@volter/browser-substrate 0.1.114 → 0.1.116
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/package-packs.js +4 -4
- package/dist/cli/package-packs.js.map +1 -1
- package/dist/shell/assets/browser-opfs-filesystem-worker-CivfnvV7.js +3 -0
- package/dist/shell/assets/{browser-sandbox-bridge-CmMlTDpO.js → browser-sandbox-bridge-BOyO6Vq0.js} +2 -2
- package/dist/shell/assets/filesystem-host-B-fDKRNE.js +3 -0
- package/dist/shell/assets/{filesystem-host-D98WfBoD.js → filesystem-host-Cngy2ePX.js} +1 -1
- package/dist/shell/assets/filesystem-worker-BQAYsjDk.js +5 -0
- package/dist/shell/assets/{fork-worker-hBikLg_q.js → fork-worker-BOu5dHuR.js} +1 -1
- package/dist/shell/assets/{node-execution-worker-961b76ab350a1c3c.js → node-execution-worker-e4ab9bf7f09262f8.js} +7 -7
- package/dist/shell/assets/{runtime-worker-DiqY2fQ4.js → runtime-worker-DH_89R1c.js} +19 -8
- package/dist/shell/assets/{sandbox-qgjYY5Gr.js → sandbox-C41DorhH.js} +1 -1
- package/dist/shell/assets/{shell-C0qfPTpQ.js → shell-CdIq-SFl.js} +4 -4
- package/dist/shell/assets/worker-BCIFrV5h.js +816 -0
- package/dist/shell/assets/worker-program-worker-BEQYJYct.js +27 -0
- package/dist/shell/bundler-worker.js +5 -5
- package/dist/shell/index.html +2 -2
- package/dist/shell/node-execution-worker.js +25 -9
- package/dist/shell/python-execution-worker.js +24 -8
- package/dist/shell/python-runtime-snapshot.bin +0 -0
- package/dist/shell/python-runtime-snapshot.json +1 -1
- package/dist/shell/rolldown/factory.mjs +20 -9
- package/dist/shell/sandbox.html +2 -2
- package/package.json +1 -1
- package/dist/shell/assets/browser-opfs-filesystem-worker-TLQsaODy.js +0 -3
- package/dist/shell/assets/filesystem-host-EfkgP9Jh.js +0 -3
- package/dist/shell/assets/filesystem-worker-51BLqPs5.js +0 -5
- package/dist/shell/assets/worker-BZ-Txq9L.js +0 -816
- package/dist/shell/assets/worker-program-worker-B_u8gbzh.js +0 -27
|
@@ -21220,10 +21220,17 @@ var implementation$1 = function bind2(that) {
|
|
|
21220
21220
|
var implementation = implementation$1;
|
|
21221
21221
|
var functionBind = Function.prototype.bind || implementation;
|
|
21222
21222
|
var functionCall = Function.prototype.call;
|
|
21223
|
-
var functionApply
|
|
21223
|
+
var functionApply;
|
|
21224
|
+
var hasRequiredFunctionApply;
|
|
21225
|
+
function requireFunctionApply() {
|
|
21226
|
+
if (hasRequiredFunctionApply) return functionApply;
|
|
21227
|
+
hasRequiredFunctionApply = 1;
|
|
21228
|
+
functionApply = Function.prototype.apply;
|
|
21229
|
+
return functionApply;
|
|
21230
|
+
}
|
|
21224
21231
|
var reflectApply = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
|
|
21225
21232
|
var bind$2 = functionBind;
|
|
21226
|
-
var $apply$1 =
|
|
21233
|
+
var $apply$1 = requireFunctionApply();
|
|
21227
21234
|
var $call$2 = functionCall;
|
|
21228
21235
|
var $reflectApply = reflectApply;
|
|
21229
21236
|
var actualApply = $reflectApply || bind$2.call($call$2, $apply$1);
|
|
@@ -21343,7 +21350,7 @@ var hasSymbols = requireHasSymbols()();
|
|
|
21343
21350
|
var getProto = requireGetProto();
|
|
21344
21351
|
var $ObjectGPO = requireObject_getPrototypeOf();
|
|
21345
21352
|
var $ReflectGPO = requireReflect_getPrototypeOf();
|
|
21346
|
-
var $apply =
|
|
21353
|
+
var $apply = requireFunctionApply();
|
|
21347
21354
|
var $call = functionCall;
|
|
21348
21355
|
var needsEval = {};
|
|
21349
21356
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
@@ -21984,7 +21991,7 @@ function requireApplyBind() {
|
|
|
21984
21991
|
if (hasRequiredApplyBind) return applyBind;
|
|
21985
21992
|
hasRequiredApplyBind = 1;
|
|
21986
21993
|
var bind3 = functionBind;
|
|
21987
|
-
var $apply2 =
|
|
21994
|
+
var $apply2 = requireFunctionApply();
|
|
21988
21995
|
var actualApply$1 = actualApply;
|
|
21989
21996
|
applyBind = function applyBind2() {
|
|
21990
21997
|
return actualApply$1(bind3, $apply2, arguments);
|
|
@@ -79884,11 +79891,15 @@ function __substrateGuestGlobal(process2) {
|
|
|
79884
79891
|
})
|
|
79885
79892
|
}
|
|
79886
79893
|
});
|
|
79887
|
-
|
|
79894
|
+
Object.defineProperties(localGlobals, {
|
|
79895
|
+
Worker: { value: void 0, writable: true, configurable: true, enumerable: true },
|
|
79896
|
+
self: { value: void 0, writable: true, configurable: true, enumerable: true }
|
|
79897
|
+
});
|
|
79898
|
+
const isLocalGlobal = (key) => ["Promise", "navigator", "Navigator", "Worker", "self"].includes(key);
|
|
79888
79899
|
guest = new Proxy(localGlobals, {
|
|
79889
79900
|
get(target, key) {
|
|
79890
79901
|
var _a3, _b3, _c3;
|
|
79891
|
-
if (["document", "window", "location"
|
|
79902
|
+
if (["document", "window", "location"].includes(key)) return void 0;
|
|
79892
79903
|
if (key === "fetch") return fetch2;
|
|
79893
79904
|
if (key === "Buffer") return buffer2 ?? loadNodeLibFor(process2, "buffer").Buffer;
|
|
79894
79905
|
if (key === "process") return process2;
|
|
@@ -81272,7 +81283,7 @@ function createRequire(vfs2, fsShim, process2, currentDir, moduleCache, options,
|
|
|
81272
81283
|
const importMetaUrl = resolvedPath.startsWith("data:") ? resolvedPath : "file://" + resolvedPath;
|
|
81273
81284
|
const strictBody = code2.startsWith(__substrateModuleMarker);
|
|
81274
81285
|
if (!scoped) code2 = __substrateScopeGlobalCalls(code2);
|
|
81275
|
-
const wrappedCode = `(function($exports, $require, $module, $filename, $dirname, $process, $console, $importMeta, $dynamicImport, __substrateGuestGlobal, __substrateGuestConstructor) { var exports = $exports; var require = $require; var module = $module; var __filename = $filename; var __dirname = $dirname; var process = $process; var console = $console; var import_meta = $importMeta; var __dynamicImport = $dynamicImport; var document = void 0, window = void 0, location = void 0
|
|
81286
|
+
const wrappedCode = `(function($exports, $require, $module, $filename, $dirname, $process, $console, $importMeta, $dynamicImport, __substrateGuestGlobal, __substrateGuestConstructor) { var exports = $exports; var require = $require; var module = $module; var __filename = $filename; var __dirname = $dirname; var process = $process; var console = $console; var import_meta = $importMeta; var __dynamicImport = $dynamicImport; var document = void 0, window = void 0, location = void 0; var globalThis = __substrateGuestGlobal($process); var global = globalThis; var Buffer = globalThis.Buffer; var queueMicrotask = globalThis.queueMicrotask, atob = globalThis.atob, btoa = globalThis.btoa, structuredClone = globalThis.structuredClone, setTimeout = globalThis.setTimeout, clearTimeout = globalThis.clearTimeout, setInterval = globalThis.setInterval, clearInterval = globalThis.clearInterval; globalThis.process = $process; global.process = $process; with ({ __proto__: null, get Worker() { return globalThis.Worker; }, set Worker(value) { globalThis.Worker = value; }, get self() { return globalThis.self; }, set self(value) { globalThis.self = value; }, get navigator() { return globalThis.navigator; }, set navigator(value) { globalThis.navigator = value; }, get Navigator() { return globalThis.Navigator; }, set Navigator(value) { globalThis.Navigator = value; }, get Promise() { return globalThis.Promise; }, set Promise(value) { globalThis.Promise = value; }, get fetch() { return globalThis.fetch; }, set fetch(value) { globalThis.fetch = value; } }) { return (function() {${code2}
|
|
81276
81287
|
}).call(${strictBody ? "void 0" : "$module.exports"}); }
|
|
81277
81288
|
})${__substrateSourceURL(resolvedPath)}`;
|
|
81278
81289
|
let bodyKind = code2.includes(__substrateTopLevelAwaitMarker) ? "async" : code2.includes(__substrateAwaitMarker) ? "generator" : "sync";
|
|
@@ -81650,7 +81661,7 @@ class Runtime {
|
|
|
81650
81661
|
const importMetaUrl = "file://" + filename;
|
|
81651
81662
|
const strictBody = code2.startsWith(__substrateModuleMarker);
|
|
81652
81663
|
code2 = __substrateScopeGlobalCalls(code2);
|
|
81653
|
-
const wrappedCode = `(function($exports, $require, $module, $filename, $dirname, $process, $console, $importMeta, $dynamicImport, __substrateGuestGlobal, __substrateGuestConstructor) { var exports = $exports; var require = $require; var module = $module; var __filename = $filename; var __dirname = $dirname; var process = $process; var console = $console; var import_meta = $importMeta; var __dynamicImport = $dynamicImport; var document = void 0, window = void 0, location = void 0
|
|
81664
|
+
const wrappedCode = `(function($exports, $require, $module, $filename, $dirname, $process, $console, $importMeta, $dynamicImport, __substrateGuestGlobal, __substrateGuestConstructor) { var exports = $exports; var require = $require; var module = $module; var __filename = $filename; var __dirname = $dirname; var process = $process; var console = $console; var import_meta = $importMeta; var __dynamicImport = $dynamicImport; var document = void 0, window = void 0, location = void 0; var globalThis = __substrateGuestGlobal($process); var global = globalThis; var Buffer = globalThis.Buffer; var queueMicrotask = globalThis.queueMicrotask, atob = globalThis.atob, btoa = globalThis.btoa, structuredClone = globalThis.structuredClone, setTimeout = globalThis.setTimeout, clearTimeout = globalThis.clearTimeout, setInterval = globalThis.setInterval, clearInterval = globalThis.clearInterval; globalThis.process = $process; global.process = $process; with ({ __proto__: null, get Worker() { return globalThis.Worker; }, set Worker(value) { globalThis.Worker = value; }, get self() { return globalThis.self; }, set self(value) { globalThis.self = value; }, get navigator() { return globalThis.navigator; }, set navigator(value) { globalThis.navigator = value; }, get Navigator() { return globalThis.Navigator; }, set Navigator(value) { globalThis.Navigator = value; }, get Promise() { return globalThis.Promise; }, set Promise(value) { globalThis.Promise = value; }, get fetch() { return globalThis.fetch; }, set fetch(value) { globalThis.fetch = value; } }) { return (function() {${code2}
|
|
81654
81665
|
}).call(${strictBody ? "void 0" : "$module.exports"}); }
|
|
81655
81666
|
})${__substrateSourceURL(filename)}`;
|
|
81656
81667
|
const dynamicImport = createDynamicImport(require2, this.process, filename.startsWith("data:") ? filename : `file://${filename}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./page-workers-BUcWBF51.js";import{i as Kr,T as Qr,a5 as Cc,a2 as Ec,a3 as Rc,h as po,a6 as Ic,a7 as Ke,a8 as yr,a9 as rt,aa as Zt,b as zn,ab as us,c as Zi,ac as Oc,ad as Mc,ae as Nc,u as kc,a as Ac,af as bt,ag as Tc,ah as mo,M as Pc}from"./browser-sandbox-bridge-
|
|
1
|
+
import"./page-workers-BUcWBF51.js";import{i as Kr,T as Qr,a5 as Cc,a2 as Ec,a3 as Rc,h as po,a6 as Ic,a7 as Ke,a8 as yr,a9 as rt,aa as Zt,b as zn,ab as us,c as Zi,ac as Oc,ad as Mc,ae as Nc,u as kc,a as Ac,af as bt,ag as Tc,ah as mo,M as Pc}from"./browser-sandbox-bridge-BOyO6Vq0.js";class pn{adapter;objects=new Map;contexts=new Map;groups=new Map;sessions=new Map;prefix=globalThis.crypto.randomUUID();sequence=0;constructor(t){this.adapter=t}forSession(t){let r=this.sessions.get(t);return r||(r=new pn(this.adapter),this.sessions.set(t,r)),r}releaseSession(t){this.sessions.get(t)?.clear(),this.sessions.delete(t)}groupFor(t){for(const[r,i]of this.groups)if(i.has(t))return r}clear(){this.objects.clear(),this.groups.clear(),this.contexts.clear();for(const t of this.sessions.values())t.clear()}contextOf(t){return this.contexts.get(t)}serialize(t,r=!1,i,n){if(t===void 0)return{type:"undefined"};if(t===null)return{type:"object",subtype:"null",value:null};if(typeof t=="number"){const d=Number.isNaN(t)?"NaN":t===1/0?"Infinity":t===-1/0?"-Infinity":Object.is(t,-0)?"-0":void 0;return d?{type:"number",unserializableValue:d}:{type:"number",value:t}}if(typeof t=="bigint")return{type:"bigint",unserializableValue:`${t}n`};if(typeof t=="string"||typeof t=="boolean")return{type:typeof t,value:t};if(typeof t=="symbol")return{type:"symbol",description:String(t)};if(r)return{type:typeof t,value:JSON.parse(JSON.stringify(t))};const u=`${this.prefix}:${++this.sequence}`;if(this.objects.set(u,t),n!==void 0&&this.contexts.set(u,n),i){const d=this.groups.get(i)??new Set;d.add(u),this.groups.set(i,d)}const c=this.adapter.describe(t);return{type:typeof t,...c,description:c.description??c.className,objectId:u}}argument(t){if(t.objectId){if(!this.objects.has(t.objectId))throw new Error(`Could not find object with given id ${t.objectId}`);return this.objects.get(t.objectId)}if(t.unserializableValue){switch(t.unserializableValue){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;case"-0":return-0}if(/^-?\d+n$/.test(t.unserializableValue))return BigInt(t.unserializableValue.slice(0,-1));throw new Error("Invalid unserializable value")}return t.value}async execute(t){if(t.sessionId!==void 0){const{sessionId:u,...c}=t;return this.forSession(u).execute(c)}const r=t.params??{},i=u=>({id:t.id,result:u}),n=typeof r.objectGroup=="string"?r.objectGroup:typeof r.objectId=="string"?this.groupFor(r.objectId):void 0;switch(t.method){case"Runtime.evaluate":{const u=typeof r.contextId=="number"?r.contextId:void 0;let c=this.adapter.evaluate(String(r.expression??""),u);return r.awaitPromise&&(c=await c),i({result:this.serialize(c,r.returnByValue===!0,n,u)})}case"Runtime.callFunctionOn":{const u=typeof r.executionContextId=="number"?r.executionContextId:typeof r.objectId=="string"?this.contextOf(r.objectId):void 0,c=typeof r.objectId=="string"?this.argument({objectId:r.objectId}):this.adapter.globalObject(u),d=Array.isArray(r.arguments)?r.arguments.map(g=>this.argument(g)):[];let o=this.adapter.invoke(String(r.functionDeclaration??"() => undefined"),c,d,u);return r.awaitPromise&&(o=await o),i({result:this.serialize(o,r.returnByValue===!0,n,u)})}case"Runtime.getProperties":{const u=this.argument({objectId:String(r.objectId??"")}),c=this.contextOf(String(r.objectId??"")),d=this.adapter.properties(u).map(({name:o,descriptor:g})=>({name:o,configurable:g.configurable??!1,enumerable:g.enumerable??!1,isOwn:!0,..."value"in g?{value:this.serialize(g.value,!1,n,c),writable:g.writable??!1}:{...g.get?{get:this.serialize(g.get,!1,n,c)}:{},...g.set?{set:this.serialize(g.set,!1,n,c)}:{}}}));return i({result:d,internalProperties:[]})}case"Runtime.releaseObject":{const u=String(r.objectId??"");this.objects.delete(u),this.contexts.delete(u);for(const c of this.groups.values())c.delete(u);return i({})}case"Runtime.releaseObjectGroup":{const u=this.groups.get(String(r.objectGroup??""));for(const c of u??[])this.objects.delete(c),this.contexts.delete(c);return this.groups.delete(String(r.objectGroup??"")),i({})}default:return}}}class Dc{backendIds=new WeakMap;backendNodes=new Map;sessions=new Map;sequence=0;backend(t){const r=this.backendIds.get(t);if(r!==void 0)return r;const i=++this.sequence;return this.backendIds.set(t,i),this.backendNodes.set(i,t),i}expose(t,r){let i=this.sessions.get(t);i||(i={ids:new WeakMap,nodes:new Map},this.sessions.set(t,i));const n=i.ids.get(r);if(n!==void 0)return n;const u=++this.sequence;return i.ids.set(r,u),i.nodes.set(u,r),this.backend(r),u}get(t,r){return this.sessions.get(t)?.nodes.get(r)}getBackend(t){return this.backendNodes.get(t)}releaseSession(t){this.sessions.delete(t)}clear(){this.sessions.clear(),this.backendNodes.clear(),this.backendIds=new WeakMap}}const Lc=4096,_c=200,Qa=128*1024,go=2e3,Fc=20,Uc=64,wt=2048,yo=64*1024,Fr=4096,qn=8e6;let es;const Za=new Set;Object.defineProperty(globalThis,"__substrateDocumentStart",{configurable:!0,value:e=>{for(const t of Za)try{t(e)}catch{}}});function $c(e){es=e}class Bc{preview;virtualPort;scriptSource;constructor(t,r){this.preview=t,this.virtualPort=r}connectProtocol(t,r){if(!es)throw new Error("This page lends no protocol surface: none is registered.");const{window:i}=this.context();return es(t,r,{window:i,documentStart:n=>{Za.add(n)},validateDocument:bo,urls:{toSurface:n=>this.surfaceUrl(n),fromSurface:n=>this.guestUrl(n),hostToSurface:n=>n==="localhost"||n==="127.0.0.1"||n===location.hostname?location.hostname:void 0,hostFromSurface:n=>n===location.hostname?"localhost":n},navigation:{navigate:n=>this.navigate(n),reload:()=>this.reload()},capture:n=>this.captureProtocolImage(n)})}guestUrl(t){let r;try{r=new URL(t)}catch{return t}if(r.origin!==location.origin)return t;const i=/^\/__virtual__\/([0-9]+)(\/.*)?$/u.exec(r.pathname),n=i?i[1]:String(this.virtualPort),u=i?i[2]??"/":r.pathname;return`http://localhost:${n}${u}${r.search}${r.hash}`}surfaceUrl(t){let r;try{r=new URL(t)}catch{return}if(r.origin===location.origin)return t;const i=r.hostname==="localhost"||r.hostname==="127.0.0.1"||r.hostname==="[::1]";if(r.protocol!=="http:"&&r.protocol!=="https:"||!i)return;const n=Number(r.port||(r.protocol==="https:"?443:80)),u=`${r.pathname}${r.search}${r.hash}`;return n===this.virtualPort?`${location.origin}${u}`:`${location.origin}/__virtual__/${n}${u}`}async captureProtocolImage(t){const r=t.format??"png";if(r!=="png"&&r!=="jpeg"&&r!=="webp")throw new Error("Unsupported preview image format.");if(t.fromSurface===!1)throw new Error("Preview capture cannot capture native surfaces.");const i=Number(t.quality??80);if(!Number.isFinite(i)||i<0||i>100)throw new Error("Invalid image quality.");const n=t.clip,u=await this.screenshot({fullPage:n!==void 0||t.captureBeyondViewport===!0});if(u.format!=="png")throw new Error("Preview could not produce PNG pixels.");const c=n?.x??0,d=n?.y??0,o=n?.width??u.width,g=n?.height??u.height,s=n?.scale??1;if(![c,d,o,g,s].every(Number.isFinite)||c<0||d<0||o<=0||g<=0||s<=0)throw new Error("Invalid preview capture clip.");if(c+o>u.width||d+g>u.height)throw new Error("Requested clip exceeds the bounded inspector capture.");const m=Math.min(1,Number(t.maxWidth??o)/o,Number(t.maxHeight??g)/g);if(!Number.isFinite(m)||m<=0)throw new Error("Invalid preview capture dimensions.");const l=Math.max(1,Math.round(o*s*m)),a=Math.max(1,Math.round(g*s*m));if(l>Fr||a>Fr||l*a>qn)throw new Error("Requested image exceeds the inspector capture limits.");const h=await wo(u.dataUrl),f=document.createElement("canvas");f.width=l,f.height=a;const y=f.getContext("2d");if(!y)throw new Error("Canvas rendering is unavailable.");y.drawImage(h,c,d,o,g,0,0,l,a);const R=f.toDataURL(`image/${r}`,i/100);if(!R.startsWith(`data:image/${r};`))throw new Error("Requested image encoder is unavailable.");const{window:x}=this.context();return{data:R.slice(R.indexOf(",")+1),deviceWidth:x.innerWidth,deviceHeight:x.innerHeight,scrollOffsetX:x.scrollX,scrollOffsetY:x.scrollY,timestamp:Date.now()/1e3}}loaded(){this.context(),this.scriptSource!==void 0&&this.installScript(this.scriptSource)}async execute(t){if(!Number.isSafeInteger(t.id)||t.id<1)throw new Error("Invalid preview command identifier.");switch(t.operation){case"snapshot":return this.snapshot();case"query":return this.query(t.selector);case"screenshot":return this.screenshot(t.fullPage===void 0?{}:{fullPage:t.fullPage});case"navigate":return this.navigate(t.url);case"reload":return this.reload();case"network-idle":return this.networkIdle(t.idleMs,t.timeoutMs);case"set-script":return this.setScript(t.source);case"evaluate":{if(typeof t.source!="string"||t.source.length>yo)throw new Error("Preview evaluation exceeds 64 KiB.");const{window:r}=this.context(),n=await new r.Function("args","preview",`return (async () => { ${t.source}
|
|
2
2
|
})();`)(t.args,{screenshot:c=>this.screenshot(c)}),u=JSON.stringify(n??null);if(u.length>1024*1024)throw new Error("Preview evaluation result exceeds 1 MiB.");return JSON.parse(u)}}}snapshot(){const{document:t,window:r}=this.context(),i=t.documentElement,n=t.body,u=Math.max(i.scrollWidth,i.clientWidth,n?.scrollWidth??0,n?.clientWidth??0),c=Math.max(i.scrollHeight,i.clientHeight,n?.scrollHeight??0,n?.clientHeight??0);return{url:r.location.href,title:t.title.slice(0,4096),readyState:t.readyState,text:(n?.innerText??"").slice(0,Qa),viewport:{width:r.innerWidth,height:r.innerHeight,devicePixelRatio:r.devicePixelRatio},document:{width:u,height:c,scrollX:r.scrollX,scrollY:r.scrollY,overflowX:u>r.innerWidth,overflowY:c>r.innerHeight},accessibility:jc(t)}}query(t){if(typeof t!="string"||t.length===0||t.length>Lc)throw new Error("Preview selector must contain 1..4096 characters.");const{document:r,window:i}=this.context();let n;try{n=r.querySelectorAll(t)}catch{throw new Error("Preview selector is invalid.")}return[...n].slice(0,_c).map(u=>Wc(u,i))}async screenshot(t={}){if(t.fullPage!==void 0&&typeof t.fullPage!="boolean")throw new Error("Invalid fullPage screenshot option.");const{document:r,window:i}=this.context(),n=r.documentElement;let u=Math.min(Fr,Math.max(1,t.fullPage===!1?i.innerWidth:n.scrollWidth,i.innerWidth)),c=Math.min(Fr,Math.max(1,t.fullPage===!1?i.innerHeight:n.scrollHeight,i.innerHeight));const d=u*c;if(d>qn){const a=Math.sqrt(qn/d);u=Math.max(1,Math.floor(u*a)),c=Math.max(1,Math.floor(c*a))}const o=Gc(n);t.fullPage===!1&&(o.style.transform=`translate(${-i.scrollX}px, ${-i.scrollY}px)`,o.style.transformOrigin="top left");const g=new XMLSerializer().serializeToString(o);if(g.length>32*1024*1024)throw new Error("Screenshot DOM exceeds 32 MiB.");const s=`<svg xmlns="http://www.w3.org/2000/svg" width="${u}" height="${c}"><foreignObject width="100%" height="100%">${g}</foreignObject></svg>`,m=Hn(s),l="DOM reconstruction; images the page may not read, external fonts, embedded media and native compositor effects are omitted";try{const a=await wo(m),h=r.createElement("canvas");h.width=u,h.height=c;const f=h.getContext("2d");if(!f)throw new Error("Canvas rendering is unavailable.");const y=w=>w==="rgba(0, 0, 0, 0)"||w==="transparent",R=i.getComputedStyle(n).backgroundColor,x=y(R)?i.getComputedStyle(r.body??n).backgroundColor:R;f.fillStyle=y(x)?"#ffffff":x,f.fillRect(0,0,u,c),f.drawImage(a,0,0,u,c);try{return{dataUrl:h.toDataURL("image/png"),format:"png",width:u,height:c,fidelity:l}}catch{return{dataUrl:Hn(s),format:"svg",width:u,height:c,fidelity:l}}}catch{return{dataUrl:Hn(s),format:"svg",width:u,height:c,fidelity:l}}}async navigate(t){if(typeof t!="string"||t.length===0||t.length>16384)throw new Error("Preview navigation target is invalid.");const r=this.preview.src||`${location.origin}/`,i=/^\/__virtual__\/([0-9]+)\//u.exec(r.startsWith("about:")?"":new URL(r).pathname),n=new URL(i?`/__virtual__/${i[1]}/`:"/",location.origin),u=t.startsWith("/")?new URL(t.slice(1),n):new URL(t,r),c=/^\/__virtual__\/[0-9]+\//u.test(u.pathname);if(u.origin!==location.origin||!(u.pathname.startsWith(n.pathname)||c))throw new Error("Preview navigation cannot leave its virtual application.");return await this.load(u.href),{url:this.context().window.location.href}}async reload(){const t=this.preview.contentWindow;let r=this.preview.src;try{r=t?.location.href||r}catch{}return await this.load(r,()=>{try{t.location.reload()}catch{this.preview.src=r}}),{url:this.context().window.location.href}}async networkIdle(t=500,r=1e4){if(!Number.isSafeInteger(t)||t<0||t>5e3||!Number.isSafeInteger(r)||r<1||r>3e4)throw new Error("Preview network-idle bounds are invalid.");const i=Date.now()+r;for(;Date.now()<i;){const n=this.context().window.__browserRuntimeNetworkState,u=n?.lastChanged??0,c=Date.now()-u;if((n?.pending??0)===0&&c>=t)return{idleForMs:c};await Xc(Math.min(50,Math.max(1,i-Date.now())))}throw new Error("Preview did not reach network idle before the timeout.")}setScript(t){if(t!==void 0&&(typeof t!="string"||t.length>yo))throw new Error("Preview instrumentation exceeds 64 KiB.");return this.scriptSource=t,t!==void 0&&this.installScript(t),{installed:t!==void 0}}installScript(t){const{document:r}=this.context();r.querySelectorAll("script[data-browser-runtime-instrumentation]").forEach(n=>n.remove());const i=r.createElement("script");i.dataset.browserRuntimeInstrumentation="",i.textContent=t,(r.head??r.documentElement).append(i)}load(t,r=()=>{this.preview.src=t}){return new Promise((i,n)=>{const u=setTimeout(()=>d(new Error("Preview navigation timed out.")),15e3),c=()=>d(),d=o=>{clearTimeout(u),this.preview.removeEventListener("load",c),o?n(o):i()};this.preview.addEventListener("load",c,{once:!0}),r()})}context(){const t=this.preview.contentWindow,r=this.preview.contentDocument;if(!t||!r)throw new Error("Generated preview is unavailable.");return bo(r),{document:r,window:t}}}function bo(e){if(e.querySelector('meta[name="browser-substrate-host"]'))throw new Error("Preview routing failed: a host document was returned instead of the generated app.")}function Wc(e,t){const r=e,i=e.getBoundingClientRect(),n=t.getComputedStyle(e),u={};for(const c of[...e.attributes].slice(0,Uc))u[c.name]=c.value.slice(0,wt);return{tag:e.tagName.toLowerCase(),...e.id?{id:e.id.slice(0,wt)}:{},classes:[...e.classList].slice(0,64),...ts(e)?{role:ts(e)}:{},...rs(e)?{name:rs(e)}:{},text:(r.innerText??e.textContent??"").trim().slice(0,Qa),visible:n.display!=="none"&&n.visibility!=="hidden"&&Number.parseFloat(n.opacity||"1")>0&&i.width>0&&i.height>0,box:Vc(i),attributes:u}}function jc(e){const t=[...e.querySelectorAll("a,button,input,select,textarea,summary,[role],[aria-label],h1,h2,h3,h4,h5,h6,main,nav,aside,header,footer,form,table")];let r=go;const i=new Set(t.slice(0,go)),n=[],u=new Map;for(const d of i){const o=zc(d,i);if(!o)n.push(d);else{const g=u.get(o)??[];g.push(d),u.set(o,g)}}const c=(d,o)=>{if(r--<=0||o>Fc)return;const g=ts(d);if(!g)return;const s=(u.get(d)??[]).map(h=>c(h,o+1)).filter(h=>!!h),m=Hc(d.getAttribute("aria-checked")??(d.tagName==="INPUT"&&new Set(["checkbox","radio"]).has(d.type)?String(d.checked):null)),l=el(d.getAttribute("aria-expanded")),a=/^h[1-6]$/iu.test(d.tagName)?Number(d.tagName.slice(1)):void 0;return{role:g,name:rs(d),tag:d.tagName.toLowerCase(),...d.disabled===!0||d.getAttribute("aria-disabled")==="true"?{disabled:!0}:{},...m!==void 0?{checked:m}:{},...l!==void 0?{expanded:l}:{},...a!==void 0?{level:a}:{},...s.length>0?{children:s}:{}}};return n.map(d=>c(d,0)).filter(d=>!!d)}function zc(e,t){let r=e.parentElement;for(;r;){if(t.has(r))return r;r=r.parentElement}}function ts(e){const t=e.getAttribute("role");if(t)return t.split(/\s+/u)[0]??"";const r=e.tagName.toLowerCase();return/^h[1-6]$/u.test(r)?"heading":{a:e.hasAttribute("href")?"link":"generic",button:"button",input:qc(e),select:"combobox",textarea:"textbox",summary:"button",main:"main",nav:"navigation",aside:"complementary",header:"banner",footer:"contentinfo",form:"form",table:"table"}[r]??""}function qc(e){return e.type==="checkbox"?"checkbox":e.type==="radio"?"radio":e.type==="range"?"slider":e.type==="button"||e.type==="submit"||e.type==="reset"?"button":"textbox"}function rs(e){const t=e.getAttribute("aria-label");if(t)return t.slice(0,wt);const r=e.getAttribute("aria-labelledby");if(r){const n=r.split(/\s+/u).map(u=>e.ownerDocument.getElementById(u)?.textContent?.trim()??"").filter(Boolean).join(" ");if(n)return n.slice(0,wt)}if(e.tagName==="IMG"&&e.alt)return e.alt.slice(0,wt);if(e.tagName==="INPUT"){const n=e,u=n.labels?.[0]?.textContent?.trim();if(u)return u.slice(0,wt);if(n.value&&new Set(["button","submit","reset"]).has(n.type))return n.value.slice(0,wt);if(n.placeholder)return n.placeholder.slice(0,wt)}const i=e.getAttribute("title");return i?i.slice(0,wt):(e.textContent??"").trim().replace(/\s+/gu," ").slice(0,wt)}function el(e){if(e==="true")return!0;if(e==="false")return!1}function Hc(e){return e==="mixed"?"mixed":el(e)}function Vc(e){return{x:e.x,y:e.y,width:e.width,height:e.height}}function wo(e){return new Promise((t,r)=>{const i=new Image;i.onload=()=>t(i),i.onerror=()=>r(new Error("The serialized preview could not be rendered.")),i.src=e})}function Hn(e){return`data:image/svg+xml;base64,${Kr(new TextEncoder().encode(e))}`}function Gc(e){const t=e.ownerDocument;let r=0;const i=(n,u)=>{if(n.nodeType===3)return t.createTextNode(n.nodeValue??"");if(n.nodeType!==1)return;const c=n,d=c.localName;if(/^(script|object|embed|video|audio|source|link|template|noscript)$/u.test(d))return;if(++r>5e3)throw new Error("Screenshot DOM exceeds 5000 elements.");if(d==="style")return u||/@import|url\s*\(/iu.test(c.textContent??"")?void 0:c.cloneNode(!0);const o=c.ownerDocument.defaultView.getComputedStyle(c),g=Array.from(o).map(a=>{const h=o.getPropertyValue(a);return/url\s*\(/iu.test(h)?"":`${a}:${h};`}).join("");if(d==="iframe"){let a=null;try{a=c.contentDocument}catch{a=null}const h=a?.documentElement?i(a.documentElement,!0):void 0;if(!h)return;const f=t.createElement("div");return f.setAttribute("style",`${g}overflow:hidden;contain:paint;${o.display==="inline"?"display:inline-block;":""}`),f.append(h),f}if(d==="canvas"){const a=c;try{const h=t.createElement("img");return h.src=a.toDataURL("image/png"),h.width=a.width,h.height=a.height,h.setAttribute("style",g),h}catch{return}}const s=c.cloneNode(!1);if(s.setAttribute("style",g),d==="input")s.setAttribute("value",c.value),s.toggleAttribute("checked",c.checked);else{if(d==="textarea")return s.textContent=c.value,s;if(d==="option")s.toggleAttribute("selected",c.selected);else if(d==="img"){const a=c;if(s.removeAttribute("srcset"),!(s.getAttribute("src")??"").startsWith("data:")&&(s.removeAttribute("src"),a.complete&&a.naturalWidth))try{const h=t.createElement("canvas");h.width=a.naturalWidth,h.height=a.naturalHeight,h.getContext("2d")?.drawImage(a,0,0),s.setAttribute("src",h.toDataURL("image/png"))}catch{}}}const m=c.shadowRoot,l=m?m.childNodes:d==="slot"&&c.getRootNode()!==c.ownerDocument?c.assignedNodes({flatten:!0}):c.childNodes;for(const a of l){const h=i(a,u||m!==null);h&&s.appendChild(h)}return s};return i(e,!1)}function Xc(e){return new Promise(t=>setTimeout(t,e))}const er=new URLSearchParams(location.search),tl=new URL(er.get("parentOrigin")||"").origin,ur=er.get("nonce")||"",pt=Number.parseInt(er.get("port")||"",10),vo=pt===0,Ct=document.querySelector("#generated-preview"),ns=new Bc(Ct,pt);let $t;window.addEventListener("pagehide",()=>{$t?.close(),Ye("protocol-disconnect")});const ds=1e4,Ur=new Map,cr=new Map,So=64*1024,Jc=8*1024*1024,Yc=64*1024*1024,xo=(e,t)=>`${location.origin}${e===pt||e===0?"":`/__virtual__/${e}`}${t}`,rl=er.get("clear")==="1"||er.get("clear")==="reuse",Kc=er.get("clear")==="reuse";if(!ur||!rl&&(!Number.isSafeInteger(pt)||pt<0||pt>65535))throw new Error("Invalid sandbox bootstrap parameters.");const Qc="<script>(function(s){try{var h=parent.__substrateDocumentStart;if(h)h(window)}catch(e){}if(s)s.remove()})(document.currentScript)<\/script>";async function Zc(){localStorage.clear(),sessionStorage.clear();for(const i of await indexedDB.databases())i.name&&indexedDB.deleteDatabase(i.name);for(const i of await caches.keys())await caches.delete(i);const e=globalThis.cookieStore;if(e)for(const i of await e.getAll())await e.delete({name:i.name,...i.path?{path:i.path}:{},...i.domain?{domain:i.domain}:{}});const t=await navigator.storage.getDirectory();for await(const i of t.keys())await t.removeEntry(i,{recursive:!0});const r=`${location.origin}/__sw__.js`;for(const i of await navigator.serviceWorker.getRegistrations()){const n=(i.active??i.waiting??i.installing)?.scriptURL;Kc&&i.scope===`${location.origin}/`&&n===r||await i.unregister()}}function Ye(e,t){window.parent.postMessage({channel:Qr,nonce:ur,type:e,payload:t},tl)}async function eu(){const e=await navigator.serviceWorker.register("/__sw__.js",{scope:"/",updateViaCache:"none"});await e.update();const t=e.installing||e.waiting||e.active;if(!t)throw new Error("Sandbox service worker registration failed.");return t.state!=="activated"&&await tu(t,"activated"),t}function tu(e,t){return new Promise((r,i)=>{const n=globalThis.setTimeout(()=>c(new Error(`Sandbox service worker did not reach ${t}.`)),ds),u=()=>{e.state===t?c():e.state==="redundant"&&c(new Error("Sandbox service worker became redundant during startup."))},c=d=>{globalThis.clearTimeout(n),e.removeEventListener("statechange",u),d?i(d):r()};e.addEventListener("statechange",u),u()})}function ru(e){return navigator.serviceWorker.controller===e?Promise.resolve():new Promise((t,r)=>{const i=globalThis.setTimeout(()=>u(new Error("Sandbox service worker did not take control.")),ds),n=()=>{navigator.serviceWorker.controller===e&&u()},u=c=>{globalThis.clearTimeout(i),navigator.serviceWorker.removeEventListener("controllerchange",n),c?r(c):t()};navigator.serviceWorker.addEventListener("controllerchange",n),n()})}function Co(){try{ns.loaded(),Ye("preview-load")}catch(e){$t?.close(),$t=void 0,Ye("error",{message:e instanceof Error?e.message:String(e)})}}function Eo(e){return e==="document"||e==="iframe"||e==="frame"}function $r(e,t){return t?[{type:"stream-start",id:e,data:{statusCode:204,statusMessage:"No Content",headers:{}}},{type:"stream-end",id:e}]:[{type:"response",id:e,data:{statusCode:204,statusMessage:"No Content",headers:{},bodyBase64:""}}]}async function nu(){const e=await eu();let t;const r=new Cc(await Ec(`sandbox:${pt}`).then(d=>(Rc(window,d),d)));async function i(d){if((d?.type==="stream-pull"||d?.type==="stream-cancel")&&Number.isSafeInteger(d.id)&&cr.has(d.id)){const a=cr.get(d.id);if(d.type==="stream-cancel"){cr.delete(d.id);return}const h=a.shift();h&&t.postMessage({type:"stream-chunk",id:d.id,data:{chunkBase64:Kr(h)}}),a.length||(cr.delete(d.id),t.postMessage({type:"stream-end",id:d.id}));return}d?.type==="stream-cancel"&&Number.isSafeInteger(d.id)&&r.forget(d.id),r.request(d);const o=d?.data,g=$t?.network;if(d?.type!=="request"||!g||!o||!o.destination||!Number.isSafeInteger(d.id)||typeof o.url!="string"||typeof o.method!="string"||!Number.isSafeInteger(o.port)){Ye("request",d);return}const s=d.id,m=xo(o.port,o.url);let l;try{l=await g.request(String(s),{url:m,method:o.method,headers:Object.entries(o.headers??{}),destination:o.destination,...o.body&&o.body.byteLength?{body:new Uint8Array(o.body)}:{}})}catch{Ye("request",d);return}if(l.type==="fulfill"){const a={};for(const[f,y]of l.headers)a[f]=a[f]===void 0?y:`${a[f]}, ${y}`;l={...l,body:Ic(l.body,a,void 0)};const h=l.headers.filter(([f])=>f.toLowerCase()==="set-cookie").map(([,f])=>f);if(r.answer({type:"response",id:s,data:{headers:h.length?{"set-cookie":h}:{}}}),o.flowControl){const f=[];for(let y=0;y<l.body.byteLength;y+=So)f.push(l.body.subarray(y,y+So));t.postMessage({type:"stream-start",id:s,data:{statusCode:l.status,statusMessage:l.statusText,headers:a}}),f.length?cr.set(s,f):t.postMessage({type:"stream-end",id:s})}else o.streaming?(t.postMessage({type:"stream-start",id:s,data:{statusCode:l.status,statusMessage:l.statusText,headers:a}}),l.body.byteLength&&t.postMessage({type:"stream-chunk",id:s,data:{chunkBase64:Kr(l.body)}}),t.postMessage({type:"stream-end",id:s})):t.postMessage({type:"response",id:s,data:{statusCode:l.status,statusMessage:l.statusText,headers:a,bodyBase64:Kr(l.body)}});return}if(l.type==="fail"){if(r.forget(s),Eo(o.destination))for(const a of $r(s,!!(o.streaming||o.flowControl)))t.postMessage(a);else t.postMessage({type:o.streaming?"stream-error":"response",id:s,error:l.reason});return}if(l.url)try{const a=new URL(l.url),h=Number(a.port||(a.protocol==="https:"?443:80));if(a.pathname.startsWith("/__virtual__/")){const f=/^\/__virtual__\/([0-9]+)(\/.*)?$/u.exec(a.pathname);f&&(o.port=Number(f[1]),o.url=`${f[2]??"/"}${a.search}`)}else a.origin===location.origin?(o.port=pt,o.url=`${a.pathname}${a.search}`):(o.port=h,o.url=`${a.pathname}${a.search}`)}catch{}l.method&&(o.method=l.method),l.headers&&(o.headers=Object.fromEntries(l.headers)),l.postData&&(o.body=l.postData.slice().buffer),Ur.set(s,{url:xo(o.port,o.url),chunks:[],size:0,document:Eo(o.destination),streaming:!!(o.streaming||o.flowControl),flowControl:!!o.flowControl}),Ye("request",d)}function n(d){return/is not listening/u.test(String(d))?"net::ERR_CONNECTION_REFUSED":"net::ERR_FAILED"}function u(d){const o=d,g=$t?.network;if(!o||!Number.isSafeInteger(o.id)||!Ur.has(o.id))return;const s=Ur.get(o.id),m=String(o.id),l=y=>Object.fromEntries(Object.entries(y??{}).map(([R,x])=>[R,Array.isArray(x)?x.join(", "):String(x)])),a=()=>{Ur.delete(o.id)};if(o.error||o.type==="stream-error")return g?.failed(m,n(o.error)),a(),s.download?[]:s.document?$r(o.id,s.streaming):void 0;const h=()=>s.download?Yc:Jc,f=()=>{s.download&&s.flowControl&&Ye("request",{type:"stream-pull",id:o.id})};if(o.type==="response"){g?.responded(m,{status:o.data?.statusCode??200,statusText:o.data?.statusMessage??"",headers:l(o.data?.headers),url:s.url})&&(s.download=!0);const R=o.data?.bodyBase64?po(o.data.bodyBase64):new Uint8Array;if(g?.finished(m,R.byteLength<=h()?R:void 0),a(),s.download)return $r(o.id,!1)}else if(o.type==="stream-start"){if(g?.responded(m,{status:o.data?.statusCode??200,statusText:o.data?.statusMessage??"",headers:l(o.data?.headers),url:s.url}))return s.download=!0,f(),$r(o.id,!0)}else if(o.type==="stream-chunk"&&o.data?.chunkBase64){const y=po(o.data.chunkBase64);if(s.size+=y.byteLength,s.size<=h()&&s.chunks.push(y),s.download)return f(),[]}else if(o.type==="stream-end"){let y;if(s.size<=h()){y=new Uint8Array(s.size);let R=0;for(const x of s.chunks)y.set(x,R),R+=x.byteLength}if(g?.finished(m,y),a(),s.download)return[]}}async function c(){const d=new MessageChannel;t=d.port1,r.reset();const o=new Promise((g,s)=>{const m=globalThis.setTimeout(()=>s(new Error("Sandbox service worker bridge timed out.")),ds);d.port1.onmessage=l=>{if(l.data?.type==="bridge-ready"){globalThis.clearTimeout(m),g();return}i(l.data)}});e.postMessage({type:"init",data:{ownDocuments:[location.pathname,"/node-host.html","/python-host.html"],documentPrelude:Qc}},[d.port2]),await o,vo||e.postMessage({type:"server-registered",data:{port:pt,hostname:"0.0.0.0",primary:!0}})}window.addEventListener("message",d=>{if(d.origin===tl&&d.source===window.parent){const o=d.data;if(o.channel===Qr&&o.nonce===ur&&o.type==="protocol-connect"){const g=o.payload?.id,s=d.ports[0];if(!s||d.ports.length!==1||typeof g!="string"||!/^[a-zA-Z0-9_-]{1,128}$/u.test(g)){for(const m of d.ports)m.close();return}try{$t?.close(),$t=ns.connectProtocol(s,g),s.postMessage({type:"protocol-ready",id:g})}catch(m){s.postMessage({type:"close",code:1011,reason:m instanceof Error?m.message:String(m)}),s.close()}return}if(o.channel===Qr&&o.nonce===ur&&o.type==="response"){const g=o.payload?.type;if(typeof g=="string"&&g.startsWith("websocket-"))Ct.contentWindow?.postMessage(o.payload,location.origin);else{r.answer(o.payload);for(const s of u(o.payload)??[o.payload])t.postMessage(s)}}if(o.channel===Qr&&o.nonce===ur&&o.type==="command"){const g=o.payload;ns.execute(g).then(s=>Ye("command-result",{id:g.id,result:s}),s=>Ye("command-result",{id:g?.id,error:s instanceof Error?s.message:String(s)}))}d.data?.channel==="vite-hmr"&&Ct.contentWindow?.postMessage(d.data,location.origin);return}if(d.source===Ct.contentWindow&&d.data?.type==="browser-agent-preview-load")Co();else if(d.source===Ct.contentWindow&&d.data?.type==="browser-agent-rendered")Ye("rendered",{revision:String(d.data.revision)});else if(d.source===Ct.contentWindow&&d.data?.type==="browser-agent-observation")Ye("observation",d.data.observation);else if(d.source===Ct.contentWindow&&typeof d.data?.type=="string"&&d.data.type.startsWith("websocket-")){const o=d.data;o.data?.port===0&&(o.data.port=pt),Ye("request",d.data)}}),navigator.serviceWorker.addEventListener("message",d=>{d.data?.type==="sw-needs-init"&&c().catch(o=>Ye("error",{message:o instanceof Error?o.message:String(o)}))}),await c(),await ru(e),Ct.addEventListener("load",Co),Ct.src=vo?"about:blank":`${location.origin}/`,Ye("ready",{documentId:crypto.randomUUID(),url:`${location.origin}/__virtual__/${pt}/`})}rl?Zc().then(()=>Ye("cleared"),e=>Ye("error",{message:e instanceof Error?e.message:String(e)})):nu().catch(e=>Ye("error",{message:e instanceof Error?e.message:String(e)}));var sn={},iu=Object.defineProperty,su=(e,t,r)=>t in e?iu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,X=(e,t,r)=>su(e,typeof t!="symbol"?t+"":t,r),Ro,ou=Object.defineProperty,au=(e,t,r)=>t in e?ou(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Io=(e,t,r)=>au(e,typeof t!="symbol"?t+"":t,r),He=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(He||{});const Oo={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Mo={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Br={},nl={},lu=()=>!!globalThis.Zone;function fs(e){if(Br[e])return Br[e];const t=globalThis[e],r=t.prototype,i=e in Oo?Oo[e]:void 0,n=!!(i&&i.every(d=>{var o,g;return!!((g=(o=Object.getOwnPropertyDescriptor(r,d))==null?void 0:o.get)!=null&&g.toString().includes("[native code]"))})),u=e in Mo?Mo[e]:void 0,c=!!(u&&u.every(d=>{var o;return typeof r[d]=="function"&&((o=r[d])==null?void 0:o.toString().includes("[native code]"))}));if(n&&c&&!lu())return Br[e]=t.prototype,t.prototype;try{const d=document.createElement("iframe");d.style.display="none",document.body.appendChild(d);const o=d.contentWindow;if(!o)return t.prototype;const g=o[e].prototype;if(!g)return d.remove(),r;const s=navigator.userAgent;return s.includes("Safari")&&!s.includes("Chrome")?(d.classList.add("rr-block"),d.setAttribute("__rrwebUntaintedMutationObserver",""),nl[e]=()=>d.remove()):d.remove(),Br[e]=g}catch{return r}}const Vn={};function ot(e,t,r){var i,n;const u=(i=Vn[e])==null?void 0:i[r];if(u)return u.call(t);const c=fs(e),d=(n=Object.getOwnPropertyDescriptor(c,r))==null?void 0:n.get;return d?((Vn[e]||(Vn[e]={}))[r]=d,d.call(t)):t[r]}const Gn={};function il(e,t,r){const i=`${e}.${String(r)}`;if(Gn[i])return Gn[i].bind(t);const u=fs(e)[r];return typeof u!="function"?t[r]:(Gn[i]=u,u.bind(t))}function cu(e){return ot("Node",e,"ownerDocument")}function uu(e){return ot("Node",e,"childNodes")}function du(e){return ot("Node",e,"parentNode")}function fu(e){return ot("Node",e,"parentElement")}function hu(e){return ot("Node",e,"textContent")}function pu(e){return ot("Node",e,"firstChild")}function mu(e){return ot("Node",e,"lastChild")}function gu(e){return ot("Node",e,"nextSibling")}function yu(e){return ot("Node",e,"previousSibling")}function bu(e,t){return il("Node",e,"contains")(t)}function wu(e){return il("Node",e,"getRootNode")()}function vu(e){return!e||!("host"in e)?null:ot("ShadowRoot",e,"host")}function Su(e){return e.styleSheets}function xu(e){return!e||!("shadowRoot"in e)?null:ot("Element",e,"shadowRoot")}function Cu(e,t){return ot("Element",e,"querySelector")(t)}function Eu(e,t){return ot("Element",e,"querySelectorAll")(t)}function Ru(){return[fs("MutationObserver").constructor,nl.MutationObserver??(()=>{})]}let sl=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(sl=()=>new Date().getTime());function Iu(e,t,r){try{if(!(t in e))return()=>{};const i=e[t],n=r(i);return typeof n=="function"&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=n,()=>{e[t]=i}}catch{return()=>{}}}const Ze={ownerDocument:cu,childNodes:uu,parentNode:du,parentElement:fu,textContent:hu,firstChild:pu,lastChild:mu,nextSibling:gu,previousSibling:yu,contains:bu,getRootNode:wu,host:vu,styleSheets:Su,shadowRoot:xu,querySelector:Cu,querySelectorAll:Eu,nowTimestamp:sl,mutationObserverCtor:Ru,patch:Iu};function ol(e){return e.nodeType===e.ELEMENT_NODE}function dr(e){const t=e&&"host"in e&&"mode"in e&&Ze.host(e)||null;return!!(t&&"shadowRoot"in t&&Ze.shadowRoot(t)===e)}function fr(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Ou(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Mu(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function is(e){try{const t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);const i=Array.from(t,n=>al(n,r)).join("");return Ou(i)}catch{return null}}function al(e,t){if(ku(e)){let r;try{r=is(e.styleSheet)||Mu(e)}catch{r=e.cssText}return e.styleSheet.href?ln(r,e.styleSheet.href):r}else{let r=e.cssText;return Au(e)&&e.selectorText.includes(":")&&(r=Nu(r)),t?ln(r,t):r}}function Nu(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function ku(e){return"styleSheet"in e}function Au(e){return"selectorText"in e}class ll{constructor(){Io(this,"idNodeMap",new Map),Io(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(i=>this.removeNodeFromMap(i))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const i=r.id;this.idNodeMap.set(i,t),this.nodeMetaMap.set(t,r)}replace(t,r){const i=this.getNode(t);if(i){const n=this.nodeMetaMap.get(i);n&&this.nodeMetaMap.set(r,n)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function Tu(){return new ll}function on({element:e,maskInputOptions:t,tagName:r,type:i,value:n,maskInputFn:u}){let c=n||"";const d=i&&Nt(i);return(t[r.toLowerCase()]||d&&t[d])&&(u?c=u(c,e):c="*".repeat(c.length)),c}function Nt(e){return e.toLowerCase()}const No="__rrweb_original__";function Pu(e){const t=e.getContext("2d");if(!t)return!0;const r=50;for(let i=0;i<e.width;i+=r)for(let n=0;n<e.height;n+=r){const u=t.getImageData,c=No in u?u[No]:u;if(new Uint32Array(c.call(t,i,n,Math.min(r,e.width-i),Math.min(r,e.height-n)).data.buffer).some(o=>o!==0))return!1}return!0}function an(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Nt(t):null}function cl(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}const i=/\.([0-9a-z]+)(?:$)/i,n=r.pathname.match(i);return n?.[1]??null}function Du(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}const Lu=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,_u=/^(?:[a-z+]+:)?\/\//i,Fu=/^www\..*/i,Uu=/^(data:)([^,]*),(.*)/i;function ln(e,t){return(e||"").replace(Lu,(r,i,n,u,c,d)=>{const o=n||c||d,g=i||u||"";if(!o)return r;if(_u.test(o)||Fu.test(o))return`url(${g}${o}${g})`;if(Uu.test(o))return`url(${g}${o}${g})`;if(o[0]==="/")return`url(${g}${Du(t)+o}${g})`;const s=o.split("#")[0],m=o.substring(s.length),l=t.split("#")[0].split("/"),a=s.split("/");l.pop();for(const h of a)h!=="."&&(h===".."?l.pop():l.push(h));return`url(${g}${l.join("/")}${m}${g})`})}function Wr(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function $u(e,t,r=!1){const i=Array.from(t.childNodes),n=[];let u=0;if(i.length>1&&e&&typeof e=="string"){let c=Wr(e,r);const d=c.length/e.length;for(let o=1;o<i.length;o++)if(i[o].textContent&&typeof i[o].textContent=="string"){const g=Wr(i[o].textContent,r),s=100;let m=3;for(;m<g.length&&(g[m].match(/[a-zA-Z0-9]/)||g.indexOf(g.substring(0,m),1)!==-1);m++);for(;m<g.length;m++){let l=g.substring(0,m),a=c.split(l),h=-1;if(a.length===2)h=a[0].length;else if(a.length>2&&a[0]===""&&i[o-1].textContent!=="")h=c.indexOf(l,1);else if(a.length===1){if(l=l.substring(0,l.length-1),a=c.split(l),a.length<=1)return n.push(e),n;m=s+1}else m===g.length-1&&(h=c.indexOf(l));if(a.length>=2&&m>s){const f=i[o-1].textContent;if(f&&typeof f=="string"){const y=Wr(f).length;h=c.indexOf(l,y)}h===-1&&(h=a[0].length)}if(h!==-1){let f=Math.floor(h/d);for(;f>0&&f<e.length;){if(u+=1,u>50*i.length)return n.push(e),n;const y=Wr(e.substring(0,f),r);if(y.length===h){n.push(e.substring(0,f)),e=e.substring(f),c=c.substring(h);break}else y.length<h?f+=Math.max(1,Math.floor((h-y.length)/d)):f-=Math.max(1,Math.floor((y.length-h)*d))}break}}}}return n.push(e),n}function Bu(e,t){return $u(e,t).join("/* rr_split */")}let Wu=1;const ju=new RegExp("[^a-z0-9-_:]"),cn=-2;function ul(){return Wu++}function zu(e){if(e instanceof HTMLFormElement)return"form";const t=Nt(e.tagName);return ju.test(t)?"div":t}let Gt,ko;const qu=/^[^ \t\n\r\u000c]+/,Hu=/^[, \t\n\r\u000c]+/;function Vu(e,t){if(t.trim()==="")return t;let r=0;function i(u){let c;const d=u.exec(t.substring(r));return d?(c=d[0],r+=c.length,c):""}const n=[];for(;i(Hu),!(r>=t.length);){let u=i(qu);if(u.slice(-1)===",")u=Yt(e,u.substring(0,u.length-1)),n.push(u);else{let c="";u=Yt(e,u);let d=!1;for(;;){const o=t.charAt(r);if(o===""){n.push((u+c).trim());break}else if(d)o===")"&&(d=!1);else if(o===","){r+=1,n.push((u+c).trim());break}else o==="("&&(d=!0);c+=o,r+=1}}}return n.join(", ")}const Ao=new WeakMap;function Yt(e,t){return!t||t.trim()===""?t:hs(e,t)}function Gu(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function hs(e,t){let r=Ao.get(e);if(r||(r=e.createElement("a"),Ao.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function dl(e,t,r,i){return i&&(r==="src"||r==="href"&&!(t==="use"&&i[0]==="#")||r==="xlink:href"&&i[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?Yt(e,i):r==="srcset"?Vu(e,i):r==="style"?ln(i,hs(e)):t==="object"&&r==="data"?Yt(e,i):i)}function fl(e,t,r){return["video","audio"].includes(e)&&Nt(t)==="autoplay"}function Xu(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let i=e.classList.length;i--;){const n=e.classList[i];if(t.test(n))return!0}if(r)return e.matches(r)}catch{}return!1}function un(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?un(Ze.parentNode(e),t,r):!1;for(let i=e.classList.length;i--;){const n=e.classList[i];if(t.test(n))return!0}return r?un(Ze.parentNode(e),t,r):!1}function hl(e,t,r,i){let n;if(ol(e)){if(n=e,!Ze.childNodes(n).length)return!1}else{if(Ze.parentElement(e)===null)return!1;n=Ze.parentElement(e)}try{if(typeof t=="string"){if(i){if(n.closest(`.${t}`))return!0}else if(n.classList.contains(t))return!0}else if(un(n,t,i))return!0;if(r){if(i){if(n.closest(r))return!0}else if(n.matches(r))return!0}}catch{}return!1}function Ju(e,t,r){const i=e.contentWindow;if(!i)return;let n=!1,u;try{u=i.document.readyState}catch{return}if(u!=="complete"){const d=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(d),n=!0,t()});return}const c="about:blank";if(i.location.href!==c||e.src===c||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Yu(e,t,r){let i=!1,n;try{n=e.sheet}catch{return}if(n)return;const u=setTimeout(()=>{i||(t(),i=!0)},r);e.addEventListener("load",()=>{clearTimeout(u),i=!0,t()})}function Ku(e,t){const{doc:r,mirror:i,blockClass:n,blockSelector:u,needsMask:c,inlineStylesheet:d,maskInputOptions:o={},maskTextFn:g,maskInputFn:s,dataURLOptions:m={},inlineImages:l,recordCanvas:a,keepIframeSrcFn:h,newlyAddedElement:f=!1,cssCaptured:y=!1}=t,R=Qu(r,i);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:He.Document,childNodes:[],compatMode:e.compatMode}:{type:He.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:He.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:R};case e.ELEMENT_NODE:return ed(e,{doc:r,blockClass:n,blockSelector:u,inlineStylesheet:d,maskInputOptions:o,maskInputFn:s,dataURLOptions:m,inlineImages:l,recordCanvas:a,keepIframeSrcFn:h,newlyAddedElement:f,rootId:R});case e.TEXT_NODE:return Zu(e,{doc:r,needsMask:c,maskTextFn:g,rootId:R,cssCaptured:y});case e.CDATA_SECTION_NODE:return{type:He.CDATA,textContent:"",rootId:R};case e.COMMENT_NODE:return{type:He.Comment,textContent:Ze.textContent(e)||"",rootId:R};default:return!1}}function Qu(e,t){if(!t.hasNode(e))return;const r=t.getId(e);return r===1?void 0:r}function Zu(e,t){const{needsMask:r,maskTextFn:i,rootId:n,cssCaptured:u}=t,c=Ze.parentNode(e),d=c&&c.tagName;let o="";const g=d==="STYLE"?!0:void 0,s=d==="SCRIPT"?!0:void 0;return s?o="SCRIPT_PLACEHOLDER":u||(o=Ze.textContent(e),g&&o&&(o=ln(o,hs(t.doc)))),!g&&!s&&o&&r&&(o=i?i(o,Ze.parentElement(e)):o.replace(/[\S]/g,"*")),{type:He.Text,textContent:o||"",rootId:n}}function ed(e,t){const{doc:r,blockClass:i,blockSelector:n,inlineStylesheet:u,maskInputOptions:c={},maskInputFn:d,dataURLOptions:o={},inlineImages:g,recordCanvas:s,keepIframeSrcFn:m,newlyAddedElement:l=!1,rootId:a}=t,h=Xu(e,i,n),f=zu(e);let y={};const R=e.attributes.length;for(let w=0;w<R;w++){const S=e.attributes[w];fl(f,S.name,S.value)||(y[S.name]=dl(r,f,Nt(S.name),S.value))}if(f==="link"&&u){const w=Array.from(r.styleSheets).find(v=>v.href===e.href);let S=null;w&&(S=is(w)),S&&(delete y.rel,delete y.href,y._cssText=S)}if(f==="style"&&e.sheet){let w=is(e.sheet);w&&(e.childNodes.length>1&&(w=Bu(w,e)),y._cssText=w)}if(["input","textarea","select"].includes(f)){const w=e.value,S=e.checked;y.type!=="radio"&&y.type!=="checkbox"&&y.type!=="submit"&&y.type!=="button"&&w?y.value=on({element:e,type:an(e),tagName:f,value:w,maskInputOptions:c,maskInputFn:d}):S&&(y.checked=S)}if(f==="option"&&(e.selected&&!c.select?y.selected=!0:delete y.selected),f==="dialog"&&e.open&&(y.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),f==="canvas"&&s){if(e.__context==="2d")Pu(e)||(y.rr_dataURL=e.toDataURL(o.type,o.quality));else if(!("__context"in e)){const w=e.toDataURL(o.type,o.quality),S=r.createElement("canvas");S.width=e.width,S.height=e.height;const v=S.toDataURL(o.type,o.quality);w!==v&&(y.rr_dataURL=w)}}if(f==="img"&&g){Gt||(Gt=r.createElement("canvas"),ko=Gt.getContext("2d"));const w=e,S=w.currentSrc||w.getAttribute("src")||"<unknown-src>",v=w.crossOrigin,E=()=>{w.removeEventListener("load",E);try{Gt.width=w.naturalWidth,Gt.height=w.naturalHeight,ko.drawImage(w,0,0),y.rr_dataURL=Gt.toDataURL(o.type,o.quality)}catch(O){if(w.crossOrigin!=="anonymous"){w.crossOrigin="anonymous",w.complete&&w.naturalWidth!==0?E():w.addEventListener("load",E);return}else console.warn(`Cannot inline img src=${S}! Error: ${O}`)}w.crossOrigin==="anonymous"&&(v?y.crossOrigin=v:w.removeAttribute("crossorigin"))};w.complete&&w.naturalWidth!==0?E():w.addEventListener("load",E)}if(["audio","video"].includes(f)){const w=y;w.rr_mediaState=e.paused?"paused":"played",w.rr_mediaCurrentTime=e.currentTime,w.rr_mediaPlaybackRate=e.playbackRate,w.rr_mediaMuted=e.muted,w.rr_mediaLoop=e.loop,w.rr_mediaVolume=e.volume}if(l||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop)),h){const{width:w,height:S}=e.getBoundingClientRect();y={class:y.class,rr_width:`${w}px`,rr_height:`${S}px`}}f==="iframe"&&!m(y.src)&&(e.contentDocument||(y.rr_src=y.src),delete y.src);let x;try{customElements.get(f)&&(x=!0)}catch{}return{type:He.Element,tagName:f,attributes:y,childNodes:[],isSVG:Gu(e)||void 0,needBlock:h,rootId:a,isCustom:x}}function De(e){return e==null?"":e.toLowerCase()}function pl(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function td(e,t){if(t.comment&&e.type===He.Comment)return!0;if(e.type===He.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&cl(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(De(e.attributes.name).match(/^msapplication-tile(image|color)$/)||De(e.attributes.name)==="application-name"||De(e.attributes.rel)==="icon"||De(e.attributes.rel)==="apple-touch-icon"||De(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&De(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(De(e.attributes.property).match(/^(og|twitter|fb):/)||De(e.attributes.name).match(/^(og|twitter):/)||De(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(De(e.attributes.name)==="robots"||De(e.attributes.name)==="googlebot"||De(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(De(e.attributes.name)==="author"||De(e.attributes.name)==="generator"||De(e.attributes.name)==="framework"||De(e.attributes.name)==="publisher"||De(e.attributes.name)==="progid"||De(e.attributes.property).match(/^article:/)||De(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(De(e.attributes.name)==="google-site-verification"||De(e.attributes.name)==="yandex-verification"||De(e.attributes.name)==="csrf-token"||De(e.attributes.name)==="p:domain_verify"||De(e.attributes.name)==="verify-v1"||De(e.attributes.name)==="verification"||De(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Kt(e,t){const{doc:r,mirror:i,blockClass:n,blockSelector:u,maskTextClass:c,maskTextSelector:d,skipChild:o=!1,inlineStylesheet:g=!0,maskInputOptions:s={},maskTextFn:m,maskInputFn:l,slimDOMOptions:a,dataURLOptions:h={},inlineImages:f=!1,recordCanvas:y=!1,onSerialize:R,onIframeLoad:x,iframeLoadTimeout:w=5e3,onStylesheetLoad:S,stylesheetLoadTimeout:v=5e3,keepIframeSrcFn:E=()=>!1,newlyAddedElement:O=!1,cssCaptured:A=!1}=t;let{needsMask:k}=t,{preserveWhiteSpace:N=!0}=t;k||(k=hl(e,c,d,k===void 0));const _=Ku(e,{doc:r,mirror:i,blockClass:n,blockSelector:u,needsMask:k,inlineStylesheet:g,maskInputOptions:s,maskTextFn:m,maskInputFn:l,dataURLOptions:h,inlineImages:f,recordCanvas:y,keepIframeSrcFn:E,newlyAddedElement:O,cssCaptured:A});if(!_)return console.warn(e,"not serialized"),null;let z;i.hasNode(e)?z=i.getId(e):td(_,a)||!N&&_.type===He.Text&&!_.textContent.replace(/^\s+|\s+$/gm,"").length?z=cn:z=ul();const T=Object.assign(_,{id:z});if(i.add(e,T),z===cn)return null;R&&R(e);let ye=!o;if(T.type===He.Element){ye=ye&&!T.needBlock,delete T.needBlock;const se=Ze.shadowRoot(e);se&&fr(se)&&(T.isShadowHost=!0)}if((T.type===He.Document||T.type===He.Element)&&ye){a.headWhitespace&&T.type===He.Element&&T.tagName==="head"&&(N=!1);const se={doc:r,mirror:i,blockClass:n,blockSelector:u,needsMask:k,maskTextClass:c,maskTextSelector:d,skipChild:o,inlineStylesheet:g,maskInputOptions:s,maskTextFn:m,maskInputFn:l,slimDOMOptions:a,dataURLOptions:h,inlineImages:f,recordCanvas:y,preserveWhiteSpace:N,onSerialize:R,onIframeLoad:x,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:v,keepIframeSrcFn:E,cssCaptured:!1};if(!(T.type===He.Element&&T.tagName==="textarea"&&T.attributes.value!==void 0)){T.type===He.Element&&T.attributes._cssText!==void 0&&typeof T.attributes._cssText=="string"&&(se.cssCaptured=!0);for(const pe of Array.from(Ze.childNodes(e))){const Ie=Kt(pe,se);Ie&&T.childNodes.push(Ie)}}let ie=null;if(ol(e)&&(ie=Ze.shadowRoot(e)))for(const pe of Array.from(Ze.childNodes(ie))){const Ie=Kt(pe,se);Ie&&(fr(ie)&&(Ie.isShadow=!0),T.childNodes.push(Ie))}}const be=Ze.parentNode(e);return be&&dr(be)&&fr(be)&&(T.isShadow=!0),T.type===He.Element&&T.tagName==="iframe"&&Ju(e,()=>{const se=e.contentDocument;if(se&&x){const ie=Kt(se,{doc:se,mirror:i,blockClass:n,blockSelector:u,needsMask:k,maskTextClass:c,maskTextSelector:d,skipChild:!1,inlineStylesheet:g,maskInputOptions:s,maskTextFn:m,maskInputFn:l,slimDOMOptions:a,dataURLOptions:h,inlineImages:f,recordCanvas:y,preserveWhiteSpace:N,onSerialize:R,onIframeLoad:x,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:v,keepIframeSrcFn:E});ie&&x(e,ie)}},w),T.type===He.Element&&T.tagName==="link"&&typeof T.attributes.rel=="string"&&(T.attributes.rel==="stylesheet"||T.attributes.rel==="preload"&&typeof T.attributes.href=="string"&&cl(T.attributes.href)==="css")&&Yu(e,()=>{if(S){const se=Kt(e,{doc:r,mirror:i,blockClass:n,blockSelector:u,needsMask:k,maskTextClass:c,maskTextSelector:d,skipChild:!1,inlineStylesheet:g,maskInputOptions:s,maskTextFn:m,maskInputFn:l,slimDOMOptions:a,dataURLOptions:h,inlineImages:f,recordCanvas:y,preserveWhiteSpace:N,onSerialize:R,onIframeLoad:x,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:v,keepIframeSrcFn:E});se&&S(e,se)}},v),T}function rd(e,t){const{mirror:r=new ll,blockClass:i="rr-block",blockSelector:n=null,maskTextClass:u="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,inlineImages:o=!1,recordCanvas:g=!1,maskAllInputs:s=!1,maskTextFn:m,maskInputFn:l,slimDOM:a=!1,dataURLOptions:h,preserveWhiteSpace:f,onSerialize:y,onIframeLoad:R,iframeLoadTimeout:x,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:v=()=>!1}=t,E=s===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:s===!1?{password:!0}:s,O=pl(a);return Kt(e,{doc:e,mirror:r,blockClass:i,blockSelector:n,maskTextClass:u,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:E,maskTextFn:m,maskInputFn:l,slimDOMOptions:O,dataURLOptions:h,inlineImages:o,recordCanvas:g,preserveWhiteSpace:f,onSerialize:y,onIframeLoad:R,iframeLoadTimeout:x,onStylesheetLoad:w,stylesheetLoadTimeout:S,keepIframeSrcFn:v,newlyAddedElement:!1})}function nd(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function id(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}),r}var jr={exports:{}},To;function sd(){if(To)return jr.exports;To=1;var e=String,t=function(){return{isColorSupported:!1,reset:e,bold:e,dim:e,italic:e,underline:e,inverse:e,hidden:e,strikethrough:e,black:e,red:e,green:e,yellow:e,blue:e,magenta:e,cyan:e,white:e,gray:e,bgBlack:e,bgRed:e,bgGreen:e,bgYellow:e,bgBlue:e,bgMagenta:e,bgCyan:e,bgWhite:e}};return jr.exports=t(),jr.exports.createColors=t,jr.exports}const od={},ad=Object.freeze(Object.defineProperty({__proto__:null,default:od},Symbol.toStringTag,{value:"Module"})),mt=id(ad);var Xn,Po;function ps(){if(Po)return Xn;Po=1;let e=sd(),t=mt;class r extends Error{constructor(n,u,c,d,o,g){super(n),this.name="CssSyntaxError",this.reason=n,o&&(this.file=o),d&&(this.source=d),g&&(this.plugin=g),typeof u<"u"&&typeof c<"u"&&(typeof u=="number"?(this.line=u,this.column=c):(this.line=u.line,this.column=u.column,this.endLine=c.line,this.endColumn=c.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,r)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(n){if(!this.source)return"";let u=this.source;n==null&&(n=e.isColorSupported),t&&n&&(u=t(u));let c=u.split(/\r?\n/),d=Math.max(this.line-3,0),o=Math.min(this.line+2,c.length),g=String(o).length,s,m;if(n){let{bold:l,gray:a,red:h}=e.createColors(!0);s=f=>l(h(f)),m=f=>a(f)}else s=m=l=>l;return c.slice(d,o).map((l,a)=>{let h=d+1+a,f=" "+(" "+h).slice(-g)+" | ";if(h===this.line){let y=m(f.replace(/\d/g," "))+l.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+m(f)+l+`
|
|
3
3
|
`+y+s("^")}return" "+m(f)+l}).join(`
|
|
4
4
|
`)}toString(){let n=this.showSourceCode();return n&&(n=`
|