@webqit/oohtml 2.1.14 → 2.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/scoped-js.js CHANGED
@@ -23,5 +23,5 @@ ${p}
23
23
  `)}
24
24
  ]);`,r.join(`
25
25
  `)]}parseImportStmt(e){let r=o=>{let s=/^[`'"]/.exec(o);return s&&o.substring(1,o.lastIndexOf(s[0]))},t={items:[{id:""}]},i=e.replace("import","").trim();return(t.url=r(i))||this.tokenize(i,(o,s,f,u,l,c)=>{if(["start-quote","ongoing-quote","end-quote","char"].includes(s)){if(t.url)return;if(!u.openQuote){let a=i.substring(l);if(f===","){t.items.unshift({id:""});return}if(a.startsWith(" as "))return t.items[0].alias="",3;if(a.startsWith(" from "))return t.url=r(a.replace("from","").trim()),a.length}"alias"in t.items[0]?t.items[0].alias+=f:(t.items[0].id+=f,u.openEnclosures.length&&(t.items[0].enclosed=!0))}}),t.items=t.items.map(o=>({id:o.id&&!o.alias&&!o.enclosed?"default":o.id.trim(),alias:o.alias?o.alias.trim():o.id.trim()})).filter(o=>o.id).reverse(),t}tokenize(e,r){let t=e.length-1;return[...e].reduce(([i,o,s],f,u)=>{if(s)return i[0]+=f,[i,o,--s];let l;if(o.openQuote||o.openComment)return f===o.openQuote?(o.openQuote=null,l=r(i,"end-quote",f,o,u,u===t)):o.openQuote?l=r(i,"ongoing-quote",f,o,u,u===t):o.openComment&&(o.openComment==="//"&&f===`
26
- `||o.openComment==="/*"&&i[0].substr(-1)==="*"&&f==="/")&&(o.openComment=null,l=r(i,"end-comment",f,o,u,u===t)),l!==!1&&(i[0]+=f),[i,o,typeof l=="number"?l:s];let c;return(c=["()","{}","[]"].filter(a=>f===a[0])[0])?(l=r(i,"start-enclosure",f,o,u,u===t),o.openEnclosures.unshift(c)):o.openEnclosures.length&&f===o.openEnclosures[0][1]?(o.openEnclosures.shift(),l=r(i,"end-enclosure",f,o,u,u===t)):['"',"'","`"].includes(f)?(l=r(i,"start-quote",f,o,u,u===t),o.openQuote=f):!o.openComment&&["/*","//"].includes(e.substr(u,2))?(l=r(i,"start-comment",f,o,u,u===t),o.openComment=e.substr(u,2)):l=r(i,"char",f,o,u,u===t),l!==!1&&(i[0]+=f),[i,o,typeof l=="number"?l:s]},[[""],{openEnclosures:[]},0])}};we(W,"hashTable",new Map),we(W,"uniqId",()=>(0|Math.random()*9e6).toString(36));function oe(n,e,r={},t={}){e=A(e).slice();for(var i=n;!j(i)&&!ee(i)&&e.length;){var o=e.shift();if(!(r.get?r.get(i,o):O(i)?o in i:i[o])){t.exists=!1;return}i=r.get?r.get(i,o):i[o]}return t.exists=!0,i}function Le(n,e,r,t={},i={}){let o=(c,a,p)=>i.set?i.set(c,a,p):(E(e[f])&&b(c)?c.push(p):c[a]=p,!0);e=A(e);for(var s=n,f=0;f<e.length;f++)if(f<e.length-1){if(!s||!O(s)&&!v(s))return!1;var u=oe(s,e[f],i);if(!O(u)){if(i.buildTree===!1)return!1;u=v(i.buildTree)?i.buildTree(f):E(e[f+1])?[]:{};var l=o(s,e[f],u);if(!l)return!1}s=u}else return o(s,e[f],r)}var Ke=n=>class{constructor(r=!0){Object.defineProperty(this,"window",{value:n}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),this.async=r,this.window.requestAnimationFrame?this._run():this.async=!1}_run(){this.window.requestAnimationFrame(()=>{this.readCallbacks.forEach(r=>{r()||this.readCallbacks.delete(r)}),this.writeCallbacks.forEach(r=>{r()||this.writeCallbacks.delete(r)}),this._run()})}onread(r,t=!1){if(t)return new Promise((i,o)=>{this.async===!1?r(i,o):this.readCallbacks.add(()=>{r(i,o)})});this.async===!1?r():this.readCallbacks.add(r)}onwrite(r,t=!1){if(t)return new Promise((i,o)=>{this.async===!1?r(i,o):this.writeCallbacks.add(()=>{r(i,o)})});this.async===!1?r():this.writeCallbacks.add(r)}cycle(r,t,i){this.onread(()=>{let o=r(i),s=f=>{f!==void 0&&this.onwrite(()=>{let u=t(f,i),l=c=>{c!==void 0&&this.cycle(r,t,c)};u instanceof Promise?u.then(l):l(u)})};o instanceof Promise?o.then(s):s(o)})}};var G=class{constructor(e,r,t){this.context=e,this.namespace=r,this.window=e.defaultView||e.ownerDocument?.defaultView||t,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(e){return v(e[0])?e=[[],...e]:x(e[0])&&e.length===1?e=[[],void 0,e[0]]:x(e[1])&&e.length===2?e=[A(e[0],!1),void 0,e[1]]:e[0]=A(e[0],!1),e}registry(...e){return D("dom.realtime",this.window,this.namespace,...e)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(e,r,t){let{window:i}=this,o=Array.isArray(r)?r:[r],s=new Set;for(let[f,u]of this.registry(e))for(let[l,c]of u){let a=o.filter(p=>l.contains(p.target)?f==="subtree"||p.target===l:!1);if(!!a.length){Array.isArray(r)||(a=a[0]);for(let p of c)s.add([p,a,l])}}for(let[f,u,l]of s)t.call(this,f,u,l)}disconnectables(e,...r){let t={disconnect(){r.forEach(i=>i&&v(i.disconnect)&&i.disconnect()||v(i)&&i()||x(i)&&(i.disconnected=!0))}};return e&&e.addEventListener("abort",()=>t.disconnect()),t}};var R=class extends G{constructor(e,...r){super(e,"attr",...r)}get(e,r=void 0,t={}){let i=typeof e=="string";[e=[],r=void 0,t={}]=this.resolveArgs(arguments);let{context:o}=this,s=nt(o,e),f=i?s[0]:s;if(!r)return f;let u=r&&t.lifecycleSignals&&this.createSignalGenerator(),l=u?.generate()||{};if(r(f,l,o),t.live){u&&(t={...t,signalGenerator:u});let c=this.observe(i?e[0]:e,r,{newValue:!0,...t});return this.disconnectables(t.signal,c)}}observe(e,r,t={}){let i=typeof e=="string";if([e=[],r,t={}]=this.resolveArgs(arguments),["sync","intercept"].includes(t.timing))return this.observeSync(i?e[0]:e,r,t);if(t.timing&&t.timing!=="async")throw new Error(`Timing option "${t.timing}" invalid.`);let{context:o,window:s,webqit:f}=this;t.eventDetails&&!f.dom.attrInterceptionHooks?.intercepting&&tt.call(s,"intercept",()=>{});let u=new s.MutationObserver(p=>{p=rt(p).map(m=>it.call(s,m)),et.call(s,a,p,o)}),l={attributes:!0,attributeOldValue:t.oldValue,subtree:t.subtree};e.length&&(l.attributeFilter=e),u.observe(o,l);let c=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),a={context:o,filter:e,callback:r,params:t,atomics:new Map,originalFilterIsString:i,signalGenerator:c,disconnectable:u};return this.disconnectables(t.signal,u,c)}observeSync(e,r,t={}){let i=typeof e=="string";[e,r,t={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(t.timing&&!["sync","intercept"].includes(t.timing))throw new Error(`Timing option "${t.timing}" invalid.`);let f=t.timing==="intercept"?"intercept":"sync",u=t.subtree?"subtree":"children";this.registry(f).size||tt.call(s,f,d=>{this.forEachMatchingContext(f,d,et)});let l={disconnect(){m.delete(a),m.size||p.delete(o)}},c=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),a={context:o,filter:e,callback:r,params:t,atomics:new Map,originalFilterIsString:i,signalGenerator:c,disconnectable:l},p=this.registry(f,u);p.has(o)||p.set(o,new Set);let m=p.get(o);return m.add(a),this.disconnectables(t.signal,l,c)}};function rt(n){return n.reduce((e,r,t)=>e[t-1]?.attributeName===r.attributeName?e:e.concat(r),[])}function et(n,e){let{context:r,filter:t,callback:i,params:o,atomics:s,originalFilterIsString:f,signalGenerator:u}=n;o.atomic&&!s.size&&(e=nt(r,t,e)),o.newValue===null&&o.oldValue===null||(e=e.map(a=>{let p;return!o.oldValue&&"oldValue"in a&&({oldValue:p,...a}=a),!o.newValue&&"value"in a?{value:p,...a}=a:o.newValue&&typeof a.value>"u"&&(a={...a,value:a.target.getAttribute(a.name)}),a})),o.atomic&&(e.forEach(a=>s.set(a.name,a)),e=Array.from(s.entries()).map(([,a])=>a));let l=f?e[0]:e,c=u?.generate()||{};i(l,c,r)}function nt(n,e,r=[]){let t={event:null,type:"attribute"};return e.length?e.map(o=>r.find(s=>s.name===o)||{target:n,name:o,value:n.getAttribute(o),...t}):Array.from(n.attributes).map(o=>r.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:o.nodeValue,...t})}function it({target:n,attributeName:e,value:r,oldValue:t}){let s=(this.webqit.dom.attrInterceptionRecords?.get(n)||{})[e]||"mutation";return{target:n,name:e,value:r,oldValue:t,type:"observation",event:s}}function tt(n,e){let r=this,{webqit:t,document:i,Element:o}=r;t.dom.attrInterceptionHooks||Object.defineProperty(t.dom,"attrInterceptionHooks",{value:new Map}),t.dom.attrInterceptionHooks.has(n)||t.dom.attrInterceptionHooks.set(n,new Set),t.dom.attrInterceptionHooks.get(n).add(e);let s=()=>t.dom.attrInterceptionHooks.get(n).delete(e);if(t.dom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),t.dom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(t.dom,"attrInterceptionRecords",{value:new Map});let f=(c,a)=>{t.dom.attrInterceptionRecords.has(c.target)||t.dom.attrInterceptionRecords.set(c.target,{});let p=t.dom.attrInterceptionRecords.get(c.target);clearTimeout(p[c.name]?.timeout),p[c.name]=c.event;let m=setTimeout(()=>{delete p[c.name]},0);Object.defineProperty(c.event,"timeout",{value:m,configurable:!0}),t.dom.attrInterceptionHooks.get("intercept")?.forEach(h=>h([c]));let d=a();return t.dom.attrInterceptionHooks.get("sync")?.forEach(h=>h([c])),d};new r.MutationObserver(c=>{c=rt(c).map(a=>it.call(r,a)).filter((a,p)=>!Array.isArray(a.event)),c.length&&(t.dom.attrInterceptionHooks.get("intercept")?.forEach(a=>a(c)),t.dom.attrInterceptionHooks.get("sync")?.forEach(a=>a(c)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let l=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(c=>{l[c]=o.prototype[c],o.prototype[c]=function(...a){let p,m=this.getAttribute(a[0]);["setAttribute","toggleAttribute"].includes(c)&&(p=a[1]),c==="toggleAttribute"&&p===void 0&&(p=m===null);let d={target:this,name:a[0],value:p,oldValue:m,type:"interception",event:[this,c]};return f(d,()=>l[c].call(this,...a))}}),s}var Y=class extends G{constructor(e,...r){super(e,"tree",...r)}attr(e,r=void 0,t={}){let{context:i,window:o}=this;return new R(i,o).get(...arguments)}query(e,r=void 0,t={}){[e,r=void 0,t={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=l=>(o.has(l)||o.set(l,{target:l,entrants:[],exits:[],type:"query",event:null}),o.get(l));if((!t.generation||t.generation==="entrants")&&(e.length?e.every(l=>typeof l=="string")&&(e=e.join(","))&&(t.subtree?i.querySelectorAll(e):[...i.children].filter(c=>c.matches(e))).forEach(c=>s(c.parentNode||i).entrants.push(c)):[...i.children].forEach(l=>s(i).entrants.push(l))),!r)return o;let f={disconnected:!1},u=r&&t.lifecycleSignals&&this.createSignalGenerator();for(let[,l]of o){if(f.disconnected)break;let c=u?.generate()||{};r(l,c,i)}if(t.live){u&&(t={...t,signalGenerator:u});let l=this.observe(e,r,t);return this.disconnectables(t.signal,f,l)}return this.disconnectables(t.signal,f,u)}children(e,r=void 0,t={}){return[e,r=void 0,t={}]=this.resolveArgs(arguments),this.query(e,r,{...t,subtree:!1})}subtree(e,r=void 0,t={}){return[e,r=void 0,t={}]=this.resolveArgs(arguments),this.query(e,r,{...t,subtree:!0})}observe(e,r,t={}){if([e,r,t={}]=this.resolveArgs(arguments),["sync","intercept"].includes(t.timing))return this.observeSync(e,r,t);if(t.timing&&t.timing!=="async")throw new Error(`Timing option "${t.timing}" invalid.`);let{context:i,window:o,webqit:s,document:f}=this;t.eventDetails&&(s.dom.domInterceptionRecordsAlwaysOn=!0),(f.readyState==="loading"||s.dom.domInterceptionRecordsAlwaysOn)&&!s.dom.domInterceptionHooks?.intercepting&&ut.call(o,"sync",()=>{});let u=new o.MutationObserver(a=>a.forEach(p=>{st.call(o,c,ft.call(o,p),i)}));u.observe(i,{childList:!0,subtree:t.subtree});let l=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),c={context:i,selectors:e,callback:r,params:t,signalGenerator:l,disconnectable:u};if(t.staticSensitivity){let a=ot.call(o,c);return this.disconnectables(t.signal,u,l,a)}return this.disconnectables(t.signal,u,l)}observeSync(e,r,t={}){[e,r,t={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(t.timing&&!["sync","intercept"].includes(t.timing))throw new Error(`Timing option "${t.timing}" invalid.`);let s=t.timing==="intercept"?"intercept":"sync",f=t.subtree?"subtree":"children";this.registry(s).size||ut.call(o,s,m=>{this.forEachMatchingContext(s,m,st)});let u={disconnect(){p.delete(c),p.size||a.delete(i)}},l=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),c={context:i,selectors:e,callback:r,params:t,signalGenerator:l,disconnectable:u},a=this.registry(s,f);a.has(i)||a.set(i,new Set);let p=a.get(i);if(p.add(c),t.staticSensitivity){let m=ot.call(o,c);return this.disconnectables(t.signal,u,l,m)}return this.disconnectables(t.signal,u,l)}};function ot(n){let e=this,{context:r,selectors:t,callback:i,params:o,signalGenerator:s}=n,f=c=>[...c.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(a=>a[1]);if(!(n.$attrs=t.filter(c=>typeof c=="string"&&c.includes("[")).reduce((c,a)=>c.concat(f(a)),[])).length)return;let u=new Set,l=new Set;return u.push=c=>(l.delete(c),u.add(c)),l.push=c=>(u.delete(c),l.add(c)),n.$deliveryCache={entrants:u,exits:l},new R(r,e).observe(n.$attrs,c=>{let a=new Map,p=h=>(a.has(h)||a.set(h,{target:h,entrants:[],exits:[],type:"static",event:null}),a.get(h)),m=new WeakMap,d=h=>(m.has(h)||m.set(h,t.some(g=>h.matches(g))),m.get(h));for(let h of c)["entrants","exits"].forEach(g=>{o.generation&&g!==o.generation||n.$deliveryCache[g].has(h.target)||(g==="entrants"?!d(h.target):d(h.target))||(n.$deliveryCache[g].push(h.target),p(h.target)[g].push(h.target),p(h.target).event=h.event)});for(let[,h]of a){let g=s?.generate()||{};i(h,g,r)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function st(n,e){let{context:r,selectors:t,callback:i,params:o,signalGenerator:s,$deliveryCache:f}=n,u={...e,entrants:[],exits:[]};if(["entrants","exits"].forEach(c=>{if(!(o.generation&&c!==o.generation)&&(t.length?u[c]=Nt(t,e[c],e.event!=="parse"):u[c]=[...e[c]],!!f))for(let a of u[c])f[c].push(a)}),!u.entrants.length&&!u.exits.length)return;let l=s?.generate()||{};i(u,l,r)}function Nt(n,e,r){e=Array.isArray(e)?e:[...e];let t=(i,o)=>{if(i=i.filter(s=>s.matches),typeof o=="string"){let s=i.filter(f=>f.matches(o));if(r&&(s=i.reduce((f,u)=>[...f,...u.querySelectorAll(o)],s)),s.length)return s}else if(i.includes(o)||r&&i.some(s=>s.contains(o)))return[o]};return e.$$searchCache||(e.$$searchCache=new Map),n.reduce((i,o)=>{let s;return e.$$searchCache.has(o)?s=e.$$searchCache.get(o):(s=t(e,o)||[],x(o)&&e.$$searchCache.set(o,s)),i.concat(s)},[])}function ft({target:n,addedNodes:e,removedNodes:r}){let t=this,i;return i=A(e).reduce((o,s)=>o||t.webqit.dom.domInterceptionRecords?.get(s),null),i=A(r).reduce((o,s)=>o||t.webqit.dom.domInterceptionRecords?.get(s),i),i=i||t.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:e,exits:r,type:"observation",event:i}}function ut(n,e){let r=this,{webqit:t,document:i,Node:o,Element:s,HTMLElement:f,HTMLTemplateElement:u,DocumentFragment:l}=r;t.dom.domInterceptionHooks||Object.defineProperty(t.dom,"domInterceptionHooks",{value:new Map}),t.dom.domInterceptionHooks.has(n)||t.dom.domInterceptionHooks.set(n,new Set),t.dom.domInterceptionHooks.get(n).add(e);let c=()=>t.dom.domInterceptionHooks.get(n).delete(e);if(t.dom.domInterceptionHooks?.intercepting)return c;console.warn("DOM mutation APIs are now being intercepted."),t.dom.domInterceptionHooks.intercepting=!0,Object.defineProperty(t.dom,"domInterceptionRecords",{value:new Map});let a=()=>!0,p=(d,h)=>{a()?d.entrants.concat(d.exits).forEach(y=>{clearTimeout(t.dom.domInterceptionRecords.get(y)?.timeout),t.dom.domInterceptionRecords.set(y,d.event);let w=setTimeout(()=>{t.dom.domInterceptionRecords.delete(y)},0);Object.defineProperty(d.event,"timeout",{value:w,configurable:!0})}):t.dom.domInterceptionRecords.clear(),t.dom.domInterceptionHooks.get("intercept")?.forEach(y=>y(d));let g=h();return t.dom.domInterceptionHooks.get("sync")?.forEach(y=>y(d)),g};if(a()){let d=new r.MutationObserver(h=>h.forEach(g=>{Array.isArray((g=ft.call(r,g)).event)||(t.dom.domInterceptionHooks.get("intercept")?.forEach(y=>y(g)),t.dom.domInterceptionHooks.get("sync")?.forEach(y=>y(g)))}));d.observe(i,{childList:!0,subtree:!0}),i.addEventListener("readystatechange",()=>!a()&&d.disconnect())}let m=Object.create(null);return["insertBefore","insertAdjacentElement","insertAdjacentHTML","setHTML","replaceChildren","replaceWith","remove","replaceChild","removeChild","before","after","append","prepend","appendChild"].forEach(d=>{let h=["insertBefore","replaceChild","removeChild","appendChild"].includes(d)?o:s;m[d]=h.prototype[d],m[d]&&(h.prototype[d]=function(...g){let y=()=>m[d].call(this,...g);if(!(this instanceof s||this instanceof l))return y();let w=[],_=[],P=this;["insertBefore"].includes(d)?_=[g[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(d)?(_=[g[1]],["beforebegin","afterend"].includes(g[0])&&(P=this.parentNode)):["setHTML","replaceChildren"].includes(d)?(w=[...this.childNodes],_=d==="replaceChildren"?[...g]:[g[0]]):["replaceWith","remove"].includes(d)?(w=[this],_=d==="replaceWith"?[...g]:[],P=this.parentNode):["replaceChild"].includes(d)?(w=[g[1]],_=[g[0]]):["removeChild"].includes(d)?w=[...g]:(_=[...g],["before","after"].includes(d)&&(P=this.parentNode));let B=d;if(["insertAdjacentHTML","setHTML"].includes(d)){let $=this.nodeName;if(d==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(g[0])){if(!this.parentNode)return m[d].call(this,...g);$=this.parentNode.nodeName}let ue=i.createElement($);m.setHTML.call(ue,_[0],d==="setHTML"?g[1]:{}),_=[...ue.childNodes],d==="insertAdjacentHTML"?(B="insertAdjacentElement",g[1]=new l,g[1].______isTemp=!0,g[1].append(...ue.childNodes)):(B="replaceChildren",g=[...ue.childNodes])}return p({target:P,entrants:_,exits:w,type:"interception",event:[this,d]},()=>m[B].call(this,...g))})}),["outerHTML","outerText","innerHTML","innerText","textContent","nodeValue"].forEach(d=>{let h=["textContent","nodeValue"].includes(d)?o:["outerText","innerText"].includes(d)?f:s;m[d]=Object.getOwnPropertyDescriptor(h.prototype,d),Object.defineProperty(h.prototype,d,{...m[d],set:function(g){let y=()=>m[d].set.call(this,g);if(!(this instanceof s))return y();let w=[],_=[],P=this;if(["outerHTML","outerText"].includes(d)?(w=[this],P=this.parentNode):w=[...this.childNodes],["outerHTML","innerHTML"].includes(d)){let se=this.nodeName;if(d==="outerHTML"){if(!this.parentNode)return y();se=this.parentNode.nodeName}let $=i.createElement(se==="TEMPLATE"?"div":se);m[d].set.call($,g),_=this instanceof u?[]:[...$.childNodes],d==="outerHTML"?(g=new l,g.______isTemp=!0,g.append(...$.childNodes),y=()=>m.replaceWith.call(this,g)):this instanceof u?y=()=>this.content.replaceChildren(...$.childNodes):y=()=>m.replaceChildren.call(this,...$.childNodes)}return p({target:P,entrants:_,exits:w,type:"interception",event:[this,d]},y)}})}),["append","prepend","replaceChildren"].forEach(d=>{[i,l.prototype].forEach(h=>{let g=h[d];h[d]=function(...y){if(this.______isTemp)return g.call(this,...y);let w=d==="replaceChildren"?[...this.childNodes]:[];return p({target:this,entrants:y,exits:w,type:"interception",event:[this,d]},()=>g.call(this,...y))}})}),c}function ct(){kt.call(this),zt.call(this),Wt.call(this)}function kt(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=e=>e.replace(/([\:@\~\$\&])/g,"\\$1"))}function zt(){let n=this;"isConnected"in n.Node.prototype||Object.defineProperty(n.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function Wt(){let n=this;n.Element.prototype.matches||(n.Element.prototype.matches=n.Element.prototype.matchesSelector||n.Element.prototype.mozMatchesSelector||n.Element.prototype.msMatchesSelector||n.Element.prototype.oMatchesSelector||n.Element.prototype.webkitMatchesSelector||function(e){for(var r=(this.document||this.ownerDocument).querySelectorAll(e),t=r.length;--t>=0&&r.item(t)!==this;);return t>-1})}function lt(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.dom)return n.webqit.dom;n.webqit.dom={},ct.call(n);let e=Ke(n);return n.webqit.dom.Reflow=new e,n.webqit.dom.DOMRealtime=Y,n.webqit.dom.AttrRealtime=R,n.webqit.dom.realtime=(r,t="tree")=>{if(t==="tree")return new Y(r,n);if(t==="attr")return new R(r,n)},n.webqit.dom.ready=Gt.bind(n),n.webqit.dom.meta=Bt.bind(n),n.webqit.dom}function Gt(n){let e=this;e.document.readyState==="complete"?n(e):(e.document.domReadyCallbacks||(e.document.domReadyCallbacks=[],e.document.addEventListener("DOMContentLoaded",()=>{e.document.domReadyCallbacks.splice(0).forEach(r=>r(e))},!1)),e.document.domReadyCallbacks.push(n))}function Bt(n){let e=this,r={},t;return(t=e.document.querySelector(`meta[name="${n}"]`))&&(r=(t.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(f=>f.trim());return Le(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:E(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return t.content},json(){return JSON.parse(JSON.stringify(r))}}}function at(n,e,r){let t=this,i=lt.call(t);t.webqit||(t.webqit={}),t.webqit.oohtml||(t.webqit.oohtml={}),t.webqit.oohtml.configs||(t.webqit.oohtml.configs={});let o=re(2,r,e,i.meta(n).json());return t.webqit.oohtml.configs[n.toUpperCase().replace("-","_")]=o,{config:o,dom:i,window:t}}function Ne({advanced:n={},...e}){let{config:r,window:t}=at.call(this,"scoped-js",e,{script:{retention:"retain",mimeType:""},advanced:fe(n,{parserParams:{allowReturnOutsideFunction:!1,allowSuperOutsideMethod:!1},compilerParams:{globalsNoObserve:["alert"]},runtimeParams:{apiVersion:2}})});r.scriptSelector=(Array.isArray(r.script.mimeType)?r.script.mimeType:[r.script.mimeType]).reduce((i,o)=>{let s=o?`[type=${t.CSS.escape(o)}]`:"";return i.concat(`script${s}[scoped],script${s}[contract]`)},[]).join(","),t.webqit.oohtml.Script={compileCache:[new Map,new Map]},t.webqit.SubscriptFunction=e.SubscriptFunction||ce,t.webqit.Observer=X,Qt.call(t,r)}function Ut(n,e,r){if(!n.function)throw new Error("Input script must already be compiled!");let t=n.function.call(e);r.contract&&(Object.defineProperty(r,"rerender",{value:(...s)=>Ve(t,([,f])=>f(...s))}),Ve(r.properties,s=>{let f=(u,l)=>(Array.isArray(l)?l:[l]).map(c=>[...u,...c.path||[c.key]]);s.processes=s.dependencies.map(u=>u[0]==="this"?X.deep(e,u.slice(1),X.observe,l=>{r.rerender(...f(["this"],l))}):X.deep(globalThis,u,X.observe,l=>{r.rerender(...f([],l))}))}));let i=this,{dom:o}=i.webqit;return o.realtime(i.document).observe(e,()=>{r.contract&&Ve(r.properties,s=>{s.processes.forEach(f=>f.abort())}),e.dispatchEvent(new i.CustomEvent("remove")),e.scripts.delete(r)},{subtree:!0,timing:"sync",generation:"exits"}),r}function Qt(n){let e=this,{dom:r}=e.webqit,t=new W(e,n,Ut),i=()=>{};r.realtime(e.document).observe(n.scriptSelector,o=>{o.entrants.forEach(s=>{if("contract"in s||(Object.defineProperty(s,"contract",{value:s.hasAttribute("contract")}),"scoped"in s))return i(s);Object.defineProperty(s,"scoped",{value:s.hasAttribute("scoped")});let f=s.scoped?o.target:s.type==="module"?void 0:e;t.compile(s,f)})},{subtree:!0,timing:"intercept",generation:"entrants"})}var Ve=(n,e)=>n instanceof Promise?n.then(e):e(n);Ne.call(window);})();
26
+ `||o.openComment==="/*"&&i[0].substr(-1)==="*"&&f==="/")&&(o.openComment=null,l=r(i,"end-comment",f,o,u,u===t)),l!==!1&&(i[0]+=f),[i,o,typeof l=="number"?l:s];let c;return(c=["()","{}","[]"].filter(a=>f===a[0])[0])?(l=r(i,"start-enclosure",f,o,u,u===t),o.openEnclosures.unshift(c)):o.openEnclosures.length&&f===o.openEnclosures[0][1]?(o.openEnclosures.shift(),l=r(i,"end-enclosure",f,o,u,u===t)):['"',"'","`"].includes(f)?(l=r(i,"start-quote",f,o,u,u===t),o.openQuote=f):!o.openComment&&["/*","//"].includes(e.substr(u,2))?(l=r(i,"start-comment",f,o,u,u===t),o.openComment=e.substr(u,2)):l=r(i,"char",f,o,u,u===t),l!==!1&&(i[0]+=f),[i,o,typeof l=="number"?l:s]},[[""],{openEnclosures:[]},0])}};we(W,"hashTable",new Map),we(W,"uniqId",()=>(0|Math.random()*9e6).toString(36));function oe(n,e,r={},t={}){e=A(e).slice();for(var i=n;!j(i)&&!ee(i)&&e.length;){var o=e.shift();if(!(r.get?r.get(i,o):O(i)?o in i:i[o])){t.exists=!1;return}i=r.get?r.get(i,o):i[o]}return t.exists=!0,i}function Le(n,e,r,t={},i={}){let o=(c,a,p)=>i.set?i.set(c,a,p):(E(e[f])&&b(c)?c.push(p):c[a]=p,!0);e=A(e);for(var s=n,f=0;f<e.length;f++)if(f<e.length-1){if(!s||!O(s)&&!v(s))return!1;var u=oe(s,e[f],i);if(!O(u)){if(i.buildTree===!1)return!1;u=v(i.buildTree)?i.buildTree(f):E(e[f+1])?[]:{};var l=o(s,e[f],u);if(!l)return!1}s=u}else return o(s,e[f],r)}var Ke=n=>class{constructor(r=!0){Object.defineProperty(this,"window",{value:n}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),this.async=r,this.window.requestAnimationFrame?this._run():this.async=!1}_run(){this.window.requestAnimationFrame(()=>{this.readCallbacks.forEach(r=>{r()||this.readCallbacks.delete(r)}),this.writeCallbacks.forEach(r=>{r()||this.writeCallbacks.delete(r)}),this._run()})}onread(r,t=!1){if(t)return new Promise((i,o)=>{this.async===!1?r(i,o):this.readCallbacks.add(()=>{r(i,o)})});this.async===!1?r():this.readCallbacks.add(r)}onwrite(r,t=!1){if(t)return new Promise((i,o)=>{this.async===!1?r(i,o):this.writeCallbacks.add(()=>{r(i,o)})});this.async===!1?r():this.writeCallbacks.add(r)}cycle(r,t,i){this.onread(()=>{let o=r(i),s=f=>{f!==void 0&&this.onwrite(()=>{let u=t(f,i),l=c=>{c!==void 0&&this.cycle(r,t,c)};u instanceof Promise?u.then(l):l(u)})};o instanceof Promise?o.then(s):s(o)})}};var G=class{constructor(e,r,t){this.context=e,this.namespace=r,this.window=e.defaultView||e.ownerDocument?.defaultView||t,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(e){return v(e[0])?e=[[],...e]:x(e[0])&&e.length===1?e=[[],void 0,e[0]]:x(e[1])&&e.length===2?e=[A(e[0],!1),void 0,e[1]]:e[0]=A(e[0],!1),e}registry(...e){return D("dom.realtime",this.window,this.namespace,...e)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(e,r,t){let{window:i}=this,o=Array.isArray(r)?r:[r],s=new Set;for(let[f,u]of this.registry(e))for(let[l,c]of u){let a=o.filter(p=>l.contains(p.target)?f==="subtree"||p.target===l:!1);if(!!a.length){Array.isArray(r)||(a=a[0]);for(let p of c)s.add([p,a,l])}}for(let[f,u,l]of s)t.call(this,f,u,l)}disconnectables(e,...r){let t={disconnect(){r.forEach(i=>i&&v(i.disconnect)&&i.disconnect()||v(i)&&i()||x(i)&&(i.disconnected=!0))}};return e&&e.addEventListener("abort",()=>t.disconnect()),t}};var R=class extends G{constructor(e,...r){super(e,"attr",...r)}get(e,r=void 0,t={}){let i=typeof e=="string";[e=[],r=void 0,t={}]=this.resolveArgs(arguments);let{context:o}=this,s=nt(o,e),f=i?s[0]:s;if(!r)return f;let u=r&&t.lifecycleSignals&&this.createSignalGenerator(),l=u?.generate()||{};if(r(f,l,o),t.live){u&&(t={...t,signalGenerator:u});let c=this.observe(i?e[0]:e,r,{newValue:!0,...t});return this.disconnectables(t.signal,c)}}observe(e,r,t={}){let i=typeof e=="string";if([e=[],r,t={}]=this.resolveArgs(arguments),["sync","intercept"].includes(t.timing))return this.observeSync(i?e[0]:e,r,t);if(t.timing&&t.timing!=="async")throw new Error(`Timing option "${t.timing}" invalid.`);let{context:o,window:s,webqit:f}=this;t.eventDetails&&!f.dom.attrInterceptionHooks?.intercepting&&tt.call(s,"intercept",()=>{});let u=new s.MutationObserver(p=>{p=rt(p).map(m=>it.call(s,m)),et.call(s,a,p,o)}),l={attributes:!0,attributeOldValue:t.oldValue,subtree:t.subtree};e.length&&(l.attributeFilter=e),u.observe(o,l);let c=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),a={context:o,filter:e,callback:r,params:t,atomics:new Map,originalFilterIsString:i,signalGenerator:c,disconnectable:u};return this.disconnectables(t.signal,u,c)}observeSync(e,r,t={}){let i=typeof e=="string";[e,r,t={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(t.timing&&!["sync","intercept"].includes(t.timing))throw new Error(`Timing option "${t.timing}" invalid.`);let f=t.timing==="intercept"?"intercept":"sync",u=t.subtree?"subtree":"children";this.registry(f).size||tt.call(s,f,d=>{this.forEachMatchingContext(f,d,et)});let l={disconnect(){m.delete(a),m.size||p.delete(o)}},c=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),a={context:o,filter:e,callback:r,params:t,atomics:new Map,originalFilterIsString:i,signalGenerator:c,disconnectable:l},p=this.registry(f,u);p.has(o)||p.set(o,new Set);let m=p.get(o);return m.add(a),this.disconnectables(t.signal,l,c)}};function rt(n){return n.reduce((e,r,t)=>e[t-1]?.attributeName===r.attributeName?e:e.concat(r),[])}function et(n,e){let{context:r,filter:t,callback:i,params:o,atomics:s,originalFilterIsString:f,signalGenerator:u}=n;o.atomic&&!s.size&&(e=nt(r,t,e)),o.newValue===null&&o.oldValue===null||(e=e.map(a=>{let p;return!o.oldValue&&"oldValue"in a&&({oldValue:p,...a}=a),!o.newValue&&"value"in a?{value:p,...a}=a:o.newValue&&typeof a.value>"u"&&(a={...a,value:a.target.getAttribute(a.name)}),a})),o.atomic&&(e.forEach(a=>s.set(a.name,a)),e=Array.from(s.entries()).map(([,a])=>a));let l=f?e[0]:e,c=u?.generate()||{};i(l,c,r)}function nt(n,e,r=[]){let t={event:null,type:"attribute"};return e.length?e.map(o=>r.find(s=>s.name===o)||{target:n,name:o,value:n.getAttribute(o),...t}):Array.from(n.attributes).map(o=>r.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:o.nodeValue,...t})}function it({target:n,attributeName:e,value:r,oldValue:t}){let s=(this.webqit.dom.attrInterceptionRecords?.get(n)||{})[e]||"mutation";return{target:n,name:e,value:r,oldValue:t,type:"observation",event:s}}function tt(n,e){let r=this,{webqit:t,document:i,Element:o}=r;t.dom.attrInterceptionHooks||Object.defineProperty(t.dom,"attrInterceptionHooks",{value:new Map}),t.dom.attrInterceptionHooks.has(n)||t.dom.attrInterceptionHooks.set(n,new Set),t.dom.attrInterceptionHooks.get(n).add(e);let s=()=>t.dom.attrInterceptionHooks.get(n).delete(e);if(t.dom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),t.dom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(t.dom,"attrInterceptionRecords",{value:new Map});let f=(c,a)=>{t.dom.attrInterceptionRecords.has(c.target)||t.dom.attrInterceptionRecords.set(c.target,{});let p=t.dom.attrInterceptionRecords.get(c.target);clearTimeout(p[c.name]?.timeout),p[c.name]=c.event;let m=setTimeout(()=>{delete p[c.name]},0);Object.defineProperty(c.event,"timeout",{value:m,configurable:!0}),t.dom.attrInterceptionHooks.get("intercept")?.forEach(h=>h([c]));let d=a();return t.dom.attrInterceptionHooks.get("sync")?.forEach(h=>h([c])),d};new r.MutationObserver(c=>{c=rt(c).map(a=>it.call(r,a)).filter((a,p)=>!Array.isArray(a.event)),c.length&&(t.dom.attrInterceptionHooks.get("intercept")?.forEach(a=>a(c)),t.dom.attrInterceptionHooks.get("sync")?.forEach(a=>a(c)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let l=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(c=>{l[c]=o.prototype[c],o.prototype[c]=function(...a){let p,m=this.getAttribute(a[0]);["setAttribute","toggleAttribute"].includes(c)&&(p=a[1]),c==="toggleAttribute"&&p===void 0&&(p=m===null);let d={target:this,name:a[0],value:p,oldValue:m,type:"interception",event:[this,c]};return f(d,()=>l[c].call(this,...a))}}),s}var Y=class extends G{constructor(e,...r){super(e,"tree",...r)}attr(e,r=void 0,t={}){let{context:i,window:o}=this;return new R(i,o).get(...arguments)}query(e,r=void 0,t={}){[e,r=void 0,t={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=l=>(o.has(l)||o.set(l,{target:l,entrants:[],exits:[],type:"query",event:null}),o.get(l));if((!t.generation||t.generation==="entrants")&&(e.length?e.every(l=>typeof l=="string")&&(e=e.join(","))&&(t.subtree?i.querySelectorAll(e):[...i.children].filter(c=>c.matches(e))).forEach(c=>s(c.parentNode||i).entrants.push(c)):[...i.children].forEach(l=>s(i).entrants.push(l))),!r)return o;let f={disconnected:!1},u=r&&t.lifecycleSignals&&this.createSignalGenerator();for(let[,l]of o){if(f.disconnected)break;let c=u?.generate()||{};r(l,c,i)}if(t.live){u&&(t={...t,signalGenerator:u});let l=this.observe(e,r,t);return this.disconnectables(t.signal,f,l)}return this.disconnectables(t.signal,f,u)}children(e,r=void 0,t={}){return[e,r=void 0,t={}]=this.resolveArgs(arguments),this.query(e,r,{...t,subtree:!1})}subtree(e,r=void 0,t={}){return[e,r=void 0,t={}]=this.resolveArgs(arguments),this.query(e,r,{...t,subtree:!0})}observe(e,r,t={}){if([e,r,t={}]=this.resolveArgs(arguments),["sync","intercept"].includes(t.timing))return this.observeSync(e,r,t);if(t.timing&&t.timing!=="async")throw new Error(`Timing option "${t.timing}" invalid.`);let{context:i,window:o,webqit:s,document:f}=this;t.eventDetails&&(s.dom.domInterceptionRecordsAlwaysOn=!0),(f.readyState==="loading"||s.dom.domInterceptionRecordsAlwaysOn)&&!s.dom.domInterceptionHooks?.intercepting&&ut.call(o,"sync",()=>{});let u=new o.MutationObserver(a=>a.forEach(p=>{st.call(o,c,ft.call(o,p),i)}));u.observe(i,{childList:!0,subtree:t.subtree});let l=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),c={context:i,selectors:e,callback:r,params:t,signalGenerator:l,disconnectable:u};if(t.staticSensitivity){let a=ot.call(o,c);return this.disconnectables(t.signal,u,l,a)}return this.disconnectables(t.signal,u,l)}observeSync(e,r,t={}){[e,r,t={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(t.timing&&!["sync","intercept"].includes(t.timing))throw new Error(`Timing option "${t.timing}" invalid.`);let s=t.timing==="intercept"?"intercept":"sync",f=t.subtree?"subtree":"children";this.registry(s).size||ut.call(o,s,m=>{this.forEachMatchingContext(s,m,st)});let u={disconnect(){p.delete(c),p.size||a.delete(i)}},l=t.signalGenerator||t.lifecycleSignals&&this.createSignalGenerator(),c={context:i,selectors:e,callback:r,params:t,signalGenerator:l,disconnectable:u},a=this.registry(s,f);a.has(i)||a.set(i,new Set);let p=a.get(i);if(p.add(c),t.staticSensitivity){let m=ot.call(o,c);return this.disconnectables(t.signal,u,l,m)}return this.disconnectables(t.signal,u,l)}};function ot(n){let e=this,{context:r,selectors:t,callback:i,params:o,signalGenerator:s}=n,f=c=>[...c.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(a=>a[1]);if(!(n.$attrs=t.filter(c=>typeof c=="string"&&c.includes("[")).reduce((c,a)=>c.concat(f(a)),[])).length)return;let u=new Set,l=new Set;return u.push=c=>(l.delete(c),u.add(c)),l.push=c=>(u.delete(c),l.add(c)),n.$deliveryCache={entrants:u,exits:l},new R(r,e).observe(n.$attrs,c=>{let a=new Map,p=h=>(a.has(h)||a.set(h,{target:h,entrants:[],exits:[],type:"static",event:null}),a.get(h)),m=new WeakMap,d=h=>(m.has(h)||m.set(h,t.some(g=>h.matches(g))),m.get(h));for(let h of c)["entrants","exits"].forEach(g=>{o.generation&&g!==o.generation||n.$deliveryCache[g].has(h.target)||(g==="entrants"?!d(h.target):d(h.target))||(n.$deliveryCache[g].push(h.target),p(h.target)[g].push(h.target),p(h.target).event=h.event)});for(let[,h]of a){let g=s?.generate()||{};i(h,g,r)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function st(n,e){let{context:r,selectors:t,callback:i,params:o,signalGenerator:s,$deliveryCache:f}=n,u={...e,entrants:[],exits:[]};if(["entrants","exits"].forEach(c=>{if(!(o.generation&&c!==o.generation)&&(t.length?u[c]=Nt(t,e[c],e.event!=="parse"):u[c]=[...e[c]],!!f))for(let a of u[c])f[c].push(a)}),!u.entrants.length&&!u.exits.length)return;let l=s?.generate()||{};i(u,l,r)}function Nt(n,e,r){e=Array.isArray(e)?e:[...e];let t=(i,o)=>{if(i=i.filter(s=>s.matches),typeof o=="string"){let s=i.filter(f=>f.matches(o));if(r&&(s=i.reduce((f,u)=>[...f,...u.querySelectorAll(o)],s)),s.length)return s}else if(i.includes(o)||r&&i.some(s=>s.contains(o)))return[o]};return e.$$searchCache||(e.$$searchCache=new Map),n.reduce((i,o)=>{let s;return e.$$searchCache.has(o)?s=e.$$searchCache.get(o):(s=t(e,o)||[],x(o)&&e.$$searchCache.set(o,s)),i.concat(s)},[])}function ft({target:n,addedNodes:e,removedNodes:r}){let t=this,i;return i=A(e).reduce((o,s)=>o||t.webqit.dom.domInterceptionRecords?.get(s),null),i=A(r).reduce((o,s)=>o||t.webqit.dom.domInterceptionRecords?.get(s),i),i=i||t.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:e,exits:r,type:"observation",event:i}}function ut(n,e){let r=this,{webqit:t,document:i,Node:o,Element:s,HTMLElement:f,HTMLTemplateElement:u,DocumentFragment:l}=r;t.dom.domInterceptionHooks||Object.defineProperty(t.dom,"domInterceptionHooks",{value:new Map}),t.dom.domInterceptionHooks.has(n)||t.dom.domInterceptionHooks.set(n,new Set),t.dom.domInterceptionHooks.get(n).add(e);let c=()=>t.dom.domInterceptionHooks.get(n).delete(e);if(t.dom.domInterceptionHooks?.intercepting)return c;console.warn("DOM mutation APIs are now being intercepted."),t.dom.domInterceptionHooks.intercepting=!0,Object.defineProperty(t.dom,"domInterceptionRecords",{value:new Map});let a=()=>!0,p=(d,h)=>{a()?d.entrants.concat(d.exits).forEach(y=>{clearTimeout(t.dom.domInterceptionRecords.get(y)?.timeout),t.dom.domInterceptionRecords.set(y,d.event);let w=setTimeout(()=>{t.dom.domInterceptionRecords.delete(y)},0);Object.defineProperty(d.event,"timeout",{value:w,configurable:!0})}):t.dom.domInterceptionRecords.clear(),t.dom.domInterceptionHooks.get("intercept")?.forEach(y=>y(d));let g=h();return t.dom.domInterceptionHooks.get("sync")?.forEach(y=>y(d)),g};if(a()){let d=new r.MutationObserver(h=>h.forEach(g=>{Array.isArray((g=ft.call(r,g)).event)||(t.dom.domInterceptionHooks.get("intercept")?.forEach(y=>y(g)),t.dom.domInterceptionHooks.get("sync")?.forEach(y=>y(g)))}));d.observe(i,{childList:!0,subtree:!0}),i.addEventListener("readystatechange",()=>!a()&&d.disconnect())}let m=Object.create(null);return["insertBefore","insertAdjacentElement","insertAdjacentHTML","setHTML","replaceChildren","replaceWith","remove","replaceChild","removeChild","before","after","append","prepend","appendChild"].forEach(d=>{let h=["insertBefore","replaceChild","removeChild","appendChild"].includes(d)?o:s;m[d]=h.prototype[d],m[d]&&(h.prototype[d]=function(...g){let y=()=>m[d].call(this,...g);if(!(this instanceof s||this instanceof l))return y();let w=[],_=[],P=this;["insertBefore"].includes(d)?_=[g[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(d)?(_=[g[1]],["beforebegin","afterend"].includes(g[0])&&(P=this.parentNode)):["setHTML","replaceChildren"].includes(d)?(w=[...this.childNodes],_=d==="replaceChildren"?[...g]:[g[0]]):["replaceWith","remove"].includes(d)?(w=[this],_=d==="replaceWith"?[...g]:[],P=this.parentNode):["replaceChild"].includes(d)?(w=[g[1]],_=[g[0]]):["removeChild"].includes(d)?w=[...g]:(_=[...g],["before","after"].includes(d)&&(P=this.parentNode));let B=d;if(["insertAdjacentHTML","setHTML"].includes(d)){let $=this.nodeName;if(d==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(g[0])){if(!this.parentNode)return m[d].call(this,...g);$=this.parentNode.nodeName}let ue=i.createElement($);m.setHTML.call(ue,_[0],d==="setHTML"?g[1]:{}),_=[...ue.childNodes],d==="insertAdjacentHTML"?(B="insertAdjacentElement",g[1]=new l,g[1].______isTemp=!0,g[1].append(...ue.childNodes)):(B="replaceChildren",g=[...ue.childNodes])}return p({target:P,entrants:_,exits:w,type:"interception",event:[this,d]},()=>m[B].call(this,...g))})}),["outerHTML","outerText","innerHTML","innerText","textContent","nodeValue"].forEach(d=>{let h=["textContent","nodeValue"].includes(d)?o:["outerText","innerText"].includes(d)?f:s;m[d]=Object.getOwnPropertyDescriptor(h.prototype,d),Object.defineProperty(h.prototype,d,{...m[d],set:function(g){let y=()=>m[d].set.call(this,g);if(!(this instanceof s))return y();let w=[],_=[],P=this;if(["outerHTML","outerText"].includes(d)?(w=[this],P=this.parentNode):w=[...this.childNodes],["outerHTML","innerHTML"].includes(d)){let se=this.nodeName;if(d==="outerHTML"){if(!this.parentNode)return y();se=this.parentNode.nodeName}let $=i.createElement(se==="TEMPLATE"?"div":se);m[d].set.call($,g),_=this instanceof u?[]:[...$.childNodes],d==="outerHTML"?(g=new l,g.______isTemp=!0,g.append(...$.childNodes),y=()=>m.replaceWith.call(this,g)):this instanceof u?y=()=>this.content.replaceChildren(...$.childNodes):y=()=>m.replaceChildren.call(this,...$.childNodes)}return p({target:P,entrants:_,exits:w,type:"interception",event:[this,d]},y)}})}),["append","prepend","replaceChildren"].forEach(d=>{[i,l.prototype].forEach(h=>{let g=h[d];h[d]=function(...y){if(this.______isTemp)return g.call(this,...y);let w=d==="replaceChildren"?[...this.childNodes]:[];return p({target:this,entrants:y,exits:w,type:"interception",event:[this,d]},()=>g.call(this,...y))}})}),c}function ct(){kt.call(this),zt.call(this),Wt.call(this)}function kt(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=e=>e.replace(/([\:@\~\$\&])/g,"\\$1"))}function zt(){let n=this;"isConnected"in n.Node.prototype||Object.defineProperty(n.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function Wt(){let n=this;n.Element.prototype.matches||(n.Element.prototype.matches=n.Element.prototype.matchesSelector||n.Element.prototype.mozMatchesSelector||n.Element.prototype.msMatchesSelector||n.Element.prototype.oMatchesSelector||n.Element.prototype.webkitMatchesSelector||function(e){for(var r=(this.document||this.ownerDocument).querySelectorAll(e),t=r.length;--t>=0&&r.item(t)!==this;);return t>-1})}function lt(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.dom)return n.webqit.dom;n.webqit.dom={},ct.call(n);let e=Ke(n);return n.webqit.dom.Reflow=new e,n.webqit.dom.DOMRealtime=Y,n.webqit.dom.AttrRealtime=R,n.webqit.dom.realtime=(r,t="tree")=>{if(t==="tree")return new Y(r,n);if(t==="attr")return new R(r,n)},n.webqit.dom.ready=Gt.bind(n),n.webqit.dom.meta=Bt.bind(n),n.webqit.dom}function Gt(n){let e=this;e.document.readyState==="complete"?n(e):(e.document.domReadyCallbacks||(e.document.domReadyCallbacks=[],e.document.addEventListener("DOMContentLoaded",()=>{e.document.domReadyCallbacks.splice(0).forEach(r=>r(e))},!1)),e.document.domReadyCallbacks.push(n))}function Bt(n){let e=this,r={},t;return(t=e.document.querySelector(`meta[name="${n}"]`))&&(r=(t.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(f=>f.trim());return Le(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:E(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return t.content},json(){return JSON.parse(JSON.stringify(r))}}}function at(n,e,r){let t=n.toUpperCase().replace("-","_"),i=this,o=lt.call(i);return i.webqit||(i.webqit={}),i.webqit.oohtml||(i.webqit.oohtml={}),i.webqit.oohtml.configs||(i.webqit.oohtml.configs={}),i.webqit.oohtml.configs[t]||(i.webqit.oohtml.configs[t]={}),re(2,i.webqit.oohtml.configs[t],r,e,o.meta(n).json()),{config:i.webqit.oohtml.configs[t],dom:o,window:i}}function Ne({advanced:n={},...e}){let{config:r,window:t}=at.call(this,"scoped-js",e,{script:{retention:"retain",mimeType:""},advanced:fe(n,{parserParams:{allowReturnOutsideFunction:!1,allowSuperOutsideMethod:!1},compilerParams:{globalsNoObserve:["alert"]},runtimeParams:{apiVersion:2}})});r.scriptSelector=(Array.isArray(r.script.mimeType)?r.script.mimeType:[r.script.mimeType]).reduce((i,o)=>{let s=o?`[type=${t.CSS.escape(o)}]`:"";return i.concat(`script${s}[scoped],script${s}[contract]`)},[]).join(","),t.webqit.oohtml.Script={compileCache:[new Map,new Map]},t.webqit.SubscriptFunction=e.SubscriptFunction||ce,t.webqit.Observer=X,Qt.call(t,r)}function Ut(n,e,r){if(!n.function)throw new Error("Input script must already be compiled!");let t=n.function.call(e);r.contract&&(Object.defineProperty(r,"rerender",{value:(...s)=>Ve(t,([,f])=>f(...s))}),Ve(r.properties,s=>{let f=(u,l)=>(Array.isArray(l)?l:[l]).map(c=>[...u,...c.path||[c.key]]);s.processes=s.dependencies.map(u=>u[0]==="this"?X.deep(e,u.slice(1),X.observe,l=>{r.rerender(...f(["this"],l))}):X.deep(globalThis,u,X.observe,l=>{r.rerender(...f([],l))}))}));let i=this,{dom:o}=i.webqit;return o.realtime(i.document).observe(e,()=>{r.contract&&Ve(r.properties,s=>{s.processes.forEach(f=>f.abort())}),e.dispatchEvent(new i.CustomEvent("remove")),e.scripts.delete(r)},{subtree:!0,timing:"sync",generation:"exits"}),r}function Qt(n){let e=this,{dom:r}=e.webqit,t=new W(e,n,Ut),i=()=>{};r.realtime(e.document).observe(n.scriptSelector,o=>{o.entrants.forEach(s=>{if("contract"in s||(Object.defineProperty(s,"contract",{value:s.hasAttribute("contract")}),"scoped"in s))return i(s);Object.defineProperty(s,"scoped",{value:s.hasAttribute("scoped")});let f=s.scoped?o.target:s.type==="module"?void 0:e;t.compile(s,f)})},{subtree:!0,timing:"intercept",generation:"entrants"})}var Ve=(n,e)=>n instanceof Promise?n.then(e):e(n);Ne.call(window);})();
27
27
  //# sourceMappingURL=scoped-js.js.map