"use strict"; globalThis.__obscura_errors = []; globalThis.addEventListener = globalThis.addEventListener || function(){}; globalThis.onunhandledrejection = function(e) { if (e?.preventDefault) e.preventDefault(); }; globalThis.onerror = function(msg, src, line, col, error) { globalThis.__obscura_errors.push({msg: String(msg), src: String(src||""), line, error: String(error||"")}); }; globalThis.__windowListeners = {}; globalThis.addEventListener = function(type, fn) { if (!globalThis.__windowListeners[type]) globalThis.__windowListeners[type] = []; globalThis.__windowListeners[type].push(fn); }; globalThis.removeEventListener = function(type, fn) { if (globalThis.__windowListeners[type]) { globalThis.__windowListeners[type] = globalThis.__windowListeners[type].filter(h => h !== fn); } }; globalThis.dispatchEvent = function(event) { if (!event) return true; const handlers = globalThis.__windowListeners[event.type] || []; for (const h of handlers) { try { h.call(globalThis, event); } catch(e) { console.error(e); } } return !event.defaultPrevented; }; const _dom = (cmd, a1, a2) => Deno.core.ops.op_dom(cmd, String(a1 ?? ""), String(a2 ?? "")); const _nativeFns = new Set(); const _origToString = Function.prototype.toString; Function.prototype.toString = function() { if (_nativeFns.has(this)) { return `function ${this.name || ''}() { [native code] }`; } return _origToString.call(this); }; function _markNative(fn) { if (typeof fn === 'function') _nativeFns.add(fn); return fn; } _nativeFns.add(Function.prototype.toString); [Error, TypeError, ReferenceError, SyntaxError, RangeError, URIError, EvalError].forEach(E => { try { Object.defineProperty(E.prototype, 'name', { value: E.name, writable: true, enumerable: false, configurable: false, }); } catch(e) {} }); const _stackCache = new WeakMap(); const _origStackDesc = Object.getOwnPropertyDescriptor(Error.prototype, 'stack'); if (_origStackDesc && _origStackDesc.get) { Object.defineProperty(Error.prototype, 'stack', { configurable: false, enumerable: false, get: function() { if (!_stackCache.has(this)) _stackCache.set(this, _origStackDesc.get.call(this)); return _stackCache.get(this); } }); } let _fpSeed = 0; function _fpRand(salt) { let h = (_fpSeed ^ (salt || 0)) | 0; h = Math.imul(h ^ (h >>> 16), 0x45d9f3b); h = Math.imul(h ^ (h >>> 13), 0x45d9f3b); return ((h ^ (h >>> 16)) >>> 0) / 0xFFFFFFFF; } function _fpNoise(x, y, channel) { return (_fpRand(x * 7919 + y * 6271 + channel * 8923) - 0.5) * 4; } var _fpCache = null; function _getFp() { if (_fpCache) return _fpCache; const gpuPool = [ 'ANGLE (NVIDIA, NVIDIA GeForce RTX 3060 Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (NVIDIA, NVIDIA GeForce GTX 1660 SUPER Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (NVIDIA, NVIDIA GeForce RTX 2070 SUPER Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (Intel, Intel(R) UHD Graphics 630 Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (Intel, Intel(R) Iris(R) Xe Graphics Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (AMD, AMD Radeon RX 580 Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (AMD, AMD Radeon RX 6700 XT Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (NVIDIA, NVIDIA GeForce RTX 4070 Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (NVIDIA, NVIDIA GeForce GTX 1080 Ti Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (Intel, Intel(R) UHD Graphics 770 Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (AMD, AMD Radeon RX 5700 XT Direct3D11 vs_5_0 ps_5_0, D3D11)', 'ANGLE (NVIDIA, NVIDIA GeForce RTX 3080 Direct3D11 vs_5_0 ps_5_0, D3D11)', ]; const gpuVendorPool = [ 'Google Inc. (NVIDIA)','Google Inc. (NVIDIA)','Google Inc. (NVIDIA)', 'Google Inc. (Intel)','Google Inc. (Intel)', 'Google Inc. (AMD)','Google Inc. (AMD)', 'Google Inc. (NVIDIA)','Google Inc. (NVIDIA)', 'Google Inc. (Intel)','Google Inc. (AMD)','Google Inc. (NVIDIA)', ]; const idx = Math.floor(_fpRand(42) * gpuPool.length); const screenPool = [[1920,1080],[2560,1440],[1366,768],[1536,864],[1440,900],[1680,1050],[1280,720],[3840,2160]]; const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; let cfp = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUg'; for (let i = 0; i < 40; i++) cfp += chars[Math.floor(_fpRand(500 + i) * 64)]; cfp += '=='; _fpCache = { gpu: gpuPool[idx], gpuVendor: gpuVendorPool[idx], audioBaseLatency: 0.002 + _fpRand(100) * 0.008, audioSampleRate: [44100, 48000][Math.floor(_fpRand(101) * 2)], compThreshold: -24 + (_fpRand(102) - 0.5) * 4, compKnee: 30 + (_fpRand(103) - 0.5) * 4, compRatio: 12 + (_fpRand(104) - 0.5) * 4, batteryLevel: 0.5 + _fpRand(200) * 0.5, batteryCharging: _fpRand(201) > 0.3, screen: screenPool[Math.floor(_fpRand(300) * screenPool.length)], canvasFingerprint: cfp, }; return _fpCache; } function _fp(key) { return _getFp()[key]; } globalThis._eventRegistry = globalThis._eventRegistry || {}; globalThis._formValues = globalThis._formValues || {}; globalThis._formChecked = globalThis._formChecked || {}; const _eventRegistry = globalThis._eventRegistry; const _formValues = globalThis._formValues; const _formChecked = globalThis._formChecked; const _domParse = (cmd, a1, a2) => { try { return JSON.parse(_dom(cmd, a1, a2)); } catch { return null; } }; const _consoleFn = (level, args) => { try { Deno.core.ops.op_console_msg(level, args.map(a => { if (a === null) return "null"; if (a === undefined) return "undefined"; if (a instanceof Error) return a.stack || a.message || String(a); if (typeof a === "object") { try { const s = JSON.stringify(a); return s === "{}" && a.message ? a.message : s; } catch { return String(a); } } return String(a); }).join(" ")); } catch {} }; globalThis.console = { log: (...a) => _consoleFn("log", a), warn: (...a) => _consoleFn("warn", a), error: (...a) => _consoleFn("error", a), info: (...a) => _consoleFn("log", a), debug: () => {}, dir: () => {}, trace: () => {}, table: () => {}, group: () => {}, groupEnd: () => {}, groupCollapsed: () => {}, time: () => {}, timeEnd: () => {}, timeLog: () => {}, count: () => {}, countReset: () => {}, clear: () => {}, assert: (c, ...a) => { if (!c) _consoleFn("error", ["Assertion failed:", ...a]); }, }; let _tid = 0; const _clearedTimers = new Set(); const _intervals = new Set(); const _scheduleAfter = (delay, fn) => { const d = Math.max(0, Number(delay) || 0); if (d === 0) Promise.resolve().then(fn); else Deno.core.ops.op_sleep(d).then(fn); }; globalThis.setTimeout = (fn, delay = 0, ...args) => { if (typeof fn !== "function") return ++_tid; const id = ++_tid; _scheduleAfter(delay, () => { if (_clearedTimers.has(id)) return; try { fn(...args); } catch(e) { console.error("Timer error:", e); } }); return id; }; globalThis.clearTimeout = (id) => { _clearedTimers.add(id); }; globalThis.setInterval = (fn, delay = 0, ...args) => { if (typeof fn !== "function") return ++_tid; const id = ++_tid; _intervals.add(id); const tick = () => { if (!_intervals.has(id)) return; try { fn(...args); } catch(e) { console.error("Interval error:", e); } if (!_intervals.has(id)) return; _scheduleAfter(delay, tick); }; _scheduleAfter(delay, tick); return id; }; globalThis.clearInterval = (id) => { _intervals.delete(id); _clearedTimers.add(id); }; globalThis.requestAnimationFrame = (fn) => setTimeout(fn, 0); globalThis.cancelAnimationFrame = globalThis.clearTimeout; globalThis.queueMicrotask = globalThis.queueMicrotask || ((fn) => Promise.resolve().then(fn)); class MessageChannel { constructor() { this.port1 = { onmessage: null, postMessage: () => {}, close() {}, addEventListener() {}, removeEventListener() {} }; this.port2 = { onmessage: null, postMessage: () => {}, close() {}, addEventListener() {}, removeEventListener() {} }; this.port1.postMessage = (data) => { Promise.resolve().then(() => { if (this.port2.onmessage) this.port2.onmessage({ data }); }); }; this.port2.postMessage = (data) => { Promise.resolve().then(() => { if (this.port1.onmessage) this.port1.onmessage({ data }); }); }; } } globalThis.MessageChannel = MessageChannel; globalThis.MessagePort = class MessagePort { constructor(){} postMessage(){} close(){} addEventListener(){} removeEventListener(){} }; class CSSStyleDeclaration { constructor() { this._props = {}; } setProperty(name, value) { this._props[name] = String(value); } removeProperty(name) { const old = this._props[name]; delete this._props[name]; return old || ""; } getPropertyValue(name) { return this._props[name] || ""; } get cssText() { return Object.entries(this._props).map(([k,v]) => `${k}: ${v}`).join("; "); } set cssText(v) { this._props = {}; if(v) v.split(";").forEach(p => { const [k,...rest]=p.split(":"); if(k&&rest.length) this._props[k.trim()]=rest.join(":").trim(); }); } get length() { return Object.keys(this._props).length; } item(i) { return Object.keys(this._props)[i] || ""; } } const _styleProxy = (decl) => new Proxy(decl, { get(t, p) { if (typeof p === "symbol" || p in t) return t[p]; if (typeof p === "string") return t._props[p] || ""; return undefined; }, set(t, p, v) { if (typeof p === "string") { t._props[p] = String(v); return true; } t[p] = v; return true; } }); class Node { static ELEMENT_NODE = 1; static TEXT_NODE = 3; static COMMENT_NODE = 8; static DOCUMENT_NODE = 9; static DOCUMENT_FRAGMENT_NODE = 11; constructor(nid) { this._nid = nid; } get nodeType() { return +_dom("node_type", this._nid); } get nodeName() { return _domParse("node_name", this._nid) || ""; } get ownerDocument() { return globalThis.document; } get textContent() { return _domParse("text_content", this._nid) ?? ""; } set textContent(v) { const oldChildren = _domParse("child_nodes", this._nid) || []; for (const c of oldChildren) _dom("remove_child", c); let added = []; if (v != null && v !== "") { const tn = +_dom("create_text_node", String(v)); _dom("append_child", this._nid, tn); added = [tn]; } // Real MutationObserver fires childList for the children swap. // Without this React 18+ hydration mismatch detection and many polling // libs (intersection-driven lazy load, content sync) silently stall. if (globalThis.__mutationObservers?.length) { globalThis.__notifyMutation('childList', this._nid, added, oldChildren); } } get nodeValue() { const t = this.nodeType; if (t === 3 || t === 8) return _domParse("text_content", this._nid) ?? ""; return null; } set nodeValue(v) { const t = this.nodeType; if (t === 3 || t === 8) _dom("set_text_content", this._nid, String(v ?? "")); } get parentNode() { return _wrap(+_dom("parent_node", this._nid)); } get parentElement() { const p = this.parentNode; return p && p.nodeType === 1 ? p : null; } get childNodes() { const ids = _domParse("child_nodes", this._nid) || []; const list = ids.map(_wrap).filter(Boolean); list.item = (i) => list[i] || null; return list; } get firstChild() { return _wrap(+_dom("first_child", this._nid)); } get lastChild() { return _wrap(+_dom("last_child", this._nid)); } get nextSibling() { return _wrap(+_dom("next_sibling", this._nid)); } get previousSibling() { return _wrap(+_dom("prev_sibling", this._nid)); } appendChild(c) { if (!c) return c; _dom("append_child", this._nid, c._nid); if (globalThis.__mutationObservers?.length) globalThis.__notifyMutation('childList', this._nid, [c._nid], []); if (c instanceof Element && c.tagName === 'SCRIPT') { const scriptType = c.getAttribute('type') || ''; const isModule = scriptType === 'module'; if (scriptType && !isModule && scriptType !== 'text/javascript' && scriptType !== 'application/javascript') { return c; } const src = c.getAttribute('src'); const prevNid = globalThis.__currentScriptNid; if (src) { const fullUrl = src.startsWith('http') || src.startsWith('data:') ? src : new URL(src, globalThis.location?.href || 'http://localhost/').href; const pageOrigin = (function() { try { return new URL(globalThis.location?.href || "about:blank").origin; } catch(e) { return ""; } })(); (async () => { try { if (isModule) { await import(fullUrl); } else { const raw = await Deno.core.ops.op_fetch_url(fullUrl, "GET", "{}", "", pageOrigin, "no-cors"); const parsed = JSON.parse(raw); if (parsed.body) { globalThis.__currentScriptNid = c._nid; try { (0, eval)(parsed.body); } catch(e) { console.error('Dynamic script error (' + fullUrl + '):', e.message); } finally { globalThis.__currentScriptNid = prevNid || 0; } } } if (typeof c.onload === 'function') try { c.onload(new Event('load')); } catch(e) {} try { c.dispatchEvent(new Event('load')); } catch(e) {} } catch(e) { console.error('Dynamic script fetch error:', e.message); if (typeof c.onerror === 'function') try { c.onerror(e); } catch(ex) {} } })(); } else { const code = c.textContent; if (code) { if (isModule) { const dataUrl = 'data:text/javascript;base64,' + btoa(unescape(encodeURIComponent(code))); (async () => { try { await import(dataUrl); } catch(e) { console.error('Dynamic inline module error:', e.message); } })(); } else { globalThis.__currentScriptNid = c._nid; try { (0, eval)(code); } catch(e) { console.error('Dynamic inline script error:', e.message); } finally { globalThis.__currentScriptNid = prevNid || 0; } } } } } return c; } removeChild(c) { if (!c) return c; _dom("remove_child", c._nid); if (globalThis.__mutationObservers?.length) globalThis.__notifyMutation('childList', this._nid, [], [c._nid]); return c; } replaceChild(newChild, oldChild) { if (!oldChild || !newChild) return oldChild; _dom("insert_before", newChild._nid, oldChild._nid); _dom("remove_child", oldChild._nid); return oldChild; } insertBefore(n, ref) { if (!n) return n; if (!ref) { this.appendChild(n); return n; } _dom("insert_before", n._nid, ref._nid); return n; } contains(o) { return o ? _dom("contains", this._nid, o._nid) === "true" : false; } hasChildNodes() { return _dom("has_child_nodes", this._nid) === "true"; } cloneNode(deep) { const t = this.nodeType; if (t === 1) { if (deep) { const wrapper = document.createElement('div'); wrapper.innerHTML = _domParse("outer_html", this._nid) || ""; const clone = wrapper.firstChild; return clone; } const el = document.createElement(this.nodeName.toLowerCase()); const html = _domParse("outer_html", this._nid) || ""; const attrMatch = html.match(/^<[a-zA-Z][^\s>]*([\s\S]*?)>/); if (attrMatch && attrMatch[1]) { const attrStr = attrMatch[1].trim(); const re = /([a-zA-Z_:][a-zA-Z0-9_.:-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|(\S+)))?/g; let m; while ((m = re.exec(attrStr)) !== null) { const name = m[1]; const val = m[2] !== undefined ? m[2] : m[3] !== undefined ? m[3] : m[4] || ""; if (name !== this.nodeName.toLowerCase()) el.setAttribute(name, val); } } return el; } if (t === 3) return document.createTextNode(this.textContent); if (t === 8) return document.createComment(this.nodeValue || ""); return null; } compareDocumentPosition(other) { if (!other) return 0; if (this._nid === other._nid) return 0; if (this.contains(other)) return 16 | 4; // DOCUMENT_POSITION_CONTAINED_BY | FOLLOWING if (other.contains && other.contains(this)) return 8 | 2; // DOCUMENT_POSITION_CONTAINS | PRECEDING return 4; // DOCUMENT_POSITION_FOLLOWING } getRootNode() { return globalThis.document; } normalize() {} // no-op isEqualNode(other) { if (!other) return false; if (this._nid === other._nid) return true; if (this.nodeType !== other.nodeType) return false; if (this.nodeName !== other.nodeName) return false; if (this.nodeValue !== other.nodeValue) return false; const a = this.attributes ? this.attributes : null; const b = other.attributes ? other.attributes : null; if ((a && a.length) || (b && b.length)) { if (!a || !b || a.length !== b.length) return false; for (let i = 0; i < a.length; i++) { if (other.getAttribute(a[i].name) !== a[i].value) return false; } } const cA = this.childNodes || []; const cB = other.childNodes || []; if (cA.length !== cB.length) return false; for (let i = 0; i < cA.length; i++) { if (!cA[i].isEqualNode(cB[i])) return false; } return true; } isSameNode(other) { return other && this._nid === other._nid; } addEventListener() {} removeEventListener() {} dispatchEvent() { return true; } } class CharacterData extends Node { get data() { return _domParse("text_content", this._nid) ?? ""; } set data(v) { const oldValue = _domParse("text_content", this._nid) ?? ""; _dom("set_text_content", this._nid, String(v ?? "")); if (globalThis.__mutationObservers?.length) { globalThis.__notifyMutation('characterData', this._nid, [], [], null, oldValue); } } get length() { return this.data.length; } substringData(offset, count) { return this.data.substring(offset, offset + count); } appendData(s) { this.data += s; } insertData(offset, s) { const d = this.data; this.data = d.slice(0, offset) + s + d.slice(offset); } deleteData(offset, count) { const d = this.data; this.data = d.slice(0, offset) + d.slice(offset + count); } replaceData(offset, count, s) { const d = this.data; this.data = d.slice(0, offset) + s + d.slice(offset + count); } } class Text extends CharacterData { get nodeName() { return "#text"; } get nodeType() { return 3; } get wholeText() { return this.data; } splitText(offset) { const d = this.data; const tail = d.substring(offset); this.data = d.substring(0, offset); const newNid = +_dom("create_text_node", tail); const parent = this.parentNode; if (parent) { const ref = this.nextSibling; parent.insertBefore(_wrap(newNid), ref); } return _wrap(newNid); } cloneNode() { return document.createTextNode(this.data); } } class Comment extends CharacterData { get nodeName() { return "#comment"; } get nodeType() { return 8; } cloneNode() { return document.createComment(this.data); } } class Element extends Node { constructor(nid) { super(nid); this._style = _styleProxy(new CSSStyleDeclaration()); } get tagName() { return _domParse("tag_name", this._nid) || ""; } get localName() { return (this.tagName || "").toLowerCase(); } get id() { return this.getAttribute("id") || ""; } set id(v) { this.setAttribute("id", v); } get className() { return this.getAttribute("class") || ""; } set className(v) { this.setAttribute("class", v); } get namespaceURI() { const tag = this.localName; if (tag === "svg" || this._ns === "http://www.w3.org/2000/svg") return "http://www.w3.org/2000/svg"; return "http://www.w3.org/1999/xhtml"; } get innerHTML() { return _domParse("inner_html", this._nid) ?? ""; } set innerHTML(v) { if (this.localName === 'template') { this.content.innerHTML = v; return; } // Capture the children that are about to be replaced so we can deliver // them as `removedNodes` in the MutationObserver record. Without this, // libraries that mutate via `innerHTML =` (jQuery's `.html(s)`, React // `dangerouslySetInnerHTML`, vue-style content swaps) silently bypass // every MutationObserver subscriber and downstream hydration / polling // logic stalls. let oldChildren = []; let newChildren = []; if (globalThis.__mutationObservers?.length) { oldChildren = _domParse("child_nodes", this._nid) || []; } _dom("set_inner_html", this._nid, String(v ?? "")); if (globalThis.__mutationObservers?.length) { newChildren = _domParse("child_nodes", this._nid) || []; globalThis.__notifyMutation('childList', this._nid, newChildren, oldChildren); } } get outerHTML() { return _domParse("outer_html", this._nid) ?? ""; } get innerText() { return this.textContent; } set innerText(v) { this.textContent = v; } get children() { const ids = _domParse("element_children", this._nid) || []; return ids.map(_wrapEl).filter(Boolean); } get content() { //