@webqit/oohtml 4.3.5 → 4.3.6
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 +2 -2
- package/dist/main.js.map +2 -2
- package/dist/main.lite.js +1 -1
- package/dist/main.lite.js.map +2 -2
- package/package.json +2 -2
package/dist/main.lite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var or=Object.defineProperty;var zr=(i,t,e)=>t in i?or(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var be=(i,t)=>{for(var e in t)or(i,e,{get:t[e],enumerable:!0})};var F=(i,t,e)=>(zr(i,typeof t!="symbol"?t+"":t,e),e);var De={};be(De,{AsyncQuantumFunction:()=>gr,AsyncQuantumScript:()=>Tt,Observer:()=>C,QuantumAsyncFunction:()=>yi,QuantumAsyncScript:()=>wi,QuantumFunction:()=>gi,QuantumModule:()=>Xt,QuantumScript:()=>bi,State:()=>wt});var je={};be(je,{apply:()=>ie,batch:()=>se,construct:()=>Pe,defineProperties:()=>li,defineProperty:()=>Vt,deleteProperties:()=>ui,deleteProperty:()=>Bt,get:()=>ot,getOwnPropertyDescriptor:()=>ne,getOwnPropertyDescriptors:()=>ai,getPrototypeOf:()=>Ee,has:()=>oe,intercept:()=>si,isExtensible:()=>Ce,map:()=>ci,observe:()=>qe,ownKeys:()=>Wt,path:()=>oi,preventExtensions:()=>Ie,reduce:()=>Me,set:()=>ht,setPrototypeOf:()=>Te});function T(i){return!Array.isArray(i)&&typeof i=="object"&&i}function At(i){return typeof i}function E(i){return Array.isArray(i)}function we(i,t,e=null){return E(t)?i.filter(r=>e?t.filter(n=>e(r,n)).length:t.indexOf(r)!==-1):[]}function D(i,...t){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new Rt}),!arguments.length)return globalThis.webqit.refs;let e=globalThis.webqit.refs.get(i);e||(e=new Rt,globalThis.webqit.refs.set(i,e));let r,n;for(;r=t.shift();)(n=e)&&!(e=e.get(r))&&(e=new Rt,n.set(r,e));return e}var Rt=class extends Map{constructor(...t){super(...t),this.observers=new Set}set(t,e){let r=super.set(t,e);return this.fire("set",t,e,t),r}delete(t){let e=super.delete(t);return this.fire("delete",t),e}has(t){return this.fire("has",t),super.has(t)}get(t){return this.fire("get",t),super.get(t)}keyNames(){return Array.from(super.keys())}observe(t,e,r){let n={type:t,key:e,callback:r};return this.observers.add(n),()=>this.observers.delete(n)}unobserve(t,e,r){if(Array.isArray(t)||Array.isArray(e))throw new Error('The "type" and "key" arguments can only be strings.');for(let n of this.observers)!(Kt([t,"*"],n.type)&&Kt([e,"*"],n.key)&&n.callback===r)||this.observers.delete(n)}fire(t,e,...r){for(let n of this.observers)!(Kt([t,"*"],n.type)&&Kt([e,"*"],n.key))||n.callback(...r)}},Kt=(i,t)=>Array.isArray(t)?we(i,t).length:i.includes(t);function $t(i){return typeof i=="function"}function kt(i){return i===null||i===""}function it(i){return arguments.length&&(i===void 0||typeof i>"u")}function M(i){return Array.isArray(i)||typeof i=="object"&&i||$t(i)}function xe(i){return kt(i)||it(i)||i===!1||i===0||M(i)&&!Object.keys(i).length}function I(i){return $t(i)||i&&{}.toString.call(i)==="[object function]"}function Nt(i){return i instanceof Number||typeof i=="number"}function G(i){return Nt(i)||i!==!0&&i!==!1&&i!==null&&i!==""&&!isNaN(i*1)}function Et(i){return i instanceof String||typeof i=="string"&&i!==null}function _e(i){return!Et(i)&&!it(i.length)}function te(i,...t){return t.forEach(e=>{i.indexOf(e)<0&&i.push(e)}),i}function ve(r,t){t=t||Object.prototype,t=t&&!E(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 Oe(i,t){var e=[];return ve(i,t).forEach(r=>{te(e,...Object.getOwnPropertyNames(r))}),e}function J(i,t,e=!1,r=!1,n=!1){var o=0,s=i.shift();if((G(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,l)=>{!M(a)&&!I(a)||(e?Oe(a):Object.keys(a)).forEach(c=>{if(!!t(c,s,a,l)){var u=s[c],f=a[c];if((E(u)&&E(f)||T(u)&&T(f))&&(o===!0||o>0))s[c]=E(u)&&E(f)?[]:{},J([G(o)?o-1:o,s[c],u,f],t,e,r,n);else if(E(s)&&E(a))r?s[c]=f:s.push(f);else try{n?Object.defineProperty(s,c,Object.getOwnPropertyDescriptor(a,c)):s[c]=a[c]}catch{}}})}),s}function Dt(...i){return J(i,(t,e,r)=>!0,!1,!1,!1)}function k(i,t=!0){return E(i)?i:!t&&T(i)?[i]:i!==!1&&i!==0&&xe(i)?[]:_e(i)?Array.prototype.slice.call(i):T(i)?Object.values(i):[i]}var q=(...i)=>D("observer-api",...i),Ct=(i,t)=>i instanceof Promise?i.then(t):t(i),ee={};var pt=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 Lt=class extends pt{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),ee.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=k(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 Ct(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 mt=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(!M(e))throw new Error(`Subject must be of type object; "${At(e)}" given!`);let o=this;return n&&q("namespaces").has(t+"-"+n)&&(o=q("namespaces").get(t+"-"+n),t+="-"+n),!q(e,"registry").has(t)&&r&&q(e,"registry").set(t,new o(e)),q(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return q("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}.`);q("namespaces").set(t,r),r.__namespace=e}};var W=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 mt{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 Lt(this,{filter:t,emit:e,params:r}))}emit(t,e=!1){if(this.batches.length){this.batches[0].snapshots.push({events:[...t],isPropertyDescriptors:e});return}this.$emit(this.entries,[{events:t,isPropertyDescriptors:e}])}$emit(t,e){let r=t.filter(l=>l.params.withPropertyDescriptors).length,n=e.some(l=>l.isPropertyDescriptors),o=[],s=[],a=t.length;e.forEach(l=>{(r||!n)&&o.push(...l.events),r!==a&&n&&(l.isPropertyDescriptors?s.push(...l.events.map(c=>{let{target:u,type:f,...d}=c,p=new W(u,{type:"set",...d});return Object.defineProperty(p,"value","get"in d.value?{get:()=>d.value.get()}:{value:d.value.value}),d.oldValue&&Object.defineProperty(p,"oldValue","get"in d.oldValue?{get:()=>d.oldValue.get()}:{value:d.oldValue.value}),p})):s.push(...l.events))}),t.forEach(l=>{l.params.withPropertyDescriptors?l.fire(o.length?o:s):l.fire(s.length?s:o)})}batch(t){this.batches.unshift({entries:[...this.entries],snapshots:[]});let e=t();return Ct(e,r=>{let n=this.batches.shift();return n.snapshots.length&&this.$emit(n.entries,n.snapshots),r})}};var Ht=class extends pt{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 nt=class extends mt{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 Ht(this,t))}emit(t,e=null){let r=this;return function n(o,...s){let a=r.entries[o];return a?a.exec(t,(...l)=>n(o+1,...l),...s):e?e(t,...s):s[0]}(0)}};var $e={};be($e,{accessorize:()=>ii,proxy:()=>dr,unaccessorize:()=>ni,unproxy:()=>Ft});function ii(i,t,e={}){i=re(i);let r=q(i,"accessorizedProps");function n(l){let c,u=i;do c=Object.getOwnPropertyDescriptor(u,l);while(!c&&(u=Object.getPrototypeOf(u)));return c?{proto:u,descriptor:c}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(l){if(r.has(l+""))return!0;let c=n(l);c.getValue=function(d=!1){return d?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},c.setValue=function(d,p=!1){if(this.dirty=!0,p){this.descriptor=d;return}return this.descriptor.set?this.descriptor.set(d)!==!1:(this.descriptor.value=d,!0)},c.intact=function(){let d=Object.getOwnPropertyDescriptor(i,l);return d?.get===f.get&&d?.set===f.set&&r.get(l+"")===this},c.restore=function(){return this.intact()?(this.proto&&this.proto!==i||!this.proto&&!this.dirty?delete i[l]:Object.defineProperty(i,l,this.descriptor),r.delete(l+""),!0):!1},r.set(isNaN(l)?l:parseInt(l),c);let{enumerable:u=!0}=c.descriptor,f={enumerable:u,configurable:!0};("value"in c.descriptor||c.descriptor.set)&&(f.set=function(d){return ht(this,l,d,e)}),("value"in c.descriptor||c.descriptor.get)&&(f.get=function(){return ot(this,l,e)});try{return Object.defineProperty(i,l,f),!0}catch{return r.delete(l+""),!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 ni(i,t,e={}){i=re(i);let r=q(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 dr(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&&q(r,"membraneRef").has(t.membrane))return q(r,"membraneRef").get(t.membrane);let n={apply(a,l,c){if(Array.isArray(l)){let u=re(l);return q(u).set("$length",u.length),se(u,()=>ie(a,l,c))}return ie(a,Ft(l),c)},construct:(a,l,c=null)=>Pe(a,l,c,t),defineProperty:(a,l,c)=>Vt(a,l,c,t),deleteProperty:(a,l)=>Bt(a,l,t),get:(a,l,c=null)=>{let u={...t,receiver:c};Array.isArray(a)&&l==="length"&&q(a).has("$length")&&(u.forceValue=q(a).get("$length"));let f=ot(a,l,u);return Array.isArray(a)&&typeof f=="function"?dr(f,{...t,membrane:c}):f},getOwnPropertyDescriptor:(a,l)=>ne(a,l,t),getPrototypeOf:a=>Ee(a,t),has:(a,l)=>oe(a,l,t),isExtensible:a=>Ce(a,t),ownKeys:a=>Wt(a,t),preventExtensions:a=>Ie(a,t),set:(a,l,c,u=null)=>{let f={...t,receiver:u};return Array.isArray(a)&&l==="length"&&(f.forceOldValue=q(a).get("$length"),q(a).set("$length",c)),ht(a,l,c,f)},setPrototypeOf:(a,l)=>Te(a,l,t)},o=e?.(n)||n,s=new Proxy(r,o);return t.membrane&&q(r,"membraneRef").set(t.membrane,s),q(s).set(s,r),s}function Ft(i){return q(i).get(i)||i}function re(i){if(!i||!M(i))throw new Error("Target must be of type object!");return Ft(i)}var zt=class extends Array{};function oi(...i){return new zt(...i)}function Me(i,t,e,r=o=>o,n={}){if(!!t.length)return function o(s,a,l){let c=a[l.level],u=l.level===a.length-1;return s instanceof W&&s.operation!=="get"?l={...l,probe:"always"}:l.probe!=="always"&&(l={...l,probe:!u}),e(s,c,(f,...d)=>{let p=_=>{_ instanceof W&&(_.path=[_.key],s instanceof W&&(_.path=s.path.concat(_.key),Object.defineProperty(_,"context",{get:()=>s,configurable:!0})))},g=_=>{let A=Y(_,!1);return Ct(A,m=>{_ instanceof W?_.value=m:_=m;let y=d[0]||{};return o(_,a,{...l,...y,level:l.level+1})})};return ae(c)&&Array.isArray(f)?(f.forEach(p),u?r(f,...d):f.map(g)):(p(f),u?r(f,...d):g(f))},l)}(i,t.slice(0),{...n,level:0})}function qe(i,t,e,r={}){if(i=Y(i,!r.level),I(arguments[1])&&([,e,r={}]=arguments,t=1/0),!I(e))throw new Error(`Handler must be a function; "${At(e)}" given!`);if(t instanceof zt)return Me(i,t,qe,e,r);if(r={...r,descripted:!0},delete r.live,!M(i))return r.probe&&ot(i,t,e,r);let n=pr(i,t,e,r);return r.probe?ot(i,t,n,r):n()}function si(i,t,e={}){return i=Y(i),T(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),nt.getInstance(i,!0,e.namespace).addRegistration({traps:t,params:e})}function ne(i,t,e=n=>n,r={}){return Z(i,"getOwnPropertyDescriptor",{key:t},e,r)}function ai(i,t,e=n=>n,r={}){return Z(i,"getOwnPropertyDescriptors",{key:t},e,r)}function Ee(i,t=r=>r,e={}){return Z(i,"getPrototypeOf",{},t,e)}function Ce(i,t=r=>r,e={}){return Z(i,"isExtensible",{},t,e)}function Wt(i,t=r=>r,e={}){return Z(i,"ownKeys",{},t,e)}function oe(i,t,e=n=>n,r={}){return Z(i,"has",{key:t},e,r)}function ot(i,t,e=n=>n,r={}){let n,o=Y(i,!r.level);return T(e)?[r,e]=[e,s=>s]:r.live&&(n=!0),t instanceof zt?Me(o,t,ot,e,r):fi(o,t,s=>{let a=[...s];return function l(c,u,f){if(!u.length)return f(c);let d=u.shift();if(!["string","number","symbol"].includes(typeof d))throw new Error(`Property name/key ${d} invalid.`);function p(A,m=void 0){let y=h=>(A.value=h,l([...c,r.live||r.descripted?A:h],u,f));if(arguments.length>1)return y(m);if(!M(o))return y(o?.[A.key]);let O=q(o,"accessorizedProps",!1),b=O&&O.get(A.key);if(b&&b.intact())return y(b.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let h=Object.getOwnPropertyDescriptor(o,A.key);return"forceValue"in r&&"value"in h&&(h.value=r.forceValue),y(h)}return"forceValue"in r?y(r.forceValue):y(Reflect.get(o,A.key))}let g=new W(o,{type:"get",key:d,value:void 0,operation:"get",related:a});if(!M(o))return p(g);let _=nt.getInstance(o,!1,r.namespace);return _?_.emit(g,p):p(g)}([],s.slice(0),l=>{let c=ae(t)?l:l[0];return n&&M(o)?pr(o,t,e,r)(c):e(c)})},r)}function se(i,t,e={}){return i=Y(i),lt.getInstance(i,!0,e.namespace).batch(t)}function ci(i,t,e={}){t=Y(t),i=Y(i);let r=(e.only||[]).slice(0),n=(e.except||[]).slice(0),o=Wt(e.spread?[...i]:i).map(c=>isNaN(c)?c:parseInt(c)),s=r.length?r.filter(c=>o.includes(c)):o.filter(c=>!n.includes(c)),a=c=>!Array.isArray(t)||isNaN(c)?c:c-n.filter(u=>u<c).length,l=c=>{let u=ne(i,c,e);"value"in u&&u.writable&&u.enumerable&&u.configurable?ht(t,a(c),u.value,e):(u.enumerable||e.onlyEnumerable===!1)&&Vt(t,c,{...u,configurable:!0},e)};return se(t,()=>{s.forEach(l)}),qe(i,c=>{c.filter(u=>r.length?r.includes(u.key):!n.includes(u.key)).forEach(u=>{if(u.operation==="deleteProperty")return Bt(t,a(u.key),e);if(u.operation==="defineProperty"){(u.value.enumerable||e.onlyEnumerable===!1)&&Vt(t,a(u.key),{...u.value,configurable:!0},e);return}l(u.key)})},{...e,withPropertyDescriptors:!0})}function ht(i,t,e,r=s=>s,n={},o=!1){let s=Y(i),a=[[t,e]];T(t)&&([,,r=c=>c,n={},o=!1]=arguments,a=Object.entries(t)),T(r)&&([o,n,r]=[typeof n=="boolean"?n:o,r,c=>c]);let l=a.map(([c])=>c);return function c(u,f,d){if(!f.length)return d(u);let[p,g]=f.shift();function _(m,y=void 0){let O=w=>(m.status=w,c(u.concat(m),f,d));if(arguments.length>1)return O(m,y);let b=q(s,"accessorizedProps",!1),h=b&&b.get(m.key);return m.operation==="defineProperty"?(h&&!h.restore()&&O(!1),Object.defineProperty(s,m.key,m.value),O(!0)):h&&h.intact()?O(h.setValue(m.value)):O(Reflect.set(s,m.key,m.value))}function A(m,y){if(n.diff&&g===y)return c(u,f,d);let O=new W(s,{type:o?"def":"set",key:p,value:g,isUpdate:m,oldValue:y,related:[...l],operation:o?"defineProperty":"set",detail:n.detail}),b=nt.getInstance(s,!1,n.namespace);return b?b.emit(O,_):_(O)}return oe(s,p,m=>{if(!m)return A(m);let y={...n,withPropertyDescriptors:o};return"forceOldValue"in n&&(y.forceValue=n.forceOldValue),ot(s,p,O=>A(m,O),y)},n)}([],a.slice(0),c=>{let u=lt.getInstance(s,!1,n.namespace);return u&&u.emit(c,o),r(ae(t)?c.map(f=>f.status):c[0]?.status)})}function Vt(i,t,e,r=o=>o,n={}){return ht(i,t,e,r,n,!0)}function li(i,t,e=n=>n,r={}){return ht(i,t,e,r,!0)}function Bt(i,t,e=n=>n,r={}){i=Y(i),T(e)&&([r,e]=[e,s=>s]);let n=k(t,!1),o=[...n];return function s(a,l,c){if(!l.length)return c(a);let u=l.shift();function f(p,g=void 0){let _=y=>(p.status=y,s(a.concat(p),l,c));if(arguments.length>1)return _(p,g);let A=q(i,"accessorizedProps",!1),m=A&&A.get(p.key);return m&&!m.restore()&&_(!1),_(Reflect.deleteProperty(i,p.key))}function d(p){let g=new W(i,{type:"delete",key:u,oldValue:p,related:[...o],operation:"deleteProperty",detail:r.detail}),_=nt.getInstance(i,!1,r.namespace);return _?_.emit(g,f):f(g)}return ot(i,u,d,r)}([],n.slice(0),s=>{let a=lt.getInstance(i,!1,r.namespace);return a&&a.emit(s),e(ae(t)?s.map(l=>l.status):s[0].status)})}function ui(i,t,e=n=>n,r={}){return Bt(...arguments)}function Pe(i,t,e=null,r=o=>o,n={}){return Z(i,"construct",arguments.length>2?{argumentsList:t,newTarget:e}:{argumentsList:t},r,n)}function ie(i,t,e,r=o=>o,n={}){return Z(i,"apply",{thisArgument:t,argumentsList:e},r,n)}function Te(i,t,e=n=>n,r={}){return Z(i,"setPrototypeOf",{proto:t},e,r)}function Ie(i,t=r=>r,e={}){return Z(i,"preventExtensions",{},t,e)}function pr(i,t,e,r={}){let n=new AbortController;ee.setMaxListeners?.(0,n.signal),r.signal&&r.signal.addEventListener("abort",()=>n.abort()),r={...r,signal:n.signal};let o=lt.getInstance(i,!0,r.namespace);return function s(a,l=null){l?.remove();let u={signal:o.addRegistration(t,s,r).signal};if(arguments.length){let f=e(a,u);if(arguments.length>1)return f}return n}}function Z(i,t,e={},r=o=>o,n={}){i=Y(i),T(r)&&([n,r]=[r,l=>l]);function o(l,c){return arguments.length>1?r(c):r((Reflect[t]||Object[t])(i,...Object.values(e)))}let s=new W(i,{operation:t,...e}),a=nt.getInstance(i,!1,n.namespace);return a?a.emit(s,o):o(s)}function ae(i){return i===1/0||Array.isArray(i)}function Y(i,t=!0){if((!i||!M(i))&&t)throw new Error(`Object must be of type object or array! "${At(i)}" given.`);return i instanceof W&&(i=i.value),i&&Ft(i)}function fi(i,t,e,r={}){return t===1/0?r.level&&!M(i)?e([]):Wt(i,e,r):e(k(t,!1))}var di={...je,...$e},C=di;var Re=(i,...t)=>{let e=t.pop();return i.constructor.name==="AsyncFunction"?U(i.call(...t),e):e(i.call(...t))},U=(i,t)=>i instanceof Promise?i.then(t):t(i),ke=i=>typeof i=="object"&&i||typeof i=="function";function mr(i){let t=typeof i[i.length-1]=="object"?i.pop():{},e=i.pop()||"";return t.functionParams=i,{source:e,params:t}}var hr={};function ce(...i){let t,e={runtimeParams:hi,compilerParams:mi,parserParams:pi};for(;t=i.shift();){let{runtimeParams:r={},compilerParams:{globalsNoObserve:n=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:a={}}=t;e={runtimeParams:{...e.runtimeParams,...r},compilerParams:{...e.compilerParams,globalsNoObserve:[...e.compilerParams.globalsNoObserve,...n],globalsOnlyPathsExcept:[...e.compilerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...e.parserParams,...a}},i.devMode}return e}var pi={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},mi={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},hi={apiVersion:3};var Ut=Object.create(null);var gt=class extends EventTarget{managedAlways=new Set;managedOnce=new Set;constructor(){super(),hr.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 yt=class extends gt{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 yt(this,e,e==="object"?t:ke(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||!ke(this.state))&&(this.mutationsWatch=C.observe(this.state,e=>{let r={map:new Map,add(o,s){for(let a of o)a.spec.beforeSchedule?.(s)!==!1&&(this.map.has(a.runtime)||this.map.set(a.runtime,new Set),this.map.get(a.runtime).add(a))}};for(let o of e){let s=this.signals.get(o.key);!s||(r.add(s.subscribers,o),s.refresh(o.value))}let n=r.map.size?[...r.map].sort((o,s)=>o.$serial>s.$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 V=class extends yt{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var K=class extends gt{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){try{return this.runtime.thread.unshift(this),U(this.beforeExecute(),e=>Re(this.closure,this,this,r=>(this.spec.complete&&(r=this.spec.complete(r,this)),this.afterExecute(e),this.runtime.thread.shift(),t?t(r,this):r)))}catch(e){if(e.cause)throw e;let r=`${e.message||e}`;this.runtime.throw(r,[this.serial,this.context?.serial],globalThis[e.name])}}afterExecute(t){this.state="complete";let e=this.flowControl;this.handleDownstream(e.size,t.size),this.handleRightstream(e.size,t.size);for(let r of["break","continue","return"])e.has(r)&&!e.get(r).endpoint?this.hoistFlowControl(r,e.get(r).arg):t.has(r)&&!t.get(r).endpoint&&this.hoistFlowControl(r,t.get(r).arg,!0)}typed(t,e,r=void 0){let 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(l){throw new Error(`Cannot declare ${t}; ${l.message}`)}}:r,s=(a,l)=>{let c=l.scope;if(n.kind==="var")for(;!["module","function"].includes(c.type)&&!C.has(c.state,t)&&c.context;)c=c.context;else c.type==="this"&&c.context&&(c=c.context);let u=c.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 f=a;return n.restOf&&(n.type==="array"?f=[]:f={},u.reader=C.map(a,f,{except:n.restOf,spread:n.type==="array"}),l.once(u.reader)),c.symbols.set(t,u),C.set(c.state,t,f),f};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?(...l)=>{try{return e(...l)}catch(c){throw new Error(`Cannot update ${t}; ${c.message}`)}}:e;return Re(a,void 0,s,l=>{o?.reader?.abort();let c=l;return r.restOf&&(o=o||{},r.type==="array"?c=[]:c={},o.reader=C.map(l,c,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader)),C.set(n.state,t,c),["postinc","postdec"].includes(r.kind)?s:c})}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=this.runtime.$params.quantumMode,o=t.type==="const",s=this===this.runtime,a=this.state==="aborted",l=this;return function c(u,f){if(n&&!o&&!s&&!a&&u.subscribe(l),!f||!u.state||typeof u.state!="object"){let p=u.state;return typeof u.state=="function"&&(p=C.proxy(u.state,{membrane:u})),p}let d;return C.proxy(u.state,{},p=>({...p,get(g,_,A=null){return d?p.get(g,_,A):(d=!0,c(u.signal(_),f-1))}}))}(t,e)}autorun(t,...e){let r=e.pop(),n=e.pop(),o=e.pop()||{},s=K,a=this.scope;if(t==="iteration"){let c=this.runtime.constructor;s=r.constructor.name==="AsyncFunction"?c.AutoAsyncIterator:c.AutoIterator}["block","iteration"].includes(t)&&(a=new V(a,t));let l=new s(this,t,o,n,a,r);if(!(t==="downstream"&&(this.downstream=l,this.flowControlApplied())))return l.execute()}function(t,e,r,n){t&&C.set(this.scope.state,n.name,n);let o=this;return Object.defineProperty(n,"toString",{value:function(s=!1){if(s&&e)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){return t&&C.set(this.scope.state,e.name,e),r.forEach(({name:n,static:o,isQuantumFunction:s,serial:a})=>{this.function(!1,s,a,o?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}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;this.type!=="block"||!(r=this.context?.downstream)||(t?r.abort():e&&(r.state="resuming",this.runtime.schedule(r)))}handleRightstream(t,e){if(this.type!=="round")return;let r=this,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 bt=class extends K{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),U(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 V(this.scope,"round",n);this.scope.symbols.forEach((l,c)=>{o.symbols.set(c,l)});let s=new K(this,"round",r,this.serial,o,this.spec.$closure),a=this.spec.kind==="for-in"?t:e;return this.rounds.set(a,s),this.lastRound&&(this.lastRound.nextRound=s,s.prevRound=this.lastRound),this.lastRound=s,s}watchMode(){let t=(e,r)=>{let 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,l=this.spec.kind==="for-in"?s.key:parseInt(s.key),c=this.rounds.get(l);if(c)C.set(c.scope.state,this.production,a),s.type==="delete"&&(this.rounds.set(l,void 0),c.prevRound&&(c.prevRound.nextRound=c.nextRound),c.nextRound&&(c.nextRound.prevRound=c.prevRound),n.add(c));else if(s.type!=="delete"&&!s.isUpdate){if(this.spec.kind==="for-of"&&this.iterator.original&&!r.done)continue;o.add(a)}}this.runtime.on("reflection",()=>{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=>{U(this.cursor,r=>t(e,r))}))}};var Gt=class extends bt{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 wt=class{constructor(t){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})}dispose(){return this.runtime.abort(!0)}};var xt=class extends K{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,n,o){super(t,e,{},-1,n,o);let{$serial:s=0,...a}=r;this.$serial=s,this.$params=a,this.$objects=new V(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}throw(t,e,r=null,n=null){let o,s=n!==null?`[${n}]: ${t}`:t,a=e.map(c=>c!==-1&&this.extractSource(c,!0)).filter(c=>c);a.push({source:this.$params.originalSource}),o=new(r||Error)(s,{cause:a});let l=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw l&&(o.fileName=l),n&&(o.code=n),o}get runtime(){return this}get nowRunning(){return this.thread[0]}schedule(...t){let e=this.queue.size;for(let r of t)this.queue.add(r);if(!e)return this.flowControlDirty=!1,function r(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=this.$params.quantumMode?new wt(this):e;return t?t(r,this):r})}spawn(t,e,r){let n=this.nowRunning||this,o={...this.$params,$serial:this.$serial+1,quantumMode:t},s=new V(n.scope,"function",{this:e});return new this.constructor(n,"function",o,s,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&&Ut[r.source])return n(Ut[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){throw a.code==="ERR_MODULE_NOT_FOUND"&&this.throw(`Cannot find package "${r.source}"${s?` imported at "${s}"`:""}.`,[r.serial],null,a.code),a}})();return r.isDynamic||this.$promises[r.forExport?"exports":"imports"].push(o),o}async export(...t){let e=Array.isArray(t[t.length-1])?null:t.pop(),r=e?await this.import({...e,forExport:!0}):this.scope.state;this.assignModules(t,this.exports,r,e?.serial)}assignModules(t,e,r,n=null){let o=[];for(let[s,a,l]of t){if(s==="*"&&l){(this.$params.quantumMode?C:Reflect).set(e,l,r);continue}C.has(r,s)||this.throw(`The requested module does not provide an export named "${s}".`,[a,n]),(this.$params.quantumMode?C:Reflect).set(e,l||s,C.get(r,s)),o.push([s,a,l])}!o.length||!this.$params.quantumMode||this.once(C.observe(r,s=>{for(let[a,,l]of o)for(let c of s)a==="*"?C.set(e,c.key,c.value):c.key===a&&C.set(e,l||a,c.value)}))}afterExecute(...t){return this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace&&(Ut[this.$params.exportNamespace]=this.exports,this.once(()=>{delete Ut[this.$params.exportNamespace]})),super.afterExecute(...t)}};F(xt,"AutoAsyncIterator",Gt),F(xt,"AutoIterator",bt);function le(i,t,e,r){let{env:n,functionParams:o=[],exportNamespace:s,fileName:a}=r,{parserParams:l,compilerParams:c,runtimeParams:u}=ce(r),f=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,d=["async-script","module"].includes(i);if(i==="module")l.sourceType=i,l.allowAwaitOutsideFunction=!0;else if(["function","async-function"].includes(i)){let g=" "+e.split(`
|
|
1
|
+
(()=>{var or=Object.defineProperty;var zr=(i,t,e)=>t in i?or(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var be=(i,t)=>{for(var e in t)or(i,e,{get:t[e],enumerable:!0})};var F=(i,t,e)=>(zr(i,typeof t!="symbol"?t+"":t,e),e);var De={};be(De,{AsyncQuantumFunction:()=>gr,AsyncQuantumScript:()=>Tt,Observer:()=>C,QuantumAsyncFunction:()=>yi,QuantumAsyncScript:()=>wi,QuantumFunction:()=>gi,QuantumModule:()=>Xt,QuantumScript:()=>bi,State:()=>wt});var je={};be(je,{apply:()=>ie,batch:()=>se,construct:()=>Pe,defineProperties:()=>li,defineProperty:()=>Vt,deleteProperties:()=>ui,deleteProperty:()=>Bt,get:()=>ot,getOwnPropertyDescriptor:()=>ne,getOwnPropertyDescriptors:()=>ai,getPrototypeOf:()=>Ee,has:()=>oe,intercept:()=>si,isExtensible:()=>Ce,map:()=>ci,observe:()=>qe,ownKeys:()=>Wt,path:()=>oi,preventExtensions:()=>Ie,reduce:()=>Me,set:()=>ht,setPrototypeOf:()=>Te});function T(i){return!Array.isArray(i)&&typeof i=="object"&&i}function At(i){return typeof i}function E(i){return Array.isArray(i)}function we(i,t,e=null){return E(t)?i.filter(r=>e?t.filter(n=>e(r,n)).length:t.indexOf(r)!==-1):[]}function D(i,...t){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new Rt}),!arguments.length)return globalThis.webqit.refs;let e=globalThis.webqit.refs.get(i);e||(e=new Rt,globalThis.webqit.refs.set(i,e));let r,n;for(;r=t.shift();)(n=e)&&!(e=e.get(r))&&(e=new Rt,n.set(r,e));return e}var Rt=class extends Map{constructor(...t){super(...t),this.observers=new Set}set(t,e){let r=super.set(t,e);return this.fire("set",t,e,t),r}delete(t){let e=super.delete(t);return this.fire("delete",t),e}has(t){return this.fire("has",t),super.has(t)}get(t){return this.fire("get",t),super.get(t)}keyNames(){return Array.from(super.keys())}observe(t,e,r){let n={type:t,key:e,callback:r};return this.observers.add(n),()=>this.observers.delete(n)}unobserve(t,e,r){if(Array.isArray(t)||Array.isArray(e))throw new Error('The "type" and "key" arguments can only be strings.');for(let n of this.observers)!(Kt([t,"*"],n.type)&&Kt([e,"*"],n.key)&&n.callback===r)||this.observers.delete(n)}fire(t,e,...r){for(let n of this.observers)!(Kt([t,"*"],n.type)&&Kt([e,"*"],n.key))||n.callback(...r)}},Kt=(i,t)=>Array.isArray(t)?we(i,t).length:i.includes(t);function $t(i){return typeof i=="function"}function kt(i){return i===null||i===""}function it(i){return arguments.length&&(i===void 0||typeof i>"u")}function M(i){return Array.isArray(i)||typeof i=="object"&&i||$t(i)}function xe(i){return kt(i)||it(i)||i===!1||i===0||M(i)&&!Object.keys(i).length}function I(i){return $t(i)||i&&{}.toString.call(i)==="[object function]"}function Nt(i){return i instanceof Number||typeof i=="number"}function G(i){return Nt(i)||i!==!0&&i!==!1&&i!==null&&i!==""&&!isNaN(i*1)}function Et(i){return i instanceof String||typeof i=="string"&&i!==null}function _e(i){return!Et(i)&&!it(i.length)}function te(i,...t){return t.forEach(e=>{i.indexOf(e)<0&&i.push(e)}),i}function ve(r,t){t=t||Object.prototype,t=t&&!E(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 Oe(i,t){var e=[];return ve(i,t).forEach(r=>{te(e,...Object.getOwnPropertyNames(r))}),e}function J(i,t,e=!1,r=!1,n=!1){var o=0,s=i.shift();if((G(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,l)=>{!M(a)&&!I(a)||(e?Oe(a):Object.keys(a)).forEach(c=>{if(!!t(c,s,a,l)){var u=s[c],f=a[c];if((E(u)&&E(f)||T(u)&&T(f))&&(o===!0||o>0))s[c]=E(u)&&E(f)?[]:{},J([G(o)?o-1:o,s[c],u,f],t,e,r,n);else if(E(s)&&E(a))r?s[c]=f:s.push(f);else try{n?Object.defineProperty(s,c,Object.getOwnPropertyDescriptor(a,c)):s[c]=a[c]}catch{}}})}),s}function Dt(...i){return J(i,(t,e,r)=>!0,!1,!1,!1)}function k(i,t=!0){return E(i)?i:!t&&T(i)?[i]:i!==!1&&i!==0&&xe(i)?[]:_e(i)?Array.prototype.slice.call(i):T(i)?Object.values(i):[i]}var q=(...i)=>D("observer-api",...i),Ct=(i,t)=>i instanceof Promise?i.then(t):t(i),ee={};var pt=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 Lt=class extends pt{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),ee.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=k(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 Ct(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 mt=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(!M(e))throw new Error(`Subject must be of type object; "${At(e)}" given!`);let o=this;return n&&q("namespaces").has(t+"-"+n)&&(o=q("namespaces").get(t+"-"+n),t+="-"+n),!q(e,"registry").has(t)&&r&&q(e,"registry").set(t,new o(e)),q(e,"registry").get(t)}static _namespace(t,e,r=null){if(t+="-"+e,arguments.length===2)return q("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}.`);q("namespaces").set(t,r),r.__namespace=e}};var W=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 mt{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 Lt(this,{filter:t,emit:e,params:r}))}emit(t,e=!1){if(this.batches.length){this.batches[0].snapshots.push({events:[...t],isPropertyDescriptors:e});return}this.$emit(this.entries,[{events:t,isPropertyDescriptors:e}])}$emit(t,e){let r=t.filter(l=>l.params.withPropertyDescriptors).length,n=e.some(l=>l.isPropertyDescriptors),o=[],s=[],a=t.length;e.forEach(l=>{(r||!n)&&o.push(...l.events),r!==a&&n&&(l.isPropertyDescriptors?s.push(...l.events.map(c=>{let{target:u,type:f,...d}=c,p=new W(u,{type:"set",...d});return Object.defineProperty(p,"value","get"in d.value?{get:()=>d.value.get()}:{value:d.value.value}),d.oldValue&&Object.defineProperty(p,"oldValue","get"in d.oldValue?{get:()=>d.oldValue.get()}:{value:d.oldValue.value}),p})):s.push(...l.events))}),t.forEach(l=>{l.params.withPropertyDescriptors?l.fire(o.length?o:s):l.fire(s.length?s:o)})}batch(t){this.batches.unshift({entries:[...this.entries],snapshots:[]});let e=t();return Ct(e,r=>{let n=this.batches.shift();return n.snapshots.length&&this.$emit(n.entries,n.snapshots),r})}};var Ht=class extends pt{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 nt=class extends mt{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 Ht(this,t))}emit(t,e=null){let r=this;return function n(o,...s){let a=r.entries[o];return a?a.exec(t,(...l)=>n(o+1,...l),...s):e?e(t,...s):s[0]}(0)}};var $e={};be($e,{accessorize:()=>ii,proxy:()=>dr,unaccessorize:()=>ni,unproxy:()=>Ft});function ii(i,t,e={}){i=re(i);let r=q(i,"accessorizedProps");function n(l){let c,u=i;do c=Object.getOwnPropertyDescriptor(u,l);while(!c&&(u=Object.getPrototypeOf(u)));return c?{proto:u,descriptor:c}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function o(l){if(r.has(l+""))return!0;let c=n(l);c.getValue=function(d=!1){return d?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},c.setValue=function(d,p=!1){if(this.dirty=!0,p){this.descriptor=d;return}return this.descriptor.set?this.descriptor.set(d)!==!1:(this.descriptor.value=d,!0)},c.intact=function(){let d=Object.getOwnPropertyDescriptor(i,l);return d?.get===f.get&&d?.set===f.set&&r.get(l+"")===this},c.restore=function(){return this.intact()?(this.proto&&this.proto!==i||!this.proto&&!this.dirty?delete i[l]:Object.defineProperty(i,l,this.descriptor),r.delete(l+""),!0):!1},r.set(isNaN(l)?l:parseInt(l),c);let{enumerable:u=!0}=c.descriptor,f={enumerable:u,configurable:!0};("value"in c.descriptor||c.descriptor.set)&&(f.set=function(d){return ht(this,l,d,e)}),("value"in c.descriptor||c.descriptor.get)&&(f.get=function(){return ot(this,l,e)});try{return Object.defineProperty(i,l,f),!0}catch{return r.delete(l+""),!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 ni(i,t,e={}){i=re(i);let r=q(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 dr(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&&q(r,"membraneRef").has(t.membrane))return q(r,"membraneRef").get(t.membrane);let n={apply(a,l,c){if(Array.isArray(l)){let u=re(l);return q(u).set("$length",u.length),se(u,()=>ie(a,l,c))}return ie(a,Ft(l),c)},construct:(a,l,c=null)=>Pe(a,l,c,t),defineProperty:(a,l,c)=>Vt(a,l,c,t),deleteProperty:(a,l)=>Bt(a,l,t),get:(a,l,c=null)=>{let u={...t,receiver:c};Array.isArray(a)&&l==="length"&&q(a).has("$length")&&(u.forceValue=q(a).get("$length"));let f=ot(a,l,u);return Array.isArray(a)&&typeof f=="function"?dr(f,{...t,membrane:c}):f},getOwnPropertyDescriptor:(a,l)=>ne(a,l,t),getPrototypeOf:a=>Ee(a,t),has:(a,l)=>oe(a,l,t),isExtensible:a=>Ce(a,t),ownKeys:a=>Wt(a,t),preventExtensions:a=>Ie(a,t),set:(a,l,c,u=null)=>{let f={...t,receiver:u};return Array.isArray(a)&&l==="length"&&(f.forceOldValue=q(a).get("$length"),q(a).set("$length",c)),ht(a,l,c,f)},setPrototypeOf:(a,l)=>Te(a,l,t)},o=e?.(n)||n,s=new Proxy(r,o);return t.membrane&&q(r,"membraneRef").set(t.membrane,s),q(s).set(s,r),s}function Ft(i){return q(i).get(i)||i}function re(i){if(!i||!M(i))throw new Error("Target must be of type object!");return Ft(i)}var zt=class extends Array{};function oi(...i){return new zt(...i)}function Me(i,t,e,r=o=>o,n={}){if(!!t.length)return function o(s,a,l){let c=a[l.level],u=l.level===a.length-1;return s instanceof W&&s.operation!=="get"?l={...l,probe:"always"}:l.probe!=="always"&&(l={...l,probe:!u}),e(s,c,(f,...d)=>{let p=_=>{_ instanceof W&&(_.path=[_.key],s instanceof W&&(_.path=s.path.concat(_.key),Object.defineProperty(_,"context",{get:()=>s,configurable:!0})))},g=_=>{let A=Y(_,!1);return Ct(A,m=>{_ instanceof W?_.value=m:_=m;let y=d[0]||{};return o(_,a,{...l,...y,level:l.level+1})})};return ae(c)&&Array.isArray(f)?(f.forEach(p),u?r(f,...d):f.map(g)):(p(f),u?r(f,...d):g(f))},l)}(i,t.slice(0),{...n,level:0})}function qe(i,t,e,r={}){if(i=Y(i,!r.level),I(arguments[1])&&([,e,r={}]=arguments,t=1/0),!I(e))throw new Error(`Handler must be a function; "${At(e)}" given!`);if(t instanceof zt)return Me(i,t,qe,e,r);if(r={...r,descripted:!0},delete r.live,!M(i))return r.probe&&ot(i,t,e,r);let n=pr(i,t,e,r);return r.probe?ot(i,t,n,r):n()}function si(i,t,e={}){return i=Y(i),T(t)||([,,,e={}]=arguments,t={[arguments[1]]:arguments[2]}),nt.getInstance(i,!0,e.namespace).addRegistration({traps:t,params:e})}function ne(i,t,e=n=>n,r={}){return Z(i,"getOwnPropertyDescriptor",{key:t},e,r)}function ai(i,t,e=n=>n,r={}){return Z(i,"getOwnPropertyDescriptors",{key:t},e,r)}function Ee(i,t=r=>r,e={}){return Z(i,"getPrototypeOf",{},t,e)}function Ce(i,t=r=>r,e={}){return Z(i,"isExtensible",{},t,e)}function Wt(i,t=r=>r,e={}){return Z(i,"ownKeys",{},t,e)}function oe(i,t,e=n=>n,r={}){return Z(i,"has",{key:t},e,r)}function ot(i,t,e=n=>n,r={}){let n,o=Y(i,!r.level);return T(e)?[r,e]=[e,s=>s]:r.live&&(n=!0),t instanceof zt?Me(o,t,ot,e,r):fi(o,t,s=>{let a=[...s];return function l(c,u,f){if(!u.length)return f(c);let d=u.shift();if(!["string","number","symbol"].includes(typeof d))throw new Error(`Property name/key ${d} invalid.`);function p(A,m=void 0){let y=h=>(A.value=h,l([...c,r.live||r.descripted?A:h],u,f));if(arguments.length>1)return y(m);if(!M(o))return y(o?.[A.key]);let O=q(o,"accessorizedProps",!1),b=O&&O.get(A.key);if(b&&b.intact())return y(b.getValue(r.withPropertyDescriptors));if(r.withPropertyDescriptors){let h=Object.getOwnPropertyDescriptor(o,A.key);return"forceValue"in r&&"value"in h&&(h.value=r.forceValue),y(h)}return"forceValue"in r?y(r.forceValue):y(Reflect.get(o,A.key))}let g=new W(o,{type:"get",key:d,value:void 0,operation:"get",related:a});if(!M(o))return p(g);let _=nt.getInstance(o,!1,r.namespace);return _?_.emit(g,p):p(g)}([],s.slice(0),l=>{let c=ae(t)?l:l[0];return n&&M(o)?pr(o,t,e,r)(c):e(c)})},r)}function se(i,t,e={}){return i=Y(i),lt.getInstance(i,!0,e.namespace).batch(t)}function ci(i,t,e={}){t=Y(t),i=Y(i);let r=(e.only||[]).slice(0),n=(e.except||[]).slice(0),o=Wt(e.spread?[...i]:i).map(c=>isNaN(c)?c:parseInt(c)),s=r.length?r.filter(c=>o.includes(c)):o.filter(c=>!n.includes(c)),a=c=>!Array.isArray(t)||isNaN(c)?c:c-n.filter(u=>u<c).length,l=c=>{let u=ne(i,c,e);"value"in u&&u.writable&&u.enumerable&&u.configurable?ht(t,a(c),u.value,e):(u.enumerable||e.onlyEnumerable===!1)&&Vt(t,c,{...u,configurable:!0},e)};return se(t,()=>{s.forEach(l)}),qe(i,c=>{c.filter(u=>r.length?r.includes(u.key):!n.includes(u.key)).forEach(u=>{if(u.operation==="deleteProperty")return Bt(t,a(u.key),e);if(u.operation==="defineProperty"){(u.value.enumerable||e.onlyEnumerable===!1)&&Vt(t,a(u.key),{...u.value,configurable:!0},e);return}l(u.key)})},{...e,withPropertyDescriptors:!0})}function ht(i,t,e,r=s=>s,n={},o=!1){let s=Y(i),a=[[t,e]];T(t)&&([,,r=c=>c,n={},o=!1]=arguments,a=Object.entries(t)),T(r)&&([o,n,r]=[typeof n=="boolean"?n:o,r,c=>c]);let l=a.map(([c])=>c);return function c(u,f,d){if(!f.length)return d(u);let[p,g]=f.shift();function _(m,y=void 0){let O=w=>(m.status=w,c(u.concat(m),f,d));if(arguments.length>1)return O(m,y);let b=q(s,"accessorizedProps",!1),h=b&&b.get(m.key);return m.operation==="defineProperty"?(h&&!h.restore()&&O(!1),Object.defineProperty(s,m.key,m.value),O(!0)):h&&h.intact()?O(h.setValue(m.value)):O(Reflect.set(s,m.key,m.value))}function A(m,y){if(n.diff&&g===y)return c(u,f,d);let O=new W(s,{type:o?"def":"set",key:p,value:g,isUpdate:m,oldValue:y,related:[...l],operation:o?"defineProperty":"set",detail:n.detail}),b=nt.getInstance(s,!1,n.namespace);return b?b.emit(O,_):_(O)}return oe(s,p,m=>{if(!m)return A(m);let y={...n,withPropertyDescriptors:o};return"forceOldValue"in n&&(y.forceValue=n.forceOldValue),ot(s,p,O=>A(m,O),y)},n)}([],a.slice(0),c=>{let u=lt.getInstance(s,!1,n.namespace);return u&&u.emit(c,o),r(ae(t)?c.map(f=>f.status):c[0]?.status)})}function Vt(i,t,e,r=o=>o,n={}){return ht(i,t,e,r,n,!0)}function li(i,t,e=n=>n,r={}){return ht(i,t,e,r,!0)}function Bt(i,t,e=n=>n,r={}){i=Y(i),T(e)&&([r,e]=[e,s=>s]);let n=k(t,!1),o=[...n];return function s(a,l,c){if(!l.length)return c(a);let u=l.shift();function f(p,g=void 0){let _=y=>(p.status=y,s(a.concat(p),l,c));if(arguments.length>1)return _(p,g);let A=q(i,"accessorizedProps",!1),m=A&&A.get(p.key);return m&&!m.restore()&&_(!1),_(Reflect.deleteProperty(i,p.key))}function d(p){let g=new W(i,{type:"delete",key:u,oldValue:p,related:[...o],operation:"deleteProperty",detail:r.detail}),_=nt.getInstance(i,!1,r.namespace);return _?_.emit(g,f):f(g)}return ot(i,u,d,r)}([],n.slice(0),s=>{let a=lt.getInstance(i,!1,r.namespace);return a&&a.emit(s),e(ae(t)?s.map(l=>l.status):s[0].status)})}function ui(i,t,e=n=>n,r={}){return Bt(...arguments)}function Pe(i,t,e=null,r=o=>o,n={}){return Z(i,"construct",arguments.length>2?{argumentsList:t,newTarget:e}:{argumentsList:t},r,n)}function ie(i,t,e,r=o=>o,n={}){return Z(i,"apply",{thisArgument:t,argumentsList:e},r,n)}function Te(i,t,e=n=>n,r={}){return Z(i,"setPrototypeOf",{proto:t},e,r)}function Ie(i,t=r=>r,e={}){return Z(i,"preventExtensions",{},t,e)}function pr(i,t,e,r={}){let n=new AbortController;ee.setMaxListeners?.(0,n.signal),r.signal&&r.signal.addEventListener("abort",()=>n.abort()),r={...r,signal:n.signal};let o=lt.getInstance(i,!0,r.namespace);return function s(a,l=null){l?.remove();let u={signal:o.addRegistration(t,s,r).signal};if(arguments.length){let f=e(a,u);if(arguments.length>1)return f}return n}}function Z(i,t,e={},r=o=>o,n={}){i=Y(i),T(r)&&([n,r]=[r,l=>l]);function o(l,c){return arguments.length>1?r(c):r((Reflect[t]||Object[t])(i,...Object.values(e)))}let s=new W(i,{operation:t,...e}),a=nt.getInstance(i,!1,n.namespace);return a?a.emit(s,o):o(s)}function ae(i){return i===1/0||Array.isArray(i)}function Y(i,t=!0){if((!i||!M(i))&&t)throw new Error(`Object must be of type object or array! "${At(i)}" given.`);return i instanceof W&&(i=i.value),i&&Ft(i)}function fi(i,t,e,r={}){return t===1/0?r.level&&!M(i)?e([]):Wt(i,e,r):e(k(t,!1))}var di={...je,...$e},C=di;var Re=(i,...t)=>{let e=t.pop();return i.constructor.name==="AsyncFunction"?U(i.call(...t),e):e(i.call(...t))},U=(i,t)=>i instanceof Promise?i.then(t):t(i),ke=i=>typeof i=="object"&&i||typeof i=="function";function mr(i){let t=typeof i[i.length-1]=="object"?i.pop():{},e=i.pop()||"";return t.functionParams=i,{source:e,params:t}}var hr={};function ce(...i){let t,e={runtimeParams:hi,compilerParams:mi,parserParams:pi};for(;t=i.shift();){let{runtimeParams:r={},compilerParams:{globalsNoObserve:n=[],globalsOnlyPathsExcept:o=[],...s}={},parserParams:a={}}=t;e={runtimeParams:{...e.runtimeParams,...r},compilerParams:{...e.compilerParams,globalsNoObserve:[...e.compilerParams.globalsNoObserve,...n],globalsOnlyPathsExcept:[...e.compilerParams.globalsOnlyPathsExcept,...o],...s},parserParams:{...e.parserParams,...a}},i.devMode}return e}var pi={ecmaVersion:"latest",allowReturnOutsideFunction:!0,allowAwaitOutsideFunction:!1,allowSuperOutsideMethod:!1,preserveParens:!1,locations:!0},mi={globalsNoObserve:["arguments","debugger"],globalsOnlyPathsExcept:[],originalSource:!0,locations:!0,compact:2},hi={apiVersion:3};var Ut=Object.create(null);var gt=class extends EventTarget{managedAlways=new Set;managedOnce=new Set;constructor(){super(),hr.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 yt=class extends gt{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 yt(this,e,e==="object"?t:ke(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||!ke(this.state))&&(this.mutationsWatch=C.observe(this.state,e=>{let r={map:new Map,add(o,s){for(let a of o)a.spec.beforeSchedule?.(s)!==!1&&(this.map.has(a.runtime)||this.map.set(a.runtime,new Set),this.map.get(a.runtime).add(a))}};for(let o of e){let s=this.signals.get(o.key);!s||(r.add(s.subscribers,o),s.refresh(o.value))}let n=r.map.size?[...r.map].sort((o,s)=>o.$serial>s.$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 V=class extends yt{symbols=new Map;constructor(t,e,r=void 0){super(t,e,r||Object.create(null))}};var K=class extends gt{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){try{return this.runtime.thread.unshift(this),U(this.beforeExecute(),e=>Re(this.closure,this,this,r=>(this.spec.complete&&(r=this.spec.complete(r,this)),this.afterExecute(e),this.runtime.thread.shift(),t?t(r,this):r)))}catch(e){if(e.cause)throw e;let r=`${e.message||e}`;this.runtime.throw(r,[this.serial,this.context?.serial],globalThis[e.name])}}afterExecute(t){this.state="complete";let e=this.flowControl;this.handleDownstream(e.size,t.size),this.handleRightstream(e.size,t.size);for(let r of["break","continue","return"])e.has(r)&&!e.get(r).endpoint?this.hoistFlowControl(r,e.get(r).arg):t.has(r)&&!t.get(r).endpoint&&this.hoistFlowControl(r,t.get(r).arg,!0)}typed(t,e,r=void 0){let 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(l){throw new Error(`Cannot declare ${t}; ${l.message}`)}}:r,s=(a,l)=>{let c=l.scope;if(n.kind==="var")for(;!["module","function"].includes(c.type)&&!C.has(c.state,t)&&c.context;)c=c.context;else c.type==="this"&&c.context&&(c=c.context);let u=c.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 f=a;return n.restOf&&(n.type==="array"?f=[]:f={},u.reader=C.map(a,f,{except:n.restOf,spread:n.type==="array"}),l.once(u.reader)),c.symbols.set(t,u),C.set(c.state,t,f),f};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?(...l)=>{try{return e(...l)}catch(c){throw new Error(`Cannot update ${t}; ${c.message}`)}}:e;return Re(a,void 0,s,l=>{o?.reader?.abort();let c=l;return r.restOf&&(o=o||{},r.type==="array"?c=[]:c={},o.reader=C.map(l,c,{except:r.restOf,spread:r.type==="array"}),this.once(o.reader)),C.set(n.state,t,c),["postinc","postdec"].includes(r.kind)?s:c})}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=this.runtime.$params.quantumMode,o=t.type==="const",s=this===this.runtime,a=this.state==="aborted",l=this;return function c(u,f){if(n&&!o&&!s&&!a&&u.subscribe(l),!f||!u.state||typeof u.state!="object"){let p=u.state;return typeof u.state=="function"&&(p=C.proxy(u.state,{membrane:u})),p}let d;return C.proxy(u.state,{},p=>({...p,get(g,_,A=null){return d?p.get(g,_,A):(d=!0,c(u.signal(_),f-1))}}))}(t,e)}autorun(t,...e){let r=e.pop(),n=e.pop(),o=e.pop()||{},s=K,a=this.scope;if(t==="iteration"){let c=this.runtime.constructor;s=r.constructor.name==="AsyncFunction"?c.AutoAsyncIterator:c.AutoIterator}["block","iteration"].includes(t)&&(a=new V(a,t));let l=new s(this,t,o,n,a,r);if(!(t==="downstream"&&(this.downstream=l,this.flowControlApplied())))return l.execute()}function(t,e,r,n){t&&C.set(this.scope.state,n.name,n);let o=this;return Object.defineProperty(n,"toString",{value:function(s=!1){if(s&&e)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){return t&&C.set(this.scope.state,e.name,e),r.forEach(({name:n,static:o,isQuantumFunction:s,serial:a})=>{this.function(!1,s,a,o?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}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;this.type!=="block"||!(r=this.context?.downstream)||(t?r.abort():e&&(r.state="resuming",this.runtime.schedule(r)))}handleRightstream(t,e){if(this.type!=="round")return;let r=this,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 bt=class extends K{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),U(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 V(this.scope,"round",n);this.scope.symbols.forEach((l,c)=>{o.symbols.set(c,l)});let s=new K(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,l=this.spec.kind==="for-in"?s.key:parseInt(s.key),c=this.rounds.get(l);if(c)C.set(c.scope.state,this.production,a),s.type==="delete"&&(this.rounds.set(l,void 0),c.prevRound&&(c.prevRound.nextRound=c.nextRound),c.nextRound&&(c.nextRound.prevRound=c.prevRound),n.add(c));else if(s.type!=="delete"&&!s.isUpdate){if(this.spec.kind==="for-of"&&this.iterator.original&&!r.done)continue;o.add(a)}}this.runtime.on("reflection",()=>{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=>{U(this.cursor,r=>t(e,r))}))}};var Gt=class extends bt{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 wt=class{constructor(t){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})}dispose(){return this.runtime.abort(!0)}};var xt=class extends K{locations=[];queue=new Set;thread=[];iThread=[];constructor(t,e,r,n,o){super(t,e,{},-1,n,o);let{$serial:s=0,...a}=r;this.$serial=s,this.$params=a,this.$objects=new V(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}throw(t,e,r=null,n=null){let o,s=n!==null?`[${n}]: ${t}`:t,a=e.map(c=>c!==-1&&this.extractSource(c,!0)).filter(c=>c);a.push({source:this.$params.originalSource}),o=new(r||Error)(s,{cause:a});let l=this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace||this.$params.fileName;throw l&&(o.fileName=l),n&&(o.code=n),o}get runtime(){return this}get nowRunning(){return this.thread[0]}schedule(...t){let e=this.queue.size;for(let r of t)this.queue.add(r);if(!e)return this.flowControlDirty=!1,function r(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=this.$params.quantumMode?new wt(this):e;return t?t(r,this):r})}spawn(t,e,r){let n=this.nowRunning||this,o={...this.$params,$serial:this.$serial+1,quantumMode:t},s=new V(n.scope,"function",{this:e});return new this.constructor(n,"function",o,s,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&&Ut[r.source])return n(Ut[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){throw a.code==="ERR_MODULE_NOT_FOUND"&&this.throw(`Cannot find package "${r.source}"${s?` imported at "${s}"`:""}.`,[r.serial],null,a.code),a}})();return r.isDynamic||this.$promises[r.forExport?"exports":"imports"].push(o),o}async export(...t){let e=Array.isArray(t[t.length-1])?null:t.pop(),r=e?await this.import({...e,forExport:!0}):this.scope.state;this.assignModules(t,this.exports,r,e?.serial)}assignModules(t,e,r,n=null){let o=[];for(let[s,a,l]of t){if(s==="*"&&l){(this.$params.quantumMode?C:Reflect).set(e,l,r);continue}C.has(r,s)||this.throw(`The requested module does not provide an export named "${s}".`,[a,n]),(this.$params.quantumMode?C:Reflect).set(e,l||s,C.get(r,s)),o.push([s,a,l])}!o.length||!this.$params.quantumMode||this.once(C.observe(r,s=>{for(let[a,,l]of o)for(let c of s)a==="*"?C.set(e,c.key,c.value):c.key===a&&C.set(e,l||a,c.value)}))}afterExecute(...t){return this.$params.sourceType==="module"&&this.$params.experimentalFeatures!==!1&&this.$params.exportNamespace&&(Ut[this.$params.exportNamespace]=this.exports,this.once(()=>{delete Ut[this.$params.exportNamespace]})),super.afterExecute(...t)}};F(xt,"AutoAsyncIterator",Gt),F(xt,"AutoIterator",bt);function le(i,t,e,r){let{env:n,functionParams:o=[],exportNamespace:s,fileName:a}=r,{parserParams:l,compilerParams:c,runtimeParams:u}=ce(r),f=Object.getOwnPropertyDescriptor(globalThis,"window")?.get?.toString().includes("[native code]")??!1,d=["async-script","module"].includes(i);if(i==="module")l.sourceType=i,l.allowAwaitOutsideFunction=!0;else if(["function","async-function"].includes(i)){let g=" "+e.split(`
|
|
2
2
|
`).join(`
|
|
3
3
|
`);e=`return ${i==="async-function"?"async ":""}function**(${o.join(", ")}) {
|
|
4
4
|
${g}
|