@wovin/base-agent 0.1.24 → 0.1.26
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 +43 -43
- package/dist/index.min.js.map +1 -1
- package/package.json +2 -2
package/dist/index.min.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var qd=Object.create,is=Object.defineProperty,Gd=Object.getOwnPropertyDescriptor,eu=Object.getOwnPropertyNames,Wd=Object.getPrototypeOf,Hd=Object.prototype.hasOwnProperty,De=(e,t)=>function(){return t||(0,e[eu(e)[0]])((t={exports:{}}).exports,t),t.exports},os=(e,t)=>{for(var n in t)is(e,n,{get:t[n],enumerable:!0})},Jd=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of eu(t))!Hd.call(e,i)&&i!==n&&is(e,i,{get:()=>t[i],enumerable:!(r=Gd(t,i))||r.enumerable});return e},mt=(e,t,n)=>(n=e!=null?qd(Wd(e)):{},Jd(t||!e||!e.__esModule?is(n,"default",{value:e,enumerable:!0}):n,e));var en=De({"../../../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 Le(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=Le;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 es(m){return Un(m)&&m.anyOf.every(Re=>Cn(Re)||O(Re))}f.TUnionLiteral=es;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 ts(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}f.TReadonly=ts;function ns(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}f.TOptional=ns;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)||Le(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)?rs(p,h):s.TUnknown(h)?Za(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 Le(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)&&Le(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)&&Le(h)||s.TInteger(p)&&Le(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 es(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 Kd of Object.getOwnPropertyNames(p.properties))if(jr(xt,p.properties[Kd])===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 ts(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 ns(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 Dd(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 kd(p,h){return U(h)?P(p,h):s.TObject(h)?qe(p,h):s.TRecord(h)?it(p,h):s.TVoid(h)?Fd(p,h):s.TUndefined(h)?c.True:c.False}function rs(p,h){return h.anyOf.some(Ae=>Ne(p,Ae)===c.True)?c.True:c.False}function Ld(p,h){return p.anyOf.every(Ae=>Ne(Ae,h)===c.True)?c.True:c.False}function Za(p,h){return c.True}function jd(p,h){return s.TNever(h)?_e(p,h):s.TIntersect(h)?be(p,h):s.TUnion(h)?rs(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 Fd(p,h){return s.TUndefined(p)||s.TUndefined(p)?c.True:c.False}function zd(p,h){return s.TIntersect(h)?be(p,h):s.TUnion(h)?rs(p,h):s.TUnknown(h)?Za(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)?ts(p,h):s.TSymbol(p)?ns(p,h):s.TTuple(p)?gt(p,h):s.TPromise(p)?es(p,h):s.TUint8Array(p)?Dd(p,h):s.TUndefined(p)?kd(p,h):s.TUnion(p)?Ld(p,h):s.TUnknown(p)?jd(p,h):s.TVoid(p)?zd(p,h):E(`Unknown left type operand '${p[e.Kind]}'`)}function Vd(p,h){return Ne(p,h)}f.Extends=Vd})(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=[...k.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[...k.Generate(U)]})():[]}f.Resolve=_})(F||(e.KeyArrayResolver=F={}));var L;(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})(L||(e.UnionResolver=L={}));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=[...k.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 k;(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=$})(k||(e.TemplateLiteralGenerator=k={}));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([...k.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=L.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}}),fr=mt(en(),1),{String:Xd,Optional:Yd,Boolean:Qd,Object:Zd,Number:ep}=fr.Type,tp=Xd.bind(fr.Type),np=ep.bind(fr.Type),zI=Zd.bind(fr.Type),VI=Yd.bind(fr.Type),rp=Qd.bind(fr.Type),KI=tp(),qI=np(),GI=rp();function tu(e){return Array.isArray(e)?e:[e]}var ip={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"},op=ip;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:op[e];throw typeof i=="function"&&(i=i.apply(null,n)),new Error("[MobX] "+i)}var sp={};function Ki(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:sp}var _u=Object.assign,Mi=Object.getOwnPropertyDescriptor,Gt=Object.defineProperty,Gr=Object.prototype,Bi=[];Object.freeze(Bi);var bs={};Object.freeze(bs);var ap=typeof Proxy<"u",up=Object.toString();function wu(){ap||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 It(){return++X.mobxGuid}function _s(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var pr=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 kt(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()===up}function Tu(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 Au(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 mr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function cp(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function tn(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Ou=typeof Object.getOwnPropertySymbols<"u";function lp(e){var t=Object.keys(e);if(!Ou)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:Ou?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function us(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function Eu(e){return e===null?null:typeof e=="object"?""+e:e}function Tt(e,t){return Gr.hasOwnProperty.call(e,t)}var fp=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 nu(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 ru(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,pp(r.key),r)}}function vr(e,t,n){return t&&ru(e.prototype,t),n&&ru(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function hr(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=hp(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
|
|
1
|
+
var Hf=Object.create,$o=Object.defineProperty,Jf=Object.getOwnPropertyDescriptor,ya=Object.getOwnPropertyNames,Xf=Object.getPrototypeOf,Yf=Object.prototype.hasOwnProperty,Ce=(e,t)=>function(){return t||(0,e[ya(e)[0]])((t={exports:{}}).exports,t),t.exports},No=(e,t)=>{for(var r in t)$o(e,r,{get:t[r],enumerable:!0})},Qf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ya(t))!Yf.call(e,i)&&i!==r&&$o(e,i,{get:()=>t[i],enumerable:!(n=Jf(t,i))||n.enumerable});return e},ft=(e,t,r)=>(r=e!=null?Hf(Xf(e)):{},Qf(t||!e||!e.__esModule?$o(r,"default",{value:e,enumerable:!0}):r,e));var qt=Ce({"../../../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 I(){return new Map(_)}f.Entries=I;function M(){return _.clear()}f.Clear=M;function C(w){return _.delete(w)}f.Delete=C;function P(w){return _.has(w)}f.Has=P;function y(w,u){_.set(w,u)}f.Set=y;function T(w){return _.get(w)}f.Get=T})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(f){super(f)}};e.TypeBoxError=r;var n;(function(f){let _=new Map;function I(){return new Map(_)}f.Entries=I;function M(){return _.clear()}f.Clear=M;function C(w){return _.delete(w)}f.Delete=C;function P(w){return _.has(w)}f.Has=P;function y(w,u){_.set(w,u)}f.Set=y;function T(w){return _.get(w)}f.Get=T})(n||(e.FormatRegistry=n={}));var i;(function(f){function _(b){return Array.isArray(b)}f.IsArray=_;function I(b){return typeof b=="bigint"}f.IsBigInt=I;function M(b){return typeof b=="boolean"}f.IsBoolean=M;function C(b){return b instanceof globalThis.Date}f.IsDate=C;function P(b){return b===null}f.IsNull=P;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 s=class extends r{};e.TypeGuardUnknownTypeError=s;var o;(function(f){function _(m){try{return new RegExp(m),!0}catch{return!1}}function I(m){if(!i.IsString(m))return!1;for(let Ee=0;Ee<m.length;Ee++){let lt=m.charCodeAt(Ee);if(lt>=7&<<=13||lt===27||lt===127)return!1}return!0}function M(m){return y(m)||Fe(m)}function C(m){return i.IsUndefined(m)||i.IsBigInt(m)}function P(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)&&I(m)&&_(m)}function u(m){return i.IsUndefined(m)||i.IsString(m)&&I(m)}function A(m){return i.IsUndefined(m)||Fe(m)}function b(m){return me(m,"Any")&&T(m.$id)}f.TAny=b;function v(m){return me(m,"Array")&&m.type==="array"&&T(m.$id)&&Fe(m.items)&&P(m.minItems)&&P(m.maxItems)&&y(m.uniqueItems)&&A(m.contains)&&P(m.minContains)&&P(m.maxContains)}f.TArray=v;function $(m){return me(m,"AsyncIterator")&&m.type==="AsyncIterator"&&T(m.$id)&&Fe(m.items)}f.TAsyncIterator=$;function z(m){return me(m,"BigInt")&&m.type==="bigint"&&T(m.$id)&&C(m.exclusiveMaximum)&&C(m.exclusiveMinimum)&&C(m.maximum)&&C(m.minimum)&&C(m.multipleOf)}f.TBigInt=z;function te(m){return me(m,"Boolean")&&m.type==="boolean"&&T(m.$id)}f.TBoolean=te;function re(m){return me(m,"Constructor")&&m.type==="Constructor"&&T(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ee=>Fe(Ee))&&Fe(m.returns)}f.TConstructor=re;function pe(m){return me(m,"Date")&&m.type==="Date"&&T(m.$id)&&P(m.exclusiveMaximumTimestamp)&&P(m.exclusiveMinimumTimestamp)&&P(m.maximumTimestamp)&&P(m.minimumTimestamp)&&P(m.multipleOfTimestamp)}f.TDate=pe;function ge(m){return me(m,"Function")&&m.type==="Function"&&T(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ee=>Fe(Ee))&&Fe(m.returns)}f.TFunction=ge;function $e(m){return me(m,"Integer")&&m.type==="integer"&&T(m.$id)&&P(m.exclusiveMaximum)&&P(m.exclusiveMinimum)&&P(m.maximum)&&P(m.minimum)&&P(m.multipleOf)}f.TInteger=$e;function De(m){return me(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Ee=>Fe(Ee)&&!bn(Ee))&&T(m.type)&&(y(m.unevaluatedProperties)||A(m.unevaluatedProperties))&&T(m.$id)}f.TIntersect=De;function vr(m){return me(m,"Iterator")&&m.type==="Iterator"&&T(m.$id)&&Fe(m.items)}f.TIterator=vr;function me(m,Ee){return rr(m)&&m[e.Kind]===Ee}f.TKindOf=me;function rr(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}f.TKind=rr;function br(m){return N(m)&&i.IsString(m.const)}f.TLiteralString=br;function O(m){return N(m)&&i.IsNumber(m.const)}f.TLiteralNumber=O;function ue(m){return N(m)&&i.IsBoolean(m.const)}f.TLiteralBoolean=ue;function N(m){return me(m,"Literal")&&T(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}f.TLiteral=N;function he(m){return me(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}f.TNever=he;function ne(m){return me(m,"Not")&&Fe(m.not)}f.TNot=ne;function le(m){return me(m,"Null")&&m.type==="null"&&T(m.$id)}f.TNull=le;function Ae(m){return me(m,"Number")&&m.type==="number"&&T(m.$id)&&P(m.exclusiveMaximum)&&P(m.exclusiveMinimum)&&P(m.maximum)&&P(m.minimum)&&P(m.multipleOf)}f.TNumber=Ae;function Ue(m){return me(m,"Object")&&m.type==="object"&&T(m.$id)&&i.IsObject(m.properties)&&M(m.additionalProperties)&&P(m.minProperties)&&P(m.maxProperties)&&Object.entries(m.properties).every(([Ee,lt])=>I(Ee)&&Fe(lt))}f.TObject=Ue;function Ye(m){return me(m,"Promise")&&m.type==="Promise"&&T(m.$id)&&Fe(m.item)}f.TPromise=Ye;function He(m){return me(m,"Record")&&m.type==="object"&&T(m.$id)&&M(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Ee=>{let lt=Object.getOwnPropertyNames(Ee.patternProperties);return lt.length===1&&_(lt[0])&&i.IsObject(Ee.patternProperties)&&Fe(Ee.patternProperties[lt[0]])})(m)}f.TRecord=He;function Ze(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}f.TRecursive=Ze;function zt(m){return me(m,"Ref")&&T(m.$id)&&i.IsString(m.$ref)}f.TRef=zt;function zr(m){return me(m,"String")&&m.type==="string"&&T(m.$id)&&P(m.minLength)&&P(m.maxLength)&&w(m.pattern)&&u(m.format)}f.TString=zr;function qr(m){return me(m,"Symbol")&&m.type==="symbol"&&T(m.$id)}f.TSymbol=qr;function _r(m){return me(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}f.TTemplateLiteral=_r;function ri(m){return me(m,"This")&&T(m.$id)&&i.IsString(m.$ref)}f.TThis=ri;function bn(m){return i.IsObject(m)&&e.Transform in m}f.TTransform=bn;function ke(m){return me(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(Ee=>Fe(Ee)))}f.TTuple=ke;function ni(m){return me(m,"Undefined")&&m.type==="undefined"&&T(m.$id)}f.TUndefined=ni;function Eo(m){return wr(m)&&m.anyOf.every(Ee=>br(Ee)||O(Ee))}f.TUnionLiteral=Eo;function wr(m){return me(m,"Union")&&T(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Ee=>Fe(Ee))}f.TUnion=wr;function Gr(m){return me(m,"Uint8Array")&&m.type==="Uint8Array"&&T(m.$id)&&P(m.minByteLength)&&P(m.maxByteLength)}f.TUint8Array=Gr;function Qe(m){return me(m,"Unknown")&&T(m.$id)}f.TUnknown=Qe;function ii(m){return me(m,"Unsafe")}f.TUnsafe=ii;function _n(m){return me(m,"Void")&&m.type==="void"&&T(m.$id)}f.TVoid=_n;function So(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}f.TReadonly=So;function Ro(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}f.TOptional=Ro;function Fe(m){return i.IsObject(m)&&(b(m)||v(m)||te(m)||z(m)||$(m)||re(m)||pe(m)||ge(m)||$e(m)||De(m)||vr(m)||N(m)||he(m)||ne(m)||le(m)||Ae(m)||Ue(m)||Ye(m)||He(m)||zt(m)||zr(m)||qr(m)||_r(m)||ri(m)||ke(m)||ni(m)||wr(m)||Gr(m)||Qe(m)||ii(m)||_n(m)||rr(m)&&t.Has(m[e.Kind]))}f.TSchema=Fe})(o||(e.TypeGuard=o={}));var a;(function(f){function _(I){return I[e.Kind]==="Intersect"?I.allOf.every(M=>_(M)):I[e.Kind]==="Union"?I.anyOf.some(M=>_(M)):I[e.Kind]==="Undefined"?!0:I[e.Kind]==="Not"?!_(I.not):!1}f.Check=_})(a||(e.ExtendsUndefined=a={}));var l=class extends r{};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 I(p){throw new l(p)}function M(p){return o.TNever(p)||o.TIntersect(p)||o.TUnion(p)||o.TUnknown(p)||o.TAny(p)}function C(p,h){return o.TNever(h)?me(p,h):o.TIntersect(h)?ge(p,h):o.TUnion(h)?Po(p,h):o.TUnknown(h)?ha(p,h):o.TAny(h)?P(p,h):I("StructuralRight")}function P(p,h){return c.True}function y(p,h){return o.TIntersect(h)?ge(p,h):o.TUnion(h)&&h.anyOf.some(_e=>o.TAny(_e)||o.TUnknown(_e))?c.True:o.TUnion(h)?c.Union:o.TUnknown(h)||o.TAny(h)?c.True:c.Union}function T(p,h){return o.TUnknown(p)?c.False:o.TAny(p)?c.Union:o.TNever(p)?c.True:c.False}function w(p,h){return o.TObject(h)&&_r(h)?c.True:M(h)?C(p,h):o.TArray(h)?_(Ie(p.items,h.items)):c.False}function u(p,h){return M(h)?C(p,h):o.TAsyncIterator(h)?_(Ie(p.items,h.items)):c.False}function A(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):o.TBigInt(h)?c.True:c.False}function b(p,h){return o.TLiteral(p)&&i.IsBoolean(p.const)||o.TBoolean(p)?c.True:c.False}function v(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):o.TBoolean(h)?c.True:c.False}function $(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TConstructor(h)?p.parameters.length>h.parameters.length?c.False:p.parameters.every((_e,It)=>_(Ie(h.parameters[It],_e))===c.True)?_(Ie(p.returns,h.returns)):c.False:c.False}function z(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):o.TDate(h)?c.True:c.False}function te(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TFunction(h)?p.parameters.length>h.parameters.length?c.False:p.parameters.every((_e,It)=>_(Ie(h.parameters[It],_e))===c.True)?_(Ie(p.returns,h.returns)):c.False:c.False}function re(p,h){return o.TLiteral(p)&&i.IsNumber(p.const)||o.TNumber(p)||o.TInteger(p)?c.True:c.False}function pe(p,h){return o.TInteger(h)||o.TNumber(h)?c.True:M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):c.False}function ge(p,h){return h.allOf.every(_e=>Ie(p,_e)===c.True)?c.True:c.False}function $e(p,h){return p.allOf.some(_e=>Ie(_e,h)===c.True)?c.True:c.False}function De(p,h){return M(h)?C(p,h):o.TIterator(h)?_(Ie(p.items,h.items)):c.False}function vr(p,h){return o.TLiteral(h)&&h.const===p.const?c.True:M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):o.TString(h)?_n(p,h):o.TNumber(h)?N(p,h):o.TInteger(h)?re(p,h):o.TBoolean(h)?b(p,h):c.False}function me(p,h){return c.False}function rr(p,h){return c.True}function br(p){let[h,_e]=[p,0];for(;o.TNot(h);)h=h.not,_e+=1;return _e%2===0?h:e.Type.Unknown()}function O(p,h){return o.TNot(p)?Ie(br(p),h):o.TNot(h)?Ie(p,br(h)):I("Invalid fallthrough for Not")}function ue(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):o.TNull(h)?c.True:c.False}function N(p,h){return o.TLiteralNumber(p)||o.TNumber(p)||o.TInteger(p)?c.True:c.False}function he(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):o.TInteger(h)||o.TNumber(h)?c.True:c.False}function ne(p,h){return Object.getOwnPropertyNames(p.properties).length===h}function le(p){return _r(p)}function Ae(p){return ne(p,0)||ne(p,1)&&"description"in p.properties&&o.TUnion(p.properties.description)&&p.properties.description.anyOf.length===2&&(o.TString(p.properties.description.anyOf[0])&&o.TUndefined(p.properties.description.anyOf[1])||o.TString(p.properties.description.anyOf[1])&&o.TUndefined(p.properties.description.anyOf[0]))}function Ue(p){return ne(p,0)}function Ye(p){return ne(p,0)}function He(p){return ne(p,0)}function Ze(p){return ne(p,0)}function zt(p){return _r(p)}function zr(p){let h=e.Type.Number();return ne(p,0)||ne(p,1)&&"length"in p.properties&&_(Ie(p.properties.length,h))===c.True}function qr(p){return ne(p,0)}function _r(p){let h=e.Type.Number();return ne(p,0)||ne(p,1)&&"length"in p.properties&&_(Ie(p.properties.length,h))===c.True}function ri(p){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return ne(p,0)||ne(p,1)&&"then"in p.properties&&_(Ie(p.properties.then,h))===c.True}function bn(p,h){return Ie(p,h)===c.False||o.TOptional(p)&&!o.TOptional(h)?c.False:c.True}function ke(p,h){return o.TUnknown(p)?c.False:o.TAny(p)?c.Union:o.TNever(p)||o.TLiteralString(p)&&le(h)||o.TLiteralNumber(p)&&Ue(h)||o.TLiteralBoolean(p)&&Ye(h)||o.TSymbol(p)&&Ae(h)||o.TBigInt(p)&&He(h)||o.TString(p)&&le(h)||o.TSymbol(p)&&Ae(h)||o.TNumber(p)&&Ue(h)||o.TInteger(p)&&Ue(h)||o.TBoolean(p)&&Ye(h)||o.TUint8Array(p)&&zt(h)||o.TDate(p)&&Ze(h)||o.TConstructor(p)&&qr(h)||o.TFunction(p)&&zr(h)?c.True:o.TRecord(p)&&o.TString(wr(p))?h[e.Hint]==="Record"?c.True:c.False:o.TRecord(p)&&o.TNumber(wr(p))?ne(h,0)?c.True:c.False:c.False}function ni(p,h){return M(h)?C(p,h):o.TRecord(h)?Qe(p,h):o.TObject(h)?(()=>{for(let _e of Object.getOwnPropertyNames(h.properties)){if(!(_e in p.properties)&&!o.TOptional(h.properties[_e]))return c.False;if(o.TOptional(h.properties[_e]))return c.True;if(bn(p.properties[_e],h.properties[_e])===c.False)return c.False}return c.True})():c.False}function Eo(p,h){return M(h)?C(p,h):o.TObject(h)&&ri(h)?c.True:o.TPromise(h)?_(Ie(p.item,h.item)):c.False}function wr(p){return e.PatternNumberExact in p.patternProperties?e.Type.Number():e.PatternStringExact in p.patternProperties?e.Type.String():I("Unknown record key pattern")}function Gr(p){return e.PatternNumberExact in p.patternProperties?p.patternProperties[e.PatternNumberExact]:e.PatternStringExact in p.patternProperties?p.patternProperties[e.PatternStringExact]:I("Unable to get record value schema")}function Qe(p,h){let[_e,It]=[wr(h),Gr(h)];return o.TLiteralString(p)&&o.TNumber(_e)&&_(Ie(p,It))===c.True?c.True:o.TUint8Array(p)&&o.TNumber(_e)||o.TString(p)&&o.TNumber(_e)||o.TArray(p)&&o.TNumber(_e)?Ie(p,It):o.TObject(p)?(()=>{for(let Wf of Object.getOwnPropertyNames(p.properties))if(bn(It,p.properties[Wf])===c.False)return c.False;return c.True})():c.False}function ii(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Ie(Gr(p),Gr(h)):c.False}function _n(p,h){return o.TLiteral(p)&&i.IsString(p.const)||o.TString(p)?c.True:c.False}function So(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):o.TString(h)?c.True:c.False}function Ro(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):o.TSymbol(h)?c.True:c.False}function Fe(p,h){return o.TTemplateLiteral(p)?Ie(k.Resolve(p),h):o.TTemplateLiteral(h)?Ie(p,k.Resolve(h)):I("Invalid fallthrough for TemplateLiteral")}function m(p,h){return o.TArray(h)&&p.items!==void 0&&p.items.every(_e=>Ie(_e,h.items)===c.True)}function Ee(p,h){return o.TNever(p)?c.True:o.TUnknown(p)?c.False:o.TAny(p)?c.Union:c.False}function lt(p,h){return M(h)?C(p,h):o.TObject(h)&&_r(h)||o.TArray(h)&&m(p,h)?c.True:o.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((_e,It)=>Ie(_e,h.items[It])===c.True)?c.True:c.False:c.False}function kf(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):o.TUint8Array(h)?c.True:c.False}function Ff(p,h){return M(h)?C(p,h):o.TObject(h)?ke(p,h):o.TRecord(h)?Qe(p,h):o.TVoid(h)?zf(p,h):o.TUndefined(h)?c.True:c.False}function Po(p,h){return h.anyOf.some(_e=>Ie(p,_e)===c.True)?c.True:c.False}function Kf(p,h){return p.anyOf.every(_e=>Ie(_e,h)===c.True)?c.True:c.False}function ha(p,h){return c.True}function Vf(p,h){return o.TNever(h)?me(p,h):o.TIntersect(h)?ge(p,h):o.TUnion(h)?Po(p,h):o.TAny(h)?P(p,h):o.TString(h)?_n(p,h):o.TNumber(h)?N(p,h):o.TInteger(h)?re(p,h):o.TBoolean(h)?b(p,h):o.TArray(h)?T(p,h):o.TTuple(h)?Ee(p,h):o.TObject(h)?ke(p,h):o.TUnknown(h)?c.True:c.False}function zf(p,h){return o.TUndefined(p)||o.TUndefined(p)?c.True:c.False}function qf(p,h){return o.TIntersect(h)?ge(p,h):o.TUnion(h)?Po(p,h):o.TUnknown(h)?ha(p,h):o.TAny(h)?P(p,h):o.TObject(h)?ke(p,h):o.TVoid(h)?c.True:c.False}function Ie(p,h){return o.TTemplateLiteral(p)||o.TTemplateLiteral(h)?Fe(p,h):o.TNot(p)||o.TNot(h)?O(p,h):o.TAny(p)?y(p,h):o.TArray(p)?w(p,h):o.TBigInt(p)?A(p,h):o.TBoolean(p)?v(p,h):o.TAsyncIterator(p)?u(p,h):o.TConstructor(p)?$(p,h):o.TDate(p)?z(p,h):o.TFunction(p)?te(p,h):o.TInteger(p)?pe(p,h):o.TIntersect(p)?$e(p,h):o.TIterator(p)?De(p,h):o.TLiteral(p)?vr(p,h):o.TNever(p)?rr(p,h):o.TNull(p)?ue(p,h):o.TNumber(p)?he(p,h):o.TObject(p)?ni(p,h):o.TRecord(p)?ii(p,h):o.TString(p)?So(p,h):o.TSymbol(p)?Ro(p,h):o.TTuple(p)?lt(p,h):o.TPromise(p)?Eo(p,h):o.TUint8Array(p)?kf(p,h):o.TUndefined(p)?Ff(p,h):o.TUnion(p)?Kf(p,h):o.TUnknown(p)?Vf(p,h):o.TVoid(p)?qf(p,h):I(`Unknown left type operand '${p[e.Kind]}'`)}function Gf(p,h){return Ie(p,h)}f.Extends=Gf})(d||(e.TypeExtends=d={}));var g;(function(f){function _(w){return w.map(u=>P(u))}function I(w){return new Date(w.getTime())}function M(w){return new Uint8Array(w)}function C(w){let u=Object.getOwnPropertyNames(w).reduce((b,v)=>({...b,[v]:P(w[v])}),{}),A=Object.getOwnPropertySymbols(w).reduce((b,v)=>({...b,[v]:P(w[v])}),{});return{...u,...A}}function P(w){return i.IsArray(w)?_(w):i.IsDate(w)?I(w):i.IsUint8Array(w)?M(w):i.IsObject(w)?C(w):w}function y(w){return w.map(u=>T(u))}f.Rest=y;function T(w,u={}){return{...P(w),...u}}f.Type=T})(g||(e.TypeClone=g={}));var x;(function(f){function _($){return $.map(z=>{let{[e.Optional]:te,...re}=g.Type(z);return re})}function I($){return $.every(z=>o.TOptional(z))}function M($){return $.some(z=>o.TOptional(z))}function C($){return I($.allOf)?e.Type.Optional(e.Type.Intersect(_($.allOf))):$}function P($){return M($.anyOf)?e.Type.Optional(e.Type.Union(_($.anyOf))):$}function y($){return $[e.Kind]==="Intersect"?C($):$[e.Kind]==="Union"?P($):$}function T($,z){let te=$.allOf.reduce((re,pe)=>{let ge=b(pe,z);return ge[e.Kind]==="Never"?re:[...re,ge]},[]);return y(e.Type.Intersect(te))}function w($,z){let te=$.anyOf.map(re=>b(re,z));return y(e.Type.Union(te))}function u($,z){let te=$.properties[z];return i.IsUndefined(te)?e.Type.Never():e.Type.Union([te])}function A($,z){let te=$.items;if(i.IsUndefined(te))return e.Type.Never();let re=te[z];return i.IsUndefined(re)?e.Type.Never():re}function b($,z){return $[e.Kind]==="Intersect"?T($,z):$[e.Kind]==="Union"?w($,z):$[e.Kind]==="Object"?u($,z):$[e.Kind]==="Tuple"?A($,z):e.Type.Never()}function v($,z,te={}){let re=z.map(pe=>b($,pe.toString()));return y(e.Type.Union(re,te))}f.Resolve=v})(x||(e.IndexedAccessor=x={}));var S;(function(f){function _(A){let[b,v]=[A.slice(0,1),A.slice(1)];return`${b.toLowerCase()}${v}`}function I(A){let[b,v]=[A.slice(0,1),A.slice(1)];return`${b.toUpperCase()}${v}`}function M(A){return A.toUpperCase()}function C(A){return A.toLowerCase()}function P(A,b){let v=q.ParseExact(A.pattern);if(!U.Check(v))return{...A,pattern:y(A.pattern,b)};let te=[...L.Generate(v)].map(ge=>e.Type.Literal(ge)),re=T(te,b),pe=e.Type.Union(re);return e.Type.TemplateLiteral([pe])}function y(A,b){return typeof A=="string"?b==="Uncapitalize"?_(A):b==="Capitalize"?I(A):b==="Uppercase"?M(A):b==="Lowercase"?C(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 o.TTemplateLiteral(A)?P(A,b):o.TUnion(A)?e.Type.Union(T(A.anyOf,b)):o.TLiteral(A)?e.Type.Literal(y(A.const,b)):A}function u(A,b){return w(A,b)}f.Map=u})(S||(e.Intrinsic=S={}));var R;(function(f){function _(y,T){return e.Type.Intersect(y.allOf.map(w=>C(w,T)),{...y})}function I(y,T){return e.Type.Union(y.anyOf.map(w=>C(w,T)),{...y})}function M(y,T){return T(y)}function C(y,T){return y[e.Kind]==="Intersect"?_(y,T):y[e.Kind]==="Union"?I(y,T):y[e.Kind]==="Object"?M(y,T):y}function P(y,T,w){return{...C(g.Type(y),T),...w}}f.Map=P})(R||(e.ObjectMap=R={}));var K;(function(f){function _(u){return u[0]==="^"&&u[u.length-1]==="$"?u.slice(1,u.length-1):u}function I(u,A){return u.allOf.reduce((b,v)=>[...b,...y(v,A)],[])}function M(u,A){let b=u.anyOf.map(v=>y(v,A));return[...b.reduce((v,$)=>$.map(z=>b.every(te=>te.includes(z))?v.add(z):v)[0],new Set)]}function C(u,A){return Object.getOwnPropertyNames(u.properties)}function P(u,A){return A.includePatterns?Object.getOwnPropertyNames(u.patternProperties):[]}function y(u,A){return o.TIntersect(u)?I(u,A):o.TUnion(u)?M(u,A):o.TObject(u)?C(u,A):o.TRecord(u)?P(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})(K||(e.KeyResolver=K={}));var H=class extends r{};e.KeyArrayResolverError=H;var F;(function(f){function _(I){return Array.isArray(I)?I:o.TUnionLiteral(I)?I.anyOf.map(M=>M.const.toString()):o.TLiteral(I)?[I.const]:o.TTemplateLiteral(I)?(()=>{let M=q.ParseExact(I.pattern);if(!U.Check(M))throw new H("Cannot resolve keys from infinite template expression");return[...L.Generate(M)]})():[]}f.Resolve=_})(F||(e.KeyArrayResolver=F={}));var j;(function(f){function*_(M){for(let C of M.anyOf)C[e.Kind]==="Union"?yield*_(C):yield C}function I(M){return e.Type.Union([..._(M)],{...M})}f.Resolve=I})(j||(e.UnionResolver=j={}));var V=class extends r{};e.TemplateLiteralPatternError=V;var G;(function(f){function _(P){throw new V(P)}function I(P){return P.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function M(P,y){return o.TTemplateLiteral(P)?P.pattern.slice(1,P.pattern.length-1):o.TUnion(P)?`(${P.anyOf.map(T=>M(T,y)).join("|")})`:o.TNumber(P)?`${y}${e.PatternNumber}`:o.TInteger(P)?`${y}${e.PatternNumber}`:o.TBigInt(P)?`${y}${e.PatternNumber}`:o.TString(P)?`${y}${e.PatternString}`:o.TLiteral(P)?`${y}${I(P.const.toString())}`:o.TBoolean(P)?`${y}${e.PatternBoolean}`:_(`Unexpected Kind '${P[e.Kind]}'`)}function C(P){return`^${P.map(y=>M(y,"")).join("")}$`}f.Create=C})(G||(e.TemplateLiteralPattern=G={}));var k;(function(f){function _(I){let M=q.ParseExact(I.pattern);if(!U.Check(M))return e.Type.String();let C=[...L.Generate(M)].map(P=>e.Type.Literal(P));return e.Type.Union(C)}f.Resolve=_})(k||(e.TemplateLiteralResolver=k={}));var Q=class extends r{};e.TemplateLiteralParserError=Q;var q;(function(f){function _($,z,te){return $[z]===te&&$.charCodeAt(z-1)!==92}function I($,z){return _($,z,"(")}function M($,z){return _($,z,")")}function C($,z){return _($,z,"|")}function P($){if(!(I($,0)&&M($,$.length-1)))return!1;let z=0;for(let te=0;te<$.length;te++)if(I($,te)&&(z+=1),M($,te)&&(z-=1),z===0&&te!==$.length-1)return!1;return!0}function y($){return $.slice(1,$.length-1)}function T($){let z=0;for(let te=0;te<$.length;te++)if(I($,te)&&(z+=1),M($,te)&&(z-=1),C($,te)&&z===0)return!0;return!1}function w($){for(let z=0;z<$.length;z++)if(I($,z))return!0;return!1}function u($){let[z,te]=[0,0],re=[];for(let ge=0;ge<$.length;ge++)if(I($,ge)&&(z+=1),M($,ge)&&(z-=1),C($,ge)&&z===0){let $e=$.slice(te,ge);$e.length>0&&re.push(b($e)),te=ge+1}let pe=$.slice(te);return pe.length>0&&re.push(b(pe)),re.length===0?{type:"const",const:""}:re.length===1?re[0]:{type:"or",expr:re}}function A($){function z(pe,ge){if(!I(pe,ge))throw new Q("TemplateLiteralParser: Index must point to open parens");let $e=0;for(let De=ge;De<pe.length;De++)if(I(pe,De)&&($e+=1),M(pe,De)&&($e-=1),$e===0)return[ge,De];throw new Q("TemplateLiteralParser: Unclosed group parens in expression")}function te(pe,ge){for(let $e=ge;$e<pe.length;$e++)if(I(pe,$e))return[ge,$e];return[ge,pe.length]}let re=[];for(let pe=0;pe<$.length;pe++)if(I($,pe)){let[ge,$e]=z($,pe),De=$.slice(ge,$e+1);re.push(b(De)),pe=$e}else{let[ge,$e]=te($,pe),De=$.slice(ge,$e);De.length>0&&re.push(b(De)),pe=$e-1}return re.length===0?{type:"const",const:""}:re.length===1?re[0]:{type:"and",expr:re}}function b($){return P($)?b(y($)):T($)?u($):w($)?A($):{type:"const",const:$}}f.Parse=b;function v($){return b($.slice(1,$.length-1))}f.ParseExact=v})(q||(e.TemplateLiteralParser=q={}));var ce=class extends r{};e.TemplateLiteralFiniteError=ce;var U;(function(f){function _(y){throw new ce(y)}function I(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 M(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 C(y){return y.type==="const"&&y.const===".*"}function P(y){return M(y)?!0:I(y)||C(y)?!1:y.type==="and"?y.expr.every(T=>P(T)):y.type==="or"?y.expr.every(T=>P(T)):y.type==="const"?!0:_("Unknown expression type")}f.Check=P})(U||(e.TemplateLiteralFinite=U={}));var D=class extends r{};e.TemplateLiteralGeneratorError=D;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*I(y){return yield*_(y.expr.map(T=>[...P(T)]))}function*M(y){for(let T of y.expr)yield*P(T)}function*C(y){return yield y.const}function*P(y){return y.type==="and"?yield*I(y):y.type==="or"?yield*M(y):y.type==="const"?yield*C(y):(()=>{throw new D("Unknown expression")})()}f.Generate=P})(L||(e.TemplateLiteralGenerator=L={}));var ee;(function(f){function*_(P){let y=P.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*I(P){if(P[1]!=="{"){let y=e.Type.Literal("$"),T=M(P.slice(1));return yield*[y,...T]}for(let y=2;y<P.length;y++)if(P[y]==="}"){let T=_(P.slice(2,y)),w=M(P.slice(y+1));return yield*[...T,...w]}yield e.Type.Literal(P)}function*M(P){for(let y=0;y<P.length;y++)if(P[y]==="$"){let T=e.Type.Literal(P.slice(0,y)),w=I(P.slice(y));return yield*[T,...w]}yield e.Type.Literal(P)}function C(P){return[...M(P)]}f.Parse=C})(ee||(e.TemplateLiteralDslParser=ee={}));var ie=class{constructor(f){this.schema=f}Decode(f){return new Y(this.schema,f)}};e.TransformDecodeBuilder=ie;var Y=class{constructor(f,_){this.schema=f,this.decode=_}Encode(f){let _=g.Type(this.schema);return o.TTransform(_)?(()=>{let C={Encode:P=>_[e.Transform].Encode(f(P)),Decode:P=>this.decode(_[e.Transform].Decode(P))};return{..._,[e.Transform]:C}})():(()=>{let I={Decode:this.decode,Encode:f};return{..._,[e.Transform]:I}})()}};e.TransformEncodeBuilder=Y;var se=0,B=class extends r{};e.TypeBuilderError=B;var W=class{Create(f){return f}Throw(f){throw new B(f)}Discard(f,_){return _.reduce((I,M)=>{let{[M]:C,...P}=I;return P},f)}Strict(f){return JSON.parse(JSON.stringify(f))}};e.TypeBuilder=W;var X=class extends W{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{...S.Map(g.Type(f),"Capitalize"),..._}}Composite(f,_){let I=e.Type.Intersect(f,{}),C=K.ResolveKeys(I,{includePatterns:!1}).reduce((P,y)=>({...P,[y]:e.Type.Index(I,[y])}),{});return e.Type.Object(C,_)}Enum(f,_={}){if(i.IsUndefined(f))return this.Throw("Enum undefined or empty");let I=Object.getOwnPropertyNames(f).filter(P=>isNaN(P)).map(P=>f[P]),C=[...new Set(I)].map(P=>e.Type.Literal(P));return this.Union(C,{..._,[e.Hint]:"Enum"})}Extends(f,_,I,M,C={}){switch(d.Extends(f,_)){case c.Union:return this.Union([g.Type(I,C),g.Type(M,C)]);case c.True:return g.Type(I,C);case c.False:return g.Type(M,C)}}Exclude(f,_,I={}){return o.TTemplateLiteral(f)?this.Exclude(k.Resolve(f),_,I):o.TTemplateLiteral(_)?this.Exclude(f,k.Resolve(_),I):o.TUnion(f)?(()=>{let M=f.anyOf.filter(C=>d.Extends(C,_)===c.False);return M.length===1?g.Type(M[0],I):this.Union(M,I)})():d.Extends(f,_)!==c.False?this.Never(I):g.Type(f,I)}Extract(f,_,I={}){return o.TTemplateLiteral(f)?this.Extract(k.Resolve(f),_,I):o.TTemplateLiteral(_)?this.Extract(f,k.Resolve(_),I):o.TUnion(f)?(()=>{let M=f.anyOf.filter(C=>d.Extends(C,_)!==c.False);return M.length===1?g.Type(M[0],I):this.Union(M,I)})():d.Extends(f,_)!==c.False?g.Type(f,I):this.Never(I)}Index(f,_,I={}){return o.TArray(f)&&o.TNumber(_)?g.Type(f.items,I):o.TTuple(f)&&o.TNumber(_)?(()=>{let C=(i.IsUndefined(f.items)?[]:f.items).map(P=>g.Type(P));return this.Union(C,I)})():(()=>{let M=F.Resolve(_),C=g.Type(f);return x.Resolve(C,M,I)})()}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(P=>o.TTransform(P))&&this.Throw("Cannot intersect transform types");let I=f.every(P=>o.TObject(P)),M=g.Rest(f),C=o.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:g.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||o.TSchema(_.unevaluatedProperties)||I?this.Create({..._,...C,[e.Kind]:"Intersect",type:"object",allOf:M}):this.Create({..._,...C,[e.Kind]:"Intersect",allOf:M})}KeyOf(f,_={}){return o.TRecord(f)?(()=>{let I=Object.getOwnPropertyNames(f.patternProperties)[0];return I===e.PatternNumberExact?this.Number(_):I===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():o.TTuple(f)?(()=>{let M=(i.IsUndefined(f.items)?[]:f.items).map((C,P)=>e.Type.Literal(P.toString()));return this.Union(M,_)})():o.TArray(f)?this.Number(_):(()=>{let I=K.ResolveKeys(f,{includePatterns:!1});if(I.length===0)return this.Never(_);let M=I.map(C=>this.Literal(C));return this.Union(M,_)})()}Literal(f,_={}){return this.Create({..._,[e.Kind]:"Literal",const:f,type:typeof f})}Lowercase(f,_={}){return{...S.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 I=Object.getOwnPropertyNames(f),M=I.filter(T=>o.TOptional(f[T])),C=I.filter(T=>!M.includes(T)),P=o.TSchema(_.additionalProperties)?{additionalProperties:g.Type(_.additionalProperties)}:{},y=I.reduce((T,w)=>({...T,[w]:g.Type(f[w])}),{});return C.length>0?this.Create({..._,...P,[e.Kind]:"Object",type:"object",properties:y,required:C}):this.Create({..._,...P,[e.Kind]:"Object",type:"object",properties:y})}Omit(f,_,I={}){let M=F.Resolve(_);return R.Map(this.Discard(g.Type(f),["$id",e.Transform]),C=>{i.IsArray(C.required)&&(C.required=C.required.filter(P=>!M.includes(P)),C.required.length===0&&delete C.required);for(let P of Object.getOwnPropertyNames(C.properties))M.includes(P)&&delete C.properties[P];return this.Create(C)},I)}Partial(f,_={}){return R.Map(this.Discard(g.Type(f),["$id",e.Transform]),I=>{let M=Object.getOwnPropertyNames(I.properties).reduce((C,P)=>({...C,[P]:this.Optional(I.properties[P])}),{});return this.Object(M,this.Discard(I,["required"]))},_)}Pick(f,_,I={}){let M=F.Resolve(_);return R.Map(this.Discard(g.Type(f),["$id",e.Transform]),C=>{i.IsArray(C.required)&&(C.required=C.required.filter(P=>M.includes(P)),C.required.length===0&&delete C.required);for(let P of Object.getOwnPropertyNames(C.properties))M.includes(P)||delete C.properties[P];return this.Create(C)},I)}Record(f,_,I={}){return o.TTemplateLiteral(f)?(()=>{let M=q.ParseExact(f.pattern);return U.Check(M)?this.Object([...L.Generate(M)].reduce((C,P)=>({...C,[P]:g.Type(_)}),{}),I):this.Create({...I,[e.Kind]:"Record",type:"object",patternProperties:{[f.pattern]:g.Type(_)}})})():o.TUnion(f)?(()=>{let M=j.Resolve(f);if(o.TUnionLiteral(M)){let C=M.anyOf.reduce((P,y)=>({...P,[y.const]:g.Type(_)}),{});return this.Object(C,{...I,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():o.TLiteral(f)?i.IsString(f.const)||i.IsNumber(f.const)?this.Object({[f.const]:g.Type(_)},I):this.Throw("Record key of type literal is not of type string or number"):o.TInteger(f)||o.TNumber(f)?this.Create({...I,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:g.Type(_)}}):o.TString(f)?(()=>{let M=i.IsUndefined(f.pattern)?e.PatternStringExact:f.pattern;return this.Create({...I,[e.Kind]:"Record",type:"object",patternProperties:{[M]:g.Type(_)}})})():this.Never()}Recursive(f,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${se++}`);let I=f({[e.Kind]:"This",$ref:`${_.$id}`});return I.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...I})}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 R.Map(this.Discard(g.Type(f),["$id",e.Transform]),I=>{let M=Object.getOwnPropertyNames(I.properties).reduce((C,P)=>({...C,[P]:this.Discard(I.properties[P],[e.Optional])}),{});return this.Object(M,I)},_)}Rest(f){return o.TTuple(f)&&!i.IsUndefined(f.items)?g.Rest(f.items):o.TIntersect(f)?g.Rest(f.allOf):o.TUnion(f)?g.Rest(f.anyOf):[]}String(f={}){return this.Create({...f,[e.Kind]:"String",type:"string"})}TemplateLiteral(f,_={}){let I=i.IsString(f)?G.Create(ee.Parse(f)):G.Create(f);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:I})}Transform(f){return new ie(f)}Tuple(f,_={}){let[I,M,C]=[!1,f.length,f.length],P=g.Rest(f),y=f.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:P,additionalItems:I,minItems:M,maxItems:C}:{..._,[e.Kind]:"Tuple",type:"array",minItems:M,maxItems:C};return this.Create(y)}Uncapitalize(f,_={}){return{...S.Map(g.Type(f),"Uncapitalize"),..._}}Union(f,_={}){return o.TTemplateLiteral(f)?k.Resolve(f):(()=>{let I=f;if(I.length===0)return this.Never(_);if(I.length===1)return this.Create(g.Type(I[0],_));let M=g.Rest(I);return this.Create({..._,[e.Kind]:"Union",anyOf:M})})()}Unknown(f={}){return this.Create({...f,[e.Kind]:"Unknown"})}Unsafe(f={}){return this.Create({...f,[e.Kind]:f[e.Kind]||"Unsafe"})}Uppercase(f,_={}){return{...S.Map(g.Type(f),"Uppercase"),..._}}};e.JsonTypeBuilder=X;var fe=class extends X{AsyncIterator(f,_={}){return this.Create({..._,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:g.Type(f)})}Awaited(f,_={}){let I=M=>M.length>0?(()=>{let[C,...P]=M;return[this.Awaited(C),...I(P)]})():M;return o.TIntersect(f)?e.Type.Intersect(I(f.allOf)):o.TUnion(f)?e.Type.Union(I(f.anyOf)):o.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,_,I){let[M,C]=[g.Rest(f),g.Type(_)];return this.Create({...I,[e.Kind]:"Constructor",type:"Constructor",parameters:M,returns:C})}Date(f={}){return this.Create({...f,[e.Kind]:"Date",type:"Date"})}Function(f,_,I){let[M,C]=[g.Rest(f),g.Type(_)];return this.Create({...I,[e.Kind]:"Function",type:"Function",parameters:M,returns:C})}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 I=i.IsString(f)?f:f.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:I})}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=fe,e.JsonType=new X,e.Type=new fe}}),Wr=ft(qt(),1),{String:Zf,Optional:ed,Boolean:td,Object:rd,Number:nd}=Wr.Type,id=Zf.bind(Wr.Type),od=nd.bind(Wr.Type),UI=rd.bind(Wr.Type),MI=ed.bind(Wr.Type),sd=td.bind(Wr.Type),DI=id(),BI=od(),LI=sd();function ga(e){return Array.isArray(e)?e:[e]}var ad={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(t,r){return"Cannot apply '"+t+"' to '"+r.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,r){return"[mobx.array] Index out of bounds, "+t+" is larger than "+r},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,r){return"the entry '"+t+"' does not exist in the observable map '"+r+"'"},26:"please specify a property",27:function(t,r){return"no observable property '"+t.toString()+"' found on the observable object '"+r+"'"},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,r){return"Cycle detected in computation "+t+": "+r},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"},ud=ad;function ae(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=typeof e=="string"?e:ud[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var cd={};function wi(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:cd}var Ma=Object.assign,di=Object.getOwnPropertyDescriptor,Bt=Object.defineProperty,In=Object.prototype,pi=[];Object.freeze(pi);var qo={};Object.freeze(qo);var ld=typeof Proxy<"u",fd=Object.toString();function Da(){ld||ae("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function wn(e){J.verifyProxies&&ae("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function _t(){return++J.mobxGuid}function Go(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Jr=function(){};function Me(e){return typeof e=="function"}function Ar(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function Ti(e){return e!==null&&typeof e=="object"}function $t(e){if(!Ti(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r.toString()===fd}function Ba(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Ai(e,t,r){Bt(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function La(e,t,r){Bt(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function sr(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return Ti(n)&&n[r]===!0}}function Zr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function dd(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function Gt(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var ja=typeof Object.getOwnPropertySymbols<"u";function pd(e){var t=Object.keys(e);if(!ja)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return In.propertyIsEnumerable.call(e,n)})):t}var Oi=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:ja?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Uo(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function ka(e){return e===null?null:typeof e=="object"?""+e:e}function gt(e,t){return In.hasOwnProperty.call(e,t)}var hd=Object.getOwnPropertyDescriptors||function(t){var r={};return Oi(t).forEach(function(n){r[n]=di(t,n)}),r};function nt(e,t){return!!(e&t)}function it(e,t,r){return r?e|=t:e&=~t,e}function ma(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function va(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,gd(n.key),n)}}function en(e,t,r){return t&&va(e.prototype,t),r&&va(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xr(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=md(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}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 Jt(){return Jt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Jt.apply(null,arguments)}function Fa(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Mo(e,t)}function Mo(e,t){return Mo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Mo(e,t)}function yd(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gd(e){var t=yd(e,"string");return typeof t=="symbol"?t:t+""}function md(e,t){if(e){if(typeof e=="string")return ma(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ma(e,t):void 0}}var et=Symbol("mobx-stored-annotations");function Lt(e){function t(r,n){if(Sn(n))return e.decorate_20223_(r,n);En(r,n,e)}return Object.assign(t,e)}function En(e,t,r){if(gt(e,et)||Ai(e,et,Jt({},e[et])),hi(r)&&!gt(e[et],t)){var n=e.constructor.name+".prototype."+t.toString();ae("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}vd(e,r,t),hi(r)||(e[et][t]=r)}function vd(e,t,r){if(!hi(t)&>(e[et],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[et][r].annotationType_,s=t.annotationType_;ae("Cannot apply '@"+s+"' to '"+n+"':"+(`
|
|
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
|
-
'`+
|
|
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 jp="true",Fp=Pu();function Pu(e){return{annotationType_:jp,options_:e,make_:zp,extend_:Vp,decorate_20223_:Kp}}function zp(e,t,n,r){var i,o;if(n.get)return ke.make_(e,t,n,r);if(n.set){var s=kn(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(Tu(n.value)){var l,c=(l=this.options_)!=null&&l.autoBind?yr.bound:yr;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 Vp(e,t,n,r){var i,o;if(n.get)return ke.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:kn(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 Kp(e,t){ce("'"+this.annotationType_+"' cannot be used as a decorator")}var qp="observable",Gp="observable.ref",Wp="observable.shallow",Hp="observable.struct",Cu={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Cu);function $i(e){return e||Cu}var ls=Xi(qp),Jp=Xi(Gp,{enhancer:Ji}),Xp=Xi(Wp,{enhancer:wp}),Yp=Xi(Hp,{enhancer:Tp}),xu=Wt(ls);function Ni(e){return e.deep===!0?Dn:e.deep===!1?Ji:Zp(e.defaultDecorator)}function Qp(e){var t;return e?(t=e.defaultDecorator)!=null?t:Pu(e):void 0}function Zp(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Dn}function Uu(e,t,n){if(Hr(t))return ls.decorate_20223_(e,t);if(Bn(t)){Wr(e,t,ls);return}return gr(e)?e:kt(e)?Ce.object(e,t,n):Array.isArray(e)?Ce.array(e,t):mr(e)?Ce.map(e,t):tn(e)?Ce.set(e,t):typeof e=="object"&&e!==null?e:Ce.box(e,t)}_u(Uu,xu);var eh={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?ey:Kh)(t,Ni(r),r.name)},map:function(t,n){var r=$i(n);return new sc(t,Ni(r),r.name)},set:function(t,n){var r=$i(n);return new ac(t,Ni(r),r.name)},object:function(t,n,r){return Vn(function(){return xh(X.useProxies===!1||r?.proxy===!1?Tr({},r):Fh({},r),t,n)})},ref:Wt(Jp),shallow:Wt(Xp),deep:xu,struct:Wt(Yp)},Ce=_u(Uu,eh),Mu="computed",th="computed.struct",fs=Ts(Mu),nh=Ts(th,{equals:ze.structural}),ke=function(t,n){if(Hr(n))return fs.decorate_20223_(t,n);if(Bn(n))return Wr(t,n,fs);if(kt(t))return Wt(Ts(Mu,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=kt(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new Ot(r)};Object.assign(ke,fs);ke.struct=Wt(nh);var iu,ou,ki=0,rh=1,ih=(iu=(ou=Mi(function(){},"name"))==null?void 0:ou.configurable)!=null?iu:!1,su={value:"action",configurable:!0,writable:!1,enumerable:!1};function kn(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 Bu(e,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},ih&&(su.value=e,Gt(i,"name",su)),i}function Bu(e,t,n,r,i){var o=oh(e,t,r,i);try{return n.apply(r,i)}catch(s){throw o.error_=s,s}finally{sh(o)}}function oh(e,t,n,r){var i=Xe()&&!!e,o=0;if(i){o=Date.now();var s=r?Array.from(r):Bi;ft({type:Os,name:e,object:n,arguments:s})}var a=X.trackingDerivation,l=!t||!a;_t();var c=X.allowStateChanges;l&&(Fn(),c=Yi(!0));var d=As(!0),g={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:c,prevAllowStateReads_:d,notifySpy_:i,startTime_:o,actionId_:rh++,parentActionId_:ki};return ki=g.actionId_,g}function sh(e){ki!==e.actionId_&&ce(30),ki=e.parentActionId_,e.error_!==void 0&&(X.suppressReactionErrors=!0),Qi(e.prevAllowStateChanges_),Vr(e.prevAllowStateReads_),wt(),e.runAsAction_&&rn(e.prevDerivation_),e.notifySpy_&&dt({time:Date.now()-e.startTime_}),X.suppressReactionErrors=!1}function ah(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 uh="create",yn=function(e){function t(r,i,o,s,a){var l;return o===void 0&&(o="ObservableValue@"+It()),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()&&Ln({type:uh,object:l,observableKind:"value",debugObjectName:l.name_,newValue:""+l.value_}),l}Iu(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),vt(this)){var o=bt(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 Eu(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(vn),ch=mn("ObservableValue",yn),Ot=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 Li(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=At.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@"+It(),n.set&&(this.setter_=kn(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(){vh(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_)ds(this)&&(this.warnAboutUntrackedRead_(),_t(),this.value_=this.computeValue_(!1),wt());else if(Ku(this),ds(this)){var r=X.trackingContext;this.keepAlive_&&!r&&(X.trackingContext=this),this.trackAndCompute()&&mh(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()&&Ln({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=ku(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 Li(s)}return Qi(i),this.isComputing=!1,o},t.suspend_=function(){this.keepAlive_||(ps(this),this.value_=void 0,this.isTracing_!==At.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 St(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}),rn(c)}s=!1,a=l})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==At.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 Eu(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},vr(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)}}])}();Ot.isComputingMask_=1;Ot.isRunningSetterMask_=2;Ot.isBeingObservedMask_=4;Ot.isPendingUnobservationMask_=8;Ot.diffValueMask_=16;var Xr=mn("ComputedValue",Ot),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 At;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(At||(At={}));var Li=function(t){this.cause=void 0,this.cause=t};function Ci(e){return e instanceof Li}function ds(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=As(!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 rn(n),Vr(t),!0}if(e.dependenciesState_===Oe.STALE_)return rn(n),Vr(t),!0}}return Lu(e),rn(n),Vr(t),!1}}}function Du(){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 lh(e){!X.allowStateReads&&X.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function ku(e,t,n){var r=As(!0);Lu(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 Li(s)}return X.inBatch--,X.trackingDerivation=i,dh(e),fh(e),Vr(r),o}function fh(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 dh(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&&zu(l,e),l.diffValue=0}for(;i--;){var c=n[i];c.diffValue===1&&(c.diffValue=0,gh(c,e))}r!==Oe.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function ps(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)zu(t[n],e);e.dependenciesState_=Oe.NOT_TRACKING_}function Pe(e){var t=Fn();try{return e()}finally{rn(t)}}function Fn(){var e=X.trackingDerivation;return X.trackingDerivation=null,e}function rn(e){X.trackingDerivation=e}function As(e){var t=X.allowStateReads;return X.allowStateReads=e,t}function Vr(e){X.allowStateReads=e}function Lu(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,ju=!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(){ju||ce(35)},1),new xi)}();function ph(){if((X.pendingReactions.length||X.inBatch||X.isRunningReactions)&&ce(36),ju=!0,Ui){var e=Ki();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),X=new xi}}function Fu(){return X}function hh(e){return e.observers_&&e.observers_.size>0}function yh(e){return e.observers_}function gh(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function zu(e,t){e.observers_.delete(t),e.observers_.size===0&&Vu(e)}function Vu(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,X.pendingUnobservations.push(e))}function _t(){X.inBatch++}function wt(){if(--X.inBatch===0){Hu();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 Ot&&n.suspend_())}X.pendingUnobservations=[]}}function Ku(e){lh(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&&Vu(e),!1)}function qu(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.UP_TO_DATE_&&(t.isTracing_!==At.NONE&&Gu(t,e),t.onBecomeStale_()),t.dependenciesState_=Oe.STALE_}))}function mh(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_!==At.NONE&&Gu(t,e)):t.dependenciesState_===Oe.UP_TO_DATE_&&(e.lowestObserverState_=Oe.UP_TO_DATE_)}))}function vh(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 Gu(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===At.BREAK){var n=[];Wu(Yr(e),n,1),new Function(`debugger;
|
|
5
|
+
Use '@override' decorator for methods overridden by subclass.`)}}function bd(e){return gt(e,et)||Ai(e,et,Jt({},e[et])),e[et]}function Sn(e){return typeof e=="object"&&typeof e.kind=="string"}function Ii(e,t){t.includes(e.kind)||ae("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var ye=Symbol("mobx administration"),ar=function(){function e(r){r===void 0&&(r="Atom@"+_t()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=we.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=r}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(n){return n()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(n){return n()})},t.reportObserved=function(){return ou(this)},t.reportChanged=function(){ht(),su(this),yt()},t.toString=function(){return this.name_},en(e,[{key:"isBeingObserved",get:function(){return nt(this.flags_,e.isBeingObservedMask_)},set:function(n){this.flags_=it(this.flags_,e.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return nt(this.flags_,e.isPendingUnobservationMask_)},set:function(n){this.flags_=it(this.flags_,e.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return nt(this.flags_,e.diffValueMask_)?1:0},set:function(n){this.flags_=it(this.flags_,e.diffValueMask_,n===1)}}])}();ar.isBeingObservedMask_=1;ar.isPendingUnobservationMask_=2;ar.diffValueMask_=4;var Wo=sr("Atom",ar);function Ka(e,t,r){t===void 0&&(t=Jr),r===void 0&&(r=Jr);var n=new ar(e);return t!==Jr&&rn(n,t),r!==Jr&&Pr(n,r),n}function _d(e,t){return e===t}function wd(e,t){return ts(e,t)}function Td(e,t){return ts(e,t,1)}function Ad(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Be={identity:_d,structural:wd,default:Ad,shallow:Td};function Or(e,t,r){return Qr(e)?e:Array.isArray(e)?Re.array(e,{name:r}):$t(e)?Re.object(e,void 0,{name:r}):Zr(e)?Re.map(e,{name:r}):Gt(e)?Re.set(e,{name:r}):typeof e=="function"&&!or(e)&&!On(e)?Ba(e)?Yr(e):An(r,e):e}function Od(e,t,r){if(e==null||Sr(e)||nn(e)||jt(e)||Et(e))return e;if(Array.isArray(e))return Re.array(e,{name:r,deep:!1});if($t(e))return Re.object(e,void 0,{name:r,deep:!1});if(Zr(e))return Re.map(e,{name:r,deep:!1});if(Gt(e))return Re.set(e,{name:r,deep:!1});ae("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Ei(e){return e}function Id(e,t){return Qr(e)&&ae("observable.struct should not be used with observable values"),ts(e,t)?t:e}var Ed="override";function hi(e){return e.annotationType_===Ed}function Rn(e,t){return{annotationType_:e,options_:t,make_:Sd,extend_:Rd,decorate_20223_:Pd}}function Sd(e,t,r,n){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(e,t,r,!1)===null?0:1;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if(or(r.value))return 1;var s=Va(e,this,t,r,!1);return Bt(n,t,s),2}function Rd(e,t,r,n){var i=Va(e,this,t,r);return e.defineProperty_(t,i,n)}function Pd(e,t){Ii(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,s=this,o=function(c){var d,g,x,S;return Ir((d=(g=s.options_)==null?void 0:g.name)!=null?d:n.toString(),c,(x=(S=s.options_)==null?void 0:S.autoAction)!=null?x:!1)};if(r=="field")return function(l){var c,d=l;return or(d)||(d=o(d)),(c=s.options_)!=null&&c.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(r=="method"){var a;return or(e)||(e=o(e)),(a=this.options_)!=null&&a.bound&&i(function(){var l=this,c=l[n].bind(l);c.isMobxAction=!0,l[n]=c}),e}ae("Cannot apply '"+s.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
|
|
6
|
+
'`+s.annotationType_+"' can only be used on properties with a function value."))}function $d(e,t,r,n){var i=t.annotationType_,s=n.value;Me(s)||ae("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
7
|
+
'`+i+"' can only be used on properties with a function value."))}function Va(e,t,r,n,i){var s,o,a,l,c,d,g;i===void 0&&(i=J.safeDescriptors),$d(e,t,r,n);var x=n.value;if((s=t.options_)!=null&&s.bound){var S;x=x.bind((S=e.proxy_)!=null?S:e.target_)}return{value:Ir((o=(a=t.options_)==null?void 0:a.name)!=null?o:r.toString(),x,(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 za(e,t){return{annotationType_:e,options_:t,make_:Nd,extend_:Cd,decorate_20223_:xd}}function Nd(e,t,r,n){var i;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!gt(e.target_,t)||!On(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(On(r.value))return 1;var s=qa(e,this,t,r,!1,!1);return Bt(n,t,s),2}function Cd(e,t,r,n){var i,s=qa(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,s,n)}function xd(e,t){var r;Ii(t,["method"]);var n=t.name,i=t.addInitializer;return On(e)||(e=Yr(e)),(r=this.options_)!=null&&r.bound&&i(function(){var s=this,o=s[n].bind(s);o.isMobXFlow=!0,s[n]=o}),e}function Ud(e,t,r,n){var i=t.annotationType_,s=n.value;Me(s)||ae("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
8
|
+
'`+i+"' can only be used on properties with a generator function value."))}function qa(e,t,r,n,i,s){s===void 0&&(s=J.safeDescriptors),Ud(e,t,r,n);var o=n.value;if(On(o)||(o=Yr(o)),i){var a;o=o.bind((a=e.proxy_)!=null?a:e.target_),o.isMobXFlow=!0}return{value:o,configurable:s?e.isPlainObject_:!0,enumerable:!1,writable:!s}}function Ho(e,t){return{annotationType_:e,options_:t,make_:Md,extend_:Dd,decorate_20223_:Bd}}function Md(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Dd(e,t,r,n){return Ld(e,this,t,r),e.defineComputedProperty_(t,Jt({},this.options_,{get:r.get,set:r.set}),n)}function Bd(e,t){Ii(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var s=on(this)[ye],o=Jt({},r.options_,{get:e,context:this});o.name||(o.name=s.name_+"."+n.toString()),s.values_.set(n,new vt(o))}),function(){return this[ye].getObservablePropValue_(n)}}function Ld(e,t,r,n){var i=t.annotationType_,s=n.get;s||ae("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
9
|
+
'`+i+"' can only be used on getter(+setter) properties."))}function Si(e,t){return{annotationType_:e,options_:t,make_:jd,extend_:kd,decorate_20223_:Fd}}function jd(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function kd(e,t,r,n){var i,s;return Kd(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(s=this.options_)==null?void 0:s.enhancer)!=null?i:Or,n)}function Fd(e,t){if(t.kind==="field")throw ae("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");Ii(t,["accessor"]);var r=this,n=t.kind,i=t.name,s=new WeakSet;function o(a,l){var c,d,g=on(a)[ye],x=new ir(l,(c=(d=r.options_)==null?void 0:d.enhancer)!=null?c:Or,g.name_+"."+i.toString(),!1);g.values_.set(i,x),s.add(a)}if(n=="accessor")return{get:function(){return s.has(this)||o(this,e.get.call(this)),this[ye].getObservablePropValue_(i)},set:function(l){return s.has(this)||o(this,l),this[ye].setObservablePropValue_(i,l)},init:function(l){return s.has(this)||o(this,l),l}}}function Kd(e,t,r,n){var i=t.annotationType_;"value"in n||ae("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
10
|
+
'`+i+"' cannot be used on getter/setter properties"))}var Vd="true",zd=Ga();function Ga(e){return{annotationType_:Vd,options_:e,make_:qd,extend_:Gd,decorate_20223_:Wd}}function qd(e,t,r,n){var i,s;if(r.get)return xe.make_(e,t,r,n);if(r.set){var o=Ir(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:J.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(Bt(n,t,{configurable:!0,set:o}),2)}if(n!==e.target_&&typeof r.value=="function"){var a;if(Ba(r.value)){var l,c=(l=this.options_)!=null&&l.autoBind?Yr.bound:Yr;return c.make_(e,t,r,n)}var d=(a=this.options_)!=null&&a.autoBind?An.bound:An;return d.make_(e,t,r,n)}var g=((i=this.options_)==null?void 0:i.deep)===!1?Re.ref:Re;if(typeof r.value=="function"&&(s=this.options_)!=null&&s.autoBind){var x;r.value=r.value.bind((x=e.proxy_)!=null?x:e.target_)}return g.make_(e,t,r,n)}function Gd(e,t,r,n){var i,s;if(r.get)return xe.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:J.safeDescriptors?e.isPlainObject_:!0,set:Ir(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var o;r.value=r.value.bind((o=e.proxy_)!=null?o:e.target_)}var a=((s=this.options_)==null?void 0:s.deep)===!1?Re.ref:Re;return a.extend_(e,t,r,n)}function Wd(e,t){ae("'"+this.annotationType_+"' cannot be used as a decorator")}var Hd="observable",Jd="observable.ref",Xd="observable.shallow",Yd="observable.struct",Wa={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Wa);function oi(e){return e||Wa}var Do=Si(Hd),Qd=Si(Jd,{enhancer:Ei}),Zd=Si(Xd,{enhancer:Od}),ep=Si(Yd,{enhancer:Id}),Ha=Lt(Do);function si(e){return e.deep===!0?Or:e.deep===!1?Ei:rp(e.defaultDecorator)}function tp(e){var t;return e?(t=e.defaultDecorator)!=null?t:Ga(e):void 0}function rp(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:Or}function Ja(e,t,r){if(Sn(t))return Do.decorate_20223_(e,t);if(Ar(t)){En(e,t,Do);return}return Qr(e)?e:$t(e)?Re.object(e,t,r):Array.isArray(e)?Re.array(e,t):Zr(e)?Re.map(e,t):Gt(e)?Re.set(e,t):typeof e=="object"&&e!==null?e:Re.box(e,t)}Ma(Ja,Ha);var np={box:function(t,r){var n=oi(r);return new ir(t,si(n),n.name,!0,n.equals)},array:function(t,r){var n=oi(r);return(J.useProxies===!1||n.proxy===!1?nh:Wp)(t,si(n),n.name)},map:function(t,r){var n=oi(r);return new wu(t,si(n),n.name)},set:function(t,r){var n=oi(r);return new Tu(t,si(n),n.name)},object:function(t,r,n){return $r(function(){return Dp(J.useProxies===!1||n?.proxy===!1?on({},n):zp({},n),t,r)})},ref:Lt(Qd),shallow:Lt(Zd),deep:Ha,struct:Lt(ep)},Re=Ma(Ja,np),Xa="computed",ip="computed.struct",Bo=Ho(Xa),op=Ho(ip,{equals:Be.structural}),xe=function(t,r){if(Sn(r))return Bo.decorate_20223_(t,r);if(Ar(r))return En(t,r,Bo);if($t(t))return Lt(Ho(Xa,t));Me(t)||ae("First argument to `computed` should be an expression."),Me(r)&&ae("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var n=$t(r)?r:{};return n.get=t,n.name||(n.name=t.name||""),new vt(n)};Object.assign(xe,Bo);xe.struct=Lt(op);var ba,_a,yi=0,sp=1,ap=(ba=(_a=di(function(){},"name"))==null?void 0:_a.configurable)!=null?ba:!1,wa={value:"action",configurable:!0,writable:!1,enumerable:!1};function Ir(e,t,r,n){r===void 0&&(r=!1),Me(t)||ae("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&ae("actions should have valid names, got: '"+e+"'");function i(){return Ya(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},ap&&(wa.value=e,Bt(i,"name",wa)),i}function Ya(e,t,r,n,i){var s=up(e,t,n,i);try{return r.apply(n,i)}catch(o){throw s.error_=o,o}finally{cp(s)}}function up(e,t,r,n){var i=qe()&&!!e,s=0;if(i){s=Date.now();var o=n?Array.from(n):pi;ot({type:Xo,name:e,object:r,arguments:o})}var a=J.trackingDerivation,l=!t||!a;ht();var c=J.allowStateChanges;l&&(Rr(),c=Ri(!0));var d=Jo(!0),g={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:c,prevAllowStateReads_:d,notifySpy_:i,startTime_:s,actionId_:sp++,parentActionId_:yi};return yi=g.actionId_,g}function cp(e){yi!==e.actionId_&&ae(30),yi=e.parentActionId_,e.error_!==void 0&&(J.suppressReactionErrors=!0),Pi(e.prevAllowStateChanges_),Tn(e.prevAllowStateReads_),yt(),e.runAsAction_&&Ht(e.prevDerivation_),e.notifySpy_&&st({time:Date.now()-e.startTime_}),J.suppressReactionErrors=!1}function lp(e,t){var r=Ri(e);try{return t()}finally{Pi(r)}}function Ri(e){var t=J.allowStateChanges;return J.allowStateChanges=e,t}function Pi(e){J.allowStateChanges=e}var fp="create",ir=function(e){function t(n,i,s,o,a){var l;return s===void 0&&(s="ObservableValue@"+_t()),o===void 0&&(o=!0),a===void 0&&(a=Be.default),l=e.call(this,s)||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_=s,l.equals=a,l.value_=i(n,void 0,s),o&&qe()&&Er({type:fp,object:l,observableKind:"value",debugObjectName:l.name_,newValue:""+l.value_}),l}Fa(t,e);var r=t.prototype;return r.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},r.set=function(i){var s=this.value_;if(i=this.prepareNewValue_(i),i!==J.UNCHANGED){var o=qe();o&&ot({type:St,object:this,observableKind:"value",debugObjectName:this.name_,newValue:i,oldValue:s}),this.setNewValue_(i),o&&st()}},r.prepareNewValue_=function(i){if(Dt(this),dt(this)){var s=pt(this,{object:this,type:St,newValue:i});if(!s)return J.UNCHANGED;i=s.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?J.UNCHANGED:i},r.setNewValue_=function(i){var s=this.value_;this.value_=i,this.reportChanged(),Rt(this)&&Pt(this,{type:St,object:this,newValue:i,oldValue:s})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(i){return Cn(this,i)},r.observe_=function(i,s){return s&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:St,newValue:this.value_,oldValue:void 0}),xn(this,i)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return ka(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(ar),dp=sr("ObservableValue",ir),vt=function(){function e(r){this.dependenciesState_=we.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=we.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new gi(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=mt.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,r.get||ae(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+_t(),r.set&&(this.setter_=Ir(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Be.structural:Be.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){wp(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(n){return n()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(n){return n()})},t.get=function(){if(this.isComputing&&ae(32,this.name_,this.derivation),J.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Lo(this)&&(this.warnAboutUntrackedRead_(),ht(),this.value_=this.computeValue_(!1),yt());else if(ou(this),Lo(this)){var n=J.trackingContext;this.keepAlive_&&!n&&(J.trackingContext=this),this.trackAndCompute()&&_p(this),J.trackingContext=n}var i=this.value_;if(ci(i))throw i.cause;return i},t.set=function(n){if(this.setter_){this.isRunningSetter&&ae(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,n)}finally{this.isRunningSetter=!1}}else ae(34,this.name_)},t.trackAndCompute=function(){var n=this.value_,i=this.dependenciesState_===we.NOT_TRACKING_,s=this.computeValue_(!0),o=i||ci(n)||ci(s)||!this.equals_(n,s);return o&&(this.value_=s,qe()&&Er({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:n,newValue:s})),o},t.computeValue_=function(n){this.isComputing=!0;var i=Ri(!1),s;if(n)s=Za(this,this.derivation,this.scope_);else if(J.disableErrorBoundaries===!0)s=this.derivation.call(this.scope_);else try{s=this.derivation.call(this.scope_)}catch(o){s=new gi(o)}return Pi(i),this.isComputing=!1,s},t.suspend_=function(){this.keepAlive_||(jo(this),this.value_=void 0,this.isTracing_!==mt.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(n,i){var s=this,o=!0,a=void 0;return wt(function(){var l=s.get();if(!o||i){var c=Rr();n({observableKind:"computed",debugObjectName:s.name_,type:St,object:s,newValue:l,oldValue:a}),Ht(c)}o=!1,a=l})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==mt.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_:J.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 ka(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},en(e,[{key:"isComputing",get:function(){return nt(this.flags_,e.isComputingMask_)},set:function(n){this.flags_=it(this.flags_,e.isComputingMask_,n)}},{key:"isRunningSetter",get:function(){return nt(this.flags_,e.isRunningSetterMask_)},set:function(n){this.flags_=it(this.flags_,e.isRunningSetterMask_,n)}},{key:"isBeingObserved",get:function(){return nt(this.flags_,e.isBeingObservedMask_)},set:function(n){this.flags_=it(this.flags_,e.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return nt(this.flags_,e.isPendingUnobservationMask_)},set:function(n){this.flags_=it(this.flags_,e.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return nt(this.flags_,e.diffValueMask_)?1:0},set:function(n){this.flags_=it(this.flags_,e.diffValueMask_,n===1)}}])}();vt.isComputingMask_=1;vt.isRunningSetterMask_=2;vt.isBeingObservedMask_=4;vt.isPendingUnobservationMask_=8;vt.diffValueMask_=16;var Pn=sr("ComputedValue",vt),we;(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_"})(we||(we={}));var mt;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(mt||(mt={}));var gi=function(t){this.cause=void 0,this.cause=t};function ci(e){return e instanceof gi}function Lo(e){switch(e.dependenciesState_){case we.UP_TO_DATE_:return!1;case we.NOT_TRACKING_:case we.STALE_:return!0;case we.POSSIBLY_STALE_:{for(var t=Jo(!0),r=Rr(),n=e.observing_,i=n.length,s=0;s<i;s++){var o=n[s];if(Pn(o)){if(J.disableErrorBoundaries)o.get();else try{o.get()}catch{return Ht(r),Tn(t),!0}if(e.dependenciesState_===we.STALE_)return Ht(r),Tn(t),!0}}return eu(e),Ht(r),Tn(t),!1}}}function Qa(){return J.trackingDerivation!==null}function Dt(e){var t=e.observers_.size>0;!J.allowStateChanges&&(t||J.enforceActions==="always")&&console.warn("[MobX] "+(J.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 pp(e){!J.allowStateReads&&J.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Za(e,t,r){var n=Jo(!0);eu(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++J.runId;var i=J.trackingDerivation;J.trackingDerivation=e,J.inBatch++;var s;if(J.disableErrorBoundaries===!0)s=t.call(r);else try{s=t.call(r)}catch(o){s=new gi(o)}return J.inBatch--,J.trackingDerivation=i,yp(e),hp(e),Tn(n),s}function hp(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:J.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function yp(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=we.UP_TO_DATE_,i=0,s=e.unboundDepsCount_,o=0;o<s;o++){var a=r[o];a.diffValue===0&&(a.diffValue=1,i!==o&&(r[i]=a),i++),a.dependenciesState_>n&&(n=a.dependenciesState_)}for(r.length=i,e.newObserving_=null,s=t.length;s--;){var l=t[s];l.diffValue===0&&nu(l,e),l.diffValue=0}for(;i--;){var c=r[i];c.diffValue===1&&(c.diffValue=0,bp(c,e))}n!==we.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function jo(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)nu(t[r],e);e.dependenciesState_=we.NOT_TRACKING_}function Se(e){var t=Rr();try{return e()}finally{Ht(t)}}function Rr(){var e=J.trackingDerivation;return J.trackingDerivation=null,e}function Ht(e){J.trackingDerivation=e}function Jo(e){var t=J.allowStateReads;return J.allowStateReads=e,t}function Tn(e){J.allowStateReads=e}function eu(e){if(e.dependenciesState_!==we.UP_TO_DATE_){e.dependenciesState_=we.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=we.UP_TO_DATE_}}var li=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},fi=!0,tu=!1,J=function(){var e=wi();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(fi=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new li().version&&(fi=!1),fi?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new li):(setTimeout(function(){tu||ae(35)},1),new li)}();function gp(){if((J.pendingReactions.length||J.inBatch||J.isRunningReactions)&&ae(36),tu=!0,fi){var e=wi();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),J=new li}}function ru(){return J}function mp(e){return e.observers_&&e.observers_.size>0}function vp(e){return e.observers_}function bp(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function nu(e,t){e.observers_.delete(t),e.observers_.size===0&&iu(e)}function iu(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,J.pendingUnobservations.push(e))}function ht(){J.inBatch++}function yt(){if(--J.inBatch===0){cu();for(var e=J.pendingUnobservations,t=0;t<e.length;t++){var r=e[t];r.isPendingUnobservation=!1,r.observers_.size===0&&(r.isBeingObserved&&(r.isBeingObserved=!1,r.onBUO()),r instanceof vt&&r.suspend_())}J.pendingUnobservations=[]}}function ou(e){pp(e);var t=J.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&J.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&J.inBatch>0&&iu(e),!1)}function su(e){e.lowestObserverState_!==we.STALE_&&(e.lowestObserverState_=we.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===we.UP_TO_DATE_&&(t.isTracing_!==mt.NONE&&au(t,e),t.onBecomeStale_()),t.dependenciesState_=we.STALE_}))}function _p(e){e.lowestObserverState_!==we.STALE_&&(e.lowestObserverState_=we.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===we.POSSIBLY_STALE_?(t.dependenciesState_=we.STALE_,t.isTracing_!==mt.NONE&&au(t,e)):t.dependenciesState_===we.UP_TO_DATE_&&(e.lowestObserverState_=we.UP_TO_DATE_)}))}function wp(e){e.lowestObserverState_===we.UP_TO_DATE_&&(e.lowestObserverState_=we.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===we.UP_TO_DATE_&&(t.dependenciesState_=we.POSSIBLY_STALE_,t.onBecomeStale_())}))}function au(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===mt.BREAK){var r=[];uu($n(e),r,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 vt?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
19
19
|
|
|
20
20
|
The dependencies for this derivation are:
|
|
21
21
|
|
|
22
|
-
`+
|
|
22
|
+
`+r.join(`
|
|
23
23
|
`)+`
|
|
24
24
|
*/
|
|
25
|
-
`)()}}function Wu(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 Wu(r,t,n+1)})}var Lt=function(){function e(n,r,i,o){n===void 0&&(n="Reaction@"+It()),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_=At.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),Hu())},t.runReaction_=function(){if(!this.isDisposed){_t(),this.isScheduled=!1;var r=X.trackingContext;if(X.trackingContext=this,ds(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&Xe()&&Ln({name:this.name_,type:"scheduled-reaction"})}catch(i){this.reportExceptionInDerivation_(i)}}X.trackingContext=r,wt()}},t.track=function(r){if(!this.isDisposed){_t();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=ku(this,r,void 0);X.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&ps(this),Ci(a)&&this.reportExceptionInDerivation_(a.cause),i&&dt({time:Date.now()-o}),wt()}},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()&&Ln({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||(_t(),ps(this),wt()))},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),Es(this,r)},vr(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)}}])}();Lt.isDisposedMask_=1;Lt.isScheduledMask_=2;Lt.isTrackPendingMask_=4;Lt.isRunningMask_=8;Lt.diffValueMask_=16;var au=100,hs=function(t){return t()};function Hu(){X.inBatch>0||X.isRunningReactions||hs(bh)}function bh(){X.isRunningReactions=!0;for(var e=X.pendingReactions,t=0;e.length>0;){++t===au&&(console.error("Reaction doesn't converge to a stable state after "+au+" 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",Lt);function _h(e){var t=hs;hs=function(r){return e(function(){return t(r)})}}function Xe(){return!!X.spyListeners.length}function Ln(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=on({},e,{spyReportStart:!0});Ln(t)}var wh={type:"report-end",spyReportEnd:!0};function dt(e){Ln(e?on({},e,{type:"report-end",spyReportEnd:!0}):wh)}function Th(e){return X.spyListeners.push(e),_s(function(){X.spyListeners=X.spyListeners.filter(function(t){return t!==e})})}var Os="action",Ah="action.bound",Ju="autoAction",Oh="autoAction.bound",Xu="<unnamed action>",ys=Jr(Os),Eh=Jr(Ah,{bound:!0}),gs=Jr(Ju,{autoAction:!0}),Ih=Jr(Oh,{autoAction:!0,bound:!0});function Yu(e){var t=function(r,i){if(je(r))return kn(r.name||Xu,r,e);if(je(i))return kn(r,i,e);if(Hr(i))return(e?gs:ys).decorate_20223_(r,i);if(Bn(i))return Wr(r,i,e?gs:ys);if(Bn(r))return Wt(Jr(e?Ju:Os,{name:r,autoAction:e}));ce("Invalid arguments for `action`")};return t}var at=Yu(!1);Object.assign(at,ys);var Kr=Yu(!0);Object.assign(Kr,gs);at.bound=Wt(Eh);Kr.bound=Wt(Ih);function br(e){return Bu(e.name||Xu,!1,e,this,void 0)}function gn(e){return je(e)&&e.isMobxAction===!0}function St(e,t){var n,r,i,o;t===void 0&&(t=bs),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@"+It(),a=!t.scheduler&&!t.delay,l;if(a)l=new Lt(s,function(){this.track(g)},t.onError,t.requiresObservable);else{var c=Qu(t),d=!1;l=new Lt(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 Sh=function(t){return t()};function Qu(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Sh}function Zu(e,t,n){var r,i,o;n===void 0&&(n=bs),(!je(e)||!je(t))&&ce("First and second argument to reaction should be functions"),kt(n)||ce("Third argument of reactions should be an object");var s=(r=n.name)!=null?r:"Reaction@"+It(),a=at(s,n.onError?$h(n.onError,t):t),l=!n.scheduler&&!n.delay,c=Qu(n),d=!0,g=!1,C,I=n.compareStructural?ze.structural:n.equals||ze.default,S=new Lt(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 L=ah(!1,function(){return e(S)});J=d||!I(C,L),C=L}),(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 $h(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}var Nh="onBO",Rh="onBUO";function _r(e,t,n){return ec(Nh,e,t,n)}function zn(e,t,n){return ec(Rh,e,t,n)}function ec(e,t,n,r){var i=typeof r=="function"?Et(t,n):Et(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",Ri="always",Ch="observed";function tc(e){e.isolateGlobalState===!0&&ph();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(X.useProxies=t===Ri?!0:t===Ph?!1:typeof Proxy<"u"),t==="ifavailable"&&(X.verifyProxies=!0),n!==void 0){var r=n===Ri?Ri:n===Ch;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&&_h(e.reactionScheduler)}function xh(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"),kt(t)||ce("'extendObservable' only accepts plain objects as second argument"),(gr(t)||gr(n))&&ce("Extending an object with another observable (object) is not supported");var i=fp(t);return Vn(function(){var o=Tr(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 nc(Et(e,t))}function nc(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Uh(e.observing_).map(nc)),t}function Qr(e,t){return rc(Et(e,t))}function rc(e){var t={name:e.name_};return hh(e)&&(t.observers=Array.from(yh(e)).map(rc)),t}function Uh(e){return Array.from(new Set(e))}var Mh=0;function ic(){this.message="FLOW_CANCELLED"}ic.prototype=Object.create(Error.prototype);var ss=Nu("flow"),Bh=Nu("flow.bound",{bound:!0}),yr=Object.assign(function(t,n){if(Hr(n))return ss.decorate_20223_(t,n);if(Bn(n))return Wr(t,n,ss);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=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 L(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,L))}F(void 0)});return I.cancel=at(i+" - runid: "+c+" - cancel",function(){try{C&&uu(C);var S=d.return(void 0),z=Promise.resolve(S.value);z.then(pr,pr),uu(z),g(new ic)}catch(J){g(J)}}),I};return o.isMobXFlow=!0,o},ss);yr.bound=Wt(Bh);function uu(e){je(e.cancel)&&e.cancel()}function qr(e){return e?.isMobXFlow===!0}function Dh(e,t){return e?t!==void 0?Ht(e)||wr(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]||ws(e)||ji(e)||Xr(e):!1}function gr(e){return arguments.length!==1&&ce("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),Dh(e)}function kh(e){if(jn(e))return e[ve].ownKeys_();ce(38)}function Pi(e,t,n){return e.set(t,n),n}function dr(e,t){if(e==null||typeof e!="object"||e instanceof Date||!gr(e))return e;if(ch(e)||Xr(e))return dr(e.get(),t);if(t.has(e))return t.get(e);if(wr(e)){var n=Pi(t,e,new Array(e.length));return e.forEach(function(s,a){n[a]=dr(s,t)}),n}if(Ut(e)){var r=Pi(t,e,new Set);return e.forEach(function(s){r.add(dr(s,t))}),r}if(Ht(e)){var i=Pi(t,e,new Map);return e.forEach(function(s,a){i.set(a,dr(s,t))}),i}else{var o=Pi(t,e,{});return kh(e).forEach(function(s){Gr.propertyIsEnumerable.call(e,s)&&(o[s]=dr(e[s],t))}),o}}function sn(e,t){return t&&ce("toJS no longer supports options"),dr(e,new Map)}function Es(){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=Lh(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_===At.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?At.BREAK:At.LOG}function Lh(e){switch(e.length){case 0:return X.trackingDerivation;case 1:return Et(e[0]);case 2:return Et(e[0],e[1])}}function nn(e,t){t===void 0&&(t=void 0),_t();try{return e.apply(t)}finally{wt()}}function Mn(e){return e[ve]}var jh={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 Fh(e,t){var n,r;return wu(),e=Tr(e,t),(r=(n=e[ve]).proxy_)!=null?r:n.proxy_=new Proxy(e,jh)}function vt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Zr(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),_s(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function bt(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{rn(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),_s(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);rn(n)}}function bn(e,t,n){return Vn(function(){var r,i=Tr(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=gp(e)),Wi(t).forEach(function(o){return i.make_(o,t[o])})}),e}var cu="splice",Mt="update",zh=1e4,Vh={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)):Tt(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)}},Is=function(){function e(n,r,i,o){n===void 0&&(n="ObservableArray@"+It()),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&&lc(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),vt(this)){var l=bt(this,{object:this.proxy_,type:cu,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<zh){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:cu,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(vt(this)){var a=bt(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 Kh(e,t,n,r){return n===void 0&&(n="ObservableArray@"+It()),r===void 0&&(r=!1),wu(),Vn(function(){var i=new Is(n,t,r,!1);Au(i.values_,ve,i);var o=new Proxy(i.values_,Vh);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",oc);xe("reduceRight",oc);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 oc(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 qh=mn("ObservableArrayAdministration",Is);function wr(e){return qi(e)&&qh(e[ve])}var Gh={},hn="add",zi="delete",sc=function(){function e(n,r,i){var o=this;r===void 0&&(r=Dn),i===void 0&&(i="ObservableMap@"+It()),this.enhancer_=void 0,this.name_=void 0,this[ve]=Gh,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_=Su(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_+"."+us(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(vt(this)){var s=bt(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_),vt(this)){var o=bt(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),nn(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_),nn(function(){var c,d=new yn(i,o.enhancer_,o.name_+"."+us(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 lu({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 lu({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=hr(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)),nn(function(){kt(r)?lp(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)}):mr(r)?(cp(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;nn(function(){Pe(function(){for(var i=hr(r.keys()),o;!(o=i()).done;){var s=o.value;r.delete(s)}})})},t.replace=function(r){var i=this;return nn(function(){for(var o=Wh(r),s=new Map,a=!1,l=hr(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=hr(o.entries()),S;!(S=I()).done;){var z=S.value,J=z[0],F=z[1],L=i.data_.has(J);if(i.set(J,F),i.data_.has(J)){var K=i.data_.get(J);s.set(J,K),L||(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)},vr(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Ht=mn("ObservableMap",sc);function lu(e){return e[Symbol.toStringTag]="MapIterator",Rs(e)}function Wh(e){if(mr(e)||Ht(e))return e;if(Array.isArray(e))return new Map(e);if(kt(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return ce(21,e)}var Hh={},ac=function(){function e(n,r,i){var o=this;r===void 0&&(r=Dn),i===void 0&&(i="ObservableSet@"+It()),this.name_=void 0,this[ve]=Hh,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_=Su(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;nn(function(){Pe(function(){for(var i=hr(r.data_.values()),o;!(o=i()).done;){var s=o.value;r.delete(s)}})})},t.forEach=function(r,i){for(var o=hr(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_),vt(this)){var o=bt(this,{type:hn,object:this,newValue:r});if(!o)return this;r=o.newValue}if(!this.has(r)){nn(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(vt(this)){var o=bt(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),nn(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 fu({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 fu({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(tn(r)&&!Ut(r))return r.intersection(this);var i=new Set(this);return i.intersection(r)},t.union=function(r){if(tn(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(tn(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(tn(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)),nn(function(){Array.isArray(r)?(i.clear(),r.forEach(function(o){return i.add(o)})):tn(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()},vr(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Ut=mn("ObservableSet",ac);function fu(e){return e[Symbol.toStringTag]="SetIterator",Rs(e)}var du=Object.create(null),pu="remove",ms=function(){function e(n,r,i,o){r===void 0&&(r=new Map),o===void 0&&(o=Fp),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_=kt(this.target_),fc(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 Ot)return o.set(i),!0;if(vt(this)){var s=bt(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&&!Tt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,i,o){return o===void 0&&(o=!1),Tt(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_+"."+us(r)+"?",!1),this.pendingKeys_.set(r,i)),i.get()},t.make_=function(r,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(gu(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)}yu(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);gu(this,o,r);var a=o.extend_(this,r,i,s);return a&&yu(this,o,r),a},t.defineProperty_=function(r,i,o){o===void 0&&(o=!1),qt(this.keysAtom_);try{_t();var s=this.delete_(r);if(!s)return s;if(vt(this)){var a=bt(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=on({},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{wt()}return!0},t.defineObservableProperty_=function(r,i,o,s){s===void 0&&(s=!1),qt(this.keysAtom_);try{_t();var a=this.delete_(r);if(!a)return a;if(vt(this)){var l=bt(this,{object:this.proxy_||this.target_,name:r,type:hn,newValue:i});if(!l)return null;i=l.newValue}var c=hu(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{wt()}return!0},t.defineComputedProperty_=function(r,i,o){o===void 0&&(o=!1),qt(this.keysAtom_);try{_t();var s=this.delete_(r);if(!s)return s;if(vt(this)){var a=bt(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=hu(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 Ot(i)),this.notifyPropertyAddition_(r,void 0)}finally{wt()}return!0},t.delete_=function(r,i){if(i===void 0&&(i=!1),qt(this.keysAtom_),!Tt(this.target_,r))return!0;if(vt(this)){var o=bt(this,{object:this.proxy_||this.target_,name:r,type:pu});if(!o)return null}try{var s;_t();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_),qu(c)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(r in this.target_),a||l){var C={type:pu,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};l&&ft(C),a&&Dt(this,C),l&&dt()}}finally{wt()}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 Tr(e,t){var n;if(t&&jn(e)&&ce("Options can't be provided for already observable objects."),Tt(e,ve))return $s(e)instanceof ms||ce("Cannot convert '"+Vi(e)+`' into observable object:
|
|
25
|
+
`)()}}function uu(e,t,r){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+" ".repeat(r-1)+e.name),e.dependencies&&e.dependencies.forEach(function(n){return uu(n,t,r+1)})}var Nt=function(){function e(r,n,i,s){r===void 0&&(r="Reaction@"+_t()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=we.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=mt.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=s}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,J.pendingReactions.push(this),cu())},t.runReaction_=function(){if(!this.isDisposed){ht(),this.isScheduled=!1;var n=J.trackingContext;if(J.trackingContext=this,Lo(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&qe()&&Er({name:this.name_,type:"scheduled-reaction"})}catch(i){this.reportExceptionInDerivation_(i)}}J.trackingContext=n,yt()}},t.track=function(n){if(!this.isDisposed){ht();var i=qe(),s;i&&(s=Date.now(),ot({name:this.name_,type:"reaction"})),this.isRunning=!0;var o=J.trackingContext;J.trackingContext=this;var a=Za(this,n,void 0);J.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&jo(this),ci(a)&&this.reportExceptionInDerivation_(a.cause),i&&st({time:Date.now()-s}),yt()}},t.reportExceptionInDerivation_=function(n){var i=this;if(this.errorHandler_){this.errorHandler_(n,this);return}if(J.disableErrorBoundaries)throw n;var s="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";J.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(s,n),qe()&&Er({type:"error",name:this.name_,message:s,error:""+n}),J.globalReactionErrorHandlers.forEach(function(o){return o(n,i)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(ht(),jo(this),yt()))},t.getDisposer_=function(n){var i=this,s=function o(){i.dispose(),n==null||n.removeEventListener==null||n.removeEventListener("abort",o)};return n==null||n.addEventListener==null||n.addEventListener("abort",s),s[ye]=this,s},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(n){n===void 0&&(n=!1),Yo(this,n)},en(e,[{key:"isDisposed",get:function(){return nt(this.flags_,e.isDisposedMask_)},set:function(n){this.flags_=it(this.flags_,e.isDisposedMask_,n)}},{key:"isScheduled",get:function(){return nt(this.flags_,e.isScheduledMask_)},set:function(n){this.flags_=it(this.flags_,e.isScheduledMask_,n)}},{key:"isTrackPending",get:function(){return nt(this.flags_,e.isTrackPendingMask_)},set:function(n){this.flags_=it(this.flags_,e.isTrackPendingMask_,n)}},{key:"isRunning",get:function(){return nt(this.flags_,e.isRunningMask_)},set:function(n){this.flags_=it(this.flags_,e.isRunningMask_,n)}},{key:"diffValue",get:function(){return nt(this.flags_,e.diffValueMask_)?1:0},set:function(n){this.flags_=it(this.flags_,e.diffValueMask_,n===1)}}])}();Nt.isDisposedMask_=1;Nt.isScheduledMask_=2;Nt.isTrackPendingMask_=4;Nt.isRunningMask_=8;Nt.diffValueMask_=16;var Ta=100,ko=function(t){return t()};function cu(){J.inBatch>0||J.isRunningReactions||ko(Tp)}function Tp(){J.isRunningReactions=!0;for(var e=J.pendingReactions,t=0;e.length>0;){++t===Ta&&(console.error("Reaction doesn't converge to a stable state after "+Ta+" iterations."+(" Probably there is a cycle in the reactive function: "+e[0])),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}J.isRunningReactions=!1}var mi=sr("Reaction",Nt);function Ap(e){var t=ko;ko=function(n){return e(function(){return t(n)})}}function qe(){return!!J.spyListeners.length}function Er(e){if(J.spyListeners.length)for(var t=J.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function ot(e){var t=Jt({},e,{spyReportStart:!0});Er(t)}var Op={type:"report-end",spyReportEnd:!0};function st(e){Er(e?Jt({},e,{type:"report-end",spyReportEnd:!0}):Op)}function Ip(e){return J.spyListeners.push(e),Go(function(){J.spyListeners=J.spyListeners.filter(function(t){return t!==e})})}var Xo="action",Ep="action.bound",lu="autoAction",Sp="autoAction.bound",fu="<unnamed action>",Fo=Rn(Xo),Rp=Rn(Ep,{bound:!0}),Ko=Rn(lu,{autoAction:!0}),Pp=Rn(Sp,{autoAction:!0,bound:!0});function du(e){var t=function(n,i){if(Me(n))return Ir(n.name||fu,n,e);if(Me(i))return Ir(n,i,e);if(Sn(i))return(e?Ko:Fo).decorate_20223_(n,i);if(Ar(i))return En(n,i,e?Ko:Fo);if(Ar(n))return Lt(Rn(e?lu:Xo,{name:n,autoAction:e}));ae("Invalid arguments for `action`")};return t}var tt=du(!1);Object.assign(tt,Fo);var An=du(!0);Object.assign(An,Ko);tt.bound=Lt(Rp);An.bound=Lt(Pp);function tn(e){return Ya(e.name||fu,!1,e,this,void 0)}function or(e){return Me(e)&&e.isMobxAction===!0}function wt(e,t){var r,n,i,s;t===void 0&&(t=qo),Me(e)||ae("Autorun expects a function as first argument"),or(e)&&ae("Autorun does not accept actions since actions are untrackable");var o=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+_t(),a=!t.scheduler&&!t.delay,l;if(a)l=new Nt(o,function(){this.track(g)},t.onError,t.requiresObservable);else{var c=pu(t),d=!1;l=new Nt(o,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_((s=t)==null?void 0:s.signal)}var $p=function(t){return t()};function pu(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:$p}function hu(e,t,r){var n,i,s;r===void 0&&(r=qo),(!Me(e)||!Me(t))&&ae("First and second argument to reaction should be functions"),$t(r)||ae("Third argument of reactions should be an object");var o=(n=r.name)!=null?n:"Reaction@"+_t(),a=tt(o,r.onError?Np(r.onError,t):t),l=!r.scheduler&&!r.delay,c=pu(r),d=!0,g=!1,x,S=r.compareStructural?Be.structural:r.equals||Be.default,R=new Nt(o,function(){d||l?K():g||(g=!0,c(K))},r.onError,r.requiresObservable);function K(){if(g=!1,!R.isDisposed){var H=!1,F=x;R.track(function(){var j=lp(!1,function(){return e(R)});H=d||!S(x,j),x=j}),(d&&r.fireImmediately||!d&&H)&&a(x,F,R),d=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||R.schedule_(),R.getDisposer_((s=r)==null?void 0:s.signal)}function Np(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var Cp="onBO",xp="onBUO";function rn(e,t,r){return yu(Cp,e,t,r)}function Pr(e,t,r){return yu(xp,e,t,r)}function yu(e,t,r,n){var i=typeof n=="function"?bt(t,r):bt(t),s=Me(n)?n:r,o=e+"L";return i[o]?i[o].add(s):i[o]=new Set([s]),function(){var a=i[o];a&&(a.delete(s),a.size===0&&delete i[o])}}var Up="never",ai="always",Mp="observed";function gu(e){e.isolateGlobalState===!0&&gp();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(J.useProxies=t===ai?!0:t===Up?!1:typeof Proxy<"u"),t==="ifavailable"&&(J.verifyProxies=!0),r!==void 0){var n=r===ai?ai:r===Mp;J.enforceActions=n,J.allowStateChanges=!(n===!0||n===ai)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(J[i]=!!e[i])}),J.allowStateReads=!J.observableRequiresReaction,J.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&Ap(e.reactionScheduler)}function Dp(e,t,r,n){arguments.length>4&&ae("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&ae("'extendObservable' expects an object as first argument"),jt(e)&&ae("'extendObservable' should not be used on maps, use map.merge instead"),$t(t)||ae("'extendObservable' only accepts plain objects as second argument"),(Qr(t)||Qr(r))&&ae("Extending an object with another observable (object) is not supported");var i=hd(t);return $r(function(){var s=on(e,n)[ye];Oi(i).forEach(function(o){s.extend_(o,i[o],r&&o in r?r[o]:!0)})}),e}function $n(e,t){return mu(bt(e,t))}function mu(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Bp(e.observing_).map(mu)),t}function Nn(e,t){return vu(bt(e,t))}function vu(e){var t={name:e.name_};return mp(e)&&(t.observers=Array.from(vp(e)).map(vu)),t}function Bp(e){return Array.from(new Set(e))}var Lp=0;function bu(){this.message="FLOW_CANCELLED"}bu.prototype=Object.create(Error.prototype);var Co=za("flow"),jp=za("flow.bound",{bound:!0}),Yr=Object.assign(function(t,r){if(Sn(r))return Co.decorate_20223_(t,r);if(Ar(r))return En(t,r,Co);arguments.length!==1&&ae("Flow expects single argument with generator function");var n=t,i=n.name||"<unnamed flow>",s=function(){var a=this,l=arguments,c=++Lp,d=tt(i+" - runid: "+c+" - init",n).apply(a,l),g,x=void 0,S=new Promise(function(R,K){var H=0;g=K;function F(G){x=void 0;var k;try{k=tt(i+" - runid: "+c+" - yield "+H++,d.next).call(d,G)}catch(Q){return K(Q)}V(k)}function j(G){x=void 0;var k;try{k=tt(i+" - runid: "+c+" - yield "+H++,d.throw).call(d,G)}catch(Q){return K(Q)}V(k)}function V(G){if(Me(G?.then)){G.then(V,K);return}return G.done?R(G.value):(x=Promise.resolve(G.value),x.then(F,j))}F(void 0)});return S.cancel=tt(i+" - runid: "+c+" - cancel",function(){try{x&&Aa(x);var R=d.return(void 0),K=Promise.resolve(R.value);K.then(Jr,Jr),Aa(K),g(new bu)}catch(H){g(H)}}),S};return s.isMobXFlow=!0,s},Co);Yr.bound=Lt(jp);function Aa(e){Me(e.cancel)&&e.cancel()}function On(e){return e?.isMobXFlow===!0}function kp(e,t){return e?t!==void 0?jt(e)||nn(e)?ae("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):Sr(e)?e[ye].values_.has(t):!1:Sr(e)||!!e[ye]||Wo(e)||mi(e)||Pn(e):!1}function Qr(e){return arguments.length!==1&&ae("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),kp(e)}function Fp(e){if(Sr(e))return e[ye].ownKeys_();ae(38)}function ui(e,t,r){return e.set(t,r),r}function Hr(e,t){if(e==null||typeof e!="object"||e instanceof Date||!Qr(e))return e;if(dp(e)||Pn(e))return Hr(e.get(),t);if(t.has(e))return t.get(e);if(nn(e)){var r=ui(t,e,new Array(e.length));return e.forEach(function(o,a){r[a]=Hr(o,t)}),r}if(Et(e)){var n=ui(t,e,new Set);return e.forEach(function(o){n.add(Hr(o,t))}),n}if(jt(e)){var i=ui(t,e,new Map);return e.forEach(function(o,a){i.set(a,Hr(o,t))}),i}else{var s=ui(t,e,{});return Fp(e).forEach(function(o){In.propertyIsEnumerable.call(e,o)&&(s[o]=Hr(e[o],t))}),s}}function Xt(e,t){return t&&ae("toJS no longer supports options"),Hr(e,new Map)}function Yo(){for(var e=!1,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];typeof r[r.length-1]=="boolean"&&(e=r.pop());var i=Kp(r);if(!i)return ae("'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_===mt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?mt.BREAK:mt.LOG}function Kp(e){switch(e.length){case 0:return J.trackingDerivation;case 1:return bt(e[0]);case 2:return bt(e[0],e[1])}}function Wt(e,t){t===void 0&&(t=void 0),ht();try{return e.apply(t)}finally{yt()}}function Tr(e){return e[ye]}var Vp={has:function(t,r){return J.trackingDerivation&&wn("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Tr(t).has_(r)},get:function(t,r){return Tr(t).get_(r)},set:function(t,r,n){var i;return Ar(r)?(Tr(t).values_.has(r)||wn("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(i=Tr(t).set_(r,n,!0))!=null?i:!0):!1},deleteProperty:function(t,r){var n;return wn("delete properties from an observable object. Use 'remove' from 'mobx' instead."),Ar(r)?(n=Tr(t).delete_(r,!0))!=null?n:!0:!1},defineProperty:function(t,r,n){var i;return wn("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(i=Tr(t).defineProperty_(r,n))!=null?i:!0},ownKeys:function(t){return J.trackingDerivation&&wn("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Tr(t).ownKeys_()},preventExtensions:function(t){ae(13)}};function zp(e,t){var r,n;return Da(),e=on(e,t),(n=(r=e[ye]).proxy_)!=null?n:r.proxy_=new Proxy(e,Vp)}function dt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Cn(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Go(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function pt(e,t){var r=Rr();try{for(var n=[].concat(e.interceptors_||[]),i=0,s=n.length;i<s&&(t=n[i](t),t&&!t.type&&ae(14),!!t);i++);return t}finally{Ht(r)}}function Rt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function xn(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Go(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Pt(e,t){var r=Rr(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,s=n.length;i<s;i++)n[i](t);Ht(r)}}function ur(e,t,r){return $r(function(){var n,i=on(e,r)[ye];t&&e[et]&&ae("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=bd(e)),Oi(t).forEach(function(s){return i.make_(s,t[s])})}),e}var Oa="splice",St="update",qp=1e4,Gp={get:function(t,r){var n=t[ye];return r===ye?n:r==="length"?n.getArrayLength_():typeof r=="string"&&!isNaN(r)?n.get_(parseInt(r)):gt(vi,r)?vi[r]:t[r]},set:function(t,r,n){var i=t[ye];return r==="length"&&i.setArrayLength_(n),typeof r=="symbol"||isNaN(r)?t[r]=n:i.set_(parseInt(r),n),!0},preventExtensions:function(){ae(15)}},Qo=function(){function e(r,n,i,s){r===void 0&&(r="ObservableArray@"+_t()),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_=s,this.atom_=new ar(r),this.enhancer_=function(o,a){return n(o,a,r+"[..]")}}var t=e.prototype;return t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.dehanceValues_=function(n){return this.dehancer!==void 0&&n.length>0?n.map(this.dehancer):n},t.intercept_=function(n){return Cn(this,n)},t.observe_=function(n,i){return i===void 0&&(i=!1),i&&n({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),xn(this,n)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(n){(typeof n!="number"||isNaN(n)||n<0)&&ae("Out of range: "+n);var i=this.values_.length;if(n!==i)if(n>i){for(var s=new Array(n-i),o=0;o<n-i;o++)s[o]=void 0;this.spliceWithArray_(i,0,s)}else this.spliceWithArray_(n,i-n)},t.updateArrayLength_=function(n,i){n!==this.lastKnownLength_&&ae(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&Iu(n+i+1)},t.spliceWithArray_=function(n,i,s){var o=this;Dt(this.atom_);var a=this.values_.length;if(n===void 0?n=0:n>a?n=a:n<0&&(n=Math.max(0,a+n)),arguments.length===1?i=a-n:i==null?i=0:i=Math.max(0,Math.min(i,a-n)),s===void 0&&(s=pi),dt(this)){var l=pt(this,{object:this.proxy_,type:Oa,index:n,removedCount:i,added:s});if(!l)return pi;i=l.removedCount,s=l.added}s=s.length===0?s:s.map(function(g){return o.enhancer_(g,void 0)}),this.legacyMode_;var c=s.length-i;this.updateArrayLength_(a,c);var d=this.spliceItemsIntoValues_(n,i,s);return(i!==0||s.length!==0)&&this.notifyArraySplice_(n,s,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(n,i,s){if(s.length<qp){var o;return(o=this.values_).splice.apply(o,[n,i].concat(s))}else{var a=this.values_.slice(n,n+i),l=this.values_.slice(n+i);this.values_.length+=s.length-i;for(var c=0;c<s.length;c++)this.values_[n+c]=s[c];for(var d=0;d<l.length;d++)this.values_[n+s.length+d]=l[d];return a}},t.notifyArrayChildUpdate_=function(n,i,s){var o=!this.owned_&&qe(),a=Rt(this),l=a||o?{observableKind:"array",object:this.proxy_,type:St,debugObjectName:this.atom_.name_,index:n,newValue:i,oldValue:s}:null;o&&ot(l),this.atom_.reportChanged(),a&&Pt(this,l),o&&st()},t.notifyArraySplice_=function(n,i,s){var o=!this.owned_&&qe(),a=Rt(this),l=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Oa,index:n,removed:s,added:i,removedCount:s.length,addedCount:i.length}:null;o&&ot(l),this.atom_.reportChanged(),a&&Pt(this,l),o&&st()},t.get_=function(n){if(this.legacyMode_&&n>=this.values_.length){console.warn("[mobx.array] Attempt to read an array index ("+n+") 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_[n])},t.set_=function(n,i){var s=this.values_;if(this.legacyMode_&&n>s.length&&ae(17,n,s.length),n<s.length){Dt(this.atom_);var o=s[n];if(dt(this)){var a=pt(this,{type:St,object:this.proxy_,index:n,newValue:i});if(!a)return;i=a.newValue}i=this.enhancer_(i,o);var l=i!==o;l&&(s[n]=i,this.notifyArrayChildUpdate_(n,i,o))}else{for(var c=new Array(n+1-s.length),d=0;d<c.length-1;d++)c[d]=void 0;c[c.length-1]=i,this.spliceWithArray_(s.length,0,c)}},e}();function Wp(e,t,r,n){return r===void 0&&(r="ObservableArray@"+_t()),n===void 0&&(n=!1),Da(),$r(function(){var i=new Qo(r,t,n,!1);La(i.values_,ye,i);var s=new Proxy(i.values_,Gp);return i.proxy_=s,e&&e.length&&i.spliceWithArray_(0,0,e),s})}var vi={clear:function(){return this.splice(0)},replace:function(t){var r=this[ye];return r.spliceWithArray_(0,r.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];var o=this[ye];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(t);case 2:return o.spliceWithArray_(t,r)}return o.spliceWithArray_(t,r,i)},spliceWithArray:function(t,r,n){return this[ye].spliceWithArray_(t,r,n)},push:function(){for(var t=this[ye],r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return t.spliceWithArray_(t.values_.length,0,n),t.values_.length},pop:function(){return this.splice(Math.max(this[ye].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[ye],r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return t.spliceWithArray_(0,0,n),t.values_.length},reverse:function(){return J.trackingDerivation&&ae(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){J.trackingDerivation&&ae(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var r=this[ye],n=r.dehanceValues_(r.values_).indexOf(t);return n>-1?(this.splice(n,1),!0):!1}};Pe("at",at);Pe("concat",at);Pe("flat",at);Pe("includes",at);Pe("indexOf",at);Pe("join",at);Pe("lastIndexOf",at);Pe("slice",at);Pe("toString",at);Pe("toLocaleString",at);Pe("toSorted",at);Pe("toSpliced",at);Pe("with",at);Pe("every",Ct);Pe("filter",Ct);Pe("find",Ct);Pe("findIndex",Ct);Pe("findLast",Ct);Pe("findLastIndex",Ct);Pe("flatMap",Ct);Pe("forEach",Ct);Pe("map",Ct);Pe("some",Ct);Pe("toReversed",Ct);Pe("reduce",_u);Pe("reduceRight",_u);function Pe(e,t){typeof Array.prototype[e]=="function"&&(vi[e]=t(e))}function at(e){return function(){var t=this[ye];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function Ct(e){return function(t,r){var n=this,i=this[ye];i.atom_.reportObserved();var s=i.dehanceValues_(i.values_);return s[e](function(o,a){return t.call(r,o,a,n)})}}function _u(e){return function(){var t=this,r=this[ye];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(s,o,a){return i(s,o,a,t)},n[e].apply(n,arguments)}}var Hp=sr("ObservableArrayAdministration",Qo);function nn(e){return Ti(e)&&Hp(e[ye])}var Jp={},nr="add",bi="delete",wu=function(){function e(r,n,i){var s=this;n===void 0&&(n=Or),i===void 0&&(i="ObservableMap@"+_t()),this.enhancer_=void 0,this.name_=void 0,this[ye]=Jp,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_=n,this.name_=i,Me(Map)||ae(18),$r(function(){s.keysAtom_=Ka(s.name_+".keys()"),s.data_=new Map,s.hasMap_=new Map,r&&s.merge(r)})}var t=e.prototype;return t.has_=function(n){return this.data_.has(n)},t.has=function(n){var i=this;if(!J.trackingDerivation)return this.has_(n);var s=this.hasMap_.get(n);if(!s){var o=s=new ir(this.has_(n),Ei,this.name_+"."+Uo(n)+"?",!1);this.hasMap_.set(n,o),Pr(o,function(){return i.hasMap_.delete(n)})}return s.get()},t.set=function(n,i){var s=this.has_(n);if(dt(this)){var o=pt(this,{type:s?St:nr,object:this,newValue:i,name:n});if(!o)return this;i=o.newValue}return s?this.updateValue_(n,i):this.addValue_(n,i),this},t.delete=function(n){var i=this;if(Dt(this.keysAtom_),dt(this)){var s=pt(this,{type:bi,object:this,name:n});if(!s)return!1}if(this.has_(n)){var o=qe(),a=Rt(this),l=a||o?{observableKind:"map",debugObjectName:this.name_,type:bi,object:this,oldValue:this.data_.get(n).value_,name:n}:null;return o&&ot(l),Wt(function(){var c;i.keysAtom_.reportChanged(),(c=i.hasMap_.get(n))==null||c.setNewValue_(!1);var d=i.data_.get(n);d.setNewValue_(void 0),i.data_.delete(n)}),a&&Pt(this,l),o&&st(),!0}return!1},t.updateValue_=function(n,i){var s=this.data_.get(n);if(i=s.prepareNewValue_(i),i!==J.UNCHANGED){var o=qe(),a=Rt(this),l=a||o?{observableKind:"map",debugObjectName:this.name_,type:St,object:this,oldValue:s.value_,name:n,newValue:i}:null;o&&ot(l),s.setNewValue_(i),a&&Pt(this,l),o&&st()}},t.addValue_=function(n,i){var s=this;Dt(this.keysAtom_),Wt(function(){var c,d=new ir(i,s.enhancer_,s.name_+"."+Uo(n),!1);s.data_.set(n,d),i=d.value_,(c=s.hasMap_.get(n))==null||c.setNewValue_(!0),s.keysAtom_.reportChanged()});var o=qe(),a=Rt(this),l=a||o?{observableKind:"map",debugObjectName:this.name_,type:nr,object:this,name:n,newValue:i}:null;o&&ot(l),a&&Pt(this,l),o&&st()},t.get=function(n){return this.has(n)?this.dehanceValue_(this.data_.get(n).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var n=this,i=this.keys();return Ia({next:function(){var o=i.next(),a=o.done,l=o.value;return{done:a,value:a?void 0:n.get(l)}}})},t.entries=function(){var n=this,i=this.keys();return Ia({next:function(){var o=i.next(),a=o.done,l=o.value;return{done:a,value:a?void 0:[l,n.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(n,i){for(var s=Xr(this),o;!(o=s()).done;){var a=o.value,l=a[0],c=a[1];n.call(i,c,l,this)}},t.merge=function(n){var i=this;return jt(n)&&(n=new Map(n)),Wt(function(){$t(n)?pd(n).forEach(function(s){return i.set(s,n[s])}):Array.isArray(n)?n.forEach(function(s){var o=s[0],a=s[1];return i.set(o,a)}):Zr(n)?(dd(n)||ae(19,n),n.forEach(function(s,o){return i.set(o,s)})):n!=null&&ae(20,n)}),this},t.clear=function(){var n=this;Wt(function(){Se(function(){for(var i=Xr(n.keys()),s;!(s=i()).done;){var o=s.value;n.delete(o)}})})},t.replace=function(n){var i=this;return Wt(function(){for(var s=Xp(n),o=new Map,a=!1,l=Xr(i.data_.keys()),c;!(c=l()).done;){var d=c.value;if(!s.has(d)){var g=i.delete(d);if(g)a=!0;else{var x=i.data_.get(d);o.set(d,x)}}}for(var S=Xr(s.entries()),R;!(R=S()).done;){var K=R.value,H=K[0],F=K[1],j=i.data_.has(H);if(i.set(H,F),i.data_.has(H)){var V=i.data_.get(H);o.set(H,V),j||(a=!0)}}if(!a)if(i.data_.size!==o.size)i.keysAtom_.reportChanged();else for(var G=i.data_.keys(),k=o.keys(),Q=G.next(),q=k.next();!Q.done;){if(Q.value!==q.value){i.keysAtom_.reportChanged();break}Q=G.next(),q=k.next()}i.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(n,i){return i===!0&&ae("`observe` doesn't support fireImmediately=true in combination with maps."),xn(this,n)},t.intercept_=function(n){return Cn(this,n)},en(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),jt=sr("ObservableMap",wu);function Ia(e){return e[Symbol.toStringTag]="MapIterator",rs(e)}function Xp(e){if(Zr(e)||jt(e))return e;if(Array.isArray(e))return new Map(e);if($t(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return ae(21,e)}var Yp={},Tu=function(){function e(r,n,i){var s=this;n===void 0&&(n=Or),i===void 0&&(i="ObservableSet@"+_t()),this.name_=void 0,this[ye]=Yp,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,Me(Set)||ae(22),this.enhancer_=function(o,a){return n(o,a,i)},$r(function(){s.atom_=Ka(s.name_),r&&s.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.clear=function(){var n=this;Wt(function(){Se(function(){for(var i=Xr(n.data_.values()),s;!(s=i()).done;){var o=s.value;n.delete(o)}})})},t.forEach=function(n,i){for(var s=Xr(this),o;!(o=s()).done;){var a=o.value;n.call(i,a,a,this)}},t.add=function(n){var i=this;if(Dt(this.atom_),dt(this)){var s=pt(this,{type:nr,object:this,newValue:n});if(!s)return this;n=s.newValue}if(!this.has(n)){Wt(function(){i.data_.add(i.enhancer_(n,void 0)),i.atom_.reportChanged()});var o=qe(),a=Rt(this),l=a||o?{observableKind:"set",debugObjectName:this.name_,type:nr,object:this,newValue:n}:null;o&&ot(l),a&&Pt(this,l),o&&st()}return this},t.delete=function(n){var i=this;if(dt(this)){var s=pt(this,{type:bi,object:this,oldValue:n});if(!s)return!1}if(this.has(n)){var o=qe(),a=Rt(this),l=a||o?{observableKind:"set",debugObjectName:this.name_,type:bi,object:this,oldValue:n}:null;return o&&ot(l),Wt(function(){i.atom_.reportChanged(),i.data_.delete(n)}),a&&Pt(this,l),o&&st(),!0}return!1},t.has=function(n){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(n))},t.entries=function(){var n=this.values();return Ea({next:function(){var s=n.next(),o=s.value,a=s.done;return a?{value:void 0,done:a}:{value:[o,o],done:a}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var n=this,i=this.data_.values();return Ea({next:function(){var o=i.next(),a=o.value,l=o.done;return l?{value:void 0,done:l}:{value:n.dehanceValue_(a),done:l}}})},t.intersection=function(n){if(Gt(n)&&!Et(n))return n.intersection(this);var i=new Set(this);return i.intersection(n)},t.union=function(n){if(Gt(n)&&!Et(n))return n.union(this);var i=new Set(this);return i.union(n)},t.difference=function(n){return new Set(this).difference(n)},t.symmetricDifference=function(n){if(Gt(n)&&!Et(n))return n.symmetricDifference(this);var i=new Set(this);return i.symmetricDifference(n)},t.isSubsetOf=function(n){return new Set(this).isSubsetOf(n)},t.isSupersetOf=function(n){return new Set(this).isSupersetOf(n)},t.isDisjointFrom=function(n){if(Gt(n)&&!Et(n))return n.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(n)},t.replace=function(n){var i=this;return Et(n)&&(n=new Set(n)),Wt(function(){Array.isArray(n)?(i.clear(),n.forEach(function(s){return i.add(s)})):Gt(n)?(i.clear(),n.forEach(function(s){return i.add(s)})):n!=null&&ae("Cannot initialize set from "+n)}),this},t.observe_=function(n,i){return i===!0&&ae("`observe` doesn't support fireImmediately=true in combination with sets."),xn(this,n)},t.intercept_=function(n){return Cn(this,n)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},en(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Et=sr("ObservableSet",Tu);function Ea(e){return e[Symbol.toStringTag]="SetIterator",rs(e)}var Sa=Object.create(null),Ra="remove",Vo=function(){function e(r,n,i,s){n===void 0&&(n=new Map),s===void 0&&(s=zd),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_=r,this.values_=n,this.name_=i,this.defaultAnnotation_=s,this.keysAtom_=new ar(this.name_+".keys"),this.isPlainObject_=$t(this.target_),Eu(this.defaultAnnotation_)||ae("defaultAnnotation must be valid annotation"),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(n){return this.values_.get(n).get()},t.setObservablePropValue_=function(n,i){var s=this.values_.get(n);if(s instanceof vt)return s.set(i),!0;if(dt(this)){var o=pt(this,{type:St,object:this.proxy_||this.target_,name:n,newValue:i});if(!o)return null;i=o.newValue}if(i=s.prepareNewValue_(i),i!==J.UNCHANGED){var a=Rt(this),l=qe(),c=a||l?{type:St,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:s.value_,name:n,newValue:i}:null;l&&ot(c),s.setNewValue_(i),a&&Pt(this,c),l&&st()}return!0},t.get_=function(n){return J.trackingDerivation&&!gt(this.target_,n)&&this.has_(n),this.target_[n]},t.set_=function(n,i,s){return s===void 0&&(s=!1),gt(this.target_,n)?this.values_.has(n)?this.setObservablePropValue_(n,i):s?Reflect.set(this.target_,n,i):(this.target_[n]=i,!0):this.extend_(n,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,s)},t.has_=function(n){if(!J.trackingDerivation)return n in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(n);return i||(i=new ir(n in this.target_,Ei,this.name_+"."+Uo(n)+"?",!1),this.pendingKeys_.set(n,i)),i.get()},t.make_=function(n,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(Na(this,i,n),!(n in this.target_)){var s;if((s=this.target_[et])!=null&&s[n])return;ae(1,i.annotationType_,this.name_+"."+n.toString())}for(var o=this.target_;o&&o!==In;){var a=di(o,n);if(a){var l=i.make_(this,n,a,o);if(l===0)return;if(l===1)break}o=Object.getPrototypeOf(o)}$a(this,i,n)}},t.extend_=function(n,i,s,o){if(o===void 0&&(o=!1),s===!0&&(s=this.defaultAnnotation_),s===!1)return this.defineProperty_(n,i,o);Na(this,s,n);var a=s.extend_(this,n,i,o);return a&&$a(this,s,n),a},t.defineProperty_=function(n,i,s){s===void 0&&(s=!1),Dt(this.keysAtom_);try{ht();var o=this.delete_(n);if(!o)return o;if(dt(this)){var a=pt(this,{object:this.proxy_||this.target_,name:n,type:nr,newValue:i.value});if(!a)return null;var l=a.newValue;i.value!==l&&(i=Jt({},i,{value:l}))}if(s){if(!Reflect.defineProperty(this.target_,n,i))return!1}else Bt(this.target_,n,i);this.notifyPropertyAddition_(n,i.value)}finally{yt()}return!0},t.defineObservableProperty_=function(n,i,s,o){o===void 0&&(o=!1),Dt(this.keysAtom_);try{ht();var a=this.delete_(n);if(!a)return a;if(dt(this)){var l=pt(this,{object:this.proxy_||this.target_,name:n,type:nr,newValue:i});if(!l)return null;i=l.newValue}var c=Pa(n),d={configurable:J.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:c.get,set:c.set};if(o){if(!Reflect.defineProperty(this.target_,n,d))return!1}else Bt(this.target_,n,d);var g=new ir(i,s,this.name_+"."+n.toString(),!1);this.values_.set(n,g),this.notifyPropertyAddition_(n,g.value_)}finally{yt()}return!0},t.defineComputedProperty_=function(n,i,s){s===void 0&&(s=!1),Dt(this.keysAtom_);try{ht();var o=this.delete_(n);if(!o)return o;if(dt(this)){var a=pt(this,{object:this.proxy_||this.target_,name:n,type:nr,newValue:void 0});if(!a)return null}i.name||(i.name=this.name_+"."+n.toString()),i.context=this.proxy_||this.target_;var l=Pa(n),c={configurable:J.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(s){if(!Reflect.defineProperty(this.target_,n,c))return!1}else Bt(this.target_,n,c);this.values_.set(n,new vt(i)),this.notifyPropertyAddition_(n,void 0)}finally{yt()}return!0},t.delete_=function(n,i){if(i===void 0&&(i=!1),Dt(this.keysAtom_),!gt(this.target_,n))return!0;if(dt(this)){var s=pt(this,{object:this.proxy_||this.target_,name:n,type:Ra});if(!s)return null}try{var o;ht();var a=Rt(this),l=qe(),c=this.values_.get(n),d=void 0;if(!c&&(a||l)){var g;d=(g=di(this.target_,n))==null?void 0:g.value}if(i){if(!Reflect.deleteProperty(this.target_,n))return!1}else delete this.target_[n];if(delete this.appliedAnnotations_[n],c&&(this.values_.delete(n),c instanceof ir&&(d=c.value_),su(c)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(n))==null||o.set(n in this.target_),a||l){var x={type:Ra,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:n};l&&ot(x),a&&Pt(this,x),l&&st()}}finally{yt()}return!0},t.observe_=function(n,i){return i===!0&&ae("`observe` doesn't support the fire immediately property for observable objects."),xn(this,n)},t.intercept_=function(n){return Cn(this,n)},t.notifyPropertyAddition_=function(n,i){var s,o=Rt(this),a=qe();if(o||a){var l=o||a?{type:nr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:n,newValue:i}:null;a&&ot(l),o&&Pt(this,l),a&&st()}(s=this.pendingKeys_)==null||(s=s.get(n))==null||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Oi(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function on(e,t){var r;if(t&&Sr(e)&&ae("Options can't be provided for already observable objects."),gt(e,ye))return es(e)instanceof Vo||ae("Cannot convert '"+_i(e)+`' into observable object:
|
|
26
26
|
The target is already observable of different type.
|
|
27
|
-
Extending builtins is not supported.`),e;Object.isExtensible(e)||
|
|
27
|
+
Extending builtins is not supported.`),e;Object.isExtensible(e)||ae("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:($t(e)?"ObservableObject":e.constructor.name)+"@"+_t(),i=new Vo(e,new Map,String(n),tp(t));return Ai(e,ye,i),e}var Qp=sr("ObservableObjectAdministration",Vo);function Pa(e){return Sa[e]||(Sa[e]={get:function(){return this[ye].getObservablePropValue_(e)},set:function(r){return this[ye].setObservablePropValue_(e,r)}})}function Sr(e){return Ti(e)?Qp(e[ye]):!1}function $a(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[et])==null||delete n[r]}function Na(e,t,r){if(Eu(t)||ae("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!hi(t)&>(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,s=t.annotationType_;ae("Cannot apply '"+s+"' to '"+n+"':"+(`
|
|
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
|
|
31
|
-
${f}`,
|
|
32
|
-
${f}`);let A=Math.min(_.length,
|
|
33
|
-
${
|
|
34
|
-
${f}`,T=" ");let u=Math.min(y,
|
|
35
|
-
${f}${
|
|
36
|
-
${
|
|
37
|
-
${f}`,
|
|
38
|
-
${f}`);let y=Math.min(
|
|
39
|
-
${_}`),
|
|
40
|
-
${f}`,
|
|
41
|
-
${f}${
|
|
42
|
-
${_}`),
|
|
43
|
-
${
|
|
44
|
-
${
|
|
45
|
-
${f}`,
|
|
46
|
-
${
|
|
47
|
-
${
|
|
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 k("",ae,[],z(D),Y,"")}if(Y.length!==0)return ee("",ae,[],Y,"")}return oe("",ae,[])}return Q}}}),Ir=De({"../../../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)&&L(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 L(j){return typeof j=="function"}e.IsFunction=L;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}}),wl=De({"../../../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=Eo(),r=en(),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}}),Oo=De({"../../../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=en(),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}}),ta=De({"../../../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,k)=>BigInt(k)),l=new Float64Array(1),c=new DataView(l.buffer),d=new Uint8Array(l.buffer);function*g(M){let k=M===0?1:Math.ceil(Math.floor(Math.log2(M)+1)/8);for(let ee=0;ee<k;ee++)yield M>>8*(k-1-ee)&255}function C(M){fe(r.Array);for(let k of M)G(k)}function I(M){fe(r.Boolean),fe(M?1:0)}function S(M){fe(r.BigInt),c.setBigInt64(0,M);for(let k of d)fe(k)}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 k of d)fe(k)}function L(M){fe(r.Object);for(let k of globalThis.Object.keys(M).sort())G(k),G(M[k])}function K(M){fe(r.String);for(let k=0;k<M.length;k++)for(let ee of g(M.charCodeAt(k)))fe(ee)}function W(M){fe(r.Symbol),G(M.description)}function j(M){fe(r.Uint8Array);for(let k=0;k<M.length;k++)fe(M[k])}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 L(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}}),Eo=De({"../../../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=wl(),r=Oo(),i=ta(),o=en(),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*L(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*k(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*L(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*k(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}}),sy=De({"../../../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(Eo(),e)}}),Tl=De({"../../../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=Eo();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return r.ValueErrorType}}),n(wl(),e)}}),ay=De({"../../../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=Tl(),r=Oo(),i=ta(),o=en(),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 L(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 k(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 L(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 k(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=$}}),uy=De({"../../../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=Oo(),r=ay(),i=en(),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)||k(Q.items,ae)}function S(Q,ae){return i.TypeGuard.TTransform(Q)||k(Q.items,ae)}function z(Q,ae){return i.TypeGuard.TTransform(Q)||k(Q.returns,ae)||Q.parameters.some(D=>k(D,ae))}function J(Q,ae){return i.TypeGuard.TTransform(Q)||k(Q.returns,ae)||Q.parameters.some(D=>k(D,ae))}function F(Q,ae){return i.TypeGuard.TTransform(Q)||i.TypeGuard.TTransform(Q.unevaluatedProperties)||Q.allOf.some(D=>k(D,ae))}function L(Q,ae){return i.TypeGuard.TTransform(Q)||k(Q.items,ae)}function K(Q,ae){return i.TypeGuard.TTransform(Q)||k(Q.not,ae)}function W(Q,ae){return i.TypeGuard.TTransform(Q)||Object.values(Q.properties).some(D=>k(D,ae))||i.TypeGuard.TSchema(Q.additionalProperties)&&k(Q.additionalProperties,ae)}function j(Q,ae){return i.TypeGuard.TTransform(Q)||k(Q.item,ae)}function Z(Q,ae){let D=Object.getOwnPropertyNames(Q.patternProperties)[0],H=Q.patternProperties[D];return i.TypeGuard.TTransform(Q)||k(H,ae)||i.TypeGuard.TSchema(Q.additionalProperties)&&i.TypeGuard.TTransform(Q.additionalProperties)}function G(Q,ae){return i.TypeGuard.TTransform(Q)?!0:k((0,n.Deref)(Q,ae),ae)}function fe(Q,ae){return i.TypeGuard.TTransform(Q)?!0:k((0,n.Deref)(Q,ae),ae)}function x(Q,ae){return i.TypeGuard.TTransform(Q)||!(0,t.IsUndefined)(Q.items)&&Q.items.some(D=>k(D,ae))}function M(Q,ae){return i.TypeGuard.TTransform(Q)||Q.anyOf.some(D=>k(D,ae))}function k(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 L(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(),k(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(k){throw new a(x,M,k)}}function S(x,M,k){return(0,t.IsArray)(k)?I(x,k.map(ee=>G(x.items,M,ee))):I(x,k)}function z(x,M,k){if(!(0,t.IsPlainObject)(k)||(0,t.IsValueType)(k))return I(x,k);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,k);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,k){return I(x,G(x.not,M,k))}function F(x,M,k){if(!(0,t.IsPlainObject)(k))return I(x,k);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,k);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 L(x,M,k){if(!(0,t.IsPlainObject)(k))return I(x,k);let ee=Object.getOwnPropertyNames(x.patternProperties)[0],oe=new RegExp(ee),Q=Object.getOwnPropertyNames(k).reduce((Y,he)=>oe.test(he)?{...Y,[he]:G(x.patternProperties[ee],M,Y[he])}:Y,k);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,k){let ee=(0,n.Deref)(x,M);return I(x,G(ee,M,k))}function W(x,M,k){let ee=(0,n.Deref)(x,M);return I(x,G(ee,M,k))}function j(x,M,k){return(0,t.IsArray)(k)&&(0,t.IsArray)(x.items)?I(x,x.items.map((ee,oe)=>G(ee,M,k[oe]))):I(x,k)}function Z(x,M,k){let ee=I(x,k);for(let oe of x.anyOf)if((0,r.Check)(oe,M,ee))return G(oe,M,ee);return ee}function G(x,M,k){let ee=typeof x.$id=="string"?[...M,x]:M,oe=x;switch(x[i.Kind]){case"Array":return S(oe,ee,k);case"Intersect":return z(oe,ee,k);case"Not":return J(oe,ee,k);case"Object":return F(oe,ee,k);case"Record":return L(oe,ee,k);case"Ref":return K(oe,ee,k);case"Symbol":return I(oe,k);case"This":return W(oe,ee,k);case"Tuple":return j(oe,ee,k);case"Union":return Z(oe,ee,k);default:return I(oe,k)}}function fe(x,M,k){return G(x,M,k)}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(k){throw new l(x,M,k)}}function S(x,M,k){let ee=I(x,k);return(0,t.IsArray)(ee)?ee.map(oe=>G(x.items,M,oe)):ee}function z(x,M,k){let ee=I(x,k);if(!(0,t.IsPlainObject)(k)||(0,t.IsValueType)(k))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,k){return I(x.not,I(x,k))}function F(x,M,k){let ee=I(x,k);if(!(0,t.IsPlainObject)(k))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 L(x,M,k){let ee=I(x,k);if(!(0,t.IsPlainObject)(k))return ee;let oe=Object.getOwnPropertyNames(x.patternProperties)[0],Q=new RegExp(oe),ae=Object.getOwnPropertyNames(k).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,k){let ee=(0,n.Deref)(x,M),oe=G(ee,M,k);return I(x,oe)}function W(x,M,k){let ee=(0,n.Deref)(x,M),oe=G(ee,M,k);return I(x,oe)}function j(x,M,k){let ee=I(x,k);return(0,t.IsArray)(x.items)?x.items.map((oe,Q)=>G(oe,M,ee[Q])):[]}function Z(x,M,k){for(let ee of x.anyOf){if(!(0,r.Check)(ee,M,k))continue;let oe=G(ee,M,k);return I(x,oe)}for(let ee of x.anyOf){let oe=G(ee,M,k);if((0,r.Check)(x,M,oe))return I(x,oe)}return I(x,k)}function G(x,M,k){let ee=typeof x.$id=="string"?[...M,x]:M,oe=x;switch(x[i.Kind]){case"Array":return S(oe,ee,k);case"Intersect":return z(oe,ee,k);case"Not":return J(oe,ee,k);case"Object":return F(oe,ee,k);case"Record":return L(oe,ee,k);case"Ref":return K(oe,ee,k);case"This":return W(oe,ee,k);case"Tuple":return j(oe,ee,k);case"Union":return Z(oe,ee,k);default:return I(oe,k)}}function fe(x,M,k){return G(x,M,k)}C.Encode=fe})(g||(e.EncodeTransform=g={}))}}),cy=De({"../../../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=uy(),n=Ir(),r=Eo(),i=Tl(),o=Oo(),s=ta(),a=en(),l=class{constructor(F,L,K,W){this.schema=F,this.references=L,this.checkFunc=K,this.code=W,this.hasTransform=t.HasTransform.Has(F,L)}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 L=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,F):F;if(!this.checkFunc(L))throw new t.TransformEncodeCheckError(this.schema,F,this.Errors(F).First());return L}};e.TypeCheck=l;var c;(function(F){function L(Z){return Z===36}F.DollarSign=L;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 L(Z){return Z.length===0?!1:c.IsNumeric(Z.charCodeAt(0))}function K(Z){if(L(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 L(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=L})(g||(g={}));var C;(function(F){function L(K){return K.replace(/'/g,"\\'")}F.Escape=L})(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 L(G,fe,x){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${fe}' in ${G} ? ${x} : true)`:`(${d.Encode(G,fe)} !== undefined ? ${x} : true)`}F.IsExactOptionalProperty=L;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 L(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(),Le=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}) => ${Le} ? 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*k(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)||L(Se))&&(yield`('${re}' in ${R})`);else{let Le=ne(Se,le,de);yield z.IsExactOptionalProperty(R,re,Le)}}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"),Le=a.TypeGuard.TSchema(O.additionalProperties)?ne(O.additionalProperties,le,R):O.additionalProperties===!1?"false":"true",rt=`(${de}.test(key) ? ${Se} : ${Le})`;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 Le=Ue(Se,O,le,"value",!1);return te.functions.set(Se,Le),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*k(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
|
-
`,
|
|
50
|
-
}`}function
|
|
51
|
-
return ${
|
|
52
|
-
}`:`return ${
|
|
53
|
-
`)}function
|
|
54
|
-
`)){let i=
|
|
30
|
+
Use 'override' annotation for methods overridden by subclass.`)}}var Zp=Ou(0),eh=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),xo=0,Au=function(){};function th(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}th(Au,Array.prototype);var Zo=function(e){function t(n,i,s,o){var a;return s===void 0&&(s="ObservableArray@"+_t()),o===void 0&&(o=!1),a=e.call(this)||this,$r(function(){var l=new Qo(s,i,o,!0);l.proxy_=a,La(a,ye,l),n&&n.length&&a.spliceWithArray(0,0,n),eh&&Object.defineProperty(a,"0",Zp)}),a}Fa(t,e);var r=t.prototype;return r.concat=function(){this[ye].atom_.reportObserved();for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),s.map(function(a){return nn(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return rs({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},en(t,[{key:"length",get:function(){return this[ye].getArrayLength_()},set:function(i){this[ye].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Au);Object.entries(vi).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&Ai(Zo.prototype,t,r)});function Ou(e){return{enumerable:!1,configurable:!0,get:function(){return this[ye].get_(e)},set:function(r){this[ye].set_(e,r)}}}function rh(e){Bt(Zo.prototype,""+e,Ou(e))}function Iu(e){if(e>xo){for(var t=xo;t<e+100;t++)rh(t);xo=e}}Iu(1e3);function nh(e,t,r){return new Zo(e,t,r)}function bt(e,t){if(typeof e=="object"&&e!==null){if(nn(e))return t!==void 0&&ae(23),e[ye].atom_;if(Et(e))return e.atom_;if(jt(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||ae(25,t,_i(e)),r}if(Sr(e)){if(!t)return ae(26);var n=e[ye].values_.get(t);return n||ae(27,t,_i(e)),n}if(Wo(e)||Pn(e)||mi(e))return e}else if(Me(e)&&mi(e[ye]))return e[ye];ae(28)}function es(e,t){if(e||ae(29),t!==void 0)return es(bt(e,t));if(Wo(e)||Pn(e)||mi(e)||jt(e)||Et(e))return e;if(e[ye])return e[ye];ae(24,e)}function _i(e,t){var r;if(t!==void 0)r=bt(e,t);else{if(or(e))return e.name;Sr(e)||jt(e)||Et(e)?r=es(e):r=bt(e)}return r.name_}function $r(e){var t=Rr(),r=Ri(!0);ht();try{return e()}finally{yt(),Pi(r),Ht(t)}}var Ca=In.toString;function ts(e,t,r){return r===void 0&&(r=-1),zo(e,t,r)}function zo(e,t,r,n,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 s=typeof e;if(s!=="function"&&s!=="object"&&typeof t!="object")return!1;var o=Ca.call(e);if(o!==Ca.call(t))return!1;switch(o){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]":r>=0&&r++;break}e=xa(e),t=xa(t);var a=o==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,c=t.constructor;if(l!==c&&!(Me(l)&&l instanceof l&&Me(c)&&c instanceof c)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var d=n.length;d--;)if(n[d]===e)return i[d]===t;if(n.push(e),i.push(t),a){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!zo(e[d],t[d],r-1,n,i))return!1}else{var g=Object.keys(e),x=g.length;if(Object.keys(t).length!==x)return!1;for(var S=0;S<x;S++){var R=g[S];if(!(gt(t,R)&&zo(e[R],t[R],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function xa(e){return nn(e)?e.slice():Zr(e)||jt(e)||Gt(e)||Et(e)?Array.from(e.entries()):e}var Ua,ih=((Ua=wi().Iterator)==null?void 0:Ua.prototype)||{};function rs(e){return e[Symbol.iterator]=oh,Object.assign(Object.create(ih),e)}function oh(){return this}function Eu(e){return e instanceof Object&&typeof e.annotationType_=="string"&&Me(e.make_)&&Me(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=wi();typeof t[e]>"u"&&ae("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Ip,extras:{getDebugName:_i},$mobx:ye});var sh=Ce({"../../../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},r=typeof window<"u"&&typeof window.document<"u",n=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,i=(typeof self>"u"?"undefined":t(self))==="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope",s=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),o=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=s,e.isDeno=o}}),ah=Ce({"../../../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(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,s=n.cmp&&function(a){return function(l){return function(c,d){var g={key:c,value:l[c]},x={key:d,value:l[d]};return a(g,x)}}}(n.cmp),o=[];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(o.indexOf(l)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var g=o.push(l)-1,x=Object.keys(l).sort(s&&s(l));for(d="",c=0;c<x.length;c++){var S=x[c],R=a(l[S]);R&&(d&&(d+=","),d+=JSON.stringify(S)+":"+R)}return o.splice(g,1),"{"+d+"}"}}(r)}}}),uh=Ce({"../../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:r}=Object.prototype,n=F();n.configure=F,n.stringify=n,n.default=n,e.stringify=n,e.configure=F,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function s(j){return j.length<5e3&&!i.test(j)?`"${j}"`:JSON.stringify(j)}function o(j,V){if(j.length>200||V)return j.sort(V);for(let G=1;G<j.length;G++){let k=j[G],Q=G;for(;Q!==0&&j[Q-1]>k;)j[Q]=j[Q-1],Q--;j[Q]=k}return j}var a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(j){return a.call(j)!==void 0&&j.length!==0}function c(j,V,G){j.length<G&&(G=j.length);let k=V===","?"":" ",Q=`"0":${k}${j[0]}`;for(let q=1;q<G;q++)Q+=`${V}"${q}":${k}${j[q]}`;return Q}function d(j){if(r.call(j,"circularValue")){let V=j.circularValue;if(typeof V=="string")return`"${V}"`;if(V==null)return V;if(V===Error||V===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(j){let V;if(r.call(j,"deterministic")&&(V=j.deterministic,typeof V!="boolean"&&typeof V!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return V===void 0?!0:V}function x(j,V){let G;if(r.call(j,V)&&(G=j[V],typeof G!="boolean"))throw new TypeError(`The "${V}" argument must be of type boolean`);return G===void 0?!0:G}function S(j,V){let G;if(r.call(j,V)){if(G=j[V],typeof G!="number")throw new TypeError(`The "${V}" argument must be of type number`);if(!Number.isInteger(G))throw new TypeError(`The "${V}" argument must be an integer`);if(G<1)throw new RangeError(`The "${V}" argument must be >= 1`)}return G===void 0?1/0:G}function R(j){return j===1?"1 item":`${j} items`}function K(j){let V=new Set;for(let G of j)(typeof G=="string"||typeof G=="number")&&V.add(String(G));return V}function H(j){if(r.call(j,"strict")){let V=j.strict;if(typeof V!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(V)return G=>{let k=`Object can not safely be stringified. Received type ${typeof G}`;throw typeof G!="function"&&(k+=` (${G.toString()})`),new Error(k)}}}function F(j){j={...j};let V=H(j);V&&(j.bigint===void 0&&(j.bigint=!1),"circularValue"in j||(j.circularValue=Error));let G=d(j),k=x(j,"bigint"),Q=g(j),q=typeof Q=="function"?Q:void 0,ce=S(j,"maximumDepth"),U=S(j,"maximumBreadth");function D(se,B,W,X,fe,f){let _=B[se];switch(typeof _=="object"&&_!==null&&typeof _.toJSON=="function"&&(_=_.toJSON(se)),_=X.call(B,se,_),typeof _){case"string":return s(_);case"object":{if(_===null)return"null";if(W.indexOf(_)!==-1)return G;let I="",M=",",C=f;if(Array.isArray(_)){if(_.length===0)return"[]";if(ce<W.length+1)return'"[Array]"';W.push(_),fe!==""&&(f+=fe,I+=`
|
|
31
|
+
${f}`,M=`,
|
|
32
|
+
${f}`);let A=Math.min(_.length,U),b=0;for(;b<A-1;b++){let $=D(String(b),_,W,X,fe,f);I+=$!==void 0?$:"null",I+=M}let v=D(String(b),_,W,X,fe,f);if(I+=v!==void 0?v:"null",_.length-1>U){let $=_.length-U-1;I+=`${M}"... ${R($)} not stringified"`}return fe!==""&&(I+=`
|
|
33
|
+
${C}`),W.pop(),`[${I}]`}let P=Object.keys(_),y=P.length;if(y===0)return"{}";if(ce<W.length+1)return'"[Object]"';let T="",w="";fe!==""&&(f+=fe,M=`,
|
|
34
|
+
${f}`,T=" ");let u=Math.min(y,U);Q&&!l(_)&&(P=o(P,q)),W.push(_);for(let A=0;A<u;A++){let b=P[A],v=D(b,_,W,X,fe,f);v!==void 0&&(I+=`${w}${s(b)}:${T}${v}`,w=M)}if(y>U){let A=y-U;I+=`${w}"...":${T}"${R(A)} not stringified"`,w=M}return fe!==""&&w.length>1&&(I=`
|
|
35
|
+
${f}${I}
|
|
36
|
+
${C}`),W.pop(),`{${I}}`}case"number":return isFinite(_)?String(_):V?V(_):"null";case"boolean":return _===!0?"true":"false";case"undefined":return;case"bigint":if(k)return String(_);default:return V?V(_):void 0}}function L(se,B,W,X,fe,f){switch(typeof B=="object"&&B!==null&&typeof B.toJSON=="function"&&(B=B.toJSON(se)),typeof B){case"string":return s(B);case"object":{if(B===null)return"null";if(W.indexOf(B)!==-1)return G;let _=f,I="",M=",";if(Array.isArray(B)){if(B.length===0)return"[]";if(ce<W.length+1)return'"[Array]"';W.push(B),fe!==""&&(f+=fe,I+=`
|
|
37
|
+
${f}`,M=`,
|
|
38
|
+
${f}`);let y=Math.min(B.length,U),T=0;for(;T<y-1;T++){let u=L(String(T),B[T],W,X,fe,f);I+=u!==void 0?u:"null",I+=M}let w=L(String(T),B[T],W,X,fe,f);if(I+=w!==void 0?w:"null",B.length-1>U){let u=B.length-U-1;I+=`${M}"... ${R(u)} not stringified"`}return fe!==""&&(I+=`
|
|
39
|
+
${_}`),W.pop(),`[${I}]`}W.push(B);let C="";fe!==""&&(f+=fe,M=`,
|
|
40
|
+
${f}`,C=" ");let P="";for(let y of X){let T=L(y,B[y],W,X,fe,f);T!==void 0&&(I+=`${P}${s(y)}:${C}${T}`,P=M)}return fe!==""&&P.length>1&&(I=`
|
|
41
|
+
${f}${I}
|
|
42
|
+
${_}`),W.pop(),`{${I}}`}case"number":return isFinite(B)?String(B):V?V(B):"null";case"boolean":return B===!0?"true":"false";case"undefined":return;case"bigint":if(k)return String(B);default:return V?V(B):void 0}}function ee(se,B,W,X,fe){switch(typeof B){case"string":return s(B);case"object":{if(B===null)return"null";if(typeof B.toJSON=="function"){if(B=B.toJSON(se),typeof B!="object")return ee(se,B,W,X,fe);if(B===null)return"null"}if(W.indexOf(B)!==-1)return G;let f=fe;if(Array.isArray(B)){if(B.length===0)return"[]";if(ce<W.length+1)return'"[Array]"';W.push(B),fe+=X;let T=`
|
|
43
|
+
${fe}`,w=`,
|
|
44
|
+
${fe}`,u=Math.min(B.length,U),A=0;for(;A<u-1;A++){let v=ee(String(A),B[A],W,X,fe);T+=v!==void 0?v:"null",T+=w}let b=ee(String(A),B[A],W,X,fe);if(T+=b!==void 0?b:"null",B.length-1>U){let v=B.length-U-1;T+=`${w}"... ${R(v)} not stringified"`}return T+=`
|
|
45
|
+
${f}`,W.pop(),`[${T}]`}let _=Object.keys(B),I=_.length;if(I===0)return"{}";if(ce<W.length+1)return'"[Object]"';fe+=X;let M=`,
|
|
46
|
+
${fe}`,C="",P="",y=Math.min(I,U);l(B)&&(C+=c(B,M,U),_=_.slice(B.length),y-=B.length,P=M),Q&&(_=o(_,q)),W.push(B);for(let T=0;T<y;T++){let w=_[T],u=ee(w,B[w],W,X,fe);u!==void 0&&(C+=`${P}${s(w)}: ${u}`,P=M)}if(I>U){let T=I-U;C+=`${P}"...": "${R(T)} not stringified"`,P=M}return P!==""&&(C=`
|
|
47
|
+
${fe}${C}
|
|
48
|
+
${f}`),W.pop(),`{${C}}`}case"number":return isFinite(B)?String(B):V?V(B):"null";case"boolean":return B===!0?"true":"false";case"undefined":return;case"bigint":if(k)return String(B);default:return V?V(B):void 0}}function ie(se,B,W){switch(typeof B){case"string":return s(B);case"object":{if(B===null)return"null";if(typeof B.toJSON=="function"){if(B=B.toJSON(se),typeof B!="object")return ie(se,B,W);if(B===null)return"null"}if(W.indexOf(B)!==-1)return G;let X="",fe=B.length!==void 0;if(fe&&Array.isArray(B)){if(B.length===0)return"[]";if(ce<W.length+1)return'"[Array]"';W.push(B);let C=Math.min(B.length,U),P=0;for(;P<C-1;P++){let T=ie(String(P),B[P],W);X+=T!==void 0?T:"null",X+=","}let y=ie(String(P),B[P],W);if(X+=y!==void 0?y:"null",B.length-1>U){let T=B.length-U-1;X+=`,"... ${R(T)} not stringified"`}return W.pop(),`[${X}]`}let f=Object.keys(B),_=f.length;if(_===0)return"{}";if(ce<W.length+1)return'"[Object]"';let I="",M=Math.min(_,U);fe&&l(B)&&(X+=c(B,",",U),f=f.slice(B.length),M-=B.length,I=","),Q&&(f=o(f,q)),W.push(B);for(let C=0;C<M;C++){let P=f[C],y=ie(P,B[P],W);y!==void 0&&(X+=`${I}${s(P)}:${y}`,I=",")}if(_>U){let C=_-U;X+=`${I}"...":"${R(C)} not stringified"`}return W.pop(),`{${X}}`}case"number":return isFinite(B)?String(B):V?V(B):"null";case"boolean":return B===!0?"true":"false";case"undefined":return;case"bigint":if(k)return String(B);default:return V?V(B):void 0}}function Y(se,B,W){if(arguments.length>1){let X="";if(typeof W=="number"?X=" ".repeat(Math.min(W,10)):typeof W=="string"&&(X=W.slice(0,10)),B!=null){if(typeof B=="function")return D("",{"":se},[],B,X,"");if(Array.isArray(B))return L("",se,[],K(B),X,"")}if(X.length!==0)return ee("",se,[],X,"")}return ie("",se,[])}return Y}}}),cn=Ce({"../../../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(k){return c(k)&&Symbol.asyncIterator in k}e.IsAsyncIterator=t;function r(k){return c(k)&&Symbol.iterator in k}e.IsIterator=r;function n(k){return ArrayBuffer.isView(k)}e.IsTypedArray=n;function i(k){return k instanceof Promise}e.IsPromise=i;function s(k){return k instanceof Uint8Array}e.IsUint8Array=s;function o(k){return k instanceof Date&&Number.isFinite(k.getTime())}e.IsDate=o;function a(k,Q){return Q in k}e.HasPropertyKey=a;function l(k){return c(k)&&j(k.constructor)&&k.constructor.name==="Object"}e.IsPlainObject=l;function c(k){return k!==null&&typeof k=="object"}e.IsObject=c;function d(k){return Array.isArray(k)&&!ArrayBuffer.isView(k)}e.IsArray=d;function g(k){return k===void 0}e.IsUndefined=g;function x(k){return k===null}e.IsNull=x;function S(k){return typeof k=="boolean"}e.IsBoolean=S;function R(k){return typeof k=="number"}e.IsNumber=R;function K(k){return R(k)&&Number.isInteger(k)}e.IsInteger=K;function H(k){return typeof k=="bigint"}e.IsBigInt=H;function F(k){return typeof k=="string"}e.IsString=F;function j(k){return typeof k=="function"}e.IsFunction=j;function V(k){return typeof k=="symbol"}e.IsSymbol=V;function G(k){return H(k)||S(k)||x(k)||R(k)||F(k)||V(k)||g(k)}e.IsValueType=G}}),Kc=Ce({"../../../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=cn(),r=oo(),n=qt(),i=class extends n.TypeBoxError{constructor(d){super(`Duplicate type kind '${d}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var s=class extends n.TypeBoxError{constructor(d){super(`Duplicate string format '${d}' detected`)}};e.TypeSystemDuplicateFormat=s;var o;(function(d){function g(S,R){if(n.TypeRegistry.Has(S))throw new i(S);return n.TypeRegistry.Set(S,R),(K={})=>n.Type.Unsafe({...K,[n.Kind]:S})}d.Type=g;function x(S,R){if(n.FormatRegistry.Has(S))throw new s(S);return n.FormatRegistry.Set(S,R),S}d.Format=x})(o||(e.TypeSystem=o={}));var a;(function(d){let g=c;function x(){g=c}d.Reset=x;function S(K){g=K}d.Set=S;function R(){return g}d.Get=R})(a||(e.TypeSystemErrorFunction=a={}));var l;(function(d){d.ExactOptionalPropertyTypes=!1,d.AllowArrayObject=!1,d.AllowNaN=!1,d.AllowNullVoid=!1;function g(H,F){return d.ExactOptionalPropertyTypes?F in H:H[F]!==void 0}d.IsExactOptionalProperty=g;function x(H){let F=(0,t.IsObject)(H);return d.AllowArrayObject?F:F&&!(0,t.IsArray)(H)}d.IsObjectLike=x;function S(H){return x(H)&&!(H instanceof Date)&&!(H instanceof Uint8Array)}d.IsRecordLike=S;function R(H){let F=(0,t.IsNumber)(H);return d.AllowNaN?F:F&&Number.isFinite(H)}d.IsNumberLike=R;function K(H){let F=(0,t.IsUndefined)(H);return d.AllowNullVoid?F||H===null:F}d.IsVoidLike=K})(l||(e.TypeSystemPolicy=l={}));function c(d,g){switch(g){case r.ValueErrorType.ArrayContains:return"Expected array to contain at least one matching value";case r.ValueErrorType.ArrayMaxContains:return`Expected array to contain no more than ${d.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${d.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${d.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${d.minItems}`;case r.ValueErrorType.ArrayUniqueItems:return"Expected array elements to be unique";case r.ValueErrorType.Array:return"Expected array";case r.ValueErrorType.AsyncIterator:return"Expected AsyncIterator";case r.ValueErrorType.BigIntExclusiveMaximum:return`Expected bigint to be less than ${d.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${d.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${d.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${d.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${d.multipleOf}`;case r.ValueErrorType.BigInt:return"Expected bigint";case r.ValueErrorType.Boolean:return"Expected boolean";case r.ValueErrorType.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${d.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${d.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${d.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${d.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${d.multipleOfTimestamp}`;case r.ValueErrorType.Date:return"Expected Date";case r.ValueErrorType.Function:return"Expected function";case r.ValueErrorType.IntegerExclusiveMaximum:return`Expected integer to be less than ${d.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${d.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${d.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${d.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${d.multipleOf}`;case r.ValueErrorType.Integer:return"Expected integer";case r.ValueErrorType.IntersectUnevaluatedProperties:return"Unexpected property";case r.ValueErrorType.Intersect:return"Expected all values to match";case r.ValueErrorType.Iterator:return"Expected Iterator";case r.ValueErrorType.Literal:return`Expected ${typeof d.const=="string"?`'${d.const}'`:d.const}`;case r.ValueErrorType.Never:return"Never";case r.ValueErrorType.Not:return"Value should not match";case r.ValueErrorType.Null:return"Expected null";case r.ValueErrorType.NumberExclusiveMaximum:return`Expected number to be less than ${d.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${d.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${d.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${d.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${d.multipleOf}`;case r.ValueErrorType.Number:return"Expected number";case r.ValueErrorType.Object:return"Expected object";case r.ValueErrorType.ObjectAdditionalProperties:return"Unexpected property";case r.ValueErrorType.ObjectMaxProperties:return`Expected object to have no more than ${d.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${d.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${d.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${d.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${d.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${d.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${d.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${d.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${d.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${d.minByteLength}`;case r.ValueErrorType.Uint8Array:return"Expected Uint8Array";case r.ValueErrorType.Undefined:return"Expected undefined";case r.ValueErrorType.Union:return"Expected union value";case r.ValueErrorType.Void:return"Expected void";case r.ValueErrorType.Kind:return`Expected kind '${d[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=c}}),io=Ce({"../../../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=qt(),r=class extends t.TypeBoxError{constructor(i){super(`Unable to dereference schema with $id '${i.$id}'`),this.schema=i}};e.TypeDereferenceError=r;function n(i,s){let o=s.findIndex(a=>a.$id===i.$ref);if(o===-1)throw new r(i);return s[o]}e.Deref=n}}),$s=Ce({"../../../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=cn(),r=class extends Error{constructor(D){super("Unable to hash value"),this.value=D}};e.ValueHashError=r;var n;(function(D){D[D.Undefined=0]="Undefined",D[D.Null=1]="Null",D[D.Boolean=2]="Boolean",D[D.Number=3]="Number",D[D.String=4]="String",D[D.Object=5]="Object",D[D.Array=6]="Array",D[D.Date=7]="Date",D[D.Uint8Array=8]="Uint8Array",D[D.Symbol=9]="Symbol",D[D.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[s,o]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],a=Array.from({length:256}).map((D,L)=>BigInt(L)),l=new Float64Array(1),c=new DataView(l.buffer),d=new Uint8Array(l.buffer);function*g(D){let L=D===0?1:Math.ceil(Math.floor(Math.log2(D)+1)/8);for(let ee=0;ee<L;ee++)yield D>>8*(L-1-ee)&255}function x(D){ce(n.Array);for(let L of D)q(L)}function S(D){ce(n.Boolean),ce(D?1:0)}function R(D){ce(n.BigInt),c.setBigInt64(0,D);for(let L of d)ce(L)}function K(D){ce(n.Date),q(D.getTime())}function H(D){ce(n.Null)}function F(D){ce(n.Number),c.setFloat64(0,D);for(let L of d)ce(L)}function j(D){ce(n.Object);for(let L of globalThis.Object.keys(D).sort())q(L),q(D[L])}function V(D){ce(n.String);for(let L=0;L<D.length;L++)for(let ee of g(D.charCodeAt(L)))ce(ee)}function G(D){ce(n.Symbol),q(D.description)}function k(D){ce(n.Uint8Array);for(let L=0;L<D.length;L++)ce(D[L])}function Q(D){return ce(n.Undefined)}function q(D){if((0,t.IsArray)(D))return x(D);if((0,t.IsBoolean)(D))return S(D);if((0,t.IsBigInt)(D))return R(D);if((0,t.IsDate)(D))return K(D);if((0,t.IsNull)(D))return H(D);if((0,t.IsNumber)(D))return F(D);if((0,t.IsPlainObject)(D))return j(D);if((0,t.IsString)(D))return V(D);if((0,t.IsSymbol)(D))return G(D);if((0,t.IsUint8Array)(D))return k(D);if((0,t.IsUndefined)(D))return Q(D);throw new r(D)}function ce(D){i=i^a[D],i=i*s%o}function U(D){return i=BigInt("14695981039346656037"),q(D),i}e.Hash=U}}),oo=Ce({"../../../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=cn(),r=Kc(),n=io(),i=$s(),s=qt(),o;(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"})(o||(e.ValueErrorType=o={}));var a=class extends s.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:r.TypeSystemErrorFunction.Get()(A,u)}}function*x(u,A,b,v){}function*S(u,A,b,v){if(!(0,t.IsArray)(v))return yield g(o.Array,u,b,v);c(u.minItems)&&!(v.length>=u.minItems)&&(yield g(o.ArrayMinItems,u,b,v)),c(u.maxItems)&&!(v.length<=u.maxItems)&&(yield g(o.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 re of v){let pe=(0,i.Hash)(re);if(te.has(pe))return!1;te.add(pe)}return!0}()&&(yield g(o.ArrayUniqueItems,u,b,v)),!(c(u.contains)||c(u.minContains)||c(u.maxContains)))return;let $=c(u.contains)?u.contains:s.Type.Never(),z=v.reduce((te,re,pe)=>T($,A,`${b}${pe}`,re).next().done===!0?te+1:te,0);z===0&&(yield g(o.ArrayContains,u,b,v)),(0,t.IsNumber)(u.minContains)&&z<u.minContains&&(yield g(o.ArrayMinContains,u,b,v)),(0,t.IsNumber)(u.maxContains)&&z>u.maxContains&&(yield g(o.ArrayMaxContains,u,b,v))}function*R(u,A,b,v){(0,t.IsAsyncIterator)(v)||(yield g(o.AsyncIterator,u,b,v))}function*K(u,A,b,v){if(!(0,t.IsBigInt)(v))return yield g(o.BigInt,u,b,v);c(u.exclusiveMaximum)&&!(v<u.exclusiveMaximum)&&(yield g(o.BigIntExclusiveMaximum,u,b,v)),c(u.exclusiveMinimum)&&!(v>u.exclusiveMinimum)&&(yield g(o.BigIntExclusiveMinimum,u,b,v)),c(u.maximum)&&!(v<=u.maximum)&&(yield g(o.BigIntMaximum,u,b,v)),c(u.minimum)&&!(v>=u.minimum)&&(yield g(o.BigIntMinimum,u,b,v)),c(u.multipleOf)&&v%u.multipleOf!==BigInt(0)&&(yield g(o.BigIntMultipleOf,u,b,v))}function*H(u,A,b,v){(0,t.IsBoolean)(v)||(yield g(o.Boolean,u,b,v))}function*F(u,A,b,v){yield*T(u.returns,A,b,v.prototype)}function*j(u,A,b,v){if(!(0,t.IsDate)(v))return yield g(o.Date,u,b,v);c(u.exclusiveMaximumTimestamp)&&!(v.getTime()<u.exclusiveMaximumTimestamp)&&(yield g(o.DateExclusiveMaximumTimestamp,u,b,v)),c(u.exclusiveMinimumTimestamp)&&!(v.getTime()>u.exclusiveMinimumTimestamp)&&(yield g(o.DateExclusiveMinimumTimestamp,u,b,v)),c(u.maximumTimestamp)&&!(v.getTime()<=u.maximumTimestamp)&&(yield g(o.DateMaximumTimestamp,u,b,v)),c(u.minimumTimestamp)&&!(v.getTime()>=u.minimumTimestamp)&&(yield g(o.DateMinimumTimestamp,u,b,v)),c(u.multipleOfTimestamp)&&v.getTime()%u.multipleOfTimestamp!==0&&(yield g(o.DateMultipleOfTimestamp,u,b,v))}function*V(u,A,b,v){(0,t.IsFunction)(v)||(yield g(o.Function,u,b,v))}function*G(u,A,b,v){if(!(0,t.IsInteger)(v))return yield g(o.Integer,u,b,v);c(u.exclusiveMaximum)&&!(v<u.exclusiveMaximum)&&(yield g(o.IntegerExclusiveMaximum,u,b,v)),c(u.exclusiveMinimum)&&!(v>u.exclusiveMinimum)&&(yield g(o.IntegerExclusiveMinimum,u,b,v)),c(u.maximum)&&!(v<=u.maximum)&&(yield g(o.IntegerMaximum,u,b,v)),c(u.minimum)&&!(v>=u.minimum)&&(yield g(o.IntegerMinimum,u,b,v)),c(u.multipleOf)&&v%u.multipleOf!==0&&(yield g(o.IntegerMultipleOf,u,b,v))}function*k(u,A,b,v){for(let $ of u.allOf){let z=T($,A,b,v).next();z.done||(yield g(o.Intersect,u,b,v),yield z.value)}if(u.unevaluatedProperties===!1){let $=new RegExp(s.KeyResolver.ResolvePattern(u));for(let z of Object.getOwnPropertyNames(v))$.test(z)||(yield g(o.IntersectUnevaluatedProperties,u,`${b}/${z}`,v))}if(typeof u.unevaluatedProperties=="object"){let $=new RegExp(s.KeyResolver.ResolvePattern(u));for(let z of Object.getOwnPropertyNames(v))if(!$.test(z)){let te=T(u.unevaluatedProperties,A,`${b}/${z}`,v[z]).next();te.done||(yield te.value)}}}function*Q(u,A,b,v){(0,t.IsIterator)(v)||(yield g(o.Iterator,u,b,v))}function*q(u,A,b,v){v!==u.const&&(yield g(o.Literal,u,b,v))}function*ce(u,A,b,v){yield g(o.Never,u,b,v)}function*U(u,A,b,v){T(u.not,A,b,v).next().done===!0&&(yield g(o.Not,u,b,v))}function*D(u,A,b,v){(0,t.IsNull)(v)||(yield g(o.Null,u,b,v))}function*L(u,A,b,v){if(!r.TypeSystemPolicy.IsNumberLike(v))return yield g(o.Number,u,b,v);c(u.exclusiveMaximum)&&!(v<u.exclusiveMaximum)&&(yield g(o.NumberExclusiveMaximum,u,b,v)),c(u.exclusiveMinimum)&&!(v>u.exclusiveMinimum)&&(yield g(o.NumberExclusiveMinimum,u,b,v)),c(u.maximum)&&!(v<=u.maximum)&&(yield g(o.NumberMaximum,u,b,v)),c(u.minimum)&&!(v>=u.minimum)&&(yield g(o.NumberMinimum,u,b,v)),c(u.multipleOf)&&v%u.multipleOf!==0&&(yield g(o.NumberMultipleOf,u,b,v))}function*ee(u,A,b,v){if(!r.TypeSystemPolicy.IsObjectLike(v))return yield g(o.Object,u,b,v);c(u.minProperties)&&!(Object.getOwnPropertyNames(v).length>=u.minProperties)&&(yield g(o.ObjectMinProperties,u,b,v)),c(u.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=u.maxProperties)&&(yield g(o.ObjectMaxProperties,u,b,v));let $=Array.isArray(u.required)?u.required:[],z=Object.getOwnPropertyNames(u.properties),te=Object.getOwnPropertyNames(v);for(let re of $)te.includes(re)||(yield g(o.ObjectRequiredProperty,u.properties[re],`${b}/${l(re)}`,void 0));if(u.additionalProperties===!1)for(let re of te)z.includes(re)||(yield g(o.ObjectAdditionalProperties,u,`${b}/${l(re)}`,v[re]));if(typeof u.additionalProperties=="object")for(let re of te)z.includes(re)||(yield*T(u.additionalProperties,A,`${b}/${l(re)}`,v[re]));for(let re of z){let pe=u.properties[re];u.required&&u.required.includes(re)?(yield*T(pe,A,`${b}/${l(re)}`,v[re]),s.ExtendsUndefined.Check(u)&&!(re in v)&&(yield g(o.ObjectRequiredProperty,pe,`${b}/${l(re)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(v,re)&&(yield*T(pe,A,`${b}/${l(re)}`,v[re]))}}function*ie(u,A,b,v){(0,t.IsPromise)(v)||(yield g(o.Promise,u,b,v))}function*Y(u,A,b,v){if(!r.TypeSystemPolicy.IsRecordLike(v))return yield g(o.Object,u,b,v);c(u.minProperties)&&!(Object.getOwnPropertyNames(v).length>=u.minProperties)&&(yield g(o.ObjectMinProperties,u,b,v)),c(u.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=u.maxProperties)&&(yield g(o.ObjectMaxProperties,u,b,v));let[$,z]=Object.entries(u.patternProperties)[0],te=new RegExp($);for(let[re,pe]of Object.entries(v))te.test(re)&&(yield*T(z,A,`${b}/${l(re)}`,pe));if(typeof u.additionalProperties=="object")for(let[re,pe]of Object.entries(v))te.test(re)||(yield*T(u.additionalProperties,A,`${b}/${l(re)}`,pe));if(u.additionalProperties===!1){for(let[re,pe]of Object.entries(v))if(!te.test(re))return yield g(o.ObjectAdditionalProperties,u,`${b}/${l(re)}`,pe)}}function*se(u,A,b,v){yield*T((0,n.Deref)(u,A),A,b,v)}function*B(u,A,b,v){if(!(0,t.IsString)(v))return yield g(o.String,u,b,v);c(u.minLength)&&!(v.length>=u.minLength)&&(yield g(o.StringMinLength,u,b,v)),c(u.maxLength)&&!(v.length<=u.maxLength)&&(yield g(o.StringMaxLength,u,b,v)),(0,t.IsString)(u.pattern)&&(new RegExp(u.pattern).test(v)||(yield g(o.StringPattern,u,b,v))),(0,t.IsString)(u.format)&&(s.FormatRegistry.Has(u.format)?s.FormatRegistry.Get(u.format)(v)||(yield g(o.StringFormat,u,b,v)):yield g(o.StringFormatUnknown,u,b,v))}function*W(u,A,b,v){(0,t.IsSymbol)(v)||(yield g(o.Symbol,u,b,v))}function*X(u,A,b,v){if(!(0,t.IsString)(v))return yield g(o.String,u,b,v);new RegExp(u.pattern).test(v)||(yield g(o.StringPattern,u,b,v))}function*fe(u,A,b,v){yield*T((0,n.Deref)(u,A),A,b,v)}function*f(u,A,b,v){if(!(0,t.IsArray)(v))return yield g(o.Tuple,u,b,v);if(u.items===void 0&&v.length!==0)return yield g(o.TupleLength,u,b,v);if(v.length!==u.maxItems)return yield g(o.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(o.Undefined,u,b,v))}function*I(u,A,b,v){let $=0;for(let z of u.anyOf){let te=[...T(z,A,b,v)];if(te.length===0)return;$+=te.length}$>0&&(yield g(o.Union,u,b,v))}function*M(u,A,b,v){if(!(0,t.IsUint8Array)(v))return yield g(o.Uint8Array,u,b,v);c(u.maxByteLength)&&!(v.length<=u.maxByteLength)&&(yield g(o.Uint8ArrayMaxByteLength,u,b,v)),c(u.minByteLength)&&!(v.length>=u.minByteLength)&&(yield g(o.Uint8ArrayMinByteLength,u,b,v))}function*C(u,A,b,v){}function*P(u,A,b,v){r.TypeSystemPolicy.IsVoidLike(v)||(yield g(o.Void,u,b,v))}function*y(u,A,b,v){s.TypeRegistry.Get(u[s.Kind])(u,v)||(yield g(o.Kind,u,b,v))}function*T(u,A,b,v){let $=c(u.$id)?[...A,u]:A,z=u;switch(z[s.Kind]){case"Any":return yield*x(z,$,b,v);case"Array":return yield*S(z,$,b,v);case"AsyncIterator":return yield*R(z,$,b,v);case"BigInt":return yield*K(z,$,b,v);case"Boolean":return yield*H(z,$,b,v);case"Constructor":return yield*F(z,$,b,v);case"Date":return yield*j(z,$,b,v);case"Function":return yield*V(z,$,b,v);case"Integer":return yield*G(z,$,b,v);case"Intersect":return yield*k(z,$,b,v);case"Iterator":return yield*Q(z,$,b,v);case"Literal":return yield*q(z,$,b,v);case"Never":return yield*ce(z,$,b,v);case"Not":return yield*U(z,$,b,v);case"Null":return yield*D(z,$,b,v);case"Number":return yield*L(z,$,b,v);case"Object":return yield*ee(z,$,b,v);case"Promise":return yield*ie(z,$,b,v);case"Record":return yield*Y(z,$,b,v);case"Ref":return yield*se(z,$,b,v);case"String":return yield*B(z,$,b,v);case"Symbol":return yield*W(z,$,b,v);case"TemplateLiteral":return yield*X(z,$,b,v);case"This":return yield*fe(z,$,b,v);case"Tuple":return yield*f(z,$,b,v);case"Undefined":return yield*_(z,$,b,v);case"Union":return yield*I(z,$,b,v);case"Uint8Array":return yield*M(z,$,b,v);case"Unknown":return yield*C(z,$,b,v);case"Void":return yield*P(z,$,b,v);default:if(!s.TypeRegistry.Has(z[s.Kind]))throw new a(u);return yield*y(z,$,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}}),ch=Ce({"../../../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(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=e&&e.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(oo(),e)}}),Vc=Ce({"../../../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,s,o,a){a===void 0&&(a=o);var l=Object.getOwnPropertyDescriptor(s,o);(!l||("get"in l?!s.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(i,a,l)}:function(i,s,o,a){a===void 0&&(a=o),i[a]=s[o]}),r=e&&e.__exportStar||function(i,s){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=oo();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(Kc(),e)}}),lh=Ce({"../../../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=cn(),r=Vc(),n=io(),i=$s(),s=qt(),o=class extends s.TypeBoxError{constructor(y){super("Unknown type"),this.schema=y}};e.ValueCheckUnknownTypeError=o;function a(y){return y[s.Kind]==="Any"||y[s.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=>C(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:s.Type.Never(),A=w.reduce((b,v)=>C(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 x(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 S(y,T,w){return(0,t.IsBoolean)(w)}function R(y,T,w){return C(y.returns,T,w.prototype)}function K(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 H(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 j(y,T,w){let u=y.allOf.every(A=>C(A,T,w));if(y.unevaluatedProperties===!1){let A=new RegExp(s.KeyResolver.ResolvePattern(y)),b=Object.getOwnPropertyNames(w).every(v=>A.test(v));return u&&b}else if(s.TypeGuard.TSchema(y.unevaluatedProperties)){let A=new RegExp(s.KeyResolver.ResolvePattern(y)),b=Object.getOwnPropertyNames(w).every(v=>A.test(v)||C(y.unevaluatedProperties,T,w[v]));return u&&b}else return u}function V(y,T,w){return(0,t.IsIterator)(w)}function G(y,T,w){return w===y.const}function k(y,T,w){return!1}function Q(y,T,w){return!C(y.not,T,w)}function q(y,T,w){return(0,t.IsNull)(w)}function ce(y,T,w){return!(!r.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 U(y,T,w){if(!r.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(!C(b,T,w[A])||(s.ExtendsUndefined.Check(b)||a(b))&&!(A in w))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(w,A)&&!C(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)||C(y.additionalProperties,T,w[b])):!0}function D(y,T,w){return(0,t.IsPromise)(w)}function L(y,T,w){if(!r.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,re])=>b.test(te)?C(A,T,re):!0),$=typeof y.additionalProperties=="object"?Object.entries(w).every(([te,re])=>b.test(te)?!0:C(y.additionalProperties,T,re)):!0,z=y.additionalProperties===!1?Object.getOwnPropertyNames(w).every(te=>b.test(te)):!0;return v&&$&&z}function ee(y,T,w){return C((0,n.Deref)(y,T),T,w)}function ie(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)?s.FormatRegistry.Has(y.format)?s.FormatRegistry.Get(y.format)(w):!1:!0}function Y(y,T,w){return(0,t.IsSymbol)(w)}function se(y,T,w){return(0,t.IsString)(w)&&new RegExp(y.pattern).test(w)}function B(y,T,w){return C((0,n.Deref)(y,T),T,w)}function W(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(!C(y.items[u],T,w[u]))return!1;return!0}function X(y,T,w){return(0,t.IsUndefined)(w)}function fe(y,T,w){return y.anyOf.some(u=>C(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 I(y,T,w){return r.TypeSystemPolicy.IsVoidLike(w)}function M(y,T,w){return s.TypeRegistry.Has(y[s.Kind])?s.TypeRegistry.Get(y[s.Kind])(y,w):!1}function C(y,T,w){let u=l(y.$id)?[...T,y]:T,A=y;switch(A[s.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 x(A,u,w);case"Boolean":return S(A,u,w);case"Constructor":return R(A,u,w);case"Date":return K(A,u,w);case"Function":return H(A,u,w);case"Integer":return F(A,u,w);case"Intersect":return j(A,u,w);case"Iterator":return V(A,u,w);case"Literal":return G(A,u,w);case"Never":return k(A,u,w);case"Not":return Q(A,u,w);case"Null":return q(A,u,w);case"Number":return ce(A,u,w);case"Object":return U(A,u,w);case"Promise":return D(A,u,w);case"Record":return L(A,u,w);case"Ref":return ee(A,u,w);case"String":return ie(A,u,w);case"Symbol":return Y(A,u,w);case"TemplateLiteral":return se(A,u,w);case"This":return B(A,u,w);case"Tuple":return W(A,u,w);case"Undefined":return X(A,u,w);case"Union":return fe(A,u,w);case"Uint8Array":return f(A,u,w);case"Unknown":return _(A,u,w);case"Void":return I(A,u,w);default:if(!s.TypeRegistry.Has(A[s.Kind]))throw new o(A);return M(A,u,w)}}function P(...y){return y.length===3?C(y[0],y[1],y[2]):C(y[0],[],y[1])}e.Check=P}}),fh=Ce({"../../../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=cn(),r=io(),n=lh(),i=qt(),s=class extends i.TypeBoxError{constructor(x,S,R){super("Unable to decode due to invalid value"),this.schema=x,this.value=S,this.error=R}};e.TransformDecodeCheckError=s;var o=class extends i.TypeBoxError{constructor(x,S,R){super("Unable to encode due to invalid value"),this.schema=x,this.value=S,this.error=R}};e.TransformEncodeCheckError=o;var a=class extends i.TypeBoxError{constructor(x,S,R){super(`${R instanceof Error?R.message:"Unknown error"}`),this.schema=x,this.value=S}};e.TransformDecodeError=a;var l=class extends i.TypeBoxError{constructor(x,S,R){super(`${R instanceof Error?R.message:"Unknown error"}`),this.schema=x,this.value=S}};e.TransformEncodeError=l;var c;(function(x){function S(Y,se){return i.TypeGuard.TTransform(Y)||L(Y.items,se)}function R(Y,se){return i.TypeGuard.TTransform(Y)||L(Y.items,se)}function K(Y,se){return i.TypeGuard.TTransform(Y)||L(Y.returns,se)||Y.parameters.some(B=>L(B,se))}function H(Y,se){return i.TypeGuard.TTransform(Y)||L(Y.returns,se)||Y.parameters.some(B=>L(B,se))}function F(Y,se){return i.TypeGuard.TTransform(Y)||i.TypeGuard.TTransform(Y.unevaluatedProperties)||Y.allOf.some(B=>L(B,se))}function j(Y,se){return i.TypeGuard.TTransform(Y)||L(Y.items,se)}function V(Y,se){return i.TypeGuard.TTransform(Y)||L(Y.not,se)}function G(Y,se){return i.TypeGuard.TTransform(Y)||Object.values(Y.properties).some(B=>L(B,se))||i.TypeGuard.TSchema(Y.additionalProperties)&&L(Y.additionalProperties,se)}function k(Y,se){return i.TypeGuard.TTransform(Y)||L(Y.item,se)}function Q(Y,se){let B=Object.getOwnPropertyNames(Y.patternProperties)[0],W=Y.patternProperties[B];return i.TypeGuard.TTransform(Y)||L(W,se)||i.TypeGuard.TSchema(Y.additionalProperties)&&i.TypeGuard.TTransform(Y.additionalProperties)}function q(Y,se){return i.TypeGuard.TTransform(Y)?!0:L((0,r.Deref)(Y,se),se)}function ce(Y,se){return i.TypeGuard.TTransform(Y)?!0:L((0,r.Deref)(Y,se),se)}function U(Y,se){return i.TypeGuard.TTransform(Y)||!(0,t.IsUndefined)(Y.items)&&Y.items.some(B=>L(B,se))}function D(Y,se){return i.TypeGuard.TTransform(Y)||Y.anyOf.some(B=>L(B,se))}function L(Y,se){let B=(0,t.IsString)(Y.$id)?[...se,Y]:se,W=Y;if(Y.$id&&ee.has(Y.$id))return!1;switch(Y.$id&&ee.add(Y.$id),Y[i.Kind]){case"Array":return S(W,B);case"AsyncIterator":return R(W,B);case"Constructor":return K(W,B);case"Function":return H(W,B);case"Intersect":return F(W,B);case"Iterator":return j(W,B);case"Not":return V(W,B);case"Object":return G(W,B);case"Promise":return k(W,B);case"Record":return Q(W,B);case"Ref":return q(W,B);case"This":return ce(W,B);case"Tuple":return U(W,B);case"Union":return D(W,B);default:return i.TypeGuard.TTransform(Y)}}let ee=new Set;function ie(Y,se){return ee.clear(),L(Y,se)}x.Has=ie})(c||(e.HasTransform=c={}));var d;(function(x){function S(U,D){try{return i.TypeGuard.TTransform(U)?U[i.Transform].Decode(D):D}catch(L){throw new a(U,D,L)}}function R(U,D,L){return(0,t.IsArray)(L)?S(U,L.map(ee=>q(U.items,D,ee))):S(U,L)}function K(U,D,L){if(!(0,t.IsPlainObject)(L)||(0,t.IsValueType)(L))return S(U,L);let ee=i.KeyResolver.ResolveKeys(U,{includePatterns:!1}),ie=ee.reduce((W,X)=>X in W?{...W,[X]:q(i.IndexedAccessor.Resolve(U,[X]),D,W[X])}:W,L);if(!i.TypeGuard.TTransform(U.unevaluatedProperties))return S(U,ie);let Y=Object.getOwnPropertyNames(ie),se=U.unevaluatedProperties,B=Y.reduce((W,X)=>ee.includes(X)?W:{...W,[X]:S(se,W[X])},ie);return S(U,B)}function H(U,D,L){return S(U,q(U.not,D,L))}function F(U,D,L){if(!(0,t.IsPlainObject)(L))return S(U,L);let ee=i.KeyResolver.ResolveKeys(U,{includePatterns:!1}),ie=ee.reduce((W,X)=>X in W?{...W,[X]:q(U.properties[X],D,W[X])}:W,L);if(!i.TypeGuard.TSchema(U.additionalProperties))return S(U,ie);let Y=Object.getOwnPropertyNames(ie),se=U.additionalProperties,B=Y.reduce((W,X)=>ee.includes(X)?W:{...W,[X]:S(se,W[X])},ie);return S(U,B)}function j(U,D,L){if(!(0,t.IsPlainObject)(L))return S(U,L);let ee=Object.getOwnPropertyNames(U.patternProperties)[0],ie=new RegExp(ee),Y=Object.getOwnPropertyNames(L).reduce((X,fe)=>ie.test(fe)?{...X,[fe]:q(U.patternProperties[ee],D,X[fe])}:X,L);if(!i.TypeGuard.TSchema(U.additionalProperties))return S(U,Y);let se=Object.getOwnPropertyNames(Y),B=U.additionalProperties,W=se.reduce((X,fe)=>ie.test(fe)?X:{...X,[fe]:S(B,X[fe])},Y);return S(U,W)}function V(U,D,L){let ee=(0,r.Deref)(U,D);return S(U,q(ee,D,L))}function G(U,D,L){let ee=(0,r.Deref)(U,D);return S(U,q(ee,D,L))}function k(U,D,L){return(0,t.IsArray)(L)&&(0,t.IsArray)(U.items)?S(U,U.items.map((ee,ie)=>q(ee,D,L[ie]))):S(U,L)}function Q(U,D,L){let ee=S(U,L);for(let ie of U.anyOf)if((0,n.Check)(ie,D,ee))return q(ie,D,ee);return ee}function q(U,D,L){let ee=typeof U.$id=="string"?[...D,U]:D,ie=U;switch(U[i.Kind]){case"Array":return R(ie,ee,L);case"Intersect":return K(ie,ee,L);case"Not":return H(ie,ee,L);case"Object":return F(ie,ee,L);case"Record":return j(ie,ee,L);case"Ref":return V(ie,ee,L);case"Symbol":return S(ie,L);case"This":return G(ie,ee,L);case"Tuple":return k(ie,ee,L);case"Union":return Q(ie,ee,L);default:return S(ie,L)}}function ce(U,D,L){return q(U,D,L)}x.Decode=ce})(d||(e.DecodeTransform=d={}));var g;(function(x){function S(U,D){try{return i.TypeGuard.TTransform(U)?U[i.Transform].Encode(D):D}catch(L){throw new l(U,D,L)}}function R(U,D,L){let ee=S(U,L);return(0,t.IsArray)(ee)?ee.map(ie=>q(U.items,D,ie)):ee}function K(U,D,L){let ee=S(U,L);if(!(0,t.IsPlainObject)(L)||(0,t.IsValueType)(L))return ee;let ie=i.KeyResolver.ResolveKeys(U,{includePatterns:!1}),Y=ie.reduce((W,X)=>X in ee?{...W,[X]:q(i.IndexedAccessor.Resolve(U,[X]),D,W[X])}:W,ee);if(!i.TypeGuard.TTransform(U.unevaluatedProperties))return S(U,Y);let se=Object.getOwnPropertyNames(Y),B=U.unevaluatedProperties;return se.reduce((W,X)=>ie.includes(X)?W:{...W,[X]:S(B,W[X])},Y)}function H(U,D,L){return S(U.not,S(U,L))}function F(U,D,L){let ee=S(U,L);if(!(0,t.IsPlainObject)(L))return ee;let ie=i.KeyResolver.ResolveKeys(U,{includePatterns:!1}),Y=ie.reduce((W,X)=>X in W?{...W,[X]:q(U.properties[X],D,W[X])}:W,ee);if(!i.TypeGuard.TSchema(U.additionalProperties))return Y;let se=Object.getOwnPropertyNames(Y),B=U.additionalProperties;return se.reduce((W,X)=>ie.includes(X)?W:{...W,[X]:S(B,W[X])},Y)}function j(U,D,L){let ee=S(U,L);if(!(0,t.IsPlainObject)(L))return ee;let ie=Object.getOwnPropertyNames(U.patternProperties)[0],Y=new RegExp(ie),se=Object.getOwnPropertyNames(L).reduce((X,fe)=>Y.test(fe)?{...X,[fe]:q(U.patternProperties[ie],D,X[fe])}:X,ee);if(!i.TypeGuard.TSchema(U.additionalProperties))return S(U,se);let B=Object.getOwnPropertyNames(se),W=U.additionalProperties;return B.reduce((X,fe)=>Y.test(fe)?X:{...X,[fe]:S(W,X[fe])},se)}function V(U,D,L){let ee=(0,r.Deref)(U,D),ie=q(ee,D,L);return S(U,ie)}function G(U,D,L){let ee=(0,r.Deref)(U,D),ie=q(ee,D,L);return S(U,ie)}function k(U,D,L){let ee=S(U,L);return(0,t.IsArray)(U.items)?U.items.map((ie,Y)=>q(ie,D,ee[Y])):[]}function Q(U,D,L){for(let ee of U.anyOf){if(!(0,n.Check)(ee,D,L))continue;let ie=q(ee,D,L);return S(U,ie)}for(let ee of U.anyOf){let ie=q(ee,D,L);if((0,n.Check)(U,D,ie))return S(U,ie)}return S(U,L)}function q(U,D,L){let ee=typeof U.$id=="string"?[...D,U]:D,ie=U;switch(U[i.Kind]){case"Array":return R(ie,ee,L);case"Intersect":return K(ie,ee,L);case"Not":return H(ie,ee,L);case"Object":return F(ie,ee,L);case"Record":return j(ie,ee,L);case"Ref":return V(ie,ee,L);case"This":return G(ie,ee,L);case"Tuple":return k(ie,ee,L);case"Union":return Q(ie,ee,L);default:return S(ie,L)}}function ce(U,D,L){return q(U,D,L)}x.Encode=ce})(g||(e.EncodeTransform=g={}))}}),dh=Ce({"../../../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=fh(),r=cn(),n=oo(),i=Vc(),s=io(),o=$s(),a=qt(),l=class{constructor(F,j,V,G){this.schema=F,this.references=j,this.checkFunc=V,this.code=G,this.hasTransform=t.HasTransform.Has(F,j)}Code(){return this.code}Errors(F){return(0,n.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 j=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,F):F;if(!this.checkFunc(j))throw new t.TransformEncodeCheckError(this.schema,F,this.Errors(F).First());return j}};e.TypeCheck=l;var c;(function(F){function j(Q){return Q===36}F.DollarSign=j;function V(Q){return Q===95}F.IsUnderscore=V;function G(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}F.IsAlpha=G;function k(Q){return Q>=48&&Q<=57}F.IsNumeric=k})(c||(c={}));var d;(function(F){function j(Q){return Q.length===0?!1:c.IsNumeric(Q.charCodeAt(0))}function V(Q){if(j(Q))return!1;for(let q=0;q<Q.length;q++){let ce=Q.charCodeAt(q);if(!(c.IsAlpha(ce)||c.IsNumeric(ce)||c.DollarSign(ce)||c.IsUnderscore(ce)))return!1}return!0}function G(Q){return Q.replace(/'/g,"\\'")}function k(Q,q){return V(q)?`${Q}.${q}`:`${Q}['${G(q)}']`}F.Encode=k})(d||(d={}));var g;(function(F){function j(V){let G=[];for(let k=0;k<V.length;k++){let Q=V.charCodeAt(k);c.IsNumeric(Q)||c.IsAlpha(Q)?G.push(V.charAt(k)):G.push(`_${Q}_`)}return G.join("").replace(/__/g,"_")}F.Encode=j})(g||(g={}));var x;(function(F){function j(V){return V.replace(/'/g,"\\'")}F.Escape=j})(x||(x={}));var S=class extends a.TypeBoxError{constructor(F){super("Unknown type"),this.schema=F}};e.TypeCompilerUnknownTypeError=S;var R=class extends a.TypeBoxError{constructor(F){super("Preflight validation check failed to guard for the given schema"),this.schema=F}};e.TypeCompilerTypeGuardError=R;var K;(function(F){function j(q,ce,U){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${ce}' in ${q} ? ${U} : true)`:`(${d.Encode(q,ce)} !== undefined ? ${U} : true)`}F.IsExactOptionalProperty=j;function V(q){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${q} === 'object' && ${q} !== null)`:`(typeof ${q} === 'object' && ${q} !== null && !Array.isArray(${q}))`}F.IsObjectLike=V;function G(q){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${q} === 'object' && ${q} !== null && !(${q} instanceof Date) && !(${q} instanceof Uint8Array))`:`(typeof ${q} === 'object' && ${q} !== null && !Array.isArray(${q}) && !(${q} instanceof Date) && !(${q} instanceof Uint8Array))`}F.IsRecordLike=G;function k(q){return i.TypeSystemPolicy.AllowNaN?`typeof ${q} === 'number'`:`(typeof ${q} === 'number' && Number.isFinite(${q}))`}F.IsNumberLike=k;function Q(q){return i.TypeSystemPolicy.AllowNullVoid?`(${q} === undefined || ${q} === null)`:`${q} === undefined`}F.IsVoidLike=Q})(K||(e.Policy=K={}));var H;(function(F){function j(O){return O[a.Kind]==="Any"||O[a.Kind]==="Unknown"}function*V(O,ue,N){yield"true"}function*G(O,ue,N){yield`Array.isArray(${N})`;let[he,ne]=[De("value","any"),De("acc","number")];(0,r.IsNumber)(O.maxItems)&&(yield`${N}.length <= ${O.maxItems}`),(0,r.IsNumber)(O.minItems)&&(yield`${N}.length >= ${O.minItems}`);let le=re(O.items,ue,"value");if(yield`${N}.every((${he}) => ${le})`,a.TypeGuard.TSchema(O.contains)||(0,r.IsNumber)(O.minContains)||(0,r.IsNumber)(O.maxContains)){let Ae=a.TypeGuard.TSchema(O.contains)?O.contains:a.Type.Never(),Ue=re(Ae,ue,"value"),Ye=(0,r.IsNumber)(O.minContains)?[`(count >= ${O.minContains})`]:[],He=(0,r.IsNumber)(O.maxContains)?[`(count <= ${O.maxContains})`]:[],Ze=`const count = value.reduce((${ne}, ${he}) => ${Ue} ? acc + 1 : acc, 0)`,zt=["(count > 0)",...Ye,...He].join(" && ");yield`((${he}) => { ${Ze}; return ${zt}})(${N})`}O.uniqueItems===!0&&(yield`((${he}) => { 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 } )(${N})`)}function*k(O,ue,N){yield`(typeof value === 'object' && Symbol.asyncIterator in ${N})`}function*Q(O,ue,N){yield`(typeof ${N} === 'bigint')`,(0,r.IsBigInt)(O.exclusiveMaximum)&&(yield`${N} < BigInt(${O.exclusiveMaximum})`),(0,r.IsBigInt)(O.exclusiveMinimum)&&(yield`${N} > BigInt(${O.exclusiveMinimum})`),(0,r.IsBigInt)(O.maximum)&&(yield`${N} <= BigInt(${O.maximum})`),(0,r.IsBigInt)(O.minimum)&&(yield`${N} >= BigInt(${O.minimum})`),(0,r.IsBigInt)(O.multipleOf)&&(yield`(${N} % BigInt(${O.multipleOf})) === 0`)}function*q(O,ue,N){yield`(typeof ${N} === 'boolean')`}function*ce(O,ue,N){yield*z(O.returns,ue,`${N}.prototype`)}function*U(O,ue,N){yield`(${N} instanceof Date) && Number.isFinite(${N}.getTime())`,(0,r.IsNumber)(O.exclusiveMaximumTimestamp)&&(yield`${N}.getTime() < ${O.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(O.exclusiveMinimumTimestamp)&&(yield`${N}.getTime() > ${O.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(O.maximumTimestamp)&&(yield`${N}.getTime() <= ${O.maximumTimestamp}`),(0,r.IsNumber)(O.minimumTimestamp)&&(yield`${N}.getTime() >= ${O.minimumTimestamp}`),(0,r.IsNumber)(O.multipleOfTimestamp)&&(yield`(${N}.getTime() % ${O.multipleOfTimestamp}) === 0`)}function*D(O,ue,N){yield`(typeof ${N} === 'function')`}function*L(O,ue,N){yield`(typeof ${N} === 'number' && Number.isInteger(${N}))`,(0,r.IsNumber)(O.exclusiveMaximum)&&(yield`${N} < ${O.exclusiveMaximum}`),(0,r.IsNumber)(O.exclusiveMinimum)&&(yield`${N} > ${O.exclusiveMinimum}`),(0,r.IsNumber)(O.maximum)&&(yield`${N} <= ${O.maximum}`),(0,r.IsNumber)(O.minimum)&&(yield`${N} >= ${O.minimum}`),(0,r.IsNumber)(O.multipleOf)&&(yield`(${N} % ${O.multipleOf}) === 0`)}function*ee(O,ue,N){let he=O.allOf.map(ne=>re(ne,ue,N)).join(" && ");if(O.unevaluatedProperties===!1){let ne=ge(`${new RegExp(a.KeyResolver.ResolvePattern(O))};`),le=`Object.getOwnPropertyNames(${N}).every(key => ${ne}.test(key))`;yield`(${he} && ${le})`}else if(a.TypeGuard.TSchema(O.unevaluatedProperties)){let ne=ge(`${new RegExp(a.KeyResolver.ResolvePattern(O))};`),le=`Object.getOwnPropertyNames(${N}).every(key => ${ne}.test(key) || ${re(O.unevaluatedProperties,ue,`${N}[key]`)})`;yield`(${he} && ${le})`}else yield`(${he})`}function*ie(O,ue,N){yield`(typeof value === 'object' && Symbol.iterator in ${N})`}function*Y(O,ue,N){typeof O.const=="number"||typeof O.const=="boolean"?yield`(${N} === ${O.const})`:yield`(${N} === '${x.Escape(O.const)}')`}function*se(O,ue,N){yield"false"}function*B(O,ue,N){yield`(!${re(O.not,ue,N)})`}function*W(O,ue,N){yield`(${N} === null)`}function*X(O,ue,N){yield K.IsNumberLike(N),(0,r.IsNumber)(O.exclusiveMaximum)&&(yield`${N} < ${O.exclusiveMaximum}`),(0,r.IsNumber)(O.exclusiveMinimum)&&(yield`${N} > ${O.exclusiveMinimum}`),(0,r.IsNumber)(O.maximum)&&(yield`${N} <= ${O.maximum}`),(0,r.IsNumber)(O.minimum)&&(yield`${N} >= ${O.minimum}`),(0,r.IsNumber)(O.multipleOf)&&(yield`(${N} % ${O.multipleOf}) === 0`)}function*fe(O,ue,N){yield K.IsObjectLike(N),(0,r.IsNumber)(O.minProperties)&&(yield`Object.getOwnPropertyNames(${N}).length >= ${O.minProperties}`),(0,r.IsNumber)(O.maxProperties)&&(yield`Object.getOwnPropertyNames(${N}).length <= ${O.maxProperties}`);let he=Object.getOwnPropertyNames(O.properties);for(let ne of he){let le=d.Encode(N,ne),Ae=O.properties[ne];if(O.required&&O.required.includes(ne))yield*z(Ae,ue,le),(a.ExtendsUndefined.Check(Ae)||j(Ae))&&(yield`('${ne}' in ${N})`);else{let Ue=re(Ae,ue,le);yield K.IsExactOptionalProperty(N,ne,Ue)}}if(O.additionalProperties===!1)if(O.required&&O.required.length===he.length)yield`Object.getOwnPropertyNames(${N}).length === ${he.length}`;else{let ne=`[${he.map(le=>`'${le}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${N}).every(key => ${ne}.includes(key))`}if(typeof O.additionalProperties=="object"){let ne=re(O.additionalProperties,ue,`${N}[key]`),le=`[${he.map(Ae=>`'${Ae}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${N}).every(key => ${le}.includes(key) || ${ne}))`}}function*f(O,ue,N){yield`(typeof value === 'object' && typeof ${N}.then === 'function')`}function*_(O,ue,N){yield K.IsRecordLike(N),(0,r.IsNumber)(O.minProperties)&&(yield`Object.getOwnPropertyNames(${N}).length >= ${O.minProperties}`),(0,r.IsNumber)(O.maxProperties)&&(yield`Object.getOwnPropertyNames(${N}).length <= ${O.maxProperties}`);let[he,ne]=Object.entries(O.patternProperties)[0],le=ge(`${new RegExp(he)}`),Ae=re(ne,ue,"value"),Ue=a.TypeGuard.TSchema(O.additionalProperties)?re(O.additionalProperties,ue,N):O.additionalProperties===!1?"false":"true",Ye=`(${le}.test(key) ? ${Ae} : ${Ue})`;yield`(Object.entries(${N}).every(([key, value]) => ${Ye}))`}function*I(O,ue,N){let he=(0,s.Deref)(O,ue);if(te.functions.has(O.$ref))return yield`${pe(O.$ref)}(${N})`;yield*z(he,ue,N)}function*M(O,ue,N){yield`(typeof ${N} === 'string')`,(0,r.IsNumber)(O.maxLength)&&(yield`${N}.length <= ${O.maxLength}`),(0,r.IsNumber)(O.minLength)&&(yield`${N}.length >= ${O.minLength}`),O.pattern!==void 0&&(yield`${ge(`${new RegExp(O.pattern)};`)}.test(${N})`),O.format!==void 0&&(yield`format('${O.format}', ${N})`)}function*C(O,ue,N){yield`(typeof ${N} === 'symbol')`}function*P(O,ue,N){yield`(typeof ${N} === 'string')`,yield`${ge(`${new RegExp(O.pattern)};`)}.test(${N})`}function*y(O,ue,N){yield`${pe(O.$ref)}(${N})`}function*T(O,ue,N){if(yield`Array.isArray(${N})`,O.items===void 0)return yield`${N}.length === 0`;yield`(${N}.length === ${O.maxItems})`;for(let he=0;he<O.items.length;he++)yield`${re(O.items[he],ue,`${N}[${he}]`)}`}function*w(O,ue,N){yield`${N} === undefined`}function*u(O,ue,N){yield`(${O.anyOf.map(ne=>re(ne,ue,N)).join(" || ")})`}function*A(O,ue,N){yield`${N} instanceof Uint8Array`,(0,r.IsNumber)(O.maxByteLength)&&(yield`(${N}.length <= ${O.maxByteLength})`),(0,r.IsNumber)(O.minByteLength)&&(yield`(${N}.length >= ${O.minByteLength})`)}function*b(O,ue,N){yield"true"}function*v(O,ue,N){yield K.IsVoidLike(N)}function*$(O,ue,N){let he=te.instances.size;te.instances.set(he,O),yield`kind('${O[a.Kind]}', ${he}, ${N})`}function*z(O,ue,N,he=!0){let ne=(0,r.IsString)(O.$id)?[...ue,O]:ue,le=O;if(he&&(0,r.IsString)(O.$id)){let Ae=pe(O.$id);if(te.functions.has(Ae))return yield`${Ae}(${N})`;{let Ue=$e(Ae,O,ue,"value",!1);return te.functions.set(Ae,Ue),yield`${Ae}(${N})`}}switch(le[a.Kind]){case"Any":return yield*V(le,ne,N);case"Array":return yield*G(le,ne,N);case"AsyncIterator":return yield*k(le,ne,N);case"BigInt":return yield*Q(le,ne,N);case"Boolean":return yield*q(le,ne,N);case"Constructor":return yield*ce(le,ne,N);case"Date":return yield*U(le,ne,N);case"Function":return yield*D(le,ne,N);case"Integer":return yield*L(le,ne,N);case"Intersect":return yield*ee(le,ne,N);case"Iterator":return yield*ie(le,ne,N);case"Literal":return yield*Y(le,ne,N);case"Never":return yield*se(le,ne,N);case"Not":return yield*B(le,ne,N);case"Null":return yield*W(le,ne,N);case"Number":return yield*X(le,ne,N);case"Object":return yield*fe(le,ne,N);case"Promise":return yield*f(le,ne,N);case"Record":return yield*_(le,ne,N);case"Ref":return yield*I(le,ne,N);case"String":return yield*M(le,ne,N);case"Symbol":return yield*C(le,ne,N);case"TemplateLiteral":return yield*P(le,ne,N);case"This":return yield*y(le,ne,N);case"Tuple":return yield*T(le,ne,N);case"Undefined":return yield*w(le,ne,N);case"Union":return yield*u(le,ne,N);case"Uint8Array":return yield*A(le,ne,N);case"Unknown":return yield*b(le,ne,N);case"Void":return yield*v(le,ne,N);default:if(!a.TypeRegistry.Has(le[a.Kind]))throw new S(O);return yield*$(le,ne,N)}}let te={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function re(O,ue,N,he=!0){return`(${[...z(O,ue,N,he)].join(" && ")})`}function pe(O){return`check_${g.Encode(O)}`}function ge(O){let ue=`local_${te.variables.size}`;return te.variables.set(ue,`const ${ue} = ${O}`),ue}function $e(O,ue,N,he,ne=!0){let[le,Ae]=[`
|
|
49
|
+
`,Ze=>"".padStart(Ze," ")],Ue=De("value","any"),Ye=vr("boolean"),He=[...z(ue,N,he,ne)].map(Ze=>`${Ae(4)}${Ze}`).join(` &&${le}`);return`function ${O}(${Ue})${Ye} {${le}${Ae(2)}return (${le}${He}${le}${Ae(2)})
|
|
50
|
+
}`}function De(O,ue){let N=te.language==="typescript"?`: ${ue}`:"";return`${O}${N}`}function vr(O){return te.language==="typescript"?`: ${O}`:""}function me(O,ue,N){let he=$e("check",O,ue,"value"),ne=De("value","any"),le=vr("boolean"),Ae=[...te.functions.values()],Ue=[...te.variables.values()],Ye=(0,r.IsString)(O.$id)?`return function check(${ne})${le} {
|
|
51
|
+
return ${pe(O.$id)}(value)
|
|
52
|
+
}`:`return ${he}`;return[...Ue,...Ae,Ye].join(`
|
|
53
|
+
`)}function rr(...O){let ue={language:"javascript"},[N,he,ne]=O.length===2&&(0,r.IsArray)(O[1])?[O[0],O[1],ue]:O.length===2&&!(0,r.IsArray)(O[1])?[O[0],[],O[1]]:O.length===3?[O[0],O[1],O[2]]:O.length===1?[O[0],[],ue]:[null,[],ue];if(te.language=ne.language,te.variables.clear(),te.functions.clear(),te.instances.clear(),!a.TypeGuard.TSchema(N))throw new R(N);for(let le of he)if(!a.TypeGuard.TSchema(le))throw new R(le);return me(N,he,ne)}F.Code=rr;function br(O,ue=[]){let N=rr(O,ue,{language:"javascript"}),he=globalThis.Function("kind","format","hash",N),ne=new Map(te.instances);function le(He,Ze,zt){if(!a.TypeRegistry.Has(He)||!ne.has(Ze))return!1;let zr=a.TypeRegistry.Get(He),qr=ne.get(Ze);return zr(qr,zt)}function Ae(He,Ze){return a.FormatRegistry.Has(He)?a.FormatRegistry.Get(He)(Ze):!1}function Ue(He){return(0,o.Hash)(He)}let Ye=he(le,Ae,Ue);return new l(O,ue,Ye,N)}F.Compile=br})(H||(e.TypeCompiler=H={}))}}),ph=Ce({"../../../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,s,o,a){a===void 0&&(a=o);var l=Object.getOwnPropertyDescriptor(s,o);(!l||("get"in l?!s.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(i,a,l)}:function(i,s,o,a){a===void 0&&(a=o),i[a]=s[o]}),r=e&&e.__exportStar||function(i,s){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=ch();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(dh(),e)}}),Li=ft(sh(),1),hh=ft(ah(),1),zc=!1,qc=!1;Li.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(zc=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(qc=process?.env?.LOGGER_PERF_PREFIX==="true"));var yh={prefix:void 0,time:zc,delta:qc,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},ns=[],Gc=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,r,n){Object.assign(this,{sinceFirst:e,sinceLast:t,time:r,delta:n})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),r=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?r:null].filter(n=>n!=null).join(",")}]`}},Wc=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Ln=!1,Oe=class rt{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=rt.INFO,r={}){r=Object.assign({},yh,r),t>10&&console.debug("setup logger",{config:r});let n=this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}),i=(...l)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...l)};i.isDisabled=!0,i.isEnabled=!1;let s=this.wrapLog(console.groupCollapsed,r),o=(l,c)=>{function d(...x){let S=x[x.length-1];return S===i?S():(s(...x.slice(0,-1)),(async()=>{try{let R=S();return R instanceof Promise?await R:R}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=o(t>=rt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...l)=>(a(...l),new Error(l.map(c=>typeof c=="string"?c:(0,hh.default)(c)).join(" "))),WARN:o(t>=rt.WARN,this.wrapLog(console.warn,r)),LOG:o(t>=rt.INFO,this.wrapLog(console.log,r)),DEBUG:o(t>=rt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:o(t>=rt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Li.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Li.isBrowser&&navigator.userAgent.includes("Chrome")?["",rt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Ln?n.push(new Wc("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();rt.firstLog||(rt.firstLog=i,rt.lastLog=i);let s=new Gc(i-rt.firstLog,i-rt.lastLog,t,r);return rt.lastLog=i,n?s.toString():s}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
|
|
54
|
+
`)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};Li.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(ns&&ns.length){for(let t of ns)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Gc))return null;Ln||(Ln=!0);let t=Oe.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof Wc?(Ln||(Ln=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var gh=typeof global=="object"&&global&&global.Object===Object&&global,Hc=gh,mh=typeof self=="object"&&self&&self.Object===Object&&self,vh=Hc||mh||Function("return this")(),ut=vh,bh=ut.Symbol,Ft=bh,Jc=Object.prototype,_h=Jc.hasOwnProperty,wh=Jc.toString,Un=Ft?Ft.toStringTag:void 0;function Th(e){var t=_h.call(e,Un),r=e[Un];try{e[Un]=void 0;var n=!0}catch{}var i=wh.call(e);return n&&(t?e[Un]=r:delete e[Un]),i}var Ah=Th,Oh=Object.prototype,Ih=Oh.toString;function Eh(e){return Ih.call(e)}var Sh=Eh,Rh="[object Null]",Ph="[object Undefined]",Su=Ft?Ft.toStringTag:void 0;function $h(e){return e==null?e===void 0?Ph:Rh:Su&&Su in Object(e)?Ah(e):Sh(e)}var ln=$h;function Nh(e){return e!=null&&typeof e=="object"}var hr=Nh,Ch="[object Symbol]";function xh(e){return typeof e=="symbol"||hr(e)&&ln(e)==Ch}var an=xh;function Uh(e,t){for(var r=-1,n=e==null?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}var Xc=Uh,Mh=Array.isArray,Mt=Mh,Dh=1/0,Ru=Ft?Ft.prototype:void 0,Pu=Ru?Ru.toString:void 0;function Yc(e){if(typeof e=="string")return e;if(Mt(e))return Xc(e,Yc)+"";if(an(e))return Pu?Pu.call(e):"";var t=e+"";return t=="0"&&1/e==-Dh?"-0":t}var Bh=Yc,Lh=/\s/;function jh(e){for(var t=e.length;t--&&Lh.test(e.charAt(t)););return t}var kh=jh,Fh=/^\s+/;function Kh(e){return e&&e.slice(0,kh(e)+1).replace(Fh,"")}var Vh=Kh;function zh(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Qt=zh,$u=NaN,qh=/^[-+]0x[0-9a-f]+$/i,Gh=/^0b[01]+$/i,Wh=/^0o[0-7]+$/i,Hh=parseInt;function Jh(e){if(typeof e=="number")return e;if(an(e))return $u;if(Qt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Qt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Vh(e);var r=Gh.test(e);return r||Wh.test(e)?Hh(e.slice(2),r?2:8):qh.test(e)?$u:+e}var Xh=Jh,Nu=1/0,Yh=17976931348623157e292;function Qh(e){if(!e)return e===0?e:0;if(e=Xh(e),e===Nu||e===-Nu){var t=e<0?-1:1;return t*Yh}return e===e?e:0}var Zh=Qh;function ey(e){var t=Zh(e),r=t%1;return t===t?r?t-r:t:0}var Cu=ey;function ty(e){return e}var so=ty,ry="[object AsyncFunction]",ny="[object Function]",iy="[object GeneratorFunction]",oy="[object Proxy]";function sy(e){if(!Qt(e))return!1;var t=ln(e);return t==ny||t==iy||t==ry||t==oy}var Qc=sy,ay=ut["__core-js_shared__"],is=ay,xu=function(){var e=/[^.]+$/.exec(is&&is.keys&&is.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function uy(e){return!!xu&&xu in e}var cy=uy,ly=Function.prototype,fy=ly.toString;function dy(e){if(e!=null){try{return fy.call(e)}catch{}try{return e+""}catch{}}return""}var Dr=dy,py=/[\\^$.*+?()[\]{}|]/g,hy=/^\[object .+?Constructor\]$/,yy=Function.prototype,gy=Object.prototype,my=yy.toString,vy=gy.hasOwnProperty,by=RegExp("^"+my.call(vy).replace(py,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _y(e){if(!Qt(e)||cy(e))return!1;var t=Qc(e)?by:hy;return t.test(Dr(e))}var wy=_y;function Ty(e,t){return e?.[t]}var Ay=Ty;function Oy(e,t){var r=Ay(e,t);return wy(r)?r:void 0}var Br=Oy,Iy=Br(ut,"WeakMap"),kn=Iy,Ey=kn&&new kn,ji=Ey,Sy=ji?function(e,t){return ji.set(e,t),e}:so,Zc=Sy,Uu=Object.create,Ry=function(){function e(){}return function(t){if(!Qt(t))return{};if(Uu)return Uu(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),Ns=Ry;function Py(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 r=Ns(e.prototype),n=e.apply(r,t);return Qt(n)?n:r}}var Fn=Py,$y=1;function Ny(e,t,r){var n=t&$y,i=Fn(e);function s(){var o=this&&this!==ut&&this instanceof s?i:e;return o.apply(n?r:this,arguments)}return s}var Cy=Ny;function xy(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Cs=xy,Uy=Math.max;function My(e,t,r,n){for(var i=-1,s=e.length,o=r.length,a=-1,l=t.length,c=Uy(s-o,0),d=Array(l+c),g=!n;++a<l;)d[a]=t[a];for(;++i<o;)(g||i<s)&&(d[r[i]]=e[i]);for(;c--;)d[a++]=e[i++];return d}var el=My,Dy=Math.max;function By(e,t,r,n){for(var i=-1,s=e.length,o=-1,a=r.length,l=-1,c=t.length,d=Dy(s-a,0),g=Array(d+c),x=!n;++i<d;)g[i]=e[i];for(var S=i;++l<c;)g[S+l]=t[l];for(;++o<a;)(x||i<s)&&(g[S+r[o]]=e[i++]);return g}var tl=By;function Ly(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var jy=Ly;function ky(){}var xs=ky,Fy=4294967295;function ki(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Fy,this.__views__=[]}ki.prototype=Ns(xs.prototype);ki.prototype.constructor=ki;var Us=ki;function Ky(){}var rl=Ky,Vy=ji?function(e){return ji.get(e)}:rl,nl=Vy,zy={},Mu=zy,qy=Object.prototype,Gy=qy.hasOwnProperty;function Wy(e){for(var t=e.name+"",r=Mu[t],n=Gy.call(Mu,t)?r.length:0;n--;){var i=r[n],s=i.func;if(s==null||s==e)return i.name}return t}var Hy=Wy;function Fi(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}Fi.prototype=Ns(xs.prototype);Fi.prototype.constructor=Fi;var gs=Fi;function Jy(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var il=Jy;function Xy(e){if(e instanceof Us)return e.clone();var t=new gs(e.__wrapped__,e.__chain__);return t.__actions__=il(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Yy=Xy,Qy=Object.prototype,Zy=Qy.hasOwnProperty;function Ki(e){if(hr(e)&&!Mt(e)&&!(e instanceof Us)){if(e instanceof gs)return e;if(Zy.call(e,"__wrapped__"))return Yy(e)}return new gs(e)}Ki.prototype=xs.prototype;Ki.prototype.constructor=Ki;var eg=Ki;function tg(e){var t=Hy(e),r=eg[t];if(typeof r!="function"||!(t in Us.prototype))return!1;if(e===r)return!0;var n=nl(r);return!!n&&e===n[0]}var rg=tg,ng=800,ig=16,og=Date.now;function sg(e){var t=0,r=0;return function(){var n=og(),i=ig-(n-r);if(r=n,i>0){if(++t>=ng)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var ol=sg,ag=ol(Zc),sl=ag,ug=/\{\n\/\* \[wrapped with (.+)\] \*/,cg=/,? & /;function lg(e){var t=e.match(ug);return t?t[1].split(cg):[]}var fg=lg,dg=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function pg(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(dg,`{
|
|
55
55
|
/* [wrapped with `+t+`] */
|
|
56
|
-
`)}var fm=lm;function dm(e){return function(){return e}}var pm=dm,hm=function(){try{var e=Xn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),fo=hm,ym=fo?function(e,t){return fo(e,"toString",{configurable:!0,enumerable:!1,value:pm(t),writable:!0})}:Io,gm=ym,mm=kl(gm),sa=mm;function vm(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}var bm=vm;function _m(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 wm=_m;function Tm(e){return e!==e}var Am=Tm;function Om(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}var Em=Om;function Im(e,t,n){return t===t?Em(e,t,n):wm(e,Am,n)}var Sm=Im;function $m(e,t){var n=e==null?0:e.length;return!!n&&Sm(e,t,0)>-1}var jl=$m,Nm=1,Rm=2,Pm=8,Cm=16,xm=32,Um=64,Mm=128,Bm=256,Dm=512,km=[["ary",Mm],["bind",Nm],["bindKey",Rm],["curry",Pm],["curryRight",Cm],["flip",Dm],["partial",xm],["partialRight",Um],["rearg",Bm]];function Lm(e,t){return bm(km,function(n){var r="_."+n[0];t&n[1]&&!jl(e,r)&&e.push(r)}),e.sort()}var jm=Lm;function Fm(e,t,n){var r=t+"";return sa(e,fm(r,jm(um(r),n)))}var Fl=Fm,zm=1,Vm=2,Km=4,qm=8,wc=32,Tc=64;function Gm(e,t,n,r,i,o,s,a,l,c){var d=t&qm,g=d?s:void 0,C=d?void 0:s,I=d?o:void 0,S=d?void 0:o;t|=d?wc:Tc,t&=~(d?Tc:wc),t&Km||(t&=~(zm|Vm));var z=[e,t,i,I,g,S,C,a,l,c],J=n.apply(void 0,z);return Zg(e)&&Ll(J,z),J.placeholder=r,Fl(J,e,t)}var zl=Gm;function Wm(e){var t=e;return t.placeholder}var aa=Wm,Hm=9007199254740991,Jm=/^(?:0|[1-9]\d*)$/;function Xm(e,t){var n=typeof e;return t=t??Hm,!!t&&(n=="number"||n!="symbol"&&Jm.test(e))&&e>-1&&e%1==0&&e<t}var So=Xm,Ym=Math.min;function Qm(e,t){for(var n=e.length,r=Ym(t.length,n),i=Dl(e);r--;){var o=t[r];e[r]=So(o,n)?i[o]:void 0}return e}var Zm=Qm,Ac="__lodash_placeholder__";function ev(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];(s===t||s===Ac)&&(e[n]=Ac,o[i++]=n)}return o}var ui=ev,tv=1,nv=2,rv=8,iv=16,ov=128,sv=512;function Vl(e,t,n,r,i,o,s,a,l,c){var d=t&ov,g=t&tv,C=t&nv,I=t&(rv|iv),S=t&sv,z=C?void 0:ai(e);function J(){for(var F=arguments.length,L=Array(F),K=F;K--;)L[K]=arguments[K];if(I)var W=aa(J),j=Bg(L,W);if(r&&(L=xl(L,r,i,I)),o&&(L=Ul(L,o,s,I)),F-=j,I&&F<c){var Z=ui(L,W);return zl(e,t,Vl,J.placeholder,n,L,Z,a,l,c-F)}var G=g?n:this,fe=C?G[e]:e;return F=L.length,a?L=Zm(L,a):S&&F>1&&L.reverse(),d&&l<F&&(L.length=l),this&&this!==ht&&this instanceof J&&(fe=z||ai(fe)),fe.apply(G,L)}return J}var Kl=Vl;function av(e,t,n){var r=ai(e);function i(){for(var o=arguments.length,s=Array(o),a=o,l=aa(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 zl(e,t,Kl,i.placeholder,void 0,s,c,void 0,void 0,n-o);var d=this&&this!==ht&&this instanceof i?r:e;return ra(d,this,s)}return i}var uv=av,cv=1;function lv(e,t,n,r){var i=t&cv,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 ra(C,i?n:this,g)}return s}var fv=lv,Oc="__lodash_placeholder__",xs=1,dv=2,pv=4,Ec=8,ni=128,Ic=256,hv=Math.min;function yv(e,t){var n=e[1],r=t[1],i=n|r,o=i<(xs|dv|ni),s=r==ni&&n==Ec||r==ni&&n==Ic&&e[7].length<=t[8]||r==(ni|Ic)&&t[7].length<=t[8]&&n==Ec;if(!(o||s))return e;r&xs&&(e[2]=t[2],i|=n&xs?0:pv);var a=t[3];if(a){var l=e[3];e[3]=l?xl(l,a,t[4]):a,e[4]=l?ui(e[3],Oc):t[4]}return a=t[5],a&&(l=e[5],e[5]=l?Ul(l,a,t[6]):a,e[6]=l?ui(e[5],Oc):t[6]),a=t[7],a&&(e[7]=a),r&ni&&(e[8]=e[8]==null?t[8]:hv(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var gv=yv,mv="Expected a function",Sc=1,vv=2,Us=8,Ms=16,Bs=32,$c=64,Nc=Math.max;function bv(e,t,n,r,i,o,s,a){var l=t&vv;if(!l&&typeof e!="function")throw new TypeError(mv);var c=r?r.length:0;if(c||(t&=~(Bs|$c),r=i=void 0),s=s===void 0?s:Nc(mc(s),0),a=a===void 0?a:mc(a),c-=i?i.length:0,t&$c){var d=r,g=i;r=i=void 0}var C=l?void 0:Bl(e),I=[e,t,n,r,i,d,g,o,s,a];if(C&&gv(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:Nc(I[9]-c,0),!a&&t&(Us|Ms)&&(t&=~(Us|Ms)),!t||t==Sc)var S=Ng(e,t,n);else t==Us||t==Ms?S=uv(e,t,a):(t==Bs||t==(Sc|Bs))&&!i.length?S=fv(e,t,n,r):S=Kl.apply(void 0,I);var z=C?Cl:Ll;return Fl(z(S,I),e,t)}var _v=bv;function wv(e,t,n){t=="__proto__"&&fo?fo(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Tv=wv;function Av(e,t){return e===t||e!==e&&t!==t}var ua=Av,Ov=Object.prototype,Ev=Ov.hasOwnProperty;function Iv(e,t,n){var r=e[t];(!(Ev.call(e,t)&&ua(r,n))||n===void 0&&!(t in e))&&Tv(e,t,n)}var Sv=Iv,Rc=Math.max;function $v(e,t,n){return t=Rc(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=Rc(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),ra(e,this,a)}}var ql=$v;function Nv(e,t){return sa(ql(e,t,Io),e+"")}var Gl=Nv,Rv=9007199254740991;function Pv(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Rv}var ca=Pv;function Cv(e){return e!=null&&ca(e.length)&&!Pl(e)}var Wl=Cv,xv=Object.prototype;function Uv(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||xv;return e===n}var Mv=Uv;function Bv(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var Dv=Bv,kv="[object Arguments]";function Lv(e){return On(e)&&Sr(e)==kv}var Pc=Lv,Hl=Object.prototype,jv=Hl.hasOwnProperty,Fv=Hl.propertyIsEnumerable,zv=Pc(function(){return arguments}())?Pc:function(e){return On(e)&&jv.call(e,"callee")&&!Fv.call(e,"callee")},la=zv;function Vv(){return!1}var Kv=Vv,Jl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Cc=Jl&&typeof module=="object"&&module&&!module.nodeType&&module,qv=Cc&&Cc.exports===Jl,xc=qv?ht.Buffer:void 0,Gv=xc?xc.isBuffer:void 0,Wv=Gv||Kv,qs=Wv,Hv="[object Arguments]",Jv="[object Array]",Xv="[object Boolean]",Yv="[object Date]",Qv="[object Error]",Zv="[object Function]",eb="[object Map]",tb="[object Number]",nb="[object Object]",rb="[object RegExp]",ib="[object Set]",ob="[object String]",sb="[object WeakMap]",ab="[object ArrayBuffer]",ub="[object DataView]",cb="[object Float32Array]",lb="[object Float64Array]",fb="[object Int8Array]",db="[object Int16Array]",pb="[object Int32Array]",hb="[object Uint8Array]",yb="[object Uint8ClampedArray]",gb="[object Uint16Array]",mb="[object Uint32Array]",Me={};Me[cb]=Me[lb]=Me[fb]=Me[db]=Me[pb]=Me[hb]=Me[yb]=Me[gb]=Me[mb]=!0;Me[Hv]=Me[Jv]=Me[ab]=Me[Xv]=Me[ub]=Me[Yv]=Me[Qv]=Me[Zv]=Me[eb]=Me[tb]=Me[nb]=Me[rb]=Me[ib]=Me[ob]=Me[sb]=!1;function vb(e){return On(e)&&ca(e.length)&&!!Me[Sr(e)]}var bb=vb;function _b(e){return function(t){return e(t)}}var Xl=_b,Yl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,oi=Yl&&typeof module=="object"&&module&&!module.nodeType&&module,wb=oi&&oi.exports===Yl,Ds=wb&&Sl.process,Tb=function(){try{var e=oi&&oi.require&&oi.require("util").types;return e||Ds&&Ds.binding&&Ds.binding("util")}catch{}}(),Uc=Tb,Mc=Uc&&Uc.isTypedArray,Ab=Mc?Xl(Mc):bb,Ql=Ab,Ob=Object.prototype,Eb=Ob.hasOwnProperty;function Ib(e,t){var n=Vt(e),r=!n&&la(e),i=!n&&!r&&qs(e),o=!n&&!r&&!i&&Ql(e),s=n||r||i||o,a=s?Dv(e.length,String):[],l=a.length;for(var c in e)(t||Eb.call(e,c))&&!(s&&(c=="length"||i&&(c=="offset"||c=="parent")||o&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||So(c,l)))&&a.push(c);return a}var Sb=Ib;function $b(e,t){return function(n){return e(t(n))}}var Nb=$b,Rb=Nb(Object.keys,Object),Pb=Rb,Cb=Object.prototype,xb=Cb.hasOwnProperty;function Ub(e){if(!Mv(e))return Pb(e);var t=[];for(var n in Object(e))xb.call(e,n)&&n!="constructor"&&t.push(n);return t}var Mb=Ub;function Bb(e){return Wl(e)?Sb(e):Mb(e)}var Zl=Bb,Db=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kb=/^\w*$/;function Lb(e,t){if(Vt(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Or(e)?!0:kb.test(e)||!Db.test(e)||t!=null&&e in Object(t)}var fa=Lb,jb=Xn(Object,"create"),ci=jb;function Fb(){this.__data__=ci?ci(null):{},this.size=0}var zb=Fb;function Vb(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Kb=Vb,qb="__lodash_hash_undefined__",Gb=Object.prototype,Wb=Gb.hasOwnProperty;function Hb(e){var t=this.__data__;if(ci){var n=t[e];return n===qb?void 0:n}return Wb.call(t,e)?t[e]:void 0}var Jb=Hb,Xb=Object.prototype,Yb=Xb.hasOwnProperty;function Qb(e){var t=this.__data__;return ci?t[e]!==void 0:Yb.call(t,e)}var Zb=Qb,e_="__lodash_hash_undefined__";function t_(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ci&&t===void 0?e_:t,this}var n_=t_;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=zb;$r.prototype.delete=Kb;$r.prototype.get=Jb;$r.prototype.has=Zb;$r.prototype.set=n_;var Bc=$r;function r_(){this.__data__=[],this.size=0}var i_=r_;function o_(e,t){for(var n=e.length;n--;)if(ua(e[n][0],t))return n;return-1}var $o=o_,s_=Array.prototype,a_=s_.splice;function u_(e){var t=this.__data__,n=$o(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():a_.call(t,n,1),--this.size,!0}var c_=u_;function l_(e){var t=this.__data__,n=$o(t,e);return n<0?void 0:t[n][1]}var f_=l_;function d_(e){return $o(this.__data__,e)>-1}var p_=d_;function h_(e,t){var n=this.__data__,r=$o(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var y_=h_;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=i_;Nr.prototype.delete=c_;Nr.prototype.get=f_;Nr.prototype.has=p_;Nr.prototype.set=y_;var No=Nr,g_=Xn(ht,"Map"),li=g_;function m_(){this.size=0,this.__data__={hash:new Bc,map:new(li||No),string:new Bc}}var v_=m_;function b_(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var __=b_;function w_(e,t){var n=e.__data__;return __(t)?n[typeof t=="string"?"string":"hash"]:n.map}var Ro=w_;function T_(e){var t=Ro(this,e).delete(e);return this.size-=t?1:0,t}var A_=T_;function O_(e){return Ro(this,e).get(e)}var E_=O_;function I_(e){return Ro(this,e).has(e)}var S_=I_;function $_(e,t){var n=Ro(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var N_=$_;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=v_;Rr.prototype.delete=A_;Rr.prototype.get=E_;Rr.prototype.has=S_;Rr.prototype.set=N_;var Po=Rr,R_="Expected a function";function da(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(R_);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(da.Cache||Po),n}da.Cache=Po;var P_=da,C_=500;function x_(e){var t=P_(e,function(r){return n.size===C_&&n.clear(),r}),n=t.cache;return t}var U_=x_,M_=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,B_=/\\(\\)?/g,D_=U_(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(M_,function(n,r,i,o){t.push(i?o.replace(B_,"$1"):r||n)}),t}),k_=D_;function L_(e){return e==null?"":Uy(e)}var j_=L_;function F_(e,t){return Vt(e)?e:fa(e,t)?[e]:k_(j_(e))}var Co=F_,z_=1/0;function V_(e){if(typeof e=="string"||Or(e))return e;var t=e+"";return t=="0"&&1/e==-z_?"-0":t}var hi=V_;function K_(e,t){t=Co(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 pa=K_;function q_(e,t,n){var r=e==null?void 0:pa(e,t);return r===void 0?n:r}var G_=q_;function W_(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}var ef=W_,Dc=Xt?Xt.isConcatSpreadable:void 0;function H_(e){return Vt(e)||la(e)||!!(Dc&&e&&e[Dc])}var J_=H_;function tf(e,t,n,r,i){var o=-1,s=e.length;for(n||(n=J_),i||(i=[]);++o<s;){var a=e[o];t>0&&n(a)?t>1?tf(a,t-1,n,r,i):ef(i,a):r||(i[i.length]=a)}return i}var X_=tf;function Y_(e){var t=e==null?0:e.length;return t?X_(e,1):[]}var Q_=Y_;function Z_(e){return sa(ql(e,void 0,Q_),e+"")}var ew=Z_;function tw(){this.__data__=new No,this.size=0}var nw=tw;function rw(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var iw=rw;function ow(e){return this.__data__.get(e)}var sw=ow;function aw(e){return this.__data__.has(e)}var uw=aw,cw=200;function lw(e,t){var n=this.__data__;if(n instanceof No){var r=n.__data__;if(!li||r.length<cw-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Po(r)}return n.set(e,t),this.size=n.size,this}var fw=lw;function Pr(e){var t=this.__data__=new No(e);this.size=t.size}Pr.prototype.clear=nw;Pr.prototype.delete=iw;Pr.prototype.get=sw;Pr.prototype.has=uw;Pr.prototype.set=fw;var to=Pr;function dw(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 pw=dw;function hw(){return[]}var yw=hw,gw=Object.prototype,mw=gw.propertyIsEnumerable,kc=Object.getOwnPropertySymbols,vw=kc?function(e){return e==null?[]:(e=Object(e),pw(kc(e),function(t){return mw.call(e,t)}))}:yw,bw=vw;function _w(e,t,n){var r=t(e);return Vt(e)?r:ef(r,n(e))}var ww=_w;function Tw(e){return ww(e,Zl,bw)}var Lc=Tw,Aw=Xn(ht,"DataView"),Gs=Aw,Ow=Xn(ht,"Promise"),Ws=Ow,Ew=Xn(ht,"Set"),Ar=Ew,jc="[object Map]",Iw="[object Object]",Fc="[object Promise]",zc="[object Set]",Vc="[object WeakMap]",Kc="[object DataView]",Sw=Jn(Gs),$w=Jn(li),Nw=Jn(Ws),Rw=Jn(Ar),Pw=Jn(si),Gn=Sr;(Gs&&Gn(new Gs(new ArrayBuffer(1)))!=Kc||li&&Gn(new li)!=jc||Ws&&Gn(Ws.resolve())!=Fc||Ar&&Gn(new Ar)!=zc||si&&Gn(new si)!=Vc)&&(Gn=function(e){var t=Sr(e),n=t==Iw?e.constructor:void 0,r=n?Jn(n):"";if(r)switch(r){case Sw:return Kc;case $w:return jc;case Nw:return Fc;case Rw:return zc;case Pw:return Vc}return t});var qc=Gn,Cw=ht.Uint8Array,Gc=Cw,xw="__lodash_hash_undefined__";function Uw(e){return this.__data__.set(e,xw),this}var Mw=Uw;function Bw(e){return this.__data__.has(e)}var Dw=Bw;function po(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new Po;++t<n;)this.add(e[t])}po.prototype.add=po.prototype.push=Mw;po.prototype.has=Dw;var nf=po;function kw(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 Lw=kw;function jw(e,t){return e.has(t)}var rf=jw,Fw=1,zw=2;function Vw(e,t,n,r,i,o){var s=n&Fw,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&zw?new nf: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(!Lw(t,function(F,L){if(!rf(I,L)&&(S===F||i(S,F,n,r,o)))return I.push(L)})){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 of=Vw;function Kw(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}var qw=Kw;function Gw(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}var sf=Gw,Ww=1,Hw=2,Jw="[object Boolean]",Xw="[object Date]",Yw="[object Error]",Qw="[object Map]",Zw="[object Number]",eT="[object RegExp]",tT="[object Set]",nT="[object String]",rT="[object Symbol]",iT="[object ArrayBuffer]",oT="[object DataView]",Wc=Xt?Xt.prototype:void 0,ks=Wc?Wc.valueOf:void 0;function sT(e,t,n,r,i,o,s){switch(n){case oT:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case iT:return!(e.byteLength!=t.byteLength||!o(new Gc(e),new Gc(t)));case Jw:case Xw:case Zw:return ua(+e,+t);case Yw:return e.name==t.name&&e.message==t.message;case eT:case nT:return e==t+"";case Qw:var a=qw;case tT:var l=r&Ww;if(a||(a=sf),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;r|=Hw,s.set(e,t);var d=of(a(e),a(t),r,i,o,s);return s.delete(e),d;case rT:if(ks)return ks.call(e)==ks.call(t)}return!1}var aT=sT,uT=1,cT=Object.prototype,lT=cT.hasOwnProperty;function fT(e,t,n,r,i,o){var s=n&uT,a=Lc(e),l=a.length,c=Lc(t),d=c.length;if(l!=d&&!s)return!1;for(var g=l;g--;){var C=a[g];if(!(s?C in t:lT.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],L=t[C];if(r)var K=s?r(L,F,C,t,e,o):r(F,L,C,e,t,o);if(!(K===void 0?F===L||i(F,L,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 dT=fT,pT=1,Hc="[object Arguments]",Jc="[object Array]",Zi="[object Object]",hT=Object.prototype,Xc=hT.hasOwnProperty;function yT(e,t,n,r,i,o){var s=Vt(e),a=Vt(t),l=s?Jc:qc(e),c=a?Jc:qc(t);l=l==Hc?Zi:l,c=c==Hc?Zi:c;var d=l==Zi,g=c==Zi,C=l==c;if(C&&qs(e)){if(!qs(t))return!1;s=!0,d=!1}if(C&&!d)return o||(o=new to),s||Ql(e)?of(e,t,n,r,i,o):aT(e,t,l,n,r,i,o);if(!(n&pT)){var I=d&&Xc.call(e,"__wrapped__"),S=g&&Xc.call(t,"__wrapped__");if(I||S){var z=I?e.value():e,J=S?t.value():t;return o||(o=new to),i(z,J,n,r,o)}}return C?(o||(o=new to),dT(e,t,n,r,i,o)):!1}var gT=yT;function af(e,t,n,r,i){return e===t?!0:e==null||t==null||!On(e)&&!On(t)?e!==e&&t!==t:gT(e,t,n,r,af,i)}var uf=af,mT=1,vT=2;function bT(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 to;if(r)var C=r(c,d,l,e,t,g);if(!(C===void 0?uf(d,c,mT|vT,r,g):C))return!1}}return!0}var _T=bT;function wT(e){return e===e&&!an(e)}var cf=wT;function TT(e){for(var t=Zl(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,cf(i)]}return t}var AT=TT;function OT(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var lf=OT;function ET(e){var t=AT(e);return t.length==1&&t[0][2]?lf(t[0][0],t[0][1]):function(n){return n===e||_T(n,e,t)}}var IT=ET;function ST(e,t){return e!=null&&t in Object(e)}var $T=ST;function NT(e,t,n){t=Co(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&&ca(i)&&So(s,i)&&(Vt(e)||la(e)))}var RT=NT;function PT(e,t){return e!=null&&RT(e,t,$T)}var ff=PT,CT=1,xT=2;function UT(e,t){return fa(e)&&cf(t)?lf(hi(e),t):function(n){var r=G_(n,e);return r===void 0&&r===t?ff(n,e):uf(t,r,CT|xT)}}var MT=UT;function BT(e){return function(t){return t?.[e]}}var DT=BT;function kT(e){return function(t){return pa(t,e)}}var LT=kT;function jT(e){return fa(e)?DT(hi(e)):LT(e)}var FT=jT;function zT(e){return typeof e=="function"?e:e==null?Io:typeof e=="object"?Vt(e)?MT(e[0],e[1]):IT(e):FT(e)}var VT=zT;function KT(e){return On(e)&&Wl(e)}var qT=KT;function GT(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 WT=GT,HT=200;function JT(e,t,n,r){var i=-1,o=jl,s=!0,a=e.length,l=[],c=t.length;if(!a)return l;n&&(t=Nl(t,Xl(n))),r?(o=WT,s=!1):t.length>=HT&&(o=rf,s=!1,t=new nf(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 XT=JT;function YT(e,t,n,r){if(!an(e))return e;t=Co(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:So(t[i+1])?[]:{})}Sv(a,l,c),a=a[l]}return e}var QT=YT;function ZT(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var s=t[r],a=pa(e,s);n(a,s)&&QT(o,Co(s,e),a)}return o}var e0=ZT,t0=32,ha=Gl(function(e,t){var n=ui(t,aa(ha));return _v(e,t0,void 0,t,n)});ha.placeholder={};var n0=ha;function r0(e,t){return e0(e,t,function(n,r){return ff(e,r)})}var i0=r0,o0=ew(function(e,t){return e==null?{}:i0(e,t)}),Yc=o0,s0=4294967295,a0=s0-1,u0=Math.floor,c0=Math.min;function l0(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=u0((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 c0(o,a0)}var f0=l0;function d0(e,t,n){return f0(e,t,VT(n,2))}var p0=d0,h0=1/0,dS=Ar&&1/sf(new Ar([,-0]))[1]==h0?function(e){return new Ar(e)}:Ml;var y0=Gl(function(e,t){return qT(e)?XT(e,t):[]}),Qc=y0,df=mt(oy(),1),pS=df.default.configure,Hn=df.default,Ls=100,{WARN:g0,LOG:hS,DEBUG:We,VERBOSE:we,ERROR:yS}=$e.setup($e.INFO),ho=Ce.set();tc({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 pf(e,t){return Pe(()=>ze.structural(e.get(),t.get()))}function Cr(e,t){return ze.shallow(e.applogs,t.applogs)}function xo(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 m0=0;function Yt(e,{name:t,equals:n}={}){let r=`observableArrayMap@${++m0}{${t}}`;we.isEnabled&&we(`[${r}] create`,{fnname:e.name,fn:e,name:t,equals:n});let i,o=yf(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=Et(i);We(`[${r}] deps`,{disposeAutorun:o,rootsAtom:s,observableArr:i,observers:Qr(i)}),br(()=>ho.add(s))}return we.isEnabled&&_r(i,()=>{we(`[${r}] observed`,Qr(i),{rootsAtom:s,observableArr:i})}),zn(i,()=>{we.isEnabled&&we(`[${r}] dispose`),s&&br(()=>ho.delete(s)),o()}),i}var v0=0;function hf(e,{name:t}={}){let n=`observableSetMap@${++v0}{${t}}`;we.isEnabled&&we(`[${n}] create`,{fnname:e.name,fn:e,name:t});let r,i=yf(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=Et(r);We.isEnabled&&We(`[${n}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:r,observers:Qr(r)}),br(()=>ho.add(o))}return we.isEnabled&&_r(r,()=>{we(`[${n}] observed`,Qr(r),{rootsAtom:o,observableSet:r})}),zn(r,()=>{we.isEnabled&&we(`[${n}] dispose`),o&&br(()=>ho.delete(o)),i()}),r}function yf(e,t=null,{name:n}={}){We.isEnabled&&We("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:n});let r=`${n}.autorunImm`,i,o=new Lt(r,function(...c){We.isEnabled&&We(`[${r}] reaction.invalidate`,c),s()});function s(){o.track(function(){let c=Ls&&performance.now();We.isEnabled&&We(`[${r}] runAndTrack:`,{name:n??e.name,fn:e}),i=e(),We.isEnabled&&We(`[${r}] runAndTrack =>`,i),br(()=>{t?.(i)}),Ls&&performance.now()-c>Ls&&g0(`[${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(_0(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(Qc(I,I[z]),Qc(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&&!Du())return!r&&Fu().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=ke(()=>(we.isEnabled&&we(`[${d}] update->rerun`,Pe(()=>({args:a})),t),we.isEnabled&&Es(),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 b0(e){let t=0,n="",r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?n+=o+`
|
|
57
|
-
`+" ".repeat(++t):
|
|
58
|
-
`+" ".repeat(--t)+
|
|
59
|
-
`+" ".repeat(t):
|
|
60
|
-
`+" ".repeat(t+1)):
|
|
61
|
-
`+" ".repeat(t)+o):o==="{"&&r>0?(r++,n+=o):(o==="}"&&r>1&&r--,n+=o)}return n}function _0(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:Zc,LOG:gS,DEBUG:w0,VERBOSE:mS,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:tu(t),this.filters=n,Pe(()=>this.parents?.length===0)&&Zc("[Thread] empty parents array",e),i.skipObservable||bn(this,{applogsCids:ke,applogsByCid:ke,insert:at,size:ke,isEmpty:ke,firstLog:ke,latestLog:ke},{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):Zc("unsubscribe called for non-existent",e)}notifySubscribers(e){w0(`[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 b0(this.name)}get hasParents(){return!!this.parents?.length}};var gf=class mf extends Er{static fromArray(t,n){return new mf(n||"static",null,[],t)}constructor(t,n,r,i){super(t,n,r,i,{skipObservable:!0})}get readOnly(){return!0}},vf={};os(vf,{code:()=>kf,decode:()=>Na,encode:()=>$a,format:()=>ll,name:()=>C1,parse:()=>U1,stringify:()=>ll});var T0=["string","number","bigint","symbol"],A0=["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 O0(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(T0.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(E0(e))return"Buffer";let n=I0(e);return n||"Object"}function E0(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function I0(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(A0.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",S0=new TextDecoder,$0=new TextEncoder;function yo(e){return xr&&globalThis.Buffer.isBuffer(e)}function ya(e){return e instanceof Uint8Array?yo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var N0=xr?(e,t,n)=>n-t>64?globalThis.Buffer.from(e.subarray(t,n)).toString("utf8"):tl(e,t,n):(e,t,n)=>n-t>64?S0.decode(e.subarray(t,n)):tl(e,t,n),bf=xr?e=>e.length>64?globalThis.Buffer.from(e):el(e):e=>e.length>64?$0.encode(e):el(e),ga=xr?(e,t,n)=>yo(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n),R0=xr?(e,t)=>(e=e.map(n=>n instanceof Uint8Array?n:globalThis.Buffer.from(n)),ya(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},P0=xr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function C0(e,t){if(yo(e)&&yo(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 el(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 tl(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 _f(r)}var nl=4096;function _f(e){let t=e.length;if(t<=nl)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=nl));return n}var x0=256,wf=class{constructor(e=x0){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=P0(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=ga(n,0,this.cursor)}else t=R0(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 U0(e,t,n,r){return new ie(B.uint,Yn(e,t+1,r),2)}function M0(e,t,n,r){return new ie(B.uint,Qn(e,t+1,r),3)}function B0(e,t,n,r){return new ie(B.uint,Zn(e,t+1,r),5)}function D0(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 k0(e,t,n,r){return new ie(B.negint,-1-Yn(e,t+1,r),2)}function L0(e,t,n,r){return new ie(B.negint,-1-Qn(e,t+1,r),3)}function j0(e,t,n,r){return new ie(B.negint,-1-Zn(e,t+1,r),5)}var ma=BigInt(-1),Tf=BigInt(1);function F0(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,ma-BigInt(i),9)}function va(e,t){let n=t.value,r=typeof n=="bigint"?n*ma-Tf:n*-1-1;Rt(e,t.type.majorEncoded,r)}va.encodedSize=function(t){let n=t.value,r=typeof n=="bigint"?n*ma-Tf:n*-1-1;return r<Ye[0]?1:r<Ye[1]?2:r<Ye[2]?3:r<Ye[3]?5:9};va.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=ga(e,t+n,t+n+r);return new ie(B.bytes,i,n+r)}function z0(e,t,n,r){return gi(e,t,1,n)}function V0(e,t,n,r){return gi(e,t,2,Yn(e,t+1,r))}function K0(e,t,n,r){return gi(e,t,3,Qn(e,t+1,r))}function q0(e,t,n,r){return gi(e,t,5,Zn(e,t+1,r))}function G0(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 go(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===B.string?bf(e.value):e.value),e.encodedBytes}function Uo(e,t){let n=go(t);Rt(e,t.type.majorEncoded,n.length),e.push(n)}Uo.encodedSize=function(t){let n=go(t);return Rt.encodedSize(n.length)+n.length};Uo.compareTokens=function(t,n){return W0(go(t),go(n))};function W0(e,t){return e.length<t.length?-1:e.length>t.length?1:C0(e,t)}function mi(e,t,n,r,i){let o=n+r;Ur(e,t,o);let s=new ie(B.string,N0(e,t+n,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=ga(e,t+n,t+o)),s}function H0(e,t,n,r){return mi(e,t,1,n,r)}function J0(e,t,n,r){return mi(e,t,2,Yn(e,t+1,r),r)}function X0(e,t,n,r){return mi(e,t,3,Qn(e,t+1,r),r)}function Y0(e,t,n,r){return mi(e,t,5,Zn(e,t+1,r),r)}function Q0(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 Z0=Uo;function Mr(e,t,n,r){return new ie(B.array,r,n)}function eA(e,t,n,r){return Mr(e,t,1,n)}function tA(e,t,n,r){return Mr(e,t,2,Yn(e,t+1,r))}function nA(e,t,n,r){return Mr(e,t,3,Qn(e,t+1,r))}function rA(e,t,n,r){return Mr(e,t,5,Zn(e,t+1,r))}function iA(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 oA(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 ba(e,t){Rt(e,B.array.majorEncoded,t.value)}ba.compareTokens=tr.compareTokens;ba.encodedSize=function(t){return Rt.encodedSize(t.value)};function Br(e,t,n,r){return new ie(B.map,r,n)}function sA(e,t,n,r){return Br(e,t,1,n)}function aA(e,t,n,r){return Br(e,t,2,Yn(e,t+1,r))}function uA(e,t,n,r){return Br(e,t,3,Qn(e,t+1,r))}function cA(e,t,n,r){return Br(e,t,5,Zn(e,t+1,r))}function lA(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 fA(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 _a(e,t){Rt(e,B.map.majorEncoded,t.value)}_a.compareTokens=tr.compareTokens;_a.encodedSize=function(t){return Rt.encodedSize(t.value)};function dA(e,t,n,r){return new ie(B.tag,n,1)}function pA(e,t,n,r){return new ie(B.tag,Yn(e,t+1,r),2)}function hA(e,t,n,r){return new ie(B.tag,Qn(e,t+1,r),3)}function yA(e,t,n,r){return new ie(B.tag,Zn(e,t+1,r),5)}function gA(e,t,n,r){return new ie(B.tag,er(e,t+1,r),9)}function wa(e,t){Rt(e,B.tag.majorEncoded,t.value)}wa.compareTokens=tr.compareTokens;wa.encodedSize=function(t){return Rt.encodedSize(t.value)};var mA=20,vA=21,bA=22,_A=23;function wA(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 TA(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 Ta(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 AA(e,t,n,r){return Ta(Oa(e,t+1),3,r)}function OA(e,t,n,r){return Ta(Ea(e,t+1),5,r)}function EA(e,t,n,r){return Ta(If(e,t+1),9,r)}function Aa(e,t,n){let r=t.value;if(r===!1)e.push([B.float.majorEncoded|mA]);else if(r===!0)e.push([B.float.majorEncoded|vA]);else if(r===null)e.push([B.float.majorEncoded|bA]);else if(r===void 0)e.push([B.float.majorEncoded|_A]);else{let i,o=!1;(!n||n.float64!==!0)&&(Of(r),i=Oa(zt,1),r===i||Number.isNaN(r)?(zt[0]=249,e.push(zt.slice(0,3)),o=!0):(Ef(r),i=Ea(zt,1),r===i&&(zt[0]=250,e.push(zt.slice(0,5)),o=!0))),o||(IA(r),i=If(zt,1),zt[0]=251,e.push(zt.slice(0,9)))}}Aa.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){Of(r);let i=Oa(zt,1);if(r===i||Number.isNaN(r))return 3;if(Ef(r),i=Ea(zt,1),r===i)return 5}return 9};var Af=new ArrayBuffer(9),$t=new DataView(Af,1),zt=new Uint8Array(Af,0);function Of(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 Oa(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 Ef(e){$t.setFloat32(0,e,!1)}function Ea(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 IA(e){$t.setFloat64(0,e,!1)}function If(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)}Aa.compareTokens=tr.compareTokens;function Ee(e,t,n){throw new Error(`${ye} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function Mo(e){return()=>{throw new Error(`${ye} ${e}`)}}var se=[];for(let e=0;e<=23;e++)se[e]=Ee;se[24]=U0;se[25]=M0;se[26]=B0;se[27]=D0;se[28]=Ee;se[29]=Ee;se[30]=Ee;se[31]=Ee;for(let e=32;e<=55;e++)se[e]=Ee;se[56]=k0;se[57]=L0;se[58]=j0;se[59]=F0;se[60]=Ee;se[61]=Ee;se[62]=Ee;se[63]=Ee;for(let e=64;e<=87;e++)se[e]=z0;se[88]=V0;se[89]=K0;se[90]=q0;se[91]=G0;se[92]=Ee;se[93]=Ee;se[94]=Ee;se[95]=Mo("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)se[e]=H0;se[120]=J0;se[121]=X0;se[122]=Y0;se[123]=Q0;se[124]=Ee;se[125]=Ee;se[126]=Ee;se[127]=Mo("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)se[e]=eA;se[152]=tA;se[153]=nA;se[154]=rA;se[155]=iA;se[156]=Ee;se[157]=Ee;se[158]=Ee;se[159]=oA;for(let e=160;e<=183;e++)se[e]=sA;se[184]=aA;se[185]=uA;se[186]=cA;se[187]=lA;se[188]=Ee;se[189]=Ee;se[190]=Ee;se[191]=fA;for(let e=192;e<=215;e++)se[e]=dA;se[216]=pA;se[217]=hA;se[218]=yA;se[219]=gA;se[220]=Ee;se[221]=Ee;se[222]=Ee;se[223]=Ee;for(let e=224;e<=243;e++)se[e]=Mo("simple values are not supported");se[244]=Ee;se[245]=Ee;se[246]=Ee;se[247]=wA;se[248]=Mo("simple values are not supported");se[249]=AA;se[250]=OA;se[251]=EA;se[252]=Ee;se[253]=Ee;se[254]=Ee;se[255]=TA;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 SA(){let e=[];return e[B.uint.major]=tr,e[B.negint.major]=va,e[B.bytes.major]=Uo,e[B.string.major]=Z0,e[B.array.major]=ba,e[B.map.major]=_a,e[B.tag.major]=wa,e[B.float.major]=Aa,e}var vS=SA(),js=new wf,rl=class Sf{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 Sf(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=rl.createCheck(r,e);let i=[],o=0;for(let s of e)i[o++]=no(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=rl.createCheck(r,e);let a=[],l=0;for(let c of o)a[l++]=[no(c,n,r),no(i?e.get(c):e[c],n,r)];return $A(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 no(e,t={},n){let r=O0(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 $A(e,t){t.mapSorter&&e.sort(t.mapSorter)}function $f(e,t,n,r){if(Array.isArray(t))for(let i of t)$f(e,i,n,r);else n[t.type.major](e,t,r)}function NA(e,t,n){let r=no(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 wf(s);if(o(a,r,n),a.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${r} was wrong`);return ya(a.chunks[0])}}return js.reset(),$f(js,r,t,n),js.toBytes(!0)}var RA={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},PA=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"),Bo=Symbol.for("BREAK");function CA(e,t,n){let r=[];for(let i=0;i<e.value;i++){let o=di(t,n);if(o===Bo){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 xA(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===Bo){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 Bo;if(n.type.terminal)return n.value;if(n.type===B.array)return CA(n,e,t);if(n.type===B.map)return xA(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 UA(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ye} data to decode must be a Uint8Array`);t=Object.assign({},RA,t);let n=t.tokenizer||new PA(e,t),r=di(n,t);if(r===fi)throw new Error(`${ye} did not find any content to decode`);if(r===Bo)throw new Error(`${ye} got unexpected break`);return[r,e.subarray(n.pos())]}function MA(e,t){let[n,r]=UA(e,t);if(r.length>0)throw new Error(`${ye} too many terminals, data makes no sense`);return n}var BA=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=bf(JSON.stringify(t.value));e.push(n.length>32?ya(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 DA(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 kA={addBreakTokens:!0,mapSorter:DA};function LA(e,t){return t=Object.assign({},kA,t),NA(e,new BA,t)}var Nf=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,_f(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 jA(e,t){return t=Object.assign({tokenizer:new Nf(e,t)},t),MA(e,t)}var bS=new Uint8Array(0);function FA(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 Ia(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 zA(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,L=S.length;F!==L&&S[F]===0;)F++,z++;for(var K=(L-F)*d+1>>>0,W=new Uint8Array(K);F!==L;){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 L=(S.length-z)*c+1>>>0,K=new Uint8Array(L);S[z];){var W=n[S.charCodeAt(z)];if(W===255)return;for(var j=0,Z=L-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=L-F;G!==L&&K[G]===0;)G++;for(var fe=new Uint8Array(J+(L-G)),x=J;G!==L;)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 VA=zA,KA=VA,qA=KA,GA=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")}},WA=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 Rf(this,e)}},HA=class{decoders;constructor(e){this.decoders=e}or(e){return Rf(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 Rf(e,t){return new HA({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var JA=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 GA(e,t,n),this.decoder=new WA(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Pf({name:e,prefix:t,encode:n,decode:r}){return new JA(e,t,n,r)}function Do({name:e,prefix:t,alphabet:n}){let{encode:r,decode:i}=qA(n,e);return Pf({prefix:t,name:e,encode:r,decode:o=>Ia(i(o))})}function XA(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 YA(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 QA(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=QA(r);return Pf({prefix:t,name:e,encode(o){return YA(o,r,n)},decode(o){return XA(o,i,n,e)}})}var ro=yt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),_S=yt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),wS=yt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),TS=yt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),AS=yt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),OS=yt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),ES=yt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),IS=yt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),SS=yt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Fs=Do({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$S=Do({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),An=Do({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),NS=Do({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Cf={};os(Cf,{Digest:()=>ko,create:()=>Sa,decode:()=>Uf,equals:()=>Mf,hasCode:()=>m1});var ZA=xf,il=128,e1=127,t1=~e1,n1=Math.pow(2,31);function xf(e,t,n){t=t||[],n=n||0;for(var r=n;e>=n1;)t[n++]=e&255|il,e/=128;for(;e&t1;)t[n++]=e&255|il,e>>>=7;return t[n]=e|0,xf.bytes=n-r+1,t}var r1=Hs,i1=128,ol=127;function Hs(e,r){var n=0,r=r||0,i=0,o=r,s,a=e.length;do{if(o>=a)throw Hs.bytes=0,new RangeError("Could not decode varint");s=e[o++],n+=i<28?(s&ol)<<i:(s&ol)*Math.pow(2,i),i+=7}while(s>=i1);return Hs.bytes=o-r,n}var o1=Math.pow(2,7),s1=Math.pow(2,14),a1=Math.pow(2,21),u1=Math.pow(2,28),c1=Math.pow(2,35),l1=Math.pow(2,42),f1=Math.pow(2,49),d1=Math.pow(2,56),p1=Math.pow(2,63),h1=function(e){return e<o1?1:e<s1?2:e<a1?3:e<u1?4:e<c1?5:e<l1?6:e<f1?7:e<d1?8:e<p1?9:10},y1={encode:ZA,decode:r1,encodingLength:h1},g1=y1,mo=g1;function Js(e,t=0){return[mo.decode(e,t),mo.decode.bytes]}function vo(e,t,n=0){return mo.encode(e,t,n),t}function bo(e){return mo.encodingLength(e)}function Sa(e,t){let n=t.byteLength,r=bo(e),i=r+bo(n),o=new Uint8Array(i+n);return vo(e,o,0),vo(n,o,r),o.set(t,i),new ko(e,n,t,o)}function Uf(e){let t=Ia(e),[n,r]=Js(t),[i,o]=Js(t.subarray(r)),s=t.subarray(r+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new ko(n,i,s,t)}function Mf(e,t){if(e===t)return!0;{let n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&FA(e.bytes,n.bytes)}}var ko=class{code;size;digest;bytes;constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}};function m1(e,t){return e.code===t}function sl(e,t){let{bytes:n,version:r}=e;switch(r){case 0:return b1(n,Xs(e),t??An.encoder);default:return _1(n,Xs(e),t??ro.encoder)}}var al=new WeakMap;function Xs(e){let t=al.get(e);if(t==null){let n=new Map;return al.set(e,n),n}return t}var Lo=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!==w1)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=Sa(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&&Mf(t.multihash,r.multihash)}toString(t){return sl(this,t)}toJSON(){return{"/":sl(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??ul(r,i,o.bytes))}else if(n[T1]===!0){let{version:r,multihash:i,code:o}=n,s=Uf(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=ul(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=Ia(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 ko(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]=Js(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]=v1(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 Xs(o).set(r,t),o}};function v1(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 ro.prefix:{let n=t??ro;return[ro.prefix,n.decode(e)]}case Fs.prefix:{let n=t??Fs;return[Fs.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 b1(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 _1(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,w1=18;function ul(e,t,n){let r=bo(e),i=r+bo(t),o=new Uint8Array(i+n.byteLength);return vo(e,o,0),vo(t,o,r),o.set(n,i),o}var T1=Symbol.for("@ipld/js-cid/CID"),A1=20;function Bf({name:e,code:t,encode:n,minDigestLength:r,maxDigestLength:i}){return new O1(e,t,n,r,i)}var O1=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,n,r,i){this.name=e,this.code=t,this.encode=n,this.minDigestLength=r??A1,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?cl(n,this.code,t?.truncate):n.then(r=>cl(r,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function cl(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 Sa(t,e)}var Df=yt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),RS=yt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),PS=yt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),CS=yt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function E1(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function I1(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Lo.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 _o(e){let t=Df.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 _o(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function S1(e){return _o(new Uint8Array(e))}function $1(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function N1(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 R1={typeEncoders:{Object:I1,Buffer:_o,Uint8Array:_o,Int8Array:Ft,Uint16Array:Ft,Int16Array:Ft,Uint32Array:Ft,Int32Array:Ft,Float32Array:Ft,Float64Array:Ft,Uint8ClampedArray:Ft,BigInt64Array:Ft,BigUint64Array:Ft,DataView:Ft,ArrayBuffer:S1,undefined:$1,number:N1}},P1=class extends Nf{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=Df.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}},Ys={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Ys.tags[42]=Lo.parse;var C1="dag-json",kf=297,$a=e=>LA(e,R1),Na=e=>{let t=E1(e),n=Object.assign(Ys,{tokenizer:new P1(t,Ys)});return jA(t,n)},ll=e=>x1.decode($a(e)),x1=new TextDecoder,U1=e=>Na(M1.encode(e)),M1=new TextEncoder;function B1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Lf(e,t,n=""){let r=B1(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 fl(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 D1(e,t){Lf(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 Qs(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function zs(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Jt(e,t){return e<<32-t|e>>>t}function k1(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 L1=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function j1(e,t,n){return e&t^~e&n}function F1(e,t,n){return e&t^e&n^t&n}var z1=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=zs(this.buffer)}update(e){fl(this),Lf(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=zs(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){fl(this),D1(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:o}=this;t[o++]=128,Qs(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=zs(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]),V1=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),K1=class extends z1{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+j1(s,a,l)+V1[d]+Tn[d]|0,S=(Jt(n,2)^Jt(n,13)^Jt(n,22))+F1(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(){Qs(Tn)}destroy(){this.set(0,0,0,0,0,0,0,0),Qs(this.buffer)}},q1=class extends K1{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)}},G1=k1(()=>new q1,L1(1));var He=mt(en(),1),jf=mt(ly(),1),dl=e=>He.Type.Union([e,He.Type.Null()]);var Ff=/^(k51qz|baguq)[0-9a-z]{56,57}$/,W1=/^[0-9A-Fa-f]{7,8}$/g;He.FormatRegistry.Set("EntityID",e=>!!e.match(W1)||!!e.match(Ff));var H1=He.Type.String(),J1=e=>e?.enc instanceof Uint8Array;He.FormatRegistry.Set("CID",e=>!!e.match(Ff));var zf=He.Type.String({format:"CID"}),X1=/^http([s]?):\/\/.*\..*/;He.FormatRegistry.Set("URL",e=>!!e.match(X1));var xS=He.Type.String({format:"URL"}),Vf=He.Type.Object({en:H1,at:He.Type.String(),vl:dl(He.Type.Union([He.Type.String(),He.Type.Boolean(),He.Type.Number()])),ts:He.Type.String(),ag:He.Type.String(),pv:dl(zf)}),pl=jf.TypeCompiler.Compile(Vf);var US=pl.Check.bind(pl),Y1=He.Type.Composite([He.Type.Object({cid:zf}),Vf]),Zs=jf.TypeCompiler.Compile(Y1),Q1=e=>Array.from(Zs.Errors(e)),Kf=Zs.Check.bind(Zs);function qf(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var Z1=Bf({name:"sha2-256",code:18,encode:qf("SHA-256")}),MS=Bf({name:"sha2-512",code:19,encode:qf("SHA-512")}),{WARN:hl,LOG:BS,DEBUG:eO,VERBOSE:Gf,ERROR:tO}=$e.setup($e.INFO);function Wf(e,t=["cid"]){if(!e)throw tO("falsy log",e);let n=e.cid;if(J1(e))return n||(n=Ra(Hf(e).bytes).toString()),hl("preparing an encrypted applog - really?"),{log:e,cid:n};let r={};for(let[i,o]of Object.entries(e))o===void 0&&(hl(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?Gf("excluding app log",{key:i,val:o}):r[i]=o;return{log:r,cid:n}}function nO(e){return Ra(rO(e).bytes)}function rO(e){return Hf(Wf(e)?.log)}function Ra(e){let t=G1(e),n=Cf.create(Z1.code,t),r=Lo.create(1,kf,n);return Gf("[getCidSync]",{bytes:e,hash:t,digest:n,cid:r}),r}function Hf(e){eO("[encodeBlock]",e);let t=$a(e);return{bytes:t,cid:Ra(t)}}function yl(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 iO(e,t){let n=yl(e),r=yl(t);return+n<+r}var{WARN:oO,LOG:DS,DEBUG:kS,VERBOSE:wo,ERROR:To}=$e.setup($e.INFO),sO=(e,t,n="asc")=>n==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Jf=(e,t,n)=>ze.structural(Yc(t,e),Yc(n,e)),aO=(e,t,n="asc")=>sO(e.ts,t.ts,n),LS=n0(Jf,["en","at"]);function pi(e,t="asc"){return e.sort((n,r)=>aO(n,r,t))}var uO=(e,t)=>iO(new Date(e.ts),new Date(t.ts));var cO=()=>{oO("[removeDuplicateAppLogs] mode not set; pass 'safety' or 'cleanup' for optimal behavior")},gl=e=>{let t=new Map,n=wo.isEnabled;for(let r of e){if(!r)throw To("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!r.cid)throw To("applog with missing CID",r),new Error("applog with missing CID");let i=r.cid,o=t.get(i);o?n&&wo("Skipping duplicate applog:",[o,r]):t.set(i,r)}return Array.from(t.values())},lO=e=>{let t=new Set,n=wo.isEnabled,r=n?new Map:null,i=null,o=0;for(let s of e){if(!s)throw To("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!s.cid)throw To("applog with missing CID",s),new Error("applog with missing CID");let a=s.cid;t.has(a)?(i||(i=e.slice(0,o)),n&&wo("Skipping duplicate applog:",[r?.get(a),s])):(t.add(a),r&&r.set(a,s),i&&i.push(s)),o++}return i??e},Xf=(e,t)=>t?t==="safety"?lO(e):gl(e):(cO(),gl(e));function fO(e){return typeof e=="string"&&e.startsWith("?")}function dO(e){return e.slice(1)}function Pa(e,t){let n={},r={};for(let[i,o]of Object.entries(e))if(fO(o)){let s=dO(o),a=t[s];a?r[i]=a:n[i]=s}else r[i]=o;return[r,n]}function pO(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 Yf=function(t){for(var n=0,r=0,i=t.length;r<i;r++)n+=t[r];return n},ml=function(t){return Yf(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:Yf,mean:ml,average:ml,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 Qf=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 Zf(){return new Date().toISOString()}var{WARN:hO,LOG:jS,DEBUG:Ke,VERBOSE:FS,ERROR:Ao}=$e.setup($e.INFO);function yO(e,t){Ke(`[ensureTsPvAndFinalizeApplogs] ENTER - ${e.length} applogs, thread size=${t.size}`);let n=Zf(),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=gO(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 gO(e,{ts:t,threadForPv:n}={}){Ke(`[finalizeApplogForInsert] ENTER - en=${e.en}, at=${e.at}`),Ke("[finalizeApplogForInsert] About to call withTs");let r=bO(e,t??Zf());Ke(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${n?.size??"null"})`);let i=_O(r,n);Ke("[finalizeApplogForInsert] About to call encodeApplogAndGetCid");let o=nO(i).toString();Ke(`[finalizeApplogForInsert] CID created: ${o}`),e.cid&&e.cid!==o&&hO("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let s={...i,cid:o};if(Ke("[finalizeApplogForInsert] About to validate applog"),!Kf(s))throw Ao(`Bogus Applog ${JSON.stringify(s)}`,Q1(s));return Ke(`[finalizeApplogForInsert] EXIT - CID=${o}`),Object.freeze(s)}function mO(e){return!!e.ts}function vO(e){return!!e.pv}function bO(e,t){return mO(e)?e:{...e,ts:t}}function _O(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"),Jf(["en","at","vl","ts","ag"],e,i))throw Ao("[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(!vO(e))throw Ao("[withPvFrom] no thread and no pv:",e);return Ke("[withPvFrom] EXIT - no thread, returning log with existing pv"),e}}function jo(e){let t=()=>(Pe(()=>e.length<2&&Ke(`joinThreads with count=${e.length}`)),pi(Xf(e.flatMap(i=>{let o=i.applogs;if(!o)throw Ao("falsy applogs of thread",i),new Error("falsy applogs of thread");return o}),"cleanup"))),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 Fo(Pe(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],n,r)}var{WARN:vl,LOG:zS,DEBUG:bl,VERBOSE:qn,ERROR:eo}=$e.setup($e.INFO),Fo=class ea extends Er{constructor(t,n,r,i,o,s=null,a){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,this._readOnly=a,bn(this,{onParentUpdate:at}),o&&this.subscribeToParents()}static mapWrites(t,n,r){return new ea(`${n}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,r)}static asReadOnly(t){return t.readOnly?t:new ea(`readOnly(${t.name})`,t,t.filters,t._applogs,null,null,!0)}_parentSubscriptions=null;insert(t){if(this.readOnly)throw eo("[MappedThread] insert() called on read-only thread:",this.nameAndSizeUntracked);let n=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!n))return this.parents.forEach(r=>r.insert(n))}insertRaw(t){if(this.readOnly)throw eo("[MappedThread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);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=St(()=>{this.parents.length||vl("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 eo("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);bl(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&vl(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Pe(()=>sn(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(p0(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))bl("Ignoring remove event for non-existent because it was part of parent event's removed",i,n);else throw eo(`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 this._readOnly??!1}},{WARN:VS,LOG:KS,DEBUG:qS,VERBOSE:Vs,ERROR:wO}=$e.setup($e.INFO),In=Qe("rollingFilter",function(t,n,r={}){let i=TO(n),o=_l(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},Vs(`rollingFilter{${t.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,i,g,"=>",C),C},l=new Fo(`${t.name} | ${r.name||`rollingFilter{${Hn(i)}}`}`,t,[...t.filters,...r.extraFilterName?[r.extraFilterName]:[]],s,a),c=Zu(()=>sn(n),g=>{Vs(`rollingFilter<${t.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,i,"=>",g),i=g,o=_l(i),l.triggerRemap()}),d=zn(s,()=>{Vs(`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})}),ed=Qe("rollingMapper",function(t,n,r={}){let i=Pe(()=>n.call(null,{init:t.applogs},t));if(!un(i))throw wO("Initial run must return init event");let o=i.init;return new Fo(`${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})}),GS=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}`:""}}`}),TO=function(t){let n=Pe(function(){return Object.fromEntries(Object.entries(sn(t)).map(([i,o])=>[sn(i),sn(o)]))});if(!Object.entries(n).length)throw new Error("Pattern is empty");return n};function _l(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(!pO(o,s,a))return!1}return!0})}}var WS=Fo.asReadOnly;var{WARN:AO,LOG:OO,DEBUG:Ve,VERBOSE:td,ERROR:io}=$e.setup($e.INFO),EO=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=yO(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}insertMissing(e,t=!1){let n=e.filter(r=>!this.hasApplog(r,t));return n.length===0?(td("[insertMissing] no missing applogs"),[]):this.insertRaw(n)??[]}insertRaw(e){Ve(`[WriteableThread.insertRaw] ENTER - ${e.length} applogs for thread "${this.name}"`),Ve("[WriteableThread.insertRaw] About to deduplicate");let t=Xf(e,"safety");if(t.length!==e.length)throw io(`[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=>!Kf(o));if(n.length)throw io(`[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 io(`[insertRaw] already existing applogs passed: ${r.length}`,{existing:r});if(Ve("[WriteableThread.insertRaw] Existing check done"),!e.length){AO("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof Ca)?OO:Ve)("Inserting:",e.length===1?e[0]:e,{ds:this}),Ve("[WriteableThread.insertRaw] About to sort applogs"),pi(e);let i=this._applogs.length&&uO(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}},Ca=class oo extends EO{constructor(t,n,r,i){super(t,n,r),this._readOnly=i,bn(this,{_applogs:Ce.shallow})}static empty(t){return oo.fromArray([],t??"empty in-memory",!1)}static fromArray(t,n,r=!1){return new oo(n??"in-memory",t,[],r)}static fromReadOnlyArray(t,n){return new oo(n??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(td("[InMem.persist] no persist for",t),this.readOnly)throw io("[persist] called for readOnly thread")}},{WARN:HS,LOG:JS,DEBUG:XS,VERBOSE:YS,ERROR:QS}=$e.setup($e.INFO);var{WARN:B$,LOG:D$,DEBUG:k$,VERBOSE:L$,ERROR:j$}=$e.setup($e.INFO);function xa(e){return Qf(e,31,7)}var SO=class{constructor(e,t,n=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=n,bn(this,{threadOfTrail:ke})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?jo([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},nd=class{constructor(e){this.nodes=e,bn(this,{threadOfAllTrails:ke,size:ke,isEmpty:ke})}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 jo(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 jo(Yt(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:q$,LOG:zo,DEBUG:cn,VERBOSE:Te,ERROR:nr}=$e.setup($e.INFO,{prefix:"[q]"}),Ua=null,$O=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=ed(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||St(()=>{Te(`lastWriteWins<${t.nameAndSizeUntracked}> filtered down to`,o.applogs.length)}),o},{equals:Cr,argsDebugName:e=>Je({caller:"lastWriteWins",thread:e})}),G$=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=hf(function(){return n.map(s=>s.en)},{name:r});return Te.isEnabled&&St(()=>{Te(`withoutDeleted<${t.nameAndSizeUntracked}> deleted:`,[...i])}),In(t,{"!en":i},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:Cr}),rd=Qe("query",function e(t,n,r={},i={}){BO();let o=id(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=NO(o,a,l,i);return Te.isDisabled||St(()=>Te("query result:",sn(c))),c},{equals:xo,argsDebugName:(e,t,n)=>Je({caller:"query",thread:e,args:n?{pattern:t,startVars:n}:t})}),NO=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]=Pa(r,a?.variables??{});Te("[queryStep.doQuery] patternWithoutVars: ",l);let d=In(t,l),g=Vo(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 SO(gf.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&&St(()=>Te("[queryStep.doQuery] resultNodes:",[...C])),i.debug&&zo("[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&&St(()=>Te("[queryStep] observableResultNodes:",[...s])),new nd(s)},{equals:xo,argsDebugName:(e,t,n)=>Je({caller:"queryStep",thread:e,pattern:n})}),W$=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]=Pa(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&&zo("[queryNot] node result:",c,"=>",C.applogs),C.isEmpty})}return new nd(o)},{equals:xo,argsDebugName:(e,t,n)=>Je({caller:"queryNot",thread:e,pattern:n})}),H$=Qe("filterAndMap",function(t,n,r){cn(`filterAndMap<${t.nameAndSizeUntracked}>`,n);let i=In(t,n);Te.isEnabled&&(Te("[filterAndMap] filtered:",i.untrackedSize),St(()=>Te("[filterAndMap] filtered:",i.applogs)));let o=Je({thread:t,pattern:n,caller:"filterAndMap"}),s=Yt(()=>CO(i,r),{name:o});return Te.isDisabled||St(()=>Te("[filterAndMap] mapped:",s)),s},{equals:ze.structural,argsDebugName:(e,t)=>Je({caller:"filterAndMap",thread:e,pattern:t})}),J$=Qe("queryAndMap",function(t,n,r,i={}){let o=id(t);cn(`queryAndMap<${o.nameAndSizeUntracked}>`,{patternOrPatterns:n,variables:i,map:r});let s=Je({thread:o,caller:"queryAndMap"}),a=rd(o,n);Te("[queryAndMap] filtered count:",a.untrackedSize);let l=Yt(()=>xO(a,r),{name:s});return Te.isDisabled||St(()=>Te("[queryAndMap] result:",sn(l))),l},{equals:ze.structural,argsDebugName:(e,t)=>Je({caller:"queryAndMap",thread:e,pattern:t})}),X$=Qe("queryEntity",function(t,n,r,i){cn(`queryEntity<${t.nameAndSizeUntracked}>`,r,n);let o=In(t,{en:r,at:UO(n,i)});return Te("queryEntity applogs:",o.applogs),ke(()=>o.isEmpty?null:Object.fromEntries(o.map(({at:s,vl:a})=>[s.slice(n.length+1),a])))},{equals:pf,argsDebugName:(e,t,n)=>Je({caller:"queryEntity",thread:e,args:{name:t,entityID:n}})}),Y$=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)}zo(`agentsOfThread<${t.nameAndSizeUntracked}> processed event`,{event:o,mapped:n})});r({init:t.applogs});let i=t.subscribe(r);return _r(n,i),n}),RO=Qe("entityOverlap",function(t,n){return zo(`entityOverlap<${t.nameAndSizeUntracked}, ${n.nameAndSizeUntracked}>`),ke(()=>{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 Q$=Qe("entityOverlapCount",function(t,n){return ke(()=>RO(t,n).get().length)}),PO=Qe("querySingle",function(t,n,r={}){let i=rd(t,n,r);return ke(()=>{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})}),Z$=Qe("querySingleAndMap",function(t,n,r,i={}){let o=PO(t,n,i);return ke(()=>{let s=o.get();if(s)return typeof r=="string"?s[r]:Vo(r)(s)})},{equals:ze.structural,argsDebugName:(e,t)=>Je({caller:"querySingleAndMap",thread:e,pattern:t})}),CO=function(t,n){return typeof n=="function"?t.map(n):typeof n=="string"?t.map(r=>r[n]):t.map(Vo(n))},xO=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=>Vo(n)(t))};function Vo(e){return t=>Object.entries(e).reduce((n,[r,i])=>(n[i]=t[r],n),{})}function UO(e,t){return t.map(n=>MO(e,n))}function MO(e,t){return`${e}/${t}`}function id(e,t){return Array.isArray(e)?Ca.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function BO(){if(Ua!=null&&performance.now()>=Ua)throw new DO(Ua)}var DO=class extends Error{constructor(e){super(e)}};var kO=De({"../../../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}}}),LO=De({"../../../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}}}),jO=De({"../../../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}}}),ja=De({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:kO(),decode:LO(),encodingLength:jO()}}}),FO=["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 zO(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=VO(e);return n||"Object"}function VO(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(FO.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",KO=new TextEncoder;function Go(e){return wi&&globalThis.Buffer.isBuffer(e)}function yd(e){return e instanceof Uint8Array?Go(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var qO=24,GO=200,WO=wi?e=>e.length>=qO?globalThis.Buffer.from(e):od(e):e=>e.length>=GO?KO.encode(e):od(e),ln=e=>Uint8Array.from(e),HO=wi?(e,t,n)=>Go(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n),JO=wi?(e,t)=>(e=e.map(n=>n instanceof Uint8Array?n:globalThis.Buffer.from(n)),yd(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},XO=wi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function gd(e,t){if(Go(e)&&Go(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 od(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 YO=256,md=class{constructor(e=YO){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=XO(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=HO(n,0,this.cursor)}else t=JO(this.chunks,this.cursor);return e&&this.reset(),t}},QO=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:",vd="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 ZO(e,t,n,r){return new pe(V.uint,rr(e,t+1,r),2)}function eE(e,t,n,r){return new pe(V.uint,ir(e,t+1,r),3)}function tE(e,t,n,r){return new pe(V.uint,or(e,t+1,r),5)}function nE(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 rE(e,t,n,r){return new pe(V.negint,-1-rr(e,t+1,r),2)}function iE(e,t,n,r){return new pe(V.negint,-1-ir(e,t+1,r),3)}function oE(e,t,n,r){return new pe(V.negint,-1-or(e,t+1,r),5)}var Fa=BigInt(-1),bd=BigInt(1);function sE(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,Fa-BigInt(i),9)}function za(e,t){let n=t.value,r=typeof n=="bigint"?n*Fa-bd:n*-1-1;Ct(e,t.type.majorEncoded,r)}za.encodedSize=function(t){let n=t.value,r=typeof n=="bigint"?n*Fa-bd:n*-1-1;return r<Ze[0]?1:r<Ze[1]?2:r<Ze[2]?3:r<Ze[3]?5:9};za.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 aE(e,t,n,r){return Ai(e,t,1,n)}function uE(e,t,n,r){return Ai(e,t,2,rr(e,t+1,r))}function cE(e,t,n,r){return Ai(e,t,3,ir(e,t+1,r))}function lE(e,t,n,r){return Ai(e,t,5,or(e,t+1,r))}function fE(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 Wo(e){return e.encodedBytes===void 0&&(e.encodedBytes=V.equals(e.type,V.string)?WO(e.value):e.value),e.encodedBytes}function Yo(e,t){let n=Wo(t);Ct(e,t.type.majorEncoded,n.length),e.push(n)}Yo.encodedSize=function(t){let n=Wo(t);return Ct.encodedSize(n.length)+n.length};Yo.compareTokens=function(t,n){return dE(Wo(t),Wo(n))};function dE(e,t){return e.length<t.length?-1:e.length>t.length?1:gd(e,t)}var sd=new TextDecoder,pE=32;function hE(e,t,n){if(n-t<pE){let i="";for(let o=t;o<n;o++){let s=e[o];if(s&128)return sd.decode(e.subarray(t,n));i+=String.fromCharCode(s)}return i}return sd.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,hE(e,t+n,t+o),o);return i.retainStringBytes===!0&&(s.byteValue=e.slice(t+n,t+o)),s}function yE(e,t,n,r){return Oi(e,t,1,n,r)}function gE(e,t,n,r){return Oi(e,t,2,rr(e,t+1,r),r)}function mE(e,t,n,r){return Oi(e,t,3,ir(e,t+1,r),r)}function vE(e,t,n,r){return Oi(e,t,5,or(e,t+1,r),r)}function bE(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 _E=Yo;function kr(e,t,n,r){return new pe(V.array,r,n)}function wE(e,t,n,r){return kr(e,t,1,n)}function TE(e,t,n,r){return kr(e,t,2,rr(e,t+1,r))}function AE(e,t,n,r){return kr(e,t,3,ir(e,t+1,r))}function OE(e,t,n,r){return kr(e,t,5,or(e,t+1,r))}function EE(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 kr(e,t,9,i)}function IE(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 Va(e,t){Ct(e,V.array.majorEncoded,t.value)}Va.compareTokens=ar.compareTokens;Va.encodedSize=function(t){return Ct.encodedSize(t.value)};function Lr(e,t,n,r){return new pe(V.map,r,n)}function SE(e,t,n,r){return Lr(e,t,1,n)}function $E(e,t,n,r){return Lr(e,t,2,rr(e,t+1,r))}function NE(e,t,n,r){return Lr(e,t,3,ir(e,t+1,r))}function RE(e,t,n,r){return Lr(e,t,5,or(e,t+1,r))}function PE(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 Lr(e,t,9,i)}function CE(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.map.majorEncoded,t.value)}Ka.compareTokens=ar.compareTokens;Ka.encodedSize=function(t){return Ct.encodedSize(t.value)};function xE(e,t,n,r){return new pe(V.tag,n,1)}function UE(e,t,n,r){return new pe(V.tag,rr(e,t+1,r),2)}function ME(e,t,n,r){return new pe(V.tag,ir(e,t+1,r),3)}function BE(e,t,n,r){return new pe(V.tag,or(e,t+1,r),5)}function DE(e,t,n,r){return new pe(V.tag,sr(e,t+1,r),9)}function qa(e,t){Ct(e,V.tag.majorEncoded,t.value)}qa.compareTokens=ar.compareTokens;qa.encodedSize=function(t){return Ct.encodedSize(t.value)};var _d=20,wd=21,Td=22,Ad=23;function kE(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 LE(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 Ga(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 jE(e,t,n,r){return Ga(Ha(e,t+1),3,r)}function FE(e,t,n,r){return Ga(Ja(e,t+1),5,r)}function zE(e,t,n,r){return Ga(Sd(e,t+1),9,r)}function Wa(e,t,n){let r=t.value;if(r===!1)e.push([V.float.majorEncoded|_d]);else if(r===!0)e.push([V.float.majorEncoded|wd]);else if(r===null)e.push([V.float.majorEncoded|Td]);else if(r===void 0)e.push([V.float.majorEncoded|Ad]);else{let i,o=!1;(!n||n.float64!==!0)&&(Ed(r),i=Ha(Kt,1),r===i||Number.isNaN(r)?(Kt[0]=249,e.push(Kt.slice(0,3)),o=!0):(Id(r),i=Ja(Kt,1),r===i&&(Kt[0]=250,e.push(Kt.slice(0,5)),o=!0))),o||(VE(r),i=Sd(Kt,1),Kt[0]=251,e.push(Kt.slice(0,9)))}}Wa.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){Ed(r);let i=Ha(Kt,1);if(r===i||Number.isNaN(r))return 3;if(Id(r),i=Ja(Kt,1),r===i)return 5}return 9};var Od=new ArrayBuffer(9),Pt=new DataView(Od,1),Kt=new Uint8Array(Od,0);function Ed(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 Ha(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 Id(e){Pt.setFloat32(0,e,!1)}function Ja(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 VE(e){Pt.setFloat64(0,e,!1)}function Sd(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)}Wa.compareTokens=ar.compareTokens;function Ie(e,t,n){throw new Error(`${Be} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function Qo(e){return()=>{throw new Error(`${Be} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=Ie;ue[24]=ZO;ue[25]=eE;ue[26]=tE;ue[27]=nE;ue[28]=Ie;ue[29]=Ie;ue[30]=Ie;ue[31]=Ie;for(let e=32;e<=55;e++)ue[e]=Ie;ue[56]=rE;ue[57]=iE;ue[58]=oE;ue[59]=sE;ue[60]=Ie;ue[61]=Ie;ue[62]=Ie;ue[63]=Ie;for(let e=64;e<=87;e++)ue[e]=aE;ue[88]=uE;ue[89]=cE;ue[90]=lE;ue[91]=fE;ue[92]=Ie;ue[93]=Ie;ue[94]=Ie;ue[95]=Qo("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ue[e]=yE;ue[120]=gE;ue[121]=mE;ue[122]=vE;ue[123]=bE;ue[124]=Ie;ue[125]=Ie;ue[126]=Ie;ue[127]=Qo("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ue[e]=wE;ue[152]=TE;ue[153]=AE;ue[154]=OE;ue[155]=EE;ue[156]=Ie;ue[157]=Ie;ue[158]=Ie;ue[159]=IE;for(let e=160;e<=183;e++)ue[e]=SE;ue[184]=$E;ue[185]=NE;ue[186]=RE;ue[187]=PE;ue[188]=Ie;ue[189]=Ie;ue[190]=Ie;ue[191]=CE;for(let e=192;e<=215;e++)ue[e]=xE;ue[216]=UE;ue[217]=ME;ue[218]=BE;ue[219]=DE;ue[220]=Ie;ue[221]=Ie;ue[222]=Ie;ue[223]=Ie;for(let e=224;e<=243;e++)ue[e]=Qo("simple values are not supported");ue[244]=Ie;ue[245]=Ie;ue[246]=Ie;ue[247]=kE;ue[248]=Qo("simple values are not supported");ue[249]=jE;ue[250]=FE;ue[251]=zE;ue[252]=Ie;ue[253]=Ie;ue[254]=Ie;ue[255]=LE;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 KE(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 qE=Object.freeze({float64:!0,mapSorter:JE,quickEncodeToken:KE});function $d(){let e=[];return e[V.uint.major]=ar,e[V.negint.major]=za,e[V.bytes.major]=Yo,e[V.string.major]=_E,e[V.array.major]=Va,e[V.map.major]=Ka,e[V.tag.major]=qa,e[V.float.major]=Wa,e}var GE=$d(),WE=new md,ad=class Nd{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(`${vd} object contains circular references`);return new Nd(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=ad.createCheck(r,e);let i=[],o=0;for(let s of e)i[o++]=Ko(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=ad.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++]=[Ko(d,n,r),Ko(g,n,r)])}c<s&&(a.length=c)}return a?.length?(HE(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 Ko(e,t={},n){let r=zO(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(`${vd} unsupported type: ${r}`);return o(e,r,t,n)}function HE(e,t){t.mapSorter&&e.sort(t.mapSorter)}function JE(e,t){if(e[0]instanceof pe&&t[0]instanceof pe){let n=e[0],r=t[0];return n._keyBytes||(n._keyBytes=ud(n.value)),r._keyBytes||(r._keyBytes=ud(r.value)),gd(n._keyBytes,r._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function ud(e){return XE(e,GE,qE)}function Rd(e,t,n,r){if(Array.isArray(t))for(let i of t)Rd(e,i,n,r);else n[t.type.major](e,t,r)}var dN=V.uint.majorEncoded,pN=V.negint.majorEncoded,hN=V.bytes.majorEncoded,yN=V.string.majorEncoded,gN=V.array.majorEncoded,mN=V.float.majorEncoded|_d,vN=V.float.majorEncoded|wd,bN=V.float.majorEncoded|Td,_N=V.float.majorEncoded|Ad,wN=BigInt(-1),TN=BigInt(1);function XE(e,t,n,r){let i=r instanceof Uint8Array,o=i?new QO(r):WE,s=Ko(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 md(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():yd(o.chunks[0])}}return o.reset(),Rd(o,s,t,n),o.toBytes(!0)}var AN=Symbol.for("DONE"),ON=Symbol.for("BREAK");var EN=new Uint8Array(0);function YE(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 Xa(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 QE(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,L=S.length;F!==L&&S[F]===0;)F++,z++;for(var K=(L-F)*d+1>>>0,W=new Uint8Array(K);F!==L;){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 L=(S.length-z)*c+1>>>0,K=new Uint8Array(L);S[z];){var W=n[S.charCodeAt(z)];if(W===255)return;for(var j=0,Z=L-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=L-F;G!==L&&K[G]===0;)G++;for(var fe=new Uint8Array(J+(L-G)),x=J;G!==L;)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 ZE=QE,eI=ZE,tI=eI,nI=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")}},rI=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 Pd(this,e)}},iI=class{decoders;constructor(e){this.decoders=e}or(e){return Pd(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 Pd(e,t){return new iI({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var oI=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 nI(e,t,n),this.decoder=new rI(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Cd({name:e,prefix:t,encode:n,decode:r}){return new oI(e,t,n,r)}function Zo({name:e,prefix:t,alphabet:n}){let{encode:r,decode:i}=tI(n,e);return Cd({prefix:t,name:e,encode:r,decode:o=>Xa(i(o))})}function sI(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 aI(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 uI(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=uI(r);return Cd({prefix:t,name:e,encode(o){return aI(o,r,n)},decode(o){return sI(o,i,n,e)}})}var qo=dn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),IN=dn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),SN=dn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),$N=dn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),NN=dn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),RN=dn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),PN=dn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),CN=dn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),xN=dn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Ma=Zo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),UN=Zo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),$n=Zo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),MN=Zo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),cI=xd,cd=128,lI=127,fI=~lI,dI=Math.pow(2,31);function xd(e,t,n){t=t||[],n=n||0;for(var r=n;e>=dI;)t[n++]=e&255|cd,e/=128;for(;e&fI;)t[n++]=e&255|cd,e>>>=7;return t[n]=e|0,xd.bytes=n-r+1,t}var pI=Ba,hI=128,ld=127;function Ba(e,r){var n=0,r=r||0,i=0,o=r,s,a=e.length;do{if(o>=a)throw Ba.bytes=0,new RangeError("Could not decode varint");s=e[o++],n+=i<28?(s&ld)<<i:(s&ld)*Math.pow(2,i),i+=7}while(s>=hI);return Ba.bytes=o-r,n}var yI=Math.pow(2,7),gI=Math.pow(2,14),mI=Math.pow(2,21),vI=Math.pow(2,28),bI=Math.pow(2,35),_I=Math.pow(2,42),wI=Math.pow(2,49),TI=Math.pow(2,56),AI=Math.pow(2,63),OI=function(e){return e<yI?1:e<gI?2:e<mI?3:e<vI?4:e<bI?5:e<_I?6:e<wI?7:e<TI?8:e<AI?9:10},EI={encode:cI,decode:pI,encodingLength:OI},II=EI,Ho=II;function Da(e,t=0){return[Ho.decode(e,t),Ho.decode.bytes]}function Jo(e,t,n=0){return Ho.encode(e,t,n),t}function Xo(e){return Ho.encodingLength(e)}function SI(e,t){let n=t.byteLength,r=Xo(e),i=r+Xo(n),o=new Uint8Array(i+n);return Jo(e,o,0),Jo(n,o,r),o.set(t,i),new Ya(e,n,t,o)}function $I(e){let t=Xa(e),[n,r]=Da(t),[i,o]=Da(t.subarray(r)),s=t.subarray(r+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Ya(n,i,s,t)}function NI(e,t){if(e===t)return!0;{let n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&YE(e.bytes,n.bytes)}}var Ya=class{code;size;digest;bytes;constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}};function fd(e,t){let{bytes:n,version:r}=e;switch(r){case 0:return PI(n,ka(e),t??$n.encoder);default:return CI(n,ka(e),t??qo.encoder)}}var dd=new WeakMap;function ka(e){let t=dd.get(e);if(t==null){let n=new Map;return dd.set(e,n),n}return t}var Ud=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!==xI)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=SI(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&&NI(t.multihash,r.multihash)}toString(t){return fd(this,t)}toJSON(){return{"/":fd(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??pd(r,i,o.bytes))}else if(n[UI]===!0){let{version:r,multihash:i,code:o}=n,s=$I(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=pd(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=Xa(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 Ya(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]=Da(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]=RI(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 ka(o).set(r,t),o}};function RI(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 qo.prefix:{let n=t??qo;return[qo.prefix,n.decode(e)]}case Ma.prefix:{let n=t??Ma;return[Ma.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 PI(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 CI(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,xI=18;function pd(e,t,n){let r=Xo(e),i=r+Xo(t),o=new Uint8Array(i+n.byteLength);return Jo(e,o,0),Jo(t,o,r),o.set(n,i),o}var UI=Symbol.for("@ipld/js-cid/CID"),Md=42;function MI(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Ud.asCID(e);if(!t)return null;let n=new Uint8Array(t.bytes.byteLength+1);return n.set(t.bytes,1),[new pe(V.tag,Md),new pe(V.bytes,n)]}function BI(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function DI(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 kI(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 hd={float64:!0,typeEncoders:{Map:kI,Object:MI,undefined:BI,number:DI}},BN={...hd,typeEncoders:{...hd.typeEncoders}};function LI(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ud.decode(e.subarray(1))}var La={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};La.tags[Md]=LI;var DN={...La,tags:La.tags.slice()};var kN=mt(ja(),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}},LN={toTyped:bi.CarV1HeaderOrV2Pragma,toRepresentation:_i.CarV1HeaderOrV2Pragma},jN=$d(),FN=mt(ja(),1),zN=[new pe(V.map,2),new pe(V.string,"version"),new pe(V.uint,1),new pe(V.string,"roots")],VN=new pe(V.tag,42);var KN=mt(ja(),1);var{WARN:qN,LOG:GN,DEBUG:WN,VERBOSE:HN,ERROR:JN}=$e.setup($e.INFO);var{WARN:XN,LOG:YN,DEBUG:QN,VERBOSE:ZN,ERROR:eR}=$e.setup($e.INFO);var Qa=class{app;username;devicename;signer},Bd=class extends Qa{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 xa(this.agentString)}get shortDID(){return this.did?.slice(-8)}get agentString(){return`${this.username}.${this.shortDID}@${this.app}.${this.devicename}`}};export{Bd as BaseAgent};
|
|
56
|
+
`)}var hg=pg;function yg(e){return function(){return e}}var gg=yg,mg=function(){try{var e=Br(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Vi=mg,vg=Vi?function(e,t){return Vi(e,"toString",{configurable:!0,enumerable:!1,value:gg(t),writable:!0})}:so,bg=vg,_g=ol(bg),Ms=_g;function wg(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var Tg=wg;function Ag(e,t,r,n){for(var i=e.length,s=r+(n?1:-1);n?s--:++s<i;)if(t(e[s],s,e))return s;return-1}var Og=Ag;function Ig(e){return e!==e}var Eg=Ig;function Sg(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var Rg=Sg;function Pg(e,t,r){return t===t?Rg(e,t,r):Og(e,Eg,r)}var $g=Pg;function Ng(e,t){var r=e==null?0:e.length;return!!r&&$g(e,t,0)>-1}var al=Ng,Cg=1,xg=2,Ug=8,Mg=16,Dg=32,Bg=64,Lg=128,jg=256,kg=512,Fg=[["ary",Lg],["bind",Cg],["bindKey",xg],["curry",Ug],["curryRight",Mg],["flip",kg],["partial",Dg],["partialRight",Bg],["rearg",jg]];function Kg(e,t){return Tg(Fg,function(r){var n="_."+r[0];t&r[1]&&!al(e,n)&&e.push(n)}),e.sort()}var Vg=Kg;function zg(e,t,r){var n=t+"";return Ms(e,hg(n,Vg(fg(n),r)))}var ul=zg,qg=1,Gg=2,Wg=4,Hg=8,Du=32,Bu=64;function Jg(e,t,r,n,i,s,o,a,l,c){var d=t&Hg,g=d?o:void 0,x=d?void 0:o,S=d?s:void 0,R=d?void 0:s;t|=d?Du:Bu,t&=~(d?Bu:Du),t&Wg||(t&=~(qg|Gg));var K=[e,t,i,S,g,R,x,a,l,c],H=r.apply(void 0,K);return rg(e)&&sl(H,K),H.placeholder=n,ul(H,e,t)}var cl=Jg;function Xg(e){var t=e;return t.placeholder}var Ds=Xg,Yg=9007199254740991,Qg=/^(?:0|[1-9]\d*)$/;function Zg(e,t){var r=typeof e;return t=t??Yg,!!t&&(r=="number"||r!="symbol"&&Qg.test(e))&&e>-1&&e%1==0&&e<t}var ao=Zg,em=Math.min;function tm(e,t){for(var r=e.length,n=em(t.length,r),i=il(e);n--;){var s=t[n];e[n]=ao(s,r)?i[s]:void 0}return e}var rm=tm,Lu="__lodash_placeholder__";function nm(e,t){for(var r=-1,n=e.length,i=0,s=[];++r<n;){var o=e[r];(o===t||o===Lu)&&(e[r]=Lu,s[i++]=r)}return s}var Kn=nm,im=1,om=2,sm=8,am=16,um=128,cm=512;function ll(e,t,r,n,i,s,o,a,l,c){var d=t&um,g=t&im,x=t&om,S=t&(sm|am),R=t&cm,K=x?void 0:Fn(e);function H(){for(var F=arguments.length,j=Array(F),V=F;V--;)j[V]=arguments[V];if(S)var G=Ds(H),k=jy(j,G);if(n&&(j=el(j,n,i,S)),s&&(j=tl(j,s,o,S)),F-=k,S&&F<c){var Q=Kn(j,G);return cl(e,t,ll,H.placeholder,r,j,Q,a,l,c-F)}var q=g?r:this,ce=x?q[e]:e;return F=j.length,a?j=rm(j,a):R&&F>1&&j.reverse(),d&&l<F&&(j.length=l),this&&this!==ut&&this instanceof H&&(ce=K||Fn(ce)),ce.apply(q,j)}return H}var fl=ll;function lm(e,t,r){var n=Fn(e);function i(){for(var s=arguments.length,o=Array(s),a=s,l=Ds(i);a--;)o[a]=arguments[a];var c=s<3&&o[0]!==l&&o[s-1]!==l?[]:Kn(o,l);if(s-=c.length,s<r)return cl(e,t,fl,i.placeholder,void 0,o,c,void 0,void 0,r-s);var d=this&&this!==ut&&this instanceof i?n:e;return Cs(d,this,o)}return i}var fm=lm,dm=1;function pm(e,t,r,n){var i=t&dm,s=Fn(e);function o(){for(var a=-1,l=arguments.length,c=-1,d=n.length,g=Array(d+l),x=this&&this!==ut&&this instanceof o?s:e;++c<d;)g[c]=n[c];for(;l--;)g[c++]=arguments[++a];return Cs(x,i?r:this,g)}return o}var hm=pm,ju="__lodash_placeholder__",os=1,ym=2,gm=4,ku=8,Mn=128,Fu=256,mm=Math.min;function vm(e,t){var r=e[1],n=t[1],i=r|n,s=i<(os|ym|Mn),o=n==Mn&&r==ku||n==Mn&&r==Fu&&e[7].length<=t[8]||n==(Mn|Fu)&&t[7].length<=t[8]&&r==ku;if(!(s||o))return e;n&os&&(e[2]=t[2],i|=r&os?0:gm);var a=t[3];if(a){var l=e[3];e[3]=l?el(l,a,t[4]):a,e[4]=l?Kn(e[3],ju):t[4]}return a=t[5],a&&(l=e[5],e[5]=l?tl(l,a,t[6]):a,e[6]=l?Kn(e[5],ju):t[6]),a=t[7],a&&(e[7]=a),n&Mn&&(e[8]=e[8]==null?t[8]:mm(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var bm=vm,_m="Expected a function",Ku=1,wm=2,ss=8,as=16,us=32,Vu=64,zu=Math.max;function Tm(e,t,r,n,i,s,o,a){var l=t&wm;if(!l&&typeof e!="function")throw new TypeError(_m);var c=n?n.length:0;if(c||(t&=~(us|Vu),n=i=void 0),o=o===void 0?o:zu(Cu(o),0),a=a===void 0?a:Cu(a),c-=i?i.length:0,t&Vu){var d=n,g=i;n=i=void 0}var x=l?void 0:nl(e),S=[e,t,r,n,i,d,g,s,o,a];if(x&&bm(S,x),e=S[0],t=S[1],r=S[2],n=S[3],i=S[4],a=S[9]=S[9]===void 0?l?0:e.length:zu(S[9]-c,0),!a&&t&(ss|as)&&(t&=~(ss|as)),!t||t==Ku)var R=Cy(e,t,r);else t==ss||t==as?R=fm(e,t,a):(t==us||t==(Ku|us))&&!i.length?R=hm(e,t,r,n):R=fl.apply(void 0,S);var K=x?Zc:sl;return ul(K(R,S),e,t)}var Am=Tm;function Om(e,t,r){t=="__proto__"&&Vi?Vi(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var Im=Om;function Em(e,t){return e===t||e!==e&&t!==t}var Bs=Em,Sm=Object.prototype,Rm=Sm.hasOwnProperty;function Pm(e,t,r){var n=e[t];(!(Rm.call(e,t)&&Bs(n,r))||r===void 0&&!(t in e))&&Im(e,t,r)}var $m=Pm,qu=Math.max;function Nm(e,t,r){return t=qu(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,s=qu(n.length-t,0),o=Array(s);++i<s;)o[i]=n[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=n[i];return a[t]=r(o),Cs(e,this,a)}}var dl=Nm;function Cm(e,t){return Ms(dl(e,t,so),e+"")}var pl=Cm,xm=9007199254740991;function Um(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=xm}var Ls=Um;function Mm(e){return e!=null&&Ls(e.length)&&!Qc(e)}var hl=Mm,Dm=Object.prototype;function Bm(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Dm;return e===r}var Lm=Bm;function jm(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var km=jm,Fm="[object Arguments]";function Km(e){return hr(e)&&ln(e)==Fm}var Gu=Km,yl=Object.prototype,Vm=yl.hasOwnProperty,zm=yl.propertyIsEnumerable,qm=Gu(function(){return arguments}())?Gu:function(e){return hr(e)&&Vm.call(e,"callee")&&!zm.call(e,"callee")},js=qm;function Gm(){return!1}var Wm=Gm,gl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wu=gl&&typeof module=="object"&&module&&!module.nodeType&&module,Hm=Wu&&Wu.exports===gl,Hu=Hm?ut.Buffer:void 0,Jm=Hu?Hu.isBuffer:void 0,Xm=Jm||Wm,ms=Xm,Ym="[object Arguments]",Qm="[object Array]",Zm="[object Boolean]",ev="[object Date]",tv="[object Error]",rv="[object Function]",nv="[object Map]",iv="[object Number]",ov="[object Object]",sv="[object RegExp]",av="[object Set]",uv="[object String]",cv="[object WeakMap]",lv="[object ArrayBuffer]",fv="[object DataView]",dv="[object Float32Array]",pv="[object Float64Array]",hv="[object Int8Array]",yv="[object Int16Array]",gv="[object Int32Array]",mv="[object Uint8Array]",vv="[object Uint8ClampedArray]",bv="[object Uint16Array]",_v="[object Uint32Array]",Ne={};Ne[dv]=Ne[pv]=Ne[hv]=Ne[yv]=Ne[gv]=Ne[mv]=Ne[vv]=Ne[bv]=Ne[_v]=!0;Ne[Ym]=Ne[Qm]=Ne[lv]=Ne[Zm]=Ne[fv]=Ne[ev]=Ne[tv]=Ne[rv]=Ne[nv]=Ne[iv]=Ne[ov]=Ne[sv]=Ne[av]=Ne[uv]=Ne[cv]=!1;function wv(e){return hr(e)&&Ls(e.length)&&!!Ne[ln(e)]}var Tv=wv;function Av(e){return function(t){return e(t)}}var ml=Av,vl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,jn=vl&&typeof module=="object"&&module&&!module.nodeType&&module,Ov=jn&&jn.exports===vl,cs=Ov&&Hc.process,Iv=function(){try{var e=jn&&jn.require&&jn.require("util").types;return e||cs&&cs.binding&&cs.binding("util")}catch{}}(),Ju=Iv,Xu=Ju&&Ju.isTypedArray,Ev=Xu?ml(Xu):Tv,bl=Ev,Sv=Object.prototype,Rv=Sv.hasOwnProperty;function Pv(e,t){var r=Mt(e),n=!r&&js(e),i=!r&&!n&&ms(e),s=!r&&!n&&!i&&bl(e),o=r||n||i||s,a=o?km(e.length,String):[],l=a.length;for(var c in e)(t||Rv.call(e,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||ao(c,l)))&&a.push(c);return a}var $v=Pv;function Nv(e,t){return function(r){return e(t(r))}}var Cv=Nv,xv=Cv(Object.keys,Object),Uv=xv,Mv=Object.prototype,Dv=Mv.hasOwnProperty;function Bv(e){if(!Lm(e))return Uv(e);var t=[];for(var r in Object(e))Dv.call(e,r)&&r!="constructor"&&t.push(r);return t}var Lv=Bv;function jv(e){return hl(e)?$v(e):Lv(e)}var _l=jv,kv=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fv=/^\w*$/;function Kv(e,t){if(Mt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||an(e)?!0:Fv.test(e)||!kv.test(e)||t!=null&&e in Object(t)}var ks=Kv,Vv=Br(Object,"create"),Vn=Vv;function zv(){this.__data__=Vn?Vn(null):{},this.size=0}var qv=zv;function Gv(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Wv=Gv,Hv="__lodash_hash_undefined__",Jv=Object.prototype,Xv=Jv.hasOwnProperty;function Yv(e){var t=this.__data__;if(Vn){var r=t[e];return r===Hv?void 0:r}return Xv.call(t,e)?t[e]:void 0}var Qv=Yv,Zv=Object.prototype,eb=Zv.hasOwnProperty;function tb(e){var t=this.__data__;return Vn?t[e]!==void 0:eb.call(t,e)}var rb=tb,nb="__lodash_hash_undefined__";function ib(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Vn&&t===void 0?nb:t,this}var ob=ib;function fn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}fn.prototype.clear=qv;fn.prototype.delete=Wv;fn.prototype.get=Qv;fn.prototype.has=rb;fn.prototype.set=ob;var Yu=fn;function sb(){this.__data__=[],this.size=0}var ab=sb;function ub(e,t){for(var r=e.length;r--;)if(Bs(e[r][0],t))return r;return-1}var uo=ub,cb=Array.prototype,lb=cb.splice;function fb(e){var t=this.__data__,r=uo(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():lb.call(t,r,1),--this.size,!0}var db=fb;function pb(e){var t=this.__data__,r=uo(t,e);return r<0?void 0:t[r][1]}var hb=pb;function yb(e){return uo(this.__data__,e)>-1}var gb=yb;function mb(e,t){var r=this.__data__,n=uo(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var vb=mb;function dn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}dn.prototype.clear=ab;dn.prototype.delete=db;dn.prototype.get=hb;dn.prototype.has=gb;dn.prototype.set=vb;var co=dn,bb=Br(ut,"Map"),zn=bb;function _b(){this.size=0,this.__data__={hash:new Yu,map:new(zn||co),string:new Yu}}var wb=_b;function Tb(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Ab=Tb;function Ob(e,t){var r=e.__data__;return Ab(t)?r[typeof t=="string"?"string":"hash"]:r.map}var lo=Ob;function Ib(e){var t=lo(this,e).delete(e);return this.size-=t?1:0,t}var Eb=Ib;function Sb(e){return lo(this,e).get(e)}var Rb=Sb;function Pb(e){return lo(this,e).has(e)}var $b=Pb;function Nb(e,t){var r=lo(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Cb=Nb;function pn(e){var t=-1,r=e==null?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}pn.prototype.clear=wb;pn.prototype.delete=Eb;pn.prototype.get=Rb;pn.prototype.has=$b;pn.prototype.set=Cb;var fo=pn,xb="Expected a function";function Fs(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(xb);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=e.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Fs.Cache||fo),r}Fs.Cache=fo;var Ub=Fs,Mb=500;function Db(e){var t=Ub(e,function(n){return r.size===Mb&&r.clear(),n}),r=t.cache;return t}var Bb=Db,Lb=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jb=/\\(\\)?/g,kb=Bb(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Lb,function(r,n,i,s){t.push(i?s.replace(jb,"$1"):n||r)}),t}),Fb=kb;function Kb(e){return e==null?"":Bh(e)}var Vb=Kb;function zb(e,t){return Mt(e)?e:ks(e,t)?[e]:Fb(Vb(e))}var po=zb,qb=1/0;function Gb(e){if(typeof e=="string"||an(e))return e;var t=e+"";return t=="0"&&1/e==-qb?"-0":t}var Hn=Gb;function Wb(e,t){t=po(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[Hn(t[r++])];return r&&r==n?e:void 0}var Ks=Wb;function Hb(e,t,r){var n=e==null?void 0:Ks(e,t);return n===void 0?r:n}var Jb=Hb;function Xb(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var wl=Xb,Qu=Ft?Ft.isConcatSpreadable:void 0;function Yb(e){return Mt(e)||js(e)||!!(Qu&&e&&e[Qu])}var Qb=Yb;function Tl(e,t,r,n,i){var s=-1,o=e.length;for(r||(r=Qb),i||(i=[]);++s<o;){var a=e[s];t>0&&r(a)?t>1?Tl(a,t-1,r,n,i):wl(i,a):n||(i[i.length]=a)}return i}var Zb=Tl;function e_(e){var t=e==null?0:e.length;return t?Zb(e,1):[]}var t_=e_;function r_(e){return Ms(dl(e,void 0,t_),e+"")}var n_=r_;function i_(){this.__data__=new co,this.size=0}var o_=i_;function s_(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var a_=s_;function u_(e){return this.__data__.get(e)}var c_=u_;function l_(e){return this.__data__.has(e)}var f_=l_,d_=200;function p_(e,t){var r=this.__data__;if(r instanceof co){var n=r.__data__;if(!zn||n.length<d_-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new fo(n)}return r.set(e,t),this.size=r.size,this}var h_=p_;function hn(e){var t=this.__data__=new co(e);this.size=t.size}hn.prototype.clear=o_;hn.prototype.delete=a_;hn.prototype.get=c_;hn.prototype.has=f_;hn.prototype.set=h_;var Ci=hn;function y_(e,t){for(var r=-1,n=e==null?0:e.length,i=0,s=[];++r<n;){var o=e[r];t(o,r,e)&&(s[i++]=o)}return s}var g_=y_;function m_(){return[]}var v_=m_,b_=Object.prototype,__=b_.propertyIsEnumerable,Zu=Object.getOwnPropertySymbols,w_=Zu?function(e){return e==null?[]:(e=Object(e),g_(Zu(e),function(t){return __.call(e,t)}))}:v_,T_=w_;function A_(e,t,r){var n=t(e);return Mt(e)?n:wl(n,r(e))}var O_=A_;function I_(e){return O_(e,_l,T_)}var ec=I_,E_=Br(ut,"DataView"),vs=E_,S_=Br(ut,"Promise"),bs=S_,R_=Br(ut,"Set"),sn=R_,tc="[object Map]",P_="[object Object]",rc="[object Promise]",nc="[object Set]",ic="[object WeakMap]",oc="[object DataView]",$_=Dr(vs),N_=Dr(zn),C_=Dr(bs),x_=Dr(sn),U_=Dr(kn),xr=ln;(vs&&xr(new vs(new ArrayBuffer(1)))!=oc||zn&&xr(new zn)!=tc||bs&&xr(bs.resolve())!=rc||sn&&xr(new sn)!=nc||kn&&xr(new kn)!=ic)&&(xr=function(e){var t=ln(e),r=t==P_?e.constructor:void 0,n=r?Dr(r):"";if(n)switch(n){case $_:return oc;case N_:return tc;case C_:return rc;case x_:return nc;case U_:return ic}return t});var sc=xr,M_=ut.Uint8Array,ac=M_,D_="__lodash_hash_undefined__";function B_(e){return this.__data__.set(e,D_),this}var L_=B_;function j_(e){return this.__data__.has(e)}var k_=j_;function zi(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new fo;++t<r;)this.add(e[t])}zi.prototype.add=zi.prototype.push=L_;zi.prototype.has=k_;var Al=zi;function F_(e,t){for(var r=-1,n=e==null?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}var K_=F_;function V_(e,t){return e.has(t)}var Ol=V_,z_=1,q_=2;function G_(e,t,r,n,i,s){var o=r&z_,a=e.length,l=t.length;if(a!=l&&!(o&&l>a))return!1;var c=s.get(e),d=s.get(t);if(c&&d)return c==t&&d==e;var g=-1,x=!0,S=r&q_?new Al:void 0;for(s.set(e,t),s.set(t,e);++g<a;){var R=e[g],K=t[g];if(n)var H=o?n(K,R,g,t,e,s):n(R,K,g,e,t,s);if(H!==void 0){if(H)continue;x=!1;break}if(S){if(!K_(t,function(F,j){if(!Ol(S,j)&&(R===F||i(R,F,r,n,s)))return S.push(j)})){x=!1;break}}else if(!(R===K||i(R,K,r,n,s))){x=!1;break}}return s.delete(e),s.delete(t),x}var Il=G_;function W_(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var H_=W_;function J_(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var El=J_,X_=1,Y_=2,Q_="[object Boolean]",Z_="[object Date]",ew="[object Error]",tw="[object Map]",rw="[object Number]",nw="[object RegExp]",iw="[object Set]",ow="[object String]",sw="[object Symbol]",aw="[object ArrayBuffer]",uw="[object DataView]",uc=Ft?Ft.prototype:void 0,ls=uc?uc.valueOf:void 0;function cw(e,t,r,n,i,s,o){switch(r){case uw:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case aw:return!(e.byteLength!=t.byteLength||!s(new ac(e),new ac(t)));case Q_:case Z_:case rw:return Bs(+e,+t);case ew:return e.name==t.name&&e.message==t.message;case nw:case ow:return e==t+"";case tw:var a=H_;case iw:var l=n&X_;if(a||(a=El),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=Y_,o.set(e,t);var d=Il(a(e),a(t),n,i,s,o);return o.delete(e),d;case sw:if(ls)return ls.call(e)==ls.call(t)}return!1}var lw=cw,fw=1,dw=Object.prototype,pw=dw.hasOwnProperty;function hw(e,t,r,n,i,s){var o=r&fw,a=ec(e),l=a.length,c=ec(t),d=c.length;if(l!=d&&!o)return!1;for(var g=l;g--;){var x=a[g];if(!(o?x in t:pw.call(t,x)))return!1}var S=s.get(e),R=s.get(t);if(S&&R)return S==t&&R==e;var K=!0;s.set(e,t),s.set(t,e);for(var H=o;++g<l;){x=a[g];var F=e[x],j=t[x];if(n)var V=o?n(j,F,x,t,e,s):n(F,j,x,e,t,s);if(!(V===void 0?F===j||i(F,j,r,n,s):V)){K=!1;break}H||(H=x=="constructor")}if(K&&!H){var G=e.constructor,k=t.constructor;G!=k&&"constructor"in e&&"constructor"in t&&!(typeof G=="function"&&G instanceof G&&typeof k=="function"&&k instanceof k)&&(K=!1)}return s.delete(e),s.delete(t),K}var yw=hw,gw=1,cc="[object Arguments]",lc="[object Array]",$i="[object Object]",mw=Object.prototype,fc=mw.hasOwnProperty;function vw(e,t,r,n,i,s){var o=Mt(e),a=Mt(t),l=o?lc:sc(e),c=a?lc:sc(t);l=l==cc?$i:l,c=c==cc?$i:c;var d=l==$i,g=c==$i,x=l==c;if(x&&ms(e)){if(!ms(t))return!1;o=!0,d=!1}if(x&&!d)return s||(s=new Ci),o||bl(e)?Il(e,t,r,n,i,s):lw(e,t,l,r,n,i,s);if(!(r&gw)){var S=d&&fc.call(e,"__wrapped__"),R=g&&fc.call(t,"__wrapped__");if(S||R){var K=S?e.value():e,H=R?t.value():t;return s||(s=new Ci),i(K,H,r,n,s)}}return x?(s||(s=new Ci),yw(e,t,r,n,i,s)):!1}var bw=vw;function Sl(e,t,r,n,i){return e===t?!0:e==null||t==null||!hr(e)&&!hr(t)?e!==e&&t!==t:bw(e,t,r,n,Sl,i)}var Rl=Sl,_w=1,ww=2;function Tw(e,t,r,n){var i=r.length,s=i,o=!n;if(e==null)return!s;for(e=Object(e);i--;){var a=r[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=r[i];var l=a[0],c=e[l],d=a[1];if(o&&a[2]){if(c===void 0&&!(l in e))return!1}else{var g=new Ci;if(n)var x=n(c,d,l,e,t,g);if(!(x===void 0?Rl(d,c,_w|ww,n,g):x))return!1}}return!0}var Aw=Tw;function Ow(e){return e===e&&!Qt(e)}var Pl=Ow;function Iw(e){for(var t=_l(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Pl(i)]}return t}var Ew=Iw;function Sw(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var $l=Sw;function Rw(e){var t=Ew(e);return t.length==1&&t[0][2]?$l(t[0][0],t[0][1]):function(r){return r===e||Aw(r,e,t)}}var Pw=Rw;function $w(e,t){return e!=null&&t in Object(e)}var Nw=$w;function Cw(e,t,r){t=po(t,e);for(var n=-1,i=t.length,s=!1;++n<i;){var o=Hn(t[n]);if(!(s=e!=null&&r(e,o)))break;e=e[o]}return s||++n!=i?s:(i=e==null?0:e.length,!!i&&Ls(i)&&ao(o,i)&&(Mt(e)||js(e)))}var xw=Cw;function Uw(e,t){return e!=null&&xw(e,t,Nw)}var Nl=Uw,Mw=1,Dw=2;function Bw(e,t){return ks(e)&&Pl(t)?$l(Hn(e),t):function(r){var n=Jb(r,e);return n===void 0&&n===t?Nl(r,e):Rl(t,n,Mw|Dw)}}var Lw=Bw;function jw(e){return function(t){return t?.[e]}}var kw=jw;function Fw(e){return function(t){return Ks(t,e)}}var Kw=Fw;function Vw(e){return ks(e)?kw(Hn(e)):Kw(e)}var zw=Vw;function qw(e){return typeof e=="function"?e:e==null?so:typeof e=="object"?Mt(e)?Lw(e[0],e[1]):Pw(e):zw(e)}var Gw=qw;function Ww(e){return hr(e)&&hl(e)}var Hw=Ww;function Jw(e,t,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}var Xw=Jw,Yw=200;function Qw(e,t,r,n){var i=-1,s=al,o=!0,a=e.length,l=[],c=t.length;if(!a)return l;r&&(t=Xc(t,ml(r))),n?(s=Xw,o=!1):t.length>=Yw&&(s=Ol,o=!1,t=new Al(t));e:for(;++i<a;){var d=e[i],g=r==null?d:r(d);if(d=n||d!==0?d:0,o&&g===g){for(var x=c;x--;)if(t[x]===g)continue e;l.push(d)}else s(t,g,n)||l.push(d)}return l}var Zw=Qw;function eT(e,t,r,n){if(!Qt(e))return e;t=po(t,e);for(var i=-1,s=t.length,o=s-1,a=e;a!=null&&++i<s;){var l=Hn(t[i]),c=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=o){var d=a[l];c=n?n(d,l,a):void 0,c===void 0&&(c=Qt(d)?d:ao(t[i+1])?[]:{})}$m(a,l,c),a=a[l]}return e}var tT=eT;function rT(e,t,r){for(var n=-1,i=t.length,s={};++n<i;){var o=t[n],a=Ks(e,o);r(a,o)&&tT(s,po(o,e),a)}return s}var nT=rT,iT=32,Vs=pl(function(e,t){var r=Kn(t,Ds(Vs));return Am(e,iT,void 0,t,r)});Vs.placeholder={};var oT=Vs;function sT(e,t){return nT(e,t,function(r,n){return Nl(e,n)})}var aT=sT,uT=n_(function(e,t){return e==null?{}:aT(e,t)}),dc=uT,cT=4294967295,lT=cT-1,fT=Math.floor,dT=Math.min;function pT(e,t,r,n){var i=0,s=e==null?0:e.length;if(s===0)return 0;t=r(t);for(var o=t!==t,a=t===null,l=an(t),c=t===void 0;i<s;){var d=fT((i+s)/2),g=r(e[d]),x=g!==void 0,S=g===null,R=g===g,K=an(g);if(o)var H=n||R;else c?H=R&&(n||x):a?H=R&&x&&(n||!S):l?H=R&&x&&!S&&(n||!K):S||K?H=!1:H=n?g<=t:g<t;H?i=d+1:s=d}return dT(s,lT)}var hT=pT;function yT(e,t,r){return hT(e,t,Gw(r,2))}var gT=yT,mT=1/0,iE=sn&&1/El(new sn([,-0]))[1]==mT?function(e){return new sn(e)}:rl;var vT=pl(function(e,t){return Hw(e)?Zw(e,t):[]}),pc=vT,Cl=ft(uh(),1),oE=Cl.default.configure,Mr=Cl.default,fs=100,{WARN:bT,LOG:sE,DEBUG:Ke,VERBOSE:ve,ERROR:aE}=Oe.setup(Oe.INFO),qi=Re.set();gu({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var ze=({caller:e,thread:t,pattern:r,args:n})=>Se(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:Mr(n)}}`:""}`));function xl(e,t){return Se(()=>Be.structural(e.get(),t.get()))}function yn(e,t){return Be.shallow(e.applogs,t.applogs)}function ho(e,t){if(e.size!==t.size)return!1;for(let r=0;r<e.size;r++){let n=e.nodes[r],i=t.nodes[r];if(ve.isEnabled&&ve("queryNodesComparer",r,n,i),!Be.structural(n.variables,i.variables))return ve.isEnabled&&ve("[queryNodesComparer] changed vars:",r,n,i),!1;if(!yn(n.logsOfThisNode,i.logsOfThisNode))return ve.isEnabled&&ve("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return ve.isEnabled&&ve("[queryNodesComparer] equal:",{a:e,b:t}),!0}var _T=0;function Kt(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++_T}{${t}}`;ve.isEnabled&&ve(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,s=Ml(e,a=>{i?Se(()=>(r??Be.structural)(i,a))?Ke.isEnabled&&Ke(`[${n}] update skipped`,{updatedItems:a,observableArr:i}):(i.replace(a),Ke.isEnabled&&Ke(`[${n}] updated`,{updatedItems:a,observableArr:i})):i=Re.array(a,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var o=bt(i);Ke(`[${n}] deps`,{disposeAutorun:s,rootsAtom:o,observableArr:i,observers:Nn(i)}),tn(()=>qi.add(o))}return ve.isEnabled&&rn(i,()=>{ve(`[${n}] observed`,Nn(i),{rootsAtom:o,observableArr:i})}),Pr(i,()=>{ve.isEnabled&&ve(`[${n}] dispose`),o&&tn(()=>qi.delete(o)),s()}),i}var wT=0;function Ul(e,{name:t}={}){let r=`observableSetMap@${++wT}{${t}}`;ve.isEnabled&&ve(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Ml(e,o=>{if(!n)n=Re.set(o,{deep:!1,name:t});else{let{deleted:a,added:l}=Se(()=>{let c=new Set(n.values()),d=new Set;for(let g of o)n.has(g)?(ve.isEnabled&&ve(`[${r}] unchanged`,g,{updatedItems:o,observableSet:n}),c.delete(g)):d.add(g);return Ke.isEnabled&&Ke(`[${r}] updated:`,{unseen:c,added:d,updatedItems:o,observableSet:n}),{added:d,deleted:c}});for(let c of a)n.delete(c);for(let c of l)n.add(c)}},{name:r});if(r.includes("useRoots")){var s=bt(n);Ke.isEnabled&&Ke(`[${r}] deps`,{disposeAutorun:i,rootsAtom:s,observableSet:n,observers:Nn(n)}),tn(()=>qi.add(s))}return ve.isEnabled&&rn(n,()=>{ve(`[${r}] observed`,Nn(n),{rootsAtom:s,observableSet:n})}),Pr(n,()=>{ve.isEnabled&&ve(`[${r}] dispose`),s&&tn(()=>qi.delete(s)),i()}),n}function Ml(e,t=null,{name:r}={}){Ke.isEnabled&&Ke("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,s=new Nt(n,function(...c){Ke.isEnabled&&Ke(`[${n}] reaction.invalidate`,c),o()});function o(){s.track(function(){let c=fs&&performance.now();Ke.isEnabled&&Ke(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),Ke.isEnabled&&Ke(`[${n}] runAndTrack =>`,i),tn(()=>{t?.(i)}),fs&&performance.now()-c>fs&&bT(`[${n}] took ${performance.now()-c}ms`)})}return o(),Ke.isEnabled&&Ke(`[${n}] deps of reaction`,{reaction:s,result:i,deps:$n(s)}),()=>{ve.isEnabled&&ve(`[${n}] dispose`),setTimeout(()=>s.dispose())}}function We(e,t,r=!1){if(or(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let n=!1,i=0,s=typeof r=="boolean"?{keepAlive:r}:r,o=new Map;return function(...a){let l,c=Se(()=>{let S=a;for(let R=0;R<a.length;R++)a[R]instanceof un&&a===S&&(S=a.slice());return S}),d=`computedFnDeepCompare(${e||t.name}#${++i})${s.argsDebugName?`{${s.argsDebugName(...a)}}`:""}`;for(let[S,R]of o.entries())if(AT(S,c)){l=R;break}else if(ve.isEnabled)for(let K=0;K<S.length;K++)S[K]instanceof un&&S[K].name===a[K].name&&Be.structural(pc(S,S[K]),pc(c,c[K]))&&ve.force(`[${d}] threadState mismatch => cachebust`,{diffFields:Object.keys(S[K]).filter(H=>!Be.structural(S[K][H],a[K][H])),cacheArg:S[K],freshArg:a[K]});if(l){let S=l.get();return ve.isEnabled&&ve(`[${d}] cache hit`,{untrackedArgs:c,cachedResult:S}),S}if(!s.keepAlive&&!Qa())return!n&&ru().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),n=!0),t.apply(this,a);ve.isEnabled&&ve(`[${d}] new computation`,{untrackedArgs:c});let g,x=xe(()=>(ve.isEnabled&&ve(`[${d}] update->rerun`,Se(()=>({args:a})),t),ve.isEnabled&&Yo(),g=t.apply(this,a)),{...s,name:d});if(ve.isEnabled&&ve(`[${d}] deps`,$n(x),{untrackedArgs:c}),o.set(c,x),!s.keepAlive){let S=Pr(x,()=>{ve.isEnabled&&ve(`[${d}] dispose`,x),S(),o.delete(c),s.onCleanup&&s.onCleanup(g,...a),g=void 0})}return x.get()}}function TT(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let s=e[i];s==="("?r+=s+`
|
|
57
|
+
`+" ".repeat(++t):s===")"?r+=`
|
|
58
|
+
`+" ".repeat(--t)+s:s===","&&n===0?r+=s+`
|
|
59
|
+
`+" ".repeat(t):s==="{"&&n===0?(n++,r+=s+`
|
|
60
|
+
`+" ".repeat(t+1)):s==="}"&&n===1?(n--,r+=`
|
|
61
|
+
`+" ".repeat(t)+s):s==="{"&&n>0?(n++,r+=s):(s==="}"&&n>1&&n--,r+=s)}return r}function AT(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]instanceof un){if(t[r]!==e[r])return!1}else if(!Be.structural(e[r],t[r]))return!1;return!0}var{WARN:hc,LOG:uE,DEBUG:OT,VERBOSE:cE,ERROR:Nr}=Oe.setup(Oe.INFO,{prefix:"[thread]"});function Zt(e){return e.init!==void 0}var un=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:ga(t),this.filters=r,Se(()=>this.parents?.length===0)&&hc("[Thread] empty parents array",e),i.skipObservable||ur(this,{applogsCids:xe,applogsByCid:xe,insert:tt,size:xe,isEmpty:xe,firstLog:xe,latestLog:xe},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw Nr("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Nr("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Nr("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw Nr("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Nr("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Nr("[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):hc("unsubscribe called for non-existent",e)}notifySubscribers(e){OT(`[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 Nr("[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 Se(()=>this.size)}get nameAndSizeUntracked(){return Se(()=>`${this.name} (${this.size})`)}get prettyName(){return TT(this.name)}get hasParents(){return!!this.parents?.length}};var Dl=class Bl extends un{static fromArray(t,r){return new Bl(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},Ll={};No(Ll,{code:()=>uf,decode:()=>na,encode:()=>ra,format:()=>Ic,name:()=>UA,parse:()=>DA,stringify:()=>Ic});var IT=["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 ET(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 r=ST(e);return r||"Object"}function ST(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(IT.includes(t))return t}var E=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}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}};E.uint=new E(0,"uint",!0);E.negint=new E(1,"negint",!0);E.bytes=new E(2,"bytes",!0);E.string=new E(3,"string",!0);E.array=new E(4,"array",!1);E.map=new E(5,"map",!1);E.tag=new E(6,"tag",!1);E.float=new E(7,"float",!0);E.false=new E(7,"false",!0);E.true=new E(7,"true",!0);E.null=new E(7,"null",!0);E.undefined=new E(7,"undefined",!0);E.break=new E(7,"break",!0);var Z=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},Jn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",RT=new TextEncoder;function Gi(e){return Jn&&globalThis.Buffer.isBuffer(e)}function yo(e){return e instanceof Uint8Array?Gi(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var PT=24,$T=200,jl=Jn?e=>e.length>=PT?globalThis.Buffer.from(e):yc(e):e=>e.length>=$T?RT.encode(e):yc(e),Yt=e=>Uint8Array.from(e),NT=Jn?(e,t,r)=>Gi(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),CT=Jn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),yo(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let i of e)n+i.length>r.length&&(i=i.subarray(0,r.length-n)),r.set(i,n),n+=i.length;return r},xT=Jn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function kl(e,t){if(Gi(e)&&Gi(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}function yc(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}var gc=4096;function UT(e){let t=e.length;if(t<=gc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=gc));return r}var MT=256,Fl=class{constructor(e=MT){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 n=t.length-(this.maxCursor-this.cursor)-1;t.set(e,n)}else{if(t){let n=t.length-(this.maxCursor-this.cursor)-1;n<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,n),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=xT(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 r=this.chunks[0];e&&this.cursor>r.length/2?(t=this.cursor===r.length?r:r.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=NT(r,0,this.cursor)}else t=CT(this.chunks,this.cursor);return e&&this.reset(),t}},DT=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}},de="CBOR decode error:",Ur="CBOR encode error:",Xn=[];Xn[23]=1;Xn[24]=2;Xn[25]=3;Xn[26]=5;Xn[27]=9;function gn(e,t,r){if(e.length-t<r)throw new Error(`${de} not enough data for type`)}var Ge=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Lr(e,t,r){gn(e,t,1);let n=e[t];if(r.strict===!0&&n<Ge[0])throw new Error(`${de} integer encoded in more bytes than necessary (strict decode)`);return n}function jr(e,t,r){gn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Ge[1])throw new Error(`${de} integer encoded in more bytes than necessary (strict decode)`);return n}function kr(e,t,r){gn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Ge[2])throw new Error(`${de} integer encoded in more bytes than necessary (strict decode)`);return n}function Fr(e,t,r){gn(e,t,8);let n=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],s=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&s<Ge[3])throw new Error(`${de} integer encoded in more bytes than necessary (strict decode)`);if(s<=Number.MAX_SAFE_INTEGER)return Number(s);if(r.allowBigInt===!0)return s;throw new Error(`${de} integers outside of the safe integer range are not supported`)}function BT(e,t,r,n){return new Z(E.uint,Lr(e,t+1,n),2)}function LT(e,t,r,n){return new Z(E.uint,jr(e,t+1,n),3)}function jT(e,t,r,n){return new Z(E.uint,kr(e,t+1,n),5)}function kT(e,t,r,n){return new Z(E.uint,Fr(e,t+1,n),9)}function Kr(e,t){return Ot(e,0,t.value)}function Ot(e,t,r){if(r<Ge[0]){let n=Number(r);e.push([t|n])}else if(r<Ge[1]){let n=Number(r);e.push([t|24,n])}else if(r<Ge[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Ge[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<Ge[4]){let i=[t|27,0,0,0,0,0,0,0],s=Number(n&BigInt(4294967295)),o=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=s&255,s=s>>8,i[7]=s&255,s=s>>8,i[6]=s&255,s=s>>8,i[5]=s&255,i[4]=o&255,o=o>>8,i[3]=o&255,o=o>>8,i[2]=o&255,o=o>>8,i[1]=o&255,e.push(i)}else throw new Error(`${de} encountered BigInt larger than allowable range`)}}Kr.encodedSize=function(t){return Ot.encodedSize(t.value)};Ot.encodedSize=function(t){return t<Ge[0]?1:t<Ge[1]?2:t<Ge[2]?3:t<Ge[3]?5:9};Kr.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function FT(e,t,r,n){return new Z(E.negint,-1-Lr(e,t+1,n),2)}function KT(e,t,r,n){return new Z(E.negint,-1-jr(e,t+1,n),3)}function VT(e,t,r,n){return new Z(E.negint,-1-kr(e,t+1,n),5)}var zs=BigInt(-1),Kl=BigInt(1);function zT(e,t,r,n){let i=Fr(e,t+1,n);if(typeof i!="bigint"){let s=-1-i;if(s>=Number.MIN_SAFE_INTEGER)return new Z(E.negint,s,9)}if(n.allowBigInt!==!0)throw new Error(`${de} integers outside of the safe integer range are not supported`);return new Z(E.negint,zs-BigInt(i),9)}function qs(e,t){let r=t.value,n=typeof r=="bigint"?r*zs-Kl:r*-1-1;Ot(e,t.type.majorEncoded,n)}qs.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*zs-Kl:r*-1-1;return n<Ge[0]?1:n<Ge[1]?2:n<Ge[2]?3:n<Ge[3]?5:9};qs.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function Yn(e,t,r,n){gn(e,t,r+n);let i=e.slice(t+r,t+r+n);return new Z(E.bytes,i,r+n)}function qT(e,t,r,n){return Yn(e,t,1,r)}function GT(e,t,r,n){return Yn(e,t,2,Lr(e,t+1,n))}function WT(e,t,r,n){return Yn(e,t,3,jr(e,t+1,n))}function HT(e,t,r,n){return Yn(e,t,5,kr(e,t+1,n))}function JT(e,t,r,n){let i=Fr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${de} 64-bit integer bytes lengths not supported`);return Yn(e,t,9,i)}function Wi(e){return e.encodedBytes===void 0&&(e.encodedBytes=E.equals(e.type,E.string)?jl(e.value):e.value),e.encodedBytes}function go(e,t){let r=Wi(t);Ot(e,t.type.majorEncoded,r.length),e.push(r)}go.encodedSize=function(t){let r=Wi(t);return Ot.encodedSize(r.length)+r.length};go.compareTokens=function(t,r){return XT(Wi(t),Wi(r))};function XT(e,t){return e.length<t.length?-1:e.length>t.length?1:kl(e,t)}var mc=new TextDecoder,YT=32;function QT(e,t,r){if(r-t<YT){let i="";for(let s=t;s<r;s++){let o=e[s];if(o&128)return mc.decode(e.subarray(t,r));i+=String.fromCharCode(o)}return i}return mc.decode(e.subarray(t,r))}function Qn(e,t,r,n,i){let s=r+n;gn(e,t,s);let o=new Z(E.string,QT(e,t+r,t+s),s);return i.retainStringBytes===!0&&(o.byteValue=e.slice(t+r,t+s)),o}function ZT(e,t,r,n){return Qn(e,t,1,r,n)}function e0(e,t,r,n){return Qn(e,t,2,Lr(e,t+1,n),n)}function t0(e,t,r,n){return Qn(e,t,3,jr(e,t+1,n),n)}function r0(e,t,r,n){return Qn(e,t,5,kr(e,t+1,n),n)}function n0(e,t,r,n){let i=Fr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${de} 64-bit integer string lengths not supported`);return Qn(e,t,9,i,n)}var i0=go;function mn(e,t,r,n){return new Z(E.array,n,r)}function o0(e,t,r,n){return mn(e,t,1,r)}function s0(e,t,r,n){return mn(e,t,2,Lr(e,t+1,n))}function a0(e,t,r,n){return mn(e,t,3,jr(e,t+1,n))}function u0(e,t,r,n){return mn(e,t,5,kr(e,t+1,n))}function c0(e,t,r,n){let i=Fr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${de} 64-bit integer array lengths not supported`);return mn(e,t,9,i)}function l0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${de} indefinite length items not allowed`);return mn(e,t,1,1/0)}function Gs(e,t){Ot(e,E.array.majorEncoded,t.value)}Gs.compareTokens=Kr.compareTokens;Gs.encodedSize=function(t){return Ot.encodedSize(t.value)};function vn(e,t,r,n){return new Z(E.map,n,r)}function f0(e,t,r,n){return vn(e,t,1,r)}function d0(e,t,r,n){return vn(e,t,2,Lr(e,t+1,n))}function p0(e,t,r,n){return vn(e,t,3,jr(e,t+1,n))}function h0(e,t,r,n){return vn(e,t,5,kr(e,t+1,n))}function y0(e,t,r,n){let i=Fr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${de} 64-bit integer map lengths not supported`);return vn(e,t,9,i)}function g0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${de} indefinite length items not allowed`);return vn(e,t,1,1/0)}function Ws(e,t){Ot(e,E.map.majorEncoded,t.value)}Ws.compareTokens=Kr.compareTokens;Ws.encodedSize=function(t){return Ot.encodedSize(t.value)};function m0(e,t,r,n){return new Z(E.tag,r,1)}function v0(e,t,r,n){return new Z(E.tag,Lr(e,t+1,n),2)}function b0(e,t,r,n){return new Z(E.tag,jr(e,t+1,n),3)}function _0(e,t,r,n){return new Z(E.tag,kr(e,t+1,n),5)}function w0(e,t,r,n){return new Z(E.tag,Fr(e,t+1,n),9)}function Hs(e,t){Ot(e,E.tag.majorEncoded,t.value)}Hs.compareTokens=Kr.compareTokens;Hs.encodedSize=function(t){return Ot.encodedSize(t.value)};var Vl=20,zl=21,ql=22,Gl=23;function T0(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${de} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new Z(E.null,null,1):new Z(E.undefined,void 0,1)}function A0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${de} indefinite length items not allowed`);return new Z(E.break,void 0,1)}function Js(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${de} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${de} Infinity values are not supported`)}return new Z(E.float,e,t)}function O0(e,t,r,n){return Js(Ys(e,t+1),3,n)}function I0(e,t,r,n){return Js(Qs(e,t+1),5,n)}function E0(e,t,r,n){return Js(Xl(e,t+1),9,n)}function Xs(e,t,r){let n=t.value;if(n===!1)e.push([E.float.majorEncoded|Vl]);else if(n===!0)e.push([E.float.majorEncoded|zl]);else if(n===null)e.push([E.float.majorEncoded|ql]);else if(n===void 0)e.push([E.float.majorEncoded|Gl]);else{let i,s=!1;(!r||r.float64!==!0)&&(Hl(n),i=Ys(Ut,1),n===i||Number.isNaN(n)?(Ut[0]=249,e.push(Ut.slice(0,3)),s=!0):(Jl(n),i=Qs(Ut,1),n===i&&(Ut[0]=250,e.push(Ut.slice(0,5)),s=!0))),s||(S0(n),i=Xl(Ut,1),Ut[0]=251,e.push(Ut.slice(0,9)))}}Xs.encodedSize=function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){Hl(n);let i=Ys(Ut,1);if(n===i||Number.isNaN(n))return 3;if(Jl(n),i=Qs(Ut,1),n===i)return 5}return 9};var Wl=new ArrayBuffer(9),Tt=new DataView(Wl,1),Ut=new Uint8Array(Wl,0);function Hl(e){if(e===1/0)Tt.setUint16(0,31744,!1);else if(e===-1/0)Tt.setUint16(0,64512,!1);else if(Number.isNaN(e))Tt.setUint16(0,32256,!1);else{Tt.setFloat32(0,e);let t=Tt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Tt.setUint16(0,31744,!1);else if(r===0)Tt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Tt.setUint16(0,0):i<-14?Tt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Tt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Ys(e,t){if(e.length-t<2)throw new Error(`${de} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,i=r&1023,s;return n===0?s=i*2**-24:n!==31?s=(i+1024)*2**(n-25):s=i===0?1/0:NaN,r&32768?-s:s}function Jl(e){Tt.setFloat32(0,e,!1)}function Qs(e,t){if(e.length-t<4)throw new Error(`${de} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function S0(e){Tt.setFloat64(0,e,!1)}function Xl(e,t){if(e.length-t<8)throw new Error(`${de} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Xs.compareTokens=Kr.compareTokens;function Te(e,t,r){throw new Error(`${de} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function mo(e){return()=>{throw new Error(`${de} ${e}`)}}var oe=[];for(let e=0;e<=23;e++)oe[e]=Te;oe[24]=BT;oe[25]=LT;oe[26]=jT;oe[27]=kT;oe[28]=Te;oe[29]=Te;oe[30]=Te;oe[31]=Te;for(let e=32;e<=55;e++)oe[e]=Te;oe[56]=FT;oe[57]=KT;oe[58]=VT;oe[59]=zT;oe[60]=Te;oe[61]=Te;oe[62]=Te;oe[63]=Te;for(let e=64;e<=87;e++)oe[e]=qT;oe[88]=GT;oe[89]=WT;oe[90]=HT;oe[91]=JT;oe[92]=Te;oe[93]=Te;oe[94]=Te;oe[95]=mo("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)oe[e]=ZT;oe[120]=e0;oe[121]=t0;oe[122]=r0;oe[123]=n0;oe[124]=Te;oe[125]=Te;oe[126]=Te;oe[127]=mo("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)oe[e]=o0;oe[152]=s0;oe[153]=a0;oe[154]=u0;oe[155]=c0;oe[156]=Te;oe[157]=Te;oe[158]=Te;oe[159]=l0;for(let e=160;e<=183;e++)oe[e]=f0;oe[184]=d0;oe[185]=p0;oe[186]=h0;oe[187]=y0;oe[188]=Te;oe[189]=Te;oe[190]=Te;oe[191]=g0;for(let e=192;e<=215;e++)oe[e]=m0;oe[216]=v0;oe[217]=b0;oe[218]=_0;oe[219]=w0;oe[220]=Te;oe[221]=Te;oe[222]=Te;oe[223]=Te;for(let e=224;e<=243;e++)oe[e]=mo("simple values are not supported");oe[244]=Te;oe[245]=Te;oe[246]=Te;oe[247]=T0;oe[248]=mo("simple values are not supported");oe[249]=O0;oe[250]=I0;oe[251]=E0;oe[252]=Te;oe[253]=Te;oe[254]=Te;oe[255]=A0;var Vt=[];for(let e=0;e<24;e++)Vt[e]=new Z(E.uint,e,1);for(let e=-1;e>=-24;e--)Vt[31-e]=new Z(E.negint,e,1);Vt[64]=new Z(E.bytes,new Uint8Array(0),1);Vt[96]=new Z(E.string,"",1);Vt[128]=new Z(E.array,0,1);Vt[160]=new Z(E.map,0,1);Vt[244]=new Z(E.false,!1,1);Vt[245]=new Z(E.true,!0,1);Vt[246]=new Z(E.null,null,1);function R0(e){switch(e.type){case E.false:return Yt([244]);case E.true:return Yt([245]);case E.null:return Yt([246]);case E.bytes:return e.value.length?void 0:Yt([64]);case E.string:return e.value===""?Yt([96]):void 0;case E.array:return e.value===0?Yt([128]):void 0;case E.map:return e.value===0?Yt([160]):void 0;case E.uint:return e.value<24?Yt([Number(e.value)]):void 0;case E.negint:if(e.value>=-24)return Yt([31-Number(e.value)])}}var P0=Object.freeze({float64:!0,mapSorter:x0,quickEncodeToken:R0});function Zs(){let e=[];return e[E.uint.major]=Kr,e[E.negint.major]=qs,e[E.bytes.major]=go,e[E.string.major]=i0,e[E.array.major]=Gs,e[E.map.major]=Ws,e[E.tag.major]=Hs,e[E.float.major]=Xs,e}var $0=Zs(),N0=new Fl,vc=class Yl{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${Ur} object contains circular references`);return new Yl(r,t)}},cr={null:new Z(E.null,null),undefined:new Z(E.undefined,void 0),true:new Z(E.true,!0),false:new Z(E.false,!1),emptyArray:new Z(E.array,0),emptyMap:new Z(E.map,0)},yr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new Z(E.float,e):e>=0?new Z(E.uint,e):new Z(E.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new Z(E.uint,e):new Z(E.negint,e)},Uint8Array(e,t,r,n){return new Z(E.bytes,e)},string(e,t,r,n){return new Z(E.string,e)},boolean(e,t,r,n){return e?cr.true:cr.false},null(e,t,r,n){return cr.null},undefined(e,t,r,n){return cr.undefined},ArrayBuffer(e,t,r,n){return new Z(E.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new Z(E.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[cr.emptyArray,new Z(E.break)]:cr.emptyArray;n=vc.createCheck(n,e);let i=[],s=0;for(let o of e)i[s++]=xi(o,r,n);return r.addBreakTokens?[new Z(E.array,e.length),i,new Z(E.break)]:[new Z(E.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",s=i?e.keys():Object.keys(e),o=i?e.size:s.length,a;if(o){a=new Array(o),n=vc.createCheck(n,e);let l=!i&&r.ignoreUndefinedProperties,c=0;for(let d of s){let g=i?e.get(d):e[d];l&&g===void 0||(a[c++]=[xi(d,r,n),xi(g,r,n)])}c<o&&(a.length=c)}return a?.length?(C0(a,r),r.addBreakTokens?[new Z(E.map,a.length),a,new Z(E.break)]:[new Z(E.map,a.length),a]):r.addBreakTokens===!0?[cr.emptyMap,new Z(E.break)]:cr.emptyMap}};yr.Map=yr.Object;yr.Buffer=yr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))yr[`${e}Array`]=yr.DataView;function xi(e,t={},r){let n=ET(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||yr[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let s=yr[n];if(!s)throw new Error(`${Ur} unsupported type: ${n}`);return s(e,n,t,r)}function C0(e,t){t.mapSorter&&e.sort(t.mapSorter)}function x0(e,t){if(e[0]instanceof Z&&t[0]instanceof Z){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=bc(r.value)),n._keyBytes||(n._keyBytes=bc(n.value)),kl(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function bc(e){return Zl(e,$0,P0)}function Ql(e,t,r,n){if(Array.isArray(t))for(let i of t)Ql(e,i,r,n);else r[t.type.major](e,t,n)}var lE=E.uint.majorEncoded,fE=E.negint.majorEncoded,dE=E.bytes.majorEncoded,pE=E.string.majorEncoded,hE=E.array.majorEncoded,yE=E.float.majorEncoded|Vl,gE=E.float.majorEncoded|zl,mE=E.float.majorEncoded|ql,vE=E.float.majorEncoded|Gl,bE=BigInt(-1),_E=BigInt(1);function Zl(e,t,r,n){let i=n instanceof Uint8Array,s=i?new DT(n):N0,o=xi(e,r);if(!Array.isArray(o)&&r.quickEncodeToken){let a=r.quickEncodeToken(o);if(a)return i?(s.push(a),s.toBytes()):a;let l=t[o.type.major];if(l.encodedSize){let c=l.encodedSize(o,r);if(i||(s=new Fl(c)),l(s,o,r),s.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${o} was wrong`);return i?s.toBytes():yo(s.chunks[0])}}return s.reset(),Ql(s,o,t,r),s.toBytes(!0)}var U0={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},M0=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=Vt[e];if(t===void 0){let r=oe[e];if(!r)throw new Error(`${de} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);let n=e&31;t=r(this.data,this._pos,n,this.options)}return this._pos+=t.encodedLength,t}},qn=Symbol.for("DONE"),vo=Symbol.for("BREAK");function D0(e,t,r){let n=[];for(let i=0;i<e.value;i++){let s=Gn(t,r);if(s===vo){if(e.value===1/0)break;throw new Error(`${de} got unexpected break to lengthed array`)}if(s===qn)throw new Error(`${de} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=s}return n}function B0(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,s=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<e.value;a++){let l=Gn(t,r);if(l===vo){if(e.value===1/0)break;throw new Error(`${de} got unexpected break to lengthed map`)}if(l===qn)throw new Error(`${de} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(!n&&typeof l!="string")throw new Error(`${de} non-string keys not supported (got ${typeof l})`);if(i&&(n&&o.has(l)||!n&&Object.hasOwn(s,l)))throw new Error(`${de} found repeat map key "${l}"`);let c=Gn(t,r);if(c===qn)throw new Error(`${de} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?o.set(l,c):s[l]=c}return n?o:s}function Gn(e,t){if(e.done())return qn;let r=e.next();if(E.equals(r.type,E.break))return vo;if(r.type.terminal)return r.value;if(E.equals(r.type,E.array))return D0(r,e,t);if(E.equals(r.type,E.map))return B0(r,e,t);if(E.equals(r.type,E.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Gn(e,t);return t.tags[r.value](n)}throw new Error(`${de} tag not supported (${r.value})`)}throw new Error("unsupported")}function L0(e,t){if(!(e instanceof Uint8Array))throw new Error(`${de} data to decode must be a Uint8Array`);t=Object.assign({},U0,t);let r=yo(e),n=t.tokenizer||new M0(r,t),i=Gn(n,t);if(i===qn)throw new Error(`${de} did not find any content to decode`);if(i===vo)throw new Error(`${de} got unexpected break`);return[i,e.subarray(n.pos())]}function ef(e,t){let[r,n]=L0(e,t);if(n.length>0)throw new Error(`${de} too many terminals, data makes no sense`);return r}var j0=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(E.equals(t.type,E.array)&&(t.elements++,t.elements!==1&&e.push([44])),E.equals(t.type,E.map)&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[E.uint.major](e,t){this.prefix(e);let r=String(t.value),n=[];for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);e.push(n)}[E.negint.major](e,t){this[E.uint.major](e,t)}[E.bytes.major](e,t){throw new Error(`${Ur} unsupported type: Uint8Array`)}[E.string.major](e,t){this.prefix(e);let r=jl(JSON.stringify(t.value));e.push(r.length>32?yo(r):r)}[E.array.major](e,t){this.prefix(e),this.inRecursive.push({type:E.array,elements:0}),e.push([91])}[E.map.major](e,t){this.prefix(e),this.inRecursive.push({type:E.map,elements:0}),e.push([123])}[E.tag.major](e,t){}[E.float.major](e,t){if(t.type.name==="break"){let s=this.inRecursive.pop();if(s){if(E.equals(s.type,E.array))e.push([93]);else if(E.equals(s.type,E.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(`${Ur} 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 r=String(t.value),n=[],i=!1;for(let s=0;s<r.length;s++)n[s]=r.charCodeAt(s),!i&&(n[s]===46||n[s]===101||n[s]===69)&&(i=!0);i||(n.push(46),n.push(48)),e.push(n)}};function k0(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${Ur} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==E.string||n.type!==E.string)throw new Error(`${Ur} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${Ur} unexpected duplicate map keys, this is not supported`)}var F0={addBreakTokens:!0,mapSorter:k0};function K0(e,t){return t=Object.assign({},F0,t),Zl(e,new j0,t)}var tf=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(`${de} 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(`${de} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=o=>{for(;!this.done();){let a=this.ch();if(o.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++,r=!0;else return new Z(E.uint,0,this._pos-e);if(n([48,49,50,51,52,53,54,55,56,57]),t&&this._pos===e+1)throw new Error(`${de} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${de} unexpected token at position ${this._pos}`);r=!0,this._pos++,n([48,49,50,51,52,53,54,55,56,57])}!this.done()&&(this.ch()===101||this.ch()===69)&&(r=!0,this._pos++,!this.done()&&(this.ch()===43||this.ch()===45)&&this._pos++,n([48,49,50,51,52,53,54,55,56,57]));let i=String.fromCharCode.apply(null,this.data.subarray(e,this._pos)),s=parseFloat(i);return r?new Z(E.float,s,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(s)?new Z(s>=0?E.uint:E.negint,s,this._pos-e):new Z(s>=0?E.uint:E.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${de} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,s=0;i<this.data.length&&s<65536;i++,s++){let o=this.data[i];if(o===92||o<32||o>=128)break;if(o===34){let a=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new Z(E.string,a,s)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${de} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let s=0;s<4;s++){let o=this.ch();if(o>=48&&o<=57)o-=48;else if(o>=97&&o<=102)o=o-97+10;else if(o>=65&&o<=70)o=o-65+10;else throw new Error(`${de} unexpected unicode escape character at position ${this._pos}`);i=i*16+o,this._pos++}return i},n=()=>{let i=this.ch(),s=null,o=i>239?4:i>223?3:i>191?2:1;if(this._pos+o>this.data.length)throw new Error(`${de} unexpected unicode sequence at position ${this._pos}`);let a,l,c,d;switch(o){case 1:i<128&&(s=i);break;case 2:a=this.data[this._pos+1],(a&192)===128&&(d=(i&31)<<6|a&63,d>127&&(s=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)&&(s=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&&(s=d))}s===null?(s=65533,o=1):s>65535&&(s-=65536,t.push(s>>>10&1023|55296),s=56320|s&1023),t.push(s),this._pos+=o};for(;!this.done();){let i=this.ch(),s;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${de} unexpected string termination at position ${this._pos}`);switch(s=this.ch(),this._pos++,s){case 34:case 39:case 92:case 47:t.push(s);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(r());break;default:throw new Error(`${de} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new Z(E.string,UT(t),this._pos-e);default:if(i<32)throw new Error(`${de} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${de} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new Z(E.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new Z(E.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new Z(E.null,null,4);case 102:return this.expect([102,97,108,115,101]),new Z(E.false,!1,5);case 116:return this.expect([116,114,117,101]),new Z(E.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(`${de} 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 Z(E.break,void 0,1);if(this.ch()!==44)throw new Error(`${de} 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 Z(E.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 Z(E.break,void 0,1);if(this.ch()!==44)throw new Error(`${de} 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 Z(E.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${de} 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(`${de} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function V0(e,t){return t=Object.assign({tokenizer:new tf(e,t)},t),ef(e,t)}var wE=new Uint8Array(0);function z0(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function ea(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 q0(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=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(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";for(var K=0,H=0,F=0,j=R.length;F!==j&&R[F]===0;)F++,K++;for(var V=(j-F)*d+1>>>0,G=new Uint8Array(V);F!==j;){for(var k=R[F],Q=0,q=V-1;(k!==0||Q<H)&&q!==-1;q--,Q++)k+=256*G[q]>>>0,G[q]=k%a>>>0,k=k/a>>>0;if(k!==0)throw new Error("Non-zero carry");H=Q,F++}for(var ce=V-H;ce!==V&&G[ce]===0;)ce++;for(var U=l.repeat(K);ce<V;++ce)U+=e.charAt(G[ce]);return U}function x(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;var K=0;if(R[K]!==" "){for(var H=0,F=0;R[K]===l;)H++,K++;for(var j=(R.length-K)*c+1>>>0,V=new Uint8Array(j);R[K];){var G=r[R.charCodeAt(K)];if(G===255)return;for(var k=0,Q=j-1;(G!==0||k<F)&&Q!==-1;Q--,k++)G+=a*V[Q]>>>0,V[Q]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");F=k,K++}if(R[K]!==" "){for(var q=j-F;q!==j&&V[q]===0;)q++;for(var ce=new Uint8Array(H+(j-q)),U=H;q!==j;)ce[U++]=V[q++];return ce}}}function S(R){var K=x(R);if(K)return K;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:x,decode:S}}var G0=q0,W0=G0,H0=W0,J0=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},X0=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){this.name=e,this.prefix=t;let n=t.codePointAt(0);if(n===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=r}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 rf(this,e)}},Y0=class{decoders;constructor(e){this.decoders=e}or(e){return rf(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function rf(e,t){return new Y0({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Q0=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new J0(e,t,r),this.decoder=new X0(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function nf({name:e,prefix:t,encode:r,decode:n}){return new Q0(e,t,r,n)}function bo({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=H0(r,e);return nf({prefix:t,name:e,encode:n,decode:s=>ea(i(s))})}function Z0(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let s=new Uint8Array(i*r/8|0),o=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-${n} character`);a=a<<r|d,o+=r,o>=8&&(o-=8,s[l++]=255&a>>o)}if(o>=r||255&a<<8-o)throw new SyntaxError("Unexpected end of data");return s}function eA(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,s="",o=0,a=0;for(let l=0;l<e.length;++l)for(a=a<<8|e[l],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o!==0&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s}function tA(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function ct({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=tA(n);return nf({prefix:t,name:e,encode(s){return eA(s,n,r)},decode(s){return Z0(s,i,r,e)}})}var Ui=ct({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),TE=ct({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),AE=ct({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),OE=ct({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),IE=ct({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),EE=ct({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),SE=ct({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),RE=ct({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),PE=ct({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),ds=bo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$E=bo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),dr=bo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),NE=bo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),rA=of,_c=128,nA=127,iA=~nA,oA=Math.pow(2,31);function of(e,t,r){t=t||[],r=r||0;for(var n=r;e>=oA;)t[r++]=e&255|_c,e/=128;for(;e&iA;)t[r++]=e&255|_c,e>>>=7;return t[r]=e|0,of.bytes=r-n+1,t}var sA=_s,aA=128,wc=127;function _s(e,n){var r=0,n=n||0,i=0,s=n,o,a=e.length;do{if(s>=a)throw _s.bytes=0,new RangeError("Could not decode varint");o=e[s++],r+=i<28?(o&wc)<<i:(o&wc)*Math.pow(2,i),i+=7}while(o>=aA);return _s.bytes=s-n,r}var uA=Math.pow(2,7),cA=Math.pow(2,14),lA=Math.pow(2,21),fA=Math.pow(2,28),dA=Math.pow(2,35),pA=Math.pow(2,42),hA=Math.pow(2,49),yA=Math.pow(2,56),gA=Math.pow(2,63),mA=function(e){return e<uA?1:e<cA?2:e<lA?3:e<fA?4:e<dA?5:e<pA?6:e<hA?7:e<yA?8:e<gA?9:10},vA={encode:rA,decode:sA,encodingLength:mA},bA=vA,Hi=bA;function ws(e,t=0){return[Hi.decode(e,t),Hi.decode.bytes]}function Ji(e,t,r=0){return Hi.encode(e,t,r),t}function Xi(e){return Hi.encodingLength(e)}function _A(e,t){let r=t.byteLength,n=Xi(e),i=n+Xi(r),s=new Uint8Array(i+r);return Ji(e,s,0),Ji(r,s,n),s.set(t,i),new ta(e,r,t,s)}function sf(e){let t=ea(e),[r,n]=ws(t),[i,s]=ws(t.subarray(n)),o=t.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new ta(r,i,o,t)}function wA(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&z0(e.bytes,r.bytes)}}var ta=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Tc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return AA(r,Ts(e),t??dr.encoder);default:return OA(r,Ts(e),t??Ui.encoder)}}var Ac=new WeakMap;function Ts(e){let t=Ac.get(e);if(t==null){let r=new Map;return Ac.set(e,r),r}return t}var Zn=class Je{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,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:r}=this;if(t!==Dn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==IA)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Je.createV0(r)}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:r}=this.multihash,n=_A(t,r);return Je.createV1(this.code,n)}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 Je.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&wA(t.multihash,n.multihash)}toString(t){return Tc(this,t)}toJSON(){return{"/":Tc(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 r=t;if(r instanceof Je)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:s,bytes:o}=r;return new Je(n,i,s,o??Oc(n,i,s.bytes))}else if(r[EA]===!0){let{version:n,multihash:i,code:s}=r,o=sf(i);return Je.create(n,s,o)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Dn)throw new Error(`Version 0 CID must use dag-pb (code: ${Dn}) block encoding`);return new Je(t,r,n,n.bytes)}case 1:{let i=Oc(t,r,n.bytes);return new Je(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return Je.create(0,Dn,t)}static createV1(t,r){return Je.create(1,t,r)}static decode(t){let[r,n]=Je.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=Je.inspectBytes(t),n=r.size-r.multihashSize,i=ea(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new ta(r.multihashCode,r.digestSize,s,i);return[r.version===0?Je.createV0(o):Je.createV1(r.codec,o),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[g,x]=ws(t.subarray(r));return r+=x,g},i=n(),s=Dn;if(i===18?(i=0,r=0):s=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),l=n(),c=r+l,d=c-o;return{version:i,codec:s,multihashCode:a,digestSize:l,multihashSize:d,size:c}}static parse(t,r){let[n,i]=TA(t,r),s=Je.decode(i);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ts(s).set(n,t),s}};function TA(e,t){switch(e[0]){case"Q":{let r=t??dr;return[dr.prefix,r.decode(`${dr.prefix}${e}`)]}case dr.prefix:{let r=t??dr;return[dr.prefix,r.decode(e)]}case Ui.prefix:{let r=t??Ui;return[Ui.prefix,r.decode(e)]}case ds.prefix:{let r=t??ds;return[ds.prefix,r.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 AA(e,t,r){let{prefix:n}=r;if(n!==dr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let s=r.encode(e).slice(1);return t.set(n,s),s}else return i}function OA(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let s=r.encode(e);return t.set(n,s),s}else return i}var Dn=112,IA=18;function Oc(e,t,r){let n=Xi(e),i=n+Xi(t),s=new Uint8Array(i+r.byteLength);return Ji(e,s,0),Ji(t,s,n),s.set(r,i),s}var EA=Symbol.for("@ipld/js-cid/CID"),af=ct({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),CE=ct({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),xE=ct({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),UE=ct({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function SA(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function RA(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Zn.asCID(e);if(!t)return null;let r=t.toString();return[new Z(E.map,1/0,1),new Z(E.string,"/",1),new Z(E.string,r,r.length),new Z(E.break,void 0,1)]}function Yi(e){let t=af.encode(e).slice(1);return[new Z(E.map,1/0,1),new Z(E.string,"/",1),new Z(E.map,1/0,1),new Z(E.string,"bytes",5),new Z(E.string,t,t.length),new Z(E.break,void 0,1),new Z(E.break,void 0,1)]}function xt(e){return Yi(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function PA(e){return Yi(new Uint8Array(e))}function $A(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function NA(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 CA={typeEncoders:{Object:RA,Buffer:Yi,Uint8Array:Yi,Int8Array:xt,Uint16Array:xt,Int16Array:xt,Uint32Array:xt,Int32Array:xt,Float32Array:xt,Float64Array:xt,Uint8ClampedArray:xt,BigInt64Array:xt,BigUint64Array:xt,DataView:xt,ArrayBuffer:PA,undefined:$A,number:NA}},xA=class extends tf{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===E.map){let t=this._next();if(t.type===E.string&&t.value==="/"){let r=this._next();if(r.type===E.string){if(this._next().type!==E.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new Z(E.tag,42,0)}if(r.type===E.map){let n=this._next();if(n.type===E.string&&n.value==="bytes"){let i=this._next();if(i.type===E.string){for(let o=0;o<2;o++)if(this._next().type!==E.break)throw new Error("Invalid encoded Bytes form");let s=af.decode(`m${i.value}`);return new Z(E.bytes,s,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},As={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};As.tags[42]=Zn.parse;var UA="dag-json",uf=297,ra=e=>K0(e,CA),na=e=>{let t=SA(e),r=Object.assign(As,{tokenizer:new xA(t,As)});return V0(t,r)},Ic=e=>MA.decode(ra(e)),MA=new TextDecoder,DA=e=>na(BA.encode(e)),BA=new TextEncoder;function LA(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function cf(e,t,r=""){let n=LA(e),i=e?.length,s=t!==void 0;if(!n||s&&i!==t){let o=r&&`"${r}" `,a=s?` of length ${t}`:"",l=n?`length=${i}`:`type=${typeof e}`;throw new Error(o+"expected Uint8Array"+a+", got "+l)}return e}function Ec(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 jA(e,t){cf(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function Os(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ps(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function kt(e,t){return e<<32-t|e>>>t}function kA(e,t={}){let r=(i,s)=>e(s).update(i).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=i=>e(i),Object.assign(r,t),Object.freeze(r)}var FA=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function KA(e,t,r){return e&t^~e&r}function VA(e,t,r){return e&t^e&r^t&r}var zA=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=ps(this.buffer)}update(e){Ec(this),cf(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let s=0;s<i;){let o=Math.min(n-this.pos,i-s);if(o===n){let a=ps(e);for(;n<=i-s;s+=n)this.process(a,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ec(this),jA(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:s}=this;t[s++]=128,Os(this.buffer.subarray(s)),this.padOffset>n-s&&(this.process(r,0),s=0);for(let d=s;d<n;d++)t[d]=0;r.setBigUint64(n-8,BigInt(this.length*8),i),this.process(r,0);let o=ps(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++)o.setUint32(4*d,c[d],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:o}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},lr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qA=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]),fr=new Uint32Array(64),GA=class extends zA{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:o,H:a}=this;return[e,t,r,n,i,s,o,a]}set(e,t,r,n,i,s,o,a){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=s|0,this.G=o|0,this.H=a|0}process(e,t){for(let d=0;d<16;d++,t+=4)fr[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let g=fr[d-15],x=fr[d-2],S=kt(g,7)^kt(g,18)^g>>>3,R=kt(x,17)^kt(x,19)^x>>>10;fr[d]=R+fr[d-7]+S+fr[d-16]|0}let{A:r,B:n,C:i,D:s,E:o,F:a,G:l,H:c}=this;for(let d=0;d<64;d++){let g=kt(o,6)^kt(o,11)^kt(o,25),x=c+g+KA(o,a,l)+qA[d]+fr[d]|0,R=(kt(r,2)^kt(r,13)^kt(r,22))+VA(r,n,i)|0;c=l,l=a,a=o,o=s+x|0,s=i,i=n,n=r,r=x+R|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,s,o,a,l,c)}roundClean(){Os(fr)}destroy(){this.set(0,0,0,0,0,0,0,0),Os(this.buffer)}},WA=class extends GA{A=lr[0]|0;B=lr[1]|0;C=lr[2]|0;D=lr[3]|0;E=lr[4]|0;F=lr[5]|0;G=lr[6]|0;H=lr[7]|0;constructor(){super(32)}},HA=kA(()=>new WA,FA(1)),ME=new Uint8Array(0);function JA(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function ia(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 XA(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=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(R){if(R instanceof Uint8Array||(ArrayBuffer.isView(R)?R=new Uint8Array(R.buffer,R.byteOffset,R.byteLength):Array.isArray(R)&&(R=Uint8Array.from(R))),!(R instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(R.length===0)return"";for(var K=0,H=0,F=0,j=R.length;F!==j&&R[F]===0;)F++,K++;for(var V=(j-F)*d+1>>>0,G=new Uint8Array(V);F!==j;){for(var k=R[F],Q=0,q=V-1;(k!==0||Q<H)&&q!==-1;q--,Q++)k+=256*G[q]>>>0,G[q]=k%a>>>0,k=k/a>>>0;if(k!==0)throw new Error("Non-zero carry");H=Q,F++}for(var ce=V-H;ce!==V&&G[ce]===0;)ce++;for(var U=l.repeat(K);ce<V;++ce)U+=e.charAt(G[ce]);return U}function x(R){if(typeof R!="string")throw new TypeError("Expected String");if(R.length===0)return new Uint8Array;var K=0;if(R[K]!==" "){for(var H=0,F=0;R[K]===l;)H++,K++;for(var j=(R.length-K)*c+1>>>0,V=new Uint8Array(j);R[K];){var G=r[R.charCodeAt(K)];if(G===255)return;for(var k=0,Q=j-1;(G!==0||k<F)&&Q!==-1;Q--,k++)G+=a*V[Q]>>>0,V[Q]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");F=k,K++}if(R[K]!==" "){for(var q=j-F;q!==j&&V[q]===0;)q++;for(var ce=new Uint8Array(H+(j-q)),U=H;q!==j;)ce[U++]=V[q++];return ce}}}function S(R){var K=x(R);if(K)return K;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:x,decode:S}}var YA=XA,QA=YA,ZA=QA,eO=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},tO=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){this.name=e,this.prefix=t;let n=t.codePointAt(0);if(n===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=r}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 lf(this,e)}},rO=class{decoders;constructor(e){this.decoders=e}or(e){return lf(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function lf(e,t){return new rO({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var nO=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new eO(e,t,r),this.decoder=new tO(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function ff({name:e,prefix:t,encode:r,decode:n}){return new nO(e,t,r,n)}function _o({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=ZA(r,e);return ff({prefix:t,name:e,encode:n,decode:s=>ia(i(s))})}function iO(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let s=new Uint8Array(i*r/8|0),o=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-${n} character`);a=a<<r|d,o+=r,o>=8&&(o-=8,s[l++]=255&a>>o)}if(o>=r||255&a<<8-o)throw new SyntaxError("Unexpected end of data");return s}function oO(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,s="",o=0,a=0;for(let l=0;l<e.length;++l)for(a=a<<8|e[l],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o!==0&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s}function sO(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function er({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=sO(n);return ff({prefix:t,name:e,encode(s){return oO(s,n,r)},decode(s){return iO(s,i,r,e)}})}var Mi=er({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),DE=er({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),BE=er({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),LE=er({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),jE=er({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),kE=er({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),FE=er({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),KE=er({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),VE=er({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),hs=_o({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),zE=_o({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),pr=_o({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),qE=_o({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),df={};No(df,{Digest:()=>wo,create:()=>oa,decode:()=>hf,equals:()=>yf,hasCode:()=>IO});var aO=pf,Sc=128,uO=127,cO=~uO,lO=Math.pow(2,31);function pf(e,t,r){t=t||[],r=r||0;for(var n=r;e>=lO;)t[r++]=e&255|Sc,e/=128;for(;e&cO;)t[r++]=e&255|Sc,e>>>=7;return t[r]=e|0,pf.bytes=r-n+1,t}var fO=Is,dO=128,Rc=127;function Is(e,n){var r=0,n=n||0,i=0,s=n,o,a=e.length;do{if(s>=a)throw Is.bytes=0,new RangeError("Could not decode varint");o=e[s++],r+=i<28?(o&Rc)<<i:(o&Rc)*Math.pow(2,i),i+=7}while(o>=dO);return Is.bytes=s-n,r}var pO=Math.pow(2,7),hO=Math.pow(2,14),yO=Math.pow(2,21),gO=Math.pow(2,28),mO=Math.pow(2,35),vO=Math.pow(2,42),bO=Math.pow(2,49),_O=Math.pow(2,56),wO=Math.pow(2,63),TO=function(e){return e<pO?1:e<hO?2:e<yO?3:e<gO?4:e<mO?5:e<vO?6:e<bO?7:e<_O?8:e<wO?9:10},AO={encode:aO,decode:fO,encodingLength:TO},OO=AO,Qi=OO;function Es(e,t=0){return[Qi.decode(e,t),Qi.decode.bytes]}function Zi(e,t,r=0){return Qi.encode(e,t,r),t}function eo(e){return Qi.encodingLength(e)}function oa(e,t){let r=t.byteLength,n=eo(e),i=n+eo(r),s=new Uint8Array(i+r);return Zi(e,s,0),Zi(r,s,n),s.set(t,i),new wo(e,r,t,s)}function hf(e){let t=ia(e),[r,n]=Es(t),[i,s]=Es(t.subarray(n)),o=t.subarray(n+s);if(o.byteLength!==i)throw new Error("Incorrect length");return new wo(r,i,o,t)}function yf(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&JA(e.bytes,r.bytes)}}var wo=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function IO(e,t){return e.code===t}function Pc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return SO(r,Ss(e),t??pr.encoder);default:return RO(r,Ss(e),t??Mi.encoder)}}var $c=new WeakMap;function Ss(e){let t=$c.get(e);if(t==null){let r=new Map;return $c.set(e,r),r}return t}var gf=class Xe{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,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:r}=this;if(t!==Bn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==PO)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Xe.createV0(r)}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:r}=this.multihash,n=oa(t,r);return Xe.createV1(this.code,n)}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 Xe.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&yf(t.multihash,n.multihash)}toString(t){return Pc(this,t)}toJSON(){return{"/":Pc(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 r=t;if(r instanceof Xe)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:s,bytes:o}=r;return new Xe(n,i,s,o??Nc(n,i,s.bytes))}else if(r[$O]===!0){let{version:n,multihash:i,code:s}=r,o=hf(i);return Xe.create(n,s,o)}else return null}static create(t,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(t){case 0:{if(r!==Bn)throw new Error(`Version 0 CID must use dag-pb (code: ${Bn}) block encoding`);return new Xe(t,r,n,n.bytes)}case 1:{let i=Nc(t,r,n.bytes);return new Xe(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return Xe.create(0,Bn,t)}static createV1(t,r){return Xe.create(1,t,r)}static decode(t){let[r,n]=Xe.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=Xe.inspectBytes(t),n=r.size-r.multihashSize,i=ia(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let s=i.subarray(r.multihashSize-r.digestSize),o=new wo(r.multihashCode,r.digestSize,s,i);return[r.version===0?Xe.createV0(o):Xe.createV1(r.codec,o),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[g,x]=Es(t.subarray(r));return r+=x,g},i=n(),s=Bn;if(i===18?(i=0,r=0):s=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,a=n(),l=n(),c=r+l,d=c-o;return{version:i,codec:s,multihashCode:a,digestSize:l,multihashSize:d,size:c}}static parse(t,r){let[n,i]=EO(t,r),s=Xe.decode(i);if(s.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ss(s).set(n,t),s}};function EO(e,t){switch(e[0]){case"Q":{let r=t??pr;return[pr.prefix,r.decode(`${pr.prefix}${e}`)]}case pr.prefix:{let r=t??pr;return[pr.prefix,r.decode(e)]}case Mi.prefix:{let r=t??Mi;return[Mi.prefix,r.decode(e)]}case hs.prefix:{let r=t??hs;return[hs.prefix,r.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 SO(e,t,r){let{prefix:n}=r;if(n!==pr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let s=r.encode(e).slice(1);return t.set(n,s),s}else return i}function RO(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let s=r.encode(e);return t.set(n,s),s}else return i}var Bn=112,PO=18;function Nc(e,t,r){let n=eo(e),i=n+eo(t),s=new Uint8Array(i+r.byteLength);return Zi(e,s,0),Zi(t,s,n),s.set(r,i),s}var $O=Symbol.for("@ipld/js-cid/CID"),NO=20;function mf({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new CO(e,t,r,n,i)}var CO=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??NO,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 r=this.encode(e);return r instanceof Uint8Array?Cc(r,this.code,t?.truncate):r.then(n=>Cc(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function Cc(e,t,r){if(r!=null&&r!==e.byteLength){if(r>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,r)}return oa(t,e)}var Ve=ft(qt(),1),vf=ft(ph(),1),xc=e=>Ve.Type.Union([e,Ve.Type.Null()]);var bf=/^(k51qz|baguq)[0-9a-z]{56,57}$/,xO=/^[0-9A-Fa-f]{7,8}$/g;Ve.FormatRegistry.Set("EntityID",e=>!!e.match(xO)||!!e.match(bf));var UO=Ve.Type.String(),MO=e=>e?.enc instanceof Uint8Array;Ve.FormatRegistry.Set("CID",e=>!!e.match(bf));var _f=Ve.Type.String({format:"CID"}),DO=/^http([s]?):\/\/.*\..*/;Ve.FormatRegistry.Set("URL",e=>!!e.match(DO));var GE=Ve.Type.String({format:"URL"}),wf=Ve.Type.Object({en:UO,at:Ve.Type.String(),vl:xc(Ve.Type.Union([Ve.Type.String(),Ve.Type.Boolean(),Ve.Type.Number()])),ts:Ve.Type.String(),ag:Ve.Type.String(),pv:xc(_f)}),Uc=vf.TypeCompiler.Compile(wf);var WE=Uc.Check.bind(Uc),BO=Ve.Type.Composite([Ve.Type.Object({cid:_f}),wf]),Rs=vf.TypeCompiler.Compile(BO),LO=e=>Array.from(Rs.Errors(e)),Tf=Rs.Check.bind(Rs);function Af(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var jO=mf({name:"sha2-256",code:18,encode:Af("SHA-256")}),HE=mf({name:"sha2-512",code:19,encode:Af("SHA-512")}),{WARN:Mc,LOG:JE,DEBUG:kO,VERBOSE:Of,ERROR:FO}=Oe.setup(Oe.INFO);function If(e,t=["cid"]){if(!e)throw FO("falsy log",e);let r=e.cid;if(MO(e))return r||(r=sa(Ef(e).bytes).toString()),Mc("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,s]of Object.entries(e))s===void 0&&(Mc(`log.${i} is undefined, which is not allowed - encoding as null`,e),s=null),t.includes(i)?Of("excluding app log",{key:i,val:s}):n[i]=s;return{log:n,cid:r}}function KO(e){return sa(VO(e).bytes)}function VO(e){return Ef(If(e)?.log)}function sa(e){let t=HA(e),r=df.create(jO.code,t),n=gf.create(1,uf,r);return Of("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Ef(e){kO("[encodeBlock]",e);let t=ra(e);return{bytes:t,cid:sa(t)}}function Dc(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 zO(e,t){let r=Dc(e),n=Dc(t);return+r<+n}var{WARN:qO,LOG:XE,DEBUG:YE,VERBOSE:to,ERROR:ro}=Oe.setup(Oe.INFO),GO=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Sf=(e,t,r)=>Be.structural(dc(t,e),dc(r,e)),WO=(e,t,r="asc")=>GO(e.ts,t.ts,r),QE=oT(Sf,["en","at"]);function Wn(e,t="asc"){return e.sort((r,n)=>WO(r,n,t))}var HO=(e,t)=>zO(new Date(e.ts),new Date(t.ts));var JO=()=>{qO("[removeDuplicateAppLogs] mode not set; pass 'safety' or 'cleanup' for optimal behavior")},Bc=e=>{let t=new Map,r=to.isEnabled;for(let n of e){if(!n)throw ro("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!n.cid)throw ro("applog with missing CID",n),new Error("applog with missing CID");let i=n.cid,s=t.get(i);s?r&&to("Skipping duplicate applog:",[s,n]):t.set(i,n)}return Array.from(t.values())},XO=e=>{let t=new Set,r=to.isEnabled,n=r?new Map:null,i=null,s=0;for(let o of e){if(!o)throw ro("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!o.cid)throw ro("applog with missing CID",o),new Error("applog with missing CID");let a=o.cid;t.has(a)?(i||(i=e.slice(0,s)),r&&to("Skipping duplicate applog:",[n?.get(a),o])):(t.add(a),n&&n.set(a,o),i&&i.push(o)),s++}return i??e},Rf=(e,t)=>t?t==="safety"?XO(e):Bc(e):(JO(),Bc(e));function YO(e){return typeof e=="string"&&e.startsWith("?")}function QO(e){return e.slice(1)}function aa(e,t){let r={},n={};for(let[i,s]of Object.entries(e))if(YO(s)){let o=QO(s),a=t[o];a?n[i]=a:r[i]=o}else n[i]=s;return[n,r]}function ZO(e,t,r){let n;if(t){let i=typeof t;i==="string"?n=t===r:i==="function"?n=t(r):typeof t.has=="function"?n=t.has(r):Array.isArray(t)&&!Array.isArray(r)?n=t.includes(r):n=t===r}else n=t===r;return e.charAt(0)==="!"?!n:n}var Pf=function(t){for(var r=0,n=0,i=t.length;n<i;n++)r+=t[n];return r},Lc=function(t){return Pf(t)/t.length},At={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return At.max(e)-At.min(e)},midrange:function(e){return At.range(e)/2},sum:Pf,mean:Lc,average:Lc,median:function(e){e.sort(function(r,n){return r-n});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={},r=0,n=[];return e.forEach(function(i){t[i]?t[i]++:t[i]=1,t[i]>r?(n=[i],r=t[i]):t[i]===r&&(n.push(i),r=t[i])}),n},variance:function(e){var t=At.mean(e);return At.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(At.variance(e))},meanAbsoluteDeviation:function(e){var t=At.mean(e);return At.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=At.mean(e),r=At.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};At.average=At.mean;var $f=function(e,t=13,r){if(!e?.length)throw new Error(`Empty string: ${e}`);let n=3735928559^t,i=1103547991^t;for(let o=0,a;o<e.length;o++)a=e.charCodeAt(o),n=Math.imul(n^a,2654435761),i=Math.imul(i^a,1597334677);return n=Math.imul(n^n>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&i)+(n>>>0)).toString(16).slice(-r).padStart(r,"0")};function Nf(){return new Date().toISOString()}var{WARN:eI,LOG:ZE,DEBUG:je,VERBOSE:e1,ERROR:no}=Oe.setup(Oe.INFO);function tI(e,t){je(`[ensureTsPvAndFinalizeApplogs] ENTER - ${e.length} applogs, thread size=${t.size}`);let r=Nf(),n=t;je("[ensureTsPvAndFinalizeApplogs] About to map over applogs");let i=e.map((s,o)=>{je(`[ensureTsPvAndFinalizeApplogs] Processing applog ${o+1}/${e.length}`);let a=rI(s,{ts:r,threadForPv:n});return je(`[ensureTsPvAndFinalizeApplogs] Finalized applog ${o+1}/${e.length}`),a});return je(`[ensureTsPvAndFinalizeApplogs] EXIT - mapped ${i.length} applogs`),i}function rI(e,{ts:t,threadForPv:r}={}){je(`[finalizeApplogForInsert] ENTER - en=${e.en}, at=${e.at}`),je("[finalizeApplogForInsert] About to call withTs");let n=oI(e,t??Nf());je(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${r?.size??"null"})`);let i=sI(n,r);je("[finalizeApplogForInsert] About to call encodeApplogAndGetCid");let s=KO(i).toString();je(`[finalizeApplogForInsert] CID created: ${s}`),e.cid&&e.cid!==s&&eI("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:s,logWithPv:i});let o={...i,cid:s};if(je("[finalizeApplogForInsert] About to validate applog"),!Tf(o))throw no(`Bogus Applog ${JSON.stringify(o)}`,LO(o));return je(`[finalizeApplogForInsert] EXIT - CID=${s}`),Object.freeze(o)}function nI(e){return!!e.ts}function iI(e){return!!e.pv}function oI(e,t){return nI(e)?e:{...e,ts:t}}function sI(e,t){if(je(`[withPvFrom] ENTER - en=${e.en}, at=${e.at}, hasPv=${e.pv!==void 0}`),e.pv!==void 0)return je("[withPvFrom] EXIT early - pv already set"),e;if(t){let{en:r,at:n}=e;je(`[withPvFrom] About to call thread.findLast for en=${r}, at=${n}, thread.size=${t.size}`);let i=t.findLast(o=>o.en==r&&o.at==n);if(je(`[withPvFrom] findLast completed, found=${!!i}`),je("[withPvFrom] About to check equality"),Sf(["en","at","vl","ts","ag"],e,i))throw no("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let s=(e.pv!==void 0?e.pv:i?.cid)??null;return je(`[withPvFrom] EXIT - prevLogCid=${s}`),{...e,pv:s}}else{if(!iI(e))throw no("[withPvFrom] no thread and no pv:",e);return je("[withPvFrom] EXIT - no thread, returning log with existing pv"),e}}function To(e){let t=()=>(Se(()=>e.length<2&&je(`joinThreads with count=${e.length}`)),Wn(Rf(e.flatMap(i=>{let s=i.applogs;if(!s)throw no("falsy applogs of thread",i),new Error("falsy applogs of thread");return s}),"cleanup"))),r=Se(()=>t()),n=tt(function(i,s){return Zt(i)?{init:Se(()=>t())}:{added:i.added.filter(o=>!this.hasApplog(o,!0)),removed:i.removed?.filter(o=>!!this.parents.some(l=>l===s?!1:l.hasApplog(o,!0)))}});return new Ao(Se(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:jc,LOG:t1,DEBUG:kc,VERBOSE:Cr,ERROR:Ni}=Oe.setup(Oe.INFO),Ao=class Ps extends un{constructor(t,r,n,i,s,o=null,a){super(t,r,n,s?Re.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=s,this._writeMapper=o,this._readOnly=a,ur(this,{onParentUpdate:tt}),s&&this.subscribeToParents()}static mapWrites(t,r,n){return new Ps(`${r}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,n)}static asReadOnly(t){return t.readOnly?t:new Ps(`readOnly(${t.name})`,t,t.filters,t._applogs,null,null,!0)}_parentSubscriptions=null;insert(t){if(this.readOnly)throw Ni("[MappedThread] insert() called on read-only thread:",this.nameAndSizeUntracked);let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insert(r))}insertRaw(t){if(this.readOnly)throw Ni("[MappedThread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insertRaw(r))}subscribeToParents(){this._parentSubscriptions=new Map;let t=wt(()=>{this.parents.length||jc("MappedThread has no parents",this),Cr(`[MappedThread: ${this.name}] subscribing to parents:`,this.parents.map(n=>n.name));let r=new Set([...this._parentSubscriptions.keys()]);for(let n of this.parents){r.delete(n)&&Cr(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),Cr(`[MappedThread: ${this.name}] sub to new parent`,n.nameAndSizeUntracked);let s=this.onParentUpdate.bind(this,n),o=n.subscribe(s);this._parentSubscriptions.set(n,o)}for(let n of r)Cr(`[MappedThread: ${this.name}] un-subscribing from old parent`,n.nameAndSizeUntracked),this._parentSubscriptions.get(n)(),this._parentSubscriptions.delete(n)})}subscribe(t){return this._parentSubscriptions||this.subscribeToParents(),super.subscribe(t)}triggerRemap(){if(!this._eventMapper)throw Ni("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);kc(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&jc(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Se(()=>Xt(t.applogs))})})}onParentUpdate(t,r){Cr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(Cr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),Zt(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(gT(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!Zt(r)&&r.removed?.includes(i))kc("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw Ni(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}Cr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,$n(this._applogs)),this.notifySubscribers(n)}get readOnly(){return this._readOnly??!1}},{WARN:r1,LOG:n1,DEBUG:i1,VERBOSE:ys,ERROR:aI}=Oe.setup(Oe.INFO),gr=We("rollingFilter",function(t,r,n={}){let i=uI(r),s=Fc(i),o=Re.array(Se(function(){return s(t.applogs)}),{deep:!1,name:`${t.name} | ${n.name||`rollingFilter.array{${Mr(i)}}`}`}),a=g=>{let x;return Zt(g)?x={init:s(g.init)}:x={added:s(g.added),removed:g.removed},ys(`rollingFilter{${t.nameAndSizeUntracked} | ${n.name?` '${n.name}'}`:""} parentUpdate`,i,g,"=>",x),x},l=new Ao(`${t.name} | ${n.name||`rollingFilter{${Mr(i)}}`}`,t,[...t.filters,...n.extraFilterName?[n.extraFilterName]:[]],o,a),c=hu(()=>Xt(r),g=>{ys(`rollingFilter<${t.nameAndSizeUntracked}>${n.name?` '${n.name}'`:""} patternUpdate`,i,"=>",g),i=g,s=Fc(i),l.triggerRemap()}),d=Pr(o,()=>{ys(`rollingFilter<${Se(()=>t.name)}>${n.name?` '${n.name}'`:""} unobserve`,i),c(),d()});return l},{equals:yn,argsDebugName:(e,t,r)=>ze({caller:"rollingFilter",thread:e,pattern:t,args:r})}),Cf=We("rollingMapper",function(t,r,n={}){let i=Se(()=>r.call(null,{init:t.applogs},t));if(!Zt(i))throw aI("Initial run must return init event");let s=i.init;return new Ao(`${t.name} | ${n.name||"rollingMapper"}`,t,[...t.filters,...n.extraFilterName?[n.extraFilterName]:[]],s,r)},{equals:yn,argsDebugName:(e,t,r)=>ze({caller:"rollingMapper",thread:e,args:r})}),o1=We("rollingAcc",function(t,r,n,i={}){let s=tt(n);return s({init:t.applogs},r),t.subscribe(o=>{s(o,r)}),r},{argsDebugName:(e,t,r,n)=>`rollingAcc{${e.nameAndSizeUntracked}${n?.name?` | ${n?.name}`:""}}`}),uI=function(t){let r=Se(function(){return Object.fromEntries(Object.entries(Xt(t)).map(([i,s])=>[Xt(i),Xt(s)]))});if(!Object.entries(r).length)throw new Error("Pattern is empty");return r};function Fc(e){return function(r){return r.filter(function(i){for(let s of Object.keys(e)){let o=e[s];if(o===void 0)continue;let a=i[s.startsWith("!")?s.slice(1):s];if(!ZO(s,o,a))return!1}return!0})}}var s1=Ao.asReadOnly;var{WARN:cI,LOG:lI,DEBUG:Le,VERBOSE:xf,ERROR:Di}=Oe.setup(Oe.INFO),fI=class extends un{constructor(e,t=[],r){super(e,null,r,t),ur(this,{})}purge(e){let t=this.applogs.length;return this._applogs=this.applogs.filter(r=>!e.includes(r.cid)),t-this.applogs.length}insert(e){Le(`[WriteableThread.insert] ENTER - ${e.length} applogs for thread "${this.name}"`),Le("[WriteableThread.insert] About to call ensureTsPvAndFinalizeApplogs");let t=tI(e,this);Le(`[WriteableThread.insert] ensureTsPvAndFinalizeApplogs completed, mapped=${t.length} applogs`),Le("[WriteableThread.insert] About to call insertRaw");let r=this.insertRaw(t);return Le("[WriteableThread.insert] insertRaw completed"),r}insertMissing(e,t=!1){let r=e.filter(n=>!this.hasApplog(n,t));return r.length===0?(xf("[insertMissing] no missing applogs"),[]):this.insertRaw(r)??[]}insertRaw(e){Le(`[WriteableThread.insertRaw] ENTER - ${e.length} applogs for thread "${this.name}"`),Le("[WriteableThread.insertRaw] About to deduplicate");let t=Rf(e,"safety");if(t.length!==e.length)throw Di(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});Le("[WriteableThread.insertRaw] Deduplication done"),Le("[WriteableThread.insertRaw] About to validate");let r=e.filter(s=>!Tf(s));if(r.length)throw Di(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});Le("[WriteableThread.insertRaw] Validation done"),Le("[WriteableThread.insertRaw] About to check for existing");let n=e.filter(s=>this.hasApplog(s,!1));if(n.length)throw Di(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(Le("[WriteableThread.insertRaw] Existing check done"),!e.length){cI("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof ua)?lI:Le)("Inserting:",e.length===1?e[0]:e,{ds:this}),Le("[WriteableThread.insertRaw] About to sort applogs"),Wn(e);let i=this._applogs.length&&HO(e[0],this._applogs[this._applogs.length-1]);return Le("[WriteableThread.insertRaw] About to push to _applogs array"),this._applogs.push(...e),i&&(Le("[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)"),Wn(this._applogs)),Le("[WriteableThread.insertRaw] About to notify subscribers"),this.notifySubscribers({added:e,removed:null}),Le("[WriteableThread.insertRaw] Subscribers notified"),Le("[WriteableThread.insertRaw] About to call persist (void - not awaited)"),this.persist(e),Le(`[WriteableThread.insertRaw] EXIT - returning ${e.length} applogs`),e}get readOnly(){return!1}},ua=class Bi extends fI{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,ur(this,{_applogs:Re.shallow})}static empty(t){return Bi.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new Bi(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new Bi(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(xf("[InMem.persist] no persist for",t),this.readOnly)throw Di("[persist] called for readOnly thread")}},{WARN:a1,LOG:u1,DEBUG:c1,VERBOSE:l1,ERROR:f1}=Oe.setup(Oe.INFO);var{WARN:tS,LOG:rS,DEBUG:nS,VERBOSE:iS,ERROR:oS}=Oe.setup(Oe.INFO);function ca(e){return $f(e,31,7)}var pI=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,ur(this,{threadOfTrail:xe})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?To([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Uf=class{constructor(e){this.nodes=e,ur(this,{threadOfAllTrails:xe,size:xe,isEmpty:xe})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Se(()=>this.records.length)}get records(){return Kt(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return To(Kt(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return Kt(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return Kt(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return To(Kt(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:lS,LOG:Oo,DEBUG:tr,VERBOSE:be,ERROR:Vr}=Oe.setup(Oe.INFO,{prefix:"[q]"}),la=null,hI=We("lastWriteWins",function(t,{inverseToOnlyReturnFirstLogs:r,tolerateAlreadyFiltered:n}={}){if(be(`lastWriteWins${r?".inversed":""} < ${t.nameAndSizeUntracked} > initializing`),t.filters.includes("lastWriteWins")){if(n)return tr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),t;throw Vr("thread already filtered lastWriteWins:",t.filters,{name:t.name})}let i,s=Cf(t,function(a,l){let c=Zt(a),d,g=[],x=c?null:[];c?(i=new Map,d=a.init):d=a.added;let S;for(let R=r?0:d.length-1;r?R<d.length:R>=0;r?R++:R--){let K=d[R],H=K.en+"|"+K.at;if(S&&(r?S>K.ts:S<K.ts))throw Vr("lastWriteWins.mapper logs not sorted:",S,r?">":"<",K.ts,{log:K,i:R,newLogs:d,inverseToOnlyReturnFirstLogs:r});S=K.ts;let F=i.get(H);(!F||(r?F.ts>K.ts:F.ts<K.ts))&&(F&&!c&&x.push(F),g.push(K),i.set(H,K))}return Wn(g),be.isDisabled||be(`lastWriteWins${r?".inversed":""}<${t.nameAndSizeUntracked}> mapped event`,c?{...Object.fromEntries(Object.entries(a).map(([R,K])=>[R,K?.length])),toAdd:g.length,toRemove:x}:{...a,toAdd:g,toRemove:x}),c?{init:g}:{added:g,removed:x}},{name:`lastWriteWins${r?".inversed":""}`,extraFilterName:"lastWriteWins"});return be.isDisabled||wt(()=>{be(`lastWriteWins<${t.nameAndSizeUntracked}> filtered down to`,s.applogs.length)}),s},{equals:yn,argsDebugName:e=>ze({caller:"lastWriteWins",thread:e})}),fS=We("withoutDeleted",function(t){if(be.isEnabled&&be(`withoutDeleted<${t.nameAndSizeUntracked}>`),t.filters.includes("withoutDeleted"))throw Vr("thread already filtered withoutDeleted:",t.filters,{name:t.name});let r=gr(t,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});be.isEnabled&&be(`withoutDeleted<${t.nameAndSizeUntracked}> deletionLogs:`,Se(function(){return[...r.applogs]}));let n=ze({caller:"allDeletedEntities",thread:t}),i=Ul(function(){return r.map(o=>o.en)},{name:n});return be.isEnabled&&wt(()=>{be(`withoutDeleted<${t.nameAndSizeUntracked}> deleted:`,[...i])}),gr(t,{"!en":i},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:yn}),Mf=We("query",function e(t,r,n={},i={}){TI();let s=Df(t);tr(`query<${s.nameAndSizeUntracked}>:`,r);let o=Array.isArray(r)?r:[r],a;if(o.length===1)a=null;else{let d=o.slice(0,-1);a=e(s,d,n,i)}let l=o[o.length-1],c=yI(s,a,l,i);return be.isDisabled||wt(()=>be("query result:",Xt(c))),c},{equals:ho,argsDebugName:(e,t,r)=>ze({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),yI=We("queryStep",function(t,r,n,i={}){if(tr(`queryStep<${t.nameAndSizeUntracked}> with`,r?.untrackedSize??"all","nodes, pattern:",n),!Object.entries(n).length)throw new Error("Pattern is empty");function s(a){let[l,c]=aa(n,a?.variables??{});be("[queryStep.doQuery] patternWithoutVars: ",l);let d=gr(t,l),g=Io(c),x=Kt(function(){let R=d.map(K=>({log:K,vars:g(K)}));return be.isEnabled&&be("[queryStep.doQuery] step node:",a?.variables," =>",R,"from:",Se(()=>d.applogs)),R.map(({log:K,vars:H})=>{let F=Object.assign({},a?.variables,H);return new pI(Dl.fromArray([K],ze({caller:"QueryNode",thread:d,pattern:`${Mr(F)}@${Mr(l)}`})),F,a)})},{name:ze({caller:"doQuery.mapNodes",thread:d,pattern:n})});return be.isEnabled&&wt(()=>be("[queryStep.doQuery] resultNodes:",[...x])),i.debug&&Oo("[queryStep] step result:",Se(()=>x.map(({variables:S,logsOfThisNode:R})=>({variables:S,thread:R})))),x}let o=Kt(function(){return tr(`[queryStep] Running with ${r?.nodes?.length} input nodes:`),r?[...r.nodes.flatMap(s)]:[...s(null)]},{name:ze({caller:"queryStep",thread:t,pattern:n})});return be.isEnabled&&wt(()=>be("[queryStep] observableResultNodes:",[...o])),new Uf(o)},{equals:ho,argsDebugName:(e,t,r)=>ze({caller:"queryStep",thread:e,pattern:r})}),dS=We("queryNot",function(t,r,n,i={}){let s=r.nodes;tr(`queryNot<${t.nameAndSizeUntracked}> from: ${s.length} nodes`);let o=Array.isArray(n)?n:[n];for(let a of o){if(!Object.entries(n).length)throw new Error("Pattern is empty");s=s.filter(function({variables:c}){let[d,g]=aa(a,c??{});be("[queryNot] patternWithoutVars: ",d);let x=gr(t,d);return be("[queryNot] step node:",c," =>",x.size,"applogs"),be.isDisabled||be("[queryNot] step node:",c," => empty?",Se(()=>x.applogs)),i.debug&&Oo("[queryNot] node result:",c,"=>",x.applogs),x.isEmpty})}return new Uf(s)},{equals:ho,argsDebugName:(e,t,r)=>ze({caller:"queryNot",thread:e,pattern:r})}),pS=We("filterAndMap",function(t,r,n){tr(`filterAndMap<${t.nameAndSizeUntracked}>`,r);let i=gr(t,r);be.isEnabled&&(be("[filterAndMap] filtered:",i.untrackedSize),wt(()=>be("[filterAndMap] filtered:",i.applogs)));let s=ze({thread:t,pattern:r,caller:"filterAndMap"}),o=Kt(()=>vI(i,n),{name:s});return be.isDisabled||wt(()=>be("[filterAndMap] mapped:",o)),o},{equals:Be.structural,argsDebugName:(e,t)=>ze({caller:"filterAndMap",thread:e,pattern:t})}),hS=We("queryAndMap",function(t,r,n,i={}){let s=Df(t);tr(`queryAndMap<${s.nameAndSizeUntracked}>`,{patternOrPatterns:r,variables:i,map:n});let o=ze({thread:s,caller:"queryAndMap"}),a=Mf(s,r);be("[queryAndMap] filtered count:",a.untrackedSize);let l=Kt(()=>bI(a,n),{name:o});return be.isDisabled||wt(()=>be("[queryAndMap] result:",Xt(l))),l},{equals:Be.structural,argsDebugName:(e,t)=>ze({caller:"queryAndMap",thread:e,pattern:t})}),yS=We("queryEntity",function(t,r,n,i){tr(`queryEntity<${t.nameAndSizeUntracked}>`,n,r);let s=gr(t,{en:n,at:_I(r,i)});return be("queryEntity applogs:",s.applogs),xe(()=>s.isEmpty?null:Object.fromEntries(s.map(({at:o,vl:a})=>[o.slice(r.length+1),a])))},{equals:xl,argsDebugName:(e,t,r)=>ze({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),gS=We("agentsOfThread",function(t){tr(`agentsOfThread<${t.nameAndSizeUntracked}>`);let r=Re.map(),n=tt(s=>{for(let o of Zt(s)?s.init:s.added){let a=r.get(o.ag)??0;r.set(o.ag,a+1)}for(let o of!Zt(s)&&s.removed||[]){let a=r.get(o.ag);if(!a||a<1)throw Vr("[agentsOfThread] number is now negative",{log:o,event:s,mapped:r,prev:a});r.set(o.ag,a-1)}Oo(`agentsOfThread<${t.nameAndSizeUntracked}> processed event`,{event:s,mapped:r})});n({init:t.applogs});let i=t.subscribe(n);return rn(r,i),r}),gI=We("entityOverlap",function(t,r){return Oo(`entityOverlap<${t.nameAndSizeUntracked}, ${r.nameAndSizeUntracked}>`),xe(()=>{let n=new Set(t.map(s=>s.en)),i=new Set(r.map(s=>s.en));return[...n].filter(s=>i.has(s))})});var mS=We("entityOverlapCount",function(t,r){return xe(()=>gI(t,r).get().length)}),mI=We("querySingle",function(t,r,n={}){let i=Mf(t,r,n);return xe(()=>{if(i.isEmpty)return null;if(i.size>1)throw Vr("[querySingle] got",i.size,"results:",i);let s=i.nodes[0].logsOfThisNode;if(s.size!=1)throw Vr("[querySingle] single result, but got",s.size,"logs:",s.applogs);return s.applogs[0]})},{equals:Be.structural,argsDebugName:(e,t)=>ze({caller:"querySingle",thread:e,pattern:t})}),vS=We("querySingleAndMap",function(t,r,n,i={}){let s=mI(t,r,i);return xe(()=>{let o=s.get();if(o)return typeof n=="string"?o[n]:Io(n)(o)})},{equals:Be.structural,argsDebugName:(e,t)=>ze({caller:"querySingleAndMap",thread:e,pattern:t})}),vI=function(t,r){return typeof r=="function"?t.map(r):typeof r=="string"?t.map(n=>n[r]):t.map(Io(r))},bI=function(t,r){return typeof r=="function"?t.records.map(r):typeof r=="string"?t.nodes.map(n=>{if(!Object.hasOwn(n.record,r)){if(n.logsOfThisNode.size!==1)throw Vr(`not sure what to map (it's not a var and a result node log count of ${n.logsOfThisNode.size})`);return n.logsOfThisNode.firstLog[r]}return n.record[r]}):t.nodes.map(n=>Io(r)(t))};function Io(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function _I(e,t){return t.map(r=>wI(e,r))}function wI(e,t){return`${e}/${t}`}function Df(e,t){return Array.isArray(e)?ua.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function TI(){if(la!=null&&performance.now()>=la)throw new AI(la)}var AI=class extends Error{constructor(e){super(e)}};var OI=Ce({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(e,t){"use strict";t.exports=o;var r=128,n=127,i=~n,s=Math.pow(2,31);function o(a,l,c){if(Number.MAX_SAFE_INTEGER&&a>Number.MAX_SAFE_INTEGER)throw o.bytes=0,new RangeError("Could not encode varint");l=l||[],c=c||0;for(var d=c;a>=s;)l[c++]=a&255|r,a/=128;for(;a&i;)l[c++]=a&255|r,a>>>=7;return l[c]=a|0,o.bytes=c-d+1,l}}}),II=Ce({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(e,t){"use strict";t.exports=i;var r=128,n=127;function i(s,l){var a=0,l=l||0,c=0,d=l,g,x=s.length;do{if(d>=x||c>49)throw i.bytes=0,new RangeError("Could not decode varint");g=s[d++],a+=c<28?(g&n)<<c:(g&n)*Math.pow(2,c),c+=7}while(g>=r);return i.bytes=d-l,a}}}),EI=Ce({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(e,t){"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),s=Math.pow(2,28),o=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<r?1:g<n?2:g<i?3:g<s?4:g<o?5:g<a?6:g<l?7:g<c?8:g<d?9:10}}}),da=Ce({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:OI(),decode:II(),encodingLength:EI()}}}),Lf=42;function SI(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Zn.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new Z(E.tag,Lf),new Z(E.bytes,r)]}function RI(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function PI(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 $I(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 Bf={float64:!0,typeEncoders:{Map:$I,Object:SI,undefined:RI,number:PI}},CS={...Bf,typeEncoders:{...Bf.typeEncoders}};function NI(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Zn.decode(e.subarray(1))}var fa={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};fa.tags[Lf]=NI;var xS={...fa,tags:fa.tags.slice()};var US=ft(da(),1);var mr={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},ei={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":mr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(mr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=ei["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let s=e[i];if(s=ei["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](s),s===void 0)return;n.push(s)}return n}}return e}},Int:mr.Int,CarV1HeaderOrV2Pragma:e=>{if(mr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[s,o]=t[i];switch(s){case"roots":{let a=ei["CarV1HeaderOrV2Pragma > roots (anon)"](e[s]);if(a===void 0)return;if(a!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=a}}break;case"version":{n--;let a=ei.Int(e[s]);if(a===void 0)return;if(a!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=a}}break;default:return}}if(!(n>0))return r}},ti={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":mr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(mr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=ti["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let s=e[i];if(s=ti["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](s),s===void 0)return;n.push(s)}return n}}return e}},Int:mr.Int,CarV1HeaderOrV2Pragma:e=>{if(mr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[s,o]=t[i];switch(s){case"roots":{let a=ti["CarV1HeaderOrV2Pragma > roots (anon)"](o);if(a===void 0)return;if(a!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=a}}break;case"version":{n--;let a=ti.Int(o);if(a===void 0)return;if(a!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=a}}break;default:return}}if(!(n>0))return r}},MS={toTyped:ei.CarV1HeaderOrV2Pragma,toRepresentation:ti.CarV1HeaderOrV2Pragma},DS=Zs(),BS=ft(da(),1),LS=[new Z(E.map,2),new Z(E.string,"version"),new Z(E.uint,1),new Z(E.string,"roots")],jS=new Z(E.tag,42);var kS=ft(da(),1);var{WARN:FS,LOG:KS,DEBUG:VS,VERBOSE:zS,ERROR:qS}=Oe.setup(Oe.INFO);var{WARN:GS,LOG:WS,DEBUG:HS,VERBOSE:JS,ERROR:XS}=Oe.setup(Oe.INFO);var pa=class{app;username;devicename;signer},jf=class extends pa{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 ca(this.agentString)}get shortDID(){return this.did?.slice(-8)}get agentString(){return`${this.username}.${this.shortDID}@${this.app}.${this.devicename}`}};export{jf as BaseAgent};
|
|
62
62
|
/*! Bundled license information:
|
|
63
63
|
|
|
64
64
|
lodash-es/lodash.js:
|