(function () { function boot() { if (!window.AutoAdOS || !window.AutoAdOS.cfg) return false; const A = window.AutoAdOS; if (A._booted) return true; A._booted = true; const cfg = A.cfg; const SERVE_URL = cfg.serve; const PING_URL = cfg.ping; const POLL_MS = cfg.pollMs || 5000; if (!SERVE_URL) return false; A._served = A._served || {}; A._scanTimer = null; function ping(slots) { if (!PING_URL || !slots.length) return; fetch(PING_URL, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ slots }) }).catch(() => {}); } function serve(el) { const slot = el.dataset.autoAdosSlot; if (!slot) return; const last = A._served[slot] || 0; const now = Date.now(); if (now - last < (cfg.lockMs || 15000)) return; const ctx = el.dataset.context || ''; fetch(`${SERVE_URL}?slot=${encodeURIComponent(slot)}&context=${encodeURIComponent(ctx)}`) .then(r => r.json()) .then(res => { if (res && res.html) { el.innerHTML = res.html; A._served[slot] = Date.now(); } }) .catch(() => {}); } function scan() { const nodes = document.querySelectorAll('[data-auto-ados-slot]'); if (!nodes.length) return; const slots =