@wovin/connect-nftstorage 0.1.25 → 0.1.27
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.
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import{e as Ts}from"./chunk-BKKH6BET.min.js";var wy=Object.create,Wf=Object.defineProperty,_y=Object.getOwnPropertyDescriptor,Ty=Object.getOwnPropertyNames,Ey=Object.getPrototypeOf,Oy=Object.prototype.hasOwnProperty,Gn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xy=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ty(t))!Oy.call(e,i)&&i!==r&&Wf(e,i,{get:()=>t[i],enumerable:!(n=_y(t,i))||n.enumerable});return e},Yi=(e,t,r)=>(r=e!=null?wy(Ey(e)):{},xy(t||!e||!e.__esModule?Wf(r,"default",{value:e,enumerable:!0}):r,e)),Ay=Gn((e,t)=>{"use strict";t.exports=a;var r=128,n=127,i=~n,o=Math.pow(2,31);function a(s,u,l){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw a.bytes=0,new RangeError("Could not encode varint");u=u||[],l=l||0;for(var f=l;s>=o;)u[l++]=s&255|r,s/=128;for(;s&i;)u[l++]=s&255|r,s>>>=7;return u[l]=s|0,a.bytes=l-f+1,u}}),Sy=Gn((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,$=o.length;do{if(f>=$||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}),Iy=Gn((e,t)=>{"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}),Ou=Gn((e,t)=>{"use strict";t.exports={encode:Ay(),decode:Sy(),encodingLength:Iy()}}),$y=Gn(e=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},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",o=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),a=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=o,e.isDeno=a}),ky=Gn((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,o=n.cmp&&function(s){return function(u){return function(l,f){var d={key:l,value:u[l]},$={key:f,value:u[f]};return s(d,$)}}}(n.cmp),a=[];return function s(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,$=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<$.length;l++){var E=$[l],T=s(u[E]);T&&(f&&(f+=","),f+=JSON.stringify(E)+":"+T)}return a.splice(d,1),"{"+f+"}"}}(r)}}),jy=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function Ny(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="symbol"?t:t==="function"?"Function":Array.isArray(e)?"Array":e instanceof Uint8Array?"Uint8Array":e.constructor===Object?"Object":Cy(e)||"Object"}function Cy(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(jy.includes(t))return t}var G=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};G.uint=new G(0,"uint",!0);G.negint=new G(1,"negint",!0);G.bytes=new G(2,"bytes",!0);G.string=new G(3,"string",!0);G.array=new G(4,"array",!1);G.map=new G(5,"map",!1);G.tag=new G(6,"tag",!1);G.float=new G(7,"float",!0);G.false=new G(7,"false",!0);G.true=new G(7,"true",!0);G.null=new G(7,"null",!0);G.undefined=new G(7,"undefined",!0);G.break=new G(7,"break",!0);var me=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}`}},Xi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Uy=new TextEncoder;function Fo(e){return Xi&&globalThis.Buffer.isBuffer(e)}function xu(e){return e instanceof Uint8Array?Fo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Py=24,Ry=200,My=Xi?e=>e.length>=Py?globalThis.Buffer.from(e):Gl(e):e=>e.length>=Ry?Uy.encode(e):Gl(e),dr=e=>Uint8Array.from(e),Dy=Xi?(e,t,r)=>Fo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ly=Xi?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),xu(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},By=Xi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Jf(e,t){if(Fo(e)&&Fo(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 Gl(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}var Vy=256,Qf=class{constructor(e=Vy){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=By(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=Dy(r,0,this.cursor)}else t=Ly(this.chunks,this.cursor);return e&&this.reset(),t}},Fy=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},xe="CBOR decode error:",Yf="CBOR encode error:",Zi=[];Zi[23]=1;Zi[24]=2;Zi[25]=3;Zi[26]=5;Zi[27]=9;function Hn(e,t,r){if(e.length-t<r)throw new Error(`${xe} not enough data for type`)}var rt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function fn(e,t,r){Hn(e,t,1);let n=e[t];if(r.strict===!0&&n<rt[0])throw new Error(`${xe} integer encoded in more bytes than necessary (strict decode)`);return n}function dn(e,t,r){Hn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<rt[1])throw new Error(`${xe} integer encoded in more bytes than necessary (strict decode)`);return n}function pn(e,t,r){Hn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<rt[2])throw new Error(`${xe} integer encoded in more bytes than necessary (strict decode)`);return n}function hn(e,t,r){Hn(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],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<rt[3])throw new Error(`${xe} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${xe} integers outside of the safe integer range are not supported`)}function zy(e,t,r,n){return new me(G.uint,fn(e,t+1,n),2)}function qy(e,t,r,n){return new me(G.uint,dn(e,t+1,n),3)}function Ky(e,t,r,n){return new me(G.uint,pn(e,t+1,n),5)}function Gy(e,t,r,n){return new me(G.uint,hn(e,t+1,n),9)}function yn(e,t){return Dt(e,0,t.value)}function Dt(e,t,r){if(r<rt[0]){let n=Number(r);e.push([t|n])}else if(r<rt[1]){let n=Number(r);e.push([t|24,n])}else if(r<rt[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<rt[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<rt[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${xe} encountered BigInt larger than allowable range`)}}yn.encodedSize=function(e){return Dt.encodedSize(e.value)};Dt.encodedSize=function(e){return e<rt[0]?1:e<rt[1]?2:e<rt[2]?3:e<rt[3]?5:9};yn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Hy(e,t,r,n){return new me(G.negint,-1-fn(e,t+1,n),2)}function Wy(e,t,r,n){return new me(G.negint,-1-dn(e,t+1,n),3)}function Jy(e,t,r,n){return new me(G.negint,-1-pn(e,t+1,n),5)}var Au=BigInt(-1),Xf=BigInt(1);function Qy(e,t,r,n){let i=hn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new me(G.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${xe} integers outside of the safe integer range are not supported`);return new me(G.negint,Au-BigInt(i),9)}function Su(e,t){let r=t.value,n=typeof r=="bigint"?r*Au-Xf:r*-1-1;Dt(e,t.type.majorEncoded,n)}Su.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Au-Xf:t*-1-1;return r<rt[0]?1:r<rt[1]?2:r<rt[2]?3:r<rt[3]?5:9};Su.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function eo(e,t,r,n){Hn(e,t,r+n);let i=e.slice(t+r,t+r+n);return new me(G.bytes,i,r+n)}function Yy(e,t,r,n){return eo(e,t,1,r)}function Xy(e,t,r,n){return eo(e,t,2,fn(e,t+1,n))}function Zy(e,t,r,n){return eo(e,t,3,dn(e,t+1,n))}function eg(e,t,r,n){return eo(e,t,5,pn(e,t+1,n))}function tg(e,t,r,n){let i=hn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${xe} 64-bit integer bytes lengths not supported`);return eo(e,t,9,i)}function zo(e){return e.encodedBytes===void 0&&(e.encodedBytes=G.equals(e.type,G.string)?My(e.value):e.value),e.encodedBytes}function Ca(e,t){let r=zo(t);Dt(e,t.type.majorEncoded,r.length),e.push(r)}Ca.encodedSize=function(e){let t=zo(e);return Dt.encodedSize(t.length)+t.length};Ca.compareTokens=function(e,t){return rg(zo(e),zo(t))};function rg(e,t){return e.length<t.length?-1:e.length>t.length?1:Jf(e,t)}var Hl=new TextDecoder,ng=32;function ig(e,t,r){if(r-t<ng){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return Hl.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return Hl.decode(e.subarray(t,r))}function to(e,t,r,n,i){let o=r+n;Hn(e,t,o);let a=new me(G.string,ig(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function og(e,t,r,n){return to(e,t,1,r,n)}function ag(e,t,r,n){return to(e,t,2,fn(e,t+1,n),n)}function sg(e,t,r,n){return to(e,t,3,dn(e,t+1,n),n)}function ug(e,t,r,n){return to(e,t,5,pn(e,t+1,n),n)}function lg(e,t,r,n){let i=hn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${xe} 64-bit integer string lengths not supported`);return to(e,t,9,i,n)}var cg=Ca;function Wn(e,t,r,n){return new me(G.array,n,r)}function fg(e,t,r,n){return Wn(e,t,1,r)}function dg(e,t,r,n){return Wn(e,t,2,fn(e,t+1,n))}function pg(e,t,r,n){return Wn(e,t,3,dn(e,t+1,n))}function hg(e,t,r,n){return Wn(e,t,5,pn(e,t+1,n))}function yg(e,t,r,n){let i=hn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${xe} 64-bit integer array lengths not supported`);return Wn(e,t,9,i)}function gg(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${xe} indefinite length items not allowed`);return Wn(e,t,1,1/0)}function Iu(e,t){Dt(e,G.array.majorEncoded,t.value)}Iu.compareTokens=yn.compareTokens;Iu.encodedSize=function(e){return Dt.encodedSize(e.value)};function Jn(e,t,r,n){return new me(G.map,n,r)}function mg(e,t,r,n){return Jn(e,t,1,r)}function bg(e,t,r,n){return Jn(e,t,2,fn(e,t+1,n))}function vg(e,t,r,n){return Jn(e,t,3,dn(e,t+1,n))}function wg(e,t,r,n){return Jn(e,t,5,pn(e,t+1,n))}function _g(e,t,r,n){let i=hn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${xe} 64-bit integer map lengths not supported`);return Jn(e,t,9,i)}function Tg(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${xe} indefinite length items not allowed`);return Jn(e,t,1,1/0)}function $u(e,t){Dt(e,G.map.majorEncoded,t.value)}$u.compareTokens=yn.compareTokens;$u.encodedSize=function(e){return Dt.encodedSize(e.value)};function Eg(e,t,r,n){return new me(G.tag,r,1)}function Og(e,t,r,n){return new me(G.tag,fn(e,t+1,n),2)}function xg(e,t,r,n){return new me(G.tag,dn(e,t+1,n),3)}function Ag(e,t,r,n){return new me(G.tag,pn(e,t+1,n),5)}function Sg(e,t,r,n){return new me(G.tag,hn(e,t+1,n),9)}function ku(e,t){Dt(e,G.tag.majorEncoded,t.value)}ku.compareTokens=yn.compareTokens;ku.encodedSize=function(e){return Dt.encodedSize(e.value)};var Zf=20,ed=21,td=22,rd=23;function Ig(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${xe} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new me(G.null,null,1):new me(G.undefined,void 0,1)}function $g(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${xe} indefinite length items not allowed`);return new me(G.break,void 0,1)}function ju(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${xe} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${xe} Infinity values are not supported`)}return new me(G.float,e,t)}function kg(e,t,r,n){return ju(Cu(e,t+1),3,n)}function jg(e,t,r,n){return ju(Uu(e,t+1),5,n)}function Ng(e,t,r,n){return ju(ad(e,t+1),9,n)}function Nu(e,t,r){let n=t.value;if(n===!1)e.push([G.float.majorEncoded|Zf]);else if(n===!0)e.push([G.float.majorEncoded|ed]);else if(n===null)e.push([G.float.majorEncoded|td]);else if(n===void 0)e.push([G.float.majorEncoded|rd]);else{let i,o=!1;(!r||r.float64!==!0)&&(id(n),i=Cu(zt,1),n===i||Number.isNaN(n)?(zt[0]=249,e.push(zt.slice(0,3)),o=!0):(od(n),i=Uu(zt,1),n===i&&(zt[0]=250,e.push(zt.slice(0,5)),o=!0))),o||(Cg(n),i=ad(zt,1),zt[0]=251,e.push(zt.slice(0,9)))}}Nu.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){id(r);let n=Cu(zt,1);if(r===n||Number.isNaN(r))return 3;if(od(r),n=Uu(zt,1),r===n)return 5}return 9};var nd=new ArrayBuffer(9),xt=new DataView(nd,1),zt=new Uint8Array(nd,0);function id(e){if(e===1/0)xt.setUint16(0,31744,!1);else if(e===-1/0)xt.setUint16(0,64512,!1);else if(Number.isNaN(e))xt.setUint16(0,32256,!1);else{xt.setFloat32(0,e);let t=xt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)xt.setUint16(0,31744,!1);else if(r===0)xt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?xt.setUint16(0,0):i<-14?xt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):xt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Cu(e,t){if(e.length-t<2)throw new Error(`${xe} 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,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function od(e){xt.setFloat32(0,e,!1)}function Uu(e,t){if(e.length-t<4)throw new Error(`${xe} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function Cg(e){xt.setFloat64(0,e,!1)}function ad(e,t){if(e.length-t<8)throw new Error(`${xe} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Nu.compareTokens=yn.compareTokens;function ke(e,t,r){throw new Error(`${xe} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ua(e){return()=>{throw new Error(`${xe} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=ke;ue[24]=zy;ue[25]=qy;ue[26]=Ky;ue[27]=Gy;ue[28]=ke;ue[29]=ke;ue[30]=ke;ue[31]=ke;for(let e=32;e<=55;e++)ue[e]=ke;ue[56]=Hy;ue[57]=Wy;ue[58]=Jy;ue[59]=Qy;ue[60]=ke;ue[61]=ke;ue[62]=ke;ue[63]=ke;for(let e=64;e<=87;e++)ue[e]=Yy;ue[88]=Xy;ue[89]=Zy;ue[90]=eg;ue[91]=tg;ue[92]=ke;ue[93]=ke;ue[94]=ke;ue[95]=Ua("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ue[e]=og;ue[120]=ag;ue[121]=sg;ue[122]=ug;ue[123]=lg;ue[124]=ke;ue[125]=ke;ue[126]=ke;ue[127]=Ua("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ue[e]=fg;ue[152]=dg;ue[153]=pg;ue[154]=hg;ue[155]=yg;ue[156]=ke;ue[157]=ke;ue[158]=ke;ue[159]=gg;for(let e=160;e<=183;e++)ue[e]=mg;ue[184]=bg;ue[185]=vg;ue[186]=wg;ue[187]=_g;ue[188]=ke;ue[189]=ke;ue[190]=ke;ue[191]=Tg;for(let e=192;e<=215;e++)ue[e]=Eg;ue[216]=Og;ue[217]=xg;ue[218]=Ag;ue[219]=Sg;ue[220]=ke;ue[221]=ke;ue[222]=ke;ue[223]=ke;for(let e=224;e<=243;e++)ue[e]=Ua("simple values are not supported");ue[244]=ke;ue[245]=ke;ue[246]=ke;ue[247]=Ig;ue[248]=Ua("simple values are not supported");ue[249]=kg;ue[250]=jg;ue[251]=Ng;ue[252]=ke;ue[253]=ke;ue[254]=ke;ue[255]=$g;var ur=[];for(let e=0;e<24;e++)ur[e]=new me(G.uint,e,1);for(let e=-1;e>=-24;e--)ur[31-e]=new me(G.negint,e,1);ur[64]=new me(G.bytes,new Uint8Array(0),1);ur[96]=new me(G.string,"",1);ur[128]=new me(G.array,0,1);ur[160]=new me(G.map,0,1);ur[244]=new me(G.false,!1,1);ur[245]=new me(G.true,!0,1);ur[246]=new me(G.null,null,1);function Ug(e){switch(e.type){case G.false:return dr([244]);case G.true:return dr([245]);case G.null:return dr([246]);case G.bytes:return e.value.length?void 0:dr([64]);case G.string:return e.value===""?dr([96]):void 0;case G.array:return e.value===0?dr([128]):void 0;case G.map:return e.value===0?dr([160]):void 0;case G.uint:return e.value<24?dr([Number(e.value)]):void 0;case G.negint:if(e.value>=-24)return dr([31-Number(e.value)])}}var Pg=Object.freeze({float64:!0,mapSorter:Bg,quickEncodeToken:Ug});function Rg(){let e=[];return e[G.uint.major]=yn,e[G.negint.major]=Su,e[G.bytes.major]=Ca,e[G.string.major]=cg,e[G.array.major]=Iu,e[G.map.major]=$u,e[G.tag.major]=ku,e[G.float.major]=Nu,e}var Mg=Rg(),Dg=new Qf,Wl=class sd{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(`${Yf} object contains circular references`);return new sd(r,t)}},$r={null:new me(G.null,null),undefined:new me(G.undefined,void 0),true:new me(G.true,!0),false:new me(G.false,!1),emptyArray:new me(G.array,0),emptyMap:new me(G.map,0)},Vr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new me(G.float,e):e>=0?new me(G.uint,e):new me(G.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new me(G.uint,e):new me(G.negint,e)},Uint8Array(e,t,r,n){return new me(G.bytes,e)},string(e,t,r,n){return new me(G.string,e)},boolean(e,t,r,n){return e?$r.true:$r.false},null(e,t,r,n){return $r.null},undefined(e,t,r,n){return $r.undefined},ArrayBuffer(e,t,r,n){return new me(G.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new me(G.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[$r.emptyArray,new me(G.break)]:$r.emptyArray;n=Wl.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=$o(a,r,n);return r.addBreakTokens?[new me(G.array,e.length),i,new me(G.break)]:[new me(G.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length,s;if(a){s=new Array(a),n=Wl.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[$o(f,r,n),$o(d,r,n)])}l<a&&(s.length=l)}return s?.length?(Lg(s,r),r.addBreakTokens?[new me(G.map,s.length),s,new me(G.break)]:[new me(G.map,s.length),s]):r.addBreakTokens===!0?[$r.emptyMap,new me(G.break)]:$r.emptyMap}};Vr.Map=Vr.Object;Vr.Buffer=Vr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Vr[`${e}Array`]=Vr.DataView;function $o(e,t={},r){let n=Ny(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Vr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Vr[n];if(!o)throw new Error(`${Yf} unsupported type: ${n}`);return o(e,n,t,r)}function Lg(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Bg(e,t){if(e[0]instanceof me&&t[0]instanceof me){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Jl(r.value)),n._keyBytes||(n._keyBytes=Jl(n.value)),Jf(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Jl(e){return Vg(e,Mg,Pg)}function ud(e,t,r,n){if(Array.isArray(t))for(let i of t)ud(e,i,r,n);else r[t.type.major](e,t,n)}var pN=G.uint.majorEncoded,hN=G.negint.majorEncoded,yN=G.bytes.majorEncoded,gN=G.string.majorEncoded,mN=G.array.majorEncoded,bN=G.float.majorEncoded|Zf,vN=G.float.majorEncoded|ed,wN=G.float.majorEncoded|td,_N=G.float.majorEncoded|rd,TN=BigInt(-1),EN=BigInt(1);function Vg(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Fy(n):Dg,a=$o(e,r);if(!Array.isArray(a)&&r.quickEncodeToken){let s=r.quickEncodeToken(a);if(s)return i?(o.push(s),o.toBytes()):s;let u=t[a.type.major];if(u.encodedSize){let l=u.encodedSize(a,r);if(i||(o=new Qf(l)),u(o,a,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${a} was wrong`);return i?o.toBytes():xu(o.chunks[0])}}return o.reset(),ud(o,a,t,r),o.toBytes(!0)}var Fg={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},zg=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=ur[e];if(t===void 0){let r=ue[e];if(!r)throw new Error(`${xe} 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}},Mi=Symbol.for("DONE"),Pa=Symbol.for("BREAK");function qg(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Di(t,r);if(o===Pa){if(e.value===1/0)break;throw new Error(`${xe} got unexpected break to lengthed array`)}if(o===Mi)throw new Error(`${xe} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Kg(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},a=n?new Map:void 0;for(let s=0;s<e.value;s++){let u=Di(t,r);if(u===Pa){if(e.value===1/0)break;throw new Error(`${xe} got unexpected break to lengthed map`)}if(u===Mi)throw new Error(`${xe} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!n&&typeof u!="string")throw new Error(`${xe} non-string keys not supported (got ${typeof u})`);if(i&&(n&&a.has(u)||!n&&Object.hasOwn(o,u)))throw new Error(`${xe} found repeat map key "${u}"`);let l=Di(t,r);if(l===Mi)throw new Error(`${xe} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?a.set(u,l):o[u]=l}return n?a:o}function Di(e,t){if(e.done())return Mi;let r=e.next();if(G.equals(r.type,G.break))return Pa;if(r.type.terminal)return r.value;if(G.equals(r.type,G.array))return qg(r,e,t);if(G.equals(r.type,G.map))return Kg(r,e,t);if(G.equals(r.type,G.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Di(e,t);return t.tags[r.value](n)}throw new Error(`${xe} tag not supported (${r.value})`)}throw new Error("unsupported")}function Gg(e,t){if(!(e instanceof Uint8Array))throw new Error(`${xe} data to decode must be a Uint8Array`);t=Object.assign({},Fg,t);let r=xu(e),n=t.tokenizer||new zg(r,t),i=Di(n,t);if(i===Mi)throw new Error(`${xe} did not find any content to decode`);if(i===Pa)throw new Error(`${xe} got unexpected break`);return[i,e.subarray(n.pos())]}function Hg(e,t){let[r,n]=Gg(e,t);if(n.length>0)throw new Error(`${xe} too many terminals, data makes no sense`);return r}var ON=new Uint8Array(0);function Wg(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function Pu(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 Jg(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 o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var B=0,W=0,M=0,k=T.length;M!==k&&T[M]===0;)M++,B++;for(var F=(k-M)*f+1>>>0,K=new Uint8Array(F);M!==k;){for(var D=T[M],Q=0,q=F-1;(D!==0||Q<W)&&q!==-1;q--,Q++)D+=256*K[q]>>>0,K[q]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");W=Q,M++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var j=u.repeat(B);te<F;++te)j+=e.charAt(K[te]);return j}function $(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var B=0;if(T[B]!==" "){for(var W=0,M=0;T[B]===u;)W++,B++;for(var k=(T.length-B)*l+1>>>0,F=new Uint8Array(k);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var D=0,Q=k-1;(K!==0||D<M)&&Q!==-1;Q--,D++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");M=D,B++}if(T[B]!==" "){for(var q=k-M;q!==k&&F[q]===0;)q++;for(var te=new Uint8Array(W+(k-q)),j=W;q!==k;)te[j++]=F[q++];return te}}}function E(T){var B=$(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:$,decode:E}}var Qg=Jg,Yg=Qg,Xg=Yg,Zg=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},em=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){this.name=e,this.prefix=t;let n=t.codePointAt(0);if(n===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ld(this,e)}},tm=class{decoders;constructor(e){this.decoders=e}or(e){return ld(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function ld(e,t){return new tm({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var rm=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Zg(e,t,r),this.decoder=new em(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function cd({name:e,prefix:t,encode:r,decode:n}){return new rm(e,t,r,n)}function Ra({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Xg(r,e);return cd({prefix:t,name:e,encode:n,decode:o=>Pu(i(o))})}function nm(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function im(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function om(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Tr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=om(n);return cd({prefix:t,name:e,encode(o){return im(o,n,r)},decode(o){return nm(o,i,r,e)}})}var ko=Tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),xN=Tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),AN=Tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),SN=Tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),IN=Tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),$N=Tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kN=Tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),jN=Tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),NN=Tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Es=Ra({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),CN=Ra({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Ur=Ra({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),UN=Ra({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),am=fd,Ql=128,sm=127,um=~sm,lm=Math.pow(2,31);function fd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=lm;)t[r++]=e&255|Ql,e/=128;for(;e&um;)t[r++]=e&255|Ql,e>>>=7;return t[r]=e|0,fd.bytes=r-n+1,t}var cm=Fs,fm=128,Yl=127;function Fs(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Fs.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Yl)<<i:(a&Yl)*Math.pow(2,i),i+=7}while(a>=fm);return Fs.bytes=o-n,r}var dm=Math.pow(2,7),pm=Math.pow(2,14),hm=Math.pow(2,21),ym=Math.pow(2,28),gm=Math.pow(2,35),mm=Math.pow(2,42),bm=Math.pow(2,49),vm=Math.pow(2,56),wm=Math.pow(2,63),_m=function(e){return e<dm?1:e<pm?2:e<hm?3:e<ym?4:e<gm?5:e<mm?6:e<bm?7:e<vm?8:e<wm?9:10},Tm={encode:am,decode:cm,encodingLength:_m},Em=Tm,qo=Em;function zs(e,t=0){return[qo.decode(e,t),qo.decode.bytes]}function Ko(e,t,r=0){return qo.encode(e,t,r),t}function Go(e){return qo.encodingLength(e)}function Om(e,t){let r=t.byteLength,n=Go(e),i=n+Go(r),o=new Uint8Array(i+r);return Ko(e,o,0),Ko(r,o,n),o.set(t,i),new Ru(e,r,t,o)}function xm(e){let t=Pu(e),[r,n]=zs(t),[i,o]=zs(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Ru(r,i,a,t)}function Am(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Wg(e.bytes,r.bytes)}}var Ru=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Xl(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Im(r,qs(e),t??Ur.encoder);default:return $m(r,qs(e),t??ko.encoder)}}var Zl=new WeakMap;function qs(e){let t=Zl.get(e);if(t==null){let r=new Map;return Zl.set(e,r),r}return t}var dd=class st{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==wi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==km)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return st.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=Om(t,r);return st.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 st.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Am(t.multihash,n.multihash)}toString(t){return Xl(this,t)}toJSON(){return{"/":Xl(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof st)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new st(n,i,o,a??ec(n,i,o.bytes))}else if(r[jm]===!0){let{version:n,multihash:i,code:o}=r,a=xm(i);return st.create(n,o,a)}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!==wi)throw new Error(`Version 0 CID must use dag-pb (code: ${wi}) block encoding`);return new st(t,r,n,n.bytes)}case 1:{let i=ec(t,r,n.bytes);return new st(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return st.create(0,wi,t)}static createV1(t,r){return st.create(1,t,r)}static decode(t){let[r,n]=st.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=st.inspectBytes(t),n=r.size-r.multihashSize,i=Pu(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new Ru(r.multihashCode,r.digestSize,o,i);return[r.version===0?st.createV0(a):st.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,$]=zs(t.subarray(r));return r+=$,d},i=n(),o=wi;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=Sm(t,r),o=st.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return qs(o).set(n,t),o}};function Sm(e,t){switch(e[0]){case"Q":{let r=t??Ur;return[Ur.prefix,r.decode(`${Ur.prefix}${e}`)]}case Ur.prefix:{let r=t??Ur;return[Ur.prefix,r.decode(e)]}case ko.prefix:{let r=t??ko;return[ko.prefix,r.decode(e)]}case Es.prefix:{let r=t??Es;return[Es.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function Im(e,t,r){let{prefix:n}=r;if(n!==Ur.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function $m(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var wi=112,km=18;function ec(e,t,r){let n=Go(e),i=n+Go(t),o=new Uint8Array(i+r.byteLength);return Ko(e,o,0),Ko(t,o,n),o.set(r,i),o}var jm=Symbol.for("@ipld/js-cid/CID"),pd=42;function Nm(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=dd.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new me(G.tag,pd),new me(G.bytes,r)]}function Cm(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Um(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 tc={float64:!0,typeEncoders:{Object:Nm,undefined:Cm,number:Um}},PN={...tc,typeEncoders:{...tc.typeEncoders}};function Pm(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return dd.decode(e.subarray(1))}var Ho={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Ho.tags[pd]=Pm;var RN={...Ho,tags:Ho.tags.slice()},Rm=e=>Hg(e,Ho),MN=new Uint8Array(0);function Mm(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function Mu(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 Dm(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 o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var B=0,W=0,M=0,k=T.length;M!==k&&T[M]===0;)M++,B++;for(var F=(k-M)*f+1>>>0,K=new Uint8Array(F);M!==k;){for(var D=T[M],Q=0,q=F-1;(D!==0||Q<W)&&q!==-1;q--,Q++)D+=256*K[q]>>>0,K[q]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");W=Q,M++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var j=u.repeat(B);te<F;++te)j+=e.charAt(K[te]);return j}function $(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var B=0;if(T[B]!==" "){for(var W=0,M=0;T[B]===u;)W++,B++;for(var k=(T.length-B)*l+1>>>0,F=new Uint8Array(k);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var D=0,Q=k-1;(K!==0||D<M)&&Q!==-1;Q--,D++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");M=D,B++}if(T[B]!==" "){for(var q=k-M;q!==k&&F[q]===0;)q++;for(var te=new Uint8Array(W+(k-q)),j=W;q!==k;)te[j++]=F[q++];return te}}}function E(T){var B=$(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:$,decode:E}}var Lm=Dm,Bm=Lm,Vm=Bm,Fm=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},zm=class{name;prefix;baseDecode;prefixCodePoint;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 hd(this,e)}},qm=class{decoders;constructor(e){this.decoders=e}or(e){return hd(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function hd(e,t){return new qm({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Km=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new Fm(e,t,r),this.decoder=new zm(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function yd({name:e,prefix:t,encode:r,decode:n}){return new Km(e,t,r,n)}function gd({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Vm(r,e);return yd({prefix:t,name:e,encode:n,decode:o=>Mu(i(o))})}function Gm(e,t,r,n){let i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=e.length;for(;e[o-1]==="=";)--o;let a=new Uint8Array(o*r/8|0),s=0,u=0,l=0;for(let f=0;f<o;++f){let d=i[e[f]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|d,s+=r,s>=8&&(s-=8,a[l++]=255&u>>s)}if(s>=r||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a}function Hm(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function Er({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return yd({prefix:t,name:e,encode(i){return Hm(i,n,r)},decode(i){return Gm(i,n,r,e)}})}var jo=Er({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),DN=Er({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),LN=Er({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),BN=Er({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),VN=Er({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),FN=Er({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),zN=Er({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),qN=Er({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),KN=Er({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Pr=gd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),GN=gd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Wm=md,rc=128,Jm=127,Qm=~Jm,Ym=Math.pow(2,31);function md(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Ym;)t[r++]=e&255|rc,e/=128;for(;e&Qm;)t[r++]=e&255|rc,e>>>=7;return t[r]=e|0,md.bytes=r-n+1,t}var Xm=Ks,Zm=128,nc=127;function Ks(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Ks.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&nc)<<i:(a&nc)*Math.pow(2,i),i+=7}while(a>=Zm);return Ks.bytes=o-n,r}var eb=Math.pow(2,7),tb=Math.pow(2,14),rb=Math.pow(2,21),nb=Math.pow(2,28),ib=Math.pow(2,35),ob=Math.pow(2,42),ab=Math.pow(2,49),sb=Math.pow(2,56),ub=Math.pow(2,63),lb=function(e){return e<eb?1:e<tb?2:e<rb?3:e<nb?4:e<ib?5:e<ob?6:e<ab?7:e<sb?8:e<ub?9:10},cb={encode:Wm,decode:Xm,encodingLength:lb},fb=cb,Wo=fb;function Gs(e,t=0){return[Wo.decode(e,t),Wo.decode.bytes]}function Jo(e,t,r=0){return Wo.encode(e,t,r),t}function Qo(e){return Wo.encodingLength(e)}function db(e,t){let r=t.byteLength,n=Qo(e),i=n+Qo(r),o=new Uint8Array(i+r);return Jo(e,o,0),Jo(r,o,n),o.set(t,i),new Du(e,r,t,o)}function Hs(e){let t=Mu(e),[r,n]=Gs(t),[i,o]=Gs(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Du(r,i,a,t)}function pb(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Mm(e.bytes,r.bytes)}}var Du=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function ic(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return yb(r,Ws(e),t??Pr.encoder);default:return gb(r,Ws(e),t??jo.encoder)}}var oc=new WeakMap;function Ws(e){let t=oc.get(e);if(t==null){let r=new Map;return oc.set(e,r),r}return t}var ac=class ut{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==_i)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==mb)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ut.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=db(t,r);return ut.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 ut.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&pb(t.multihash,n.multihash)}toString(t){return ic(this,t)}toJSON(){return{"/":ic(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof ut)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new ut(n,i,o,a??sc(n,i,o.bytes))}else if(r[bb]===!0){let{version:n,multihash:i,code:o}=r,a=Hs(i);return ut.create(n,o,a)}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!==_i)throw new Error(`Version 0 CID must use dag-pb (code: ${_i}) block encoding`);return new ut(t,r,n,n.bytes)}case 1:{let i=sc(t,r,n.bytes);return new ut(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ut.create(0,_i,t)}static createV1(t,r){return ut.create(1,t,r)}static decode(t){let[r,n]=ut.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=ut.inspectBytes(t),n=r.size-r.multihashSize,i=Mu(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new Du(r.multihashCode,r.digestSize,o,i);return[r.version===0?ut.createV0(a):ut.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,$]=Gs(t.subarray(r));return r+=$,d},i=n(),o=_i;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=hb(t,r),o=ut.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ws(o).set(n,t),o}};function hb(e,t){switch(e[0]){case"Q":{let r=t??Pr;return[Pr.prefix,r.decode(`${Pr.prefix}${e}`)]}case Pr.prefix:{let r=t??Pr;return[Pr.prefix,r.decode(e)]}case jo.prefix:{let r=t??jo;return[jo.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)]}}}function yb(e,t,r){let{prefix:n}=r;if(n!==Pr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function gb(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var _i=112,mb=18;function sc(e,t,r){let n=Qo(e),i=n+Qo(t),o=new Uint8Array(i+r.byteLength);return Jo(e,o,0),Jo(t,o,n),o.set(r,i),o}var bb=Symbol.for("@ipld/js-cid/CID"),nn=Yi(Ou(),1),Os={SHA2_256:18,LENGTH:32,DAG_PB:112},vb=40;function Yo(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=nn.default.decode(e);return t.seek(nn.default.decode.bytes),r}function wb(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 _b(e){nn.default.decode(e);let t=nn.default.decode.bytes,r=nn.default.decode(e.subarray(nn.default.decode.bytes)),n=nn.default.decode.bytes;return t+n+r}var Mr={Null:e=>e===null?e:void 0,Int:e=>Number.isInteger(e)?e:void 0,Float:e=>typeof e=="number"&&Number.isFinite(e)?e:void 0,String:e=>typeof e=="string"?e:void 0,Bool:e=>typeof e=="boolean"?e:void 0,Bytes:e=>e instanceof Uint8Array?e:void 0,Link:e=>e!==null&&typeof e=="object"&&e.asCID===e?e:void 0,List:e=>Array.isArray(e)?e:void 0,Map:e=>e!==null&&typeof e=="object"&&e.asCID!==e&&!Array.isArray(e)&&!(e instanceof Uint8Array)?e:void 0},Si={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Mr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Mr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Si["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 o=e[i];if(o=Si["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Mr.Int,CarV1HeaderOrV2Pragma:e=>{if(Mr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Si["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Si.Int(e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Ii={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Mr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Mr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Ii["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 o=e[i];if(o=Ii["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Mr.Int,CarV1HeaderOrV2Pragma:e=>{if(Mr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Ii["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=Ii.Int(a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},Tb={toTyped:Si.CarV1HeaderOrV2Pragma,toRepresentation:Ii.CarV1HeaderOrV2Pragma},Eb=["string","number","bigint","symbol"],Ob=["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 xb(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return Eb.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":Ab(e)?"Buffer":Sb(e)||"Object"}function Ab(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Sb(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Ob.includes(t))return t}var Y=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}};Y.uint=new Y(0,"uint",!0);Y.negint=new Y(1,"negint",!0);Y.bytes=new Y(2,"bytes",!0);Y.string=new Y(3,"string",!0);Y.array=new Y(4,"array",!1);Y.map=new Y(5,"map",!1);Y.tag=new Y(6,"tag",!1);Y.float=new Y(7,"float",!0);Y.false=new Y(7,"false",!0);Y.true=new Y(7,"true",!0);Y.null=new Y(7,"null",!0);Y.undefined=new Y(7,"undefined",!0);Y.break=new Y(7,"break",!0);var ge=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}`}},Qn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Ib=new TextDecoder,$b=new TextEncoder;function Xo(e){return Qn&&globalThis.Buffer.isBuffer(e)}function kb(e){return e instanceof Uint8Array?Xo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var jb=Qn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):lc(e,t,r):(e,t,r)=>r-t>64?Ib.decode(e.subarray(t,r)):lc(e,t,r),Nb=Qn?e=>e.length>64?globalThis.Buffer.from(e):uc(e):e=>e.length>64?$b.encode(e):uc(e),Lu=Qn?(e,t,r)=>Xo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Cb=Qn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),kb(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},Ub=Qn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Pb(e,t){if(Xo(e)&&Xo(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 uc(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 lc(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,a=i>239?4:i>223?3:i>191?2:1;if(t+a<=r){let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=e[t+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=e[t+1],u=e[t+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=e[t+1],u=e[t+2],l=e[t+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=a}return Rb(n)}var cc=4096;function Rb(e){let t=e.length;if(t<=cc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=cc));return r}var Mb=256,Db=class{constructor(e=Mb){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=Ub(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=Lu(r,0,this.cursor)}else t=Cb(this.chunks,this.cursor);return e&&this.reset(),t}},Ve="CBOR decode error:",bd="CBOR encode error:",ro=[];ro[23]=1;ro[24]=2;ro[25]=3;ro[26]=5;ro[27]=9;function Yn(e,t,r){if(e.length-t<r)throw new Error(`${Ve} not enough data for type`)}var nt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function gn(e,t,r){Yn(e,t,1);let n=e[t];if(r.strict===!0&&n<nt[0])throw new Error(`${Ve} integer encoded in more bytes than necessary (strict decode)`);return n}function mn(e,t,r){Yn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<nt[1])throw new Error(`${Ve} integer encoded in more bytes than necessary (strict decode)`);return n}function bn(e,t,r){Yn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<nt[2])throw new Error(`${Ve} integer encoded in more bytes than necessary (strict decode)`);return n}function vn(e,t,r){Yn(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],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<nt[3])throw new Error(`${Ve} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${Ve} integers outside of the safe integer range are not supported`)}function Lb(e,t,r,n){return new ge(Y.uint,gn(e,t+1,n),2)}function Bb(e,t,r,n){return new ge(Y.uint,mn(e,t+1,n),3)}function Vb(e,t,r,n){return new ge(Y.uint,bn(e,t+1,n),5)}function Fb(e,t,r,n){return new ge(Y.uint,vn(e,t+1,n),9)}function wn(e,t){return Lt(e,0,t.value)}function Lt(e,t,r){if(r<nt[0]){let n=Number(r);e.push([t|n])}else if(r<nt[1]){let n=Number(r);e.push([t|24,n])}else if(r<nt[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<nt[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<nt[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${Ve} encountered BigInt larger than allowable range`)}}wn.encodedSize=function(e){return Lt.encodedSize(e.value)};Lt.encodedSize=function(e){return e<nt[0]?1:e<nt[1]?2:e<nt[2]?3:e<nt[3]?5:9};wn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function zb(e,t,r,n){return new ge(Y.negint,-1-gn(e,t+1,n),2)}function qb(e,t,r,n){return new ge(Y.negint,-1-mn(e,t+1,n),3)}function Kb(e,t,r,n){return new ge(Y.negint,-1-bn(e,t+1,n),5)}var Bu=BigInt(-1),vd=BigInt(1);function Gb(e,t,r,n){let i=vn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ge(Y.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ve} integers outside of the safe integer range are not supported`);return new ge(Y.negint,Bu-BigInt(i),9)}function Vu(e,t){let r=t.value,n=typeof r=="bigint"?r*Bu-vd:r*-1-1;Lt(e,t.type.majorEncoded,n)}Vu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Bu-vd:t*-1-1;return r<nt[0]?1:r<nt[1]?2:r<nt[2]?3:r<nt[3]?5:9};Vu.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function no(e,t,r,n){Yn(e,t,r+n);let i=Lu(e,t+r,t+r+n);return new ge(Y.bytes,i,r+n)}function Hb(e,t,r,n){return no(e,t,1,r)}function Wb(e,t,r,n){return no(e,t,2,gn(e,t+1,n))}function Jb(e,t,r,n){return no(e,t,3,mn(e,t+1,n))}function Qb(e,t,r,n){return no(e,t,5,bn(e,t+1,n))}function Yb(e,t,r,n){let i=vn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer bytes lengths not supported`);return no(e,t,9,i)}function Zo(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Y.string?Nb(e.value):e.value),e.encodedBytes}function Ma(e,t){let r=Zo(t);Lt(e,t.type.majorEncoded,r.length),e.push(r)}Ma.encodedSize=function(e){let t=Zo(e);return Lt.encodedSize(t.length)+t.length};Ma.compareTokens=function(e,t){return Xb(Zo(e),Zo(t))};function Xb(e,t){return e.length<t.length?-1:e.length>t.length?1:Pb(e,t)}function io(e,t,r,n,i){let o=r+n;Yn(e,t,o);let a=new ge(Y.string,jb(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=Lu(e,t+r,t+o)),a}function Zb(e,t,r,n){return io(e,t,1,r,n)}function ev(e,t,r,n){return io(e,t,2,gn(e,t+1,n),n)}function tv(e,t,r,n){return io(e,t,3,mn(e,t+1,n),n)}function rv(e,t,r,n){return io(e,t,5,bn(e,t+1,n),n)}function nv(e,t,r,n){let i=vn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer string lengths not supported`);return io(e,t,9,i,n)}var iv=Ma;function Xn(e,t,r,n){return new ge(Y.array,n,r)}function ov(e,t,r,n){return Xn(e,t,1,r)}function av(e,t,r,n){return Xn(e,t,2,gn(e,t+1,n))}function sv(e,t,r,n){return Xn(e,t,3,mn(e,t+1,n))}function uv(e,t,r,n){return Xn(e,t,5,bn(e,t+1,n))}function lv(e,t,r,n){let i=vn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer array lengths not supported`);return Xn(e,t,9,i)}function cv(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ve} indefinite length items not allowed`);return Xn(e,t,1,1/0)}function Fu(e,t){Lt(e,Y.array.majorEncoded,t.value)}Fu.compareTokens=wn.compareTokens;Fu.encodedSize=function(e){return Lt.encodedSize(e.value)};function Zn(e,t,r,n){return new ge(Y.map,n,r)}function fv(e,t,r,n){return Zn(e,t,1,r)}function dv(e,t,r,n){return Zn(e,t,2,gn(e,t+1,n))}function pv(e,t,r,n){return Zn(e,t,3,mn(e,t+1,n))}function hv(e,t,r,n){return Zn(e,t,5,bn(e,t+1,n))}function yv(e,t,r,n){let i=vn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer map lengths not supported`);return Zn(e,t,9,i)}function gv(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ve} indefinite length items not allowed`);return Zn(e,t,1,1/0)}function zu(e,t){Lt(e,Y.map.majorEncoded,t.value)}zu.compareTokens=wn.compareTokens;zu.encodedSize=function(e){return Lt.encodedSize(e.value)};function mv(e,t,r,n){return new ge(Y.tag,r,1)}function bv(e,t,r,n){return new ge(Y.tag,gn(e,t+1,n),2)}function vv(e,t,r,n){return new ge(Y.tag,mn(e,t+1,n),3)}function wv(e,t,r,n){return new ge(Y.tag,bn(e,t+1,n),5)}function _v(e,t,r,n){return new ge(Y.tag,vn(e,t+1,n),9)}function qu(e,t){Lt(e,Y.tag.majorEncoded,t.value)}qu.compareTokens=wn.compareTokens;qu.encodedSize=function(e){return Lt.encodedSize(e.value)};var Tv=20,Ev=21,Ov=22,xv=23;function Av(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ve} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ge(Y.null,null,1):new ge(Y.undefined,void 0,1)}function Sv(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ve} indefinite length items not allowed`);return new ge(Y.break,void 0,1)}function Ku(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 ge(Y.float,e,t)}function Iv(e,t,r,n){return Ku(Hu(e,t+1),3,n)}function $v(e,t,r,n){return Ku(Wu(e,t+1),5,n)}function kv(e,t,r,n){return Ku(Ed(e,t+1),9,n)}function Gu(e,t,r){let n=t.value;if(n===!1)e.push([Y.float.majorEncoded|Tv]);else if(n===!0)e.push([Y.float.majorEncoded|Ev]);else if(n===null)e.push([Y.float.majorEncoded|Ov]);else if(n===void 0)e.push([Y.float.majorEncoded|xv]);else{let i,o=!1;(!r||r.float64!==!0)&&(_d(n),i=Hu(qt,1),n===i||Number.isNaN(n)?(qt[0]=249,e.push(qt.slice(0,3)),o=!0):(Td(n),i=Wu(qt,1),n===i&&(qt[0]=250,e.push(qt.slice(0,5)),o=!0))),o||(jv(n),i=Ed(qt,1),qt[0]=251,e.push(qt.slice(0,9)))}}Gu.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){_d(r);let n=Hu(qt,1);if(r===n||Number.isNaN(r))return 3;if(Td(r),n=Wu(qt,1),r===n)return 5}return 9};var wd=new ArrayBuffer(9),At=new DataView(wd,1),qt=new Uint8Array(wd,0);function _d(e){if(e===1/0)At.setUint16(0,31744,!1);else if(e===-1/0)At.setUint16(0,64512,!1);else if(Number.isNaN(e))At.setUint16(0,32256,!1);else{At.setFloat32(0,e);let t=At.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)At.setUint16(0,31744,!1);else if(r===0)At.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?At.setUint16(0,0):i<-14?At.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):At.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Hu(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,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function Td(e){At.setFloat32(0,e,!1)}function Wu(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 jv(e){At.setFloat64(0,e,!1)}function Ed(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)}Gu.compareTokens=wn.compareTokens;function je(e,t,r){throw new Error(`${Ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Da(e){return()=>{throw new Error(`${Ve} ${e}`)}}var fe=[];for(let e=0;e<=23;e++)fe[e]=je;fe[24]=Lb;fe[25]=Bb;fe[26]=Vb;fe[27]=Fb;fe[28]=je;fe[29]=je;fe[30]=je;fe[31]=je;for(let e=32;e<=55;e++)fe[e]=je;fe[56]=zb;fe[57]=qb;fe[58]=Kb;fe[59]=Gb;fe[60]=je;fe[61]=je;fe[62]=je;fe[63]=je;for(let e=64;e<=87;e++)fe[e]=Hb;fe[88]=Wb;fe[89]=Jb;fe[90]=Qb;fe[91]=Yb;fe[92]=je;fe[93]=je;fe[94]=je;fe[95]=Da("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)fe[e]=Zb;fe[120]=ev;fe[121]=tv;fe[122]=rv;fe[123]=nv;fe[124]=je;fe[125]=je;fe[126]=je;fe[127]=Da("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)fe[e]=ov;fe[152]=av;fe[153]=sv;fe[154]=uv;fe[155]=lv;fe[156]=je;fe[157]=je;fe[158]=je;fe[159]=cv;for(let e=160;e<=183;e++)fe[e]=fv;fe[184]=dv;fe[185]=pv;fe[186]=hv;fe[187]=yv;fe[188]=je;fe[189]=je;fe[190]=je;fe[191]=gv;for(let e=192;e<=215;e++)fe[e]=mv;fe[216]=bv;fe[217]=vv;fe[218]=wv;fe[219]=_v;fe[220]=je;fe[221]=je;fe[222]=je;fe[223]=je;for(let e=224;e<=243;e++)fe[e]=Da("simple values are not supported");fe[244]=je;fe[245]=je;fe[246]=je;fe[247]=Av;fe[248]=Da("simple values are not supported");fe[249]=Iv;fe[250]=$v;fe[251]=kv;fe[252]=je;fe[253]=je;fe[254]=je;fe[255]=Sv;var Or=[];for(let e=0;e<24;e++)Or[e]=new ge(Y.uint,e,1);for(let e=-1;e>=-24;e--)Or[31-e]=new ge(Y.negint,e,1);Or[64]=new ge(Y.bytes,new Uint8Array(0),1);Or[96]=new ge(Y.string,"",1);Or[128]=new ge(Y.array,0,1);Or[160]=new ge(Y.map,0,1);Or[244]=new ge(Y.false,!1,1);Or[245]=new ge(Y.true,!0,1);Or[246]=new ge(Y.null,null,1);function Od(){let e=[];return e[Y.uint.major]=wn,e[Y.negint.major]=Vu,e[Y.bytes.major]=Ma,e[Y.string.major]=iv,e[Y.array.major]=Fu,e[Y.map.major]=zu,e[Y.tag.major]=qu,e[Y.float.major]=Gu,e}var HN=Od(),WN=new Db,fc=class xd{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(`${bd} object contains circular references`);return new xd(r,t)}},kr={null:new ge(Y.null,null),undefined:new ge(Y.undefined,void 0),true:new ge(Y.true,!0),false:new ge(Y.false,!1),emptyArray:new ge(Y.array,0),emptyMap:new ge(Y.map,0)},Fr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ge(Y.float,e):e>=0?new ge(Y.uint,e):new ge(Y.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ge(Y.uint,e):new ge(Y.negint,e)},Uint8Array(e,t,r,n){return new ge(Y.bytes,e)},string(e,t,r,n){return new ge(Y.string,e)},boolean(e,t,r,n){return e?kr.true:kr.false},null(e,t,r,n){return kr.null},undefined(e,t,r,n){return kr.undefined},ArrayBuffer(e,t,r,n){return new ge(Y.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ge(Y.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[kr.emptyArray,new ge(Y.break)]:kr.emptyArray;n=fc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=xs(a,r,n);return r.addBreakTokens?[new ge(Y.array,e.length),i,new ge(Y.break)]:[new ge(Y.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length;if(!a)return r.addBreakTokens===!0?[kr.emptyMap,new ge(Y.break)]:kr.emptyMap;n=fc.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[xs(l,r,n),xs(i?e.get(l):e[l],r,n)];return Nv(s,r),r.addBreakTokens?[new ge(Y.map,a),s,new ge(Y.break)]:[new ge(Y.map,a),s]}};Fr.Map=Fr.Object;Fr.Buffer=Fr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Fr[`${e}Array`]=Fr.DataView;function xs(e,t={},r){let n=xb(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Fr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Fr[n];if(!o)throw new Error(`${bd} unsupported type: ${n}`);return o(e,n,t,r)}function Nv(e,t){t.mapSorter&&e.sort(t.mapSorter)}var JN=Symbol.for("DONE"),QN=Symbol.for("BREAK"),YN=Od(),XN=Yi(Ou(),1),ZN=[new ge(Y.map,2),new ge(Y.string,"version"),new ge(Y.uint,1),new ge(Y.string,"roots")],eC=new ge(Y.tag,42);async function Ad(e,t){let r=Yo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Rm(n);if(Tb.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 o=wb(await e.exactly(vb,!0));e.seek(o.dataOffset-e.pos);let a=await Ad(e,1);return Object.assign(a,o)}async function Cv(e){let t=await e.exactly(2,!1);if(t[0]===Os.SHA2_256&&t[1]===Os.LENGTH){let a=await e.exactly(34,!0),s=Hs(a);return ac.create(0,Os.DAG_PB,s)}let r=Yo(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Yo(await e.upTo(8),e),i=await e.exactly(_b(await e.upTo(8)),!0),o=Hs(i);return ac.create(r,n,o)}async function Sd(e){let t=e.pos,r=Yo(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await Cv(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function Uv(e){let{cid:t,blockLength:r}=await Sd(e);return{bytes:await e.exactly(r,!0),cid:t}}async function Pv(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await Sd(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function Rv(e){let t=(async()=>{let r=await Ad(e);if(r.version===2){let n=e.pos-r.dataOffset;e=Bv(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await Uv(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await Pv(e)}}}function Mv(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 Dv(e){let t=0,r=0,n=0,i=new Uint8Array(0),o=async a=>{r=i.length-n;let s=[i.subarray(n)];for(;r<a;){let l=await e();if(l==null)break;r<0?l.length>r&&s.push(l.subarray(-r)):s.push(l),r+=l.length}i=new Uint8Array(s.reduce((l,f)=>l+f.length,0));let u=0;for(let l of s)i.set(l,u),u+=l.length;n=0};return{async upTo(a){return i.length-n<a&&await o(a),i.subarray(n,n+Math.min(i.length-n,a))},async exactly(a,s=!1){if(i.length-n<a&&await o(a),i.length-n<a)throw new Error("Unexpected end of data");let u=i.subarray(n,n+a);return s&&(t+=a,n+=a),u},seek(a){t+=a,n+=a},get pos(){return t}}}function Lv(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return Dv(r)}function Bv(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 o=await e.exactly(n,i);if(o.length+r>t)throw new Error("Unexpected end of data");return i&&(r+=n),o},seek(n){r+=n,e.seek(n)},get pos(){return e.pos}}}var Id=class{constructor(e,t){this._header=e,this._blocks=t,this._keys=t.map(r=>r.cid.toString())}get version(){return this._header.version}async getRoots(){return this._header.roots}async has(e){return this._keys.indexOf(e.toString())>-1}async get(e){let t=this._keys.indexOf(e.toString());return t>-1?this._blocks[t]:void 0}async*blocks(){for(let e of this._blocks)yield e}async*cids(){for(let e of this._blocks)yield e.cid}static async fromBytes(e){if(!(e instanceof Uint8Array))throw new TypeError("fromBytes() requires a Uint8Array");return dc(Mv(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return dc(Lv(e))}};async function dc(e){let t=Rv(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new Id(r,n)}var tC=Yi(Ou(),1),Vv=Object.create,Ju=Object.defineProperty,Fv=Object.getOwnPropertyDescriptor,$d=Object.getOwnPropertyNames,zv=Object.getPrototypeOf,qv=Object.prototype.hasOwnProperty,Ze=(e,t)=>function(){return t||(0,e[$d(e)[0]])((t={exports:{}}).exports,t),t.exports},ei=(e,t)=>{for(var r in t)Ju(e,r,{get:t[r],enumerable:!0})},Kv=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of $d(t))!qv.call(e,i)&&i!==r&&Ju(e,i,{get:()=>t[i],enumerable:!(n=Fv(t,i))||n.enumerable});return e},xr=(e,t,r)=>(r=e!=null?Vv(zv(e)):{},Kv(t||!e||!e.__esModule?Ju(r,"default",{value:e,enumerable:!0}):r,e)),Gr=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/typebox.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function R(){return w.clear()}p.Clear=R;function N(_){return w.delete(_)}p.Delete=N;function U(_){return w.has(_)}p.Has=U;function g(_,c){w.set(_,c)}p.Set=g;function x(_){return w.get(_)}p.Get=x})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(p){super(p)}};e.TypeBoxError=r;var n;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function R(){return w.clear()}p.Clear=R;function N(_){return w.delete(_)}p.Delete=N;function U(_){return w.has(_)}p.Has=U;function g(_,c){w.set(_,c)}p.Set=g;function x(_){return w.get(_)}p.Get=x})(n||(e.FormatRegistry=n={}));var i;(function(p){function w(v){return Array.isArray(v)}p.IsArray=w;function A(v){return typeof v=="bigint"}p.IsBigInt=A;function R(v){return typeof v=="boolean"}p.IsBoolean=R;function N(v){return v instanceof globalThis.Date}p.IsDate=N;function U(v){return v===null}p.IsNull=U;function g(v){return typeof v=="number"}p.IsNumber=g;function x(v){return typeof v=="object"&&v!==null}p.IsObject=x;function _(v){return typeof v=="string"}p.IsString=_;function c(v){return v instanceof globalThis.Uint8Array}p.IsUint8Array=c;function O(v){return v===void 0}p.IsUndefined=O})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var a;(function(p){function w(m){try{return new RegExp(m),!0}catch{return!1}}function A(m){if(!i.IsString(m))return!1;for(let Ue=0;Ue<m.length;Ue++){let Ot=m.charCodeAt(Ue);if(Ot>=7&&Ot<=13||Ot===27||Ot===127)return!1}return!0}function R(m){return g(m)||Ye(m)}function N(m){return i.IsUndefined(m)||i.IsBigInt(m)}function U(m){return i.IsUndefined(m)||i.IsNumber(m)}function g(m){return i.IsUndefined(m)||i.IsBoolean(m)}function x(m){return i.IsUndefined(m)||i.IsString(m)}function _(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)&&w(m)}function c(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)}function O(m){return i.IsUndefined(m)||Ye(m)}function v(m){return Te(m,"Any")&&x(m.$id)}p.TAny=v;function b(m){return Te(m,"Array")&&m.type==="array"&&x(m.$id)&&Ye(m.items)&&U(m.minItems)&&U(m.maxItems)&&g(m.uniqueItems)&&O(m.contains)&&U(m.minContains)&&U(m.maxContains)}p.TArray=b;function P(m){return Te(m,"AsyncIterator")&&m.type==="AsyncIterator"&&x(m.$id)&&Ye(m.items)}p.TAsyncIterator=P;function H(m){return Te(m,"BigInt")&&m.type==="bigint"&&x(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}p.TBigInt=H;function ie(m){return Te(m,"Boolean")&&m.type==="boolean"&&x(m.$id)}p.TBoolean=ie;function oe(m){return Te(m,"Constructor")&&m.type==="Constructor"&&x(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ue=>Ye(Ue))&&Ye(m.returns)}p.TConstructor=oe;function ve(m){return Te(m,"Date")&&m.type==="Date"&&x(m.$id)&&U(m.exclusiveMaximumTimestamp)&&U(m.exclusiveMinimumTimestamp)&&U(m.maximumTimestamp)&&U(m.minimumTimestamp)&&U(m.multipleOfTimestamp)}p.TDate=ve;function Oe(m){return Te(m,"Function")&&m.type==="Function"&&x(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Ue=>Ye(Ue))&&Ye(m.returns)}p.TFunction=Oe;function Me(m){return Te(m,"Integer")&&m.type==="integer"&&x(m.$id)&&U(m.exclusiveMaximum)&&U(m.exclusiveMinimum)&&U(m.maximum)&&U(m.minimum)&&U(m.multipleOf)}p.TInteger=Me;function ze(m){return Te(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Ue=>Ye(Ue)&&!bi(Ue))&&x(m.type)&&(g(m.unevaluatedProperties)||O(m.unevaluatedProperties))&&x(m.$id)}p.TIntersect=ze;function Jr(m){return Te(m,"Iterator")&&m.type==="Iterator"&&x(m.$id)&&Ye(m.items)}p.TIterator=Jr;function Te(m,Ue){return Sr(m)&&m[e.Kind]===Ue}p.TKindOf=Te;function Sr(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}p.TKind=Sr;function Qr(m){return C(m)&&i.IsString(m.const)}p.TLiteralString=Qr;function S(m){return C(m)&&i.IsNumber(m.const)}p.TLiteralNumber=S;function pe(m){return C(m)&&i.IsBoolean(m.const)}p.TLiteralBoolean=pe;function C(m){return Te(m,"Literal")&&x(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}p.TLiteral=C;function _e(m){return Te(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}p.TNever=_e;function ae(m){return Te(m,"Not")&&Ye(m.not)}p.TNot=ae;function he(m){return Te(m,"Null")&&m.type==="null"&&x(m.$id)}p.TNull=he;function Ce(m){return Te(m,"Number")&&m.type==="number"&&x(m.$id)&&U(m.exclusiveMaximum)&&U(m.exclusiveMinimum)&&U(m.maximum)&&U(m.minimum)&&U(m.multipleOf)}p.TNumber=Ce;function qe(m){return Te(m,"Object")&&m.type==="object"&&x(m.$id)&&i.IsObject(m.properties)&&R(m.additionalProperties)&&U(m.minProperties)&&U(m.maxProperties)&&Object.entries(m.properties).every(([Ue,Ot])=>A(Ue)&&Ye(Ot))}p.TObject=qe;function ft(m){return Te(m,"Promise")&&m.type==="Promise"&&x(m.$id)&&Ye(m.item)}p.TPromise=ft;function at(m){return Te(m,"Record")&&m.type==="object"&&x(m.$id)&&R(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Ue=>{let Ot=Object.getOwnPropertyNames(Ue.patternProperties);return Ot.length===1&&w(Ot[0])&&i.IsObject(Ue.patternProperties)&&Ye(Ue.patternProperties[Ot[0]])})(m)}p.TRecord=at;function pt(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}p.TRecursive=pt;function Ir(m){return Te(m,"Ref")&&x(m.$id)&&i.IsString(m.$ref)}p.TRef=Ir;function kn(m){return Te(m,"String")&&m.type==="string"&&x(m.$id)&&U(m.minLength)&&U(m.maxLength)&&_(m.pattern)&&c(m.format)}p.TString=kn;function jn(m){return Te(m,"Symbol")&&m.type==="symbol"&&x(m.$id)}p.TSymbol=jn;function Yr(m){return Te(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}p.TTemplateLiteral=Yr;function wo(m){return Te(m,"This")&&x(m.$id)&&i.IsString(m.$ref)}p.TThis=wo;function bi(m){return i.IsObject(m)&&e.Transform in m}p.TTransform=bi;function Qe(m){return Te(m,"Tuple")&&m.type==="array"&&x(m.$id)&&i.IsNumber(m.minItems)&&i.IsNumber(m.maxItems)&&m.minItems===m.maxItems&&(i.IsUndefined(m.items)&&i.IsUndefined(m.additionalItems)&&m.minItems===0||i.IsArray(m.items)&&m.items.every(Ue=>Ye(Ue)))}p.TTuple=Qe;function _o(m){return Te(m,"Undefined")&&m.type==="undefined"&&x(m.$id)}p.TUndefined=_o;function bs(m){return Xr(m)&&m.anyOf.every(Ue=>Qr(Ue)||S(Ue))}p.TUnionLiteral=bs;function Xr(m){return Te(m,"Union")&&x(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Ue=>Ye(Ue))}p.TUnion=Xr;function Nn(m){return Te(m,"Uint8Array")&&m.type==="Uint8Array"&&x(m.$id)&&U(m.minByteLength)&&U(m.maxByteLength)}p.TUint8Array=Nn;function dt(m){return Te(m,"Unknown")&&x(m.$id)}p.TUnknown=dt;function To(m){return Te(m,"Unsafe")}p.TUnsafe=To;function vi(m){return Te(m,"Void")&&m.type==="void"&&x(m.$id)}p.TVoid=vi;function vs(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}p.TReadonly=vs;function ws(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}p.TOptional=ws;function Ye(m){return i.IsObject(m)&&(v(m)||b(m)||ie(m)||H(m)||P(m)||oe(m)||ve(m)||Oe(m)||Me(m)||ze(m)||Jr(m)||C(m)||_e(m)||ae(m)||he(m)||Ce(m)||qe(m)||ft(m)||at(m)||Ir(m)||kn(m)||jn(m)||Yr(m)||wo(m)||Qe(m)||_o(m)||Xr(m)||Nn(m)||dt(m)||To(m)||vi(m)||Sr(m)&&t.Has(m[e.Kind]))}p.TSchema=Ye})(a||(e.TypeGuard=a={}));var s;(function(p){function w(A){return A[e.Kind]==="Intersect"?A.allOf.every(R=>w(R)):A[e.Kind]==="Union"?A.anyOf.some(R=>w(R)):A[e.Kind]==="Undefined"?!0:A[e.Kind]==="Not"?!w(A.not):!1}p.Check=w})(s||(e.ExtendsUndefined=s={}));var u=class extends r{};e.TypeExtendsError=u;var l;(function(p){p[p.Union=0]="Union",p[p.True=1]="True",p[p.False=2]="False"})(l||(e.TypeExtendsResult=l={}));var f;(function(p){function w(y){return y===l.False?y:l.True}function A(y){throw new u(y)}function R(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function N(y,h){return a.TNever(h)?Te(y,h):a.TIntersect(h)?Oe(y,h):a.TUnion(h)?_s(y,h):a.TUnknown(h)?Kl(y,h):a.TAny(h)?U(y,h):A("StructuralRight")}function U(y,h){return l.True}function g(y,h){return a.TIntersect(h)?Oe(y,h):a.TUnion(h)&&h.anyOf.some(Ie=>a.TAny(Ie)||a.TUnknown(Ie))?l.True:a.TUnion(h)?l.Union:a.TUnknown(h)||a.TAny(h)?l.True:l.Union}function x(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)?l.True:l.False}function _(y,h){return a.TObject(h)&&Yr(h)?l.True:R(h)?N(y,h):a.TArray(h)?w(Pe(y.items,h.items)):l.False}function c(y,h){return R(h)?N(y,h):a.TAsyncIterator(h)?w(Pe(y.items,h.items)):l.False}function O(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TBigInt(h)?l.True:l.False}function v(y,h){return a.TLiteral(y)&&i.IsBoolean(y.const)||a.TBoolean(y)?l.True:l.False}function b(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TBoolean(h)?l.True:l.False}function P(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TConstructor(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((Ie,fr)=>w(Pe(h.parameters[fr],Ie))===l.True)?w(Pe(y.returns,h.returns)):l.False:l.False}function H(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TDate(h)?l.True:l.False}function ie(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TFunction(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((Ie,fr)=>w(Pe(h.parameters[fr],Ie))===l.True)?w(Pe(y.returns,h.returns)):l.False:l.False}function oe(y,h){return a.TLiteral(y)&&i.IsNumber(y.const)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function ve(y,h){return a.TInteger(h)||a.TNumber(h)?l.True:R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):l.False}function Oe(y,h){return h.allOf.every(Ie=>Pe(y,Ie)===l.True)?l.True:l.False}function Me(y,h){return y.allOf.some(Ie=>Pe(Ie,h)===l.True)?l.True:l.False}function ze(y,h){return R(h)?N(y,h):a.TIterator(h)?w(Pe(y.items,h.items)):l.False}function Jr(y,h){return a.TLiteral(h)&&h.const===y.const?l.True:R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TString(h)?vi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):l.False}function Te(y,h){return l.False}function Sr(y,h){return l.True}function Qr(y){let[h,Ie]=[y,0];for(;a.TNot(h);)h=h.not,Ie+=1;return Ie%2===0?h:e.Type.Unknown()}function S(y,h){return a.TNot(y)?Pe(Qr(y),h):a.TNot(h)?Pe(y,Qr(h)):A("Invalid fallthrough for Not")}function pe(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TNull(h)?l.True:l.False}function C(y,h){return a.TLiteralNumber(y)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function _e(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TInteger(h)||a.TNumber(h)?l.True:l.False}function ae(y,h){return Object.getOwnPropertyNames(y.properties).length===h}function he(y){return Yr(y)}function Ce(y){return ae(y,0)||ae(y,1)&&"description"in y.properties&&a.TUnion(y.properties.description)&&y.properties.description.anyOf.length===2&&(a.TString(y.properties.description.anyOf[0])&&a.TUndefined(y.properties.description.anyOf[1])||a.TString(y.properties.description.anyOf[1])&&a.TUndefined(y.properties.description.anyOf[0]))}function qe(y){return ae(y,0)}function ft(y){return ae(y,0)}function at(y){return ae(y,0)}function pt(y){return ae(y,0)}function Ir(y){return Yr(y)}function kn(y){let h=e.Type.Number();return ae(y,0)||ae(y,1)&&"length"in y.properties&&w(Pe(y.properties.length,h))===l.True}function jn(y){return ae(y,0)}function Yr(y){let h=e.Type.Number();return ae(y,0)||ae(y,1)&&"length"in y.properties&&w(Pe(y.properties.length,h))===l.True}function wo(y){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return ae(y,0)||ae(y,1)&&"then"in y.properties&&w(Pe(y.properties.then,h))===l.True}function bi(y,h){return Pe(y,h)===l.False||a.TOptional(y)&&!a.TOptional(h)?l.False:l.True}function Qe(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)||a.TLiteralString(y)&&he(h)||a.TLiteralNumber(y)&&qe(h)||a.TLiteralBoolean(y)&&ft(h)||a.TSymbol(y)&&Ce(h)||a.TBigInt(y)&&at(h)||a.TString(y)&&he(h)||a.TSymbol(y)&&Ce(h)||a.TNumber(y)&&qe(h)||a.TInteger(y)&&qe(h)||a.TBoolean(y)&&ft(h)||a.TUint8Array(y)&&Ir(h)||a.TDate(y)&&pt(h)||a.TConstructor(y)&&jn(h)||a.TFunction(y)&&kn(h)?l.True:a.TRecord(y)&&a.TString(Xr(y))?h[e.Hint]==="Record"?l.True:l.False:a.TRecord(y)&&a.TNumber(Xr(y))&&ae(h,0)?l.True:l.False}function _o(y,h){return R(h)?N(y,h):a.TRecord(h)?dt(y,h):a.TObject(h)?(()=>{for(let Ie of Object.getOwnPropertyNames(h.properties)){if(!(Ie in y.properties)&&!a.TOptional(h.properties[Ie]))return l.False;if(a.TOptional(h.properties[Ie]))return l.True;if(bi(y.properties[Ie],h.properties[Ie])===l.False)return l.False}return l.True})():l.False}function bs(y,h){return R(h)?N(y,h):a.TObject(h)&&wo(h)?l.True:a.TPromise(h)?w(Pe(y.item,h.item)):l.False}function Xr(y){return e.PatternNumberExact in y.patternProperties?e.Type.Number():e.PatternStringExact in y.patternProperties?e.Type.String():A("Unknown record key pattern")}function Nn(y){return e.PatternNumberExact in y.patternProperties?y.patternProperties[e.PatternNumberExact]:e.PatternStringExact in y.patternProperties?y.patternProperties[e.PatternStringExact]:A("Unable to get record value schema")}function dt(y,h){let[Ie,fr]=[Xr(h),Nn(h)];return a.TLiteralString(y)&&a.TNumber(Ie)&&w(Pe(y,fr))===l.True?l.True:a.TUint8Array(y)&&a.TNumber(Ie)||a.TString(y)&&a.TNumber(Ie)||a.TArray(y)&&a.TNumber(Ie)?Pe(y,fr):a.TObject(y)?(()=>{for(let vy of Object.getOwnPropertyNames(y.properties))if(bi(fr,y.properties[vy])===l.False)return l.False;return l.True})():l.False}function To(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?Pe(Nn(y),Nn(h)):l.False}function vi(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function vs(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TString(h)?l.True:l.False}function ws(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TSymbol(h)?l.True:l.False}function Ye(y,h){return a.TTemplateLiteral(y)?Pe(D.Resolve(y),h):a.TTemplateLiteral(h)?Pe(y,D.Resolve(h)):A("Invalid fallthrough for TemplateLiteral")}function m(y,h){return a.TArray(h)&&y.items!==void 0&&y.items.every(Ie=>Pe(Ie,h.items)===l.True)}function Ue(y,h){return a.TNever(y)?l.True:a.TUnknown(y)?l.False:a.TAny(y)?l.Union:l.False}function Ot(y,h){return R(h)?N(y,h):a.TObject(h)&&Yr(h)||a.TArray(h)&&m(y,h)?l.True:a.TTuple(h)?i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||!i.IsUndefined(y.items)&&i.IsUndefined(h.items)?l.False:i.IsUndefined(y.items)&&!i.IsUndefined(h.items)||y.items.every((Ie,fr)=>Pe(Ie,h.items[fr])===l.True)?l.True:l.False:l.False}function dy(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TUint8Array(h)?l.True:l.False}function py(y,h){return R(h)?N(y,h):a.TObject(h)?Qe(y,h):a.TRecord(h)?dt(y,h):a.TVoid(h)?gy(y,h):a.TUndefined(h)?l.True:l.False}function _s(y,h){return h.anyOf.some(Ie=>Pe(y,Ie)===l.True)?l.True:l.False}function hy(y,h){return y.anyOf.every(Ie=>Pe(Ie,h)===l.True)?l.True:l.False}function Kl(y,h){return l.True}function yy(y,h){return a.TNever(h)?Te(y,h):a.TIntersect(h)?Oe(y,h):a.TUnion(h)?_s(y,h):a.TAny(h)?U(y,h):a.TString(h)?vi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):a.TArray(h)?x(y,h):a.TTuple(h)?Ue(y,h):a.TObject(h)?Qe(y,h):a.TUnknown(h)?l.True:l.False}function gy(y,h){return a.TUndefined(y)||a.TUndefined(y)?l.True:l.False}function my(y,h){return a.TIntersect(h)?Oe(y,h):a.TUnion(h)?_s(y,h):a.TUnknown(h)?Kl(y,h):a.TAny(h)?U(y,h):a.TObject(h)?Qe(y,h):a.TVoid(h)?l.True:l.False}function Pe(y,h){return a.TTemplateLiteral(y)||a.TTemplateLiteral(h)?Ye(y,h):a.TNot(y)||a.TNot(h)?S(y,h):a.TAny(y)?g(y,h):a.TArray(y)?_(y,h):a.TBigInt(y)?O(y,h):a.TBoolean(y)?b(y,h):a.TAsyncIterator(y)?c(y,h):a.TConstructor(y)?P(y,h):a.TDate(y)?H(y,h):a.TFunction(y)?ie(y,h):a.TInteger(y)?ve(y,h):a.TIntersect(y)?Me(y,h):a.TIterator(y)?ze(y,h):a.TLiteral(y)?Jr(y,h):a.TNever(y)?Sr(y,h):a.TNull(y)?pe(y,h):a.TNumber(y)?_e(y,h):a.TObject(y)?_o(y,h):a.TRecord(y)?To(y,h):a.TString(y)?vs(y,h):a.TSymbol(y)?ws(y,h):a.TTuple(y)?Ot(y,h):a.TPromise(y)?bs(y,h):a.TUint8Array(y)?dy(y,h):a.TUndefined(y)?py(y,h):a.TUnion(y)?hy(y,h):a.TUnknown(y)?yy(y,h):a.TVoid(y)?my(y,h):A(`Unknown left type operand '${y[e.Kind]}'`)}function by(y,h){return Pe(y,h)}p.Extends=by})(f||(e.TypeExtends=f={}));var d;(function(p){function w(_){return _.map(c=>U(c))}function A(_){return new Date(_.getTime())}function R(_){return new Uint8Array(_)}function N(_){let c=Object.getOwnPropertyNames(_).reduce((v,b)=>({...v,[b]:U(_[b])}),{}),O=Object.getOwnPropertySymbols(_).reduce((v,b)=>({...v,[b]:U(_[b])}),{});return{...c,...O}}function U(_){return i.IsArray(_)?w(_):i.IsDate(_)?A(_):i.IsUint8Array(_)?R(_):i.IsObject(_)?N(_):_}function g(_){return _.map(c=>x(c))}p.Rest=g;function x(_,c={}){return{...U(_),...c}}p.Type=x})(d||(e.TypeClone=d={}));var $;(function(p){function w(P){return P.map(H=>{let{[e.Optional]:ie,...oe}=d.Type(H);return oe})}function A(P){return P.every(H=>a.TOptional(H))}function R(P){return P.some(H=>a.TOptional(H))}function N(P){return A(P.allOf)?e.Type.Optional(e.Type.Intersect(w(P.allOf))):P}function U(P){return R(P.anyOf)?e.Type.Optional(e.Type.Union(w(P.anyOf))):P}function g(P){return P[e.Kind]==="Intersect"?N(P):P[e.Kind]==="Union"?U(P):P}function x(P,H){let ie=P.allOf.reduce((oe,ve)=>{let Oe=v(ve,H);return Oe[e.Kind]==="Never"?oe:[...oe,Oe]},[]);return g(e.Type.Intersect(ie))}function _(P,H){let ie=P.anyOf.map(oe=>v(oe,H));return g(e.Type.Union(ie))}function c(P,H){let ie=P.properties[H];return i.IsUndefined(ie)?e.Type.Never():e.Type.Union([ie])}function O(P,H){let ie=P.items;if(i.IsUndefined(ie))return e.Type.Never();let oe=ie[H];return i.IsUndefined(oe)?e.Type.Never():oe}function v(P,H){return P[e.Kind]==="Intersect"?x(P,H):P[e.Kind]==="Union"?_(P,H):P[e.Kind]==="Object"?c(P,H):P[e.Kind]==="Tuple"?O(P,H):e.Type.Never()}function b(P,H,ie={}){let oe=H.map(ve=>v(P,ve.toString()));return g(e.Type.Union(oe,ie))}p.Resolve=b})($||(e.IndexedAccessor=$={}));var E;(function(p){function w(O){let[v,b]=[O.slice(0,1),O.slice(1)];return`${v.toLowerCase()}${b}`}function A(O){let[v,b]=[O.slice(0,1),O.slice(1)];return`${v.toUpperCase()}${b}`}function R(O){return O.toUpperCase()}function N(O){return O.toLowerCase()}function U(O,v){let b=q.ParseExact(O.pattern);if(!j.Check(b))return{...O,pattern:g(O.pattern,v)};let P=[...z.Generate(b)].map(oe=>e.Type.Literal(oe)),H=x(P,v),ie=e.Type.Union(H);return e.Type.TemplateLiteral([ie])}function g(O,v){return typeof O=="string"?v==="Uncapitalize"?w(O):v==="Capitalize"?A(O):v==="Uppercase"?R(O):v==="Lowercase"?N(O):O:O.toString()}function x(O,v){if(O.length===0)return[];let[b,...P]=O;return[c(b,v),...x(P,v)]}function _(O,v){return a.TTemplateLiteral(O)?U(O,v):a.TUnion(O)?e.Type.Union(x(O.anyOf,v)):a.TLiteral(O)?e.Type.Literal(g(O.const,v)):O}function c(O,v){return _(O,v)}p.Map=c})(E||(e.Intrinsic=E={}));var T;(function(p){function w(g,x){return e.Type.Intersect(g.allOf.map(_=>N(_,x)),{...g})}function A(g,x){return e.Type.Union(g.anyOf.map(_=>N(_,x)),{...g})}function R(g,x){return x(g)}function N(g,x){return g[e.Kind]==="Intersect"?w(g,x):g[e.Kind]==="Union"?A(g,x):g[e.Kind]==="Object"?R(g,x):g}function U(g,x,_){return{...N(d.Type(g),x),..._}}p.Map=U})(T||(e.ObjectMap=T={}));var B;(function(p){function w(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}function A(c,O){return c.allOf.reduce((v,b)=>[...v,...g(b,O)],[])}function R(c,O){let v=c.anyOf.map(b=>g(b,O));return[...v.reduce((b,P)=>P.map(H=>v.every(ie=>ie.includes(H))?b.add(H):b)[0],new Set)]}function N(c,O){return Object.getOwnPropertyNames(c.properties)}function U(c,O){return O.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function g(c,O){return a.TIntersect(c)?A(c,O):a.TUnion(c)?R(c,O):a.TObject(c)?N(c,O):a.TRecord(c)?U(c,O):[]}function x(c,O){return[...new Set(g(c,O))]}p.ResolveKeys=x;function _(c){return`^(${x(c,{includePatterns:!0}).map(O=>`(${w(O)})`).join("|")})$`}p.ResolvePattern=_})(B||(e.KeyResolver=B={}));var W=class extends r{};e.KeyArrayResolverError=W;var M;(function(p){function w(A){return Array.isArray(A)?A:a.TUnionLiteral(A)?A.anyOf.map(R=>R.const.toString()):a.TLiteral(A)?[A.const]:a.TTemplateLiteral(A)?(()=>{let R=q.ParseExact(A.pattern);if(!j.Check(R))throw new W("Cannot resolve keys from infinite template expression");return[...z.Generate(R)]})():[]}p.Resolve=w})(M||(e.KeyArrayResolver=M={}));var k;(function(p){function*w(R){for(let N of R.anyOf)N[e.Kind]==="Union"?yield*w(N):yield N}function A(R){return e.Type.Union([...w(R)],{...R})}p.Resolve=A})(k||(e.UnionResolver=k={}));var F=class extends r{};e.TemplateLiteralPatternError=F;var K;(function(p){function w(U){throw new F(U)}function A(U){return U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function R(U,g){return a.TTemplateLiteral(U)?U.pattern.slice(1,U.pattern.length-1):a.TUnion(U)?`(${U.anyOf.map(x=>R(x,g)).join("|")})`:a.TNumber(U)?`${g}${e.PatternNumber}`:a.TInteger(U)?`${g}${e.PatternNumber}`:a.TBigInt(U)?`${g}${e.PatternNumber}`:a.TString(U)?`${g}${e.PatternString}`:a.TLiteral(U)?`${g}${A(U.const.toString())}`:a.TBoolean(U)?`${g}${e.PatternBoolean}`:w(`Unexpected Kind '${U[e.Kind]}'`)}function N(U){return`^${U.map(g=>R(g,"")).join("")}$`}p.Create=N})(K||(e.TemplateLiteralPattern=K={}));var D;(function(p){function w(A){let R=q.ParseExact(A.pattern);if(!j.Check(R))return e.Type.String();let N=[...z.Generate(R)].map(U=>e.Type.Literal(U));return e.Type.Union(N)}p.Resolve=w})(D||(e.TemplateLiteralResolver=D={}));var Q=class extends r{};e.TemplateLiteralParserError=Q;var q;(function(p){function w(P,H,ie){return P[H]===ie&&P.charCodeAt(H-1)!==92}function A(P,H){return w(P,H,"(")}function R(P,H){return w(P,H,")")}function N(P,H){return w(P,H,"|")}function U(P){if(!(A(P,0)&&R(P,P.length-1)))return!1;let H=0;for(let ie=0;ie<P.length;ie++)if(A(P,ie)&&(H+=1),R(P,ie)&&(H-=1),H===0&&ie!==P.length-1)return!1;return!0}function g(P){return P.slice(1,P.length-1)}function x(P){let H=0;for(let ie=0;ie<P.length;ie++)if(A(P,ie)&&(H+=1),R(P,ie)&&(H-=1),N(P,ie)&&H===0)return!0;return!1}function _(P){for(let H=0;H<P.length;H++)if(A(P,H))return!0;return!1}function c(P){let[H,ie]=[0,0],oe=[];for(let Oe=0;Oe<P.length;Oe++)if(A(P,Oe)&&(H+=1),R(P,Oe)&&(H-=1),N(P,Oe)&&H===0){let Me=P.slice(ie,Oe);Me.length>0&&oe.push(v(Me)),ie=Oe+1}let ve=P.slice(ie);return ve.length>0&&oe.push(v(ve)),oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"or",expr:oe}}function O(P){function H(ve,Oe){if(!A(ve,Oe))throw new Q("TemplateLiteralParser: Index must point to open parens");let Me=0;for(let ze=Oe;ze<ve.length;ze++)if(A(ve,ze)&&(Me+=1),R(ve,ze)&&(Me-=1),Me===0)return[Oe,ze];throw new Q("TemplateLiteralParser: Unclosed group parens in expression")}function ie(ve,Oe){for(let Me=Oe;Me<ve.length;Me++)if(A(ve,Me))return[Oe,Me];return[Oe,ve.length]}let oe=[];for(let ve=0;ve<P.length;ve++)if(A(P,ve)){let[Oe,Me]=H(P,ve),ze=P.slice(Oe,Me+1);oe.push(v(ze)),ve=Me}else{let[Oe,Me]=ie(P,ve),ze=P.slice(Oe,Me);ze.length>0&&oe.push(v(ze)),ve=Me-1}return oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"and",expr:oe}}function v(P){return U(P)?v(g(P)):x(P)?c(P):_(P)?O(P):{type:"const",const:P}}p.Parse=v;function b(P){return v(P.slice(1,P.length-1))}p.ParseExact=b})(q||(e.TemplateLiteralParser=q={}));var te=class extends r{};e.TemplateLiteralFiniteError=te;var j;(function(p){function w(g){throw new te(g)}function A(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="0"&&g.expr[1].type==="const"&&g.expr[1].const==="[1-9][0-9]*"}function R(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="true"&&g.expr[1].type==="const"&&g.expr[1].const==="false"}function N(g){return g.type==="const"&&g.const===".*"}function U(g){return R(g)?!0:A(g)||N(g)?!1:g.type==="and"?g.expr.every(x=>U(x)):g.type==="or"?g.expr.every(x=>U(x)):g.type==="const"?!0:w("Unknown expression type")}p.Check=U})(j||(e.TemplateLiteralFinite=j={}));var L=class extends r{};e.TemplateLiteralGeneratorError=L;var z;(function(p){function*w(g){if(g.length===1)return yield*g[0];for(let x of g[0])for(let _ of w(g.slice(1)))yield`${x}${_}`}function*A(g){return yield*w(g.expr.map(x=>[...U(x)]))}function*R(g){for(let x of g.expr)yield*U(x)}function*N(g){return yield g.const}function*U(g){return g.type==="and"?yield*A(g):g.type==="or"?yield*R(g):g.type==="const"?yield*N(g):(()=>{throw new L("Unknown expression")})()}p.Generate=U})(z||(e.TemplateLiteralGenerator=z={}));var re;(function(p){function*w(U){let g=U.trim().replace(/"|'/g,"");return g==="boolean"?yield e.Type.Boolean():g==="number"?yield e.Type.Number():g==="bigint"?yield e.Type.BigInt():g==="string"?yield e.Type.String():yield(()=>{let x=g.split("|").map(_=>e.Type.Literal(_.trim()));return x.length===0?e.Type.Never():x.length===1?x[0]:e.Type.Union(x)})()}function*A(U){if(U[1]!=="{"){let g=e.Type.Literal("$"),x=R(U.slice(1));return yield*[g,...x]}for(let g=2;g<U.length;g++)if(U[g]==="}"){let x=w(U.slice(2,g)),_=R(U.slice(g+1));return yield*[...x,..._]}yield e.Type.Literal(U)}function*R(U){for(let g=0;g<U.length;g++)if(U[g]==="$"){let x=e.Type.Literal(U.slice(0,g)),_=A(U.slice(g));return yield*[x,..._]}yield e.Type.Literal(U)}function N(U){return[...R(U)]}p.Parse=N})(re||(e.TemplateLiteralDslParser=re={}));var se=class{constructor(p){this.schema=p}Decode(p){return new ee(this.schema,p)}};e.TransformDecodeBuilder=se;var ee=class{constructor(p,w){this.schema=p,this.decode=w}Encode(p){let w=d.Type(this.schema);return a.TTransform(w)?(()=>{let A={Encode:R=>w[e.Transform].Encode(p(R)),Decode:R=>this.decode(w[e.Transform].Decode(R))};return{...w,[e.Transform]:A}})():(()=>{let A={Decode:this.decode,Encode:p};return{...w,[e.Transform]:A}})()}};e.TransformEncodeBuilder=ee;var ce=0,V=class extends r{};e.TypeBuilderError=V;var J=class{Create(p){return p}Throw(p){throw new V(p)}Discard(p,w){return w.reduce((A,R)=>{let{[R]:N,...U}=A;return U},p)}Strict(p){return JSON.parse(JSON.stringify(p))}};e.TypeBuilder=J;var Z=class extends J{ReadonlyOptional(p){return this.Readonly(this.Optional(p))}Readonly(p){return{...d.Type(p),[e.Readonly]:"Readonly"}}Optional(p){return{...d.Type(p),[e.Optional]:"Optional"}}Any(p={}){return this.Create({...p,[e.Kind]:"Any"})}Array(p,w={}){return this.Create({...w,[e.Kind]:"Array",type:"array",items:d.Type(p)})}Boolean(p={}){return this.Create({...p,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(p,w={}){return{...E.Map(d.Type(p),"Capitalize"),...w}}Composite(p,w){let A=e.Type.Intersect(p,{}),R=B.ResolveKeys(A,{includePatterns:!1}).reduce((N,U)=>({...N,[U]:e.Type.Index(A,[U])}),{});return e.Type.Object(R,w)}Enum(p,w={}){if(i.IsUndefined(p))return this.Throw("Enum undefined or empty");let A=Object.getOwnPropertyNames(p).filter(N=>isNaN(N)).map(N=>p[N]),R=[...new Set(A)].map(N=>e.Type.Literal(N));return this.Union(R,{...w,[e.Hint]:"Enum"})}Extends(p,w,A,R,N={}){switch(f.Extends(p,w)){case l.Union:return this.Union([d.Type(A,N),d.Type(R,N)]);case l.True:return d.Type(A,N);case l.False:return d.Type(R,N)}}Exclude(p,w,A={}){return a.TTemplateLiteral(p)?this.Exclude(D.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Exclude(p,D.Resolve(w),A):a.TUnion(p)?(()=>{let R=p.anyOf.filter(N=>f.Extends(N,w)===l.False);return R.length===1?d.Type(R[0],A):this.Union(R,A)})():f.Extends(p,w)!==l.False?this.Never(A):d.Type(p,A)}Extract(p,w,A={}){return a.TTemplateLiteral(p)?this.Extract(D.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Extract(p,D.Resolve(w),A):a.TUnion(p)?(()=>{let R=p.anyOf.filter(N=>f.Extends(N,w)!==l.False);return R.length===1?d.Type(R[0],A):this.Union(R,A)})():f.Extends(p,w)!==l.False?d.Type(p,A):this.Never(A)}Index(p,w,A={}){return a.TArray(p)&&a.TNumber(w)?d.Type(p.items,A):a.TTuple(p)&&a.TNumber(w)?(()=>{let R=(i.IsUndefined(p.items)?[]:p.items).map(N=>d.Type(N));return this.Union(R,A)})():(()=>{let R=M.Resolve(w),N=d.Type(p);return $.Resolve(N,R,A)})()}Integer(p={}){return this.Create({...p,[e.Kind]:"Integer",type:"integer"})}Intersect(p,w={}){if(p.length===0)return e.Type.Never();if(p.length===1)return d.Type(p[0],w);p.some(U=>a.TTransform(U))&&this.Throw("Cannot intersect transform types");let A=p.every(U=>a.TObject(U)),R=d.Rest(p),N=a.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:d.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||a.TSchema(w.unevaluatedProperties)||A?this.Create({...w,...N,[e.Kind]:"Intersect",type:"object",allOf:R}):this.Create({...w,...N,[e.Kind]:"Intersect",allOf:R})}KeyOf(p,w={}){return a.TRecord(p)?(()=>{let A=Object.getOwnPropertyNames(p.patternProperties)[0];return A===e.PatternNumberExact?this.Number(w):A===e.PatternStringExact?this.String(w):this.Throw("Unable to resolve key type from Record key pattern")})():a.TTuple(p)?(()=>{let A=(i.IsUndefined(p.items)?[]:p.items).map((R,N)=>e.Type.Literal(N.toString()));return this.Union(A,w)})():a.TArray(p)?this.Number(w):(()=>{let A=B.ResolveKeys(p,{includePatterns:!1});if(A.length===0)return this.Never(w);let R=A.map(N=>this.Literal(N));return this.Union(R,w)})()}Literal(p,w={}){return this.Create({...w,[e.Kind]:"Literal",const:p,type:typeof p})}Lowercase(p,w={}){return{...E.Map(d.Type(p),"Lowercase"),...w}}Never(p={}){return this.Create({...p,[e.Kind]:"Never",not:{}})}Not(p,w){return this.Create({...w,[e.Kind]:"Not",not:d.Type(p)})}Null(p={}){return this.Create({...p,[e.Kind]:"Null",type:"null"})}Number(p={}){return this.Create({...p,[e.Kind]:"Number",type:"number"})}Object(p,w={}){let A=Object.getOwnPropertyNames(p),R=A.filter(x=>a.TOptional(p[x])),N=A.filter(x=>!R.includes(x)),U=a.TSchema(w.additionalProperties)?{additionalProperties:d.Type(w.additionalProperties)}:{},g=A.reduce((x,_)=>({...x,[_]:d.Type(p[_])}),{});return N.length>0?this.Create({...w,...U,[e.Kind]:"Object",type:"object",properties:g,required:N}):this.Create({...w,...U,[e.Kind]:"Object",type:"object",properties:g})}Omit(p,w,A={}){let R=M.Resolve(w);return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),N=>{i.IsArray(N.required)&&(N.required=N.required.filter(U=>!R.includes(U)),N.required.length===0&&delete N.required);for(let U of Object.getOwnPropertyNames(N.properties))R.includes(U)&&delete N.properties[U];return this.Create(N)},A)}Partial(p,w={}){return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let R=Object.getOwnPropertyNames(A.properties).reduce((N,U)=>({...N,[U]:this.Optional(A.properties[U])}),{});return this.Object(R,this.Discard(A,["required"]))},w)}Pick(p,w,A={}){let R=M.Resolve(w);return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),N=>{i.IsArray(N.required)&&(N.required=N.required.filter(U=>R.includes(U)),N.required.length===0&&delete N.required);for(let U of Object.getOwnPropertyNames(N.properties))R.includes(U)||delete N.properties[U];return this.Create(N)},A)}Record(p,w,A={}){return a.TTemplateLiteral(p)?(()=>{let R=q.ParseExact(p.pattern);return j.Check(R)?this.Object([...z.Generate(R)].reduce((N,U)=>({...N,[U]:d.Type(w)}),{}),A):this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[p.pattern]:d.Type(w)}})})():a.TUnion(p)?(()=>{let R=k.Resolve(p);if(a.TUnionLiteral(R)){let N=R.anyOf.reduce((U,g)=>({...U,[g.const]:d.Type(w)}),{});return this.Object(N,{...A,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(p)?i.IsString(p.const)||i.IsNumber(p.const)?this.Object({[p.const]:d.Type(w)},A):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(p)||a.TNumber(p)?this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:d.Type(w)}}):a.TString(p)?(()=>{let R=i.IsUndefined(p.pattern)?e.PatternStringExact:p.pattern;return this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[R]:d.Type(w)}})})():this.Never()}Recursive(p,w={}){i.IsUndefined(w.$id)&&(w.$id=`T${ce++}`);let A=p({[e.Kind]:"This",$ref:`${w.$id}`});return A.$id=w.$id,this.Create({...w,[e.Hint]:"Recursive",...A})}Ref(p,w={}){return i.IsString(p)?this.Create({...w,[e.Kind]:"Ref",$ref:p}):(i.IsUndefined(p.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...w,[e.Kind]:"Ref",$ref:p.$id}))}Required(p,w={}){return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let R=Object.getOwnPropertyNames(A.properties).reduce((N,U)=>({...N,[U]:this.Discard(A.properties[U],[e.Optional])}),{});return this.Object(R,A)},w)}Rest(p){return a.TTuple(p)&&!i.IsUndefined(p.items)?d.Rest(p.items):a.TIntersect(p)?d.Rest(p.allOf):a.TUnion(p)?d.Rest(p.anyOf):[]}String(p={}){return this.Create({...p,[e.Kind]:"String",type:"string"})}TemplateLiteral(p,w={}){let A=i.IsString(p)?K.Create(re.Parse(p)):K.Create(p);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:A})}Transform(p){return new se(p)}Tuple(p,w={}){let[A,R,N]=[!1,p.length,p.length],U=d.Rest(p),g=p.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:U,additionalItems:A,minItems:R,maxItems:N}:{...w,[e.Kind]:"Tuple",type:"array",minItems:R,maxItems:N};return this.Create(g)}Uncapitalize(p,w={}){return{...E.Map(d.Type(p),"Uncapitalize"),...w}}Union(p,w={}){return a.TTemplateLiteral(p)?D.Resolve(p):(()=>{let A=p;if(A.length===0)return this.Never(w);if(A.length===1)return this.Create(d.Type(A[0],w));let R=d.Rest(A);return this.Create({...w,[e.Kind]:"Union",anyOf:R})})()}Unknown(p={}){return this.Create({...p,[e.Kind]:"Unknown"})}Unsafe(p={}){return this.Create({...p,[e.Kind]:p[e.Kind]||"Unsafe"})}Uppercase(p,w={}){return{...E.Map(d.Type(p),"Uppercase"),...w}}};e.JsonTypeBuilder=Z;var ye=class extends Z{AsyncIterator(p,w={}){return this.Create({...w,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:d.Type(p)})}Awaited(p,w={}){let A=R=>R.length>0?(()=>{let[N,...U]=R;return[this.Awaited(N),...A(U)]})():R;return a.TIntersect(p)?e.Type.Intersect(A(p.allOf)):a.TUnion(p)?e.Type.Union(A(p.anyOf)):a.TPromise(p)?this.Awaited(p.item):d.Type(p,w)}BigInt(p={}){return this.Create({...p,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(p,w={}){return this.Tuple([...p.parameters],{...w})}Constructor(p,w,A){let[R,N]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Constructor",type:"Constructor",parameters:R,returns:N})}Date(p={}){return this.Create({...p,[e.Kind]:"Date",type:"Date"})}Function(p,w,A){let[R,N]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Function",type:"Function",parameters:R,returns:N})}InstanceType(p,w={}){return d.Type(p.returns,w)}Iterator(p,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:d.Type(p)})}Parameters(p,w={}){return this.Tuple(p.parameters,{...w})}Promise(p,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:d.Type(p)})}RegExp(p,w={}){let A=i.IsString(p)?p:p.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:A})}RegEx(p,w={}){return this.RegExp(p,w)}ReturnType(p,w={}){return d.Type(p.returns,w)}Symbol(p){return this.Create({...p,[e.Kind]:"Symbol",type:"symbol"})}Undefined(p={}){return this.Create({...p,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(p={}){return this.Create({...p,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(p={}){return this.Create({...p,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=ye,e.JsonType=new Z,e.Type=new ye}}),ti=xr(Gr(),1),{String:Gv,Optional:Hv,Boolean:Wv,Object:Jv,Number:Qv}=ti.Type,Yv=Gv.bind(ti.Type),Xv=Qv.bind(ti.Type),rC=Jv.bind(ti.Type),nC=Hv.bind(ti.Type),Zv=Wv.bind(ti.Type),iC=Yv(),oC=Xv(),aC=Zv();function ea(e){return Array.isArray(e)?e:[e]}var e0=["Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function t0(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return t==="string"||t==="number"||t==="bigint"||t==="symbol"?t:t==="function"?"Function":Array.isArray(e)?"Array":e instanceof Uint8Array?"Uint8Array":e.constructor===Object?"Object":r0(e)||"Object"}function r0(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(e0.includes(t))return t}var I=class{constructor(e,t,r){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=r}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};I.uint=new I(0,"uint",!0);I.negint=new I(1,"negint",!0);I.bytes=new I(2,"bytes",!0);I.string=new I(3,"string",!0);I.array=new I(4,"array",!1);I.map=new I(5,"map",!1);I.tag=new I(6,"tag",!1);I.float=new I(7,"float",!0);I.false=new I(7,"false",!0);I.true=new I(7,"true",!0);I.null=new I(7,"null",!0);I.undefined=new I(7,"undefined",!0);I.break=new I(7,"break",!0);var ne=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}`}},oo=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",n0=new TextEncoder;function ta(e){return oo&&globalThis.Buffer.isBuffer(e)}function La(e){return e instanceof Uint8Array?ta(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var i0=24,o0=200,kd=oo?e=>e.length>=i0?globalThis.Buffer.from(e):pc(e):e=>e.length>=o0?n0.encode(e):pc(e),pr=e=>Uint8Array.from(e),a0=oo?(e,t,r)=>ta(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),s0=oo?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),La(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},u0=oo?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function jd(e,t){if(ta(e)&&ta(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 pc(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}var hc=4096;function l0(e){let t=e.length;if(t<=hc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=hc));return r}var c0=256,Nd=class{constructor(e=c0){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=u0(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=a0(r,0,this.cursor)}else t=s0(this.chunks,this.cursor);return e&&this.reset(),t}},f0=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}push(e){if(this.cursor+e.length>this.dest.length)throw new Error("write out of bounds, destination buffer is too small");this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},be="CBOR decode error:",on="CBOR encode error:",ao=[];ao[23]=1;ao[24]=2;ao[25]=3;ao[26]=5;ao[27]=9;function ri(e,t,r){if(e.length-t<r)throw new Error(`${be} not enough data for type`)}var it=[24,256,65536,4294967296,BigInt("18446744073709551616")];function _n(e,t,r){ri(e,t,1);let n=e[t];if(r.strict===!0&&n<it[0])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function Tn(e,t,r){ri(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<it[1])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function En(e,t,r){ri(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<it[2])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function On(e,t,r){ri(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],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<it[3])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${be} integers outside of the safe integer range are not supported`)}function d0(e,t,r,n){return new ne(I.uint,_n(e,t+1,n),2)}function p0(e,t,r,n){return new ne(I.uint,Tn(e,t+1,n),3)}function h0(e,t,r,n){return new ne(I.uint,En(e,t+1,n),5)}function y0(e,t,r,n){return new ne(I.uint,On(e,t+1,n),9)}function xn(e,t){return Bt(e,0,t.value)}function Bt(e,t,r){if(r<it[0]){let n=Number(r);e.push([t|n])}else if(r<it[1]){let n=Number(r);e.push([t|24,n])}else if(r<it[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<it[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<it[4]){let i=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),a=Number(n>>BigInt(32)&BigInt(4294967295));i[8]=o&255,o=o>>8,i[7]=o&255,o=o>>8,i[6]=o&255,o=o>>8,i[5]=o&255,i[4]=a&255,a=a>>8,i[3]=a&255,a=a>>8,i[2]=a&255,a=a>>8,i[1]=a&255,e.push(i)}else throw new Error(`${be} encountered BigInt larger than allowable range`)}}xn.encodedSize=function(e){return Bt.encodedSize(e.value)};Bt.encodedSize=function(e){return e<it[0]?1:e<it[1]?2:e<it[2]?3:e<it[3]?5:9};xn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function g0(e,t,r,n){return new ne(I.negint,-1-_n(e,t+1,n),2)}function m0(e,t,r,n){return new ne(I.negint,-1-Tn(e,t+1,n),3)}function b0(e,t,r,n){return new ne(I.negint,-1-En(e,t+1,n),5)}var Qu=BigInt(-1),Cd=BigInt(1);function v0(e,t,r,n){let i=On(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ne(I.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${be} integers outside of the safe integer range are not supported`);return new ne(I.negint,Qu-BigInt(i),9)}function Yu(e,t){let r=t.value,n=typeof r=="bigint"?r*Qu-Cd:r*-1-1;Bt(e,t.type.majorEncoded,n)}Yu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Qu-Cd:t*-1-1;return r<it[0]?1:r<it[1]?2:r<it[2]?3:r<it[3]?5:9};Yu.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function so(e,t,r,n){ri(e,t,r+n);let i=e.slice(t+r,t+r+n);return new ne(I.bytes,i,r+n)}function w0(e,t,r,n){return so(e,t,1,r)}function _0(e,t,r,n){return so(e,t,2,_n(e,t+1,n))}function T0(e,t,r,n){return so(e,t,3,Tn(e,t+1,n))}function E0(e,t,r,n){return so(e,t,5,En(e,t+1,n))}function O0(e,t,r,n){let i=On(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer bytes lengths not supported`);return so(e,t,9,i)}function ra(e){return e.encodedBytes===void 0&&(e.encodedBytes=I.equals(e.type,I.string)?kd(e.value):e.value),e.encodedBytes}function Ba(e,t){let r=ra(t);Bt(e,t.type.majorEncoded,r.length),e.push(r)}Ba.encodedSize=function(e){let t=ra(e);return Bt.encodedSize(t.length)+t.length};Ba.compareTokens=function(e,t){return x0(ra(e),ra(t))};function x0(e,t){return e.length<t.length?-1:e.length>t.length?1:jd(e,t)}var yc=new TextDecoder,A0=32;function S0(e,t,r){if(r-t<A0){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return yc.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return yc.decode(e.subarray(t,r))}function uo(e,t,r,n,i){let o=r+n;ri(e,t,o);let a=new ne(I.string,S0(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function I0(e,t,r,n){return uo(e,t,1,r,n)}function $0(e,t,r,n){return uo(e,t,2,_n(e,t+1,n),n)}function k0(e,t,r,n){return uo(e,t,3,Tn(e,t+1,n),n)}function j0(e,t,r,n){return uo(e,t,5,En(e,t+1,n),n)}function N0(e,t,r,n){let i=On(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer string lengths not supported`);return uo(e,t,9,i,n)}var C0=Ba;function ni(e,t,r,n){return new ne(I.array,n,r)}function U0(e,t,r,n){return ni(e,t,1,r)}function P0(e,t,r,n){return ni(e,t,2,_n(e,t+1,n))}function R0(e,t,r,n){return ni(e,t,3,Tn(e,t+1,n))}function M0(e,t,r,n){return ni(e,t,5,En(e,t+1,n))}function D0(e,t,r,n){let i=On(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer array lengths not supported`);return ni(e,t,9,i)}function L0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return ni(e,t,1,1/0)}function Xu(e,t){Bt(e,I.array.majorEncoded,t.value)}Xu.compareTokens=xn.compareTokens;Xu.encodedSize=function(e){return Bt.encodedSize(e.value)};function ii(e,t,r,n){return new ne(I.map,n,r)}function B0(e,t,r,n){return ii(e,t,1,r)}function V0(e,t,r,n){return ii(e,t,2,_n(e,t+1,n))}function F0(e,t,r,n){return ii(e,t,3,Tn(e,t+1,n))}function z0(e,t,r,n){return ii(e,t,5,En(e,t+1,n))}function q0(e,t,r,n){let i=On(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer map lengths not supported`);return ii(e,t,9,i)}function K0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return ii(e,t,1,1/0)}function Zu(e,t){Bt(e,I.map.majorEncoded,t.value)}Zu.compareTokens=xn.compareTokens;Zu.encodedSize=function(e){return Bt.encodedSize(e.value)};function G0(e,t,r,n){return new ne(I.tag,r,1)}function H0(e,t,r,n){return new ne(I.tag,_n(e,t+1,n),2)}function W0(e,t,r,n){return new ne(I.tag,Tn(e,t+1,n),3)}function J0(e,t,r,n){return new ne(I.tag,En(e,t+1,n),5)}function Q0(e,t,r,n){return new ne(I.tag,On(e,t+1,n),9)}function el(e,t){Bt(e,I.tag.majorEncoded,t.value)}el.compareTokens=xn.compareTokens;el.encodedSize=function(e){return Bt.encodedSize(e.value)};var Ud=20,Pd=21,Rd=22,Md=23;function Y0(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${be} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ne(I.null,null,1):new ne(I.undefined,void 0,1)}function X0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return new ne(I.break,void 0,1)}function tl(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${be} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${be} Infinity values are not supported`)}return new ne(I.float,e,t)}function Z0(e,t,r,n){return tl(nl(e,t+1),3,n)}function ew(e,t,r,n){return tl(il(e,t+1),5,n)}function tw(e,t,r,n){return tl(Vd(e,t+1),9,n)}function rl(e,t,r){let n=t.value;if(n===!1)e.push([I.float.majorEncoded|Ud]);else if(n===!0)e.push([I.float.majorEncoded|Pd]);else if(n===null)e.push([I.float.majorEncoded|Rd]);else if(n===void 0)e.push([I.float.majorEncoded|Md]);else{let i,o=!1;(!r||r.float64!==!0)&&(Ld(n),i=nl(Kt,1),n===i||Number.isNaN(n)?(Kt[0]=249,e.push(Kt.slice(0,3)),o=!0):(Bd(n),i=il(Kt,1),n===i&&(Kt[0]=250,e.push(Kt.slice(0,5)),o=!0))),o||(rw(n),i=Vd(Kt,1),Kt[0]=251,e.push(Kt.slice(0,9)))}}rl.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){Ld(r);let n=nl(Kt,1);if(r===n||Number.isNaN(r))return 3;if(Bd(r),n=il(Kt,1),r===n)return 5}return 9};var Dd=new ArrayBuffer(9),St=new DataView(Dd,1),Kt=new Uint8Array(Dd,0);function Ld(e){if(e===1/0)St.setUint16(0,31744,!1);else if(e===-1/0)St.setUint16(0,64512,!1);else if(Number.isNaN(e))St.setUint16(0,32256,!1);else{St.setFloat32(0,e);let t=St.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)St.setUint16(0,31744,!1);else if(r===0)St.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?St.setUint16(0,0):i<-14?St.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):St.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function nl(e,t){if(e.length-t<2)throw new Error(`${be} 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,o;return n===0?o=i*2**-24:n!==31?o=(i+1024)*2**(n-25):o=i===0?1/0:NaN,r&32768?-o:o}function Bd(e){St.setFloat32(0,e,!1)}function il(e,t){if(e.length-t<4)throw new Error(`${be} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function rw(e){St.setFloat64(0,e,!1)}function Vd(e,t){if(e.length-t<8)throw new Error(`${be} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}rl.compareTokens=xn.compareTokens;function Ne(e,t,r){throw new Error(`${be} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Va(e){return()=>{throw new Error(`${be} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=Ne;le[24]=d0;le[25]=p0;le[26]=h0;le[27]=y0;le[28]=Ne;le[29]=Ne;le[30]=Ne;le[31]=Ne;for(let e=32;e<=55;e++)le[e]=Ne;le[56]=g0;le[57]=m0;le[58]=b0;le[59]=v0;le[60]=Ne;le[61]=Ne;le[62]=Ne;le[63]=Ne;for(let e=64;e<=87;e++)le[e]=w0;le[88]=_0;le[89]=T0;le[90]=E0;le[91]=O0;le[92]=Ne;le[93]=Ne;le[94]=Ne;le[95]=Va("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=I0;le[120]=$0;le[121]=k0;le[122]=j0;le[123]=N0;le[124]=Ne;le[125]=Ne;le[126]=Ne;le[127]=Va("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=U0;le[152]=P0;le[153]=R0;le[154]=M0;le[155]=D0;le[156]=Ne;le[157]=Ne;le[158]=Ne;le[159]=L0;for(let e=160;e<=183;e++)le[e]=B0;le[184]=V0;le[185]=F0;le[186]=z0;le[187]=q0;le[188]=Ne;le[189]=Ne;le[190]=Ne;le[191]=K0;for(let e=192;e<=215;e++)le[e]=G0;le[216]=H0;le[217]=W0;le[218]=J0;le[219]=Q0;le[220]=Ne;le[221]=Ne;le[222]=Ne;le[223]=Ne;for(let e=224;e<=243;e++)le[e]=Va("simple values are not supported");le[244]=Ne;le[245]=Ne;le[246]=Ne;le[247]=Y0;le[248]=Va("simple values are not supported");le[249]=Z0;le[250]=ew;le[251]=tw;le[252]=Ne;le[253]=Ne;le[254]=Ne;le[255]=X0;var lr=[];for(let e=0;e<24;e++)lr[e]=new ne(I.uint,e,1);for(let e=-1;e>=-24;e--)lr[31-e]=new ne(I.negint,e,1);lr[64]=new ne(I.bytes,new Uint8Array(0),1);lr[96]=new ne(I.string,"",1);lr[128]=new ne(I.array,0,1);lr[160]=new ne(I.map,0,1);lr[244]=new ne(I.false,!1,1);lr[245]=new ne(I.true,!0,1);lr[246]=new ne(I.null,null,1);function nw(e){switch(e.type){case I.false:return pr([244]);case I.true:return pr([245]);case I.null:return pr([246]);case I.bytes:return e.value.length?void 0:pr([64]);case I.string:return e.value===""?pr([96]):void 0;case I.array:return e.value===0?pr([128]):void 0;case I.map:return e.value===0?pr([160]):void 0;case I.uint:return e.value<24?pr([Number(e.value)]):void 0;case I.negint:if(e.value>=-24)return pr([31-Number(e.value)])}}var iw=Object.freeze({float64:!0,mapSorter:uw,quickEncodeToken:nw});function Fd(){let e=[];return e[I.uint.major]=xn,e[I.negint.major]=Yu,e[I.bytes.major]=Ba,e[I.string.major]=C0,e[I.array.major]=Xu,e[I.map.major]=Zu,e[I.tag.major]=el,e[I.float.major]=rl,e}var ow=Fd(),aw=new Nd,gc=class zd{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(`${on} object contains circular references`);return new zd(r,t)}},jr={null:new ne(I.null,null),undefined:new ne(I.undefined,void 0),true:new ne(I.true,!0),false:new ne(I.false,!1),emptyArray:new ne(I.array,0),emptyMap:new ne(I.map,0)},zr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ne(I.float,e):e>=0?new ne(I.uint,e):new ne(I.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ne(I.uint,e):new ne(I.negint,e)},Uint8Array(e,t,r,n){return new ne(I.bytes,e)},string(e,t,r,n){return new ne(I.string,e)},boolean(e,t,r,n){return e?jr.true:jr.false},null(e,t,r,n){return jr.null},undefined(e,t,r,n){return jr.undefined},ArrayBuffer(e,t,r,n){return new ne(I.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ne(I.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[jr.emptyArray,new ne(I.break)]:jr.emptyArray;n=gc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=No(a,r,n);return r.addBreakTokens?[new ne(I.array,e.length),i,new ne(I.break)]:[new ne(I.array,e.length),i]},Object(e,t,r,n){let i=t!=="Object",o=i?e.keys():Object.keys(e),a=i?e.size:o.length,s;if(a){s=new Array(a),n=gc.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[No(f,r,n),No(d,r,n)])}l<a&&(s.length=l)}return s?.length?(sw(s,r),r.addBreakTokens?[new ne(I.map,s.length),s,new ne(I.break)]:[new ne(I.map,s.length),s]):r.addBreakTokens===!0?[jr.emptyMap,new ne(I.break)]:jr.emptyMap}};zr.Map=zr.Object;zr.Buffer=zr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))zr[`${e}Array`]=zr.DataView;function No(e,t={},r){let n=t0(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||zr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=zr[n];if(!o)throw new Error(`${on} unsupported type: ${n}`);return o(e,n,t,r)}function sw(e,t){t.mapSorter&&e.sort(t.mapSorter)}function uw(e,t){if(e[0]instanceof ne&&t[0]instanceof ne){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=mc(r.value)),n._keyBytes||(n._keyBytes=mc(n.value)),jd(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function mc(e){return Kd(e,ow,iw)}function qd(e,t,r,n){if(Array.isArray(t))for(let i of t)qd(e,i,r,n);else r[t.type.major](e,t,n)}var sC=I.uint.majorEncoded,uC=I.negint.majorEncoded,lC=I.bytes.majorEncoded,cC=I.string.majorEncoded,fC=I.array.majorEncoded,dC=I.float.majorEncoded|Ud,pC=I.float.majorEncoded|Pd,hC=I.float.majorEncoded|Rd,yC=I.float.majorEncoded|Md,gC=BigInt(-1),mC=BigInt(1);function Kd(e,t,r,n){let i=n instanceof Uint8Array,o=i?new f0(n):aw,a=No(e,r);if(!Array.isArray(a)&&r.quickEncodeToken){let s=r.quickEncodeToken(a);if(s)return i?(o.push(s),o.toBytes()):s;let u=t[a.type.major];if(u.encodedSize){let l=u.encodedSize(a,r);if(i||(o=new Nd(l)),u(o,a,r),o.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${a} was wrong`);return i?o.toBytes():La(o.chunks[0])}}return o.reset(),qd(o,a,t,r),o.toBytes(!0)}var lw={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},cw=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=lr[e];if(t===void 0){let r=le[e];if(!r)throw new Error(`${be} 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}},Li=Symbol.for("DONE"),Fa=Symbol.for("BREAK");function fw(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Bi(t,r);if(o===Fa){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed array`)}if(o===Li)throw new Error(`${be} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function dw(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},a=n?new Map:void 0;for(let s=0;s<e.value;s++){let u=Bi(t,r);if(u===Fa){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed map`)}if(u===Li)throw new Error(`${be} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!n&&typeof u!="string")throw new Error(`${be} non-string keys not supported (got ${typeof u})`);if(i&&(n&&a.has(u)||!n&&Object.hasOwn(o,u)))throw new Error(`${be} found repeat map key "${u}"`);let l=Bi(t,r);if(l===Li)throw new Error(`${be} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?a.set(u,l):o[u]=l}return n?a:o}function Bi(e,t){if(e.done())return Li;let r=e.next();if(I.equals(r.type,I.break))return Fa;if(r.type.terminal)return r.value;if(I.equals(r.type,I.array))return fw(r,e,t);if(I.equals(r.type,I.map))return dw(r,e,t);if(I.equals(r.type,I.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Bi(e,t);return t.tags[r.value](n)}throw new Error(`${be} tag not supported (${r.value})`)}throw new Error("unsupported")}function pw(e,t){if(!(e instanceof Uint8Array))throw new Error(`${be} data to decode must be a Uint8Array`);t=Object.assign({},lw,t);let r=La(e),n=t.tokenizer||new cw(r,t),i=Bi(n,t);if(i===Li)throw new Error(`${be} did not find any content to decode`);if(i===Fa)throw new Error(`${be} got unexpected break`);return[i,e.subarray(n.pos())]}function hw(e,t){let[r,n]=pw(e,t);if(n.length>0)throw new Error(`${be} too many terminals, data makes no sense`);return r}var yw={};ei(yw,{base36:()=>Co,base36upper:()=>Iw});var bC=new Uint8Array(0);function gw(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function ol(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 mw(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 o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var B=0,W=0,M=0,k=T.length;M!==k&&T[M]===0;)M++,B++;for(var F=(k-M)*f+1>>>0,K=new Uint8Array(F);M!==k;){for(var D=T[M],Q=0,q=F-1;(D!==0||Q<W)&&q!==-1;q--,Q++)D+=256*K[q]>>>0,K[q]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");W=Q,M++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var j=u.repeat(B);te<F;++te)j+=e.charAt(K[te]);return j}function $(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var B=0;if(T[B]!==" "){for(var W=0,M=0;T[B]===u;)W++,B++;for(var k=(T.length-B)*l+1>>>0,F=new Uint8Array(k);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var D=0,Q=k-1;(K!==0||D<M)&&Q!==-1;Q--,D++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");M=D,B++}if(T[B]!==" "){for(var q=k-M;q!==k&&F[q]===0;)q++;for(var te=new Uint8Array(W+(k-q)),j=W;q!==k;)te[j++]=F[q++];return te}}}function E(T){var B=$(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:$,decode:E}}var bw=mw,vw=bw,ww=vw,_w=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Tw=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){this.name=e,this.prefix=t;let n=t.codePointAt(0);if(n===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Gd(this,e)}},Ew=class{decoders;constructor(e){this.decoders=e}or(e){return Gd(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Gd(e,t){return new Ew({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Ow=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new _w(e,t,r),this.decoder=new Tw(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Hd({name:e,prefix:t,encode:r,decode:n}){return new Ow(e,t,r,n)}function za({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=ww(r,e);return Hd({prefix:t,name:e,encode:n,decode:o=>ol(i(o))})}function xw(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function Aw(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function Sw(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function _t({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=Sw(n);return Hd({prefix:t,name:e,encode(o){return Aw(o,n,r)},decode(o){return xw(o,i,r,e)}})}var Co=za({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Iw=za({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),$w=Wd,bc=128,kw=127,jw=~kw,Nw=Math.pow(2,31);function Wd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Nw;)t[r++]=e&255|bc,e/=128;for(;e&jw;)t[r++]=e&255|bc,e>>>=7;return t[r]=e|0,Wd.bytes=r-n+1,t}var Cw=Js,Uw=128,vc=127;function Js(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Js.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&vc)<<i:(a&vc)*Math.pow(2,i),i+=7}while(a>=Uw);return Js.bytes=o-n,r}var Pw=Math.pow(2,7),Rw=Math.pow(2,14),Mw=Math.pow(2,21),Dw=Math.pow(2,28),Lw=Math.pow(2,35),Bw=Math.pow(2,42),Vw=Math.pow(2,49),Fw=Math.pow(2,56),zw=Math.pow(2,63),qw=function(e){return e<Pw?1:e<Rw?2:e<Mw?3:e<Dw?4:e<Lw?5:e<Bw?6:e<Vw?7:e<Fw?8:e<zw?9:10},Kw={encode:$w,decode:Cw,encodingLength:qw},Gw=Kw,na=Gw;function Qs(e,t=0){return[na.decode(e,t),na.decode.bytes]}function ia(e,t,r=0){return na.encode(e,t,r),t}function oa(e){return na.encodingLength(e)}function Hw(e,t){let r=t.byteLength,n=oa(e),i=n+oa(r),o=new Uint8Array(i+r);return ia(e,o,0),ia(r,o,n),o.set(t,i),new al(e,r,t,o)}function Ww(e){let t=ol(e),[r,n]=Qs(t),[i,o]=Qs(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new al(r,i,a,t)}function Jw(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&gw(e.bytes,r.bytes)}}var al=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}},Qw={};ei(Qw,{base32:()=>Ci,base32hex:()=>e1,base32hexpad:()=>r1,base32hexpadupper:()=>n1,base32hexupper:()=>t1,base32pad:()=>Xw,base32padupper:()=>Zw,base32upper:()=>Yw,base32z:()=>i1});var Ci=_t({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Yw=_t({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Xw=_t({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Zw=_t({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),e1=_t({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),t1=_t({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),r1=_t({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),n1=_t({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),i1=_t({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),o1={};ei(o1,{base58btc:()=>hr,base58flickr:()=>a1});var hr=za({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),a1=za({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});function wc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return u1(r,Ys(e),t??hr.encoder);default:return l1(r,Ys(e),t??Ci.encoder)}}var _c=new WeakMap;function Ys(e){let t=_c.get(e);if(t==null){let r=new Map;return _c.set(e,r),r}return t}var qa=class lt{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Ti)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==c1)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return lt.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=Hw(t,r);return lt.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 lt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Jw(t.multihash,n.multihash)}toString(t){return wc(this,t)}toJSON(){return{"/":wc(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof lt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new lt(n,i,o,a??Tc(n,i,o.bytes))}else if(r[f1]===!0){let{version:n,multihash:i,code:o}=r,a=Ww(i);return lt.create(n,o,a)}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!==Ti)throw new Error(`Version 0 CID must use dag-pb (code: ${Ti}) block encoding`);return new lt(t,r,n,n.bytes)}case 1:{let i=Tc(t,r,n.bytes);return new lt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return lt.create(0,Ti,t)}static createV1(t,r){return lt.create(1,t,r)}static decode(t){let[r,n]=lt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=lt.inspectBytes(t),n=r.size-r.multihashSize,i=ol(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new al(r.multihashCode,r.digestSize,o,i);return[r.version===0?lt.createV0(a):lt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,$]=Qs(t.subarray(r));return r+=$,d},i=n(),o=Ti;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=s1(t,r),o=lt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ys(o).set(n,t),o}};function s1(e,t){switch(e[0]){case"Q":{let r=t??hr;return[hr.prefix,r.decode(`${hr.prefix}${e}`)]}case hr.prefix:{let r=t??hr;return[hr.prefix,r.decode(e)]}case Ci.prefix:{let r=t??Ci;return[Ci.prefix,r.decode(e)]}case Co.prefix:{let r=t??Co;return[Co.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function u1(e,t,r){let{prefix:n}=r;if(n!==hr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function l1(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Ti=112,c1=18;function Tc(e,t,r){let n=oa(e),i=n+oa(t),o=new Uint8Array(i+r.byteLength);return ia(e,o,0),ia(t,o,n),o.set(r,i),o}var f1=Symbol.for("@ipld/js-cid/CID");function d1(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Jd(e,t,r=""){let n=d1(e),i=e?.length,o=t!==void 0;if(!n||o&&i!==t){let a=r&&`"${r}" `,s=o?` of length ${t}`:"",u=n?`length=${i}`:`type=${typeof e}`;throw new Error(a+"expected Uint8Array"+s+", got "+u)}return e}function Ec(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function p1(e,t){Jd(e,void 0,"digestInto() output");let r=t.outputLen;if(e.length<r)throw new Error('"digestInto() output" expected to be of length >='+r)}function Xs(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function As(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function tr(e,t){return e<<32-t|e>>>t}function h1(e,t={}){let r=(i,o)=>e(o).update(i).digest(),n=e(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.create=i=>e(i),Object.assign(r,t),Object.freeze(r)}var y1=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function g1(e,t,r){return e&t^~e&r}function m1(e,t,r){return e&t^e&r^t&r}var b1=class{blockLen;outputLen;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,r,n){this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=As(this.buffer)}update(e){Ec(this),Jd(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let o=0;o<i;){let a=Math.min(n-this.pos,i-o);if(a===n){let s=As(e);for(;n<=i-o;o+=n)this.process(s,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ec(this),p1(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,Xs(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(r,0),o=0);for(let f=o;f<n;f++)t[f]=0;r.setBigUint64(n-8,BigInt(this.length*8),i),this.process(r,0);let a=As(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let u=s/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,l[f],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=i,e.length=n,e.pos=a,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},Nr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),vC=BigInt(2**32-1),v1=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Cr=new Uint32Array(64),w1=class extends b1{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=s|0}process(e,t){for(let f=0;f<16;f++,t+=4)Cr[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let d=Cr[f-15],$=Cr[f-2],E=tr(d,7)^tr(d,18)^d>>>3,T=tr($,17)^tr($,19)^$>>>10;Cr[f]=T+Cr[f-7]+E+Cr[f-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:u,H:l}=this;for(let f=0;f<64;f++){let d=tr(a,6)^tr(a,11)^tr(a,25),$=l+d+g1(a,s,u)+v1[f]+Cr[f]|0,E=(tr(r,2)^tr(r,13)^tr(r,22))+m1(r,n,i)|0;l=u,u=s,s=a,a=o+$|0,o=i,i=n,n=r,r=$+E|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,n,i,o,a,s,u,l)}roundClean(){Xs(Cr)}destroy(){this.set(0,0,0,0,0,0,0,0),Xs(this.buffer)}},_1=class extends w1{A=Nr[0]|0;B=Nr[1]|0;C=Nr[2]|0;D=Nr[3]|0;E=Nr[4]|0;F=Nr[5]|0;G=Nr[6]|0;H=Nr[7]|0;constructor(){super(32)}},T1=h1(()=>new _1,y1(1)),wC=new Uint8Array(0);function E1(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0}function sl(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 O1(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 o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var B=0,W=0,M=0,k=T.length;M!==k&&T[M]===0;)M++,B++;for(var F=(k-M)*f+1>>>0,K=new Uint8Array(F);M!==k;){for(var D=T[M],Q=0,q=F-1;(D!==0||Q<W)&&q!==-1;q--,Q++)D+=256*K[q]>>>0,K[q]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");W=Q,M++}for(var te=F-W;te!==F&&K[te]===0;)te++;for(var j=u.repeat(B);te<F;++te)j+=e.charAt(K[te]);return j}function $(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var B=0;if(T[B]!==" "){for(var W=0,M=0;T[B]===u;)W++,B++;for(var k=(T.length-B)*l+1>>>0,F=new Uint8Array(k);T[B];){var K=r[T.charCodeAt(B)];if(K===255)return;for(var D=0,Q=k-1;(K!==0||D<M)&&Q!==-1;Q--,D++)K+=s*F[Q]>>>0,F[Q]=K%256>>>0,K=K/256>>>0;if(K!==0)throw new Error("Non-zero carry");M=D,B++}if(T[B]!==" "){for(var q=k-M;q!==k&&F[q]===0;)q++;for(var te=new Uint8Array(W+(k-q)),j=W;q!==k;)te[j++]=F[q++];return te}}}function E(T){var B=$(T);if(B)return B;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:$,decode:E}}var x1=O1,A1=x1,S1=A1,I1=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},$1=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){this.name=e,this.prefix=t;let n=t.codePointAt(0);if(n===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n,this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Qd(this,e)}},k1=class{decoders;constructor(e){this.decoders=e}or(e){return Qd(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Qd(e,t){return new k1({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var j1=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new I1(e,t,r),this.decoder=new $1(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Yd({name:e,prefix:t,encode:r,decode:n}){return new j1(e,t,r,n)}function Ka({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=S1(r,e);return Yd({prefix:t,name:e,encode:n,decode:o=>sl(i(o))})}function N1(e,t,r,n){let i=e.length;for(;e[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),a=0,s=0,u=0;for(let l=0;l<i;++l){let f=t[e[l]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);s=s<<r|f,a+=r,a>=8&&(a-=8,o[u++]=255&s>>a)}if(a>=r||255&s<<8-a)throw new SyntaxError("Unexpected end of data");return o}function C1(e,t,r){let n=t[t.length-1]==="=",i=(1<<r)-1,o="",a=0,s=0;for(let u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>r;)a-=r,o+=t[i&s>>a];if(a!==0&&(o+=t[i&s<<r-a]),n)for(;o.length*r&7;)o+="=";return o}function U1(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Ar({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=U1(n);return Yd({prefix:t,name:e,encode(o){return C1(o,n,r)},decode(o){return N1(o,i,r,e)}})}var Uo=Ka({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_C=Ka({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),P1={};ei(P1,{base64:()=>ul,base64pad:()=>R1,base64url:()=>M1,base64urlpad:()=>D1});var ul=_t({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),R1=_t({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),M1=_t({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),D1=_t({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),L1={0:"Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'",1:function(e,t){return"Cannot apply '"+e+"' to '"+t.toString()+"': Field not found."},5:"'keys()' can only be used on observable objects, arrays, sets and maps",6:"'values()' can only be used on observable objects, arrays, sets and maps",7:"'entries()' can only be used on observable objects, arrays and maps",8:"'set()' can only be used on observable objects, arrays and maps",9:"'remove()' can only be used on observable objects, arrays and maps",10:"'has()' can only be used on observable objects, arrays and maps",11:"'get()' can only be used on observable objects, arrays and maps",12:"Invalid annotation",13:"Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",14:"Intercept handlers should return nothing or a change object",15:"Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",16:"Modification exception: the internal structure of an observable array was changed.",17:function(e,t){return"[mobx.array] Index out of bounds, "+e+" is larger than "+t},18:"mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js",19:function(e){return"Cannot initialize from classes that inherit from Map: "+e.constructor.name},20:function(e){return"Cannot initialize map from "+e},21:function(e){return"Cannot convert to map from '"+e+"'"},22:"mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js",23:"It is not possible to get index atoms from arrays",24:function(e){return"Cannot obtain administration from "+e},25:function(e,t){return"the entry '"+e+"' does not exist in the observable map '"+t+"'"},26:"please specify a property",27:function(e,t){return"no observable property '"+e.toString()+"' found on the observable object '"+t+"'"},28:function(e){return"Cannot obtain atom from "+e},29:"Expecting some object",30:"invalid action stack. did you forget to finish an action?",31:"missing option for computed: get",32:function(e,t){return"Cycle detected in computation "+e+": "+t},33:function(e){return"The setter of computed value '"+e+"' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"},34:function(e){return"[ComputedValue '"+e+"'] It is not possible to assign a new value to a computed value."},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:"isolateGlobalState should be called before MobX is running any reactions",37:function(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:"'ownKeys()' can only be used on observable objects",39:"'defineProperty()' can only be used on observable objects"},B1=L1;function de(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var i=typeof e=="string"?e:B1[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var V1={};function Ga(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:V1}var Xd=Object.assign,aa=Object.getOwnPropertyDescriptor,nr=Object.defineProperty,lo=Object.prototype,sa=[];Object.freeze(sa);var ll={};Object.freeze(ll);var F1=typeof Proxy<"u",z1=Object.toString();function Zd(){F1||de("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function Ei(e){X.verifyProxies&&de("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function Vt(){return++X.mobxGuid}function cl(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Rn=function(){};function Fe(e){return typeof e=="function"}function an(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function Ha(e){return e!==null&&typeof e=="object"}function Yt(e){if(!Ha(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()===z1}function ep(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Wa(e,t,r){nr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function tp(e,t,r){nr(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function Hr(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return Ha(n)&&n[r]===!0}}function oi(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function q1(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function yr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var rp=typeof Object.getOwnPropertySymbols<"u";function K1(e){var t=Object.keys(e);if(!rp)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return lo.propertyIsEnumerable.call(e,n)})):t}var Ja=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:rp?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Zs(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function np(e){return e===null?null:typeof e=="object"?""+e:e}function Ut(e,t){return lo.hasOwnProperty.call(e,t)}var G1=Object.getOwnPropertyDescriptors||function(e){var t={};return Ja(e).forEach(function(r){t[r]=aa(e,r)}),t};function mt(e,t){return!!(e&t)}function bt(e,t,r){return r?e|=t:e&=~t,e}function Oc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function xc(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,W1(n.key),n)}}function ai(e,t,r){return t&&xc(e.prototype,t),r&&xc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Mn(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=J1(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vr(){return vr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},vr.apply(null,arguments)}function ip(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,eu(e,t)}function eu(e,t){return eu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},eu(e,t)}function H1(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function W1(e){var t=H1(e,"string");return typeof t=="symbol"?t:t+""}function J1(e,t){if(e){if(typeof e=="string")return Oc(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Oc(e,t):void 0}}var gt=Symbol("mobx-stored-annotations");function ir(e){function t(r,n){if(fo(n))return e.decorate_20223_(r,n);co(r,n,e)}return Object.assign(t,e)}function co(e,t,r){if(Ut(e,gt)||Wa(e,gt,vr({},e[gt])),ua(r)&&!Ut(e[gt],t)){var n=e.constructor.name+".prototype."+t.toString();de("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}Q1(e,r,t),ua(r)||(e[gt][t]=r)}function Q1(e,t,r){if(!ua(t)&&Ut(e[gt],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[gt][r].annotationType_,o=t.annotationType_;de("Cannot apply '@"+o+"' to '"+n+"':"+(`
|
|
3
|
+
The field is already decorated with '@`+i+"'.")+`
|
|
4
|
+
Re-decorating fields is not allowed.
|
|
5
|
+
Use '@override' decorator for methods overridden by subclass.`)}}function Y1(e){return Ut(e,gt)||Wa(e,gt,vr({},e[gt])),e[gt]}function fo(e){return typeof e=="object"&&typeof e.kind=="string"}function Qa(e,t){t.includes(e.kind)||de("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var we=Symbol("mobx administration"),Wr=function(){function e(r){r===void 0&&(r="Atom@"+Vt()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=$e.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 wp(this)},t.reportChanged=function(){jt(),_p(this),Nt()},t.toString=function(){return this.name_},ai(e,[{key:"isBeingObserved",get:function(){return mt(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=bt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return mt(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=bt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return mt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=bt(this.flags_,e.diffValueMask_,r===1)}}])}();Wr.isBeingObservedMask_=1;Wr.isPendingUnobservationMask_=2;Wr.diffValueMask_=4;var fl=Hr("Atom",Wr);function op(e,t,r){t===void 0&&(t=Rn),r===void 0&&(r=Rn);var n=new Wr(e);return t!==Rn&&ts(n,t),r!==Rn&&ui(n,r),n}function X1(e,t){return e===t}function Z1(e,t){return bl(e,t)}function e_(e,t){return bl(e,t,1)}function t_(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Je={identity:X1,structural:Z1,default:t_,shallow:e_};function si(e,t,r){return Vn(e)?e:Array.isArray(e)?Be.array(e,{name:r}):Yt(e)?Be.object(e,void 0,{name:r}):oi(e)?Be.map(e,{name:r}):yr(e)?Be.set(e,{name:r}):typeof e=="function"&&!un(e)&&!zi(e)?ep(e)?Bn(e):Vi(r,e):e}function r_(e,t,r){if(e==null||ln(e)||ci(e)||cr(e)||Gt(e))return e;if(Array.isArray(e))return Be.array(e,{name:r,deep:!1});if(Yt(e))return Be.object(e,void 0,{name:r,deep:!1});if(oi(e))return Be.map(e,{name:r,deep:!1});if(yr(e))return Be.set(e,{name:r,deep:!1});de("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Ya(e){return e}function n_(e,t){return Vn(e)&&de("observable.struct should not be used with observable values"),bl(e,t)?t:e}var i_="override";function ua(e){return e.annotationType_===i_}function po(e,t){return{annotationType_:e,options_:t,make_:o_,extend_:a_,decorate_20223_:s_}}function o_(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(un(r.value))return 1;var o=ap(e,this,t,r,!1);return nr(n,t,o),2}function a_(e,t,r,n){var i=ap(e,this,t,r);return e.defineProperty_(t,i,n)}function s_(e,t){Qa(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,a=function(u){var l,f,d,$;return sn((l=(f=o.options_)==null?void 0:f.name)!=null?l:n.toString(),u,(d=($=o.options_)==null?void 0:$.autoAction)!=null?d:!1)};if(r=="field")return function(u){var l,f=u;return un(f)||(f=a(f)),(l=o.options_)!=null&&l.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(r=="method"){var s;return un(e)||(e=a(e)),(s=this.options_)!=null&&s.bound&&i(function(){var u=this,l=u[n].bind(u);l.isMobxAction=!0,u[n]=l}),e}de("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
|
|
6
|
+
'`+o.annotationType_+"' can only be used on properties with a function value."))}function u_(e,t,r,n){var i=t.annotationType_,o=n.value;Fe(o)||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
7
|
+
'`+i+"' can only be used on properties with a function value."))}function ap(e,t,r,n,i){var o,a,s,u,l,f,d;i===void 0&&(i=X.safeDescriptors),u_(e,t,r,n);var $=n.value;if((o=t.options_)!=null&&o.bound){var E;$=$.bind((E=e.proxy_)!=null?E:e.target_)}return{value:sn((a=(s=t.options_)==null?void 0:s.name)!=null?a:r.toString(),$,(u=(l=t.options_)==null?void 0:l.autoAction)!=null?u:!1,(f=t.options_)!=null&&f.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function sp(e,t){return{annotationType_:e,options_:t,make_:l_,extend_:c_,decorate_20223_:f_}}function l_(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&&(!Ut(e.target_,t)||!zi(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(zi(r.value))return 1;var o=up(e,this,t,r,!1,!1);return nr(n,t,o),2}function c_(e,t,r,n){var i,o=up(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function f_(e,t){var r;Qa(t,["method"]);var n=t.name,i=t.addInitializer;return zi(e)||(e=Bn(e)),(r=this.options_)!=null&&r.bound&&i(function(){var o=this,a=o[n].bind(o);a.isMobXFlow=!0,o[n]=a}),e}function d_(e,t,r,n){var i=t.annotationType_,o=n.value;Fe(o)||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
8
|
+
'`+i+"' can only be used on properties with a generator function value."))}function up(e,t,r,n,i,o){o===void 0&&(o=X.safeDescriptors),d_(e,t,r,n);var a=n.value;if(zi(a)||(a=Bn(a)),i){var s;a=a.bind((s=e.proxy_)!=null?s:e.target_),a.isMobXFlow=!0}return{value:a,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function dl(e,t){return{annotationType_:e,options_:t,make_:p_,extend_:h_,decorate_20223_:y_}}function p_(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function h_(e,t,r,n){return g_(e,this,t,r),e.defineComputedProperty_(t,vr({},this.options_,{get:r.get,set:r.set}),n)}function y_(e,t){Qa(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=fi(this)[we],a=vr({},r.options_,{get:e,context:this});a.name||(a.name=o.name_+"."+n.toString()),o.values_.set(n,new Rt(a))}),function(){return this[we].getObservablePropValue_(n)}}function g_(e,t,r,n){var i=t.annotationType_,o=n.get;o||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
9
|
+
'`+i+"' can only be used on getter(+setter) properties."))}function Xa(e,t){return{annotationType_:e,options_:t,make_:m_,extend_:b_,decorate_20223_:v_}}function m_(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function b_(e,t,r,n){var i,o;return w_(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:si,n)}function v_(e,t){if(t.kind==="field")throw de("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");Qa(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function a(s,u){var l,f,d=fi(s)[we],$=new Br(u,(l=(f=r.options_)==null?void 0:f.enhancer)!=null?l:si,d.name_+"."+i.toString(),!1);d.values_.set(i,$),o.add(s)}if(n=="accessor")return{get:function(){return o.has(this)||a(this,e.get.call(this)),this[we].getObservablePropValue_(i)},set:function(s){return o.has(this)||a(this,s),this[we].setObservablePropValue_(i,s)},init:function(s){return o.has(this)||a(this,s),s}}}function w_(e,t,r,n){var i=t.annotationType_;"value"in n||de("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
10
|
+
'`+i+"' cannot be used on getter/setter properties"))}var __="true",T_=lp();function lp(e){return{annotationType_:__,options_:e,make_:E_,extend_:O_,decorate_20223_:x_}}function E_(e,t,r,n){var i,o;if(r.get)return He.make_(e,t,r,n);if(r.set){var a=sn(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(nr(n,t,{configurable:!0,set:a}),2)}if(n!==e.target_&&typeof r.value=="function"){var s;if(ep(r.value)){var u,l=(u=this.options_)!=null&&u.autoBind?Bn.bound:Bn;return l.make_(e,t,r,n)}var f=(s=this.options_)!=null&&s.autoBind?Vi.bound:Vi;return f.make_(e,t,r,n)}var d=((i=this.options_)==null?void 0:i.deep)===!1?Be.ref:Be;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var $;r.value=r.value.bind(($=e.proxy_)!=null?$:e.target_)}return d.make_(e,t,r,n)}function O_(e,t,r,n){var i,o;if(r.get)return He.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:sn(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var a;r.value=r.value.bind((a=e.proxy_)!=null?a:e.target_)}var s=((o=this.options_)==null?void 0:o.deep)===!1?Be.ref:Be;return s.extend_(e,t,r,n)}function x_(e,t){de("'"+this.annotationType_+"' cannot be used as a decorator")}var A_="observable",S_="observable.ref",I_="observable.shallow",$_="observable.struct",cp={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(cp);function Eo(e){return e||cp}var tu=Xa(A_),k_=Xa(S_,{enhancer:Ya}),j_=Xa(I_,{enhancer:r_}),N_=Xa($_,{enhancer:n_}),fp=ir(tu);function Oo(e){return e.deep===!0?si:e.deep===!1?Ya:U_(e.defaultDecorator)}function C_(e){var t;return e?(t=e.defaultDecorator)!=null?t:lp(e):void 0}function U_(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:si}function dp(e,t,r){if(fo(t))return tu.decorate_20223_(e,t);if(an(t)){co(e,t,tu);return}return Vn(e)?e:Yt(e)?Be.object(e,t,r):Array.isArray(e)?Be.array(e,t):oi(e)?Be.map(e,t):yr(e)?Be.set(e,t):typeof e=="object"&&e!==null?e:Be.box(e,t)}Xd(dp,fp);var P_={box:function(e,t){var r=Eo(t);return new Br(e,Oo(r),r.name,!0,r.equals)},array:function(e,t){var r=Eo(t);return(X.useProxies===!1||r.proxy===!1?LT:$T)(e,Oo(r),r.name)},map:function(e,t){var r=Eo(t);return new Pp(e,Oo(r),r.name)},set:function(e,t){var r=Eo(t);return new Rp(e,Oo(r),r.name)},object:function(e,t,r){return Sn(function(){return bT(X.useProxies===!1||r?.proxy===!1?fi({},r):AT({},r),e,t)})},ref:ir(k_),shallow:ir(j_),deep:fp,struct:ir(N_)},Be=Xd(dp,P_),pp="computed",R_="computed.struct",ru=dl(pp),M_=dl(R_,{equals:Je.structural}),He=function(e,t){if(fo(t))return ru.decorate_20223_(e,t);if(an(t))return co(e,t,ru);if(Yt(e))return ir(dl(pp,e));Fe(e)||de("First argument to `computed` should be an expression."),Fe(t)&&de("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=Yt(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Rt(r)};Object.assign(He,ru);He.struct=ir(M_);var Ac,Sc,la=0,D_=1,L_=(Ac=(Sc=aa(function(){},"name"))==null?void 0:Sc.configurable)!=null?Ac:!1,Ic={value:"action",configurable:!0,writable:!1,enumerable:!1};function sn(e,t,r,n){r===void 0&&(r=!1),Fe(t)||de("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&de("actions should have valid names, got: '"+e+"'");function i(){return hp(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},L_&&(Ic.value=e,nr(i,"name",Ic)),i}function hp(e,t,r,n,i){var o=B_(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{V_(o)}}function B_(e,t,r,n){var i=ot()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):sa;vt({type:hl,name:e,object:r,arguments:a})}var s=X.trackingDerivation,u=!t||!s;jt();var l=X.allowStateChanges;u&&(An(),l=Za(!0));var f=pl(!0),d={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:D_++,parentActionId_:la};return la=d.actionId_,d}function V_(e){la!==e.actionId_&&de(30),la=e.parentActionId_,e.error_!==void 0&&(X.suppressReactionErrors=!0),es(e.prevAllowStateChanges_),Ui(e.prevAllowStateReads_),Nt(),e.runAsAction_&&mr(e.prevDerivation_),e.notifySpy_&&wt({time:Date.now()-e.startTime_}),X.suppressReactionErrors=!1}function F_(e,t){var r=Za(e);try{return t()}finally{es(r)}}function Za(e){var t=X.allowStateChanges;return X.allowStateChanges=e,t}function es(e){X.allowStateChanges=e}var z_="create",Br=function(e){function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+Vt()),a===void 0&&(a=!0),s===void 0&&(s=Je.default),u=e.call(this,o)||this,u.enhancer=void 0,u.name_=void 0,u.equals=void 0,u.hasUnreportedChange_=!1,u.interceptors_=void 0,u.changeListeners_=void 0,u.value_=void 0,u.dehancer=void 0,u.enhancer=i,u.name_=o,u.equals=s,u.value_=i(n,void 0,o),a&&ot()&&Ln({type:z_,object:u,observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}ip(t,e);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!==X.UNCHANGED){var o=ot();o&&vt({type:Wt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:n,oldValue:i}),this.setNewValue_(n),o&&wt()}},r.prepareNewValue_=function(n){if(rr(this),$t(this)){var i=kt(this,{object:this,type:Wt,newValue:n});if(!i)return X.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?X.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),Jt(this)&&Qt(this,{type:Wt,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return yo(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:Wt,newValue:this.value_,oldValue:void 0}),go(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 np(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Wr),q_=Hr("ObservableValue",Br),Rt=function(){function e(r){this.dependenciesState_=$e.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new ca(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Pt.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||de(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+Vt(),r.set&&(this.setter_=sn(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Je.structural:Je.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){tT(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&&de(32,this.name_,this.derivation),X.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)nu(this)&&(this.warnAboutUntrackedRead_(),jt(),this.value_=this.computeValue_(!1),Nt());else if(wp(this),nu(this)){var r=X.trackingContext;this.keepAlive_&&!r&&(X.trackingContext=this),this.trackAndCompute()&&eT(this),X.trackingContext=r}var n=this.value_;if(Po(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter&&de(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else de(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===$e.NOT_TRACKING_,i=this.computeValue_(!0),o=n||Po(r)||Po(i)||!this.equals_(r,i);return o&&(this.value_=i,ot()&&Ln({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing=!0;var n=Za(!1),i;if(r)i=yp(this,this.derivation,this.scope_);else if(X.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new ca(o)}return es(n),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(iu(this),this.value_=void 0,this.isTracing_!==Pt.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(r,n){var i=this,o=!0,a=void 0;return Mt(function(){var s=i.get();if(!o||n){var u=An();r({observableKind:"computed",debugObjectName:i.name_,type:Wt,object:i,newValue:s,oldValue:a}),mr(u)}o=!1,a=s})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==Pt.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),(typeof this.requiresReaction_=="boolean"?this.requiresReaction_:X.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute.")},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return np(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},ai(e,[{key:"isComputing",get:function(){return mt(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=bt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return mt(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=bt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return mt(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=bt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return mt(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=bt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return mt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=bt(this.flags_,e.diffValueMask_,r===1)}}])}();Rt.isComputingMask_=1;Rt.isRunningSetterMask_=2;Rt.isBeingObservedMask_=4;Rt.isPendingUnobservationMask_=8;Rt.diffValueMask_=16;var ho=Hr("ComputedValue",Rt),$e;(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_"})($e||($e={}));var Pt;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Pt||(Pt={}));var ca=function(e){this.cause=void 0,this.cause=e};function Po(e){return e instanceof ca}function nu(e){switch(e.dependenciesState_){case $e.UP_TO_DATE_:return!1;case $e.NOT_TRACKING_:case $e.STALE_:return!0;case $e.POSSIBLY_STALE_:{for(var t=pl(!0),r=An(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(ho(a)){if(X.disableErrorBoundaries)a.get();else try{a.get()}catch{return mr(r),Ui(t),!0}if(e.dependenciesState_===$e.STALE_)return mr(r),Ui(t),!0}}return gp(e),mr(r),Ui(t),!1}}}function K_(){return X.trackingDerivation!==null}function rr(e){var t=e.observers_.size>0;!X.allowStateChanges&&(t||X.enforceActions==="always")&&console.warn("[MobX] "+(X.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}function G_(e){!X.allowStateReads&&X.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function yp(e,t,r){var n=pl(!0);gp(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++X.runId;var i=X.trackingDerivation;X.trackingDerivation=e,X.inBatch++;var o;if(X.disableErrorBoundaries===!0)o=t.call(r);else try{o=t.call(r)}catch(a){o=new ca(a)}return X.inBatch--,X.trackingDerivation=i,W_(e),H_(e),Ui(n),o}function H_(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:X.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function W_(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=$e.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,a=0;a<o;a++){var s=r[a];s.diffValue===0&&(s.diffValue=1,i!==a&&(r[i]=s),i++),s.dependenciesState_>n&&(n=s.dependenciesState_)}for(r.length=i,e.newObserving_=null,o=t.length;o--;){var u=t[o];u.diffValue===0&&bp(u,e),u.diffValue=0}for(;i--;){var l=r[i];l.diffValue===1&&(l.diffValue=0,Z_(l,e))}n!==$e.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function iu(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)bp(t[r],e);e.dependenciesState_=$e.NOT_TRACKING_}function Le(e){var t=An();try{return e()}finally{mr(t)}}function An(){var e=X.trackingDerivation;return X.trackingDerivation=null,e}function mr(e){X.trackingDerivation=e}function pl(e){var t=X.allowStateReads;return X.allowStateReads=e,t}function Ui(e){X.allowStateReads=e}function gp(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=$e.UP_TO_DATE_}}var Ro=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},Mo=!0,mp=!1,X=function(){var e=Ga();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Mo=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Ro().version&&(Mo=!1),Mo?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Ro):(setTimeout(function(){mp||de(35)},1),new Ro)}();function J_(){if((X.pendingReactions.length||X.inBatch||X.isRunningReactions)&&de(36),mp=!0,Mo){var e=Ga();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),X=new Ro}}function Q_(){return X}function Y_(e){return e.observers_&&e.observers_.size>0}function X_(e){return e.observers_}function Z_(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function bp(e,t){e.observers_.delete(t),e.observers_.size===0&&vp(e)}function vp(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,X.pendingUnobservations.push(e))}function jt(){X.inBatch++}function Nt(){if(--X.inBatch===0){Op();for(var e=X.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 Rt&&r.suspend_())}X.pendingUnobservations=[]}}function wp(e){G_(e);var t=X.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&X.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&X.inBatch>0&&vp(e),!1)}function _p(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===$e.UP_TO_DATE_&&(t.isTracing_!==Pt.NONE&&Tp(t,e),t.onBecomeStale_()),t.dependenciesState_=$e.STALE_}))}function eT(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===$e.POSSIBLY_STALE_?(t.dependenciesState_=$e.STALE_,t.isTracing_!==Pt.NONE&&Tp(t,e)):t.dependenciesState_===$e.UP_TO_DATE_&&(e.lowestObserverState_=$e.UP_TO_DATE_)}))}function tT(e){e.lowestObserverState_===$e.UP_TO_DATE_&&(e.lowestObserverState_=$e.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===$e.UP_TO_DATE_&&(t.dependenciesState_=$e.POSSIBLY_STALE_,t.onBecomeStale_())}))}function Tp(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Pt.BREAK){var r=[];Ep(rs(e),r,1),new Function(`debugger;
|
|
11
|
+
/*
|
|
12
|
+
Tracing '`+e.name_+`'
|
|
13
|
+
|
|
14
|
+
You are entering this break point because derivation '`+e.name_+"' is being traced and '"+t.name_+`' is now forcing it to update.
|
|
15
|
+
Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
|
|
16
|
+
The stackframe you are looking for is at least ~6-8 stack-frames up.
|
|
17
|
+
|
|
18
|
+
`+(e instanceof Rt?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
19
|
+
|
|
20
|
+
The dependencies for this derivation are:
|
|
21
|
+
|
|
22
|
+
`+r.join(`
|
|
23
|
+
`)+`
|
|
24
|
+
*/
|
|
25
|
+
`)()}}function Ep(e,t,r){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+" ".repeat(r-1)+e.name),e.dependencies&&e.dependencies.forEach(function(n){return Ep(n,t,r+1)})}var ar=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+Vt()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Pt.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,X.pendingReactions.push(this),Op())},t.runReaction_=function(){if(!this.isDisposed){jt(),this.isScheduled=!1;var r=X.trackingContext;if(X.trackingContext=this,nu(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&ot()&&Ln({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}X.trackingContext=r,Nt()}},t.track=function(r){if(!this.isDisposed){jt();var n=ot(),i;n&&(i=Date.now(),vt({name:this.name_,type:"reaction"})),this.isRunning=!0;var o=X.trackingContext;X.trackingContext=this;var a=yp(this,r,void 0);X.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&iu(this),Po(a)&&this.reportExceptionInDerivation_(a.cause),n&&wt({time:Date.now()-i}),Nt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(X.disableErrorBoundaries)throw r;var i="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";X.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(i,r),ot()&&Ln({type:"error",name:this.name_,message:i,error:""+r}),X.globalReactionErrorHandlers.forEach(function(o){return o(r,n)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(jt(),iu(this),Nt()))},t.getDisposer_=function(r){var n=this,i=function o(){n.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",o)};return r==null||r.addEventListener==null||r.addEventListener("abort",i),i[we]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),Cp(this,r)},ai(e,[{key:"isDisposed",get:function(){return mt(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=bt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return mt(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=bt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return mt(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=bt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return mt(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=bt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return mt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=bt(this.flags_,e.diffValueMask_,r===1)}}])}();ar.isDisposedMask_=1;ar.isScheduledMask_=2;ar.isTrackPendingMask_=4;ar.isRunningMask_=8;ar.diffValueMask_=16;var $c=100,ou=function(e){return e()};function Op(){X.inBatch>0||X.isRunningReactions||ou(rT)}function rT(){X.isRunningReactions=!0;for(var e=X.pendingReactions,t=0;e.length>0;){++t===$c&&(console.error("Reaction doesn't converge to a stable state after "+$c+" iterations."+(" Probably there is a cycle in the reactive function: "+e[0])),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}X.isRunningReactions=!1}var fa=Hr("Reaction",ar);function nT(e){var t=ou;ou=function(r){return e(function(){return t(r)})}}function ot(){return!!X.spyListeners.length}function Ln(e){if(X.spyListeners.length)for(var t=X.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function vt(e){var t=vr({},e,{spyReportStart:!0});Ln(t)}var iT={type:"report-end",spyReportEnd:!0};function wt(e){Ln(e?vr({},e,{type:"report-end",spyReportEnd:!0}):iT)}function oT(e){return X.spyListeners.push(e),cl(function(){X.spyListeners=X.spyListeners.filter(function(t){return t!==e})})}var hl="action",aT="action.bound",xp="autoAction",sT="autoAction.bound",Ap="<unnamed action>",au=po(hl),uT=po(aT,{bound:!0}),su=po(xp,{autoAction:!0}),lT=po(sT,{autoAction:!0,bound:!0});function Sp(e){var t=function(r,n){if(Fe(r))return sn(r.name||Ap,r,e);if(Fe(n))return sn(r,n,e);if(fo(n))return(e?su:au).decorate_20223_(r,n);if(an(n))return co(r,n,e?su:au);if(an(r))return ir(po(e?xp:hl,{name:r,autoAction:e}));de("Invalid arguments for `action`")};return t}var Ct=Sp(!1);Object.assign(Ct,au);var Vi=Sp(!0);Object.assign(Vi,su);Ct.bound=ir(uT);Vi.bound=ir(lT);function Fi(e){return hp(e.name||Ap,!1,e,this,void 0)}function un(e){return Fe(e)&&e.isMobxAction===!0}function Mt(e,t){var r,n,i,o;t===void 0&&(t=ll),Fe(e)||de("Autorun expects a function as first argument"),un(e)&&de("Autorun does not accept actions since actions are untrackable");var a=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+Vt(),s=!t.scheduler&&!t.delay,u;if(s)u=new ar(a,function(){this.track(d)},t.onError,t.requiresObservable);else{var l=Ip(t),f=!1;u=new ar(a,function(){f||(f=!0,l(function(){f=!1,u.isDisposed||u.track(d)}))},t.onError,t.requiresObservable)}function d(){e(u)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||u.schedule_(),u.getDisposer_((o=t)==null?void 0:o.signal)}var cT=function(e){return e()};function Ip(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:cT}function fT(e,t,r){var n,i,o;r===void 0&&(r=ll),(!Fe(e)||!Fe(t))&&de("First and second argument to reaction should be functions"),Yt(r)||de("Third argument of reactions should be an object");var a=(n=r.name)!=null?n:"Reaction@"+Vt(),s=Ct(a,r.onError?dT(r.onError,t):t),u=!r.scheduler&&!r.delay,l=Ip(r),f=!0,d=!1,$,E=r.compareStructural?Je.structural:r.equals||Je.default,T=new ar(a,function(){f||u?B():d||(d=!0,l(B))},r.onError,r.requiresObservable);function B(){if(d=!1,!T.isDisposed){var W=!1,M=$;T.track(function(){var k=F_(!1,function(){return e(T)});W=f||!E($,k),$=k}),(f&&r.fireImmediately||!f&&W)&&s($,M,T),f=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||T.schedule_(),T.getDisposer_((o=r)==null?void 0:o.signal)}function dT(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var pT="onBO",hT="onBUO";function ts(e,t,r){return $p(pT,e,t,r)}function ui(e,t,r){return $p(hT,e,t,r)}function $p(e,t,r,n){var i=typeof n=="function"?Xt(t,r):Xt(t),o=Fe(n)?n:r,a=e+"L";return i[a]?i[a].add(o):i[a]=new Set([o]),function(){var s=i[a];s&&(s.delete(o),s.size===0&&delete i[a])}}var yT="never",xo="always",gT="observed";function mT(e){e.isolateGlobalState===!0&&J_();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(X.useProxies=t===xo?!0:t===yT?!1:typeof Proxy<"u"),t==="ifavailable"&&(X.verifyProxies=!0),r!==void 0){var n=r===xo?xo:r===gT;X.enforceActions=n,X.allowStateChanges=!(n===!0||n===xo)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(X[i]=!!e[i])}),X.allowStateReads=!X.observableRequiresReaction,X.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&nT(e.reactionScheduler)}function bT(e,t,r,n){arguments.length>4&&de("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&de("'extendObservable' expects an object as first argument"),cr(e)&&de("'extendObservable' should not be used on maps, use map.merge instead"),Yt(t)||de("'extendObservable' only accepts plain objects as second argument"),(Vn(t)||Vn(r))&&de("Extending an object with another observable (object) is not supported");var i=G1(t);return Sn(function(){var o=fi(e,n)[we];Ja(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function rs(e,t){return kp(Xt(e,t))}function kp(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=vT(e.observing_).map(kp)),t}function da(e,t){return jp(Xt(e,t))}function jp(e){var t={name:e.name_};return Y_(e)&&(t.observers=Array.from(X_(e)).map(jp)),t}function vT(e){return Array.from(new Set(e))}var wT=0;function Np(){this.message="FLOW_CANCELLED"}Np.prototype=Object.create(Error.prototype);var Ss=sp("flow"),_T=sp("flow.bound",{bound:!0}),Bn=Object.assign(function(e,t){if(fo(t))return Ss.decorate_20223_(e,t);if(an(t))return co(e,t,Ss);arguments.length!==1&&de("Flow expects single argument with generator function");var r=e,n=r.name||"<unnamed flow>",i=function(){var o=this,a=arguments,s=++wT,u=Ct(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,d=new Promise(function($,E){var T=0;l=E;function B(k){f=void 0;var F;try{F=Ct(n+" - runid: "+s+" - yield "+T++,u.next).call(u,k)}catch(K){return E(K)}M(F)}function W(k){f=void 0;var F;try{F=Ct(n+" - runid: "+s+" - yield "+T++,u.throw).call(u,k)}catch(K){return E(K)}M(F)}function M(k){if(Fe(k?.then)){k.then(M,E);return}return k.done?$(k.value):(f=Promise.resolve(k.value),f.then(B,W))}B(void 0)});return d.cancel=Ct(n+" - runid: "+s+" - cancel",function(){try{f&&kc(f);var $=u.return(void 0),E=Promise.resolve($.value);E.then(Rn,Rn),kc(E),l(new Np)}catch(T){l(T)}}),d};return i.isMobXFlow=!0,i},Ss);Bn.bound=ir(_T);function kc(e){Fe(e.cancel)&&e.cancel()}function zi(e){return e?.isMobXFlow===!0}function TT(e,t){return e?t!==void 0?cr(e)||ci(e)?de("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):ln(e)?e[we].values_.has(t):!1:ln(e)||!!e[we]||fl(e)||fa(e)||ho(e):!1}function Vn(e){return arguments.length!==1&&de("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),TT(e)}function ET(e){if(ln(e))return e[we].ownKeys_();de(38)}function Ao(e,t,r){return e.set(t,r),r}function Un(e,t){if(e==null||typeof e!="object"||e instanceof Date||!Vn(e))return e;if(q_(e)||ho(e))return Un(e.get(),t);if(t.has(e))return t.get(e);if(ci(e)){var r=Ao(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=Un(a,t)}),r}if(Gt(e)){var n=Ao(t,e,new Set);return e.forEach(function(a){n.add(Un(a,t))}),n}if(cr(e)){var i=Ao(t,e,new Map);return e.forEach(function(a,s){i.set(s,Un(a,t))}),i}else{var o=Ao(t,e,{});return ET(e).forEach(function(a){lo.propertyIsEnumerable.call(e,a)&&(o[a]=Un(e[a],t))}),o}}function br(e,t){return t&&de("toJS no longer supports options"),Un(e,new Map)}function Cp(){for(var e=!1,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];typeof r[r.length-1]=="boolean"&&(e=r.pop());var i=OT(r);if(!i)return de("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");i.isTracing_===Pt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?Pt.BREAK:Pt.LOG}function OT(e){switch(e.length){case 0:return X.trackingDerivation;case 1:return Xt(e[0]);case 2:return Xt(e[0],e[1])}}function gr(e,t){t===void 0&&(t=void 0),jt();try{return e.apply(t)}finally{Nt()}}function Zr(e){return e[we]}var xT={has:function(e,t){return X.trackingDerivation&&Ei("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Zr(e).has_(t)},get:function(e,t){return Zr(e).get_(t)},set:function(e,t,r){var n;return an(t)?(Zr(e).values_.has(t)||Ei("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(n=Zr(e).set_(t,r,!0))!=null?n:!0):!1},deleteProperty:function(e,t){var r;return Ei("delete properties from an observable object. Use 'remove' from 'mobx' instead."),an(t)?(r=Zr(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return Ei("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(n=Zr(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return X.trackingDerivation&&Ei("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Zr(e).ownKeys_()},preventExtensions:function(e){de(13)}};function AT(e,t){var r,n;return Zd(),e=fi(e,t),(n=(r=e[we]).proxy_)!=null?n:r.proxy_=new Proxy(e,xT)}function $t(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function yo(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),cl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function kt(e,t){var r=An();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&de(14),!!t);i++);return t}finally{mr(r)}}function Jt(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function go(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),cl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Qt(e,t){var r=An(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);mr(r)}}function li(e,t,r){return Sn(function(){var n,i=fi(e,r)[we];t&&e[gt]&&de("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=Y1(e)),Ja(t).forEach(function(o){return i.make_(o,t[o])})}),e}var jc="splice",Wt="update",ST=1e4,IT={get:function(e,t){var r=e[we];return t===we?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Ut(pa,t)?pa[t]:e[t]},set:function(e,t,r){var n=e[we];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){de(15)}},yl=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+Vt()),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=o,this.atom_=new Wr(r),this.enhancer_=function(a,s){return n(a,s,r+"[..]")}}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 yo(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}),go(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&de("Out of range: "+r);var n=this.values_.length;if(r!==n)if(r>n){for(var i=new Array(r-n),o=0;o<r-n;o++)i[o]=void 0;this.spliceWithArray_(n,0,i)}else this.spliceWithArray_(r,n-r)},t.updateArrayLength_=function(r,n){r!==this.lastKnownLength_&&de(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&Lp(r+n+1)},t.spliceWithArray_=function(r,n,i){var o=this;rr(this.atom_);var a=this.values_.length;if(r===void 0?r=0:r>a?r=a:r<0&&(r=Math.max(0,a+r)),arguments.length===1?n=a-r:n==null?n=0:n=Math.max(0,Math.min(n,a-r)),i===void 0&&(i=sa),$t(this)){var s=kt(this,{object:this.proxy_,type:jc,index:r,removedCount:n,added:i});if(!s)return sa;n=s.removedCount,i=s.added}i=i.length===0?i:i.map(function(f){return o.enhancer_(f,void 0)}),this.legacyMode_;var u=i.length-n;this.updateArrayLength_(a,u);var l=this.spliceItemsIntoValues_(r,n,i);return(n!==0||i.length!==0)&&this.notifyArraySplice_(r,i,l),this.dehanceValues_(l)},t.spliceItemsIntoValues_=function(r,n,i){if(i.length<ST){var o;return(o=this.values_).splice.apply(o,[r,n].concat(i))}else{var a=this.values_.slice(r,r+n),s=this.values_.slice(r+n);this.values_.length+=i.length-n;for(var u=0;u<i.length;u++)this.values_[r+u]=i[u];for(var l=0;l<s.length;l++)this.values_[r+i.length+l]=s[l];return a}},t.notifyArrayChildUpdate_=function(r,n,i){var o=!this.owned_&&ot(),a=Jt(this),s=a||o?{observableKind:"array",object:this.proxy_,type:Wt,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;o&&vt(s),this.atom_.reportChanged(),a&&Qt(this,s),o&&wt()},t.notifyArraySplice_=function(r,n,i){var o=!this.owned_&&ot(),a=Jt(this),s=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:jc,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;o&&vt(s),this.atom_.reportChanged(),a&&Qt(this,s),o&&wt()},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx.array] Attempt to read an array index ("+r+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX");return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,n){var i=this.values_;if(this.legacyMode_&&r>i.length&&de(17,r,i.length),r<i.length){rr(this.atom_);var o=i[r];if($t(this)){var a=kt(this,{type:Wt,object:this.proxy_,index:r,newValue:n});if(!a)return;n=a.newValue}n=this.enhancer_(n,o);var s=n!==o;s&&(i[r]=n,this.notifyArrayChildUpdate_(r,n,o))}else{for(var u=new Array(r+1-i.length),l=0;l<u.length-1;l++)u[l]=void 0;u[u.length-1]=n,this.spliceWithArray_(i.length,0,u)}},e}();function $T(e,t,r,n){return r===void 0&&(r="ObservableArray@"+Vt()),n===void 0&&(n=!1),Zd(),Sn(function(){var i=new yl(r,t,n,!1);tp(i.values_,we,i);var o=new Proxy(i.values_,IT);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var pa={clear:function(){return this.splice(0)},replace:function(e){var t=this[we];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 o=this[we];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(e);case 2:return o.spliceWithArray_(e,t)}return o.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,r){return this[we].spliceWithArray_(e,t,r)},push:function(){for(var e=this[we],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[we].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[we],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 X.trackingDerivation&&de(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){X.trackingDerivation&&de(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[we],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Re("at",Tt);Re("concat",Tt);Re("flat",Tt);Re("includes",Tt);Re("indexOf",Tt);Re("join",Tt);Re("lastIndexOf",Tt);Re("slice",Tt);Re("toString",Tt);Re("toLocaleString",Tt);Re("toSorted",Tt);Re("toSpliced",Tt);Re("with",Tt);Re("every",er);Re("filter",er);Re("find",er);Re("findIndex",er);Re("findLast",er);Re("findLastIndex",er);Re("flatMap",er);Re("forEach",er);Re("map",er);Re("some",er);Re("toReversed",er);Re("reduce",Up);Re("reduceRight",Up);function Re(e,t){typeof Array.prototype[e]=="function"&&(pa[e]=t(e))}function Tt(e){return function(){var t=this[we];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function er(e){return function(t,r){var n=this,i=this[we];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(a,s){return t.call(r,a,s,n)})}}function Up(e){return function(){var t=this,r=this[we];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(o,a,s){return i(o,a,s,t)},n[e].apply(n,arguments)}}var kT=Hr("ObservableArrayAdministration",yl);function ci(e){return Ha(e)&&kT(e[we])}var jT={},Dr="add",ha="delete",Pp=function(){function e(r,n,i){var o=this;n===void 0&&(n=si),i===void 0&&(i="ObservableMap@"+Vt()),this.enhancer_=void 0,this.name_=void 0,this[we]=jT,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,Fe(Map)||de(18),Sn(function(){o.keysAtom_=op(o.name_+".keys()"),o.data_=new Map,o.hasMap_=new Map,r&&o.merge(r)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var n=this;if(!X.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new Br(this.has_(r),Ya,this.name_+"."+Zs(r)+"?",!1);this.hasMap_.set(r,o),ui(o,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if($t(this)){var o=kt(this,{type:i?Wt:Dr,object:this,newValue:n,name:r});if(!o)return this;n=o.newValue}return i?this.updateValue_(r,n):this.addValue_(r,n),this},t.delete=function(r){var n=this;if(rr(this.keysAtom_),$t(this)){var i=kt(this,{type:ha,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=ot(),a=Jt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:ha,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&vt(s),gr(function(){var u;n.keysAtom_.reportChanged(),(u=n.hasMap_.get(r))==null||u.setNewValue_(!1);var l=n.data_.get(r);l.setNewValue_(void 0),n.data_.delete(r)}),a&&Qt(this,s),o&&wt(),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==X.UNCHANGED){var o=ot(),a=Jt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Wt,object:this,oldValue:i.value_,name:r,newValue:n}:null;o&&vt(s),i.setNewValue_(n),a&&Qt(this,s),o&&wt()}},t.addValue_=function(r,n){var i=this;rr(this.keysAtom_),gr(function(){var u,l=new Br(n,i.enhancer_,i.name_+"."+Zs(r),!1);i.data_.set(r,l),n=l.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=ot(),a=Jt(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Dr,object:this,name:r,newValue:n}:null;o&&vt(s),a&&Qt(this,s),o&&wt()},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 Nc({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:r.get(a)}}})},t.entries=function(){var r=this,n=this.keys();return Nc({next:function(){var i=n.next(),o=i.done,a=i.value;return{done:o,value:o?void 0:[a,r.get(a)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,n){for(var i=Mn(this),o;!(o=i()).done;){var a=o.value,s=a[0],u=a[1];r.call(n,u,s,this)}},t.merge=function(r){var n=this;return cr(r)&&(r=new Map(r)),gr(function(){Yt(r)?K1(r).forEach(function(i){return n.set(i,r[i])}):Array.isArray(r)?r.forEach(function(i){var o=i[0],a=i[1];return n.set(o,a)}):oi(r)?(q1(r)||de(19,r),r.forEach(function(i,o){return n.set(o,i)})):r!=null&&de(20,r)}),this},t.clear=function(){var r=this;gr(function(){Le(function(){for(var n=Mn(r.keys()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var n=this;return gr(function(){for(var i=NT(r),o=new Map,a=!1,s=Mn(n.data_.keys()),u;!(u=s()).done;){var l=u.value;if(!i.has(l)){var f=n.delete(l);if(f)a=!0;else{var d=n.data_.get(l);o.set(l,d)}}}for(var $=Mn(i.entries()),E;!(E=$()).done;){var T=E.value,B=T[0],W=T[1],M=n.data_.has(B);if(n.set(B,W),n.data_.has(B)){var k=n.data_.get(B);o.set(B,k),M||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var F=n.data_.keys(),K=o.keys(),D=F.next(),Q=K.next();!D.done;){if(D.value!==Q.value){n.keysAtom_.reportChanged();break}D=F.next(),Q=K.next()}n.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,n){return n===!0&&de("`observe` doesn't support fireImmediately=true in combination with maps."),go(this,r)},t.intercept_=function(r){return yo(this,r)},ai(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),cr=Hr("ObservableMap",Pp);function Nc(e){return e[Symbol.toStringTag]="MapIterator",vl(e)}function NT(e){if(oi(e)||cr(e))return e;if(Array.isArray(e))return new Map(e);if(Yt(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return de(21,e)}var CT={},Rp=function(){function e(r,n,i){var o=this;n===void 0&&(n=si),i===void 0&&(i="ObservableSet@"+Vt()),this.name_=void 0,this[we]=CT,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,Fe(Set)||de(22),this.enhancer_=function(a,s){return n(a,s,i)},Sn(function(){o.atom_=op(o.name_),r&&o.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;gr(function(){Le(function(){for(var n=Mn(r.data_.values()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,n){for(var i=Mn(this),o;!(o=i()).done;){var a=o.value;r.call(n,a,a,this)}},t.add=function(r){var n=this;if(rr(this.atom_),$t(this)){var i=kt(this,{type:Dr,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){gr(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var o=ot(),a=Jt(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:Dr,object:this,newValue:r}:null;o&&vt(s),a&&Qt(this,s),o&&wt()}return this},t.delete=function(r){var n=this;if($t(this)){var i=kt(this,{type:ha,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=ot(),a=Jt(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:ha,object:this,oldValue:r}:null;return o&&vt(s),gr(function(){n.atom_.reportChanged(),n.data_.delete(r)}),a&&Qt(this,s),o&&wt(),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return Cc({next:function(){var n=r.next(),i=n.value,o=n.done;return o?{value:void 0,done:o}:{value:[i,i],done:o}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,n=this.data_.values();return Cc({next:function(){var i=n.next(),o=i.value,a=i.done;return a?{value:void 0,done:a}:{value:r.dehanceValue_(o),done:a}}})},t.intersection=function(r){if(yr(r)&&!Gt(r))return r.intersection(this);var n=new Set(this);return n.intersection(r)},t.union=function(r){if(yr(r)&&!Gt(r))return r.union(this);var n=new Set(this);return n.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(yr(r)&&!Gt(r))return r.symmetricDifference(this);var n=new Set(this);return n.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(yr(r)&&!Gt(r))return r.isDisjointFrom(this);var n=new Set(this);return n.isDisjointFrom(r)},t.replace=function(r){var n=this;return Gt(r)&&(r=new Set(r)),gr(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):yr(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&de("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return n===!0&&de("`observe` doesn't support fireImmediately=true in combination with sets."),go(this,r)},t.intercept_=function(r){return yo(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},ai(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Gt=Hr("ObservableSet",Rp);function Cc(e){return e[Symbol.toStringTag]="SetIterator",vl(e)}var Uc=Object.create(null),Pc="remove",uu=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=T_),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_=o,this.keysAtom_=new Wr(this.name_+".keys"),this.isPlainObject_=Yt(this.target_),Bp(this.defaultAnnotation_)||de("defaultAnnotation must be valid annotation"),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,n){var i=this.values_.get(r);if(i instanceof Rt)return i.set(n),!0;if($t(this)){var o=kt(this,{type:Wt,object:this.proxy_||this.target_,name:r,newValue:n});if(!o)return null;n=o.newValue}if(n=i.prepareNewValue_(n),n!==X.UNCHANGED){var a=Jt(this),s=ot(),u=a||s?{type:Wt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;s&&vt(u),i.setNewValue_(n),a&&Qt(this,u),s&&wt()}return!0},t.get_=function(r){return X.trackingDerivation&&!Ut(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Ut(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(!X.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var n=this.pendingKeys_.get(r);return n||(n=new Br(r in this.target_,Ya,this.name_+"."+Zs(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(Dc(this,n,r),!(r in this.target_)){var i;if((i=this.target_[gt])!=null&&i[r])return;de(1,n.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==lo;){var a=aa(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}Mc(this,n,r)}},t.extend_=function(r,n,i,o){if(o===void 0&&(o=!1),i===!0&&(i=this.defaultAnnotation_),i===!1)return this.defineProperty_(r,n,o);Dc(this,i,r);var a=i.extend_(this,r,n,o);return a&&Mc(this,i,r),a},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),rr(this.keysAtom_);try{jt();var o=this.delete_(r);if(!o)return o;if($t(this)){var a=kt(this,{object:this.proxy_||this.target_,name:r,type:Dr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=vr({},n,{value:s}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else nr(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{Nt()}return!0},t.defineObservableProperty_=function(r,n,i,o){o===void 0&&(o=!1),rr(this.keysAtom_);try{jt();var a=this.delete_(r);if(!a)return a;if($t(this)){var s=kt(this,{object:this.proxy_||this.target_,name:r,type:Dr,newValue:n});if(!s)return null;n=s.newValue}var u=Rc(r),l={configurable:X.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,l))return!1}else nr(this.target_,r,l);var f=new Br(n,i,this.name_+"."+r.toString(),!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Nt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),rr(this.keysAtom_);try{jt();var o=this.delete_(r);if(!o)return o;if($t(this)){var a=kt(this,{object:this.proxy_||this.target_,name:r,type:Dr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=Rc(r),u={configurable:X.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:s.get,set:s.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else nr(this.target_,r,u);this.values_.set(r,new Rt(n)),this.notifyPropertyAddition_(r,void 0)}finally{Nt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),rr(this.keysAtom_),!Ut(this.target_,r))return!0;if($t(this)){var i=kt(this,{object:this.proxy_||this.target_,name:r,type:Pc});if(!i)return null}try{var o;jt();var a=Jt(this),s=ot(),u=this.values_.get(r),l=void 0;if(!u&&(a||s)){var f;l=(f=aa(this.target_,r))==null?void 0:f.value}if(n){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(delete this.appliedAnnotations_[r],u&&(this.values_.delete(r),u instanceof Br&&(l=u.value_),_p(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),a||s){var d={type:Pc,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:r};s&&vt(d),a&&Qt(this,d),s&&wt()}}finally{Nt()}return!0},t.observe_=function(r,n){return n===!0&&de("`observe` doesn't support the fire immediately property for observable objects."),go(this,r)},t.intercept_=function(r){return yo(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o=Jt(this),a=ot();if(o||a){var s=o||a?{type:Dr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;a&&vt(s),o&&Qt(this,s),a&&wt()}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Ja(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function fi(e,t){var r;if(t&&ln(e)&&de("Options can't be provided for already observable objects."),Ut(e,we))return ml(e)instanceof uu||de("Cannot convert '"+ya(e)+`' into observable object:
|
|
26
|
+
The target is already observable of different type.
|
|
27
|
+
Extending builtins is not supported.`),e;Object.isExtensible(e)||de("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(Yt(e)?"ObservableObject":e.constructor.name)+"@"+Vt(),i=new uu(e,new Map,String(n),C_(t));return Wa(e,we,i),e}var UT=Hr("ObservableObjectAdministration",uu);function Rc(e){return Uc[e]||(Uc[e]={get:function(){return this[we].getObservablePropValue_(e)},set:function(t){return this[we].setObservablePropValue_(e,t)}})}function ln(e){return Ha(e)?UT(e[we]):!1}function Mc(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[gt])==null||delete n[r]}function Dc(e,t,r){if(Bp(t)||de("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!ua(t)&&Ut(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;de("Cannot apply '"+o+"' to '"+n+"':"+(`
|
|
28
|
+
The field is already annotated with '`+i+"'.")+`
|
|
29
|
+
Re-annotating fields is not allowed.
|
|
30
|
+
Use 'override' annotation for methods overridden by subclass.`)}}var PT=Dp(0),RT=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Is=0,Mp=function(){};function MT(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}MT(Mp,Array.prototype);var gl=function(e){function t(n,i,o,a){var s;return o===void 0&&(o="ObservableArray@"+Vt()),a===void 0&&(a=!1),s=e.call(this)||this,Sn(function(){var u=new yl(o,i,a,!0);u.proxy_=s,tp(s,we,u),n&&n.length&&s.spliceWithArray(0,0,n),RT&&Object.defineProperty(s,"0",PT)}),s}ip(t,e);var r=t.prototype;return r.concat=function(){this[we].atom_.reportObserved();for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),i.map(function(a){return ci(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return vl({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},ai(t,[{key:"length",get:function(){return this[we].getArrayLength_()},set:function(n){this[we].setArrayLength_(n)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Mp);Object.entries(pa).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&Wa(gl.prototype,t,r)});function Dp(e){return{enumerable:!1,configurable:!0,get:function(){return this[we].get_(e)},set:function(t){this[we].set_(e,t)}}}function DT(e){nr(gl.prototype,""+e,Dp(e))}function Lp(e){if(e>Is){for(var t=Is;t<e+100;t++)DT(t);Is=e}}Lp(1e3);function LT(e,t,r){return new gl(e,t,r)}function Xt(e,t){if(typeof e=="object"&&e!==null){if(ci(e))return t!==void 0&&de(23),e[we].atom_;if(Gt(e))return e.atom_;if(cr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||de(25,t,ya(e)),r}if(ln(e)){if(!t)return de(26);var n=e[we].values_.get(t);return n||de(27,t,ya(e)),n}if(fl(e)||ho(e)||fa(e))return e}else if(Fe(e)&&fa(e[we]))return e[we];de(28)}function ml(e,t){if(e||de(29),t!==void 0)return ml(Xt(e,t));if(fl(e)||ho(e)||fa(e)||cr(e)||Gt(e))return e;if(e[we])return e[we];de(24,e)}function ya(e,t){var r;if(t!==void 0)r=Xt(e,t);else{if(un(e))return e.name;ln(e)||cr(e)||Gt(e)?r=ml(e):r=Xt(e)}return r.name_}function Sn(e){var t=An(),r=Za(!0);jt();try{return e()}finally{Nt(),es(r),mr(t)}}var Lc=lo.toString;function bl(e,t,r){return r===void 0&&(r=-1),lu(e,t,r)}function lu(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 o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var a=Lc.call(e);if(a!==Lc.call(t))return!1;switch(a){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=Bc(e),t=Bc(t);var s=a==="[object Array]";if(!s){if(typeof e!="object"||typeof t!="object")return!1;var u=e.constructor,l=t.constructor;if(u!==l&&!(Fe(u)&&u instanceof u&&Fe(l)&&l instanceof l)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var f=n.length;f--;)if(n[f]===e)return i[f]===t;if(n.push(e),i.push(t),s){if(f=e.length,f!==t.length)return!1;for(;f--;)if(!lu(e[f],t[f],r-1,n,i))return!1}else{var d=Object.keys(e),$=d.length;if(Object.keys(t).length!==$)return!1;for(var E=0;E<$;E++){var T=d[E];if(!(Ut(t,T)&&lu(e[T],t[T],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function Bc(e){return ci(e)?e.slice():oi(e)||cr(e)||yr(e)||Gt(e)?Array.from(e.entries()):e}var Vc,BT=((Vc=Ga().Iterator)==null?void 0:Vc.prototype)||{};function vl(e){return e[Symbol.iterator]=VT,Object.assign(Object.create(BT),e)}function VT(){return this}function Bp(e){return e instanceof Object&&typeof e.annotationType_=="string"&&Fe(e.make_)&&Fe(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=Ga();typeof t[e]>"u"&&de("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:oT,extras:{getDebugName:ya},$mobx:we});var FT=Ze({"../../../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(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},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",o=typeof window<"u"&&window.name==="nodejs"||typeof navigator<"u"&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),a=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u";e.isBrowser=r,e.isWebWorker=i,e.isNode=n,e.isJsDom=o,e.isDeno=a}}),zT=Ze({"../../../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,o=n.cmp&&function(s){return function(u){return function(l,f){var d={key:l,value:u[l]},$={key:f,value:u[f]};return s(d,$)}}}(n.cmp),a=[];return function s(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,$=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<$.length;l++){var E=$[l],T=s(u[E]);T&&(f&&(f+=","),f+=JSON.stringify(E)+":"+T)}return a.splice(d,1),"{"+f+"}"}}(r)}}}),qT=Ze({"../../../node_modules/.pnpm/safe-stable-stringify@2.5.0/node_modules/safe-stable-stringify/index.js"(e,t){"use strict";var{hasOwnProperty:r}=Object.prototype,n=M();n.configure=M,n.stringify=n,n.default=n,e.stringify=n,e.configure=M,t.exports=n;var i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function o(k){return k.length<5e3&&!i.test(k)?`"${k}"`:JSON.stringify(k)}function a(k,F){if(k.length>200||F)return k.sort(F);for(let K=1;K<k.length;K++){let D=k[K],Q=K;for(;Q!==0&&k[Q-1]>D;)k[Q]=k[Q-1],Q--;k[Q]=D}return k}var s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(k){return s.call(k)!==void 0&&k.length!==0}function l(k,F,K){k.length<K&&(K=k.length);let D=F===","?"":" ",Q=`"0":${D}${k[0]}`;for(let q=1;q<K;q++)Q+=`${F}"${q}":${D}${k[q]}`;return Q}function f(k){if(r.call(k,"circularValue")){let F=k.circularValue;if(typeof F=="string")return`"${F}"`;if(F==null)return F;if(F===Error||F===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 d(k){let F;if(r.call(k,"deterministic")&&(F=k.deterministic,typeof F!="boolean"&&typeof F!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return F===void 0?!0:F}function $(k,F){let K;if(r.call(k,F)&&(K=k[F],typeof K!="boolean"))throw new TypeError(`The "${F}" argument must be of type boolean`);return K===void 0?!0:K}function E(k,F){let K;if(r.call(k,F)){if(K=k[F],typeof K!="number")throw new TypeError(`The "${F}" argument must be of type number`);if(!Number.isInteger(K))throw new TypeError(`The "${F}" argument must be an integer`);if(K<1)throw new RangeError(`The "${F}" argument must be >= 1`)}return K===void 0?1/0:K}function T(k){return k===1?"1 item":`${k} items`}function B(k){let F=new Set;for(let K of k)(typeof K=="string"||typeof K=="number")&&F.add(String(K));return F}function W(k){if(r.call(k,"strict")){let F=k.strict;if(typeof F!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(F)return K=>{let D=`Object can not safely be stringified. Received type ${typeof K}`;throw typeof K!="function"&&(D+=` (${K.toString()})`),new Error(D)}}}function M(k){k={...k};let F=W(k);F&&(k.bigint===void 0&&(k.bigint=!1),"circularValue"in k||(k.circularValue=Error));let K=f(k),D=$(k,"bigint"),Q=d(k),q=typeof Q=="function"?Q:void 0,te=E(k,"maximumDepth"),j=E(k,"maximumBreadth");function L(ce,V,J,Z,ye,p){let w=V[ce];switch(typeof w=="object"&&w!==null&&typeof w.toJSON=="function"&&(w=w.toJSON(ce)),w=Z.call(V,ce,w),typeof w){case"string":return o(w);case"object":{if(w===null)return"null";if(J.indexOf(w)!==-1)return K;let A="",R=",",N=p;if(Array.isArray(w)){if(w.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(w),ye!==""&&(p+=ye,A+=`
|
|
31
|
+
${p}`,R=`,
|
|
32
|
+
${p}`);let O=Math.min(w.length,j),v=0;for(;v<O-1;v++){let P=L(String(v),w,J,Z,ye,p);A+=P!==void 0?P:"null",A+=R}let b=L(String(v),w,J,Z,ye,p);if(A+=b!==void 0?b:"null",w.length-1>j){let P=w.length-j-1;A+=`${R}"... ${T(P)} not stringified"`}return ye!==""&&(A+=`
|
|
33
|
+
${N}`),J.pop(),`[${A}]`}let U=Object.keys(w),g=U.length;if(g===0)return"{}";if(te<J.length+1)return'"[Object]"';let x="",_="";ye!==""&&(p+=ye,R=`,
|
|
34
|
+
${p}`,x=" ");let c=Math.min(g,j);Q&&!u(w)&&(U=a(U,q)),J.push(w);for(let O=0;O<c;O++){let v=U[O],b=L(v,w,J,Z,ye,p);b!==void 0&&(A+=`${_}${o(v)}:${x}${b}`,_=R)}if(g>j){let O=g-j;A+=`${_}"...":${x}"${T(O)} not stringified"`,_=R}return ye!==""&&_.length>1&&(A=`
|
|
35
|
+
${p}${A}
|
|
36
|
+
${N}`),J.pop(),`{${A}}`}case"number":return isFinite(w)?String(w):F?F(w):"null";case"boolean":return w===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(w);default:return F?F(w):void 0}}function z(ce,V,J,Z,ye,p){switch(typeof V=="object"&&V!==null&&typeof V.toJSON=="function"&&(V=V.toJSON(ce)),typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(J.indexOf(V)!==-1)return K;let w=p,A="",R=",";if(Array.isArray(V)){if(V.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(V),ye!==""&&(p+=ye,A+=`
|
|
37
|
+
${p}`,R=`,
|
|
38
|
+
${p}`);let g=Math.min(V.length,j),x=0;for(;x<g-1;x++){let c=z(String(x),V[x],J,Z,ye,p);A+=c!==void 0?c:"null",A+=R}let _=z(String(x),V[x],J,Z,ye,p);if(A+=_!==void 0?_:"null",V.length-1>j){let c=V.length-j-1;A+=`${R}"... ${T(c)} not stringified"`}return ye!==""&&(A+=`
|
|
39
|
+
${w}`),J.pop(),`[${A}]`}J.push(V);let N="";ye!==""&&(p+=ye,R=`,
|
|
40
|
+
${p}`,N=" ");let U="";for(let g of Z){let x=z(g,V[g],J,Z,ye,p);x!==void 0&&(A+=`${U}${o(g)}:${N}${x}`,U=R)}return ye!==""&&U.length>1&&(A=`
|
|
41
|
+
${p}${A}
|
|
42
|
+
${w}`),J.pop(),`{${A}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(V);default:return F?F(V):void 0}}function re(ce,V,J,Z,ye){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(ce),typeof V!="object")return re(ce,V,J,Z,ye);if(V===null)return"null"}if(J.indexOf(V)!==-1)return K;let p=ye;if(Array.isArray(V)){if(V.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(V),ye+=Z;let x=`
|
|
43
|
+
${ye}`,_=`,
|
|
44
|
+
${ye}`,c=Math.min(V.length,j),O=0;for(;O<c-1;O++){let b=re(String(O),V[O],J,Z,ye);x+=b!==void 0?b:"null",x+=_}let v=re(String(O),V[O],J,Z,ye);if(x+=v!==void 0?v:"null",V.length-1>j){let b=V.length-j-1;x+=`${_}"... ${T(b)} not stringified"`}return x+=`
|
|
45
|
+
${p}`,J.pop(),`[${x}]`}let w=Object.keys(V),A=w.length;if(A===0)return"{}";if(te<J.length+1)return'"[Object]"';ye+=Z;let R=`,
|
|
46
|
+
${ye}`,N="",U="",g=Math.min(A,j);u(V)&&(N+=l(V,R,j),w=w.slice(V.length),g-=V.length,U=R),Q&&(w=a(w,q)),J.push(V);for(let x=0;x<g;x++){let _=w[x],c=re(_,V[_],J,Z,ye);c!==void 0&&(N+=`${U}${o(_)}: ${c}`,U=R)}if(A>j){let x=A-j;N+=`${U}"...": "${T(x)} not stringified"`,U=R}return U!==""&&(N=`
|
|
47
|
+
${ye}${N}
|
|
48
|
+
${p}`),J.pop(),`{${N}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(V);default:return F?F(V):void 0}}function se(ce,V,J){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(ce),typeof V!="object")return se(ce,V,J);if(V===null)return"null"}if(J.indexOf(V)!==-1)return K;let Z="",ye=V.length!==void 0;if(ye&&Array.isArray(V)){if(V.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(V);let N=Math.min(V.length,j),U=0;for(;U<N-1;U++){let x=se(String(U),V[U],J);Z+=x!==void 0?x:"null",Z+=","}let g=se(String(U),V[U],J);if(Z+=g!==void 0?g:"null",V.length-1>j){let x=V.length-j-1;Z+=`,"... ${T(x)} not stringified"`}return J.pop(),`[${Z}]`}let p=Object.keys(V),w=p.length;if(w===0)return"{}";if(te<J.length+1)return'"[Object]"';let A="",R=Math.min(w,j);ye&&u(V)&&(Z+=l(V,",",j),p=p.slice(V.length),R-=V.length,A=","),Q&&(p=a(p,q)),J.push(V);for(let N=0;N<R;N++){let U=p[N],g=se(U,V[U],J);g!==void 0&&(Z+=`${A}${o(U)}:${g}`,A=",")}if(w>j){let N=w-j;Z+=`${A}"...":"${T(N)} not stringified"`}return J.pop(),`{${Z}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(V);default:return F?F(V):void 0}}function ee(ce,V,J){if(arguments.length>1){let Z="";if(typeof J=="number"?Z=" ".repeat(Math.min(J,10)):typeof J=="string"&&(Z=J.slice(0,10)),V!=null){if(typeof V=="function")return L("",{"":ce},[],V,Z,"");if(Array.isArray(V))return z("",ce,[],B(V),Z,"")}if(Z.length!==0)return re("",ce,[],Z,"")}return se("",ce,[])}return ee}}}),di=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/guard.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IsValueType=e.IsSymbol=e.IsFunction=e.IsString=e.IsBigInt=e.IsInteger=e.IsNumber=e.IsBoolean=e.IsNull=e.IsUndefined=e.IsArray=e.IsObject=e.IsPlainObject=e.HasPropertyKey=e.IsDate=e.IsUint8Array=e.IsPromise=e.IsTypedArray=e.IsIterator=e.IsAsyncIterator=void 0;function t(D){return l(D)&&Symbol.asyncIterator in D}e.IsAsyncIterator=t;function r(D){return l(D)&&Symbol.iterator in D}e.IsIterator=r;function n(D){return ArrayBuffer.isView(D)}e.IsTypedArray=n;function i(D){return D instanceof Promise}e.IsPromise=i;function o(D){return D instanceof Uint8Array}e.IsUint8Array=o;function a(D){return D instanceof Date&&Number.isFinite(D.getTime())}e.IsDate=a;function s(D,Q){return Q in D}e.HasPropertyKey=s;function u(D){return l(D)&&k(D.constructor)&&D.constructor.name==="Object"}e.IsPlainObject=u;function l(D){return D!==null&&typeof D=="object"}e.IsObject=l;function f(D){return Array.isArray(D)&&!ArrayBuffer.isView(D)}e.IsArray=f;function d(D){return D===void 0}e.IsUndefined=d;function $(D){return D===null}e.IsNull=$;function E(D){return typeof D=="boolean"}e.IsBoolean=E;function T(D){return typeof D=="number"}e.IsNumber=T;function B(D){return T(D)&&Number.isInteger(D)}e.IsInteger=B;function W(D){return typeof D=="bigint"}e.IsBigInt=W;function M(D){return typeof D=="string"}e.IsString=M;function k(D){return typeof D=="function"}e.IsFunction=k;function F(D){return typeof D=="symbol"}e.IsSymbol=F;function K(D){return W(D)||E(D)||$(D)||T(D)||M(D)||F(D)||d(D)}e.IsValueType=K}}),Vp=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/system.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultErrorFunction=e.TypeSystemPolicy=e.TypeSystemErrorFunction=e.TypeSystem=e.TypeSystemDuplicateFormat=e.TypeSystemDuplicateTypeKind=void 0;var t=di(),r=is(),n=Gr(),i=class extends n.TypeBoxError{constructor(f){super(`Duplicate type kind '${f}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends n.TypeBoxError{constructor(f){super(`Duplicate string format '${f}' detected`)}};e.TypeSystemDuplicateFormat=o;var a;(function(f){function d(E,T){if(n.TypeRegistry.Has(E))throw new i(E);return n.TypeRegistry.Set(E,T),(B={})=>n.Type.Unsafe({...B,[n.Kind]:E})}f.Type=d;function $(E,T){if(n.FormatRegistry.Has(E))throw new o(E);return n.FormatRegistry.Set(E,T),E}f.Format=$})(a||(e.TypeSystem=a={}));var s;(function(f){let d=l;function $(){d=l}f.Reset=$;function E(B){d=B}f.Set=E;function T(){return d}f.Get=T})(s||(e.TypeSystemErrorFunction=s={}));var u;(function(f){f.ExactOptionalPropertyTypes=!1,f.AllowArrayObject=!1,f.AllowNaN=!1,f.AllowNullVoid=!1;function d(W,M){return f.ExactOptionalPropertyTypes?M in W:W[M]!==void 0}f.IsExactOptionalProperty=d;function $(W){let M=(0,t.IsObject)(W);return f.AllowArrayObject?M:M&&!(0,t.IsArray)(W)}f.IsObjectLike=$;function E(W){return $(W)&&!(W instanceof Date)&&!(W instanceof Uint8Array)}f.IsRecordLike=E;function T(W){let M=(0,t.IsNumber)(W);return f.AllowNaN?M:M&&Number.isFinite(W)}f.IsNumberLike=T;function B(W){let M=(0,t.IsUndefined)(W);return f.AllowNullVoid?M||W===null:M}f.IsVoidLike=B})(u||(e.TypeSystemPolicy=u={}));function l(f,d){switch(d){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 ${f.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${f.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${f.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${f.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 ${f.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${f.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${f.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${f.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 ${f.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${f.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${f.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${f.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${f.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 ${f.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${f.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${f.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${f.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 f.const=="string"?`'${f.const}'`:f.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 ${f.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${f.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${f.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${f.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 ${f.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${f.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${f.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${f.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${f.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${f.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${f.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${f.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${f.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${f.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 '${f[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=l}}),ns=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/deref.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Deref=e.TypeDereferenceError=void 0;var t=Gr(),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,o){let a=o.findIndex(s=>s.$id===i.$ref);if(a===-1)throw new r(i);return o[a]}e.Deref=n}}),wl=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/hash.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.ByteMarker=e.ValueHashError=void 0;var t=di(),r=class extends Error{constructor(L){super("Unable to hash value"),this.value=L}};e.ValueHashError=r;var n;(function(L){L[L.Undefined=0]="Undefined",L[L.Null=1]="Null",L[L.Boolean=2]="Boolean",L[L.Number=3]="Number",L[L.String=4]="String",L[L.Object=5]="Object",L[L.Array=6]="Array",L[L.Date=7]="Date",L[L.Uint8Array=8]="Uint8Array",L[L.Symbol=9]="Symbol",L[L.BigInt=10]="BigInt"})(n||(e.ByteMarker=n={}));var i=BigInt("14695981039346656037"),[o,a]=[BigInt("1099511628211"),BigInt("2")**BigInt("64")],s=Array.from({length:256}).map((L,z)=>BigInt(z)),u=new Float64Array(1),l=new DataView(u.buffer),f=new Uint8Array(u.buffer);function*d(L){let z=L===0?1:Math.ceil(Math.floor(Math.log2(L)+1)/8);for(let re=0;re<z;re++)yield L>>8*(z-1-re)&255}function $(L){te(n.Array);for(let z of L)q(z)}function E(L){te(n.Boolean),te(L?1:0)}function T(L){te(n.BigInt),l.setBigInt64(0,L);for(let z of f)te(z)}function B(L){te(n.Date),q(L.getTime())}function W(L){te(n.Null)}function M(L){te(n.Number),l.setFloat64(0,L);for(let z of f)te(z)}function k(L){te(n.Object);for(let z of globalThis.Object.keys(L).sort())q(z),q(L[z])}function F(L){te(n.String);for(let z=0;z<L.length;z++)for(let re of d(L.charCodeAt(z)))te(re)}function K(L){te(n.Symbol),q(L.description)}function D(L){te(n.Uint8Array);for(let z=0;z<L.length;z++)te(L[z])}function Q(L){return te(n.Undefined)}function q(L){if((0,t.IsArray)(L))return $(L);if((0,t.IsBoolean)(L))return E(L);if((0,t.IsBigInt)(L))return T(L);if((0,t.IsDate)(L))return B(L);if((0,t.IsNull)(L))return W(L);if((0,t.IsNumber)(L))return M(L);if((0,t.IsPlainObject)(L))return k(L);if((0,t.IsString)(L))return F(L);if((0,t.IsSymbol)(L))return K(L);if((0,t.IsUint8Array)(L))return D(L);if((0,t.IsUndefined)(L))return Q(L);throw new r(L)}function te(L){i=i^s[L],i=i*o%a}function j(L){return i=BigInt("14695981039346656037"),q(L),i}e.Hash=j}}),is=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/errors.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Errors=e.ValueErrorIterator=e.EscapeKey=e.ValueErrorsUnknownTypeError=e.ValueErrorType=void 0;var t=di(),r=Vp(),n=ns(),i=wl(),o=Gr(),a;(function(c){c[c.ArrayContains=0]="ArrayContains",c[c.ArrayMaxContains=1]="ArrayMaxContains",c[c.ArrayMaxItems=2]="ArrayMaxItems",c[c.ArrayMinContains=3]="ArrayMinContains",c[c.ArrayMinItems=4]="ArrayMinItems",c[c.ArrayUniqueItems=5]="ArrayUniqueItems",c[c.Array=6]="Array",c[c.AsyncIterator=7]="AsyncIterator",c[c.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",c[c.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",c[c.BigIntMaximum=10]="BigIntMaximum",c[c.BigIntMinimum=11]="BigIntMinimum",c[c.BigIntMultipleOf=12]="BigIntMultipleOf",c[c.BigInt=13]="BigInt",c[c.Boolean=14]="Boolean",c[c.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",c[c.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",c[c.DateMaximumTimestamp=17]="DateMaximumTimestamp",c[c.DateMinimumTimestamp=18]="DateMinimumTimestamp",c[c.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",c[c.Date=20]="Date",c[c.Function=21]="Function",c[c.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",c[c.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",c[c.IntegerMaximum=24]="IntegerMaximum",c[c.IntegerMinimum=25]="IntegerMinimum",c[c.IntegerMultipleOf=26]="IntegerMultipleOf",c[c.Integer=27]="Integer",c[c.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",c[c.Intersect=29]="Intersect",c[c.Iterator=30]="Iterator",c[c.Kind=31]="Kind",c[c.Literal=32]="Literal",c[c.Never=33]="Never",c[c.Not=34]="Not",c[c.Null=35]="Null",c[c.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",c[c.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",c[c.NumberMaximum=38]="NumberMaximum",c[c.NumberMinimum=39]="NumberMinimum",c[c.NumberMultipleOf=40]="NumberMultipleOf",c[c.Number=41]="Number",c[c.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",c[c.ObjectMaxProperties=43]="ObjectMaxProperties",c[c.ObjectMinProperties=44]="ObjectMinProperties",c[c.ObjectRequiredProperty=45]="ObjectRequiredProperty",c[c.Object=46]="Object",c[c.Promise=47]="Promise",c[c.StringFormatUnknown=48]="StringFormatUnknown",c[c.StringFormat=49]="StringFormat",c[c.StringMaxLength=50]="StringMaxLength",c[c.StringMinLength=51]="StringMinLength",c[c.StringPattern=52]="StringPattern",c[c.String=53]="String",c[c.Symbol=54]="Symbol",c[c.TupleLength=55]="TupleLength",c[c.Tuple=56]="Tuple",c[c.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",c[c.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",c[c.Uint8Array=59]="Uint8Array",c[c.Undefined=60]="Undefined",c[c.Union=61]="Union",c[c.Void=62]="Void"})(a||(e.ValueErrorType=a={}));var s=class extends o.TypeBoxError{constructor(c){super("Unknown type"),this.schema=c}};e.ValueErrorsUnknownTypeError=s;function u(c){return c.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=u;function l(c){return c!==void 0}var f=class{constructor(c){this.iterator=c}[Symbol.iterator](){return this.iterator}First(){let c=this.iterator.next();return c.done?void 0:c.value}};e.ValueErrorIterator=f;function d(c,O,v,b){return{type:c,schema:O,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(O,c)}}function*$(c,O,v,b){}function*E(c,O,v,b){if(!(0,t.IsArray)(b))return yield d(a.Array,c,v,b);l(c.minItems)&&!(b.length>=c.minItems)&&(yield d(a.ArrayMinItems,c,v,b)),l(c.maxItems)&&!(b.length<=c.maxItems)&&(yield d(a.ArrayMaxItems,c,v,b));for(let ie=0;ie<b.length;ie++)yield*x(c.items,O,`${v}/${ie}`,b[ie]);if(c.uniqueItems===!0&&!function(){let ie=new Set;for(let oe of b){let ve=(0,i.Hash)(oe);if(ie.has(ve))return!1;ie.add(ve)}return!0}()&&(yield d(a.ArrayUniqueItems,c,v,b)),!(l(c.contains)||l(c.minContains)||l(c.maxContains)))return;let P=l(c.contains)?c.contains:o.Type.Never(),H=b.reduce((ie,oe,ve)=>x(P,O,`${v}${ve}`,oe).next().done===!0?ie+1:ie,0);H===0&&(yield d(a.ArrayContains,c,v,b)),(0,t.IsNumber)(c.minContains)&&H<c.minContains&&(yield d(a.ArrayMinContains,c,v,b)),(0,t.IsNumber)(c.maxContains)&&H>c.maxContains&&(yield d(a.ArrayMaxContains,c,v,b))}function*T(c,O,v,b){(0,t.IsAsyncIterator)(b)||(yield d(a.AsyncIterator,c,v,b))}function*B(c,O,v,b){if(!(0,t.IsBigInt)(b))return yield d(a.BigInt,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.BigIntExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.BigIntExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.BigIntMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.BigIntMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==BigInt(0)&&(yield d(a.BigIntMultipleOf,c,v,b))}function*W(c,O,v,b){(0,t.IsBoolean)(b)||(yield d(a.Boolean,c,v,b))}function*M(c,O,v,b){yield*x(c.returns,O,v,b.prototype)}function*k(c,O,v,b){if(!(0,t.IsDate)(b))return yield d(a.Date,c,v,b);l(c.exclusiveMaximumTimestamp)&&!(b.getTime()<c.exclusiveMaximumTimestamp)&&(yield d(a.DateExclusiveMaximumTimestamp,c,v,b)),l(c.exclusiveMinimumTimestamp)&&!(b.getTime()>c.exclusiveMinimumTimestamp)&&(yield d(a.DateExclusiveMinimumTimestamp,c,v,b)),l(c.maximumTimestamp)&&!(b.getTime()<=c.maximumTimestamp)&&(yield d(a.DateMaximumTimestamp,c,v,b)),l(c.minimumTimestamp)&&!(b.getTime()>=c.minimumTimestamp)&&(yield d(a.DateMinimumTimestamp,c,v,b)),l(c.multipleOfTimestamp)&&b.getTime()%c.multipleOfTimestamp!==0&&(yield d(a.DateMultipleOfTimestamp,c,v,b))}function*F(c,O,v,b){(0,t.IsFunction)(b)||(yield d(a.Function,c,v,b))}function*K(c,O,v,b){if(!(0,t.IsInteger)(b))return yield d(a.Integer,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.IntegerExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.IntegerExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.IntegerMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.IntegerMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.IntegerMultipleOf,c,v,b))}function*D(c,O,v,b){for(let P of c.allOf){let H=x(P,O,v,b).next();H.done||(yield d(a.Intersect,c,v,b),yield H.value)}if(c.unevaluatedProperties===!1){let P=new RegExp(o.KeyResolver.ResolvePattern(c));for(let H of Object.getOwnPropertyNames(b))P.test(H)||(yield d(a.IntersectUnevaluatedProperties,c,`${v}/${H}`,b))}if(typeof c.unevaluatedProperties=="object"){let P=new RegExp(o.KeyResolver.ResolvePattern(c));for(let H of Object.getOwnPropertyNames(b))if(!P.test(H)){let ie=x(c.unevaluatedProperties,O,`${v}/${H}`,b[H]).next();ie.done||(yield ie.value)}}}function*Q(c,O,v,b){(0,t.IsIterator)(b)||(yield d(a.Iterator,c,v,b))}function*q(c,O,v,b){b!==c.const&&(yield d(a.Literal,c,v,b))}function*te(c,O,v,b){yield d(a.Never,c,v,b)}function*j(c,O,v,b){x(c.not,O,v,b).next().done===!0&&(yield d(a.Not,c,v,b))}function*L(c,O,v,b){(0,t.IsNull)(b)||(yield d(a.Null,c,v,b))}function*z(c,O,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield d(a.Number,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.NumberExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.NumberExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.NumberMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.NumberMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.NumberMultipleOf,c,v,b))}function*re(c,O,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let P=Array.isArray(c.required)?c.required:[],H=Object.getOwnPropertyNames(c.properties),ie=Object.getOwnPropertyNames(b);for(let oe of P)ie.includes(oe)||(yield d(a.ObjectRequiredProperty,c.properties[oe],`${v}/${u(oe)}`,void 0));if(c.additionalProperties===!1)for(let oe of ie)H.includes(oe)||(yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,b[oe]));if(typeof c.additionalProperties=="object")for(let oe of ie)H.includes(oe)||(yield*x(c.additionalProperties,O,`${v}/${u(oe)}`,b[oe]));for(let oe of H){let ve=c.properties[oe];c.required&&c.required.includes(oe)?(yield*x(ve,O,`${v}/${u(oe)}`,b[oe]),o.ExtendsUndefined.Check(c)&&!(oe in b)&&(yield d(a.ObjectRequiredProperty,ve,`${v}/${u(oe)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(b,oe)&&(yield*x(ve,O,`${v}/${u(oe)}`,b[oe]))}}function*se(c,O,v,b){(0,t.IsPromise)(b)||(yield d(a.Promise,c,v,b))}function*ee(c,O,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let[P,H]=Object.entries(c.patternProperties)[0],ie=new RegExp(P);for(let[oe,ve]of Object.entries(b))ie.test(oe)&&(yield*x(H,O,`${v}/${u(oe)}`,ve));if(typeof c.additionalProperties=="object")for(let[oe,ve]of Object.entries(b))ie.test(oe)||(yield*x(c.additionalProperties,O,`${v}/${u(oe)}`,ve));if(c.additionalProperties===!1){for(let[oe,ve]of Object.entries(b))if(!ie.test(oe))return yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,ve)}}function*ce(c,O,v,b){yield*x((0,n.Deref)(c,O),O,v,b)}function*V(c,O,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);l(c.minLength)&&!(b.length>=c.minLength)&&(yield d(a.StringMinLength,c,v,b)),l(c.maxLength)&&!(b.length<=c.maxLength)&&(yield d(a.StringMaxLength,c,v,b)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(b)||(yield d(a.StringFormat,c,v,b)):yield d(a.StringFormatUnknown,c,v,b))}function*J(c,O,v,b){(0,t.IsSymbol)(b)||(yield d(a.Symbol,c,v,b))}function*Z(c,O,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))}function*ye(c,O,v,b){yield*x((0,n.Deref)(c,O),O,v,b)}function*p(c,O,v,b){if(!(0,t.IsArray)(b))return yield d(a.Tuple,c,v,b);if(c.items===void 0&&b.length!==0)return yield d(a.TupleLength,c,v,b);if(b.length!==c.maxItems)return yield d(a.TupleLength,c,v,b);if(c.items)for(let P=0;P<c.items.length;P++)yield*x(c.items[P],O,`${v}/${P}`,b[P])}function*w(c,O,v,b){(0,t.IsUndefined)(b)||(yield d(a.Undefined,c,v,b))}function*A(c,O,v,b){let P=0;for(let H of c.anyOf){let ie=[...x(H,O,v,b)];if(ie.length===0)return;P+=ie.length}P>0&&(yield d(a.Union,c,v,b))}function*R(c,O,v,b){if(!(0,t.IsUint8Array)(b))return yield d(a.Uint8Array,c,v,b);l(c.maxByteLength)&&!(b.length<=c.maxByteLength)&&(yield d(a.Uint8ArrayMaxByteLength,c,v,b)),l(c.minByteLength)&&!(b.length>=c.minByteLength)&&(yield d(a.Uint8ArrayMinByteLength,c,v,b))}function*N(c,O,v,b){}function*U(c,O,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield d(a.Void,c,v,b))}function*g(c,O,v,b){o.TypeRegistry.Get(c[o.Kind])(c,b)||(yield d(a.Kind,c,v,b))}function*x(c,O,v,b){let P=l(c.$id)?[...O,c]:O,H=c;switch(H[o.Kind]){case"Any":return yield*$(H,P,v,b);case"Array":return yield*E(H,P,v,b);case"AsyncIterator":return yield*T(H,P,v,b);case"BigInt":return yield*B(H,P,v,b);case"Boolean":return yield*W(H,P,v,b);case"Constructor":return yield*M(H,P,v,b);case"Date":return yield*k(H,P,v,b);case"Function":return yield*F(H,P,v,b);case"Integer":return yield*K(H,P,v,b);case"Intersect":return yield*D(H,P,v,b);case"Iterator":return yield*Q(H,P,v,b);case"Literal":return yield*q(H,P,v,b);case"Never":return yield*te(H,P,v,b);case"Not":return yield*j(H,P,v,b);case"Null":return yield*L(H,P,v,b);case"Number":return yield*z(H,P,v,b);case"Object":return yield*re(H,P,v,b);case"Promise":return yield*se(H,P,v,b);case"Record":return yield*ee(H,P,v,b);case"Ref":return yield*ce(H,P,v,b);case"String":return yield*V(H,P,v,b);case"Symbol":return yield*J(H,P,v,b);case"TemplateLiteral":return yield*Z(H,P,v,b);case"This":return yield*ye(H,P,v,b);case"Tuple":return yield*p(H,P,v,b);case"Undefined":return yield*w(H,P,v,b);case"Union":return yield*A(H,P,v,b);case"Uint8Array":return yield*R(H,P,v,b);case"Unknown":return yield*N(H,P,v,b);case"Void":return yield*U(H,P,v,b);default:if(!o.TypeRegistry.Has(H[o.Kind]))throw new s(c);return yield*g(H,P,v,b)}}function _(...c){let O=c.length===3?x(c[0],c[1],"",c[2]):x(c[0],[],"",c[1]);return new f(O)}e.Errors=_}}),KT=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/errors/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(n,i,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(i,o);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,a,s)}:function(n,i,o,a){a===void 0&&(a=o),n[a]=i[o]}),r=e&&e.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,n,o)};Object.defineProperty(e,"__esModule",{value:!0}),r(is(),e)}}),Fp=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/system/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,a,s){s===void 0&&(s=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,s,u)}:function(i,o,a,s){s===void 0&&(s=a),i[s]=o[a]}),r=e&&e.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorType=void 0;var n=is();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(Vp(),e)}}),GT=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/check.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Check=e.ValueCheckUnknownTypeError=void 0;var t=di(),r=Fp(),n=ns(),i=wl(),o=Gr(),a=class extends o.TypeBoxError{constructor(g){super("Unknown type"),this.schema=g}};e.ValueCheckUnknownTypeError=a;function s(g){return g[o.Kind]==="Any"||g[o.Kind]==="Unknown"}function u(g){return g!==void 0}function l(g,x,_){return!0}function f(g,x,_){if(!(0,t.IsArray)(_)||u(g.minItems)&&!(_.length>=g.minItems)||u(g.maxItems)&&!(_.length<=g.maxItems)||!_.every(v=>N(g.items,x,v))||g.uniqueItems===!0&&!function(){let v=new Set;for(let b of _){let P=(0,i.Hash)(b);if(v.has(P))return!1;v.add(P)}return!0}())return!1;if(!(u(g.contains)||(0,t.IsNumber)(g.minContains)||(0,t.IsNumber)(g.maxContains)))return!0;let c=u(g.contains)?g.contains:o.Type.Never(),O=_.reduce((v,b)=>N(c,x,b)?v+1:v,0);return!(O===0||(0,t.IsNumber)(g.minContains)&&O<g.minContains||(0,t.IsNumber)(g.maxContains)&&O>g.maxContains)}function d(g,x,_){return(0,t.IsAsyncIterator)(_)}function $(g,x,_){return!(!(0,t.IsBigInt)(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.minimum)&&!(_>=g.minimum)||u(g.multipleOf)&&_%g.multipleOf!==BigInt(0))}function E(g,x,_){return(0,t.IsBoolean)(_)}function T(g,x,_){return N(g.returns,x,_.prototype)}function B(g,x,_){return!(!(0,t.IsDate)(_)||u(g.exclusiveMaximumTimestamp)&&!(_.getTime()<g.exclusiveMaximumTimestamp)||u(g.exclusiveMinimumTimestamp)&&!(_.getTime()>g.exclusiveMinimumTimestamp)||u(g.maximumTimestamp)&&!(_.getTime()<=g.maximumTimestamp)||u(g.minimumTimestamp)&&!(_.getTime()>=g.minimumTimestamp)||u(g.multipleOfTimestamp)&&_.getTime()%g.multipleOfTimestamp!==0)}function W(g,x,_){return(0,t.IsFunction)(_)}function M(g,x,_){return!(!(0,t.IsInteger)(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.minimum)&&!(_>=g.minimum)||u(g.multipleOf)&&_%g.multipleOf!==0)}function k(g,x,_){let c=g.allOf.every(O=>N(O,x,_));if(g.unevaluatedProperties===!1){let O=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>O.test(b));return c&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let O=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>O.test(b)||N(g.unevaluatedProperties,x,_[b]));return c&&v}else return c}function F(g,x,_){return(0,t.IsIterator)(_)}function K(g,x,_){return _===g.const}function D(g,x,_){return!1}function Q(g,x,_){return!N(g.not,x,_)}function q(g,x,_){return(0,t.IsNull)(_)}function te(g,x,_){return!(!r.TypeSystemPolicy.IsNumberLike(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.minimum)&&!(_>=g.minimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.multipleOf)&&_%g.multipleOf!==0)}function j(g,x,_){if(!r.TypeSystemPolicy.IsObjectLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let c=Object.getOwnPropertyNames(g.properties);for(let O of c){let v=g.properties[O];if(g.required&&g.required.includes(O)){if(!N(v,x,_[O])||(o.ExtendsUndefined.Check(v)||s(v))&&!(O in _))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(_,O)&&!N(v,x,_[O]))return!1}if(g.additionalProperties===!1){let O=Object.getOwnPropertyNames(_);return g.required&&g.required.length===c.length&&O.length===c.length?!0:O.every(v=>c.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(_).every(O=>c.includes(O)||N(g.additionalProperties,x,_[O])):!0}function L(g,x,_){return(0,t.IsPromise)(_)}function z(g,x,_){if(!r.TypeSystemPolicy.IsRecordLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let[c,O]=Object.entries(g.patternProperties)[0],v=new RegExp(c),b=Object.entries(_).every(([ie,oe])=>v.test(ie)?N(O,x,oe):!0),P=typeof g.additionalProperties=="object"?Object.entries(_).every(([ie,oe])=>v.test(ie)?!0:N(g.additionalProperties,x,oe)):!0,H=g.additionalProperties===!1?Object.getOwnPropertyNames(_).every(ie=>v.test(ie)):!0;return b&&P&&H}function re(g,x,_){return N((0,n.Deref)(g,x),x,_)}function se(g,x,_){return!(0,t.IsString)(_)||u(g.minLength)&&!(_.length>=g.minLength)||u(g.maxLength)&&!(_.length<=g.maxLength)||u(g.pattern)&&!new RegExp(g.pattern).test(_)?!1:u(g.format)?o.FormatRegistry.Has(g.format)?o.FormatRegistry.Get(g.format)(_):!1:!0}function ee(g,x,_){return(0,t.IsSymbol)(_)}function ce(g,x,_){return(0,t.IsString)(_)&&new RegExp(g.pattern).test(_)}function V(g,x,_){return N((0,n.Deref)(g,x),x,_)}function J(g,x,_){if(!(0,t.IsArray)(_)||g.items===void 0&&_.length!==0||_.length!==g.maxItems)return!1;if(!g.items)return!0;for(let c=0;c<g.items.length;c++)if(!N(g.items[c],x,_[c]))return!1;return!0}function Z(g,x,_){return(0,t.IsUndefined)(_)}function ye(g,x,_){return g.anyOf.some(c=>N(c,x,_))}function p(g,x,_){return!(!(0,t.IsUint8Array)(_)||u(g.maxByteLength)&&!(_.length<=g.maxByteLength)||u(g.minByteLength)&&!(_.length>=g.minByteLength))}function w(g,x,_){return!0}function A(g,x,_){return r.TypeSystemPolicy.IsVoidLike(_)}function R(g,x,_){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,_):!1}function N(g,x,_){let c=u(g.$id)?[...x,g]:x,O=g;switch(O[o.Kind]){case"Any":return l(O,c,_);case"Array":return f(O,c,_);case"AsyncIterator":return d(O,c,_);case"BigInt":return $(O,c,_);case"Boolean":return E(O,c,_);case"Constructor":return T(O,c,_);case"Date":return B(O,c,_);case"Function":return W(O,c,_);case"Integer":return M(O,c,_);case"Intersect":return k(O,c,_);case"Iterator":return F(O,c,_);case"Literal":return K(O,c,_);case"Never":return D(O,c,_);case"Not":return Q(O,c,_);case"Null":return q(O,c,_);case"Number":return te(O,c,_);case"Object":return j(O,c,_);case"Promise":return L(O,c,_);case"Record":return z(O,c,_);case"Ref":return re(O,c,_);case"String":return se(O,c,_);case"Symbol":return ee(O,c,_);case"TemplateLiteral":return ce(O,c,_);case"This":return V(O,c,_);case"Tuple":return J(O,c,_);case"Undefined":return Z(O,c,_);case"Union":return ye(O,c,_);case"Uint8Array":return p(O,c,_);case"Unknown":return w(O,c,_);case"Void":return A(O,c,_);default:if(!o.TypeRegistry.Has(O[o.Kind]))throw new a(O);return R(O,c,_)}}function U(...g){return g.length===3?N(g[0],g[1],g[2]):N(g[0],[],g[1])}e.Check=U}}),HT=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/transform.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.EncodeTransform=e.DecodeTransform=e.HasTransform=e.TransformEncodeError=e.TransformDecodeError=e.TransformEncodeCheckError=e.TransformDecodeCheckError=void 0;var t=di(),r=ns(),n=GT(),i=Gr(),o=class extends i.TypeBoxError{constructor($,E,T){super("Unable to decode due to invalid value"),this.schema=$,this.value=E,this.error=T}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor($,E,T){super("Unable to encode due to invalid value"),this.schema=$,this.value=E,this.error=T}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor($,E,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=$,this.value=E}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor($,E,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=$,this.value=E}};e.TransformEncodeError=u;var l;(function($){function E(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.items,ce)}function T(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.items,ce)}function B(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.returns,ce)||ee.parameters.some(V=>z(V,ce))}function W(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.returns,ce)||ee.parameters.some(V=>z(V,ce))}function M(ee,ce){return i.TypeGuard.TTransform(ee)||i.TypeGuard.TTransform(ee.unevaluatedProperties)||ee.allOf.some(V=>z(V,ce))}function k(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.items,ce)}function F(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.not,ce)}function K(ee,ce){return i.TypeGuard.TTransform(ee)||Object.values(ee.properties).some(V=>z(V,ce))||i.TypeGuard.TSchema(ee.additionalProperties)&&z(ee.additionalProperties,ce)}function D(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.item,ce)}function Q(ee,ce){let V=Object.getOwnPropertyNames(ee.patternProperties)[0],J=ee.patternProperties[V];return i.TypeGuard.TTransform(ee)||z(J,ce)||i.TypeGuard.TSchema(ee.additionalProperties)&&i.TypeGuard.TTransform(ee.additionalProperties)}function q(ee,ce){return i.TypeGuard.TTransform(ee)?!0:z((0,r.Deref)(ee,ce),ce)}function te(ee,ce){return i.TypeGuard.TTransform(ee)?!0:z((0,r.Deref)(ee,ce),ce)}function j(ee,ce){return i.TypeGuard.TTransform(ee)||!(0,t.IsUndefined)(ee.items)&&ee.items.some(V=>z(V,ce))}function L(ee,ce){return i.TypeGuard.TTransform(ee)||ee.anyOf.some(V=>z(V,ce))}function z(ee,ce){let V=(0,t.IsString)(ee.$id)?[...ce,ee]:ce,J=ee;if(ee.$id&&re.has(ee.$id))return!1;switch(ee.$id&&re.add(ee.$id),ee[i.Kind]){case"Array":return E(J,V);case"AsyncIterator":return T(J,V);case"Constructor":return B(J,V);case"Function":return W(J,V);case"Intersect":return M(J,V);case"Iterator":return k(J,V);case"Not":return F(J,V);case"Object":return K(J,V);case"Promise":return D(J,V);case"Record":return Q(J,V);case"Ref":return q(J,V);case"This":return te(J,V);case"Tuple":return j(J,V);case"Union":return L(J,V);default:return i.TypeGuard.TTransform(ee)}}let re=new Set;function se(ee,ce){return re.clear(),z(ee,ce)}$.Has=se})(l||(e.HasTransform=l={}));var f;(function($){function E(j,L){try{return i.TypeGuard.TTransform(j)?j[i.Transform].Decode(L):L}catch(z){throw new s(j,L,z)}}function T(j,L,z){return(0,t.IsArray)(z)?E(j,z.map(re=>q(j.items,L,re))):E(j,z)}function B(j,L,z){if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return E(j,z);let re=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),se=re.reduce((J,Z)=>Z in J?{...J,[Z]:q(i.IndexedAccessor.Resolve(j,[Z]),L,J[Z])}:J,z);if(!i.TypeGuard.TTransform(j.unevaluatedProperties))return E(j,se);let ee=Object.getOwnPropertyNames(se),ce=j.unevaluatedProperties,V=ee.reduce((J,Z)=>re.includes(Z)?J:{...J,[Z]:E(ce,J[Z])},se);return E(j,V)}function W(j,L,z){return E(j,q(j.not,L,z))}function M(j,L,z){if(!(0,t.IsPlainObject)(z))return E(j,z);let re=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),se=re.reduce((J,Z)=>Z in J?{...J,[Z]:q(j.properties[Z],L,J[Z])}:J,z);if(!i.TypeGuard.TSchema(j.additionalProperties))return E(j,se);let ee=Object.getOwnPropertyNames(se),ce=j.additionalProperties,V=ee.reduce((J,Z)=>re.includes(Z)?J:{...J,[Z]:E(ce,J[Z])},se);return E(j,V)}function k(j,L,z){if(!(0,t.IsPlainObject)(z))return E(j,z);let re=Object.getOwnPropertyNames(j.patternProperties)[0],se=new RegExp(re),ee=Object.getOwnPropertyNames(z).reduce((Z,ye)=>se.test(ye)?{...Z,[ye]:q(j.patternProperties[re],L,Z[ye])}:Z,z);if(!i.TypeGuard.TSchema(j.additionalProperties))return E(j,ee);let ce=Object.getOwnPropertyNames(ee),V=j.additionalProperties,J=ce.reduce((Z,ye)=>se.test(ye)?Z:{...Z,[ye]:E(V,Z[ye])},ee);return E(j,J)}function F(j,L,z){let re=(0,r.Deref)(j,L);return E(j,q(re,L,z))}function K(j,L,z){let re=(0,r.Deref)(j,L);return E(j,q(re,L,z))}function D(j,L,z){return(0,t.IsArray)(z)&&(0,t.IsArray)(j.items)?E(j,j.items.map((re,se)=>q(re,L,z[se]))):E(j,z)}function Q(j,L,z){let re=E(j,z);for(let se of j.anyOf)if((0,n.Check)(se,L,re))return q(se,L,re);return re}function q(j,L,z){let re=typeof j.$id=="string"?[...L,j]:L,se=j;switch(j[i.Kind]){case"Array":return T(se,re,z);case"Intersect":return B(se,re,z);case"Not":return W(se,re,z);case"Object":return M(se,re,z);case"Record":return k(se,re,z);case"Ref":return F(se,re,z);case"Symbol":return E(se,z);case"This":return K(se,re,z);case"Tuple":return D(se,re,z);case"Union":return Q(se,re,z);default:return E(se,z)}}function te(j,L,z){return q(j,L,z)}$.Decode=te})(f||(e.DecodeTransform=f={}));var d;(function($){function E(j,L){try{return i.TypeGuard.TTransform(j)?j[i.Transform].Encode(L):L}catch(z){throw new u(j,L,z)}}function T(j,L,z){let re=E(j,z);return(0,t.IsArray)(re)?re.map(se=>q(j.items,L,se)):re}function B(j,L,z){let re=E(j,z);if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return re;let se=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),ee=se.reduce((J,Z)=>Z in re?{...J,[Z]:q(i.IndexedAccessor.Resolve(j,[Z]),L,J[Z])}:J,re);if(!i.TypeGuard.TTransform(j.unevaluatedProperties))return E(j,ee);let ce=Object.getOwnPropertyNames(ee),V=j.unevaluatedProperties;return ce.reduce((J,Z)=>se.includes(Z)?J:{...J,[Z]:E(V,J[Z])},ee)}function W(j,L,z){return E(j.not,E(j,z))}function M(j,L,z){let re=E(j,z);if(!(0,t.IsPlainObject)(z))return re;let se=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),ee=se.reduce((J,Z)=>Z in J?{...J,[Z]:q(j.properties[Z],L,J[Z])}:J,re);if(!i.TypeGuard.TSchema(j.additionalProperties))return ee;let ce=Object.getOwnPropertyNames(ee),V=j.additionalProperties;return ce.reduce((J,Z)=>se.includes(Z)?J:{...J,[Z]:E(V,J[Z])},ee)}function k(j,L,z){let re=E(j,z);if(!(0,t.IsPlainObject)(z))return re;let se=Object.getOwnPropertyNames(j.patternProperties)[0],ee=new RegExp(se),ce=Object.getOwnPropertyNames(z).reduce((Z,ye)=>ee.test(ye)?{...Z,[ye]:q(j.patternProperties[se],L,Z[ye])}:Z,re);if(!i.TypeGuard.TSchema(j.additionalProperties))return E(j,ce);let V=Object.getOwnPropertyNames(ce),J=j.additionalProperties;return V.reduce((Z,ye)=>ee.test(ye)?Z:{...Z,[ye]:E(J,Z[ye])},ce)}function F(j,L,z){let re=(0,r.Deref)(j,L),se=q(re,L,z);return E(j,se)}function K(j,L,z){let re=(0,r.Deref)(j,L),se=q(re,L,z);return E(j,se)}function D(j,L,z){let re=E(j,z);return(0,t.IsArray)(j.items)?j.items.map((se,ee)=>q(se,L,re[ee])):[]}function Q(j,L,z){for(let re of j.anyOf){if(!(0,n.Check)(re,L,z))continue;let se=q(re,L,z);return E(j,se)}for(let re of j.anyOf){let se=q(re,L,z);if((0,n.Check)(j,L,se))return E(j,se)}return E(j,z)}function q(j,L,z){let re=typeof j.$id=="string"?[...L,j]:L,se=j;switch(j[i.Kind]){case"Array":return T(se,re,z);case"Intersect":return B(se,re,z);case"Not":return W(se,re,z);case"Object":return M(se,re,z);case"Record":return k(se,re,z);case"Ref":return F(se,re,z);case"This":return K(se,re,z);case"Tuple":return D(se,re,z);case"Union":return Q(se,re,z);default:return E(se,z)}}function te(j,L,z){return q(j,L,z)}$.Encode=te})(d||(e.EncodeTransform=d={}))}}),WT=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/compiler.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TypeCompiler=e.Policy=e.TypeCompilerTypeGuardError=e.TypeCompilerUnknownTypeError=e.TypeCheck=void 0;var t=HT(),r=di(),n=is(),i=Fp(),o=ns(),a=wl(),s=Gr(),u=class{constructor(M,k,F,K){this.schema=M,this.references=k,this.checkFunc=F,this.code=K,this.hasTransform=t.HasTransform.Has(M,k)}Code(){return this.code}Errors(M){return(0,n.Errors)(this.schema,this.references,M)}Check(M){return this.checkFunc(M)}Decode(M){if(!this.checkFunc(M))throw new t.TransformDecodeCheckError(this.schema,M,this.Errors(M).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,M):M}Encode(M){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,M):M;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,M,this.Errors(M).First());return k}};e.TypeCheck=u;var l;(function(M){function k(Q){return Q===36}M.DollarSign=k;function F(Q){return Q===95}M.IsUnderscore=F;function K(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}M.IsAlpha=K;function D(Q){return Q>=48&&Q<=57}M.IsNumeric=D})(l||(l={}));var f;(function(M){function k(Q){return Q.length===0?!1:l.IsNumeric(Q.charCodeAt(0))}function F(Q){if(k(Q))return!1;for(let q=0;q<Q.length;q++){let te=Q.charCodeAt(q);if(!(l.IsAlpha(te)||l.IsNumeric(te)||l.DollarSign(te)||l.IsUnderscore(te)))return!1}return!0}function K(Q){return Q.replace(/'/g,"\\'")}function D(Q,q){return F(q)?`${Q}.${q}`:`${Q}['${K(q)}']`}M.Encode=D})(f||(f={}));var d;(function(M){function k(F){let K=[];for(let D=0;D<F.length;D++){let Q=F.charCodeAt(D);l.IsNumeric(Q)||l.IsAlpha(Q)?K.push(F.charAt(D)):K.push(`_${Q}_`)}return K.join("").replace(/__/g,"_")}M.Encode=k})(d||(d={}));var $;(function(M){function k(F){return F.replace(/'/g,"\\'")}M.Escape=k})($||($={}));var E=class extends s.TypeBoxError{constructor(M){super("Unknown type"),this.schema=M}};e.TypeCompilerUnknownTypeError=E;var T=class extends s.TypeBoxError{constructor(M){super("Preflight validation check failed to guard for the given schema"),this.schema=M}};e.TypeCompilerTypeGuardError=T;var B;(function(M){function k(q,te,j){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${te}' in ${q} ? ${j} : true)`:`(${f.Encode(q,te)} !== undefined ? ${j} : true)`}M.IsExactOptionalProperty=k;function F(q){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${q} === 'object' && ${q} !== null)`:`(typeof ${q} === 'object' && ${q} !== null && !Array.isArray(${q}))`}M.IsObjectLike=F;function K(q){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${q} === 'object' && ${q} !== null && !(${q} instanceof Date) && !(${q} instanceof Uint8Array))`:`(typeof ${q} === 'object' && ${q} !== null && !Array.isArray(${q}) && !(${q} instanceof Date) && !(${q} instanceof Uint8Array))`}M.IsRecordLike=K;function D(q){return i.TypeSystemPolicy.AllowNaN?`typeof ${q} === 'number'`:`(typeof ${q} === 'number' && Number.isFinite(${q}))`}M.IsNumberLike=D;function Q(q){return i.TypeSystemPolicy.AllowNullVoid?`(${q} === undefined || ${q} === null)`:`${q} === undefined`}M.IsVoidLike=Q})(B||(e.Policy=B={}));var W;(function(M){function k(S){return S[s.Kind]==="Any"||S[s.Kind]==="Unknown"}function*F(S,pe,C){yield"true"}function*K(S,pe,C){yield`Array.isArray(${C})`;let[_e,ae]=[ze("value","any"),ze("acc","number")];(0,r.IsNumber)(S.maxItems)&&(yield`${C}.length <= ${S.maxItems}`),(0,r.IsNumber)(S.minItems)&&(yield`${C}.length >= ${S.minItems}`);let he=oe(S.items,pe,"value");if(yield`${C}.every((${_e}) => ${he})`,s.TypeGuard.TSchema(S.contains)||(0,r.IsNumber)(S.minContains)||(0,r.IsNumber)(S.maxContains)){let Ce=s.TypeGuard.TSchema(S.contains)?S.contains:s.Type.Never(),qe=oe(Ce,pe,"value"),ft=(0,r.IsNumber)(S.minContains)?[`(count >= ${S.minContains})`]:[],at=(0,r.IsNumber)(S.maxContains)?[`(count <= ${S.maxContains})`]:[],pt=`const count = value.reduce((${ae}, ${_e}) => ${qe} ? acc + 1 : acc, 0)`,Ir=["(count > 0)",...ft,...at].join(" && ");yield`((${_e}) => { ${pt}; return ${Ir}})(${C})`}S.uniqueItems===!0&&(yield`((${_e}) => { 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 } )(${C})`)}function*D(S,pe,C){yield`(typeof value === 'object' && Symbol.asyncIterator in ${C})`}function*Q(S,pe,C){yield`(typeof ${C} === 'bigint')`,(0,r.IsBigInt)(S.exclusiveMaximum)&&(yield`${C} < BigInt(${S.exclusiveMaximum})`),(0,r.IsBigInt)(S.exclusiveMinimum)&&(yield`${C} > BigInt(${S.exclusiveMinimum})`),(0,r.IsBigInt)(S.maximum)&&(yield`${C} <= BigInt(${S.maximum})`),(0,r.IsBigInt)(S.minimum)&&(yield`${C} >= BigInt(${S.minimum})`),(0,r.IsBigInt)(S.multipleOf)&&(yield`(${C} % BigInt(${S.multipleOf})) === 0`)}function*q(S,pe,C){yield`(typeof ${C} === 'boolean')`}function*te(S,pe,C){yield*H(S.returns,pe,`${C}.prototype`)}function*j(S,pe,C){yield`(${C} instanceof Date) && Number.isFinite(${C}.getTime())`,(0,r.IsNumber)(S.exclusiveMaximumTimestamp)&&(yield`${C}.getTime() < ${S.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(S.exclusiveMinimumTimestamp)&&(yield`${C}.getTime() > ${S.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(S.maximumTimestamp)&&(yield`${C}.getTime() <= ${S.maximumTimestamp}`),(0,r.IsNumber)(S.minimumTimestamp)&&(yield`${C}.getTime() >= ${S.minimumTimestamp}`),(0,r.IsNumber)(S.multipleOfTimestamp)&&(yield`(${C}.getTime() % ${S.multipleOfTimestamp}) === 0`)}function*L(S,pe,C){yield`(typeof ${C} === 'function')`}function*z(S,pe,C){yield`(typeof ${C} === 'number' && Number.isInteger(${C}))`,(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*re(S,pe,C){let _e=S.allOf.map(ae=>oe(ae,pe,C)).join(" && ");if(S.unevaluatedProperties===!1){let ae=Oe(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),he=`Object.getOwnPropertyNames(${C}).every(key => ${ae}.test(key))`;yield`(${_e} && ${he})`}else if(s.TypeGuard.TSchema(S.unevaluatedProperties)){let ae=Oe(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),he=`Object.getOwnPropertyNames(${C}).every(key => ${ae}.test(key) || ${oe(S.unevaluatedProperties,pe,`${C}[key]`)})`;yield`(${_e} && ${he})`}else yield`(${_e})`}function*se(S,pe,C){yield`(typeof value === 'object' && Symbol.iterator in ${C})`}function*ee(S,pe,C){typeof S.const=="number"||typeof S.const=="boolean"?yield`(${C} === ${S.const})`:yield`(${C} === '${$.Escape(S.const)}')`}function*ce(S,pe,C){yield"false"}function*V(S,pe,C){yield`(!${oe(S.not,pe,C)})`}function*J(S,pe,C){yield`(${C} === null)`}function*Z(S,pe,C){yield B.IsNumberLike(C),(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*ye(S,pe,C){yield B.IsObjectLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let _e=Object.getOwnPropertyNames(S.properties);for(let ae of _e){let he=f.Encode(C,ae),Ce=S.properties[ae];if(S.required&&S.required.includes(ae))yield*H(Ce,pe,he),(s.ExtendsUndefined.Check(Ce)||k(Ce))&&(yield`('${ae}' in ${C})`);else{let qe=oe(Ce,pe,he);yield B.IsExactOptionalProperty(C,ae,qe)}}if(S.additionalProperties===!1)if(S.required&&S.required.length===_e.length)yield`Object.getOwnPropertyNames(${C}).length === ${_e.length}`;else{let ae=`[${_e.map(he=>`'${he}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${C}).every(key => ${ae}.includes(key))`}if(typeof S.additionalProperties=="object"){let ae=oe(S.additionalProperties,pe,`${C}[key]`),he=`[${_e.map(Ce=>`'${Ce}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${C}).every(key => ${he}.includes(key) || ${ae}))`}}function*p(S,pe,C){yield`(typeof value === 'object' && typeof ${C}.then === 'function')`}function*w(S,pe,C){yield B.IsRecordLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let[_e,ae]=Object.entries(S.patternProperties)[0],he=Oe(`${new RegExp(_e)}`),Ce=oe(ae,pe,"value"),qe=s.TypeGuard.TSchema(S.additionalProperties)?oe(S.additionalProperties,pe,C):S.additionalProperties===!1?"false":"true",ft=`(${he}.test(key) ? ${Ce} : ${qe})`;yield`(Object.entries(${C}).every(([key, value]) => ${ft}))`}function*A(S,pe,C){let _e=(0,o.Deref)(S,pe);if(ie.functions.has(S.$ref))return yield`${ve(S.$ref)}(${C})`;yield*H(_e,pe,C)}function*R(S,pe,C){yield`(typeof ${C} === 'string')`,(0,r.IsNumber)(S.maxLength)&&(yield`${C}.length <= ${S.maxLength}`),(0,r.IsNumber)(S.minLength)&&(yield`${C}.length >= ${S.minLength}`),S.pattern!==void 0&&(yield`${Oe(`${new RegExp(S.pattern)};`)}.test(${C})`),S.format!==void 0&&(yield`format('${S.format}', ${C})`)}function*N(S,pe,C){yield`(typeof ${C} === 'symbol')`}function*U(S,pe,C){yield`(typeof ${C} === 'string')`,yield`${Oe(`${new RegExp(S.pattern)};`)}.test(${C})`}function*g(S,pe,C){yield`${ve(S.$ref)}(${C})`}function*x(S,pe,C){if(yield`Array.isArray(${C})`,S.items===void 0)return yield`${C}.length === 0`;yield`(${C}.length === ${S.maxItems})`;for(let _e=0;_e<S.items.length;_e++)yield`${oe(S.items[_e],pe,`${C}[${_e}]`)}`}function*_(S,pe,C){yield`${C} === undefined`}function*c(S,pe,C){yield`(${S.anyOf.map(_e=>oe(_e,pe,C)).join(" || ")})`}function*O(S,pe,C){yield`${C} instanceof Uint8Array`,(0,r.IsNumber)(S.maxByteLength)&&(yield`(${C}.length <= ${S.maxByteLength})`),(0,r.IsNumber)(S.minByteLength)&&(yield`(${C}.length >= ${S.minByteLength})`)}function*v(S,pe,C){yield"true"}function*b(S,pe,C){yield B.IsVoidLike(C)}function*P(S,pe,C){let _e=ie.instances.size;ie.instances.set(_e,S),yield`kind('${S[s.Kind]}', ${_e}, ${C})`}function*H(S,pe,C,_e=!0){let ae=(0,r.IsString)(S.$id)?[...pe,S]:pe,he=S;if(_e&&(0,r.IsString)(S.$id)){let Ce=ve(S.$id);if(ie.functions.has(Ce))return yield`${Ce}(${C})`;{let qe=Me(Ce,S,pe,"value",!1);return ie.functions.set(Ce,qe),yield`${Ce}(${C})`}}switch(he[s.Kind]){case"Any":return yield*F(he,ae,C);case"Array":return yield*K(he,ae,C);case"AsyncIterator":return yield*D(he,ae,C);case"BigInt":return yield*Q(he,ae,C);case"Boolean":return yield*q(he,ae,C);case"Constructor":return yield*te(he,ae,C);case"Date":return yield*j(he,ae,C);case"Function":return yield*L(he,ae,C);case"Integer":return yield*z(he,ae,C);case"Intersect":return yield*re(he,ae,C);case"Iterator":return yield*se(he,ae,C);case"Literal":return yield*ee(he,ae,C);case"Never":return yield*ce(he,ae,C);case"Not":return yield*V(he,ae,C);case"Null":return yield*J(he,ae,C);case"Number":return yield*Z(he,ae,C);case"Object":return yield*ye(he,ae,C);case"Promise":return yield*p(he,ae,C);case"Record":return yield*w(he,ae,C);case"Ref":return yield*A(he,ae,C);case"String":return yield*R(he,ae,C);case"Symbol":return yield*N(he,ae,C);case"TemplateLiteral":return yield*U(he,ae,C);case"This":return yield*g(he,ae,C);case"Tuple":return yield*x(he,ae,C);case"Undefined":return yield*_(he,ae,C);case"Union":return yield*c(he,ae,C);case"Uint8Array":return yield*O(he,ae,C);case"Unknown":return yield*v(he,ae,C);case"Void":return yield*b(he,ae,C);default:if(!s.TypeRegistry.Has(he[s.Kind]))throw new E(S);return yield*P(he,ae,C)}}let ie={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function oe(S,pe,C,_e=!0){return`(${[...H(S,pe,C,_e)].join(" && ")})`}function ve(S){return`check_${d.Encode(S)}`}function Oe(S){let pe=`local_${ie.variables.size}`;return ie.variables.set(pe,`const ${pe} = ${S}`),pe}function Me(S,pe,C,_e,ae=!0){let[he,Ce]=[`
|
|
49
|
+
`,pt=>"".padStart(pt," ")],qe=ze("value","any"),ft=Jr("boolean"),at=[...H(pe,C,_e,ae)].map(pt=>`${Ce(4)}${pt}`).join(` &&${he}`);return`function ${S}(${qe})${ft} {${he}${Ce(2)}return (${he}${at}${he}${Ce(2)})
|
|
50
|
+
}`}function ze(S,pe){let C=ie.language==="typescript"?`: ${pe}`:"";return`${S}${C}`}function Jr(S){return ie.language==="typescript"?`: ${S}`:""}function Te(S,pe,C){let _e=Me("check",S,pe,"value"),ae=ze("value","any"),he=Jr("boolean"),Ce=[...ie.functions.values()],qe=[...ie.variables.values()],ft=(0,r.IsString)(S.$id)?`return function check(${ae})${he} {
|
|
51
|
+
return ${ve(S.$id)}(value)
|
|
52
|
+
}`:`return ${_e}`;return[...qe,...Ce,ft].join(`
|
|
53
|
+
`)}function Sr(...S){let pe={language:"javascript"},[C,_e,ae]=S.length===2&&(0,r.IsArray)(S[1])?[S[0],S[1],pe]:S.length===2&&!(0,r.IsArray)(S[1])?[S[0],[],S[1]]:S.length===3?[S[0],S[1],S[2]]:S.length===1?[S[0],[],pe]:[null,[],pe];if(ie.language=ae.language,ie.variables.clear(),ie.functions.clear(),ie.instances.clear(),!s.TypeGuard.TSchema(C))throw new T(C);for(let he of _e)if(!s.TypeGuard.TSchema(he))throw new T(he);return Te(C,_e,ae)}M.Code=Sr;function Qr(S,pe=[]){let C=Sr(S,pe,{language:"javascript"}),_e=globalThis.Function("kind","format","hash",C),ae=new Map(ie.instances);function he(at,pt,Ir){if(!s.TypeRegistry.Has(at)||!ae.has(pt))return!1;let kn=s.TypeRegistry.Get(at),jn=ae.get(pt);return kn(jn,Ir)}function Ce(at,pt){return s.FormatRegistry.Has(at)?s.FormatRegistry.Get(at)(pt):!1}function qe(at){return(0,a.Hash)(at)}let ft=_e(he,Ce,qe);return new u(S,pe,ft,C)}M.Compile=Qr})(W||(e.TypeCompiler=W={}))}}),JT=Ze({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/compiler/index.js"(e){"use strict";var t=e&&e.__createBinding||(Object.create?function(i,o,a,s){s===void 0&&(s=a);var u=Object.getOwnPropertyDescriptor(o,a);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[a]}}),Object.defineProperty(i,s,u)}:function(i,o,a,s){s===void 0&&(s=a),i[s]=o[a]}),r=e&&e.__exportStar||function(i,o){for(var a in i)a!=="default"&&!Object.prototype.hasOwnProperty.call(o,a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),e.ValueErrorIterator=e.ValueErrorType=void 0;var n=KT();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(WT(),e)}}),ga=xr(FT(),1),QT=xr(zT(),1),zp=!1,qp=!1;ga.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(zp=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(qp=process?.env?.LOGGER_PERF_PREFIX==="true"));var YT={prefix:void 0,time:zp,delta:qp,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},$s=[],Kp=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,r,n){Object.assign(this,{sinceFirst:e,sinceLast:t,time:r,delta:n})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),r=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?t:null,this.delta?r:null].filter(n=>n!=null).join(",")}]`}},Gp=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},$i=!1,Ae=class ht{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(t=ht.INFO,r={}){r=Object.assign({},YT,r),t>10&&console.debug("setup logger",{config:r});let n=this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}),i=(...u)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...u)};i.isDisabled=!0,i.isEnabled=!1;let o=this.wrapLog(console.groupCollapsed,r),a=(u,l)=>{function f(...$){let E=$[$.length-1];return E===i?E():(o(...$.slice(0,-1)),(async()=>{try{let T=E();return T instanceof Promise?await T:T}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=ht.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error(u.map(l=>typeof l=="string"?l:(0,QT.default)(l)).join(" "))),WARN:a(t>=ht.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=ht.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=ht.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=ht.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(ga.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=ga.isBrowser&&navigator.userAgent.includes("Chrome")?["",ht.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&($i?n.push(new Gp("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();ht.firstLog||(ht.firstLog=i,ht.lastLog=i);let o=new Kp(i-ht.firstLog,i-ht.lastLog,t,r);return ht.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
|
|
54
|
+
`)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};ga.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if($s&&$s.length){for(let t of $s)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Kp))return null;$i||($i=!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 Gp?($i||($i=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var XT=typeof global=="object"&&global&&global.Object===Object&&global,Hp=XT,ZT=typeof self=="object"&&self&&self.Object===Object&&self,e2=Hp||ZT||Function("return this")(),Et=e2,t2=Et.Symbol,sr=t2,Wp=Object.prototype,r2=Wp.hasOwnProperty,n2=Wp.toString,Oi=sr?sr.toStringTag:void 0;function i2(e){var t=r2.call(e,Oi),r=e[Oi];try{e[Oi]=void 0;var n=!0}catch{}var i=n2.call(e);return n&&(t?e[Oi]=r:delete e[Oi]),i}var o2=i2,a2=Object.prototype,s2=a2.toString;function u2(e){return s2.call(e)}var l2=u2,c2="[object Null]",f2="[object Undefined]",Fc=sr?sr.toStringTag:void 0;function d2(e){return e==null?e===void 0?f2:c2:Fc&&Fc in Object(e)?o2(e):l2(e)}var pi=d2;function p2(e){return e!=null&&typeof e=="object"}var qr=p2,h2="[object Symbol]";function y2(e){return typeof e=="symbol"||qr(e)&&pi(e)==h2}var Fn=y2;function g2(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 Jp=g2,m2=Array.isArray,Zt=m2,b2=1/0,zc=sr?sr.prototype:void 0,qc=zc?zc.toString:void 0;function Qp(e){if(typeof e=="string")return e;if(Zt(e))return Jp(e,Qp)+"";if(Fn(e))return qc?qc.call(e):"";var t=e+"";return t=="0"&&1/e==-b2?"-0":t}var v2=Qp,w2=/\s/;function _2(e){for(var t=e.length;t--&&w2.test(e.charAt(t)););return t}var T2=_2,E2=/^\s+/;function O2(e){return e&&e.slice(0,T2(e)+1).replace(E2,"")}var x2=O2;function A2(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var wr=A2,Kc=NaN,S2=/^[-+]0x[0-9a-f]+$/i,I2=/^0b[01]+$/i,$2=/^0o[0-7]+$/i,k2=parseInt;function j2(e){if(typeof e=="number")return e;if(Fn(e))return Kc;if(wr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=wr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=x2(e);var r=I2.test(e);return r||$2.test(e)?k2(e.slice(2),r?2:8):S2.test(e)?Kc:+e}var N2=j2,Gc=1/0,C2=17976931348623157e292;function U2(e){if(!e)return e===0?e:0;if(e=N2(e),e===Gc||e===-Gc){var t=e<0?-1:1;return t*C2}return e===e?e:0}var P2=U2;function R2(e){var t=P2(e),r=t%1;return t===t?r?t-r:t:0}var Hc=R2;function M2(e){return e}var os=M2,D2="[object AsyncFunction]",L2="[object Function]",B2="[object GeneratorFunction]",V2="[object Proxy]";function F2(e){if(!wr(e))return!1;var t=pi(e);return t==L2||t==B2||t==D2||t==V2}var Yp=F2,z2=Et["__core-js_shared__"],ks=z2,Wc=function(){var e=/[^.]+$/.exec(ks&&ks.keys&&ks.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function q2(e){return!!Wc&&Wc in e}var K2=q2,G2=Function.prototype,H2=G2.toString;function W2(e){if(e!=null){try{return H2.call(e)}catch{}try{return e+""}catch{}}return""}var In=W2,J2=/[\\^$.*+?()[\]{}|]/g,Q2=/^\[object .+?Constructor\]$/,Y2=Function.prototype,X2=Object.prototype,Z2=Y2.toString,eE=X2.hasOwnProperty,tE=RegExp("^"+Z2.call(eE).replace(J2,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function rE(e){if(!wr(e)||K2(e))return!1;var t=Yp(e)?tE:Q2;return t.test(In(e))}var nE=rE;function iE(e,t){return e?.[t]}var oE=iE;function aE(e,t){var r=oE(e,t);return nE(r)?r:void 0}var $n=aE,sE=$n(Et,"WeakMap"),qi=sE,uE=qi&&new qi,ma=uE,lE=ma?function(e,t){return ma.set(e,t),e}:os,Xp=lE,Jc=Object.create,cE=function(){function e(){}return function(t){if(!wr(t))return{};if(Jc)return Jc(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),_l=cE;function fE(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=_l(e.prototype),n=e.apply(r,t);return wr(n)?n:r}}var Ki=fE,dE=1;function pE(e,t,r){var n=t&dE,i=Ki(e);function o(){var a=this&&this!==Et&&this instanceof o?i:e;return a.apply(n?r:this,arguments)}return o}var hE=pE;function yE(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var Tl=yE,gE=Math.max;function mE(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,l=gE(o-a,0),f=Array(u+l),d=!n;++s<u;)f[s]=t[s];for(;++i<a;)(d||i<o)&&(f[r[i]]=e[i]);for(;l--;)f[s++]=e[i++];return f}var Zp=mE,bE=Math.max;function vE(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,u=-1,l=t.length,f=bE(o-s,0),d=Array(f+l),$=!n;++i<f;)d[i]=e[i];for(var E=i;++u<l;)d[E+u]=t[u];for(;++a<s;)($||i<o)&&(d[E+r[a]]=e[i++]);return d}var eh=vE;function wE(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var _E=wE;function TE(){}var El=TE,EE=4294967295;function ba(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=EE,this.__views__=[]}ba.prototype=_l(El.prototype);ba.prototype.constructor=ba;var Ol=ba;function OE(){}var th=OE,xE=ma?function(e){return ma.get(e)}:th,rh=xE,AE={},Qc=AE,SE=Object.prototype,IE=SE.hasOwnProperty;function $E(e){for(var t=e.name+"",r=Qc[t],n=IE.call(Qc,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var kE=$E;function va(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}va.prototype=_l(El.prototype);va.prototype.constructor=va;var cu=va;function jE(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var nh=jE;function NE(e){if(e instanceof Ol)return e.clone();var t=new cu(e.__wrapped__,e.__chain__);return t.__actions__=nh(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var CE=NE,UE=Object.prototype,PE=UE.hasOwnProperty;function wa(e){if(qr(e)&&!Zt(e)&&!(e instanceof Ol)){if(e instanceof cu)return e;if(PE.call(e,"__wrapped__"))return CE(e)}return new cu(e)}wa.prototype=El.prototype;wa.prototype.constructor=wa;var RE=wa;function ME(e){var t=kE(e),r=RE[t];if(typeof r!="function"||!(t in Ol.prototype))return!1;if(e===r)return!0;var n=rh(r);return!!n&&e===n[0]}var DE=ME,LE=800,BE=16,VE=Date.now;function FE(e){var t=0,r=0;return function(){var n=VE(),i=BE-(n-r);if(r=n,i>0){if(++t>=LE)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var ih=FE,zE=ih(Xp),oh=zE,qE=/\{\n\/\* \[wrapped with (.+)\] \*/,KE=/,? & /;function GE(e){var t=e.match(qE);return t?t[1].split(KE):[]}var HE=GE,WE=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function JE(e,t){var r=t.length;if(!r)return e;var n=r-1;return t[n]=(r>1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(WE,`{
|
|
55
|
+
/* [wrapped with `+t+`] */
|
|
56
|
+
`)}var QE=JE;function YE(e){return function(){return e}}var XE=YE,ZE=function(){try{var e=$n(Object,"defineProperty");return e({},"",{}),e}catch{}}(),_a=ZE,eO=_a?function(e,t){return _a(e,"toString",{configurable:!0,enumerable:!1,value:XE(t),writable:!0})}:os,tO=eO,rO=ih(tO),xl=rO;function nO(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var iO=nO;function oO(e,t,r,n){for(var i=e.length,o=r+(n?1:-1);n?o--:++o<i;)if(t(e[o],o,e))return o;return-1}var aO=oO;function sO(e){return e!==e}var uO=sO;function lO(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var cO=lO;function fO(e,t,r){return t===t?cO(e,t,r):aO(e,uO,r)}var dO=fO;function pO(e,t){var r=e==null?0:e.length;return!!r&&dO(e,t,0)>-1}var ah=pO,hO=1,yO=2,gO=8,mO=16,bO=32,vO=64,wO=128,_O=256,TO=512,EO=[["ary",wO],["bind",hO],["bindKey",yO],["curry",gO],["curryRight",mO],["flip",TO],["partial",bO],["partialRight",vO],["rearg",_O]];function OO(e,t){return iO(EO,function(r){var n="_."+r[0];t&r[1]&&!ah(e,n)&&e.push(n)}),e.sort()}var xO=OO;function AO(e,t,r){var n=t+"";return xl(e,QE(n,xO(HE(n),r)))}var sh=AO,SO=1,IO=2,$O=4,kO=8,Yc=32,Xc=64;function jO(e,t,r,n,i,o,a,s,u,l){var f=t&kO,d=f?a:void 0,$=f?void 0:a,E=f?o:void 0,T=f?void 0:o;t|=f?Yc:Xc,t&=~(f?Xc:Yc),t&$O||(t&=~(SO|IO));var B=[e,t,i,E,d,T,$,s,u,l],W=r.apply(void 0,B);return DE(e)&&oh(W,B),W.placeholder=n,sh(W,e,t)}var uh=jO;function NO(e){var t=e;return t.placeholder}var Al=NO,CO=9007199254740991,UO=/^(?:0|[1-9]\d*)$/;function PO(e,t){var r=typeof e;return t=t??CO,!!t&&(r=="number"||r!="symbol"&&UO.test(e))&&e>-1&&e%1==0&&e<t}var as=PO,RO=Math.min;function MO(e,t){for(var r=e.length,n=RO(t.length,r),i=nh(e);n--;){var o=t[n];e[n]=as(o,r)?i[o]:void 0}return e}var DO=MO,Zc="__lodash_placeholder__";function LO(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===Zc)&&(e[r]=Zc,o[i++]=r)}return o}var Gi=LO,BO=1,VO=2,FO=8,zO=16,qO=128,KO=512;function lh(e,t,r,n,i,o,a,s,u,l){var f=t&qO,d=t&BO,$=t&VO,E=t&(FO|zO),T=t&KO,B=$?void 0:Ki(e);function W(){for(var M=arguments.length,k=Array(M),F=M;F--;)k[F]=arguments[F];if(E)var K=Al(W),D=_E(k,K);if(n&&(k=Zp(k,n,i,E)),o&&(k=eh(k,o,a,E)),M-=D,E&&M<l){var Q=Gi(k,K);return uh(e,t,lh,W.placeholder,r,k,Q,s,u,l-M)}var q=d?r:this,te=$?q[e]:e;return M=k.length,s?k=DO(k,s):T&&M>1&&k.reverse(),f&&u<M&&(k.length=u),this&&this!==Et&&this instanceof W&&(te=B||Ki(te)),te.apply(q,k)}return W}var ch=lh;function GO(e,t,r){var n=Ki(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=Al(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:Gi(a,u);if(o-=l.length,o<r)return uh(e,t,ch,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==Et&&this instanceof i?n:e;return Tl(f,this,a)}return i}var HO=GO,WO=1;function JO(e,t,r,n){var i=t&WO,o=Ki(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,d=Array(f+u),$=this&&this!==Et&&this instanceof a?o:e;++l<f;)d[l]=n[l];for(;u--;)d[l++]=arguments[++s];return Tl($,i?r:this,d)}return a}var QO=JO,ef="__lodash_placeholder__",js=1,YO=2,XO=4,tf=8,xi=128,rf=256,ZO=Math.min;function ex(e,t){var r=e[1],n=t[1],i=r|n,o=i<(js|YO|xi),a=n==xi&&r==tf||n==xi&&r==rf&&e[7].length<=t[8]||n==(xi|rf)&&t[7].length<=t[8]&&r==tf;if(!(o||a))return e;n&js&&(e[2]=t[2],i|=r&js?0:XO);var s=t[3];if(s){var u=e[3];e[3]=u?Zp(u,s,t[4]):s,e[4]=u?Gi(e[3],ef):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?eh(u,s,t[6]):s,e[6]=u?Gi(e[5],ef):t[6]),s=t[7],s&&(e[7]=s),n&xi&&(e[8]=e[8]==null?t[8]:ZO(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var tx=ex,rx="Expected a function",nf=1,nx=2,Ns=8,Cs=16,Us=32,of=64,af=Math.max;function ix(e,t,r,n,i,o,a,s){var u=t&nx;if(!u&&typeof e!="function")throw new TypeError(rx);var l=n?n.length:0;if(l||(t&=~(Us|of),n=i=void 0),a=a===void 0?a:af(Hc(a),0),s=s===void 0?s:Hc(s),l-=i?i.length:0,t&of){var f=n,d=i;n=i=void 0}var $=u?void 0:rh(e),E=[e,t,r,n,i,f,d,o,a,s];if($&&tx(E,$),e=E[0],t=E[1],r=E[2],n=E[3],i=E[4],s=E[9]=E[9]===void 0?u?0:e.length:af(E[9]-l,0),!s&&t&(Ns|Cs)&&(t&=~(Ns|Cs)),!t||t==nf)var T=hE(e,t,r);else t==Ns||t==Cs?T=HO(e,t,s):(t==Us||t==(nf|Us))&&!i.length?T=QO(e,t,r,n):T=ch.apply(void 0,E);var B=$?Xp:oh;return sh(B(T,E),e,t)}var ox=ix;function ax(e,t,r){t=="__proto__"&&_a?_a(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var sx=ax;function ux(e,t){return e===t||e!==e&&t!==t}var Sl=ux,lx=Object.prototype,cx=lx.hasOwnProperty;function fx(e,t,r){var n=e[t];(!(cx.call(e,t)&&Sl(n,r))||r===void 0&&!(t in e))&&sx(e,t,r)}var dx=fx,sf=Math.max;function px(e,t,r){return t=sf(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=sf(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),Tl(e,this,s)}}var fh=px;function hx(e,t){return xl(fh(e,t,os),e+"")}var dh=hx,yx=9007199254740991;function gx(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=yx}var Il=gx;function mx(e){return e!=null&&Il(e.length)&&!Yp(e)}var ph=mx,bx=Object.prototype;function vx(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||bx;return e===r}var wx=vx;function _x(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var Tx=_x,Ex="[object Arguments]";function Ox(e){return qr(e)&&pi(e)==Ex}var uf=Ox,hh=Object.prototype,xx=hh.hasOwnProperty,Ax=hh.propertyIsEnumerable,Sx=uf(function(){return arguments}())?uf:function(e){return qr(e)&&xx.call(e,"callee")&&!Ax.call(e,"callee")},$l=Sx;function Ix(){return!1}var $x=Ix,yh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lf=yh&&typeof module=="object"&&module&&!module.nodeType&&module,kx=lf&&lf.exports===yh,cf=kx?Et.Buffer:void 0,jx=cf?cf.isBuffer:void 0,Nx=jx||$x,fu=Nx,Cx="[object Arguments]",Ux="[object Array]",Px="[object Boolean]",Rx="[object Date]",Mx="[object Error]",Dx="[object Function]",Lx="[object Map]",Bx="[object Number]",Vx="[object Object]",Fx="[object RegExp]",zx="[object Set]",qx="[object String]",Kx="[object WeakMap]",Gx="[object ArrayBuffer]",Hx="[object DataView]",Wx="[object Float32Array]",Jx="[object Float64Array]",Qx="[object Int8Array]",Yx="[object Int16Array]",Xx="[object Int32Array]",Zx="[object Uint8Array]",eA="[object Uint8ClampedArray]",tA="[object Uint16Array]",rA="[object Uint32Array]",De={};De[Wx]=De[Jx]=De[Qx]=De[Yx]=De[Xx]=De[Zx]=De[eA]=De[tA]=De[rA]=!0;De[Cx]=De[Ux]=De[Gx]=De[Px]=De[Hx]=De[Rx]=De[Mx]=De[Dx]=De[Lx]=De[Bx]=De[Vx]=De[Fx]=De[zx]=De[qx]=De[Kx]=!1;function nA(e){return qr(e)&&Il(e.length)&&!!De[pi(e)]}var iA=nA;function oA(e){return function(t){return e(t)}}var gh=oA,mh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pi=mh&&typeof module=="object"&&module&&!module.nodeType&&module,aA=Pi&&Pi.exports===mh,Ps=aA&&Hp.process,sA=function(){try{var e=Pi&&Pi.require&&Pi.require("util").types;return e||Ps&&Ps.binding&&Ps.binding("util")}catch{}}(),ff=sA,df=ff&&ff.isTypedArray,uA=df?gh(df):iA,bh=uA,lA=Object.prototype,cA=lA.hasOwnProperty;function fA(e,t){var r=Zt(e),n=!r&&$l(e),i=!r&&!n&&fu(e),o=!r&&!n&&!i&&bh(e),a=r||n||i||o,s=a?Tx(e.length,String):[],u=s.length;for(var l in e)(t||cA.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||as(l,u)))&&s.push(l);return s}var dA=fA;function pA(e,t){return function(r){return e(t(r))}}var hA=pA,yA=hA(Object.keys,Object),gA=yA,mA=Object.prototype,bA=mA.hasOwnProperty;function vA(e){if(!wx(e))return gA(e);var t=[];for(var r in Object(e))bA.call(e,r)&&r!="constructor"&&t.push(r);return t}var wA=vA;function _A(e){return ph(e)?dA(e):wA(e)}var vh=_A,TA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,EA=/^\w*$/;function OA(e,t){if(Zt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Fn(e)?!0:EA.test(e)||!TA.test(e)||t!=null&&e in Object(t)}var kl=OA,xA=$n(Object,"create"),Hi=xA;function AA(){this.__data__=Hi?Hi(null):{},this.size=0}var SA=AA;function IA(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var $A=IA,kA="__lodash_hash_undefined__",jA=Object.prototype,NA=jA.hasOwnProperty;function CA(e){var t=this.__data__;if(Hi){var r=t[e];return r===kA?void 0:r}return NA.call(t,e)?t[e]:void 0}var UA=CA,PA=Object.prototype,RA=PA.hasOwnProperty;function MA(e){var t=this.__data__;return Hi?t[e]!==void 0:RA.call(t,e)}var DA=MA,LA="__lodash_hash_undefined__";function BA(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Hi&&t===void 0?LA:t,this}var VA=BA;function hi(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])}}hi.prototype.clear=SA;hi.prototype.delete=$A;hi.prototype.get=UA;hi.prototype.has=DA;hi.prototype.set=VA;var pf=hi;function FA(){this.__data__=[],this.size=0}var zA=FA;function qA(e,t){for(var r=e.length;r--;)if(Sl(e[r][0],t))return r;return-1}var ss=qA,KA=Array.prototype,GA=KA.splice;function HA(e){var t=this.__data__,r=ss(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():GA.call(t,r,1),--this.size,!0}var WA=HA;function JA(e){var t=this.__data__,r=ss(t,e);return r<0?void 0:t[r][1]}var QA=JA;function YA(e){return ss(this.__data__,e)>-1}var XA=YA;function ZA(e,t){var r=this.__data__,n=ss(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var eS=ZA;function yi(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])}}yi.prototype.clear=zA;yi.prototype.delete=WA;yi.prototype.get=QA;yi.prototype.has=XA;yi.prototype.set=eS;var us=yi,tS=$n(Et,"Map"),Wi=tS;function rS(){this.size=0,this.__data__={hash:new pf,map:new(Wi||us),string:new pf}}var nS=rS;function iS(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var oS=iS;function aS(e,t){var r=e.__data__;return oS(t)?r[typeof t=="string"?"string":"hash"]:r.map}var ls=aS;function sS(e){var t=ls(this,e).delete(e);return this.size-=t?1:0,t}var uS=sS;function lS(e){return ls(this,e).get(e)}var cS=lS;function fS(e){return ls(this,e).has(e)}var dS=fS;function pS(e,t){var r=ls(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var hS=pS;function gi(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])}}gi.prototype.clear=nS;gi.prototype.delete=uS;gi.prototype.get=cS;gi.prototype.has=dS;gi.prototype.set=hS;var cs=gi,yS="Expected a function";function jl(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(yS);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(jl.Cache||cs),r}jl.Cache=cs;var gS=jl,mS=500;function bS(e){var t=gS(e,function(n){return r.size===mS&&r.clear(),n}),r=t.cache;return t}var vS=bS,wS=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_S=/\\(\\)?/g,TS=vS(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(wS,function(r,n,i,o){t.push(i?o.replace(_S,"$1"):n||r)}),t}),ES=TS;function OS(e){return e==null?"":v2(e)}var xS=OS;function AS(e,t){return Zt(e)?e:kl(e,t)?[e]:ES(xS(e))}var fs=AS,SS=1/0;function IS(e){if(typeof e=="string"||Fn(e))return e;var t=e+"";return t=="0"&&1/e==-SS?"-0":t}var mo=IS;function $S(e,t){t=fs(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[mo(t[r++])];return r&&r==n?e:void 0}var Nl=$S;function kS(e,t,r){var n=e==null?void 0:Nl(e,t);return n===void 0?r:n}var jS=kS;function NS(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var wh=NS,hf=sr?sr.isConcatSpreadable:void 0;function CS(e){return Zt(e)||$l(e)||!!(hf&&e&&e[hf])}var US=CS;function _h(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=US),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?_h(s,t-1,r,n,i):wh(i,s):n||(i[i.length]=s)}return i}var PS=_h;function RS(e){var t=e==null?0:e.length;return t?PS(e,1):[]}var MS=RS;function DS(e){return xl(fh(e,void 0,MS),e+"")}var LS=DS;function BS(){this.__data__=new us,this.size=0}var VS=BS;function FS(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var zS=FS;function qS(e){return this.__data__.get(e)}var KS=qS;function GS(e){return this.__data__.has(e)}var HS=GS,WS=200;function JS(e,t){var r=this.__data__;if(r instanceof us){var n=r.__data__;if(!Wi||n.length<WS-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new cs(n)}return r.set(e,t),this.size=r.size,this}var QS=JS;function mi(e){var t=this.__data__=new us(e);this.size=t.size}mi.prototype.clear=VS;mi.prototype.delete=zS;mi.prototype.get=KS;mi.prototype.has=HS;mi.prototype.set=QS;var Do=mi;function YS(e,t){for(var r=-1,n=e==null?0:e.length,i=0,o=[];++r<n;){var a=e[r];t(a,r,e)&&(o[i++]=a)}return o}var XS=YS;function ZS(){return[]}var eI=ZS,tI=Object.prototype,rI=tI.propertyIsEnumerable,yf=Object.getOwnPropertySymbols,nI=yf?function(e){return e==null?[]:(e=Object(e),XS(yf(e),function(t){return rI.call(e,t)}))}:eI,iI=nI;function oI(e,t,r){var n=t(e);return Zt(e)?n:wh(n,r(e))}var aI=oI;function sI(e){return aI(e,vh,iI)}var gf=sI,uI=$n(Et,"DataView"),du=uI,lI=$n(Et,"Promise"),pu=lI,cI=$n(Et,"Set"),Dn=cI,mf="[object Map]",fI="[object Object]",bf="[object Promise]",vf="[object Set]",wf="[object WeakMap]",_f="[object DataView]",dI=In(du),pI=In(Wi),hI=In(pu),yI=In(Dn),gI=In(qi),rn=pi;(du&&rn(new du(new ArrayBuffer(1)))!=_f||Wi&&rn(new Wi)!=mf||pu&&rn(pu.resolve())!=bf||Dn&&rn(new Dn)!=vf||qi&&rn(new qi)!=wf)&&(rn=function(e){var t=pi(e),r=t==fI?e.constructor:void 0,n=r?In(r):"";if(n)switch(n){case dI:return _f;case pI:return mf;case hI:return bf;case yI:return vf;case gI:return wf}return t});var Tf=rn,mI=Et.Uint8Array,Ef=mI,bI="__lodash_hash_undefined__";function vI(e){return this.__data__.set(e,bI),this}var wI=vI;function _I(e){return this.__data__.has(e)}var TI=_I;function Ta(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new cs;++t<r;)this.add(e[t])}Ta.prototype.add=Ta.prototype.push=wI;Ta.prototype.has=TI;var Th=Ta;function EI(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 OI=EI;function xI(e,t){return e.has(t)}var Eh=xI,AI=1,SI=2;function II(e,t,r,n,i,o){var a=r&AI,s=e.length,u=t.length;if(s!=u&&!(a&&u>s))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var d=-1,$=!0,E=r&SI?new Th:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var T=e[d],B=t[d];if(n)var W=a?n(B,T,d,t,e,o):n(T,B,d,e,t,o);if(W!==void 0){if(W)continue;$=!1;break}if(E){if(!OI(t,function(M,k){if(!Eh(E,k)&&(T===M||i(T,M,r,n,o)))return E.push(k)})){$=!1;break}}else if(!(T===B||i(T,B,r,n,o))){$=!1;break}}return o.delete(e),o.delete(t),$}var Oh=II;function $I(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var kI=$I;function jI(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var xh=jI,NI=1,CI=2,UI="[object Boolean]",PI="[object Date]",RI="[object Error]",MI="[object Map]",DI="[object Number]",LI="[object RegExp]",BI="[object Set]",VI="[object String]",FI="[object Symbol]",zI="[object ArrayBuffer]",qI="[object DataView]",Of=sr?sr.prototype:void 0,Rs=Of?Of.valueOf:void 0;function KI(e,t,r,n,i,o,a){switch(r){case qI:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case zI:return!(e.byteLength!=t.byteLength||!o(new Ef(e),new Ef(t)));case UI:case PI:case DI:return Sl(+e,+t);case RI:return e.name==t.name&&e.message==t.message;case LI:case VI:return e==t+"";case MI:var s=kI;case BI:var u=n&NI;if(s||(s=xh),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=CI,a.set(e,t);var f=Oh(s(e),s(t),n,i,o,a);return a.delete(e),f;case FI:if(Rs)return Rs.call(e)==Rs.call(t)}return!1}var GI=KI,HI=1,WI=Object.prototype,JI=WI.hasOwnProperty;function QI(e,t,r,n,i,o){var a=r&HI,s=gf(e),u=s.length,l=gf(t),f=l.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var $=s[d];if(!(a?$ in t:JI.call(t,$)))return!1}var E=o.get(e),T=o.get(t);if(E&&T)return E==t&&T==e;var B=!0;o.set(e,t),o.set(t,e);for(var W=a;++d<u;){$=s[d];var M=e[$],k=t[$];if(n)var F=a?n(k,M,$,t,e,o):n(M,k,$,e,t,o);if(!(F===void 0?M===k||i(M,k,r,n,o):F)){B=!1;break}W||(W=$=="constructor")}if(B&&!W){var K=e.constructor,D=t.constructor;K!=D&&"constructor"in e&&"constructor"in t&&!(typeof K=="function"&&K instanceof K&&typeof D=="function"&&D instanceof D)&&(B=!1)}return o.delete(e),o.delete(t),B}var YI=QI,XI=1,xf="[object Arguments]",Af="[object Array]",So="[object Object]",ZI=Object.prototype,Sf=ZI.hasOwnProperty;function e$(e,t,r,n,i,o){var a=Zt(e),s=Zt(t),u=a?Af:Tf(e),l=s?Af:Tf(t);u=u==xf?So:u,l=l==xf?So:l;var f=u==So,d=l==So,$=u==l;if($&&fu(e)){if(!fu(t))return!1;a=!0,f=!1}if($&&!f)return o||(o=new Do),a||bh(e)?Oh(e,t,r,n,i,o):GI(e,t,u,r,n,i,o);if(!(r&XI)){var E=f&&Sf.call(e,"__wrapped__"),T=d&&Sf.call(t,"__wrapped__");if(E||T){var B=E?e.value():e,W=T?t.value():t;return o||(o=new Do),i(B,W,r,n,o)}}return $?(o||(o=new Do),YI(e,t,r,n,i,o)):!1}var t$=e$;function Ah(e,t,r,n,i){return e===t?!0:e==null||t==null||!qr(e)&&!qr(t)?e!==e&&t!==t:t$(e,t,r,n,Ah,i)}var Sh=Ah,r$=1,n$=2;function i$(e,t,r,n){var i=r.length,o=i,a=!n;if(e==null)return!o;for(e=Object(e);i--;){var s=r[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=r[i];var u=s[0],l=e[u],f=s[1];if(a&&s[2]){if(l===void 0&&!(u in e))return!1}else{var d=new Do;if(n)var $=n(l,f,u,e,t,d);if(!($===void 0?Sh(f,l,r$|n$,n,d):$))return!1}}return!0}var o$=i$;function a$(e){return e===e&&!wr(e)}var Ih=a$;function s$(e){for(var t=vh(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Ih(i)]}return t}var u$=s$;function l$(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var $h=l$;function c$(e){var t=u$(e);return t.length==1&&t[0][2]?$h(t[0][0],t[0][1]):function(r){return r===e||o$(r,e,t)}}var f$=c$;function d$(e,t){return e!=null&&t in Object(e)}var p$=d$;function h$(e,t,r){t=fs(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=mo(t[n]);if(!(o=e!=null&&r(e,a)))break;e=e[a]}return o||++n!=i?o:(i=e==null?0:e.length,!!i&&Il(i)&&as(a,i)&&(Zt(e)||$l(e)))}var y$=h$;function g$(e,t){return e!=null&&y$(e,t,p$)}var kh=g$,m$=1,b$=2;function v$(e,t){return kl(e)&&Ih(t)?$h(mo(e),t):function(r){var n=jS(r,e);return n===void 0&&n===t?kh(r,e):Sh(t,n,m$|b$)}}var w$=v$;function _$(e){return function(t){return t?.[e]}}var T$=_$;function E$(e){return function(t){return Nl(t,e)}}var O$=E$;function x$(e){return kl(e)?T$(mo(e)):O$(e)}var A$=x$;function S$(e){return typeof e=="function"?e:e==null?os:typeof e=="object"?Zt(e)?w$(e[0],e[1]):f$(e):A$(e)}var I$=S$;function $$(e){return qr(e)&&ph(e)}var k$=$$;function j$(e,t,r){for(var n=-1,i=e==null?0:e.length;++n<i;)if(r(t,e[n]))return!0;return!1}var N$=j$,C$=200;function U$(e,t,r,n){var i=-1,o=ah,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;r&&(t=Jp(t,gh(r))),n?(o=N$,a=!1):t.length>=C$&&(o=Eh,a=!1,t=new Th(t));e:for(;++i<s;){var f=e[i],d=r==null?f:r(f);if(f=n||f!==0?f:0,a&&d===d){for(var $=l;$--;)if(t[$]===d)continue e;u.push(f)}else o(t,d,n)||u.push(f)}return u}var P$=U$;function R$(e,t,r,n){if(!wr(e))return e;t=fs(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=mo(t[i]),l=r;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=a){var f=s[u];l=n?n(f,u,s):void 0,l===void 0&&(l=wr(f)?f:as(t[i+1])?[]:{})}dx(s,u,l),s=s[u]}return e}var M$=R$;function D$(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=Nl(e,a);r(s,a)&&M$(o,fs(a,e),s)}return o}var L$=D$,B$=32,Cl=dh(function(e,t){var r=Gi(t,Al(Cl));return ox(e,B$,void 0,t,r)});Cl.placeholder={};var V$=Cl;function F$(e,t){return L$(e,t,function(r,n){return kh(e,n)})}var z$=F$,q$=LS(function(e,t){return e==null?{}:z$(e,t)}),If=q$,K$=4294967295,G$=K$-1,H$=Math.floor,W$=Math.min;function J$(e,t,r,n){var i=0,o=e==null?0:e.length;if(o===0)return 0;t=r(t);for(var a=t!==t,s=t===null,u=Fn(t),l=t===void 0;i<o;){var f=H$((i+o)/2),d=r(e[f]),$=d!==void 0,E=d===null,T=d===d,B=Fn(d);if(a)var W=n||T;else l?W=T&&(n||$):s?W=T&&$&&(n||!E):u?W=T&&$&&!E&&(n||!B):E||B?W=!1:W=n?d<=t:d<t;W?i=f+1:o=f}return W$(o,G$)}var Q$=J$;function Y$(e,t,r){return Q$(e,t,I$(r,2))}var X$=Y$,Z$=1/0,TC=Dn&&1/xh(new Dn([,-0]))[1]==Z$?function(e){return new Dn(e)}:th,ek=dh(function(e,t){return k$(e)?P$(e,t):[]}),$f=ek,jh=xr(qT(),1),EC=jh.default.configure,Ji=jh.default,Ms=100,{WARN:tk,LOG:OC,DEBUG:Xe,VERBOSE:Ee,ERROR:xC}=Ae.setup(Ae.INFO),Ea=Be.set();mT({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var We=({caller:e,thread:t,pattern:r,args:n})=>Le(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:Ji(n)}}`:""}`));function rk(e,t){return Le(()=>Je.structural(e.get(),t.get()))}function bo(e,t){return Je.shallow(e.applogs,t.applogs)}function Ul(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(Ee.isEnabled&&Ee("queryNodesComparer",r,n,i),!Je.structural(n.variables,i.variables))return Ee.isEnabled&&Ee("[queryNodesComparer] changed vars:",r,n,i),!1;if(!bo(n.logsOfThisNode,i.logsOfThisNode))return Ee.isEnabled&&Ee("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Ee.isEnabled&&Ee("[queryNodesComparer] equal:",{a:e,b:t}),!0}var nk=0;function Ht(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++nk}{${t}}`;Ee.isEnabled&&Ee(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Nh(e,s=>{i?Le(()=>(r??Je.structural)(i,s))?Xe.isEnabled&&Xe(`[${n}] update skipped`,{updatedItems:s,observableArr:i}):(i.replace(s),Xe.isEnabled&&Xe(`[${n}] updated`,{updatedItems:s,observableArr:i})):i=Be.array(s,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var a=Xt(i);Xe(`[${n}] deps`,{disposeAutorun:o,rootsAtom:a,observableArr:i,observers:da(i)}),Fi(()=>Ea.add(a))}return Ee.isEnabled&&ts(i,()=>{Ee(`[${n}] observed`,da(i),{rootsAtom:a,observableArr:i})}),ui(i,()=>{Ee.isEnabled&&Ee(`[${n}] dispose`),a&&Fi(()=>Ea.delete(a)),o()}),i}var ik=0;function ok(e,{name:t}={}){let r=`observableSetMap@${++ik}{${t}}`;Ee.isEnabled&&Ee(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Nh(e,a=>{if(!n)n=Be.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=Le(()=>{let l=new Set(n.values()),f=new Set;for(let d of a)n.has(d)?(Ee.isEnabled&&Ee(`[${r}] unchanged`,d,{updatedItems:a,observableSet:n}),l.delete(d)):f.add(d);return Xe.isEnabled&&Xe(`[${r}] updated:`,{unseen:l,added:f,updatedItems:a,observableSet:n}),{added:f,deleted:l}});for(let l of s)n.delete(l);for(let l of u)n.add(l)}},{name:r});if(r.includes("useRoots")){var o=Xt(n);Xe.isEnabled&&Xe(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:da(n)}),Fi(()=>Ea.add(o))}return Ee.isEnabled&&ts(n,()=>{Ee(`[${r}] observed`,da(n),{rootsAtom:o,observableSet:n})}),ui(n,()=>{Ee.isEnabled&&Ee(`[${r}] dispose`),o&&Fi(()=>Ea.delete(o)),i()}),n}function Nh(e,t=null,{name:r}={}){Xe.isEnabled&&Xe("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new ar(n,function(...s){Xe.isEnabled&&Xe(`[${n}] reaction.invalidate`,s),a()});function a(){o.track(function(){let s=Ms&&performance.now();Xe.isEnabled&&Xe(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),Xe.isEnabled&&Xe(`[${n}] runAndTrack =>`,i),Fi(()=>{t?.(i)}),Ms&&performance.now()-s>Ms&&tk(`[${n}] took ${performance.now()-s}ms`)})}return a(),Xe.isEnabled&&Xe(`[${n}] deps of reaction`,{reaction:o,result:i,deps:rs(o)}),()=>{Ee.isEnabled&&Ee(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function tt(e,t,r=!1){if(un(t))throw new Error("computedFnDeepCompare shouldn't be used on actions");let n=!1,i=0,o=typeof r=="boolean"?{keepAlive:r}:r,a=new Map;return function(...s){let u,l=Le(()=>{let E=s;for(let T=0;T<s.length;T++)s[T]instanceof zn&&s===E&&(E=s.slice());return E}),f=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...s)}}`:""}`;for(let[E,T]of a.entries())if(sk(E,l)){u=T;break}else if(Ee.isEnabled)for(let B=0;B<E.length;B++)E[B]instanceof zn&&E[B].name===s[B].name&&Je.structural($f(E,E[B]),$f(l,l[B]))&&Ee.force(`[${f}] threadState mismatch => cachebust`,{diffFields:Object.keys(E[B]).filter(W=>!Je.structural(E[B][W],s[B][W])),cacheArg:E[B],freshArg:s[B]});if(u){let E=u.get();return Ee.isEnabled&&Ee(`[${f}] cache hit`,{untrackedArgs:l,cachedResult:E}),E}if(!o.keepAlive&&!K_())return!n&&Q_().computedRequiresReaction&&(console.warn("invoking a computedFn from outside an reactive context won't be memoized, unless keepAlive is set"),n=!0),t.apply(this,s);Ee.isEnabled&&Ee(`[${f}] new computation`,{untrackedArgs:l});let d,$=He(()=>(Ee.isEnabled&&Ee(`[${f}] update->rerun`,Le(()=>({args:s})),t),Ee.isEnabled&&Cp(),d=t.apply(this,s)),{...o,name:f});if(Ee.isEnabled&&Ee(`[${f}] deps`,rs($),{untrackedArgs:l}),a.set(l,$),!o.keepAlive){let E=ui($,()=>{Ee.isEnabled&&Ee(`[${f}] dispose`,$),E(),a.delete(l),o.onCleanup&&o.onCleanup(d,...s),d=void 0})}return $.get()}}function ak(e){let t=0,r="",n=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("?r+=o+`
|
|
57
|
+
`+" ".repeat(++t):o===")"?r+=`
|
|
58
|
+
`+" ".repeat(--t)+o:o===","&&n===0?r+=o+`
|
|
59
|
+
`+" ".repeat(t):o==="{"&&n===0?(n++,r+=o+`
|
|
60
|
+
`+" ".repeat(t+1)):o==="}"&&n===1?(n--,r+=`
|
|
61
|
+
`+" ".repeat(t)+o):o==="{"&&n>0?(n++,r+=o):(o==="}"&&n>1&&n--,r+=o)}return r}function sk(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]instanceof zn){if(t[r]!==e[r])return!1}else if(!Je.structural(e[r],t[r]))return!1;return!0}var{WARN:kf,LOG:AC,DEBUG:uk,VERBOSE:SC,ERROR:en}=Ae.setup(Ae.INFO,{prefix:"[thread]"});function Kr(e){return e.init!==void 0}var zn=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:ea(t),this.filters=r,Le(()=>this.parents?.length===0)&&kf("[Thread] empty parents array",e),i.skipObservable||li(this,{applogsCids:He,applogsByCid:He,insert:Ct,size:He,isEmpty:He,firstLog:He,latestLog:He},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw en("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw en("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw en("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw en("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw en("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw en("[Thread] insertRaw() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insertRaw(e)}subscribe(e){return this._subscribers.push(e),this.unsubscribe.bind(this,e)}unsubscribe(e){let t=this._subscribers.indexOf(e);t!==-1?this._subscribers.splice(t,1):kf("unsubscribe called for non-existent",e)}notifySubscribers(e){uk(`[thread: ${this.name}] notifying`,this._subscribers.length,"subscribers of",{...e,subs:this._subscribers});for(let t of this._subscribers)t(e)}get applogs(){return this._applogs}get applogsCids(){return this._applogs.map(e=>e.cid)}map(e){return this.applogs.map(e)}get findLast(){return this.applogs.findLast.bind(this.applogs)}get findFirst(){return this.applogs.find.bind(this.applogs)}get firstLog(){return this.applogs[0]}get latestLog(){return this.applogs[this.applogs.length-1]}hasApplog(e,t){if(t)return this.applogs.includes(e);if(!e.cid)throw en("[hasApplogs] applog without CID:",e);return this.hasApplogCid(e.cid)}hasApplogCid(e){return this.applogsCids.includes(e.toString())}get applogsByCid(){return new Map(this.applogs.map(e=>[e.cid,e]))}getApplog(e){return this.applogsByCid.get(e.toString())}hasApplogWithDiffTs(e){return this.applogs.find(t=>t.en===e.en&&t.at===e.at&&t.vl===e.vl&&t.ag===e.ag)}get isEmpty(){return this.size===0}get size(){return this.applogs.length}get length(){return this.applogs.length}get untrackedSize(){return Le(()=>this.size)}get nameAndSizeUntracked(){return Le(()=>`${this.name} (${this.size})`)}get prettyName(){return ak(this.name)}get hasParents(){return!!this.parents?.length}},lk=class Ch extends zn{static fromArray(t,r){return new Ch(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},ck={};ei(ck,{code:()=>Ph,decode:()=>Rl,encode:()=>Pl,format:()=>jf,name:()=>Ek,parse:()=>xk,stringify:()=>jf});var fk=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(I.equals(t.type,I.array)&&(t.elements++,t.elements!==1&&e.push([44])),I.equals(t.type,I.map)&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[I.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)}[I.negint.major](e,t){this[I.uint.major](e,t)}[I.bytes.major](e,t){throw new Error(`${on} unsupported type: Uint8Array`)}[I.string.major](e,t){this.prefix(e);let r=kd(JSON.stringify(t.value));e.push(r.length>32?La(r):r)}[I.array.major](e,t){this.prefix(e),this.inRecursive.push({type:I.array,elements:0}),e.push([91])}[I.map.major](e,t){this.prefix(e),this.inRecursive.push({type:I.map,elements:0}),e.push([123])}[I.tag.major](e,t){}[I.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(I.equals(o.type,I.array))e.push([93]);else if(I.equals(o.type,I.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(`${on} 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 o=0;o<r.length;o++)n[o]=r.charCodeAt(o),!i&&(n[o]===46||n[o]===101||n[o]===69)&&(i=!0);i||(n.push(46),n.push(48)),e.push(n)}};function dk(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${on} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==I.string||n.type!==I.string)throw new Error(`${on} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${on} unexpected duplicate map keys, this is not supported`)}var pk={addBreakTokens:!0,mapSorter:dk};function hk(e,t){return t=Object.assign({},pk,t),Kd(e,new fk,t)}var Uh=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(`${be} 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(`${be} unexpected token at position ${this._pos}, expected to find '${String.fromCharCode(...e)}'`)}parseNumber(){let e=this._pos,t=!1,r=!1,n=a=>{for(;!this.done();){let s=this.ch();if(a.includes(s))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 ne(I.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(`${be} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${be} 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)),o=parseFloat(i);return r?new ne(I.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ne(o>=0?I.uint:I.negint,o,this._pos-e):new ne(o>=0?I.uint:I.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${be} unexpected character at position ${this._pos}; this shouldn't happen`);this._pos++;for(let i=this._pos,o=0;i<this.data.length&&o<65536;i++,o++){let a=this.data[i];if(a===92||a<32||a>=128)break;if(a===34){let s=String.fromCharCode.apply(null,this.data.subarray(this._pos,i));return this._pos=i+1,new ne(I.string,s,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${be} unexpected end of unicode escape sequence at position ${this._pos}`);let i=0;for(let o=0;o<4;o++){let a=this.ch();if(a>=48&&a<=57)a-=48;else if(a>=97&&a<=102)a=a-97+10;else if(a>=65&&a<=70)a=a-65+10;else throw new Error(`${be} unexpected unicode escape character at position ${this._pos}`);i=i*16+a,this._pos++}return i},n=()=>{let i=this.ch(),o=null,a=i>239?4:i>223?3:i>191?2:1;if(this._pos+a>this.data.length)throw new Error(`${be} unexpected unicode sequence at position ${this._pos}`);let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=this.data[this._pos+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=this.data[this._pos+1],u=this.data[this._pos+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=this.data[this._pos+1],u=this.data[this._pos+2],l=this.data[this._pos+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}o===null?(o=65533,a=1):o>65535&&(o-=65536,t.push(o>>>10&1023|55296),o=56320|o&1023),t.push(o),this._pos+=a};for(;!this.done();){let i=this.ch(),o;switch(i){case 92:if(this._pos++,this.done())throw new Error(`${be} unexpected string termination at position ${this._pos}`);switch(o=this.ch(),this._pos++,o){case 34:case 39:case 92:case 47:t.push(o);break;case 98:t.push(8);break;case 116:t.push(9);break;case 110:t.push(10);break;case 102:t.push(12);break;case 114:t.push(13);break;case 117:t.push(r());break;default:throw new Error(`${be} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ne(I.string,l0(t),this._pos-e);default:if(i<32)throw new Error(`${be} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${be} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ne(I.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ne(I.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ne(I.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ne(I.false,!1,5);case 116:return this.expect([116,114,117,101]),new ne(I.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(`${be} 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 ne(I.break,void 0,1);if(this.ch()!==44)throw new Error(`${be} 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 ne(I.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 ne(I.break,void 0,1);if(this.ch()!==44)throw new Error(`${be} 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 ne(I.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${be} 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(`${be} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function yk(e,t){return t=Object.assign({tokenizer:new Uh(e,t)},t),hw(e,t)}function gk(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function mk(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=qa.asCID(e);if(!t)return null;let r=t.toString();return[new ne(I.map,1/0,1),new ne(I.string,"/",1),new ne(I.string,r,r.length),new ne(I.break,void 0,1)]}function Oa(e){let t=ul.encode(e).slice(1);return[new ne(I.map,1/0,1),new ne(I.string,"/",1),new ne(I.map,1/0,1),new ne(I.string,"bytes",5),new ne(I.string,t,t.length),new ne(I.break,void 0,1),new ne(I.break,void 0,1)]}function Ft(e){return Oa(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function bk(e){return Oa(new Uint8Array(e))}function vk(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function wk(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 _k={typeEncoders:{Object:mk,Buffer:Oa,Uint8Array:Oa,Int8Array:Ft,Uint16Array:Ft,Int16Array:Ft,Uint32Array:Ft,Int32Array:Ft,Float32Array:Ft,Float64Array:Ft,Uint8ClampedArray:Ft,BigInt64Array:Ft,BigUint64Array:Ft,DataView:Ft,ArrayBuffer:bk,undefined:vk,number:wk}},Tk=class extends Uh{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===I.map){let t=this._next();if(t.type===I.string&&t.value==="/"){let r=this._next();if(r.type===I.string){if(this._next().type!==I.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new ne(I.tag,42,0)}if(r.type===I.map){let n=this._next();if(n.type===I.string&&n.value==="bytes"){let i=this._next();if(i.type===I.string){for(let a=0;a<2;a++)if(this._next().type!==I.break)throw new Error("Invalid encoded Bytes form");let o=ul.decode(`m${i.value}`);return new ne(I.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},hu={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};hu.tags[42]=qa.parse;var Ek="dag-json",Ph=297,Pl=e=>hk(e,_k),Rl=e=>{let t=gk(e),r=Object.assign(hu,{tokenizer:new Tk(t,hu)});return yk(t,r)},jf=e=>Ok.decode(Pl(e)),Ok=new TextDecoder,xk=e=>Rl(Ak.encode(e)),Ak=new TextEncoder,Lo=Ar({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),IC=Ar({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),$C=Ar({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),kC=Ar({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),jC=Ar({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),NC=Ar({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),CC=Ar({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),UC=Ar({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),PC=Ar({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Rr=Ka({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),RC=Ka({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Rh={};ei(Rh,{Digest:()=>ds,create:()=>Ml,decode:()=>Dh,equals:()=>Lh,hasCode:()=>Kk});var Sk=Mh,Nf=128,Ik=127,$k=~Ik,kk=Math.pow(2,31);function Mh(e,t,r){t=t||[],r=r||0;for(var n=r;e>=kk;)t[r++]=e&255|Nf,e/=128;for(;e&$k;)t[r++]=e&255|Nf,e>>>=7;return t[r]=e|0,Mh.bytes=r-n+1,t}var jk=yu,Nk=128,Cf=127;function yu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw yu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Cf)<<i:(a&Cf)*Math.pow(2,i),i+=7}while(a>=Nk);return yu.bytes=o-n,r}var Ck=Math.pow(2,7),Uk=Math.pow(2,14),Pk=Math.pow(2,21),Rk=Math.pow(2,28),Mk=Math.pow(2,35),Dk=Math.pow(2,42),Lk=Math.pow(2,49),Bk=Math.pow(2,56),Vk=Math.pow(2,63),Fk=function(e){return e<Ck?1:e<Uk?2:e<Pk?3:e<Rk?4:e<Mk?5:e<Dk?6:e<Lk?7:e<Bk?8:e<Vk?9:10},zk={encode:Sk,decode:jk,encodingLength:Fk},qk=zk,xa=qk;function gu(e,t=0){return[xa.decode(e,t),xa.decode.bytes]}function Aa(e,t,r=0){return xa.encode(e,t,r),t}function Sa(e){return xa.encodingLength(e)}function Ml(e,t){let r=t.byteLength,n=Sa(e),i=n+Sa(r),o=new Uint8Array(i+r);return Aa(e,o,0),Aa(r,o,n),o.set(t,i),new ds(e,r,t,o)}function Dh(e){let t=sl(e),[r,n]=gu(t),[i,o]=gu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new ds(r,i,a,t)}function Lh(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&E1(e.bytes,r.bytes)}}var ds=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Kk(e,t){return e.code===t}function Uf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Hk(r,mu(e),t??Rr.encoder);default:return Wk(r,mu(e),t??Lo.encoder)}}var Pf=new WeakMap;function mu(e){let t=Pf.get(e);if(t==null){let r=new Map;return Pf.set(e,r),r}return t}var or=class ct{code;version;multihash;bytes;"/";constructor(t,r,n,i){this.code=r,this.version=t,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:r}=this;if(t!==Ai)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Jk)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ct.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=Ml(t,r);return ct.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 ct.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&Lh(t.multihash,n.multihash)}toString(t){return Uf(this,t)}toJSON(){return{"/":Uf(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof ct)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new ct(n,i,o,a??Rf(n,i,o.bytes))}else if(r[Qk]===!0){let{version:n,multihash:i,code:o}=r,a=Dh(i);return ct.create(n,o,a)}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!==Ai)throw new Error(`Version 0 CID must use dag-pb (code: ${Ai}) block encoding`);return new ct(t,r,n,n.bytes)}case 1:{let i=Rf(t,r,n.bytes);return new ct(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ct.create(0,Ai,t)}static createV1(t,r){return ct.create(1,t,r)}static decode(t){let[r,n]=ct.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=ct.inspectBytes(t),n=r.size-r.multihashSize,i=sl(t.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),a=new ds(r.multihashCode,r.digestSize,o,i);return[r.version===0?ct.createV0(a):ct.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,$]=gu(t.subarray(r));return r+=$,d},i=n(),o=Ai;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let a=r,s=n(),u=n(),l=r+u,f=l-a;return{version:i,codec:o,multihashCode:s,digestSize:u,multihashSize:f,size:l}}static parse(t,r){let[n,i]=Gk(t,r),o=ct.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return mu(o).set(n,t),o}};function Gk(e,t){switch(e[0]){case"Q":{let r=t??Rr;return[Rr.prefix,r.decode(`${Rr.prefix}${e}`)]}case Rr.prefix:{let r=t??Rr;return[Rr.prefix,r.decode(e)]}case Lo.prefix:{let r=t??Lo;return[Lo.prefix,r.decode(e)]}case Uo.prefix:{let r=t??Uo;return[Uo.prefix,r.decode(e)]}default:{if(t==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function Hk(e,t,r){let{prefix:n}=r;if(n!==Rr.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(i==null){let o=r.encode(e).slice(1);return t.set(n,o),o}else return i}function Wk(e,t,r){let{prefix:n}=r,i=t.get(n);if(i==null){let o=r.encode(e);return t.set(n,o),o}else return i}var Ai=112,Jk=18;function Rf(e,t,r){let n=Sa(e),i=n+Sa(t),o=new Uint8Array(i+r.byteLength);return Aa(e,o,0),Aa(t,o,n),o.set(r,i),o}var Qk=Symbol.for("@ipld/js-cid/CID"),Yk=20;function Bh({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new Xk(e,t,r,n,i)}var Xk=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??Yk,this.maxDigestLength=i}digest(e,t){if(t?.truncate!=null){if(t.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&t.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Mf(r,this.code,t?.truncate):r.then(n=>Mf(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function Mf(e,t,r){if(r!=null&&r!==e.byteLength){if(r>e.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${e.byteLength}`);e=e.subarray(0,r)}return Ml(t,e)}var et=xr(Gr(),1),Vh=xr(JT(),1),Df=e=>et.Type.Union([e,et.Type.Null()]),Fh=/^(k51qz|baguq)[0-9a-z]{56,57}$/,Zk=/^[0-9A-Fa-f]{7,8}$/g;et.FormatRegistry.Set("EntityID",e=>!!e.match(Zk)||!!e.match(Fh));var ej=et.Type.String(),bu=e=>e?.enc instanceof Uint8Array;et.FormatRegistry.Set("CID",e=>!!e.match(Fh));var zh=et.Type.String({format:"CID"}),tj=/^http([s]?):\/\/.*\..*/;et.FormatRegistry.Set("URL",e=>!!e.match(tj));var MC=et.Type.String({format:"URL"}),qh=et.Type.Object({en:ej,at:et.Type.String(),vl:Df(et.Type.Union([et.Type.String(),et.Type.Boolean(),et.Type.Number()])),ts:et.Type.String(),ag:et.Type.String(),pv:Df(zh)}),Lf=Vh.TypeCompiler.Compile(qh),DC=Lf.Check.bind(Lf),rj=et.Type.Composite([et.Type.Object({cid:zh}),qh]),vu=Vh.TypeCompiler.Compile(rj),nj=e=>Array.from(vu.Errors(e)),Kh=vu.Check.bind(vu);function Gh(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var ij=Bh({name:"sha2-256",code:18,encode:Gh("SHA-256")}),LC=Bh({name:"sha2-512",code:19,encode:Gh("SHA-512")}),{WARN:Bf,LOG:BC,DEBUG:oj,VERBOSE:Ia,ERROR:aj}=Ae.setup(Ae.INFO),sj=114;function uj(e,t=["cid"]){if(!e)throw aj("falsy log",e);let r=e.cid;if(bu(e))return r||(r=Dl(Hh(e).bytes).toString()),Bf("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(Bf(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?Ia("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function lj(e){return Dl(cj(e).bytes)}function cj(e){return Hh(uj(e)?.log)}function Dl(e){let t=T1(e),r=Rh.create(ij.code,t),n=or.create(1,Ph,r);return Ia("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function Hh(e){oj("[encodeBlock]",e);let t=Pl(e);return{bytes:t,cid:Dl(t)}}function fj(e){let t=null,r=[];try{t=or.parse(e)}catch(n){Ia("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=or.parse(e,Uo)}catch(n){Ia("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&Ll(t)}}function Ll(e){return e.code===sj}function wu(e){return typeof e=="string"?or.parse(e):typeof e.toV1!="function"?or.decode(e.bytes):e}function Wh(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=wu(e),n=wu(t);return r.toV1().toString()===n.toV1().toString()}function Vf(e){let t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function dj(e,t){let r=Vf(e),n=Vf(t);return+r<+n}var{WARN:pj,LOG:VC,DEBUG:FC,VERBOSE:$a,ERROR:ka}=Ae.setup(Ae.INFO),hj=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Jh=(e,t,r)=>Je.structural(If(t,e),If(r,e)),yj=(e,t,r="asc")=>hj(e.ts,t.ts,r),zC=V$(Jh,["en","at"]);function Qi(e,t="asc"){return e.sort((r,n)=>yj(r,n,t))}var gj=(e,t)=>dj(new Date(e.ts),new Date(t.ts)),mj=()=>{pj("[removeDuplicateAppLogs] mode not set; pass 'safety' or 'cleanup' for optimal behavior")},Ff=e=>{let t=new Map,r=$a.isEnabled;for(let n of e){if(!n)throw ka("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!n.cid)throw ka("applog with missing CID",n),new Error("applog with missing CID");let i=n.cid,o=t.get(i);o?r&&$a("Skipping duplicate applog:",[o,n]):t.set(i,n)}return Array.from(t.values())},bj=e=>{let t=new Set,r=$a.isEnabled,n=r?new Map:null,i=null,o=0;for(let a of e){if(!a)throw ka("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!a.cid)throw ka("applog with missing CID",a),new Error("applog with missing CID");let s=a.cid;t.has(s)?(i||(i=e.slice(0,o)),r&&$a("Skipping duplicate applog:",[n?.get(s),a])):(t.add(s),n&&n.set(s,a),i&&i.push(a)),o++}return i??e},Qh=(e,t)=>t?t==="safety"?bj(e):Ff(e):(mj(),Ff(e));function vj(e){return typeof e=="string"&&e.startsWith("?")}function wj(e){return e.slice(1)}function Yh(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(vj(o)){let a=wj(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function _j(e,t,r){let n;if(t){let i=typeof t;i==="string"?n=t===r:i==="function"?n=t(r):typeof t.has=="function"?n=t.has(r):Array.isArray(t)&&!Array.isArray(r)?n=t.includes(r):n=t===r}else n=t===r;return e.charAt(0)==="!"?!n:n}var Xh=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},zf=function(e){return Xh(e)/e.length},It={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return It.max(e)-It.min(e)},midrange:function(e){return It.range(e)/2},sum:Xh,mean:zf,average:zf,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=It.mean(e);return It.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(It.variance(e))},meanAbsoluteDeviation:function(e){var t=It.mean(e);return It.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=It.mean(e),r=It.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};It.average=It.mean;function Zh(){return new Date().toISOString()}var{WARN:Tj,LOG:qC,DEBUG:Ge,VERBOSE:KC,ERROR:ja}=Ae.setup(Ae.INFO);function Ej(e,t){Ge(`[ensureTsPvAndFinalizeApplogs] ENTER - ${e.length} applogs, thread size=${t.size}`);let r=Zh(),n=t;Ge("[ensureTsPvAndFinalizeApplogs] About to map over applogs");let i=e.map((o,a)=>{Ge(`[ensureTsPvAndFinalizeApplogs] Processing applog ${a+1}/${e.length}`);let s=Oj(o,{ts:r,threadForPv:n});return Ge(`[ensureTsPvAndFinalizeApplogs] Finalized applog ${a+1}/${e.length}`),s});return Ge(`[ensureTsPvAndFinalizeApplogs] EXIT - mapped ${i.length} applogs`),i}function Oj(e,{ts:t,threadForPv:r}={}){Ge(`[finalizeApplogForInsert] ENTER - en=${e.en}, at=${e.at}`),Ge("[finalizeApplogForInsert] About to call withTs");let n=Sj(e,t??Zh());Ge(`[finalizeApplogForInsert] About to call withPvFrom (thread size=${r?.size??"null"})`);let i=Ij(n,r);Ge("[finalizeApplogForInsert] About to call encodeApplogAndGetCid");let o=lj(i).toString();Ge(`[finalizeApplogForInsert] CID created: ${o}`),e.cid&&e.cid!==o&&Tj("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(Ge("[finalizeApplogForInsert] About to validate applog"),!Kh(a))throw ja(`Bogus Applog ${JSON.stringify(a)}`,nj(a));return Ge(`[finalizeApplogForInsert] EXIT - CID=${o}`),Object.freeze(a)}function xj(e){return!!e.ts}function Aj(e){return!!e.pv}function Sj(e,t){return xj(e)?e:{...e,ts:t}}function Ij(e,t){if(Ge(`[withPvFrom] ENTER - en=${e.en}, at=${e.at}, hasPv=${e.pv!==void 0}`),e.pv!==void 0)return Ge("[withPvFrom] EXIT early - pv already set"),e;if(t){let{en:r,at:n}=e;Ge(`[withPvFrom] About to call thread.findLast for en=${r}, at=${n}, thread.size=${t.size}`);let i=t.findLast(a=>a.en==r&&a.at==n);if(Ge(`[withPvFrom] findLast completed, found=${!!i}`),Ge("[withPvFrom] About to check equality"),Jh(["en","at","vl","ts","ag"],e,i))throw ja("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return Ge(`[withPvFrom] EXIT - prevLogCid=${o}`),{...e,pv:o}}else{if(!Aj(e))throw ja("[withPvFrom] no thread and no pv:",e);return Ge("[withPvFrom] EXIT - no thread, returning log with existing pv"),e}}function _u(e){let t=()=>(Le(()=>e.length<2&&Ge(`joinThreads with count=${e.length}`)),Qi(Qh(e.flatMap(i=>{let o=i.applogs;if(!o)throw ja("falsy applogs of thread",i),new Error("falsy applogs of thread");return o}),"cleanup"))),r=Le(()=>t()),n=Ct(function(i,o){return Kr(i)?{init:Le(()=>t())}:{added:i.added.filter(a=>!this.hasApplog(a,!0)),removed:i.removed?.filter(a=>!!this.parents.some(s=>s===o?!1:s.hasApplog(a,!0)))}});return new ps(Le(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:qf,LOG:GC,DEBUG:Kf,VERBOSE:tn,ERROR:Io}=Ae.setup(Ae.INFO),ps=class Tu extends zn{constructor(t,r,n,i,o,a=null,s){super(t,r,n,o?Be.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=a,this._readOnly=s,li(this,{onParentUpdate:Ct}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new Tu(`${r}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,n)}static asReadOnly(t){return t.readOnly?t:new Tu(`readOnly(${t.name})`,t,t.filters,t._applogs,null,null,!0)}_parentSubscriptions=null;insert(t){if(this.readOnly)throw Io("[MappedThread] insert() called on read-only thread:",this.nameAndSizeUntracked);let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insert(r))}insertRaw(t){if(this.readOnly)throw Io("[MappedThread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insertRaw(r))}subscribeToParents(){this._parentSubscriptions=new Map;let t=Mt(()=>{this.parents.length||qf("MappedThread has no parents",this),tn(`[MappedThread: ${this.name}] subscribing to parents:`,this.parents.map(n=>n.name));let r=new Set([...this._parentSubscriptions.keys()]);for(let n of this.parents){r.delete(n)&&tn(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),tn(`[MappedThread: ${this.name}] sub to new parent`,n.nameAndSizeUntracked);let i=this.onParentUpdate.bind(this,n),o=n.subscribe(i);this._parentSubscriptions.set(n,o)}for(let n of r)tn(`[MappedThread: ${this.name}] un-subscribing from old parent`,n.nameAndSizeUntracked),this._parentSubscriptions.get(n)(),this._parentSubscriptions.delete(n)})}subscribe(t){return this._parentSubscriptions||this.subscribeToParents(),super.subscribe(t)}triggerRemap(){if(!this._eventMapper)throw Io("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);Kf(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&qf(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:Le(()=>br(t.applogs))})})}onParentUpdate(t,r){tn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(tn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),Kr(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(X$(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!Kr(r)&&r.removed?.includes(i))Kf("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw Io(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}tn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,rs(this._applogs)),this.notifySubscribers(n)}get readOnly(){return this._readOnly??!1}},{WARN:HC,LOG:WC,DEBUG:JC,VERBOSE:Ds,ERROR:$j}=Ae.setup(Ae.INFO),qn=tt("rollingFilter",function(e,t,r={}){let n=jj(t),i=Gf(n),o=Be.array(Le(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${Ji(n)}}`}`}),a=f=>{let d;return Kr(f)?d={init:i(f.init)}:d={added:i(f.added),removed:f.removed},Ds(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",d),d},s=new ps(`${e.name} | ${r.name||`rollingFilter{${Ji(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=fT(()=>br(t),f=>{Ds(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=Gf(n),s.triggerRemap()}),l=ui(o,()=>{Ds(`rollingFilter<${Le(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:bo,argsDebugName:(e,t,r)=>We({caller:"rollingFilter",thread:e,pattern:t,args:r})}),kj=tt("rollingMapper",function(e,t,r={}){let n=Le(()=>t.call(null,{init:e.applogs},e));if(!Kr(n))throw $j("Initial run must return init event");let i=n.init;return new ps(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:bo,argsDebugName:(e,t,r)=>We({caller:"rollingMapper",thread:e,args:r})}),QC=tt("rollingAcc",function(e,t,r,n={}){let i=Ct(r);return i({init:e.applogs},t),e.subscribe(o=>{i(o,t)}),t},{argsDebugName:(e,t,r,n)=>`rollingAcc{${e.nameAndSizeUntracked}${n?.name?` | ${n?.name}`:""}}`}),jj=function(e){let t=Le(function(){return Object.fromEntries(Object.entries(br(e)).map(([r,n])=>[br(r),br(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function Gf(e){return function(t){return t.filter(function(r){for(let n of Object.keys(e)){let i=e[n];if(i===void 0)continue;let o=r[n.startsWith("!")?n.slice(1):n];if(!_j(n,i,o))return!1}return!0})}}var YC=ps.asReadOnly,{WARN:Nj,LOG:Cj,DEBUG:Ke,VERBOSE:ey,ERROR:Bo}=Ae.setup(Ae.INFO),Uj=class extends zn{constructor(e,t=[],r){super(e,null,r,t),li(this,{})}purge(e){let t=this.applogs.length;return this._applogs=this.applogs.filter(r=>!e.includes(r.cid)),t-this.applogs.length}insert(e){Ke(`[WriteableThread.insert] ENTER - ${e.length} applogs for thread "${this.name}"`),Ke("[WriteableThread.insert] About to call ensureTsPvAndFinalizeApplogs");let t=Ej(e,this);Ke(`[WriteableThread.insert] ensureTsPvAndFinalizeApplogs completed, mapped=${t.length} applogs`),Ke("[WriteableThread.insert] About to call insertRaw");let r=this.insertRaw(t);return Ke("[WriteableThread.insert] insertRaw completed"),r}insertMissing(e,t=!1){let r=e.filter(n=>!this.hasApplog(n,t));return r.length===0?(ey("[insertMissing] no missing applogs"),[]):this.insertRaw(r)??[]}insertRaw(e){Ke(`[WriteableThread.insertRaw] ENTER - ${e.length} applogs for thread "${this.name}"`),Ke("[WriteableThread.insertRaw] About to deduplicate");let t=Qh(e,"safety");if(t.length!==e.length)throw Bo(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});Ke("[WriteableThread.insertRaw] Deduplication done"),Ke("[WriteableThread.insertRaw] About to validate");let r=e.filter(o=>!Kh(o));if(r.length)throw Bo(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});Ke("[WriteableThread.insertRaw] Validation done"),Ke("[WriteableThread.insertRaw] About to check for existing");let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw Bo(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(Ke("[WriteableThread.insertRaw] Existing check done"),!e.length){Nj("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof vo)?Cj:Ke)("Inserting:",e.length===1?e[0]:e,{ds:this}),Ke("[WriteableThread.insertRaw] About to sort applogs"),Qi(e);let i=this._applogs.length&&gj(e[0],this._applogs[this._applogs.length-1]);return Ke("[WriteableThread.insertRaw] About to push to _applogs array"),this._applogs.push(...e),i&&(Ke("[WriteableThread.insertRaw] About to sort _applogs (sortNeeded=true)"),Qi(this._applogs)),Ke("[WriteableThread.insertRaw] About to notify subscribers"),this.notifySubscribers({added:e,removed:null}),Ke("[WriteableThread.insertRaw] Subscribers notified"),Ke("[WriteableThread.insertRaw] About to call persist (void - not awaited)"),this.persist(e),Ke(`[WriteableThread.insertRaw] EXIT - returning ${e.length} applogs`),e}get readOnly(){return!1}},vo=class Vo extends Uj{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,li(this,{_applogs:Be.shallow})}static empty(t){return Vo.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new Vo(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new Vo(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(ey("[InMem.persist] no persist for",t),this.readOnly)throw Bo("[persist] called for readOnly thread")}},{WARN:XC,LOG:ZC,DEBUG:e5,VERBOSE:t5,ERROR:r5}=Ae.setup(Ae.INFO),{WARN:n5,LOG:i5,DEBUG:o5,VERBOSE:a5,ERROR:s5}=Ae.setup(Ae.INFO),Pj=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,li(this,{threadOfTrail:He})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?_u([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},ty=class{constructor(e){this.nodes=e,li(this,{threadOfAllTrails:He,size:He,isEmpty:He})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return Le(()=>this.records.length)}get records(){return Ht(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return _u(Ht(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return Ht(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return Ht(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return _u(Ht(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:u5,LOG:hs,DEBUG:_r,VERBOSE:Se,ERROR:cn}=Ae.setup(Ae.INFO,{prefix:"[q]"}),Ls=null,l5=tt("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(Se(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return _r("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw cn("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=kj(e,function(o,a){let s=Kr(o),u,l=[],f=s?null:[];s?(n=new Map,u=o.init):u=o.added;let d;for(let $=t?0:u.length-1;t?$<u.length:$>=0;t?$++:$--){let E=u[$],T=E.en+"|"+E.at;if(d&&(t?d>E.ts:d<E.ts))throw cn("lastWriteWins.mapper logs not sorted:",d,t?">":"<",E.ts,{log:E,i:$,newLogs:u,inverseToOnlyReturnFirstLogs:t});d=E.ts;let B=n.get(T);(!B||(t?B.ts>E.ts:B.ts<E.ts))&&(B&&!s&&f.push(B),l.push(E),n.set(T,E))}return Qi(l),Se.isDisabled||Se(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([$,E])=>[$,E?.length])),toAdd:l.length,toRemove:f}:{...o,toAdd:l,toRemove:f}),s?{init:l}:{added:l,removed:f}},{name:`lastWriteWins${t?".inversed":""}`,extraFilterName:"lastWriteWins"});return Se.isDisabled||Mt(()=>{Se(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:bo,argsDebugName:e=>We({caller:"lastWriteWins",thread:e})}),c5=tt("withoutDeleted",function(e){if(Se.isEnabled&&Se(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw cn("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=qn(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});Se.isEnabled&&Se(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,Le(function(){return[...t.applogs]}));let r=We({caller:"allDeletedEntities",thread:e}),n=ok(function(){return t.map(i=>i.en)},{name:r});return Se.isEnabled&&Mt(()=>{Se(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),qn(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:bo}),ry=tt("query",function e(t,r,n={},i={}){zj();let o=ny(t);_r(`query<${o.nameAndSizeUntracked}>:`,r);let a=Array.isArray(r)?r:[r],s;if(a.length===1)s=null;else{let f=a.slice(0,-1);s=e(o,f,n,i)}let u=a[a.length-1],l=Rj(o,s,u,i);return Se.isDisabled||Mt(()=>Se("query result:",br(l))),l},{equals:Ul,argsDebugName:(e,t,r)=>We({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),Rj=tt("queryStep",function(e,t,r,n={}){if(_r(`queryStep<${e.nameAndSizeUntracked}> with`,t?.untrackedSize??"all","nodes, pattern:",r),!Object.entries(r).length)throw new Error("Pattern is empty");function i(a){let[s,u]=Yh(r,a?.variables??{});Se("[queryStep.doQuery] patternWithoutVars: ",s);let l=qn(e,s),f=ys(u),d=Ht(function(){let $=l.map(E=>({log:E,vars:f(E)}));return Se.isEnabled&&Se("[queryStep.doQuery] step node:",a?.variables," =>",$,"from:",Le(()=>l.applogs)),$.map(({log:E,vars:T})=>{let B=Object.assign({},a?.variables,T);return new Pj(lk.fromArray([E],We({caller:"QueryNode",thread:l,pattern:`${Ji(B)}@${Ji(s)}`})),B,a)})},{name:We({caller:"doQuery.mapNodes",thread:l,pattern:r})});return Se.isEnabled&&Mt(()=>Se("[queryStep.doQuery] resultNodes:",[...d])),n.debug&&hs("[queryStep] step result:",Le(()=>d.map(({variables:$,logsOfThisNode:E})=>({variables:$,thread:E})))),d}let o=Ht(function(){return _r(`[queryStep] Running with ${t?.nodes?.length} input nodes:`),t?[...t.nodes.flatMap(i)]:[...i(null)]},{name:We({caller:"queryStep",thread:e,pattern:r})});return Se.isEnabled&&Mt(()=>Se("[queryStep] observableResultNodes:",[...o])),new ty(o)},{equals:Ul,argsDebugName:(e,t,r)=>We({caller:"queryStep",thread:e,pattern:r})}),f5=tt("queryNot",function(e,t,r,n={}){let i=t.nodes;_r(`queryNot<${e.nameAndSizeUntracked}> from: ${i.length} nodes`);let o=Array.isArray(r)?r:[r];for(let a of o){if(!Object.entries(r).length)throw new Error("Pattern is empty");i=i.filter(function({variables:s}){let[u,l]=Yh(a,s??{});Se("[queryNot] patternWithoutVars: ",u);let f=qn(e,u);return Se("[queryNot] step node:",s," =>",f.size,"applogs"),Se.isDisabled||Se("[queryNot] step node:",s," => empty?",Le(()=>f.applogs)),n.debug&&hs("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new ty(i)},{equals:Ul,argsDebugName:(e,t,r)=>We({caller:"queryNot",thread:e,pattern:r})}),d5=tt("filterAndMap",function(e,t,r){_r(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=qn(e,t);Se.isEnabled&&(Se("[filterAndMap] filtered:",n.untrackedSize),Mt(()=>Se("[filterAndMap] filtered:",n.applogs)));let i=We({thread:e,pattern:t,caller:"filterAndMap"}),o=Ht(()=>Lj(n,r),{name:i});return Se.isDisabled||Mt(()=>Se("[filterAndMap] mapped:",o)),o},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"filterAndMap",thread:e,pattern:t})}),p5=tt("queryAndMap",function(e,t,r,n={}){let i=ny(e);_r(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=We({thread:i,caller:"queryAndMap"}),a=ry(i,t);Se("[queryAndMap] filtered count:",a.untrackedSize);let s=Ht(()=>Bj(a,r),{name:o});return Se.isDisabled||Mt(()=>Se("[queryAndMap] result:",br(s))),s},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"queryAndMap",thread:e,pattern:t})}),h5=tt("queryEntity",function(e,t,r,n){_r(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=qn(e,{en:r,at:Vj(t,n)});return Se("queryEntity applogs:",i.applogs),He(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:o,vl:a})=>[o.slice(t.length+1),a])))},{equals:rk,argsDebugName:(e,t,r)=>We({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),y5=tt("agentsOfThread",function(e){_r(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Be.map(),r=Ct(i=>{for(let o of Kr(i)?i.init:i.added){let a=t.get(o.ag)??0;t.set(o.ag,a+1)}for(let o of!Kr(i)&&i.removed||[]){let a=t.get(o.ag);if(!a||a<1)throw cn("[agentsOfThread] number is now negative",{log:o,event:i,mapped:t,prev:a});t.set(o.ag,a-1)}hs(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return ts(t,n),t}),Mj=tt("entityOverlap",function(e,t){return hs(`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))})}),g5=tt("entityOverlapCount",function(e,t){return He(()=>Mj(e,t).get().length)}),Dj=tt("querySingle",function(e,t,r={}){let n=ry(e,t,r);return He(()=>{if(n.isEmpty)return null;if(n.size>1)throw cn("[querySingle] got",n.size,"results:",n);let i=n.nodes[0].logsOfThisNode;if(i.size!=1)throw cn("[querySingle] single result, but got",i.size,"logs:",i.applogs);return i.applogs[0]})},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"querySingle",thread:e,pattern:t})}),m5=tt("querySingleAndMap",function(e,t,r,n={}){let i=Dj(e,t,n);return He(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:ys(r)(o)})},{equals:Je.structural,argsDebugName:(e,t)=>We({caller:"querySingleAndMap",thread:e,pattern:t})}),Lj=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map(ys(t))},Bj=function(e,t){return typeof t=="function"?e.records.map(t):typeof t=="string"?e.nodes.map(r=>{if(!Object.hasOwn(r.record,t)){if(r.logsOfThisNode.size!==1)throw cn(`not sure what to map (it's not a var and a result node log count of ${r.logsOfThisNode.size})`);return r.logsOfThisNode.firstLog[t]}return r.record[t]}):e.nodes.map(r=>ys(t)(e))};function ys(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function Vj(e,t){return t.map(r=>Fj(e,r))}function Fj(e,t){return`${e}/${t}`}function ny(e,t){return Array.isArray(e)?vo.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function zj(){if(Ls!=null&&performance.now()>=Ls)throw new qj(Ls)}var qj=class extends Error{constructor(e){super(e)}},Kj=Ze({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/encode.js"(e,t){"use strict";t.exports=a;var r=128,n=127,i=~n,o=Math.pow(2,31);function a(s,u,l){if(Number.MAX_SAFE_INTEGER&&s>Number.MAX_SAFE_INTEGER)throw a.bytes=0,new RangeError("Could not encode varint");u=u||[],l=l||0;for(var f=l;s>=o;)u[l++]=s&255|r,s/=128;for(;s&i;)u[l++]=s&255|r,s>>>=7;return u[l]=s|0,a.bytes=l-f+1,u}}}),Gj=Ze({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(e,t){"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,$=o.length;do{if(f>=$||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}}),Hj=Ze({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(e,t){"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}}),Bl=Ze({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:Kj(),decode:Gj(),encodingLength:Hj()}}}),iy=42;function Wj(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=qa.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new ne(I.tag,iy),new ne(I.bytes,r)]}function Jj(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Qj(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}function Yj(e){for(let t of e.keys())if(typeof t!="string"||t.length===0)throw new Error("Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded");return null}var Hf={float64:!0,typeEncoders:{Map:Yj,Object:Wj,undefined:Jj,number:Qj}},b5={...Hf,typeEncoders:{...Hf.typeEncoders}};function Xj(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return qa.decode(e.subarray(1))}var Eu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Eu.tags[iy]=Xj;var v5={...Eu,tags:Eu.tags.slice()},w5=xr(Bl(),1),Lr={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},ki={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Lr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Lr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=ki["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 o=e[i];if(o=ki["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Lr.Int,CarV1HeaderOrV2Pragma:e=>{if(Lr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=ki["CarV1HeaderOrV2Pragma > roots (anon)"](e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=ki.Int(e[o]);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},ji={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Lr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Lr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=ji["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 o=e[i];if(o=ji["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Lr.Int,CarV1HeaderOrV2Pragma:e=>{if(Lr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=ji["CarV1HeaderOrV2Pragma > roots (anon)"](a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.roots=s}}break;case"version":{n--;let s=ji.Int(a);if(s===void 0)return;if(s!==a||r!==e){if(r===e){r={};for(let u=0;u<i;u++)r[t[u][0]]=t[u][1]}r.version=s}}break;default:return}}if(!(n>0))return r}},_5={toTyped:ki.CarV1HeaderOrV2Pragma,toRepresentation:ji.CarV1HeaderOrV2Pragma},T5=Fd(),E5=xr(Bl(),1),O5=[new ne(I.map,2),new ne(I.string,"version"),new ne(I.uint,1),new ne(I.string,"roots")],x5=new ne(I.tag,42),A5=xr(Bl(),1),{WARN:oy,LOG:S5,DEBUG:Bs,VERBOSE:Vl,ERROR:Cn}=Ae.setup(Ae.INFO);async function Zj(e){let t=await tN(e);return await eN(t)}async function eN({rootCID:e,blockStore:t},r=[],n){if(!e||!t)throw Cn("Empty roots/blocks",{rootCID:e,blockStore:t});let i=[],o=null,a=e,s=new Set,u=null;for(;a;){let f=a.toString();if(s.has(f))throw Cn("[decodePubFromBlocks] pub chain has a loop",{currentCID:f,visited:[...s]});s.add(f);let d=await Pn(t,a);if(Vl("[decodePubFromBlocks] root:",f,d,{blockStore:t}),!d)throw Cn("[decodePubFromBlocks] root not found in blockStore",{blockStore:t,currentCID:f});let $;if(d?.info){u||(u=d.applogs);let B=await Pn(t,d.applogs);$=await iN(B,t),o||(o=await Pn(t,d.info),Bs("new format - infoLogs",o.logs.map(W=>({[W.toString()]:W}))))}else $=d.applogs;let E=async B=>{let W=B,M=await Pn(t,W);if(!M)throw Cn("Could not find applog CID in pub blocks:",W.toString(),{cid:W,root:d,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${W.toString()}`);return M.pv instanceof or&&(M.pv=M.pv.toV1().toString()),{...M,cid:W.toV1().toString()}},T=await Promise.all($.map(E));if(i=i.concat(T),!d.prev)break;if(n&&Wh(d.prev,n)){Bs("[decodePubFromBlocks] stopping at stopAtCID:",n.toString());break}if(!await t.get(d.prev))throw Cn("[decodePubFromBlocks] prev snapshot missing from blockStore",{currentCID:f,prev:d.prev.toString(),stopAtCID:n?.toString(),visited:[...s]});a=d.prev}let l={cid:e,info:o?{...o,logs:await Promise.all(o.logs.map(async f=>{let d=f,$=await Pn(t,d);if(!$)throw Cn("Could not find info log CID in pub blocks:",d.toString(),{cid:d,blockStore:t}),new Error(`Could not find info log CID in pub blocks: ${d.toString()}`);return $.pv instanceof or&&($.pv=$.pv.toV1().toString()),{...$,cid:d.toV1().toString()}}))}:null,applogsCID:u,applogs:i};return Bs("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),blockStore:t,applogs:i}),l}async function tN(e){let t=(await e.getRoots()).map(n=>(typeof n.toV1=="function"?n:or.decode(n.bytes)).toV1().toString()),r=new Map;for await(let{cid:n,bytes:i}of e.blocks()){let o=typeof n.toV1=="function"?n:or.decode(n.bytes);Vl({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&oy("Unexpected roots count:",t),{rootCID:or.parse(t[0]),blockStore:{get:n=>r.get(n.toV1().toString())}}}async function Pn(e,t){try{var r=await e.get(t);if(!r)return oy("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return Rl(r)}function rN(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(Vl("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:I5,LOG:$5,DEBUG:k5,VERBOSE:j5,ERROR:nN}=Ae.setup(Ae.INFO);async function iN(e,t){return oN(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Pn(t,r);if(!n.logs)throw nN("Weird chunk",n);return n.logs}))).flat():e.logs}function oN(e){return e.chunks}var Na=Yi($y(),1),aN=Yi(ky(),1),ay=!1,sy=!1;Na.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(ay=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(sy=process?.env?.LOGGER_PERF_PREFIX==="true"));var sN={prefix:void 0,time:ay,delta:sy,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Vs=[],uy=class{sinceFirst=0;sinceLast=0;time=!1;delta=!1;constructor(e,t,r,n){Object.assign(this,{sinceFirst:e,sinceLast:t,time:r,delta:n})}toString(){let e=this.sinceFirst*.001,t=e.toFixed(e<5?2:1),r=this.sinceLast<1e3?`${this.sinceLast.toFixed(0)}`.padStart(5," "):`${`${(this.sinceLast*.001).toFixed(this.sinceLast<1e4?1:0)}`.padStart(4," ")}s`;return`[${[this.time?t:null,this.delta?r:null].filter(n=>n!=null).join(",")}]`}},ly=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Ni=!1,Kn=class yt{static ERROR=2;static WARN=4;static INFO=6;static LOG=6;static DEBUG=8;static VERBOSE=10;static firstLog=0;static lastLog=0;static setup(t=yt.INFO,r={}){r=Object.assign({},sN,r),t>10&&console.debug("setup logger",{config:r});let n=this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}),i=(...u)=>{typeof window<"u"&&window?.FORCE_DISABLE_LOGLEVEL&&n(...u)};i.isDisabled=!0,i.isEnabled=!1;let o=this.wrapLog(console.groupCollapsed,r),a=(u,l)=>{function f(...$){let E=$[$.length-1];return E===i?E():(o(...$.slice(0,-1)),(async()=>{try{let T=E();return T instanceof Promise?await T:T}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=yt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,aN.default)(u))),WARN:a(t>=yt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=yt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=yt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=yt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Na.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Na.isBrowser&&navigator.userAgent.includes("Chrome")?["",yt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Ni?n.push(new ly("dim",r.prefix)):n.push(r.prefix)),t.bind(console,...n)}}static timeStr(t,r,n=0){if(!performance.now)return;let i=performance.now();yt.firstLog||(yt.firstLog=i,yt.lastLog=i);let o=new uy(i-yt.firstLog,i-yt.lastLog,t,r);return yt.lastLog=i,n?o.toString():o}static getOriginFromStack(t){let r=!1;for(let n of t.split(`
|
|
62
|
+
`)){let i=n.match(/^\s+at\s+(.*)/);if(i){if(r)return i[1].trim().replace(__dirname,"");r=!0}}}};Na.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Vs&&Vs.length){for(let t of Vs)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof uy))return null;Ni||(Ni=!0);let t=Kn.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof ly?(Ni||(Ni=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var{WARN:uN,LOG:N5,DEBUG:Ri,VERBOSE:C5,ERROR:gs}=Kn.setup(Kn.INFO),Fl=["https://trustless-gateway.link/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function zl(e,{readOnly:t=!0,pinnedCID:r,gateways:n=Fl}={}){let{cid:i,errors:o,isIpns:a}=fj(e);if(!i)throw gs("Failed to parse pubID",e,o);Ri("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await cy(i),{applogs:u,info:l}=await Zj(s),f=u.filter(bu);f.length&&uN(`Found ${f.length} encrypted logs - skipping`);let d=u.filter(E=>!bu(E));Qi(d);let $=vo.fromArray(d,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:$,encryptedCount:f.length}}async function cy(e,t=Fl){return e=wu(e),Ri("Retrieving:",e,e.toString(),"from",t),await ql(t,async(r,n)=>{var i=fy(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await lN(o,i);Ri("[retrieveCar] GW result",{result:a,gateway:r});let s=await Id.fromIterable(a);Ri("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!Ll(e)&&!Wh(e,u))throw gs("Fetched CAR has different CID",u.toString(),"than the one asked for:",e.toString());return s})}function fy(e,t,r="all"){let n=new URL(e.url),i=Ll(t),o=`${n}${i?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=${r}`;return Ri({isIpns:i,url:o}),o}async function lN(e,t){if(!e?.ok||!e?.body)throw gs("[retrieveCar] unexpected response",e?.statusText,{url:t});return rN(e.body.getReader())}async function ql(e,t,r=1){try{return await Promise.any(ea(e).map(async n=>{try{return await t(n,r)}catch(i){throw gs("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await ql(e,t,r+1);throw new Error("[Gateway] no valid results after 3 attempts via: "+ea(e).map(({url:i})=>i)+`
|
|
63
|
+
`+n.errors.map(i=>i.message))}}var{WARN:l8,LOG:c8,DEBUG:f8,VERBOSE:d8,ERROR:p8}=Ae.setup(Ae.INFO),{WARN:h8,LOG:y8,DEBUG:g8,VERBOSE:m8,ERROR:b8}=Ae.setup(Ae.INFO),{WARN:cN,LOG:v8,DEBUG:fN,VERBOSE:ms,ERROR:w8}=Ae.setup(Ae.INFO),_8=tt("queryDivergencesByPrev",function(e){fN(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("lastWriteWins")&&cN("queryDivergencesByPrev on thread lastWriteWins",e);let t=Ht(()=>{let r=new Map,n=new Set;ms("all applogs:",e.applogs);for(let i of e.applogs){let o;i.pv&&(o=i.pv&&r.get(i.pv.toString()),n.delete(i.pv.toString())),ms("traversing log",{log:i,prevLogs:o,leafs:Array.from(n)}),r.set(i.cid,o?[...o,i]:[i]),n.add(i.cid)}return Array.from(n).map(i=>{let o=new vo(We({caller:"DivergenceLeaf",thread:e,pattern:`leaf: ${i}`}),r.get(i),e.filters,!0);return{log:o.latestLog,thread:o}})},{name:We({caller:"queryDivergencesByPrev",thread:e})});return ms.isDisabled||Mt(()=>ms("[queryDivergencesByPrev] result:",br(t))),t},{equals:Je.structural}),{WARN:T8,LOG:E8,DEBUG:O8,VERBOSE:x8,ERROR:A8}=Kn.setup(Kn.INFO);var{WARN:k8,LOG:j8,DEBUG:N8,VERBOSE:C8,ERROR:U8}=Ts.setup(Ts.INFO),dN="https://nftstorage.link";async function P8(e,{readOnly:t=!0,pinnedCID:r}={}){return zl(e,{readOnly:t,pinnedCID:r,gateways:[{url:dN}]})}export{dN as a,P8 as b};
|
|
64
|
+
/*! Bundled license information:
|
|
65
|
+
|
|
66
|
+
@noble/hashes/utils.js:
|
|
67
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
68
|
+
*/
|
|
69
|
+
/*! Bundled license information:
|
|
70
|
+
|
|
71
|
+
lodash-es/lodash.js:
|
|
72
|
+
(**
|
|
73
|
+
* @license
|
|
74
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
75
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
76
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
77
|
+
* Released under MIT license <https://lodash.com/license>
|
|
78
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
79
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
80
|
+
*)
|
|
81
|
+
*/
|
|
82
|
+
//# sourceMappingURL=chunk-YU2L6ZL2.min.js.map
|