@webqit/oohtml 5.0.2 → 5.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +11 -11
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +6 -6
- package/dist/main.lite.js.map +2 -2
- package/package.json +2 -2
package/dist/main.lite.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var Sr=Object.defineProperty;var fi=(i,t,e)=>t in i?Sr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Pe=(i,t)=>{for(var e in t)Sr(i,e,{get:t[e],enumerable:!0})};var V=(i,t,e)=>(fi(i,typeof t!="symbol"?t+"":t,e),e),Or=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var U=(i,t,e)=>(Or(i,t,"read from private field"),e?e.call(i):t.get(i)),Ut=(i,t,e)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,e)},It=(i,t,e,r)=>(Or(i,t,"write to private field"),r?r.call(i,e):t.set(i,e),e);var Ke={};Pe(Ke,{AsyncLiveFunction:()=>Wi,AsyncLiveScript:()=>ne,LiveFunction:()=>Fi,LiveModule:()=>oe,LiveProgramHandle:()=>vt,LiveScript:()=>zi,Observer:()=>C,compile:()=>Dr,matchPrologDirective:()=>jr,nextKeyword:()=>Rr,parse:()=>ge,serialize:()=>be,transform:()=>ye});var Xe={};Pe(Xe,{any:()=>Pi,apply:()=>We,batch:()=>Ge,construct:()=>Fe,defineProperties:()=>Mi,defineProperty:()=>Zt,deleteProperties:()=>qi,deleteProperty:()=>Kt,get:()=>ut,getOwnPropertyDescriptor:()=>de,getOwnPropertyDescriptors:()=>Ci,getPrototypeOf:()=>Ne,has:()=>he,intercept:()=>Ti,isExtensible:()=>Le,map:()=>Ii,observe:()=>Ve,ownKeys:()=>He,path:()=>Ei,preventExtensions:()=>Be,reduce:()=>Ue,set:()=>xt,setPrototypeOf:()=>ze,subtree:()=>Ai});function q(i){return!Array.isArray(i)&&typeof i=="object"&&i}function Mt(i){return typeof i}function M(i){return Array.isArray(i)}function qt(i){return typeof i=="function"}function Vt(i){return i===null||i===""}function at(i){return arguments.length&&(i===void 0||typeof i>"u")}function j(i){return Array.isArray(i)||typeof i=="object"&&i||qt(i)}function Te(i){return Vt(i)||at(i)||i===!1||i===0||j(i)&&!Object.keys(i).length}function k(i){return qt(i)||i&&{}.toString.call(i)==="[object function]"}function Gt(i){return i instanceof Number||typeof i=="number"}function Z(i){return Gt(i)||i!==!0&&i!==!1&&i!==null&&i!==""&&!isNaN(i*1)}function kt(i){return i instanceof String||typeof i=="string"&&i!==null}function Ce(i){return!kt(i)&&!at(i.length)}function ue(i,...t){return t.forEach(e=>{i.indexOf(e)<0&&i.push(e)}),i}function Ie(r,t){t=t||Object.prototype,t=t&&!M(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 Me(i,t){var e=[];return Ie(i,t).forEach(r=>{ue(e,...Object.getOwnPropertyNames(r))}),e}function it(i,t,e=!1,r=!1,n=!1){var o=0,s=i.shift();if((Z(s)||s===!0||s===!1)&&(o=s,s=i.shift()),!i.length)throw new Error("_merge() requires two or more array/objects.");return i.forEach((a,c)=>{!j(a)&&!k(a)||(e?Me(a):Object.keys(a)).forEach(l=>{if(!!t(l,s,a,c)){var u=s[l],p=a[l];if((M(u)&&M(p)||q(u)&&q(p))&&(o===!0||o>0))s[l]=M(u)&&M(p)?[]:{},it([Z(o)?o-1:o,s[l],u,p],t,e,r,n);else if(M(s)&&M(a))r?s[l]=p:s.push(p);else try{n?Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(a,l)):s[l]=a[l]}catch{}}})}),s}function Xt(...i){return it(i,(t,e,r)=>!0,!1,!1,!1)}function W(i,...t){if(!i||!["object","function"].includes(typeof i))throw new Error("Argument #1 must be of type object");let e=i[Symbol.for("wq")];if(e||(e=new fe,Object.defineProperty(i,Symbol.for("wq"),{value:e,enumerable:!1,configurable:!1,writable:!1})),!t.length)return e;let r,n;for(;r=t.shift();)(n=e)&&!(e=e.get(r))&&(e=new fe,n.set(r,e));return e}var fe=class extends Map{};function F(i,t=!0){return M(i)?i:!t&&q(i)?[i]:i!==!1&&i!==0&&Te(i)?[]:Ce(i)?Array.prototype.slice.call(i):q(i)?Object.values(i):[i]}var L=(i,...t)=>W(i,"observerAPI",...t),jt=(i,t)=>i instanceof Promise?i.then(t):t(i),pe={};var bt=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 Jt=class extends bt{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),pe.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=F(r,!1))&&(e=t.filter(o=>r.includes(o.key))),this.params.diff&&(e=e.filter(o=>o.type!=="set"||o.value!==o.oldValue)),!e.length)return;if(["inject","defer"].includes(this.params.recursions)){if(this.emit.recursionTarget){this.emit.recursionTarget.push(...e);return}this.emit.recursionTarget=this.params.recursions==="inject"?e:[]}let n=this.filter===1/0||Array.isArray(this.filter)?this.emit(e,this):this.emit(e[0],this);return jt(n,o=>{let s=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="defer"&&s?.length?this.emit.currentRegistration.fire(s):o})}};var wt=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,n=this.__namespace){if(!j(e))throw new Error(`Subject must be of type object; "${Mt(e)}" given!`);let o=this;return n&&L(globalThis,"observerAPI","namespaces").has(t+"-"+n)&&(o=L(globalThis,"observerAPI","namespaces").get(t+"-"+n),t+="-"+n),!L(e,"registry").has(t)&&r&&L(e,"registry").set(t,new o(e)),L(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return L(globalThis,"observerAPI","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}.`);L(globalThis,"observerAPI","namespaces").set(t,r),r.__namespace=e}};var z=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 lt=class extends wt{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 Jt(this,{filter:t,emit:e,params:r}))}emit(t,{eventsArePropertyDescriptors:e=!1,eventIsArrayMethodDescriptor:r=!1}={}){if(this.batches.length){let n=this.batches[0].params.arrayMethodName;this.batches[0].snapshots.push({events:[...t],arrayMethodName:n,eventsArePropertyDescriptors:e,eventIsArrayMethodDescriptor:r});return}this.$emit(this.entries,[{events:t,eventsArePropertyDescriptors:e,eventIsArrayMethodDescriptor:r}])}$emit(t,e){let r=0,n=0,o=0;for(let u of t)r+=1,u.params.withPropertyDescriptors&&(n+=1),u.params.withArrayMethodDescriptors&&(o+=1);let s=[],a=[],c=[],l=[];for(let u of e){let p=u.arrayMethodName,f=u.eventsArePropertyDescriptors,d=u.eventIsArrayMethodDescriptor;for(let m of u.events)if(p&&(m.operation=p),n&&(o&&s.push(m),d||o!==r&&a.push(m)),n!==r){let w=m;if(f){let{target:v,type:g,...y}=m;w=new z(v,{type:"set",...y}),Object.defineProperty(w,"value","get"in y.value?{get:()=>y.value.get()}:{value:y.value.value}),y.oldValue&&Object.defineProperty(w,"oldValue","get"in y.oldValue?{get:()=>y.oldValue.get()}:{value:y.oldValue.value})}o&&c.push(w),d||o!==r&&l.push(w)}}for(let u of t)u.params.withPropertyDescriptors?u.params.withArrayMethodDescriptors?s.length&&u.fire(s):a.length&&u.fire(a):u.params.withArrayMethodDescriptors?c.length&&u.fire(c):l.length&&u.fire(l)}batch(t,e={}){this.batches.unshift({entries:[...this.entries],snapshots:[],params:e});let r=t();return jt(r,n=>{let o=this.batches.shift();return o.snapshots.length&&this.$emit(o.entries,o.snapshots),n})}};var Qt=class extends bt{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,(...n)=>(this.running=!1,e(...n))))}};var ct=class extends wt{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 Qt(this,t))}emit(t,e=null){let r=this;return function n(o,...s){let a=r.entries[o];return a?a.exec(t,(...c)=>n(o+1,...c),...s):e?e(t,...s):s[0]}(0)}};var De={};Pe(De,{accessorize:()=>Oi,proxy:()=>je,unaccessorize:()=>$i,unproxy:()=>Yt});var Ir=Symbol("wqOriginal");function Oi(i,t,e={}){i=Re(i);let r=L(i,"accessorizedProps");function n(c){let l,u=i;do l=Object.getOwnPropertyDescriptor(u,c);while(!l&&(u=Object.getPrototypeOf(u)));return l?{proto:u,descriptor:l}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(c){if(r.has(c+""))return!0;let l=n(c);l.getValue=function(f=!1){return f?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},l.setValue=function(f,d=!1){if(this.dirty=!0,d){this.descriptor=f;return}return this.descriptor.set?this.descriptor.set(f)!==!1:(this.descriptor.value=f,!0)},l.intact=function(){let f=Object.getOwnPropertyDescriptor(i,c);return f?.get===p.get&&f?.set===p.set&&r.get(c+"")===this},l.restore=function(){return this.intact()?(this.proto&&this.proto!==i||!this.proto&&!this.dirty?delete i[c]:Object.defineProperty(i,c,this.descriptor),r.delete(c+""),!0):!1},r.set(isNaN(c)?c:parseInt(c),l);let{enumerable:u=!0}=l.descriptor,p={enumerable:u,configurable:!0};("value"in l.descriptor||l.descriptor.set)&&(p.set=function(f){return xt(this,c,f,e)}),("value"in l.descriptor||l.descriptor.get)&&(p.get=function(){return ut(this,c,e)});try{return Object.defineProperty(i,c,p),!0}catch{return r.delete(c+""),!1}}let a=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(o);return t===void 0||Array.isArray(t)?a:a[0]}function $i(i,t,e={}){i=Re(i);let r=L(i,"accessorizedProps");function n(a){return r.has(a+"")?r.get(a+"").restore():!0}let s=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(n);return t===void 0||Array.isArray(t)?s:s[0]}function je(i,t={},e=void 0){let r=Re(i);if(typeof t.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(t.membrane&&L(r,"membraneRef").has(t.membrane))return L(r,"membraneRef").get(t.membrane);let n={apply:(a,c,l)=>We(a,c,l,void 0,t),construct:(a,c,l=null)=>Fe(a,c,l,t),defineProperty:(a,c,l)=>Zt(a,c,l,t),deleteProperty:(a,c)=>Kt(a,c,t),get:(a,c,l=null)=>{if(c===Ir)return r;let u={...t,receiver:l},p=ut(a,c,u);return Array.isArray(a)&&typeof p=="function"&&!/^class\s?/.test(Function.prototype.toString.call(p))?je(p,{...t,arrayMethodName:c,membrane:l},e):t.chainable&&j(p)&&c!=="prototype"&&!(typeof p=="function"&&/^class\s?|\{\s\[native\scode\]\s\}$/.test(Function.prototype.toString.call(p)))?je(p,t,e):p},getOwnPropertyDescriptor:(a,c)=>de(a,c,t),getPrototypeOf:a=>Ne(a,t),has:(a,c)=>he(a,c,t),isExtensible:a=>Le(a,t),ownKeys:a=>He(a,t),preventExtensions:a=>Be(a,t),set:(a,c,l,u=null)=>xt(a,c,l,{...t,receiver:u}),setPrototypeOf:(a,c)=>ze(a,c,t)},o=e?.(n)||n,s=new Proxy(r,o);return t.membrane&&L(r,"membraneRef").set(t.membrane,s),s}function Yt(i){return i&&i[Ir]||i}function Re(i){if(!i||!j(i))throw new Error("Target must be of type object!");return Yt(i)}var te=class extends Array{};function Ei(...i){return new te(...i)}var _t=class extends Array{};function Ai(){return new _t}function Pi(){return 1/0}function Ue(i,t,e,r=o=>o,n={}){let o=t instanceof _t;if(!(!o&&!t?.length))return function s(a,c,l,u){let p=u||c[l.level]instanceof _t,f=p?1/0:c[l.level],d=p?!1:l.level===c.length-1;return a instanceof z&&a.operation!=="get"?l={...l,probe:"always"}:l.probe!=="always"&&(l={...l,probe:!d}),e(a,f,(m,...w)=>{let v=x=>{x instanceof z&&(x.path="key"in x?[x.key]:[],a instanceof z&&(x.path="key"in x?a.path.concat(x.key):a.path.slice(0),Object.defineProperty(x,"context",{get:()=>a,configurable:!0})))},g=w[0]||{},y=x=>{if(x instanceof z&&"argumentsList"in x)return;let S=nt(x,!1);return jt(S,h=>(x instanceof z?x.value=h:x=h,s(x,c,{...l,...g,keyInParent:x.key,level:l.level+1},p)))};if(ee(f)&&Array.isArray(m)){if(m.forEach(v),d)return r(m,...w);p&&m[0]instanceof z&&(m[0].operation!=="get"||n.asGet)&&r(m,...w);for(let x of m)y(x);return}return v(m),d?r(m,...w):y(m)},l)}(i,t.slice(0),{...n,level:0},o)}function Ve(i,t,e,r={}){let n=nt(i,!r.level);if(k(arguments[1])&&([,e,r={}]=arguments,t=1/0),!k(e))throw new Error(`Handler must be a function; "${Mt(e)}" given!`);if(t instanceof te||t instanceof _t)return Ue(n,t,Ve,e,r);if(r={...r,descripted:!0},delete r.live,!j(n))return r.probe&&ut(n,t,e,r)||void 0;let o=Mr(n,t,e,r);return r.probe?ut(n,t,o,r):o()}function Ti(i,t,e={}){let r=nt(i);return q(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),ct.getInstance(r,!0,e.namespace).addRegistration({traps:t,params:e})}function de(i,t,e=n=>n,r={}){return rt(i,"getOwnPropertyDescriptor",{key:t},e,r)}function Ci(i,t,e=n=>n,r={}){return rt(i,"getOwnPropertyDescriptors",{key:t},e,r)}function Ne(i,t=r=>r,e={}){return rt(i,"getPrototypeOf",{},t,e)}function Le(i,t=r=>r,e={}){return rt(i,"isExtensible",{},t,e)}function He(i,t=r=>r,e={}){return rt(i,"ownKeys",{},t,e)}function he(i,t,e=n=>n,r={}){return rt(i,"has",{key:t},e,r)}function ut(i,t,e=n=>n,r={}){let n,o=nt(i,!r.level);return q(e)?[r,e]=[e,s=>s]:r.live&&(n=!0),t instanceof te||t instanceof _t?Ue(o,t,ut,e,{...r,asGet:!0}):ki(o,t,s=>{let a=[...s];return function c(l,u,p){if(!u.length)return p(l);let f=u.shift();if(!["string","number","symbol"].includes(typeof f))throw new Error(`Property name/key ${f} invalid.`);function d(v,g=void 0){let y=h=>(v.value=h,c([...l,r.live||r.descripted?v:h],u,p));if(arguments.length>1)return y(g);if(!j(o))return y(o?.[v.key]);let x=L(o,"accessorizedProps",!1),S=x&&x.get(v.key);if(S&&S.intact())return y(S.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let h=Object.getOwnPropertyDescriptor(o,v.key);return y(h)}return y(Reflect.get(o,v.key))}let m=new z(o,{type:"get",key:f,value:void 0,operation:"get",related:a});if(!j(o))return d(m);let w=ct.getInstance(o,!1,r.namespace);return w?w.emit(m,d):d(m)}([],s.slice(0),c=>{let l=ee(t)?c:c[0];return n&&j(o)?Mr(o,t,e,r,i.key)(l):e(l)})},r)}function Ge(i,t,e={}){let r=nt(i);return lt.getInstance(r,!0,e.namespace).batch(t,e)}function Ii(i,t,e={}){t=nt(t),i=nt(i);let r=(e.only||[]).slice(0),n=(e.except||[]).slice(0),o=Object.keys(e.spread?[...i]:i).map(l=>isNaN(l)?l:parseInt(l)),s=r.length?r.filter(l=>o.includes(l)):o.filter(l=>!n.includes(l)),a=l=>!Array.isArray(t)||isNaN(l)?l:l-n.filter(u=>u<l).length,c=l=>{let u=de(i,l,e);"value"in u&&u.writable&&u.enumerable&&u.configurable?xt(t,a(l),u.value,e):(u.enumerable||e.onlyEnumerable===!1)&&Zt(t,l,{...u,configurable:!0},e)};return Ge(t,()=>{s.forEach(c)}),Ve(i,l=>{l.filter(u=>r.length?r.includes(u.key):!n.includes(u.key)).forEach(u=>{if(u.type==="delete")return Kt(t,a(u.key),e);if(u.type==="def"){(u.value.enumerable||e.onlyEnumerable===!1)&&Zt(t,a(u.key),{...u.value,configurable:!0},e);return}c(u.key)})},{...e,withPropertyDescriptors:!0})}function xt(i,t,e,r=s=>s,n={},o=!1){let s=nt(i),a=[[t,e]];q(t)&&([,,r=l=>l,n={},o=!1]=arguments,a=Object.entries(t)),q(r)&&([o,n,r]=[typeof n=="boolean"?n:o,r,l=>l]);let c=a.map(([l])=>l);return function l(u,p,f){if(!p.length)return f(u);let[d,m]=p.shift();function w(g,y=void 0){let x=b=>(g.status=b,l(u.concat(g),p,f));if(arguments.length>1)return x(g,y);let S=L(s,"accessorizedProps",!1),h=S&&S.get(g.key);return g.type==="def"?(h&&!h.restore()&&x(!1),Object.defineProperty(s,g.key,g.value),x(!0)):h&&h.intact()?x(h.setValue(g.value)):x(Reflect.set(s,g.key,g.value))}function v(g,y){if(n.diff&&m===y)return l(u,p,f);let x=new z(s,{type:o?"def":"set",key:d,value:m,isUpdate:g,oldValue:y,related:[...c],operation:o?"defineProperty":"set",detail:n.detail}),S=ct.getInstance(s,!1,n.namespace);return S?S.emit(x,w):w(x)}return he(s,d,g=>{if(!g)return v(g);if(d==="length"&&Array.isArray(s)&&L(s).has("$length"))return v(!0,L(s).get("$length"));let y={...n,withPropertyDescriptors:o};return ut(s,d,x=>v(g,x),y)},n)}([],a.slice(0),l=>{let u=lt.getInstance(s,!1,n.namespace);return u&&u.emit(l,{eventsArePropertyDescriptors:!!o}),r(ee(t)?l.map(p=>p.status):l[0]?.status)})}function Zt(i,t,e,r=o=>o,n={}){return xt(i,t,e,r,n,!0)}function Mi(i,t,e=n=>n,r={}){return xt(i,t,e,r,!0)}function Kt(i,t,e=n=>n,r={}){let n=nt(i);q(e)&&([r,e]=[e,a=>a]);let o=F(t,!1),s=[...o];return function a(c,l,u){if(!l.length)return u(c);let p=l.shift();function f(m,w=void 0){let v=x=>(m.status=x,a(c.concat(m),l,u));if(arguments.length>1)return v(m,w);let g=L(n,"accessorizedProps",!1),y=g&&g.get(m.key);return y&&!y.restore()&&v(!1),v(Reflect.deleteProperty(n,m.key))}function d(m){let w=new z(n,{type:"delete",key:p,oldValue:m,related:[...s],operation:"deleteProperty",detail:r.detail}),v=ct.getInstance(n,!1,r.namespace);return v?v.emit(w,f):f(w)}return ut(n,p,d,r)}([],o.slice(0),a=>{let c=lt.getInstance(n,!1,r.namespace);return c&&c.emit(a),e(ee(t)?a.map(l=>l.status):a[0].status)})}function qi(i,t,e=n=>n,r={}){return Kt(...arguments)}function Fe(i,t,e=null,r=o=>o,n={}){return rt(i,"construct",arguments.length>2?{argumentsList:t,newTarget:e}:{argumentsList:t},r,n)}function We(i,t,e,r=o=>o,n={}){let o=Yt(t),s;if(Array.isArray(t)){if(n.arrayMethodName){let a=new z(o,{operation:n.arrayMethodName,argumentsList:e});lt.getInstance(o,!1,n.namespace)?.emit([a],{eventIsArrayMethodDescriptor:!0})}L(o).set("$length",o.length),s=Ge(o,()=>rt(i,"apply",{thisArgument:t,argumentsList:e},r,n),n),L(o).delete("$length")}else s=rt(i,"apply",{thisArgument:o,argumentsList:e},r,n);return s}function ze(i,t,e=n=>n,r={}){return rt(i,"setPrototypeOf",{proto:t},e,r)}function Be(i,t=r=>r,e={}){return rt(i,"preventExtensions",{},t,e)}function Mr(i,t,e,r={}){let n=new AbortController;pe.setMaxListeners?.(0,n.signal),r.signal&&r.signal.addEventListener("abort",()=>n.abort());let o={...r,signal:n.signal},s=lt.getInstance(i,!0,o.namespace),a=new Map;return function c(l=[],u=null){let p,f,d;if(ee(t)){if(u){d=!0,f=u;for(let m of l)a.get(m.key)?.remove(),a.delete(m.key)}else f=s.addRegistration(t,c,o);p={signal:f.signal,childRegistrations:a}}else u?.remove(),f=s.addRegistration(t,c,o),p={signal:f.signal};if(o.childRegistrations&&o.keyInParent&&o.childRegistrations.set(o.keyInParent,f),arguments.length){let m=e(l,p);if(arguments.length>1)return m}return n}}function rt(i,t,e={},r=o=>o,n={}){i=nt(i),q(r)&&([n,r]=[r,c=>c]);function o(c,l){return arguments.length>1?r(l):r((Reflect[t]||Object[t])(i,...Object.values(e)))}let s=new z(i,{operation:t,...e}),a=ct.getInstance(i,!1,n.namespace);return a?a.emit(s,o):o(s)}function ee(i){return i===1/0||Array.isArray(i)}function nt(i,t=!0,e=!0){if((!i||!j(i))&&t)throw new Error(`Object must be of type object or array! "${Mt(i)}" given.`);return i instanceof z&&(i.type==="def"&&e?i=typeof i.value.get=="function"?i.value.get():i.value.value:i=i.value),i&&Yt(i)}function ki(i,t,e,r={}){return t===1/0?r.level&&!j(i)?e([]):e(Object.entries(Object.getOwnPropertyDescriptors(i)).filter(([,n])=>n.writable!==!1&&!n.get&&!n.set).map(([n])=>n)):e(F(t,!1))}var ji={...Xe,...De},C=ji;var vt=class{constructor(t){Object.defineProperty(this,Symbol.toStringTag,{value:"LiveProgramHandle"}),Object.defineProperty(this,"runtime",{value:t});let e={statechange:()=>{C.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})}abort(){return this.runtime.abort(!0)}};var Je=(i,...t)=>{let e=t.pop();if(i.constructor.name==="AsyncFunction")return G(i.call(...t),e);try{return e(i.call(...t))}catch(r){return e(void 0,r)}},G=(i,t)=>i instanceof Promise?i.then(t).catch(e=>t(void 0,e)):t(i),Qe=i=>typeof i=="object"&&i||typeof i=="function";function qr(i){let t=typeof i[i.length-1]=="object"?i.pop():{};return{source:i.pop()||"",args:i,params:t}}var kr={};function jr(i,t=!1){return t?/^(["'])use live\1\s*(;|$)/.test(i):/(["'])use live\1\s*(;|$)/.test(i)}function Rr(i,t=0,e=null){let r=t,n=i.length,o=()=>{for(;r<n&&/\s/.test(i[r]);)r++},s=()=>{for(r+=2;r<n&&i[r]!==`
|
|
2
|
-
`&&i[r]!=="\r";)r++},a=()=>{for(r+=2;r<n&&!(i[r]==="*"&&i[r+1]==="/");)r++;r<n&&(r+=2)};for(;r<n;){if(o(),i[r]==="/"&&i[r+1]==="/"){s();continue}if(i[r]==="/"&&i[r+1]==="*"){a();continue}break}if(e===0)return i.slice(r);let c=r;if(r<n&&/[A-Za-z$_]/.test(i[r])){for(r++;r<n&&/[A-Za-z0-9$_]/.test(i[r]);)r++;return i.slice(c,r)}return e===1&&r<n?i[r]:null}function Rt(...i){let t,e={runtimeParams:Ni,transformerParams:Di,parserParams:Ri};for(;t=i.shift();){let{runtimeParams:r={},transformerParams:{globalsNoObserve:n=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:a={}}=t;e={runtimeParams:{...e.runtimeParams,...r},transformerParams:{...e.transformerParams,globalsNoObserve:[...e.transformerParams.globalsNoObserve,...n],globalsOnlyPathsExcept:[...e.transformerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...e.parserParams,...a}},i.devMode}return e}var Ri={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},Di={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Ni={apiVersion:3};var Dt={throwStmt(i){return{type:"ThrowStatement",argument:i}},tryStmt(i,t,e,r){return{type:"TryStatement",block:i,handler:t,finalizer:e,guardedHandlers:r}},catchClause(i,t){return{type:"CatchClause",param:i,body:t}},exprStmt(i){return{type:"ExpressionStatement",expression:i}},blockStmt(i){return{type:"BlockStatement",body:i}},labeledStmt(i,t){return{type:"LabeledStatement",label:i,body:t}},withStmt(i,t){return{type:"WithStatement",object:i,body:t}},ifStmt(i,t,e){return this.conditionalExpr(i,t,e,"IfStatement")},switchStmt(i,t,e=!1){return{type:"SwitchStatement",discriminant:i,cases:t}},switchCase(i,t){return{type:"SwitchCase",test:i,consequent:t}},whileStmt(i,t){return{type:"WhileStatement",test:i,body:t}},doWhileStmt(i,t){return{type:"DoWhileStatement",test:i,body:t}},forStmt(i,t,e,r){return{type:"ForStatement",init:i,test:t,update:e,body:r}},forInStmt(i,t,e){return{type:"ForInStatement",left:i,right:t,body:e}},forOfStmt(i,t,e){return{type:"ForOfStatement",left:i,right:t,body:e}},breakStmt(i=null){return{type:"BreakStatement",label:i}},continueStmt(i=null){return{type:"ContinueStatement",label:i}},returnStmt(i){return{type:"ReturnStatement",argument:i}},yieldExpr(i,t=!1){return{type:"YieldExpression",argument:i,delegate:t}},awaitExpr(i){return{type:"AwaitExpression",argument:i}},varDeclaration(i,t){return{type:"VariableDeclaration",kind:i,declarations:t}},varDeclarator(i,t=null){return{type:"VariableDeclarator",id:i,init:t}},funcDeclaration(i,t,e,r=!1,n=!1,o=!1){return this.func("FunctionDeclaration",...arguments)},sequenceExpr(i){return{type:"SequenceExpression",expressions:i}},parensExpr(i){return{type:"ParenthesizedExpression",expression:i}},logicalExpr(i,t,e){return{type:"LogicalExpression",operator:i,left:t,right:e}},binaryExpr(i,t,e){return{type:"BinaryExpression",operator:i,left:t,right:e}},unaryExpr(i,t,e=!0){return{type:"UnaryExpression",operator:i,argument:t,prefix:e}},updateExpr(i,t,e=!1){return{type:"UpdateExpression",operator:i,argument:t,prefix:e}},assignmentExpr(i,t,e="="){return{type:"AssignmentExpression",operator:e,left:i,right:t}},assignmentPattern(i,t){return{type:"AssignmentPattern",left:i,right:t}},thisExpr(){return{type:"ThisExpression"}},conditionalExpr(i,t,e,r="ConditionalExpression"){return{type:r,test:i,consequent:t,alternate:e}},arrayExpr(i){return{type:"ArrayExpression",elements:i}},arrayPattern(i){return{type:"ArrayPattern",elements:i}},objectExpr(i){return{type:"ObjectExpression",properties:i}},objectPattern(i){return{type:"ObjectPattern",properties:i}},chainExpr(i){return{type:"ChainExpression",expression:i}},callExpr(i,t,e=!1){return{type:"CallExpression",callee:i,arguments:t,optional:e}},newExpr(i,t){return{type:"NewExpression",callee:i,arguments:t}},taggedTemplateExpr(i,t){return{type:"TaggedTemplateExpression",tag:i,quasi:t}},memberExpr(i,t,e=!1,r=!1){return{type:"MemberExpression",object:i,property:t,computed:e,optional:r}},funcExpr(i,t,e,r=!1,n=!1,o=!1){return this.func("FunctionExpression",...arguments)},arrowFuncExpr(i,t,e,r=!1,n=!1,o=!1){return this.func("ArrowFunctionExpression",...arguments)},func(i,t,e,r,n=!1,o=!1,s=!1){return{type:i,id:t,params:e,body:r,async:n,expression:o,generator:s}},identifier(i){return{type:"Identifier",name:i}},property(i,t,e="init",r=!1,n=!1,o=!1){return{type:"Property",key:i,value:t,kind:e,shorthand:r,computed:n,method:o}},classDeclaration(i,t,e=null){return this.class("ClassDeclaration",...arguments)},classExpression(i,t,e=null){return this.class("ClassExpression",...arguments)},class(i,t,e,r=null){return{type:i,id:t,body:e,superClass:r}},methodDefinition(i,t,e="method",r=!1,n=!1){return{type:"MethodDefinition",key:i,value:t,kind:e,static:r,computed:n}},propertyDefinition(i,t,e=!1,r=!1){return{type:"PropertyDefinition",key:i,value:t,static:e,computed:r}},spreadElement(i){return{type:"SpreadElement",argument:i}},literal(i){if(typeof i=="object"&&!("name"in i)&&!("value"in i))throw new Error('Objects that convert to literals must have a "name" or "value" property.');return typeof i=="object"?{type:"Literal",get value(){return"name"in i?i.name:i.value}}:{type:"Literal",value:i}},templateLiteral(i,t){return{type:"TemplateLiteral",quasis:i,expressions:t}},comments(i){let t={};return Object.defineProperty(t,"toString",{value:()=>i}),Object.defineProperty(t,"trim",{value:function(){return this.toString()}}),[{type:"Line",value:t}]},withLoc(i,...t){return["start","end"].forEach(e=>{let r=e==="start"?t[0]:t[t.length-1];i[e]=r[e],r.loc&&(i.loc=i.loc||{},i.loc[e]=r.loc?.[e])}),i},invert(i){return this.unaryExpr("!",i)},clone(i){return i={...i},delete i.start,delete i.end,i}};var re=Object.create(null);var St=class extends EventTarget{managedAlways=new Set;managedOnce=new Set;constructor(){super(),kr.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 Ot=class extends St{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 Ot(this,e,e==="object"?t:Qe(this.state)?C.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||!Qe(this.state))&&(this.mutationsWatch=C.observe(this.state,e=>{let r={map:new Map,add(o,s,a){for(let c of o)c.runtime.thread.includes(c),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),s.refresh(o.value))}let n=r.map.size?[...r.map].sort((o,s)=>o[0].$serial>s[0].$serial?1:-1):r.map;for(let[o,s]of n)o.state!=="aborted"&&o.schedule(...s)},{recursions:"force-sync"}))}refresh(t){this.state=t;for(let[e,r]of this.signals)r.refresh(C.get(this.state??{},e));this.watchMode()}};var K=class extends Ot{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var ot=class extends St{state;constructor(t,e,r,n,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=n,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((n,o,s)=>n&&o<=r.path[s],!0)&&e||r}beforeExecute(){this.state="running";let t=this.flowControl;return this.flowControl=new Map,t}execute(t=null){return this.runtime.thread.unshift(this),G(this.beforeExecute(),e=>Je(this.closure,this,this,(r,n)=>n?this.throw(n,[this.serial,this.context?.serial],n.code):(this.spec.complete&&(r=this.spec.complete(r,this)),this.afterExecute(e),this.runtime.thread.shift(),t?t(r,this):r)))}throw(t,e,r){if(this.type==="function"&&["HandlerFunction","FinalizerFunction"].includes(this.$params.executionMode))return this.$params.lexicalContext.throw(t,e,r);if(this.spec.handler)return this.spec.handler(t);if(this.type!=="function"&&this.context)return this.context.throw(t,e,r);if(t.cause)throw t;let n=`${t.message||t}`,o=r!==null?`[${r}]: ${n}`:n,s=e.map(u=>u!==-1&&this.extractSource(u,!0)).filter(u=>u);s.push({source:this.runtime.$params.originalSource});let a=globalThis[t.name],c=new(a||Error)(o,{cause:s}),l=this.runtime.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw l&&(c.fileName=l),r&&(c.code=r),c}afterExecute(t){this.state="complete";let e=this.flowControl;this.spec.finalizer&&this.spec.finalizer(),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 n=Array.isArray(e)?"array":e===null?"null":typeof e;if(n===t||t==="iterable"&&e?.[Symbol.iterator]||t==="desctructurable"&&!["undefined","null"].includes(n))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,n={}){return this.var(t,e,r,{...n,kind:"let"})}const(t,e,r,n={}){return this.var(t,e,r,{...n,kind:"const"})}var(t,e,r,n={}){n={kind:"var",...n},r||(r=()=>{});let o=n.restOf?(...a)=>{try{return r(...a)}catch(c){throw new Error(`Cannot declare ${t}; ${c.message}`)}}:r,s=(a,c)=>{let l=c.scope;if(n.kind==="var")for(;!["module","function"].includes(l.type)&&!C.has(l.state,t)&&l.context;)l=l.context;else l.type==="this"&&l.context&&(l=l.context);let u=l.symbols.get(t);if(u&&(u.kind!==n.kind||n.kind==="let"&&u.serial!==e))throw new Error(`Identifier "${t}" has already been declared.`);u?.reader?.abort(),u={serial:e,kind:n.kind};let p=a;return n.restOf&&(n.type==="array"?p=[]:p={},u.reader=C.map(a,p,{except:n.restOf,spread:n.type==="array"}),c.once(u.reader)),l.symbols.set(t,u),C.set(l.state,t,p),p};return this.autorun(n.kind,{complete:s,...n},e,o)}update(t,e,r={}){let n=this.scope;for(;n&&!C.has(n.state,t);)n=n.context;if(!n)throw new ReferenceError(`${t} is not defined.`);let o=n.symbols.get(t);if(o?.kind==="const")throw new ReferenceError(`Assignment to constant variable "${t}".`);let s=C.get(n.state,t),a=r.restOf?(...c)=>{try{return e(...c)}catch(l){throw new Error(`Cannot update ${t}; ${l.message}`)}}:e;return Je(a,void 0,s,(c,l)=>{if(l)return this.throw(l,[this.serial]);o?.reader?.abort();let u=c;r.restOf&&(o=o||{},r.type==="array"?u=[]:u={},o.reader=C.map(c,u,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader));let p=this.spec.static||this.type==="function"&&this.$params?.executionMode==="RegularFunction";return C.set(n.state,t,u),["postinc","postdec"].includes(r.kind)?s:u})}ref(t,...e){let r=0,n={};typeof e[0]=="number"?(r=e.shift(),n=e.shift()||{}):typeof e[0]=="object"&&(n=e.shift());let o=this.scope;for(;o&&!C.has(o.state,t);)o=o.context;if(!o){if(n.isTypeCheck)return;throw new Error(`${t} is not defined.`)}let s=o.symbols.get(t)?.kind,a=o.signal(t,s);return n.typed&&this.typed(n.typed,a.state,t),this.autobind(a,r,n)}obj(t,...e){let r=0,n={};return typeof e[0]=="number"?(r=e.shift(),n=e.shift()||{}):typeof e[0]=="object"&&(n=e.shift()),this.autobind(this.runtime.$objects.signal(t,"object"),r,n)}autobind(t,e,r){let n=["LiveProgram","LiveFunction"].includes(this.runtime.$params.executionMode),o=t.type==="const",s=this===this.runtime,a=this.state==="aborted",c=this.spec.static,l=this.spec.isWrite,u=this;return function p(f,d={},m){if(n&&!c&&!l&&!r?.isLeft&&!o&&!s&&!a&&f.subscribe(u),!m||!f.state||typeof f.state!="object"){let v=f.state;return typeof f.state=="function"&&!/^class\s?/.test(Function.prototype.toString.call(f.state))&&(v=C.proxy(f.state,{...d,membrane:f})),v}let w;return C.proxy(f.state,d,v=>({...v,get(g,y,x=null){if(w)return v.get(g,y,x);w=!0;let S={...d};return Array.isArray(g)&&(S.arrayMethodName=y),p(f.signal(y),S,m-1)}}))}(t,{},e)}autorun(t,...e){let r=e.pop(),n=e.pop(),o=e.pop()||{},s=ot,a=this.scope;if(t==="iteration"){let l=this.runtime.constructor;s=r.constructor.name==="AsyncFunction"?l.AutoAsyncIterator:l.AutoIterator}["block","switch","iteration"].includes(t)&&(a=new K(a,t));let c=new s(this,t,o,n,a,r);if(t==="downstream"){if(this.downstream=c,this.flowControlApplied())return}else if(this.type==="switch"&&this.breakpoint)return;return c.execute()}function(t,e,r,n){if(e==="Declaration"){let s=this.scope.type==="this"?this.scope.context:this.scope;C.set(s.state,n.name,n)}let o=this;return Object.defineProperty(n,"toString",{value:function(s=!1){if(s&&t==="LiveFunction")return Function.prototype.toString.call(n);let a=o.runtime.extractSource(r);return a.startsWith("static ")?a.replace("static ",""):a}}),n}class(t,e,r){if(t==="Declaration"){let n=this.scope.type==="this"?this.scope.context:this.scope;C.set(this.scope.state,e.name,e)}return r.forEach(({name:n,isLiveFunction:o,static:s,serial:a})=>{this.function(o&&"LiveFunction"||"RegularFunction","Expression",a,s?e[n]:e.prototype[n])}),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 n=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,n);return}if(this.context?.type==="switch"&&t==="break"&&!e){r||(this.flowControl.get(t).endpoint=!0),this.context.breakpoint=this;return}this.state!=="running"&&(this.handleDownstream(this.flowControl.size,n),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;!["block"].includes(this.type)||!(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,n=new Set;for(;r=r.nextRound;)t?r.abort():e&&r.state!=="inert"&&(r.state="resuming",n.add(r));n.size&&this.runtime.schedule(...n),!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 $t=class extends ot{rounds=new Map;constructor(t,e,r,n,o,s){r.$closure=s,super(t,e,r,n,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},n=["for-in","for-of"].includes(this.spec.kind)?{[this.production]:t}:{...this.scope.state},o=new K(this.scope,"round",n);this.scope.symbols.forEach((c,l)=>{o.symbols.set(l,c)});let s=new ot(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(){if(this.spec.static)return;let t=(e,r)=>{let n=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,c=this.spec.kind==="for-in"?s.key:parseInt(s.key),l=this.rounds.get(c);if(l)C.set(l.scope.state,this.production,a),s.type==="delete"&&(this.rounds.set(c,void 0),l.prevRound&&(l.prevRound.nextRound=l.nextRound),l.nextRound&&(l.nextRound.prevRound=l.prevRound),n.add(l));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",()=>{n.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(C.observe(this.iteratee,e=>{G(this.cursor,r=>t(e,r))}))}};var ie=class extends $t{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 Et=class extends ot{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,n,o){let{$serial:s=0,spec:a,...c}=r;super(t,e,a,-1,n,o),this.$serial=s,this.$params=c,this.$objects=new K(void 0,"objects"),this.manage(this.$objects),this.exports=Object.create(null),this.$promises={imports:[],exports:[]},this.manage(()=>{C.deleteProperties(this.exports,Object.keys(this.exports)),this.$promises.imports.splice(0),this.$promises.exports.splice(0)})}extractSource(t,e=!1){let[[r,n,o],[s]]=this.locations[t],a=this.$params.originalSource.slice(r,s);return e?{expr:a,line:n,column:o}:a}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(n,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"),n)}.call(this,void 0,this.nowRunning)}execute(t=null){return super.execute(e=>{let r=["LiveProgram","LiveFunction"].includes(this.$params.executionMode),n=this.$params.sourceType==="module"||this.$params.sourceType==="script",o=r||this.$params.executionMode==="RegularProgram"&&n?new vt(this):this.flowControl.get("return")?.arg;return t?t(o,this):o})}spawn(t,e,r,n=null){let o=this.nowRunning||n||this,s={...this.$params,$serial:this.$serial+1,executionMode:t,lexicalContext:n},a=new K(o.scope,"function",e?{this:e}:{});return new this.constructor(o,"function",s,a,r).execute()}async import(...t){let e=t.pop(),r=typeof e=="string"?{source:e}:e,n=s=>{if(r.forExport||r.isDynamic)return s;this.assignModules(t,this.scope.state,s,e.serial)};if(this.$params.experimentalFeatures!==!1&&re[r.source])return n(re[r.source]);let o=(async()=>{let s=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;try{return n({...await import(r.source)})}catch(a){a.code==="ERR_MODULE_NOT_FOUND"?this.throw(new Error(`Cannot find module "${r.source}"${s?` imported at "${s}"`:""}.`),[r.serial],a.code):this.throw(a,[r.serial],a.code)}})();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.type==="this"?this.scope.context.state:this.scope.state;this.assignModules(t,this.exports,r,e?.serial)}assignModules(t,e,r,n=null){let o=[],s=["LiveProgram","LiveFunction"].includes(this.$params.executionMode);for(let[a,c,l,u]of t){if(a===null){(s?C:Reflect).set(e,l,u);continue}if(a==="*"&&l){(s?C:Reflect).set(e,l,r);continue}C.has(r,a)||this.throw(new Error(`The requested module does not provide an export named "${a}".`),[c,n]),(s?C:Reflect).set(e,l||a,C.get(r,a)),o.push([a,c,l])}!o.length||!s||this.once(C.observe(r,a=>{for(let[c,,l]of o)for(let u of a)c==="*"?C.set(e,u.key,u.value):u.key===c&&C.set(e,l||c,u.value)}))}afterExecute(...t){return this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace&&(re[this.$params.exportNamespace]=this.exports,this.once(()=>{delete re[this.$params.exportNamespace]})),super.afterExecute(...t)}};V(Et,"AutoAsyncIterator",ie),V(Et,"AutoIterator",$t);function me(i,t,e,r=[],n={}){typeof r=="object"&&r&&!Array.isArray(r)&&(n=r,r=[]);let{liveMode:o=!0,thisContext:s,env:a,exportNamespace:c,fileName:l,base64:u,compileFunction:p,forDynamicBinding:f=!1,...d}=n,{parserParams:m,transformerParams:w,runtimeParams:v}=Rt(d),g=/module/.test(i),y=/script/.test(i),x=/function/.test(i),S=/async/.test(i)||/module/.test(i),h=/source/.test(i),b=/file/.test(i),_=typeof e=="object"&&e?.type==="Program";_||(e=e+"");let O=e;if(g)m.sourceType="module",m.allowAwaitOutsideFunction=!0,m.executionMode=o?"LiveProgram":"RegularProgram";else if(y)m.executionMode=o?"LiveProgram":"RegularProgram";else if(x){if(h)if(_)e=Dt.funcExpr(null,r.map(I=>Dt.identifier(I)),Dt.blockStmt(o?[Dt.literal("use live"),...e.body]:e.body),S),e.isLiveFunction=O.isLiveProgram;else{let I=" "+e.split(`
|
|
1
|
+
var Sr=Object.defineProperty;var fi=(i,t,e)=>t in i?Sr(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var Pe=(i,t)=>{for(var e in t)Sr(i,e,{get:t[e],enumerable:!0})};var V=(i,t,e)=>(fi(i,typeof t!="symbol"?t+"":t,e),e),Or=(i,t,e)=>{if(!t.has(i))throw TypeError("Cannot "+e)};var U=(i,t,e)=>(Or(i,t,"read from private field"),e?e.call(i):t.get(i)),Ut=(i,t,e)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,e)},It=(i,t,e,r)=>(Or(i,t,"write to private field"),r?r.call(i,e):t.set(i,e),e);var Ke={};Pe(Ke,{AsyncLiveFunction:()=>Fi,AsyncLiveScript:()=>ne,LiveFunction:()=>Hi,LiveModule:()=>oe,LiveProgramHandle:()=>vt,LiveScript:()=>Wi,Observer:()=>C,compile:()=>Dr,matchPrologDirective:()=>jr,nextKeyword:()=>Rr,parse:()=>ge,serialize:()=>be,transform:()=>ye});var Xe={};Pe(Xe,{any:()=>Pi,apply:()=>We,batch:()=>Ge,construct:()=>Fe,defineProperties:()=>Mi,defineProperty:()=>Zt,deleteProperties:()=>qi,deleteProperty:()=>Kt,get:()=>ut,getOwnPropertyDescriptor:()=>de,getOwnPropertyDescriptors:()=>Ci,getPrototypeOf:()=>Ne,has:()=>he,intercept:()=>Ti,isExtensible:()=>Le,map:()=>Ii,observe:()=>Ve,ownKeys:()=>He,path:()=>Ei,preventExtensions:()=>Be,reduce:()=>Ue,set:()=>xt,setPrototypeOf:()=>ze,subtree:()=>Ai});function q(i){return!Array.isArray(i)&&typeof i=="object"&&i}function Mt(i){return typeof i}function M(i){return Array.isArray(i)}function qt(i){return typeof i=="function"}function Vt(i){return i===null||i===""}function at(i){return arguments.length&&(i===void 0||typeof i>"u")}function j(i){return Array.isArray(i)||typeof i=="object"&&i||qt(i)}function Te(i){return Vt(i)||at(i)||i===!1||i===0||j(i)&&!Object.keys(i).length}function k(i){return qt(i)||i&&{}.toString.call(i)==="[object function]"}function Gt(i){return i instanceof Number||typeof i=="number"}function Z(i){return Gt(i)||i!==!0&&i!==!1&&i!==null&&i!==""&&!isNaN(i*1)}function kt(i){return i instanceof String||typeof i=="string"&&i!==null}function Ce(i){return!kt(i)&&!at(i.length)}function ue(i,...t){return t.forEach(e=>{i.indexOf(e)<0&&i.push(e)}),i}function Ie(r,t){t=t||Object.prototype,t=t&&!M(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 Me(i,t){var e=[];return Ie(i,t).forEach(r=>{ue(e,...Object.getOwnPropertyNames(r))}),e}function it(i,t,e=!1,r=!1,n=!1){var o=0,s=i.shift();if((Z(s)||s===!0||s===!1)&&(o=s,s=i.shift()),!i.length)throw new Error("_merge() requires two or more array/objects.");return i.forEach((a,c)=>{!j(a)&&!k(a)||(e?Me(a):Object.keys(a)).forEach(l=>{if(!!t(l,s,a,c)){var u=s[l],p=a[l];if((M(u)&&M(p)||q(u)&&q(p))&&(o===!0||o>0))s[l]=M(u)&&M(p)?[]:{},it([Z(o)?o-1:o,s[l],u,p],t,e,r,n);else if(M(s)&&M(a))r?s[l]=p:s.push(p);else try{n?Object.defineProperty(s,l,Object.getOwnPropertyDescriptor(a,l)):s[l]=a[l]}catch{}}})}),s}function Xt(...i){return it(i,(t,e,r)=>!0,!1,!1,!1)}function W(i,...t){if(!i||!["object","function"].includes(typeof i))throw new Error("Argument #1 must be of type object");let e=i[Symbol.for("wq")];if(e||(e=new fe,Object.defineProperty(i,Symbol.for("wq"),{value:e,enumerable:!1,configurable:!1,writable:!1})),!t.length)return e;let r,n;for(;r=t.shift();)(n=e)&&!(e=e.get(r))&&(e=new fe,n.set(r,e));return e}var fe=class extends Map{};function F(i,t=!0){return M(i)?i:!t&&q(i)?[i]:i!==!1&&i!==0&&Te(i)?[]:Ce(i)?Array.prototype.slice.call(i):q(i)?Object.values(i):[i]}var L=(i,...t)=>W(i,"observerAPI",...t),jt=(i,t)=>i instanceof Promise?i.then(t):t(i),pe={};var bt=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 Jt=class extends bt{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),pe.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=F(r,!1))&&(e=t.filter(o=>r.includes(o.key))),this.params.diff&&(e=e.filter(o=>o.type!=="set"||o.value!==o.oldValue)),!e.length)return;if(["inject","defer"].includes(this.params.recursions)){if(this.emit.recursionTarget){this.emit.recursionTarget.push(...e);return}this.emit.recursionTarget=this.params.recursions==="inject"?e:[]}let n=this.filter===1/0||Array.isArray(this.filter)?this.emit(e,this):this.emit(e[0],this);return jt(n,o=>{let s=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="defer"&&s?.length?this.emit.currentRegistration.fire(s):o})}};var wt=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,n=this.__namespace){if(!j(e))throw new Error(`Subject must be of type object; "${Mt(e)}" given!`);let o=this;return n&&L(globalThis,"observerAPI","namespaces").has(t+"-"+n)&&(o=L(globalThis,"observerAPI","namespaces").get(t+"-"+n),t+="-"+n),!L(e,"registry").has(t)&&r&&L(e,"registry").set(t,new o(e)),L(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return L(globalThis,"observerAPI","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}.`);L(globalThis,"observerAPI","namespaces").set(t,r),r.__namespace=e}};var z=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 lt=class extends wt{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 Jt(this,{filter:t,emit:e,params:r}))}emit(t,{eventsArePropertyDescriptors:e=!1,eventIsArrayMethodDescriptor:r=!1}={}){if(this.batches.length){let n=this.batches[0].params.arrayMethodName;this.batches[0].snapshots.push({events:[...t],arrayMethodName:n,eventsArePropertyDescriptors:e,eventIsArrayMethodDescriptor:r});return}this.$emit(this.entries,[{events:t,eventsArePropertyDescriptors:e,eventIsArrayMethodDescriptor:r}])}$emit(t,e){let r=0,n=0,o=0;for(let u of t)r+=1,u.params.withPropertyDescriptors&&(n+=1),u.params.withArrayMethodDescriptors&&(o+=1);let s=[],a=[],c=[],l=[];for(let u of e){let p=u.arrayMethodName,f=u.eventsArePropertyDescriptors,d=u.eventIsArrayMethodDescriptor;for(let m of u.events)if(p&&(m.operation=p),n&&(o&&s.push(m),d||o!==r&&a.push(m)),n!==r){let w=m;if(f){let{target:v,type:g,...y}=m;w=new z(v,{type:"set",...y}),Object.defineProperty(w,"value","get"in y.value?{get:()=>y.value.get()}:{value:y.value.value}),y.oldValue&&Object.defineProperty(w,"oldValue","get"in y.oldValue?{get:()=>y.oldValue.get()}:{value:y.oldValue.value})}o&&c.push(w),d||o!==r&&l.push(w)}}for(let u of t)u.params.withPropertyDescriptors?u.params.withArrayMethodDescriptors?s.length&&u.fire(s):a.length&&u.fire(a):u.params.withArrayMethodDescriptors?c.length&&u.fire(c):l.length&&u.fire(l)}batch(t,e={}){this.batches.unshift({entries:[...this.entries],snapshots:[],params:e});let r=t();return jt(r,n=>{let o=this.batches.shift();return o.snapshots.length&&this.$emit(o.entries,o.snapshots),n})}};var Qt=class extends bt{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,(...n)=>(this.running=!1,e(...n))))}};var ct=class extends wt{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 Qt(this,t))}emit(t,e=null){let r=this;return function n(o,...s){let a=r.entries[o];return a?a.exec(t,(...c)=>n(o+1,...c),...s):e?e(t,...s):s[0]}(0)}};var De={};Pe(De,{accessorize:()=>Oi,proxy:()=>je,unaccessorize:()=>$i,unproxy:()=>Yt});var Ir=Symbol("wqOriginal");function Oi(i,t,e={}){i=Re(i);let r=L(i,"accessorizedProps");function n(c){let l,u=i;do l=Object.getOwnPropertyDescriptor(u,c);while(!l&&(u=Object.getPrototypeOf(u)));return l?{proto:u,descriptor:l}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(c){if(r.has(c+""))return!0;let l=n(c);l.getValue=function(f=!1){return f?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},l.setValue=function(f,d=!1){if(this.dirty=!0,d){this.descriptor=f;return}return this.descriptor.set?this.descriptor.set(f)!==!1:(this.descriptor.value=f,!0)},l.intact=function(){let f=Object.getOwnPropertyDescriptor(i,c);return f?.get===p.get&&f?.set===p.set&&r.get(c+"")===this},l.restore=function(){return this.intact()?(this.proto&&this.proto!==i||!this.proto&&!this.dirty?delete i[c]:Object.defineProperty(i,c,this.descriptor),r.delete(c+""),!0):!1},r.set(isNaN(c)?c:parseInt(c),l);let{enumerable:u=!0}=l.descriptor,p={enumerable:u,configurable:!0};("value"in l.descriptor||l.descriptor.set)&&(p.set=function(f){return xt(this,c,f,e)}),("value"in l.descriptor||l.descriptor.get)&&(p.get=function(){return ut(this,c,e)});try{return Object.defineProperty(i,c,p),!0}catch{return r.delete(c+""),!1}}let a=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(o);return t===void 0||Array.isArray(t)?a:a[0]}function $i(i,t,e={}){i=Re(i);let r=L(i,"accessorizedProps");function n(a){return r.has(a+"")?r.get(a+"").restore():!0}let s=(Array.isArray(t)?t:t===void 0?Object.keys(i):[t]).map(n);return t===void 0||Array.isArray(t)?s:s[0]}function je(i,t={},e=void 0){let r=Re(i);if(typeof t.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(t.membrane&&L(r,"membraneRef").has(t.membrane))return L(r,"membraneRef").get(t.membrane);let n={apply:(a,c,l)=>We(a,c,l,void 0,t),construct:(a,c,l=null)=>Fe(a,c,l,t),defineProperty:(a,c,l)=>Zt(a,c,l,t),deleteProperty:(a,c)=>Kt(a,c,t),get:(a,c,l=null)=>{if(c===Ir)return r;let u={...t,receiver:l},p=ut(a,c,u);return Array.isArray(a)&&typeof p=="function"&&!/^class\s?/.test(Function.prototype.toString.call(p))?je(p,{...t,arrayMethodName:c,membrane:l},e):t.chainable&&j(p)&&c!=="prototype"&&!(typeof p=="function"&&/^class\s?|\{\s\[native\scode\]\s\}$/.test(Function.prototype.toString.call(p)))?je(p,t,e):p},getOwnPropertyDescriptor:(a,c)=>de(a,c,t),getPrototypeOf:a=>Ne(a,t),has:(a,c)=>he(a,c,t),isExtensible:a=>Le(a,t),ownKeys:a=>He(a,t),preventExtensions:a=>Be(a,t),set:(a,c,l,u=null)=>xt(a,c,l,{...t,receiver:u}),setPrototypeOf:(a,c)=>ze(a,c,t)},o=e?.(n)||n,s=new Proxy(r,o);return t.membrane&&L(r,"membraneRef").set(t.membrane,s),s}function Yt(i){return i&&i[Ir]||i}function Re(i){if(!i||!j(i))throw new Error("Target must be of type object!");return Yt(i)}var te=class extends Array{};function Ei(...i){return new te(...i)}var _t=class extends Array{};function Ai(){return new _t}function Pi(){return 1/0}function Ue(i,t,e,r=o=>o,n={}){let o=t instanceof _t;if(!(!o&&!t?.length))return function s(a,c,l,u){let p=u||c[l.level]instanceof _t,f=p?1/0:c[l.level],d=p?!1:l.level===c.length-1;return a instanceof z&&a.operation!=="get"?l={...l,probe:"always"}:l.probe!=="always"&&(l={...l,probe:!d}),e(a,f,(m,...w)=>{let v=x=>{x instanceof z&&(x.path="key"in x?[x.key]:[],a instanceof z&&(x.path="key"in x?a.path.concat(x.key):a.path.slice(0),Object.defineProperty(x,"context",{get:()=>a,configurable:!0})))},g=w[0]||{},y=x=>{if(x instanceof z&&"argumentsList"in x)return;let S=nt(x,!1);return jt(S,h=>(x instanceof z?x.value=h:x=h,s(x,c,{...l,...g,keyInParent:x.key,level:l.level+1},p)))};if(ee(f)&&Array.isArray(m)){if(m.forEach(v),d)return r(m,...w);p&&m[0]instanceof z&&(m[0].operation!=="get"||n.asGet)&&r(m,...w);for(let x of m)y(x);return}return v(m),d?r(m,...w):y(m)},l)}(i,t.slice(0),{...n,level:0},o)}function Ve(i,t,e,r={}){let n=nt(i,!r.level);if(k(arguments[1])&&([,e,r={}]=arguments,t=1/0),!k(e))throw new Error(`Handler must be a function; "${Mt(e)}" given!`);if(t instanceof te||t instanceof _t)return Ue(n,t,Ve,e,r);if(r={...r,descripted:!0},delete r.live,!j(n))return r.probe&&ut(n,t,e,r)||void 0;let o=Mr(n,t,e,r);return r.probe?ut(n,t,o,r):o()}function Ti(i,t,e={}){let r=nt(i);return q(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),ct.getInstance(r,!0,e.namespace).addRegistration({traps:t,params:e})}function de(i,t,e=n=>n,r={}){return rt(i,"getOwnPropertyDescriptor",{key:t},e,r)}function Ci(i,t,e=n=>n,r={}){return rt(i,"getOwnPropertyDescriptors",{key:t},e,r)}function Ne(i,t=r=>r,e={}){return rt(i,"getPrototypeOf",{},t,e)}function Le(i,t=r=>r,e={}){return rt(i,"isExtensible",{},t,e)}function He(i,t=r=>r,e={}){return rt(i,"ownKeys",{},t,e)}function he(i,t,e=n=>n,r={}){return rt(i,"has",{key:t},e,r)}function ut(i,t,e=n=>n,r={}){let n,o=nt(i,!r.level);return q(e)?[r,e]=[e,s=>s]:r.live&&(n=!0),t instanceof te||t instanceof _t?Ue(o,t,ut,e,{...r,asGet:!0}):ki(o,t,s=>{let a=[...s];return function c(l,u,p){if(!u.length)return p(l);let f=u.shift();if(!["string","number","symbol"].includes(typeof f))throw new Error(`Property name/key ${f} invalid.`);function d(v,g=void 0){let y=h=>(v.value=h,c([...l,r.live||r.descripted?v:h],u,p));if(arguments.length>1)return y(g);if(!j(o))return y(o?.[v.key]);let x=L(o,"accessorizedProps",!1),S=x&&x.get(v.key);if(S&&S.intact())return y(S.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let h=Object.getOwnPropertyDescriptor(o,v.key);return y(h)}return y(Reflect.get(o,v.key))}let m=new z(o,{type:"get",key:f,value:void 0,operation:"get",related:a});if(!j(o))return d(m);let w=ct.getInstance(o,!1,r.namespace);return w?w.emit(m,d):d(m)}([],s.slice(0),c=>{let l=ee(t)?c:c[0];return n&&j(o)?Mr(o,t,e,r,i.key)(l):e(l)})},r)}function Ge(i,t,e={}){let r=nt(i);return lt.getInstance(r,!0,e.namespace).batch(t,e)}function Ii(i,t,e={}){t=nt(t),i=nt(i);let r=(e.only||[]).slice(0),n=(e.except||[]).slice(0),o=Object.keys(e.spread?[...i]:i).map(l=>isNaN(l)?l:parseInt(l)),s=r.length?r.filter(l=>o.includes(l)):o.filter(l=>!n.includes(l)),a=l=>!Array.isArray(t)||isNaN(l)?l:l-n.filter(u=>u<l).length,c=l=>{let u=de(i,l,e);"value"in u&&u.writable&&u.enumerable&&u.configurable?xt(t,a(l),u.value,e):(u.enumerable||e.onlyEnumerable===!1)&&Zt(t,l,{...u,configurable:!0},e)};return Ge(t,()=>{s.forEach(c)}),Ve(i,l=>{l.filter(u=>r.length?r.includes(u.key):!n.includes(u.key)).forEach(u=>{if(u.type==="delete")return Kt(t,a(u.key),e);if(u.type==="def"){(u.value.enumerable||e.onlyEnumerable===!1)&&Zt(t,a(u.key),{...u.value,configurable:!0},e);return}c(u.key)})},{...e,withPropertyDescriptors:!0})}function xt(i,t,e,r=s=>s,n={},o=!1){let s=nt(i),a=[[t,e]];q(t)&&([,,r=l=>l,n={},o=!1]=arguments,a=Object.entries(t)),q(r)&&([o,n,r]=[typeof n=="boolean"?n:o,r,l=>l]);let c=a.map(([l])=>l);return function l(u,p,f){if(!p.length)return f(u);let[d,m]=p.shift();function w(g,y=void 0){let x=b=>(g.status=b,l(u.concat(g),p,f));if(arguments.length>1)return x(g,y);let S=L(s,"accessorizedProps",!1),h=S&&S.get(g.key);return g.type==="def"?(h&&!h.restore()&&x(!1),Object.defineProperty(s,g.key,g.value),x(!0)):h&&h.intact()?x(h.setValue(g.value)):x(Reflect.set(s,g.key,g.value))}function v(g,y){if(n.diff&&m===y)return l(u,p,f);let x=new z(s,{type:o?"def":"set",key:d,value:m,isUpdate:g,oldValue:y,related:[...c],operation:o?"defineProperty":"set",detail:n.detail}),S=ct.getInstance(s,!1,n.namespace);return S?S.emit(x,w):w(x)}return he(s,d,g=>{if(!g)return v(g);if(d==="length"&&Array.isArray(s)&&L(s).has("$length"))return v(!0,L(s).get("$length"));let y={...n,withPropertyDescriptors:o};return ut(s,d,x=>v(g,x),y)},n)}([],a.slice(0),l=>{let u=lt.getInstance(s,!1,n.namespace);return u&&u.emit(l,{eventsArePropertyDescriptors:!!o}),r(ee(t)?l.map(p=>p.status):l[0]?.status)})}function Zt(i,t,e,r=o=>o,n={}){return xt(i,t,e,r,n,!0)}function Mi(i,t,e=n=>n,r={}){return xt(i,t,e,r,!0)}function Kt(i,t,e=n=>n,r={}){let n=nt(i);q(e)&&([r,e]=[e,a=>a]);let o=F(t,!1),s=[...o];return function a(c,l,u){if(!l.length)return u(c);let p=l.shift();function f(m,w=void 0){let v=x=>(m.status=x,a(c.concat(m),l,u));if(arguments.length>1)return v(m,w);let g=L(n,"accessorizedProps",!1),y=g&&g.get(m.key);return y&&!y.restore()&&v(!1),v(Reflect.deleteProperty(n,m.key))}function d(m){let w=new z(n,{type:"delete",key:p,oldValue:m,related:[...s],operation:"deleteProperty",detail:r.detail}),v=ct.getInstance(n,!1,r.namespace);return v?v.emit(w,f):f(w)}return ut(n,p,d,r)}([],o.slice(0),a=>{let c=lt.getInstance(n,!1,r.namespace);return c&&c.emit(a),e(ee(t)?a.map(l=>l.status):a[0].status)})}function qi(i,t,e=n=>n,r={}){return Kt(...arguments)}function Fe(i,t,e=null,r=o=>o,n={}){return rt(i,"construct",arguments.length>2?{argumentsList:t,newTarget:e}:{argumentsList:t},r,n)}function We(i,t,e,r=o=>o,n={}){let o=Yt(t),s;if(Array.isArray(t)){if(n.arrayMethodName){let a=new z(o,{operation:n.arrayMethodName,argumentsList:e});lt.getInstance(o,!1,n.namespace)?.emit([a],{eventIsArrayMethodDescriptor:!0})}L(o).set("$length",o.length),s=Ge(o,()=>rt(i,"apply",{thisArgument:t,argumentsList:e},r,n),n),L(o).delete("$length")}else s=rt(i,"apply",{thisArgument:o,argumentsList:e},r,n);return s}function ze(i,t,e=n=>n,r={}){return rt(i,"setPrototypeOf",{proto:t},e,r)}function Be(i,t=r=>r,e={}){return rt(i,"preventExtensions",{},t,e)}function Mr(i,t,e,r={}){let n=new AbortController;pe.setMaxListeners?.(0,n.signal),r.signal&&r.signal.addEventListener("abort",()=>n.abort());let o={...r,signal:n.signal},s=lt.getInstance(i,!0,o.namespace),a=new Map;return function c(l=[],u=null){let p,f,d;if(ee(t)){if(u){d=!0,f=u;for(let m of l)a.get(m.key)?.remove(),a.delete(m.key)}else f=s.addRegistration(t,c,o);p={signal:f.signal,childRegistrations:a}}else u?.remove(),f=s.addRegistration(t,c,o),p={signal:f.signal};if(o.childRegistrations&&o.keyInParent&&o.childRegistrations.set(o.keyInParent,f),arguments.length){let m=e(l,p);if(arguments.length>1)return m}return n}}function rt(i,t,e={},r=o=>o,n={}){i=nt(i),q(r)&&([n,r]=[r,c=>c]);function o(c,l){return arguments.length>1?r(l):r((Reflect[t]||Object[t])(i,...Object.values(e)))}let s=new z(i,{operation:t,...e}),a=ct.getInstance(i,!1,n.namespace);return a?a.emit(s,o):o(s)}function ee(i){return i===1/0||Array.isArray(i)}function nt(i,t=!0,e=!0){if((!i||!j(i))&&t)throw new Error(`Object must be of type object or array! "${Mt(i)}" given.`);return i instanceof z&&(i.type==="def"&&e?i=typeof i.value.get=="function"?i.value.get():i.value.value:i=i.value),i&&Yt(i)}function ki(i,t,e,r={}){return t===1/0?r.level&&!j(i)?e([]):e(Object.entries(Object.getOwnPropertyDescriptors(i)).filter(([,n])=>n.writable!==!1&&!n.get&&!n.set).map(([n])=>n)):e(F(t,!1))}var C={...Xe,...De};var vt=class{constructor(t){Object.defineProperty(this,Symbol.toStringTag,{value:"LiveProgramHandle"}),Object.defineProperty(this,"runtime",{value:t});let e={statechange:()=>{C.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})}abort(){return this.runtime.abort(!0)}};var Je=(i,...t)=>{let e=t.pop();if(i.constructor.name==="AsyncFunction")return G(i.call(...t),e);try{return e(i.call(...t))}catch(r){return e(void 0,r)}},G=(i,t)=>i instanceof Promise?i.then(t).catch(e=>t(void 0,e)):t(i),Qe=i=>typeof i=="object"&&i||typeof i=="function";function qr(i){let t=typeof i[i.length-1]=="object"?i.pop():{};return{source:i.pop()||"",args:i,params:t}}var kr={};function jr(i,t=!1){return t?/^(["'])use live\1\s*(;|$)/.test(i):/(["'])use live\1\s*(;|$)/.test(i)}function Rr(i,t=0,e=null){let r=t,n=i.length,o=()=>{for(;r<n&&/\s/.test(i[r]);)r++},s=()=>{for(r+=2;r<n&&i[r]!==`
|
|
2
|
+
`&&i[r]!=="\r";)r++},a=()=>{for(r+=2;r<n&&!(i[r]==="*"&&i[r+1]==="/");)r++;r<n&&(r+=2)};for(;r<n;){if(o(),i[r]==="/"&&i[r+1]==="/"){s();continue}if(i[r]==="/"&&i[r+1]==="*"){a();continue}break}if(e===0)return i.slice(r);let c=r;if(r<n&&/[A-Za-z$_]/.test(i[r])){for(r++;r<n&&/[A-Za-z0-9$_]/.test(i[r]);)r++;return i.slice(c,r)}return e===1&&r<n?i[r]:null}function Rt(...i){let t,e={runtimeParams:Di,transformerParams:Ri,parserParams:ji};for(;t=i.shift();){let{runtimeParams:r={},transformerParams:{globalsNoObserve:n=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:a={}}=t;e={runtimeParams:{...e.runtimeParams,...r},transformerParams:{...e.transformerParams,globalsNoObserve:[...e.transformerParams.globalsNoObserve,...n],globalsOnlyPathsExcept:[...e.transformerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...e.parserParams,...a}},i.devMode}return e}var ji={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},Ri={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},Di={apiVersion:3};var Dt={throwStmt(i){return{type:"ThrowStatement",argument:i}},tryStmt(i,t,e,r){return{type:"TryStatement",block:i,handler:t,finalizer:e,guardedHandlers:r}},catchClause(i,t){return{type:"CatchClause",param:i,body:t}},exprStmt(i){return{type:"ExpressionStatement",expression:i}},blockStmt(i){return{type:"BlockStatement",body:i}},labeledStmt(i,t){return{type:"LabeledStatement",label:i,body:t}},withStmt(i,t){return{type:"WithStatement",object:i,body:t}},ifStmt(i,t,e){return this.conditionalExpr(i,t,e,"IfStatement")},switchStmt(i,t,e=!1){return{type:"SwitchStatement",discriminant:i,cases:t}},switchCase(i,t){return{type:"SwitchCase",test:i,consequent:t}},whileStmt(i,t){return{type:"WhileStatement",test:i,body:t}},doWhileStmt(i,t){return{type:"DoWhileStatement",test:i,body:t}},forStmt(i,t,e,r){return{type:"ForStatement",init:i,test:t,update:e,body:r}},forInStmt(i,t,e){return{type:"ForInStatement",left:i,right:t,body:e}},forOfStmt(i,t,e){return{type:"ForOfStatement",left:i,right:t,body:e}},breakStmt(i=null){return{type:"BreakStatement",label:i}},continueStmt(i=null){return{type:"ContinueStatement",label:i}},returnStmt(i){return{type:"ReturnStatement",argument:i}},yieldExpr(i,t=!1){return{type:"YieldExpression",argument:i,delegate:t}},awaitExpr(i){return{type:"AwaitExpression",argument:i}},varDeclaration(i,t){return{type:"VariableDeclaration",kind:i,declarations:t}},varDeclarator(i,t=null){return{type:"VariableDeclarator",id:i,init:t}},funcDeclaration(i,t,e,r=!1,n=!1,o=!1){return this.func("FunctionDeclaration",...arguments)},sequenceExpr(i){return{type:"SequenceExpression",expressions:i}},parensExpr(i){return{type:"ParenthesizedExpression",expression:i}},logicalExpr(i,t,e){return{type:"LogicalExpression",operator:i,left:t,right:e}},binaryExpr(i,t,e){return{type:"BinaryExpression",operator:i,left:t,right:e}},unaryExpr(i,t,e=!0){return{type:"UnaryExpression",operator:i,argument:t,prefix:e}},updateExpr(i,t,e=!1){return{type:"UpdateExpression",operator:i,argument:t,prefix:e}},assignmentExpr(i,t,e="="){return{type:"AssignmentExpression",operator:e,left:i,right:t}},assignmentPattern(i,t){return{type:"AssignmentPattern",left:i,right:t}},thisExpr(){return{type:"ThisExpression"}},conditionalExpr(i,t,e,r="ConditionalExpression"){return{type:r,test:i,consequent:t,alternate:e}},arrayExpr(i){return{type:"ArrayExpression",elements:i}},arrayPattern(i){return{type:"ArrayPattern",elements:i}},objectExpr(i){return{type:"ObjectExpression",properties:i}},objectPattern(i){return{type:"ObjectPattern",properties:i}},chainExpr(i){return{type:"ChainExpression",expression:i}},callExpr(i,t,e=!1){return{type:"CallExpression",callee:i,arguments:t,optional:e}},newExpr(i,t){return{type:"NewExpression",callee:i,arguments:t}},taggedTemplateExpr(i,t){return{type:"TaggedTemplateExpression",tag:i,quasi:t}},memberExpr(i,t,e=!1,r=!1){return{type:"MemberExpression",object:i,property:t,computed:e,optional:r}},funcExpr(i,t,e,r=!1,n=!1,o=!1){return this.func("FunctionExpression",...arguments)},arrowFuncExpr(i,t,e,r=!1,n=!1,o=!1){return this.func("ArrowFunctionExpression",...arguments)},func(i,t,e,r,n=!1,o=!1,s=!1){return{type:i,id:t,params:e,body:r,async:n,expression:o,generator:s}},identifier(i){return{type:"Identifier",name:i}},property(i,t,e="init",r=!1,n=!1,o=!1){return{type:"Property",key:i,value:t,kind:e,shorthand:r,computed:n,method:o}},classDeclaration(i,t,e=null){return this.class("ClassDeclaration",...arguments)},classExpression(i,t,e=null){return this.class("ClassExpression",...arguments)},class(i,t,e,r=null){return{type:i,id:t,body:e,superClass:r}},methodDefinition(i,t,e="method",r=!1,n=!1){return{type:"MethodDefinition",key:i,value:t,kind:e,static:r,computed:n}},propertyDefinition(i,t,e=!1,r=!1){return{type:"PropertyDefinition",key:i,value:t,static:e,computed:r}},spreadElement(i){return{type:"SpreadElement",argument:i}},literal(i){if(typeof i=="object"&&!("name"in i)&&!("value"in i))throw new Error('Objects that convert to literals must have a "name" or "value" property.');return typeof i=="object"?{type:"Literal",get value(){return"name"in i?i.name:i.value}}:{type:"Literal",value:i}},templateLiteral(i,t){return{type:"TemplateLiteral",quasis:i,expressions:t}},comments(i){let t={};return Object.defineProperty(t,"toString",{value:()=>i}),Object.defineProperty(t,"trim",{value:function(){return this.toString()}}),[{type:"Line",value:t}]},withLoc(i,...t){return["start","end"].forEach(e=>{let r=e==="start"?t[0]:t[t.length-1];i[e]=r[e],r.loc&&(i.loc=i.loc||{},i.loc[e]=r.loc?.[e])}),i},invert(i){return this.unaryExpr("!",i)},clone(i){return i={...i},delete i.start,delete i.end,i}};var re=Object.create(null);var St=class extends EventTarget{managedAlways=new Set;managedOnce=new Set;constructor(){super(),kr.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 Ot=class extends St{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 Ot(this,e,e==="object"?t:Qe(this.state)?C.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||!Qe(this.state))&&(this.mutationsWatch=C.observe(this.state,e=>{let r={map:new Map,add(o,s,a){for(let c of o)c.runtime.thread.includes(c),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),s.refresh(o.value))}let n=r.map.size?[...r.map].sort((o,s)=>o[0].$serial>s[0].$serial?1:-1):r.map;for(let[o,s]of n)o.state!=="aborted"&&o.schedule(...s)},{recursions:"force-sync"}))}refresh(t){this.state=t;for(let[e,r]of this.signals)r.refresh(C.get(this.state??{},e));this.watchMode()}};var K=class extends Ot{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var ot=class extends St{state;constructor(t,e,r,n,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=n,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((n,o,s)=>n&&o<=r.path[s],!0)&&e||r}beforeExecute(){this.state="running";let t=this.flowControl;return this.flowControl=new Map,t}execute(t=null){return this.runtime.thread.unshift(this),G(this.beforeExecute(),e=>Je(this.closure,this,this,(r,n)=>n?this.throw(n,[this.serial,this.context?.serial],n.code):(this.spec.complete&&(r=this.spec.complete(r,this)),this.afterExecute(e),this.runtime.thread.shift(),t?t(r,this):r)))}throw(t,e,r){if(this.type==="function"&&["HandlerFunction","FinalizerFunction"].includes(this.$params.executionMode))return this.$params.lexicalContext.throw(t,e,r);if(this.spec.handler)return this.spec.handler(t);if(this.type!=="function"&&this.context)return this.context.throw(t,e,r);if(t.cause)throw t;let n=`${t.message||t}`,o=r!==null?`[${r}]: ${n}`:n,s=e.map(u=>u!==-1&&this.extractSource(u,!0)).filter(u=>u);s.push({source:this.runtime.$params.originalSource});let a=globalThis[t.name],c=new(a||Error)(o,{cause:s}),l=this.runtime.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw l&&(c.fileName=l),r&&(c.code=r),c}afterExecute(t){this.state="complete";let e=this.flowControl;this.spec.finalizer&&this.spec.finalizer(),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 n=Array.isArray(e)?"array":e===null?"null":typeof e;if(n===t||t==="iterable"&&e?.[Symbol.iterator]||t==="desctructurable"&&!["undefined","null"].includes(n))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,n={}){return this.var(t,e,r,{...n,kind:"let"})}const(t,e,r,n={}){return this.var(t,e,r,{...n,kind:"const"})}var(t,e,r,n={}){n={kind:"var",...n},r||(r=()=>{});let o=n.restOf?(...a)=>{try{return r(...a)}catch(c){throw new Error(`Cannot declare ${t}; ${c.message}`)}}:r,s=(a,c)=>{let l=c.scope;if(n.kind==="var")for(;!["module","function"].includes(l.type)&&!C.has(l.state,t)&&l.context;)l=l.context;else l.type==="this"&&l.context&&(l=l.context);let u=l.symbols.get(t);if(u&&(u.kind!==n.kind||n.kind==="let"&&u.serial!==e))throw new Error(`Identifier "${t}" has already been declared.`);u?.reader?.abort(),u={serial:e,kind:n.kind};let p=a;return n.restOf&&(n.type==="array"?p=[]:p={},u.reader=C.map(a,p,{except:n.restOf,spread:n.type==="array"}),c.once(u.reader)),l.symbols.set(t,u),C.set(l.state,t,p),p};return this.autorun(n.kind,{complete:s,...n},e,o)}update(t,e,r={}){let n=this.scope;for(;n&&!C.has(n.state,t);)n=n.context;if(!n)throw new ReferenceError(`${t} is not defined.`);let o=n.symbols.get(t);if(o?.kind==="const")throw new ReferenceError(`Assignment to constant variable "${t}".`);let s=C.get(n.state,t),a=r.restOf?(...c)=>{try{return e(...c)}catch(l){throw new Error(`Cannot update ${t}; ${l.message}`)}}:e;return Je(a,void 0,s,(c,l)=>{if(l)return this.throw(l,[this.serial]);o?.reader?.abort();let u=c;r.restOf&&(o=o||{},r.type==="array"?u=[]:u={},o.reader=C.map(c,u,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader));let p=this.spec.static||this.type==="function"&&this.$params?.executionMode==="RegularFunction";return C.set(n.state,t,u),["postinc","postdec"].includes(r.kind)?s:u})}ref(t,...e){let r=0,n={};typeof e[0]=="number"?(r=e.shift(),n=e.shift()||{}):typeof e[0]=="object"&&(n=e.shift());let o=this.scope;for(;o&&!C.has(o.state,t);)o=o.context;if(!o){if(n.isTypeCheck)return;throw new Error(`${t} is not defined.`)}let s=o.symbols.get(t)?.kind,a=o.signal(t,s);return n.typed&&this.typed(n.typed,a.state,t),this.autobind(a,r,n)}obj(t,...e){let r=0,n={};return typeof e[0]=="number"?(r=e.shift(),n=e.shift()||{}):typeof e[0]=="object"&&(n=e.shift()),this.autobind(this.runtime.$objects.signal(t,"object"),r,n)}autobind(t,e,r){let n=["LiveProgram","LiveFunction"].includes(this.runtime.$params.executionMode),o=t.type==="const",s=this===this.runtime,a=this.state==="aborted",c=this.spec.static,l=this.spec.isWrite,u=this;return function p(f,d={},m){if(n&&!c&&!l&&!r?.isLeft&&!o&&!s&&!a&&f.subscribe(u),!m||!f.state||typeof f.state!="object"){let v=f.state;return typeof f.state=="function"&&!/^class\s?/.test(Function.prototype.toString.call(f.state))&&(v=C.proxy(f.state,{...d,membrane:f})),v}let w;return C.proxy(f.state,d,v=>({...v,get(g,y,x=null){if(w)return v.get(g,y,x);w=!0;let S={...d};return Array.isArray(g)&&(S.arrayMethodName=y),p(f.signal(y),S,m-1)}}))}(t,{},e)}autorun(t,...e){let r=e.pop(),n=e.pop(),o=e.pop()||{},s=ot,a=this.scope;if(t==="iteration"){let l=this.runtime.constructor;s=r.constructor.name==="AsyncFunction"?l.AutoAsyncIterator:l.AutoIterator}["block","switch","iteration"].includes(t)&&(a=new K(a,t));let c=new s(this,t,o,n,a,r);if(t==="downstream"){if(this.downstream=c,this.flowControlApplied())return}else if(this.type==="switch"&&this.breakpoint)return;return c.execute()}function(t,e,r,n){if(e==="Declaration"){let s=this.scope.type==="this"?this.scope.context:this.scope;C.set(s.state,n.name,n)}let o=this;return Object.defineProperty(n,"toString",{value:function(s=!1){if(s&&t==="LiveFunction")return Function.prototype.toString.call(n);let a=o.runtime.extractSource(r);return a.startsWith("static ")?a.replace("static ",""):a}}),n}class(t,e,r){if(t==="Declaration"){let n=this.scope.type==="this"?this.scope.context:this.scope;C.set(this.scope.state,e.name,e)}return r.forEach(({name:n,isLiveFunction:o,static:s,serial:a})=>{this.function(o&&"LiveFunction"||"RegularFunction","Expression",a,s?e[n]:e.prototype[n])}),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 n=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,n);return}if(this.context?.type==="switch"&&t==="break"&&!e){r||(this.flowControl.get(t).endpoint=!0),this.context.breakpoint=this;return}this.state!=="running"&&(this.handleDownstream(this.flowControl.size,n),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;!["block"].includes(this.type)||!(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,n=new Set;for(;r=r.nextRound;)t?r.abort():e&&r.state!=="inert"&&(r.state="resuming",n.add(r));n.size&&this.runtime.schedule(...n),!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 $t=class extends ot{rounds=new Map;constructor(t,e,r,n,o,s){r.$closure=s,super(t,e,r,n,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},n=["for-in","for-of"].includes(this.spec.kind)?{[this.production]:t}:{...this.scope.state},o=new K(this.scope,"round",n);this.scope.symbols.forEach((c,l)=>{o.symbols.set(l,c)});let s=new ot(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(){if(this.spec.static)return;let t=(e,r)=>{let n=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,c=this.spec.kind==="for-in"?s.key:parseInt(s.key),l=this.rounds.get(c);if(l)C.set(l.scope.state,this.production,a),s.type==="delete"&&(this.rounds.set(c,void 0),l.prevRound&&(l.prevRound.nextRound=l.nextRound),l.nextRound&&(l.nextRound.prevRound=l.prevRound),n.add(l));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",()=>{n.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(C.observe(this.iteratee,e=>{G(this.cursor,r=>t(e,r))}))}};var ie=class extends $t{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 Et=class extends ot{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,n,o){let{$serial:s=0,spec:a,...c}=r;super(t,e,a,-1,n,o),this.$serial=s,this.$params=c,this.$objects=new K(void 0,"objects"),this.manage(this.$objects),this.exports=Object.create(null),this.$promises={imports:[],exports:[]},this.manage(()=>{C.deleteProperties(this.exports,Object.keys(this.exports)),this.$promises.imports.splice(0),this.$promises.exports.splice(0)})}extractSource(t,e=!1){let[[r,n,o],[s]]=this.locations[t],a=this.$params.originalSource.slice(r,s);return e?{expr:a,line:n,column:o}:a}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(n,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"),n)}.call(this,void 0,this.nowRunning)}execute(t=null){return super.execute(e=>{let r=["LiveProgram","LiveFunction"].includes(this.$params.executionMode),n=this.$params.sourceType==="module"||this.$params.sourceType==="script",o=r||this.$params.executionMode==="RegularProgram"&&n?new vt(this):this.flowControl.get("return")?.arg;return t?t(o,this):o})}spawn(t,e,r,n=null){let o=this.nowRunning||n||this,s={...this.$params,$serial:this.$serial+1,executionMode:t,lexicalContext:n},a=new K(o.scope,"function",e?{this:e}:{});return new this.constructor(o,"function",s,a,r).execute()}async import(...t){let e=t.pop(),r=typeof e=="string"?{source:e}:e,n=s=>{if(r.forExport||r.isDynamic)return s;this.assignModules(t,this.scope.state,s,e.serial)};if(this.$params.experimentalFeatures!==!1&&re[r.source])return n(re[r.source]);let o=(async()=>{let s=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;try{return n({...await import(r.source)})}catch(a){a.code==="ERR_MODULE_NOT_FOUND"?this.throw(new Error(`Cannot find module "${r.source}"${s?` imported at "${s}"`:""}.`),[r.serial],a.code):this.throw(a,[r.serial],a.code)}})();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.type==="this"?this.scope.context.state:this.scope.state;this.assignModules(t,this.exports,r,e?.serial)}assignModules(t,e,r,n=null){let o=[],s=["LiveProgram","LiveFunction"].includes(this.$params.executionMode);for(let[a,c,l,u]of t){if(a===null){(s?C:Reflect).set(e,l,u);continue}if(a==="*"&&l){(s?C:Reflect).set(e,l,r);continue}C.has(r,a)||this.throw(new Error(`The requested module does not provide an export named "${a}".`),[c,n]),(s?C:Reflect).set(e,l||a,C.get(r,a)),o.push([a,c,l])}!o.length||!s||this.once(C.observe(r,a=>{for(let[c,,l]of o)for(let u of a)c==="*"?C.set(e,u.key,u.value):u.key===c&&C.set(e,l||c,u.value)}))}afterExecute(...t){return this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace&&(re[this.$params.exportNamespace]=this.exports,this.once(()=>{delete re[this.$params.exportNamespace]})),super.afterExecute(...t)}};V(Et,"AutoAsyncIterator",ie),V(Et,"AutoIterator",$t);function me(i,t,e,r=[],n={}){typeof r=="object"&&r&&!Array.isArray(r)&&(n=r,r=[]);let{liveMode:o=!0,thisContext:s,env:a,exportNamespace:c,fileName:l,base64:u,compileFunction:p,forDynamicBinding:f=!1,...d}=n,{parserParams:m,transformerParams:w,runtimeParams:v}=Rt(d),g=/module/.test(i),y=/script/.test(i),x=/function/.test(i),S=/async/.test(i)||/module/.test(i),h=/source/.test(i),b=/file/.test(i),_=typeof e=="object"&&e?.type==="Program";_||(e=e+"");let O=e;if(g)m.sourceType="module",m.allowAwaitOutsideFunction=!0,m.executionMode=o?"LiveProgram":"RegularProgram";else if(y)m.executionMode=o?"LiveProgram":"RegularProgram";else if(x){if(h)if(_)e=Dt.funcExpr(null,r.map(I=>Dt.identifier(I)),Dt.blockStmt(o?[Dt.literal("use live"),...e.body]:e.body),S),e.isLiveFunction=O.isLiveProgram;else{let I=" "+e.split(`
|
|
3
3
|
`).join(`
|
|
4
4
|
`);e=`${S?"async function":"function"}(${r.join(", ")}) {
|
|
5
5
|
${o?` "use live";
|
|
@@ -8,7 +8,7 @@ ${o?` "use live";
|
|
|
8
8
|
`);return _?G(t.parse(A,m),H=>(H.body.find(Q=>Q.type==="ExpressionStatement"&&Q.expression?.type==="AssignmentExpression"&&Q.expression.left.type==="MemberExpression"&&Q.expression.left.object.type==="Identifier"&&Q.expression.left.property.type==="Identifier"&&Q.expression.left.property.name==="main"&&Q.expression.right.type==="FunctionExpression").expression.right.body.body.push(...R.transformedSource.body),P?G(H,Q=>t.serialize(Q)):H)):A}return G(R,I=>{if(!I)return;let P=[],A=I.identifier2,H;if(b&&Ye)P.push(`const { Scope, Runtime } = await import('${Ye}/index.js');`),P.push(`const ${A} = { Scope, Runtime, params: { ...(${JSON.stringify(v)}), executionMode: '${I.isLiveProgram&&"LiveProgram"||"RegularProgram"}', originalSource: \`${I.originalSource.replace(/`/g,"\\`")}\`, }, };`);else{let yt={Scope:K,Runtime:Et,params:{...v,originalSource:I.originalSource,executionMode:I.isLiveProgram&&"LiveProgram"||"RegularProgram"},thisContext:s,env:a};b?(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.UseLive||(globalThis.webqit.UseLive={}),globalThis.webqit.UseLive.Script||(globalThis.webqit.UseLive.Script=yt),P.push(`const ${A} = globalThis.webqit.UseLive.Script;`)):H=yt}P.push(`${A}.main = ${g?"async ":""}function(${I.identifier}) {${_?"":`
|
|
9
9
|
${I.transformedSource.replace(/\n/g,`
|
|
10
10
|
`)}
|
|
11
|
-
`}};`);let B="global";if(P.push(`${A}.scope = new ${A}.Scope(undefined, '${B}', globalThis);`),(y||H?.env||H&&f)&&(B="env",P.push(`${A}.scope = new ${A}.Scope(${A}.scope, '${B}', ${A}.env);`)),g&&(B="module",P.push(`${A}.scope = new ${A}.Scope(${A}.scope, '${B}');`)),(typeof H?.thisContext<"u"||H&&f)&&P.push(`${A}.scope = new ${A}.Scope(${A}.scope, 'this', { ['this']: ${A}.thisContext });`),P.push(`${A}.runtime = new ${A}.Runtime(undefined, '${B}', ${A}.params, ${A}.scope, ${A}.main);`),g&&b){P.push(`${A}.result = await ${A}.runtime.execute();`);let[yt,_r]=I.exportIds.reduce(([,vr],Ae)=>Ae==="default"?[Ae,vr]:[,vr.concat(Ae)],[null,[]]);return _r.length&&P.push(`export const { ${_r.join(", ")} } = ${A}.result.exports;`),yt&&P.push(`export default ${A}.result.exports.default;`),N(P)}if(b)return P.push(`${A}.result = ${A}.runtime.execute();`),x&&P.push(`return ${A}.result;`),N(P);P.push(x?`return ${A}.runtime.execute();`:`return ${A}.runtime;`);let Q=N(P,!0),xr=p||Function;return G(Q,yt=>f?[xr(A,yt),H]:xr(A,yt)(H))})}var Ye;try{Ye=eval("import.meta.url")}catch(i){}function
|
|
11
|
+
`}};`);let B="global";if(P.push(`${A}.scope = new ${A}.Scope(undefined, '${B}', globalThis);`),(y||H?.env||H&&f)&&(B="env",P.push(`${A}.scope = new ${A}.Scope(${A}.scope, '${B}', ${A}.env);`)),g&&(B="module",P.push(`${A}.scope = new ${A}.Scope(${A}.scope, '${B}');`)),(typeof H?.thisContext<"u"||H&&f)&&P.push(`${A}.scope = new ${A}.Scope(${A}.scope, 'this', { ['this']: ${A}.thisContext });`),P.push(`${A}.runtime = new ${A}.Runtime(undefined, '${B}', ${A}.params, ${A}.scope, ${A}.main);`),g&&b){P.push(`${A}.result = await ${A}.runtime.execute();`);let[yt,_r]=I.exportIds.reduce(([,vr],Ae)=>Ae==="default"?[Ae,vr]:[,vr.concat(Ae)],[null,[]]);return _r.length&&P.push(`export const { ${_r.join(", ")} } = ${A}.result.exports;`),yt&&P.push(`export default ${A}.result.exports.default;`),N(P)}if(b)return P.push(`${A}.result = ${A}.runtime.execute();`),x&&P.push(`return ${A}.result;`),N(P);P.push(x?`return ${A}.runtime.execute();`:`return ${A}.runtime;`);let Q=N(P,!0),xr=p||Function;return G(Q,yt=>f?[xr(A,yt),H]:xr(A,yt)(H))})}var Ye;try{Ye=eval("import.meta.url")}catch(i){}function Nu(i){let t=Ni(i);return Li(t)}function Ni(i){if(typeof i!="string")throw new TypeError("URL must be a string");if(!i.startsWith("file://"))return i;let t=i.slice(7);return t=t.replace(/^\/([A-Za-z]:)/,"$1"),t=decodeURIComponent(t),t}function Li(i){if(typeof i!="string")throw new TypeError("path must be a string");let t=i.includes("\\")?"\\":"/",e=i.lastIndexOf(t);return e===-1?i:e===0?t:i.slice(0,e)}var Nt=class{constructor(...t){let e=this.constructor,r=typeof t[t.length-1]=="object"?t.pop():{};this.source=t.pop()||"",this.$program=me(e.sourceType,e.astTools,this.source,{...r,forDynamicBinding:!0})}execute(){return G(this.$program,([t,e])=>G(t(e),r=>r.execute()))}bind(t,e=void 0){return G(this.$program,([r,n])=>r({...n,thisContext:t,env:e}))}toString(t=!1){return t?G(this.$program,([e])=>e+""):this.source}};var Hi;function Fi(...i){let{source:t,args:e,params:r}=qr(i),n=Dr("async-function-source",t,e,r);if(!(n instanceof Promise))return n;let o=async function(...s){return(await n).call(this,...s)};return Object.defineProperty(o,"toString",{value:async function(...s){return(await n).toString(...s)}}),o}var Wi,ne=class extends Nt{};V(ne,"sourceType","async-script-source"),V(ne,"astTools",{parse:ge,transform:ye,serialize:be});var oe=class extends Nt{};V(oe,"sourceType","module"),V(oe,"astTools",{parse:ge,transform:ye,serialize:be});function Dr(i,t,...e){return me(i,{parse:ge,transform:ye,serialize:be},t,...e)}function ge(i,t){return Ze("parse",i,t)}function ye(i,t){return Ze("transform",i,t)}function be(i,t){return Ze("serialize",i,t)}function Ze(i,t,e){let r=n=>(Object.defineProperty(n,"toString",{value:o=>o==="base64"?n.transformedSourceBase64:n.transformedSource}),n);if(globalThis.webqit?.$useLiveT){let{parse:n,transform:o,serialize:s}=globalThis.webqit.$useLiveT;if(i==="serialize")return s(t,e);if(i==="parse")return n(t,e);if(i==="transform"){let a=o(t,e);return r(a)}}if(globalThis.webqit=globalThis.webqit||{},!globalThis.webqit.$useLiveTWorker){let s=`
|
|
12
12
|
const transformerUrls = [ '${(document.querySelector('meta[name="$q-transformer-url"]')?.content.split(",")||[]).concat("https://unpkg.com/@webqit/use-live/dist/transformer.js").join("','")}' ];
|
|
13
13
|
( function importScript() {
|
|
14
14
|
try { importScripts( transformerUrls.shift().trim() ) } catch( e ) { if ( transformerUrls.length ) { importScript(); } }
|
|
@@ -26,7 +26,7 @@ ${o?` "use live";
|
|
|
26
26
|
result = compilation;
|
|
27
27
|
}
|
|
28
28
|
e.ports[0]?.postMessage(result);
|
|
29
|
-
};`;globalThis.webqit.$useLiveTWorker=new Worker(`data:text/javascript;base64,${btoa(s)}`)}return new Promise(n=>{let o=new MessageChannel;webqit.$useLiveTWorker.postMessage({action:i,input:t,params:e},[o.port2]),o.port1.onmessage=s=>{let a=s.data;i==="transform"&&r(a),n(a)}})}function se(i,t,e={},r={}){t=F(t).slice();for(var n=i;!at(n)&&!Vt(n)&&t.length;){var o=t.shift();if(!(e.get?e.get(n,o):j(n)?o in n:n[o])){r.exists=!1;return}n=e.get?e.get(n,o):n[o]}return r.exists=!0,n}function tr(i,t,e,r={},n={}){let o=(u,p,f)=>n.set?n.set(u,p,f):(Z(t[a])&&M(u)?u.push(f):u[p]=f,!0);t=F(t);for(var s=i,a=0;a<t.length;a++)if(a<t.length-1){if(!s||!j(s)&&!k(s))return!1;var c=se(s,t[a],n);if(!j(c)){if(n.buildTree===!1)return!1;c=k(n.buildTree)?n.buildTree(a):Z(t[a+1])?[]:{};var l=o(s,t[a],c);if(!l)return!1}s=c}else return o(s,t[a],e)}var ae=class{constructor(t,e=!1){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),Object.defineProperty(this,"_synthesis",{value:0,writable:!0}),!e&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(t){this._synthesis++,this._fulfill();let e=await t();return this._synthesis--,e}_fulfill(){for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t)}_loop(){this.window.requestAnimationFrame(()=>{this._fulfill(),this._loop()})}onread(t,e=!1){if(e)return new Promise(r=>{this.synthesis?r(t()):this.readCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.readCallbacks.add(t)}onwrite(t,e=!1){if(e)return new Promise(r=>{this.synthesis?r(t()):this.writeCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.writeCallbacks.add(t)}cycle(t,e,r){this.onread(()=>{let n=t(r),o=s=>{s!==void 0&&this.onwrite(()=>{let a=e(s,r),c=l=>{l!==void 0&&this.cycle(t,e,l)};a instanceof Promise?a.then(c):c(a)})};n instanceof Promise?n.then(o):o(n)})}};function Nr(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function Lt(i,t,e,r=!0){e=(Array.isArray(e)?e:[e]).map(s=>(s+"").replace("(",r?"(.//":"(./")).join("|");let n=[],o;try{let s=i.document.evaluate(e,t,null,i.XPathResult.ANY_TYPE);for(;o=s.iterateNext();)n.push(o)}catch{}return n}function Lr(i,t,e){e=(Array.isArray(e)?e:[e]).map(r=>(r+"").replace("(","(self::")).join("|");try{return i.document.evaluate(`${e}`,t,null,i.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function le(i,t,e,r=!1,n=null){let o=n?.get(t)?.get(e);if(typeof o<"u")return o;let s=l=>(n?.has(t)||n?.set(t,new WeakMap),n?.get(t)?.set(e,l),l),a=t.getRootNode(),c=e.getRootNode();return a===c?s(t.contains(e)):r&&c instanceof i.ShadowRoot?s(le(i,t,c.host,r,n)):s(!1)}function Hr(i,t="|"){return[...i].reduce(([e,r,n,o],s)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(s)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(s)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(s)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(s)&&!n[0].endsWith("\\")&&(e=e===s?null:e||s),n[0]+=s,[e,r,n]),[null,0,[""]])[2].reverse()}var tt=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Nr(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Hr(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var At=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(k(t[0])?t=[[],...t]:q(t[0])&&!(t[0]instanceof tt)&&t.length===1?t=[[],void 0,t[0]]:q(t[1])&&t.length===2?t=[F(t[0],!1),void 0,t[1]]:t[0]=F(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof tt)&&!(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 tt?e:new tt(e)),t}registry(...t){return W(this.window,"realdom",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:n}=this,o=new Set,s=new WeakMap;for(let[a,c]of this.registry(t)){let l=[].concat(e).filter(p=>le(n,a.context,p.target,a.params.subtree==="cross-roots",s));if(!l.length)continue;let u=[a,Array.isArray(e)?l:l[0]];c?o.add(u):r.call(n,...u)}for(let a of o)r.call(n,...a);o.clear()}disconnectables(t,...e){let r={disconnect(){e.forEach(n=>n&&k(n.disconnect)&&n.disconnect()||k(n)&&n()||q(n)&&(n.disconnected=!0))}};return t&&t.addEventListener("abort",()=>r.disconnect()),r}};var ht=class extends At{type="attr";constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let n=typeof t=="string"||t instanceof tt;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=Br(o,t);if(!e)return s;let a=r.lifecycleSignals&&this.createSignalGenerator();if(n)for(let c of s){let l=a?a.generate():{};e(c,l,o)}else{let c=a?.generate()||{};e(s,c,o)}if(r.live){a&&(r={...r,signalGenerator:a});let c=this.observe(n?t[0]:t,e,{newValue:!0,...r});return this.disconnectables(r.signal,c)}}observe(t,e,r={}){let n=typeof t=="string"||t instanceof tt;if([t=[],e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(n?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&&Wr.call(s,"intercept",()=>{});let c=new s.MutationObserver(f=>{f=zr(f).map(d=>Ur.call(s,d)),Fr.call(s,p,f,o)}),l={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(l.attributeFilter=t.map(f=>f+"")),c.observe(o,l);let u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),p={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:u,disconnectable:c};return this.disconnectables(r.signal,c,u)}observeSync(t,e,r={}){let n=typeof t=="string"||t instanceof tt;[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";this.registry(a).size||Wr.call(s,a,f=>{this.forEachMatchingContext(a,f,Fr)});let c={disconnect(){p.delete(u)}},l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:l,disconnectable:c},p=this.registry(a);return p.set(u,!!u.params.deferred),this.disconnectables(r.signal,c,l)}};function zr(i){return i.reduce((t,e,r)=>t[r-1]?.attributeName===e.attributeName||W(e.target,"realdom","internalAttrInteractions").get(e.attributeName)?t:t.concat(e),[])}function Fr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:s,originalFilterIsString:a,signalGenerator:c}=i;if(o.subtree||(t=t.filter(f=>f.target===e)),!t.length)return;let l=r.map(f=>f+"");if(o.atomic&&!s.size?t=Br(e,r,t):o.timing!=="async"&&r.length&&(t=t.filter(f=>l.includes(f.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(f=>{let d;return o.eventDetails||({event:d,...f}=f),!o.oldValue&&"oldValue"in f&&({oldValue:d,...f}=f),!o.newValue&&"value"in f?{value:d,...f}=f:o.newValue&&typeof f.value>"u"&&(f={...f,value:xe(f.target,f.name,()=>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,p=c?c.generate():{};n(u,p,e)}function xe(i,t,e){let r=W(i,"realdom","internalAttrInteractions").get(t);W(i,"realdom","internalAttrInteractions").set(t,!0);let n=e();return W(i,"realdom","internalAttrInteractions").set(t,r),n}function Br(i,t,e=[]){let r={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",e.find(s=>s.name===o)||{target:i,name:o,value:xe(i,o,()=>i.getAttribute(o)),...r})):Array.from(i.attributes).map(o=>e.find(s=>s.name===o.nodeName)||{target:i,name:o.nodeName,value:xe(i,o.nodeName,()=>o.nodeValue),...r})}function Ur({target:i,attributeName:t,value:e,oldValue:r}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(i)||{})[t]?.[0]||"mutation";return{target:i,name:t,value:e,oldValue:r,type:"observation",event:s}}function Wr(i,t){let e=this,{webqit:r,document:n,Element:o}=e;r.realdom.attrInterceptionHooks||Object.defineProperty(r.realdom,"attrInterceptionHooks",{value:new Map}),r.realdom.attrInterceptionHooks.has(i)||r.realdom.attrInterceptionHooks.set(i,new Set),r.realdom.attrInterceptionHooks.get(i).add(t);let s=()=>r.realdom.attrInterceptionHooks.get(i).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,p)=>{r.realdom.attrInterceptionRecords.has(u.target)||r.realdom.attrInterceptionRecords.set(u.target,{});let f=r.realdom.attrInterceptionRecords.get(u.target);if(f[u.name]=f[u.name]||[],f[u.name].unshift(u.event),W(u.target,"realdom","internalAttrInteractions").get(u.name))return p();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(m=>m([u]));let d=p();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(m=>m([u])),d};new e.MutationObserver(u=>{u=u.filter(p=>!(e.webqit.realdom.attrInterceptionRecords?.get(p.target)||{})[p.attributeName]?.shift()),u=zr(u).map(p=>Ur.call(e,p)),u.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(p=>p(u)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(p=>p(u)))}).observe(n,{attributes:!0,subtree:!0,attributeOldValue:!0});let l=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(u=>{l[u]=o.prototype[u],o.prototype[u]=function(...p){let f,d=xe(this,p[0],()=>this.getAttribute(p[0]));["setAttribute","toggleAttribute"].includes(u)&&(f=p[1]),u==="toggleAttribute"&&f===void 0&&(f=d===null);let m={target:this,name:p[0],value:f,oldValue:d,type:"interception",event:[this,u]};return a(m,()=>l[u].call(this,...p))}}),s}var ce=class extends At{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new ht(n,o).get(...arguments)}query(t,e=void 0,r={}){[t,e=void 0,r={}]=this.resolveArgs(arguments);let{context:n}=this,o=new Map,s=l=>(o.has(l)||o.set(l,{target:l,entrants:[],exits:[],type:"query",event:null}),o.get(l));if(!r.generation||r.generation==="entrants"){if(!t.length)[...n.children].forEach(l=>s(n).entrants.push(l));else if(t.every(l=>l.type==="selector")){let[l,u]=t.reduce(([f,d],m)=>m.kind==="xpath"?[f,d.concat(m)]:[f.concat(m),d],[[],[]]),p=[];r.subtree?(l.length&&p.push(...n.querySelectorAll(l.join(","))),u.length&&p.push(...Lt(this.window,n,u))):(l.length&&p.push(...[...n.children].filter(f=>f.matches(l))),u.length&&p.push(...Lt(this.window,n,u,!1))),p.forEach(f=>s(f.parentNode||n).entrants.push(f))}}if(!e)return o;let a={disconnected:!1},c=e&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,l]of o){if(a.disconnected)break;let u=c?.generate()||{};e(l,u,n)}if(r.live){c&&(r={...r,signalGenerator:c});let l=this.observe(t,e,r);return this.disconnectables(r.signal,a,l)}return this.disconnectables(r.signal,a,c)}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:n,window:o,webqit:s,document:a}=this;r.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(a.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&Xr.call(o,"sync",()=>{});let c=new o.MutationObserver(p=>p.forEach(f=>{rr.call(o,u,Gr.call(o,f),n)}));c.observe(n,{childList:!0,subtree:r.subtree&&!0});let l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:n,spec:t,callback:e,params:r,signalGenerator:l,disconnectable:c};if(r.staticSensitivity){let p=Vr.call(o,u);return this.disconnectables(r.signal,c,l,p)}return this.disconnectables(r.signal,c,l)}observeSync(t,e,r={}){[t,e,r={}]=this.resolveArgs(arguments);let{context:n,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";this.registry(s).size||Xr.call(o,s,f=>{this.forEachMatchingContext(s,f,rr)});let a=new o.MutationObserver(f=>f.forEach(d=>{Array.isArray((d=Gr.call(o,d)).event)||rr.call(o,u,d,n)}));a.observe(n,{childList:!0,subtree:r.subtree&&!0});let c={disconnect(){p.delete(u),a.disconnect()}},l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:n,spec:t,callback:e,params:r,signalGenerator:l,disconnectable:c},p=this.registry(s);if(p.set(u,!!u.params.deferred),r.staticSensitivity){let f=Vr.call(o,u);return this.disconnectables(r.signal,c,l,f)}return this.disconnectables(r.signal,c,l)}track(t,e,r={}){return r={subtree:!0,...r},this.observe(t,n=>{n.entrants.length&&e(!0,Array.isArray(t)?n.entrants:n.entrants[0]),n.exits.length&&e(!1,Array.isArray(t)?n.exits:n.exits[0])},r)}};function Vr(i){let t=this,{context:e,spec:r,callback:n,params:o,signalGenerator:s}=i,a=r.filter(d=>d.kind==="css"),c=d=>d.match(/\.([\w-]+)/g)?.length?["class"]:[],l=d=>d.match(/#([\w-]+)/g)?.length?["id"]:[],u=d=>[...d.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(m=>m[1]).concat(c(d)).concat(l(d));if(!(i.$attrs=Array.from(new Set(a.filter(d=>(d+"").includes("[")).reduce((d,m)=>d.concat(u(m+"")),[])))).length)return;let p=new Set,f=new Set;return p.push=d=>(f.delete(d),p.add(d)),f.push=d=>(p.delete(d),f.add(d)),i.$deliveryCache={entrants:p,exits:f},new ht(e,t).observe(i.$attrs,d=>{let m=new Map,w=y=>(m.has(y)||m.set(y,{target:y,entrants:[],exits:[],type:"static",event:null}),m.get(y)),v=new WeakMap,g=y=>(v.has(y)||v.set(y,a.some(x=>y.matches(x+""))),v.get(y));for(let y of d)["entrants","exits"].forEach(x=>{o.generation&&x!==o.generation||i.$deliveryCache[x].has(y.target)||(x==="entrants"?!g(y.target):g(y.target))||(i.$deliveryCache[x].push(y.target),w(y.target)[x].push(y.target),w(y.target).event=y.event)});for(let[,y]of m){let x=s?.generate()||{};n(y,x,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function rr(i,t){let{context:e,spec:r,callback:n,params:o,signalGenerator:s,$deliveryCache:a}=i,c={...t,entrants:[],exits:[]};if(o.eventDetails||delete c.event,["entrants","exits"].forEach(u=>{if(!(o.generation&&u!==o.generation)&&(r.length?c[u]=Gi.call(this,r,o.subtree==="cross-roots",t[u],t.event!=="parse"):c[u]=[...t[u]],!!a))for(let p of c[u])a[u].push(p)}),!c.entrants.length&&!c.exits.length)return;let l=s?.generate()||{};n(c,l,e)}function Gi(i,t,e,r){e=Array.isArray(e)?e:[...e];let n=(o,s)=>{if(s.type==="selector"){let a=s.isXpathAttr?[]:o.filter(c=>s.kind==="xpath"?Lr(this,c,s+""):c.matches&&c.matches(s+""));if((r||s.isXpathAttr)&&(a=o.reduce((c,l)=>s.kind==="xpath"?[...c,...Lt(this,l,s,r)]:l.querySelectorAll?[...c,...l.querySelectorAll(s+"")]:c,a)),a.length)return a}else if(o.includes(s.content)||r&&o.some(a=>le(this,a,s.content,t)))return[s.content]};return e.$$searchCache||(e.$$searchCache=new Map),i.reduce((o,s)=>{let a;return e.$$searchCache.has(s.content)?a=e.$$searchCache.get(s.content):(a=n(e,s)||[],s.type==="instance"&&e.$$searchCache.set(s.content,a)),o.concat(a)},[])}function Gr({target:i,addedNodes:t,removedNodes:e}){let r=this,n;return n=F(t).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),null),n=F(e).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),n),n=n||r.document.readyState==="loading"&&"parse"||"mutation",{target:i,entrants:t,exits:e,type:"observation",event:n}}function Xr(i,t){let e=this,{webqit:r,document:n,Node:o,CharacterData:s,Element:a,HTMLElement:c,HTMLTemplateElement:l,DocumentFragment:u}=e;r.realdom.domInterceptionHooks||Object.defineProperty(r.realdom,"domInterceptionHooks",{value:new Map}),r.realdom.domInterceptionNoRecurse||Object.defineProperty(r.realdom,"domInterceptionNoRecurse",{value:new Map}),r.realdom.domInterceptionHooks.has(i)||r.realdom.domInterceptionHooks.set(i,new Set),r.realdom.domInterceptionHooks.get(i).add(t);let p=()=>r.realdom.domInterceptionHooks.get(i).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return p;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let f=(g,y,x)=>{r.realdom.domInterceptionNoRecurse.set(g,y);let S=x();return r.realdom.domInterceptionNoRecurse.delete(g),S},d=(g,y)=>{g.entrants.concat(g.exits).forEach(S=>{clearTimeout(r.realdom.domInterceptionRecords.get(S)?.timeout),r.realdom.domInterceptionRecords.set(S,g.event);let h=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(S)},0);Object.defineProperty(g.event,"timeout",{value:h,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(S=>S(g));let x=y();return r.realdom.domInterceptionHooks.get("sync")?.forEach(S=>S(g)),x},m={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},w={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(m).reduce((g,y)=>g.concat(y),[])).forEach(g=>{Object.keys(m).forEach(S=>{if(!m[S].includes(g))return;let h=Object.getOwnPropertyDescriptor(e[S].prototype,g);!h||(Object.defineProperty(e[S].prototype,g,"value"in h?{...h,value:y}:{...h,set:x}),w[S][g]=h)});function y(...S){let h=Object.keys(w).find(I=>this instanceof e[I]&&g in w[I]),b=w[h],_=()=>b[g].value.call(this,...S);if(r.realdom.domInterceptionNoRecurse.get(this)===g)return _();let O=[],$=[],T=this;["insertBefore"].includes(g)?$=[S[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(g)?($=[S[1]],["beforebegin","afterend"].includes(S[0])&&(T=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(g)?(O=[...this.childNodes],$=g==="replaceChildren"?[...S]:[S[0]]):["replaceWith","remove"].includes(g)?(O=[this],$=g==="replaceWith"?[...S]:[],T=this.parentNode):["replaceChild"].includes(g)?(O=[S[1]],$=[S[0]]):["removeChild"].includes(g)?O=[...S]:($=[...S],["before","after"].includes(g)&&(T=this.parentNode));let R=g;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(g)){let I=this.nodeName;if(g==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(S[0])){if(!this.parentNode)return b[g].value.call(this,...S);I=this.parentNode.nodeName}let P=n.createElement(I.includes("-")?"div":I);b.setHTMLUnsafe.value.call(P,$[0],g==="setHTMLUnsafe"?S[1]:{}),$=[...P.childNodes],g==="insertAdjacentHTML"?(R="insertAdjacentElement",S[1]=new u,f(S[1],"append",()=>S[1].append(...P.childNodes))):(R="replaceChildren",S=[...P.childNodes])}return T?d({target:T,entrants:$,exits:O,type:"interception",event:[this,g]},()=>b[R].value.call(this,...S)):_()}function x(S){let h=Object.keys(w).find(N=>this instanceof e[N]&&g in w[N]),b=w[h],_=()=>b[g].set.call(this,S);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===g)return _();let O=[],$=[],T=this;if(["outerHTML","outerText"].includes(g)?(O=[this],T=this.parentNode):this instanceof l?(T=this.content,O=[...this.content.childNodes]):O=[...this.childNodes],["outerHTML","innerHTML"].includes(g)){let N=this.nodeName;if(g==="outerHTML"){if(!this.parentNode)return _();N=this.parentNode.nodeName}let I=n.createElement(N.includes("-")?"div":N);if(f(I,g,()=>I[g]=S),$=this instanceof l?[...I.content.childNodes]:[...I.childNodes],this instanceof l&&this.hasAttribute("src")||this instanceof ShadowRoot){let P=A=>A.reduce((H,B)=>B instanceof HTMLScriptElement?H.concat(B):B instanceof l?H.concat(P([B.content])):(H=H.concat(P([...B.querySelectorAll?.("template")||[]].map(Q=>Q.content))),H.concat(...B.querySelectorAll?.("script")||[])),[]);for(let A of P($)){if(this instanceof ShadowRoot){A.setAttribute("data-handling","manual");continue}let H=n.createElement("script");[...A.attributes].forEach(B=>H.setAttribute(B.name,B.value)),H.textContent=A.textContent,f(A,"replaceWith",()=>A.replaceWith(H))}}g==="outerHTML"?(S=new u,f(S,"append",()=>S.append(...$)),_=()=>f(this,"replaceWith",()=>a.prototype.replaceWith.call(this,S))):this instanceof l?_=()=>f(this.content,"replaceChildren",()=>this.content.replaceChildren(...$)):_=()=>f(this,"replaceChildren",()=>a.prototype.replaceChildren.call(this,...$))}return d({target:T,entrants:$,exits:O,type:"interception",event:[this,g]},_)}}),p}function Jr(){Xi.call(this),Ji.call(this),Qi.call(this)}function Xi(){let i=this;i.CSS||(i.CSS={}),i.CSS.escape||(i.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function Ji(){let i=this;"isConnected"in i.Node.prototype||Object.defineProperty(i.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function Qi(){let i=this;i.Element.prototype.matches||(i.Element.prototype.matches=i.Element.prototype.matchesSelector||i.Element.prototype.mozMatchesSelector||i.Element.prototype.msMatchesSelector||i.Element.prototype.oMatchesSelector||i.Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),r=e.length;--r>=0&&e.item(r)!==this;);return r>-1})}function Qr(){let i=this;if(i.webqit||(i.webqit={}),i.webqit.realdom)return i.webqit.realdom;i.webqit.realdom={},Jr.call(i),i.webqit.realdom.meta=(...e)=>Yi.call(i,...e),i.webqit.realdom.ready=(...e)=>ir.call(i,...e),i.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new ce(e,i);if(r==="attr")return new ht(e,i)};let t=new ae(i);return i.webqit.realdom.schedule=(e,...r)=>t[`on${e}`](...r),i.webqit.realdom.synthesizeWhile=(...e)=>t.synthesizeWhile(...e),i.webqit.realdom}function ir(...i){let t="interactive",e;kt(i[0])?(t=i[0],k(i[1])&&(e=i[1])):k(i[0])&&(e=i[0]);let r={interactive:["interactive","complete"],complete:["complete"]};if(!r[t])throw new Error(`Invalid ready-state timing: ${t}.`);let n=this;if(!e)return n.webqit.realdom.readyStatePromises||(n.webqit.realdom.readyStatePromises={interactive:new Promise(o=>ir.call(this,"interactive",o)),complete:new Promise(o=>ir.call(this,"complete",o))}),n.webqit.realdom.readyStatePromises[t];if(r[t].includes(n.document.readyState))return e(n);n.webqit.realdom.readyStateCallbacks||(n.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},n.document.addEventListener("readystatechange",()=>{let o=n.document.readyState;for(let s of n.webqit.realdom.readyStateCallbacks[o].splice(0))s(n)},!1)),n.webqit.realdom.readyStateCallbacks[t].push(e)}function Yi(i){let t=this,e={},r;return(r=t.document.querySelector(`meta[name="${i}"]`))&&(e=(r.content||"").split(";").filter(n=>n).reduce((n,o)=>{let s=o.split("=").map(a=>a.trim());return tr(n,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:Z(s[1])?parseInt(s[1]):s[1]),n},{})),{get name(){return i},get content(){return r.content},json(){return JSON.parse(JSON.stringify(e))}}}function _e(i,t){return typeof i!="string"?i:i.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+(typeof t!==void 0&&t?e.substr(1).toLowerCase():e.substr(1))})}var E=(i,...t)=>W(i,"oohtml",...t),D={};function X(i,t,e){let r=this,n=Qr.call(r);D.window=r,r.webqitConfig||(r.webqitConfig=n.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let o=i.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[o]){r.webqit.oohtml.configs[o]={};let s=r.webqit.oohtml.configs[o];Xt(2,s,e,t,n.meta(i).json()),r.webqitConfig.prefix&&Object.keys(s).forEach(a=>{Object.keys(s[a]).forEach(c=>{a==="api"&&typeof s[a][c]=="string"?s[a][c]=`${r.webqitConfig.prefix}${_e(s[a][c])}`:["attr","elements"].includes(a)&&s[a][c]?.startsWith("data-")===!1&&(s[a][c]=`${r.webqitConfig.prefix}-${s[a][c]}`)})})}return{config:r.webqit.oohtml.configs[o],realdom:n,window:r}}function or(i,t){return W(i,"realdom","internalAttrInteractions").get(t)}function Zr(i,t,e){let r=W(i,"realdom","internalAttrInteractions").get(t);W(i,"realdom","internalAttrInteractions").set(t,!0);let n=e();return W(i,"realdom","internalAttrInteractions").set(t,r),n}function ft(i,t){return[...i].reduce(([e,r,n],o)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(o)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(o)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(o)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(o)&&!n[0].endsWith("\\")&&(e=e===o?null:e||o),n[0]+=o,[e,r,n]),[null,0,[""]])[2].reverse()}var tn=()=>(0|Math.random()*9e6).toString(36),nr=new Map;function Pt(i){let t;return(t=nr.get(i))||(t=tn(),nr.set(i,t)),t}function ve(i){let t;return nr.forEach((e,r)=>{e===i&&(t=r)}),t}function Se(){let{window:i}=D,{webqit:t}=i;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class e extends i.Event{constructor(...n){let o=n.pop();if(typeof o!="function")throw new Error("Callback must be provided.");let s=n.pop();if(!s?.kind)throw new Error('"options.kind" must be specified.');let a=["contextrequest","contextclaim"],c=n.pop()||a[0];if(!a.includes(c))throw new Error(`Invalid event type. Must be one of: ${a.join(",")}`);let{kind:l,detail:u,targetContext:p,live:f,signal:d,diff:m,...w}=s;super(c,{...w,bubbles:w.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>o}),Object.defineProperty(this,"kind",{get:()=>l}),Object.defineProperty(this,"targetContext",{get:()=>p}),Object.defineProperty(this,"detail",{get:()=>u}),Object.defineProperty(this,"live",{get:()=>f}),Object.defineProperty(this,"signal",{get:()=>d}),Object.defineProperty(this,"diff",{get:()=>m}),Object.defineProperty(this,"options",{get:()=>w}),Object.defineProperty(this,"meta",{value:{}})}get target(){return super.target||this.meta.target}get answered(){return this.meta.answered||!1}respondWith(n){if(this.meta.answered=!0,this.diff){if("_prevValue"in this&&this._prevValue===n)return;Object.defineProperty(this,"_prevValue",{value:n,configurable:!0})}return this.callback(n)}}return t.DOMContextRequestEvent=e,e}var Tt=class extends AbortController{constructor(t){super(),t(e=>{let{window:{webqit:{Observer:r}}}=D;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var Ct=class extends Error{};var mt=class{static instance(t){return E(t).get("contexts::instance")||new this(t)}constructor(t){E(t).get("contexts::instance")?.dispose(),E(t).set("contexts::instance",this);let e={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>e})}[Symbol.iterator](){return this["#"].contexts[Symbol.iterator]()}get length(){return this["#"].contexts.size}find(...t){return[...this["#"].contexts].find(e=>typeof t[0]=="function"?t[0](e):e.constructor.kind===t[0]&&(!t[1]||e.detail===t[1]))}attach(t){if(!(t instanceof J))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new Ct(`Context of same kind "${t.constructor.kind}"${t.detail?` and detail "${t.detail}"`:""} already exists.`);this["#"].contexts.add(t),t.initialize(this["#"].host)}detach(t){t.dispose(this["#"].host),this["#"].contexts.delete(t)}request(...t){return new Tt((e,r)=>{typeof t[t.length-1]!="function"&&(t[t.length-1]?t.push(e):t[t.length-1]=e);let n;(n=t.find(s=>typeof s=="object"&&s))&&n.live&&(n.signal&&n.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(n)]={...n,signal:r.signal});let o=new(Se())(...t);this["#"].host.dispatchEvent(o)})}};var sr=class{static createRequest(){return{kind:this.kind}}constructor(t=null){Object.defineProperty(this,"detail",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get configs(){let{window:{webqit:{oohtml:{configs:t}}}}=D;return t}get name(){return[D.window.Document,D.window.ShadowRoot].some(t=>this.host instanceof t)?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(!(t.detail instanceof sr)||t.target===this.host)return;let e=new Set;if(this.subscriptions.forEach(r=>{!t.target.contains(r.target)||!t.detail.matchEvent(r)||(this.subscriptions.delete(r),this.unsubscribed(r),e.add(r))}),e.size)return t.respondWith(e)}if(t.type==="contextrequest")return this.matchEvent(t)?(t.live&&(this.subscriptions.add(t),this.subscribed(t),t.signal?.addEventListener("abort",()=>{this.subscriptions.delete(t),this.unsubscribed(t)})),t.stopPropagation(),this.handle(t)):void 0}}initialize(t){this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this);let{value:e}=mt.instance(t).request("contextclaim",{kind:this.constructor.kind,detail:this});return e?.forEach(r=>{this.subscriptions.add(r),this.subscribed(r),this.handle(r)}),this}dispose(t){return this.disposed=!0,t.removeEventListener("contextrequest",this),t.removeEventListener("contextclaim",this),this.subscriptions.forEach(e=>{this.subscriptions.delete(e),this.unsubscribed(e);let{target:r}=e;e.meta.answered=!1,r.dispatchEvent(e)}),this}},J=sr;V(J,"kind");var Ht=class extends J{static createRequest(t=null){let e=super.createRequest();if(t?.startsWith("@")){let[r,...n]=n.slice(1).split("/").map(o=>o.trim());e.targetContext=r,e.detail=n.join("/")}else e.detail=t;return e}get namespaceObj(){return this.host[this.configs.NAMESPACED_HTML.api.namespace]}handle(t){let{window:{webqit:{Observer:e}}}=D;if(t.meta.controller?.abort(),!(t.detail||"").trim())return t.respondWith(e.unproxy(this.namespaceObj));let r=(t.detail||"").split("/").map(n=>n.trim()).filter(n=>n);if(!r.length)return t.respondWith();r=r.join(`/${this.configs.NAMESPACED_HTML.api.namespace}/`)?.split("/")||[],t.meta.controller=e.reduce(this.namespaceObj,r,e.get,n=>{this.disposed||t.respondWith(n.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};V(Ht,"kind","namespace");function ar(i={}){let{config:t,window:e}=X.call(this,"namespaced-html",i,{attr:{namespace:"namespace",lid:"id"},api:{namespace:"namespace"},tokens:{lidrefPrefix:"~",lidrefSeparator:":"},target:{className:":target",eventName:":target",scrolling:!0}});t.lidSelector=`[${e.CSS.escape(t.attr.lid)}]`,t.namespaceSelector=`[${e.CSS.escape(t.attr.namespace)}]`,e.webqit.DOMNamingContext=Ht,en.call(e,t),rn.call(e,t)}function Kr(i){let{lidrefPrefix:t,lidrefSeparator:e}=i.tokens;return{escape(r,n=1){return[...r].map(o=>/\w/.test(o)?o:n===2?`\\\\${o}`:`\\${o}`).join("")},lidrefPrefix(r=0){return r?this.escape(t,r):t},lidrefSeparator(r=0){return r?this.escape(e,r):e},isUuid(r,n=0){return r.startsWith(this.lidrefPrefix(n))&&r.includes(this.lidrefSeparator(n))},toUuid(r,n,o=0){return r.endsWith("-root")?n:`${this.lidrefPrefix(o)}${r}${this.lidrefSeparator(o)}${n}`},uuidToId(r,n=0){return this.isUuid(r)?r.split(this.lidrefSeparator(n))[1]:r},uuidToLidref(r,n=0){return this.isUuid(r)?`${this.lidrefPrefix(n)}${r.split(this.lidrefSeparator(n))[1]}`:r}}}function lr(i,t,e=null,r=0){let n=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:o}}}}=n,s=Kr(o),a=new RegExp(`${e?":scope|":""}#(${s.lidrefPrefix(r+1)})?([\\w]+${s.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[c,l]=ft(i,",").reduce(([p,f],d)=>{let m,w;return d=d.replace(a,(v,g,y,x,S)=>{if(m||(m=[...d.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),m.some(O=>S>O.index&&S+v.length<O.index+O[0].length))return v;if(v===":scope")return w=!0,e;let h=g&&!y;if(g&&y)return`#${s.escape(v.replace("#",""),1)}`;if(h&&o.attr.lid==="id"&&t&&!t.endsWith("-root"))return`#${s.toUuid(t,x,1)}`;let _;return o.attr.lid==="id"?_=`:is(#${x},[id^="${s.lidrefPrefix(r)}"][id$="${s.lidrefSeparator(r)}${x}"])`:_=`:is(#${x},[${n.CSS.escape(o.attr.lid)}="${x}"])`,h?`:is(${_}):not(${e?e+" ":""}${o.namespaceSelector} *)`:_}),w?[p,f.concat(d)]:[p.concat(d),f]},[[],[]]),u;return e&&c.length?u=[c.length>1?`${e} :is(${c.join(", ")})`:`${e} ${c[0]}`,l.join(", ")].filter(p=>p).join(", "):u=[...c,...l].join(", "),u}function Oe(i){let t=this;if(!E(i).has("namespace")){let e=Object.create(null);E(i).set("namespace",e);let r=[t.Document,t.ShadowRoot].some(n=>i instanceof n);Object.defineProperty(e,Symbol.toStringTag,{get(){return r?"RootNamespaceRegistry":"NamespaceRegistry"}})}return E(i).get("namespace")}function Ft(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return Oe.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function $e(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(ve(i)||Pt(i))+(t?"-root":"")}function en(i){let t=this,{webqit:{Observer:e}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let n=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.namespace in r)throw new Error(`The ${n} prototype already has a "${i.api.namespace}" API!`);Object.defineProperty(r,i.api.namespace,{get:function(){return e.proxy(Oe.call(t,this))}})})}function rn(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},DOMNamingContext:o}}=t,s=["aria-owns","aria-controls","aria-labelledby","aria-describedby","aria-flowto"],a=["for","list","form","aria-activedescendant","aria-details","aria-errormessage","popovertarget"],c=[i.attr.lid,...s,...a],l={id:"id",for:"htmlFor","aria-owns":"ariaOwns","aria-controls":"ariaControls","aria-labelledby":"ariaLabelledBy","aria-describedby":"ariaDescribedBy","aria-flowto":"ariaFlowto","aria-activedescendant":"ariaActiveDescendant","aria-details":"ariaDetails","aria-errormessage":"ariaErrorMessage",popovertarget:"popoverTargetElement"},u=Kr(i),p=(h,b,_)=>{if(!or(h,b)&&E(h,"attrOriginals").has(b))return E(h,"attrOriginals").get(b);let O=_();return or(h,b)?O:O&&O.split(" ").map($=>($=$.trim())&&(b===i.attr.lid?u.uuidToId:u.uuidToLidref).call(u,$)).join(" ")},f=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...f,value(h){return this.querySelector(`#${h}`)}});for(let h of["querySelector","querySelectorAll"])for(let b of[t.Document,t.Element]){let _=Object.getOwnPropertyDescriptor(b.prototype,h);Object.defineProperty(b.prototype,h,{..._,value(O){return _.value.call(this,lr.call(t,O,$e(Oe.call(t,this))))}})}let d=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...d,value(h){let b=()=>d.value.call(this,h);return c.includes(h)&&!E(this,"lock").get(h)?p(this,h,b):b()}});let m=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...m,get(){let h=()=>m.get.call(this);return c.includes(this.name)?p(this.ownerElement,this.name,h):h()}});let w=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...w,get(){let h=()=>w.get.call(this);return this instanceof t.Attr&&c.includes(this.name)?p(this.ownerElement,this.name,h):h()}});for(let h of c){if(!(h in l))continue;let b=h==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:h==="popovertarget"?[t.HTMLButtonElement,t.HTMLInputElement]:[t.Element];for(let _ of b){let O=Object.getOwnPropertyDescriptor(_.prototype,l[h]);!O||Object.defineProperty(_.prototype,l[h],{...O,get(){return p(this,h,()=>O.get.call(this,h))}})}}i.attr.lid!=="id"&&Object.defineProperty(t.Element.prototype,i.attr.lid,{configurable:!0,enumerable:!0,get(){return this.getAttribute(i.attr.lid)},set(h){return this.setAttribute(i.attr.lid,h)}});let v=(h,b,_,O)=>Zr(h,b,()=>(typeof _=="function"&&(_=_()),O(_))),g=(h,b,_,O=null)=>{v(h,b,_,$=>{let T=b===i.attr.lid,R=O||Ft.call(t,h,T),N=$e(R);if(T){let I=u.uuidToId($);if(e.get(R,I)!==h){let P=u.toUuid(N,I);P!==$&&h.setAttribute("id",P),e.set(R,I,h)}}else{E(h,"attrOriginals").set(b,$);let I=$.split(" ").map(P=>(P=P.trim())&&u.isUuid(P)?P:u.toUuid(N,P)).join(" ");h.setAttribute(b,I),E(R).set("idrefs",E(R).get("idrefs")||new Set),E(R).get("idrefs").add(h)}})},y=(h,b,_,O=null)=>{v(h,b,_,$=>{let T=b===i.attr.lid,R=O||Ft.call(t,h,T);if(T){let N=u.uuidToId($);e.get(R,N)===h&&e.deleteProperty(R,N)}else{let N=E(h,"attrOriginals").get(b);h.hasAttribute(b)&&h.setAttribute(b,N),E(R).get("idrefs")?.delete(h)}})};r.realtime(t.document).query(i.namespaceSelector,h=>{let b=(_,O,$,T)=>{if(!_.hasAttribute(O))return;let R=()=>_.getAttribute(O);y(_,O,R,$),_.isConnected&&g(_,O,E(_,"attrOriginals").get(O)||R,T)};h.exits.forEach(_=>{if(_.isConnected){let T=Oe.call(t,_);for(let R of new Set([...Object.values(T),...E(T).get("idrefs")||[]]))for(let N of c)b(R,N,T)}let O=_[n.CONTEXT_API.api.contexts],$=O.find(o.kind);$&&O.detach($)}),h.entrants.forEach(_=>{let O,$=Ft.call(t,_,!0);for(let R of new Set([...Object.values($),...E($).get("idrefs")||[]]))if((O=Ft.call(t,R,!0))!==$)for(let N of c)b(R,N,$,O);let T=_[n.CONTEXT_API.api.contexts];T.find(o.kind)||T.attach(new o)})},{id:"namespace-html:namespace",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(`[${c.map(h=>t.CSS.escape(h)).join("],[")}]`,h=>{let b={forID:new Map,forOther:new Map};for(let _ of c){let O=_===i.attr.lid?b.forID:b.forOther;h.exits.forEach($=>{if(!$.hasAttribute(_))return;let T=O.get($);typeof T>"u"&&(T=(_===i.attr.lid?$.parentNode:$)?.closest?.(i.namespaceSelector)||$.getRootNode().host,O.set($,T)),!(T&&!T.isConnected)&&y($,_,()=>$.getAttribute(_))}),h.entrants.forEach($=>{!$.hasAttribute(_)||g($,_,()=>$.getAttribute(_))})}b.forID.clear(),b.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(c,h=>{for(let b of h)b.oldValue&&b.value!==b.oldValue&&y(b.target,b.name,b.oldValue),b.value&&b.value!==b.oldValue&&g(b.target,b.name,b.value)},{id:"namespace-html:attr(attrs)",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let x,S=()=>{if(!t.location.hash?.startsWith(`#${u.lidrefPrefix()}`))return;let h=t.location.hash?.substring(`#${u.lidrefPrefix()}`.length).split("/").map(_=>_.trim()).filter(_=>_)||[],b=h.reduce((_,O)=>_&&_[i.api.namespace][O],t.document);x&&i.target.className&&x.classList.toggle(i.target.className,!1),b&&b!==t.document&&(i.target.className&&b.classList.toggle(i.target.className,!0),i.target.eventName&&b.dispatchEvent(new t.CustomEvent(i.target.eventName)),i.target.scrolling&&h.length>1&&b.scrollIntoView(),x=b)};t.addEventListener("hashchange",S),r.ready(S)}function cr({advanced:i={},...t}){let{config:e,window:r}=X.call(this,"scoped-js",t,{script:{retention:"retain",mimeTypes:"module|text/javascript|application/javascript",timing:"auto"},api:{scripts:"scripts"},advanced:Rt(i)}),n=Array.isArray(e.script.mimeTypes)?e.script.mimeTypes:e.script.mimeTypes.split("|").filter(o=>o);e.scriptSelector=n.map(o=>`script[type="${r.CSS.escape(o)}"]:not([oohtmlignore])`).concat("script:not([type])").join(","),r.webqit.oohtml.Script={compileCache:[new Map,new Map],execute:on.bind(r,e)},nn.call(r,e),sn.call(r,e)}function nn(i){let t=this,{webqit:{nextKeyword:e,matchPrologDirective:r}}=t,n=new Map;if(i.api.scripts in t.Element.prototype)throw new Error(`The "Element" class already has a "${i.api.scripts}" property!`);[t.ShadowRoot.prototype,t.Element.prototype].forEach(o=>{Object.defineProperty(o,i.api.scripts,{get:function(){return n.has(this)||n.set(this,[]),n.get(this)}})}),Object.defineProperties(t.HTMLScriptElement.prototype,{scoped:{configurable:!0,get(){return this.hasAttribute("scoped")},set(o){this.toggleAttribute("scoped",o)}},live:{configurable:!0,get(){if(this.liveProgramHandle)return!0;let o=e(this.oohtml__textContent||this.textContent||"",0,0);return r(o,!0)}}})}async function on(i,t){let e=this,{realdom:r}=e.webqit,n=ve(t);if(!n)throw new Error("Argument must be a valid exec hash.");let{script:o,compiledScript:s,thisContext:a}=n;i.script.retention==="dispose"?o.remove():i.script.retention==="hidden"?o.textContent='"source hidden"':setTimeout(async()=>{o.textContent=await s.toString()},0);let c=o.scoped?a:o.getRootNode();E(c).has("scriptEnv")||E(c).set("scriptEnv",Object.create(null));let l=await(await s.bind(a,E(c).get("scriptEnv"))).execute();o.live&&Object.defineProperty(o,"liveProgramHandle",{value:l}),r.realtime(e.document).observe(o,()=>{o.live&&l.abort(),a instanceof e.Element&&a[i.api.scripts]?.splice(a[i.api.scripts].indexOf(o,1))},{id:"scoped-js:script-exits",subtree:"cross-roots",timing:"sync",generation:"exits"})}function sn(i){let t=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,e=this,{webqit:{oohtml:r,realdom:n}}=e;e.HTMLScriptElement.supports||(e.HTMLScriptElement.supports=s=>["text/javascript","application/javascript"].includes(s));let o=new WeakSet;n.realtime(e.document).query(i.scriptSelector,s=>{s.entrants.forEach(a=>{if(o.has(a)||a.hasAttribute("oohtmlno")||!t&&!a.hasAttribute("ssr"))return;let c=ti.call(e,i,a);if(!c)return;o.add(a);let l=a.scoped?a.parentNode||s.target:a.type==="module"?void 0:e;a.scoped&&l[i.api.scripts].push(a);let u=Pt({script:a,compiledScript:c,thisContext:l});s.type==="query"||a.type&&!e.HTMLScriptElement.supports(a.type)||a.getAttribute("data-handling")==="manual"||i.script.timing==="manual"?r.Script.execute(u):a.textContent=`webqit.oohtml.Script.execute( '${u}' );`})},{id:"scoped-js:script-entries",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants",eventDetails:!0})}function ti(i,t){let e=this,{webqit:{oohtml:r,LiveScript:n,AsyncLiveScript:o,LiveModule:s}}=e,a=t.textContent.trim();if(a.startsWith("/*@oohtml*/if(false){")&&a.endsWith("}/*@oohtml*/")&&(a=a.slice(21,-12),Object.defineProperty(t,"oohtml__textContent",{value:a})),!a.trim().length)return;let c=Pt(a),l=r.Script.compileCache[t.live?0:1],u;if(!(u=l.get(c))){let{parserParams:p,compilerParams:f,runtimeParams:d}=i.advanced;u=new(t.type==="module"?s:n||o)(a,{liveMode:t.live,exportNamespace:`#${t.id}`,fileName:`${e.document.url?.split("#")?.[0]||""}#${t.id}`,parserParams:p,compilerParams:f,runtimeParams:d}),l.set(c,u)}return u}function ei(i){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:e}}}}=t;[...i?.querySelectorAll(e.scriptSelector)||[]].forEach(r=>{ti.call(t,e,r)})}function pr(i={}){let{config:t,window:e}=X.call(this,"data-binding",i,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},advanced:Rt({runtimeParams:{spec:{handler:n=>{}}}})});({CONTEXT_API:t.CONTEXT_API,BINDINGS_API:t.BINDINGS_API,HTML_IMPORTS:t.HTML_IMPORTS}=e.webqit.oohtml.configs),t.attrSelector=`[${e.CSS.escape(t.attr.render)}]`;let r=(n,o)=>{let s=`starts-with(., "${n}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,an.call(e,t)}function an(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(i.attrSelector,r=>{ri.call(this,...r.exits),cn.call(t,i,...r.entrants),queueMicrotask(()=>{})},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),e.realtime(t.document).query(`(${i.discreteBindingsSelector})`,r=>{ri.call(this,...r.exits),ln.call(t,i,...r.entrants),queueMicrotask(()=>{})},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function ii(i,t){let{webqit:{realdom:e,Observer:r,DOMBindingsContext:n}}=this;if(E(t).has("data-binding"))return E(t).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(c,l,...u)=>{(()=>{try{c[l](...u)}catch(f){throw new Error(`Error executing "${l}()": ${f.message} at ${f.cause}`)}})()},o.$assign__=(c,l,u)=>{(()=>{try{c[l]=u}catch(f){throw new Error(`Error executing "${l} = ${u}": ${f.message} at ${f.cause}`)}})()},r.intercept(o,{get:(c,l,u)=>{if(!(c.key in o)){let p={...n.createRequest(c.key),live:!0,signal:s.signal};t[i.CONTEXT_API.api.contexts].request(p,f=>{r.set(o,c.key,f)})}return u(o[c.key]??(c.key in globalThis?globalThis[c.key]:void 0))},has:(c,l,u)=>u(!0)});let a={scope:o,abortController:s,bindings:new Map};return E(t).set("data-binding",a),a}function ri(...i){for(let t of i){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:n}=E(e).get("data-binding")||{};if(!r?.has(t))return;r.get(t).liveProgramHandle.abort(),r.get(t).signals?.forEach(o=>o.abort()),r.delete(t),r.size||(n.abort(),E(e).delete("data-binding"))}}function ni(i,t){let e=i.tokens.tagStart.split("").map(l=>`\\${l}`).join(""),r=i.tokens.tagEnd.split("").map(l=>`\\${l}`).join(""),n=i.tokens.stateStart.split("").map(l=>l===" "?"(?:\\s+)?":`\\${l}`).join(""),o=i.tokens.stateEnd.split("").map(l=>`\\${l}`).join(""),s=`^${e}(.*?)(?:${n}(\\d+)${o}(?:\\s+)?)?${r}$`,[,a,c]=t.match(new RegExp(s));return{raw:t,expr:a,span:parseInt(c??0)}}async function ln(i,...t){let e=this,r=t.reduce((n,o)=>{if(o.isBound)return n;let s=ni(i,o.nodeValue),a=o;if(s.span){if(a=o.nextSibling,a?.nodeName!=="#text"||a.nodeValue.length<s.span)return n;a.nodeValue.length>s.span&&a.splitText(s.span)}else a=o.ownerDocument.createTextNode(""),o.after(a);a.isBound=!0;let c=o;return e.webqit.env!=="server"&&(c.remove(),c=null),n.concat({textNode:a,template:s,anchorNode:c})},[]);for(let{textNode:n,template:o,anchorNode:s}of r){let a=oi.call(e,i,o.expr),{scope:c,bindings:l}=ii.call(this,i,n.parentNode);Object.defineProperty(n,"$oohtml_internal_databinding_anchorNode",{value:s,configurable:!0});try{l.set(n,{liveProgramHandle:await(await a.bind(n,c)).execute()})}catch(u){console.log(u)}}}var ur=new Map;function oi(i,t){if(ur.has(t))return ur.get(t);let e=`let content = ((${t}) ?? '') + '';`;e+="$assign__(this, 'nodeValue', content);",e+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${i.tokens.tagStart}${Wt(t)}${i.tokens.stateStart}" + content.length + "${i.tokens.stateEnd} ${i.tokens.tagEnd}"); }`;let{webqit:{LiveScript:r,AsyncLiveScript:n}}=this,{parserParams:o,compilerParams:s,runtimeParams:a}=i.advanced,c=new(r||n)(e,{parserParams:o,compilerParams:s,runtimeParams:a});return ur.set(t,c),c}async function cn(i,...t){for(let e of t){let r=si.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=ii.call(this,i,e),s=[];Object.defineProperty(e,"$oohtml_internal_databinding_signals",{value:s,configurable:!0});try{o.set(e,{signals:s,liveProgramHandle:await(await r.bind(e,n)).execute()})}catch(a){console.log(a)}}}var fr=new Map;function si(i,t){if(fr.has(t))return fr.get(t);let e={},r=-1,n=ft(t,";").map(p=>{let[f,d]=ft(p,":").map(y=>y.trim()),m=f[0],w=f.slice(1).trim(),v=`(${d})`,g=`(${v} ?? '')`;if(m==="&")return w.startsWith("--")?`$exec__(this.style, 'setProperty', "${Wt(w)}", ${g});`:`$assign__(this.style, "${Wt(w)}", ${g});`;if(m==="%")return`$exec__(this.classList, 'toggle', "${Wt(w)}", !!${v});`;if(m==="~")return w.startsWith("?")?`$exec__(this, 'toggleAttribute', "${Wt(w.substring(1).trim())}", !!${v});`:`$exec__(this, 'setAttribute', "${Wt(w)}", ${g});`;if(m==="#"){if(e[w])throw new Error(`Duplicate binding: ${f}.`);if(e[w]=!0,w==="text")return`$assign__(this, 'textContent', ${g});`;if(w==="html")return`$assign__(this, 'innerHTML', ${g});`;if(w==="items"){let[y,x]=ft(d,"/");if(!x)throw new Error(`Invalid ${m}items spec: ${p}; no import specifier.`);let[S,h,b,_]=y.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!S)throw new Error(`Invalid ${m}items spec: ${p}.`);if(h.startsWith("(")?h=h.trim().slice(1,-1).split(",").map(T=>T.trim()):h=[h],h.length>(b==="in"?3:2))throw new Error(`Invalid ${m}items spec: ${p}.`);let O=b==="in"?h[2]:h[1]||"$index__";return`
|
|
29
|
+
};`;globalThis.webqit.$useLiveTWorker=new Worker(`data:text/javascript;base64,${btoa(s)}`)}return new Promise(n=>{let o=new MessageChannel;webqit.$useLiveTWorker.postMessage({action:i,input:t,params:e},[o.port2]),o.port1.onmessage=s=>{let a=s.data;i==="transform"&&r(a),n(a)}})}function se(i,t,e={},r={}){t=F(t).slice();for(var n=i;!at(n)&&!Vt(n)&&t.length;){var o=t.shift();if(!(e.get?e.get(n,o):j(n)?o in n:n[o])){r.exists=!1;return}n=e.get?e.get(n,o):n[o]}return r.exists=!0,n}function tr(i,t,e,r={},n={}){let o=(u,p,f)=>n.set?n.set(u,p,f):(Z(t[a])&&M(u)?u.push(f):u[p]=f,!0);t=F(t);for(var s=i,a=0;a<t.length;a++)if(a<t.length-1){if(!s||!j(s)&&!k(s))return!1;var c=se(s,t[a],n);if(!j(c)){if(n.buildTree===!1)return!1;c=k(n.buildTree)?n.buildTree(a):Z(t[a+1])?[]:{};var l=o(s,t[a],c);if(!l)return!1}s=c}else return o(s,t[a],e)}var ae=class{constructor(t,e=!1){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),Object.defineProperty(this,"_synthesis",{value:0,writable:!0}),!e&&this.window.requestAnimationFrame?this._loop():this._synthesis++}get synthesis(){return this._synthesis}async synthesizeWhile(t){this._synthesis++,this._fulfill();let e=await t();return this._synthesis--,e}_fulfill(){for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t)}_loop(){this.window.requestAnimationFrame(()=>{this._fulfill(),this._loop()})}onread(t,e=!1){if(e)return new Promise(r=>{this.synthesis?r(t()):this.readCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.readCallbacks.add(t)}onwrite(t,e=!1){if(e)return new Promise(r=>{this.synthesis?r(t()):this.writeCallbacks.add(()=>{r(t())})});this.synthesis?Promise.resolve().then(t):this.writeCallbacks.add(t)}cycle(t,e,r){this.onread(()=>{let n=t(r),o=s=>{s!==void 0&&this.onwrite(()=>{let a=e(s,r),c=l=>{l!==void 0&&this.cycle(t,e,l)};a instanceof Promise?a.then(c):c(a)})};n instanceof Promise?n.then(o):o(n)})}};function Nr(i){return(i=i.trim())&&i.startsWith("(")&&i.endsWith(")")}function Lt(i,t,e,r=!0){e=(Array.isArray(e)?e:[e]).map(s=>(s+"").replace("(",r?"(.//":"(./")).join("|");let n=[],o;try{let s=i.document.evaluate(e,t,null,i.XPathResult.ANY_TYPE);for(;o=s.iterateNext();)n.push(o)}catch{}return n}function Lr(i,t,e){e=(Array.isArray(e)?e:[e]).map(r=>(r+"").replace("(","(self::")).join("|");try{return i.document.evaluate(`${e}`,t,null,i.XPathResult.BOOLEAN_TYPE).booleanValue}catch{}}function le(i,t,e,r=!1,n=null){let o=n?.get(t)?.get(e);if(typeof o<"u")return o;let s=l=>(n?.has(t)||n?.set(t,new WeakMap),n?.get(t)?.set(e,l),l),a=t.getRootNode(),c=e.getRootNode();return a===c?s(t.contains(e)):r&&c instanceof i.ShadowRoot?s(le(i,t,c.host,r,n)):s(!1)}function Hr(i,t="|"){return[...i].reduce(([e,r,n,o],s)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(s)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(s)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(s)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(s)&&!n[0].endsWith("\\")&&(e=e===s?null:e||s),n[0]+=s,[e,r,n]),[null,0,[""]])[2].reverse()}var tt=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:Nr(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Hr(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var At=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(k(t[0])?t=[[],...t]:q(t[0])&&!(t[0]instanceof tt)&&t.length===1?t=[[],void 0,t[0]]:q(t[1])&&t.length===2?t=[F(t[0],!1),void 0,t[1]]:t[0]=F(t[0],!1),t[0].filter(e=>typeof e!="string"&&!(e instanceof tt)&&!(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 tt?e:new tt(e)),t}registry(...t){return W(this.window,"realdom",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:n}=this,o=new Set,s=new WeakMap;for(let[a,c]of this.registry(t)){let l=[].concat(e).filter(p=>le(n,a.context,p.target,a.params.subtree==="cross-roots",s));if(!l.length)continue;let u=[a,Array.isArray(e)?l:l[0]];c?o.add(u):r.call(n,...u)}for(let a of o)r.call(n,...a);o.clear()}disconnectables(t,...e){let r={disconnect(){e.forEach(n=>n&&k(n.disconnect)&&n.disconnect()||k(n)&&n()||q(n)&&(n.disconnected=!0))}};return t&&t.addEventListener("abort",()=>r.disconnect()),r}};var ht=class extends At{type="attr";constructor(t,...e){super(t,"attr",...e)}get(t,e=void 0,r={}){let n=typeof t=="string"||t instanceof tt;[t=[],e=void 0,r={}]=this.resolveArgs(arguments);let{context:o}=this,s=Br(o,t);if(!e)return s;let a=r.lifecycleSignals&&this.createSignalGenerator();if(n)for(let c of s){let l=a?a.generate():{};e(c,l,o)}else{let c=a?.generate()||{};e(s,c,o)}if(r.live){a&&(r={...r,signalGenerator:a});let c=this.observe(n?t[0]:t,e,{newValue:!0,...r});return this.disconnectables(r.signal,c)}}observe(t,e,r={}){let n=typeof t=="string"||t instanceof tt;if([t=[],e,r={}]=this.resolveArgs(arguments),["sync","intercept"].includes(r.timing))return this.observeSync(n?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&&Wr.call(s,"intercept",()=>{});let c=new s.MutationObserver(f=>{f=zr(f).map(d=>Ur.call(s,d)),Fr.call(s,p,f,o)}),l={attributes:!0,attributeOldValue:r.oldValue,subtree:r.subtree&&!0};t.length&&(l.attributeFilter=t.map(f=>f+"")),c.observe(o,l);let u=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),p={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:u,disconnectable:c};return this.disconnectables(r.signal,c,u)}observeSync(t,e,r={}){let n=typeof t=="string"||t instanceof tt;[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";this.registry(a).size||Wr.call(s,a,f=>{this.forEachMatchingContext(a,f,Fr)});let c={disconnect(){p.delete(u)}},l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:o,spec:t,callback:e,params:r,atomics:new Map,originalFilterIsString:n,signalGenerator:l,disconnectable:c},p=this.registry(a);return p.set(u,!!u.params.deferred),this.disconnectables(r.signal,c,l)}};function zr(i){return i.reduce((t,e,r)=>t[r-1]?.attributeName===e.attributeName||W(e.target,"realdom","internalAttrInteractions").get(e.attributeName)?t:t.concat(e),[])}function Fr(i,t){let{context:e,spec:r,callback:n,params:o,atomics:s,originalFilterIsString:a,signalGenerator:c}=i;if(o.subtree||(t=t.filter(f=>f.target===e)),!t.length)return;let l=r.map(f=>f+"");if(o.atomic&&!s.size?t=Br(e,r,t):o.timing!=="async"&&r.length&&(t=t.filter(f=>l.includes(f.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(f=>{let d;return o.eventDetails||({event:d,...f}=f),!o.oldValue&&"oldValue"in f&&({oldValue:d,...f}=f),!o.newValue&&"value"in f?{value:d,...f}=f:o.newValue&&typeof f.value>"u"&&(f={...f,value:xe(f.target,f.name,()=>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,p=c?c.generate():{};n(u,p,e)}function xe(i,t,e){let r=W(i,"realdom","internalAttrInteractions").get(t);W(i,"realdom","internalAttrInteractions").set(t,!0);let n=e();return W(i,"realdom","internalAttrInteractions").set(t,r),n}function Br(i,t,e=[]){let r={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",e.find(s=>s.name===o)||{target:i,name:o,value:xe(i,o,()=>i.getAttribute(o)),...r})):Array.from(i.attributes).map(o=>e.find(s=>s.name===o.nodeName)||{target:i,name:o.nodeName,value:xe(i,o.nodeName,()=>o.nodeValue),...r})}function Ur({target:i,attributeName:t,value:e,oldValue:r}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(i)||{})[t]?.[0]||"mutation";return{target:i,name:t,value:e,oldValue:r,type:"observation",event:s}}function Wr(i,t){let e=this,{webqit:r,document:n,Element:o}=e;r.realdom.attrInterceptionHooks||Object.defineProperty(r.realdom,"attrInterceptionHooks",{value:new Map}),r.realdom.attrInterceptionHooks.has(i)||r.realdom.attrInterceptionHooks.set(i,new Set),r.realdom.attrInterceptionHooks.get(i).add(t);let s=()=>r.realdom.attrInterceptionHooks.get(i).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,p)=>{r.realdom.attrInterceptionRecords.has(u.target)||r.realdom.attrInterceptionRecords.set(u.target,{});let f=r.realdom.attrInterceptionRecords.get(u.target);if(f[u.name]=f[u.name]||[],f[u.name].unshift(u.event),W(u.target,"realdom","internalAttrInteractions").get(u.name))return p();r.realdom.attrInterceptionHooks.get("intercept")?.forEach(m=>m([u]));let d=p();return r.realdom.attrInterceptionHooks.get("sync")?.forEach(m=>m([u])),d};new e.MutationObserver(u=>{u=u.filter(p=>!(e.webqit.realdom.attrInterceptionRecords?.get(p.target)||{})[p.attributeName]?.shift()),u=zr(u).map(p=>Ur.call(e,p)),u.length&&(r.realdom.attrInterceptionHooks.get("intercept")?.forEach(p=>p(u)),r.realdom.attrInterceptionHooks.get("sync")?.forEach(p=>p(u)))}).observe(n,{attributes:!0,subtree:!0,attributeOldValue:!0});let l=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(u=>{l[u]=o.prototype[u],o.prototype[u]=function(...p){let f,d=xe(this,p[0],()=>this.getAttribute(p[0]));["setAttribute","toggleAttribute"].includes(u)&&(f=p[1]),u==="toggleAttribute"&&f===void 0&&(f=d===null);let m={target:this,name:p[0],value:f,oldValue:d,type:"interception",event:[this,u]};return a(m,()=>l[u].call(this,...p))}}),s}var ce=class extends At{constructor(t,...e){super(t,"tree",...e)}attr(t,e=void 0,r={}){let{context:n,window:o}=this;return new ht(n,o).get(...arguments)}query(t,e=void 0,r={}){[t,e=void 0,r={}]=this.resolveArgs(arguments);let{context:n}=this,o=new Map,s=l=>(o.has(l)||o.set(l,{target:l,entrants:[],exits:[],type:"query",event:null}),o.get(l));if(!r.generation||r.generation==="entrants"){if(!t.length)[...n.children].forEach(l=>s(n).entrants.push(l));else if(t.every(l=>l.type==="selector")){let[l,u]=t.reduce(([f,d],m)=>m.kind==="xpath"?[f,d.concat(m)]:[f.concat(m),d],[[],[]]),p=[];r.subtree?(l.length&&p.push(...n.querySelectorAll(l.join(","))),u.length&&p.push(...Lt(this.window,n,u))):(l.length&&p.push(...[...n.children].filter(f=>f.matches(l))),u.length&&p.push(...Lt(this.window,n,u,!1))),p.forEach(f=>s(f.parentNode||n).entrants.push(f))}}if(!e)return o;let a={disconnected:!1},c=e&&r.lifecycleSignals&&this.createSignalGenerator();for(let[,l]of o){if(a.disconnected)break;let u=c?.generate()||{};e(l,u,n)}if(r.live){c&&(r={...r,signalGenerator:c});let l=this.observe(t,e,r);return this.disconnectables(r.signal,a,l)}return this.disconnectables(r.signal,a,c)}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:n,window:o,webqit:s,document:a}=this;r.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(a.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&Xr.call(o,"sync",()=>{});let c=new o.MutationObserver(p=>p.forEach(f=>{rr.call(o,u,Gr.call(o,f),n)}));c.observe(n,{childList:!0,subtree:r.subtree&&!0});let l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:n,spec:t,callback:e,params:r,signalGenerator:l,disconnectable:c};if(r.staticSensitivity){let p=Vr.call(o,u);return this.disconnectables(r.signal,c,l,p)}return this.disconnectables(r.signal,c,l)}observeSync(t,e,r={}){[t,e,r={}]=this.resolveArgs(arguments);let{context:n,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";this.registry(s).size||Xr.call(o,s,f=>{this.forEachMatchingContext(s,f,rr)});let a=new o.MutationObserver(f=>f.forEach(d=>{Array.isArray((d=Gr.call(o,d)).event)||rr.call(o,u,d,n)}));a.observe(n,{childList:!0,subtree:r.subtree&&!0});let c={disconnect(){p.delete(u),a.disconnect()}},l=r.signalGenerator||r.lifecycleSignals&&this.createSignalGenerator(),u={context:n,spec:t,callback:e,params:r,signalGenerator:l,disconnectable:c},p=this.registry(s);if(p.set(u,!!u.params.deferred),r.staticSensitivity){let f=Vr.call(o,u);return this.disconnectables(r.signal,c,l,f)}return this.disconnectables(r.signal,c,l)}track(t,e,r={}){return r={subtree:!0,...r},this.observe(t,n=>{n.entrants.length&&e(!0,Array.isArray(t)?n.entrants:n.entrants[0]),n.exits.length&&e(!1,Array.isArray(t)?n.exits:n.exits[0])},r)}};function Vr(i){let t=this,{context:e,spec:r,callback:n,params:o,signalGenerator:s}=i,a=r.filter(d=>d.kind==="css"),c=d=>d.match(/\.([\w-]+)/g)?.length?["class"]:[],l=d=>d.match(/#([\w-]+)/g)?.length?["id"]:[],u=d=>[...d.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(m=>m[1]).concat(c(d)).concat(l(d));if(!(i.$attrs=Array.from(new Set(a.filter(d=>(d+"").includes("[")).reduce((d,m)=>d.concat(u(m+"")),[])))).length)return;let p=new Set,f=new Set;return p.push=d=>(f.delete(d),p.add(d)),f.push=d=>(p.delete(d),f.add(d)),i.$deliveryCache={entrants:p,exits:f},new ht(e,t).observe(i.$attrs,d=>{let m=new Map,w=y=>(m.has(y)||m.set(y,{target:y,entrants:[],exits:[],type:"static",event:null}),m.get(y)),v=new WeakMap,g=y=>(v.has(y)||v.set(y,a.some(x=>y.matches(x+""))),v.get(y));for(let y of d)["entrants","exits"].forEach(x=>{o.generation&&x!==o.generation||i.$deliveryCache[x].has(y.target)||(x==="entrants"?!g(y.target):g(y.target))||(i.$deliveryCache[x].push(y.target),w(y.target)[x].push(y.target),w(y.target).event=y.event)});for(let[,y]of m){let x=s?.generate()||{};n(y,x,e)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function rr(i,t){let{context:e,spec:r,callback:n,params:o,signalGenerator:s,$deliveryCache:a}=i,c={...t,entrants:[],exits:[]};if(o.eventDetails||delete c.event,["entrants","exits"].forEach(u=>{if(!(o.generation&&u!==o.generation)&&(r.length?c[u]=Vi.call(this,r,o.subtree==="cross-roots",t[u],t.event!=="parse"):c[u]=[...t[u]],!!a))for(let p of c[u])a[u].push(p)}),!c.entrants.length&&!c.exits.length)return;let l=s?.generate()||{};n(c,l,e)}function Vi(i,t,e,r){e=Array.isArray(e)?e:[...e];let n=(o,s)=>{if(s.type==="selector"){let a=s.isXpathAttr?[]:o.filter(c=>s.kind==="xpath"?Lr(this,c,s+""):c.matches&&c.matches(s+""));if((r||s.isXpathAttr)&&(a=o.reduce((c,l)=>s.kind==="xpath"?[...c,...Lt(this,l,s,r)]:l.querySelectorAll?[...c,...l.querySelectorAll(s+"")]:c,a)),a.length)return a}else if(o.includes(s.content)||r&&o.some(a=>le(this,a,s.content,t)))return[s.content]};return e.$$searchCache||(e.$$searchCache=new Map),i.reduce((o,s)=>{let a;return e.$$searchCache.has(s.content)?a=e.$$searchCache.get(s.content):(a=n(e,s)||[],s.type==="instance"&&e.$$searchCache.set(s.content,a)),o.concat(a)},[])}function Gr({target:i,addedNodes:t,removedNodes:e}){let r=this,n;return n=F(t).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),null),n=F(e).reduce((o,s)=>o||r.webqit.realdom.domInterceptionRecords?.get(s),n),n=n||r.document.readyState==="loading"&&"parse"||"mutation",{target:i,entrants:t,exits:e,type:"observation",event:n}}function Xr(i,t){let e=this,{webqit:r,document:n,Node:o,CharacterData:s,Element:a,HTMLElement:c,HTMLTemplateElement:l,DocumentFragment:u}=e;r.realdom.domInterceptionHooks||Object.defineProperty(r.realdom,"domInterceptionHooks",{value:new Map}),r.realdom.domInterceptionNoRecurse||Object.defineProperty(r.realdom,"domInterceptionNoRecurse",{value:new Map}),r.realdom.domInterceptionHooks.has(i)||r.realdom.domInterceptionHooks.set(i,new Set),r.realdom.domInterceptionHooks.get(i).add(t);let p=()=>r.realdom.domInterceptionHooks.get(i).delete(t);if(r.realdom.domInterceptionHooks?.intercepting)return p;console.warn("DOM mutation APIs are now being intercepted."),r.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(r.realdom,"domInterceptionRecords",{value:new Map});let f=(g,y,x)=>{r.realdom.domInterceptionNoRecurse.set(g,y);let S=x();return r.realdom.domInterceptionNoRecurse.delete(g),S},d=(g,y)=>{g.entrants.concat(g.exits).forEach(S=>{clearTimeout(r.realdom.domInterceptionRecords.get(S)?.timeout),r.realdom.domInterceptionRecords.set(S,g.event);let h=setTimeout(()=>{r.realdom.domInterceptionRecords.delete(S)},0);Object.defineProperty(g.event,"timeout",{value:h,configurable:!0})}),r.realdom.domInterceptionHooks.get("intercept")?.forEach(S=>S(g));let x=y();return r.realdom.domInterceptionHooks.get("sync")?.forEach(S=>S(g)),x},m={ShadowRoot:["innerHTML","setHTMLUnsafe"],DocumentFragment:["replaceChildren","append","prepend"],Document:["replaceChildren","append","prepend"],HTMLElement:["outerText","innerText"],Element:["append","prepend","before","after","insertAdjacentElement","insertAdjacentHTML","remove","replaceChildren","replaceWith","setHTMLUnsafe","innerHTML","outerHTML"],CharacterData:["before","after","remove","replaceWith"],Node:["insertBefore","replaceChild","removeChild","appendChild","textContent","nodeValue"]},w={ShadowRoot:Object.create(null),DocumentFragment:Object.create(null),Document:Object.create(null),HTMLElement:Object.create(null),Element:Object.create(null),CharacterData:Object.create(null),Node:Object.create(null)};return new Set(Object.values(m).reduce((g,y)=>g.concat(y),[])).forEach(g=>{Object.keys(m).forEach(S=>{if(!m[S].includes(g))return;let h=Object.getOwnPropertyDescriptor(e[S].prototype,g);!h||(Object.defineProperty(e[S].prototype,g,"value"in h?{...h,value:y}:{...h,set:x}),w[S][g]=h)});function y(...S){let h=Object.keys(w).find(I=>this instanceof e[I]&&g in w[I]),b=w[h],_=()=>b[g].value.call(this,...S);if(r.realdom.domInterceptionNoRecurse.get(this)===g)return _();let O=[],$=[],T=this;["insertBefore"].includes(g)?$=[S[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(g)?($=[S[1]],["beforebegin","afterend"].includes(S[0])&&(T=this.parentNode)):["setHTMLUnsafe","replaceChildren"].includes(g)?(O=[...this.childNodes],$=g==="replaceChildren"?[...S]:[S[0]]):["replaceWith","remove"].includes(g)?(O=[this],$=g==="replaceWith"?[...S]:[],T=this.parentNode):["replaceChild"].includes(g)?(O=[S[1]],$=[S[0]]):["removeChild"].includes(g)?O=[...S]:($=[...S],["before","after"].includes(g)&&(T=this.parentNode));let R=g;if(["insertAdjacentHTML","setHTMLUnsafe"].includes(g)){let I=this.nodeName;if(g==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(S[0])){if(!this.parentNode)return b[g].value.call(this,...S);I=this.parentNode.nodeName}let P=n.createElement(I.includes("-")?"div":I);b.setHTMLUnsafe.value.call(P,$[0],g==="setHTMLUnsafe"?S[1]:{}),$=[...P.childNodes],g==="insertAdjacentHTML"?(R="insertAdjacentElement",S[1]=new u,f(S[1],"append",()=>S[1].append(...P.childNodes))):(R="replaceChildren",S=[...P.childNodes])}return T?d({target:T,entrants:$,exits:O,type:"interception",event:[this,g]},()=>b[R].value.call(this,...S)):_()}function x(S){let h=Object.keys(w).find(N=>this instanceof e[N]&&g in w[N]),b=w[h],_=()=>b[g].set.call(this,S);if(this instanceof HTMLScriptElement||r.realdom.domInterceptionNoRecurse.get(this)===g)return _();let O=[],$=[],T=this;if(["outerHTML","outerText"].includes(g)?(O=[this],T=this.parentNode):this instanceof l?(T=this.content,O=[...this.content.childNodes]):O=[...this.childNodes],["outerHTML","innerHTML"].includes(g)){let N=this.nodeName;if(g==="outerHTML"){if(!this.parentNode)return _();N=this.parentNode.nodeName}let I=n.createElement(N.includes("-")?"div":N);if(f(I,g,()=>I[g]=S),$=this instanceof l?[...I.content.childNodes]:[...I.childNodes],this instanceof l&&this.hasAttribute("src")||this instanceof ShadowRoot){let P=A=>A.reduce((H,B)=>B instanceof HTMLScriptElement?H.concat(B):B instanceof l?H.concat(P([B.content])):(H=H.concat(P([...B.querySelectorAll?.("template")||[]].map(Q=>Q.content))),H.concat(...B.querySelectorAll?.("script")||[])),[]);for(let A of P($)){if(this instanceof ShadowRoot){A.setAttribute("data-handling","manual");continue}let H=n.createElement("script");[...A.attributes].forEach(B=>H.setAttribute(B.name,B.value)),H.textContent=A.textContent,f(A,"replaceWith",()=>A.replaceWith(H))}}g==="outerHTML"?(S=new u,f(S,"append",()=>S.append(...$)),_=()=>f(this,"replaceWith",()=>a.prototype.replaceWith.call(this,S))):this instanceof l?_=()=>f(this.content,"replaceChildren",()=>this.content.replaceChildren(...$)):_=()=>f(this,"replaceChildren",()=>a.prototype.replaceChildren.call(this,...$))}return d({target:T,entrants:$,exits:O,type:"interception",event:[this,g]},_)}}),p}function Jr(){Gi.call(this),Xi.call(this),Ji.call(this)}function Gi(){let i=this;i.CSS||(i.CSS={}),i.CSS.escape||(i.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function Xi(){let i=this;"isConnected"in i.Node.prototype||Object.defineProperty(i.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function Ji(){let i=this;i.Element.prototype.matches||(i.Element.prototype.matches=i.Element.prototype.matchesSelector||i.Element.prototype.mozMatchesSelector||i.Element.prototype.msMatchesSelector||i.Element.prototype.oMatchesSelector||i.Element.prototype.webkitMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),r=e.length;--r>=0&&e.item(r)!==this;);return r>-1})}function Qr(){let i=this;if(i.webqit||(i.webqit={}),i.webqit.realdom)return i.webqit.realdom;i.webqit.realdom={},Jr.call(i),i.webqit.realdom.meta=(...e)=>Qi.call(i,...e),i.webqit.realdom.ready=(...e)=>ir.call(i,...e),i.webqit.realdom.realtime=(e,r="dom")=>{if(r==="dom")return new ce(e,i);if(r==="attr")return new ht(e,i)};let t=new ae(i);return i.webqit.realdom.schedule=(e,...r)=>t[`on${e}`](...r),i.webqit.realdom.synthesizeWhile=(...e)=>t.synthesizeWhile(...e),i.webqit.realdom}function ir(...i){let t="interactive",e;kt(i[0])?(t=i[0],k(i[1])&&(e=i[1])):k(i[0])&&(e=i[0]);let r={interactive:["interactive","complete"],complete:["complete"]};if(!r[t])throw new Error(`Invalid ready-state timing: ${t}.`);let n=this;if(!e)return n.webqit.realdom.readyStatePromises||(n.webqit.realdom.readyStatePromises={interactive:new Promise(o=>ir.call(this,"interactive",o)),complete:new Promise(o=>ir.call(this,"complete",o))}),n.webqit.realdom.readyStatePromises[t];if(r[t].includes(n.document.readyState))return e(n);n.webqit.realdom.readyStateCallbacks||(n.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},n.document.addEventListener("readystatechange",()=>{let o=n.document.readyState;for(let s of n.webqit.realdom.readyStateCallbacks[o].splice(0))s(n)},!1)),n.webqit.realdom.readyStateCallbacks[t].push(e)}function Qi(i){let t=this,e={},r;return(r=t.document.querySelector(`meta[name="${i}"]`))&&(e=(r.content||"").split(";").filter(n=>n).reduce((n,o)=>{let s=o.split("=").map(a=>a.trim());return tr(n,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:Z(s[1])?parseInt(s[1]):s[1]),n},{})),{get name(){return i},get content(){return r.content},json(){return JSON.parse(JSON.stringify(e))}}}function _e(i,t){return typeof i!="string"?i:i.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+(typeof t!==void 0&&t?e.substr(1).toLowerCase():e.substr(1))})}var E=(i,...t)=>W(i,"oohtml",...t),D={};function X(i,t,e){let r=this,n=Qr.call(r);D.window=r,r.webqitConfig||(r.webqitConfig=n.meta("webqit").json()),r.webqit||(r.webqit={}),r.webqit.oohtml||(r.webqit.oohtml={}),r.webqit.oohtml.configs||(r.webqit.oohtml.configs={});let o=i.toUpperCase().replace("-","_");if(!r.webqit.oohtml.configs[o]){r.webqit.oohtml.configs[o]={};let s=r.webqit.oohtml.configs[o];Xt(2,s,e,t,n.meta(i).json()),r.webqitConfig.prefix&&Object.keys(s).forEach(a=>{Object.keys(s[a]).forEach(c=>{a==="api"&&typeof s[a][c]=="string"?s[a][c]=`${r.webqitConfig.prefix}${_e(s[a][c])}`:["attr","elements"].includes(a)&&s[a][c]?.startsWith("data-")===!1&&(s[a][c]=`${r.webqitConfig.prefix}-${s[a][c]}`)})})}return{config:r.webqit.oohtml.configs[o],realdom:n,window:r}}function or(i,t){return W(i,"realdom","internalAttrInteractions").get(t)}function Zr(i,t,e){let r=W(i,"realdom","internalAttrInteractions").get(t);W(i,"realdom","internalAttrInteractions").set(t,!0);let n=e();return W(i,"realdom","internalAttrInteractions").set(t,r),n}function ft(i,t){return[...i].reduce(([e,r,n],o)=>!e&&r===0&&(Array.isArray(t)?t:[t]).includes(o)?[e,r,[""].concat(n)]:(!e&&["(","[","{"].includes(o)&&!n[0].endsWith("\\")&&r++,!e&&[")","]","}"].includes(o)&&!n[0].endsWith("\\")&&r--,['"',"'","`"].includes(o)&&!n[0].endsWith("\\")&&(e=e===o?null:e||o),n[0]+=o,[e,r,n]),[null,0,[""]])[2].reverse()}var Ki=()=>(0|Math.random()*9e6).toString(36),nr=new Map;function Pt(i){let t;return(t=nr.get(i))||(t=Ki(),nr.set(i,t)),t}function ve(i){let t;return nr.forEach((e,r)=>{e===i&&(t=r)}),t}function Se(){let{window:i}=D,{webqit:t}=i;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class e extends i.Event{constructor(...n){let o=n.pop();if(typeof o!="function")throw new Error("Callback must be provided.");let s=n.pop();if(!s?.kind)throw new Error('"options.kind" must be specified.');let a=["contextrequest","contextclaim"],c=n.pop()||a[0];if(!a.includes(c))throw new Error(`Invalid event type. Must be one of: ${a.join(",")}`);let{kind:l,detail:u,targetContext:p,live:f,signal:d,diff:m,...w}=s;super(c,{...w,bubbles:w.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>o}),Object.defineProperty(this,"kind",{get:()=>l}),Object.defineProperty(this,"targetContext",{get:()=>p}),Object.defineProperty(this,"detail",{get:()=>u}),Object.defineProperty(this,"live",{get:()=>f}),Object.defineProperty(this,"signal",{get:()=>d}),Object.defineProperty(this,"diff",{get:()=>m}),Object.defineProperty(this,"options",{get:()=>w}),Object.defineProperty(this,"meta",{value:{}})}get target(){return super.target||this.meta.target}get answered(){return this.meta.answered||!1}respondWith(n){if(this.meta.answered=!0,this.diff){if("_prevValue"in this&&this._prevValue===n)return;Object.defineProperty(this,"_prevValue",{value:n,configurable:!0})}return this.callback(n)}}return t.DOMContextRequestEvent=e,e}var Tt=class extends AbortController{constructor(t){super(),t(e=>{let{window:{webqit:{Observer:r}}}=D;r.defineProperty(this,"value",{value:e,configurable:!0,enumerable:!0})},this)}};var Ct=class extends Error{};var mt=class{static instance(t){return E(t).get("contexts::instance")||new this(t)}constructor(t){E(t).get("contexts::instance")?.dispose(),E(t).set("contexts::instance",this);let e={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>e})}[Symbol.iterator](){return this["#"].contexts[Symbol.iterator]()}get length(){return this["#"].contexts.size}find(...t){return[...this["#"].contexts].find(e=>typeof t[0]=="function"?t[0](e):e.constructor.kind===t[0]&&(!t[1]||e.detail===t[1]))}attach(t){if(!(t instanceof J))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new Ct(`Context of same kind "${t.constructor.kind}"${t.detail?` and detail "${t.detail}"`:""} already exists.`);this["#"].contexts.add(t),t.initialize(this["#"].host)}detach(t){t.dispose(this["#"].host),this["#"].contexts.delete(t)}request(...t){return new Tt((e,r)=>{typeof t[t.length-1]!="function"&&(t[t.length-1]?t.push(e):t[t.length-1]=e);let n;(n=t.find(s=>typeof s=="object"&&s))&&n.live&&(n.signal&&n.signal.addEventListener("abort",()=>r.abort()),t[t.indexOf(n)]={...n,signal:r.signal});let o=new(Se())(...t);this["#"].host.dispatchEvent(o)})}};var sr=class{static createRequest(){return{kind:this.kind}}constructor(t=null){Object.defineProperty(this,"detail",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get configs(){let{window:{webqit:{oohtml:{configs:t}}}}=D;return t}get name(){return[D.window.Document,D.window.ShadowRoot].some(t=>this.host instanceof t)?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(!(t.detail instanceof sr)||t.target===this.host)return;let e=new Set;if(this.subscriptions.forEach(r=>{!t.target.contains(r.target)||!t.detail.matchEvent(r)||(this.subscriptions.delete(r),this.unsubscribed(r),e.add(r))}),e.size)return t.respondWith(e)}if(t.type==="contextrequest")return this.matchEvent(t)?(t.live&&(this.subscriptions.add(t),this.subscribed(t),t.signal?.addEventListener("abort",()=>{this.subscriptions.delete(t),this.unsubscribed(t)})),t.stopPropagation(),this.handle(t)):void 0}}initialize(t){this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this);let{value:e}=mt.instance(t).request("contextclaim",{kind:this.constructor.kind,detail:this});return e?.forEach(r=>{this.subscriptions.add(r),this.subscribed(r),this.handle(r)}),this}dispose(t){return this.disposed=!0,t.removeEventListener("contextrequest",this),t.removeEventListener("contextclaim",this),this.subscriptions.forEach(e=>{this.subscriptions.delete(e),this.unsubscribed(e);let{target:r}=e;e.meta.answered=!1,r.dispatchEvent(e)}),this}},J=sr;V(J,"kind");var Ht=class extends J{static createRequest(t=null){let e=super.createRequest();if(t?.startsWith("@")){let[r,...n]=n.slice(1).split("/").map(o=>o.trim());e.targetContext=r,e.detail=n.join("/")}else e.detail=t;return e}get namespaceObj(){return this.host[this.configs.NAMESPACED_HTML.api.namespace]}handle(t){let{window:{webqit:{Observer:e}}}=D;if(t.meta.controller?.abort(),!(t.detail||"").trim())return t.respondWith(e.unproxy(this.namespaceObj));let r=(t.detail||"").split("/").map(n=>n.trim()).filter(n=>n);if(!r.length)return t.respondWith();r=r.join(`/${this.configs.NAMESPACED_HTML.api.namespace}/`)?.split("/")||[],t.meta.controller=e.reduce(this.namespaceObj,r,e.get,n=>{this.disposed||t.respondWith(n.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};V(Ht,"kind","namespace");function ar(i={}){let{config:t,window:e}=X.call(this,"namespaced-html",i,{attr:{namespace:"namespace",lid:"id"},api:{namespace:"namespace"},tokens:{lidrefPrefix:"~",lidrefSeparator:":"},target:{className:":target",eventName:":target",scrolling:!0}});t.lidSelector=`[${e.CSS.escape(t.attr.lid)}]`,t.namespaceSelector=`[${e.CSS.escape(t.attr.namespace)}]`,e.webqit.DOMNamingContext=Ht,tn.call(e,t),en.call(e,t)}function Kr(i){let{lidrefPrefix:t,lidrefSeparator:e}=i.tokens;return{escape(r,n=1){return[...r].map(o=>/\w/.test(o)?o:n===2?`\\\\${o}`:`\\${o}`).join("")},lidrefPrefix(r=0){return r?this.escape(t,r):t},lidrefSeparator(r=0){return r?this.escape(e,r):e},isUuid(r,n=0){return r.startsWith(this.lidrefPrefix(n))&&r.includes(this.lidrefSeparator(n))},toUuid(r,n,o=0){return r.endsWith("-root")?n:`${this.lidrefPrefix(o)}${r}${this.lidrefSeparator(o)}${n}`},uuidToId(r,n=0){return this.isUuid(r)?r.split(this.lidrefSeparator(n))[1]:r},uuidToLidref(r,n=0){return this.isUuid(r)?`${this.lidrefPrefix(n)}${r.split(this.lidrefSeparator(n))[1]}`:r}}}function lr(i,t,e=null,r=0){let n=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:o}}}}=n,s=Kr(o),a=new RegExp(`${e?":scope|":""}#(${s.lidrefPrefix(r+1)})?([\\w]+${s.lidrefSeparator(r+1)})?((?:[\\w-]|\\\\.)+)`,"g"),[c,l]=ft(i,",").reduce(([p,f],d)=>{let m,w;return d=d.replace(a,(v,g,y,x,S)=>{if(m||(m=[...d.matchAll(/(["'])(?:(?=(\\?))\2.)*?\1/g)]),m.some(O=>S>O.index&&S+v.length<O.index+O[0].length))return v;if(v===":scope")return w=!0,e;let h=g&&!y;if(g&&y)return`#${s.escape(v.replace("#",""),1)}`;if(h&&o.attr.lid==="id"&&t&&!t.endsWith("-root"))return`#${s.toUuid(t,x,1)}`;let _;return o.attr.lid==="id"?_=`:is(#${x},[id^="${s.lidrefPrefix(r)}"][id$="${s.lidrefSeparator(r)}${x}"])`:_=`:is(#${x},[${n.CSS.escape(o.attr.lid)}="${x}"])`,h?`:is(${_}):not(${e?e+" ":""}${o.namespaceSelector} *)`:_}),w?[p,f.concat(d)]:[p.concat(d),f]},[[],[]]),u;return e&&c.length?u=[c.length>1?`${e} :is(${c.join(", ")})`:`${e} ${c[0]}`,l.join(", ")].filter(p=>p).join(", "):u=[...c,...l].join(", "),u}function Oe(i){let t=this;if(!E(i).has("namespace")){let e=Object.create(null);E(i).set("namespace",e);let r=[t.Document,t.ShadowRoot].some(n=>i instanceof n);Object.defineProperty(e,Symbol.toStringTag,{get(){return r?"RootNamespaceRegistry":"NamespaceRegistry"}})}return E(i).get("namespace")}function Ft(i,t=!1){let e=this,{webqit:{oohtml:{configs:{NAMESPACED_HTML:r}}}}=e,n=[e.Document,e.ShadowRoot].some(o=>i instanceof o);return Oe.call(e,n?i:(t?i.parentNode:i)?.closest?.(r.namespaceSelector)||i.getRootNode())}function $e(i){let t=Object.prototype.toString.call(i)==="[object RootNamespaceRegistry]";return(ve(i)||Pt(i))+(t?"-root":"")}function tn(i){let t=this,{webqit:{Observer:e}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let n=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.namespace in r)throw new Error(`The ${n} prototype already has a "${i.api.namespace}" API!`);Object.defineProperty(r,i.api.namespace,{get:function(){return e.proxy(Oe.call(t,this))}})})}function en(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},DOMNamingContext:o}}=t,s=["aria-owns","aria-controls","aria-labelledby","aria-describedby","aria-flowto"],a=["for","list","form","aria-activedescendant","aria-details","aria-errormessage","popovertarget"],c=[i.attr.lid,...s,...a],l={id:"id",for:"htmlFor","aria-owns":"ariaOwns","aria-controls":"ariaControls","aria-labelledby":"ariaLabelledBy","aria-describedby":"ariaDescribedBy","aria-flowto":"ariaFlowto","aria-activedescendant":"ariaActiveDescendant","aria-details":"ariaDetails","aria-errormessage":"ariaErrorMessage",popovertarget:"popoverTargetElement"},u=Kr(i),p=(h,b,_)=>{if(!or(h,b)&&E(h,"attrOriginals").has(b))return E(h,"attrOriginals").get(b);let O=_();return or(h,b)?O:O&&O.split(" ").map($=>($=$.trim())&&(b===i.attr.lid?u.uuidToId:u.uuidToLidref).call(u,$)).join(" ")},f=Object.getOwnPropertyDescriptor(t.Document.prototype,"getElementById");Object.defineProperty(t.Document.prototype,"getElementById",{...f,value(h){return this.querySelector(`#${h}`)}});for(let h of["querySelector","querySelectorAll"])for(let b of[t.Document,t.Element]){let _=Object.getOwnPropertyDescriptor(b.prototype,h);Object.defineProperty(b.prototype,h,{..._,value(O){return _.value.call(this,lr.call(t,O,$e(Oe.call(t,this))))}})}let d=Object.getOwnPropertyDescriptor(t.Element.prototype,"getAttribute");Object.defineProperty(t.Element.prototype,"getAttribute",{...d,value(h){let b=()=>d.value.call(this,h);return c.includes(h)&&!E(this,"lock").get(h)?p(this,h,b):b()}});let m=Object.getOwnPropertyDescriptor(t.Attr.prototype,"value");Object.defineProperty(t.Attr.prototype,"value",{...m,get(){let h=()=>m.get.call(this);return c.includes(this.name)?p(this.ownerElement,this.name,h):h()}});let w=Object.getOwnPropertyDescriptor(t.Node.prototype,"nodeValue");Object.defineProperty(t.Node.prototype,"nodeValue",{...w,get(){let h=()=>w.get.call(this);return this instanceof t.Attr&&c.includes(this.name)?p(this.ownerElement,this.name,h):h()}});for(let h of c){if(!(h in l))continue;let b=h==="for"?[t.HTMLLabelElement,t.HTMLOutputElement]:h==="popovertarget"?[t.HTMLButtonElement,t.HTMLInputElement]:[t.Element];for(let _ of b){let O=Object.getOwnPropertyDescriptor(_.prototype,l[h]);!O||Object.defineProperty(_.prototype,l[h],{...O,get(){return p(this,h,()=>O.get.call(this,h))}})}}i.attr.lid!=="id"&&Object.defineProperty(t.Element.prototype,i.attr.lid,{configurable:!0,enumerable:!0,get(){return this.getAttribute(i.attr.lid)},set(h){return this.setAttribute(i.attr.lid,h)}});let v=(h,b,_,O)=>Zr(h,b,()=>(typeof _=="function"&&(_=_()),O(_))),g=(h,b,_,O=null)=>{v(h,b,_,$=>{let T=b===i.attr.lid,R=O||Ft.call(t,h,T),N=$e(R);if(T){let I=u.uuidToId($);if(e.get(R,I)!==h){let P=u.toUuid(N,I);P!==$&&h.setAttribute("id",P),e.set(R,I,h)}}else{E(h,"attrOriginals").set(b,$);let I=$.split(" ").map(P=>(P=P.trim())&&u.isUuid(P)?P:u.toUuid(N,P)).join(" ");h.setAttribute(b,I),E(R).set("idrefs",E(R).get("idrefs")||new Set),E(R).get("idrefs").add(h)}})},y=(h,b,_,O=null)=>{v(h,b,_,$=>{let T=b===i.attr.lid,R=O||Ft.call(t,h,T);if(T){let N=u.uuidToId($);e.get(R,N)===h&&e.deleteProperty(R,N)}else{let N=E(h,"attrOriginals").get(b);h.hasAttribute(b)&&h.setAttribute(b,N),E(R).get("idrefs")?.delete(h)}})};r.realtime(t.document).query(i.namespaceSelector,h=>{let b=(_,O,$,T)=>{if(!_.hasAttribute(O))return;let R=()=>_.getAttribute(O);y(_,O,R,$),_.isConnected&&g(_,O,E(_,"attrOriginals").get(O)||R,T)};h.exits.forEach(_=>{if(_.isConnected){let T=Oe.call(t,_);for(let R of new Set([...Object.values(T),...E(T).get("idrefs")||[]]))for(let N of c)b(R,N,T)}let O=_[n.CONTEXT_API.api.contexts],$=O.find(o.kind);$&&O.detach($)}),h.entrants.forEach(_=>{let O,$=Ft.call(t,_,!0);for(let R of new Set([...Object.values($),...E($).get("idrefs")||[]]))if((O=Ft.call(t,R,!0))!==$)for(let N of c)b(R,N,$,O);let T=_[n.CONTEXT_API.api.contexts];T.find(o.kind)||T.attach(new o)})},{id:"namespace-html:namespace",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(`[${c.map(h=>t.CSS.escape(h)).join("],[")}]`,h=>{let b={forID:new Map,forOther:new Map};for(let _ of c){let O=_===i.attr.lid?b.forID:b.forOther;h.exits.forEach($=>{if(!$.hasAttribute(_))return;let T=O.get($);typeof T>"u"&&(T=(_===i.attr.lid?$.parentNode:$)?.closest?.(i.namespaceSelector)||$.getRootNode().host,O.set($,T)),!(T&&!T.isConnected)&&y($,_,()=>$.getAttribute(_))}),h.entrants.forEach($=>{!$.hasAttribute(_)||g($,_,()=>$.getAttribute(_))})}b.forID.clear(),b.forOther.clear()},{id:"namespace-html:attrs",live:!0,subtree:"cross-roots",timing:"sync"}),r.realtime(t.document,"attr").observe(c,h=>{for(let b of h)b.oldValue&&b.value!==b.oldValue&&y(b.target,b.name,b.oldValue),b.value&&b.value!==b.oldValue&&g(b.target,b.name,b.value)},{id:"namespace-html:attr(attrs)",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0});let x,S=()=>{if(!t.location.hash?.startsWith(`#${u.lidrefPrefix()}`))return;let h=t.location.hash?.substring(`#${u.lidrefPrefix()}`.length).split("/").map(_=>_.trim()).filter(_=>_)||[],b=h.reduce((_,O)=>_&&_[i.api.namespace][O],t.document);x&&i.target.className&&x.classList.toggle(i.target.className,!1),b&&b!==t.document&&(i.target.className&&b.classList.toggle(i.target.className,!0),i.target.eventName&&b.dispatchEvent(new t.CustomEvent(i.target.eventName)),i.target.scrolling&&h.length>1&&b.scrollIntoView(),x=b)};t.addEventListener("hashchange",S),r.ready(S)}function cr({advanced:i={},...t}){let{config:e,window:r}=X.call(this,"scoped-js",t,{script:{retention:"retain",mimeTypes:"module|text/javascript|application/javascript",timing:"auto"},api:{scripts:"scripts"},advanced:Rt(i)}),n=Array.isArray(e.script.mimeTypes)?e.script.mimeTypes:e.script.mimeTypes.split("|").filter(o=>o);e.scriptSelector=n.map(o=>`script[type="${r.CSS.escape(o)}"]:not([oohtmlignore])`).concat("script:not([type])").join(","),r.webqit.oohtml.Script={compileCache:[new Map,new Map],execute:nn.bind(r,e)},rn.call(r,e),on.call(r,e)}function rn(i){let t=this,{webqit:{nextKeyword:e,matchPrologDirective:r}}=t,n=new Map;if(i.api.scripts in t.Element.prototype)throw new Error(`The "Element" class already has a "${i.api.scripts}" property!`);[t.ShadowRoot.prototype,t.Element.prototype].forEach(o=>{Object.defineProperty(o,i.api.scripts,{get:function(){return n.has(this)||n.set(this,[]),n.get(this)}})}),Object.defineProperties(t.HTMLScriptElement.prototype,{scoped:{configurable:!0,get(){return this.hasAttribute("scoped")},set(o){this.toggleAttribute("scoped",o)}},live:{configurable:!0,get(){if(this.liveProgramHandle)return!0;let o=e(this.oohtml__textContent||this.textContent||"",0,0);return r(o,!0)}}})}async function nn(i,t){let e=this,{realdom:r}=e.webqit,n=ve(t);if(!n)throw new Error("Argument must be a valid exec hash.");let{script:o,compiledScript:s,thisContext:a}=n;i.script.retention==="dispose"?o.remove():i.script.retention==="hidden"?o.textContent='"source hidden"':setTimeout(async()=>{o.textContent=await s.toString()},0);let c=o.scoped?a:o.getRootNode();E(c).has("scriptEnv")||E(c).set("scriptEnv",Object.create(null));let l=await(await s.bind(a,E(c).get("scriptEnv"))).execute();o.live&&Object.defineProperty(o,"liveProgramHandle",{value:l}),r.realtime(e.document).observe(o,()=>{o.live&&l.abort(),a instanceof e.Element&&a[i.api.scripts]?.splice(a[i.api.scripts].indexOf(o,1))},{id:"scoped-js:script-exits",subtree:"cross-roots",timing:"sync",generation:"exits"})}function on(i){let t=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,e=this,{webqit:{oohtml:r,realdom:n}}=e;e.HTMLScriptElement.supports||(e.HTMLScriptElement.supports=s=>["text/javascript","application/javascript"].includes(s));let o=new WeakSet;n.realtime(e.document).query(i.scriptSelector,s=>{s.entrants.forEach(a=>{if(o.has(a)||a.hasAttribute("oohtmlno")||!t&&!a.hasAttribute("ssr"))return;let c=ti.call(e,i,a);if(!c)return;o.add(a);let l=a.scoped?a.parentNode||s.target:a.type==="module"?void 0:e;a.scoped&&l[i.api.scripts].push(a);let u=Pt({script:a,compiledScript:c,thisContext:l});s.type==="query"||a.type&&!e.HTMLScriptElement.supports(a.type)||a.getAttribute("data-handling")==="manual"||i.script.timing==="manual"?r.Script.execute(u):a.textContent=`webqit.oohtml.Script.execute( '${u}' );`})},{id:"scoped-js:script-entries",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants",eventDetails:!0})}function ti(i,t){let e=this,{webqit:{oohtml:r,LiveScript:n,AsyncLiveScript:o,LiveModule:s}}=e,a=t.textContent.trim();if(a.startsWith("/*@oohtml*/if(false){")&&a.endsWith("}/*@oohtml*/")&&(a=a.slice(21,-12),Object.defineProperty(t,"oohtml__textContent",{value:a})),!a.trim().length)return;let c=Pt(a),l=r.Script.compileCache[t.live?0:1],u;if(!(u=l.get(c))){let{parserParams:p,compilerParams:f,runtimeParams:d}=i.advanced;u=new(t.type==="module"?s:n||o)(a,{liveMode:t.live,exportNamespace:`#${t.id}`,fileName:`${e.document.url?.split("#")?.[0]||""}#${t.id}`,parserParams:p,compilerParams:f,runtimeParams:d}),l.set(c,u)}return u}function ei(i){let t=this,{webqit:{oohtml:{configs:{SCOPED_JS:e}}}}=t;[...i?.querySelectorAll(e.scriptSelector)||[]].forEach(r=>{ti.call(t,e,r)})}function pr(i={}){let{config:t,window:e}=X.call(this,"data-binding",i,{attr:{render:"render",itemIndex:"data-key"},tokens:{nodeType:"processing-instruction",tagStart:"?{",tagEnd:"}?",stateStart:"; [=",stateEnd:"]"},advanced:Rt({runtimeParams:{spec:{handler:n=>{}}}})});({CONTEXT_API:t.CONTEXT_API,BINDINGS_API:t.BINDINGS_API,HTML_IMPORTS:t.HTML_IMPORTS}=e.webqit.oohtml.configs),t.attrSelector=`[${e.CSS.escape(t.attr.render)}]`;let r=(n,o)=>{let s=`starts-with(., "${n}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.discreteBindingsSelector=`comment()[${r(t.tokens.tagStart,t.tokens.tagEnd)}]`,sn.call(e,t)}function sn(i){let t=this,{webqit:{realdom:e}}=t;e.realtime(t.document).query(i.attrSelector,r=>{ri.call(this,...r.exits),ln.call(t,i,...r.entrants),queueMicrotask(()=>{})},{id:"data-binding:attr",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0,staticSensitivity:!0}),e.realtime(t.document).query(`(${i.discreteBindingsSelector})`,r=>{ri.call(this,...r.exits),an.call(t,i,...r.entrants),queueMicrotask(()=>{})},{id:"data-binding:descrete",live:!0,subtree:"cross-roots",timing:"sync"})}function ii(i,t){let{webqit:{realdom:e,Observer:r,DOMBindingsContext:n}}=this;if(E(t).has("data-binding"))return E(t).get("data-binding");let o=Object.create(null),s=new AbortController;o.$exec__=(c,l,...u)=>{(()=>{try{c[l](...u)}catch(f){throw new Error(`Error executing "${l}()": ${f.message} at ${f.cause}`)}})()},o.$assign__=(c,l,u)=>{(()=>{try{c[l]=u}catch(f){throw new Error(`Error executing "${l} = ${u}": ${f.message} at ${f.cause}`)}})()},r.intercept(o,{get:(c,l,u)=>{if(!(c.key in o)){let p={...n.createRequest(c.key),live:!0,signal:s.signal};t[i.CONTEXT_API.api.contexts].request(p,f=>{r.set(o,c.key,f)})}return u(o[c.key]??(c.key in globalThis?globalThis[c.key]:void 0))},has:(c,l,u)=>u(!0)});let a={scope:o,abortController:s,bindings:new Map};return E(t).set("data-binding",a),a}function ri(...i){for(let t of i){let e=t.nodeName==="#text"?t.parentNode:t,{bindings:r,abortController:n}=E(e).get("data-binding")||{};if(!r?.has(t))return;r.get(t).liveProgramHandle.abort(),r.get(t).signals?.forEach(o=>o.abort()),r.delete(t),r.size||(n.abort(),E(e).delete("data-binding"))}}function ni(i,t){let e=i.tokens.tagStart.split("").map(l=>`\\${l}`).join(""),r=i.tokens.tagEnd.split("").map(l=>`\\${l}`).join(""),n=i.tokens.stateStart.split("").map(l=>l===" "?"(?:\\s+)?":`\\${l}`).join(""),o=i.tokens.stateEnd.split("").map(l=>`\\${l}`).join(""),s=`^${e}(.*?)(?:${n}(\\d+)${o}(?:\\s+)?)?${r}$`,[,a,c]=t.match(new RegExp(s));return{raw:t,expr:a,span:parseInt(c??0)}}async function an(i,...t){let e=this,r=t.reduce((n,o)=>{if(o.isBound)return n;let s=ni(i,o.nodeValue),a=o;if(s.span){if(a=o.nextSibling,a?.nodeName!=="#text"||a.nodeValue.length<s.span)return n;a.nodeValue.length>s.span&&a.splitText(s.span)}else a=o.ownerDocument.createTextNode(""),o.after(a);a.isBound=!0;let c=o;return e.webqit.env!=="server"&&(c.remove(),c=null),n.concat({textNode:a,template:s,anchorNode:c})},[]);for(let{textNode:n,template:o,anchorNode:s}of r){let a=oi.call(e,i,o.expr),{scope:c,bindings:l}=ii.call(this,i,n.parentNode);Object.defineProperty(n,"$oohtml_internal_databinding_anchorNode",{value:s,configurable:!0});try{l.set(n,{liveProgramHandle:await(await a.bind(n,c)).execute()})}catch(u){console.log(u)}}}var ur=new Map;function oi(i,t){if(ur.has(t))return ur.get(t);let e=`let content = ((${t}) ?? '') + '';`;e+="$assign__(this, 'nodeValue', content);",e+=`if ( this.$oohtml_internal_databinding_anchorNode ) { $assign__(this.$oohtml_internal_databinding_anchorNode, 'nodeValue', "${i.tokens.tagStart}${Wt(t)}${i.tokens.stateStart}" + content.length + "${i.tokens.stateEnd} ${i.tokens.tagEnd}"); }`;let{webqit:{LiveScript:r,AsyncLiveScript:n}}=this,{parserParams:o,compilerParams:s,runtimeParams:a}=i.advanced,c=new(r||n)(e,{parserParams:o,compilerParams:s,runtimeParams:a});return ur.set(t,c),c}async function ln(i,...t){for(let e of t){let r=si.call(this,i,e.getAttribute(i.attr.render)),{scope:n,bindings:o}=ii.call(this,i,e),s=[];Object.defineProperty(e,"$oohtml_internal_databinding_signals",{value:s,configurable:!0});try{o.set(e,{signals:s,liveProgramHandle:await(await r.bind(e,n)).execute()})}catch(a){console.log(a)}}}var fr=new Map;function si(i,t){if(fr.has(t))return fr.get(t);let e={},r=-1,n=ft(t,";").map(p=>{let[f,d]=ft(p,":").map(y=>y.trim()),m=f[0],w=f.slice(1).trim(),v=`(${d})`,g=`(${v} ?? '')`;if(m==="&")return w.startsWith("--")?`$exec__(this.style, 'setProperty', "${Wt(w)}", ${g});`:`$assign__(this.style, "${Wt(w)}", ${g});`;if(m==="%")return`$exec__(this.classList, 'toggle', "${Wt(w)}", !!${v});`;if(m==="~")return w.startsWith("?")?`$exec__(this, 'toggleAttribute', "${Wt(w.substring(1).trim())}", !!${v});`:`$exec__(this, 'setAttribute', "${Wt(w)}", ${g});`;if(m==="#"){if(e[w])throw new Error(`Duplicate binding: ${f}.`);if(e[w]=!0,w==="text")return`$assign__(this, 'textContent', ${g});`;if(w==="html")return`$assign__(this, 'innerHTML', ${g});`;if(w==="items"){let[y,x]=ft(d,"/");if(!x)throw new Error(`Invalid ${m}items spec: ${p}; no import specifier.`);let[S,h,b,_]=y.trim().match(/(.*?[\)\s+])(of|in)([\(\{\[\s+].*)/i)||[];if(!S)throw new Error(`Invalid ${m}items spec: ${p}.`);if(h.startsWith("(")?h=h.trim().slice(1,-1).split(",").map(T=>T.trim()):h=[h],h.length>(b==="in"?3:2))throw new Error(`Invalid ${m}items spec: ${p}.`);let O=b==="in"?h[2]:h[1]||"$index__";return`
|
|
30
30
|
let $iteratee__ = ${_};
|
|
31
31
|
let $import__ = this.${i.HTML_IMPORTS.api.import}( ${x.trim()}, true );
|
|
32
32
|
this.$oohtml_internal_databinding_signals?.push( $import__ );
|
|
@@ -63,9 +63,9 @@ ${o?` "use live";
|
|
|
63
63
|
const abort${r} = () => this.removeEventListener( '${w}', handler${r} );
|
|
64
64
|
this.$oohtml_internal_databinding_signals?.push( { abort: abort${r} } );
|
|
65
65
|
`;if(m==="$")return`$exec__(this, '${w}', ${v});`;if(p.trim())throw new Error(`Invalid binding: ${p}.`)}).join(`
|
|
66
|
-
`),{webqit:{LiveScript:o,AsyncLiveScript:s}}=this,{parserParams:a,compilerParams:c,runtimeParams:l}=i.advanced,u=new(o||s)(n,{parserParams:a,compilerParams:c,runtimeParams:l});return fr.set(t,u),u}var Wt=i=>i.replace(/"/g,'\\"');function ai(i){let t=this,{webqit:{oohtml:{configs:{DATA_BINDING:e}}}}=t;(i?.matches(e.attrSelector)?[i]:[]).concat([...i?.querySelectorAll(e.attrSelector)||[]]).forEach(r=>{si.call(t,e,r.getAttribute(e.attr.render))}),Lt(t,i,`(${e.discreteBindingsSelector})`).forEach(r=>{let n=ni(e,r.nodeValue);oi.call(t,e,n.expr)})}var et=class extends J{static createRequest(t=null){let e=super.createRequest();if(t?.startsWith("@")){let[r,...n]=n.slice(1).split(".").map(o=>o.trim());e.targetContext=r,e.detail=n.join(".")}else e.detail=t;return e}get bindingsObj(){return this.host[this.configs.BINDINGS_API.api.bindings]}matchEvent(t){return super.matchEvent(t)&&(!t.detail||!this.detail||(Array.isArray(t.detail)?t.detail[0]===this.detail:t.detail===this.detail))}handle(t){if(t.meta.controller?.abort(),!(t.detail+"").trim())return t.respondWith(this.bindingsObj);let{window:{webqit:{Observer:e}}}=D;t.meta.controller=e.reduce(this.bindingsObj,Array.isArray(t.detail)?t.detail:[t.detail],e.get,r=>{this.disposed||t.respondWith(r.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};V(et,"kind","bindings");function dr(i={}){let{config:t,window:e}=X.call(this,"bindings-api",i,{attr:{bindingsreflection:"bindings"},api:{bind:"bind",bindings:"bindings"}});e.webqit.DOMBindingsContext=et,un.call(e,t),pn.call(e,t)}function hr(i,t){let e=this,{webqit:{Observer:r,oohtml:{configs:{CONTEXT_API:n}}}}=e;if(!E(t).has("bindings")){let o=Object.create(null);E(t).set("bindings",o),r.observe(o,s=>{if(t instanceof e.Element){let a=Ee(t.getAttribute(i.attr.bindingsreflection)||""),c=new Map(a);for(let l of s)l.detail?.publish!==!1&&(l.type==="delete"?a.delete(l.key):a.set(l.key,void 0));a.size&&a.size!==c.size?t.setAttribute(i.attr.bindingsreflection,`{ ${[...a.entries()].map(([l,u])=>u===void 0?l:`${l}: ${u}`).join(", ")} }`):a.size||t.toggleAttribute(i.attr.bindingsreflection,!1)}else{let a=t[n.api.contexts];for(let c of s)if(c.type==="delete"){let l=a.find(et.kind,c.key);l&&a.detach(l)}else a.find(et.kind,c.key)||a.attach(new et(c.key))}})}return E(t).get("bindings")}function un(i){let t=this,{webqit:{Observer:e}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let n=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.bind in r)throw new Error(`The ${n} prototype already has a "${i.api.bind}" API!`);if(i.api.bindings in r)throw new Error(`The ${n} prototype already has a "${i.api.bindings}" API!`);Object.defineProperty(r,i.api.bind,{value:function(o,s={}){return fn.call(t,i,this,o,s)}}),Object.defineProperty(r,i.api.bindings,{get:function(){return e.proxy(hr.call(t,i,this))}})})}function fn(i,t,e,{merge:r,diff:n,publish:o,namespace:s}={}){let a=this,{webqit:{Observer:c}}=a,l=hr.call(this,i,t),u={diff:n,namespace:s,detail:{publish:o}},p=r?[]:Object.keys(l).filter(f=>!(f in e));return c.batch(l,()=>(p.length&&c.deleteProperties(l,p,u),c.set(l,e,u)),u)}function pn(i){let t=this,{webqit:{realdom:e,Observer:r,oohtml:{configs:n}}}=t,o=(a,c)=>{let l=a[n.CONTEXT_API.api.contexts];l.find(et.kind,c)||l.attach(new et(c))},s=(a,c)=>{let l,u=a[n.CONTEXT_API.api.contexts];for(;l=u.find(et.kind,c);)u.detach(l)};e.realtime(t.document).query(`[${t.CSS.escape(i.attr.bindingsreflection)}]`,a=>{a.exits.forEach(c=>s(c)),a.entrants.forEach(c=>{let l=Ee(c.getAttribute(i.attr.bindingsreflection)||""),u=[...l.entries()].filter(([p,f])=>f!==void 0);u.length&&c[i.api.bind](Object.fromEntries(u),{merge:!0,publish:!1});for(let[p]of l)o(c,p)})},{id:"bindings:dom",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0}),e.realtime(t.document,"attr").observe(i.attr.bindingsreflection,a=>{let c=hr.call(t,i,a.target),l=Ee(a.value||""),u=Ee(a.oldValue||"");for(let p of new Set([...l.keys(),...u.keys()]))u.has(p)?l.has(p)?l.get(p)!==u.get(p)&&r.set(c,p,l.get(p),{detail:{publish:!1}}):(u.get(p)!==void 0&&r.deleteProperty(c,p,{detail:{publish:!1}}),s(a.target,p)):(l.get(p)!==void 0&&r.set(c,p,l.get(p),{detail:{publish:!1}}),o(a.target,p))},{id:"bindings:attr",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0})}var Ee=i=>(i=i.trim(),new Map(ft(i.slice(1,-1),",").filter(t=>t.trim()).map(t=>ft(t,":").map(e=>e.trim()))));var st=class{static instance(t){return E(t).get("defsmanager::instance")||new this(t)}constructor(t,e=null,r=0){let{window:n}=D,{webqit:{realdom:o,oohtml:{configs:s}}}=n;E(t).get("defsmanager::instance")?.dispose(),E(t).set("defsmanager::instance",this),this.window=n,this.host=t,this.config=s.HTML_IMPORTS,this.parent=e,this.level=r,this.defs=pt(this.host),this.defId=(this.host.getAttribute(this.config.attr.def)||"").trim(),this.validateDefId(this.defId),this.realtimeA=o.realtime(this.host.content).children(a=>{this.expose(a.exits,!1),this.expose(a.entrants,!0)},{live:!0,timing:"sync"}),this.realtimeB=o.realtime(this.host).attr(["src","loading"],(...a)=>this.evaluateLoading(...a),{live:!0,atomic:!0,timing:"sync",lifecycleSignals:!0}),this.realtimeC=this.evalInheritance()}validateDefId(t){if(["@","/","*","#"].some(e=>t.includes(e)))throw new Error(`The export ID "${t}" contains an invalid character.`)}expose(t,e){let{window:r}=D,{webqit:{Observer:n}}=r,o,s=this.defs["#"]||[];t.forEach(a=>{if(!a||a.nodeType!==1)return;let c=a.matches(this.config.templateSelector),l=(a.getAttribute(c?this.config.attr.def:this.config.attr.fragmentdef)||"").trim();e?(c&&l?new st(a,this.host,this.level+1):(s.push(a),o=!0,typeof requestIdleCallback=="function"&&requestIdleCallback(()=>{this.config.idleCompilers?.forEach(u=>u.call(this.window,a))})),l&&(this.validateDefId(l),n.set(this.defs,(!c&&"#"||"")+l,a))):(c&&l?st.instance(a).dispose():(s=s.filter(u=>u!==a),o=!0),l&&n.deleteProperty(this.defs,(!c&&"#"||"")+l))}),o&&n.set(this.defs,"#",s)}evaluateLoading([t,e],{signal:r}){let{window:{webqit:{Observer:n}}}=D,o=(t.value||"").trim();if(!o)return;let s,a=u=>{if(!u)return s;s=u.then(()=>l.remove())},c=(e.value||"").trim(),l=n.intercept(this.defs,"get",async(u,p,f)=>(c==="lazy"&&a(this.load(o,!0)),await a(),f()),{signal:r});c!=="lazy"&&a(this.load(o))}#t=new Set;#e;load(t){let{window:e}=D;if(this.#t.has(t)||(this.#t.add(t),this.#t.size===1&&this.host.content.children.length))return Promise.resolve();this.#e?.controller.abort();let r=new AbortController,n=(s,a)=>this.host.dispatchEvent(new e.CustomEvent(s,{detail:a})),o=e.fetch(t,{signal:r.signal,element:this.host}).then(s=>s.ok?s.text():Promise.reject(s.statusText)).then(s=>(this.host.innerHTML=s.trim(),n("load"),this.host)).catch(s=>(console.error(`Error fetching the bundle at "${t}": ${s.message}`),this.#e=null,n("loaderror"),this.host));return this.#e={request:o,controller:r},o}evalInheritance(){if(!this.parent)return[];let{window:{webqit:{Observer:t}}}=D,e=(this.host.getAttribute(this.config.attr.extends)||"").trim(),r=(this.host.getAttribute(this.config.attr.inherits)||"").trim().split(" ").map(a=>a.trim()).filter(a=>a),n=a=>{a.forEach(c=>{t.get(this.defs,c.key)===c.oldValue&&(["get","set","def"].includes(c.type)?t[c.type.replace("get","set")](this.defs,c.key,c.value):c.type==="delete"&&t.deleteProperty(this.defs,c.key))})},o=[],s=pt(this.parent);return e&&o.push(t.reduce(s,[e,this.config.api.defs,1/0],t.get,n,{live:!0})),r.length&&o.push(t.get(s,r.includes("*")?1/0:r,n,{live:!0})),o}dispose(){this.realtimeA.disconnect(),this.realtimeB.disconnect(),this.realtimeC.forEach(t=>t instanceof Promise?t.then(e=>e.abort()):t.abort()),Object.entries(this.defs).forEach(([t,e])=>{t.startsWith("#")||st.instance(e).dispose()})}};var gt,Y,zt,Bt,dt=class extends J{constructor(){super(...arguments);Ut(this,gt,{});Ut(this,Y,void 0);Ut(this,zt,void 0);Ut(this,Bt,void 0)}static createRequest(e=null){let r=super.createRequest();if(e?.startsWith("/"))r.detail=e,r.targetContext=1/0;else if(e?.startsWith("@")){let[n,...o]=e.slice(1).split(/(?<=\w)(?=\/|#)/).map(s=>s.trim());r.targetContext=n,r.detail=o.join("")}else r.detail=e;return r}get localModules(){return pt(this.host)}get inheritedModules(){return U(this,gt)}handle(e){let{window:{webqit:{Observer:r}}}=D;e.meta.controller?.abort();let n=(e.detail||"").split(/\/|(?<=\w)(?=#)/g).map(s=>s.trim()).filter(s=>s);if(!n.length)return e.respondWith();n=n.join(`/${this.configs.HTML_IMPORTS.api.defs}/`)?.split("/").map(s=>s==="*"?1/0:s)||[];let o={live:e.live,sig_nal:e.signal,descripted:!0};e.meta.controller=r.reduce(U(this,Y),n,r.get,s=>{if(Array.isArray(s)){if(!s.length){e.respondWith();return}for(let a of s)e.respondWith(a)}else e.respondWith(s.value)},o)}unsubscribed(e){e.meta.controller?.abort()}initialize(e){this.host=e;let{window:{webqit:{Observer:r}}}=D,n=()=>{for(let s of new Set([...Object.keys(this.localModules),...Object.keys(this.inheritedModules),...Object.keys(U(this,Y))]))if(!r.has(this.localModules,s)&&!r.has(this.inheritedModules,s))r.deleteProperty(U(this,Y),s);else if(s==="#"&&r.has(this.localModules,s)&&r.has(this.inheritedModules,s))r.set(U(this,Y),s,[...r.get(this.localModules,s),...r.get(this.inheritedModules,s)]);else{let a=r.get(this.localModules,s)||r.get(this.inheritedModules,s);r.get(U(this,Y),s)!==a&&r.set(U(this,Y),s,a)}};It(this,Y,{...this.localModules}),U(this,zt)?.abort(),It(this,zt,r.observe(this.localModules,()=>n("local"),{timing:"sync"}));let o=this.configs.HTML_IMPORTS;if(this.host.matches&&o.attr.importscontext){let s=this.host.ownerDocument.defaultView.webqit.realdom,a;U(this,Bt)?.disconnect(),It(this,Bt,s.realtime(this.host).attr(o.attr.importscontext,(c,{signal:l})=>{let u=(c.value||"").trim();a=u,It(this,gt,{});let p={...this.constructor.createRequest(u?`${u}/*`:"*"),live:!0,signal:l,diff:!0};this.host.parentNode[this.configs.CONTEXT_API.api.contexts].request(p,f=>{f?f.type==="delete"?(delete U(this,gt)[f.key],Reflect.has(this.localModules,f.key)||r.deleteProperty(U(this,Y),f.key)):(U(this,gt)[f.key]=f.value,!Reflect.has(this.localModules,f.key)&&Reflect.get(U(this,Y),f.key)!==f.value&&r.set(U(this,Y),f.key,f.value)):(It(this,gt,{}),n("inherited"))}),n("inherited")},{live:!0,timing:"sync",oldValue:!0,lifecycleSignals:!0}))}return super.initialize(e)}dispose(e){return U(this,zt)?.abort(),U(this,Bt)?.disconnect(),super.dispose(e)}};gt=new WeakMap,Y=new WeakMap,zt=new WeakMap,Bt=new WeakMap,V(dt,"kind","html-imports");function li(){let{window:i}=D,{webqit:t}=i,{realdom:e,oohtml:{configs:r}}=t;if(t.HTMLImportElement)return t.HTMLImportElement;let n=r.HTML_IMPORTS.elements.import.includes("-")?i.HTMLElement:class{};class o extends n{static instance(a){return r.HTML_IMPORTS.elements.import.includes("-")&&a instanceof this?a:E(a).get("import::instance")||new this(a)}constructor(...a){super();let c=a[0]||this;E(c).set("import::instance",this),Object.defineProperty(this,"el",{get:()=>c,configurable:!1});let l={};Object.defineProperty(this,"#",{get:()=>l,configurable:!1}),l.slottedElements=new Set,l.setAnchorNode=u=>(l.anchorNode=u,u),l.live=u=>{if(l.liveImportsRealtime)throw new Error("Import element already in live mode.");let p=this.el.isConnected?this.el.parentNode:l.anchorNode.parentNode;l.liveImportsRealtime=e.realtime(this.el).attr(r.HTML_IMPORTS.attr.ref,(f,{signal:d})=>{l.moduleRef=f.value;let m=l.moduleRef.includes("#")?l.moduleRef:`${l.moduleRef}#`,w={...dt.createRequest(m),live:d&&!0,signal:d,diff:!m.endsWith("#")};p[r.CONTEXT_API.api.contexts].request(w,v=>{u((v instanceof i.HTMLTemplateElement?[...v.content.children]:Array.isArray(v)?v:v&&[v])||[])})},{live:!0,timing:"sync",lifecycleSignals:!0}),l.autoDestroyRealtime=e.realtime(i.document).track(p,()=>{l.die()},{subtree:"cross-roots",timing:"sync",generation:"exits"})},l.die=()=>{l.autoDestroyRealtime?.disconnect(),l.liveImportsRealtime?.disconnect(),l.liveImportsRealtime=null},l.hydrate=(u,p)=>{u.replaceWith(l.setAnchorNode(this.createAnchorNode())),l.live(f=>{if(l.originalsRemapped)return this.fill(f);let d=f.map((m,w)=>({el:m,fragmentDef:m.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",tagName:m.tagName,i:w}));p.forEach((m,w)=>{let v=m.tagName,g=m.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",y=(w++,d.find(x=>x.tagName===v&&x.fragmentDef===g&&x.i===w));y&&E(m).set("original@imports",y.el),E(m).set("slot@imports",this.el),l.slottedElements.add(m)}),l.originalsRemapped=!0})},l.autoRestore=(u=null)=>{l.autoRestoreRealtime?.disconnect(),u&&u();let p=()=>{this.el.isConnected||(this.el.setAttribute("data-nodecount",0),l.internalMutation=!0,l.anchorNode.replaceWith(this.el),l.internalMutation=!1,l.setAnchorNode(null))};if(!l.slottedElements.size)return p();let f=e.realtime(l.anchorNode.parentNode).observe([...l.slottedElements],d=>{if(d.exits.forEach(m=>{E(m).delete("slot@imports"),l.slottedElements.delete(m)}),!l.slottedElements.size){if(f.disconnect(),!d.target.isConnected)return;p()}},{subtree:"cross-roots",timing:"sync",generation:"exits"});l.autoRestoreRealtime=f},l.connectedCallback=()=>{l.internalMutation||l.live(u=>this.fill(u))},l.disconnectedCallback=()=>{l.internalMutation||l.die()}}createAnchorNode(){if(i.webqit.env!=="server")return i.document.createTextNode("");let a=i.document.createElement("div");a.textContent=this.el.outerHTML;let c=i.document.createComment(a.innerHTML);return E(c).set("isAnchorNode",!0),c}fill(a,c){!this.el.isConnected&&(!this["#"].anchorNode||!this["#"].anchorNode.isConnected)||(Array.isArray(a)&&(a=new Set(a)),this.el.setAttribute("data-nodecount",a.size),this["#"].autoRestore(()=>{if(this["#"].slottedElements.forEach(l=>{let u=E(l).get("original@imports");a.has(u)?a.delete(u):(this["#"].slottedElements.delete(l),l.remove())}),a.size&&this.el.isConnected){let l=this["#"].setAnchorNode(this.createAnchorNode());this["#"].internalMutation=!0,this.el.replaceWith(l),this["#"].internalMutation=!1}a.forEach(l=>{let u=l.cloneNode(!0);u.hasAttribute(r.HTML_IMPORTS.attr.fragmentdef)||u.toggleAttribute(r.HTML_IMPORTS.attr.fragmentdef,!0),E(u).set("original@imports",l),E(u).set("slot@imports",this.el),this["#"].slottedElements.add(u),this["#"].anchorNode.before(u)})}))}empty(){this["#"].slottedElements.forEach(a=>a.remove())}get anchorNode(){return this["#"].anchorNode}get moduleRef(){return this["#"].moduleRef}get slottedElements(){return this["#"].slottedElements}}return r.HTML_IMPORTS.elements.import.includes("-")&&customElements.define(r.HTML_IMPORTS.elements.import,o),t.HTMLImportElement=o,o}function mr(i={}){let{config:t,window:e}=X.call(this,"html-imports",i,{elements:{import:"import"},attr:{def:"def",extends:"extends",inherits:"inherits",ref:"ref",importscontext:"importscontext"},api:{def:"def",defs:"defs",import:"import"}});t.attr.fragmentdef||(t.attr.fragmentdef=t.attr.def),t.templateSelector=`template[${e.CSS.escape(t.attr.def)}]`,t.importsContextSelector=`[${e.CSS.escape(t.attr.importscontext)}]`,t.slottedElementsSelector=`[${e.CSS.escape(t.attr.fragmentdef)}]:not(template)`;let r=(n,o)=>{let s=`starts-with(., "${n}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.anchorNodeSelector=`comment()[${r(`<${t.elements.import}`,`</${t.elements.import}>`)}]`,e.webqit.HTMLImportsContext=dt,e.webqit.HTMLImportElement=li(),dn.call(e,t),hn.call(e,t)}function pt(i,t=!0){if(!E(i).has("defs")&&t){let e=Object.create(null);E(i).set("defs",e)}return E(i).get("defs")}function dn(i){let t=this,{webqit:{oohtml:{configs:e}}}=t;if(i.api.def in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${i.api.def}" API!`);if(i.api.defs in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${i.api.defs}" API!`);Object.defineProperty(t.HTMLTemplateElement.prototype,i.api.def,{get:function(){return this.getAttribute(i.attr.def)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,i.api.defs,{get:function(){return pt(this)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(n){this.toggleAttribute("scoped",n)}}),[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(n=>{let o=n===t.Document.prototype?"Document":n===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.import in n)throw new Error(`The ${o} prototype already has a "${i.api.import}" API!`);if(i.api.defs in n)throw new Error(`The ${o} prototype already has a "${i.api.defs}" API!`);Object.defineProperty(n,i.api.defs,{get:function(){return pt(this)}}),Object.defineProperty(n,i.api.import,{value:function(s,a=!1,c=null){return r(this,...arguments)}})});function r(n,o,s=!1,a=null){let c={};typeof s=="function"?(a=s,s=!1):typeof s=="object"&&s?c={...s,...c}:c={live:s};let l={...dt.createRequest(o),...c};return n[e.CONTEXT_API.api.contexts].request(l,a)}}function hn(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},HTMLImportElement:o,HTMLImportsContext:s}}=t,a=u=>{let p=u[n.CONTEXT_API.api.contexts];p.find(s.kind)||p.attach(new s)},c=u=>{let p=u[n.CONTEXT_API.api.contexts],f=p.find(s.kind);f&&(!u.isConnected||!u.matches?.(i.importsContextSelector)&&!Object.keys(f.localModules).length)&&p.detach(f)};r.realtime(t.document).query([i.templateSelector,i.importsContextSelector],u=>{u.entrants.forEach(p=>{if(p.matches(i.templateSelector)){let f=st.instance(p);f.ownerContext=p.scoped?p.parentNode:p.getRootNode();let d=pt(f.ownerContext);f.defId&&e.set(d,f.defId,p),a(f.ownerContext)}else a(p)}),u.exits.forEach(p=>{if(p.matches(i.templateSelector)){let f=st.instance(p),d=pt(f.ownerContext);f.defId&&f.ownerContext.isConnected&&e.deleteProperty(d,f.defId),c(f.ownerContext)}else c(p)})},{id:"imports:template/importscontext",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(i.elements.import,u=>{u.entrants.forEach(p=>l(p,!0,u)),u.exits.forEach(p=>l(p,!1,u))},{id:"imports:import",live:!0,subtree:"cross-roots",timing:"sync",deferred:!0});function l(u,p){let f=o.instance(u);p?f["#"].connectedCallback():f["#"].disconnectedCallback()}t.webqit.env!=="server"&&r.realtime(t.document).query(`(${i.anchorNodeSelector})`,u=>{u.entrants.forEach(p=>{if(E(p).get("isAnchorNode"))return;let f=t.document.createElement("div");f.innerHTML=p.nodeValue,f.innerHTML=f.firstChild.textContent;let d=f.firstChild,m=parseInt(d.getAttribute("data-nodecount")),w=new Set,v=p;for(;(v=v.previousElementSibling)&&v.matches(i.slottedElementsSelector)&&m--;)w.add(v);o.instance(d)["#"].hydrate(p,w)})},{id:"imports:hydration",live:!0,subtree:"cross-roots",timing:"sync"})}function gr(i={}){let{config:t,window:e}=X.call(this,"context-api",i,{elements:{roots:"root,webflo-embedded"},attr:{contextname:"contextname"},api:{contexts:"contexts"}}),r=new Map,n=e.EventTarget.prototype.dispatchEvent;Object.defineProperty(e.EventTarget.prototype,"dispatchEvent",{value:function(...o){let s=o[0],a=this?.closest?.(t.elements.roots)||this.getRootNode?.();if(["contextclaim","contextrequest"].includes(s.type)&&a){s.meta&&(s.meta.target=this);let c=u=>{if(u.stopImmediatePropagation(),u.meta&&(u.meta.target=u.target),!u.answered){if(r.get(a)||r.set(a,new Set),u.type==="contextrequest"&&u.live)r.get(a).add(u);else if(u.type==="contextclaim"){let p=new Set;return r.get(a).forEach(f=>{!u.target.contains(f.target)||!u.detail?.matchEvent?.(f)||(r.get(a).delete(f),p.add(f))}),r.get(a).size||r.delete(a),u.respondWith?.(p)}}};a.addEventListener(s.type,c);let l=n.call(this,...o);return a.removeEventListener(s.type,c),l}return n.call(this,...o)}}),e.webqit.DOMContexts=mt,e.webqit.DOMContext=J,e.webqit.DOMContextRequestEvent=Se(),e.webqit.DOMContextResponse=Tt,e.webqit.DuplicateContextError=Ct,mn.call(e,t)}function mn(i){let t=this;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(e=>{let r=e===t.Document.prototype?"Document":e===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.contexts in e)throw new Error(`The ${r} prototype already has a "${i.api.contexts}" API!`);Object.defineProperty(e,i.api.contexts,{get:function(){return mt.instance(this)}})})}function br({advanced:i={},...t}){let{config:e,window:r}=X.call(this,"scoped-css",t,{api:{styleSheets:"styleSheets"},style:{retention:"retain",mimeTypes:"text/css",strategy:null}});e.styleSelector=(Array.isArray(e.style.mimeTypes)?e.style.mimeTypes:e.style.mimeTypes.split("|")).concat("").reduce((n,o)=>{let s=o?`[type="${r.CSS.escape(o)}"]`:":not([type])";return n.concat(`style${s}`)},[]).join(","),r.webqit.oohtml.Style={compileCache:new Map},gn.call(r,e),yn.call(r,e)}function gn(i){let t=this,e=new Map;[t.Element.prototype].forEach(r=>{let n="Element";if(i.api.styleSheets in r)throw new Error(`The ${n} prototype already has a "${i.api.styleSheets}" API!`);Object.defineProperty(r,i.api.styleSheets,{get:function(){return e.has(this)||e.set(this,[]),e.get(this)}})}),Object.defineProperty(t.HTMLStyleElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(r){this.toggleAttribute("scoped",r)}})}function yn(i){let t=this,{webqit:{oohtml:e,realdom:r}}=t,n=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1;t.CSS.supports||(t.CSS.supports=()=>!1);let o=new WeakSet;r.realtime(t.document).query(i.styleSelector,s=>{s.entrants.forEach(a=>{if(o.has(a))return;o.add(a);let c=Pt(a.textContent),l=CSS.supports("selector(:has(a,b))"),u=a.scoped&&(l?`:has(> style[rand-${c}])`:`[rand-${c}]`),p=a.scoped&&t.CSSScopeRule&&!1,f=a.scoped&&a.parentNode||a.getRootNode();if(f instanceof t.Element){if(f[i.api.styleSheets].push(a),!n)return;(l?a:f).toggleAttribute(`rand-${c}`,!0)}if(!!n)if(a.scoped&&a.hasAttribute("shared")){let d;(d=e.Style.compileCache.get(c))||(d=bn.call(t,a,null,p,u),e.Style.compileCache.set(c,d)),Object.defineProperty(a,"sheet",{value:d,configurable:!0}),a.textContent=`
|
|
66
|
+
`),{webqit:{LiveScript:o,AsyncLiveScript:s}}=this,{parserParams:a,compilerParams:c,runtimeParams:l}=i.advanced,u=new(o||s)(n,{parserParams:a,compilerParams:c,runtimeParams:l});return fr.set(t,u),u}var Wt=i=>i.replace(/"/g,'\\"');function ai(i){let t=this,{webqit:{oohtml:{configs:{DATA_BINDING:e}}}}=t;(i?.matches(e.attrSelector)?[i]:[]).concat([...i?.querySelectorAll(e.attrSelector)||[]]).forEach(r=>{si.call(t,e,r.getAttribute(e.attr.render))}),Lt(t,i,`(${e.discreteBindingsSelector})`).forEach(r=>{let n=ni(e,r.nodeValue);oi.call(t,e,n.expr)})}var et=class extends J{static createRequest(t=null){let e=super.createRequest();if(t?.startsWith("@")){let[r,...n]=n.slice(1).split(".").map(o=>o.trim());e.targetContext=r,e.detail=n.join(".")}else e.detail=t;return e}get bindingsObj(){return this.host[this.configs.BINDINGS_API.api.bindings]}matchEvent(t){return super.matchEvent(t)&&(!t.detail||!this.detail||(Array.isArray(t.detail)?t.detail[0]===this.detail:t.detail===this.detail))}handle(t){if(t.meta.controller?.abort(),!(t.detail+"").trim())return t.respondWith(this.bindingsObj);let{window:{webqit:{Observer:e}}}=D;t.meta.controller=e.reduce(this.bindingsObj,Array.isArray(t.detail)?t.detail:[t.detail],e.get,r=>{this.disposed||t.respondWith(r.value)},{live:t.live,signal:t.signal,descripted:!0})}unsubscribed(t){t.meta.controller?.abort()}};V(et,"kind","bindings");function dr(i={}){let{config:t,window:e}=X.call(this,"bindings-api",i,{attr:{bindingsreflection:"bindings"},api:{bind:"bind",bindings:"bindings"}});e.webqit.DOMBindingsContext=et,cn.call(e,t),fn.call(e,t)}function hr(i,t){let e=this,{webqit:{Observer:r,oohtml:{configs:{CONTEXT_API:n}}}}=e;if(!E(t).has("bindings")){let o=Object.create(null);E(t).set("bindings",o),r.observe(o,s=>{if(t instanceof e.Element){let a=Ee(t.getAttribute(i.attr.bindingsreflection)||""),c=new Map(a);for(let l of s)l.detail?.publish!==!1&&(l.type==="delete"?a.delete(l.key):a.set(l.key,void 0));a.size&&a.size!==c.size?t.setAttribute(i.attr.bindingsreflection,`{ ${[...a.entries()].map(([l,u])=>u===void 0?l:`${l}: ${u}`).join(", ")} }`):a.size||t.toggleAttribute(i.attr.bindingsreflection,!1)}else{let a=t[n.api.contexts];for(let c of s)if(c.type==="delete"){let l=a.find(et.kind,c.key);l&&a.detach(l)}else a.find(et.kind,c.key)||a.attach(new et(c.key))}})}return E(t).get("bindings")}function cn(i){let t=this,{webqit:{Observer:e}}=t;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(r=>{let n=r===t.Document.prototype?"Document":r===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.bind in r)throw new Error(`The ${n} prototype already has a "${i.api.bind}" API!`);if(i.api.bindings in r)throw new Error(`The ${n} prototype already has a "${i.api.bindings}" API!`);Object.defineProperty(r,i.api.bind,{value:function(o,s={}){return un.call(t,i,this,o,s)}}),Object.defineProperty(r,i.api.bindings,{get:function(){return e.proxy(hr.call(t,i,this))}})})}function un(i,t,e,{merge:r,diff:n,publish:o,namespace:s}={}){let a=this,{webqit:{Observer:c}}=a,l=hr.call(this,i,t),u={diff:n,namespace:s,detail:{publish:o}},p=r?[]:Object.keys(l).filter(f=>!(f in e));return c.batch(l,()=>(p.length&&c.deleteProperties(l,p,u),c.set(l,e,u)),u)}function fn(i){let t=this,{webqit:{realdom:e,Observer:r,oohtml:{configs:n}}}=t,o=(a,c)=>{let l=a[n.CONTEXT_API.api.contexts];l.find(et.kind,c)||l.attach(new et(c))},s=(a,c)=>{let l,u=a[n.CONTEXT_API.api.contexts];for(;l=u.find(et.kind,c);)u.detach(l)};e.realtime(t.document).query(`[${t.CSS.escape(i.attr.bindingsreflection)}]`,a=>{a.exits.forEach(c=>s(c)),a.entrants.forEach(c=>{let l=Ee(c.getAttribute(i.attr.bindingsreflection)||""),u=[...l.entries()].filter(([p,f])=>f!==void 0);u.length&&c[i.api.bind](Object.fromEntries(u),{merge:!0,publish:!1});for(let[p]of l)o(c,p)})},{id:"bindings:dom",live:!0,subtree:"cross-roots",timing:"sync",eventDetails:!0}),e.realtime(t.document,"attr").observe(i.attr.bindingsreflection,a=>{let c=hr.call(t,i,a.target),l=Ee(a.value||""),u=Ee(a.oldValue||"");for(let p of new Set([...l.keys(),...u.keys()]))u.has(p)?l.has(p)?l.get(p)!==u.get(p)&&r.set(c,p,l.get(p),{detail:{publish:!1}}):(u.get(p)!==void 0&&r.deleteProperty(c,p,{detail:{publish:!1}}),s(a.target,p)):(l.get(p)!==void 0&&r.set(c,p,l.get(p),{detail:{publish:!1}}),o(a.target,p))},{id:"bindings:attr",subtree:"cross-roots",timing:"sync",newValue:!0,oldValue:!0})}var Ee=i=>(i=i.trim(),new Map(ft(i.slice(1,-1),",").filter(t=>t.trim()).map(t=>ft(t,":").map(e=>e.trim()))));var st=class{static instance(t){return E(t).get("defsmanager::instance")||new this(t)}constructor(t,e=null,r=0){let{window:n}=D,{webqit:{realdom:o,oohtml:{configs:s}}}=n;E(t).get("defsmanager::instance")?.dispose(),E(t).set("defsmanager::instance",this),this.window=n,this.host=t,this.config=s.HTML_IMPORTS,this.parent=e,this.level=r,this.defs=pt(this.host),this.defId=(this.host.getAttribute(this.config.attr.def)||"").trim(),this.validateDefId(this.defId),this.realtimeA=o.realtime(this.host.content).children(a=>{this.expose(a.exits,!1),this.expose(a.entrants,!0)},{live:!0,timing:"sync"}),this.realtimeB=o.realtime(this.host).attr(["src","loading"],(...a)=>this.evaluateLoading(...a),{live:!0,atomic:!0,timing:"sync",lifecycleSignals:!0}),this.realtimeC=this.evalInheritance()}validateDefId(t){if(["@","/","*","#"].some(e=>t.includes(e)))throw new Error(`The export ID "${t}" contains an invalid character.`)}expose(t,e){let{window:r}=D,{webqit:{Observer:n}}=r,o,s=this.defs["#"]||[];t.forEach(a=>{if(!a||a.nodeType!==1)return;let c=a.matches(this.config.templateSelector),l=(a.getAttribute(c?this.config.attr.def:this.config.attr.fragmentdef)||"").trim();e?(c&&l?new st(a,this.host,this.level+1):(s.push(a),o=!0,typeof requestIdleCallback=="function"&&requestIdleCallback(()=>{this.config.idleCompilers?.forEach(u=>u.call(this.window,a))})),l&&(this.validateDefId(l),n.set(this.defs,(!c&&"#"||"")+l,a))):(c&&l?st.instance(a).dispose():(s=s.filter(u=>u!==a),o=!0),l&&n.deleteProperty(this.defs,(!c&&"#"||"")+l))}),o&&n.set(this.defs,"#",s)}evaluateLoading([t,e],{signal:r}){let{window:{webqit:{Observer:n}}}=D,o=(t.value||"").trim();if(!o)return;let s,a=u=>{if(!u)return s;s=u.then(()=>l.remove())},c=(e.value||"").trim(),l=n.intercept(this.defs,"get",async(u,p,f)=>(c==="lazy"&&a(this.load(o,!0)),await a(),f()),{signal:r});c!=="lazy"&&a(this.load(o))}#t=new Set;#e;load(t){let{window:e}=D;if(this.#t.has(t)||(this.#t.add(t),this.#t.size===1&&this.host.content.children.length))return Promise.resolve();this.#e?.controller.abort();let r=new AbortController,n=(s,a)=>this.host.dispatchEvent(new e.CustomEvent(s,{detail:a})),o=e.fetch(t,{signal:r.signal,element:this.host}).then(s=>s.ok?s.text():Promise.reject(s.statusText)).then(s=>(this.host.innerHTML=s.trim(),n("load"),this.host)).catch(s=>(console.error(`Error fetching the bundle at "${t}": ${s.message}`),this.#e=null,n("loaderror"),this.host));return this.#e={request:o,controller:r},o}evalInheritance(){if(!this.parent)return[];let{window:{webqit:{Observer:t}}}=D,e=(this.host.getAttribute(this.config.attr.extends)||"").trim(),r=(this.host.getAttribute(this.config.attr.inherits)||"").trim().split(" ").map(a=>a.trim()).filter(a=>a),n=a=>{a.forEach(c=>{t.get(this.defs,c.key)===c.oldValue&&(["get","set","def"].includes(c.type)?t[c.type.replace("get","set")](this.defs,c.key,c.value):c.type==="delete"&&t.deleteProperty(this.defs,c.key))})},o=[],s=pt(this.parent);return e&&o.push(t.reduce(s,[e,this.config.api.defs,1/0],t.get,n,{live:!0})),r.length&&o.push(t.get(s,r.includes("*")?1/0:r,n,{live:!0})),o}dispose(){this.realtimeA.disconnect(),this.realtimeB.disconnect(),this.realtimeC.forEach(t=>t instanceof Promise?t.then(e=>e.abort()):t.abort()),Object.entries(this.defs).forEach(([t,e])=>{t.startsWith("#")||st.instance(e).dispose()})}};var gt,Y,zt,Bt,dt=class extends J{constructor(){super(...arguments);Ut(this,gt,{});Ut(this,Y,void 0);Ut(this,zt,void 0);Ut(this,Bt,void 0)}static createRequest(e=null){let r=super.createRequest();if(e?.startsWith("/"))r.detail=e,r.targetContext=1/0;else if(e?.startsWith("@")){let[n,...o]=e.slice(1).split(/(?<=\w)(?=\/|#)/).map(s=>s.trim());r.targetContext=n,r.detail=o.join("")}else r.detail=e;return r}get localModules(){return pt(this.host)}get inheritedModules(){return U(this,gt)}handle(e){let{window:{webqit:{Observer:r}}}=D;e.meta.controller?.abort();let n=(e.detail||"").split(/\/|(?<=\w)(?=#)/g).map(s=>s.trim()).filter(s=>s);if(!n.length)return e.respondWith();n=n.join(`/${this.configs.HTML_IMPORTS.api.defs}/`)?.split("/").map(s=>s==="*"?1/0:s)||[];let o={live:e.live,sig_nal:e.signal,descripted:!0};e.meta.controller=r.reduce(U(this,Y),n,r.get,s=>{if(Array.isArray(s)){if(!s.length){e.respondWith();return}for(let a of s)e.respondWith(a)}else e.respondWith(s.value)},o)}unsubscribed(e){e.meta.controller?.abort()}initialize(e){this.host=e;let{window:{webqit:{Observer:r}}}=D,n=()=>{for(let s of new Set([...Object.keys(this.localModules),...Object.keys(this.inheritedModules),...Object.keys(U(this,Y))]))if(!r.has(this.localModules,s)&&!r.has(this.inheritedModules,s))r.deleteProperty(U(this,Y),s);else if(s==="#"&&r.has(this.localModules,s)&&r.has(this.inheritedModules,s))r.set(U(this,Y),s,[...r.get(this.localModules,s),...r.get(this.inheritedModules,s)]);else{let a=r.get(this.localModules,s)||r.get(this.inheritedModules,s);r.get(U(this,Y),s)!==a&&r.set(U(this,Y),s,a)}};It(this,Y,{...this.localModules}),U(this,zt)?.abort(),It(this,zt,r.observe(this.localModules,()=>n("local"),{timing:"sync"}));let o=this.configs.HTML_IMPORTS;if(this.host.matches&&o.attr.importscontext){let s=this.host.ownerDocument.defaultView.webqit.realdom,a;U(this,Bt)?.disconnect(),It(this,Bt,s.realtime(this.host).attr(o.attr.importscontext,(c,{signal:l})=>{let u=(c.value||"").trim();a=u,It(this,gt,{});let p={...this.constructor.createRequest(u?`${u}/*`:"*"),live:!0,signal:l,diff:!0};this.host.parentNode[this.configs.CONTEXT_API.api.contexts].request(p,f=>{f?f.type==="delete"?(delete U(this,gt)[f.key],Reflect.has(this.localModules,f.key)||r.deleteProperty(U(this,Y),f.key)):(U(this,gt)[f.key]=f.value,!Reflect.has(this.localModules,f.key)&&Reflect.get(U(this,Y),f.key)!==f.value&&r.set(U(this,Y),f.key,f.value)):(It(this,gt,{}),n("inherited"))}),n("inherited")},{live:!0,timing:"sync",oldValue:!0,lifecycleSignals:!0}))}return super.initialize(e)}dispose(e){return U(this,zt)?.abort(),U(this,Bt)?.disconnect(),super.dispose(e)}};gt=new WeakMap,Y=new WeakMap,zt=new WeakMap,Bt=new WeakMap,V(dt,"kind","html-imports");function li(){let{window:i}=D,{webqit:t}=i,{realdom:e,oohtml:{configs:r}}=t;if(t.HTMLImportElement)return t.HTMLImportElement;let n=r.HTML_IMPORTS.elements.import.includes("-")?i.HTMLElement:class{};class o extends n{static instance(a){return r.HTML_IMPORTS.elements.import.includes("-")&&a instanceof this?a:E(a).get("import::instance")||new this(a)}constructor(...a){super();let c=a[0]||this;E(c).set("import::instance",this),Object.defineProperty(this,"el",{get:()=>c,configurable:!1});let l={};Object.defineProperty(this,"#",{get:()=>l,configurable:!1}),l.slottedElements=new Set,l.setAnchorNode=u=>(l.anchorNode=u,u),l.live=u=>{if(l.liveImportsRealtime)throw new Error("Import element already in live mode.");let p=this.el.isConnected?this.el.parentNode:l.anchorNode.parentNode;l.liveImportsRealtime=e.realtime(this.el).attr(r.HTML_IMPORTS.attr.ref,(f,{signal:d})=>{l.moduleRef=f.value;let m=l.moduleRef.includes("#")?l.moduleRef:`${l.moduleRef}#`,w={...dt.createRequest(m),live:d&&!0,signal:d,diff:!m.endsWith("#")};p[r.CONTEXT_API.api.contexts].request(w,v=>{u((v instanceof i.HTMLTemplateElement?[...v.content.children]:Array.isArray(v)?v:v&&[v])||[])})},{live:!0,timing:"sync",lifecycleSignals:!0}),l.autoDestroyRealtime=e.realtime(i.document).track(p,()=>{l.die()},{subtree:"cross-roots",timing:"sync",generation:"exits"})},l.die=()=>{l.autoDestroyRealtime?.disconnect(),l.liveImportsRealtime?.disconnect(),l.liveImportsRealtime=null},l.hydrate=(u,p)=>{u.replaceWith(l.setAnchorNode(this.createAnchorNode())),l.live(f=>{if(l.originalsRemapped)return this.fill(f);let d=f.map((m,w)=>({el:m,fragmentDef:m.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",tagName:m.tagName,i:w}));p.forEach((m,w)=>{let v=m.tagName,g=m.getAttribute(r.HTML_IMPORTS.attr.fragmentdef)||"",y=(w++,d.find(x=>x.tagName===v&&x.fragmentDef===g&&x.i===w));y&&E(m).set("original@imports",y.el),E(m).set("slot@imports",this.el),l.slottedElements.add(m)}),l.originalsRemapped=!0})},l.autoRestore=(u=null)=>{l.autoRestoreRealtime?.disconnect(),u&&u();let p=()=>{this.el.isConnected||(this.el.setAttribute("data-nodecount",0),l.internalMutation=!0,l.anchorNode.replaceWith(this.el),l.internalMutation=!1,l.setAnchorNode(null))};if(!l.slottedElements.size)return p();let f=e.realtime(l.anchorNode.parentNode).observe([...l.slottedElements],d=>{if(d.exits.forEach(m=>{E(m).delete("slot@imports"),l.slottedElements.delete(m)}),!l.slottedElements.size){if(f.disconnect(),!d.target.isConnected)return;p()}},{subtree:"cross-roots",timing:"sync",generation:"exits"});l.autoRestoreRealtime=f},l.connectedCallback=()=>{l.internalMutation||l.live(u=>this.fill(u))},l.disconnectedCallback=()=>{l.internalMutation||l.die()}}createAnchorNode(){if(i.webqit.env!=="server")return i.document.createTextNode("");let a=i.document.createElement("div");a.textContent=this.el.outerHTML;let c=i.document.createComment(a.innerHTML);return E(c).set("isAnchorNode",!0),c}fill(a,c){!this.el.isConnected&&(!this["#"].anchorNode||!this["#"].anchorNode.isConnected)||(Array.isArray(a)&&(a=new Set(a)),this.el.setAttribute("data-nodecount",a.size),this["#"].autoRestore(()=>{if(this["#"].slottedElements.forEach(l=>{let u=E(l).get("original@imports");a.has(u)?a.delete(u):(this["#"].slottedElements.delete(l),l.remove())}),a.size&&this.el.isConnected){let l=this["#"].setAnchorNode(this.createAnchorNode());this["#"].internalMutation=!0,this.el.replaceWith(l),this["#"].internalMutation=!1}a.forEach(l=>{let u=l.cloneNode(!0);u.hasAttribute(r.HTML_IMPORTS.attr.fragmentdef)||u.toggleAttribute(r.HTML_IMPORTS.attr.fragmentdef,!0),E(u).set("original@imports",l),E(u).set("slot@imports",this.el),this["#"].slottedElements.add(u),this["#"].anchorNode.before(u)})}))}empty(){this["#"].slottedElements.forEach(a=>a.remove())}get anchorNode(){return this["#"].anchorNode}get moduleRef(){return this["#"].moduleRef}get slottedElements(){return this["#"].slottedElements}}return r.HTML_IMPORTS.elements.import.includes("-")&&customElements.define(r.HTML_IMPORTS.elements.import,o),t.HTMLImportElement=o,o}function mr(i={}){let{config:t,window:e}=X.call(this,"html-imports",i,{elements:{import:"import"},attr:{def:"def",extends:"extends",inherits:"inherits",ref:"ref",importscontext:"importscontext"},api:{def:"def",defs:"defs",import:"import"}});t.attr.fragmentdef||(t.attr.fragmentdef=t.attr.def),t.templateSelector=`template[${e.CSS.escape(t.attr.def)}]`,t.importsContextSelector=`[${e.CSS.escape(t.attr.importscontext)}]`,t.slottedElementsSelector=`[${e.CSS.escape(t.attr.fragmentdef)}]:not(template)`;let r=(n,o)=>{let s=`starts-with(., "${n}")`,a=`substring(., string-length(.) - string-length("${o}") + 1) = "${o}"`;return`${s} and ${a}`};t.anchorNodeSelector=`comment()[${r(`<${t.elements.import}`,`</${t.elements.import}>`)}]`,e.webqit.HTMLImportsContext=dt,e.webqit.HTMLImportElement=li(),pn.call(e,t),dn.call(e,t)}function pt(i,t=!0){if(!E(i).has("defs")&&t){let e=Object.create(null);E(i).set("defs",e)}return E(i).get("defs")}function pn(i){let t=this,{webqit:{oohtml:{configs:e}}}=t;if(i.api.def in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${i.api.def}" API!`);if(i.api.defs in t.HTMLTemplateElement.prototype)throw new Error(`The "HTMLTemplateElement" prototype already has a "${i.api.defs}" API!`);Object.defineProperty(t.HTMLTemplateElement.prototype,i.api.def,{get:function(){return this.getAttribute(i.attr.def)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,i.api.defs,{get:function(){return pt(this)}}),Object.defineProperty(t.HTMLTemplateElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(n){this.toggleAttribute("scoped",n)}}),[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(n=>{let o=n===t.Document.prototype?"Document":n===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.import in n)throw new Error(`The ${o} prototype already has a "${i.api.import}" API!`);if(i.api.defs in n)throw new Error(`The ${o} prototype already has a "${i.api.defs}" API!`);Object.defineProperty(n,i.api.defs,{get:function(){return pt(this)}}),Object.defineProperty(n,i.api.import,{value:function(s,a=!1,c=null){return r(this,...arguments)}})});function r(n,o,s=!1,a=null){let c={};typeof s=="function"?(a=s,s=!1):typeof s=="object"&&s?c={...s,...c}:c={live:s};let l={...dt.createRequest(o),...c};return n[e.CONTEXT_API.api.contexts].request(l,a)}}function dn(i){let t=this,{webqit:{Observer:e,realdom:r,oohtml:{configs:n},HTMLImportElement:o,HTMLImportsContext:s}}=t,a=u=>{let p=u[n.CONTEXT_API.api.contexts];p.find(s.kind)||p.attach(new s)},c=u=>{let p=u[n.CONTEXT_API.api.contexts],f=p.find(s.kind);f&&(!u.isConnected||!u.matches?.(i.importsContextSelector)&&!Object.keys(f.localModules).length)&&p.detach(f)};r.realtime(t.document).query([i.templateSelector,i.importsContextSelector],u=>{u.entrants.forEach(p=>{if(p.matches(i.templateSelector)){let f=st.instance(p);f.ownerContext=p.scoped?p.parentNode:p.getRootNode();let d=pt(f.ownerContext);f.defId&&e.set(d,f.defId,p),a(f.ownerContext)}else a(p)}),u.exits.forEach(p=>{if(p.matches(i.templateSelector)){let f=st.instance(p),d=pt(f.ownerContext);f.defId&&f.ownerContext.isConnected&&e.deleteProperty(d,f.defId),c(f.ownerContext)}else c(p)})},{id:"imports:template/importscontext",live:!0,subtree:"cross-roots",timing:"sync",staticSensitivity:!0,eventDetails:!0}),r.realtime(t.document).query(i.elements.import,u=>{u.entrants.forEach(p=>l(p,!0,u)),u.exits.forEach(p=>l(p,!1,u))},{id:"imports:import",live:!0,subtree:"cross-roots",timing:"sync",deferred:!0});function l(u,p){let f=o.instance(u);p?f["#"].connectedCallback():f["#"].disconnectedCallback()}t.webqit.env!=="server"&&r.realtime(t.document).query(`(${i.anchorNodeSelector})`,u=>{u.entrants.forEach(p=>{if(E(p).get("isAnchorNode"))return;let f=t.document.createElement("div");f.innerHTML=p.nodeValue,f.innerHTML=f.firstChild.textContent;let d=f.firstChild,m=parseInt(d.getAttribute("data-nodecount")),w=new Set,v=p;for(;(v=v.previousElementSibling)&&v.matches(i.slottedElementsSelector)&&m--;)w.add(v);o.instance(d)["#"].hydrate(p,w)})},{id:"imports:hydration",live:!0,subtree:"cross-roots",timing:"sync"})}function gr(i={}){let{config:t,window:e}=X.call(this,"context-api",i,{elements:{roots:"root,webflo-embedded"},attr:{contextname:"contextname"},api:{contexts:"contexts"}}),r=new Map,n=e.EventTarget.prototype.dispatchEvent;Object.defineProperty(e.EventTarget.prototype,"dispatchEvent",{value:function(...o){let s=o[0],a=this?.closest?.(t.elements.roots)||this.getRootNode?.();if(["contextclaim","contextrequest"].includes(s.type)&&a){s.meta&&(s.meta.target=this);let c=u=>{if(u.stopImmediatePropagation(),u.meta&&(u.meta.target=u.target),!u.answered){if(r.get(a)||r.set(a,new Set),u.type==="contextrequest"&&u.live)r.get(a).add(u);else if(u.type==="contextclaim"){let p=new Set;return r.get(a).forEach(f=>{!u.target.contains(f.target)||!u.detail?.matchEvent?.(f)||(r.get(a).delete(f),p.add(f))}),r.get(a).size||r.delete(a),u.respondWith?.(p)}}};a.addEventListener(s.type,c);let l=n.call(this,...o);return a.removeEventListener(s.type,c),l}return n.call(this,...o)}}),e.webqit.DOMContexts=mt,e.webqit.DOMContext=J,e.webqit.DOMContextRequestEvent=Se(),e.webqit.DOMContextResponse=Tt,e.webqit.DuplicateContextError=Ct,hn.call(e,t)}function hn(i){let t=this;[t.Document.prototype,t.Element.prototype,t.ShadowRoot.prototype].forEach(e=>{let r=e===t.Document.prototype?"Document":e===t.ShadowRoot.prototype?"ShadowRoot":"Element";if(i.api.contexts in e)throw new Error(`The ${r} prototype already has a "${i.api.contexts}" API!`);Object.defineProperty(e,i.api.contexts,{get:function(){return mt.instance(this)}})})}function br({advanced:i={},...t}){let{config:e,window:r}=X.call(this,"scoped-css",t,{api:{styleSheets:"styleSheets"},style:{retention:"retain",mimeTypes:"text/css",strategy:null}});e.styleSelector=(Array.isArray(e.style.mimeTypes)?e.style.mimeTypes:e.style.mimeTypes.split("|")).concat("").reduce((n,o)=>{let s=o?`[type="${r.CSS.escape(o)}"]`:":not([type])";return n.concat(`style${s}`)},[]).join(","),r.webqit.oohtml.Style={compileCache:new Map},mn.call(r,e),gn.call(r,e)}function mn(i){let t=this,e=new Map;[t.Element.prototype].forEach(r=>{let n="Element";if(i.api.styleSheets in r)throw new Error(`The ${n} prototype already has a "${i.api.styleSheets}" API!`);Object.defineProperty(r,i.api.styleSheets,{get:function(){return e.has(this)||e.set(this,[]),e.get(this)}})}),Object.defineProperty(t.HTMLStyleElement.prototype,"scoped",{configurable:!0,get(){return this.hasAttribute("scoped")},set(r){this.toggleAttribute("scoped",r)}})}function gn(i){let t=this,{webqit:{oohtml:e,realdom:r}}=t,n=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1;t.CSS.supports||(t.CSS.supports=()=>!1);let o=new WeakSet;r.realtime(t.document).query(i.styleSelector,s=>{s.entrants.forEach(a=>{if(o.has(a))return;o.add(a);let c=Pt(a.textContent),l=CSS.supports("selector(:has(a,b))"),u=a.scoped&&(l?`:has(> style[rand-${c}])`:`[rand-${c}]`),p=a.scoped&&t.CSSScopeRule&&!1,f=a.scoped&&a.parentNode||a.getRootNode();if(f instanceof t.Element){if(f[i.api.styleSheets].push(a),!n)return;(l?a:f).toggleAttribute(`rand-${c}`,!0)}if(!!n)if(a.scoped&&a.hasAttribute("shared")){let d;(d=e.Style.compileCache.get(c))||(d=yn.call(t,a,null,p,u),e.Style.compileCache.set(c,d)),Object.defineProperty(a,"sheet",{value:d,configurable:!0}),a.textContent=`
|
|
67
67
|
/*[ Shared style sheet ]*/
|
|
68
|
-
`}else{let d=()=>{let m=$e(Ft.call(t,f));yr.call(this,a.sheet,m,!p&&u)};a.isConnected?d():setTimeout(()=>{d()},0)}})},{id:"scoped-css",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants"})}function
|
|
68
|
+
`}else{let d=()=>{let m=$e(Ft.call(t,f));yr.call(this,a.sheet,m,!p&&u)};a.isConnected?d():setTimeout(()=>{d()},0)}})},{id:"scoped-css",live:!0,subtree:"cross-roots",timing:"intercept",generation:"entrants"})}function yn(i,t,e,r){let n=this,o=i.textContent,s,a=e&&r?`@scope (${r}) {
|
|
69
69
|
${o.trim()}
|
|
70
70
|
}`:o.trim();try{s=new n.CSSStyleSheet,s.replaceSync(a),yr.call(this,s,t,!e&&r);let c=()=>i.getRootNode().adoptedStyleSheets.push(s);i.isConnected?c():setTimeout(()=>{c()},0)}catch{let l=n.document.createElement("style");i.after(l),l.textContent=a,s=l.sheet,yr.call(this,s,t,!e&&r)}return s}function yr(i,t,e=null){let r=i?.cssRules.length||-1;for(let n=0;n<r;++n){let o=i.cssRules[n];o instanceof CSSImportRule||ci.call(this,o,t,e)}}function ci(i,t,e=null){if(i instanceof CSSStyleRule){ui.call(this,i,t,e);return}if([window.CSSScopeRule,window.CSSMediaRule,window.CSSContainerRule,window.CSSSupportsRule,window.CSSLayerBlockRule].some(r=>r&&i instanceof r)){let r=i.cssRules.length;for(let n=0;n<r;++n)ci.call(this,i.cssRules[n],t,e)}}function ui(i,t,e=null){let r=lr.call(this,i.selectorText,t,e,1);if(i.selectorText=r,i.cssRules){let n=i.cssRules.length;for(let o=0;o<n;++o)ui.call(this,i.cssRules[o],t)}}function wr(i,t={}){this.webqit||(this.webqit={}),Object.assign(this.webqit,i),gr.call(this,t.CONTEXT_API||{}),dr.call(this,t.BINDINGS_API||{}),mr.call(this,{...t.HTML_IMPORTS||{},idleCompilers:[ei,ai]}),ar.call(this,t.NAMESPACED_HTML||{}),pr.call(this,t.DATA_BINDING||{}),br.call(this,t.SCOPED_CSS||{}),cr.call(this,t.SCOPED_JS||{})}wr.call(window,Ke);
|
|
71
71
|
//# sourceMappingURL=main.lite.js.map
|