@wovin/base-agent 0.1.0 → 0.1.2
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/index.min.js +27 -27
- package/dist/index.min.js.map +1 -1
- package/package.json +3 -3
package/dist/index.min.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
1
|
+
var zd={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(t,n){return"Cannot apply '"+t+"' to '"+n.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(t,n){return"[mobx.array] Index out of bounds, "+t+" is larger than "+n},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(t){return"Cannot initialize from classes that inherit from Map: "+t.constructor.name},20:function(t){return"Cannot initialize map from "+t},21:function(t){return"Cannot convert to map from '"+t+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(t){return"Cannot obtain administration from "+t},25:function(t,n){return"the entry '"+t+"' does not exist in the observable map '"+n+"'"},26:"please specify a property",27:function(t,n){return"no observable property '"+t.toString()+"' found on the observable object '"+n+"'"},28:function(t){return"Cannot obtain atom from "+t},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(t,n){return"Cycle detected in computation "+t+": "+n},33:function(t){return"The setter of computed value '"+t+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(t){return"[ComputedValue '"+t+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(t){return"[mobx] `observableArray."+t+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+t+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},Vd=zd;function ce(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=typeof e=="string"?e:Vd[e];throw typeof i=="function"&&(i=i.apply(null,n)),new Error("[MobX] "+i)}var Kd={};function Ki(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:Kd}var hu=Object.assign,Mi=Object.getOwnPropertyDescriptor,Gt=Object.defineProperty,Gr=Object.prototype,Bi=[];Object.freeze(Bi);var ps={};Object.freeze(ps);var qd=typeof Proxy<"u",Gd=Object.toString();function yu(){qd||ce("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function zr(e){X.verifyProxies&&ce("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function Et(){return++X.mobxGuid}function hs(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var dr=function(){};function je(e){return typeof e=="function"}function Bn(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function qi(e){return e!==null&&typeof e=="object"}function Lt(e){if(!qi(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===Gd}function gu(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Gi(e,t,n){Gt(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function mu(e,t,n){Gt(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function mn(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return qi(r)&&r[n]===!0}}function gr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function Wd(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function en(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var vu=typeof Object.getOwnPropertySymbols<"u";function Hd(e){var t=Object.keys(e);if(!vu)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return Gr.propertyIsEnumerable.call(e,r)})):t}var Wi=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:vu?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function ns(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function bu(e){return e===null?null:typeof e=="object"?""+e:e}function wt(e,t){return Gr.hasOwnProperty.call(e,t)}var Jd=Object.getOwnPropertyDescriptors||function(t){var n={};return Wi(t).forEach(function(r){n[r]=Mi(t,r)}),n};function ct(e,t){return!!(e&t)}function lt(e,t,n){return n?e|=t:e&=~t,e}function Xa(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ya(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Yd(r.key),r)}}function mr(e,t,n){return t&&Ya(e.prototype,t),n&&Ya(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function pr(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=Qd(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function rn(){return rn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},rn.apply(null,arguments)}function _u(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,rs(e,t)}function rs(e,t){return rs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},rs(e,t)}function Xd(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Yd(e){var t=Xd(e,"string");return typeof t=="symbol"?t:t+""}function Qd(e,t){if(e){if(typeof e=="string")return Xa(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xa(e,t):void 0}}var st=Symbol("mobx-stored-annotations");function Wt(e){function t(n,r){if(Hr(r))return e.decorate_20223_(n,r);Wr(n,r,e)}return Object.assign(t,e)}function Wr(e,t,n){if(wt(e,st)||Gi(e,st,rn({},e[st])),Di(n)&&!wt(e[st],t)){var r=e.constructor.name+".prototype."+t.toString();ce("'"+r+"' is decorated with 'override', but no such decorated member was found on prototype.")}Zd(e,n,t),Di(n)||(e[st][t]=n)}function Zd(e,t,n){if(!Di(t)&&wt(e[st],n)){var r=e.constructor.name+".prototype."+n.toString(),i=e[st][n].annotationType_,o=t.annotationType_;ce("Cannot apply '@"+o+"' to '"+r+"':"+(`
|
|
3
3
|
The field is already decorated with '@`+i+"'.")+`
|
|
4
4
|
Re-decorating fields is not allowed.
|
|
5
|
-
Use '@override' decorator for methods overridden by subclass.`)}}function
|
|
6
|
-
'`+o.annotationType_+"' can only be used on properties with a function value."))}function
|
|
7
|
-
'`+i+"' can only be used on properties with a function value."))}function
|
|
8
|
-
'`+i+"' can only be used on properties with a generator function value."))}function
|
|
9
|
-
'`+i+"' can only be used on getter(+setter) properties."))}function
|
|
10
|
-
'`+i+"' cannot be used on getter/setter properties"))}var Tp="true",Ap=Au();function Au(e){return{annotationType_:Tp,options_:e,make_:Op,extend_:Ep,decorate_20223_:Ip}}function Op(e,t,n,r){var i,o;if(n.get)return De.make_(e,t,n,r);if(n.set){var s=Bn(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:s})===null?0:2:(zt(r,t,{configurable:!0,set:s}),2)}if(r!==e.target_&&typeof n.value=="function"){var a;if(hu(n.value)){var l,c=(l=this.options_)!=null&&l.autoBind?dr.bound:dr;return c.make_(e,t,n,r)}var d=(a=this.options_)!=null&&a.autoBind?Vr.bound:Vr;return d.make_(e,t,n,r)}var g=((i=this.options_)==null?void 0:i.deep)===!1?Ce.ref:Ce;if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var C;n.value=n.value.bind((C=e.proxy_)!=null?C:e.target_)}return g.make_(e,t,n,r)}function Ep(e,t,n,r){var i,o;if(n.get)return De.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:Bn(t.toString(),n.set)},r);if(typeof n.value=="function"&&(i=this.options_)!=null&&i.autoBind){var s;n.value=n.value.bind((s=e.proxy_)!=null?s:e.target_)}var a=((o=this.options_)==null?void 0:o.deep)===!1?Ce.ref:Ce;return a.extend_(e,t,n,r)}function Ip(e,t){ce("'"+this.annotationType_+"' cannot be used as a decorator")}var Sp="observable",Np="observable.ref",$p="observable.shallow",Rp="observable.struct",Ou={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Ou);function Ii(e){return e||Ou}var ns=Hi(Sp),Pp=Hi(Np,{enhancer:Wi}),Cp=Hi($p,{enhancer:rp}),xp=Hi(Rp,{enhancer:ip}),Eu=qt(ns);function Si(e){return e.deep===!0?Mn:e.deep===!1?Wi:Mp(e.defaultDecorator)}function Up(e){var t;return e?(t=e.defaultDecorator)!=null?t:Au(e):void 0}function Mp(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Mn}function Iu(e,t,n){if(Gr(t))return ns.decorate_20223_(e,t);if(Un(t)){qr(e,t,ns);return}return pr(e)?e:Bt(e)?Ce.object(e,t,n):Array.isArray(e)?Ce.array(e,t):hr(e)?Ce.map(e,t):Qt(e)?Ce.set(e,t):typeof e=="object"&&e!==null?e:Ce.box(e,t)}du(Iu,Eu);var Bp={box:function(t,n){var r=Ii(n);return new pn(t,Si(r),r.name,!0,r.equals)},array:function(t,n){var r=Ii(n);return(X.useProxies===!1||r.proxy===!1?Bh:Ih)(t,Si(r),r.name)},map:function(t,n){var r=Ii(n);return new Qu(t,Si(r),r.name)},set:function(t,n){var r=Ii(n);return new Zu(t,Si(r),r.name)},object:function(t,n,r){return Fn(function(){return yh(X.useProxies===!1||r?.proxy===!1?br({},r):Ah({},r),t,n)})},ref:qt(Pp),shallow:qt(Cp),deep:Eu,struct:qt(xp)},Ce=du(Iu,Bp),Su="computed",Dp="computed.struct",rs=hs(Su),Lp=hs(Dp,{equals:Ve.structural}),De=function(t,n){if(Gr(n))return rs.decorate_20223_(t,n);if(Un(n))return qr(t,n,rs);if(Bt(t))return qt(hs(Su,t));je(t)||ce("First argument to `computed` should be an expression."),je(n)&&ce("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=Bt(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new wt(r)};Object.assign(De,rs);De.struct=qt(Lp);var Xa,Ya,Bi=0,kp=1,jp=(Xa=(Ya=xi(function(){},"name"))==null?void 0:Ya.configurable)!=null?Xa:!1,Qa={value:"action",configurable:!0,writable:!1,enumerable:!1};function Bn(e,t,n,r){n===void 0&&(n=!1),je(t)||ce("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&ce("actions should have valid names, got: '"+e+"'");function i(){return Nu(e,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},jp&&(Qa.value=e,zt(i,"name",Qa)),i}function Nu(e,t,n,r,i){var o=Fp(e,t,r,i);try{return n.apply(r,i)}catch(s){throw o.error_=s,s}finally{Vp(o)}}function Fp(e,t,n,r){var i=He()&&!!e,o=0;if(i){o=Date.now();var s=r?Array.from(r):Ui;ct({type:gs,name:e,object:n,arguments:s})}var a=X.trackingDerivation,l=!t||!a;mt();var c=X.allowStateChanges;l&&(kn(),c=Ji(!0));var d=ys(!0),g={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:c,prevAllowStateReads_:d,notifySpy_:i,startTime_:o,actionId_:kp++,parentActionId_:Bi};return Bi=g.actionId_,g}function Vp(e){Bi!==e.actionId_&&ce(30),Bi=e.parentActionId_,e.error_!==void 0&&(X.suppressReactionErrors=!0),Xi(e.prevAllowStateChanges_),Fr(e.prevAllowStateReads_),vt(),e.runAsAction_&&en(e.prevDerivation_),e.notifySpy_&<({time:Date.now()-e.startTime_}),X.suppressReactionErrors=!1}function Kp(e,t){var n=Ji(e);try{return t()}finally{Xi(n)}}function Ji(e){var t=X.allowStateChanges;return X.allowStateChanges=e,t}function Xi(e){X.allowStateChanges=e}var zp="create",pn=function(e){function t(r,i,o,s,a){var l;return o===void 0&&(o="ObservableValue@"+At()),s===void 0&&(s=!0),a===void 0&&(a=Ve.default),l=e.call(this,o)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=i,l.name_=o,l.equals=a,l.value_=i(r,void 0,o),s&&He()&&Dn({type:zp,object:l,observableKind:"value",debugObjectName:l.name_,newValue:""+l.value_}),l}vu(t,e);var n=t.prototype;return n.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},n.set=function(i){var o=this.value_;if(i=this.prepareNewValue_(i),i!==X.UNCHANGED){var s=He();s&&ct({type:xt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:i,oldValue:o}),this.setNewValue_(i),s&<()}},n.prepareNewValue_=function(i){if(Kt(this),yt(this)){var o=gt(this,{object:this,type:xt,newValue:i});if(!o)return X.UNCHANGED;i=o.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?X.UNCHANGED:i},n.setNewValue_=function(i){var o=this.value_;this.value_=i,this.reportChanged(),Ut(this)&&Mt(this,{type:xt,object:this,newValue:i,oldValue:o})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(i){return Yr(this,i)},n.observe_=function(i,o){return o&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:xt,newValue:this.value_,oldValue:void 0}),Qr(this,i)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return mu(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(gn),qp=yn("ObservableValue",pn),wt=function(){function e(n){this.dependenciesState_=Oe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Oe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Di(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=_t.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||ce(31),this.derivation=n.get,this.name_=n.name||"ComputedValue@"+At(),n.set&&(this.setter_=Bn(this.name_+"-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Ve.structural:Ve.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){eh(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&ce(32,this.name_,this.derivation),X.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)is(this)&&(this.warnAboutUntrackedRead_(),mt(),this.value_=this.computeValue_(!1),vt());else if(Bu(this),is(this)){var r=X.trackingContext;this.keepAlive_&&!r&&(X.trackingContext=this),this.trackAndCompute()&&Zp(this),X.trackingContext=r}var i=this.value_;if(Ri(i))throw i.cause;return i},t.set=function(r){if(this.setter_){this.isRunningSetter&&ce(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else ce(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,i=this.dependenciesState_===Oe.NOT_TRACKING_,o=this.computeValue_(!0),s=i||Ri(r)||Ri(o)||!this.equals_(r,o);return s&&(this.value_=o,He()&&Dn({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:o})),s},t.computeValue_=function(r){this.isComputing=!0;var i=Ji(!1),o;if(r)o=Ru(this,this.derivation,this.scope_);else if(X.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(s){o=new Di(s)}return Xi(i),this.isComputing=!1,o},t.suspend_=function(){this.keepAlive_||(os(this),this.value_=void 0,this.isTracing_!==_t.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(r,i){var o=this,s=!0,a=void 0;return Ot(function(){var l=o.get();if(!s||i){var c=kn();r({observableKind:"computed",debugObjectName:o.name_,type:xt,object:o,newValue:l,oldValue:a}),en(c)}s=!1,a=l})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==_t.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),(typeof this.requiresReaction_=="boolean"?this.requiresReaction_:X.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute.")},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return mu(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},yr(e,[{key:"isComputing",get:function(){return at(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=ut(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return at(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=ut(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return at(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=ut(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return at(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=ut(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return at(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=ut(this.flags_,e.diffValueMask_,r===1)}}])}();wt.isComputingMask_=1;wt.isRunningSetterMask_=2;wt.isBeingObservedMask_=4;wt.isPendingUnobservationMask_=8;wt.diffValueMask_=16;var Hr=yn("ComputedValue",wt),Oe;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(Oe||(Oe={}));var _t;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(_t||(_t={}));var Di=function(t){this.cause=void 0,this.cause=t};function Ri(e){return e instanceof Di}function is(e){switch(e.dependenciesState_){case Oe.UP_TO_DATE_:return!1;case Oe.NOT_TRACKING_:case Oe.STALE_:return!0;case Oe.POSSIBLY_STALE_:{for(var t=ys(!0),n=kn(),r=e.observing_,i=r.length,o=0;o<i;o++){var s=r[o];if(Hr(s)){if(X.disableErrorBoundaries)s.get();else try{s.get()}catch{return en(n),Fr(t),!0}if(e.dependenciesState_===Oe.STALE_)return en(n),Fr(t),!0}}return Pu(e),en(n),Fr(t),!1}}}function $u(){return X.trackingDerivation!==null}function Kt(e){var t=e.observers_.size>0;!X.allowStateChanges&&(t||X.enforceActions==="always")&&console.warn("[MobX] "+(X.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}function Gp(e){!X.allowStateReads&&X.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Ru(e,t,n){var r=ys(!0);Pu(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++X.runId;var i=X.trackingDerivation;X.trackingDerivation=e,X.inBatch++;var o;if(X.disableErrorBoundaries===!0)o=t.call(n);else try{o=t.call(n)}catch(s){o=new Di(s)}return X.inBatch--,X.trackingDerivation=i,Hp(e),Wp(e),Fr(r),o}function Wp(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:X.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function Hp(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=Oe.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,s=0;s<o;s++){var a=n[s];a.diffValue===0&&(a.diffValue=1,i!==s&&(n[i]=a),i++),a.dependenciesState_>r&&(r=a.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];l.diffValue===0&&Uu(l,e),l.diffValue=0}for(;i--;){var c=n[i];c.diffValue===1&&(c.diffValue=0,Qp(c,e))}r!==Oe.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function os(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Uu(t[n],e);e.dependenciesState_=Oe.NOT_TRACKING_}function Pe(e){var t=kn();try{return e()}finally{en(t)}}function kn(){var e=X.trackingDerivation;return X.trackingDerivation=null,e}function en(e){X.trackingDerivation=e}function ys(e){var t=X.allowStateReads;return X.allowStateReads=e,t}function Fr(e){X.allowStateReads=e}function Pu(e){if(e.dependenciesState_!==Oe.UP_TO_DATE_){e.dependenciesState_=Oe.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=Oe.UP_TO_DATE_}}var Pi=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Ci=!0,Cu=!1,X=function(){var e=Vi();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Ci=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Pi().version&&(Ci=!1),Ci?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Pi):(setTimeout(function(){Cu||ce(35)},1),new Pi)}();function Jp(){if((X.pendingReactions.length||X.inBatch||X.isRunningReactions)&&ce(36),Cu=!0,Ci){var e=Vi();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),X=new Pi}}function xu(){return X}function Xp(e){return e.observers_&&e.observers_.size>0}function Yp(e){return e.observers_}function Qp(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Uu(e,t){e.observers_.delete(t),e.observers_.size===0&&Mu(e)}function Mu(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,X.pendingUnobservations.push(e))}function mt(){X.inBatch++}function vt(){if(--X.inBatch===0){ju();for(var e=X.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof wt&&n.suspend_())}X.pendingUnobservations=[]}}function Bu(e){Gp(e);var t=X.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&X.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&X.inBatch>0&&Mu(e),!1)}function Du(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.UP_TO_DATE_&&(t.isTracing_!==_t.NONE&&Lu(t,e),t.onBecomeStale_()),t.dependenciesState_=Oe.STALE_}))}function Zp(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.POSSIBLY_STALE_?(t.dependenciesState_=Oe.STALE_,t.isTracing_!==_t.NONE&&Lu(t,e)):t.dependenciesState_===Oe.UP_TO_DATE_&&(e.lowestObserverState_=Oe.UP_TO_DATE_)}))}function eh(e){e.lowestObserverState_===Oe.UP_TO_DATE_&&(e.lowestObserverState_=Oe.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.UP_TO_DATE_&&(t.dependenciesState_=Oe.POSSIBLY_STALE_,t.onBecomeStale_())}))}function Lu(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===_t.BREAK){var n=[];ku(Jr(e),n,1),new Function(`debugger;
|
|
5
|
+
Use '@override' decorator for methods overridden by subclass.`)}}function ep(e){return wt(e,st)||Gi(e,st,rn({},e[st])),e[st]}function Hr(e){return typeof e=="object"&&typeof e.kind=="string"}function Hi(e,t){t.includes(e.kind)||ce("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var ve=Symbol("mobx administration"),vn=function(){function e(n){n===void 0&&(n="Atom@"+Et()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Oe.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return Lu(this)},t.reportChanged=function(){bt(),ku(this),_t()},t.toString=function(){return this.name_},mr(e,[{key:"isBeingObserved",get:function(){return ct(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=lt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return ct(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=lt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return ct(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=lt(this.flags_,e.diffValueMask_,r===1)}}])}();vn.isBeingObservedMask_=1;vn.isPendingUnobservationMask_=2;vn.diffValueMask_=4;var ys=mn("Atom",vn);function wu(e,t,n){t===void 0&&(t=dr),n===void 0&&(n=dr);var r=new vn(e);return t!==dr&&br(r,t),n!==dr&&zn(r,n),r}function tp(e,t){return e===t}function np(e,t){return As(e,t)}function rp(e,t){return As(e,t,1)}function ip(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ze={identity:tp,structural:np,default:ip,shallow:rp};function Dn(e,t,n){return yr(e)?e:Array.isArray(e)?Ce.array(e,{name:n}):Lt(e)?Ce.object(e,void 0,{name:n}):gr(e)?Ce.map(e,{name:n}):en(e)?Ce.set(e,{name:n}):typeof e=="function"&&!gn(e)&&!qr(e)?gu(e)?hr(e):Kr(n,e):e}function op(e,t,n){if(e==null||jn(e)||_r(e)||Ht(e)||Ut(e))return e;if(Array.isArray(e))return Ce.array(e,{name:n,deep:!1});if(Lt(e))return Ce.object(e,void 0,{name:n,deep:!1});if(gr(e))return Ce.map(e,{name:n,deep:!1});if(en(e))return Ce.set(e,{name:n,deep:!1});ce("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Ji(e){return e}function sp(e,t){return yr(e)&&ce("observable.struct should not be used with observable values"),As(e,t)?t:e}var ap="override";function Di(e){return e.annotationType_===ap}function Jr(e,t){return{annotationType_:e,options_:t,make_:up,extend_:cp,decorate_20223_:lp}}function up(e,t,n,r){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(gn(n.value))return 1;var o=Tu(e,this,t,n,!1);return Gt(r,t,o),2}function cp(e,t,n,r){var i=Tu(e,this,t,n);return e.defineProperty_(t,i,r)}function lp(e,t){Hi(t,["method","field"]);var n=t.kind,r=t.name,i=t.addInitializer,o=this,s=function(c){var d,g,C,I;return Ln((d=(g=o.options_)==null?void 0:g.name)!=null?d:r.toString(),c,(C=(I=o.options_)==null?void 0:I.autoAction)!=null?C:!1)};if(n=="field")return function(l){var c,d=l;return gn(d)||(d=s(d)),(c=o.options_)!=null&&c.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var a;return gn(e)||(e=s(e)),(a=this.options_)!=null&&a.bound&&i(function(){var l=this,c=l[r].bind(l);c.isMobxAction=!0,l[r]=c}),e}ce("Cannot apply '"+o.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
|
|
6
|
+
'`+o.annotationType_+"' can only be used on properties with a function value."))}function fp(e,t,n,r){var i=t.annotationType_,o=r.value;je(o)||ce("Cannot apply '"+i+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
7
|
+
'`+i+"' can only be used on properties with a function value."))}function Tu(e,t,n,r,i){var o,s,a,l,c,d,g;i===void 0&&(i=X.safeDescriptors),fp(e,t,n,r);var C=r.value;if((o=t.options_)!=null&&o.bound){var I;C=C.bind((I=e.proxy_)!=null?I:e.target_)}return{value:Ln((s=(a=t.options_)==null?void 0:a.name)!=null?s:n.toString(),C,(l=(c=t.options_)==null?void 0:c.autoAction)!=null?l:!1,(d=t.options_)!=null&&d.bound?(g=e.proxy_)!=null?g:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Au(e,t){return{annotationType_:e,options_:t,make_:dp,extend_:pp,decorate_20223_:hp}}function dp(e,t,n,r){var i;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!wt(e.target_,t)||!qr(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(qr(n.value))return 1;var o=Ou(e,this,t,n,!1,!1);return Gt(r,t,o),2}function pp(e,t,n,r){var i,o=Ou(e,this,t,n,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,r)}function hp(e,t){var n;Hi(t,["method"]);var r=t.name,i=t.addInitializer;return qr(e)||(e=hr(e)),(n=this.options_)!=null&&n.bound&&i(function(){var o=this,s=o[r].bind(o);s.isMobXFlow=!0,o[r]=s}),e}function yp(e,t,n,r){var i=t.annotationType_,o=r.value;je(o)||ce("Cannot apply '"+i+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
8
|
+
'`+i+"' can only be used on properties with a generator function value."))}function Ou(e,t,n,r,i,o){o===void 0&&(o=X.safeDescriptors),yp(e,t,n,r);var s=r.value;if(qr(s)||(s=hr(s)),i){var a;s=s.bind((a=e.proxy_)!=null?a:e.target_),s.isMobXFlow=!0}return{value:s,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function gs(e,t){return{annotationType_:e,options_:t,make_:gp,extend_:mp,decorate_20223_:vp}}function gp(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function mp(e,t,n,r){return bp(e,this,t,n),e.defineComputedProperty_(t,rn({},this.options_,{get:n.get,set:n.set}),r)}function vp(e,t){Hi(t,["getter"]);var n=this,r=t.name,i=t.addInitializer;return i(function(){var o=wr(this)[ve],s=rn({},n.options_,{get:e,context:this});s.name||(s.name=o.name_+"."+r.toString()),o.values_.set(r,new At(s))}),function(){return this[ve].getObservablePropValue_(r)}}function bp(e,t,n,r){var i=t.annotationType_,o=r.get;o||ce("Cannot apply '"+i+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
9
|
+
'`+i+"' can only be used on getter(+setter) properties."))}function Xi(e,t){return{annotationType_:e,options_:t,make_:_p,extend_:wp,decorate_20223_:Tp}}function _p(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function wp(e,t,n,r){var i,o;return Ap(e,this,t,n),e.defineObservableProperty_(t,n.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:Dn,r)}function Tp(e,t){if(t.kind==="field")throw ce("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");Hi(t,["accessor"]);var n=this,r=t.kind,i=t.name,o=new WeakSet;function s(a,l){var c,d,g=wr(a)[ve],C=new yn(l,(c=(d=n.options_)==null?void 0:d.enhancer)!=null?c:Dn,g.name_+"."+i.toString(),!1);g.values_.set(i,C),o.add(a)}if(r=="accessor")return{get:function(){return o.has(this)||s(this,e.get.call(this)),this[ve].getObservablePropValue_(i)},set:function(l){return o.has(this)||s(this,l),this[ve].setObservablePropValue_(i,l)},init:function(l){return o.has(this)||s(this,l),l}}}function Ap(e,t,n,r){var i=t.annotationType_;"value"in r||ce("Cannot apply '"+i+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
10
|
+
'`+i+"' cannot be used on getter/setter properties"))}var Op="true",Ep=Eu();function Eu(e){return{annotationType_:Op,options_:e,make_:Ip,extend_:Sp,decorate_20223_:$p}}function Ip(e,t,n,r){var i,o;if(n.get)return De.make_(e,t,n,r);if(n.set){var s=Ln(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:s})===null?0:2:(Gt(r,t,{configurable:!0,set:s}),2)}if(r!==e.target_&&typeof n.value=="function"){var a;if(gu(n.value)){var l,c=(l=this.options_)!=null&&l.autoBind?hr.bound:hr;return c.make_(e,t,n,r)}var d=(a=this.options_)!=null&&a.autoBind?Kr.bound:Kr;return d.make_(e,t,n,r)}var g=((i=this.options_)==null?void 0:i.deep)===!1?Ce.ref:Ce;if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var C;n.value=n.value.bind((C=e.proxy_)!=null?C:e.target_)}return g.make_(e,t,n,r)}function Sp(e,t,n,r){var i,o;if(n.get)return De.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:Ln(t.toString(),n.set)},r);if(typeof n.value=="function"&&(i=this.options_)!=null&&i.autoBind){var s;n.value=n.value.bind((s=e.proxy_)!=null?s:e.target_)}var a=((o=this.options_)==null?void 0:o.deep)===!1?Ce.ref:Ce;return a.extend_(e,t,n,r)}function $p(e,t){ce("'"+this.annotationType_+"' cannot be used as a decorator")}var Np="observable",Rp="observable.ref",Pp="observable.shallow",Cp="observable.struct",Iu={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Iu);function $i(e){return e||Iu}var is=Xi(Np),xp=Xi(Rp,{enhancer:Ji}),Up=Xi(Pp,{enhancer:op}),Mp=Xi(Cp,{enhancer:sp}),Su=Wt(is);function Ni(e){return e.deep===!0?Dn:e.deep===!1?Ji:Dp(e.defaultDecorator)}function Bp(e){var t;return e?(t=e.defaultDecorator)!=null?t:Eu(e):void 0}function Dp(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Dn}function $u(e,t,n){if(Hr(t))return is.decorate_20223_(e,t);if(Bn(t)){Wr(e,t,is);return}return yr(e)?e:Lt(e)?Ce.object(e,t,n):Array.isArray(e)?Ce.array(e,t):gr(e)?Ce.map(e,t):en(e)?Ce.set(e,t):typeof e=="object"&&e!==null?e:Ce.box(e,t)}hu($u,Su);var Lp={box:function(t,n){var r=$i(n);return new yn(t,Ni(r),r.name,!0,r.equals)},array:function(t,n){var r=$i(n);return(X.useProxies===!1||r.proxy===!1?Lh:$h)(t,Ni(r),r.name)},map:function(t,n){var r=$i(n);return new ec(t,Ni(r),r.name)},set:function(t,n){var r=$i(n);return new tc(t,Ni(r),r.name)},object:function(t,n,r){return Vn(function(){return mh(X.useProxies===!1||r?.proxy===!1?wr({},r):Eh({},r),t,n)})},ref:Wt(xp),shallow:Wt(Up),deep:Su,struct:Wt(Mp)},Ce=hu($u,Lp),Nu="computed",kp="computed.struct",os=gs(Nu),jp=gs(kp,{equals:ze.structural}),De=function(t,n){if(Hr(n))return os.decorate_20223_(t,n);if(Bn(n))return Wr(t,n,os);if(Lt(t))return Wt(gs(Nu,t));je(t)||ce("First argument to `computed` should be an expression."),je(n)&&ce("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=Lt(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new At(r)};Object.assign(De,os);De.struct=Wt(jp);var Qa,Za,Li=0,Fp=1,zp=(Qa=(Za=Mi(function(){},"name"))==null?void 0:Za.configurable)!=null?Qa:!1,eu={value:"action",configurable:!0,writable:!1,enumerable:!1};function Ln(e,t,n,r){n===void 0&&(n=!1),je(t)||ce("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&ce("actions should have valid names, got: '"+e+"'");function i(){return Ru(e,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},zp&&(eu.value=e,Gt(i,"name",eu)),i}function Ru(e,t,n,r,i){var o=Vp(e,t,r,i);try{return n.apply(r,i)}catch(s){throw o.error_=s,s}finally{Kp(o)}}function Vp(e,t,n,r){var i=Xe()&&!!e,o=0;if(i){o=Date.now();var s=r?Array.from(r):Bi;ft({type:vs,name:e,object:n,arguments:s})}var a=X.trackingDerivation,l=!t||!a;bt();var c=X.allowStateChanges;l&&(Fn(),c=Yi(!0));var d=ms(!0),g={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:c,prevAllowStateReads_:d,notifySpy_:i,startTime_:o,actionId_:Fp++,parentActionId_:Li};return Li=g.actionId_,g}function Kp(e){Li!==e.actionId_&&ce(30),Li=e.parentActionId_,e.error_!==void 0&&(X.suppressReactionErrors=!0),Qi(e.prevAllowStateChanges_),Vr(e.prevAllowStateReads_),_t(),e.runAsAction_&&nn(e.prevDerivation_),e.notifySpy_&&dt({time:Date.now()-e.startTime_}),X.suppressReactionErrors=!1}function qp(e,t){var n=Yi(e);try{return t()}finally{Qi(n)}}function Yi(e){var t=X.allowStateChanges;return X.allowStateChanges=e,t}function Qi(e){X.allowStateChanges=e}var Gp="create",yn=function(e){function t(r,i,o,s,a){var l;return o===void 0&&(o="ObservableValue@"+Et()),s===void 0&&(s=!0),a===void 0&&(a=ze.default),l=e.call(this,o)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=i,l.name_=o,l.equals=a,l.value_=i(r,void 0,o),s&&Xe()&&kn({type:Gp,object:l,observableKind:"value",debugObjectName:l.name_,newValue:""+l.value_}),l}_u(t,e);var n=t.prototype;return n.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},n.set=function(i){var o=this.value_;if(i=this.prepareNewValue_(i),i!==X.UNCHANGED){var s=Xe();s&&ft({type:Mt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:i,oldValue:o}),this.setNewValue_(i),s&&dt()}},n.prepareNewValue_=function(i){if(qt(this),mt(this)){var o=vt(this,{object:this,type:Mt,newValue:i});if(!o)return X.UNCHANGED;i=o.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?X.UNCHANGED:i},n.setNewValue_=function(i){var o=this.value_;this.value_=i,this.reportChanged(),Bt(this)&&Dt(this,{type:Mt,object:this,newValue:i,oldValue:o})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(i){return Zr(this,i)},n.observe_=function(i,o){return o&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:Mt,newValue:this.value_,oldValue:void 0}),ei(this,i)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return bu(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(vn),Wp=mn("ObservableValue",yn),At=function(){function e(n){this.dependenciesState_=Oe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Oe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new ki(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Tt.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||ce(31),this.derivation=n.get,this.name_=n.name||"ComputedValue@"+Et(),n.set&&(this.setter_=Ln(this.name_+"-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?ze.structural:ze.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){nh(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&ce(32,this.name_,this.derivation),X.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)ss(this)&&(this.warnAboutUntrackedRead_(),bt(),this.value_=this.computeValue_(!1),_t());else if(Lu(this),ss(this)){var r=X.trackingContext;this.keepAlive_&&!r&&(X.trackingContext=this),this.trackAndCompute()&&th(this),X.trackingContext=r}var i=this.value_;if(Ci(i))throw i.cause;return i},t.set=function(r){if(this.setter_){this.isRunningSetter&&ce(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else ce(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,i=this.dependenciesState_===Oe.NOT_TRACKING_,o=this.computeValue_(!0),s=i||Ci(r)||Ci(o)||!this.equals_(r,o);return s&&(this.value_=o,Xe()&&kn({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:o})),s},t.computeValue_=function(r){this.isComputing=!0;var i=Yi(!1),o;if(r)o=Cu(this,this.derivation,this.scope_);else if(X.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(s){o=new ki(s)}return Qi(i),this.isComputing=!1,o},t.suspend_=function(){this.keepAlive_||(as(this),this.value_=void 0,this.isTracing_!==Tt.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(r,i){var o=this,s=!0,a=void 0;return It(function(){var l=o.get();if(!s||i){var c=Fn();r({observableKind:"computed",debugObjectName:o.name_,type:Mt,object:o,newValue:l,oldValue:a}),nn(c)}s=!1,a=l})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==Tt.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),(typeof this.requiresReaction_=="boolean"?this.requiresReaction_:X.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute.")},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return bu(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},mr(e,[{key:"isComputing",get:function(){return ct(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=lt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return ct(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=lt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return ct(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=lt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return ct(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=lt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return ct(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=lt(this.flags_,e.diffValueMask_,r===1)}}])}();At.isComputingMask_=1;At.isRunningSetterMask_=2;At.isBeingObservedMask_=4;At.isPendingUnobservationMask_=8;At.diffValueMask_=16;var Xr=mn("ComputedValue",At),Oe;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(Oe||(Oe={}));var Tt;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Tt||(Tt={}));var ki=function(t){this.cause=void 0,this.cause=t};function Ci(e){return e instanceof ki}function ss(e){switch(e.dependenciesState_){case Oe.UP_TO_DATE_:return!1;case Oe.NOT_TRACKING_:case Oe.STALE_:return!0;case Oe.POSSIBLY_STALE_:{for(var t=ms(!0),n=Fn(),r=e.observing_,i=r.length,o=0;o<i;o++){var s=r[o];if(Xr(s)){if(X.disableErrorBoundaries)s.get();else try{s.get()}catch{return nn(n),Vr(t),!0}if(e.dependenciesState_===Oe.STALE_)return nn(n),Vr(t),!0}}return xu(e),nn(n),Vr(t),!1}}}function Pu(){return X.trackingDerivation!==null}function qt(e){var t=e.observers_.size>0;!X.allowStateChanges&&(t||X.enforceActions==="always")&&console.warn("[MobX] "+(X.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}function Hp(e){!X.allowStateReads&&X.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Cu(e,t,n){var r=ms(!0);xu(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++X.runId;var i=X.trackingDerivation;X.trackingDerivation=e,X.inBatch++;var o;if(X.disableErrorBoundaries===!0)o=t.call(n);else try{o=t.call(n)}catch(s){o=new ki(s)}return X.inBatch--,X.trackingDerivation=i,Xp(e),Jp(e),Vr(r),o}function Jp(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:X.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function Xp(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=Oe.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,s=0;s<o;s++){var a=n[s];a.diffValue===0&&(a.diffValue=1,i!==s&&(n[i]=a),i++),a.dependenciesState_>r&&(r=a.dependenciesState_)}for(n.length=i,e.newObserving_=null,o=t.length;o--;){var l=t[o];l.diffValue===0&&Bu(l,e),l.diffValue=0}for(;i--;){var c=n[i];c.diffValue===1&&(c.diffValue=0,eh(c,e))}r!==Oe.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function as(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Bu(t[n],e);e.dependenciesState_=Oe.NOT_TRACKING_}function Pe(e){var t=Fn();try{return e()}finally{nn(t)}}function Fn(){var e=X.trackingDerivation;return X.trackingDerivation=null,e}function nn(e){X.trackingDerivation=e}function ms(e){var t=X.allowStateReads;return X.allowStateReads=e,t}function Vr(e){X.allowStateReads=e}function xu(e){if(e.dependenciesState_!==Oe.UP_TO_DATE_){e.dependenciesState_=Oe.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=Oe.UP_TO_DATE_}}var xi=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Ui=!0,Uu=!1,X=function(){var e=Ki();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Ui=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new xi().version&&(Ui=!1),Ui?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new xi):(setTimeout(function(){Uu||ce(35)},1),new xi)}();function Yp(){if((X.pendingReactions.length||X.inBatch||X.isRunningReactions)&&ce(36),Uu=!0,Ui){var e=Ki();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),X=new xi}}function Mu(){return X}function Qp(e){return e.observers_&&e.observers_.size>0}function Zp(e){return e.observers_}function eh(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Bu(e,t){e.observers_.delete(t),e.observers_.size===0&&Du(e)}function Du(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,X.pendingUnobservations.push(e))}function bt(){X.inBatch++}function _t(){if(--X.inBatch===0){zu();for(var e=X.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof At&&n.suspend_())}X.pendingUnobservations=[]}}function Lu(e){Hp(e);var t=X.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&X.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&X.inBatch>0&&Du(e),!1)}function ku(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.UP_TO_DATE_&&(t.isTracing_!==Tt.NONE&&ju(t,e),t.onBecomeStale_()),t.dependenciesState_=Oe.STALE_}))}function th(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.POSSIBLY_STALE_?(t.dependenciesState_=Oe.STALE_,t.isTracing_!==Tt.NONE&&ju(t,e)):t.dependenciesState_===Oe.UP_TO_DATE_&&(e.lowestObserverState_=Oe.UP_TO_DATE_)}))}function nh(e){e.lowestObserverState_===Oe.UP_TO_DATE_&&(e.lowestObserverState_=Oe.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.UP_TO_DATE_&&(t.dependenciesState_=Oe.POSSIBLY_STALE_,t.onBecomeStale_())}))}function ju(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Tt.BREAK){var n=[];Fu(Yr(e),n,1),new Function(`debugger;
|
|
11
11
|
/*
|
|
12
12
|
Tracing '`+e.name_+`'
|
|
13
13
|
|
|
@@ -15,50 +15,50 @@ You are entering this break point because derivation '`+e.name_+"' is being trac
|
|
|
15
15
|
Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
|
|
16
16
|
The stackframe you are looking for is at least ~6-8 stack-frames up.
|
|
17
17
|
|
|
18
|
-
`+(e instanceof
|
|
18
|
+
`+(e instanceof At?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
19
19
|
|
|
20
20
|
The dependencies for this derivation are:
|
|
21
21
|
|
|
22
22
|
`+n.join(`
|
|
23
23
|
`)+`
|
|
24
24
|
*/
|
|
25
|
-
`)()}}function ku(e,t,n){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+" ".repeat(n-1)+e.name),e.dependencies&&e.dependencies.forEach(function(r){return ku(r,t,n+1)})}var Dt=function(){function e(n,r,i,o){n===void 0&&(n="Reaction@"+At()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Oe.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=_t.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=i,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,X.pendingReactions.push(this),ju())},t.runReaction_=function(){if(!this.isDisposed){mt(),this.isScheduled=!1;var r=X.trackingContext;if(X.trackingContext=this,is(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&He()&&Dn({name:this.name_,type:"scheduled-reaction"})}catch(i){this.reportExceptionInDerivation_(i)}}X.trackingContext=r,vt()}},t.track=function(r){if(!this.isDisposed){mt();var i=He(),o;i&&(o=Date.now(),ct({name:this.name_,type:"reaction"})),this.isRunning=!0;var s=X.trackingContext;X.trackingContext=this;var a=Ru(this,r,void 0);X.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&os(this),Ri(a)&&this.reportExceptionInDerivation_(a.cause),i&<({time:Date.now()-o}),vt()}},t.reportExceptionInDerivation_=function(r){var i=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(X.disableErrorBoundaries)throw r;var o="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";X.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(o,r),He()&&Dn({type:"error",name:this.name_,message:o,error:""+r}),X.globalReactionErrorHandlers.forEach(function(s){return s(r,i)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(mt(),os(this),vt()))},t.getDisposer_=function(r){var i=this,o=function s(){i.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",s)};return r==null||r.addEventListener==null||r.addEventListener("abort",o),o[ve]=this,o},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),ms(this,r)},yr(e,[{key:"isDisposed",get:function(){return at(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=ut(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return at(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=ut(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return at(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=ut(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return at(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=ut(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return at(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=ut(this.flags_,e.diffValueMask_,r===1)}}])}();Dt.isDisposedMask_=1;Dt.isScheduledMask_=2;Dt.isTrackPendingMask_=4;Dt.isRunningMask_=8;Dt.diffValueMask_=16;var Za=100,ss=function(t){return t()};function ju(){X.inBatch>0||X.isRunningReactions||ss(th)}function th(){X.isRunningReactions=!0;for(var e=X.pendingReactions,t=0;e.length>0;){++t===Za&&(console.error("Reaction doesn't converge to a stable state after "+Za+" iterations."+(" Probably there is a cycle in the reactive function: "+e[0])),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}X.isRunningReactions=!1}var Li=yn("Reaction",Dt);function nh(e){var t=ss;ss=function(r){return e(function(){return t(r)})}}function He(){return!!X.spyListeners.length}function Dn(e){if(X.spyListeners.length)for(var t=X.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function ct(e){var t=tn({},e,{spyReportStart:!0});Dn(t)}var rh={type:"report-end",spyReportEnd:!0};function lt(e){Dn(e?tn({},e,{type:"report-end",spyReportEnd:!0}):rh)}function ih(e){return X.spyListeners.push(e),ds(function(){X.spyListeners=X.spyListeners.filter(function(t){return t!==e})})}var gs="action",oh="action.bound",Fu="autoAction",sh="autoAction.bound",Vu="<unnamed action>",as=Wr(gs),ah=Wr(oh,{bound:!0}),us=Wr(Fu,{autoAction:!0}),uh=Wr(sh,{autoAction:!0,bound:!0});function Ku(e){var t=function(r,i){if(je(r))return Bn(r.name||Vu,r,e);if(je(i))return Bn(r,i,e);if(Gr(i))return(e?us:as).decorate_20223_(r,i);if(Un(i))return qr(r,i,e?us:as);if(Un(r))return qt(Wr(e?Fu:gs,{name:r,autoAction:e}));ce("Invalid arguments for `action`")};return t}var ot=Ku(!1);Object.assign(ot,as);var Vr=Ku(!0);Object.assign(Vr,us);ot.bound=qt(ah);Vr.bound=qt(uh);function gr(e){return Nu(e.name||Vu,!1,e,this,void 0)}function hn(e){return je(e)&&e.isMobxAction===!0}function Ot(e,t){var n,r,i,o;t===void 0&&(t=fs),je(e)||ce("Autorun expects a function as first argument"),hn(e)&&ce("Autorun does not accept actions since actions are untrackable");var s=(n=(r=t)==null?void 0:r.name)!=null?n:e.name||"Autorun@"+At(),a=!t.scheduler&&!t.delay,l;if(a)l=new Dt(s,function(){this.track(g)},t.onError,t.requiresObservable);else{var c=zu(t),d=!1;l=new Dt(s,function(){d||(d=!0,c(function(){d=!1,l.isDisposed||l.track(g)}))},t.onError,t.requiresObservable)}function g(){e(l)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||l.schedule_(),l.getDisposer_((o=t)==null?void 0:o.signal)}var ch=function(t){return t()};function zu(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:ch}function qu(e,t,n){var r,i,o;n===void 0&&(n=fs),(!je(e)||!je(t))&&ce("First and second argument to reaction should be functions"),Bt(n)||ce("Third argument of reactions should be an object");var s=(r=n.name)!=null?r:"Reaction@"+At(),a=ot(s,n.onError?lh(n.onError,t):t),l=!n.scheduler&&!n.delay,c=zu(n),d=!0,g=!1,C,I=n.compareStructural?Ve.structural:n.equals||Ve.default,S=new Dt(s,function(){d||l?V():g||(g=!0,c(V))},n.onError,n.requiresObservable);function V(){if(g=!1,!S.isDisposed){var J=!1,F=C;S.track(function(){var k=Kp(!1,function(){return e(S)});J=d||!I(C,k),C=k}),(d&&n.fireImmediately||!d&&J)&&a(C,F,S),d=!1}}return(i=n)!=null&&(i=i.signal)!=null&&i.aborted||S.schedule_(),S.getDisposer_((o=n)==null?void 0:o.signal)}function lh(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}var fh="onBO",dh="onBUO";function mr(e,t,n){return Gu(fh,e,t,n)}function jn(e,t,n){return Gu(dh,e,t,n)}function Gu(e,t,n,r){var i=typeof r=="function"?Tt(t,n):Tt(t),o=je(r)?r:n,s=e+"L";return i[s]?i[s].add(o):i[s]=new Set([o]),function(){var a=i[s];a&&(a.delete(o),a.size===0&&delete i[s])}}var ph="never",Ni="always",hh="observed";function Wu(e){e.isolateGlobalState===!0&&Jp();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(X.useProxies=t===Ni?!0:t===ph?!1:typeof Proxy<"u"),t==="ifavailable"&&(X.verifyProxies=!0),n!==void 0){var r=n===Ni?Ni:n===hh;X.enforceActions=r,X.allowStateChanges=!(r===!0||r===Ni)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(X[i]=!!e[i])}),X.allowStateReads=!X.observableRequiresReaction,X.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&nh(e.reactionScheduler)}function yh(e,t,n,r){arguments.length>4&&ce("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&ce("'extendObservable' expects an object as first argument"),Gt(e)&&ce("'extendObservable' should not be used on maps, use map.merge instead"),Bt(t)||ce("'extendObservable' only accepts plain objects as second argument"),(pr(t)||pr(n))&&ce("Extending an object with another observable (object) is not supported");var i=Wd(t);return Fn(function(){var o=br(e,r)[ve];qi(i).forEach(function(s){o.extend_(s,i[s],n&&s in n?n[s]:!0)})}),e}function Jr(e,t){return Hu(Tt(e,t))}function Hu(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=gh(e.observing_).map(Hu)),t}function Xr(e,t){return Ju(Tt(e,t))}function Ju(e){var t={name:e.name_};return Xp(e)&&(t.observers=Array.from(Yp(e)).map(Ju)),t}function gh(e){return Array.from(new Set(e))}var mh=0;function Xu(){this.message="FLOW_CANCELLED"}Xu.prototype=Object.create(Error.prototype);var Qo=wu("flow"),vh=wu("flow.bound",{bound:!0}),dr=Object.assign(function(t,n){if(Gr(n))return Qo.decorate_20223_(t,n);if(Un(n))return qr(t,n,Qo);arguments.length!==1&&ce("Flow expects single argument with generator function");var r=t,i=r.name||"<unnamed flow>",o=function(){var a=this,l=arguments,c=++mh,d=ot(i+" - runid: "+c+" - init",r).apply(a,l),g,C=void 0,I=new Promise(function(S,V){var J=0;g=V;function F(W){C=void 0;var j;try{j=ot(i+" - runid: "+c+" - yield "+J++,d.next).call(d,W)}catch(Z){return V(Z)}z(j)}function k(W){C=void 0;var j;try{j=ot(i+" - runid: "+c+" - yield "+J++,d.throw).call(d,W)}catch(Z){return V(Z)}z(j)}function z(W){if(je(W?.then)){W.then(z,V);return}return W.done?S(W.value):(C=Promise.resolve(W.value),C.then(F,k))}F(void 0)});return I.cancel=ot(i+" - runid: "+c+" - cancel",function(){try{C&&eu(C);var S=d.return(void 0),V=Promise.resolve(S.value);V.then(lr,lr),eu(V),g(new Xu)}catch(J){g(J)}}),I};return o.isMobXFlow=!0,o},Qo);dr.bound=qt(vh);function eu(e){je(e.cancel)&&e.cancel()}function Kr(e){return e?.isMobXFlow===!0}function bh(e,t){return e?t!==void 0?Gt(e)||vr(e)?ce("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):Ln(e)?e[ve].values_.has(t):!1:Ln(e)||!!e[ve]||ps(e)||Li(e)||Hr(e):!1}function pr(e){return arguments.length!==1&&ce("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),bh(e)}function _h(e){if(Ln(e))return e[ve].ownKeys_();ce(38)}function $i(e,t,n){return e.set(t,n),n}function cr(e,t){if(e==null||typeof e!="object"||e instanceof Date||!pr(e))return e;if(qp(e)||Hr(e))return cr(e.get(),t);if(t.has(e))return t.get(e);if(vr(e)){var n=$i(t,e,new Array(e.length));return e.forEach(function(s,a){n[a]=cr(s,t)}),n}if(Ct(e)){var r=$i(t,e,new Set);return e.forEach(function(s){r.add(cr(s,t))}),r}if(Gt(e)){var i=$i(t,e,new Map);return e.forEach(function(s,a){i.set(a,cr(s,t))}),i}else{var o=$i(t,e,{});return _h(e).forEach(function(s){zr.propertyIsEnumerable.call(e,s)&&(o[s]=cr(e[s],t))}),o}}function nn(e,t){return t&&ce("toJS no longer supports options"),cr(e,new Map)}function ms(){for(var e=!1,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];typeof n[n.length-1]=="boolean"&&(e=n.pop());var i=wh(n);if(!i)return ce("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===_t.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?_t.BREAK:_t.LOG}function wh(e){switch(e.length){case 0:return X.trackingDerivation;case 1:return Tt(e[0]);case 2:return Tt(e[0],e[1])}}function Zt(e,t){t===void 0&&(t=void 0),mt();try{return e.apply(t)}finally{vt()}}function xn(e){return e[ve]}var Th={has:function(t,n){return X.trackingDerivation&&jr("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),xn(t).has_(n)},get:function(t,n){return xn(t).get_(n)},set:function(t,n,r){var i;return Un(n)?(xn(t).values_.has(n)||jr("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(i=xn(t).set_(n,r,!0))!=null?i:!0):!1},deleteProperty:function(t,n){var r;return jr("delete properties from an observable object. Use 'remove' from 'mobx' instead."),Un(n)?(r=xn(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var i;return jr("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(i=xn(t).defineProperty_(n,r))!=null?i:!0},ownKeys:function(t){return X.trackingDerivation&&jr("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),xn(t).ownKeys_()},preventExtensions:function(t){ce(13)}};function Ah(e,t){var n,r;return pu(),e=br(e,t),(r=(n=e[ve]).proxy_)!=null?r:n.proxy_=new Proxy(e,Th)}function yt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Yr(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),ds(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function gt(e,t){var n=kn();try{for(var r=[].concat(e.interceptors_||[]),i=0,o=r.length;i<o&&(t=r[i](t),t&&!t.type&&ce(14),!!t);i++);return t}finally{en(n)}}function Ut(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Qr(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),ds(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Mt(e,t){var n=kn(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,o=r.length;i<o;i++)r[i](t);en(n)}}function mn(e,t,n){return Fn(function(){var r,i=br(e,n)[ve];t&&e[it]&&ce("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(r=t)!=null||(t=Qd(e)),qi(t).forEach(function(o){return i.make_(o,t[o])})}),e}var tu="splice",xt="update",Oh=1e4,Eh={get:function(t,n){var r=t[ve];return n===ve?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):bt(ki,n)?ki[n]:t[n]},set:function(t,n,r){var i=t[ve];return n==="length"&&i.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:i.set_(parseInt(n),r),!0},preventExtensions:function(){ce(15)}},vs=function(){function e(n,r,i,o){n===void 0&&(n="ObservableArray@"+At()),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=o,this.atom_=new gn(n),this.enhancer_=function(s,a){return r(s,a,n+"[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return Yr(this,r)},t.observe_=function(r,i){return i===void 0&&(i=!1),i&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Qr(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&ce("Out of range: "+r);var i=this.values_.length;if(r!==i)if(r>i){for(var o=new Array(r-i),s=0;s<r-i;s++)o[s]=void 0;this.spliceWithArray_(i,0,o)}else this.spliceWithArray_(r,i-r)},t.updateArrayLength_=function(r,i){r!==this.lastKnownLength_&&ce(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&nc(r+i+1)},t.spliceWithArray_=function(r,i,o){var s=this;Kt(this.atom_);var a=this.values_.length;if(r===void 0?r=0:r>a?r=a:r<0&&(r=Math.max(0,a+r)),arguments.length===1?i=a-r:i==null?i=0:i=Math.max(0,Math.min(i,a-r)),o===void 0&&(o=Ui),yt(this)){var l=gt(this,{object:this.proxy_,type:tu,index:r,removedCount:i,added:o});if(!l)return Ui;i=l.removedCount,o=l.added}o=o.length===0?o:o.map(function(g){return s.enhancer_(g,void 0)}),this.legacyMode_;var c=o.length-i;this.updateArrayLength_(a,c);var d=this.spliceItemsIntoValues_(r,i,o);return(i!==0||o.length!==0)&&this.notifyArraySplice_(r,o,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(r,i,o){if(o.length<Oh){var s;return(s=this.values_).splice.apply(s,[r,i].concat(o))}else{var a=this.values_.slice(r,r+i),l=this.values_.slice(r+i);this.values_.length+=o.length-i;for(var c=0;c<o.length;c++)this.values_[r+c]=o[c];for(var d=0;d<l.length;d++)this.values_[r+o.length+d]=l[d];return a}},t.notifyArrayChildUpdate_=function(r,i,o){var s=!this.owned_&&He(),a=Ut(this),l=a||s?{observableKind:"array",object:this.proxy_,type:xt,debugObjectName:this.atom_.name_,index:r,newValue:i,oldValue:o}:null;s&&ct(l),this.atom_.reportChanged(),a&&Mt(this,l),s&<()},t.notifyArraySplice_=function(r,i,o){var s=!this.owned_&&He(),a=Ut(this),l=a||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:tu,index:r,removed:o,added:i,removedCount:o.length,addedCount:i.length}:null;s&&ct(l),this.atom_.reportChanged(),a&&Mt(this,l),s&<()},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx.array] Attempt to read an array index ("+r+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX");return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,i){var o=this.values_;if(this.legacyMode_&&r>o.length&&ce(17,r,o.length),r<o.length){Kt(this.atom_);var s=o[r];if(yt(this)){var a=gt(this,{type:xt,object:this.proxy_,index:r,newValue:i});if(!a)return;i=a.newValue}i=this.enhancer_(i,s);var l=i!==s;l&&(o[r]=i,this.notifyArrayChildUpdate_(r,i,s))}else{for(var c=new Array(r+1-o.length),d=0;d<c.length-1;d++)c[d]=void 0;c[c.length-1]=i,this.spliceWithArray_(o.length,0,c)}},e}();function Ih(e,t,n,r){return n===void 0&&(n="ObservableArray@"+At()),r===void 0&&(r=!1),pu(),Fn(function(){var i=new vs(n,t,r,!1);yu(i.values_,ve,i);var o=new Proxy(i.values_,Eh);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var ki={clear:function(){return this.splice(0)},replace:function(t){var n=this[ve];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];var s=this[ve];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(t);case 2:return s.spliceWithArray_(t,n)}return s.spliceWithArray_(t,n,i)},spliceWithArray:function(t,n,r){return this[ve].spliceWithArray_(t,n,r)},push:function(){for(var t=this[ve],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[ve].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[ve],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return X.trackingDerivation&&ce(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){X.trackingDerivation&&ce(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[ve],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};xe("at",ft);xe("concat",ft);xe("flat",ft);xe("includes",ft);xe("indexOf",ft);xe("join",ft);xe("lastIndexOf",ft);xe("slice",ft);xe("toString",ft);xe("toLocaleString",ft);xe("toSorted",ft);xe("toSpliced",ft);xe("with",ft);xe("every",Lt);xe("filter",Lt);xe("find",Lt);xe("findIndex",Lt);xe("findLast",Lt);xe("findLastIndex",Lt);xe("flatMap",Lt);xe("forEach",Lt);xe("map",Lt);xe("some",Lt);xe("toReversed",Lt);xe("reduce",Yu);xe("reduceRight",Yu);function xe(e,t){typeof Array.prototype[e]=="function"&&(ki[e]=t(e))}function ft(e){return function(){var t=this[ve];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Lt(e){return function(t,n){var r=this,i=this[ve];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(s,a){return t.call(n,s,a,r)})}}function Yu(e){return function(){var t=this,n=this[ve];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(o,s,a){return i(o,s,a,t)},r[e].apply(r,arguments)}}var Sh=yn("ObservableArrayAdministration",vs);function vr(e){return Ki(e)&&Sh(e[ve])}var Nh={},dn="add",ji="delete",Qu=function(){function e(n,r,i){var o=this;r===void 0&&(r=Mn),i===void 0&&(i="ObservableMap@"+At()),this.enhancer_=void 0,this.name_=void 0,this[ve]=Nh,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=i,je(Map)||ce(18),Fn(function(){o.keysAtom_=bu(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,n&&o.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var i=this;if(!X.trackingDerivation)return this.has_(r);var o=this.hasMap_.get(r);if(!o){var s=o=new pn(this.has_(r),Wi,this.name_+"."+es(r)+"?",!1);this.hasMap_.set(r,s),jn(s,function(){return i.hasMap_.delete(r)})}return o.get()},t.set=function(r,i){var o=this.has_(r);if(yt(this)){var s=gt(this,{type:o?xt:dn,object:this,newValue:i,name:r});if(!s)return this;i=s.newValue}return o?this.updateValue_(r,i):this.addValue_(r,i),this},t.delete=function(r){var i=this;if(Kt(this.keysAtom_),yt(this)){var o=gt(this,{type:ji,object:this,name:r});if(!o)return!1}if(this.has_(r)){var s=He(),a=Ut(this),l=a||s?{observableKind:"map",debugObjectName:this.name_,type:ji,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return s&&ct(l),Zt(function(){var c;i.keysAtom_.reportChanged(),(c=i.hasMap_.get(r))==null||c.setNewValue_(!1);var d=i.data_.get(r);d.setNewValue_(void 0),i.data_.delete(r)}),a&&Mt(this,l),s&<(),!0}return!1},t.updateValue_=function(r,i){var o=this.data_.get(r);if(i=o.prepareNewValue_(i),i!==X.UNCHANGED){var s=He(),a=Ut(this),l=a||s?{observableKind:"map",debugObjectName:this.name_,type:xt,object:this,oldValue:o.value_,name:r,newValue:i}:null;s&&ct(l),o.setNewValue_(i),a&&Mt(this,l),s&<()}},t.addValue_=function(r,i){var o=this;Kt(this.keysAtom_),Zt(function(){var c,d=new pn(i,o.enhancer_,o.name_+"."+es(r),!1);o.data_.set(r,d),i=d.value_,(c=o.hasMap_.get(r))==null||c.setNewValue_(!0),o.keysAtom_.reportChanged()});var s=He(),a=Ut(this),l=a||s?{observableKind:"map",debugObjectName:this.name_,type:dn,object:this,name:r,newValue:i}:null;s&&ct(l),a&&Mt(this,l),s&<()},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,i=this.keys();return nu({next:function(){var s=i.next(),a=s.done,l=s.value;return{done:a,value:a?void 0:r.get(l)}}})},t.entries=function(){var r=this,i=this.keys();return nu({next:function(){var s=i.next(),a=s.done,l=s.value;return{done:a,value:a?void 0:[l,r.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,i){for(var o=fr(this),s;!(s=o()).done;){var a=s.value,l=a[0],c=a[1];r.call(i,c,l,this)}},t.merge=function(r){var i=this;return Gt(r)&&(r=new Map(r)),Zt(function(){Bt(r)?Gd(r).forEach(function(o){return i.set(o,r[o])}):Array.isArray(r)?r.forEach(function(o){var s=o[0],a=o[1];return i.set(s,a)}):hr(r)?(qd(r)||ce(19,r),r.forEach(function(o,s){return i.set(s,o)})):r!=null&&ce(20,r)}),this},t.clear=function(){var r=this;Zt(function(){Pe(function(){for(var i=fr(r.keys()),o;!(o=i()).done;){var s=o.value;r.delete(s)}})})},t.replace=function(r){var i=this;return Zt(function(){for(var o=$h(r),s=new Map,a=!1,l=fr(i.data_.keys()),c;!(c=l()).done;){var d=c.value;if(!o.has(d)){var g=i.delete(d);if(g)a=!0;else{var C=i.data_.get(d);s.set(d,C)}}}for(var I=fr(o.entries()),S;!(S=I()).done;){var V=S.value,J=V[0],F=V[1],k=i.data_.has(J);if(i.set(J,F),i.data_.has(J)){var z=i.data_.get(J);s.set(J,z),k||(a=!0)}}if(!a)if(i.data_.size!==s.size)i.keysAtom_.reportChanged();else for(var W=i.data_.keys(),j=s.keys(),Z=W.next(),G=j.next();!Z.done;){if(Z.value!==G.value){i.keysAtom_.reportChanged();break}Z=W.next(),G=j.next()}i.data_=s}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,i){return i===!0&&ce("`observe` doesn't support fireImmediately=true in combination with maps."),Qr(this,r)},t.intercept_=function(r){return Yr(this,r)},yr(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Gt=yn("ObservableMap",Qu);function nu(e){return e[Symbol.toStringTag]="MapIterator",Ts(e)}function $h(e){if(hr(e)||Gt(e))return e;if(Array.isArray(e))return new Map(e);if(Bt(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return ce(21,e)}var Rh={},Zu=function(){function e(n,r,i){var o=this;r===void 0&&(r=Mn),i===void 0&&(i="ObservableSet@"+At()),this.name_=void 0,this[ve]=Rh,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,je(Set)||ce(22),this.enhancer_=function(s,a){return r(s,a,i)},Fn(function(){o.atom_=bu(o.name_),n&&o.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;Zt(function(){Pe(function(){for(var i=fr(r.data_.values()),o;!(o=i()).done;){var s=o.value;r.delete(s)}})})},t.forEach=function(r,i){for(var o=fr(this),s;!(s=o()).done;){var a=s.value;r.call(i,a,a,this)}},t.add=function(r){var i=this;if(Kt(this.atom_),yt(this)){var o=gt(this,{type:dn,object:this,newValue:r});if(!o)return this;r=o.newValue}if(!this.has(r)){Zt(function(){i.data_.add(i.enhancer_(r,void 0)),i.atom_.reportChanged()});var s=He(),a=Ut(this),l=a||s?{observableKind:"set",debugObjectName:this.name_,type:dn,object:this,newValue:r}:null;s&&ct(l),a&&Mt(this,l),s&<()}return this},t.delete=function(r){var i=this;if(yt(this)){var o=gt(this,{type:ji,object:this,oldValue:r});if(!o)return!1}if(this.has(r)){var s=He(),a=Ut(this),l=a||s?{observableKind:"set",debugObjectName:this.name_,type:ji,object:this,oldValue:r}:null;return s&&ct(l),Zt(function(){i.atom_.reportChanged(),i.data_.delete(r)}),a&&Mt(this,l),s&<(),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return ru({next:function(){var o=r.next(),s=o.value,a=o.done;return a?{value:void 0,done:a}:{value:[s,s],done:a}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,i=this.data_.values();return ru({next:function(){var s=i.next(),a=s.value,l=s.done;return l?{value:void 0,done:l}:{value:r.dehanceValue_(a),done:l}}})},t.intersection=function(r){if(Qt(r)&&!Ct(r))return r.intersection(this);var i=new Set(this);return i.intersection(r)},t.union=function(r){if(Qt(r)&&!Ct(r))return r.union(this);var i=new Set(this);return i.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(Qt(r)&&!Ct(r))return r.symmetricDifference(this);var i=new Set(this);return i.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(Qt(r)&&!Ct(r))return r.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(r)},t.replace=function(r){var i=this;return Ct(r)&&(r=new Set(r)),Zt(function(){Array.isArray(r)?(i.clear(),r.forEach(function(o){return i.add(o)})):Qt(r)?(i.clear(),r.forEach(function(o){return i.add(o)})):r!=null&&ce("Cannot initialize set from "+r)}),this},t.observe_=function(r,i){return i===!0&&ce("`observe` doesn't support fireImmediately=true in combination with sets."),Qr(this,r)},t.intercept_=function(r){return Yr(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},yr(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Ct=yn("ObservableSet",Zu);function ru(e){return e[Symbol.toStringTag]="SetIterator",Ts(e)}var iu=Object.create(null),ou="remove",cs=function(){function e(n,r,i,o){r===void 0&&(r=new Map),o===void 0&&(o=Ap),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=r,this.name_=i,this.defaultAnnotation_=o,this.keysAtom_=new gn(this.name_+".keys"),this.isPlainObject_=Bt(this.target_),rc(this.defaultAnnotation_)||ce("defaultAnnotation must be valid annotation"),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,i){var o=this.values_.get(r);if(o instanceof wt)return o.set(i),!0;if(yt(this)){var s=gt(this,{type:xt,object:this.proxy_||this.target_,name:r,newValue:i});if(!s)return null;i=s.newValue}if(i=o.prepareNewValue_(i),i!==X.UNCHANGED){var a=Ut(this),l=He(),c=a||l?{type:xt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:r,newValue:i}:null;l&&ct(c),o.setNewValue_(i),a&&Mt(this,c),l&<()}return!0},t.get_=function(r){return X.trackingDerivation&&!bt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,i,o){return o===void 0&&(o=!1),bt(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,i):o?Reflect.set(this.target_,r,i):(this.target_[r]=i,!0):this.extend_(r,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,o)},t.has_=function(r){if(!X.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(r);return i||(i=new pn(r in this.target_,Wi,this.name_+"."+es(r)+"?",!1),this.pendingKeys_.set(r,i)),i.get()},t.make_=function(r,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(uu(this,i,r),!(r in this.target_)){var o;if((o=this.target_[it])!=null&&o[r])return;ce(1,i.annotationType_,this.name_+"."+r.toString())}for(var s=this.target_;s&&s!==zr;){var a=xi(s,r);if(a){var l=i.make_(this,r,a,s);if(l===0)return;if(l===1)break}s=Object.getPrototypeOf(s)}au(this,i,r)}},t.extend_=function(r,i,o,s){if(s===void 0&&(s=!1),o===!0&&(o=this.defaultAnnotation_),o===!1)return this.defineProperty_(r,i,s);uu(this,o,r);var a=o.extend_(this,r,i,s);return a&&au(this,o,r),a},t.defineProperty_=function(r,i,o){o===void 0&&(o=!1),Kt(this.keysAtom_);try{mt();var s=this.delete_(r);if(!s)return s;if(yt(this)){var a=gt(this,{object:this.proxy_||this.target_,name:r,type:dn,newValue:i.value});if(!a)return null;var l=a.newValue;i.value!==l&&(i=tn({},i,{value:l}))}if(o){if(!Reflect.defineProperty(this.target_,r,i))return!1}else zt(this.target_,r,i);this.notifyPropertyAddition_(r,i.value)}finally{vt()}return!0},t.defineObservableProperty_=function(r,i,o,s){s===void 0&&(s=!1),Kt(this.keysAtom_);try{mt();var a=this.delete_(r);if(!a)return a;if(yt(this)){var l=gt(this,{object:this.proxy_||this.target_,name:r,type:dn,newValue:i});if(!l)return null;i=l.newValue}var c=su(r),d={configurable:X.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:c.get,set:c.set};if(s){if(!Reflect.defineProperty(this.target_,r,d))return!1}else zt(this.target_,r,d);var g=new pn(i,o,this.name_+"."+r.toString(),!1);this.values_.set(r,g),this.notifyPropertyAddition_(r,g.value_)}finally{vt()}return!0},t.defineComputedProperty_=function(r,i,o){o===void 0&&(o=!1),Kt(this.keysAtom_);try{mt();var s=this.delete_(r);if(!s)return s;if(yt(this)){var a=gt(this,{object:this.proxy_||this.target_,name:r,type:dn,newValue:void 0});if(!a)return null}i.name||(i.name=this.name_+"."+r.toString()),i.context=this.proxy_||this.target_;var l=su(r),c={configurable:X.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(o){if(!Reflect.defineProperty(this.target_,r,c))return!1}else zt(this.target_,r,c);this.values_.set(r,new wt(i)),this.notifyPropertyAddition_(r,void 0)}finally{vt()}return!0},t.delete_=function(r,i){if(i===void 0&&(i=!1),Kt(this.keysAtom_),!bt(this.target_,r))return!0;if(yt(this)){var o=gt(this,{object:this.proxy_||this.target_,name:r,type:ou});if(!o)return null}try{var s;mt();var a=Ut(this),l=He(),c=this.values_.get(r),d=void 0;if(!c&&(a||l)){var g;d=(g=xi(this.target_,r))==null?void 0:g.value}if(i){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(delete this.appliedAnnotations_[r],c&&(this.values_.delete(r),c instanceof pn&&(d=c.value_),Du(c)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(r in this.target_),a||l){var C={type:ou,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};l&&ct(C),a&&Mt(this,C),l&<()}}finally{vt()}return!0},t.observe_=function(r,i){return i===!0&&ce("`observe` doesn't support the fire immediately property for observable objects."),Qr(this,r)},t.intercept_=function(r){return Yr(this,r)},t.notifyPropertyAddition_=function(r,i){var o,s=Ut(this),a=He();if(s||a){var l=s||a?{type:dn,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:i}:null;a&&ct(l),s&&Mt(this,l),a&<()}(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),qi(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function br(e,t){var n;if(t&&Ln(e)&&ce("Options can't be provided for already observable objects."),bt(e,ve))return _s(e)instanceof cs||ce("Cannot convert '"+Fi(e)+`' into observable object:
|
|
25
|
+
`)()}}function Fu(e,t,n){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+" ".repeat(n-1)+e.name),e.dependencies&&e.dependencies.forEach(function(r){return Fu(r,t,n+1)})}var kt=function(){function e(n,r,i,o){n===void 0&&(n="Reaction@"+Et()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Oe.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Tt.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=i,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,X.pendingReactions.push(this),zu())},t.runReaction_=function(){if(!this.isDisposed){bt(),this.isScheduled=!1;var r=X.trackingContext;if(X.trackingContext=this,ss(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&Xe()&&kn({name:this.name_,type:"scheduled-reaction"})}catch(i){this.reportExceptionInDerivation_(i)}}X.trackingContext=r,_t()}},t.track=function(r){if(!this.isDisposed){bt();var i=Xe(),o;i&&(o=Date.now(),ft({name:this.name_,type:"reaction"})),this.isRunning=!0;var s=X.trackingContext;X.trackingContext=this;var a=Cu(this,r,void 0);X.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&as(this),Ci(a)&&this.reportExceptionInDerivation_(a.cause),i&&dt({time:Date.now()-o}),_t()}},t.reportExceptionInDerivation_=function(r){var i=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(X.disableErrorBoundaries)throw r;var o="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";X.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(o,r),Xe()&&kn({type:"error",name:this.name_,message:o,error:""+r}),X.globalReactionErrorHandlers.forEach(function(s){return s(r,i)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(bt(),as(this),_t()))},t.getDisposer_=function(r){var i=this,o=function s(){i.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",s)};return r==null||r.addEventListener==null||r.addEventListener("abort",o),o[ve]=this,o},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),bs(this,r)},mr(e,[{key:"isDisposed",get:function(){return ct(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=lt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return ct(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=lt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return ct(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=lt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return ct(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=lt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return ct(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=lt(this.flags_,e.diffValueMask_,r===1)}}])}();kt.isDisposedMask_=1;kt.isScheduledMask_=2;kt.isTrackPendingMask_=4;kt.isRunningMask_=8;kt.diffValueMask_=16;var tu=100,us=function(t){return t()};function zu(){X.inBatch>0||X.isRunningReactions||us(rh)}function rh(){X.isRunningReactions=!0;for(var e=X.pendingReactions,t=0;e.length>0;){++t===tu&&(console.error("Reaction doesn't converge to a stable state after "+tu+" iterations."+(" Probably there is a cycle in the reactive function: "+e[0])),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}X.isRunningReactions=!1}var ji=mn("Reaction",kt);function ih(e){var t=us;us=function(r){return e(function(){return t(r)})}}function Xe(){return!!X.spyListeners.length}function kn(e){if(X.spyListeners.length)for(var t=X.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function ft(e){var t=rn({},e,{spyReportStart:!0});kn(t)}var oh={type:"report-end",spyReportEnd:!0};function dt(e){kn(e?rn({},e,{type:"report-end",spyReportEnd:!0}):oh)}function sh(e){return X.spyListeners.push(e),hs(function(){X.spyListeners=X.spyListeners.filter(function(t){return t!==e})})}var vs="action",ah="action.bound",Vu="autoAction",uh="autoAction.bound",Ku="<unnamed action>",cs=Jr(vs),ch=Jr(ah,{bound:!0}),ls=Jr(Vu,{autoAction:!0}),lh=Jr(uh,{autoAction:!0,bound:!0});function qu(e){var t=function(r,i){if(je(r))return Ln(r.name||Ku,r,e);if(je(i))return Ln(r,i,e);if(Hr(i))return(e?ls:cs).decorate_20223_(r,i);if(Bn(i))return Wr(r,i,e?ls:cs);if(Bn(r))return Wt(Jr(e?Vu:vs,{name:r,autoAction:e}));ce("Invalid arguments for `action`")};return t}var at=qu(!1);Object.assign(at,cs);var Kr=qu(!0);Object.assign(Kr,ls);at.bound=Wt(ch);Kr.bound=Wt(lh);function vr(e){return Ru(e.name||Ku,!1,e,this,void 0)}function gn(e){return je(e)&&e.isMobxAction===!0}function It(e,t){var n,r,i,o;t===void 0&&(t=ps),je(e)||ce("Autorun expects a function as first argument"),gn(e)&&ce("Autorun does not accept actions since actions are untrackable");var s=(n=(r=t)==null?void 0:r.name)!=null?n:e.name||"Autorun@"+Et(),a=!t.scheduler&&!t.delay,l;if(a)l=new kt(s,function(){this.track(g)},t.onError,t.requiresObservable);else{var c=Gu(t),d=!1;l=new kt(s,function(){d||(d=!0,c(function(){d=!1,l.isDisposed||l.track(g)}))},t.onError,t.requiresObservable)}function g(){e(l)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||l.schedule_(),l.getDisposer_((o=t)==null?void 0:o.signal)}var fh=function(t){return t()};function Gu(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:fh}function Wu(e,t,n){var r,i,o;n===void 0&&(n=ps),(!je(e)||!je(t))&&ce("First and second argument to reaction should be functions"),Lt(n)||ce("Third argument of reactions should be an object");var s=(r=n.name)!=null?r:"Reaction@"+Et(),a=at(s,n.onError?dh(n.onError,t):t),l=!n.scheduler&&!n.delay,c=Gu(n),d=!0,g=!1,C,I=n.compareStructural?ze.structural:n.equals||ze.default,S=new kt(s,function(){d||l?z():g||(g=!0,c(z))},n.onError,n.requiresObservable);function z(){if(g=!1,!S.isDisposed){var J=!1,F=C;S.track(function(){var k=qp(!1,function(){return e(S)});J=d||!I(C,k),C=k}),(d&&n.fireImmediately||!d&&J)&&a(C,F,S),d=!1}}return(i=n)!=null&&(i=i.signal)!=null&&i.aborted||S.schedule_(),S.getDisposer_((o=n)==null?void 0:o.signal)}function dh(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}var ph="onBO",hh="onBUO";function br(e,t,n){return Hu(ph,e,t,n)}function zn(e,t,n){return Hu(hh,e,t,n)}function Hu(e,t,n,r){var i=typeof r=="function"?Ot(t,n):Ot(t),o=je(r)?r:n,s=e+"L";return i[s]?i[s].add(o):i[s]=new Set([o]),function(){var a=i[s];a&&(a.delete(o),a.size===0&&delete i[s])}}var yh="never",Ri="always",gh="observed";function Ju(e){e.isolateGlobalState===!0&&Yp();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(X.useProxies=t===Ri?!0:t===yh?!1:typeof Proxy<"u"),t==="ifavailable"&&(X.verifyProxies=!0),n!==void 0){var r=n===Ri?Ri:n===gh;X.enforceActions=r,X.allowStateChanges=!(r===!0||r===Ri)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(X[i]=!!e[i])}),X.allowStateReads=!X.observableRequiresReaction,X.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&ih(e.reactionScheduler)}function mh(e,t,n,r){arguments.length>4&&ce("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&ce("'extendObservable' expects an object as first argument"),Ht(e)&&ce("'extendObservable' should not be used on maps, use map.merge instead"),Lt(t)||ce("'extendObservable' only accepts plain objects as second argument"),(yr(t)||yr(n))&&ce("Extending an object with another observable (object) is not supported");var i=Jd(t);return Vn(function(){var o=wr(e,r)[ve];Wi(i).forEach(function(s){o.extend_(s,i[s],n&&s in n?n[s]:!0)})}),e}function Yr(e,t){return Xu(Ot(e,t))}function Xu(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=vh(e.observing_).map(Xu)),t}function Qr(e,t){return Yu(Ot(e,t))}function Yu(e){var t={name:e.name_};return Qp(e)&&(t.observers=Array.from(Zp(e)).map(Yu)),t}function vh(e){return Array.from(new Set(e))}var bh=0;function Qu(){this.message="FLOW_CANCELLED"}Qu.prototype=Object.create(Error.prototype);var es=Au("flow"),_h=Au("flow.bound",{bound:!0}),hr=Object.assign(function(t,n){if(Hr(n))return es.decorate_20223_(t,n);if(Bn(n))return Wr(t,n,es);arguments.length!==1&&ce("Flow expects single argument with generator function");var r=t,i=r.name||"<unnamed flow>",o=function(){var a=this,l=arguments,c=++bh,d=at(i+" - runid: "+c+" - init",r).apply(a,l),g,C=void 0,I=new Promise(function(S,z){var J=0;g=z;function F(W){C=void 0;var j;try{j=at(i+" - runid: "+c+" - yield "+J++,d.next).call(d,W)}catch(Z){return z(Z)}K(j)}function k(W){C=void 0;var j;try{j=at(i+" - runid: "+c+" - yield "+J++,d.throw).call(d,W)}catch(Z){return z(Z)}K(j)}function K(W){if(je(W?.then)){W.then(K,z);return}return W.done?S(W.value):(C=Promise.resolve(W.value),C.then(F,k))}F(void 0)});return I.cancel=at(i+" - runid: "+c+" - cancel",function(){try{C&&nu(C);var S=d.return(void 0),z=Promise.resolve(S.value);z.then(dr,dr),nu(z),g(new Qu)}catch(J){g(J)}}),I};return o.isMobXFlow=!0,o},es);hr.bound=Wt(_h);function nu(e){je(e.cancel)&&e.cancel()}function qr(e){return e?.isMobXFlow===!0}function wh(e,t){return e?t!==void 0?Ht(e)||_r(e)?ce("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):jn(e)?e[ve].values_.has(t):!1:jn(e)||!!e[ve]||ys(e)||ji(e)||Xr(e):!1}function yr(e){return arguments.length!==1&&ce("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),wh(e)}function Th(e){if(jn(e))return e[ve].ownKeys_();ce(38)}function Pi(e,t,n){return e.set(t,n),n}function fr(e,t){if(e==null||typeof e!="object"||e instanceof Date||!yr(e))return e;if(Wp(e)||Xr(e))return fr(e.get(),t);if(t.has(e))return t.get(e);if(_r(e)){var n=Pi(t,e,new Array(e.length));return e.forEach(function(s,a){n[a]=fr(s,t)}),n}if(Ut(e)){var r=Pi(t,e,new Set);return e.forEach(function(s){r.add(fr(s,t))}),r}if(Ht(e)){var i=Pi(t,e,new Map);return e.forEach(function(s,a){i.set(a,fr(s,t))}),i}else{var o=Pi(t,e,{});return Th(e).forEach(function(s){Gr.propertyIsEnumerable.call(e,s)&&(o[s]=fr(e[s],t))}),o}}function on(e,t){return t&&ce("toJS no longer supports options"),fr(e,new Map)}function bs(){for(var e=!1,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];typeof n[n.length-1]=="boolean"&&(e=n.pop());var i=Ah(n);if(!i)return ce("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===Tt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?Tt.BREAK:Tt.LOG}function Ah(e){switch(e.length){case 0:return X.trackingDerivation;case 1:return Ot(e[0]);case 2:return Ot(e[0],e[1])}}function tn(e,t){t===void 0&&(t=void 0),bt();try{return e.apply(t)}finally{_t()}}function Mn(e){return e[ve]}var Oh={has:function(t,n){return X.trackingDerivation&&zr("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Mn(t).has_(n)},get:function(t,n){return Mn(t).get_(n)},set:function(t,n,r){var i;return Bn(n)?(Mn(t).values_.has(n)||zr("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(i=Mn(t).set_(n,r,!0))!=null?i:!0):!1},deleteProperty:function(t,n){var r;return zr("delete properties from an observable object. Use 'remove' from 'mobx' instead."),Bn(n)?(r=Mn(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var i;return zr("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(i=Mn(t).defineProperty_(n,r))!=null?i:!0},ownKeys:function(t){return X.trackingDerivation&&zr("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Mn(t).ownKeys_()},preventExtensions:function(t){ce(13)}};function Eh(e,t){var n,r;return yu(),e=wr(e,t),(r=(n=e[ve]).proxy_)!=null?r:n.proxy_=new Proxy(e,Oh)}function mt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Zr(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),hs(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function vt(e,t){var n=Fn();try{for(var r=[].concat(e.interceptors_||[]),i=0,o=r.length;i<o&&(t=r[i](t),t&&!t.type&&ce(14),!!t);i++);return t}finally{nn(n)}}function Bt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function ei(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),hs(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Dt(e,t){var n=Fn(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,o=r.length;i<o;i++)r[i](t);nn(n)}}function bn(e,t,n){return Vn(function(){var r,i=wr(e,n)[ve];t&&e[st]&&ce("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(r=t)!=null||(t=ep(e)),Wi(t).forEach(function(o){return i.make_(o,t[o])})}),e}var ru="splice",Mt="update",Ih=1e4,Sh={get:function(t,n){var r=t[ve];return n===ve?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):wt(Fi,n)?Fi[n]:t[n]},set:function(t,n,r){var i=t[ve];return n==="length"&&i.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:i.set_(parseInt(n),r),!0},preventExtensions:function(){ce(15)}},_s=function(){function e(n,r,i,o){n===void 0&&(n="ObservableArray@"+Et()),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=o,this.atom_=new vn(n),this.enhancer_=function(s,a){return r(s,a,n+"[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return Zr(this,r)},t.observe_=function(r,i){return i===void 0&&(i=!1),i&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),ei(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&ce("Out of range: "+r);var i=this.values_.length;if(r!==i)if(r>i){for(var o=new Array(r-i),s=0;s<r-i;s++)o[s]=void 0;this.spliceWithArray_(i,0,o)}else this.spliceWithArray_(r,i-r)},t.updateArrayLength_=function(r,i){r!==this.lastKnownLength_&&ce(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&ic(r+i+1)},t.spliceWithArray_=function(r,i,o){var s=this;qt(this.atom_);var a=this.values_.length;if(r===void 0?r=0:r>a?r=a:r<0&&(r=Math.max(0,a+r)),arguments.length===1?i=a-r:i==null?i=0:i=Math.max(0,Math.min(i,a-r)),o===void 0&&(o=Bi),mt(this)){var l=vt(this,{object:this.proxy_,type:ru,index:r,removedCount:i,added:o});if(!l)return Bi;i=l.removedCount,o=l.added}o=o.length===0?o:o.map(function(g){return s.enhancer_(g,void 0)}),this.legacyMode_;var c=o.length-i;this.updateArrayLength_(a,c);var d=this.spliceItemsIntoValues_(r,i,o);return(i!==0||o.length!==0)&&this.notifyArraySplice_(r,o,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(r,i,o){if(o.length<Ih){var s;return(s=this.values_).splice.apply(s,[r,i].concat(o))}else{var a=this.values_.slice(r,r+i),l=this.values_.slice(r+i);this.values_.length+=o.length-i;for(var c=0;c<o.length;c++)this.values_[r+c]=o[c];for(var d=0;d<l.length;d++)this.values_[r+o.length+d]=l[d];return a}},t.notifyArrayChildUpdate_=function(r,i,o){var s=!this.owned_&&Xe(),a=Bt(this),l=a||s?{observableKind:"array",object:this.proxy_,type:Mt,debugObjectName:this.atom_.name_,index:r,newValue:i,oldValue:o}:null;s&&ft(l),this.atom_.reportChanged(),a&&Dt(this,l),s&&dt()},t.notifyArraySplice_=function(r,i,o){var s=!this.owned_&&Xe(),a=Bt(this),l=a||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:ru,index:r,removed:o,added:i,removedCount:o.length,addedCount:i.length}:null;s&&ft(l),this.atom_.reportChanged(),a&&Dt(this,l),s&&dt()},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx.array] Attempt to read an array index ("+r+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX");return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,i){var o=this.values_;if(this.legacyMode_&&r>o.length&&ce(17,r,o.length),r<o.length){qt(this.atom_);var s=o[r];if(mt(this)){var a=vt(this,{type:Mt,object:this.proxy_,index:r,newValue:i});if(!a)return;i=a.newValue}i=this.enhancer_(i,s);var l=i!==s;l&&(o[r]=i,this.notifyArrayChildUpdate_(r,i,s))}else{for(var c=new Array(r+1-o.length),d=0;d<c.length-1;d++)c[d]=void 0;c[c.length-1]=i,this.spliceWithArray_(o.length,0,c)}},e}();function $h(e,t,n,r){return n===void 0&&(n="ObservableArray@"+Et()),r===void 0&&(r=!1),yu(),Vn(function(){var i=new _s(n,t,r,!1);mu(i.values_,ve,i);var o=new Proxy(i.values_,Sh);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var Fi={clear:function(){return this.splice(0)},replace:function(t){var n=this[ve];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;o<r;o++)i[o-2]=arguments[o];var s=this[ve];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(t);case 2:return s.spliceWithArray_(t,n)}return s.spliceWithArray_(t,n,i)},spliceWithArray:function(t,n,r){return this[ve].spliceWithArray_(t,n,r)},push:function(){for(var t=this[ve],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[ve].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[ve],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return X.trackingDerivation&&ce(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){X.trackingDerivation&&ce(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[ve],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};xe("at",pt);xe("concat",pt);xe("flat",pt);xe("includes",pt);xe("indexOf",pt);xe("join",pt);xe("lastIndexOf",pt);xe("slice",pt);xe("toString",pt);xe("toLocaleString",pt);xe("toSorted",pt);xe("toSpliced",pt);xe("with",pt);xe("every",jt);xe("filter",jt);xe("find",jt);xe("findIndex",jt);xe("findLast",jt);xe("findLastIndex",jt);xe("flatMap",jt);xe("forEach",jt);xe("map",jt);xe("some",jt);xe("toReversed",jt);xe("reduce",Zu);xe("reduceRight",Zu);function xe(e,t){typeof Array.prototype[e]=="function"&&(Fi[e]=t(e))}function pt(e){return function(){var t=this[ve];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function jt(e){return function(t,n){var r=this,i=this[ve];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(s,a){return t.call(n,s,a,r)})}}function Zu(e){return function(){var t=this,n=this[ve];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(o,s,a){return i(o,s,a,t)},r[e].apply(r,arguments)}}var Nh=mn("ObservableArrayAdministration",_s);function _r(e){return qi(e)&&Nh(e[ve])}var Rh={},hn="add",zi="delete",ec=function(){function e(n,r,i){var o=this;r===void 0&&(r=Dn),i===void 0&&(i="ObservableMap@"+Et()),this.enhancer_=void 0,this.name_=void 0,this[ve]=Rh,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=i,je(Map)||ce(18),Vn(function(){o.keysAtom_=wu(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,n&&o.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var i=this;if(!X.trackingDerivation)return this.has_(r);var o=this.hasMap_.get(r);if(!o){var s=o=new yn(this.has_(r),Ji,this.name_+"."+ns(r)+"?",!1);this.hasMap_.set(r,s),zn(s,function(){return i.hasMap_.delete(r)})}return o.get()},t.set=function(r,i){var o=this.has_(r);if(mt(this)){var s=vt(this,{type:o?Mt:hn,object:this,newValue:i,name:r});if(!s)return this;i=s.newValue}return o?this.updateValue_(r,i):this.addValue_(r,i),this},t.delete=function(r){var i=this;if(qt(this.keysAtom_),mt(this)){var o=vt(this,{type:zi,object:this,name:r});if(!o)return!1}if(this.has_(r)){var s=Xe(),a=Bt(this),l=a||s?{observableKind:"map",debugObjectName:this.name_,type:zi,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return s&&ft(l),tn(function(){var c;i.keysAtom_.reportChanged(),(c=i.hasMap_.get(r))==null||c.setNewValue_(!1);var d=i.data_.get(r);d.setNewValue_(void 0),i.data_.delete(r)}),a&&Dt(this,l),s&&dt(),!0}return!1},t.updateValue_=function(r,i){var o=this.data_.get(r);if(i=o.prepareNewValue_(i),i!==X.UNCHANGED){var s=Xe(),a=Bt(this),l=a||s?{observableKind:"map",debugObjectName:this.name_,type:Mt,object:this,oldValue:o.value_,name:r,newValue:i}:null;s&&ft(l),o.setNewValue_(i),a&&Dt(this,l),s&&dt()}},t.addValue_=function(r,i){var o=this;qt(this.keysAtom_),tn(function(){var c,d=new yn(i,o.enhancer_,o.name_+"."+ns(r),!1);o.data_.set(r,d),i=d.value_,(c=o.hasMap_.get(r))==null||c.setNewValue_(!0),o.keysAtom_.reportChanged()});var s=Xe(),a=Bt(this),l=a||s?{observableKind:"map",debugObjectName:this.name_,type:hn,object:this,name:r,newValue:i}:null;s&&ft(l),a&&Dt(this,l),s&&dt()},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,i=this.keys();return iu({next:function(){var s=i.next(),a=s.done,l=s.value;return{done:a,value:a?void 0:r.get(l)}}})},t.entries=function(){var r=this,i=this.keys();return iu({next:function(){var s=i.next(),a=s.done,l=s.value;return{done:a,value:a?void 0:[l,r.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,i){for(var o=pr(this),s;!(s=o()).done;){var a=s.value,l=a[0],c=a[1];r.call(i,c,l,this)}},t.merge=function(r){var i=this;return Ht(r)&&(r=new Map(r)),tn(function(){Lt(r)?Hd(r).forEach(function(o){return i.set(o,r[o])}):Array.isArray(r)?r.forEach(function(o){var s=o[0],a=o[1];return i.set(s,a)}):gr(r)?(Wd(r)||ce(19,r),r.forEach(function(o,s){return i.set(s,o)})):r!=null&&ce(20,r)}),this},t.clear=function(){var r=this;tn(function(){Pe(function(){for(var i=pr(r.keys()),o;!(o=i()).done;){var s=o.value;r.delete(s)}})})},t.replace=function(r){var i=this;return tn(function(){for(var o=Ph(r),s=new Map,a=!1,l=pr(i.data_.keys()),c;!(c=l()).done;){var d=c.value;if(!o.has(d)){var g=i.delete(d);if(g)a=!0;else{var C=i.data_.get(d);s.set(d,C)}}}for(var I=pr(o.entries()),S;!(S=I()).done;){var z=S.value,J=z[0],F=z[1],k=i.data_.has(J);if(i.set(J,F),i.data_.has(J)){var K=i.data_.get(J);s.set(J,K),k||(a=!0)}}if(!a)if(i.data_.size!==s.size)i.keysAtom_.reportChanged();else for(var W=i.data_.keys(),j=s.keys(),Z=W.next(),G=j.next();!Z.done;){if(Z.value!==G.value){i.keysAtom_.reportChanged();break}Z=W.next(),G=j.next()}i.data_=s}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,i){return i===!0&&ce("`observe` doesn't support fireImmediately=true in combination with maps."),ei(this,r)},t.intercept_=function(r){return Zr(this,r)},mr(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Ht=mn("ObservableMap",ec);function iu(e){return e[Symbol.toStringTag]="MapIterator",Os(e)}function Ph(e){if(gr(e)||Ht(e))return e;if(Array.isArray(e))return new Map(e);if(Lt(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return ce(21,e)}var Ch={},tc=function(){function e(n,r,i){var o=this;r===void 0&&(r=Dn),i===void 0&&(i="ObservableSet@"+Et()),this.name_=void 0,this[ve]=Ch,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,je(Set)||ce(22),this.enhancer_=function(s,a){return r(s,a,i)},Vn(function(){o.atom_=wu(o.name_),n&&o.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;tn(function(){Pe(function(){for(var i=pr(r.data_.values()),o;!(o=i()).done;){var s=o.value;r.delete(s)}})})},t.forEach=function(r,i){for(var o=pr(this),s;!(s=o()).done;){var a=s.value;r.call(i,a,a,this)}},t.add=function(r){var i=this;if(qt(this.atom_),mt(this)){var o=vt(this,{type:hn,object:this,newValue:r});if(!o)return this;r=o.newValue}if(!this.has(r)){tn(function(){i.data_.add(i.enhancer_(r,void 0)),i.atom_.reportChanged()});var s=Xe(),a=Bt(this),l=a||s?{observableKind:"set",debugObjectName:this.name_,type:hn,object:this,newValue:r}:null;s&&ft(l),a&&Dt(this,l),s&&dt()}return this},t.delete=function(r){var i=this;if(mt(this)){var o=vt(this,{type:zi,object:this,oldValue:r});if(!o)return!1}if(this.has(r)){var s=Xe(),a=Bt(this),l=a||s?{observableKind:"set",debugObjectName:this.name_,type:zi,object:this,oldValue:r}:null;return s&&ft(l),tn(function(){i.atom_.reportChanged(),i.data_.delete(r)}),a&&Dt(this,l),s&&dt(),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return ou({next:function(){var o=r.next(),s=o.value,a=o.done;return a?{value:void 0,done:a}:{value:[s,s],done:a}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,i=this.data_.values();return ou({next:function(){var s=i.next(),a=s.value,l=s.done;return l?{value:void 0,done:l}:{value:r.dehanceValue_(a),done:l}}})},t.intersection=function(r){if(en(r)&&!Ut(r))return r.intersection(this);var i=new Set(this);return i.intersection(r)},t.union=function(r){if(en(r)&&!Ut(r))return r.union(this);var i=new Set(this);return i.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(en(r)&&!Ut(r))return r.symmetricDifference(this);var i=new Set(this);return i.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(en(r)&&!Ut(r))return r.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(r)},t.replace=function(r){var i=this;return Ut(r)&&(r=new Set(r)),tn(function(){Array.isArray(r)?(i.clear(),r.forEach(function(o){return i.add(o)})):en(r)?(i.clear(),r.forEach(function(o){return i.add(o)})):r!=null&&ce("Cannot initialize set from "+r)}),this},t.observe_=function(r,i){return i===!0&&ce("`observe` doesn't support fireImmediately=true in combination with sets."),ei(this,r)},t.intercept_=function(r){return Zr(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},mr(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Ut=mn("ObservableSet",tc);function ou(e){return e[Symbol.toStringTag]="SetIterator",Os(e)}var su=Object.create(null),au="remove",fs=function(){function e(n,r,i,o){r===void 0&&(r=new Map),o===void 0&&(o=Ep),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=r,this.name_=i,this.defaultAnnotation_=o,this.keysAtom_=new vn(this.name_+".keys"),this.isPlainObject_=Lt(this.target_),oc(this.defaultAnnotation_)||ce("defaultAnnotation must be valid annotation"),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,i){var o=this.values_.get(r);if(o instanceof At)return o.set(i),!0;if(mt(this)){var s=vt(this,{type:Mt,object:this.proxy_||this.target_,name:r,newValue:i});if(!s)return null;i=s.newValue}if(i=o.prepareNewValue_(i),i!==X.UNCHANGED){var a=Bt(this),l=Xe(),c=a||l?{type:Mt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:r,newValue:i}:null;l&&ft(c),o.setNewValue_(i),a&&Dt(this,c),l&&dt()}return!0},t.get_=function(r){return X.trackingDerivation&&!wt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,i,o){return o===void 0&&(o=!1),wt(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,i):o?Reflect.set(this.target_,r,i):(this.target_[r]=i,!0):this.extend_(r,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,o)},t.has_=function(r){if(!X.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(r);return i||(i=new yn(r in this.target_,Ji,this.name_+"."+ns(r)+"?",!1),this.pendingKeys_.set(r,i)),i.get()},t.make_=function(r,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(lu(this,i,r),!(r in this.target_)){var o;if((o=this.target_[st])!=null&&o[r])return;ce(1,i.annotationType_,this.name_+"."+r.toString())}for(var s=this.target_;s&&s!==Gr;){var a=Mi(s,r);if(a){var l=i.make_(this,r,a,s);if(l===0)return;if(l===1)break}s=Object.getPrototypeOf(s)}cu(this,i,r)}},t.extend_=function(r,i,o,s){if(s===void 0&&(s=!1),o===!0&&(o=this.defaultAnnotation_),o===!1)return this.defineProperty_(r,i,s);lu(this,o,r);var a=o.extend_(this,r,i,s);return a&&cu(this,o,r),a},t.defineProperty_=function(r,i,o){o===void 0&&(o=!1),qt(this.keysAtom_);try{bt();var s=this.delete_(r);if(!s)return s;if(mt(this)){var a=vt(this,{object:this.proxy_||this.target_,name:r,type:hn,newValue:i.value});if(!a)return null;var l=a.newValue;i.value!==l&&(i=rn({},i,{value:l}))}if(o){if(!Reflect.defineProperty(this.target_,r,i))return!1}else Gt(this.target_,r,i);this.notifyPropertyAddition_(r,i.value)}finally{_t()}return!0},t.defineObservableProperty_=function(r,i,o,s){s===void 0&&(s=!1),qt(this.keysAtom_);try{bt();var a=this.delete_(r);if(!a)return a;if(mt(this)){var l=vt(this,{object:this.proxy_||this.target_,name:r,type:hn,newValue:i});if(!l)return null;i=l.newValue}var c=uu(r),d={configurable:X.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:c.get,set:c.set};if(s){if(!Reflect.defineProperty(this.target_,r,d))return!1}else Gt(this.target_,r,d);var g=new yn(i,o,this.name_+"."+r.toString(),!1);this.values_.set(r,g),this.notifyPropertyAddition_(r,g.value_)}finally{_t()}return!0},t.defineComputedProperty_=function(r,i,o){o===void 0&&(o=!1),qt(this.keysAtom_);try{bt();var s=this.delete_(r);if(!s)return s;if(mt(this)){var a=vt(this,{object:this.proxy_||this.target_,name:r,type:hn,newValue:void 0});if(!a)return null}i.name||(i.name=this.name_+"."+r.toString()),i.context=this.proxy_||this.target_;var l=uu(r),c={configurable:X.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(o){if(!Reflect.defineProperty(this.target_,r,c))return!1}else Gt(this.target_,r,c);this.values_.set(r,new At(i)),this.notifyPropertyAddition_(r,void 0)}finally{_t()}return!0},t.delete_=function(r,i){if(i===void 0&&(i=!1),qt(this.keysAtom_),!wt(this.target_,r))return!0;if(mt(this)){var o=vt(this,{object:this.proxy_||this.target_,name:r,type:au});if(!o)return null}try{var s;bt();var a=Bt(this),l=Xe(),c=this.values_.get(r),d=void 0;if(!c&&(a||l)){var g;d=(g=Mi(this.target_,r))==null?void 0:g.value}if(i){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(delete this.appliedAnnotations_[r],c&&(this.values_.delete(r),c instanceof yn&&(d=c.value_),ku(c)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(r in this.target_),a||l){var C={type:au,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};l&&ft(C),a&&Dt(this,C),l&&dt()}}finally{_t()}return!0},t.observe_=function(r,i){return i===!0&&ce("`observe` doesn't support the fire immediately property for observable objects."),ei(this,r)},t.intercept_=function(r){return Zr(this,r)},t.notifyPropertyAddition_=function(r,i){var o,s=Bt(this),a=Xe();if(s||a){var l=s||a?{type:hn,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:i}:null;a&&ft(l),s&&Dt(this,l),a&&dt()}(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Wi(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function wr(e,t){var n;if(t&&jn(e)&&ce("Options can't be provided for already observable objects."),wt(e,ve))return Ts(e)instanceof fs||ce("Cannot convert '"+Vi(e)+`' into observable object:
|
|
26
26
|
The target is already observable of different type.
|
|
27
|
-
Extending builtins is not supported.`),e;Object.isExtensible(e)||ce("Cannot make the designated object observable; it is not extensible");var r=(n=t?.name)!=null?n:(
|
|
27
|
+
Extending builtins is not supported.`),e;Object.isExtensible(e)||ce("Cannot make the designated object observable; it is not extensible");var r=(n=t?.name)!=null?n:(Lt(e)?"ObservableObject":e.constructor.name)+"@"+Et(),i=new fs(e,new Map,String(r),Bp(t));return Gi(e,ve,i),e}var xh=mn("ObservableObjectAdministration",fs);function uu(e){return su[e]||(su[e]={get:function(){return this[ve].getObservablePropValue_(e)},set:function(n){return this[ve].setObservablePropValue_(e,n)}})}function jn(e){return qi(e)?xh(e[ve]):!1}function cu(e,t,n){var r;e.appliedAnnotations_[n]=t,(r=e.target_[st])==null||delete r[n]}function lu(e,t,n){if(oc(t)||ce("Cannot annotate '"+e.name_+"."+n.toString()+"': Invalid annotation."),!Di(t)&&wt(e.appliedAnnotations_,n)){var r=e.name_+"."+n.toString(),i=e.appliedAnnotations_[n].annotationType_,o=t.annotationType_;ce("Cannot apply '"+o+"' to '"+r+"':"+(`
|
|
28
28
|
The field is already annotated with '`+i+"'.")+`
|
|
29
29
|
Re-annotating fields is not allowed.
|
|
30
|
-
Use 'override' annotation for methods overridden by subclass.`)}}var Ch=tc(0),xh=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Zo=0,ec=function(){};function Uh(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Uh(ec,Array.prototype);var bs=function(e){function t(r,i,o,s){var a;return o===void 0&&(o="ObservableArray@"+At()),s===void 0&&(s=!1),a=e.call(this)||this,Fn(function(){var l=new vs(o,i,s,!0);l.proxy_=a,yu(a,ve,l),r&&r.length&&a.spliceWithArray(0,0,r),xh&&Object.defineProperty(a,"0",Ch)}),a}vu(t,e);var n=t.prototype;return n.concat=function(){this[ve].atom_.reportObserved();for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),o.map(function(a){return vr(a)?a.slice():a}))},n[Symbol.iterator]=function(){var r=this,i=0;return Ts({next:function(){return i<r.length?{value:r[i++],done:!1}:{done:!0,value:void 0}}})},yr(t,[{key:"length",get:function(){return this[ve].getArrayLength_()},set:function(i){this[ve].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(ec);Object.entries(ki).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&zi(bs.prototype,t,n)});function tc(e){return{enumerable:!1,configurable:!0,get:function(){return this[ve].get_(e)},set:function(n){this[ve].set_(e,n)}}}function Mh(e){zt(bs.prototype,""+e,tc(e))}function nc(e){if(e>Zo){for(var t=Zo;t<e+100;t++)Mh(t);Zo=e}}nc(1e3);function Bh(e,t,n){return new bs(e,t,n)}function Tt(e,t){if(typeof e=="object"&&e!==null){if(vr(e))return t!==void 0&&ce(23),e[ve].atom_;if(Ct(e))return e.atom_;if(Gt(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||ce(25,t,Fi(e)),n}if(Ln(e)){if(!t)return ce(26);var r=e[ve].values_.get(t);return r||ce(27,t,Fi(e)),r}if(ps(e)||Hr(e)||Li(e))return e}else if(je(e)&&Li(e[ve]))return e[ve];ce(28)}function _s(e,t){if(e||ce(29),t!==void 0)return _s(Tt(e,t));if(ps(e)||Hr(e)||Li(e)||Gt(e)||Ct(e))return e;if(e[ve])return e[ve];ce(24,e)}function Fi(e,t){var n;if(t!==void 0)n=Tt(e,t);else{if(hn(e))return e.name;Ln(e)||Gt(e)||Ct(e)?n=_s(e):n=Tt(e)}return n.name_}function Fn(e){var t=kn(),n=Ji(!0);mt();try{return e()}finally{vt(),Xi(n),en(t)}}var cu=zr.toString;function ws(e,t,n){return n===void 0&&(n=-1),ls(e,t,n)}function ls(e,t,n,r,i){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var s=cu.call(e);if(s!==cu.call(t))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=lu(e),t=lu(t);var a=s==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,c=t.constructor;if(l!==c&&!(je(l)&&l instanceof l&&je(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],i=i||[];for(var d=r.length;d--;)if(r[d]===e)return i[d]===t;if(r.push(e),i.push(t),a){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!ls(e[d],t[d],n-1,r,i))return!1}else{var g=Object.keys(e),C=g.length;if(Object.keys(t).length!==C)return!1;for(var I=0;I<C;I++){var S=g[I];if(!(bt(t,S)&&ls(e[S],t[S],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function lu(e){return vr(e)?e.slice():hr(e)||Gt(e)||Qt(e)||Ct(e)?Array.from(e.entries()):e}var fu,Dh=((fu=Vi().Iterator)==null?void 0:fu.prototype)||{};function Ts(e){return e[Symbol.iterator]=Lh,Object.assign(Object.create(Dh),e)}function Lh(){return this}function rc(e){return e instanceof Object&&typeof e.annotationType_=="string"&&je(e.make_)&&je(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=Vi();typeof t[e]>"u"&&ce("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:ih,extras:{getDebugName:Fi},$mobx:ve});var kh=Object.create,As=Object.defineProperty,jh=Object.getOwnPropertyDescriptor,ic=Object.getOwnPropertyNames,Fh=Object.getPrototypeOf,Vh=Object.prototype.hasOwnProperty,Le=(e,t)=>function(){return t||(0,e[ic(e)[0]])((t={exports:{}}).exports,t),t.exports},Os=(e,t)=>{for(var n in t)As(e,n,{get:t[n],enumerable:!0})},Kh=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ic(t))!Vh.call(e,i)&&i!==n&&As(e,i,{get:()=>t[i],enumerable:!(r=jh(t,i))||r.enumerable});return e},Et=(e,t,n)=>(n=e!=null?kh(Fh(e)):{},Kh(t||!e||!e.__esModule?As(n,"default",{value:e,enumerable:!0}):n,e));var rn=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/typebox.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(f){let _=new Map;function E(){return new Map(_)}f.Entries=E;function U(){return _.clear()}f.Clear=U;function P(w){return _.delete(w)}f.Delete=P;function N(w){return _.has(w)}f.Has=N;function y(w,u){_.set(w,u)}f.Set=y;function T(w){return _.get(w)}f.Get=T})(t||(e.TypeRegistry=t={}));var n=class extends Error{constructor(f){super(f)}};e.TypeBoxError=n;var r;(function(f){let _=new Map;function E(){return new Map(_)}f.Entries=E;function U(){return _.clear()}f.Clear=U;function P(w){return _.delete(w)}f.Delete=P;function N(w){return _.has(w)}f.Has=N;function y(w,u){_.set(w,u)}f.Set=y;function T(w){return _.get(w)}f.Get=T})(r||(e.FormatRegistry=r={}));var i;(function(f){function _(b){return Array.isArray(b)}f.IsArray=_;function E(b){return typeof b=="bigint"}f.IsBigInt=E;function U(b){return typeof b=="boolean"}f.IsBoolean=U;function P(b){return b instanceof globalThis.Date}f.IsDate=P;function N(b){return b===null}f.IsNull=N;function y(b){return typeof b=="number"}f.IsNumber=y;function T(b){return typeof b=="object"&&b!==null}f.IsObject=T;function w(b){return typeof b=="string"}f.IsString=w;function u(b){return b instanceof globalThis.Uint8Array}f.IsUint8Array=u;function A(b){return b===void 0}f.IsUndefined=A})(i||(e.ValueGuard=i={}));var o=class extends n{};e.TypeGuardUnknownTypeError=o;var s;(function(f){function _(m){try{return new RegExp(m),!0}catch{return!1}}function E(m){if(!i.IsString(m))return!1;for(let Re=0;Re<m.length;Re++){let ht=m.charCodeAt(Re);if(ht>=7&&ht<=13||ht===27||ht===127)return!1}return!0}function U(m){return y(m)||ze(m)}function P(m){return i.IsUndefined(m)||i.IsBigInt(m)}function N(m){return i.IsUndefined(m)||i.IsNumber(m)}function y(m){return i.IsUndefined(m)||i.IsBoolean(m)}function T(m){return i.IsUndefined(m)||i.IsString(m)}function w(m){return i.IsUndefined(m)||i.IsString(m)&&E(m)&&_(m)}function u(m){return i.IsUndefined(m)||i.IsString(m)&&E(m)}function A(m){return i.IsUndefined(m)||ze(m)}function b(m){return _e(m,"Any")&&T(m.$id)}f.TAny=b;function v(m){return _e(m,"Array")&&m.type==="array"&&T(m.$id)&&ze(m.items)&&N(m.minItems)&&N(m.maxItems)&&y(m.uniqueItems)&&A(m.contains)&&N(m.minContains)&&N(m.maxContains)}f.TArray=v;function $(m){return _e(m,"AsyncIterator")&&m.type==="AsyncIterator"&&T(m.$id)&&ze(m.items)}f.TAsyncIterator=$;function q(m){return _e(m,"BigInt")&&m.type==="bigint"&&T(m.$id)&&P(m.exclusiveMaximum)&&P(m.exclusiveMinimum)&&P(m.maximum)&&P(m.minimum)&&P(m.multipleOf)}f.TBigInt=q;function te(m){return _e(m,"Boolean")&&m.type==="boolean"&&T(m.$id)}f.TBoolean=te;function ne(m){return _e(m,"Constructor")&&m.type==="Constructor"&&T(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Re=>ze(Re))&&ze(m.returns)}f.TConstructor=ne;function ge(m){return _e(m,"Date")&&m.type==="Date"&&T(m.$id)&&N(m.exclusiveMaximumTimestamp)&&N(m.exclusiveMinimumTimestamp)&&N(m.maximumTimestamp)&&N(m.minimumTimestamp)&&N(m.multipleOfTimestamp)}f.TDate=ge;function be(m){return _e(m,"Function")&&m.type==="Function"&&T(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Re=>ze(Re))&&ze(m.returns)}f.TFunction=be;function Ue(m){return _e(m,"Integer")&&m.type==="integer"&&T(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}f.TInteger=Ue;function Fe(m){return _e(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Re=>ze(Re)&&!Lr(Re))&&T(m.type)&&(y(m.unevaluatedProperties)||A(m.unevaluatedProperties))&&T(m.$id)}f.TIntersect=Fe;function $n(m){return _e(m,"Iterator")&&m.type==="Iterator"&&T(m.$id)&&ze(m.items)}f.TIterator=$n;function _e(m,Re){return fn(m)&&m[e.Kind]===Re}f.TKindOf=_e;function fn(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}f.TKind=fn;function Rn(m){return R(m)&&i.IsString(m.const)}f.TLiteralString=Rn;function O(m){return R(m)&&i.IsNumber(m.const)}f.TLiteralNumber=O;function le(m){return R(m)&&i.IsBoolean(m.const)}f.TLiteralBoolean=le;function R(m){return _e(m,"Literal")&&T(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}f.TLiteral=R;function me(m){return _e(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}f.TNever=me;function re(m){return _e(m,"Not")&&ze(m.not)}f.TNot=re;function de(m){return _e(m,"Null")&&m.type==="null"&&T(m.$id)}f.TNull=de;function Se(m){return _e(m,"Number")&&m.type==="number"&&T(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}f.TNumber=Se;function ke(m){return _e(m,"Object")&&m.type==="object"&&T(m.$id)&&i.IsObject(m.properties)&&U(m.additionalProperties)&&N(m.minProperties)&&N(m.maxProperties)&&Object.entries(m.properties).every(([Re,ht])=>E(Re)&&ze(ht))}f.TObject=ke;function tt(m){return _e(m,"Promise")&&m.type==="Promise"&&T(m.$id)&&ze(m.item)}f.TPromise=tt;function Qe(m){return _e(m,"Record")&&m.type==="object"&&T(m.$id)&&U(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Re=>{let ht=Object.getOwnPropertyNames(Re.patternProperties);return ht.length===1&&_(ht[0])&&i.IsObject(Re.patternProperties)&&ze(Re.patternProperties[ht[0]])})(m)}f.TRecord=Qe;function rt(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}f.TRecursive=rt;function Yt(m){return _e(m,"Ref")&&T(m.$id)&&i.IsString(m.$ref)}f.TRef=Yt;function sr(m){return _e(m,"String")&&m.type==="string"&&T(m.$id)&&N(m.minLength)&&N(m.maxLength)&&w(m.pattern)&&u(m.format)}f.TString=sr;function ar(m){return _e(m,"Symbol")&&m.type==="symbol"&&T(m.$id)}f.TSymbol=ar;function Pn(m){return _e(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}f.TTemplateLiteral=Pn;function Ai(m){return _e(m,"This")&&T(m.$id)&&i.IsString(m.$ref)}f.TThis=Ai;function Lr(m){return i.IsObject(m)&&e.Transform in m}f.TTransform=Lr;function Ke(m){return _e(m,"Tuple")&&m.type==="array"&&T(m.$id)&&i.IsNumber(m.minItems)&&i.IsNumber(m.maxItems)&&m.minItems===m.maxItems&&(i.IsUndefined(m.items)&&i.IsUndefined(m.additionalItems)&&m.minItems===0||i.IsArray(m.items)&&m.items.every(Re=>ze(Re)))}f.TTuple=Ke;function Oi(m){return _e(m,"Undefined")&&m.type==="undefined"&&T(m.$id)}f.TUndefined=Oi;function Ho(m){return Cn(m)&&m.anyOf.every(Re=>Rn(Re)||O(Re))}f.TUnionLiteral=Ho;function Cn(m){return _e(m,"Union")&&T(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Re=>ze(Re))}f.TUnion=Cn;function ur(m){return _e(m,"Uint8Array")&&m.type==="Uint8Array"&&T(m.$id)&&N(m.minByteLength)&&N(m.maxByteLength)}f.TUint8Array=ur;function nt(m){return _e(m,"Unknown")&&T(m.$id)}f.TUnknown=nt;function Ei(m){return _e(m,"Unsafe")}f.TUnsafe=Ei;function kr(m){return _e(m,"Void")&&m.type==="void"&&T(m.$id)}f.TVoid=kr;function Jo(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}f.TReadonly=Jo;function Xo(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}f.TOptional=Xo;function ze(m){return i.IsObject(m)&&(b(m)||v(m)||te(m)||q(m)||$(m)||ne(m)||ge(m)||be(m)||Ue(m)||Fe(m)||$n(m)||R(m)||me(m)||re(m)||de(m)||Se(m)||ke(m)||tt(m)||Qe(m)||Yt(m)||sr(m)||ar(m)||Pn(m)||Ai(m)||Ke(m)||Oi(m)||Cn(m)||ur(m)||nt(m)||Ei(m)||kr(m)||fn(m)&&t.Has(m[e.Kind]))}f.TSchema=ze})(s||(e.TypeGuard=s={}));var a;(function(f){function _(E){return E[e.Kind]==="Intersect"?E.allOf.every(U=>_(U)):E[e.Kind]==="Union"?E.anyOf.some(U=>_(U)):E[e.Kind]==="Undefined"?!0:E[e.Kind]==="Not"?!_(E.not):!1}f.Check=_})(a||(e.ExtendsUndefined=a={}));var l=class extends n{};e.TypeExtendsError=l;var c;(function(f){f[f.Union=0]="Union",f[f.True=1]="True",f[f.False=2]="False"})(c||(e.TypeExtendsResult=c={}));var d;(function(f){function _(p){return p===c.False?p:c.True}function E(p){throw new l(p)}function U(p){return s.TNever(p)||s.TIntersect(p)||s.TUnion(p)||s.TUnknown(p)||s.TAny(p)}function P(p,h){return s.TNever(h)?_e(p,h):s.TIntersect(h)?be(p,h):s.TUnion(h)?Yo(p,h):s.TUnknown(h)?Wa(p,h):s.TAny(h)?N(p,h):E("StructuralRight")}function N(p,h){return c.True}function y(p,h){return s.TIntersect(h)?be(p,h):s.TUnion(h)&&h.anyOf.some(Ae=>s.TAny(Ae)||s.TUnknown(Ae))?c.True:s.TUnion(h)?c.Union:s.TUnknown(h)||s.TAny(h)?c.True:c.Union}function T(p,h){return s.TUnknown(p)?c.False:s.TAny(p)?c.Union:s.TNever(p)?c.True:c.False}function w(p,h){return s.TObject(h)&&Pn(h)?c.True:U(h)?P(p,h):s.TArray(h)?_($e(p.items,h.items)):c.False}function u(p,h){return U(h)?P(p,h):s.TAsyncIterator(h)?_($e(p.items,h.items)):c.False}function A(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):s.TBigInt(h)?c.True:c.False}function b(p,h){return s.TLiteral(p)&&i.IsBoolean(p.const)||s.TBoolean(p)?c.True:c.False}function v(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):s.TBoolean(h)?c.True:c.False}function $(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TConstructor(h)?p.parameters.length>h.parameters.length?c.False:p.parameters.every((Ae,Pt)=>_($e(h.parameters[Pt],Ae))===c.True)?_($e(p.returns,h.returns)):c.False:c.False}function q(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):s.TDate(h)?c.True:c.False}function te(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TFunction(h)?p.parameters.length>h.parameters.length?c.False:p.parameters.every((Ae,Pt)=>_($e(h.parameters[Pt],Ae))===c.True)?_($e(p.returns,h.returns)):c.False:c.False}function ne(p,h){return s.TLiteral(p)&&i.IsNumber(p.const)||s.TNumber(p)||s.TInteger(p)?c.True:c.False}function ge(p,h){return s.TInteger(h)||s.TNumber(h)?c.True:U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):c.False}function be(p,h){return h.allOf.every(Ae=>$e(p,Ae)===c.True)?c.True:c.False}function Ue(p,h){return p.allOf.some(Ae=>$e(Ae,h)===c.True)?c.True:c.False}function Fe(p,h){return U(h)?P(p,h):s.TIterator(h)?_($e(p.items,h.items)):c.False}function $n(p,h){return s.TLiteral(h)&&h.const===p.const?c.True:U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):s.TString(h)?kr(p,h):s.TNumber(h)?R(p,h):s.TInteger(h)?ne(p,h):s.TBoolean(h)?b(p,h):c.False}function _e(p,h){return c.False}function fn(p,h){return c.True}function Rn(p){let[h,Ae]=[p,0];for(;s.TNot(h);)h=h.not,Ae+=1;return Ae%2===0?h:e.Type.Unknown()}function O(p,h){return s.TNot(p)?$e(Rn(p),h):s.TNot(h)?$e(p,Rn(h)):E("Invalid fallthrough for Not")}function le(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):s.TNull(h)?c.True:c.False}function R(p,h){return s.TLiteralNumber(p)||s.TNumber(p)||s.TInteger(p)?c.True:c.False}function me(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):s.TInteger(h)||s.TNumber(h)?c.True:c.False}function re(p,h){return Object.getOwnPropertyNames(p.properties).length===h}function de(p){return Pn(p)}function Se(p){return re(p,0)||re(p,1)&&"description"in p.properties&&s.TUnion(p.properties.description)&&p.properties.description.anyOf.length===2&&(s.TString(p.properties.description.anyOf[0])&&s.TUndefined(p.properties.description.anyOf[1])||s.TString(p.properties.description.anyOf[1])&&s.TUndefined(p.properties.description.anyOf[0]))}function ke(p){return re(p,0)}function tt(p){return re(p,0)}function Qe(p){return re(p,0)}function rt(p){return re(p,0)}function Yt(p){return Pn(p)}function sr(p){let h=e.Type.Number();return re(p,0)||re(p,1)&&"length"in p.properties&&_($e(p.properties.length,h))===c.True}function ar(p){return re(p,0)}function Pn(p){let h=e.Type.Number();return re(p,0)||re(p,1)&&"length"in p.properties&&_($e(p.properties.length,h))===c.True}function Ai(p){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return re(p,0)||re(p,1)&&"then"in p.properties&&_($e(p.properties.then,h))===c.True}function Lr(p,h){return $e(p,h)===c.False||s.TOptional(p)&&!s.TOptional(h)?c.False:c.True}function Ke(p,h){return s.TUnknown(p)?c.False:s.TAny(p)?c.Union:s.TNever(p)||s.TLiteralString(p)&&de(h)||s.TLiteralNumber(p)&&ke(h)||s.TLiteralBoolean(p)&&tt(h)||s.TSymbol(p)&&Se(h)||s.TBigInt(p)&&Qe(h)||s.TString(p)&&de(h)||s.TSymbol(p)&&Se(h)||s.TNumber(p)&&ke(h)||s.TInteger(p)&&ke(h)||s.TBoolean(p)&&tt(h)||s.TUint8Array(p)&&Yt(h)||s.TDate(p)&&rt(h)||s.TConstructor(p)&&ar(h)||s.TFunction(p)&&sr(h)?c.True:s.TRecord(p)&&s.TString(Cn(p))?h[e.Hint]==="Record"?c.True:c.False:s.TRecord(p)&&s.TNumber(Cn(p))?re(h,0)?c.True:c.False:c.False}function Oi(p,h){return U(h)?P(p,h):s.TRecord(h)?nt(p,h):s.TObject(h)?(()=>{for(let Ae of Object.getOwnPropertyNames(h.properties)){if(!(Ae in p.properties)&&!s.TOptional(h.properties[Ae]))return c.False;if(s.TOptional(h.properties[Ae]))return c.True;if(Lr(p.properties[Ae],h.properties[Ae])===c.False)return c.False}return c.True})():c.False}function Ho(p,h){return U(h)?P(p,h):s.TObject(h)&&Ai(h)?c.True:s.TPromise(h)?_($e(p.item,h.item)):c.False}function Cn(p){return e.PatternNumberExact in p.patternProperties?e.Type.Number():e.PatternStringExact in p.patternProperties?e.Type.String():E("Unknown record key pattern")}function ur(p){return e.PatternNumberExact in p.patternProperties?p.patternProperties[e.PatternNumberExact]:e.PatternStringExact in p.patternProperties?p.patternProperties[e.PatternStringExact]:E("Unable to get record value schema")}function nt(p,h){let[Ae,Pt]=[Cn(h),ur(h)];return s.TLiteralString(p)&&s.TNumber(Ae)&&_($e(p,Pt))===c.True?c.True:s.TUint8Array(p)&&s.TNumber(Ae)||s.TString(p)&&s.TNumber(Ae)||s.TArray(p)&&s.TNumber(Ae)?$e(p,Pt):s.TObject(p)?(()=>{for(let kd of Object.getOwnPropertyNames(p.properties))if(Lr(Pt,p.properties[kd])===c.False)return c.False;return c.True})():c.False}function Ei(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?$e(ur(p),ur(h)):c.False}function kr(p,h){return s.TLiteral(p)&&i.IsString(p.const)||s.TString(p)?c.True:c.False}function Jo(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):s.TString(h)?c.True:c.False}function Xo(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):s.TSymbol(h)?c.True:c.False}function ze(p,h){return s.TTemplateLiteral(p)?$e(j.Resolve(p),h):s.TTemplateLiteral(h)?$e(p,j.Resolve(h)):E("Invalid fallthrough for TemplateLiteral")}function m(p,h){return s.TArray(h)&&p.items!==void 0&&p.items.every(Ae=>$e(Ae,h.items)===c.True)}function Re(p,h){return s.TNever(p)?c.True:s.TUnknown(p)?c.False:s.TAny(p)?c.Union:c.False}function ht(p,h){return U(h)?P(p,h):s.TObject(h)&&Pn(h)||s.TArray(h)&&m(p,h)?c.True:s.TTuple(h)?i.IsUndefined(p.items)&&!i.IsUndefined(h.items)||!i.IsUndefined(p.items)&&i.IsUndefined(h.items)?c.False:i.IsUndefined(p.items)&&!i.IsUndefined(h.items)||p.items.every((Ae,Pt)=>$e(Ae,h.items[Pt])===c.True)?c.True:c.False:c.False}function Cd(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):s.TUint8Array(h)?c.True:c.False}function xd(p,h){return U(h)?P(p,h):s.TObject(h)?Ke(p,h):s.TRecord(h)?nt(p,h):s.TVoid(h)?Bd(p,h):s.TUndefined(h)?c.True:c.False}function Yo(p,h){return h.anyOf.some(Ae=>$e(p,Ae)===c.True)?c.True:c.False}function Ud(p,h){return p.anyOf.every(Ae=>$e(Ae,h)===c.True)?c.True:c.False}function Wa(p,h){return c.True}function Md(p,h){return s.TNever(h)?_e(p,h):s.TIntersect(h)?be(p,h):s.TUnion(h)?Yo(p,h):s.TAny(h)?N(p,h):s.TString(h)?kr(p,h):s.TNumber(h)?R(p,h):s.TInteger(h)?ne(p,h):s.TBoolean(h)?b(p,h):s.TArray(h)?T(p,h):s.TTuple(h)?Re(p,h):s.TObject(h)?Ke(p,h):s.TUnknown(h)?c.True:c.False}function Bd(p,h){return s.TUndefined(p)||s.TUndefined(p)?c.True:c.False}function Dd(p,h){return s.TIntersect(h)?be(p,h):s.TUnion(h)?Yo(p,h):s.TUnknown(h)?Wa(p,h):s.TAny(h)?N(p,h):s.TObject(h)?Ke(p,h):s.TVoid(h)?c.True:c.False}function $e(p,h){return s.TTemplateLiteral(p)||s.TTemplateLiteral(h)?ze(p,h):s.TNot(p)||s.TNot(h)?O(p,h):s.TAny(p)?y(p,h):s.TArray(p)?w(p,h):s.TBigInt(p)?A(p,h):s.TBoolean(p)?v(p,h):s.TAsyncIterator(p)?u(p,h):s.TConstructor(p)?$(p,h):s.TDate(p)?q(p,h):s.TFunction(p)?te(p,h):s.TInteger(p)?ge(p,h):s.TIntersect(p)?Ue(p,h):s.TIterator(p)?Fe(p,h):s.TLiteral(p)?$n(p,h):s.TNever(p)?fn(p,h):s.TNull(p)?le(p,h):s.TNumber(p)?me(p,h):s.TObject(p)?Oi(p,h):s.TRecord(p)?Ei(p,h):s.TString(p)?Jo(p,h):s.TSymbol(p)?Xo(p,h):s.TTuple(p)?ht(p,h):s.TPromise(p)?Ho(p,h):s.TUint8Array(p)?Cd(p,h):s.TUndefined(p)?xd(p,h):s.TUnion(p)?Ud(p,h):s.TUnknown(p)?Md(p,h):s.TVoid(p)?Dd(p,h):E(`Unknown left type operand '${p[e.Kind]}'`)}function Ld(p,h){return $e(p,h)}f.Extends=Ld})(d||(e.TypeExtends=d={}));var g;(function(f){function _(w){return w.map(u=>N(u))}function E(w){return new Date(w.getTime())}function U(w){return new Uint8Array(w)}function P(w){let u=Object.getOwnPropertyNames(w).reduce((b,v)=>({...b,[v]:N(w[v])}),{}),A=Object.getOwnPropertySymbols(w).reduce((b,v)=>({...b,[v]:N(w[v])}),{});return{...u,...A}}function N(w){return i.IsArray(w)?_(w):i.IsDate(w)?E(w):i.IsUint8Array(w)?U(w):i.IsObject(w)?P(w):w}function y(w){return w.map(u=>T(u))}f.Rest=y;function T(w,u={}){return{...N(w),...u}}f.Type=T})(g||(e.TypeClone=g={}));var C;(function(f){function _($){return $.map(q=>{let{[e.Optional]:te,...ne}=g.Type(q);return ne})}function E($){return $.every(q=>s.TOptional(q))}function U($){return $.some(q=>s.TOptional(q))}function P($){return E($.allOf)?e.Type.Optional(e.Type.Intersect(_($.allOf))):$}function N($){return U($.anyOf)?e.Type.Optional(e.Type.Union(_($.anyOf))):$}function y($){return $[e.Kind]==="Intersect"?P($):$[e.Kind]==="Union"?N($):$}function T($,q){let te=$.allOf.reduce((ne,ge)=>{let be=b(ge,q);return be[e.Kind]==="Never"?ne:[...ne,be]},[]);return y(e.Type.Intersect(te))}function w($,q){let te=$.anyOf.map(ne=>b(ne,q));return y(e.Type.Union(te))}function u($,q){let te=$.properties[q];return i.IsUndefined(te)?e.Type.Never():e.Type.Union([te])}function A($,q){let te=$.items;if(i.IsUndefined(te))return e.Type.Never();let ne=te[q];return i.IsUndefined(ne)?e.Type.Never():ne}function b($,q){return $[e.Kind]==="Intersect"?T($,q):$[e.Kind]==="Union"?w($,q):$[e.Kind]==="Object"?u($,q):$[e.Kind]==="Tuple"?A($,q):e.Type.Never()}function v($,q,te={}){let ne=q.map(ge=>b($,ge.toString()));return y(e.Type.Union(ne,te))}f.Resolve=v})(C||(e.IndexedAccessor=C={}));var I;(function(f){function _(A){let[b,v]=[A.slice(0,1),A.slice(1)];return`${b.toLowerCase()}${v}`}function E(A){let[b,v]=[A.slice(0,1),A.slice(1)];return`${b.toUpperCase()}${v}`}function U(A){return A.toUpperCase()}function P(A){return A.toLowerCase()}function N(A,b){let v=G.ParseExact(A.pattern);if(!x.Check(v))return{...A,pattern:y(A.pattern,b)};let te=[...L.Generate(v)].map(be=>e.Type.Literal(be)),ne=T(te,b),ge=e.Type.Union(ne);return e.Type.TemplateLiteral([ge])}function y(A,b){return typeof A=="string"?b==="Uncapitalize"?_(A):b==="Capitalize"?E(A):b==="Uppercase"?U(A):b==="Lowercase"?P(A):A:A.toString()}function T(A,b){if(A.length===0)return[];let[v,...$]=A;return[u(v,b),...T($,b)]}function w(A,b){return s.TTemplateLiteral(A)?N(A,b):s.TUnion(A)?e.Type.Union(T(A.anyOf,b)):s.TLiteral(A)?e.Type.Literal(y(A.const,b)):A}function u(A,b){return w(A,b)}f.Map=u})(I||(e.Intrinsic=I={}));var S;(function(f){function _(y,T){return e.Type.Intersect(y.allOf.map(w=>P(w,T)),{...y})}function E(y,T){return e.Type.Union(y.anyOf.map(w=>P(w,T)),{...y})}function U(y,T){return T(y)}function P(y,T){return y[e.Kind]==="Intersect"?_(y,T):y[e.Kind]==="Union"?E(y,T):y[e.Kind]==="Object"?U(y,T):y}function N(y,T,w){return{...P(g.Type(y),T),...w}}f.Map=N})(S||(e.ObjectMap=S={}));var V;(function(f){function _(u){return u[0]==="^"&&u[u.length-1]==="$"?u.slice(1,u.length-1):u}function E(u,A){return u.allOf.reduce((b,v)=>[...b,...y(v,A)],[])}function U(u,A){let b=u.anyOf.map(v=>y(v,A));return[...b.reduce((v,$)=>$.map(q=>b.every(te=>te.includes(q))?v.add(q):v)[0],new Set)]}function P(u,A){return Object.getOwnPropertyNames(u.properties)}function N(u,A){return A.includePatterns?Object.getOwnPropertyNames(u.patternProperties):[]}function y(u,A){return s.TIntersect(u)?E(u,A):s.TUnion(u)?U(u,A):s.TObject(u)?P(u,A):s.TRecord(u)?N(u,A):[]}function T(u,A){return[...new Set(y(u,A))]}f.ResolveKeys=T;function w(u){return`^(${T(u,{includePatterns:!0}).map(v=>`(${_(v)})`).join("|")})$`}f.ResolvePattern=w})(V||(e.KeyResolver=V={}));var J=class extends n{};e.KeyArrayResolverError=J;var F;(function(f){function _(E){return Array.isArray(E)?E:s.TUnionLiteral(E)?E.anyOf.map(U=>U.const.toString()):s.TLiteral(E)?[E.const]:s.TTemplateLiteral(E)?(()=>{let U=G.ParseExact(E.pattern);if(!x.Check(U))throw new J("Cannot resolve keys from infinite template expression");return[...L.Generate(U)]})():[]}f.Resolve=_})(F||(e.KeyArrayResolver=F={}));var k;(function(f){function*_(U){for(let P of U.anyOf)P[e.Kind]==="Union"?yield*_(P):yield P}function E(U){return e.Type.Union([..._(U)],{...U})}f.Resolve=E})(k||(e.UnionResolver=k={}));var z=class extends n{};e.TemplateLiteralPatternError=z;var W;(function(f){function _(N){throw new z(N)}function E(N){return N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function U(N,y){return s.TTemplateLiteral(N)?N.pattern.slice(1,N.pattern.length-1):s.TUnion(N)?`(${N.anyOf.map(T=>U(T,y)).join("|")})`:s.TNumber(N)?`${y}${e.PatternNumber}`:s.TInteger(N)?`${y}${e.PatternNumber}`:s.TBigInt(N)?`${y}${e.PatternNumber}`:s.TString(N)?`${y}${e.PatternString}`:s.TLiteral(N)?`${y}${E(N.const.toString())}`:s.TBoolean(N)?`${y}${e.PatternBoolean}`:_(`Unexpected Kind '${N[e.Kind]}'`)}function P(N){return`^${N.map(y=>U(y,"")).join("")}$`}f.Create=P})(W||(e.TemplateLiteralPattern=W={}));var j;(function(f){function _(E){let U=G.ParseExact(E.pattern);if(!x.Check(U))return e.Type.String();let P=[...L.Generate(U)].map(N=>e.Type.Literal(N));return e.Type.Union(P)}f.Resolve=_})(j||(e.TemplateLiteralResolver=j={}));var Z=class extends n{};e.TemplateLiteralParserError=Z;var G;(function(f){function _($,q,te){return $[q]===te&&$.charCodeAt(q-1)!==92}function E($,q){return _($,q,"(")}function U($,q){return _($,q,")")}function P($,q){return _($,q,"|")}function N($){if(!(E($,0)&&U($,$.length-1)))return!1;let q=0;for(let te=0;te<$.length;te++)if(E($,te)&&(q+=1),U($,te)&&(q-=1),q===0&&te!==$.length-1)return!1;return!0}function y($){return $.slice(1,$.length-1)}function T($){let q=0;for(let te=0;te<$.length;te++)if(E($,te)&&(q+=1),U($,te)&&(q-=1),P($,te)&&q===0)return!0;return!1}function w($){for(let q=0;q<$.length;q++)if(E($,q))return!0;return!1}function u($){let[q,te]=[0,0],ne=[];for(let be=0;be<$.length;be++)if(E($,be)&&(q+=1),U($,be)&&(q-=1),P($,be)&&q===0){let Ue=$.slice(te,be);Ue.length>0&&ne.push(b(Ue)),te=be+1}let ge=$.slice(te);return ge.length>0&&ne.push(b(ge)),ne.length===0?{type:"const",const:""}:ne.length===1?ne[0]:{type:"or",expr:ne}}function A($){function q(ge,be){if(!E(ge,be))throw new Z("TemplateLiteralParser: Index must point to open parens");let Ue=0;for(let Fe=be;Fe<ge.length;Fe++)if(E(ge,Fe)&&(Ue+=1),U(ge,Fe)&&(Ue-=1),Ue===0)return[be,Fe];throw new Z("TemplateLiteralParser: Unclosed group parens in expression")}function te(ge,be){for(let Ue=be;Ue<ge.length;Ue++)if(E(ge,Ue))return[be,Ue];return[be,ge.length]}let ne=[];for(let ge=0;ge<$.length;ge++)if(E($,ge)){let[be,Ue]=q($,ge),Fe=$.slice(be,Ue+1);ne.push(b(Fe)),ge=Ue}else{let[be,Ue]=te($,ge),Fe=$.slice(be,Ue);Fe.length>0&&ne.push(b(Fe)),ge=Ue-1}return ne.length===0?{type:"const",const:""}:ne.length===1?ne[0]:{type:"and",expr:ne}}function b($){return N($)?b(y($)):T($)?u($):w($)?A($):{type:"const",const:$}}f.Parse=b;function v($){return b($.slice(1,$.length-1))}f.ParseExact=v})(G||(e.TemplateLiteralParser=G={}));var fe=class extends n{};e.TemplateLiteralFiniteError=fe;var x;(function(f){function _(y){throw new fe(y)}function E(y){return y.type==="or"&&y.expr.length===2&&y.expr[0].type==="const"&&y.expr[0].const==="0"&&y.expr[1].type==="const"&&y.expr[1].const==="[1-9][0-9]*"}function U(y){return y.type==="or"&&y.expr.length===2&&y.expr[0].type==="const"&&y.expr[0].const==="true"&&y.expr[1].type==="const"&&y.expr[1].const==="false"}function P(y){return y.type==="const"&&y.const===".*"}function N(y){return U(y)?!0:E(y)||P(y)?!1:y.type==="and"?y.expr.every(T=>N(T)):y.type==="or"?y.expr.every(T=>N(T)):y.type==="const"?!0:_("Unknown expression type")}f.Check=N})(x||(e.TemplateLiteralFinite=x={}));var M=class extends n{};e.TemplateLiteralGeneratorError=M;var L;(function(f){function*_(y){if(y.length===1)return yield*y[0];for(let T of y[0])for(let w of _(y.slice(1)))yield`${T}${w}`}function*E(y){return yield*_(y.expr.map(T=>[...N(T)]))}function*U(y){for(let T of y.expr)yield*N(T)}function*P(y){return yield y.const}function*N(y){return y.type==="and"?yield*E(y):y.type==="or"?yield*U(y):y.type==="const"?yield*P(y):(()=>{throw new M("Unknown expression")})()}f.Generate=N})(L||(e.TemplateLiteralGenerator=L={}));var ee;(function(f){function*_(N){let y=N.trim().replace(/"|'/g,"");return y==="boolean"?yield e.Type.Boolean():y==="number"?yield e.Type.Number():y==="bigint"?yield e.Type.BigInt():y==="string"?yield e.Type.String():yield(()=>{let T=y.split("|").map(w=>e.Type.Literal(w.trim()));return T.length===0?e.Type.Never():T.length===1?T[0]:e.Type.Union(T)})()}function*E(N){if(N[1]!=="{"){let y=e.Type.Literal("$"),T=U(N.slice(1));return yield*[y,...T]}for(let y=2;y<N.length;y++)if(N[y]==="}"){let T=_(N.slice(2,y)),w=U(N.slice(y+1));return yield*[...T,...w]}yield e.Type.Literal(N)}function*U(N){for(let y=0;y<N.length;y++)if(N[y]==="$"){let T=e.Type.Literal(N.slice(0,y)),w=E(N.slice(y));return yield*[T,...w]}yield e.Type.Literal(N)}function P(N){return[...U(N)]}f.Parse=P})(ee||(e.TemplateLiteralDslParser=ee={}));var oe=class{constructor(f){this.schema=f}Decode(f){return new Q(this.schema,f)}};e.TransformDecodeBuilder=oe;var Q=class{constructor(f,_){this.schema=f,this.decode=_}Encode(f){let _=g.Type(this.schema);return s.TTransform(_)?(()=>{let P={Encode:N=>_[e.Transform].Encode(f(N)),Decode:N=>this.decode(_[e.Transform].Decode(N))};return{..._,[e.Transform]:P}})():(()=>{let E={Decode:this.decode,Encode:f};return{..._,[e.Transform]:E}})()}};e.TransformEncodeBuilder=Q;var ae=0,D=class extends n{};e.TypeBuilderError=D;var H=class{Create(f){return f}Throw(f){throw new D(f)}Discard(f,_){return _.reduce((E,U)=>{let{[U]:P,...N}=E;return N},f)}Strict(f){return JSON.parse(JSON.stringify(f))}};e.TypeBuilder=H;var Y=class extends H{ReadonlyOptional(f){return this.Readonly(this.Optional(f))}Readonly(f){return{...g.Type(f),[e.Readonly]:"Readonly"}}Optional(f){return{...g.Type(f),[e.Optional]:"Optional"}}Any(f={}){return this.Create({...f,[e.Kind]:"Any"})}Array(f,_={}){return this.Create({..._,[e.Kind]:"Array",type:"array",items:g.Type(f)})}Boolean(f={}){return this.Create({...f,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(f,_={}){return{...I.Map(g.Type(f),"Capitalize"),..._}}Composite(f,_){let E=e.Type.Intersect(f,{}),P=V.ResolveKeys(E,{includePatterns:!1}).reduce((N,y)=>({...N,[y]:e.Type.Index(E,[y])}),{});return e.Type.Object(P,_)}Enum(f,_={}){if(i.IsUndefined(f))return this.Throw("Enum undefined or empty");let E=Object.getOwnPropertyNames(f).filter(N=>isNaN(N)).map(N=>f[N]),P=[...new Set(E)].map(N=>e.Type.Literal(N));return this.Union(P,{..._,[e.Hint]:"Enum"})}Extends(f,_,E,U,P={}){switch(d.Extends(f,_)){case c.Union:return this.Union([g.Type(E,P),g.Type(U,P)]);case c.True:return g.Type(E,P);case c.False:return g.Type(U,P)}}Exclude(f,_,E={}){return s.TTemplateLiteral(f)?this.Exclude(j.Resolve(f),_,E):s.TTemplateLiteral(_)?this.Exclude(f,j.Resolve(_),E):s.TUnion(f)?(()=>{let U=f.anyOf.filter(P=>d.Extends(P,_)===c.False);return U.length===1?g.Type(U[0],E):this.Union(U,E)})():d.Extends(f,_)!==c.False?this.Never(E):g.Type(f,E)}Extract(f,_,E={}){return s.TTemplateLiteral(f)?this.Extract(j.Resolve(f),_,E):s.TTemplateLiteral(_)?this.Extract(f,j.Resolve(_),E):s.TUnion(f)?(()=>{let U=f.anyOf.filter(P=>d.Extends(P,_)!==c.False);return U.length===1?g.Type(U[0],E):this.Union(U,E)})():d.Extends(f,_)!==c.False?g.Type(f,E):this.Never(E)}Index(f,_,E={}){return s.TArray(f)&&s.TNumber(_)?g.Type(f.items,E):s.TTuple(f)&&s.TNumber(_)?(()=>{let P=(i.IsUndefined(f.items)?[]:f.items).map(N=>g.Type(N));return this.Union(P,E)})():(()=>{let U=F.Resolve(_),P=g.Type(f);return C.Resolve(P,U,E)})()}Integer(f={}){return this.Create({...f,[e.Kind]:"Integer",type:"integer"})}Intersect(f,_={}){if(f.length===0)return e.Type.Never();if(f.length===1)return g.Type(f[0],_);f.some(N=>s.TTransform(N))&&this.Throw("Cannot intersect transform types");let E=f.every(N=>s.TObject(N)),U=g.Rest(f),P=s.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:g.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||s.TSchema(_.unevaluatedProperties)||E?this.Create({..._,...P,[e.Kind]:"Intersect",type:"object",allOf:U}):this.Create({..._,...P,[e.Kind]:"Intersect",allOf:U})}KeyOf(f,_={}){return s.TRecord(f)?(()=>{let E=Object.getOwnPropertyNames(f.patternProperties)[0];return E===e.PatternNumberExact?this.Number(_):E===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():s.TTuple(f)?(()=>{let U=(i.IsUndefined(f.items)?[]:f.items).map((P,N)=>e.Type.Literal(N.toString()));return this.Union(U,_)})():s.TArray(f)?this.Number(_):(()=>{let E=V.ResolveKeys(f,{includePatterns:!1});if(E.length===0)return this.Never(_);let U=E.map(P=>this.Literal(P));return this.Union(U,_)})()}Literal(f,_={}){return this.Create({..._,[e.Kind]:"Literal",const:f,type:typeof f})}Lowercase(f,_={}){return{...I.Map(g.Type(f),"Lowercase"),..._}}Never(f={}){return this.Create({...f,[e.Kind]:"Never",not:{}})}Not(f,_){return this.Create({..._,[e.Kind]:"Not",not:g.Type(f)})}Null(f={}){return this.Create({...f,[e.Kind]:"Null",type:"null"})}Number(f={}){return this.Create({...f,[e.Kind]:"Number",type:"number"})}Object(f,_={}){let E=Object.getOwnPropertyNames(f),U=E.filter(T=>s.TOptional(f[T])),P=E.filter(T=>!U.includes(T)),N=s.TSchema(_.additionalProperties)?{additionalProperties:g.Type(_.additionalProperties)}:{},y=E.reduce((T,w)=>({...T,[w]:g.Type(f[w])}),{});return P.length>0?this.Create({..._,...N,[e.Kind]:"Object",type:"object",properties:y,required:P}):this.Create({..._,...N,[e.Kind]:"Object",type:"object",properties:y})}Omit(f,_,E={}){let U=F.Resolve(_);return S.Map(this.Discard(g.Type(f),["$id",e.Transform]),P=>{i.IsArray(P.required)&&(P.required=P.required.filter(N=>!U.includes(N)),P.required.length===0&&delete P.required);for(let N of Object.getOwnPropertyNames(P.properties))U.includes(N)&&delete P.properties[N];return this.Create(P)},E)}Partial(f,_={}){return S.Map(this.Discard(g.Type(f),["$id",e.Transform]),E=>{let U=Object.getOwnPropertyNames(E.properties).reduce((P,N)=>({...P,[N]:this.Optional(E.properties[N])}),{});return this.Object(U,this.Discard(E,["required"]))},_)}Pick(f,_,E={}){let U=F.Resolve(_);return S.Map(this.Discard(g.Type(f),["$id",e.Transform]),P=>{i.IsArray(P.required)&&(P.required=P.required.filter(N=>U.includes(N)),P.required.length===0&&delete P.required);for(let N of Object.getOwnPropertyNames(P.properties))U.includes(N)||delete P.properties[N];return this.Create(P)},E)}Record(f,_,E={}){return s.TTemplateLiteral(f)?(()=>{let U=G.ParseExact(f.pattern);return x.Check(U)?this.Object([...L.Generate(U)].reduce((P,N)=>({...P,[N]:g.Type(_)}),{}),E):this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[f.pattern]:g.Type(_)}})})():s.TUnion(f)?(()=>{let U=k.Resolve(f);if(s.TUnionLiteral(U)){let P=U.anyOf.reduce((N,y)=>({...N,[y.const]:g.Type(_)}),{});return this.Object(P,{...E,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():s.TLiteral(f)?i.IsString(f.const)||i.IsNumber(f.const)?this.Object({[f.const]:g.Type(_)},E):this.Throw("Record key of type literal is not of type string or number"):s.TInteger(f)||s.TNumber(f)?this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:g.Type(_)}}):s.TString(f)?(()=>{let U=i.IsUndefined(f.pattern)?e.PatternStringExact:f.pattern;return this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[U]:g.Type(_)}})})():this.Never()}Recursive(f,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${ae++}`);let E=f({[e.Kind]:"This",$ref:`${_.$id}`});return E.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...E})}Ref(f,_={}){return i.IsString(f)?this.Create({..._,[e.Kind]:"Ref",$ref:f}):(i.IsUndefined(f.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({..._,[e.Kind]:"Ref",$ref:f.$id}))}Required(f,_={}){return S.Map(this.Discard(g.Type(f),["$id",e.Transform]),E=>{let U=Object.getOwnPropertyNames(E.properties).reduce((P,N)=>({...P,[N]:this.Discard(E.properties[N],[e.Optional])}),{});return this.Object(U,E)},_)}Rest(f){return s.TTuple(f)&&!i.IsUndefined(f.items)?g.Rest(f.items):s.TIntersect(f)?g.Rest(f.allOf):s.TUnion(f)?g.Rest(f.anyOf):[]}String(f={}){return this.Create({...f,[e.Kind]:"String",type:"string"})}TemplateLiteral(f,_={}){let E=i.IsString(f)?W.Create(ee.Parse(f)):W.Create(f);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:E})}Transform(f){return new oe(f)}Tuple(f,_={}){let[E,U,P]=[!1,f.length,f.length],N=g.Rest(f),y=f.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:N,additionalItems:E,minItems:U,maxItems:P}:{..._,[e.Kind]:"Tuple",type:"array",minItems:U,maxItems:P};return this.Create(y)}Uncapitalize(f,_={}){return{...I.Map(g.Type(f),"Uncapitalize"),..._}}Union(f,_={}){return s.TTemplateLiteral(f)?j.Resolve(f):(()=>{let E=f;if(E.length===0)return this.Never(_);if(E.length===1)return this.Create(g.Type(E[0],_));let U=g.Rest(E);return this.Create({..._,[e.Kind]:"Union",anyOf:U})})()}Unknown(f={}){return this.Create({...f,[e.Kind]:"Unknown"})}Unsafe(f={}){return this.Create({...f,[e.Kind]:f[e.Kind]||"Unsafe"})}Uppercase(f,_={}){return{...I.Map(g.Type(f),"Uppercase"),..._}}};e.JsonTypeBuilder=Y;var he=class extends Y{AsyncIterator(f,_={}){return this.Create({..._,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:g.Type(f)})}Awaited(f,_={}){let E=U=>U.length>0?(()=>{let[P,...N]=U;return[this.Awaited(P),...E(N)]})():U;return s.TIntersect(f)?e.Type.Intersect(E(f.allOf)):s.TUnion(f)?e.Type.Union(E(f.anyOf)):s.TPromise(f)?this.Awaited(f.item):g.Type(f,_)}BigInt(f={}){return this.Create({...f,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(f,_={}){return this.Tuple([...f.parameters],{..._})}Constructor(f,_,E){let[U,P]=[g.Rest(f),g.Type(_)];return this.Create({...E,[e.Kind]:"Constructor",type:"Constructor",parameters:U,returns:P})}Date(f={}){return this.Create({...f,[e.Kind]:"Date",type:"Date"})}Function(f,_,E){let[U,P]=[g.Rest(f),g.Type(_)];return this.Create({...E,[e.Kind]:"Function",type:"Function",parameters:U,returns:P})}InstanceType(f,_={}){return g.Type(f.returns,_)}Iterator(f,_={}){return this.Create({..._,[e.Kind]:"Iterator",type:"Iterator",items:g.Type(f)})}Parameters(f,_={}){return this.Tuple(f.parameters,{..._})}Promise(f,_={}){return this.Create({..._,[e.Kind]:"Promise",type:"Promise",item:g.Type(f)})}RegExp(f,_={}){let E=i.IsString(f)?f:f.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:E})}RegEx(f,_={}){return this.RegExp(f,_)}ReturnType(f,_={}){return g.Type(f.returns,_)}Symbol(f){return this.Create({...f,[e.Kind]:"Symbol",type:"symbol"})}Undefined(f={}){return this.Create({...f,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(f={}){return this.Create({...f,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(f={}){return this.Create({...f,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=he,e.JsonType=new Y,e.Type=new he}}),_r=Et(rn(),1),{String:zh,Optional:qh,Boolean:Gh,Object:Wh,Number:Hh}=_r.Type,Jh=zh.bind(_r.Type),Xh=Hh.bind(_r.Type),kI=Wh.bind(_r.Type),jI=qh.bind(_r.Type),Yh=Gh.bind(_r.Type),FI=Jh(),VI=Xh(),KI=Yh();function oc(e){return Array.isArray(e)?e:[e]}var Qh=Le({"../../../node_modules/.pnpm/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},n=typeof window<"u"&&typeof window.document<"u",r=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,i=(typeof self>"u"?"undefined":t(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",o=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),s=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=n,e.isWebWorker=i,e.isNode=r,e.isJsDom=o,e.isDeno=s}}),Zh=Le({"../../../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js"(e,t){"use strict";t.exports=function(n,r){r||(r={}),typeof r=="function"&&(r={cmp:r});var i=typeof r.cycles=="boolean"?r.cycles:!1,o=r.cmp&&function(a){return function(l){return function(c,d){var g={key:c,value:l[c]},C={key:d,value:l[d]};return a(g,C)}}}(r.cmp),s=[];return function a(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var c,d;if(Array.isArray(l)){for(d="[",c=0;c<l.length;c++)c&&(d+=","),d+=a(l[c])||"null";return d+"]"}if(l===null)return"null";if(s.indexOf(l)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var g=s.push(l)-1,C=Object.keys(l).sort(o&&o(l));for(d="",c=0;c<C.length;c++){var I=C[c],S=a(l[I]);S&&(d&&(d+=","),d+=JSON.stringify(I)+":"+S)}return s.splice(g,1),"{"+d+"}"}}(n)}}}),ey=Le({"../../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:n}=Object.prototype,r=F();r.configure=F,r.stringify=r,r.default=r,e.stringify=r,e.configure=F,t.exports=r;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(k){return k.length<5e3&&!i.test(k)?`"${k}"`:JSON.stringify(k)}function s(k,z){if(k.length>200||z)return k.sort(z);for(let W=1;W<k.length;W++){let j=k[W],Z=W;for(;Z!==0&&k[Z-1]>j;)k[Z]=k[Z-1],Z--;k[Z]=j}return k}var a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(k){return a.call(k)!==void 0&&k.length!==0}function c(k,z,W){k.length<W&&(W=k.length);let j=z===","?"":" ",Z=`"0":${j}${k[0]}`;for(let G=1;G<W;G++)Z+=`${z}"${G}":${j}${k[G]}`;return Z}function d(k){if(n.call(k,"circularValue")){let z=k.circularValue;if(typeof z=="string")return`"${z}"`;if(z==null)return z;if(z===Error||z===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function g(k){let z;if(n.call(k,"deterministic")&&(z=k.deterministic,typeof z!="boolean"&&typeof z!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return z===void 0?!0:z}function C(k,z){let W;if(n.call(k,z)&&(W=k[z],typeof W!="boolean"))throw new TypeError(`The "${z}" argument must be of type boolean`);return W===void 0?!0:W}function I(k,z){let W;if(n.call(k,z)){if(W=k[z],typeof W!="number")throw new TypeError(`The "${z}" argument must be of type number`);if(!Number.isInteger(W))throw new TypeError(`The "${z}" argument must be an integer`);if(W<1)throw new RangeError(`The "${z}" argument must be >= 1`)}return W===void 0?1/0:W}function S(k){return k===1?"1 item":`${k} items`}function V(k){let z=new Set;for(let W of k)(typeof W=="string"||typeof W=="number")&&z.add(String(W));return z}function J(k){if(n.call(k,"strict")){let z=k.strict;if(typeof z!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(z)return W=>{let j=`Object can not safely be stringified. Received type ${typeof W}`;throw typeof W!="function"&&(j+=` (${W.toString()})`),new Error(j)}}}function F(k){k={...k};let z=J(k);z&&(k.bigint===void 0&&(k.bigint=!1),"circularValue"in k||(k.circularValue=Error));let W=d(k),j=C(k,"bigint"),Z=g(k),G=typeof Z=="function"?Z:void 0,fe=I(k,"maximumDepth"),x=I(k,"maximumBreadth");function M(ae,D,H,Y,he,f){let _=D[ae];switch(typeof _=="object"&&_!==null&&typeof _.toJSON=="function"&&(_=_.toJSON(ae)),_=Y.call(D,ae,_),typeof _){case"string":return o(_);case"object":{if(_===null)return"null";if(H.indexOf(_)!==-1)return W;let E="",U=",",P=f;if(Array.isArray(_)){if(_.length===0)return"[]";if(fe<H.length+1)return'"[Array]"';H.push(_),he!==""&&(f+=he,E+=`
|
|
30
|
+
Use 'override' annotation for methods overridden by subclass.`)}}var Uh=rc(0),Mh=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),ts=0,nc=function(){};function Bh(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Bh(nc,Array.prototype);var ws=function(e){function t(r,i,o,s){var a;return o===void 0&&(o="ObservableArray@"+Et()),s===void 0&&(s=!1),a=e.call(this)||this,Vn(function(){var l=new _s(o,i,s,!0);l.proxy_=a,mu(a,ve,l),r&&r.length&&a.spliceWithArray(0,0,r),Mh&&Object.defineProperty(a,"0",Uh)}),a}_u(t,e);var n=t.prototype;return n.concat=function(){this[ve].atom_.reportObserved();for(var i=arguments.length,o=new Array(i),s=0;s<i;s++)o[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),o.map(function(a){return _r(a)?a.slice():a}))},n[Symbol.iterator]=function(){var r=this,i=0;return Os({next:function(){return i<r.length?{value:r[i++],done:!1}:{done:!0,value:void 0}}})},mr(t,[{key:"length",get:function(){return this[ve].getArrayLength_()},set:function(i){this[ve].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(nc);Object.entries(Fi).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Gi(ws.prototype,t,n)});function rc(e){return{enumerable:!1,configurable:!0,get:function(){return this[ve].get_(e)},set:function(n){this[ve].set_(e,n)}}}function Dh(e){Gt(ws.prototype,""+e,rc(e))}function ic(e){if(e>ts){for(var t=ts;t<e+100;t++)Dh(t);ts=e}}ic(1e3);function Lh(e,t,n){return new ws(e,t,n)}function Ot(e,t){if(typeof e=="object"&&e!==null){if(_r(e))return t!==void 0&&ce(23),e[ve].atom_;if(Ut(e))return e.atom_;if(Ht(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||ce(25,t,Vi(e)),n}if(jn(e)){if(!t)return ce(26);var r=e[ve].values_.get(t);return r||ce(27,t,Vi(e)),r}if(ys(e)||Xr(e)||ji(e))return e}else if(je(e)&&ji(e[ve]))return e[ve];ce(28)}function Ts(e,t){if(e||ce(29),t!==void 0)return Ts(Ot(e,t));if(ys(e)||Xr(e)||ji(e)||Ht(e)||Ut(e))return e;if(e[ve])return e[ve];ce(24,e)}function Vi(e,t){var n;if(t!==void 0)n=Ot(e,t);else{if(gn(e))return e.name;jn(e)||Ht(e)||Ut(e)?n=Ts(e):n=Ot(e)}return n.name_}function Vn(e){var t=Fn(),n=Yi(!0);bt();try{return e()}finally{_t(),Qi(n),nn(t)}}var fu=Gr.toString;function As(e,t,n){return n===void 0&&(n=-1),ds(e,t,n)}function ds(e,t,n,r,i){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var s=fu.call(e);if(s!==fu.call(t))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=du(e),t=du(t);var a=s==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,c=t.constructor;if(l!==c&&!(je(l)&&l instanceof l&&je(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],i=i||[];for(var d=r.length;d--;)if(r[d]===e)return i[d]===t;if(r.push(e),i.push(t),a){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!ds(e[d],t[d],n-1,r,i))return!1}else{var g=Object.keys(e),C=g.length;if(Object.keys(t).length!==C)return!1;for(var I=0;I<C;I++){var S=g[I];if(!(wt(t,S)&&ds(e[S],t[S],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function du(e){return _r(e)?e.slice():gr(e)||Ht(e)||en(e)||Ut(e)?Array.from(e.entries()):e}var pu,kh=((pu=Ki().Iterator)==null?void 0:pu.prototype)||{};function Os(e){return e[Symbol.iterator]=jh,Object.assign(Object.create(kh),e)}function jh(){return this}function oc(e){return e instanceof Object&&typeof e.annotationType_=="string"&&je(e.make_)&&je(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=Ki();typeof t[e]>"u"&&ce("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:sh,extras:{getDebugName:Vi},$mobx:ve});var Fh=Object.create,Es=Object.defineProperty,zh=Object.getOwnPropertyDescriptor,sc=Object.getOwnPropertyNames,Vh=Object.getPrototypeOf,Kh=Object.prototype.hasOwnProperty,Le=(e,t)=>function(){return t||(0,e[sc(e)[0]])((t={exports:{}}).exports,t),t.exports},Is=(e,t)=>{for(var n in t)Es(e,n,{get:t[n],enumerable:!0})},qh=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sc(t))!Kh.call(e,i)&&i!==n&&Es(e,i,{get:()=>t[i],enumerable:!(r=zh(t,i))||r.enumerable});return e},St=(e,t,n)=>(n=e!=null?Fh(Vh(e)):{},qh(t||!e||!e.__esModule?Es(n,"default",{value:e,enumerable:!0}):n,e));var sn=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/typebox.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(f){let _=new Map;function E(){return new Map(_)}f.Entries=E;function U(){return _.clear()}f.Clear=U;function P(w){return _.delete(w)}f.Delete=P;function $(w){return _.has(w)}f.Has=$;function y(w,u){_.set(w,u)}f.Set=y;function T(w){return _.get(w)}f.Get=T})(t||(e.TypeRegistry=t={}));var n=class extends Error{constructor(f){super(f)}};e.TypeBoxError=n;var r;(function(f){let _=new Map;function E(){return new Map(_)}f.Entries=E;function U(){return _.clear()}f.Clear=U;function P(w){return _.delete(w)}f.Delete=P;function $(w){return _.has(w)}f.Has=$;function y(w,u){_.set(w,u)}f.Set=y;function T(w){return _.get(w)}f.Get=T})(r||(e.FormatRegistry=r={}));var i;(function(f){function _(b){return Array.isArray(b)}f.IsArray=_;function E(b){return typeof b=="bigint"}f.IsBigInt=E;function U(b){return typeof b=="boolean"}f.IsBoolean=U;function P(b){return b instanceof globalThis.Date}f.IsDate=P;function $(b){return b===null}f.IsNull=$;function y(b){return typeof b=="number"}f.IsNumber=y;function T(b){return typeof b=="object"&&b!==null}f.IsObject=T;function w(b){return typeof b=="string"}f.IsString=w;function u(b){return b instanceof globalThis.Uint8Array}f.IsUint8Array=u;function A(b){return b===void 0}f.IsUndefined=A})(i||(e.ValueGuard=i={}));var o=class extends n{};e.TypeGuardUnknownTypeError=o;var s;(function(f){function _(m){try{return new RegExp(m),!0}catch{return!1}}function E(m){if(!i.IsString(m))return!1;for(let Re=0;Re<m.length;Re++){let gt=m.charCodeAt(Re);if(gt>=7&><=13||gt===27||gt===127)return!1}return!0}function U(m){return y(m)||Ge(m)}function P(m){return i.IsUndefined(m)||i.IsBigInt(m)}function $(m){return i.IsUndefined(m)||i.IsNumber(m)}function y(m){return i.IsUndefined(m)||i.IsBoolean(m)}function T(m){return i.IsUndefined(m)||i.IsString(m)}function w(m){return i.IsUndefined(m)||i.IsString(m)&&E(m)&&_(m)}function u(m){return i.IsUndefined(m)||i.IsString(m)&&E(m)}function A(m){return i.IsUndefined(m)||Ge(m)}function b(m){return _e(m,"Any")&&T(m.$id)}f.TAny=b;function v(m){return _e(m,"Array")&&m.type==="array"&&T(m.$id)&&Ge(m.items)&&$(m.minItems)&&$(m.maxItems)&&y(m.uniqueItems)&&A(m.contains)&&$(m.minContains)&&$(m.maxContains)}f.TArray=v;function N(m){return _e(m,"AsyncIterator")&&m.type==="AsyncIterator"&&T(m.$id)&&Ge(m.items)}f.TAsyncIterator=N;function q(m){return _e(m,"BigInt")&&m.type==="bigint"&&T(m.$id)&&P(m.exclusiveMaximum)&&P(m.exclusiveMinimum)&&P(m.maximum)&&P(m.minimum)&&P(m.multipleOf)}f.TBigInt=q;function te(m){return _e(m,"Boolean")&&m.type==="boolean"&&T(m.$id)}f.TBoolean=te;function ne(m){return _e(m,"Constructor")&&m.type==="Constructor"&&T(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Re=>Ge(Re))&&Ge(m.returns)}f.TConstructor=ne;function ge(m){return _e(m,"Date")&&m.type==="Date"&&T(m.$id)&&$(m.exclusiveMaximumTimestamp)&&$(m.exclusiveMinimumTimestamp)&&$(m.maximumTimestamp)&&$(m.minimumTimestamp)&&$(m.multipleOfTimestamp)}f.TDate=ge;function be(m){return _e(m,"Function")&&m.type==="Function"&&T(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Re=>Ge(Re))&&Ge(m.returns)}f.TFunction=be;function Ue(m){return _e(m,"Integer")&&m.type==="integer"&&T(m.$id)&&$(m.exclusiveMaximum)&&$(m.exclusiveMinimum)&&$(m.maximum)&&$(m.minimum)&&$(m.multipleOf)}f.TInteger=Ue;function Fe(m){return _e(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Re=>Ge(Re)&&!jr(Re))&&T(m.type)&&(y(m.unevaluatedProperties)||A(m.unevaluatedProperties))&&T(m.$id)}f.TIntersect=Fe;function Pn(m){return _e(m,"Iterator")&&m.type==="Iterator"&&T(m.$id)&&Ge(m.items)}f.TIterator=Pn;function _e(m,Re){return pn(m)&&m[e.Kind]===Re}f.TKindOf=_e;function pn(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}f.TKind=pn;function Cn(m){return R(m)&&i.IsString(m.const)}f.TLiteralString=Cn;function O(m){return R(m)&&i.IsNumber(m.const)}f.TLiteralNumber=O;function le(m){return R(m)&&i.IsBoolean(m.const)}f.TLiteralBoolean=le;function R(m){return _e(m,"Literal")&&T(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}f.TLiteral=R;function me(m){return _e(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}f.TNever=me;function re(m){return _e(m,"Not")&&Ge(m.not)}f.TNot=re;function de(m){return _e(m,"Null")&&m.type==="null"&&T(m.$id)}f.TNull=de;function Se(m){return _e(m,"Number")&&m.type==="number"&&T(m.$id)&&$(m.exclusiveMaximum)&&$(m.exclusiveMinimum)&&$(m.maximum)&&$(m.minimum)&&$(m.multipleOf)}f.TNumber=Se;function ke(m){return _e(m,"Object")&&m.type==="object"&&T(m.$id)&&i.IsObject(m.properties)&&U(m.additionalProperties)&&$(m.minProperties)&&$(m.maxProperties)&&Object.entries(m.properties).every(([Re,gt])=>E(Re)&&Ge(gt))}f.TObject=ke;function rt(m){return _e(m,"Promise")&&m.type==="Promise"&&T(m.$id)&&Ge(m.item)}f.TPromise=rt;function et(m){return _e(m,"Record")&&m.type==="object"&&T(m.$id)&&U(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Re=>{let gt=Object.getOwnPropertyNames(Re.patternProperties);return gt.length===1&&_(gt[0])&&i.IsObject(Re.patternProperties)&&Ge(Re.patternProperties[gt[0]])})(m)}f.TRecord=et;function ot(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}f.TRecursive=ot;function Zt(m){return _e(m,"Ref")&&T(m.$id)&&i.IsString(m.$ref)}f.TRef=Zt;function ur(m){return _e(m,"String")&&m.type==="string"&&T(m.$id)&&$(m.minLength)&&$(m.maxLength)&&w(m.pattern)&&u(m.format)}f.TString=ur;function cr(m){return _e(m,"Symbol")&&m.type==="symbol"&&T(m.$id)}f.TSymbol=cr;function xn(m){return _e(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}f.TTemplateLiteral=xn;function Ei(m){return _e(m,"This")&&T(m.$id)&&i.IsString(m.$ref)}f.TThis=Ei;function jr(m){return i.IsObject(m)&&e.Transform in m}f.TTransform=jr;function qe(m){return _e(m,"Tuple")&&m.type==="array"&&T(m.$id)&&i.IsNumber(m.minItems)&&i.IsNumber(m.maxItems)&&m.minItems===m.maxItems&&(i.IsUndefined(m.items)&&i.IsUndefined(m.additionalItems)&&m.minItems===0||i.IsArray(m.items)&&m.items.every(Re=>Ge(Re)))}f.TTuple=qe;function Ii(m){return _e(m,"Undefined")&&m.type==="undefined"&&T(m.$id)}f.TUndefined=Ii;function Xo(m){return Un(m)&&m.anyOf.every(Re=>Cn(Re)||O(Re))}f.TUnionLiteral=Xo;function Un(m){return _e(m,"Union")&&T(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Re=>Ge(Re))}f.TUnion=Un;function lr(m){return _e(m,"Uint8Array")&&m.type==="Uint8Array"&&T(m.$id)&&$(m.minByteLength)&&$(m.maxByteLength)}f.TUint8Array=lr;function it(m){return _e(m,"Unknown")&&T(m.$id)}f.TUnknown=it;function Si(m){return _e(m,"Unsafe")}f.TUnsafe=Si;function Fr(m){return _e(m,"Void")&&m.type==="void"&&T(m.$id)}f.TVoid=Fr;function Yo(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}f.TReadonly=Yo;function Qo(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}f.TOptional=Qo;function Ge(m){return i.IsObject(m)&&(b(m)||v(m)||te(m)||q(m)||N(m)||ne(m)||ge(m)||be(m)||Ue(m)||Fe(m)||Pn(m)||R(m)||me(m)||re(m)||de(m)||Se(m)||ke(m)||rt(m)||et(m)||Zt(m)||ur(m)||cr(m)||xn(m)||Ei(m)||qe(m)||Ii(m)||Un(m)||lr(m)||it(m)||Si(m)||Fr(m)||pn(m)&&t.Has(m[e.Kind]))}f.TSchema=Ge})(s||(e.TypeGuard=s={}));var a;(function(f){function _(E){return E[e.Kind]==="Intersect"?E.allOf.every(U=>_(U)):E[e.Kind]==="Union"?E.anyOf.some(U=>_(U)):E[e.Kind]==="Undefined"?!0:E[e.Kind]==="Not"?!_(E.not):!1}f.Check=_})(a||(e.ExtendsUndefined=a={}));var l=class extends n{};e.TypeExtendsError=l;var c;(function(f){f[f.Union=0]="Union",f[f.True=1]="True",f[f.False=2]="False"})(c||(e.TypeExtendsResult=c={}));var d;(function(f){function _(p){return p===c.False?p:c.True}function E(p){throw new l(p)}function U(p){return s.TNever(p)||s.TIntersect(p)||s.TUnion(p)||s.TUnknown(p)||s.TAny(p)}function P(p,h){return s.TNever(h)?_e(p,h):s.TIntersect(h)?be(p,h):s.TUnion(h)?Zo(p,h):s.TUnknown(h)?Ja(p,h):s.TAny(h)?$(p,h):E("StructuralRight")}function $(p,h){return c.True}function y(p,h){return s.TIntersect(h)?be(p,h):s.TUnion(h)&&h.anyOf.some(Ae=>s.TAny(Ae)||s.TUnknown(Ae))?c.True:s.TUnion(h)?c.Union:s.TUnknown(h)||s.TAny(h)?c.True:c.Union}function T(p,h){return s.TUnknown(p)?c.False:s.TAny(p)?c.Union:s.TNever(p)?c.True:c.False}function w(p,h){return s.TObject(h)&&xn(h)?c.True:U(h)?P(p,h):s.TArray(h)?_(Ne(p.items,h.items)):c.False}function u(p,h){return U(h)?P(p,h):s.TAsyncIterator(h)?_(Ne(p.items,h.items)):c.False}function A(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TBigInt(h)?c.True:c.False}function b(p,h){return s.TLiteral(p)&&i.IsBoolean(p.const)||s.TBoolean(p)?c.True:c.False}function v(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TBoolean(h)?c.True:c.False}function N(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TConstructor(h)?p.parameters.length>h.parameters.length?c.False:p.parameters.every((Ae,xt)=>_(Ne(h.parameters[xt],Ae))===c.True)?_(Ne(p.returns,h.returns)):c.False:c.False}function q(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TDate(h)?c.True:c.False}function te(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TFunction(h)?p.parameters.length>h.parameters.length?c.False:p.parameters.every((Ae,xt)=>_(Ne(h.parameters[xt],Ae))===c.True)?_(Ne(p.returns,h.returns)):c.False:c.False}function ne(p,h){return s.TLiteral(p)&&i.IsNumber(p.const)||s.TNumber(p)||s.TInteger(p)?c.True:c.False}function ge(p,h){return s.TInteger(h)||s.TNumber(h)?c.True:U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):c.False}function be(p,h){return h.allOf.every(Ae=>Ne(p,Ae)===c.True)?c.True:c.False}function Ue(p,h){return p.allOf.some(Ae=>Ne(Ae,h)===c.True)?c.True:c.False}function Fe(p,h){return U(h)?P(p,h):s.TIterator(h)?_(Ne(p.items,h.items)):c.False}function Pn(p,h){return s.TLiteral(h)&&h.const===p.const?c.True:U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TString(h)?Fr(p,h):s.TNumber(h)?R(p,h):s.TInteger(h)?ne(p,h):s.TBoolean(h)?b(p,h):c.False}function _e(p,h){return c.False}function pn(p,h){return c.True}function Cn(p){let[h,Ae]=[p,0];for(;s.TNot(h);)h=h.not,Ae+=1;return Ae%2===0?h:e.Type.Unknown()}function O(p,h){return s.TNot(p)?Ne(Cn(p),h):s.TNot(h)?Ne(p,Cn(h)):E("Invalid fallthrough for Not")}function le(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TNull(h)?c.True:c.False}function R(p,h){return s.TLiteralNumber(p)||s.TNumber(p)||s.TInteger(p)?c.True:c.False}function me(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TInteger(h)||s.TNumber(h)?c.True:c.False}function re(p,h){return Object.getOwnPropertyNames(p.properties).length===h}function de(p){return xn(p)}function Se(p){return re(p,0)||re(p,1)&&"description"in p.properties&&s.TUnion(p.properties.description)&&p.properties.description.anyOf.length===2&&(s.TString(p.properties.description.anyOf[0])&&s.TUndefined(p.properties.description.anyOf[1])||s.TString(p.properties.description.anyOf[1])&&s.TUndefined(p.properties.description.anyOf[0]))}function ke(p){return re(p,0)}function rt(p){return re(p,0)}function et(p){return re(p,0)}function ot(p){return re(p,0)}function Zt(p){return xn(p)}function ur(p){let h=e.Type.Number();return re(p,0)||re(p,1)&&"length"in p.properties&&_(Ne(p.properties.length,h))===c.True}function cr(p){return re(p,0)}function xn(p){let h=e.Type.Number();return re(p,0)||re(p,1)&&"length"in p.properties&&_(Ne(p.properties.length,h))===c.True}function Ei(p){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return re(p,0)||re(p,1)&&"then"in p.properties&&_(Ne(p.properties.then,h))===c.True}function jr(p,h){return Ne(p,h)===c.False||s.TOptional(p)&&!s.TOptional(h)?c.False:c.True}function qe(p,h){return s.TUnknown(p)?c.False:s.TAny(p)?c.Union:s.TNever(p)||s.TLiteralString(p)&&de(h)||s.TLiteralNumber(p)&&ke(h)||s.TLiteralBoolean(p)&&rt(h)||s.TSymbol(p)&&Se(h)||s.TBigInt(p)&&et(h)||s.TString(p)&&de(h)||s.TSymbol(p)&&Se(h)||s.TNumber(p)&&ke(h)||s.TInteger(p)&&ke(h)||s.TBoolean(p)&&rt(h)||s.TUint8Array(p)&&Zt(h)||s.TDate(p)&&ot(h)||s.TConstructor(p)&&cr(h)||s.TFunction(p)&&ur(h)?c.True:s.TRecord(p)&&s.TString(Un(p))?h[e.Hint]==="Record"?c.True:c.False:s.TRecord(p)&&s.TNumber(Un(p))?re(h,0)?c.True:c.False:c.False}function Ii(p,h){return U(h)?P(p,h):s.TRecord(h)?it(p,h):s.TObject(h)?(()=>{for(let Ae of Object.getOwnPropertyNames(h.properties)){if(!(Ae in p.properties)&&!s.TOptional(h.properties[Ae]))return c.False;if(s.TOptional(h.properties[Ae]))return c.True;if(jr(p.properties[Ae],h.properties[Ae])===c.False)return c.False}return c.True})():c.False}function Xo(p,h){return U(h)?P(p,h):s.TObject(h)&&Ei(h)?c.True:s.TPromise(h)?_(Ne(p.item,h.item)):c.False}function Un(p){return e.PatternNumberExact in p.patternProperties?e.Type.Number():e.PatternStringExact in p.patternProperties?e.Type.String():E("Unknown record key pattern")}function lr(p){return e.PatternNumberExact in p.patternProperties?p.patternProperties[e.PatternNumberExact]:e.PatternStringExact in p.patternProperties?p.patternProperties[e.PatternStringExact]:E("Unable to get record value schema")}function it(p,h){let[Ae,xt]=[Un(h),lr(h)];return s.TLiteralString(p)&&s.TNumber(Ae)&&_(Ne(p,xt))===c.True?c.True:s.TUint8Array(p)&&s.TNumber(Ae)||s.TString(p)&&s.TNumber(Ae)||s.TArray(p)&&s.TNumber(Ae)?Ne(p,xt):s.TObject(p)?(()=>{for(let Fd of Object.getOwnPropertyNames(p.properties))if(jr(xt,p.properties[Fd])===c.False)return c.False;return c.True})():c.False}function Si(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?Ne(lr(p),lr(h)):c.False}function Fr(p,h){return s.TLiteral(p)&&i.IsString(p.const)||s.TString(p)?c.True:c.False}function Yo(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TString(h)?c.True:c.False}function Qo(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TSymbol(h)?c.True:c.False}function Ge(p,h){return s.TTemplateLiteral(p)?Ne(j.Resolve(p),h):s.TTemplateLiteral(h)?Ne(p,j.Resolve(h)):E("Invalid fallthrough for TemplateLiteral")}function m(p,h){return s.TArray(h)&&p.items!==void 0&&p.items.every(Ae=>Ne(Ae,h.items)===c.True)}function Re(p,h){return s.TNever(p)?c.True:s.TUnknown(p)?c.False:s.TAny(p)?c.Union:c.False}function gt(p,h){return U(h)?P(p,h):s.TObject(h)&&xn(h)||s.TArray(h)&&m(p,h)?c.True:s.TTuple(h)?i.IsUndefined(p.items)&&!i.IsUndefined(h.items)||!i.IsUndefined(p.items)&&i.IsUndefined(h.items)?c.False:i.IsUndefined(p.items)&&!i.IsUndefined(h.items)||p.items.every((Ae,xt)=>Ne(Ae,h.items[xt])===c.True)?c.True:c.False:c.False}function Ud(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TUint8Array(h)?c.True:c.False}function Md(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TVoid(h)?Ld(p,h):s.TUndefined(h)?c.True:c.False}function Zo(p,h){return h.anyOf.some(Ae=>Ne(p,Ae)===c.True)?c.True:c.False}function Bd(p,h){return p.anyOf.every(Ae=>Ne(Ae,h)===c.True)?c.True:c.False}function Ja(p,h){return c.True}function Dd(p,h){return s.TNever(h)?_e(p,h):s.TIntersect(h)?be(p,h):s.TUnion(h)?Zo(p,h):s.TAny(h)?$(p,h):s.TString(h)?Fr(p,h):s.TNumber(h)?R(p,h):s.TInteger(h)?ne(p,h):s.TBoolean(h)?b(p,h):s.TArray(h)?T(p,h):s.TTuple(h)?Re(p,h):s.TObject(h)?qe(p,h):s.TUnknown(h)?c.True:c.False}function Ld(p,h){return s.TUndefined(p)||s.TUndefined(p)?c.True:c.False}function kd(p,h){return s.TIntersect(h)?be(p,h):s.TUnion(h)?Zo(p,h):s.TUnknown(h)?Ja(p,h):s.TAny(h)?$(p,h):s.TObject(h)?qe(p,h):s.TVoid(h)?c.True:c.False}function Ne(p,h){return s.TTemplateLiteral(p)||s.TTemplateLiteral(h)?Ge(p,h):s.TNot(p)||s.TNot(h)?O(p,h):s.TAny(p)?y(p,h):s.TArray(p)?w(p,h):s.TBigInt(p)?A(p,h):s.TBoolean(p)?v(p,h):s.TAsyncIterator(p)?u(p,h):s.TConstructor(p)?N(p,h):s.TDate(p)?q(p,h):s.TFunction(p)?te(p,h):s.TInteger(p)?ge(p,h):s.TIntersect(p)?Ue(p,h):s.TIterator(p)?Fe(p,h):s.TLiteral(p)?Pn(p,h):s.TNever(p)?pn(p,h):s.TNull(p)?le(p,h):s.TNumber(p)?me(p,h):s.TObject(p)?Ii(p,h):s.TRecord(p)?Si(p,h):s.TString(p)?Yo(p,h):s.TSymbol(p)?Qo(p,h):s.TTuple(p)?gt(p,h):s.TPromise(p)?Xo(p,h):s.TUint8Array(p)?Ud(p,h):s.TUndefined(p)?Md(p,h):s.TUnion(p)?Bd(p,h):s.TUnknown(p)?Dd(p,h):s.TVoid(p)?kd(p,h):E(`Unknown left type operand '${p[e.Kind]}'`)}function jd(p,h){return Ne(p,h)}f.Extends=jd})(d||(e.TypeExtends=d={}));var g;(function(f){function _(w){return w.map(u=>$(u))}function E(w){return new Date(w.getTime())}function U(w){return new Uint8Array(w)}function P(w){let u=Object.getOwnPropertyNames(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{}),A=Object.getOwnPropertySymbols(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{});return{...u,...A}}function $(w){return i.IsArray(w)?_(w):i.IsDate(w)?E(w):i.IsUint8Array(w)?U(w):i.IsObject(w)?P(w):w}function y(w){return w.map(u=>T(u))}f.Rest=y;function T(w,u={}){return{...$(w),...u}}f.Type=T})(g||(e.TypeClone=g={}));var C;(function(f){function _(N){return N.map(q=>{let{[e.Optional]:te,...ne}=g.Type(q);return ne})}function E(N){return N.every(q=>s.TOptional(q))}function U(N){return N.some(q=>s.TOptional(q))}function P(N){return E(N.allOf)?e.Type.Optional(e.Type.Intersect(_(N.allOf))):N}function $(N){return U(N.anyOf)?e.Type.Optional(e.Type.Union(_(N.anyOf))):N}function y(N){return N[e.Kind]==="Intersect"?P(N):N[e.Kind]==="Union"?$(N):N}function T(N,q){let te=N.allOf.reduce((ne,ge)=>{let be=b(ge,q);return be[e.Kind]==="Never"?ne:[...ne,be]},[]);return y(e.Type.Intersect(te))}function w(N,q){let te=N.anyOf.map(ne=>b(ne,q));return y(e.Type.Union(te))}function u(N,q){let te=N.properties[q];return i.IsUndefined(te)?e.Type.Never():e.Type.Union([te])}function A(N,q){let te=N.items;if(i.IsUndefined(te))return e.Type.Never();let ne=te[q];return i.IsUndefined(ne)?e.Type.Never():ne}function b(N,q){return N[e.Kind]==="Intersect"?T(N,q):N[e.Kind]==="Union"?w(N,q):N[e.Kind]==="Object"?u(N,q):N[e.Kind]==="Tuple"?A(N,q):e.Type.Never()}function v(N,q,te={}){let ne=q.map(ge=>b(N,ge.toString()));return y(e.Type.Union(ne,te))}f.Resolve=v})(C||(e.IndexedAccessor=C={}));var I;(function(f){function _(A){let[b,v]=[A.slice(0,1),A.slice(1)];return`${b.toLowerCase()}${v}`}function E(A){let[b,v]=[A.slice(0,1),A.slice(1)];return`${b.toUpperCase()}${v}`}function U(A){return A.toUpperCase()}function P(A){return A.toLowerCase()}function $(A,b){let v=G.ParseExact(A.pattern);if(!x.Check(v))return{...A,pattern:y(A.pattern,b)};let te=[...L.Generate(v)].map(be=>e.Type.Literal(be)),ne=T(te,b),ge=e.Type.Union(ne);return e.Type.TemplateLiteral([ge])}function y(A,b){return typeof A=="string"?b==="Uncapitalize"?_(A):b==="Capitalize"?E(A):b==="Uppercase"?U(A):b==="Lowercase"?P(A):A:A.toString()}function T(A,b){if(A.length===0)return[];let[v,...N]=A;return[u(v,b),...T(N,b)]}function w(A,b){return s.TTemplateLiteral(A)?$(A,b):s.TUnion(A)?e.Type.Union(T(A.anyOf,b)):s.TLiteral(A)?e.Type.Literal(y(A.const,b)):A}function u(A,b){return w(A,b)}f.Map=u})(I||(e.Intrinsic=I={}));var S;(function(f){function _(y,T){return e.Type.Intersect(y.allOf.map(w=>P(w,T)),{...y})}function E(y,T){return e.Type.Union(y.anyOf.map(w=>P(w,T)),{...y})}function U(y,T){return T(y)}function P(y,T){return y[e.Kind]==="Intersect"?_(y,T):y[e.Kind]==="Union"?E(y,T):y[e.Kind]==="Object"?U(y,T):y}function $(y,T,w){return{...P(g.Type(y),T),...w}}f.Map=$})(S||(e.ObjectMap=S={}));var z;(function(f){function _(u){return u[0]==="^"&&u[u.length-1]==="$"?u.slice(1,u.length-1):u}function E(u,A){return u.allOf.reduce((b,v)=>[...b,...y(v,A)],[])}function U(u,A){let b=u.anyOf.map(v=>y(v,A));return[...b.reduce((v,N)=>N.map(q=>b.every(te=>te.includes(q))?v.add(q):v)[0],new Set)]}function P(u,A){return Object.getOwnPropertyNames(u.properties)}function $(u,A){return A.includePatterns?Object.getOwnPropertyNames(u.patternProperties):[]}function y(u,A){return s.TIntersect(u)?E(u,A):s.TUnion(u)?U(u,A):s.TObject(u)?P(u,A):s.TRecord(u)?$(u,A):[]}function T(u,A){return[...new Set(y(u,A))]}f.ResolveKeys=T;function w(u){return`^(${T(u,{includePatterns:!0}).map(v=>`(${_(v)})`).join("|")})$`}f.ResolvePattern=w})(z||(e.KeyResolver=z={}));var J=class extends n{};e.KeyArrayResolverError=J;var F;(function(f){function _(E){return Array.isArray(E)?E:s.TUnionLiteral(E)?E.anyOf.map(U=>U.const.toString()):s.TLiteral(E)?[E.const]:s.TTemplateLiteral(E)?(()=>{let U=G.ParseExact(E.pattern);if(!x.Check(U))throw new J("Cannot resolve keys from infinite template expression");return[...L.Generate(U)]})():[]}f.Resolve=_})(F||(e.KeyArrayResolver=F={}));var k;(function(f){function*_(U){for(let P of U.anyOf)P[e.Kind]==="Union"?yield*_(P):yield P}function E(U){return e.Type.Union([..._(U)],{...U})}f.Resolve=E})(k||(e.UnionResolver=k={}));var K=class extends n{};e.TemplateLiteralPatternError=K;var W;(function(f){function _($){throw new K($)}function E($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function U($,y){return s.TTemplateLiteral($)?$.pattern.slice(1,$.pattern.length-1):s.TUnion($)?`(${$.anyOf.map(T=>U(T,y)).join("|")})`:s.TNumber($)?`${y}${e.PatternNumber}`:s.TInteger($)?`${y}${e.PatternNumber}`:s.TBigInt($)?`${y}${e.PatternNumber}`:s.TString($)?`${y}${e.PatternString}`:s.TLiteral($)?`${y}${E($.const.toString())}`:s.TBoolean($)?`${y}${e.PatternBoolean}`:_(`Unexpected Kind '${$[e.Kind]}'`)}function P($){return`^${$.map(y=>U(y,"")).join("")}$`}f.Create=P})(W||(e.TemplateLiteralPattern=W={}));var j;(function(f){function _(E){let U=G.ParseExact(E.pattern);if(!x.Check(U))return e.Type.String();let P=[...L.Generate(U)].map($=>e.Type.Literal($));return e.Type.Union(P)}f.Resolve=_})(j||(e.TemplateLiteralResolver=j={}));var Z=class extends n{};e.TemplateLiteralParserError=Z;var G;(function(f){function _(N,q,te){return N[q]===te&&N.charCodeAt(q-1)!==92}function E(N,q){return _(N,q,"(")}function U(N,q){return _(N,q,")")}function P(N,q){return _(N,q,"|")}function $(N){if(!(E(N,0)&&U(N,N.length-1)))return!1;let q=0;for(let te=0;te<N.length;te++)if(E(N,te)&&(q+=1),U(N,te)&&(q-=1),q===0&&te!==N.length-1)return!1;return!0}function y(N){return N.slice(1,N.length-1)}function T(N){let q=0;for(let te=0;te<N.length;te++)if(E(N,te)&&(q+=1),U(N,te)&&(q-=1),P(N,te)&&q===0)return!0;return!1}function w(N){for(let q=0;q<N.length;q++)if(E(N,q))return!0;return!1}function u(N){let[q,te]=[0,0],ne=[];for(let be=0;be<N.length;be++)if(E(N,be)&&(q+=1),U(N,be)&&(q-=1),P(N,be)&&q===0){let Ue=N.slice(te,be);Ue.length>0&&ne.push(b(Ue)),te=be+1}let ge=N.slice(te);return ge.length>0&&ne.push(b(ge)),ne.length===0?{type:"const",const:""}:ne.length===1?ne[0]:{type:"or",expr:ne}}function A(N){function q(ge,be){if(!E(ge,be))throw new Z("TemplateLiteralParser: Index must point to open parens");let Ue=0;for(let Fe=be;Fe<ge.length;Fe++)if(E(ge,Fe)&&(Ue+=1),U(ge,Fe)&&(Ue-=1),Ue===0)return[be,Fe];throw new Z("TemplateLiteralParser: Unclosed group parens in expression")}function te(ge,be){for(let Ue=be;Ue<ge.length;Ue++)if(E(ge,Ue))return[be,Ue];return[be,ge.length]}let ne=[];for(let ge=0;ge<N.length;ge++)if(E(N,ge)){let[be,Ue]=q(N,ge),Fe=N.slice(be,Ue+1);ne.push(b(Fe)),ge=Ue}else{let[be,Ue]=te(N,ge),Fe=N.slice(be,Ue);Fe.length>0&&ne.push(b(Fe)),ge=Ue-1}return ne.length===0?{type:"const",const:""}:ne.length===1?ne[0]:{type:"and",expr:ne}}function b(N){return $(N)?b(y(N)):T(N)?u(N):w(N)?A(N):{type:"const",const:N}}f.Parse=b;function v(N){return b(N.slice(1,N.length-1))}f.ParseExact=v})(G||(e.TemplateLiteralParser=G={}));var fe=class extends n{};e.TemplateLiteralFiniteError=fe;var x;(function(f){function _(y){throw new fe(y)}function E(y){return y.type==="or"&&y.expr.length===2&&y.expr[0].type==="const"&&y.expr[0].const==="0"&&y.expr[1].type==="const"&&y.expr[1].const==="[1-9][0-9]*"}function U(y){return y.type==="or"&&y.expr.length===2&&y.expr[0].type==="const"&&y.expr[0].const==="true"&&y.expr[1].type==="const"&&y.expr[1].const==="false"}function P(y){return y.type==="const"&&y.const===".*"}function $(y){return U(y)?!0:E(y)||P(y)?!1:y.type==="and"?y.expr.every(T=>$(T)):y.type==="or"?y.expr.every(T=>$(T)):y.type==="const"?!0:_("Unknown expression type")}f.Check=$})(x||(e.TemplateLiteralFinite=x={}));var M=class extends n{};e.TemplateLiteralGeneratorError=M;var L;(function(f){function*_(y){if(y.length===1)return yield*y[0];for(let T of y[0])for(let w of _(y.slice(1)))yield`${T}${w}`}function*E(y){return yield*_(y.expr.map(T=>[...$(T)]))}function*U(y){for(let T of y.expr)yield*$(T)}function*P(y){return yield y.const}function*$(y){return y.type==="and"?yield*E(y):y.type==="or"?yield*U(y):y.type==="const"?yield*P(y):(()=>{throw new M("Unknown expression")})()}f.Generate=$})(L||(e.TemplateLiteralGenerator=L={}));var ee;(function(f){function*_($){let y=$.trim().replace(/"|'/g,"");return y==="boolean"?yield e.Type.Boolean():y==="number"?yield e.Type.Number():y==="bigint"?yield e.Type.BigInt():y==="string"?yield e.Type.String():yield(()=>{let T=y.split("|").map(w=>e.Type.Literal(w.trim()));return T.length===0?e.Type.Never():T.length===1?T[0]:e.Type.Union(T)})()}function*E($){if($[1]!=="{"){let y=e.Type.Literal("$"),T=U($.slice(1));return yield*[y,...T]}for(let y=2;y<$.length;y++)if($[y]==="}"){let T=_($.slice(2,y)),w=U($.slice(y+1));return yield*[...T,...w]}yield e.Type.Literal($)}function*U($){for(let y=0;y<$.length;y++)if($[y]==="$"){let T=e.Type.Literal($.slice(0,y)),w=E($.slice(y));return yield*[T,...w]}yield e.Type.Literal($)}function P($){return[...U($)]}f.Parse=P})(ee||(e.TemplateLiteralDslParser=ee={}));var oe=class{constructor(f){this.schema=f}Decode(f){return new Q(this.schema,f)}};e.TransformDecodeBuilder=oe;var Q=class{constructor(f,_){this.schema=f,this.decode=_}Encode(f){let _=g.Type(this.schema);return s.TTransform(_)?(()=>{let P={Encode:$=>_[e.Transform].Encode(f($)),Decode:$=>this.decode(_[e.Transform].Decode($))};return{..._,[e.Transform]:P}})():(()=>{let E={Decode:this.decode,Encode:f};return{..._,[e.Transform]:E}})()}};e.TransformEncodeBuilder=Q;var ae=0,D=class extends n{};e.TypeBuilderError=D;var H=class{Create(f){return f}Throw(f){throw new D(f)}Discard(f,_){return _.reduce((E,U)=>{let{[U]:P,...$}=E;return $},f)}Strict(f){return JSON.parse(JSON.stringify(f))}};e.TypeBuilder=H;var Y=class extends H{ReadonlyOptional(f){return this.Readonly(this.Optional(f))}Readonly(f){return{...g.Type(f),[e.Readonly]:"Readonly"}}Optional(f){return{...g.Type(f),[e.Optional]:"Optional"}}Any(f={}){return this.Create({...f,[e.Kind]:"Any"})}Array(f,_={}){return this.Create({..._,[e.Kind]:"Array",type:"array",items:g.Type(f)})}Boolean(f={}){return this.Create({...f,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(f,_={}){return{...I.Map(g.Type(f),"Capitalize"),..._}}Composite(f,_){let E=e.Type.Intersect(f,{}),P=z.ResolveKeys(E,{includePatterns:!1}).reduce(($,y)=>({...$,[y]:e.Type.Index(E,[y])}),{});return e.Type.Object(P,_)}Enum(f,_={}){if(i.IsUndefined(f))return this.Throw("Enum undefined or empty");let E=Object.getOwnPropertyNames(f).filter($=>isNaN($)).map($=>f[$]),P=[...new Set(E)].map($=>e.Type.Literal($));return this.Union(P,{..._,[e.Hint]:"Enum"})}Extends(f,_,E,U,P={}){switch(d.Extends(f,_)){case c.Union:return this.Union([g.Type(E,P),g.Type(U,P)]);case c.True:return g.Type(E,P);case c.False:return g.Type(U,P)}}Exclude(f,_,E={}){return s.TTemplateLiteral(f)?this.Exclude(j.Resolve(f),_,E):s.TTemplateLiteral(_)?this.Exclude(f,j.Resolve(_),E):s.TUnion(f)?(()=>{let U=f.anyOf.filter(P=>d.Extends(P,_)===c.False);return U.length===1?g.Type(U[0],E):this.Union(U,E)})():d.Extends(f,_)!==c.False?this.Never(E):g.Type(f,E)}Extract(f,_,E={}){return s.TTemplateLiteral(f)?this.Extract(j.Resolve(f),_,E):s.TTemplateLiteral(_)?this.Extract(f,j.Resolve(_),E):s.TUnion(f)?(()=>{let U=f.anyOf.filter(P=>d.Extends(P,_)!==c.False);return U.length===1?g.Type(U[0],E):this.Union(U,E)})():d.Extends(f,_)!==c.False?g.Type(f,E):this.Never(E)}Index(f,_,E={}){return s.TArray(f)&&s.TNumber(_)?g.Type(f.items,E):s.TTuple(f)&&s.TNumber(_)?(()=>{let P=(i.IsUndefined(f.items)?[]:f.items).map($=>g.Type($));return this.Union(P,E)})():(()=>{let U=F.Resolve(_),P=g.Type(f);return C.Resolve(P,U,E)})()}Integer(f={}){return this.Create({...f,[e.Kind]:"Integer",type:"integer"})}Intersect(f,_={}){if(f.length===0)return e.Type.Never();if(f.length===1)return g.Type(f[0],_);f.some($=>s.TTransform($))&&this.Throw("Cannot intersect transform types");let E=f.every($=>s.TObject($)),U=g.Rest(f),P=s.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:g.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||s.TSchema(_.unevaluatedProperties)||E?this.Create({..._,...P,[e.Kind]:"Intersect",type:"object",allOf:U}):this.Create({..._,...P,[e.Kind]:"Intersect",allOf:U})}KeyOf(f,_={}){return s.TRecord(f)?(()=>{let E=Object.getOwnPropertyNames(f.patternProperties)[0];return E===e.PatternNumberExact?this.Number(_):E===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():s.TTuple(f)?(()=>{let U=(i.IsUndefined(f.items)?[]:f.items).map((P,$)=>e.Type.Literal($.toString()));return this.Union(U,_)})():s.TArray(f)?this.Number(_):(()=>{let E=z.ResolveKeys(f,{includePatterns:!1});if(E.length===0)return this.Never(_);let U=E.map(P=>this.Literal(P));return this.Union(U,_)})()}Literal(f,_={}){return this.Create({..._,[e.Kind]:"Literal",const:f,type:typeof f})}Lowercase(f,_={}){return{...I.Map(g.Type(f),"Lowercase"),..._}}Never(f={}){return this.Create({...f,[e.Kind]:"Never",not:{}})}Not(f,_){return this.Create({..._,[e.Kind]:"Not",not:g.Type(f)})}Null(f={}){return this.Create({...f,[e.Kind]:"Null",type:"null"})}Number(f={}){return this.Create({...f,[e.Kind]:"Number",type:"number"})}Object(f,_={}){let E=Object.getOwnPropertyNames(f),U=E.filter(T=>s.TOptional(f[T])),P=E.filter(T=>!U.includes(T)),$=s.TSchema(_.additionalProperties)?{additionalProperties:g.Type(_.additionalProperties)}:{},y=E.reduce((T,w)=>({...T,[w]:g.Type(f[w])}),{});return P.length>0?this.Create({..._,...$,[e.Kind]:"Object",type:"object",properties:y,required:P}):this.Create({..._,...$,[e.Kind]:"Object",type:"object",properties:y})}Omit(f,_,E={}){let U=F.Resolve(_);return S.Map(this.Discard(g.Type(f),["$id",e.Transform]),P=>{i.IsArray(P.required)&&(P.required=P.required.filter($=>!U.includes($)),P.required.length===0&&delete P.required);for(let $ of Object.getOwnPropertyNames(P.properties))U.includes($)&&delete P.properties[$];return this.Create(P)},E)}Partial(f,_={}){return S.Map(this.Discard(g.Type(f),["$id",e.Transform]),E=>{let U=Object.getOwnPropertyNames(E.properties).reduce((P,$)=>({...P,[$]:this.Optional(E.properties[$])}),{});return this.Object(U,this.Discard(E,["required"]))},_)}Pick(f,_,E={}){let U=F.Resolve(_);return S.Map(this.Discard(g.Type(f),["$id",e.Transform]),P=>{i.IsArray(P.required)&&(P.required=P.required.filter($=>U.includes($)),P.required.length===0&&delete P.required);for(let $ of Object.getOwnPropertyNames(P.properties))U.includes($)||delete P.properties[$];return this.Create(P)},E)}Record(f,_,E={}){return s.TTemplateLiteral(f)?(()=>{let U=G.ParseExact(f.pattern);return x.Check(U)?this.Object([...L.Generate(U)].reduce((P,$)=>({...P,[$]:g.Type(_)}),{}),E):this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[f.pattern]:g.Type(_)}})})():s.TUnion(f)?(()=>{let U=k.Resolve(f);if(s.TUnionLiteral(U)){let P=U.anyOf.reduce(($,y)=>({...$,[y.const]:g.Type(_)}),{});return this.Object(P,{...E,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():s.TLiteral(f)?i.IsString(f.const)||i.IsNumber(f.const)?this.Object({[f.const]:g.Type(_)},E):this.Throw("Record key of type literal is not of type string or number"):s.TInteger(f)||s.TNumber(f)?this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:g.Type(_)}}):s.TString(f)?(()=>{let U=i.IsUndefined(f.pattern)?e.PatternStringExact:f.pattern;return this.Create({...E,[e.Kind]:"Record",type:"object",patternProperties:{[U]:g.Type(_)}})})():this.Never()}Recursive(f,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${ae++}`);let E=f({[e.Kind]:"This",$ref:`${_.$id}`});return E.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...E})}Ref(f,_={}){return i.IsString(f)?this.Create({..._,[e.Kind]:"Ref",$ref:f}):(i.IsUndefined(f.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({..._,[e.Kind]:"Ref",$ref:f.$id}))}Required(f,_={}){return S.Map(this.Discard(g.Type(f),["$id",e.Transform]),E=>{let U=Object.getOwnPropertyNames(E.properties).reduce((P,$)=>({...P,[$]:this.Discard(E.properties[$],[e.Optional])}),{});return this.Object(U,E)},_)}Rest(f){return s.TTuple(f)&&!i.IsUndefined(f.items)?g.Rest(f.items):s.TIntersect(f)?g.Rest(f.allOf):s.TUnion(f)?g.Rest(f.anyOf):[]}String(f={}){return this.Create({...f,[e.Kind]:"String",type:"string"})}TemplateLiteral(f,_={}){let E=i.IsString(f)?W.Create(ee.Parse(f)):W.Create(f);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:E})}Transform(f){return new oe(f)}Tuple(f,_={}){let[E,U,P]=[!1,f.length,f.length],$=g.Rest(f),y=f.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:$,additionalItems:E,minItems:U,maxItems:P}:{..._,[e.Kind]:"Tuple",type:"array",minItems:U,maxItems:P};return this.Create(y)}Uncapitalize(f,_={}){return{...I.Map(g.Type(f),"Uncapitalize"),..._}}Union(f,_={}){return s.TTemplateLiteral(f)?j.Resolve(f):(()=>{let E=f;if(E.length===0)return this.Never(_);if(E.length===1)return this.Create(g.Type(E[0],_));let U=g.Rest(E);return this.Create({..._,[e.Kind]:"Union",anyOf:U})})()}Unknown(f={}){return this.Create({...f,[e.Kind]:"Unknown"})}Unsafe(f={}){return this.Create({...f,[e.Kind]:f[e.Kind]||"Unsafe"})}Uppercase(f,_={}){return{...I.Map(g.Type(f),"Uppercase"),..._}}};e.JsonTypeBuilder=Y;var he=class extends Y{AsyncIterator(f,_={}){return this.Create({..._,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:g.Type(f)})}Awaited(f,_={}){let E=U=>U.length>0?(()=>{let[P,...$]=U;return[this.Awaited(P),...E($)]})():U;return s.TIntersect(f)?e.Type.Intersect(E(f.allOf)):s.TUnion(f)?e.Type.Union(E(f.anyOf)):s.TPromise(f)?this.Awaited(f.item):g.Type(f,_)}BigInt(f={}){return this.Create({...f,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(f,_={}){return this.Tuple([...f.parameters],{..._})}Constructor(f,_,E){let[U,P]=[g.Rest(f),g.Type(_)];return this.Create({...E,[e.Kind]:"Constructor",type:"Constructor",parameters:U,returns:P})}Date(f={}){return this.Create({...f,[e.Kind]:"Date",type:"Date"})}Function(f,_,E){let[U,P]=[g.Rest(f),g.Type(_)];return this.Create({...E,[e.Kind]:"Function",type:"Function",parameters:U,returns:P})}InstanceType(f,_={}){return g.Type(f.returns,_)}Iterator(f,_={}){return this.Create({..._,[e.Kind]:"Iterator",type:"Iterator",items:g.Type(f)})}Parameters(f,_={}){return this.Tuple(f.parameters,{..._})}Promise(f,_={}){return this.Create({..._,[e.Kind]:"Promise",type:"Promise",item:g.Type(f)})}RegExp(f,_={}){let E=i.IsString(f)?f:f.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:E})}RegEx(f,_={}){return this.RegExp(f,_)}ReturnType(f,_={}){return g.Type(f.returns,_)}Symbol(f){return this.Create({...f,[e.Kind]:"Symbol",type:"symbol"})}Undefined(f={}){return this.Create({...f,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(f={}){return this.Create({...f,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(f={}){return this.Create({...f,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=he,e.JsonType=new Y,e.Type=new he}}),Tr=St(sn(),1),{String:Gh,Optional:Wh,Boolean:Hh,Object:Jh,Number:Xh}=Tr.Type,Yh=Gh.bind(Tr.Type),Qh=Xh.bind(Tr.Type),kI=Jh.bind(Tr.Type),jI=Wh.bind(Tr.Type),Zh=Hh.bind(Tr.Type),FI=Yh(),zI=Qh(),VI=Zh();function ac(e){return Array.isArray(e)?e:[e]}var ey=Le({"../../../node_modules/.pnpm/browser-or-node@2.1.1/node_modules/browser-or-node/lib/index.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},n=typeof window<"u"&&typeof window.document<"u",r=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,i=(typeof self>"u"?"undefined":t(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",o=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),s=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=n,e.isWebWorker=i,e.isNode=r,e.isJsDom=o,e.isDeno=s}}),ty=Le({"../../../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js"(e,t){"use strict";t.exports=function(n,r){r||(r={}),typeof r=="function"&&(r={cmp:r});var i=typeof r.cycles=="boolean"?r.cycles:!1,o=r.cmp&&function(a){return function(l){return function(c,d){var g={key:c,value:l[c]},C={key:d,value:l[d]};return a(g,C)}}}(r.cmp),s=[];return function a(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var c,d;if(Array.isArray(l)){for(d="[",c=0;c<l.length;c++)c&&(d+=","),d+=a(l[c])||"null";return d+"]"}if(l===null)return"null";if(s.indexOf(l)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var g=s.push(l)-1,C=Object.keys(l).sort(o&&o(l));for(d="",c=0;c<C.length;c++){var I=C[c],S=a(l[I]);S&&(d&&(d+=","),d+=JSON.stringify(I)+":"+S)}return s.splice(g,1),"{"+d+"}"}}(n)}}}),ny=Le({"../../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:n}=Object.prototype,r=F();r.configure=F,r.stringify=r,r.default=r,e.stringify=r,e.configure=F,t.exports=r;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(k){return k.length<5e3&&!i.test(k)?`"${k}"`:JSON.stringify(k)}function s(k,K){if(k.length>200||K)return k.sort(K);for(let W=1;W<k.length;W++){let j=k[W],Z=W;for(;Z!==0&&k[Z-1]>j;)k[Z]=k[Z-1],Z--;k[Z]=j}return k}var a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(k){return a.call(k)!==void 0&&k.length!==0}function c(k,K,W){k.length<W&&(W=k.length);let j=K===","?"":" ",Z=`"0":${j}${k[0]}`;for(let G=1;G<W;G++)Z+=`${K}"${G}":${j}${k[G]}`;return Z}function d(k){if(n.call(k,"circularValue")){let K=k.circularValue;if(typeof K=="string")return`"${K}"`;if(K==null)return K;if(K===Error||K===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function g(k){let K;if(n.call(k,"deterministic")&&(K=k.deterministic,typeof K!="boolean"&&typeof K!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return K===void 0?!0:K}function C(k,K){let W;if(n.call(k,K)&&(W=k[K],typeof W!="boolean"))throw new TypeError(`The "${K}" argument must be of type boolean`);return W===void 0?!0:W}function I(k,K){let W;if(n.call(k,K)){if(W=k[K],typeof W!="number")throw new TypeError(`The "${K}" argument must be of type number`);if(!Number.isInteger(W))throw new TypeError(`The "${K}" argument must be an integer`);if(W<1)throw new RangeError(`The "${K}" argument must be >= 1`)}return W===void 0?1/0:W}function S(k){return k===1?"1 item":`${k} items`}function z(k){let K=new Set;for(let W of k)(typeof W=="string"||typeof W=="number")&&K.add(String(W));return K}function J(k){if(n.call(k,"strict")){let K=k.strict;if(typeof K!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(K)return W=>{let j=`Object can not safely be stringified. Received type ${typeof W}`;throw typeof W!="function"&&(j+=` (${W.toString()})`),new Error(j)}}}function F(k){k={...k};let K=J(k);K&&(k.bigint===void 0&&(k.bigint=!1),"circularValue"in k||(k.circularValue=Error));let W=d(k),j=C(k,"bigint"),Z=g(k),G=typeof Z=="function"?Z:void 0,fe=I(k,"maximumDepth"),x=I(k,"maximumBreadth");function M(ae,D,H,Y,he,f){let _=D[ae];switch(typeof _=="object"&&_!==null&&typeof _.toJSON=="function"&&(_=_.toJSON(ae)),_=Y.call(D,ae,_),typeof _){case"string":return o(_);case"object":{if(_===null)return"null";if(H.indexOf(_)!==-1)return W;let E="",U=",",P=f;if(Array.isArray(_)){if(_.length===0)return"[]";if(fe<H.length+1)return'"[Array]"';H.push(_),he!==""&&(f+=he,E+=`
|
|
31
31
|
${f}`,U=`,
|
|
32
|
-
${f}`);let A=Math.min(_.length,x),b=0;for(;b<A-1;b++){let
|
|
33
|
-
${P}`),H.pop(),`[${E}]`}let
|
|
34
|
-
${f}`,T=" ");let u=Math.min(y,x);Z&&!l(_)&&(
|
|
32
|
+
${f}`);let A=Math.min(_.length,x),b=0;for(;b<A-1;b++){let N=M(String(b),_,H,Y,he,f);E+=N!==void 0?N:"null",E+=U}let v=M(String(b),_,H,Y,he,f);if(E+=v!==void 0?v:"null",_.length-1>x){let N=_.length-x-1;E+=`${U}"... ${S(N)} not stringified"`}return he!==""&&(E+=`
|
|
33
|
+
${P}`),H.pop(),`[${E}]`}let $=Object.keys(_),y=$.length;if(y===0)return"{}";if(fe<H.length+1)return'"[Object]"';let T="",w="";he!==""&&(f+=he,U=`,
|
|
34
|
+
${f}`,T=" ");let u=Math.min(y,x);Z&&!l(_)&&($=s($,G)),H.push(_);for(let A=0;A<u;A++){let b=$[A],v=M(b,_,H,Y,he,f);v!==void 0&&(E+=`${w}${o(b)}:${T}${v}`,w=U)}if(y>x){let A=y-x;E+=`${w}"...":${T}"${S(A)} not stringified"`,w=U}return he!==""&&w.length>1&&(E=`
|
|
35
35
|
${f}${E}
|
|
36
|
-
${P}`),H.pop(),`{${E}}`}case"number":return isFinite(_)?String(_):
|
|
36
|
+
${P}`),H.pop(),`{${E}}`}case"number":return isFinite(_)?String(_):K?K(_):"null";case"boolean":return _===!0?"true":"false";case"undefined":return;case"bigint":if(j)return String(_);default:return K?K(_):void 0}}function L(ae,D,H,Y,he,f){switch(typeof D=="object"&&D!==null&&typeof D.toJSON=="function"&&(D=D.toJSON(ae)),typeof D){case"string":return o(D);case"object":{if(D===null)return"null";if(H.indexOf(D)!==-1)return W;let _=f,E="",U=",";if(Array.isArray(D)){if(D.length===0)return"[]";if(fe<H.length+1)return'"[Array]"';H.push(D),he!==""&&(f+=he,E+=`
|
|
37
37
|
${f}`,U=`,
|
|
38
38
|
${f}`);let y=Math.min(D.length,x),T=0;for(;T<y-1;T++){let u=L(String(T),D[T],H,Y,he,f);E+=u!==void 0?u:"null",E+=U}let w=L(String(T),D[T],H,Y,he,f);if(E+=w!==void 0?w:"null",D.length-1>x){let u=D.length-x-1;E+=`${U}"... ${S(u)} not stringified"`}return he!==""&&(E+=`
|
|
39
39
|
${_}`),H.pop(),`[${E}]`}H.push(D);let P="";he!==""&&(f+=he,U=`,
|
|
40
|
-
${f}`,P=" ");let
|
|
40
|
+
${f}`,P=" ");let $="";for(let y of Y){let T=L(y,D[y],H,Y,he,f);T!==void 0&&(E+=`${$}${o(y)}:${P}${T}`,$=U)}return he!==""&&$.length>1&&(E=`
|
|
41
41
|
${f}${E}
|
|
42
|
-
${_}`),H.pop(),`{${E}}`}case"number":return isFinite(D)?String(D):
|
|
42
|
+
${_}`),H.pop(),`{${E}}`}case"number":return isFinite(D)?String(D):K?K(D):"null";case"boolean":return D===!0?"true":"false";case"undefined":return;case"bigint":if(j)return String(D);default:return K?K(D):void 0}}function ee(ae,D,H,Y,he){switch(typeof D){case"string":return o(D);case"object":{if(D===null)return"null";if(typeof D.toJSON=="function"){if(D=D.toJSON(ae),typeof D!="object")return ee(ae,D,H,Y,he);if(D===null)return"null"}if(H.indexOf(D)!==-1)return W;let f=he;if(Array.isArray(D)){if(D.length===0)return"[]";if(fe<H.length+1)return'"[Array]"';H.push(D),he+=Y;let T=`
|
|
43
43
|
${he}`,w=`,
|
|
44
44
|
${he}`,u=Math.min(D.length,x),A=0;for(;A<u-1;A++){let v=ee(String(A),D[A],H,Y,he);T+=v!==void 0?v:"null",T+=w}let b=ee(String(A),D[A],H,Y,he);if(T+=b!==void 0?b:"null",D.length-1>x){let v=D.length-x-1;T+=`${w}"... ${S(v)} not stringified"`}return T+=`
|
|
45
45
|
${f}`,H.pop(),`[${T}]`}let _=Object.keys(D),E=_.length;if(E===0)return"{}";if(fe<H.length+1)return'"[Object]"';he+=Y;let U=`,
|
|
46
|
-
${he}`,P=""
|
|
46
|
+
${he}`,P="",$="",y=Math.min(E,x);l(D)&&(P+=c(D,U,x),_=_.slice(D.length),y-=D.length,$=U),Z&&(_=s(_,G)),H.push(D);for(let T=0;T<y;T++){let w=_[T],u=ee(w,D[w],H,Y,he);u!==void 0&&(P+=`${$}${o(w)}: ${u}`,$=U)}if(E>x){let T=E-x;P+=`${$}"...": "${S(T)} not stringified"`,$=U}return $!==""&&(P=`
|
|
47
47
|
${he}${P}
|
|
48
|
-
${f}`),H.pop(),`{${P}}`}case"number":return isFinite(D)?String(D):z?z(D):"null";case"boolean":return D===!0?"true":"false";case"undefined":return;case"bigint":if(j)return String(D);default:return z?z(D):void 0}}function oe(ae,D,H){switch(typeof D){case"string":return o(D);case"object":{if(D===null)return"null";if(typeof D.toJSON=="function"){if(D=D.toJSON(ae),typeof D!="object")return oe(ae,D,H);if(D===null)return"null"}if(H.indexOf(D)!==-1)return W;let Y="",he=D.length!==void 0;if(he&&Array.isArray(D)){if(D.length===0)return"[]";if(fe<H.length+1)return'"[Array]"';H.push(D);let P=Math.min(D.length,x),N=0;for(;N<P-1;N++){let T=oe(String(N),D[N],H);Y+=T!==void 0?T:"null",Y+=","}let y=oe(String(N),D[N],H);if(Y+=y!==void 0?y:"null",D.length-1>x){let T=D.length-x-1;Y+=`,"... ${S(T)} not stringified"`}return H.pop(),`[${Y}]`}let f=Object.keys(D),_=f.length;if(_===0)return"{}";if(fe<H.length+1)return'"[Object]"';let E="",U=Math.min(_,x);he&&l(D)&&(Y+=c(D,",",x),f=f.slice(D.length),U-=D.length,E=","),Z&&(f=s(f,G)),H.push(D);for(let P=0;P<U;P++){let N=f[P],y=oe(N,D[N],H);y!==void 0&&(Y+=`${E}${o(N)}:${y}`,E=",")}if(_>x){let P=_-x;Y+=`${E}"...":"${S(P)} not stringified"`}return H.pop(),`{${Y}}`}case"number":return isFinite(D)?String(D):z?z(D):"null";case"boolean":return D===!0?"true":"false";case"undefined":return;case"bigint":if(j)return String(D);default:return z?z(D):void 0}}function Q(ae,D,H){if(arguments.length>1){let Y="";if(typeof H=="number"?Y=" ".repeat(Math.min(H,10)):typeof H=="string"&&(Y=H.slice(0,10)),D!=null){if(typeof D=="function")return M("",{"":ae},[],D,Y,"");if(Array.isArray(D))return L("",ae,[],V(D),Y,"")}if(Y.length!==0)return ee("",ae,[],Y,"")}return oe("",ae,[])}return Q}}}),Or=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/guard.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IsValueType=e.IsSymbol=e.IsFunction=e.IsString=e.IsBigInt=e.IsInteger=e.IsNumber=e.IsBoolean=e.IsNull=e.IsUndefined=e.IsArray=e.IsObject=e.IsPlainObject=e.HasPropertyKey=e.IsDate=e.IsUint8Array=e.IsPromise=e.IsTypedArray=e.IsIterator=e.IsAsyncIterator=void 0;function t(j){return c(j)&&Symbol.asyncIterator in j}e.IsAsyncIterator=t;function n(j){return c(j)&&Symbol.iterator in j}e.IsIterator=n;function r(j){return ArrayBuffer.isView(j)}e.IsTypedArray=r;function i(j){return j instanceof Promise}e.IsPromise=i;function o(j){return j instanceof Uint8Array}e.IsUint8Array=o;function s(j){return j instanceof Date&&Number.isFinite(j.getTime())}e.IsDate=s;function a(j,Z){return Z in j}e.HasPropertyKey=a;function l(j){return c(j)&&k(j.constructor)&&j.constructor.name==="Object"}e.IsPlainObject=l;function c(j){return j!==null&&typeof j=="object"}e.IsObject=c;function d(j){return Array.isArray(j)&&!ArrayBuffer.isView(j)}e.IsArray=d;function g(j){return j===void 0}e.IsUndefined=g;function C(j){return j===null}e.IsNull=C;function I(j){return typeof j=="boolean"}e.IsBoolean=I;function S(j){return typeof j=="number"}e.IsNumber=S;function V(j){return S(j)&&Number.isInteger(j)}e.IsInteger=V;function J(j){return typeof j=="bigint"}e.IsBigInt=J;function F(j){return typeof j=="string"}e.IsString=F;function k(j){return typeof j=="function"}e.IsFunction=k;function z(j){return typeof j=="symbol"}e.IsSymbol=z;function W(j){return J(j)||I(j)||C(j)||S(j)||F(j)||z(j)||g(j)}e.IsValueType=W}}),gl=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/system.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultErrorFunction=e.TypeSystemPolicy=e.TypeSystemErrorFunction=e.TypeSystem=e.TypeSystemDuplicateFormat=e.TypeSystemDuplicateTypeKind=void 0;var t=Or(),n=_o(),r=rn(),i=class extends r.TypeBoxError{constructor(d){super(`Duplicate type kind '${d}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends r.TypeBoxError{constructor(d){super(`Duplicate string format '${d}' detected`)}};e.TypeSystemDuplicateFormat=o;var s;(function(d){function g(I,S){if(r.TypeRegistry.Has(I))throw new i(I);return r.TypeRegistry.Set(I,S),(V={})=>r.Type.Unsafe({...V,[r.Kind]:I})}d.Type=g;function C(I,S){if(r.FormatRegistry.Has(I))throw new o(I);return r.FormatRegistry.Set(I,S),I}d.Format=C})(s||(e.TypeSystem=s={}));var a;(function(d){let g=c;function C(){g=c}d.Reset=C;function I(V){g=V}d.Set=I;function S(){return g}d.Get=S})(a||(e.TypeSystemErrorFunction=a={}));var l;(function(d){d.ExactOptionalPropertyTypes=!1,d.AllowArrayObject=!1,d.AllowNaN=!1,d.AllowNullVoid=!1;function g(J,F){return d.ExactOptionalPropertyTypes?F in J:J[F]!==void 0}d.IsExactOptionalProperty=g;function C(J){let F=(0,t.IsObject)(J);return d.AllowArrayObject?F:F&&!(0,t.IsArray)(J)}d.IsObjectLike=C;function I(J){return C(J)&&!(J instanceof Date)&&!(J instanceof Uint8Array)}d.IsRecordLike=I;function S(J){let F=(0,t.IsNumber)(J);return d.AllowNaN?F:F&&Number.isFinite(J)}d.IsNumberLike=S;function V(J){let F=(0,t.IsUndefined)(J);return d.AllowNullVoid?F||J===null:F}d.IsVoidLike=V})(l||(e.TypeSystemPolicy=l={}));function c(d,g){switch(g){case n.ValueErrorType.ArrayContains:return"Expected array to contain at least one matching value";case n.ValueErrorType.ArrayMaxContains:return`Expected array to contain no more than ${d.maxContains} matching values`;case n.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${d.minContains} matching values`;case n.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${d.maxItems}`;case n.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${d.minItems}`;case n.ValueErrorType.ArrayUniqueItems:return"Expected array elements to be unique";case n.ValueErrorType.Array:return"Expected array";case n.ValueErrorType.AsyncIterator:return"Expected AsyncIterator";case n.ValueErrorType.BigIntExclusiveMaximum:return`Expected bigint to be less than ${d.exclusiveMaximum}`;case n.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${d.exclusiveMinimum}`;case n.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${d.maximum}`;case n.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${d.minimum}`;case n.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${d.multipleOf}`;case n.ValueErrorType.BigInt:return"Expected bigint";case n.ValueErrorType.Boolean:return"Expected boolean";case n.ValueErrorType.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${d.exclusiveMinimumTimestamp}`;case n.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${d.exclusiveMaximumTimestamp}`;case n.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${d.minimumTimestamp}`;case n.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${d.maximumTimestamp}`;case n.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${d.multipleOfTimestamp}`;case n.ValueErrorType.Date:return"Expected Date";case n.ValueErrorType.Function:return"Expected function";case n.ValueErrorType.IntegerExclusiveMaximum:return`Expected integer to be less than ${d.exclusiveMaximum}`;case n.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${d.exclusiveMinimum}`;case n.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${d.maximum}`;case n.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${d.minimum}`;case n.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${d.multipleOf}`;case n.ValueErrorType.Integer:return"Expected integer";case n.ValueErrorType.IntersectUnevaluatedProperties:return"Unexpected property";case n.ValueErrorType.Intersect:return"Expected all values to match";case n.ValueErrorType.Iterator:return"Expected Iterator";case n.ValueErrorType.Literal:return`Expected ${typeof d.const=="string"?`'${d.const}'`:d.const}`;case n.ValueErrorType.Never:return"Never";case n.ValueErrorType.Not:return"Value should not match";case n.ValueErrorType.Null:return"Expected null";case n.ValueErrorType.NumberExclusiveMaximum:return`Expected number to be less than ${d.exclusiveMaximum}`;case n.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${d.exclusiveMinimum}`;case n.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${d.maximum}`;case n.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${d.minimum}`;case n.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${d.multipleOf}`;case n.ValueErrorType.Number:return"Expected number";case n.ValueErrorType.Object:return"Expected object";case n.ValueErrorType.ObjectAdditionalProperties:return"Unexpected property";case n.ValueErrorType.ObjectMaxProperties:return`Expected object to have no more than ${d.maxProperties} properties`;case n.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${d.minProperties} properties`;case n.ValueErrorType.ObjectRequiredProperty:return"Required property";case n.ValueErrorType.Promise:return"Expected Promise";case n.ValueErrorType.StringFormatUnknown:return`Unknown format '${d.format}'`;case n.ValueErrorType.StringFormat:return`Expected string to match '${d.format}' format`;case n.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${d.maxLength}`;case n.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${d.minLength}`;case n.ValueErrorType.StringPattern:return`Expected string to match '${d.pattern}'`;case n.ValueErrorType.String:return"Expected string";case n.ValueErrorType.Symbol:return"Expected symbol";case n.ValueErrorType.TupleLength:return`Expected tuple to have ${d.maxItems||0} elements`;case n.ValueErrorType.Tuple:return"Expected tuple";case n.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${d.maxByteLength}`;case n.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${d.minByteLength}`;case n.ValueErrorType.Uint8Array:return"Expected Uint8Array";case n.ValueErrorType.Undefined:return"Expected undefined";case n.ValueErrorType.Union:return"Expected union value";case n.ValueErrorType.Void:return"Expected void";case n.ValueErrorType.Kind:return`Expected kind '${d[r.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=c}}),bo=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/deref.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=rn(),n=class extends t.TypeBoxError{constructor(i){super(`Unable to dereference schema with $id '${i.$id}'`),this.schema=i}};e.TypeDereferenceError=n;function r(i,o){let s=o.findIndex(a=>a.$id===i.$ref);if(s===-1)throw new n(i);return o[s]}e.Deref=r}}),Hs=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/hash.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=Or(),n=class extends Error{constructor(M){super("Unable to hash value"),this.value=M}};e.ValueHashError=n;var r;(function(M){M[M.Undefined=0]="Undefined",M[M.Null=1]="Null",M[M.Boolean=2]="Boolean",M[M.Number=3]="Number",M[M.String=4]="String",M[M.Object=5]="Object",M[M.Array=6]="Array",M[M.Date=7]="Date",M[M.Uint8Array=8]="Uint8Array",M[M.Symbol=9]="Symbol",M[M.BigInt=10]="BigInt"})(r||(e.ByteMarker=r={}));var i=BigInt("14695981039346656037"),[o,s]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],a=Array.from({length:256}).map((M,L)=>BigInt(L)),l=new Float64Array(1),c=new DataView(l.buffer),d=new Uint8Array(l.buffer);function*g(M){let L=M===0?1:Math.ceil(Math.floor(Math.log2(M)+1)/8);for(let ee=0;ee<L;ee++)yield M>>8*(L-1-ee)&255}function C(M){fe(r.Array);for(let L of M)G(L)}function I(M){fe(r.Boolean),fe(M?1:0)}function S(M){fe(r.BigInt),c.setBigInt64(0,M);for(let L of d)fe(L)}function V(M){fe(r.Date),G(M.getTime())}function J(M){fe(r.Null)}function F(M){fe(r.Number),c.setFloat64(0,M);for(let L of d)fe(L)}function k(M){fe(r.Object);for(let L of globalThis.Object.keys(M).sort())G(L),G(M[L])}function z(M){fe(r.String);for(let L=0;L<M.length;L++)for(let ee of g(M.charCodeAt(L)))fe(ee)}function W(M){fe(r.Symbol),G(M.description)}function j(M){fe(r.Uint8Array);for(let L=0;L<M.length;L++)fe(M[L])}function Z(M){return fe(r.Undefined)}function G(M){if((0,t.IsArray)(M))return C(M);if((0,t.IsBoolean)(M))return I(M);if((0,t.IsBigInt)(M))return S(M);if((0,t.IsDate)(M))return V(M);if((0,t.IsNull)(M))return J(M);if((0,t.IsNumber)(M))return F(M);if((0,t.IsPlainObject)(M))return k(M);if((0,t.IsString)(M))return z(M);if((0,t.IsSymbol)(M))return W(M);if((0,t.IsUint8Array)(M))return j(M);if((0,t.IsUndefined)(M))return Z(M);throw new n(M)}function fe(M){i=i^a[M],i=i*o%s}function x(M){return i=BigInt("14695981039346656037"),G(M),i}e.Hash=x}}),_o=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=Or(),n=gl(),r=bo(),i=Hs(),o=rn(),s;(function(u){u[u.ArrayContains=0]="ArrayContains",u[u.ArrayMaxContains=1]="ArrayMaxContains",u[u.ArrayMaxItems=2]="ArrayMaxItems",u[u.ArrayMinContains=3]="ArrayMinContains",u[u.ArrayMinItems=4]="ArrayMinItems",u[u.ArrayUniqueItems=5]="ArrayUniqueItems",u[u.Array=6]="Array",u[u.AsyncIterator=7]="AsyncIterator",u[u.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",u[u.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",u[u.BigIntMaximum=10]="BigIntMaximum",u[u.BigIntMinimum=11]="BigIntMinimum",u[u.BigIntMultipleOf=12]="BigIntMultipleOf",u[u.BigInt=13]="BigInt",u[u.Boolean=14]="Boolean",u[u.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",u[u.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",u[u.DateMaximumTimestamp=17]="DateMaximumTimestamp",u[u.DateMinimumTimestamp=18]="DateMinimumTimestamp",u[u.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",u[u.Date=20]="Date",u[u.Function=21]="Function",u[u.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",u[u.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",u[u.IntegerMaximum=24]="IntegerMaximum",u[u.IntegerMinimum=25]="IntegerMinimum",u[u.IntegerMultipleOf=26]="IntegerMultipleOf",u[u.Integer=27]="Integer",u[u.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",u[u.Intersect=29]="Intersect",u[u.Iterator=30]="Iterator",u[u.Kind=31]="Kind",u[u.Literal=32]="Literal",u[u.Never=33]="Never",u[u.Not=34]="Not",u[u.Null=35]="Null",u[u.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",u[u.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",u[u.NumberMaximum=38]="NumberMaximum",u[u.NumberMinimum=39]="NumberMinimum",u[u.NumberMultipleOf=40]="NumberMultipleOf",u[u.Number=41]="Number",u[u.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",u[u.ObjectMaxProperties=43]="ObjectMaxProperties",u[u.ObjectMinProperties=44]="ObjectMinProperties",u[u.ObjectRequiredProperty=45]="ObjectRequiredProperty",u[u.Object=46]="Object",u[u.Promise=47]="Promise",u[u.StringFormatUnknown=48]="StringFormatUnknown",u[u.StringFormat=49]="StringFormat",u[u.StringMaxLength=50]="StringMaxLength",u[u.StringMinLength=51]="StringMinLength",u[u.StringPattern=52]="StringPattern",u[u.String=53]="String",u[u.Symbol=54]="Symbol",u[u.TupleLength=55]="TupleLength",u[u.Tuple=56]="Tuple",u[u.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",u[u.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",u[u.Uint8Array=59]="Uint8Array",u[u.Undefined=60]="Undefined",u[u.Union=61]="Union",u[u.Void=62]="Void"})(s||(e.ValueErrorType=s={}));var a=class extends o.TypeBoxError{constructor(u){super("Unknown type"),this.schema=u}};e.ValueErrorsUnknownTypeError=a;function l(u){return u.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=l;function c(u){return u!==void 0}var d=class{constructor(u){this.iterator=u}[Symbol.iterator](){return this.iterator}First(){let u=this.iterator.next();return u.done?void 0:u.value}};e.ValueErrorIterator=d;function g(u,A,b,v){return{type:u,schema:A,path:b,value:v,message:n.TypeSystemErrorFunction.Get()(A,u)}}function*C(u,A,b,v){}function*I(u,A,b,v){if(!(0,t.IsArray)(v))return yield g(s.Array,u,b,v);c(u.minItems)&&!(v.length>=u.minItems)&&(yield g(s.ArrayMinItems,u,b,v)),c(u.maxItems)&&!(v.length<=u.maxItems)&&(yield g(s.ArrayMaxItems,u,b,v));for(let te=0;te<v.length;te++)yield*T(u.items,A,`${b}/${te}`,v[te]);if(u.uniqueItems===!0&&!function(){let te=new Set;for(let ne of v){let ge=(0,i.Hash)(ne);if(te.has(ge))return!1;te.add(ge)}return!0}()&&(yield g(s.ArrayUniqueItems,u,b,v)),!(c(u.contains)||c(u.minContains)||c(u.maxContains)))return;let $=c(u.contains)?u.contains:o.Type.Never(),q=v.reduce((te,ne,ge)=>T($,A,`${b}${ge}`,ne).next().done===!0?te+1:te,0);q===0&&(yield g(s.ArrayContains,u,b,v)),(0,t.IsNumber)(u.minContains)&&q<u.minContains&&(yield g(s.ArrayMinContains,u,b,v)),(0,t.IsNumber)(u.maxContains)&&q>u.maxContains&&(yield g(s.ArrayMaxContains,u,b,v))}function*S(u,A,b,v){(0,t.IsAsyncIterator)(v)||(yield g(s.AsyncIterator,u,b,v))}function*V(u,A,b,v){if(!(0,t.IsBigInt)(v))return yield g(s.BigInt,u,b,v);c(u.exclusiveMaximum)&&!(v<u.exclusiveMaximum)&&(yield g(s.BigIntExclusiveMaximum,u,b,v)),c(u.exclusiveMinimum)&&!(v>u.exclusiveMinimum)&&(yield g(s.BigIntExclusiveMinimum,u,b,v)),c(u.maximum)&&!(v<=u.maximum)&&(yield g(s.BigIntMaximum,u,b,v)),c(u.minimum)&&!(v>=u.minimum)&&(yield g(s.BigIntMinimum,u,b,v)),c(u.multipleOf)&&v%u.multipleOf!==BigInt(0)&&(yield g(s.BigIntMultipleOf,u,b,v))}function*J(u,A,b,v){(0,t.IsBoolean)(v)||(yield g(s.Boolean,u,b,v))}function*F(u,A,b,v){yield*T(u.returns,A,b,v.prototype)}function*k(u,A,b,v){if(!(0,t.IsDate)(v))return yield g(s.Date,u,b,v);c(u.exclusiveMaximumTimestamp)&&!(v.getTime()<u.exclusiveMaximumTimestamp)&&(yield g(s.DateExclusiveMaximumTimestamp,u,b,v)),c(u.exclusiveMinimumTimestamp)&&!(v.getTime()>u.exclusiveMinimumTimestamp)&&(yield g(s.DateExclusiveMinimumTimestamp,u,b,v)),c(u.maximumTimestamp)&&!(v.getTime()<=u.maximumTimestamp)&&(yield g(s.DateMaximumTimestamp,u,b,v)),c(u.minimumTimestamp)&&!(v.getTime()>=u.minimumTimestamp)&&(yield g(s.DateMinimumTimestamp,u,b,v)),c(u.multipleOfTimestamp)&&v.getTime()%u.multipleOfTimestamp!==0&&(yield g(s.DateMultipleOfTimestamp,u,b,v))}function*z(u,A,b,v){(0,t.IsFunction)(v)||(yield g(s.Function,u,b,v))}function*W(u,A,b,v){if(!(0,t.IsInteger)(v))return yield g(s.Integer,u,b,v);c(u.exclusiveMaximum)&&!(v<u.exclusiveMaximum)&&(yield g(s.IntegerExclusiveMaximum,u,b,v)),c(u.exclusiveMinimum)&&!(v>u.exclusiveMinimum)&&(yield g(s.IntegerExclusiveMinimum,u,b,v)),c(u.maximum)&&!(v<=u.maximum)&&(yield g(s.IntegerMaximum,u,b,v)),c(u.minimum)&&!(v>=u.minimum)&&(yield g(s.IntegerMinimum,u,b,v)),c(u.multipleOf)&&v%u.multipleOf!==0&&(yield g(s.IntegerMultipleOf,u,b,v))}function*j(u,A,b,v){for(let $ of u.allOf){let q=T($,A,b,v).next();q.done||(yield g(s.Intersect,u,b,v),yield q.value)}if(u.unevaluatedProperties===!1){let $=new RegExp(o.KeyResolver.ResolvePattern(u));for(let q of Object.getOwnPropertyNames(v))$.test(q)||(yield g(s.IntersectUnevaluatedProperties,u,`${b}/${q}`,v))}if(typeof u.unevaluatedProperties=="object"){let $=new RegExp(o.KeyResolver.ResolvePattern(u));for(let q of Object.getOwnPropertyNames(v))if(!$.test(q)){let te=T(u.unevaluatedProperties,A,`${b}/${q}`,v[q]).next();te.done||(yield te.value)}}}function*Z(u,A,b,v){(0,t.IsIterator)(v)||(yield g(s.Iterator,u,b,v))}function*G(u,A,b,v){v!==u.const&&(yield g(s.Literal,u,b,v))}function*fe(u,A,b,v){yield g(s.Never,u,b,v)}function*x(u,A,b,v){T(u.not,A,b,v).next().done===!0&&(yield g(s.Not,u,b,v))}function*M(u,A,b,v){(0,t.IsNull)(v)||(yield g(s.Null,u,b,v))}function*L(u,A,b,v){if(!n.TypeSystemPolicy.IsNumberLike(v))return yield g(s.Number,u,b,v);c(u.exclusiveMaximum)&&!(v<u.exclusiveMaximum)&&(yield g(s.NumberExclusiveMaximum,u,b,v)),c(u.exclusiveMinimum)&&!(v>u.exclusiveMinimum)&&(yield g(s.NumberExclusiveMinimum,u,b,v)),c(u.maximum)&&!(v<=u.maximum)&&(yield g(s.NumberMaximum,u,b,v)),c(u.minimum)&&!(v>=u.minimum)&&(yield g(s.NumberMinimum,u,b,v)),c(u.multipleOf)&&v%u.multipleOf!==0&&(yield g(s.NumberMultipleOf,u,b,v))}function*ee(u,A,b,v){if(!n.TypeSystemPolicy.IsObjectLike(v))return yield g(s.Object,u,b,v);c(u.minProperties)&&!(Object.getOwnPropertyNames(v).length>=u.minProperties)&&(yield g(s.ObjectMinProperties,u,b,v)),c(u.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=u.maxProperties)&&(yield g(s.ObjectMaxProperties,u,b,v));let $=Array.isArray(u.required)?u.required:[],q=Object.getOwnPropertyNames(u.properties),te=Object.getOwnPropertyNames(v);for(let ne of $)te.includes(ne)||(yield g(s.ObjectRequiredProperty,u.properties[ne],`${b}/${l(ne)}`,void 0));if(u.additionalProperties===!1)for(let ne of te)q.includes(ne)||(yield g(s.ObjectAdditionalProperties,u,`${b}/${l(ne)}`,v[ne]));if(typeof u.additionalProperties=="object")for(let ne of te)q.includes(ne)||(yield*T(u.additionalProperties,A,`${b}/${l(ne)}`,v[ne]));for(let ne of q){let ge=u.properties[ne];u.required&&u.required.includes(ne)?(yield*T(ge,A,`${b}/${l(ne)}`,v[ne]),o.ExtendsUndefined.Check(u)&&!(ne in v)&&(yield g(s.ObjectRequiredProperty,ge,`${b}/${l(ne)}`,void 0))):n.TypeSystemPolicy.IsExactOptionalProperty(v,ne)&&(yield*T(ge,A,`${b}/${l(ne)}`,v[ne]))}}function*oe(u,A,b,v){(0,t.IsPromise)(v)||(yield g(s.Promise,u,b,v))}function*Q(u,A,b,v){if(!n.TypeSystemPolicy.IsRecordLike(v))return yield g(s.Object,u,b,v);c(u.minProperties)&&!(Object.getOwnPropertyNames(v).length>=u.minProperties)&&(yield g(s.ObjectMinProperties,u,b,v)),c(u.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=u.maxProperties)&&(yield g(s.ObjectMaxProperties,u,b,v));let[$,q]=Object.entries(u.patternProperties)[0],te=new RegExp($);for(let[ne,ge]of Object.entries(v))te.test(ne)&&(yield*T(q,A,`${b}/${l(ne)}`,ge));if(typeof u.additionalProperties=="object")for(let[ne,ge]of Object.entries(v))te.test(ne)||(yield*T(u.additionalProperties,A,`${b}/${l(ne)}`,ge));if(u.additionalProperties===!1){for(let[ne,ge]of Object.entries(v))if(!te.test(ne))return yield g(s.ObjectAdditionalProperties,u,`${b}/${l(ne)}`,ge)}}function*ae(u,A,b,v){yield*T((0,r.Deref)(u,A),A,b,v)}function*D(u,A,b,v){if(!(0,t.IsString)(v))return yield g(s.String,u,b,v);c(u.minLength)&&!(v.length>=u.minLength)&&(yield g(s.StringMinLength,u,b,v)),c(u.maxLength)&&!(v.length<=u.maxLength)&&(yield g(s.StringMaxLength,u,b,v)),(0,t.IsString)(u.pattern)&&(new RegExp(u.pattern).test(v)||(yield g(s.StringPattern,u,b,v))),(0,t.IsString)(u.format)&&(o.FormatRegistry.Has(u.format)?o.FormatRegistry.Get(u.format)(v)||(yield g(s.StringFormat,u,b,v)):yield g(s.StringFormatUnknown,u,b,v))}function*H(u,A,b,v){(0,t.IsSymbol)(v)||(yield g(s.Symbol,u,b,v))}function*Y(u,A,b,v){if(!(0,t.IsString)(v))return yield g(s.String,u,b,v);new RegExp(u.pattern).test(v)||(yield g(s.StringPattern,u,b,v))}function*he(u,A,b,v){yield*T((0,r.Deref)(u,A),A,b,v)}function*f(u,A,b,v){if(!(0,t.IsArray)(v))return yield g(s.Tuple,u,b,v);if(u.items===void 0&&v.length!==0)return yield g(s.TupleLength,u,b,v);if(v.length!==u.maxItems)return yield g(s.TupleLength,u,b,v);if(u.items)for(let $=0;$<u.items.length;$++)yield*T(u.items[$],A,`${b}/${$}`,v[$])}function*_(u,A,b,v){(0,t.IsUndefined)(v)||(yield g(s.Undefined,u,b,v))}function*E(u,A,b,v){let $=0;for(let q of u.anyOf){let te=[...T(q,A,b,v)];if(te.length===0)return;$+=te.length}$>0&&(yield g(s.Union,u,b,v))}function*U(u,A,b,v){if(!(0,t.IsUint8Array)(v))return yield g(s.Uint8Array,u,b,v);c(u.maxByteLength)&&!(v.length<=u.maxByteLength)&&(yield g(s.Uint8ArrayMaxByteLength,u,b,v)),c(u.minByteLength)&&!(v.length>=u.minByteLength)&&(yield g(s.Uint8ArrayMinByteLength,u,b,v))}function*P(u,A,b,v){}function*N(u,A,b,v){n.TypeSystemPolicy.IsVoidLike(v)||(yield g(s.Void,u,b,v))}function*y(u,A,b,v){o.TypeRegistry.Get(u[o.Kind])(u,v)||(yield g(s.Kind,u,b,v))}function*T(u,A,b,v){let $=c(u.$id)?[...A,u]:A,q=u;switch(q[o.Kind]){case"Any":return yield*C(q,$,b,v);case"Array":return yield*I(q,$,b,v);case"AsyncIterator":return yield*S(q,$,b,v);case"BigInt":return yield*V(q,$,b,v);case"Boolean":return yield*J(q,$,b,v);case"Constructor":return yield*F(q,$,b,v);case"Date":return yield*k(q,$,b,v);case"Function":return yield*z(q,$,b,v);case"Integer":return yield*W(q,$,b,v);case"Intersect":return yield*j(q,$,b,v);case"Iterator":return yield*Z(q,$,b,v);case"Literal":return yield*G(q,$,b,v);case"Never":return yield*fe(q,$,b,v);case"Not":return yield*x(q,$,b,v);case"Null":return yield*M(q,$,b,v);case"Number":return yield*L(q,$,b,v);case"Object":return yield*ee(q,$,b,v);case"Promise":return yield*oe(q,$,b,v);case"Record":return yield*Q(q,$,b,v);case"Ref":return yield*ae(q,$,b,v);case"String":return yield*D(q,$,b,v);case"Symbol":return yield*H(q,$,b,v);case"TemplateLiteral":return yield*Y(q,$,b,v);case"This":return yield*he(q,$,b,v);case"Tuple":return yield*f(q,$,b,v);case"Undefined":return yield*_(q,$,b,v);case"Union":return yield*E(q,$,b,v);case"Uint8Array":return yield*U(q,$,b,v);case"Unknown":return yield*P(q,$,b,v);case"Void":return yield*N(q,$,b,v);default:if(!o.TypeRegistry.Has(q[o.Kind]))throw new a(u);return yield*y(q,$,b,v)}}function w(...u){let A=u.length===3?T(u[0],u[1],"",u[2]):T(u[0],[],"",u[1]);return new d(A)}e.Errors=w}}),ty=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(r,i,o,s){s===void 0&&(s=o);var a=Object.getOwnPropertyDescriptor(i,o);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(r,s,a)}:function(r,i,o,s){s===void 0&&(s=o),r[s]=i[o]}),n=e&&e.__exportStar||function(r,i){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(_o(),e)}}),ml=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(o,s);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(i,a,l)}:function(i,o,s,a){a===void 0&&(a=s),i[a]=o[s]}),n=e&&e.__exportStar||function(i,o){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,i,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var r=_o();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return r.ValueErrorType}}),n(gl(),e)}}),ny=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/check.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=Or(),n=ml(),r=bo(),i=Hs(),o=rn(),s=class extends o.TypeBoxError{constructor(y){super("Unknown type"),this.schema=y}};e.ValueCheckUnknownTypeError=s;function a(y){return y[o.Kind]==="Any"||y[o.Kind]==="Unknown"}function l(y){return y!==void 0}function c(y,T,w){return!0}function d(y,T,w){if(!(0,t.IsArray)(w)||l(y.minItems)&&!(w.length>=y.minItems)||l(y.maxItems)&&!(w.length<=y.maxItems)||!w.every(b=>P(y.items,T,b))||y.uniqueItems===!0&&!function(){let b=new Set;for(let v of w){let $=(0,i.Hash)(v);if(b.has($))return!1;b.add($)}return!0}())return!1;if(!(l(y.contains)||(0,t.IsNumber)(y.minContains)||(0,t.IsNumber)(y.maxContains)))return!0;let u=l(y.contains)?y.contains:o.Type.Never(),A=w.reduce((b,v)=>P(u,T,v)?b+1:b,0);return!(A===0||(0,t.IsNumber)(y.minContains)&&A<y.minContains||(0,t.IsNumber)(y.maxContains)&&A>y.maxContains)}function g(y,T,w){return(0,t.IsAsyncIterator)(w)}function C(y,T,w){return!(!(0,t.IsBigInt)(w)||l(y.exclusiveMaximum)&&!(w<y.exclusiveMaximum)||l(y.exclusiveMinimum)&&!(w>y.exclusiveMinimum)||l(y.maximum)&&!(w<=y.maximum)||l(y.minimum)&&!(w>=y.minimum)||l(y.multipleOf)&&w%y.multipleOf!==BigInt(0))}function I(y,T,w){return(0,t.IsBoolean)(w)}function S(y,T,w){return P(y.returns,T,w.prototype)}function V(y,T,w){return!(!(0,t.IsDate)(w)||l(y.exclusiveMaximumTimestamp)&&!(w.getTime()<y.exclusiveMaximumTimestamp)||l(y.exclusiveMinimumTimestamp)&&!(w.getTime()>y.exclusiveMinimumTimestamp)||l(y.maximumTimestamp)&&!(w.getTime()<=y.maximumTimestamp)||l(y.minimumTimestamp)&&!(w.getTime()>=y.minimumTimestamp)||l(y.multipleOfTimestamp)&&w.getTime()%y.multipleOfTimestamp!==0)}function J(y,T,w){return(0,t.IsFunction)(w)}function F(y,T,w){return!(!(0,t.IsInteger)(w)||l(y.exclusiveMaximum)&&!(w<y.exclusiveMaximum)||l(y.exclusiveMinimum)&&!(w>y.exclusiveMinimum)||l(y.maximum)&&!(w<=y.maximum)||l(y.minimum)&&!(w>=y.minimum)||l(y.multipleOf)&&w%y.multipleOf!==0)}function k(y,T,w){let u=y.allOf.every(A=>P(A,T,w));if(y.unevaluatedProperties===!1){let A=new RegExp(o.KeyResolver.ResolvePattern(y)),b=Object.getOwnPropertyNames(w).every(v=>A.test(v));return u&&b}else if(o.TypeGuard.TSchema(y.unevaluatedProperties)){let A=new RegExp(o.KeyResolver.ResolvePattern(y)),b=Object.getOwnPropertyNames(w).every(v=>A.test(v)||P(y.unevaluatedProperties,T,w[v]));return u&&b}else return u}function z(y,T,w){return(0,t.IsIterator)(w)}function W(y,T,w){return w===y.const}function j(y,T,w){return!1}function Z(y,T,w){return!P(y.not,T,w)}function G(y,T,w){return(0,t.IsNull)(w)}function fe(y,T,w){return!(!n.TypeSystemPolicy.IsNumberLike(w)||l(y.exclusiveMaximum)&&!(w<y.exclusiveMaximum)||l(y.exclusiveMinimum)&&!(w>y.exclusiveMinimum)||l(y.minimum)&&!(w>=y.minimum)||l(y.maximum)&&!(w<=y.maximum)||l(y.multipleOf)&&w%y.multipleOf!==0)}function x(y,T,w){if(!n.TypeSystemPolicy.IsObjectLike(w)||l(y.minProperties)&&!(Object.getOwnPropertyNames(w).length>=y.minProperties)||l(y.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=y.maxProperties))return!1;let u=Object.getOwnPropertyNames(y.properties);for(let A of u){let b=y.properties[A];if(y.required&&y.required.includes(A)){if(!P(b,T,w[A])||(o.ExtendsUndefined.Check(b)||a(b))&&!(A in w))return!1}else if(n.TypeSystemPolicy.IsExactOptionalProperty(w,A)&&!P(b,T,w[A]))return!1}if(y.additionalProperties===!1){let A=Object.getOwnPropertyNames(w);return y.required&&y.required.length===u.length&&A.length===u.length?!0:A.every(b=>u.includes(b))}else return typeof y.additionalProperties=="object"?Object.getOwnPropertyNames(w).every(b=>u.includes(b)||P(y.additionalProperties,T,w[b])):!0}function M(y,T,w){return(0,t.IsPromise)(w)}function L(y,T,w){if(!n.TypeSystemPolicy.IsRecordLike(w)||l(y.minProperties)&&!(Object.getOwnPropertyNames(w).length>=y.minProperties)||l(y.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=y.maxProperties))return!1;let[u,A]=Object.entries(y.patternProperties)[0],b=new RegExp(u),v=Object.entries(w).every(([te,ne])=>b.test(te)?P(A,T,ne):!0),$=typeof y.additionalProperties=="object"?Object.entries(w).every(([te,ne])=>b.test(te)?!0:P(y.additionalProperties,T,ne)):!0,q=y.additionalProperties===!1?Object.getOwnPropertyNames(w).every(te=>b.test(te)):!0;return v&&$&&q}function ee(y,T,w){return P((0,r.Deref)(y,T),T,w)}function oe(y,T,w){return!(0,t.IsString)(w)||l(y.minLength)&&!(w.length>=y.minLength)||l(y.maxLength)&&!(w.length<=y.maxLength)||l(y.pattern)&&!new RegExp(y.pattern).test(w)?!1:l(y.format)?o.FormatRegistry.Has(y.format)?o.FormatRegistry.Get(y.format)(w):!1:!0}function Q(y,T,w){return(0,t.IsSymbol)(w)}function ae(y,T,w){return(0,t.IsString)(w)&&new RegExp(y.pattern).test(w)}function D(y,T,w){return P((0,r.Deref)(y,T),T,w)}function H(y,T,w){if(!(0,t.IsArray)(w)||y.items===void 0&&w.length!==0||w.length!==y.maxItems)return!1;if(!y.items)return!0;for(let u=0;u<y.items.length;u++)if(!P(y.items[u],T,w[u]))return!1;return!0}function Y(y,T,w){return(0,t.IsUndefined)(w)}function he(y,T,w){return y.anyOf.some(u=>P(u,T,w))}function f(y,T,w){return!(!(0,t.IsUint8Array)(w)||l(y.maxByteLength)&&!(w.length<=y.maxByteLength)||l(y.minByteLength)&&!(w.length>=y.minByteLength))}function _(y,T,w){return!0}function E(y,T,w){return n.TypeSystemPolicy.IsVoidLike(w)}function U(y,T,w){return o.TypeRegistry.Has(y[o.Kind])?o.TypeRegistry.Get(y[o.Kind])(y,w):!1}function P(y,T,w){let u=l(y.$id)?[...T,y]:T,A=y;switch(A[o.Kind]){case"Any":return c(A,u,w);case"Array":return d(A,u,w);case"AsyncIterator":return g(A,u,w);case"BigInt":return C(A,u,w);case"Boolean":return I(A,u,w);case"Constructor":return S(A,u,w);case"Date":return V(A,u,w);case"Function":return J(A,u,w);case"Integer":return F(A,u,w);case"Intersect":return k(A,u,w);case"Iterator":return z(A,u,w);case"Literal":return W(A,u,w);case"Never":return j(A,u,w);case"Not":return Z(A,u,w);case"Null":return G(A,u,w);case"Number":return fe(A,u,w);case"Object":return x(A,u,w);case"Promise":return M(A,u,w);case"Record":return L(A,u,w);case"Ref":return ee(A,u,w);case"String":return oe(A,u,w);case"Symbol":return Q(A,u,w);case"TemplateLiteral":return ae(A,u,w);case"This":return D(A,u,w);case"Tuple":return H(A,u,w);case"Undefined":return Y(A,u,w);case"Union":return he(A,u,w);case"Uint8Array":return f(A,u,w);case"Unknown":return _(A,u,w);case"Void":return E(A,u,w);default:if(!o.TypeRegistry.Has(A[o.Kind]))throw new s(A);return U(A,u,w)}}function N(...y){return y.length===3?P(y[0],y[1],y[2]):P(y[0],[],y[1])}e.Check=N}}),ry=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/transform.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodeTransform=e.DecodeTransform=e.HasTransform=e.TransformEncodeError=e.TransformDecodeError=e.TransformEncodeCheckError=e.TransformDecodeCheckError=void 0;var t=Or(),n=bo(),r=ny(),i=rn(),o=class extends i.TypeBoxError{constructor(C,I,S){super("Unable to decode due to invalid value"),this.schema=C,this.value=I,this.error=S}};e.TransformDecodeCheckError=o;var s=class extends i.TypeBoxError{constructor(C,I,S){super("Unable to encode due to invalid value"),this.schema=C,this.value=I,this.error=S}};e.TransformEncodeCheckError=s;var a=class extends i.TypeBoxError{constructor(C,I,S){super(`${S instanceof Error?S.message:"Unknown error"}`),this.schema=C,this.value=I}};e.TransformDecodeError=a;var l=class extends i.TypeBoxError{constructor(C,I,S){super(`${S instanceof Error?S.message:"Unknown error"}`),this.schema=C,this.value=I}};e.TransformEncodeError=l;var c;(function(C){function I(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.items,ae)}function S(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.items,ae)}function V(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.returns,ae)||Q.parameters.some(D=>L(D,ae))}function J(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.returns,ae)||Q.parameters.some(D=>L(D,ae))}function F(Q,ae){return i.TypeGuard.TTransform(Q)||i.TypeGuard.TTransform(Q.unevaluatedProperties)||Q.allOf.some(D=>L(D,ae))}function k(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.items,ae)}function z(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.not,ae)}function W(Q,ae){return i.TypeGuard.TTransform(Q)||Object.values(Q.properties).some(D=>L(D,ae))||i.TypeGuard.TSchema(Q.additionalProperties)&&L(Q.additionalProperties,ae)}function j(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.item,ae)}function Z(Q,ae){let D=Object.getOwnPropertyNames(Q.patternProperties)[0],H=Q.patternProperties[D];return i.TypeGuard.TTransform(Q)||L(H,ae)||i.TypeGuard.TSchema(Q.additionalProperties)&&i.TypeGuard.TTransform(Q.additionalProperties)}function G(Q,ae){return i.TypeGuard.TTransform(Q)?!0:L((0,n.Deref)(Q,ae),ae)}function fe(Q,ae){return i.TypeGuard.TTransform(Q)?!0:L((0,n.Deref)(Q,ae),ae)}function x(Q,ae){return i.TypeGuard.TTransform(Q)||!(0,t.IsUndefined)(Q.items)&&Q.items.some(D=>L(D,ae))}function M(Q,ae){return i.TypeGuard.TTransform(Q)||Q.anyOf.some(D=>L(D,ae))}function L(Q,ae){let D=(0,t.IsString)(Q.$id)?[...ae,Q]:ae,H=Q;if(Q.$id&&ee.has(Q.$id))return!1;switch(Q.$id&&ee.add(Q.$id),Q[i.Kind]){case"Array":return I(H,D);case"AsyncIterator":return S(H,D);case"Constructor":return V(H,D);case"Function":return J(H,D);case"Intersect":return F(H,D);case"Iterator":return k(H,D);case"Not":return z(H,D);case"Object":return W(H,D);case"Promise":return j(H,D);case"Record":return Z(H,D);case"Ref":return G(H,D);case"This":return fe(H,D);case"Tuple":return x(H,D);case"Union":return M(H,D);default:return i.TypeGuard.TTransform(Q)}}let ee=new Set;function oe(Q,ae){return ee.clear(),L(Q,ae)}C.Has=oe})(c||(e.HasTransform=c={}));var d;(function(C){function I(x,M){try{return i.TypeGuard.TTransform(x)?x[i.Transform].Decode(M):M}catch(L){throw new a(x,M,L)}}function S(x,M,L){return(0,t.IsArray)(L)?I(x,L.map(ee=>G(x.items,M,ee))):I(x,L)}function V(x,M,L){if(!(0,t.IsPlainObject)(L)||(0,t.IsValueType)(L))return I(x,L);let ee=i.KeyResolver.ResolveKeys(x,{includePatterns:!1}),oe=ee.reduce((H,Y)=>Y in H?{...H,[Y]:G(i.IndexedAccessor.Resolve(x,[Y]),M,H[Y])}:H,L);if(!i.TypeGuard.TTransform(x.unevaluatedProperties))return I(x,oe);let Q=Object.getOwnPropertyNames(oe),ae=x.unevaluatedProperties,D=Q.reduce((H,Y)=>ee.includes(Y)?H:{...H,[Y]:I(ae,H[Y])},oe);return I(x,D)}function J(x,M,L){return I(x,G(x.not,M,L))}function F(x,M,L){if(!(0,t.IsPlainObject)(L))return I(x,L);let ee=i.KeyResolver.ResolveKeys(x,{includePatterns:!1}),oe=ee.reduce((H,Y)=>Y in H?{...H,[Y]:G(x.properties[Y],M,H[Y])}:H,L);if(!i.TypeGuard.TSchema(x.additionalProperties))return I(x,oe);let Q=Object.getOwnPropertyNames(oe),ae=x.additionalProperties,D=Q.reduce((H,Y)=>ee.includes(Y)?H:{...H,[Y]:I(ae,H[Y])},oe);return I(x,D)}function k(x,M,L){if(!(0,t.IsPlainObject)(L))return I(x,L);let ee=Object.getOwnPropertyNames(x.patternProperties)[0],oe=new RegExp(ee),Q=Object.getOwnPropertyNames(L).reduce((Y,he)=>oe.test(he)?{...Y,[he]:G(x.patternProperties[ee],M,Y[he])}:Y,L);if(!i.TypeGuard.TSchema(x.additionalProperties))return I(x,Q);let ae=Object.getOwnPropertyNames(Q),D=x.additionalProperties,H=ae.reduce((Y,he)=>oe.test(he)?Y:{...Y,[he]:I(D,Y[he])},Q);return I(x,H)}function z(x,M,L){let ee=(0,n.Deref)(x,M);return I(x,G(ee,M,L))}function W(x,M,L){let ee=(0,n.Deref)(x,M);return I(x,G(ee,M,L))}function j(x,M,L){return(0,t.IsArray)(L)&&(0,t.IsArray)(x.items)?I(x,x.items.map((ee,oe)=>G(ee,M,L[oe]))):I(x,L)}function Z(x,M,L){let ee=I(x,L);for(let oe of x.anyOf)if((0,r.Check)(oe,M,ee))return G(oe,M,ee);return ee}function G(x,M,L){let ee=typeof x.$id=="string"?[...M,x]:M,oe=x;switch(x[i.Kind]){case"Array":return S(oe,ee,L);case"Intersect":return V(oe,ee,L);case"Not":return J(oe,ee,L);case"Object":return F(oe,ee,L);case"Record":return k(oe,ee,L);case"Ref":return z(oe,ee,L);case"Symbol":return I(oe,L);case"This":return W(oe,ee,L);case"Tuple":return j(oe,ee,L);case"Union":return Z(oe,ee,L);default:return I(oe,L)}}function fe(x,M,L){return G(x,M,L)}C.Decode=fe})(d||(e.DecodeTransform=d={}));var g;(function(C){function I(x,M){try{return i.TypeGuard.TTransform(x)?x[i.Transform].Encode(M):M}catch(L){throw new l(x,M,L)}}function S(x,M,L){let ee=I(x,L);return(0,t.IsArray)(ee)?ee.map(oe=>G(x.items,M,oe)):ee}function V(x,M,L){let ee=I(x,L);if(!(0,t.IsPlainObject)(L)||(0,t.IsValueType)(L))return ee;let oe=i.KeyResolver.ResolveKeys(x,{includePatterns:!1}),Q=oe.reduce((H,Y)=>Y in ee?{...H,[Y]:G(i.IndexedAccessor.Resolve(x,[Y]),M,H[Y])}:H,ee);if(!i.TypeGuard.TTransform(x.unevaluatedProperties))return I(x,Q);let ae=Object.getOwnPropertyNames(Q),D=x.unevaluatedProperties;return ae.reduce((H,Y)=>oe.includes(Y)?H:{...H,[Y]:I(D,H[Y])},Q)}function J(x,M,L){return I(x.not,I(x,L))}function F(x,M,L){let ee=I(x,L);if(!(0,t.IsPlainObject)(L))return ee;let oe=i.KeyResolver.ResolveKeys(x,{includePatterns:!1}),Q=oe.reduce((H,Y)=>Y in H?{...H,[Y]:G(x.properties[Y],M,H[Y])}:H,ee);if(!i.TypeGuard.TSchema(x.additionalProperties))return Q;let ae=Object.getOwnPropertyNames(Q),D=x.additionalProperties;return ae.reduce((H,Y)=>oe.includes(Y)?H:{...H,[Y]:I(D,H[Y])},Q)}function k(x,M,L){let ee=I(x,L);if(!(0,t.IsPlainObject)(L))return ee;let oe=Object.getOwnPropertyNames(x.patternProperties)[0],Q=new RegExp(oe),ae=Object.getOwnPropertyNames(L).reduce((Y,he)=>Q.test(he)?{...Y,[he]:G(x.patternProperties[oe],M,Y[he])}:Y,ee);if(!i.TypeGuard.TSchema(x.additionalProperties))return I(x,ae);let D=Object.getOwnPropertyNames(ae),H=x.additionalProperties;return D.reduce((Y,he)=>Q.test(he)?Y:{...Y,[he]:I(H,Y[he])},ae)}function z(x,M,L){let ee=(0,n.Deref)(x,M),oe=G(ee,M,L);return I(x,oe)}function W(x,M,L){let ee=(0,n.Deref)(x,M),oe=G(ee,M,L);return I(x,oe)}function j(x,M,L){let ee=I(x,L);return(0,t.IsArray)(x.items)?x.items.map((oe,Q)=>G(oe,M,ee[Q])):[]}function Z(x,M,L){for(let ee of x.anyOf){if(!(0,r.Check)(ee,M,L))continue;let oe=G(ee,M,L);return I(x,oe)}for(let ee of x.anyOf){let oe=G(ee,M,L);if((0,r.Check)(x,M,oe))return I(x,oe)}return I(x,L)}function G(x,M,L){let ee=typeof x.$id=="string"?[...M,x]:M,oe=x;switch(x[i.Kind]){case"Array":return S(oe,ee,L);case"Intersect":return V(oe,ee,L);case"Not":return J(oe,ee,L);case"Object":return F(oe,ee,L);case"Record":return k(oe,ee,L);case"Ref":return z(oe,ee,L);case"This":return W(oe,ee,L);case"Tuple":return j(oe,ee,L);case"Union":return Z(oe,ee,L);default:return I(oe,L)}}function fe(x,M,L){return G(x,M,L)}C.Encode=fe})(g||(e.EncodeTransform=g={}))}}),iy=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/compiler.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=ry(),n=Or(),r=_o(),i=ml(),o=bo(),s=Hs(),a=rn(),l=class{constructor(F,k,z,W){this.schema=F,this.references=k,this.checkFunc=z,this.code=W,this.hasTransform=t.HasTransform.Has(F,k)}Code(){return this.code}Errors(F){return(0,r.Errors)(this.schema,this.references,F)}Check(F){return this.checkFunc(F)}Decode(F){if(!this.checkFunc(F))throw new t.TransformDecodeCheckError(this.schema,F,this.Errors(F).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,F):F}Encode(F){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,F):F;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,F,this.Errors(F).First());return k}};e.TypeCheck=l;var c;(function(F){function k(Z){return Z===36}F.DollarSign=k;function z(Z){return Z===95}F.IsUnderscore=z;function W(Z){return Z>=65&&Z<=90||Z>=97&&Z<=122}F.IsAlpha=W;function j(Z){return Z>=48&&Z<=57}F.IsNumeric=j})(c||(c={}));var d;(function(F){function k(Z){return Z.length===0?!1:c.IsNumeric(Z.charCodeAt(0))}function z(Z){if(k(Z))return!1;for(let G=0;G<Z.length;G++){let fe=Z.charCodeAt(G);if(!(c.IsAlpha(fe)||c.IsNumeric(fe)||c.DollarSign(fe)||c.IsUnderscore(fe)))return!1}return!0}function W(Z){return Z.replace(/'/g,"\\'")}function j(Z,G){return z(G)?`${Z}.${G}`:`${Z}['${W(G)}']`}F.Encode=j})(d||(d={}));var g;(function(F){function k(z){let W=[];for(let j=0;j<z.length;j++){let Z=z.charCodeAt(j);c.IsNumeric(Z)||c.IsAlpha(Z)?W.push(z.charAt(j)):W.push(`_${Z}_`)}return W.join("").replace(/__/g,"_")}F.Encode=k})(g||(g={}));var C;(function(F){function k(z){return z.replace(/'/g,"\\'")}F.Escape=k})(C||(C={}));var I=class extends a.TypeBoxError{constructor(F){super("Unknown type"),this.schema=F}};e.TypeCompilerUnknownTypeError=I;var S=class extends a.TypeBoxError{constructor(F){super("Preflight validation check failed to guard for the given schema"),this.schema=F}};e.TypeCompilerTypeGuardError=S;var V;(function(F){function k(G,fe,x){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${fe}' in ${G} ? ${x} : true)`:`(${d.Encode(G,fe)} !== undefined ? ${x} : true)`}F.IsExactOptionalProperty=k;function z(G){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${G} === 'object' && ${G} !== null)`:`(typeof ${G} === 'object' && ${G} !== null && !Array.isArray(${G}))`}F.IsObjectLike=z;function W(G){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${G} === 'object' && ${G} !== null && !(${G} instanceof Date) && !(${G} instanceof Uint8Array))`:`(typeof ${G} === 'object' && ${G} !== null && !Array.isArray(${G}) && !(${G} instanceof Date) && !(${G} instanceof Uint8Array))`}F.IsRecordLike=W;function j(G){return i.TypeSystemPolicy.AllowNaN?`typeof ${G} === 'number'`:`(typeof ${G} === 'number' && Number.isFinite(${G}))`}F.IsNumberLike=j;function Z(G){return i.TypeSystemPolicy.AllowNullVoid?`(${G} === undefined || ${G} === null)`:`${G} === undefined`}F.IsVoidLike=Z})(V||(e.Policy=V={}));var J;(function(F){function k(O){return O[a.Kind]==="Any"||O[a.Kind]==="Unknown"}function*z(O,le,R){yield"true"}function*W(O,le,R){yield`Array.isArray(${R})`;let[me,re]=[Fe("value","any"),Fe("acc","number")];(0,n.IsNumber)(O.maxItems)&&(yield`${R}.length <= ${O.maxItems}`),(0,n.IsNumber)(O.minItems)&&(yield`${R}.length >= ${O.minItems}`);let de=ne(O.items,le,"value");if(yield`${R}.every((${me}) => ${de})`,a.TypeGuard.TSchema(O.contains)||(0,n.IsNumber)(O.minContains)||(0,n.IsNumber)(O.maxContains)){let Se=a.TypeGuard.TSchema(O.contains)?O.contains:a.Type.Never(),ke=ne(Se,le,"value"),tt=(0,n.IsNumber)(O.minContains)?[`(count >= ${O.minContains})`]:[],Qe=(0,n.IsNumber)(O.maxContains)?[`(count <= ${O.maxContains})`]:[],rt=`const count = value.reduce((${re}, ${me}) => ${ke} ? acc + 1 : acc, 0)`,Yt=["(count > 0)",...tt,...Qe].join(" && ");yield`((${me}) => { ${rt}; return ${Yt}})(${R})`}O.uniqueItems===!0&&(yield`((${me}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${R})`)}function*j(O,le,R){yield`(typeof value === 'object' && Symbol.asyncIterator in ${R})`}function*Z(O,le,R){yield`(typeof ${R} === 'bigint')`,(0,n.IsBigInt)(O.exclusiveMaximum)&&(yield`${R} < BigInt(${O.exclusiveMaximum})`),(0,n.IsBigInt)(O.exclusiveMinimum)&&(yield`${R} > BigInt(${O.exclusiveMinimum})`),(0,n.IsBigInt)(O.maximum)&&(yield`${R} <= BigInt(${O.maximum})`),(0,n.IsBigInt)(O.minimum)&&(yield`${R} >= BigInt(${O.minimum})`),(0,n.IsBigInt)(O.multipleOf)&&(yield`(${R} % BigInt(${O.multipleOf})) === 0`)}function*G(O,le,R){yield`(typeof ${R} === 'boolean')`}function*fe(O,le,R){yield*q(O.returns,le,`${R}.prototype`)}function*x(O,le,R){yield`(${R} instanceof Date) && Number.isFinite(${R}.getTime())`,(0,n.IsNumber)(O.exclusiveMaximumTimestamp)&&(yield`${R}.getTime() < ${O.exclusiveMaximumTimestamp}`),(0,n.IsNumber)(O.exclusiveMinimumTimestamp)&&(yield`${R}.getTime() > ${O.exclusiveMinimumTimestamp}`),(0,n.IsNumber)(O.maximumTimestamp)&&(yield`${R}.getTime() <= ${O.maximumTimestamp}`),(0,n.IsNumber)(O.minimumTimestamp)&&(yield`${R}.getTime() >= ${O.minimumTimestamp}`),(0,n.IsNumber)(O.multipleOfTimestamp)&&(yield`(${R}.getTime() % ${O.multipleOfTimestamp}) === 0`)}function*M(O,le,R){yield`(typeof ${R} === 'function')`}function*L(O,le,R){yield`(typeof ${R} === 'number' && Number.isInteger(${R}))`,(0,n.IsNumber)(O.exclusiveMaximum)&&(yield`${R} < ${O.exclusiveMaximum}`),(0,n.IsNumber)(O.exclusiveMinimum)&&(yield`${R} > ${O.exclusiveMinimum}`),(0,n.IsNumber)(O.maximum)&&(yield`${R} <= ${O.maximum}`),(0,n.IsNumber)(O.minimum)&&(yield`${R} >= ${O.minimum}`),(0,n.IsNumber)(O.multipleOf)&&(yield`(${R} % ${O.multipleOf}) === 0`)}function*ee(O,le,R){let me=O.allOf.map(re=>ne(re,le,R)).join(" && ");if(O.unevaluatedProperties===!1){let re=be(`${new RegExp(a.KeyResolver.ResolvePattern(O))};`),de=`Object.getOwnPropertyNames(${R}).every(key => ${re}.test(key))`;yield`(${me} && ${de})`}else if(a.TypeGuard.TSchema(O.unevaluatedProperties)){let re=be(`${new RegExp(a.KeyResolver.ResolvePattern(O))};`),de=`Object.getOwnPropertyNames(${R}).every(key => ${re}.test(key) || ${ne(O.unevaluatedProperties,le,`${R}[key]`)})`;yield`(${me} && ${de})`}else yield`(${me})`}function*oe(O,le,R){yield`(typeof value === 'object' && Symbol.iterator in ${R})`}function*Q(O,le,R){typeof O.const=="number"||typeof O.const=="boolean"?yield`(${R} === ${O.const})`:yield`(${R} === '${C.Escape(O.const)}')`}function*ae(O,le,R){yield"false"}function*D(O,le,R){yield`(!${ne(O.not,le,R)})`}function*H(O,le,R){yield`(${R} === null)`}function*Y(O,le,R){yield V.IsNumberLike(R),(0,n.IsNumber)(O.exclusiveMaximum)&&(yield`${R} < ${O.exclusiveMaximum}`),(0,n.IsNumber)(O.exclusiveMinimum)&&(yield`${R} > ${O.exclusiveMinimum}`),(0,n.IsNumber)(O.maximum)&&(yield`${R} <= ${O.maximum}`),(0,n.IsNumber)(O.minimum)&&(yield`${R} >= ${O.minimum}`),(0,n.IsNumber)(O.multipleOf)&&(yield`(${R} % ${O.multipleOf}) === 0`)}function*he(O,le,R){yield V.IsObjectLike(R),(0,n.IsNumber)(O.minProperties)&&(yield`Object.getOwnPropertyNames(${R}).length >= ${O.minProperties}`),(0,n.IsNumber)(O.maxProperties)&&(yield`Object.getOwnPropertyNames(${R}).length <= ${O.maxProperties}`);let me=Object.getOwnPropertyNames(O.properties);for(let re of me){let de=d.Encode(R,re),Se=O.properties[re];if(O.required&&O.required.includes(re))yield*q(Se,le,de),(a.ExtendsUndefined.Check(Se)||k(Se))&&(yield`('${re}' in ${R})`);else{let ke=ne(Se,le,de);yield V.IsExactOptionalProperty(R,re,ke)}}if(O.additionalProperties===!1)if(O.required&&O.required.length===me.length)yield`Object.getOwnPropertyNames(${R}).length === ${me.length}`;else{let re=`[${me.map(de=>`'${de}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${R}).every(key => ${re}.includes(key))`}if(typeof O.additionalProperties=="object"){let re=ne(O.additionalProperties,le,`${R}[key]`),de=`[${me.map(Se=>`'${Se}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${R}).every(key => ${de}.includes(key) || ${re}))`}}function*f(O,le,R){yield`(typeof value === 'object' && typeof ${R}.then === 'function')`}function*_(O,le,R){yield V.IsRecordLike(R),(0,n.IsNumber)(O.minProperties)&&(yield`Object.getOwnPropertyNames(${R}).length >= ${O.minProperties}`),(0,n.IsNumber)(O.maxProperties)&&(yield`Object.getOwnPropertyNames(${R}).length <= ${O.maxProperties}`);let[me,re]=Object.entries(O.patternProperties)[0],de=be(`${new RegExp(me)}`),Se=ne(re,le,"value"),ke=a.TypeGuard.TSchema(O.additionalProperties)?ne(O.additionalProperties,le,R):O.additionalProperties===!1?"false":"true",tt=`(${de}.test(key) ? ${Se} : ${ke})`;yield`(Object.entries(${R}).every(([key, value]) => ${tt}))`}function*E(O,le,R){let me=(0,o.Deref)(O,le);if(te.functions.has(O.$ref))return yield`${ge(O.$ref)}(${R})`;yield*q(me,le,R)}function*U(O,le,R){yield`(typeof ${R} === 'string')`,(0,n.IsNumber)(O.maxLength)&&(yield`${R}.length <= ${O.maxLength}`),(0,n.IsNumber)(O.minLength)&&(yield`${R}.length >= ${O.minLength}`),O.pattern!==void 0&&(yield`${be(`${new RegExp(O.pattern)};`)}.test(${R})`),O.format!==void 0&&(yield`format('${O.format}', ${R})`)}function*P(O,le,R){yield`(typeof ${R} === 'symbol')`}function*N(O,le,R){yield`(typeof ${R} === 'string')`,yield`${be(`${new RegExp(O.pattern)};`)}.test(${R})`}function*y(O,le,R){yield`${ge(O.$ref)}(${R})`}function*T(O,le,R){if(yield`Array.isArray(${R})`,O.items===void 0)return yield`${R}.length === 0`;yield`(${R}.length === ${O.maxItems})`;for(let me=0;me<O.items.length;me++)yield`${ne(O.items[me],le,`${R}[${me}]`)}`}function*w(O,le,R){yield`${R} === undefined`}function*u(O,le,R){yield`(${O.anyOf.map(re=>ne(re,le,R)).join(" || ")})`}function*A(O,le,R){yield`${R} instanceof Uint8Array`,(0,n.IsNumber)(O.maxByteLength)&&(yield`(${R}.length <= ${O.maxByteLength})`),(0,n.IsNumber)(O.minByteLength)&&(yield`(${R}.length >= ${O.minByteLength})`)}function*b(O,le,R){yield"true"}function*v(O,le,R){yield V.IsVoidLike(R)}function*$(O,le,R){let me=te.instances.size;te.instances.set(me,O),yield`kind('${O[a.Kind]}', ${me}, ${R})`}function*q(O,le,R,me=!0){let re=(0,n.IsString)(O.$id)?[...le,O]:le,de=O;if(me&&(0,n.IsString)(O.$id)){let Se=ge(O.$id);if(te.functions.has(Se))return yield`${Se}(${R})`;{let ke=Ue(Se,O,le,"value",!1);return te.functions.set(Se,ke),yield`${Se}(${R})`}}switch(de[a.Kind]){case"Any":return yield*z(de,re,R);case"Array":return yield*W(de,re,R);case"AsyncIterator":return yield*j(de,re,R);case"BigInt":return yield*Z(de,re,R);case"Boolean":return yield*G(de,re,R);case"Constructor":return yield*fe(de,re,R);case"Date":return yield*x(de,re,R);case"Function":return yield*M(de,re,R);case"Integer":return yield*L(de,re,R);case"Intersect":return yield*ee(de,re,R);case"Iterator":return yield*oe(de,re,R);case"Literal":return yield*Q(de,re,R);case"Never":return yield*ae(de,re,R);case"Not":return yield*D(de,re,R);case"Null":return yield*H(de,re,R);case"Number":return yield*Y(de,re,R);case"Object":return yield*he(de,re,R);case"Promise":return yield*f(de,re,R);case"Record":return yield*_(de,re,R);case"Ref":return yield*E(de,re,R);case"String":return yield*U(de,re,R);case"Symbol":return yield*P(de,re,R);case"TemplateLiteral":return yield*N(de,re,R);case"This":return yield*y(de,re,R);case"Tuple":return yield*T(de,re,R);case"Undefined":return yield*w(de,re,R);case"Union":return yield*u(de,re,R);case"Uint8Array":return yield*A(de,re,R);case"Unknown":return yield*b(de,re,R);case"Void":return yield*v(de,re,R);default:if(!a.TypeRegistry.Has(de[a.Kind]))throw new I(O);return yield*$(de,re,R)}}let te={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ne(O,le,R,me=!0){return`(${[...q(O,le,R,me)].join(" && ")})`}function ge(O){return`check_${g.Encode(O)}`}function be(O){let le=`local_${te.variables.size}`;return te.variables.set(le,`const ${le} = ${O}`),le}function Ue(O,le,R,me,re=!0){let[de,Se]=[`
|
|
49
|
-
`,
|
|
50
|
-
}`}function Fe(O,le){let R=te.language==="typescript"?`: ${le}`:"";return`${O}${R}`}function
|
|
48
|
+
${f}`),H.pop(),`{${P}}`}case"number":return isFinite(D)?String(D):K?K(D):"null";case"boolean":return D===!0?"true":"false";case"undefined":return;case"bigint":if(j)return String(D);default:return K?K(D):void 0}}function oe(ae,D,H){switch(typeof D){case"string":return o(D);case"object":{if(D===null)return"null";if(typeof D.toJSON=="function"){if(D=D.toJSON(ae),typeof D!="object")return oe(ae,D,H);if(D===null)return"null"}if(H.indexOf(D)!==-1)return W;let Y="",he=D.length!==void 0;if(he&&Array.isArray(D)){if(D.length===0)return"[]";if(fe<H.length+1)return'"[Array]"';H.push(D);let P=Math.min(D.length,x),$=0;for(;$<P-1;$++){let T=oe(String($),D[$],H);Y+=T!==void 0?T:"null",Y+=","}let y=oe(String($),D[$],H);if(Y+=y!==void 0?y:"null",D.length-1>x){let T=D.length-x-1;Y+=`,"... ${S(T)} not stringified"`}return H.pop(),`[${Y}]`}let f=Object.keys(D),_=f.length;if(_===0)return"{}";if(fe<H.length+1)return'"[Object]"';let E="",U=Math.min(_,x);he&&l(D)&&(Y+=c(D,",",x),f=f.slice(D.length),U-=D.length,E=","),Z&&(f=s(f,G)),H.push(D);for(let P=0;P<U;P++){let $=f[P],y=oe($,D[$],H);y!==void 0&&(Y+=`${E}${o($)}:${y}`,E=",")}if(_>x){let P=_-x;Y+=`${E}"...":"${S(P)} not stringified"`}return H.pop(),`{${Y}}`}case"number":return isFinite(D)?String(D):K?K(D):"null";case"boolean":return D===!0?"true":"false";case"undefined":return;case"bigint":if(j)return String(D);default:return K?K(D):void 0}}function Q(ae,D,H){if(arguments.length>1){let Y="";if(typeof H=="number"?Y=" ".repeat(Math.min(H,10)):typeof H=="string"&&(Y=H.slice(0,10)),D!=null){if(typeof D=="function")return M("",{"":ae},[],D,Y,"");if(Array.isArray(D))return L("",ae,[],z(D),Y,"")}if(Y.length!==0)return ee("",ae,[],Y,"")}return oe("",ae,[])}return Q}}}),Ir=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/guard.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IsValueType=e.IsSymbol=e.IsFunction=e.IsString=e.IsBigInt=e.IsInteger=e.IsNumber=e.IsBoolean=e.IsNull=e.IsUndefined=e.IsArray=e.IsObject=e.IsPlainObject=e.HasPropertyKey=e.IsDate=e.IsUint8Array=e.IsPromise=e.IsTypedArray=e.IsIterator=e.IsAsyncIterator=void 0;function t(j){return c(j)&&Symbol.asyncIterator in j}e.IsAsyncIterator=t;function n(j){return c(j)&&Symbol.iterator in j}e.IsIterator=n;function r(j){return ArrayBuffer.isView(j)}e.IsTypedArray=r;function i(j){return j instanceof Promise}e.IsPromise=i;function o(j){return j instanceof Uint8Array}e.IsUint8Array=o;function s(j){return j instanceof Date&&Number.isFinite(j.getTime())}e.IsDate=s;function a(j,Z){return Z in j}e.HasPropertyKey=a;function l(j){return c(j)&&k(j.constructor)&&j.constructor.name==="Object"}e.IsPlainObject=l;function c(j){return j!==null&&typeof j=="object"}e.IsObject=c;function d(j){return Array.isArray(j)&&!ArrayBuffer.isView(j)}e.IsArray=d;function g(j){return j===void 0}e.IsUndefined=g;function C(j){return j===null}e.IsNull=C;function I(j){return typeof j=="boolean"}e.IsBoolean=I;function S(j){return typeof j=="number"}e.IsNumber=S;function z(j){return S(j)&&Number.isInteger(j)}e.IsInteger=z;function J(j){return typeof j=="bigint"}e.IsBigInt=J;function F(j){return typeof j=="string"}e.IsString=F;function k(j){return typeof j=="function"}e.IsFunction=k;function K(j){return typeof j=="symbol"}e.IsSymbol=K;function W(j){return J(j)||I(j)||C(j)||S(j)||F(j)||K(j)||g(j)}e.IsValueType=W}}),vl=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/system.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultErrorFunction=e.TypeSystemPolicy=e.TypeSystemErrorFunction=e.TypeSystem=e.TypeSystemDuplicateFormat=e.TypeSystemDuplicateTypeKind=void 0;var t=Ir(),n=To(),r=sn(),i=class extends r.TypeBoxError{constructor(d){super(`Duplicate type kind '${d}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends r.TypeBoxError{constructor(d){super(`Duplicate string format '${d}' detected`)}};e.TypeSystemDuplicateFormat=o;var s;(function(d){function g(I,S){if(r.TypeRegistry.Has(I))throw new i(I);return r.TypeRegistry.Set(I,S),(z={})=>r.Type.Unsafe({...z,[r.Kind]:I})}d.Type=g;function C(I,S){if(r.FormatRegistry.Has(I))throw new o(I);return r.FormatRegistry.Set(I,S),I}d.Format=C})(s||(e.TypeSystem=s={}));var a;(function(d){let g=c;function C(){g=c}d.Reset=C;function I(z){g=z}d.Set=I;function S(){return g}d.Get=S})(a||(e.TypeSystemErrorFunction=a={}));var l;(function(d){d.ExactOptionalPropertyTypes=!1,d.AllowArrayObject=!1,d.AllowNaN=!1,d.AllowNullVoid=!1;function g(J,F){return d.ExactOptionalPropertyTypes?F in J:J[F]!==void 0}d.IsExactOptionalProperty=g;function C(J){let F=(0,t.IsObject)(J);return d.AllowArrayObject?F:F&&!(0,t.IsArray)(J)}d.IsObjectLike=C;function I(J){return C(J)&&!(J instanceof Date)&&!(J instanceof Uint8Array)}d.IsRecordLike=I;function S(J){let F=(0,t.IsNumber)(J);return d.AllowNaN?F:F&&Number.isFinite(J)}d.IsNumberLike=S;function z(J){let F=(0,t.IsUndefined)(J);return d.AllowNullVoid?F||J===null:F}d.IsVoidLike=z})(l||(e.TypeSystemPolicy=l={}));function c(d,g){switch(g){case n.ValueErrorType.ArrayContains:return"Expected array to contain at least one matching value";case n.ValueErrorType.ArrayMaxContains:return`Expected array to contain no more than ${d.maxContains} matching values`;case n.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${d.minContains} matching values`;case n.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${d.maxItems}`;case n.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${d.minItems}`;case n.ValueErrorType.ArrayUniqueItems:return"Expected array elements to be unique";case n.ValueErrorType.Array:return"Expected array";case n.ValueErrorType.AsyncIterator:return"Expected AsyncIterator";case n.ValueErrorType.BigIntExclusiveMaximum:return`Expected bigint to be less than ${d.exclusiveMaximum}`;case n.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${d.exclusiveMinimum}`;case n.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${d.maximum}`;case n.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${d.minimum}`;case n.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${d.multipleOf}`;case n.ValueErrorType.BigInt:return"Expected bigint";case n.ValueErrorType.Boolean:return"Expected boolean";case n.ValueErrorType.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${d.exclusiveMinimumTimestamp}`;case n.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${d.exclusiveMaximumTimestamp}`;case n.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${d.minimumTimestamp}`;case n.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${d.maximumTimestamp}`;case n.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${d.multipleOfTimestamp}`;case n.ValueErrorType.Date:return"Expected Date";case n.ValueErrorType.Function:return"Expected function";case n.ValueErrorType.IntegerExclusiveMaximum:return`Expected integer to be less than ${d.exclusiveMaximum}`;case n.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${d.exclusiveMinimum}`;case n.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${d.maximum}`;case n.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${d.minimum}`;case n.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${d.multipleOf}`;case n.ValueErrorType.Integer:return"Expected integer";case n.ValueErrorType.IntersectUnevaluatedProperties:return"Unexpected property";case n.ValueErrorType.Intersect:return"Expected all values to match";case n.ValueErrorType.Iterator:return"Expected Iterator";case n.ValueErrorType.Literal:return`Expected ${typeof d.const=="string"?`'${d.const}'`:d.const}`;case n.ValueErrorType.Never:return"Never";case n.ValueErrorType.Not:return"Value should not match";case n.ValueErrorType.Null:return"Expected null";case n.ValueErrorType.NumberExclusiveMaximum:return`Expected number to be less than ${d.exclusiveMaximum}`;case n.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${d.exclusiveMinimum}`;case n.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${d.maximum}`;case n.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${d.minimum}`;case n.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${d.multipleOf}`;case n.ValueErrorType.Number:return"Expected number";case n.ValueErrorType.Object:return"Expected object";case n.ValueErrorType.ObjectAdditionalProperties:return"Unexpected property";case n.ValueErrorType.ObjectMaxProperties:return`Expected object to have no more than ${d.maxProperties} properties`;case n.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${d.minProperties} properties`;case n.ValueErrorType.ObjectRequiredProperty:return"Required property";case n.ValueErrorType.Promise:return"Expected Promise";case n.ValueErrorType.StringFormatUnknown:return`Unknown format '${d.format}'`;case n.ValueErrorType.StringFormat:return`Expected string to match '${d.format}' format`;case n.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${d.maxLength}`;case n.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${d.minLength}`;case n.ValueErrorType.StringPattern:return`Expected string to match '${d.pattern}'`;case n.ValueErrorType.String:return"Expected string";case n.ValueErrorType.Symbol:return"Expected symbol";case n.ValueErrorType.TupleLength:return`Expected tuple to have ${d.maxItems||0} elements`;case n.ValueErrorType.Tuple:return"Expected tuple";case n.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${d.maxByteLength}`;case n.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${d.minByteLength}`;case n.ValueErrorType.Uint8Array:return"Expected Uint8Array";case n.ValueErrorType.Undefined:return"Expected undefined";case n.ValueErrorType.Union:return"Expected union value";case n.ValueErrorType.Void:return"Expected void";case n.ValueErrorType.Kind:return`Expected kind '${d[r.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=c}}),wo=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/deref.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=sn(),n=class extends t.TypeBoxError{constructor(i){super(`Unable to dereference schema with $id '${i.$id}'`),this.schema=i}};e.TypeDereferenceError=n;function r(i,o){let s=o.findIndex(a=>a.$id===i.$ref);if(s===-1)throw new n(i);return o[s]}e.Deref=r}}),Xs=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/hash.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=Ir(),n=class extends Error{constructor(M){super("Unable to hash value"),this.value=M}};e.ValueHashError=n;var r;(function(M){M[M.Undefined=0]="Undefined",M[M.Null=1]="Null",M[M.Boolean=2]="Boolean",M[M.Number=3]="Number",M[M.String=4]="String",M[M.Object=5]="Object",M[M.Array=6]="Array",M[M.Date=7]="Date",M[M.Uint8Array=8]="Uint8Array",M[M.Symbol=9]="Symbol",M[M.BigInt=10]="BigInt"})(r||(e.ByteMarker=r={}));var i=BigInt("14695981039346656037"),[o,s]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],a=Array.from({length:256}).map((M,L)=>BigInt(L)),l=new Float64Array(1),c=new DataView(l.buffer),d=new Uint8Array(l.buffer);function*g(M){let L=M===0?1:Math.ceil(Math.floor(Math.log2(M)+1)/8);for(let ee=0;ee<L;ee++)yield M>>8*(L-1-ee)&255}function C(M){fe(r.Array);for(let L of M)G(L)}function I(M){fe(r.Boolean),fe(M?1:0)}function S(M){fe(r.BigInt),c.setBigInt64(0,M);for(let L of d)fe(L)}function z(M){fe(r.Date),G(M.getTime())}function J(M){fe(r.Null)}function F(M){fe(r.Number),c.setFloat64(0,M);for(let L of d)fe(L)}function k(M){fe(r.Object);for(let L of globalThis.Object.keys(M).sort())G(L),G(M[L])}function K(M){fe(r.String);for(let L=0;L<M.length;L++)for(let ee of g(M.charCodeAt(L)))fe(ee)}function W(M){fe(r.Symbol),G(M.description)}function j(M){fe(r.Uint8Array);for(let L=0;L<M.length;L++)fe(M[L])}function Z(M){return fe(r.Undefined)}function G(M){if((0,t.IsArray)(M))return C(M);if((0,t.IsBoolean)(M))return I(M);if((0,t.IsBigInt)(M))return S(M);if((0,t.IsDate)(M))return z(M);if((0,t.IsNull)(M))return J(M);if((0,t.IsNumber)(M))return F(M);if((0,t.IsPlainObject)(M))return k(M);if((0,t.IsString)(M))return K(M);if((0,t.IsSymbol)(M))return W(M);if((0,t.IsUint8Array)(M))return j(M);if((0,t.IsUndefined)(M))return Z(M);throw new n(M)}function fe(M){i=i^a[M],i=i*o%s}function x(M){return i=BigInt("14695981039346656037"),G(M),i}e.Hash=x}}),To=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=Ir(),n=vl(),r=wo(),i=Xs(),o=sn(),s;(function(u){u[u.ArrayContains=0]="ArrayContains",u[u.ArrayMaxContains=1]="ArrayMaxContains",u[u.ArrayMaxItems=2]="ArrayMaxItems",u[u.ArrayMinContains=3]="ArrayMinContains",u[u.ArrayMinItems=4]="ArrayMinItems",u[u.ArrayUniqueItems=5]="ArrayUniqueItems",u[u.Array=6]="Array",u[u.AsyncIterator=7]="AsyncIterator",u[u.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",u[u.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",u[u.BigIntMaximum=10]="BigIntMaximum",u[u.BigIntMinimum=11]="BigIntMinimum",u[u.BigIntMultipleOf=12]="BigIntMultipleOf",u[u.BigInt=13]="BigInt",u[u.Boolean=14]="Boolean",u[u.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",u[u.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",u[u.DateMaximumTimestamp=17]="DateMaximumTimestamp",u[u.DateMinimumTimestamp=18]="DateMinimumTimestamp",u[u.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",u[u.Date=20]="Date",u[u.Function=21]="Function",u[u.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",u[u.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",u[u.IntegerMaximum=24]="IntegerMaximum",u[u.IntegerMinimum=25]="IntegerMinimum",u[u.IntegerMultipleOf=26]="IntegerMultipleOf",u[u.Integer=27]="Integer",u[u.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",u[u.Intersect=29]="Intersect",u[u.Iterator=30]="Iterator",u[u.Kind=31]="Kind",u[u.Literal=32]="Literal",u[u.Never=33]="Never",u[u.Not=34]="Not",u[u.Null=35]="Null",u[u.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",u[u.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",u[u.NumberMaximum=38]="NumberMaximum",u[u.NumberMinimum=39]="NumberMinimum",u[u.NumberMultipleOf=40]="NumberMultipleOf",u[u.Number=41]="Number",u[u.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",u[u.ObjectMaxProperties=43]="ObjectMaxProperties",u[u.ObjectMinProperties=44]="ObjectMinProperties",u[u.ObjectRequiredProperty=45]="ObjectRequiredProperty",u[u.Object=46]="Object",u[u.Promise=47]="Promise",u[u.StringFormatUnknown=48]="StringFormatUnknown",u[u.StringFormat=49]="StringFormat",u[u.StringMaxLength=50]="StringMaxLength",u[u.StringMinLength=51]="StringMinLength",u[u.StringPattern=52]="StringPattern",u[u.String=53]="String",u[u.Symbol=54]="Symbol",u[u.TupleLength=55]="TupleLength",u[u.Tuple=56]="Tuple",u[u.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",u[u.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",u[u.Uint8Array=59]="Uint8Array",u[u.Undefined=60]="Undefined",u[u.Union=61]="Union",u[u.Void=62]="Void"})(s||(e.ValueErrorType=s={}));var a=class extends o.TypeBoxError{constructor(u){super("Unknown type"),this.schema=u}};e.ValueErrorsUnknownTypeError=a;function l(u){return u.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=l;function c(u){return u!==void 0}var d=class{constructor(u){this.iterator=u}[Symbol.iterator](){return this.iterator}First(){let u=this.iterator.next();return u.done?void 0:u.value}};e.ValueErrorIterator=d;function g(u,A,b,v){return{type:u,schema:A,path:b,value:v,message:n.TypeSystemErrorFunction.Get()(A,u)}}function*C(u,A,b,v){}function*I(u,A,b,v){if(!(0,t.IsArray)(v))return yield g(s.Array,u,b,v);c(u.minItems)&&!(v.length>=u.minItems)&&(yield g(s.ArrayMinItems,u,b,v)),c(u.maxItems)&&!(v.length<=u.maxItems)&&(yield g(s.ArrayMaxItems,u,b,v));for(let te=0;te<v.length;te++)yield*T(u.items,A,`${b}/${te}`,v[te]);if(u.uniqueItems===!0&&!function(){let te=new Set;for(let ne of v){let ge=(0,i.Hash)(ne);if(te.has(ge))return!1;te.add(ge)}return!0}()&&(yield g(s.ArrayUniqueItems,u,b,v)),!(c(u.contains)||c(u.minContains)||c(u.maxContains)))return;let N=c(u.contains)?u.contains:o.Type.Never(),q=v.reduce((te,ne,ge)=>T(N,A,`${b}${ge}`,ne).next().done===!0?te+1:te,0);q===0&&(yield g(s.ArrayContains,u,b,v)),(0,t.IsNumber)(u.minContains)&&q<u.minContains&&(yield g(s.ArrayMinContains,u,b,v)),(0,t.IsNumber)(u.maxContains)&&q>u.maxContains&&(yield g(s.ArrayMaxContains,u,b,v))}function*S(u,A,b,v){(0,t.IsAsyncIterator)(v)||(yield g(s.AsyncIterator,u,b,v))}function*z(u,A,b,v){if(!(0,t.IsBigInt)(v))return yield g(s.BigInt,u,b,v);c(u.exclusiveMaximum)&&!(v<u.exclusiveMaximum)&&(yield g(s.BigIntExclusiveMaximum,u,b,v)),c(u.exclusiveMinimum)&&!(v>u.exclusiveMinimum)&&(yield g(s.BigIntExclusiveMinimum,u,b,v)),c(u.maximum)&&!(v<=u.maximum)&&(yield g(s.BigIntMaximum,u,b,v)),c(u.minimum)&&!(v>=u.minimum)&&(yield g(s.BigIntMinimum,u,b,v)),c(u.multipleOf)&&v%u.multipleOf!==BigInt(0)&&(yield g(s.BigIntMultipleOf,u,b,v))}function*J(u,A,b,v){(0,t.IsBoolean)(v)||(yield g(s.Boolean,u,b,v))}function*F(u,A,b,v){yield*T(u.returns,A,b,v.prototype)}function*k(u,A,b,v){if(!(0,t.IsDate)(v))return yield g(s.Date,u,b,v);c(u.exclusiveMaximumTimestamp)&&!(v.getTime()<u.exclusiveMaximumTimestamp)&&(yield g(s.DateExclusiveMaximumTimestamp,u,b,v)),c(u.exclusiveMinimumTimestamp)&&!(v.getTime()>u.exclusiveMinimumTimestamp)&&(yield g(s.DateExclusiveMinimumTimestamp,u,b,v)),c(u.maximumTimestamp)&&!(v.getTime()<=u.maximumTimestamp)&&(yield g(s.DateMaximumTimestamp,u,b,v)),c(u.minimumTimestamp)&&!(v.getTime()>=u.minimumTimestamp)&&(yield g(s.DateMinimumTimestamp,u,b,v)),c(u.multipleOfTimestamp)&&v.getTime()%u.multipleOfTimestamp!==0&&(yield g(s.DateMultipleOfTimestamp,u,b,v))}function*K(u,A,b,v){(0,t.IsFunction)(v)||(yield g(s.Function,u,b,v))}function*W(u,A,b,v){if(!(0,t.IsInteger)(v))return yield g(s.Integer,u,b,v);c(u.exclusiveMaximum)&&!(v<u.exclusiveMaximum)&&(yield g(s.IntegerExclusiveMaximum,u,b,v)),c(u.exclusiveMinimum)&&!(v>u.exclusiveMinimum)&&(yield g(s.IntegerExclusiveMinimum,u,b,v)),c(u.maximum)&&!(v<=u.maximum)&&(yield g(s.IntegerMaximum,u,b,v)),c(u.minimum)&&!(v>=u.minimum)&&(yield g(s.IntegerMinimum,u,b,v)),c(u.multipleOf)&&v%u.multipleOf!==0&&(yield g(s.IntegerMultipleOf,u,b,v))}function*j(u,A,b,v){for(let N of u.allOf){let q=T(N,A,b,v).next();q.done||(yield g(s.Intersect,u,b,v),yield q.value)}if(u.unevaluatedProperties===!1){let N=new RegExp(o.KeyResolver.ResolvePattern(u));for(let q of Object.getOwnPropertyNames(v))N.test(q)||(yield g(s.IntersectUnevaluatedProperties,u,`${b}/${q}`,v))}if(typeof u.unevaluatedProperties=="object"){let N=new RegExp(o.KeyResolver.ResolvePattern(u));for(let q of Object.getOwnPropertyNames(v))if(!N.test(q)){let te=T(u.unevaluatedProperties,A,`${b}/${q}`,v[q]).next();te.done||(yield te.value)}}}function*Z(u,A,b,v){(0,t.IsIterator)(v)||(yield g(s.Iterator,u,b,v))}function*G(u,A,b,v){v!==u.const&&(yield g(s.Literal,u,b,v))}function*fe(u,A,b,v){yield g(s.Never,u,b,v)}function*x(u,A,b,v){T(u.not,A,b,v).next().done===!0&&(yield g(s.Not,u,b,v))}function*M(u,A,b,v){(0,t.IsNull)(v)||(yield g(s.Null,u,b,v))}function*L(u,A,b,v){if(!n.TypeSystemPolicy.IsNumberLike(v))return yield g(s.Number,u,b,v);c(u.exclusiveMaximum)&&!(v<u.exclusiveMaximum)&&(yield g(s.NumberExclusiveMaximum,u,b,v)),c(u.exclusiveMinimum)&&!(v>u.exclusiveMinimum)&&(yield g(s.NumberExclusiveMinimum,u,b,v)),c(u.maximum)&&!(v<=u.maximum)&&(yield g(s.NumberMaximum,u,b,v)),c(u.minimum)&&!(v>=u.minimum)&&(yield g(s.NumberMinimum,u,b,v)),c(u.multipleOf)&&v%u.multipleOf!==0&&(yield g(s.NumberMultipleOf,u,b,v))}function*ee(u,A,b,v){if(!n.TypeSystemPolicy.IsObjectLike(v))return yield g(s.Object,u,b,v);c(u.minProperties)&&!(Object.getOwnPropertyNames(v).length>=u.minProperties)&&(yield g(s.ObjectMinProperties,u,b,v)),c(u.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=u.maxProperties)&&(yield g(s.ObjectMaxProperties,u,b,v));let N=Array.isArray(u.required)?u.required:[],q=Object.getOwnPropertyNames(u.properties),te=Object.getOwnPropertyNames(v);for(let ne of N)te.includes(ne)||(yield g(s.ObjectRequiredProperty,u.properties[ne],`${b}/${l(ne)}`,void 0));if(u.additionalProperties===!1)for(let ne of te)q.includes(ne)||(yield g(s.ObjectAdditionalProperties,u,`${b}/${l(ne)}`,v[ne]));if(typeof u.additionalProperties=="object")for(let ne of te)q.includes(ne)||(yield*T(u.additionalProperties,A,`${b}/${l(ne)}`,v[ne]));for(let ne of q){let ge=u.properties[ne];u.required&&u.required.includes(ne)?(yield*T(ge,A,`${b}/${l(ne)}`,v[ne]),o.ExtendsUndefined.Check(u)&&!(ne in v)&&(yield g(s.ObjectRequiredProperty,ge,`${b}/${l(ne)}`,void 0))):n.TypeSystemPolicy.IsExactOptionalProperty(v,ne)&&(yield*T(ge,A,`${b}/${l(ne)}`,v[ne]))}}function*oe(u,A,b,v){(0,t.IsPromise)(v)||(yield g(s.Promise,u,b,v))}function*Q(u,A,b,v){if(!n.TypeSystemPolicy.IsRecordLike(v))return yield g(s.Object,u,b,v);c(u.minProperties)&&!(Object.getOwnPropertyNames(v).length>=u.minProperties)&&(yield g(s.ObjectMinProperties,u,b,v)),c(u.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=u.maxProperties)&&(yield g(s.ObjectMaxProperties,u,b,v));let[N,q]=Object.entries(u.patternProperties)[0],te=new RegExp(N);for(let[ne,ge]of Object.entries(v))te.test(ne)&&(yield*T(q,A,`${b}/${l(ne)}`,ge));if(typeof u.additionalProperties=="object")for(let[ne,ge]of Object.entries(v))te.test(ne)||(yield*T(u.additionalProperties,A,`${b}/${l(ne)}`,ge));if(u.additionalProperties===!1){for(let[ne,ge]of Object.entries(v))if(!te.test(ne))return yield g(s.ObjectAdditionalProperties,u,`${b}/${l(ne)}`,ge)}}function*ae(u,A,b,v){yield*T((0,r.Deref)(u,A),A,b,v)}function*D(u,A,b,v){if(!(0,t.IsString)(v))return yield g(s.String,u,b,v);c(u.minLength)&&!(v.length>=u.minLength)&&(yield g(s.StringMinLength,u,b,v)),c(u.maxLength)&&!(v.length<=u.maxLength)&&(yield g(s.StringMaxLength,u,b,v)),(0,t.IsString)(u.pattern)&&(new RegExp(u.pattern).test(v)||(yield g(s.StringPattern,u,b,v))),(0,t.IsString)(u.format)&&(o.FormatRegistry.Has(u.format)?o.FormatRegistry.Get(u.format)(v)||(yield g(s.StringFormat,u,b,v)):yield g(s.StringFormatUnknown,u,b,v))}function*H(u,A,b,v){(0,t.IsSymbol)(v)||(yield g(s.Symbol,u,b,v))}function*Y(u,A,b,v){if(!(0,t.IsString)(v))return yield g(s.String,u,b,v);new RegExp(u.pattern).test(v)||(yield g(s.StringPattern,u,b,v))}function*he(u,A,b,v){yield*T((0,r.Deref)(u,A),A,b,v)}function*f(u,A,b,v){if(!(0,t.IsArray)(v))return yield g(s.Tuple,u,b,v);if(u.items===void 0&&v.length!==0)return yield g(s.TupleLength,u,b,v);if(v.length!==u.maxItems)return yield g(s.TupleLength,u,b,v);if(u.items)for(let N=0;N<u.items.length;N++)yield*T(u.items[N],A,`${b}/${N}`,v[N])}function*_(u,A,b,v){(0,t.IsUndefined)(v)||(yield g(s.Undefined,u,b,v))}function*E(u,A,b,v){let N=0;for(let q of u.anyOf){let te=[...T(q,A,b,v)];if(te.length===0)return;N+=te.length}N>0&&(yield g(s.Union,u,b,v))}function*U(u,A,b,v){if(!(0,t.IsUint8Array)(v))return yield g(s.Uint8Array,u,b,v);c(u.maxByteLength)&&!(v.length<=u.maxByteLength)&&(yield g(s.Uint8ArrayMaxByteLength,u,b,v)),c(u.minByteLength)&&!(v.length>=u.minByteLength)&&(yield g(s.Uint8ArrayMinByteLength,u,b,v))}function*P(u,A,b,v){}function*$(u,A,b,v){n.TypeSystemPolicy.IsVoidLike(v)||(yield g(s.Void,u,b,v))}function*y(u,A,b,v){o.TypeRegistry.Get(u[o.Kind])(u,v)||(yield g(s.Kind,u,b,v))}function*T(u,A,b,v){let N=c(u.$id)?[...A,u]:A,q=u;switch(q[o.Kind]){case"Any":return yield*C(q,N,b,v);case"Array":return yield*I(q,N,b,v);case"AsyncIterator":return yield*S(q,N,b,v);case"BigInt":return yield*z(q,N,b,v);case"Boolean":return yield*J(q,N,b,v);case"Constructor":return yield*F(q,N,b,v);case"Date":return yield*k(q,N,b,v);case"Function":return yield*K(q,N,b,v);case"Integer":return yield*W(q,N,b,v);case"Intersect":return yield*j(q,N,b,v);case"Iterator":return yield*Z(q,N,b,v);case"Literal":return yield*G(q,N,b,v);case"Never":return yield*fe(q,N,b,v);case"Not":return yield*x(q,N,b,v);case"Null":return yield*M(q,N,b,v);case"Number":return yield*L(q,N,b,v);case"Object":return yield*ee(q,N,b,v);case"Promise":return yield*oe(q,N,b,v);case"Record":return yield*Q(q,N,b,v);case"Ref":return yield*ae(q,N,b,v);case"String":return yield*D(q,N,b,v);case"Symbol":return yield*H(q,N,b,v);case"TemplateLiteral":return yield*Y(q,N,b,v);case"This":return yield*he(q,N,b,v);case"Tuple":return yield*f(q,N,b,v);case"Undefined":return yield*_(q,N,b,v);case"Union":return yield*E(q,N,b,v);case"Uint8Array":return yield*U(q,N,b,v);case"Unknown":return yield*P(q,N,b,v);case"Void":return yield*$(q,N,b,v);default:if(!o.TypeRegistry.Has(q[o.Kind]))throw new a(u);return yield*y(q,N,b,v)}}function w(...u){let A=u.length===3?T(u[0],u[1],"",u[2]):T(u[0],[],"",u[1]);return new d(A)}e.Errors=w}}),ry=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(r,i,o,s){s===void 0&&(s=o);var a=Object.getOwnPropertyDescriptor(i,o);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(r,s,a)}:function(r,i,o,s){s===void 0&&(s=o),r[s]=i[o]}),n=e&&e.__exportStar||function(r,i){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(To(),e)}}),bl=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(o,s);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(i,a,l)}:function(i,o,s,a){a===void 0&&(a=s),i[a]=o[s]}),n=e&&e.__exportStar||function(i,o){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,i,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var r=To();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return r.ValueErrorType}}),n(vl(),e)}}),iy=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/check.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=Ir(),n=bl(),r=wo(),i=Xs(),o=sn(),s=class extends o.TypeBoxError{constructor(y){super("Unknown type"),this.schema=y}};e.ValueCheckUnknownTypeError=s;function a(y){return y[o.Kind]==="Any"||y[o.Kind]==="Unknown"}function l(y){return y!==void 0}function c(y,T,w){return!0}function d(y,T,w){if(!(0,t.IsArray)(w)||l(y.minItems)&&!(w.length>=y.minItems)||l(y.maxItems)&&!(w.length<=y.maxItems)||!w.every(b=>P(y.items,T,b))||y.uniqueItems===!0&&!function(){let b=new Set;for(let v of w){let N=(0,i.Hash)(v);if(b.has(N))return!1;b.add(N)}return!0}())return!1;if(!(l(y.contains)||(0,t.IsNumber)(y.minContains)||(0,t.IsNumber)(y.maxContains)))return!0;let u=l(y.contains)?y.contains:o.Type.Never(),A=w.reduce((b,v)=>P(u,T,v)?b+1:b,0);return!(A===0||(0,t.IsNumber)(y.minContains)&&A<y.minContains||(0,t.IsNumber)(y.maxContains)&&A>y.maxContains)}function g(y,T,w){return(0,t.IsAsyncIterator)(w)}function C(y,T,w){return!(!(0,t.IsBigInt)(w)||l(y.exclusiveMaximum)&&!(w<y.exclusiveMaximum)||l(y.exclusiveMinimum)&&!(w>y.exclusiveMinimum)||l(y.maximum)&&!(w<=y.maximum)||l(y.minimum)&&!(w>=y.minimum)||l(y.multipleOf)&&w%y.multipleOf!==BigInt(0))}function I(y,T,w){return(0,t.IsBoolean)(w)}function S(y,T,w){return P(y.returns,T,w.prototype)}function z(y,T,w){return!(!(0,t.IsDate)(w)||l(y.exclusiveMaximumTimestamp)&&!(w.getTime()<y.exclusiveMaximumTimestamp)||l(y.exclusiveMinimumTimestamp)&&!(w.getTime()>y.exclusiveMinimumTimestamp)||l(y.maximumTimestamp)&&!(w.getTime()<=y.maximumTimestamp)||l(y.minimumTimestamp)&&!(w.getTime()>=y.minimumTimestamp)||l(y.multipleOfTimestamp)&&w.getTime()%y.multipleOfTimestamp!==0)}function J(y,T,w){return(0,t.IsFunction)(w)}function F(y,T,w){return!(!(0,t.IsInteger)(w)||l(y.exclusiveMaximum)&&!(w<y.exclusiveMaximum)||l(y.exclusiveMinimum)&&!(w>y.exclusiveMinimum)||l(y.maximum)&&!(w<=y.maximum)||l(y.minimum)&&!(w>=y.minimum)||l(y.multipleOf)&&w%y.multipleOf!==0)}function k(y,T,w){let u=y.allOf.every(A=>P(A,T,w));if(y.unevaluatedProperties===!1){let A=new RegExp(o.KeyResolver.ResolvePattern(y)),b=Object.getOwnPropertyNames(w).every(v=>A.test(v));return u&&b}else if(o.TypeGuard.TSchema(y.unevaluatedProperties)){let A=new RegExp(o.KeyResolver.ResolvePattern(y)),b=Object.getOwnPropertyNames(w).every(v=>A.test(v)||P(y.unevaluatedProperties,T,w[v]));return u&&b}else return u}function K(y,T,w){return(0,t.IsIterator)(w)}function W(y,T,w){return w===y.const}function j(y,T,w){return!1}function Z(y,T,w){return!P(y.not,T,w)}function G(y,T,w){return(0,t.IsNull)(w)}function fe(y,T,w){return!(!n.TypeSystemPolicy.IsNumberLike(w)||l(y.exclusiveMaximum)&&!(w<y.exclusiveMaximum)||l(y.exclusiveMinimum)&&!(w>y.exclusiveMinimum)||l(y.minimum)&&!(w>=y.minimum)||l(y.maximum)&&!(w<=y.maximum)||l(y.multipleOf)&&w%y.multipleOf!==0)}function x(y,T,w){if(!n.TypeSystemPolicy.IsObjectLike(w)||l(y.minProperties)&&!(Object.getOwnPropertyNames(w).length>=y.minProperties)||l(y.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=y.maxProperties))return!1;let u=Object.getOwnPropertyNames(y.properties);for(let A of u){let b=y.properties[A];if(y.required&&y.required.includes(A)){if(!P(b,T,w[A])||(o.ExtendsUndefined.Check(b)||a(b))&&!(A in w))return!1}else if(n.TypeSystemPolicy.IsExactOptionalProperty(w,A)&&!P(b,T,w[A]))return!1}if(y.additionalProperties===!1){let A=Object.getOwnPropertyNames(w);return y.required&&y.required.length===u.length&&A.length===u.length?!0:A.every(b=>u.includes(b))}else return typeof y.additionalProperties=="object"?Object.getOwnPropertyNames(w).every(b=>u.includes(b)||P(y.additionalProperties,T,w[b])):!0}function M(y,T,w){return(0,t.IsPromise)(w)}function L(y,T,w){if(!n.TypeSystemPolicy.IsRecordLike(w)||l(y.minProperties)&&!(Object.getOwnPropertyNames(w).length>=y.minProperties)||l(y.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=y.maxProperties))return!1;let[u,A]=Object.entries(y.patternProperties)[0],b=new RegExp(u),v=Object.entries(w).every(([te,ne])=>b.test(te)?P(A,T,ne):!0),N=typeof y.additionalProperties=="object"?Object.entries(w).every(([te,ne])=>b.test(te)?!0:P(y.additionalProperties,T,ne)):!0,q=y.additionalProperties===!1?Object.getOwnPropertyNames(w).every(te=>b.test(te)):!0;return v&&N&&q}function ee(y,T,w){return P((0,r.Deref)(y,T),T,w)}function oe(y,T,w){return!(0,t.IsString)(w)||l(y.minLength)&&!(w.length>=y.minLength)||l(y.maxLength)&&!(w.length<=y.maxLength)||l(y.pattern)&&!new RegExp(y.pattern).test(w)?!1:l(y.format)?o.FormatRegistry.Has(y.format)?o.FormatRegistry.Get(y.format)(w):!1:!0}function Q(y,T,w){return(0,t.IsSymbol)(w)}function ae(y,T,w){return(0,t.IsString)(w)&&new RegExp(y.pattern).test(w)}function D(y,T,w){return P((0,r.Deref)(y,T),T,w)}function H(y,T,w){if(!(0,t.IsArray)(w)||y.items===void 0&&w.length!==0||w.length!==y.maxItems)return!1;if(!y.items)return!0;for(let u=0;u<y.items.length;u++)if(!P(y.items[u],T,w[u]))return!1;return!0}function Y(y,T,w){return(0,t.IsUndefined)(w)}function he(y,T,w){return y.anyOf.some(u=>P(u,T,w))}function f(y,T,w){return!(!(0,t.IsUint8Array)(w)||l(y.maxByteLength)&&!(w.length<=y.maxByteLength)||l(y.minByteLength)&&!(w.length>=y.minByteLength))}function _(y,T,w){return!0}function E(y,T,w){return n.TypeSystemPolicy.IsVoidLike(w)}function U(y,T,w){return o.TypeRegistry.Has(y[o.Kind])?o.TypeRegistry.Get(y[o.Kind])(y,w):!1}function P(y,T,w){let u=l(y.$id)?[...T,y]:T,A=y;switch(A[o.Kind]){case"Any":return c(A,u,w);case"Array":return d(A,u,w);case"AsyncIterator":return g(A,u,w);case"BigInt":return C(A,u,w);case"Boolean":return I(A,u,w);case"Constructor":return S(A,u,w);case"Date":return z(A,u,w);case"Function":return J(A,u,w);case"Integer":return F(A,u,w);case"Intersect":return k(A,u,w);case"Iterator":return K(A,u,w);case"Literal":return W(A,u,w);case"Never":return j(A,u,w);case"Not":return Z(A,u,w);case"Null":return G(A,u,w);case"Number":return fe(A,u,w);case"Object":return x(A,u,w);case"Promise":return M(A,u,w);case"Record":return L(A,u,w);case"Ref":return ee(A,u,w);case"String":return oe(A,u,w);case"Symbol":return Q(A,u,w);case"TemplateLiteral":return ae(A,u,w);case"This":return D(A,u,w);case"Tuple":return H(A,u,w);case"Undefined":return Y(A,u,w);case"Union":return he(A,u,w);case"Uint8Array":return f(A,u,w);case"Unknown":return _(A,u,w);case"Void":return E(A,u,w);default:if(!o.TypeRegistry.Has(A[o.Kind]))throw new s(A);return U(A,u,w)}}function $(...y){return y.length===3?P(y[0],y[1],y[2]):P(y[0],[],y[1])}e.Check=$}}),oy=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/transform.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodeTransform=e.DecodeTransform=e.HasTransform=e.TransformEncodeError=e.TransformDecodeError=e.TransformEncodeCheckError=e.TransformDecodeCheckError=void 0;var t=Ir(),n=wo(),r=iy(),i=sn(),o=class extends i.TypeBoxError{constructor(C,I,S){super("Unable to decode due to invalid value"),this.schema=C,this.value=I,this.error=S}};e.TransformDecodeCheckError=o;var s=class extends i.TypeBoxError{constructor(C,I,S){super("Unable to encode due to invalid value"),this.schema=C,this.value=I,this.error=S}};e.TransformEncodeCheckError=s;var a=class extends i.TypeBoxError{constructor(C,I,S){super(`${S instanceof Error?S.message:"Unknown error"}`),this.schema=C,this.value=I}};e.TransformDecodeError=a;var l=class extends i.TypeBoxError{constructor(C,I,S){super(`${S instanceof Error?S.message:"Unknown error"}`),this.schema=C,this.value=I}};e.TransformEncodeError=l;var c;(function(C){function I(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.items,ae)}function S(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.items,ae)}function z(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.returns,ae)||Q.parameters.some(D=>L(D,ae))}function J(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.returns,ae)||Q.parameters.some(D=>L(D,ae))}function F(Q,ae){return i.TypeGuard.TTransform(Q)||i.TypeGuard.TTransform(Q.unevaluatedProperties)||Q.allOf.some(D=>L(D,ae))}function k(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.items,ae)}function K(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.not,ae)}function W(Q,ae){return i.TypeGuard.TTransform(Q)||Object.values(Q.properties).some(D=>L(D,ae))||i.TypeGuard.TSchema(Q.additionalProperties)&&L(Q.additionalProperties,ae)}function j(Q,ae){return i.TypeGuard.TTransform(Q)||L(Q.item,ae)}function Z(Q,ae){let D=Object.getOwnPropertyNames(Q.patternProperties)[0],H=Q.patternProperties[D];return i.TypeGuard.TTransform(Q)||L(H,ae)||i.TypeGuard.TSchema(Q.additionalProperties)&&i.TypeGuard.TTransform(Q.additionalProperties)}function G(Q,ae){return i.TypeGuard.TTransform(Q)?!0:L((0,n.Deref)(Q,ae),ae)}function fe(Q,ae){return i.TypeGuard.TTransform(Q)?!0:L((0,n.Deref)(Q,ae),ae)}function x(Q,ae){return i.TypeGuard.TTransform(Q)||!(0,t.IsUndefined)(Q.items)&&Q.items.some(D=>L(D,ae))}function M(Q,ae){return i.TypeGuard.TTransform(Q)||Q.anyOf.some(D=>L(D,ae))}function L(Q,ae){let D=(0,t.IsString)(Q.$id)?[...ae,Q]:ae,H=Q;if(Q.$id&&ee.has(Q.$id))return!1;switch(Q.$id&&ee.add(Q.$id),Q[i.Kind]){case"Array":return I(H,D);case"AsyncIterator":return S(H,D);case"Constructor":return z(H,D);case"Function":return J(H,D);case"Intersect":return F(H,D);case"Iterator":return k(H,D);case"Not":return K(H,D);case"Object":return W(H,D);case"Promise":return j(H,D);case"Record":return Z(H,D);case"Ref":return G(H,D);case"This":return fe(H,D);case"Tuple":return x(H,D);case"Union":return M(H,D);default:return i.TypeGuard.TTransform(Q)}}let ee=new Set;function oe(Q,ae){return ee.clear(),L(Q,ae)}C.Has=oe})(c||(e.HasTransform=c={}));var d;(function(C){function I(x,M){try{return i.TypeGuard.TTransform(x)?x[i.Transform].Decode(M):M}catch(L){throw new a(x,M,L)}}function S(x,M,L){return(0,t.IsArray)(L)?I(x,L.map(ee=>G(x.items,M,ee))):I(x,L)}function z(x,M,L){if(!(0,t.IsPlainObject)(L)||(0,t.IsValueType)(L))return I(x,L);let ee=i.KeyResolver.ResolveKeys(x,{includePatterns:!1}),oe=ee.reduce((H,Y)=>Y in H?{...H,[Y]:G(i.IndexedAccessor.Resolve(x,[Y]),M,H[Y])}:H,L);if(!i.TypeGuard.TTransform(x.unevaluatedProperties))return I(x,oe);let Q=Object.getOwnPropertyNames(oe),ae=x.unevaluatedProperties,D=Q.reduce((H,Y)=>ee.includes(Y)?H:{...H,[Y]:I(ae,H[Y])},oe);return I(x,D)}function J(x,M,L){return I(x,G(x.not,M,L))}function F(x,M,L){if(!(0,t.IsPlainObject)(L))return I(x,L);let ee=i.KeyResolver.ResolveKeys(x,{includePatterns:!1}),oe=ee.reduce((H,Y)=>Y in H?{...H,[Y]:G(x.properties[Y],M,H[Y])}:H,L);if(!i.TypeGuard.TSchema(x.additionalProperties))return I(x,oe);let Q=Object.getOwnPropertyNames(oe),ae=x.additionalProperties,D=Q.reduce((H,Y)=>ee.includes(Y)?H:{...H,[Y]:I(ae,H[Y])},oe);return I(x,D)}function k(x,M,L){if(!(0,t.IsPlainObject)(L))return I(x,L);let ee=Object.getOwnPropertyNames(x.patternProperties)[0],oe=new RegExp(ee),Q=Object.getOwnPropertyNames(L).reduce((Y,he)=>oe.test(he)?{...Y,[he]:G(x.patternProperties[ee],M,Y[he])}:Y,L);if(!i.TypeGuard.TSchema(x.additionalProperties))return I(x,Q);let ae=Object.getOwnPropertyNames(Q),D=x.additionalProperties,H=ae.reduce((Y,he)=>oe.test(he)?Y:{...Y,[he]:I(D,Y[he])},Q);return I(x,H)}function K(x,M,L){let ee=(0,n.Deref)(x,M);return I(x,G(ee,M,L))}function W(x,M,L){let ee=(0,n.Deref)(x,M);return I(x,G(ee,M,L))}function j(x,M,L){return(0,t.IsArray)(L)&&(0,t.IsArray)(x.items)?I(x,x.items.map((ee,oe)=>G(ee,M,L[oe]))):I(x,L)}function Z(x,M,L){let ee=I(x,L);for(let oe of x.anyOf)if((0,r.Check)(oe,M,ee))return G(oe,M,ee);return ee}function G(x,M,L){let ee=typeof x.$id=="string"?[...M,x]:M,oe=x;switch(x[i.Kind]){case"Array":return S(oe,ee,L);case"Intersect":return z(oe,ee,L);case"Not":return J(oe,ee,L);case"Object":return F(oe,ee,L);case"Record":return k(oe,ee,L);case"Ref":return K(oe,ee,L);case"Symbol":return I(oe,L);case"This":return W(oe,ee,L);case"Tuple":return j(oe,ee,L);case"Union":return Z(oe,ee,L);default:return I(oe,L)}}function fe(x,M,L){return G(x,M,L)}C.Decode=fe})(d||(e.DecodeTransform=d={}));var g;(function(C){function I(x,M){try{return i.TypeGuard.TTransform(x)?x[i.Transform].Encode(M):M}catch(L){throw new l(x,M,L)}}function S(x,M,L){let ee=I(x,L);return(0,t.IsArray)(ee)?ee.map(oe=>G(x.items,M,oe)):ee}function z(x,M,L){let ee=I(x,L);if(!(0,t.IsPlainObject)(L)||(0,t.IsValueType)(L))return ee;let oe=i.KeyResolver.ResolveKeys(x,{includePatterns:!1}),Q=oe.reduce((H,Y)=>Y in ee?{...H,[Y]:G(i.IndexedAccessor.Resolve(x,[Y]),M,H[Y])}:H,ee);if(!i.TypeGuard.TTransform(x.unevaluatedProperties))return I(x,Q);let ae=Object.getOwnPropertyNames(Q),D=x.unevaluatedProperties;return ae.reduce((H,Y)=>oe.includes(Y)?H:{...H,[Y]:I(D,H[Y])},Q)}function J(x,M,L){return I(x.not,I(x,L))}function F(x,M,L){let ee=I(x,L);if(!(0,t.IsPlainObject)(L))return ee;let oe=i.KeyResolver.ResolveKeys(x,{includePatterns:!1}),Q=oe.reduce((H,Y)=>Y in H?{...H,[Y]:G(x.properties[Y],M,H[Y])}:H,ee);if(!i.TypeGuard.TSchema(x.additionalProperties))return Q;let ae=Object.getOwnPropertyNames(Q),D=x.additionalProperties;return ae.reduce((H,Y)=>oe.includes(Y)?H:{...H,[Y]:I(D,H[Y])},Q)}function k(x,M,L){let ee=I(x,L);if(!(0,t.IsPlainObject)(L))return ee;let oe=Object.getOwnPropertyNames(x.patternProperties)[0],Q=new RegExp(oe),ae=Object.getOwnPropertyNames(L).reduce((Y,he)=>Q.test(he)?{...Y,[he]:G(x.patternProperties[oe],M,Y[he])}:Y,ee);if(!i.TypeGuard.TSchema(x.additionalProperties))return I(x,ae);let D=Object.getOwnPropertyNames(ae),H=x.additionalProperties;return D.reduce((Y,he)=>Q.test(he)?Y:{...Y,[he]:I(H,Y[he])},ae)}function K(x,M,L){let ee=(0,n.Deref)(x,M),oe=G(ee,M,L);return I(x,oe)}function W(x,M,L){let ee=(0,n.Deref)(x,M),oe=G(ee,M,L);return I(x,oe)}function j(x,M,L){let ee=I(x,L);return(0,t.IsArray)(x.items)?x.items.map((oe,Q)=>G(oe,M,ee[Q])):[]}function Z(x,M,L){for(let ee of x.anyOf){if(!(0,r.Check)(ee,M,L))continue;let oe=G(ee,M,L);return I(x,oe)}for(let ee of x.anyOf){let oe=G(ee,M,L);if((0,r.Check)(x,M,oe))return I(x,oe)}return I(x,L)}function G(x,M,L){let ee=typeof x.$id=="string"?[...M,x]:M,oe=x;switch(x[i.Kind]){case"Array":return S(oe,ee,L);case"Intersect":return z(oe,ee,L);case"Not":return J(oe,ee,L);case"Object":return F(oe,ee,L);case"Record":return k(oe,ee,L);case"Ref":return K(oe,ee,L);case"This":return W(oe,ee,L);case"Tuple":return j(oe,ee,L);case"Union":return Z(oe,ee,L);default:return I(oe,L)}}function fe(x,M,L){return G(x,M,L)}C.Encode=fe})(g||(e.EncodeTransform=g={}))}}),sy=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/compiler.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=oy(),n=Ir(),r=To(),i=bl(),o=wo(),s=Xs(),a=sn(),l=class{constructor(F,k,K,W){this.schema=F,this.references=k,this.checkFunc=K,this.code=W,this.hasTransform=t.HasTransform.Has(F,k)}Code(){return this.code}Errors(F){return(0,r.Errors)(this.schema,this.references,F)}Check(F){return this.checkFunc(F)}Decode(F){if(!this.checkFunc(F))throw new t.TransformDecodeCheckError(this.schema,F,this.Errors(F).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,F):F}Encode(F){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,F):F;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,F,this.Errors(F).First());return k}};e.TypeCheck=l;var c;(function(F){function k(Z){return Z===36}F.DollarSign=k;function K(Z){return Z===95}F.IsUnderscore=K;function W(Z){return Z>=65&&Z<=90||Z>=97&&Z<=122}F.IsAlpha=W;function j(Z){return Z>=48&&Z<=57}F.IsNumeric=j})(c||(c={}));var d;(function(F){function k(Z){return Z.length===0?!1:c.IsNumeric(Z.charCodeAt(0))}function K(Z){if(k(Z))return!1;for(let G=0;G<Z.length;G++){let fe=Z.charCodeAt(G);if(!(c.IsAlpha(fe)||c.IsNumeric(fe)||c.DollarSign(fe)||c.IsUnderscore(fe)))return!1}return!0}function W(Z){return Z.replace(/'/g,"\\'")}function j(Z,G){return K(G)?`${Z}.${G}`:`${Z}['${W(G)}']`}F.Encode=j})(d||(d={}));var g;(function(F){function k(K){let W=[];for(let j=0;j<K.length;j++){let Z=K.charCodeAt(j);c.IsNumeric(Z)||c.IsAlpha(Z)?W.push(K.charAt(j)):W.push(`_${Z}_`)}return W.join("").replace(/__/g,"_")}F.Encode=k})(g||(g={}));var C;(function(F){function k(K){return K.replace(/'/g,"\\'")}F.Escape=k})(C||(C={}));var I=class extends a.TypeBoxError{constructor(F){super("Unknown type"),this.schema=F}};e.TypeCompilerUnknownTypeError=I;var S=class extends a.TypeBoxError{constructor(F){super("Preflight validation check failed to guard for the given schema"),this.schema=F}};e.TypeCompilerTypeGuardError=S;var z;(function(F){function k(G,fe,x){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${fe}' in ${G} ? ${x} : true)`:`(${d.Encode(G,fe)} !== undefined ? ${x} : true)`}F.IsExactOptionalProperty=k;function K(G){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${G} === 'object' && ${G} !== null)`:`(typeof ${G} === 'object' && ${G} !== null && !Array.isArray(${G}))`}F.IsObjectLike=K;function W(G){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${G} === 'object' && ${G} !== null && !(${G} instanceof Date) && !(${G} instanceof Uint8Array))`:`(typeof ${G} === 'object' && ${G} !== null && !Array.isArray(${G}) && !(${G} instanceof Date) && !(${G} instanceof Uint8Array))`}F.IsRecordLike=W;function j(G){return i.TypeSystemPolicy.AllowNaN?`typeof ${G} === 'number'`:`(typeof ${G} === 'number' && Number.isFinite(${G}))`}F.IsNumberLike=j;function Z(G){return i.TypeSystemPolicy.AllowNullVoid?`(${G} === undefined || ${G} === null)`:`${G} === undefined`}F.IsVoidLike=Z})(z||(e.Policy=z={}));var J;(function(F){function k(O){return O[a.Kind]==="Any"||O[a.Kind]==="Unknown"}function*K(O,le,R){yield"true"}function*W(O,le,R){yield`Array.isArray(${R})`;let[me,re]=[Fe("value","any"),Fe("acc","number")];(0,n.IsNumber)(O.maxItems)&&(yield`${R}.length <= ${O.maxItems}`),(0,n.IsNumber)(O.minItems)&&(yield`${R}.length >= ${O.minItems}`);let de=ne(O.items,le,"value");if(yield`${R}.every((${me}) => ${de})`,a.TypeGuard.TSchema(O.contains)||(0,n.IsNumber)(O.minContains)||(0,n.IsNumber)(O.maxContains)){let Se=a.TypeGuard.TSchema(O.contains)?O.contains:a.Type.Never(),ke=ne(Se,le,"value"),rt=(0,n.IsNumber)(O.minContains)?[`(count >= ${O.minContains})`]:[],et=(0,n.IsNumber)(O.maxContains)?[`(count <= ${O.maxContains})`]:[],ot=`const count = value.reduce((${re}, ${me}) => ${ke} ? acc + 1 : acc, 0)`,Zt=["(count > 0)",...rt,...et].join(" && ");yield`((${me}) => { ${ot}; return ${Zt}})(${R})`}O.uniqueItems===!0&&(yield`((${me}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${R})`)}function*j(O,le,R){yield`(typeof value === 'object' && Symbol.asyncIterator in ${R})`}function*Z(O,le,R){yield`(typeof ${R} === 'bigint')`,(0,n.IsBigInt)(O.exclusiveMaximum)&&(yield`${R} < BigInt(${O.exclusiveMaximum})`),(0,n.IsBigInt)(O.exclusiveMinimum)&&(yield`${R} > BigInt(${O.exclusiveMinimum})`),(0,n.IsBigInt)(O.maximum)&&(yield`${R} <= BigInt(${O.maximum})`),(0,n.IsBigInt)(O.minimum)&&(yield`${R} >= BigInt(${O.minimum})`),(0,n.IsBigInt)(O.multipleOf)&&(yield`(${R} % BigInt(${O.multipleOf})) === 0`)}function*G(O,le,R){yield`(typeof ${R} === 'boolean')`}function*fe(O,le,R){yield*q(O.returns,le,`${R}.prototype`)}function*x(O,le,R){yield`(${R} instanceof Date) && Number.isFinite(${R}.getTime())`,(0,n.IsNumber)(O.exclusiveMaximumTimestamp)&&(yield`${R}.getTime() < ${O.exclusiveMaximumTimestamp}`),(0,n.IsNumber)(O.exclusiveMinimumTimestamp)&&(yield`${R}.getTime() > ${O.exclusiveMinimumTimestamp}`),(0,n.IsNumber)(O.maximumTimestamp)&&(yield`${R}.getTime() <= ${O.maximumTimestamp}`),(0,n.IsNumber)(O.minimumTimestamp)&&(yield`${R}.getTime() >= ${O.minimumTimestamp}`),(0,n.IsNumber)(O.multipleOfTimestamp)&&(yield`(${R}.getTime() % ${O.multipleOfTimestamp}) === 0`)}function*M(O,le,R){yield`(typeof ${R} === 'function')`}function*L(O,le,R){yield`(typeof ${R} === 'number' && Number.isInteger(${R}))`,(0,n.IsNumber)(O.exclusiveMaximum)&&(yield`${R} < ${O.exclusiveMaximum}`),(0,n.IsNumber)(O.exclusiveMinimum)&&(yield`${R} > ${O.exclusiveMinimum}`),(0,n.IsNumber)(O.maximum)&&(yield`${R} <= ${O.maximum}`),(0,n.IsNumber)(O.minimum)&&(yield`${R} >= ${O.minimum}`),(0,n.IsNumber)(O.multipleOf)&&(yield`(${R} % ${O.multipleOf}) === 0`)}function*ee(O,le,R){let me=O.allOf.map(re=>ne(re,le,R)).join(" && ");if(O.unevaluatedProperties===!1){let re=be(`${new RegExp(a.KeyResolver.ResolvePattern(O))};`),de=`Object.getOwnPropertyNames(${R}).every(key => ${re}.test(key))`;yield`(${me} && ${de})`}else if(a.TypeGuard.TSchema(O.unevaluatedProperties)){let re=be(`${new RegExp(a.KeyResolver.ResolvePattern(O))};`),de=`Object.getOwnPropertyNames(${R}).every(key => ${re}.test(key) || ${ne(O.unevaluatedProperties,le,`${R}[key]`)})`;yield`(${me} && ${de})`}else yield`(${me})`}function*oe(O,le,R){yield`(typeof value === 'object' && Symbol.iterator in ${R})`}function*Q(O,le,R){typeof O.const=="number"||typeof O.const=="boolean"?yield`(${R} === ${O.const})`:yield`(${R} === '${C.Escape(O.const)}')`}function*ae(O,le,R){yield"false"}function*D(O,le,R){yield`(!${ne(O.not,le,R)})`}function*H(O,le,R){yield`(${R} === null)`}function*Y(O,le,R){yield z.IsNumberLike(R),(0,n.IsNumber)(O.exclusiveMaximum)&&(yield`${R} < ${O.exclusiveMaximum}`),(0,n.IsNumber)(O.exclusiveMinimum)&&(yield`${R} > ${O.exclusiveMinimum}`),(0,n.IsNumber)(O.maximum)&&(yield`${R} <= ${O.maximum}`),(0,n.IsNumber)(O.minimum)&&(yield`${R} >= ${O.minimum}`),(0,n.IsNumber)(O.multipleOf)&&(yield`(${R} % ${O.multipleOf}) === 0`)}function*he(O,le,R){yield z.IsObjectLike(R),(0,n.IsNumber)(O.minProperties)&&(yield`Object.getOwnPropertyNames(${R}).length >= ${O.minProperties}`),(0,n.IsNumber)(O.maxProperties)&&(yield`Object.getOwnPropertyNames(${R}).length <= ${O.maxProperties}`);let me=Object.getOwnPropertyNames(O.properties);for(let re of me){let de=d.Encode(R,re),Se=O.properties[re];if(O.required&&O.required.includes(re))yield*q(Se,le,de),(a.ExtendsUndefined.Check(Se)||k(Se))&&(yield`('${re}' in ${R})`);else{let ke=ne(Se,le,de);yield z.IsExactOptionalProperty(R,re,ke)}}if(O.additionalProperties===!1)if(O.required&&O.required.length===me.length)yield`Object.getOwnPropertyNames(${R}).length === ${me.length}`;else{let re=`[${me.map(de=>`'${de}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${R}).every(key => ${re}.includes(key))`}if(typeof O.additionalProperties=="object"){let re=ne(O.additionalProperties,le,`${R}[key]`),de=`[${me.map(Se=>`'${Se}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${R}).every(key => ${de}.includes(key) || ${re}))`}}function*f(O,le,R){yield`(typeof value === 'object' && typeof ${R}.then === 'function')`}function*_(O,le,R){yield z.IsRecordLike(R),(0,n.IsNumber)(O.minProperties)&&(yield`Object.getOwnPropertyNames(${R}).length >= ${O.minProperties}`),(0,n.IsNumber)(O.maxProperties)&&(yield`Object.getOwnPropertyNames(${R}).length <= ${O.maxProperties}`);let[me,re]=Object.entries(O.patternProperties)[0],de=be(`${new RegExp(me)}`),Se=ne(re,le,"value"),ke=a.TypeGuard.TSchema(O.additionalProperties)?ne(O.additionalProperties,le,R):O.additionalProperties===!1?"false":"true",rt=`(${de}.test(key) ? ${Se} : ${ke})`;yield`(Object.entries(${R}).every(([key, value]) => ${rt}))`}function*E(O,le,R){let me=(0,o.Deref)(O,le);if(te.functions.has(O.$ref))return yield`${ge(O.$ref)}(${R})`;yield*q(me,le,R)}function*U(O,le,R){yield`(typeof ${R} === 'string')`,(0,n.IsNumber)(O.maxLength)&&(yield`${R}.length <= ${O.maxLength}`),(0,n.IsNumber)(O.minLength)&&(yield`${R}.length >= ${O.minLength}`),O.pattern!==void 0&&(yield`${be(`${new RegExp(O.pattern)};`)}.test(${R})`),O.format!==void 0&&(yield`format('${O.format}', ${R})`)}function*P(O,le,R){yield`(typeof ${R} === 'symbol')`}function*$(O,le,R){yield`(typeof ${R} === 'string')`,yield`${be(`${new RegExp(O.pattern)};`)}.test(${R})`}function*y(O,le,R){yield`${ge(O.$ref)}(${R})`}function*T(O,le,R){if(yield`Array.isArray(${R})`,O.items===void 0)return yield`${R}.length === 0`;yield`(${R}.length === ${O.maxItems})`;for(let me=0;me<O.items.length;me++)yield`${ne(O.items[me],le,`${R}[${me}]`)}`}function*w(O,le,R){yield`${R} === undefined`}function*u(O,le,R){yield`(${O.anyOf.map(re=>ne(re,le,R)).join(" || ")})`}function*A(O,le,R){yield`${R} instanceof Uint8Array`,(0,n.IsNumber)(O.maxByteLength)&&(yield`(${R}.length <= ${O.maxByteLength})`),(0,n.IsNumber)(O.minByteLength)&&(yield`(${R}.length >= ${O.minByteLength})`)}function*b(O,le,R){yield"true"}function*v(O,le,R){yield z.IsVoidLike(R)}function*N(O,le,R){let me=te.instances.size;te.instances.set(me,O),yield`kind('${O[a.Kind]}', ${me}, ${R})`}function*q(O,le,R,me=!0){let re=(0,n.IsString)(O.$id)?[...le,O]:le,de=O;if(me&&(0,n.IsString)(O.$id)){let Se=ge(O.$id);if(te.functions.has(Se))return yield`${Se}(${R})`;{let ke=Ue(Se,O,le,"value",!1);return te.functions.set(Se,ke),yield`${Se}(${R})`}}switch(de[a.Kind]){case"Any":return yield*K(de,re,R);case"Array":return yield*W(de,re,R);case"AsyncIterator":return yield*j(de,re,R);case"BigInt":return yield*Z(de,re,R);case"Boolean":return yield*G(de,re,R);case"Constructor":return yield*fe(de,re,R);case"Date":return yield*x(de,re,R);case"Function":return yield*M(de,re,R);case"Integer":return yield*L(de,re,R);case"Intersect":return yield*ee(de,re,R);case"Iterator":return yield*oe(de,re,R);case"Literal":return yield*Q(de,re,R);case"Never":return yield*ae(de,re,R);case"Not":return yield*D(de,re,R);case"Null":return yield*H(de,re,R);case"Number":return yield*Y(de,re,R);case"Object":return yield*he(de,re,R);case"Promise":return yield*f(de,re,R);case"Record":return yield*_(de,re,R);case"Ref":return yield*E(de,re,R);case"String":return yield*U(de,re,R);case"Symbol":return yield*P(de,re,R);case"TemplateLiteral":return yield*$(de,re,R);case"This":return yield*y(de,re,R);case"Tuple":return yield*T(de,re,R);case"Undefined":return yield*w(de,re,R);case"Union":return yield*u(de,re,R);case"Uint8Array":return yield*A(de,re,R);case"Unknown":return yield*b(de,re,R);case"Void":return yield*v(de,re,R);default:if(!a.TypeRegistry.Has(de[a.Kind]))throw new I(O);return yield*N(de,re,R)}}let te={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ne(O,le,R,me=!0){return`(${[...q(O,le,R,me)].join(" && ")})`}function ge(O){return`check_${g.Encode(O)}`}function be(O){let le=`local_${te.variables.size}`;return te.variables.set(le,`const ${le} = ${O}`),le}function Ue(O,le,R,me,re=!0){let[de,Se]=[`
|
|
49
|
+
`,ot=>"".padStart(ot," ")],ke=Fe("value","any"),rt=Pn("boolean"),et=[...q(le,R,me,re)].map(ot=>`${Se(4)}${ot}`).join(` &&${de}`);return`function ${O}(${ke})${rt} {${de}${Se(2)}return (${de}${et}${de}${Se(2)})
|
|
50
|
+
}`}function Fe(O,le){let R=te.language==="typescript"?`: ${le}`:"";return`${O}${R}`}function Pn(O){return te.language==="typescript"?`: ${O}`:""}function _e(O,le,R){let me=Ue("check",O,le,"value"),re=Fe("value","any"),de=Pn("boolean"),Se=[...te.functions.values()],ke=[...te.variables.values()],rt=(0,n.IsString)(O.$id)?`return function check(${re})${de} {
|
|
51
51
|
return ${ge(O.$id)}(value)
|
|
52
|
-
}`:`return ${me}`;return[...ke,...Se,
|
|
53
|
-
`)}function
|
|
54
|
-
`)){let i=r.match(/^\s+at\s+(.*)/);if(i){if(n)return i[1].trim().replace(__dirname,"");n=!0}}}};
|
|
52
|
+
}`:`return ${me}`;return[...ke,...Se,rt].join(`
|
|
53
|
+
`)}function pn(...O){let le={language:"javascript"},[R,me,re]=O.length===2&&(0,n.IsArray)(O[1])?[O[0],O[1],le]:O.length===2&&!(0,n.IsArray)(O[1])?[O[0],[],O[1]]:O.length===3?[O[0],O[1],O[2]]:O.length===1?[O[0],[],le]:[null,[],le];if(te.language=re.language,te.variables.clear(),te.functions.clear(),te.instances.clear(),!a.TypeGuard.TSchema(R))throw new S(R);for(let de of me)if(!a.TypeGuard.TSchema(de))throw new S(de);return _e(R,me,re)}F.Code=pn;function Cn(O,le=[]){let R=pn(O,le,{language:"javascript"}),me=globalThis.Function("kind","format","hash",R),re=new Map(te.instances);function de(et,ot,Zt){if(!a.TypeRegistry.Has(et)||!re.has(ot))return!1;let ur=a.TypeRegistry.Get(et),cr=re.get(ot);return ur(cr,Zt)}function Se(et,ot){return a.FormatRegistry.Has(et)?a.FormatRegistry.Get(et)(ot):!1}function ke(et){return(0,s.Hash)(et)}let rt=me(de,Se,ke);return new l(O,le,rt,R)}F.Compile=Cn})(J||(e.TypeCompiler=J={}))}}),ay=Le({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(o,s);(!l||("get"in l?!o.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(i,a,l)}:function(i,o,s,a){a===void 0&&(a=s),i[a]=o[s]}),n=e&&e.__exportStar||function(i,o){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,i,s)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var r=ry();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return r.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return r.ValueErrorIterator}}),n(sy(),e)}}),oo=St(ey(),1),uy=St(ty(),1),_l=!1,wl=!1;oo.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(_l=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(wl=process?.env?.LOGGER_PERF_PREFIX==="true"));var cy={prefix:void 0,time:_l,delta:wl,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Ss=[],Tl=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,n,r){Object.assign(this,{sinceFirst:e,sinceLast:t,time:n,delta:r})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),n=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?t:null,this.delta?n:null].filter(r=>r!=null).join(",")}]`}},Al=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},ii=!1,$e=class ut{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(t=ut.INFO,n={}){n=Object.assign({},cy,n),t>10&&console.debug("setup logger",{config:n});let r=this.wrapLog(console.debug,{...n,dim:n.dimDebugOnServer}),i=(...l)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&r(...l)};i.isDisabled=!0,i.isEnabled=!1;let o=this.wrapLog(console.groupCollapsed,n),s=(l,c)=>{function d(...C){let I=C[C.length-1];return I===i?I():(o(...C.slice(0,-1)),(async()=>{try{let S=I();return S instanceof Promise?await S:S}finally{console.groupEnd()}})())}let g=Object.assign(c.bind({}),{isEnabled:l,isDisabled:!l,group:d,force:c});return l?g:Object.assign(i.bind({}),{isEnabled:l,isDisabled:!l,group:d,force:g})},a=s(t>=ut.ERROR,this.wrapLog(console.error,n));return{ERROR:(...l)=>(a(...l),new Error(l.map(c=>typeof c=="string"?c:(0,uy.default)(c)).join(" "))),WARN:s(t>=ut.WARN,this.wrapLog(console.warn,n)),LOG:s(t>=ut.INFO,this.wrapLog(console.log,n)),DEBUG:s(t>=ut.DEBUG,this.wrapLog(console.log,{...n,dim:n.dimDebugOnServer})),VERBOSE:s(t>=ut.VERBOSE,this.wrapLog(console.debug,{...n,dim:n.dimDebugOnServer}))}}static wrapLog(t,n){if(oo.isNode)return t.bind(console);{let r=[];if(n.time||n.delta){let i=oo.isBrowser&&navigator.userAgent.includes("Chrome")?["",ut.timeStr(!!n.time,!!n.delta)]:[];r.push(...i)}return n.prefix&&(ii?r.push(new Al("dim",n.prefix)):r.push(n.prefix)),t.bind(console,...r)}}static timeStr(t,n,r=0){if(!performance.now)return;let i=performance.now();ut.firstLog||(ut.firstLog=i,ut.lastLog=i);let o=new Tl(i-ut.firstLog,i-ut.lastLog,t,n);return ut.lastLog=i,r?o.toString():o}static getOriginFromStack(t){let n=!1;for(let r of t.split(`
|
|
54
|
+
`)){let i=r.match(/^\s+at\s+(.*)/);if(i){if(n)return i[1].trim().replace(__dirname,"");n=!0}}}};oo.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Ss&&Ss.length){for(let t of Ss)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Tl))return null;ii||(ii=!0);let t=$e.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof Al?(ii||(ii=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var ly=typeof global=="object"&&global&&global.Object===Object&&global,Ol=ly,fy=typeof self=="object"&&self&&self.Object===Object&&self,dy=Ol||fy||Function("return this")(),ht=dy,py=ht.Symbol,Xt=py,El=Object.prototype,hy=El.hasOwnProperty,yy=El.toString,ti=Xt?Xt.toStringTag:void 0;function gy(e){var t=hy.call(e,ti),n=e[ti];try{e[ti]=void 0;var r=!0}catch{}var i=yy.call(e);return r&&(t?e[ti]=n:delete e[ti]),i}var my=gy,vy=Object.prototype,by=vy.toString;function _y(e){return by.call(e)}var wy=_y,Ty="[object Null]",Ay="[object Undefined]",uc=Xt?Xt.toStringTag:void 0;function Oy(e){return e==null?e===void 0?Ay:Ty:uc&&uc in Object(e)?my(e):wy(e)}var Sr=Oy;function Ey(e){return e!=null&&typeof e=="object"}var On=Ey,Iy="[object Symbol]";function Sy(e){return typeof e=="symbol"||On(e)&&Sr(e)==Iy}var Or=Sy;function $y(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var Il=$y,Ny=Array.isArray,Vt=Ny,Ry=1/0,cc=Xt?Xt.prototype:void 0,lc=cc?cc.toString:void 0;function Sl(e){if(typeof e=="string")return e;if(Vt(e))return Il(e,Sl)+"";if(Or(e))return lc?lc.call(e):"";var t=e+"";return t=="0"&&1/e==-Ry?"-0":t}var Py=Sl,Cy=/\s/;function xy(e){for(var t=e.length;t--&&Cy.test(e.charAt(t)););return t}var Uy=xy,My=/^\s+/;function By(e){return e&&e.slice(0,Uy(e)+1).replace(My,"")}var Dy=By;function Ly(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var an=Ly,fc=NaN,ky=/^[-+]0x[0-9a-f]+$/i,jy=/^0b[01]+$/i,Fy=/^0o[0-7]+$/i,zy=parseInt;function Vy(e){if(typeof e=="number")return e;if(Or(e))return fc;if(an(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=an(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Dy(e);var n=jy.test(e);return n||Fy.test(e)?zy(e.slice(2),n?2:8):ky.test(e)?fc:+e}var Ky=Vy,dc=1/0,qy=17976931348623157e292;function Gy(e){if(!e)return e===0?e:0;if(e=Ky(e),e===dc||e===-dc){var t=e<0?-1:1;return t*qy}return e===e?e:0}var Wy=Gy;function Hy(e){var t=Wy(e),n=t%1;return t===t?n?t-n:t:0}var pc=Hy;function Jy(e){return e}var Ao=Jy,Xy="[object AsyncFunction]",Yy="[object Function]",Qy="[object GeneratorFunction]",Zy="[object Proxy]";function eg(e){if(!an(e))return!1;var t=Sr(e);return t==Yy||t==Qy||t==Xy||t==Zy}var $l=eg,tg=ht["__core-js_shared__"],$s=tg,hc=function(){var e=/[^.]+$/.exec($s&&$s.keys&&$s.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ng(e){return!!hc&&hc in e}var rg=ng,ig=Function.prototype,og=ig.toString;function sg(e){if(e!=null){try{return og.call(e)}catch{}try{return e+""}catch{}}return""}var Jn=sg,ag=/[\\^$.*+?()[\]{}|]/g,ug=/^\[object .+?Constructor\]$/,cg=Function.prototype,lg=Object.prototype,fg=cg.toString,dg=lg.hasOwnProperty,pg=RegExp("^"+fg.call(dg).replace(ag,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function hg(e){if(!an(e)||rg(e))return!1;var t=$l(e)?pg:ug;return t.test(Jn(e))}var yg=hg;function gg(e,t){return e?.[t]}var mg=gg;function vg(e,t){var n=mg(e,t);return yg(n)?n:void 0}var Xn=vg,bg=Xn(ht,"WeakMap"),si=bg,_g=si&&new si,so=_g,wg=so?function(e,t){return so.set(e,t),e}:Ao,Nl=wg,yc=Object.create,Tg=function(){function e(){}return function(t){if(!an(t))return{};if(yc)return yc(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),Ys=Tg;function Ag(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Ys(e.prototype),r=e.apply(n,t);return an(r)?r:n}}var ai=Ag,Og=1;function Eg(e,t,n){var r=t&Og,i=ai(e);function o(){var s=this&&this!==ht&&this instanceof o?i:e;return s.apply(r?n:this,arguments)}return o}var Ig=Eg;function Sg(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Qs=Sg,$g=Math.max;function Ng(e,t,n,r){for(var i=-1,o=e.length,s=n.length,a=-1,l=t.length,c=$g(o-s,0),d=Array(l+c),g=!r;++a<l;)d[a]=t[a];for(;++i<s;)(g||i<o)&&(d[n[i]]=e[i]);for(;c--;)d[a++]=e[i++];return d}var Rl=Ng,Rg=Math.max;function Pg(e,t,n,r){for(var i=-1,o=e.length,s=-1,a=n.length,l=-1,c=t.length,d=Rg(o-a,0),g=Array(d+c),C=!r;++i<d;)g[i]=e[i];for(var I=i;++l<c;)g[I+l]=t[l];for(;++s<a;)(C||i<o)&&(g[I+n[s]]=e[i++]);return g}var Pl=Pg;function Cg(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var xg=Cg;function Ug(){}var Zs=Ug,Mg=4294967295;function ao(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Mg,this.__views__=[]}ao.prototype=Ys(Zs.prototype);ao.prototype.constructor=ao;var ea=ao;function Bg(){}var Cl=Bg,Dg=so?function(e){return so.get(e)}:Cl,xl=Dg,Lg={},gc=Lg,kg=Object.prototype,jg=kg.hasOwnProperty;function Fg(e){for(var t=e.name+"",n=gc[t],r=jg.call(gc,t)?n.length:0;r--;){var i=n[r],o=i.func;if(o==null||o==e)return i.name}return t}var zg=Fg;function uo(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}uo.prototype=Ys(Zs.prototype);uo.prototype.constructor=uo;var js=uo;function Vg(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Ul=Vg;function Kg(e){if(e instanceof ea)return e.clone();var t=new js(e.__wrapped__,e.__chain__);return t.__actions__=Ul(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var qg=Kg,Gg=Object.prototype,Wg=Gg.hasOwnProperty;function co(e){if(On(e)&&!Vt(e)&&!(e instanceof ea)){if(e instanceof js)return e;if(Wg.call(e,"__wrapped__"))return qg(e)}return new js(e)}co.prototype=Zs.prototype;co.prototype.constructor=co;var Hg=co;function Jg(e){var t=zg(e),n=Hg[t];if(typeof n!="function"||!(t in ea.prototype))return!1;if(e===n)return!0;var r=xl(n);return!!r&&e===r[0]}var Xg=Jg,Yg=800,Qg=16,Zg=Date.now;function em(e){var t=0,n=0;return function(){var r=Zg(),i=Qg-(r-n);if(n=r,i>0){if(++t>=Yg)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Ml=em,tm=Ml(Nl),Bl=tm,nm=/\{\n\/\* \[wrapped with (.+)\] \*/,rm=/,? & /;function im(e){var t=e.match(nm);return t?t[1].split(rm):[]}var om=im,sm=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function am(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(sm,`{
|
|
55
55
|
/* [wrapped with `+t+`] */
|
|
56
|
-
`)}var sm=om;function am(e){return function(){return e}}var um=am,cm=function(){try{var e=Hn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),uo=cm,lm=uo?function(e,t){return uo(e,"toString",{configurable:!0,enumerable:!1,value:um(t),writable:!0})}:wo,fm=lm,dm=xl(fm),Zs=dm;function pm(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var hm=pm;function ym(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var gm=ym;function mm(e){return e!==e}var vm=mm;function bm(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var _m=bm;function wm(e,t,n){return t===t?_m(e,t,n):gm(e,vm,n)}var Tm=wm;function Am(e,t){var n=e==null?0:e.length;return!!n&&Tm(e,t,0)>-1}var Ml=Am,Om=1,Em=2,Im=8,Sm=16,Nm=32,$m=64,Rm=128,Pm=256,Cm=512,xm=[["ary",Rm],["bind",Om],["bindKey",Em],["curry",Im],["curryRight",Sm],["flip",Cm],["partial",Nm],["partialRight",$m],["rearg",Pm]];function Um(e,t){return hm(xm,function(n){var r="_."+n[0];t&n[1]&&!Ml(e,r)&&e.push(r)}),e.sort()}var Mm=Um;function Bm(e,t,n){var r=t+"";return Zs(e,sm(r,Mm(rm(r),n)))}var Bl=Bm,Dm=1,Lm=2,km=4,jm=8,yc=32,gc=64;function Fm(e,t,n,r,i,o,s,a,l,c){var d=t&jm,g=d?s:void 0,C=d?void 0:s,I=d?o:void 0,S=d?void 0:o;t|=d?yc:gc,t&=~(d?gc:yc),t&km||(t&=~(Dm|Lm));var V=[e,t,i,I,g,S,C,a,l,c],J=n.apply(void 0,V);return Hg(e)&&Ul(J,V),J.placeholder=r,Bl(J,e,t)}var Dl=Fm;function Vm(e){var t=e;return t.placeholder}var ea=Vm,Km=9007199254740991,zm=/^(?:0|[1-9]\d*)$/;function qm(e,t){var n=typeof e;return t=t??Km,!!t&&(n=="number"||n!="symbol"&&zm.test(e))&&e>-1&&e%1==0&&e<t}var To=qm,Gm=Math.min;function Wm(e,t){for(var n=e.length,r=Gm(t.length,n),i=Cl(e);r--;){var o=t[r];e[r]=To(o,n)?i[o]:void 0}return e}var Hm=Wm,mc="__lodash_placeholder__";function Jm(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];(s===t||s===mc)&&(e[n]=mc,o[i++]=n)}return o}var si=Jm,Xm=1,Ym=2,Qm=8,Zm=16,ev=128,tv=512;function Ll(e,t,n,r,i,o,s,a,l,c){var d=t&ev,g=t&Xm,C=t&Ym,I=t&(Qm|Zm),S=t&tv,V=C?void 0:oi(e);function J(){for(var F=arguments.length,k=Array(F),z=F;z--;)k[z]=arguments[z];if(I)var W=ea(J),j=Pg(k,W);if(r&&(k=Nl(k,r,i,I)),o&&(k=$l(k,o,s,I)),F-=j,I&&F<c){var Z=si(k,W);return Dl(e,t,Ll,J.placeholder,n,k,Z,a,l,c-F)}var G=g?n:this,fe=C?G[e]:e;return F=k.length,a?k=Hm(k,a):S&&F>1&&k.reverse(),d&&l<F&&(k.length=l),this&&this!==dt&&this instanceof J&&(fe=V||oi(fe)),fe.apply(G,k)}return J}var kl=Ll;function nv(e,t,n){var r=oi(e);function i(){for(var o=arguments.length,s=Array(o),a=o,l=ea(i);a--;)s[a]=arguments[a];var c=o<3&&s[0]!==l&&s[o-1]!==l?[]:si(s,l);if(o-=c.length,o<n)return Dl(e,t,kl,i.placeholder,void 0,s,c,void 0,void 0,n-o);var d=this&&this!==dt&&this instanceof i?r:e;return Xs(d,this,s)}return i}var rv=nv,iv=1;function ov(e,t,n,r){var i=t&iv,o=oi(e);function s(){for(var a=-1,l=arguments.length,c=-1,d=r.length,g=Array(d+l),C=this&&this!==dt&&this instanceof s?o:e;++c<d;)g[c]=r[c];for(;l--;)g[c++]=arguments[++a];return Xs(C,i?n:this,g)}return s}var sv=ov,vc="__lodash_placeholder__",Ss=1,av=2,uv=4,bc=8,ei=128,_c=256,cv=Math.min;function lv(e,t){var n=e[1],r=t[1],i=n|r,o=i<(Ss|av|ei),s=r==ei&&n==bc||r==ei&&n==_c&&e[7].length<=t[8]||r==(ei|_c)&&t[7].length<=t[8]&&n==bc;if(!(o||s))return e;r&Ss&&(e[2]=t[2],i|=n&Ss?0:uv);var a=t[3];if(a){var l=e[3];e[3]=l?Nl(l,a,t[4]):a,e[4]=l?si(e[3],vc):t[4]}return a=t[5],a&&(l=e[5],e[5]=l?$l(l,a,t[6]):a,e[6]=l?si(e[5],vc):t[6]),a=t[7],a&&(e[7]=a),r&ei&&(e[8]=e[8]==null?t[8]:cv(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var fv=lv,dv="Expected a function",wc=1,pv=2,Ns=8,$s=16,Rs=32,Tc=64,Ac=Math.max;function hv(e,t,n,r,i,o,s,a){var l=t&pv;if(!l&&typeof e!="function")throw new TypeError(dv);var c=r?r.length:0;if(c||(t&=~(Rs|Tc),r=i=void 0),s=s===void 0?s:Ac(fc(s),0),a=a===void 0?a:fc(a),c-=i?i.length:0,t&Tc){var d=r,g=i;r=i=void 0}var C=l?void 0:Pl(e),I=[e,t,n,r,i,d,g,o,s,a];if(C&&fv(I,C),e=I[0],t=I[1],n=I[2],r=I[3],i=I[4],a=I[9]=I[9]===void 0?l?0:e.length:Ac(I[9]-c,0),!a&&t&(Ns|$s)&&(t&=~(Ns|$s)),!t||t==wc)var S=Og(e,t,n);else t==Ns||t==$s?S=rv(e,t,a):(t==Rs||t==(wc|Rs))&&!i.length?S=sv(e,t,n,r):S=kl.apply(void 0,I);var V=C?Sl:Ul;return Bl(V(S,I),e,t)}var yv=hv;function gv(e,t,n){t=="__proto__"&&uo?uo(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var mv=gv;function vv(e,t){return e===t||e!==e&&t!==t}var ta=vv,bv=Object.prototype,_v=bv.hasOwnProperty;function wv(e,t,n){var r=e[t];(!(_v.call(e,t)&&ta(r,n))||n===void 0&&!(t in e))&&mv(e,t,n)}var Tv=wv,Oc=Math.max;function Av(e,t,n){return t=Oc(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=Oc(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),Xs(e,this,a)}}var jl=Av;function Ov(e,t){return Zs(jl(e,t,wo),e+"")}var Fl=Ov,Ev=9007199254740991;function Iv(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Ev}var na=Iv;function Sv(e){return e!=null&&na(e.length)&&!Il(e)}var Vl=Sv,Nv=Object.prototype;function $v(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Nv;return e===n}var Rv=$v;function Pv(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Cv=Pv,xv="[object Arguments]";function Uv(e){return Tn(e)&&Er(e)==xv}var Ec=Uv,Kl=Object.prototype,Mv=Kl.hasOwnProperty,Bv=Kl.propertyIsEnumerable,Dv=Ec(function(){return arguments}())?Ec:function(e){return Tn(e)&&Mv.call(e,"callee")&&!Bv.call(e,"callee")},ra=Dv;function Lv(){return!1}var kv=Lv,zl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ic=zl&&typeof module=="object"&&module&&!module.nodeType&&module,jv=Ic&&Ic.exports===zl,Sc=jv?dt.Buffer:void 0,Fv=Sc?Sc.isBuffer:void 0,Vv=Fv||kv,ks=Vv,Kv="[object Arguments]",zv="[object Array]",qv="[object Boolean]",Gv="[object Date]",Wv="[object Error]",Hv="[object Function]",Jv="[object Map]",Xv="[object Number]",Yv="[object Object]",Qv="[object RegExp]",Zv="[object Set]",eb="[object String]",tb="[object WeakMap]",nb="[object ArrayBuffer]",rb="[object DataView]",ib="[object Float32Array]",ob="[object Float64Array]",sb="[object Int8Array]",ab="[object Int16Array]",ub="[object Int32Array]",cb="[object Uint8Array]",lb="[object Uint8ClampedArray]",fb="[object Uint16Array]",db="[object Uint32Array]",Me={};Me[ib]=Me[ob]=Me[sb]=Me[ab]=Me[ub]=Me[cb]=Me[lb]=Me[fb]=Me[db]=!0;Me[Kv]=Me[zv]=Me[nb]=Me[qv]=Me[rb]=Me[Gv]=Me[Wv]=Me[Hv]=Me[Jv]=Me[Xv]=Me[Yv]=Me[Qv]=Me[Zv]=Me[eb]=Me[tb]=!1;function pb(e){return Tn(e)&&na(e.length)&&!!Me[Er(e)]}var hb=pb;function yb(e){return function(t){return e(t)}}var ql=yb,Gl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ri=Gl&&typeof module=="object"&&module&&!module.nodeType&&module,gb=ri&&ri.exports===Gl,Ps=gb&&Tl.process,mb=function(){try{var e=ri&&ri.require&&ri.require("util").types;return e||Ps&&Ps.binding&&Ps.binding("util")}catch{}}(),Nc=mb,$c=Nc&&Nc.isTypedArray,vb=$c?ql($c):hb,Wl=vb,bb=Object.prototype,_b=bb.hasOwnProperty;function wb(e,t){var n=Ft(e),r=!n&&ra(e),i=!n&&!r&&ks(e),o=!n&&!r&&!i&&Wl(e),s=n||r||i||o,a=s?Cv(e.length,String):[],l=a.length;for(var c in e)(t||_b.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||To(c,l)))&&a.push(c);return a}var Tb=wb;function Ab(e,t){return function(n){return e(t(n))}}var Ob=Ab,Eb=Ob(Object.keys,Object),Ib=Eb,Sb=Object.prototype,Nb=Sb.hasOwnProperty;function $b(e){if(!Rv(e))return Ib(e);var t=[];for(var n in Object(e))Nb.call(e,n)&&n!="constructor"&&t.push(n);return t}var Rb=$b;function Pb(e){return Vl(e)?Tb(e):Rb(e)}var Hl=Pb,Cb=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xb=/^\w*$/;function Ub(e,t){if(Ft(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Tr(e)?!0:xb.test(e)||!Cb.test(e)||t!=null&&e in Object(t)}var ia=Ub,Mb=Hn(Object,"create"),ai=Mb;function Bb(){this.__data__=ai?ai(null):{},this.size=0}var Db=Bb;function Lb(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var kb=Lb,jb="__lodash_hash_undefined__",Fb=Object.prototype,Vb=Fb.hasOwnProperty;function Kb(e){var t=this.__data__;if(ai){var n=t[e];return n===jb?void 0:n}return Vb.call(t,e)?t[e]:void 0}var zb=Kb,qb=Object.prototype,Gb=qb.hasOwnProperty;function Wb(e){var t=this.__data__;return ai?t[e]!==void 0:Gb.call(t,e)}var Hb=Wb,Jb="__lodash_hash_undefined__";function Xb(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ai&&t===void 0?Jb:t,this}var Yb=Xb;function Ir(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ir.prototype.clear=Db;Ir.prototype.delete=kb;Ir.prototype.get=zb;Ir.prototype.has=Hb;Ir.prototype.set=Yb;var Rc=Ir;function Qb(){this.__data__=[],this.size=0}var Zb=Qb;function e_(e,t){for(var n=e.length;n--;)if(ta(e[n][0],t))return n;return-1}var Ao=e_,t_=Array.prototype,n_=t_.splice;function r_(e){var t=this.__data__,n=Ao(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():n_.call(t,n,1),--this.size,!0}var i_=r_;function o_(e){var t=this.__data__,n=Ao(t,e);return n<0?void 0:t[n][1]}var s_=o_;function a_(e){return Ao(this.__data__,e)>-1}var u_=a_;function c_(e,t){var n=this.__data__,r=Ao(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var l_=c_;function Sr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Sr.prototype.clear=Zb;Sr.prototype.delete=i_;Sr.prototype.get=s_;Sr.prototype.has=u_;Sr.prototype.set=l_;var Oo=Sr,f_=Hn(dt,"Map"),ui=f_;function d_(){this.size=0,this.__data__={hash:new Rc,map:new(ui||Oo),string:new Rc}}var p_=d_;function h_(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var y_=h_;function g_(e,t){var n=e.__data__;return y_(t)?n[typeof t=="string"?"string":"hash"]:n.map}var Eo=g_;function m_(e){var t=Eo(this,e).delete(e);return this.size-=t?1:0,t}var v_=m_;function b_(e){return Eo(this,e).get(e)}var __=b_;function w_(e){return Eo(this,e).has(e)}var T_=w_;function A_(e,t){var n=Eo(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var O_=A_;function Nr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Nr.prototype.clear=p_;Nr.prototype.delete=v_;Nr.prototype.get=__;Nr.prototype.has=T_;Nr.prototype.set=O_;var Io=Nr,E_="Expected a function";function oa(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(E_);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(oa.Cache||Io),n}oa.Cache=Io;var I_=oa,S_=500;function N_(e){var t=I_(e,function(r){return n.size===S_&&n.clear(),r}),n=t.cache;return t}var $_=N_,R_=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,P_=/\\(\\)?/g,C_=$_(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(R_,function(n,r,i,o){t.push(i?o.replace(P_,"$1"):r||n)}),t}),x_=C_;function U_(e){return e==null?"":$y(e)}var M_=U_;function B_(e,t){return Ft(e)?e:ia(e,t)?[e]:x_(M_(e))}var So=B_,D_=1/0;function L_(e){if(typeof e=="string"||Tr(e))return e;var t=e+"";return t=="0"&&1/e==-D_?"-0":t}var di=L_;function k_(e,t){t=So(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[di(t[n++])];return n&&n==r?e:void 0}var sa=k_;function j_(e,t,n){var r=e==null?void 0:sa(e,t);return r===void 0?n:r}var F_=j_;function V_(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Jl=V_,Pc=Ht?Ht.isConcatSpreadable:void 0;function K_(e){return Ft(e)||ra(e)||!!(Pc&&e&&e[Pc])}var z_=K_;function Xl(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=z_),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?Xl(a,t-1,n,r,i):Jl(i,a):r||(i[i.length]=a)}return i}var q_=Xl;function G_(e){var t=e==null?0:e.length;return t?q_(e,1):[]}var W_=G_;function H_(e){return Zs(jl(e,void 0,W_),e+"")}var J_=H_;function X_(){this.__data__=new Oo,this.size=0}var Y_=X_;function Q_(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var Z_=Q_;function ew(e){return this.__data__.get(e)}var tw=ew;function nw(e){return this.__data__.has(e)}var rw=nw,iw=200;function ow(e,t){var n=this.__data__;if(n instanceof Oo){var r=n.__data__;if(!ui||r.length<iw-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Io(r)}return n.set(e,t),this.size=n.size,this}var sw=ow;function $r(e){var t=this.__data__=new Oo(e);this.size=t.size}$r.prototype.clear=Y_;$r.prototype.delete=Z_;$r.prototype.get=tw;$r.prototype.has=rw;$r.prototype.set=sw;var Qi=$r;function aw(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}var uw=aw;function cw(){return[]}var lw=cw,fw=Object.prototype,dw=fw.propertyIsEnumerable,Cc=Object.getOwnPropertySymbols,pw=Cc?function(e){return e==null?[]:(e=Object(e),uw(Cc(e),function(t){return dw.call(e,t)}))}:lw,hw=pw;function yw(e,t,n){var r=t(e);return Ft(e)?r:Jl(r,n(e))}var gw=yw;function mw(e){return gw(e,Hl,hw)}var xc=mw,vw=Hn(dt,"DataView"),js=vw,bw=Hn(dt,"Promise"),Fs=bw,_w=Hn(dt,"Set"),wr=_w,Uc="[object Map]",ww="[object Object]",Mc="[object Promise]",Bc="[object Set]",Dc="[object WeakMap]",Lc="[object DataView]",Tw=Wn(js),Aw=Wn(ui),Ow=Wn(Fs),Ew=Wn(wr),Iw=Wn(ii),zn=Er;(js&&zn(new js(new ArrayBuffer(1)))!=Lc||ui&&zn(new ui)!=Uc||Fs&&zn(Fs.resolve())!=Mc||wr&&zn(new wr)!=Bc||ii&&zn(new ii)!=Dc)&&(zn=function(e){var t=Er(e),n=t==ww?e.constructor:void 0,r=n?Wn(n):"";if(r)switch(r){case Tw:return Lc;case Aw:return Uc;case Ow:return Mc;case Ew:return Bc;case Iw:return Dc}return t});var kc=zn,Sw=dt.Uint8Array,jc=Sw,Nw="__lodash_hash_undefined__";function $w(e){return this.__data__.set(e,Nw),this}var Rw=$w;function Pw(e){return this.__data__.has(e)}var Cw=Pw;function co(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Io;++t<n;)this.add(e[t])}co.prototype.add=co.prototype.push=Rw;co.prototype.has=Cw;var Yl=co;function xw(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Uw=xw;function Mw(e,t){return e.has(t)}var Ql=Mw,Bw=1,Dw=2;function Lw(e,t,n,r,i,o){var s=n&Bw,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),d=o.get(t);if(c&&d)return c==t&&d==e;var g=-1,C=!0,I=n&Dw?new Yl:void 0;for(o.set(e,t),o.set(t,e);++g<a;){var S=e[g],V=t[g];if(r)var J=s?r(V,S,g,t,e,o):r(S,V,g,e,t,o);if(J!==void 0){if(J)continue;C=!1;break}if(I){if(!Uw(t,function(F,k){if(!Ql(I,k)&&(S===F||i(S,F,n,r,o)))return I.push(k)})){C=!1;break}}else if(!(S===V||i(S,V,n,r,o))){C=!1;break}}return o.delete(e),o.delete(t),C}var Zl=Lw;function kw(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}var jw=kw;function Fw(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var ef=Fw,Vw=1,Kw=2,zw="[object Boolean]",qw="[object Date]",Gw="[object Error]",Ww="[object Map]",Hw="[object Number]",Jw="[object RegExp]",Xw="[object Set]",Yw="[object String]",Qw="[object Symbol]",Zw="[object ArrayBuffer]",eT="[object DataView]",Fc=Ht?Ht.prototype:void 0,Cs=Fc?Fc.valueOf:void 0;function tT(e,t,n,r,i,o,s){switch(n){case eT:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Zw:return!(e.byteLength!=t.byteLength||!o(new jc(e),new jc(t)));case zw:case qw:case Hw:return ta(+e,+t);case Gw:return e.name==t.name&&e.message==t.message;case Jw:case Yw:return e==t+"";case Ww:var a=jw;case Xw:var l=r&Vw;if(a||(a=ef),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=Kw,s.set(e,t);var d=Zl(a(e),a(t),r,i,o,s);return s.delete(e),d;case Qw:if(Cs)return Cs.call(e)==Cs.call(t)}return!1}var nT=tT,rT=1,iT=Object.prototype,oT=iT.hasOwnProperty;function sT(e,t,n,r,i,o){var s=n&rT,a=xc(e),l=a.length,c=xc(t),d=c.length;if(l!=d&&!s)return!1;for(var g=l;g--;){var C=a[g];if(!(s?C in t:oT.call(t,C)))return!1}var I=o.get(e),S=o.get(t);if(I&&S)return I==t&&S==e;var V=!0;o.set(e,t),o.set(t,e);for(var J=s;++g<l;){C=a[g];var F=e[C],k=t[C];if(r)var z=s?r(k,F,C,t,e,o):r(F,k,C,e,t,o);if(!(z===void 0?F===k||i(F,k,n,r,o):z)){V=!1;break}J||(J=C=="constructor")}if(V&&!J){var W=e.constructor,j=t.constructor;W!=j&&"constructor"in e&&"constructor"in t&&!(typeof W=="function"&&W instanceof W&&typeof j=="function"&&j instanceof j)&&(V=!1)}return o.delete(e),o.delete(t),V}var aT=sT,uT=1,Vc="[object Arguments]",Kc="[object Array]",Yi="[object Object]",cT=Object.prototype,zc=cT.hasOwnProperty;function lT(e,t,n,r,i,o){var s=Ft(e),a=Ft(t),l=s?Kc:kc(e),c=a?Kc:kc(t);l=l==Vc?Yi:l,c=c==Vc?Yi:c;var d=l==Yi,g=c==Yi,C=l==c;if(C&&ks(e)){if(!ks(t))return!1;s=!0,d=!1}if(C&&!d)return o||(o=new Qi),s||Wl(e)?Zl(e,t,n,r,i,o):nT(e,t,l,n,r,i,o);if(!(n&uT)){var I=d&&zc.call(e,"__wrapped__"),S=g&&zc.call(t,"__wrapped__");if(I||S){var V=I?e.value():e,J=S?t.value():t;return o||(o=new Qi),i(V,J,n,r,o)}}return C?(o||(o=new Qi),aT(e,t,n,r,i,o)):!1}var fT=lT;function tf(e,t,n,r,i){return e===t?!0:e==null||t==null||!Tn(e)&&!Tn(t)?e!==e&&t!==t:fT(e,t,n,r,tf,i)}var nf=tf,dT=1,pT=2;function hT(e,t,n,r){var i=n.length,o=i,s=!r;if(e==null)return!o;for(e=Object(e);i--;){var a=n[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){a=n[i];var l=a[0],c=e[l],d=a[1];if(s&&a[2]){if(c===void 0&&!(l in e))return!1}else{var g=new Qi;if(r)var C=r(c,d,l,e,t,g);if(!(C===void 0?nf(d,c,dT|pT,r,g):C))return!1}}return!0}var yT=hT;function gT(e){return e===e&&!on(e)}var rf=gT;function mT(e){for(var t=Hl(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,rf(i)]}return t}var vT=mT;function bT(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var of=bT;function _T(e){var t=vT(e);return t.length==1&&t[0][2]?of(t[0][0],t[0][1]):function(n){return n===e||yT(n,e,t)}}var wT=_T;function TT(e,t){return e!=null&&t in Object(e)}var AT=TT;function OT(e,t,n){t=So(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=di(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&na(i)&&To(s,i)&&(Ft(e)||ra(e)))}var ET=OT;function IT(e,t){return e!=null&&ET(e,t,AT)}var sf=IT,ST=1,NT=2;function $T(e,t){return ia(e)&&rf(t)?of(di(e),t):function(n){var r=F_(n,e);return r===void 0&&r===t?sf(n,e):nf(t,r,ST|NT)}}var RT=$T;function PT(e){return function(t){return t?.[e]}}var CT=PT;function xT(e){return function(t){return sa(t,e)}}var UT=xT;function MT(e){return ia(e)?CT(di(e)):UT(e)}var BT=MT;function DT(e){return typeof e=="function"?e:e==null?wo:typeof e=="object"?Ft(e)?RT(e[0],e[1]):wT(e):BT(e)}var LT=DT;function kT(e){return Tn(e)&&Vl(e)}var jT=kT;function FT(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var VT=FT,KT=200;function zT(e,t,n,r){var i=-1,o=Ml,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=Ol(t,ql(n))),r?(o=VT,s=!1):t.length>=KT&&(o=Ql,s=!1,t=new Yl(t));e:for(;++i<a;){var d=e[i],g=n==null?d:n(d);if(d=r||d!==0?d:0,s&&g===g){for(var C=c;C--;)if(t[C]===g)continue e;l.push(d)}else o(t,g,r)||l.push(d)}return l}var qT=zT;function GT(e,t,n,r){if(!on(e))return e;t=So(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var l=di(t[i]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=s){var d=a[l];c=r?r(d,l,a):void 0,c===void 0&&(c=on(d)?d:To(t[i+1])?[]:{})}Tv(a,l,c),a=a[l]}return e}var WT=GT;function HT(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=sa(e,s);n(a,s)&&WT(o,So(s,e),a)}return o}var JT=HT,XT=32,aa=Fl(function(e,t){var n=si(t,ea(aa));return yv(e,XT,void 0,t,n)});aa.placeholder={};var YT=aa;function QT(e,t){return JT(e,t,function(n,r){return sf(e,r)})}var ZT=QT,e0=J_(function(e,t){return e==null?{}:ZT(e,t)}),qc=e0,t0=4294967295,n0=t0-1,r0=Math.floor,i0=Math.min;function o0(e,t,n,r){var i=0,o=e==null?0:e.length;if(o===0)return 0;t=n(t);for(var s=t!==t,a=t===null,l=Tr(t),c=t===void 0;i<o;){var d=r0((i+o)/2),g=n(e[d]),C=g!==void 0,I=g===null,S=g===g,V=Tr(g);if(s)var J=r||S;else c?J=S&&(r||C):a?J=S&&C&&(r||!I):l?J=S&&C&&!I&&(r||!V):I||V?J=!1:J=r?g<=t:g<t;J?i=d+1:o=d}return i0(o,n0)}var s0=o0;function a0(e,t,n){return s0(e,t,LT(n,2))}var u0=a0,c0=1/0,uS=wr&&1/ef(new wr([,-0]))[1]==c0?function(e){return new wr(e)}:Rl;var l0=Fl(function(e,t){return jT(e)?qT(e,t):[]}),Gc=l0,af=Et(ey(),1),cS=af.default.configure,Gn=af.default,xs=100,{WARN:f0,LOG:lS,DEBUG:qe,VERBOSE:we,ERROR:fS}=Ne.setup(Ne.INFO),lo=Ce.set();Wu({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var We=({caller:e,thread:t,pattern:n,args:r})=>Pe(()=>(r=r||n,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${r?`{${typeof r=="string"?r:Gn(r)}}`:""}`));function uf(e,t){return Pe(()=>Ve.structural(e.get(),t.get()))}function Rr(e,t){return Ve.shallow(e.applogs,t.applogs)}function No(e,t){if(e.size!==t.size)return!1;for(let n=0;n<e.size;n++){let r=e.nodes[n],i=t.nodes[n];if(we.isEnabled&&we("queryNodesComparer",n,r,i),!Ve.structural(r.variables,i.variables))return we.isEnabled&&we("[queryNodesComparer] changed vars:",n,r,i),!1;if(!Rr(r.logsOfThisNode,i.logsOfThisNode))return we.isEnabled&&we("[queryNodesComparer] changed logsOfThisNode:",n,r,i),!1}return we.isEnabled&&we("[queryNodesComparer] equal:",{a:e,b:t}),!0}var d0=0;function Jt(e,{name:t,equals:n}={}){let r=`observableArrayMap@${++d0}{${t}}`;we.isEnabled&&we(`[${r}] create`,{fnname:e.name,fn:e,name:t,equals:n});let i,o=lf(e,a=>{i?Pe(()=>(n??Ve.structural)(i,a))?qe.isEnabled&&qe(`[${r}] update skipped`,{updatedItems:a,observableArr:i}):(i.replace(a),qe.isEnabled&&qe(`[${r}] updated`,{updatedItems:a,observableArr:i})):i=Ce.array(a,{deep:!1,name:t,equals:n})},{name:r});if(r.includes("useRoots")){var s=Tt(i);qe(`[${r}] deps`,{disposeAutorun:o,rootsAtom:s,observableArr:i,observers:Xr(i)}),gr(()=>lo.add(s))}return we.isEnabled&&mr(i,()=>{we(`[${r}] observed`,Xr(i),{rootsAtom:s,observableArr:i})}),jn(i,()=>{we.isEnabled&&we(`[${r}] dispose`),s&&gr(()=>lo.delete(s)),o()}),i}var p0=0;function cf(e,{name:t}={}){let n=`observableSetMap@${++p0}{${t}}`;we.isEnabled&&we(`[${n}] create`,{fnname:e.name,fn:e,name:t});let r,i=lf(e,s=>{if(!r)r=Ce.set(s,{deep:!1,name:t});else{let{deleted:a,added:l}=Pe(()=>{let c=new Set(r.values()),d=new Set;for(let g of s)r.has(g)?(we.isEnabled&&we(`[${n}] unchanged`,g,{updatedItems:s,observableSet:r}),c.delete(g)):d.add(g);return qe.isEnabled&&qe(`[${n}] updated:`,{unseen:c,added:d,updatedItems:s,observableSet:r}),{added:d,deleted:c}});for(let c of a)r.delete(c);for(let c of l)r.add(c)}},{name:n});if(n.includes("useRoots")){var o=Tt(r);qe.isEnabled&&qe(`[${n}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:r,observers:Xr(r)}),gr(()=>lo.add(o))}return we.isEnabled&&mr(r,()=>{we(`[${n}] observed`,Xr(r),{rootsAtom:o,observableSet:r})}),jn(r,()=>{we.isEnabled&&we(`[${n}] dispose`),o&&gr(()=>lo.delete(o)),i()}),r}function lf(e,t=null,{name:n}={}){qe.isEnabled&&qe("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:n});let r=`${n}.autorunImm`,i,o=new Dt(r,function(...c){qe.isEnabled&&qe(`[${r}] reaction.invalidate`,c),s()});function s(){o.track(function(){let c=xs&&performance.now();qe.isEnabled&&qe(`[${r}] runAndTrack:`,{name:n??e.name,fn:e}),i=e(),qe.isEnabled&&qe(`[${r}] runAndTrack =>`,i),gr(()=>{t?.(i)}),xs&&performance.now()-c>xs&&f0(`[${r}] took ${performance.now()-c}ms`)})}return s(),qe.isEnabled&&qe(`[${r}] deps of reaction`,{reaction:o,result:i,deps:Jr(o)}),()=>{we.isEnabled&&we(`[${r}] dispose`),setTimeout(()=>o.dispose())}}function Xe(e,t,n=!1){if(hn(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let r=!1,i=0,o=typeof n=="boolean"?{keepAlive:n}:n,s=new Map;return function(...a){let l,c=Pe(()=>{let I=a;for(let S=0;S<a.length;S++)a[S]instanceof Ar&&a===I&&(I=a.slice());return I}),d=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...a)}}`:""}`;for(let[I,S]of s.entries())if(y0(I,c)){l=S;break}else if(we.isEnabled)for(let V=0;V<I.length;V++)I[V]instanceof Ar&&I[V].name===a[V].name&&Ve.structural(Gc(I,I[V]),Gc(c,c[V]))&&we.force(`[${d}] threadState mismatch => cachebust`,{diffFields:Object.keys(I[V]).filter(J=>!Ve.structural(I[V][J],a[V][J])),cacheArg:I[V],freshArg:a[V]});if(l){let I=l.get();return we.isEnabled&&we(`[${d}] cache hit`,{untrackedArgs:c,cachedResult:I}),I}if(!o.keepAlive&&!$u())return!r&&xu().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),r=!0),t.apply(this,a);we.isEnabled&&we(`[${d}] new computation`,{untrackedArgs:c});let g,C=De(()=>(we.isEnabled&&we(`[${d}] update->rerun`,Pe(()=>({args:a})),t),we.isEnabled&&ms(),g=t.apply(this,a)),{...o,name:d});if(we.isEnabled&&we(`[${d}] deps`,Jr(C),{untrackedArgs:c}),s.set(c,C),!o.keepAlive){let I=jn(C,()=>{we.isEnabled&&we(`[${d}] dispose`,C),I(),s.delete(c),o.onCleanup&&o.onCleanup(g,...a),g=void 0})}return C.get()}}function h0(e){let t=0,n="",r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?n+=o+`
|
|
56
|
+
`)}var um=am;function cm(e){return function(){return e}}var lm=cm,fm=function(){try{var e=Xn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),lo=fm,dm=lo?function(e,t){return lo(e,"toString",{configurable:!0,enumerable:!1,value:lm(t),writable:!0})}:Ao,pm=dm,hm=Ml(pm),ta=hm;function ym(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var gm=ym;function mm(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var vm=mm;function bm(e){return e!==e}var _m=bm;function wm(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var Tm=wm;function Am(e,t,n){return t===t?Tm(e,t,n):vm(e,_m,n)}var Om=Am;function Em(e,t){var n=e==null?0:e.length;return!!n&&Om(e,t,0)>-1}var Dl=Em,Im=1,Sm=2,$m=8,Nm=16,Rm=32,Pm=64,Cm=128,xm=256,Um=512,Mm=[["ary",Cm],["bind",Im],["bindKey",Sm],["curry",$m],["curryRight",Nm],["flip",Um],["partial",Rm],["partialRight",Pm],["rearg",xm]];function Bm(e,t){return gm(Mm,function(n){var r="_."+n[0];t&n[1]&&!Dl(e,r)&&e.push(r)}),e.sort()}var Dm=Bm;function Lm(e,t,n){var r=t+"";return ta(e,um(r,Dm(om(r),n)))}var Ll=Lm,km=1,jm=2,Fm=4,zm=8,mc=32,vc=64;function Vm(e,t,n,r,i,o,s,a,l,c){var d=t&zm,g=d?s:void 0,C=d?void 0:s,I=d?o:void 0,S=d?void 0:o;t|=d?mc:vc,t&=~(d?vc:mc),t&Fm||(t&=~(km|jm));var z=[e,t,i,I,g,S,C,a,l,c],J=n.apply(void 0,z);return Xg(e)&&Bl(J,z),J.placeholder=r,Ll(J,e,t)}var kl=Vm;function Km(e){var t=e;return t.placeholder}var na=Km,qm=9007199254740991,Gm=/^(?:0|[1-9]\d*)$/;function Wm(e,t){var n=typeof e;return t=t??qm,!!t&&(n=="number"||n!="symbol"&&Gm.test(e))&&e>-1&&e%1==0&&e<t}var Oo=Wm,Hm=Math.min;function Jm(e,t){for(var n=e.length,r=Hm(t.length,n),i=Ul(e);r--;){var o=t[r];e[r]=Oo(o,n)?i[o]:void 0}return e}var Xm=Jm,bc="__lodash_placeholder__";function Ym(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];(s===t||s===bc)&&(e[n]=bc,o[i++]=n)}return o}var ui=Ym,Qm=1,Zm=2,ev=8,tv=16,nv=128,rv=512;function jl(e,t,n,r,i,o,s,a,l,c){var d=t&nv,g=t&Qm,C=t&Zm,I=t&(ev|tv),S=t&rv,z=C?void 0:ai(e);function J(){for(var F=arguments.length,k=Array(F),K=F;K--;)k[K]=arguments[K];if(I)var W=na(J),j=xg(k,W);if(r&&(k=Rl(k,r,i,I)),o&&(k=Pl(k,o,s,I)),F-=j,I&&F<c){var Z=ui(k,W);return kl(e,t,jl,J.placeholder,n,k,Z,a,l,c-F)}var G=g?n:this,fe=C?G[e]:e;return F=k.length,a?k=Xm(k,a):S&&F>1&&k.reverse(),d&&l<F&&(k.length=l),this&&this!==ht&&this instanceof J&&(fe=z||ai(fe)),fe.apply(G,k)}return J}var Fl=jl;function iv(e,t,n){var r=ai(e);function i(){for(var o=arguments.length,s=Array(o),a=o,l=na(i);a--;)s[a]=arguments[a];var c=o<3&&s[0]!==l&&s[o-1]!==l?[]:ui(s,l);if(o-=c.length,o<n)return kl(e,t,Fl,i.placeholder,void 0,s,c,void 0,void 0,n-o);var d=this&&this!==ht&&this instanceof i?r:e;return Qs(d,this,s)}return i}var ov=iv,sv=1;function av(e,t,n,r){var i=t&sv,o=ai(e);function s(){for(var a=-1,l=arguments.length,c=-1,d=r.length,g=Array(d+l),C=this&&this!==ht&&this instanceof s?o:e;++c<d;)g[c]=r[c];for(;l--;)g[c++]=arguments[++a];return Qs(C,i?n:this,g)}return s}var uv=av,_c="__lodash_placeholder__",Ns=1,cv=2,lv=4,wc=8,ni=128,Tc=256,fv=Math.min;function dv(e,t){var n=e[1],r=t[1],i=n|r,o=i<(Ns|cv|ni),s=r==ni&&n==wc||r==ni&&n==Tc&&e[7].length<=t[8]||r==(ni|Tc)&&t[7].length<=t[8]&&n==wc;if(!(o||s))return e;r&Ns&&(e[2]=t[2],i|=n&Ns?0:lv);var a=t[3];if(a){var l=e[3];e[3]=l?Rl(l,a,t[4]):a,e[4]=l?ui(e[3],_c):t[4]}return a=t[5],a&&(l=e[5],e[5]=l?Pl(l,a,t[6]):a,e[6]=l?ui(e[5],_c):t[6]),a=t[7],a&&(e[7]=a),r&ni&&(e[8]=e[8]==null?t[8]:fv(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var pv=dv,hv="Expected a function",Ac=1,yv=2,Rs=8,Ps=16,Cs=32,Oc=64,Ec=Math.max;function gv(e,t,n,r,i,o,s,a){var l=t&yv;if(!l&&typeof e!="function")throw new TypeError(hv);var c=r?r.length:0;if(c||(t&=~(Cs|Oc),r=i=void 0),s=s===void 0?s:Ec(pc(s),0),a=a===void 0?a:pc(a),c-=i?i.length:0,t&Oc){var d=r,g=i;r=i=void 0}var C=l?void 0:xl(e),I=[e,t,n,r,i,d,g,o,s,a];if(C&&pv(I,C),e=I[0],t=I[1],n=I[2],r=I[3],i=I[4],a=I[9]=I[9]===void 0?l?0:e.length:Ec(I[9]-c,0),!a&&t&(Rs|Ps)&&(t&=~(Rs|Ps)),!t||t==Ac)var S=Ig(e,t,n);else t==Rs||t==Ps?S=ov(e,t,a):(t==Cs||t==(Ac|Cs))&&!i.length?S=uv(e,t,n,r):S=Fl.apply(void 0,I);var z=C?Nl:Bl;return Ll(z(S,I),e,t)}var mv=gv;function vv(e,t,n){t=="__proto__"&&lo?lo(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var bv=vv;function _v(e,t){return e===t||e!==e&&t!==t}var ra=_v,wv=Object.prototype,Tv=wv.hasOwnProperty;function Av(e,t,n){var r=e[t];(!(Tv.call(e,t)&&ra(r,n))||n===void 0&&!(t in e))&&bv(e,t,n)}var Ov=Av,Ic=Math.max;function Ev(e,t,n){return t=Ic(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=Ic(r.length-t,0),s=Array(o);++i<o;)s[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(s),Qs(e,this,a)}}var zl=Ev;function Iv(e,t){return ta(zl(e,t,Ao),e+"")}var Vl=Iv,Sv=9007199254740991;function $v(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Sv}var ia=$v;function Nv(e){return e!=null&&ia(e.length)&&!$l(e)}var Kl=Nv,Rv=Object.prototype;function Pv(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Rv;return e===n}var Cv=Pv;function xv(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Uv=xv,Mv="[object Arguments]";function Bv(e){return On(e)&&Sr(e)==Mv}var Sc=Bv,ql=Object.prototype,Dv=ql.hasOwnProperty,Lv=ql.propertyIsEnumerable,kv=Sc(function(){return arguments}())?Sc:function(e){return On(e)&&Dv.call(e,"callee")&&!Lv.call(e,"callee")},oa=kv;function jv(){return!1}var Fv=jv,Gl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,$c=Gl&&typeof module=="object"&&module&&!module.nodeType&&module,zv=$c&&$c.exports===Gl,Nc=zv?ht.Buffer:void 0,Vv=Nc?Nc.isBuffer:void 0,Kv=Vv||Fv,Fs=Kv,qv="[object Arguments]",Gv="[object Array]",Wv="[object Boolean]",Hv="[object Date]",Jv="[object Error]",Xv="[object Function]",Yv="[object Map]",Qv="[object Number]",Zv="[object Object]",eb="[object RegExp]",tb="[object Set]",nb="[object String]",rb="[object WeakMap]",ib="[object ArrayBuffer]",ob="[object DataView]",sb="[object Float32Array]",ab="[object Float64Array]",ub="[object Int8Array]",cb="[object Int16Array]",lb="[object Int32Array]",fb="[object Uint8Array]",db="[object Uint8ClampedArray]",pb="[object Uint16Array]",hb="[object Uint32Array]",Me={};Me[sb]=Me[ab]=Me[ub]=Me[cb]=Me[lb]=Me[fb]=Me[db]=Me[pb]=Me[hb]=!0;Me[qv]=Me[Gv]=Me[ib]=Me[Wv]=Me[ob]=Me[Hv]=Me[Jv]=Me[Xv]=Me[Yv]=Me[Qv]=Me[Zv]=Me[eb]=Me[tb]=Me[nb]=Me[rb]=!1;function yb(e){return On(e)&&ia(e.length)&&!!Me[Sr(e)]}var gb=yb;function mb(e){return function(t){return e(t)}}var Wl=mb,Hl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,oi=Hl&&typeof module=="object"&&module&&!module.nodeType&&module,vb=oi&&oi.exports===Hl,xs=vb&&Ol.process,bb=function(){try{var e=oi&&oi.require&&oi.require("util").types;return e||xs&&xs.binding&&xs.binding("util")}catch{}}(),Rc=bb,Pc=Rc&&Rc.isTypedArray,_b=Pc?Wl(Pc):gb,Jl=_b,wb=Object.prototype,Tb=wb.hasOwnProperty;function Ab(e,t){var n=Vt(e),r=!n&&oa(e),i=!n&&!r&&Fs(e),o=!n&&!r&&!i&&Jl(e),s=n||r||i||o,a=s?Uv(e.length,String):[],l=a.length;for(var c in e)(t||Tb.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Oo(c,l)))&&a.push(c);return a}var Ob=Ab;function Eb(e,t){return function(n){return e(t(n))}}var Ib=Eb,Sb=Ib(Object.keys,Object),$b=Sb,Nb=Object.prototype,Rb=Nb.hasOwnProperty;function Pb(e){if(!Cv(e))return $b(e);var t=[];for(var n in Object(e))Rb.call(e,n)&&n!="constructor"&&t.push(n);return t}var Cb=Pb;function xb(e){return Kl(e)?Ob(e):Cb(e)}var Xl=xb,Ub=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Mb=/^\w*$/;function Bb(e,t){if(Vt(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Or(e)?!0:Mb.test(e)||!Ub.test(e)||t!=null&&e in Object(t)}var sa=Bb,Db=Xn(Object,"create"),ci=Db;function Lb(){this.__data__=ci?ci(null):{},this.size=0}var kb=Lb;function jb(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Fb=jb,zb="__lodash_hash_undefined__",Vb=Object.prototype,Kb=Vb.hasOwnProperty;function qb(e){var t=this.__data__;if(ci){var n=t[e];return n===zb?void 0:n}return Kb.call(t,e)?t[e]:void 0}var Gb=qb,Wb=Object.prototype,Hb=Wb.hasOwnProperty;function Jb(e){var t=this.__data__;return ci?t[e]!==void 0:Hb.call(t,e)}var Xb=Jb,Yb="__lodash_hash_undefined__";function Qb(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ci&&t===void 0?Yb:t,this}var Zb=Qb;function $r(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}$r.prototype.clear=kb;$r.prototype.delete=Fb;$r.prototype.get=Gb;$r.prototype.has=Xb;$r.prototype.set=Zb;var Cc=$r;function e_(){this.__data__=[],this.size=0}var t_=e_;function n_(e,t){for(var n=e.length;n--;)if(ra(e[n][0],t))return n;return-1}var Eo=n_,r_=Array.prototype,i_=r_.splice;function o_(e){var t=this.__data__,n=Eo(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():i_.call(t,n,1),--this.size,!0}var s_=o_;function a_(e){var t=this.__data__,n=Eo(t,e);return n<0?void 0:t[n][1]}var u_=a_;function c_(e){return Eo(this.__data__,e)>-1}var l_=c_;function f_(e,t){var n=this.__data__,r=Eo(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var d_=f_;function Nr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Nr.prototype.clear=t_;Nr.prototype.delete=s_;Nr.prototype.get=u_;Nr.prototype.has=l_;Nr.prototype.set=d_;var Io=Nr,p_=Xn(ht,"Map"),li=p_;function h_(){this.size=0,this.__data__={hash:new Cc,map:new(li||Io),string:new Cc}}var y_=h_;function g_(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var m_=g_;function v_(e,t){var n=e.__data__;return m_(t)?n[typeof t=="string"?"string":"hash"]:n.map}var So=v_;function b_(e){var t=So(this,e).delete(e);return this.size-=t?1:0,t}var __=b_;function w_(e){return So(this,e).get(e)}var T_=w_;function A_(e){return So(this,e).has(e)}var O_=A_;function E_(e,t){var n=So(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var I_=E_;function Rr(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Rr.prototype.clear=y_;Rr.prototype.delete=__;Rr.prototype.get=T_;Rr.prototype.has=O_;Rr.prototype.set=I_;var $o=Rr,S_="Expected a function";function aa(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(S_);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=e.apply(this,r);return n.cache=o.set(i,s)||o,s};return n.cache=new(aa.Cache||$o),n}aa.Cache=$o;var $_=aa,N_=500;function R_(e){var t=$_(e,function(r){return n.size===N_&&n.clear(),r}),n=t.cache;return t}var P_=R_,C_=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,x_=/\\(\\)?/g,U_=P_(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(C_,function(n,r,i,o){t.push(i?o.replace(x_,"$1"):r||n)}),t}),M_=U_;function B_(e){return e==null?"":Py(e)}var D_=B_;function L_(e,t){return Vt(e)?e:sa(e,t)?[e]:M_(D_(e))}var No=L_,k_=1/0;function j_(e){if(typeof e=="string"||Or(e))return e;var t=e+"";return t=="0"&&1/e==-k_?"-0":t}var hi=j_;function F_(e,t){t=No(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[hi(t[n++])];return n&&n==r?e:void 0}var ua=F_;function z_(e,t,n){var r=e==null?void 0:ua(e,t);return r===void 0?n:r}var V_=z_;function K_(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var Yl=K_,xc=Xt?Xt.isConcatSpreadable:void 0;function q_(e){return Vt(e)||oa(e)||!!(xc&&e&&e[xc])}var G_=q_;function Ql(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=G_),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?Ql(a,t-1,n,r,i):Yl(i,a):r||(i[i.length]=a)}return i}var W_=Ql;function H_(e){var t=e==null?0:e.length;return t?W_(e,1):[]}var J_=H_;function X_(e){return ta(zl(e,void 0,J_),e+"")}var Y_=X_;function Q_(){this.__data__=new Io,this.size=0}var Z_=Q_;function ew(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var tw=ew;function nw(e){return this.__data__.get(e)}var rw=nw;function iw(e){return this.__data__.has(e)}var ow=iw,sw=200;function aw(e,t){var n=this.__data__;if(n instanceof Io){var r=n.__data__;if(!li||r.length<sw-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new $o(r)}return n.set(e,t),this.size=n.size,this}var uw=aw;function Pr(e){var t=this.__data__=new Io(e);this.size=t.size}Pr.prototype.clear=Z_;Pr.prototype.delete=tw;Pr.prototype.get=rw;Pr.prototype.has=ow;Pr.prototype.set=uw;var eo=Pr;function cw(e,t){for(var n=-1,r=e==null?0:e.length,i=0,o=[];++n<r;){var s=e[n];t(s,n,e)&&(o[i++]=s)}return o}var lw=cw;function fw(){return[]}var dw=fw,pw=Object.prototype,hw=pw.propertyIsEnumerable,Uc=Object.getOwnPropertySymbols,yw=Uc?function(e){return e==null?[]:(e=Object(e),lw(Uc(e),function(t){return hw.call(e,t)}))}:dw,gw=yw;function mw(e,t,n){var r=t(e);return Vt(e)?r:Yl(r,n(e))}var vw=mw;function bw(e){return vw(e,Xl,gw)}var Mc=bw,_w=Xn(ht,"DataView"),zs=_w,ww=Xn(ht,"Promise"),Vs=ww,Tw=Xn(ht,"Set"),Ar=Tw,Bc="[object Map]",Aw="[object Object]",Dc="[object Promise]",Lc="[object Set]",kc="[object WeakMap]",jc="[object DataView]",Ow=Jn(zs),Ew=Jn(li),Iw=Jn(Vs),Sw=Jn(Ar),$w=Jn(si),Gn=Sr;(zs&&Gn(new zs(new ArrayBuffer(1)))!=jc||li&&Gn(new li)!=Bc||Vs&&Gn(Vs.resolve())!=Dc||Ar&&Gn(new Ar)!=Lc||si&&Gn(new si)!=kc)&&(Gn=function(e){var t=Sr(e),n=t==Aw?e.constructor:void 0,r=n?Jn(n):"";if(r)switch(r){case Ow:return jc;case Ew:return Bc;case Iw:return Dc;case Sw:return Lc;case $w:return kc}return t});var Fc=Gn,Nw=ht.Uint8Array,zc=Nw,Rw="__lodash_hash_undefined__";function Pw(e){return this.__data__.set(e,Rw),this}var Cw=Pw;function xw(e){return this.__data__.has(e)}var Uw=xw;function fo(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new $o;++t<n;)this.add(e[t])}fo.prototype.add=fo.prototype.push=Cw;fo.prototype.has=Uw;var Zl=fo;function Mw(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Bw=Mw;function Dw(e,t){return e.has(t)}var ef=Dw,Lw=1,kw=2;function jw(e,t,n,r,i,o){var s=n&Lw,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),d=o.get(t);if(c&&d)return c==t&&d==e;var g=-1,C=!0,I=n&kw?new Zl:void 0;for(o.set(e,t),o.set(t,e);++g<a;){var S=e[g],z=t[g];if(r)var J=s?r(z,S,g,t,e,o):r(S,z,g,e,t,o);if(J!==void 0){if(J)continue;C=!1;break}if(I){if(!Bw(t,function(F,k){if(!ef(I,k)&&(S===F||i(S,F,n,r,o)))return I.push(k)})){C=!1;break}}else if(!(S===z||i(S,z,n,r,o))){C=!1;break}}return o.delete(e),o.delete(t),C}var tf=jw;function Fw(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}var zw=Fw;function Vw(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var nf=Vw,Kw=1,qw=2,Gw="[object Boolean]",Ww="[object Date]",Hw="[object Error]",Jw="[object Map]",Xw="[object Number]",Yw="[object RegExp]",Qw="[object Set]",Zw="[object String]",eT="[object Symbol]",tT="[object ArrayBuffer]",nT="[object DataView]",Vc=Xt?Xt.prototype:void 0,Us=Vc?Vc.valueOf:void 0;function rT(e,t,n,r,i,o,s){switch(n){case nT:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case tT:return!(e.byteLength!=t.byteLength||!o(new zc(e),new zc(t)));case Gw:case Ww:case Xw:return ra(+e,+t);case Hw:return e.name==t.name&&e.message==t.message;case Yw:case Zw:return e==t+"";case Jw:var a=zw;case Qw:var l=r&Kw;if(a||(a=nf),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=qw,s.set(e,t);var d=tf(a(e),a(t),r,i,o,s);return s.delete(e),d;case eT:if(Us)return Us.call(e)==Us.call(t)}return!1}var iT=rT,oT=1,sT=Object.prototype,aT=sT.hasOwnProperty;function uT(e,t,n,r,i,o){var s=n&oT,a=Mc(e),l=a.length,c=Mc(t),d=c.length;if(l!=d&&!s)return!1;for(var g=l;g--;){var C=a[g];if(!(s?C in t:aT.call(t,C)))return!1}var I=o.get(e),S=o.get(t);if(I&&S)return I==t&&S==e;var z=!0;o.set(e,t),o.set(t,e);for(var J=s;++g<l;){C=a[g];var F=e[C],k=t[C];if(r)var K=s?r(k,F,C,t,e,o):r(F,k,C,e,t,o);if(!(K===void 0?F===k||i(F,k,n,r,o):K)){z=!1;break}J||(J=C=="constructor")}if(z&&!J){var W=e.constructor,j=t.constructor;W!=j&&"constructor"in e&&"constructor"in t&&!(typeof W=="function"&&W instanceof W&&typeof j=="function"&&j instanceof j)&&(z=!1)}return o.delete(e),o.delete(t),z}var cT=uT,lT=1,Kc="[object Arguments]",qc="[object Array]",Zi="[object Object]",fT=Object.prototype,Gc=fT.hasOwnProperty;function dT(e,t,n,r,i,o){var s=Vt(e),a=Vt(t),l=s?qc:Fc(e),c=a?qc:Fc(t);l=l==Kc?Zi:l,c=c==Kc?Zi:c;var d=l==Zi,g=c==Zi,C=l==c;if(C&&Fs(e)){if(!Fs(t))return!1;s=!0,d=!1}if(C&&!d)return o||(o=new eo),s||Jl(e)?tf(e,t,n,r,i,o):iT(e,t,l,n,r,i,o);if(!(n&lT)){var I=d&&Gc.call(e,"__wrapped__"),S=g&&Gc.call(t,"__wrapped__");if(I||S){var z=I?e.value():e,J=S?t.value():t;return o||(o=new eo),i(z,J,n,r,o)}}return C?(o||(o=new eo),cT(e,t,n,r,i,o)):!1}var pT=dT;function rf(e,t,n,r,i){return e===t?!0:e==null||t==null||!On(e)&&!On(t)?e!==e&&t!==t:pT(e,t,n,r,rf,i)}var of=rf,hT=1,yT=2;function gT(e,t,n,r){var i=n.length,o=i,s=!r;if(e==null)return!o;for(e=Object(e);i--;){var a=n[i];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<o;){a=n[i];var l=a[0],c=e[l],d=a[1];if(s&&a[2]){if(c===void 0&&!(l in e))return!1}else{var g=new eo;if(r)var C=r(c,d,l,e,t,g);if(!(C===void 0?of(d,c,hT|yT,r,g):C))return!1}}return!0}var mT=gT;function vT(e){return e===e&&!an(e)}var sf=vT;function bT(e){for(var t=Xl(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,sf(i)]}return t}var _T=bT;function wT(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var af=wT;function TT(e){var t=_T(e);return t.length==1&&t[0][2]?af(t[0][0],t[0][1]):function(n){return n===e||mT(n,e,t)}}var AT=TT;function OT(e,t){return e!=null&&t in Object(e)}var ET=OT;function IT(e,t,n){t=No(t,e);for(var r=-1,i=t.length,o=!1;++r<i;){var s=hi(t[r]);if(!(o=e!=null&&n(e,s)))break;e=e[s]}return o||++r!=i?o:(i=e==null?0:e.length,!!i&&ia(i)&&Oo(s,i)&&(Vt(e)||oa(e)))}var ST=IT;function $T(e,t){return e!=null&&ST(e,t,ET)}var uf=$T,NT=1,RT=2;function PT(e,t){return sa(e)&&sf(t)?af(hi(e),t):function(n){var r=V_(n,e);return r===void 0&&r===t?uf(n,e):of(t,r,NT|RT)}}var CT=PT;function xT(e){return function(t){return t?.[e]}}var UT=xT;function MT(e){return function(t){return ua(t,e)}}var BT=MT;function DT(e){return sa(e)?UT(hi(e)):BT(e)}var LT=DT;function kT(e){return typeof e=="function"?e:e==null?Ao:typeof e=="object"?Vt(e)?CT(e[0],e[1]):AT(e):LT(e)}var jT=kT;function FT(e){return On(e)&&Kl(e)}var zT=FT;function VT(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}var KT=VT,qT=200;function GT(e,t,n,r){var i=-1,o=Dl,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=Il(t,Wl(n))),r?(o=KT,s=!1):t.length>=qT&&(o=ef,s=!1,t=new Zl(t));e:for(;++i<a;){var d=e[i],g=n==null?d:n(d);if(d=r||d!==0?d:0,s&&g===g){for(var C=c;C--;)if(t[C]===g)continue e;l.push(d)}else o(t,g,r)||l.push(d)}return l}var WT=GT;function HT(e,t,n,r){if(!an(e))return e;t=No(t,e);for(var i=-1,o=t.length,s=o-1,a=e;a!=null&&++i<o;){var l=hi(t[i]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=s){var d=a[l];c=r?r(d,l,a):void 0,c===void 0&&(c=an(d)?d:Oo(t[i+1])?[]:{})}Ov(a,l,c),a=a[l]}return e}var JT=HT;function XT(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=ua(e,s);n(a,s)&&JT(o,No(s,e),a)}return o}var YT=XT,QT=32,ca=Vl(function(e,t){var n=ui(t,na(ca));return mv(e,QT,void 0,t,n)});ca.placeholder={};var ZT=ca;function e0(e,t){return YT(e,t,function(n,r){return uf(e,r)})}var t0=e0,n0=Y_(function(e,t){return e==null?{}:t0(e,t)}),Wc=n0,r0=4294967295,i0=r0-1,o0=Math.floor,s0=Math.min;function a0(e,t,n,r){var i=0,o=e==null?0:e.length;if(o===0)return 0;t=n(t);for(var s=t!==t,a=t===null,l=Or(t),c=t===void 0;i<o;){var d=o0((i+o)/2),g=n(e[d]),C=g!==void 0,I=g===null,S=g===g,z=Or(g);if(s)var J=r||S;else c?J=S&&(r||C):a?J=S&&C&&(r||!I):l?J=S&&C&&!I&&(r||!z):I||z?J=!1:J=r?g<=t:g<t;J?i=d+1:o=d}return s0(o,i0)}var u0=a0;function c0(e,t,n){return u0(e,t,jT(n,2))}var l0=c0,f0=1/0,uS=Ar&&1/nf(new Ar([,-0]))[1]==f0?function(e){return new Ar(e)}:Cl;var d0=Vl(function(e,t){return zT(e)?WT(e,t):[]}),Hc=d0,cf=St(ny(),1),cS=cf.default.configure,Hn=cf.default,Ms=100,{WARN:p0,LOG:lS,DEBUG:We,VERBOSE:we,ERROR:fS}=$e.setup($e.INFO),po=Ce.set();Ju({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var Je=({caller:e,thread:t,pattern:n,args:r})=>Pe(()=>(r=r||n,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${r?`{${typeof r=="string"?r:Hn(r)}}`:""}`));function lf(e,t){return Pe(()=>ze.structural(e.get(),t.get()))}function Cr(e,t){return ze.shallow(e.applogs,t.applogs)}function Ro(e,t){if(e.size!==t.size)return!1;for(let n=0;n<e.size;n++){let r=e.nodes[n],i=t.nodes[n];if(we.isEnabled&&we("queryNodesComparer",n,r,i),!ze.structural(r.variables,i.variables))return we.isEnabled&&we("[queryNodesComparer] changed vars:",n,r,i),!1;if(!Cr(r.logsOfThisNode,i.logsOfThisNode))return we.isEnabled&&we("[queryNodesComparer] changed logsOfThisNode:",n,r,i),!1}return we.isEnabled&&we("[queryNodesComparer] equal:",{a:e,b:t}),!0}var h0=0;function Yt(e,{name:t,equals:n}={}){let r=`observableArrayMap@${++h0}{${t}}`;we.isEnabled&&we(`[${r}] create`,{fnname:e.name,fn:e,name:t,equals:n});let i,o=df(e,a=>{i?Pe(()=>(n??ze.structural)(i,a))?We.isEnabled&&We(`[${r}] update skipped`,{updatedItems:a,observableArr:i}):(i.replace(a),We.isEnabled&&We(`[${r}] updated`,{updatedItems:a,observableArr:i})):i=Ce.array(a,{deep:!1,name:t,equals:n})},{name:r});if(r.includes("useRoots")){var s=Ot(i);We(`[${r}] deps`,{disposeAutorun:o,rootsAtom:s,observableArr:i,observers:Qr(i)}),vr(()=>po.add(s))}return we.isEnabled&&br(i,()=>{we(`[${r}] observed`,Qr(i),{rootsAtom:s,observableArr:i})}),zn(i,()=>{we.isEnabled&&we(`[${r}] dispose`),s&&vr(()=>po.delete(s)),o()}),i}var y0=0;function ff(e,{name:t}={}){let n=`observableSetMap@${++y0}{${t}}`;we.isEnabled&&we(`[${n}] create`,{fnname:e.name,fn:e,name:t});let r,i=df(e,s=>{if(!r)r=Ce.set(s,{deep:!1,name:t});else{let{deleted:a,added:l}=Pe(()=>{let c=new Set(r.values()),d=new Set;for(let g of s)r.has(g)?(we.isEnabled&&we(`[${n}] unchanged`,g,{updatedItems:s,observableSet:r}),c.delete(g)):d.add(g);return We.isEnabled&&We(`[${n}] updated:`,{unseen:c,added:d,updatedItems:s,observableSet:r}),{added:d,deleted:c}});for(let c of a)r.delete(c);for(let c of l)r.add(c)}},{name:n});if(n.includes("useRoots")){var o=Ot(r);We.isEnabled&&We(`[${n}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:r,observers:Qr(r)}),vr(()=>po.add(o))}return we.isEnabled&&br(r,()=>{we(`[${n}] observed`,Qr(r),{rootsAtom:o,observableSet:r})}),zn(r,()=>{we.isEnabled&&we(`[${n}] dispose`),o&&vr(()=>po.delete(o)),i()}),r}function df(e,t=null,{name:n}={}){We.isEnabled&&We("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:n});let r=`${n}.autorunImm`,i,o=new kt(r,function(...c){We.isEnabled&&We(`[${r}] reaction.invalidate`,c),s()});function s(){o.track(function(){let c=Ms&&performance.now();We.isEnabled&&We(`[${r}] runAndTrack:`,{name:n??e.name,fn:e}),i=e(),We.isEnabled&&We(`[${r}] runAndTrack =>`,i),vr(()=>{t?.(i)}),Ms&&performance.now()-c>Ms&&p0(`[${r}] took ${performance.now()-c}ms`)})}return s(),We.isEnabled&&We(`[${r}] deps of reaction`,{reaction:o,result:i,deps:Yr(o)}),()=>{we.isEnabled&&we(`[${r}] dispose`),setTimeout(()=>o.dispose())}}function Qe(e,t,n=!1){if(gn(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let r=!1,i=0,o=typeof n=="boolean"?{keepAlive:n}:n,s=new Map;return function(...a){let l,c=Pe(()=>{let I=a;for(let S=0;S<a.length;S++)a[S]instanceof Er&&a===I&&(I=a.slice());return I}),d=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...a)}}`:""}`;for(let[I,S]of s.entries())if(m0(I,c)){l=S;break}else if(we.isEnabled)for(let z=0;z<I.length;z++)I[z]instanceof Er&&I[z].name===a[z].name&&ze.structural(Hc(I,I[z]),Hc(c,c[z]))&&we.force(`[${d}] threadState mismatch => cachebust`,{diffFields:Object.keys(I[z]).filter(J=>!ze.structural(I[z][J],a[z][J])),cacheArg:I[z],freshArg:a[z]});if(l){let I=l.get();return we.isEnabled&&we(`[${d}] cache hit`,{untrackedArgs:c,cachedResult:I}),I}if(!o.keepAlive&&!Pu())return!r&&Mu().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),r=!0),t.apply(this,a);we.isEnabled&&we(`[${d}] new computation`,{untrackedArgs:c});let g,C=De(()=>(we.isEnabled&&we(`[${d}] update->rerun`,Pe(()=>({args:a})),t),we.isEnabled&&bs(),g=t.apply(this,a)),{...o,name:d});if(we.isEnabled&&we(`[${d}] deps`,Yr(C),{untrackedArgs:c}),s.set(c,C),!o.keepAlive){let I=zn(C,()=>{we.isEnabled&&we(`[${d}] dispose`,C),I(),s.delete(c),o.onCleanup&&o.onCleanup(g,...a),g=void 0})}return C.get()}}function g0(e){let t=0,n="",r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?n+=o+`
|
|
57
57
|
`+" ".repeat(++t):o===")"?n+=`
|
|
58
58
|
`+" ".repeat(--t)+o:o===","&&r===0?n+=o+`
|
|
59
59
|
`+" ".repeat(t):o==="{"&&r===0?(r++,n+=o+`
|
|
60
60
|
`+" ".repeat(t+1)):o==="}"&&r===1?(r--,n+=`
|
|
61
|
-
`+" ".repeat(t)+o):o==="{"&&r>0?(r++,n+=o):(o==="}"&&r>1&&r--,n+=o)}return n}function y0(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]instanceof Ar){if(t[n]!==e[n])return!1}else if(!Ve.structural(e[n],t[n]))return!1;return!0}var{WARN:Wc,LOG:dS,DEBUG:g0,VERBOSE:pS,ERROR:Vn}=Ne.setup(Ne.INFO,{prefix:"[thread]"});function sn(e){return e.init!==void 0}var Ar=class{constructor(e,t,n,r=[],i={}){this.name=e,this._applogs=r,this.parents=t===null?null:oc(t),this.filters=n,Pe(()=>this.parents?.length===0)&&Wc("[Thread] empty parents array",e),i.skipObservable||mn(this,{applogsCids:De,applogsByCid:De,insert:ot,size:De,isEmpty:De,firstLog:De,latestLog:De},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw Vn("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Vn("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Vn("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw Vn("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Vn("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Vn("[Thread] insertRaw() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insertRaw(e)}subscribe(e){return this._subscribers.push(e),this.unsubscribe.bind(this,e)}unsubscribe(e){let t=this._subscribers.indexOf(e);t!==-1?this._subscribers.splice(t,1):Wc("unsubscribe called for non-existent",e)}notifySubscribers(e){g0(`[thread: ${this.name}] notifying`,this._subscribers.length,"subscribers of",{...e,subs:this._subscribers});for(let t of this._subscribers)t(e)}get applogs(){return this._applogs}get applogsCids(){return this._applogs.map(e=>e.cid)}map(e){return this.applogs.map(e)}get findLast(){return this.applogs.findLast.bind(this.applogs)}get findFirst(){return this.applogs.find.bind(this.applogs)}get firstLog(){return this.applogs[0]}get latestLog(){return this.applogs[this.applogs.length-1]}hasApplog(e,t){if(t)return this.applogs.includes(e);if(!e.cid)throw Vn("[hasApplogs] applog without CID:",e);return this.hasApplogCid(e.cid)}hasApplogCid(e){return this.applogsCids.includes(e.toString())}get applogsByCid(){return new Map(this.applogs.map(e=>[e.cid,e]))}getApplog(e){return this.applogsByCid.get(e.toString())}hasApplogWithDiffTs(e){return this.applogs.find(t=>t.en===e.en&&t.at===e.at&&t.vl===e.vl&&t.ag===e.ag)}get isEmpty(){return this.size===0}get size(){return this.applogs.length}get length(){return this.applogs.length}get untrackedSize(){return Pe(()=>this.size)}get nameAndSizeUntracked(){return Pe(()=>`${this.name} (${this.size})`)}get prettyName(){return h0(this.name)}get hasParents(){return!!this.parents?.length}};var ff=class df extends Ar{static fromArray(t,n){return new df(n||"static",null,[],t)}constructor(t,n,r,i){super(t,n,r,i,{skipObservable:!0})}get readOnly(){return!0}},pf={};Os(pf,{code:()=>xf,decode:()=>Ta,encode:()=>wa,format:()=>il,name:()=>S1,parse:()=>$1,stringify:()=>il});var m0=["string","number","bigint","symbol"],v0=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function b0(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(m0.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(_0(e))return"Buffer";let n=w0(e);return n||"Object"}function _0(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function w0(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(v0.includes(t))return t}var B=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};B.uint=new B(0,"uint",!0);B.negint=new B(1,"negint",!0);B.bytes=new B(2,"bytes",!0);B.string=new B(3,"string",!0);B.array=new B(4,"array",!1);B.map=new B(5,"map",!1);B.tag=new B(6,"tag",!1);B.float=new B(7,"float",!0);B.false=new B(7,"false",!0);B.true=new B(7,"true",!0);B.null=new B(7,"null",!0);B.undefined=new B(7,"undefined",!0);B.break=new B(7,"break",!0);var ie=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},Pr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",T0=new TextDecoder,A0=new TextEncoder;function fo(e){return Pr&&globalThis.Buffer.isBuffer(e)}function ua(e){return e instanceof Uint8Array?fo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var O0=Pr?(e,t,n)=>n-t>64?globalThis.Buffer.from(e.subarray(t,n)).toString("utf8"):Jc(e,t,n):(e,t,n)=>n-t>64?T0.decode(e.subarray(t,n)):Jc(e,t,n),hf=Pr?e=>e.length>64?globalThis.Buffer.from(e):Hc(e):e=>e.length>64?A0.encode(e):Hc(e),ca=Pr?(e,t,n)=>fo(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n),E0=Pr?(e,t)=>(e=e.map(n=>n instanceof Uint8Array?n:globalThis.Buffer.from(n)),ua(globalThis.Buffer.concat(e,t))):(e,t)=>{let n=new Uint8Array(t),r=0;for(let i of e)r+i.length>n.length&&(i=i.subarray(0,n.length-r)),n.set(i,r),r+=i.length;return n},I0=Pr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function S0(e,t){if(fo(e)&&fo(t))return e.compare(t);for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return 0}function Hc(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)===55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}function Jc(e,t,n){let r=[];for(;t<n;){let i=e[t],o=null,s=i>239?4:i>223?3:i>191?2:1;if(t+s<=n){let a,l,c,d;switch(s){case 1:i<128&&(o=i);break;case 2:a=e[t+1],(a&192)===128&&(d=(i&31)<<6|a&63,d>127&&(o=d));break;case 3:a=e[t+1],l=e[t+2],(a&192)===128&&(l&192)===128&&(d=(i&15)<<12|(a&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:a=e[t+1],l=e[t+2],c=e[t+3],(a&192)===128&&(l&192)===128&&(c&192)===128&&(d=(i&15)<<18|(a&63)<<12|(l&63)<<6|c&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),t+=s}return yf(r)}var Xc=4096;function yf(e){let t=e.length;if(t<=Xc)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Xc));return n}var N0=256,gf=class{constructor(e=N0){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=I0(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=ca(n,0,this.cursor)}else t=E0(this.chunks,this.cursor);return e&&this.reset(),t}},ye="CBOR decode error:",qn="CBOR encode error:",pi=[];pi[23]=1;pi[24]=2;pi[25]=3;pi[26]=5;pi[27]=9;function Cr(e,t,n){if(e.length-t<n)throw new Error(`${ye} not enough data for type`)}var Je=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Jn(e,t,n){Cr(e,t,1);let r=e[t];if(n.strict===!0&&r<Je[0])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return r}function Xn(e,t,n){Cr(e,t,2);let r=e[t]<<8|e[t+1];if(n.strict===!0&&r<Je[1])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return r}function Yn(e,t,n){Cr(e,t,4);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(n.strict===!0&&r<Je[2])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return r}function Qn(e,t,n){Cr(e,t,8);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(r)<<BigInt(32))+BigInt(i);if(n.strict===!0&&o<Je[3])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(n.allowBigInt===!0)return o;throw new Error(`${ye} integers outside of the safe integer range are not supported`)}function $0(e,t,n,r){return new ie(B.uint,Jn(e,t+1,r),2)}function R0(e,t,n,r){return new ie(B.uint,Xn(e,t+1,r),3)}function P0(e,t,n,r){return new ie(B.uint,Yn(e,t+1,r),5)}function C0(e,t,n,r){return new ie(B.uint,Qn(e,t+1,r),9)}function Zn(e,t){return Nt(e,0,t.value)}function Nt(e,t,n){if(n<Je[0]){let r=Number(n);e.push([t|r])}else if(n<Je[1]){let r=Number(n);e.push([t|24,r])}else if(n<Je[2]){let r=Number(n);e.push([t|25,r>>>8,r&255])}else if(n<Je[3]){let r=Number(n);e.push([t|26,r>>>24&255,r>>>16&255,r>>>8&255,r&255])}else{let r=BigInt(n);if(r<Je[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(r&BigInt(4294967295)),s=Number(r>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,e.push(i)}else throw new Error(`${ye} encountered BigInt larger than allowable range`)}}Zn.encodedSize=function(t){return Nt.encodedSize(t.value)};Nt.encodedSize=function(t){return t<Je[0]?1:t<Je[1]?2:t<Je[2]?3:t<Je[3]?5:9};Zn.compareTokens=function(t,n){return t.value<n.value?-1:t.value>n.value?1:0};function x0(e,t,n,r){return new ie(B.negint,-1-Jn(e,t+1,r),2)}function U0(e,t,n,r){return new ie(B.negint,-1-Xn(e,t+1,r),3)}function M0(e,t,n,r){return new ie(B.negint,-1-Yn(e,t+1,r),5)}var la=BigInt(-1),mf=BigInt(1);function B0(e,t,n,r){let i=Qn(e,t+1,r);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ie(B.negint,o,9)}if(r.allowBigInt!==!0)throw new Error(`${ye} integers outside of the safe integer range are not supported`);return new ie(B.negint,la-BigInt(i),9)}function fa(e,t){let n=t.value,r=typeof n=="bigint"?n*la-mf:n*-1-1;Nt(e,t.type.majorEncoded,r)}fa.encodedSize=function(t){let n=t.value,r=typeof n=="bigint"?n*la-mf:n*-1-1;return r<Je[0]?1:r<Je[1]?2:r<Je[2]?3:r<Je[3]?5:9};fa.compareTokens=function(t,n){return t.value<n.value?1:t.value>n.value?-1:0};function hi(e,t,n,r){Cr(e,t,n+r);let i=ca(e,t+n,t+n+r);return new ie(B.bytes,i,n+r)}function D0(e,t,n,r){return hi(e,t,1,n)}function L0(e,t,n,r){return hi(e,t,2,Jn(e,t+1,r))}function k0(e,t,n,r){return hi(e,t,3,Xn(e,t+1,r))}function j0(e,t,n,r){return hi(e,t,5,Yn(e,t+1,r))}function F0(e,t,n,r){let i=Qn(e,t+1,r);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer bytes lengths not supported`);return hi(e,t,9,i)}function po(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===B.string?hf(e.value):e.value),e.encodedBytes}function $o(e,t){let n=po(t);Nt(e,t.type.majorEncoded,n.length),e.push(n)}$o.encodedSize=function(t){let n=po(t);return Nt.encodedSize(n.length)+n.length};$o.compareTokens=function(t,n){return V0(po(t),po(n))};function V0(e,t){return e.length<t.length?-1:e.length>t.length?1:S0(e,t)}function yi(e,t,n,r,i){let o=n+r;Cr(e,t,o);let s=new ie(B.string,O0(e,t+n,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=ca(e,t+n,t+o)),s}function K0(e,t,n,r){return yi(e,t,1,n,r)}function z0(e,t,n,r){return yi(e,t,2,Jn(e,t+1,r),r)}function q0(e,t,n,r){return yi(e,t,3,Xn(e,t+1,r),r)}function G0(e,t,n,r){return yi(e,t,5,Yn(e,t+1,r),r)}function W0(e,t,n,r){let i=Qn(e,t+1,r);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer string lengths not supported`);return yi(e,t,9,i,r)}var H0=$o;function xr(e,t,n,r){return new ie(B.array,r,n)}function J0(e,t,n,r){return xr(e,t,1,n)}function X0(e,t,n,r){return xr(e,t,2,Jn(e,t+1,r))}function Y0(e,t,n,r){return xr(e,t,3,Xn(e,t+1,r))}function Q0(e,t,n,r){return xr(e,t,5,Yn(e,t+1,r))}function Z0(e,t,n,r){let i=Qn(e,t+1,r);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer array lengths not supported`);return xr(e,t,9,i)}function eA(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return xr(e,t,1,1/0)}function da(e,t){Nt(e,B.array.majorEncoded,t.value)}da.compareTokens=Zn.compareTokens;da.encodedSize=function(t){return Nt.encodedSize(t.value)};function Ur(e,t,n,r){return new ie(B.map,r,n)}function tA(e,t,n,r){return Ur(e,t,1,n)}function nA(e,t,n,r){return Ur(e,t,2,Jn(e,t+1,r))}function rA(e,t,n,r){return Ur(e,t,3,Xn(e,t+1,r))}function iA(e,t,n,r){return Ur(e,t,5,Yn(e,t+1,r))}function oA(e,t,n,r){let i=Qn(e,t+1,r);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer map lengths not supported`);return Ur(e,t,9,i)}function sA(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return Ur(e,t,1,1/0)}function pa(e,t){Nt(e,B.map.majorEncoded,t.value)}pa.compareTokens=Zn.compareTokens;pa.encodedSize=function(t){return Nt.encodedSize(t.value)};function aA(e,t,n,r){return new ie(B.tag,n,1)}function uA(e,t,n,r){return new ie(B.tag,Jn(e,t+1,r),2)}function cA(e,t,n,r){return new ie(B.tag,Xn(e,t+1,r),3)}function lA(e,t,n,r){return new ie(B.tag,Yn(e,t+1,r),5)}function fA(e,t,n,r){return new ie(B.tag,Qn(e,t+1,r),9)}function ha(e,t){Nt(e,B.tag.majorEncoded,t.value)}ha.compareTokens=Zn.compareTokens;ha.encodedSize=function(t){return Nt.encodedSize(t.value)};var dA=20,pA=21,hA=22,yA=23;function gA(e,t,n,r){if(r.allowUndefined===!1)throw new Error(`${ye} undefined values are not supported`);return r.coerceUndefinedToNull===!0?new ie(B.null,null,1):new ie(B.undefined,void 0,1)}function mA(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return new ie(B.break,void 0,1)}function ya(e,t,n){if(n){if(n.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ye} NaN values are not supported`);if(n.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ye} Infinity values are not supported`)}return new ie(B.float,e,t)}function vA(e,t,n,r){return ya(ma(e,t+1),3,r)}function bA(e,t,n,r){return ya(va(e,t+1),5,r)}function _A(e,t,n,r){return ya(wf(e,t+1),9,r)}function ga(e,t,n){let r=t.value;if(r===!1)e.push([B.float.majorEncoded|dA]);else if(r===!0)e.push([B.float.majorEncoded|pA]);else if(r===null)e.push([B.float.majorEncoded|hA]);else if(r===void 0)e.push([B.float.majorEncoded|yA]);else{let i,o=!1;(!n||n.float64!==!0)&&(bf(r),i=ma(jt,1),r===i||Number.isNaN(r)?(jt[0]=249,e.push(jt.slice(0,3)),o=!0):(_f(r),i=va(jt,1),r===i&&(jt[0]=250,e.push(jt.slice(0,5)),o=!0))),o||(wA(r),i=wf(jt,1),jt[0]=251,e.push(jt.slice(0,9)))}}ga.encodedSize=function(t,n){let r=t.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!n||n.float64!==!0){bf(r);let i=ma(jt,1);if(r===i||Number.isNaN(r))return 3;if(_f(r),i=va(jt,1),r===i)return 5}return 9};var vf=new ArrayBuffer(9),It=new DataView(vf,1),jt=new Uint8Array(vf,0);function bf(e){if(e===1/0)It.setUint16(0,31744,!1);else if(e===-1/0)It.setUint16(0,64512,!1);else if(Number.isNaN(e))It.setUint16(0,32256,!1);else{It.setFloat32(0,e);let t=It.getUint32(0),n=(t&2139095040)>>23,r=t&8388607;if(n===255)It.setUint16(0,31744,!1);else if(n===0)It.setUint16(0,(e&2147483648)>>16|r>>13,!1);else{let i=n-127;i<-24?It.setUint16(0,0):i<-14?It.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):It.setUint16(0,(t&2147483648)>>16|i+15<<10|r>>13,!1)}}}function ma(e,t){if(e.length-t<2)throw new Error(`${ye} not enough data for float16`);let n=(e[t]<<8)+e[t+1];if(n===31744)return 1/0;if(n===64512)return-1/0;if(n===32256)return NaN;let r=n>>10&31,i=n&1023,o;return r===0?o=i*2**-24:r!==31?o=(i+1024)*2**(r-25):o=i===0?1/0:NaN,n&32768?-o:o}function _f(e){It.setFloat32(0,e,!1)}function va(e,t){if(e.length-t<4)throw new Error(`${ye} not enough data for float32`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,4).getFloat32(0,!1)}function wA(e){It.setFloat64(0,e,!1)}function wf(e,t){if(e.length-t<8)throw new Error(`${ye} not enough data for float64`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,8).getFloat64(0,!1)}ga.compareTokens=Zn.compareTokens;function Ee(e,t,n){throw new Error(`${ye} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function Ro(e){return()=>{throw new Error(`${ye} ${e}`)}}var se=[];for(let e=0;e<=23;e++)se[e]=Ee;se[24]=$0;se[25]=R0;se[26]=P0;se[27]=C0;se[28]=Ee;se[29]=Ee;se[30]=Ee;se[31]=Ee;for(let e=32;e<=55;e++)se[e]=Ee;se[56]=x0;se[57]=U0;se[58]=M0;se[59]=B0;se[60]=Ee;se[61]=Ee;se[62]=Ee;se[63]=Ee;for(let e=64;e<=87;e++)se[e]=D0;se[88]=L0;se[89]=k0;se[90]=j0;se[91]=F0;se[92]=Ee;se[93]=Ee;se[94]=Ee;se[95]=Ro("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)se[e]=K0;se[120]=z0;se[121]=q0;se[122]=G0;se[123]=W0;se[124]=Ee;se[125]=Ee;se[126]=Ee;se[127]=Ro("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)se[e]=J0;se[152]=X0;se[153]=Y0;se[154]=Q0;se[155]=Z0;se[156]=Ee;se[157]=Ee;se[158]=Ee;se[159]=eA;for(let e=160;e<=183;e++)se[e]=tA;se[184]=nA;se[185]=rA;se[186]=iA;se[187]=oA;se[188]=Ee;se[189]=Ee;se[190]=Ee;se[191]=sA;for(let e=192;e<=215;e++)se[e]=aA;se[216]=uA;se[217]=cA;se[218]=lA;se[219]=fA;se[220]=Ee;se[221]=Ee;se[222]=Ee;se[223]=Ee;for(let e=224;e<=243;e++)se[e]=Ro("simple values are not supported");se[244]=Ee;se[245]=Ee;se[246]=Ee;se[247]=gA;se[248]=Ro("simple values are not supported");se[249]=vA;se[250]=bA;se[251]=_A;se[252]=Ee;se[253]=Ee;se[254]=Ee;se[255]=mA;var Xt=[];for(let e=0;e<24;e++)Xt[e]=new ie(B.uint,e,1);for(let e=-1;e>=-24;e--)Xt[31-e]=new ie(B.negint,e,1);Xt[64]=new ie(B.bytes,new Uint8Array(0),1);Xt[96]=new ie(B.string,"",1);Xt[128]=new ie(B.array,0,1);Xt[160]=new ie(B.map,0,1);Xt[244]=new ie(B.false,!1,1);Xt[245]=new ie(B.true,!0,1);Xt[246]=new ie(B.null,null,1);function TA(){let e=[];return e[B.uint.major]=Zn,e[B.negint.major]=fa,e[B.bytes.major]=$o,e[B.string.major]=H0,e[B.array.major]=da,e[B.map.major]=pa,e[B.tag.major]=ha,e[B.float.major]=ga,e}var hS=TA(),Us=new gf,Yc=class Tf{constructor(t,n){this.obj=t,this.parent=n}includes(t){let n=this;do if(n.obj===t)return!0;while(n=n.parent);return!1}static createCheck(t,n){if(t&&t.includes(n))throw new Error(`${qn} object contains circular references`);return new Tf(n,t)}},vn={null:new ie(B.null,null),undefined:new ie(B.undefined,void 0),true:new ie(B.true,!0),false:new ie(B.false,!1),emptyArray:new ie(B.array,0),emptyMap:new ie(B.map,0)},An={number(e,t,n,r){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ie(B.float,e):e>=0?new ie(B.uint,e):new ie(B.negint,e)},bigint(e,t,n,r){return e>=BigInt(0)?new ie(B.uint,e):new ie(B.negint,e)},Uint8Array(e,t,n,r){return new ie(B.bytes,e)},string(e,t,n,r){return new ie(B.string,e)},boolean(e,t,n,r){return e?vn.true:vn.false},null(e,t,n,r){return vn.null},undefined(e,t,n,r){return vn.undefined},ArrayBuffer(e,t,n,r){return new ie(B.bytes,new Uint8Array(e))},DataView(e,t,n,r){return new ie(B.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,n,r){if(!e.length)return n.addBreakTokens===!0?[vn.emptyArray,new ie(B.break)]:vn.emptyArray;r=Yc.createCheck(r,e);let i=[],o=0;for(let s of e)i[o++]=Zi(s,n,r);return n.addBreakTokens?[new ie(B.array,e.length),i,new ie(B.break)]:[new ie(B.array,e.length),i]},Object(e,t,n,r){let i=t!=="Object",o=i?e.keys():Object.keys(e),s=i?e.size:o.length;if(!s)return n.addBreakTokens===!0?[vn.emptyMap,new ie(B.break)]:vn.emptyMap;r=Yc.createCheck(r,e);let a=[],l=0;for(let c of o)a[l++]=[Zi(c,n,r),Zi(i?e.get(c):e[c],n,r)];return AA(a,n),n.addBreakTokens?[new ie(B.map,s),a,new ie(B.break)]:[new ie(B.map,s),a]}};An.Map=An.Object;An.Buffer=An.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))An[`${e}Array`]=An.DataView;function Zi(e,t={},n){let r=b0(e),i=t&&t.typeEncoders&&t.typeEncoders[r]||An[r];if(typeof i=="function"){let s=i(e,r,t,n);if(s!=null)return s}let o=An[r];if(!o)throw new Error(`${qn} unsupported type: ${r}`);return o(e,r,t,n)}function AA(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Af(e,t,n,r){if(Array.isArray(t))for(let i of t)Af(e,i,n,r);else n[t.type.major](e,t,r)}function OA(e,t,n){let r=Zi(e,n);if(!Array.isArray(r)&&n.quickEncodeToken){let i=n.quickEncodeToken(r);if(i)return i;let o=t[r.type.major];if(o.encodedSize){let s=o.encodedSize(r,n),a=new gf(s);if(o(a,r,n),a.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${r} was wrong`);return ua(a.chunks[0])}}return Us.reset(),Af(Us,r,t,n),Us.toBytes(!0)}var EA={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},IA=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=Xt[e];if(t===void 0){let n=se[e];if(!n)throw new Error(`${ye} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let r=e&31;t=n(this.data,this._pos,r,this.options)}return this._pos+=t.encodedLength,t}},ci=Symbol.for("DONE"),Po=Symbol.for("BREAK");function SA(e,t,n){let r=[];for(let i=0;i<e.value;i++){let o=li(t,n);if(o===Po){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed array`)}if(o===ci)throw new Error(`${ye} found array but not enough entries (got ${i}, expected ${e.value})`);r[i]=o}return r}function NA(e,t,n){let r=n.useMaps===!0,i=r?void 0:{},o=r?new Map:void 0;for(let s=0;s<e.value;s++){let a=li(t,n);if(a===Po){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed map`)}if(a===ci)throw new Error(`${ye} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(r!==!0&&typeof a!="string")throw new Error(`${ye} non-string keys not supported (got ${typeof a})`);if(n.rejectDuplicateMapKeys===!0&&(r&&o.has(a)||!r&&a in i))throw new Error(`${ye} found repeat map key "${a}"`);let l=li(t,n);if(l===ci)throw new Error(`${ye} found map but not enough entries (got ${s} [no value], expected ${e.value})`);r?o.set(a,l):i[a]=l}return r?o:i}function li(e,t){if(e.done())return ci;let n=e.next();if(n.type===B.break)return Po;if(n.type.terminal)return n.value;if(n.type===B.array)return SA(n,e,t);if(n.type===B.map)return NA(n,e,t);if(n.type===B.tag){if(t.tags&&typeof t.tags[n.value]=="function"){let r=li(e,t);return t.tags[n.value](r)}throw new Error(`${ye} tag not supported (${n.value})`)}throw new Error("unsupported")}function $A(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ye} data to decode must be a Uint8Array`);t=Object.assign({},EA,t);let n=t.tokenizer||new IA(e,t),r=li(n,t);if(r===ci)throw new Error(`${ye} did not find any content to decode`);if(r===Po)throw new Error(`${ye} got unexpected break`);return[r,e.subarray(n.pos())]}function RA(e,t){let[n,r]=$A(e,t);if(r.length>0)throw new Error(`${ye} too many terminals, data makes no sense`);return n}var PA=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===B.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===B.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[B.uint.major](e,t){this.prefix(e);let n=String(t.value),r=[];for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);e.push(r)}[B.negint.major](e,t){this[B.uint.major](e,t)}[B.bytes.major](e,t){throw new Error(`${qn} unsupported type: Uint8Array`)}[B.string.major](e,t){this.prefix(e);let n=hf(JSON.stringify(t.value));e.push(n.length>32?ua(n):n)}[B.array.major](e,t){this.prefix(e),this.inRecursive.push({type:B.array,elements:0}),e.push([91])}[B.map.major](e,t){this.prefix(e),this.inRecursive.push({type:B.map,elements:0}),e.push([123])}[B.tag.major](e,t){}[B.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===B.array)e.push([93]);else if(o.type===B.map)e.push([125]);else throw new Error("Unexpected recursive type; this should not happen!");return}throw new Error("Unexpected break; this should not happen!")}if(t.value===void 0)throw new Error(`${qn} unsupported type: undefined`);if(this.prefix(e),t.type.name==="true"){e.push([116,114,117,101]);return}else if(t.type.name==="false"){e.push([102,97,108,115,101]);return}else if(t.type.name==="null"){e.push([110,117,108,108]);return}let n=String(t.value),r=[],i=!1;for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o),!i&&(r[o]===46||r[o]===101||r[o]===69)&&(i=!0);i||(r.push(46),r.push(48)),e.push(r)}};function CA(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${qn} complex map keys are not supported`);let n=e[0],r=t[0];if(n.type!==B.string||r.type!==B.string)throw new Error(`${qn} non-string map keys are not supported`);if(n<r)return-1;if(n>r)return 1;throw new Error(`${qn} unexpected duplicate map keys, this is not supported`)}var xA={addBreakTokens:!0,mapSorter:CA};function UA(e,t){return t=Object.assign({},xA,t),OA(e,new PA,t)}var Of=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t,this.modeStack=["value"],this.lastToken=""}pos(){return this._pos}done(){return this._pos>=this.data.length}ch(){return this.data[this._pos]}currentMode(){return this.modeStack[this.modeStack.length-1]}skipWhitespace(){let e=this.ch();for(;e===32||e===9||e===13||e===10;)e=this.data[++this._pos]}expect(e){if(this.data.length-this._pos<e.length)throw new Error(`${ye} unexpected end of input at position ${this._pos}`);for(let t=0;t<e.length;t++)if(this.data[this._pos++]!==e[t])throw new Error(`${ye} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,n=!1,r=s=>{for(;!this.done();){let a=this.ch();if(s.includes(a))this._pos++;else break}};if(this.ch()===45&&(t=!0,this._pos++),this.ch()===48)if(this._pos++,this.ch()===46)this._pos++,n=!0;else return new ie(B.uint,0,this._pos-e);if(r([48,49,50,51,52,53,54,55,56,57]),t&&this._pos===e+1)throw new Error(`${ye} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(n)throw new Error(`${ye} unexpected token at position ${this._pos}`);n=!0,this._pos++,r([48,49,50,51,52,53,54,55,56,57])}!this.done()&&(this.ch()===101||this.ch()===69)&&(n=!0,this._pos++,!this.done()&&(this.ch()===43||this.ch()===45)&&this._pos++,r([48,49,50,51,52,53,54,55,56,57]));let i=String.fromCharCode.apply(null,this.data.subarray(e,this._pos)),o=parseFloat(i);return n?new ie(B.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ie(o>=0?B.uint:B.negint,o,this._pos-e):new ie(o>=0?B.uint:B.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${ye} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,o=0;i<this.data.length&&o<65536;i++,o++){let s=this.data[i];if(s===92||s<32||s>=128)break;if(s===34){let a=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new ie(B.string,a,o)}}let e=this._pos,t=[],n=()=>{if(this._pos+4>=this.data.length)throw new Error(`${ye} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let s=this.ch();if(s>=48&&s<=57)s-=48;else if(s>=97&&s<=102)s=s-97+10;else if(s>=65&&s<=70)s=s-65+10;else throw new Error(`${ye} unexpected unicode escape character at position ${this._pos}`);i=i*16+s,this._pos++}return i},r=()=>{let i=this.ch(),o=null,s=i>239?4:i>223?3:i>191?2:1;if(this._pos+s>this.data.length)throw new Error(`${ye} unexpected unicode sequence at position ${this._pos}`);let a,l,c,d;switch(s){case 1:i<128&&(o=i);break;case 2:a=this.data[this._pos+1],(a&192)===128&&(d=(i&31)<<6|a&63,d>127&&(o=d));break;case 3:a=this.data[this._pos+1],l=this.data[this._pos+2],(a&192)===128&&(l&192)===128&&(d=(i&15)<<12|(a&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:a=this.data[this._pos+1],l=this.data[this._pos+2],c=this.data[this._pos+3],(a&192)===128&&(l&192)===128&&(c&192)===128&&(d=(i&15)<<18|(a&63)<<12|(l&63)<<6|c&63,d>65535&&d<1114112&&(o=d))}o===null?(o=65533,s=1):o>65535&&(o-=65536,t.push(o>>>10&1023|55296),o=56320|o&1023),t.push(o),this._pos+=s};for(;!this.done();){let i=this.ch(),o;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${ye} unexpected string termination at position ${this._pos}`);switch(o=this.ch(),this._pos++,o){case 34:case 39:case 92:case 47:t.push(o);break;case 98:t.push(8);break;case 116:t.push(9);break;case 110:t.push(10);break;case 102:t.push(12);break;case 114:t.push(13);break;case 117:t.push(n());break;default:throw new Error(`${ye} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ie(B.string,yf(t),this._pos-e);default:if(i<32)throw new Error(`${ye} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):r()}}throw new Error(`${ye} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ie(B.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ie(B.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ie(B.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ie(B.false,!1,5);case 116:return this.expect([116,114,117,101]),new ie(B.true,!0,4);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.parseNumber();default:throw new Error(`${ye} unexpected character at position ${this._pos}`)}}next(){switch(this.skipWhitespace(),this.currentMode()){case"value":return this.modeStack.pop(),this.parseValue();case"array-value":{if(this.modeStack.pop(),this.ch()===93)return this._pos++,this.skipWhitespace(),new ie(B.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} unexpected character at position ${this._pos}, was expecting array delimiter but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("array-value"),this.skipWhitespace(),this.parseValue()}case"array-start":return this.modeStack.pop(),this.ch()===93?(this._pos++,this.skipWhitespace(),new ie(B.break,void 0,1)):(this.modeStack.push("array-value"),this.skipWhitespace(),this.parseValue());case"obj-key":if(this.ch()===125)return this.modeStack.pop(),this._pos++,this.skipWhitespace(),new ie(B.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} unexpected character at position ${this._pos}, was expecting object delimiter but found '${String.fromCharCode(this.ch())}'`);this._pos++,this.skipWhitespace();case"obj-start":{if(this.modeStack.pop(),this.ch()===125)return this._pos++,this.skipWhitespace(),new ie(B.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${ye} unexpected character at position ${this._pos}, was expecting key/value delimiter ':' but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("obj-value"),e}case"obj-value":return this.modeStack.pop(),this.modeStack.push("obj-key"),this.skipWhitespace(),this.parseValue();default:throw new Error(`${ye} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function MA(e,t){return t=Object.assign({tokenizer:new Of(e,t)},t),RA(e,t)}var yS=new Uint8Array(0);function BA(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0}function ba(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function DA(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(n[s]!==255)throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function g(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var V=0,J=0,F=0,k=S.length;F!==k&&S[F]===0;)F++,V++;for(var z=(k-F)*d+1>>>0,W=new Uint8Array(z);F!==k;){for(var j=S[F],Z=0,G=z-1;(j!==0||Z<J)&&G!==-1;G--,Z++)j+=256*W[G]>>>0,W[G]=j%a>>>0,j=j/a>>>0;if(j!==0)throw new Error("Non-zero carry");J=Z,F++}for(var fe=z-J;fe!==z&&W[fe]===0;)fe++;for(var x=l.repeat(V);fe<z;++fe)x+=e.charAt(W[fe]);return x}function C(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var V=0;if(S[V]!==" "){for(var J=0,F=0;S[V]===l;)J++,V++;for(var k=(S.length-V)*c+1>>>0,z=new Uint8Array(k);S[V];){var W=n[S.charCodeAt(V)];if(W===255)return;for(var j=0,Z=k-1;(W!==0||j<F)&&Z!==-1;Z--,j++)W+=a*z[Z]>>>0,z[Z]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");F=j,V++}if(S[V]!==" "){for(var G=k-F;G!==k&&z[G]===0;)G++;for(var fe=new Uint8Array(J+(k-G)),x=J;G!==k;)fe[x++]=z[G++];return fe}}}function I(S){var V=C(S);if(V)return V;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:C,decode:I}}var LA=DA,kA=LA,jA=kA,FA=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},VA=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let r=t.codePointAt(0);if(r===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Ef(this,e)}},KA=class{decoders;constructor(e){this.decoders=e}or(e){return Ef(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Ef(e,t){return new KA({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var zA=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new FA(e,t,n),this.decoder=new VA(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function If({name:e,prefix:t,encode:n,decode:r}){return new zA(e,t,n,r)}function Co({name:e,prefix:t,alphabet:n}){let{encode:r,decode:i}=jA(n,e);return If({prefix:t,name:e,encode:r,decode:o=>ba(i(o))})}function qA(e,t,n,r){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*n/8|0),s=0,a=0,l=0;for(let c=0;c<i;++c){let d=t[e[c]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);a=a<<n|d,s+=n,s>=8&&(s-=8,o[l++]=255&a>>s)}if(s>=n||255&a<<8-s)throw new SyntaxError("Unexpected end of data");return o}function GA(e,t,n){let r=t[t.length-1]==="=",i=(1<<n)-1,o="",s=0,a=0;for(let l=0;l<e.length;++l)for(a=a<<8|e[l],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s!==0&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o}function WA(e){let t={};for(let n=0;n<e.length;++n)t[e[n]]=n;return t}function pt({name:e,prefix:t,bitsPerChar:n,alphabet:r}){let i=WA(r);return If({prefix:t,name:e,encode(o){return GA(o,r,n)},decode(o){return qA(o,i,n,e)}})}var eo=pt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),gS=pt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mS=pt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),vS=pt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),bS=pt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_S=pt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),wS=pt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),TS=pt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),AS=pt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ms=Co({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),OS=Co({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),wn=Co({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ES=Co({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Sf={};Os(Sf,{Digest:()=>xo,create:()=>_a,decode:()=>$f,equals:()=>Rf,hasCode:()=>d1});var HA=Nf,Qc=128,JA=127,XA=~JA,YA=Math.pow(2,31);function Nf(e,t,n){t=t||[],n=n||0;for(var r=n;e>=YA;)t[n++]=e&255|Qc,e/=128;for(;e&XA;)t[n++]=e&255|Qc,e>>>=7;return t[n]=e|0,Nf.bytes=n-r+1,t}var QA=Vs,ZA=128,Zc=127;function Vs(e,r){var n=0,r=r||0,i=0,o=r,s,a=e.length;do{if(o>=a)throw Vs.bytes=0,new RangeError("Could not decode varint");s=e[o++],n+=i<28?(s&Zc)<<i:(s&Zc)*Math.pow(2,i),i+=7}while(s>=ZA);return Vs.bytes=o-r,n}var e1=Math.pow(2,7),t1=Math.pow(2,14),n1=Math.pow(2,21),r1=Math.pow(2,28),i1=Math.pow(2,35),o1=Math.pow(2,42),s1=Math.pow(2,49),a1=Math.pow(2,56),u1=Math.pow(2,63),c1=function(e){return e<e1?1:e<t1?2:e<n1?3:e<r1?4:e<i1?5:e<o1?6:e<s1?7:e<a1?8:e<u1?9:10},l1={encode:HA,decode:QA,encodingLength:c1},f1=l1,ho=f1;function Ks(e,t=0){return[ho.decode(e,t),ho.decode.bytes]}function yo(e,t,n=0){return ho.encode(e,t,n),t}function go(e){return ho.encodingLength(e)}function _a(e,t){let n=t.byteLength,r=go(e),i=r+go(n),o=new Uint8Array(i+n);return yo(e,o,0),yo(n,o,r),o.set(t,i),new xo(e,n,t,o)}function $f(e){let t=ba(e),[n,r]=Ks(t),[i,o]=Ks(t.subarray(r)),s=t.subarray(r+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new xo(n,i,s,t)}function Rf(e,t){if(e===t)return!0;{let n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&BA(e.bytes,n.bytes)}}var xo=class{code;size;digest;bytes;constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}};function d1(e,t){return e.code===t}function el(e,t){let{bytes:n,version:r}=e;switch(r){case 0:return h1(n,zs(e),t??wn.encoder);default:return y1(n,zs(e),t??eo.encoder)}}var tl=new WeakMap;function zs(e){let t=tl.get(e);if(t==null){let n=new Map;return tl.set(e,n),n}return t}var Uo=class Ze{code;version;multihash;bytes;"/";constructor(t,n,r,i){this.code=n,this.version=t,this.multihash=r,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:n}=this;if(t!==ti)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(n.code!==g1)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ze.createV0(n)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:n}=this.multihash,r=_a(t,n);return Ze.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return Ze.equals(this,t)}static equals(t,n){let r=n;return r!=null&&t.code===r.code&&t.version===r.version&&Rf(t.multihash,r.multihash)}toString(t){return el(this,t)}toJSON(){return{"/":el(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let n=t;if(n instanceof Ze)return n;if(n["/"]!=null&&n["/"]===n.bytes||n.asCID===n){let{version:r,code:i,multihash:o,bytes:s}=n;return new Ze(r,i,o,s??nl(r,i,o.bytes))}else if(n[m1]===!0){let{version:r,multihash:i,code:o}=n,s=$f(i);return Ze.create(r,o,s)}else return null}static create(t,n,r){if(typeof n!="number")throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(n!==ti)throw new Error(`Version 0 CID must use dag-pb (code: ${ti}) block encoding`);return new Ze(t,n,r,r.bytes)}case 1:{let i=nl(t,n,r.bytes);return new Ze(t,n,r,i)}default:throw new Error("Invalid version")}}static createV0(t){return Ze.create(0,ti,t)}static createV1(t,n){return Ze.create(1,t,n)}static decode(t){let[n,r]=Ze.decodeFirst(t);if(r.length!==0)throw new Error("Incorrect length");return n}static decodeFirst(t){let n=Ze.inspectBytes(t),r=n.size-n.multihashSize,i=ba(t.subarray(r,r+n.multihashSize));if(i.byteLength!==n.multihashSize)throw new Error("Incorrect length");let o=i.subarray(n.multihashSize-n.digestSize),s=new xo(n.multihashCode,n.digestSize,o,i);return[n.version===0?Ze.createV0(s):Ze.createV1(n.codec,s),t.subarray(n.size)]}static inspectBytes(t){let n=0,r=()=>{let[g,C]=Ks(t.subarray(n));return n+=C,g},i=r(),o=ti;if(i===18?(i=0,n=0):o=r(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=n,a=r(),l=r(),c=n+l,d=c-s;return{version:i,codec:o,multihashCode:a,digestSize:l,multihashSize:d,size:c}}static parse(t,n){let[r,i]=p1(t,n),o=Ze.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return zs(o).set(r,t),o}};function p1(e,t){switch(e[0]){case"Q":{let n=t??wn;return[wn.prefix,n.decode(`${wn.prefix}${e}`)]}case wn.prefix:{let n=t??wn;return[wn.prefix,n.decode(e)]}case eo.prefix:{let n=t??eo;return[eo.prefix,n.decode(e)]}case Ms.prefix:{let n=t??Ms;return[Ms.prefix,n.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function h1(e,t,n){let{prefix:r}=n;if(r!==wn.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);let i=t.get(r);if(i==null){let o=n.encode(e).slice(1);return t.set(r,o),o}else return i}function y1(e,t,n){let{prefix:r}=n,i=t.get(r);if(i==null){let o=n.encode(e);return t.set(r,o),o}else return i}var ti=112,g1=18;function nl(e,t,n){let r=go(e),i=r+go(t),o=new Uint8Array(i+n.byteLength);return yo(e,o,0),yo(t,o,r),o.set(n,i),o}var m1=Symbol.for("@ipld/js-cid/CID"),v1=20;function Pf({name:e,code:t,encode:n,minDigestLength:r,maxDigestLength:i}){return new b1(e,t,n,r,i)}var b1=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,r,i){this.name=e,this.code=t,this.encode=n,this.minDigestLength=r??v1,this.maxDigestLength=i}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?rl(n,this.code,t?.truncate):n.then(r=>rl(r,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function rl(e,t,n){if(n!=null&&n!==e.byteLength){if(n>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,n)}return _a(t,e)}var Cf=pt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),IS=pt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),SS=pt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),NS=pt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function _1(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function w1(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Uo.asCID(e);if(!t)return null;let n=t.toString();return[new ie(B.map,1/0,1),new ie(B.string,"/",1),new ie(B.string,n,n.length),new ie(B.break,void 0,1)]}function mo(e){let t=Cf.encode(e).slice(1);return[new ie(B.map,1/0,1),new ie(B.string,"/",1),new ie(B.map,1/0,1),new ie(B.string,"bytes",5),new ie(B.string,t,t.length),new ie(B.break,void 0,1),new ie(B.break,void 0,1)]}function kt(e){return mo(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function T1(e){return mo(new Uint8Array(e))}function A1(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function O1(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var E1={typeEncoders:{Object:w1,Buffer:mo,Uint8Array:mo,Int8Array:kt,Uint16Array:kt,Int16Array:kt,Uint32Array:kt,Int32Array:kt,Float32Array:kt,Float64Array:kt,Uint8ClampedArray:kt,BigInt64Array:kt,BigUint64Array:kt,DataView:kt,ArrayBuffer:T1,undefined:A1,number:O1}},I1=class extends Of{constructor(e,t){super(e,t),this.tokenBuffer=[]}done(){return this.tokenBuffer.length===0&&super.done()}_next(){return this.tokenBuffer.length>0?this.tokenBuffer.pop():super.next()}next(){let e=this._next();if(e.type===B.map){let t=this._next();if(t.type===B.string&&t.value==="/"){let n=this._next();if(n.type===B.string){if(this._next().type!==B.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(n),new ie(B.tag,42,0)}if(n.type===B.map){let r=this._next();if(r.type===B.string&&r.value==="bytes"){let i=this._next();if(i.type===B.string){for(let s=0;s<2;s++)if(this._next().type!==B.break)throw new Error("Invalid encoded Bytes form");let o=Cf.decode(`m${i.value}`);return new ie(B.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(r)}this.tokenBuffer.push(n)}this.tokenBuffer.push(t)}return e}},qs={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};qs.tags[42]=Uo.parse;var S1="dag-json",xf=297,wa=e=>UA(e,E1),Ta=e=>{let t=_1(e),n=Object.assign(qs,{tokenizer:new I1(t,qs)});return MA(t,n)},il=e=>N1.decode(wa(e)),N1=new TextDecoder,$1=e=>Ta(R1.encode(e)),R1=new TextEncoder;function P1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Uf(e,t,n=""){let r=P1(e),i=e?.length,o=t!==void 0;if(!r||o&&i!==t){let s=n&&`"${n}" `,a=o?` of length ${t}`:"",l=r?`length=${i}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+a+", got "+l)}return e}function ol(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function C1(e,t){Uf(e,void 0,"digestInto() output");let n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function Gs(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Bs(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Wt(e,t){return e<<32-t|e>>>t}function x1(e,t={}){let n=(i,o)=>e(o).update(i).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=i=>e(i),Object.assign(n,t),Object.freeze(n)}var U1=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function M1(e,t,n){return e&t^~e&n}function B1(e,t,n){return e&t^e&n^t&n}var D1=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=Bs(this.buffer)}update(e){ol(this),Uf(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);if(s===r){let a=Bs(e);for(;r<=i-o;o+=r)this.process(a,o);continue}n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ol(this),C1(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:o}=this;t[o++]=128,Gs(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let d=o;d<r;d++)t[d]=0;n.setBigUint64(r-8,BigInt(this.length*8),i),this.process(n,0);let s=Bs(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)s.setUint32(4*d,c[d],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=r,e.pos=s,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}},bn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),L1=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_n=new Uint32Array(64),k1=class extends D1{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=o|0,this.G=s|0,this.H=a|0}process(e,t){for(let d=0;d<16;d++,t+=4)_n[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let g=_n[d-15],C=_n[d-2],I=Wt(g,7)^Wt(g,18)^g>>>3,S=Wt(C,17)^Wt(C,19)^C>>>10;_n[d]=S+_n[d-7]+I+_n[d-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:l,H:c}=this;for(let d=0;d<64;d++){let g=Wt(s,6)^Wt(s,11)^Wt(s,25),C=c+g+M1(s,a,l)+L1[d]+_n[d]|0,S=(Wt(n,2)^Wt(n,13)^Wt(n,22))+B1(n,r,i)|0;c=l,l=a,a=s,s=o+C|0,o=i,i=r,r=n,n=C+S|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,l,c)}roundClean(){Gs(_n)}destroy(){this.set(0,0,0,0,0,0,0,0),Gs(this.buffer)}},j1=class extends k1{A=bn[0]|0;B=bn[1]|0;C=bn[2]|0;D=bn[3]|0;E=bn[4]|0;F=bn[5]|0;G=bn[6]|0;H=bn[7]|0;constructor(){super(32)}},F1=x1(()=>new j1,U1(1));var Ge=Et(rn(),1),Mf=Et(oy(),1),sl=e=>Ge.Type.Union([e,Ge.Type.Null()]);var Bf=/^(k51qz|baguq)[0-9a-z]{56,57}$/,V1=/^[0-9A-Fa-f]{7,8}$/g;Ge.FormatRegistry.Set("EntityID",e=>!!e.match(V1)||!!e.match(Bf));var K1=Ge.Type.String(),z1=e=>e?.enc instanceof Uint8Array;Ge.FormatRegistry.Set("CID",e=>!!e.match(Bf));var Df=Ge.Type.String({format:"CID"}),q1=/^http([s]?):\/\/.*\..*/;Ge.FormatRegistry.Set("URL",e=>!!e.match(q1));var $S=Ge.Type.String({format:"URL"}),Lf=Ge.Type.Object({en:K1,at:Ge.Type.String(),vl:sl(Ge.Type.Union([Ge.Type.String(),Ge.Type.Boolean(),Ge.Type.Number()])),ts:Ge.Type.String(),ag:Ge.Type.String(),pv:sl(Df)}),al=Mf.TypeCompiler.Compile(Lf);var RS=al.Check.bind(al),G1=Ge.Type.Composite([Ge.Type.Object({cid:Df}),Lf]),Ws=Mf.TypeCompiler.Compile(G1),W1=e=>Array.from(Ws.Errors(e)),kf=Ws.Check.bind(Ws);function jf(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var H1=Pf({name:"sha2-256",code:18,encode:jf("SHA-256")}),PS=Pf({name:"sha2-512",code:19,encode:jf("SHA-512")}),{WARN:ul,LOG:CS,DEBUG:J1,VERBOSE:Ff,ERROR:X1}=Ne.setup(Ne.INFO);function Vf(e,t=["cid"]){if(!e)throw X1("falsy log",e);let n=e.cid;if(z1(e))return n||(n=Aa(Kf(e).bytes).toString()),ul("preparing an encrypted applog - really?"),{log:e,cid:n};let r={};for(let[i,o]of Object.entries(e))o===void 0&&(ul(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?Ff("excluding app log",{key:i,val:o}):r[i]=o;return{log:r,cid:n}}function Y1(e){return Aa(Q1(e).bytes)}function Q1(e){return Kf(Vf(e)?.log)}function Aa(e){let t=F1(e),n=Sf.create(H1.code,t),r=Uo.create(1,xf,n);return Ff("[getCidSync]",{bytes:e,hash:t,digest:n,cid:r}),r}function Kf(e){J1("[encodeBlock]",e);let t=wa(e);return{bytes:t,cid:Aa(t)}}function cl(e){let t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function Z1(e,t){let n=cl(e),r=cl(t);return+n<+r}var{WARN:xS,LOG:US,DEBUG:MS,VERBOSE:eO,ERROR:ll}=Ne.setup(Ne.INFO),tO=(e,t,n="asc")=>n==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),zf=(e,t,n)=>Ve.structural(qc(t,e),qc(n,e)),nO=(e,t,n="asc")=>tO(e.ts,t.ts,n),BS=YT(zf,["en","at"]);function fi(e,t="asc"){return e.sort((n,r)=>nO(n,r,t))}var rO=(e,t)=>Z1(new Date(e.ts),new Date(t.ts));var qf=e=>{let t=new Map;for(let n of e){if(!n)throw ll("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!n.cid)throw ll("applog with missing CID",n),new Error("applog with missing CID");let r=n.cid;t.has(r)?eO("Skipping duplicate applog:",[t.get(r),n]):t.set(r,n)}return Array.from(t.values())};function iO(e){return typeof e=="string"&&e.startsWith("?")}function oO(e){return e.slice(1)}function Oa(e,t){let n={},r={};for(let[i,o]of Object.entries(e))if(iO(o)){let s=oO(o),a=t[s];a?r[i]=a:n[i]=s}else r[i]=o;return[r,n]}function sO(e,t,n){let r;if(t){let i=typeof t;i==="string"?r=t===n:i==="function"?r=t(n):typeof t.has=="function"?r=t.has(n):Array.isArray(t)&&!Array.isArray(n)?r=t.includes(n):r=t===n}else r=t===n;return e.charAt(0)==="!"?!r:r}var Gf=function(t){for(var n=0,r=0,i=t.length;r<i;r++)n+=t[r];return n},fl=function(t){return Gf(t)/t.length},St={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return St.max(e)-St.min(e)},midrange:function(e){return St.range(e)/2},sum:Gf,mean:fl,average:fl,median:function(e){e.sort(function(n,r){return n-r});var t=e.length/2;return t%1?e[t-.5]:(e[t-1]+e[t])/2},modes:function(e){if(!e.length)return[];var t={},n=0,r=[];return e.forEach(function(i){t[i]?t[i]++:t[i]=1,t[i]>n?(r=[i],n=t[i]):t[i]===n&&(r.push(i),n=t[i])}),r},variance:function(e){var t=St.mean(e);return St.mean(e.map(function(n){return Math.pow(n-t,2)}))},standardDeviation:function(e){return Math.sqrt(St.variance(e))},meanAbsoluteDeviation:function(e){var t=St.mean(e);return St.mean(e.map(function(n){return Math.abs(n-t)}))},zScores:function(e){var t=St.mean(e),n=St.standardDeviation(e);return e.map(function(r){return(r-t)/n})}};St.average=St.mean;var Wf=function(e,t=13,n){if(!e?.length)throw new Error(`Empty string: ${e}`);let r=3735928559^t,i=1103547991^t;for(let s=0,a;s<e.length;s++)a=e.charCodeAt(s),r=Math.imul(r^a,2654435761),i=Math.imul(i^a,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),(4294967296*(2097151&i)+(r>>>0)).toString(16).slice(-n).padStart(n,"0")};function Hf(){return new Date().toISOString()}var{WARN:aO,LOG:DS,DEBUG:uO,VERBOSE:LS,ERROR:vo}=Ne.setup(Ne.INFO);function cO(e,t){let n=Hf(),r=t;return e.map(o=>lO(o,{ts:n,threadForPv:r}))}function lO(e,{ts:t,threadForPv:n}={}){let r=pO(e,t??Hf()),i=hO(r,n),o=Y1(i).toString();e.cid&&e.cid!==o&&aO("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let s={...i,cid:o};if(!kf(s))throw vo(`Bogus Applog ${JSON.stringify(s)}`,W1(s));return Object.freeze(s)}function fO(e){return!!e.ts}function dO(e){return!!e.pv}function pO(e,t){return fO(e)?e:{...e,ts:t}}function hO(e,t){if(e.pv!==void 0)return e;if(t){let{en:n,at:r}=e,i=t.findLast(s=>s.en==n&&s.at==r);if(zf(["en","at","vl","ts","ag"],e,i))throw vo("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return{...e,pv:o}}else{if(!dO(e))throw vo("[withPvFrom] no thread and no pv:",e);return e}}function Mo(e){let t=()=>(Pe(()=>e.length<2&&uO(`joinThreads with count=${e.length}`)),fi(qf(e.flatMap(i=>{let o=i.applogs;if(!o)throw vo("falsy applogs of thread",i),new Error("falsy applogs of thread");return o})))),n=Pe(()=>t()),r=ot(function(i,o){return sn(i)?{init:Pe(()=>t())}:{added:i.added.filter(s=>!this.hasApplog(s,!0)),removed:i.removed?.filter(s=>!!this.parents.some(l=>l===o?!1:l.hasApplog(s,!0)))}});return new Ea(Pe(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],n,r)}var{WARN:dl,LOG:kS,DEBUG:pl,VERBOSE:Kn,ERROR:hl}=Ne.setup(Ne.INFO),Ea=class Jf extends Ar{constructor(t,n,r,i,o,s=null){super(t,n,r,o?Ce.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=s,mn(this,{onParentUpdate:ot}),o&&this.subscribeToParents()}static mapWrites(t,n,r){return new Jf(`${n}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,r)}_parentSubscriptions=null;insert(t){let n=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!n))return this.parents.forEach(r=>r.insert(n))}insertRaw(t){let n=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!n))return this.parents.forEach(r=>r.insertRaw(n))}subscribeToParents(){this._parentSubscriptions=new Map;let t=Ot(()=>{this.parents.length||dl("MappedThread has no parents",this),Kn(`[MappedThread: ${this.name}] subscribing to parents:`,this.parents.map(r=>r.name));let n=new Set([...this._parentSubscriptions.keys()]);for(let r of this.parents){n.delete(r)&&Kn(`[MappedThread: ${this.name}] Skipping re-sub to parent`,r.nameAndSizeUntracked),Kn(`[MappedThread: ${this.name}] sub to new parent`,r.nameAndSizeUntracked);let o=this.onParentUpdate.bind(this,r),s=r.subscribe(o);this._parentSubscriptions.set(r,s)}for(let r of n)Kn(`[MappedThread: ${this.name}] un-subscribing from old parent`,r.nameAndSizeUntracked),this._parentSubscriptions.get(r)(),this._parentSubscriptions.delete(r)})}subscribe(t){return this._parentSubscriptions||this.subscribeToParents(),super.subscribe(t)}triggerRemap(){if(!this._eventMapper)throw hl("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);pl(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&dl(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Pe(()=>nn(t.applogs))})})}onParentUpdate(t,n){Kn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,n);let r=this._eventMapper?this._eventMapper(n,t):n;if(this._eventMapper)if(Kn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,r),sn(r))this._applogs.replace([...r.init]);else{for(let i of r.added)this._applogs.splice(u0(this._applogs,i,"ts"),0,i);if(r.removed){for(let i of r.removed)if(!this._applogs.remove(i))if(!sn(n)&&n.removed?.includes(i))pl("Ignoring remove event for non-existent because it was part of parent event's removed",i,n);else throw hl(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:n,mapResult:r})}}Kn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Jr(this._applogs)),this.notifySubscribers(r)}get readOnly(){return!1}},{WARN:jS,LOG:FS,DEBUG:VS,VERBOSE:Ds,ERROR:yO}=Ne.setup(Ne.INFO),On=Xe("rollingFilter",function(t,n,r={}){let i=gO(n),o=yl(i),s=Ce.array(Pe(function(){return o(t.applogs)}),{deep:!1,name:`${t.name} | ${r.name||`rollingFilter.array{${Gn(i)}}`}`}),a=g=>{let C;return sn(g)?C={init:o(g.init)}:C={added:o(g.added),removed:g.removed},Ds(`rollingFilter{${t.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,i,g,"=>",C),C},l=new Ea(`${t.name} | ${r.name||`rollingFilter{${Gn(i)}}`}`,t,[...t.filters,...r.extraFilterName?[r.extraFilterName]:[]],s,a),c=qu(()=>nn(n),g=>{Ds(`rollingFilter<${t.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,i,"=>",g),i=g,o=yl(i),l.triggerRemap()}),d=jn(s,()=>{Ds(`rollingFilter<${Pe(()=>t.name)}>${r.name?` '${r.name}'`:""} unobserve`,i),c(),d()});return l},{equals:Rr,argsDebugName:(e,t,n)=>We({caller:"rollingFilter",thread:e,pattern:t,args:n})}),Xf=Xe("rollingMapper",function(t,n,r={}){let i=Pe(()=>n.call(null,{init:t.applogs},t));if(!sn(i))throw yO("Initial run must return init event");let o=i.init;return new Ea(`${t.name} | ${r.name||"rollingMapper"}`,t,[...t.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,n)},{equals:Rr,argsDebugName:(e,t,n)=>We({caller:"rollingMapper",thread:e,args:n})}),KS=Xe("rollingAcc",function(t,n,r,i={}){let o=ot(r);return o({init:t.applogs},n),t.subscribe(s=>{o(s,n)}),n},{argsDebugName:(e,t,n,r)=>`rollingAcc{${e.nameAndSizeUntracked}${r?.name?` | ${r?.name}`:""}}`}),gO=function(t){let n=Pe(function(){return Object.fromEntries(Object.entries(nn(t)).map(([i,o])=>[nn(i),nn(o)]))});if(!Object.entries(n).length)throw new Error("Pattern is empty");return n};function yl(e){return function(n){return n.filter(function(i){for(let o of Object.keys(e)){let s=e[o];if(s===void 0)continue;let a=i[o.startsWith("!")?o.slice(1):o];if(!sO(o,s,a))return!1}return!0})}}var{WARN:mO,LOG:vO,DEBUG:bO,VERBOSE:_O,ERROR:to}=Ne.setup(Ne.INFO),wO=class extends Ar{constructor(e,t=[],n){super(e,null,n,t),mn(this,{})}purge(e){let t=this.applogs.length;return this._applogs=this.applogs.filter(n=>!e.includes(n.cid)),t-this.applogs.length}insert(e){let t=cO(e,this);return this.insertRaw(t)}insertRaw(e){let t=qf(e);if(t.length!==e.length)throw to(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});let n=e.filter(o=>!kf(o));if(n.length)throw to(`[insertRaw] bogus applogs passed: ${n.length}`,{bogus:n});let r=e.filter(o=>this.hasApplog(o,!1));if(r.length)throw to(`[insertRaw] already existing applogs passed: ${r.length}`,{existing:r});if(!e.length){mO("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof Ia)?vO:bO)("Inserting:",e.length===1?e[0]:e,{ds:this}),fi(e);let i=this._applogs.length&&rO(e[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...e),i&&fi(this._applogs),this.notifySubscribers({added:e,removed:null}),this.persist(e),e}get readOnly(){return!1}},Ia=class no extends wO{constructor(t,n,r,i){super(t,n,r),this._readOnly=i,mn(this,{_applogs:Ce.shallow})}static empty(t){return no.fromArray([],t??"empty in-memory",!1)}static fromArray(t,n,r=!1){return new no(n??"in-memory",t,[],r)}static fromReadOnlyArray(t,n){return new no(n??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(_O("[InMem.persist] no persist for",t),this.readOnly)throw to("[persist] called for readOnly thread")}},{WARN:zS,LOG:qS,DEBUG:GS,VERBOSE:WS,ERROR:HS}=Ne.setup(Ne.INFO);var{WARN:CN,LOG:xN,DEBUG:UN,VERBOSE:MN,ERROR:BN}=Ne.setup(Ne.INFO);function Sa(e){return Wf(e,31,7)}var AO=class{constructor(e,t,n=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=n,mn(this,{threadOfTrail:De})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?Mo([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Yf=class{constructor(e){this.nodes=e,mn(this,{threadOfAllTrails:De,size:De,isEmpty:De})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Pe(()=>this.records.length)}get records(){return Jt(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return Mo(Jt(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return Jt(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return Jt(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return Mo(Jt(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:FN,LOG:Bo,DEBUG:an,VERBOSE:Te,ERROR:er}=Ne.setup(Ne.INFO,{prefix:"[q]"}),Na=null,OO=Xe("lastWriteWins",function(t,{inverseToOnlyReturnFirstLogs:n,tolerateAlreadyFiltered:r}={}){if(Te(`lastWriteWins${n?".inversed":""} < ${t.nameAndSizeUntracked} > initializing`),t.filters.includes("lastWriteWins")){if(r)return an("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),t;throw er("thread already filtered lastWriteWins:",t.filters,{name:t.name})}let i,o=Xf(t,function(a,l){let c=sn(a),d,g=[],C=c?null:[];c?(i=new Map,d=a.init):d=a.added;let I;for(let S=n?0:d.length-1;n?S<d.length:S>=0;n?S++:S--){let V=d[S],J=V.en+"|"+V.at;if(I&&(n?I>V.ts:I<V.ts))throw er("lastWriteWins.mapper logs not sorted:",I,n?">":"<",V.ts,{log:V,i:S,newLogs:d,inverseToOnlyReturnFirstLogs:n});I=V.ts;let F=i.get(J);(!F||(n?F.ts>V.ts:F.ts<V.ts))&&(F&&!c&&C.push(F),g.push(V),i.set(J,V))}return fi(g),Te.isDisabled||Te(`lastWriteWins${n?".inversed":""}<${t.nameAndSizeUntracked}> mapped event`,c?{...Object.fromEntries(Object.entries(a).map(([S,V])=>[S,V?.length])),toAdd:g.length,toRemove:C}:{...a,toAdd:g,toRemove:C}),c?{init:g}:{added:g,removed:C}},{name:`lastWriteWins${n?".inversed":""}`,extraFilterName:"lastWriteWins"});return Te.isDisabled||Ot(()=>{Te(`lastWriteWins<${t.nameAndSizeUntracked}> filtered down to`,o.applogs.length)}),o},{equals:Rr,argsDebugName:e=>We({caller:"lastWriteWins",thread:e})}),VN=Xe("withoutDeleted",function(t){if(Te.isEnabled&&Te(`withoutDeleted<${t.nameAndSizeUntracked}>`),t.filters.includes("withoutDeleted"))throw er("thread already filtered withoutDeleted:",t.filters,{name:t.name});let n=On(t,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Te.isEnabled&&Te(`withoutDeleted<${t.nameAndSizeUntracked}> deletionLogs:`,Pe(function(){return[...n.applogs]}));let r=We({caller:"allDeletedEntities",thread:t}),i=cf(function(){return n.map(s=>s.en)},{name:r});return Te.isEnabled&&Ot(()=>{Te(`withoutDeleted<${t.nameAndSizeUntracked}> deleted:`,[...i])}),On(t,{"!en":i},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:Rr}),Qf=Xe("query",function e(t,n,r={},i={}){CO();let o=Zf(t);an(`query<${o.nameAndSizeUntracked}>:`,n);let s=Array.isArray(n)?n:[n],a;if(s.length===1)a=null;else{let d=s.slice(0,-1);a=e(o,d,r,i)}let l=s[s.length-1],c=EO(o,a,l,i);return Te.isDisabled||Ot(()=>Te("query result:",nn(c))),c},{equals:No,argsDebugName:(e,t,n)=>We({caller:"query",thread:e,args:n?{pattern:t,startVars:n}:t})}),EO=Xe("queryStep",function(t,n,r,i={}){if(an(`queryStep<${t.nameAndSizeUntracked}> with`,n?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");function o(a){let[l,c]=Oa(r,a?.variables??{});Te("[queryStep.doQuery] patternWithoutVars: ",l);let d=On(t,l),g=Do(c),C=Jt(function(){let S=d.map(V=>({log:V,vars:g(V)}));return Te.isEnabled&&Te("[queryStep.doQuery] step node:",a?.variables," =>",S,"from:",Pe(()=>d.applogs)),S.map(({log:V,vars:J})=>{let F=Object.assign({},a?.variables,J);return new AO(ff.fromArray([V],We({caller:"QueryNode",thread:d,pattern:`${Gn(F)}@${Gn(l)}`})),F,a)})},{name:We({caller:"doQuery.mapNodes",thread:d,pattern:r})});return Te.isEnabled&&Ot(()=>Te("[queryStep.doQuery] resultNodes:",[...C])),i.debug&&Bo("[queryStep] step result:",Pe(()=>C.map(({variables:I,logsOfThisNode:S})=>({variables:I,thread:S})))),C}let s=Jt(function(){return an(`[queryStep] Running with ${n?.nodes?.length} input nodes:`),n?[...n.nodes.flatMap(o)]:[...o(null)]},{name:We({caller:"queryStep",thread:t,pattern:r})});return Te.isEnabled&&Ot(()=>Te("[queryStep] observableResultNodes:",[...s])),new Yf(s)},{equals:No,argsDebugName:(e,t,n)=>We({caller:"queryStep",thread:e,pattern:n})}),KN=Xe("queryNot",function(t,n,r,i={}){let o=n.nodes;an(`queryNot<${t.nameAndSizeUntracked}> from: ${o.length} nodes`);let s=Array.isArray(r)?r:[r];for(let a of s){if(!Object.entries(r).length)throw new Error("Pattern is empty");o=o.filter(function({variables:c}){let[d,g]=Oa(a,c??{});Te("[queryNot] patternWithoutVars: ",d);let C=On(t,d);return Te("[queryNot] step node:",c," =>",C.size,"applogs"),Te.isDisabled||Te("[queryNot] step node:",c," => empty?",Pe(()=>C.applogs)),i.debug&&Bo("[queryNot] node result:",c,"=>",C.applogs),C.isEmpty})}return new Yf(o)},{equals:No,argsDebugName:(e,t,n)=>We({caller:"queryNot",thread:e,pattern:n})}),zN=Xe("filterAndMap",function(t,n,r){an(`filterAndMap<${t.nameAndSizeUntracked}>`,n);let i=On(t,n);Te.isEnabled&&(Te("[filterAndMap] filtered:",i.untrackedSize),Ot(()=>Te("[filterAndMap] filtered:",i.applogs)));let o=We({thread:t,pattern:n,caller:"filterAndMap"}),s=Jt(()=>NO(i,r),{name:o});return Te.isDisabled||Ot(()=>Te("[filterAndMap] mapped:",s)),s},{equals:Ve.structural,argsDebugName:(e,t)=>We({caller:"filterAndMap",thread:e,pattern:t})}),qN=Xe("queryAndMap",function(t,n,r,i={}){let o=Zf(t);an(`queryAndMap<${o.nameAndSizeUntracked}>`,{patternOrPatterns:n,variables:i,map:r});let s=We({thread:o,caller:"queryAndMap"}),a=Qf(o,n);Te("[queryAndMap] filtered count:",a.untrackedSize);let l=Jt(()=>$O(a,r),{name:s});return Te.isDisabled||Ot(()=>Te("[queryAndMap] result:",nn(l))),l},{equals:Ve.structural,argsDebugName:(e,t)=>We({caller:"queryAndMap",thread:e,pattern:t})}),GN=Xe("queryEntity",function(t,n,r,i){an(`queryEntity<${t.nameAndSizeUntracked}>`,r,n);let o=On(t,{en:r,at:RO(n,i)});return Te("queryEntity applogs:",o.applogs),De(()=>o.isEmpty?null:Object.fromEntries(o.map(({at:s,vl:a})=>[s.slice(n.length+1),a])))},{equals:uf,argsDebugName:(e,t,n)=>We({caller:"queryEntity",thread:e,args:{name:t,entityID:n}})}),WN=Xe("agentsOfThread",function(t){an(`agentsOfThread<${t.nameAndSizeUntracked}>`);let n=Ce.map(),r=ot(o=>{for(let s of sn(o)?o.init:o.added){let a=n.get(s.ag)??0;n.set(s.ag,a+1)}for(let s of!sn(o)&&o.removed||[]){let a=n.get(s.ag);if(!a||a<1)throw er("[agentsOfThread] number is now negative",{log:s,event:o,mapped:n,prev:a});n.set(s.ag,a-1)}Bo(`agentsOfThread<${t.nameAndSizeUntracked}> processed event`,{event:o,mapped:n})});r({init:t.applogs});let i=t.subscribe(r);return mr(n,i),n}),IO=Xe("entityOverlap",function(t,n){return Bo(`entityOverlap<${t.nameAndSizeUntracked}, ${n.nameAndSizeUntracked}>`),De(()=>{let r=new Set(t.map(o=>o.en)),i=new Set(n.map(o=>o.en));return[...r].filter(o=>i.has(o))})});var HN=Xe("entityOverlapCount",function(t,n){return De(()=>IO(t,n).get().length)}),SO=Xe("querySingle",function(t,n,r={}){let i=Qf(t,n,r);return De(()=>{if(i.isEmpty)return null;if(i.size>1)throw er("[querySingle] got",i.size,"results:",i);let o=i.nodes[0].logsOfThisNode;if(o.size!=1)throw er("[querySingle] single result, but got",o.size,"logs:",o.applogs);return o.applogs[0]})},{equals:Ve.structural,argsDebugName:(e,t)=>We({caller:"querySingle",thread:e,pattern:t})}),JN=Xe("querySingleAndMap",function(t,n,r,i={}){let o=SO(t,n,i);return De(()=>{let s=o.get();if(s)return typeof r=="string"?s[r]:Do(r)(s)})},{equals:Ve.structural,argsDebugName:(e,t)=>We({caller:"querySingleAndMap",thread:e,pattern:t})}),NO=function(t,n){return typeof n=="function"?t.map(n):typeof n=="string"?t.map(r=>r[n]):t.map(Do(n))},$O=function(t,n){return typeof n=="function"?t.records.map(n):typeof n=="string"?t.nodes.map(r=>{if(!Object.hasOwn(r.record,n)){if(r.logsOfThisNode.size!==1)throw er(`not sure what to map (it's not a var and a result node log count of ${r.logsOfThisNode.size})`);return r.logsOfThisNode.firstLog[n]}return r.record[n]}):t.nodes.map(r=>Do(n)(t))};function Do(e){return t=>Object.entries(e).reduce((n,[r,i])=>(n[i]=t[r],n),{})}function RO(e,t){return t.map(n=>PO(e,n))}function PO(e,t){return`${e}/${t}`}function Zf(e,t){return Array.isArray(e)?Ia.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function CO(){if(Na!=null&&performance.now()>=Na)throw new xO(Na)}var xO=class extends Error{constructor(e){super(e)}};var UO=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(e,t){"use strict";t.exports=s;var n=128,r=127,i=~r,o=Math.pow(2,31);function s(a,l,c){if(Number.MAX_SAFE_INTEGER&&a>Number.MAX_SAFE_INTEGER)throw s.bytes=0,new RangeError("Could not encode varint");l=l||[],c=c||0;for(var d=c;a>=o;)l[c++]=a&255|n,a/=128;for(;a&i;)l[c++]=a&255|n,a>>>=7;return l[c]=a|0,s.bytes=c-d+1,l}}}),MO=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(e,t){"use strict";t.exports=i;var n=128,r=127;function i(o,l){var a=0,l=l||0,c=0,d=l,g,C=o.length;do{if(d>=C||c>49)throw i.bytes=0,new RangeError("Could not decode varint");g=o[d++],a+=c<28?(g&r)<<c:(g&r)*Math.pow(2,c),c+=7}while(g>=n);return i.bytes=d-l,a}}}),BO=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(e,t){"use strict";var n=Math.pow(2,7),r=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),l=Math.pow(2,49),c=Math.pow(2,56),d=Math.pow(2,63);t.exports=function(g){return g<n?1:g<r?2:g<i?3:g<o?4:g<s?5:g<a?6:g<l?7:g<c?8:g<d?9:10}}}),Ua=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:UO(),decode:MO(),encodingLength:BO()}}}),DO=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function LO(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(t==="string"||t==="number"||t==="bigint"||t==="symbol")return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(e instanceof Uint8Array)return"Uint8Array";if(e.constructor===Object)return"Object";let n=kO(e);return n||"Object"}function kO(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(DO.includes(t))return t}var K=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};K.uint=new K(0,"uint",!0);K.negint=new K(1,"negint",!0);K.bytes=new K(2,"bytes",!0);K.string=new K(3,"string",!0);K.array=new K(4,"array",!1);K.map=new K(5,"map",!1);K.tag=new K(6,"tag",!1);K.float=new K(7,"float",!0);K.false=new K(7,"false",!0);K.true=new K(7,"true",!0);K.null=new K(7,"null",!0);K.undefined=new K(7,"undefined",!0);K.break=new K(7,"break",!0);var pe=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},bi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",jO=new TextEncoder;function jo(e){return bi&&globalThis.Buffer.isBuffer(e)}function ld(e){return e instanceof Uint8Array?jo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var FO=24,VO=200,KO=bi?e=>e.length>=FO?globalThis.Buffer.from(e):ed(e):e=>e.length>=VO?jO.encode(e):ed(e),un=e=>Uint8Array.from(e),zO=bi?(e,t,n)=>jo(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n),qO=bi?(e,t)=>(e=e.map(n=>n instanceof Uint8Array?n:globalThis.Buffer.from(n)),ld(globalThis.Buffer.concat(e,t))):(e,t)=>{let n=new Uint8Array(t),r=0;for(let i of e)r+i.length>n.length&&(i=i.subarray(0,n.length-r)),n.set(i,r),r+=i.length;return n},GO=bi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function fd(e,t){if(jo(e)&&jo(t))return e.compare(t);for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return 0}function ed(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)===55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}var WO=256,dd=class{constructor(e=WO){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=GO(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=zO(n,0,this.cursor)}else t=qO(this.chunks,this.cursor);return e&&this.reset(),t}},HO=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},Be="CBOR decode error:",pd="CBOR encode error:",_i=[];_i[23]=1;_i[24]=2;_i[25]=3;_i[26]=5;_i[27]=9;function Mr(e,t,n){if(e.length-t<n)throw new Error(`${Be} not enough data for type`)}var Ye=[24,256,65536,4294967296,BigInt("18446744073709551616")];function tr(e,t,n){Mr(e,t,1);let r=e[t];if(n.strict===!0&&r<Ye[0])throw new Error(`${Be} integer encoded in more bytes than necessary (strict decode)`);return r}function nr(e,t,n){Mr(e,t,2);let r=e[t]<<8|e[t+1];if(n.strict===!0&&r<Ye[1])throw new Error(`${Be} integer encoded in more bytes than necessary (strict decode)`);return r}function rr(e,t,n){Mr(e,t,4);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(n.strict===!0&&r<Ye[2])throw new Error(`${Be} integer encoded in more bytes than necessary (strict decode)`);return r}function ir(e,t,n){Mr(e,t,8);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(r)<<BigInt(32))+BigInt(i);if(n.strict===!0&&o<Ye[3])throw new Error(`${Be} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(n.allowBigInt===!0)return o;throw new Error(`${Be} integers outside of the safe integer range are not supported`)}function JO(e,t,n,r){return new pe(K.uint,tr(e,t+1,r),2)}function XO(e,t,n,r){return new pe(K.uint,nr(e,t+1,r),3)}function YO(e,t,n,r){return new pe(K.uint,rr(e,t+1,r),5)}function QO(e,t,n,r){return new pe(K.uint,ir(e,t+1,r),9)}function or(e,t){return Rt(e,0,t.value)}function Rt(e,t,n){if(n<Ye[0]){let r=Number(n);e.push([t|r])}else if(n<Ye[1]){let r=Number(n);e.push([t|24,r])}else if(n<Ye[2]){let r=Number(n);e.push([t|25,r>>>8,r&255])}else if(n<Ye[3]){let r=Number(n);e.push([t|26,r>>>24&255,r>>>16&255,r>>>8&255,r&255])}else{let r=BigInt(n);if(r<Ye[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(r&BigInt(4294967295)),s=Number(r>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,e.push(i)}else throw new Error(`${Be} encountered BigInt larger than allowable range`)}}or.encodedSize=function(t){return Rt.encodedSize(t.value)};Rt.encodedSize=function(t){return t<Ye[0]?1:t<Ye[1]?2:t<Ye[2]?3:t<Ye[3]?5:9};or.compareTokens=function(t,n){return t.value<n.value?-1:t.value>n.value?1:0};function ZO(e,t,n,r){return new pe(K.negint,-1-tr(e,t+1,r),2)}function eE(e,t,n,r){return new pe(K.negint,-1-nr(e,t+1,r),3)}function tE(e,t,n,r){return new pe(K.negint,-1-rr(e,t+1,r),5)}var Ma=BigInt(-1),hd=BigInt(1);function nE(e,t,n,r){let i=ir(e,t+1,r);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new pe(K.negint,o,9)}if(r.allowBigInt!==!0)throw new Error(`${Be} integers outside of the safe integer range are not supported`);return new pe(K.negint,Ma-BigInt(i),9)}function Ba(e,t){let n=t.value,r=typeof n=="bigint"?n*Ma-hd:n*-1-1;Rt(e,t.type.majorEncoded,r)}Ba.encodedSize=function(t){let n=t.value,r=typeof n=="bigint"?n*Ma-hd:n*-1-1;return r<Ye[0]?1:r<Ye[1]?2:r<Ye[2]?3:r<Ye[3]?5:9};Ba.compareTokens=function(t,n){return t.value<n.value?1:t.value>n.value?-1:0};function wi(e,t,n,r){Mr(e,t,n+r);let i=e.slice(t+n,t+n+r);return new pe(K.bytes,i,n+r)}function rE(e,t,n,r){return wi(e,t,1,n)}function iE(e,t,n,r){return wi(e,t,2,tr(e,t+1,r))}function oE(e,t,n,r){return wi(e,t,3,nr(e,t+1,r))}function sE(e,t,n,r){return wi(e,t,5,rr(e,t+1,r))}function aE(e,t,n,r){let i=ir(e,t+1,r);if(typeof i=="bigint")throw new Error(`${Be} 64-bit integer bytes lengths not supported`);return wi(e,t,9,i)}function Fo(e){return e.encodedBytes===void 0&&(e.encodedBytes=K.equals(e.type,K.string)?KO(e.value):e.value),e.encodedBytes}function qo(e,t){let n=Fo(t);Rt(e,t.type.majorEncoded,n.length),e.push(n)}qo.encodedSize=function(t){let n=Fo(t);return Rt.encodedSize(n.length)+n.length};qo.compareTokens=function(t,n){return uE(Fo(t),Fo(n))};function uE(e,t){return e.length<t.length?-1:e.length>t.length?1:fd(e,t)}var td=new TextDecoder,cE=32;function lE(e,t,n){if(n-t<cE){let i="";for(let o=t;o<n;o++){let s=e[o];if(s&128)return td.decode(e.subarray(t,n));i+=String.fromCharCode(s)}return i}return td.decode(e.subarray(t,n))}function Ti(e,t,n,r,i){let o=n+r;Mr(e,t,o);let s=new pe(K.string,lE(e,t+n,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=e.slice(t+n,t+o)),s}function fE(e,t,n,r){return Ti(e,t,1,n,r)}function dE(e,t,n,r){return Ti(e,t,2,tr(e,t+1,r),r)}function pE(e,t,n,r){return Ti(e,t,3,nr(e,t+1,r),r)}function hE(e,t,n,r){return Ti(e,t,5,rr(e,t+1,r),r)}function yE(e,t,n,r){let i=ir(e,t+1,r);if(typeof i=="bigint")throw new Error(`${Be} 64-bit integer string lengths not supported`);return Ti(e,t,9,i,r)}var gE=qo;function Br(e,t,n,r){return new pe(K.array,r,n)}function mE(e,t,n,r){return Br(e,t,1,n)}function vE(e,t,n,r){return Br(e,t,2,tr(e,t+1,r))}function bE(e,t,n,r){return Br(e,t,3,nr(e,t+1,r))}function _E(e,t,n,r){return Br(e,t,5,rr(e,t+1,r))}function wE(e,t,n,r){let i=ir(e,t+1,r);if(typeof i=="bigint")throw new Error(`${Be} 64-bit integer array lengths not supported`);return Br(e,t,9,i)}function TE(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${Be} indefinite length items not allowed`);return Br(e,t,1,1/0)}function Da(e,t){Rt(e,K.array.majorEncoded,t.value)}Da.compareTokens=or.compareTokens;Da.encodedSize=function(t){return Rt.encodedSize(t.value)};function Dr(e,t,n,r){return new pe(K.map,r,n)}function AE(e,t,n,r){return Dr(e,t,1,n)}function OE(e,t,n,r){return Dr(e,t,2,tr(e,t+1,r))}function EE(e,t,n,r){return Dr(e,t,3,nr(e,t+1,r))}function IE(e,t,n,r){return Dr(e,t,5,rr(e,t+1,r))}function SE(e,t,n,r){let i=ir(e,t+1,r);if(typeof i=="bigint")throw new Error(`${Be} 64-bit integer map lengths not supported`);return Dr(e,t,9,i)}function NE(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${Be} indefinite length items not allowed`);return Dr(e,t,1,1/0)}function La(e,t){Rt(e,K.map.majorEncoded,t.value)}La.compareTokens=or.compareTokens;La.encodedSize=function(t){return Rt.encodedSize(t.value)};function $E(e,t,n,r){return new pe(K.tag,n,1)}function RE(e,t,n,r){return new pe(K.tag,tr(e,t+1,r),2)}function PE(e,t,n,r){return new pe(K.tag,nr(e,t+1,r),3)}function CE(e,t,n,r){return new pe(K.tag,rr(e,t+1,r),5)}function xE(e,t,n,r){return new pe(K.tag,ir(e,t+1,r),9)}function ka(e,t){Rt(e,K.tag.majorEncoded,t.value)}ka.compareTokens=or.compareTokens;ka.encodedSize=function(t){return Rt.encodedSize(t.value)};var yd=20,gd=21,md=22,vd=23;function UE(e,t,n,r){if(r.allowUndefined===!1)throw new Error(`${Be} undefined values are not supported`);return r.coerceUndefinedToNull===!0?new pe(K.null,null,1):new pe(K.undefined,void 0,1)}function ME(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${Be} indefinite length items not allowed`);return new pe(K.break,void 0,1)}function ja(e,t,n){if(n){if(n.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Be} NaN values are not supported`);if(n.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Be} Infinity values are not supported`)}return new pe(K.float,e,t)}function BE(e,t,n,r){return ja(Va(e,t+1),3,r)}function DE(e,t,n,r){return ja(Ka(e,t+1),5,r)}function LE(e,t,n,r){return ja(Td(e,t+1),9,r)}function Fa(e,t,n){let r=t.value;if(r===!1)e.push([K.float.majorEncoded|yd]);else if(r===!0)e.push([K.float.majorEncoded|gd]);else if(r===null)e.push([K.float.majorEncoded|md]);else if(r===void 0)e.push([K.float.majorEncoded|vd]);else{let i,o=!1;(!n||n.float64!==!0)&&(_d(r),i=Va(Vt,1),r===i||Number.isNaN(r)?(Vt[0]=249,e.push(Vt.slice(0,3)),o=!0):(wd(r),i=Ka(Vt,1),r===i&&(Vt[0]=250,e.push(Vt.slice(0,5)),o=!0))),o||(kE(r),i=Td(Vt,1),Vt[0]=251,e.push(Vt.slice(0,9)))}}Fa.encodedSize=function(t,n){let r=t.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!n||n.float64!==!0){_d(r);let i=Va(Vt,1);if(r===i||Number.isNaN(r))return 3;if(wd(r),i=Ka(Vt,1),r===i)return 5}return 9};var bd=new ArrayBuffer(9),$t=new DataView(bd,1),Vt=new Uint8Array(bd,0);function _d(e){if(e===1/0)$t.setUint16(0,31744,!1);else if(e===-1/0)$t.setUint16(0,64512,!1);else if(Number.isNaN(e))$t.setUint16(0,32256,!1);else{$t.setFloat32(0,e);let t=$t.getUint32(0),n=(t&2139095040)>>23,r=t&8388607;if(n===255)$t.setUint16(0,31744,!1);else if(n===0)$t.setUint16(0,(e&2147483648)>>16|r>>13,!1);else{let i=n-127;i<-24?$t.setUint16(0,0):i<-14?$t.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):$t.setUint16(0,(t&2147483648)>>16|i+15<<10|r>>13,!1)}}}function Va(e,t){if(e.length-t<2)throw new Error(`${Be} not enough data for float16`);let n=(e[t]<<8)+e[t+1];if(n===31744)return 1/0;if(n===64512)return-1/0;if(n===32256)return NaN;let r=n>>10&31,i=n&1023,o;return r===0?o=i*2**-24:r!==31?o=(i+1024)*2**(r-25):o=i===0?1/0:NaN,n&32768?-o:o}function wd(e){$t.setFloat32(0,e,!1)}function Ka(e,t){if(e.length-t<4)throw new Error(`${Be} not enough data for float32`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,4).getFloat32(0,!1)}function kE(e){$t.setFloat64(0,e,!1)}function Td(e,t){if(e.length-t<8)throw new Error(`${Be} not enough data for float64`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,8).getFloat64(0,!1)}Fa.compareTokens=or.compareTokens;function Ie(e,t,n){throw new Error(`${Be} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function Go(e){return()=>{throw new Error(`${Be} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=Ie;ue[24]=JO;ue[25]=XO;ue[26]=YO;ue[27]=QO;ue[28]=Ie;ue[29]=Ie;ue[30]=Ie;ue[31]=Ie;for(let e=32;e<=55;e++)ue[e]=Ie;ue[56]=ZO;ue[57]=eE;ue[58]=tE;ue[59]=nE;ue[60]=Ie;ue[61]=Ie;ue[62]=Ie;ue[63]=Ie;for(let e=64;e<=87;e++)ue[e]=rE;ue[88]=iE;ue[89]=oE;ue[90]=sE;ue[91]=aE;ue[92]=Ie;ue[93]=Ie;ue[94]=Ie;ue[95]=Go("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ue[e]=fE;ue[120]=dE;ue[121]=pE;ue[122]=hE;ue[123]=yE;ue[124]=Ie;ue[125]=Ie;ue[126]=Ie;ue[127]=Go("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ue[e]=mE;ue[152]=vE;ue[153]=bE;ue[154]=_E;ue[155]=wE;ue[156]=Ie;ue[157]=Ie;ue[158]=Ie;ue[159]=TE;for(let e=160;e<=183;e++)ue[e]=AE;ue[184]=OE;ue[185]=EE;ue[186]=IE;ue[187]=SE;ue[188]=Ie;ue[189]=Ie;ue[190]=Ie;ue[191]=NE;for(let e=192;e<=215;e++)ue[e]=$E;ue[216]=RE;ue[217]=PE;ue[218]=CE;ue[219]=xE;ue[220]=Ie;ue[221]=Ie;ue[222]=Ie;ue[223]=Ie;for(let e=224;e<=243;e++)ue[e]=Go("simple values are not supported");ue[244]=Ie;ue[245]=Ie;ue[246]=Ie;ue[247]=UE;ue[248]=Go("simple values are not supported");ue[249]=BE;ue[250]=DE;ue[251]=LE;ue[252]=Ie;ue[253]=Ie;ue[254]=Ie;ue[255]=ME;var cn=[];for(let e=0;e<24;e++)cn[e]=new pe(K.uint,e,1);for(let e=-1;e>=-24;e--)cn[31-e]=new pe(K.negint,e,1);cn[64]=new pe(K.bytes,new Uint8Array(0),1);cn[96]=new pe(K.string,"",1);cn[128]=new pe(K.array,0,1);cn[160]=new pe(K.map,0,1);cn[244]=new pe(K.false,!1,1);cn[245]=new pe(K.true,!0,1);cn[246]=new pe(K.null,null,1);function jE(e){switch(e.type){case K.false:return un([244]);case K.true:return un([245]);case K.null:return un([246]);case K.bytes:return e.value.length?void 0:un([64]);case K.string:return e.value===""?un([96]):void 0;case K.array:return e.value===0?un([128]):void 0;case K.map:return e.value===0?un([160]):void 0;case K.uint:return e.value<24?un([Number(e.value)]):void 0;case K.negint:if(e.value>=-24)return un([31-Number(e.value)])}}var FE=Object.freeze({float64:!0,mapSorter:qE,quickEncodeToken:jE});function Ad(){let e=[];return e[K.uint.major]=or,e[K.negint.major]=Ba,e[K.bytes.major]=qo,e[K.string.major]=gE,e[K.array.major]=Da,e[K.map.major]=La,e[K.tag.major]=ka,e[K.float.major]=Fa,e}var VE=Ad(),KE=new dd,nd=class Od{constructor(t,n){this.obj=t,this.parent=n}includes(t){let n=this;do if(n.obj===t)return!0;while(n=n.parent);return!1}static createCheck(t,n){if(t&&t.includes(n))throw new Error(`${pd} object contains circular references`);return new Od(n,t)}},En={null:new pe(K.null,null),undefined:new pe(K.undefined,void 0),true:new pe(K.true,!0),false:new pe(K.false,!1),emptyArray:new pe(K.array,0),emptyMap:new pe(K.map,0)},Nn={number(e,t,n,r){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new pe(K.float,e):e>=0?new pe(K.uint,e):new pe(K.negint,e)},bigint(e,t,n,r){return e>=BigInt(0)?new pe(K.uint,e):new pe(K.negint,e)},Uint8Array(e,t,n,r){return new pe(K.bytes,e)},string(e,t,n,r){return new pe(K.string,e)},boolean(e,t,n,r){return e?En.true:En.false},null(e,t,n,r){return En.null},undefined(e,t,n,r){return En.undefined},ArrayBuffer(e,t,n,r){return new pe(K.bytes,new Uint8Array(e))},DataView(e,t,n,r){return new pe(K.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,n,r){if(!e.length)return n.addBreakTokens===!0?[En.emptyArray,new pe(K.break)]:En.emptyArray;r=nd.createCheck(r,e);let i=[],o=0;for(let s of e)i[o++]=Lo(s,n,r);return n.addBreakTokens?[new pe(K.array,e.length),i,new pe(K.break)]:[new pe(K.array,e.length),i]},Object(e,t,n,r){let i=t!=="Object",o=i?e.keys():Object.keys(e),s=i?e.size:o.length,a;if(s){a=new Array(s),r=nd.createCheck(r,e);let l=!i&&n.ignoreUndefinedProperties,c=0;for(let d of o){let g=i?e.get(d):e[d];l&&g===void 0||(a[c++]=[Lo(d,n,r),Lo(g,n,r)])}c<s&&(a.length=c)}return a?.length?(zE(a,n),n.addBreakTokens?[new pe(K.map,a.length),a,new pe(K.break)]:[new pe(K.map,a.length),a]):n.addBreakTokens===!0?[En.emptyMap,new pe(K.break)]:En.emptyMap}};Nn.Map=Nn.Object;Nn.Buffer=Nn.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Nn[`${e}Array`]=Nn.DataView;function Lo(e,t={},n){let r=LO(e),i=t&&t.typeEncoders&&t.typeEncoders[r]||Nn[r];if(typeof i=="function"){let s=i(e,r,t,n);if(s!=null)return s}let o=Nn[r];if(!o)throw new Error(`${pd} unsupported type: ${r}`);return o(e,r,t,n)}function zE(e,t){t.mapSorter&&e.sort(t.mapSorter)}function qE(e,t){if(e[0]instanceof pe&&t[0]instanceof pe){let n=e[0],r=t[0];return n._keyBytes||(n._keyBytes=rd(n.value)),r._keyBytes||(r._keyBytes=rd(r.value)),fd(n._keyBytes,r._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function rd(e){return GE(e,VE,FE)}function Ed(e,t,n,r){if(Array.isArray(t))for(let i of t)Ed(e,i,n,r);else n[t.type.major](e,t,r)}var u$=K.uint.majorEncoded,c$=K.negint.majorEncoded,l$=K.bytes.majorEncoded,f$=K.string.majorEncoded,d$=K.array.majorEncoded,p$=K.float.majorEncoded|yd,h$=K.float.majorEncoded|gd,y$=K.float.majorEncoded|md,g$=K.float.majorEncoded|vd,m$=BigInt(-1),v$=BigInt(1);function GE(e,t,n,r){let i=r instanceof Uint8Array,o=i?new HO(r):KE,s=Lo(e,n);if(!Array.isArray(s)&&n.quickEncodeToken){let a=n.quickEncodeToken(s);if(a)return i?(o.push(a),o.toBytes()):a;let l=t[s.type.major];if(l.encodedSize){let c=l.encodedSize(s,n);if(i||(o=new dd(c)),l(o,s,n),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${s} was wrong`);return i?o.toBytes():ld(o.chunks[0])}}return o.reset(),Ed(o,s,t,n),o.toBytes(!0)}var b$=Symbol.for("DONE"),_$=Symbol.for("BREAK");var w$=new Uint8Array(0);function WE(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0}function za(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function HE(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(n[s]!==255)throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function g(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var V=0,J=0,F=0,k=S.length;F!==k&&S[F]===0;)F++,V++;for(var z=(k-F)*d+1>>>0,W=new Uint8Array(z);F!==k;){for(var j=S[F],Z=0,G=z-1;(j!==0||Z<J)&&G!==-1;G--,Z++)j+=256*W[G]>>>0,W[G]=j%a>>>0,j=j/a>>>0;if(j!==0)throw new Error("Non-zero carry");J=Z,F++}for(var fe=z-J;fe!==z&&W[fe]===0;)fe++;for(var x=l.repeat(V);fe<z;++fe)x+=e.charAt(W[fe]);return x}function C(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var V=0;if(S[V]!==" "){for(var J=0,F=0;S[V]===l;)J++,V++;for(var k=(S.length-V)*c+1>>>0,z=new Uint8Array(k);S[V];){var W=n[S.charCodeAt(V)];if(W===255)return;for(var j=0,Z=k-1;(W!==0||j<F)&&Z!==-1;Z--,j++)W+=a*z[Z]>>>0,z[Z]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");F=j,V++}if(S[V]!==" "){for(var G=k-F;G!==k&&z[G]===0;)G++;for(var fe=new Uint8Array(J+(k-G)),x=J;G!==k;)fe[x++]=z[G++];return fe}}}function I(S){var V=C(S);if(V)return V;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:C,decode:I}}var JE=HE,XE=JE,YE=XE,QE=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},ZE=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let r=t.codePointAt(0);if(r===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Id(this,e)}},eI=class{decoders;constructor(e){this.decoders=e}or(e){return Id(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Id(e,t){return new eI({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var tI=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new QE(e,t,n),this.decoder=new ZE(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Sd({name:e,prefix:t,encode:n,decode:r}){return new tI(e,t,n,r)}function Wo({name:e,prefix:t,alphabet:n}){let{encode:r,decode:i}=YE(n,e);return Sd({prefix:t,name:e,encode:r,decode:o=>za(i(o))})}function nI(e,t,n,r){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*n/8|0),s=0,a=0,l=0;for(let c=0;c<i;++c){let d=t[e[c]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);a=a<<n|d,s+=n,s>=8&&(s-=8,o[l++]=255&a>>s)}if(s>=n||255&a<<8-s)throw new SyntaxError("Unexpected end of data");return o}function rI(e,t,n){let r=t[t.length-1]==="=",i=(1<<n)-1,o="",s=0,a=0;for(let l=0;l<e.length;++l)for(a=a<<8|e[l],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s!==0&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o}function iI(e){let t={};for(let n=0;n<e.length;++n)t[e[n]]=n;return t}function ln({name:e,prefix:t,bitsPerChar:n,alphabet:r}){let i=iI(r);return Sd({prefix:t,name:e,encode(o){return rI(o,r,n)},decode(o){return nI(o,i,n,e)}})}var ko=ln({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),T$=ln({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),A$=ln({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),O$=ln({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),E$=ln({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),I$=ln({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),S$=ln({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),N$=ln({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),$$=ln({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),$a=Wo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),R$=Wo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),In=Wo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),P$=Wo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),oI=Nd,id=128,sI=127,aI=~sI,uI=Math.pow(2,31);function Nd(e,t,n){t=t||[],n=n||0;for(var r=n;e>=uI;)t[n++]=e&255|id,e/=128;for(;e&aI;)t[n++]=e&255|id,e>>>=7;return t[n]=e|0,Nd.bytes=n-r+1,t}var cI=Ra,lI=128,od=127;function Ra(e,r){var n=0,r=r||0,i=0,o=r,s,a=e.length;do{if(o>=a)throw Ra.bytes=0,new RangeError("Could not decode varint");s=e[o++],n+=i<28?(s&od)<<i:(s&od)*Math.pow(2,i),i+=7}while(s>=lI);return Ra.bytes=o-r,n}var fI=Math.pow(2,7),dI=Math.pow(2,14),pI=Math.pow(2,21),hI=Math.pow(2,28),yI=Math.pow(2,35),gI=Math.pow(2,42),mI=Math.pow(2,49),vI=Math.pow(2,56),bI=Math.pow(2,63),_I=function(e){return e<fI?1:e<dI?2:e<pI?3:e<hI?4:e<yI?5:e<gI?6:e<mI?7:e<vI?8:e<bI?9:10},wI={encode:oI,decode:cI,encodingLength:_I},TI=wI,Vo=TI;function Pa(e,t=0){return[Vo.decode(e,t),Vo.decode.bytes]}function Ko(e,t,n=0){return Vo.encode(e,t,n),t}function zo(e){return Vo.encodingLength(e)}function AI(e,t){let n=t.byteLength,r=zo(e),i=r+zo(n),o=new Uint8Array(i+n);return Ko(e,o,0),Ko(n,o,r),o.set(t,i),new qa(e,n,t,o)}function OI(e){let t=za(e),[n,r]=Pa(t),[i,o]=Pa(t.subarray(r)),s=t.subarray(r+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new qa(n,i,s,t)}function EI(e,t){if(e===t)return!0;{let n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&WE(e.bytes,n.bytes)}}var qa=class{code;size;digest;bytes;constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}};function sd(e,t){let{bytes:n,version:r}=e;switch(r){case 0:return SI(n,Ca(e),t??In.encoder);default:return NI(n,Ca(e),t??ko.encoder)}}var ad=new WeakMap;function Ca(e){let t=ad.get(e);if(t==null){let n=new Map;return ad.set(e,n),n}return t}var $d=class et{code;version;multihash;bytes;"/";constructor(t,n,r,i){this.code=n,this.version=t,this.multihash=r,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:n}=this;if(t!==gi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(n.code!==$I)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return et.createV0(n)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:n}=this.multihash,r=AI(t,n);return et.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return et.equals(this,t)}static equals(t,n){let r=n;return r!=null&&t.code===r.code&&t.version===r.version&&EI(t.multihash,r.multihash)}toString(t){return sd(this,t)}toJSON(){return{"/":sd(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let n=t;if(n instanceof et)return n;if(n["/"]!=null&&n["/"]===n.bytes||n.asCID===n){let{version:r,code:i,multihash:o,bytes:s}=n;return new et(r,i,o,s??ud(r,i,o.bytes))}else if(n[RI]===!0){let{version:r,multihash:i,code:o}=n,s=OI(i);return et.create(r,o,s)}else return null}static create(t,n,r){if(typeof n!="number")throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(n!==gi)throw new Error(`Version 0 CID must use dag-pb (code: ${gi}) block encoding`);return new et(t,n,r,r.bytes)}case 1:{let i=ud(t,n,r.bytes);return new et(t,n,r,i)}default:throw new Error("Invalid version")}}static createV0(t){return et.create(0,gi,t)}static createV1(t,n){return et.create(1,t,n)}static decode(t){let[n,r]=et.decodeFirst(t);if(r.length!==0)throw new Error("Incorrect length");return n}static decodeFirst(t){let n=et.inspectBytes(t),r=n.size-n.multihashSize,i=za(t.subarray(r,r+n.multihashSize));if(i.byteLength!==n.multihashSize)throw new Error("Incorrect length");let o=i.subarray(n.multihashSize-n.digestSize),s=new qa(n.multihashCode,n.digestSize,o,i);return[n.version===0?et.createV0(s):et.createV1(n.codec,s),t.subarray(n.size)]}static inspectBytes(t){let n=0,r=()=>{let[g,C]=Pa(t.subarray(n));return n+=C,g},i=r(),o=gi;if(i===18?(i=0,n=0):o=r(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=n,a=r(),l=r(),c=n+l,d=c-s;return{version:i,codec:o,multihashCode:a,digestSize:l,multihashSize:d,size:c}}static parse(t,n){let[r,i]=II(t,n),o=et.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ca(o).set(r,t),o}};function II(e,t){switch(e[0]){case"Q":{let n=t??In;return[In.prefix,n.decode(`${In.prefix}${e}`)]}case In.prefix:{let n=t??In;return[In.prefix,n.decode(e)]}case ko.prefix:{let n=t??ko;return[ko.prefix,n.decode(e)]}case $a.prefix:{let n=t??$a;return[$a.prefix,n.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function SI(e,t,n){let{prefix:r}=n;if(r!==In.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);let i=t.get(r);if(i==null){let o=n.encode(e).slice(1);return t.set(r,o),o}else return i}function NI(e,t,n){let{prefix:r}=n,i=t.get(r);if(i==null){let o=n.encode(e);return t.set(r,o),o}else return i}var gi=112,$I=18;function ud(e,t,n){let r=zo(e),i=r+zo(t),o=new Uint8Array(i+n.byteLength);return Ko(e,o,0),Ko(t,o,r),o.set(n,i),o}var RI=Symbol.for("@ipld/js-cid/CID"),Rd=42;function PI(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=$d.asCID(e);if(!t)return null;let n=new Uint8Array(t.bytes.byteLength+1);return n.set(t.bytes,1),[new pe(K.tag,Rd),new pe(K.bytes,n)]}function CI(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function xI(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}function UI(e){for(let t of e.keys())if(typeof t!="string"||t.length===0)throw new Error("Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded");return null}var cd={float64:!0,typeEncoders:{Map:UI,Object:PI,undefined:CI,number:xI}},C$={...cd,typeEncoders:{...cd.typeEncoders}};function MI(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return $d.decode(e.subarray(1))}var xa={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};xa.tags[Rd]=MI;var x$={...xa,tags:xa.tags.slice()};var U$=Et(Ua(),1);var Sn={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},mi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Sn.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Sn.List(e)!==void 0){for(let t=0;t<e.length;t++){let n=e[t];if(n=mi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](n),n===void 0)return;if(n!==e[t]){let r=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=mi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;r.push(o)}return r}}return e}},Int:Sn.Int,CarV1HeaderOrV2Pragma:e=>{if(Sn.Map(e)===void 0)return;let t=Object.entries(e),n=e,r=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=mi["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(a===void 0)return;if(a!==s||n!==e){if(n===e){n={};for(let l=0;l<i;l++)n[t[l][0]]=t[l][1]}n.roots=a}}break;case"version":{r--;let a=mi.Int(e[o]);if(a===void 0)return;if(a!==s||n!==e){if(n===e){n={};for(let l=0;l<i;l++)n[t[l][0]]=t[l][1]}n.version=a}}break;default:return}}if(!(r>0))return n}},vi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Sn.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Sn.List(e)!==void 0){for(let t=0;t<e.length;t++){let n=e[t];if(n=vi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](n),n===void 0)return;if(n!==e[t]){let r=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=vi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;r.push(o)}return r}}return e}},Int:Sn.Int,CarV1HeaderOrV2Pragma:e=>{if(Sn.Map(e)===void 0)return;let t=Object.entries(e),n=e,r=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=vi["CarV1HeaderOrV2Pragma > roots (anon)"](s);if(a===void 0)return;if(a!==s||n!==e){if(n===e){n={};for(let l=0;l<i;l++)n[t[l][0]]=t[l][1]}n.roots=a}}break;case"version":{r--;let a=vi.Int(s);if(a===void 0)return;if(a!==s||n!==e){if(n===e){n={};for(let l=0;l<i;l++)n[t[l][0]]=t[l][1]}n.version=a}}break;default:return}}if(!(r>0))return n}},M$={toTyped:mi.CarV1HeaderOrV2Pragma,toRepresentation:vi.CarV1HeaderOrV2Pragma},B$=Ad(),D$=Et(Ua(),1),L$=[new pe(K.map,2),new pe(K.string,"version"),new pe(K.uint,1),new pe(K.string,"roots")],k$=new pe(K.tag,42);var j$=Et(Ua(),1);var{WARN:F$,LOG:V$,DEBUG:K$,VERBOSE:z$,ERROR:q$}=Ne.setup(Ne.INFO);var{WARN:G$,LOG:W$,DEBUG:H$,VERBOSE:J$,ERROR:X$}=Ne.setup(Ne.INFO);var Ga=class{app;username;devicename;signer},Pd=class extends Ga{constructor(t){super(),Object.assign(this,t)}get did(){return this.signer.did}async sign(t){return await this.signer.sign(t)}get ag(){return Sa(this.agentString)}get shortDID(){return this.did?.slice(-8)}get agentString(){return`${this.username}.${this.shortDID}@${this.app}.${this.devicename}`}};export{Pd as BaseAgent};
|
|
61
|
+
`+" ".repeat(t)+o):o==="{"&&r>0?(r++,n+=o):(o==="}"&&r>1&&r--,n+=o)}return n}function m0(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]instanceof Er){if(t[n]!==e[n])return!1}else if(!ze.structural(e[n],t[n]))return!1;return!0}var{WARN:Jc,LOG:dS,DEBUG:v0,VERBOSE:pS,ERROR:Kn}=$e.setup($e.INFO,{prefix:"[thread]"});function un(e){return e.init!==void 0}var Er=class{constructor(e,t,n,r=[],i={}){this.name=e,this._applogs=r,this.parents=t===null?null:ac(t),this.filters=n,Pe(()=>this.parents?.length===0)&&Jc("[Thread] empty parents array",e),i.skipObservable||bn(this,{applogsCids:De,applogsByCid:De,insert:at,size:De,isEmpty:De,firstLog:De,latestLog:De},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw Kn("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Kn("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Kn("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw Kn("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Kn("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Kn("[Thread] insertRaw() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insertRaw(e)}subscribe(e){return this._subscribers.push(e),this.unsubscribe.bind(this,e)}unsubscribe(e){let t=this._subscribers.indexOf(e);t!==-1?this._subscribers.splice(t,1):Jc("unsubscribe called for non-existent",e)}notifySubscribers(e){v0(`[thread: ${this.name}] notifying`,this._subscribers.length,"subscribers of",{...e,subs:this._subscribers});for(let t of this._subscribers)t(e)}get applogs(){return this._applogs}get applogsCids(){return this._applogs.map(e=>e.cid)}map(e){return this.applogs.map(e)}get findLast(){return this.applogs.findLast.bind(this.applogs)}get findFirst(){return this.applogs.find.bind(this.applogs)}get firstLog(){return this.applogs[0]}get latestLog(){return this.applogs[this.applogs.length-1]}hasApplog(e,t){if(t)return this.applogs.includes(e);if(!e.cid)throw Kn("[hasApplogs] applog without CID:",e);return this.hasApplogCid(e.cid)}hasApplogCid(e){return this.applogsCids.includes(e.toString())}get applogsByCid(){return new Map(this.applogs.map(e=>[e.cid,e]))}getApplog(e){return this.applogsByCid.get(e.toString())}hasApplogWithDiffTs(e){return this.applogs.find(t=>t.en===e.en&&t.at===e.at&&t.vl===e.vl&&t.ag===e.ag)}get isEmpty(){return this.size===0}get size(){return this.applogs.length}get length(){return this.applogs.length}get untrackedSize(){return Pe(()=>this.size)}get nameAndSizeUntracked(){return Pe(()=>`${this.name} (${this.size})`)}get prettyName(){return g0(this.name)}get hasParents(){return!!this.parents?.length}};var pf=class hf extends Er{static fromArray(t,n){return new hf(n||"static",null,[],t)}constructor(t,n,r,i){super(t,n,r,i,{skipObservable:!0})}get readOnly(){return!0}},yf={};Is(yf,{code:()=>Mf,decode:()=>Oa,encode:()=>Aa,format:()=>sl,name:()=>N1,parse:()=>P1,stringify:()=>sl});var b0=["string","number","bigint","symbol"],_0=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function w0(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(b0.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(T0(e))return"Buffer";let n=A0(e);return n||"Object"}function T0(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function A0(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(_0.includes(t))return t}var B=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}};B.uint=new B(0,"uint",!0);B.negint=new B(1,"negint",!0);B.bytes=new B(2,"bytes",!0);B.string=new B(3,"string",!0);B.array=new B(4,"array",!1);B.map=new B(5,"map",!1);B.tag=new B(6,"tag",!1);B.float=new B(7,"float",!0);B.false=new B(7,"false",!0);B.true=new B(7,"true",!0);B.null=new B(7,"null",!0);B.undefined=new B(7,"undefined",!0);B.break=new B(7,"break",!0);var ie=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},xr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",O0=new TextDecoder,E0=new TextEncoder;function ho(e){return xr&&globalThis.Buffer.isBuffer(e)}function la(e){return e instanceof Uint8Array?ho(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var I0=xr?(e,t,n)=>n-t>64?globalThis.Buffer.from(e.subarray(t,n)).toString("utf8"):Yc(e,t,n):(e,t,n)=>n-t>64?O0.decode(e.subarray(t,n)):Yc(e,t,n),gf=xr?e=>e.length>64?globalThis.Buffer.from(e):Xc(e):e=>e.length>64?E0.encode(e):Xc(e),fa=xr?(e,t,n)=>ho(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n),S0=xr?(e,t)=>(e=e.map(n=>n instanceof Uint8Array?n:globalThis.Buffer.from(n)),la(globalThis.Buffer.concat(e,t))):(e,t)=>{let n=new Uint8Array(t),r=0;for(let i of e)r+i.length>n.length&&(i=i.subarray(0,n.length-r)),n.set(i,r),r+=i.length;return n},$0=xr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function N0(e,t){if(ho(e)&&ho(t))return e.compare(t);for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return 0}function Xc(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)===55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}function Yc(e,t,n){let r=[];for(;t<n;){let i=e[t],o=null,s=i>239?4:i>223?3:i>191?2:1;if(t+s<=n){let a,l,c,d;switch(s){case 1:i<128&&(o=i);break;case 2:a=e[t+1],(a&192)===128&&(d=(i&31)<<6|a&63,d>127&&(o=d));break;case 3:a=e[t+1],l=e[t+2],(a&192)===128&&(l&192)===128&&(d=(i&15)<<12|(a&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:a=e[t+1],l=e[t+2],c=e[t+3],(a&192)===128&&(l&192)===128&&(c&192)===128&&(d=(i&15)<<18|(a&63)<<12|(l&63)<<6|c&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),t+=s}return mf(r)}var Qc=4096;function mf(e){let t=e.length;if(t<=Qc)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=Qc));return n}var R0=256,vf=class{constructor(e=R0){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=$0(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=fa(n,0,this.cursor)}else t=S0(this.chunks,this.cursor);return e&&this.reset(),t}},ye="CBOR decode error:",Wn="CBOR encode error:",yi=[];yi[23]=1;yi[24]=2;yi[25]=3;yi[26]=5;yi[27]=9;function Ur(e,t,n){if(e.length-t<n)throw new Error(`${ye} not enough data for type`)}var Ye=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Yn(e,t,n){Ur(e,t,1);let r=e[t];if(n.strict===!0&&r<Ye[0])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return r}function Qn(e,t,n){Ur(e,t,2);let r=e[t]<<8|e[t+1];if(n.strict===!0&&r<Ye[1])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return r}function Zn(e,t,n){Ur(e,t,4);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(n.strict===!0&&r<Ye[2])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);return r}function er(e,t,n){Ur(e,t,8);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(r)<<BigInt(32))+BigInt(i);if(n.strict===!0&&o<Ye[3])throw new Error(`${ye} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(n.allowBigInt===!0)return o;throw new Error(`${ye} integers outside of the safe integer range are not supported`)}function P0(e,t,n,r){return new ie(B.uint,Yn(e,t+1,r),2)}function C0(e,t,n,r){return new ie(B.uint,Qn(e,t+1,r),3)}function x0(e,t,n,r){return new ie(B.uint,Zn(e,t+1,r),5)}function U0(e,t,n,r){return new ie(B.uint,er(e,t+1,r),9)}function tr(e,t){return Rt(e,0,t.value)}function Rt(e,t,n){if(n<Ye[0]){let r=Number(n);e.push([t|r])}else if(n<Ye[1]){let r=Number(n);e.push([t|24,r])}else if(n<Ye[2]){let r=Number(n);e.push([t|25,r>>>8,r&255])}else if(n<Ye[3]){let r=Number(n);e.push([t|26,r>>>24&255,r>>>16&255,r>>>8&255,r&255])}else{let r=BigInt(n);if(r<Ye[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(r&BigInt(4294967295)),s=Number(r>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,e.push(i)}else throw new Error(`${ye} encountered BigInt larger than allowable range`)}}tr.encodedSize=function(t){return Rt.encodedSize(t.value)};Rt.encodedSize=function(t){return t<Ye[0]?1:t<Ye[1]?2:t<Ye[2]?3:t<Ye[3]?5:9};tr.compareTokens=function(t,n){return t.value<n.value?-1:t.value>n.value?1:0};function M0(e,t,n,r){return new ie(B.negint,-1-Yn(e,t+1,r),2)}function B0(e,t,n,r){return new ie(B.negint,-1-Qn(e,t+1,r),3)}function D0(e,t,n,r){return new ie(B.negint,-1-Zn(e,t+1,r),5)}var da=BigInt(-1),bf=BigInt(1);function L0(e,t,n,r){let i=er(e,t+1,r);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ie(B.negint,o,9)}if(r.allowBigInt!==!0)throw new Error(`${ye} integers outside of the safe integer range are not supported`);return new ie(B.negint,da-BigInt(i),9)}function pa(e,t){let n=t.value,r=typeof n=="bigint"?n*da-bf:n*-1-1;Rt(e,t.type.majorEncoded,r)}pa.encodedSize=function(t){let n=t.value,r=typeof n=="bigint"?n*da-bf:n*-1-1;return r<Ye[0]?1:r<Ye[1]?2:r<Ye[2]?3:r<Ye[3]?5:9};pa.compareTokens=function(t,n){return t.value<n.value?1:t.value>n.value?-1:0};function gi(e,t,n,r){Ur(e,t,n+r);let i=fa(e,t+n,t+n+r);return new ie(B.bytes,i,n+r)}function k0(e,t,n,r){return gi(e,t,1,n)}function j0(e,t,n,r){return gi(e,t,2,Yn(e,t+1,r))}function F0(e,t,n,r){return gi(e,t,3,Qn(e,t+1,r))}function z0(e,t,n,r){return gi(e,t,5,Zn(e,t+1,r))}function V0(e,t,n,r){let i=er(e,t+1,r);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer bytes lengths not supported`);return gi(e,t,9,i)}function yo(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===B.string?gf(e.value):e.value),e.encodedBytes}function Po(e,t){let n=yo(t);Rt(e,t.type.majorEncoded,n.length),e.push(n)}Po.encodedSize=function(t){let n=yo(t);return Rt.encodedSize(n.length)+n.length};Po.compareTokens=function(t,n){return K0(yo(t),yo(n))};function K0(e,t){return e.length<t.length?-1:e.length>t.length?1:N0(e,t)}function mi(e,t,n,r,i){let o=n+r;Ur(e,t,o);let s=new ie(B.string,I0(e,t+n,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=fa(e,t+n,t+o)),s}function q0(e,t,n,r){return mi(e,t,1,n,r)}function G0(e,t,n,r){return mi(e,t,2,Yn(e,t+1,r),r)}function W0(e,t,n,r){return mi(e,t,3,Qn(e,t+1,r),r)}function H0(e,t,n,r){return mi(e,t,5,Zn(e,t+1,r),r)}function J0(e,t,n,r){let i=er(e,t+1,r);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer string lengths not supported`);return mi(e,t,9,i,r)}var X0=Po;function Mr(e,t,n,r){return new ie(B.array,r,n)}function Y0(e,t,n,r){return Mr(e,t,1,n)}function Q0(e,t,n,r){return Mr(e,t,2,Yn(e,t+1,r))}function Z0(e,t,n,r){return Mr(e,t,3,Qn(e,t+1,r))}function eA(e,t,n,r){return Mr(e,t,5,Zn(e,t+1,r))}function tA(e,t,n,r){let i=er(e,t+1,r);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer array lengths not supported`);return Mr(e,t,9,i)}function nA(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return Mr(e,t,1,1/0)}function ha(e,t){Rt(e,B.array.majorEncoded,t.value)}ha.compareTokens=tr.compareTokens;ha.encodedSize=function(t){return Rt.encodedSize(t.value)};function Br(e,t,n,r){return new ie(B.map,r,n)}function rA(e,t,n,r){return Br(e,t,1,n)}function iA(e,t,n,r){return Br(e,t,2,Yn(e,t+1,r))}function oA(e,t,n,r){return Br(e,t,3,Qn(e,t+1,r))}function sA(e,t,n,r){return Br(e,t,5,Zn(e,t+1,r))}function aA(e,t,n,r){let i=er(e,t+1,r);if(typeof i=="bigint")throw new Error(`${ye} 64-bit integer map lengths not supported`);return Br(e,t,9,i)}function uA(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return Br(e,t,1,1/0)}function ya(e,t){Rt(e,B.map.majorEncoded,t.value)}ya.compareTokens=tr.compareTokens;ya.encodedSize=function(t){return Rt.encodedSize(t.value)};function cA(e,t,n,r){return new ie(B.tag,n,1)}function lA(e,t,n,r){return new ie(B.tag,Yn(e,t+1,r),2)}function fA(e,t,n,r){return new ie(B.tag,Qn(e,t+1,r),3)}function dA(e,t,n,r){return new ie(B.tag,Zn(e,t+1,r),5)}function pA(e,t,n,r){return new ie(B.tag,er(e,t+1,r),9)}function ga(e,t){Rt(e,B.tag.majorEncoded,t.value)}ga.compareTokens=tr.compareTokens;ga.encodedSize=function(t){return Rt.encodedSize(t.value)};var hA=20,yA=21,gA=22,mA=23;function vA(e,t,n,r){if(r.allowUndefined===!1)throw new Error(`${ye} undefined values are not supported`);return r.coerceUndefinedToNull===!0?new ie(B.null,null,1):new ie(B.undefined,void 0,1)}function bA(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${ye} indefinite length items not allowed`);return new ie(B.break,void 0,1)}function ma(e,t,n){if(n){if(n.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ye} NaN values are not supported`);if(n.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ye} Infinity values are not supported`)}return new ie(B.float,e,t)}function _A(e,t,n,r){return ma(ba(e,t+1),3,r)}function wA(e,t,n,r){return ma(_a(e,t+1),5,r)}function TA(e,t,n,r){return ma(Af(e,t+1),9,r)}function va(e,t,n){let r=t.value;if(r===!1)e.push([B.float.majorEncoded|hA]);else if(r===!0)e.push([B.float.majorEncoded|yA]);else if(r===null)e.push([B.float.majorEncoded|gA]);else if(r===void 0)e.push([B.float.majorEncoded|mA]);else{let i,o=!1;(!n||n.float64!==!0)&&(wf(r),i=ba(zt,1),r===i||Number.isNaN(r)?(zt[0]=249,e.push(zt.slice(0,3)),o=!0):(Tf(r),i=_a(zt,1),r===i&&(zt[0]=250,e.push(zt.slice(0,5)),o=!0))),o||(AA(r),i=Af(zt,1),zt[0]=251,e.push(zt.slice(0,9)))}}va.encodedSize=function(t,n){let r=t.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!n||n.float64!==!0){wf(r);let i=ba(zt,1);if(r===i||Number.isNaN(r))return 3;if(Tf(r),i=_a(zt,1),r===i)return 5}return 9};var _f=new ArrayBuffer(9),$t=new DataView(_f,1),zt=new Uint8Array(_f,0);function wf(e){if(e===1/0)$t.setUint16(0,31744,!1);else if(e===-1/0)$t.setUint16(0,64512,!1);else if(Number.isNaN(e))$t.setUint16(0,32256,!1);else{$t.setFloat32(0,e);let t=$t.getUint32(0),n=(t&2139095040)>>23,r=t&8388607;if(n===255)$t.setUint16(0,31744,!1);else if(n===0)$t.setUint16(0,(e&2147483648)>>16|r>>13,!1);else{let i=n-127;i<-24?$t.setUint16(0,0):i<-14?$t.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):$t.setUint16(0,(t&2147483648)>>16|i+15<<10|r>>13,!1)}}}function ba(e,t){if(e.length-t<2)throw new Error(`${ye} not enough data for float16`);let n=(e[t]<<8)+e[t+1];if(n===31744)return 1/0;if(n===64512)return-1/0;if(n===32256)return NaN;let r=n>>10&31,i=n&1023,o;return r===0?o=i*2**-24:r!==31?o=(i+1024)*2**(r-25):o=i===0?1/0:NaN,n&32768?-o:o}function Tf(e){$t.setFloat32(0,e,!1)}function _a(e,t){if(e.length-t<4)throw new Error(`${ye} not enough data for float32`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,4).getFloat32(0,!1)}function AA(e){$t.setFloat64(0,e,!1)}function Af(e,t){if(e.length-t<8)throw new Error(`${ye} not enough data for float64`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,8).getFloat64(0,!1)}va.compareTokens=tr.compareTokens;function Ee(e,t,n){throw new Error(`${ye} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function Co(e){return()=>{throw new Error(`${ye} ${e}`)}}var se=[];for(let e=0;e<=23;e++)se[e]=Ee;se[24]=P0;se[25]=C0;se[26]=x0;se[27]=U0;se[28]=Ee;se[29]=Ee;se[30]=Ee;se[31]=Ee;for(let e=32;e<=55;e++)se[e]=Ee;se[56]=M0;se[57]=B0;se[58]=D0;se[59]=L0;se[60]=Ee;se[61]=Ee;se[62]=Ee;se[63]=Ee;for(let e=64;e<=87;e++)se[e]=k0;se[88]=j0;se[89]=F0;se[90]=z0;se[91]=V0;se[92]=Ee;se[93]=Ee;se[94]=Ee;se[95]=Co("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)se[e]=q0;se[120]=G0;se[121]=W0;se[122]=H0;se[123]=J0;se[124]=Ee;se[125]=Ee;se[126]=Ee;se[127]=Co("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)se[e]=Y0;se[152]=Q0;se[153]=Z0;se[154]=eA;se[155]=tA;se[156]=Ee;se[157]=Ee;se[158]=Ee;se[159]=nA;for(let e=160;e<=183;e++)se[e]=rA;se[184]=iA;se[185]=oA;se[186]=sA;se[187]=aA;se[188]=Ee;se[189]=Ee;se[190]=Ee;se[191]=uA;for(let e=192;e<=215;e++)se[e]=cA;se[216]=lA;se[217]=fA;se[218]=dA;se[219]=pA;se[220]=Ee;se[221]=Ee;se[222]=Ee;se[223]=Ee;for(let e=224;e<=243;e++)se[e]=Co("simple values are not supported");se[244]=Ee;se[245]=Ee;se[246]=Ee;se[247]=vA;se[248]=Co("simple values are not supported");se[249]=_A;se[250]=wA;se[251]=TA;se[252]=Ee;se[253]=Ee;se[254]=Ee;se[255]=bA;var Qt=[];for(let e=0;e<24;e++)Qt[e]=new ie(B.uint,e,1);for(let e=-1;e>=-24;e--)Qt[31-e]=new ie(B.negint,e,1);Qt[64]=new ie(B.bytes,new Uint8Array(0),1);Qt[96]=new ie(B.string,"",1);Qt[128]=new ie(B.array,0,1);Qt[160]=new ie(B.map,0,1);Qt[244]=new ie(B.false,!1,1);Qt[245]=new ie(B.true,!0,1);Qt[246]=new ie(B.null,null,1);function OA(){let e=[];return e[B.uint.major]=tr,e[B.negint.major]=pa,e[B.bytes.major]=Po,e[B.string.major]=X0,e[B.array.major]=ha,e[B.map.major]=ya,e[B.tag.major]=ga,e[B.float.major]=va,e}var hS=OA(),Bs=new vf,Zc=class Of{constructor(t,n){this.obj=t,this.parent=n}includes(t){let n=this;do if(n.obj===t)return!0;while(n=n.parent);return!1}static createCheck(t,n){if(t&&t.includes(n))throw new Error(`${Wn} object contains circular references`);return new Of(n,t)}},_n={null:new ie(B.null,null),undefined:new ie(B.undefined,void 0),true:new ie(B.true,!0),false:new ie(B.false,!1),emptyArray:new ie(B.array,0),emptyMap:new ie(B.map,0)},En={number(e,t,n,r){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ie(B.float,e):e>=0?new ie(B.uint,e):new ie(B.negint,e)},bigint(e,t,n,r){return e>=BigInt(0)?new ie(B.uint,e):new ie(B.negint,e)},Uint8Array(e,t,n,r){return new ie(B.bytes,e)},string(e,t,n,r){return new ie(B.string,e)},boolean(e,t,n,r){return e?_n.true:_n.false},null(e,t,n,r){return _n.null},undefined(e,t,n,r){return _n.undefined},ArrayBuffer(e,t,n,r){return new ie(B.bytes,new Uint8Array(e))},DataView(e,t,n,r){return new ie(B.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,n,r){if(!e.length)return n.addBreakTokens===!0?[_n.emptyArray,new ie(B.break)]:_n.emptyArray;r=Zc.createCheck(r,e);let i=[],o=0;for(let s of e)i[o++]=to(s,n,r);return n.addBreakTokens?[new ie(B.array,e.length),i,new ie(B.break)]:[new ie(B.array,e.length),i]},Object(e,t,n,r){let i=t!=="Object",o=i?e.keys():Object.keys(e),s=i?e.size:o.length;if(!s)return n.addBreakTokens===!0?[_n.emptyMap,new ie(B.break)]:_n.emptyMap;r=Zc.createCheck(r,e);let a=[],l=0;for(let c of o)a[l++]=[to(c,n,r),to(i?e.get(c):e[c],n,r)];return EA(a,n),n.addBreakTokens?[new ie(B.map,s),a,new ie(B.break)]:[new ie(B.map,s),a]}};En.Map=En.Object;En.Buffer=En.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))En[`${e}Array`]=En.DataView;function to(e,t={},n){let r=w0(e),i=t&&t.typeEncoders&&t.typeEncoders[r]||En[r];if(typeof i=="function"){let s=i(e,r,t,n);if(s!=null)return s}let o=En[r];if(!o)throw new Error(`${Wn} unsupported type: ${r}`);return o(e,r,t,n)}function EA(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Ef(e,t,n,r){if(Array.isArray(t))for(let i of t)Ef(e,i,n,r);else n[t.type.major](e,t,r)}function IA(e,t,n){let r=to(e,n);if(!Array.isArray(r)&&n.quickEncodeToken){let i=n.quickEncodeToken(r);if(i)return i;let o=t[r.type.major];if(o.encodedSize){let s=o.encodedSize(r,n),a=new vf(s);if(o(a,r,n),a.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${r} was wrong`);return la(a.chunks[0])}}return Bs.reset(),Ef(Bs,r,t,n),Bs.toBytes(!0)}var SA={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},$A=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=Qt[e];if(t===void 0){let n=se[e];if(!n)throw new Error(`${ye} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let r=e&31;t=n(this.data,this._pos,r,this.options)}return this._pos+=t.encodedLength,t}},fi=Symbol.for("DONE"),xo=Symbol.for("BREAK");function NA(e,t,n){let r=[];for(let i=0;i<e.value;i++){let o=di(t,n);if(o===xo){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed array`)}if(o===fi)throw new Error(`${ye} found array but not enough entries (got ${i}, expected ${e.value})`);r[i]=o}return r}function RA(e,t,n){let r=n.useMaps===!0,i=r?void 0:{},o=r?new Map:void 0;for(let s=0;s<e.value;s++){let a=di(t,n);if(a===xo){if(e.value===1/0)break;throw new Error(`${ye} got unexpected break to lengthed map`)}if(a===fi)throw new Error(`${ye} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(r!==!0&&typeof a!="string")throw new Error(`${ye} non-string keys not supported (got ${typeof a})`);if(n.rejectDuplicateMapKeys===!0&&(r&&o.has(a)||!r&&a in i))throw new Error(`${ye} found repeat map key "${a}"`);let l=di(t,n);if(l===fi)throw new Error(`${ye} found map but not enough entries (got ${s} [no value], expected ${e.value})`);r?o.set(a,l):i[a]=l}return r?o:i}function di(e,t){if(e.done())return fi;let n=e.next();if(n.type===B.break)return xo;if(n.type.terminal)return n.value;if(n.type===B.array)return NA(n,e,t);if(n.type===B.map)return RA(n,e,t);if(n.type===B.tag){if(t.tags&&typeof t.tags[n.value]=="function"){let r=di(e,t);return t.tags[n.value](r)}throw new Error(`${ye} tag not supported (${n.value})`)}throw new Error("unsupported")}function PA(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ye} data to decode must be a Uint8Array`);t=Object.assign({},SA,t);let n=t.tokenizer||new $A(e,t),r=di(n,t);if(r===fi)throw new Error(`${ye} did not find any content to decode`);if(r===xo)throw new Error(`${ye} got unexpected break`);return[r,e.subarray(n.pos())]}function CA(e,t){let[n,r]=PA(e,t);if(r.length>0)throw new Error(`${ye} too many terminals, data makes no sense`);return n}var xA=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===B.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===B.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[B.uint.major](e,t){this.prefix(e);let n=String(t.value),r=[];for(let i=0;i<n.length;i++)r[i]=n.charCodeAt(i);e.push(r)}[B.negint.major](e,t){this[B.uint.major](e,t)}[B.bytes.major](e,t){throw new Error(`${Wn} unsupported type: Uint8Array`)}[B.string.major](e,t){this.prefix(e);let n=gf(JSON.stringify(t.value));e.push(n.length>32?la(n):n)}[B.array.major](e,t){this.prefix(e),this.inRecursive.push({type:B.array,elements:0}),e.push([91])}[B.map.major](e,t){this.prefix(e),this.inRecursive.push({type:B.map,elements:0}),e.push([123])}[B.tag.major](e,t){}[B.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===B.array)e.push([93]);else if(o.type===B.map)e.push([125]);else throw new Error("Unexpected recursive type; this should not happen!");return}throw new Error("Unexpected break; this should not happen!")}if(t.value===void 0)throw new Error(`${Wn} unsupported type: undefined`);if(this.prefix(e),t.type.name==="true"){e.push([116,114,117,101]);return}else if(t.type.name==="false"){e.push([102,97,108,115,101]);return}else if(t.type.name==="null"){e.push([110,117,108,108]);return}let n=String(t.value),r=[],i=!1;for(let o=0;o<n.length;o++)r[o]=n.charCodeAt(o),!i&&(r[o]===46||r[o]===101||r[o]===69)&&(i=!0);i||(r.push(46),r.push(48)),e.push(r)}};function UA(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${Wn} complex map keys are not supported`);let n=e[0],r=t[0];if(n.type!==B.string||r.type!==B.string)throw new Error(`${Wn} non-string map keys are not supported`);if(n<r)return-1;if(n>r)return 1;throw new Error(`${Wn} unexpected duplicate map keys, this is not supported`)}var MA={addBreakTokens:!0,mapSorter:UA};function BA(e,t){return t=Object.assign({},MA,t),IA(e,new xA,t)}var If=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t,this.modeStack=["value"],this.lastToken=""}pos(){return this._pos}done(){return this._pos>=this.data.length}ch(){return this.data[this._pos]}currentMode(){return this.modeStack[this.modeStack.length-1]}skipWhitespace(){let e=this.ch();for(;e===32||e===9||e===13||e===10;)e=this.data[++this._pos]}expect(e){if(this.data.length-this._pos<e.length)throw new Error(`${ye} unexpected end of input at position ${this._pos}`);for(let t=0;t<e.length;t++)if(this.data[this._pos++]!==e[t])throw new Error(`${ye} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,n=!1,r=s=>{for(;!this.done();){let a=this.ch();if(s.includes(a))this._pos++;else break}};if(this.ch()===45&&(t=!0,this._pos++),this.ch()===48)if(this._pos++,this.ch()===46)this._pos++,n=!0;else return new ie(B.uint,0,this._pos-e);if(r([48,49,50,51,52,53,54,55,56,57]),t&&this._pos===e+1)throw new Error(`${ye} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(n)throw new Error(`${ye} unexpected token at position ${this._pos}`);n=!0,this._pos++,r([48,49,50,51,52,53,54,55,56,57])}!this.done()&&(this.ch()===101||this.ch()===69)&&(n=!0,this._pos++,!this.done()&&(this.ch()===43||this.ch()===45)&&this._pos++,r([48,49,50,51,52,53,54,55,56,57]));let i=String.fromCharCode.apply(null,this.data.subarray(e,this._pos)),o=parseFloat(i);return n?new ie(B.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ie(o>=0?B.uint:B.negint,o,this._pos-e):new ie(o>=0?B.uint:B.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${ye} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,o=0;i<this.data.length&&o<65536;i++,o++){let s=this.data[i];if(s===92||s<32||s>=128)break;if(s===34){let a=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new ie(B.string,a,o)}}let e=this._pos,t=[],n=()=>{if(this._pos+4>=this.data.length)throw new Error(`${ye} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let s=this.ch();if(s>=48&&s<=57)s-=48;else if(s>=97&&s<=102)s=s-97+10;else if(s>=65&&s<=70)s=s-65+10;else throw new Error(`${ye} unexpected unicode escape character at position ${this._pos}`);i=i*16+s,this._pos++}return i},r=()=>{let i=this.ch(),o=null,s=i>239?4:i>223?3:i>191?2:1;if(this._pos+s>this.data.length)throw new Error(`${ye} unexpected unicode sequence at position ${this._pos}`);let a,l,c,d;switch(s){case 1:i<128&&(o=i);break;case 2:a=this.data[this._pos+1],(a&192)===128&&(d=(i&31)<<6|a&63,d>127&&(o=d));break;case 3:a=this.data[this._pos+1],l=this.data[this._pos+2],(a&192)===128&&(l&192)===128&&(d=(i&15)<<12|(a&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:a=this.data[this._pos+1],l=this.data[this._pos+2],c=this.data[this._pos+3],(a&192)===128&&(l&192)===128&&(c&192)===128&&(d=(i&15)<<18|(a&63)<<12|(l&63)<<6|c&63,d>65535&&d<1114112&&(o=d))}o===null?(o=65533,s=1):o>65535&&(o-=65536,t.push(o>>>10&1023|55296),o=56320|o&1023),t.push(o),this._pos+=s};for(;!this.done();){let i=this.ch(),o;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${ye} unexpected string termination at position ${this._pos}`);switch(o=this.ch(),this._pos++,o){case 34:case 39:case 92:case 47:t.push(o);break;case 98:t.push(8);break;case 116:t.push(9);break;case 110:t.push(10);break;case 102:t.push(12);break;case 114:t.push(13);break;case 117:t.push(n());break;default:throw new Error(`${ye} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ie(B.string,mf(t),this._pos-e);default:if(i<32)throw new Error(`${ye} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):r()}}throw new Error(`${ye} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ie(B.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ie(B.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ie(B.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ie(B.false,!1,5);case 116:return this.expect([116,114,117,101]),new ie(B.true,!0,4);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.parseNumber();default:throw new Error(`${ye} unexpected character at position ${this._pos}`)}}next(){switch(this.skipWhitespace(),this.currentMode()){case"value":return this.modeStack.pop(),this.parseValue();case"array-value":{if(this.modeStack.pop(),this.ch()===93)return this._pos++,this.skipWhitespace(),new ie(B.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} unexpected character at position ${this._pos}, was expecting array delimiter but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("array-value"),this.skipWhitespace(),this.parseValue()}case"array-start":return this.modeStack.pop(),this.ch()===93?(this._pos++,this.skipWhitespace(),new ie(B.break,void 0,1)):(this.modeStack.push("array-value"),this.skipWhitespace(),this.parseValue());case"obj-key":if(this.ch()===125)return this.modeStack.pop(),this._pos++,this.skipWhitespace(),new ie(B.break,void 0,1);if(this.ch()!==44)throw new Error(`${ye} unexpected character at position ${this._pos}, was expecting object delimiter but found '${String.fromCharCode(this.ch())}'`);this._pos++,this.skipWhitespace();case"obj-start":{if(this.modeStack.pop(),this.ch()===125)return this._pos++,this.skipWhitespace(),new ie(B.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${ye} unexpected character at position ${this._pos}, was expecting key/value delimiter ':' but found '${String.fromCharCode(this.ch())}'`);return this._pos++,this.modeStack.push("obj-value"),e}case"obj-value":return this.modeStack.pop(),this.modeStack.push("obj-key"),this.skipWhitespace(),this.parseValue();default:throw new Error(`${ye} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function DA(e,t){return t=Object.assign({tokenizer:new If(e,t)},t),CA(e,t)}var yS=new Uint8Array(0);function LA(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0}function wa(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function kA(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(n[s]!==255)throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function g(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var z=0,J=0,F=0,k=S.length;F!==k&&S[F]===0;)F++,z++;for(var K=(k-F)*d+1>>>0,W=new Uint8Array(K);F!==k;){for(var j=S[F],Z=0,G=K-1;(j!==0||Z<J)&&G!==-1;G--,Z++)j+=256*W[G]>>>0,W[G]=j%a>>>0,j=j/a>>>0;if(j!==0)throw new Error("Non-zero carry");J=Z,F++}for(var fe=K-J;fe!==K&&W[fe]===0;)fe++;for(var x=l.repeat(z);fe<K;++fe)x+=e.charAt(W[fe]);return x}function C(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var z=0;if(S[z]!==" "){for(var J=0,F=0;S[z]===l;)J++,z++;for(var k=(S.length-z)*c+1>>>0,K=new Uint8Array(k);S[z];){var W=n[S.charCodeAt(z)];if(W===255)return;for(var j=0,Z=k-1;(W!==0||j<F)&&Z!==-1;Z--,j++)W+=a*K[Z]>>>0,K[Z]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");F=j,z++}if(S[z]!==" "){for(var G=k-F;G!==k&&K[G]===0;)G++;for(var fe=new Uint8Array(J+(k-G)),x=J;G!==k;)fe[x++]=K[G++];return fe}}}function I(S){var z=C(S);if(z)return z;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:C,decode:I}}var jA=kA,FA=jA,zA=FA,VA=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},KA=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let r=t.codePointAt(0);if(r===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Sf(this,e)}},qA=class{decoders;constructor(e){this.decoders=e}or(e){return Sf(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Sf(e,t){return new qA({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var GA=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new VA(e,t,n),this.decoder=new KA(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function $f({name:e,prefix:t,encode:n,decode:r}){return new GA(e,t,n,r)}function Uo({name:e,prefix:t,alphabet:n}){let{encode:r,decode:i}=zA(n,e);return $f({prefix:t,name:e,encode:r,decode:o=>wa(i(o))})}function WA(e,t,n,r){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*n/8|0),s=0,a=0,l=0;for(let c=0;c<i;++c){let d=t[e[c]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);a=a<<n|d,s+=n,s>=8&&(s-=8,o[l++]=255&a>>s)}if(s>=n||255&a<<8-s)throw new SyntaxError("Unexpected end of data");return o}function HA(e,t,n){let r=t[t.length-1]==="=",i=(1<<n)-1,o="",s=0,a=0;for(let l=0;l<e.length;++l)for(a=a<<8|e[l],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s!==0&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o}function JA(e){let t={};for(let n=0;n<e.length;++n)t[e[n]]=n;return t}function yt({name:e,prefix:t,bitsPerChar:n,alphabet:r}){let i=JA(r);return $f({prefix:t,name:e,encode(o){return HA(o,r,n)},decode(o){return WA(o,i,n,e)}})}var no=yt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),gS=yt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),mS=yt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),vS=yt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),bS=yt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),_S=yt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),wS=yt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),TS=yt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),AS=yt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ds=Uo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),OS=Uo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),An=Uo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),ES=Uo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Nf={};Is(Nf,{Digest:()=>Mo,create:()=>Ta,decode:()=>Pf,equals:()=>Cf,hasCode:()=>h1});var XA=Rf,el=128,YA=127,QA=~YA,ZA=Math.pow(2,31);function Rf(e,t,n){t=t||[],n=n||0;for(var r=n;e>=ZA;)t[n++]=e&255|el,e/=128;for(;e&QA;)t[n++]=e&255|el,e>>>=7;return t[n]=e|0,Rf.bytes=n-r+1,t}var e1=Ks,t1=128,tl=127;function Ks(e,r){var n=0,r=r||0,i=0,o=r,s,a=e.length;do{if(o>=a)throw Ks.bytes=0,new RangeError("Could not decode varint");s=e[o++],n+=i<28?(s&tl)<<i:(s&tl)*Math.pow(2,i),i+=7}while(s>=t1);return Ks.bytes=o-r,n}var n1=Math.pow(2,7),r1=Math.pow(2,14),i1=Math.pow(2,21),o1=Math.pow(2,28),s1=Math.pow(2,35),a1=Math.pow(2,42),u1=Math.pow(2,49),c1=Math.pow(2,56),l1=Math.pow(2,63),f1=function(e){return e<n1?1:e<r1?2:e<i1?3:e<o1?4:e<s1?5:e<a1?6:e<u1?7:e<c1?8:e<l1?9:10},d1={encode:XA,decode:e1,encodingLength:f1},p1=d1,go=p1;function qs(e,t=0){return[go.decode(e,t),go.decode.bytes]}function mo(e,t,n=0){return go.encode(e,t,n),t}function vo(e){return go.encodingLength(e)}function Ta(e,t){let n=t.byteLength,r=vo(e),i=r+vo(n),o=new Uint8Array(i+n);return mo(e,o,0),mo(n,o,r),o.set(t,i),new Mo(e,n,t,o)}function Pf(e){let t=wa(e),[n,r]=qs(t),[i,o]=qs(t.subarray(r)),s=t.subarray(r+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Mo(n,i,s,t)}function Cf(e,t){if(e===t)return!0;{let n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&LA(e.bytes,n.bytes)}}var Mo=class{code;size;digest;bytes;constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}};function h1(e,t){return e.code===t}function nl(e,t){let{bytes:n,version:r}=e;switch(r){case 0:return g1(n,Gs(e),t??An.encoder);default:return m1(n,Gs(e),t??no.encoder)}}var rl=new WeakMap;function Gs(e){let t=rl.get(e);if(t==null){let n=new Map;return rl.set(e,n),n}return t}var Bo=class tt{code;version;multihash;bytes;"/";constructor(t,n,r,i){this.code=n,this.version=t,this.multihash=r,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:n}=this;if(t!==ri)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(n.code!==v1)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return tt.createV0(n)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:n}=this.multihash,r=Ta(t,n);return tt.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return tt.equals(this,t)}static equals(t,n){let r=n;return r!=null&&t.code===r.code&&t.version===r.version&&Cf(t.multihash,r.multihash)}toString(t){return nl(this,t)}toJSON(){return{"/":nl(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let n=t;if(n instanceof tt)return n;if(n["/"]!=null&&n["/"]===n.bytes||n.asCID===n){let{version:r,code:i,multihash:o,bytes:s}=n;return new tt(r,i,o,s??il(r,i,o.bytes))}else if(n[b1]===!0){let{version:r,multihash:i,code:o}=n,s=Pf(i);return tt.create(r,o,s)}else return null}static create(t,n,r){if(typeof n!="number")throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(n!==ri)throw new Error(`Version 0 CID must use dag-pb (code: ${ri}) block encoding`);return new tt(t,n,r,r.bytes)}case 1:{let i=il(t,n,r.bytes);return new tt(t,n,r,i)}default:throw new Error("Invalid version")}}static createV0(t){return tt.create(0,ri,t)}static createV1(t,n){return tt.create(1,t,n)}static decode(t){let[n,r]=tt.decodeFirst(t);if(r.length!==0)throw new Error("Incorrect length");return n}static decodeFirst(t){let n=tt.inspectBytes(t),r=n.size-n.multihashSize,i=wa(t.subarray(r,r+n.multihashSize));if(i.byteLength!==n.multihashSize)throw new Error("Incorrect length");let o=i.subarray(n.multihashSize-n.digestSize),s=new Mo(n.multihashCode,n.digestSize,o,i);return[n.version===0?tt.createV0(s):tt.createV1(n.codec,s),t.subarray(n.size)]}static inspectBytes(t){let n=0,r=()=>{let[g,C]=qs(t.subarray(n));return n+=C,g},i=r(),o=ri;if(i===18?(i=0,n=0):o=r(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=n,a=r(),l=r(),c=n+l,d=c-s;return{version:i,codec:o,multihashCode:a,digestSize:l,multihashSize:d,size:c}}static parse(t,n){let[r,i]=y1(t,n),o=tt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Gs(o).set(r,t),o}};function y1(e,t){switch(e[0]){case"Q":{let n=t??An;return[An.prefix,n.decode(`${An.prefix}${e}`)]}case An.prefix:{let n=t??An;return[An.prefix,n.decode(e)]}case no.prefix:{let n=t??no;return[no.prefix,n.decode(e)]}case Ds.prefix:{let n=t??Ds;return[Ds.prefix,n.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function g1(e,t,n){let{prefix:r}=n;if(r!==An.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);let i=t.get(r);if(i==null){let o=n.encode(e).slice(1);return t.set(r,o),o}else return i}function m1(e,t,n){let{prefix:r}=n,i=t.get(r);if(i==null){let o=n.encode(e);return t.set(r,o),o}else return i}var ri=112,v1=18;function il(e,t,n){let r=vo(e),i=r+vo(t),o=new Uint8Array(i+n.byteLength);return mo(e,o,0),mo(t,o,r),o.set(n,i),o}var b1=Symbol.for("@ipld/js-cid/CID"),_1=20;function xf({name:e,code:t,encode:n,minDigestLength:r,maxDigestLength:i}){return new w1(e,t,n,r,i)}var w1=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,r,i){this.name=e,this.code=t,this.encode=n,this.minDigestLength=r??_1,this.maxDigestLength=i}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?ol(n,this.code,t?.truncate):n.then(r=>ol(r,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function ol(e,t,n){if(n!=null&&n!==e.byteLength){if(n>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,n)}return Ta(t,e)}var Uf=yt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),IS=yt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),SS=yt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$S=yt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function T1(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function A1(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Bo.asCID(e);if(!t)return null;let n=t.toString();return[new ie(B.map,1/0,1),new ie(B.string,"/",1),new ie(B.string,n,n.length),new ie(B.break,void 0,1)]}function bo(e){let t=Uf.encode(e).slice(1);return[new ie(B.map,1/0,1),new ie(B.string,"/",1),new ie(B.map,1/0,1),new ie(B.string,"bytes",5),new ie(B.string,t,t.length),new ie(B.break,void 0,1),new ie(B.break,void 0,1)]}function Ft(e){return bo(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function O1(e){return bo(new Uint8Array(e))}function E1(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function I1(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}var S1={typeEncoders:{Object:A1,Buffer:bo,Uint8Array:bo,Int8Array:Ft,Uint16Array:Ft,Int16Array:Ft,Uint32Array:Ft,Int32Array:Ft,Float32Array:Ft,Float64Array:Ft,Uint8ClampedArray:Ft,BigInt64Array:Ft,BigUint64Array:Ft,DataView:Ft,ArrayBuffer:O1,undefined:E1,number:I1}},$1=class extends If{constructor(e,t){super(e,t),this.tokenBuffer=[]}done(){return this.tokenBuffer.length===0&&super.done()}_next(){return this.tokenBuffer.length>0?this.tokenBuffer.pop():super.next()}next(){let e=this._next();if(e.type===B.map){let t=this._next();if(t.type===B.string&&t.value==="/"){let n=this._next();if(n.type===B.string){if(this._next().type!==B.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(n),new ie(B.tag,42,0)}if(n.type===B.map){let r=this._next();if(r.type===B.string&&r.value==="bytes"){let i=this._next();if(i.type===B.string){for(let s=0;s<2;s++)if(this._next().type!==B.break)throw new Error("Invalid encoded Bytes form");let o=Uf.decode(`m${i.value}`);return new ie(B.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(r)}this.tokenBuffer.push(n)}this.tokenBuffer.push(t)}return e}},Ws={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Ws.tags[42]=Bo.parse;var N1="dag-json",Mf=297,Aa=e=>BA(e,S1),Oa=e=>{let t=T1(e),n=Object.assign(Ws,{tokenizer:new $1(t,Ws)});return DA(t,n)},sl=e=>R1.decode(Aa(e)),R1=new TextDecoder,P1=e=>Oa(C1.encode(e)),C1=new TextEncoder;function x1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Bf(e,t,n=""){let r=x1(e),i=e?.length,o=t!==void 0;if(!r||o&&i!==t){let s=n&&`"${n}" `,a=o?` of length ${t}`:"",l=r?`length=${i}`:`type=${typeof e}`;throw new Error(s+"expected Uint8Array"+a+", got "+l)}return e}function al(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function U1(e,t){Bf(e,void 0,"digestInto() output");let n=t.outputLen;if(e.length<n)throw new Error('"digestInto() output" expected to be of length >='+n)}function Hs(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ls(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Jt(e,t){return e<<32-t|e>>>t}function M1(e,t={}){let n=(i,o)=>e(o).update(i).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.create=i=>e(i),Object.assign(n,t),Object.freeze(n)}var B1=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function D1(e,t,n){return e&t^~e&n}function L1(e,t,n){return e&t^e&n^t&n}var k1=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=Ls(this.buffer)}update(e){al(this),Bf(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);if(s===r){let a=Ls(e);for(;r<=i-o;o+=r)this.process(a,o);continue}n.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){al(this),U1(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:o}=this;t[o++]=128,Hs(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let d=o;d<r;d++)t[d]=0;n.setBigUint64(r-8,BigInt(this.length*8),i),this.process(n,0);let s=Ls(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let l=a/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)s.setUint32(4*d,c[d],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:o,pos:s}=this;return e.destroyed=o,e.finished=i,e.length=r,e.pos=s,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}},wn=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),j1=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Tn=new Uint32Array(64),F1=class extends k1{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:n,D:r,E:i,F:o,G:s,H:a}=this;return[e,t,n,r,i,o,s,a]}set(e,t,n,r,i,o,s,a){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=o|0,this.G=s|0,this.H=a|0}process(e,t){for(let d=0;d<16;d++,t+=4)Tn[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let g=Tn[d-15],C=Tn[d-2],I=Jt(g,7)^Jt(g,18)^g>>>3,S=Jt(C,17)^Jt(C,19)^C>>>10;Tn[d]=S+Tn[d-7]+I+Tn[d-16]|0}let{A:n,B:r,C:i,D:o,E:s,F:a,G:l,H:c}=this;for(let d=0;d<64;d++){let g=Jt(s,6)^Jt(s,11)^Jt(s,25),C=c+g+D1(s,a,l)+j1[d]+Tn[d]|0,S=(Jt(n,2)^Jt(n,13)^Jt(n,22))+L1(n,r,i)|0;c=l,l=a,a=s,s=o+C|0,o=i,i=r,r=n,n=C+S|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,s=s+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(n,r,i,o,s,a,l,c)}roundClean(){Hs(Tn)}destroy(){this.set(0,0,0,0,0,0,0,0),Hs(this.buffer)}},z1=class extends F1{A=wn[0]|0;B=wn[1]|0;C=wn[2]|0;D=wn[3]|0;E=wn[4]|0;F=wn[5]|0;G=wn[6]|0;H=wn[7]|0;constructor(){super(32)}},V1=M1(()=>new z1,B1(1));var He=St(sn(),1),Df=St(ay(),1),ul=e=>He.Type.Union([e,He.Type.Null()]);var Lf=/^(k51qz|baguq)[0-9a-z]{56,57}$/,K1=/^[0-9A-Fa-f]{7,8}$/g;He.FormatRegistry.Set("EntityID",e=>!!e.match(K1)||!!e.match(Lf));var q1=He.Type.String(),G1=e=>e?.enc instanceof Uint8Array;He.FormatRegistry.Set("CID",e=>!!e.match(Lf));var kf=He.Type.String({format:"CID"}),W1=/^http([s]?):\/\/.*\..*/;He.FormatRegistry.Set("URL",e=>!!e.match(W1));var NS=He.Type.String({format:"URL"}),jf=He.Type.Object({en:q1,at:He.Type.String(),vl:ul(He.Type.Union([He.Type.String(),He.Type.Boolean(),He.Type.Number()])),ts:He.Type.String(),ag:He.Type.String(),pv:ul(kf)}),cl=Df.TypeCompiler.Compile(jf);var RS=cl.Check.bind(cl),H1=He.Type.Composite([He.Type.Object({cid:kf}),jf]),Js=Df.TypeCompiler.Compile(H1),J1=e=>Array.from(Js.Errors(e)),Ff=Js.Check.bind(Js);function zf(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var X1=xf({name:"sha2-256",code:18,encode:zf("SHA-256")}),PS=xf({name:"sha2-512",code:19,encode:zf("SHA-512")}),{WARN:ll,LOG:CS,DEBUG:Y1,VERBOSE:Vf,ERROR:Q1}=$e.setup($e.INFO);function Kf(e,t=["cid"]){if(!e)throw Q1("falsy log",e);let n=e.cid;if(G1(e))return n||(n=Ea(qf(e).bytes).toString()),ll("preparing an encrypted applog - really?"),{log:e,cid:n};let r={};for(let[i,o]of Object.entries(e))o===void 0&&(ll(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?Vf("excluding app log",{key:i,val:o}):r[i]=o;return{log:r,cid:n}}function Z1(e){return Ea(eO(e).bytes)}function eO(e){return qf(Kf(e)?.log)}function Ea(e){let t=V1(e),n=Nf.create(X1.code,t),r=Bo.create(1,Mf,n);return Vf("[getCidSync]",{bytes:e,hash:t,digest:n,cid:r}),r}function qf(e){Y1("[encodeBlock]",e);let t=Aa(e);return{bytes:t,cid:Ea(t)}}function fl(e){let t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function tO(e,t){let n=fl(e),r=fl(t);return+n<+r}var{WARN:xS,LOG:US,DEBUG:MS,VERBOSE:nO,ERROR:dl}=$e.setup($e.INFO),rO=(e,t,n="asc")=>n==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Gf=(e,t,n)=>ze.structural(Wc(t,e),Wc(n,e)),iO=(e,t,n="asc")=>rO(e.ts,t.ts,n),BS=ZT(Gf,["en","at"]);function pi(e,t="asc"){return e.sort((n,r)=>iO(n,r,t))}var oO=(e,t)=>tO(new Date(e.ts),new Date(t.ts));var Wf=e=>{let t=new Map;for(let n of e){if(!n)throw dl("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!n.cid)throw dl("applog with missing CID",n),new Error("applog with missing CID");let r=n.cid;t.has(r)?nO("Skipping duplicate applog:",[t.get(r),n]):t.set(r,n)}return Array.from(t.values())};function sO(e){return typeof e=="string"&&e.startsWith("?")}function aO(e){return e.slice(1)}function Ia(e,t){let n={},r={};for(let[i,o]of Object.entries(e))if(sO(o)){let s=aO(o),a=t[s];a?r[i]=a:n[i]=s}else r[i]=o;return[r,n]}function uO(e,t,n){let r;if(t){let i=typeof t;i==="string"?r=t===n:i==="function"?r=t(n):typeof t.has=="function"?r=t.has(n):Array.isArray(t)&&!Array.isArray(n)?r=t.includes(n):r=t===n}else r=t===n;return e.charAt(0)==="!"?!r:r}var Hf=function(t){for(var n=0,r=0,i=t.length;r<i;r++)n+=t[r];return n},pl=function(t){return Hf(t)/t.length},Nt={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return Nt.max(e)-Nt.min(e)},midrange:function(e){return Nt.range(e)/2},sum:Hf,mean:pl,average:pl,median:function(e){e.sort(function(n,r){return n-r});var t=e.length/2;return t%1?e[t-.5]:(e[t-1]+e[t])/2},modes:function(e){if(!e.length)return[];var t={},n=0,r=[];return e.forEach(function(i){t[i]?t[i]++:t[i]=1,t[i]>n?(r=[i],n=t[i]):t[i]===n&&(r.push(i),n=t[i])}),r},variance:function(e){var t=Nt.mean(e);return Nt.mean(e.map(function(n){return Math.pow(n-t,2)}))},standardDeviation:function(e){return Math.sqrt(Nt.variance(e))},meanAbsoluteDeviation:function(e){var t=Nt.mean(e);return Nt.mean(e.map(function(n){return Math.abs(n-t)}))},zScores:function(e){var t=Nt.mean(e),n=Nt.standardDeviation(e);return e.map(function(r){return(r-t)/n})}};Nt.average=Nt.mean;var Jf=function(e,t=13,n){if(!e?.length)throw new Error(`Empty string: ${e}`);let r=3735928559^t,i=1103547991^t;for(let s=0,a;s<e.length;s++)a=e.charCodeAt(s),r=Math.imul(r^a,2654435761),i=Math.imul(i^a,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),(4294967296*(2097151&i)+(r>>>0)).toString(16).slice(-n).padStart(n,"0")};function Xf(){return new Date().toISOString()}var{WARN:cO,LOG:DS,DEBUG:Ke,VERBOSE:LS,ERROR:_o}=$e.setup($e.INFO);function lO(e,t){Ke(`[ensureTsPvAndFinalizeApplogs] ENTER - ${e.length} applogs, thread size=${t.size}`);let n=Xf(),r=t;Ke("[ensureTsPvAndFinalizeApplogs] About to map over applogs");let i=e.map((o,s)=>{Ke(`[ensureTsPvAndFinalizeApplogs] Processing applog ${s+1}/${e.length}`);let a=fO(o,{ts:n,threadForPv:r});return Ke(`[ensureTsPvAndFinalizeApplogs] Finalized applog ${s+1}/${e.length}`),a});return Ke(`[ensureTsPvAndFinalizeApplogs] EXIT - mapped ${i.length} applogs`),i}function fO(e,{ts:t,threadForPv:n}={}){Ke(`[finalizeApplogForInsert] ENTER - en=${e.en}, at=${e.at}`),Ke("[finalizeApplogForInsert] About to call withTs");let r=hO(e,t??Xf());Ke(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${n?.size??"null"})`);let i=yO(r,n);Ke("[finalizeApplogForInsert] About to call encodeApplogAndGetCid");let o=Z1(i).toString();Ke(`[finalizeApplogForInsert] CID created: ${o}`),e.cid&&e.cid!==o&&cO("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let s={...i,cid:o};if(Ke("[finalizeApplogForInsert] About to validate applog"),!Ff(s))throw _o(`Bogus Applog ${JSON.stringify(s)}`,J1(s));return Ke(`[finalizeApplogForInsert] EXIT - CID=${o}`),Object.freeze(s)}function dO(e){return!!e.ts}function pO(e){return!!e.pv}function hO(e,t){return dO(e)?e:{...e,ts:t}}function yO(e,t){if(Ke(`[withPvFrom] ENTER - en=${e.en}, at=${e.at}, hasPv=${e.pv!==void 0}`),e.pv!==void 0)return Ke("[withPvFrom] EXIT early - pv already set"),e;if(t){let{en:n,at:r}=e;Ke(`[withPvFrom] About to call thread.findLast for en=${n}, at=${r}, thread.size=${t.size}`);let i=t.findLast(s=>s.en==n&&s.at==r);if(Ke(`[withPvFrom] findLast completed, found=${!!i}`),Ke("[withPvFrom] About to check equality"),Gf(["en","at","vl","ts","ag"],e,i))throw _o("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return Ke(`[withPvFrom] EXIT - prevLogCid=${o}`),{...e,pv:o}}else{if(!pO(e))throw _o("[withPvFrom] no thread and no pv:",e);return Ke("[withPvFrom] EXIT - no thread, returning log with existing pv"),e}}function Do(e){let t=()=>(Pe(()=>e.length<2&&Ke(`joinThreads with count=${e.length}`)),pi(Wf(e.flatMap(i=>{let o=i.applogs;if(!o)throw _o("falsy applogs of thread",i),new Error("falsy applogs of thread");return o})))),n=Pe(()=>t()),r=at(function(i,o){return un(i)?{init:Pe(()=>t())}:{added:i.added.filter(s=>!this.hasApplog(s,!0)),removed:i.removed?.filter(s=>!!this.parents.some(l=>l===o?!1:l.hasApplog(s,!0)))}});return new Sa(Pe(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],n,r)}var{WARN:hl,LOG:kS,DEBUG:yl,VERBOSE:qn,ERROR:gl}=$e.setup($e.INFO),Sa=class Yf extends Er{constructor(t,n,r,i,o,s=null){super(t,n,r,o?Ce.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=s,bn(this,{onParentUpdate:at}),o&&this.subscribeToParents()}static mapWrites(t,n,r){return new Yf(`${n}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,r)}_parentSubscriptions=null;insert(t){let n=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!n))return this.parents.forEach(r=>r.insert(n))}insertRaw(t){let n=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!n))return this.parents.forEach(r=>r.insertRaw(n))}subscribeToParents(){this._parentSubscriptions=new Map;let t=It(()=>{this.parents.length||hl("MappedThread has no parents",this),qn(`[MappedThread: ${this.name}] subscribing to parents:`,this.parents.map(r=>r.name));let n=new Set([...this._parentSubscriptions.keys()]);for(let r of this.parents){n.delete(r)&&qn(`[MappedThread: ${this.name}] Skipping re-sub to parent`,r.nameAndSizeUntracked),qn(`[MappedThread: ${this.name}] sub to new parent`,r.nameAndSizeUntracked);let o=this.onParentUpdate.bind(this,r),s=r.subscribe(o);this._parentSubscriptions.set(r,s)}for(let r of n)qn(`[MappedThread: ${this.name}] un-subscribing from old parent`,r.nameAndSizeUntracked),this._parentSubscriptions.get(r)(),this._parentSubscriptions.delete(r)})}subscribe(t){return this._parentSubscriptions||this.subscribeToParents(),super.subscribe(t)}triggerRemap(){if(!this._eventMapper)throw gl("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);yl(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&hl(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Pe(()=>on(t.applogs))})})}onParentUpdate(t,n){qn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,n);let r=this._eventMapper?this._eventMapper(n,t):n;if(this._eventMapper)if(qn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,r),un(r))this._applogs.replace([...r.init]);else{for(let i of r.added)this._applogs.splice(l0(this._applogs,i,"ts"),0,i);if(r.removed){for(let i of r.removed)if(!this._applogs.remove(i))if(!un(n)&&n.removed?.includes(i))yl("Ignoring remove event for non-existent because it was part of parent event's removed",i,n);else throw gl(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:n,mapResult:r})}}qn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Yr(this._applogs)),this.notifySubscribers(r)}get readOnly(){return!1}},{WARN:jS,LOG:FS,DEBUG:zS,VERBOSE:ks,ERROR:gO}=$e.setup($e.INFO),In=Qe("rollingFilter",function(t,n,r={}){let i=mO(n),o=ml(i),s=Ce.array(Pe(function(){return o(t.applogs)}),{deep:!1,name:`${t.name} | ${r.name||`rollingFilter.array{${Hn(i)}}`}`}),a=g=>{let C;return un(g)?C={init:o(g.init)}:C={added:o(g.added),removed:g.removed},ks(`rollingFilter{${t.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,i,g,"=>",C),C},l=new Sa(`${t.name} | ${r.name||`rollingFilter{${Hn(i)}}`}`,t,[...t.filters,...r.extraFilterName?[r.extraFilterName]:[]],s,a),c=Wu(()=>on(n),g=>{ks(`rollingFilter<${t.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,i,"=>",g),i=g,o=ml(i),l.triggerRemap()}),d=zn(s,()=>{ks(`rollingFilter<${Pe(()=>t.name)}>${r.name?` '${r.name}'`:""} unobserve`,i),c(),d()});return l},{equals:Cr,argsDebugName:(e,t,n)=>Je({caller:"rollingFilter",thread:e,pattern:t,args:n})}),Qf=Qe("rollingMapper",function(t,n,r={}){let i=Pe(()=>n.call(null,{init:t.applogs},t));if(!un(i))throw gO("Initial run must return init event");let o=i.init;return new Sa(`${t.name} | ${r.name||"rollingMapper"}`,t,[...t.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,n)},{equals:Cr,argsDebugName:(e,t,n)=>Je({caller:"rollingMapper",thread:e,args:n})}),VS=Qe("rollingAcc",function(t,n,r,i={}){let o=at(r);return o({init:t.applogs},n),t.subscribe(s=>{o(s,n)}),n},{argsDebugName:(e,t,n,r)=>`rollingAcc{${e.nameAndSizeUntracked}${r?.name?` | ${r?.name}`:""}}`}),mO=function(t){let n=Pe(function(){return Object.fromEntries(Object.entries(on(t)).map(([i,o])=>[on(i),on(o)]))});if(!Object.entries(n).length)throw new Error("Pattern is empty");return n};function ml(e){return function(n){return n.filter(function(i){for(let o of Object.keys(e)){let s=e[o];if(s===void 0)continue;let a=i[o.startsWith("!")?o.slice(1):o];if(!uO(o,s,a))return!1}return!0})}}var{WARN:vO,LOG:bO,DEBUG:Ve,VERBOSE:_O,ERROR:ro}=$e.setup($e.INFO),wO=class extends Er{constructor(e,t=[],n){super(e,null,n,t),bn(this,{})}purge(e){let t=this.applogs.length;return this._applogs=this.applogs.filter(n=>!e.includes(n.cid)),t-this.applogs.length}insert(e){Ve(`[WriteableThread.insert] ENTER - ${e.length} applogs for thread "${this.name}"`),Ve("[WriteableThread.insert] About to call ensureTsPvAndFinalizeApplogs");let t=lO(e,this);Ve(`[WriteableThread.insert] ensureTsPvAndFinalizeApplogs completed, mapped=${t.length} applogs`),Ve("[WriteableThread.insert] About to call insertRaw");let n=this.insertRaw(t);return Ve("[WriteableThread.insert] insertRaw completed"),n}insertRaw(e){Ve(`[WriteableThread.insertRaw] ENTER - ${e.length} applogs for thread "${this.name}"`),Ve("[WriteableThread.insertRaw] About to deduplicate");let t=Wf(e);if(t.length!==e.length)throw ro(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});Ve("[WriteableThread.insertRaw] Deduplication done"),Ve("[WriteableThread.insertRaw] About to validate");let n=e.filter(o=>!Ff(o));if(n.length)throw ro(`[insertRaw] bogus applogs passed: ${n.length}`,{bogus:n});Ve("[WriteableThread.insertRaw] Validation done"),Ve("[WriteableThread.insertRaw] About to check for existing");let r=e.filter(o=>this.hasApplog(o,!1));if(r.length)throw ro(`[insertRaw] already existing applogs passed: ${r.length}`,{existing:r});if(Ve("[WriteableThread.insertRaw] Existing check done"),!e.length){vO("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof $a)?bO:Ve)("Inserting:",e.length===1?e[0]:e,{ds:this}),Ve("[WriteableThread.insertRaw] About to sort applogs"),pi(e);let i=this._applogs.length&&oO(e[0],this._applogs[this._applogs.length-1]);return Ve("[WriteableThread.insertRaw] About to push to _applogs array"),this._applogs.push(...e),i&&(Ve("[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)"),pi(this._applogs)),Ve("[WriteableThread.insertRaw] About to notify subscribers"),this.notifySubscribers({added:e,removed:null}),Ve("[WriteableThread.insertRaw] Subscribers notified"),Ve("[WriteableThread.insertRaw] About to call persist (void - not awaited)"),this.persist(e),Ve(`[WriteableThread.insertRaw] EXIT - returning ${e.length} applogs`),e}get readOnly(){return!1}},$a=class io extends wO{constructor(t,n,r,i){super(t,n,r),this._readOnly=i,bn(this,{_applogs:Ce.shallow})}static empty(t){return io.fromArray([],t??"empty in-memory",!1)}static fromArray(t,n,r=!1){return new io(n??"in-memory",t,[],r)}static fromReadOnlyArray(t,n){return new io(n??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(_O("[InMem.persist] no persist for",t),this.readOnly)throw ro("[persist] called for readOnly thread")}},{WARN:KS,LOG:qS,DEBUG:GS,VERBOSE:WS,ERROR:HS}=$e.setup($e.INFO);var{WARN:C$,LOG:x$,DEBUG:U$,VERBOSE:M$,ERROR:B$}=$e.setup($e.INFO);function Na(e){return Jf(e,31,7)}var AO=class{constructor(e,t,n=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=n,bn(this,{threadOfTrail:De})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?Do([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Zf=class{constructor(e){this.nodes=e,bn(this,{threadOfAllTrails:De,size:De,isEmpty:De})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Pe(()=>this.records.length)}get records(){return Yt(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return Do(Yt(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return Yt(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return Yt(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return Do(Yt(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:F$,LOG:Lo,DEBUG:cn,VERBOSE:Te,ERROR:nr}=$e.setup($e.INFO,{prefix:"[q]"}),Ra=null,OO=Qe("lastWriteWins",function(t,{inverseToOnlyReturnFirstLogs:n,tolerateAlreadyFiltered:r}={}){if(Te(`lastWriteWins${n?".inversed":""} < ${t.nameAndSizeUntracked} > initializing`),t.filters.includes("lastWriteWins")){if(r)return cn("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),t;throw nr("thread already filtered lastWriteWins:",t.filters,{name:t.name})}let i,o=Qf(t,function(a,l){let c=un(a),d,g=[],C=c?null:[];c?(i=new Map,d=a.init):d=a.added;let I;for(let S=n?0:d.length-1;n?S<d.length:S>=0;n?S++:S--){let z=d[S],J=z.en+"|"+z.at;if(I&&(n?I>z.ts:I<z.ts))throw nr("lastWriteWins.mapper logs not sorted:",I,n?">":"<",z.ts,{log:z,i:S,newLogs:d,inverseToOnlyReturnFirstLogs:n});I=z.ts;let F=i.get(J);(!F||(n?F.ts>z.ts:F.ts<z.ts))&&(F&&!c&&C.push(F),g.push(z),i.set(J,z))}return pi(g),Te.isDisabled||Te(`lastWriteWins${n?".inversed":""}<${t.nameAndSizeUntracked}> mapped event`,c?{...Object.fromEntries(Object.entries(a).map(([S,z])=>[S,z?.length])),toAdd:g.length,toRemove:C}:{...a,toAdd:g,toRemove:C}),c?{init:g}:{added:g,removed:C}},{name:`lastWriteWins${n?".inversed":""}`,extraFilterName:"lastWriteWins"});return Te.isDisabled||It(()=>{Te(`lastWriteWins<${t.nameAndSizeUntracked}> filtered down to`,o.applogs.length)}),o},{equals:Cr,argsDebugName:e=>Je({caller:"lastWriteWins",thread:e})}),z$=Qe("withoutDeleted",function(t){if(Te.isEnabled&&Te(`withoutDeleted<${t.nameAndSizeUntracked}>`),t.filters.includes("withoutDeleted"))throw nr("thread already filtered withoutDeleted:",t.filters,{name:t.name});let n=In(t,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Te.isEnabled&&Te(`withoutDeleted<${t.nameAndSizeUntracked}> deletionLogs:`,Pe(function(){return[...n.applogs]}));let r=Je({caller:"allDeletedEntities",thread:t}),i=ff(function(){return n.map(s=>s.en)},{name:r});return Te.isEnabled&&It(()=>{Te(`withoutDeleted<${t.nameAndSizeUntracked}> deleted:`,[...i])}),In(t,{"!en":i},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:Cr}),ed=Qe("query",function e(t,n,r={},i={}){CO();let o=td(t);cn(`query<${o.nameAndSizeUntracked}>:`,n);let s=Array.isArray(n)?n:[n],a;if(s.length===1)a=null;else{let d=s.slice(0,-1);a=e(o,d,r,i)}let l=s[s.length-1],c=EO(o,a,l,i);return Te.isDisabled||It(()=>Te("query result:",on(c))),c},{equals:Ro,argsDebugName:(e,t,n)=>Je({caller:"query",thread:e,args:n?{pattern:t,startVars:n}:t})}),EO=Qe("queryStep",function(t,n,r,i={}){if(cn(`queryStep<${t.nameAndSizeUntracked}> with`,n?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");function o(a){let[l,c]=Ia(r,a?.variables??{});Te("[queryStep.doQuery] patternWithoutVars: ",l);let d=In(t,l),g=ko(c),C=Yt(function(){let S=d.map(z=>({log:z,vars:g(z)}));return Te.isEnabled&&Te("[queryStep.doQuery] step node:",a?.variables," =>",S,"from:",Pe(()=>d.applogs)),S.map(({log:z,vars:J})=>{let F=Object.assign({},a?.variables,J);return new AO(pf.fromArray([z],Je({caller:"QueryNode",thread:d,pattern:`${Hn(F)}@${Hn(l)}`})),F,a)})},{name:Je({caller:"doQuery.mapNodes",thread:d,pattern:r})});return Te.isEnabled&&It(()=>Te("[queryStep.doQuery] resultNodes:",[...C])),i.debug&&Lo("[queryStep] step result:",Pe(()=>C.map(({variables:I,logsOfThisNode:S})=>({variables:I,thread:S})))),C}let s=Yt(function(){return cn(`[queryStep] Running with ${n?.nodes?.length} input nodes:`),n?[...n.nodes.flatMap(o)]:[...o(null)]},{name:Je({caller:"queryStep",thread:t,pattern:r})});return Te.isEnabled&&It(()=>Te("[queryStep] observableResultNodes:",[...s])),new Zf(s)},{equals:Ro,argsDebugName:(e,t,n)=>Je({caller:"queryStep",thread:e,pattern:n})}),V$=Qe("queryNot",function(t,n,r,i={}){let o=n.nodes;cn(`queryNot<${t.nameAndSizeUntracked}> from: ${o.length} nodes`);let s=Array.isArray(r)?r:[r];for(let a of s){if(!Object.entries(r).length)throw new Error("Pattern is empty");o=o.filter(function({variables:c}){let[d,g]=Ia(a,c??{});Te("[queryNot] patternWithoutVars: ",d);let C=In(t,d);return Te("[queryNot] step node:",c," =>",C.size,"applogs"),Te.isDisabled||Te("[queryNot] step node:",c," => empty?",Pe(()=>C.applogs)),i.debug&&Lo("[queryNot] node result:",c,"=>",C.applogs),C.isEmpty})}return new Zf(o)},{equals:Ro,argsDebugName:(e,t,n)=>Je({caller:"queryNot",thread:e,pattern:n})}),K$=Qe("filterAndMap",function(t,n,r){cn(`filterAndMap<${t.nameAndSizeUntracked}>`,n);let i=In(t,n);Te.isEnabled&&(Te("[filterAndMap] filtered:",i.untrackedSize),It(()=>Te("[filterAndMap] filtered:",i.applogs)));let o=Je({thread:t,pattern:n,caller:"filterAndMap"}),s=Yt(()=>$O(i,r),{name:o});return Te.isDisabled||It(()=>Te("[filterAndMap] mapped:",s)),s},{equals:ze.structural,argsDebugName:(e,t)=>Je({caller:"filterAndMap",thread:e,pattern:t})}),q$=Qe("queryAndMap",function(t,n,r,i={}){let o=td(t);cn(`queryAndMap<${o.nameAndSizeUntracked}>`,{patternOrPatterns:n,variables:i,map:r});let s=Je({thread:o,caller:"queryAndMap"}),a=ed(o,n);Te("[queryAndMap] filtered count:",a.untrackedSize);let l=Yt(()=>NO(a,r),{name:s});return Te.isDisabled||It(()=>Te("[queryAndMap] result:",on(l))),l},{equals:ze.structural,argsDebugName:(e,t)=>Je({caller:"queryAndMap",thread:e,pattern:t})}),G$=Qe("queryEntity",function(t,n,r,i){cn(`queryEntity<${t.nameAndSizeUntracked}>`,r,n);let o=In(t,{en:r,at:RO(n,i)});return Te("queryEntity applogs:",o.applogs),De(()=>o.isEmpty?null:Object.fromEntries(o.map(({at:s,vl:a})=>[s.slice(n.length+1),a])))},{equals:lf,argsDebugName:(e,t,n)=>Je({caller:"queryEntity",thread:e,args:{name:t,entityID:n}})}),W$=Qe("agentsOfThread",function(t){cn(`agentsOfThread<${t.nameAndSizeUntracked}>`);let n=Ce.map(),r=at(o=>{for(let s of un(o)?o.init:o.added){let a=n.get(s.ag)??0;n.set(s.ag,a+1)}for(let s of!un(o)&&o.removed||[]){let a=n.get(s.ag);if(!a||a<1)throw nr("[agentsOfThread] number is now negative",{log:s,event:o,mapped:n,prev:a});n.set(s.ag,a-1)}Lo(`agentsOfThread<${t.nameAndSizeUntracked}> processed event`,{event:o,mapped:n})});r({init:t.applogs});let i=t.subscribe(r);return br(n,i),n}),IO=Qe("entityOverlap",function(t,n){return Lo(`entityOverlap<${t.nameAndSizeUntracked}, ${n.nameAndSizeUntracked}>`),De(()=>{let r=new Set(t.map(o=>o.en)),i=new Set(n.map(o=>o.en));return[...r].filter(o=>i.has(o))})});var H$=Qe("entityOverlapCount",function(t,n){return De(()=>IO(t,n).get().length)}),SO=Qe("querySingle",function(t,n,r={}){let i=ed(t,n,r);return De(()=>{if(i.isEmpty)return null;if(i.size>1)throw nr("[querySingle] got",i.size,"results:",i);let o=i.nodes[0].logsOfThisNode;if(o.size!=1)throw nr("[querySingle] single result, but got",o.size,"logs:",o.applogs);return o.applogs[0]})},{equals:ze.structural,argsDebugName:(e,t)=>Je({caller:"querySingle",thread:e,pattern:t})}),J$=Qe("querySingleAndMap",function(t,n,r,i={}){let o=SO(t,n,i);return De(()=>{let s=o.get();if(s)return typeof r=="string"?s[r]:ko(r)(s)})},{equals:ze.structural,argsDebugName:(e,t)=>Je({caller:"querySingleAndMap",thread:e,pattern:t})}),$O=function(t,n){return typeof n=="function"?t.map(n):typeof n=="string"?t.map(r=>r[n]):t.map(ko(n))},NO=function(t,n){return typeof n=="function"?t.records.map(n):typeof n=="string"?t.nodes.map(r=>{if(!Object.hasOwn(r.record,n)){if(r.logsOfThisNode.size!==1)throw nr(`not sure what to map (it's not a var and a result node log count of ${r.logsOfThisNode.size})`);return r.logsOfThisNode.firstLog[n]}return r.record[n]}):t.nodes.map(r=>ko(n)(t))};function ko(e){return t=>Object.entries(e).reduce((n,[r,i])=>(n[i]=t[r],n),{})}function RO(e,t){return t.map(n=>PO(e,n))}function PO(e,t){return`${e}/${t}`}function td(e,t){return Array.isArray(e)?$a.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function CO(){if(Ra!=null&&performance.now()>=Ra)throw new xO(Ra)}var xO=class extends Error{constructor(e){super(e)}};var UO=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(e,t){"use strict";t.exports=s;var n=128,r=127,i=~r,o=Math.pow(2,31);function s(a,l,c){if(Number.MAX_SAFE_INTEGER&&a>Number.MAX_SAFE_INTEGER)throw s.bytes=0,new RangeError("Could not encode varint");l=l||[],c=c||0;for(var d=c;a>=o;)l[c++]=a&255|n,a/=128;for(;a&i;)l[c++]=a&255|n,a>>>=7;return l[c]=a|0,s.bytes=c-d+1,l}}}),MO=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(e,t){"use strict";t.exports=i;var n=128,r=127;function i(o,l){var a=0,l=l||0,c=0,d=l,g,C=o.length;do{if(d>=C||c>49)throw i.bytes=0,new RangeError("Could not decode varint");g=o[d++],a+=c<28?(g&r)<<c:(g&r)*Math.pow(2,c),c+=7}while(g>=n);return i.bytes=d-l,a}}}),BO=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(e,t){"use strict";var n=Math.pow(2,7),r=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),s=Math.pow(2,35),a=Math.pow(2,42),l=Math.pow(2,49),c=Math.pow(2,56),d=Math.pow(2,63);t.exports=function(g){return g<n?1:g<r?2:g<i?3:g<o?4:g<s?5:g<a?6:g<l?7:g<c?8:g<d?9:10}}}),Ba=Le({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:UO(),decode:MO(),encodingLength:BO()}}}),DO=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function LO(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(t==="string"||t==="number"||t==="bigint"||t==="symbol")return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(e instanceof Uint8Array)return"Uint8Array";if(e.constructor===Object)return"Object";let n=kO(e);return n||"Object"}function kO(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(DO.includes(t))return t}var V=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};V.uint=new V(0,"uint",!0);V.negint=new V(1,"negint",!0);V.bytes=new V(2,"bytes",!0);V.string=new V(3,"string",!0);V.array=new V(4,"array",!1);V.map=new V(5,"map",!1);V.tag=new V(6,"tag",!1);V.float=new V(7,"float",!0);V.false=new V(7,"false",!0);V.true=new V(7,"true",!0);V.null=new V(7,"null",!0);V.undefined=new V(7,"undefined",!0);V.break=new V(7,"break",!0);var pe=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},wi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",jO=new TextEncoder;function zo(e){return wi&&globalThis.Buffer.isBuffer(e)}function dd(e){return e instanceof Uint8Array?zo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var FO=24,zO=200,VO=wi?e=>e.length>=FO?globalThis.Buffer.from(e):nd(e):e=>e.length>=zO?jO.encode(e):nd(e),ln=e=>Uint8Array.from(e),KO=wi?(e,t,n)=>zo(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n),qO=wi?(e,t)=>(e=e.map(n=>n instanceof Uint8Array?n:globalThis.Buffer.from(n)),dd(globalThis.Buffer.concat(e,t))):(e,t)=>{let n=new Uint8Array(t),r=0;for(let i of e)r+i.length>n.length&&(i=i.subarray(0,n.length-r)),n.set(i,r),r+=i.length;return n},GO=wi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function pd(e,t){if(zo(e)&&zo(t))return e.compare(t);for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return 0}function nd(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)===55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}var WO=256,hd=class{constructor(e=WO){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let r=t.length-(this.maxCursor-this.cursor)-1;t.set(e,r)}else{if(t){let r=t.length-(this.maxCursor-this.cursor)-1;r<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,r),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=GO(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=KO(n,0,this.cursor)}else t=qO(this.chunks,this.cursor);return e&&this.reset(),t}},HO=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},Be="CBOR decode error:",yd="CBOR encode error:",Ti=[];Ti[23]=1;Ti[24]=2;Ti[25]=3;Ti[26]=5;Ti[27]=9;function Dr(e,t,n){if(e.length-t<n)throw new Error(`${Be} not enough data for type`)}var Ze=[24,256,65536,4294967296,BigInt("18446744073709551616")];function rr(e,t,n){Dr(e,t,1);let r=e[t];if(n.strict===!0&&r<Ze[0])throw new Error(`${Be} integer encoded in more bytes than necessary (strict decode)`);return r}function ir(e,t,n){Dr(e,t,2);let r=e[t]<<8|e[t+1];if(n.strict===!0&&r<Ze[1])throw new Error(`${Be} integer encoded in more bytes than necessary (strict decode)`);return r}function or(e,t,n){Dr(e,t,4);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(n.strict===!0&&r<Ze[2])throw new Error(`${Be} integer encoded in more bytes than necessary (strict decode)`);return r}function sr(e,t,n){Dr(e,t,8);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(r)<<BigInt(32))+BigInt(i);if(n.strict===!0&&o<Ze[3])throw new Error(`${Be} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(n.allowBigInt===!0)return o;throw new Error(`${Be} integers outside of the safe integer range are not supported`)}function JO(e,t,n,r){return new pe(V.uint,rr(e,t+1,r),2)}function XO(e,t,n,r){return new pe(V.uint,ir(e,t+1,r),3)}function YO(e,t,n,r){return new pe(V.uint,or(e,t+1,r),5)}function QO(e,t,n,r){return new pe(V.uint,sr(e,t+1,r),9)}function ar(e,t){return Ct(e,0,t.value)}function Ct(e,t,n){if(n<Ze[0]){let r=Number(n);e.push([t|r])}else if(n<Ze[1]){let r=Number(n);e.push([t|24,r])}else if(n<Ze[2]){let r=Number(n);e.push([t|25,r>>>8,r&255])}else if(n<Ze[3]){let r=Number(n);e.push([t|26,r>>>24&255,r>>>16&255,r>>>8&255,r&255])}else{let r=BigInt(n);if(r<Ze[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(r&BigInt(4294967295)),s=Number(r>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=s&255,s=s>>8,i[3]=s&255,s=s>>8,i[2]=s&255,s=s>>8,i[1]=s&255,e.push(i)}else throw new Error(`${Be} encountered BigInt larger than allowable range`)}}ar.encodedSize=function(t){return Ct.encodedSize(t.value)};Ct.encodedSize=function(t){return t<Ze[0]?1:t<Ze[1]?2:t<Ze[2]?3:t<Ze[3]?5:9};ar.compareTokens=function(t,n){return t.value<n.value?-1:t.value>n.value?1:0};function ZO(e,t,n,r){return new pe(V.negint,-1-rr(e,t+1,r),2)}function eE(e,t,n,r){return new pe(V.negint,-1-ir(e,t+1,r),3)}function tE(e,t,n,r){return new pe(V.negint,-1-or(e,t+1,r),5)}var Da=BigInt(-1),gd=BigInt(1);function nE(e,t,n,r){let i=sr(e,t+1,r);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new pe(V.negint,o,9)}if(r.allowBigInt!==!0)throw new Error(`${Be} integers outside of the safe integer range are not supported`);return new pe(V.negint,Da-BigInt(i),9)}function La(e,t){let n=t.value,r=typeof n=="bigint"?n*Da-gd:n*-1-1;Ct(e,t.type.majorEncoded,r)}La.encodedSize=function(t){let n=t.value,r=typeof n=="bigint"?n*Da-gd:n*-1-1;return r<Ze[0]?1:r<Ze[1]?2:r<Ze[2]?3:r<Ze[3]?5:9};La.compareTokens=function(t,n){return t.value<n.value?1:t.value>n.value?-1:0};function Ai(e,t,n,r){Dr(e,t,n+r);let i=e.slice(t+n,t+n+r);return new pe(V.bytes,i,n+r)}function rE(e,t,n,r){return Ai(e,t,1,n)}function iE(e,t,n,r){return Ai(e,t,2,rr(e,t+1,r))}function oE(e,t,n,r){return Ai(e,t,3,ir(e,t+1,r))}function sE(e,t,n,r){return Ai(e,t,5,or(e,t+1,r))}function aE(e,t,n,r){let i=sr(e,t+1,r);if(typeof i=="bigint")throw new Error(`${Be} 64-bit integer bytes lengths not supported`);return Ai(e,t,9,i)}function Vo(e){return e.encodedBytes===void 0&&(e.encodedBytes=V.equals(e.type,V.string)?VO(e.value):e.value),e.encodedBytes}function Wo(e,t){let n=Vo(t);Ct(e,t.type.majorEncoded,n.length),e.push(n)}Wo.encodedSize=function(t){let n=Vo(t);return Ct.encodedSize(n.length)+n.length};Wo.compareTokens=function(t,n){return uE(Vo(t),Vo(n))};function uE(e,t){return e.length<t.length?-1:e.length>t.length?1:pd(e,t)}var rd=new TextDecoder,cE=32;function lE(e,t,n){if(n-t<cE){let i="";for(let o=t;o<n;o++){let s=e[o];if(s&128)return rd.decode(e.subarray(t,n));i+=String.fromCharCode(s)}return i}return rd.decode(e.subarray(t,n))}function Oi(e,t,n,r,i){let o=n+r;Dr(e,t,o);let s=new pe(V.string,lE(e,t+n,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=e.slice(t+n,t+o)),s}function fE(e,t,n,r){return Oi(e,t,1,n,r)}function dE(e,t,n,r){return Oi(e,t,2,rr(e,t+1,r),r)}function pE(e,t,n,r){return Oi(e,t,3,ir(e,t+1,r),r)}function hE(e,t,n,r){return Oi(e,t,5,or(e,t+1,r),r)}function yE(e,t,n,r){let i=sr(e,t+1,r);if(typeof i=="bigint")throw new Error(`${Be} 64-bit integer string lengths not supported`);return Oi(e,t,9,i,r)}var gE=Wo;function Lr(e,t,n,r){return new pe(V.array,r,n)}function mE(e,t,n,r){return Lr(e,t,1,n)}function vE(e,t,n,r){return Lr(e,t,2,rr(e,t+1,r))}function bE(e,t,n,r){return Lr(e,t,3,ir(e,t+1,r))}function _E(e,t,n,r){return Lr(e,t,5,or(e,t+1,r))}function wE(e,t,n,r){let i=sr(e,t+1,r);if(typeof i=="bigint")throw new Error(`${Be} 64-bit integer array lengths not supported`);return Lr(e,t,9,i)}function TE(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${Be} indefinite length items not allowed`);return Lr(e,t,1,1/0)}function ka(e,t){Ct(e,V.array.majorEncoded,t.value)}ka.compareTokens=ar.compareTokens;ka.encodedSize=function(t){return Ct.encodedSize(t.value)};function kr(e,t,n,r){return new pe(V.map,r,n)}function AE(e,t,n,r){return kr(e,t,1,n)}function OE(e,t,n,r){return kr(e,t,2,rr(e,t+1,r))}function EE(e,t,n,r){return kr(e,t,3,ir(e,t+1,r))}function IE(e,t,n,r){return kr(e,t,5,or(e,t+1,r))}function SE(e,t,n,r){let i=sr(e,t+1,r);if(typeof i=="bigint")throw new Error(`${Be} 64-bit integer map lengths not supported`);return kr(e,t,9,i)}function $E(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${Be} indefinite length items not allowed`);return kr(e,t,1,1/0)}function ja(e,t){Ct(e,V.map.majorEncoded,t.value)}ja.compareTokens=ar.compareTokens;ja.encodedSize=function(t){return Ct.encodedSize(t.value)};function NE(e,t,n,r){return new pe(V.tag,n,1)}function RE(e,t,n,r){return new pe(V.tag,rr(e,t+1,r),2)}function PE(e,t,n,r){return new pe(V.tag,ir(e,t+1,r),3)}function CE(e,t,n,r){return new pe(V.tag,or(e,t+1,r),5)}function xE(e,t,n,r){return new pe(V.tag,sr(e,t+1,r),9)}function Fa(e,t){Ct(e,V.tag.majorEncoded,t.value)}Fa.compareTokens=ar.compareTokens;Fa.encodedSize=function(t){return Ct.encodedSize(t.value)};var md=20,vd=21,bd=22,_d=23;function UE(e,t,n,r){if(r.allowUndefined===!1)throw new Error(`${Be} undefined values are not supported`);return r.coerceUndefinedToNull===!0?new pe(V.null,null,1):new pe(V.undefined,void 0,1)}function ME(e,t,n,r){if(r.allowIndefinite===!1)throw new Error(`${Be} indefinite length items not allowed`);return new pe(V.break,void 0,1)}function za(e,t,n){if(n){if(n.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Be} NaN values are not supported`);if(n.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Be} Infinity values are not supported`)}return new pe(V.float,e,t)}function BE(e,t,n,r){return za(Ka(e,t+1),3,r)}function DE(e,t,n,r){return za(qa(e,t+1),5,r)}function LE(e,t,n,r){return za(Od(e,t+1),9,r)}function Va(e,t,n){let r=t.value;if(r===!1)e.push([V.float.majorEncoded|md]);else if(r===!0)e.push([V.float.majorEncoded|vd]);else if(r===null)e.push([V.float.majorEncoded|bd]);else if(r===void 0)e.push([V.float.majorEncoded|_d]);else{let i,o=!1;(!n||n.float64!==!0)&&(Td(r),i=Ka(Kt,1),r===i||Number.isNaN(r)?(Kt[0]=249,e.push(Kt.slice(0,3)),o=!0):(Ad(r),i=qa(Kt,1),r===i&&(Kt[0]=250,e.push(Kt.slice(0,5)),o=!0))),o||(kE(r),i=Od(Kt,1),Kt[0]=251,e.push(Kt.slice(0,9)))}}Va.encodedSize=function(t,n){let r=t.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!n||n.float64!==!0){Td(r);let i=Ka(Kt,1);if(r===i||Number.isNaN(r))return 3;if(Ad(r),i=qa(Kt,1),r===i)return 5}return 9};var wd=new ArrayBuffer(9),Pt=new DataView(wd,1),Kt=new Uint8Array(wd,0);function Td(e){if(e===1/0)Pt.setUint16(0,31744,!1);else if(e===-1/0)Pt.setUint16(0,64512,!1);else if(Number.isNaN(e))Pt.setUint16(0,32256,!1);else{Pt.setFloat32(0,e);let t=Pt.getUint32(0),n=(t&2139095040)>>23,r=t&8388607;if(n===255)Pt.setUint16(0,31744,!1);else if(n===0)Pt.setUint16(0,(e&2147483648)>>16|r>>13,!1);else{let i=n-127;i<-24?Pt.setUint16(0,0):i<-14?Pt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Pt.setUint16(0,(t&2147483648)>>16|i+15<<10|r>>13,!1)}}}function Ka(e,t){if(e.length-t<2)throw new Error(`${Be} not enough data for float16`);let n=(e[t]<<8)+e[t+1];if(n===31744)return 1/0;if(n===64512)return-1/0;if(n===32256)return NaN;let r=n>>10&31,i=n&1023,o;return r===0?o=i*2**-24:r!==31?o=(i+1024)*2**(r-25):o=i===0?1/0:NaN,n&32768?-o:o}function Ad(e){Pt.setFloat32(0,e,!1)}function qa(e,t){if(e.length-t<4)throw new Error(`${Be} not enough data for float32`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,4).getFloat32(0,!1)}function kE(e){Pt.setFloat64(0,e,!1)}function Od(e,t){if(e.length-t<8)throw new Error(`${Be} not enough data for float64`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,8).getFloat64(0,!1)}Va.compareTokens=ar.compareTokens;function Ie(e,t,n){throw new Error(`${Be} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function Ho(e){return()=>{throw new Error(`${Be} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=Ie;ue[24]=JO;ue[25]=XO;ue[26]=YO;ue[27]=QO;ue[28]=Ie;ue[29]=Ie;ue[30]=Ie;ue[31]=Ie;for(let e=32;e<=55;e++)ue[e]=Ie;ue[56]=ZO;ue[57]=eE;ue[58]=tE;ue[59]=nE;ue[60]=Ie;ue[61]=Ie;ue[62]=Ie;ue[63]=Ie;for(let e=64;e<=87;e++)ue[e]=rE;ue[88]=iE;ue[89]=oE;ue[90]=sE;ue[91]=aE;ue[92]=Ie;ue[93]=Ie;ue[94]=Ie;ue[95]=Ho("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ue[e]=fE;ue[120]=dE;ue[121]=pE;ue[122]=hE;ue[123]=yE;ue[124]=Ie;ue[125]=Ie;ue[126]=Ie;ue[127]=Ho("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ue[e]=mE;ue[152]=vE;ue[153]=bE;ue[154]=_E;ue[155]=wE;ue[156]=Ie;ue[157]=Ie;ue[158]=Ie;ue[159]=TE;for(let e=160;e<=183;e++)ue[e]=AE;ue[184]=OE;ue[185]=EE;ue[186]=IE;ue[187]=SE;ue[188]=Ie;ue[189]=Ie;ue[190]=Ie;ue[191]=$E;for(let e=192;e<=215;e++)ue[e]=NE;ue[216]=RE;ue[217]=PE;ue[218]=CE;ue[219]=xE;ue[220]=Ie;ue[221]=Ie;ue[222]=Ie;ue[223]=Ie;for(let e=224;e<=243;e++)ue[e]=Ho("simple values are not supported");ue[244]=Ie;ue[245]=Ie;ue[246]=Ie;ue[247]=UE;ue[248]=Ho("simple values are not supported");ue[249]=BE;ue[250]=DE;ue[251]=LE;ue[252]=Ie;ue[253]=Ie;ue[254]=Ie;ue[255]=ME;var fn=[];for(let e=0;e<24;e++)fn[e]=new pe(V.uint,e,1);for(let e=-1;e>=-24;e--)fn[31-e]=new pe(V.negint,e,1);fn[64]=new pe(V.bytes,new Uint8Array(0),1);fn[96]=new pe(V.string,"",1);fn[128]=new pe(V.array,0,1);fn[160]=new pe(V.map,0,1);fn[244]=new pe(V.false,!1,1);fn[245]=new pe(V.true,!0,1);fn[246]=new pe(V.null,null,1);function jE(e){switch(e.type){case V.false:return ln([244]);case V.true:return ln([245]);case V.null:return ln([246]);case V.bytes:return e.value.length?void 0:ln([64]);case V.string:return e.value===""?ln([96]):void 0;case V.array:return e.value===0?ln([128]):void 0;case V.map:return e.value===0?ln([160]):void 0;case V.uint:return e.value<24?ln([Number(e.value)]):void 0;case V.negint:if(e.value>=-24)return ln([31-Number(e.value)])}}var FE=Object.freeze({float64:!0,mapSorter:qE,quickEncodeToken:jE});function Ed(){let e=[];return e[V.uint.major]=ar,e[V.negint.major]=La,e[V.bytes.major]=Wo,e[V.string.major]=gE,e[V.array.major]=ka,e[V.map.major]=ja,e[V.tag.major]=Fa,e[V.float.major]=Va,e}var zE=Ed(),VE=new hd,id=class Id{constructor(t,n){this.obj=t,this.parent=n}includes(t){let n=this;do if(n.obj===t)return!0;while(n=n.parent);return!1}static createCheck(t,n){if(t&&t.includes(n))throw new Error(`${yd} object contains circular references`);return new Id(n,t)}},Sn={null:new pe(V.null,null),undefined:new pe(V.undefined,void 0),true:new pe(V.true,!0),false:new pe(V.false,!1),emptyArray:new pe(V.array,0),emptyMap:new pe(V.map,0)},Rn={number(e,t,n,r){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new pe(V.float,e):e>=0?new pe(V.uint,e):new pe(V.negint,e)},bigint(e,t,n,r){return e>=BigInt(0)?new pe(V.uint,e):new pe(V.negint,e)},Uint8Array(e,t,n,r){return new pe(V.bytes,e)},string(e,t,n,r){return new pe(V.string,e)},boolean(e,t,n,r){return e?Sn.true:Sn.false},null(e,t,n,r){return Sn.null},undefined(e,t,n,r){return Sn.undefined},ArrayBuffer(e,t,n,r){return new pe(V.bytes,new Uint8Array(e))},DataView(e,t,n,r){return new pe(V.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,n,r){if(!e.length)return n.addBreakTokens===!0?[Sn.emptyArray,new pe(V.break)]:Sn.emptyArray;r=id.createCheck(r,e);let i=[],o=0;for(let s of e)i[o++]=jo(s,n,r);return n.addBreakTokens?[new pe(V.array,e.length),i,new pe(V.break)]:[new pe(V.array,e.length),i]},Object(e,t,n,r){let i=t!=="Object",o=i?e.keys():Object.keys(e),s=i?e.size:o.length,a;if(s){a=new Array(s),r=id.createCheck(r,e);let l=!i&&n.ignoreUndefinedProperties,c=0;for(let d of o){let g=i?e.get(d):e[d];l&&g===void 0||(a[c++]=[jo(d,n,r),jo(g,n,r)])}c<s&&(a.length=c)}return a?.length?(KE(a,n),n.addBreakTokens?[new pe(V.map,a.length),a,new pe(V.break)]:[new pe(V.map,a.length),a]):n.addBreakTokens===!0?[Sn.emptyMap,new pe(V.break)]:Sn.emptyMap}};Rn.Map=Rn.Object;Rn.Buffer=Rn.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Rn[`${e}Array`]=Rn.DataView;function jo(e,t={},n){let r=LO(e),i=t&&t.typeEncoders&&t.typeEncoders[r]||Rn[r];if(typeof i=="function"){let s=i(e,r,t,n);if(s!=null)return s}let o=Rn[r];if(!o)throw new Error(`${yd} unsupported type: ${r}`);return o(e,r,t,n)}function KE(e,t){t.mapSorter&&e.sort(t.mapSorter)}function qE(e,t){if(e[0]instanceof pe&&t[0]instanceof pe){let n=e[0],r=t[0];return n._keyBytes||(n._keyBytes=od(n.value)),r._keyBytes||(r._keyBytes=od(r.value)),pd(n._keyBytes,r._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function od(e){return GE(e,zE,FE)}function Sd(e,t,n,r){if(Array.isArray(t))for(let i of t)Sd(e,i,n,r);else n[t.type.major](e,t,r)}var uN=V.uint.majorEncoded,cN=V.negint.majorEncoded,lN=V.bytes.majorEncoded,fN=V.string.majorEncoded,dN=V.array.majorEncoded,pN=V.float.majorEncoded|md,hN=V.float.majorEncoded|vd,yN=V.float.majorEncoded|bd,gN=V.float.majorEncoded|_d,mN=BigInt(-1),vN=BigInt(1);function GE(e,t,n,r){let i=r instanceof Uint8Array,o=i?new HO(r):VE,s=jo(e,n);if(!Array.isArray(s)&&n.quickEncodeToken){let a=n.quickEncodeToken(s);if(a)return i?(o.push(a),o.toBytes()):a;let l=t[s.type.major];if(l.encodedSize){let c=l.encodedSize(s,n);if(i||(o=new hd(c)),l(o,s,n),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${s} was wrong`);return i?o.toBytes():dd(o.chunks[0])}}return o.reset(),Sd(o,s,t,n),o.toBytes(!0)}var bN=Symbol.for("DONE"),_N=Symbol.for("BREAK");var wN=new Uint8Array(0);function WE(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0}function Ga(e){if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")}function HE(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),s=o.charCodeAt(0);if(n[s]!==255)throw new TypeError(o+" is ambiguous");n[s]=i}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function g(S){if(S instanceof Uint8Array||(ArrayBuffer.isView(S)?S=new Uint8Array(S.buffer,S.byteOffset,S.byteLength):Array.isArray(S)&&(S=Uint8Array.from(S))),!(S instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(S.length===0)return"";for(var z=0,J=0,F=0,k=S.length;F!==k&&S[F]===0;)F++,z++;for(var K=(k-F)*d+1>>>0,W=new Uint8Array(K);F!==k;){for(var j=S[F],Z=0,G=K-1;(j!==0||Z<J)&&G!==-1;G--,Z++)j+=256*W[G]>>>0,W[G]=j%a>>>0,j=j/a>>>0;if(j!==0)throw new Error("Non-zero carry");J=Z,F++}for(var fe=K-J;fe!==K&&W[fe]===0;)fe++;for(var x=l.repeat(z);fe<K;++fe)x+=e.charAt(W[fe]);return x}function C(S){if(typeof S!="string")throw new TypeError("Expected String");if(S.length===0)return new Uint8Array;var z=0;if(S[z]!==" "){for(var J=0,F=0;S[z]===l;)J++,z++;for(var k=(S.length-z)*c+1>>>0,K=new Uint8Array(k);S[z];){var W=n[S.charCodeAt(z)];if(W===255)return;for(var j=0,Z=k-1;(W!==0||j<F)&&Z!==-1;Z--,j++)W+=a*K[Z]>>>0,K[Z]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");F=j,z++}if(S[z]!==" "){for(var G=k-F;G!==k&&K[G]===0;)G++;for(var fe=new Uint8Array(J+(k-G)),x=J;G!==k;)fe[x++]=K[G++];return fe}}}function I(S){var z=C(S);if(z)return z;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:C,decode:I}}var JE=HE,XE=JE,YE=XE,QE=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},ZE=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let r=t.codePointAt(0);if(r===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r,this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return $d(this,e)}},eI=class{decoders;constructor(e){this.decoders=e}or(e){return $d(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function $d(e,t){return new eI({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var tI=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new QE(e,t,n),this.decoder=new ZE(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Nd({name:e,prefix:t,encode:n,decode:r}){return new tI(e,t,n,r)}function Jo({name:e,prefix:t,alphabet:n}){let{encode:r,decode:i}=YE(n,e);return Nd({prefix:t,name:e,encode:r,decode:o=>Ga(i(o))})}function nI(e,t,n,r){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*n/8|0),s=0,a=0,l=0;for(let c=0;c<i;++c){let d=t[e[c]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);a=a<<n|d,s+=n,s>=8&&(s-=8,o[l++]=255&a>>s)}if(s>=n||255&a<<8-s)throw new SyntaxError("Unexpected end of data");return o}function rI(e,t,n){let r=t[t.length-1]==="=",i=(1<<n)-1,o="",s=0,a=0;for(let l=0;l<e.length;++l)for(a=a<<8|e[l],s+=8;s>n;)s-=n,o+=t[i&a>>s];if(s!==0&&(o+=t[i&a<<n-s]),r)for(;o.length*n&7;)o+="=";return o}function iI(e){let t={};for(let n=0;n<e.length;++n)t[e[n]]=n;return t}function dn({name:e,prefix:t,bitsPerChar:n,alphabet:r}){let i=iI(r);return Nd({prefix:t,name:e,encode(o){return rI(o,r,n)},decode(o){return nI(o,i,n,e)}})}var Fo=dn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),TN=dn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),AN=dn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ON=dn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),EN=dn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),IN=dn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),SN=dn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$N=dn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),NN=dn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Pa=Jo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),RN=Jo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),$n=Jo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),PN=Jo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),oI=Rd,sd=128,sI=127,aI=~sI,uI=Math.pow(2,31);function Rd(e,t,n){t=t||[],n=n||0;for(var r=n;e>=uI;)t[n++]=e&255|sd,e/=128;for(;e&aI;)t[n++]=e&255|sd,e>>>=7;return t[n]=e|0,Rd.bytes=n-r+1,t}var cI=Ca,lI=128,ad=127;function Ca(e,r){var n=0,r=r||0,i=0,o=r,s,a=e.length;do{if(o>=a)throw Ca.bytes=0,new RangeError("Could not decode varint");s=e[o++],n+=i<28?(s&ad)<<i:(s&ad)*Math.pow(2,i),i+=7}while(s>=lI);return Ca.bytes=o-r,n}var fI=Math.pow(2,7),dI=Math.pow(2,14),pI=Math.pow(2,21),hI=Math.pow(2,28),yI=Math.pow(2,35),gI=Math.pow(2,42),mI=Math.pow(2,49),vI=Math.pow(2,56),bI=Math.pow(2,63),_I=function(e){return e<fI?1:e<dI?2:e<pI?3:e<hI?4:e<yI?5:e<gI?6:e<mI?7:e<vI?8:e<bI?9:10},wI={encode:oI,decode:cI,encodingLength:_I},TI=wI,Ko=TI;function xa(e,t=0){return[Ko.decode(e,t),Ko.decode.bytes]}function qo(e,t,n=0){return Ko.encode(e,t,n),t}function Go(e){return Ko.encodingLength(e)}function AI(e,t){let n=t.byteLength,r=Go(e),i=r+Go(n),o=new Uint8Array(i+n);return qo(e,o,0),qo(n,o,r),o.set(t,i),new Wa(e,n,t,o)}function OI(e){let t=Ga(e),[n,r]=xa(t),[i,o]=xa(t.subarray(r)),s=t.subarray(r+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Wa(n,i,s,t)}function EI(e,t){if(e===t)return!0;{let n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&WE(e.bytes,n.bytes)}}var Wa=class{code;size;digest;bytes;constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}};function ud(e,t){let{bytes:n,version:r}=e;switch(r){case 0:return SI(n,Ua(e),t??$n.encoder);default:return $I(n,Ua(e),t??Fo.encoder)}}var cd=new WeakMap;function Ua(e){let t=cd.get(e);if(t==null){let n=new Map;return cd.set(e,n),n}return t}var Pd=class nt{code;version;multihash;bytes;"/";constructor(t,n,r,i){this.code=n,this.version=t,this.multihash=r,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:n}=this;if(t!==vi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(n.code!==NI)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return nt.createV0(n)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:n}=this.multihash,r=AI(t,n);return nt.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return nt.equals(this,t)}static equals(t,n){let r=n;return r!=null&&t.code===r.code&&t.version===r.version&&EI(t.multihash,r.multihash)}toString(t){return ud(this,t)}toJSON(){return{"/":ud(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let n=t;if(n instanceof nt)return n;if(n["/"]!=null&&n["/"]===n.bytes||n.asCID===n){let{version:r,code:i,multihash:o,bytes:s}=n;return new nt(r,i,o,s??ld(r,i,o.bytes))}else if(n[RI]===!0){let{version:r,multihash:i,code:o}=n,s=OI(i);return nt.create(r,o,s)}else return null}static create(t,n,r){if(typeof n!="number")throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(n!==vi)throw new Error(`Version 0 CID must use dag-pb (code: ${vi}) block encoding`);return new nt(t,n,r,r.bytes)}case 1:{let i=ld(t,n,r.bytes);return new nt(t,n,r,i)}default:throw new Error("Invalid version")}}static createV0(t){return nt.create(0,vi,t)}static createV1(t,n){return nt.create(1,t,n)}static decode(t){let[n,r]=nt.decodeFirst(t);if(r.length!==0)throw new Error("Incorrect length");return n}static decodeFirst(t){let n=nt.inspectBytes(t),r=n.size-n.multihashSize,i=Ga(t.subarray(r,r+n.multihashSize));if(i.byteLength!==n.multihashSize)throw new Error("Incorrect length");let o=i.subarray(n.multihashSize-n.digestSize),s=new Wa(n.multihashCode,n.digestSize,o,i);return[n.version===0?nt.createV0(s):nt.createV1(n.codec,s),t.subarray(n.size)]}static inspectBytes(t){let n=0,r=()=>{let[g,C]=xa(t.subarray(n));return n+=C,g},i=r(),o=vi;if(i===18?(i=0,n=0):o=r(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=n,a=r(),l=r(),c=n+l,d=c-s;return{version:i,codec:o,multihashCode:a,digestSize:l,multihashSize:d,size:c}}static parse(t,n){let[r,i]=II(t,n),o=nt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ua(o).set(r,t),o}};function II(e,t){switch(e[0]){case"Q":{let n=t??$n;return[$n.prefix,n.decode(`${$n.prefix}${e}`)]}case $n.prefix:{let n=t??$n;return[$n.prefix,n.decode(e)]}case Fo.prefix:{let n=t??Fo;return[Fo.prefix,n.decode(e)]}case Pa.prefix:{let n=t??Pa;return[Pa.prefix,n.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function SI(e,t,n){let{prefix:r}=n;if(r!==$n.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);let i=t.get(r);if(i==null){let o=n.encode(e).slice(1);return t.set(r,o),o}else return i}function $I(e,t,n){let{prefix:r}=n,i=t.get(r);if(i==null){let o=n.encode(e);return t.set(r,o),o}else return i}var vi=112,NI=18;function ld(e,t,n){let r=Go(e),i=r+Go(t),o=new Uint8Array(i+n.byteLength);return qo(e,o,0),qo(t,o,r),o.set(n,i),o}var RI=Symbol.for("@ipld/js-cid/CID"),Cd=42;function PI(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Pd.asCID(e);if(!t)return null;let n=new Uint8Array(t.bytes.byteLength+1);return n.set(t.bytes,1),[new pe(V.tag,Cd),new pe(V.bytes,n)]}function CI(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function xI(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}function UI(e){for(let t of e.keys())if(typeof t!="string"||t.length===0)throw new Error("Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded");return null}var fd={float64:!0,typeEncoders:{Map:UI,Object:PI,undefined:CI,number:xI}},CN={...fd,typeEncoders:{...fd.typeEncoders}};function MI(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Pd.decode(e.subarray(1))}var Ma={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Ma.tags[Cd]=MI;var xN={...Ma,tags:Ma.tags.slice()};var UN=St(Ba(),1);var Nn={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},bi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Nn.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Nn.List(e)!==void 0){for(let t=0;t<e.length;t++){let n=e[t];if(n=bi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](n),n===void 0)return;if(n!==e[t]){let r=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=bi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;r.push(o)}return r}}return e}},Int:Nn.Int,CarV1HeaderOrV2Pragma:e=>{if(Nn.Map(e)===void 0)return;let t=Object.entries(e),n=e,r=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=bi["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(a===void 0)return;if(a!==s||n!==e){if(n===e){n={};for(let l=0;l<i;l++)n[t[l][0]]=t[l][1]}n.roots=a}}break;case"version":{r--;let a=bi.Int(e[o]);if(a===void 0)return;if(a!==s||n!==e){if(n===e){n={};for(let l=0;l<i;l++)n[t[l][0]]=t[l][1]}n.version=a}}break;default:return}}if(!(r>0))return n}},_i={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Nn.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Nn.List(e)!==void 0){for(let t=0;t<e.length;t++){let n=e[t];if(n=_i["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](n),n===void 0)return;if(n!==e[t]){let r=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=_i["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;r.push(o)}return r}}return e}},Int:Nn.Int,CarV1HeaderOrV2Pragma:e=>{if(Nn.Map(e)===void 0)return;let t=Object.entries(e),n=e,r=1;for(let i=0;i<t.length;i++){let[o,s]=t[i];switch(o){case"roots":{let a=_i["CarV1HeaderOrV2Pragma > roots (anon)"](s);if(a===void 0)return;if(a!==s||n!==e){if(n===e){n={};for(let l=0;l<i;l++)n[t[l][0]]=t[l][1]}n.roots=a}}break;case"version":{r--;let a=_i.Int(s);if(a===void 0)return;if(a!==s||n!==e){if(n===e){n={};for(let l=0;l<i;l++)n[t[l][0]]=t[l][1]}n.version=a}}break;default:return}}if(!(r>0))return n}},MN={toTyped:bi.CarV1HeaderOrV2Pragma,toRepresentation:_i.CarV1HeaderOrV2Pragma},BN=Ed(),DN=St(Ba(),1),LN=[new pe(V.map,2),new pe(V.string,"version"),new pe(V.uint,1),new pe(V.string,"roots")],kN=new pe(V.tag,42);var jN=St(Ba(),1);var{WARN:FN,LOG:zN,DEBUG:VN,VERBOSE:KN,ERROR:qN}=$e.setup($e.INFO);var{WARN:GN,LOG:WN,DEBUG:HN,VERBOSE:JN,ERROR:XN}=$e.setup($e.INFO);var Ha=class{app;username;devicename;signer},xd=class extends Ha{constructor(t){super(),Object.assign(this,t)}get did(){return this.signer.did}async sign(t){return await this.signer.sign(t)}get ag(){return Na(this.agentString)}get shortDID(){return this.did?.slice(-8)}get agentString(){return`${this.username}.${this.shortDID}@${this.app}.${this.devicename}`}};export{xd as BaseAgent};
|
|
62
62
|
/*! Bundled license information:
|
|
63
63
|
|
|
64
64
|
lodash-es/lodash.js:
|