@webqit/oohtml 2.1.81 → 3.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
@@ -21,7 +21,7 @@ Building Single Page Applications? OOHTML is a special love letter!
21
21
 
22
22
  <details><summary>Show</summary>
23
23
 
24
- Vanilla HTML is unsurprisingly becoming a compelling option for an increasing number of developers! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and other fundamental capabilities like data binding! Authors still have to rely on tools - or, to say the least, do half of the work in HTML and half in JS - to get even basic things working!
24
+ Vanilla HTML is unsurprisingly becoming a compelling option for an increasing number of developers! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and other fundamental capabilities like data binding! Authors still have to rely on tools - or, to say the least, have to do half of the work in HTML and half in JS - to get even basic things working!
25
25
 
26
26
  This project pursues an object-oriented approach to HTML and implicitly revisits much of what inhibits the idea of a *component* architecture for HTML!
27
27
 
@@ -75,7 +75,7 @@ let { user } = document.namespace;
75
75
  let { url, name, email } = user.namespace;
76
76
  ```
77
77
 
78
- <details><summary>All in Realtime</summary>
78
+ <details><summary>All in realtime</summary>
79
79
 
80
80
  The Namespace API is designed to always reflect the DOM in real-time. This may be observed using the general-purpose object observability API - [Observer API](https://github.com/webqit/observer):
81
81
 
@@ -239,7 +239,7 @@ Here, we get an `<import>` element that lets us do that declaratively:
239
239
  </body>
240
240
  ```
241
241
 
242
- <details><summary>All in Realtime</summary>
242
+ <details><summary>All in realtime</summary>
243
243
 
244
244
  As a realtime module system, `<import> `elements maintain a live relationship with given module definition elements (`<template def>`) and are resolved again in the event that:
245
245
  + the `<import>` element points to another module — either by `ref` change or by a change in `importscontext` (below).
@@ -572,7 +572,7 @@ console.log(localOrGlobalImport2); // { value: div }
572
572
 
573
573
  Data binding is the concept of having a mechanism that declaratively drives the UI from application data, ensuring that the relevant parts of the UI are *automatically* updated as application state changes.
574
574
 
575
- OOHTML makes this possible in just simple conventions - via a new comment-based data-binding syntax `<?{ }?>` and a complementary new `binding` attribute! And there's one more: Stateful Scripts which brings the most advanced form of reactivity to HTML!
575
+ OOHTML makes this possible in just simple conventions - via a new comment-based data-binding syntax `<?{ }?>` and a complementary new `binding` attribute! And there's one more: Quantum Scripts which brings the most advanced form of reactivity to HTML!
576
576
 
577
577
  ### Discrete Data-Binding
578
578
 
@@ -613,40 +613,37 @@ Now that extra bit of information gets decoded and original relationships are fo
613
613
  Here, we get the `binding` attribute for a declarative and neat, key/value data-binding syntax:
614
614
 
615
615
  ```html
616
- <div binding="<type><parameter>: <argument>;"></div>
616
+ <div binding="<directive> <param>: <arg>;"></div>
617
617
  ```
618
618
 
619
619
  **-->** *where*:
620
620
 
621
- + *`<type>` is the binding type, which is always a symbol*
622
- + *`<directive>` is the binding directive, which could be any of CSS property, class name, attribute name, Structural Directive*
623
- + *`<argument>` is the bound value or expression*
621
+ + *`<directive>` is the directive, which is always a symbol*
622
+ + *`<param>` is the parameter being bound, which could be a CSS property, class name, attribute name, Structural Directive - depending on the givin directive*
623
+ + *`<arg>` is the bound value or expression*
624
624
 
625
625
  **-->** *which would give us the following for a CSS property*:
626
626
 
627
627
  ```html
628
- <div binding="&color: someColor; &backgroundColor: 'red'"></div>
628
+ <div binding="& color:someColor; & backgroundColor:'red'"></div>
629
629
  ```
630
630
 
631
- **-->** *with enough liberty to separate the binding type from the directive itself*:
631
+ **-->** *and that isn't space-sensitive*:
632
632
 
633
633
  ```html
634
- <div binding="& color: someColor; & backgroundColor: 'red'"></div>
634
+ <div binding="& color:someColor; &backgroundColor: 'red'"></div>
635
635
  ```
636
636
 
637
637
  **-->** *the rest of which can be seen below*:
638
638
 
639
- | Symbol | Meaning | Usage |
639
+ | Directive | Type | Usage |
640
640
  | :---- | :---- | :---- |
641
- | `&` | CSS Property | `<div binding="&color: someColor;"></div>` |
642
- | `%` | Class Name | `<div binding="%active: app.isActive;"></div>` |
643
- | `~` | Attribute Name | `<a binding="~href: person.profileUrl+'#bio';"></a>` |
644
- | | A Toggled Attribute | `<a binding="~required?: formField.required;"></a>` |
641
+ | `&` | CSS Property | `<div binding="& color:someColor; & backgroundColor:someColor;"></div>` |
642
+ | `%` | Class Name | `<div binding="% active:app.isActive; % expanded:app.isExpanded;"></div>` |
643
+ | `~` | Attribute Name | `<a binding="~ href:person.profileUrl+'#bio'; ~ title:'Click me';"></a>` |
644
+ | | Boolean Attribute | `<a binding="~ ?required:formField.required; ~ ?aria-checked: formField.checked"></a>` |
645
645
  | `@` | Structural Directive: | *See next table* |
646
-
647
- | Directive | Meaning | Usage |
648
- | :---- | :---- | :---- |
649
- | `@text` | Plain text content | `<span binding="@text: firstName+' '+lastName;"></span>` |
646
+ | `@text` | Plain text content | `<span binding="@text:firstName+' '+lastName;"></span>` |
650
647
  | `@html` | Markup content | `<span binding="@html: '<i>'+firstName+'</i>';"></span>` |
651
648
  | `@items` | A list, with argument in the following format:<br>`<declaration> <of\|in> <iterable> / <importRef>` | *See next two tables* |
652
649
 
@@ -670,7 +667,7 @@ Here, we get the `binding` attribute for a declarative and neat, key/value data-
670
667
 
671
668
  </details>
672
669
 
673
- <details><summary>All in Realtime</summary>
670
+ <details><summary>All in realtime</summary>
674
671
 
675
672
  Lists are rendered in realtime, which means that in-place mutations - additions and removals - on the *iteratee* will be automatically reflected on the UI!
676
673
 
@@ -682,7 +679,7 @@ Generated item elements are automatically assigned a corresponding index with a
682
679
 
683
680
  </details>
684
681
 
685
- ### Stateful Scripts
682
+ ### Quantum Scripts
686
683
 
687
684
  *[TODO]*
688
685
 
@@ -740,10 +737,10 @@ element.bindings.data = { prop1: 'value1' };
740
737
  Observer.set(element.bindings.data, 'prop2', 'value2');
741
738
  ```
742
739
 
743
- └ *"Stateful Scripts" for reactive scripting*:
740
+ └ *"Quantum Scripts" for reactive scripting*:
744
741
 
745
742
  ```html
746
- <script stateful>
743
+ <script quantum>
747
744
  console.log(this) // window
748
745
 
749
746
  console.log(window.liveProperty) // live expression
@@ -762,7 +759,7 @@ Observer.set(window, 'liveProperty'); // Live expressions rerun
762
759
 
763
760
  ```html
764
761
  <div>
765
- <script stateful scoped>
762
+ <script quantum scoped>
766
763
  console.log(this) // div
767
764
 
768
765
  console.log(this.liveProperty) // live expression
@@ -836,7 +833,7 @@ Also, if you'll be going ahead to build a real app to see OOHTML in action, you
836
833
 
837
834
  + **Loading Requirements**. As specified above, the OOHTML script tag is to be placed early on in the document and should be a classic script without any `defer` or `async` directives!
838
835
 
839
- If you must load the script "async", one little trade-off has to be made for `<script scoped>` and `<script stateful>` elements to have them ignored by the browser until the polyfill comes picking them up: *employing a custom MIME type in place of the standard `text/javascript` and `module` types*, in which case, a `<meta name="scoped-js">` element is used to configure the polyfill to honor the custom MIME type:
836
+ If you must load the script "async", one little trade-off has to be made for `<script scoped>` and `<script quantum>` elements to have them ignored by the browser until the polyfill comes picking them up: *employing a custom MIME type in place of the standard `text/javascript` and `module` types*, in which case, a `<meta name="scoped-js">` element is used to configure the polyfill to honor the custom MIME type:
840
837
 
841
838
  ```html
842
839
  <head>
@@ -850,7 +847,7 @@ Also, if you'll be going ahead to build a real app to see OOHTML in action, you
850
847
  </body>
851
848
  ```
852
849
 
853
- The custom MIME type strategy also comes in as a "fix" for when in a browser or other runtime where the polyfill is not able to intercept `<script scoped>` and `<script stateful>` elements ahead of the runtime - e.g. where...
850
+ The custom MIME type strategy also comes in as a "fix" for when in a browser or other runtime where the polyfill is not able to intercept `<script scoped>` and `<script quantum>` elements ahead of the runtime - e.g. where...
854
851
 
855
852
  ```html
856
853
  <body>
@@ -862,7 +859,7 @@ Also, if you'll be going ahead to build a real app to see OOHTML in action, you
862
859
 
863
860
  ...still gives the `window` object in the console.
864
861
 
865
- + **Scoped/Stateful Scripts**. This feature is an extension of [Stateful JS](https://github.com/webqit/stateful-js). The default OOHTML build is based on the [Stateful JS Lite APIs](https://github.com/webqit/stateful-js#stateful-js-lite) and this means that `<script stateful></script>` and `<script scoped></script>` elements are parsed "asynchronously", in the same timing as `<script type="module"></script>`!
862
+ + **Scoped/Quantum Scripts**. This feature is an extension of [Quantum JS](https://github.com/webqit/quantum-js). The default OOHTML build is based on the [Quantum JS Lite APIs](https://github.com/webqit/quantum-js#quantum-js-lite) and this means that `<script quantum></script>` and `<script scoped></script>` elements are parsed "asynchronously", in the same timing as `<script type="module"></script>`!
866
863
 
867
864
  This timing works perfectly generally, but if you have a requirment to have classic scripts follow their [native synchronous timing](https://html.spec.whatwg.org/multipage/parsing.html#scripts-that-modify-the-page-as-it-is-being-parsed), then you'd need to use the *realtime* OOHTML build:
868
865
 
@@ -1,13 +1,13 @@
1
- (()=>{var pe=Object.defineProperty;var Be=(n,t,e)=>t in n?pe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var de=(n,t)=>{for(var e in t)pe(n,e,{get:t[e],enumerable:!0})};var F=(n,t,e)=>(Be(n,typeof t!="symbol"?t+"":t,e),e);var ee={};de(ee,{apply:()=>It,batch:()=>Mt,construct:()=>Yt,defineProperties:()=>lr,defineProperty:()=>bt,deleteProperties:()=>ur,deleteProperty:()=>wt,get:()=>V,getOwnPropertyDescriptor:()=>jt,getOwnPropertyDescriptors:()=>cr,getPrototypeOf:()=>Xt,has:()=>Rt,intercept:()=>sr,isExtensible:()=>Jt,observe:()=>te,ownKeys:()=>yt,path:()=>or,preventExtensions:()=>Zt,read:()=>ar,reduce:()=>Kt,set:()=>Z,setPrototypeOf:()=>Qt});function O(n){return!Array.isArray(n)&&typeof n=="object"&&n}function ot(n){return typeof n}function _(n){return Array.isArray(n)}function Lt(n,t,e=null){return _(t)?n.filter(r=>e?t.filter(i=>e(r,i)).length:t.indexOf(r)!==-1):[]}function z(n,...t){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new ut}),!arguments.length)return globalThis.webqit.refs;let e=globalThis.webqit.refs.get(n);e||(e=new ut,globalThis.webqit.refs.set(n,e));let r,i;for(;r=t.shift();)(i=e)&&!(e=e.get(r))&&(e=new ut,i.set(r,e));return e}var ut=class extends Map{constructor(...t){super(...t),this.observers=new Set}set(t,e){let r=super.set(t,e);return this.fire("set",t,e,t),r}delete(t){let e=super.delete(t);return this.fire("delete",t),e}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,e,r){let i={type:t,key:e,callback:r};return this.observers.add(i),()=>this.observers.delete(i)}unobserve(t,e,r){if(Array.isArray(t)||Array.isArray(e))throw new Error('The "type" and "key" arguments can only be strings.');for(let i of this.observers)!(Ct([t,"*"],i.type)&&Ct([e,"*"],i.key)&&i.callback===r)||this.observers.delete(i)}fire(t,e,...r){for(let i of this.observers)!(Ct([t,"*"],i.type)&&Ct([e,"*"],i.key))||i.callback(...r)}},Ct=(n,t)=>Array.isArray(t)?Lt(n,t).length:n.includes(t);function st(n){return typeof n=="function"}function ft(n){return n===null||n===""}function D(n){return arguments.length&&(n===void 0||typeof n>"u")}function E(n){return Array.isArray(n)||typeof n=="object"&&n||st(n)}function Vt(n){return ft(n)||D(n)||n===!1||n===0||E(n)&&!Object.keys(n).length}function $(n){return st(n)||n&&{}.toString.call(n)==="[object function]"}function ht(n){return n instanceof Number||typeof n=="number"}function k(n){return ht(n)||n!==!0&&n!==!1&&n!==null&&n!==""&&!isNaN(n*1)}function ct(n){return n instanceof String||typeof n=="string"&&n!==null}function Ht(n){return!ct(n)&&!D(n.length)}function Tt(n,...t){return t.forEach(e=>{n.indexOf(e)<0&&n.push(e)}),n}function zt(r,t){t=t||Object.prototype,t=t&&!_(t)?[t]:t;for(var e=[],r=r;r&&(!t||t.indexOf(r)<0)&&r.name!=="default";)e.push(r),r=r?Object.getPrototypeOf(r):null;return e}function Wt(n,t){var e=[];return zt(n,t).forEach(r=>{Tt(e,...Object.getOwnPropertyNames(r))}),e}function I(n,t,e=!1,r=!1,i=!1){var o=0,s=n.shift();if((k(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((c,l)=>{!E(c)&&!$(c)||(e?Wt(c):Object.keys(c)).forEach(a=>{if(!!t(a,s,c,l)){var u=s[a],h=c[a];if((_(u)&&_(h)||O(u)&&O(h))&&(o===!0||o>0))s[a]=_(u)&&_(h)?[]:{},I([k(o)?o-1:o,s[a],u,h],t,e,r,i);else if(_(s)&&_(c))r?s[a]=h:s.push(h);else try{i?Object.defineProperty(s,a,Object.getOwnPropertyDescriptor(c,a)):s[a]=c[a]}catch{}}})}),s}function mt(...n){return I(n,(t,e,r)=>!0,!1,!1,!1)}function S(n,t=!0){return _(n)?n:!t&&O(n)?[n]:n!==!1&&n!==0&&Vt(n)?[]:Ht(n)?Array.prototype.slice.call(n):O(n)?Object.values(n):[n]}var P=(...n)=>z("observer-api",...n),at=(n,t)=>n instanceof Promise?n.then(t):t(n),kt={};var Y=class{constructor(t,e){this.registry=t,Object.assign(this,{...e,target:t.target}),this.params.signal&&this.params.signal.addEventListener("abort",()=>this.remove())}remove(){return this.removed=!0,this.registry.removeRegistration(this)}};var pt=class extends Y{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),kt.setMaxListeners?.(0,this.signal)}remove(){this.abortController.abort(),super.remove()}fire(t){if(this.emit.recursionTarget&&!["inject","force-async","force-sync"].includes(this.params.recursions))return;let e=t,r=this.filter;if(r!==1/0&&(r=S(r,!1))&&(e=t.filter(i=>r.includes(i.key))),this.params.diff&&(e=e.filter(i=>i.type!=="set"||i.value!==i.oldValue)),e.length){if(this.emit.recursionTarget&&this.params.recursions!=="force-sync"){this.emit.recursionTarget.push(...e);return}this.emit.recursionTarget=this.params.recursions==="inject"?e:[];let i=this.filter===1/0||Array.isArray(this.filter)?this.emit(e,this):this.emit(e[0],this);return at(i,o=>{let s=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="force-async"&&s.length?this.emit.currentRegistration.fire(s):o})}}};var Q=class{constructor(t){this.target=t,this.entries=[]}addRegistration(t){return this.entries.push(t),t}removeRegistration(t){this.entries=this.entries.filter(e=>e!==t)}static _getInstance(t,e,r=!0,i=this.__namespace){if(!E(e))throw new Error(`Subject must be of type object; "${ot(e)}" given!`);let o=this;return i&&P("namespaces").has(t+"-"+i)&&(o=P("namespaces").get(t+"-"+i),t+="-"+i),!P(e,"registry").has(t)&&r&&P(e,"registry").set(t,new o(e)),P(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return P("namespaces").get(t);if(!(r.prototype instanceof this))throw new Error(`The implementation of the namespace ${this.name}.${e} must be a subclass of ${this.name}.`);P("namespaces").set(t,r),r.__namespace=e}};var C=class{constructor(t,e){if(this.target=t,!e.operation)throw new Error("Descriptor operation must be given in definition!");Object.assign(this,e)}};var W=class extends Q{static getInstance(t,e=!0,r=null){return super._getInstance("listeners",...arguments)}static namespace(t,e=null){return super._namespace("listeners",...arguments)}constructor(t){super(t),this.batches=[]}addRegistration(t,e,r){return super.addRegistration(new pt(this,{filter:t,emit:e,params:r}))}emit(t,e=!1){if(this.batches.length){this.batches[0].snapshots.push({events:[...t],isPropertyDescriptors:e});return}this.$emit(this.entries,[{events:t,isPropertyDescriptors:e}])}$emit(t,e){let r=t.filter(l=>l.params.withPropertyDescriptors).length,i=e.some(l=>l.isPropertyDescriptors),o=[],s=[],c=t.length;e.forEach(l=>{(r||!i)&&o.push(...l.events),r!==c&&i&&(l.isPropertyDescriptors?s.push(...l.events.map(a=>{let{target:u,type:h,...f}=a,p=new C(u,{type:"set",...f});return Object.defineProperty(p,"value","get"in f.value?{get:()=>f.value.get()}:{value:f.value.value}),f.oldValue&&Object.defineProperty(p,"oldValue","get"in f.oldValue?{get:()=>f.oldValue.get()}:{value:f.oldValue.value}),p})):s.push(...l.events))}),t.forEach(l=>{l.params.withPropertyDescriptors?l.fire(o.length?o:s):l.fire(s.length?s:o)})}batch(t){this.batches.unshift({entries:[...this.entries],snapshots:[]});let e=t();return at(e,r=>{let i=this.batches.shift();return i.snapshots.length&&this.$emit(i.entries,i.snapshots),r})}};var dt=class extends Y{exec(t,e,r){return this.running||!this.traps[t.operation]?e(...Array.prototype.slice.call(arguments,2)):(this.running=!0,this.traps[t.operation](t,r,(...i)=>(this.running=!1,e(...i))))}};var L=class extends Q{static getInstance(t,e=!0,r=null){return super._getInstance("traps",...arguments)}static namespace(t,e=null){return super._namespace("traps",...arguments)}addRegistration(t){return super.addRegistration(new dt(this,t))}emit(t,e=null){let r=this;return function i(o,...s){let c=r.entries[o];return c?c.exec(t,(...l)=>i(o+1,...l),...s):e?e(t,...s):s[0]}(0)}};var Gt={};de(Gt,{accessorize:()=>nr,proxy:()=>ve,unaccessorize:()=>ir,unproxy:()=>gt});function nr(n,t,e={}){n=qt(n);let r=P(n,"accessorizedProps");function i(l){let a,u=n;do a=Object.getOwnPropertyDescriptor(u,l);while(!a&&(u=Object.getPrototypeOf(u)));return a?{proto:u,descriptor:a}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(l){if(r.has(l+""))return!0;let a=i(l);a.getValue=function(f=!1){return f?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},a.setValue=function(f,p=!1){if(this.dirty=!0,p){this.descriptor=f;return}return this.descriptor.set?this.descriptor.set(f)!==!1:(this.descriptor.value=f,!0)},a.intact=function(){let f=Object.getOwnPropertyDescriptor(n,l);return f?.get===h.get&&f?.set===h.set&&r.get(l+"")===this},a.restore=function(){return this.intact()?(this.proto&&this.proto!==n||!this.proto&&!this.dirty?delete n[l]:Object.defineProperty(n,l,this.descriptor),r.delete(l+""),!0):!1},r.set(isNaN(l)?l:parseInt(l),a);let{enumerable:u=!0}=a.descriptor,h={enumerable:u,configurable:!0};("value"in a.descriptor||a.descriptor.set)&&(h.set=function(f){return Z(this,l,f,e)}),("value"in a.descriptor||a.descriptor.get)&&(h.get=function(){return V(this,l,e)});try{return Object.defineProperty(n,l,h),!0}catch{return r.delete(l+""),!1}}let c=(Array.isArray(t)?t:t===void 0?Object.keys(n):[t]).map(o);return t===void 0||Array.isArray(t)?c:c[0]}function ir(n,t,e={}){n=qt(n);let r=P(n,"accessorizedProps");function i(c){return r.has(c+"")?r.get(c+"").restore():!0}let s=(Array.isArray(t)?t:t===void 0?Object.keys(n):[t]).map(i);return t===void 0||Array.isArray(t)?s:s[0]}function ve(n,t={},e=void 0){let r=qt(n);if(typeof t.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(t.membrane&&P(r,"membraneRef").has(t.membrane))return P(r,"membraneRef").get(t.membrane);let i={apply(c,l,a){if(Array.isArray(l)){let u=qt(l);return P(u).set("$length",u.length),Mt(u,()=>It(c,l,a))}return It(c,gt(l),a)},construct:(c,l,a=null)=>Yt(c,l,a,t),defineProperty:(c,l,a)=>bt(c,l,a,t),deleteProperty:(c,l)=>wt(c,l,t),get:(c,l,a=null)=>{let u={...t,receiver:a};Array.isArray(c)&&l==="length"&&P(c).has("$length")&&(u.forceValue=P(c).get("$length"));let h=V(c,l,u);return Array.isArray(c)&&typeof h=="function"?ve(h,{...t,membrane:a}):h},getOwnPropertyDescriptor:(c,l)=>jt(c,l,t),getPrototypeOf:c=>Xt(c,t),has:(c,l)=>Rt(c,l,t),isExtensible:c=>Jt(c,t),ownKeys:c=>yt(c,t),preventExtensions:c=>Zt(c,t),set:(c,l,a,u=null)=>{let h={...t,receiver:u};return Array.isArray(c)&&l==="length"&&(h.forceOldValue=P(c).get("$length"),P(c).set("$length",a)),Z(c,l,a,h)},setPrototypeOf:(c,l)=>Qt(c,l,t)},o=e?.(i)||i,s=new Proxy(r,o);return t.membrane&&P(r,"membraneRef").set(t.membrane,s),P(s).set(s,r),s}function gt(n){return P(n).get(n)||n}function qt(n){if(!n||!E(n))throw new Error("Target must be of type object!");return gt(n)}var xt=class extends Array{};function or(...n){return new xt(...n)}function Kt(n,t,e,r=o=>o,i={}){if(!!t.length)return function o(s,c,l){let a=c[l.level],u=l.level===c.length-1;return s instanceof C&&s.operation!=="get"?l={...l,probe:"always"}:l.probe!=="always"&&(l={...l,probe:!u}),e(s,a,(h,...f)=>{let p=m=>{m instanceof C&&(m.path=[m.key],s instanceof C&&(m.path=s.path.concat(m.key),Object.defineProperty(m,"context",{get:()=>s,configurable:!0})))},y=m=>{let x=j(m,!1);return at(x,g=>{m instanceof C?m.value=g:m=g;let d=f[0]||{};return o(m,c,{...l,...d,level:l.level+1})})};return Nt(a)&&Array.isArray(h)?(h.forEach(p),u?r(h,...f):h.map(y)):(p(h),u?r(h,...f):y(h))},l)}(n,t.slice(0),{...i,level:0})}function te(n,t,e,r={}){if(n=j(n,!r.level),$(arguments[1])&&([,e,r={}]=arguments,t=1/0),!$(e))throw new Error(`Handler must be a function; "${ot(e)}" given!`);if(t instanceof xt)return Kt(n,t,te,e,r);if(r={...r,descripted:!0},delete r.live,!E(n))return r.probe&&V(n,t,e,r);let i=Oe(n,t,e,r);return r.probe?V(n,t,i,r):i()}function sr(n,t,e={}){return n=j(n),O(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),L.getInstance(n,!0,e.namespace).addRegistration({traps:t,params:e})}function jt(n,t,e=i=>i,r={}){return R(n,"getOwnPropertyDescriptor",{key:t},e,r)}function cr(n,t,e=i=>i,r={}){return R(n,"getOwnPropertyDescriptors",{key:t},e,r)}function Xt(n,t=r=>r,e={}){return R(n,"getPrototypeOf",{},t,e)}function Jt(n,t=r=>r,e={}){return R(n,"isExtensible",{},t,e)}function yt(n,t=r=>r,e={}){return R(n,"ownKeys",{},t,e)}function Rt(n,t,e=i=>i,r={}){return R(n,"has",{key:t},e,r)}function V(n,t,e=i=>i,r={}){let i,o=j(n,!r.level);return O(e)?[r,e]=[e,s=>s]:r.live&&(i=!0),t instanceof xt?Kt(o,t,V,e,r):fr(o,t,s=>{let c=[...s];return function l(a,u,h){if(!u.length)return h(a);let f=u.shift();if(!["string","number","symbol"].includes(typeof f))throw new Error(`Property name/key ${f} invalid.`);function p(x,g=void 0){let d=v=>(x.value=v,l([...a,r.live||r.descripted?x:v],u,h));if(arguments.length>1)return d(g);if(!E(o))return d(o?.[x.key]);let b=P(o,"accessorizedProps",!1),A=b&&b.get(x.key);if(A&&A.intact())return d(A.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let v=Object.getOwnPropertyDescriptor(o,x.key);return"forceValue"in r&&"value"in v&&(v.value=r.forceValue),d(v)}return"forceValue"in r?d(r.forceValue):d(Reflect.get(o,x.key,...r.receiver?[r.receiver]:[]))}let y=new C(o,{type:"get",key:f,value:void 0,operation:"get",related:c});if(!E(o))return p(y);let m=L.getInstance(o,!1,r.namespace);return m?m.emit(y,p):p(y)}([],s.slice(0),l=>{let a=Nt(t)?l:l[0];return i&&E(o)?Oe(o,t,e,r)(a):e(a)})},r)}function Mt(n,t,e={}){return n=j(n),W.getInstance(n,!0,e.namespace).batch(t)}function ar(n,t,e={}){t=j(t),n=j(n);let r=(e.only||[]).slice(0),i=(e.except||[]).slice(0),o=yt(e.spread?[...n]:n).map(a=>isNaN(a)?a:parseInt(a)),s=r.length?r.filter(a=>o.includes(a)):o.filter(a=>!i.includes(a)),c=a=>!Array.isArray(t)||isNaN(a)?a:a-i.filter(u=>u<a).length,l=a=>{let u=jt(n,a,e);"value"in u&&u.writable&&u.enumerable&&u.configurable?Z(t,c(a),u.value,e):(u.enumerable||e.onlyEnumerable===!1)&&bt(t,a,{...u,configurable:!0},e)};return Mt(t,()=>{s.forEach(l)}),te(n,a=>{a.filter(u=>r.length?r.includes(u.key):!i.includes(u.key)).forEach(u=>{if(u.operation==="deleteProperty")return wt(t,c(u.key),e);if(u.operation==="defineProperty"){(u.value.enumerable||e.onlyEnumerable===!1)&&bt(t,c(u.key),{...u.value,configurable:!0},e);return}l(u.key)})},{...e,withPropertyDescriptors:!0})}function Z(n,t,e,r=s=>s,i={},o=!1){let s=j(n),c=[[t,e]];O(t)&&([,,r=a=>a,i={},o=!1]=arguments,c=Object.entries(t)),O(r)&&([o,i,r]=[typeof i=="boolean"?i:o,r,a=>a]);let l=c.map(([a])=>a);return function a(u,h,f){if(!h.length)return f(u);let[p,y]=h.shift();function m(g,d=void 0){let b=X=>(g.status=X,a(u.concat(g),h,f));if(arguments.length>1)return b(g,d);let A=P(s,"accessorizedProps",!1),v=A&&A.get(g.key);return g.operation==="defineProperty"?(v&&!v.restore()&&b(!1),Object.defineProperty(s,g.key,g.value),b(!0)):v&&v.intact()?b(v.setValue(g.value)):b(Reflect.set(s,g.key,g.value))}function x(g,d){if(i.diff&&y===d)return a(u,h,f);let b=new C(s,{type:o?"def":"set",key:p,value:y,isUpdate:g,oldValue:d,related:[...l],operation:o?"defineProperty":"set",detail:i.detail}),A=L.getInstance(s,!1,i.namespace);return A?A.emit(b,m):m(b)}return Rt(s,p,g=>{if(!g)return x(g);let d={...i,withPropertyDescriptors:o};return"forceOldValue"in i&&(d.forceValue=i.forceOldValue),V(s,p,b=>x(g,b),d)},i)}([],c.slice(0),a=>{let u=W.getInstance(s,!1,i.namespace);return u&&u.emit(a,o),r(Nt(t)?a.map(h=>h.status):a[0]?.status)})}function bt(n,t,e,r=o=>o,i={}){return Z(n,t,e,r,i,!0)}function lr(n,t,e=i=>i,r={}){return Z(n,t,e,r,!0)}function wt(n,t,e=i=>i,r={}){n=j(n),O(e)&&([r,e]=[e,s=>s]);let i=S(t,!1),o=[...i];return function s(c,l,a){if(!l.length)return a(c);let u=l.shift();function h(p,y=void 0){let m=d=>(p.status=d,s(c.concat(p),l,a));if(arguments.length>1)return m(p,y);let x=P(n,"accessorizedProps",!1),g=x&&x.get(p.key);return g&&!g.restore()&&m(!1),m(Reflect.deleteProperty(n,p.key))}function f(p){let y=new C(n,{type:"delete",key:u,oldValue:p,related:[...o],operation:"deleteProperty",detail:r.detail}),m=L.getInstance(n,!1,r.namespace);return m?m.emit(y,h):h(y)}return V(n,u,f,r)}([],i.slice(0),s=>{let c=W.getInstance(n,!1,r.namespace);return c&&c.emit(s),e(Nt(t)?s.map(l=>l.status):s[0].status)})}function ur(n,t,e=i=>i,r={}){return wt(...arguments)}function Yt(n,t,e=null,r=o=>o,i={}){return R(n,"construct",arguments.length>2?{argumentsList:t,newTarget:e}:{argumentsList:t},r,i)}function It(n,t,e,r=o=>o,i={}){return R(n,"apply",{thisArgument:t,argumentsList:e},r,i)}function Qt(n,t,e=i=>i,r={}){return R(n,"setPrototypeOf",{proto:t},e,r)}function Zt(n,t=r=>r,e={}){return R(n,"preventExtensions",{},t,e)}function Oe(n,t,e,r={}){let i;r.signal||(i=new AbortController,r={...r,signal:i.signal},kt.setMaxListeners?.(0,i.signal));let o=W.getInstance(n,!0,r.namespace);return function s(c,l=null){l?.remove();let u={signal:o.addRegistration(t,s,r).signal};if(arguments.length){let h=e(c,u);if(arguments.length>1)return h}return i}}function R(n,t,e={},r=o=>o,i={}){n=j(n),O(r)&&([i,r]=[r,l=>l]);function o(l,a){return arguments.length>1?r(a):r((Reflect[t]||Object[t])(n,...Object.values(e)))}let s=new C(n,{operation:t,...e}),c=L.getInstance(n,!1,i.namespace);return c?c.emit(s,o):o(s)}function Nt(n){return n===1/0||Array.isArray(n)}function j(n,t=!0){if((!n||!E(n))&&t)throw new Error(`Object must be of type object or array! "${ot(n)}" given.`);return n instanceof C&&(n=n.value),n&&gt(n)}function fr(n,t,e,r={}){return t===1/0?r.level&&!E(n)?e([]):yt(n,e,r):e(S(t,!1))}var hr={...ee,...Gt},w=hr;function _t(n,t,e={},r={}){t=S(t).slice();for(var i=n;!D(i)&&!ft(i)&&t.length;){var o=t.shift();if(!(e.get?e.get(i,o):E(i)?o in i:i[o])){r.exists=!1;return}i=e.get?e.get(i,o):i[o]}return r.exists=!0,i}function re(n,t,e,r={},i={}){let o=(u,h,f)=>i.set?i.set(u,h,f):(k(t[c])&&_(u)?u.push(f):u[h]=f,!0);t=S(t);for(var s=n,c=0;c<t.length;c++)if(c<t.length-1){if(!s||!E(s)&&!$(s))return!1;var l=_t(s,t[c],i);if(!E(l)){if(i.buildTree===!1)return!1;l=$(i.buildTree)?i.buildTree(c):k(t[c+1])?[]:{};var a=o(s,t[c],l);if(!a)return!1}s=l}else return o(s,t[c],e)}var vt=class{constructor(t,e=!0){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),this.async=e,this.window.requestAnimationFrame?this._run():this.async=!1}_run(){this.window.requestAnimationFrame(()=>{for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t);this._run()})}onread(t,e=!1){if(e)return new Promise(r=>{this.async===!1?r(t()):this.readCallbacks.add(()=>{r(t())})});this.async===!1?t():this.readCallbacks.add(t)}onwrite(t,e=!1){if(e)return new Promise(r=>{this.async===!1?r(t()):this.writeCallbacks.add(()=>{r(t())})});this.async===!1?t():this.writeCallbacks.add(t)}cycle(t,e,r){this.onread(()=>{let i=t(r),o=s=>{s!==void 0&&this.onwrite(()=>{let c=e(s,r),l=a=>{a!==void 0&&this.cycle(t,e,a)};c instanceof Promise?c.then(l):l(c)})};i instanceof Promise?i.then(o):o(i)})}};function $e(n){return(n=n.trim())&&n.startsWith("(")&&n.endsWith(")")}function Dt(n,t,e,r=!0){e=(Array.isArray(e)?e:[e]).map(c=>(c+"").replace("(",r?"(.//":"(./")).join("|");let i=n.document.evaluate(e,t,null,XPathResult.ANY_TYPE),o=[],s;for(;s=i.iterateNext();)o.push(s);return o}function Ae(n,t,e){return e=(Array.isArray(e)?e:[e]).map(r=>(r+"").replace("(","(self::")).join("|"),n.document.evaluate(`${e}`,t,null,XPathResult.BOOLEAN_TYPE).booleanValue}function Ee(n,t="|"){return[...n].reduce(([e,r,i,o],s)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(s)?[e,r,[""].concat(i)]:(!e&&["(","[","{"].includes(s)&&!i[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(s)&&!i[0].endsWith("\\")&&r--,['"',"'","`"].includes(s)&&!i[0].endsWith("\\")&&(e=e===s?null:e||s),i[0]+=s,[e,r,i]),[null,0,[""]])[2].reverse()}var q=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:$e(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ee(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var K=class{constructor(t,e,r){this.context=t,this.namespace=e,this.window=t.defaultView||t.ownerDocument?.defaultView||r,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if($(t[0])?t=[[],...t]:O(t[0])&&!(t[0]instanceof q)&&t.length===1?t=[[],void 0,t[0]]:O(t[1])&&t.length===2?t=[S(t[0],!1),void 0,t[1]]:t[0]=S(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof q)&&!(e 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(e=>e instanceof q?e:new q(e)),t}registry(...t){return z("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,e,r){let{window:i}=this,o=Array.isArray(e)?e:[e],s=new Set;for(let[c,l]of this.registry(t))for(let[a,u]of l){let h=o.filter(f=>a.contains(f.target)?c==="subtree"||f.target===a:!1);if(!!h.length){Array.isArray(e)||(h=h[0]);for(let f of u)s.add([f,h,a])}}for(let[c,l,a]of s)r.call(i,c,l,a)}disconnectables(t,...e){let r={disconnect(){e.forEach(i=>i&&$(i.disconnect)&&i.disconnect()||$(i)&&i()||O(i)&&(i.disconnected=!0))}};return t&&t.addEventListener("abort",()=>r.disconnect()),r}};var B=class extends K{constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let i=typeof t=="string"||t instanceof q;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=ke(o,t);if(!e)return s;let c=r.lifecycleSignals&&this.createSignalGenerator();if(i)for(let l of s){let a=c?.generate()||{};e(l,a,o)}else{let l=c?.generate()||{};e(s,l,o)}if(r.live){c&&(r={...r,signalGenerator:c});let l=this.observe(i?t[0]:t,e,{newValue:!0,...r});return this.disconnectables(r.signal,l)}}observe(t,e,r={}){let i=typeof t=="string"||t instanceof q;if([t=[],e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(i?t[0]:t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:o,window:s,webqit:c}=this;r.eventDetails&&!c.realdom.attrInterceptionHooks?.intercepting&&Ce.call(s,"intercept",()=>{});let l=new s.MutationObserver(f=>{f=Te(f).map(p=>qe.call(s,p)),Se.call(s,h,f,o)}),a={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree};t.length&&(a.attributeFilter=t.map(f=>f+"")),l.observe(o,a);let u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),h={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:i,signalGenerator:u,disconnectable:l};return this.disconnectables(r.signal,l,u)}observeSync(t,e,r={}){let i=typeof t=="string"||t instanceof q;[t,e,r={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let c=r.timing==="intercept"?"intercept":"sync",l=r.subtree?"subtree":"children";this.registry(c).size||Ce.call(s,c,y=>{this.forEachMatchingContext(c,y,Se)});let a={disconnect(){p.delete(h),p.size||f.delete(o)}},u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),h={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:i,signalGenerator:u,disconnectable:a},f=this.registry(c,l);f.has(o)||f.set(o,new Set);let p=f.get(o);return p.add(h),this.disconnectables(r.signal,a,u)}};function Te(n){return n.reduce((t,e,r)=>t[r-1]?.attributeName===e.attributeName?t:t.concat(e),[])}function Se(n,t){let{context:e,spec:r,callback:i,params:o,atomics:s,originalFilterIsString:c,signalGenerator:l}=n,a=r.map(f=>f+"");if(o.atomic&&!s.size?t=ke(e,r,t):o.timing!=="async"&&r.length&&(t=t.filter(f=>a.includes(f.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(f=>{let p;return o.eventDetails||({event:p,...f}=f),!o.oldValue&&"oldValue"in f&&({oldValue:p,...f}=f),!o.newValue&&"value"in f?{value:p,...f}=f:o.newValue&&typeof f.value>"u"&&(f={...f,value:f.target.getAttribute(f.name)}),f})),o.atomic&&(t.forEach(f=>s.set(f.name,f)),t=Array.from(s.entries()).map(([,f])=>f));let u=c?t[0]:t,h=l?.generate()||{};i(u,h,e)}function ke(n,t,e=[]){let r={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",e.find(s=>s.name===o)||{target:n,name:o,value:n.getAttribute(o),...r})):Array.from(n.attributes).map(o=>e.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:o.nodeValue,...r})}function qe({target:n,attributeName:t,value:e,oldValue:r}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(n)||{})[t]?.[0]||"mutation";return{target:n,name:t,value:e,oldValue:r,type:"observation",event:s}}function Ce(n,t){let e=this,{webqit:r,document:i,Element:o}=e;r.realdom.attrInterceptionHooks||Object.defineProperty(r.realdom,"attrInterceptionHooks",{value:new Map}),r.realdom.attrInterceptionHooks.has(n)||r.realdom.attrInterceptionHooks.set(n,new Set),r.realdom.attrInterceptionHooks.get(n).add(t);let s=()=>r.realdom.attrInterceptionHooks.get(n).delete(t);if(r.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),r.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"attrInterceptionRecords",{value:new Map});let c=(u,h)=>{r.realdom.attrInterceptionRecords.has(u.target)||r.realdom.attrInterceptionRecords.set(u.target,{});let f=r.realdom.attrInterceptionRecords.get(u.target);f[u.name]=f[u.name]||[],f[u.name].unshift(u.event),r.realdom.attrInterceptionHooks.get("intercept")?.forEach(y=>y([u]));let p=h();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(y=>y([u])),p};new e.MutationObserver(u=>{u=u.filter(h=>!(e.webqit.realdom.attrInterceptionRecords?.get(h.target)||{})[h.attributeName]?.shift()),u=Te(u).map(h=>qe.call(e,h)),u.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(h=>h(u)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(h=>h(u)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let a=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(u=>{a[u]=o.prototype[u],o.prototype[u]=function(...h){let f,p=this.getAttribute(h[0]);["setAttribute","toggleAttribute"].includes(u)&&(f=h[1]),u==="toggleAttribute"&&f===void 0&&(f=p===null);let y={target:this,name:h[0],value:f,oldValue:p,type:"interception",event:[this,u]};return c(y,()=>a[u].call(this,...h))}}),s}var Ot=class extends K{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:i,window:o}=this;return new B(i,o).get(...arguments)}query(t,e=void 0,r={}){[t,e=void 0,r={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=a=>(o.has(a)||o.set(a,{target:a,entrants:[],exits:[],type:"query",event:null}),o.get(a));if(!r.generation||r.generation==="entrants"){if(!t.length)[...i.children].forEach(a=>s(i).entrants.push(a));else if(t.every(a=>a.type==="selector")){let[a,u]=t.reduce(([f,p],y)=>y.kind==="xpath"?[f,p.concat(y)]:[f.concat(y),p],[[],[]]),h=[];r.subtree?(a.length&&h.push(...i.querySelectorAll(a.join(","))),u.length&&h.push(...Dt(this.window,i,u))):(a.length&&h.push(...[...i.children].filter(f=>f.matches(a))),u.length&&h.push(...Dt(this.window,i,u,!1))),h.forEach(f=>s(f.parentNode||i).entrants.push(f))}}if(!e)return o;let c={disconnected:!1},l=e&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,a]of o){if(c.disconnected)break;let u=l?.generate()||{};e(a,u,i)}if(r.live){l&&(r={...r,signalGenerator:l});let a=this.observe(t,e,r);return this.disconnectables(r.signal,c,a)}return this.disconnectables(r.signal,c,l)}children(t,e=void 0,r={}){return[t,e=void 0,r={}]=this.resolveArgs(arguments),this.query(t,e,{...r,subtree:!1})}subtree(t,e=void 0,r={}){return[t,e=void 0,r={}]=this.resolveArgs(arguments),this.query(t,e,{...r,subtree:!0})}observe(t,e,r={}){if([t,e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:i,window:o,webqit:s,document:c}=this;r.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(c.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&Re.call(o,"sync",()=>{});let l=new o.MutationObserver(h=>h.forEach(f=>{ne.call(o,u,je.call(o,f),i)}));l.observe(i,{childList:!0,subtree:r.subtree});let a=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:i,spec:t,callback:e,params:r,signalGenerator:a,disconnectable:l};if(r.staticSensitivity){let h=Ie.call(o,u);return this.disconnectables(r.signal,l,a,h)}return this.disconnectables(r.signal,l,a)}observeSync(t,e,r={}){[t,e,r={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let s=r.timing==="intercept"?"intercept":"sync",c=r.subtree?"subtree":"children";this.registry(s).size||Re.call(o,s,y=>{this.forEachMatchingContext(s,y,ne)});let l=new o.MutationObserver(y=>y.forEach(m=>{Array.isArray((m=je.call(o,m)).event)||ne.call(o,h,m,i)}));l.observe(i,{childList:!0,subtree:r.subtree});let a={disconnect(){l.disconnect(),p.delete(h),p.size||f.delete(i)}},u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),h={context:i,spec:t,callback:e,params:r,signalGenerator:u,disconnectable:a},f=this.registry(s,c);f.has(i)||f.set(i,new Set);let p=f.get(i);if(p.add(h),r.staticSensitivity){let y=Ie.call(o,h);return this.disconnectables(r.signal,a,u,y)}return this.disconnectables(r.signal,a,u)}};function Ie(n){let t=this,{context:e,spec:r,callback:i,params:o,signalGenerator:s}=n,c=r.filter(p=>p.kind==="css"),l=p=>p.match(/\.([\w-]+)/g)?.length?["class"]:[],a=p=>p.match(/#([\w-]+)/g)?.length?["id"]:[],u=p=>[...p.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(y=>y[1]).concat(l(p)).concat(a(p));if(!(n.$attrs=Array.from(new Set(c.filter(p=>(p+"").includes("[")).reduce((p,y)=>p.concat(u(y+"")),[])))).length)return;let h=new Set,f=new Set;return h.push=p=>(f.delete(p),h.add(p)),f.push=p=>(h.delete(p),f.add(p)),n.$deliveryCache={entrants:h,exits:f},new B(e,t).observe(n.$attrs,p=>{let y=new Map,m=d=>(y.has(d)||y.set(d,{target:d,entrants:[],exits:[],type:"static",event:null}),y.get(d)),x=new WeakMap,g=d=>(x.has(d)||x.set(d,c.some(b=>d.matches(b+""))),x.get(d));for(let d of p)["entrants","exits"].forEach(b=>{o.generation&&b!==o.generation||n.$deliveryCache[b].has(d.target)||(b==="entrants"?!g(d.target):g(d.target))||(n.$deliveryCache[b].push(d.target),m(d.target)[b].push(d.target),m(d.target).event=d.event)});for(let[,d]of y){let b=s?.generate()||{};i(d,b,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function ne(n,t){let{context:e,spec:r,callback:i,params:o,signalGenerator:s,$deliveryCache:c}=n,l={...t,entrants:[],exits:[]};if(o.eventDetails||delete l.event,["entrants","exits"].forEach(u=>{if(!(o.generation&&u!==o.generation)&&(r.length?l[u]=gr.call(this,r,t[u],t.event!=="parse"):l[u]=[...t[u]],!!c))for(let h of l[u])c[u].push(h)}),!l.entrants.length&&!l.exits.length)return;let a=s?.generate()||{};i(l,a,e)}function gr(n,t,e){t=Array.isArray(t)?t:[...t];let r=(i,o)=>{if(o.type==="selector"){let s=o.isXpathAttr?[]:i.filter(c=>o.kind==="xpath"?Ae(this,c,o+""):c.matches&&c.matches(o+""));if((e||o.isXpathAttr)&&(s=i.reduce((c,l)=>o.kind==="xpath"?[...c,...Dt(this,l,o,e)]:l.querySelectorAll?[...c,...l.querySelectorAll(o+"")]:c,s)),s.length)return s}else if(i.includes(o.content)||e&&i.some(s=>s.contains(o.content)))return[o.content]};return t.$$searchCache||(t.$$searchCache=new Map),n.reduce((i,o)=>{let s;return t.$$searchCache.has(o.content)?s=t.$$searchCache.get(o.content):(s=r(t,o)||[],o.type==="instance"&&t.$$searchCache.set(o.content,s)),i.concat(s)},[])}function je({target:n,addedNodes:t,removedNodes:e}){let r=this,i;return i=S(t).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),null),i=S(e).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),i),i=i||r.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:t,exits:e,type:"observation",event:i}}function Re(n,t){let e=this,{webqit:r,document:i,Node:o,CharacterData:s,Element:c,HTMLElement:l,HTMLTemplateElement:a,DocumentFragment:u}=e;r.realdom.domInterceptionHooks||Object.defineProperty(r.realdom,"domInterceptionHooks",{value:new Map}),r.realdom.domInterceptionHooks.has(n)||r.realdom.domInterceptionHooks.set(n,new Set),r.realdom.domInterceptionHooks.get(n).add(t);let h=()=>r.realdom.domInterceptionHooks.get(n).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return h;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let f=(m,x)=>{m.entrants.concat(m.exits).forEach(d=>{clearTimeout(r.realdom.domInterceptionRecords.get(d)?.timeout),r.realdom.domInterceptionRecords.set(d,m.event);let b=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(d)},0);Object.defineProperty(m.event,"timeout",{value:b,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(d=>d(m));let g=x();return r.realdom.domInterceptionHooks.get("sync")?.forEach(d=>d(m)),g},p={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(...g){let d=this instanceof s?p.characterData:p.other,b=()=>d[m].call(this,...g);if(!(this instanceof s||this instanceof c||this instanceof u))return b();let A=[],v=[],X=this;["insertBefore"].includes(m)?v=[g[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(m)?(v=[g[1]],["beforebegin","afterend"].includes(g[0])&&(X=this.parentNode)):["setHTML","replaceChildren"].includes(m)?(A=[...this.childNodes],v=m==="replaceChildren"?[...g]:[g[0]]):["replaceWith","remove"].includes(m)?(A=[this],v=m==="replaceWith"?[...g]:[],X=this.parentNode):["replaceChild"].includes(m)?(A=[g[1]],v=[g[0]]):["removeChild"].includes(m)?A=[...g]:(v=[...g],["before","after"].includes(m)&&(X=this.parentNode));let J=m;if(["insertAdjacentHTML","setHTML"].includes(m)){let me=this.nodeName;if(m==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(g[0])){if(!this.parentNode)return d[m].call(this,...g);me=this.parentNode.nodeName}let St=i.createElement(me);d.setHTML.call(St,v[0],m==="setHTML"?g[1]:{}),v=[...St.childNodes],m==="insertAdjacentHTML"?(J="insertAdjacentElement",g[1]=new u,g[1].______isTemp=!0,g[1].append(...St.childNodes)):(J="replaceChildren",g=[...St.childNodes])}return f({target:X,entrants:v,exits:A,type:"interception",event:[this,m]},()=>d[J].call(this,...g))}["insertBefore","replaceChild","removeChild","appendChild"].includes(m)?(p.other[m]=o.prototype[m],o.prototype[m]=x):(["after","before","remove","replaceWith"].includes(m)&&(p.characterData[m]=s.prototype[m],s.prototype[m]=x),c.prototype[m]&&(p.other[m]=c.prototype[m],c.prototype[m]=x))});let y=Object.create(null);return["outerHTML","outerText","innerHTML","innerText","textContent","nodeValue"].forEach(m=>{let x=["textContent","nodeValue"].includes(m)?o:["outerText","innerText"].includes(m)?l:c;y[m]=Object.getOwnPropertyDescriptor(x.prototype,m),Object.defineProperty(x.prototype,m,{...y[m],set:function(g){let d=()=>y[m].set.call(this,g);if(!(this instanceof c))return d();let b=[],A=[],v=this;if(["outerHTML","outerText"].includes(m)?(b=[this],v=this.parentNode):b=[...this.childNodes],["outerHTML","innerHTML"].includes(m)){let J=this.nodeName;if(m==="outerHTML"){if(!this.parentNode)return d();J=this.parentNode.nodeName}let it=i.createElement(J==="TEMPLATE"?"div":J);y[m].set.call(it,g),A=this instanceof a?[]:[...it.childNodes],m==="outerHTML"?(g=new u,g.______isTemp=!0,g.append(...it.childNodes),d=()=>c.prototype.replaceWith.call(this,g)):this instanceof a?d=()=>this.content.replaceChildren(...it.childNodes):d=()=>c.prototype.replaceChildren.call(this,...it.childNodes)}return f({target:v,entrants:A,exits:b,type:"interception",event:[this,m]},d)}})}),["append","prepend","replaceChildren"].forEach(m=>{[i,u.prototype].forEach(x=>{let g=x[m];x[m]=function(...d){if(this.______isTemp)return g.call(this,...d);let b=m==="replaceChildren"?[...this.childNodes]:[];return f({target:this,entrants:d,exits:b,type:"interception",event:[this,m]},()=>g.call(this,...d))}})}),h}function Me(){yr.call(this),br.call(this),wr.call(this)}function yr(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function br(){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 wr(){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 e=(this.document||this.ownerDocument).querySelectorAll(t),r=e.length;--r>=0&&e.item(r)!==this;);return r>-1})}function Ne(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.realdom)return n.webqit.realdom;n.webqit.realdom={},Me.call(n),n.webqit.realdom.meta=(...e)=>xr.call(n,...e),n.webqit.realdom.ready=(...e)=>ie.call(n,...e),n.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new Ot(e,n);if(r==="attr")return new B(e,n)};let t=new vt(n);return n.webqit.realdom.schedule=(e,...r)=>t[`on${e}`](...r),n.webqit.realdom}function ie(...n){let t="interactive",e;ct(n[0])?(t=n[0],$(n[1])&&(e=n[1])):$(n[0])&&(e=n[0]);let r={interactive:["interactive","complete"],complete:["complete"]};if(!r[t])throw new Error(`Invalid ready-state timing: ${t}.`);let i=this;if(!e)return i.webqit.realdom.readyStatePromises||(i.webqit.realdom.readyStatePromises={interactive:new Promise(o=>ie.call(this,"interactive",o)),complete:new Promise(o=>ie.call(this,"complete",o))}),i.webqit.realdom.readyStatePromises[t];if(r[t].includes(i.document.readyState))return e(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(e)}function xr(n){let t=this,e={},r;return(r=t.document.querySelector(`meta[name="${n}"]`))&&(e=(r.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(c=>c.trim());return re(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:k(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return r.content},json(){return JSON.parse(JSON.stringify(e))}}}var M=(...n)=>z("oohtml",...n);function oe(n,t,e){let r=n.toUpperCase().replace("-","_"),i=this,o=Ne.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[r]||(i.webqit.oohtml.configs[r]={}),mt(2,i.webqit.oohtml.configs[r],e,t,o.meta(n).json()),{config:i.webqit.oohtml.configs[r],realdom:o,window:i}}function se(n,t,e=1,r=!1){if(e&&typeof n=="object"&&n&&typeof t=="object"&&t&&(!r||Object.keys(n).length===Object.keys(t).length)){for(let i in n)if(!se(n[i],t[i],e-1,r))return!1;return!0}return Array.isArray(n)&&Array.isArray(t)&&n.length===t.length?(t=t.slice(0).sort())&&n.slice(0).sort().every((i,o)=>i===t[o]):n===t}var $t=class{constructor(t,e){Object.defineProperty(this,"request",{value:t}),Object.defineProperty(this,"hostElement",{value:e}),t.live&&!t.signal&&(Object.defineProperty(this,"abortController",{value:new AbortController}),t.signal=this.abortController.signal)}callback(t){w.defineProperty(this,"value",{value:t,configurable:!0,enumerable:!0})}abort(){if(this.abortController)return this.abortController.abort();let t=this.hostElement.ownerDocument?.defaultView||this.hostElement.defaultView;if(this.request.signal)return this.request.signal.dispatchEvent(new t.Event("abort"))}};function Fe(){let n=this;return class extends n.Event{constructor(e,r,{type:i="contextrequest",...o}={}){super(i,o),Object.defineProperty(this,"request",{get:()=>e}),Object.defineProperty(this,"callback",{get:()=>r})}respondWith(e,...r){if(this.request.diff){if("prevValue"in this&&this.prevValue===e)return;Object.defineProperty(this,"prevValue",{value:e,configurable:!0})}return this.callback(e,...r)}}}var H=class{static instance(t){return M(t).get("context::instance")||new this(t)}constructor(t){M(t).get("context::instance")?.dispose(),M(t).set("context::instance",this);let e={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>e});let r=Fe.call(t.ownerDocument?.defaultView||t.defaultView);Object.defineProperty(this,"ContextRequestEvent",{get:()=>r}),this[Symbol.iterator]=function*(){yield*e.contexts}}get length(){this["#"].contexts.size}findProvider(t){return[...this["#"].contexts].find(t)}attachProvider(t){this["#"].contexts.add(t),t.initialize(this["#"].host)}detachProvider(t){t.dispose(this["#"].host),this["#"].contexts.delete(t)}request(t,e=null,r={}){typeof e=="object"&&(r=e,e=null);let i;e||(i=new $t(t,this["#"].host),e=i.callback.bind(i));let o=this["#"].host.dispatchEvent(new this.ContextRequestEvent(t,e,{bubbles:!0,...r}));return i??o}dispose(){}};var U=class{static get config(){return{}}static attachTo(t,e,r=!1){this.providers.set(this.type,this);let i,o=H.instance(t);return!r&&(i=o.findProvider(s=>this.matchId(s.id,e)))?i:o.attachProvider(new this(e))}static detachFrom(t,e,r=!1){let i,o=H.instance(t);for(i of o["#"].contexts)if(!(!this.matchId(i.id,e)||typeof r=="function"&&!r(i))&&(o.detachProvider(i),typeof multiple!="function"&&!r))return i}static createId(t,e={}){let r={type:this.type,...e};return r.contextName||(t.getAttribute&&!(r.contextName=(t.getAttribute(this.config.context.attr.contextname)||"").trim())?delete r.contextName:t.ownerDocument||(r.contextName="root")),r}static matchId(t,e){return se(t,e,1,!0)}static createRequest(t={}){return{type:this.type,...t}}static matchRequest(t,e){return e.type===t.type&&(!e.contextName||e.contextName===t.contextName)}constructor(t){Object.defineProperty(this,"id",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get length(){this.subscriptions.size}handle(t){}subscribe(t){this.subscriptions.add(t),t.request.signal&&t.request.signal.addEventListener("abort",()=>{this.unsubscribe(t)})}unsubscribe(t){this.subscriptions.delete(t),t.request.controller?.abort()}handleEvent(t){if(!(this.disposed||t.target===this.host&&t.request?.superContextOnly||!(typeof t.request=="object"&&t.request)||typeof t.respondWith!="function"||!this.constructor.matchRequest(this.id,t.request)))if(t.stopPropagation(),t.type==="contextclaim"){let e=new Set;this.subscriptions.forEach(r=>{!t.target.contains(r.request.superContextOnly?r.target.parentNode:r.target)||!this.constructor.matchRequest(t.request,r.request)||(this.subscriptions.delete(r),e.add(r))}),t.respondWith(e)}else t.type==="contextrequest"&&(t.request.live&&this.subscribe(t),this.handle(t))}initialize(t){return this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this),H.instance(t).request({...this.id,superContextOnly:!0},e=>e.forEach(r=>{this.subscribe(r),this.handle(r)}),{type:"contextclaim"}),this}dispose(t){return this.disposed=!0,t.removeEventListener("contextrequest",this),t.removeEventListener("contextclaim",this),this.subscriptions.forEach(e=>{this.unsubscribe(e);let{target:r,request:i,callback:o,options:s}=e;H.instance(r).request(i,o,s)}),this}};F(U,"providers",new Map),F(U,"type");var lt=class extends U{static createRequest(t={}){let e=super.createRequest(t);if(e.detail?.startsWith("@")){let[r,...i]=e.detail.slice(1).split(".").map(o=>o.trim());e.contextName=r,e.detail=i.join(".")}return e}static matchRequest(t,e){return super.matchRequest(t,e)&&(!e.detail||!t.detail||(Array.isArray(e.detail)?e.detail[0]===t.detail:e.detail===t.detail))}get bindingsObj(){return this.host[this.constructor.config.api.bindings]}handle(t){if(t.request.controller?.abort(),!(t.request.detail+"").trim())return t.respondWith(this.bindingsObj);t.request.controller=w.reduce(this.bindingsObj,Array.isArray(t.request.detail)?t.request.detail:[t.request.detail],w.get,e=>{this.disposed||t.respondWith(e.value)},{live:t.request.live,descripted:!0})}};F(lt,"type","bindings");var ce=(n,...t)=>{let e=t.pop();return n.constructor.name==="AsyncFunction"?G(n.call(...t),e):e(n.call(...t))},G=(n,t)=>n instanceof Promise?n.then(t):t(n),ae=n=>typeof n=="object"&&n||typeof n=="function";function De(n){let t=typeof n[n.length-1]=="object"?n.pop():{},e=n.pop()||"";return t.functionParams=n,{source:e,params:t}}var Le={};function Ve(...n){let t,e={runtimeParams:Or,compilerParams:vr,parserParams:_r};for(;t=n.shift();){let{runtimeParams:r={},compilerParams:{globalsNoObserve:i=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:c={}}=t;e={runtimeParams:{...e.runtimeParams,...r},compilerParams:{...e.compilerParams,globalsNoObserve:[...e.compilerParams.globalsNoObserve,...i],globalsOnlyPathsExcept:[...e.compilerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...e.parserParams,...c}},n.devMode}return e}var _r={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},vr={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Or={apiVersion:3};var At=Object.create(null);var tt=class extends EventTarget{managedAlways=new Set;managedOnce=new Set;constructor(){super(),Le.setMaxListeners?.(0,this)}fire(t){return this.dispatchEvent(new Event(t,{cancelable:!0}))}on(...t){return this.addEventListener(...t),()=>this.removeEventListener(...t)}abort(t=!1){this.managedAlways.forEach(e=>e.abort?e.abort(t):e(t)),this.managedOnce.forEach(e=>e.abort?e.abort(t):e(t)),this.managedOnce.clear(),this.fire("abort")}manage(t){this.managedAlways.add(t)}once(t){this.managedOnce.add(t)}};var et=class extends tt{subscribers=new Set;signals=new Map;constructor(t,e,r){super(),this.context=t,this.context?.once(()=>this.abort()),this.once(()=>this.watchMode(!1)),this.type=e,this.state=r}get name(){return[...this.context?.signals.keys()||[]].find(t=>this.context.signals.get(t)===this)}signal(t,e="prop"){let r=this.signals.get(t);return r||(r=new et(this,e,e==="object"?t:ae(this.state)?w.get(this.state,t):void 0),this.signals.set(t,r),this.signals.size===1&&this.watchMode(),r.once(()=>{this.signals.delete(t),this.signals.size||this.watchMode(!1)})),r}subscribe(t){this.subscribers.add(t),t.once(()=>{this.subscribers.delete(t),this.subscribers.size||this.abort()})}watchMode(t=!0){this.mutationsWatch?.abort(),!(!t||!this.signals.size||!ae(this.state))&&(this.mutationsWatch=w.observe(this.state,e=>{let r={map:new Map,add(o,s){for(let c of o)c.spec.beforeSchedule?.(s)!==!1&&(this.map.has(c.runtime)||this.map.set(c.runtime,new Set),this.map.get(c.runtime).add(c))}};for(let o of e){let s=this.signals.get(o.key);!s||(r.add(s.subscribers,o),s.refresh(o.value))}let i=r.map.size?[...r.map].sort((o,s)=>o.$serial>s.$serial?-1:1):r.map;for(let[o,s]of i)o.state!=="aborted"&&o.schedule(...s)},{recursions:"force-sync"}))}refresh(t){this.state=t;for(let[e,r]of this.signals)r.refresh(w.get(this.state??{},e));this.watchMode()}};var T=class extends et{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var N=class extends tt{state;constructor(t,e,r,i,o,s){super(),t?.once(this),this.context=t,this.type=e,this.spec=r,this.scope=o,t?.scope!==o&&this.manage(o),this.serial=i,s&&(this.closure=s),t?.type==="iteration"?this.path=t.path.concat(this.spec.index):t?.type==="round"?this.path=t.path.concat(this.serial):this.path=(t?.path||[]).slice(0,-1).concat(this.serial),this.flowControl=new Map}get runtime(){return this.context.runtime}contains(t){return this===t.context||t.context&&this.contains(t.context)}order(t){if(!t)return this;let[e,r]=t.path.length<this.path.length?[t,this]:[this,t];return e.path.reduce((i,o,s)=>i&&o<=r.path[s],!0)&&e||r}beforeExecute(){this.state="running";let t=this.flowControl;return this.flowControl=new Map,t}execute(t=null){try{return this.runtime.thread.unshift(this),G(this.beforeExecute(),e=>ce(this.closure,this,this,r=>(this.spec.complete&&(r=this.spec.complete(r,this)),this.afterExecute(e),this.runtime.thread.shift(),t?t(r,this):r)))}catch(e){if(e.cause)throw e;let r=`${e.message||e}`;this.runtime.throw(r,[this.serial,this.context?.serial],globalThis[e.name])}}afterExecute(t){this.state="complete";let e=this.flowControl;this.handleDownstream(e.size,t.size),this.handleRightstream(e.size,t.size);for(let r of["break","continue","return"])e.has(r)&&!e.get(r).endpoint?this.hoistFlowControl(r,e.get(r).arg):t.has(r)&&!t.get(r).endpoint&&this.hoistFlowControl(r,t.get(r).arg,!0)}typed(t,e,r=void 0){let i=Array.isArray(e)?"array":e===null?"null":typeof e;if(i===t||t==="iterable"&&e?.[Symbol.iterator]||t==="desctructurable"&&!["undefined","null"].includes(i))return e;throw t==="iterable"?new Error("value is not iterable."):t==="desctructurable"?new Error((r?`Cannot access ${r}; `:"")+"object not desctructurable."):new Error(`value must be of type ${t}.`)}let(t,e,r,i={}){return this.var(t,e,r,{...i,kind:"let"})}const(t,e,r,i={}){return this.var(t,e,r,{...i,kind:"const"})}var(t,e,r,i={}){i={kind:"var",...i},r||(r=()=>{});let o=i.restOf?(...c)=>{try{return r(...c)}catch(l){throw new Error(`Cannot declare ${t}; ${l.message}`)}}:r,s=(c,l)=>{let a=i.kind==="var"?this.runtime.scope:l.scope;for(;i.kind==="var"&&!["module","function"].includes(a.type)&&!w.has(a.state,t)&&a.context;)a=a.context;let u=a.symbols.get(t);if(u&&(u.kind!==i.kind||i.kind==="let"&&u.serial!==e))throw new Error(`Identifier "${t}" has already been declared.`);u?.reader?.abort(),u={serial:e,kind:i.kind};let h=c;return i.restOf&&(i.type==="array"?h=[]:h={},u.reader=w.read(c,h,{except:i.restOf,spread:i.type==="array"}),l.once(u.reader)),a.symbols.set(t,u),w.set(a.state,t,h),h};return this.autorun(i.kind,{complete:s,...i},e,o)}update(t,e,r={}){let i=this.scope;for(;i&&!w.has(i.state,t);)i=i.context;if(!i)throw new ReferenceError(`${t} is not defined.`);let o=i.symbols.get(t);if(o?.kind==="const")throw new ReferenceError(`Assignment to constant variable "${t}".`);let s=w.get(i.state,t),c=r.restOf?(...l)=>{try{return e(...l)}catch(a){throw new Error(`Cannot update ${t}; ${a.message}`)}}:e;return ce(c,void 0,s,l=>{o?.reader?.abort();let a=l;return r.restOf&&(o=o||{},r.type==="array"?a=[]:a={},o.reader=w.read(l,a,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader)),w.set(i.state,t,a),["postinc","postdec"].includes(r.kind)?s:a})}ref(t,...e){let r=0,i={};typeof e[0]=="number"?(r=e.shift(),i=e.shift()||{}):typeof e[0]=="object"&&(i=e.shift());let o=this.scope;for(;o&&!w.has(o.state,t);)o=o.context;if(!o){if(i.isTypeCheck)return;throw new Error(`${t} is not defined.`)}let s=o.symbols.get(t)?.kind,c=o.signal(t,s);return i.typed&&this.typed(i.typed,c.state,t),this.autobind(c,r,i)}obj(t,...e){let r=0,i={};return typeof e[0]=="number"?(r=e.shift(),i=e.shift()||{}):typeof e[0]=="object"&&(i=e.shift()),this.autobind(this.runtime.$objects.signal(t,"object"),r,i)}autobind(t,e,r){let i=this.runtime.$params.isStatefulFunction,o=t.type==="const",s=this===this.runtime,c=this.state==="aborted",l=this;return function a(u,h){if(i&&!o&&!s&&!c&&u.subscribe(l),!h||!u.state||typeof u.state!="object"){let p=u.state;return typeof u.state=="function"&&(p=w.proxy(u.state,{membrane:u})),p}let f;return w.proxy(u.state,{},p=>({...p,get(y,m,x=null){return f?p.get(y,m,x):(f=!0,a(u.signal(m),h-1))}}))}(t,e)}autorun(t,...e){let r=e.pop(),i=e.pop(),o=e.pop()||{},s=N,c=this.scope;if(t==="iteration"){let a=this.runtime.constructor;s=r.constructor.name==="AsyncFunction"?a.AutoAsyncIterator:a.AutoIterator}["block","iteration"].includes(t)&&(c=new T(c,t));let l=new s(this,t,o,i,c,r);if(!(t==="downstream"&&(this.downstream=l,this.flowControlApplied())))return l.execute()}function(t,e,r,i){t&&w.set(this.scope.state,i.name,i);let o=this;return Object.defineProperty(i,"toString",{value:function(s=!1){if(s&&e)return Function.prototype.toString.call(i);let c=o.runtime.extractSource(r);return c.startsWith("static ")?c.replace("static ",""):c}}),i}class(t,e,r){return t&&w.set(this.scope.state,e.name,e),r.forEach(({name:i,static:o,isStatefulFunction:s,serial:c})=>{this.function(!1,s,c,o?e[i]:e.prototype[i])}),e}async import(...t){return this.runtime.import(...t)}async export(...t){return this.runtime.export(...t)}continue(t){return this.applyFlowControl("continue",t)}break(t){return this.applyFlowControl("break",t)}return(t){return this.applyFlowControl("return",t)}applyFlowControl(t,e,r=!1){let i=this.flowControl.size;if(r?this.flowControl.delete(t):this.flowControl.set(t,{arg:e}),this.type==="round"&&(this.context.breakpoint=this),this.type==="round"&&["break","continue"].includes(t)&&e===this.context?.spec.label){r||(this.flowControl.get(t).endpoint=!0),this.state!=="running"&&this.handleRightstream(this.flowControl.size,i);return}this.state!=="running"&&(this.handleDownstream(this.flowControl.size,i),this.hoistFlowControl(...arguments))}hoistFlowControl(...t){return this.context?.applyFlowControl(...t)}flowControlApplied(t,e){return arguments.length?arguments.length===1?this.flowControl.has(t):this.flowControl.get(t)?.arg===e:this.flowControl.size||!1}handleDownstream(t,e){let r;this.type!=="block"||!(r=this.context?.downstream)||(t?r.abort():e&&(r.state="resuming",this.runtime.schedule(r)))}handleRightstream(t,e){if(this.type!=="round")return;let r=this,i=new Set;for(;r=r.nextRound;)t?r.abort():e&&r.state!=="inert"&&(r.state="resuming",i.add(r));i.size&&this.runtime.schedule(...i),!t&&e&&this.runtime.on("reflection",()=>{this.context.iterating||this.context.iterate()},{once:!0})}abort(t=!1){return t&&(this.context?.breakpoint===this&&delete this.context.breakpoint,this.flowControl.clear()),this.state=t?"inert":"aborted",super.abort(t)}};var rt=class extends N{rounds=new Map;constructor(t,e,r,i,o,s){r.$closure=s,super(t,e,r,i,o),this.manage(()=>{delete this.breakpoint,this.rounds.clear()})}pseudorun(t){return this.runtime.iThread.unshift(this),G(t(),e=>(this.runtime.iThread.pop(),e))}createIterator(){return this.spec.kind==="for-in"?function*(){for(let t in this.iteratee)yield t}.call(this):this.spec.kind==="for-of"?function*(){for(let t of this.iteratee)yield t}.call(this):{next:()=>({done:!this.pseudorun(()=>this.spec.test(this))})}}closure(){["for-of","for-in"].includes(this.spec.kind)?([this.production,this.iteratee]=this.spec.parameters(this),this.iterator=this.createIterator(),this.iterator.original=!0,this.watchMode()):(this.spec.kind==="for"&&this.spec.init(this),this.iterator=this.createIterator()),this.iterate()}terminated(){return this.breakpoint&&!this.breakpoint.flowControlApplied("continue",this.spec.label)&&this.breakpoint.flowControlApplied()}advance(){this.spec.kind==="for"&&this.pseudorun(()=>this.spec.advance(this))}iterate(){this.iterating=!0;let t=()=>!this.terminated()&&!(this.cursor=this.iterator.next()).done,e=()=>{this.createRound(this.cursor.value).execute(),this.advance()};if(this.spec.kind==="do-while")do e();while(t());else for(;t();)e();this.iterating=!1}createRound(t){let e=this.rounds.size,r={index:e},i=["for-in","for-of"].includes(this.spec.kind)?{[this.production]:t}:{...this.scope.state},o=new T(this.scope,"round",i);this.scope.symbols.forEach((l,a)=>{o.symbols.set(a,l)});let s=new N(this,"round",r,this.serial,o,this.spec.$closure),c=this.spec.kind==="for-in"?t:e;return this.rounds.set(c,s),this.lastRound&&(this.lastRound.nextRound=s,s.prevRound=this.lastRound),this.lastRound=s,s}watchMode(){let t=(e,r)=>{let i=new Set,o=new Set;for(let s of e){if(Array.isArray(this.iteratee)&&s.key==="length")continue;let c=this.spec.kind==="for-in"?s.key:s.value,l=this.spec.kind==="for-in"?s.key:parseInt(s.key),a=this.rounds.get(l);if(a)w.set(a.scope.state,this.production,c),s.type==="delete"&&(this.rounds.set(l,void 0),a.prevRound&&(a.prevRound.nextRound=a.nextRound),a.nextRound&&(a.nextRound.prevRound=a.prevRound),i.add(a));else if(s.type!=="delete"&&!s.isUpdate){if(this.spec.kind==="for-of"&&this.iterator.original&&!r.done)continue;o.add(c)}}this.runtime.on("reflection",()=>{i.forEach(s=>s.abort(!0))},{once:!0}),o.size&&(this.iterator=function*(s){yield*s,yield*o}(this.iterator),r.done&&this.iterate())};this.once(w.observe(this.iteratee,e=>{G(this.cursor,r=>t(e,r))}))}};var Et=class extends rt{async createIterator(){return this.spec.kind==="for-in"?function*(){for(let t in this.iteratee)yield t}.call(this):this.spec.kind==="for-of"?function*(){for(let t of this.iteratee)yield t}.call(this):{next:async()=>({done:!await this.pseudorun(()=>this.spec.test(this))})}}async closure(){["for-of","for-in"].includes(this.spec.kind)?([this.production,this.iteratee]=await this.spec.parameters(this),this.iterator=await this.createIterator(),this.iterator.original=!0,this.watchMode()):(this.spec.kind==="for"&&await this.spec.init(this),this.iterator=await this.createIterator()),await this.iterate()}async iterate(){let t;this.iterating=!0;let e=async()=>!this.terminated()&&(this.cursor=this.iterator.next())&&(t=await this.cursor)&&!t.done,r=async()=>{await this.createRound(t.value).execute(),await this.advance()};if(this.spec.kind==="do-while")do await r();while(await e());else for(;await e();)await r();this.iterating=!1}};var Pt=class{constructor(t){Object.defineProperty(this,"runtime",{value:t});let e={statechange:()=>{w.defineProperty(this,"value",{value:t.flowControl.get("return")?.arg,enumerable:!0,configurable:!0})}};for(let r in e)t.on(r,e[r]),e[r]();t.$params.sourceType==="module"&&Object.defineProperty(this,"exports",{value:t.exports})}dispose(){return this.runtime.abort(!0)}};var nt=class extends N{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,i,o){super(t,e,{},-1,i,o);let{$serial:s=0,...c}=r;this.$serial=s,this.$params=c,this.$objects=new T(void 0,"objects"),this.manage(this.$objects),this.exports=Object.create(null),this.$promises={imports:[],exports:[]},this.manage(()=>{w.deleteProperties(this.exports,Object.keys(this.exports)),this.$promises.imports.splice(0),this.$promises.exports.splice(0)})}extractSource(t,e=!1){let[[r,i,o],[s]]=this.locations[t],c=this.$params.originalSource.slice(r,s);return e?{expr:c,line:i,column:o}:c}throw(t,e,r=null,i=null){let o,s=i!==null?`[${i}]: ${t}`:t,c=e.map(a=>a!==-1&&this.extractSource(a,!0)).filter(a=>a);c.push({source:this.$params.originalSource}),o=new(r||Error)(s,{cause:c});let l=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw l&&(o.fileName=l),i&&(o.code=i),o}get runtime(){return this}get nowRunning(){return this.thread[0]}schedule(...t){let e=this.queue.size;for(let r of t)this.queue.add(r);if(!e)return this.flowControlDirty=!1,function r(i,o){let s;for(let c of this.queue){if(o&&o.order(c)!==o||["aborted","running"].includes(c.state)||this.iThread[0]?.contains(c)){this.queue.delete(c);continue}s=s?s.order(c):c,o||(o=s)}return s?(s.abort(),s.execute(c=>(this.queue.delete(s),r.call(this,c,s)))):(this.fire("reflection"),this.flowControlApplied()&&this.fire("statechange"),i)}.call(this,void 0,this.nowRunning)}execute(t=null){return super.execute(e=>{let r=this.$params.isStatefulFunction?new Pt(this):e;return t?t(r,this):r})}spawn(t,e,r){let i=this.nowRunning||this,o={...this.$params,$serial:this.$serial+1,isStatefulFunction:t},s=new T(i.scope,"function",{this:e});return new this.constructor(i,"function",o,s,r).execute()}async import(...t){let e=t.pop(),r=typeof e=="string"?{source:e}:e,i=s=>{if(r.forExport||r.isDynamic)return s;this.assignModules(t,this.scope.state,s,e.serial)};if(this.$params.experimentalFeatures!==!1&&At[r.source])return i(At[r.source]);let o=(async()=>{let s=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;try{return i(await import(r.source))}catch(c){throw c.code==="ERR_MODULE_NOT_FOUND"&&this.throw(`Cannot find package "${r.source}"${s?` imported at "${s}"`:""}.`,[r.serial],null,c.code),c}})();return r.isDynamic||this.$promises[r.forExport?"exports":"imports"].push(o),o}async export(...t){let e=Array.isArray(t[t.length-1])?null:t.pop(),r=e?await this.import({...e,forExport:!0}):this.scope.state;this.assignModules(t,this.exports,r,e?.serial)}assignModules(t,e,r,i=null){let o=[];for(let[s,c,l]of t){if(s==="*"&&l){w.set(e,l,r);continue}w.has(r,s)||this.throw(`The requested module does not provide an export named "${s}".`,[c,i]),w.set(e,l||s,w.get(r,s)),o.push([s,c,l])}!o.length||this.once(w.observe(r,s=>{for(let[c,,l]of o)for(let a of s)c==="*"?w.set(e,a.key,a.value):a.key===c&&w.set(e,l||c,a.value)}))}afterExecute(...t){return this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace&&(At[this.$params.exportNamespace]=this.exports,this.once(()=>{delete At[this.$params.exportNamespace]})),super.afterExecute(...t)}};F(nt,"AutoAsyncIterator",Et),F(nt,"AutoIterator",rt);function He(n,t,e,r){let{env:i,functionParams:o=[],exportNamespace:s,fileName:c}=r,{parserParams:l,compilerParams:a,runtimeParams:u}=Ve(r);if(n==="module")l.sourceType=n,l.allowAwaitOutsideFunction=!0;else if(["function","async-function"].includes(n)){let f=" "+e.split(`
1
+ (()=>{var pe=Object.defineProperty;var Be=(n,t,e)=>t in n?pe(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var de=(n,t)=>{for(var e in t)pe(n,e,{get:t[e],enumerable:!0})};var D=(n,t,e)=>(Be(n,typeof t!="symbol"?t+"":t,e),e);var ee={};de(ee,{apply:()=>It,batch:()=>Mt,construct:()=>Yt,defineProperties:()=>lr,defineProperty:()=>bt,deleteProperties:()=>ur,deleteProperty:()=>wt,get:()=>V,getOwnPropertyDescriptor:()=>jt,getOwnPropertyDescriptors:()=>ar,getPrototypeOf:()=>Xt,has:()=>Rt,intercept:()=>sr,isExtensible:()=>Jt,observe:()=>te,ownKeys:()=>yt,path:()=>or,preventExtensions:()=>Zt,read:()=>cr,reduce:()=>Kt,set:()=>Z,setPrototypeOf:()=>Qt});function O(n){return!Array.isArray(n)&&typeof n=="object"&&n}function ot(n){return typeof n}function _(n){return Array.isArray(n)}function Lt(n,t,e=null){return _(t)?n.filter(r=>e?t.filter(i=>e(r,i)).length:t.indexOf(r)!==-1):[]}function z(n,...t){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new ut}),!arguments.length)return globalThis.webqit.refs;let e=globalThis.webqit.refs.get(n);e||(e=new ut,globalThis.webqit.refs.set(n,e));let r,i;for(;r=t.shift();)(i=e)&&!(e=e.get(r))&&(e=new ut,i.set(r,e));return e}var ut=class extends Map{constructor(...t){super(...t),this.observers=new Set}set(t,e){let r=super.set(t,e);return this.fire("set",t,e,t),r}delete(t){let e=super.delete(t);return this.fire("delete",t),e}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,e,r){let i={type:t,key:e,callback:r};return this.observers.add(i),()=>this.observers.delete(i)}unobserve(t,e,r){if(Array.isArray(t)||Array.isArray(e))throw new Error('The "type" and "key" arguments can only be strings.');for(let i of this.observers)!(Ct([t,"*"],i.type)&&Ct([e,"*"],i.key)&&i.callback===r)||this.observers.delete(i)}fire(t,e,...r){for(let i of this.observers)!(Ct([t,"*"],i.type)&&Ct([e,"*"],i.key))||i.callback(...r)}},Ct=(n,t)=>Array.isArray(t)?Lt(n,t).length:n.includes(t);function st(n){return typeof n=="function"}function ft(n){return n===null||n===""}function F(n){return arguments.length&&(n===void 0||typeof n>"u")}function E(n){return Array.isArray(n)||typeof n=="object"&&n||st(n)}function Vt(n){return ft(n)||F(n)||n===!1||n===0||E(n)&&!Object.keys(n).length}function $(n){return st(n)||n&&{}.toString.call(n)==="[object function]"}function ht(n){return n instanceof Number||typeof n=="number"}function k(n){return ht(n)||n!==!0&&n!==!1&&n!==null&&n!==""&&!isNaN(n*1)}function at(n){return n instanceof String||typeof n=="string"&&n!==null}function Ht(n){return!at(n)&&!F(n.length)}function Tt(n,...t){return t.forEach(e=>{n.indexOf(e)<0&&n.push(e)}),n}function zt(r,t){t=t||Object.prototype,t=t&&!_(t)?[t]:t;for(var e=[],r=r;r&&(!t||t.indexOf(r)<0)&&r.name!=="default";)e.push(r),r=r?Object.getPrototypeOf(r):null;return e}function Wt(n,t){var e=[];return zt(n,t).forEach(r=>{Tt(e,...Object.getOwnPropertyNames(r))}),e}function I(n,t,e=!1,r=!1,i=!1){var o=0,s=n.shift();if((k(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((a,l)=>{!E(a)&&!$(a)||(e?Wt(a):Object.keys(a)).forEach(c=>{if(!!t(c,s,a,l)){var u=s[c],h=a[c];if((_(u)&&_(h)||O(u)&&O(h))&&(o===!0||o>0))s[c]=_(u)&&_(h)?[]:{},I([k(o)?o-1:o,s[c],u,h],t,e,r,i);else if(_(s)&&_(a))r?s[c]=h:s.push(h);else try{i?Object.defineProperty(s,c,Object.getOwnPropertyDescriptor(a,c)):s[c]=a[c]}catch{}}})}),s}function mt(...n){return I(n,(t,e,r)=>!0,!1,!1,!1)}function S(n,t=!0){return _(n)?n:!t&&O(n)?[n]:n!==!1&&n!==0&&Vt(n)?[]:Ht(n)?Array.prototype.slice.call(n):O(n)?Object.values(n):[n]}var P=(...n)=>z("observer-api",...n),ct=(n,t)=>n instanceof Promise?n.then(t):t(n),kt={};var Y=class{constructor(t,e){this.registry=t,Object.assign(this,{...e,target:t.target}),this.params.signal&&this.params.signal.addEventListener("abort",()=>this.remove())}remove(){return this.removed=!0,this.registry.removeRegistration(this)}};var pt=class extends Y{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),kt.setMaxListeners?.(0,this.signal)}remove(){this.abortController.abort(),super.remove()}fire(t){if(this.emit.recursionTarget&&!["inject","force-async","force-sync"].includes(this.params.recursions))return;let e=t,r=this.filter;if(r!==1/0&&(r=S(r,!1))&&(e=t.filter(i=>r.includes(i.key))),this.params.diff&&(e=e.filter(i=>i.type!=="set"||i.value!==i.oldValue)),e.length){if(this.emit.recursionTarget&&this.params.recursions!=="force-sync"){this.emit.recursionTarget.push(...e);return}this.emit.recursionTarget=this.params.recursions==="inject"?e:[];let i=this.filter===1/0||Array.isArray(this.filter)?this.emit(e,this):this.emit(e[0],this);return ct(i,o=>{let s=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="force-async"&&s.length?this.emit.currentRegistration.fire(s):o})}}};var Q=class{constructor(t){this.target=t,this.entries=[]}addRegistration(t){return this.entries.push(t),t}removeRegistration(t){this.entries=this.entries.filter(e=>e!==t)}static _getInstance(t,e,r=!0,i=this.__namespace){if(!E(e))throw new Error(`Subject must be of type object; "${ot(e)}" given!`);let o=this;return i&&P("namespaces").has(t+"-"+i)&&(o=P("namespaces").get(t+"-"+i),t+="-"+i),!P(e,"registry").has(t)&&r&&P(e,"registry").set(t,new o(e)),P(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return P("namespaces").get(t);if(!(r.prototype instanceof this))throw new Error(`The implementation of the namespace ${this.name}.${e} must be a subclass of ${this.name}.`);P("namespaces").set(t,r),r.__namespace=e}};var C=class{constructor(t,e){if(this.target=t,!e.operation)throw new Error("Descriptor operation must be given in definition!");Object.assign(this,e)}};var W=class extends Q{static getInstance(t,e=!0,r=null){return super._getInstance("listeners",...arguments)}static namespace(t,e=null){return super._namespace("listeners",...arguments)}constructor(t){super(t),this.batches=[]}addRegistration(t,e,r){return super.addRegistration(new pt(this,{filter:t,emit:e,params:r}))}emit(t,e=!1){if(this.batches.length){this.batches[0].snapshots.push({events:[...t],isPropertyDescriptors:e});return}this.$emit(this.entries,[{events:t,isPropertyDescriptors:e}])}$emit(t,e){let r=t.filter(l=>l.params.withPropertyDescriptors).length,i=e.some(l=>l.isPropertyDescriptors),o=[],s=[],a=t.length;e.forEach(l=>{(r||!i)&&o.push(...l.events),r!==a&&i&&(l.isPropertyDescriptors?s.push(...l.events.map(c=>{let{target:u,type:h,...f}=c,p=new C(u,{type:"set",...f});return Object.defineProperty(p,"value","get"in f.value?{get:()=>f.value.get()}:{value:f.value.value}),f.oldValue&&Object.defineProperty(p,"oldValue","get"in f.oldValue?{get:()=>f.oldValue.get()}:{value:f.oldValue.value}),p})):s.push(...l.events))}),t.forEach(l=>{l.params.withPropertyDescriptors?l.fire(o.length?o:s):l.fire(s.length?s:o)})}batch(t){this.batches.unshift({entries:[...this.entries],snapshots:[]});let e=t();return ct(e,r=>{let i=this.batches.shift();return i.snapshots.length&&this.$emit(i.entries,i.snapshots),r})}};var dt=class extends Y{exec(t,e,r){return this.running||!this.traps[t.operation]?e(...Array.prototype.slice.call(arguments,2)):(this.running=!0,this.traps[t.operation](t,r,(...i)=>(this.running=!1,e(...i))))}};var L=class extends Q{static getInstance(t,e=!0,r=null){return super._getInstance("traps",...arguments)}static namespace(t,e=null){return super._namespace("traps",...arguments)}addRegistration(t){return super.addRegistration(new dt(this,t))}emit(t,e=null){let r=this;return function i(o,...s){let a=r.entries[o];return a?a.exec(t,(...l)=>i(o+1,...l),...s):e?e(t,...s):s[0]}(0)}};var Gt={};de(Gt,{accessorize:()=>nr,proxy:()=>ve,unaccessorize:()=>ir,unproxy:()=>gt});function nr(n,t,e={}){n=qt(n);let r=P(n,"accessorizedProps");function i(l){let c,u=n;do c=Object.getOwnPropertyDescriptor(u,l);while(!c&&(u=Object.getPrototypeOf(u)));return c?{proto:u,descriptor:c}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(l){if(r.has(l+""))return!0;let c=i(l);c.getValue=function(f=!1){return f?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},c.setValue=function(f,p=!1){if(this.dirty=!0,p){this.descriptor=f;return}return this.descriptor.set?this.descriptor.set(f)!==!1:(this.descriptor.value=f,!0)},c.intact=function(){let f=Object.getOwnPropertyDescriptor(n,l);return f?.get===h.get&&f?.set===h.set&&r.get(l+"")===this},c.restore=function(){return this.intact()?(this.proto&&this.proto!==n||!this.proto&&!this.dirty?delete n[l]:Object.defineProperty(n,l,this.descriptor),r.delete(l+""),!0):!1},r.set(isNaN(l)?l:parseInt(l),c);let{enumerable:u=!0}=c.descriptor,h={enumerable:u,configurable:!0};("value"in c.descriptor||c.descriptor.set)&&(h.set=function(f){return Z(this,l,f,e)}),("value"in c.descriptor||c.descriptor.get)&&(h.get=function(){return V(this,l,e)});try{return Object.defineProperty(n,l,h),!0}catch{return r.delete(l+""),!1}}let a=(Array.isArray(t)?t:t===void 0?Object.keys(n):[t]).map(o);return t===void 0||Array.isArray(t)?a:a[0]}function ir(n,t,e={}){n=qt(n);let r=P(n,"accessorizedProps");function i(a){return r.has(a+"")?r.get(a+"").restore():!0}let s=(Array.isArray(t)?t:t===void 0?Object.keys(n):[t]).map(i);return t===void 0||Array.isArray(t)?s:s[0]}function ve(n,t={},e=void 0){let r=qt(n);if(typeof t.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(t.membrane&&P(r,"membraneRef").has(t.membrane))return P(r,"membraneRef").get(t.membrane);let i={apply(a,l,c){if(Array.isArray(l)){let u=qt(l);return P(u).set("$length",u.length),Mt(u,()=>It(a,l,c))}return It(a,gt(l),c)},construct:(a,l,c=null)=>Yt(a,l,c,t),defineProperty:(a,l,c)=>bt(a,l,c,t),deleteProperty:(a,l)=>wt(a,l,t),get:(a,l,c=null)=>{let u={...t,receiver:c};Array.isArray(a)&&l==="length"&&P(a).has("$length")&&(u.forceValue=P(a).get("$length"));let h=V(a,l,u);return Array.isArray(a)&&typeof h=="function"?ve(h,{...t,membrane:c}):h},getOwnPropertyDescriptor:(a,l)=>jt(a,l,t),getPrototypeOf:a=>Xt(a,t),has:(a,l)=>Rt(a,l,t),isExtensible:a=>Jt(a,t),ownKeys:a=>yt(a,t),preventExtensions:a=>Zt(a,t),set:(a,l,c,u=null)=>{let h={...t,receiver:u};return Array.isArray(a)&&l==="length"&&(h.forceOldValue=P(a).get("$length"),P(a).set("$length",c)),Z(a,l,c,h)},setPrototypeOf:(a,l)=>Qt(a,l,t)},o=e?.(i)||i,s=new Proxy(r,o);return t.membrane&&P(r,"membraneRef").set(t.membrane,s),P(s).set(s,r),s}function gt(n){return P(n).get(n)||n}function qt(n){if(!n||!E(n))throw new Error("Target must be of type object!");return gt(n)}var xt=class extends Array{};function or(...n){return new xt(...n)}function Kt(n,t,e,r=o=>o,i={}){if(!!t.length)return function o(s,a,l){let c=a[l.level],u=l.level===a.length-1;return s instanceof C&&s.operation!=="get"?l={...l,probe:"always"}:l.probe!=="always"&&(l={...l,probe:!u}),e(s,c,(h,...f)=>{let p=m=>{m instanceof C&&(m.path=[m.key],s instanceof C&&(m.path=s.path.concat(m.key),Object.defineProperty(m,"context",{get:()=>s,configurable:!0})))},y=m=>{let x=j(m,!1);return ct(x,g=>{m instanceof C?m.value=g:m=g;let d=f[0]||{};return o(m,a,{...l,...d,level:l.level+1})})};return Nt(c)&&Array.isArray(h)?(h.forEach(p),u?r(h,...f):h.map(y)):(p(h),u?r(h,...f):y(h))},l)}(n,t.slice(0),{...i,level:0})}function te(n,t,e,r={}){if(n=j(n,!r.level),$(arguments[1])&&([,e,r={}]=arguments,t=1/0),!$(e))throw new Error(`Handler must be a function; "${ot(e)}" given!`);if(t instanceof xt)return Kt(n,t,te,e,r);if(r={...r,descripted:!0},delete r.live,!E(n))return r.probe&&V(n,t,e,r);let i=Oe(n,t,e,r);return r.probe?V(n,t,i,r):i()}function sr(n,t,e={}){return n=j(n),O(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),L.getInstance(n,!0,e.namespace).addRegistration({traps:t,params:e})}function jt(n,t,e=i=>i,r={}){return R(n,"getOwnPropertyDescriptor",{key:t},e,r)}function ar(n,t,e=i=>i,r={}){return R(n,"getOwnPropertyDescriptors",{key:t},e,r)}function Xt(n,t=r=>r,e={}){return R(n,"getPrototypeOf",{},t,e)}function Jt(n,t=r=>r,e={}){return R(n,"isExtensible",{},t,e)}function yt(n,t=r=>r,e={}){return R(n,"ownKeys",{},t,e)}function Rt(n,t,e=i=>i,r={}){return R(n,"has",{key:t},e,r)}function V(n,t,e=i=>i,r={}){let i,o=j(n,!r.level);return O(e)?[r,e]=[e,s=>s]:r.live&&(i=!0),t instanceof xt?Kt(o,t,V,e,r):fr(o,t,s=>{let a=[...s];return function l(c,u,h){if(!u.length)return h(c);let f=u.shift();if(!["string","number","symbol"].includes(typeof f))throw new Error(`Property name/key ${f} invalid.`);function p(x,g=void 0){let d=v=>(x.value=v,l([...c,r.live||r.descripted?x:v],u,h));if(arguments.length>1)return d(g);if(!E(o))return d(o?.[x.key]);let b=P(o,"accessorizedProps",!1),A=b&&b.get(x.key);if(A&&A.intact())return d(A.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let v=Object.getOwnPropertyDescriptor(o,x.key);return"forceValue"in r&&"value"in v&&(v.value=r.forceValue),d(v)}return"forceValue"in r?d(r.forceValue):d(Reflect.get(o,x.key,...r.receiver?[r.receiver]:[]))}let y=new C(o,{type:"get",key:f,value:void 0,operation:"get",related:a});if(!E(o))return p(y);let m=L.getInstance(o,!1,r.namespace);return m?m.emit(y,p):p(y)}([],s.slice(0),l=>{let c=Nt(t)?l:l[0];return i&&E(o)?Oe(o,t,e,r)(c):e(c)})},r)}function Mt(n,t,e={}){return n=j(n),W.getInstance(n,!0,e.namespace).batch(t)}function cr(n,t,e={}){t=j(t),n=j(n);let r=(e.only||[]).slice(0),i=(e.except||[]).slice(0),o=yt(e.spread?[...n]:n).map(c=>isNaN(c)?c:parseInt(c)),s=r.length?r.filter(c=>o.includes(c)):o.filter(c=>!i.includes(c)),a=c=>!Array.isArray(t)||isNaN(c)?c:c-i.filter(u=>u<c).length,l=c=>{let u=jt(n,c,e);"value"in u&&u.writable&&u.enumerable&&u.configurable?Z(t,a(c),u.value,e):(u.enumerable||e.onlyEnumerable===!1)&&bt(t,c,{...u,configurable:!0},e)};return Mt(t,()=>{s.forEach(l)}),te(n,c=>{c.filter(u=>r.length?r.includes(u.key):!i.includes(u.key)).forEach(u=>{if(u.operation==="deleteProperty")return wt(t,a(u.key),e);if(u.operation==="defineProperty"){(u.value.enumerable||e.onlyEnumerable===!1)&&bt(t,a(u.key),{...u.value,configurable:!0},e);return}l(u.key)})},{...e,withPropertyDescriptors:!0})}function Z(n,t,e,r=s=>s,i={},o=!1){let s=j(n),a=[[t,e]];O(t)&&([,,r=c=>c,i={},o=!1]=arguments,a=Object.entries(t)),O(r)&&([o,i,r]=[typeof i=="boolean"?i:o,r,c=>c]);let l=a.map(([c])=>c);return function c(u,h,f){if(!h.length)return f(u);let[p,y]=h.shift();function m(g,d=void 0){let b=X=>(g.status=X,c(u.concat(g),h,f));if(arguments.length>1)return b(g,d);let A=P(s,"accessorizedProps",!1),v=A&&A.get(g.key);return g.operation==="defineProperty"?(v&&!v.restore()&&b(!1),Object.defineProperty(s,g.key,g.value),b(!0)):v&&v.intact()?b(v.setValue(g.value)):b(Reflect.set(s,g.key,g.value))}function x(g,d){if(i.diff&&y===d)return c(u,h,f);let b=new C(s,{type:o?"def":"set",key:p,value:y,isUpdate:g,oldValue:d,related:[...l],operation:o?"defineProperty":"set",detail:i.detail}),A=L.getInstance(s,!1,i.namespace);return A?A.emit(b,m):m(b)}return Rt(s,p,g=>{if(!g)return x(g);let d={...i,withPropertyDescriptors:o};return"forceOldValue"in i&&(d.forceValue=i.forceOldValue),V(s,p,b=>x(g,b),d)},i)}([],a.slice(0),c=>{let u=W.getInstance(s,!1,i.namespace);return u&&u.emit(c,o),r(Nt(t)?c.map(h=>h.status):c[0]?.status)})}function bt(n,t,e,r=o=>o,i={}){return Z(n,t,e,r,i,!0)}function lr(n,t,e=i=>i,r={}){return Z(n,t,e,r,!0)}function wt(n,t,e=i=>i,r={}){n=j(n),O(e)&&([r,e]=[e,s=>s]);let i=S(t,!1),o=[...i];return function s(a,l,c){if(!l.length)return c(a);let u=l.shift();function h(p,y=void 0){let m=d=>(p.status=d,s(a.concat(p),l,c));if(arguments.length>1)return m(p,y);let x=P(n,"accessorizedProps",!1),g=x&&x.get(p.key);return g&&!g.restore()&&m(!1),m(Reflect.deleteProperty(n,p.key))}function f(p){let y=new C(n,{type:"delete",key:u,oldValue:p,related:[...o],operation:"deleteProperty",detail:r.detail}),m=L.getInstance(n,!1,r.namespace);return m?m.emit(y,h):h(y)}return V(n,u,f,r)}([],i.slice(0),s=>{let a=W.getInstance(n,!1,r.namespace);return a&&a.emit(s),e(Nt(t)?s.map(l=>l.status):s[0].status)})}function ur(n,t,e=i=>i,r={}){return wt(...arguments)}function Yt(n,t,e=null,r=o=>o,i={}){return R(n,"construct",arguments.length>2?{argumentsList:t,newTarget:e}:{argumentsList:t},r,i)}function It(n,t,e,r=o=>o,i={}){return R(n,"apply",{thisArgument:t,argumentsList:e},r,i)}function Qt(n,t,e=i=>i,r={}){return R(n,"setPrototypeOf",{proto:t},e,r)}function Zt(n,t=r=>r,e={}){return R(n,"preventExtensions",{},t,e)}function Oe(n,t,e,r={}){let i;r.signal||(i=new AbortController,r={...r,signal:i.signal},kt.setMaxListeners?.(0,i.signal));let o=W.getInstance(n,!0,r.namespace);return function s(a,l=null){l?.remove();let u={signal:o.addRegistration(t,s,r).signal};if(arguments.length){let h=e(a,u);if(arguments.length>1)return h}return i}}function R(n,t,e={},r=o=>o,i={}){n=j(n),O(r)&&([i,r]=[r,l=>l]);function o(l,c){return arguments.length>1?r(c):r((Reflect[t]||Object[t])(n,...Object.values(e)))}let s=new C(n,{operation:t,...e}),a=L.getInstance(n,!1,i.namespace);return a?a.emit(s,o):o(s)}function Nt(n){return n===1/0||Array.isArray(n)}function j(n,t=!0){if((!n||!E(n))&&t)throw new Error(`Object must be of type object or array! "${ot(n)}" given.`);return n instanceof C&&(n=n.value),n&&gt(n)}function fr(n,t,e,r={}){return t===1/0?r.level&&!E(n)?e([]):yt(n,e,r):e(S(t,!1))}var hr={...ee,...Gt},w=hr;function _t(n,t,e={},r={}){t=S(t).slice();for(var i=n;!F(i)&&!ft(i)&&t.length;){var o=t.shift();if(!(e.get?e.get(i,o):E(i)?o in i:i[o])){r.exists=!1;return}i=e.get?e.get(i,o):i[o]}return r.exists=!0,i}function re(n,t,e,r={},i={}){let o=(u,h,f)=>i.set?i.set(u,h,f):(k(t[a])&&_(u)?u.push(f):u[h]=f,!0);t=S(t);for(var s=n,a=0;a<t.length;a++)if(a<t.length-1){if(!s||!E(s)&&!$(s))return!1;var l=_t(s,t[a],i);if(!E(l)){if(i.buildTree===!1)return!1;l=$(i.buildTree)?i.buildTree(a):k(t[a+1])?[]:{};var c=o(s,t[a],l);if(!c)return!1}s=l}else return o(s,t[a],e)}var vt=class{constructor(t,e=!0){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),this.async=e,this.window.requestAnimationFrame?this._run():this.async=!1}_run(){this.window.requestAnimationFrame(()=>{for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t);this._run()})}onread(t,e=!1){if(e)return new Promise(r=>{this.async===!1?r(t()):this.readCallbacks.add(()=>{r(t())})});this.async===!1?t():this.readCallbacks.add(t)}onwrite(t,e=!1){if(e)return new Promise(r=>{this.async===!1?r(t()):this.writeCallbacks.add(()=>{r(t())})});this.async===!1?t():this.writeCallbacks.add(t)}cycle(t,e,r){this.onread(()=>{let i=t(r),o=s=>{s!==void 0&&this.onwrite(()=>{let a=e(s,r),l=c=>{c!==void 0&&this.cycle(t,e,c)};a instanceof Promise?a.then(l):l(a)})};i instanceof Promise?i.then(o):o(i)})}};function $e(n){return(n=n.trim())&&n.startsWith("(")&&n.endsWith(")")}function Ft(n,t,e,r=!0){e=(Array.isArray(e)?e:[e]).map(a=>(a+"").replace("(",r?"(.//":"(./")).join("|");let i=n.document.evaluate(e,t,null,XPathResult.ANY_TYPE),o=[],s;for(;s=i.iterateNext();)o.push(s);return o}function Ae(n,t,e){return e=(Array.isArray(e)?e:[e]).map(r=>(r+"").replace("(","(self::")).join("|"),n.document.evaluate(`${e}`,t,null,XPathResult.BOOLEAN_TYPE).booleanValue}function Ee(n,t="|"){return[...n].reduce(([e,r,i,o],s)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(s)?[e,r,[""].concat(i)]:(!e&&["(","[","{"].includes(s)&&!i[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(s)&&!i[0].endsWith("\\")&&r--,['"',"'","`"].includes(s)&&!i[0].endsWith("\\")&&(e=e===s?null:e||s),i[0]+=s,[e,r,i]),[null,0,[""]])[2].reverse()}var q=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:$e(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ee(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var K=class{constructor(t,e,r){this.context=t,this.namespace=e,this.window=t.defaultView||t.ownerDocument?.defaultView||r,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if($(t[0])?t=[[],...t]:O(t[0])&&!(t[0]instanceof q)&&t.length===1?t=[[],void 0,t[0]]:O(t[1])&&t.length===2?t=[S(t[0],!1),void 0,t[1]]:t[0]=S(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof q)&&!(e 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(e=>e instanceof q?e:new q(e)),t}registry(...t){return z("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,e,r){let{window:i}=this,o=Array.isArray(e)?e:[e],s=new Set;for(let[a,l]of this.registry(t))for(let[c,u]of l){let h=o.filter(f=>c.contains(f.target)?a==="subtree"||f.target===c:!1);if(!!h.length){Array.isArray(e)||(h=h[0]);for(let f of u)s.add([f,h,c])}}for(let[a,l,c]of s)r.call(i,a,l,c)}disconnectables(t,...e){let r={disconnect(){e.forEach(i=>i&&$(i.disconnect)&&i.disconnect()||$(i)&&i()||O(i)&&(i.disconnected=!0))}};return t&&t.addEventListener("abort",()=>r.disconnect()),r}};var B=class extends K{constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let i=typeof t=="string"||t instanceof q;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=ke(o,t);if(!e)return s;let a=r.lifecycleSignals&&this.createSignalGenerator();if(i)for(let l of s){let c=a?.generate()||{};e(l,c,o)}else{let l=a?.generate()||{};e(s,l,o)}if(r.live){a&&(r={...r,signalGenerator:a});let l=this.observe(i?t[0]:t,e,{newValue:!0,...r});return this.disconnectables(r.signal,l)}}observe(t,e,r={}){let i=typeof t=="string"||t instanceof q;if([t=[],e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(i?t[0]:t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:o,window:s,webqit:a}=this;r.eventDetails&&!a.realdom.attrInterceptionHooks?.intercepting&&Ce.call(s,"intercept",()=>{});let l=new s.MutationObserver(f=>{f=Te(f).map(p=>qe.call(s,p)),Se.call(s,h,f,o)}),c={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree};t.length&&(c.attributeFilter=t.map(f=>f+"")),l.observe(o,c);let u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),h={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:i,signalGenerator:u,disconnectable:l};return this.disconnectables(r.signal,l,u)}observeSync(t,e,r={}){let i=typeof t=="string"||t instanceof q;[t,e,r={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let a=r.timing==="intercept"?"intercept":"sync",l=r.subtree?"subtree":"children";this.registry(a).size||Ce.call(s,a,y=>{this.forEachMatchingContext(a,y,Se)});let c={disconnect(){p.delete(h),p.size||f.delete(o)}},u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),h={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:i,signalGenerator:u,disconnectable:c},f=this.registry(a,l);f.has(o)||f.set(o,new Set);let p=f.get(o);return p.add(h),this.disconnectables(r.signal,c,u)}};function Te(n){return n.reduce((t,e,r)=>t[r-1]?.attributeName===e.attributeName?t:t.concat(e),[])}function Se(n,t){let{context:e,spec:r,callback:i,params:o,atomics:s,originalFilterIsString:a,signalGenerator:l}=n,c=r.map(f=>f+"");if(o.atomic&&!s.size?t=ke(e,r,t):o.timing!=="async"&&r.length&&(t=t.filter(f=>c.includes(f.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(f=>{let p;return o.eventDetails||({event:p,...f}=f),!o.oldValue&&"oldValue"in f&&({oldValue:p,...f}=f),!o.newValue&&"value"in f?{value:p,...f}=f:o.newValue&&typeof f.value>"u"&&(f={...f,value:f.target.getAttribute(f.name)}),f})),o.atomic&&(t.forEach(f=>s.set(f.name,f)),t=Array.from(s.entries()).map(([,f])=>f));let u=a?t[0]:t,h=l?.generate()||{};i(u,h,e)}function ke(n,t,e=[]){let r={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",e.find(s=>s.name===o)||{target:n,name:o,value:n.getAttribute(o),...r})):Array.from(n.attributes).map(o=>e.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:o.nodeValue,...r})}function qe({target:n,attributeName:t,value:e,oldValue:r}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(n)||{})[t]?.[0]||"mutation";return{target:n,name:t,value:e,oldValue:r,type:"observation",event:s}}function Ce(n,t){let e=this,{webqit:r,document:i,Element:o}=e;r.realdom.attrInterceptionHooks||Object.defineProperty(r.realdom,"attrInterceptionHooks",{value:new Map}),r.realdom.attrInterceptionHooks.has(n)||r.realdom.attrInterceptionHooks.set(n,new Set),r.realdom.attrInterceptionHooks.get(n).add(t);let s=()=>r.realdom.attrInterceptionHooks.get(n).delete(t);if(r.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),r.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"attrInterceptionRecords",{value:new Map});let a=(u,h)=>{r.realdom.attrInterceptionRecords.has(u.target)||r.realdom.attrInterceptionRecords.set(u.target,{});let f=r.realdom.attrInterceptionRecords.get(u.target);f[u.name]=f[u.name]||[],f[u.name].unshift(u.event),r.realdom.attrInterceptionHooks.get("intercept")?.forEach(y=>y([u]));let p=h();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(y=>y([u])),p};new e.MutationObserver(u=>{u=u.filter(h=>!(e.webqit.realdom.attrInterceptionRecords?.get(h.target)||{})[h.attributeName]?.shift()),u=Te(u).map(h=>qe.call(e,h)),u.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(h=>h(u)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(h=>h(u)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let c=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(u=>{c[u]=o.prototype[u],o.prototype[u]=function(...h){let f,p=this.getAttribute(h[0]);["setAttribute","toggleAttribute"].includes(u)&&(f=h[1]),u==="toggleAttribute"&&f===void 0&&(f=p===null);let y={target:this,name:h[0],value:f,oldValue:p,type:"interception",event:[this,u]};return a(y,()=>c[u].call(this,...h))}}),s}var Ot=class extends K{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:i,window:o}=this;return new B(i,o).get(...arguments)}query(t,e=void 0,r={}){[t,e=void 0,r={}]=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(!r.generation||r.generation==="entrants"){if(!t.length)[...i.children].forEach(c=>s(i).entrants.push(c));else if(t.every(c=>c.type==="selector")){let[c,u]=t.reduce(([f,p],y)=>y.kind==="xpath"?[f,p.concat(y)]:[f.concat(y),p],[[],[]]),h=[];r.subtree?(c.length&&h.push(...i.querySelectorAll(c.join(","))),u.length&&h.push(...Ft(this.window,i,u))):(c.length&&h.push(...[...i.children].filter(f=>f.matches(c))),u.length&&h.push(...Ft(this.window,i,u,!1))),h.forEach(f=>s(f.parentNode||i).entrants.push(f))}}if(!e)return o;let a={disconnected:!1},l=e&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,c]of o){if(a.disconnected)break;let u=l?.generate()||{};e(c,u,i)}if(r.live){l&&(r={...r,signalGenerator:l});let c=this.observe(t,e,r);return this.disconnectables(r.signal,a,c)}return this.disconnectables(r.signal,a,l)}children(t,e=void 0,r={}){return[t,e=void 0,r={}]=this.resolveArgs(arguments),this.query(t,e,{...r,subtree:!1})}subtree(t,e=void 0,r={}){return[t,e=void 0,r={}]=this.resolveArgs(arguments),this.query(t,e,{...r,subtree:!0})}observe(t,e,r={}){if([t,e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(t,e,r);if(r.timing&&r.timing!=="async")throw new Error(`Timing option "${r.timing}" invalid.`);let{context:i,window:o,webqit:s,document:a}=this;r.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(a.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&Re.call(o,"sync",()=>{});let l=new o.MutationObserver(h=>h.forEach(f=>{ne.call(o,u,je.call(o,f),i)}));l.observe(i,{childList:!0,subtree:r.subtree});let c=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:i,spec:t,callback:e,params:r,signalGenerator:c,disconnectable:l};if(r.staticSensitivity){let h=Ie.call(o,u);return this.disconnectables(r.signal,l,c,h)}return this.disconnectables(r.signal,l,c)}observeSync(t,e,r={}){[t,e,r={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(r.timing&&!["sync","intercept"].includes(r.timing))throw new Error(`Timing option "${r.timing}" invalid.`);let s=r.timing==="intercept"?"intercept":"sync",a=r.subtree?"subtree":"children";this.registry(s).size||Re.call(o,s,y=>{this.forEachMatchingContext(s,y,ne)});let l=new o.MutationObserver(y=>y.forEach(m=>{Array.isArray((m=je.call(o,m)).event)||ne.call(o,h,m,i)}));l.observe(i,{childList:!0,subtree:r.subtree});let c={disconnect(){l.disconnect(),p.delete(h),p.size||f.delete(i)}},u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),h={context:i,spec:t,callback:e,params:r,signalGenerator:u,disconnectable:c},f=this.registry(s,a);f.has(i)||f.set(i,new Set);let p=f.get(i);if(p.add(h),r.staticSensitivity){let y=Ie.call(o,h);return this.disconnectables(r.signal,c,u,y)}return this.disconnectables(r.signal,c,u)}};function Ie(n){let t=this,{context:e,spec:r,callback:i,params:o,signalGenerator:s}=n,a=r.filter(p=>p.kind==="css"),l=p=>p.match(/\.([\w-]+)/g)?.length?["class"]:[],c=p=>p.match(/#([\w-]+)/g)?.length?["id"]:[],u=p=>[...p.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(y=>y[1]).concat(l(p)).concat(c(p));if(!(n.$attrs=Array.from(new Set(a.filter(p=>(p+"").includes("[")).reduce((p,y)=>p.concat(u(y+"")),[])))).length)return;let h=new Set,f=new Set;return h.push=p=>(f.delete(p),h.add(p)),f.push=p=>(h.delete(p),f.add(p)),n.$deliveryCache={entrants:h,exits:f},new B(e,t).observe(n.$attrs,p=>{let y=new Map,m=d=>(y.has(d)||y.set(d,{target:d,entrants:[],exits:[],type:"static",event:null}),y.get(d)),x=new WeakMap,g=d=>(x.has(d)||x.set(d,a.some(b=>d.matches(b+""))),x.get(d));for(let d of p)["entrants","exits"].forEach(b=>{o.generation&&b!==o.generation||n.$deliveryCache[b].has(d.target)||(b==="entrants"?!g(d.target):g(d.target))||(n.$deliveryCache[b].push(d.target),m(d.target)[b].push(d.target),m(d.target).event=d.event)});for(let[,d]of y){let b=s?.generate()||{};i(d,b,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function ne(n,t){let{context:e,spec:r,callback:i,params:o,signalGenerator:s,$deliveryCache:a}=n,l={...t,entrants:[],exits:[]};if(o.eventDetails||delete l.event,["entrants","exits"].forEach(u=>{if(!(o.generation&&u!==o.generation)&&(r.length?l[u]=gr.call(this,r,t[u],t.event!=="parse"):l[u]=[...t[u]],!!a))for(let h of l[u])a[u].push(h)}),!l.entrants.length&&!l.exits.length)return;let c=s?.generate()||{};i(l,c,e)}function gr(n,t,e){t=Array.isArray(t)?t:[...t];let r=(i,o)=>{if(o.type==="selector"){let s=o.isXpathAttr?[]:i.filter(a=>o.kind==="xpath"?Ae(this,a,o+""):a.matches&&a.matches(o+""));if((e||o.isXpathAttr)&&(s=i.reduce((a,l)=>o.kind==="xpath"?[...a,...Ft(this,l,o,e)]:l.querySelectorAll?[...a,...l.querySelectorAll(o+"")]:a,s)),s.length)return s}else if(i.includes(o.content)||e&&i.some(s=>s.contains(o.content)))return[o.content]};return t.$$searchCache||(t.$$searchCache=new Map),n.reduce((i,o)=>{let s;return t.$$searchCache.has(o.content)?s=t.$$searchCache.get(o.content):(s=r(t,o)||[],o.type==="instance"&&t.$$searchCache.set(o.content,s)),i.concat(s)},[])}function je({target:n,addedNodes:t,removedNodes:e}){let r=this,i;return i=S(t).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),null),i=S(e).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),i),i=i||r.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:t,exits:e,type:"observation",event:i}}function Re(n,t){let e=this,{webqit:r,document:i,Node:o,CharacterData:s,Element:a,HTMLElement:l,HTMLTemplateElement:c,DocumentFragment:u}=e;r.realdom.domInterceptionHooks||Object.defineProperty(r.realdom,"domInterceptionHooks",{value:new Map}),r.realdom.domInterceptionHooks.has(n)||r.realdom.domInterceptionHooks.set(n,new Set),r.realdom.domInterceptionHooks.get(n).add(t);let h=()=>r.realdom.domInterceptionHooks.get(n).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return h;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let f=(m,x)=>{m.entrants.concat(m.exits).forEach(d=>{clearTimeout(r.realdom.domInterceptionRecords.get(d)?.timeout),r.realdom.domInterceptionRecords.set(d,m.event);let b=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(d)},0);Object.defineProperty(m.event,"timeout",{value:b,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(d=>d(m));let g=x();return r.realdom.domInterceptionHooks.get("sync")?.forEach(d=>d(m)),g},p={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(...g){let d=this instanceof s?p.characterData:p.other,b=()=>d[m].call(this,...g);if(!(this instanceof s||this instanceof a||this instanceof u))return b();let A=[],v=[],X=this;["insertBefore"].includes(m)?v=[g[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(m)?(v=[g[1]],["beforebegin","afterend"].includes(g[0])&&(X=this.parentNode)):["setHTML","replaceChildren"].includes(m)?(A=[...this.childNodes],v=m==="replaceChildren"?[...g]:[g[0]]):["replaceWith","remove"].includes(m)?(A=[this],v=m==="replaceWith"?[...g]:[],X=this.parentNode):["replaceChild"].includes(m)?(A=[g[1]],v=[g[0]]):["removeChild"].includes(m)?A=[...g]:(v=[...g],["before","after"].includes(m)&&(X=this.parentNode));let J=m;if(["insertAdjacentHTML","setHTML"].includes(m)){let me=this.nodeName;if(m==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(g[0])){if(!this.parentNode)return d[m].call(this,...g);me=this.parentNode.nodeName}let St=i.createElement(me);d.setHTML.call(St,v[0],m==="setHTML"?g[1]:{}),v=[...St.childNodes],m==="insertAdjacentHTML"?(J="insertAdjacentElement",g[1]=new u,g[1].______isTemp=!0,g[1].append(...St.childNodes)):(J="replaceChildren",g=[...St.childNodes])}return f({target:X,entrants:v,exits:A,type:"interception",event:[this,m]},()=>d[J].call(this,...g))}["insertBefore","replaceChild","removeChild","appendChild"].includes(m)?(p.other[m]=o.prototype[m],o.prototype[m]=x):(["after","before","remove","replaceWith"].includes(m)&&(p.characterData[m]=s.prototype[m],s.prototype[m]=x),a.prototype[m]&&(p.other[m]=a.prototype[m],a.prototype[m]=x))});let y=Object.create(null);return["outerHTML","outerText","innerHTML","innerText","textContent","nodeValue"].forEach(m=>{let x=["textContent","nodeValue"].includes(m)?o:["outerText","innerText"].includes(m)?l:a;y[m]=Object.getOwnPropertyDescriptor(x.prototype,m),Object.defineProperty(x.prototype,m,{...y[m],set:function(g){let d=()=>y[m].set.call(this,g);if(!(this instanceof a))return d();let b=[],A=[],v=this;if(["outerHTML","outerText"].includes(m)?(b=[this],v=this.parentNode):b=[...this.childNodes],["outerHTML","innerHTML"].includes(m)){let J=this.nodeName;if(m==="outerHTML"){if(!this.parentNode)return d();J=this.parentNode.nodeName}let it=i.createElement(J==="TEMPLATE"?"div":J);y[m].set.call(it,g),A=this instanceof c?[]:[...it.childNodes],m==="outerHTML"?(g=new u,g.______isTemp=!0,g.append(...it.childNodes),d=()=>a.prototype.replaceWith.call(this,g)):this instanceof c?d=()=>this.content.replaceChildren(...it.childNodes):d=()=>a.prototype.replaceChildren.call(this,...it.childNodes)}return f({target:v,entrants:A,exits:b,type:"interception",event:[this,m]},d)}})}),["append","prepend","replaceChildren"].forEach(m=>{[i,u.prototype].forEach(x=>{let g=x[m];x[m]=function(...d){if(this.______isTemp)return g.call(this,...d);let b=m==="replaceChildren"?[...this.childNodes]:[];return f({target:this,entrants:d,exits:b,type:"interception",event:[this,m]},()=>g.call(this,...d))}})}),h}function Me(){yr.call(this),br.call(this),wr.call(this)}function yr(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function br(){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 wr(){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 e=(this.document||this.ownerDocument).querySelectorAll(t),r=e.length;--r>=0&&e.item(r)!==this;);return r>-1})}function Ne(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.realdom)return n.webqit.realdom;n.webqit.realdom={},Me.call(n),n.webqit.realdom.meta=(...e)=>xr.call(n,...e),n.webqit.realdom.ready=(...e)=>ie.call(n,...e),n.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new Ot(e,n);if(r==="attr")return new B(e,n)};let t=new vt(n);return n.webqit.realdom.schedule=(e,...r)=>t[`on${e}`](...r),n.webqit.realdom}function ie(...n){let t="interactive",e;at(n[0])?(t=n[0],$(n[1])&&(e=n[1])):$(n[0])&&(e=n[0]);let r={interactive:["interactive","complete"],complete:["complete"]};if(!r[t])throw new Error(`Invalid ready-state timing: ${t}.`);let i=this;if(!e)return i.webqit.realdom.readyStatePromises||(i.webqit.realdom.readyStatePromises={interactive:new Promise(o=>ie.call(this,"interactive",o)),complete:new Promise(o=>ie.call(this,"complete",o))}),i.webqit.realdom.readyStatePromises[t];if(r[t].includes(i.document.readyState))return e(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(e)}function xr(n){let t=this,e={},r;return(r=t.document.querySelector(`meta[name="${n}"]`))&&(e=(r.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(a=>a.trim());return re(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:k(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return r.content},json(){return JSON.parse(JSON.stringify(e))}}}var M=(...n)=>z("oohtml",...n);function oe(n,t,e){let r=n.toUpperCase().replace("-","_"),i=this,o=Ne.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[r]||(i.webqit.oohtml.configs[r]={}),mt(2,i.webqit.oohtml.configs[r],e,t,o.meta(n).json()),{config:i.webqit.oohtml.configs[r],realdom:o,window:i}}function se(n,t,e=1,r=!1){if(e&&typeof n=="object"&&n&&typeof t=="object"&&t&&(!r||Object.keys(n).length===Object.keys(t).length)){for(let i in n)if(!se(n[i],t[i],e-1,r))return!1;return!0}return Array.isArray(n)&&Array.isArray(t)&&n.length===t.length?(t=t.slice(0).sort())&&n.slice(0).sort().every((i,o)=>i===t[o]):n===t}var $t=class{constructor(t,e){Object.defineProperty(this,"request",{value:t}),Object.defineProperty(this,"hostElement",{value:e}),t.live&&!t.signal&&(Object.defineProperty(this,"abortController",{value:new AbortController}),t.signal=this.abortController.signal)}callback(t){w.defineProperty(this,"value",{value:t,configurable:!0,enumerable:!0})}abort(){if(this.abortController)return this.abortController.abort();let t=this.hostElement.ownerDocument?.defaultView||this.hostElement.defaultView;if(this.request.signal)return this.request.signal.dispatchEvent(new t.Event("abort"))}};function De(){let n=this;return class extends n.Event{constructor(e,r,{type:i="contextrequest",...o}={}){super(i,o),Object.defineProperty(this,"request",{get:()=>e}),Object.defineProperty(this,"callback",{get:()=>r})}respondWith(e,...r){if(this.request.diff){if("prevValue"in this&&this.prevValue===e)return;Object.defineProperty(this,"prevValue",{value:e,configurable:!0})}return this.callback(e,...r)}}}var H=class{static instance(t){return M(t).get("context::instance")||new this(t)}constructor(t){M(t).get("context::instance")?.dispose(),M(t).set("context::instance",this);let e={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>e});let r=De.call(t.ownerDocument?.defaultView||t.defaultView);Object.defineProperty(this,"ContextRequestEvent",{get:()=>r}),this[Symbol.iterator]=function*(){yield*e.contexts}}get length(){this["#"].contexts.size}findProvider(t){return[...this["#"].contexts].find(t)}attachProvider(t){this["#"].contexts.add(t),t.initialize(this["#"].host)}detachProvider(t){t.dispose(this["#"].host),this["#"].contexts.delete(t)}request(t,e=null,r={}){typeof e=="object"&&(r=e,e=null);let i;e||(i=new $t(t,this["#"].host),e=i.callback.bind(i));let o=this["#"].host.dispatchEvent(new this.ContextRequestEvent(t,e,{bubbles:!0,...r}));return i??o}dispose(){}};var U=class{static get config(){return{}}static attachTo(t,e,r=!1){this.providers.set(this.type,this);let i,o=H.instance(t);return!r&&(i=o.findProvider(s=>this.matchId(s.id,e)))?i:o.attachProvider(new this(e))}static detachFrom(t,e,r=!1){let i,o=H.instance(t);for(i of o["#"].contexts)if(!(!this.matchId(i.id,e)||typeof r=="function"&&!r(i))&&(o.detachProvider(i),typeof multiple!="function"&&!r))return i}static createId(t,e={}){let r={type:this.type,...e};return r.contextName||(t.getAttribute&&!(r.contextName=(t.getAttribute(this.config.context.attr.contextname)||"").trim())?delete r.contextName:t.ownerDocument||(r.contextName="root")),r}static matchId(t,e){return se(t,e,1,!0)}static createRequest(t={}){return{type:this.type,...t}}static matchRequest(t,e){return e.type===t.type&&(!e.contextName||e.contextName===t.contextName)}constructor(t){Object.defineProperty(this,"id",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get length(){this.subscriptions.size}handle(t){}subscribe(t){this.subscriptions.add(t),t.request.signal&&t.request.signal.addEventListener("abort",()=>{this.unsubscribe(t)})}unsubscribe(t){this.subscriptions.delete(t),t.request.controller?.abort()}handleEvent(t){if(!(this.disposed||t.target===this.host&&t.request?.superContextOnly||!(typeof t.request=="object"&&t.request)||typeof t.respondWith!="function"||!this.constructor.matchRequest(this.id,t.request)))if(t.stopPropagation(),t.type==="contextclaim"){let e=new Set;this.subscriptions.forEach(r=>{!t.target.contains(r.request.superContextOnly?r.target.parentNode:r.target)||!this.constructor.matchRequest(t.request,r.request)||(this.subscriptions.delete(r),e.add(r))}),t.respondWith(e)}else t.type==="contextrequest"&&(t.request.live&&this.subscribe(t),this.handle(t))}initialize(t){return this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this),H.instance(t).request({...this.id,superContextOnly:!0},e=>e.forEach(r=>{this.subscribe(r),this.handle(r)}),{type:"contextclaim"}),this}dispose(t){return this.disposed=!0,t.removeEventListener("contextrequest",this),t.removeEventListener("contextclaim",this),this.subscriptions.forEach(e=>{this.unsubscribe(e);let{target:r,request:i,callback:o,options:s}=e;H.instance(r).request(i,o,s)}),this}};D(U,"providers",new Map),D(U,"type");var lt=class extends U{static createRequest(t={}){let e=super.createRequest(t);if(e.detail?.startsWith("@")){let[r,...i]=e.detail.slice(1).split(".").map(o=>o.trim());e.contextName=r,e.detail=i.join(".")}return e}static matchRequest(t,e){return super.matchRequest(t,e)&&(!e.detail||!t.detail||(Array.isArray(e.detail)?e.detail[0]===t.detail:e.detail===t.detail))}get bindingsObj(){return this.host[this.constructor.config.api.bindings]}handle(t){if(t.request.controller?.abort(),!(t.request.detail+"").trim())return t.respondWith(this.bindingsObj);t.request.controller=w.reduce(this.bindingsObj,Array.isArray(t.request.detail)?t.request.detail:[t.request.detail],w.get,e=>{this.disposed||t.respondWith(e.value)},{live:t.request.live,descripted:!0})}};D(lt,"type","bindings");var ae=(n,...t)=>{let e=t.pop();return n.constructor.name==="AsyncFunction"?G(n.call(...t),e):e(n.call(...t))},G=(n,t)=>n instanceof Promise?n.then(t):t(n),ce=n=>typeof n=="object"&&n||typeof n=="function";function Fe(n){let t=typeof n[n.length-1]=="object"?n.pop():{},e=n.pop()||"";return t.functionParams=n,{source:e,params:t}}var Le={};function Ve(...n){let t,e={runtimeParams:Or,compilerParams:vr,parserParams:_r};for(;t=n.shift();){let{runtimeParams:r={},compilerParams:{globalsNoObserve:i=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:a={}}=t;e={runtimeParams:{...e.runtimeParams,...r},compilerParams:{...e.compilerParams,globalsNoObserve:[...e.compilerParams.globalsNoObserve,...i],globalsOnlyPathsExcept:[...e.compilerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...e.parserParams,...a}},n.devMode}return e}var _r={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},vr={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Or={apiVersion:3};var At=Object.create(null);var tt=class extends EventTarget{managedAlways=new Set;managedOnce=new Set;constructor(){super(),Le.setMaxListeners?.(0,this)}fire(t){return this.dispatchEvent(new Event(t,{cancelable:!0}))}on(...t){return this.addEventListener(...t),()=>this.removeEventListener(...t)}abort(t=!1){this.managedAlways.forEach(e=>e.abort?e.abort(t):e(t)),this.managedOnce.forEach(e=>e.abort?e.abort(t):e(t)),this.managedOnce.clear(),this.fire("abort")}manage(t){this.managedAlways.add(t)}once(t){this.managedOnce.add(t)}};var et=class extends tt{subscribers=new Set;signals=new Map;constructor(t,e,r){super(),this.context=t,this.context?.once(()=>this.abort()),this.once(()=>this.watchMode(!1)),this.type=e,this.state=r}get name(){return[...this.context?.signals.keys()||[]].find(t=>this.context.signals.get(t)===this)}signal(t,e="prop"){let r=this.signals.get(t);return r||(r=new et(this,e,e==="object"?t:ce(this.state)?w.get(this.state,t):void 0),this.signals.set(t,r),this.signals.size===1&&this.watchMode(),r.once(()=>{this.signals.delete(t),this.signals.size||this.watchMode(!1)})),r}subscribe(t){this.subscribers.add(t),t.once(()=>{this.subscribers.delete(t),this.subscribers.size||this.abort()})}watchMode(t=!0){this.mutationsWatch?.abort(),!(!t||!this.signals.size||!ce(this.state))&&(this.mutationsWatch=w.observe(this.state,e=>{let r={map:new Map,add(o,s){for(let a of o)a.spec.beforeSchedule?.(s)!==!1&&(this.map.has(a.runtime)||this.map.set(a.runtime,new Set),this.map.get(a.runtime).add(a))}};for(let o of e){let s=this.signals.get(o.key);!s||(r.add(s.subscribers,o),s.refresh(o.value))}let i=r.map.size?[...r.map].sort((o,s)=>o.$serial>s.$serial?-1:1):r.map;for(let[o,s]of i)o.state!=="aborted"&&o.schedule(...s)},{recursions:"force-sync"}))}refresh(t){this.state=t;for(let[e,r]of this.signals)r.refresh(w.get(this.state??{},e));this.watchMode()}};var T=class extends et{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var N=class extends tt{state;constructor(t,e,r,i,o,s){super(),t?.once(this),this.context=t,this.type=e,this.spec=r,this.scope=o,t?.scope!==o&&this.manage(o),this.serial=i,s&&(this.closure=s),t?.type==="iteration"?this.path=t.path.concat(this.spec.index):t?.type==="round"?this.path=t.path.concat(this.serial):this.path=(t?.path||[]).slice(0,-1).concat(this.serial),this.flowControl=new Map}get runtime(){return this.context.runtime}contains(t){return this===t.context||t.context&&this.contains(t.context)}order(t){if(!t)return this;let[e,r]=t.path.length<this.path.length?[t,this]:[this,t];return e.path.reduce((i,o,s)=>i&&o<=r.path[s],!0)&&e||r}beforeExecute(){this.state="running";let t=this.flowControl;return this.flowControl=new Map,t}execute(t=null){try{return this.runtime.thread.unshift(this),G(this.beforeExecute(),e=>ae(this.closure,this,this,r=>(this.spec.complete&&(r=this.spec.complete(r,this)),this.afterExecute(e),this.runtime.thread.shift(),t?t(r,this):r)))}catch(e){if(e.cause)throw e;let r=`${e.message||e}`;this.runtime.throw(r,[this.serial,this.context?.serial],globalThis[e.name])}}afterExecute(t){this.state="complete";let e=this.flowControl;this.handleDownstream(e.size,t.size),this.handleRightstream(e.size,t.size);for(let r of["break","continue","return"])e.has(r)&&!e.get(r).endpoint?this.hoistFlowControl(r,e.get(r).arg):t.has(r)&&!t.get(r).endpoint&&this.hoistFlowControl(r,t.get(r).arg,!0)}typed(t,e,r=void 0){let i=Array.isArray(e)?"array":e===null?"null":typeof e;if(i===t||t==="iterable"&&e?.[Symbol.iterator]||t==="desctructurable"&&!["undefined","null"].includes(i))return e;throw t==="iterable"?new Error("value is not iterable."):t==="desctructurable"?new Error((r?`Cannot access ${r}; `:"")+"object not desctructurable."):new Error(`value must be of type ${t}.`)}let(t,e,r,i={}){return this.var(t,e,r,{...i,kind:"let"})}const(t,e,r,i={}){return this.var(t,e,r,{...i,kind:"const"})}var(t,e,r,i={}){i={kind:"var",...i},r||(r=()=>{});let o=i.restOf?(...a)=>{try{return r(...a)}catch(l){throw new Error(`Cannot declare ${t}; ${l.message}`)}}:r,s=(a,l)=>{let c=i.kind==="var"?this.runtime.scope:l.scope;for(;i.kind==="var"&&!["module","function"].includes(c.type)&&!w.has(c.state,t)&&c.context;)c=c.context;let u=c.symbols.get(t);if(u&&(u.kind!==i.kind||i.kind==="let"&&u.serial!==e))throw new Error(`Identifier "${t}" has already been declared.`);u?.reader?.abort(),u={serial:e,kind:i.kind};let h=a;return i.restOf&&(i.type==="array"?h=[]:h={},u.reader=w.read(a,h,{except:i.restOf,spread:i.type==="array"}),l.once(u.reader)),c.symbols.set(t,u),w.set(c.state,t,h),h};return this.autorun(i.kind,{complete:s,...i},e,o)}update(t,e,r={}){let i=this.scope;for(;i&&!w.has(i.state,t);)i=i.context;if(!i)throw new ReferenceError(`${t} is not defined.`);let o=i.symbols.get(t);if(o?.kind==="const")throw new ReferenceError(`Assignment to constant variable "${t}".`);let s=w.get(i.state,t),a=r.restOf?(...l)=>{try{return e(...l)}catch(c){throw new Error(`Cannot update ${t}; ${c.message}`)}}:e;return ae(a,void 0,s,l=>{o?.reader?.abort();let c=l;return r.restOf&&(o=o||{},r.type==="array"?c=[]:c={},o.reader=w.read(l,c,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader)),w.set(i.state,t,c),["postinc","postdec"].includes(r.kind)?s:c})}ref(t,...e){let r=0,i={};typeof e[0]=="number"?(r=e.shift(),i=e.shift()||{}):typeof e[0]=="object"&&(i=e.shift());let o=this.scope;for(;o&&!w.has(o.state,t);)o=o.context;if(!o){if(i.isTypeCheck)return;throw new Error(`${t} is not defined.`)}let s=o.symbols.get(t)?.kind,a=o.signal(t,s);return i.typed&&this.typed(i.typed,a.state,t),this.autobind(a,r,i)}obj(t,...e){let r=0,i={};return typeof e[0]=="number"?(r=e.shift(),i=e.shift()||{}):typeof e[0]=="object"&&(i=e.shift()),this.autobind(this.runtime.$objects.signal(t,"object"),r,i)}autobind(t,e,r){let i=this.runtime.$params.isQuantumFunction,o=t.type==="const",s=this===this.runtime,a=this.state==="aborted",l=this;return function c(u,h){if(i&&!o&&!s&&!a&&u.subscribe(l),!h||!u.state||typeof u.state!="object"){let p=u.state;return typeof u.state=="function"&&(p=w.proxy(u.state,{membrane:u})),p}let f;return w.proxy(u.state,{},p=>({...p,get(y,m,x=null){return f?p.get(y,m,x):(f=!0,c(u.signal(m),h-1))}}))}(t,e)}autorun(t,...e){let r=e.pop(),i=e.pop(),o=e.pop()||{},s=N,a=this.scope;if(t==="iteration"){let c=this.runtime.constructor;s=r.constructor.name==="AsyncFunction"?c.AutoAsyncIterator:c.AutoIterator}["block","iteration"].includes(t)&&(a=new T(a,t));let l=new s(this,t,o,i,a,r);if(!(t==="downstream"&&(this.downstream=l,this.flowControlApplied())))return l.execute()}function(t,e,r,i){t&&w.set(this.scope.state,i.name,i);let o=this;return Object.defineProperty(i,"toString",{value:function(s=!1){if(s&&e)return Function.prototype.toString.call(i);let a=o.runtime.extractSource(r);return a.startsWith("static ")?a.replace("static ",""):a}}),i}class(t,e,r){return t&&w.set(this.scope.state,e.name,e),r.forEach(({name:i,static:o,isQuantumFunction:s,serial:a})=>{this.function(!1,s,a,o?e[i]:e.prototype[i])}),e}async import(...t){return this.runtime.import(...t)}async export(...t){return this.runtime.export(...t)}continue(t){return this.applyFlowControl("continue",t)}break(t){return this.applyFlowControl("break",t)}return(t){return this.applyFlowControl("return",t)}applyFlowControl(t,e,r=!1){let i=this.flowControl.size;if(r?this.flowControl.delete(t):this.flowControl.set(t,{arg:e}),this.type==="round"&&(this.context.breakpoint=this),this.type==="round"&&["break","continue"].includes(t)&&e===this.context?.spec.label){r||(this.flowControl.get(t).endpoint=!0),this.state!=="running"&&this.handleRightstream(this.flowControl.size,i);return}this.state!=="running"&&(this.handleDownstream(this.flowControl.size,i),this.hoistFlowControl(...arguments))}hoistFlowControl(...t){return this.context?.applyFlowControl(...t)}flowControlApplied(t,e){return arguments.length?arguments.length===1?this.flowControl.has(t):this.flowControl.get(t)?.arg===e:this.flowControl.size||!1}handleDownstream(t,e){let r;this.type!=="block"||!(r=this.context?.downstream)||(t?r.abort():e&&(r.state="resuming",this.runtime.schedule(r)))}handleRightstream(t,e){if(this.type!=="round")return;let r=this,i=new Set;for(;r=r.nextRound;)t?r.abort():e&&r.state!=="inert"&&(r.state="resuming",i.add(r));i.size&&this.runtime.schedule(...i),!t&&e&&this.runtime.on("reflection",()=>{this.context.iterating||this.context.iterate()},{once:!0})}abort(t=!1){return t&&(this.context?.breakpoint===this&&delete this.context.breakpoint,this.flowControl.clear()),this.state=t?"inert":"aborted",super.abort(t)}};var rt=class extends N{rounds=new Map;constructor(t,e,r,i,o,s){r.$closure=s,super(t,e,r,i,o),this.manage(()=>{delete this.breakpoint,this.rounds.clear()})}pseudorun(t){return this.runtime.iThread.unshift(this),G(t(),e=>(this.runtime.iThread.pop(),e))}createIterator(){return this.spec.kind==="for-in"?function*(){for(let t in this.iteratee)yield t}.call(this):this.spec.kind==="for-of"?function*(){for(let t of this.iteratee)yield t}.call(this):{next:()=>({done:!this.pseudorun(()=>this.spec.test(this))})}}closure(){["for-of","for-in"].includes(this.spec.kind)?([this.production,this.iteratee]=this.spec.parameters(this),this.iterator=this.createIterator(),this.iterator.original=!0,this.watchMode()):(this.spec.kind==="for"&&this.spec.init(this),this.iterator=this.createIterator()),this.iterate()}terminated(){return this.breakpoint&&!this.breakpoint.flowControlApplied("continue",this.spec.label)&&this.breakpoint.flowControlApplied()}advance(){this.spec.kind==="for"&&this.pseudorun(()=>this.spec.advance(this))}iterate(){this.iterating=!0;let t=()=>!this.terminated()&&!(this.cursor=this.iterator.next()).done,e=()=>{this.createRound(this.cursor.value).execute(),this.advance()};if(this.spec.kind==="do-while")do e();while(t());else for(;t();)e();this.iterating=!1}createRound(t){let e=this.rounds.size,r={index:e},i=["for-in","for-of"].includes(this.spec.kind)?{[this.production]:t}:{...this.scope.state},o=new T(this.scope,"round",i);this.scope.symbols.forEach((l,c)=>{o.symbols.set(c,l)});let s=new N(this,"round",r,this.serial,o,this.spec.$closure),a=this.spec.kind==="for-in"?t:e;return this.rounds.set(a,s),this.lastRound&&(this.lastRound.nextRound=s,s.prevRound=this.lastRound),this.lastRound=s,s}watchMode(){let t=(e,r)=>{let i=new Set,o=new Set;for(let s of e){if(Array.isArray(this.iteratee)&&s.key==="length")continue;let a=this.spec.kind==="for-in"?s.key:s.value,l=this.spec.kind==="for-in"?s.key:parseInt(s.key),c=this.rounds.get(l);if(c)w.set(c.scope.state,this.production,a),s.type==="delete"&&(this.rounds.set(l,void 0),c.prevRound&&(c.prevRound.nextRound=c.nextRound),c.nextRound&&(c.nextRound.prevRound=c.prevRound),i.add(c));else if(s.type!=="delete"&&!s.isUpdate){if(this.spec.kind==="for-of"&&this.iterator.original&&!r.done)continue;o.add(a)}}this.runtime.on("reflection",()=>{i.forEach(s=>s.abort(!0))},{once:!0}),o.size&&(this.iterator=function*(s){yield*s,yield*o}(this.iterator),r.done&&this.iterate())};this.once(w.observe(this.iteratee,e=>{G(this.cursor,r=>t(e,r))}))}};var Et=class extends rt{async createIterator(){return this.spec.kind==="for-in"?function*(){for(let t in this.iteratee)yield t}.call(this):this.spec.kind==="for-of"?function*(){for(let t of this.iteratee)yield t}.call(this):{next:async()=>({done:!await this.pseudorun(()=>this.spec.test(this))})}}async closure(){["for-of","for-in"].includes(this.spec.kind)?([this.production,this.iteratee]=await this.spec.parameters(this),this.iterator=await this.createIterator(),this.iterator.original=!0,this.watchMode()):(this.spec.kind==="for"&&await this.spec.init(this),this.iterator=await this.createIterator()),await this.iterate()}async iterate(){let t;this.iterating=!0;let e=async()=>!this.terminated()&&(this.cursor=this.iterator.next())&&(t=await this.cursor)&&!t.done,r=async()=>{await this.createRound(t.value).execute(),await this.advance()};if(this.spec.kind==="do-while")do await r();while(await e());else for(;await e();)await r();this.iterating=!1}};var Pt=class{constructor(t){Object.defineProperty(this,"runtime",{value:t});let e={statechange:()=>{w.defineProperty(this,"value",{value:t.flowControl.get("return")?.arg,enumerable:!0,configurable:!0})}};for(let r in e)t.on(r,e[r]),e[r]();t.$params.sourceType==="module"&&Object.defineProperty(this,"exports",{value:t.exports})}dispose(){return this.runtime.abort(!0)}};var nt=class extends N{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,i,o){super(t,e,{},-1,i,o);let{$serial:s=0,...a}=r;this.$serial=s,this.$params=a,this.$objects=new T(void 0,"objects"),this.manage(this.$objects),this.exports=Object.create(null),this.$promises={imports:[],exports:[]},this.manage(()=>{w.deleteProperties(this.exports,Object.keys(this.exports)),this.$promises.imports.splice(0),this.$promises.exports.splice(0)})}extractSource(t,e=!1){let[[r,i,o],[s]]=this.locations[t],a=this.$params.originalSource.slice(r,s);return e?{expr:a,line:i,column:o}:a}throw(t,e,r=null,i=null){let o,s=i!==null?`[${i}]: ${t}`:t,a=e.map(c=>c!==-1&&this.extractSource(c,!0)).filter(c=>c);a.push({source:this.$params.originalSource}),o=new(r||Error)(s,{cause:a});let l=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw l&&(o.fileName=l),i&&(o.code=i),o}get runtime(){return this}get nowRunning(){return this.thread[0]}schedule(...t){let e=this.queue.size;for(let r of t)this.queue.add(r);if(!e)return this.flowControlDirty=!1,function r(i,o){let s;for(let a of this.queue){if(o&&o.order(a)!==o||["aborted","running"].includes(a.state)||this.iThread[0]?.contains(a)){this.queue.delete(a);continue}s=s?s.order(a):a,o||(o=s)}return s?(s.abort(),s.execute(a=>(this.queue.delete(s),r.call(this,a,s)))):(this.fire("reflection"),this.flowControlApplied()&&this.fire("statechange"),i)}.call(this,void 0,this.nowRunning)}execute(t=null){return super.execute(e=>{let r=this.$params.isQuantumFunction?new Pt(this):e;return t?t(r,this):r})}spawn(t,e,r){let i=this.nowRunning||this,o={...this.$params,$serial:this.$serial+1,isQuantumFunction:t},s=new T(i.scope,"function",{this:e});return new this.constructor(i,"function",o,s,r).execute()}async import(...t){let e=t.pop(),r=typeof e=="string"?{source:e}:e,i=s=>{if(r.forExport||r.isDynamic)return s;this.assignModules(t,this.scope.state,s,e.serial)};if(this.$params.experimentalFeatures!==!1&&At[r.source])return i(At[r.source]);let o=(async()=>{let s=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;try{return i(await import(r.source))}catch(a){throw a.code==="ERR_MODULE_NOT_FOUND"&&this.throw(`Cannot find package "${r.source}"${s?` imported at "${s}"`:""}.`,[r.serial],null,a.code),a}})();return r.isDynamic||this.$promises[r.forExport?"exports":"imports"].push(o),o}async export(...t){let e=Array.isArray(t[t.length-1])?null:t.pop(),r=e?await this.import({...e,forExport:!0}):this.scope.state;this.assignModules(t,this.exports,r,e?.serial)}assignModules(t,e,r,i=null){let o=[];for(let[s,a,l]of t){if(s==="*"&&l){w.set(e,l,r);continue}w.has(r,s)||this.throw(`The requested module does not provide an export named "${s}".`,[a,i]),w.set(e,l||s,w.get(r,s)),o.push([s,a,l])}!o.length||this.once(w.observe(r,s=>{for(let[a,,l]of o)for(let c of s)a==="*"?w.set(e,c.key,c.value):c.key===a&&w.set(e,l||a,c.value)}))}afterExecute(...t){return this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace&&(At[this.$params.exportNamespace]=this.exports,this.once(()=>{delete At[this.$params.exportNamespace]})),super.afterExecute(...t)}};D(nt,"AutoAsyncIterator",Et),D(nt,"AutoIterator",rt);function He(n,t,e,r){let{env:i,functionParams:o=[],exportNamespace:s,fileName:a}=r,{parserParams:l,compilerParams:c,runtimeParams:u}=Ve(r);if(n==="module")l.sourceType=n,l.allowAwaitOutsideFunction=!0;else if(["function","async-function"].includes(n)){let f=" "+e.split(`
2
2
  `).join(`
3
3
  `);e=`return ${n==="async-function"?"async ":""}function**(${o.join(", ")}) {
4
4
  ${f}
5
- }`,a.startStatic=!0}else if(!["script","async-script"].includes(n))throw new Error(`Unrecognized sourceType specified: "${n}".`);a.sourceType=n;let h=t(e,{parserParams:l,compilerParams:a});if(h instanceof Promise&&!["async-function","async-script","module"].includes(n))throw new Error("Parse-compile can only return a Promise for sourceTypes: async-function, async-script, module.");return u.sourceType=n,u.exportNamespace=s,u.fileName=c,G(h,f=>{let p=["async-script","module"].includes(n),m=((d,b)=>u.compileFunction?u.compileFunction(b,d):new(p?async function(){}.constructor:Function)(...d.concat(b)))([f.identifier+""],f+""),x=["function","async-function"].includes(n),g=d=>{let b=m;d&&(b=b.bind(d));let A="global",v=new T(void 0,A,globalThis);return(n.endsWith("script")||i)&&(A="env",v=new T(v,A,i)),n==="module"&&(A="module",v=new T(v,A)),typeof d<"u"&&(v=new T(v,"this",{this:d})),new nt(void 0,A,{...u,originalSource:f.originalSource,isStatefulFunction:!x},v,b)};return x?g().execute():{createRuntime:g,compiledSource:f}})}function le(...n){let{source:t,params:e}=De(n),r=He("async-function",$r,t,e);if(!(r instanceof Promise))return r;let i=async function(...o){return(await r).call(this,...o)};return Object.defineProperty(i,"toString",{value:async function(...o){return(await r).toString(...o)}}),i}function $r(...n){let t=typeof n[n.length-1]=="object"?n.pop():{},e=n.pop()||"";if(globalThis.webqit?.$fCompiler){let{parse:r,compile:i}=globalThis.webqit.$fCompiler,o=r(e,t.parserParams);return i(o,t.compilerParams)}if(globalThis.webqit=globalThis.webqit||{},!globalThis.webqit.$fCompilerWorker){let o=`
6
- const compilerUrls = [ '${(document.querySelector('meta[name="$f-compiler-url"]')?.content.split(",")||[]).concat("https://unpkg.com/@webqit/stateful-js/dist/compiler.js").join("','")}' ];
5
+ }`,c.startStatic=!0}else if(!["script","async-script"].includes(n))throw new Error(`Unrecognized sourceType specified: "${n}".`);c.sourceType=n;let h=t(e,{parserParams:l,compilerParams:c});if(h instanceof Promise&&!["async-function","async-script","module"].includes(n))throw new Error("Parse-compile can only return a Promise for sourceTypes: async-function, async-script, module.");return u.sourceType=n,u.exportNamespace=s,u.fileName=a,G(h,f=>{let p=["async-script","module"].includes(n),m=((d,b)=>u.compileFunction?u.compileFunction(b,d):new(p?async function(){}.constructor:Function)(...d.concat(b)))([f.identifier+""],f+""),x=["function","async-function"].includes(n),g=d=>{let b=m;d&&(b=b.bind(d));let A="global",v=new T(void 0,A,globalThis);return(n.endsWith("script")||i)&&(A="env",v=new T(v,A,i)),n==="module"&&(A="module",v=new T(v,A)),typeof d<"u"&&(v=new T(v,"this",{this:d})),new nt(void 0,A,{...u,originalSource:f.originalSource,isQuantumFunction:!x},v,b)};return x?g().execute():{createRuntime:g,compiledSource:f}})}function le(...n){let{source:t,params:e}=Fe(n),r=He("async-function",$r,t,e);if(!(r instanceof Promise))return r;let i=async function(...o){return(await r).call(this,...o)};return Object.defineProperty(i,"toString",{value:async function(...o){return(await r).toString(...o)}}),i}function $r(...n){let t=typeof n[n.length-1]=="object"?n.pop():{},e=n.pop()||"";if(globalThis.webqit?.$qCompiler){let{parse:r,compile:i}=globalThis.webqit.$qCompiler,o=r(e,t.parserParams);return i(o,t.compilerParams)}if(globalThis.webqit=globalThis.webqit||{},!globalThis.webqit.$qCompilerWorker){let o=`
6
+ const compilerUrls = [ '${(document.querySelector('meta[name="$q-compiler-url"]')?.content.split(",")||[]).concat("https://unpkg.com/@webqit/quantum-js/dist/compiler.js").join("','")}' ];
7
7
  ( function importScript() {
8
8
  try { importScripts( compilerUrls.shift().trim() ) } catch( e ) { if ( compilerUrls.length ) { importScript(); } }
9
9
  } )();
10
- const { parse, compile } = globalThis.webqit.$fCompiler;
10
+ const { parse, compile } = globalThis.webqit.$qCompiler;
11
11
  globalThis.onmessage = e => {
12
12
  const { source, params } = e.data;
13
13
  const ast = parse( source, params.parserParams );
@@ -18,7 +18,7 @@ ${f}
18
18
  compiledSource: compilation + '',
19
19
  topLevelAwait: compilation.topLevelAwait
20
20
  } );
21
- };`;globalThis.webqit.$fCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return new Promise(r=>{let i=new MessageChannel;webqit.$fCompilerWorker.postMessage({source:e,params:t},[i.port2]),i.port1.onmessage=o=>{let{compiledSource:s,...c}=o.data;Object.defineProperty(c,"toString",{value:()=>s}),r(c)}})}function he(n={}){let{config:t,window:e}=oe.call(this,"html-bindings",n,{attr:{binding:"binding",itemIndex:"data-index"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},staticsensitivity:!0,isomorphic:!0});t.CONTEXT_API=e.webqit.oohtml.configs.CONTEXT_API,t.BINDINGS_API=e.webqit.oohtml.configs.BINDINGS_API,t.HTML_IMPORTS=e.webqit.oohtml.configs.HTML_IMPORTS,t.attrSelector=`[${e.CSS.escape(t.attr.binding)}]`;let r=(i,o)=>{let s=`starts-with(., "${i}")`,c=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${c}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,e.webqit.Observer=w,Ar.call(e,t)}function Ar(n){let t=this,{realdom:e}=t.webqit;e.realtime(t.document).subtree(`(${n.discreteBindingsSelector})`,r=>{ze.call(this,...r.exits),Er.call(this,n,...r.entrants)},{live:!0}),e.realtime(t.document).subtree(n.attrSelector,r=>{ze.call(this,...r.exits),Pr.call(this,n,...r.entrants)},{live:!0,timing:"sync",staticSensitivity:n.staticsensitivity})}function We(n,t){if(M(t).has("data-binding"))return M(t).get("data-binding");let e={},r=new AbortController;e.$set__=function(o,s,c){o&&(o[s]=c)},w.intercept(e,{get:(o,s,c)=>{if(!(o.key in e)){let l=lt.createRequest({detail:o.key,live:!0,signal:r.signal});t[n.CONTEXT_API.api.context].request(l,a=>{w.set(e,o.key,a)})}return c(e[o.key]??(o.key in globalThis?globalThis[o.key]:void 0))},has:(o,s,c)=>c(!0)});let i={scope:e,abortController:r,bindings:new Map};return M(t).set("data-binding",i),i}function ze(...n){for(let t of n){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:i}=M(e).get("data-binding")||{};if(!r?.has(t))return;r.get(t).state.dispose(),r.get(t).signals.forEach(o=>o.abort()),r.delete(t),r.size||(i.abort(),M(e).delete("data-binding"))}}async function Er(n,...t){let e=this,r=o=>{let s=n.tokens.tagStart.split("").map(p=>`\\${p}`).join(""),c=n.tokens.tagEnd.split("").map(p=>`\\${p}`).join(""),l=n.tokens.stateStart.split("").map(p=>p===" "?"(?:\\s+)?":`\\${p}`).join(""),a=n.tokens.stateEnd.split("").map(p=>`\\${p}`).join(""),u=`^${s}(.*?)(?:${l}(\\d+)${a}(?:\\s+)?)?${c}$`,[,h,f]=o.match(new RegExp(u));return{raw:o,expr:h,span:parseInt(f??0)}},i=t.reduce((o,s)=>{if(s.isBound)return o;let c=r(s.nodeValue),l=s;if(c.span){if(l=s.nextSibling,l?.nodeName!=="#text"||l.nodeValue.length<c.span)return o;l.nodeValue.length>c.span&&l.splitText(c.span)}else l=s.ownerDocument.createTextNode(""),s.after(l);l.isBound=!0;let a=s;return e.webqit.env!=="server"&&(a.remove(),a=null),o.concat({textNode:l,template:c,anchorNode:a})},[]);for(let{textNode:o,template:s,anchorNode:c}of i){let{scope:l,bindings:a}=We(n,o.parentNode),u="";u+=`let content = ((${s.expr}) ?? '') + '';`,u+="$set__(this, 'nodeValue', content);",c&&(u+=`$set__($anchorNode__, 'nodeValue', \`${n.tokens.tagStart}${s.expr}${n.tokens.stateStart}\` + content.length + \`${n.tokens.stateEnd} ${n.tokens.tagEnd}\`);`);let h=new le("$signals__","$anchorNode__",u,{env:l}),f=[];a.set(o,{compiled:h,signals:f,state:await h.call(o,f,c)})}}async function Pr(n,...t){for(let e of t){let r=Sr(n,e.getAttribute(n.attr.binding)),{scope:i,bindings:o}=We(n,e),s=new le("$signals__",r,{env:i}),c=[];o.set(e,{compiled:s,signals:c,state:await s.call(e,c)})}}var ue=new Map;function Sr(n,t){if(ue.has(t))return ue.get(t);let e={},r=fe(t,";").map(i=>{let[o,s]=fe(i,":").map(h=>h.trim()),c=o[0],l=o.slice(1).trim(),a=`(${s})`,u=`(${a} ?? '')`;if(c==="&")return`this.style[\`${l}\`] = ${u};`;if(c==="%")return`this.classList.toggle(\`${l}\`, !!${a});`;if(c==="~")return l.endsWith("?")?`this.toggleAttribute(\`${l.substring(0,-1).trim()}\`, !!${a});`:`this.setAttribute(\`${l}\`, ${u});`;if(c==="@"){if(e[l])throw new Error(`Duplicate binding: ${o}.`);if(e[l]=!0,l==="text")return`$set__(this, 'textContent', ${u});`;if(l==="html")return`this.setHTML(${u});`;if(l==="items"){let[h,f]=fe(s,"/");if(!f)throw new Error(`Invalid ${c}items spec: ${i}; no import specifier.`);let[p,y,m,x]=h.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!p)throw new Error(`Invalid ${c}items spec: ${i}.`);if(y.startsWith("(")?y=y.trim().slice(1,-1).split(",").map(d=>d.trim()):y=[y],y.length>(m==="in"?3:2))throw new Error(`Invalid ${c}items spec: ${i}.`);let g=m==="in"?y[2]:y[1]||"$index__";return`
21
+ };`;globalThis.webqit.$qCompilerWorker=new Worker(`data:text/javascript;base64,${btoa(o)}`)}return new Promise(r=>{let i=new MessageChannel;webqit.$qCompilerWorker.postMessage({source:e,params:t},[i.port2]),i.port1.onmessage=o=>{let{compiledSource:s,...a}=o.data;Object.defineProperty(a,"toString",{value:()=>s}),r(a)}})}function he(n={}){let{config:t,window:e}=oe.call(this,"html-bindings",n,{attr:{binding:"binding",itemIndex:"data-index"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},staticsensitivity:!0,isomorphic:!0});t.CONTEXT_API=e.webqit.oohtml.configs.CONTEXT_API,t.BINDINGS_API=e.webqit.oohtml.configs.BINDINGS_API,t.HTML_IMPORTS=e.webqit.oohtml.configs.HTML_IMPORTS,t.attrSelector=`[${e.CSS.escape(t.attr.binding)}]`;let r=(i,o)=>{let s=`starts-with(., "${i}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,e.webqit.Observer=w,Ar.call(e,t)}function Ar(n){let t=this,{realdom:e}=t.webqit;e.realtime(t.document).subtree(`(${n.discreteBindingsSelector})`,r=>{ze.call(this,...r.exits),Er.call(this,n,...r.entrants)},{live:!0}),e.realtime(t.document).subtree(n.attrSelector,r=>{ze.call(this,...r.exits),Pr.call(this,n,...r.entrants)},{live:!0,timing:"sync",staticSensitivity:n.staticsensitivity})}function We(n,t){if(M(t).has("data-binding"))return M(t).get("data-binding");let e={},r=new AbortController;e.$set__=function(o,s,a){o&&(o[s]=a)},w.intercept(e,{get:(o,s,a)=>{if(!(o.key in e)){let l=lt.createRequest({detail:o.key,live:!0,signal:r.signal});t[n.CONTEXT_API.api.context].request(l,c=>{w.set(e,o.key,c)})}return a(e[o.key]??(o.key in globalThis?globalThis[o.key]:void 0))},has:(o,s,a)=>a(!0)});let i={scope:e,abortController:r,bindings:new Map};return M(t).set("data-binding",i),i}function ze(...n){for(let t of n){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:i}=M(e).get("data-binding")||{};if(!r?.has(t))return;r.get(t).state.dispose(),r.get(t).signals.forEach(o=>o.abort()),r.delete(t),r.size||(i.abort(),M(e).delete("data-binding"))}}async function Er(n,...t){let e=this,r=o=>{let s=n.tokens.tagStart.split("").map(p=>`\\${p}`).join(""),a=n.tokens.tagEnd.split("").map(p=>`\\${p}`).join(""),l=n.tokens.stateStart.split("").map(p=>p===" "?"(?:\\s+)?":`\\${p}`).join(""),c=n.tokens.stateEnd.split("").map(p=>`\\${p}`).join(""),u=`^${s}(.*?)(?:${l}(\\d+)${c}(?:\\s+)?)?${a}$`,[,h,f]=o.match(new RegExp(u));return{raw:o,expr:h,span:parseInt(f??0)}},i=t.reduce((o,s)=>{if(s.isBound)return o;let a=r(s.nodeValue),l=s;if(a.span){if(l=s.nextSibling,l?.nodeName!=="#text"||l.nodeValue.length<a.span)return o;l.nodeValue.length>a.span&&l.splitText(a.span)}else l=s.ownerDocument.createTextNode(""),s.after(l);l.isBound=!0;let c=s;return e.webqit.env!=="server"&&(c.remove(),c=null),o.concat({textNode:l,template:a,anchorNode:c})},[]);for(let{textNode:o,template:s,anchorNode:a}of i){let{scope:l,bindings:c}=We(n,o.parentNode),u="";u+=`let content = ((${s.expr}) ?? '') + '';`,u+="$set__(this, 'nodeValue', content);",a&&(u+=`$set__($anchorNode__, 'nodeValue', \`${n.tokens.tagStart}${s.expr}${n.tokens.stateStart}\` + content.length + \`${n.tokens.stateEnd} ${n.tokens.tagEnd}\`);`);let h=new le("$signals__","$anchorNode__",u,{env:l}),f=[];c.set(o,{compiled:h,signals:f,state:await h.call(o,f,a)})}}async function Pr(n,...t){for(let e of t){let r=Sr(n,e.getAttribute(n.attr.binding)),{scope:i,bindings:o}=We(n,e),s=new le("$signals__",r,{env:i}),a=[];o.set(e,{compiled:s,signals:a,state:await s.call(e,a)})}}var ue=new Map;function Sr(n,t){if(ue.has(t))return ue.get(t);let e={},r=fe(t,";").map(i=>{let[o,s]=fe(i,":").map(h=>h.trim()),a=o[0],l=o.slice(1).trim(),c=`(${s})`,u=`(${c} ?? '')`;if(a==="&")return`this.style[\`${l}\`] = ${u};`;if(a==="%")return`this.classList.toggle(\`${l}\`, !!${c});`;if(a==="~")return l.startsWith("?")?`this.toggleAttribute(\`${l.substring(1).trim()}\`, !!${c});`:`this.setAttribute(\`${l}\`, ${u});`;if(a==="@"){if(e[l])throw new Error(`Duplicate binding: ${o}.`);if(e[l]=!0,l==="text")return`$set__(this, 'textContent', ${u});`;if(l==="html")return`this.setHTML(${u});`;if(l==="items"){let[h,f]=fe(s,"/");if(!f)throw new Error(`Invalid ${a}items spec: ${i}; no import specifier.`);let[p,y,m,x]=h.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!p)throw new Error(`Invalid ${a}items spec: ${i}.`);if(y.startsWith("(")?y=y.trim().slice(1,-1).split(",").map(d=>d.trim()):y=[y],y.length>(m==="in"?3:2))throw new Error(`Invalid ${a}items spec: ${i}.`);let g=m==="in"?y[2]:y[1]||"$index__";return`
22
22
  let $iteratee__ = ${x};
23
23
  let $import__ = this.${n.HTML_IMPORTS.context.api.import}( ${f.trim()}, true );
24
24
  $signals__.push( $import__ );