@webqit/oohtml 3.1.22 → 4.0.0

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/README.md CHANGED
@@ -114,12 +114,12 @@ If you'll be going ahead to build a real app with OOHTML, you may want to consid
114
114
 
115
115
  ...still gives the `window` object in the console.
116
116
 
117
- + **Syntax**. The syntax for attribute names and API names across features - e.g. the `def` and `ref` attributes, the `expr` attribute - isn't finalized, and may change on subsequent iterations, albeit with same principle of operation. But the polyfill is designed to be configurable via meta tags, and to honour any such "overrides". Here's an example:
117
+ + **Syntax**. The syntax for attribute names and API names across features - e.g. the `def` and `ref` attributes, the `render` attribute - isn't finalized, and may change on subsequent iterations, albeit with same principle of operation. But the polyfill is designed to be configurable via meta tags, and to honour any such "overrides". Here's an example:
118
118
 
119
119
  ```html
120
120
  <head>
121
121
  <!-- Configurations come before the polyfil -->
122
- <meta name="data-binding" content="attr.expr=expr;">
122
+ <meta name="data-binding" content="attr.render=render;">
123
123
  <meta name="namespaced-html" content="attr.id=id;">
124
124
  <meta name="html-imports" content="attr.def=def; attr.ref=ref;">
125
125
  <script src="https://unpkg.com/@webqit/oohtml/dist/main.js"></script>
@@ -149,7 +149,7 @@ If you'll be going ahead to build a real app with OOHTML, you may want to consid
149
149
 
150
150
  | Config | Default Syntax | Description |
151
151
  | :----- | :------------- | :---------- |
152
- | `attr.expr` | `expr` | The "expr" attribute for inline data binding. ([Docs](#inline-data-binding)) |
152
+ | `attr.render` | `render` | The "render" attribute for inline data binding. ([Docs](#inline-data-binding)) |
153
153
  | `attr.itemIndex` | `data-index` | The "item index" attribute for assigning indexes to list items. ([Docs](#inline-data-binding)) |
154
154
 
155
155
  **Spec: `<meta name="bindings-api">`**
@@ -925,7 +925,7 @@ const result = contextElement.import('foo#fragment2'); // the local module: foo#
925
925
 
926
926
  Data binding is the idea of declaratively binding the UI to application data, wherein the relevant parts of the UI *automatically* update as application state changes.
927
927
 
928
- OOHTML makes this possible in just simple conventions - via a new comment-based data-binding syntax `<?{ }?>` and a complementary new `expr` attribute!
928
+ OOHTML makes this possible in just simple conventions - via a new comment-based data-binding syntax `<?{ }?>` and a complementary new `render` attribute!
929
929
 
930
930
  And for when we need to write extensive reactive logic on the UI, a perfect answer: Quantum Scripts!
931
931
 
@@ -996,10 +996,12 @@ Now, on getting to the client, that extra bit of information gets decoded, and o
996
996
 
997
997
  ### Inline Data-Binding
998
998
 
999
- For attribute-based data binding, OOHTML deviates from the usual (and problematic) idea of bringing markup-style bindings into attribute texts: `title="Hello { titleValue }"`, **as though attributes had the same semantics as markup**. Instead, we get a dedicated "expressions" attribute - `expr` - for a nifty, key/value data-binding language:
999
+ For attribute-based data binding, OOHTML deviates from the usual (and problematic) idea of bringing markup-style bindings into attribute texts: `title="Hello { titleValue }"`, **as though attributes had the same semantics as markup**. Instead, we get a dedicated "render" attribute - `render` - for a nifty, key/value data-binding language:
1000
+
1001
+ > Note that in OOHTML <= v3 the `render` attribute was `expr`.
1000
1002
 
1001
1003
  ```html
1002
- <div expr="<directive> <param>: <arg>;"></div>
1004
+ <div render="<directive> <param>: <arg>;"></div>
1003
1005
  ```
1004
1006
 
1005
1007
  **-->** *where*:
@@ -1011,36 +1013,36 @@ For attribute-based data binding, OOHTML deviates from the usual (and problemati
1011
1013
  **-->** *which would give us the following for a CSS property*:
1012
1014
 
1013
1015
  ```html
1014
- <div expr="& color:someColor; & backgroundColor:'red'"></div>
1016
+ <div render="& color:someColor; & backgroundColor:'red'"></div>
1015
1017
  ```
1016
1018
 
1017
1019
  **-->** *without being space-sensitive*:
1018
1020
 
1019
1021
  ```html
1020
- <div expr="& color:someColor; &backgroundColor: 'red'"></div>
1022
+ <div render="& color:someColor; &backgroundColor: 'red'"></div>
1021
1023
  ```
1022
1024
 
1023
1025
  **-->** *the rest of which can be seen below*:
1024
1026
 
1025
1027
  | Directive | Type | Usage |
1026
1028
  | :---- | :---- | :---- |
1027
- | `&` | CSS Property | `<div expr="& color:someColor; & backgroundColor:someBgColor;"></div>` |
1028
- | `%` | Class Name | `<div expr="% active:app.isActive; % expanded:app.isExpanded;"></div>` |
1029
- | `~` | Attribute Name | `<a expr="~ href:person.profileUrl+'#bio'; ~ title:'Click me';"></a>` |
1030
- | | Boolean Attribute | `<a expr="~ ?required:formField.required; ~ ?aria-checked: formField.checked"></a>` |
1029
+ | `&` | CSS Property | `<div render="& color:someColor; & backgroundColor:someBgColor;"></div>` |
1030
+ | `%` | Class Name | `<div render="% active:app.isActive; % expanded:app.isExpanded;"></div>` |
1031
+ | `~` | Attribute Name | `<a render="~ href:person.profileUrl+'#bio'; ~ title:'Click me';"></a>` |
1032
+ | | Boolean Attribute | `<a render="~ ?required:formField.required; ~ ?aria-checked: formField.checked"></a>` |
1031
1033
  | `@` | Structural Directive: | *See below* |
1032
- | `@text` | Plain text content | `<span expr="@text:firstName+' '+lastName;"></span>` |
1033
- | `@html` | Markup content | `<span expr="@html: '<i>'+firstName+'</i>';"></span>` |
1034
+ | `@text` | Plain text content | `<span render="@text:firstName+' '+lastName;"></span>` |
1035
+ | `@html` | Markup content | `<span render="@html: '<i>'+firstName+'</i>';"></span>` |
1034
1036
  | `@items` | A list, of the following format | `<declaration> <of\|in> <iterable> / <importRef>`<br>*See next two tables* |
1035
1037
 
1036
1038
  <details><summary><code>For ... Of</code> Loops</summary>
1037
1039
 
1038
1040
  | Idea | Usage |
1039
1041
  | :---- | :---- |
1040
- | A `for...of` loop over an array/iterable | `<ul expr="@items: value of [1,2,3] / 'foo#fragment';"></ul>` |
1041
- | Same as above but with a `key` declaration | `<ul expr="@items: (value,key) of [1,2,3] / 'foo#fragment';"></ul>` |
1042
- | Same as above but with different variable names | `<ul expr="@items: (product,id) of store.products / 'foo#fragment';"></ul>` |
1043
- | Same as above but with a dynamic `importRef` | `<ul expr="@items: (product,id) of store.products / store.importRef;"></ul>` |
1042
+ | A `for...of` loop over an array/iterable | `<ul render="@items: value of [1,2,3] / 'foo#fragment';"></ul>` |
1043
+ | Same as above but with a `key` declaration | `<ul render="@items: (value,key) of [1,2,3] / 'foo#fragment';"></ul>` |
1044
+ | Same as above but with different variable names | `<ul render="@items: (product,id) of store.products / 'foo#fragment';"></ul>` |
1045
+ | Same as above but with a dynamic `importRef` | `<ul render="@items: (product,id) of store.products / store.importRef;"></ul>` |
1044
1046
 
1045
1047
  </details>
1046
1048
 
@@ -1048,8 +1050,8 @@ For attribute-based data binding, OOHTML deviates from the usual (and problemati
1048
1050
 
1049
1051
  | Idea | Usage |
1050
1052
  | :---- | :---- |
1051
- | A `for...in` loop over an object | `<ul expr="@items: key in {a:1,b:2} / 'foo#fragment';"></ul>` |
1052
- | Same as above but with a `value` and `index` declaration | `<ul expr="@items: (key,value,index) in {a:1, b:2} / 'foo#fragment';"></ul>` |
1053
+ | A `for...in` loop over an object | `<ul render="@items: key in {a:1,b:2} / 'foo#fragment';"></ul>` |
1054
+ | Same as above but with a `value` and `index` declaration | `<ul render="@items: (key,value,index) in {a:1, b:2} / 'foo#fragment';"></ul>` |
1053
1055
 
1054
1056
  </details>
1055
1057
 
@@ -1785,11 +1787,11 @@ The following is a hypothetical list page!
1785
1787
 
1786
1788
  <!-- The "items" template -->
1787
1789
  <template def="item" scoped>
1788
- <li><a expr="~href: '/animals#'+name;"><?{ index+': '+name }?></a></li>
1790
+ <li><a render="~href: '/animals#'+name;"><?{ index+': '+name }?></a></li>
1789
1791
  </template>
1790
1792
 
1791
1793
  <!-- The loop -->
1792
- <ul expr="@items: (name,index) of ['dog','cat','ram'] / 'item';"></ul>
1794
+ <ul render="@items: (name,index) of ['dog','cat','ram'] / 'item';"></ul>
1793
1795
 
1794
1796
  </section>
1795
1797
  ```
@@ -1,4 +1,4 @@
1
- (()=>{function b(n){return!Array.isArray(n)&&typeof n=="object"&&n}function y(n){return Array.isArray(n)}function it(n,t,r=null){return y(t)?n.filter(e=>r?t.filter(i=>r(e,i)).length:t.indexOf(e)!==-1):[]}function I(n,...t){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new R}),!arguments.length)return globalThis.webqit.refs;let r=globalThis.webqit.refs.get(n);r||(r=new R,globalThis.webqit.refs.set(n,r));let e,i;for(;e=t.shift();)(i=r)&&!(r=r.get(e))&&(r=new R,i.set(e,r));return r}var R=class extends Map{constructor(...t){super(...t),this.observers=new Set}set(t,r){let e=super.set(t,r);return this.fire("set",t,r,t),e}delete(t){let r=super.delete(t);return this.fire("delete",t),r}has(t){return this.fire("has",t),super.has(t)}get(t){return this.fire("get",t),super.get(t)}keyNames(){return Array.from(super.keys())}observe(t,r,e){let i={type:t,key:r,callback:e};return this.observers.add(i),()=>this.observers.delete(i)}unobserve(t,r,e){if(Array.isArray(t)||Array.isArray(r))throw new Error('The "type" and "key" arguments can only be strings.');for(let i of this.observers)!(Y([t,"*"],i.type)&&Y([r,"*"],i.key)&&i.callback===e)||this.observers.delete(i)}fire(t,r,...e){for(let i of this.observers)!(Y([t,"*"],i.type)&&Y([r,"*"],i.key))||i.callback(...e)}},Y=(n,t)=>Array.isArray(t)?it(n,t).length:n.includes(t);function L(n){return typeof n=="function"}function W(n){return n===null||n===""}function M(n){return arguments.length&&(n===void 0||typeof n>"u")}function v(n){return Array.isArray(n)||typeof n=="object"&&n||L(n)}function ot(n){return W(n)||M(n)||n===!1||n===0||v(n)&&!Object.keys(n).length}function w(n){return L(n)||n&&{}.toString.call(n)==="[object function]"}function V(n){return n instanceof Number||typeof n=="number"}function C(n){return V(n)||n!==!0&&n!==!1&&n!==null&&n!==""&&!isNaN(n*1)}function D(n){return n instanceof String||typeof n=="string"&&n!==null}function st(n){return!D(n)&&!M(n.length)}function Z(n,...t){return t.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n}function ft(e,t){t=t||Object.prototype,t=t&&!y(t)?[t]:t;for(var r=[],e=e;e&&(!t||t.indexOf(e)<0)&&e.name!=="default";)r.push(e),e=e?Object.getPrototypeOf(e):null;return r}function lt(n,t){var r=[];return ft(n,t).forEach(e=>{Z(r,...Object.getOwnPropertyNames(e))}),r}function T(n,t,r=!1,e=!1,i=!1){var o=0,s=n.shift();if((C(s)||s===!0||s===!1)&&(o=s,s=n.shift()),!n.length)throw new Error("_merge() requires two or more array/objects.");return n.forEach((f,u)=>{!v(f)&&!w(f)||(r?lt(f):Object.keys(f)).forEach(c=>{if(!!t(c,s,f,u)){var l=s[c],d=f[c];if((y(l)&&y(d)||b(l)&&b(d))&&(o===!0||o>0))s[c]=y(l)&&y(d)?[]:{},T([C(o)?o-1:o,s[c],l,d],t,r,e,i);else if(y(s)&&y(f))e?s[c]=d:s.push(d);else try{i?Object.defineProperty(s,c,Object.getOwnPropertyDescriptor(f,c)):s[c]=f[c]}catch{}}})}),s}function G(...n){return T(n,(t,r,e)=>!0,!1,!1,!1)}function A(n,t=!0){return y(n)?n:!t&&b(n)?[n]:n!==!1&&n!==0&&ot(n)?[]:st(n)?Array.prototype.slice.call(n):b(n)?Object.values(n):[n]}function U(n,t,r={},e={}){t=A(t).slice();for(var i=n;!M(i)&&!W(i)&&t.length;){var o=t.shift();if(!(r.get?r.get(i,o):v(i)?o in i:i[o])){e.exists=!1;return}i=r.get?r.get(i,o):i[o]}return e.exists=!0,i}function ut(n,t,r,e={},i={}){let o=(l,d,a)=>i.set?i.set(l,d,a):(C(t[f])&&y(l)?l.push(a):l[d]=a,!0);t=A(t);for(var s=n,f=0;f<t.length;f++)if(f<t.length-1){if(!s||!v(s)&&!w(s))return!1;var u=U(s,t[f],i);if(!v(u)){if(i.buildTree===!1)return!1;u=w(i.buildTree)?i.buildTree(f):C(t[f+1])?[]:{};var c=o(s,t[f],u);if(!c)return!1}s=u}else return o(s,t[f],r)}var X=class{constructor(t,r=!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}),!r&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(t){this._synthesis++,this._fulfill();let r=await t();return this._synthesis--,r}_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,r=!1){if(r)return new Promise(e=>{this.synthesis?e(t()):this.readCallbacks.add(()=>{e(t())})});this.synthesis?Promise.resolve().then(t):this.readCallbacks.add(t)}onwrite(t,r=!1){if(r)return new Promise(e=>{this.synthesis?e(t()):this.writeCallbacks.add(()=>{e(t())})});this.synthesis?Promise.resolve().then(t):this.writeCallbacks.add(t)}cycle(t,r,e){this.onread(()=>{let i=t(e),o=s=>{s!==void 0&&this.onwrite(()=>{let f=r(s,e),u=c=>{c!==void 0&&this.cycle(t,r,c)};f instanceof Promise?f.then(u):u(f)})};i instanceof Promise?i.then(o):o(i)})}};function $t(n){return(n=n.trim())&&n.startsWith("(")&&n.endsWith(")")}function tt(n,t,r,e=!0){r=(Array.isArray(r)?r:[r]).map(s=>(s+"").replace("(",e?"(.//":"(./")).join("|");let i=[],o;try{let s=n.document.evaluate(r,t,null,n.XPathResult.ANY_TYPE);for(;o=s.iterateNext();)i.push(o)}catch{}return i}function St(n,t,r){r=(Array.isArray(r)?r:[r]).map(e=>(e+"").replace("(","(self::")).join("|");try{return n.document.evaluate(`${r}`,t,null,n.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function z(n,t,r,e=!1){let i=t.getRootNode(),o=r.getRootNode();return i===o?t.contains(r):e&&o instanceof n.ShadowRoot?z(n,t,o.host,e):!1}function It(n,t="|"){return[...n].reduce(([r,e,i,o],s)=>!r&&e===0&&(Array.isArray(t)?t:[t]).includes(s)?[r,e,[""].concat(i)]:(!r&&["(","[","{"].includes(s)&&!i[0].endsWith("\\")&&e++,!r&&[")","]","}"].includes(s)&&!i[0].endsWith("\\")&&e--,['"',"'","`"].includes(s)&&!i[0].endsWith("\\")&&(r=r===s?null:r||s),i[0]+=s,[r,e,i]),[null,0,[""]])[2].reverse()}var E=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:$t(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=It(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var k=class{constructor(t,r,e){this.context=t,this.namespace=r,this.window=t.defaultView||t.ownerDocument?.defaultView||e,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if(w(t[0])?t=[[],...t]:b(t[0])&&!(t[0]instanceof E)&&t.length===1?t=[[],void 0,t[0]]:b(t[1])&&t.length===2?t=[A(t[0],!1),void 0,t[1]]:t[0]=A(t[0],!1),t[0].filter(r=>typeof r!="string"&&!(r instanceof E)&&!(r 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(r=>r instanceof E?r:new E(r)),t}registry(...t){return I("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,r,e){let{window:i}=this,o=Array.isArray(r)?r:[r],s=new Set;for(let[f,u]of this.registry(t))for(let[c,l]of u){let d=o.filter(a=>z(i,c,a.target,f==="cross-roots")?["subtree","cross-roots"].includes(f)||a.target===c:!1);if(!!d.length){Array.isArray(r)||(d=d[0]);for(let a of l)s.add([a,d,c])}}for(let[f,u,c]of s)e.call(i,f,u,c)}disconnectables(t,...r){let e={disconnect(){r.forEach(i=>i&&w(i.disconnect)&&i.disconnect()||w(i)&&i()||b(i)&&(i.disconnected=!0))}};return t&&t.addEventListener("abort",()=>e.disconnect()),e}};var q=class extends k{constructor(t,...r){super(t,"attr",...r)}get(t,r=void 0,e={}){let i=typeof t=="string"||t instanceof E;[t=[],r=void 0,e={}]=this.resolveArgs(arguments);let{context:o}=this,s=Pt(o,t);if(!r)return s;let f=e.lifecycleSignals&&this.createSignalGenerator();if(i)for(let u of s){let c=f?.generate()||{};r(u,c,o)}else{let u=f?.generate()||{};r(s,u,o)}if(e.live){f&&(e={...e,signalGenerator:f});let u=this.observe(i?t[0]:t,r,{newValue:!0,...e});return this.disconnectables(e.signal,u)}}observe(t,r,e={}){let i=typeof t=="string"||t instanceof E;if([t=[],r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(i?t[0]:t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:o,window:s,webqit:f}=this;e.eventDetails&&!f.realdom.attrInterceptionHooks?.intercepting&&Et.call(s,"intercept",()=>{});let u=new s.MutationObserver(a=>{a=Tt(a).map(h=>Mt.call(s,h)),Ct.call(s,d,a,o)}),c={attributes:!0,attributeOldValue:e.oldValue,subtree:e.subtree&&!0};t.length&&(c.attributeFilter=t.map(a=>a+"")),u.observe(o,c);let l=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),d={context:o,spec:t,callback:r,params:e,atomics:new Map,originalFilterIsString:i,signalGenerator:l,disconnectable:u};return this.disconnectables(e.signal,u,l)}observeSync(t,r,e={}){let i=typeof t=="string"||t instanceof E;[t,r,e={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let f=e.timing==="intercept"?"intercept":"sync",u=e.subtree==="cross-roots"?"cross-roots":e.subtree?"subtree":"children";this.registry(f).size||Et.call(s,f,g=>{this.forEachMatchingContext(f,g,Ct)});let c={disconnect(){h.delete(d),h.size||a.delete(o)}},l=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),d={context:o,spec:t,callback:r,params:e,atomics:new Map,originalFilterIsString:i,signalGenerator:l,disconnectable:c},a=this.registry(f,u);a.has(o)||a.set(o,new Set);let h=a.get(o);return h.add(d),this.disconnectables(e.signal,c,l)}};function Tt(n){return n.reduce((t,r,e)=>t[e-1]?.attributeName===r.attributeName||I(r.target,"internalAttrInteractions").get(r.attributeName)?t:t.concat(r),[])}function Ct(n,t){let{context:r,spec:e,callback:i,params:o,atomics:s,originalFilterIsString:f,signalGenerator:u}=n,c=e.map(a=>a+"");if(o.atomic&&!s.size?t=Pt(r,e,t):o.timing!=="async"&&e.length&&(t=t.filter(a=>c.includes(a.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(a=>{let h;return o.eventDetails||({event:h,...a}=a),!o.oldValue&&"oldValue"in a&&({oldValue:h,...a}=a),!o.newValue&&"value"in a?{value:h,...a}=a:o.newValue&&typeof a.value>"u"&&(a={...a,value:et(a.target,a.name,()=>a.target.getAttribute(a.name))}),a})),o.atomic&&(t.forEach(a=>s.set(a.name,a)),t=Array.from(s.entries()).map(([,a])=>a));let l=f?t[0]:t,d=u?.generate()||{};i(l,d,r)}function et(n,t,r){let e=I(n,"internalAttrInteractions").get(t);I(n,"internalAttrInteractions").set(t,!0);let i=r();return I(n,"internalAttrInteractions").set(t,e),i}function Pt(n,t,r=[]){let e={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",r.find(s=>s.name===o)||{target:n,name:o,value:et(n,o,()=>n.getAttribute(o)),...e})):Array.from(n.attributes).map(o=>r.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:et(n,o.nodeName,()=>o.nodeValue),...e})}function Mt({target:n,attributeName:t,value:r,oldValue:e}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(n)||{})[t]?.[0]||"mutation";return{target:n,name:t,value:r,oldValue:e,type:"observation",event:s}}function Et(n,t){let r=this,{webqit:e,document:i,Element:o}=r;e.realdom.attrInterceptionHooks||Object.defineProperty(e.realdom,"attrInterceptionHooks",{value:new Map}),e.realdom.attrInterceptionHooks.has(n)||e.realdom.attrInterceptionHooks.set(n,new Set),e.realdom.attrInterceptionHooks.get(n).add(t);let s=()=>e.realdom.attrInterceptionHooks.get(n).delete(t);if(e.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),e.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(e.realdom,"attrInterceptionRecords",{value:new Map});let f=(l,d)=>{e.realdom.attrInterceptionRecords.has(l.target)||e.realdom.attrInterceptionRecords.set(l.target,{});let a=e.realdom.attrInterceptionRecords.get(l.target);if(a[l.name]=a[l.name]||[],a[l.name].unshift(l.event),I(l.target,"internalAttrInteractions").get(l.name))return d();e.realdom.attrInterceptionHooks.get("intercept")?.forEach(g=>g([l]));let h=d();return e.realdom.attrInterceptionHooks.get("sync")?.forEach(g=>g([l])),h};new r.MutationObserver(l=>{l=l.filter(d=>!(r.webqit.realdom.attrInterceptionRecords?.get(d.target)||{})[d.attributeName]?.shift()),l=Tt(l).map(d=>Mt.call(r,d)),l.length&&(e.realdom.attrInterceptionHooks.get("intercept")?.forEach(d=>d(l)),e.realdom.attrInterceptionHooks.get("sync")?.forEach(d=>d(l)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let c=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(l=>{c[l]=o.prototype[l],o.prototype[l]=function(...d){let a,h=et(this,d[0],()=>this.getAttribute(d[0]));["setAttribute","toggleAttribute"].includes(l)&&(a=d[1]),l==="toggleAttribute"&&a===void 0&&(a=h===null);let g={target:this,name:d[0],value:a,oldValue:h,type:"interception",event:[this,l]};return f(g,()=>c[l].call(this,...d))}}),s}var Q=class extends k{constructor(t,...r){super(t,"tree",...r)}attr(t,r=void 0,e={}){let{context:i,window:o}=this;return new q(i,o).get(...arguments)}query(t,r=void 0,e={}){[t,r=void 0,e={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=c=>(o.has(c)||o.set(c,{target:c,entrants:[],exits:[],type:"query",event:null}),o.get(c));if(!e.generation||e.generation==="entrants"){if(!t.length)[...i.children].forEach(c=>s(i).entrants.push(c));else if(t.every(c=>c.type==="selector")){let[c,l]=t.reduce(([a,h],g)=>g.kind==="xpath"?[a,h.concat(g)]:[a.concat(g),h],[[],[]]),d=[];e.subtree?(c.length&&d.push(...i.querySelectorAll(c.join(","))),l.length&&d.push(...tt(this.window,i,l))):(c.length&&d.push(...[...i.children].filter(a=>a.matches(c))),l.length&&d.push(...tt(this.window,i,l,!1))),d.forEach(a=>s(a.parentNode||i).entrants.push(a))}}if(!r)return o;let f={disconnected:!1},u=r&&e.lifecycleSignals&&this.createSignalGenerator();for(let[,c]of o){if(f.disconnected)break;let l=u?.generate()||{};r(c,l,i)}if(e.live){u&&(e={...e,signalGenerator:u});let c=this.observe(t,r,e);return this.disconnectables(e.signal,f,c)}return this.disconnectables(e.signal,f,u)}children(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!1})}subtree(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!0})}observe(t,r,e={}){if([t,r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:i,window:o,webqit:s,document:f}=this;e.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(f.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&kt.call(o,"sync",()=>{});let u=new o.MutationObserver(d=>d.forEach(a=>{dt.call(o,l,Nt.call(o,a),i)}));u.observe(i,{childList:!0,subtree:e.subtree&&!0});let c=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),l={context:i,spec:t,callback:r,params:e,signalGenerator:c,disconnectable:u};if(e.staticSensitivity){let d=qt.call(o,l);return this.disconnectables(e.signal,u,c,d)}return this.disconnectables(e.signal,u,c)}observeSync(t,r,e={}){[t,r,e={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let s=e.timing==="intercept"?"intercept":"sync",f=e.subtree==="cross-roots"?"cross-roots":e.subtree?"subtree":"children";this.registry(s).size||kt.call(o,s,g=>{this.forEachMatchingContext(s,g,dt)});let u=new o.MutationObserver(g=>g.forEach(O=>{Array.isArray((O=Nt.call(o,O)).event)||dt.call(o,d,O,i)}));u.observe(i,{childList:!0,subtree:e.subtree&&!0});let c={disconnect(){u.disconnect(),h.delete(d),h.size||a.delete(i)}},l=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),d={context:i,spec:t,callback:r,params:e,signalGenerator:l,disconnectable:c},a=this.registry(s,f);a.has(i)||a.set(i,new Set);let h=a.get(i);if(h.add(d),e.staticSensitivity){let g=qt.call(o,d);return this.disconnectables(e.signal,c,l,g)}return this.disconnectables(e.signal,c,l)}track(t,r,e={}){return e={subtree:!0,...e},this.observe(t,i=>{i.entrants.length&&r(!0,Array.isArray(t)?i.entrants:i.entrants[0]),i.exits.length&&r(!1,Array.isArray(t)?i.exits:i.exits[0])},e)}};function qt(n){let t=this,{context:r,spec:e,callback:i,params:o,signalGenerator:s}=n,f=e.filter(h=>h.kind==="css"),u=h=>h.match(/\.([\w-]+)/g)?.length?["class"]:[],c=h=>h.match(/#([\w-]+)/g)?.length?["id"]:[],l=h=>[...h.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(g=>g[1]).concat(u(h)).concat(c(h));if(!(n.$attrs=Array.from(new Set(f.filter(h=>(h+"").includes("[")).reduce((h,g)=>h.concat(l(g+"")),[])))).length)return;let d=new Set,a=new Set;return d.push=h=>(a.delete(h),d.add(h)),a.push=h=>(d.delete(h),a.add(h)),n.$deliveryCache={entrants:d,exits:a},new q(r,t).observe(n.$attrs,h=>{let g=new Map,O=p=>(g.has(p)||g.set(p,{target:p,entrants:[],exits:[],type:"static",event:null}),g.get(p)),m=new WeakMap,x=p=>(m.has(p)||m.set(p,f.some(_=>p.matches(_+""))),m.get(p));for(let p of h)["entrants","exits"].forEach(_=>{o.generation&&_!==o.generation||n.$deliveryCache[_].has(p.target)||(_==="entrants"?!x(p.target):x(p.target))||(n.$deliveryCache[_].push(p.target),O(p.target)[_].push(p.target),O(p.target).event=p.event)});for(let[,p]of g){let _=s?.generate()||{};i(p,_,r)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function dt(n,t){let{context:r,spec:e,callback:i,params:o,signalGenerator:s,$deliveryCache:f}=n,u={...t,entrants:[],exits:[]};if(o.eventDetails||delete u.event,["entrants","exits"].forEach(l=>{if(!(o.generation&&l!==o.generation)&&(e.length?u[l]=re.call(this,e,o.subtree==="cross-roots",t[l],t.event!=="parse"):u[l]=[...t[l]],!!f))for(let d of u[l])f[l].push(d)}),!u.entrants.length&&!u.exits.length)return;let c=s?.generate()||{};i(u,c,r)}function re(n,t,r,e){r=Array.isArray(r)?r:[...r];let i=(o,s)=>{if(s.type==="selector"){let f=s.isXpathAttr?[]:o.filter(u=>s.kind==="xpath"?St(this,u,s+""):u.matches&&u.matches(s+""));if((e||s.isXpathAttr)&&(f=o.reduce((u,c)=>s.kind==="xpath"?[...u,...tt(this,c,s,e)]:c.querySelectorAll?[...u,...c.querySelectorAll(s+"")]:u,f)),f.length)return f}else if(o.includes(s.content)||e&&o.some(f=>z(this,f,s.content,t)))return[s.content]};return r.$$searchCache||(r.$$searchCache=new Map),n.reduce((o,s)=>{let f;return r.$$searchCache.has(s.content)?f=r.$$searchCache.get(s.content):(f=i(r,s)||[],s.type==="instance"&&r.$$searchCache.set(s.content,f)),o.concat(f)},[])}function Nt({target:n,addedNodes:t,removedNodes:r}){let e=this,i;return i=A(t).reduce((o,s)=>o||e.webqit.realdom.domInterceptionRecords?.get(s),null),i=A(r).reduce((o,s)=>o||e.webqit.realdom.domInterceptionRecords?.get(s),i),i=i||e.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:t,exits:r,type:"observation",event:i}}function kt(n,t){let r=this,{webqit:e,document:i,Node:o,CharacterData:s,Element:f,HTMLElement:u,HTMLTemplateElement:c,DocumentFragment:l}=r;e.realdom.domInterceptionHooks||Object.defineProperty(e.realdom,"domInterceptionHooks",{value:new Map}),e.realdom.domInterceptionNoRecurse||Object.defineProperty(e.realdom,"domInterceptionNoRecurse",{value:new Map}),e.realdom.domInterceptionHooks.has(n)||e.realdom.domInterceptionHooks.set(n,new Set),e.realdom.domInterceptionHooks.get(n).add(t);let d=()=>e.realdom.domInterceptionHooks.get(n).delete(t);if(e.realdom.domInterceptionHooks?.intercepting)return d;console.warn("DOM mutation APIs are now being intercepted."),e.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(e.realdom,"domInterceptionRecords",{value:new Map});let a=(m,x,p)=>{e.realdom.domInterceptionNoRecurse.set(m,x);let _=p();return e.realdom.domInterceptionNoRecurse.delete(m),_},h=(m,x)=>{m.entrants.concat(m.exits).forEach(_=>{clearTimeout(e.realdom.domInterceptionRecords.get(_)?.timeout),e.realdom.domInterceptionRecords.set(_,m.event);let $=setTimeout(()=>{e.realdom.domInterceptionRecords.delete(_)},0);Object.defineProperty(m.event,"timeout",{value:$,configurable:!0})}),e.realdom.domInterceptionHooks.get("intercept")?.forEach(_=>_(m));let p=x();return e.realdom.domInterceptionHooks.get("sync")?.forEach(_=>_(m)),p},g={characterData:Object.create(null),other:Object.create(null)};["insertBefore","insertAdjacentElement","insertAdjacentHTML","setHTML","replaceChildren","replaceWith","remove","replaceChild","removeChild","before","after","append","prepend","appendChild"].forEach(m=>{function x(...p){let _=this instanceof s?g.characterData:g.other,$=()=>_[m].call(this,...p);if(!(this instanceof s||this instanceof f||this instanceof l)||e.realdom.domInterceptionNoRecurse.get(this)===m)return $();let P=[],S=[],B=this;["insertBefore"].includes(m)?S=[p[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(m)?(S=[p[1]],["beforebegin","afterend"].includes(p[0])&&(B=this.parentNode)):["setHTML","replaceChildren"].includes(m)?(P=[...this.childNodes],S=m==="replaceChildren"?[...p]:[p[0]]):["replaceWith","remove"].includes(m)?(P=[this],S=m==="replaceWith"?[...p]:[],B=this.parentNode):["replaceChild"].includes(m)?(P=[p[1]],S=[p[0]]):["removeChild"].includes(m)?P=[...p]:(S=[...p],["before","after"].includes(m)&&(B=this.parentNode));let N=m;if(["insertAdjacentHTML","setHTML"].includes(m)){let yt=this.nodeName;if(m==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(p[0])){if(!this.parentNode)return _[m].call(this,...p);yt=this.parentNode.nodeName}let J=i.createElement(yt);_.setHTML.call(J,S[0],m==="setHTML"?p[1]:{}),S=[...J.childNodes],m==="insertAdjacentHTML"?(N="insertAdjacentElement",p[1]=new l,a(p[1],"append",()=>p[1].append(...J.childNodes))):(N="replaceChildren",p=[...J.childNodes])}return h({target:B,entrants:S,exits:P,type:"interception",event:[this,m]},()=>_[N].call(this,...p))}["insertBefore","replaceChild","removeChild","appendChild"].includes(m)?(g.other[m]=o.prototype[m],o.prototype[m]=x):(["after","before","remove","replaceWith"].includes(m)&&(g.characterData[m]=s.prototype[m],s.prototype[m]=x),f.prototype[m]&&(g.other[m]=f.prototype[m],f.prototype[m]=x))});let O=Object.create(null);return["outerHTML","outerText","innerHTML","innerText","textContent","nodeValue"].forEach(m=>{let x=["textContent","nodeValue"].includes(m)?o:["outerText","innerText"].includes(m)?u:f;O[m]=Object.getOwnPropertyDescriptor(x.prototype,m),Object.defineProperty(x.prototype,m,{...O[m],set:function(p){let _=()=>O[m].set.call(this,p);if(!(this instanceof f))return _();let $=[],P=[],S=this;if(["outerHTML","outerText"].includes(m)?($=[this],S=this.parentNode):$=[...this.childNodes],["outerHTML","innerHTML"].includes(m)){let N=this.nodeName;if(m==="outerHTML"){if(!this.parentNode)return _();N=this.parentNode.nodeName}let H=i.createElement(N==="TEMPLATE"?"div":N);O[m].set.call(H,p),P=this instanceof c?[]:[...H.childNodes],m==="outerHTML"?(p=new l,a(p,"append",()=>p.append(...H.childNodes)),_=()=>a(this,"replaceWith",()=>f.prototype.replaceWith.call(this,p))):this instanceof c?_=()=>a(this.conten,"replaceChildren",()=>this.content.replaceChildren(...H.childNodes)):_=()=>a(this,"replaceChildren",()=>f.prototype.replaceChildren.call(this,...H.childNodes))}return h({target:S,entrants:P,exits:$,type:"interception",event:[this,m]},_)}})}),["append","prepend","replaceChildren"].forEach(m=>{[i,l.prototype].forEach(x=>{let p=x[m];x[m]=function(..._){if(e.realdom.domInterceptionNoRecurse.get(this)===m)return p.call(this,..._);let $=m==="replaceChildren"?[...this.childNodes]:[];return h({target:this,entrants:_,exits:$,type:"interception",event:[this,m]},()=>p.call(this,..._))}})}),d}function Ht(){ne.call(this),ie.call(this),oe.call(this)}function ne(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function ie(){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 oe(){let n=this;n.Element.prototype.matches||(n.Element.prototype.matches=n.Element.prototype.matchesSelector||n.Element.prototype.mozMatchesSelector||n.Element.prototype.msMatchesSelector||n.Element.prototype.oMatchesSelector||n.Element.prototype.webkitMatchesSelector||function(t){for(var r=(this.document||this.ownerDocument).querySelectorAll(t),e=r.length;--e>=0&&r.item(e)!==this;);return e>-1})}function Lt(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.realdom)return n.webqit.realdom;n.webqit.realdom={},Ht.call(n),n.webqit.realdom.meta=(...r)=>se.call(n,...r),n.webqit.realdom.ready=(...r)=>pt.call(n,...r),n.webqit.realdom.realtime=(r,e="dom")=>{if(e==="dom")return new Q(r,n);if(e==="attr")return new q(r,n)};let t=new X(n);return n.webqit.realdom.schedule=(r,...e)=>t[`on${r}`](...e),n.webqit.realdom.synthesizeWhile=(...r)=>t.synthesizeWhile(...r),n.webqit.realdom}function pt(...n){let t="interactive",r;D(n[0])?(t=n[0],w(n[1])&&(r=n[1])):w(n[0])&&(r=n[0]);let e={interactive:["interactive","complete"],complete:["complete"]};if(!e[t])throw new Error(`Invalid ready-state timing: ${t}.`);let i=this;if(!r)return i.webqit.realdom.readyStatePromises||(i.webqit.realdom.readyStatePromises={interactive:new Promise(o=>pt.call(this,"interactive",o)),complete:new Promise(o=>pt.call(this,"complete",o))}),i.webqit.realdom.readyStatePromises[t];if(e[t].includes(i.document.readyState))return r(i);i.webqit.realdom.readyStateCallbacks||(i.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},i.document.addEventListener("readystatechange",()=>{let o=i.document.readyState;for(let s of i.webqit.realdom.readyStateCallbacks[o].splice(0))s(i)},!1)),i.webqit.realdom.readyStateCallbacks[t].push(r)}function se(n){let t=this,r={},e;return(e=t.document.querySelector(`meta[name="${n}"]`))&&(r=(e.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(f=>f.trim());return ut(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:C(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return e.content},json(){return JSON.parse(JSON.stringify(r))}}}function rt(n,t){return typeof n!="string"?n:n.replace(/\w\S*/g,function(r){return r.charAt(0).toUpperCase()+(typeof t!==void 0&&t?r.substr(1).toLowerCase():r.substr(1))})}var F=(...n)=>I("oohtml",...n),ce={};function Ft(n,t,r){let e=this,i=Lt.call(e);ce.window=e,e.webqitConfig||(e.webqitConfig=i.meta("webqit").json()),e.webqit||(e.webqit={}),e.webqit.oohtml||(e.webqit.oohtml={}),e.webqit.oohtml.configs||(e.webqit.oohtml.configs={});let o=n.toUpperCase().replace("-","_");if(!e.webqit.oohtml.configs[o]){e.webqit.oohtml.configs[o]={};let s=e.webqit.oohtml.configs[o];G(2,s,r,t,i.meta(n).json()),e.webqitConfig.prefix&&Object.keys(s).forEach(f=>{Object.keys(s[f]).forEach(u=>{f==="api"&&typeof s[f][u]=="string"?s[f][u]=`${e.webqitConfig.prefix}${rt(s[f][u])}`:["attr","elements"].includes(f)&&s[f][u]?.startsWith("data-")===!1&&(s[f][u]=`${e.webqitConfig.prefix}-${s[f][u]}`)})})}return{config:e.webqit.oohtml.configs[o],realdom:i,window:e}}function nt(n,t){return[...n].reduce(([r,e,i],o)=>!r&&e===0&&(Array.isArray(t)?t:[t]).includes(o)?[r,e,[""].concat(i)]:(!r&&["(","[","{"].includes(o)&&!i[0].endsWith("\\")&&e++,!r&&[")","]","}"].includes(o)&&!i[0].endsWith("\\")&&e--,['"',"'","`"].includes(o)&&!i[0].endsWith("\\")&&(r=r===o?null:r||o),i[0]+=o,[r,e,i]),[null,0,[""]])[2].reverse()}function _t(n={}){let{config:t,window:r}=Ft.call(this,"data-binding",n,{attr:{expr:"expr",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"}});({CONTEXT_API:t.CONTEXT_API,BINDINGS_API:t.BINDINGS_API,HTML_IMPORTS:t.HTML_IMPORTS}=r.webqit.oohtml.configs),t.attrSelector=`[${r.CSS.escape(t.attr.expr)}]`;let e=(i,o)=>{let s=`starts-with(., "${i}")`,f=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${f}`};t.discreteBindingsSelector=`comment()[${e(t.tokens.tagStart,t.tokens.tagEnd)}]`,ue.call(r,t)}function ue(n){let t=this,{webqit:{realdom:r}}=t;r.realtime(t.document).subtree(`(${n.discreteBindingsSelector})`,e=>{jt.call(this,...e.exits),ae.call(this,n,...e.entrants)},{live:!0}),r.realtime(t.document).subtree(n.attrSelector,e=>{jt.call(this,...e.exits),de.call(this,n,...e.entrants)},{live:!0,timing:"sync",staticSensitivity:!0})}function Bt(n,t){let{webqit:{realdom:r,Observer:e,DOMBindingsContext:i}}=this;if(F(t).has("data-binding"))return F(t).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(u,c,...l)=>{r.schedule("write",()=>u[c](...l))},o.$assign__=(u,c,l)=>{r.schedule("write",()=>u[c]=l)},e.intercept(o,{get:(u,c,l)=>{if(!(u.key in o)){let d={...i.createRequest(u.key),live:!0,signal:s.signal};t[n.CONTEXT_API.api.contexts].request(d,a=>{e.set(o,u.key,a)})}return l(o[u.key]??(u.key in globalThis?globalThis[u.key]:void 0))},has:(u,c,l)=>l(!0)});let f={scope:o,abortController:s,bindings:new Map};return F(t).set("data-binding",f),f}function jt(...n){for(let t of n){let r=t.nodeName==="#text"?t.parentNode:t,{bindings:e,abortController:i}=F(r).get("data-binding")||{};if(!e?.has(t))return;e.get(t).state.dispose(),e.get(t).signals?.forEach(o=>o.abort()),e.delete(t),e.size||(i.abort(),F(r).delete("data-binding"))}}async function ae(n,...t){let r=this,{webqit:{QuantumAsyncFunction:e}}=r,i=s=>{let f=n.tokens.tagStart.split("").map(g=>`\\${g}`).join(""),u=n.tokens.tagEnd.split("").map(g=>`\\${g}`).join(""),c=n.tokens.stateStart.split("").map(g=>g===" "?"(?:\\s+)?":`\\${g}`).join(""),l=n.tokens.stateEnd.split("").map(g=>`\\${g}`).join(""),d=`^${f}(.*?)(?:${c}(\\d+)${l}(?:\\s+)?)?${u}$`,[,a,h]=s.match(new RegExp(d));return{raw:s,expr:a,span:parseInt(h??0)}},o=t.reduce((s,f)=>{if(f.isBound)return s;let u=i(f.nodeValue),c=f;if(u.span){if(c=f.nextSibling,c?.nodeName!=="#text"||c.nodeValue.length<u.span)return s;c.nodeValue.length>u.span&&c.splitText(u.span)}else c=f.ownerDocument.createTextNode(""),f.after(c);c.isBound=!0;let l=f;return r.webqit.env!=="server"&&(l.remove(),l=null),s.concat({textNode:c,template:u,anchorNode:l})},[]);for(let{textNode:s,template:f,anchorNode:u}of o){let c=me(n,f.expr),{scope:l,bindings:d}=Bt.call(this,n,s.parentNode);Object.defineProperty(s,"$oohtml_internal_databinding_anchorNode",{value:u,configurable:!0}),d.set(s,{state:await(await c.bind(s,l)).execute()})}}var ht=new Map;function me(n,t){if(ht.has(t))return ht.get(t);let r=`let content = ((${t}) ?? '') + '';`;r+="$assign__(this, 'nodeValue', content);",r+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${n.tokens.tagStart}${j(t)}${n.tokens.stateStart}" + content.length + "${n.tokens.stateEnd} ${n.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:e}}=this,i=new e(r);return ht.set(t,i),i}async function de(n,...t){for(let r of t){let e=pe(n,r.getAttribute(n.attr.expr)),{scope:i,bindings:o}=Bt.call(this,n,r),s=[];Object.defineProperty(r,"$oohtml_internal_databinding_signals",{value:s,configurable:!0}),o.set(r,{signals:s,state:await(await e.bind(r,i)).execute()})}}var gt=new Map;function pe(n,t){if(gt.has(t))return gt.get(t);let r={},e=nt(t,";").map(s=>{let[f,u]=nt(s,":").map(h=>h.trim()),c=f[0],l=f.slice(1).trim(),d=`(${u})`,a=`(${d} ?? '')`;if(c==="&")return l.startsWith("--")?`$exec__(this.style, 'setProperty', "${j(l)}", ${a});`:`$assign__(this.style, "${j(l)}", ${a});`;if(c==="%")return`$exec__(this.classList, 'toggle', "${j(l)}", !!${d});`;if(c==="~")return l.startsWith("?")?`$exec__(this, 'toggleAttribute', "${j(l.substring(1).trim())}", !!${d});`:`$exec__(this, 'setAttribute', "${j(l)}", ${a});`;if(c==="@"){if(r[l])throw new Error(`Duplicate binding: ${f}.`);if(r[l]=!0,l==="text")return`$assign__(this, 'textContent', ${a});`;if(l==="html")return`$exec__(this, 'setHTML', ${a});`;if(l==="items"){let[h,g]=nt(u,"/");if(!g)throw new Error(`Invalid ${c}items spec: ${s}; no import specifier.`);let[O,m,x,p]=h.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!O)throw new Error(`Invalid ${c}items spec: ${s}.`);if(m.startsWith("(")?m=m.trim().slice(1,-1).split(",").map($=>$.trim()):m=[m],m.length>(x==="in"?3:2))throw new Error(`Invalid ${c}items spec: ${s}.`);let _=x==="in"?m[2]:m[1]||"$index__";return`
1
+ (()=>{function b(n){return!Array.isArray(n)&&typeof n=="object"&&n}function y(n){return Array.isArray(n)}function it(n,t,r=null){return y(t)?n.filter(e=>r?t.filter(i=>r(e,i)).length:t.indexOf(e)!==-1):[]}function I(n,...t){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new R}),!arguments.length)return globalThis.webqit.refs;let r=globalThis.webqit.refs.get(n);r||(r=new R,globalThis.webqit.refs.set(n,r));let e,i;for(;e=t.shift();)(i=r)&&!(r=r.get(e))&&(r=new R,i.set(e,r));return r}var R=class extends Map{constructor(...t){super(...t),this.observers=new Set}set(t,r){let e=super.set(t,r);return this.fire("set",t,r,t),e}delete(t){let r=super.delete(t);return this.fire("delete",t),r}has(t){return this.fire("has",t),super.has(t)}get(t){return this.fire("get",t),super.get(t)}keyNames(){return Array.from(super.keys())}observe(t,r,e){let i={type:t,key:r,callback:e};return this.observers.add(i),()=>this.observers.delete(i)}unobserve(t,r,e){if(Array.isArray(t)||Array.isArray(r))throw new Error('The "type" and "key" arguments can only be strings.');for(let i of this.observers)!(Y([t,"*"],i.type)&&Y([r,"*"],i.key)&&i.callback===e)||this.observers.delete(i)}fire(t,r,...e){for(let i of this.observers)!(Y([t,"*"],i.type)&&Y([r,"*"],i.key))||i.callback(...e)}},Y=(n,t)=>Array.isArray(t)?it(n,t).length:n.includes(t);function L(n){return typeof n=="function"}function W(n){return n===null||n===""}function M(n){return arguments.length&&(n===void 0||typeof n>"u")}function v(n){return Array.isArray(n)||typeof n=="object"&&n||L(n)}function ot(n){return W(n)||M(n)||n===!1||n===0||v(n)&&!Object.keys(n).length}function w(n){return L(n)||n&&{}.toString.call(n)==="[object function]"}function V(n){return n instanceof Number||typeof n=="number"}function C(n){return V(n)||n!==!0&&n!==!1&&n!==null&&n!==""&&!isNaN(n*1)}function D(n){return n instanceof String||typeof n=="string"&&n!==null}function st(n){return!D(n)&&!M(n.length)}function Z(n,...t){return t.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n}function ft(e,t){t=t||Object.prototype,t=t&&!y(t)?[t]:t;for(var r=[],e=e;e&&(!t||t.indexOf(e)<0)&&e.name!=="default";)r.push(e),e=e?Object.getPrototypeOf(e):null;return r}function lt(n,t){var r=[];return ft(n,t).forEach(e=>{Z(r,...Object.getOwnPropertyNames(e))}),r}function T(n,t,r=!1,e=!1,i=!1){var o=0,s=n.shift();if((C(s)||s===!0||s===!1)&&(o=s,s=n.shift()),!n.length)throw new Error("_merge() requires two or more array/objects.");return n.forEach((f,u)=>{!v(f)&&!w(f)||(r?lt(f):Object.keys(f)).forEach(c=>{if(!!t(c,s,f,u)){var l=s[c],d=f[c];if((y(l)&&y(d)||b(l)&&b(d))&&(o===!0||o>0))s[c]=y(l)&&y(d)?[]:{},T([C(o)?o-1:o,s[c],l,d],t,r,e,i);else if(y(s)&&y(f))e?s[c]=d:s.push(d);else try{i?Object.defineProperty(s,c,Object.getOwnPropertyDescriptor(f,c)):s[c]=f[c]}catch{}}})}),s}function G(...n){return T(n,(t,r,e)=>!0,!1,!1,!1)}function A(n,t=!0){return y(n)?n:!t&&b(n)?[n]:n!==!1&&n!==0&&ot(n)?[]:st(n)?Array.prototype.slice.call(n):b(n)?Object.values(n):[n]}function U(n,t,r={},e={}){t=A(t).slice();for(var i=n;!M(i)&&!W(i)&&t.length;){var o=t.shift();if(!(r.get?r.get(i,o):v(i)?o in i:i[o])){e.exists=!1;return}i=r.get?r.get(i,o):i[o]}return e.exists=!0,i}function ut(n,t,r,e={},i={}){let o=(l,d,a)=>i.set?i.set(l,d,a):(C(t[f])&&y(l)?l.push(a):l[d]=a,!0);t=A(t);for(var s=n,f=0;f<t.length;f++)if(f<t.length-1){if(!s||!v(s)&&!w(s))return!1;var u=U(s,t[f],i);if(!v(u)){if(i.buildTree===!1)return!1;u=w(i.buildTree)?i.buildTree(f):C(t[f+1])?[]:{};var c=o(s,t[f],u);if(!c)return!1}s=u}else return o(s,t[f],r)}var X=class{constructor(t,r=!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}),!r&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(t){this._synthesis++,this._fulfill();let r=await t();return this._synthesis--,r}_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,r=!1){if(r)return new Promise(e=>{this.synthesis?e(t()):this.readCallbacks.add(()=>{e(t())})});this.synthesis?Promise.resolve().then(t):this.readCallbacks.add(t)}onwrite(t,r=!1){if(r)return new Promise(e=>{this.synthesis?e(t()):this.writeCallbacks.add(()=>{e(t())})});this.synthesis?Promise.resolve().then(t):this.writeCallbacks.add(t)}cycle(t,r,e){this.onread(()=>{let i=t(e),o=s=>{s!==void 0&&this.onwrite(()=>{let f=r(s,e),u=c=>{c!==void 0&&this.cycle(t,r,c)};f instanceof Promise?f.then(u):u(f)})};i instanceof Promise?i.then(o):o(i)})}};function $t(n){return(n=n.trim())&&n.startsWith("(")&&n.endsWith(")")}function tt(n,t,r,e=!0){r=(Array.isArray(r)?r:[r]).map(s=>(s+"").replace("(",e?"(.//":"(./")).join("|");let i=[],o;try{let s=n.document.evaluate(r,t,null,n.XPathResult.ANY_TYPE);for(;o=s.iterateNext();)i.push(o)}catch{}return i}function St(n,t,r){r=(Array.isArray(r)?r:[r]).map(e=>(e+"").replace("(","(self::")).join("|");try{return n.document.evaluate(`${r}`,t,null,n.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function z(n,t,r,e=!1){let i=t.getRootNode(),o=r.getRootNode();return i===o?t.contains(r):e&&o instanceof n.ShadowRoot?z(n,t,o.host,e):!1}function It(n,t="|"){return[...n].reduce(([r,e,i,o],s)=>!r&&e===0&&(Array.isArray(t)?t:[t]).includes(s)?[r,e,[""].concat(i)]:(!r&&["(","[","{"].includes(s)&&!i[0].endsWith("\\")&&e++,!r&&[")","]","}"].includes(s)&&!i[0].endsWith("\\")&&e--,['"',"'","`"].includes(s)&&!i[0].endsWith("\\")&&(r=r===s?null:r||s),i[0]+=s,[r,e,i]),[null,0,[""]])[2].reverse()}var E=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:$t(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=It(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var k=class{constructor(t,r,e){this.context=t,this.namespace=r,this.window=t.defaultView||t.ownerDocument?.defaultView||e,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if(w(t[0])?t=[[],...t]:b(t[0])&&!(t[0]instanceof E)&&t.length===1?t=[[],void 0,t[0]]:b(t[1])&&t.length===2?t=[A(t[0],!1),void 0,t[1]]:t[0]=A(t[0],!1),t[0].filter(r=>typeof r!="string"&&!(r instanceof E)&&!(r 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(r=>r instanceof E?r:new E(r)),t}registry(...t){return I("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,r,e){let{window:i}=this,o=Array.isArray(r)?r:[r],s=new Set;for(let[f,u]of this.registry(t))for(let[c,l]of u){let d=o.filter(a=>z(i,c,a.target,f==="cross-roots")?["subtree","cross-roots"].includes(f)||a.target===c:!1);if(!!d.length){Array.isArray(r)||(d=d[0]);for(let a of l)s.add([a,d,c])}}for(let[f,u,c]of s)e.call(i,f,u,c)}disconnectables(t,...r){let e={disconnect(){r.forEach(i=>i&&w(i.disconnect)&&i.disconnect()||w(i)&&i()||b(i)&&(i.disconnected=!0))}};return t&&t.addEventListener("abort",()=>e.disconnect()),e}};var q=class extends k{constructor(t,...r){super(t,"attr",...r)}get(t,r=void 0,e={}){let i=typeof t=="string"||t instanceof E;[t=[],r=void 0,e={}]=this.resolveArgs(arguments);let{context:o}=this,s=Pt(o,t);if(!r)return s;let f=e.lifecycleSignals&&this.createSignalGenerator();if(i)for(let u of s){let c=f?.generate()||{};r(u,c,o)}else{let u=f?.generate()||{};r(s,u,o)}if(e.live){f&&(e={...e,signalGenerator:f});let u=this.observe(i?t[0]:t,r,{newValue:!0,...e});return this.disconnectables(e.signal,u)}}observe(t,r,e={}){let i=typeof t=="string"||t instanceof E;if([t=[],r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(i?t[0]:t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:o,window:s,webqit:f}=this;e.eventDetails&&!f.realdom.attrInterceptionHooks?.intercepting&&Et.call(s,"intercept",()=>{});let u=new s.MutationObserver(a=>{a=Tt(a).map(h=>Mt.call(s,h)),Ct.call(s,d,a,o)}),c={attributes:!0,attributeOldValue:e.oldValue,subtree:e.subtree&&!0};t.length&&(c.attributeFilter=t.map(a=>a+"")),u.observe(o,c);let l=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),d={context:o,spec:t,callback:r,params:e,atomics:new Map,originalFilterIsString:i,signalGenerator:l,disconnectable:u};return this.disconnectables(e.signal,u,l)}observeSync(t,r,e={}){let i=typeof t=="string"||t instanceof E;[t,r,e={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let f=e.timing==="intercept"?"intercept":"sync",u=e.subtree==="cross-roots"?"cross-roots":e.subtree?"subtree":"children";this.registry(f).size||Et.call(s,f,g=>{this.forEachMatchingContext(f,g,Ct)});let c={disconnect(){h.delete(d),h.size||a.delete(o)}},l=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),d={context:o,spec:t,callback:r,params:e,atomics:new Map,originalFilterIsString:i,signalGenerator:l,disconnectable:c},a=this.registry(f,u);a.has(o)||a.set(o,new Set);let h=a.get(o);return h.add(d),this.disconnectables(e.signal,c,l)}};function Tt(n){return n.reduce((t,r,e)=>t[e-1]?.attributeName===r.attributeName||I(r.target,"internalAttrInteractions").get(r.attributeName)?t:t.concat(r),[])}function Ct(n,t){let{context:r,spec:e,callback:i,params:o,atomics:s,originalFilterIsString:f,signalGenerator:u}=n,c=e.map(a=>a+"");if(o.atomic&&!s.size?t=Pt(r,e,t):o.timing!=="async"&&e.length&&(t=t.filter(a=>c.includes(a.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(a=>{let h;return o.eventDetails||({event:h,...a}=a),!o.oldValue&&"oldValue"in a&&({oldValue:h,...a}=a),!o.newValue&&"value"in a?{value:h,...a}=a:o.newValue&&typeof a.value>"u"&&(a={...a,value:et(a.target,a.name,()=>a.target.getAttribute(a.name))}),a})),o.atomic&&(t.forEach(a=>s.set(a.name,a)),t=Array.from(s.entries()).map(([,a])=>a));let l=f?t[0]:t,d=u?.generate()||{};i(l,d,r)}function et(n,t,r){let e=I(n,"internalAttrInteractions").get(t);I(n,"internalAttrInteractions").set(t,!0);let i=r();return I(n,"internalAttrInteractions").set(t,e),i}function Pt(n,t,r=[]){let e={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",r.find(s=>s.name===o)||{target:n,name:o,value:et(n,o,()=>n.getAttribute(o)),...e})):Array.from(n.attributes).map(o=>r.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:et(n,o.nodeName,()=>o.nodeValue),...e})}function Mt({target:n,attributeName:t,value:r,oldValue:e}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(n)||{})[t]?.[0]||"mutation";return{target:n,name:t,value:r,oldValue:e,type:"observation",event:s}}function Et(n,t){let r=this,{webqit:e,document:i,Element:o}=r;e.realdom.attrInterceptionHooks||Object.defineProperty(e.realdom,"attrInterceptionHooks",{value:new Map}),e.realdom.attrInterceptionHooks.has(n)||e.realdom.attrInterceptionHooks.set(n,new Set),e.realdom.attrInterceptionHooks.get(n).add(t);let s=()=>e.realdom.attrInterceptionHooks.get(n).delete(t);if(e.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),e.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(e.realdom,"attrInterceptionRecords",{value:new Map});let f=(l,d)=>{e.realdom.attrInterceptionRecords.has(l.target)||e.realdom.attrInterceptionRecords.set(l.target,{});let a=e.realdom.attrInterceptionRecords.get(l.target);if(a[l.name]=a[l.name]||[],a[l.name].unshift(l.event),I(l.target,"internalAttrInteractions").get(l.name))return d();e.realdom.attrInterceptionHooks.get("intercept")?.forEach(g=>g([l]));let h=d();return e.realdom.attrInterceptionHooks.get("sync")?.forEach(g=>g([l])),h};new r.MutationObserver(l=>{l=l.filter(d=>!(r.webqit.realdom.attrInterceptionRecords?.get(d.target)||{})[d.attributeName]?.shift()),l=Tt(l).map(d=>Mt.call(r,d)),l.length&&(e.realdom.attrInterceptionHooks.get("intercept")?.forEach(d=>d(l)),e.realdom.attrInterceptionHooks.get("sync")?.forEach(d=>d(l)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let c=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(l=>{c[l]=o.prototype[l],o.prototype[l]=function(...d){let a,h=et(this,d[0],()=>this.getAttribute(d[0]));["setAttribute","toggleAttribute"].includes(l)&&(a=d[1]),l==="toggleAttribute"&&a===void 0&&(a=h===null);let g={target:this,name:d[0],value:a,oldValue:h,type:"interception",event:[this,l]};return f(g,()=>c[l].call(this,...d))}}),s}var Q=class extends k{constructor(t,...r){super(t,"tree",...r)}attr(t,r=void 0,e={}){let{context:i,window:o}=this;return new q(i,o).get(...arguments)}query(t,r=void 0,e={}){[t,r=void 0,e={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=c=>(o.has(c)||o.set(c,{target:c,entrants:[],exits:[],type:"query",event:null}),o.get(c));if(!e.generation||e.generation==="entrants"){if(!t.length)[...i.children].forEach(c=>s(i).entrants.push(c));else if(t.every(c=>c.type==="selector")){let[c,l]=t.reduce(([a,h],g)=>g.kind==="xpath"?[a,h.concat(g)]:[a.concat(g),h],[[],[]]),d=[];e.subtree?(c.length&&d.push(...i.querySelectorAll(c.join(","))),l.length&&d.push(...tt(this.window,i,l))):(c.length&&d.push(...[...i.children].filter(a=>a.matches(c))),l.length&&d.push(...tt(this.window,i,l,!1))),d.forEach(a=>s(a.parentNode||i).entrants.push(a))}}if(!r)return o;let f={disconnected:!1},u=r&&e.lifecycleSignals&&this.createSignalGenerator();for(let[,c]of o){if(f.disconnected)break;let l=u?.generate()||{};r(c,l,i)}if(e.live){u&&(e={...e,signalGenerator:u});let c=this.observe(t,r,e);return this.disconnectables(e.signal,f,c)}return this.disconnectables(e.signal,f,u)}children(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!1})}subtree(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!0})}observe(t,r,e={}){if([t,r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:i,window:o,webqit:s,document:f}=this;e.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(f.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&kt.call(o,"sync",()=>{});let u=new o.MutationObserver(d=>d.forEach(a=>{dt.call(o,l,Nt.call(o,a),i)}));u.observe(i,{childList:!0,subtree:e.subtree&&!0});let c=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),l={context:i,spec:t,callback:r,params:e,signalGenerator:c,disconnectable:u};if(e.staticSensitivity){let d=qt.call(o,l);return this.disconnectables(e.signal,u,c,d)}return this.disconnectables(e.signal,u,c)}observeSync(t,r,e={}){[t,r,e={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let s=e.timing==="intercept"?"intercept":"sync",f=e.subtree==="cross-roots"?"cross-roots":e.subtree?"subtree":"children";this.registry(s).size||kt.call(o,s,g=>{this.forEachMatchingContext(s,g,dt)});let u=new o.MutationObserver(g=>g.forEach(O=>{Array.isArray((O=Nt.call(o,O)).event)||dt.call(o,d,O,i)}));u.observe(i,{childList:!0,subtree:e.subtree&&!0});let c={disconnect(){u.disconnect(),h.delete(d),h.size||a.delete(i)}},l=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),d={context:i,spec:t,callback:r,params:e,signalGenerator:l,disconnectable:c},a=this.registry(s,f);a.has(i)||a.set(i,new Set);let h=a.get(i);if(h.add(d),e.staticSensitivity){let g=qt.call(o,d);return this.disconnectables(e.signal,c,l,g)}return this.disconnectables(e.signal,c,l)}track(t,r,e={}){return e={subtree:!0,...e},this.observe(t,i=>{i.entrants.length&&r(!0,Array.isArray(t)?i.entrants:i.entrants[0]),i.exits.length&&r(!1,Array.isArray(t)?i.exits:i.exits[0])},e)}};function qt(n){let t=this,{context:r,spec:e,callback:i,params:o,signalGenerator:s}=n,f=e.filter(h=>h.kind==="css"),u=h=>h.match(/\.([\w-]+)/g)?.length?["class"]:[],c=h=>h.match(/#([\w-]+)/g)?.length?["id"]:[],l=h=>[...h.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(g=>g[1]).concat(u(h)).concat(c(h));if(!(n.$attrs=Array.from(new Set(f.filter(h=>(h+"").includes("[")).reduce((h,g)=>h.concat(l(g+"")),[])))).length)return;let d=new Set,a=new Set;return d.push=h=>(a.delete(h),d.add(h)),a.push=h=>(d.delete(h),a.add(h)),n.$deliveryCache={entrants:d,exits:a},new q(r,t).observe(n.$attrs,h=>{let g=new Map,O=p=>(g.has(p)||g.set(p,{target:p,entrants:[],exits:[],type:"static",event:null}),g.get(p)),m=new WeakMap,x=p=>(m.has(p)||m.set(p,f.some(_=>p.matches(_+""))),m.get(p));for(let p of h)["entrants","exits"].forEach(_=>{o.generation&&_!==o.generation||n.$deliveryCache[_].has(p.target)||(_==="entrants"?!x(p.target):x(p.target))||(n.$deliveryCache[_].push(p.target),O(p.target)[_].push(p.target),O(p.target).event=p.event)});for(let[,p]of g){let _=s?.generate()||{};i(p,_,r)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function dt(n,t){let{context:r,spec:e,callback:i,params:o,signalGenerator:s,$deliveryCache:f}=n,u={...t,entrants:[],exits:[]};if(o.eventDetails||delete u.event,["entrants","exits"].forEach(l=>{if(!(o.generation&&l!==o.generation)&&(e.length?u[l]=re.call(this,e,o.subtree==="cross-roots",t[l],t.event!=="parse"):u[l]=[...t[l]],!!f))for(let d of u[l])f[l].push(d)}),!u.entrants.length&&!u.exits.length)return;let c=s?.generate()||{};i(u,c,r)}function re(n,t,r,e){r=Array.isArray(r)?r:[...r];let i=(o,s)=>{if(s.type==="selector"){let f=s.isXpathAttr?[]:o.filter(u=>s.kind==="xpath"?St(this,u,s+""):u.matches&&u.matches(s+""));if((e||s.isXpathAttr)&&(f=o.reduce((u,c)=>s.kind==="xpath"?[...u,...tt(this,c,s,e)]:c.querySelectorAll?[...u,...c.querySelectorAll(s+"")]:u,f)),f.length)return f}else if(o.includes(s.content)||e&&o.some(f=>z(this,f,s.content,t)))return[s.content]};return r.$$searchCache||(r.$$searchCache=new Map),n.reduce((o,s)=>{let f;return r.$$searchCache.has(s.content)?f=r.$$searchCache.get(s.content):(f=i(r,s)||[],s.type==="instance"&&r.$$searchCache.set(s.content,f)),o.concat(f)},[])}function Nt({target:n,addedNodes:t,removedNodes:r}){let e=this,i;return i=A(t).reduce((o,s)=>o||e.webqit.realdom.domInterceptionRecords?.get(s),null),i=A(r).reduce((o,s)=>o||e.webqit.realdom.domInterceptionRecords?.get(s),i),i=i||e.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:t,exits:r,type:"observation",event:i}}function kt(n,t){let r=this,{webqit:e,document:i,Node:o,CharacterData:s,Element:f,HTMLElement:u,HTMLTemplateElement:c,DocumentFragment:l}=r;e.realdom.domInterceptionHooks||Object.defineProperty(e.realdom,"domInterceptionHooks",{value:new Map}),e.realdom.domInterceptionNoRecurse||Object.defineProperty(e.realdom,"domInterceptionNoRecurse",{value:new Map}),e.realdom.domInterceptionHooks.has(n)||e.realdom.domInterceptionHooks.set(n,new Set),e.realdom.domInterceptionHooks.get(n).add(t);let d=()=>e.realdom.domInterceptionHooks.get(n).delete(t);if(e.realdom.domInterceptionHooks?.intercepting)return d;console.warn("DOM mutation APIs are now being intercepted."),e.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(e.realdom,"domInterceptionRecords",{value:new Map});let a=(m,x,p)=>{e.realdom.domInterceptionNoRecurse.set(m,x);let _=p();return e.realdom.domInterceptionNoRecurse.delete(m),_},h=(m,x)=>{m.entrants.concat(m.exits).forEach(_=>{clearTimeout(e.realdom.domInterceptionRecords.get(_)?.timeout),e.realdom.domInterceptionRecords.set(_,m.event);let $=setTimeout(()=>{e.realdom.domInterceptionRecords.delete(_)},0);Object.defineProperty(m.event,"timeout",{value:$,configurable:!0})}),e.realdom.domInterceptionHooks.get("intercept")?.forEach(_=>_(m));let p=x();return e.realdom.domInterceptionHooks.get("sync")?.forEach(_=>_(m)),p},g={characterData:Object.create(null),other:Object.create(null)};["insertBefore","insertAdjacentElement","insertAdjacentHTML","setHTML","replaceChildren","replaceWith","remove","replaceChild","removeChild","before","after","append","prepend","appendChild"].forEach(m=>{function x(...p){let _=this instanceof s?g.characterData:g.other,$=()=>_[m].call(this,...p);if(!(this instanceof s||this instanceof f||this instanceof l)||e.realdom.domInterceptionNoRecurse.get(this)===m)return $();let P=[],S=[],B=this;["insertBefore"].includes(m)?S=[p[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(m)?(S=[p[1]],["beforebegin","afterend"].includes(p[0])&&(B=this.parentNode)):["setHTML","replaceChildren"].includes(m)?(P=[...this.childNodes],S=m==="replaceChildren"?[...p]:[p[0]]):["replaceWith","remove"].includes(m)?(P=[this],S=m==="replaceWith"?[...p]:[],B=this.parentNode):["replaceChild"].includes(m)?(P=[p[1]],S=[p[0]]):["removeChild"].includes(m)?P=[...p]:(S=[...p],["before","after"].includes(m)&&(B=this.parentNode));let N=m;if(["insertAdjacentHTML","setHTML"].includes(m)){let yt=this.nodeName;if(m==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(p[0])){if(!this.parentNode)return _[m].call(this,...p);yt=this.parentNode.nodeName}let J=i.createElement(yt);_.setHTML.call(J,S[0],m==="setHTML"?p[1]:{}),S=[...J.childNodes],m==="insertAdjacentHTML"?(N="insertAdjacentElement",p[1]=new l,a(p[1],"append",()=>p[1].append(...J.childNodes))):(N="replaceChildren",p=[...J.childNodes])}return h({target:B,entrants:S,exits:P,type:"interception",event:[this,m]},()=>_[N].call(this,...p))}["insertBefore","replaceChild","removeChild","appendChild"].includes(m)?(g.other[m]=o.prototype[m],o.prototype[m]=x):(["after","before","remove","replaceWith"].includes(m)&&(g.characterData[m]=s.prototype[m],s.prototype[m]=x),f.prototype[m]&&(g.other[m]=f.prototype[m],f.prototype[m]=x))});let O=Object.create(null);return["outerHTML","outerText","innerHTML","innerText","textContent","nodeValue"].forEach(m=>{let x=["textContent","nodeValue"].includes(m)?o:["outerText","innerText"].includes(m)?u:f;O[m]=Object.getOwnPropertyDescriptor(x.prototype,m),Object.defineProperty(x.prototype,m,{...O[m],set:function(p){let _=()=>O[m].set.call(this,p);if(!(this instanceof f))return _();let $=[],P=[],S=this;if(["outerHTML","outerText"].includes(m)?($=[this],S=this.parentNode):$=[...this.childNodes],["outerHTML","innerHTML"].includes(m)){let N=this.nodeName;if(m==="outerHTML"){if(!this.parentNode)return _();N=this.parentNode.nodeName}let H=i.createElement(N==="TEMPLATE"?"div":N);O[m].set.call(H,p),P=this instanceof c?[]:[...H.childNodes],m==="outerHTML"?(p=new l,a(p,"append",()=>p.append(...H.childNodes)),_=()=>a(this,"replaceWith",()=>f.prototype.replaceWith.call(this,p))):this instanceof c?_=()=>a(this.conten,"replaceChildren",()=>this.content.replaceChildren(...H.childNodes)):_=()=>a(this,"replaceChildren",()=>f.prototype.replaceChildren.call(this,...H.childNodes))}return h({target:S,entrants:P,exits:$,type:"interception",event:[this,m]},_)}})}),["append","prepend","replaceChildren"].forEach(m=>{[i,l.prototype].forEach(x=>{let p=x[m];x[m]=function(..._){if(e.realdom.domInterceptionNoRecurse.get(this)===m)return p.call(this,..._);let $=m==="replaceChildren"?[...this.childNodes]:[];return h({target:this,entrants:_,exits:$,type:"interception",event:[this,m]},()=>p.call(this,..._))}})}),d}function Ht(){ne.call(this),ie.call(this),oe.call(this)}function ne(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function ie(){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 oe(){let n=this;n.Element.prototype.matches||(n.Element.prototype.matches=n.Element.prototype.matchesSelector||n.Element.prototype.mozMatchesSelector||n.Element.prototype.msMatchesSelector||n.Element.prototype.oMatchesSelector||n.Element.prototype.webkitMatchesSelector||function(t){for(var r=(this.document||this.ownerDocument).querySelectorAll(t),e=r.length;--e>=0&&r.item(e)!==this;);return e>-1})}function Lt(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.realdom)return n.webqit.realdom;n.webqit.realdom={},Ht.call(n),n.webqit.realdom.meta=(...r)=>se.call(n,...r),n.webqit.realdom.ready=(...r)=>pt.call(n,...r),n.webqit.realdom.realtime=(r,e="dom")=>{if(e==="dom")return new Q(r,n);if(e==="attr")return new q(r,n)};let t=new X(n);return n.webqit.realdom.schedule=(r,...e)=>t[`on${r}`](...e),n.webqit.realdom.synthesizeWhile=(...r)=>t.synthesizeWhile(...r),n.webqit.realdom}function pt(...n){let t="interactive",r;D(n[0])?(t=n[0],w(n[1])&&(r=n[1])):w(n[0])&&(r=n[0]);let e={interactive:["interactive","complete"],complete:["complete"]};if(!e[t])throw new Error(`Invalid ready-state timing: ${t}.`);let i=this;if(!r)return i.webqit.realdom.readyStatePromises||(i.webqit.realdom.readyStatePromises={interactive:new Promise(o=>pt.call(this,"interactive",o)),complete:new Promise(o=>pt.call(this,"complete",o))}),i.webqit.realdom.readyStatePromises[t];if(e[t].includes(i.document.readyState))return r(i);i.webqit.realdom.readyStateCallbacks||(i.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},i.document.addEventListener("readystatechange",()=>{let o=i.document.readyState;for(let s of i.webqit.realdom.readyStateCallbacks[o].splice(0))s(i)},!1)),i.webqit.realdom.readyStateCallbacks[t].push(r)}function se(n){let t=this,r={},e;return(e=t.document.querySelector(`meta[name="${n}"]`))&&(r=(e.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(f=>f.trim());return ut(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:C(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return e.content},json(){return JSON.parse(JSON.stringify(r))}}}function rt(n,t){return typeof n!="string"?n:n.replace(/\w\S*/g,function(r){return r.charAt(0).toUpperCase()+(typeof t!==void 0&&t?r.substr(1).toLowerCase():r.substr(1))})}var F=(...n)=>I("oohtml",...n),ce={};function Ft(n,t,r){let e=this,i=Lt.call(e);ce.window=e,e.webqitConfig||(e.webqitConfig=i.meta("webqit").json()),e.webqit||(e.webqit={}),e.webqit.oohtml||(e.webqit.oohtml={}),e.webqit.oohtml.configs||(e.webqit.oohtml.configs={});let o=n.toUpperCase().replace("-","_");if(!e.webqit.oohtml.configs[o]){e.webqit.oohtml.configs[o]={};let s=e.webqit.oohtml.configs[o];G(2,s,r,t,i.meta(n).json()),e.webqitConfig.prefix&&Object.keys(s).forEach(f=>{Object.keys(s[f]).forEach(u=>{f==="api"&&typeof s[f][u]=="string"?s[f][u]=`${e.webqitConfig.prefix}${rt(s[f][u])}`:["attr","elements"].includes(f)&&s[f][u]?.startsWith("data-")===!1&&(s[f][u]=`${e.webqitConfig.prefix}-${s[f][u]}`)})})}return{config:e.webqit.oohtml.configs[o],realdom:i,window:e}}function nt(n,t){return[...n].reduce(([r,e,i],o)=>!r&&e===0&&(Array.isArray(t)?t:[t]).includes(o)?[r,e,[""].concat(i)]:(!r&&["(","[","{"].includes(o)&&!i[0].endsWith("\\")&&e++,!r&&[")","]","}"].includes(o)&&!i[0].endsWith("\\")&&e--,['"',"'","`"].includes(o)&&!i[0].endsWith("\\")&&(r=r===o?null:r||o),i[0]+=o,[r,e,i]),[null,0,[""]])[2].reverse()}function _t(n={}){let{config:t,window:r}=Ft.call(this,"data-binding",n,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"}});({CONTEXT_API:t.CONTEXT_API,BINDINGS_API:t.BINDINGS_API,HTML_IMPORTS:t.HTML_IMPORTS}=r.webqit.oohtml.configs),t.attrSelector=`[${r.CSS.escape(t.attr.render)}]`;let e=(i,o)=>{let s=`starts-with(., "${i}")`,f=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${f}`};t.discreteBindingsSelector=`comment()[${e(t.tokens.tagStart,t.tokens.tagEnd)}]`,ue.call(r,t)}function ue(n){let t=this,{webqit:{realdom:r}}=t;r.realtime(t.document).subtree(`(${n.discreteBindingsSelector})`,e=>{jt.call(this,...e.exits),ae.call(this,n,...e.entrants)},{live:!0}),r.realtime(t.document).subtree(n.attrSelector,e=>{jt.call(this,...e.exits),de.call(this,n,...e.entrants)},{live:!0,timing:"sync",staticSensitivity:!0})}function Bt(n,t){let{webqit:{realdom:r,Observer:e,DOMBindingsContext:i}}=this;if(F(t).has("data-binding"))return F(t).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(u,c,...l)=>{r.schedule("write",()=>u[c](...l))},o.$assign__=(u,c,l)=>{r.schedule("write",()=>u[c]=l)},e.intercept(o,{get:(u,c,l)=>{if(!(u.key in o)){let d={...i.createRequest(u.key),live:!0,signal:s.signal};t[n.CONTEXT_API.api.contexts].request(d,a=>{e.set(o,u.key,a)})}return l(o[u.key]??(u.key in globalThis?globalThis[u.key]:void 0))},has:(u,c,l)=>l(!0)});let f={scope:o,abortController:s,bindings:new Map};return F(t).set("data-binding",f),f}function jt(...n){for(let t of n){let r=t.nodeName==="#text"?t.parentNode:t,{bindings:e,abortController:i}=F(r).get("data-binding")||{};if(!e?.has(t))return;e.get(t).state.dispose(),e.get(t).signals?.forEach(o=>o.abort()),e.delete(t),e.size||(i.abort(),F(r).delete("data-binding"))}}async function ae(n,...t){let r=this,{webqit:{QuantumAsyncFunction:e}}=r,i=s=>{let f=n.tokens.tagStart.split("").map(g=>`\\${g}`).join(""),u=n.tokens.tagEnd.split("").map(g=>`\\${g}`).join(""),c=n.tokens.stateStart.split("").map(g=>g===" "?"(?:\\s+)?":`\\${g}`).join(""),l=n.tokens.stateEnd.split("").map(g=>`\\${g}`).join(""),d=`^${f}(.*?)(?:${c}(\\d+)${l}(?:\\s+)?)?${u}$`,[,a,h]=s.match(new RegExp(d));return{raw:s,expr:a,span:parseInt(h??0)}},o=t.reduce((s,f)=>{if(f.isBound)return s;let u=i(f.nodeValue),c=f;if(u.span){if(c=f.nextSibling,c?.nodeName!=="#text"||c.nodeValue.length<u.span)return s;c.nodeValue.length>u.span&&c.splitText(u.span)}else c=f.ownerDocument.createTextNode(""),f.after(c);c.isBound=!0;let l=f;return r.webqit.env!=="server"&&(l.remove(),l=null),s.concat({textNode:c,template:u,anchorNode:l})},[]);for(let{textNode:s,template:f,anchorNode:u}of o){let c=me(n,f.expr),{scope:l,bindings:d}=Bt.call(this,n,s.parentNode);Object.defineProperty(s,"$oohtml_internal_databinding_anchorNode",{value:u,configurable:!0}),d.set(s,{state:await(await c.bind(s,l)).execute()})}}var ht=new Map;function me(n,t){if(ht.has(t))return ht.get(t);let r=`let content = ((${t}) ?? '') + '';`;r+="$assign__(this, 'nodeValue', content);",r+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${n.tokens.tagStart}${j(t)}${n.tokens.stateStart}" + content.length + "${n.tokens.stateEnd} ${n.tokens.tagEnd}"); }`;let{webqit:{QuantumModule:e}}=this,i=new e(r);return ht.set(t,i),i}async function de(n,...t){for(let r of t){let e=pe(n,r.getAttribute(n.attr.render)),{scope:i,bindings:o}=Bt.call(this,n,r),s=[];Object.defineProperty(r,"$oohtml_internal_databinding_signals",{value:s,configurable:!0}),o.set(r,{signals:s,state:await(await e.bind(r,i)).execute()})}}var gt=new Map;function pe(n,t){if(gt.has(t))return gt.get(t);let r={},e=nt(t,";").map(s=>{let[f,u]=nt(s,":").map(h=>h.trim()),c=f[0],l=f.slice(1).trim(),d=`(${u})`,a=`(${d} ?? '')`;if(c==="&")return l.startsWith("--")?`$exec__(this.style, 'setProperty', "${j(l)}", ${a});`:`$assign__(this.style, "${j(l)}", ${a});`;if(c==="%")return`$exec__(this.classList, 'toggle', "${j(l)}", !!${d});`;if(c==="~")return l.startsWith("?")?`$exec__(this, 'toggleAttribute', "${j(l.substring(1).trim())}", !!${d});`:`$exec__(this, 'setAttribute', "${j(l)}", ${a});`;if(c==="@"){if(r[l])throw new Error(`Duplicate binding: ${f}.`);if(r[l]=!0,l==="text")return`$assign__(this, 'textContent', ${a});`;if(l==="html")return`$exec__(this, 'setHTML', ${a});`;if(l==="items"){let[h,g]=nt(u,"/");if(!g)throw new Error(`Invalid ${c}items spec: ${s}; no import specifier.`);let[O,m,x,p]=h.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!O)throw new Error(`Invalid ${c}items spec: ${s}.`);if(m.startsWith("(")?m=m.trim().slice(1,-1).split(",").map($=>$.trim()):m=[m],m.length>(x==="in"?3:2))throw new Error(`Invalid ${c}items spec: ${s}.`);let _=x==="in"?m[2]:m[1]||"$index__";return`
2
2
  let $iteratee__ = ${p};
3
3
  let $import__ = this.${n.HTML_IMPORTS.api.import}( ${g.trim()}, true );
4
4
  this.$oohtml_internal_databinding_signals?.push( $import__ );