@webqit/oohtml 2.0.0 → 2.0.2

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/scoped-js.js CHANGED
@@ -1,8 +1,8 @@
1
- (()=>{function oe(i={}){let t={runtimeParams:{...Pe,...i.runtimeParams||{}},compilerParams:{...Te,...i.compilerParams||{}},parserParams:{...Ie,...i.parserParams||{}}};return i.devMode,t}var Ie={ecmaVersion:"2020",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!0,allowSuperOutsideMethod:!0,preserveParens:!1,locations:!1},Te={globalsNoObserve:["globalThis","arguments","console"],originalSource:!0,globalsOnlyPaths:!1,locations:!0,compact:2},Pe={apiVersion:1};function se(i,t=!1){let r=i.split(/\n/g);if(r.length>1){for(;!r[0].trim().length;)r.shift();let e=r[t?1:0].split(/[^\s]/)[0].length;if(e)return r.map((n,s)=>{let o=n.substring(0,e);return o.trim().length?o.trim()==="}"&&s===r.length-1?"}":n:n.substring(e)}).join(`
2
- `)}return i}var O=(i,t)=>i instanceof Promise?i.then(t):t(i);var fe=new Map;function j(i,t,r=void 0){let e=fe.get(i);if(arguments.length>2){e||(e=new Map,fe.set(i,e)),e.set(t,r);return}return e&&e.get(t)}var T=class{constructor(t,r,e,n={},s=null,o=null){this.ownerContract=t,this.graph=r,this.callee=e,this.params=t?n:{...n,isSubscriptFunction:!0},this.exits=o||new Map,this.$thread=s||{entries:new Map,sequence:[],ownerContract:this},this.subContracts=new Map,this.observers=[],this.contract=function(f,c,u=null,l=null){if(!this.graph.subContracts[f])throw new Error(`[${this.graph.type}:${this.graph.lineage}]: Graph not found for child contract ${f}.`);let a=this.graph.subContracts[f],p={...this.params,isIterationContract:arguments.length===3,iterationId:arguments.length===3&&c,isFunctionContract:arguments.length===4,functionType:arguments.length===4&&c,isSubscriptFunction:arguments.length===4&&u,functionScope:this.params.isFunctionContract&&this.graph.lineage||this.params.functionScope};if(p.isIterationContract){let d=u,y=new T(this,a,d,p,this.$thread,this.exits),_=this.subContracts.get(f);return _||(_=new Map,this.subContracts.set(f,_)),_.has(p.iterationId)&&_.get(p.iterationId).dispose(),_.set(p.iterationId,y),y.call()}let g,m,h;if(this.subContracts.has(f)&&this.subContracts.get(f).dispose(),p.isFunctionContract){g=l;let d=()=>new T(this,a,g,p);if(p.functionType!=="FunctionDeclaration")h=this.createFunction(d);else{let y=d();p.apiVersion>1?(h=function(..._){let v=y.call(this,..._);return v=O(v,E=>[v,y.thread.bind(y),y]),y=d(),v},h.target=y):h=y}}else g=c,m=new T(this,a,g,p,this.$thread,this.exits),this.subContracts.set(f,m),h=m.call();return h}.bind(this),this.contract.memo=Object.create(null),this.ownerContract&&!["FunctionDeclaration","FunctionExpression"].includes(this.graph.type)&&(this.contract.args=this.ownerContract.contract.args),this.contract.exiting=function(f,c){if(!arguments.length)return this.exits.size;let u=this.exits.get(f)===c;return u&&this.exits.clear(),u}.bind(this),this.contract.exit=function(f,c){this.exits.set(f,c)}.bind(this),this.contract.functions=new Map,this.contract.functions.declaration=(f,c)=>{this.contract.functions.set(f,c),this.applyReflection(f,typeof c=="function"?c.target:c)}}fire(t,r,e){if(!this.ownerContract)return;let n=this.ownerContract.fire(t,r,e);return this.observers.forEach(s=>{s.contractUrl===t&&s.callback(r,e)}),n}observe(t,r){!this.params.isFunctionContract||this.observers.push({contractUrl:t,callback:r})}call(t,...r){if(this.disposed)throw new Error(`[${this.graph.type}:${this.graph.lineage}]: Instance not runable after having been disposed.`);this.ownerContract||(this.contract.args=r,Object.defineProperty(this.contract.args,Symbol.toStringTag,{value:"Arguments"}));let e=this.callee.call(t,this.contract,...r);if(this.graph.$sideEffects)for(let n in this.graph.effects)for(let s of this.graph.effects[n].refs)this.buildThread([],s,[],0,!0);return O(e,()=>{if(!this.ownerContract||this.params.isFunctionContract){let n=this.exits.get("return");if(this.exits.clear(),n!==void 0)return n}return e})}iterate(t=[]){if(this.disposed)return!1;if(!["ForOfStatement","ForInStatement"].includes(this.graph.type)||this.subContracts.size!==1)throw new Error(`Contract ${this.graph.lineage} is not an iterator.`);let[[,r]]=this.subContracts,e;if(!t.length||t.includes("length")&&this.graph.type==="ForOfStatement")for(let[,n]of r)e=O(e,()=>n.call());else for(let n of t){let s=r.get(n)||r.get(parseInt(n));!s||(e=O(e,()=>s.call()))}return e}thread(...t){if(this.disposed)return!1;this.$thread.active=!0;for(let r in this.graph.effects)for(let e of this.graph.effects[r].refs)for(let n of t){let[s,o,f]=this.matchRefs(n,e);!s||this.buildThread(n,e,f,o)}return this.runThread()}runThread(){let t=(s,o)=>{if(["ForOfStatement","ForInStatement"].includes(s.graph.type)&&o.every(f=>f.executionPlan.isIterationContractTarget)){let f=o.map(c=>c.executionPlan.iterationTarget);return this.fire(s.graph.lineage,"iterating",o),s.iterate(f)}return this.fire(s.graph.lineage,"executing",o),s.call()},r,e,n;for(;(e=this.$thread.sequence.shift())&&(n=[...this.$thread.entries.get(e)])&&this.$thread.entries.delete(e);)r=O(r,()=>{if(e.disposed||!e.filterRefs(n).length)return;this.$thread.current=e;let s=t(e,n);return O(s,()=>{for(let o of n)[].concat(o.executionPlan.assigneeRef||o.executionPlan.assigneeRefs||[]).forEach(f=>{e.buildThread([],f,[],0)})}),s});return O(r,()=>{let s=this.exits.get("return");return this.exits.clear(),this.$thread.current=null,this.$thread.active=!1,s})}buildThread(t,r,e,n=0,s=!1){let o=n>0;if(this.ownerContract){if(!this.compute(e)||r.condition!==void 0&&!this.assert(r.condition))return}else o||(o=e.length||r.condition!==void 0);let f=s?r.$subscriptions:r.subscriptions;Object.keys(f).forEach(c=>{let[u,l]=c.split(":"),a=g=>{!g||g.selectRefs(l,f[c],o?t:null)},p=this.locate(u);Array.isArray(p)?p.forEach(a):a(p)})}selectRefs(t,r,e=null){let n=this.$thread,s=this.graph.signals[t],o=(c,u)=>c.graph.lineage.localeCompare(u.graph.lineage,void 0,{numeric:!0}),f=(c,u=[],l={})=>{if(!n.active||n.current&&o(this,n.current)<0)return;let a=n.entries.get(this);if(a||(a=new Set,n.entries.set(this,a),n.sequence.push(this),n.sequence.sort(o)),a.add({...c,computes:u,executionPlan:l}),!l.assigneeRef&&["VariableDeclaration","AssignmentExpression"].includes(this.graph.type)){l.assigneeRefs=[];for(let p in this.graph.effects)l.assigneeRefs.push(...this.graph.effects[p].refs)}};for(let c of r){let u=s.refs[c];if(!e){f(u);continue}let[l,a,p]=this.matchRefs(e,u);if(!l)continue;if(a<=0){f(u,p);continue}let g=e.slice(-a),m="assignee"in s?this.graph.effects[s.assignee]:null;if(m){m.refs.forEach(h=>{if(h.depth.length){let[d,y,_]=this.matchRefs(g,h.depth),v=p.concat(_);if(d&&y>0){let E=h.path.concat(g.slice(-y));this.buildThread(E,h,v,y)}else d&&f(u,v,{assigneeRef:h})}else{let d=h.path.concat(g);this.buildThread(d,h,p,a)}});continue}if(a===1&&this.graph.type==="ForOfStatement"){f(u,p,{isIterationContractTarget:!0,iterationTarget:g[0]});continue}if(a===1&&this.graph.type==="ForInStatement"){f(u,p,{isIterationContractTarget:!0,iterationTarget:g[0]});continue}}}filterRefs(t){return t.filter(r=>{if(!!this.compute(r.computes)&&!(r.condition!==void 0&&!this.assert(r.condition)))return!0})}matchRefs(t,r){let e,n,s,o;Array.isArray(t)?(e=t,n=t.dotSafe?t.join("."):void 0):(e=t.path,n=t.$path),Array.isArray(r)?(s=r,o=r.dotSafe?r.join("."):void 0):(s=r.path,o=r.$path);let f=e.length-s.length;if(f>0&&([e,s,n,o]=[s,e,o,n]),n&&o)return[`${o}.`.startsWith(`${n}.`),f,[]];let c=[],u=a=>typeof a=="object"?a.name:a,l=(a,p)=>{if(!a||!p)return!1;let g=typeof a=="object"&&"memoId"in a,m=typeof p=="object"&&"memoId"in p;return g||m?(c.push(h=>(g?h[a.memoId]:u(a))===(m?h[p.memoId]:u(p))),!0):u(a)===u(p)};return[e.reduce((a,p,g)=>a&&l(p,s[g]),!0),f,c]}locate(t){let r=this.graph.lineage+"/",e=t+"/";if(e===r)return this;if(e.startsWith(r)){let n=t.slice(r.length).split("/"),s=this.subContracts.get(parseInt(n.shift()));if(n.length){if(s instanceof Map)return Array.from(s).reduce((o,[f,c])=>o.concat(c.locate(t)),[]);if(s)return s.locate(t)}return s}if(this.ownerContract)return this.ownerContract.locate(t)}compute(t){return!t.some(r=>r(this.contract.memo)===!1)}assert(t){if(typeof t=="string"&&t.includes(":")){let[n,s]=t.split(":");return this.locate(n).assert(s)}let r=this.graph.conditions[t],e=this.contract.memo;return typeof r.parent<"u"&&!this.assert(r.parent)?!1:typeof r.switch<"u"?r.cases.some(n=>e[n]===e[r.switch]):typeof r.whenNot<"u"?!e[r.whenNot]:typeof r.when<"u"?e[r.when]:!0}dispose(){this.params.isFunctionContract||(this.subContracts.forEach((t,r)=>{t instanceof Map?(t.forEach(e=>e.dispose()),t.clear()):t.dispose()}),this.subContracts.clear(),delete this.ownerContract,delete this.callee,delete this.params,delete this.contract.memo,this.disposed=!0)}createFunction(t,r=void 0){let e=t(),n=function(o,...f){let c=o.call(this===void 0?r:this,...f);return o.params.isSubscriptFunction&&o.params.apiVersion>1&&(c=O(c,u=>[u,o.thread.bind(o),o]),e=t(e)),c},s=e instanceof Promise||e.callee instanceof async function(){}.constructor?async function(){return O(e,o=>n.call(this,o,...arguments))}:function(){return n.call(this,e,...arguments)};return O(e,o=>{this.applyReflection(s,o)}),j(s,"properties",O(e,o=>{let f={type:o.params.functionType||"Program",apiVersion:o.params.apiVersion||1,isSubscriptFunction:o.params.isSubscriptFunction,sideEffects:o.graph.sideEffects||!1};if(o.params.isSubscriptFunction){f.dependencies=[];for(let[c,u]of Object.entries(o.graph.effects))f.dependencies.push(...u.refs.map(l=>l.path.map(a=>"name"in a?a.name:1/0)))}return f})),s}applyReflection(t,r){Object.defineProperty(r.callee,"length",{configurable:!0,value:r.callee.length-1});let e=r.callee.toString();Object.defineProperty(r.callee,"toString",{configurable:!0,value:(s=!1)=>!s&&r.graph.originalSource?r.graph.originalSource:e});let n={name:r.callee.name,length:r.callee.length,toString:r.callee.toString};r.params.isSubscriptFunction&&(r.params.apiVersion>1||(n={...n,thread:r.thread.bind(r),dispose:r.dispose.bind(r),runtime:r})),Object.keys(n).forEach(s=>{Object.defineProperty(t,s,{configurable:!0,value:n[s]})})}};var L=class extends T{static create(t,r=[],e={}){let s=e.async||t.graph.hoistedAwaitKeyword?Object.getPrototypeOf(async function(){}).constructor:Function,o=e.compileFunction?e.compileFunction(t.source,[t.identifier+""].concat(r)):new s(t.identifier+"",...r,t.source);return new this(null,t.graph,o,e)}static createFunction(t,r,e=[],n={},s,o=null){n={...n,functionType:"Constructor"},r instanceof Promise&&(n={...n,async:!0});let f=l=>l?new this(null,l.graph,l.callee,n):O(r,a=>c(this.create(a,e,n))),c=l=>{if(l.graph.originalSource&&!l.graph.originalSourceModified){let a=`${n.async||l.graph.hoistedAwaitKeyword?"async ":""}function ${t||"anonymous"}`,p=l.graph.originalSource.split(/\n/g).map(g=>` ${g}`).join(`
1
+ (()=>{var lt=Object.defineProperty;var Le=(n,t)=>{for(var r in t)lt(n,r,{get:t[r],enumerable:!0})};function Ne(n={}){let t={runtimeParams:{...he,...n.runtimeParams||{}},compilerParams:{...se,...n.compilerParams||{}},parserParams:{...de,...n.parserParams||{}}};return n.devMode,t}var de={ecmaVersion:"2020",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!0,allowSuperOutsideMethod:!0,preserveParens:!1,locations:!1},se={globalsNoObserve:["globalThis","arguments","console","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},he={apiVersion:1};function Ve(n,t=!1){let r=n.split(/\n/g);if(r.length>1){for(;!r[0].trim().length;)r.shift();let e=r[t?1:0].split(/[^\s]/)[0].length;if(e)return r.map((i,o)=>{let s=i.substring(0,e);return s.trim().length?s.trim()==="}"&&o===r.length-1?"}":i:i.substring(e)}).join(`
2
+ `)}return n}var P=(n,t)=>n instanceof Promise?n.then(t):t(n);var We=new Map;function Q(n,t,r=void 0){let e=We.get(n);if(arguments.length>2){e||(e=new Map,We.set(n,e)),e.set(t,r);return}return e&&e.get(t)}var M=class{constructor(t,r,e,i={},o=null,s=null){this.ownerContract=t,this.graph=r,this.callee=e,this.params=t?i:{...i,isSubscriptFunction:!0},this.exits=s||new Map,this.$thread=o||{entries:new Map,sequence:[],ownerContract:this},this.subContracts=new Map,this.observers=[],this.contract=function(f,u,c=null,l=null){if(!this.graph.subContracts[f])throw new Error(`[${this.graph.type}:${this.graph.lineage}]: Graph not found for child contract ${f}.`);let a=this.graph.subContracts[f],p={...this.params,isIterationContract:arguments.length===3,iterationId:arguments.length===3&&u,isFunctionContract:arguments.length===4,functionType:arguments.length===4&&u,isSubscriptFunction:arguments.length===4&&c,functionScope:this.params.isFunctionContract&&this.graph.lineage||this.params.functionScope};if(p.isIterationContract){let g=c,y=new M(this,a,g,p,this.$thread,this.exits),w=this.subContracts.get(f);return w||(w=new Map,this.subContracts.set(f,w)),w.has(p.iterationId)&&w.get(p.iterationId).dispose(),w.set(p.iterationId,y),y.call()}let d,m,h;if(this.subContracts.has(f)&&this.subContracts.get(f).dispose(),p.isFunctionContract){d=l;let g=()=>new M(this,a,d,p);if(p.functionType!=="FunctionDeclaration")h=this.createFunction(g);else{let y=g();p.apiVersion>1?(h=function(...w){let _=y.call(this,...w);return _=P(_,C=>[_,y.thread.bind(y),y]),y=g(),_},h.target=y):h=y}}else d=u,m=new M(this,a,d,p,this.$thread,this.exits),this.subContracts.set(f,m),h=m.call();return h}.bind(this),this.contract.memo=Object.create(null),this.ownerContract&&!["FunctionDeclaration","FunctionExpression"].includes(this.graph.type)&&(this.contract.args=this.ownerContract.contract.args),this.contract.exiting=function(f,u){if(!arguments.length)return this.exits.size;let c=this.exits.get(f)===u;return c&&this.exits.clear(),c}.bind(this),this.contract.exit=function(f,u){this.exits.set(f,u)}.bind(this),this.contract.functions=new Map,this.contract.functions.declaration=(f,u)=>{this.contract.functions.set(f,u),this.applyReflection(f,typeof u=="function"?u.target:u)}}fire(t,r,e){if(!this.ownerContract)return;let i=this.ownerContract.fire(t,r,e);return this.observers.forEach(o=>{o.contractUrl===t&&o.callback(r,e)}),i}observe(t,r){!this.params.isFunctionContract||this.observers.push({contractUrl:t,callback:r})}call(t,...r){if(this.disposed)throw new Error(`[${this.graph.type}:${this.graph.lineage}]: Instance not runable after having been disposed.`);this.ownerContract||(this.contract.args=r,Object.defineProperty(this.contract.args,Symbol.toStringTag,{value:"Arguments"}));let e=this.callee.call(t,this.contract,...r);if(this.graph.$sideEffects)for(let i in this.graph.effects)for(let o of this.graph.effects[i].refs)this.buildThread([],o,[],0,!0);return P(e,()=>{if(!this.ownerContract||this.params.isFunctionContract){let i=this.exits.get("return");if(this.exits.clear(),i!==void 0)return i}return e})}iterate(t=[]){if(this.disposed)return!1;if(!["ForOfStatement","ForInStatement"].includes(this.graph.type)||this.subContracts.size!==1)throw new Error(`Contract ${this.graph.lineage} is not an iterator.`);let[[,r]]=this.subContracts,e;if(!t.length||t.includes("length")&&this.graph.type==="ForOfStatement")for(let[,i]of r)e=P(e,()=>i.call());else for(let i of t){let o=r.get(i)||r.get(parseInt(i));!o||(e=P(e,()=>o.call()))}return e}thread(...t){if(this.disposed)return!1;this.$thread.active=!0;for(let r in this.graph.effects)for(let e of this.graph.effects[r].refs)for(let i of t){let[o,s,f]=this.matchRefs(i,e);!o||this.buildThread(i,e,f,s)}return this.runThread()}runThread(){let t=(o,s)=>{if(["ForOfStatement","ForInStatement"].includes(o.graph.type)&&s.every(f=>f.executionPlan.isIterationContractTarget)){let f=s.map(u=>u.executionPlan.iterationTarget);return this.fire(o.graph.lineage,"iterating",s),o.iterate(f)}return this.fire(o.graph.lineage,"executing",s),o.call()},r,e,i;for(;(e=this.$thread.sequence.shift())&&(i=[...this.$thread.entries.get(e)])&&this.$thread.entries.delete(e);)r=P(r,()=>{if(e.disposed||!e.filterRefs(i).length)return;this.$thread.current=e;let o=t(e,i);return P(o,()=>{for(let s of i)[].concat(s.executionPlan.assigneeRef||s.executionPlan.assigneeRefs||[]).forEach(f=>{e.buildThread([],f,[],0)})}),o});return P(r,()=>{let o=this.exits.get("return");return this.exits.clear(),this.$thread.current=null,this.$thread.active=!1,o})}buildThread(t,r,e,i=0,o=!1){let s=i>0;if(this.ownerContract){if(!this.compute(e)||r.condition!==void 0&&!this.assert(r.condition))return}else s||(s=e.length||r.condition!==void 0);let f=o?r.$subscriptions:r.subscriptions;Object.keys(f).forEach(u=>{let[c,l]=u.split(":"),a=d=>{!d||d.selectRefs(l,f[u],s?t:null)},p=this.locate(c);Array.isArray(p)?p.forEach(a):a(p)})}selectRefs(t,r,e=null){let i=this.$thread,o=this.graph.signals[t],s=(u,c)=>u.graph.lineage.localeCompare(c.graph.lineage,void 0,{numeric:!0}),f=(u,c=[],l={})=>{if(!i.active||i.current&&s(this,i.current)<0)return;let a=i.entries.get(this);if(a||(a=new Set,i.entries.set(this,a),i.sequence.push(this),i.sequence.sort(s)),a.add({...u,computes:c,executionPlan:l}),!l.assigneeRef&&["VariableDeclaration","AssignmentExpression"].includes(this.graph.type)){l.assigneeRefs=[];for(let p in this.graph.effects)l.assigneeRefs.push(...this.graph.effects[p].refs)}};for(let u of r){let c=o.refs[u];if(!e){f(c);continue}let[l,a,p]=this.matchRefs(e,c);if(!l)continue;if(a<=0){f(c,p);continue}let d=e.slice(-a),m="assignee"in o?this.graph.effects[o.assignee]:null;if(m){m.refs.forEach(h=>{if(h.depth.length){let[g,y,w]=this.matchRefs(d,h.depth),_=p.concat(w);if(g&&y>0){let C=h.path.concat(d.slice(-y));this.buildThread(C,h,_,y)}else g&&f(c,_,{assigneeRef:h})}else{let g=h.path.concat(d);this.buildThread(g,h,p,a)}});continue}if(a===1&&this.graph.type==="ForOfStatement"){f(c,p,{isIterationContractTarget:!0,iterationTarget:d[0]});continue}if(a===1&&this.graph.type==="ForInStatement"){f(c,p,{isIterationContractTarget:!0,iterationTarget:d[0]});continue}}}filterRefs(t){return t.filter(r=>{if(!!this.compute(r.computes)&&!(r.condition!==void 0&&!this.assert(r.condition)))return!0})}matchRefs(t,r){let e,i,o,s;Array.isArray(t)?(e=t,i=t.dotSafe?t.join("."):void 0):(e=t.path,i=t.$path),Array.isArray(r)?(o=r,s=r.dotSafe?r.join("."):void 0):(o=r.path,s=r.$path);let f=e.length-o.length;if(f>0&&([e,o,i,s]=[o,e,s,i]),i&&s)return[`${s}.`.startsWith(`${i}.`),f,[]];let u=[],c=a=>typeof a=="object"?a.name:a,l=(a,p)=>{if(!a||!p)return!1;let d=typeof a=="object"&&"memoId"in a,m=typeof p=="object"&&"memoId"in p;return d||m?(u.push(h=>(d?h[a.memoId]:c(a))===(m?h[p.memoId]:c(p))),!0):c(a)===c(p)};return[e.reduce((a,p,d)=>a&&l(p,o[d]),!0),f,u]}locate(t){let r=this.graph.lineage+"/",e=t+"/";if(e===r)return this;if(e.startsWith(r)){let i=t.slice(r.length).split("/"),o=this.subContracts.get(parseInt(i.shift()));if(i.length){if(o instanceof Map)return Array.from(o).reduce((s,[f,u])=>s.concat(u.locate(t)),[]);if(o)return o.locate(t)}return o}if(this.ownerContract)return this.ownerContract.locate(t)}compute(t){return!t.some(r=>r(this.contract.memo)===!1)}assert(t){if(typeof t=="string"&&t.includes(":")){let[i,o]=t.split(":");return this.locate(i).assert(o)}let r=this.graph.conditions[t],e=this.contract.memo;return typeof r.parent<"u"&&!this.assert(r.parent)?!1:typeof r.switch<"u"?r.cases.some(i=>e[i]===e[r.switch]):typeof r.whenNot<"u"?!e[r.whenNot]:typeof r.when<"u"?e[r.when]:!0}dispose(){this.params.isFunctionContract||(this.subContracts.forEach((t,r)=>{t instanceof Map?(t.forEach(e=>e.dispose()),t.clear()):t.dispose()}),this.subContracts.clear(),delete this.ownerContract,delete this.callee,delete this.params,delete this.contract.memo,this.disposed=!0)}createFunction(t,r=void 0){let e=t(),i=function(s,...f){let u=s.call(this===void 0?r:this,...f);return s.params.isSubscriptFunction&&s.params.apiVersion>1&&(u=P(u,c=>[c,s.thread.bind(s),s]),e=t(e)),u},o=e instanceof Promise||e.callee instanceof async function(){}.constructor?async function(){return P(e,s=>i.call(this,s,...arguments))}:function(){return i.call(this,e,...arguments)};return P(e,s=>{this.applyReflection(o,s)}),Q(o,"properties",P(e,s=>{let f={type:s.params.functionType||"Program",apiVersion:s.params.apiVersion||1,isSubscriptFunction:s.params.isSubscriptFunction,sideEffects:s.graph.sideEffects||!1};if(s.params.isSubscriptFunction){f.dependencies=[];for(let[u,c]of Object.entries(s.graph.effects))f.dependencies.push(...c.refs.map(l=>l.path.map(a=>"name"in a?a.name:1/0)))}return f})),o}applyReflection(t,r){Object.defineProperty(r.callee,"length",{configurable:!0,value:r.callee.length-1});let e=r.callee.toString();Object.defineProperty(r.callee,"toString",{configurable:!0,value:(o=!1)=>!o&&r.graph.originalSource?r.graph.originalSource:e});let i={name:r.callee.name,length:r.callee.length,toString:r.callee.toString};r.params.isSubscriptFunction&&(r.params.apiVersion>1||(i={...i,thread:r.thread.bind(r),dispose:r.dispose.bind(r),runtime:r})),Object.keys(i).forEach(o=>{Object.defineProperty(t,o,{configurable:!0,value:i[o]})})}};var Y=class extends M{static create(t,r=[],e={}){let o=e.async||t.graph.hoistedAwaitKeyword?Object.getPrototypeOf(async function(){}).constructor:Function,s=e.compileFunction?e.compileFunction(t.source,[t.identifier+""].concat(r)):new o(t.identifier+"",...r,t.source);return new this(null,t.graph,s,e)}static createFunction(t,r,e=[],i={},o,s=null){i={...i,functionType:"Constructor"},r instanceof Promise&&(i={...i,async:!0});let f=l=>l?new this(null,l.graph,l.callee,i):P(r,a=>u(this.create(a,e,i))),u=l=>{if(l.graph.originalSource&&!l.graph.originalSourceModified){let a=`${i.async||l.graph.hoistedAwaitKeyword?"async ":""}function ${t||"anonymous"}`,p=l.graph.originalSource.split(/\n/g).map(d=>` ${d}`).join(`
3
3
  `);l.graph.originalSource=`${a}(${e.join(", ")}) {
4
4
  ${p}
5
- }`,l.graph.originalSourceModified=!0}return t&&Object.defineProperty(l.callee,"name",{configurable:!0,value:t}),l},u=this.prototype.createFunction(f,s);return j(u,"locations",O(r,l=>({locations:l.locations}))),u}};function U(...i){if(typeof window!="object")throw new Error("No window in context.");let t=oe(typeof i[i.length-1]=="object"?i.pop():{}),r=se(i.pop()||""),e=i,n=s=>L.createFunction(void 0,s,e,t.runtimeParams,this,r);if(window.wq?.SubscriptCompiler&&!t.runtimeParams.async){let{parse:s,compile:o}=window.wq.SubscriptCompiler,f=s(r,t.parserParams);return n(o(f,t.compilerParams))}if(!window.wq?.SubscriptCompilerWorker){let f=`
5
+ }`,l.graph.originalSourceModified=!0}return t&&Object.defineProperty(l.callee,"name",{configurable:!0,value:t}),l},c=this.prototype.createFunction(f,o);return Q(c,"locations",P(r,l=>({locations:l.locations}))),c}};function Z(...n){if(typeof window!="object")throw new Error("No window in context.");let t=Ne(typeof n[n.length-1]=="object"?n.pop():{}),r=Ve(n.pop()||""),e=n,i=o=>Y.createFunction(void 0,o,e,t.runtimeParams,this,r);if(window.wq?.SubscriptCompiler&&!t.runtimeParams.async){let{parse:o,compile:s}=window.wq.SubscriptCompiler,f=o(r,t.parserParams);return i(s(f,t.compilerParams))}if(!window.wq?.SubscriptCompilerWorker){let f=`
6
6
  importScripts( '${document.querySelector('meta[name="subscript-compiler-url"]')?.content||"https://unpkg.com/@webqit/subscript/dist/compiler.js"}' );
7
7
  const { parse, compile } = self.wq.SubscriptCompiler;
8
8
  self.onmessage = e => {
@@ -11,17 +11,17 @@ ${p}
11
11
  const compilation = compile( ast, params.compilerParams );
12
12
  compilation.identifier = compilation.identifier.toString();
13
13
  e.ports[ 0 ]?.postMessage( compilation );
14
- };`;window.wq=window.wq||{},window.wq.SubscriptCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(f)}`)}return n(new Promise(s=>{let o=new MessageChannel;wq.SubscriptCompilerWorker.postMessage({source:r,params:t},[o.port2]),o.port1.onmessage=f=>s(f.data)}))}Object.defineProperty(U,"inspect",{value:j});function x(i){return!Array.isArray(i)&&typeof i=="object"&&i}function z(i,...t){globalThis.WebQitInternalsRegistry||(globalThis.WebQitInternalsRegistry=new Map);var r=globalThis.WebQitInternalsRegistry.get(i);if(!r){if(r=new Map,t[0]===!1)return r;globalThis.WebQitInternalsRegistry.set(i,r)}for(var e,n;e=t.shift();)if((n=r)&&!(r=r.get(e))){if(r=new Map,t[0]===!1)return r;n.set(e,r)}return r}function w(i){return Array.isArray(i)}function H(i){return typeof i=="function"}function V(i){return i===null||i===""}function P(i){return arguments.length&&(i===void 0||typeof i>"u")}function S(i){return Array.isArray(i)||typeof i=="object"&&i||H(i)}function X(i){return V(i)||P(i)||i===!1||i===0||S(i)&&!Object.keys(i).length}function b(i){return H(i)||i&&{}.toString.call(i)==="[object function]"}function W(i){return i instanceof Number||typeof i=="number"}function A(i){return W(i)||i!==!0&&i!==!1&&i!==null&&i!==""&&!isNaN(i*1)}function Q(i){return i instanceof String||typeof i=="string"&&i!==null}function Y(i){return!Q(i)&&!P(i.length)}function k(i,...t){return t.forEach(r=>{i.indexOf(r)<0&&i.push(r)}),i}function Z(e,t){t=t||Object.prototype,t=t&&!w(t)?[t]:t;for(var r=[],e=e;e&&(!t||t.indexOf(e)<0)&&e.name!=="default";)r.push(e),e=e?Object.getPrototypeOf(e):null;return r}function K(i,t){var r=[];return Z(i,t).forEach(e=>{k(r,...Object.getOwnPropertyNames(e))}),r}function I(i,t,r=!1,e=!1,n=!1){var s=0,o=i.shift();if((A(o)||o===!0||o===!1)&&(s=o,o=i.shift()),!i.length)throw new Error("_merge() requires two or more array/objects.");return i.forEach((f,c)=>{!S(f)&&!b(f)||(r?K(f):Object.keys(f)).forEach(u=>{if(!!t(u,o,f,c)){var l=o[u],a=f[u];if((w(l)&&w(a)||x(l)&&x(a))&&(s===!0||s>0))o[u]=w(l)&&w(a)?[]:{},I([A(s)?s-1:s,o[u],l,a],t,r,e,n);else if(w(o)&&w(f))e?o[u]=a:o.push(a);else try{n?Object.defineProperty(o,u,Object.getOwnPropertyDescriptor(f,u)):o[u]=f[u]}catch{}}})}),o}function D(...i){return I(i,(t,r,e)=>!0,!1,!1,!1)}function C(i,t=!0){return w(i)?i:!t&&x(i)?[i]:i!==!1&&i!==0&&X(i)?[]:Y(i)?Array.prototype.slice.call(i):x(i)?Object.values(i):[i]}function q(i,t,r={},e={}){t=C(t).slice();for(var n=i;!P(n)&&!V(n)&&t.length;){var s=t.shift();if(!(r.get?r.get(n,s):S(n)?s in n:n[s])){e.exists=!1;return}n=r.get?r.get(n,s):n[s]}return e.exists=!0,n}function te(i,t,r,e={},n={}){let s=(l,a,p)=>n.set?n.set(l,a,p):(A(t[f])&&w(l)?l.push(p):l[a]=p,!0);t=C(t);for(var o=i,f=0;f<t.length;f++)if(f<t.length-1){if(!o||!S(o)&&!b(o))return!1;var c=q(o,t[f],n);if(!S(c)){if(n.buildTree===!1)return!1;c=b(n.buildTree)?n.buildTree(f):A(t[f+1])?[]:{};var u=s(o,t[f],c);if(!u)return!1}o=c}else return s(o,t[f],r)}var pe=i=>class{constructor(r=!0){Object.defineProperty(this,"window",{value:i}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),this.async=r,this.window.requestAnimationFrame?this._run():this.async=!1}_run(){this.window.requestAnimationFrame(()=>{this.readCallbacks.forEach(r=>{r()||this.readCallbacks.delete(r)}),this.writeCallbacks.forEach(r=>{r()||this.writeCallbacks.delete(r)}),this._run()})}onread(r,e=!1){if(e)return new Promise((n,s)=>{this.async===!1?r(n,s):this.readCallbacks.add(()=>{r(n,s)})});this.async===!1?r():this.readCallbacks.add(r)}onwrite(r,e=!1){if(e)return new Promise((n,s)=>{this.async===!1?r(n,s):this.writeCallbacks.add(()=>{r(n,s)})});this.async===!1?r():this.writeCallbacks.add(r)}cycle(r,e,n){this.onread(()=>{let s=r(n),o=f=>{f!==void 0&&this.onwrite(()=>{let c=e(f,n),u=l=>{l!==void 0&&this.cycle(r,e,l)};c instanceof Promise?c.then(u):u(c)})};s instanceof Promise?s.then(o):o(s)})}};var $=class{constructor(t,r,e){this.context=t,this.namespace=r,this.window=t.defaultView||t.ownerDocument?.defaultView||e,this.document=this.window.document,this.wq=this.window.wq,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){return b(t[0])?t=[[],...t]:x(t[0])&&t.length===1?t=[[],void 0,t[0]]:x(t[1])&&t.length===2?t=[C(t[0],!1),void 0,t[1]]:t[0]=C(t[0],!1),t}registry(...t){return z(this.window,"dom.realtime",this.namespace,...t)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(t,r,e){let{window:n}=this,s=Array.isArray(r)?r:[r],o=new Set;for(let[f,c]of this.registry(t))for(let[u,l]of c){let a=s.filter(p=>u.contains(p.target)?f==="subtree"||p.target===u:!1);if(!!a.length){Array.isArray(r)||(a=a[0]);for(let p of l)o.add([p,a,u])}}for(let[f,c,u]of o)e.call(this,f,c,u)}disconnectables(t,...r){let e={disconnect(){r.forEach(n=>n&&b(n.disconnect)&&n.disconnect()||b(n)&&n()||x(n)&&(n.disconnected=!0))}};return t&&t.addEventListener("abort",()=>e.disconnect()),e}};var M=class extends ${constructor(t,...r){super(t,"attr",...r)}get(t,r=void 0,e={}){let n=typeof t=="string";[t=[],r=void 0,e={}]=this.resolveArgs(arguments);let{context:s}=this,o=we(s,t),f=n?o[0]:o;if(!r)return f;let c=r&&e.lifecycleSignals&&this.createSignalGenerator(),u=c?.generate()||{};if(r(f,u,s),e.live){c&&(e={...e,signalGenerator:c});let l=this.observe(n?t[0]:t,r,{newValue:!0,...e});return this.disconnectables(e.signal,l)}}observe(t,r,e={}){let n=typeof t=="string";if([t=[],r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(n?t[0]:t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:s,window:o,wq:f}=this;e.eventDetails&&!f.attrInterceptionHooks?.intercepting&&ge.call(o,"intercept",()=>{});let c=new o.MutationObserver(p=>{p=ye(p).map(g=>_e.call(o,g)),he.call(o,a,p,s)}),u={attributes:!0,attributeOldValue:e.oldValue,subtree:e.subtree};t.length&&(u.attributeFilter=t),c.observe(s,u);let l=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),a={context:s,filter:t,callback:r,params:e,atomics:new Map,originalFilterIsString:n,signalGenerator:l,disconnectable:c};return this.disconnectables(e.signal,c,l)}observeSync(t,r,e={}){let n=typeof t=="string";[t,r,e={}]=this.resolveArgs(arguments);let{context:s,window:o}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let f=e.timing==="intercept"?"intercept":"sync",c=e.subtree?"subtree":"children";this.registry(f).size||ge.call(o,f,m=>{this.forEachMatchingContext(f,m,he)});let u={disconnect(){g.delete(a),g.size||p.delete(s)}},l=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),a={context:s,filter:t,callback:r,params:e,atomics:new Map,originalFilterIsString:n,signalGenerator:l,disconnectable:u},p=this.registry(f,c);p.has(s)||p.set(s,new Set);let g=p.get(s);return g.add(a),this.disconnectables(e.signal,u,l)}};function ye(i){return i.reduce((t,r,e)=>t[e-1]?.attributeName===r.attributeName?t:t.concat(r),[])}function he(i,t){let{context:r,filter:e,callback:n,params:s,atomics:o,originalFilterIsString:f,signalGenerator:c}=i;s.atomic&&!o.size&&(t=we(r,e,t)),s.newValue===null&&s.oldValue===null||(t=t.map(a=>{let p;return!s.oldValue&&"oldValue"in a&&({oldValue:p,...a}=a),!s.newValue&&"value"in a?{value:p,...a}=a:s.newValue&&typeof a.value>"u"&&(a={...a,value:a.target.getAttribute(a.name)}),a})),s.atomic&&(t.forEach(a=>o.set(a.name,a)),t=Array.from(o.entries()).map(([,a])=>a));let u=f?t[0]:t,l=c?.generate()||{};n(u,l,r)}function we(i,t,r=[]){let e={event:null,type:"attribute"};return t.length?t.map(s=>r.find(o=>o.name===s)||{target:i,name:s,value:i.getAttribute(s),...e}):Array.from(i.attributes).map(s=>r.find(o=>o.name===s.nodeName)||{target:i,name:s.nodeName,value:s.nodeValue,...e})}function _e({target:i,attributeName:t,value:r,oldValue:e}){let o=(this.wq.attrInterceptionRecords?.get(i)||{})[t]||"mutation";return{target:i,name:t,value:r,oldValue:e,type:"observation",event:o}}function ge(i,t){let r=this,{wq:e,document:n,Element:s}=r;e.attrInterceptionHooks||(e.attrInterceptionHooks=new Map),e.attrInterceptionHooks.has(i)||e.attrInterceptionHooks.set(i,new Set),e.attrInterceptionHooks.get(i).add(t);let o=()=>e.attrInterceptionHooks.get(i).delete(t);if(e.attrInterceptionHooks?.intercepting)return o;console.warn("Attr mutation APIs are now being intercepted."),e.attrInterceptionHooks.intercepting=!0,e.attrInterceptionRecords=new Map;let f=(l,a)=>{e.attrInterceptionRecords.has(l.target)||e.attrInterceptionRecords.set(l.target,{});let p=e.attrInterceptionRecords.get(l.target);clearTimeout(p[l.name]?.timeout),p[l.name]=l.event;let g=setTimeout(()=>{delete p[l.name]},0);Object.defineProperty(l.event,"timeout",{value:g,configurable:!0}),e.attrInterceptionHooks.get("intercept")?.forEach(h=>h([l]));let m=a();return e.attrInterceptionHooks.get("sync")?.forEach(h=>h([l])),m};new r.MutationObserver(l=>{l=ye(l).map(a=>_e.call(r,a)).filter((a,p)=>!Array.isArray(a.event)),l.length&&(e.attrInterceptionHooks.get("intercept")?.forEach(a=>a(l)),e.attrInterceptionHooks.get("sync")?.forEach(a=>a(l)))}).observe(n,{attributes:!0,subtree:!0,attributeOldValue:!0});let u=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(l=>{u[l]=s.prototype[l],s.prototype[l]=function(...a){let p,g=this.getAttribute(a[0]);["setAttribute","toggleAttribute"].includes(l)&&(p=a[1]),l==="toggleAttribute"&&p===void 0&&(p=g===null);let m={target:this,name:a[0],value:p,oldValue:g,type:"interception",event:[this,l]};return f(m,()=>u[l].call(this,...a))}}),o}var R=class extends ${constructor(t,...r){super(t,"tree",...r)}attr(t,r=void 0,e={}){let{context:n,window:s}=this;return new M(n,s).get(...arguments)}query(t,r=void 0,e={}){[t,r=void 0,e={}]=this.resolveArgs(arguments);let{context:n}=this,s=new Map,o=u=>(s.has(u)||s.set(u,{target:u,entrants:[],exits:[],type:"query",event:null}),s.get(u));if((!e.generation||e.generation==="entrants")&&(t.length?t.every(u=>typeof u=="string")&&(t=t.join(","))&&(e.subtree?n.querySelectorAll(t):[...n.children].filter(l=>l.matches(t))).forEach(l=>o(l.parentNode||n).entrants.push(l)):[...n.children].forEach(u=>o(n).entrants.push(u))),!r)return s;let f={disconnected:!1},c=r&&e.lifecycleSignals&&this.createSignalGenerator();for(let[,u]of s){if(f.disconnected)break;let l=c?.generate()||{};r(u,l,n)}if(e.live){c&&(e={...e,signalGenerator:c});let u=this.observe(t,r,e);return this.disconnectables(e.signal,f,u)}return this.disconnectables(e.signal,f,c)}children(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!1})}subtree(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!0})}observe(t,r,e={}){if([t,r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:n,window:s,wq:o,document:f}=this;e.eventDetails&&(o.domInterceptionRecordsAlwaysOn=!0),(f.readyState==="loading"||o.domInterceptionRecordsAlwaysOn)&&!o.domInterceptionHooks?.intercepting&&ve.call(s,"sync",()=>{});let c=new s.MutationObserver(a=>a.forEach(p=>{be.call(s,l,Oe.call(s,p),n)}));c.observe(n,{childList:!0,subtree:e.subtree});let u=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),l={context:n,selectors:t,callback:r,params:e,signalGenerator:u,disconnectable:c};if(e.staticSensitivity){let a=xe.call(s,l);return this.disconnectables(e.signal,c,u,a)}return this.disconnectables(e.signal,c,u)}observeSync(t,r,e={}){[t,r,e={}]=this.resolveArgs(arguments);let{context:n,window:s}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let o=e.timing==="intercept"?"intercept":"sync",f=e.subtree?"subtree":"children";this.registry(o).size||ve.call(s,o,g=>{this.forEachMatchingContext(o,g,be)});let c={disconnect(){p.delete(l),p.size||a.delete(n)}},u=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),l={context:n,selectors:t,callback:r,params:e,signalGenerator:u,disconnectable:c},a=this.registry(o,f);a.has(n)||a.set(n,new Set);let p=a.get(n);if(p.add(l),e.staticSensitivity){let g=xe.call(s,l);return this.disconnectables(e.signal,c,u,g)}return this.disconnectables(e.signal,c,u)}};function xe(i){let t=this,{context:r,selectors:e,callback:n,params:s,signalGenerator:o}=i,f=l=>[...l.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(a=>a[1]);if(!(i.$attrs=e.filter(l=>typeof l=="string"&&l.includes("[")).reduce((l,a)=>l.concat(f(a)),[])).length)return;let c=new Set,u=new Set;return c.push=l=>(u.delete(l),c.add(l)),u.push=l=>(c.delete(l),u.add(l)),i.$deliveryCache={entrants:c,exits:u},new M(r,t).observe(i.$attrs,l=>{let a=new Map,p=h=>(a.has(h)||a.set(h,{target:h,entrants:[],exits:[],type:"static",event:null}),a.get(h)),g=new WeakMap,m=h=>(g.has(h)||g.set(h,e.some(d=>h.matches(d))),g.get(h));for(let h of l)["entrants","exits"].forEach(d=>{s.generation&&d!==s.generation||i.$deliveryCache[d].has(h.target)||(d==="entrants"?!m(h.target):m(h.target))||(i.$deliveryCache[d].push(h.target),p(h.target)[d].push(h.target),p(h.target).event=h.event)});for(let[,h]of a){let d=o?.generate()||{};n(h,d,r)}},{subtree:s.subtree,timing:s.timing,eventDetails:s.eventDetails})}function be(i,t){let{context:r,selectors:e,callback:n,params:s,signalGenerator:o,$deliveryCache:f}=i,c={...t,entrants:[],exits:[]};if(["entrants","exits"].forEach(l=>{if(!(s.generation&&l!==s.generation)&&(e.length?c[l]=Ue(e,t[l],t.event!=="parse"):c[l]=[...t[l]],!!f))for(let a of c[l])f[l].push(a)}),!c.entrants.length&&!c.exits.length)return;let u=o?.generate()||{};n(c,u,r)}function Ue(i,t,r){t=Array.isArray(t)?t:[...t];let e=(n,s)=>{if(n=n.filter(o=>o.matches),typeof s=="string"){let o=n.filter(f=>f.matches(s));if(r&&(o=n.reduce((f,c)=>[...f,...c.querySelectorAll(s)],o)),o.length)return o}else if(n.includes(s)||r&&n.some(o=>o.contains(s)))return[s]};return t.$$searchCache||(t.$$searchCache=new Map),i.reduce((n,s)=>{let o;return t.$$searchCache.has(s)?o=t.$$searchCache.get(s):(o=e(t,s)||[],x(s)&&t.$$searchCache.set(s,o)),n.concat(o)},[])}function Oe({target:i,addedNodes:t,removedNodes:r}){let e=this,n;return n=C(t).reduce((s,o)=>s||e.wq.domInterceptionRecords?.get(o),null),n=C(r).reduce((s,o)=>s||e.wq.domInterceptionRecords?.get(o),n),n=n||e.document.readyState==="loading"&&"parse"||"mutation",{target:i,entrants:t,exits:r,type:"observation",event:n}}function ve(i,t){let r=this,{wq:e,document:n,Node:s,Element:o,HTMLElement:f,HTMLTemplateElement:c,DocumentFragment:u}=r;e.domInterceptionHooks||(e.domInterceptionHooks=new Map),e.domInterceptionHooks.has(i)||e.domInterceptionHooks.set(i,new Set),e.domInterceptionHooks.get(i).add(t);let l=()=>e.domInterceptionHooks.get(i).delete(t);if(e.domInterceptionHooks?.intercepting)return l;console.warn("DOM mutation APIs are now being intercepted."),e.domInterceptionHooks.intercepting=!0,e.domInterceptionRecords=new Map;let a=()=>!0,p=(m,h)=>{a()?m.entrants.concat(m.exits).forEach(y=>{clearTimeout(e.domInterceptionRecords.get(y)?.timeout),e.domInterceptionRecords.set(y,m.event);let _=setTimeout(()=>{e.domInterceptionRecords.delete(y)},0);Object.defineProperty(m.event,"timeout",{value:_,configurable:!0})}):e.domInterceptionRecords.clear(),e.domInterceptionHooks.get("intercept")?.forEach(y=>y(m));let d=h();return e.domInterceptionHooks.get("sync")?.forEach(y=>y(m)),d};if(a()){let m=new r.MutationObserver(h=>h.forEach(d=>{Array.isArray((d=Oe.call(r,d)).event)||(e.domInterceptionHooks.get("intercept")?.forEach(y=>y(d)),e.domInterceptionHooks.get("sync")?.forEach(y=>y(d)))}));m.observe(n,{childList:!0,subtree:!0}),n.addEventListener("readystatechange",()=>!a()&&m.disconnect())}let g=Object.create(null);return["insertBefore","insertAdjacentElement","insertAdjacentHTML","setHTML","replaceChildren","replaceWith","remove","replaceChild","removeChild","before","after","append","prepend","appendChild"].forEach(m=>{let h=["insertBefore","replaceChild","removeChild","appendChild"].includes(m)?s:o;g[m]=h.prototype[m],g[m]&&(h.prototype[m]=function(...d){let y=()=>g[m].call(this,...d);if(!(this instanceof o||this instanceof u))return y();let _=[],v=[],E=this;["insertBefore"].includes(m)?v=[d[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(m)?(v=[d[1]],["beforebegin","afterend"].includes(d[0])&&(E=this.parentNode)):["setHTML","replaceChildren"].includes(m)?(_=[...this.childNodes],v=m==="replaceChildren"?[...d]:[d[0]]):["replaceWith","remove"].includes(m)?(_=[this],v=m==="replaceWith"?[...d]:[],E=this.parentNode):["replaceChild"].includes(m)?(_=[d[1]],v=[d[0]]):["removeChild"].includes(m)?_=[...d]:(v=[...d],["before","after"].includes(m)&&(E=this.parentNode));let N=m;if(["insertAdjacentHTML","setHTML"].includes(m)){let F=this.nodeName;if(m==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(d[0])){if(!this.parentNode)return g[m].call(this,...d);F=this.parentNode.nodeName}let B=n.createElement(F);g.setHTML.call(B,v[0],m==="setHTML"?d[1]:{}),v=[...B.childNodes],m==="insertAdjacentHTML"?(N="insertAdjacentElement",d[1]=new u,d[1].______isTemp=!0,d[1].append(...B.childNodes)):(N="replaceChildren",d=[...B.childNodes])}return p({target:E,entrants:v,exits:_,type:"interception",event:[this,m]},()=>g[N].call(this,...d))})}),["outerHTML","outerText","innerHTML","innerText","textContent","nodeValue"].forEach(m=>{let h=["textContent","nodeValue"].includes(m)?s:["outerText","innerText"].includes(m)?f:o;g[m]=Object.getOwnPropertyDescriptor(h.prototype,m),Object.defineProperty(h.prototype,m,{...g[m],set:function(d){let y=()=>g[m].set.call(this,d);if(!(this instanceof o))return y();let _=[],v=[],E=this;if(["outerHTML","outerText"].includes(m)?(_=[this],E=this.parentNode):_=[...this.childNodes],["outerHTML","innerHTML"].includes(m)){let G=this.nodeName;if(m==="outerHTML"){if(!this.parentNode)return y();G=this.parentNode.nodeName}let F=n.createElement(G==="TEMPLATE"?"div":G);g[m].set.call(F,d),v=this instanceof c?[]:[...F.childNodes],m==="outerHTML"?(d=new u,d.______isTemp=!0,d.append(...F.childNodes),y=()=>g.replaceWith.call(this,d)):this instanceof c?y=()=>this.content.replaceChildren(...F.childNodes):y=()=>g.replaceChildren.call(this,...F.childNodes)}return p({target:E,entrants:v,exits:_,type:"interception",event:[this,m]},y)}})}),["append","prepend","replaceChildren"].forEach(m=>{[n,u.prototype].forEach(h=>{let d=h[m];h[m]=function(...y){if(this.______isTemp)return d.call(this,...y);let _=m==="replaceChildren"?[...this.childNodes]:[];return p({target:this,entrants:y,exits:_,type:"interception",event:[this,m]},()=>d.call(this,...y))}})}),l}function Se(){ze.call(this),Qe.call(this),ke.call(this)}function ze(){let i=this;i.CSS||(i.CSS={}),i.CSS.escape||(i.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function Qe(){let i=this;"isConnected"in i.Node.prototype||Object.defineProperty(i.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function ke(){let i=this;i.Element.prototype.matches||(i.Element.prototype.matches=i.Element.prototype.matchesSelector||i.Element.prototype.mozMatchesSelector||i.Element.prototype.msMatchesSelector||i.Element.prototype.oMatchesSelector||i.Element.prototype.webkitMatchesSelector||function(t){for(var r=(this.document||this.ownerDocument).querySelectorAll(t),e=r.length;--e>=0&&r.item(e)!==this;);return e>-1})}function Ce(){let i=this;if(i.wq||(i.wq={}),i.wq.dom)return i.wq.dom;i.wq.dom={},Se.call(i);let t=pe(i);return i.wq.dom.Reflow=new t,i.wq.dom.DOMRealtime=R,i.wq.dom.AttrRealtime=M,i.wq.dom.realtime=(r,e="tree")=>{if(e==="tree")return new R(r,i);if(e==="attr")return new M(r,i)},i.wq.dom.ready=Je.bind(i),i.wq.dom.meta=Xe.bind(i),i.wq.dom}function Je(i){let t=this;t.document.readyState==="complete"?i(t):(t.document.domReadyCallbacks||(t.document.domReadyCallbacks=[],t.document.addEventListener("DOMContentLoaded",()=>{t.document.domReadyCallbacks.splice(0).forEach(r=>r(t))},!1)),t.document.domReadyCallbacks.push(i))}function Xe(i,t=!1){let r=this,e={content:{}};return!(e.el=r.document.querySelector(`meta[name="${i}"]`))&&t&&(e.el=r.document.createElement("meta"),e.el.setAttribute("name",i),r.document.head.append(e.el)),e.el&&(e.content=(e.el.getAttribute("content")||"").split(";").filter(n=>n).reduce((n,s)=>{let o=s.split("=").map(f=>f.trim());return te(n,o[0].split("."),o[1]==="true"?!0:o[1]==="false"?!1:A(o[1])?parseInt(o[1]):o[1]),n},{})),e.get=function(n){return JSON.parse(JSON.stringify(q(this.content,n.split("."))))},e.copy=function(){return JSON.parse(JSON.stringify(this.content))},e.copyWithDefaults=function(...n){return n.length?D(!0,{},...n.reverse().concat(this.content)):this.copy()},e}function ie(i={}){let t=this,e=Ce.call(t).meta("oohtml").copyWithDefaults(i,{retention:"retain",mimeType:""});e.scriptSelector=(Array.isArray(e.mimeType)?e.mimeType:[e.mimeType]).reduce((n,s)=>{let o=s?`[type=${t.CSS.escape(s)}]`:"";return n.concat(`script${o}[scoped],script${o}[contract]`)},[]).join(","),Ye.call(this,e)}function Ye(i){let t=this,{dom:r}=t.wq;t.wq.transformCache=new Map,t.wq.compileCache=[new Map,new Map];let e=()=>{};r.realtime(t.document).observe(i.scriptSelector,n=>{n.entrants.forEach(s=>{if("contract"in s||(Object.defineProperty(s,"contract",{value:s.hasAttribute("contract")}),"scoped"in s))return e(s);Object.defineProperty(s,"scoped",{value:s.hasAttribute("scoped")});let o=s.scoped?n.target:s.type==="module"?void 0:t;Ke.call(this,s,o,i)})},{subtree:!0,timing:"intercept",generation:"entrants"}),t.wq.exec=n=>{let s=ot(n);if(!s)throw new Error("Argument must be a valid exec hash.");let{script:o,compiledScript:f,thisContext:c}=s;switch(c instanceof t.Element&&o.scoped&&(c.scripts||Object.defineProperty(c,"scripts",{value:new Set}),c.scripts.add(o)),i.retention){case"dispose":o.remove();break;case"hidden":o.textContent='"hidden"';break;default:o.textContent=f.function.originalSource}return Ze.call(this,f,c,o)}}function Ze(i,t,r){if(!i.function)throw new Error("Input script must already be compiled!");let e=i.function.call(t);i.contract&&Object.defineProperty(r,"rerender",{value:(...f)=>it(e,([,c])=>c(...f))});let n=this,{dom:s}=n.wq;if(!(t instanceof n.EventTarget))return e;let o;return r.contract&&(o=f=>{r.rerender((f.detail||{paths:[]}).paths)},t.addEventListener("namespacechange",o),t.addEventListener("statechange",o)),s.realtime(n.document).observe(t,()=>{r.contract&&(t.removeEventListener("namespacechange",o),t.removeEventListener("statechange",o)),t.dispatchEvent(new n.CustomEvent("remove")),t.scripts.delete(r)},{subtree:!0,timing:"sync",generation:"exits"}),r}function Ke(i,t,r={}){let e=this.wq,n=e.compileCache[i.contract?0:1],s=Ae(i.textContent),o=i.textContent,f;if(!(f=n.get(s))){let u=[],l={},a=[];i.type==="module"&&a.push("import "),i.type==="module"&&!i.contract&&a.push("await "),a.length&&new RegExp(a.join("|")).test(o)&&([u,o,l]=et(o),u.length&&(o=`
15
- ${tt(u).join(`
14
+ };`;window.wq=window.wq||{},window.wq.SubscriptCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(f)}`)}return i(new Promise(o=>{let s=new MessageChannel;wq.SubscriptCompilerWorker.postMessage({source:r,params:t},[s.port2]),s.port1.onmessage=f=>o(f.data)}))}Object.defineProperty(Z,"inspect",{value:Q});var Re={};Le(Re,{apply:()=>Fe,construct:()=>Te,deep:()=>Ct,defineProperties:()=>It,defineProperty:()=>Ee,deleteProperty:()=>Ie,get:()=>V,getOwnPropertyDescriptor:()=>Ce,getOwnPropertyDescriptors:()=>Et,getPrototypeOf:()=>Se,has:()=>ae,intercept:()=>Pt,isExtensible:()=>Pe,observe:()=>St,ownKeys:()=>le,preventExtensions:()=>qe,set:()=>J,setPrototypeOf:()=>Me});function b(n){return!Array.isArray(n)&&typeof n=="object"&&n}function U(n){return typeof n}function S(n,...t){globalThis.WebQitInternalsRegistry||(globalThis.WebQitInternalsRegistry=new Map);var r=globalThis.WebQitInternalsRegistry.get(n);if(!r){if(r=new Map,t[0]===!1)return r;globalThis.WebQitInternalsRegistry.set(n,r)}for(var e,i;e=t.shift();)if((i=r)&&!(r=r.get(e))){if(r=new Map,t[0]===!1)return r;i.set(e,r)}return r}function x(n){return Array.isArray(n)}function H(n){return typeof n=="function"}function ge(n){return H(n)&&/^class\s?/.test(Function.prototype.toString.call(n))}function K(n){return n===null||n===""}function q(n){return arguments.length&&(n===void 0||typeof n>"u")}function v(n){return Array.isArray(n)||typeof n=="object"&&n||H(n)}function ye(n){return K(n)||q(n)||n===!1||n===0||v(n)&&!Object.keys(n).length}function O(n){return H(n)||n&&{}.toString.call(n)==="[object function]"}function ee(n){return n instanceof Number||typeof n=="number"}function E(n){return ee(n)||n!==!0&&n!==!1&&n!==null&&n!==""&&!isNaN(n*1)}function ue(n){return n instanceof String||typeof n=="string"&&n!==null}function we(n){return!ue(n)&&!q(n.length)}function fe(n,...t){return t.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n}function xe(e,t){t=t||Object.prototype,t=t&&!x(t)?[t]:t;for(var r=[],e=e;e&&(!t||t.indexOf(e)<0)&&e.name!=="default";)r.push(e),e=e?Object.getPrototypeOf(e):null;return r}function _e(n,t){var r=[];return xe(n,t).forEach(e=>{fe(r,...Object.getOwnPropertyNames(e))}),r}function T(n,t,r=!1,e=!1,i=!1){var o=0,s=n.shift();if((E(s)||s===!0||s===!1)&&(o=s,s=n.shift()),!n.length)throw new Error("_merge() requires two or more array/objects.");return n.forEach((f,u)=>{!v(f)&&!O(f)||(r?_e(f):Object.keys(f)).forEach(c=>{if(!!t(c,s,f,u)){var l=s[c],a=f[c];if((x(l)&&x(a)||b(l)&&b(a))&&(o===!0||o>0))s[c]=x(l)&&x(a)?[]:{},T([E(o)?o-1:o,s[c],l,a],t,r,e,i);else if(x(s)&&x(f))e?s[c]=a:s.push(a);else try{i?Object.defineProperty(s,c,Object.getOwnPropertyDescriptor(f,c)):s[c]=f[c]}catch{}}})}),s}function te(...n){return T(n,(t,r,e)=>!0,!1,!1,!1)}function A(n,t=!0){return x(n)?n:!t&&b(n)?[n]:n!==!1&&n!==0&&ye(n)?[]:we(n)?Array.prototype.slice.call(n):b(n)?Object.values(n):[n]}var D=class{constructor(t,r){this.registry=t,Object.assign(this,{...r,target:t.target}),this.params.signal&&this.params.signal.addEventListener("abort",()=>this.remove())}remove(){return this.removed=!0,this.registry.removeRegistration(this)}};var re=class extends D{constructor(){super(...arguments),Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal})}remove(){this.abortController.abort(),super.remove()}fire(t){let r=t,e=this.filter;if(e!==1/0&&(e=A(e))&&(r=t.filter(i=>e.includes(i.key))),r.length)return this.filter===1/0||Array.isArray(this.filter)?this.handler(r,this):this.handler(r[0],this)}};var L=class{constructor(t){this.target=t,this.entries=[]}addRegistration(t){return this.entries.push(t),t}removeRegistration(t){this.entries=this.entries.filter(r=>r!==t)}static _getInstance(t,r,e=!0,i=this.__namespace){if(!v(r))throw new Error(`Subject must be of type object; "${U(r)}" given!`);let o=this;return i&&globalThis.WebQitObserverNamespaceRegistry.has(t+"-"+i)&&(o=globalThis.WebQitObserverNamespaceRegistry.get(t+"-"+i),t+="-"+i),!S(r,"observerApi").has(t)&&e&&S(r,"observerApi").set(t,new o(r)),S(r,"observerApi").get(t)}static _namespace(t,r,e=null){if(t+="-"+r,arguments.length===2)return globalThis.WebQitObserverNamespaceRegistry.get(t);if(!(e.prototype instanceof this))throw new Error(`The implementation of the namespace ${this.name}.${r} must be a subclass of ${this.name}.`);globalThis.WebQitObserverNamespaceRegistry.set(t,e),e.__namespace=r}};globalThis.WebQitObserverNamespaceRegistry||(globalThis.WebQitObserverNamespaceRegistry=new Map);var N=class extends L{static getInstance(t,r=!0,e=null){return super._getInstance("listeners",...arguments)}static namespace(t,r=null){return super._namespace("listeners",...arguments)}addRegistration(t,r,e){return super.addRegistration(new re(this,{filter:t,handler:r,params:e}))}emit(t){this.entries.forEach(r=>r.fire(t))}};var ne=class extends D{exec(t,r,e){return this.running||!this.traps[t.type]?r(...Array.prototype.slice.call(arguments,2)):(this.running=!0,this.traps[t.type](t,e,(...i)=>(this.running=!1,r(...i))))}};var R=class extends L{static getInstance(t,r=!0,e=null){return super._getInstance("traps",...arguments)}static namespace(t,r=null){return super._namespace("traps",...arguments)}addRegistration(t){return super.addRegistration(new ne(this,t))}emit(t,r=null){let e=this;return function i(o,...s){let f=e.entries[o];return f?f.exec(t,(...u)=>i(o+1,...u),...s):r?r(t,...s):s[0]}(0)}};var I=class{constructor(t,r){if(this.target=t,!r.type)throw new Error("Descriptor type must be given in definition!");Object.assign(this,r)}};var Ae={};Le(Ae,{accessorize:()=>Ot,proxy:()=>At,unaccessorize:()=>vt,unproxy:()=>ce});function Ot(n,t,r={}){n=ve(n);let e=S(n,"accessorizedProps");function i(u){let c,l=n;for(;!c&&(l=Object.getPrototypeOf(l));)c=Object.getOwnPropertyDescriptor(l,u);return c?{proto:l,descriptor:c}:{descriptor:{value:void 0}}}function o(u){if(e.has(u))return!0;let c=i(u);c.getValue=function(){return"get"in this.descriptor?this.descriptor.get():this.descriptor.value},c.setValue=function(d){return"set"in this.descriptor?this.descriptor.set(d):this.descriptor.value=d},c.intact=function(){let d=Object.getOwnPropertyDescriptor(n,u);return d.get===p.get&&d.set===p.set&&e.get(u)===this},c.restore=function(){return this.intact()?(this.proto!==n?delete n[u]:Object.defineProperty(n,u,this.descriptor),e.delete(u),!0):!1},e.set(u,c);let{enumerable:l=!0,configurable:a=!0}=c.descriptor,p={enumerable:l,configurable:a};["value","set"].some(d=>d in c.descriptor)&&(p.set=function(d){return J(this,u,d,r)}),["value","get"].some(d=>d in c.descriptor)&&(p.get=function(){return V(this,u,r)});try{return Object.defineProperty(n,u,p),!0}catch{return e.delete(u),!1}}let f=(Array.isArray(t)?t:t===void 0?Object.keys(n):[t]).map(o);return t===void 0||Array.isArray(t)?f:f[0]}function vt(n,t,r={}){n=ve(n);let e=S(n,"accessorizedProps");function i(f){return e.has(f)?e.get(f).restore():!0}let s=(Array.isArray(t)?t:t===void 0?Object.keys(n):[t]).map(i);return t===void 0||Array.isArray(t)?s:s[0]}function At(n,t={}){n=ve(n);let r=new Proxy(n,{apply:(e,i,o)=>Fe(e,i,o,t),construct:(e,i,o=null)=>Te(e,i,o,t),defineProperty:(e,i,o)=>Ee(e,i,o,t),deleteProperty:(e,i)=>Ie(e,i,t),get:(e,i,o=null)=>{let s=V(e,i,{...t,receiver:o});return t.proxyAutoBinding!==!1&&O(s)&&!ge(s)?s.bind(r):s},getOwnPropertyDescriptor:(e,i)=>Ce(e,i,t),getPrototypeOf:e=>Se(e,t),has:(e,i)=>ae(e,i,t),isExtensible:e=>Pe(e,t),ownKeys:e=>le(e,t),preventExtensions:e=>qe(e,t),set:(e,i,o,s=null)=>J(e,i,o,{...t,receiver:s}),setPrototypeOf:(e,i)=>Me(e,i,t)});return S(r).set(r,n),r}function ce(n){return S(n,!1).get(n)||n}function ve(n){if(!n||!v(n))throw new Error("Target must be of type object!");return ce(n)}function Ct(n,t,r,e=o=>o,i={}){return function o(s,f,u){let c=f[u.level];return u.level<f.length-1?u={...u,preflight:!0}:u={...u,preflight:i.preflight},r(s,c,(l,...a)=>{let p=(h={})=>({...u,...h,level:u.level+1}),d=h=>{h instanceof I&&(h.path=[h.key],s instanceof I&&(h.path=s.path.concat(h.key),h.context=s))};if(pe(c)&&Array.isArray(l))return l.forEach(d),u.level===f.length-1||!l.length&&u.midwayResults?e(l,...a):l.map(h=>o(h,f,p(...a)));d(l);let m=v(W(l,!1));return u.level===f.length-1||!m&&u.midwayResults?e(l,...a):m&&o(l,f,p(...a))},u)}(n,t.slice(0),{...i,level:0})}function St(n,t,r,e={}){if(n=W(n),O(arguments[1])&&([,r,e={}]=arguments,t=1/0),!O(r))throw new Error(`Handler must be a function; "${U(r)}" given!`);let i=Je(n,t,r,e);return e.preflight?(e={...e,descripted:!0},delete e.live,V(n,t,i,e)):i()}function Pt(n,t,r={}){return n=W(n),b(t)||([,,,r={}]=arguments,t={[arguments[1]]:arguments[2]}),R.getInstance(n,!0,r.namespace).addRegistration({traps:t,params:r})}function Ce(n,t,r=i=>i,e={}){return F(n,"getOwnPropertyDescriptor",{key:t},r,e)}function Et(n,t,r=i=>i,e={}){return F(n,"getOwnPropertyDescriptors",{key:t},r,e)}function Se(n,t=e=>e,r={}){return F(n,"getPrototypeOf",{},t,r)}function Pe(n,t=e=>e,r={}){return F(n,"isExtensible",{},t,r)}function le(n,t=e=>e,r={}){return F(n,"ownKeys",{},t,r)}function ae(n,t,r=i=>i,e={}){return F(n,"has",{key:t},r,e)}function V(n,t,r=i=>i,e={}){let i;return n=W(n),b(r)?[e,r]=[r,o=>o]:e.live&&(i=!0),Tt(n,t,o=>{let s=[...o];return function f(u,c,l){if(!c.length)return l(u);let a=c.shift();function p(h,g=void 0){let y=C=>(h.value=C,f(u.concat(e.live||e.descripted?h:C),c,l));if(arguments.length>1)return y(g);let w=S(n,"accessorizedProps",!1),_=w&&w.get(h.key);return _&&_.intact()?y(_.getValue()):y(Reflect.get(n,h.key,...e.receiver?[e.receiver]:[]))}let d=new I(n,{type:"get",key:a,value:void 0,related:s}),m=R.getInstance(n,!1,e.namespace);return m?m.emit(d,p):p(d)}([],o.slice(0),f=>{let u=pe(t)?f:f[0];return i?Je(n,t,r,e)(u):r(u)})})}function J(n,t,r,e=s=>s,i={},o=!1){n=W(n);let s=[[t,r]];b(t)&&([,,e=u=>u,i={},o=!1]=arguments,s=Object.entries(t)),b(e)&&([o,i,e]=[typeof i=="boolean"?i:!1,e,u=>u]);let f=s.map(([u])=>u);return function u(c,l,a){if(!l.length)return a(c);let[p,d]=l.shift();function m(g,y=void 0){let w=B=>(g.status=B,u(c.concat(g),l,a));if(arguments.length>1)return w(g,y);let _=S(n,"accessorizedProps",!1),C=_&&_.get(g.key);return g.type==="defineProperty"?(C&&!C.restore()&&w(!1),Object.defineProperty(n,g.key,g.value),w(!0)):C&&C.intact()?w(C.setValue(g.value)):w(Reflect.set(n,g.key,g.value))}function h(g,y){let w=new I(n,{type:o?"defineProperty":"set",key:p,value:d,isUpdate:g,oldValue:y,related:[...f],detail:i.detail}),_=R.getInstance(n,!1,i.namespace);return _?_.emit(w,m):m(w)}return ae(n,p,g=>!g||i.oldValue!==!0?h(g):V(n,p,y=>h(g,y),i),i)}([],s.slice(0),u=>{let c=N.getInstance(n,!1,i.namespace);return c&&c.emit(u),e(pe(t)?u.map(l=>l.status):u[0].status)})}function Ee(n,t,r,e=o=>o,i={}){return J(n,t,r,e,i,!0)}function It(n,t,r=i=>i,e={}){return J(n,t,r,e,!0)}function Ie(n,t,r=i=>i,e={}){n=W(n),b(r)&&([e,r]=[r,s=>s]);let i=A(t),o=[...i];return function s(f,u,c){if(!u.length)return c(f);let l=u.shift();function a(d,m=void 0){let h=w=>(d.status=w,s(f.concat(d),u,c));if(arguments.length>1)return h(d,m);let g=S(n,"accessorizedProps",!1),y=g&&g.get(d.key);return y&&!y.restore()&&h(!1),h(Reflect.deleteProperty(n,d.key))}function p(d){let m=new I(n,{type:"deleteProperty",key:l,oldValue:d,related:[...o],detail:e.detail}),h=R.getInstance(n,!1,e.namespace);return h?h.emit(m,a):a(m)}return e.oldValue===!1?p():V(n,l,p,e)}([],i.slice(0),s=>{let f=N.getInstance(n,!1,e.namespace);return f&&f.emit(s),r(pe(t)?s.map(u=>u.status):s[0].status)})}function Te(n,t,r=null,e=o=>o,i={}){return F(n,"construct",arguments.length>2?{argumentsList:t,newTarget:r}:{argumentsList:t},e,i)}function Fe(n,t,r,e=o=>o,i={}){return F(n,"apply",{thisArgument:t,argumentsList:r},e,i)}function Me(n,t,r=i=>i,e={}){return F(n,"setPrototypeOf",{proto:t},r,e)}function qe(n,t=e=>e,r={}){return F(n,"preventExtensions",{},t,r)}function Je(n,t,r,e={}){let i;e.signal||(i=new AbortController,e={...e,signal:i.signal});let o=N.getInstance(n,!0,e.namespace);return function s(f,u=null){u?.remove();let l={signal:o.addRegistration(t,s,e).signal};return arguments.length&&r(f,l),i}}function F(n,t,r={},e=o=>o,i={}){n=W(n),b(e)&&([i,e]=[e,u=>u]);function o(u,c){return arguments.length>1?e(c):e(Reflect[t](n,...Object.values(r)))}let s=new I(n,{type:t,...r}),f=R.getInstance(n,!1,i.namespace);return f?f.emit(s,o):o(s)}function pe(n){return n===1/0||Array.isArray(n)}function W(n,t=!0){if((!n||!v(n))&&t)throw new Error(`Object must be of type object or array! "${U(n)}" given.`);return n instanceof I&&(n=n.value),n&&ce(n)}function Tt(n,t,r){return t===1/0?le(n,r):r(A(t))}var Ft={...Re,...Ae},z=Ft;function k(n,t,r={},e={}){t=A(t).slice();for(var i=n;!q(i)&&!K(i)&&t.length;){var o=t.shift();if(!(r.get?r.get(i,o):v(i)?o in i:i[o])){e.exists=!1;return}i=r.get?r.get(i,o):i[o]}return e.exists=!0,i}function $e(n,t,r,e={},i={}){let o=(l,a,p)=>i.set?i.set(l,a,p):(E(t[f])&&x(l)?l.push(p):l[a]=p,!0);t=A(t);for(var s=n,f=0;f<t.length;f++)if(f<t.length-1){if(!s||!v(s)&&!O(s))return!1;var u=k(s,t[f],i);if(!v(u)){if(i.buildTree===!1)return!1;u=O(i.buildTree)?i.buildTree(f):E(t[f+1])?[]:{};var c=o(s,t[f],u);if(!c)return!1}s=u}else return o(s,t[f],r)}var Xe=n=>class{constructor(r=!0){Object.defineProperty(this,"window",{value:n}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),this.async=r,this.window.requestAnimationFrame?this._run():this.async=!1}_run(){this.window.requestAnimationFrame(()=>{this.readCallbacks.forEach(r=>{r()||this.readCallbacks.delete(r)}),this.writeCallbacks.forEach(r=>{r()||this.writeCallbacks.delete(r)}),this._run()})}onread(r,e=!1){if(e)return new Promise((i,o)=>{this.async===!1?r(i,o):this.readCallbacks.add(()=>{r(i,o)})});this.async===!1?r():this.readCallbacks.add(r)}onwrite(r,e=!1){if(e)return new Promise((i,o)=>{this.async===!1?r(i,o):this.writeCallbacks.add(()=>{r(i,o)})});this.async===!1?r():this.writeCallbacks.add(r)}cycle(r,e,i){this.onread(()=>{let o=r(i),s=f=>{f!==void 0&&this.onwrite(()=>{let u=e(f,i),c=l=>{l!==void 0&&this.cycle(r,e,l)};u instanceof Promise?u.then(c):c(u)})};o instanceof Promise?o.then(s):s(o)})}};var G=class{constructor(t,r,e){this.context=t,this.namespace=r,this.window=t.defaultView||t.ownerDocument?.defaultView||e,this.document=this.window.document,this.wq=this.window.wq,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){return O(t[0])?t=[[],...t]:b(t[0])&&t.length===1?t=[[],void 0,t[0]]:b(t[1])&&t.length===2?t=[A(t[0],!1),void 0,t[1]]:t[0]=A(t[0],!1),t}registry(...t){return S(this.window,"dom.realtime",this.namespace,...t)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(t,r,e){let{window:i}=this,o=Array.isArray(r)?r:[r],s=new Set;for(let[f,u]of this.registry(t))for(let[c,l]of u){let a=o.filter(p=>c.contains(p.target)?f==="subtree"||p.target===c:!1);if(!!a.length){Array.isArray(r)||(a=a[0]);for(let p of l)s.add([p,a,c])}}for(let[f,u,c]of s)e.call(this,f,u,c)}disconnectables(t,...r){let e={disconnect(){r.forEach(i=>i&&O(i.disconnect)&&i.disconnect()||O(i)&&i()||b(i)&&(i.disconnected=!0))}};return t&&t.addEventListener("abort",()=>e.disconnect()),e}};var $=class extends G{constructor(t,...r){super(t,"attr",...r)}get(t,r=void 0,e={}){let i=typeof t=="string";[t=[],r=void 0,e={}]=this.resolveArgs(arguments);let{context:o}=this,s=et(o,t),f=i?s[0]:s;if(!r)return f;let u=r&&e.lifecycleSignals&&this.createSignalGenerator(),c=u?.generate()||{};if(r(f,c,o),e.live){u&&(e={...e,signalGenerator:u});let l=this.observe(i?t[0]:t,r,{newValue:!0,...e});return this.disconnectables(e.signal,l)}}observe(t,r,e={}){let i=typeof t=="string";if([t=[],r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(i?t[0]:t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:o,window:s,wq:f}=this;e.eventDetails&&!f.attrInterceptionHooks?.intercepting&&Ze.call(s,"intercept",()=>{});let u=new s.MutationObserver(p=>{p=Ke(p).map(d=>tt.call(s,d)),Ye.call(s,a,p,o)}),c={attributes:!0,attributeOldValue:e.oldValue,subtree:e.subtree};t.length&&(c.attributeFilter=t),u.observe(o,c);let l=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),a={context:o,filter:t,callback:r,params:e,atomics:new Map,originalFilterIsString:i,signalGenerator:l,disconnectable:u};return this.disconnectables(e.signal,u,l)}observeSync(t,r,e={}){let i=typeof t=="string";[t,r,e={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let f=e.timing==="intercept"?"intercept":"sync",u=e.subtree?"subtree":"children";this.registry(f).size||Ze.call(s,f,m=>{this.forEachMatchingContext(f,m,Ye)});let c={disconnect(){d.delete(a),d.size||p.delete(o)}},l=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),a={context:o,filter:t,callback:r,params:e,atomics:new Map,originalFilterIsString:i,signalGenerator:l,disconnectable:c},p=this.registry(f,u);p.has(o)||p.set(o,new Set);let d=p.get(o);return d.add(a),this.disconnectables(e.signal,c,l)}};function Ke(n){return n.reduce((t,r,e)=>t[e-1]?.attributeName===r.attributeName?t:t.concat(r),[])}function Ye(n,t){let{context:r,filter:e,callback:i,params:o,atomics:s,originalFilterIsString:f,signalGenerator:u}=n;o.atomic&&!s.size&&(t=et(r,e,t)),o.newValue===null&&o.oldValue===null||(t=t.map(a=>{let p;return!o.oldValue&&"oldValue"in a&&({oldValue:p,...a}=a),!o.newValue&&"value"in a?{value:p,...a}=a:o.newValue&&typeof a.value>"u"&&(a={...a,value:a.target.getAttribute(a.name)}),a})),o.atomic&&(t.forEach(a=>s.set(a.name,a)),t=Array.from(s.entries()).map(([,a])=>a));let c=f?t[0]:t,l=u?.generate()||{};i(c,l,r)}function et(n,t,r=[]){let e={event:null,type:"attribute"};return t.length?t.map(o=>r.find(s=>s.name===o)||{target:n,name:o,value:n.getAttribute(o),...e}):Array.from(n.attributes).map(o=>r.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:o.nodeValue,...e})}function tt({target:n,attributeName:t,value:r,oldValue:e}){let s=(this.wq.attrInterceptionRecords?.get(n)||{})[t]||"mutation";return{target:n,name:t,value:r,oldValue:e,type:"observation",event:s}}function Ze(n,t){let r=this,{wq:e,document:i,Element:o}=r;e.attrInterceptionHooks||(e.attrInterceptionHooks=new Map),e.attrInterceptionHooks.has(n)||e.attrInterceptionHooks.set(n,new Set),e.attrInterceptionHooks.get(n).add(t);let s=()=>e.attrInterceptionHooks.get(n).delete(t);if(e.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),e.attrInterceptionHooks.intercepting=!0,e.attrInterceptionRecords=new Map;let f=(l,a)=>{e.attrInterceptionRecords.has(l.target)||e.attrInterceptionRecords.set(l.target,{});let p=e.attrInterceptionRecords.get(l.target);clearTimeout(p[l.name]?.timeout),p[l.name]=l.event;let d=setTimeout(()=>{delete p[l.name]},0);Object.defineProperty(l.event,"timeout",{value:d,configurable:!0}),e.attrInterceptionHooks.get("intercept")?.forEach(h=>h([l]));let m=a();return e.attrInterceptionHooks.get("sync")?.forEach(h=>h([l])),m};new r.MutationObserver(l=>{l=Ke(l).map(a=>tt.call(r,a)).filter((a,p)=>!Array.isArray(a.event)),l.length&&(e.attrInterceptionHooks.get("intercept")?.forEach(a=>a(l)),e.attrInterceptionHooks.get("sync")?.forEach(a=>a(l)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let c=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(l=>{c[l]=o.prototype[l],o.prototype[l]=function(...a){let p,d=this.getAttribute(a[0]);["setAttribute","toggleAttribute"].includes(l)&&(p=a[1]),l==="toggleAttribute"&&p===void 0&&(p=d===null);let m={target:this,name:a[0],value:p,oldValue:d,type:"interception",event:[this,l]};return f(m,()=>c[l].call(this,...a))}}),s}var X=class extends G{constructor(t,...r){super(t,"tree",...r)}attr(t,r=void 0,e={}){let{context:i,window:o}=this;return new $(i,o).get(...arguments)}query(t,r=void 0,e={}){[t,r=void 0,e={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=c=>(o.has(c)||o.set(c,{target:c,entrants:[],exits:[],type:"query",event:null}),o.get(c));if((!e.generation||e.generation==="entrants")&&(t.length?t.every(c=>typeof c=="string")&&(t=t.join(","))&&(e.subtree?i.querySelectorAll(t):[...i.children].filter(l=>l.matches(t))).forEach(l=>s(l.parentNode||i).entrants.push(l)):[...i.children].forEach(c=>s(i).entrants.push(c))),!r)return o;let f={disconnected:!1},u=r&&e.lifecycleSignals&&this.createSignalGenerator();for(let[,c]of o){if(f.disconnected)break;let l=u?.generate()||{};r(c,l,i)}if(e.live){u&&(e={...e,signalGenerator:u});let c=this.observe(t,r,e);return this.disconnectables(e.signal,f,c)}return this.disconnectables(e.signal,f,u)}children(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!1})}subtree(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!0})}observe(t,r,e={}){if([t,r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:i,window:o,wq:s,document:f}=this;e.eventDetails&&(s.domInterceptionRecordsAlwaysOn=!0),(f.readyState==="loading"||s.domInterceptionRecordsAlwaysOn)&&!s.domInterceptionHooks?.intercepting&&it.call(o,"sync",()=>{});let u=new o.MutationObserver(a=>a.forEach(p=>{nt.call(o,l,ot.call(o,p),i)}));u.observe(i,{childList:!0,subtree:e.subtree});let c=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),l={context:i,selectors:t,callback:r,params:e,signalGenerator:c,disconnectable:u};if(e.staticSensitivity){let a=rt.call(o,l);return this.disconnectables(e.signal,u,c,a)}return this.disconnectables(e.signal,u,c)}observeSync(t,r,e={}){[t,r,e={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let s=e.timing==="intercept"?"intercept":"sync",f=e.subtree?"subtree":"children";this.registry(s).size||it.call(o,s,d=>{this.forEachMatchingContext(s,d,nt)});let u={disconnect(){p.delete(l),p.size||a.delete(i)}},c=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),l={context:i,selectors:t,callback:r,params:e,signalGenerator:c,disconnectable:u},a=this.registry(s,f);a.has(i)||a.set(i,new Set);let p=a.get(i);if(p.add(l),e.staticSensitivity){let d=rt.call(o,l);return this.disconnectables(e.signal,u,c,d)}return this.disconnectables(e.signal,u,c)}};function rt(n){let t=this,{context:r,selectors:e,callback:i,params:o,signalGenerator:s}=n,f=l=>[...l.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(a=>a[1]);if(!(n.$attrs=e.filter(l=>typeof l=="string"&&l.includes("[")).reduce((l,a)=>l.concat(f(a)),[])).length)return;let u=new Set,c=new Set;return u.push=l=>(c.delete(l),u.add(l)),c.push=l=>(u.delete(l),c.add(l)),n.$deliveryCache={entrants:u,exits:c},new $(r,t).observe(n.$attrs,l=>{let a=new Map,p=h=>(a.has(h)||a.set(h,{target:h,entrants:[],exits:[],type:"static",event:null}),a.get(h)),d=new WeakMap,m=h=>(d.has(h)||d.set(h,e.some(g=>h.matches(g))),d.get(h));for(let h of l)["entrants","exits"].forEach(g=>{o.generation&&g!==o.generation||n.$deliveryCache[g].has(h.target)||(g==="entrants"?!m(h.target):m(h.target))||(n.$deliveryCache[g].push(h.target),p(h.target)[g].push(h.target),p(h.target).event=h.event)});for(let[,h]of a){let g=s?.generate()||{};i(h,g,r)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function nt(n,t){let{context:r,selectors:e,callback:i,params:o,signalGenerator:s,$deliveryCache:f}=n,u={...t,entrants:[],exits:[]};if(["entrants","exits"].forEach(l=>{if(!(o.generation&&l!==o.generation)&&(e.length?u[l]=$t(e,t[l],t.event!=="parse"):u[l]=[...t[l]],!!f))for(let a of u[l])f[l].push(a)}),!u.entrants.length&&!u.exits.length)return;let c=s?.generate()||{};i(u,c,r)}function $t(n,t,r){t=Array.isArray(t)?t:[...t];let e=(i,o)=>{if(i=i.filter(s=>s.matches),typeof o=="string"){let s=i.filter(f=>f.matches(o));if(r&&(s=i.reduce((f,u)=>[...f,...u.querySelectorAll(o)],s)),s.length)return s}else if(i.includes(o)||r&&i.some(s=>s.contains(o)))return[o]};return t.$$searchCache||(t.$$searchCache=new Map),n.reduce((i,o)=>{let s;return t.$$searchCache.has(o)?s=t.$$searchCache.get(o):(s=e(t,o)||[],b(o)&&t.$$searchCache.set(o,s)),i.concat(s)},[])}function ot({target:n,addedNodes:t,removedNodes:r}){let e=this,i;return i=A(t).reduce((o,s)=>o||e.wq.domInterceptionRecords?.get(s),null),i=A(r).reduce((o,s)=>o||e.wq.domInterceptionRecords?.get(s),i),i=i||e.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:t,exits:r,type:"observation",event:i}}function it(n,t){let r=this,{wq:e,document:i,Node:o,Element:s,HTMLElement:f,HTMLTemplateElement:u,DocumentFragment:c}=r;e.domInterceptionHooks||(e.domInterceptionHooks=new Map),e.domInterceptionHooks.has(n)||e.domInterceptionHooks.set(n,new Set),e.domInterceptionHooks.get(n).add(t);let l=()=>e.domInterceptionHooks.get(n).delete(t);if(e.domInterceptionHooks?.intercepting)return l;console.warn("DOM mutation APIs are now being intercepted."),e.domInterceptionHooks.intercepting=!0,e.domInterceptionRecords=new Map;let a=()=>!0,p=(m,h)=>{a()?m.entrants.concat(m.exits).forEach(y=>{clearTimeout(e.domInterceptionRecords.get(y)?.timeout),e.domInterceptionRecords.set(y,m.event);let w=setTimeout(()=>{e.domInterceptionRecords.delete(y)},0);Object.defineProperty(m.event,"timeout",{value:w,configurable:!0})}):e.domInterceptionRecords.clear(),e.domInterceptionHooks.get("intercept")?.forEach(y=>y(m));let g=h();return e.domInterceptionHooks.get("sync")?.forEach(y=>y(m)),g};if(a()){let m=new r.MutationObserver(h=>h.forEach(g=>{Array.isArray((g=ot.call(r,g)).event)||(e.domInterceptionHooks.get("intercept")?.forEach(y=>y(g)),e.domInterceptionHooks.get("sync")?.forEach(y=>y(g)))}));m.observe(i,{childList:!0,subtree:!0}),i.addEventListener("readystatechange",()=>!a()&&m.disconnect())}let d=Object.create(null);return["insertBefore","insertAdjacentElement","insertAdjacentHTML","setHTML","replaceChildren","replaceWith","remove","replaceChild","removeChild","before","after","append","prepend","appendChild"].forEach(m=>{let h=["insertBefore","replaceChild","removeChild","appendChild"].includes(m)?o:s;d[m]=h.prototype[m],d[m]&&(h.prototype[m]=function(...g){let y=()=>d[m].call(this,...g);if(!(this instanceof s||this instanceof c))return y();let w=[],_=[],C=this;["insertBefore"].includes(m)?_=[g[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(m)?(_=[g[1]],["beforebegin","afterend"].includes(g[0])&&(C=this.parentNode)):["setHTML","replaceChildren"].includes(m)?(w=[...this.childNodes],_=m==="replaceChildren"?[...g]:[g[0]]):["replaceWith","remove"].includes(m)?(w=[this],_=m==="replaceWith"?[...g]:[],C=this.parentNode):["replaceChild"].includes(m)?(w=[g[1]],_=[g[0]]):["removeChild"].includes(m)?w=[...g]:(_=[...g],["before","after"].includes(m)&&(C=this.parentNode));let B=m;if(["insertAdjacentHTML","setHTML"].includes(m)){let j=this.nodeName;if(m==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(g[0])){if(!this.parentNode)return d[m].call(this,...g);j=this.parentNode.nodeName}let oe=i.createElement(j);d.setHTML.call(oe,_[0],m==="setHTML"?g[1]:{}),_=[...oe.childNodes],m==="insertAdjacentHTML"?(B="insertAdjacentElement",g[1]=new c,g[1].______isTemp=!0,g[1].append(...oe.childNodes)):(B="replaceChildren",g=[...oe.childNodes])}return p({target:C,entrants:_,exits:w,type:"interception",event:[this,m]},()=>d[B].call(this,...g))})}),["outerHTML","outerText","innerHTML","innerText","textContent","nodeValue"].forEach(m=>{let h=["textContent","nodeValue"].includes(m)?o:["outerText","innerText"].includes(m)?f:s;d[m]=Object.getOwnPropertyDescriptor(h.prototype,m),Object.defineProperty(h.prototype,m,{...d[m],set:function(g){let y=()=>d[m].set.call(this,g);if(!(this instanceof s))return y();let w=[],_=[],C=this;if(["outerHTML","outerText"].includes(m)?(w=[this],C=this.parentNode):w=[...this.childNodes],["outerHTML","innerHTML"].includes(m)){let ie=this.nodeName;if(m==="outerHTML"){if(!this.parentNode)return y();ie=this.parentNode.nodeName}let j=i.createElement(ie==="TEMPLATE"?"div":ie);d[m].set.call(j,g),_=this instanceof u?[]:[...j.childNodes],m==="outerHTML"?(g=new c,g.______isTemp=!0,g.append(...j.childNodes),y=()=>d.replaceWith.call(this,g)):this instanceof u?y=()=>this.content.replaceChildren(...j.childNodes):y=()=>d.replaceChildren.call(this,...j.childNodes)}return p({target:C,entrants:_,exits:w,type:"interception",event:[this,m]},y)}})}),["append","prepend","replaceChildren"].forEach(m=>{[i,c.prototype].forEach(h=>{let g=h[m];h[m]=function(...y){if(this.______isTemp)return g.call(this,...y);let w=m==="replaceChildren"?[...this.childNodes]:[];return p({target:this,entrants:y,exits:w,type:"interception",event:[this,m]},()=>g.call(this,...y))}})}),l}function st(){jt.call(this),Ht.call(this),Dt.call(this)}function jt(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function Ht(){let n=this;"isConnected"in n.Node.prototype||Object.defineProperty(n.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function Dt(){let n=this;n.Element.prototype.matches||(n.Element.prototype.matches=n.Element.prototype.matchesSelector||n.Element.prototype.mozMatchesSelector||n.Element.prototype.msMatchesSelector||n.Element.prototype.oMatchesSelector||n.Element.prototype.webkitMatchesSelector||function(t){for(var r=(this.document||this.ownerDocument).querySelectorAll(t),e=r.length;--e>=0&&r.item(e)!==this;);return e>-1})}function ut(){let n=this;if(n.wq||(n.wq={}),n.wq.dom)return n.wq.dom;n.wq.dom={},st.call(n);let t=Xe(n);return n.wq.dom.Reflow=new t,n.wq.dom.DOMRealtime=X,n.wq.dom.AttrRealtime=$,n.wq.dom.realtime=(r,e="tree")=>{if(e==="tree")return new X(r,n);if(e==="attr")return new $(r,n)},n.wq.dom.ready=Lt.bind(n),n.wq.dom.meta=Nt.bind(n),n.wq.dom}function Lt(n){let t=this;t.document.readyState==="complete"?n(t):(t.document.domReadyCallbacks||(t.document.domReadyCallbacks=[],t.document.addEventListener("DOMContentLoaded",()=>{t.document.domReadyCallbacks.splice(0).forEach(r=>r(t))},!1)),t.document.domReadyCallbacks.push(n))}function Nt(n,t=!1){let r=this,e={content:{}};return!(e.el=r.document.querySelector(`meta[name="${n}"]`))&&t&&(e.el=r.document.createElement("meta"),e.el.setAttribute("name",n),r.document.head.append(e.el)),e.el&&(e.content=(e.el.getAttribute("content")||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(f=>f.trim());return $e(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:E(s[1])?parseInt(s[1]):s[1]),i},{})),e.get=function(i){return JSON.parse(JSON.stringify(k(this.content,i.split("."))))},e.copy=function(){return JSON.parse(JSON.stringify(this.content))},e.copyWithDefaults=function(...i){return i.length?te(!0,{},...i.reverse().concat(this.content)):this.copy()},e}function De(n={}){let t=this,e=ut.call(t).meta("oohtml").copyWithDefaults(n,{script:{retention:"retain",mimeType:""},parserParams:{...de,allowReturnOutsideFunction:!1,allowSuperOutsideMethod:!1},compilerParams:{...se,globalsNoObserve:[...se.globalsNoObserve,"alert"]},runtimeParams:{...he,apiVersion:2}});e.scriptSelector=(Array.isArray(e.script.mimeType)?e.script.mimeType:[e.script.mimeType]).reduce((i,o)=>{let s=o?`[type=${t.CSS.escape(o)}]`:"";return i.concat(`script${s}[scoped],script${s}[contract]`)},[]).join(","),Vt.call(this,e)}function Vt(n){let t=this,{dom:r}=t.wq;t.wq.transformCache=new Map,t.wq.compileCache=[new Map,new Map];let e=()=>{};r.realtime(t.document).observe(n.scriptSelector,i=>{i.entrants.forEach(o=>{if("contract"in o||(Object.defineProperty(o,"contract",{value:o.hasAttribute("contract")}),"scoped"in o))return e(o);Object.defineProperty(o,"scoped",{value:o.hasAttribute("scoped")});let s=o.scoped?i.target:o.type==="module"?void 0:t;zt.call(this,o,s,n)})},{subtree:!0,timing:"intercept",generation:"entrants"}),t.wq.exec=i=>{let o=Ut(i);if(!o)throw new Error("Argument must be a valid exec hash.");let{script:s,compiledScript:f,thisContext:u}=o;switch(u instanceof t.Element&&s.scoped&&(u.scripts||Object.defineProperty(u,"scripts",{value:new Set}),u.scripts.add(s)),n.script.retention){case"dispose":s.remove();break;case"hidden":s.textContent='"source hidden"';break;default:s.textContent=f.function.originalSource}return Wt.call(this,f,u,s)}}function Wt(n,t,r){if(!n.function)throw new Error("Input script must already be compiled!");let e=n.function.call(t);r.contract&&(Object.defineProperty(r,"rerender",{value:(...s)=>je(e,([,f])=>f(...s))}),je(r.properties,s=>{let f=(u,c)=>(Array.isArray(c)?c:[c]).map(l=>[...u,...l.path||[l.key]]);s.processes=s.dependencies.map(u=>u[0]==="this"?z.deep(t,u.slice(1),z.observe,c=>{r.rerender(...f(["this"],c))}):z.deep(globalThis,u,z.observe,c=>{r.rerender(...f([],c))}))}));let i=this,{dom:o}=i.wq;return o.realtime(i.document).observe(t,()=>{r.contract&&je(r.properties,s=>{s.processes.forEach(f=>f.abort())}),t.dispatchEvent(new i.CustomEvent("remove")),t.scripts.delete(r)},{subtree:!0,timing:"sync",generation:"exits"}),r}function zt(n,t,r={}){let e=this.wq,i=e.compileCache[n.contract?0:1],o=ft(n.textContent),s=n.textContent,f;if(!(f=i.get(o))){let c=[],l={},a=[];n.type==="module"&&a.push("import "),n.type==="module"&&!n.contract&&a.push("await "),a.length&&new RegExp(a.join("|")).test(s)&&([c,s,l]=kt(s),c.length&&(s=`
15
+ ${Gt(c).join(`
16
16
  `)}
17
- ${o}
18
- `));let p;if(i.contract){let g={...r.parserParams||{},allowReturnOutsideFunction:!1,allowAwaitOutsideFunction:i.type==="module",allowSuperOutsideMethod:!1},m={...r.runtimeParams||{},async:i.type==="module",apiVersion:2};p=U(o,{...r,parserParams:g,runtimeParams:m})}else{let m=i.type==="module"?Object.getPrototypeOf(async function(){}).constructor:Function;p=r.runtimeParams?.compileFunction?r.runtimeParams.compileFunction(o):new m(o),Object.defineProperty(p,"originalSource",{configurable:!0,value:i.textContent})}f=Object.defineProperty(i.cloneNode(),"function",{value:p}),i.scoped&&Object.defineProperty(f,"scoped",Object.getOwnPropertyDescriptor(i,"scoped")),i.contract&&Object.defineProperty(f,"contract",Object.getOwnPropertyDescriptor(i,"contract")),n.set(s,f)}let c=Ae({script:i,compiledScript:f,thisContext:t});i.textContent=`wq.exec('${c}');`}function et(i){let[t,r]=Ee(i,(o,f,c,u,l,a)=>{if(f==="start-enclosure"&&c==="{"&&!u.openAsync?.type&&u.openEnclosures.length===u.openAsync?.scopeId)u.openAsync.type="block";else if(f==="end-enclosure"&&c==="}"&&u.openAsync?.type==="block"&&u.openEnclosures.length===u.openAsync.scopeId)u.openAsync=null;else if(f==="start-quote"&&!u.openEnclosures.length&&["starting","from"].includes(u.openImport))u.openImport="url";else if(f==="end-quote"&&u.openImport==="url")u.openImport="closing";else if(f==="char"){if(u.openImport==="closing"&&(c===";"||![" ",`
19
- `].includes(c)||a))return c===";"||a?(o[0]+=c,o.unshift("")):o.unshift(c),u.openImport=null,!1;let p=i.substring(l-1);if(!u.openImport&&/^[\W]?import[ ]*[^\(]/.test(p))return u.openImport="starting",o.unshift(""),6;if(u.openImport==="starting"&&/^[\W]?from /.test(p))return u.openImport="from",4;if(!u.openAsync){if(/^[\W]?async /.test(p))return u.openAsync={scopeId:u.openEnclosures.length},5;if(/^[\W]?await /.test(p))return u.topLevelAwait=!0,5}u.openAsync&&(!u.openAsync.type&&/.?\=\>[ ]*?\{/.test(p)?u.openAsync.type="inline-arrow":u.openAsync.type==="inline-arrow"&&[`
20
- `,";"].includes(c)&&u.openEnclosures.length===u.openAsync.scopeId&&(u.openAsync=null))}}),e=[],n="",s;for(let o of t.reverse())(s=o.trim()).startsWith("import ")?e.push(o):s&&(n+=o);return[e,n,r]}function tt(i){let t=[],r=[];return i.forEach((e,n)=>{e=rt(e);let[s,o]=e.items.reduce(([f,c],u)=>u.id==="*"?[u.alias,c]:[f,c.concat(u)],[null,[]]);if(s&&t.push(`const ${s} = __$imports$__[${n}];`),o.length){let f=o.map(c=>`${c.id}${c.id!==c.alias?`: ${c.alias}`:""}`).join(", ");t.push(`const { ${f} } = __$imports$__[${n}];`)}r.push(`import("${e.url}")`)}),[`
17
+ ${s}
18
+ `));let p;if(n.contract){let{parserParams:d,compilerParams:m,runtimeParams:h}=r;d={...d,allowAwaitOutsideFunction:n.type==="module"},h={...h,async:n.type==="module"},p=Z(s,{compilerParams:m,parserParams:d,runtimeParams:h}),Object.defineProperty(n,"properties",{configurable:!0,value:Z.inspect(p,"properties")})}else{let m=n.type==="module"?Object.getPrototypeOf(async function(){}).constructor:Function;p=r.runtimeParams?.compileFunction?r.runtimeParams.compileFunction(s):new m(s),Object.defineProperty(p,"originalSource",{configurable:!0,value:n.textContent})}f=Object.defineProperty(n.cloneNode(),"function",{value:p}),n.scoped&&Object.defineProperty(f,"scoped",Object.getOwnPropertyDescriptor(n,"scoped")),n.contract&&Object.defineProperty(f,"contract",Object.getOwnPropertyDescriptor(n,"contract")),i.set(o,f)}let u=ft({script:n,compiledScript:f,thisContext:t});n.textContent=`wq.exec('${u}');`}function kt(n){let[t,r]=ct(n,(s,f,u,c,l,a)=>{if(f==="start-enclosure"&&u==="{"&&!c.openAsync?.type&&c.openEnclosures.length===c.openAsync?.scopeId)c.openAsync.type="block";else if(f==="end-enclosure"&&u==="}"&&c.openAsync?.type==="block"&&c.openEnclosures.length===c.openAsync.scopeId)c.openAsync=null;else if(f==="start-quote"&&!c.openEnclosures.length&&["starting","from"].includes(c.openImport))c.openImport="url";else if(f==="end-quote"&&c.openImport==="url")c.openImport="closing";else if(f==="char"){if(c.openImport==="closing"&&(u===";"||![" ",`
19
+ `].includes(u)||a))return u===";"||a?(s[0]+=u,s.unshift("")):s.unshift(u),c.openImport=null,!1;let p=n.substring(l-1);if(!c.openImport&&/^[\W]?import[ ]*[^\(]/.test(p))return c.openImport="starting",s.unshift(""),6;if(c.openImport==="starting"&&/^[\W]?from /.test(p))return c.openImport="from",4;if(!c.openAsync){if(/^[\W]?async /.test(p))return c.openAsync={scopeId:c.openEnclosures.length},5;if(/^[\W]?await /.test(p))return c.topLevelAwait=!0,5}c.openAsync&&(!c.openAsync.type&&/.?\=\>[ ]*?\{/.test(p)?c.openAsync.type="inline-arrow":c.openAsync.type==="inline-arrow"&&[`
20
+ `,";"].includes(u)&&c.openEnclosures.length===c.openAsync.scopeId&&(c.openAsync=null))}}),e=[],i="",o;for(let s of t.reverse())(o=s.trim()).startsWith("import ")?e.push(s):o&&(i+=s);return[e,i,r]}function Gt(n){let t=[],r=[];return n.forEach((e,i)=>{e=Bt(e);let[o,s]=e.items.reduce(([f,u],c)=>c.id==="*"?[c.alias,u]:[f,u.concat(c)],[null,[]]);if(o&&t.push(`const ${o} = __$imports$__[${i}];`),s.length){let f=s.map(u=>`${u.id}${u.id!==u.alias?`: ${u.alias}`:""}`).join(", ");t.push(`const { ${f} } = __$imports$__[${i}];`)}r.push(`import("${e.url}")`)}),[`
21
21
  const __$imports$__ = await Promise.all([
22
22
  ${r.join(`,
23
23
  `)}
24
24
  ]);`,t.join(`
25
- `)]}function rt(i){let t=n=>{let s=/^[`'"]/.exec(n);return s&&n.substring(1,n.lastIndexOf(s[0]))},r={items:[{id:""}]},e=i.replace("import","").trim();return(r.url=t(e))||Ee(e,(n,s,o,f,c,u)=>{if(["start-quote","ongoing-quote","end-quote","char"].includes(s)){if(r.url)return;if(!f.openQuote){let l=e.substring(c);if(o===","){r.items.unshift({id:""});return}if(l.startsWith(" as "))return r.items[0].alias="",3;if(l.startsWith(" from "))return r.url=t(l.replace("from","").trim()),l.length}"alias"in r.items[0]?r.items[0].alias+=o:(r.items[0].id+=o,f.openEnclosures.length&&(r.items[0].enclosed=!0))}}),r.items=r.items.map(n=>({id:n.id&&!n.alias&&!n.enclosed?"default":n.id.trim(),alias:n.alias?n.alias.trim():n.id.trim()})).filter(n=>n.id).reverse(),r}function Ee(i,t){let r=i.length-1;return[...i].reduce(([e,n,s],o,f)=>{if(s)return e[0]+=o,[e,n,--s];let c;if(n.openQuote||n.openComment)return o===n.openQuote?(n.openQuote=null,c=t(e,"end-quote",o,n,f,f===r)):n.openQuote?c=t(e,"ongoing-quote",o,n,f,f===r):n.openComment&&(n.openComment==="//"&&o===`
26
- `||n.openComment==="/*"&&e[0].substr(-1)==="*"&&o==="/")&&(n.openComment=null,c=t(e,"end-comment",o,n,f,f===r)),c!==!1&&(e[0]+=o),[e,n,typeof c=="number"?c:s];let u;return(u=["()","{}","[]"].filter(l=>o===l[0])[0])?(c=t(e,"start-enclosure",o,n,f,f===r),n.openEnclosures.unshift(u)):n.openEnclosures.length&&o===n.openEnclosures[0][1]?(n.openEnclosures.shift(),c=t(e,"end-enclosure",o,n,f,f===r)):['"',"'","`"].includes(o)?(c=t(e,"start-quote",o,n,f,f===r),n.openQuote=o):!n.openComment&&["/*","//"].includes(i.substr(f,2))?(c=t(e,"start-comment",o,n,f,f===r),n.openComment=i.substr(f,2)):c=t(e,"char",o,n,f,f===r),c!==!1&&(e[0]+=o),[e,n,typeof c=="number"?c:s]},[[""],{openEnclosures:[]},0])}var ne=new Map,nt=()=>(0|Math.random()*9e6).toString(36),it=(i,t)=>i instanceof Promise?i.then(t):t(i);function Ae(i){let t;return(t=ne.get(i))||(t=nt(),ne.set(i,t)),t}function ot(i){let t;return ne.forEach((r,e)=>{r===i&&(t=e)}),t}ie.call(window);})();
25
+ `)]}function Bt(n){let t=i=>{let o=/^[`'"]/.exec(i);return o&&i.substring(1,i.lastIndexOf(o[0]))},r={items:[{id:""}]},e=n.replace("import","").trim();return(r.url=t(e))||ct(e,(i,o,s,f,u,c)=>{if(["start-quote","ongoing-quote","end-quote","char"].includes(o)){if(r.url)return;if(!f.openQuote){let l=e.substring(u);if(s===","){r.items.unshift({id:""});return}if(l.startsWith(" as "))return r.items[0].alias="",3;if(l.startsWith(" from "))return r.url=t(l.replace("from","").trim()),l.length}"alias"in r.items[0]?r.items[0].alias+=s:(r.items[0].id+=s,f.openEnclosures.length&&(r.items[0].enclosed=!0))}}),r.items=r.items.map(i=>({id:i.id&&!i.alias&&!i.enclosed?"default":i.id.trim(),alias:i.alias?i.alias.trim():i.id.trim()})).filter(i=>i.id).reverse(),r}function ct(n,t){let r=n.length-1;return[...n].reduce(([e,i,o],s,f)=>{if(o)return e[0]+=s,[e,i,--o];let u;if(i.openQuote||i.openComment)return s===i.openQuote?(i.openQuote=null,u=t(e,"end-quote",s,i,f,f===r)):i.openQuote?u=t(e,"ongoing-quote",s,i,f,f===r):i.openComment&&(i.openComment==="//"&&s===`
26
+ `||i.openComment==="/*"&&e[0].substr(-1)==="*"&&s==="/")&&(i.openComment=null,u=t(e,"end-comment",s,i,f,f===r)),u!==!1&&(e[0]+=s),[e,i,typeof u=="number"?u:o];let c;return(c=["()","{}","[]"].filter(l=>s===l[0])[0])?(u=t(e,"start-enclosure",s,i,f,f===r),i.openEnclosures.unshift(c)):i.openEnclosures.length&&s===i.openEnclosures[0][1]?(i.openEnclosures.shift(),u=t(e,"end-enclosure",s,i,f,f===r)):['"',"'","`"].includes(s)?(u=t(e,"start-quote",s,i,f,f===r),i.openQuote=s):!i.openComment&&["/*","//"].includes(n.substr(f,2))?(u=t(e,"start-comment",s,i,f,f===r),i.openComment=n.substr(f,2)):u=t(e,"char",s,i,f,f===r),u!==!1&&(e[0]+=s),[e,i,typeof u=="number"?u:o]},[[""],{openEnclosures:[]},0])}var He=new Map,Qt=()=>(0|Math.random()*9e6).toString(36),je=(n,t)=>n instanceof Promise?n.then(t):t(n);function ft(n){let t;return(t=He.get(n))||(t=Qt(),He.set(n,t)),t}function Ut(n){let t;return He.forEach((r,e)=>{r===n&&(t=e)}),t}De.call(window);window.wq||(window.wq={});window.wq.Observer=z;})();
27
27
  //# sourceMappingURL=scoped-js.js.map