@wovin/connect-nftstorage 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-FNKQBNYP.min.js → chunk-IRRRPVEK.min.js} +15 -15
- package/dist/{chunk-FNKQBNYP.min.js.map → chunk-IRRRPVEK.min.js.map} +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/retrieve.d.ts +3 -3
- package/dist/retrieve.d.ts.map +1 -1
- package/dist/retrieve.min.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-MPXCRD5U.min.js +0 -12400
- package/dist/chunk-MPXCRD5U.min.js.map +0 -1
- package/dist/chunk-RSIVX4XW.min.js +0 -6488
- package/dist/chunk-RSIVX4XW.min.js.map +0 -1
- package/dist/chunk-Z4SV224X.min.js +0 -1485
- package/dist/chunk-Z4SV224X.min.js.map +0 -1
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import{b as bi,d as Ro,e as Mo,f as wi,g as gt}from"./chunk-SOBCOB7T.min.js";var Ru=bi((oE,Cu)=>{"use strict";Cu.exports=Wo;var Bu=128,Op=127,Ip=~Op,Ap=Math.pow(2,31);function Wo(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw Wo.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=Ap;)t[r++]=e&255|Bu,e/=128;for(;e&Ip;)t[r++]=e&255|Bu,e>>>=7;return t[r]=e|0,Wo.bytes=r-n+1,t}});var Du=bi((aE,Lu)=>{"use strict";Lu.exports=Jo;var Sp=128,Mu=127;function Jo(e,n){var r=0,n=n||0,i=0,a=n,o,u=e.length;do{if(a>=u||i>49)throw Jo.bytes=0,new RangeError("Could not decode varint");o=e[a++],r+=i<28?(o&Mu)<<i:(o&Mu)*Math.pow(2,i),i+=7}while(o>=Sp);return Jo.bytes=a-n,r}});var Fu=bi((sE,Vu)=>{"use strict";var $p=Math.pow(2,7),kp=Math.pow(2,14),Up=Math.pow(2,21),jp=Math.pow(2,28),Np=Math.pow(2,35),Pp=Math.pow(2,42),Bp=Math.pow(2,49),Cp=Math.pow(2,56),Rp=Math.pow(2,63);Vu.exports=function(e){return e<$p?1:e<kp?2:e<Up?3:e<jp?4:e<Np?5:e<Pp?6:e<Bp?7:e<Cp?8:e<Rp?9:10}});var Ni=bi((uE,zu)=>{"use strict";zu.exports={encode:Ru(),decode:Du(),encodingLength:Fu()}});var Wd=["string","number","bigint","symbol"],Jd=["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 Us(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(Wd.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Xd(e))return"Buffer";let r=Yd(e);return r||"Object"}function Xd(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Yd(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Jd.includes(t))return t}var D=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};D.uint=new D(0,"uint",!0);D.negint=new D(1,"negint",!0);D.bytes=new D(2,"bytes",!0);D.string=new D(3,"string",!0);D.array=new D(4,"array",!1);D.map=new D(5,"map",!1);D.tag=new D(6,"tag",!1);D.float=new D(7,"float",!0);D.false=new D(7,"false",!0);D.true=new D(7,"true",!0);D.null=new D(7,"null",!0);D.undefined=new D(7,"undefined",!0);D.break=new D(7,"break",!0);var ce=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};var qr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Qd=new TextDecoder,Zd=new TextEncoder;function _i(e){return qr&&globalThis.Buffer.isBuffer(e)}function Bs(e){return e instanceof Uint8Array?_i(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Cs=qr?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Ns(e,t,r):(e,t,r)=>r-t>64?Qd.decode(e.subarray(t,r)):Ns(e,t,r),Rs=qr?e=>e.length>64?globalThis.Buffer.from(e):js(e):e=>e.length>64?Zd.encode(e):js(e);var Kr=qr?(e,t,r)=>_i(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ms=qr?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Bs(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},Ls=qr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Ds(e,t){if(_i(e)&&_i(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 js(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):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}function Ns(e,t,r){let n=[];for(;t<r;){let i=e[t],a=null,o=i>239?4:i>223?3:i>191?2:1;if(t+o<=r){let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=e[t+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=e[t+1],l=e[t+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=e[t+1],l=e[t+2],c=e[t+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),t+=o}return ep(n)}var Ps=4096;function ep(e){let t=e.length;if(t<=Ps)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Ps));return r}var tp=256,Ti=class{constructor(t=tp){this.chunkSize=t,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(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let i=r.length-(this.maxCursor-this.cursor)-1;r.set(t,i)}else{if(r){let i=r.length-(this.maxCursor-this.cursor)-1;i<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,i),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=Ls(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=Kr(n,0,this.cursor)}else r=Ms(this.chunks,this.cursor);return t&&this.reset(),r}};var ve="CBOR decode error:",Lo="CBOR encode error:",En=[];En[23]=1;En[24]=2;En[25]=3;En[26]=5;En[27]=9;function Ct(e,t,r){if(e.length-t<r)throw new Error(`${ve} not enough data for type`)}var Ve=[24,256,65536,4294967296,BigInt("18446744073709551616")];function tt(e,t,r){Ct(e,t,1);let n=e[t];if(r.strict===!0&&n<Ve[0])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function rt(e,t,r){Ct(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Ve[1])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function nt(e,t,r){Ct(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Ve[2])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function it(e,t,r){Ct(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],a=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&a<Ve[3])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);if(a<=Number.MAX_SAFE_INTEGER)return Number(a);if(r.allowBigInt===!0)return a;throw new Error(`${ve} integers outside of the safe integer range are not supported`)}function Vs(e,t,r,n){return new ce(D.uint,tt(e,t+1,n),2)}function Fs(e,t,r,n){return new ce(D.uint,rt(e,t+1,n),3)}function zs(e,t,r,n){return new ce(D.uint,nt(e,t+1,n),5)}function qs(e,t,r,n){return new ce(D.uint,it(e,t+1,n),9)}function ct(e,t){return Fe(e,0,t.value)}function Fe(e,t,r){if(r<Ve[0]){let n=Number(r);e.push([t|n])}else if(r<Ve[1]){let n=Number(r);e.push([t|24,n])}else if(r<Ve[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Ve[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<Ve[4]){let i=[t|27,0,0,0,0,0,0,0],a=Number(n&BigInt(4294967295)),o=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=a&255,a=a>>8,i[7]=a&255,a=a>>8,i[6]=a&255,a=a>>8,i[5]=a&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(`${ve} encountered BigInt larger than allowable range`)}}ct.encodedSize=function(t){return Fe.encodedSize(t.value)};Fe.encodedSize=function(t){return t<Ve[0]?1:t<Ve[1]?2:t<Ve[2]?3:t<Ve[3]?5:9};ct.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function Ks(e,t,r,n){return new ce(D.negint,-1-tt(e,t+1,n),2)}function Gs(e,t,r,n){return new ce(D.negint,-1-rt(e,t+1,n),3)}function Hs(e,t,r,n){return new ce(D.negint,-1-nt(e,t+1,n),5)}var Do=BigInt(-1),Ws=BigInt(1);function Js(e,t,r,n){let i=it(e,t+1,n);if(typeof i!="bigint"){let a=-1-i;if(a>=Number.MIN_SAFE_INTEGER)return new ce(D.negint,a,9)}if(n.allowBigInt!==!0)throw new Error(`${ve} integers outside of the safe integer range are not supported`);return new ce(D.negint,Do-BigInt(i),9)}function xi(e,t){let r=t.value,n=typeof r=="bigint"?r*Do-Ws:r*-1-1;Fe(e,t.type.majorEncoded,n)}xi.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Do-Ws:r*-1-1;return n<Ve[0]?1:n<Ve[1]?2:n<Ve[2]?3:n<Ve[3]?5:9};xi.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function On(e,t,r,n){Ct(e,t,r+n);let i=Kr(e,t+r,t+r+n);return new ce(D.bytes,i,r+n)}function Xs(e,t,r,n){return On(e,t,1,r)}function Ys(e,t,r,n){return On(e,t,2,tt(e,t+1,n))}function Qs(e,t,r,n){return On(e,t,3,rt(e,t+1,n))}function Zs(e,t,r,n){return On(e,t,5,nt(e,t+1,n))}function eu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer bytes lengths not supported`);return On(e,t,9,i)}function Ei(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===D.string?Rs(e.value):e.value),e.encodedBytes}function Gr(e,t){let r=Ei(t);Fe(e,t.type.majorEncoded,r.length),e.push(r)}Gr.encodedSize=function(t){let r=Ei(t);return Fe.encodedSize(r.length)+r.length};Gr.compareTokens=function(t,r){return np(Ei(t),Ei(r))};function np(e,t){return e.length<t.length?-1:e.length>t.length?1:Ds(e,t)}function In(e,t,r,n,i){let a=r+n;Ct(e,t,a);let o=new ce(D.string,Cs(e,t+r,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=Kr(e,t+r,t+a)),o}function tu(e,t,r,n){return In(e,t,1,r,n)}function ru(e,t,r,n){return In(e,t,2,tt(e,t+1,n),n)}function nu(e,t,r,n){return In(e,t,3,rt(e,t+1,n),n)}function iu(e,t,r,n){return In(e,t,5,nt(e,t+1,n),n)}function ou(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer string lengths not supported`);return In(e,t,9,i,n)}var au=Gr;function Hr(e,t,r,n){return new ce(D.array,n,r)}function su(e,t,r,n){return Hr(e,t,1,r)}function uu(e,t,r,n){return Hr(e,t,2,tt(e,t+1,n))}function cu(e,t,r,n){return Hr(e,t,3,rt(e,t+1,n))}function lu(e,t,r,n){return Hr(e,t,5,nt(e,t+1,n))}function fu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer array lengths not supported`);return Hr(e,t,9,i)}function du(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return Hr(e,t,1,1/0)}function Oi(e,t){Fe(e,D.array.majorEncoded,t.value)}Oi.compareTokens=ct.compareTokens;Oi.encodedSize=function(t){return Fe.encodedSize(t.value)};function Wr(e,t,r,n){return new ce(D.map,n,r)}function pu(e,t,r,n){return Wr(e,t,1,r)}function hu(e,t,r,n){return Wr(e,t,2,tt(e,t+1,n))}function yu(e,t,r,n){return Wr(e,t,3,rt(e,t+1,n))}function mu(e,t,r,n){return Wr(e,t,5,nt(e,t+1,n))}function gu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer map lengths not supported`);return Wr(e,t,9,i)}function vu(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return Wr(e,t,1,1/0)}function Ii(e,t){Fe(e,D.map.majorEncoded,t.value)}Ii.compareTokens=ct.compareTokens;Ii.encodedSize=function(t){return Fe.encodedSize(t.value)};function bu(e,t,r,n){return new ce(D.tag,r,1)}function wu(e,t,r,n){return new ce(D.tag,tt(e,t+1,n),2)}function _u(e,t,r,n){return new ce(D.tag,rt(e,t+1,n),3)}function Tu(e,t,r,n){return new ce(D.tag,nt(e,t+1,n),5)}function xu(e,t,r,n){return new ce(D.tag,it(e,t+1,n),9)}function Ai(e,t){Fe(e,D.tag.majorEncoded,t.value)}Ai.compareTokens=ct.compareTokens;Ai.encodedSize=function(t){return Fe.encodedSize(t.value)};var cp=20,lp=21,fp=22,dp=23;function Eu(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${ve} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ce(D.null,null,1):new ce(D.undefined,void 0,1)}function Ou(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return new ce(D.break,void 0,1)}function Vo(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ve} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ve} Infinity values are not supported`)}return new ce(D.float,e,t)}function Iu(e,t,r,n){return Vo(Fo(e,t+1),3,n)}function Au(e,t,r,n){return Vo(zo(e,t+1),5,n)}function Su(e,t,r,n){return Vo(ju(e,t+1),9,n)}function Si(e,t,r){let n=t.value;if(n===!1)e.push([D.float.majorEncoded|cp]);else if(n===!0)e.push([D.float.majorEncoded|lp]);else if(n===null)e.push([D.float.majorEncoded|fp]);else if(n===void 0)e.push([D.float.majorEncoded|dp]);else{let i,a=!1;(!r||r.float64!==!0)&&(ku(n),i=Fo(vt,1),n===i||Number.isNaN(n)?(vt[0]=249,e.push(vt.slice(0,3)),a=!0):(Uu(n),i=zo(vt,1),n===i&&(vt[0]=250,e.push(vt.slice(0,5)),a=!0))),a||(pp(n),i=ju(vt,1),vt[0]=251,e.push(vt.slice(0,9)))}}Si.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){ku(n);let i=Fo(vt,1);if(n===i||Number.isNaN(n))return 3;if(Uu(n),i=zo(vt,1),n===i)return 5}return 9};var $u=new ArrayBuffer(9),lt=new DataView($u,1),vt=new Uint8Array($u,0);function ku(e){if(e===1/0)lt.setUint16(0,31744,!1);else if(e===-1/0)lt.setUint16(0,64512,!1);else if(Number.isNaN(e))lt.setUint16(0,32256,!1);else{lt.setFloat32(0,e);let t=lt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)lt.setUint16(0,31744,!1);else if(r===0)lt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?lt.setUint16(0,0):i<-14?lt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):lt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Fo(e,t){if(e.length-t<2)throw new Error(`${ve} 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,a;return n===0?a=i*2**-24:n!==31?a=(i+1024)*2**(n-25):a=i===0?1/0:NaN,r&32768?-a:a}function Uu(e){lt.setFloat32(0,e,!1)}function zo(e,t){if(e.length-t<4)throw new Error(`${ve} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function pp(e){lt.setFloat64(0,e,!1)}function ju(e,t){if(e.length-t<8)throw new Error(`${ve} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Si.compareTokens=ct.compareTokens;function xe(e,t,r){throw new Error(`${ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function $i(e){return()=>{throw new Error(`${ve} ${e}`)}}var ie=[];for(let e=0;e<=23;e++)ie[e]=xe;ie[24]=Vs;ie[25]=Fs;ie[26]=zs;ie[27]=qs;ie[28]=xe;ie[29]=xe;ie[30]=xe;ie[31]=xe;for(let e=32;e<=55;e++)ie[e]=xe;ie[56]=Ks;ie[57]=Gs;ie[58]=Hs;ie[59]=Js;ie[60]=xe;ie[61]=xe;ie[62]=xe;ie[63]=xe;for(let e=64;e<=87;e++)ie[e]=Xs;ie[88]=Ys;ie[89]=Qs;ie[90]=Zs;ie[91]=eu;ie[92]=xe;ie[93]=xe;ie[94]=xe;ie[95]=$i("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ie[e]=tu;ie[120]=ru;ie[121]=nu;ie[122]=iu;ie[123]=ou;ie[124]=xe;ie[125]=xe;ie[126]=xe;ie[127]=$i("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ie[e]=su;ie[152]=uu;ie[153]=cu;ie[154]=lu;ie[155]=fu;ie[156]=xe;ie[157]=xe;ie[158]=xe;ie[159]=du;for(let e=160;e<=183;e++)ie[e]=pu;ie[184]=hu;ie[185]=yu;ie[186]=mu;ie[187]=gu;ie[188]=xe;ie[189]=xe;ie[190]=xe;ie[191]=vu;for(let e=192;e<=215;e++)ie[e]=bu;ie[216]=wu;ie[217]=_u;ie[218]=Tu;ie[219]=xu;ie[220]=xe;ie[221]=xe;ie[222]=xe;ie[223]=xe;for(let e=224;e<=243;e++)ie[e]=$i("simple values are not supported");ie[244]=xe;ie[245]=xe;ie[246]=xe;ie[247]=Eu;ie[248]=$i("simple values are not supported");ie[249]=Iu;ie[250]=Au;ie[251]=Su;ie[252]=xe;ie[253]=xe;ie[254]=xe;ie[255]=Ou;var bt=[];for(let e=0;e<24;e++)bt[e]=new ce(D.uint,e,1);for(let e=-1;e>=-24;e--)bt[31-e]=new ce(D.negint,e,1);bt[64]=new ce(D.bytes,new Uint8Array(0),1);bt[96]=new ce(D.string,"",1);bt[128]=new ce(D.array,0,1);bt[160]=new ce(D.map,0,1);bt[244]=new ce(D.false,!1,1);bt[245]=new ce(D.true,!0,1);bt[246]=new ce(D.null,null,1);function qo(){let e=[];return e[D.uint.major]=ct,e[D.negint.major]=xi,e[D.bytes.major]=Gr,e[D.string.major]=au,e[D.array.major]=Oi,e[D.map.major]=Ii,e[D.tag.major]=Ai,e[D.float.major]=Si,e}var Wx=qo(),Jx=new Ti,Ui=class e{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(`${Lo} object contains circular references`);return new e(r,t)}},Kt={null:new ce(D.null,null),undefined:new ce(D.undefined,void 0),true:new ce(D.true,!0),false:new ce(D.false,!1),emptyArray:new ce(D.array,0),emptyMap:new ce(D.map,0)},Gt={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ce(D.float,e):e>=0?new ce(D.uint,e):new ce(D.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ce(D.uint,e):new ce(D.negint,e)},Uint8Array(e,t,r,n){return new ce(D.bytes,e)},string(e,t,r,n){return new ce(D.string,e)},boolean(e,t,r,n){return e?Kt.true:Kt.false},null(e,t,r,n){return Kt.null},undefined(e,t,r,n){return Kt.undefined},ArrayBuffer(e,t,r,n){return new ce(D.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ce(D.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Kt.emptyArray,new ce(D.break)]:Kt.emptyArray;n=Ui.createCheck(n,e);let i=[],a=0;for(let o of e)i[a++]=ki(o,r,n);return r.addBreakTokens?[new ce(D.array,e.length),i,new ce(D.break)]:[new ce(D.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",a=i?e.keys():Object.keys(e),o=i?e.size:a.length;if(!o)return r.addBreakTokens===!0?[Kt.emptyMap,new ce(D.break)]:Kt.emptyMap;n=Ui.createCheck(n,e);let u=[],l=0;for(let c of a)u[l++]=[ki(c,r,n),ki(i?e.get(c):e[c],r,n)];return mp(u,r),r.addBreakTokens?[new ce(D.map,o),u,new ce(D.break)]:[new ce(D.map,o),u]}};Gt.Map=Gt.Object;Gt.Buffer=Gt.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Gt[`${e}Array`]=Gt.DataView;function ki(e,t={},r){let n=Us(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Gt[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let a=Gt[n];if(!a)throw new Error(`${Lo} unsupported type: ${n}`);return a(e,n,t,r)}function mp(e,t){t.mapSorter&&e.sort(t.mapSorter)}var gp={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Ko=class{constructor(t,r={}){this._pos=0,this.data=t,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let t=this.data[this._pos],r=bt[t];if(r===void 0){let n=ie[t];if(!n)throw new Error(`${ve} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let i=t&31;r=n(this.data,this._pos,i,this.options)}return this._pos+=r.encodedLength,r}},An=Symbol.for("DONE"),ji=Symbol.for("BREAK");function vp(e,t,r){let n=[];for(let i=0;i<e.value;i++){let a=Sn(t,r);if(a===ji){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed array`)}if(a===An)throw new Error(`${ve} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=a}return n}function bp(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},a=n?new Map:void 0;for(let o=0;o<e.value;o++){let u=Sn(t,r);if(u===ji){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed map`)}if(u===An)throw new Error(`${ve} found map but not enough entries (got ${o} [no key], expected ${e.value})`);if(n!==!0&&typeof u!="string")throw new Error(`${ve} non-string keys not supported (got ${typeof u})`);if(r.rejectDuplicateMapKeys===!0&&(n&&a.has(u)||!n&&u in i))throw new Error(`${ve} found repeat map key "${u}"`);let l=Sn(t,r);if(l===An)throw new Error(`${ve} found map but not enough entries (got ${o} [no value], expected ${e.value})`);n?a.set(u,l):i[u]=l}return n?a:i}function Sn(e,t){if(e.done())return An;let r=e.next();if(r.type===D.break)return ji;if(r.type.terminal)return r.value;if(r.type===D.array)return vp(r,e,t);if(r.type===D.map)return bp(r,e,t);if(r.type===D.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Sn(e,t);return t.tags[r.value](n)}throw new Error(`${ve} tag not supported (${r.value})`)}throw new Error("unsupported")}function Nu(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ve} data to decode must be a Uint8Array`);t=Object.assign({},gp,t);let r=t.tokenizer||new Ko(e,t),n=Sn(r,t);if(n===An)throw new Error(`${ve} did not find any content to decode`);if(n===ji)throw new Error(`${ve} got unexpected break`);return[n,e.subarray(r.pos())]}function Go(e,t){let[r,n]=Nu(e,t);if(n.length>0)throw new Error(`${ve} too many terminals, data makes no sense`);return r}var Tp=42;function xp(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return gt.decode(e.subarray(1))}var Pu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Pu.tags[Tp]=xp;var Ho=e=>Go(e,Pu);var Ht=Ro(Ni(),1),$n={SHA2_256:18,LENGTH:32,DAG_PB:112},Xo=40;function Jr(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Ht.default.decode(e);return t.seek(Ht.default.decode.bytes),r}function Yo(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=0;return{version:2,characteristics:[t.getBigUint64(r,!0),t.getBigUint64(r+=8,!0)],dataOffset:Number(t.getBigUint64(r+=8,!0)),dataSize:Number(t.getBigUint64(r+=8,!0)),indexOffset:Number(t.getBigUint64(r+=8,!0))}}function Qo(e){Ht.default.decode(e);let t=Ht.default.decode.bytes,r=Ht.default.decode(e.subarray(Ht.default.decode.bytes)),n=Ht.default.decode.bytes;return t+n+r}var Wt={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},kn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Wt.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Wt.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=kn["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 a=e[i];if(a=kn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:Wt.Int,CarV1HeaderOrV2Pragma:e=>{if(Wt.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=kn["CarV1HeaderOrV2Pragma > roots (anon)"](e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=kn.Int(e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},Un={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Wt.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Wt.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Un["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 a=e[i];if(a=Un["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:Wt.Int,CarV1HeaderOrV2Pragma:e=>{if(Wt.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=Un["CarV1HeaderOrV2Pragma > roots (anon)"](o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=Un.Int(o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},Zo={toTyped:kn.CarV1HeaderOrV2Pragma,toRepresentation:Un.CarV1HeaderOrV2Pragma};var bE=qo();var Vp=Ro(Ni(),1);var EE=[new ce(D.map,2),new ce(D.string,"version"),new ce(D.uint,1),new ce(D.string,"roots")],OE=new ce(D.tag,42);async function ea(e,t){let r=Jr(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Ho(n);if(Zo.toTyped(i)===void 0)throw new Error("Invalid CAR header format");if(i.version!==1&&i.version!==2||t!==void 0&&i.version!==t)throw new Error(`Invalid CAR version: ${i.version}${t!==void 0?` (expected ${t})`:""}`);if(i.version===1){if(!Array.isArray(i.roots))throw new Error("Invalid CAR header format");return i}if(i.roots!==void 0)throw new Error("Invalid CAR header format");let a=Yo(await e.exactly(Xo,!0));e.seek(a.dataOffset-e.pos);let o=await ea(e,1);return Object.assign(o,a)}async function zp(e){let t=await e.exactly(2,!1);if(t[0]===$n.SHA2_256&&t[1]===$n.LENGTH){let o=await e.exactly(34,!0),u=wi(o);return gt.create(0,$n.DAG_PB,u)}let r=Jr(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Jr(await e.upTo(8),e),i=await e.exactly(Qo(await e.upTo(8)),!0),a=wi(i);return gt.create(r,n,a)}async function qu(e){let t=e.pos,r=Jr(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await zp(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function qp(e){let{cid:t,blockLength:r}=await qu(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Kp(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await qu(e),a={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(a.blockLength),a}function Jt(e){let t=(async()=>{let r=await ea(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Hp(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await qp(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Kp(e)}}}function gr(e){let t=0;return{async upTo(r){return e.subarray(t,t+Math.min(r,e.length-t))},async exactly(r,n=!1){if(r>e.length-t)throw new Error("Unexpected end of data");let i=e.subarray(t,t+r);return n&&(t+=r),i},seek(r){t+=r},get pos(){return t}}}function Gp(e){let t=0,r=0,n=0,i=new Uint8Array(0),a=async o=>{r=i.length-n;let u=[i.subarray(n)];for(;r<o;){let c=await e();if(c==null)break;r<0?c.length>r&&u.push(c.subarray(-r)):u.push(c),r+=c.length}i=new Uint8Array(u.reduce((c,m)=>c+m.length,0));let l=0;for(let c of u)i.set(c,l),l+=c.length;n=0};return{async upTo(o){return i.length-n<o&&await a(o),i.subarray(n,n+Math.min(i.length-n,o))},async exactly(o,u=!1){if(i.length-n<o&&await a(o),i.length-n<o)throw new Error("Unexpected end of data");let l=i.subarray(n,n+o);return u&&(t+=o,n+=o),l},seek(o){t+=o,n+=o},get pos(){return t}}}function Xt(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Gp(r)}function Hp(e,t){let r=0;return{async upTo(n){let i=await e.upTo(n);return i.length+r>t&&(i=i.subarray(0,t-r)),i},async exactly(n,i=!1){let a=await e.exactly(n,i);if(a.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),a},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var jn=class{constructor(t,r,n){this._version=t,this._roots=r,this._iterator=n}get version(){return this._version}async getRoots(){return this._roots}[Symbol.asyncIterator](){return this._iterator}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Ku(gr(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Ku(Xt(t))}};async function Ku(e){let t=Jt(e),{version:r,roots:n}=await t.header();return new jn(r,n,t.blocksIndex())}var vr=class{constructor(t,r){this._header=t,this._blocks=r,this._keys=r.map(n=>n.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(t){return this._keys.indexOf(t.toString())>-1}async get(t){let r=this._keys.indexOf(t.toString());return r>-1?this._blocks[r]:void 0}async*blocks(){for(let t of this._blocks)yield t}async*cids(){for(let t of this._blocks)yield t.cid}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Gu(gr(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Gu(Xt(t))}};async function Gu(e){let t=Jt(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new vr(r,n)}var Pi=class{constructor(t,r,n){this._version=t,this._roots=r,this._iterable=n,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},ta=class e extends Pi{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Hu(t);return new e(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Wu(t);return new e(r,n,i)}},ra=class e extends Pi{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;let t=this._iterable[Symbol.asyncIterator]();return{async next(){let r=await t.next();return r.done?r:{done:!1,value:r.value.cid}}}}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Hu(t);return new e(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Wu(t);return new e(r,n,i)}};async function Hu(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Ju(gr(e))}async function Wu(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Ju(Xt(e))}async function Ju(e){let t=Jt(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var Wp=Ro(Ni(),1);var Xu=class{constructor(t){this._iterator=t}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};var Jp=Object.create,la=Object.defineProperty,Xp=Object.getOwnPropertyDescriptor,Yp=Object.getOwnPropertyNames,Qp=Object.getPrototypeOf,Zp=Object.prototype.hasOwnProperty,Le=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),uc=(e,t)=>{for(var r in t)la(e,r,{get:t[r],enumerable:!0})},eh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Yp(t))!Zp.call(e,i)&&i!==r&&la(e,i,{get:()=>t[i],enumerable:!(n=Xp(t,i))||n.enumerable});return e},rr=(e,t,r)=>(r=e!=null?Jp(Qp(e)):{},eh(t||!e||!e.__esModule?la(r,"default",{value:e,enumerable:!0}):r,e)),th={};uc(th,{code:()=>Sc,decode:()=>Wi,encode:()=>Oa,format:()=>ac,name:()=>am,parse:()=>um,stringify:()=>ac});var rh=["string","number","bigint","symbol"],nh=["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 ih(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return rh.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":oh(e)?"Buffer":ah(e)||"Object"}function oh(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function ah(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(nh.includes(t))return t}var N=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}};N.uint=new N(0,"uint",!0);N.negint=new N(1,"negint",!0);N.bytes=new N(2,"bytes",!0);N.string=new N(3,"string",!0);N.array=new N(4,"array",!1);N.map=new N(5,"map",!1);N.tag=new N(6,"tag",!1);N.float=new N(7,"float",!0);N.false=new N(7,"false",!0);N.true=new N(7,"true",!0);N.null=new N(7,"null",!0);N.undefined=new N(7,"undefined",!0);N.break=new N(7,"break",!0);var Y=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}`}},Xr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",sh=new TextDecoder,uh=new TextEncoder;function Ri(e){return Xr&&globalThis.Buffer.isBuffer(e)}function fa(e){return e instanceof Uint8Array?Ri(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var ch=Xr?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Qu(e,t,r):(e,t,r)=>r-t>64?sh.decode(e.subarray(t,r)):Qu(e,t,r),cc=Xr?e=>e.length>64?globalThis.Buffer.from(e):Yu(e):e=>e.length>64?uh.encode(e):Yu(e);var da=Xr?(e,t,r)=>Ri(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),lh=Xr?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),fa(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},fh=Xr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function dh(e,t){if(Ri(e)&&Ri(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 Yu(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):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}function Qu(e,t,r){let n=[];for(;t<r;){let i=e[t],a=null,o=i>239?4:i>223?3:i>191?2:1;if(t+o<=r){let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=e[t+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=e[t+1],l=e[t+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=e[t+1],l=e[t+2],c=e[t+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),t+=o}return lc(n)}var Zu=4096;function lc(e){let t=e.length;if(t<=Zu)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Zu));return r}var ph=256,fc=class{constructor(e=ph){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=fh(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=da(r,0,this.cursor)}else t=lh(this.chunks,this.cursor);return e&&this.reset(),t}},he="CBOR decode error:",br="CBOR encode error:",Mn=[];Mn[23]=1;Mn[24]=2;Mn[25]=3;Mn[26]=5;Mn[27]=9;function Yr(e,t,r){if(e.length-t<r)throw new Error(`${he} not enough data for type`)}var ze=[24,256,65536,4294967296,BigInt("18446744073709551616")];function wr(e,t,r){Yr(e,t,1);let n=e[t];if(r.strict===!0&&n<ze[0])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function _r(e,t,r){Yr(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ze[1])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function Tr(e,t,r){Yr(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ze[2])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function xr(e,t,r){Yr(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],a=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&a<ze[3])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);if(a<=Number.MAX_SAFE_INTEGER)return Number(a);if(r.allowBigInt===!0)return a;throw new Error(`${he} integers outside of the safe integer range are not supported`)}function hh(e,t,r,n){return new Y(N.uint,wr(e,t+1,n),2)}function yh(e,t,r,n){return new Y(N.uint,_r(e,t+1,n),3)}function mh(e,t,r,n){return new Y(N.uint,Tr(e,t+1,n),5)}function gh(e,t,r,n){return new Y(N.uint,xr(e,t+1,n),9)}function Er(e,t){return dt(e,0,t.value)}function dt(e,t,r){if(r<ze[0]){let n=Number(r);e.push([t|n])}else if(r<ze[1]){let n=Number(r);e.push([t|24,n])}else if(r<ze[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ze[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<ze[4]){let i=[t|27,0,0,0,0,0,0,0],a=Number(n&BigInt(4294967295)),o=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=a&255,a=a>>8,i[7]=a&255,a=a>>8,i[6]=a&255,a=a>>8,i[5]=a&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(`${he} encountered BigInt larger than allowable range`)}}Er.encodedSize=function(e){return dt.encodedSize(e.value)};dt.encodedSize=function(e){return e<ze[0]?1:e<ze[1]?2:e<ze[2]?3:e<ze[3]?5:9};Er.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function vh(e,t,r,n){return new Y(N.negint,-1-wr(e,t+1,n),2)}function bh(e,t,r,n){return new Y(N.negint,-1-_r(e,t+1,n),3)}function wh(e,t,r,n){return new Y(N.negint,-1-Tr(e,t+1,n),5)}var pa=BigInt(-1),dc=BigInt(1);function _h(e,t,r,n){let i=xr(e,t+1,n);if(typeof i!="bigint"){let a=-1-i;if(a>=Number.MIN_SAFE_INTEGER)return new Y(N.negint,a,9)}if(n.allowBigInt!==!0)throw new Error(`${he} integers outside of the safe integer range are not supported`);return new Y(N.negint,pa-BigInt(i),9)}function ha(e,t){let r=t.value,n=typeof r=="bigint"?r*pa-dc:r*-1-1;dt(e,t.type.majorEncoded,n)}ha.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*pa-dc:t*-1-1;return r<ze[0]?1:r<ze[1]?2:r<ze[2]?3:r<ze[3]?5:9};ha.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Ln(e,t,r,n){Yr(e,t,r+n);let i=da(e,t+r,t+r+n);return new Y(N.bytes,i,r+n)}function Th(e,t,r,n){return Ln(e,t,1,r)}function xh(e,t,r,n){return Ln(e,t,2,wr(e,t+1,n))}function Eh(e,t,r,n){return Ln(e,t,3,_r(e,t+1,n))}function Oh(e,t,r,n){return Ln(e,t,5,Tr(e,t+1,n))}function Ih(e,t,r,n){let i=xr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer bytes lengths not supported`);return Ln(e,t,9,i)}function Mi(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===N.string?cc(e.value):e.value),e.encodedBytes}function qi(e,t){let r=Mi(t);dt(e,t.type.majorEncoded,r.length),e.push(r)}qi.encodedSize=function(e){let t=Mi(e);return dt.encodedSize(t.length)+t.length};qi.compareTokens=function(e,t){return Ah(Mi(e),Mi(t))};function Ah(e,t){return e.length<t.length?-1:e.length>t.length?1:dh(e,t)}function Dn(e,t,r,n,i){let a=r+n;Yr(e,t,a);let o=new Y(N.string,ch(e,t+r,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=da(e,t+r,t+a)),o}function Sh(e,t,r,n){return Dn(e,t,1,r,n)}function $h(e,t,r,n){return Dn(e,t,2,wr(e,t+1,n),n)}function kh(e,t,r,n){return Dn(e,t,3,_r(e,t+1,n),n)}function Uh(e,t,r,n){return Dn(e,t,5,Tr(e,t+1,n),n)}function jh(e,t,r,n){let i=xr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer string lengths not supported`);return Dn(e,t,9,i,n)}var Nh=qi;function Qr(e,t,r,n){return new Y(N.array,n,r)}function Ph(e,t,r,n){return Qr(e,t,1,r)}function Bh(e,t,r,n){return Qr(e,t,2,wr(e,t+1,n))}function Ch(e,t,r,n){return Qr(e,t,3,_r(e,t+1,n))}function Rh(e,t,r,n){return Qr(e,t,5,Tr(e,t+1,n))}function Mh(e,t,r,n){let i=xr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer array lengths not supported`);return Qr(e,t,9,i)}function Lh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return Qr(e,t,1,1/0)}function ya(e,t){dt(e,N.array.majorEncoded,t.value)}ya.compareTokens=Er.compareTokens;ya.encodedSize=function(e){return dt.encodedSize(e.value)};function Zr(e,t,r,n){return new Y(N.map,n,r)}function Dh(e,t,r,n){return Zr(e,t,1,r)}function Vh(e,t,r,n){return Zr(e,t,2,wr(e,t+1,n))}function Fh(e,t,r,n){return Zr(e,t,3,_r(e,t+1,n))}function zh(e,t,r,n){return Zr(e,t,5,Tr(e,t+1,n))}function qh(e,t,r,n){let i=xr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer map lengths not supported`);return Zr(e,t,9,i)}function Kh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return Zr(e,t,1,1/0)}function ma(e,t){dt(e,N.map.majorEncoded,t.value)}ma.compareTokens=Er.compareTokens;ma.encodedSize=function(e){return dt.encodedSize(e.value)};function Gh(e,t,r,n){return new Y(N.tag,r,1)}function Hh(e,t,r,n){return new Y(N.tag,wr(e,t+1,n),2)}function Wh(e,t,r,n){return new Y(N.tag,_r(e,t+1,n),3)}function Jh(e,t,r,n){return new Y(N.tag,Tr(e,t+1,n),5)}function Xh(e,t,r,n){return new Y(N.tag,xr(e,t+1,n),9)}function ga(e,t){dt(e,N.tag.majorEncoded,t.value)}ga.compareTokens=Er.compareTokens;ga.encodedSize=function(e){return dt.encodedSize(e.value)};var Yh=20,Qh=21,Zh=22,ey=23;function ty(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${he} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new Y(N.null,null,1):new Y(N.undefined,void 0,1)}function ry(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return new Y(N.break,void 0,1)}function va(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${he} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${he} Infinity values are not supported`)}return new Y(N.float,e,t)}function ny(e,t,r,n){return va(wa(e,t+1),3,n)}function iy(e,t,r,n){return va(_a(e,t+1),5,n)}function oy(e,t,r,n){return va(mc(e,t+1),9,n)}function ba(e,t,r){let n=t.value;if(n===!1)e.push([N.float.majorEncoded|Yh]);else if(n===!0)e.push([N.float.majorEncoded|Qh]);else if(n===null)e.push([N.float.majorEncoded|Zh]);else if(n===void 0)e.push([N.float.majorEncoded|ey]);else{let i,a=!1;(!r||r.float64!==!0)&&(hc(n),i=wa(_t,1),n===i||Number.isNaN(n)?(_t[0]=249,e.push(_t.slice(0,3)),a=!0):(yc(n),i=_a(_t,1),n===i&&(_t[0]=250,e.push(_t.slice(0,5)),a=!0))),a||(ay(n),i=mc(_t,1),_t[0]=251,e.push(_t.slice(0,9)))}}ba.encodedSize=function(e,t){let r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!t||t.float64!==!0){hc(r);let n=wa(_t,1);if(r===n||Number.isNaN(r))return 3;if(yc(r),n=_a(_t,1),r===n)return 5}return 9};var pc=new ArrayBuffer(9),ft=new DataView(pc,1),_t=new Uint8Array(pc,0);function hc(e){if(e===1/0)ft.setUint16(0,31744,!1);else if(e===-1/0)ft.setUint16(0,64512,!1);else if(Number.isNaN(e))ft.setUint16(0,32256,!1);else{ft.setFloat32(0,e);let t=ft.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)ft.setUint16(0,31744,!1);else if(r===0)ft.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?ft.setUint16(0,0):i<-14?ft.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):ft.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function wa(e,t){if(e.length-t<2)throw new Error(`${he} 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,a;return n===0?a=i*2**-24:n!==31?a=(i+1024)*2**(n-25):a=i===0?1/0:NaN,r&32768?-a:a}function yc(e){ft.setFloat32(0,e,!1)}function _a(e,t){if(e.length-t<4)throw new Error(`${he} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function ay(e){ft.setFloat64(0,e,!1)}function mc(e,t){if(e.length-t<8)throw new Error(`${he} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}ba.compareTokens=Er.compareTokens;function Ee(e,t,r){throw new Error(`${he} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ki(e){return()=>{throw new Error(`${he} ${e}`)}}var oe=[];for(let e=0;e<=23;e++)oe[e]=Ee;oe[24]=hh;oe[25]=yh;oe[26]=mh;oe[27]=gh;oe[28]=Ee;oe[29]=Ee;oe[30]=Ee;oe[31]=Ee;for(let e=32;e<=55;e++)oe[e]=Ee;oe[56]=vh;oe[57]=bh;oe[58]=wh;oe[59]=_h;oe[60]=Ee;oe[61]=Ee;oe[62]=Ee;oe[63]=Ee;for(let e=64;e<=87;e++)oe[e]=Th;oe[88]=xh;oe[89]=Eh;oe[90]=Oh;oe[91]=Ih;oe[92]=Ee;oe[93]=Ee;oe[94]=Ee;oe[95]=Ki("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)oe[e]=Sh;oe[120]=$h;oe[121]=kh;oe[122]=Uh;oe[123]=jh;oe[124]=Ee;oe[125]=Ee;oe[126]=Ee;oe[127]=Ki("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)oe[e]=Ph;oe[152]=Bh;oe[153]=Ch;oe[154]=Rh;oe[155]=Mh;oe[156]=Ee;oe[157]=Ee;oe[158]=Ee;oe[159]=Lh;for(let e=160;e<=183;e++)oe[e]=Dh;oe[184]=Vh;oe[185]=Fh;oe[186]=zh;oe[187]=qh;oe[188]=Ee;oe[189]=Ee;oe[190]=Ee;oe[191]=Kh;for(let e=192;e<=215;e++)oe[e]=Gh;oe[216]=Hh;oe[217]=Wh;oe[218]=Jh;oe[219]=Xh;oe[220]=Ee;oe[221]=Ee;oe[222]=Ee;oe[223]=Ee;for(let e=224;e<=243;e++)oe[e]=Ki("simple values are not supported");oe[244]=Ee;oe[245]=Ee;oe[246]=Ee;oe[247]=ty;oe[248]=Ki("simple values are not supported");oe[249]=ny;oe[250]=iy;oe[251]=oy;oe[252]=Ee;oe[253]=Ee;oe[254]=Ee;oe[255]=ry;var $t=[];for(let e=0;e<24;e++)$t[e]=new Y(N.uint,e,1);for(let e=-1;e>=-24;e--)$t[31-e]=new Y(N.negint,e,1);$t[64]=new Y(N.bytes,new Uint8Array(0),1);$t[96]=new Y(N.string,"",1);$t[128]=new Y(N.array,0,1);$t[160]=new Y(N.map,0,1);$t[244]=new Y(N.false,!1,1);$t[245]=new Y(N.true,!0,1);$t[246]=new Y(N.null,null,1);function Ta(){let e=[];return e[N.uint.major]=Er,e[N.negint.major]=ha,e[N.bytes.major]=qi,e[N.string.major]=Nh,e[N.array.major]=ya,e[N.map.major]=ma,e[N.tag.major]=ga,e[N.float.major]=ba,e}var uO=Ta(),na=new fc,ec=class gc{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(`${br} object contains circular references`);return new gc(r,t)}},Yt={null:new Y(N.null,null),undefined:new Y(N.undefined,void 0),true:new Y(N.true,!0),false:new Y(N.false,!1),emptyArray:new Y(N.array,0),emptyMap:new Y(N.map,0)},tr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new Y(N.float,e):e>=0?new Y(N.uint,e):new Y(N.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new Y(N.uint,e):new Y(N.negint,e)},Uint8Array(e,t,r,n){return new Y(N.bytes,e)},string(e,t,r,n){return new Y(N.string,e)},boolean(e,t,r,n){return e?Yt.true:Yt.false},null(e,t,r,n){return Yt.null},undefined(e,t,r,n){return Yt.undefined},ArrayBuffer(e,t,r,n){return new Y(N.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new Y(N.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Yt.emptyArray,new Y(N.break)]:Yt.emptyArray;n=ec.createCheck(n,e);let i=[],a=0;for(let o of e)i[a++]=Bi(o,r,n);return r.addBreakTokens?[new Y(N.array,e.length),i,new Y(N.break)]:[new Y(N.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",a=i?e.keys():Object.keys(e),o=i?e.size:a.length;if(!o)return r.addBreakTokens===!0?[Yt.emptyMap,new Y(N.break)]:Yt.emptyMap;n=ec.createCheck(n,e);let u=[],l=0;for(let c of a)u[l++]=[Bi(c,r,n),Bi(i?e.get(c):e[c],r,n)];return sy(u,r),r.addBreakTokens?[new Y(N.map,o),u,new Y(N.break)]:[new Y(N.map,o),u]}};tr.Map=tr.Object;tr.Buffer=tr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))tr[`${e}Array`]=tr.DataView;function Bi(e,t={},r){let n=ih(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||tr[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let a=tr[n];if(!a)throw new Error(`${br} unsupported type: ${n}`);return a(e,n,t,r)}function sy(e,t){t.mapSorter&&e.sort(t.mapSorter)}function vc(e,t,r,n){if(Array.isArray(t))for(let i of t)vc(e,i,r,n);else r[t.type.major](e,t,n)}function uy(e,t,r){let n=Bi(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let a=t[n.type.major];if(a.encodedSize){let o=a.encodedSize(n,r),u=new fc(o);if(a(u,n,r),u.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return fa(u.chunks[0])}}return na.reset(),vc(na,n,t,r),na.toBytes(!0)}var cy={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},ly=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=$t[e];if(t===void 0){let r=oe[e];if(!r)throw new Error(`${he} 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}},Bn=Symbol.for("DONE"),Gi=Symbol.for("BREAK");function fy(e,t,r){let n=[];for(let i=0;i<e.value;i++){let a=Cn(t,r);if(a===Gi){if(e.value===1/0)break;throw new Error(`${he} got unexpected break to lengthed array`)}if(a===Bn)throw new Error(`${he} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=a}return n}function dy(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},a=n?new Map:void 0;for(let o=0;o<e.value;o++){let u=Cn(t,r);if(u===Gi){if(e.value===1/0)break;throw new Error(`${he} got unexpected break to lengthed map`)}if(u===Bn)throw new Error(`${he} found map but not enough entries (got ${o} [no key], expected ${e.value})`);if(n!==!0&&typeof u!="string")throw new Error(`${he} non-string keys not supported (got ${typeof u})`);if(r.rejectDuplicateMapKeys===!0&&(n&&a.has(u)||!n&&u in i))throw new Error(`${he} found repeat map key "${u}"`);let l=Cn(t,r);if(l===Bn)throw new Error(`${he} found map but not enough entries (got ${o} [no value], expected ${e.value})`);n?a.set(u,l):i[u]=l}return n?a:i}function Cn(e,t){if(e.done())return Bn;let r=e.next();if(r.type===N.break)return Gi;if(r.type.terminal)return r.value;if(r.type===N.array)return fy(r,e,t);if(r.type===N.map)return dy(r,e,t);if(r.type===N.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Cn(e,t);return t.tags[r.value](n)}throw new Error(`${he} tag not supported (${r.value})`)}throw new Error("unsupported")}function py(e,t){if(!(e instanceof Uint8Array))throw new Error(`${he} data to decode must be a Uint8Array`);t=Object.assign({},cy,t);let r=t.tokenizer||new ly(e,t),n=Cn(r,t);if(n===Bn)throw new Error(`${he} did not find any content to decode`);if(n===Gi)throw new Error(`${he} got unexpected break`);return[n,e.subarray(r.pos())]}function xa(e,t){let[r,n]=py(e,t);if(n.length>0)throw new Error(`${he} too many terminals, data makes no sense`);return r}var hy=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===N.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===N.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[N.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)}[N.negint.major](e,t){this[N.uint.major](e,t)}[N.bytes.major](e,t){throw new Error(`${br} unsupported type: Uint8Array`)}[N.string.major](e,t){this.prefix(e);let r=cc(JSON.stringify(t.value));e.push(r.length>32?fa(r):r)}[N.array.major](e,t){this.prefix(e),this.inRecursive.push({type:N.array,elements:0}),e.push([91])}[N.map.major](e,t){this.prefix(e),this.inRecursive.push({type:N.map,elements:0}),e.push([123])}[N.tag.major](e,t){}[N.float.major](e,t){if(t.type.name==="break"){let a=this.inRecursive.pop();if(a){if(a.type===N.array)e.push([93]);else if(a.type===N.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(`${br} 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 a=0;a<r.length;a++)n[a]=r.charCodeAt(a),!i&&(n[a]===46||n[a]===101||n[a]===69)&&(i=!0);i||(n.push(46),n.push(48)),e.push(n)}};function yy(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${br} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==N.string||n.type!==N.string)throw new Error(`${br} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${br} unexpected duplicate map keys, this is not supported`)}var my={addBreakTokens:!0,mapSorter:yy};function gy(e,t){return t=Object.assign({},my,t),uy(e,new hy,t)}var bc=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(`${he} 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(`${he} 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 u=this.ch();if(o.includes(u))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 Y(N.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(`${he} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${he} 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)),a=parseFloat(i);return r?new Y(N.float,a,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(a)?new Y(a>=0?N.uint:N.negint,a,this._pos-e):new Y(a>=0?N.uint:N.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${he} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,a=0;i<this.data.length&&a<65536;i++,a++){let o=this.data[i];if(o===92||o<32||o>=128)break;if(o===34){let u=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new Y(N.string,u,a)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${he} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let a=0;a<4;a++){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(`${he} unexpected unicode escape character at position ${this._pos}`);i=i*16+o,this._pos++}return i},n=()=>{let i=this.ch(),a=null,o=i>239?4:i>223?3:i>191?2:1;if(this._pos+o>this.data.length)throw new Error(`${he} unexpected unicode sequence at position ${this._pos}`);let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=this.data[this._pos+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=this.data[this._pos+1],l=this.data[this._pos+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=this.data[this._pos+1],l=this.data[this._pos+2],c=this.data[this._pos+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}a===null?(a=65533,o=1):a>65535&&(a-=65536,t.push(a>>>10&1023|55296),a=56320|a&1023),t.push(a),this._pos+=o};for(;!this.done();){let i=this.ch(),a;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${he} unexpected string termination at position ${this._pos}`);switch(a=this.ch(),this._pos++,a){case 34:case 39:case 92:case 47:t.push(a);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(`${he} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new Y(N.string,lc(t),this._pos-e);default:if(i<32)throw new Error(`${he} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${he} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new Y(N.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new Y(N.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new Y(N.null,null,4);case 102:return this.expect([102,97,108,115,101]),new Y(N.false,!1,5);case 116:return this.expect([116,114,117,101]),new Y(N.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(`${he} 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 Y(N.break,void 0,1);if(this.ch()!==44)throw new Error(`${he} 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 Y(N.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 Y(N.break,void 0,1);if(this.ch()!==44)throw new Error(`${he} 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 Y(N.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${he} 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(`${he} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function vy(e,t){return t=Object.assign({tokenizer:new bc(e,t)},t),xa(e,t)}var cO=new Uint8Array(0),by=(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},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 wy(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 a=e.charAt(i),o=a.charCodeAt(0);if(r[o]!==255)throw new TypeError(a+" is ambiguous");r[o]=i}var u=e.length,l=e.charAt(0),c=Math.log(u)/Math.log(256),m=Math.log(256)/Math.log(u);function g(q){if(q instanceof Uint8Array||(ArrayBuffer.isView(q)?q=new Uint8Array(q.buffer,q.byteOffset,q.byteLength):Array.isArray(q)&&(q=Uint8Array.from(q))),!(q instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(q.length===0)return"";for(var Z=0,ae=0,B=0,V=q.length;B!==V&&q[B]===0;)B++,Z++;for(var H=(V-B)*m+1>>>0,se=new Uint8Array(H);B!==V;){for(var F=q[B],ue=0,z=H-1;(F!==0||ue<ae)&&z!==-1;z--,ue++)F+=256*se[z]>>>0,se[z]=F%u>>>0,F=F/u>>>0;if(F!==0)throw new Error("Non-zero carry");ae=ue,B++}for(var pe=H-ae;pe!==H&&se[pe]===0;)pe++;for(var M=l.repeat(Z);pe<H;++pe)M+=e.charAt(se[pe]);return M}function R(q){if(typeof q!="string")throw new TypeError("Expected String");if(q.length===0)return new Uint8Array;var Z=0;if(q[Z]!==" "){for(var ae=0,B=0;q[Z]===l;)ae++,Z++;for(var V=(q.length-Z)*c+1>>>0,H=new Uint8Array(V);q[Z];){var se=r[q.charCodeAt(Z)];if(se===255)return;for(var F=0,ue=V-1;(se!==0||F<B)&&ue!==-1;ue--,F++)se+=u*H[ue]>>>0,H[ue]=se%256>>>0,se=se/256>>>0;if(se!==0)throw new Error("Non-zero carry");B=F,Z++}if(q[Z]!==" "){for(var z=V-B;z!==V&&H[z]===0;)z++;for(var pe=new Uint8Array(ae+(V-z)),M=ae;z!==V;)pe[M++]=H[z++];return pe}}}function j(q){var Z=R(q);if(Z)return Z;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:R,decode:j}}var _y=wy,Ty=_y,xy=Ty,Ey=class{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")}},Oy=class{constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),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 wc(this,e)}},Iy=class{constructor(e){this.decoders=e}or(e){return wc(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},wc=(e,t)=>new Iy({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Ay=class{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Ey(e,t,r),this.decoder=new Oy(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},_c=({name:e,prefix:t,encode:r,decode:n})=>new Ay(e,t,r,n),Tc=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=xy(r,t);return _c({prefix:e,name:t,encode:n,decode:a=>Ea(i(a))})},Sy=(e,t,r,n)=>{let i={};for(let m=0;m<t.length;++m)i[t[m]]=m;let a=e.length;for(;e[a-1]==="=";)--a;let o=new Uint8Array(a*r/8|0),u=0,l=0,c=0;for(let m=0;m<a;++m){let g=i[e[m]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<r|g,u+=r,u>=8&&(u-=8,o[c++]=255&l>>u)}if(u>=r||255&l<<8-u)throw new SyntaxError("Unexpected end of data");return o},$y=(e,t,r)=>{let n=t[t.length-1]==="=",i=(1<<r)-1,a="",o=0,u=0;for(let l=0;l<e.length;++l)for(u=u<<8|e[l],o+=8;o>r;)o-=r,a+=t[i&u>>o];if(o&&(a+=t[i&u<<r-o]),n)for(;a.length*r&7;)a+="=";return a},ot=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>_c({prefix:t,name:e,encode(i){return $y(i,n,r)},decode(i){return Sy(i,n,r,e)}}),Ci=ot({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),lO=ot({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),fO=ot({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),dO=ot({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pO=ot({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hO=ot({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),yO=ot({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),mO=ot({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),gO=ot({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),er=Tc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vO=Tc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),xc={};uc(xc,{Digest:()=>Hi,create:()=>Fi,decode:()=>Vn,equals:()=>Oc});var ky=Ec,tc=128,Uy=127,jy=~Uy,Ny=Math.pow(2,31);function Ec(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Ny;)t[r++]=e&255|tc,e/=128;for(;e&jy;)t[r++]=e&255|tc,e>>>=7;return t[r]=e|0,Ec.bytes=r-n+1,t}var Py=aa,By=128,rc=127;function aa(e,n){var r=0,n=n||0,i=0,a=n,o,u=e.length;do{if(a>=u)throw aa.bytes=0,new RangeError("Could not decode varint");o=e[a++],r+=i<28?(o&rc)<<i:(o&rc)*Math.pow(2,i),i+=7}while(o>=By);return aa.bytes=a-n,r}var Cy=Math.pow(2,7),Ry=Math.pow(2,14),My=Math.pow(2,21),Ly=Math.pow(2,28),Dy=Math.pow(2,35),Vy=Math.pow(2,42),Fy=Math.pow(2,49),zy=Math.pow(2,56),qy=Math.pow(2,63),Ky=function(e){return e<Cy?1:e<Ry?2:e<My?3:e<Ly?4:e<Dy?5:e<Vy?6:e<Fy?7:e<zy?8:e<qy?9:10},Gy={encode:ky,decode:Py,encodingLength:Ky},Hy=Gy,Li=Hy,sa=(e,t=0)=>[Li.decode(e,t),Li.decode.bytes],Di=(e,t,r=0)=>(Li.encode(e,t,r),t),Vi=e=>Li.encodingLength(e),Fi=(e,t)=>{let r=t.byteLength,n=Vi(e),i=n+Vi(r),a=new Uint8Array(i+r);return Di(e,a,0),Di(r,a,n),a.set(t,i),new Hi(e,r,t,a)},Vn=e=>{let t=Ea(e),[r,n]=sa(t),[i,a]=sa(t.subarray(n)),o=t.subarray(n+a);if(o.byteLength!==i)throw new Error("Incorrect length");return new Hi(r,i,o,t)},Oc=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&by(e.bytes,r.bytes)}},Hi=class{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}},nc=(e,t)=>{let{bytes:r,version:n}=e;switch(n){case 0:return Jy(r,ua(e),t||er.encoder);default:return Xy(r,ua(e),t||Ci.encoder)}},ic=new WeakMap,ua=e=>{let t=ic.get(e);if(t==null){let r=new Map;return ic.set(e,r),r}return t},nr=class Ke{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!==Nn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Yy)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ke.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=Fi(t,r);return Ke.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 Ke.equals(this,t)}static equals(t,r){let n=r;return n&&t.code===n.code&&t.version===n.version&&Oc(t.multihash,n.multihash)}toString(t){return nc(this,t)}toJSON(){return{"/":nc(this)}}link(){return this}get[Symbol.toStringTag](){return"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 Ke)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:a,bytes:o}=r;return new Ke(n,i,a,o||oc(n,i,a.bytes))}else if(r[Qy]===!0){let{version:n,multihash:i,code:a}=r,o=Vn(i);return Ke.create(n,a,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!==Nn)throw new Error(`Version 0 CID must use dag-pb (code: ${Nn}) block encoding`);return new Ke(t,r,n,n.bytes)}case 1:{let i=oc(t,r,n.bytes);return new Ke(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return Ke.create(0,Nn,t)}static createV1(t,r){return Ke.create(1,t,r)}static decode(t){let[r,n]=Ke.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=Ke.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 a=i.subarray(r.multihashSize-r.digestSize),o=new Hi(r.multihashCode,r.digestSize,a,i);return[r.version===0?Ke.createV0(o):Ke.createV1(r.codec,o),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[g,R]=sa(t.subarray(r));return r+=R,g},i=n(),a=Nn;if(i===18?(i=0,r=0):a=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,u=n(),l=n(),c=r+l,m=c-o;return{version:i,codec:a,multihashCode:u,digestSize:l,multihashSize:m,size:c}}static parse(t,r){let[n,i]=Wy(t,r),a=Ke.decode(i);if(a.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ua(a).set(n,t),a}},Wy=(e,t)=>{switch(e[0]){case"Q":{let r=t||er;return[er.prefix,r.decode(`${er.prefix}${e}`)]}case er.prefix:{let r=t||er;return[er.prefix,r.decode(e)]}case Ci.prefix:{let r=t||Ci;return[Ci.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}},Jy=(e,t,r)=>{let{prefix:n}=r;if(n!==er.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let a=r.encode(e).slice(1);return t.set(n,a),a}else return i},Xy=(e,t,r)=>{let{prefix:n}=r,i=t.get(n);if(i==null){let a=r.encode(e);return t.set(n,a),a}else return i},Nn=112,Yy=18,oc=(e,t,r)=>{let n=Vi(e),i=n+Vi(t),a=new Uint8Array(i+r.byteLength);return Di(e,a,0),Di(t,a,n),a.set(r,i),a},Qy=Symbol.for("@ipld/js-cid/CID"),Ic=({name:e,code:t,encode:r})=>new Zy(e,t,r),Zy=class{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Fi(this.code,t):t.then(r=>Fi(this.code,r))}else throw Error("Unknown type, must be binary type")}},Ac=ot({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bO=ot({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wO=ot({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_O=ot({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function em(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=nr.asCID(e);if(!t)return null;let r=t.toString();return[new Y(N.map,1/0,1),new Y(N.string,"/",1),new Y(N.string,r,r.length),new Y(N.break,void 0,1)]}function zi(e){let t=Ac.encode(e).slice(1);return[new Y(N.map,1/0,1),new Y(N.string,"/",1),new Y(N.map,1/0,1),new Y(N.string,"bytes",5),new Y(N.string,t,t.length),new Y(N.break,void 0,1),new Y(N.break,void 0,1)]}function wt(e){return zi(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function tm(e){return zi(new Uint8Array(e))}function rm(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function nm(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 im={typeEncoders:{Object:em,Buffer:zi,Uint8Array:zi,Int8Array:wt,Uint16Array:wt,Int16Array:wt,Uint32Array:wt,Int32Array:wt,Float32Array:wt,Float64Array:wt,Uint8ClampedArray:wt,BigInt64Array:wt,BigUint64Array:wt,DataView:wt,ArrayBuffer:tm,undefined:rm,number:nm}},om=class extends bc{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===N.map){let t=this._next();if(t.type===N.string&&t.value==="/"){let r=this._next();if(r.type===N.string){if(this._next().type!==N.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new Y(N.tag,42,0)}if(r.type===N.map){let n=this._next();if(n.type===N.string&&n.value==="bytes"){let i=this._next();if(i.type===N.string){for(let o=0;o<2;o++)if(this._next().type!==N.break)throw new Error("Invalid encoded Bytes form");let a=Ac.decode(`m${i.value}`);return new Y(N.bytes,a,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},ca={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};ca.tags[42]=nr.parse;var am="dag-json",Sc=297,Oa=e=>gy(e,im),Wi=e=>{let t=Object.assign(ca,{tokenizer:new om(e,ca)});return vy(e,t)},ac=e=>sm.decode(Oa(e)),sm=new TextDecoder,um=e=>Wi(cm.encode(e)),cm=new TextEncoder;function lm(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function sc(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 fm(e,t){lm(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var dm=e=>e instanceof Uint8Array,ia=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),St=(e,t)=>e<<32-t|e>>>t,pm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!pm)throw new Error("Non little-endian hardware is not supported");function hm(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function $c(e){if(typeof e=="string"&&(e=hm(e)),!dm(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var ym=class{clone(){return this._cloneInto()}},TO={}.toString;function mm(e){let t=n=>e().update($c(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function gm(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),a=BigInt(4294967295),o=Number(r>>i&a),u=Number(r&a),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,u,n)}var vm=class extends ym{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ia(this.buffer)}update(e){sc(this);let{view:t,buffer:r,blockLen:n}=this;e=$c(e);let i=e.length;for(let a=0;a<i;){let o=Math.min(n-this.pos,i-a);if(o===n){let u=ia(e);for(;n<=i-a;a+=n)this.process(u,a);continue}r.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){sc(this),fm(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>n-a&&(this.process(r,0),a=0);for(let m=a;m<n;m++)t[m]=0;gm(r,n-8,BigInt(this.length*8),i),this.process(r,0);let o=ia(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=u/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)o.setUint32(4*m,c[m],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:a,pos:o}=this;return e.length=n,e.pos=o,e.finished=i,e.destroyed=a,n%t&&e.buffer.set(r),e}},bm=(e,t,r)=>e&t^~e&r,wm=(e,t,r)=>e&t^e&r^t&r,_m=new Uint32Array([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]),Qt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Zt=new Uint32Array(64),Tm=class extends vm{constructor(){super(64,32,8,!1),this.A=Qt[0]|0,this.B=Qt[1]|0,this.C=Qt[2]|0,this.D=Qt[3]|0,this.E=Qt[4]|0,this.F=Qt[5]|0,this.G=Qt[6]|0,this.H=Qt[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:a,G:o,H:u}=this;return[e,t,r,n,i,a,o,u]}set(e,t,r,n,i,a,o,u){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=u|0}process(e,t){for(let m=0;m<16;m++,t+=4)Zt[m]=e.getUint32(t,!1);for(let m=16;m<64;m++){let g=Zt[m-15],R=Zt[m-2],j=St(g,7)^St(g,18)^g>>>3,q=St(R,17)^St(R,19)^R>>>10;Zt[m]=q+Zt[m-7]+j+Zt[m-16]|0}let{A:r,B:n,C:i,D:a,E:o,F:u,G:l,H:c}=this;for(let m=0;m<64;m++){let g=St(o,6)^St(o,11)^St(o,25),R=c+g+bm(o,u,l)+_m[m]+Zt[m]|0,j=(St(r,2)^St(r,13)^St(r,22))+wm(r,n,i)|0;c=l,l=u,u=o,o=a+R|0,a=i,i=n,n=r,r=R+j|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,u=u+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,a,o,u,l,c)}roundClean(){Zt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},xm=mm(()=>new Tm),Em=Object.create,Ia=Object.defineProperty,Om=Object.getOwnPropertyDescriptor,kc=Object.getOwnPropertyNames,Im=Object.getPrototypeOf,Am=Object.prototype.hasOwnProperty,Sm=(e,t,r)=>t in e?Ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Uc=(e,t)=>function(){return t||(0,e[kc(e)[0]])((t={exports:{}}).exports,t),t.exports},$m=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kc(t))!Am.call(e,i)&&i!==r&&Ia(e,i,{get:()=>t[i],enumerable:!(n=Om(t,i))||n.enumerable});return e},jc=(e,t,r)=>(r=e!=null?Em(Im(e)):{},$m(t||!e||!e.__esModule?Ia(r,"default",{value:e,enumerable:!0}):r,e)),ir=(e,t,r)=>(Sm(e,typeof t!="symbol"?t+"":t,r),r),km=Uc({"../../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(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},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",a=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=a,e.isDeno=o}}),Um=Uc({"../../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,a=n.cmp&&function(u){return function(l){return function(c,m){var g={key:c,value:l[c]},R={key:m,value:l[m]};return u(g,R)}}}(n.cmp),o=[];return function u(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,m;if(Array.isArray(l)){for(m="[",c=0;c<l.length;c++)c&&(m+=","),m+=u(l[c])||"null";return m+"]"}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,R=Object.keys(l).sort(a&&a(l));for(m="",c=0;c<R.length;c++){var j=R[c],q=u(l[j]);q&&(m&&(m+=","),m+=JSON.stringify(j)+":"+q)}return o.splice(g,1),"{"+m+"}"}}(r)}}}),Rn=jc(km(),1),jm=jc(Um(),1),Nc=!1,Pc=!1;Rn.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Nc=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(Pc=process?.env?.LOGGER_PERF_PREFIX==="true"));var Nm=Object.freeze({prefix:void 0,time:Nc,delta:Pc,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0}),oa=[],Bc=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].join(",")}]`}},Cc=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Pn=!1,Ye=class{static setup(e=Ye.INFO,t={}){t=Object.assign({},Nm,t),e>10&&console.debug("setup logger",{config:t});let r=this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}),n=(...u)=>{window?.FORCE_DISABLE_LOGLEVEL&&r(...u)};n.isDisabled=!0,n.isEnabled=!1;let i=this.wrapLog(console.groupCollapsed,t),a=(u,l)=>{function c(...g){let R=g[g.length-1];return R===n?R():(i(...g.slice(0,-1)),(async()=>{try{let j=R();return j instanceof Promise?await j:j}finally{console.groupEnd()}})())}let m=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:c,force:l});return u?m:Object.assign(n.bind({}),{isEnabled:u,isDisabled:!u,group:c,force:m})},o=a(e>=Ye.ERROR,this.wrapLog(console.error,t));return{ERROR:(...u)=>(o(...u),new Error((0,jm.default)(u))),WARN:a(e>=Ye.WARN,this.wrapLog(console.warn,t)),LOG:a(e>=Ye.INFO,this.wrapLog(console.log,t)),DEBUG:a(e>=Ye.DEBUG,this.wrapLog(console.log,{...t,dim:t.dimDebugOnServer})),VERBOSE:a(e>=Ye.VERBOSE,this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}))}}static wrapLog(e,t){if(Rn.isNode)return e.bind(console);{let r=[];if(t.time||t.delta){let n=Rn.isBrowser&&navigator.userAgent.includes("Chrome")?["",Ye.timeStr(!!t.time,!!t.delta)]:[];r.push(...n)}return t.prefix&&(Pn?r.push(new Cc("dim",t.prefix)):r.push(t.prefix)),e.bind(console,...r)}}static timeStr(e,t,r=0){if(!performance.now)return;let n=performance.now();Ye.firstLog||(Ye.firstLog=n,Ye.lastLog=n);let i=new Bc(n-Ye.firstLog,n-Ye.lastLog,e,t);return Ye.lastLog=n,r?i.toString():i}static getOriginFromStack(e){let t=!1;for(let r of e.split(`
|
|
2
|
-
`)){let n=r.match(/^\s+at\s+(.*)/);if(n){if(t)return n[1].trim().replace(__dirname,"");t=!0}}}},
|
|
1
|
+
import{b as bi,d as Ro,e as Mo,f as wi,g as gt}from"./chunk-SOBCOB7T.min.js";var Ru=bi((oE,Cu)=>{"use strict";Cu.exports=Wo;var Bu=128,Op=127,Ap=~Op,Ip=Math.pow(2,31);function Wo(e,t,r){if(Number.MAX_SAFE_INTEGER&&e>Number.MAX_SAFE_INTEGER)throw Wo.bytes=0,new RangeError("Could not encode varint");t=t||[],r=r||0;for(var n=r;e>=Ip;)t[r++]=e&255|Bu,e/=128;for(;e&Ap;)t[r++]=e&255|Bu,e>>>=7;return t[r]=e|0,Wo.bytes=r-n+1,t}});var Du=bi((aE,Lu)=>{"use strict";Lu.exports=Jo;var Sp=128,Mu=127;function Jo(e,n){var r=0,n=n||0,i=0,a=n,o,u=e.length;do{if(a>=u||i>49)throw Jo.bytes=0,new RangeError("Could not decode varint");o=e[a++],r+=i<28?(o&Mu)<<i:(o&Mu)*Math.pow(2,i),i+=7}while(o>=Sp);return Jo.bytes=a-n,r}});var Fu=bi((sE,Vu)=>{"use strict";var $p=Math.pow(2,7),kp=Math.pow(2,14),Up=Math.pow(2,21),jp=Math.pow(2,28),Np=Math.pow(2,35),Pp=Math.pow(2,42),Bp=Math.pow(2,49),Cp=Math.pow(2,56),Rp=Math.pow(2,63);Vu.exports=function(e){return e<$p?1:e<kp?2:e<Up?3:e<jp?4:e<Np?5:e<Pp?6:e<Bp?7:e<Cp?8:e<Rp?9:10}});var Ni=bi((uE,zu)=>{"use strict";zu.exports={encode:Ru(),decode:Du(),encodingLength:Fu()}});var Wd=["string","number","bigint","symbol"],Jd=["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 Us(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(Wd.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(Xd(e))return"Buffer";let r=Yd(e);return r||"Object"}function Xd(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Yd(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Jd.includes(t))return t}var D=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};D.uint=new D(0,"uint",!0);D.negint=new D(1,"negint",!0);D.bytes=new D(2,"bytes",!0);D.string=new D(3,"string",!0);D.array=new D(4,"array",!1);D.map=new D(5,"map",!1);D.tag=new D(6,"tag",!1);D.float=new D(7,"float",!0);D.false=new D(7,"false",!0);D.true=new D(7,"true",!0);D.null=new D(7,"null",!0);D.undefined=new D(7,"undefined",!0);D.break=new D(7,"break",!0);var ce=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};var qr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Qd=new TextDecoder,Zd=new TextEncoder;function _i(e){return qr&&globalThis.Buffer.isBuffer(e)}function Bs(e){return e instanceof Uint8Array?_i(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Cs=qr?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Ns(e,t,r):(e,t,r)=>r-t>64?Qd.decode(e.subarray(t,r)):Ns(e,t,r),Rs=qr?e=>e.length>64?globalThis.Buffer.from(e):js(e):e=>e.length>64?Zd.encode(e):js(e);var Kr=qr?(e,t,r)=>_i(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ms=qr?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Bs(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},Ls=qr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Ds(e,t){if(_i(e)&&_i(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 js(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):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}function Ns(e,t,r){let n=[];for(;t<r;){let i=e[t],a=null,o=i>239?4:i>223?3:i>191?2:1;if(t+o<=r){let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=e[t+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=e[t+1],l=e[t+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=e[t+1],l=e[t+2],c=e[t+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),t+=o}return ep(n)}var Ps=4096;function ep(e){let t=e.length;if(t<=Ps)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Ps));return r}var tp=256,Ti=class{constructor(t=tp){this.chunkSize=t,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(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let i=r.length-(this.maxCursor-this.cursor)-1;r.set(t,i)}else{if(r){let i=r.length-(this.maxCursor-this.cursor)-1;i<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,i),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=Ls(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=Kr(n,0,this.cursor)}else r=Ms(this.chunks,this.cursor);return t&&this.reset(),r}};var ve="CBOR decode error:",Lo="CBOR encode error:",En=[];En[23]=1;En[24]=2;En[25]=3;En[26]=5;En[27]=9;function Ct(e,t,r){if(e.length-t<r)throw new Error(`${ve} not enough data for type`)}var Ve=[24,256,65536,4294967296,BigInt("18446744073709551616")];function tt(e,t,r){Ct(e,t,1);let n=e[t];if(r.strict===!0&&n<Ve[0])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function rt(e,t,r){Ct(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Ve[1])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function nt(e,t,r){Ct(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Ve[2])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);return n}function it(e,t,r){Ct(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],a=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&a<Ve[3])throw new Error(`${ve} integer encoded in more bytes than necessary (strict decode)`);if(a<=Number.MAX_SAFE_INTEGER)return Number(a);if(r.allowBigInt===!0)return a;throw new Error(`${ve} integers outside of the safe integer range are not supported`)}function Vs(e,t,r,n){return new ce(D.uint,tt(e,t+1,n),2)}function Fs(e,t,r,n){return new ce(D.uint,rt(e,t+1,n),3)}function zs(e,t,r,n){return new ce(D.uint,nt(e,t+1,n),5)}function qs(e,t,r,n){return new ce(D.uint,it(e,t+1,n),9)}function ct(e,t){return Fe(e,0,t.value)}function Fe(e,t,r){if(r<Ve[0]){let n=Number(r);e.push([t|n])}else if(r<Ve[1]){let n=Number(r);e.push([t|24,n])}else if(r<Ve[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Ve[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<Ve[4]){let i=[t|27,0,0,0,0,0,0,0],a=Number(n&BigInt(4294967295)),o=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=a&255,a=a>>8,i[7]=a&255,a=a>>8,i[6]=a&255,a=a>>8,i[5]=a&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(`${ve} encountered BigInt larger than allowable range`)}}ct.encodedSize=function(t){return Fe.encodedSize(t.value)};Fe.encodedSize=function(t){return t<Ve[0]?1:t<Ve[1]?2:t<Ve[2]?3:t<Ve[3]?5:9};ct.compareTokens=function(t,r){return t.value<r.value?-1:t.value>r.value?1:0};function Ks(e,t,r,n){return new ce(D.negint,-1-tt(e,t+1,n),2)}function Gs(e,t,r,n){return new ce(D.negint,-1-rt(e,t+1,n),3)}function Hs(e,t,r,n){return new ce(D.negint,-1-nt(e,t+1,n),5)}var Do=BigInt(-1),Ws=BigInt(1);function Js(e,t,r,n){let i=it(e,t+1,n);if(typeof i!="bigint"){let a=-1-i;if(a>=Number.MIN_SAFE_INTEGER)return new ce(D.negint,a,9)}if(n.allowBigInt!==!0)throw new Error(`${ve} integers outside of the safe integer range are not supported`);return new ce(D.negint,Do-BigInt(i),9)}function xi(e,t){let r=t.value,n=typeof r=="bigint"?r*Do-Ws:r*-1-1;Fe(e,t.type.majorEncoded,n)}xi.encodedSize=function(t){let r=t.value,n=typeof r=="bigint"?r*Do-Ws:r*-1-1;return n<Ve[0]?1:n<Ve[1]?2:n<Ve[2]?3:n<Ve[3]?5:9};xi.compareTokens=function(t,r){return t.value<r.value?1:t.value>r.value?-1:0};function On(e,t,r,n){Ct(e,t,r+n);let i=Kr(e,t+r,t+r+n);return new ce(D.bytes,i,r+n)}function Xs(e,t,r,n){return On(e,t,1,r)}function Ys(e,t,r,n){return On(e,t,2,tt(e,t+1,n))}function Qs(e,t,r,n){return On(e,t,3,rt(e,t+1,n))}function Zs(e,t,r,n){return On(e,t,5,nt(e,t+1,n))}function eu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer bytes lengths not supported`);return On(e,t,9,i)}function Ei(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===D.string?Rs(e.value):e.value),e.encodedBytes}function Gr(e,t){let r=Ei(t);Fe(e,t.type.majorEncoded,r.length),e.push(r)}Gr.encodedSize=function(t){let r=Ei(t);return Fe.encodedSize(r.length)+r.length};Gr.compareTokens=function(t,r){return np(Ei(t),Ei(r))};function np(e,t){return e.length<t.length?-1:e.length>t.length?1:Ds(e,t)}function An(e,t,r,n,i){let a=r+n;Ct(e,t,a);let o=new ce(D.string,Cs(e,t+r,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=Kr(e,t+r,t+a)),o}function tu(e,t,r,n){return An(e,t,1,r,n)}function ru(e,t,r,n){return An(e,t,2,tt(e,t+1,n),n)}function nu(e,t,r,n){return An(e,t,3,rt(e,t+1,n),n)}function iu(e,t,r,n){return An(e,t,5,nt(e,t+1,n),n)}function ou(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer string lengths not supported`);return An(e,t,9,i,n)}var au=Gr;function Hr(e,t,r,n){return new ce(D.array,n,r)}function su(e,t,r,n){return Hr(e,t,1,r)}function uu(e,t,r,n){return Hr(e,t,2,tt(e,t+1,n))}function cu(e,t,r,n){return Hr(e,t,3,rt(e,t+1,n))}function lu(e,t,r,n){return Hr(e,t,5,nt(e,t+1,n))}function fu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer array lengths not supported`);return Hr(e,t,9,i)}function du(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return Hr(e,t,1,1/0)}function Oi(e,t){Fe(e,D.array.majorEncoded,t.value)}Oi.compareTokens=ct.compareTokens;Oi.encodedSize=function(t){return Fe.encodedSize(t.value)};function Wr(e,t,r,n){return new ce(D.map,n,r)}function pu(e,t,r,n){return Wr(e,t,1,r)}function hu(e,t,r,n){return Wr(e,t,2,tt(e,t+1,n))}function yu(e,t,r,n){return Wr(e,t,3,rt(e,t+1,n))}function mu(e,t,r,n){return Wr(e,t,5,nt(e,t+1,n))}function gu(e,t,r,n){let i=it(e,t+1,n);if(typeof i=="bigint")throw new Error(`${ve} 64-bit integer map lengths not supported`);return Wr(e,t,9,i)}function vu(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return Wr(e,t,1,1/0)}function Ai(e,t){Fe(e,D.map.majorEncoded,t.value)}Ai.compareTokens=ct.compareTokens;Ai.encodedSize=function(t){return Fe.encodedSize(t.value)};function bu(e,t,r,n){return new ce(D.tag,r,1)}function wu(e,t,r,n){return new ce(D.tag,tt(e,t+1,n),2)}function _u(e,t,r,n){return new ce(D.tag,rt(e,t+1,n),3)}function Tu(e,t,r,n){return new ce(D.tag,nt(e,t+1,n),5)}function xu(e,t,r,n){return new ce(D.tag,it(e,t+1,n),9)}function Ii(e,t){Fe(e,D.tag.majorEncoded,t.value)}Ii.compareTokens=ct.compareTokens;Ii.encodedSize=function(t){return Fe.encodedSize(t.value)};var cp=20,lp=21,fp=22,dp=23;function Eu(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${ve} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ce(D.null,null,1):new ce(D.undefined,void 0,1)}function Ou(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${ve} indefinite length items not allowed`);return new ce(D.break,void 0,1)}function Vo(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${ve} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${ve} Infinity values are not supported`)}return new ce(D.float,e,t)}function Au(e,t,r,n){return Vo(Fo(e,t+1),3,n)}function Iu(e,t,r,n){return Vo(zo(e,t+1),5,n)}function Su(e,t,r,n){return Vo(ju(e,t+1),9,n)}function Si(e,t,r){let n=t.value;if(n===!1)e.push([D.float.majorEncoded|cp]);else if(n===!0)e.push([D.float.majorEncoded|lp]);else if(n===null)e.push([D.float.majorEncoded|fp]);else if(n===void 0)e.push([D.float.majorEncoded|dp]);else{let i,a=!1;(!r||r.float64!==!0)&&(ku(n),i=Fo(vt,1),n===i||Number.isNaN(n)?(vt[0]=249,e.push(vt.slice(0,3)),a=!0):(Uu(n),i=zo(vt,1),n===i&&(vt[0]=250,e.push(vt.slice(0,5)),a=!0))),a||(pp(n),i=ju(vt,1),vt[0]=251,e.push(vt.slice(0,9)))}}Si.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){ku(n);let i=Fo(vt,1);if(n===i||Number.isNaN(n))return 3;if(Uu(n),i=zo(vt,1),n===i)return 5}return 9};var $u=new ArrayBuffer(9),lt=new DataView($u,1),vt=new Uint8Array($u,0);function ku(e){if(e===1/0)lt.setUint16(0,31744,!1);else if(e===-1/0)lt.setUint16(0,64512,!1);else if(Number.isNaN(e))lt.setUint16(0,32256,!1);else{lt.setFloat32(0,e);let t=lt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)lt.setUint16(0,31744,!1);else if(r===0)lt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?lt.setUint16(0,0):i<-14?lt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):lt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Fo(e,t){if(e.length-t<2)throw new Error(`${ve} 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,a;return n===0?a=i*2**-24:n!==31?a=(i+1024)*2**(n-25):a=i===0?1/0:NaN,r&32768?-a:a}function Uu(e){lt.setFloat32(0,e,!1)}function zo(e,t){if(e.length-t<4)throw new Error(`${ve} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function pp(e){lt.setFloat64(0,e,!1)}function ju(e,t){if(e.length-t<8)throw new Error(`${ve} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Si.compareTokens=ct.compareTokens;function xe(e,t,r){throw new Error(`${ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function $i(e){return()=>{throw new Error(`${ve} ${e}`)}}var ie=[];for(let e=0;e<=23;e++)ie[e]=xe;ie[24]=Vs;ie[25]=Fs;ie[26]=zs;ie[27]=qs;ie[28]=xe;ie[29]=xe;ie[30]=xe;ie[31]=xe;for(let e=32;e<=55;e++)ie[e]=xe;ie[56]=Ks;ie[57]=Gs;ie[58]=Hs;ie[59]=Js;ie[60]=xe;ie[61]=xe;ie[62]=xe;ie[63]=xe;for(let e=64;e<=87;e++)ie[e]=Xs;ie[88]=Ys;ie[89]=Qs;ie[90]=Zs;ie[91]=eu;ie[92]=xe;ie[93]=xe;ie[94]=xe;ie[95]=$i("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ie[e]=tu;ie[120]=ru;ie[121]=nu;ie[122]=iu;ie[123]=ou;ie[124]=xe;ie[125]=xe;ie[126]=xe;ie[127]=$i("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ie[e]=su;ie[152]=uu;ie[153]=cu;ie[154]=lu;ie[155]=fu;ie[156]=xe;ie[157]=xe;ie[158]=xe;ie[159]=du;for(let e=160;e<=183;e++)ie[e]=pu;ie[184]=hu;ie[185]=yu;ie[186]=mu;ie[187]=gu;ie[188]=xe;ie[189]=xe;ie[190]=xe;ie[191]=vu;for(let e=192;e<=215;e++)ie[e]=bu;ie[216]=wu;ie[217]=_u;ie[218]=Tu;ie[219]=xu;ie[220]=xe;ie[221]=xe;ie[222]=xe;ie[223]=xe;for(let e=224;e<=243;e++)ie[e]=$i("simple values are not supported");ie[244]=xe;ie[245]=xe;ie[246]=xe;ie[247]=Eu;ie[248]=$i("simple values are not supported");ie[249]=Au;ie[250]=Iu;ie[251]=Su;ie[252]=xe;ie[253]=xe;ie[254]=xe;ie[255]=Ou;var bt=[];for(let e=0;e<24;e++)bt[e]=new ce(D.uint,e,1);for(let e=-1;e>=-24;e--)bt[31-e]=new ce(D.negint,e,1);bt[64]=new ce(D.bytes,new Uint8Array(0),1);bt[96]=new ce(D.string,"",1);bt[128]=new ce(D.array,0,1);bt[160]=new ce(D.map,0,1);bt[244]=new ce(D.false,!1,1);bt[245]=new ce(D.true,!0,1);bt[246]=new ce(D.null,null,1);function qo(){let e=[];return e[D.uint.major]=ct,e[D.negint.major]=xi,e[D.bytes.major]=Gr,e[D.string.major]=au,e[D.array.major]=Oi,e[D.map.major]=Ai,e[D.tag.major]=Ii,e[D.float.major]=Si,e}var Wx=qo(),Jx=new Ti,Ui=class e{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(`${Lo} object contains circular references`);return new e(r,t)}},Gt={null:new ce(D.null,null),undefined:new ce(D.undefined,void 0),true:new ce(D.true,!0),false:new ce(D.false,!1),emptyArray:new ce(D.array,0),emptyMap:new ce(D.map,0)},Ht={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ce(D.float,e):e>=0?new ce(D.uint,e):new ce(D.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ce(D.uint,e):new ce(D.negint,e)},Uint8Array(e,t,r,n){return new ce(D.bytes,e)},string(e,t,r,n){return new ce(D.string,e)},boolean(e,t,r,n){return e?Gt.true:Gt.false},null(e,t,r,n){return Gt.null},undefined(e,t,r,n){return Gt.undefined},ArrayBuffer(e,t,r,n){return new ce(D.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ce(D.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Gt.emptyArray,new ce(D.break)]:Gt.emptyArray;n=Ui.createCheck(n,e);let i=[],a=0;for(let o of e)i[a++]=ki(o,r,n);return r.addBreakTokens?[new ce(D.array,e.length),i,new ce(D.break)]:[new ce(D.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",a=i?e.keys():Object.keys(e),o=i?e.size:a.length;if(!o)return r.addBreakTokens===!0?[Gt.emptyMap,new ce(D.break)]:Gt.emptyMap;n=Ui.createCheck(n,e);let u=[],l=0;for(let c of a)u[l++]=[ki(c,r,n),ki(i?e.get(c):e[c],r,n)];return mp(u,r),r.addBreakTokens?[new ce(D.map,o),u,new ce(D.break)]:[new ce(D.map,o),u]}};Ht.Map=Ht.Object;Ht.Buffer=Ht.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Ht[`${e}Array`]=Ht.DataView;function ki(e,t={},r){let n=Us(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Ht[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let a=Ht[n];if(!a)throw new Error(`${Lo} unsupported type: ${n}`);return a(e,n,t,r)}function mp(e,t){t.mapSorter&&e.sort(t.mapSorter)}var gp={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Ko=class{constructor(t,r={}){this._pos=0,this.data=t,this.options=r}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let t=this.data[this._pos],r=bt[t];if(r===void 0){let n=ie[t];if(!n)throw new Error(`${ve} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let i=t&31;r=n(this.data,this._pos,i,this.options)}return this._pos+=r.encodedLength,r}},In=Symbol.for("DONE"),ji=Symbol.for("BREAK");function vp(e,t,r){let n=[];for(let i=0;i<e.value;i++){let a=Sn(t,r);if(a===ji){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed array`)}if(a===In)throw new Error(`${ve} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=a}return n}function bp(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},a=n?new Map:void 0;for(let o=0;o<e.value;o++){let u=Sn(t,r);if(u===ji){if(e.value===1/0)break;throw new Error(`${ve} got unexpected break to lengthed map`)}if(u===In)throw new Error(`${ve} found map but not enough entries (got ${o} [no key], expected ${e.value})`);if(n!==!0&&typeof u!="string")throw new Error(`${ve} non-string keys not supported (got ${typeof u})`);if(r.rejectDuplicateMapKeys===!0&&(n&&a.has(u)||!n&&u in i))throw new Error(`${ve} found repeat map key "${u}"`);let l=Sn(t,r);if(l===In)throw new Error(`${ve} found map but not enough entries (got ${o} [no value], expected ${e.value})`);n?a.set(u,l):i[u]=l}return n?a:i}function Sn(e,t){if(e.done())return In;let r=e.next();if(r.type===D.break)return ji;if(r.type.terminal)return r.value;if(r.type===D.array)return vp(r,e,t);if(r.type===D.map)return bp(r,e,t);if(r.type===D.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Sn(e,t);return t.tags[r.value](n)}throw new Error(`${ve} tag not supported (${r.value})`)}throw new Error("unsupported")}function Nu(e,t){if(!(e instanceof Uint8Array))throw new Error(`${ve} data to decode must be a Uint8Array`);t=Object.assign({},gp,t);let r=t.tokenizer||new Ko(e,t),n=Sn(r,t);if(n===In)throw new Error(`${ve} did not find any content to decode`);if(n===ji)throw new Error(`${ve} got unexpected break`);return[n,e.subarray(r.pos())]}function Go(e,t){let[r,n]=Nu(e,t);if(n.length>0)throw new Error(`${ve} too many terminals, data makes no sense`);return r}var Tp=42;function xp(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return gt.decode(e.subarray(1))}var Pu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Pu.tags[Tp]=xp;var Ho=e=>Go(e,Pu);var Wt=Ro(Ni(),1),$n={SHA2_256:18,LENGTH:32,DAG_PB:112},Xo=40;function Jr(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Wt.default.decode(e);return t.seek(Wt.default.decode.bytes),r}function Yo(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=0;return{version:2,characteristics:[t.getBigUint64(r,!0),t.getBigUint64(r+=8,!0)],dataOffset:Number(t.getBigUint64(r+=8,!0)),dataSize:Number(t.getBigUint64(r+=8,!0)),indexOffset:Number(t.getBigUint64(r+=8,!0))}}function Qo(e){Wt.default.decode(e);let t=Wt.default.decode.bytes,r=Wt.default.decode(e.subarray(Wt.default.decode.bytes)),n=Wt.default.decode.bytes;return t+n+r}var Jt={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},kn={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Jt.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Jt.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=kn["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 a=e[i];if(a=kn["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:Jt.Int,CarV1HeaderOrV2Pragma:e=>{if(Jt.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=kn["CarV1HeaderOrV2Pragma > roots (anon)"](e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=kn.Int(e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},Un={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Jt.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Jt.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Un["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 a=e[i];if(a=Un["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:Jt.Int,CarV1HeaderOrV2Pragma:e=>{if(Jt.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=Un["CarV1HeaderOrV2Pragma > roots (anon)"](o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=Un.Int(o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},Zo={toTyped:kn.CarV1HeaderOrV2Pragma,toRepresentation:Un.CarV1HeaderOrV2Pragma};var bE=qo();var Vp=Ro(Ni(),1);var EE=[new ce(D.map,2),new ce(D.string,"version"),new ce(D.uint,1),new ce(D.string,"roots")],OE=new ce(D.tag,42);async function ea(e,t){let r=Jr(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Ho(n);if(Zo.toTyped(i)===void 0)throw new Error("Invalid CAR header format");if(i.version!==1&&i.version!==2||t!==void 0&&i.version!==t)throw new Error(`Invalid CAR version: ${i.version}${t!==void 0?` (expected ${t})`:""}`);if(i.version===1){if(!Array.isArray(i.roots))throw new Error("Invalid CAR header format");return i}if(i.roots!==void 0)throw new Error("Invalid CAR header format");let a=Yo(await e.exactly(Xo,!0));e.seek(a.dataOffset-e.pos);let o=await ea(e,1);return Object.assign(o,a)}async function zp(e){let t=await e.exactly(2,!1);if(t[0]===$n.SHA2_256&&t[1]===$n.LENGTH){let o=await e.exactly(34,!0),u=wi(o);return gt.create(0,$n.DAG_PB,u)}let r=Jr(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Jr(await e.upTo(8),e),i=await e.exactly(Qo(await e.upTo(8)),!0),a=wi(i);return gt.create(r,n,a)}async function qu(e){let t=e.pos,r=Jr(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await zp(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function qp(e){let{cid:t,blockLength:r}=await qu(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Kp(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await qu(e),a={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(a.blockLength),a}function Xt(e){let t=(async()=>{let r=await ea(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Hp(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await qp(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Kp(e)}}}function gr(e){let t=0;return{async upTo(r){return e.subarray(t,t+Math.min(r,e.length-t))},async exactly(r,n=!1){if(r>e.length-t)throw new Error("Unexpected end of data");let i=e.subarray(t,t+r);return n&&(t+=r),i},seek(r){t+=r},get pos(){return t}}}function Gp(e){let t=0,r=0,n=0,i=new Uint8Array(0),a=async o=>{r=i.length-n;let u=[i.subarray(n)];for(;r<o;){let c=await e();if(c==null)break;r<0?c.length>r&&u.push(c.subarray(-r)):u.push(c),r+=c.length}i=new Uint8Array(u.reduce((c,m)=>c+m.length,0));let l=0;for(let c of u)i.set(c,l),l+=c.length;n=0};return{async upTo(o){return i.length-n<o&&await a(o),i.subarray(n,n+Math.min(i.length-n,o))},async exactly(o,u=!1){if(i.length-n<o&&await a(o),i.length-n<o)throw new Error("Unexpected end of data");let l=i.subarray(n,n+o);return u&&(t+=o,n+=o),l},seek(o){t+=o,n+=o},get pos(){return t}}}function Yt(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Gp(r)}function Hp(e,t){let r=0;return{async upTo(n){let i=await e.upTo(n);return i.length+r>t&&(i=i.subarray(0,t-r)),i},async exactly(n,i=!1){let a=await e.exactly(n,i);if(a.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),a},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var jn=class{constructor(t,r,n){this._version=t,this._roots=r,this._iterator=n}get version(){return this._version}async getRoots(){return this._roots}[Symbol.asyncIterator](){return this._iterator}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Ku(gr(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Ku(Yt(t))}};async function Ku(e){let t=Xt(e),{version:r,roots:n}=await t.header();return new jn(r,n,t.blocksIndex())}var vr=class{constructor(t,r){this._header=t,this._blocks=r,this._keys=r.map(n=>n.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(t){return this._keys.indexOf(t.toString())>-1}async get(t){let r=this._keys.indexOf(t.toString());return r>-1?this._blocks[r]:void 0}async*blocks(){for(let t of this._blocks)yield t}async*cids(){for(let t of this._blocks)yield t.cid}static async fromBytes(t){if(!(t instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Gu(gr(t))}static async fromIterable(t){if(!t||typeof t[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Gu(Yt(t))}};async function Gu(e){let t=Xt(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new vr(r,n)}var Pi=class{constructor(t,r,n){this._version=t,this._roots=r,this._iterable=n,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},ta=class e extends Pi{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Hu(t);return new e(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Wu(t);return new e(r,n,i)}},ra=class e extends Pi{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;let t=this._iterable[Symbol.asyncIterator]();return{async next(){let r=await t.next();return r.done?r:{done:!1,value:r.value.cid}}}}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Hu(t);return new e(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Wu(t);return new e(r,n,i)}};async function Hu(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Ju(gr(e))}async function Wu(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Ju(Yt(e))}async function Ju(e){let t=Xt(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var Wp=Ro(Ni(),1);var Xu=class{constructor(t){this._iterator=t}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};var Jp=Object.create,la=Object.defineProperty,Xp=Object.getOwnPropertyDescriptor,Yp=Object.getOwnPropertyNames,Qp=Object.getPrototypeOf,Zp=Object.prototype.hasOwnProperty,Le=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),uc=(e,t)=>{for(var r in t)la(e,r,{get:t[r],enumerable:!0})},eh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Yp(t))!Zp.call(e,i)&&i!==r&&la(e,i,{get:()=>t[i],enumerable:!(n=Xp(t,i))||n.enumerable});return e},nr=(e,t,r)=>(r=e!=null?Jp(Qp(e)):{},eh(t||!e||!e.__esModule?la(r,"default",{value:e,enumerable:!0}):r,e)),th={};uc(th,{code:()=>Sc,decode:()=>Wi,encode:()=>Oa,format:()=>ac,name:()=>am,parse:()=>um,stringify:()=>ac});var rh=["string","number","bigint","symbol"],nh=["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 ih(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return rh.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":oh(e)?"Buffer":ah(e)||"Object"}function oh(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function ah(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(nh.includes(t))return t}var N=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}};N.uint=new N(0,"uint",!0);N.negint=new N(1,"negint",!0);N.bytes=new N(2,"bytes",!0);N.string=new N(3,"string",!0);N.array=new N(4,"array",!1);N.map=new N(5,"map",!1);N.tag=new N(6,"tag",!1);N.float=new N(7,"float",!0);N.false=new N(7,"false",!0);N.true=new N(7,"true",!0);N.null=new N(7,"null",!0);N.undefined=new N(7,"undefined",!0);N.break=new N(7,"break",!0);var Y=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}`}},Xr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",sh=new TextDecoder,uh=new TextEncoder;function Ri(e){return Xr&&globalThis.Buffer.isBuffer(e)}function fa(e){return e instanceof Uint8Array?Ri(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var ch=Xr?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Qu(e,t,r):(e,t,r)=>r-t>64?sh.decode(e.subarray(t,r)):Qu(e,t,r),cc=Xr?e=>e.length>64?globalThis.Buffer.from(e):Yu(e):e=>e.length>64?uh.encode(e):Yu(e);var da=Xr?(e,t,r)=>Ri(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),lh=Xr?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),fa(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},fh=Xr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function dh(e,t){if(Ri(e)&&Ri(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 Yu(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):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}function Qu(e,t,r){let n=[];for(;t<r;){let i=e[t],a=null,o=i>239?4:i>223?3:i>191?2:1;if(t+o<=r){let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=e[t+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=e[t+1],l=e[t+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=e[t+1],l=e[t+2],c=e[t+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),t+=o}return lc(n)}var Zu=4096;function lc(e){let t=e.length;if(t<=Zu)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Zu));return r}var ph=256,fc=class{constructor(e=ph){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=fh(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=da(r,0,this.cursor)}else t=lh(this.chunks,this.cursor);return e&&this.reset(),t}},he="CBOR decode error:",br="CBOR encode error:",Mn=[];Mn[23]=1;Mn[24]=2;Mn[25]=3;Mn[26]=5;Mn[27]=9;function Yr(e,t,r){if(e.length-t<r)throw new Error(`${he} not enough data for type`)}var ze=[24,256,65536,4294967296,BigInt("18446744073709551616")];function wr(e,t,r){Yr(e,t,1);let n=e[t];if(r.strict===!0&&n<ze[0])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function _r(e,t,r){Yr(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ze[1])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function Tr(e,t,r){Yr(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ze[2])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);return n}function xr(e,t,r){Yr(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],a=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&a<ze[3])throw new Error(`${he} integer encoded in more bytes than necessary (strict decode)`);if(a<=Number.MAX_SAFE_INTEGER)return Number(a);if(r.allowBigInt===!0)return a;throw new Error(`${he} integers outside of the safe integer range are not supported`)}function hh(e,t,r,n){return new Y(N.uint,wr(e,t+1,n),2)}function yh(e,t,r,n){return new Y(N.uint,_r(e,t+1,n),3)}function mh(e,t,r,n){return new Y(N.uint,Tr(e,t+1,n),5)}function gh(e,t,r,n){return new Y(N.uint,xr(e,t+1,n),9)}function Er(e,t){return dt(e,0,t.value)}function dt(e,t,r){if(r<ze[0]){let n=Number(r);e.push([t|n])}else if(r<ze[1]){let n=Number(r);e.push([t|24,n])}else if(r<ze[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ze[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<ze[4]){let i=[t|27,0,0,0,0,0,0,0],a=Number(n&BigInt(4294967295)),o=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=a&255,a=a>>8,i[7]=a&255,a=a>>8,i[6]=a&255,a=a>>8,i[5]=a&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(`${he} encountered BigInt larger than allowable range`)}}Er.encodedSize=function(e){return dt.encodedSize(e.value)};dt.encodedSize=function(e){return e<ze[0]?1:e<ze[1]?2:e<ze[2]?3:e<ze[3]?5:9};Er.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function vh(e,t,r,n){return new Y(N.negint,-1-wr(e,t+1,n),2)}function bh(e,t,r,n){return new Y(N.negint,-1-_r(e,t+1,n),3)}function wh(e,t,r,n){return new Y(N.negint,-1-Tr(e,t+1,n),5)}var pa=BigInt(-1),dc=BigInt(1);function _h(e,t,r,n){let i=xr(e,t+1,n);if(typeof i!="bigint"){let a=-1-i;if(a>=Number.MIN_SAFE_INTEGER)return new Y(N.negint,a,9)}if(n.allowBigInt!==!0)throw new Error(`${he} integers outside of the safe integer range are not supported`);return new Y(N.negint,pa-BigInt(i),9)}function ha(e,t){let r=t.value,n=typeof r=="bigint"?r*pa-dc:r*-1-1;dt(e,t.type.majorEncoded,n)}ha.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*pa-dc:t*-1-1;return r<ze[0]?1:r<ze[1]?2:r<ze[2]?3:r<ze[3]?5:9};ha.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Ln(e,t,r,n){Yr(e,t,r+n);let i=da(e,t+r,t+r+n);return new Y(N.bytes,i,r+n)}function Th(e,t,r,n){return Ln(e,t,1,r)}function xh(e,t,r,n){return Ln(e,t,2,wr(e,t+1,n))}function Eh(e,t,r,n){return Ln(e,t,3,_r(e,t+1,n))}function Oh(e,t,r,n){return Ln(e,t,5,Tr(e,t+1,n))}function Ah(e,t,r,n){let i=xr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer bytes lengths not supported`);return Ln(e,t,9,i)}function Mi(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===N.string?cc(e.value):e.value),e.encodedBytes}function qi(e,t){let r=Mi(t);dt(e,t.type.majorEncoded,r.length),e.push(r)}qi.encodedSize=function(e){let t=Mi(e);return dt.encodedSize(t.length)+t.length};qi.compareTokens=function(e,t){return Ih(Mi(e),Mi(t))};function Ih(e,t){return e.length<t.length?-1:e.length>t.length?1:dh(e,t)}function Dn(e,t,r,n,i){let a=r+n;Yr(e,t,a);let o=new Y(N.string,ch(e,t+r,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=da(e,t+r,t+a)),o}function Sh(e,t,r,n){return Dn(e,t,1,r,n)}function $h(e,t,r,n){return Dn(e,t,2,wr(e,t+1,n),n)}function kh(e,t,r,n){return Dn(e,t,3,_r(e,t+1,n),n)}function Uh(e,t,r,n){return Dn(e,t,5,Tr(e,t+1,n),n)}function jh(e,t,r,n){let i=xr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer string lengths not supported`);return Dn(e,t,9,i,n)}var Nh=qi;function Qr(e,t,r,n){return new Y(N.array,n,r)}function Ph(e,t,r,n){return Qr(e,t,1,r)}function Bh(e,t,r,n){return Qr(e,t,2,wr(e,t+1,n))}function Ch(e,t,r,n){return Qr(e,t,3,_r(e,t+1,n))}function Rh(e,t,r,n){return Qr(e,t,5,Tr(e,t+1,n))}function Mh(e,t,r,n){let i=xr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer array lengths not supported`);return Qr(e,t,9,i)}function Lh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return Qr(e,t,1,1/0)}function ya(e,t){dt(e,N.array.majorEncoded,t.value)}ya.compareTokens=Er.compareTokens;ya.encodedSize=function(e){return dt.encodedSize(e.value)};function Zr(e,t,r,n){return new Y(N.map,n,r)}function Dh(e,t,r,n){return Zr(e,t,1,r)}function Vh(e,t,r,n){return Zr(e,t,2,wr(e,t+1,n))}function Fh(e,t,r,n){return Zr(e,t,3,_r(e,t+1,n))}function zh(e,t,r,n){return Zr(e,t,5,Tr(e,t+1,n))}function qh(e,t,r,n){let i=xr(e,t+1,n);if(typeof i=="bigint")throw new Error(`${he} 64-bit integer map lengths not supported`);return Zr(e,t,9,i)}function Kh(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return Zr(e,t,1,1/0)}function ma(e,t){dt(e,N.map.majorEncoded,t.value)}ma.compareTokens=Er.compareTokens;ma.encodedSize=function(e){return dt.encodedSize(e.value)};function Gh(e,t,r,n){return new Y(N.tag,r,1)}function Hh(e,t,r,n){return new Y(N.tag,wr(e,t+1,n),2)}function Wh(e,t,r,n){return new Y(N.tag,_r(e,t+1,n),3)}function Jh(e,t,r,n){return new Y(N.tag,Tr(e,t+1,n),5)}function Xh(e,t,r,n){return new Y(N.tag,xr(e,t+1,n),9)}function ga(e,t){dt(e,N.tag.majorEncoded,t.value)}ga.compareTokens=Er.compareTokens;ga.encodedSize=function(e){return dt.encodedSize(e.value)};var Yh=20,Qh=21,Zh=22,ey=23;function ty(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${he} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new Y(N.null,null,1):new Y(N.undefined,void 0,1)}function ry(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${he} indefinite length items not allowed`);return new Y(N.break,void 0,1)}function va(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${he} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${he} Infinity values are not supported`)}return new Y(N.float,e,t)}function ny(e,t,r,n){return va(wa(e,t+1),3,n)}function iy(e,t,r,n){return va(_a(e,t+1),5,n)}function oy(e,t,r,n){return va(mc(e,t+1),9,n)}function ba(e,t,r){let n=t.value;if(n===!1)e.push([N.float.majorEncoded|Yh]);else if(n===!0)e.push([N.float.majorEncoded|Qh]);else if(n===null)e.push([N.float.majorEncoded|Zh]);else if(n===void 0)e.push([N.float.majorEncoded|ey]);else{let i,a=!1;(!r||r.float64!==!0)&&(hc(n),i=wa(_t,1),n===i||Number.isNaN(n)?(_t[0]=249,e.push(_t.slice(0,3)),a=!0):(yc(n),i=_a(_t,1),n===i&&(_t[0]=250,e.push(_t.slice(0,5)),a=!0))),a||(ay(n),i=mc(_t,1),_t[0]=251,e.push(_t.slice(0,9)))}}ba.encodedSize=function(e,t){let r=e.value;if(r===!1||r===!0||r===null||r===void 0)return 1;if(!t||t.float64!==!0){hc(r);let n=wa(_t,1);if(r===n||Number.isNaN(r))return 3;if(yc(r),n=_a(_t,1),r===n)return 5}return 9};var pc=new ArrayBuffer(9),ft=new DataView(pc,1),_t=new Uint8Array(pc,0);function hc(e){if(e===1/0)ft.setUint16(0,31744,!1);else if(e===-1/0)ft.setUint16(0,64512,!1);else if(Number.isNaN(e))ft.setUint16(0,32256,!1);else{ft.setFloat32(0,e);let t=ft.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)ft.setUint16(0,31744,!1);else if(r===0)ft.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?ft.setUint16(0,0):i<-14?ft.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):ft.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function wa(e,t){if(e.length-t<2)throw new Error(`${he} 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,a;return n===0?a=i*2**-24:n!==31?a=(i+1024)*2**(n-25):a=i===0?1/0:NaN,r&32768?-a:a}function yc(e){ft.setFloat32(0,e,!1)}function _a(e,t){if(e.length-t<4)throw new Error(`${he} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function ay(e){ft.setFloat64(0,e,!1)}function mc(e,t){if(e.length-t<8)throw new Error(`${he} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}ba.compareTokens=Er.compareTokens;function Ee(e,t,r){throw new Error(`${he} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ki(e){return()=>{throw new Error(`${he} ${e}`)}}var oe=[];for(let e=0;e<=23;e++)oe[e]=Ee;oe[24]=hh;oe[25]=yh;oe[26]=mh;oe[27]=gh;oe[28]=Ee;oe[29]=Ee;oe[30]=Ee;oe[31]=Ee;for(let e=32;e<=55;e++)oe[e]=Ee;oe[56]=vh;oe[57]=bh;oe[58]=wh;oe[59]=_h;oe[60]=Ee;oe[61]=Ee;oe[62]=Ee;oe[63]=Ee;for(let e=64;e<=87;e++)oe[e]=Th;oe[88]=xh;oe[89]=Eh;oe[90]=Oh;oe[91]=Ah;oe[92]=Ee;oe[93]=Ee;oe[94]=Ee;oe[95]=Ki("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)oe[e]=Sh;oe[120]=$h;oe[121]=kh;oe[122]=Uh;oe[123]=jh;oe[124]=Ee;oe[125]=Ee;oe[126]=Ee;oe[127]=Ki("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)oe[e]=Ph;oe[152]=Bh;oe[153]=Ch;oe[154]=Rh;oe[155]=Mh;oe[156]=Ee;oe[157]=Ee;oe[158]=Ee;oe[159]=Lh;for(let e=160;e<=183;e++)oe[e]=Dh;oe[184]=Vh;oe[185]=Fh;oe[186]=zh;oe[187]=qh;oe[188]=Ee;oe[189]=Ee;oe[190]=Ee;oe[191]=Kh;for(let e=192;e<=215;e++)oe[e]=Gh;oe[216]=Hh;oe[217]=Wh;oe[218]=Jh;oe[219]=Xh;oe[220]=Ee;oe[221]=Ee;oe[222]=Ee;oe[223]=Ee;for(let e=224;e<=243;e++)oe[e]=Ki("simple values are not supported");oe[244]=Ee;oe[245]=Ee;oe[246]=Ee;oe[247]=ty;oe[248]=Ki("simple values are not supported");oe[249]=ny;oe[250]=iy;oe[251]=oy;oe[252]=Ee;oe[253]=Ee;oe[254]=Ee;oe[255]=ry;var $t=[];for(let e=0;e<24;e++)$t[e]=new Y(N.uint,e,1);for(let e=-1;e>=-24;e--)$t[31-e]=new Y(N.negint,e,1);$t[64]=new Y(N.bytes,new Uint8Array(0),1);$t[96]=new Y(N.string,"",1);$t[128]=new Y(N.array,0,1);$t[160]=new Y(N.map,0,1);$t[244]=new Y(N.false,!1,1);$t[245]=new Y(N.true,!0,1);$t[246]=new Y(N.null,null,1);function Ta(){let e=[];return e[N.uint.major]=Er,e[N.negint.major]=ha,e[N.bytes.major]=qi,e[N.string.major]=Nh,e[N.array.major]=ya,e[N.map.major]=ma,e[N.tag.major]=ga,e[N.float.major]=ba,e}var uO=Ta(),na=new fc,ec=class gc{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(`${br} object contains circular references`);return new gc(r,t)}},Qt={null:new Y(N.null,null),undefined:new Y(N.undefined,void 0),true:new Y(N.true,!0),false:new Y(N.false,!1),emptyArray:new Y(N.array,0),emptyMap:new Y(N.map,0)},rr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new Y(N.float,e):e>=0?new Y(N.uint,e):new Y(N.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new Y(N.uint,e):new Y(N.negint,e)},Uint8Array(e,t,r,n){return new Y(N.bytes,e)},string(e,t,r,n){return new Y(N.string,e)},boolean(e,t,r,n){return e?Qt.true:Qt.false},null(e,t,r,n){return Qt.null},undefined(e,t,r,n){return Qt.undefined},ArrayBuffer(e,t,r,n){return new Y(N.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new Y(N.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Qt.emptyArray,new Y(N.break)]:Qt.emptyArray;n=ec.createCheck(n,e);let i=[],a=0;for(let o of e)i[a++]=Bi(o,r,n);return r.addBreakTokens?[new Y(N.array,e.length),i,new Y(N.break)]:[new Y(N.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",a=i?e.keys():Object.keys(e),o=i?e.size:a.length;if(!o)return r.addBreakTokens===!0?[Qt.emptyMap,new Y(N.break)]:Qt.emptyMap;n=ec.createCheck(n,e);let u=[],l=0;for(let c of a)u[l++]=[Bi(c,r,n),Bi(i?e.get(c):e[c],r,n)];return sy(u,r),r.addBreakTokens?[new Y(N.map,o),u,new Y(N.break)]:[new Y(N.map,o),u]}};rr.Map=rr.Object;rr.Buffer=rr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))rr[`${e}Array`]=rr.DataView;function Bi(e,t={},r){let n=ih(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||rr[n];if(typeof i=="function"){let o=i(e,n,t,r);if(o!=null)return o}let a=rr[n];if(!a)throw new Error(`${br} unsupported type: ${n}`);return a(e,n,t,r)}function sy(e,t){t.mapSorter&&e.sort(t.mapSorter)}function vc(e,t,r,n){if(Array.isArray(t))for(let i of t)vc(e,i,r,n);else r[t.type.major](e,t,n)}function uy(e,t,r){let n=Bi(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let a=t[n.type.major];if(a.encodedSize){let o=a.encodedSize(n,r),u=new fc(o);if(a(u,n,r),u.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return fa(u.chunks[0])}}return na.reset(),vc(na,n,t,r),na.toBytes(!0)}var cy={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},ly=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=$t[e];if(t===void 0){let r=oe[e];if(!r)throw new Error(`${he} 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}},Bn=Symbol.for("DONE"),Gi=Symbol.for("BREAK");function fy(e,t,r){let n=[];for(let i=0;i<e.value;i++){let a=Cn(t,r);if(a===Gi){if(e.value===1/0)break;throw new Error(`${he} got unexpected break to lengthed array`)}if(a===Bn)throw new Error(`${he} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=a}return n}function dy(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},a=n?new Map:void 0;for(let o=0;o<e.value;o++){let u=Cn(t,r);if(u===Gi){if(e.value===1/0)break;throw new Error(`${he} got unexpected break to lengthed map`)}if(u===Bn)throw new Error(`${he} found map but not enough entries (got ${o} [no key], expected ${e.value})`);if(n!==!0&&typeof u!="string")throw new Error(`${he} non-string keys not supported (got ${typeof u})`);if(r.rejectDuplicateMapKeys===!0&&(n&&a.has(u)||!n&&u in i))throw new Error(`${he} found repeat map key "${u}"`);let l=Cn(t,r);if(l===Bn)throw new Error(`${he} found map but not enough entries (got ${o} [no value], expected ${e.value})`);n?a.set(u,l):i[u]=l}return n?a:i}function Cn(e,t){if(e.done())return Bn;let r=e.next();if(r.type===N.break)return Gi;if(r.type.terminal)return r.value;if(r.type===N.array)return fy(r,e,t);if(r.type===N.map)return dy(r,e,t);if(r.type===N.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Cn(e,t);return t.tags[r.value](n)}throw new Error(`${he} tag not supported (${r.value})`)}throw new Error("unsupported")}function py(e,t){if(!(e instanceof Uint8Array))throw new Error(`${he} data to decode must be a Uint8Array`);t=Object.assign({},cy,t);let r=t.tokenizer||new ly(e,t),n=Cn(r,t);if(n===Bn)throw new Error(`${he} did not find any content to decode`);if(n===Gi)throw new Error(`${he} got unexpected break`);return[n,e.subarray(r.pos())]}function xa(e,t){let[r,n]=py(e,t);if(n.length>0)throw new Error(`${he} too many terminals, data makes no sense`);return r}var hy=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===N.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===N.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[N.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)}[N.negint.major](e,t){this[N.uint.major](e,t)}[N.bytes.major](e,t){throw new Error(`${br} unsupported type: Uint8Array`)}[N.string.major](e,t){this.prefix(e);let r=cc(JSON.stringify(t.value));e.push(r.length>32?fa(r):r)}[N.array.major](e,t){this.prefix(e),this.inRecursive.push({type:N.array,elements:0}),e.push([91])}[N.map.major](e,t){this.prefix(e),this.inRecursive.push({type:N.map,elements:0}),e.push([123])}[N.tag.major](e,t){}[N.float.major](e,t){if(t.type.name==="break"){let a=this.inRecursive.pop();if(a){if(a.type===N.array)e.push([93]);else if(a.type===N.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(`${br} 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 a=0;a<r.length;a++)n[a]=r.charCodeAt(a),!i&&(n[a]===46||n[a]===101||n[a]===69)&&(i=!0);i||(n.push(46),n.push(48)),e.push(n)}};function yy(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${br} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==N.string||n.type!==N.string)throw new Error(`${br} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${br} unexpected duplicate map keys, this is not supported`)}var my={addBreakTokens:!0,mapSorter:yy};function gy(e,t){return t=Object.assign({},my,t),uy(e,new hy,t)}var bc=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(`${he} 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(`${he} 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 u=this.ch();if(o.includes(u))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 Y(N.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(`${he} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${he} 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)),a=parseFloat(i);return r?new Y(N.float,a,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(a)?new Y(a>=0?N.uint:N.negint,a,this._pos-e):new Y(a>=0?N.uint:N.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${he} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,a=0;i<this.data.length&&a<65536;i++,a++){let o=this.data[i];if(o===92||o<32||o>=128)break;if(o===34){let u=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new Y(N.string,u,a)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${he} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let a=0;a<4;a++){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(`${he} unexpected unicode escape character at position ${this._pos}`);i=i*16+o,this._pos++}return i},n=()=>{let i=this.ch(),a=null,o=i>239?4:i>223?3:i>191?2:1;if(this._pos+o>this.data.length)throw new Error(`${he} unexpected unicode sequence at position ${this._pos}`);let u,l,c,m;switch(o){case 1:i<128&&(a=i);break;case 2:u=this.data[this._pos+1],(u&192)===128&&(m=(i&31)<<6|u&63,m>127&&(a=m));break;case 3:u=this.data[this._pos+1],l=this.data[this._pos+2],(u&192)===128&&(l&192)===128&&(m=(i&15)<<12|(u&63)<<6|l&63,m>2047&&(m<55296||m>57343)&&(a=m));break;case 4:u=this.data[this._pos+1],l=this.data[this._pos+2],c=this.data[this._pos+3],(u&192)===128&&(l&192)===128&&(c&192)===128&&(m=(i&15)<<18|(u&63)<<12|(l&63)<<6|c&63,m>65535&&m<1114112&&(a=m))}a===null?(a=65533,o=1):a>65535&&(a-=65536,t.push(a>>>10&1023|55296),a=56320|a&1023),t.push(a),this._pos+=o};for(;!this.done();){let i=this.ch(),a;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${he} unexpected string termination at position ${this._pos}`);switch(a=this.ch(),this._pos++,a){case 34:case 39:case 92:case 47:t.push(a);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(`${he} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new Y(N.string,lc(t),this._pos-e);default:if(i<32)throw new Error(`${he} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${he} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new Y(N.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new Y(N.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new Y(N.null,null,4);case 102:return this.expect([102,97,108,115,101]),new Y(N.false,!1,5);case 116:return this.expect([116,114,117,101]),new Y(N.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(`${he} 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 Y(N.break,void 0,1);if(this.ch()!==44)throw new Error(`${he} 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 Y(N.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 Y(N.break,void 0,1);if(this.ch()!==44)throw new Error(`${he} 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 Y(N.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${he} 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(`${he} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function vy(e,t){return t=Object.assign({tokenizer:new bc(e,t)},t),xa(e,t)}var cO=new Uint8Array(0),by=(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},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 wy(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 a=e.charAt(i),o=a.charCodeAt(0);if(r[o]!==255)throw new TypeError(a+" is ambiguous");r[o]=i}var u=e.length,l=e.charAt(0),c=Math.log(u)/Math.log(256),m=Math.log(256)/Math.log(u);function g(q){if(q instanceof Uint8Array||(ArrayBuffer.isView(q)?q=new Uint8Array(q.buffer,q.byteOffset,q.byteLength):Array.isArray(q)&&(q=Uint8Array.from(q))),!(q instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(q.length===0)return"";for(var Z=0,ae=0,B=0,V=q.length;B!==V&&q[B]===0;)B++,Z++;for(var H=(V-B)*m+1>>>0,se=new Uint8Array(H);B!==V;){for(var F=q[B],ue=0,z=H-1;(F!==0||ue<ae)&&z!==-1;z--,ue++)F+=256*se[z]>>>0,se[z]=F%u>>>0,F=F/u>>>0;if(F!==0)throw new Error("Non-zero carry");ae=ue,B++}for(var pe=H-ae;pe!==H&&se[pe]===0;)pe++;for(var M=l.repeat(Z);pe<H;++pe)M+=e.charAt(se[pe]);return M}function R(q){if(typeof q!="string")throw new TypeError("Expected String");if(q.length===0)return new Uint8Array;var Z=0;if(q[Z]!==" "){for(var ae=0,B=0;q[Z]===l;)ae++,Z++;for(var V=(q.length-Z)*c+1>>>0,H=new Uint8Array(V);q[Z];){var se=r[q.charCodeAt(Z)];if(se===255)return;for(var F=0,ue=V-1;(se!==0||F<B)&&ue!==-1;ue--,F++)se+=u*H[ue]>>>0,H[ue]=se%256>>>0,se=se/256>>>0;if(se!==0)throw new Error("Non-zero carry");B=F,Z++}if(q[Z]!==" "){for(var z=V-B;z!==V&&H[z]===0;)z++;for(var pe=new Uint8Array(ae+(V-z)),M=ae;z!==V;)pe[M++]=H[z++];return pe}}}function j(q){var Z=R(q);if(Z)return Z;throw new Error(`Non-${t} character`)}return{encode:g,decodeUnsafe:R,decode:j}}var _y=wy,Ty=_y,xy=Ty,Ey=class{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")}},Oy=class{constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),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 wc(this,e)}},Ay=class{constructor(e){this.decoders=e}or(e){return wc(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},wc=(e,t)=>new Ay({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Iy=class{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Ey(e,t,r),this.decoder=new Oy(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},_c=({name:e,prefix:t,encode:r,decode:n})=>new Iy(e,t,r,n),Tc=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=xy(r,t);return _c({prefix:e,name:t,encode:n,decode:a=>Ea(i(a))})},Sy=(e,t,r,n)=>{let i={};for(let m=0;m<t.length;++m)i[t[m]]=m;let a=e.length;for(;e[a-1]==="=";)--a;let o=new Uint8Array(a*r/8|0),u=0,l=0,c=0;for(let m=0;m<a;++m){let g=i[e[m]];if(g===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<r|g,u+=r,u>=8&&(u-=8,o[c++]=255&l>>u)}if(u>=r||255&l<<8-u)throw new SyntaxError("Unexpected end of data");return o},$y=(e,t,r)=>{let n=t[t.length-1]==="=",i=(1<<r)-1,a="",o=0,u=0;for(let l=0;l<e.length;++l)for(u=u<<8|e[l],o+=8;o>r;)o-=r,a+=t[i&u>>o];if(o&&(a+=t[i&u<<r-o]),n)for(;a.length*r&7;)a+="=";return a},ot=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>_c({prefix:t,name:e,encode(i){return $y(i,n,r)},decode(i){return Sy(i,n,r,e)}}),Ci=ot({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),lO=ot({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),fO=ot({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),dO=ot({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pO=ot({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hO=ot({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),yO=ot({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),mO=ot({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),gO=ot({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),tr=Tc({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vO=Tc({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),xc={};uc(xc,{Digest:()=>Hi,create:()=>Fi,decode:()=>Vn,equals:()=>Oc});var ky=Ec,tc=128,Uy=127,jy=~Uy,Ny=Math.pow(2,31);function Ec(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Ny;)t[r++]=e&255|tc,e/=128;for(;e&jy;)t[r++]=e&255|tc,e>>>=7;return t[r]=e|0,Ec.bytes=r-n+1,t}var Py=aa,By=128,rc=127;function aa(e,n){var r=0,n=n||0,i=0,a=n,o,u=e.length;do{if(a>=u)throw aa.bytes=0,new RangeError("Could not decode varint");o=e[a++],r+=i<28?(o&rc)<<i:(o&rc)*Math.pow(2,i),i+=7}while(o>=By);return aa.bytes=a-n,r}var Cy=Math.pow(2,7),Ry=Math.pow(2,14),My=Math.pow(2,21),Ly=Math.pow(2,28),Dy=Math.pow(2,35),Vy=Math.pow(2,42),Fy=Math.pow(2,49),zy=Math.pow(2,56),qy=Math.pow(2,63),Ky=function(e){return e<Cy?1:e<Ry?2:e<My?3:e<Ly?4:e<Dy?5:e<Vy?6:e<Fy?7:e<zy?8:e<qy?9:10},Gy={encode:ky,decode:Py,encodingLength:Ky},Hy=Gy,Li=Hy,sa=(e,t=0)=>[Li.decode(e,t),Li.decode.bytes],Di=(e,t,r=0)=>(Li.encode(e,t,r),t),Vi=e=>Li.encodingLength(e),Fi=(e,t)=>{let r=t.byteLength,n=Vi(e),i=n+Vi(r),a=new Uint8Array(i+r);return Di(e,a,0),Di(r,a,n),a.set(t,i),new Hi(e,r,t,a)},Vn=e=>{let t=Ea(e),[r,n]=sa(t),[i,a]=sa(t.subarray(n)),o=t.subarray(n+a);if(o.byteLength!==i)throw new Error("Incorrect length");return new Hi(r,i,o,t)},Oc=(e,t)=>{if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&by(e.bytes,r.bytes)}},Hi=class{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}},nc=(e,t)=>{let{bytes:r,version:n}=e;switch(n){case 0:return Jy(r,ua(e),t||tr.encoder);default:return Xy(r,ua(e),t||Ci.encoder)}},ic=new WeakMap,ua=e=>{let t=ic.get(e);if(t==null){let r=new Map;return ic.set(e,r),r}return t},Rt=class Ke{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!==Nn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Yy)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return Ke.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=Fi(t,r);return Ke.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 Ke.equals(this,t)}static equals(t,r){let n=r;return n&&t.code===n.code&&t.version===n.version&&Oc(t.multihash,n.multihash)}toString(t){return nc(this,t)}toJSON(){return{"/":nc(this)}}link(){return this}get[Symbol.toStringTag](){return"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 Ke)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:a,bytes:o}=r;return new Ke(n,i,a,o||oc(n,i,a.bytes))}else if(r[Qy]===!0){let{version:n,multihash:i,code:a}=r,o=Vn(i);return Ke.create(n,a,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!==Nn)throw new Error(`Version 0 CID must use dag-pb (code: ${Nn}) block encoding`);return new Ke(t,r,n,n.bytes)}case 1:{let i=oc(t,r,n.bytes);return new Ke(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return Ke.create(0,Nn,t)}static createV1(t,r){return Ke.create(1,t,r)}static decode(t){let[r,n]=Ke.decodeFirst(t);if(n.length)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=Ke.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 a=i.subarray(r.multihashSize-r.digestSize),o=new Hi(r.multihashCode,r.digestSize,a,i);return[r.version===0?Ke.createV0(o):Ke.createV1(r.codec,o),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[g,R]=sa(t.subarray(r));return r+=R,g},i=n(),a=Nn;if(i===18?(i=0,r=0):a=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let o=r,u=n(),l=n(),c=r+l,m=c-o;return{version:i,codec:a,multihashCode:u,digestSize:l,multihashSize:m,size:c}}static parse(t,r){let[n,i]=Wy(t,r),a=Ke.decode(i);if(a.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return ua(a).set(n,t),a}},Wy=(e,t)=>{switch(e[0]){case"Q":{let r=t||tr;return[tr.prefix,r.decode(`${tr.prefix}${e}`)]}case tr.prefix:{let r=t||tr;return[tr.prefix,r.decode(e)]}case Ci.prefix:{let r=t||Ci;return[Ci.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}},Jy=(e,t,r)=>{let{prefix:n}=r;if(n!==tr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let a=r.encode(e).slice(1);return t.set(n,a),a}else return i},Xy=(e,t,r)=>{let{prefix:n}=r,i=t.get(n);if(i==null){let a=r.encode(e);return t.set(n,a),a}else return i},Nn=112,Yy=18,oc=(e,t,r)=>{let n=Vi(e),i=n+Vi(t),a=new Uint8Array(i+r.byteLength);return Di(e,a,0),Di(t,a,n),a.set(r,i),a},Qy=Symbol.for("@ipld/js-cid/CID"),Ac=({name:e,code:t,encode:r})=>new Zy(e,t,r),Zy=class{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Fi(this.code,t):t.then(r=>Fi(this.code,r))}else throw Error("Unknown type, must be binary type")}},Ic=ot({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),bO=ot({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wO=ot({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),_O=ot({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function em(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Rt.asCID(e);if(!t)return null;let r=t.toString();return[new Y(N.map,1/0,1),new Y(N.string,"/",1),new Y(N.string,r,r.length),new Y(N.break,void 0,1)]}function zi(e){let t=Ic.encode(e).slice(1);return[new Y(N.map,1/0,1),new Y(N.string,"/",1),new Y(N.map,1/0,1),new Y(N.string,"bytes",5),new Y(N.string,t,t.length),new Y(N.break,void 0,1),new Y(N.break,void 0,1)]}function wt(e){return zi(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function tm(e){return zi(new Uint8Array(e))}function rm(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function nm(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 im={typeEncoders:{Object:em,Buffer:zi,Uint8Array:zi,Int8Array:wt,Uint16Array:wt,Int16Array:wt,Uint32Array:wt,Int32Array:wt,Float32Array:wt,Float64Array:wt,Uint8ClampedArray:wt,BigInt64Array:wt,BigUint64Array:wt,DataView:wt,ArrayBuffer:tm,undefined:rm,number:nm}},om=class extends bc{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===N.map){let t=this._next();if(t.type===N.string&&t.value==="/"){let r=this._next();if(r.type===N.string){if(this._next().type!==N.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new Y(N.tag,42,0)}if(r.type===N.map){let n=this._next();if(n.type===N.string&&n.value==="bytes"){let i=this._next();if(i.type===N.string){for(let o=0;o<2;o++)if(this._next().type!==N.break)throw new Error("Invalid encoded Bytes form");let a=Ic.decode(`m${i.value}`);return new Y(N.bytes,a,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},ca={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};ca.tags[42]=Rt.parse;var am="dag-json",Sc=297,Oa=e=>gy(e,im),Wi=e=>{let t=Object.assign(ca,{tokenizer:new om(e,ca)});return vy(e,t)},ac=e=>sm.decode(Oa(e)),sm=new TextDecoder,um=e=>Wi(cm.encode(e)),cm=new TextEncoder;function lm(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function sc(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 fm(e,t){lm(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var dm=e=>e instanceof Uint8Array,ia=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),St=(e,t)=>e<<32-t|e>>>t,pm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!pm)throw new Error("Non little-endian hardware is not supported");function hm(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function $c(e){if(typeof e=="string"&&(e=hm(e)),!dm(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var ym=class{clone(){return this._cloneInto()}},TO={}.toString;function mm(e){let t=n=>e().update($c(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function gm(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),a=BigInt(4294967295),o=Number(r>>i&a),u=Number(r&a),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,u,n)}var vm=class extends ym{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ia(this.buffer)}update(e){sc(this);let{view:t,buffer:r,blockLen:n}=this;e=$c(e);let i=e.length;for(let a=0;a<i;){let o=Math.min(n-this.pos,i-a);if(o===n){let u=ia(e);for(;n<=i-a;a+=n)this.process(u,a);continue}r.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){sc(this),fm(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>n-a&&(this.process(r,0),a=0);for(let m=a;m<n;m++)t[m]=0;gm(r,n-8,BigInt(this.length*8),i),this.process(r,0);let o=ia(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=u/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<l;m++)o.setUint32(4*m,c[m],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:a,pos:o}=this;return e.length=n,e.pos=o,e.finished=i,e.destroyed=a,n%t&&e.buffer.set(r),e}},bm=(e,t,r)=>e&t^~e&r,wm=(e,t,r)=>e&t^e&r^t&r,_m=new Uint32Array([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]),Zt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),er=new Uint32Array(64),Tm=class extends vm{constructor(){super(64,32,8,!1),this.A=Zt[0]|0,this.B=Zt[1]|0,this.C=Zt[2]|0,this.D=Zt[3]|0,this.E=Zt[4]|0,this.F=Zt[5]|0,this.G=Zt[6]|0,this.H=Zt[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:a,G:o,H:u}=this;return[e,t,r,n,i,a,o,u]}set(e,t,r,n,i,a,o,u){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=u|0}process(e,t){for(let m=0;m<16;m++,t+=4)er[m]=e.getUint32(t,!1);for(let m=16;m<64;m++){let g=er[m-15],R=er[m-2],j=St(g,7)^St(g,18)^g>>>3,q=St(R,17)^St(R,19)^R>>>10;er[m]=q+er[m-7]+j+er[m-16]|0}let{A:r,B:n,C:i,D:a,E:o,F:u,G:l,H:c}=this;for(let m=0;m<64;m++){let g=St(o,6)^St(o,11)^St(o,25),R=c+g+bm(o,u,l)+_m[m]+er[m]|0,j=(St(r,2)^St(r,13)^St(r,22))+wm(r,n,i)|0;c=l,l=u,u=o,o=a+R|0,a=i,i=n,n=r,r=R+j|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,u=u+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,a,o,u,l,c)}roundClean(){er.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},xm=mm(()=>new Tm),Em=Object.create,Aa=Object.defineProperty,Om=Object.getOwnPropertyDescriptor,kc=Object.getOwnPropertyNames,Am=Object.getPrototypeOf,Im=Object.prototype.hasOwnProperty,Sm=(e,t,r)=>t in e?Aa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Uc=(e,t)=>function(){return t||(0,e[kc(e)[0]])((t={exports:{}}).exports,t),t.exports},$m=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of kc(t))!Im.call(e,i)&&i!==r&&Aa(e,i,{get:()=>t[i],enumerable:!(n=Om(t,i))||n.enumerable});return e},jc=(e,t,r)=>(r=e!=null?Em(Am(e)):{},$m(t||!e||!e.__esModule?Aa(r,"default",{value:e,enumerable:!0}):r,e)),ir=(e,t,r)=>(Sm(e,typeof t!="symbol"?t+"":t,r),r),km=Uc({"../../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(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},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",a=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=a,e.isDeno=o}}),Um=Uc({"../../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,a=n.cmp&&function(u){return function(l){return function(c,m){var g={key:c,value:l[c]},R={key:m,value:l[m]};return u(g,R)}}}(n.cmp),o=[];return function u(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,m;if(Array.isArray(l)){for(m="[",c=0;c<l.length;c++)c&&(m+=","),m+=u(l[c])||"null";return m+"]"}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,R=Object.keys(l).sort(a&&a(l));for(m="",c=0;c<R.length;c++){var j=R[c],q=u(l[j]);q&&(m&&(m+=","),m+=JSON.stringify(j)+":"+q)}return o.splice(g,1),"{"+m+"}"}}(r)}}}),Rn=jc(km(),1),jm=jc(Um(),1),Nc=!1,Pc=!1;Rn.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Nc=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(Pc=process?.env?.LOGGER_PERF_PREFIX==="true"));var Nm=Object.freeze({prefix:void 0,time:Nc,delta:Pc,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0}),oa=[],Bc=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].join(",")}]`}},Cc=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Pn=!1,Ye=class{static setup(e=Ye.INFO,t={}){t=Object.assign({},Nm,t),e>10&&console.debug("setup logger",{config:t});let r=this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}),n=(...u)=>{window?.FORCE_DISABLE_LOGLEVEL&&r(...u)};n.isDisabled=!0,n.isEnabled=!1;let i=this.wrapLog(console.groupCollapsed,t),a=(u,l)=>{function c(...g){let R=g[g.length-1];return R===n?R():(i(...g.slice(0,-1)),(async()=>{try{let j=R();return j instanceof Promise?await j:j}finally{console.groupEnd()}})())}let m=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:c,force:l});return u?m:Object.assign(n.bind({}),{isEnabled:u,isDisabled:!u,group:c,force:m})},o=a(e>=Ye.ERROR,this.wrapLog(console.error,t));return{ERROR:(...u)=>(o(...u),new Error((0,jm.default)(u))),WARN:a(e>=Ye.WARN,this.wrapLog(console.warn,t)),LOG:a(e>=Ye.INFO,this.wrapLog(console.log,t)),DEBUG:a(e>=Ye.DEBUG,this.wrapLog(console.log,{...t,dim:t.dimDebugOnServer})),VERBOSE:a(e>=Ye.VERBOSE,this.wrapLog(console.debug,{...t,dim:t.dimDebugOnServer}))}}static wrapLog(e,t){if(Rn.isNode)return e.bind(console);{let r=[];if(t.time||t.delta){let n=Rn.isBrowser&&navigator.userAgent.includes("Chrome")?["",Ye.timeStr(!!t.time,!!t.delta)]:[];r.push(...n)}return t.prefix&&(Pn?r.push(new Cc("dim",t.prefix)):r.push(t.prefix)),e.bind(console,...r)}}static timeStr(e,t,r=0){if(!performance.now)return;let n=performance.now();Ye.firstLog||(Ye.firstLog=n,Ye.lastLog=n);let i=new Bc(n-Ye.firstLog,n-Ye.lastLog,e,t);return Ye.lastLog=n,r?i.toString():i}static getOriginFromStack(e){let t=!1;for(let r of e.split(`
|
|
2
|
+
`)){let n=r.match(/^\s+at\s+(.*)/);if(n){if(t)return n[1].trim().replace(__dirname,"");t=!0}}}},Ae=Ye;ir(Ae,"ERROR",2);ir(Ae,"WARN",4);ir(Ae,"INFO",6);ir(Ae,"LOG",6);ir(Ae,"DEBUG",8);ir(Ae,"VERBOSE",10);ir(Ae,"firstLog",0);ir(Ae,"lastLog",0);Rn.isBrowser?(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(oa&&oa.length){for(let t of oa)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Bc))return null;Pn||(Pn=!0);let t=Ae.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof Cc?(Pn||(Pn=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1})):Rn.isNode;var Rc=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Pm=Ac({name:"sha2-256",code:18,encode:Rc("SHA-256")}),xO=Ac({name:"sha2-512",code:19,encode:Rc("SHA-512")}),{WARN:Bm,LOG:EO,DEBUG:Cm,VERBOSE:Mc,ERROR:OO}=Ae.setup(Ae.INFO);function Lc(e,t=["cid"]){let r={};for(let[n,i]of Object.entries(e))i===void 0&&(Bm(`log.${n} is undefined, which is not allowed - encoding as null`,e),i=null),t.includes(n)?Mc("excluding app log",{key:n,val:i}):r[n]=i&&n==="pv"?Rt.parse(i):i;return r}function Ia(e){return Sa(Dc(e).bytes)}function Dc(e){return Vc(Lc(e))}function Sa(e){let t=xm(e),r=xc.create(Pm.code,t),n=Rt.create(1,Sc,r);return Mc("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Vc(e){Cm("[encodeBlock]",e);let t=Oa(e);return{bytes:t,cid:Sa(t)}}var Rm=Le((e,t)=>{"use strict";var{hasOwnProperty:r}=Object.prototype,n=ae();n.configure=ae,n.stringify=n,n.default=n,e.stringify=n,e.configure=ae,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function a(B){return B.length<5e3&&!i.test(B)?`"${B}"`:JSON.stringify(B)}function o(B){if(B.length>200)return B.sort();for(let V=1;V<B.length;V++){let H=B[V],se=V;for(;se!==0&&B[se-1]>H;)B[se]=B[se-1],se--;B[se]=H}return B}var u=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(B){return u.call(B)!==void 0&&B.length!==0}function c(B,V,H){B.length<H&&(H=B.length);let se=V===","?"":" ",F=`"0":${se}${B[0]}`;for(let ue=1;ue<H;ue++)F+=`${V}"${ue}":${se}${B[ue]}`;return F}function m(B){if(r.call(B,"circularValue")){let V=B.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(B,V){let H;if(r.call(B,V)&&(H=B[V],typeof H!="boolean"))throw new TypeError(`The "${V}" argument must be of type boolean`);return H===void 0?!0:H}function R(B,V){let H;if(r.call(B,V)){if(H=B[V],typeof H!="number")throw new TypeError(`The "${V}" argument must be of type number`);if(!Number.isInteger(H))throw new TypeError(`The "${V}" argument must be an integer`);if(H<1)throw new RangeError(`The "${V}" argument must be >= 1`)}return H===void 0?1/0:H}function j(B){return B===1?"1 item":`${B} items`}function q(B){let V=new Set;for(let H of B)(typeof H=="string"||typeof H=="number")&&V.add(String(H));return V}function Z(B){if(r.call(B,"strict")){let V=B.strict;if(typeof V!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(V)return H=>{let se=`Object can not safely be stringified. Received type ${typeof H}`;throw typeof H!="function"&&(se+=` (${H.toString()})`),new Error(se)}}}function ae(B){B={...B};let V=Z(B);V&&(B.bigint===void 0&&(B.bigint=!1),"circularValue"in B||(B.circularValue=Error));let H=m(B),se=g(B,"bigint"),F=g(B,"deterministic"),ue=R(B,"maximumDepth"),z=R(B,"maximumBreadth");function pe(X,E,K,te,G,W){let fe=E[X];switch(typeof fe=="object"&&fe!==null&&typeof fe.toJSON=="function"&&(fe=fe.toJSON(X)),fe=te.call(E,X,fe),typeof fe){case"string":return a(fe);case"object":{if(fe===null)return"null";if(K.indexOf(fe)!==-1)return H;let f="",_=",",O=W;if(Array.isArray(fe)){if(fe.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(fe),G!==""&&(W+=G,f+=`
|
|
3
3
|
${W}`,_=`,
|
|
4
4
|
${W}`);let w=Math.min(fe.length,z),s=0;for(;s<w-1;s++){let b=pe(String(s),fe,K,te,G,W);f+=b!==void 0?b:"null",f+=_}let T=pe(String(s),fe,K,te,G,W);if(f+=T!==void 0?T:"null",fe.length-1>z){let b=fe.length-z-1;f+=`${_}"... ${j(b)} not stringified"`}return G!==""&&(f+=`
|
|
5
5
|
${O}`),K.pop(),`[${f}]`}let k=Object.keys(fe),S=k.length;if(S===0)return"{}";if(ue<K.length+1)return'"[Object]"';let $="",h="";G!==""&&(W+=G,_=`,
|
|
6
|
-
${W}`,$=" ");let
|
|
6
|
+
${W}`,$=" ");let A=Math.min(S,z);F&&!l(fe)&&(k=o(k)),K.push(fe);for(let w=0;w<A;w++){let s=k[w],T=pe(s,fe,K,te,G,W);T!==void 0&&(f+=`${h}${a(s)}:${$}${T}`,h=_)}if(S>z){let w=S-z;f+=`${h}"...":${$}"${j(w)} not stringified"`,h=_}return G!==""&&h.length>1&&(f=`
|
|
7
7
|
${W}${f}
|
|
8
8
|
${O}`),K.pop(),`{${f}}`}case"number":return isFinite(fe)?String(fe):V?V(fe):"null";case"boolean":return fe===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(fe);default:return V?V(fe):void 0}}function M(X,E,K,te,G,W){switch(typeof E=="object"&&E!==null&&typeof E.toJSON=="function"&&(E=E.toJSON(X)),typeof E){case"string":return a(E);case"object":{if(E===null)return"null";if(K.indexOf(E)!==-1)return H;let fe=W,f="",_=",";if(Array.isArray(E)){if(E.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(E),G!==""&&(W+=G,f+=`
|
|
9
9
|
${W}`,_=`,
|
|
10
|
-
${W}`);let S=Math.min(E.length,z),$=0;for(;$<S-1;$++){let
|
|
10
|
+
${W}`);let S=Math.min(E.length,z),$=0;for(;$<S-1;$++){let A=M(String($),E[$],K,te,G,W);f+=A!==void 0?A:"null",f+=_}let h=M(String($),E[$],K,te,G,W);if(f+=h!==void 0?h:"null",E.length-1>z){let A=E.length-z-1;f+=`${_}"... ${j(A)} not stringified"`}return G!==""&&(f+=`
|
|
11
11
|
${fe}`),K.pop(),`[${f}]`}K.push(E);let O="";G!==""&&(W+=G,_=`,
|
|
12
12
|
${W}`,O=" ");let k="";for(let S of te){let $=M(S,E[S],K,te,G,W);$!==void 0&&(f+=`${k}${a(S)}:${O}${$}`,k=_)}return G!==""&&k.length>1&&(f=`
|
|
13
13
|
${W}${f}
|
|
14
14
|
${fe}`),K.pop(),`{${f}}`}case"number":return isFinite(E)?String(E):V?V(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(E);default:return V?V(E):void 0}}function P(X,E,K,te,G){switch(typeof E){case"string":return a(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(X),typeof E!="object")return P(X,E,K,te,G);if(E===null)return"null"}if(K.indexOf(E)!==-1)return H;let W=G;if(Array.isArray(E)){if(E.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(E),G+=te;let $=`
|
|
15
15
|
${G}`,h=`,
|
|
16
|
-
${G}`,
|
|
16
|
+
${G}`,A=Math.min(E.length,z),w=0;for(;w<A-1;w++){let T=P(String(w),E[w],K,te,G);$+=T!==void 0?T:"null",$+=h}let s=P(String(w),E[w],K,te,G);if($+=s!==void 0?s:"null",E.length-1>z){let T=E.length-z-1;$+=`${h}"... ${j(T)} not stringified"`}return $+=`
|
|
17
17
|
${W}`,K.pop(),`[${$}]`}let fe=Object.keys(E),f=fe.length;if(f===0)return"{}";if(ue<K.length+1)return'"[Object]"';G+=te;let _=`,
|
|
18
|
-
${G}`,O="",k="",S=Math.min(f,z);l(E)&&(O+=c(E,_,z),fe=fe.slice(E.length),S-=E.length,k=_),F&&(fe=o(fe)),K.push(E);for(let $=0;$<S;$++){let h=fe[$],
|
|
18
|
+
${G}`,O="",k="",S=Math.min(f,z);l(E)&&(O+=c(E,_,z),fe=fe.slice(E.length),S-=E.length,k=_),F&&(fe=o(fe)),K.push(E);for(let $=0;$<S;$++){let h=fe[$],A=P(h,E[h],K,te,G);A!==void 0&&(O+=`${k}${a(h)}: ${A}`,k=_)}if(f>z){let $=f-z;O+=`${k}"...": "${j($)} not stringified"`,k=_}return k!==""&&(O=`
|
|
19
19
|
${G}${O}
|
|
20
|
-
${W}`),K.pop(),`{${O}}`}case"number":return isFinite(E)?String(E):V?V(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(E);default:return V?V(E):void 0}}function C(X,E,K){switch(typeof E){case"string":return a(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(X),typeof E!="object")return C(X,E,K);if(E===null)return"null"}if(K.indexOf(E)!==-1)return H;let te="";if(Array.isArray(E)){if(E.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(E);let _=Math.min(E.length,z),O=0;for(;O<_-1;O++){let S=C(String(O),E[O],K);te+=S!==void 0?S:"null",te+=","}let k=C(String(O),E[O],K);if(te+=k!==void 0?k:"null",E.length-1>z){let S=E.length-z-1;te+=`,"... ${j(S)} not stringified"`}return K.pop(),`[${te}]`}let G=Object.keys(E),W=G.length;if(W===0)return"{}";if(ue<K.length+1)return'"[Object]"';let fe="",f=Math.min(W,z);l(E)&&(te+=c(E,",",z),G=G.slice(E.length),f-=E.length,fe=","),F&&(G=o(G)),K.push(E);for(let _=0;_<f;_++){let O=G[_],k=C(O,E[O],K);k!==void 0&&(te+=`${fe}${a(O)}:${k}`,fe=",")}if(W>z){let _=W-z;te+=`${fe}"...":"${j(_)} not stringified"`}return K.pop(),`{${te}}`}case"number":return isFinite(E)?String(E):V?V(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(E);default:return V?V(E):void 0}}function Q(X,E,K){if(arguments.length>1){let te="";if(typeof K=="number"?te=" ".repeat(Math.min(K,10)):typeof K=="string"&&(te=K.slice(0,10)),E!=null){if(typeof E=="function")return pe("",{"":X},[],E,te,"");if(Array.isArray(E))return M("",X,[],q(E),te,"")}if(te.length!==0)return P("",X,[],te,"")}return C("",X,[])}return Q}}),Pr=Le(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 O(){return new Map(_)}f.Entries=O;function k(){return _.clear()}f.Clear=k;function S(w){return _.delete(w)}f.Delete=S;function $(w){return _.has(w)}f.Has=$;function h(w,s){_.set(w,s)}f.Set=h;function I(w){return _.get(w)}f.Get=I})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(f){super(f)}};e.TypeBoxError=r;var n;(function(f){let _=new Map;function O(){return new Map(_)}f.Entries=O;function k(){return _.clear()}f.Clear=k;function S(w){return _.delete(w)}f.Delete=S;function $(w){return _.has(w)}f.Has=$;function h(w,s){_.set(w,s)}f.Set=h;function I(w){return _.get(w)}f.Get=I})(n||(e.FormatRegistry=n={}));var i;(function(f){function _(b){return Array.isArray(b)}f.IsArray=_;function O(b){return typeof b=="bigint"}f.IsBigInt=O;function k(b){return typeof b=="boolean"}f.IsBoolean=k;function S(b){return b instanceof globalThis.Date}f.IsDate=S;function $(b){return b===null}f.IsNull=$;function h(b){return typeof b=="number"}f.IsNumber=h;function I(b){return typeof b=="object"&&b!==null}f.IsObject=I;function w(b){return typeof b=="string"}f.IsString=w;function s(b){return b instanceof globalThis.Uint8Array}f.IsUint8Array=s;function T(b){return b===void 0}f.IsUndefined=T})(i||(e.ValueGuard=i={}));var a=class extends r{};e.TypeGuardUnknownTypeError=a;var o;(function(f){function _(y){try{return new RegExp(y),!0}catch{return!1}}function O(y){if(!i.IsString(y))return!1;for(let $e=0;$e<y.length;$e++){let ut=y.charCodeAt($e);if(ut>=7&&ut<=13||ut===27||ut===127)return!1}return!0}function k(y){return h(y)||Me(y)}function S(y){return i.IsUndefined(y)||i.IsBigInt(y)}function $(y){return i.IsUndefined(y)||i.IsNumber(y)}function h(y){return i.IsUndefined(y)||i.IsBoolean(y)}function I(y){return i.IsUndefined(y)||i.IsString(y)}function w(y){return i.IsUndefined(y)||i.IsString(y)&&O(y)&&_(y)}function s(y){return i.IsUndefined(y)||i.IsString(y)&&O(y)}function T(y){return i.IsUndefined(y)||Me(y)}function b(y){return be(y,"Any")&&I(y.$id)}f.TAny=b;function v(y){return be(y,"Array")&&y.type==="array"&&I(y.$id)&&Me(y.items)&&$(y.minItems)&&$(y.maxItems)&&h(y.uniqueItems)&&T(y.contains)&&$(y.minContains)&&$(y.maxContains)}f.TArray=v;function U(y){return be(y,"AsyncIterator")&&y.type==="AsyncIterator"&&I(y.$id)&&Me(y.items)}f.TAsyncIterator=U;function L(y){return be(y,"BigInt")&&y.type==="bigint"&&I(y.$id)&&S(y.exclusiveMaximum)&&S(y.exclusiveMinimum)&&S(y.maximum)&&S(y.minimum)&&S(y.multipleOf)}f.TBigInt=L;function J(y){return be(y,"Boolean")&&y.type==="boolean"&&I(y.$id)}f.TBoolean=J;function ee(y){return be(y,"Constructor")&&y.type==="Constructor"&&I(y.$id)&&i.IsArray(y.parameters)&&y.parameters.every($e=>Me($e))&&Me(y.returns)}f.TConstructor=ee;function ye(y){return be(y,"Date")&&y.type==="Date"&&I(y.$id)&&$(y.exclusiveMaximumTimestamp)&&$(y.exclusiveMinimumTimestamp)&&$(y.maximumTimestamp)&&$(y.minimumTimestamp)&&$(y.multipleOfTimestamp)}f.TDate=ye;function we(y){return be(y,"Function")&&y.type==="Function"&&I(y.$id)&&i.IsArray(y.parameters)&&y.parameters.every($e=>Me($e))&&Me(y.returns)}f.TFunction=we;function je(y){return be(y,"Integer")&&y.type==="integer"&&I(y.$id)&&$(y.exclusiveMaximum)&&$(y.exclusiveMinimum)&&$(y.maximum)&&$(y.minimum)&&$(y.multipleOf)}f.TInteger=je;function Be(y){return be(y,"Intersect")&&!(i.IsString(y.type)&&y.type!=="object")&&i.IsArray(y.allOf)&&y.allOf.every($e=>Me($e)&&!Tn($e))&&I(y.type)&&(h(y.unevaluatedProperties)||T(y.unevaluatedProperties))&&I(y.$id)}f.TIntersect=Be;function dr(y){return be(y,"Iterator")&&y.type==="Iterator"&&I(y.$id)&&Me(y.items)}f.TIterator=dr;function be(y,$e){return zt(y)&&y[e.Kind]===$e}f.TKindOf=be;function zt(y){return i.IsObject(y)&&e.Kind in y&&i.IsString(y[e.Kind])}f.TKind=zt;function pr(y){return A(y)&&i.IsString(y.const)}f.TLiteralString=pr;function x(y){return A(y)&&i.IsNumber(y.const)}f.TLiteralNumber=x;function le(y){return A(y)&&i.IsBoolean(y.const)}f.TLiteralBoolean=le;function A(y){return be(y,"Literal")&&I(y.$id)&&(i.IsBoolean(y.const)||i.IsNumber(y.const)||i.IsString(y.const))}f.TLiteral=A;function ge(y){return be(y,"Never")&&i.IsObject(y.not)&&Object.getOwnPropertyNames(y.not).length===0}f.TNever=ge;function ne(y){return be(y,"Not")&&Me(y.not)}f.TNot=ne;function de(y){return be(y,"Null")&&y.type==="null"&&I(y.$id)}f.TNull=de;function Ae(y){return be(y,"Number")&&y.type==="number"&&I(y.$id)&&$(y.exclusiveMaximum)&&$(y.exclusiveMinimum)&&$(y.maximum)&&$(y.minimum)&&$(y.multipleOf)}f.TNumber=Ae;function Ce(y){return be(y,"Object")&&y.type==="object"&&I(y.$id)&&i.IsObject(y.properties)&&k(y.additionalProperties)&&$(y.minProperties)&&$(y.maxProperties)&&Object.entries(y.properties).every(([$e,ut])=>O($e)&&Me(ut))}f.TObject=Ce;function We(y){return be(y,"Promise")&&y.type==="Promise"&&I(y.$id)&&Me(y.item)}f.TPromise=We;function qe(y){return be(y,"Record")&&y.type==="object"&&I(y.$id)&&k(y.additionalProperties)&&i.IsObject(y.patternProperties)&&($e=>{let ut=Object.getOwnPropertyNames($e.patternProperties);return ut.length===1&&_(ut[0])&&i.IsObject($e.patternProperties)&&Me($e.patternProperties[ut[0]])})(y)}f.TRecord=qe;function Xe(y){return i.IsObject(y)&&e.Hint in y&&y[e.Hint]==="Recursive"}f.TRecursive=Xe;function qt(y){return be(y,"Ref")&&I(y.$id)&&i.IsString(y.$ref)}f.TRef=qt;function Vr(y){return be(y,"String")&&y.type==="string"&&I(y.$id)&&$(y.minLength)&&$(y.maxLength)&&w(y.pattern)&&s(y.format)}f.TString=Vr;function Fr(y){return be(y,"Symbol")&&y.type==="symbol"&&I(y.$id)}f.TSymbol=Fr;function hr(y){return be(y,"TemplateLiteral")&&y.type==="string"&&i.IsString(y.pattern)&&y.pattern[0]==="^"&&y.pattern[y.pattern.length-1]==="$"}f.TTemplateLiteral=hr;function mi(y){return be(y,"This")&&I(y.$id)&&i.IsString(y.$ref)}f.TThis=mi;function Tn(y){return i.IsObject(y)&&e.Transform in y}f.TTransform=Tn;function Re(y){return be(y,"Tuple")&&y.type==="array"&&I(y.$id)&&i.IsNumber(y.minItems)&&i.IsNumber(y.maxItems)&&y.minItems===y.maxItems&&(i.IsUndefined(y.items)&&i.IsUndefined(y.additionalItems)&&y.minItems===0||i.IsArray(y.items)&&y.items.every($e=>Me($e)))}f.TTuple=Re;function gi(y){return be(y,"Undefined")&&y.type==="undefined"&&I(y.$id)}f.TUndefined=gi;function No(y){return yr(y)&&y.anyOf.every($e=>pr($e)||x($e))}f.TUnionLiteral=No;function yr(y){return be(y,"Union")&&I(y.$id)&&i.IsObject(y)&&i.IsArray(y.anyOf)&&y.anyOf.every($e=>Me($e))}f.TUnion=yr;function zr(y){return be(y,"Uint8Array")&&y.type==="Uint8Array"&&I(y.$id)&&$(y.minByteLength)&&$(y.maxByteLength)}f.TUint8Array=zr;function Je(y){return be(y,"Unknown")&&I(y.$id)}f.TUnknown=Je;function vi(y){return be(y,"Unsafe")}f.TUnsafe=vi;function xn(y){return be(y,"Void")&&y.type==="void"&&I(y.$id)}f.TVoid=xn;function Po(y){return i.IsObject(y)&&y[e.Readonly]==="Readonly"}f.TReadonly=Po;function Bo(y){return i.IsObject(y)&&y[e.Optional]==="Optional"}f.TOptional=Bo;function Me(y){return i.IsObject(y)&&(b(y)||v(y)||J(y)||L(y)||U(y)||ee(y)||ye(y)||we(y)||je(y)||Be(y)||dr(y)||A(y)||ge(y)||ne(y)||de(y)||Ae(y)||Ce(y)||We(y)||qe(y)||qt(y)||Vr(y)||Fr(y)||hr(y)||mi(y)||Re(y)||gi(y)||yr(y)||zr(y)||Je(y)||vi(y)||xn(y)||zt(y)&&t.Has(y[e.Kind]))}f.TSchema=Me})(o||(e.TypeGuard=o={}));var u;(function(f){function _(O){return O[e.Kind]==="Intersect"?O.allOf.every(k=>_(k)):O[e.Kind]==="Union"?O.anyOf.some(k=>_(k)):O[e.Kind]==="Undefined"?!0:O[e.Kind]==="Not"?!_(O.not):!1}f.Check=_})(u||(e.ExtendsUndefined=u={}));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 m;(function(f){function _(p){return p===c.False?p:c.True}function O(p){throw new l(p)}function k(p){return o.TNever(p)||o.TIntersect(p)||o.TUnion(p)||o.TUnknown(p)||o.TAny(p)}function S(p,d){return o.TNever(d)?be(p,d):o.TIntersect(d)?we(p,d):o.TUnion(d)?Co(p,d):o.TUnknown(d)?ks(p,d):o.TAny(d)?$(p,d):O("StructuralRight")}function $(p,d){return c.True}function h(p,d){return o.TIntersect(d)?we(p,d):o.TUnion(d)&&d.anyOf.some(Te=>o.TAny(Te)||o.TUnknown(Te))?c.True:o.TUnion(d)?c.Union:o.TUnknown(d)||o.TAny(d)?c.True:c.Union}function I(p,d){return o.TUnknown(p)?c.False:o.TAny(p)?c.Union:o.TNever(p)?c.True:c.False}function w(p,d){return o.TObject(d)&&hr(d)?c.True:k(d)?S(p,d):o.TArray(d)?_(ke(p.items,d.items)):c.False}function s(p,d){return k(d)?S(p,d):o.TAsyncIterator(d)?_(ke(p.items,d.items)):c.False}function T(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TBigInt(d)?c.True:c.False}function b(p,d){return o.TLiteral(p)&&i.IsBoolean(p.const)||o.TBoolean(p)?c.True:c.False}function v(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TBoolean(d)?c.True:c.False}function U(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TConstructor(d)?p.parameters.length>d.parameters.length?c.False:p.parameters.every((Te,Bt)=>_(ke(d.parameters[Bt],Te))===c.True)?_(ke(p.returns,d.returns)):c.False:c.False}function L(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TDate(d)?c.True:c.False}function J(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TFunction(d)?p.parameters.length>d.parameters.length?c.False:p.parameters.every((Te,Bt)=>_(ke(d.parameters[Bt],Te))===c.True)?_(ke(p.returns,d.returns)):c.False:c.False}function ee(p,d){return o.TLiteral(p)&&i.IsNumber(p.const)||o.TNumber(p)||o.TInteger(p)?c.True:c.False}function ye(p,d){return o.TInteger(d)||o.TNumber(d)?c.True:k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):c.False}function we(p,d){return d.allOf.every(Te=>ke(p,Te)===c.True)?c.True:c.False}function je(p,d){return p.allOf.some(Te=>ke(Te,d)===c.True)?c.True:c.False}function Be(p,d){return k(d)?S(p,d):o.TIterator(d)?_(ke(p.items,d.items)):c.False}function dr(p,d){return o.TLiteral(d)&&d.const===p.const?c.True:k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TString(d)?xn(p,d):o.TNumber(d)?A(p,d):o.TInteger(d)?ee(p,d):o.TBoolean(d)?b(p,d):c.False}function be(p,d){return c.False}function zt(p,d){return c.True}function pr(p){let[d,Te]=[p,0];for(;o.TNot(d);)d=d.not,Te+=1;return Te%2===0?d:e.Type.Unknown()}function x(p,d){return o.TNot(p)?ke(pr(p),d):o.TNot(d)?ke(p,pr(d)):O("Invalid fallthrough for Not")}function le(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TNull(d)?c.True:c.False}function A(p,d){return o.TLiteralNumber(p)||o.TNumber(p)||o.TInteger(p)?c.True:c.False}function ge(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TInteger(d)||o.TNumber(d)?c.True:c.False}function ne(p,d){return Object.getOwnPropertyNames(p.properties).length===d}function de(p){return hr(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 Ce(p){return ne(p,0)}function We(p){return ne(p,0)}function qe(p){return ne(p,0)}function Xe(p){return ne(p,0)}function qt(p){return hr(p)}function Vr(p){let d=e.Type.Number();return ne(p,0)||ne(p,1)&&"length"in p.properties&&_(ke(p.properties.length,d))===c.True}function Fr(p){return ne(p,0)}function hr(p){let d=e.Type.Number();return ne(p,0)||ne(p,1)&&"length"in p.properties&&_(ke(p.properties.length,d))===c.True}function mi(p){let d=e.Type.Function([e.Type.Any()],e.Type.Any());return ne(p,0)||ne(p,1)&&"then"in p.properties&&_(ke(p.properties.then,d))===c.True}function Tn(p,d){return ke(p,d)===c.False||o.TOptional(p)&&!o.TOptional(d)?c.False:c.True}function Re(p,d){return o.TUnknown(p)?c.False:o.TAny(p)?c.Union:o.TNever(p)||o.TLiteralString(p)&&de(d)||o.TLiteralNumber(p)&&Ce(d)||o.TLiteralBoolean(p)&&We(d)||o.TSymbol(p)&&Ae(d)||o.TBigInt(p)&&qe(d)||o.TString(p)&&de(d)||o.TSymbol(p)&&Ae(d)||o.TNumber(p)&&Ce(d)||o.TInteger(p)&&Ce(d)||o.TBoolean(p)&&We(d)||o.TUint8Array(p)&&qt(d)||o.TDate(p)&&Xe(d)||o.TConstructor(p)&&Fr(d)||o.TFunction(p)&&Vr(d)?c.True:o.TRecord(p)&&o.TString(yr(p))?d[e.Hint]==="Record"?c.True:c.False:o.TRecord(p)&&o.TNumber(yr(p))&&ne(d,0)?c.True:c.False}function gi(p,d){return k(d)?S(p,d):o.TRecord(d)?Je(p,d):o.TObject(d)?(()=>{for(let Te of Object.getOwnPropertyNames(d.properties)){if(!(Te in p.properties)&&!o.TOptional(d.properties[Te]))return c.False;if(o.TOptional(d.properties[Te]))return c.True;if(Tn(p.properties[Te],d.properties[Te])===c.False)return c.False}return c.True})():c.False}function No(p,d){return k(d)?S(p,d):o.TObject(d)&&mi(d)?c.True:o.TPromise(d)?_(ke(p.item,d.item)):c.False}function yr(p){return e.PatternNumberExact in p.patternProperties?e.Type.Number():e.PatternStringExact in p.patternProperties?e.Type.String():O("Unknown record key pattern")}function zr(p){return e.PatternNumberExact in p.patternProperties?p.patternProperties[e.PatternNumberExact]:e.PatternStringExact in p.patternProperties?p.patternProperties[e.PatternStringExact]:O("Unable to get record value schema")}function Je(p,d){let[Te,Bt]=[yr(d),zr(d)];return o.TLiteralString(p)&&o.TNumber(Te)&&_(ke(p,Bt))===c.True?c.True:o.TUint8Array(p)&&o.TNumber(Te)||o.TString(p)&&o.TNumber(Te)||o.TArray(p)&&o.TNumber(Te)?ke(p,Bt):o.TObject(p)?(()=>{for(let Hd of Object.getOwnPropertyNames(p.properties))if(Tn(Bt,p.properties[Hd])===c.False)return c.False;return c.True})():c.False}function vi(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?ke(zr(p),zr(d)):c.False}function xn(p,d){return o.TLiteral(p)&&i.IsString(p.const)||o.TString(p)?c.True:c.False}function Po(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TString(d)?c.True:c.False}function Bo(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TSymbol(d)?c.True:c.False}function Me(p,d){return o.TTemplateLiteral(p)?ke(F.Resolve(p),d):o.TTemplateLiteral(d)?ke(p,F.Resolve(d)):O("Invalid fallthrough for TemplateLiteral")}function y(p,d){return o.TArray(d)&&p.items!==void 0&&p.items.every(Te=>ke(Te,d.items)===c.True)}function $e(p,d){return o.TNever(p)?c.True:o.TUnknown(p)?c.False:o.TAny(p)?c.Union:c.False}function ut(p,d){return k(d)?S(p,d):o.TObject(d)&&hr(d)||o.TArray(d)&&y(p,d)?c.True:o.TTuple(d)?i.IsUndefined(p.items)&&!i.IsUndefined(d.items)||!i.IsUndefined(p.items)&&i.IsUndefined(d.items)?c.False:i.IsUndefined(p.items)&&!i.IsUndefined(d.items)||p.items.every((Te,Bt)=>ke(Te,d.items[Bt])===c.True)?c.True:c.False:c.False}function Dd(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TUint8Array(d)?c.True:c.False}function Vd(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TVoid(d)?qd(p,d):o.TUndefined(d)?c.True:c.False}function Co(p,d){return d.anyOf.some(Te=>ke(p,Te)===c.True)?c.True:c.False}function Fd(p,d){return p.anyOf.every(Te=>ke(Te,d)===c.True)?c.True:c.False}function ks(p,d){return c.True}function zd(p,d){return o.TNever(d)?be(p,d):o.TIntersect(d)?we(p,d):o.TUnion(d)?Co(p,d):o.TAny(d)?$(p,d):o.TString(d)?xn(p,d):o.TNumber(d)?A(p,d):o.TInteger(d)?ee(p,d):o.TBoolean(d)?b(p,d):o.TArray(d)?I(p,d):o.TTuple(d)?$e(p,d):o.TObject(d)?Re(p,d):o.TUnknown(d)?c.True:c.False}function qd(p,d){return o.TUndefined(p)||o.TUndefined(p)?c.True:c.False}function Kd(p,d){return o.TIntersect(d)?we(p,d):o.TUnion(d)?Co(p,d):o.TUnknown(d)?ks(p,d):o.TAny(d)?$(p,d):o.TObject(d)?Re(p,d):o.TVoid(d)?c.True:c.False}function ke(p,d){return o.TTemplateLiteral(p)||o.TTemplateLiteral(d)?Me(p,d):o.TNot(p)||o.TNot(d)?x(p,d):o.TAny(p)?h(p,d):o.TArray(p)?w(p,d):o.TBigInt(p)?T(p,d):o.TBoolean(p)?v(p,d):o.TAsyncIterator(p)?s(p,d):o.TConstructor(p)?U(p,d):o.TDate(p)?L(p,d):o.TFunction(p)?J(p,d):o.TInteger(p)?ye(p,d):o.TIntersect(p)?je(p,d):o.TIterator(p)?Be(p,d):o.TLiteral(p)?dr(p,d):o.TNever(p)?zt(p,d):o.TNull(p)?le(p,d):o.TNumber(p)?ge(p,d):o.TObject(p)?gi(p,d):o.TRecord(p)?vi(p,d):o.TString(p)?Po(p,d):o.TSymbol(p)?Bo(p,d):o.TTuple(p)?ut(p,d):o.TPromise(p)?No(p,d):o.TUint8Array(p)?Dd(p,d):o.TUndefined(p)?Vd(p,d):o.TUnion(p)?Fd(p,d):o.TUnknown(p)?zd(p,d):o.TVoid(p)?Kd(p,d):O(`Unknown left type operand '${p[e.Kind]}'`)}function Gd(p,d){return ke(p,d)}f.Extends=Gd})(m||(e.TypeExtends=m={}));var g;(function(f){function _(w){return w.map(s=>$(s))}function O(w){return new Date(w.getTime())}function k(w){return new Uint8Array(w)}function S(w){let s=Object.getOwnPropertyNames(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{}),T=Object.getOwnPropertySymbols(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{});return{...s,...T}}function $(w){return i.IsArray(w)?_(w):i.IsDate(w)?O(w):i.IsUint8Array(w)?k(w):i.IsObject(w)?S(w):w}function h(w){return w.map(s=>I(s))}f.Rest=h;function I(w,s={}){return{...$(w),...s}}f.Type=I})(g||(e.TypeClone=g={}));var R;(function(f){function _(U){return U.map(L=>{let{[e.Optional]:J,...ee}=g.Type(L);return ee})}function O(U){return U.every(L=>o.TOptional(L))}function k(U){return U.some(L=>o.TOptional(L))}function S(U){return O(U.allOf)?e.Type.Optional(e.Type.Intersect(_(U.allOf))):U}function $(U){return k(U.anyOf)?e.Type.Optional(e.Type.Union(_(U.anyOf))):U}function h(U){return U[e.Kind]==="Intersect"?S(U):U[e.Kind]==="Union"?$(U):U}function I(U,L){let J=U.allOf.reduce((ee,ye)=>{let we=b(ye,L);return we[e.Kind]==="Never"?ee:[...ee,we]},[]);return h(e.Type.Intersect(J))}function w(U,L){let J=U.anyOf.map(ee=>b(ee,L));return h(e.Type.Union(J))}function s(U,L){let J=U.properties[L];return i.IsUndefined(J)?e.Type.Never():e.Type.Union([J])}function T(U,L){let J=U.items;if(i.IsUndefined(J))return e.Type.Never();let ee=J[L];return i.IsUndefined(ee)?e.Type.Never():ee}function b(U,L){return U[e.Kind]==="Intersect"?I(U,L):U[e.Kind]==="Union"?w(U,L):U[e.Kind]==="Object"?s(U,L):U[e.Kind]==="Tuple"?T(U,L):e.Type.Never()}function v(U,L,J={}){let ee=L.map(ye=>b(U,ye.toString()));return h(e.Type.Union(ee,J))}f.Resolve=v})(R||(e.IndexedAccessor=R={}));var j;(function(f){function _(T){let[b,v]=[T.slice(0,1),T.slice(1)];return`${b.toLowerCase()}${v}`}function O(T){let[b,v]=[T.slice(0,1),T.slice(1)];return`${b.toUpperCase()}${v}`}function k(T){return T.toUpperCase()}function S(T){return T.toLowerCase()}function $(T,b){let v=z.ParseExact(T.pattern);if(!M.Check(v))return{...T,pattern:h(T.pattern,b)};let U=[...C.Generate(v)].map(ee=>e.Type.Literal(ee)),L=I(U,b),J=e.Type.Union(L);return e.Type.TemplateLiteral([J])}function h(T,b){return typeof T=="string"?b==="Uncapitalize"?_(T):b==="Capitalize"?O(T):b==="Uppercase"?k(T):b==="Lowercase"?S(T):T:T.toString()}function I(T,b){if(T.length===0)return[];let[v,...U]=T;return[s(v,b),...I(U,b)]}function w(T,b){return o.TTemplateLiteral(T)?$(T,b):o.TUnion(T)?e.Type.Union(I(T.anyOf,b)):o.TLiteral(T)?e.Type.Literal(h(T.const,b)):T}function s(T,b){return w(T,b)}f.Map=s})(j||(e.Intrinsic=j={}));var q;(function(f){function _(h,I){return e.Type.Intersect(h.allOf.map(w=>S(w,I)),{...h})}function O(h,I){return e.Type.Union(h.anyOf.map(w=>S(w,I)),{...h})}function k(h,I){return I(h)}function S(h,I){return h[e.Kind]==="Intersect"?_(h,I):h[e.Kind]==="Union"?O(h,I):h[e.Kind]==="Object"?k(h,I):h}function $(h,I,w){return{...S(g.Type(h),I),...w}}f.Map=$})(q||(e.ObjectMap=q={}));var Z;(function(f){function _(s){return s[0]==="^"&&s[s.length-1]==="$"?s.slice(1,s.length-1):s}function O(s,T){return s.allOf.reduce((b,v)=>[...b,...h(v,T)],[])}function k(s,T){let b=s.anyOf.map(v=>h(v,T));return[...b.reduce((v,U)=>U.map(L=>b.every(J=>J.includes(L))?v.add(L):v)[0],new Set)]}function S(s,T){return Object.getOwnPropertyNames(s.properties)}function $(s,T){return T.includePatterns?Object.getOwnPropertyNames(s.patternProperties):[]}function h(s,T){return o.TIntersect(s)?O(s,T):o.TUnion(s)?k(s,T):o.TObject(s)?S(s,T):o.TRecord(s)?$(s,T):[]}function I(s,T){return[...new Set(h(s,T))]}f.ResolveKeys=I;function w(s){return`^(${I(s,{includePatterns:!0}).map(T=>`(${_(T)})`).join("|")})$`}f.ResolvePattern=w})(Z||(e.KeyResolver=Z={}));var ae=class extends r{};e.KeyArrayResolverError=ae;var B;(function(f){function _(O){return Array.isArray(O)?O:o.TUnionLiteral(O)?O.anyOf.map(k=>k.const.toString()):o.TLiteral(O)?[O.const]:o.TTemplateLiteral(O)?(()=>{let k=z.ParseExact(O.pattern);if(!M.Check(k))throw new ae("Cannot resolve keys from infinite template expression");return[...C.Generate(k)]})():[]}f.Resolve=_})(B||(e.KeyArrayResolver=B={}));var V;(function(f){function*_(k){for(let S of k.anyOf)S[e.Kind]==="Union"?yield*_(S):yield S}function O(k){return e.Type.Union([..._(k)],{...k})}f.Resolve=O})(V||(e.UnionResolver=V={}));var H=class extends r{};e.TemplateLiteralPatternError=H;var se;(function(f){function _($){throw new H($)}function O($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k($,h){return o.TTemplateLiteral($)?$.pattern.slice(1,$.pattern.length-1):o.TUnion($)?`(${$.anyOf.map(I=>k(I,h)).join("|")})`:o.TNumber($)?`${h}${e.PatternNumber}`:o.TInteger($)?`${h}${e.PatternNumber}`:o.TBigInt($)?`${h}${e.PatternNumber}`:o.TString($)?`${h}${e.PatternString}`:o.TLiteral($)?`${h}${O($.const.toString())}`:o.TBoolean($)?`${h}${e.PatternBoolean}`:_(`Unexpected Kind '${$[e.Kind]}'`)}function S($){return`^${$.map(h=>k(h,"")).join("")}$`}f.Create=S})(se||(e.TemplateLiteralPattern=se={}));var F;(function(f){function _(O){let k=z.ParseExact(O.pattern);if(!M.Check(k))return e.Type.String();let S=[...C.Generate(k)].map($=>e.Type.Literal($));return e.Type.Union(S)}f.Resolve=_})(F||(e.TemplateLiteralResolver=F={}));var ue=class extends r{};e.TemplateLiteralParserError=ue;var z;(function(f){function _(U,L,J){return U[L]===J&&U.charCodeAt(L-1)!==92}function O(U,L){return _(U,L,"(")}function k(U,L){return _(U,L,")")}function S(U,L){return _(U,L,"|")}function $(U){if(!(O(U,0)&&k(U,U.length-1)))return!1;let L=0;for(let J=0;J<U.length;J++)if(O(U,J)&&(L+=1),k(U,J)&&(L-=1),L===0&&J!==U.length-1)return!1;return!0}function h(U){return U.slice(1,U.length-1)}function I(U){let L=0;for(let J=0;J<U.length;J++)if(O(U,J)&&(L+=1),k(U,J)&&(L-=1),S(U,J)&&L===0)return!0;return!1}function w(U){for(let L=0;L<U.length;L++)if(O(U,L))return!0;return!1}function s(U){let[L,J]=[0,0],ee=[];for(let we=0;we<U.length;we++)if(O(U,we)&&(L+=1),k(U,we)&&(L-=1),S(U,we)&&L===0){let je=U.slice(J,we);je.length>0&&ee.push(b(je)),J=we+1}let ye=U.slice(J);return ye.length>0&&ee.push(b(ye)),ee.length===0?{type:"const",const:""}:ee.length===1?ee[0]:{type:"or",expr:ee}}function T(U){function L(ye,we){if(!O(ye,we))throw new ue("TemplateLiteralParser: Index must point to open parens");let je=0;for(let Be=we;Be<ye.length;Be++)if(O(ye,Be)&&(je+=1),k(ye,Be)&&(je-=1),je===0)return[we,Be];throw new ue("TemplateLiteralParser: Unclosed group parens in expression")}function J(ye,we){for(let je=we;je<ye.length;je++)if(O(ye,je))return[we,je];return[we,ye.length]}let ee=[];for(let ye=0;ye<U.length;ye++)if(O(U,ye)){let[we,je]=L(U,ye),Be=U.slice(we,je+1);ee.push(b(Be)),ye=je}else{let[we,je]=J(U,ye),Be=U.slice(we,je);Be.length>0&&ee.push(b(Be)),ye=je-1}return ee.length===0?{type:"const",const:""}:ee.length===1?ee[0]:{type:"and",expr:ee}}function b(U){return $(U)?b(h(U)):I(U)?s(U):w(U)?T(U):{type:"const",const:U}}f.Parse=b;function v(U){return b(U.slice(1,U.length-1))}f.ParseExact=v})(z||(e.TemplateLiteralParser=z={}));var pe=class extends r{};e.TemplateLiteralFiniteError=pe;var M;(function(f){function _(h){throw new pe(h)}function O(h){return h.type==="or"&&h.expr.length===2&&h.expr[0].type==="const"&&h.expr[0].const==="0"&&h.expr[1].type==="const"&&h.expr[1].const==="[1-9][0-9]*"}function k(h){return h.type==="or"&&h.expr.length===2&&h.expr[0].type==="const"&&h.expr[0].const==="true"&&h.expr[1].type==="const"&&h.expr[1].const==="false"}function S(h){return h.type==="const"&&h.const===".*"}function $(h){return k(h)?!0:O(h)||S(h)?!1:h.type==="and"?h.expr.every(I=>$(I)):h.type==="or"?h.expr.every(I=>$(I)):h.type==="const"?!0:_("Unknown expression type")}f.Check=$})(M||(e.TemplateLiteralFinite=M={}));var P=class extends r{};e.TemplateLiteralGeneratorError=P;var C;(function(f){function*_(h){if(h.length===1)return yield*h[0];for(let I of h[0])for(let w of _(h.slice(1)))yield`${I}${w}`}function*O(h){return yield*_(h.expr.map(I=>[...$(I)]))}function*k(h){for(let I of h.expr)yield*$(I)}function*S(h){return yield h.const}function*$(h){return h.type==="and"?yield*O(h):h.type==="or"?yield*k(h):h.type==="const"?yield*S(h):(()=>{throw new P("Unknown expression")})()}f.Generate=$})(C||(e.TemplateLiteralGenerator=C={}));var Q;(function(f){function*_($){let h=$.trim().replace(/"|'/g,"");return h==="boolean"?yield e.Type.Boolean():h==="number"?yield e.Type.Number():h==="bigint"?yield e.Type.BigInt():h==="string"?yield e.Type.String():yield(()=>{let I=h.split("|").map(w=>e.Type.Literal(w.trim()));return I.length===0?e.Type.Never():I.length===1?I[0]:e.Type.Union(I)})()}function*O($){if($[1]!=="{"){let h=e.Type.Literal("$"),I=k($.slice(1));return yield*[h,...I]}for(let h=2;h<$.length;h++)if($[h]==="}"){let I=_($.slice(2,h)),w=k($.slice(h+1));return yield*[...I,...w]}yield e.Type.Literal($)}function*k($){for(let h=0;h<$.length;h++)if($[h]==="$"){let I=e.Type.Literal($.slice(0,h)),w=O($.slice(h));return yield*[I,...w]}yield e.Type.Literal($)}function S($){return[...k($)]}f.Parse=S})(Q||(e.TemplateLiteralDslParser=Q={}));var X=class{constructor(f){this.schema=f}Decode(f){return new E(this.schema,f)}};e.TransformDecodeBuilder=X;var E=class{constructor(f,_){this.schema=f,this.decode=_}Encode(f){let _=g.Type(this.schema);return o.TTransform(_)?(()=>{let O={Encode:k=>_[e.Transform].Encode(f(k)),Decode:k=>this.decode(_[e.Transform].Decode(k))};return{..._,[e.Transform]:O}})():(()=>{let O={Decode:this.decode,Encode:f};return{..._,[e.Transform]:O}})()}};e.TransformEncodeBuilder=E;var K=0,te=class extends r{};e.TypeBuilderError=te;var G=class{Create(f){return f}Throw(f){throw new te(f)}Discard(f,_){return _.reduce((O,k)=>{let{[k]:S,...$}=O;return $},f)}Strict(f){return JSON.parse(JSON.stringify(f))}};e.TypeBuilder=G;var W=class extends G{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{...j.Map(g.Type(f),"Capitalize"),..._}}Composite(f,_){let O=e.Type.Intersect(f,{}),k=Z.ResolveKeys(O,{includePatterns:!1}).reduce((S,$)=>({...S,[$]:e.Type.Index(O,[$])}),{});return e.Type.Object(k,_)}Enum(f,_={}){if(i.IsUndefined(f))return this.Throw("Enum undefined or empty");let O=Object.getOwnPropertyNames(f).filter(S=>isNaN(S)).map(S=>f[S]),k=[...new Set(O)].map(S=>e.Type.Literal(S));return this.Union(k,{..._,[e.Hint]:"Enum"})}Extends(f,_,O,k,S={}){switch(m.Extends(f,_)){case c.Union:return this.Union([g.Type(O,S),g.Type(k,S)]);case c.True:return g.Type(O,S);case c.False:return g.Type(k,S)}}Exclude(f,_,O={}){return o.TTemplateLiteral(f)?this.Exclude(F.Resolve(f),_,O):o.TTemplateLiteral(_)?this.Exclude(f,F.Resolve(_),O):o.TUnion(f)?(()=>{let k=f.anyOf.filter(S=>m.Extends(S,_)===c.False);return k.length===1?g.Type(k[0],O):this.Union(k,O)})():m.Extends(f,_)!==c.False?this.Never(O):g.Type(f,O)}Extract(f,_,O={}){return o.TTemplateLiteral(f)?this.Extract(F.Resolve(f),_,O):o.TTemplateLiteral(_)?this.Extract(f,F.Resolve(_),O):o.TUnion(f)?(()=>{let k=f.anyOf.filter(S=>m.Extends(S,_)!==c.False);return k.length===1?g.Type(k[0],O):this.Union(k,O)})():m.Extends(f,_)!==c.False?g.Type(f,O):this.Never(O)}Index(f,_,O={}){return o.TArray(f)&&o.TNumber(_)?g.Type(f.items,O):o.TTuple(f)&&o.TNumber(_)?(()=>{let k=(i.IsUndefined(f.items)?[]:f.items).map(S=>g.Type(S));return this.Union(k,O)})():(()=>{let k=B.Resolve(_),S=g.Type(f);return R.Resolve(S,k,O)})()}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($=>o.TTransform($))&&this.Throw("Cannot intersect transform types");let O=f.every($=>o.TObject($)),k=g.Rest(f),S=o.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:g.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||o.TSchema(_.unevaluatedProperties)||O?this.Create({..._,...S,[e.Kind]:"Intersect",type:"object",allOf:k}):this.Create({..._,...S,[e.Kind]:"Intersect",allOf:k})}KeyOf(f,_={}){return o.TRecord(f)?(()=>{let O=Object.getOwnPropertyNames(f.patternProperties)[0];return O===e.PatternNumberExact?this.Number(_):O===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():o.TTuple(f)?(()=>{let O=(i.IsUndefined(f.items)?[]:f.items).map((k,S)=>e.Type.Literal(S.toString()));return this.Union(O,_)})():o.TArray(f)?this.Number(_):(()=>{let O=Z.ResolveKeys(f,{includePatterns:!1});if(O.length===0)return this.Never(_);let k=O.map(S=>this.Literal(S));return this.Union(k,_)})()}Literal(f,_={}){return this.Create({..._,[e.Kind]:"Literal",const:f,type:typeof f})}Lowercase(f,_={}){return{...j.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 O=Object.getOwnPropertyNames(f),k=O.filter(I=>o.TOptional(f[I])),S=O.filter(I=>!k.includes(I)),$=o.TSchema(_.additionalProperties)?{additionalProperties:g.Type(_.additionalProperties)}:{},h=O.reduce((I,w)=>({...I,[w]:g.Type(f[w])}),{});return S.length>0?this.Create({..._,...$,[e.Kind]:"Object",type:"object",properties:h,required:S}):this.Create({..._,...$,[e.Kind]:"Object",type:"object",properties:h})}Omit(f,_,O={}){let k=B.Resolve(_);return q.Map(this.Discard(g.Type(f),["$id",e.Transform]),S=>{i.IsArray(S.required)&&(S.required=S.required.filter($=>!k.includes($)),S.required.length===0&&delete S.required);for(let $ of Object.getOwnPropertyNames(S.properties))k.includes($)&&delete S.properties[$];return this.Create(S)},O)}Partial(f,_={}){return q.Map(this.Discard(g.Type(f),["$id",e.Transform]),O=>{let k=Object.getOwnPropertyNames(O.properties).reduce((S,$)=>({...S,[$]:this.Optional(O.properties[$])}),{});return this.Object(k,this.Discard(O,["required"]))},_)}Pick(f,_,O={}){let k=B.Resolve(_);return q.Map(this.Discard(g.Type(f),["$id",e.Transform]),S=>{i.IsArray(S.required)&&(S.required=S.required.filter($=>k.includes($)),S.required.length===0&&delete S.required);for(let $ of Object.getOwnPropertyNames(S.properties))k.includes($)||delete S.properties[$];return this.Create(S)},O)}Record(f,_,O={}){return o.TTemplateLiteral(f)?(()=>{let k=z.ParseExact(f.pattern);return M.Check(k)?this.Object([...C.Generate(k)].reduce((S,$)=>({...S,[$]:g.Type(_)}),{}),O):this.Create({...O,[e.Kind]:"Record",type:"object",patternProperties:{[f.pattern]:g.Type(_)}})})():o.TUnion(f)?(()=>{let k=V.Resolve(f);if(o.TUnionLiteral(k)){let S=k.anyOf.reduce(($,h)=>({...$,[h.const]:g.Type(_)}),{});return this.Object(S,{...O,[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(_)},O):this.Throw("Record key of type literal is not of type string or number"):o.TInteger(f)||o.TNumber(f)?this.Create({...O,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:g.Type(_)}}):o.TString(f)?(()=>{let k=i.IsUndefined(f.pattern)?e.PatternStringExact:f.pattern;return this.Create({...O,[e.Kind]:"Record",type:"object",patternProperties:{[k]:g.Type(_)}})})():this.Never()}Recursive(f,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${K++}`);let O=f({[e.Kind]:"This",$ref:`${_.$id}`});return O.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...O})}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 q.Map(this.Discard(g.Type(f),["$id",e.Transform]),O=>{let k=Object.getOwnPropertyNames(O.properties).reduce((S,$)=>({...S,[$]:this.Discard(O.properties[$],[e.Optional])}),{});return this.Object(k,O)},_)}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 O=i.IsString(f)?se.Create(Q.Parse(f)):se.Create(f);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:O})}Transform(f){return new X(f)}Tuple(f,_={}){let[O,k,S]=[!1,f.length,f.length],$=g.Rest(f),h=f.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:$,additionalItems:O,minItems:k,maxItems:S}:{..._,[e.Kind]:"Tuple",type:"array",minItems:k,maxItems:S};return this.Create(h)}Uncapitalize(f,_={}){return{...j.Map(g.Type(f),"Uncapitalize"),..._}}Union(f,_={}){return o.TTemplateLiteral(f)?F.Resolve(f):(()=>{let O=f;if(O.length===0)return this.Never(_);if(O.length===1)return this.Create(g.Type(O[0],_));let k=g.Rest(O);return this.Create({..._,[e.Kind]:"Union",anyOf:k})})()}Unknown(f={}){return this.Create({...f,[e.Kind]:"Unknown"})}Unsafe(f={}){return this.Create({...f,[e.Kind]:f[e.Kind]||"Unsafe"})}Uppercase(f,_={}){return{...j.Map(g.Type(f),"Uppercase"),..._}}};e.JsonTypeBuilder=W;var fe=class extends W{AsyncIterator(f,_={}){return this.Create({..._,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:g.Type(f)})}Awaited(f,_={}){let O=k=>k.length>0?(()=>{let[S,...$]=k;return[this.Awaited(S),...O($)]})():k;return o.TIntersect(f)?e.Type.Intersect(O(f.allOf)):o.TUnion(f)?e.Type.Union(O(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,_,O){let[k,S]=[g.Rest(f),g.Type(_)];return this.Create({...O,[e.Kind]:"Constructor",type:"Constructor",parameters:k,returns:S})}Date(f={}){return this.Create({...f,[e.Kind]:"Date",type:"Date"})}Function(f,_,O){let[k,S]=[g.Rest(f),g.Type(_)];return this.Create({...O,[e.Kind]:"Function",type:"Function",parameters:k,returns:S})}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 O=i.IsString(f)?f:f.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:O})}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 W,e.Type=new fe}),ln=Le(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(F){return c(F)&&Symbol.asyncIterator in F}e.IsAsyncIterator=t;function r(F){return c(F)&&Symbol.iterator in F}e.IsIterator=r;function n(F){return ArrayBuffer.isView(F)}e.IsTypedArray=n;function i(F){return F instanceof Promise}e.IsPromise=i;function a(F){return F instanceof Uint8Array}e.IsUint8Array=a;function o(F){return F instanceof Date&&Number.isFinite(F.getTime())}e.IsDate=o;function u(F,ue){return ue in F}e.HasPropertyKey=u;function l(F){return c(F)&&V(F.constructor)&&F.constructor.name==="Object"}e.IsPlainObject=l;function c(F){return F!==null&&typeof F=="object"}e.IsObject=c;function m(F){return Array.isArray(F)&&!ArrayBuffer.isView(F)}e.IsArray=m;function g(F){return F===void 0}e.IsUndefined=g;function R(F){return F===null}e.IsNull=R;function j(F){return typeof F=="boolean"}e.IsBoolean=j;function q(F){return typeof F=="number"}e.IsNumber=q;function Z(F){return q(F)&&Number.isInteger(F)}e.IsInteger=Z;function ae(F){return typeof F=="bigint"}e.IsBigInt=ae;function B(F){return typeof F=="string"}e.IsString=B;function V(F){return typeof F=="function"}e.IsFunction=V;function H(F){return typeof F=="symbol"}e.IsSymbol=H;function se(F){return ae(F)||j(F)||R(F)||q(F)||B(F)||H(F)||g(F)}e.IsValueType=se}),Nl=Le(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=ln(),r=mo(),n=Pr(),i=class extends n.TypeBoxError{constructor(m){super(`Duplicate type kind '${m}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var a=class extends n.TypeBoxError{constructor(m){super(`Duplicate string format '${m}' detected`)}};e.TypeSystemDuplicateFormat=a;var o;(function(m){function g(j,q){if(n.TypeRegistry.Has(j))throw new i(j);return n.TypeRegistry.Set(j,q),(Z={})=>n.Type.Unsafe({...Z,[n.Kind]:j})}m.Type=g;function R(j,q){if(n.FormatRegistry.Has(j))throw new a(j);return n.FormatRegistry.Set(j,q),j}m.Format=R})(o||(e.TypeSystem=o={}));var u;(function(m){let g=c;function R(){g=c}m.Reset=R;function j(Z){g=Z}m.Set=j;function q(){return g}m.Get=q})(u||(e.TypeSystemErrorFunction=u={}));var l;(function(m){m.ExactOptionalPropertyTypes=!1,m.AllowArrayObject=!1,m.AllowNaN=!1,m.AllowNullVoid=!1;function g(ae,B){return m.ExactOptionalPropertyTypes?B in ae:ae[B]!==void 0}m.IsExactOptionalProperty=g;function R(ae){let B=(0,t.IsObject)(ae);return m.AllowArrayObject?B:B&&!(0,t.IsArray)(ae)}m.IsObjectLike=R;function j(ae){return R(ae)&&!(ae instanceof Date)&&!(ae instanceof Uint8Array)}m.IsRecordLike=j;function q(ae){let B=(0,t.IsNumber)(ae);return m.AllowNaN?B:B&&Number.isFinite(ae)}m.IsNumberLike=q;function Z(ae){let B=(0,t.IsUndefined)(ae);return m.AllowNullVoid?B||ae===null:B}m.IsVoidLike=Z})(l||(e.TypeSystemPolicy=l={}));function c(m,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 ${m.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${m.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${m.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${m.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${m.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${m.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 ${m.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${m.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${m.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${m.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${m.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${m.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${m.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 m.const=="string"?`'${m.const}'`:m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${m.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${m.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${m.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 ${m.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${m.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${m.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${m.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${m.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${m.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${m.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${m.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${m.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${m.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 '${m[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=c}),yo=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=Pr(),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,a){let o=a.findIndex(u=>u.$id===i.$ref);if(o===-1)throw new r(i);return a[o]}e.Deref=n}),rs=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=ln(),r=class extends Error{constructor(P){super("Unable to hash value"),this.value=P}};e.ValueHashError=r;var n;(function(P){P[P.Undefined=0]="Undefined",P[P.Null=1]="Null",P[P.Boolean=2]="Boolean",P[P.Number=3]="Number",P[P.String=4]="String",P[P.Object=5]="Object",P[P.Array=6]="Array",P[P.Date=7]="Date",P[P.Uint8Array=8]="Uint8Array",P[P.Symbol=9]="Symbol",P[P.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[a,o]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],u=Array.from({length:256}).map((P,C)=>BigInt(C)),l=new Float64Array(1),c=new DataView(l.buffer),m=new Uint8Array(l.buffer);function*g(P){let C=P===0?1:Math.ceil(Math.floor(Math.log2(P)+1)/8);for(let Q=0;Q<C;Q++)yield P>>8*(C-1-Q)&255}function R(P){pe(n.Array);for(let C of P)z(C)}function j(P){pe(n.Boolean),pe(P?1:0)}function q(P){pe(n.BigInt),c.setBigInt64(0,P);for(let C of m)pe(C)}function Z(P){pe(n.Date),z(P.getTime())}function ae(P){pe(n.Null)}function B(P){pe(n.Number),c.setFloat64(0,P);for(let C of m)pe(C)}function V(P){pe(n.Object);for(let C of globalThis.Object.keys(P).sort())z(C),z(P[C])}function H(P){pe(n.String);for(let C=0;C<P.length;C++)for(let Q of g(P.charCodeAt(C)))pe(Q)}function se(P){pe(n.Symbol),z(P.description)}function F(P){pe(n.Uint8Array);for(let C=0;C<P.length;C++)pe(P[C])}function ue(P){return pe(n.Undefined)}function z(P){if((0,t.IsArray)(P))return R(P);if((0,t.IsBoolean)(P))return j(P);if((0,t.IsBigInt)(P))return q(P);if((0,t.IsDate)(P))return Z(P);if((0,t.IsNull)(P))return ae(P);if((0,t.IsNumber)(P))return B(P);if((0,t.IsPlainObject)(P))return V(P);if((0,t.IsString)(P))return H(P);if((0,t.IsSymbol)(P))return se(P);if((0,t.IsUint8Array)(P))return F(P);if((0,t.IsUndefined)(P))return ue(P);throw new r(P)}function pe(P){i=i^u[P],i=i*a%o}function M(P){return i=BigInt("14695981039346656037"),z(P),i}e.Hash=M}),mo=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=ln(),r=Nl(),n=yo(),i=rs(),a=Pr(),o;(function(s){s[s.ArrayContains=0]="ArrayContains",s[s.ArrayMaxContains=1]="ArrayMaxContains",s[s.ArrayMaxItems=2]="ArrayMaxItems",s[s.ArrayMinContains=3]="ArrayMinContains",s[s.ArrayMinItems=4]="ArrayMinItems",s[s.ArrayUniqueItems=5]="ArrayUniqueItems",s[s.Array=6]="Array",s[s.AsyncIterator=7]="AsyncIterator",s[s.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",s[s.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",s[s.BigIntMaximum=10]="BigIntMaximum",s[s.BigIntMinimum=11]="BigIntMinimum",s[s.BigIntMultipleOf=12]="BigIntMultipleOf",s[s.BigInt=13]="BigInt",s[s.Boolean=14]="Boolean",s[s.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",s[s.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",s[s.DateMaximumTimestamp=17]="DateMaximumTimestamp",s[s.DateMinimumTimestamp=18]="DateMinimumTimestamp",s[s.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",s[s.Date=20]="Date",s[s.Function=21]="Function",s[s.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",s[s.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",s[s.IntegerMaximum=24]="IntegerMaximum",s[s.IntegerMinimum=25]="IntegerMinimum",s[s.IntegerMultipleOf=26]="IntegerMultipleOf",s[s.Integer=27]="Integer",s[s.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",s[s.Intersect=29]="Intersect",s[s.Iterator=30]="Iterator",s[s.Kind=31]="Kind",s[s.Literal=32]="Literal",s[s.Never=33]="Never",s[s.Not=34]="Not",s[s.Null=35]="Null",s[s.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",s[s.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",s[s.NumberMaximum=38]="NumberMaximum",s[s.NumberMinimum=39]="NumberMinimum",s[s.NumberMultipleOf=40]="NumberMultipleOf",s[s.Number=41]="Number",s[s.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",s[s.ObjectMaxProperties=43]="ObjectMaxProperties",s[s.ObjectMinProperties=44]="ObjectMinProperties",s[s.ObjectRequiredProperty=45]="ObjectRequiredProperty",s[s.Object=46]="Object",s[s.Promise=47]="Promise",s[s.StringFormatUnknown=48]="StringFormatUnknown",s[s.StringFormat=49]="StringFormat",s[s.StringMaxLength=50]="StringMaxLength",s[s.StringMinLength=51]="StringMinLength",s[s.StringPattern=52]="StringPattern",s[s.String=53]="String",s[s.Symbol=54]="Symbol",s[s.TupleLength=55]="TupleLength",s[s.Tuple=56]="Tuple",s[s.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",s[s.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",s[s.Uint8Array=59]="Uint8Array",s[s.Undefined=60]="Undefined",s[s.Union=61]="Union",s[s.Void=62]="Void"})(o||(e.ValueErrorType=o={}));var u=class extends a.TypeBoxError{constructor(s){super("Unknown type"),this.schema=s}};e.ValueErrorsUnknownTypeError=u;function l(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=l;function c(s){return s!==void 0}var m=class{constructor(s){this.iterator=s}[Symbol.iterator](){return this.iterator}First(){let s=this.iterator.next();return s.done?void 0:s.value}};e.ValueErrorIterator=m;function g(s,T,b,v){return{type:s,schema:T,path:b,value:v,message:r.TypeSystemErrorFunction.Get()(T,s)}}function*R(s,T,b,v){}function*j(s,T,b,v){if(!(0,t.IsArray)(v))return yield g(o.Array,s,b,v);c(s.minItems)&&!(v.length>=s.minItems)&&(yield g(o.ArrayMinItems,s,b,v)),c(s.maxItems)&&!(v.length<=s.maxItems)&&(yield g(o.ArrayMaxItems,s,b,v));for(let J=0;J<v.length;J++)yield*I(s.items,T,`${b}/${J}`,v[J]);if(s.uniqueItems===!0&&!function(){let J=new Set;for(let ee of v){let ye=(0,i.Hash)(ee);if(J.has(ye))return!1;J.add(ye)}return!0}()&&(yield g(o.ArrayUniqueItems,s,b,v)),!(c(s.contains)||c(s.minContains)||c(s.maxContains)))return;let U=c(s.contains)?s.contains:a.Type.Never(),L=v.reduce((J,ee,ye)=>I(U,T,`${b}${ye}`,ee).next().done===!0?J+1:J,0);L===0&&(yield g(o.ArrayContains,s,b,v)),(0,t.IsNumber)(s.minContains)&&L<s.minContains&&(yield g(o.ArrayMinContains,s,b,v)),(0,t.IsNumber)(s.maxContains)&&L>s.maxContains&&(yield g(o.ArrayMaxContains,s,b,v))}function*q(s,T,b,v){(0,t.IsAsyncIterator)(v)||(yield g(o.AsyncIterator,s,b,v))}function*Z(s,T,b,v){if(!(0,t.IsBigInt)(v))return yield g(o.BigInt,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.BigIntExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.BigIntExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.BigIntMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.BigIntMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==BigInt(0)&&(yield g(o.BigIntMultipleOf,s,b,v))}function*ae(s,T,b,v){(0,t.IsBoolean)(v)||(yield g(o.Boolean,s,b,v))}function*B(s,T,b,v){yield*I(s.returns,T,b,v.prototype)}function*V(s,T,b,v){if(!(0,t.IsDate)(v))return yield g(o.Date,s,b,v);c(s.exclusiveMaximumTimestamp)&&!(v.getTime()<s.exclusiveMaximumTimestamp)&&(yield g(o.DateExclusiveMaximumTimestamp,s,b,v)),c(s.exclusiveMinimumTimestamp)&&!(v.getTime()>s.exclusiveMinimumTimestamp)&&(yield g(o.DateExclusiveMinimumTimestamp,s,b,v)),c(s.maximumTimestamp)&&!(v.getTime()<=s.maximumTimestamp)&&(yield g(o.DateMaximumTimestamp,s,b,v)),c(s.minimumTimestamp)&&!(v.getTime()>=s.minimumTimestamp)&&(yield g(o.DateMinimumTimestamp,s,b,v)),c(s.multipleOfTimestamp)&&v.getTime()%s.multipleOfTimestamp!==0&&(yield g(o.DateMultipleOfTimestamp,s,b,v))}function*H(s,T,b,v){(0,t.IsFunction)(v)||(yield g(o.Function,s,b,v))}function*se(s,T,b,v){if(!(0,t.IsInteger)(v))return yield g(o.Integer,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.IntegerExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.IntegerExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.IntegerMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.IntegerMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==0&&(yield g(o.IntegerMultipleOf,s,b,v))}function*F(s,T,b,v){for(let U of s.allOf){let L=I(U,T,b,v).next();L.done||(yield g(o.Intersect,s,b,v),yield L.value)}if(s.unevaluatedProperties===!1){let U=new RegExp(a.KeyResolver.ResolvePattern(s));for(let L of Object.getOwnPropertyNames(v))U.test(L)||(yield g(o.IntersectUnevaluatedProperties,s,`${b}/${L}`,v))}if(typeof s.unevaluatedProperties=="object"){let U=new RegExp(a.KeyResolver.ResolvePattern(s));for(let L of Object.getOwnPropertyNames(v))if(!U.test(L)){let J=I(s.unevaluatedProperties,T,`${b}/${L}`,v[L]).next();J.done||(yield J.value)}}}function*ue(s,T,b,v){(0,t.IsIterator)(v)||(yield g(o.Iterator,s,b,v))}function*z(s,T,b,v){v!==s.const&&(yield g(o.Literal,s,b,v))}function*pe(s,T,b,v){yield g(o.Never,s,b,v)}function*M(s,T,b,v){I(s.not,T,b,v).next().done===!0&&(yield g(o.Not,s,b,v))}function*P(s,T,b,v){(0,t.IsNull)(v)||(yield g(o.Null,s,b,v))}function*C(s,T,b,v){if(!r.TypeSystemPolicy.IsNumberLike(v))return yield g(o.Number,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.NumberExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.NumberExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.NumberMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.NumberMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==0&&(yield g(o.NumberMultipleOf,s,b,v))}function*Q(s,T,b,v){if(!r.TypeSystemPolicy.IsObjectLike(v))return yield g(o.Object,s,b,v);c(s.minProperties)&&!(Object.getOwnPropertyNames(v).length>=s.minProperties)&&(yield g(o.ObjectMinProperties,s,b,v)),c(s.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=s.maxProperties)&&(yield g(o.ObjectMaxProperties,s,b,v));let U=Array.isArray(s.required)?s.required:[],L=Object.getOwnPropertyNames(s.properties),J=Object.getOwnPropertyNames(v);for(let ee of U)J.includes(ee)||(yield g(o.ObjectRequiredProperty,s.properties[ee],`${b}/${l(ee)}`,void 0));if(s.additionalProperties===!1)for(let ee of J)L.includes(ee)||(yield g(o.ObjectAdditionalProperties,s,`${b}/${l(ee)}`,v[ee]));if(typeof s.additionalProperties=="object")for(let ee of J)L.includes(ee)||(yield*I(s.additionalProperties,T,`${b}/${l(ee)}`,v[ee]));for(let ee of L){let ye=s.properties[ee];s.required&&s.required.includes(ee)?(yield*I(ye,T,`${b}/${l(ee)}`,v[ee]),a.ExtendsUndefined.Check(s)&&!(ee in v)&&(yield g(o.ObjectRequiredProperty,ye,`${b}/${l(ee)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(v,ee)&&(yield*I(ye,T,`${b}/${l(ee)}`,v[ee]))}}function*X(s,T,b,v){(0,t.IsPromise)(v)||(yield g(o.Promise,s,b,v))}function*E(s,T,b,v){if(!r.TypeSystemPolicy.IsRecordLike(v))return yield g(o.Object,s,b,v);c(s.minProperties)&&!(Object.getOwnPropertyNames(v).length>=s.minProperties)&&(yield g(o.ObjectMinProperties,s,b,v)),c(s.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=s.maxProperties)&&(yield g(o.ObjectMaxProperties,s,b,v));let[U,L]=Object.entries(s.patternProperties)[0],J=new RegExp(U);for(let[ee,ye]of Object.entries(v))J.test(ee)&&(yield*I(L,T,`${b}/${l(ee)}`,ye));if(typeof s.additionalProperties=="object")for(let[ee,ye]of Object.entries(v))J.test(ee)||(yield*I(s.additionalProperties,T,`${b}/${l(ee)}`,ye));if(s.additionalProperties===!1){for(let[ee,ye]of Object.entries(v))if(!J.test(ee))return yield g(o.ObjectAdditionalProperties,s,`${b}/${l(ee)}`,ye)}}function*K(s,T,b,v){yield*I((0,n.Deref)(s,T),T,b,v)}function*te(s,T,b,v){if(!(0,t.IsString)(v))return yield g(o.String,s,b,v);c(s.minLength)&&!(v.length>=s.minLength)&&(yield g(o.StringMinLength,s,b,v)),c(s.maxLength)&&!(v.length<=s.maxLength)&&(yield g(o.StringMaxLength,s,b,v)),(0,t.IsString)(s.pattern)&&(new RegExp(s.pattern).test(v)||(yield g(o.StringPattern,s,b,v))),(0,t.IsString)(s.format)&&(a.FormatRegistry.Has(s.format)?a.FormatRegistry.Get(s.format)(v)||(yield g(o.StringFormat,s,b,v)):yield g(o.StringFormatUnknown,s,b,v))}function*G(s,T,b,v){(0,t.IsSymbol)(v)||(yield g(o.Symbol,s,b,v))}function*W(s,T,b,v){if(!(0,t.IsString)(v))return yield g(o.String,s,b,v);new RegExp(s.pattern).test(v)||(yield g(o.StringPattern,s,b,v))}function*fe(s,T,b,v){yield*I((0,n.Deref)(s,T),T,b,v)}function*f(s,T,b,v){if(!(0,t.IsArray)(v))return yield g(o.Tuple,s,b,v);if(s.items===void 0&&v.length!==0)return yield g(o.TupleLength,s,b,v);if(v.length!==s.maxItems)return yield g(o.TupleLength,s,b,v);if(s.items)for(let U=0;U<s.items.length;U++)yield*I(s.items[U],T,`${b}/${U}`,v[U])}function*_(s,T,b,v){(0,t.IsUndefined)(v)||(yield g(o.Undefined,s,b,v))}function*O(s,T,b,v){let U=0;for(let L of s.anyOf){let J=[...I(L,T,b,v)];if(J.length===0)return;U+=J.length}U>0&&(yield g(o.Union,s,b,v))}function*k(s,T,b,v){if(!(0,t.IsUint8Array)(v))return yield g(o.Uint8Array,s,b,v);c(s.maxByteLength)&&!(v.length<=s.maxByteLength)&&(yield g(o.Uint8ArrayMaxByteLength,s,b,v)),c(s.minByteLength)&&!(v.length>=s.minByteLength)&&(yield g(o.Uint8ArrayMinByteLength,s,b,v))}function*S(s,T,b,v){}function*$(s,T,b,v){r.TypeSystemPolicy.IsVoidLike(v)||(yield g(o.Void,s,b,v))}function*h(s,T,b,v){a.TypeRegistry.Get(s[a.Kind])(s,v)||(yield g(o.Kind,s,b,v))}function*I(s,T,b,v){let U=c(s.$id)?[...T,s]:T,L=s;switch(L[a.Kind]){case"Any":return yield*R(L,U,b,v);case"Array":return yield*j(L,U,b,v);case"AsyncIterator":return yield*q(L,U,b,v);case"BigInt":return yield*Z(L,U,b,v);case"Boolean":return yield*ae(L,U,b,v);case"Constructor":return yield*B(L,U,b,v);case"Date":return yield*V(L,U,b,v);case"Function":return yield*H(L,U,b,v);case"Integer":return yield*se(L,U,b,v);case"Intersect":return yield*F(L,U,b,v);case"Iterator":return yield*ue(L,U,b,v);case"Literal":return yield*z(L,U,b,v);case"Never":return yield*pe(L,U,b,v);case"Not":return yield*M(L,U,b,v);case"Null":return yield*P(L,U,b,v);case"Number":return yield*C(L,U,b,v);case"Object":return yield*Q(L,U,b,v);case"Promise":return yield*X(L,U,b,v);case"Record":return yield*E(L,U,b,v);case"Ref":return yield*K(L,U,b,v);case"String":return yield*te(L,U,b,v);case"Symbol":return yield*G(L,U,b,v);case"TemplateLiteral":return yield*W(L,U,b,v);case"This":return yield*fe(L,U,b,v);case"Tuple":return yield*f(L,U,b,v);case"Undefined":return yield*_(L,U,b,v);case"Union":return yield*O(L,U,b,v);case"Uint8Array":return yield*k(L,U,b,v);case"Unknown":return yield*S(L,U,b,v);case"Void":return yield*$(L,U,b,v);default:if(!a.TypeRegistry.Has(L[a.Kind]))throw new u(s);return yield*h(L,U,b,v)}}function w(...s){let T=s.length===3?I(s[0],s[1],"",s[2]):I(s[0],[],"",s[1]);return new m(T)}e.Errors=w}),Mm=Le(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var u=Object.getOwnPropertyDescriptor(i,a);(!u||("get"in u?!i.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,u)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),r=e&&e.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&t(i,n,a)};Object.defineProperty(e,"__esModule",{value:!0}),r(mo(),e)}),Pl=Le(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(i,a,o,u){u===void 0&&(u=o);var l=Object.getOwnPropertyDescriptor(a,o);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,u,l)}:function(i,a,o,u){u===void 0&&(u=o),i[u]=a[o]}),r=e&&e.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=mo();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(Nl(),e)}),Lm=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=ln(),r=Pl(),n=yo(),i=rs(),a=Pr(),o=class extends a.TypeBoxError{constructor(h){super("Unknown type"),this.schema=h}};e.ValueCheckUnknownTypeError=o;function u(h){return h[a.Kind]==="Any"||h[a.Kind]==="Unknown"}function l(h){return h!==void 0}function c(h,I,w){return!0}function m(h,I,w){if(!(0,t.IsArray)(w)||l(h.minItems)&&!(w.length>=h.minItems)||l(h.maxItems)&&!(w.length<=h.maxItems)||!w.every(b=>S(h.items,I,b))||h.uniqueItems===!0&&!function(){let b=new Set;for(let v of w){let U=(0,i.Hash)(v);if(b.has(U))return!1;b.add(U)}return!0}())return!1;if(!(l(h.contains)||(0,t.IsNumber)(h.minContains)||(0,t.IsNumber)(h.maxContains)))return!0;let s=l(h.contains)?h.contains:a.Type.Never(),T=w.reduce((b,v)=>S(s,I,v)?b+1:b,0);return!(T===0||(0,t.IsNumber)(h.minContains)&&T<h.minContains||(0,t.IsNumber)(h.maxContains)&&T>h.maxContains)}function g(h,I,w){return(0,t.IsAsyncIterator)(w)}function R(h,I,w){return!(!(0,t.IsBigInt)(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.minimum)&&!(w>=h.minimum)||l(h.multipleOf)&&w%h.multipleOf!==BigInt(0))}function j(h,I,w){return(0,t.IsBoolean)(w)}function q(h,I,w){return S(h.returns,I,w.prototype)}function Z(h,I,w){return!(!(0,t.IsDate)(w)||l(h.exclusiveMaximumTimestamp)&&!(w.getTime()<h.exclusiveMaximumTimestamp)||l(h.exclusiveMinimumTimestamp)&&!(w.getTime()>h.exclusiveMinimumTimestamp)||l(h.maximumTimestamp)&&!(w.getTime()<=h.maximumTimestamp)||l(h.minimumTimestamp)&&!(w.getTime()>=h.minimumTimestamp)||l(h.multipleOfTimestamp)&&w.getTime()%h.multipleOfTimestamp!==0)}function ae(h,I,w){return(0,t.IsFunction)(w)}function B(h,I,w){return!(!(0,t.IsInteger)(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.minimum)&&!(w>=h.minimum)||l(h.multipleOf)&&w%h.multipleOf!==0)}function V(h,I,w){let s=h.allOf.every(T=>S(T,I,w));if(h.unevaluatedProperties===!1){let T=new RegExp(a.KeyResolver.ResolvePattern(h)),b=Object.getOwnPropertyNames(w).every(v=>T.test(v));return s&&b}else if(a.TypeGuard.TSchema(h.unevaluatedProperties)){let T=new RegExp(a.KeyResolver.ResolvePattern(h)),b=Object.getOwnPropertyNames(w).every(v=>T.test(v)||S(h.unevaluatedProperties,I,w[v]));return s&&b}else return s}function H(h,I,w){return(0,t.IsIterator)(w)}function se(h,I,w){return w===h.const}function F(h,I,w){return!1}function ue(h,I,w){return!S(h.not,I,w)}function z(h,I,w){return(0,t.IsNull)(w)}function pe(h,I,w){return!(!r.TypeSystemPolicy.IsNumberLike(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.minimum)&&!(w>=h.minimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.multipleOf)&&w%h.multipleOf!==0)}function M(h,I,w){if(!r.TypeSystemPolicy.IsObjectLike(w)||l(h.minProperties)&&!(Object.getOwnPropertyNames(w).length>=h.minProperties)||l(h.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=h.maxProperties))return!1;let s=Object.getOwnPropertyNames(h.properties);for(let T of s){let b=h.properties[T];if(h.required&&h.required.includes(T)){if(!S(b,I,w[T])||(a.ExtendsUndefined.Check(b)||u(b))&&!(T in w))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(w,T)&&!S(b,I,w[T]))return!1}if(h.additionalProperties===!1){let T=Object.getOwnPropertyNames(w);return h.required&&h.required.length===s.length&&T.length===s.length?!0:T.every(b=>s.includes(b))}else return typeof h.additionalProperties=="object"?Object.getOwnPropertyNames(w).every(T=>s.includes(T)||S(h.additionalProperties,I,w[T])):!0}function P(h,I,w){return(0,t.IsPromise)(w)}function C(h,I,w){if(!r.TypeSystemPolicy.IsRecordLike(w)||l(h.minProperties)&&!(Object.getOwnPropertyNames(w).length>=h.minProperties)||l(h.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=h.maxProperties))return!1;let[s,T]=Object.entries(h.patternProperties)[0],b=new RegExp(s),v=Object.entries(w).every(([J,ee])=>b.test(J)?S(T,I,ee):!0),U=typeof h.additionalProperties=="object"?Object.entries(w).every(([J,ee])=>b.test(J)?!0:S(h.additionalProperties,I,ee)):!0,L=h.additionalProperties===!1?Object.getOwnPropertyNames(w).every(J=>b.test(J)):!0;return v&&U&&L}function Q(h,I,w){return S((0,n.Deref)(h,I),I,w)}function X(h,I,w){return!(0,t.IsString)(w)||l(h.minLength)&&!(w.length>=h.minLength)||l(h.maxLength)&&!(w.length<=h.maxLength)||l(h.pattern)&&!new RegExp(h.pattern).test(w)?!1:l(h.format)?a.FormatRegistry.Has(h.format)?a.FormatRegistry.Get(h.format)(w):!1:!0}function E(h,I,w){return(0,t.IsSymbol)(w)}function K(h,I,w){return(0,t.IsString)(w)&&new RegExp(h.pattern).test(w)}function te(h,I,w){return S((0,n.Deref)(h,I),I,w)}function G(h,I,w){if(!(0,t.IsArray)(w)||h.items===void 0&&w.length!==0||w.length!==h.maxItems)return!1;if(!h.items)return!0;for(let s=0;s<h.items.length;s++)if(!S(h.items[s],I,w[s]))return!1;return!0}function W(h,I,w){return(0,t.IsUndefined)(w)}function fe(h,I,w){return h.anyOf.some(s=>S(s,I,w))}function f(h,I,w){return!(!(0,t.IsUint8Array)(w)||l(h.maxByteLength)&&!(w.length<=h.maxByteLength)||l(h.minByteLength)&&!(w.length>=h.minByteLength))}function _(h,I,w){return!0}function O(h,I,w){return r.TypeSystemPolicy.IsVoidLike(w)}function k(h,I,w){return a.TypeRegistry.Has(h[a.Kind])?a.TypeRegistry.Get(h[a.Kind])(h,w):!1}function S(h,I,w){let s=l(h.$id)?[...I,h]:I,T=h;switch(T[a.Kind]){case"Any":return c(T,s,w);case"Array":return m(T,s,w);case"AsyncIterator":return g(T,s,w);case"BigInt":return R(T,s,w);case"Boolean":return j(T,s,w);case"Constructor":return q(T,s,w);case"Date":return Z(T,s,w);case"Function":return ae(T,s,w);case"Integer":return B(T,s,w);case"Intersect":return V(T,s,w);case"Iterator":return H(T,s,w);case"Literal":return se(T,s,w);case"Never":return F(T,s,w);case"Not":return ue(T,s,w);case"Null":return z(T,s,w);case"Number":return pe(T,s,w);case"Object":return M(T,s,w);case"Promise":return P(T,s,w);case"Record":return C(T,s,w);case"Ref":return Q(T,s,w);case"String":return X(T,s,w);case"Symbol":return E(T,s,w);case"TemplateLiteral":return K(T,s,w);case"This":return te(T,s,w);case"Tuple":return G(T,s,w);case"Undefined":return W(T,s,w);case"Union":return fe(T,s,w);case"Uint8Array":return f(T,s,w);case"Unknown":return _(T,s,w);case"Void":return O(T,s,w);default:if(!a.TypeRegistry.Has(T[a.Kind]))throw new o(T);return k(T,s,w)}}function $(...h){return h.length===3?S(h[0],h[1],h[2]):S(h[0],[],h[1])}e.Check=$}),Dm=Le(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=ln(),r=yo(),n=Lm(),i=Pr(),a=class extends i.TypeBoxError{constructor(R,j,q){super("Unable to decode due to invalid value"),this.schema=R,this.value=j,this.error=q}};e.TransformDecodeCheckError=a;var o=class extends i.TypeBoxError{constructor(R,j,q){super("Unable to encode due to invalid value"),this.schema=R,this.value=j,this.error=q}};e.TransformEncodeCheckError=o;var u=class extends i.TypeBoxError{constructor(R,j,q){super(`${q instanceof Error?q.message:"Unknown error"}`),this.schema=R,this.value=j}};e.TransformDecodeError=u;var l=class extends i.TypeBoxError{constructor(R,j,q){super(`${q instanceof Error?q.message:"Unknown error"}`),this.schema=R,this.value=j}};e.TransformEncodeError=l;var c;(function(R){function j(E,K){return i.TypeGuard.TTransform(E)||C(E.items,K)}function q(E,K){return i.TypeGuard.TTransform(E)||C(E.items,K)}function Z(E,K){return i.TypeGuard.TTransform(E)||C(E.returns,K)||E.parameters.some(te=>C(te,K))}function ae(E,K){return i.TypeGuard.TTransform(E)||C(E.returns,K)||E.parameters.some(te=>C(te,K))}function B(E,K){return i.TypeGuard.TTransform(E)||i.TypeGuard.TTransform(E.unevaluatedProperties)||E.allOf.some(te=>C(te,K))}function V(E,K){return i.TypeGuard.TTransform(E)||C(E.items,K)}function H(E,K){return i.TypeGuard.TTransform(E)||C(E.not,K)}function se(E,K){return i.TypeGuard.TTransform(E)||Object.values(E.properties).some(te=>C(te,K))||i.TypeGuard.TSchema(E.additionalProperties)&&C(E.additionalProperties,K)}function F(E,K){return i.TypeGuard.TTransform(E)||C(E.item,K)}function ue(E,K){let te=Object.getOwnPropertyNames(E.patternProperties)[0],G=E.patternProperties[te];return i.TypeGuard.TTransform(E)||C(G,K)||i.TypeGuard.TSchema(E.additionalProperties)&&i.TypeGuard.TTransform(E.additionalProperties)}function z(E,K){return i.TypeGuard.TTransform(E)?!0:C((0,r.Deref)(E,K),K)}function pe(E,K){return i.TypeGuard.TTransform(E)?!0:C((0,r.Deref)(E,K),K)}function M(E,K){return i.TypeGuard.TTransform(E)||!(0,t.IsUndefined)(E.items)&&E.items.some(te=>C(te,K))}function P(E,K){return i.TypeGuard.TTransform(E)||E.anyOf.some(te=>C(te,K))}function C(E,K){let te=(0,t.IsString)(E.$id)?[...K,E]:K,G=E;if(E.$id&&Q.has(E.$id))return!1;switch(E.$id&&Q.add(E.$id),E[i.Kind]){case"Array":return j(G,te);case"AsyncIterator":return q(G,te);case"Constructor":return Z(G,te);case"Function":return ae(G,te);case"Intersect":return B(G,te);case"Iterator":return V(G,te);case"Not":return H(G,te);case"Object":return se(G,te);case"Promise":return F(G,te);case"Record":return ue(G,te);case"Ref":return z(G,te);case"This":return pe(G,te);case"Tuple":return M(G,te);case"Union":return P(G,te);default:return i.TypeGuard.TTransform(E)}}let Q=new Set;function X(E,K){return Q.clear(),C(E,K)}R.Has=X})(c||(e.HasTransform=c={}));var m;(function(R){function j(M,P){try{return i.TypeGuard.TTransform(M)?M[i.Transform].Decode(P):P}catch(C){throw new u(M,P,C)}}function q(M,P,C){return(0,t.IsArray)(C)?j(M,C.map(Q=>z(M.items,P,Q))):j(M,C)}function Z(M,P,C){if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return j(M,C);let Q=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),X=Q.reduce((G,W)=>W in G?{...G,[W]:z(i.IndexedAccessor.Resolve(M,[W]),P,G[W])}:G,C);if(!i.TypeGuard.TTransform(M.unevaluatedProperties))return j(M,X);let E=Object.getOwnPropertyNames(X),K=M.unevaluatedProperties,te=E.reduce((G,W)=>Q.includes(W)?G:{...G,[W]:j(K,G[W])},X);return j(M,te)}function ae(M,P,C){return j(M,z(M.not,P,C))}function B(M,P,C){if(!(0,t.IsPlainObject)(C))return j(M,C);let Q=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),X=Q.reduce((G,W)=>W in G?{...G,[W]:z(M.properties[W],P,G[W])}:G,C);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,X);let E=Object.getOwnPropertyNames(X),K=M.additionalProperties,te=E.reduce((G,W)=>Q.includes(W)?G:{...G,[W]:j(K,G[W])},X);return j(M,te)}function V(M,P,C){if(!(0,t.IsPlainObject)(C))return j(M,C);let Q=Object.getOwnPropertyNames(M.patternProperties)[0],X=new RegExp(Q),E=Object.getOwnPropertyNames(C).reduce((W,fe)=>X.test(fe)?{...W,[fe]:z(M.patternProperties[Q],P,W[fe])}:W,C);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,E);let K=Object.getOwnPropertyNames(E),te=M.additionalProperties,G=K.reduce((W,fe)=>X.test(fe)?W:{...W,[fe]:j(te,W[fe])},E);return j(M,G)}function H(M,P,C){let Q=(0,r.Deref)(M,P);return j(M,z(Q,P,C))}function se(M,P,C){let Q=(0,r.Deref)(M,P);return j(M,z(Q,P,C))}function F(M,P,C){return(0,t.IsArray)(C)&&(0,t.IsArray)(M.items)?j(M,M.items.map((Q,X)=>z(Q,P,C[X]))):j(M,C)}function ue(M,P,C){let Q=j(M,C);for(let X of M.anyOf)if((0,n.Check)(X,P,Q))return z(X,P,Q);return Q}function z(M,P,C){let Q=typeof M.$id=="string"?[...P,M]:P,X=M;switch(M[i.Kind]){case"Array":return q(X,Q,C);case"Intersect":return Z(X,Q,C);case"Not":return ae(X,Q,C);case"Object":return B(X,Q,C);case"Record":return V(X,Q,C);case"Ref":return H(X,Q,C);case"Symbol":return j(X,C);case"This":return se(X,Q,C);case"Tuple":return F(X,Q,C);case"Union":return ue(X,Q,C);default:return j(X,C)}}function pe(M,P,C){return z(M,P,C)}R.Decode=pe})(m||(e.DecodeTransform=m={}));var g;(function(R){function j(M,P){try{return i.TypeGuard.TTransform(M)?M[i.Transform].Encode(P):P}catch(C){throw new l(M,P,C)}}function q(M,P,C){let Q=j(M,C);return(0,t.IsArray)(Q)?Q.map(X=>z(M.items,P,X)):Q}function Z(M,P,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return Q;let X=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),E=X.reduce((G,W)=>W in Q?{...G,[W]:z(i.IndexedAccessor.Resolve(M,[W]),P,G[W])}:G,Q);if(!i.TypeGuard.TTransform(M.unevaluatedProperties))return j(M,E);let K=Object.getOwnPropertyNames(E),te=M.unevaluatedProperties;return K.reduce((G,W)=>X.includes(W)?G:{...G,[W]:j(te,G[W])},E)}function ae(M,P,C){return j(M.not,j(M,C))}function B(M,P,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C))return Q;let X=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),E=X.reduce((G,W)=>W in G?{...G,[W]:z(M.properties[W],P,G[W])}:G,Q);if(!i.TypeGuard.TSchema(M.additionalProperties))return E;let K=Object.getOwnPropertyNames(E),te=M.additionalProperties;return K.reduce((G,W)=>X.includes(W)?G:{...G,[W]:j(te,G[W])},E)}function V(M,P,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C))return Q;let X=Object.getOwnPropertyNames(M.patternProperties)[0],E=new RegExp(X),K=Object.getOwnPropertyNames(C).reduce((W,fe)=>E.test(fe)?{...W,[fe]:z(M.patternProperties[X],P,W[fe])}:W,Q);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,K);let te=Object.getOwnPropertyNames(K),G=M.additionalProperties;return te.reduce((W,fe)=>E.test(fe)?W:{...W,[fe]:j(G,W[fe])},K)}function H(M,P,C){let Q=(0,r.Deref)(M,P),X=z(Q,P,C);return j(M,X)}function se(M,P,C){let Q=(0,r.Deref)(M,P),X=z(Q,P,C);return j(M,X)}function F(M,P,C){let Q=j(M,C);return(0,t.IsArray)(M.items)?M.items.map((X,E)=>z(X,P,Q[E])):[]}function ue(M,P,C){for(let Q of M.anyOf){if(!(0,n.Check)(Q,P,C))continue;let X=z(Q,P,C);return j(M,X)}for(let Q of M.anyOf){let X=z(Q,P,C);if((0,n.Check)(M,P,X))return j(M,X)}return j(M,C)}function z(M,P,C){let Q=typeof M.$id=="string"?[...P,M]:P,X=M;switch(M[i.Kind]){case"Array":return q(X,Q,C);case"Intersect":return Z(X,Q,C);case"Not":return ae(X,Q,C);case"Object":return B(X,Q,C);case"Record":return V(X,Q,C);case"Ref":return H(X,Q,C);case"This":return se(X,Q,C);case"Tuple":return F(X,Q,C);case"Union":return ue(X,Q,C);default:return j(X,C)}}function pe(M,P,C){return z(M,P,C)}R.Encode=pe})(g||(e.EncodeTransform=g={}))}),Vm=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=Dm(),r=ln(),n=mo(),i=Pl(),a=yo(),o=rs(),u=Pr(),l=class{constructor(B,V,H,se){this.schema=B,this.references=V,this.checkFunc=H,this.code=se,this.hasTransform=t.HasTransform.Has(B,V)}Code(){return this.code}Errors(B){return(0,n.Errors)(this.schema,this.references,B)}Check(B){return this.checkFunc(B)}Decode(B){if(!this.checkFunc(B))throw new t.TransformDecodeCheckError(this.schema,B,this.Errors(B).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,B):B}Encode(B){let V=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,B):B;if(!this.checkFunc(V))throw new t.TransformEncodeCheckError(this.schema,B,this.Errors(B).First());return V}};e.TypeCheck=l;var c;(function(B){function V(ue){return ue===36}B.DollarSign=V;function H(ue){return ue===95}B.IsUnderscore=H;function se(ue){return ue>=65&&ue<=90||ue>=97&&ue<=122}B.IsAlpha=se;function F(ue){return ue>=48&&ue<=57}B.IsNumeric=F})(c||(c={}));var m;(function(B){function V(ue){return ue.length===0?!1:c.IsNumeric(ue.charCodeAt(0))}function H(ue){if(V(ue))return!1;for(let z=0;z<ue.length;z++){let pe=ue.charCodeAt(z);if(!(c.IsAlpha(pe)||c.IsNumeric(pe)||c.DollarSign(pe)||c.IsUnderscore(pe)))return!1}return!0}function se(ue){return ue.replace(/'/g,"\\'")}function F(ue,z){return H(z)?`${ue}.${z}`:`${ue}['${se(z)}']`}B.Encode=F})(m||(m={}));var g;(function(B){function V(H){let se=[];for(let F=0;F<H.length;F++){let ue=H.charCodeAt(F);c.IsNumeric(ue)||c.IsAlpha(ue)?se.push(H.charAt(F)):se.push(`_${ue}_`)}return se.join("").replace(/__/g,"_")}B.Encode=V})(g||(g={}));var R;(function(B){function V(H){return H.replace(/'/g,"\\'")}B.Escape=V})(R||(R={}));var j=class extends u.TypeBoxError{constructor(B){super("Unknown type"),this.schema=B}};e.TypeCompilerUnknownTypeError=j;var q=class extends u.TypeBoxError{constructor(B){super("Preflight validation check failed to guard for the given schema"),this.schema=B}};e.TypeCompilerTypeGuardError=q;var Z;(function(B){function V(z,pe,M){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${pe}' in ${z} ? ${M} : true)`:`(${m.Encode(z,pe)} !== undefined ? ${M} : true)`}B.IsExactOptionalProperty=V;function H(z){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${z} === 'object' && ${z} !== null)`:`(typeof ${z} === 'object' && ${z} !== null && !Array.isArray(${z}))`}B.IsObjectLike=H;function se(z){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${z} === 'object' && ${z} !== null && !(${z} instanceof Date) && !(${z} instanceof Uint8Array))`:`(typeof ${z} === 'object' && ${z} !== null && !Array.isArray(${z}) && !(${z} instanceof Date) && !(${z} instanceof Uint8Array))`}B.IsRecordLike=se;function F(z){return i.TypeSystemPolicy.AllowNaN?`typeof ${z} === 'number'`:`(typeof ${z} === 'number' && Number.isFinite(${z}))`}B.IsNumberLike=F;function ue(z){return i.TypeSystemPolicy.AllowNullVoid?`(${z} === undefined || ${z} === null)`:`${z} === undefined`}B.IsVoidLike=ue})(Z||(e.Policy=Z={}));var ae;(function(B){function V(x){return x[u.Kind]==="Any"||x[u.Kind]==="Unknown"}function*H(x,le,A){yield"true"}function*se(x,le,A){yield`Array.isArray(${A})`;let[ge,ne]=[Be("value","any"),Be("acc","number")];(0,r.IsNumber)(x.maxItems)&&(yield`${A}.length <= ${x.maxItems}`),(0,r.IsNumber)(x.minItems)&&(yield`${A}.length >= ${x.minItems}`);let de=ee(x.items,le,"value");if(yield`${A}.every((${ge}) => ${de})`,u.TypeGuard.TSchema(x.contains)||(0,r.IsNumber)(x.minContains)||(0,r.IsNumber)(x.maxContains)){let Ae=u.TypeGuard.TSchema(x.contains)?x.contains:u.Type.Never(),Ce=ee(Ae,le,"value"),We=(0,r.IsNumber)(x.minContains)?[`(count >= ${x.minContains})`]:[],qe=(0,r.IsNumber)(x.maxContains)?[`(count <= ${x.maxContains})`]:[],Xe=`const count = value.reduce((${ne}, ${ge}) => ${Ce} ? acc + 1 : acc, 0)`,qt=["(count > 0)",...We,...qe].join(" && ");yield`((${ge}) => { ${Xe}; return ${qt}})(${A})`}x.uniqueItems===!0&&(yield`((${ge}) => { 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 } )(${A})`)}function*F(x,le,A){yield`(typeof value === 'object' && Symbol.asyncIterator in ${A})`}function*ue(x,le,A){yield`(typeof ${A} === 'bigint')`,(0,r.IsBigInt)(x.exclusiveMaximum)&&(yield`${A} < BigInt(${x.exclusiveMaximum})`),(0,r.IsBigInt)(x.exclusiveMinimum)&&(yield`${A} > BigInt(${x.exclusiveMinimum})`),(0,r.IsBigInt)(x.maximum)&&(yield`${A} <= BigInt(${x.maximum})`),(0,r.IsBigInt)(x.minimum)&&(yield`${A} >= BigInt(${x.minimum})`),(0,r.IsBigInt)(x.multipleOf)&&(yield`(${A} % BigInt(${x.multipleOf})) === 0`)}function*z(x,le,A){yield`(typeof ${A} === 'boolean')`}function*pe(x,le,A){yield*L(x.returns,le,`${A}.prototype`)}function*M(x,le,A){yield`(${A} instanceof Date) && Number.isFinite(${A}.getTime())`,(0,r.IsNumber)(x.exclusiveMaximumTimestamp)&&(yield`${A}.getTime() < ${x.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(x.exclusiveMinimumTimestamp)&&(yield`${A}.getTime() > ${x.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(x.maximumTimestamp)&&(yield`${A}.getTime() <= ${x.maximumTimestamp}`),(0,r.IsNumber)(x.minimumTimestamp)&&(yield`${A}.getTime() >= ${x.minimumTimestamp}`),(0,r.IsNumber)(x.multipleOfTimestamp)&&(yield`(${A}.getTime() % ${x.multipleOfTimestamp}) === 0`)}function*P(x,le,A){yield`(typeof ${A} === 'function')`}function*C(x,le,A){yield`(typeof ${A} === 'number' && Number.isInteger(${A}))`,(0,r.IsNumber)(x.exclusiveMaximum)&&(yield`${A} < ${x.exclusiveMaximum}`),(0,r.IsNumber)(x.exclusiveMinimum)&&(yield`${A} > ${x.exclusiveMinimum}`),(0,r.IsNumber)(x.maximum)&&(yield`${A} <= ${x.maximum}`),(0,r.IsNumber)(x.minimum)&&(yield`${A} >= ${x.minimum}`),(0,r.IsNumber)(x.multipleOf)&&(yield`(${A} % ${x.multipleOf}) === 0`)}function*Q(x,le,A){let ge=x.allOf.map(ne=>ee(ne,le,A)).join(" && ");if(x.unevaluatedProperties===!1){let ne=we(`${new RegExp(u.KeyResolver.ResolvePattern(x))};`),de=`Object.getOwnPropertyNames(${A}).every(key => ${ne}.test(key))`;yield`(${ge} && ${de})`}else if(u.TypeGuard.TSchema(x.unevaluatedProperties)){let ne=we(`${new RegExp(u.KeyResolver.ResolvePattern(x))};`),de=`Object.getOwnPropertyNames(${A}).every(key => ${ne}.test(key) || ${ee(x.unevaluatedProperties,le,`${A}[key]`)})`;yield`(${ge} && ${de})`}else yield`(${ge})`}function*X(x,le,A){yield`(typeof value === 'object' && Symbol.iterator in ${A})`}function*E(x,le,A){typeof x.const=="number"||typeof x.const=="boolean"?yield`(${A} === ${x.const})`:yield`(${A} === '${R.Escape(x.const)}')`}function*K(x,le,A){yield"false"}function*te(x,le,A){yield`(!${ee(x.not,le,A)})`}function*G(x,le,A){yield`(${A} === null)`}function*W(x,le,A){yield Z.IsNumberLike(A),(0,r.IsNumber)(x.exclusiveMaximum)&&(yield`${A} < ${x.exclusiveMaximum}`),(0,r.IsNumber)(x.exclusiveMinimum)&&(yield`${A} > ${x.exclusiveMinimum}`),(0,r.IsNumber)(x.maximum)&&(yield`${A} <= ${x.maximum}`),(0,r.IsNumber)(x.minimum)&&(yield`${A} >= ${x.minimum}`),(0,r.IsNumber)(x.multipleOf)&&(yield`(${A} % ${x.multipleOf}) === 0`)}function*fe(x,le,A){yield Z.IsObjectLike(A),(0,r.IsNumber)(x.minProperties)&&(yield`Object.getOwnPropertyNames(${A}).length >= ${x.minProperties}`),(0,r.IsNumber)(x.maxProperties)&&(yield`Object.getOwnPropertyNames(${A}).length <= ${x.maxProperties}`);let ge=Object.getOwnPropertyNames(x.properties);for(let ne of ge){let de=m.Encode(A,ne),Ae=x.properties[ne];if(x.required&&x.required.includes(ne))yield*L(Ae,le,de),(u.ExtendsUndefined.Check(Ae)||V(Ae))&&(yield`('${ne}' in ${A})`);else{let Ce=ee(Ae,le,de);yield Z.IsExactOptionalProperty(A,ne,Ce)}}if(x.additionalProperties===!1)if(x.required&&x.required.length===ge.length)yield`Object.getOwnPropertyNames(${A}).length === ${ge.length}`;else{let ne=`[${ge.map(de=>`'${de}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${A}).every(key => ${ne}.includes(key))`}if(typeof x.additionalProperties=="object"){let ne=ee(x.additionalProperties,le,`${A}[key]`),de=`[${ge.map(Ae=>`'${Ae}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${A}).every(key => ${de}.includes(key) || ${ne}))`}}function*f(x,le,A){yield`(typeof value === 'object' && typeof ${A}.then === 'function')`}function*_(x,le,A){yield Z.IsRecordLike(A),(0,r.IsNumber)(x.minProperties)&&(yield`Object.getOwnPropertyNames(${A}).length >= ${x.minProperties}`),(0,r.IsNumber)(x.maxProperties)&&(yield`Object.getOwnPropertyNames(${A}).length <= ${x.maxProperties}`);let[ge,ne]=Object.entries(x.patternProperties)[0],de=we(`${new RegExp(ge)}`),Ae=ee(ne,le,"value"),Ce=u.TypeGuard.TSchema(x.additionalProperties)?ee(x.additionalProperties,le,A):x.additionalProperties===!1?"false":"true",We=`(${de}.test(key) ? ${Ae} : ${Ce})`;yield`(Object.entries(${A}).every(([key, value]) => ${We}))`}function*O(x,le,A){let ge=(0,a.Deref)(x,le);if(J.functions.has(x.$ref))return yield`${ye(x.$ref)}(${A})`;yield*L(ge,le,A)}function*k(x,le,A){yield`(typeof ${A} === 'string')`,(0,r.IsNumber)(x.maxLength)&&(yield`${A}.length <= ${x.maxLength}`),(0,r.IsNumber)(x.minLength)&&(yield`${A}.length >= ${x.minLength}`),x.pattern!==void 0&&(yield`${we(`${new RegExp(x.pattern)};`)}.test(${A})`),x.format!==void 0&&(yield`format('${x.format}', ${A})`)}function*S(x,le,A){yield`(typeof ${A} === 'symbol')`}function*$(x,le,A){yield`(typeof ${A} === 'string')`,yield`${we(`${new RegExp(x.pattern)};`)}.test(${A})`}function*h(x,le,A){yield`${ye(x.$ref)}(${A})`}function*I(x,le,A){if(yield`Array.isArray(${A})`,x.items===void 0)return yield`${A}.length === 0`;yield`(${A}.length === ${x.maxItems})`;for(let ge=0;ge<x.items.length;ge++)yield`${ee(x.items[ge],le,`${A}[${ge}]`)}`}function*w(x,le,A){yield`${A} === undefined`}function*s(x,le,A){yield`(${x.anyOf.map(ge=>ee(ge,le,A)).join(" || ")})`}function*T(x,le,A){yield`${A} instanceof Uint8Array`,(0,r.IsNumber)(x.maxByteLength)&&(yield`(${A}.length <= ${x.maxByteLength})`),(0,r.IsNumber)(x.minByteLength)&&(yield`(${A}.length >= ${x.minByteLength})`)}function*b(x,le,A){yield"true"}function*v(x,le,A){yield Z.IsVoidLike(A)}function*U(x,le,A){let ge=J.instances.size;J.instances.set(ge,x),yield`kind('${x[u.Kind]}', ${ge}, ${A})`}function*L(x,le,A,ge=!0){let ne=(0,r.IsString)(x.$id)?[...le,x]:le,de=x;if(ge&&(0,r.IsString)(x.$id)){let Ae=ye(x.$id);if(J.functions.has(Ae))return yield`${Ae}(${A})`;{let Ce=je(Ae,x,le,"value",!1);return J.functions.set(Ae,Ce),yield`${Ae}(${A})`}}switch(de[u.Kind]){case"Any":return yield*H(de,ne,A);case"Array":return yield*se(de,ne,A);case"AsyncIterator":return yield*F(de,ne,A);case"BigInt":return yield*ue(de,ne,A);case"Boolean":return yield*z(de,ne,A);case"Constructor":return yield*pe(de,ne,A);case"Date":return yield*M(de,ne,A);case"Function":return yield*P(de,ne,A);case"Integer":return yield*C(de,ne,A);case"Intersect":return yield*Q(de,ne,A);case"Iterator":return yield*X(de,ne,A);case"Literal":return yield*E(de,ne,A);case"Never":return yield*K(de,ne,A);case"Not":return yield*te(de,ne,A);case"Null":return yield*G(de,ne,A);case"Number":return yield*W(de,ne,A);case"Object":return yield*fe(de,ne,A);case"Promise":return yield*f(de,ne,A);case"Record":return yield*_(de,ne,A);case"Ref":return yield*O(de,ne,A);case"String":return yield*k(de,ne,A);case"Symbol":return yield*S(de,ne,A);case"TemplateLiteral":return yield*$(de,ne,A);case"This":return yield*h(de,ne,A);case"Tuple":return yield*I(de,ne,A);case"Undefined":return yield*w(de,ne,A);case"Union":return yield*s(de,ne,A);case"Uint8Array":return yield*T(de,ne,A);case"Unknown":return yield*b(de,ne,A);case"Void":return yield*v(de,ne,A);default:if(!u.TypeRegistry.Has(de[u.Kind]))throw new j(x);return yield*U(de,ne,A)}}let J={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ee(x,le,A,ge=!0){return`(${[...L(x,le,A,ge)].join(" && ")})`}function ye(x){return`check_${g.Encode(x)}`}function we(x){let le=`local_${J.variables.size}`;return J.variables.set(le,`const ${le} = ${x}`),le}function je(x,le,A,ge,ne=!0){let[de,Ae]=[`
|
|
21
|
-
`,Xe=>"".padStart(Xe," ")],Ce=Be("value","any"),We=dr("boolean"),qe=[...L(le,
|
|
22
|
-
}`}function Be(x,le){let
|
|
20
|
+
${W}`),K.pop(),`{${O}}`}case"number":return isFinite(E)?String(E):V?V(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(E);default:return V?V(E):void 0}}function C(X,E,K){switch(typeof E){case"string":return a(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(X),typeof E!="object")return C(X,E,K);if(E===null)return"null"}if(K.indexOf(E)!==-1)return H;let te="";if(Array.isArray(E)){if(E.length===0)return"[]";if(ue<K.length+1)return'"[Array]"';K.push(E);let _=Math.min(E.length,z),O=0;for(;O<_-1;O++){let S=C(String(O),E[O],K);te+=S!==void 0?S:"null",te+=","}let k=C(String(O),E[O],K);if(te+=k!==void 0?k:"null",E.length-1>z){let S=E.length-z-1;te+=`,"... ${j(S)} not stringified"`}return K.pop(),`[${te}]`}let G=Object.keys(E),W=G.length;if(W===0)return"{}";if(ue<K.length+1)return'"[Object]"';let fe="",f=Math.min(W,z);l(E)&&(te+=c(E,",",z),G=G.slice(E.length),f-=E.length,fe=","),F&&(G=o(G)),K.push(E);for(let _=0;_<f;_++){let O=G[_],k=C(O,E[O],K);k!==void 0&&(te+=`${fe}${a(O)}:${k}`,fe=",")}if(W>z){let _=W-z;te+=`${fe}"...":"${j(_)} not stringified"`}return K.pop(),`{${te}}`}case"number":return isFinite(E)?String(E):V?V(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(se)return String(E);default:return V?V(E):void 0}}function Q(X,E,K){if(arguments.length>1){let te="";if(typeof K=="number"?te=" ".repeat(Math.min(K,10)):typeof K=="string"&&(te=K.slice(0,10)),E!=null){if(typeof E=="function")return pe("",{"":X},[],E,te,"");if(Array.isArray(E))return M("",X,[],q(E),te,"")}if(te.length!==0)return P("",X,[],te,"")}return C("",X,[])}return Q}}),Pr=Le(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 O(){return new Map(_)}f.Entries=O;function k(){return _.clear()}f.Clear=k;function S(w){return _.delete(w)}f.Delete=S;function $(w){return _.has(w)}f.Has=$;function h(w,s){_.set(w,s)}f.Set=h;function A(w){return _.get(w)}f.Get=A})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(f){super(f)}};e.TypeBoxError=r;var n;(function(f){let _=new Map;function O(){return new Map(_)}f.Entries=O;function k(){return _.clear()}f.Clear=k;function S(w){return _.delete(w)}f.Delete=S;function $(w){return _.has(w)}f.Has=$;function h(w,s){_.set(w,s)}f.Set=h;function A(w){return _.get(w)}f.Get=A})(n||(e.FormatRegistry=n={}));var i;(function(f){function _(b){return Array.isArray(b)}f.IsArray=_;function O(b){return typeof b=="bigint"}f.IsBigInt=O;function k(b){return typeof b=="boolean"}f.IsBoolean=k;function S(b){return b instanceof globalThis.Date}f.IsDate=S;function $(b){return b===null}f.IsNull=$;function h(b){return typeof b=="number"}f.IsNumber=h;function A(b){return typeof b=="object"&&b!==null}f.IsObject=A;function w(b){return typeof b=="string"}f.IsString=w;function s(b){return b instanceof globalThis.Uint8Array}f.IsUint8Array=s;function T(b){return b===void 0}f.IsUndefined=T})(i||(e.ValueGuard=i={}));var a=class extends r{};e.TypeGuardUnknownTypeError=a;var o;(function(f){function _(y){try{return new RegExp(y),!0}catch{return!1}}function O(y){if(!i.IsString(y))return!1;for(let $e=0;$e<y.length;$e++){let ut=y.charCodeAt($e);if(ut>=7&&ut<=13||ut===27||ut===127)return!1}return!0}function k(y){return h(y)||Me(y)}function S(y){return i.IsUndefined(y)||i.IsBigInt(y)}function $(y){return i.IsUndefined(y)||i.IsNumber(y)}function h(y){return i.IsUndefined(y)||i.IsBoolean(y)}function A(y){return i.IsUndefined(y)||i.IsString(y)}function w(y){return i.IsUndefined(y)||i.IsString(y)&&O(y)&&_(y)}function s(y){return i.IsUndefined(y)||i.IsString(y)&&O(y)}function T(y){return i.IsUndefined(y)||Me(y)}function b(y){return be(y,"Any")&&A(y.$id)}f.TAny=b;function v(y){return be(y,"Array")&&y.type==="array"&&A(y.$id)&&Me(y.items)&&$(y.minItems)&&$(y.maxItems)&&h(y.uniqueItems)&&T(y.contains)&&$(y.minContains)&&$(y.maxContains)}f.TArray=v;function U(y){return be(y,"AsyncIterator")&&y.type==="AsyncIterator"&&A(y.$id)&&Me(y.items)}f.TAsyncIterator=U;function L(y){return be(y,"BigInt")&&y.type==="bigint"&&A(y.$id)&&S(y.exclusiveMaximum)&&S(y.exclusiveMinimum)&&S(y.maximum)&&S(y.minimum)&&S(y.multipleOf)}f.TBigInt=L;function J(y){return be(y,"Boolean")&&y.type==="boolean"&&A(y.$id)}f.TBoolean=J;function ee(y){return be(y,"Constructor")&&y.type==="Constructor"&&A(y.$id)&&i.IsArray(y.parameters)&&y.parameters.every($e=>Me($e))&&Me(y.returns)}f.TConstructor=ee;function ye(y){return be(y,"Date")&&y.type==="Date"&&A(y.$id)&&$(y.exclusiveMaximumTimestamp)&&$(y.exclusiveMinimumTimestamp)&&$(y.maximumTimestamp)&&$(y.minimumTimestamp)&&$(y.multipleOfTimestamp)}f.TDate=ye;function we(y){return be(y,"Function")&&y.type==="Function"&&A(y.$id)&&i.IsArray(y.parameters)&&y.parameters.every($e=>Me($e))&&Me(y.returns)}f.TFunction=we;function je(y){return be(y,"Integer")&&y.type==="integer"&&A(y.$id)&&$(y.exclusiveMaximum)&&$(y.exclusiveMinimum)&&$(y.maximum)&&$(y.minimum)&&$(y.multipleOf)}f.TInteger=je;function Be(y){return be(y,"Intersect")&&!(i.IsString(y.type)&&y.type!=="object")&&i.IsArray(y.allOf)&&y.allOf.every($e=>Me($e)&&!Tn($e))&&A(y.type)&&(h(y.unevaluatedProperties)||T(y.unevaluatedProperties))&&A(y.$id)}f.TIntersect=Be;function dr(y){return be(y,"Iterator")&&y.type==="Iterator"&&A(y.$id)&&Me(y.items)}f.TIterator=dr;function be(y,$e){return qt(y)&&y[e.Kind]===$e}f.TKindOf=be;function qt(y){return i.IsObject(y)&&e.Kind in y&&i.IsString(y[e.Kind])}f.TKind=qt;function pr(y){return I(y)&&i.IsString(y.const)}f.TLiteralString=pr;function x(y){return I(y)&&i.IsNumber(y.const)}f.TLiteralNumber=x;function le(y){return I(y)&&i.IsBoolean(y.const)}f.TLiteralBoolean=le;function I(y){return be(y,"Literal")&&A(y.$id)&&(i.IsBoolean(y.const)||i.IsNumber(y.const)||i.IsString(y.const))}f.TLiteral=I;function ge(y){return be(y,"Never")&&i.IsObject(y.not)&&Object.getOwnPropertyNames(y.not).length===0}f.TNever=ge;function ne(y){return be(y,"Not")&&Me(y.not)}f.TNot=ne;function de(y){return be(y,"Null")&&y.type==="null"&&A(y.$id)}f.TNull=de;function Ie(y){return be(y,"Number")&&y.type==="number"&&A(y.$id)&&$(y.exclusiveMaximum)&&$(y.exclusiveMinimum)&&$(y.maximum)&&$(y.minimum)&&$(y.multipleOf)}f.TNumber=Ie;function Ce(y){return be(y,"Object")&&y.type==="object"&&A(y.$id)&&i.IsObject(y.properties)&&k(y.additionalProperties)&&$(y.minProperties)&&$(y.maxProperties)&&Object.entries(y.properties).every(([$e,ut])=>O($e)&&Me(ut))}f.TObject=Ce;function We(y){return be(y,"Promise")&&y.type==="Promise"&&A(y.$id)&&Me(y.item)}f.TPromise=We;function qe(y){return be(y,"Record")&&y.type==="object"&&A(y.$id)&&k(y.additionalProperties)&&i.IsObject(y.patternProperties)&&($e=>{let ut=Object.getOwnPropertyNames($e.patternProperties);return ut.length===1&&_(ut[0])&&i.IsObject($e.patternProperties)&&Me($e.patternProperties[ut[0]])})(y)}f.TRecord=qe;function Xe(y){return i.IsObject(y)&&e.Hint in y&&y[e.Hint]==="Recursive"}f.TRecursive=Xe;function Kt(y){return be(y,"Ref")&&A(y.$id)&&i.IsString(y.$ref)}f.TRef=Kt;function Vr(y){return be(y,"String")&&y.type==="string"&&A(y.$id)&&$(y.minLength)&&$(y.maxLength)&&w(y.pattern)&&s(y.format)}f.TString=Vr;function Fr(y){return be(y,"Symbol")&&y.type==="symbol"&&A(y.$id)}f.TSymbol=Fr;function hr(y){return be(y,"TemplateLiteral")&&y.type==="string"&&i.IsString(y.pattern)&&y.pattern[0]==="^"&&y.pattern[y.pattern.length-1]==="$"}f.TTemplateLiteral=hr;function mi(y){return be(y,"This")&&A(y.$id)&&i.IsString(y.$ref)}f.TThis=mi;function Tn(y){return i.IsObject(y)&&e.Transform in y}f.TTransform=Tn;function Re(y){return be(y,"Tuple")&&y.type==="array"&&A(y.$id)&&i.IsNumber(y.minItems)&&i.IsNumber(y.maxItems)&&y.minItems===y.maxItems&&(i.IsUndefined(y.items)&&i.IsUndefined(y.additionalItems)&&y.minItems===0||i.IsArray(y.items)&&y.items.every($e=>Me($e)))}f.TTuple=Re;function gi(y){return be(y,"Undefined")&&y.type==="undefined"&&A(y.$id)}f.TUndefined=gi;function No(y){return yr(y)&&y.anyOf.every($e=>pr($e)||x($e))}f.TUnionLiteral=No;function yr(y){return be(y,"Union")&&A(y.$id)&&i.IsObject(y)&&i.IsArray(y.anyOf)&&y.anyOf.every($e=>Me($e))}f.TUnion=yr;function zr(y){return be(y,"Uint8Array")&&y.type==="Uint8Array"&&A(y.$id)&&$(y.minByteLength)&&$(y.maxByteLength)}f.TUint8Array=zr;function Je(y){return be(y,"Unknown")&&A(y.$id)}f.TUnknown=Je;function vi(y){return be(y,"Unsafe")}f.TUnsafe=vi;function xn(y){return be(y,"Void")&&y.type==="void"&&A(y.$id)}f.TVoid=xn;function Po(y){return i.IsObject(y)&&y[e.Readonly]==="Readonly"}f.TReadonly=Po;function Bo(y){return i.IsObject(y)&&y[e.Optional]==="Optional"}f.TOptional=Bo;function Me(y){return i.IsObject(y)&&(b(y)||v(y)||J(y)||L(y)||U(y)||ee(y)||ye(y)||we(y)||je(y)||Be(y)||dr(y)||I(y)||ge(y)||ne(y)||de(y)||Ie(y)||Ce(y)||We(y)||qe(y)||Kt(y)||Vr(y)||Fr(y)||hr(y)||mi(y)||Re(y)||gi(y)||yr(y)||zr(y)||Je(y)||vi(y)||xn(y)||qt(y)&&t.Has(y[e.Kind]))}f.TSchema=Me})(o||(e.TypeGuard=o={}));var u;(function(f){function _(O){return O[e.Kind]==="Intersect"?O.allOf.every(k=>_(k)):O[e.Kind]==="Union"?O.anyOf.some(k=>_(k)):O[e.Kind]==="Undefined"?!0:O[e.Kind]==="Not"?!_(O.not):!1}f.Check=_})(u||(e.ExtendsUndefined=u={}));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 m;(function(f){function _(p){return p===c.False?p:c.True}function O(p){throw new l(p)}function k(p){return o.TNever(p)||o.TIntersect(p)||o.TUnion(p)||o.TUnknown(p)||o.TAny(p)}function S(p,d){return o.TNever(d)?be(p,d):o.TIntersect(d)?we(p,d):o.TUnion(d)?Co(p,d):o.TUnknown(d)?ks(p,d):o.TAny(d)?$(p,d):O("StructuralRight")}function $(p,d){return c.True}function h(p,d){return o.TIntersect(d)?we(p,d):o.TUnion(d)&&d.anyOf.some(Te=>o.TAny(Te)||o.TUnknown(Te))?c.True:o.TUnion(d)?c.Union:o.TUnknown(d)||o.TAny(d)?c.True:c.Union}function A(p,d){return o.TUnknown(p)?c.False:o.TAny(p)?c.Union:o.TNever(p)?c.True:c.False}function w(p,d){return o.TObject(d)&&hr(d)?c.True:k(d)?S(p,d):o.TArray(d)?_(ke(p.items,d.items)):c.False}function s(p,d){return k(d)?S(p,d):o.TAsyncIterator(d)?_(ke(p.items,d.items)):c.False}function T(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TBigInt(d)?c.True:c.False}function b(p,d){return o.TLiteral(p)&&i.IsBoolean(p.const)||o.TBoolean(p)?c.True:c.False}function v(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TBoolean(d)?c.True:c.False}function U(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TConstructor(d)?p.parameters.length>d.parameters.length?c.False:p.parameters.every((Te,Bt)=>_(ke(d.parameters[Bt],Te))===c.True)?_(ke(p.returns,d.returns)):c.False:c.False}function L(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TDate(d)?c.True:c.False}function J(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TFunction(d)?p.parameters.length>d.parameters.length?c.False:p.parameters.every((Te,Bt)=>_(ke(d.parameters[Bt],Te))===c.True)?_(ke(p.returns,d.returns)):c.False:c.False}function ee(p,d){return o.TLiteral(p)&&i.IsNumber(p.const)||o.TNumber(p)||o.TInteger(p)?c.True:c.False}function ye(p,d){return o.TInteger(d)||o.TNumber(d)?c.True:k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):c.False}function we(p,d){return d.allOf.every(Te=>ke(p,Te)===c.True)?c.True:c.False}function je(p,d){return p.allOf.some(Te=>ke(Te,d)===c.True)?c.True:c.False}function Be(p,d){return k(d)?S(p,d):o.TIterator(d)?_(ke(p.items,d.items)):c.False}function dr(p,d){return o.TLiteral(d)&&d.const===p.const?c.True:k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TString(d)?xn(p,d):o.TNumber(d)?I(p,d):o.TInteger(d)?ee(p,d):o.TBoolean(d)?b(p,d):c.False}function be(p,d){return c.False}function qt(p,d){return c.True}function pr(p){let[d,Te]=[p,0];for(;o.TNot(d);)d=d.not,Te+=1;return Te%2===0?d:e.Type.Unknown()}function x(p,d){return o.TNot(p)?ke(pr(p),d):o.TNot(d)?ke(p,pr(d)):O("Invalid fallthrough for Not")}function le(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TNull(d)?c.True:c.False}function I(p,d){return o.TLiteralNumber(p)||o.TNumber(p)||o.TInteger(p)?c.True:c.False}function ge(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TInteger(d)||o.TNumber(d)?c.True:c.False}function ne(p,d){return Object.getOwnPropertyNames(p.properties).length===d}function de(p){return hr(p)}function Ie(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 Ce(p){return ne(p,0)}function We(p){return ne(p,0)}function qe(p){return ne(p,0)}function Xe(p){return ne(p,0)}function Kt(p){return hr(p)}function Vr(p){let d=e.Type.Number();return ne(p,0)||ne(p,1)&&"length"in p.properties&&_(ke(p.properties.length,d))===c.True}function Fr(p){return ne(p,0)}function hr(p){let d=e.Type.Number();return ne(p,0)||ne(p,1)&&"length"in p.properties&&_(ke(p.properties.length,d))===c.True}function mi(p){let d=e.Type.Function([e.Type.Any()],e.Type.Any());return ne(p,0)||ne(p,1)&&"then"in p.properties&&_(ke(p.properties.then,d))===c.True}function Tn(p,d){return ke(p,d)===c.False||o.TOptional(p)&&!o.TOptional(d)?c.False:c.True}function Re(p,d){return o.TUnknown(p)?c.False:o.TAny(p)?c.Union:o.TNever(p)||o.TLiteralString(p)&&de(d)||o.TLiteralNumber(p)&&Ce(d)||o.TLiteralBoolean(p)&&We(d)||o.TSymbol(p)&&Ie(d)||o.TBigInt(p)&&qe(d)||o.TString(p)&&de(d)||o.TSymbol(p)&&Ie(d)||o.TNumber(p)&&Ce(d)||o.TInteger(p)&&Ce(d)||o.TBoolean(p)&&We(d)||o.TUint8Array(p)&&Kt(d)||o.TDate(p)&&Xe(d)||o.TConstructor(p)&&Fr(d)||o.TFunction(p)&&Vr(d)?c.True:o.TRecord(p)&&o.TString(yr(p))?d[e.Hint]==="Record"?c.True:c.False:o.TRecord(p)&&o.TNumber(yr(p))&&ne(d,0)?c.True:c.False}function gi(p,d){return k(d)?S(p,d):o.TRecord(d)?Je(p,d):o.TObject(d)?(()=>{for(let Te of Object.getOwnPropertyNames(d.properties)){if(!(Te in p.properties)&&!o.TOptional(d.properties[Te]))return c.False;if(o.TOptional(d.properties[Te]))return c.True;if(Tn(p.properties[Te],d.properties[Te])===c.False)return c.False}return c.True})():c.False}function No(p,d){return k(d)?S(p,d):o.TObject(d)&&mi(d)?c.True:o.TPromise(d)?_(ke(p.item,d.item)):c.False}function yr(p){return e.PatternNumberExact in p.patternProperties?e.Type.Number():e.PatternStringExact in p.patternProperties?e.Type.String():O("Unknown record key pattern")}function zr(p){return e.PatternNumberExact in p.patternProperties?p.patternProperties[e.PatternNumberExact]:e.PatternStringExact in p.patternProperties?p.patternProperties[e.PatternStringExact]:O("Unable to get record value schema")}function Je(p,d){let[Te,Bt]=[yr(d),zr(d)];return o.TLiteralString(p)&&o.TNumber(Te)&&_(ke(p,Bt))===c.True?c.True:o.TUint8Array(p)&&o.TNumber(Te)||o.TString(p)&&o.TNumber(Te)||o.TArray(p)&&o.TNumber(Te)?ke(p,Bt):o.TObject(p)?(()=>{for(let Hd of Object.getOwnPropertyNames(p.properties))if(Tn(Bt,p.properties[Hd])===c.False)return c.False;return c.True})():c.False}function vi(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?ke(zr(p),zr(d)):c.False}function xn(p,d){return o.TLiteral(p)&&i.IsString(p.const)||o.TString(p)?c.True:c.False}function Po(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TString(d)?c.True:c.False}function Bo(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TSymbol(d)?c.True:c.False}function Me(p,d){return o.TTemplateLiteral(p)?ke(F.Resolve(p),d):o.TTemplateLiteral(d)?ke(p,F.Resolve(d)):O("Invalid fallthrough for TemplateLiteral")}function y(p,d){return o.TArray(d)&&p.items!==void 0&&p.items.every(Te=>ke(Te,d.items)===c.True)}function $e(p,d){return o.TNever(p)?c.True:o.TUnknown(p)?c.False:o.TAny(p)?c.Union:c.False}function ut(p,d){return k(d)?S(p,d):o.TObject(d)&&hr(d)||o.TArray(d)&&y(p,d)?c.True:o.TTuple(d)?i.IsUndefined(p.items)&&!i.IsUndefined(d.items)||!i.IsUndefined(p.items)&&i.IsUndefined(d.items)?c.False:i.IsUndefined(p.items)&&!i.IsUndefined(d.items)||p.items.every((Te,Bt)=>ke(Te,d.items[Bt])===c.True)?c.True:c.False:c.False}function Dd(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TUint8Array(d)?c.True:c.False}function Vd(p,d){return k(d)?S(p,d):o.TObject(d)?Re(p,d):o.TRecord(d)?Je(p,d):o.TVoid(d)?qd(p,d):o.TUndefined(d)?c.True:c.False}function Co(p,d){return d.anyOf.some(Te=>ke(p,Te)===c.True)?c.True:c.False}function Fd(p,d){return p.anyOf.every(Te=>ke(Te,d)===c.True)?c.True:c.False}function ks(p,d){return c.True}function zd(p,d){return o.TNever(d)?be(p,d):o.TIntersect(d)?we(p,d):o.TUnion(d)?Co(p,d):o.TAny(d)?$(p,d):o.TString(d)?xn(p,d):o.TNumber(d)?I(p,d):o.TInteger(d)?ee(p,d):o.TBoolean(d)?b(p,d):o.TArray(d)?A(p,d):o.TTuple(d)?$e(p,d):o.TObject(d)?Re(p,d):o.TUnknown(d)?c.True:c.False}function qd(p,d){return o.TUndefined(p)||o.TUndefined(p)?c.True:c.False}function Kd(p,d){return o.TIntersect(d)?we(p,d):o.TUnion(d)?Co(p,d):o.TUnknown(d)?ks(p,d):o.TAny(d)?$(p,d):o.TObject(d)?Re(p,d):o.TVoid(d)?c.True:c.False}function ke(p,d){return o.TTemplateLiteral(p)||o.TTemplateLiteral(d)?Me(p,d):o.TNot(p)||o.TNot(d)?x(p,d):o.TAny(p)?h(p,d):o.TArray(p)?w(p,d):o.TBigInt(p)?T(p,d):o.TBoolean(p)?v(p,d):o.TAsyncIterator(p)?s(p,d):o.TConstructor(p)?U(p,d):o.TDate(p)?L(p,d):o.TFunction(p)?J(p,d):o.TInteger(p)?ye(p,d):o.TIntersect(p)?je(p,d):o.TIterator(p)?Be(p,d):o.TLiteral(p)?dr(p,d):o.TNever(p)?qt(p,d):o.TNull(p)?le(p,d):o.TNumber(p)?ge(p,d):o.TObject(p)?gi(p,d):o.TRecord(p)?vi(p,d):o.TString(p)?Po(p,d):o.TSymbol(p)?Bo(p,d):o.TTuple(p)?ut(p,d):o.TPromise(p)?No(p,d):o.TUint8Array(p)?Dd(p,d):o.TUndefined(p)?Vd(p,d):o.TUnion(p)?Fd(p,d):o.TUnknown(p)?zd(p,d):o.TVoid(p)?Kd(p,d):O(`Unknown left type operand '${p[e.Kind]}'`)}function Gd(p,d){return ke(p,d)}f.Extends=Gd})(m||(e.TypeExtends=m={}));var g;(function(f){function _(w){return w.map(s=>$(s))}function O(w){return new Date(w.getTime())}function k(w){return new Uint8Array(w)}function S(w){let s=Object.getOwnPropertyNames(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{}),T=Object.getOwnPropertySymbols(w).reduce((b,v)=>({...b,[v]:$(w[v])}),{});return{...s,...T}}function $(w){return i.IsArray(w)?_(w):i.IsDate(w)?O(w):i.IsUint8Array(w)?k(w):i.IsObject(w)?S(w):w}function h(w){return w.map(s=>A(s))}f.Rest=h;function A(w,s={}){return{...$(w),...s}}f.Type=A})(g||(e.TypeClone=g={}));var R;(function(f){function _(U){return U.map(L=>{let{[e.Optional]:J,...ee}=g.Type(L);return ee})}function O(U){return U.every(L=>o.TOptional(L))}function k(U){return U.some(L=>o.TOptional(L))}function S(U){return O(U.allOf)?e.Type.Optional(e.Type.Intersect(_(U.allOf))):U}function $(U){return k(U.anyOf)?e.Type.Optional(e.Type.Union(_(U.anyOf))):U}function h(U){return U[e.Kind]==="Intersect"?S(U):U[e.Kind]==="Union"?$(U):U}function A(U,L){let J=U.allOf.reduce((ee,ye)=>{let we=b(ye,L);return we[e.Kind]==="Never"?ee:[...ee,we]},[]);return h(e.Type.Intersect(J))}function w(U,L){let J=U.anyOf.map(ee=>b(ee,L));return h(e.Type.Union(J))}function s(U,L){let J=U.properties[L];return i.IsUndefined(J)?e.Type.Never():e.Type.Union([J])}function T(U,L){let J=U.items;if(i.IsUndefined(J))return e.Type.Never();let ee=J[L];return i.IsUndefined(ee)?e.Type.Never():ee}function b(U,L){return U[e.Kind]==="Intersect"?A(U,L):U[e.Kind]==="Union"?w(U,L):U[e.Kind]==="Object"?s(U,L):U[e.Kind]==="Tuple"?T(U,L):e.Type.Never()}function v(U,L,J={}){let ee=L.map(ye=>b(U,ye.toString()));return h(e.Type.Union(ee,J))}f.Resolve=v})(R||(e.IndexedAccessor=R={}));var j;(function(f){function _(T){let[b,v]=[T.slice(0,1),T.slice(1)];return`${b.toLowerCase()}${v}`}function O(T){let[b,v]=[T.slice(0,1),T.slice(1)];return`${b.toUpperCase()}${v}`}function k(T){return T.toUpperCase()}function S(T){return T.toLowerCase()}function $(T,b){let v=z.ParseExact(T.pattern);if(!M.Check(v))return{...T,pattern:h(T.pattern,b)};let U=[...C.Generate(v)].map(ee=>e.Type.Literal(ee)),L=A(U,b),J=e.Type.Union(L);return e.Type.TemplateLiteral([J])}function h(T,b){return typeof T=="string"?b==="Uncapitalize"?_(T):b==="Capitalize"?O(T):b==="Uppercase"?k(T):b==="Lowercase"?S(T):T:T.toString()}function A(T,b){if(T.length===0)return[];let[v,...U]=T;return[s(v,b),...A(U,b)]}function w(T,b){return o.TTemplateLiteral(T)?$(T,b):o.TUnion(T)?e.Type.Union(A(T.anyOf,b)):o.TLiteral(T)?e.Type.Literal(h(T.const,b)):T}function s(T,b){return w(T,b)}f.Map=s})(j||(e.Intrinsic=j={}));var q;(function(f){function _(h,A){return e.Type.Intersect(h.allOf.map(w=>S(w,A)),{...h})}function O(h,A){return e.Type.Union(h.anyOf.map(w=>S(w,A)),{...h})}function k(h,A){return A(h)}function S(h,A){return h[e.Kind]==="Intersect"?_(h,A):h[e.Kind]==="Union"?O(h,A):h[e.Kind]==="Object"?k(h,A):h}function $(h,A,w){return{...S(g.Type(h),A),...w}}f.Map=$})(q||(e.ObjectMap=q={}));var Z;(function(f){function _(s){return s[0]==="^"&&s[s.length-1]==="$"?s.slice(1,s.length-1):s}function O(s,T){return s.allOf.reduce((b,v)=>[...b,...h(v,T)],[])}function k(s,T){let b=s.anyOf.map(v=>h(v,T));return[...b.reduce((v,U)=>U.map(L=>b.every(J=>J.includes(L))?v.add(L):v)[0],new Set)]}function S(s,T){return Object.getOwnPropertyNames(s.properties)}function $(s,T){return T.includePatterns?Object.getOwnPropertyNames(s.patternProperties):[]}function h(s,T){return o.TIntersect(s)?O(s,T):o.TUnion(s)?k(s,T):o.TObject(s)?S(s,T):o.TRecord(s)?$(s,T):[]}function A(s,T){return[...new Set(h(s,T))]}f.ResolveKeys=A;function w(s){return`^(${A(s,{includePatterns:!0}).map(T=>`(${_(T)})`).join("|")})$`}f.ResolvePattern=w})(Z||(e.KeyResolver=Z={}));var ae=class extends r{};e.KeyArrayResolverError=ae;var B;(function(f){function _(O){return Array.isArray(O)?O:o.TUnionLiteral(O)?O.anyOf.map(k=>k.const.toString()):o.TLiteral(O)?[O.const]:o.TTemplateLiteral(O)?(()=>{let k=z.ParseExact(O.pattern);if(!M.Check(k))throw new ae("Cannot resolve keys from infinite template expression");return[...C.Generate(k)]})():[]}f.Resolve=_})(B||(e.KeyArrayResolver=B={}));var V;(function(f){function*_(k){for(let S of k.anyOf)S[e.Kind]==="Union"?yield*_(S):yield S}function O(k){return e.Type.Union([..._(k)],{...k})}f.Resolve=O})(V||(e.UnionResolver=V={}));var H=class extends r{};e.TemplateLiteralPatternError=H;var se;(function(f){function _($){throw new H($)}function O($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k($,h){return o.TTemplateLiteral($)?$.pattern.slice(1,$.pattern.length-1):o.TUnion($)?`(${$.anyOf.map(A=>k(A,h)).join("|")})`:o.TNumber($)?`${h}${e.PatternNumber}`:o.TInteger($)?`${h}${e.PatternNumber}`:o.TBigInt($)?`${h}${e.PatternNumber}`:o.TString($)?`${h}${e.PatternString}`:o.TLiteral($)?`${h}${O($.const.toString())}`:o.TBoolean($)?`${h}${e.PatternBoolean}`:_(`Unexpected Kind '${$[e.Kind]}'`)}function S($){return`^${$.map(h=>k(h,"")).join("")}$`}f.Create=S})(se||(e.TemplateLiteralPattern=se={}));var F;(function(f){function _(O){let k=z.ParseExact(O.pattern);if(!M.Check(k))return e.Type.String();let S=[...C.Generate(k)].map($=>e.Type.Literal($));return e.Type.Union(S)}f.Resolve=_})(F||(e.TemplateLiteralResolver=F={}));var ue=class extends r{};e.TemplateLiteralParserError=ue;var z;(function(f){function _(U,L,J){return U[L]===J&&U.charCodeAt(L-1)!==92}function O(U,L){return _(U,L,"(")}function k(U,L){return _(U,L,")")}function S(U,L){return _(U,L,"|")}function $(U){if(!(O(U,0)&&k(U,U.length-1)))return!1;let L=0;for(let J=0;J<U.length;J++)if(O(U,J)&&(L+=1),k(U,J)&&(L-=1),L===0&&J!==U.length-1)return!1;return!0}function h(U){return U.slice(1,U.length-1)}function A(U){let L=0;for(let J=0;J<U.length;J++)if(O(U,J)&&(L+=1),k(U,J)&&(L-=1),S(U,J)&&L===0)return!0;return!1}function w(U){for(let L=0;L<U.length;L++)if(O(U,L))return!0;return!1}function s(U){let[L,J]=[0,0],ee=[];for(let we=0;we<U.length;we++)if(O(U,we)&&(L+=1),k(U,we)&&(L-=1),S(U,we)&&L===0){let je=U.slice(J,we);je.length>0&&ee.push(b(je)),J=we+1}let ye=U.slice(J);return ye.length>0&&ee.push(b(ye)),ee.length===0?{type:"const",const:""}:ee.length===1?ee[0]:{type:"or",expr:ee}}function T(U){function L(ye,we){if(!O(ye,we))throw new ue("TemplateLiteralParser: Index must point to open parens");let je=0;for(let Be=we;Be<ye.length;Be++)if(O(ye,Be)&&(je+=1),k(ye,Be)&&(je-=1),je===0)return[we,Be];throw new ue("TemplateLiteralParser: Unclosed group parens in expression")}function J(ye,we){for(let je=we;je<ye.length;je++)if(O(ye,je))return[we,je];return[we,ye.length]}let ee=[];for(let ye=0;ye<U.length;ye++)if(O(U,ye)){let[we,je]=L(U,ye),Be=U.slice(we,je+1);ee.push(b(Be)),ye=je}else{let[we,je]=J(U,ye),Be=U.slice(we,je);Be.length>0&&ee.push(b(Be)),ye=je-1}return ee.length===0?{type:"const",const:""}:ee.length===1?ee[0]:{type:"and",expr:ee}}function b(U){return $(U)?b(h(U)):A(U)?s(U):w(U)?T(U):{type:"const",const:U}}f.Parse=b;function v(U){return b(U.slice(1,U.length-1))}f.ParseExact=v})(z||(e.TemplateLiteralParser=z={}));var pe=class extends r{};e.TemplateLiteralFiniteError=pe;var M;(function(f){function _(h){throw new pe(h)}function O(h){return h.type==="or"&&h.expr.length===2&&h.expr[0].type==="const"&&h.expr[0].const==="0"&&h.expr[1].type==="const"&&h.expr[1].const==="[1-9][0-9]*"}function k(h){return h.type==="or"&&h.expr.length===2&&h.expr[0].type==="const"&&h.expr[0].const==="true"&&h.expr[1].type==="const"&&h.expr[1].const==="false"}function S(h){return h.type==="const"&&h.const===".*"}function $(h){return k(h)?!0:O(h)||S(h)?!1:h.type==="and"?h.expr.every(A=>$(A)):h.type==="or"?h.expr.every(A=>$(A)):h.type==="const"?!0:_("Unknown expression type")}f.Check=$})(M||(e.TemplateLiteralFinite=M={}));var P=class extends r{};e.TemplateLiteralGeneratorError=P;var C;(function(f){function*_(h){if(h.length===1)return yield*h[0];for(let A of h[0])for(let w of _(h.slice(1)))yield`${A}${w}`}function*O(h){return yield*_(h.expr.map(A=>[...$(A)]))}function*k(h){for(let A of h.expr)yield*$(A)}function*S(h){return yield h.const}function*$(h){return h.type==="and"?yield*O(h):h.type==="or"?yield*k(h):h.type==="const"?yield*S(h):(()=>{throw new P("Unknown expression")})()}f.Generate=$})(C||(e.TemplateLiteralGenerator=C={}));var Q;(function(f){function*_($){let h=$.trim().replace(/"|'/g,"");return h==="boolean"?yield e.Type.Boolean():h==="number"?yield e.Type.Number():h==="bigint"?yield e.Type.BigInt():h==="string"?yield e.Type.String():yield(()=>{let A=h.split("|").map(w=>e.Type.Literal(w.trim()));return A.length===0?e.Type.Never():A.length===1?A[0]:e.Type.Union(A)})()}function*O($){if($[1]!=="{"){let h=e.Type.Literal("$"),A=k($.slice(1));return yield*[h,...A]}for(let h=2;h<$.length;h++)if($[h]==="}"){let A=_($.slice(2,h)),w=k($.slice(h+1));return yield*[...A,...w]}yield e.Type.Literal($)}function*k($){for(let h=0;h<$.length;h++)if($[h]==="$"){let A=e.Type.Literal($.slice(0,h)),w=O($.slice(h));return yield*[A,...w]}yield e.Type.Literal($)}function S($){return[...k($)]}f.Parse=S})(Q||(e.TemplateLiteralDslParser=Q={}));var X=class{constructor(f){this.schema=f}Decode(f){return new E(this.schema,f)}};e.TransformDecodeBuilder=X;var E=class{constructor(f,_){this.schema=f,this.decode=_}Encode(f){let _=g.Type(this.schema);return o.TTransform(_)?(()=>{let O={Encode:k=>_[e.Transform].Encode(f(k)),Decode:k=>this.decode(_[e.Transform].Decode(k))};return{..._,[e.Transform]:O}})():(()=>{let O={Decode:this.decode,Encode:f};return{..._,[e.Transform]:O}})()}};e.TransformEncodeBuilder=E;var K=0,te=class extends r{};e.TypeBuilderError=te;var G=class{Create(f){return f}Throw(f){throw new te(f)}Discard(f,_){return _.reduce((O,k)=>{let{[k]:S,...$}=O;return $},f)}Strict(f){return JSON.parse(JSON.stringify(f))}};e.TypeBuilder=G;var W=class extends G{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{...j.Map(g.Type(f),"Capitalize"),..._}}Composite(f,_){let O=e.Type.Intersect(f,{}),k=Z.ResolveKeys(O,{includePatterns:!1}).reduce((S,$)=>({...S,[$]:e.Type.Index(O,[$])}),{});return e.Type.Object(k,_)}Enum(f,_={}){if(i.IsUndefined(f))return this.Throw("Enum undefined or empty");let O=Object.getOwnPropertyNames(f).filter(S=>isNaN(S)).map(S=>f[S]),k=[...new Set(O)].map(S=>e.Type.Literal(S));return this.Union(k,{..._,[e.Hint]:"Enum"})}Extends(f,_,O,k,S={}){switch(m.Extends(f,_)){case c.Union:return this.Union([g.Type(O,S),g.Type(k,S)]);case c.True:return g.Type(O,S);case c.False:return g.Type(k,S)}}Exclude(f,_,O={}){return o.TTemplateLiteral(f)?this.Exclude(F.Resolve(f),_,O):o.TTemplateLiteral(_)?this.Exclude(f,F.Resolve(_),O):o.TUnion(f)?(()=>{let k=f.anyOf.filter(S=>m.Extends(S,_)===c.False);return k.length===1?g.Type(k[0],O):this.Union(k,O)})():m.Extends(f,_)!==c.False?this.Never(O):g.Type(f,O)}Extract(f,_,O={}){return o.TTemplateLiteral(f)?this.Extract(F.Resolve(f),_,O):o.TTemplateLiteral(_)?this.Extract(f,F.Resolve(_),O):o.TUnion(f)?(()=>{let k=f.anyOf.filter(S=>m.Extends(S,_)!==c.False);return k.length===1?g.Type(k[0],O):this.Union(k,O)})():m.Extends(f,_)!==c.False?g.Type(f,O):this.Never(O)}Index(f,_,O={}){return o.TArray(f)&&o.TNumber(_)?g.Type(f.items,O):o.TTuple(f)&&o.TNumber(_)?(()=>{let k=(i.IsUndefined(f.items)?[]:f.items).map(S=>g.Type(S));return this.Union(k,O)})():(()=>{let k=B.Resolve(_),S=g.Type(f);return R.Resolve(S,k,O)})()}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($=>o.TTransform($))&&this.Throw("Cannot intersect transform types");let O=f.every($=>o.TObject($)),k=g.Rest(f),S=o.TSchema(_.unevaluatedProperties)?{unevaluatedProperties:g.Type(_.unevaluatedProperties)}:{};return _.unevaluatedProperties===!1||o.TSchema(_.unevaluatedProperties)||O?this.Create({..._,...S,[e.Kind]:"Intersect",type:"object",allOf:k}):this.Create({..._,...S,[e.Kind]:"Intersect",allOf:k})}KeyOf(f,_={}){return o.TRecord(f)?(()=>{let O=Object.getOwnPropertyNames(f.patternProperties)[0];return O===e.PatternNumberExact?this.Number(_):O===e.PatternStringExact?this.String(_):this.Throw("Unable to resolve key type from Record key pattern")})():o.TTuple(f)?(()=>{let O=(i.IsUndefined(f.items)?[]:f.items).map((k,S)=>e.Type.Literal(S.toString()));return this.Union(O,_)})():o.TArray(f)?this.Number(_):(()=>{let O=Z.ResolveKeys(f,{includePatterns:!1});if(O.length===0)return this.Never(_);let k=O.map(S=>this.Literal(S));return this.Union(k,_)})()}Literal(f,_={}){return this.Create({..._,[e.Kind]:"Literal",const:f,type:typeof f})}Lowercase(f,_={}){return{...j.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 O=Object.getOwnPropertyNames(f),k=O.filter(A=>o.TOptional(f[A])),S=O.filter(A=>!k.includes(A)),$=o.TSchema(_.additionalProperties)?{additionalProperties:g.Type(_.additionalProperties)}:{},h=O.reduce((A,w)=>({...A,[w]:g.Type(f[w])}),{});return S.length>0?this.Create({..._,...$,[e.Kind]:"Object",type:"object",properties:h,required:S}):this.Create({..._,...$,[e.Kind]:"Object",type:"object",properties:h})}Omit(f,_,O={}){let k=B.Resolve(_);return q.Map(this.Discard(g.Type(f),["$id",e.Transform]),S=>{i.IsArray(S.required)&&(S.required=S.required.filter($=>!k.includes($)),S.required.length===0&&delete S.required);for(let $ of Object.getOwnPropertyNames(S.properties))k.includes($)&&delete S.properties[$];return this.Create(S)},O)}Partial(f,_={}){return q.Map(this.Discard(g.Type(f),["$id",e.Transform]),O=>{let k=Object.getOwnPropertyNames(O.properties).reduce((S,$)=>({...S,[$]:this.Optional(O.properties[$])}),{});return this.Object(k,this.Discard(O,["required"]))},_)}Pick(f,_,O={}){let k=B.Resolve(_);return q.Map(this.Discard(g.Type(f),["$id",e.Transform]),S=>{i.IsArray(S.required)&&(S.required=S.required.filter($=>k.includes($)),S.required.length===0&&delete S.required);for(let $ of Object.getOwnPropertyNames(S.properties))k.includes($)||delete S.properties[$];return this.Create(S)},O)}Record(f,_,O={}){return o.TTemplateLiteral(f)?(()=>{let k=z.ParseExact(f.pattern);return M.Check(k)?this.Object([...C.Generate(k)].reduce((S,$)=>({...S,[$]:g.Type(_)}),{}),O):this.Create({...O,[e.Kind]:"Record",type:"object",patternProperties:{[f.pattern]:g.Type(_)}})})():o.TUnion(f)?(()=>{let k=V.Resolve(f);if(o.TUnionLiteral(k)){let S=k.anyOf.reduce(($,h)=>({...$,[h.const]:g.Type(_)}),{});return this.Object(S,{...O,[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(_)},O):this.Throw("Record key of type literal is not of type string or number"):o.TInteger(f)||o.TNumber(f)?this.Create({...O,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:g.Type(_)}}):o.TString(f)?(()=>{let k=i.IsUndefined(f.pattern)?e.PatternStringExact:f.pattern;return this.Create({...O,[e.Kind]:"Record",type:"object",patternProperties:{[k]:g.Type(_)}})})():this.Never()}Recursive(f,_={}){i.IsUndefined(_.$id)&&(_.$id=`T${K++}`);let O=f({[e.Kind]:"This",$ref:`${_.$id}`});return O.$id=_.$id,this.Create({..._,[e.Hint]:"Recursive",...O})}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 q.Map(this.Discard(g.Type(f),["$id",e.Transform]),O=>{let k=Object.getOwnPropertyNames(O.properties).reduce((S,$)=>({...S,[$]:this.Discard(O.properties[$],[e.Optional])}),{});return this.Object(k,O)},_)}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 O=i.IsString(f)?se.Create(Q.Parse(f)):se.Create(f);return this.Create({..._,[e.Kind]:"TemplateLiteral",type:"string",pattern:O})}Transform(f){return new X(f)}Tuple(f,_={}){let[O,k,S]=[!1,f.length,f.length],$=g.Rest(f),h=f.length>0?{..._,[e.Kind]:"Tuple",type:"array",items:$,additionalItems:O,minItems:k,maxItems:S}:{..._,[e.Kind]:"Tuple",type:"array",minItems:k,maxItems:S};return this.Create(h)}Uncapitalize(f,_={}){return{...j.Map(g.Type(f),"Uncapitalize"),..._}}Union(f,_={}){return o.TTemplateLiteral(f)?F.Resolve(f):(()=>{let O=f;if(O.length===0)return this.Never(_);if(O.length===1)return this.Create(g.Type(O[0],_));let k=g.Rest(O);return this.Create({..._,[e.Kind]:"Union",anyOf:k})})()}Unknown(f={}){return this.Create({...f,[e.Kind]:"Unknown"})}Unsafe(f={}){return this.Create({...f,[e.Kind]:f[e.Kind]||"Unsafe"})}Uppercase(f,_={}){return{...j.Map(g.Type(f),"Uppercase"),..._}}};e.JsonTypeBuilder=W;var fe=class extends W{AsyncIterator(f,_={}){return this.Create({..._,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:g.Type(f)})}Awaited(f,_={}){let O=k=>k.length>0?(()=>{let[S,...$]=k;return[this.Awaited(S),...O($)]})():k;return o.TIntersect(f)?e.Type.Intersect(O(f.allOf)):o.TUnion(f)?e.Type.Union(O(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,_,O){let[k,S]=[g.Rest(f),g.Type(_)];return this.Create({...O,[e.Kind]:"Constructor",type:"Constructor",parameters:k,returns:S})}Date(f={}){return this.Create({...f,[e.Kind]:"Date",type:"Date"})}Function(f,_,O){let[k,S]=[g.Rest(f),g.Type(_)];return this.Create({...O,[e.Kind]:"Function",type:"Function",parameters:k,returns:S})}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 O=i.IsString(f)?f:f.source;return this.Create({..._,[e.Kind]:"String",type:"string",pattern:O})}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 W,e.Type=new fe}),ln=Le(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(F){return c(F)&&Symbol.asyncIterator in F}e.IsAsyncIterator=t;function r(F){return c(F)&&Symbol.iterator in F}e.IsIterator=r;function n(F){return ArrayBuffer.isView(F)}e.IsTypedArray=n;function i(F){return F instanceof Promise}e.IsPromise=i;function a(F){return F instanceof Uint8Array}e.IsUint8Array=a;function o(F){return F instanceof Date&&Number.isFinite(F.getTime())}e.IsDate=o;function u(F,ue){return ue in F}e.HasPropertyKey=u;function l(F){return c(F)&&V(F.constructor)&&F.constructor.name==="Object"}e.IsPlainObject=l;function c(F){return F!==null&&typeof F=="object"}e.IsObject=c;function m(F){return Array.isArray(F)&&!ArrayBuffer.isView(F)}e.IsArray=m;function g(F){return F===void 0}e.IsUndefined=g;function R(F){return F===null}e.IsNull=R;function j(F){return typeof F=="boolean"}e.IsBoolean=j;function q(F){return typeof F=="number"}e.IsNumber=q;function Z(F){return q(F)&&Number.isInteger(F)}e.IsInteger=Z;function ae(F){return typeof F=="bigint"}e.IsBigInt=ae;function B(F){return typeof F=="string"}e.IsString=B;function V(F){return typeof F=="function"}e.IsFunction=V;function H(F){return typeof F=="symbol"}e.IsSymbol=H;function se(F){return ae(F)||j(F)||R(F)||q(F)||B(F)||H(F)||g(F)}e.IsValueType=se}),Nl=Le(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=ln(),r=mo(),n=Pr(),i=class extends n.TypeBoxError{constructor(m){super(`Duplicate type kind '${m}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var a=class extends n.TypeBoxError{constructor(m){super(`Duplicate string format '${m}' detected`)}};e.TypeSystemDuplicateFormat=a;var o;(function(m){function g(j,q){if(n.TypeRegistry.Has(j))throw new i(j);return n.TypeRegistry.Set(j,q),(Z={})=>n.Type.Unsafe({...Z,[n.Kind]:j})}m.Type=g;function R(j,q){if(n.FormatRegistry.Has(j))throw new a(j);return n.FormatRegistry.Set(j,q),j}m.Format=R})(o||(e.TypeSystem=o={}));var u;(function(m){let g=c;function R(){g=c}m.Reset=R;function j(Z){g=Z}m.Set=j;function q(){return g}m.Get=q})(u||(e.TypeSystemErrorFunction=u={}));var l;(function(m){m.ExactOptionalPropertyTypes=!1,m.AllowArrayObject=!1,m.AllowNaN=!1,m.AllowNullVoid=!1;function g(ae,B){return m.ExactOptionalPropertyTypes?B in ae:ae[B]!==void 0}m.IsExactOptionalProperty=g;function R(ae){let B=(0,t.IsObject)(ae);return m.AllowArrayObject?B:B&&!(0,t.IsArray)(ae)}m.IsObjectLike=R;function j(ae){return R(ae)&&!(ae instanceof Date)&&!(ae instanceof Uint8Array)}m.IsRecordLike=j;function q(ae){let B=(0,t.IsNumber)(ae);return m.AllowNaN?B:B&&Number.isFinite(ae)}m.IsNumberLike=q;function Z(ae){let B=(0,t.IsUndefined)(ae);return m.AllowNullVoid?B||ae===null:B}m.IsVoidLike=Z})(l||(e.TypeSystemPolicy=l={}));function c(m,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 ${m.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${m.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${m.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${m.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${m.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${m.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 ${m.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${m.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${m.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${m.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${m.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${m.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${m.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 m.const=="string"?`'${m.const}'`:m.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 ${m.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${m.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${m.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${m.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${m.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 ${m.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${m.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${m.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${m.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${m.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${m.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${m.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${m.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${m.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${m.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 '${m[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=c}),yo=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=Pr(),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,a){let o=a.findIndex(u=>u.$id===i.$ref);if(o===-1)throw new r(i);return a[o]}e.Deref=n}),rs=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=ln(),r=class extends Error{constructor(P){super("Unable to hash value"),this.value=P}};e.ValueHashError=r;var n;(function(P){P[P.Undefined=0]="Undefined",P[P.Null=1]="Null",P[P.Boolean=2]="Boolean",P[P.Number=3]="Number",P[P.String=4]="String",P[P.Object=5]="Object",P[P.Array=6]="Array",P[P.Date=7]="Date",P[P.Uint8Array=8]="Uint8Array",P[P.Symbol=9]="Symbol",P[P.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[a,o]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],u=Array.from({length:256}).map((P,C)=>BigInt(C)),l=new Float64Array(1),c=new DataView(l.buffer),m=new Uint8Array(l.buffer);function*g(P){let C=P===0?1:Math.ceil(Math.floor(Math.log2(P)+1)/8);for(let Q=0;Q<C;Q++)yield P>>8*(C-1-Q)&255}function R(P){pe(n.Array);for(let C of P)z(C)}function j(P){pe(n.Boolean),pe(P?1:0)}function q(P){pe(n.BigInt),c.setBigInt64(0,P);for(let C of m)pe(C)}function Z(P){pe(n.Date),z(P.getTime())}function ae(P){pe(n.Null)}function B(P){pe(n.Number),c.setFloat64(0,P);for(let C of m)pe(C)}function V(P){pe(n.Object);for(let C of globalThis.Object.keys(P).sort())z(C),z(P[C])}function H(P){pe(n.String);for(let C=0;C<P.length;C++)for(let Q of g(P.charCodeAt(C)))pe(Q)}function se(P){pe(n.Symbol),z(P.description)}function F(P){pe(n.Uint8Array);for(let C=0;C<P.length;C++)pe(P[C])}function ue(P){return pe(n.Undefined)}function z(P){if((0,t.IsArray)(P))return R(P);if((0,t.IsBoolean)(P))return j(P);if((0,t.IsBigInt)(P))return q(P);if((0,t.IsDate)(P))return Z(P);if((0,t.IsNull)(P))return ae(P);if((0,t.IsNumber)(P))return B(P);if((0,t.IsPlainObject)(P))return V(P);if((0,t.IsString)(P))return H(P);if((0,t.IsSymbol)(P))return se(P);if((0,t.IsUint8Array)(P))return F(P);if((0,t.IsUndefined)(P))return ue(P);throw new r(P)}function pe(P){i=i^u[P],i=i*a%o}function M(P){return i=BigInt("14695981039346656037"),z(P),i}e.Hash=M}),mo=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=ln(),r=Nl(),n=yo(),i=rs(),a=Pr(),o;(function(s){s[s.ArrayContains=0]="ArrayContains",s[s.ArrayMaxContains=1]="ArrayMaxContains",s[s.ArrayMaxItems=2]="ArrayMaxItems",s[s.ArrayMinContains=3]="ArrayMinContains",s[s.ArrayMinItems=4]="ArrayMinItems",s[s.ArrayUniqueItems=5]="ArrayUniqueItems",s[s.Array=6]="Array",s[s.AsyncIterator=7]="AsyncIterator",s[s.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",s[s.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",s[s.BigIntMaximum=10]="BigIntMaximum",s[s.BigIntMinimum=11]="BigIntMinimum",s[s.BigIntMultipleOf=12]="BigIntMultipleOf",s[s.BigInt=13]="BigInt",s[s.Boolean=14]="Boolean",s[s.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",s[s.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",s[s.DateMaximumTimestamp=17]="DateMaximumTimestamp",s[s.DateMinimumTimestamp=18]="DateMinimumTimestamp",s[s.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",s[s.Date=20]="Date",s[s.Function=21]="Function",s[s.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",s[s.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",s[s.IntegerMaximum=24]="IntegerMaximum",s[s.IntegerMinimum=25]="IntegerMinimum",s[s.IntegerMultipleOf=26]="IntegerMultipleOf",s[s.Integer=27]="Integer",s[s.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",s[s.Intersect=29]="Intersect",s[s.Iterator=30]="Iterator",s[s.Kind=31]="Kind",s[s.Literal=32]="Literal",s[s.Never=33]="Never",s[s.Not=34]="Not",s[s.Null=35]="Null",s[s.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",s[s.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",s[s.NumberMaximum=38]="NumberMaximum",s[s.NumberMinimum=39]="NumberMinimum",s[s.NumberMultipleOf=40]="NumberMultipleOf",s[s.Number=41]="Number",s[s.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",s[s.ObjectMaxProperties=43]="ObjectMaxProperties",s[s.ObjectMinProperties=44]="ObjectMinProperties",s[s.ObjectRequiredProperty=45]="ObjectRequiredProperty",s[s.Object=46]="Object",s[s.Promise=47]="Promise",s[s.StringFormatUnknown=48]="StringFormatUnknown",s[s.StringFormat=49]="StringFormat",s[s.StringMaxLength=50]="StringMaxLength",s[s.StringMinLength=51]="StringMinLength",s[s.StringPattern=52]="StringPattern",s[s.String=53]="String",s[s.Symbol=54]="Symbol",s[s.TupleLength=55]="TupleLength",s[s.Tuple=56]="Tuple",s[s.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",s[s.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",s[s.Uint8Array=59]="Uint8Array",s[s.Undefined=60]="Undefined",s[s.Union=61]="Union",s[s.Void=62]="Void"})(o||(e.ValueErrorType=o={}));var u=class extends a.TypeBoxError{constructor(s){super("Unknown type"),this.schema=s}};e.ValueErrorsUnknownTypeError=u;function l(s){return s.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=l;function c(s){return s!==void 0}var m=class{constructor(s){this.iterator=s}[Symbol.iterator](){return this.iterator}First(){let s=this.iterator.next();return s.done?void 0:s.value}};e.ValueErrorIterator=m;function g(s,T,b,v){return{type:s,schema:T,path:b,value:v,message:r.TypeSystemErrorFunction.Get()(T,s)}}function*R(s,T,b,v){}function*j(s,T,b,v){if(!(0,t.IsArray)(v))return yield g(o.Array,s,b,v);c(s.minItems)&&!(v.length>=s.minItems)&&(yield g(o.ArrayMinItems,s,b,v)),c(s.maxItems)&&!(v.length<=s.maxItems)&&(yield g(o.ArrayMaxItems,s,b,v));for(let J=0;J<v.length;J++)yield*A(s.items,T,`${b}/${J}`,v[J]);if(s.uniqueItems===!0&&!function(){let J=new Set;for(let ee of v){let ye=(0,i.Hash)(ee);if(J.has(ye))return!1;J.add(ye)}return!0}()&&(yield g(o.ArrayUniqueItems,s,b,v)),!(c(s.contains)||c(s.minContains)||c(s.maxContains)))return;let U=c(s.contains)?s.contains:a.Type.Never(),L=v.reduce((J,ee,ye)=>A(U,T,`${b}${ye}`,ee).next().done===!0?J+1:J,0);L===0&&(yield g(o.ArrayContains,s,b,v)),(0,t.IsNumber)(s.minContains)&&L<s.minContains&&(yield g(o.ArrayMinContains,s,b,v)),(0,t.IsNumber)(s.maxContains)&&L>s.maxContains&&(yield g(o.ArrayMaxContains,s,b,v))}function*q(s,T,b,v){(0,t.IsAsyncIterator)(v)||(yield g(o.AsyncIterator,s,b,v))}function*Z(s,T,b,v){if(!(0,t.IsBigInt)(v))return yield g(o.BigInt,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.BigIntExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.BigIntExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.BigIntMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.BigIntMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==BigInt(0)&&(yield g(o.BigIntMultipleOf,s,b,v))}function*ae(s,T,b,v){(0,t.IsBoolean)(v)||(yield g(o.Boolean,s,b,v))}function*B(s,T,b,v){yield*A(s.returns,T,b,v.prototype)}function*V(s,T,b,v){if(!(0,t.IsDate)(v))return yield g(o.Date,s,b,v);c(s.exclusiveMaximumTimestamp)&&!(v.getTime()<s.exclusiveMaximumTimestamp)&&(yield g(o.DateExclusiveMaximumTimestamp,s,b,v)),c(s.exclusiveMinimumTimestamp)&&!(v.getTime()>s.exclusiveMinimumTimestamp)&&(yield g(o.DateExclusiveMinimumTimestamp,s,b,v)),c(s.maximumTimestamp)&&!(v.getTime()<=s.maximumTimestamp)&&(yield g(o.DateMaximumTimestamp,s,b,v)),c(s.minimumTimestamp)&&!(v.getTime()>=s.minimumTimestamp)&&(yield g(o.DateMinimumTimestamp,s,b,v)),c(s.multipleOfTimestamp)&&v.getTime()%s.multipleOfTimestamp!==0&&(yield g(o.DateMultipleOfTimestamp,s,b,v))}function*H(s,T,b,v){(0,t.IsFunction)(v)||(yield g(o.Function,s,b,v))}function*se(s,T,b,v){if(!(0,t.IsInteger)(v))return yield g(o.Integer,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.IntegerExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.IntegerExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.IntegerMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.IntegerMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==0&&(yield g(o.IntegerMultipleOf,s,b,v))}function*F(s,T,b,v){for(let U of s.allOf){let L=A(U,T,b,v).next();L.done||(yield g(o.Intersect,s,b,v),yield L.value)}if(s.unevaluatedProperties===!1){let U=new RegExp(a.KeyResolver.ResolvePattern(s));for(let L of Object.getOwnPropertyNames(v))U.test(L)||(yield g(o.IntersectUnevaluatedProperties,s,`${b}/${L}`,v))}if(typeof s.unevaluatedProperties=="object"){let U=new RegExp(a.KeyResolver.ResolvePattern(s));for(let L of Object.getOwnPropertyNames(v))if(!U.test(L)){let J=A(s.unevaluatedProperties,T,`${b}/${L}`,v[L]).next();J.done||(yield J.value)}}}function*ue(s,T,b,v){(0,t.IsIterator)(v)||(yield g(o.Iterator,s,b,v))}function*z(s,T,b,v){v!==s.const&&(yield g(o.Literal,s,b,v))}function*pe(s,T,b,v){yield g(o.Never,s,b,v)}function*M(s,T,b,v){A(s.not,T,b,v).next().done===!0&&(yield g(o.Not,s,b,v))}function*P(s,T,b,v){(0,t.IsNull)(v)||(yield g(o.Null,s,b,v))}function*C(s,T,b,v){if(!r.TypeSystemPolicy.IsNumberLike(v))return yield g(o.Number,s,b,v);c(s.exclusiveMaximum)&&!(v<s.exclusiveMaximum)&&(yield g(o.NumberExclusiveMaximum,s,b,v)),c(s.exclusiveMinimum)&&!(v>s.exclusiveMinimum)&&(yield g(o.NumberExclusiveMinimum,s,b,v)),c(s.maximum)&&!(v<=s.maximum)&&(yield g(o.NumberMaximum,s,b,v)),c(s.minimum)&&!(v>=s.minimum)&&(yield g(o.NumberMinimum,s,b,v)),c(s.multipleOf)&&v%s.multipleOf!==0&&(yield g(o.NumberMultipleOf,s,b,v))}function*Q(s,T,b,v){if(!r.TypeSystemPolicy.IsObjectLike(v))return yield g(o.Object,s,b,v);c(s.minProperties)&&!(Object.getOwnPropertyNames(v).length>=s.minProperties)&&(yield g(o.ObjectMinProperties,s,b,v)),c(s.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=s.maxProperties)&&(yield g(o.ObjectMaxProperties,s,b,v));let U=Array.isArray(s.required)?s.required:[],L=Object.getOwnPropertyNames(s.properties),J=Object.getOwnPropertyNames(v);for(let ee of U)J.includes(ee)||(yield g(o.ObjectRequiredProperty,s.properties[ee],`${b}/${l(ee)}`,void 0));if(s.additionalProperties===!1)for(let ee of J)L.includes(ee)||(yield g(o.ObjectAdditionalProperties,s,`${b}/${l(ee)}`,v[ee]));if(typeof s.additionalProperties=="object")for(let ee of J)L.includes(ee)||(yield*A(s.additionalProperties,T,`${b}/${l(ee)}`,v[ee]));for(let ee of L){let ye=s.properties[ee];s.required&&s.required.includes(ee)?(yield*A(ye,T,`${b}/${l(ee)}`,v[ee]),a.ExtendsUndefined.Check(s)&&!(ee in v)&&(yield g(o.ObjectRequiredProperty,ye,`${b}/${l(ee)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(v,ee)&&(yield*A(ye,T,`${b}/${l(ee)}`,v[ee]))}}function*X(s,T,b,v){(0,t.IsPromise)(v)||(yield g(o.Promise,s,b,v))}function*E(s,T,b,v){if(!r.TypeSystemPolicy.IsRecordLike(v))return yield g(o.Object,s,b,v);c(s.minProperties)&&!(Object.getOwnPropertyNames(v).length>=s.minProperties)&&(yield g(o.ObjectMinProperties,s,b,v)),c(s.maxProperties)&&!(Object.getOwnPropertyNames(v).length<=s.maxProperties)&&(yield g(o.ObjectMaxProperties,s,b,v));let[U,L]=Object.entries(s.patternProperties)[0],J=new RegExp(U);for(let[ee,ye]of Object.entries(v))J.test(ee)&&(yield*A(L,T,`${b}/${l(ee)}`,ye));if(typeof s.additionalProperties=="object")for(let[ee,ye]of Object.entries(v))J.test(ee)||(yield*A(s.additionalProperties,T,`${b}/${l(ee)}`,ye));if(s.additionalProperties===!1){for(let[ee,ye]of Object.entries(v))if(!J.test(ee))return yield g(o.ObjectAdditionalProperties,s,`${b}/${l(ee)}`,ye)}}function*K(s,T,b,v){yield*A((0,n.Deref)(s,T),T,b,v)}function*te(s,T,b,v){if(!(0,t.IsString)(v))return yield g(o.String,s,b,v);c(s.minLength)&&!(v.length>=s.minLength)&&(yield g(o.StringMinLength,s,b,v)),c(s.maxLength)&&!(v.length<=s.maxLength)&&(yield g(o.StringMaxLength,s,b,v)),(0,t.IsString)(s.pattern)&&(new RegExp(s.pattern).test(v)||(yield g(o.StringPattern,s,b,v))),(0,t.IsString)(s.format)&&(a.FormatRegistry.Has(s.format)?a.FormatRegistry.Get(s.format)(v)||(yield g(o.StringFormat,s,b,v)):yield g(o.StringFormatUnknown,s,b,v))}function*G(s,T,b,v){(0,t.IsSymbol)(v)||(yield g(o.Symbol,s,b,v))}function*W(s,T,b,v){if(!(0,t.IsString)(v))return yield g(o.String,s,b,v);new RegExp(s.pattern).test(v)||(yield g(o.StringPattern,s,b,v))}function*fe(s,T,b,v){yield*A((0,n.Deref)(s,T),T,b,v)}function*f(s,T,b,v){if(!(0,t.IsArray)(v))return yield g(o.Tuple,s,b,v);if(s.items===void 0&&v.length!==0)return yield g(o.TupleLength,s,b,v);if(v.length!==s.maxItems)return yield g(o.TupleLength,s,b,v);if(s.items)for(let U=0;U<s.items.length;U++)yield*A(s.items[U],T,`${b}/${U}`,v[U])}function*_(s,T,b,v){(0,t.IsUndefined)(v)||(yield g(o.Undefined,s,b,v))}function*O(s,T,b,v){let U=0;for(let L of s.anyOf){let J=[...A(L,T,b,v)];if(J.length===0)return;U+=J.length}U>0&&(yield g(o.Union,s,b,v))}function*k(s,T,b,v){if(!(0,t.IsUint8Array)(v))return yield g(o.Uint8Array,s,b,v);c(s.maxByteLength)&&!(v.length<=s.maxByteLength)&&(yield g(o.Uint8ArrayMaxByteLength,s,b,v)),c(s.minByteLength)&&!(v.length>=s.minByteLength)&&(yield g(o.Uint8ArrayMinByteLength,s,b,v))}function*S(s,T,b,v){}function*$(s,T,b,v){r.TypeSystemPolicy.IsVoidLike(v)||(yield g(o.Void,s,b,v))}function*h(s,T,b,v){a.TypeRegistry.Get(s[a.Kind])(s,v)||(yield g(o.Kind,s,b,v))}function*A(s,T,b,v){let U=c(s.$id)?[...T,s]:T,L=s;switch(L[a.Kind]){case"Any":return yield*R(L,U,b,v);case"Array":return yield*j(L,U,b,v);case"AsyncIterator":return yield*q(L,U,b,v);case"BigInt":return yield*Z(L,U,b,v);case"Boolean":return yield*ae(L,U,b,v);case"Constructor":return yield*B(L,U,b,v);case"Date":return yield*V(L,U,b,v);case"Function":return yield*H(L,U,b,v);case"Integer":return yield*se(L,U,b,v);case"Intersect":return yield*F(L,U,b,v);case"Iterator":return yield*ue(L,U,b,v);case"Literal":return yield*z(L,U,b,v);case"Never":return yield*pe(L,U,b,v);case"Not":return yield*M(L,U,b,v);case"Null":return yield*P(L,U,b,v);case"Number":return yield*C(L,U,b,v);case"Object":return yield*Q(L,U,b,v);case"Promise":return yield*X(L,U,b,v);case"Record":return yield*E(L,U,b,v);case"Ref":return yield*K(L,U,b,v);case"String":return yield*te(L,U,b,v);case"Symbol":return yield*G(L,U,b,v);case"TemplateLiteral":return yield*W(L,U,b,v);case"This":return yield*fe(L,U,b,v);case"Tuple":return yield*f(L,U,b,v);case"Undefined":return yield*_(L,U,b,v);case"Union":return yield*O(L,U,b,v);case"Uint8Array":return yield*k(L,U,b,v);case"Unknown":return yield*S(L,U,b,v);case"Void":return yield*$(L,U,b,v);default:if(!a.TypeRegistry.Has(L[a.Kind]))throw new u(s);return yield*h(L,U,b,v)}}function w(...s){let T=s.length===3?A(s[0],s[1],"",s[2]):A(s[0],[],"",s[1]);return new m(T)}e.Errors=w}),Mm=Le(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(n,i,a,o){o===void 0&&(o=a);var u=Object.getOwnPropertyDescriptor(i,a);(!u||("get"in u?!i.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,u)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]}),r=e&&e.__exportStar||function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&t(i,n,a)};Object.defineProperty(e,"__esModule",{value:!0}),r(mo(),e)}),Pl=Le(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(i,a,o,u){u===void 0&&(u=o);var l=Object.getOwnPropertyDescriptor(a,o);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,u,l)}:function(i,a,o,u){u===void 0&&(u=o),i[u]=a[o]}),r=e&&e.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=mo();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(Nl(),e)}),Lm=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=ln(),r=Pl(),n=yo(),i=rs(),a=Pr(),o=class extends a.TypeBoxError{constructor(h){super("Unknown type"),this.schema=h}};e.ValueCheckUnknownTypeError=o;function u(h){return h[a.Kind]==="Any"||h[a.Kind]==="Unknown"}function l(h){return h!==void 0}function c(h,A,w){return!0}function m(h,A,w){if(!(0,t.IsArray)(w)||l(h.minItems)&&!(w.length>=h.minItems)||l(h.maxItems)&&!(w.length<=h.maxItems)||!w.every(b=>S(h.items,A,b))||h.uniqueItems===!0&&!function(){let b=new Set;for(let v of w){let U=(0,i.Hash)(v);if(b.has(U))return!1;b.add(U)}return!0}())return!1;if(!(l(h.contains)||(0,t.IsNumber)(h.minContains)||(0,t.IsNumber)(h.maxContains)))return!0;let s=l(h.contains)?h.contains:a.Type.Never(),T=w.reduce((b,v)=>S(s,A,v)?b+1:b,0);return!(T===0||(0,t.IsNumber)(h.minContains)&&T<h.minContains||(0,t.IsNumber)(h.maxContains)&&T>h.maxContains)}function g(h,A,w){return(0,t.IsAsyncIterator)(w)}function R(h,A,w){return!(!(0,t.IsBigInt)(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.minimum)&&!(w>=h.minimum)||l(h.multipleOf)&&w%h.multipleOf!==BigInt(0))}function j(h,A,w){return(0,t.IsBoolean)(w)}function q(h,A,w){return S(h.returns,A,w.prototype)}function Z(h,A,w){return!(!(0,t.IsDate)(w)||l(h.exclusiveMaximumTimestamp)&&!(w.getTime()<h.exclusiveMaximumTimestamp)||l(h.exclusiveMinimumTimestamp)&&!(w.getTime()>h.exclusiveMinimumTimestamp)||l(h.maximumTimestamp)&&!(w.getTime()<=h.maximumTimestamp)||l(h.minimumTimestamp)&&!(w.getTime()>=h.minimumTimestamp)||l(h.multipleOfTimestamp)&&w.getTime()%h.multipleOfTimestamp!==0)}function ae(h,A,w){return(0,t.IsFunction)(w)}function B(h,A,w){return!(!(0,t.IsInteger)(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.minimum)&&!(w>=h.minimum)||l(h.multipleOf)&&w%h.multipleOf!==0)}function V(h,A,w){let s=h.allOf.every(T=>S(T,A,w));if(h.unevaluatedProperties===!1){let T=new RegExp(a.KeyResolver.ResolvePattern(h)),b=Object.getOwnPropertyNames(w).every(v=>T.test(v));return s&&b}else if(a.TypeGuard.TSchema(h.unevaluatedProperties)){let T=new RegExp(a.KeyResolver.ResolvePattern(h)),b=Object.getOwnPropertyNames(w).every(v=>T.test(v)||S(h.unevaluatedProperties,A,w[v]));return s&&b}else return s}function H(h,A,w){return(0,t.IsIterator)(w)}function se(h,A,w){return w===h.const}function F(h,A,w){return!1}function ue(h,A,w){return!S(h.not,A,w)}function z(h,A,w){return(0,t.IsNull)(w)}function pe(h,A,w){return!(!r.TypeSystemPolicy.IsNumberLike(w)||l(h.exclusiveMaximum)&&!(w<h.exclusiveMaximum)||l(h.exclusiveMinimum)&&!(w>h.exclusiveMinimum)||l(h.minimum)&&!(w>=h.minimum)||l(h.maximum)&&!(w<=h.maximum)||l(h.multipleOf)&&w%h.multipleOf!==0)}function M(h,A,w){if(!r.TypeSystemPolicy.IsObjectLike(w)||l(h.minProperties)&&!(Object.getOwnPropertyNames(w).length>=h.minProperties)||l(h.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=h.maxProperties))return!1;let s=Object.getOwnPropertyNames(h.properties);for(let T of s){let b=h.properties[T];if(h.required&&h.required.includes(T)){if(!S(b,A,w[T])||(a.ExtendsUndefined.Check(b)||u(b))&&!(T in w))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(w,T)&&!S(b,A,w[T]))return!1}if(h.additionalProperties===!1){let T=Object.getOwnPropertyNames(w);return h.required&&h.required.length===s.length&&T.length===s.length?!0:T.every(b=>s.includes(b))}else return typeof h.additionalProperties=="object"?Object.getOwnPropertyNames(w).every(T=>s.includes(T)||S(h.additionalProperties,A,w[T])):!0}function P(h,A,w){return(0,t.IsPromise)(w)}function C(h,A,w){if(!r.TypeSystemPolicy.IsRecordLike(w)||l(h.minProperties)&&!(Object.getOwnPropertyNames(w).length>=h.minProperties)||l(h.maxProperties)&&!(Object.getOwnPropertyNames(w).length<=h.maxProperties))return!1;let[s,T]=Object.entries(h.patternProperties)[0],b=new RegExp(s),v=Object.entries(w).every(([J,ee])=>b.test(J)?S(T,A,ee):!0),U=typeof h.additionalProperties=="object"?Object.entries(w).every(([J,ee])=>b.test(J)?!0:S(h.additionalProperties,A,ee)):!0,L=h.additionalProperties===!1?Object.getOwnPropertyNames(w).every(J=>b.test(J)):!0;return v&&U&&L}function Q(h,A,w){return S((0,n.Deref)(h,A),A,w)}function X(h,A,w){return!(0,t.IsString)(w)||l(h.minLength)&&!(w.length>=h.minLength)||l(h.maxLength)&&!(w.length<=h.maxLength)||l(h.pattern)&&!new RegExp(h.pattern).test(w)?!1:l(h.format)?a.FormatRegistry.Has(h.format)?a.FormatRegistry.Get(h.format)(w):!1:!0}function E(h,A,w){return(0,t.IsSymbol)(w)}function K(h,A,w){return(0,t.IsString)(w)&&new RegExp(h.pattern).test(w)}function te(h,A,w){return S((0,n.Deref)(h,A),A,w)}function G(h,A,w){if(!(0,t.IsArray)(w)||h.items===void 0&&w.length!==0||w.length!==h.maxItems)return!1;if(!h.items)return!0;for(let s=0;s<h.items.length;s++)if(!S(h.items[s],A,w[s]))return!1;return!0}function W(h,A,w){return(0,t.IsUndefined)(w)}function fe(h,A,w){return h.anyOf.some(s=>S(s,A,w))}function f(h,A,w){return!(!(0,t.IsUint8Array)(w)||l(h.maxByteLength)&&!(w.length<=h.maxByteLength)||l(h.minByteLength)&&!(w.length>=h.minByteLength))}function _(h,A,w){return!0}function O(h,A,w){return r.TypeSystemPolicy.IsVoidLike(w)}function k(h,A,w){return a.TypeRegistry.Has(h[a.Kind])?a.TypeRegistry.Get(h[a.Kind])(h,w):!1}function S(h,A,w){let s=l(h.$id)?[...A,h]:A,T=h;switch(T[a.Kind]){case"Any":return c(T,s,w);case"Array":return m(T,s,w);case"AsyncIterator":return g(T,s,w);case"BigInt":return R(T,s,w);case"Boolean":return j(T,s,w);case"Constructor":return q(T,s,w);case"Date":return Z(T,s,w);case"Function":return ae(T,s,w);case"Integer":return B(T,s,w);case"Intersect":return V(T,s,w);case"Iterator":return H(T,s,w);case"Literal":return se(T,s,w);case"Never":return F(T,s,w);case"Not":return ue(T,s,w);case"Null":return z(T,s,w);case"Number":return pe(T,s,w);case"Object":return M(T,s,w);case"Promise":return P(T,s,w);case"Record":return C(T,s,w);case"Ref":return Q(T,s,w);case"String":return X(T,s,w);case"Symbol":return E(T,s,w);case"TemplateLiteral":return K(T,s,w);case"This":return te(T,s,w);case"Tuple":return G(T,s,w);case"Undefined":return W(T,s,w);case"Union":return fe(T,s,w);case"Uint8Array":return f(T,s,w);case"Unknown":return _(T,s,w);case"Void":return O(T,s,w);default:if(!a.TypeRegistry.Has(T[a.Kind]))throw new o(T);return k(T,s,w)}}function $(...h){return h.length===3?S(h[0],h[1],h[2]):S(h[0],[],h[1])}e.Check=$}),Dm=Le(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=ln(),r=yo(),n=Lm(),i=Pr(),a=class extends i.TypeBoxError{constructor(R,j,q){super("Unable to decode due to invalid value"),this.schema=R,this.value=j,this.error=q}};e.TransformDecodeCheckError=a;var o=class extends i.TypeBoxError{constructor(R,j,q){super("Unable to encode due to invalid value"),this.schema=R,this.value=j,this.error=q}};e.TransformEncodeCheckError=o;var u=class extends i.TypeBoxError{constructor(R,j,q){super(`${q instanceof Error?q.message:"Unknown error"}`),this.schema=R,this.value=j}};e.TransformDecodeError=u;var l=class extends i.TypeBoxError{constructor(R,j,q){super(`${q instanceof Error?q.message:"Unknown error"}`),this.schema=R,this.value=j}};e.TransformEncodeError=l;var c;(function(R){function j(E,K){return i.TypeGuard.TTransform(E)||C(E.items,K)}function q(E,K){return i.TypeGuard.TTransform(E)||C(E.items,K)}function Z(E,K){return i.TypeGuard.TTransform(E)||C(E.returns,K)||E.parameters.some(te=>C(te,K))}function ae(E,K){return i.TypeGuard.TTransform(E)||C(E.returns,K)||E.parameters.some(te=>C(te,K))}function B(E,K){return i.TypeGuard.TTransform(E)||i.TypeGuard.TTransform(E.unevaluatedProperties)||E.allOf.some(te=>C(te,K))}function V(E,K){return i.TypeGuard.TTransform(E)||C(E.items,K)}function H(E,K){return i.TypeGuard.TTransform(E)||C(E.not,K)}function se(E,K){return i.TypeGuard.TTransform(E)||Object.values(E.properties).some(te=>C(te,K))||i.TypeGuard.TSchema(E.additionalProperties)&&C(E.additionalProperties,K)}function F(E,K){return i.TypeGuard.TTransform(E)||C(E.item,K)}function ue(E,K){let te=Object.getOwnPropertyNames(E.patternProperties)[0],G=E.patternProperties[te];return i.TypeGuard.TTransform(E)||C(G,K)||i.TypeGuard.TSchema(E.additionalProperties)&&i.TypeGuard.TTransform(E.additionalProperties)}function z(E,K){return i.TypeGuard.TTransform(E)?!0:C((0,r.Deref)(E,K),K)}function pe(E,K){return i.TypeGuard.TTransform(E)?!0:C((0,r.Deref)(E,K),K)}function M(E,K){return i.TypeGuard.TTransform(E)||!(0,t.IsUndefined)(E.items)&&E.items.some(te=>C(te,K))}function P(E,K){return i.TypeGuard.TTransform(E)||E.anyOf.some(te=>C(te,K))}function C(E,K){let te=(0,t.IsString)(E.$id)?[...K,E]:K,G=E;if(E.$id&&Q.has(E.$id))return!1;switch(E.$id&&Q.add(E.$id),E[i.Kind]){case"Array":return j(G,te);case"AsyncIterator":return q(G,te);case"Constructor":return Z(G,te);case"Function":return ae(G,te);case"Intersect":return B(G,te);case"Iterator":return V(G,te);case"Not":return H(G,te);case"Object":return se(G,te);case"Promise":return F(G,te);case"Record":return ue(G,te);case"Ref":return z(G,te);case"This":return pe(G,te);case"Tuple":return M(G,te);case"Union":return P(G,te);default:return i.TypeGuard.TTransform(E)}}let Q=new Set;function X(E,K){return Q.clear(),C(E,K)}R.Has=X})(c||(e.HasTransform=c={}));var m;(function(R){function j(M,P){try{return i.TypeGuard.TTransform(M)?M[i.Transform].Decode(P):P}catch(C){throw new u(M,P,C)}}function q(M,P,C){return(0,t.IsArray)(C)?j(M,C.map(Q=>z(M.items,P,Q))):j(M,C)}function Z(M,P,C){if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return j(M,C);let Q=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),X=Q.reduce((G,W)=>W in G?{...G,[W]:z(i.IndexedAccessor.Resolve(M,[W]),P,G[W])}:G,C);if(!i.TypeGuard.TTransform(M.unevaluatedProperties))return j(M,X);let E=Object.getOwnPropertyNames(X),K=M.unevaluatedProperties,te=E.reduce((G,W)=>Q.includes(W)?G:{...G,[W]:j(K,G[W])},X);return j(M,te)}function ae(M,P,C){return j(M,z(M.not,P,C))}function B(M,P,C){if(!(0,t.IsPlainObject)(C))return j(M,C);let Q=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),X=Q.reduce((G,W)=>W in G?{...G,[W]:z(M.properties[W],P,G[W])}:G,C);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,X);let E=Object.getOwnPropertyNames(X),K=M.additionalProperties,te=E.reduce((G,W)=>Q.includes(W)?G:{...G,[W]:j(K,G[W])},X);return j(M,te)}function V(M,P,C){if(!(0,t.IsPlainObject)(C))return j(M,C);let Q=Object.getOwnPropertyNames(M.patternProperties)[0],X=new RegExp(Q),E=Object.getOwnPropertyNames(C).reduce((W,fe)=>X.test(fe)?{...W,[fe]:z(M.patternProperties[Q],P,W[fe])}:W,C);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,E);let K=Object.getOwnPropertyNames(E),te=M.additionalProperties,G=K.reduce((W,fe)=>X.test(fe)?W:{...W,[fe]:j(te,W[fe])},E);return j(M,G)}function H(M,P,C){let Q=(0,r.Deref)(M,P);return j(M,z(Q,P,C))}function se(M,P,C){let Q=(0,r.Deref)(M,P);return j(M,z(Q,P,C))}function F(M,P,C){return(0,t.IsArray)(C)&&(0,t.IsArray)(M.items)?j(M,M.items.map((Q,X)=>z(Q,P,C[X]))):j(M,C)}function ue(M,P,C){let Q=j(M,C);for(let X of M.anyOf)if((0,n.Check)(X,P,Q))return z(X,P,Q);return Q}function z(M,P,C){let Q=typeof M.$id=="string"?[...P,M]:P,X=M;switch(M[i.Kind]){case"Array":return q(X,Q,C);case"Intersect":return Z(X,Q,C);case"Not":return ae(X,Q,C);case"Object":return B(X,Q,C);case"Record":return V(X,Q,C);case"Ref":return H(X,Q,C);case"Symbol":return j(X,C);case"This":return se(X,Q,C);case"Tuple":return F(X,Q,C);case"Union":return ue(X,Q,C);default:return j(X,C)}}function pe(M,P,C){return z(M,P,C)}R.Decode=pe})(m||(e.DecodeTransform=m={}));var g;(function(R){function j(M,P){try{return i.TypeGuard.TTransform(M)?M[i.Transform].Encode(P):P}catch(C){throw new l(M,P,C)}}function q(M,P,C){let Q=j(M,C);return(0,t.IsArray)(Q)?Q.map(X=>z(M.items,P,X)):Q}function Z(M,P,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C)||(0,t.IsValueType)(C))return Q;let X=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),E=X.reduce((G,W)=>W in Q?{...G,[W]:z(i.IndexedAccessor.Resolve(M,[W]),P,G[W])}:G,Q);if(!i.TypeGuard.TTransform(M.unevaluatedProperties))return j(M,E);let K=Object.getOwnPropertyNames(E),te=M.unevaluatedProperties;return K.reduce((G,W)=>X.includes(W)?G:{...G,[W]:j(te,G[W])},E)}function ae(M,P,C){return j(M.not,j(M,C))}function B(M,P,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C))return Q;let X=i.KeyResolver.ResolveKeys(M,{includePatterns:!1}),E=X.reduce((G,W)=>W in G?{...G,[W]:z(M.properties[W],P,G[W])}:G,Q);if(!i.TypeGuard.TSchema(M.additionalProperties))return E;let K=Object.getOwnPropertyNames(E),te=M.additionalProperties;return K.reduce((G,W)=>X.includes(W)?G:{...G,[W]:j(te,G[W])},E)}function V(M,P,C){let Q=j(M,C);if(!(0,t.IsPlainObject)(C))return Q;let X=Object.getOwnPropertyNames(M.patternProperties)[0],E=new RegExp(X),K=Object.getOwnPropertyNames(C).reduce((W,fe)=>E.test(fe)?{...W,[fe]:z(M.patternProperties[X],P,W[fe])}:W,Q);if(!i.TypeGuard.TSchema(M.additionalProperties))return j(M,K);let te=Object.getOwnPropertyNames(K),G=M.additionalProperties;return te.reduce((W,fe)=>E.test(fe)?W:{...W,[fe]:j(G,W[fe])},K)}function H(M,P,C){let Q=(0,r.Deref)(M,P),X=z(Q,P,C);return j(M,X)}function se(M,P,C){let Q=(0,r.Deref)(M,P),X=z(Q,P,C);return j(M,X)}function F(M,P,C){let Q=j(M,C);return(0,t.IsArray)(M.items)?M.items.map((X,E)=>z(X,P,Q[E])):[]}function ue(M,P,C){for(let Q of M.anyOf){if(!(0,n.Check)(Q,P,C))continue;let X=z(Q,P,C);return j(M,X)}for(let Q of M.anyOf){let X=z(Q,P,C);if((0,n.Check)(M,P,X))return j(M,X)}return j(M,C)}function z(M,P,C){let Q=typeof M.$id=="string"?[...P,M]:P,X=M;switch(M[i.Kind]){case"Array":return q(X,Q,C);case"Intersect":return Z(X,Q,C);case"Not":return ae(X,Q,C);case"Object":return B(X,Q,C);case"Record":return V(X,Q,C);case"Ref":return H(X,Q,C);case"This":return se(X,Q,C);case"Tuple":return F(X,Q,C);case"Union":return ue(X,Q,C);default:return j(X,C)}}function pe(M,P,C){return z(M,P,C)}R.Encode=pe})(g||(e.EncodeTransform=g={}))}),Vm=Le(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=Dm(),r=ln(),n=mo(),i=Pl(),a=yo(),o=rs(),u=Pr(),l=class{constructor(B,V,H,se){this.schema=B,this.references=V,this.checkFunc=H,this.code=se,this.hasTransform=t.HasTransform.Has(B,V)}Code(){return this.code}Errors(B){return(0,n.Errors)(this.schema,this.references,B)}Check(B){return this.checkFunc(B)}Decode(B){if(!this.checkFunc(B))throw new t.TransformDecodeCheckError(this.schema,B,this.Errors(B).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,B):B}Encode(B){let V=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,B):B;if(!this.checkFunc(V))throw new t.TransformEncodeCheckError(this.schema,B,this.Errors(B).First());return V}};e.TypeCheck=l;var c;(function(B){function V(ue){return ue===36}B.DollarSign=V;function H(ue){return ue===95}B.IsUnderscore=H;function se(ue){return ue>=65&&ue<=90||ue>=97&&ue<=122}B.IsAlpha=se;function F(ue){return ue>=48&&ue<=57}B.IsNumeric=F})(c||(c={}));var m;(function(B){function V(ue){return ue.length===0?!1:c.IsNumeric(ue.charCodeAt(0))}function H(ue){if(V(ue))return!1;for(let z=0;z<ue.length;z++){let pe=ue.charCodeAt(z);if(!(c.IsAlpha(pe)||c.IsNumeric(pe)||c.DollarSign(pe)||c.IsUnderscore(pe)))return!1}return!0}function se(ue){return ue.replace(/'/g,"\\'")}function F(ue,z){return H(z)?`${ue}.${z}`:`${ue}['${se(z)}']`}B.Encode=F})(m||(m={}));var g;(function(B){function V(H){let se=[];for(let F=0;F<H.length;F++){let ue=H.charCodeAt(F);c.IsNumeric(ue)||c.IsAlpha(ue)?se.push(H.charAt(F)):se.push(`_${ue}_`)}return se.join("").replace(/__/g,"_")}B.Encode=V})(g||(g={}));var R;(function(B){function V(H){return H.replace(/'/g,"\\'")}B.Escape=V})(R||(R={}));var j=class extends u.TypeBoxError{constructor(B){super("Unknown type"),this.schema=B}};e.TypeCompilerUnknownTypeError=j;var q=class extends u.TypeBoxError{constructor(B){super("Preflight validation check failed to guard for the given schema"),this.schema=B}};e.TypeCompilerTypeGuardError=q;var Z;(function(B){function V(z,pe,M){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${pe}' in ${z} ? ${M} : true)`:`(${m.Encode(z,pe)} !== undefined ? ${M} : true)`}B.IsExactOptionalProperty=V;function H(z){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${z} === 'object' && ${z} !== null)`:`(typeof ${z} === 'object' && ${z} !== null && !Array.isArray(${z}))`}B.IsObjectLike=H;function se(z){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${z} === 'object' && ${z} !== null && !(${z} instanceof Date) && !(${z} instanceof Uint8Array))`:`(typeof ${z} === 'object' && ${z} !== null && !Array.isArray(${z}) && !(${z} instanceof Date) && !(${z} instanceof Uint8Array))`}B.IsRecordLike=se;function F(z){return i.TypeSystemPolicy.AllowNaN?`typeof ${z} === 'number'`:`(typeof ${z} === 'number' && Number.isFinite(${z}))`}B.IsNumberLike=F;function ue(z){return i.TypeSystemPolicy.AllowNullVoid?`(${z} === undefined || ${z} === null)`:`${z} === undefined`}B.IsVoidLike=ue})(Z||(e.Policy=Z={}));var ae;(function(B){function V(x){return x[u.Kind]==="Any"||x[u.Kind]==="Unknown"}function*H(x,le,I){yield"true"}function*se(x,le,I){yield`Array.isArray(${I})`;let[ge,ne]=[Be("value","any"),Be("acc","number")];(0,r.IsNumber)(x.maxItems)&&(yield`${I}.length <= ${x.maxItems}`),(0,r.IsNumber)(x.minItems)&&(yield`${I}.length >= ${x.minItems}`);let de=ee(x.items,le,"value");if(yield`${I}.every((${ge}) => ${de})`,u.TypeGuard.TSchema(x.contains)||(0,r.IsNumber)(x.minContains)||(0,r.IsNumber)(x.maxContains)){let Ie=u.TypeGuard.TSchema(x.contains)?x.contains:u.Type.Never(),Ce=ee(Ie,le,"value"),We=(0,r.IsNumber)(x.minContains)?[`(count >= ${x.minContains})`]:[],qe=(0,r.IsNumber)(x.maxContains)?[`(count <= ${x.maxContains})`]:[],Xe=`const count = value.reduce((${ne}, ${ge}) => ${Ce} ? acc + 1 : acc, 0)`,Kt=["(count > 0)",...We,...qe].join(" && ");yield`((${ge}) => { ${Xe}; return ${Kt}})(${I})`}x.uniqueItems===!0&&(yield`((${ge}) => { 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 } )(${I})`)}function*F(x,le,I){yield`(typeof value === 'object' && Symbol.asyncIterator in ${I})`}function*ue(x,le,I){yield`(typeof ${I} === 'bigint')`,(0,r.IsBigInt)(x.exclusiveMaximum)&&(yield`${I} < BigInt(${x.exclusiveMaximum})`),(0,r.IsBigInt)(x.exclusiveMinimum)&&(yield`${I} > BigInt(${x.exclusiveMinimum})`),(0,r.IsBigInt)(x.maximum)&&(yield`${I} <= BigInt(${x.maximum})`),(0,r.IsBigInt)(x.minimum)&&(yield`${I} >= BigInt(${x.minimum})`),(0,r.IsBigInt)(x.multipleOf)&&(yield`(${I} % BigInt(${x.multipleOf})) === 0`)}function*z(x,le,I){yield`(typeof ${I} === 'boolean')`}function*pe(x,le,I){yield*L(x.returns,le,`${I}.prototype`)}function*M(x,le,I){yield`(${I} instanceof Date) && Number.isFinite(${I}.getTime())`,(0,r.IsNumber)(x.exclusiveMaximumTimestamp)&&(yield`${I}.getTime() < ${x.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(x.exclusiveMinimumTimestamp)&&(yield`${I}.getTime() > ${x.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(x.maximumTimestamp)&&(yield`${I}.getTime() <= ${x.maximumTimestamp}`),(0,r.IsNumber)(x.minimumTimestamp)&&(yield`${I}.getTime() >= ${x.minimumTimestamp}`),(0,r.IsNumber)(x.multipleOfTimestamp)&&(yield`(${I}.getTime() % ${x.multipleOfTimestamp}) === 0`)}function*P(x,le,I){yield`(typeof ${I} === 'function')`}function*C(x,le,I){yield`(typeof ${I} === 'number' && Number.isInteger(${I}))`,(0,r.IsNumber)(x.exclusiveMaximum)&&(yield`${I} < ${x.exclusiveMaximum}`),(0,r.IsNumber)(x.exclusiveMinimum)&&(yield`${I} > ${x.exclusiveMinimum}`),(0,r.IsNumber)(x.maximum)&&(yield`${I} <= ${x.maximum}`),(0,r.IsNumber)(x.minimum)&&(yield`${I} >= ${x.minimum}`),(0,r.IsNumber)(x.multipleOf)&&(yield`(${I} % ${x.multipleOf}) === 0`)}function*Q(x,le,I){let ge=x.allOf.map(ne=>ee(ne,le,I)).join(" && ");if(x.unevaluatedProperties===!1){let ne=we(`${new RegExp(u.KeyResolver.ResolvePattern(x))};`),de=`Object.getOwnPropertyNames(${I}).every(key => ${ne}.test(key))`;yield`(${ge} && ${de})`}else if(u.TypeGuard.TSchema(x.unevaluatedProperties)){let ne=we(`${new RegExp(u.KeyResolver.ResolvePattern(x))};`),de=`Object.getOwnPropertyNames(${I}).every(key => ${ne}.test(key) || ${ee(x.unevaluatedProperties,le,`${I}[key]`)})`;yield`(${ge} && ${de})`}else yield`(${ge})`}function*X(x,le,I){yield`(typeof value === 'object' && Symbol.iterator in ${I})`}function*E(x,le,I){typeof x.const=="number"||typeof x.const=="boolean"?yield`(${I} === ${x.const})`:yield`(${I} === '${R.Escape(x.const)}')`}function*K(x,le,I){yield"false"}function*te(x,le,I){yield`(!${ee(x.not,le,I)})`}function*G(x,le,I){yield`(${I} === null)`}function*W(x,le,I){yield Z.IsNumberLike(I),(0,r.IsNumber)(x.exclusiveMaximum)&&(yield`${I} < ${x.exclusiveMaximum}`),(0,r.IsNumber)(x.exclusiveMinimum)&&(yield`${I} > ${x.exclusiveMinimum}`),(0,r.IsNumber)(x.maximum)&&(yield`${I} <= ${x.maximum}`),(0,r.IsNumber)(x.minimum)&&(yield`${I} >= ${x.minimum}`),(0,r.IsNumber)(x.multipleOf)&&(yield`(${I} % ${x.multipleOf}) === 0`)}function*fe(x,le,I){yield Z.IsObjectLike(I),(0,r.IsNumber)(x.minProperties)&&(yield`Object.getOwnPropertyNames(${I}).length >= ${x.minProperties}`),(0,r.IsNumber)(x.maxProperties)&&(yield`Object.getOwnPropertyNames(${I}).length <= ${x.maxProperties}`);let ge=Object.getOwnPropertyNames(x.properties);for(let ne of ge){let de=m.Encode(I,ne),Ie=x.properties[ne];if(x.required&&x.required.includes(ne))yield*L(Ie,le,de),(u.ExtendsUndefined.Check(Ie)||V(Ie))&&(yield`('${ne}' in ${I})`);else{let Ce=ee(Ie,le,de);yield Z.IsExactOptionalProperty(I,ne,Ce)}}if(x.additionalProperties===!1)if(x.required&&x.required.length===ge.length)yield`Object.getOwnPropertyNames(${I}).length === ${ge.length}`;else{let ne=`[${ge.map(de=>`'${de}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${I}).every(key => ${ne}.includes(key))`}if(typeof x.additionalProperties=="object"){let ne=ee(x.additionalProperties,le,`${I}[key]`),de=`[${ge.map(Ie=>`'${Ie}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${I}).every(key => ${de}.includes(key) || ${ne}))`}}function*f(x,le,I){yield`(typeof value === 'object' && typeof ${I}.then === 'function')`}function*_(x,le,I){yield Z.IsRecordLike(I),(0,r.IsNumber)(x.minProperties)&&(yield`Object.getOwnPropertyNames(${I}).length >= ${x.minProperties}`),(0,r.IsNumber)(x.maxProperties)&&(yield`Object.getOwnPropertyNames(${I}).length <= ${x.maxProperties}`);let[ge,ne]=Object.entries(x.patternProperties)[0],de=we(`${new RegExp(ge)}`),Ie=ee(ne,le,"value"),Ce=u.TypeGuard.TSchema(x.additionalProperties)?ee(x.additionalProperties,le,I):x.additionalProperties===!1?"false":"true",We=`(${de}.test(key) ? ${Ie} : ${Ce})`;yield`(Object.entries(${I}).every(([key, value]) => ${We}))`}function*O(x,le,I){let ge=(0,a.Deref)(x,le);if(J.functions.has(x.$ref))return yield`${ye(x.$ref)}(${I})`;yield*L(ge,le,I)}function*k(x,le,I){yield`(typeof ${I} === 'string')`,(0,r.IsNumber)(x.maxLength)&&(yield`${I}.length <= ${x.maxLength}`),(0,r.IsNumber)(x.minLength)&&(yield`${I}.length >= ${x.minLength}`),x.pattern!==void 0&&(yield`${we(`${new RegExp(x.pattern)};`)}.test(${I})`),x.format!==void 0&&(yield`format('${x.format}', ${I})`)}function*S(x,le,I){yield`(typeof ${I} === 'symbol')`}function*$(x,le,I){yield`(typeof ${I} === 'string')`,yield`${we(`${new RegExp(x.pattern)};`)}.test(${I})`}function*h(x,le,I){yield`${ye(x.$ref)}(${I})`}function*A(x,le,I){if(yield`Array.isArray(${I})`,x.items===void 0)return yield`${I}.length === 0`;yield`(${I}.length === ${x.maxItems})`;for(let ge=0;ge<x.items.length;ge++)yield`${ee(x.items[ge],le,`${I}[${ge}]`)}`}function*w(x,le,I){yield`${I} === undefined`}function*s(x,le,I){yield`(${x.anyOf.map(ge=>ee(ge,le,I)).join(" || ")})`}function*T(x,le,I){yield`${I} instanceof Uint8Array`,(0,r.IsNumber)(x.maxByteLength)&&(yield`(${I}.length <= ${x.maxByteLength})`),(0,r.IsNumber)(x.minByteLength)&&(yield`(${I}.length >= ${x.minByteLength})`)}function*b(x,le,I){yield"true"}function*v(x,le,I){yield Z.IsVoidLike(I)}function*U(x,le,I){let ge=J.instances.size;J.instances.set(ge,x),yield`kind('${x[u.Kind]}', ${ge}, ${I})`}function*L(x,le,I,ge=!0){let ne=(0,r.IsString)(x.$id)?[...le,x]:le,de=x;if(ge&&(0,r.IsString)(x.$id)){let Ie=ye(x.$id);if(J.functions.has(Ie))return yield`${Ie}(${I})`;{let Ce=je(Ie,x,le,"value",!1);return J.functions.set(Ie,Ce),yield`${Ie}(${I})`}}switch(de[u.Kind]){case"Any":return yield*H(de,ne,I);case"Array":return yield*se(de,ne,I);case"AsyncIterator":return yield*F(de,ne,I);case"BigInt":return yield*ue(de,ne,I);case"Boolean":return yield*z(de,ne,I);case"Constructor":return yield*pe(de,ne,I);case"Date":return yield*M(de,ne,I);case"Function":return yield*P(de,ne,I);case"Integer":return yield*C(de,ne,I);case"Intersect":return yield*Q(de,ne,I);case"Iterator":return yield*X(de,ne,I);case"Literal":return yield*E(de,ne,I);case"Never":return yield*K(de,ne,I);case"Not":return yield*te(de,ne,I);case"Null":return yield*G(de,ne,I);case"Number":return yield*W(de,ne,I);case"Object":return yield*fe(de,ne,I);case"Promise":return yield*f(de,ne,I);case"Record":return yield*_(de,ne,I);case"Ref":return yield*O(de,ne,I);case"String":return yield*k(de,ne,I);case"Symbol":return yield*S(de,ne,I);case"TemplateLiteral":return yield*$(de,ne,I);case"This":return yield*h(de,ne,I);case"Tuple":return yield*A(de,ne,I);case"Undefined":return yield*w(de,ne,I);case"Union":return yield*s(de,ne,I);case"Uint8Array":return yield*T(de,ne,I);case"Unknown":return yield*b(de,ne,I);case"Void":return yield*v(de,ne,I);default:if(!u.TypeRegistry.Has(de[u.Kind]))throw new j(x);return yield*U(de,ne,I)}}let J={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ee(x,le,I,ge=!0){return`(${[...L(x,le,I,ge)].join(" && ")})`}function ye(x){return`check_${g.Encode(x)}`}function we(x){let le=`local_${J.variables.size}`;return J.variables.set(le,`const ${le} = ${x}`),le}function je(x,le,I,ge,ne=!0){let[de,Ie]=[`
|
|
21
|
+
`,Xe=>"".padStart(Xe," ")],Ce=Be("value","any"),We=dr("boolean"),qe=[...L(le,I,ge,ne)].map(Xe=>`${Ie(4)}${Xe}`).join(` &&${de}`);return`function ${x}(${Ce})${We} {${de}${Ie(2)}return (${de}${qe}${de}${Ie(2)})
|
|
22
|
+
}`}function Be(x,le){let I=J.language==="typescript"?`: ${le}`:"";return`${x}${I}`}function dr(x){return J.language==="typescript"?`: ${x}`:""}function be(x,le,I){let ge=je("check",x,le,"value"),ne=Be("value","any"),de=dr("boolean"),Ie=[...J.functions.values()],Ce=[...J.variables.values()],We=(0,r.IsString)(x.$id)?`return function check(${ne})${de} {
|
|
23
23
|
return ${ye(x.$id)}(value)
|
|
24
|
-
}`:`return ${ge}`;return[...Ce,...
|
|
25
|
-
`)}function
|
|
26
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jm(e,t){if(typeof e!="object"||e===null)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 Xm(e){var t=Jm(e,"string");return typeof t=="symbol"?t:String(t)}var kt=Symbol("mobx-stored-annotations");function Nt(e){function t(r,n){if(ii(n))return e.decorate_20223_(r,n);dn(r,n,e)}return Object.assign(t,e)}function dn(e,t,r){if(
|
|
27
|
-
'`+a.annotationType_+"' can only be used on properties with a function value."))}function lg(e,t,r,n){var i=t.annotationType_,a=n.value}function ql(e,t,r,n,i){var a,o,u,l,c,m,g;i===void 0&&(i=re.safeDescriptors),lg(e,t,r,n);var R=n.value;if((a=t.options_)!=null&&a.bound){var j;R=R.bind((j=e.proxy_)!=null?j:e.target_)}return{value:$r((o=(u=t.options_)==null?void 0:u.name)!=null?o:r.toString(),R,(l=(c=t.options_)==null?void 0:c.autoAction)!=null?l:!1,(m=t.options_)!=null&&m.bound?(g=e.proxy_)!=null?g:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Kl(e,t){return{annotationType_:e,options_:t,make_:fg,extend_:dg,decorate_20223_:pg}}function fg(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&&(!Mt(e.target_,t)||!Jn(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(Jn(r.value))return 1;var a=Gl(e,this,t,r,!1,!1);return jt(n,t,a),2}function dg(e,t,r,n){var i,a=Gl(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,a,n)}function pg(e,t){var r,n=t.name,i=t.addInitializer;return Jn(e)||(e=sn(e)),(r=this.options_)!=null&&r.bound&&i(function(){var a=this,o=a[n].bind(a);o.isMobXFlow=!0,a[n]=o}),e}function hg(e,t,r,n){var i=t.annotationType_,a=n.value}function Gl(e,t,r,n,i,a){a===void 0&&(a=re.safeDescriptors),hg(e,t,r,n);var o=n.value;if(Jn(o)||(o=sn(o)),i){var u;o=o.bind((u=e.proxy_)!=null?u:e.target_),o.isMobXFlow=!0}return{value:o,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function ss(e,t){return{annotationType_:e,options_:t,make_:yg,extend_:mg,decorate_20223_:gg}}function yg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function mg(e,t,r,n){return vg(e,this,t,r),e.defineComputedProperty_(t,Sr({},this.options_,{get:r.get,set:r.set}),n)}function gg(e,t){var r=this,n=t.name,i=t.addInitializer;return i(function(){var a=yn(this)[me],o=Sr({},r.options_,{get:e,context:this});o.name||(o.name="ObservableObject."+n.toString()),a.values_.set(n,new an(o))}),function(){return this[me].getObservablePropValue_(n)}}function vg(e,t,r,n){var i=t.annotationType_,a=n.get}function _o(e,t){return{annotationType_:e,options_:t,make_:bg,extend_:wg,decorate_20223_:_g}}function bg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function wg(e,t,r,n){var i,a;return Tg(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(a=this.options_)==null?void 0:a.enhancer)!=null?i:pn,n)}function _g(e,t){var r=this,n=t.kind,i=t.name,a=new WeakSet;function o(u,l){var c,m,g=yn(u)[me],R=new ar(l,(c=(m=r.options_)==null?void 0:m.enhancer)!=null?c:pn,"ObservableObject."+i.toString(),!1);g.values_.set(i,R),a.add(u)}if(n=="accessor")return{get:function(){return a.has(this)||o(this,e.get.call(this)),this[me].getObservablePropValue_(i)},set:function(u){return a.has(this)||o(this,u),this[me].setObservablePropValue_(i,u)},init:function(u){return a.has(this)||o(this,u),u}}}function Tg(e,t,r,n){var i=t.annotationType_}var xg="true",Eg=Hl();function Hl(e){return{annotationType_:xg,options_:e,make_:Og,extend_:Ig,decorate_20223_:Ag}}function Og(e,t,r,n){var i,a;if(r.get)return He.make_(e,t,r,n);if(r.set){var o=$r(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:re.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(jt(n,t,{configurable:!0,set:o}),2)}if(n!==e.target_&&typeof r.value=="function"){var u;if(Ml(r.value)){var l,c=(l=this.options_)!=null&&l.autoBind?sn.bound:sn;return c.make_(e,t,r,n)}var m=(u=this.options_)!=null&&u.autoBind?Hn.bound:Hn;return m.make_(e,t,r,n)}var g=((i=this.options_)==null?void 0:i.deep)===!1?Pe.ref:Pe;if(typeof r.value=="function"&&(a=this.options_)!=null&&a.autoBind){var R;r.value=r.value.bind((R=e.proxy_)!=null?R:e.target_)}return g.make_(e,t,r,n)}function Ig(e,t,r,n){var i,a;if(r.get)return He.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:re.safeDescriptors?e.isPlainObject_:!0,set:$r(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 u=((a=this.options_)==null?void 0:a.deep)===!1?Pe.ref:Pe;return u.extend_(e,t,r,n)}function Ag(e,t){_e("'"+this.annotationType_+"' cannot be used as a decorator")}var Sg="observable",$g="observable.ref",kg="observable.shallow",Ug="observable.struct",Wl={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Wl);function Ji(e){return e||Wl}var La=_o(Sg),jg=_o($g,{enhancer:wo}),Ng=_o(kg,{enhancer:ng}),Pg=_o(Ug,{enhancer:ig}),Jl=Nt(La);function Xi(e){return e.deep===!0?pn:e.deep===!1?wo:Cg(e.defaultDecorator)}function Bg(e){var t;return e?(t=e.defaultDecorator)!=null?t:Hl(e):void 0}function Cg(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:pn}function Xl(e,t,r){if(ii(t))return La.decorate_20223_(e,t);if(Ar(t)){dn(e,t,La);return}return cs(e)?e:sr(e)?Pe.object(e,t,r):Array.isArray(e)?Pe.array(e,t):fn(e)?Pe.map(e,t):ni(e)?Pe.set(e,t):typeof e=="object"&&e!==null?e:Pe.box(e,t)}Bl(Xl,Jl);var Rg={box:function(e,t){var r=Ji(t);return new ar(e,Xi(r),r.name,!0,r.equals)},array:function(e,t){var r=Ji(t);return(re.useProxies===!1||r.proxy===!1?Mv:Sv)(e,Xi(r),r.name)},map:function(e,t){var r=Ji(t);return new Of(e,Xi(r),r.name)},set:function(e,t){var r=Ji(t);return new Sf(e,Xi(r),r.name)},object:function(e,t,r){return Rr(function(){return gv(re.useProxies===!1||r?.proxy===!1?yn({},r):Ov({},r),e,t)})},ref:Nt(jg),shallow:Nt(Ng),deep:Jl,struct:Nt(Pg)},Pe=Bl(Xl,Rg),Yl="computed",Mg="computed.struct",Da=ss(Yl),Lg=ss(Mg,{equals:Ze.structural}),He=function(e,t){if(ii(t))return Da.decorate_20223_(e,t);if(Ar(t))return dn(e,t,Da);if(sr(e))return Nt(ss(Yl,e));var r=sr(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new an(r)};Object.assign(He,Da);He.struct=Nt(Lg);var qc,Kc,oo=0,Dg=1,Vg=(qc=(Kc=io(function(){},"name"))==null?void 0:Kc.configurable)!=null?qc:!1,Gc={value:"action",configurable:!0,writable:!1,enumerable:!1};function $r(e,t,r,n){r===void 0&&(r=!1);function i(){return Ql(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},Vg&&(Gc.value=e,jt(i,"name",Gc)),i}function Ql(e,t,r,n,i){var a=Fg(e,t,n,i);try{return r.apply(n,i)}catch(o){throw a.error_=o,o}finally{zg(a)}}function Fg(e,t,r,n){var i=!1,a=0;if(0)var o;var u=re.trackingDerivation,l=!t||!u;yt();var c=re.allowStateChanges;l&&(Br(),c=To(!0));var m=us(!0),g={runAsAction_:l,prevDerivation_:u,prevAllowStateChanges_:c,prevAllowStateReads_:m,notifySpy_:i,startTime_:a,actionId_:Dg++,parentActionId_:oo};return oo=g.actionId_,g}function zg(e){oo!==e.actionId_&&_e(30),oo=e.parentActionId_,e.error_!==void 0&&(re.suppressReactionErrors=!0),xo(e.prevAllowStateChanges_),qn(e.prevAllowStateReads_),mt(),e.runAsAction_&&Lt(e.prevDerivation_),re.suppressReactionErrors=!1}function qg(e,t){var r=To(e);try{return t()}finally{xo(r)}}function To(e){var t=re.allowStateChanges;return re.allowStateChanges=e,t}function xo(e){re.allowStateChanges=e}var Zl;Zl=Symbol.toPrimitive;var ar=function(e){Fl(t,e);function t(n,i,a,o,u){var l;return a===void 0&&(a="ObservableValue"),o===void 0&&(o=!0),u===void 0&&(u=Ze.default),l=e.call(this,a)||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_=a,l.equals=u,l.value_=i(n,void 0,a),l}var r=t.prototype;return r.dehanceValue=function(n){return this.dehancer!==void 0?this.dehancer(n):n},r.set=function(n){var i=this.value_;if(n=this.prepareNewValue_(n),n!==re.UNCHANGED){var a=Ir();this.setNewValue_(n)}},r.prepareNewValue_=function(n){if(Ut(this),pt(this)){var i=ht(this,{object:this,type:Pt,newValue:n});if(!i)return re.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?re.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),Et(this)&&Ot(this,{type:Pt,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return li(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:Pt,newValue:this.value_,oldValue:void 0}),fi(this,n)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return Vl(this.get())},r[Zl]=function(){return this.valueOf()},t}(oi),Kg=cr("ObservableValue",ar),ef;ef=Symbol.toPrimitive;var an=function(){function e(r){this.dependenciesState_=Oe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Oe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new so(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=ao.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||_e(31),this.derivation=r.get,this.name_=r.name||"ComputedValue",r.set&&(this.setter_=$r("ComputedValue-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Ze.structural:Ze.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){ev(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_&&_e(32,this.name_,this.derivation),re.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Va(this)&&(this.warnAboutUntrackedRead_(),yt(),this.value_=this.computeValue_(!1),mt());else if(sf(this),Va(this)){var r=re.trackingContext;this.keepAlive_&&!r&&(re.trackingContext=this),this.trackAndCompute()&&Zg(this),re.trackingContext=r}var n=this.value_;if(eo(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter_&&_e(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter_=!1}}else _e(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===Oe.NOT_TRACKING_,i=this.computeValue_(!0),a=n||eo(r)||eo(i)||!this.equals_(r,i);return a&&(this.value_=i),a},t.computeValue_=function(r){this.isComputing_=!0;var n=To(!1),i;if(r)i=tf(this,this.derivation,this.scope_);else if(re.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(a){i=new so(a)}return xo(n),this.isComputing_=!1,i},t.suspend_=function(){this.keepAlive_||(Fa(this),this.value_=void 0)},t.observe_=function(r,n){var i=this,a=!0,o=void 0;return kr(function(){var u=i.get();if(!a||n){var l=Br();r({observableKind:"computed",debugObjectName:i.name_,type:Pt,object:i,newValue:u,oldValue:o}),Lt(l)}a=!1,o=u})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Vl(this.get())},t[ef]=function(){return this.valueOf()},e}(),si=cr("ComputedValue",an),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 ao;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(ao||(ao={}));var so=function(e){this.cause=void 0,this.cause=e};function eo(e){return e instanceof so}function Va(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=us(!0),r=Br(),n=e.observing_,i=n.length,a=0;a<i;a++){var o=n[a];if(si(o)){if(re.disableErrorBoundaries)o.get();else try{o.get()}catch{return Lt(r),qn(t),!0}if(e.dependenciesState_===Oe.STALE_)return Lt(r),qn(t),!0}}return rf(e),Lt(r),qn(t),!1}}}function Gg(){return re.trackingDerivation!==null}function Ut(e){return;var t}function tf(e,t,r){var n=us(!0);rf(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++re.runId;var i=re.trackingDerivation;re.trackingDerivation=e,re.inBatch++;var a;if(re.disableErrorBoundaries===!0)a=t.call(r);else try{a=t.call(r)}catch(o){a=new so(o)}return re.inBatch--,re.trackingDerivation=i,Hg(e),qn(n),a}function Hg(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Oe.UP_TO_DATE_,i=0,a=e.unboundDepsCount_,o=0;o<a;o++){var u=r[o];u.diffValue_===0&&(u.diffValue_=1,i!==o&&(r[i]=u),i++),u.dependenciesState_>n&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var l=t[a];l.diffValue_===0&&of(l,e),l.diffValue_=0}for(;i--;){var c=r[i];c.diffValue_===1&&(c.diffValue_=0,Qg(c,e))}n!==Oe.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function Fa(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)of(t[r],e);e.dependenciesState_=Oe.NOT_TRACKING_}function De(e){var t=Br();try{return e()}finally{Lt(t)}}function Br(){var e=re.trackingDerivation;return re.trackingDerivation=null,e}function Lt(e){re.trackingDerivation=e}function us(e){var t=re.allowStateReads;return re.allowStateReads=e,t}function qn(e){re.allowStateReads=e}function rf(e){if(e.dependenciesState_!==Oe.UP_TO_DATE_){e.dependenciesState_=Oe.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Oe.UP_TO_DATE_}}var to=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},ro=!0,nf=!1,re=function(){var e=ns();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ro=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new to().version&&(ro=!1),ro?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new to):(setTimeout(function(){nf||_e(35)},1),new to)}();function Wg(){if((re.pendingReactions.length||re.inBatch||re.isRunningReactions)&&_e(36),nf=!0,ro){var e=ns();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),re=new to}}function Jg(){return re}function Xg(e){return e.observers_&&e.observers_.size>0}function Yg(e){return e.observers_}function Qg(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function of(e,t){e.observers_.delete(t),e.observers_.size===0&&af(e)}function af(e){e.isPendingUnobservation_===!1&&(e.isPendingUnobservation_=!0,re.pendingUnobservations.push(e))}function yt(){re.inBatch++}function mt(){if(--re.inBatch===0){cf();for(var e=re.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 an&&r.suspend_())}re.pendingUnobservations=[]}}function sf(e){var t=re.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&re.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),e.isBeingObserved_):(e.observers_.size===0&&re.inBatch>0&&af(e),!1)}function uf(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=Oe.STALE_}))}function Zg(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.POSSIBLY_STALE_?t.dependenciesState_=Oe.STALE_:t.dependenciesState_===Oe.UP_TO_DATE_&&(e.lowestObserverState_=Oe.UP_TO_DATE_)}))}function ev(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_())}))}var Gn=function(){function e(r,n,i,a){r===void 0&&(r="Reaction"),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.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=ao.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=a}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,re.pendingReactions.push(this),cf())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){yt(),this.isScheduled_=!1;var r=re.trackingContext;if(re.trackingContext=this,Va(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(n){this.reportExceptionInDerivation_(n)}}re.trackingContext=r,mt()}},t.track=function(r){if(!this.isDisposed_){yt();var n=Ir(),i;this.isRunning_=!0;var a=re.trackingContext;re.trackingContext=this;var o=tf(this,r,void 0);re.trackingContext=a,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Fa(this),eo(o)&&this.reportExceptionInDerivation_(o.cause),mt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(re.disableErrorBoundaries)throw r;var i="[mobx] uncaught error in '"+this+"'";re.suppressReactionErrors||console.error(i,r),re.globalReactionErrorHandlers.forEach(function(a){return a(r,n)})},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(yt(),Fa(this),mt()))},t.getDisposer_=function(r){var n=this,i=function a(){n.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",a)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[me]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),_f(this,r)},e}(),tv=100,za=function(e){return e()};function cf(){re.inBatch>0||re.isRunningReactions||za(rv)}function rv(){re.isRunningReactions=!0;for(var e=re.pendingReactions,t=0;e.length>0;){++t===tv&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}re.isRunningReactions=!1}var uo=cr("Reaction",Gn);function nv(e){var t=za;za=function(r){return e(function(){return t(r)})}}function Ir(){return!1}function lf(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var ff="action",iv="action.bound",df="autoAction",ov="autoAction.bound",pf="<unnamed action>",qa=ai(ff),av=ai(iv,{bound:!0}),Ka=ai(df,{autoAction:!0}),sv=ai(ov,{autoAction:!0,bound:!0});function hf(e){var t=function(r,n){if(It(r))return $r(r.name||pf,r,e);if(It(n))return $r(r,n,e);if(ii(n))return(e?Ka:qa).decorate_20223_(r,n);if(Ar(n))return dn(r,n,e?Ka:qa);if(Ar(r))return Nt(ai(e?df:ff,{name:r,autoAction:e}))};return t}var Tt=hf(!1);Object.assign(Tt,qa);var Hn=hf(!0);Object.assign(Hn,Ka);Tt.bound=Nt(av);Hn.bound=Nt(sv);function uv(e){return Ql(e.name||pf,!1,e,this,void 0)}function ui(e){return It(e)&&e.isMobxAction===!0}function kr(e,t){var r,n,i,a,o;t===void 0&&(t=is);var u=(r=(n=t)==null?void 0:n.name)!=null?r:"Autorun",l=!t.scheduler&&!t.delay,c;if(l)c=new Gn(u,function(){this.track(R)},t.onError,t.requiresObservable);else{var m=yf(t),g=!1;c=new Gn(u,function(){g||(g=!0,m(function(){g=!1,c.isDisposed_||c.track(R)}))},t.onError,t.requiresObservable)}function R(){e(c)}return(i=t)!=null&&(a=i.signal)!=null&&a.aborted||c.schedule_(),c.getDisposer_((o=t)==null?void 0:o.signal)}var cv=function(e){return e()};function yf(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:cv}function lv(e,t,r){var n,i,a,o;r===void 0&&(r=is);var u=(n=r.name)!=null?n:"Reaction",l=Tt(u,r.onError?fv(r.onError,t):t),c=!r.scheduler&&!r.delay,m=yf(r),g=!0,R=!1,j,q,Z=r.compareStructural?Ze.structural:r.equals||Ze.default,ae=new Gn(u,function(){g||c?B():R||(R=!0,m(B))},r.onError,r.requiresObservable);function B(){if(R=!1,!ae.isDisposed_){var V=!1;ae.track(function(){var H=qg(!1,function(){return e(ae)});V=g||!Z(j,H),q=j,j=H}),(g&&r.fireImmediately||!g&&V)&&l(j,q,ae),g=!1}}return(i=r)!=null&&(a=i.signal)!=null&&a.aborted||ae.schedule_(),ae.getDisposer_((o=r)==null?void 0:o.signal)}function fv(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var dv="onBO",pv="onBUO";function mf(e,t,r){return gf(dv,e,t,r)}function ci(e,t,r){return gf(pv,e,t,r)}function gf(e,t,r,n){var i=typeof n=="function"?Ur(t,r):Ur(t),a=It(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var u=i[o];u&&(u.delete(a),u.size===0&&delete i[o])}}var hv="never",Yi="always",yv="observed";function mv(e){e.isolateGlobalState===!0&&Wg();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(re.useProxies=t===Yi?!0:t===hv?!1:typeof Proxy<"u"),t==="ifavailable"&&(re.verifyProxies=!0),r!==void 0){var n=r===Yi?Yi:r===yv;re.enforceActions=n,re.allowStateChanges=!(n===!0||n===Yi)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(re[i]=!!e[i])}),re.allowStateReads=!re.observableRequiresReaction,e.reactionScheduler&&nv(e.reactionScheduler)}function gv(e,t,r,n){var i=Hm(t);return Rr(function(){var a=yn(e,n)[me];bo(i).forEach(function(o){a.extend_(o,i[o],r&&o in r?r[o]:!0)})}),e}function Wn(e,t){return vf(Ur(e,t))}function vf(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=bv(e.observing_).map(vf)),t}function vv(e,t){return bf(Ur(e,t))}function bf(e){var t={name:e.name_};return Xg(e)&&(t.observers=Array.from(Yg(e)).map(bf)),t}function bv(e){return Array.from(new Set(e))}var wv=0;function wf(){this.message="FLOW_CANCELLED"}wf.prototype=Object.create(Error.prototype);var ka=Kl("flow"),_v=Kl("flow.bound",{bound:!0}),sn=Object.assign(function(e,t){if(ii(t))return ka.decorate_20223_(e,t);if(Ar(t))return dn(e,t,ka);var r=e,n=r.name||"<unnamed flow>",i=function(){var a=this,o=arguments,u=++wv,l=Tt(n+" - runid: "+u+" - init",r).apply(a,o),c,m=void 0,g=new Promise(function(R,j){var q=0;c=j;function Z(V){m=void 0;var H;try{H=Tt(n+" - runid: "+u+" - yield "+q++,l.next).call(l,V)}catch(se){return j(se)}B(H)}function ae(V){m=void 0;var H;try{H=Tt(n+" - runid: "+u+" - yield "+q++,l.throw).call(l,V)}catch(se){return j(se)}B(H)}function B(V){if(It(V?.then)){V.then(B,j);return}return V.done?R(V.value):(m=Promise.resolve(V.value),m.then(Z,ae))}Z(void 0)});return g.cancel=Tt(n+" - runid: "+u+" - cancel",function(){try{m&&Hc(m);var R=l.return(void 0),j=Promise.resolve(R.value);j.then(rn,rn),Hc(j),c(new wf)}catch(q){c(q)}}),g};return i.isMobXFlow=!0,i},ka);sn.bound=Nt(_v);function Hc(e){It(e.cancel)&&e.cancel()}function Jn(e){return e?.isMobXFlow===!0}function Tv(e,t){return e?t!==void 0?un(e)?e[me].values_.has(t):!1:un(e)||!!e[me]||as(e)||uo(e)||si(e):!1}function cs(e){return Tv(e)}function xv(e){if(un(e))return e[me].ownKeys_();_e(38)}function Qi(e,t,r){return e.set(t,r),r}function tn(e,t){if(e==null||typeof e!="object"||e instanceof Date||!cs(e))return e;if(Kg(e)||si(e))return tn(e.get(),t);if(t.has(e))return t.get(e);if(di(e)){var r=Qi(t,e,new Array(e.length));return e.forEach(function(o,u){r[u]=tn(o,t)}),r}if(Cr(e)){var n=Qi(t,e,new Set);return e.forEach(function(o){n.add(tn(o,t))}),n}if(lr(e)){var i=Qi(t,e,new Map);return e.forEach(function(o,u){i.set(u,tn(o,t))}),i}else{var a=Qi(t,e,{});return xv(e).forEach(function(o){ri.propertyIsEnumerable.call(e,o)&&(a[o]=tn(e[o],t))}),a}}function on(e,t){return tn(e,new Map)}function _f(){return;for(var e,t,r,n;n<t;n++)r[n]=arguments[n];var i}function Rt(e,t){t===void 0&&(t=void 0),yt();try{return e.apply(t)}finally{mt()}}function en(e){return e[me]}var Ev={has:function(e,t){return en(e).has_(t)},get:function(e,t){return en(e).get_(t)},set:function(e,t,r){var n;return Ar(t)?(n=en(e).set_(t,r,!0))!=null?n:!0:!1},deleteProperty:function(e,t){var r;return Ar(t)?(r=en(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return(n=en(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return en(e).ownKeys_()},preventExtensions:function(e){_e(13)}};function Ov(e,t){var r,n;return Cl(),e=yn(e,t),(n=(r=e[me]).proxy_)!=null?n:r.proxy_=new Proxy(e,Ev)}function pt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function li(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Rl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function ht(e,t){var r=Br();try{for(var n=[].concat(e.interceptors_||[]),i=0,a=n.length;i<a&&(t=n[i](t),t&&!t.type&&_e(14),!!t);i++);return t}finally{Lt(r)}}function Et(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function fi(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Rl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Ot(e,t){var r=Br(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,a=n.length;i<a;i++)n[i](t);Lt(r)}}function hn(e,t,r){return Rr(function(){var n,i=yn(e,r)[me];(n=t)!=null||(t=Qm(e)),bo(t).forEach(function(a){return i.make_(a,t[a])})}),e}var Wc="splice",Pt="update",Iv=1e4,Av={get:function(e,t){var r=e[me];return t===me?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Mt(co,t)?co[t]:e[t]},set:function(e,t,r){var n=e[me];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){_e(15)}},ls=function(){function e(r,n,i,a){r===void 0&&(r="ObservableArray"),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_=a,this.atom_=new oi(r),this.enhancer_=function(o,u){return n(o,u,"ObservableArray[..]")}}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 li(this,r)},t.observe_=function(r,n){return n===void 0&&(n=!1),n&&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}),fi(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&_e("Out of range: "+r);var n=this.values_.length;if(r!==n)if(r>n){for(var i=new Array(r-n),a=0;a<r-n;a++)i[a]=void 0;this.spliceWithArray_(n,0,i)}else this.spliceWithArray_(r,n-r)},t.updateArrayLength_=function(r,n){r!==this.lastKnownLength_&&_e(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&jf(r+n+1)},t.spliceWithArray_=function(r,n,i){var a=this;Ut(this.atom_);var o=this.values_.length;if(r===void 0?r=0:r>o?r=o:r<0&&(r=Math.max(0,o+r)),arguments.length===1?n=o-r:n==null?n=0:n=Math.max(0,Math.min(n,o-r)),i===void 0&&(i=Ra),pt(this)){var u=ht(this,{object:this.proxy_,type:Wc,index:r,removedCount:n,added:i});if(!u)return Ra;n=u.removedCount,i=u.added}if(i=i.length===0?i:i.map(function(m){return a.enhancer_(m,void 0)}),this.legacyMode_){var l=i.length-n;this.updateArrayLength_(o,l)}var c=this.spliceItemsIntoValues_(r,n,i);return(n!==0||i.length!==0)&&this.notifyArraySplice_(r,i,c),this.dehanceValues_(c)},t.spliceItemsIntoValues_=function(r,n,i){if(i.length<Iv){var a;return(a=this.values_).splice.apply(a,[r,n].concat(i))}else{var o=this.values_.slice(r,r+n),u=this.values_.slice(r+n);this.values_.length+=i.length-n;for(var l=0;l<i.length;l++)this.values_[r+l]=i[l];for(var c=0;c<u.length;c++)this.values_[r+i.length+c]=u[c];return o}},t.notifyArrayChildUpdate_=function(r,n,i){var a=!this.owned_&&Ir(),o=Et(this),u=o||a?{observableKind:"array",object:this.proxy_,type:Pt,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;this.atom_.reportChanged(),o&&Ot(this,u)},t.notifyArraySplice_=function(r,n,i){var a=!this.owned_&&Ir(),o=Et(this),u=o||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Wc,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;this.atom_.reportChanged(),o&&Ot(this,u)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,n){var i=this.values_;if(this.legacyMode_&&r>i.length&&_e(17,r,i.length),r<i.length){Ut(this.atom_);var a=i[r];if(pt(this)){var o=ht(this,{type:Pt,object:this.proxy_,index:r,newValue:n});if(!o)return;n=o.newValue}n=this.enhancer_(n,a);var u=n!==a;u&&(i[r]=n,this.notifyArrayChildUpdate_(r,n,a))}else{for(var l=new Array(r+1-i.length),c=0;c<l.length-1;c++)l[c]=void 0;l[l.length-1]=n,this.spliceWithArray_(i.length,0,l)}},e}();function Sv(e,t,r,n){return r===void 0&&(r="ObservableArray"),n===void 0&&(n=!1),Cl(),Rr(function(){var i=new ls(r,t,n,!1);Ll(i.values_,me,i);var a=new Proxy(i.values_,Av);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var co={clear:function(){return this.splice(0)},replace:function(e){var t=this[me];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];var a=this[me];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(e);case 2:return a.spliceWithArray_(e,t)}return a.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[me].spliceWithArray_(e,t,r)},push:function(){for(var e=this[me],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(e.values_.length,0,r),e.values_.length},pop:function(){return this.splice(Math.max(this[me].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[me],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return re.trackingDerivation&&_e(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){re.trackingDerivation&&_e(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[me],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Ue("at",st);Ue("concat",st);Ue("flat",st);Ue("includes",st);Ue("indexOf",st);Ue("join",st);Ue("lastIndexOf",st);Ue("slice",st);Ue("toString",st);Ue("toLocaleString",st);Ue("toSorted",st);Ue("toSpliced",st);Ue("with",st);Ue("every",At);Ue("filter",At);Ue("find",At);Ue("findIndex",At);Ue("findLast",At);Ue("findLastIndex",At);Ue("flatMap",At);Ue("forEach",At);Ue("map",At);Ue("some",At);Ue("toReversed",At);Ue("reduce",Tf);Ue("reduceRight",Tf);function Ue(e,t){typeof Array.prototype[e]=="function"&&(co[e]=t(e))}function st(e){return function(){var t=this[me];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function At(e){return function(t,r){var n=this,i=this[me];i.atom_.reportObserved();var a=i.dehanceValues_(i.values_);return a[e](function(o,u){return t.call(r,o,u,n)})}}function Tf(e){return function(){var t=this,r=this[me];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(a,o,u){return i(a,o,u,t)},n[e].apply(n,arguments)}}var $v=cr("ObservableArrayAdministration",ls);function di(e){return go(e)&&$v(e[me])}var xf,Ef,kv={},or="add",lo="delete";xf=Symbol.iterator;Ef=Symbol.toStringTag;var Of=function(){function e(r,n,i){var a=this;n===void 0&&(n=pn),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[me]=kv,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,It(Map)||_e(18),Rr(function(){a.keysAtom_=zl("ObservableMap.keys()"),a.data_=new Map,a.hasMap_=new Map,r&&a.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!re.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var a=i=new ar(this.has_(r),wo,"ObservableMap.key?",!1);this.hasMap_.set(r,a),ci(a,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(pt(this)){var a=ht(this,{type:i?Pt:or,object:this,newValue:n,name:r});if(!a)return this;n=a.newValue}return i?this.updateValue_(r,n):this.addValue_(r,n),this},t.delete=function(r){var n=this;if(Ut(this.keysAtom_),pt(this)){var i=ht(this,{type:lo,object:this,name:r});if(!i)return!1}if(this.has_(r)){var a=Ir(),o=Et(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:lo,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return Rt(function(){var l;n.keysAtom_.reportChanged(),(l=n.hasMap_.get(r))==null||l.setNewValue_(!1);var c=n.data_.get(r);c.setNewValue_(void 0),n.data_.delete(r)}),o&&Ot(this,u),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==re.UNCHANGED){var a=Ir(),o=Et(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:Pt,object:this,oldValue:i.value_,name:r,newValue:n}:null;i.setNewValue_(n),o&&Ot(this,u)}},t.addValue_=function(r,n){var i=this;Ut(this.keysAtom_),Rt(function(){var l,c=new ar(n,i.enhancer_,"ObservableMap.key",!1);i.data_.set(r,c),n=c.value_,(l=i.hasMap_.get(r))==null||l.setNewValue_(!0),i.keysAtom_.reportChanged()});var a=Ir(),o=Et(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:or,object:this,name:r,newValue:n}:null;o&&Ot(this,u)},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,n=this.keys();return Xn({next:function(){var i=n.next(),a=i.done,o=i.value;return{done:a,value:a?void 0:r.get(o)}}})},t.entries=function(){var r=this,n=this.keys();return Xn({next:function(){var i=n.next(),a=i.done,o=i.value;return{done:a,value:a?void 0:[o,r.get(o)]}}})},t[xf]=function(){return this.entries()},t.forEach=function(r,n){for(var i=nn(this),a;!(a=i()).done;){var o=a.value,u=o[0],l=o[1];r.call(n,l,u,this)}},t.merge=function(r){var n=this;return lr(r)&&(r=new Map(r)),Rt(function(){sr(r)?Gm(r).forEach(function(i){return n.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var a=i[0],o=i[1];return n.set(a,o)}):fn(r)?(r.constructor!==Map&&_e(19,r),r.forEach(function(i,a){return n.set(a,i)})):r!=null&&_e(20,r)}),this},t.clear=function(){var r=this;Rt(function(){De(function(){for(var n=nn(r.keys()),i;!(i=n()).done;){var a=i.value;r.delete(a)}})})},t.replace=function(r){var n=this;return Rt(function(){for(var i=Uv(r),a=new Map,o=!1,u=nn(n.data_.keys()),l;!(l=u()).done;){var c=l.value;if(!i.has(c)){var m=n.delete(c);if(m)o=!0;else{var g=n.data_.get(c);a.set(c,g)}}}for(var R=nn(i.entries()),j;!(j=R()).done;){var q=j.value,Z=q[0],ae=q[1],B=n.data_.has(Z);if(n.set(Z,ae),n.data_.has(Z)){var V=n.data_.get(Z);a.set(Z,V),B||(o=!0)}}if(!o)if(n.data_.size!==a.size)n.keysAtom_.reportChanged();else for(var H=n.data_.keys(),se=a.keys(),F=H.next(),ue=se.next();!F.done;){if(F.value!==ue.value){n.keysAtom_.reportChanged();break}F=H.next(),ue=se.next()}n.data_=a}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,n){return fi(this,r)},t.intercept_=function(r){return li(this,r)},os(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Ef,get:function(){return"Map"}}]),e}(),lr=cr("ObservableMap",Of);function Uv(e){if(fn(e)||lr(e))return e;if(Array.isArray(e))return new Map(e);if(sr(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return _e(21,e)}var If,Af,jv={};If=Symbol.iterator;Af=Symbol.toStringTag;var Sf=function(){function e(r,n,i){var a=this;n===void 0&&(n=pn),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[me]=jv,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,It(Set)||_e(22),this.enhancer_=function(o,u){return n(o,u,i)},Rr(function(){a.atom_=zl(a.name_),r&&a.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;Rt(function(){De(function(){for(var n=nn(r.data_.values()),i;!(i=n()).done;){var a=i.value;r.delete(a)}})})},t.forEach=function(r,n){for(var i=nn(this),a;!(a=i()).done;){var o=a.value;r.call(n,o,o,this)}},t.add=function(r){var n=this;if(Ut(this.atom_),pt(this)){var i=ht(this,{type:or,object:this,newValue:r});if(!i)return this}if(!this.has(r)){Rt(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var a=!1,o=Et(this),u=o||a?{observableKind:"set",debugObjectName:this.name_,type:or,object:this,newValue:r}:null;o&&Ot(this,u)}return this},t.delete=function(r){var n=this;if(pt(this)){var i=ht(this,{type:lo,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var a=!1,o=Et(this),u=o||a?{observableKind:"set",debugObjectName:this.name_,type:lo,object:this,oldValue:r}:null;return Rt(function(){n.atom_.reportChanged(),n.data_.delete(r)}),o&&Ot(this,u),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=0,n=Array.from(this.keys()),i=Array.from(this.values());return Xn({next:function(){var a=r;return r+=1,a<i.length?{value:[n[a],i[a]],done:!1}:{done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,n=0,i=Array.from(this.data_.values());return Xn({next:function(){return n<i.length?{value:r.dehanceValue_(i[n++]),done:!1}:{done:!0}}})},t.replace=function(r){var n=this;return Cr(r)&&(r=new Set(r)),Rt(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):ni(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&_e("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return fi(this,r)},t.intercept_=function(r){return li(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[If]=function(){return this.values()},os(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Af,get:function(){return"Set"}}]),e}(),Cr=cr("ObservableSet",Sf),Jc=Object.create(null),Xc="remove",$f=function(){function e(r,n,i,a){n===void 0&&(n=new Map),a===void 0&&(a=Eg),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_=a,this.keysAtom_=new oi("ObservableObject.keys"),this.isPlainObject_=sr(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,n){var i=this.values_.get(r);if(i instanceof an)return i.set(n),!0;if(pt(this)){var a=ht(this,{type:Pt,object:this.proxy_||this.target_,name:r,newValue:n});if(!a)return null;n=a.newValue}if(n=i.prepareNewValue_(n),n!==re.UNCHANGED){var o=Et(this),u=!1,l=o||u?{type:Pt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;i.setNewValue_(n),o&&Ot(this,l)}return!0},t.get_=function(r){return re.trackingDerivation&&!Mt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Mt(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,n):i?Reflect.set(this.target_,r,n):(this.target_[r]=n,!0):this.extend_(r,{value:n,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(r){if(!re.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var n=this.pendingKeys_.get(r);return n||(n=new ar(r in this.target_,wo,"ObservableObject.key?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(Zc(this,n,r),!(r in this.target_)){var i;if((i=this.target_[kt])!=null&&i[r])return;_e(1,n.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==ri;){var o=io(a,r);if(o){var u=n.make_(this,r,o,a);if(u===0)return;if(u===1)break}a=Object.getPrototypeOf(a)}Qc(this,n,r)}},t.extend_=function(r,n,i,a){if(a===void 0&&(a=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,n,a);Zc(this,i,r);var o=i.extend_(this,r,n,a);return o&&Qc(this,i,r),o},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),Ut(this.keysAtom_);try{yt();var a=this.delete_(r);if(!a)return a;if(pt(this)){var o=ht(this,{object:this.proxy_||this.target_,name:r,type:or,newValue:n.value});if(!o)return null;var u=o.newValue;n.value!==u&&(n=Sr({},n,{value:u}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else jt(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{mt()}return!0},t.defineObservableProperty_=function(r,n,i,a){a===void 0&&(a=!1),Ut(this.keysAtom_);try{yt();var o=this.delete_(r);if(!o)return o;if(pt(this)){var u=ht(this,{object:this.proxy_||this.target_,name:r,type:or,newValue:n});if(!u)return null;n=u.newValue}var l=Yc(r),c={configurable:re.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:l.get,set:l.set};if(a){if(!Reflect.defineProperty(this.target_,r,c))return!1}else jt(this.target_,r,c);var m=new ar(n,i,"ObservableObject.key",!1);this.values_.set(r,m),this.notifyPropertyAddition_(r,m.value_)}finally{mt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),Ut(this.keysAtom_);try{yt();var a=this.delete_(r);if(!a)return a;if(pt(this)){var o=ht(this,{object:this.proxy_||this.target_,name:r,type:or,newValue:void 0});if(!o)return null}n.name||(n.name="ObservableObject.key"),n.context=this.proxy_||this.target_;var u=Yc(r),l={configurable:re.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(i){if(!Reflect.defineProperty(this.target_,r,l))return!1}else jt(this.target_,r,l);this.values_.set(r,new an(n)),this.notifyPropertyAddition_(r,void 0)}finally{mt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),Ut(this.keysAtom_),!Mt(this.target_,r))return!0;if(pt(this)){var i=ht(this,{object:this.proxy_||this.target_,name:r,type:Xc});if(!i)return null}try{var a,o;yt();var u=Et(this),l=!1,c=this.values_.get(r),m=void 0;if(!c&&(u||l)){var g;m=(g=io(this.target_,r))==null?void 0:g.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(c&&(this.values_.delete(r),c instanceof ar&&(m=c.value_),uf(c)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(o=a.get(r))==null||o.set(r in this.target_),u||l){var R={type:Xc,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:m,name:r};u&&Ot(this,R)}}finally{mt()}return!0},t.observe_=function(r,n){return fi(this,r)},t.intercept_=function(r){return li(this,r)},t.notifyPropertyAddition_=function(r,n){var i,a,o=Et(this),u=!1;if(o||u){var l=o||u?{type:or,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;o&&Ot(this,l)}(i=this.pendingKeys_)==null||(a=i.get(r))==null||a.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),bo(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function yn(e,t){var r;if(Mt(e,me))return e;var n=(r=t?.name)!=null?r:"ObservableObject",i=new $f(e,new Map,String(n),Bg(t));return vo(e,me,i),e}var Nv=cr("ObservableObjectAdministration",$f);function Yc(e){return Jc[e]||(Jc[e]={get:function(){return this[me].getObservablePropValue_(e)},set:function(t){return this[me].setObservablePropValue_(e,t)}})}function un(e){return go(e)?Nv(e[me]):!1}function Qc(e,t,r){var n;(n=e.target_[kt])==null||delete n[r]}function Zc(e,t,r){if(0)var n,i,a}var Pv=Uf(0),Bv=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Ua=0,kf=function(){};function Cv(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Cv(kf,Array.prototype);var fs=function(e,t,r){Fl(n,e);function n(a,o,u,l){var c;return u===void 0&&(u="ObservableArray"),l===void 0&&(l=!1),c=e.call(this)||this,Rr(function(){var m=new ls(u,o,l,!0);m.proxy_=$a(c),Ll($a(c),me,m),a&&a.length&&c.spliceWithArray(0,0,a),Bv&&Object.defineProperty($a(c),"0",Pv)}),c}var i=n.prototype;return i.concat=function(){this[me].atom_.reportObserved();for(var a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];return Array.prototype.concat.apply(this.slice(),o.map(function(l){return di(l)?l.slice():l}))},i[r]=function(){var a=this,o=0;return Xn({next:function(){return o<a.length?{value:a[o++],done:!1}:{done:!0,value:void 0}}})},os(n,[{key:"length",get:function(){return this[me].getArrayLength_()},set:function(a){this[me].setArrayLength_(a)}},{key:t,get:function(){return"Array"}}]),n}(kf,Symbol.toStringTag,Symbol.iterator);Object.entries(co).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&vo(fs.prototype,t,r)});function Uf(e){return{enumerable:!1,configurable:!0,get:function(){return this[me].get_(e)},set:function(t){this[me].set_(e,t)}}}function Rv(e){jt(fs.prototype,""+e,Uf(e))}function jf(e){if(e>Ua){for(var t=Ua;t<e+100;t++)Rv(t);Ua=e}}jf(1e3);function Mv(e,t,r){return new fs(e,t,r)}function Ur(e,t){if(typeof e=="object"&&e!==null){if(di(e))return t!==void 0&&_e(23),e[me].atom_;if(Cr(e))return e.atom_;if(lr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||_e(25,t,Ga(e)),r}if(un(e)){if(!t)return _e(26);var n=e[me].values_.get(t);return n||_e(27,t,Ga(e)),n}if(as(e)||si(e)||uo(e))return e}else if(It(e)&&uo(e[me]))return e[me];_e(28)}function Nf(e,t){if(e||_e(29),t!==void 0)return Nf(Ur(e,t));if(as(e)||si(e)||uo(e)||lr(e)||Cr(e))return e;if(e[me])return e[me];_e(24,e)}function Ga(e,t){var r;if(t!==void 0)r=Ur(e,t);else{if(ui(e))return e.name;un(e)||lr(e)||Cr(e)?r=Nf(e):r=Ur(e)}return r.name_}function Rr(e){var t=Br(),r=To(!0);yt();try{return e()}finally{mt(),xo(r),Lt(t)}}var el=ri.toString;function ds(e,t,r){return r===void 0&&(r=-1),Ha(e,t,r)}function Ha(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 a=typeof e;if(a!=="function"&&a!=="object"&&typeof t!="object")return!1;var o=el.call(e);if(o!==el.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=tl(e),t=tl(t);var u=o==="[object Array]";if(!u){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,c=t.constructor;if(l!==c&&!(It(l)&&l instanceof l&&It(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 m=n.length;m--;)if(n[m]===e)return i[m]===t;if(n.push(e),i.push(t),u){if(m=e.length,m!==t.length)return!1;for(;m--;)if(!Ha(e[m],t[m],r-1,n,i))return!1}else{var g=Object.keys(e),R;if(m=g.length,Object.keys(t).length!==m)return!1;for(;m--;)if(R=g[m],!(Mt(t,R)&&Ha(e[R],t[R],r-1,n,i)))return!1}return n.pop(),i.pop(),!0}function tl(e){return di(e)?e.slice():fn(e)||lr(e)||ni(e)||Cr(e)?Array.from(e.entries()):e}function Xn(e){return e[Symbol.iterator]=Lv,e}function Lv(){return this}["Symbol","Map","Set"].forEach(function(e){var t=ns();typeof t[e]>"u"&&_e("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:lf,extras:{getDebugName:Ga},$mobx:me});function Wa(e){"@babel/helpers - typeof";return Wa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wa(e)}function Pf(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function rl(e){Pf(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Wa(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Dv(e,t){Pf(2,arguments);var r=rl(e),n=rl(t);return r.getTime()<n.getTime()}var Bf=rr(Rm(),1),HO=Bf.default.configure,xt=Bf.default,{WARN:WO,LOG:JO,DEBUG:XO,VERBOSE:nl,ERROR:Vv}=Ie.setup(Ie.DEBUG),Cf=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Rf=(e,t,r="asc")=>Cf(e.ts,t.ts,r);function jr(e,t="asc"){return e.sort((r,n)=>Rf(r,n,t))}var Mf=(e,t)=>Dv(new Date(e.ts),new Date(t.ts));var Lf=(e,t)=>Ze.structural(e,t),ps=e=>{let t=new Map;for(let r of e){if(!r)throw Vv("falsy entry in applogs",e),new Error("falsy entry in applogs");t.set(xt(r),r)}return Array.from(t.values())};function Df(e){return typeof e=="string"&&e.startsWith("?")}function Vf(e){return e.slice(1)}function hs(e,t){let r={};return[Object.entries(e).reduce((n,[i,a])=>{if(Df(a)){let o=Vf(a),u=t[o];u?n[i]=u:r[i]=o}else n[i]=a;return n},{}),r]}function Ff(e,t,r){nl("[matchPartStatic]",e,t,t===r?"===":"!==",r);let n=typeof t=="function"?t(r):Array.isArray(t)&&!Array.isArray(r)?t.includes(r):t===r;return nl("[matchPartStatic] =>",e.startsWith("!")?"!":"",n),e.startsWith("!")?!n:n}var zf=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},il=function(e){return zf(e)/e.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:zf,mean:il,average:il,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;function qf(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();for(let i=0;i<r.length;i++)if(r[i]!==n[i])return!1;return!0}function Kf(){return new Date().toISOString()}var ja=100,{WARN:Fv,LOG:YO,DEBUG:zv,VERBOSE:Qe,ERROR:QO}=Ie.setup(Ie.INFO);mv({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");typeof window=="object"&&(window.getDependencyTree=Wn,window.getObserverTree=vv);Qe.isDisabled||lf(e=>{Qe("[mobx]",e)});var Yn=({caller:e,stream:t,pattern:r})=>`${t?.name?t.name+" | ":""}${e??"caller?"}${r?`{${typeof r=="string"?r:xt(r)}}`:""}`;function qv(e,t){return De(()=>Ze.structural(e.get(),t.get()))}function pi(e,t){return Ze.shallow(e.applogs,t.applogs)}function ys(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(Qe("queryNodesComparer",r,n,i),!Ze.structural(n.variables,i.variables)||!pi(n.logsOfThisNode,i.logsOfThisNode))return!1}return!0}var Kv=0;function Eo(e,{name:t,equals:r}={}){Qe("[observableArrayMap] create",{fnname:e.name,fn:e,name:t,equals:r});let n=`observableArrayMap@${++Kv}{${t}}`,i,a;function o(){u.track(()=>{let c=ja&&performance.now();zv(`[${n}] runAndTrack:`,{name:t??e.name,fn:e}),a=e(),Qe(`[${n}] runAndTrack =>`,a),ja&&performance.now()-c>ja&&Fv(`[${n}] took ${performance.now()-c}ms`)})}let u=new Gn(n,(...c)=>{Qe(`[${n}] reaction.invalidate`,c),o(),uv(()=>{(r??Ze.structural)(i,a)||i.replace(a)})});o(),i=Pe.array(a,{deep:!1,name:t}),Qe(`[${n}] deps of reaction`,Wn(u),"array:",Wn(i),{reaction:u,observableArr:i});let l=ci(i,()=>{Qe("[observableArrayMap] dispose"),u.dispose(),l()});return i}function et(e,t=!1){if(ui(e))throw new Error("computedFnDeepCompare shouldn't be used on actions");let r=!1,n=0,i=typeof t=="boolean"?{keepAlive:t}:t,a=new Map;return function(...o){let u,l=De(()=>o),c=`computedFnDeepCompare(${i.name||e.name}#${++n})${i.argsDebugName?`{${i.argsDebugName(...o)}}`:""}`;for(let[R,j]of a.entries())if(Ze.structural(R,l)){u=j;break}if(u){let R=u.get();return Qe(`[${c}] cache hit`,{untrackedArgs:l,cachedResult:R}),R}if(!i.keepAlive&&!Gg())return!r&&Jg().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),r=!0),e.apply(this,o);Qe(`[${c}] new computation`,{untrackedArgs:l});let m,g=He(()=>(Qe(`[${c}] update->rerun`,De(()=>({args:o})),e),Qe.isDisabled||_f(),m=e.apply(this,o)),{...i,name:c});if(Qe(`[${c}] deps`,Wn(g),{untrackedArgs:l}),a.set(l,g),!i.keepAlive){let R=ci(g,()=>{Qe(`[${c}] dispose`,g),a.delete(l),i.onCleanup&&i.onCleanup(m,...o),m=void 0,R()})}return g.get()}}function Gv(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];a==="("?r+=a+`
|
|
24
|
+
}`:`return ${ge}`;return[...Ce,...Ie,We].join(`
|
|
25
|
+
`)}function qt(...x){let le={language:"javascript"},[I,ge,ne]=x.length===2&&(0,r.IsArray)(x[1])?[x[0],x[1],le]:x.length===2&&!(0,r.IsArray)(x[1])?[x[0],[],x[1]]:x.length===3?[x[0],x[1],x[2]]:x.length===1?[x[0],[],le]:[null,[],le];if(J.language=ne.language,J.variables.clear(),J.functions.clear(),J.instances.clear(),!u.TypeGuard.TSchema(I))throw new q(I);for(let de of ge)if(!u.TypeGuard.TSchema(de))throw new q(de);return be(I,ge,ne)}B.Code=qt;function pr(x,le=[]){let I=qt(x,le,{language:"javascript"}),ge=globalThis.Function("kind","format","hash",I),ne=new Map(J.instances);function de(qe,Xe,Kt){if(!u.TypeRegistry.Has(qe)||!ne.has(Xe))return!1;let Vr=u.TypeRegistry.Get(qe),Fr=ne.get(Xe);return Vr(Fr,Kt)}function Ie(qe,Xe){return u.FormatRegistry.Has(qe)?u.FormatRegistry.Get(qe)(Xe):!1}function Ce(qe){return(0,o.Hash)(qe)}let We=ge(de,Ie,Ce);return new l(x,le,We,I)}B.Compile=pr})(ae||(e.TypeCompiler=ae={}))}),Fm=Le(e=>{"use strict";var t=e&&e.__createBinding||(Object.create?function(i,a,o,u){u===void 0&&(u=o);var l=Object.getOwnPropertyDescriptor(a,o);(!l||("get"in l?!a.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return a[o]}}),Object.defineProperty(i,u,l)}:function(i,a,o,u){u===void 0&&(u=o),i[u]=a[o]}),r=e&&e.__exportStar||function(i,a){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(a,o)&&t(a,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=Mm();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(Vm(),e)});function _e(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(0)var i;throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(r.length?" "+r.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var zm={};function ns(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:zm}var Bl=Object.assign,io=Object.getOwnPropertyDescriptor,jt=Object.defineProperty,ri=Object.prototype,Ra=[];Object.freeze(Ra);var is={};Object.freeze(is);var qm=typeof Proxy<"u",Km=Object.toString();function Cl(){qm||_e("Proxy not available")}function Rl(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var rn=function(){};function At(e){return typeof e=="function"}function Ir(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function go(e){return e!==null&&typeof e=="object"}function sr(e){if(!go(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()===Km}function Ml(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function vo(e,t,r){jt(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function Ll(e,t,r){jt(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function cr(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return go(n)&&n[r]===!0}}function fn(e){return e instanceof Map}function ni(e){return e instanceof Set}var Dl=typeof Object.getOwnPropertySymbols<"u";function Gm(e){var t=Object.keys(e);if(!Dl)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return ri.propertyIsEnumerable.call(e,n)})):t}var bo=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Dl?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Vl(e){return e===null?null:typeof e=="object"?""+e:e}function Lt(e,t){return ri.hasOwnProperty.call(e,t)}var Hm=Object.getOwnPropertyDescriptors||function(e){var t={};return bo(e).forEach(function(r){t[r]=io(e,r)}),t};function Fc(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,Xm(n.key),n)}}function os(e,t,r){return t&&Fc(e.prototype,t),r&&Fc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sr(){return Sr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sr.apply(this,arguments)}function Fl(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ma(e,t)}function Ma(e,t){return Ma=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Ma(e,t)}function $a(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Wm(e,t){if(e){if(typeof e=="string")return zc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zc(e,t)}}function zc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function nn(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=Wm(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.
|
|
26
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jm(e,t){if(typeof e!="object"||e===null)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 Xm(e){var t=Jm(e,"string");return typeof t=="symbol"?t:String(t)}var kt=Symbol("mobx-stored-annotations");function Nt(e){function t(r,n){if(ii(n))return e.decorate_20223_(r,n);dn(r,n,e)}return Object.assign(t,e)}function dn(e,t,r){if(Lt(e,kt)||vo(e,kt,Sr({},e[kt])),0)var n;Ym(e,r,t),ag(r)||(e[kt][t]=r)}function Ym(e,t,r){if(0)var n,i,a}function Qm(e){return Lt(e,kt)||vo(e,kt,Sr({},e[kt])),e[kt]}function ii(e){return typeof e=="object"&&typeof e.kind=="string"}var me=Symbol("mobx administration"),oi=function(){function e(r){r===void 0&&(r="Atom"),this.name_=void 0,this.isPendingUnobservation_=!1,this.isBeingObserved_=!1,this.observers_=new Set,this.diffValue_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Oe.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(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return sf(this)},t.reportChanged=function(){yt(),uf(this),mt()},t.toString=function(){return this.name_},e}(),as=cr("Atom",oi);function zl(e,t,r){t===void 0&&(t=rn),r===void 0&&(r=rn);var n=new oi(e);return t!==rn&&mf(n,t),r!==rn&&ci(n,r),n}function Zm(e,t){return e===t}function eg(e,t){return ds(e,t)}function tg(e,t){return ds(e,t,1)}function rg(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ze={identity:Zm,structural:eg,default:rg,shallow:tg};function pn(e,t,r){return cs(e)?e:Array.isArray(e)?Pe.array(e,{name:r}):sr(e)?Pe.object(e,void 0,{name:r}):fn(e)?Pe.map(e,{name:r}):ni(e)?Pe.set(e,{name:r}):typeof e=="function"&&!ui(e)&&!Jn(e)?Ml(e)?sn(e):Hn(r,e):e}function ng(e,t,r){if(e==null||un(e)||di(e)||lr(e)||Cr(e))return e;if(Array.isArray(e))return Pe.array(e,{name:r,deep:!1});if(sr(e))return Pe.object(e,void 0,{name:r,deep:!1});if(fn(e))return Pe.map(e,{name:r,deep:!1});if(ni(e))return Pe.set(e,{name:r,deep:!1})}function wo(e){return e}function ig(e,t){return ds(e,t)?t:e}var og="override";function ag(e){return e.annotationType_===og}function ai(e,t){return{annotationType_:e,options_:t,make_:sg,extend_:ug,decorate_20223_:cg}}function sg(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(ui(r.value))return 1;var a=ql(e,this,t,r,!1);return jt(n,t,a),2}function ug(e,t,r,n){var i=ql(e,this,t,r);return e.defineProperty_(t,i,n)}function cg(e,t){var r=t.kind,n=t.name,i=t.addInitializer,a=this,o=function(l){var c,m,g,R;return $r((c=(m=a.options_)==null?void 0:m.name)!=null?c:n.toString(),l,(g=(R=a.options_)==null?void 0:R.autoAction)!=null?g:!1)};if(r=="field"){i(function(){dn(this,n,a)});return}if(r=="method"){var u;return ui(e)||(e=o(e)),(u=this.options_)!=null&&u.bound&&i(function(){var l=this,c=l[n].bind(l);c.isMobxAction=!0,l[n]=c}),e}_e("Cannot apply '"+a.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
|
|
27
|
+
'`+a.annotationType_+"' can only be used on properties with a function value."))}function lg(e,t,r,n){var i=t.annotationType_,a=n.value}function ql(e,t,r,n,i){var a,o,u,l,c,m,g;i===void 0&&(i=re.safeDescriptors),lg(e,t,r,n);var R=n.value;if((a=t.options_)!=null&&a.bound){var j;R=R.bind((j=e.proxy_)!=null?j:e.target_)}return{value:$r((o=(u=t.options_)==null?void 0:u.name)!=null?o:r.toString(),R,(l=(c=t.options_)==null?void 0:c.autoAction)!=null?l:!1,(m=t.options_)!=null&&m.bound?(g=e.proxy_)!=null?g:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Kl(e,t){return{annotationType_:e,options_:t,make_:fg,extend_:dg,decorate_20223_:pg}}function fg(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&&(!Lt(e.target_,t)||!Jn(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(Jn(r.value))return 1;var a=Gl(e,this,t,r,!1,!1);return jt(n,t,a),2}function dg(e,t,r,n){var i,a=Gl(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,a,n)}function pg(e,t){var r,n=t.name,i=t.addInitializer;return Jn(e)||(e=sn(e)),(r=this.options_)!=null&&r.bound&&i(function(){var a=this,o=a[n].bind(a);o.isMobXFlow=!0,a[n]=o}),e}function hg(e,t,r,n){var i=t.annotationType_,a=n.value}function Gl(e,t,r,n,i,a){a===void 0&&(a=re.safeDescriptors),hg(e,t,r,n);var o=n.value;if(Jn(o)||(o=sn(o)),i){var u;o=o.bind((u=e.proxy_)!=null?u:e.target_),o.isMobXFlow=!0}return{value:o,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function ss(e,t){return{annotationType_:e,options_:t,make_:yg,extend_:mg,decorate_20223_:gg}}function yg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function mg(e,t,r,n){return vg(e,this,t,r),e.defineComputedProperty_(t,Sr({},this.options_,{get:r.get,set:r.set}),n)}function gg(e,t){var r=this,n=t.name,i=t.addInitializer;return i(function(){var a=yn(this)[me],o=Sr({},r.options_,{get:e,context:this});o.name||(o.name="ObservableObject."+n.toString()),a.values_.set(n,new an(o))}),function(){return this[me].getObservablePropValue_(n)}}function vg(e,t,r,n){var i=t.annotationType_,a=n.get}function _o(e,t){return{annotationType_:e,options_:t,make_:bg,extend_:wg,decorate_20223_:_g}}function bg(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function wg(e,t,r,n){var i,a;return Tg(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(a=this.options_)==null?void 0:a.enhancer)!=null?i:pn,n)}function _g(e,t){var r=this,n=t.kind,i=t.name,a=new WeakSet;function o(u,l){var c,m,g=yn(u)[me],R=new ar(l,(c=(m=r.options_)==null?void 0:m.enhancer)!=null?c:pn,"ObservableObject."+i.toString(),!1);g.values_.set(i,R),a.add(u)}if(n=="accessor")return{get:function(){return a.has(this)||o(this,e.get.call(this)),this[me].getObservablePropValue_(i)},set:function(u){return a.has(this)||o(this,u),this[me].setObservablePropValue_(i,u)},init:function(u){return a.has(this)||o(this,u),u}}}function Tg(e,t,r,n){var i=t.annotationType_}var xg="true",Eg=Hl();function Hl(e){return{annotationType_:xg,options_:e,make_:Og,extend_:Ag,decorate_20223_:Ig}}function Og(e,t,r,n){var i,a;if(r.get)return He.make_(e,t,r,n);if(r.set){var o=$r(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:re.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(jt(n,t,{configurable:!0,set:o}),2)}if(n!==e.target_&&typeof r.value=="function"){var u;if(Ml(r.value)){var l,c=(l=this.options_)!=null&&l.autoBind?sn.bound:sn;return c.make_(e,t,r,n)}var m=(u=this.options_)!=null&&u.autoBind?Hn.bound:Hn;return m.make_(e,t,r,n)}var g=((i=this.options_)==null?void 0:i.deep)===!1?Pe.ref:Pe;if(typeof r.value=="function"&&(a=this.options_)!=null&&a.autoBind){var R;r.value=r.value.bind((R=e.proxy_)!=null?R:e.target_)}return g.make_(e,t,r,n)}function Ag(e,t,r,n){var i,a;if(r.get)return He.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:re.safeDescriptors?e.isPlainObject_:!0,set:$r(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 u=((a=this.options_)==null?void 0:a.deep)===!1?Pe.ref:Pe;return u.extend_(e,t,r,n)}function Ig(e,t){_e("'"+this.annotationType_+"' cannot be used as a decorator")}var Sg="observable",$g="observable.ref",kg="observable.shallow",Ug="observable.struct",Wl={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Wl);function Ji(e){return e||Wl}var La=_o(Sg),jg=_o($g,{enhancer:wo}),Ng=_o(kg,{enhancer:ng}),Pg=_o(Ug,{enhancer:ig}),Jl=Nt(La);function Xi(e){return e.deep===!0?pn:e.deep===!1?wo:Cg(e.defaultDecorator)}function Bg(e){var t;return e?(t=e.defaultDecorator)!=null?t:Hl(e):void 0}function Cg(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:pn}function Xl(e,t,r){if(ii(t))return La.decorate_20223_(e,t);if(Ir(t)){dn(e,t,La);return}return cs(e)?e:sr(e)?Pe.object(e,t,r):Array.isArray(e)?Pe.array(e,t):fn(e)?Pe.map(e,t):ni(e)?Pe.set(e,t):typeof e=="object"&&e!==null?e:Pe.box(e,t)}Bl(Xl,Jl);var Rg={box:function(e,t){var r=Ji(t);return new ar(e,Xi(r),r.name,!0,r.equals)},array:function(e,t){var r=Ji(t);return(re.useProxies===!1||r.proxy===!1?Mv:Sv)(e,Xi(r),r.name)},map:function(e,t){var r=Ji(t);return new Of(e,Xi(r),r.name)},set:function(e,t){var r=Ji(t);return new Sf(e,Xi(r),r.name)},object:function(e,t,r){return Rr(function(){return gv(re.useProxies===!1||r?.proxy===!1?yn({},r):Ov({},r),e,t)})},ref:Nt(jg),shallow:Nt(Ng),deep:Jl,struct:Nt(Pg)},Pe=Bl(Xl,Rg),Yl="computed",Mg="computed.struct",Da=ss(Yl),Lg=ss(Mg,{equals:Ze.structural}),He=function(e,t){if(ii(t))return Da.decorate_20223_(e,t);if(Ir(t))return dn(e,t,Da);if(sr(e))return Nt(ss(Yl,e));var r=sr(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new an(r)};Object.assign(He,Da);He.struct=Nt(Lg);var qc,Kc,oo=0,Dg=1,Vg=(qc=(Kc=io(function(){},"name"))==null?void 0:Kc.configurable)!=null?qc:!1,Gc={value:"action",configurable:!0,writable:!1,enumerable:!1};function $r(e,t,r,n){r===void 0&&(r=!1);function i(){return Ql(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},Vg&&(Gc.value=e,jt(i,"name",Gc)),i}function Ql(e,t,r,n,i){var a=Fg(e,t,n,i);try{return r.apply(n,i)}catch(o){throw a.error_=o,o}finally{zg(a)}}function Fg(e,t,r,n){var i=!1,a=0;if(0)var o;var u=re.trackingDerivation,l=!t||!u;yt();var c=re.allowStateChanges;l&&(Br(),c=To(!0));var m=us(!0),g={runAsAction_:l,prevDerivation_:u,prevAllowStateChanges_:c,prevAllowStateReads_:m,notifySpy_:i,startTime_:a,actionId_:Dg++,parentActionId_:oo};return oo=g.actionId_,g}function zg(e){oo!==e.actionId_&&_e(30),oo=e.parentActionId_,e.error_!==void 0&&(re.suppressReactionErrors=!0),xo(e.prevAllowStateChanges_),qn(e.prevAllowStateReads_),mt(),e.runAsAction_&&Dt(e.prevDerivation_),re.suppressReactionErrors=!1}function qg(e,t){var r=To(e);try{return t()}finally{xo(r)}}function To(e){var t=re.allowStateChanges;return re.allowStateChanges=e,t}function xo(e){re.allowStateChanges=e}var Zl;Zl=Symbol.toPrimitive;var ar=function(e){Fl(t,e);function t(n,i,a,o,u){var l;return a===void 0&&(a="ObservableValue"),o===void 0&&(o=!0),u===void 0&&(u=Ze.default),l=e.call(this,a)||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_=a,l.equals=u,l.value_=i(n,void 0,a),l}var r=t.prototype;return r.dehanceValue=function(n){return this.dehancer!==void 0?this.dehancer(n):n},r.set=function(n){var i=this.value_;if(n=this.prepareNewValue_(n),n!==re.UNCHANGED){var a=Ar();this.setNewValue_(n)}},r.prepareNewValue_=function(n){if(Ut(this),pt(this)){var i=ht(this,{object:this,type:Pt,newValue:n});if(!i)return re.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?re.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),Et(this)&&Ot(this,{type:Pt,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return li(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:Pt,newValue:this.value_,oldValue:void 0}),fi(this,n)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return Vl(this.get())},r[Zl]=function(){return this.valueOf()},t}(oi),Kg=cr("ObservableValue",ar),ef;ef=Symbol.toPrimitive;var an=function(){function e(r){this.dependenciesState_=Oe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.isBeingObserved_=!1,this.isPendingUnobservation_=!1,this.observers_=new Set,this.diffValue_=0,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Oe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new so(null),this.name_=void 0,this.triggeredBy_=void 0,this.isComputing_=!1,this.isRunningSetter_=!1,this.derivation=void 0,this.setter_=void 0,this.isTracing_=ao.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||_e(31),this.derivation=r.get,this.name_=r.name||"ComputedValue",r.set&&(this.setter_=$r("ComputedValue-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Ze.structural:Ze.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){ev(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_&&_e(32,this.name_,this.derivation),re.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Va(this)&&(this.warnAboutUntrackedRead_(),yt(),this.value_=this.computeValue_(!1),mt());else if(sf(this),Va(this)){var r=re.trackingContext;this.keepAlive_&&!r&&(re.trackingContext=this),this.trackAndCompute()&&Zg(this),re.trackingContext=r}var n=this.value_;if(eo(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter_&&_e(33,this.name_),this.isRunningSetter_=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter_=!1}}else _e(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===Oe.NOT_TRACKING_,i=this.computeValue_(!0),a=n||eo(r)||eo(i)||!this.equals_(r,i);return a&&(this.value_=i),a},t.computeValue_=function(r){this.isComputing_=!0;var n=To(!1),i;if(r)i=tf(this,this.derivation,this.scope_);else if(re.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(a){i=new so(a)}return xo(n),this.isComputing_=!1,i},t.suspend_=function(){this.keepAlive_||(Fa(this),this.value_=void 0)},t.observe_=function(r,n){var i=this,a=!0,o=void 0;return kr(function(){var u=i.get();if(!a||n){var l=Br();r({observableKind:"computed",debugObjectName:i.name_,type:Pt,object:i,newValue:u,oldValue:o}),Dt(l)}a=!1,o=u})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Vl(this.get())},t[ef]=function(){return this.valueOf()},e}(),si=cr("ComputedValue",an),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 ao;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(ao||(ao={}));var so=function(e){this.cause=void 0,this.cause=e};function eo(e){return e instanceof so}function Va(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=us(!0),r=Br(),n=e.observing_,i=n.length,a=0;a<i;a++){var o=n[a];if(si(o)){if(re.disableErrorBoundaries)o.get();else try{o.get()}catch{return Dt(r),qn(t),!0}if(e.dependenciesState_===Oe.STALE_)return Dt(r),qn(t),!0}}return rf(e),Dt(r),qn(t),!1}}}function Gg(){return re.trackingDerivation!==null}function Ut(e){return;var t}function tf(e,t,r){var n=us(!0);rf(e),e.newObserving_=new Array(e.observing_.length+100),e.unboundDepsCount_=0,e.runId_=++re.runId;var i=re.trackingDerivation;re.trackingDerivation=e,re.inBatch++;var a;if(re.disableErrorBoundaries===!0)a=t.call(r);else try{a=t.call(r)}catch(o){a=new so(o)}return re.inBatch--,re.trackingDerivation=i,Hg(e),qn(n),a}function Hg(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Oe.UP_TO_DATE_,i=0,a=e.unboundDepsCount_,o=0;o<a;o++){var u=r[o];u.diffValue_===0&&(u.diffValue_=1,i!==o&&(r[i]=u),i++),u.dependenciesState_>n&&(n=u.dependenciesState_)}for(r.length=i,e.newObserving_=null,a=t.length;a--;){var l=t[a];l.diffValue_===0&&of(l,e),l.diffValue_=0}for(;i--;){var c=r[i];c.diffValue_===1&&(c.diffValue_=0,Qg(c,e))}n!==Oe.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function Fa(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)of(t[r],e);e.dependenciesState_=Oe.NOT_TRACKING_}function De(e){var t=Br();try{return e()}finally{Dt(t)}}function Br(){var e=re.trackingDerivation;return re.trackingDerivation=null,e}function Dt(e){re.trackingDerivation=e}function us(e){var t=re.allowStateReads;return re.allowStateReads=e,t}function qn(e){re.allowStateReads=e}function rf(e){if(e.dependenciesState_!==Oe.UP_TO_DATE_){e.dependenciesState_=Oe.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Oe.UP_TO_DATE_}}var to=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},ro=!0,nf=!1,re=function(){var e=ns();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ro=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new to().version&&(ro=!1),ro?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new to):(setTimeout(function(){nf||_e(35)},1),new to)}();function Wg(){if((re.pendingReactions.length||re.inBatch||re.isRunningReactions)&&_e(36),nf=!0,ro){var e=ns();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),re=new to}}function Jg(){return re}function Xg(e){return e.observers_&&e.observers_.size>0}function Yg(e){return e.observers_}function Qg(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function of(e,t){e.observers_.delete(t),e.observers_.size===0&&af(e)}function af(e){e.isPendingUnobservation_===!1&&(e.isPendingUnobservation_=!0,re.pendingUnobservations.push(e))}function yt(){re.inBatch++}function mt(){if(--re.inBatch===0){cf();for(var e=re.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 an&&r.suspend_())}re.pendingUnobservations=[]}}function sf(e){var t=re.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved_&&re.trackingContext&&(e.isBeingObserved_=!0,e.onBO())),e.isBeingObserved_):(e.observers_.size===0&&re.inBatch>0&&af(e),!1)}function uf(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=Oe.STALE_}))}function Zg(e){e.lowestObserverState_!==Oe.STALE_&&(e.lowestObserverState_=Oe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Oe.POSSIBLY_STALE_?t.dependenciesState_=Oe.STALE_:t.dependenciesState_===Oe.UP_TO_DATE_&&(e.lowestObserverState_=Oe.UP_TO_DATE_)}))}function ev(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_())}))}var Gn=function(){function e(r,n,i,a){r===void 0&&(r="Reaction"),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.diffValue_=0,this.runId_=0,this.unboundDepsCount_=0,this.isDisposed_=!1,this.isScheduled_=!1,this.isTrackPending_=!1,this.isRunning_=!1,this.isTracing_=ao.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=a}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled_||(this.isScheduled_=!0,re.pendingReactions.push(this),cf())},t.isScheduled=function(){return this.isScheduled_},t.runReaction_=function(){if(!this.isDisposed_){yt(),this.isScheduled_=!1;var r=re.trackingContext;if(re.trackingContext=this,Va(this)){this.isTrackPending_=!0;try{this.onInvalidate_()}catch(n){this.reportExceptionInDerivation_(n)}}re.trackingContext=r,mt()}},t.track=function(r){if(!this.isDisposed_){yt();var n=Ar(),i;this.isRunning_=!0;var a=re.trackingContext;re.trackingContext=this;var o=tf(this,r,void 0);re.trackingContext=a,this.isRunning_=!1,this.isTrackPending_=!1,this.isDisposed_&&Fa(this),eo(o)&&this.reportExceptionInDerivation_(o.cause),mt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(re.disableErrorBoundaries)throw r;var i="[mobx] uncaught error in '"+this+"'";re.suppressReactionErrors||console.error(i,r),re.globalReactionErrorHandlers.forEach(function(a){return a(r,n)})},t.dispose=function(){this.isDisposed_||(this.isDisposed_=!0,this.isRunning_||(yt(),Fa(this),mt()))},t.getDisposer_=function(r){var n=this,i=function a(){n.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",a)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[me]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),_f(this,r)},e}(),tv=100,za=function(e){return e()};function cf(){re.inBatch>0||re.isRunningReactions||za(rv)}function rv(){re.isRunningReactions=!0;for(var e=re.pendingReactions,t=0;e.length>0;){++t===tv&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}re.isRunningReactions=!1}var uo=cr("Reaction",Gn);function nv(e){var t=za;za=function(r){return e(function(){return t(r)})}}function Ar(){return!1}function lf(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var ff="action",iv="action.bound",df="autoAction",ov="autoAction.bound",pf="<unnamed action>",qa=ai(ff),av=ai(iv,{bound:!0}),Ka=ai(df,{autoAction:!0}),sv=ai(ov,{autoAction:!0,bound:!0});function hf(e){var t=function(r,n){if(At(r))return $r(r.name||pf,r,e);if(At(n))return $r(r,n,e);if(ii(n))return(e?Ka:qa).decorate_20223_(r,n);if(Ir(n))return dn(r,n,e?Ka:qa);if(Ir(r))return Nt(ai(e?df:ff,{name:r,autoAction:e}))};return t}var Tt=hf(!1);Object.assign(Tt,qa);var Hn=hf(!0);Object.assign(Hn,Ka);Tt.bound=Nt(av);Hn.bound=Nt(sv);function uv(e){return Ql(e.name||pf,!1,e,this,void 0)}function ui(e){return At(e)&&e.isMobxAction===!0}function kr(e,t){var r,n,i,a,o;t===void 0&&(t=is);var u=(r=(n=t)==null?void 0:n.name)!=null?r:"Autorun",l=!t.scheduler&&!t.delay,c;if(l)c=new Gn(u,function(){this.track(R)},t.onError,t.requiresObservable);else{var m=yf(t),g=!1;c=new Gn(u,function(){g||(g=!0,m(function(){g=!1,c.isDisposed_||c.track(R)}))},t.onError,t.requiresObservable)}function R(){e(c)}return(i=t)!=null&&(a=i.signal)!=null&&a.aborted||c.schedule_(),c.getDisposer_((o=t)==null?void 0:o.signal)}var cv=function(e){return e()};function yf(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:cv}function lv(e,t,r){var n,i,a,o;r===void 0&&(r=is);var u=(n=r.name)!=null?n:"Reaction",l=Tt(u,r.onError?fv(r.onError,t):t),c=!r.scheduler&&!r.delay,m=yf(r),g=!0,R=!1,j,q,Z=r.compareStructural?Ze.structural:r.equals||Ze.default,ae=new Gn(u,function(){g||c?B():R||(R=!0,m(B))},r.onError,r.requiresObservable);function B(){if(R=!1,!ae.isDisposed_){var V=!1;ae.track(function(){var H=qg(!1,function(){return e(ae)});V=g||!Z(j,H),q=j,j=H}),(g&&r.fireImmediately||!g&&V)&&l(j,q,ae),g=!1}}return(i=r)!=null&&(a=i.signal)!=null&&a.aborted||ae.schedule_(),ae.getDisposer_((o=r)==null?void 0:o.signal)}function fv(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var dv="onBO",pv="onBUO";function mf(e,t,r){return gf(dv,e,t,r)}function ci(e,t,r){return gf(pv,e,t,r)}function gf(e,t,r,n){var i=typeof n=="function"?Ur(t,r):Ur(t),a=At(n)?n:r,o=e+"L";return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var u=i[o];u&&(u.delete(a),u.size===0&&delete i[o])}}var hv="never",Yi="always",yv="observed";function mv(e){e.isolateGlobalState===!0&&Wg();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(re.useProxies=t===Yi?!0:t===hv?!1:typeof Proxy<"u"),t==="ifavailable"&&(re.verifyProxies=!0),r!==void 0){var n=r===Yi?Yi:r===yv;re.enforceActions=n,re.allowStateChanges=!(n===!0||n===Yi)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(re[i]=!!e[i])}),re.allowStateReads=!re.observableRequiresReaction,e.reactionScheduler&&nv(e.reactionScheduler)}function gv(e,t,r,n){var i=Hm(t);return Rr(function(){var a=yn(e,n)[me];bo(i).forEach(function(o){a.extend_(o,i[o],r&&o in r?r[o]:!0)})}),e}function Wn(e,t){return vf(Ur(e,t))}function vf(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=bv(e.observing_).map(vf)),t}function vv(e,t){return bf(Ur(e,t))}function bf(e){var t={name:e.name_};return Xg(e)&&(t.observers=Array.from(Yg(e)).map(bf)),t}function bv(e){return Array.from(new Set(e))}var wv=0;function wf(){this.message="FLOW_CANCELLED"}wf.prototype=Object.create(Error.prototype);var ka=Kl("flow"),_v=Kl("flow.bound",{bound:!0}),sn=Object.assign(function(e,t){if(ii(t))return ka.decorate_20223_(e,t);if(Ir(t))return dn(e,t,ka);var r=e,n=r.name||"<unnamed flow>",i=function(){var a=this,o=arguments,u=++wv,l=Tt(n+" - runid: "+u+" - init",r).apply(a,o),c,m=void 0,g=new Promise(function(R,j){var q=0;c=j;function Z(V){m=void 0;var H;try{H=Tt(n+" - runid: "+u+" - yield "+q++,l.next).call(l,V)}catch(se){return j(se)}B(H)}function ae(V){m=void 0;var H;try{H=Tt(n+" - runid: "+u+" - yield "+q++,l.throw).call(l,V)}catch(se){return j(se)}B(H)}function B(V){if(At(V?.then)){V.then(B,j);return}return V.done?R(V.value):(m=Promise.resolve(V.value),m.then(Z,ae))}Z(void 0)});return g.cancel=Tt(n+" - runid: "+u+" - cancel",function(){try{m&&Hc(m);var R=l.return(void 0),j=Promise.resolve(R.value);j.then(rn,rn),Hc(j),c(new wf)}catch(q){c(q)}}),g};return i.isMobXFlow=!0,i},ka);sn.bound=Nt(_v);function Hc(e){At(e.cancel)&&e.cancel()}function Jn(e){return e?.isMobXFlow===!0}function Tv(e,t){return e?t!==void 0?un(e)?e[me].values_.has(t):!1:un(e)||!!e[me]||as(e)||uo(e)||si(e):!1}function cs(e){return Tv(e)}function xv(e){if(un(e))return e[me].ownKeys_();_e(38)}function Qi(e,t,r){return e.set(t,r),r}function tn(e,t){if(e==null||typeof e!="object"||e instanceof Date||!cs(e))return e;if(Kg(e)||si(e))return tn(e.get(),t);if(t.has(e))return t.get(e);if(di(e)){var r=Qi(t,e,new Array(e.length));return e.forEach(function(o,u){r[u]=tn(o,t)}),r}if(Cr(e)){var n=Qi(t,e,new Set);return e.forEach(function(o){n.add(tn(o,t))}),n}if(lr(e)){var i=Qi(t,e,new Map);return e.forEach(function(o,u){i.set(u,tn(o,t))}),i}else{var a=Qi(t,e,{});return xv(e).forEach(function(o){ri.propertyIsEnumerable.call(e,o)&&(a[o]=tn(e[o],t))}),a}}function on(e,t){return tn(e,new Map)}function _f(){return;for(var e,t,r,n;n<t;n++)r[n]=arguments[n];var i}function Mt(e,t){t===void 0&&(t=void 0),yt();try{return e.apply(t)}finally{mt()}}function en(e){return e[me]}var Ev={has:function(e,t){return en(e).has_(t)},get:function(e,t){return en(e).get_(t)},set:function(e,t,r){var n;return Ir(t)?(n=en(e).set_(t,r,!0))!=null?n:!0:!1},deleteProperty:function(e,t){var r;return Ir(t)?(r=en(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return(n=en(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return en(e).ownKeys_()},preventExtensions:function(e){_e(13)}};function Ov(e,t){var r,n;return Cl(),e=yn(e,t),(n=(r=e[me]).proxy_)!=null?n:r.proxy_=new Proxy(e,Ev)}function pt(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function li(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),Rl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function ht(e,t){var r=Br();try{for(var n=[].concat(e.interceptors_||[]),i=0,a=n.length;i<a&&(t=n[i](t),t&&!t.type&&_e(14),!!t);i++);return t}finally{Dt(r)}}function Et(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function fi(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),Rl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Ot(e,t){var r=Br(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,a=n.length;i<a;i++)n[i](t);Dt(r)}}function hn(e,t,r){return Rr(function(){var n,i=yn(e,r)[me];(n=t)!=null||(t=Qm(e)),bo(t).forEach(function(a){return i.make_(a,t[a])})}),e}var Wc="splice",Pt="update",Av=1e4,Iv={get:function(e,t){var r=e[me];return t===me?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Lt(co,t)?co[t]:e[t]},set:function(e,t,r){var n=e[me];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){_e(15)}},ls=function(){function e(r,n,i,a){r===void 0&&(r="ObservableArray"),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_=a,this.atom_=new oi(r),this.enhancer_=function(o,u){return n(o,u,"ObservableArray[..]")}}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 li(this,r)},t.observe_=function(r,n){return n===void 0&&(n=!1),n&&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}),fi(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&_e("Out of range: "+r);var n=this.values_.length;if(r!==n)if(r>n){for(var i=new Array(r-n),a=0;a<r-n;a++)i[a]=void 0;this.spliceWithArray_(n,0,i)}else this.spliceWithArray_(r,n-r)},t.updateArrayLength_=function(r,n){r!==this.lastKnownLength_&&_e(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&jf(r+n+1)},t.spliceWithArray_=function(r,n,i){var a=this;Ut(this.atom_);var o=this.values_.length;if(r===void 0?r=0:r>o?r=o:r<0&&(r=Math.max(0,o+r)),arguments.length===1?n=o-r:n==null?n=0:n=Math.max(0,Math.min(n,o-r)),i===void 0&&(i=Ra),pt(this)){var u=ht(this,{object:this.proxy_,type:Wc,index:r,removedCount:n,added:i});if(!u)return Ra;n=u.removedCount,i=u.added}if(i=i.length===0?i:i.map(function(m){return a.enhancer_(m,void 0)}),this.legacyMode_){var l=i.length-n;this.updateArrayLength_(o,l)}var c=this.spliceItemsIntoValues_(r,n,i);return(n!==0||i.length!==0)&&this.notifyArraySplice_(r,i,c),this.dehanceValues_(c)},t.spliceItemsIntoValues_=function(r,n,i){if(i.length<Av){var a;return(a=this.values_).splice.apply(a,[r,n].concat(i))}else{var o=this.values_.slice(r,r+n),u=this.values_.slice(r+n);this.values_.length+=i.length-n;for(var l=0;l<i.length;l++)this.values_[r+l]=i[l];for(var c=0;c<u.length;c++)this.values_[r+i.length+c]=u[c];return o}},t.notifyArrayChildUpdate_=function(r,n,i){var a=!this.owned_&&Ar(),o=Et(this),u=o||a?{observableKind:"array",object:this.proxy_,type:Pt,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;this.atom_.reportChanged(),o&&Ot(this,u)},t.notifyArraySplice_=function(r,n,i){var a=!this.owned_&&Ar(),o=Et(this),u=o||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Wc,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;this.atom_.reportChanged(),o&&Ot(this,u)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,n){var i=this.values_;if(this.legacyMode_&&r>i.length&&_e(17,r,i.length),r<i.length){Ut(this.atom_);var a=i[r];if(pt(this)){var o=ht(this,{type:Pt,object:this.proxy_,index:r,newValue:n});if(!o)return;n=o.newValue}n=this.enhancer_(n,a);var u=n!==a;u&&(i[r]=n,this.notifyArrayChildUpdate_(r,n,a))}else{for(var l=new Array(r+1-i.length),c=0;c<l.length-1;c++)l[c]=void 0;l[l.length-1]=n,this.spliceWithArray_(i.length,0,l)}},e}();function Sv(e,t,r,n){return r===void 0&&(r="ObservableArray"),n===void 0&&(n=!1),Cl(),Rr(function(){var i=new ls(r,t,n,!1);Ll(i.values_,me,i);var a=new Proxy(i.values_,Iv);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var co={clear:function(){return this.splice(0)},replace:function(e){var t=this[me];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];var a=this[me];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(e);case 2:return a.spliceWithArray_(e,t)}return a.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[me].spliceWithArray_(e,t,r)},push:function(){for(var e=this[me],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(e.values_.length,0,r),e.values_.length},pop:function(){return this.splice(Math.max(this[me].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[me],t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e.spliceWithArray_(0,0,r),e.values_.length},reverse:function(){return re.trackingDerivation&&_e(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){re.trackingDerivation&&_e(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[me],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Ue("at",st);Ue("concat",st);Ue("flat",st);Ue("includes",st);Ue("indexOf",st);Ue("join",st);Ue("lastIndexOf",st);Ue("slice",st);Ue("toString",st);Ue("toLocaleString",st);Ue("toSorted",st);Ue("toSpliced",st);Ue("with",st);Ue("every",It);Ue("filter",It);Ue("find",It);Ue("findIndex",It);Ue("findLast",It);Ue("findLastIndex",It);Ue("flatMap",It);Ue("forEach",It);Ue("map",It);Ue("some",It);Ue("toReversed",It);Ue("reduce",Tf);Ue("reduceRight",Tf);function Ue(e,t){typeof Array.prototype[e]=="function"&&(co[e]=t(e))}function st(e){return function(){var t=this[me];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function It(e){return function(t,r){var n=this,i=this[me];i.atom_.reportObserved();var a=i.dehanceValues_(i.values_);return a[e](function(o,u){return t.call(r,o,u,n)})}}function Tf(e){return function(){var t=this,r=this[me];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(a,o,u){return i(a,o,u,t)},n[e].apply(n,arguments)}}var $v=cr("ObservableArrayAdministration",ls);function di(e){return go(e)&&$v(e[me])}var xf,Ef,kv={},or="add",lo="delete";xf=Symbol.iterator;Ef=Symbol.toStringTag;var Of=function(){function e(r,n,i){var a=this;n===void 0&&(n=pn),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[me]=kv,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,At(Map)||_e(18),Rr(function(){a.keysAtom_=zl("ObservableMap.keys()"),a.data_=new Map,a.hasMap_=new Map,r&&a.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!re.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var a=i=new ar(this.has_(r),wo,"ObservableMap.key?",!1);this.hasMap_.set(r,a),ci(a,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(pt(this)){var a=ht(this,{type:i?Pt:or,object:this,newValue:n,name:r});if(!a)return this;n=a.newValue}return i?this.updateValue_(r,n):this.addValue_(r,n),this},t.delete=function(r){var n=this;if(Ut(this.keysAtom_),pt(this)){var i=ht(this,{type:lo,object:this,name:r});if(!i)return!1}if(this.has_(r)){var a=Ar(),o=Et(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:lo,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return Mt(function(){var l;n.keysAtom_.reportChanged(),(l=n.hasMap_.get(r))==null||l.setNewValue_(!1);var c=n.data_.get(r);c.setNewValue_(void 0),n.data_.delete(r)}),o&&Ot(this,u),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==re.UNCHANGED){var a=Ar(),o=Et(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:Pt,object:this,oldValue:i.value_,name:r,newValue:n}:null;i.setNewValue_(n),o&&Ot(this,u)}},t.addValue_=function(r,n){var i=this;Ut(this.keysAtom_),Mt(function(){var l,c=new ar(n,i.enhancer_,"ObservableMap.key",!1);i.data_.set(r,c),n=c.value_,(l=i.hasMap_.get(r))==null||l.setNewValue_(!0),i.keysAtom_.reportChanged()});var a=Ar(),o=Et(this),u=o||a?{observableKind:"map",debugObjectName:this.name_,type:or,object:this,name:r,newValue:n}:null;o&&Ot(this,u)},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,n=this.keys();return Xn({next:function(){var i=n.next(),a=i.done,o=i.value;return{done:a,value:a?void 0:r.get(o)}}})},t.entries=function(){var r=this,n=this.keys();return Xn({next:function(){var i=n.next(),a=i.done,o=i.value;return{done:a,value:a?void 0:[o,r.get(o)]}}})},t[xf]=function(){return this.entries()},t.forEach=function(r,n){for(var i=nn(this),a;!(a=i()).done;){var o=a.value,u=o[0],l=o[1];r.call(n,l,u,this)}},t.merge=function(r){var n=this;return lr(r)&&(r=new Map(r)),Mt(function(){sr(r)?Gm(r).forEach(function(i){return n.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var a=i[0],o=i[1];return n.set(a,o)}):fn(r)?(r.constructor!==Map&&_e(19,r),r.forEach(function(i,a){return n.set(a,i)})):r!=null&&_e(20,r)}),this},t.clear=function(){var r=this;Mt(function(){De(function(){for(var n=nn(r.keys()),i;!(i=n()).done;){var a=i.value;r.delete(a)}})})},t.replace=function(r){var n=this;return Mt(function(){for(var i=Uv(r),a=new Map,o=!1,u=nn(n.data_.keys()),l;!(l=u()).done;){var c=l.value;if(!i.has(c)){var m=n.delete(c);if(m)o=!0;else{var g=n.data_.get(c);a.set(c,g)}}}for(var R=nn(i.entries()),j;!(j=R()).done;){var q=j.value,Z=q[0],ae=q[1],B=n.data_.has(Z);if(n.set(Z,ae),n.data_.has(Z)){var V=n.data_.get(Z);a.set(Z,V),B||(o=!0)}}if(!o)if(n.data_.size!==a.size)n.keysAtom_.reportChanged();else for(var H=n.data_.keys(),se=a.keys(),F=H.next(),ue=se.next();!F.done;){if(F.value!==ue.value){n.keysAtom_.reportChanged();break}F=H.next(),ue=se.next()}n.data_=a}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,n){return fi(this,r)},t.intercept_=function(r){return li(this,r)},os(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Ef,get:function(){return"Map"}}]),e}(),lr=cr("ObservableMap",Of);function Uv(e){if(fn(e)||lr(e))return e;if(Array.isArray(e))return new Map(e);if(sr(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return _e(21,e)}var Af,If,jv={};Af=Symbol.iterator;If=Symbol.toStringTag;var Sf=function(){function e(r,n,i){var a=this;n===void 0&&(n=pn),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[me]=jv,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,At(Set)||_e(22),this.enhancer_=function(o,u){return n(o,u,i)},Rr(function(){a.atom_=zl(a.name_),r&&a.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;Mt(function(){De(function(){for(var n=nn(r.data_.values()),i;!(i=n()).done;){var a=i.value;r.delete(a)}})})},t.forEach=function(r,n){for(var i=nn(this),a;!(a=i()).done;){var o=a.value;r.call(n,o,o,this)}},t.add=function(r){var n=this;if(Ut(this.atom_),pt(this)){var i=ht(this,{type:or,object:this,newValue:r});if(!i)return this}if(!this.has(r)){Mt(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var a=!1,o=Et(this),u=o||a?{observableKind:"set",debugObjectName:this.name_,type:or,object:this,newValue:r}:null;o&&Ot(this,u)}return this},t.delete=function(r){var n=this;if(pt(this)){var i=ht(this,{type:lo,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var a=!1,o=Et(this),u=o||a?{observableKind:"set",debugObjectName:this.name_,type:lo,object:this,oldValue:r}:null;return Mt(function(){n.atom_.reportChanged(),n.data_.delete(r)}),o&&Ot(this,u),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=0,n=Array.from(this.keys()),i=Array.from(this.values());return Xn({next:function(){var a=r;return r+=1,a<i.length?{value:[n[a],i[a]],done:!1}:{done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,n=0,i=Array.from(this.data_.values());return Xn({next:function(){return n<i.length?{value:r.dehanceValue_(i[n++]),done:!1}:{done:!0}}})},t.replace=function(r){var n=this;return Cr(r)&&(r=new Set(r)),Mt(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):ni(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&_e("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return fi(this,r)},t.intercept_=function(r){return li(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Af]=function(){return this.values()},os(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:If,get:function(){return"Set"}}]),e}(),Cr=cr("ObservableSet",Sf),Jc=Object.create(null),Xc="remove",$f=function(){function e(r,n,i,a){n===void 0&&(n=new Map),a===void 0&&(a=Eg),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_=a,this.keysAtom_=new oi("ObservableObject.keys"),this.isPlainObject_=sr(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,n){var i=this.values_.get(r);if(i instanceof an)return i.set(n),!0;if(pt(this)){var a=ht(this,{type:Pt,object:this.proxy_||this.target_,name:r,newValue:n});if(!a)return null;n=a.newValue}if(n=i.prepareNewValue_(n),n!==re.UNCHANGED){var o=Et(this),u=!1,l=o||u?{type:Pt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;i.setNewValue_(n),o&&Ot(this,l)}return!0},t.get_=function(r){return re.trackingDerivation&&!Lt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Lt(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,n):i?Reflect.set(this.target_,r,n):(this.target_[r]=n,!0):this.extend_(r,{value:n,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(r){if(!re.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var n=this.pendingKeys_.get(r);return n||(n=new ar(r in this.target_,wo,"ObservableObject.key?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(Zc(this,n,r),!(r in this.target_)){var i;if((i=this.target_[kt])!=null&&i[r])return;_e(1,n.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==ri;){var o=io(a,r);if(o){var u=n.make_(this,r,o,a);if(u===0)return;if(u===1)break}a=Object.getPrototypeOf(a)}Qc(this,n,r)}},t.extend_=function(r,n,i,a){if(a===void 0&&(a=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,n,a);Zc(this,i,r);var o=i.extend_(this,r,n,a);return o&&Qc(this,i,r),o},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),Ut(this.keysAtom_);try{yt();var a=this.delete_(r);if(!a)return a;if(pt(this)){var o=ht(this,{object:this.proxy_||this.target_,name:r,type:or,newValue:n.value});if(!o)return null;var u=o.newValue;n.value!==u&&(n=Sr({},n,{value:u}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else jt(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{mt()}return!0},t.defineObservableProperty_=function(r,n,i,a){a===void 0&&(a=!1),Ut(this.keysAtom_);try{yt();var o=this.delete_(r);if(!o)return o;if(pt(this)){var u=ht(this,{object:this.proxy_||this.target_,name:r,type:or,newValue:n});if(!u)return null;n=u.newValue}var l=Yc(r),c={configurable:re.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:l.get,set:l.set};if(a){if(!Reflect.defineProperty(this.target_,r,c))return!1}else jt(this.target_,r,c);var m=new ar(n,i,"ObservableObject.key",!1);this.values_.set(r,m),this.notifyPropertyAddition_(r,m.value_)}finally{mt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),Ut(this.keysAtom_);try{yt();var a=this.delete_(r);if(!a)return a;if(pt(this)){var o=ht(this,{object:this.proxy_||this.target_,name:r,type:or,newValue:void 0});if(!o)return null}n.name||(n.name="ObservableObject.key"),n.context=this.proxy_||this.target_;var u=Yc(r),l={configurable:re.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:u.get,set:u.set};if(i){if(!Reflect.defineProperty(this.target_,r,l))return!1}else jt(this.target_,r,l);this.values_.set(r,new an(n)),this.notifyPropertyAddition_(r,void 0)}finally{mt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),Ut(this.keysAtom_),!Lt(this.target_,r))return!0;if(pt(this)){var i=ht(this,{object:this.proxy_||this.target_,name:r,type:Xc});if(!i)return null}try{var a,o;yt();var u=Et(this),l=!1,c=this.values_.get(r),m=void 0;if(!c&&(u||l)){var g;m=(g=io(this.target_,r))==null?void 0:g.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(c&&(this.values_.delete(r),c instanceof ar&&(m=c.value_),uf(c)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(o=a.get(r))==null||o.set(r in this.target_),u||l){var R={type:Xc,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:m,name:r};u&&Ot(this,R)}}finally{mt()}return!0},t.observe_=function(r,n){return fi(this,r)},t.intercept_=function(r){return li(this,r)},t.notifyPropertyAddition_=function(r,n){var i,a,o=Et(this),u=!1;if(o||u){var l=o||u?{type:or,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;o&&Ot(this,l)}(i=this.pendingKeys_)==null||(a=i.get(r))==null||a.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),bo(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function yn(e,t){var r;if(Lt(e,me))return e;var n=(r=t?.name)!=null?r:"ObservableObject",i=new $f(e,new Map,String(n),Bg(t));return vo(e,me,i),e}var Nv=cr("ObservableObjectAdministration",$f);function Yc(e){return Jc[e]||(Jc[e]={get:function(){return this[me].getObservablePropValue_(e)},set:function(t){return this[me].setObservablePropValue_(e,t)}})}function un(e){return go(e)?Nv(e[me]):!1}function Qc(e,t,r){var n;(n=e.target_[kt])==null||delete n[r]}function Zc(e,t,r){if(0)var n,i,a}var Pv=Uf(0),Bv=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Ua=0,kf=function(){};function Cv(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Cv(kf,Array.prototype);var fs=function(e,t,r){Fl(n,e);function n(a,o,u,l){var c;return u===void 0&&(u="ObservableArray"),l===void 0&&(l=!1),c=e.call(this)||this,Rr(function(){var m=new ls(u,o,l,!0);m.proxy_=$a(c),Ll($a(c),me,m),a&&a.length&&c.spliceWithArray(0,0,a),Bv&&Object.defineProperty($a(c),"0",Pv)}),c}var i=n.prototype;return i.concat=function(){this[me].atom_.reportObserved();for(var a=arguments.length,o=new Array(a),u=0;u<a;u++)o[u]=arguments[u];return Array.prototype.concat.apply(this.slice(),o.map(function(l){return di(l)?l.slice():l}))},i[r]=function(){var a=this,o=0;return Xn({next:function(){return o<a.length?{value:a[o++],done:!1}:{done:!0,value:void 0}}})},os(n,[{key:"length",get:function(){return this[me].getArrayLength_()},set:function(a){this[me].setArrayLength_(a)}},{key:t,get:function(){return"Array"}}]),n}(kf,Symbol.toStringTag,Symbol.iterator);Object.entries(co).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&vo(fs.prototype,t,r)});function Uf(e){return{enumerable:!1,configurable:!0,get:function(){return this[me].get_(e)},set:function(t){this[me].set_(e,t)}}}function Rv(e){jt(fs.prototype,""+e,Uf(e))}function jf(e){if(e>Ua){for(var t=Ua;t<e+100;t++)Rv(t);Ua=e}}jf(1e3);function Mv(e,t,r){return new fs(e,t,r)}function Ur(e,t){if(typeof e=="object"&&e!==null){if(di(e))return t!==void 0&&_e(23),e[me].atom_;if(Cr(e))return e.atom_;if(lr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||_e(25,t,Ga(e)),r}if(un(e)){if(!t)return _e(26);var n=e[me].values_.get(t);return n||_e(27,t,Ga(e)),n}if(as(e)||si(e)||uo(e))return e}else if(At(e)&&uo(e[me]))return e[me];_e(28)}function Nf(e,t){if(e||_e(29),t!==void 0)return Nf(Ur(e,t));if(as(e)||si(e)||uo(e)||lr(e)||Cr(e))return e;if(e[me])return e[me];_e(24,e)}function Ga(e,t){var r;if(t!==void 0)r=Ur(e,t);else{if(ui(e))return e.name;un(e)||lr(e)||Cr(e)?r=Nf(e):r=Ur(e)}return r.name_}function Rr(e){var t=Br(),r=To(!0);yt();try{return e()}finally{mt(),xo(r),Dt(t)}}var el=ri.toString;function ds(e,t,r){return r===void 0&&(r=-1),Ha(e,t,r)}function Ha(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 a=typeof e;if(a!=="function"&&a!=="object"&&typeof t!="object")return!1;var o=el.call(e);if(o!==el.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=tl(e),t=tl(t);var u=o==="[object Array]";if(!u){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,c=t.constructor;if(l!==c&&!(At(l)&&l instanceof l&&At(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 m=n.length;m--;)if(n[m]===e)return i[m]===t;if(n.push(e),i.push(t),u){if(m=e.length,m!==t.length)return!1;for(;m--;)if(!Ha(e[m],t[m],r-1,n,i))return!1}else{var g=Object.keys(e),R;if(m=g.length,Object.keys(t).length!==m)return!1;for(;m--;)if(R=g[m],!(Lt(t,R)&&Ha(e[R],t[R],r-1,n,i)))return!1}return n.pop(),i.pop(),!0}function tl(e){return di(e)?e.slice():fn(e)||lr(e)||ni(e)||Cr(e)?Array.from(e.entries()):e}function Xn(e){return e[Symbol.iterator]=Lv,e}function Lv(){return this}["Symbol","Map","Set"].forEach(function(e){var t=ns();typeof t[e]>"u"&&_e("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:lf,extras:{getDebugName:Ga},$mobx:me});function Wa(e){"@babel/helpers - typeof";return Wa=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wa(e)}function Pf(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function rl(e){Pf(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Wa(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Dv(e,t){Pf(2,arguments);var r=rl(e),n=rl(t);return r.getTime()<n.getTime()}var Bf=nr(Rm(),1),HO=Bf.default.configure,xt=Bf.default,{WARN:WO,LOG:JO,DEBUG:XO,VERBOSE:nl,ERROR:Vv}=Ae.setup(Ae.DEBUG),Cf=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Rf=(e,t,r="asc")=>Cf(e.ts,t.ts,r);function jr(e,t="asc"){return e.sort((r,n)=>Rf(r,n,t))}var Mf=(e,t)=>Dv(new Date(e.ts),new Date(t.ts));var Lf=(e,t)=>Ze.structural(e,t),ps=e=>{let t=new Map;for(let r of e){if(!r)throw Vv("falsy entry in applogs",e),new Error("falsy entry in applogs");t.set(xt(r),r)}return Array.from(t.values())};function Df(e){return typeof e=="string"&&e.startsWith("?")}function Vf(e){return e.slice(1)}function hs(e,t){let r={};return[Object.entries(e).reduce((n,[i,a])=>{if(Df(a)){let o=Vf(a),u=t[o];u?n[i]=u:r[i]=o}else n[i]=a;return n},{}),r]}function Ff(e,t,r){nl("[matchPartStatic]",e,t,t===r?"===":"!==",r);let n=typeof t=="function"?t(r):Array.isArray(t)&&!Array.isArray(r)?t.includes(r):t===r;return nl("[matchPartStatic] =>",e.startsWith("!")?"!":"",n),e.startsWith("!")?!n:n}var zf=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},il=function(e){return zf(e)/e.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:zf,mean:il,average:il,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;function qf(e,t){if(e.length!==t.length)return!1;let r=[...e].sort(),n=[...t].sort();for(let i=0;i<r.length;i++)if(r[i]!==n[i])return!1;return!0}function Kf(){return new Date().toISOString()}var ja=100,{WARN:Fv,LOG:YO,DEBUG:zv,VERBOSE:Qe,ERROR:QO}=Ae.setup(Ae.INFO);mv({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");typeof window=="object"&&(window.getDependencyTree=Wn,window.getObserverTree=vv);Qe.isDisabled||lf(e=>{Qe("[mobx]",e)});var Yn=({caller:e,thread:t,pattern:r})=>`${t?.name?t.name+" | ":""}${e??"caller?"}${r?`{${typeof r=="string"?r:xt(r)}}`:""}`;function qv(e,t){return De(()=>Ze.structural(e.get(),t.get()))}function pi(e,t){return Ze.shallow(e.applogs,t.applogs)}function ys(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(Qe("queryNodesComparer",r,n,i),!Ze.structural(n.variables,i.variables)||!pi(n.logsOfThisNode,i.logsOfThisNode))return!1}return!0}var Kv=0;function Eo(e,{name:t,equals:r}={}){Qe("[observableArrayMap] create",{fnname:e.name,fn:e,name:t,equals:r});let n=`observableArrayMap@${++Kv}{${t}}`,i,a;function o(){u.track(()=>{let c=ja&&performance.now();zv(`[${n}] runAndTrack:`,{name:t??e.name,fn:e}),a=e(),Qe(`[${n}] runAndTrack =>`,a),ja&&performance.now()-c>ja&&Fv(`[${n}] took ${performance.now()-c}ms`)})}let u=new Gn(n,(...c)=>{Qe(`[${n}] reaction.invalidate`,c),o(),uv(()=>{(r??Ze.structural)(i,a)||i.replace(a)})});o(),i=Pe.array(a,{deep:!1,name:t}),Qe(`[${n}] deps of reaction`,Wn(u),"array:",Wn(i),{reaction:u,observableArr:i});let l=ci(i,()=>{Qe("[observableArrayMap] dispose"),u.dispose(),l()});return i}function et(e,t=!1){if(ui(e))throw new Error("computedFnDeepCompare shouldn't be used on actions");let r=!1,n=0,i=typeof t=="boolean"?{keepAlive:t}:t,a=new Map;return function(...o){let u,l=De(()=>o),c=`computedFnDeepCompare(${i.name||e.name}#${++n})${i.argsDebugName?`{${i.argsDebugName(...o)}}`:""}`;for(let[R,j]of a.entries())if(Ze.structural(R,l)){u=j;break}if(u){let R=u.get();return Qe(`[${c}] cache hit`,{untrackedArgs:l,cachedResult:R}),R}if(!i.keepAlive&&!Gg())return!r&&Jg().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),r=!0),e.apply(this,o);Qe(`[${c}] new computation`,{untrackedArgs:l});let m,g=He(()=>(Qe(`[${c}] update->rerun`,De(()=>({args:o})),e),Qe.isDisabled||_f(),m=e.apply(this,o)),{...i,name:c});if(Qe(`[${c}] deps`,Wn(g),{untrackedArgs:l}),a.set(l,g),!i.keepAlive){let R=ci(g,()=>{Qe(`[${c}] dispose`,g),a.delete(l),i.onCleanup&&i.onCleanup(m,...o),m=void 0,R()})}return g.get()}}function Gv(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let a=e[i];a==="("?r+=a+`
|
|
28
28
|
`+" ".repeat(++t):a===")"?r+=`
|
|
29
29
|
`+" ".repeat(--t)+a:a===","&&n===0?r+=a+`
|
|
30
30
|
`+" ".repeat(t):a==="{"&&n===0?(n++,r+=a+`
|
|
31
31
|
`+" ".repeat(t+1)):a==="}"&&n===1?(n--,r+=`
|
|
32
|
-
`+" ".repeat(t)+a):a==="{"&&n>0?(n++,r+=a):(a==="}"&&n>1&&n--,r+=a)}return r}var{WARN:Hv,LOG:ZO,DEBUG:Wv,VERBOSE:eI,ERROR:ol}=Ie.setup(Ie.INFO,{prefix:"[stream]"});function Dt(e){return e.init!==void 0}var ms=class{constructor(e,t,r=[],n){if(this._applogs=r,this.name=n,this.parents=e&&!Array.isArray(e)?[e]:e,this.filters=t,this.parents?.length===0)throw new Error("Unhandled: empty parents");hn(this,{size:He,isEmpty:He,firstLog:He,latestLog:He},{name:`Stream{${n}}`})}filters;parents;_subscribers=[];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):Hv("unsubscribe called for non-existent",e)}notifySubscribers(e){Wv(`[stream: ${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}map(e){return this.applogs.map||ol("applogs arr?!",this.applogs),this.applogs.map(e)}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);{let r=Object.keys(e);return!!this.applogs.find(n=>{if(!qf(r,Object.keys(n)))throw ol("[hasApplog] field set mismatch:",{applog:e,log:n});return Lf(n,e)})}}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 untrackedSize(){return De(()=>this.size)}get nameAndSizeUntracked(){return De(()=>`${this.name} (${this.size})`)}get prettyName(){return Gv(this.name)}};var Jv=typeof global=="object"&&global&&global.Object===Object&&global,Gf=Jv,Xv=typeof self=="object"&&self&&self.Object===Object&&self,Yv=Gf||Xv||Function("return this")(),Ft=Yv,Qv=Ft.Symbol,ur=Qv,Hf=Object.prototype,Zv=Hf.hasOwnProperty,eb=Hf.toString,Fn=ur?ur.toStringTag:void 0;function tb(e){var t=Zv.call(e,Fn),r=e[Fn];try{e[Fn]=void 0;var n=!0}catch{}var i=eb.call(e);return n&&(t?e[Fn]=r:delete e[Fn]),i}var rb=tb,nb=Object.prototype,ib=nb.toString;function ob(e){return ib.call(e)}var ab=ob,sb="[object Null]",ub="[object Undefined]",al=ur?ur.toStringTag:void 0;function cb(e){return e==null?e===void 0?ub:sb:al&&al in Object(e)?rb(e):ab(e)}var mn=cb;function lb(e){return e!=null&&typeof e=="object"}var cn=lb,fb="[object Symbol]";function db(e){return typeof e=="symbol"||cn(e)&&mn(e)==fb}var Qn=db;function pb(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 hb=pb,yb=Array.isArray,Vt=yb,mb=1/0,sl=ur?ur.prototype:void 0,ul=sl?sl.toString:void 0;function Wf(e){if(typeof e=="string")return e;if(Vt(e))return hb(e,Wf)+"";if(Qn(e))return ul?ul.call(e):"";var t=e+"";return t=="0"&&1/e==-mb?"-0":t}var gb=Wf;function vb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var gs=vb;function bb(e){return e}var wb=bb,_b="[object AsyncFunction]",Tb="[object Function]",xb="[object GeneratorFunction]",Eb="[object Proxy]";function Ob(e){if(!gs(e))return!1;var t=mn(e);return t==Tb||t==xb||t==_b||t==Eb}var Jf=Ob,Ib=Ft["__core-js_shared__"],Na=Ib,cl=function(){var e=/[^.]+$/.exec(Na&&Na.keys&&Na.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Ab(e){return!!cl&&cl in e}var Sb=Ab,$b=Function.prototype,kb=$b.toString;function Ub(e){if(e!=null){try{return kb.call(e)}catch{}try{return e+""}catch{}}return""}var Mr=Ub,jb=/[\\^$.*+?()[\]{}|]/g,Nb=/^\[object .+?Constructor\]$/,Pb=Function.prototype,Bb=Object.prototype,Cb=Pb.toString,Rb=Bb.hasOwnProperty,Mb=RegExp("^"+Cb.call(Rb).replace(jb,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Lb(e){if(!gs(e)||Sb(e))return!1;var t=Jf(e)?Mb:Nb;return t.test(Mr(e))}var Db=Lb;function Vb(e,t){return e?.[t]}var Fb=Vb;function zb(e,t){var r=Fb(e,t);return Db(r)?r:void 0}var gn=zb,qb=gn(Ft,"WeakMap"),Ja=qb,Kb=9007199254740991,Gb=/^(?:0|[1-9]\d*)$/;function Hb(e,t){var r=typeof e;return t=t??Kb,!!t&&(r=="number"||r!="symbol"&&Gb.test(e))&&e>-1&&e%1==0&&e<t}var Xf=Hb;function Wb(e,t){return e===t||e!==e&&t!==t}var Yf=Wb,Jb=9007199254740991;function Xb(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Jb}var vs=Xb;function Yb(e){return e!=null&&vs(e.length)&&!Jf(e)}var Qb=Yb,Zb=Object.prototype;function e0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Zb;return e===r}var t0=e0;function r0(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var n0=r0,i0="[object Arguments]";function o0(e){return cn(e)&&mn(e)==i0}var ll=o0,Qf=Object.prototype,a0=Qf.hasOwnProperty,s0=Qf.propertyIsEnumerable,u0=ll(function(){return arguments}())?ll:function(e){return cn(e)&&a0.call(e,"callee")&&!s0.call(e,"callee")},Zf=u0;function c0(){return!1}var l0=c0,ed=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fl=ed&&typeof module=="object"&&module&&!module.nodeType&&module,f0=fl&&fl.exports===ed,dl=f0?Ft.Buffer:void 0,d0=dl?dl.isBuffer:void 0,p0=d0||l0,Xa=p0,h0="[object Arguments]",y0="[object Array]",m0="[object Boolean]",g0="[object Date]",v0="[object Error]",b0="[object Function]",w0="[object Map]",_0="[object Number]",T0="[object Object]",x0="[object RegExp]",E0="[object Set]",O0="[object String]",I0="[object WeakMap]",A0="[object ArrayBuffer]",S0="[object DataView]",$0="[object Float32Array]",k0="[object Float64Array]",U0="[object Int8Array]",j0="[object Int16Array]",N0="[object Int32Array]",P0="[object Uint8Array]",B0="[object Uint8ClampedArray]",C0="[object Uint16Array]",R0="[object Uint32Array]",Ne={};Ne[$0]=Ne[k0]=Ne[U0]=Ne[j0]=Ne[N0]=Ne[P0]=Ne[B0]=Ne[C0]=Ne[R0]=!0;Ne[h0]=Ne[y0]=Ne[A0]=Ne[m0]=Ne[S0]=Ne[g0]=Ne[v0]=Ne[b0]=Ne[w0]=Ne[_0]=Ne[T0]=Ne[x0]=Ne[E0]=Ne[O0]=Ne[I0]=!1;function M0(e){return cn(e)&&vs(e.length)&&!!Ne[mn(e)]}var L0=M0;function D0(e){return function(t){return e(t)}}var V0=D0,td=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Kn=td&&typeof module=="object"&&module&&!module.nodeType&&module,F0=Kn&&Kn.exports===td,Pa=F0&&Gf.process,z0=function(){try{var e=Kn&&Kn.require&&Kn.require("util").types;return e||Pa&&Pa.binding&&Pa.binding("util")}catch{}}(),pl=z0,hl=pl&&pl.isTypedArray,q0=hl?V0(hl):L0,rd=q0,K0=Object.prototype,G0=K0.hasOwnProperty;function H0(e,t){var r=Vt(e),n=!r&&Zf(e),i=!r&&!n&&Xa(e),a=!r&&!n&&!i&&rd(e),o=r||n||i||a,u=o?n0(e.length,String):[],l=u.length;for(var c in e)(t||G0.call(e,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Xf(c,l)))&&u.push(c);return u}var W0=H0;function J0(e,t){return function(r){return e(t(r))}}var X0=J0,Y0=X0(Object.keys,Object),Q0=Y0,Z0=Object.prototype,ew=Z0.hasOwnProperty;function tw(e){if(!t0(e))return Q0(e);var t=[];for(var r in Object(e))ew.call(e,r)&&r!="constructor"&&t.push(r);return t}var rw=tw;function nw(e){return Qb(e)?W0(e):rw(e)}var nd=nw,iw=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ow=/^\w*$/;function aw(e,t){if(Vt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Qn(e)?!0:ow.test(e)||!iw.test(e)||t!=null&&e in Object(t)}var bs=aw,sw=gn(Object,"create"),Zn=sw;function uw(){this.__data__=Zn?Zn(null):{},this.size=0}var cw=uw;function lw(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var fw=lw,dw="__lodash_hash_undefined__",pw=Object.prototype,hw=pw.hasOwnProperty;function yw(e){var t=this.__data__;if(Zn){var r=t[e];return r===dw?void 0:r}return hw.call(t,e)?t[e]:void 0}var mw=yw,gw=Object.prototype,vw=gw.hasOwnProperty;function bw(e){var t=this.__data__;return Zn?t[e]!==void 0:vw.call(t,e)}var ww=bw,_w="__lodash_hash_undefined__";function Tw(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Zn&&t===void 0?_w:t,this}var xw=Tw;function vn(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])}}vn.prototype.clear=cw;vn.prototype.delete=fw;vn.prototype.get=mw;vn.prototype.has=ww;vn.prototype.set=xw;var yl=vn;function Ew(){this.__data__=[],this.size=0}var Ow=Ew;function Iw(e,t){for(var r=e.length;r--;)if(Yf(e[r][0],t))return r;return-1}var Oo=Iw,Aw=Array.prototype,Sw=Aw.splice;function $w(e){var t=this.__data__,r=Oo(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Sw.call(t,r,1),--this.size,!0}var kw=$w;function Uw(e){var t=this.__data__,r=Oo(t,e);return r<0?void 0:t[r][1]}var jw=Uw;function Nw(e){return Oo(this.__data__,e)>-1}var Pw=Nw;function Bw(e,t){var r=this.__data__,n=Oo(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var Cw=Bw;function bn(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])}}bn.prototype.clear=Ow;bn.prototype.delete=kw;bn.prototype.get=jw;bn.prototype.has=Pw;bn.prototype.set=Cw;var Io=bn,Rw=gn(Ft,"Map"),ei=Rw;function Mw(){this.size=0,this.__data__={hash:new yl,map:new(ei||Io),string:new yl}}var Lw=Mw;function Dw(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Vw=Dw;function Fw(e,t){var r=e.__data__;return Vw(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Ao=Fw;function zw(e){var t=Ao(this,e).delete(e);return this.size-=t?1:0,t}var qw=zw;function Kw(e){return Ao(this,e).get(e)}var Gw=Kw;function Hw(e){return Ao(this,e).has(e)}var Ww=Hw;function Jw(e,t){var r=Ao(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Xw=Jw;function wn(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])}}wn.prototype.clear=Lw;wn.prototype.delete=qw;wn.prototype.get=Gw;wn.prototype.has=Ww;wn.prototype.set=Xw;var So=wn,Yw="Expected a function";function ws(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Yw);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(ws.Cache||So),r}ws.Cache=So;var Qw=ws,Zw=500;function e1(e){var t=Qw(e,function(n){return r.size===Zw&&r.clear(),n}),r=t.cache;return t}var t1=e1,r1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n1=/\\(\\)?/g,i1=t1(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(r1,function(r,n,i,a){t.push(i?a.replace(n1,"$1"):n||r)}),t}),o1=i1;function a1(e){return e==null?"":gb(e)}var s1=a1;function u1(e,t){return Vt(e)?e:bs(e,t)?[e]:o1(s1(e))}var id=u1,c1=1/0;function l1(e){if(typeof e=="string"||Qn(e))return e;var t=e+"";return t=="0"&&1/e==-c1?"-0":t}var $o=l1;function f1(e,t){t=id(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[$o(t[r++])];return r&&r==n?e:void 0}var od=f1;function d1(e,t,r){var n=e==null?void 0:od(e,t);return n===void 0?r:n}var p1=d1;function h1(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var y1=h1;function m1(){this.__data__=new Io,this.size=0}var g1=m1;function v1(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var b1=v1;function w1(e){return this.__data__.get(e)}var _1=w1;function T1(e){return this.__data__.has(e)}var x1=T1,E1=200;function O1(e,t){var r=this.__data__;if(r instanceof Io){var n=r.__data__;if(!ei||n.length<E1-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new So(n)}return r.set(e,t),this.size=r.size,this}var I1=O1;function _n(e){var t=this.__data__=new Io(e);this.size=t.size}_n.prototype.clear=g1;_n.prototype.delete=b1;_n.prototype.get=_1;_n.prototype.has=x1;_n.prototype.set=I1;var no=_n;function A1(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}var S1=A1;function $1(){return[]}var k1=$1,U1=Object.prototype,j1=U1.propertyIsEnumerable,ml=Object.getOwnPropertySymbols,N1=ml?function(e){return e==null?[]:(e=Object(e),S1(ml(e),function(t){return j1.call(e,t)}))}:k1,P1=N1;function B1(e,t,r){var n=t(e);return Vt(e)?n:y1(n,r(e))}var C1=B1;function R1(e){return C1(e,nd,P1)}var gl=R1,M1=gn(Ft,"DataView"),Ya=M1,L1=gn(Ft,"Promise"),Qa=L1,D1=gn(Ft,"Set"),Za=D1,vl="[object Map]",V1="[object Object]",bl="[object Promise]",wl="[object Set]",_l="[object WeakMap]",Tl="[object DataView]",F1=Mr(Ya),z1=Mr(ei),q1=Mr(Qa),K1=Mr(Za),G1=Mr(Ja),Or=mn;(Ya&&Or(new Ya(new ArrayBuffer(1)))!=Tl||ei&&Or(new ei)!=vl||Qa&&Or(Qa.resolve())!=bl||Za&&Or(new Za)!=wl||Ja&&Or(new Ja)!=_l)&&(Or=function(e){var t=mn(e),r=t==V1?e.constructor:void 0,n=r?Mr(r):"";if(n)switch(n){case F1:return Tl;case z1:return vl;case q1:return bl;case K1:return wl;case G1:return _l}return t});var xl=Or,H1=Ft.Uint8Array,El=H1,W1="__lodash_hash_undefined__";function J1(e){return this.__data__.set(e,W1),this}var X1=J1;function Y1(e){return this.__data__.has(e)}var Q1=Y1;function fo(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new So;++t<r;)this.add(e[t])}fo.prototype.add=fo.prototype.push=X1;fo.prototype.has=Q1;var Z1=fo;function e_(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 t_=e_;function r_(e,t){return e.has(t)}var n_=r_,i_=1,o_=2;function a_(e,t,r,n,i,a){var o=r&i_,u=e.length,l=t.length;if(u!=l&&!(o&&l>u))return!1;var c=a.get(e),m=a.get(t);if(c&&m)return c==t&&m==e;var g=-1,R=!0,j=r&o_?new Z1:void 0;for(a.set(e,t),a.set(t,e);++g<u;){var q=e[g],Z=t[g];if(n)var ae=o?n(Z,q,g,t,e,a):n(q,Z,g,e,t,a);if(ae!==void 0){if(ae)continue;R=!1;break}if(j){if(!t_(t,function(B,V){if(!n_(j,V)&&(q===B||i(q,B,r,n,a)))return j.push(V)})){R=!1;break}}else if(!(q===Z||i(q,Z,r,n,a))){R=!1;break}}return a.delete(e),a.delete(t),R}var ad=a_;function s_(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var u_=s_;function c_(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var l_=c_,f_=1,d_=2,p_="[object Boolean]",h_="[object Date]",y_="[object Error]",m_="[object Map]",g_="[object Number]",v_="[object RegExp]",b_="[object Set]",w_="[object String]",__="[object Symbol]",T_="[object ArrayBuffer]",x_="[object DataView]",Ol=ur?ur.prototype:void 0,Ba=Ol?Ol.valueOf:void 0;function E_(e,t,r,n,i,a,o){switch(r){case x_:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case T_:return!(e.byteLength!=t.byteLength||!a(new El(e),new El(t)));case p_:case h_:case g_:return Yf(+e,+t);case y_:return e.name==t.name&&e.message==t.message;case v_:case w_:return e==t+"";case m_:var u=u_;case b_:var l=n&f_;if(u||(u=l_),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=d_,o.set(e,t);var m=ad(u(e),u(t),n,i,a,o);return o.delete(e),m;case __:if(Ba)return Ba.call(e)==Ba.call(t)}return!1}var O_=E_,I_=1,A_=Object.prototype,S_=A_.hasOwnProperty;function $_(e,t,r,n,i,a){var o=r&I_,u=gl(e),l=u.length,c=gl(t),m=c.length;if(l!=m&&!o)return!1;for(var g=l;g--;){var R=u[g];if(!(o?R in t:S_.call(t,R)))return!1}var j=a.get(e),q=a.get(t);if(j&&q)return j==t&&q==e;var Z=!0;a.set(e,t),a.set(t,e);for(var ae=o;++g<l;){R=u[g];var B=e[R],V=t[R];if(n)var H=o?n(V,B,R,t,e,a):n(B,V,R,e,t,a);if(!(H===void 0?B===V||i(B,V,r,n,a):H)){Z=!1;break}ae||(ae=R=="constructor")}if(Z&&!ae){var se=e.constructor,F=t.constructor;se!=F&&"constructor"in e&&"constructor"in t&&!(typeof se=="function"&&se instanceof se&&typeof F=="function"&&F instanceof F)&&(Z=!1)}return a.delete(e),a.delete(t),Z}var k_=$_,U_=1,Il="[object Arguments]",Al="[object Array]",Zi="[object Object]",j_=Object.prototype,Sl=j_.hasOwnProperty;function N_(e,t,r,n,i,a){var o=Vt(e),u=Vt(t),l=o?Al:xl(e),c=u?Al:xl(t);l=l==Il?Zi:l,c=c==Il?Zi:c;var m=l==Zi,g=c==Zi,R=l==c;if(R&&Xa(e)){if(!Xa(t))return!1;o=!0,m=!1}if(R&&!m)return a||(a=new no),o||rd(e)?ad(e,t,r,n,i,a):O_(e,t,l,r,n,i,a);if(!(r&U_)){var j=m&&Sl.call(e,"__wrapped__"),q=g&&Sl.call(t,"__wrapped__");if(j||q){var Z=j?e.value():e,ae=q?t.value():t;return a||(a=new no),i(Z,ae,r,n,a)}}return R?(a||(a=new no),k_(e,t,r,n,i,a)):!1}var P_=N_;function sd(e,t,r,n,i){return e===t?!0:e==null||t==null||!cn(e)&&!cn(t)?e!==e&&t!==t:P_(e,t,r,n,sd,i)}var ud=sd,B_=1,C_=2;function R_(e,t,r,n){var i=r.length,a=i,o=!n;if(e==null)return!a;for(e=Object(e);i--;){var u=r[i];if(o&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<a;){u=r[i];var l=u[0],c=e[l],m=u[1];if(o&&u[2]){if(c===void 0&&!(l in e))return!1}else{var g=new no;if(n)var R=n(c,m,l,e,t,g);if(!(R===void 0?ud(m,c,B_|C_,n,g):R))return!1}}return!0}var M_=R_;function L_(e){return e===e&&!gs(e)}var cd=L_;function D_(e){for(var t=nd(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,cd(i)]}return t}var V_=D_;function F_(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var ld=F_;function z_(e){var t=V_(e);return t.length==1&&t[0][2]?ld(t[0][0],t[0][1]):function(r){return r===e||M_(r,e,t)}}var q_=z_;function K_(e,t){return e!=null&&t in Object(e)}var G_=K_;function H_(e,t,r){t=id(t,e);for(var n=-1,i=t.length,a=!1;++n<i;){var o=$o(t[n]);if(!(a=e!=null&&r(e,o)))break;e=e[o]}return a||++n!=i?a:(i=e==null?0:e.length,!!i&&vs(i)&&Xf(o,i)&&(Vt(e)||Zf(e)))}var W_=H_;function J_(e,t){return e!=null&&W_(e,t,G_)}var X_=J_,Y_=1,Q_=2;function Z_(e,t){return bs(e)&&cd(t)?ld($o(e),t):function(r){var n=p1(r,e);return n===void 0&&n===t?X_(r,e):ud(t,n,Y_|Q_)}}var eT=Z_;function tT(e){return function(t){return t?.[e]}}var rT=tT;function nT(e){return function(t){return od(t,e)}}var iT=nT;function oT(e){return bs(e)?rT($o(e)):iT(e)}var aT=oT;function sT(e){return typeof e=="function"?e:e==null?wb:typeof e=="object"?Vt(e)?eT(e[0],e[1]):q_(e):aT(e)}var uT=sT,cT=4294967295,lT=cT-1,fT=Math.floor,dT=Math.min;function pT(e,t,r,n){var i=0,a=e==null?0:e.length;if(a===0)return 0;t=r(t);for(var o=t!==t,u=t===null,l=Qn(t),c=t===void 0;i<a;){var m=fT((i+a)/2),g=r(e[m]),R=g!==void 0,j=g===null,q=g===g,Z=Qn(g);if(o)var ae=n||q;else c?ae=q&&(n||R):u?ae=q&&R&&(n||!j):l?ae=q&&R&&!j&&(n||!Z):j||Z?ae=!1:ae=n?g<=t:g<t;ae?i=m+1:a=m}return dT(a,lT)}var hT=pT;function yT(e,t,r){return hT(e,t,uT(r,2))}var mT=yT,{WARN:gT,LOG:tI,DEBUG:vT,VERBOSE:zn,ERROR:$l}=Ie.setup(Ie.INFO),ko=class extends ms{constructor(e,t,r,n,i){super(e,t,Pe.array([...r],{deep:!1,name:`${i}.array`}),i),this._initialLogs=r,this._eventMapper=n,this.name=i,hn(this,{onParentUpdate:Tt}),this.subscribeToParent()}_parentSubscriptions=new Map;get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}subscribeToParent(){if(this.parents.length||gT("MappedStream has no parents",this),this._parentSubscriptions.size)throw $l("parents subs must not be called twice",this);zn(`[MappedStream: ${this.name}] subscribing to parents:`,this.parents.map(e=>e.name)),this.parents.forEach(e=>{let t=this.onParentUpdate.bind(this,e);e.subscribe(t),this._parentSubscriptions.set(e,t)})}triggerRemap(){zn(`MappedStream{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.forEach(e=>{this.onParentUpdate(e,{init:De(()=>on(e.applogs))})})}onParentUpdate(e,t){zn(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate`,t);let r=this._eventMapper(t,e);if(zn(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate => mapped`,r),Dt(r))this._applogs.replace([...r.init]);else{for(let n of r.added)this._applogs.splice(mT(this._applogs,n,"ts"),0,n);if(r.removed){for(let n of r.removed)if(!this._applogs.remove(n))if(!Dt(t)&&t.removed?.includes(n))vT("Ignoring remove event for non-existent because it was part of parent event's removed",n,t);else throw $l(`MappedStream{${this.name}} toRemove contained log that doesn't exist`,n,{stream:this,event:t,mapResult:r})}}zn(`MappedStream{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Wn(this._applogs)),this.notifySubscribers(r)}},{WARN:rI,LOG:nI,DEBUG:iI,VERBOSE:Ca,ERROR:bT}=Ie.setup(Ie.INFO),Nr=et(function(e,t,r={}){let n=dd(t),i=es(n),a=Pe.array(De(()=>i(e.applogs)),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${xt(n)}}`}`}),o=m=>{let g;return Dt(m)?g={init:i(m.init)}:g={added:i(m.added),removed:m.removed},Ca(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,m,"=>",g),g},u=new ko(e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],a,o,`${e.name} | ${r.name||`rollingFilter{${xt(n)}}`}`),l=lv(()=>JSON.parse(JSON.stringify(t)),m=>{Ca(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",m),n=m,i=es(n),u.triggerRemap()}),c=ci(a,()=>{Ca(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} unobserve`,n),l(),c()});return u},{equals:pi,argsDebugName:(e,t,r)=>`${xt(t)}, ${xt(r)}`}),fd=et(function(e,t,r={}){let n=De(()=>t.call(null,{init:e.applogs},e));if(!Dt(n))throw bT("Initial run must return init event");let i=n.init;return new ko(e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t,`${e.name} | ${r.name||"rollingMapper"}`)},{equals:pi,argsDebugName:(e,t,r)=>`${xt(t)}, ${xt(r)}`}),wT=et(function(e,t,r){return r=Tt(r),r({init:e.applogs},t),e.subscribe(n=>{r(n,t)}),t},{argsDebugName:e=>`rollingAcc{${e.nameAndSizeUntracked}}`}),dd=function(e){let t=De(()=>Object.fromEntries(Object.entries(on(e)).map(([r,n])=>[on(r),on(n)])));if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function es(e){return t=>t.filter(r=>{for(let[n,i]of Object.entries(e)){let a=r[n.startsWith("!")?n.slice(1):n];if(!Ff(n,i,a))return!1}return!0})}var{WARN:oI,LOG:ti,DEBUG:Lr,VERBOSE:Se,ERROR:po}=Ie.setup(Ie.INFO,{prefix:"[q]"}),_T=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prev=r,hn(this,{allApplogs:He})}get record(){return this.variables}get allApplogs(){return this.prev?_s([this.logsOfThisNode,this.prev.allApplogs]):this.logsOfThisNode}},pd=class{constructor(e){this.nodes=e,hn(this,{allApplogs:He,size:He,isEmpty:He})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return De(()=>this.records.length)}get records(){return this.nodes.map(({variables:e})=>e)}get applogSets(){return this.nodes.map(({logsOfThisNode:e})=>e.applogs)}get applogStreams(){return this.nodes.map(({logsOfThisNode:e})=>e)}get allApplogs(){return _s(this.nodes.map(e=>e.allApplogs))}},TT=et(function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Se(`withoutHistory${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("withoutHistory")){if(r)return Lr("[withoutHistory] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw po("stream already filtered withoutHistory:",e.filters,{name:e.name})}let n,i=fd(e,function(a,o){let u=Dt(a),l,c=[],m=u?null:[];u?(n=new Map,l=a.init):l=a.added;let g;for(let R=t?0:l.length-1;t?R<l.length:R>=0;t?R++:R--){let j=l[R],q=xt([j.en,j.at]);if(g&&(t?g>j.ts:g<j.ts))throw po("withoutHistory.mapper logs not sorted:",g,t?">":"<",j.ts,{log:j,i:R,newLogs:l,inverseToOnlyReturnFirstLogs:t});g=j.ts;let Z=n.get(q);(!Z||(t?Z.ts>j.ts:Z.ts<j.ts))&&(Z&&!u&&m.push(Z),c.push(j),n.set(q,j))}return jr(c),Se.isDisabled||Se(`withoutHistory${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,u?{...Object.fromEntries(Object.entries(a).map(([R,j])=>[R,j?.length])),toAdd:c.length,toRemove:m}:{...a,toAdd:c,toRemove:m}),u?{init:c}:{added:c,removed:m}},{name:`withoutHistory${t?".inversed":""}`,extraFilterName:"withoutHistory"});return Se.isDisabled||kr(()=>{Se(`withoutHistory<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:pi}),aI=et(function(e){if(Se(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw po("stream already filtered withoutDeleted:",e.filters,{name:e.name});let t=Nr(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Se(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,De(()=>[...t.applogs]));let r=Yn({caller:"allDeletedEntities",stream:e}),n=Eo(()=>t.map(i=>i.en),{name:r});return Se.isDisabled||kr(()=>{Se(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),Nr(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:pi}),xT=et(function e(t,r,n={},i={}){Lr(`query<${t.nameAndSizeUntracked}>:`,r);let a=Array.isArray(r)?r:[r],o;if(a.length===1)o=null;else{let c=a.slice(0,-1);o=e(t,c,n,i)}let u=a[a.length-1],l=ET(t,o,u,i);return Se.isDisabled||kr(()=>Se("query result:",on(l))),l},{equals:ys}),ET=et(function(e,t,r,n={}){if(Lr(`queryStep<${e.nameAndSizeUntracked}> with`,t?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");let i=Eo(()=>{function a(o){let[u,l]=hs(r,o?.variables??{});Se("[queryStep] patternWithoutVars: ",u);let c=Nr(e,u),m=hd(l),g=c.map(j=>({log:j,vars:m(j)}));Se.isDisabled||Se("[queryStep] step node:",o?.variables," =>",g,"from:",De(()=>c.applogs));let R=g.map(({log:j,vars:q})=>{let Z=Object.assign({},o?.variables,q);return new _T(new Uo([j],e.filters,Yn({caller:"QueryNode",stream:c,pattern:`${xt(Z)}@${xt(u)}`}),!0,c),Z,o)});return n.debug&&ti("[queryStep] step result:",De(()=>R.map(({variables:j,logsOfThisNode:q})=>({variables:j,stream:q.applogs})))),R}return t?t.nodes.flatMap(a):a(null)},{name:Yn({caller:"queryStep",stream:e,pattern:r})});return Se("queryStep result:",i),new pd(i)},{equals:ys}),sI=et(function(e,t,r,n={}){let i=t.nodes;Lr(`queryNot<${e.nameAndSizeUntracked}> from: ${i.length} nodes`);let a=Array.isArray(r)?r:[r];for(let o of a){if(!Object.entries(r).length)throw new Error("Pattern is empty");i=i.filter(({variables:u})=>{let[l,c]=hs(o,u??{});Se("[queryNot] patternWithoutVars: ",l);let m=Nr(e,l);return Se("[queryNot] step node:",u," =>",m.size,"applogs"),Se.isDisabled||Se("[queryNot] step node:",u," => empty?",De(()=>m.applogs)),n.debug&&ti("[queryNot] node result:",u,"=>",m.applogs),m.isEmpty})}return new pd(i)},{equals:ys}),OT=et(function(e,t,r){Lr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=Nr(e,t);Se("[filterAndMap] filtered:",n.untrackedSize),Se.isDisabled||kr(()=>Se("[filterAndMap] filtered:",n.applogs));let i=function(){return typeof r=="function"?n.map(r):typeof r=="string"?n.map(u=>u[r]):n.map(hd(r))},a=Yn({stream:e,pattern:t,caller:"filterAndMap"}),o=Eo(i,{name:a});return Se.isDisabled||kr(()=>Se("[filterAndMap] mapped:",o)),o},{equals:Ze.structural}),uI=et(function(e,t,r,n={}){Lr(`queryAndMap<${e.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let i=Yn({stream:e,caller:"queryAndMap"}),a=xT(e,t);Se("[queryAndMap] filtered count:",a.untrackedSize);let o=Eo(()=>{if(typeof r=="function")return a.records.map(r);if(typeof r=="string")return a.records.map(u=>u[r]);throw new Error("what's this map param about?")},{name:i});return Se.isDisabled||kr(()=>Se("[queryAndMap] result:",on(o))),o},{equals:Ze.structural}),cI=et(function(e,t,r,n){Lr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=Nr(e,{en:r,at:AT(t,n)});return Se("queryEntity applogs:",i.applogs),He(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:a,vl:o})=>[a.slice(t.length+1),o])))},{equals:qv}),lI=et(function(e){ti(`agentsOfStream<${e.nameAndSizeUntracked}>`);let t=Pe.map();function r(n){for(let i of Dt(n)?n.init:n.added){let a=t.get(i.ag)??0;t.set(i.ag,a+1)}for(let i of!Dt(n)&&n.removed||[]){let a=t.get(i.ag);if(!a||a<1)throw po("[agentsOfStream] number is now negative",{log:i,event:n,mapped:t,prev:a});t.set(i.ag,a-1)}ti(`agentsOfStream<${e.nameAndSizeUntracked}> processed event`,{event:n,mapped:t})}return De(()=>r({init:e.applogs})),e.subscribe(r),mf(t,()=>e.unsubscribe(r)),t}),IT=et(function(e,t){return ti(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),He(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),fI=et(function(e,t){return He(()=>IT(e,t).get().length)});function hd(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function AT(e,t){return t.map(r=>ST(e,r))}function ST(e,t){return`${e}/${t}`}var{WARN:kl,LOG:dI,DEBUG:pI,VERBOSE:hI,ERROR:Ul}=Ie.setup(Ie.INFO);function yd(e){return!!e.ts}function md(e,t){return yd(e)?e:{...e,ts:t}}function gd(e,t){let{en:r,at:n}=e,i=OT(TT(t),{en:r,at:n},"cid");i.length>1&&kl("[withPv] unexpected result count:",i.length);let a=i.length?i[0]:null,o=a===e.pv;return e.pv&&!o&&kl("[withPv] different than pre-set pv:",{queriedPv:a,logPv:e.pv}),a=e.pv??a,{...e,pv:a??null}}function _s(e){if(e.length===0)throw Ul("joinStreams called with empty array");if(e.length===1)return e[0];let t=()=>jr(ps(e.flatMap(i=>{let a=i.applogs;if(!a)throw Ul("falsy applogs of stream",i),new Error("falsy applogs of stream");return a}))),r=De(()=>t()),n=Tt(function(i,a){return Dt(i)?{init:De(()=>t())}:{added:i.added.filter(o=>!this.hasApplog(o,!0)),removed:i.added.filter(o=>!this.parents.some(u=>u===a?!1:u.hasApplog(o,!0)))}});return new ko(e,["?"],r,n,`join(${e.map(i=>i.name).join(", ")})`)}var Ge=rr(Pr(),1),$T=rr(Fm(),1),vd=e=>Ge.Type.Union([e,Ge.Type.Null()]);var bd=/^(k51qz|baguq)[0-9a-z]{56,57}$/,kT=/^[0-9A-Fa-f]{7,8}$/g;Ge.FormatRegistry.Set("EntityID",e=>!!e.match(kT)||!!e.match(bd));var wd=Ge.Type.String();Ge.FormatRegistry.Set("CID",e=>!!e.match(bd));var UT=Ge.Type.String({format:"EntityID"}),jT=/^http([s]?):\/\/.*\..*/;Ge.FormatRegistry.Set("URL",e=>!!e.match(jT));var NT=Ge.Type.String({format:"URL"}),_d=Ge.Type.Object({en:wd,at:Ge.Type.String(),vl:vd(Ge.Type.Union([Ge.Type.String(),Ge.Type.Boolean(),Ge.Type.Number()])),ts:Ge.Type.String(),ag:Ge.Type.String()}),ho=$T.TypeCompiler.Compile(_d),Td=e=>Array.from(ho.Errors(e)),xd=ho.Check.bind(ho),{WARN:jl,LOG:PT,DEBUG:yI,VERBOSE:BT,ERROR:Ed}=Ie.setup(Ie.INFO),Od=class extends ms{constructor(e,t,r=[],n){super(e,t,r,n),hn(this,{insert:Tt})}insert(e){let t=Kf(),r=e.map(a=>{let o=md(a,t);if(!xd(o))throw Ed(`Bogus Applog ${JSON.stringify(o)}`,Td(o));let u=gd(o,this),l=Aa(u).toString(),c={...u,cid:l};return Object.freeze(c)}),n=ps(r);if(e.length!==n.length?jl("request to insert duplicate log, inserting mappedLogs:",{appLogsToInsert:e,mappedLogs:n}):e.length?PT("Inserting:",n.length===1?n[0]:n,{ds:this}):jl("request to insert empty logs array"),!n.length)return[];jr(n);let i=this._applogs.length&&Mf(n[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...n),i&&jr(this._applogs),this.notifySubscribers({added:n,removed:null}),this.persist(n),n}get readOnly(){return!1}},Uo=class ts extends Od{constructor(t,r,n,i,a=null){super(a,r,t,n),this._readOnly=i,hn(this,{_applogs:Pe.shallow})}static empty(t){return ts.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new ts(t,[],r??"in-memory",n)}get readOnly(){return this._readOnly}persist(t){if(BT("[InMem.persist] no persist for",t),this.readOnly)throw Ed("[persist] called for readOnly stream")}};var CT=Le((e,t)=>{"use strict";t.exports=o;var r=128,n=127,i=~n,a=Math.pow(2,31);function o(u,l,c){if(Number.MAX_SAFE_INTEGER&&u>Number.MAX_SAFE_INTEGER)throw o.bytes=0,new RangeError("Could not encode varint");l=l||[],c=c||0;for(var m=c;u>=a;)l[c++]=u&255|r,u/=128;for(;u&i;)l[c++]=u&255|r,u>>>=7;return l[c]=u|0,o.bytes=c-m+1,l}}),RT=Le((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(a,l){var u=0,l=l||0,c=0,m=l,g,R=a.length;do{if(m>=R||c>49)throw i.bytes=0,new RangeError("Could not decode varint");g=a[m++],u+=c<28?(g&n)<<c:(g&n)*Math.pow(2,c),c+=7}while(g>=r);return i.bytes=m-l,u}}),MT=Le((e,t)=>{"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),a=Math.pow(2,28),o=Math.pow(2,35),u=Math.pow(2,42),l=Math.pow(2,49),c=Math.pow(2,56),m=Math.pow(2,63);t.exports=function(g){return g<r?1:g<n?2:g<i?3:g<a?4:g<o?5:g<u?6:g<l?7:g<c?8:g<m?9:10}}),Is=Le((e,t)=>{"use strict";t.exports={encode:CT(),decode:RT(),encodingLength:MT()}}),LT=42;function DT(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return nr.decode(e.subarray(1))}var Sd={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Sd.tags[LT]=DT;var VT=e=>xa(e,Sd),Dr=rr(Is(),1),Ts={SHA2_256:18,LENGTH:32,DAG_PB:112},FT=40;function jo(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Dr.default.decode(e);return t.seek(Dr.default.decode.bytes),r}function zT(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=0;return{version:2,characteristics:[t.getBigUint64(r,!0),t.getBigUint64(r+=8,!0)],dataOffset:Number(t.getBigUint64(r+=8,!0)),dataSize:Number(t.getBigUint64(r+=8,!0)),indexOffset:Number(t.getBigUint64(r+=8,!0))}}function qT(e){Dr.default.decode(e);let t=Dr.default.decode.bytes,r=Dr.default.decode(e.subarray(Dr.default.decode.bytes)),n=Dr.default.decode.bytes;return t+n+r}var fr={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},hi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":fr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(fr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=hi["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 a=e[i];if(a=hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:fr.Int,CarV1HeaderOrV2Pragma:e=>{if(fr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=hi["CarV1HeaderOrV2Pragma > roots (anon)"](e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=hi.Int(e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},yi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":fr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(fr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=yi["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 a=e[i];if(a=yi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:fr.Int,CarV1HeaderOrV2Pragma:e=>{if(fr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=yi["CarV1HeaderOrV2Pragma > roots (anon)"](o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=yi.Int(o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},KT={toTyped:hi.CarV1HeaderOrV2Pragma,toRepresentation:yi.CarV1HeaderOrV2Pragma},pA=Ta(),hA=rr(Is(),1),yA=[new Y(N.map,2),new Y(N.string,"version"),new Y(N.uint,1),new Y(N.string,"roots")],mA=new Y(N.tag,42);async function $d(e,t){let r=jo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=VT(n);if(KT.toTyped(i)===void 0)throw new Error("Invalid CAR header format");if(i.version!==1&&i.version!==2||t!==void 0&&i.version!==t)throw new Error(`Invalid CAR version: ${i.version}${t!==void 0?` (expected ${t})`:""}`);if(i.version===1){if(!Array.isArray(i.roots))throw new Error("Invalid CAR header format");return i}if(i.roots!==void 0)throw new Error("Invalid CAR header format");let a=zT(await e.exactly(FT,!0));e.seek(a.dataOffset-e.pos);let o=await $d(e,1);return Object.assign(o,a)}async function GT(e){let t=await e.exactly(2,!1);if(t[0]===Ts.SHA2_256&&t[1]===Ts.LENGTH){let o=await e.exactly(34,!0),u=Vn(o);return nr.create(0,Ts.DAG_PB,u)}let r=jo(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=jo(await e.upTo(8),e),i=await e.exactly(qT(await e.upTo(8)),!0),a=Vn(i);return nr.create(r,n,a)}async function kd(e){let t=e.pos,r=jo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await GT(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function HT(e){let{cid:t,blockLength:r}=await kd(e);return{bytes:await e.exactly(r,!0),cid:t}}async function WT(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await kd(e),a={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(a.blockLength),a}function Ud(e){let t=(async()=>{let r=await $d(e);if(r.version===2){let n=e.pos-r.dataOffset;e=XT(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await HT(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await WT(e)}}}function jd(e){let t=0;return{async upTo(r){return e.subarray(t,t+Math.min(r,e.length-t))},async exactly(r,n=!1){if(r>e.length-t)throw new Error("Unexpected end of data");let i=e.subarray(t,t+r);return n&&(t+=r),i},seek(r){t+=r},get pos(){return t}}}function JT(e){let t=0,r=0,n=0,i=new Uint8Array(0),a=async o=>{r=i.length-n;let u=[i.subarray(n)];for(;r<o;){let c=await e();if(c==null)break;r<0?c.length>r&&u.push(c.subarray(-r)):u.push(c),r+=c.length}i=new Uint8Array(u.reduce((c,m)=>c+m.length,0));let l=0;for(let c of u)i.set(c,l),l+=c.length;n=0};return{async upTo(o){return i.length-n<o&&await a(o),i.subarray(n,n+Math.min(i.length-n,o))},async exactly(o,u=!1){if(i.length-n<o&&await a(o),i.length-n<o)throw new Error("Unexpected end of data");let l=i.subarray(n,n+o);return u&&(t+=o,n+=o),l},seek(o){t+=o,n+=o},get pos(){return t}}}function Nd(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return JT(r)}function XT(e,t){let r=0;return{async upTo(n){let i=await e.upTo(n);return i.length+r>t&&(i=i.subarray(0,t-r)),i},async exactly(n,i=!1){let a=await e.exactly(n,i);if(a.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),a},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var YT=class{constructor(e,t,r){this._version=e,this._roots=t,this._iterator=r}get version(){return this._version}async getRoots(){return this._roots}[Symbol.asyncIterator](){return this._iterator}static async fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Id(jd(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Id(Nd(e))}};async function Id(e){let t=Ud(e),{version:r,roots:n}=await t.header();return new YT(r,n,t.blocksIndex())}var Pd=class{constructor(e,t,r){this._version=e,this._roots=t,this._iterable=r,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},gA=class Es extends Pd{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Bd(t);return new Es(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Cd(t);return new Es(r,n,i)}},vA=class Os extends Pd{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;let t=this._iterable[Symbol.asyncIterator]();return{async next(){let r=await t.next();return r.done?r:{done:!1,value:r.value.cid}}}}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Bd(t);return new Os(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Cd(t);return new Os(r,n,i)}};async function Bd(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Rd(jd(e))}async function Cd(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Rd(Nd(e))}async function Rd(e){let t=Ud(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var bA=rr(Is(),1);var wA=class{constructor(e){this._iterator=e}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};var{WARN:QT,LOG:_A,DEBUG:xs,VERBOSE:TA,ERROR:Ad}=Ie.setup(Ie.INFO);async function As(e){let{roots:t,blocks:r}=await Md(e);if(!t||!r)throw Ad("decodeCar is funky",{roots:t,blocks:r});t.length!==1&&QT("Unexpected roots count:",t);let n=r.get(t[0]),i;xs("root:",n,{blocks:r}),n.info?(i=r.get(n.applogs.toString()).logs,xs("new format - infoLogs",r.get(n.info.toString()))):i=n.applogs;let a;return a=i.map(o=>{let u=o.toV1?o.toV1().toString():o["/"],l=r.get(u);if(!l)throw Ad("Could not find applog CID in Car file:",u,{root:n,blocks:r});return{...l,cid:u}}),xs("Decoded car logs:",n,{roots:t,blocks:r,applogs:a}),{applogs:a}}async function Md(e){let t=(await e.getRoots()).map(n=>n.toV1().toString()),r=new Map;for await(let{cid:n,bytes:i}of e.blocks())r.set(n.toV1().toString(),Wi(i));return{roots:t,blocks:r}}var{WARN:Ss,LOG:XA,DEBUG:Ld,VERBOSE:YA,ERROR:$s}=Mo.setup(Mo.DEBUG),ZT=["https://ipfs.4everland.io/ipfs/CID/?format=car&dag-scope=all","https://cloudflare-ipfs.com/ipfs/CID/?format=car&dag-scope=all"];async function QA(e,{readOnly:t=!0,pinnedCID:r}={}){let n;if(r)n=gt.parse(r);else try{n=await ex(e),Ld("Resolved pub to CID",n.toString())}catch(c){throw $s(`Failed to resolve IPNS ${e}:`,c)}let i=await tx(n),{applogs:a}=await As(i),o=a.filter(c=>c instanceof Uint8Array);o.length&&Ss(`Found ${o.length} encrypted logs - skipping`);let u=a.filter(c=>!(c instanceof Uint8Array));jr(u);let l=new Uo(u,[],`preview-${e}`,t);return{cid:n,dataStream:l}}async function ex(e){let r=await(await fetch(`https://name.web3.storage/name/${e}`)).json();return r.value.startsWith("/ipfs/")||console.warn("IPNS value is not ipfs:",r),gt.parse(r.value.replace("/ipfs/",""))}async function tx(e){Ld("Retrieving:",e);let t;for(let r of ZT){let n=r.replaceAll("CID",e.toString()),i=await fetch(n);(!i?.ok||!i?.body)&&(t=$s(`[retrieveCar] unexpected response ${i?.statusText}`,{url:n}),Ss("Gateway failed:",n,t)),t=rx(i.body.getReader())}if(t instanceof Error)throw t;return(await nx(t)).car}function rx(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}()}async function nx(e){let t=Jt(Xt(e)),r=await t.header(),n=[],i=!1;try{for await(let a of t.blocks())n.push(a);i=!0}catch(a){if($s("Failed to read car:",a,{blocks:n,header:r}),n.length===0)throw a;Ss(`Returning half-baked car with ${n.length} blocks`)}return{complete:i,car:new vr(r,n)}}export{QA as a,ex as b,tx as c};
|
|
32
|
+
`+" ".repeat(t)+a):a==="{"&&n>0?(n++,r+=a):(a==="}"&&n>1&&n--,r+=a)}return r}var{WARN:Hv,LOG:ZO,DEBUG:Wv,VERBOSE:eA,ERROR:ol}=Ae.setup(Ae.INFO,{prefix:"[thread]"});function Vt(e){return e.init!==void 0}var ms=class{constructor(e,t,r=[],n){if(this._applogs=r,this.name=n,this.parents=e&&!Array.isArray(e)?[e]:e,this.filters=t,this.parents?.length===0)throw new Error("Unhandled: empty parents");hn(this,{size:He,isEmpty:He,firstLog:He,latestLog:He},{name:`Thread{${n}}`})}filters;parents;_subscribers=[];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):Hv("unsubscribe called for non-existent",e)}notifySubscribers(e){Wv(`[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}map(e){return this.applogs.map||ol("applogs arr?!",this.applogs),this.applogs.map(e)}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);{let r=Object.keys(e);return!!this.applogs.find(n=>{if(!qf(r,Object.keys(n)))throw ol("[hasApplog] field set mismatch:",{applog:e,log:n});return Lf(n,e)})}}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 untrackedSize(){return De(()=>this.size)}get nameAndSizeUntracked(){return De(()=>`${this.name} (${this.size})`)}get prettyName(){return Gv(this.name)}};var Jv=typeof global=="object"&&global&&global.Object===Object&&global,Gf=Jv,Xv=typeof self=="object"&&self&&self.Object===Object&&self,Yv=Gf||Xv||Function("return this")(),zt=Yv,Qv=zt.Symbol,ur=Qv,Hf=Object.prototype,Zv=Hf.hasOwnProperty,eb=Hf.toString,Fn=ur?ur.toStringTag:void 0;function tb(e){var t=Zv.call(e,Fn),r=e[Fn];try{e[Fn]=void 0;var n=!0}catch{}var i=eb.call(e);return n&&(t?e[Fn]=r:delete e[Fn]),i}var rb=tb,nb=Object.prototype,ib=nb.toString;function ob(e){return ib.call(e)}var ab=ob,sb="[object Null]",ub="[object Undefined]",al=ur?ur.toStringTag:void 0;function cb(e){return e==null?e===void 0?ub:sb:al&&al in Object(e)?rb(e):ab(e)}var mn=cb;function lb(e){return e!=null&&typeof e=="object"}var cn=lb,fb="[object Symbol]";function db(e){return typeof e=="symbol"||cn(e)&&mn(e)==fb}var Qn=db;function pb(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 hb=pb,yb=Array.isArray,Ft=yb,mb=1/0,sl=ur?ur.prototype:void 0,ul=sl?sl.toString:void 0;function Wf(e){if(typeof e=="string")return e;if(Ft(e))return hb(e,Wf)+"";if(Qn(e))return ul?ul.call(e):"";var t=e+"";return t=="0"&&1/e==-mb?"-0":t}var gb=Wf;function vb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var gs=vb;function bb(e){return e}var wb=bb,_b="[object AsyncFunction]",Tb="[object Function]",xb="[object GeneratorFunction]",Eb="[object Proxy]";function Ob(e){if(!gs(e))return!1;var t=mn(e);return t==Tb||t==xb||t==_b||t==Eb}var Jf=Ob,Ab=zt["__core-js_shared__"],Na=Ab,cl=function(){var e=/[^.]+$/.exec(Na&&Na.keys&&Na.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Ib(e){return!!cl&&cl in e}var Sb=Ib,$b=Function.prototype,kb=$b.toString;function Ub(e){if(e!=null){try{return kb.call(e)}catch{}try{return e+""}catch{}}return""}var Mr=Ub,jb=/[\\^$.*+?()[\]{}|]/g,Nb=/^\[object .+?Constructor\]$/,Pb=Function.prototype,Bb=Object.prototype,Cb=Pb.toString,Rb=Bb.hasOwnProperty,Mb=RegExp("^"+Cb.call(Rb).replace(jb,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Lb(e){if(!gs(e)||Sb(e))return!1;var t=Jf(e)?Mb:Nb;return t.test(Mr(e))}var Db=Lb;function Vb(e,t){return e?.[t]}var Fb=Vb;function zb(e,t){var r=Fb(e,t);return Db(r)?r:void 0}var gn=zb,qb=gn(zt,"WeakMap"),Ja=qb,Kb=9007199254740991,Gb=/^(?:0|[1-9]\d*)$/;function Hb(e,t){var r=typeof e;return t=t??Kb,!!t&&(r=="number"||r!="symbol"&&Gb.test(e))&&e>-1&&e%1==0&&e<t}var Xf=Hb;function Wb(e,t){return e===t||e!==e&&t!==t}var Yf=Wb,Jb=9007199254740991;function Xb(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Jb}var vs=Xb;function Yb(e){return e!=null&&vs(e.length)&&!Jf(e)}var Qb=Yb,Zb=Object.prototype;function e0(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||Zb;return e===r}var t0=e0;function r0(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var n0=r0,i0="[object Arguments]";function o0(e){return cn(e)&&mn(e)==i0}var ll=o0,Qf=Object.prototype,a0=Qf.hasOwnProperty,s0=Qf.propertyIsEnumerable,u0=ll(function(){return arguments}())?ll:function(e){return cn(e)&&a0.call(e,"callee")&&!s0.call(e,"callee")},Zf=u0;function c0(){return!1}var l0=c0,ed=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fl=ed&&typeof module=="object"&&module&&!module.nodeType&&module,f0=fl&&fl.exports===ed,dl=f0?zt.Buffer:void 0,d0=dl?dl.isBuffer:void 0,p0=d0||l0,Xa=p0,h0="[object Arguments]",y0="[object Array]",m0="[object Boolean]",g0="[object Date]",v0="[object Error]",b0="[object Function]",w0="[object Map]",_0="[object Number]",T0="[object Object]",x0="[object RegExp]",E0="[object Set]",O0="[object String]",A0="[object WeakMap]",I0="[object ArrayBuffer]",S0="[object DataView]",$0="[object Float32Array]",k0="[object Float64Array]",U0="[object Int8Array]",j0="[object Int16Array]",N0="[object Int32Array]",P0="[object Uint8Array]",B0="[object Uint8ClampedArray]",C0="[object Uint16Array]",R0="[object Uint32Array]",Ne={};Ne[$0]=Ne[k0]=Ne[U0]=Ne[j0]=Ne[N0]=Ne[P0]=Ne[B0]=Ne[C0]=Ne[R0]=!0;Ne[h0]=Ne[y0]=Ne[I0]=Ne[m0]=Ne[S0]=Ne[g0]=Ne[v0]=Ne[b0]=Ne[w0]=Ne[_0]=Ne[T0]=Ne[x0]=Ne[E0]=Ne[O0]=Ne[A0]=!1;function M0(e){return cn(e)&&vs(e.length)&&!!Ne[mn(e)]}var L0=M0;function D0(e){return function(t){return e(t)}}var V0=D0,td=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Kn=td&&typeof module=="object"&&module&&!module.nodeType&&module,F0=Kn&&Kn.exports===td,Pa=F0&&Gf.process,z0=function(){try{var e=Kn&&Kn.require&&Kn.require("util").types;return e||Pa&&Pa.binding&&Pa.binding("util")}catch{}}(),pl=z0,hl=pl&&pl.isTypedArray,q0=hl?V0(hl):L0,rd=q0,K0=Object.prototype,G0=K0.hasOwnProperty;function H0(e,t){var r=Ft(e),n=!r&&Zf(e),i=!r&&!n&&Xa(e),a=!r&&!n&&!i&&rd(e),o=r||n||i||a,u=o?n0(e.length,String):[],l=u.length;for(var c in e)(t||G0.call(e,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||a&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||Xf(c,l)))&&u.push(c);return u}var W0=H0;function J0(e,t){return function(r){return e(t(r))}}var X0=J0,Y0=X0(Object.keys,Object),Q0=Y0,Z0=Object.prototype,ew=Z0.hasOwnProperty;function tw(e){if(!t0(e))return Q0(e);var t=[];for(var r in Object(e))ew.call(e,r)&&r!="constructor"&&t.push(r);return t}var rw=tw;function nw(e){return Qb(e)?W0(e):rw(e)}var nd=nw,iw=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ow=/^\w*$/;function aw(e,t){if(Ft(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Qn(e)?!0:ow.test(e)||!iw.test(e)||t!=null&&e in Object(t)}var bs=aw,sw=gn(Object,"create"),Zn=sw;function uw(){this.__data__=Zn?Zn(null):{},this.size=0}var cw=uw;function lw(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var fw=lw,dw="__lodash_hash_undefined__",pw=Object.prototype,hw=pw.hasOwnProperty;function yw(e){var t=this.__data__;if(Zn){var r=t[e];return r===dw?void 0:r}return hw.call(t,e)?t[e]:void 0}var mw=yw,gw=Object.prototype,vw=gw.hasOwnProperty;function bw(e){var t=this.__data__;return Zn?t[e]!==void 0:vw.call(t,e)}var ww=bw,_w="__lodash_hash_undefined__";function Tw(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Zn&&t===void 0?_w:t,this}var xw=Tw;function vn(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])}}vn.prototype.clear=cw;vn.prototype.delete=fw;vn.prototype.get=mw;vn.prototype.has=ww;vn.prototype.set=xw;var yl=vn;function Ew(){this.__data__=[],this.size=0}var Ow=Ew;function Aw(e,t){for(var r=e.length;r--;)if(Yf(e[r][0],t))return r;return-1}var Oo=Aw,Iw=Array.prototype,Sw=Iw.splice;function $w(e){var t=this.__data__,r=Oo(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():Sw.call(t,r,1),--this.size,!0}var kw=$w;function Uw(e){var t=this.__data__,r=Oo(t,e);return r<0?void 0:t[r][1]}var jw=Uw;function Nw(e){return Oo(this.__data__,e)>-1}var Pw=Nw;function Bw(e,t){var r=this.__data__,n=Oo(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var Cw=Bw;function bn(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])}}bn.prototype.clear=Ow;bn.prototype.delete=kw;bn.prototype.get=jw;bn.prototype.has=Pw;bn.prototype.set=Cw;var Ao=bn,Rw=gn(zt,"Map"),ei=Rw;function Mw(){this.size=0,this.__data__={hash:new yl,map:new(ei||Ao),string:new yl}}var Lw=Mw;function Dw(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Vw=Dw;function Fw(e,t){var r=e.__data__;return Vw(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Io=Fw;function zw(e){var t=Io(this,e).delete(e);return this.size-=t?1:0,t}var qw=zw;function Kw(e){return Io(this,e).get(e)}var Gw=Kw;function Hw(e){return Io(this,e).has(e)}var Ww=Hw;function Jw(e,t){var r=Io(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var Xw=Jw;function wn(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])}}wn.prototype.clear=Lw;wn.prototype.delete=qw;wn.prototype.get=Gw;wn.prototype.has=Ww;wn.prototype.set=Xw;var So=wn,Yw="Expected a function";function ws(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Yw);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i))return a.get(i);var o=e.apply(this,n);return r.cache=a.set(i,o)||a,o};return r.cache=new(ws.Cache||So),r}ws.Cache=So;var Qw=ws,Zw=500;function e1(e){var t=Qw(e,function(n){return r.size===Zw&&r.clear(),n}),r=t.cache;return t}var t1=e1,r1=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n1=/\\(\\)?/g,i1=t1(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(r1,function(r,n,i,a){t.push(i?a.replace(n1,"$1"):n||r)}),t}),o1=i1;function a1(e){return e==null?"":gb(e)}var s1=a1;function u1(e,t){return Ft(e)?e:bs(e,t)?[e]:o1(s1(e))}var id=u1,c1=1/0;function l1(e){if(typeof e=="string"||Qn(e))return e;var t=e+"";return t=="0"&&1/e==-c1?"-0":t}var $o=l1;function f1(e,t){t=id(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[$o(t[r++])];return r&&r==n?e:void 0}var od=f1;function d1(e,t,r){var n=e==null?void 0:od(e,t);return n===void 0?r:n}var p1=d1;function h1(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var y1=h1;function m1(){this.__data__=new Ao,this.size=0}var g1=m1;function v1(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var b1=v1;function w1(e){return this.__data__.get(e)}var _1=w1;function T1(e){return this.__data__.has(e)}var x1=T1,E1=200;function O1(e,t){var r=this.__data__;if(r instanceof Ao){var n=r.__data__;if(!ei||n.length<E1-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new So(n)}return r.set(e,t),this.size=r.size,this}var A1=O1;function _n(e){var t=this.__data__=new Ao(e);this.size=t.size}_n.prototype.clear=g1;_n.prototype.delete=b1;_n.prototype.get=_1;_n.prototype.has=x1;_n.prototype.set=A1;var no=_n;function I1(e,t){for(var r=-1,n=e==null?0:e.length,i=0,a=[];++r<n;){var o=e[r];t(o,r,e)&&(a[i++]=o)}return a}var S1=I1;function $1(){return[]}var k1=$1,U1=Object.prototype,j1=U1.propertyIsEnumerable,ml=Object.getOwnPropertySymbols,N1=ml?function(e){return e==null?[]:(e=Object(e),S1(ml(e),function(t){return j1.call(e,t)}))}:k1,P1=N1;function B1(e,t,r){var n=t(e);return Ft(e)?n:y1(n,r(e))}var C1=B1;function R1(e){return C1(e,nd,P1)}var gl=R1,M1=gn(zt,"DataView"),Ya=M1,L1=gn(zt,"Promise"),Qa=L1,D1=gn(zt,"Set"),Za=D1,vl="[object Map]",V1="[object Object]",bl="[object Promise]",wl="[object Set]",_l="[object WeakMap]",Tl="[object DataView]",F1=Mr(Ya),z1=Mr(ei),q1=Mr(Qa),K1=Mr(Za),G1=Mr(Ja),Or=mn;(Ya&&Or(new Ya(new ArrayBuffer(1)))!=Tl||ei&&Or(new ei)!=vl||Qa&&Or(Qa.resolve())!=bl||Za&&Or(new Za)!=wl||Ja&&Or(new Ja)!=_l)&&(Or=function(e){var t=mn(e),r=t==V1?e.constructor:void 0,n=r?Mr(r):"";if(n)switch(n){case F1:return Tl;case z1:return vl;case q1:return bl;case K1:return wl;case G1:return _l}return t});var xl=Or,H1=zt.Uint8Array,El=H1,W1="__lodash_hash_undefined__";function J1(e){return this.__data__.set(e,W1),this}var X1=J1;function Y1(e){return this.__data__.has(e)}var Q1=Y1;function fo(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new So;++t<r;)this.add(e[t])}fo.prototype.add=fo.prototype.push=X1;fo.prototype.has=Q1;var Z1=fo;function e_(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 t_=e_;function r_(e,t){return e.has(t)}var n_=r_,i_=1,o_=2;function a_(e,t,r,n,i,a){var o=r&i_,u=e.length,l=t.length;if(u!=l&&!(o&&l>u))return!1;var c=a.get(e),m=a.get(t);if(c&&m)return c==t&&m==e;var g=-1,R=!0,j=r&o_?new Z1:void 0;for(a.set(e,t),a.set(t,e);++g<u;){var q=e[g],Z=t[g];if(n)var ae=o?n(Z,q,g,t,e,a):n(q,Z,g,e,t,a);if(ae!==void 0){if(ae)continue;R=!1;break}if(j){if(!t_(t,function(B,V){if(!n_(j,V)&&(q===B||i(q,B,r,n,a)))return j.push(V)})){R=!1;break}}else if(!(q===Z||i(q,Z,r,n,a))){R=!1;break}}return a.delete(e),a.delete(t),R}var ad=a_;function s_(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var u_=s_;function c_(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var l_=c_,f_=1,d_=2,p_="[object Boolean]",h_="[object Date]",y_="[object Error]",m_="[object Map]",g_="[object Number]",v_="[object RegExp]",b_="[object Set]",w_="[object String]",__="[object Symbol]",T_="[object ArrayBuffer]",x_="[object DataView]",Ol=ur?ur.prototype:void 0,Ba=Ol?Ol.valueOf:void 0;function E_(e,t,r,n,i,a,o){switch(r){case x_:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case T_:return!(e.byteLength!=t.byteLength||!a(new El(e),new El(t)));case p_:case h_:case g_:return Yf(+e,+t);case y_:return e.name==t.name&&e.message==t.message;case v_:case w_:return e==t+"";case m_:var u=u_;case b_:var l=n&f_;if(u||(u=l_),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;n|=d_,o.set(e,t);var m=ad(u(e),u(t),n,i,a,o);return o.delete(e),m;case __:if(Ba)return Ba.call(e)==Ba.call(t)}return!1}var O_=E_,A_=1,I_=Object.prototype,S_=I_.hasOwnProperty;function $_(e,t,r,n,i,a){var o=r&A_,u=gl(e),l=u.length,c=gl(t),m=c.length;if(l!=m&&!o)return!1;for(var g=l;g--;){var R=u[g];if(!(o?R in t:S_.call(t,R)))return!1}var j=a.get(e),q=a.get(t);if(j&&q)return j==t&&q==e;var Z=!0;a.set(e,t),a.set(t,e);for(var ae=o;++g<l;){R=u[g];var B=e[R],V=t[R];if(n)var H=o?n(V,B,R,t,e,a):n(B,V,R,e,t,a);if(!(H===void 0?B===V||i(B,V,r,n,a):H)){Z=!1;break}ae||(ae=R=="constructor")}if(Z&&!ae){var se=e.constructor,F=t.constructor;se!=F&&"constructor"in e&&"constructor"in t&&!(typeof se=="function"&&se instanceof se&&typeof F=="function"&&F instanceof F)&&(Z=!1)}return a.delete(e),a.delete(t),Z}var k_=$_,U_=1,Al="[object Arguments]",Il="[object Array]",Zi="[object Object]",j_=Object.prototype,Sl=j_.hasOwnProperty;function N_(e,t,r,n,i,a){var o=Ft(e),u=Ft(t),l=o?Il:xl(e),c=u?Il:xl(t);l=l==Al?Zi:l,c=c==Al?Zi:c;var m=l==Zi,g=c==Zi,R=l==c;if(R&&Xa(e)){if(!Xa(t))return!1;o=!0,m=!1}if(R&&!m)return a||(a=new no),o||rd(e)?ad(e,t,r,n,i,a):O_(e,t,l,r,n,i,a);if(!(r&U_)){var j=m&&Sl.call(e,"__wrapped__"),q=g&&Sl.call(t,"__wrapped__");if(j||q){var Z=j?e.value():e,ae=q?t.value():t;return a||(a=new no),i(Z,ae,r,n,a)}}return R?(a||(a=new no),k_(e,t,r,n,i,a)):!1}var P_=N_;function sd(e,t,r,n,i){return e===t?!0:e==null||t==null||!cn(e)&&!cn(t)?e!==e&&t!==t:P_(e,t,r,n,sd,i)}var ud=sd,B_=1,C_=2;function R_(e,t,r,n){var i=r.length,a=i,o=!n;if(e==null)return!a;for(e=Object(e);i--;){var u=r[i];if(o&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++i<a;){u=r[i];var l=u[0],c=e[l],m=u[1];if(o&&u[2]){if(c===void 0&&!(l in e))return!1}else{var g=new no;if(n)var R=n(c,m,l,e,t,g);if(!(R===void 0?ud(m,c,B_|C_,n,g):R))return!1}}return!0}var M_=R_;function L_(e){return e===e&&!gs(e)}var cd=L_;function D_(e){for(var t=nd(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,cd(i)]}return t}var V_=D_;function F_(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var ld=F_;function z_(e){var t=V_(e);return t.length==1&&t[0][2]?ld(t[0][0],t[0][1]):function(r){return r===e||M_(r,e,t)}}var q_=z_;function K_(e,t){return e!=null&&t in Object(e)}var G_=K_;function H_(e,t,r){t=id(t,e);for(var n=-1,i=t.length,a=!1;++n<i;){var o=$o(t[n]);if(!(a=e!=null&&r(e,o)))break;e=e[o]}return a||++n!=i?a:(i=e==null?0:e.length,!!i&&vs(i)&&Xf(o,i)&&(Ft(e)||Zf(e)))}var W_=H_;function J_(e,t){return e!=null&&W_(e,t,G_)}var X_=J_,Y_=1,Q_=2;function Z_(e,t){return bs(e)&&cd(t)?ld($o(e),t):function(r){var n=p1(r,e);return n===void 0&&n===t?X_(r,e):ud(t,n,Y_|Q_)}}var eT=Z_;function tT(e){return function(t){return t?.[e]}}var rT=tT;function nT(e){return function(t){return od(t,e)}}var iT=nT;function oT(e){return bs(e)?rT($o(e)):iT(e)}var aT=oT;function sT(e){return typeof e=="function"?e:e==null?wb:typeof e=="object"?Ft(e)?eT(e[0],e[1]):q_(e):aT(e)}var uT=sT,cT=4294967295,lT=cT-1,fT=Math.floor,dT=Math.min;function pT(e,t,r,n){var i=0,a=e==null?0:e.length;if(a===0)return 0;t=r(t);for(var o=t!==t,u=t===null,l=Qn(t),c=t===void 0;i<a;){var m=fT((i+a)/2),g=r(e[m]),R=g!==void 0,j=g===null,q=g===g,Z=Qn(g);if(o)var ae=n||q;else c?ae=q&&(n||R):u?ae=q&&R&&(n||!j):l?ae=q&&R&&!j&&(n||!Z):j||Z?ae=!1:ae=n?g<=t:g<t;ae?i=m+1:a=m}return dT(a,lT)}var hT=pT;function yT(e,t,r){return hT(e,t,uT(r,2))}var mT=yT,{WARN:gT,LOG:tA,DEBUG:vT,VERBOSE:zn,ERROR:$l}=Ae.setup(Ae.INFO),ko=class extends ms{constructor(e,t,r,n,i){super(e,t,Pe.array([...r],{deep:!1,name:`${i}.array`}),i),this._initialLogs=r,this._eventMapper=n,this.name=i,hn(this,{onParentUpdate:Tt}),this.subscribeToParent()}_parentSubscriptions=new Map;get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}subscribeToParent(){if(this.parents.length||gT("MappedThread has no parents",this),this._parentSubscriptions.size)throw $l("parents subs must not be called twice",this);zn(`[MappedThread: ${this.name}] subscribing to parents:`,this.parents.map(e=>e.name)),this.parents.forEach(e=>{let t=this.onParentUpdate.bind(this,e);e.subscribe(t),this._parentSubscriptions.set(e,t)})}triggerRemap(){zn(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.forEach(e=>{this.onParentUpdate(e,{init:De(()=>on(e.applogs))})})}onParentUpdate(e,t){zn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,t);let r=this._eventMapper(t,e);if(zn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,r),Vt(r))this._applogs.replace([...r.init]);else{for(let n of r.added)this._applogs.splice(mT(this._applogs,n,"ts"),0,n);if(r.removed){for(let n of r.removed)if(!this._applogs.remove(n))if(!Vt(t)&&t.removed?.includes(n))vT("Ignoring remove event for non-existent because it was part of parent event's removed",n,t);else throw $l(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,n,{thread:this,event:t,mapResult:r})}}zn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Wn(this._applogs)),this.notifySubscribers(r)}},{WARN:rA,LOG:nA,DEBUG:iA,VERBOSE:Ca,ERROR:bT}=Ae.setup(Ae.INFO),Nr=et(function(e,t,r={}){let n=dd(t),i=es(n),a=Pe.array(De(()=>i(e.applogs)),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${xt(n)}}`}`}),o=m=>{let g;return Vt(m)?g={init:i(m.init)}:g={added:i(m.added),removed:m.removed},Ca(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,m,"=>",g),g},u=new ko(e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],a,o,`${e.name} | ${r.name||`rollingFilter{${xt(n)}}`}`),l=lv(()=>JSON.parse(JSON.stringify(t)),m=>{Ca(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",m),n=m,i=es(n),u.triggerRemap()}),c=ci(a,()=>{Ca(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} unobserve`,n),l(),c()});return u},{equals:pi,argsDebugName:(e,t,r)=>`${xt(t)}, ${xt(r)}`}),fd=et(function(e,t,r={}){let n=De(()=>t.call(null,{init:e.applogs},e));if(!Vt(n))throw bT("Initial run must return init event");let i=n.init;return new ko(e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t,`${e.name} | ${r.name||"rollingMapper"}`)},{equals:pi,argsDebugName:(e,t,r)=>`${xt(t)}, ${xt(r)}`}),wT=et(function(e,t,r){return r=Tt(r),r({init:e.applogs},t),e.subscribe(n=>{r(n,t)}),t},{argsDebugName:e=>`rollingAcc{${e.nameAndSizeUntracked}}`}),dd=function(e){let t=De(()=>Object.fromEntries(Object.entries(on(e)).map(([r,n])=>[on(r),on(n)])));if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function es(e){return t=>t.filter(r=>{for(let[n,i]of Object.entries(e)){let a=r[n.startsWith("!")?n.slice(1):n];if(!Ff(n,i,a))return!1}return!0})}var{WARN:oA,LOG:ti,DEBUG:Lr,VERBOSE:Se,ERROR:po}=Ae.setup(Ae.INFO,{prefix:"[q]"}),_T=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prev=r,hn(this,{allApplogs:He})}get record(){return this.variables}get allApplogs(){return this.prev?_s([this.logsOfThisNode,this.prev.allApplogs]):this.logsOfThisNode}},pd=class{constructor(e){this.nodes=e,hn(this,{allApplogs:He,size:He,isEmpty:He})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return De(()=>this.records.length)}get records(){return this.nodes.map(({variables:e})=>e)}get applogSets(){return this.nodes.map(({logsOfThisNode:e})=>e.applogs)}get applogThreads(){return this.nodes.map(({logsOfThisNode:e})=>e)}get allApplogs(){return _s(this.nodes.map(e=>e.allApplogs))}},TT=et(function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Se(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return Lr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw po("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=fd(e,function(a,o){let u=Vt(a),l,c=[],m=u?null:[];u?(n=new Map,l=a.init):l=a.added;let g;for(let R=t?0:l.length-1;t?R<l.length:R>=0;t?R++:R--){let j=l[R],q=xt([j.en,j.at]);if(g&&(t?g>j.ts:g<j.ts))throw po("lastWriteWins.mapper logs not sorted:",g,t?">":"<",j.ts,{log:j,i:R,newLogs:l,inverseToOnlyReturnFirstLogs:t});g=j.ts;let Z=n.get(q);(!Z||(t?Z.ts>j.ts:Z.ts<j.ts))&&(Z&&!u&&m.push(Z),c.push(j),n.set(q,j))}return jr(c),Se.isDisabled||Se(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,u?{...Object.fromEntries(Object.entries(a).map(([R,j])=>[R,j?.length])),toAdd:c.length,toRemove:m}:{...a,toAdd:c,toRemove:m}),u?{init:c}:{added:c,removed:m}},{name:`lastWriteWins${t?".inversed":""}`,extraFilterName:"lastWriteWins"});return Se.isDisabled||kr(()=>{Se(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:pi}),aA=et(function(e){if(Se(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw po("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=Nr(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Se(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,De(()=>[...t.applogs]));let r=Yn({caller:"allDeletedEntities",thread:e}),n=Eo(()=>t.map(i=>i.en),{name:r});return Se.isDisabled||kr(()=>{Se(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),Nr(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:pi}),xT=et(function e(t,r,n={},i={}){Lr(`query<${t.nameAndSizeUntracked}>:`,r);let a=Array.isArray(r)?r:[r],o;if(a.length===1)o=null;else{let c=a.slice(0,-1);o=e(t,c,n,i)}let u=a[a.length-1],l=ET(t,o,u,i);return Se.isDisabled||kr(()=>Se("query result:",on(l))),l},{equals:ys}),ET=et(function(e,t,r,n={}){if(Lr(`queryStep<${e.nameAndSizeUntracked}> with`,t?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");let i=Eo(()=>{function a(o){let[u,l]=hs(r,o?.variables??{});Se("[queryStep] patternWithoutVars: ",u);let c=Nr(e,u),m=hd(l),g=c.map(j=>({log:j,vars:m(j)}));Se.isDisabled||Se("[queryStep] step node:",o?.variables," =>",g,"from:",De(()=>c.applogs));let R=g.map(({log:j,vars:q})=>{let Z=Object.assign({},o?.variables,q);return new _T(new Uo([j],e.filters,Yn({caller:"QueryNode",thread:c,pattern:`${xt(Z)}@${xt(u)}`}),!0,c),Z,o)});return n.debug&&ti("[queryStep] step result:",De(()=>R.map(({variables:j,logsOfThisNode:q})=>({variables:j,thread:q.applogs})))),R}return t?t.nodes.flatMap(a):a(null)},{name:Yn({caller:"queryStep",thread:e,pattern:r})});return Se("queryStep result:",i),new pd(i)},{equals:ys}),sA=et(function(e,t,r,n={}){let i=t.nodes;Lr(`queryNot<${e.nameAndSizeUntracked}> from: ${i.length} nodes`);let a=Array.isArray(r)?r:[r];for(let o of a){if(!Object.entries(r).length)throw new Error("Pattern is empty");i=i.filter(({variables:u})=>{let[l,c]=hs(o,u??{});Se("[queryNot] patternWithoutVars: ",l);let m=Nr(e,l);return Se("[queryNot] step node:",u," =>",m.size,"applogs"),Se.isDisabled||Se("[queryNot] step node:",u," => empty?",De(()=>m.applogs)),n.debug&&ti("[queryNot] node result:",u,"=>",m.applogs),m.isEmpty})}return new pd(i)},{equals:ys}),OT=et(function(e,t,r){Lr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=Nr(e,t);Se("[filterAndMap] filtered:",n.untrackedSize),Se.isDisabled||kr(()=>Se("[filterAndMap] filtered:",n.applogs));let i=function(){return typeof r=="function"?n.map(r):typeof r=="string"?n.map(u=>u[r]):n.map(hd(r))},a=Yn({thread:e,pattern:t,caller:"filterAndMap"}),o=Eo(i,{name:a});return Se.isDisabled||kr(()=>Se("[filterAndMap] mapped:",o)),o},{equals:Ze.structural}),uA=et(function(e,t,r,n={}){Lr(`queryAndMap<${e.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let i=Yn({thread:e,caller:"queryAndMap"}),a=xT(e,t);Se("[queryAndMap] filtered count:",a.untrackedSize);let o=Eo(()=>{if(typeof r=="function")return a.records.map(r);if(typeof r=="string")return a.records.map(u=>u[r]);throw new Error("what's this map param about?")},{name:i});return Se.isDisabled||kr(()=>Se("[queryAndMap] result:",on(o))),o},{equals:Ze.structural}),cA=et(function(e,t,r,n){Lr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=Nr(e,{en:r,at:IT(t,n)});return Se("queryEntity applogs:",i.applogs),He(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:a,vl:o})=>[a.slice(t.length+1),o])))},{equals:qv}),lA=et(function(e){ti(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Pe.map();function r(n){for(let i of Vt(n)?n.init:n.added){let a=t.get(i.ag)??0;t.set(i.ag,a+1)}for(let i of!Vt(n)&&n.removed||[]){let a=t.get(i.ag);if(!a||a<1)throw po("[agentsOfThread] number is now negative",{log:i,event:n,mapped:t,prev:a});t.set(i.ag,a-1)}ti(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:n,mapped:t})}return De(()=>r({init:e.applogs})),e.subscribe(r),mf(t,()=>e.unsubscribe(r)),t}),AT=et(function(e,t){return ti(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),He(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),fA=et(function(e,t){return He(()=>AT(e,t).get().length)});function hd(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function IT(e,t){return t.map(r=>ST(e,r))}function ST(e,t){return`${e}/${t}`}var{WARN:kl,LOG:dA,DEBUG:pA,VERBOSE:hA,ERROR:Ul}=Ae.setup(Ae.INFO);function yd(e){return!!e.ts}function md(e,t){return yd(e)?e:{...e,ts:t}}function gd(e,t){let{en:r,at:n}=e,i=OT(TT(t),{en:r,at:n},"cid");i.length>1&&kl("[withPv] unexpected result count:",i.length);let a=i.length?i[0]:null,o=a===e.pv;return e.pv&&!o&&kl("[withPv] different than pre-set pv:",{queriedPv:a,logPv:e.pv}),a=e.pv??a,{...e,pv:a??null}}function _s(e){if(e.length===0)throw Ul("joinThreads called with empty array");if(e.length===1)return e[0];let t=()=>jr(ps(e.flatMap(i=>{let a=i.applogs;if(!a)throw Ul("falsy applogs of thread",i),new Error("falsy applogs of thread");return a}))),r=De(()=>t()),n=Tt(function(i,a){return Vt(i)?{init:De(()=>t())}:{added:i.added.filter(o=>!this.hasApplog(o,!0)),removed:i.added.filter(o=>!this.parents.some(u=>u===a?!1:u.hasApplog(o,!0)))}});return new ko(e,["?"],r,n,`join(${e.map(i=>i.name).join(", ")})`)}var Ge=nr(Pr(),1),$T=nr(Fm(),1),vd=e=>Ge.Type.Union([e,Ge.Type.Null()]);var bd=/^(k51qz|baguq)[0-9a-z]{56,57}$/,kT=/^[0-9A-Fa-f]{7,8}$/g;Ge.FormatRegistry.Set("EntityID",e=>!!e.match(kT)||!!e.match(bd));var wd=Ge.Type.String();Ge.FormatRegistry.Set("CID",e=>!!e.match(bd));var UT=Ge.Type.String({format:"EntityID"}),jT=/^http([s]?):\/\/.*\..*/;Ge.FormatRegistry.Set("URL",e=>!!e.match(jT));var NT=Ge.Type.String({format:"URL"}),_d=Ge.Type.Object({en:wd,at:Ge.Type.String(),vl:vd(Ge.Type.Union([Ge.Type.String(),Ge.Type.Boolean(),Ge.Type.Number()])),ts:Ge.Type.String(),ag:Ge.Type.String()}),ho=$T.TypeCompiler.Compile(_d),Td=e=>Array.from(ho.Errors(e)),xd=ho.Check.bind(ho),{WARN:jl,LOG:PT,DEBUG:yA,VERBOSE:BT,ERROR:Ed}=Ae.setup(Ae.INFO),Od=class extends ms{constructor(e,t,r=[],n){super(e,t,r,n),hn(this,{insert:Tt})}insert(e){let t=Kf(),r=e.map(a=>{let o=md(a,t);if(!xd(o))throw Ed(`Bogus Applog ${JSON.stringify(o)}`,Td(o));let u=gd(o,this),l=Ia(u).toString(),c={...u,cid:l};return Object.freeze(c)}),n=ps(r);if(e.length!==n.length?jl("request to insert duplicate log, inserting mappedLogs:",{appLogsToInsert:e,mappedLogs:n}):e.length?PT("Inserting:",n.length===1?n[0]:n,{ds:this}):jl("request to insert empty logs array"),!n.length)return[];jr(n);let i=this._applogs.length&&Mf(n[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...n),i&&jr(this._applogs),this.notifySubscribers({added:n,removed:null}),this.persist(n),n}get readOnly(){return!1}},Uo=class ts extends Od{constructor(t,r,n,i,a=null){super(a,r,t,n),this._readOnly=i,hn(this,{_applogs:Pe.shallow})}static empty(t){return ts.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new ts(t,[],r??"in-memory",n)}get readOnly(){return this._readOnly}persist(t){if(BT("[InMem.persist] no persist for",t),this.readOnly)throw Ed("[persist] called for readOnly thread")}};var CT=Le((e,t)=>{"use strict";t.exports=o;var r=128,n=127,i=~n,a=Math.pow(2,31);function o(u,l,c){if(Number.MAX_SAFE_INTEGER&&u>Number.MAX_SAFE_INTEGER)throw o.bytes=0,new RangeError("Could not encode varint");l=l||[],c=c||0;for(var m=c;u>=a;)l[c++]=u&255|r,u/=128;for(;u&i;)l[c++]=u&255|r,u>>>=7;return l[c]=u|0,o.bytes=c-m+1,l}}),RT=Le((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(a,l){var u=0,l=l||0,c=0,m=l,g,R=a.length;do{if(m>=R||c>49)throw i.bytes=0,new RangeError("Could not decode varint");g=a[m++],u+=c<28?(g&n)<<c:(g&n)*Math.pow(2,c),c+=7}while(g>=r);return i.bytes=m-l,u}}),MT=Le((e,t)=>{"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),a=Math.pow(2,28),o=Math.pow(2,35),u=Math.pow(2,42),l=Math.pow(2,49),c=Math.pow(2,56),m=Math.pow(2,63);t.exports=function(g){return g<r?1:g<n?2:g<i?3:g<a?4:g<o?5:g<u?6:g<l?7:g<c?8:g<m?9:10}}),As=Le((e,t)=>{"use strict";t.exports={encode:CT(),decode:RT(),encodingLength:MT()}}),LT=42;function DT(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Rt.decode(e.subarray(1))}var Sd={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Sd.tags[LT]=DT;var VT=e=>xa(e,Sd),Dr=nr(As(),1),Ts={SHA2_256:18,LENGTH:32,DAG_PB:112},FT=40;function jo(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=Dr.default.decode(e);return t.seek(Dr.default.decode.bytes),r}function zT(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),r=0;return{version:2,characteristics:[t.getBigUint64(r,!0),t.getBigUint64(r+=8,!0)],dataOffset:Number(t.getBigUint64(r+=8,!0)),dataSize:Number(t.getBigUint64(r+=8,!0)),indexOffset:Number(t.getBigUint64(r+=8,!0))}}function qT(e){Dr.default.decode(e);let t=Dr.default.decode.bytes,r=Dr.default.decode(e.subarray(Dr.default.decode.bytes)),n=Dr.default.decode.bytes;return t+n+r}var fr={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},hi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":fr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(fr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=hi["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 a=e[i];if(a=hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:fr.Int,CarV1HeaderOrV2Pragma:e=>{if(fr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=hi["CarV1HeaderOrV2Pragma > roots (anon)"](e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=hi.Int(e[a]);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},yi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":fr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(fr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=yi["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 a=e[i];if(a=yi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](a),a===void 0)return;n.push(a)}return n}}return e}},Int:fr.Int,CarV1HeaderOrV2Pragma:e=>{if(fr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[a,o]=t[i];switch(a){case"roots":{let u=yi["CarV1HeaderOrV2Pragma > roots (anon)"](o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.roots=u}}break;case"version":{n--;let u=yi.Int(o);if(u===void 0)return;if(u!==o||r!==e){if(r===e){r={};for(let l=0;l<i;l++)r[t[l][0]]=t[l][1]}r.version=u}}break;default:return}}if(!(n>0))return r}},KT={toTyped:hi.CarV1HeaderOrV2Pragma,toRepresentation:yi.CarV1HeaderOrV2Pragma},pI=Ta(),hI=nr(As(),1),yI=[new Y(N.map,2),new Y(N.string,"version"),new Y(N.uint,1),new Y(N.string,"roots")],mI=new Y(N.tag,42);async function $d(e,t){let r=jo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=VT(n);if(KT.toTyped(i)===void 0)throw new Error("Invalid CAR header format");if(i.version!==1&&i.version!==2||t!==void 0&&i.version!==t)throw new Error(`Invalid CAR version: ${i.version}${t!==void 0?` (expected ${t})`:""}`);if(i.version===1){if(!Array.isArray(i.roots))throw new Error("Invalid CAR header format");return i}if(i.roots!==void 0)throw new Error("Invalid CAR header format");let a=zT(await e.exactly(FT,!0));e.seek(a.dataOffset-e.pos);let o=await $d(e,1);return Object.assign(o,a)}async function GT(e){let t=await e.exactly(2,!1);if(t[0]===Ts.SHA2_256&&t[1]===Ts.LENGTH){let o=await e.exactly(34,!0),u=Vn(o);return Rt.create(0,Ts.DAG_PB,u)}let r=jo(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=jo(await e.upTo(8),e),i=await e.exactly(qT(await e.upTo(8)),!0),a=Vn(i);return Rt.create(r,n,a)}async function kd(e){let t=e.pos,r=jo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await GT(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function HT(e){let{cid:t,blockLength:r}=await kd(e);return{bytes:await e.exactly(r,!0),cid:t}}async function WT(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await kd(e),a={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(a.blockLength),a}function Ud(e){let t=(async()=>{let r=await $d(e);if(r.version===2){let n=e.pos-r.dataOffset;e=XT(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await HT(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await WT(e)}}}function jd(e){let t=0;return{async upTo(r){return e.subarray(t,t+Math.min(r,e.length-t))},async exactly(r,n=!1){if(r>e.length-t)throw new Error("Unexpected end of data");let i=e.subarray(t,t+r);return n&&(t+=r),i},seek(r){t+=r},get pos(){return t}}}function JT(e){let t=0,r=0,n=0,i=new Uint8Array(0),a=async o=>{r=i.length-n;let u=[i.subarray(n)];for(;r<o;){let c=await e();if(c==null)break;r<0?c.length>r&&u.push(c.subarray(-r)):u.push(c),r+=c.length}i=new Uint8Array(u.reduce((c,m)=>c+m.length,0));let l=0;for(let c of u)i.set(c,l),l+=c.length;n=0};return{async upTo(o){return i.length-n<o&&await a(o),i.subarray(n,n+Math.min(i.length-n,o))},async exactly(o,u=!1){if(i.length-n<o&&await a(o),i.length-n<o)throw new Error("Unexpected end of data");let l=i.subarray(n,n+o);return u&&(t+=o,n+=o),l},seek(o){t+=o,n+=o},get pos(){return t}}}function Nd(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return JT(r)}function XT(e,t){let r=0;return{async upTo(n){let i=await e.upTo(n);return i.length+r>t&&(i=i.subarray(0,t-r)),i},async exactly(n,i=!1){let a=await e.exactly(n,i);if(a.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),a},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var YT=class{constructor(e,t,r){this._version=e,this._roots=t,this._iterator=r}get version(){return this._version}async getRoots(){return this._roots}[Symbol.asyncIterator](){return this._iterator}static async fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Ad(jd(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Ad(Nd(e))}};async function Ad(e){let t=Ud(e),{version:r,roots:n}=await t.header();return new YT(r,n,t.blocksIndex())}var Pd=class{constructor(e,t,r){this._version=e,this._roots=t,this._iterable=r,this._decoded=!1}get version(){return this._version}async getRoots(){return this._roots}},gI=class Es extends Pd{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");return this._decoded=!0,this._iterable[Symbol.asyncIterator]()}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Bd(t);return new Es(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Cd(t);return new Es(r,n,i)}},vI=class Os extends Pd{[Symbol.asyncIterator](){if(this._decoded)throw new Error("Cannot decode more than once");if(!this._iterable)throw new Error("Block iterable not found");this._decoded=!0;let t=this._iterable[Symbol.asyncIterator]();return{async next(){let r=await t.next();return r.done?r:{done:!1,value:r.value.cid}}}}static async fromBytes(t){let{version:r,roots:n,iterator:i}=await Bd(t);return new Os(r,n,i)}static async fromIterable(t){let{version:r,roots:n,iterator:i}=await Cd(t);return new Os(r,n,i)}};async function Bd(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return Rd(jd(e))}async function Cd(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Rd(Nd(e))}async function Rd(e){let t=Ud(e),{version:r,roots:n}=await t.header();return{version:r,roots:n,iterator:t.blocks()}}var bI=nr(As(),1);var wI=class{constructor(e){this._iterator=e}[Symbol.asyncIterator](){if(this._iterating)throw new Error("Multiple iterator not supported");return this._iterating=!0,this._iterator}};var{WARN:QT,LOG:_I,DEBUG:xs,VERBOSE:TI,ERROR:Id}=Ae.setup(Ae.INFO);async function Is(e){let{roots:t,blocks:r}=await Md(e);if(!t||!r)throw Id("decodeCar is funky",{roots:t,blocks:r});t.length!==1&&QT("Unexpected roots count:",t);let n=r.get(t[0]),i;xs("root:",n,{blocks:r}),n.info?(i=r.get(n.applogs.toString()).logs,xs("new format - infoLogs",r.get(n.info.toString()))):i=n.applogs;let a;return a=i.map(o=>{let u=o.toV1?o.toV1().toString():o["/"],l=r.get(u);if(!l)throw Id("Could not find applog CID in Car file:",u,{root:n,blocks:r});return l.pv instanceof Rt&&(l.pv=l.pv.toV1().toString()),{...l,cid:u}}),xs("Decoded car logs:",n,{roots:t,blocks:r,applogs:a}),{applogs:a}}async function Md(e){let t=(await e.getRoots()).map(n=>n.toV1().toString()),r=new Map;for await(let{cid:n,bytes:i}of e.blocks())r.set(n.toV1().toString(),Wi(i));return{roots:t,blocks:r}}var{WARN:Ss,LOG:XI,DEBUG:Ld,VERBOSE:YI,ERROR:$s}=Mo.setup(Mo.DEBUG),ZT=["https://ipfs.4everland.io/ipfs/CID/?format=car&dag-scope=all","https://cloudflare-ipfs.com/ipfs/CID/?format=car&dag-scope=all"];async function QI(e,{readOnly:t=!0,pinnedCID:r}={}){let n;if(r)n=gt.parse(r);else try{n=await ex(e),Ld("Resolved pub to CID",n.toString())}catch(c){throw $s(`Failed to resolve IPNS ${e}:`,c)}let i=await tx(n),{applogs:a}=await Is(i),o=a.filter(c=>c instanceof Uint8Array);o.length&&Ss(`Found ${o.length} encrypted logs - skipping`);let u=a.filter(c=>!(c instanceof Uint8Array));jr(u);let l=new Uo(u,[],`preview-${e}`,t);return{cid:n,thread:l}}async function ex(e){let r=await(await fetch(`https://name.web3.storage/name/${e}`)).json();return r.value.startsWith("/ipfs/")||console.warn("IPNS value is not ipfs:",r),gt.parse(r.value.replace("/ipfs/",""))}async function tx(e){Ld("Retrieving:",e);let t;for(let r of ZT){let n=r.replaceAll("CID",e.toString()),i=await fetch(n);(!i?.ok||!i?.body)&&(t=$s(`[retrieveCar] unexpected response ${i?.statusText}`,{url:n}),Ss("Gateway failed:",n,t)),t=rx(i.body.getReader())}if(t instanceof Error)throw t;return(await nx(t)).car}function rx(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(t)break;yield r}}()}async function nx(e){let t=Xt(Yt(e)),r=await t.header(),n=[],i=!1;try{for await(let a of t.blocks())n.push(a);i=!0}catch(a){if($s("Failed to read car:",a,{blocks:n,header:r}),n.length===0)throw a;Ss(`Returning half-baked car with ${n.length} blocks`)}return{complete:i,car:new vr(r,n)}}export{QI as a,ex as b,tx as c};
|
|
33
33
|
/*! Bundled license information:
|
|
34
34
|
|
|
35
35
|
@noble/hashes/esm/utils.js:
|
|
@@ -48,4 +48,4 @@ lodash-es/lodash.js:
|
|
|
48
48
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
49
49
|
*)
|
|
50
50
|
*/
|
|
51
|
-
//# sourceMappingURL=chunk-
|
|
51
|
+
//# sourceMappingURL=chunk-IRRRPVEK.min.js.map
|