@webqit/oohtml 4.3.7 → 4.3.8
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/bindings-api.js +1 -1
- package/dist/bindings-api.js.map +2 -2
- package/dist/context-api.js +1 -1
- package/dist/context-api.js.map +2 -2
- package/dist/data-binding.js +1 -1
- package/dist/data-binding.js.map +2 -2
- package/dist/html-imports.js +1 -1
- package/dist/html-imports.js.map +2 -2
- package/dist/main.js +1 -1
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +1 -1
- package/dist/main.lite.js.map +2 -2
- package/dist/namespaced-html.js +1 -1
- package/dist/namespaced-html.js.map +2 -2
- package/dist/scoped-css.js +1 -1
- package/dist/scoped-css.js.map +2 -2
- package/package.json +1 -1
- package/src/context-api/DOMContexts.js +1 -1
- package/src/data-binding/index.js +7 -3
package/dist/main.js
CHANGED
|
@@ -12,7 +12,7 @@ Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=1
|
|
|
12
12
|
`).join(`
|
|
13
13
|
`);i=`return ${e==="async-function"?"async ":""}function**(${n.join(", ")}) {
|
|
14
14
|
${g}
|
|
15
|
-
}`,u.executionMode="RegularProgram"}else if(!["script","async-script"].includes(e))throw new Error(`Unrecognized sourceType specified: "${e}".`);c.sourceType=e,u.inBrowser=f,c.base64=p&&f&&"export default async function(%0) {%1}";let m=t(i,{parserParams:u,compilerParams:c});if(m instanceof Promise&&!["async-function","async-script","module"].includes(e))throw new Error("Parse-compile can only return a Promise for sourceTypes: async-function, async-script, module.");return l.sourceType=e,l.inBrowser=f,l.exportNamespace=a,l.fileName=o,nt(m,g=>{let v=["function","async-function"].includes(e);return nt(((x,w)=>{if(l.compileFunction)return l.compileFunction(w.toString(),[x]);if(c.base64){let C=`data:text/javascript;base64,${w.toString("base64")}`;return(()=>import(C).then(y=>y.default))()}return new(p?async function(){}.constructor:Function)(x,w.toString())})(g.identifier+"",g),x=>{let w=(C,b=s)=>{let y=x;C&&(y=y.bind(C));let _="global",S=new et(void 0,_,globalThis);return(e.endsWith("script")||b)&&(_="env",S=new et(S,_,b)),e==="module"&&(_="module",S=new et(S,_)),typeof C<"u"&&(S=new et(S,"this",{this:C})),new Gt(void 0,_,{...l,originalSource:g.originalSource,executionMode:g.isQuantumProgram&&"QuantumProgram"||"RegularProgram"},S,y)};return v?w().execute():{createRuntime:w,compilation:g}})})}var Kt=class{constructor(...t){let i=this.constructor,r=typeof t[t.length-1]=="object"?t.pop():{},s=t.pop()||"";this.$program=De(i.sourceType,i.parseCompileCallback,s,r)}execute(){return nt(this.$program,({createRuntime:t})=>t().execute())}bind(t,i=void 0){return nt(this.$program,({createRuntime:r})=>r(t,i))}toString(t=!1){return nt(this.$program,({compilation:i})=>t?i+"":i.originalSource)}};function ha(...e){let{source:t,params:i}=Di(e);return De("function",qe,t,i)}function Ps(...e){let{source:t,params:i}=Di(e);return De("async-function",qe,t,i)}var fa=Ps,Ve=class extends Kt{};G(Ve,"sourceType","script"),G(Ve,"parseCompileCallback",qe);var he=class extends Kt{};G(he,"sourceType","async-script"),G(he,"parseCompileCallback",qe);var pa=he,Fe=class extends Kt{};G(Fe,"sourceType","module"),G(Fe,"parseCompileCallback",qe);function qe(e,t){let i=ks(e,t.parserParams);return As(i,t.compilerParams)}function je(e,t,i={},r={}){t=W(t).slice();for(var s=e;!Et(s)&&!xe(s)&&t.length;){var n=t.shift();if(!(i.get?i.get(s,n):q(s)?n in s:s[n])){r.exists=!1;return}s=i.get?i.get(s,n):s[n]}return r.exists=!0,s}function er(e,t,i,r={},s={}){let n=(l,f,p)=>s.set?s.set(l,f,p):(at(t[o])&&L(l)?l.push(p):l[f]=p,!0);t=W(t);for(var a=e,o=0;o<t.length;o++)if(o<t.length-1){if(!a||!q(a)&&!F(a))return!1;var u=je(a,t[o],s);if(!q(u)){if(s.buildTree===!1)return!1;u=F(s.buildTree)?s.buildTree(o):at(t[o+1])?[]:{};var c=n(a,t[o],u);if(!c)return!1}a=u}else return n(a,t[o],i)}var Be=class{constructor(t,i=!1){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),Object.defineProperty(this,"_synthesis",{value:0,writable:!0}),!i&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(t){this._synthesis++,this._fulfill();let i=await t();return this._synthesis--,i}_fulfill(){for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t)}_loop(){this.window.requestAnimationFrame(()=>{this._fulfill(),this._loop()})}onread(t,i=!1){if(i)return new Promise(r=>{this.synthesis?r(t()):this.readCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.readCallbacks.add(t)}onwrite(t,i=!1){if(i)return new Promise(r=>{this.synthesis?r(t()):this.writeCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.writeCallbacks.add(t)}cycle(t,i,r){this.onread(()=>{let s=t(r),n=a=>{a!==void 0&&this.onwrite(()=>{let o=i(a,r),u=c=>{c!==void 0&&this.cycle(t,i,c)};o instanceof Promise?o.then(u):u(o)})};s instanceof Promise?s.then(n):n(s)})}};function Is(e){return(e=e.trim())&&e.startsWith("(")&&e.endsWith(")")}function fe(e,t,i,r=!0){i=(Array.isArray(i)?i:[i]).map(a=>(a+"").replace("(",r?"(.//":"(./")).join("|");let s=[],n;try{let a=e.document.evaluate(i,t,null,e.XPathResult.ANY_TYPE);for(;n=a.iterateNext();)s.push(n)}catch{}return s}function Os(e,t,i){i=(Array.isArray(i)?i:[i]).map(r=>(r+"").replace("(","(self::")).join("|");try{return e.document.evaluate(`${i}`,t,null,e.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function He(e,t,i,r=!1,s=null){let n=s?.get(t)?.get(i);if(typeof n<"u")return n;let a=c=>(s?.has(t)||s?.set(t,new WeakMap),s?.get(t)?.set(i,c),c),o=t.getRootNode(),u=i.getRootNode();return o===u?a(t.contains(i)):r&&u instanceof e.ShadowRoot?a(He(e,t,u.host,r,s)):a(!1)}function Ts(e,t="|"){return[...e].reduce(([i,r,s,n],a)=>!i&&r===0&&(Array.isArray(t)?t:[t]).includes(a)?[i,r,[""].concat(s)]:(!i&&["(","[","{"].includes(a)&&!s[0].endsWith("\\")&&r++,!i&&[")","]","}"].includes(a)&&!s[0].endsWith("\\")&&r--,['"',"'","`"].includes(a)&&!s[0].endsWith("\\")&&(i=i===a?null:i||a),s[0]+=a,[i,r,s]),[null,0,[""]])[2].reverse()}var ht=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Is(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ts(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var Xt=class{constructor(t,i,r){this.context=t,this.namespace=i,this.window=t.defaultView||t.ownerDocument?.defaultView||r,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if(F(t[0])?t=[[],...t]:V(t[0])&&!(t[0]instanceof ht)&&t.length===1?t=[[],void 0,t[0]]:V(t[1])&&t.length===2?t=[W(t[0],!1),void 0,t[1]]:t[0]=W(t[0],!1),t[0].filter(i=>typeof i!="string"&&!(i instanceof ht)&&!(i instanceof this.window.Node)).length)throw new Error("Argument #2 must be either a string or a Node object, or a list of those.");return t[0]=t[0].map(i=>i instanceof ht?i:new ht(i)),t}registry(...t){return K("realdom.realtime",this.window,this.namespace,...t)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(t,i,r){let{window:s}=this,n=new Set,a=new WeakMap;for(let[o,u]of this.registry(t)){let c=[].concat(i).filter(f=>He(s,o.context,f.target,o.params.subtree==="cross-roots",a));if(!c.length)continue;let l=[o,Array.isArray(i)?c:c[0]];u?n.add(l):r.call(s,...l)}for(let o of n)r.call(s,...o);n.clear()}disconnectables(t,...i){let r={disconnect(){i.forEach(s=>s&&F(s.disconnect)&&s.disconnect()||F(s)&&s()||V(s)&&(s.disconnected=!0))}};return t&&t.addEventListener("abort",()=>r.disconnect()),r}};var Dt=class extends Xt{type="attr";constructor(t,...i){super(t,"attr",...i)}get(t,i=void 0,r={}){let s=typeof t=="string"||t instanceof ht;[t=[],i=void 0,r={}]=this.resolveArgs(arguments);let{context:n}=this,a=Rs(n,t);if(!i)return a;let o=r.lifecycleSignals&&this.createSignalGenerator();if(s)for(let u of a){let c=o?.generate()||{};i(u,c,n)}else{let u=o?.generate()||{};i(a,u,n)}if(r.live){o&&(r={...r,signalGenerator:o});let u=this.observe(s?t[0]:t,i,{newValue:!0,...r});return this.disconnectables(r.signal,u)}}observe(t,i,r={}){let s=typeof t=="string"||t instanceof ht;if([t=[],i,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(s?t[0]:t,i,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:n,window:a,webqit:o}=this;r.eventDetails&&!o.realdom.attrInterceptionHooks?.intercepting&&$s.call(a,"intercept",()=>{});let u=new a.MutationObserver(p=>{p=Ls(p).map(m=>Ms.call(a,m)),Ns.call(a,f,p,n)}),c={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(c.attributeFilter=t.map(p=>p+"")),u.observe(n,c);let l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),f={context:n,spec:t,callback:i,params:r,atomics:new Map,originalFilterIsString:s,signalGenerator:l,disconnectable:u};return this.disconnectables(r.signal,u,l)}observeSync(t,i,r={}){let s=typeof t=="string"||t instanceof ht;[t,i,r={}]=this.resolveArgs(arguments);let{context:n,window:a}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let o=r.timing==="intercept"?"intercept":"sync";this.registry(o).size||$s.call(a,o,p=>{this.forEachMatchingContext(o,p,Ns)});let u={disconnect(){f.delete(l)}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:n,spec:t,callback:i,params:r,atomics:new Map,originalFilterIsString:s,signalGenerator:c,disconnectable:u},f=this.registry(o);return f.set(l,!!l.params.deferred),this.disconnectables(r.signal,u,c)}};function Ls(e){return e.reduce((t,i,r)=>t[r-1]?.attributeName===i.attributeName||K(i.target,"internalAttrInteractions").get(i.attributeName)?t:t.concat(i),[])}function Ns(e,t){let{context:i,spec:r,callback:s,params:n,atomics:a,originalFilterIsString:o,signalGenerator:u}=e,c=r.map(p=>p+"");if(n.atomic&&!a.size?t=Rs(i,r,t):n.timing!=="async"&&r.length&&(t=t.filter(p=>c.includes(p.name))),!t.length)return;n.newValue===null&&n.oldValue===null&&n.eventDetails||(t=t.map(p=>{let m;return n.eventDetails||({event:m,...p}=p),!n.oldValue&&"oldValue"in p&&({oldValue:m,...p}=p),!n.newValue&&"value"in p?{value:m,...p}=p:n.newValue&&typeof p.value>"u"&&(p={...p,value:hi(p.target,p.name,()=>p.target.getAttribute(p.name))}),p})),n.atomic&&(t.forEach(p=>a.set(p.name,p)),t=Array.from(a.entries()).map(([,p])=>p));let l=o?t[0]:t,f=u?.generate()||{};s(l,f,i)}function hi(e,t,i){let r=K(e,"internalAttrInteractions").get(t);K(e,"internalAttrInteractions").set(t,!0);let s=i();return K(e,"internalAttrInteractions").set(t,r),s}function Rs(e,t,i=[]){let r={event:null,type:"attribute"};return t.length?t.map(n=>(n=n+"",i.find(a=>a.name===n)||{target:e,name:n,value:hi(e,n,()=>e.getAttribute(n)),...r})):Array.from(e.attributes).map(n=>i.find(a=>a.name===n.nodeName)||{target:e,name:n.nodeName,value:hi(e,n.nodeName,()=>n.nodeValue),...r})}function Ms({target:e,attributeName:t,value:i,oldValue:r}){let a=(this.webqit.realdom.attrInterceptionRecords?.get(e)||{})[t]?.[0]||"mutation";return{target:e,name:t,value:i,oldValue:r,type:"observation",event:a}}function $s(e,t){let i=this,{webqit:r,document:s,Element:n}=i;r.realdom.attrInterceptionHooks||Object.defineProperty(r.realdom,"attrInterceptionHooks",{value:new Map}),r.realdom.attrInterceptionHooks.has(e)||r.realdom.attrInterceptionHooks.set(e,new Set),r.realdom.attrInterceptionHooks.get(e).add(t);let a=()=>r.realdom.attrInterceptionHooks.get(e).delete(t);if(r.realdom.attrInterceptionHooks?.intercepting)return a;console.warn("Attr mutation APIs are now being intercepted."),r.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"attrInterceptionRecords",{value:new Map});let o=(l,f)=>{r.realdom.attrInterceptionRecords.has(l.target)||r.realdom.attrInterceptionRecords.set(l.target,{});let p=r.realdom.attrInterceptionRecords.get(l.target);if(p[l.name]=p[l.name]||[],p[l.name].unshift(l.event),K(l.target,"internalAttrInteractions").get(l.name))return f();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(g=>g([l]));let m=f();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(g=>g([l])),m};new i.MutationObserver(l=>{l=l.filter(f=>!(i.webqit.realdom.attrInterceptionRecords?.get(f.target)||{})[f.attributeName]?.shift()),l=Ls(l).map(f=>Ms.call(i,f)),l.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(f=>f(l)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(f=>f(l)))}).observe(s,{attributes:!0,subtree:!0,attributeOldValue:!0});let c=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(l=>{c[l]=n.prototype[l],n.prototype[l]=function(...f){let p,m=hi(this,f[0],()=>this.getAttribute(f[0]));["setAttribute","toggleAttribute"].includes(l)&&(p=f[1]),l==="toggleAttribute"&&p===void 0&&(p=m===null);let g={target:this,name:f[0],value:p,oldValue:m,type:"interception",event:[this,l]};return o(g,()=>c[l].call(this,...f))}}),a}var Ue=class extends Xt{constructor(t,...i){super(t,"tree",...i)}attr(t,i=void 0,r={}){let{context:s,window:n}=this;return new Dt(s,n).get(...arguments)}query(t,i=void 0,r={}){[t,i=void 0,r={}]=this.resolveArgs(arguments);let{context:s}=this,n=new Map,a=c=>(n.has(c)||n.set(c,{target:c,entrants:[],exits:[],type:"query",event:null}),n.get(c));if(!r.generation||r.generation==="entrants"){if(!t.length)[...s.children].forEach(c=>a(s).entrants.push(c));else if(t.every(c=>c.type==="selector")){let[c,l]=t.reduce(([p,m],g)=>g.kind==="xpath"?[p,m.concat(g)]:[p.concat(g),m],[[],[]]),f=[];r.subtree?(c.length&&f.push(...s.querySelectorAll(c.join(","))),l.length&&f.push(...fe(this.window,s,l))):(c.length&&f.push(...[...s.children].filter(p=>p.matches(c))),l.length&&f.push(...fe(this.window,s,l,!1))),f.forEach(p=>a(p.parentNode||s).entrants.push(p))}}if(!i)return n;let o={disconnected:!1},u=i&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,c]of n){if(o.disconnected)break;let l=u?.generate()||{};i(c,l,s)}if(r.live){u&&(r={...r,signalGenerator:u});let c=this.observe(t,i,r);return this.disconnectables(r.signal,o,c)}return this.disconnectables(r.signal,o,u)}children(t,i=void 0,r={}){return[t,i=void 0,r={}]=this.resolveArgs(arguments),this.query(t,i,{...r,subtree:!1})}subtree(t,i=void 0,r={}){return[t,i=void 0,r={}]=this.resolveArgs(arguments),this.query(t,i,{...r,subtree:!0})}observe(t,i,r={}){if([t,i,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(t,i,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:s,window:n,webqit:a,document:o}=this;r.eventDetails&&(a.realdom.domInterceptionRecordsAlwaysOn=!0),(o.readyState==="loading"||a.realdom.domInterceptionRecordsAlwaysOn)&&!a.realdom.domInterceptionHooks?.intercepting&&Fs.call(n,"sync",()=>{});let u=new n.MutationObserver(f=>f.forEach(p=>{rr.call(n,l,Vs.call(n,p),s)}));u.observe(s,{childList:!0,subtree:r.subtree&&!0});let c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:s,spec:t,callback:i,params:r,signalGenerator:c,disconnectable:u};if(r.staticSensitivity){let f=Ds.call(n,l);return this.disconnectables(r.signal,u,c,f)}return this.disconnectables(r.signal,u,c)}observeSync(t,i,r={}){[t,i,r={}]=this.resolveArgs(arguments);let{context:s,window:n}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let a=r.timing==="intercept"?"intercept":"sync";this.registry(a).size||Fs.call(n,a,p=>{this.forEachMatchingContext(a,p,rr)});let o=new n.MutationObserver(p=>p.forEach(m=>{Array.isArray((m=Vs.call(n,m)).event)||rr.call(n,l,m,s)}));o.observe(s,{childList:!0,subtree:r.subtree&&!0});let u={disconnect(){f.delete(l),o.disconnect()}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:s,spec:t,callback:i,params:r,signalGenerator:c,disconnectable:u},f=this.registry(a);if(f.set(l,!!l.params.deferred),r.staticSensitivity){let p=Ds.call(n,l);return this.disconnectables(r.signal,u,c,p)}return this.disconnectables(r.signal,u,c)}track(t,i,r={}){return r={subtree:!0,...r},this.observe(t,s=>{s.entrants.length&&i(!0,Array.isArray(t)?s.entrants:s.entrants[0]),s.exits.length&&i(!1,Array.isArray(t)?s.exits:s.exits[0])},r)}};function Ds(e){let t=this,{context:i,spec:r,callback:s,params:n,signalGenerator:a}=e,o=r.filter(m=>m.kind==="css"),u=m=>m.match(/\.([\w-]+)/g)?.length?["class"]:[],c=m=>m.match(/#([\w-]+)/g)?.length?["id"]:[],l=m=>[...m.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(g=>g[1]).concat(u(m)).concat(c(m));if(!(e.$attrs=Array.from(new Set(o.filter(m=>(m+"").includes("[")).reduce((m,g)=>m.concat(l(g+"")),[])))).length)return;let f=new Set,p=new Set;return f.push=m=>(p.delete(m),f.add(m)),p.push=m=>(f.delete(m),p.add(m)),e.$deliveryCache={entrants:f,exits:p},new Dt(i,t).observe(e.$attrs,m=>{let g=new Map,v=w=>(g.has(w)||g.set(w,{target:w,entrants:[],exits:[],type:"static",event:null}),g.get(w)),E=new WeakMap,x=w=>(E.has(w)||E.set(w,o.some(C=>w.matches(C+""))),E.get(w));for(let w of m)["entrants","exits"].forEach(C=>{n.generation&&C!==n.generation||e.$deliveryCache[C].has(w.target)||(C==="entrants"?!x(w.target):x(w.target))||(e.$deliveryCache[C].push(w.target),v(w.target)[C].push(w.target),v(w.target).event=w.event)});for(let[,w]of g){let C=a?.generate()||{};s(w,C,i)}},{subtree:n.subtree,timing:n.timing,eventDetails:n.eventDetails})}function rr(e,t){let{context:i,spec:r,callback:s,params:n,signalGenerator:a,$deliveryCache:o}=e,u={...t,entrants:[],exits:[]};if(n.eventDetails||delete u.event,["entrants","exits"].forEach(l=>{if(!(n.generation&&l!==n.generation)&&(r.length?u[l]=xa.call(this,r,n.subtree==="cross-roots",t[l],t.event!=="parse"):u[l]=[...t[l]],!!o))for(let f of u[l])o[l].push(f)}),!u.entrants.length&&!u.exits.length)return;let c=a?.generate()||{};s(u,c,i)}function xa(e,t,i,r){i=Array.isArray(i)?i:[...i];let s=(n,a)=>{if(a.type==="selector"){let o=a.isXpathAttr?[]:n.filter(u=>a.kind==="xpath"?Os(this,u,a+""):u.matches&&u.matches(a+""));if((r||a.isXpathAttr)&&(o=n.reduce((u,c)=>a.kind==="xpath"?[...u,...fe(this,c,a,r)]:c.querySelectorAll?[...u,...c.querySelectorAll(a+"")]:u,o)),o.length)return o}else if(n.includes(a.content)||r&&n.some(o=>He(this,o,a.content,t)))return[a.content]};return i.$$searchCache||(i.$$searchCache=new Map),e.reduce((n,a)=>{let o;return i.$$searchCache.has(a.content)?o=i.$$searchCache.get(a.content):(o=s(i,a)||[],a.type==="instance"&&i.$$searchCache.set(a.content,o)),n.concat(o)},[])}function Vs({target:e,addedNodes:t,removedNodes:i}){let r=this,s;return s=W(t).reduce((n,a)=>n||r.webqit.realdom.domInterceptionRecords?.get(a),null),s=W(i).reduce((n,a)=>n||r.webqit.realdom.domInterceptionRecords?.get(a),s),s=s||r.document.readyState==="loading"&&"parse"||"mutation",{target:e,entrants:t,exits:i,type:"observation",event:s}}function Fs(e,t){let i=this,{webqit:r,document:s,Node:n,CharacterData:a,Element:o,HTMLElement:u,HTMLTemplateElement:c,DocumentFragment:l}=i;r.realdom.domInterceptionHooks||Object.defineProperty(r.realdom,"domInterceptionHooks",{value:new Map}),r.realdom.domInterceptionNoRecurse||Object.defineProperty(r.realdom,"domInterceptionNoRecurse",{value:new Map}),r.realdom.domInterceptionHooks.has(e)||r.realdom.domInterceptionHooks.set(e,new Set),r.realdom.domInterceptionHooks.get(e).add(t);let f=()=>r.realdom.domInterceptionHooks.get(e).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return f;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let p=(x,w,C)=>{r.realdom.domInterceptionNoRecurse.set(x,w);let b=C();return r.realdom.domInterceptionNoRecurse.delete(x),b},m=(x,w)=>{x.entrants.concat(x.exits).forEach(b=>{clearTimeout(r.realdom.domInterceptionRecords.get(b)?.timeout),r.realdom.domInterceptionRecords.set(b,x.event);let y=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(b)},0);Object.defineProperty(x.event,"timeout",{value:y,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(b=>b(x));let C=w();return r.realdom.domInterceptionHooks.get("sync")?.forEach(b=>b(x)),C},g={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},v={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(g).reduce((x,w)=>x.concat(w),[])).forEach(x=>{Object.keys(g).forEach(b=>{if(!g[b].includes(x))return;let y=Object.getOwnPropertyDescriptor(i[b].prototype,x);!y||(Object.defineProperty(i[b].prototype,x,"value"in y?{...y,value:w}:{...y,set:C}),v[b][x]=y)});function w(...b){let y=Object.keys(v).find(X=>this instanceof i[X]&&x in v[X]),_=v[y],S=()=>_[x].value.call(this,...b);if(r.realdom.domInterceptionNoRecurse.get(this)===x)return S();let O=[],P=[],D=this;["insertBefore"].includes(x)?P=[b[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(x)?(P=[b[1]],["beforebegin","afterend"].includes(b[0])&&(D=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(x)?(O=[...this.childNodes],P=x==="replaceChildren"?[...b]:[b[0]]):["replaceWith","remove"].includes(x)?(O=[this],P=x==="replaceWith"?[...b]:[],D=this.parentNode):["replaceChild"].includes(x)?(O=[b[1]],P=[b[0]]):["removeChild"].includes(x)?O=[...b]:(P=[...b],["before","after"].includes(x)&&(D=this.parentNode));let H=x;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(x)){let X=this.nodeName;if(x==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(b[0])){if(!this.parentNode)return _[x].value.call(this,...b);X=this.parentNode.nodeName}let Y=s.createElement(X.includes("-")?"div":X);_.setHTMLUnsafe.value.call(Y,P[0],x==="setHTMLUnsafe"?b[1]:{}),P=[...Y.childNodes],x==="insertAdjacentHTML"?(H="insertAdjacentElement",b[1]=new l,p(b[1],"append",()=>b[1].append(...Y.childNodes))):(H="replaceChildren",b=[...Y.childNodes])}return m({target:D,entrants:P,exits:O,type:"interception",event:[this,x]},()=>_[H].value.call(this,...b))}function C(b){let y=Object.keys(v).find(Q=>this instanceof i[Q]&&x in v[Q]),_=v[y],S=()=>_[x].set.call(this,b);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===x)return S();let O=[],P=[],D=this;if(["outerHTML","outerText"].includes(x)?(O=[this],D=this.parentNode):this instanceof c?(D=this.content,O=[...this.content.childNodes]):O=[...this.childNodes],["outerHTML","innerHTML"].includes(x)){let Q=this.nodeName;if(x==="outerHTML"){if(!this.parentNode)return S();Q=this.parentNode.nodeName}let X=s.createElement(Q.includes("-")?"div":Q);if(p(X,x,()=>X[x]=b),P=this instanceof c?[...X.content.childNodes]:[...X.childNodes],this instanceof c&&this.hasAttribute("src")||this instanceof ShadowRoot){let Y=Ft=>Ft.reduce((St,_t)=>_t instanceof HTMLScriptElement?St.concat(_t):_t instanceof c?St.concat(Y([_t.content])):(St=St.concat(Y([..._t.querySelectorAll?.("template")||[]].map(rn=>rn.content))),St.concat(..._t.querySelectorAll?.("script")||[])),[]);for(let Ft of Y(P)){if(this instanceof ShadowRoot){Ft.setAttribute("data-handling","manual");continue}let St=s.createElement("script");[...Ft.attributes].forEach(_t=>St.setAttribute(_t.name,_t.value)),St.textContent=Ft.textContent,p(Ft,"replaceWith",()=>Ft.replaceWith(St))}}x==="outerHTML"?(b=new l,p(b,"append",()=>b.append(...P)),S=()=>p(this,"replaceWith",()=>o.prototype.replaceWith.call(this,b))):this instanceof c?S=()=>p(this.content,"replaceChildren",()=>this.content.replaceChildren(...P)):S=()=>p(this,"replaceChildren",()=>o.prototype.replaceChildren.call(this,...P))}return m({target:D,entrants:P,exits:O,type:"interception",event:[this,x]},S)}}),f}function qs(){ya.call(this),ba.call(this),wa.call(this)}function ya(){let e=this;e.CSS||(e.CSS={}),e.CSS.escape||(e.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function ba(){let e=this;"isConnected"in e.Node.prototype||Object.defineProperty(e.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function wa(){let e=this;e.Element.prototype.matches||(e.Element.prototype.matches=e.Element.prototype.matchesSelector||e.Element.prototype.mozMatchesSelector||e.Element.prototype.msMatchesSelector||e.Element.prototype.oMatchesSelector||e.Element.prototype.webkitMatchesSelector||function(t){for(var i=(this.document||this.ownerDocument).querySelectorAll(t),r=i.length;--r>=0&&i.item(r)!==this;);return r>-1})}function js(){let e=this;if(e.webqit||(e.webqit={}),e.webqit.realdom)return e.webqit.realdom;e.webqit.realdom={},qs.call(e),e.webqit.realdom.meta=(...i)=>va.call(e,...i),e.webqit.realdom.ready=(...i)=>sr.call(e,...i),e.webqit.realdom.realtime=(i,r="dom")=>{if(r==="dom")return new Ue(i,e);if(r==="attr")return new Dt(i,e)};let t=new Be(e);return e.webqit.realdom.schedule=(i,...r)=>t[`on${i}`](...r),e.webqit.realdom.synthesizeWhile=(...i)=>t.synthesizeWhile(...i),e.webqit.realdom}function sr(...e){let t="interactive",i;ie(e[0])?(t=e[0],F(e[1])&&(i=e[1])):F(e[0])&&(i=e[0]);let r={interactive:["interactive","complete"],complete:["complete"]};if(!r[t])throw new Error(`Invalid ready-state timing: ${t}.`);let s=this;if(!i)return s.webqit.realdom.readyStatePromises||(s.webqit.realdom.readyStatePromises={interactive:new Promise(n=>sr.call(this,"interactive",n)),complete:new Promise(n=>sr.call(this,"complete",n))}),s.webqit.realdom.readyStatePromises[t];if(r[t].includes(s.document.readyState))return i(s);s.webqit.realdom.readyStateCallbacks||(s.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},s.document.addEventListener("readystatechange",()=>{let n=s.document.readyState;for(let a of s.webqit.realdom.readyStateCallbacks[n].splice(0))a(s)},!1)),s.webqit.realdom.readyStateCallbacks[t].push(i)}function va(e){let t=this,i={},r;return(r=t.document.querySelector(`meta[name="${e}"]`))&&(i=(r.content||"").split(";").filter(s=>s).reduce((s,n)=>{let a=n.split("=").map(o=>o.trim());return er(s,a[0].split("."),a[1]==="true"?!0:a[1]==="false"?!1:at(a[1])?parseInt(a[1]):a[1]),s},{})),{get name(){return e},get content(){return r.content},json(){return JSON.parse(JSON.stringify(i))}}}function fi(e,t){return typeof e!="string"?e:e.replace(/\w\S*/g,function(i){return i.charAt(0).toUpperCase()+(typeof t!==void 0&&t?i.substr(1).toLowerCase():i.substr(1))})}var A=(...e)=>K("oohtml",...e),U={};function rt(e,t,i){let r=this,s=js.call(r);U.window=r,r.webqitConfig||(r.webqitConfig=s.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let n=e.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[n]){r.webqit.oohtml.configs[n]={};let a=r.webqit.oohtml.configs[n];be(2,a,i,t,s.meta(e).json()),r.webqitConfig.prefix&&Object.keys(a).forEach(o=>{Object.keys(a[o]).forEach(u=>{o==="api"&&typeof a[o][u]=="string"?a[o][u]=`${r.webqitConfig.prefix}${fi(a[o][u])}`:["attr","elements"].includes(o)&&a[o][u]?.startsWith("data-")===!1&&(a[o][u]=`${r.webqitConfig.prefix}-${a[o][u]}`)})})}return{config:r.webqit.oohtml.configs[n],realdom:s,window:r}}function ar(e,t){return K(e,"internalAttrInteractions").get(t)}function Hs(e,t,i){let r=K(e,"internalAttrInteractions").get(t);K(e,"internalAttrInteractions").set(t,!0);let s=i();return K(e,"internalAttrInteractions").set(t,r),s}function Tt(e,t){return[...e].reduce(([i,r,s],n)=>!i&&r===0&&(Array.isArray(t)?t:[t]).includes(n)?[i,r,[""].concat(s)]:(!i&&["(","[","{"].includes(n)&&!s[0].endsWith("\\")&&r++,!i&&[")","]","}"].includes(n)&&!s[0].endsWith("\\")&&r--,['"',"'","`"].includes(n)&&!s[0].endsWith("\\")&&(i=i===n?null:i||n),s[0]+=n,[i,r,s]),[null,0,[""]])[2].reverse()}var Ea=()=>(0|Math.random()*9e6).toString(36),nr=new Map;function Yt(e){let t;return(t=nr.get(e))||(t=Ea(),nr.set(e,t)),t}function pi(e){let t;return nr.forEach((i,r)=>{i===e&&(t=r)}),t}function di(){let{window:e}=U,{webqit:t}=e;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class i extends e.Event{constructor(...s){let n=s.pop();if(typeof n!="function")throw new Error("Callback must be provided.");let a=s.pop();if(!a?.kind)throw new Error('"options.kind" must be specified.');let o=["contextrequest","contextclaim"],u=s.pop()||o[0];if(!o.includes(u))throw new Error(`Invalid event type. Must be one of: ${o.join(",")}`);let{kind:c,detail:l,targetContext:f,live:p,signal:m,diff:g,...v}=a;super(u,{...v,bubbles:v.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>n}),Object.defineProperty(this,"kind",{get:()=>c}),Object.defineProperty(this,"targetContext",{get:()=>f}),Object.defineProperty(this,"detail",{get:()=>l}),Object.defineProperty(this,"live",{get:()=>p}),Object.defineProperty(this,"signal",{get:()=>m}),Object.defineProperty(this,"diff",{get:()=>g}),Object.defineProperty(this,"options",{get:()=>v}),Object.defineProperty(this,"meta",{value:{}})}get target(){return super.target||this.meta.target}get answered(){return this.meta.answered||!1}respondWith(s){if(this.meta.answered=!0,this.diff){if("_prevValue"in this&&this._prevValue===s)return;Object.defineProperty(this,"_prevValue",{value:s,configurable:!0})}return this.callback(s)}}return t.DOMContextRequestEvent=i,i}var Jt=class extends AbortController{constructor(t){super(),t(i=>{let{window:{webqit:{Observer:r}}}=U;r.defineProperty(this,"value",{value:i,configurable:!0,enumerable:!0})},this)}};var Zt=class extends Error{};var Vt=class{static instance(t){return A(t).get("contexts::instance")||new this(t)}constructor(t){A(t).get("contexts::instance")?.dispose(),A(t).set("contexts::instance",this);let i={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>i})}get[Symbol.iterator](){return this["#"].contexts[Symbol.iterator]}get length(){return this["#"].contexts.size}find(...t){return[...this["#"].contexts].find(i=>typeof t[0]=="function"?t[0](i):i.constructor.kind===t[0]&&(!t[1]||i.detail===t[1]))}attach(t){if(!(t instanceof st))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new Zt(`Context of same kind "${t.constructor.kind}"${t.detail?` and detail "${t.detail}"`:""} already exists.`);this["#"].contexts.add(t),t.initialize(this["#"].host)}detach(t){t.dispose(this["#"].host),this["#"].contexts.delete(t)}request(...t){return new Jt((i,r)=>{typeof t[t.length-1]!="function"&&(t[t.length-1]?t.push(i):t[t.length-1]=i);let s;(s=t.find(a=>typeof a=="object"&&a))&&s.live&&(s.signal&&s.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(s)]={...s,signal:r.signal});let n=new(di())(...t);this["#"].host.dispatchEvent(n)})}};var or=class{static createRequest(){return{kind:this.kind}}constructor(t=null){Object.defineProperty(this,"detail",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get configs(){let{window:{webqit:{oohtml:{configs:t}}}}=U;return t}get name(){return[U.window.Document,U.window.ShadowRoot].some(t=>this.host instanceof t)?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(!(t.detail instanceof or)||t.target===this.host)return;let i=new Set;if(this.subscriptions.forEach(r=>{!t.target.contains(r.target)||!t.detail.matchEvent(r)||(this.subscriptions.delete(r),this.unsubscribed(r),i.add(r))}),i.size)return t.respondWith(i)}if(t.type==="contextrequest")return this.matchEvent(t)?(t.live&&(this.subscriptions.add(t),this.subscribed(t),t.signal?.addEventListener("abort",()=>{this.subscriptions.delete(t),this.unsubscribed(t)})),t.stopPropagation(),this.handle(t)):void 0}}initialize(t){this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this);let{value:i}=Vt.instance(t).request("contextclaim",{kind:this.constructor.kind,detail:this});return i?.forEach(r=>{this.subscriptions.add(r),this.subscribed(r),this.handle(r)}),this}dispose(t){return this.disposed=!0,t.removeEventListener("contextrequest",this),t.removeEventListener("contextclaim",this),this.subscriptions.forEach(i=>{this.subscriptions.delete(i),this.unsubscribed(i);let{target:r}=i;i.meta.answered=!1,r.dispatchEvent(i)}),this}},st=or;G(st,"kind");var pe=class extends st{static createRequest(t=null){let i=super.createRequest();if(t?.startsWith("@")){let[r,...s]=s.slice(1).split("/").map(n=>n.trim());i.targetContext=r,i.detail=s.join("/")}else i.detail=t;return i}get namespaceObj(){return this.host[this.configs.NAMESPACED_HTML.api.namespace]}handle(t){let{window:{webqit:{Observer:i}}}=U;if(t.meta.controller?.abort(),!(t.detail||"").trim())return t.respondWith(i.unproxy(this.namespaceObj));let r=(t.detail||"").split("/").map(s=>s.trim()).filter(s=>s);if(!r.length)return t.respondWith();r=r.join(`/${this.configs.NAMESPACED_HTML.api.namespace}/`)?.split("/")||[],t.meta.controller=i.reduce(this.namespaceObj,r,i.get,s=>{this.disposed||t.respondWith(s.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};G(pe,"kind","namespace");function ur(e={}){let{config:t,window:i}=rt.call(this,"namespaced-html",e,{attr:{namespace:"namespace",lid:"id"},api:{namespace:"namespace"},tokens:{lidrefPrefix:"~",lidrefSeparator:":"},target:{className:":target",eventName:":target",scrolling:!0}});t.lidSelector=`[${i.CSS.escape(t.attr.lid)}]`,t.namespaceSelector=`[${i.CSS.escape(t.attr.namespace)}]`,i.webqit.DOMNamingContext=pe,Ca.call(i,t),ka.call(i,t)}function Us(e){let{lidrefPrefix:t,lidrefSeparator:i}=e.tokens;return{escape(r,s=1){return[...r].map(n=>/\w/.test(n)?n:s===2?`\\\\${n}`:`\\${n}`).join("")},lidrefPrefix(r=0){return r?this.escape(t,r):t},lidrefSeparator(r=0){return r?this.escape(i,r):i},isUuid(r,s=0){return r.startsWith(this.lidrefPrefix(s))&&r.includes(this.lidrefSeparator(s))},toUuid(r,s,n=0){return r.endsWith("-root")?s:`${this.lidrefPrefix(n)}${r}${this.lidrefSeparator(n)}${s}`},uuidToId(r,s=0){return this.isUuid(r)?r.split(this.lidrefSeparator(s))[1]:r},uuidToLidref(r,s=0){return this.isUuid(r)?`${this.lidrefPrefix(s)}${r.split(this.lidrefSeparator(s))[1]}`:r}}}function cr(e,t,i=null,r=0){let s=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:n}}}}=s,a=Us(n),o=new RegExp(`${i?":scope|":""}#(${a.lidrefPrefix(r+1)})?([\\w]+${a.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[u,c]=Tt(e,",").reduce(([f,p],m)=>{let g,v;return m=m.replace(o,(E,x,w,C,b)=>{if(g||(g=[...m.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),g.some(O=>b>O.index&&b+E.length<O.index+O[0].length))return E;if(E===":scope")return v=!0,i;let y=x&&!w;if(x&&w)return`#${a.escape(E.replace("#",""),1)}`;if(y&&n.attr.lid==="id"&&t&&!t.endsWith("-root"))return`#${a.toUuid(t,C,1)}`;let S;return n.attr.lid==="id"?S=`:is(#${C},[id^="${a.lidrefPrefix(r)}"][id$="${a.lidrefSeparator(r)}${C}"])`:S=`:is(#${C},[${s.CSS.escape(n.attr.lid)}="${C}"])`,y?`:is(${S}):not(${i?i+" ":""}${n.namespaceSelector} *)`:S}),v?[f,p.concat(m)]:[f.concat(m),p]},[[],[]]),l;return i&&u.length?l=[u.length>1?`${i} :is(${u.join(", ")})`:`${i} ${u[0]}`,c.join(", ")].filter(f=>f).join(", "):l=[...u,...c].join(", "),l}function mi(e){let t=this;if(!A(e).has("namespace")){let i=Object.create(null);A(e).set("namespace",i);let r=[t.Document,t.ShadowRoot].some(s=>e instanceof s);Object.defineProperty(i,Symbol.toStringTag,{get(){return r?"RootNamespaceRegistry":"NamespaceRegistry"}})}return A(e).get("namespace")}function de(e,t=!1){let i=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=i,s=[i.Document,i.ShadowRoot].some(n=>e instanceof n);return mi.call(i,s?e:(t?e.parentNode:e)?.closest?.(r.namespaceSelector)||e.getRootNode())}function gi(e){let t=Object.prototype.toString.call(e)==="[object RootNamespaceRegistry]";return(pi(e)||Yt(e))+(t?"-root":"")}function Ca(e){let t=this,{webqit:{Observer:i}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let s=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(e.api.namespace in r)throw new Error(`The ${s} prototype already has a "${e.api.namespace}" API!`);Object.defineProperty(r,e.api.namespace,{get:function(){return i.proxy(mi.call(t,this))}})})}function ka(e){let t=this,{webqit:{Observer:i,realdom:r,oohtml:{configs:s},DOMNamingContext:n}}=t,a=["aria-owns","aria-controls","aria-labelledby","aria-describedby","aria-flowto"],o=["for","list","form","aria-activedescendant","aria-details","aria-errormessage"],u=[e.attr.lid,...a,...o],c={id:"id",for:"htmlFor","aria-owns":"ariaOwns","aria-controls":"ariaControls","aria-labelledby":"ariaLabelledBy","aria-describedby":"ariaDescribedBy","aria-flowto":"ariaFlowto","aria-activedescendant":"ariaActiveDescendant","aria-details":"ariaDetails","aria-errormessage":"ariaErrorMessage"},l=Us(e),f=(y,_,S)=>{if(!ar(y,_)&&A(y,"attrOriginals").has(_))return A(y,"attrOriginals").get(_);let O=S();return ar(y,_)?O:O&&O.split(" ").map(P=>(P=P.trim())&&(_===e.attr.lid?l.uuidToId:l.uuidToLidref).call(l,P)).join(" ")},p=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...p,value(y){return this.querySelector(`#${y}`)}});for(let y of["querySelector","querySelectorAll"])for(nodeApi of[t.Document,t.Element]){let _=Object.getOwnPropertyDescriptor(nodeApi.prototype,y);Object.defineProperty(nodeApi.prototype,y,{..._,value(S){return _.value.call(this,cr.call(t,S,gi(mi.call(t,this))))}})}let m=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...m,value(y){let _=()=>m.value.call(this,y);return u.includes(y)&&!A(this,"lock").get(y)?f(this,y,_):_()}});let g=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...g,get(){let y=()=>g.get.call(this);return u.includes(this.name)?f(this.ownerElement,this.name,y):y()}});let v=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...v,get(){let y=()=>v.get.call(this);return this instanceof t.Attr&&u.includes(this.name)?f(this.ownerElement,this.name,y):y()}});for(let y of u){if(!(y in c))continue;let _=y==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let S of _){let O=Object.getOwnPropertyDescriptor(S.prototype,c[y]);!O||Object.defineProperty(S.prototype,c[y],{...O,get(){return f(this,y,()=>O.get.call(this,y))}})}}e.attr.lid!=="id"&&Object.defineProperty(t.Element.prototype,e.attr.lid,{configurable:!0,enumerable:!0,get(){return this.getAttribute(e.attr.lid)},set(y){return this.setAttribute(e.attr.lid,y)}});let E=(y,_,S,O)=>Hs(y,_,()=>(typeof S=="function"&&(S=S()),O(S))),x=(y,_,S,O=null)=>{E(y,_,S,P=>{let D=_===e.attr.lid,H=O||de.call(t,y,D),Q=gi(H);if(D){let X=l.uuidToId(P);if(i.get(H,X)!==y){let Y=l.toUuid(Q,X);Y!==P&&y.setAttribute("id",Y),i.set(H,X,y)}}else{A(y,"attrOriginals").set(_,P);let X=P.split(" ").map(Y=>(Y=Y.trim())&&l.isUuid(Y)?Y:l.toUuid(Q,Y)).join(" ");y.setAttribute(_,X),A(H).set("idrefs",A(H).get("idrefs")||new Set),A(H).get("idrefs").add(y)}})},w=(y,_,S,O=null)=>{E(y,_,S,P=>{let D=_===e.attr.lid,H=O||de.call(t,y,D);if(D){let Q=l.uuidToId(P);i.get(H,Q)===y&&i.deleteProperty(H,Q)}else{let Q=A(y,"attrOriginals").get(_);y.hasAttribute(_)&&y.setAttribute(_,Q),A(H).get("idrefs")?.delete(y)}})};r.realtime(t.document).query(e.namespaceSelector,y=>{let _=(S,O,P,D)=>{if(!S.hasAttribute(O))return;let H=()=>S.getAttribute(O);w(S,O,H,P),S.isConnected&&x(S,O,A(S,"attrOriginals").get(O)||H,D)};y.exits.forEach(S=>{if(S.isConnected){let D=mi.call(t,S);for(let H of new Set([...Object.values(D),...A(D).get("idrefs")||[]]))for(let Q of u)_(H,Q,D)}let O=S[s.CONTEXT_API.api.contexts],P=O.find(n.kind);P&&O.detach(P)}),y.entrants.forEach(S=>{let O,P=de.call(t,S,!0);for(let H of new Set([...Object.values(P),...A(P).get("idrefs")||[]]))if((O=de.call(t,H,!0))!==P)for(let Q of u)_(H,Q,P,O);let D=S[s.CONTEXT_API.api.contexts];D.find(n.kind)||D.attach(new n)})},{id:"namespace-html:namespace",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(`[${u.map(y=>t.CSS.escape(y)).join("],[")}]`,y=>{let _={forID:new Map,forOther:new Map};for(let S of u){let O=S===e.attr.lid?_.forID:_.forOther;y.exits.forEach(P=>{if(!P.hasAttribute(S))return;let D=O.get(P);typeof D>"u"&&(D=(S===e.attr.lid?P.parentNode:P)?.closest?.(e.namespaceSelector)||P.getRootNode().host,O.set(P,D)),!(D&&!D.isConnected)&&w(P,S,()=>P.getAttribute(S))}),y.entrants.forEach(P=>{!P.hasAttribute(S)||x(P,S,()=>P.getAttribute(S))})}_.forID.clear(),_.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(u,y=>{for(let _ of y)_.oldValue&&w(_.target,_.name,_.oldValue),_.value&&x(_.target,_.name,_.value)},{id:"namespace-html:attr(attrs)",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let C,b=()=>{if(!t.location.hash?.startsWith(`#${l.lidrefPrefix()}`))return;let y=t.location.hash?.substring(`#${l.lidrefPrefix()}`.length).split("/").map(S=>S.trim()).filter(S=>S)||[],_=y.reduce((S,O)=>S&&S[e.api.namespace][O],t.document);C&&e.target.className&&C.classList.toggle(e.target.className,!1),_&&_!==t.document&&(e.target.className&&_.classList.toggle(e.target.className,!0),e.target.eventName&&_.dispatchEvent(new t.CustomEvent(e.target.eventName)),e.target.scrolling&&y.length>1&&_.scrollIntoView(),C=_)};t.addEventListener("hashchange",b),r.ready(b)}function lr({advanced:e={},...t}){let{config:i,window:r}=rt.call(this,"scoped-js",t,{script:{retention:"retain",mimeTypes:"module|text/javascript|application/javascript",timing:"auto"},api:{scripts:"scripts"},advanced:le(e)}),s=Array.isArray(i.script.mimeTypes)?i.script.mimeTypes:i.script.mimeTypes.split("|").filter(n=>n);i.scriptSelector=s.map(n=>`script[type="${r.CSS.escape(n)}"]:not([oohtmlignore])`).concat("script:not([type])").join(","),r.webqit.oohtml.Script={compileCache:[new Map,new Map],execute:Pa.bind(r,i)},Aa.call(r,i),Ia.call(r,i)}function Aa(e){let t=this,i=new Map;if(e.api.scripts in t.Element.prototype)throw new Error(`The "Element" class already has a "${e.api.scripts}" property!`);[t.ShadowRoot.prototype,t.Element.prototype].forEach(r=>{Object.defineProperty(r,e.api.scripts,{get:function(){return i.has(this)||i.set(this,[]),i.get(this)}})}),Object.defineProperties(t.HTMLScriptElement.prototype,{scoped:{configurable:!0,get(){return this.hasAttribute("scoped")},set(r){this.toggleAttribute("scoped",r)}},quantum:{configurable:!0,get(){return this.hasAttribute("quantum")},set(r){this.toggleAttribute("quantum",r)}}})}async function Pa(e,t){let i=this,{realdom:r}=i.webqit,s=pi(t);if(!s)throw new Error("Argument must be a valid exec hash.");let{script:n,compiledScript:a,thisContext:o}=s;e.script.retention==="dispose"?n.remove():e.script.retention==="hidden"?n.textContent='"source hidden"':n.textContent=await a.toString();let u=n.scoped?o:n.getRootNode();A(u).has("scriptEnv")||A(u).set("scriptEnv",Object.create(null));let c=await(await a.bind(o,A(u).get("scriptEnv"))).execute();n.quantum&&Object.defineProperty(n,"state",{value:c}),r.realtime(i.document).observe(n,()=>{n.quantum&&c.dispose(),o instanceof i.Element&&o[e.api.scripts]?.splice(o[e.api.scripts].indexOf(n,1))},{id:"scoped-js:script-exits",subtree:"cross-roots",timing:"sync",generation:"exits"})}function Ia(e){let t=this,{webqit:{oohtml:i,realdom:r}}=t;t.HTMLScriptElement.supports||(t.HTMLScriptElement.supports=n=>["text/javascript","application/javascript"].includes(n));let s=new WeakSet;r.realtime(t.document).query(e.scriptSelector,n=>{n.entrants.forEach(a=>{if(s.has(a))return;let o=Ws.call(t,e,a);if(!o)return;s.add(a);let u=a.scoped?a.parentNode||n.target:a.type==="module"?void 0:t;a.scoped&&u[e.api.scripts].push(a);let c=Yt({script:a,compiledScript:o,thisContext:u});n.type==="query"||a.type&&!t.HTMLScriptElement.supports(a.type)||a.getAttribute("data-handling")==="manual"||e.script.timing==="manual"?i.Script.execute(c):a.textContent=`webqit.oohtml.Script.execute( '${c}' );`})},{id:"scoped-js:script-entries",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants",eventDetails:!0})}function Ws(e,t){let i=this,{webqit:{oohtml:r,QuantumScript:s,AsyncQuantumScript:n,QuantumModule:a}}=i,o=(t._=t.textContent.trim())&&t._.startsWith("/*@oohtml*/if(false){")&&t._.endsWith("}/*@oohtml*/")?t._.slice(21,-12):t.textContent;if(!o.trim().length)return;let u=Yt(o),c=r.Script.compileCache[t.quantum?0:1],l;if(!(l=c.get(u))){let{parserParams:f,compilerParams:p,runtimeParams:m}=e.advanced;l=new(t.type==="module"?a:s||n)(o,{exportNamespace:`#${t.id}`,fileName:`${i.document.url?.split("#")?.[0]||""}#${t.id}`,parserParams:{...f,executionMode:t.quantum&&"QuantumProgram"||"RegularProgram"},compilerParams:p,runtimeParams:m}),c.set(u,l)}return l}function zs(e){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:i}}}}=t;[...e?.querySelectorAll(i.scriptSelector)||[]].forEach(r=>{Ws.call(t,i,r)})}function pr(e={}){let{config:t,window:i}=rt.call(this,"data-binding",e,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},advanced:le({runtimeParams:{spec:{handler:s=>{}}}})});({CONTEXT_API:t.CONTEXT_API,BINDINGS_API:t.BINDINGS_API,HTML_IMPORTS:t.HTML_IMPORTS}=i.webqit.oohtml.configs),t.attrSelector=`[${i.CSS.escape(t.attr.render)}]`;let r=(s,n)=>{let a=`starts-with(., "${s}")`,o=`substring(., string-length(.) - string-length("${n}") + 1) = "${n}"`;return`${a} and ${o}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,Oa.call(i,t)}function Oa(e){let t=this,{webqit:{realdom:i}}=t;i.realtime(t.document).query(e.attrSelector,r=>{Qs.call(this,...r.exits),Na.call(t,e,...r.entrants)},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),i.realtime(t.document).query(`(${e.discreteBindingsSelector})`,r=>{Qs.call(this,...r.exits),Ta.call(t,e,...r.entrants)},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function Gs(e,t){let{webqit:{realdom:i,Observer:r,DOMBindingsContext:s}}=this;if(A(t).has("data-binding"))return A(t).get("data-binding");let n=Object.create(null),a=new AbortController;n.$exec__=(u,c,...l)=>{(()=>{try{u[c](...l)}catch(p){throw new Error(`Error executing "${c}()": ${p.message} at ${p.cause}`)}})()},n.$assign__=(u,c,l)=>{(()=>{try{u[c]=l}catch(p){throw new Error(`Error executing "${c} = ${l}": ${p.message} at ${p.cause}`)}})()},r.intercept(n,{get:(u,c,l)=>{if(!(u.key in n)){let f={...s.createRequest(u.key),live:!0,signal:a.signal};t[e.CONTEXT_API.api.contexts].request(f,p=>{r.set(n,u.key,p)})}return l(n[u.key]??(u.key in globalThis?globalThis[u.key]:void 0))},has:(u,c,l)=>l(!0)});let o={scope:n,abortController:a,bindings:new Map};return A(t).set("data-binding",o),o}function Qs(...e){for(let t of e){let i=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:s}=A(i).get("data-binding")||{};if(!r?.has(t))return;r.get(t).state.dispose(),r.get(t).signals?.forEach(n=>n.abort()),r.delete(t),r.size||(s.abort(),A(i).delete("data-binding"))}}function Ks(e,t){let i=e.tokens.tagStart.split("").map(c=>`\\${c}`).join(""),r=e.tokens.tagEnd.split("").map(c=>`\\${c}`).join(""),s=e.tokens.stateStart.split("").map(c=>c===" "?"(?:\\s+)?":`\\${c}`).join(""),n=e.tokens.stateEnd.split("").map(c=>`\\${c}`).join(""),a=`^${i}(.*?)(?:${s}(\\d+)${n}(?:\\s+)?)?${r}$`,[,o,u]=t.match(new RegExp(a));return{raw:t,expr:o,span:parseInt(u??0)}}async function Ta(e,...t){let i=this,r=t.reduce((s,n)=>{if(n.isBound)return s;let a=Ks(e,n.nodeValue),o=n;if(a.span){if(o=n.nextSibling,o?.nodeName!=="#text"||o.nodeValue.length<a.span)return s;o.nodeValue.length>a.span&&o.splitText(a.span)}else o=n.ownerDocument.createTextNode(""),n.after(o);o.isBound=!0;let u=n;return i.webqit.env!=="server"&&(u.remove(),u=null),s.concat({textNode:o,template:a,anchorNode:u})},[]);for(let{textNode:s,template:n,anchorNode:a}of r){let o=Xs.call(i,e,n.expr),{scope:u,bindings:c}=Gs.call(this,e,s.parentNode);Object.defineProperty(s,"$oohtml_internal_databinding_anchorNode",{value:a,configurable:!0});try{c.set(s,{state:await(await o.bind(s,u)).execute()})}catch(l){console.log(l)}}}var hr=new Map;function Xs(e,t){if(hr.has(t))return hr.get(t);let i=`let content = ((${t}) ?? '') + '';`;i+="$assign__(this, 'nodeValue', content);",i+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${e.tokens.tagStart}${me(t)}${e.tokens.stateStart}" + content.length + "${e.tokens.stateEnd} ${e.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:r}}=this,{parserParams:s,compilerParams:n,runtimeParams:a}=e.advanced,o=new r(i,{parserParams:s,compilerParams:n,runtimeParams:a});return hr.set(t,o),o}async function Na(e,...t){for(let i of t){let r=Ys.call(this,e,i.getAttribute(e.attr.render)),{scope:s,bindings:n}=Gs.call(this,e,i),a=[];Object.defineProperty(i,"$oohtml_internal_databinding_signals",{value:a,configurable:!0});try{n.set(i,{signals:a,state:await(await r.bind(i,s)).execute()})}catch(o){console.log(o)}}}var fr=new Map;function Ys(e,t){if(fr.has(t))return fr.get(t);let i={},r=-1,s=Tt(t,";").map(l=>{let[f,p]=Tt(l,":").map(x=>x.trim()),m=f[0],g=f.slice(1).trim(),v=`(${p})`,E=`(${v} ?? '')`;if(m==="&")return g.startsWith("--")?`$exec__(this.style, 'setProperty', "${me(g)}", ${E});`:`$assign__(this.style, "${me(g)}", ${E});`;if(m==="%")return`$exec__(this.classList, 'toggle', "${me(g)}", !!${v});`;if(m==="~")return g.startsWith("?")?`$exec__(this, 'toggleAttribute', "${me(g.substring(1).trim())}", !!${v});`:`$exec__(this, 'setAttribute', "${me(g)}", ${E});`;if(m==="#"){if(i[g])throw new Error(`Duplicate binding: ${f}.`);if(i[g]=!0,g==="text")return`$assign__(this, 'textContent', ${E});`;if(g==="html")return`$exec__(this, 'setHTMLUnsafe', ${E});`;if(g==="items"){let[x,w]=Tt(p,"/");if(!w)throw new Error(`Invalid ${m}items spec: ${l}; no import specifier.`);let[C,b,y,_]=x.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!C)throw new Error(`Invalid ${m}items spec: ${l}.`);if(b.startsWith("(")?b=b.trim().slice(1,-1).split(",").map(O=>O.trim()):b=[b],b.length>(y==="in"?3:2))throw new Error(`Invalid ${m}items spec: ${l}.`);let S=y==="in"?b[2]:b[1]||"$index__";return`
|
|
15
|
+
}`,u.executionMode="RegularProgram"}else if(!["script","async-script"].includes(e))throw new Error(`Unrecognized sourceType specified: "${e}".`);c.sourceType=e,u.inBrowser=f,c.base64=p&&f&&"export default async function(%0) {%1}";let m=t(i,{parserParams:u,compilerParams:c});if(m instanceof Promise&&!["async-function","async-script","module"].includes(e))throw new Error("Parse-compile can only return a Promise for sourceTypes: async-function, async-script, module.");return l.sourceType=e,l.inBrowser=f,l.exportNamespace=a,l.fileName=o,nt(m,g=>{let v=["function","async-function"].includes(e);return nt(((x,w)=>{if(l.compileFunction)return l.compileFunction(w.toString(),[x]);if(c.base64){let C=`data:text/javascript;base64,${w.toString("base64")}`;return(()=>import(C).then(y=>y.default))()}return new(p?async function(){}.constructor:Function)(x,w.toString())})(g.identifier+"",g),x=>{let w=(C,b=s)=>{let y=x;C&&(y=y.bind(C));let _="global",S=new et(void 0,_,globalThis);return(e.endsWith("script")||b)&&(_="env",S=new et(S,_,b)),e==="module"&&(_="module",S=new et(S,_)),typeof C<"u"&&(S=new et(S,"this",{this:C})),new Gt(void 0,_,{...l,originalSource:g.originalSource,executionMode:g.isQuantumProgram&&"QuantumProgram"||"RegularProgram"},S,y)};return v?w().execute():{createRuntime:w,compilation:g}})})}var Kt=class{constructor(...t){let i=this.constructor,r=typeof t[t.length-1]=="object"?t.pop():{},s=t.pop()||"";this.$program=De(i.sourceType,i.parseCompileCallback,s,r)}execute(){return nt(this.$program,({createRuntime:t})=>t().execute())}bind(t,i=void 0){return nt(this.$program,({createRuntime:r})=>r(t,i))}toString(t=!1){return nt(this.$program,({compilation:i})=>t?i+"":i.originalSource)}};function ha(...e){let{source:t,params:i}=Di(e);return De("function",qe,t,i)}function Ps(...e){let{source:t,params:i}=Di(e);return De("async-function",qe,t,i)}var fa=Ps,Ve=class extends Kt{};G(Ve,"sourceType","script"),G(Ve,"parseCompileCallback",qe);var he=class extends Kt{};G(he,"sourceType","async-script"),G(he,"parseCompileCallback",qe);var pa=he,Fe=class extends Kt{};G(Fe,"sourceType","module"),G(Fe,"parseCompileCallback",qe);function qe(e,t){let i=ks(e,t.parserParams);return As(i,t.compilerParams)}function je(e,t,i={},r={}){t=W(t).slice();for(var s=e;!Et(s)&&!xe(s)&&t.length;){var n=t.shift();if(!(i.get?i.get(s,n):q(s)?n in s:s[n])){r.exists=!1;return}s=i.get?i.get(s,n):s[n]}return r.exists=!0,s}function er(e,t,i,r={},s={}){let n=(l,f,p)=>s.set?s.set(l,f,p):(at(t[o])&&L(l)?l.push(p):l[f]=p,!0);t=W(t);for(var a=e,o=0;o<t.length;o++)if(o<t.length-1){if(!a||!q(a)&&!F(a))return!1;var u=je(a,t[o],s);if(!q(u)){if(s.buildTree===!1)return!1;u=F(s.buildTree)?s.buildTree(o):at(t[o+1])?[]:{};var c=n(a,t[o],u);if(!c)return!1}a=u}else return n(a,t[o],i)}var Be=class{constructor(t,i=!1){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),Object.defineProperty(this,"_synthesis",{value:0,writable:!0}),!i&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(t){this._synthesis++,this._fulfill();let i=await t();return this._synthesis--,i}_fulfill(){for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t)}_loop(){this.window.requestAnimationFrame(()=>{this._fulfill(),this._loop()})}onread(t,i=!1){if(i)return new Promise(r=>{this.synthesis?r(t()):this.readCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.readCallbacks.add(t)}onwrite(t,i=!1){if(i)return new Promise(r=>{this.synthesis?r(t()):this.writeCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.writeCallbacks.add(t)}cycle(t,i,r){this.onread(()=>{let s=t(r),n=a=>{a!==void 0&&this.onwrite(()=>{let o=i(a,r),u=c=>{c!==void 0&&this.cycle(t,i,c)};o instanceof Promise?o.then(u):u(o)})};s instanceof Promise?s.then(n):n(s)})}};function Is(e){return(e=e.trim())&&e.startsWith("(")&&e.endsWith(")")}function fe(e,t,i,r=!0){i=(Array.isArray(i)?i:[i]).map(a=>(a+"").replace("(",r?"(.//":"(./")).join("|");let s=[],n;try{let a=e.document.evaluate(i,t,null,e.XPathResult.ANY_TYPE);for(;n=a.iterateNext();)s.push(n)}catch{}return s}function Os(e,t,i){i=(Array.isArray(i)?i:[i]).map(r=>(r+"").replace("(","(self::")).join("|");try{return e.document.evaluate(`${i}`,t,null,e.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function He(e,t,i,r=!1,s=null){let n=s?.get(t)?.get(i);if(typeof n<"u")return n;let a=c=>(s?.has(t)||s?.set(t,new WeakMap),s?.get(t)?.set(i,c),c),o=t.getRootNode(),u=i.getRootNode();return o===u?a(t.contains(i)):r&&u instanceof e.ShadowRoot?a(He(e,t,u.host,r,s)):a(!1)}function Ts(e,t="|"){return[...e].reduce(([i,r,s,n],a)=>!i&&r===0&&(Array.isArray(t)?t:[t]).includes(a)?[i,r,[""].concat(s)]:(!i&&["(","[","{"].includes(a)&&!s[0].endsWith("\\")&&r++,!i&&[")","]","}"].includes(a)&&!s[0].endsWith("\\")&&r--,['"',"'","`"].includes(a)&&!s[0].endsWith("\\")&&(i=i===a?null:i||a),s[0]+=a,[i,r,s]),[null,0,[""]])[2].reverse()}var ht=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Is(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ts(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var Xt=class{constructor(t,i,r){this.context=t,this.namespace=i,this.window=t.defaultView||t.ownerDocument?.defaultView||r,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if(F(t[0])?t=[[],...t]:V(t[0])&&!(t[0]instanceof ht)&&t.length===1?t=[[],void 0,t[0]]:V(t[1])&&t.length===2?t=[W(t[0],!1),void 0,t[1]]:t[0]=W(t[0],!1),t[0].filter(i=>typeof i!="string"&&!(i instanceof ht)&&!(i instanceof this.window.Node)).length)throw new Error("Argument #2 must be either a string or a Node object, or a list of those.");return t[0]=t[0].map(i=>i instanceof ht?i:new ht(i)),t}registry(...t){return K("realdom.realtime",this.window,this.namespace,...t)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(t,i,r){let{window:s}=this,n=new Set,a=new WeakMap;for(let[o,u]of this.registry(t)){let c=[].concat(i).filter(f=>He(s,o.context,f.target,o.params.subtree==="cross-roots",a));if(!c.length)continue;let l=[o,Array.isArray(i)?c:c[0]];u?n.add(l):r.call(s,...l)}for(let o of n)r.call(s,...o);n.clear()}disconnectables(t,...i){let r={disconnect(){i.forEach(s=>s&&F(s.disconnect)&&s.disconnect()||F(s)&&s()||V(s)&&(s.disconnected=!0))}};return t&&t.addEventListener("abort",()=>r.disconnect()),r}};var Dt=class extends Xt{type="attr";constructor(t,...i){super(t,"attr",...i)}get(t,i=void 0,r={}){let s=typeof t=="string"||t instanceof ht;[t=[],i=void 0,r={}]=this.resolveArgs(arguments);let{context:n}=this,a=Rs(n,t);if(!i)return a;let o=r.lifecycleSignals&&this.createSignalGenerator();if(s)for(let u of a){let c=o?.generate()||{};i(u,c,n)}else{let u=o?.generate()||{};i(a,u,n)}if(r.live){o&&(r={...r,signalGenerator:o});let u=this.observe(s?t[0]:t,i,{newValue:!0,...r});return this.disconnectables(r.signal,u)}}observe(t,i,r={}){let s=typeof t=="string"||t instanceof ht;if([t=[],i,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(s?t[0]:t,i,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:n,window:a,webqit:o}=this;r.eventDetails&&!o.realdom.attrInterceptionHooks?.intercepting&&$s.call(a,"intercept",()=>{});let u=new a.MutationObserver(p=>{p=Ls(p).map(m=>Ms.call(a,m)),Ns.call(a,f,p,n)}),c={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(c.attributeFilter=t.map(p=>p+"")),u.observe(n,c);let l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),f={context:n,spec:t,callback:i,params:r,atomics:new Map,originalFilterIsString:s,signalGenerator:l,disconnectable:u};return this.disconnectables(r.signal,u,l)}observeSync(t,i,r={}){let s=typeof t=="string"||t instanceof ht;[t,i,r={}]=this.resolveArgs(arguments);let{context:n,window:a}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let o=r.timing==="intercept"?"intercept":"sync";this.registry(o).size||$s.call(a,o,p=>{this.forEachMatchingContext(o,p,Ns)});let u={disconnect(){f.delete(l)}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:n,spec:t,callback:i,params:r,atomics:new Map,originalFilterIsString:s,signalGenerator:c,disconnectable:u},f=this.registry(o);return f.set(l,!!l.params.deferred),this.disconnectables(r.signal,u,c)}};function Ls(e){return e.reduce((t,i,r)=>t[r-1]?.attributeName===i.attributeName||K(i.target,"internalAttrInteractions").get(i.attributeName)?t:t.concat(i),[])}function Ns(e,t){let{context:i,spec:r,callback:s,params:n,atomics:a,originalFilterIsString:o,signalGenerator:u}=e,c=r.map(p=>p+"");if(n.atomic&&!a.size?t=Rs(i,r,t):n.timing!=="async"&&r.length&&(t=t.filter(p=>c.includes(p.name))),!t.length)return;n.newValue===null&&n.oldValue===null&&n.eventDetails||(t=t.map(p=>{let m;return n.eventDetails||({event:m,...p}=p),!n.oldValue&&"oldValue"in p&&({oldValue:m,...p}=p),!n.newValue&&"value"in p?{value:m,...p}=p:n.newValue&&typeof p.value>"u"&&(p={...p,value:hi(p.target,p.name,()=>p.target.getAttribute(p.name))}),p})),n.atomic&&(t.forEach(p=>a.set(p.name,p)),t=Array.from(a.entries()).map(([,p])=>p));let l=o?t[0]:t,f=u?.generate()||{};s(l,f,i)}function hi(e,t,i){let r=K(e,"internalAttrInteractions").get(t);K(e,"internalAttrInteractions").set(t,!0);let s=i();return K(e,"internalAttrInteractions").set(t,r),s}function Rs(e,t,i=[]){let r={event:null,type:"attribute"};return t.length?t.map(n=>(n=n+"",i.find(a=>a.name===n)||{target:e,name:n,value:hi(e,n,()=>e.getAttribute(n)),...r})):Array.from(e.attributes).map(n=>i.find(a=>a.name===n.nodeName)||{target:e,name:n.nodeName,value:hi(e,n.nodeName,()=>n.nodeValue),...r})}function Ms({target:e,attributeName:t,value:i,oldValue:r}){let a=(this.webqit.realdom.attrInterceptionRecords?.get(e)||{})[t]?.[0]||"mutation";return{target:e,name:t,value:i,oldValue:r,type:"observation",event:a}}function $s(e,t){let i=this,{webqit:r,document:s,Element:n}=i;r.realdom.attrInterceptionHooks||Object.defineProperty(r.realdom,"attrInterceptionHooks",{value:new Map}),r.realdom.attrInterceptionHooks.has(e)||r.realdom.attrInterceptionHooks.set(e,new Set),r.realdom.attrInterceptionHooks.get(e).add(t);let a=()=>r.realdom.attrInterceptionHooks.get(e).delete(t);if(r.realdom.attrInterceptionHooks?.intercepting)return a;console.warn("Attr mutation APIs are now being intercepted."),r.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"attrInterceptionRecords",{value:new Map});let o=(l,f)=>{r.realdom.attrInterceptionRecords.has(l.target)||r.realdom.attrInterceptionRecords.set(l.target,{});let p=r.realdom.attrInterceptionRecords.get(l.target);if(p[l.name]=p[l.name]||[],p[l.name].unshift(l.event),K(l.target,"internalAttrInteractions").get(l.name))return f();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(g=>g([l]));let m=f();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(g=>g([l])),m};new i.MutationObserver(l=>{l=l.filter(f=>!(i.webqit.realdom.attrInterceptionRecords?.get(f.target)||{})[f.attributeName]?.shift()),l=Ls(l).map(f=>Ms.call(i,f)),l.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(f=>f(l)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(f=>f(l)))}).observe(s,{attributes:!0,subtree:!0,attributeOldValue:!0});let c=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(l=>{c[l]=n.prototype[l],n.prototype[l]=function(...f){let p,m=hi(this,f[0],()=>this.getAttribute(f[0]));["setAttribute","toggleAttribute"].includes(l)&&(p=f[1]),l==="toggleAttribute"&&p===void 0&&(p=m===null);let g={target:this,name:f[0],value:p,oldValue:m,type:"interception",event:[this,l]};return o(g,()=>c[l].call(this,...f))}}),a}var Ue=class extends Xt{constructor(t,...i){super(t,"tree",...i)}attr(t,i=void 0,r={}){let{context:s,window:n}=this;return new Dt(s,n).get(...arguments)}query(t,i=void 0,r={}){[t,i=void 0,r={}]=this.resolveArgs(arguments);let{context:s}=this,n=new Map,a=c=>(n.has(c)||n.set(c,{target:c,entrants:[],exits:[],type:"query",event:null}),n.get(c));if(!r.generation||r.generation==="entrants"){if(!t.length)[...s.children].forEach(c=>a(s).entrants.push(c));else if(t.every(c=>c.type==="selector")){let[c,l]=t.reduce(([p,m],g)=>g.kind==="xpath"?[p,m.concat(g)]:[p.concat(g),m],[[],[]]),f=[];r.subtree?(c.length&&f.push(...s.querySelectorAll(c.join(","))),l.length&&f.push(...fe(this.window,s,l))):(c.length&&f.push(...[...s.children].filter(p=>p.matches(c))),l.length&&f.push(...fe(this.window,s,l,!1))),f.forEach(p=>a(p.parentNode||s).entrants.push(p))}}if(!i)return n;let o={disconnected:!1},u=i&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,c]of n){if(o.disconnected)break;let l=u?.generate()||{};i(c,l,s)}if(r.live){u&&(r={...r,signalGenerator:u});let c=this.observe(t,i,r);return this.disconnectables(r.signal,o,c)}return this.disconnectables(r.signal,o,u)}children(t,i=void 0,r={}){return[t,i=void 0,r={}]=this.resolveArgs(arguments),this.query(t,i,{...r,subtree:!1})}subtree(t,i=void 0,r={}){return[t,i=void 0,r={}]=this.resolveArgs(arguments),this.query(t,i,{...r,subtree:!0})}observe(t,i,r={}){if([t,i,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(t,i,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:s,window:n,webqit:a,document:o}=this;r.eventDetails&&(a.realdom.domInterceptionRecordsAlwaysOn=!0),(o.readyState==="loading"||a.realdom.domInterceptionRecordsAlwaysOn)&&!a.realdom.domInterceptionHooks?.intercepting&&Fs.call(n,"sync",()=>{});let u=new n.MutationObserver(f=>f.forEach(p=>{rr.call(n,l,Vs.call(n,p),s)}));u.observe(s,{childList:!0,subtree:r.subtree&&!0});let c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:s,spec:t,callback:i,params:r,signalGenerator:c,disconnectable:u};if(r.staticSensitivity){let f=Ds.call(n,l);return this.disconnectables(r.signal,u,c,f)}return this.disconnectables(r.signal,u,c)}observeSync(t,i,r={}){[t,i,r={}]=this.resolveArgs(arguments);let{context:s,window:n}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let a=r.timing==="intercept"?"intercept":"sync";this.registry(a).size||Fs.call(n,a,p=>{this.forEachMatchingContext(a,p,rr)});let o=new n.MutationObserver(p=>p.forEach(m=>{Array.isArray((m=Vs.call(n,m)).event)||rr.call(n,l,m,s)}));o.observe(s,{childList:!0,subtree:r.subtree&&!0});let u={disconnect(){f.delete(l),o.disconnect()}},c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),l={context:s,spec:t,callback:i,params:r,signalGenerator:c,disconnectable:u},f=this.registry(a);if(f.set(l,!!l.params.deferred),r.staticSensitivity){let p=Ds.call(n,l);return this.disconnectables(r.signal,u,c,p)}return this.disconnectables(r.signal,u,c)}track(t,i,r={}){return r={subtree:!0,...r},this.observe(t,s=>{s.entrants.length&&i(!0,Array.isArray(t)?s.entrants:s.entrants[0]),s.exits.length&&i(!1,Array.isArray(t)?s.exits:s.exits[0])},r)}};function Ds(e){let t=this,{context:i,spec:r,callback:s,params:n,signalGenerator:a}=e,o=r.filter(m=>m.kind==="css"),u=m=>m.match(/\.([\w-]+)/g)?.length?["class"]:[],c=m=>m.match(/#([\w-]+)/g)?.length?["id"]:[],l=m=>[...m.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(g=>g[1]).concat(u(m)).concat(c(m));if(!(e.$attrs=Array.from(new Set(o.filter(m=>(m+"").includes("[")).reduce((m,g)=>m.concat(l(g+"")),[])))).length)return;let f=new Set,p=new Set;return f.push=m=>(p.delete(m),f.add(m)),p.push=m=>(f.delete(m),p.add(m)),e.$deliveryCache={entrants:f,exits:p},new Dt(i,t).observe(e.$attrs,m=>{let g=new Map,v=w=>(g.has(w)||g.set(w,{target:w,entrants:[],exits:[],type:"static",event:null}),g.get(w)),E=new WeakMap,x=w=>(E.has(w)||E.set(w,o.some(C=>w.matches(C+""))),E.get(w));for(let w of m)["entrants","exits"].forEach(C=>{n.generation&&C!==n.generation||e.$deliveryCache[C].has(w.target)||(C==="entrants"?!x(w.target):x(w.target))||(e.$deliveryCache[C].push(w.target),v(w.target)[C].push(w.target),v(w.target).event=w.event)});for(let[,w]of g){let C=a?.generate()||{};s(w,C,i)}},{subtree:n.subtree,timing:n.timing,eventDetails:n.eventDetails})}function rr(e,t){let{context:i,spec:r,callback:s,params:n,signalGenerator:a,$deliveryCache:o}=e,u={...t,entrants:[],exits:[]};if(n.eventDetails||delete u.event,["entrants","exits"].forEach(l=>{if(!(n.generation&&l!==n.generation)&&(r.length?u[l]=xa.call(this,r,n.subtree==="cross-roots",t[l],t.event!=="parse"):u[l]=[...t[l]],!!o))for(let f of u[l])o[l].push(f)}),!u.entrants.length&&!u.exits.length)return;let c=a?.generate()||{};s(u,c,i)}function xa(e,t,i,r){i=Array.isArray(i)?i:[...i];let s=(n,a)=>{if(a.type==="selector"){let o=a.isXpathAttr?[]:n.filter(u=>a.kind==="xpath"?Os(this,u,a+""):u.matches&&u.matches(a+""));if((r||a.isXpathAttr)&&(o=n.reduce((u,c)=>a.kind==="xpath"?[...u,...fe(this,c,a,r)]:c.querySelectorAll?[...u,...c.querySelectorAll(a+"")]:u,o)),o.length)return o}else if(n.includes(a.content)||r&&n.some(o=>He(this,o,a.content,t)))return[a.content]};return i.$$searchCache||(i.$$searchCache=new Map),e.reduce((n,a)=>{let o;return i.$$searchCache.has(a.content)?o=i.$$searchCache.get(a.content):(o=s(i,a)||[],a.type==="instance"&&i.$$searchCache.set(a.content,o)),n.concat(o)},[])}function Vs({target:e,addedNodes:t,removedNodes:i}){let r=this,s;return s=W(t).reduce((n,a)=>n||r.webqit.realdom.domInterceptionRecords?.get(a),null),s=W(i).reduce((n,a)=>n||r.webqit.realdom.domInterceptionRecords?.get(a),s),s=s||r.document.readyState==="loading"&&"parse"||"mutation",{target:e,entrants:t,exits:i,type:"observation",event:s}}function Fs(e,t){let i=this,{webqit:r,document:s,Node:n,CharacterData:a,Element:o,HTMLElement:u,HTMLTemplateElement:c,DocumentFragment:l}=i;r.realdom.domInterceptionHooks||Object.defineProperty(r.realdom,"domInterceptionHooks",{value:new Map}),r.realdom.domInterceptionNoRecurse||Object.defineProperty(r.realdom,"domInterceptionNoRecurse",{value:new Map}),r.realdom.domInterceptionHooks.has(e)||r.realdom.domInterceptionHooks.set(e,new Set),r.realdom.domInterceptionHooks.get(e).add(t);let f=()=>r.realdom.domInterceptionHooks.get(e).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return f;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let p=(x,w,C)=>{r.realdom.domInterceptionNoRecurse.set(x,w);let b=C();return r.realdom.domInterceptionNoRecurse.delete(x),b},m=(x,w)=>{x.entrants.concat(x.exits).forEach(b=>{clearTimeout(r.realdom.domInterceptionRecords.get(b)?.timeout),r.realdom.domInterceptionRecords.set(b,x.event);let y=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(b)},0);Object.defineProperty(x.event,"timeout",{value:y,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(b=>b(x));let C=w();return r.realdom.domInterceptionHooks.get("sync")?.forEach(b=>b(x)),C},g={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},v={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(g).reduce((x,w)=>x.concat(w),[])).forEach(x=>{Object.keys(g).forEach(b=>{if(!g[b].includes(x))return;let y=Object.getOwnPropertyDescriptor(i[b].prototype,x);!y||(Object.defineProperty(i[b].prototype,x,"value"in y?{...y,value:w}:{...y,set:C}),v[b][x]=y)});function w(...b){let y=Object.keys(v).find(X=>this instanceof i[X]&&x in v[X]),_=v[y],S=()=>_[x].value.call(this,...b);if(r.realdom.domInterceptionNoRecurse.get(this)===x)return S();let O=[],P=[],D=this;["insertBefore"].includes(x)?P=[b[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(x)?(P=[b[1]],["beforebegin","afterend"].includes(b[0])&&(D=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(x)?(O=[...this.childNodes],P=x==="replaceChildren"?[...b]:[b[0]]):["replaceWith","remove"].includes(x)?(O=[this],P=x==="replaceWith"?[...b]:[],D=this.parentNode):["replaceChild"].includes(x)?(O=[b[1]],P=[b[0]]):["removeChild"].includes(x)?O=[...b]:(P=[...b],["before","after"].includes(x)&&(D=this.parentNode));let H=x;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(x)){let X=this.nodeName;if(x==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(b[0])){if(!this.parentNode)return _[x].value.call(this,...b);X=this.parentNode.nodeName}let Y=s.createElement(X.includes("-")?"div":X);_.setHTMLUnsafe.value.call(Y,P[0],x==="setHTMLUnsafe"?b[1]:{}),P=[...Y.childNodes],x==="insertAdjacentHTML"?(H="insertAdjacentElement",b[1]=new l,p(b[1],"append",()=>b[1].append(...Y.childNodes))):(H="replaceChildren",b=[...Y.childNodes])}return m({target:D,entrants:P,exits:O,type:"interception",event:[this,x]},()=>_[H].value.call(this,...b))}function C(b){let y=Object.keys(v).find(Q=>this instanceof i[Q]&&x in v[Q]),_=v[y],S=()=>_[x].set.call(this,b);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===x)return S();let O=[],P=[],D=this;if(["outerHTML","outerText"].includes(x)?(O=[this],D=this.parentNode):this instanceof c?(D=this.content,O=[...this.content.childNodes]):O=[...this.childNodes],["outerHTML","innerHTML"].includes(x)){let Q=this.nodeName;if(x==="outerHTML"){if(!this.parentNode)return S();Q=this.parentNode.nodeName}let X=s.createElement(Q.includes("-")?"div":Q);if(p(X,x,()=>X[x]=b),P=this instanceof c?[...X.content.childNodes]:[...X.childNodes],this instanceof c&&this.hasAttribute("src")||this instanceof ShadowRoot){let Y=Ft=>Ft.reduce((St,_t)=>_t instanceof HTMLScriptElement?St.concat(_t):_t instanceof c?St.concat(Y([_t.content])):(St=St.concat(Y([..._t.querySelectorAll?.("template")||[]].map(rn=>rn.content))),St.concat(..._t.querySelectorAll?.("script")||[])),[]);for(let Ft of Y(P)){if(this instanceof ShadowRoot){Ft.setAttribute("data-handling","manual");continue}let St=s.createElement("script");[...Ft.attributes].forEach(_t=>St.setAttribute(_t.name,_t.value)),St.textContent=Ft.textContent,p(Ft,"replaceWith",()=>Ft.replaceWith(St))}}x==="outerHTML"?(b=new l,p(b,"append",()=>b.append(...P)),S=()=>p(this,"replaceWith",()=>o.prototype.replaceWith.call(this,b))):this instanceof c?S=()=>p(this.content,"replaceChildren",()=>this.content.replaceChildren(...P)):S=()=>p(this,"replaceChildren",()=>o.prototype.replaceChildren.call(this,...P))}return m({target:D,entrants:P,exits:O,type:"interception",event:[this,x]},S)}}),f}function qs(){ya.call(this),ba.call(this),wa.call(this)}function ya(){let e=this;e.CSS||(e.CSS={}),e.CSS.escape||(e.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function ba(){let e=this;"isConnected"in e.Node.prototype||Object.defineProperty(e.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function wa(){let e=this;e.Element.prototype.matches||(e.Element.prototype.matches=e.Element.prototype.matchesSelector||e.Element.prototype.mozMatchesSelector||e.Element.prototype.msMatchesSelector||e.Element.prototype.oMatchesSelector||e.Element.prototype.webkitMatchesSelector||function(t){for(var i=(this.document||this.ownerDocument).querySelectorAll(t),r=i.length;--r>=0&&i.item(r)!==this;);return r>-1})}function js(){let e=this;if(e.webqit||(e.webqit={}),e.webqit.realdom)return e.webqit.realdom;e.webqit.realdom={},qs.call(e),e.webqit.realdom.meta=(...i)=>va.call(e,...i),e.webqit.realdom.ready=(...i)=>sr.call(e,...i),e.webqit.realdom.realtime=(i,r="dom")=>{if(r==="dom")return new Ue(i,e);if(r==="attr")return new Dt(i,e)};let t=new Be(e);return e.webqit.realdom.schedule=(i,...r)=>t[`on${i}`](...r),e.webqit.realdom.synthesizeWhile=(...i)=>t.synthesizeWhile(...i),e.webqit.realdom}function sr(...e){let t="interactive",i;ie(e[0])?(t=e[0],F(e[1])&&(i=e[1])):F(e[0])&&(i=e[0]);let r={interactive:["interactive","complete"],complete:["complete"]};if(!r[t])throw new Error(`Invalid ready-state timing: ${t}.`);let s=this;if(!i)return s.webqit.realdom.readyStatePromises||(s.webqit.realdom.readyStatePromises={interactive:new Promise(n=>sr.call(this,"interactive",n)),complete:new Promise(n=>sr.call(this,"complete",n))}),s.webqit.realdom.readyStatePromises[t];if(r[t].includes(s.document.readyState))return i(s);s.webqit.realdom.readyStateCallbacks||(s.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},s.document.addEventListener("readystatechange",()=>{let n=s.document.readyState;for(let a of s.webqit.realdom.readyStateCallbacks[n].splice(0))a(s)},!1)),s.webqit.realdom.readyStateCallbacks[t].push(i)}function va(e){let t=this,i={},r;return(r=t.document.querySelector(`meta[name="${e}"]`))&&(i=(r.content||"").split(";").filter(s=>s).reduce((s,n)=>{let a=n.split("=").map(o=>o.trim());return er(s,a[0].split("."),a[1]==="true"?!0:a[1]==="false"?!1:at(a[1])?parseInt(a[1]):a[1]),s},{})),{get name(){return e},get content(){return r.content},json(){return JSON.parse(JSON.stringify(i))}}}function fi(e,t){return typeof e!="string"?e:e.replace(/\w\S*/g,function(i){return i.charAt(0).toUpperCase()+(typeof t!==void 0&&t?i.substr(1).toLowerCase():i.substr(1))})}var A=(...e)=>K("oohtml",...e),U={};function rt(e,t,i){let r=this,s=js.call(r);U.window=r,r.webqitConfig||(r.webqitConfig=s.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let n=e.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[n]){r.webqit.oohtml.configs[n]={};let a=r.webqit.oohtml.configs[n];be(2,a,i,t,s.meta(e).json()),r.webqitConfig.prefix&&Object.keys(a).forEach(o=>{Object.keys(a[o]).forEach(u=>{o==="api"&&typeof a[o][u]=="string"?a[o][u]=`${r.webqitConfig.prefix}${fi(a[o][u])}`:["attr","elements"].includes(o)&&a[o][u]?.startsWith("data-")===!1&&(a[o][u]=`${r.webqitConfig.prefix}-${a[o][u]}`)})})}return{config:r.webqit.oohtml.configs[n],realdom:s,window:r}}function ar(e,t){return K(e,"internalAttrInteractions").get(t)}function Hs(e,t,i){let r=K(e,"internalAttrInteractions").get(t);K(e,"internalAttrInteractions").set(t,!0);let s=i();return K(e,"internalAttrInteractions").set(t,r),s}function Tt(e,t){return[...e].reduce(([i,r,s],n)=>!i&&r===0&&(Array.isArray(t)?t:[t]).includes(n)?[i,r,[""].concat(s)]:(!i&&["(","[","{"].includes(n)&&!s[0].endsWith("\\")&&r++,!i&&[")","]","}"].includes(n)&&!s[0].endsWith("\\")&&r--,['"',"'","`"].includes(n)&&!s[0].endsWith("\\")&&(i=i===n?null:i||n),s[0]+=n,[i,r,s]),[null,0,[""]])[2].reverse()}var Ea=()=>(0|Math.random()*9e6).toString(36),nr=new Map;function Yt(e){let t;return(t=nr.get(e))||(t=Ea(),nr.set(e,t)),t}function pi(e){let t;return nr.forEach((i,r)=>{i===e&&(t=r)}),t}function di(){let{window:e}=U,{webqit:t}=e;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class i extends e.Event{constructor(...s){let n=s.pop();if(typeof n!="function")throw new Error("Callback must be provided.");let a=s.pop();if(!a?.kind)throw new Error('"options.kind" must be specified.');let o=["contextrequest","contextclaim"],u=s.pop()||o[0];if(!o.includes(u))throw new Error(`Invalid event type. Must be one of: ${o.join(",")}`);let{kind:c,detail:l,targetContext:f,live:p,signal:m,diff:g,...v}=a;super(u,{...v,bubbles:v.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>n}),Object.defineProperty(this,"kind",{get:()=>c}),Object.defineProperty(this,"targetContext",{get:()=>f}),Object.defineProperty(this,"detail",{get:()=>l}),Object.defineProperty(this,"live",{get:()=>p}),Object.defineProperty(this,"signal",{get:()=>m}),Object.defineProperty(this,"diff",{get:()=>g}),Object.defineProperty(this,"options",{get:()=>v}),Object.defineProperty(this,"meta",{value:{}})}get target(){return super.target||this.meta.target}get answered(){return this.meta.answered||!1}respondWith(s){if(this.meta.answered=!0,this.diff){if("_prevValue"in this&&this._prevValue===s)return;Object.defineProperty(this,"_prevValue",{value:s,configurable:!0})}return this.callback(s)}}return t.DOMContextRequestEvent=i,i}var Jt=class extends AbortController{constructor(t){super(),t(i=>{let{window:{webqit:{Observer:r}}}=U;r.defineProperty(this,"value",{value:i,configurable:!0,enumerable:!0})},this)}};var Zt=class extends Error{};var Vt=class{static instance(t){return A(t).get("contexts::instance")||new this(t)}constructor(t){A(t).get("contexts::instance")?.dispose(),A(t).set("contexts::instance",this);let i={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>i})}[Symbol.iterator](){return this["#"].contexts[Symbol.iterator]()}get length(){return this["#"].contexts.size}find(...t){return[...this["#"].contexts].find(i=>typeof t[0]=="function"?t[0](i):i.constructor.kind===t[0]&&(!t[1]||i.detail===t[1]))}attach(t){if(!(t instanceof st))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new Zt(`Context of same kind "${t.constructor.kind}"${t.detail?` and detail "${t.detail}"`:""} already exists.`);this["#"].contexts.add(t),t.initialize(this["#"].host)}detach(t){t.dispose(this["#"].host),this["#"].contexts.delete(t)}request(...t){return new Jt((i,r)=>{typeof t[t.length-1]!="function"&&(t[t.length-1]?t.push(i):t[t.length-1]=i);let s;(s=t.find(a=>typeof a=="object"&&a))&&s.live&&(s.signal&&s.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(s)]={...s,signal:r.signal});let n=new(di())(...t);this["#"].host.dispatchEvent(n)})}};var or=class{static createRequest(){return{kind:this.kind}}constructor(t=null){Object.defineProperty(this,"detail",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get configs(){let{window:{webqit:{oohtml:{configs:t}}}}=U;return t}get name(){return[U.window.Document,U.window.ShadowRoot].some(t=>this.host instanceof t)?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(!(t.detail instanceof or)||t.target===this.host)return;let i=new Set;if(this.subscriptions.forEach(r=>{!t.target.contains(r.target)||!t.detail.matchEvent(r)||(this.subscriptions.delete(r),this.unsubscribed(r),i.add(r))}),i.size)return t.respondWith(i)}if(t.type==="contextrequest")return this.matchEvent(t)?(t.live&&(this.subscriptions.add(t),this.subscribed(t),t.signal?.addEventListener("abort",()=>{this.subscriptions.delete(t),this.unsubscribed(t)})),t.stopPropagation(),this.handle(t)):void 0}}initialize(t){this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this);let{value:i}=Vt.instance(t).request("contextclaim",{kind:this.constructor.kind,detail:this});return i?.forEach(r=>{this.subscriptions.add(r),this.subscribed(r),this.handle(r)}),this}dispose(t){return this.disposed=!0,t.removeEventListener("contextrequest",this),t.removeEventListener("contextclaim",this),this.subscriptions.forEach(i=>{this.subscriptions.delete(i),this.unsubscribed(i);let{target:r}=i;i.meta.answered=!1,r.dispatchEvent(i)}),this}},st=or;G(st,"kind");var pe=class extends st{static createRequest(t=null){let i=super.createRequest();if(t?.startsWith("@")){let[r,...s]=s.slice(1).split("/").map(n=>n.trim());i.targetContext=r,i.detail=s.join("/")}else i.detail=t;return i}get namespaceObj(){return this.host[this.configs.NAMESPACED_HTML.api.namespace]}handle(t){let{window:{webqit:{Observer:i}}}=U;if(t.meta.controller?.abort(),!(t.detail||"").trim())return t.respondWith(i.unproxy(this.namespaceObj));let r=(t.detail||"").split("/").map(s=>s.trim()).filter(s=>s);if(!r.length)return t.respondWith();r=r.join(`/${this.configs.NAMESPACED_HTML.api.namespace}/`)?.split("/")||[],t.meta.controller=i.reduce(this.namespaceObj,r,i.get,s=>{this.disposed||t.respondWith(s.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};G(pe,"kind","namespace");function ur(e={}){let{config:t,window:i}=rt.call(this,"namespaced-html",e,{attr:{namespace:"namespace",lid:"id"},api:{namespace:"namespace"},tokens:{lidrefPrefix:"~",lidrefSeparator:":"},target:{className:":target",eventName:":target",scrolling:!0}});t.lidSelector=`[${i.CSS.escape(t.attr.lid)}]`,t.namespaceSelector=`[${i.CSS.escape(t.attr.namespace)}]`,i.webqit.DOMNamingContext=pe,Ca.call(i,t),ka.call(i,t)}function Us(e){let{lidrefPrefix:t,lidrefSeparator:i}=e.tokens;return{escape(r,s=1){return[...r].map(n=>/\w/.test(n)?n:s===2?`\\\\${n}`:`\\${n}`).join("")},lidrefPrefix(r=0){return r?this.escape(t,r):t},lidrefSeparator(r=0){return r?this.escape(i,r):i},isUuid(r,s=0){return r.startsWith(this.lidrefPrefix(s))&&r.includes(this.lidrefSeparator(s))},toUuid(r,s,n=0){return r.endsWith("-root")?s:`${this.lidrefPrefix(n)}${r}${this.lidrefSeparator(n)}${s}`},uuidToId(r,s=0){return this.isUuid(r)?r.split(this.lidrefSeparator(s))[1]:r},uuidToLidref(r,s=0){return this.isUuid(r)?`${this.lidrefPrefix(s)}${r.split(this.lidrefSeparator(s))[1]}`:r}}}function cr(e,t,i=null,r=0){let s=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:n}}}}=s,a=Us(n),o=new RegExp(`${i?":scope|":""}#(${a.lidrefPrefix(r+1)})?([\\w]+${a.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[u,c]=Tt(e,",").reduce(([f,p],m)=>{let g,v;return m=m.replace(o,(E,x,w,C,b)=>{if(g||(g=[...m.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),g.some(O=>b>O.index&&b+E.length<O.index+O[0].length))return E;if(E===":scope")return v=!0,i;let y=x&&!w;if(x&&w)return`#${a.escape(E.replace("#",""),1)}`;if(y&&n.attr.lid==="id"&&t&&!t.endsWith("-root"))return`#${a.toUuid(t,C,1)}`;let S;return n.attr.lid==="id"?S=`:is(#${C},[id^="${a.lidrefPrefix(r)}"][id$="${a.lidrefSeparator(r)}${C}"])`:S=`:is(#${C},[${s.CSS.escape(n.attr.lid)}="${C}"])`,y?`:is(${S}):not(${i?i+" ":""}${n.namespaceSelector} *)`:S}),v?[f,p.concat(m)]:[f.concat(m),p]},[[],[]]),l;return i&&u.length?l=[u.length>1?`${i} :is(${u.join(", ")})`:`${i} ${u[0]}`,c.join(", ")].filter(f=>f).join(", "):l=[...u,...c].join(", "),l}function mi(e){let t=this;if(!A(e).has("namespace")){let i=Object.create(null);A(e).set("namespace",i);let r=[t.Document,t.ShadowRoot].some(s=>e instanceof s);Object.defineProperty(i,Symbol.toStringTag,{get(){return r?"RootNamespaceRegistry":"NamespaceRegistry"}})}return A(e).get("namespace")}function de(e,t=!1){let i=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=i,s=[i.Document,i.ShadowRoot].some(n=>e instanceof n);return mi.call(i,s?e:(t?e.parentNode:e)?.closest?.(r.namespaceSelector)||e.getRootNode())}function gi(e){let t=Object.prototype.toString.call(e)==="[object RootNamespaceRegistry]";return(pi(e)||Yt(e))+(t?"-root":"")}function Ca(e){let t=this,{webqit:{Observer:i}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let s=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(e.api.namespace in r)throw new Error(`The ${s} prototype already has a "${e.api.namespace}" API!`);Object.defineProperty(r,e.api.namespace,{get:function(){return i.proxy(mi.call(t,this))}})})}function ka(e){let t=this,{webqit:{Observer:i,realdom:r,oohtml:{configs:s},DOMNamingContext:n}}=t,a=["aria-owns","aria-controls","aria-labelledby","aria-describedby","aria-flowto"],o=["for","list","form","aria-activedescendant","aria-details","aria-errormessage"],u=[e.attr.lid,...a,...o],c={id:"id",for:"htmlFor","aria-owns":"ariaOwns","aria-controls":"ariaControls","aria-labelledby":"ariaLabelledBy","aria-describedby":"ariaDescribedBy","aria-flowto":"ariaFlowto","aria-activedescendant":"ariaActiveDescendant","aria-details":"ariaDetails","aria-errormessage":"ariaErrorMessage"},l=Us(e),f=(y,_,S)=>{if(!ar(y,_)&&A(y,"attrOriginals").has(_))return A(y,"attrOriginals").get(_);let O=S();return ar(y,_)?O:O&&O.split(" ").map(P=>(P=P.trim())&&(_===e.attr.lid?l.uuidToId:l.uuidToLidref).call(l,P)).join(" ")},p=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...p,value(y){return this.querySelector(`#${y}`)}});for(let y of["querySelector","querySelectorAll"])for(nodeApi of[t.Document,t.Element]){let _=Object.getOwnPropertyDescriptor(nodeApi.prototype,y);Object.defineProperty(nodeApi.prototype,y,{..._,value(S){return _.value.call(this,cr.call(t,S,gi(mi.call(t,this))))}})}let m=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...m,value(y){let _=()=>m.value.call(this,y);return u.includes(y)&&!A(this,"lock").get(y)?f(this,y,_):_()}});let g=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...g,get(){let y=()=>g.get.call(this);return u.includes(this.name)?f(this.ownerElement,this.name,y):y()}});let v=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...v,get(){let y=()=>v.get.call(this);return this instanceof t.Attr&&u.includes(this.name)?f(this.ownerElement,this.name,y):y()}});for(let y of u){if(!(y in c))continue;let _=y==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:[t.Element];for(let S of _){let O=Object.getOwnPropertyDescriptor(S.prototype,c[y]);!O||Object.defineProperty(S.prototype,c[y],{...O,get(){return f(this,y,()=>O.get.call(this,y))}})}}e.attr.lid!=="id"&&Object.defineProperty(t.Element.prototype,e.attr.lid,{configurable:!0,enumerable:!0,get(){return this.getAttribute(e.attr.lid)},set(y){return this.setAttribute(e.attr.lid,y)}});let E=(y,_,S,O)=>Hs(y,_,()=>(typeof S=="function"&&(S=S()),O(S))),x=(y,_,S,O=null)=>{E(y,_,S,P=>{let D=_===e.attr.lid,H=O||de.call(t,y,D),Q=gi(H);if(D){let X=l.uuidToId(P);if(i.get(H,X)!==y){let Y=l.toUuid(Q,X);Y!==P&&y.setAttribute("id",Y),i.set(H,X,y)}}else{A(y,"attrOriginals").set(_,P);let X=P.split(" ").map(Y=>(Y=Y.trim())&&l.isUuid(Y)?Y:l.toUuid(Q,Y)).join(" ");y.setAttribute(_,X),A(H).set("idrefs",A(H).get("idrefs")||new Set),A(H).get("idrefs").add(y)}})},w=(y,_,S,O=null)=>{E(y,_,S,P=>{let D=_===e.attr.lid,H=O||de.call(t,y,D);if(D){let Q=l.uuidToId(P);i.get(H,Q)===y&&i.deleteProperty(H,Q)}else{let Q=A(y,"attrOriginals").get(_);y.hasAttribute(_)&&y.setAttribute(_,Q),A(H).get("idrefs")?.delete(y)}})};r.realtime(t.document).query(e.namespaceSelector,y=>{let _=(S,O,P,D)=>{if(!S.hasAttribute(O))return;let H=()=>S.getAttribute(O);w(S,O,H,P),S.isConnected&&x(S,O,A(S,"attrOriginals").get(O)||H,D)};y.exits.forEach(S=>{if(S.isConnected){let D=mi.call(t,S);for(let H of new Set([...Object.values(D),...A(D).get("idrefs")||[]]))for(let Q of u)_(H,Q,D)}let O=S[s.CONTEXT_API.api.contexts],P=O.find(n.kind);P&&O.detach(P)}),y.entrants.forEach(S=>{let O,P=de.call(t,S,!0);for(let H of new Set([...Object.values(P),...A(P).get("idrefs")||[]]))if((O=de.call(t,H,!0))!==P)for(let Q of u)_(H,Q,P,O);let D=S[s.CONTEXT_API.api.contexts];D.find(n.kind)||D.attach(new n)})},{id:"namespace-html:namespace",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(`[${u.map(y=>t.CSS.escape(y)).join("],[")}]`,y=>{let _={forID:new Map,forOther:new Map};for(let S of u){let O=S===e.attr.lid?_.forID:_.forOther;y.exits.forEach(P=>{if(!P.hasAttribute(S))return;let D=O.get(P);typeof D>"u"&&(D=(S===e.attr.lid?P.parentNode:P)?.closest?.(e.namespaceSelector)||P.getRootNode().host,O.set(P,D)),!(D&&!D.isConnected)&&w(P,S,()=>P.getAttribute(S))}),y.entrants.forEach(P=>{!P.hasAttribute(S)||x(P,S,()=>P.getAttribute(S))})}_.forID.clear(),_.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(u,y=>{for(let _ of y)_.oldValue&&w(_.target,_.name,_.oldValue),_.value&&x(_.target,_.name,_.value)},{id:"namespace-html:attr(attrs)",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let C,b=()=>{if(!t.location.hash?.startsWith(`#${l.lidrefPrefix()}`))return;let y=t.location.hash?.substring(`#${l.lidrefPrefix()}`.length).split("/").map(S=>S.trim()).filter(S=>S)||[],_=y.reduce((S,O)=>S&&S[e.api.namespace][O],t.document);C&&e.target.className&&C.classList.toggle(e.target.className,!1),_&&_!==t.document&&(e.target.className&&_.classList.toggle(e.target.className,!0),e.target.eventName&&_.dispatchEvent(new t.CustomEvent(e.target.eventName)),e.target.scrolling&&y.length>1&&_.scrollIntoView(),C=_)};t.addEventListener("hashchange",b),r.ready(b)}function lr({advanced:e={},...t}){let{config:i,window:r}=rt.call(this,"scoped-js",t,{script:{retention:"retain",mimeTypes:"module|text/javascript|application/javascript",timing:"auto"},api:{scripts:"scripts"},advanced:le(e)}),s=Array.isArray(i.script.mimeTypes)?i.script.mimeTypes:i.script.mimeTypes.split("|").filter(n=>n);i.scriptSelector=s.map(n=>`script[type="${r.CSS.escape(n)}"]:not([oohtmlignore])`).concat("script:not([type])").join(","),r.webqit.oohtml.Script={compileCache:[new Map,new Map],execute:Pa.bind(r,i)},Aa.call(r,i),Ia.call(r,i)}function Aa(e){let t=this,i=new Map;if(e.api.scripts in t.Element.prototype)throw new Error(`The "Element" class already has a "${e.api.scripts}" property!`);[t.ShadowRoot.prototype,t.Element.prototype].forEach(r=>{Object.defineProperty(r,e.api.scripts,{get:function(){return i.has(this)||i.set(this,[]),i.get(this)}})}),Object.defineProperties(t.HTMLScriptElement.prototype,{scoped:{configurable:!0,get(){return this.hasAttribute("scoped")},set(r){this.toggleAttribute("scoped",r)}},quantum:{configurable:!0,get(){return this.hasAttribute("quantum")},set(r){this.toggleAttribute("quantum",r)}}})}async function Pa(e,t){let i=this,{realdom:r}=i.webqit,s=pi(t);if(!s)throw new Error("Argument must be a valid exec hash.");let{script:n,compiledScript:a,thisContext:o}=s;e.script.retention==="dispose"?n.remove():e.script.retention==="hidden"?n.textContent='"source hidden"':n.textContent=await a.toString();let u=n.scoped?o:n.getRootNode();A(u).has("scriptEnv")||A(u).set("scriptEnv",Object.create(null));let c=await(await a.bind(o,A(u).get("scriptEnv"))).execute();n.quantum&&Object.defineProperty(n,"state",{value:c}),r.realtime(i.document).observe(n,()=>{n.quantum&&c.dispose(),o instanceof i.Element&&o[e.api.scripts]?.splice(o[e.api.scripts].indexOf(n,1))},{id:"scoped-js:script-exits",subtree:"cross-roots",timing:"sync",generation:"exits"})}function Ia(e){let t=this,{webqit:{oohtml:i,realdom:r}}=t;t.HTMLScriptElement.supports||(t.HTMLScriptElement.supports=n=>["text/javascript","application/javascript"].includes(n));let s=new WeakSet;r.realtime(t.document).query(e.scriptSelector,n=>{n.entrants.forEach(a=>{if(s.has(a))return;let o=Ws.call(t,e,a);if(!o)return;s.add(a);let u=a.scoped?a.parentNode||n.target:a.type==="module"?void 0:t;a.scoped&&u[e.api.scripts].push(a);let c=Yt({script:a,compiledScript:o,thisContext:u});n.type==="query"||a.type&&!t.HTMLScriptElement.supports(a.type)||a.getAttribute("data-handling")==="manual"||e.script.timing==="manual"?i.Script.execute(c):a.textContent=`webqit.oohtml.Script.execute( '${c}' );`})},{id:"scoped-js:script-entries",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants",eventDetails:!0})}function Ws(e,t){let i=this,{webqit:{oohtml:r,QuantumScript:s,AsyncQuantumScript:n,QuantumModule:a}}=i,o=(t._=t.textContent.trim())&&t._.startsWith("/*@oohtml*/if(false){")&&t._.endsWith("}/*@oohtml*/")?t._.slice(21,-12):t.textContent;if(!o.trim().length)return;let u=Yt(o),c=r.Script.compileCache[t.quantum?0:1],l;if(!(l=c.get(u))){let{parserParams:f,compilerParams:p,runtimeParams:m}=e.advanced;l=new(t.type==="module"?a:s||n)(o,{exportNamespace:`#${t.id}`,fileName:`${i.document.url?.split("#")?.[0]||""}#${t.id}`,parserParams:{...f,executionMode:t.quantum&&"QuantumProgram"||"RegularProgram"},compilerParams:p,runtimeParams:m}),c.set(u,l)}return l}function zs(e){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:i}}}}=t;[...e?.querySelectorAll(i.scriptSelector)||[]].forEach(r=>{Ws.call(t,i,r)})}function pr(e={}){let{config:t,window:i}=rt.call(this,"data-binding",e,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},advanced:le({runtimeParams:{spec:{handler:s=>{}}}})});({CONTEXT_API:t.CONTEXT_API,BINDINGS_API:t.BINDINGS_API,HTML_IMPORTS:t.HTML_IMPORTS}=i.webqit.oohtml.configs),t.attrSelector=`[${i.CSS.escape(t.attr.render)}]`;let r=(s,n)=>{let a=`starts-with(., "${s}")`,o=`substring(., string-length(.) - string-length("${n}") + 1) = "${n}"`;return`${a} and ${o}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,Oa.call(i,t)}function Oa(e){let t=this,{webqit:{realdom:i}}=t;i.realtime(t.document).query(e.attrSelector,r=>{Qs.call(this,...r.exits),setTimeout(()=>{Na.call(t,e,...r.entrants)},0)},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),i.realtime(t.document).query(`(${e.discreteBindingsSelector})`,r=>{setTimeout(()=>{Qs.call(this,...r.exits),Ta.call(t,e,...r.entrants)},0)},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function Gs(e,t){let{webqit:{realdom:i,Observer:r,DOMBindingsContext:s}}=this;if(A(t).has("data-binding"))return A(t).get("data-binding");let n=Object.create(null),a=new AbortController;n.$exec__=(u,c,...l)=>{(()=>{try{u[c](...l)}catch(p){throw new Error(`Error executing "${c}()": ${p.message} at ${p.cause}`)}})()},n.$assign__=(u,c,l)=>{(()=>{try{u[c]=l}catch(p){throw new Error(`Error executing "${c} = ${l}": ${p.message} at ${p.cause}`)}})()},r.intercept(n,{get:(u,c,l)=>{if(!(u.key in n)){let f={...s.createRequest(u.key),live:!0,signal:a.signal};t[e.CONTEXT_API.api.contexts].request(f,p=>{r.set(n,u.key,p)})}return l(n[u.key]??(u.key in globalThis?globalThis[u.key]:void 0))},has:(u,c,l)=>l(!0)});let o={scope:n,abortController:a,bindings:new Map};return A(t).set("data-binding",o),o}function Qs(...e){for(let t of e){let i=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:s}=A(i).get("data-binding")||{};if(!r?.has(t))return;r.get(t).state.dispose(),r.get(t).signals?.forEach(n=>n.abort()),r.delete(t),r.size||(s.abort(),A(i).delete("data-binding"))}}function Ks(e,t){let i=e.tokens.tagStart.split("").map(c=>`\\${c}`).join(""),r=e.tokens.tagEnd.split("").map(c=>`\\${c}`).join(""),s=e.tokens.stateStart.split("").map(c=>c===" "?"(?:\\s+)?":`\\${c}`).join(""),n=e.tokens.stateEnd.split("").map(c=>`\\${c}`).join(""),a=`^${i}(.*?)(?:${s}(\\d+)${n}(?:\\s+)?)?${r}$`,[,o,u]=t.match(new RegExp(a));return{raw:t,expr:o,span:parseInt(u??0)}}async function Ta(e,...t){let i=this,r=t.reduce((s,n)=>{if(n.isBound)return s;let a=Ks(e,n.nodeValue),o=n;if(a.span){if(o=n.nextSibling,o?.nodeName!=="#text"||o.nodeValue.length<a.span)return s;o.nodeValue.length>a.span&&o.splitText(a.span)}else o=n.ownerDocument.createTextNode(""),n.after(o);o.isBound=!0;let u=n;return i.webqit.env!=="server"&&(u.remove(),u=null),s.concat({textNode:o,template:a,anchorNode:u})},[]);for(let{textNode:s,template:n,anchorNode:a}of r){let o=Xs.call(i,e,n.expr),{scope:u,bindings:c}=Gs.call(this,e,s.parentNode);Object.defineProperty(s,"$oohtml_internal_databinding_anchorNode",{value:a,configurable:!0});try{c.set(s,{state:await(await o.bind(s,u)).execute()})}catch(l){console.log(l)}}}var hr=new Map;function Xs(e,t){if(hr.has(t))return hr.get(t);let i=`let content = ((${t}) ?? '') + '';`;i+="$assign__(this, 'nodeValue', content);",i+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${e.tokens.tagStart}${me(t)}${e.tokens.stateStart}" + content.length + "${e.tokens.stateEnd} ${e.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:r}}=this,{parserParams:s,compilerParams:n,runtimeParams:a}=e.advanced,o=new r(i,{parserParams:s,compilerParams:n,runtimeParams:a});return hr.set(t,o),o}async function Na(e,...t){for(let i of t){let r=Ys.call(this,e,i.getAttribute(e.attr.render)),{scope:s,bindings:n}=Gs.call(this,e,i),a=[];Object.defineProperty(i,"$oohtml_internal_databinding_signals",{value:a,configurable:!0});try{n.set(i,{signals:a,state:await(await r.bind(i,s)).execute()})}catch(o){console.log(o)}}}var fr=new Map;function Ys(e,t){if(fr.has(t))return fr.get(t);let i={},r=-1,s=Tt(t,";").map(l=>{let[f,p]=Tt(l,":").map(x=>x.trim()),m=f[0],g=f.slice(1).trim(),v=`(${p})`,E=`(${v} ?? '')`;if(m==="&")return g.startsWith("--")?`$exec__(this.style, 'setProperty', "${me(g)}", ${E});`:`$assign__(this.style, "${me(g)}", ${E});`;if(m==="%")return`$exec__(this.classList, 'toggle', "${me(g)}", !!${v});`;if(m==="~")return g.startsWith("?")?`$exec__(this, 'toggleAttribute', "${me(g.substring(1).trim())}", !!${v});`:`$exec__(this, 'setAttribute', "${me(g)}", ${E});`;if(m==="#"){if(i[g])throw new Error(`Duplicate binding: ${f}.`);if(i[g]=!0,g==="text")return`$assign__(this, 'textContent', ${E});`;if(g==="html")return`$exec__(this, 'setHTMLUnsafe', ${E});`;if(g==="items"){let[x,w]=Tt(p,"/");if(!w)throw new Error(`Invalid ${m}items spec: ${l}; no import specifier.`);let[C,b,y,_]=x.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!C)throw new Error(`Invalid ${m}items spec: ${l}.`);if(b.startsWith("(")?b=b.trim().slice(1,-1).split(",").map(O=>O.trim()):b=[b],b.length>(y==="in"?3:2))throw new Error(`Invalid ${m}items spec: ${l}.`);let S=y==="in"?b[2]:b[1]||"$index__";return`
|
|
16
16
|
let $iteratee__ = ${_};
|
|
17
17
|
let $import__ = this.${e.HTML_IMPORTS.api.import}( ${w.trim()}, true );
|
|
18
18
|
this.$oohtml_internal_databinding_signals?.push( $import__ );
|