@wovin/connect-nftstorage 0.0.16 → 0.0.18
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,80 @@
|
|
|
1
|
+
import{e as fs}from"./chunk-BKKH6BET.min.js";var cy=Object.create,Df=Object.defineProperty,fy=Object.getOwnPropertyDescriptor,dy=Object.getOwnPropertyNames,py=Object.getPrototypeOf,hy=Object.prototype.hasOwnProperty,zn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),yy=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dy(t))!hy.call(e,i)&&i!==r&&Df(e,i,{get:()=>t[i],enumerable:!(n=fy(t,i))||n.enumerable});return e},Wi=(e,t,r)=>(r=e!=null?cy(py(e)):{},yy(t||!e||!e.__esModule?Df(r,"default",{value:e,enumerable:!0}):r,e)),gy=zn((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}}),my=zn((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,p,S=o.length;do{if(f>=S||l>49)throw i.bytes=0,new RangeError("Could not decode varint");p=o[f++],s+=l<28?(p&n)<<l:(p&n)*Math.pow(2,l),l+=7}while(p>=r);return i.bytes=f-u,s}}),by=zn((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(p){return p<r?1:p<n?2:p<i?3:p<o?4:p<a?5:p<s?6:p<u?7:p<l?8:p<f?9:10}}),hu=zn((e,t)=>{"use strict";t.exports={encode:gy(),decode:my(),encodingLength:by()}}),vy=zn(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}),wy=zn((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 p={key:l,value:u[l]},S={key:f,value:u[f]};return s(p,S)}}}(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 p=a.push(u)-1,S=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<S.length;l++){var O=S[l],T=s(u[O]);T&&(f&&(f+=","),f+=JSON.stringify(O)+":"+T)}return a.splice(p,1),"{"+f+"}"}}(r)}}),_y=["string","number","bigint","symbol"],Ty=["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 Oy(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return _y.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":Ey(e)?"Buffer":Ay(e)||"Object"}function Ey(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function Ay(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Ty.includes(t))return t}var Q=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}};Q.uint=new Q(0,"uint",!0);Q.negint=new Q(1,"negint",!0);Q.bytes=new Q(2,"bytes",!0);Q.string=new Q(3,"string",!0);Q.array=new Q(4,"array",!1);Q.map=new Q(5,"map",!1);Q.tag=new Q(6,"tag",!1);Q.float=new Q(7,"float",!0);Q.false=new Q(7,"false",!0);Q.true=new Q(7,"true",!0);Q.null=new Q(7,"null",!0);Q.undefined=new Q(7,"undefined",!0);Q.break=new Q(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}`}},Kn=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",xy=new TextDecoder,Iy=new TextEncoder;function Uo(e){return Kn&&globalThis.Buffer.isBuffer(e)}function Sy(e){return e instanceof Uint8Array?Uo(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var ky=Kn?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Rl(e,t,r):(e,t,r)=>r-t>64?xy.decode(e.subarray(t,r)):Rl(e,t,r),$y=Kn?e=>e.length>64?globalThis.Buffer.from(e):Bl(e):e=>e.length>64?Iy.encode(e):Bl(e),yu=Kn?(e,t,r)=>Uo(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),jy=Kn?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Sy(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},Cy=Kn?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Ny(e,t){if(Uo(e)&&Uo(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 Bl(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 Rl(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 My(n)}var Dl=4096;function My(e){let t=e.length;if(t<=Dl)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Dl));return r}var Py=256,Uy=class{constructor(e=Py){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=Cy(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=yu(r,0,this.cursor)}else t=jy(this.chunks,this.cursor);return e&&this.reset(),t}},Ae="CBOR decode error:",Lf="CBOR encode error:",Hi=[];Hi[23]=1;Hi[24]=2;Hi[25]=3;Hi[26]=5;Hi[27]=9;function Gn(e,t,r){if(e.length-t<r)throw new Error(`${Ae} not enough data for type`)}var et=[24,256,65536,4294967296,BigInt("18446744073709551616")];function un(e,t,r){Gn(e,t,1);let n=e[t];if(r.strict===!0&&n<et[0])throw new Error(`${Ae} integer encoded in more bytes than necessary (strict decode)`);return n}function ln(e,t,r){Gn(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<et[1])throw new Error(`${Ae} integer encoded in more bytes than necessary (strict decode)`);return n}function cn(e,t,r){Gn(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<et[2])throw new Error(`${Ae} integer encoded in more bytes than necessary (strict decode)`);return n}function fn(e,t,r){Gn(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(i);if(r.strict===!0&&o<et[3])throw new Error(`${Ae} 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(`${Ae} integers outside of the safe integer range are not supported`)}function By(e,t,r,n){return new ge(Q.uint,un(e,t+1,n),2)}function Ry(e,t,r,n){return new ge(Q.uint,ln(e,t+1,n),3)}function Dy(e,t,r,n){return new ge(Q.uint,cn(e,t+1,n),5)}function Ly(e,t,r,n){return new ge(Q.uint,fn(e,t+1,n),9)}function dn(e,t){return Bt(e,0,t.value)}function Bt(e,t,r){if(r<et[0]){let n=Number(r);e.push([t|n])}else if(r<et[1]){let n=Number(r);e.push([t|24,n])}else if(r<et[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<et[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<et[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(`${Ae} encountered BigInt larger than allowable range`)}}dn.encodedSize=function(e){return Bt.encodedSize(e.value)};Bt.encodedSize=function(e){return e<et[0]?1:e<et[1]?2:e<et[2]?3:e<et[3]?5:9};dn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Vy(e,t,r,n){return new ge(Q.negint,-1-un(e,t+1,n),2)}function Fy(e,t,r,n){return new ge(Q.negint,-1-ln(e,t+1,n),3)}function zy(e,t,r,n){return new ge(Q.negint,-1-cn(e,t+1,n),5)}var gu=BigInt(-1),Vf=BigInt(1);function Ky(e,t,r,n){let i=fn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ge(Q.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ae} integers outside of the safe integer range are not supported`);return new ge(Q.negint,gu-BigInt(i),9)}function mu(e,t){let r=t.value,n=typeof r=="bigint"?r*gu-Vf:r*-1-1;Bt(e,t.type.majorEncoded,n)}mu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*gu-Vf:t*-1-1;return r<et[0]?1:r<et[1]?2:r<et[2]?3:r<et[3]?5:9};mu.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Ji(e,t,r,n){Gn(e,t,r+n);let i=yu(e,t+r,t+r+n);return new ge(Q.bytes,i,r+n)}function Gy(e,t,r,n){return Ji(e,t,1,r)}function qy(e,t,r,n){return Ji(e,t,2,un(e,t+1,n))}function Wy(e,t,r,n){return Ji(e,t,3,ln(e,t+1,n))}function Hy(e,t,r,n){return Ji(e,t,5,cn(e,t+1,n))}function Jy(e,t,r,n){let i=fn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ae} 64-bit integer bytes lengths not supported`);return Ji(e,t,9,i)}function Bo(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Q.string?$y(e.value):e.value),e.encodedBytes}function Aa(e,t){let r=Bo(t);Bt(e,t.type.majorEncoded,r.length),e.push(r)}Aa.encodedSize=function(e){let t=Bo(e);return Bt.encodedSize(t.length)+t.length};Aa.compareTokens=function(e,t){return Qy(Bo(e),Bo(t))};function Qy(e,t){return e.length<t.length?-1:e.length>t.length?1:Ny(e,t)}function Qi(e,t,r,n,i){let o=r+n;Gn(e,t,o);let a=new ge(Q.string,ky(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=yu(e,t+r,t+o)),a}function Yy(e,t,r,n){return Qi(e,t,1,r,n)}function Xy(e,t,r,n){return Qi(e,t,2,un(e,t+1,n),n)}function Zy(e,t,r,n){return Qi(e,t,3,ln(e,t+1,n),n)}function eg(e,t,r,n){return Qi(e,t,5,cn(e,t+1,n),n)}function tg(e,t,r,n){let i=fn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ae} 64-bit integer string lengths not supported`);return Qi(e,t,9,i,n)}var rg=Aa;function qn(e,t,r,n){return new ge(Q.array,n,r)}function ng(e,t,r,n){return qn(e,t,1,r)}function ig(e,t,r,n){return qn(e,t,2,un(e,t+1,n))}function og(e,t,r,n){return qn(e,t,3,ln(e,t+1,n))}function ag(e,t,r,n){return qn(e,t,5,cn(e,t+1,n))}function sg(e,t,r,n){let i=fn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ae} 64-bit integer array lengths not supported`);return qn(e,t,9,i)}function ug(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ae} indefinite length items not allowed`);return qn(e,t,1,1/0)}function bu(e,t){Bt(e,Q.array.majorEncoded,t.value)}bu.compareTokens=dn.compareTokens;bu.encodedSize=function(e){return Bt.encodedSize(e.value)};function Wn(e,t,r,n){return new ge(Q.map,n,r)}function lg(e,t,r,n){return Wn(e,t,1,r)}function cg(e,t,r,n){return Wn(e,t,2,un(e,t+1,n))}function fg(e,t,r,n){return Wn(e,t,3,ln(e,t+1,n))}function dg(e,t,r,n){return Wn(e,t,5,cn(e,t+1,n))}function pg(e,t,r,n){let i=fn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ae} 64-bit integer map lengths not supported`);return Wn(e,t,9,i)}function hg(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ae} indefinite length items not allowed`);return Wn(e,t,1,1/0)}function vu(e,t){Bt(e,Q.map.majorEncoded,t.value)}vu.compareTokens=dn.compareTokens;vu.encodedSize=function(e){return Bt.encodedSize(e.value)};function yg(e,t,r,n){return new ge(Q.tag,r,1)}function gg(e,t,r,n){return new ge(Q.tag,un(e,t+1,n),2)}function mg(e,t,r,n){return new ge(Q.tag,ln(e,t+1,n),3)}function bg(e,t,r,n){return new ge(Q.tag,cn(e,t+1,n),5)}function vg(e,t,r,n){return new ge(Q.tag,fn(e,t+1,n),9)}function wu(e,t){Bt(e,Q.tag.majorEncoded,t.value)}wu.compareTokens=dn.compareTokens;wu.encodedSize=function(e){return Bt.encodedSize(e.value)};var wg=20,_g=21,Tg=22,Og=23;function Eg(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ae} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ge(Q.null,null,1):new ge(Q.undefined,void 0,1)}function Ag(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ae} indefinite length items not allowed`);return new ge(Q.break,void 0,1)}function _u(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ae} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ae} Infinity values are not supported`)}return new ge(Q.float,e,t)}function xg(e,t,r,n){return _u(Ou(e,t+1),3,n)}function Ig(e,t,r,n){return _u(Eu(e,t+1),5,n)}function Sg(e,t,r,n){return _u(Gf(e,t+1),9,n)}function Tu(e,t,r){let n=t.value;if(n===!1)e.push([Q.float.majorEncoded|wg]);else if(n===!0)e.push([Q.float.majorEncoded|_g]);else if(n===null)e.push([Q.float.majorEncoded|Tg]);else if(n===void 0)e.push([Q.float.majorEncoded|Og]);else{let i,o=!1;(!r||r.float64!==!0)&&(zf(n),i=Ou(Ft,1),n===i||Number.isNaN(n)?(Ft[0]=249,e.push(Ft.slice(0,3)),o=!0):(Kf(n),i=Eu(Ft,1),n===i&&(Ft[0]=250,e.push(Ft.slice(0,5)),o=!0))),o||(kg(n),i=Gf(Ft,1),Ft[0]=251,e.push(Ft.slice(0,9)))}}Tu.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){zf(r);let n=Ou(Ft,1);if(r===n||Number.isNaN(r))return 3;if(Kf(r),n=Eu(Ft,1),r===n)return 5}return 9};var Ff=new ArrayBuffer(9),Ot=new DataView(Ff,1),Ft=new Uint8Array(Ff,0);function zf(e){if(e===1/0)Ot.setUint16(0,31744,!1);else if(e===-1/0)Ot.setUint16(0,64512,!1);else if(Number.isNaN(e))Ot.setUint16(0,32256,!1);else{Ot.setFloat32(0,e);let t=Ot.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Ot.setUint16(0,31744,!1);else if(r===0)Ot.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Ot.setUint16(0,0):i<-14?Ot.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Ot.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Ou(e,t){if(e.length-t<2)throw new Error(`${Ae} 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 Kf(e){Ot.setFloat32(0,e,!1)}function Eu(e,t){if(e.length-t<4)throw new Error(`${Ae} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function kg(e){Ot.setFloat64(0,e,!1)}function Gf(e,t){if(e.length-t<8)throw new Error(`${Ae} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Tu.compareTokens=dn.compareTokens;function $e(e,t,r){throw new Error(`${Ae} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function xa(e){return()=>{throw new Error(`${Ae} ${e}`)}}var ue=[];for(let e=0;e<=23;e++)ue[e]=$e;ue[24]=By;ue[25]=Ry;ue[26]=Dy;ue[27]=Ly;ue[28]=$e;ue[29]=$e;ue[30]=$e;ue[31]=$e;for(let e=32;e<=55;e++)ue[e]=$e;ue[56]=Vy;ue[57]=Fy;ue[58]=zy;ue[59]=Ky;ue[60]=$e;ue[61]=$e;ue[62]=$e;ue[63]=$e;for(let e=64;e<=87;e++)ue[e]=Gy;ue[88]=qy;ue[89]=Wy;ue[90]=Hy;ue[91]=Jy;ue[92]=$e;ue[93]=$e;ue[94]=$e;ue[95]=xa("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ue[e]=Yy;ue[120]=Xy;ue[121]=Zy;ue[122]=eg;ue[123]=tg;ue[124]=$e;ue[125]=$e;ue[126]=$e;ue[127]=xa("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ue[e]=ng;ue[152]=ig;ue[153]=og;ue[154]=ag;ue[155]=sg;ue[156]=$e;ue[157]=$e;ue[158]=$e;ue[159]=ug;for(let e=160;e<=183;e++)ue[e]=lg;ue[184]=cg;ue[185]=fg;ue[186]=dg;ue[187]=pg;ue[188]=$e;ue[189]=$e;ue[190]=$e;ue[191]=hg;for(let e=192;e<=215;e++)ue[e]=yg;ue[216]=gg;ue[217]=mg;ue[218]=bg;ue[219]=vg;ue[220]=$e;ue[221]=$e;ue[222]=$e;ue[223]=$e;for(let e=224;e<=243;e++)ue[e]=xa("simple values are not supported");ue[244]=$e;ue[245]=$e;ue[246]=$e;ue[247]=Eg;ue[248]=xa("simple values are not supported");ue[249]=xg;ue[250]=Ig;ue[251]=Sg;ue[252]=$e;ue[253]=$e;ue[254]=$e;ue[255]=Ag;var ar=[];for(let e=0;e<24;e++)ar[e]=new ge(Q.uint,e,1);for(let e=-1;e>=-24;e--)ar[31-e]=new ge(Q.negint,e,1);ar[64]=new ge(Q.bytes,new Uint8Array(0),1);ar[96]=new ge(Q.string,"",1);ar[128]=new ge(Q.array,0,1);ar[160]=new ge(Q.map,0,1);ar[244]=new ge(Q.false,!1,1);ar[245]=new ge(Q.true,!0,1);ar[246]=new ge(Q.null,null,1);function qf(){let e=[];return e[Q.uint.major]=dn,e[Q.negint.major]=mu,e[Q.bytes.major]=Aa,e[Q.string.major]=rg,e[Q.array.major]=bu,e[Q.map.major]=vu,e[Q.tag.major]=wu,e[Q.float.major]=Tu,e}var Dj=qf(),Lj=new Uy,Ll=class Wf{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(`${Lf} object contains circular references`);return new Wf(r,t)}},Ar={null:new ge(Q.null,null),undefined:new ge(Q.undefined,void 0),true:new ge(Q.true,!0),false:new ge(Q.false,!1),emptyArray:new ge(Q.array,0),emptyMap:new ge(Q.map,0)},Rr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ge(Q.float,e):e>=0?new ge(Q.uint,e):new ge(Q.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ge(Q.uint,e):new ge(Q.negint,e)},Uint8Array(e,t,r,n){return new ge(Q.bytes,e)},string(e,t,r,n){return new ge(Q.string,e)},boolean(e,t,r,n){return e?Ar.true:Ar.false},null(e,t,r,n){return Ar.null},undefined(e,t,r,n){return Ar.undefined},ArrayBuffer(e,t,r,n){return new ge(Q.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ge(Q.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Ar.emptyArray,new ge(Q.break)]:Ar.emptyArray;n=Ll.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=ds(a,r,n);return r.addBreakTokens?[new ge(Q.array,e.length),i,new ge(Q.break)]:[new ge(Q.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?[Ar.emptyMap,new ge(Q.break)]:Ar.emptyMap;n=Ll.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[ds(l,r,n),ds(i?e.get(l):e[l],r,n)];return $g(s,r),r.addBreakTokens?[new ge(Q.map,a),s,new ge(Q.break)]:[new ge(Q.map,a),s]}};Rr.Map=Rr.Object;Rr.Buffer=Rr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Rr[`${e}Array`]=Rr.DataView;function ds(e,t={},r){let n=Oy(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Rr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Rr[n];if(!o)throw new Error(`${Lf} unsupported type: ${n}`);return o(e,n,t,r)}function $g(e,t){t.mapSorter&&e.sort(t.mapSorter)}var jg={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Cg=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=ar[e];if(t===void 0){let r=ue[e];if(!r)throw new Error(`${Ae} 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}},Ni=Symbol.for("DONE"),Ia=Symbol.for("BREAK");function Ng(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Mi(t,r);if(o===Ia){if(e.value===1/0)break;throw new Error(`${Ae} got unexpected break to lengthed array`)}if(o===Ni)throw new Error(`${Ae} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Mg(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<e.value;a++){let s=Mi(t,r);if(s===Ia){if(e.value===1/0)break;throw new Error(`${Ae} got unexpected break to lengthed map`)}if(s===Ni)throw new Error(`${Ae} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof s!="string")throw new Error(`${Ae} non-string keys not supported (got ${typeof s})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(s)||!n&&s in i))throw new Error(`${Ae} found repeat map key "${s}"`);let u=Mi(t,r);if(u===Ni)throw new Error(`${Ae} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?o.set(s,u):i[s]=u}return n?o:i}function Mi(e,t){if(e.done())return Ni;let r=e.next();if(r.type===Q.break)return Ia;if(r.type.terminal)return r.value;if(r.type===Q.array)return Ng(r,e,t);if(r.type===Q.map)return Mg(r,e,t);if(r.type===Q.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Mi(e,t);return t.tags[r.value](n)}throw new Error(`${Ae} tag not supported (${r.value})`)}throw new Error("unsupported")}function Pg(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Ae} data to decode must be a Uint8Array`);t=Object.assign({},jg,t);let r=t.tokenizer||new Cg(e,t),n=Mi(r,t);if(n===Ni)throw new Error(`${Ae} did not find any content to decode`);if(n===Ia)throw new Error(`${Ae} got unexpected break`);return[n,e.subarray(r.pos())]}function Ug(e,t){let[r,n]=Pg(e,t);if(n.length>0)throw new Error(`${Ae} too many terminals, data makes no sense`);return r}var Vj=new Uint8Array(0);function Bg(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 Au(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 Rg(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 p(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 L=0,H=0,U=0,k=T.length;U!==k&&T[U]===0;)U++,L++;for(var F=(k-U)*f+1>>>0,G=new Uint8Array(F);U!==k;){for(var B=T[U],Y=0,K=F-1;(B!==0||Y<H)&&K!==-1;K--,Y++)B+=256*G[K]>>>0,G[K]=B%s>>>0,B=B/s>>>0;if(B!==0)throw new Error("Non-zero carry");H=Y,U++}for(var te=F-H;te!==F&&G[te]===0;)te++;for(var $=u.repeat(L);te<F;++te)$+=e.charAt(G[te]);return $}function S(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var L=0;if(T[L]!==" "){for(var H=0,U=0;T[L]===u;)H++,L++;for(var k=(T.length-L)*l+1>>>0,F=new Uint8Array(k);T[L];){var G=r[T.charCodeAt(L)];if(G===255)return;for(var B=0,Y=k-1;(G!==0||B<U)&&Y!==-1;Y--,B++)G+=s*F[Y]>>>0,F[Y]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");U=B,L++}if(T[L]!==" "){for(var K=k-U;K!==k&&F[K]===0;)K++;for(var te=new Uint8Array(H+(k-K)),$=H;K!==k;)te[$++]=F[K++];return te}}}function O(T){var L=S(T);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:S,decode:O}}var Dg=Rg,Lg=Dg,Vg=Lg,Fg=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")}},zg=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 Hf(this,e)}},Kg=class{decoders;constructor(e){this.decoders=e}or(e){return Hf(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 Hf(e,t){return new Kg({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Gg=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 Fg(e,t,r),this.decoder=new zg(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Jf({name:e,prefix:t,encode:r,decode:n}){return new Gg(e,t,r,n)}function Sa({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Vg(r,e);return Jf({prefix:t,name:e,encode:n,decode:o=>Au(i(o))})}function qg(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 Wg(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 Hg(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function br({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=Hg(n);return Jf({prefix:t,name:e,encode(o){return Wg(o,n,r)},decode(o){return qg(o,i,r,e)}})}var Oo=br({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Fj=br({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),zj=br({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Kj=br({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Gj=br({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),qj=br({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Wj=br({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Hj=br({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Jj=br({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),ps=Sa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Qj=Sa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),$r=Sa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Yj=Sa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Jg=Qf,Vl=128,Qg=127,Yg=~Qg,Xg=Math.pow(2,31);function Qf(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Xg;)t[r++]=e&255|Vl,e/=128;for(;e&Yg;)t[r++]=e&255|Vl,e>>>=7;return t[r]=e|0,Qf.bytes=r-n+1,t}var Zg=Ns,em=128,Fl=127;function Ns(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Ns.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Fl)<<i:(a&Fl)*Math.pow(2,i),i+=7}while(a>=em);return Ns.bytes=o-n,r}var tm=Math.pow(2,7),rm=Math.pow(2,14),nm=Math.pow(2,21),im=Math.pow(2,28),om=Math.pow(2,35),am=Math.pow(2,42),sm=Math.pow(2,49),um=Math.pow(2,56),lm=Math.pow(2,63),cm=function(e){return e<tm?1:e<rm?2:e<nm?3:e<im?4:e<om?5:e<am?6:e<sm?7:e<um?8:e<lm?9:10},fm={encode:Jg,decode:Zg,encodingLength:cm},dm=fm,Ro=dm;function Ms(e,t=0){return[Ro.decode(e,t),Ro.decode.bytes]}function Do(e,t,r=0){return Ro.encode(e,t,r),t}function Lo(e){return Ro.encodingLength(e)}function pm(e,t){let r=t.byteLength,n=Lo(e),i=n+Lo(r),o=new Uint8Array(i+r);return Do(e,o,0),Do(r,o,n),o.set(t,i),new xu(e,r,t,o)}function hm(e){let t=Au(e),[r,n]=Ms(t),[i,o]=Ms(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new xu(r,i,a,t)}function ym(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Bg(e.bytes,r.bytes)}}var xu=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function zl(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return mm(r,Ps(e),t??$r.encoder);default:return bm(r,Ps(e),t??Oo.encoder)}}var Kl=new WeakMap;function Ps(e){let t=Kl.get(e);if(t==null){let r=new Map;return Kl.set(e,r),r}return t}var Yf=class ot{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!==mi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==vm)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ot.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=pm(t,r);return ot.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 ot.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&ym(t.multihash,n.multihash)}toString(t){return zl(this,t)}toJSON(){return{"/":zl(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 ot)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new ot(n,i,o,a??Gl(n,i,o.bytes))}else if(r[wm]===!0){let{version:n,multihash:i,code:o}=r,a=hm(i);return ot.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!==mi)throw new Error(`Version 0 CID must use dag-pb (code: ${mi}) block encoding`);return new ot(t,r,n,n.bytes)}case 1:{let i=Gl(t,r,n.bytes);return new ot(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ot.create(0,mi,t)}static createV1(t,r){return ot.create(1,t,r)}static decode(t){let[r,n]=ot.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=ot.inspectBytes(t),n=r.size-r.multihashSize,i=Au(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 xu(r.multihashCode,r.digestSize,o,i);return[r.version===0?ot.createV0(a):ot.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,S]=Ms(t.subarray(r));return r+=S,p},i=n(),o=mi;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]=gm(t,r),o=ot.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ps(o).set(n,t),o}};function gm(e,t){switch(e[0]){case"Q":{let r=t??$r;return[$r.prefix,r.decode(`${$r.prefix}${e}`)]}case $r.prefix:{let r=t??$r;return[$r.prefix,r.decode(e)]}case Oo.prefix:{let r=t??Oo;return[Oo.prefix,r.decode(e)]}case ps.prefix:{let r=t??ps;return[ps.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 mm(e,t,r){let{prefix:n}=r;if(n!==$r.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 bm(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 mi=112,vm=18;function Gl(e,t,r){let n=Lo(e),i=n+Lo(t),o=new Uint8Array(i+r.byteLength);return Do(e,o,0),Do(t,o,n),o.set(r,i),o}var wm=Symbol.for("@ipld/js-cid/CID"),Xf=42;function _m(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Yf.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new ge(Q.tag,Xf),new ge(Q.bytes,r)]}function Tm(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Om(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 ql={float64:!0,typeEncoders:{Object:_m,undefined:Tm,number:Om}},Xj={...ql,typeEncoders:{...ql.typeEncoders}};function Em(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Yf.decode(e.subarray(1))}var Vo={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Vo.tags[Xf]=Em;var Zj={...Vo,tags:Vo.tags.slice()},Am=e=>Ug(e,Vo),eC=new Uint8Array(0);function xm(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 Iu(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 Im(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 p(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 L=0,H=0,U=0,k=T.length;U!==k&&T[U]===0;)U++,L++;for(var F=(k-U)*f+1>>>0,G=new Uint8Array(F);U!==k;){for(var B=T[U],Y=0,K=F-1;(B!==0||Y<H)&&K!==-1;K--,Y++)B+=256*G[K]>>>0,G[K]=B%s>>>0,B=B/s>>>0;if(B!==0)throw new Error("Non-zero carry");H=Y,U++}for(var te=F-H;te!==F&&G[te]===0;)te++;for(var $=u.repeat(L);te<F;++te)$+=e.charAt(G[te]);return $}function S(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var L=0;if(T[L]!==" "){for(var H=0,U=0;T[L]===u;)H++,L++;for(var k=(T.length-L)*l+1>>>0,F=new Uint8Array(k);T[L];){var G=r[T.charCodeAt(L)];if(G===255)return;for(var B=0,Y=k-1;(G!==0||B<U)&&Y!==-1;Y--,B++)G+=s*F[Y]>>>0,F[Y]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");U=B,L++}if(T[L]!==" "){for(var K=k-U;K!==k&&F[K]===0;)K++;for(var te=new Uint8Array(H+(k-K)),$=H;K!==k;)te[$++]=F[K++];return te}}}function O(T){var L=S(T);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:S,decode:O}}var Sm=Im,km=Sm,$m=km,jm=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")}},Cm=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 Zf(this,e)}},Nm=class{decoders;constructor(e){this.decoders=e}or(e){return Zf(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 Zf(e,t){return new Nm({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Mm=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 jm(e,t,r),this.decoder=new Cm(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function ed({name:e,prefix:t,encode:r,decode:n}){return new Mm(e,t,r,n)}function td({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=$m(r,e);return ed({prefix:t,name:e,encode:n,decode:o=>Iu(i(o))})}function Pm(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 p=i[e[f]];if(p===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|p,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 Um(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 vr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return ed({prefix:t,name:e,encode(i){return Um(i,n,r)},decode(i){return Pm(i,n,r,e)}})}var Eo=vr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),tC=vr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rC=vr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),nC=vr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),iC=vr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),oC=vr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),aC=vr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),sC=vr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uC=vr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),jr=td({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),lC=td({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Bm=rd,Wl=128,Rm=127,Dm=~Rm,Lm=Math.pow(2,31);function rd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Lm;)t[r++]=e&255|Wl,e/=128;for(;e&Dm;)t[r++]=e&255|Wl,e>>>=7;return t[r]=e|0,rd.bytes=r-n+1,t}var Vm=Us,Fm=128,Hl=127;function Us(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Us.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Hl)<<i:(a&Hl)*Math.pow(2,i),i+=7}while(a>=Fm);return Us.bytes=o-n,r}var zm=Math.pow(2,7),Km=Math.pow(2,14),Gm=Math.pow(2,21),qm=Math.pow(2,28),Wm=Math.pow(2,35),Hm=Math.pow(2,42),Jm=Math.pow(2,49),Qm=Math.pow(2,56),Ym=Math.pow(2,63),Xm=function(e){return e<zm?1:e<Km?2:e<Gm?3:e<qm?4:e<Wm?5:e<Hm?6:e<Jm?7:e<Qm?8:e<Ym?9:10},Zm={encode:Bm,decode:Vm,encodingLength:Xm},eb=Zm,Fo=eb;function Bs(e,t=0){return[Fo.decode(e,t),Fo.decode.bytes]}function zo(e,t,r=0){return Fo.encode(e,t,r),t}function Ko(e){return Fo.encodingLength(e)}function tb(e,t){let r=t.byteLength,n=Ko(e),i=n+Ko(r),o=new Uint8Array(i+r);return zo(e,o,0),zo(r,o,n),o.set(t,i),new Su(e,r,t,o)}function Rs(e){let t=Iu(e),[r,n]=Bs(t),[i,o]=Bs(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Su(r,i,a,t)}function rb(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&xm(e.bytes,r.bytes)}}var Su=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Jl(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return ib(r,Ds(e),t??jr.encoder);default:return ob(r,Ds(e),t??Eo.encoder)}}var Ql=new WeakMap;function Ds(e){let t=Ql.get(e);if(t==null){let r=new Map;return Ql.set(e,r),r}return t}var Yl=class at{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!==bi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==ab)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return at.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=tb(t,r);return at.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 at.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&rb(t.multihash,n.multihash)}toString(t){return Jl(this,t)}toJSON(){return{"/":Jl(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 at)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new at(n,i,o,a??Xl(n,i,o.bytes))}else if(r[sb]===!0){let{version:n,multihash:i,code:o}=r,a=Rs(i);return at.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!==bi)throw new Error(`Version 0 CID must use dag-pb (code: ${bi}) block encoding`);return new at(t,r,n,n.bytes)}case 1:{let i=Xl(t,r,n.bytes);return new at(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return at.create(0,bi,t)}static createV1(t,r){return at.create(1,t,r)}static decode(t){let[r,n]=at.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=at.inspectBytes(t),n=r.size-r.multihashSize,i=Iu(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 Su(r.multihashCode,r.digestSize,o,i);return[r.version===0?at.createV0(a):at.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[p,S]=Bs(t.subarray(r));return r+=S,p},i=n(),o=bi;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]=nb(t,r),o=at.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Ds(o).set(n,t),o}};function nb(e,t){switch(e[0]){case"Q":{let r=t??jr;return[jr.prefix,r.decode(`${jr.prefix}${e}`)]}case jr.prefix:{let r=t??jr;return[jr.prefix,r.decode(e)]}case Eo.prefix:{let r=t??Eo;return[Eo.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 ib(e,t,r){let{prefix:n}=r;if(n!==jr.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 ob(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 bi=112,ab=18;function Xl(e,t,r){let n=Ko(e),i=n+Ko(t),o=new Uint8Array(i+r.byteLength);return zo(e,o,0),zo(t,o,n),o.set(r,i),o}var sb=Symbol.for("@ipld/js-cid/CID"),en=Wi(hu(),1),hs={SHA2_256:18,LENGTH:32,DAG_PB:112},ub=40;function Go(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=en.default.decode(e);return t.seek(en.default.decode.bytes),r}function lb(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 cb(e){en.default.decode(e);let t=en.default.decode.bytes,r=en.default.decode(e.subarray(en.default.decode.bytes)),n=en.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},Ei={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Mr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Mr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Ei["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Ei["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=Ei["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=Ei.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}},Ai={"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=Ai["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=Ai["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=Ai["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=Ai.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}},fb={toTyped:Ei.CarV1HeaderOrV2Pragma,toRepresentation:Ai.CarV1HeaderOrV2Pragma},cC=qf(),fC=Wi(hu(),1),dC=[new ge(Q.map,2),new ge(Q.string,"version"),new ge(Q.uint,1),new ge(Q.string,"roots")],pC=new ge(Q.tag,42);async function nd(e,t){let r=Go(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=Am(n);if(fb.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=lb(await e.exactly(ub,!0));e.seek(o.dataOffset-e.pos);let a=await nd(e,1);return Object.assign(a,o)}async function db(e){let t=await e.exactly(2,!1);if(t[0]===hs.SHA2_256&&t[1]===hs.LENGTH){let a=await e.exactly(34,!0),s=Rs(a);return Yl.create(0,hs.DAG_PB,s)}let r=Go(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=Go(await e.upTo(8),e),i=await e.exactly(cb(await e.upTo(8)),!0),o=Rs(i);return Yl.create(r,n,o)}async function id(e){let t=e.pos,r=Go(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await db(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function pb(e){let{cid:t,blockLength:r}=await id(e);return{bytes:await e.exactly(r,!0),cid:t}}async function hb(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await id(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function yb(e){let t=(async()=>{let r=await nd(e);if(r.version===2){let n=e.pos-r.dataOffset;e=vb(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await pb(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await hb(e)}}}function gb(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 mb(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 bb(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return mb(r)}function vb(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 od=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 Zl(gb(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return Zl(bb(e))}};async function Zl(e){let t=yb(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new od(r,n)}var hC=Wi(hu(),1),wb={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"},_b=wb;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:_b[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var Tb={};function ka(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:Tb}var ad=Object.assign,qo=Object.getOwnPropertyDescriptor,rr=Object.defineProperty,Yi=Object.prototype,Wo=[];Object.freeze(Wo);var ku={};Object.freeze(ku);var Ob=typeof Proxy<"u",Eb=Object.toString();function sd(){Ob||de("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function vi(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 Rt(){return++X.mobxGuid}function $u(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Nn=function(){};function Fe(e){return typeof e=="function"}function rn(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function $a(e){return e!==null&&typeof e=="object"}function Qt(e){if(!$a(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()===Eb}function ud(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function ja(e,t,r){rr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function ld(e,t,r){rr(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function zr(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return $a(n)&&n[r]===!0}}function Hn(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function Ab(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function fr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var cd=typeof Object.getOwnPropertySymbols<"u";function xb(e){var t=Object.keys(e);if(!cd)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return Yi.propertyIsEnumerable.call(e,n)})):t}var Ca=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:cd?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Ls(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function fd(e){return e===null?null:typeof e=="object"?""+e:e}function Ct(e,t){return Yi.hasOwnProperty.call(e,t)}var Ib=Object.getOwnPropertyDescriptors||function(e){var t={};return Ca(e).forEach(function(r){t[r]=qo(e,r)}),t};function yt(e,t){return!!(e&t)}function gt(e,t,r){return r?e|=t:e&=~t,e}function ec(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 tc(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,kb(n.key),n)}}function Jn(e,t,r){return t&&tc(e.prototype,t),r&&tc(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=$b(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 yr(){return yr=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},yr.apply(null,arguments)}function dd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Vs(e,t)}function Vs(e,t){return Vs=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},Vs(e,t)}function Sb(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 kb(e){var t=Sb(e,"string");return typeof t=="symbol"?t:t+""}function $b(e,t){if(e){if(typeof e=="string")return ec(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)?ec(e,t):void 0}}var ht=Symbol("mobx-stored-annotations");function nr(e){function t(r,n){if(Zi(n))return e.decorate_20223_(r,n);Xi(r,n,e)}return Object.assign(t,e)}function Xi(e,t,r){if(Ct(e,ht)||ja(e,ht,yr({},e[ht])),Ho(r)&&!Ct(e[ht],t)){var n=e.constructor.name+".prototype."+t.toString();de("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}jb(e,r,t),Ho(r)||(e[ht][t]=r)}function jb(e,t,r){if(!Ho(t)&&Ct(e[ht],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[ht][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 Cb(e){return Ct(e,ht)||ja(e,ht,yr({},e[ht])),e[ht]}function Zi(e){return typeof e=="object"&&typeof e.kind=="string"}function Na(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"),Kr=function(){function e(r){r===void 0&&(r="Atom@"+Rt()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Se.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 Sd(this)},t.reportChanged=function(){kt(),kd(this),$t()},t.toString=function(){return this.name_},Jn(e,[{key:"isBeingObserved",get:function(){return yt(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=gt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return yt(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=gt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return yt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=gt(this.flags_,e.diffValueMask_,r===1)}}])}();Kr.isBeingObservedMask_=1;Kr.isPendingUnobservationMask_=2;Kr.diffValueMask_=4;var ju=zr("Atom",Kr);function pd(e,t,r){t===void 0&&(t=Nn),r===void 0&&(r=Nn);var n=new Kr(e);return t!==Nn&&Ra(n,t),r!==Nn&&Yn(n,r),n}function Nb(e,t){return e===t}function Mb(e,t){return Ru(e,t)}function Pb(e,t){return Ru(e,t,1)}function Ub(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var We={identity:Nb,structural:Mb,default:Ub,shallow:Pb};function Qn(e,t,r){return Rn(e)?e:Array.isArray(e)?Le.array(e,{name:r}):Qt(e)?Le.object(e,void 0,{name:r}):Hn(e)?Le.map(e,{name:r}):fr(e)?Le.set(e,{name:r}):typeof e=="function"&&!on(e)&&!Bi(e)?ud(e)?Bn(e):Pi(r,e):e}function Bb(e,t,r){if(e==null||an(e)||Zn(e)||sr(e)||Gt(e))return e;if(Array.isArray(e))return Le.array(e,{name:r,deep:!1});if(Qt(e))return Le.object(e,void 0,{name:r,deep:!1});if(Hn(e))return Le.map(e,{name:r,deep:!1});if(fr(e))return Le.set(e,{name:r,deep:!1});de("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Ma(e){return e}function Rb(e,t){return Rn(e)&&de("observable.struct should not be used with observable values"),Ru(e,t)?t:e}var Db="override";function Ho(e){return e.annotationType_===Db}function eo(e,t){return{annotationType_:e,options_:t,make_:Lb,extend_:Vb,decorate_20223_:Fb}}function Lb(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(on(r.value))return 1;var o=hd(e,this,t,r,!1);return rr(n,t,o),2}function Vb(e,t,r,n){var i=hd(e,this,t,r);return e.defineProperty_(t,i,n)}function Fb(e,t){Na(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,a=function(u){var l,f,p,S;return nn((l=(f=o.options_)==null?void 0:f.name)!=null?l:n.toString(),u,(p=(S=o.options_)==null?void 0:S.autoAction)!=null?p:!1)};if(r=="field")return function(u){var l,f=u;return on(f)||(f=a(f)),(l=o.options_)!=null&&l.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(r=="method"){var s;return on(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 zb(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 hd(e,t,r,n,i){var o,a,s,u,l,f,p;i===void 0&&(i=X.safeDescriptors),zb(e,t,r,n);var S=n.value;if((o=t.options_)!=null&&o.bound){var O;S=S.bind((O=e.proxy_)!=null?O:e.target_)}return{value:nn((a=(s=t.options_)==null?void 0:s.name)!=null?a:r.toString(),S,(u=(l=t.options_)==null?void 0:l.autoAction)!=null?u:!1,(f=t.options_)!=null&&f.bound?(p=e.proxy_)!=null?p:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function yd(e,t){return{annotationType_:e,options_:t,make_:Kb,extend_:Gb,decorate_20223_:qb}}function Kb(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&&(!Ct(e.target_,t)||!Bi(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(Bi(r.value))return 1;var o=gd(e,this,t,r,!1,!1);return rr(n,t,o),2}function Gb(e,t,r,n){var i,o=gd(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function qb(e,t){var r;Na(t,["method"]);var n=t.name,i=t.addInitializer;return Bi(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 Wb(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 gd(e,t,r,n,i,o){o===void 0&&(o=X.safeDescriptors),Wb(e,t,r,n);var a=n.value;if(Bi(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 Cu(e,t){return{annotationType_:e,options_:t,make_:Hb,extend_:Jb,decorate_20223_:Qb}}function Hb(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Jb(e,t,r,n){return Yb(e,this,t,r),e.defineComputedProperty_(t,yr({},this.options_,{get:r.get,set:r.set}),n)}function Qb(e,t){Na(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=ei(this)[we],a=yr({},r.options_,{get:e,context:this});a.name||(a.name=o.name_+"."+n.toString()),o.values_.set(n,new Pt(a))}),function(){return this[we].getObservablePropValue_(n)}}function Yb(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 Pa(e,t){return{annotationType_:e,options_:t,make_:Xb,extend_:Zb,decorate_20223_:ev}}function Xb(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function Zb(e,t,r,n){var i,o;return tv(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:Qn,n)}function ev(e,t){if(t.kind==="field")throw de("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");Na(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function a(s,u){var l,f,p=ei(s)[we],S=new Br(u,(l=(f=r.options_)==null?void 0:f.enhancer)!=null?l:Qn,p.name_+"."+i.toString(),!1);p.values_.set(i,S),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 tv(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 rv="true",nv=md();function md(e){return{annotationType_:rv,options_:e,make_:iv,extend_:ov,decorate_20223_:av}}function iv(e,t,r,n){var i,o;if(r.get)return Ge.make_(e,t,r,n);if(r.set){var a=nn(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(rr(n,t,{configurable:!0,set:a}),2)}if(n!==e.target_&&typeof r.value=="function"){var s;if(ud(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?Pi.bound:Pi;return f.make_(e,t,r,n)}var p=((i=this.options_)==null?void 0:i.deep)===!1?Le.ref:Le;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var S;r.value=r.value.bind((S=e.proxy_)!=null?S:e.target_)}return p.make_(e,t,r,n)}function ov(e,t,r,n){var i,o;if(r.get)return Ge.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:X.safeDescriptors?e.isPlainObject_:!0,set:nn(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?Le.ref:Le;return s.extend_(e,t,r,n)}function av(e,t){de("'"+this.annotationType_+"' cannot be used as a decorator")}var sv="observable",uv="observable.ref",lv="observable.shallow",cv="observable.struct",bd={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(bd);function bo(e){return e||bd}var Fs=Pa(sv),fv=Pa(uv,{enhancer:Ma}),dv=Pa(lv,{enhancer:Bb}),pv=Pa(cv,{enhancer:Rb}),vd=nr(Fs);function vo(e){return e.deep===!0?Qn:e.deep===!1?Ma:yv(e.defaultDecorator)}function hv(e){var t;return e?(t=e.defaultDecorator)!=null?t:md(e):void 0}function yv(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:Qn}function wd(e,t,r){if(Zi(t))return Fs.decorate_20223_(e,t);if(rn(t)){Xi(e,t,Fs);return}return Rn(e)?e:Qt(e)?Le.object(e,t,r):Array.isArray(e)?Le.array(e,t):Hn(e)?Le.map(e,t):fr(e)?Le.set(e,t):typeof e=="object"&&e!==null?e:Le.box(e,t)}ad(wd,vd);var gv={box:function(e,t){var r=bo(t);return new Br(e,vo(r),r.name,!0,r.equals)},array:function(e,t){var r=bo(t);return(X.useProxies===!1||r.proxy===!1?w0:c0)(e,vo(r),r.name)},map:function(e,t){var r=bo(t);return new zd(e,vo(r),r.name)},set:function(e,t){var r=bo(t);return new Kd(e,vo(r),r.name)},object:function(e,t,r){return hn(function(){return Zv(X.useProxies===!1||r?.proxy===!1?ei({},r):s0({},r),e,t)})},ref:nr(fv),shallow:nr(dv),deep:vd,struct:nr(pv)},Le=ad(wd,gv),_d="computed",mv="computed.struct",zs=Cu(_d),bv=Cu(mv,{equals:We.structural}),Ge=function(e,t){if(Zi(t))return zs.decorate_20223_(e,t);if(rn(t))return Xi(e,t,zs);if(Qt(e))return nr(Cu(_d,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=Qt(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Pt(r)};Object.assign(Ge,zs);Ge.struct=nr(bv);var rc,nc,Jo=0,vv=1,wv=(rc=(nc=qo(function(){},"name"))==null?void 0:nc.configurable)!=null?rc:!1,ic={value:"action",configurable:!0,writable:!1,enumerable:!1};function nn(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 Td(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},wv&&(ic.value=e,rr(i,"name",ic)),i}function Td(e,t,r,n,i){var o=_v(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{Tv(o)}}function _v(e,t,r,n){var i=nt()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):Wo;mt({type:Mu,name:e,object:r,arguments:a})}var s=X.trackingDerivation,u=!t||!s;kt();var l=X.allowStateChanges;u&&(pn(),l=Ua(!0));var f=Nu(!0),p={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:vv++,parentActionId_:Jo};return Jo=p.actionId_,p}function Tv(e){Jo!==e.actionId_&&de(30),Jo=e.parentActionId_,e.error_!==void 0&&(X.suppressReactionErrors=!0),Ba(e.prevAllowStateChanges_),$i(e.prevAllowStateReads_),$t(),e.runAsAction_&&pr(e.prevDerivation_),e.notifySpy_&&bt({time:Date.now()-e.startTime_}),X.suppressReactionErrors=!1}function Ov(e,t){var r=Ua(e);try{return t()}finally{Ba(r)}}function Ua(e){var t=X.allowStateChanges;return X.allowStateChanges=e,t}function Ba(e){X.allowStateChanges=e}var Ev="create",Br=function(e){function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+Rt()),a===void 0&&(a=!0),s===void 0&&(s=We.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&&nt()&&Un({type:Ev,object:u,observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}dd(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=nt();o&&mt({type:Wt,object:this,observableKind:"value",debugObjectName:this.name_,newValue:n,oldValue:i}),this.setNewValue_(n),o&&bt()}},r.prepareNewValue_=function(n){if(tr(this),It(this)){var i=St(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(),Ht(this)&&Jt(this,{type:Wt,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return ro(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}),no(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 fd(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Kr),Av=zr("ObservableValue",Br),Pt=function(){function e(r){this.dependenciesState_=Se.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Se.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new Qo(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Nt.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@"+Rt(),r.set&&(this.setter_=nn(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?We.structural:We.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Uv(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_)Ks(this)&&(this.warnAboutUntrackedRead_(),kt(),this.value_=this.computeValue_(!1),$t());else if(Sd(this),Ks(this)){var r=X.trackingContext;this.keepAlive_&&!r&&(X.trackingContext=this),this.trackAndCompute()&&Pv(this),X.trackingContext=r}var n=this.value_;if(Ao(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_===Se.NOT_TRACKING_,i=this.computeValue_(!0),o=n||Ao(r)||Ao(i)||!this.equals_(r,i);return o&&(this.value_=i,nt()&&Un({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing=!0;var n=Ua(!1),i;if(r)i=Od(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 Qo(o)}return Ba(n),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(Gs(this),this.value_=void 0,this.isTracing_!==Nt.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 Ut(function(){var s=i.get();if(!o||n){var u=pn();r({observableKind:"computed",debugObjectName:i.name_,type:Wt,object:i,newValue:s,oldValue:a}),pr(u)}o=!1,a=s})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==Nt.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 fd(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Jn(e,[{key:"isComputing",get:function(){return yt(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=gt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return yt(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=gt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return yt(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=gt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return yt(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=gt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return yt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=gt(this.flags_,e.diffValueMask_,r===1)}}])}();Pt.isComputingMask_=1;Pt.isRunningSetterMask_=2;Pt.isBeingObservedMask_=4;Pt.isPendingUnobservationMask_=8;Pt.diffValueMask_=16;var to=zr("ComputedValue",Pt),Se;(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_"})(Se||(Se={}));var Nt;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Nt||(Nt={}));var Qo=function(e){this.cause=void 0,this.cause=e};function Ao(e){return e instanceof Qo}function Ks(e){switch(e.dependenciesState_){case Se.UP_TO_DATE_:return!1;case Se.NOT_TRACKING_:case Se.STALE_:return!0;case Se.POSSIBLY_STALE_:{for(var t=Nu(!0),r=pn(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(to(a)){if(X.disableErrorBoundaries)a.get();else try{a.get()}catch{return pr(r),$i(t),!0}if(e.dependenciesState_===Se.STALE_)return pr(r),$i(t),!0}}return Ed(e),pr(r),$i(t),!1}}}function xv(){return X.trackingDerivation!==null}function tr(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 Iv(e){!X.allowStateReads&&X.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Od(e,t,r){var n=Nu(!0);Ed(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 Qo(a)}return X.inBatch--,X.trackingDerivation=i,kv(e),Sv(e),$i(n),o}function Sv(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 kv(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=Se.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&&xd(u,e),u.diffValue=0}for(;i--;){var l=r[i];l.diffValue===1&&(l.diffValue=0,Mv(l,e))}n!==Se.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function Gs(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)xd(t[r],e);e.dependenciesState_=Se.NOT_TRACKING_}function De(e){var t=pn();try{return e()}finally{pr(t)}}function pn(){var e=X.trackingDerivation;return X.trackingDerivation=null,e}function pr(e){X.trackingDerivation=e}function Nu(e){var t=X.allowStateReads;return X.allowStateReads=e,t}function $i(e){X.allowStateReads=e}function Ed(e){if(e.dependenciesState_!==Se.UP_TO_DATE_){e.dependenciesState_=Se.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=Se.UP_TO_DATE_}}var xo=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},Io=!0,Ad=!1,X=function(){var e=ka();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Io=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new xo().version&&(Io=!1),Io?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new xo):(setTimeout(function(){Ad||de(35)},1),new xo)}();function $v(){if((X.pendingReactions.length||X.inBatch||X.isRunningReactions)&&de(36),Ad=!0,Io){var e=ka();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),X=new xo}}function jv(){return X}function Cv(e){return e.observers_&&e.observers_.size>0}function Nv(e){return e.observers_}function Mv(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function xd(e,t){e.observers_.delete(t),e.observers_.size===0&&Id(e)}function Id(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,X.pendingUnobservations.push(e))}function kt(){X.inBatch++}function $t(){if(--X.inBatch===0){Cd();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 Pt&&r.suspend_())}X.pendingUnobservations=[]}}function Sd(e){Iv(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&&Id(e),!1)}function kd(e){e.lowestObserverState_!==Se.STALE_&&(e.lowestObserverState_=Se.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Se.UP_TO_DATE_&&(t.isTracing_!==Nt.NONE&&$d(t,e),t.onBecomeStale_()),t.dependenciesState_=Se.STALE_}))}function Pv(e){e.lowestObserverState_!==Se.STALE_&&(e.lowestObserverState_=Se.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Se.POSSIBLY_STALE_?(t.dependenciesState_=Se.STALE_,t.isTracing_!==Nt.NONE&&$d(t,e)):t.dependenciesState_===Se.UP_TO_DATE_&&(e.lowestObserverState_=Se.UP_TO_DATE_)}))}function Uv(e){e.lowestObserverState_===Se.UP_TO_DATE_&&(e.lowestObserverState_=Se.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Se.UP_TO_DATE_&&(t.dependenciesState_=Se.POSSIBLY_STALE_,t.onBecomeStale_())}))}function $d(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Nt.BREAK){var r=[];jd(Da(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 Pt?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
19
|
+
|
|
20
|
+
The dependencies for this derivation are:
|
|
21
|
+
|
|
22
|
+
`+r.join(`
|
|
23
|
+
`)+`
|
|
24
|
+
*/
|
|
25
|
+
`)()}}function jd(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 jd(n,t,r+1)})}var ir=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+Rt()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Se.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Nt.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),Cd())},t.runReaction_=function(){if(!this.isDisposed){kt(),this.isScheduled=!1;var r=X.trackingContext;if(X.trackingContext=this,Ks(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&nt()&&Un({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}X.trackingContext=r,$t()}},t.track=function(r){if(!this.isDisposed){kt();var n=nt(),i;n&&(i=Date.now(),mt({name:this.name_,type:"reaction"})),this.isRunning=!0;var o=X.trackingContext;X.trackingContext=this;var a=Od(this,r,void 0);X.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Gs(this),Ao(a)&&this.reportExceptionInDerivation_(a.cause),n&&bt({time:Date.now()-i}),$t()}},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),nt()&&Un({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||(kt(),Gs(this),$t()))},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),Vd(this,r)},Jn(e,[{key:"isDisposed",get:function(){return yt(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=gt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return yt(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=gt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return yt(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=gt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return yt(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=gt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return yt(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=gt(this.flags_,e.diffValueMask_,r===1)}}])}();ir.isDisposedMask_=1;ir.isScheduledMask_=2;ir.isTrackPendingMask_=4;ir.isRunningMask_=8;ir.diffValueMask_=16;var oc=100,qs=function(e){return e()};function Cd(){X.inBatch>0||X.isRunningReactions||qs(Bv)}function Bv(){X.isRunningReactions=!0;for(var e=X.pendingReactions,t=0;e.length>0;){++t===oc&&(console.error("Reaction doesn't converge to a stable state after "+oc+" 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 Yo=zr("Reaction",ir);function Rv(e){var t=qs;qs=function(r){return e(function(){return t(r)})}}function nt(){return!!X.spyListeners.length}function Un(e){if(X.spyListeners.length)for(var t=X.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function mt(e){var t=yr({},e,{spyReportStart:!0});Un(t)}var Dv={type:"report-end",spyReportEnd:!0};function bt(e){Un(e?yr({},e,{type:"report-end",spyReportEnd:!0}):Dv)}function Lv(e){return X.spyListeners.push(e),$u(function(){X.spyListeners=X.spyListeners.filter(function(t){return t!==e})})}var Mu="action",Vv="action.bound",Nd="autoAction",Fv="autoAction.bound",Md="<unnamed action>",Ws=eo(Mu),zv=eo(Vv,{bound:!0}),Hs=eo(Nd,{autoAction:!0}),Kv=eo(Fv,{autoAction:!0,bound:!0});function Pd(e){var t=function(r,n){if(Fe(r))return nn(r.name||Md,r,e);if(Fe(n))return nn(r,n,e);if(Zi(n))return(e?Hs:Ws).decorate_20223_(r,n);if(rn(n))return Xi(r,n,e?Hs:Ws);if(rn(r))return nr(eo(e?Nd:Mu,{name:r,autoAction:e}));de("Invalid arguments for `action`")};return t}var jt=Pd(!1);Object.assign(jt,Ws);var Pi=Pd(!0);Object.assign(Pi,Hs);jt.bound=nr(zv);Pi.bound=nr(Kv);function Ui(e){return Td(e.name||Md,!1,e,this,void 0)}function on(e){return Fe(e)&&e.isMobxAction===!0}function Ut(e,t){var r,n,i,o;t===void 0&&(t=ku),Fe(e)||de("Autorun expects a function as first argument"),on(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@"+Rt(),s=!t.scheduler&&!t.delay,u;if(s)u=new ir(a,function(){this.track(p)},t.onError,t.requiresObservable);else{var l=Ud(t),f=!1;u=new ir(a,function(){f||(f=!0,l(function(){f=!1,u.isDisposed||u.track(p)}))},t.onError,t.requiresObservable)}function p(){e(u)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||u.schedule_(),u.getDisposer_((o=t)==null?void 0:o.signal)}var Gv=function(e){return e()};function Ud(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Gv}function qv(e,t,r){var n,i,o;r===void 0&&(r=ku),(!Fe(e)||!Fe(t))&&de("First and second argument to reaction should be functions"),Qt(r)||de("Third argument of reactions should be an object");var a=(n=r.name)!=null?n:"Reaction@"+Rt(),s=jt(a,r.onError?Wv(r.onError,t):t),u=!r.scheduler&&!r.delay,l=Ud(r),f=!0,p=!1,S,O=r.compareStructural?We.structural:r.equals||We.default,T=new ir(a,function(){f||u?L():p||(p=!0,l(L))},r.onError,r.requiresObservable);function L(){if(p=!1,!T.isDisposed){var H=!1,U=S;T.track(function(){var k=Ov(!1,function(){return e(T)});H=f||!O(S,k),S=k}),(f&&r.fireImmediately||!f&&H)&&s(S,U,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 Wv(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var Hv="onBO",Jv="onBUO";function Ra(e,t,r){return Bd(Hv,e,t,r)}function Yn(e,t,r){return Bd(Jv,e,t,r)}function Bd(e,t,r,n){var i=typeof n=="function"?Yt(t,r):Yt(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 Qv="never",wo="always",Yv="observed";function Xv(e){e.isolateGlobalState===!0&&$v();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(X.useProxies=t===wo?!0:t===Qv?!1:typeof Proxy<"u"),t==="ifavailable"&&(X.verifyProxies=!0),r!==void 0){var n=r===wo?wo:r===Yv;X.enforceActions=n,X.allowStateChanges=!(n===!0||n===wo)}["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&&Rv(e.reactionScheduler)}function Zv(e,t,r,n){arguments.length>4&&de("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&de("'extendObservable' expects an object as first argument"),sr(e)&&de("'extendObservable' should not be used on maps, use map.merge instead"),Qt(t)||de("'extendObservable' only accepts plain objects as second argument"),(Rn(t)||Rn(r))&&de("Extending an object with another observable (object) is not supported");var i=Ib(t);return hn(function(){var o=ei(e,n)[we];Ca(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function Da(e,t){return Rd(Yt(e,t))}function Rd(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=e0(e.observing_).map(Rd)),t}function Xo(e,t){return Dd(Yt(e,t))}function Dd(e){var t={name:e.name_};return Cv(e)&&(t.observers=Array.from(Nv(e)).map(Dd)),t}function e0(e){return Array.from(new Set(e))}var t0=0;function Ld(){this.message="FLOW_CANCELLED"}Ld.prototype=Object.create(Error.prototype);var ys=yd("flow"),r0=yd("flow.bound",{bound:!0}),Bn=Object.assign(function(e,t){if(Zi(t))return ys.decorate_20223_(e,t);if(rn(t))return Xi(e,t,ys);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=++t0,u=jt(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,p=new Promise(function(S,O){var T=0;l=O;function L(k){f=void 0;var F;try{F=jt(n+" - runid: "+s+" - yield "+T++,u.next).call(u,k)}catch(G){return O(G)}U(F)}function H(k){f=void 0;var F;try{F=jt(n+" - runid: "+s+" - yield "+T++,u.throw).call(u,k)}catch(G){return O(G)}U(F)}function U(k){if(Fe(k?.then)){k.then(U,O);return}return k.done?S(k.value):(f=Promise.resolve(k.value),f.then(L,H))}L(void 0)});return p.cancel=jt(n+" - runid: "+s+" - cancel",function(){try{f&&ac(f);var S=u.return(void 0),O=Promise.resolve(S.value);O.then(Nn,Nn),ac(O),l(new Ld)}catch(T){l(T)}}),p};return i.isMobXFlow=!0,i},ys);Bn.bound=nr(r0);function ac(e){Fe(e.cancel)&&e.cancel()}function Bi(e){return e?.isMobXFlow===!0}function n0(e,t){return e?t!==void 0?sr(e)||Zn(e)?de("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):an(e)?e[we].values_.has(t):!1:an(e)||!!e[we]||ju(e)||Yo(e)||to(e):!1}function Rn(e){return arguments.length!==1&&de("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),n0(e)}function i0(e){if(an(e))return e[we].ownKeys_();de(38)}function _o(e,t,r){return e.set(t,r),r}function jn(e,t){if(e==null||typeof e!="object"||e instanceof Date||!Rn(e))return e;if(Av(e)||to(e))return jn(e.get(),t);if(t.has(e))return t.get(e);if(Zn(e)){var r=_o(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=jn(a,t)}),r}if(Gt(e)){var n=_o(t,e,new Set);return e.forEach(function(a){n.add(jn(a,t))}),n}if(sr(e)){var i=_o(t,e,new Map);return e.forEach(function(a,s){i.set(s,jn(a,t))}),i}else{var o=_o(t,e,{});return i0(e).forEach(function(a){Yi.propertyIsEnumerable.call(e,a)&&(o[a]=jn(e[a],t))}),o}}function hr(e,t){return t&&de("toJS no longer supports options"),jn(e,new Map)}function Vd(){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=o0(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_===Nt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?Nt.BREAK:Nt.LOG}function o0(e){switch(e.length){case 0:return X.trackingDerivation;case 1:return Yt(e[0]);case 2:return Yt(e[0],e[1])}}function dr(e,t){t===void 0&&(t=void 0),kt();try{return e.apply(t)}finally{$t()}}function Qr(e){return e[we]}var a0={has:function(e,t){return X.trackingDerivation&&vi("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),Qr(e).has_(t)},get:function(e,t){return Qr(e).get_(t)},set:function(e,t,r){var n;return rn(t)?(Qr(e).values_.has(t)||vi("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(n=Qr(e).set_(t,r,!0))!=null?n:!0):!1},deleteProperty:function(e,t){var r;return vi("delete properties from an observable object. Use 'remove' from 'mobx' instead."),rn(t)?(r=Qr(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return vi("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(n=Qr(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return X.trackingDerivation&&vi("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),Qr(e).ownKeys_()},preventExtensions:function(e){de(13)}};function s0(e,t){var r,n;return sd(),e=ei(e,t),(n=(r=e[we]).proxy_)!=null?n:r.proxy_=new Proxy(e,a0)}function It(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function ro(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),$u(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function St(e,t){var r=pn();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{pr(r)}}function Ht(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function no(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),$u(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Jt(e,t){var r=pn(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);pr(r)}}function Xn(e,t,r){return hn(function(){var n,i=ei(e,r)[we];t&&e[ht]&&de("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=Cb(e)),Ca(t).forEach(function(o){return i.make_(o,t[o])})}),e}var sc="splice",Wt="update",u0=1e4,l0={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)):Ct(Zo,t)?Zo[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)}},Pu=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+Rt()),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 Kr(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 ro(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}),no(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&&Wd(r+n+1)},t.spliceWithArray_=function(r,n,i){var o=this;tr(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=Wo),It(this)){var s=St(this,{object:this.proxy_,type:sc,index:r,removedCount:n,added:i});if(!s)return Wo;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<u0){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_&&nt(),a=Ht(this),s=a||o?{observableKind:"array",object:this.proxy_,type:Wt,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;o&&mt(s),this.atom_.reportChanged(),a&&Jt(this,s),o&&bt()},t.notifyArraySplice_=function(r,n,i){var o=!this.owned_&&nt(),a=Ht(this),s=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:sc,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;o&&mt(s),this.atom_.reportChanged(),a&&Jt(this,s),o&&bt()},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){tr(this.atom_);var o=i[r];if(It(this)){var a=St(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 c0(e,t,r,n){return r===void 0&&(r="ObservableArray@"+Rt()),n===void 0&&(n=!1),sd(),hn(function(){var i=new Pu(r,t,n,!1);ld(i.values_,we,i);var o=new Proxy(i.values_,l0);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var Zo={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}};Ue("at",vt);Ue("concat",vt);Ue("flat",vt);Ue("includes",vt);Ue("indexOf",vt);Ue("join",vt);Ue("lastIndexOf",vt);Ue("slice",vt);Ue("toString",vt);Ue("toLocaleString",vt);Ue("toSorted",vt);Ue("toSpliced",vt);Ue("with",vt);Ue("every",Zt);Ue("filter",Zt);Ue("find",Zt);Ue("findIndex",Zt);Ue("findLast",Zt);Ue("findLastIndex",Zt);Ue("flatMap",Zt);Ue("forEach",Zt);Ue("map",Zt);Ue("some",Zt);Ue("toReversed",Zt);Ue("reduce",Fd);Ue("reduceRight",Fd);function Ue(e,t){typeof Array.prototype[e]=="function"&&(Zo[e]=t(e))}function vt(e){return function(){var t=this[we];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function Zt(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 Fd(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 f0=zr("ObservableArrayAdministration",Pu);function Zn(e){return $a(e)&&f0(e[we])}var d0={},Pr="add",ea="delete",zd=function(){function e(r,n,i){var o=this;n===void 0&&(n=Qn),i===void 0&&(i="ObservableMap@"+Rt()),this.enhancer_=void 0,this.name_=void 0,this[we]=d0,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),hn(function(){o.keysAtom_=pd(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),Ma,this.name_+"."+Ls(r)+"?",!1);this.hasMap_.set(r,o),Yn(o,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(It(this)){var o=St(this,{type:i?Wt:Pr,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(tr(this.keysAtom_),It(this)){var i=St(this,{type:ea,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=nt(),a=Ht(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:ea,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&mt(s),dr(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&&Jt(this,s),o&&bt(),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==X.UNCHANGED){var o=nt(),a=Ht(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Wt,object:this,oldValue:i.value_,name:r,newValue:n}:null;o&&mt(s),i.setNewValue_(n),a&&Jt(this,s),o&&bt()}},t.addValue_=function(r,n){var i=this;tr(this.keysAtom_),dr(function(){var u,l=new Br(n,i.enhancer_,i.name_+"."+Ls(r),!1);i.data_.set(r,l),n=l.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=nt(),a=Ht(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Pr,object:this,name:r,newValue:n}:null;o&&mt(s),a&&Jt(this,s),o&&bt()},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 uc({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 uc({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 sr(r)&&(r=new Map(r)),dr(function(){Qt(r)?xb(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)}):Hn(r)?(Ab(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;dr(function(){De(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 dr(function(){for(var i=p0(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 p=n.data_.get(l);o.set(l,p)}}}for(var S=Mn(i.entries()),O;!(O=S()).done;){var T=O.value,L=T[0],H=T[1],U=n.data_.has(L);if(n.set(L,H),n.data_.has(L)){var k=n.data_.get(L);o.set(L,k),U||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var F=n.data_.keys(),G=o.keys(),B=F.next(),Y=G.next();!B.done;){if(B.value!==Y.value){n.keysAtom_.reportChanged();break}B=F.next(),Y=G.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."),no(this,r)},t.intercept_=function(r){return ro(this,r)},Jn(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),sr=zr("ObservableMap",zd);function uc(e){return e[Symbol.toStringTag]="MapIterator",Du(e)}function p0(e){if(Hn(e)||sr(e))return e;if(Array.isArray(e))return new Map(e);if(Qt(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return de(21,e)}var h0={},Kd=function(){function e(r,n,i){var o=this;n===void 0&&(n=Qn),i===void 0&&(i="ObservableSet@"+Rt()),this.name_=void 0,this[we]=h0,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)},hn(function(){o.atom_=pd(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;dr(function(){De(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(tr(this.atom_),It(this)){var i=St(this,{type:Pr,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){dr(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var o=nt(),a=Ht(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:Pr,object:this,newValue:r}:null;o&&mt(s),a&&Jt(this,s),o&&bt()}return this},t.delete=function(r){var n=this;if(It(this)){var i=St(this,{type:ea,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=nt(),a=Ht(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:ea,object:this,oldValue:r}:null;return o&&mt(s),dr(function(){n.atom_.reportChanged(),n.data_.delete(r)}),a&&Jt(this,s),o&&bt(),!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 lc({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 lc({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(fr(r)&&!Gt(r))return r.intersection(this);var n=new Set(this);return n.intersection(r)},t.union=function(r){if(fr(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(fr(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(fr(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)),dr(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):fr(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."),no(this,r)},t.intercept_=function(r){return ro(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Jn(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Gt=zr("ObservableSet",Kd);function lc(e){return e[Symbol.toStringTag]="SetIterator",Du(e)}var cc=Object.create(null),fc="remove",Js=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=nv),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 Kr(this.name_+".keys"),this.isPlainObject_=Qt(this.target_),Hd(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 Pt)return i.set(n),!0;if(It(this)){var o=St(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=Ht(this),s=nt(),u=a||s?{type:Wt,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;s&&mt(u),i.setNewValue_(n),a&&Jt(this,u),s&&bt()}return!0},t.get_=function(r){return X.trackingDerivation&&!Ct(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Ct(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_,Ma,this.name_+"."+Ls(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(hc(this,n,r),!(r in this.target_)){var i;if((i=this.target_[ht])!=null&&i[r])return;de(1,n.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==Yi;){var a=qo(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}pc(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);hc(this,i,r);var a=i.extend_(this,r,n,o);return a&&pc(this,i,r),a},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),tr(this.keysAtom_);try{kt();var o=this.delete_(r);if(!o)return o;if(It(this)){var a=St(this,{object:this.proxy_||this.target_,name:r,type:Pr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=yr({},n,{value:s}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else rr(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{$t()}return!0},t.defineObservableProperty_=function(r,n,i,o){o===void 0&&(o=!1),tr(this.keysAtom_);try{kt();var a=this.delete_(r);if(!a)return a;if(It(this)){var s=St(this,{object:this.proxy_||this.target_,name:r,type:Pr,newValue:n});if(!s)return null;n=s.newValue}var u=dc(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 rr(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{$t()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),tr(this.keysAtom_);try{kt();var o=this.delete_(r);if(!o)return o;if(It(this)){var a=St(this,{object:this.proxy_||this.target_,name:r,type:Pr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=dc(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 rr(this.target_,r,u);this.values_.set(r,new Pt(n)),this.notifyPropertyAddition_(r,void 0)}finally{$t()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),tr(this.keysAtom_),!Ct(this.target_,r))return!0;if(It(this)){var i=St(this,{object:this.proxy_||this.target_,name:r,type:fc});if(!i)return null}try{var o;kt();var a=Ht(this),s=nt(),u=this.values_.get(r),l=void 0;if(!u&&(a||s)){var f;l=(f=qo(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_),kd(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),a||s){var p={type:fc,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:r};s&&mt(p),a&&Jt(this,p),s&&bt()}}finally{$t()}return!0},t.observe_=function(r,n){return n===!0&&de("`observe` doesn't support the fire immediately property for observable objects."),no(this,r)},t.intercept_=function(r){return ro(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o=Ht(this),a=nt();if(o||a){var s=o||a?{type:Pr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;a&&mt(s),o&&Jt(this,s),a&&bt()}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Ca(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function ei(e,t){var r;if(t&&an(e)&&de("Options can't be provided for already observable objects."),Ct(e,we))return Bu(e)instanceof Js||de("Cannot convert '"+ta(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:(Qt(e)?"ObservableObject":e.constructor.name)+"@"+Rt(),i=new Js(e,new Map,String(n),hv(t));return ja(e,we,i),e}var y0=zr("ObservableObjectAdministration",Js);function dc(e){return cc[e]||(cc[e]={get:function(){return this[we].getObservablePropValue_(e)},set:function(t){return this[we].setObservablePropValue_(e,t)}})}function an(e){return $a(e)?y0(e[we]):!1}function pc(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[ht])==null||delete n[r]}function hc(e,t,r){if(Hd(t)||de("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!Ho(t)&&Ct(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 g0=qd(0),m0=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),gs=0,Gd=function(){};function b0(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}b0(Gd,Array.prototype);var Uu=function(e){function t(n,i,o,a){var s;return o===void 0&&(o="ObservableArray@"+Rt()),a===void 0&&(a=!1),s=e.call(this)||this,hn(function(){var u=new Pu(o,i,a,!0);u.proxy_=s,ld(s,we,u),n&&n.length&&s.spliceWithArray(0,0,n),m0&&Object.defineProperty(s,"0",g0)}),s}dd(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 Zn(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return Du({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},Jn(t,[{key:"length",get:function(){return this[we].getArrayLength_()},set:function(n){this[we].setArrayLength_(n)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Gd);Object.entries(Zo).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&ja(Uu.prototype,t,r)});function qd(e){return{enumerable:!1,configurable:!0,get:function(){return this[we].get_(e)},set:function(t){this[we].set_(e,t)}}}function v0(e){rr(Uu.prototype,""+e,qd(e))}function Wd(e){if(e>gs){for(var t=gs;t<e+100;t++)v0(t);gs=e}}Wd(1e3);function w0(e,t,r){return new Uu(e,t,r)}function Yt(e,t){if(typeof e=="object"&&e!==null){if(Zn(e))return t!==void 0&&de(23),e[we].atom_;if(Gt(e))return e.atom_;if(sr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||de(25,t,ta(e)),r}if(an(e)){if(!t)return de(26);var n=e[we].values_.get(t);return n||de(27,t,ta(e)),n}if(ju(e)||to(e)||Yo(e))return e}else if(Fe(e)&&Yo(e[we]))return e[we];de(28)}function Bu(e,t){if(e||de(29),t!==void 0)return Bu(Yt(e,t));if(ju(e)||to(e)||Yo(e)||sr(e)||Gt(e))return e;if(e[we])return e[we];de(24,e)}function ta(e,t){var r;if(t!==void 0)r=Yt(e,t);else{if(on(e))return e.name;an(e)||sr(e)||Gt(e)?r=Bu(e):r=Yt(e)}return r.name_}function hn(e){var t=pn(),r=Ua(!0);kt();try{return e()}finally{$t(),Ba(r),pr(t)}}var yc=Yi.toString;function Ru(e,t,r){return r===void 0&&(r=-1),Qs(e,t,r)}function Qs(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=yc.call(e);if(a!==yc.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=gc(e),t=gc(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(!Qs(e[f],t[f],r-1,n,i))return!1}else{var p=Object.keys(e),S=p.length;if(Object.keys(t).length!==S)return!1;for(var O=0;O<S;O++){var T=p[O];if(!(Ct(t,T)&&Qs(e[T],t[T],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function gc(e){return Zn(e)?e.slice():Hn(e)||sr(e)||fr(e)||Gt(e)?Array.from(e.entries()):e}var mc,_0=((mc=ka().Iterator)==null?void 0:mc.prototype)||{};function Du(e){return e[Symbol.iterator]=T0,Object.assign(Object.create(_0),e)}function T0(){return this}function Hd(e){return e instanceof Object&&typeof e.annotationType_=="string"&&Fe(e.make_)&&Fe(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=ka();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:Lv,extras:{getDebugName:ta},$mobx:we});var O0=Object.create,Lu=Object.defineProperty,E0=Object.getOwnPropertyDescriptor,Jd=Object.getOwnPropertyNames,A0=Object.getPrototypeOf,x0=Object.prototype.hasOwnProperty,Ye=(e,t)=>function(){return t||(0,e[Jd(e)[0]])((t={exports:{}}).exports,t),t.exports},Qd=(e,t)=>{for(var r in t)Lu(e,r,{get:t[r],enumerable:!0})},I0=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Jd(t))!x0.call(e,i)&&i!==r&&Lu(e,i,{get:()=>t[i],enumerable:!(n=E0(t,i))||n.enumerable});return e},wr=(e,t,r)=>(r=e!=null?O0(A0(e)):{},I0(t||!e||!e.__esModule?Lu(r,"default",{value:e,enumerable:!0}):r,e)),Gr=Ye({"../../../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(d){let w=new Map;function x(){return new Map(w)}d.Entries=x;function P(){return w.clear()}d.Clear=P;function j(_){return w.delete(_)}d.Delete=j;function N(_){return w.has(_)}d.Has=N;function g(_,c){w.set(_,c)}d.Set=g;function A(_){return w.get(_)}d.Get=A})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(d){super(d)}};e.TypeBoxError=r;var n;(function(d){let w=new Map;function x(){return new Map(w)}d.Entries=x;function P(){return w.clear()}d.Clear=P;function j(_){return w.delete(_)}d.Delete=j;function N(_){return w.has(_)}d.Has=N;function g(_,c){w.set(_,c)}d.Set=g;function A(_){return w.get(_)}d.Get=A})(n||(e.FormatRegistry=n={}));var i;(function(d){function w(v){return Array.isArray(v)}d.IsArray=w;function x(v){return typeof v=="bigint"}d.IsBigInt=x;function P(v){return typeof v=="boolean"}d.IsBoolean=P;function j(v){return v instanceof globalThis.Date}d.IsDate=j;function N(v){return v===null}d.IsNull=N;function g(v){return typeof v=="number"}d.IsNumber=g;function A(v){return typeof v=="object"&&v!==null}d.IsObject=A;function _(v){return typeof v=="string"}d.IsString=_;function c(v){return v instanceof globalThis.Uint8Array}d.IsUint8Array=c;function E(v){return v===void 0}d.IsUndefined=E})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var a;(function(d){function w(m){try{return new RegExp(m),!0}catch{return!1}}function x(m){if(!i.IsString(m))return!1;for(let Me=0;Me<m.length;Me++){let Tt=m.charCodeAt(Me);if(Tt>=7&&Tt<=13||Tt===27||Tt===127)return!1}return!0}function P(m){return g(m)||Je(m)}function j(m){return i.IsUndefined(m)||i.IsBigInt(m)}function N(m){return i.IsUndefined(m)||i.IsNumber(m)}function g(m){return i.IsUndefined(m)||i.IsBoolean(m)}function A(m){return i.IsUndefined(m)||i.IsString(m)}function _(m){return i.IsUndefined(m)||i.IsString(m)&&x(m)&&w(m)}function c(m){return i.IsUndefined(m)||i.IsString(m)&&x(m)}function E(m){return i.IsUndefined(m)||Je(m)}function v(m){return Te(m,"Any")&&A(m.$id)}d.TAny=v;function b(m){return Te(m,"Array")&&m.type==="array"&&A(m.$id)&&Je(m.items)&&N(m.minItems)&&N(m.maxItems)&&g(m.uniqueItems)&&E(m.contains)&&N(m.minContains)&&N(m.maxContains)}d.TArray=b;function M(m){return Te(m,"AsyncIterator")&&m.type==="AsyncIterator"&&A(m.$id)&&Je(m.items)}d.TAsyncIterator=M;function W(m){return Te(m,"BigInt")&&m.type==="bigint"&&A(m.$id)&&j(m.exclusiveMaximum)&&j(m.exclusiveMinimum)&&j(m.maximum)&&j(m.minimum)&&j(m.multipleOf)}d.TBigInt=W;function ne(m){return Te(m,"Boolean")&&m.type==="boolean"&&A(m.$id)}d.TBoolean=ne;function ie(m){return Te(m,"Constructor")&&m.type==="Constructor"&&A(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Me=>Je(Me))&&Je(m.returns)}d.TConstructor=ie;function ve(m){return Te(m,"Date")&&m.type==="Date"&&A(m.$id)&&N(m.exclusiveMaximumTimestamp)&&N(m.exclusiveMinimumTimestamp)&&N(m.maximumTimestamp)&&N(m.minimumTimestamp)&&N(m.multipleOfTimestamp)}d.TDate=ve;function Ee(m){return Te(m,"Function")&&m.type==="Function"&&A(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Me=>Je(Me))&&Je(m.returns)}d.TFunction=Ee;function Be(m){return Te(m,"Integer")&&m.type==="integer"&&A(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}d.TInteger=Be;function ze(m){return Te(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Me=>Je(Me)&&!yi(Me))&&A(m.type)&&(g(m.unevaluatedProperties)||E(m.unevaluatedProperties))&&A(m.$id)}d.TIntersect=ze;function qr(m){return Te(m,"Iterator")&&m.type==="Iterator"&&A(m.$id)&&Je(m.items)}d.TIterator=qr;function Te(m,Me){return Or(m)&&m[e.Kind]===Me}d.TKindOf=Te;function Or(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}d.TKind=Or;function Wr(m){return C(m)&&i.IsString(m.const)}d.TLiteralString=Wr;function I(m){return C(m)&&i.IsNumber(m.const)}d.TLiteralNumber=I;function pe(m){return C(m)&&i.IsBoolean(m.const)}d.TLiteralBoolean=pe;function C(m){return Te(m,"Literal")&&A(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}d.TLiteral=C;function _e(m){return Te(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}d.TNever=_e;function ae(m){return Te(m,"Not")&&Je(m.not)}d.TNot=ae;function he(m){return Te(m,"Null")&&m.type==="null"&&A(m.$id)}d.TNull=he;function Ne(m){return Te(m,"Number")&&m.type==="number"&&A(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}d.TNumber=Ne;function Ke(m){return Te(m,"Object")&&m.type==="object"&&A(m.$id)&&i.IsObject(m.properties)&&P(m.additionalProperties)&&N(m.minProperties)&&N(m.maxProperties)&&Object.entries(m.properties).every(([Me,Tt])=>x(Me)&&Je(Tt))}d.TObject=Ke;function lt(m){return Te(m,"Promise")&&m.type==="Promise"&&A(m.$id)&&Je(m.item)}d.TPromise=lt;function it(m){return Te(m,"Record")&&m.type==="object"&&A(m.$id)&&P(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Me=>{let Tt=Object.getOwnPropertyNames(Me.patternProperties);return Tt.length===1&&w(Tt[0])&&i.IsObject(Me.patternProperties)&&Je(Me.patternProperties[Tt[0]])})(m)}d.TRecord=it;function ft(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}d.TRecursive=ft;function Er(m){return Te(m,"Ref")&&A(m.$id)&&i.IsString(m.$ref)}d.TRef=Er;function In(m){return Te(m,"String")&&m.type==="string"&&A(m.$id)&&N(m.minLength)&&N(m.maxLength)&&_(m.pattern)&&c(m.format)}d.TString=In;function Sn(m){return Te(m,"Symbol")&&m.type==="symbol"&&A(m.$id)}d.TSymbol=Sn;function Hr(m){return Te(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}d.TTemplateLiteral=Hr;function yo(m){return Te(m,"This")&&A(m.$id)&&i.IsString(m.$ref)}d.TThis=yo;function yi(m){return i.IsObject(m)&&e.Transform in m}d.TTransform=yi;function He(m){return Te(m,"Tuple")&&m.type==="array"&&A(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(Me=>Je(Me)))}d.TTuple=He;function go(m){return Te(m,"Undefined")&&m.type==="undefined"&&A(m.$id)}d.TUndefined=go;function ss(m){return Jr(m)&&m.anyOf.every(Me=>Wr(Me)||I(Me))}d.TUnionLiteral=ss;function Jr(m){return Te(m,"Union")&&A(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Me=>Je(Me))}d.TUnion=Jr;function kn(m){return Te(m,"Uint8Array")&&m.type==="Uint8Array"&&A(m.$id)&&N(m.minByteLength)&&N(m.maxByteLength)}d.TUint8Array=kn;function ct(m){return Te(m,"Unknown")&&A(m.$id)}d.TUnknown=ct;function mo(m){return Te(m,"Unsafe")}d.TUnsafe=mo;function gi(m){return Te(m,"Void")&&m.type==="void"&&A(m.$id)}d.TVoid=gi;function us(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}d.TReadonly=us;function ls(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}d.TOptional=ls;function Je(m){return i.IsObject(m)&&(v(m)||b(m)||ne(m)||W(m)||M(m)||ie(m)||ve(m)||Ee(m)||Be(m)||ze(m)||qr(m)||C(m)||_e(m)||ae(m)||he(m)||Ne(m)||Ke(m)||lt(m)||it(m)||Er(m)||In(m)||Sn(m)||Hr(m)||yo(m)||He(m)||go(m)||Jr(m)||kn(m)||ct(m)||mo(m)||gi(m)||Or(m)&&t.Has(m[e.Kind]))}d.TSchema=Je})(a||(e.TypeGuard=a={}));var s;(function(d){function w(x){return x[e.Kind]==="Intersect"?x.allOf.every(P=>w(P)):x[e.Kind]==="Union"?x.anyOf.some(P=>w(P)):x[e.Kind]==="Undefined"?!0:x[e.Kind]==="Not"?!w(x.not):!1}d.Check=w})(s||(e.ExtendsUndefined=s={}));var u=class extends r{};e.TypeExtendsError=u;var l;(function(d){d[d.Union=0]="Union",d[d.True=1]="True",d[d.False=2]="False"})(l||(e.TypeExtendsResult=l={}));var f;(function(d){function w(y){return y===l.False?y:l.True}function x(y){throw new u(y)}function P(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function j(y,h){return a.TNever(h)?Te(y,h):a.TIntersect(h)?Ee(y,h):a.TUnion(h)?cs(y,h):a.TUnknown(h)?Ul(y,h):a.TAny(h)?N(y,h):x("StructuralRight")}function N(y,h){return l.True}function g(y,h){return a.TIntersect(h)?Ee(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 A(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)&&Hr(h)?l.True:P(h)?j(y,h):a.TArray(h)?w(Pe(y.items,h.items)):l.False}function c(y,h){return P(h)?j(y,h):a.TAsyncIterator(h)?w(Pe(y.items,h.items)):l.False}function E(y,h){return P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(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 P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(y,h):a.TBoolean(h)?l.True:l.False}function M(y,h){return P(h)?j(y,h):a.TObject(h)?He(y,h):a.TConstructor(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((Ie,lr)=>w(Pe(h.parameters[lr],Ie))===l.True)?w(Pe(y.returns,h.returns)):l.False:l.False}function W(y,h){return P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(y,h):a.TDate(h)?l.True:l.False}function ne(y,h){return P(h)?j(y,h):a.TObject(h)?He(y,h):a.TFunction(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((Ie,lr)=>w(Pe(h.parameters[lr],Ie))===l.True)?w(Pe(y.returns,h.returns)):l.False:l.False}function ie(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:P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(y,h):l.False}function Ee(y,h){return h.allOf.every(Ie=>Pe(y,Ie)===l.True)?l.True:l.False}function Be(y,h){return y.allOf.some(Ie=>Pe(Ie,h)===l.True)?l.True:l.False}function ze(y,h){return P(h)?j(y,h):a.TIterator(h)?w(Pe(y.items,h.items)):l.False}function qr(y,h){return a.TLiteral(h)&&h.const===y.const?l.True:P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(y,h):a.TString(h)?gi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?ie(y,h):a.TBoolean(h)?v(y,h):l.False}function Te(y,h){return l.False}function Or(y,h){return l.True}function Wr(y){let[h,Ie]=[y,0];for(;a.TNot(h);)h=h.not,Ie+=1;return Ie%2===0?h:e.Type.Unknown()}function I(y,h){return a.TNot(y)?Pe(Wr(y),h):a.TNot(h)?Pe(y,Wr(h)):x("Invalid fallthrough for Not")}function pe(y,h){return P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(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 P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(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 Hr(y)}function Ne(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 Ke(y){return ae(y,0)}function lt(y){return ae(y,0)}function it(y){return ae(y,0)}function ft(y){return ae(y,0)}function Er(y){return Hr(y)}function In(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 Sn(y){return ae(y,0)}function Hr(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 yo(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 yi(y,h){return Pe(y,h)===l.False||a.TOptional(y)&&!a.TOptional(h)?l.False:l.True}function He(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)||a.TLiteralString(y)&&he(h)||a.TLiteralNumber(y)&&Ke(h)||a.TLiteralBoolean(y)&<(h)||a.TSymbol(y)&&Ne(h)||a.TBigInt(y)&&it(h)||a.TString(y)&&he(h)||a.TSymbol(y)&&Ne(h)||a.TNumber(y)&&Ke(h)||a.TInteger(y)&&Ke(h)||a.TBoolean(y)&<(h)||a.TUint8Array(y)&&Er(h)||a.TDate(y)&&ft(h)||a.TConstructor(y)&&Sn(h)||a.TFunction(y)&&In(h)?l.True:a.TRecord(y)&&a.TString(Jr(y))?h[e.Hint]==="Record"?l.True:l.False:a.TRecord(y)&&a.TNumber(Jr(y))&&ae(h,0)?l.True:l.False}function go(y,h){return P(h)?j(y,h):a.TRecord(h)?ct(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(yi(y.properties[Ie],h.properties[Ie])===l.False)return l.False}return l.True})():l.False}function ss(y,h){return P(h)?j(y,h):a.TObject(h)&&yo(h)?l.True:a.TPromise(h)?w(Pe(y.item,h.item)):l.False}function Jr(y){return e.PatternNumberExact in y.patternProperties?e.Type.Number():e.PatternStringExact in y.patternProperties?e.Type.String():x("Unknown record key pattern")}function kn(y){return e.PatternNumberExact in y.patternProperties?y.patternProperties[e.PatternNumberExact]:e.PatternStringExact in y.patternProperties?y.patternProperties[e.PatternStringExact]:x("Unable to get record value schema")}function ct(y,h){let[Ie,lr]=[Jr(h),kn(h)];return a.TLiteralString(y)&&a.TNumber(Ie)&&w(Pe(y,lr))===l.True?l.True:a.TUint8Array(y)&&a.TNumber(Ie)||a.TString(y)&&a.TNumber(Ie)||a.TArray(y)&&a.TNumber(Ie)?Pe(y,lr):a.TObject(y)?(()=>{for(let ly of Object.getOwnPropertyNames(y.properties))if(yi(lr,y.properties[ly])===l.False)return l.False;return l.True})():l.False}function mo(y,h){return P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?Pe(kn(y),kn(h)):l.False}function gi(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function us(y,h){return P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(y,h):a.TString(h)?l.True:l.False}function ls(y,h){return P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(y,h):a.TSymbol(h)?l.True:l.False}function Je(y,h){return a.TTemplateLiteral(y)?Pe(B.Resolve(y),h):a.TTemplateLiteral(h)?Pe(y,B.Resolve(h)):x("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 Me(y,h){return a.TNever(y)?l.True:a.TUnknown(y)?l.False:a.TAny(y)?l.Union:l.False}function Tt(y,h){return P(h)?j(y,h):a.TObject(h)&&Hr(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,lr)=>Pe(Ie,h.items[lr])===l.True)?l.True:l.False:l.False}function ry(y,h){return P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(y,h):a.TUint8Array(h)?l.True:l.False}function ny(y,h){return P(h)?j(y,h):a.TObject(h)?He(y,h):a.TRecord(h)?ct(y,h):a.TVoid(h)?ay(y,h):a.TUndefined(h)?l.True:l.False}function cs(y,h){return h.anyOf.some(Ie=>Pe(y,Ie)===l.True)?l.True:l.False}function iy(y,h){return y.anyOf.every(Ie=>Pe(Ie,h)===l.True)?l.True:l.False}function Ul(y,h){return l.True}function oy(y,h){return a.TNever(h)?Te(y,h):a.TIntersect(h)?Ee(y,h):a.TUnion(h)?cs(y,h):a.TAny(h)?N(y,h):a.TString(h)?gi(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?ie(y,h):a.TBoolean(h)?v(y,h):a.TArray(h)?A(y,h):a.TTuple(h)?Me(y,h):a.TObject(h)?He(y,h):a.TUnknown(h)?l.True:l.False}function ay(y,h){return a.TUndefined(y)||a.TUndefined(y)?l.True:l.False}function sy(y,h){return a.TIntersect(h)?Ee(y,h):a.TUnion(h)?cs(y,h):a.TUnknown(h)?Ul(y,h):a.TAny(h)?N(y,h):a.TObject(h)?He(y,h):a.TVoid(h)?l.True:l.False}function Pe(y,h){return a.TTemplateLiteral(y)||a.TTemplateLiteral(h)?Je(y,h):a.TNot(y)||a.TNot(h)?I(y,h):a.TAny(y)?g(y,h):a.TArray(y)?_(y,h):a.TBigInt(y)?E(y,h):a.TBoolean(y)?b(y,h):a.TAsyncIterator(y)?c(y,h):a.TConstructor(y)?M(y,h):a.TDate(y)?W(y,h):a.TFunction(y)?ne(y,h):a.TInteger(y)?ve(y,h):a.TIntersect(y)?Be(y,h):a.TIterator(y)?ze(y,h):a.TLiteral(y)?qr(y,h):a.TNever(y)?Or(y,h):a.TNull(y)?pe(y,h):a.TNumber(y)?_e(y,h):a.TObject(y)?go(y,h):a.TRecord(y)?mo(y,h):a.TString(y)?us(y,h):a.TSymbol(y)?ls(y,h):a.TTuple(y)?Tt(y,h):a.TPromise(y)?ss(y,h):a.TUint8Array(y)?ry(y,h):a.TUndefined(y)?ny(y,h):a.TUnion(y)?iy(y,h):a.TUnknown(y)?oy(y,h):a.TVoid(y)?sy(y,h):x(`Unknown left type operand '${y[e.Kind]}'`)}function uy(y,h){return Pe(y,h)}d.Extends=uy})(f||(e.TypeExtends=f={}));var p;(function(d){function w(_){return _.map(c=>N(c))}function x(_){return new Date(_.getTime())}function P(_){return new Uint8Array(_)}function j(_){let c=Object.getOwnPropertyNames(_).reduce((v,b)=>({...v,[b]:N(_[b])}),{}),E=Object.getOwnPropertySymbols(_).reduce((v,b)=>({...v,[b]:N(_[b])}),{});return{...c,...E}}function N(_){return i.IsArray(_)?w(_):i.IsDate(_)?x(_):i.IsUint8Array(_)?P(_):i.IsObject(_)?j(_):_}function g(_){return _.map(c=>A(c))}d.Rest=g;function A(_,c={}){return{...N(_),...c}}d.Type=A})(p||(e.TypeClone=p={}));var S;(function(d){function w(M){return M.map(W=>{let{[e.Optional]:ne,...ie}=p.Type(W);return ie})}function x(M){return M.every(W=>a.TOptional(W))}function P(M){return M.some(W=>a.TOptional(W))}function j(M){return x(M.allOf)?e.Type.Optional(e.Type.Intersect(w(M.allOf))):M}function N(M){return P(M.anyOf)?e.Type.Optional(e.Type.Union(w(M.anyOf))):M}function g(M){return M[e.Kind]==="Intersect"?j(M):M[e.Kind]==="Union"?N(M):M}function A(M,W){let ne=M.allOf.reduce((ie,ve)=>{let Ee=v(ve,W);return Ee[e.Kind]==="Never"?ie:[...ie,Ee]},[]);return g(e.Type.Intersect(ne))}function _(M,W){let ne=M.anyOf.map(ie=>v(ie,W));return g(e.Type.Union(ne))}function c(M,W){let ne=M.properties[W];return i.IsUndefined(ne)?e.Type.Never():e.Type.Union([ne])}function E(M,W){let ne=M.items;if(i.IsUndefined(ne))return e.Type.Never();let ie=ne[W];return i.IsUndefined(ie)?e.Type.Never():ie}function v(M,W){return M[e.Kind]==="Intersect"?A(M,W):M[e.Kind]==="Union"?_(M,W):M[e.Kind]==="Object"?c(M,W):M[e.Kind]==="Tuple"?E(M,W):e.Type.Never()}function b(M,W,ne={}){let ie=W.map(ve=>v(M,ve.toString()));return g(e.Type.Union(ie,ne))}d.Resolve=b})(S||(e.IndexedAccessor=S={}));var O;(function(d){function w(E){let[v,b]=[E.slice(0,1),E.slice(1)];return`${v.toLowerCase()}${b}`}function x(E){let[v,b]=[E.slice(0,1),E.slice(1)];return`${v.toUpperCase()}${b}`}function P(E){return E.toUpperCase()}function j(E){return E.toLowerCase()}function N(E,v){let b=K.ParseExact(E.pattern);if(!$.Check(b))return{...E,pattern:g(E.pattern,v)};let M=[...z.Generate(b)].map(ie=>e.Type.Literal(ie)),W=A(M,v),ne=e.Type.Union(W);return e.Type.TemplateLiteral([ne])}function g(E,v){return typeof E=="string"?v==="Uncapitalize"?w(E):v==="Capitalize"?x(E):v==="Uppercase"?P(E):v==="Lowercase"?j(E):E:E.toString()}function A(E,v){if(E.length===0)return[];let[b,...M]=E;return[c(b,v),...A(M,v)]}function _(E,v){return a.TTemplateLiteral(E)?N(E,v):a.TUnion(E)?e.Type.Union(A(E.anyOf,v)):a.TLiteral(E)?e.Type.Literal(g(E.const,v)):E}function c(E,v){return _(E,v)}d.Map=c})(O||(e.Intrinsic=O={}));var T;(function(d){function w(g,A){return e.Type.Intersect(g.allOf.map(_=>j(_,A)),{...g})}function x(g,A){return e.Type.Union(g.anyOf.map(_=>j(_,A)),{...g})}function P(g,A){return A(g)}function j(g,A){return g[e.Kind]==="Intersect"?w(g,A):g[e.Kind]==="Union"?x(g,A):g[e.Kind]==="Object"?P(g,A):g}function N(g,A,_){return{...j(p.Type(g),A),..._}}d.Map=N})(T||(e.ObjectMap=T={}));var L;(function(d){function w(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}function x(c,E){return c.allOf.reduce((v,b)=>[...v,...g(b,E)],[])}function P(c,E){let v=c.anyOf.map(b=>g(b,E));return[...v.reduce((b,M)=>M.map(W=>v.every(ne=>ne.includes(W))?b.add(W):b)[0],new Set)]}function j(c,E){return Object.getOwnPropertyNames(c.properties)}function N(c,E){return E.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function g(c,E){return a.TIntersect(c)?x(c,E):a.TUnion(c)?P(c,E):a.TObject(c)?j(c,E):a.TRecord(c)?N(c,E):[]}function A(c,E){return[...new Set(g(c,E))]}d.ResolveKeys=A;function _(c){return`^(${A(c,{includePatterns:!0}).map(E=>`(${w(E)})`).join("|")})$`}d.ResolvePattern=_})(L||(e.KeyResolver=L={}));var H=class extends r{};e.KeyArrayResolverError=H;var U;(function(d){function w(x){return Array.isArray(x)?x:a.TUnionLiteral(x)?x.anyOf.map(P=>P.const.toString()):a.TLiteral(x)?[x.const]:a.TTemplateLiteral(x)?(()=>{let P=K.ParseExact(x.pattern);if(!$.Check(P))throw new H("Cannot resolve keys from infinite template expression");return[...z.Generate(P)]})():[]}d.Resolve=w})(U||(e.KeyArrayResolver=U={}));var k;(function(d){function*w(P){for(let j of P.anyOf)j[e.Kind]==="Union"?yield*w(j):yield j}function x(P){return e.Type.Union([...w(P)],{...P})}d.Resolve=x})(k||(e.UnionResolver=k={}));var F=class extends r{};e.TemplateLiteralPatternError=F;var G;(function(d){function w(N){throw new F(N)}function x(N){return N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P(N,g){return a.TTemplateLiteral(N)?N.pattern.slice(1,N.pattern.length-1):a.TUnion(N)?`(${N.anyOf.map(A=>P(A,g)).join("|")})`:a.TNumber(N)?`${g}${e.PatternNumber}`:a.TInteger(N)?`${g}${e.PatternNumber}`:a.TBigInt(N)?`${g}${e.PatternNumber}`:a.TString(N)?`${g}${e.PatternString}`:a.TLiteral(N)?`${g}${x(N.const.toString())}`:a.TBoolean(N)?`${g}${e.PatternBoolean}`:w(`Unexpected Kind '${N[e.Kind]}'`)}function j(N){return`^${N.map(g=>P(g,"")).join("")}$`}d.Create=j})(G||(e.TemplateLiteralPattern=G={}));var B;(function(d){function w(x){let P=K.ParseExact(x.pattern);if(!$.Check(P))return e.Type.String();let j=[...z.Generate(P)].map(N=>e.Type.Literal(N));return e.Type.Union(j)}d.Resolve=w})(B||(e.TemplateLiteralResolver=B={}));var Y=class extends r{};e.TemplateLiteralParserError=Y;var K;(function(d){function w(M,W,ne){return M[W]===ne&&M.charCodeAt(W-1)!==92}function x(M,W){return w(M,W,"(")}function P(M,W){return w(M,W,")")}function j(M,W){return w(M,W,"|")}function N(M){if(!(x(M,0)&&P(M,M.length-1)))return!1;let W=0;for(let ne=0;ne<M.length;ne++)if(x(M,ne)&&(W+=1),P(M,ne)&&(W-=1),W===0&&ne!==M.length-1)return!1;return!0}function g(M){return M.slice(1,M.length-1)}function A(M){let W=0;for(let ne=0;ne<M.length;ne++)if(x(M,ne)&&(W+=1),P(M,ne)&&(W-=1),j(M,ne)&&W===0)return!0;return!1}function _(M){for(let W=0;W<M.length;W++)if(x(M,W))return!0;return!1}function c(M){let[W,ne]=[0,0],ie=[];for(let Ee=0;Ee<M.length;Ee++)if(x(M,Ee)&&(W+=1),P(M,Ee)&&(W-=1),j(M,Ee)&&W===0){let Be=M.slice(ne,Ee);Be.length>0&&ie.push(v(Be)),ne=Ee+1}let ve=M.slice(ne);return ve.length>0&&ie.push(v(ve)),ie.length===0?{type:"const",const:""}:ie.length===1?ie[0]:{type:"or",expr:ie}}function E(M){function W(ve,Ee){if(!x(ve,Ee))throw new Y("TemplateLiteralParser: Index must point to open parens");let Be=0;for(let ze=Ee;ze<ve.length;ze++)if(x(ve,ze)&&(Be+=1),P(ve,ze)&&(Be-=1),Be===0)return[Ee,ze];throw new Y("TemplateLiteralParser: Unclosed group parens in expression")}function ne(ve,Ee){for(let Be=Ee;Be<ve.length;Be++)if(x(ve,Be))return[Ee,Be];return[Ee,ve.length]}let ie=[];for(let ve=0;ve<M.length;ve++)if(x(M,ve)){let[Ee,Be]=W(M,ve),ze=M.slice(Ee,Be+1);ie.push(v(ze)),ve=Be}else{let[Ee,Be]=ne(M,ve),ze=M.slice(Ee,Be);ze.length>0&&ie.push(v(ze)),ve=Be-1}return ie.length===0?{type:"const",const:""}:ie.length===1?ie[0]:{type:"and",expr:ie}}function v(M){return N(M)?v(g(M)):A(M)?c(M):_(M)?E(M):{type:"const",const:M}}d.Parse=v;function b(M){return v(M.slice(1,M.length-1))}d.ParseExact=b})(K||(e.TemplateLiteralParser=K={}));var te=class extends r{};e.TemplateLiteralFiniteError=te;var $;(function(d){function w(g){throw new te(g)}function x(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 P(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 j(g){return g.type==="const"&&g.const===".*"}function N(g){return P(g)?!0:x(g)||j(g)?!1:g.type==="and"?g.expr.every(A=>N(A)):g.type==="or"?g.expr.every(A=>N(A)):g.type==="const"?!0:w("Unknown expression type")}d.Check=N})($||(e.TemplateLiteralFinite=$={}));var R=class extends r{};e.TemplateLiteralGeneratorError=R;var z;(function(d){function*w(g){if(g.length===1)return yield*g[0];for(let A of g[0])for(let _ of w(g.slice(1)))yield`${A}${_}`}function*x(g){return yield*w(g.expr.map(A=>[...N(A)]))}function*P(g){for(let A of g.expr)yield*N(A)}function*j(g){return yield g.const}function*N(g){return g.type==="and"?yield*x(g):g.type==="or"?yield*P(g):g.type==="const"?yield*j(g):(()=>{throw new R("Unknown expression")})()}d.Generate=N})(z||(e.TemplateLiteralGenerator=z={}));var re;(function(d){function*w(N){let g=N.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 A=g.split("|").map(_=>e.Type.Literal(_.trim()));return A.length===0?e.Type.Never():A.length===1?A[0]:e.Type.Union(A)})()}function*x(N){if(N[1]!=="{"){let g=e.Type.Literal("$"),A=P(N.slice(1));return yield*[g,...A]}for(let g=2;g<N.length;g++)if(N[g]==="}"){let A=w(N.slice(2,g)),_=P(N.slice(g+1));return yield*[...A,..._]}yield e.Type.Literal(N)}function*P(N){for(let g=0;g<N.length;g++)if(N[g]==="$"){let A=e.Type.Literal(N.slice(0,g)),_=x(N.slice(g));return yield*[A,..._]}yield e.Type.Literal(N)}function j(N){return[...P(N)]}d.Parse=j})(re||(e.TemplateLiteralDslParser=re={}));var se=class{constructor(d){this.schema=d}Decode(d){return new ee(this.schema,d)}};e.TransformDecodeBuilder=se;var ee=class{constructor(d,w){this.schema=d,this.decode=w}Encode(d){let w=p.Type(this.schema);return a.TTransform(w)?(()=>{let x={Encode:P=>w[e.Transform].Encode(d(P)),Decode:P=>this.decode(w[e.Transform].Decode(P))};return{...w,[e.Transform]:x}})():(()=>{let x={Decode:this.decode,Encode:d};return{...w,[e.Transform]:x}})()}};e.TransformEncodeBuilder=ee;var ce=0,V=class extends r{};e.TypeBuilderError=V;var J=class{Create(d){return d}Throw(d){throw new V(d)}Discard(d,w){return w.reduce((x,P)=>{let{[P]:j,...N}=x;return N},d)}Strict(d){return JSON.parse(JSON.stringify(d))}};e.TypeBuilder=J;var Z=class extends J{ReadonlyOptional(d){return this.Readonly(this.Optional(d))}Readonly(d){return{...p.Type(d),[e.Readonly]:"Readonly"}}Optional(d){return{...p.Type(d),[e.Optional]:"Optional"}}Any(d={}){return this.Create({...d,[e.Kind]:"Any"})}Array(d,w={}){return this.Create({...w,[e.Kind]:"Array",type:"array",items:p.Type(d)})}Boolean(d={}){return this.Create({...d,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(d,w={}){return{...O.Map(p.Type(d),"Capitalize"),...w}}Composite(d,w){let x=e.Type.Intersect(d,{}),P=L.ResolveKeys(x,{includePatterns:!1}).reduce((j,N)=>({...j,[N]:e.Type.Index(x,[N])}),{});return e.Type.Object(P,w)}Enum(d,w={}){if(i.IsUndefined(d))return this.Throw("Enum undefined or empty");let x=Object.getOwnPropertyNames(d).filter(j=>isNaN(j)).map(j=>d[j]),P=[...new Set(x)].map(j=>e.Type.Literal(j));return this.Union(P,{...w,[e.Hint]:"Enum"})}Extends(d,w,x,P,j={}){switch(f.Extends(d,w)){case l.Union:return this.Union([p.Type(x,j),p.Type(P,j)]);case l.True:return p.Type(x,j);case l.False:return p.Type(P,j)}}Exclude(d,w,x={}){return a.TTemplateLiteral(d)?this.Exclude(B.Resolve(d),w,x):a.TTemplateLiteral(w)?this.Exclude(d,B.Resolve(w),x):a.TUnion(d)?(()=>{let P=d.anyOf.filter(j=>f.Extends(j,w)===l.False);return P.length===1?p.Type(P[0],x):this.Union(P,x)})():f.Extends(d,w)!==l.False?this.Never(x):p.Type(d,x)}Extract(d,w,x={}){return a.TTemplateLiteral(d)?this.Extract(B.Resolve(d),w,x):a.TTemplateLiteral(w)?this.Extract(d,B.Resolve(w),x):a.TUnion(d)?(()=>{let P=d.anyOf.filter(j=>f.Extends(j,w)!==l.False);return P.length===1?p.Type(P[0],x):this.Union(P,x)})():f.Extends(d,w)!==l.False?p.Type(d,x):this.Never(x)}Index(d,w,x={}){return a.TArray(d)&&a.TNumber(w)?p.Type(d.items,x):a.TTuple(d)&&a.TNumber(w)?(()=>{let P=(i.IsUndefined(d.items)?[]:d.items).map(j=>p.Type(j));return this.Union(P,x)})():(()=>{let P=U.Resolve(w),j=p.Type(d);return S.Resolve(j,P,x)})()}Integer(d={}){return this.Create({...d,[e.Kind]:"Integer",type:"integer"})}Intersect(d,w={}){if(d.length===0)return e.Type.Never();if(d.length===1)return p.Type(d[0],w);d.some(N=>a.TTransform(N))&&this.Throw("Cannot intersect transform types");let x=d.every(N=>a.TObject(N)),P=p.Rest(d),j=a.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:p.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||a.TSchema(w.unevaluatedProperties)||x?this.Create({...w,...j,[e.Kind]:"Intersect",type:"object",allOf:P}):this.Create({...w,...j,[e.Kind]:"Intersect",allOf:P})}KeyOf(d,w={}){return a.TRecord(d)?(()=>{let x=Object.getOwnPropertyNames(d.patternProperties)[0];return x===e.PatternNumberExact?this.Number(w):x===e.PatternStringExact?this.String(w):this.Throw("Unable to resolve key type from Record key pattern")})():a.TTuple(d)?(()=>{let x=(i.IsUndefined(d.items)?[]:d.items).map((P,j)=>e.Type.Literal(j.toString()));return this.Union(x,w)})():a.TArray(d)?this.Number(w):(()=>{let x=L.ResolveKeys(d,{includePatterns:!1});if(x.length===0)return this.Never(w);let P=x.map(j=>this.Literal(j));return this.Union(P,w)})()}Literal(d,w={}){return this.Create({...w,[e.Kind]:"Literal",const:d,type:typeof d})}Lowercase(d,w={}){return{...O.Map(p.Type(d),"Lowercase"),...w}}Never(d={}){return this.Create({...d,[e.Kind]:"Never",not:{}})}Not(d,w){return this.Create({...w,[e.Kind]:"Not",not:p.Type(d)})}Null(d={}){return this.Create({...d,[e.Kind]:"Null",type:"null"})}Number(d={}){return this.Create({...d,[e.Kind]:"Number",type:"number"})}Object(d,w={}){let x=Object.getOwnPropertyNames(d),P=x.filter(A=>a.TOptional(d[A])),j=x.filter(A=>!P.includes(A)),N=a.TSchema(w.additionalProperties)?{additionalProperties:p.Type(w.additionalProperties)}:{},g=x.reduce((A,_)=>({...A,[_]:p.Type(d[_])}),{});return j.length>0?this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g,required:j}):this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g})}Omit(d,w,x={}){let P=U.Resolve(w);return T.Map(this.Discard(p.Type(d),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(N=>!P.includes(N)),j.required.length===0&&delete j.required);for(let N of Object.getOwnPropertyNames(j.properties))P.includes(N)&&delete j.properties[N];return this.Create(j)},x)}Partial(d,w={}){return T.Map(this.Discard(p.Type(d),["$id",e.Transform]),x=>{let P=Object.getOwnPropertyNames(x.properties).reduce((j,N)=>({...j,[N]:this.Optional(x.properties[N])}),{});return this.Object(P,this.Discard(x,["required"]))},w)}Pick(d,w,x={}){let P=U.Resolve(w);return T.Map(this.Discard(p.Type(d),["$id",e.Transform]),j=>{i.IsArray(j.required)&&(j.required=j.required.filter(N=>P.includes(N)),j.required.length===0&&delete j.required);for(let N of Object.getOwnPropertyNames(j.properties))P.includes(N)||delete j.properties[N];return this.Create(j)},x)}Record(d,w,x={}){return a.TTemplateLiteral(d)?(()=>{let P=K.ParseExact(d.pattern);return $.Check(P)?this.Object([...z.Generate(P)].reduce((j,N)=>({...j,[N]:p.Type(w)}),{}),x):this.Create({...x,[e.Kind]:"Record",type:"object",patternProperties:{[d.pattern]:p.Type(w)}})})():a.TUnion(d)?(()=>{let P=k.Resolve(d);if(a.TUnionLiteral(P)){let j=P.anyOf.reduce((N,g)=>({...N,[g.const]:p.Type(w)}),{});return this.Object(j,{...x,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(d)?i.IsString(d.const)||i.IsNumber(d.const)?this.Object({[d.const]:p.Type(w)},x):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(d)||a.TNumber(d)?this.Create({...x,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:p.Type(w)}}):a.TString(d)?(()=>{let P=i.IsUndefined(d.pattern)?e.PatternStringExact:d.pattern;return this.Create({...x,[e.Kind]:"Record",type:"object",patternProperties:{[P]:p.Type(w)}})})():this.Never()}Recursive(d,w={}){i.IsUndefined(w.$id)&&(w.$id=`T${ce++}`);let x=d({[e.Kind]:"This",$ref:`${w.$id}`});return x.$id=w.$id,this.Create({...w,[e.Hint]:"Recursive",...x})}Ref(d,w={}){return i.IsString(d)?this.Create({...w,[e.Kind]:"Ref",$ref:d}):(i.IsUndefined(d.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...w,[e.Kind]:"Ref",$ref:d.$id}))}Required(d,w={}){return T.Map(this.Discard(p.Type(d),["$id",e.Transform]),x=>{let P=Object.getOwnPropertyNames(x.properties).reduce((j,N)=>({...j,[N]:this.Discard(x.properties[N],[e.Optional])}),{});return this.Object(P,x)},w)}Rest(d){return a.TTuple(d)&&!i.IsUndefined(d.items)?p.Rest(d.items):a.TIntersect(d)?p.Rest(d.allOf):a.TUnion(d)?p.Rest(d.anyOf):[]}String(d={}){return this.Create({...d,[e.Kind]:"String",type:"string"})}TemplateLiteral(d,w={}){let x=i.IsString(d)?G.Create(re.Parse(d)):G.Create(d);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:x})}Transform(d){return new se(d)}Tuple(d,w={}){let[x,P,j]=[!1,d.length,d.length],N=p.Rest(d),g=d.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:N,additionalItems:x,minItems:P,maxItems:j}:{...w,[e.Kind]:"Tuple",type:"array",minItems:P,maxItems:j};return this.Create(g)}Uncapitalize(d,w={}){return{...O.Map(p.Type(d),"Uncapitalize"),...w}}Union(d,w={}){return a.TTemplateLiteral(d)?B.Resolve(d):(()=>{let x=d;if(x.length===0)return this.Never(w);if(x.length===1)return this.Create(p.Type(x[0],w));let P=p.Rest(x);return this.Create({...w,[e.Kind]:"Union",anyOf:P})})()}Unknown(d={}){return this.Create({...d,[e.Kind]:"Unknown"})}Unsafe(d={}){return this.Create({...d,[e.Kind]:d[e.Kind]||"Unsafe"})}Uppercase(d,w={}){return{...O.Map(p.Type(d),"Uppercase"),...w}}};e.JsonTypeBuilder=Z;var me=class extends Z{AsyncIterator(d,w={}){return this.Create({...w,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:p.Type(d)})}Awaited(d,w={}){let x=P=>P.length>0?(()=>{let[j,...N]=P;return[this.Awaited(j),...x(N)]})():P;return a.TIntersect(d)?e.Type.Intersect(x(d.allOf)):a.TUnion(d)?e.Type.Union(x(d.anyOf)):a.TPromise(d)?this.Awaited(d.item):p.Type(d,w)}BigInt(d={}){return this.Create({...d,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(d,w={}){return this.Tuple([...d.parameters],{...w})}Constructor(d,w,x){let[P,j]=[p.Rest(d),p.Type(w)];return this.Create({...x,[e.Kind]:"Constructor",type:"Constructor",parameters:P,returns:j})}Date(d={}){return this.Create({...d,[e.Kind]:"Date",type:"Date"})}Function(d,w,x){let[P,j]=[p.Rest(d),p.Type(w)];return this.Create({...x,[e.Kind]:"Function",type:"Function",parameters:P,returns:j})}InstanceType(d,w={}){return p.Type(d.returns,w)}Iterator(d,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:p.Type(d)})}Parameters(d,w={}){return this.Tuple(d.parameters,{...w})}Promise(d,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:p.Type(d)})}RegExp(d,w={}){let x=i.IsString(d)?d:d.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:x})}RegEx(d,w={}){return this.RegExp(d,w)}ReturnType(d,w={}){return p.Type(d.returns,w)}Symbol(d){return this.Create({...d,[e.Kind]:"Symbol",type:"symbol"})}Undefined(d={}){return this.Create({...d,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(d={}){return this.Create({...d,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(d={}){return this.Create({...d,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=me,e.JsonType=new Z,e.Type=new me}}),ti=wr(Gr(),1),{String:S0,Optional:k0,Boolean:$0,Object:j0,Number:C0}=ti.Type,N0=S0.bind(ti.Type),M0=C0.bind(ti.Type),yC=j0.bind(ti.Type),gC=k0.bind(ti.Type),P0=$0.bind(ti.Type),mC=N0(),bC=M0(),vC=P0();function ra(e){return Array.isArray(e)?e:[e]}var U0=Ye({"../../../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}}),B0=Ye({"../../../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 p={key:l,value:u[l]},S={key:f,value:u[f]};return s(p,S)}}}(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 p=a.push(u)-1,S=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<S.length;l++){var O=S[l],T=s(u[O]);T&&(f&&(f+=","),f+=JSON.stringify(O)+":"+T)}return a.splice(p,1),"{"+f+"}"}}(r)}}}),R0=Ye({"../../../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=U();n.configure=U,n.stringify=n,n.default=n,e.stringify=n,e.configure=U,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 G=1;G<k.length;G++){let B=k[G],Y=G;for(;Y!==0&&k[Y-1]>B;)k[Y]=k[Y-1],Y--;k[Y]=B}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,G){k.length<G&&(G=k.length);let B=F===","?"":" ",Y=`"0":${B}${k[0]}`;for(let K=1;K<G;K++)Y+=`${F}"${K}":${B}${k[K]}`;return Y}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 p(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 S(k,F){let G;if(r.call(k,F)&&(G=k[F],typeof G!="boolean"))throw new TypeError(`The "${F}" argument must be of type boolean`);return G===void 0?!0:G}function O(k,F){let G;if(r.call(k,F)){if(G=k[F],typeof G!="number")throw new TypeError(`The "${F}" argument must be of type number`);if(!Number.isInteger(G))throw new TypeError(`The "${F}" argument must be an integer`);if(G<1)throw new RangeError(`The "${F}" argument must be >= 1`)}return G===void 0?1/0:G}function T(k){return k===1?"1 item":`${k} items`}function L(k){let F=new Set;for(let G of k)(typeof G=="string"||typeof G=="number")&&F.add(String(G));return F}function H(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 G=>{let B=`Object can not safely be stringified. Received type ${typeof G}`;throw typeof G!="function"&&(B+=` (${G.toString()})`),new Error(B)}}}function U(k){k={...k};let F=H(k);F&&(k.bigint===void 0&&(k.bigint=!1),"circularValue"in k||(k.circularValue=Error));let G=f(k),B=S(k,"bigint"),Y=p(k),K=typeof Y=="function"?Y:void 0,te=O(k,"maximumDepth"),$=O(k,"maximumBreadth");function R(ce,V,J,Z,me,d){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 G;let x="",P=",",j=d;if(Array.isArray(w)){if(w.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(w),me!==""&&(d+=me,x+=`
|
|
31
|
+
${d}`,P=`,
|
|
32
|
+
${d}`);let E=Math.min(w.length,$),v=0;for(;v<E-1;v++){let M=R(String(v),w,J,Z,me,d);x+=M!==void 0?M:"null",x+=P}let b=R(String(v),w,J,Z,me,d);if(x+=b!==void 0?b:"null",w.length-1>$){let M=w.length-$-1;x+=`${P}"... ${T(M)} not stringified"`}return me!==""&&(x+=`
|
|
33
|
+
${j}`),J.pop(),`[${x}]`}let N=Object.keys(w),g=N.length;if(g===0)return"{}";if(te<J.length+1)return'"[Object]"';let A="",_="";me!==""&&(d+=me,P=`,
|
|
34
|
+
${d}`,A=" ");let c=Math.min(g,$);Y&&!u(w)&&(N=a(N,K)),J.push(w);for(let E=0;E<c;E++){let v=N[E],b=R(v,w,J,Z,me,d);b!==void 0&&(x+=`${_}${o(v)}:${A}${b}`,_=P)}if(g>$){let E=g-$;x+=`${_}"...":${A}"${T(E)} not stringified"`,_=P}return me!==""&&_.length>1&&(x=`
|
|
35
|
+
${d}${x}
|
|
36
|
+
${j}`),J.pop(),`{${x}}`}case"number":return isFinite(w)?String(w):F?F(w):"null";case"boolean":return w===!0?"true":"false";case"undefined":return;case"bigint":if(B)return String(w);default:return F?F(w):void 0}}function z(ce,V,J,Z,me,d){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 G;let w=d,x="",P=",";if(Array.isArray(V)){if(V.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(V),me!==""&&(d+=me,x+=`
|
|
37
|
+
${d}`,P=`,
|
|
38
|
+
${d}`);let g=Math.min(V.length,$),A=0;for(;A<g-1;A++){let c=z(String(A),V[A],J,Z,me,d);x+=c!==void 0?c:"null",x+=P}let _=z(String(A),V[A],J,Z,me,d);if(x+=_!==void 0?_:"null",V.length-1>$){let c=V.length-$-1;x+=`${P}"... ${T(c)} not stringified"`}return me!==""&&(x+=`
|
|
39
|
+
${w}`),J.pop(),`[${x}]`}J.push(V);let j="";me!==""&&(d+=me,P=`,
|
|
40
|
+
${d}`,j=" ");let N="";for(let g of Z){let A=z(g,V[g],J,Z,me,d);A!==void 0&&(x+=`${N}${o(g)}:${j}${A}`,N=P)}return me!==""&&N.length>1&&(x=`
|
|
41
|
+
${d}${x}
|
|
42
|
+
${w}`),J.pop(),`{${x}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(B)return String(V);default:return F?F(V):void 0}}function re(ce,V,J,Z,me){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,me);if(V===null)return"null"}if(J.indexOf(V)!==-1)return G;let d=me;if(Array.isArray(V)){if(V.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(V),me+=Z;let A=`
|
|
43
|
+
${me}`,_=`,
|
|
44
|
+
${me}`,c=Math.min(V.length,$),E=0;for(;E<c-1;E++){let b=re(String(E),V[E],J,Z,me);A+=b!==void 0?b:"null",A+=_}let v=re(String(E),V[E],J,Z,me);if(A+=v!==void 0?v:"null",V.length-1>$){let b=V.length-$-1;A+=`${_}"... ${T(b)} not stringified"`}return A+=`
|
|
45
|
+
${d}`,J.pop(),`[${A}]`}let w=Object.keys(V),x=w.length;if(x===0)return"{}";if(te<J.length+1)return'"[Object]"';me+=Z;let P=`,
|
|
46
|
+
${me}`,j="",N="",g=Math.min(x,$);u(V)&&(j+=l(V,P,$),w=w.slice(V.length),g-=V.length,N=P),Y&&(w=a(w,K)),J.push(V);for(let A=0;A<g;A++){let _=w[A],c=re(_,V[_],J,Z,me);c!==void 0&&(j+=`${N}${o(_)}: ${c}`,N=P)}if(x>$){let A=x-$;j+=`${N}"...": "${T(A)} not stringified"`,N=P}return N!==""&&(j=`
|
|
47
|
+
${me}${j}
|
|
48
|
+
${d}`),J.pop(),`{${j}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(B)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 G;let Z="",me=V.length!==void 0;if(me&&Array.isArray(V)){if(V.length===0)return"[]";if(te<J.length+1)return'"[Array]"';J.push(V);let j=Math.min(V.length,$),N=0;for(;N<j-1;N++){let A=se(String(N),V[N],J);Z+=A!==void 0?A:"null",Z+=","}let g=se(String(N),V[N],J);if(Z+=g!==void 0?g:"null",V.length-1>$){let A=V.length-$-1;Z+=`,"... ${T(A)} not stringified"`}return J.pop(),`[${Z}]`}let d=Object.keys(V),w=d.length;if(w===0)return"{}";if(te<J.length+1)return'"[Object]"';let x="",P=Math.min(w,$);me&&u(V)&&(Z+=l(V,",",$),d=d.slice(V.length),P-=V.length,x=","),Y&&(d=a(d,K)),J.push(V);for(let j=0;j<P;j++){let N=d[j],g=se(N,V[N],J);g!==void 0&&(Z+=`${x}${o(N)}:${g}`,x=",")}if(w>$){let j=w-$;Z+=`${x}"...":"${T(j)} 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(B)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 R("",{"":ce},[],V,Z,"");if(Array.isArray(V))return z("",ce,[],L(V),Z,"")}if(Z.length!==0)return re("",ce,[],Z,"")}return se("",ce,[])}return ee}}}),ri=Ye({"../../../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(B){return l(B)&&Symbol.asyncIterator in B}e.IsAsyncIterator=t;function r(B){return l(B)&&Symbol.iterator in B}e.IsIterator=r;function n(B){return ArrayBuffer.isView(B)}e.IsTypedArray=n;function i(B){return B instanceof Promise}e.IsPromise=i;function o(B){return B instanceof Uint8Array}e.IsUint8Array=o;function a(B){return B instanceof Date&&Number.isFinite(B.getTime())}e.IsDate=a;function s(B,Y){return Y in B}e.HasPropertyKey=s;function u(B){return l(B)&&k(B.constructor)&&B.constructor.name==="Object"}e.IsPlainObject=u;function l(B){return B!==null&&typeof B=="object"}e.IsObject=l;function f(B){return Array.isArray(B)&&!ArrayBuffer.isView(B)}e.IsArray=f;function p(B){return B===void 0}e.IsUndefined=p;function S(B){return B===null}e.IsNull=S;function O(B){return typeof B=="boolean"}e.IsBoolean=O;function T(B){return typeof B=="number"}e.IsNumber=T;function L(B){return T(B)&&Number.isInteger(B)}e.IsInteger=L;function H(B){return typeof B=="bigint"}e.IsBigInt=H;function U(B){return typeof B=="string"}e.IsString=U;function k(B){return typeof B=="function"}e.IsFunction=k;function F(B){return typeof B=="symbol"}e.IsSymbol=F;function G(B){return H(B)||O(B)||S(B)||T(B)||U(B)||F(B)||p(B)}e.IsValueType=G}}),Yd=Ye({"../../../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=ri(),r=Va(),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 p(O,T){if(n.TypeRegistry.Has(O))throw new i(O);return n.TypeRegistry.Set(O,T),(L={})=>n.Type.Unsafe({...L,[n.Kind]:O})}f.Type=p;function S(O,T){if(n.FormatRegistry.Has(O))throw new o(O);return n.FormatRegistry.Set(O,T),O}f.Format=S})(a||(e.TypeSystem=a={}));var s;(function(f){let p=l;function S(){p=l}f.Reset=S;function O(L){p=L}f.Set=O;function T(){return p}f.Get=T})(s||(e.TypeSystemErrorFunction=s={}));var u;(function(f){f.ExactOptionalPropertyTypes=!1,f.AllowArrayObject=!1,f.AllowNaN=!1,f.AllowNullVoid=!1;function p(H,U){return f.ExactOptionalPropertyTypes?U in H:H[U]!==void 0}f.IsExactOptionalProperty=p;function S(H){let U=(0,t.IsObject)(H);return f.AllowArrayObject?U:U&&!(0,t.IsArray)(H)}f.IsObjectLike=S;function O(H){return S(H)&&!(H instanceof Date)&&!(H instanceof Uint8Array)}f.IsRecordLike=O;function T(H){let U=(0,t.IsNumber)(H);return f.AllowNaN?U:U&&Number.isFinite(H)}f.IsNumberLike=T;function L(H){let U=(0,t.IsUndefined)(H);return f.AllowNullVoid?U||H===null:U}f.IsVoidLike=L})(u||(e.TypeSystemPolicy=u={}));function l(f,p){switch(p){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}}),La=Ye({"../../../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}}),Vu=Ye({"../../../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=ri(),r=class extends Error{constructor(R){super("Unable to hash value"),this.value=R}};e.ValueHashError=r;var n;(function(R){R[R.Undefined=0]="Undefined",R[R.Null=1]="Null",R[R.Boolean=2]="Boolean",R[R.Number=3]="Number",R[R.String=4]="String",R[R.Object=5]="Object",R[R.Array=6]="Array",R[R.Date=7]="Date",R[R.Uint8Array=8]="Uint8Array",R[R.Symbol=9]="Symbol",R[R.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((R,z)=>BigInt(z)),u=new Float64Array(1),l=new DataView(u.buffer),f=new Uint8Array(u.buffer);function*p(R){let z=R===0?1:Math.ceil(Math.floor(Math.log2(R)+1)/8);for(let re=0;re<z;re++)yield R>>8*(z-1-re)&255}function S(R){te(n.Array);for(let z of R)K(z)}function O(R){te(n.Boolean),te(R?1:0)}function T(R){te(n.BigInt),l.setBigInt64(0,R);for(let z of f)te(z)}function L(R){te(n.Date),K(R.getTime())}function H(R){te(n.Null)}function U(R){te(n.Number),l.setFloat64(0,R);for(let z of f)te(z)}function k(R){te(n.Object);for(let z of globalThis.Object.keys(R).sort())K(z),K(R[z])}function F(R){te(n.String);for(let z=0;z<R.length;z++)for(let re of p(R.charCodeAt(z)))te(re)}function G(R){te(n.Symbol),K(R.description)}function B(R){te(n.Uint8Array);for(let z=0;z<R.length;z++)te(R[z])}function Y(R){return te(n.Undefined)}function K(R){if((0,t.IsArray)(R))return S(R);if((0,t.IsBoolean)(R))return O(R);if((0,t.IsBigInt)(R))return T(R);if((0,t.IsDate)(R))return L(R);if((0,t.IsNull)(R))return H(R);if((0,t.IsNumber)(R))return U(R);if((0,t.IsPlainObject)(R))return k(R);if((0,t.IsString)(R))return F(R);if((0,t.IsSymbol)(R))return G(R);if((0,t.IsUint8Array)(R))return B(R);if((0,t.IsUndefined)(R))return Y(R);throw new r(R)}function te(R){i=i^s[R],i=i*o%a}function $(R){return i=BigInt("14695981039346656037"),K(R),i}e.Hash=$}}),Va=Ye({"../../../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=ri(),r=Yd(),n=La(),i=Vu(),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 p(c,E,v,b){return{type:c,schema:E,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(E,c)}}function*S(c,E,v,b){}function*O(c,E,v,b){if(!(0,t.IsArray)(b))return yield p(a.Array,c,v,b);l(c.minItems)&&!(b.length>=c.minItems)&&(yield p(a.ArrayMinItems,c,v,b)),l(c.maxItems)&&!(b.length<=c.maxItems)&&(yield p(a.ArrayMaxItems,c,v,b));for(let ne=0;ne<b.length;ne++)yield*A(c.items,E,`${v}/${ne}`,b[ne]);if(c.uniqueItems===!0&&!function(){let ne=new Set;for(let ie of b){let ve=(0,i.Hash)(ie);if(ne.has(ve))return!1;ne.add(ve)}return!0}()&&(yield p(a.ArrayUniqueItems,c,v,b)),!(l(c.contains)||l(c.minContains)||l(c.maxContains)))return;let M=l(c.contains)?c.contains:o.Type.Never(),W=b.reduce((ne,ie,ve)=>A(M,E,`${v}${ve}`,ie).next().done===!0?ne+1:ne,0);W===0&&(yield p(a.ArrayContains,c,v,b)),(0,t.IsNumber)(c.minContains)&&W<c.minContains&&(yield p(a.ArrayMinContains,c,v,b)),(0,t.IsNumber)(c.maxContains)&&W>c.maxContains&&(yield p(a.ArrayMaxContains,c,v,b))}function*T(c,E,v,b){(0,t.IsAsyncIterator)(b)||(yield p(a.AsyncIterator,c,v,b))}function*L(c,E,v,b){if(!(0,t.IsBigInt)(b))return yield p(a.BigInt,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield p(a.BigIntExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield p(a.BigIntExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield p(a.BigIntMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield p(a.BigIntMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==BigInt(0)&&(yield p(a.BigIntMultipleOf,c,v,b))}function*H(c,E,v,b){(0,t.IsBoolean)(b)||(yield p(a.Boolean,c,v,b))}function*U(c,E,v,b){yield*A(c.returns,E,v,b.prototype)}function*k(c,E,v,b){if(!(0,t.IsDate)(b))return yield p(a.Date,c,v,b);l(c.exclusiveMaximumTimestamp)&&!(b.getTime()<c.exclusiveMaximumTimestamp)&&(yield p(a.DateExclusiveMaximumTimestamp,c,v,b)),l(c.exclusiveMinimumTimestamp)&&!(b.getTime()>c.exclusiveMinimumTimestamp)&&(yield p(a.DateExclusiveMinimumTimestamp,c,v,b)),l(c.maximumTimestamp)&&!(b.getTime()<=c.maximumTimestamp)&&(yield p(a.DateMaximumTimestamp,c,v,b)),l(c.minimumTimestamp)&&!(b.getTime()>=c.minimumTimestamp)&&(yield p(a.DateMinimumTimestamp,c,v,b)),l(c.multipleOfTimestamp)&&b.getTime()%c.multipleOfTimestamp!==0&&(yield p(a.DateMultipleOfTimestamp,c,v,b))}function*F(c,E,v,b){(0,t.IsFunction)(b)||(yield p(a.Function,c,v,b))}function*G(c,E,v,b){if(!(0,t.IsInteger)(b))return yield p(a.Integer,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield p(a.IntegerExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield p(a.IntegerExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield p(a.IntegerMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield p(a.IntegerMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield p(a.IntegerMultipleOf,c,v,b))}function*B(c,E,v,b){for(let M of c.allOf){let W=A(M,E,v,b).next();W.done||(yield p(a.Intersect,c,v,b),yield W.value)}if(c.unevaluatedProperties===!1){let M=new RegExp(o.KeyResolver.ResolvePattern(c));for(let W of Object.getOwnPropertyNames(b))M.test(W)||(yield p(a.IntersectUnevaluatedProperties,c,`${v}/${W}`,b))}if(typeof c.unevaluatedProperties=="object"){let M=new RegExp(o.KeyResolver.ResolvePattern(c));for(let W of Object.getOwnPropertyNames(b))if(!M.test(W)){let ne=A(c.unevaluatedProperties,E,`${v}/${W}`,b[W]).next();ne.done||(yield ne.value)}}}function*Y(c,E,v,b){(0,t.IsIterator)(b)||(yield p(a.Iterator,c,v,b))}function*K(c,E,v,b){b!==c.const&&(yield p(a.Literal,c,v,b))}function*te(c,E,v,b){yield p(a.Never,c,v,b)}function*$(c,E,v,b){A(c.not,E,v,b).next().done===!0&&(yield p(a.Not,c,v,b))}function*R(c,E,v,b){(0,t.IsNull)(b)||(yield p(a.Null,c,v,b))}function*z(c,E,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield p(a.Number,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield p(a.NumberExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield p(a.NumberExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield p(a.NumberMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield p(a.NumberMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield p(a.NumberMultipleOf,c,v,b))}function*re(c,E,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield p(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield p(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield p(a.ObjectMaxProperties,c,v,b));let M=Array.isArray(c.required)?c.required:[],W=Object.getOwnPropertyNames(c.properties),ne=Object.getOwnPropertyNames(b);for(let ie of M)ne.includes(ie)||(yield p(a.ObjectRequiredProperty,c.properties[ie],`${v}/${u(ie)}`,void 0));if(c.additionalProperties===!1)for(let ie of ne)W.includes(ie)||(yield p(a.ObjectAdditionalProperties,c,`${v}/${u(ie)}`,b[ie]));if(typeof c.additionalProperties=="object")for(let ie of ne)W.includes(ie)||(yield*A(c.additionalProperties,E,`${v}/${u(ie)}`,b[ie]));for(let ie of W){let ve=c.properties[ie];c.required&&c.required.includes(ie)?(yield*A(ve,E,`${v}/${u(ie)}`,b[ie]),o.ExtendsUndefined.Check(c)&&!(ie in b)&&(yield p(a.ObjectRequiredProperty,ve,`${v}/${u(ie)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(b,ie)&&(yield*A(ve,E,`${v}/${u(ie)}`,b[ie]))}}function*se(c,E,v,b){(0,t.IsPromise)(b)||(yield p(a.Promise,c,v,b))}function*ee(c,E,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield p(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield p(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield p(a.ObjectMaxProperties,c,v,b));let[M,W]=Object.entries(c.patternProperties)[0],ne=new RegExp(M);for(let[ie,ve]of Object.entries(b))ne.test(ie)&&(yield*A(W,E,`${v}/${u(ie)}`,ve));if(typeof c.additionalProperties=="object")for(let[ie,ve]of Object.entries(b))ne.test(ie)||(yield*A(c.additionalProperties,E,`${v}/${u(ie)}`,ve));if(c.additionalProperties===!1){for(let[ie,ve]of Object.entries(b))if(!ne.test(ie))return yield p(a.ObjectAdditionalProperties,c,`${v}/${u(ie)}`,ve)}}function*ce(c,E,v,b){yield*A((0,n.Deref)(c,E),E,v,b)}function*V(c,E,v,b){if(!(0,t.IsString)(b))return yield p(a.String,c,v,b);l(c.minLength)&&!(b.length>=c.minLength)&&(yield p(a.StringMinLength,c,v,b)),l(c.maxLength)&&!(b.length<=c.maxLength)&&(yield p(a.StringMaxLength,c,v,b)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(b)||(yield p(a.StringPattern,c,v,b))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(b)||(yield p(a.StringFormat,c,v,b)):yield p(a.StringFormatUnknown,c,v,b))}function*J(c,E,v,b){(0,t.IsSymbol)(b)||(yield p(a.Symbol,c,v,b))}function*Z(c,E,v,b){if(!(0,t.IsString)(b))return yield p(a.String,c,v,b);new RegExp(c.pattern).test(b)||(yield p(a.StringPattern,c,v,b))}function*me(c,E,v,b){yield*A((0,n.Deref)(c,E),E,v,b)}function*d(c,E,v,b){if(!(0,t.IsArray)(b))return yield p(a.Tuple,c,v,b);if(c.items===void 0&&b.length!==0)return yield p(a.TupleLength,c,v,b);if(b.length!==c.maxItems)return yield p(a.TupleLength,c,v,b);if(c.items)for(let M=0;M<c.items.length;M++)yield*A(c.items[M],E,`${v}/${M}`,b[M])}function*w(c,E,v,b){(0,t.IsUndefined)(b)||(yield p(a.Undefined,c,v,b))}function*x(c,E,v,b){let M=0;for(let W of c.anyOf){let ne=[...A(W,E,v,b)];if(ne.length===0)return;M+=ne.length}M>0&&(yield p(a.Union,c,v,b))}function*P(c,E,v,b){if(!(0,t.IsUint8Array)(b))return yield p(a.Uint8Array,c,v,b);l(c.maxByteLength)&&!(b.length<=c.maxByteLength)&&(yield p(a.Uint8ArrayMaxByteLength,c,v,b)),l(c.minByteLength)&&!(b.length>=c.minByteLength)&&(yield p(a.Uint8ArrayMinByteLength,c,v,b))}function*j(c,E,v,b){}function*N(c,E,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield p(a.Void,c,v,b))}function*g(c,E,v,b){o.TypeRegistry.Get(c[o.Kind])(c,b)||(yield p(a.Kind,c,v,b))}function*A(c,E,v,b){let M=l(c.$id)?[...E,c]:E,W=c;switch(W[o.Kind]){case"Any":return yield*S(W,M,v,b);case"Array":return yield*O(W,M,v,b);case"AsyncIterator":return yield*T(W,M,v,b);case"BigInt":return yield*L(W,M,v,b);case"Boolean":return yield*H(W,M,v,b);case"Constructor":return yield*U(W,M,v,b);case"Date":return yield*k(W,M,v,b);case"Function":return yield*F(W,M,v,b);case"Integer":return yield*G(W,M,v,b);case"Intersect":return yield*B(W,M,v,b);case"Iterator":return yield*Y(W,M,v,b);case"Literal":return yield*K(W,M,v,b);case"Never":return yield*te(W,M,v,b);case"Not":return yield*$(W,M,v,b);case"Null":return yield*R(W,M,v,b);case"Number":return yield*z(W,M,v,b);case"Object":return yield*re(W,M,v,b);case"Promise":return yield*se(W,M,v,b);case"Record":return yield*ee(W,M,v,b);case"Ref":return yield*ce(W,M,v,b);case"String":return yield*V(W,M,v,b);case"Symbol":return yield*J(W,M,v,b);case"TemplateLiteral":return yield*Z(W,M,v,b);case"This":return yield*me(W,M,v,b);case"Tuple":return yield*d(W,M,v,b);case"Undefined":return yield*w(W,M,v,b);case"Union":return yield*x(W,M,v,b);case"Uint8Array":return yield*P(W,M,v,b);case"Unknown":return yield*j(W,M,v,b);case"Void":return yield*N(W,M,v,b);default:if(!o.TypeRegistry.Has(W[o.Kind]))throw new s(c);return yield*g(W,M,v,b)}}function _(...c){let E=c.length===3?A(c[0],c[1],"",c[2]):A(c[0],[],"",c[1]);return new f(E)}e.Errors=_}}),D0=Ye({"../../../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(Va(),e)}}),Xd=Ye({"../../../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=Va();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(Yd(),e)}}),L0=Ye({"../../../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=ri(),r=Xd(),n=La(),i=Vu(),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,A,_){return!0}function f(g,A,_){if(!(0,t.IsArray)(_)||u(g.minItems)&&!(_.length>=g.minItems)||u(g.maxItems)&&!(_.length<=g.maxItems)||!_.every(v=>j(g.items,A,v))||g.uniqueItems===!0&&!function(){let v=new Set;for(let b of _){let M=(0,i.Hash)(b);if(v.has(M))return!1;v.add(M)}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(),E=_.reduce((v,b)=>j(c,A,b)?v+1:v,0);return!(E===0||(0,t.IsNumber)(g.minContains)&&E<g.minContains||(0,t.IsNumber)(g.maxContains)&&E>g.maxContains)}function p(g,A,_){return(0,t.IsAsyncIterator)(_)}function S(g,A,_){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 O(g,A,_){return(0,t.IsBoolean)(_)}function T(g,A,_){return j(g.returns,A,_.prototype)}function L(g,A,_){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 H(g,A,_){return(0,t.IsFunction)(_)}function U(g,A,_){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,A,_){let c=g.allOf.every(E=>j(E,A,_));if(g.unevaluatedProperties===!1){let E=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>E.test(b));return c&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let E=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>E.test(b)||j(g.unevaluatedProperties,A,_[b]));return c&&v}else return c}function F(g,A,_){return(0,t.IsIterator)(_)}function G(g,A,_){return _===g.const}function B(g,A,_){return!1}function Y(g,A,_){return!j(g.not,A,_)}function K(g,A,_){return(0,t.IsNull)(_)}function te(g,A,_){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 $(g,A,_){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 E of c){let v=g.properties[E];if(g.required&&g.required.includes(E)){if(!j(v,A,_[E])||(o.ExtendsUndefined.Check(v)||s(v))&&!(E in _))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(_,E)&&!j(v,A,_[E]))return!1}if(g.additionalProperties===!1){let E=Object.getOwnPropertyNames(_);return g.required&&g.required.length===c.length&&E.length===c.length?!0:E.every(v=>c.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(_).every(E=>c.includes(E)||j(g.additionalProperties,A,_[E])):!0}function R(g,A,_){return(0,t.IsPromise)(_)}function z(g,A,_){if(!r.TypeSystemPolicy.IsRecordLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let[c,E]=Object.entries(g.patternProperties)[0],v=new RegExp(c),b=Object.entries(_).every(([ne,ie])=>v.test(ne)?j(E,A,ie):!0),M=typeof g.additionalProperties=="object"?Object.entries(_).every(([ne,ie])=>v.test(ne)?!0:j(g.additionalProperties,A,ie)):!0,W=g.additionalProperties===!1?Object.getOwnPropertyNames(_).every(ne=>v.test(ne)):!0;return b&&M&&W}function re(g,A,_){return j((0,n.Deref)(g,A),A,_)}function se(g,A,_){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,A,_){return(0,t.IsSymbol)(_)}function ce(g,A,_){return(0,t.IsString)(_)&&new RegExp(g.pattern).test(_)}function V(g,A,_){return j((0,n.Deref)(g,A),A,_)}function J(g,A,_){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(!j(g.items[c],A,_[c]))return!1;return!0}function Z(g,A,_){return(0,t.IsUndefined)(_)}function me(g,A,_){return g.anyOf.some(c=>j(c,A,_))}function d(g,A,_){return!(!(0,t.IsUint8Array)(_)||u(g.maxByteLength)&&!(_.length<=g.maxByteLength)||u(g.minByteLength)&&!(_.length>=g.minByteLength))}function w(g,A,_){return!0}function x(g,A,_){return r.TypeSystemPolicy.IsVoidLike(_)}function P(g,A,_){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,_):!1}function j(g,A,_){let c=u(g.$id)?[...A,g]:A,E=g;switch(E[o.Kind]){case"Any":return l(E,c,_);case"Array":return f(E,c,_);case"AsyncIterator":return p(E,c,_);case"BigInt":return S(E,c,_);case"Boolean":return O(E,c,_);case"Constructor":return T(E,c,_);case"Date":return L(E,c,_);case"Function":return H(E,c,_);case"Integer":return U(E,c,_);case"Intersect":return k(E,c,_);case"Iterator":return F(E,c,_);case"Literal":return G(E,c,_);case"Never":return B(E,c,_);case"Not":return Y(E,c,_);case"Null":return K(E,c,_);case"Number":return te(E,c,_);case"Object":return $(E,c,_);case"Promise":return R(E,c,_);case"Record":return z(E,c,_);case"Ref":return re(E,c,_);case"String":return se(E,c,_);case"Symbol":return ee(E,c,_);case"TemplateLiteral":return ce(E,c,_);case"This":return V(E,c,_);case"Tuple":return J(E,c,_);case"Undefined":return Z(E,c,_);case"Union":return me(E,c,_);case"Uint8Array":return d(E,c,_);case"Unknown":return w(E,c,_);case"Void":return x(E,c,_);default:if(!o.TypeRegistry.Has(E[o.Kind]))throw new a(E);return P(E,c,_)}}function N(...g){return g.length===3?j(g[0],g[1],g[2]):j(g[0],[],g[1])}e.Check=N}}),V0=Ye({"../../../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=ri(),r=La(),n=L0(),i=Gr(),o=class extends i.TypeBoxError{constructor(S,O,T){super("Unable to decode due to invalid value"),this.schema=S,this.value=O,this.error=T}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor(S,O,T){super("Unable to encode due to invalid value"),this.schema=S,this.value=O,this.error=T}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor(S,O,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=S,this.value=O}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor(S,O,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=S,this.value=O}};e.TransformEncodeError=u;var l;(function(S){function O(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 L(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.returns,ce)||ee.parameters.some(V=>z(V,ce))}function H(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.returns,ce)||ee.parameters.some(V=>z(V,ce))}function U(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 G(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 B(ee,ce){return i.TypeGuard.TTransform(ee)||z(ee.item,ce)}function Y(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 K(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 $(ee,ce){return i.TypeGuard.TTransform(ee)||!(0,t.IsUndefined)(ee.items)&&ee.items.some(V=>z(V,ce))}function R(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 O(J,V);case"AsyncIterator":return T(J,V);case"Constructor":return L(J,V);case"Function":return H(J,V);case"Intersect":return U(J,V);case"Iterator":return k(J,V);case"Not":return F(J,V);case"Object":return G(J,V);case"Promise":return B(J,V);case"Record":return Y(J,V);case"Ref":return K(J,V);case"This":return te(J,V);case"Tuple":return $(J,V);case"Union":return R(J,V);default:return i.TypeGuard.TTransform(ee)}}let re=new Set;function se(ee,ce){return re.clear(),z(ee,ce)}S.Has=se})(l||(e.HasTransform=l={}));var f;(function(S){function O($,R){try{return i.TypeGuard.TTransform($)?$[i.Transform].Decode(R):R}catch(z){throw new s($,R,z)}}function T($,R,z){return(0,t.IsArray)(z)?O($,z.map(re=>K($.items,R,re))):O($,z)}function L($,R,z){if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return O($,z);let re=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),se=re.reduce((J,Z)=>Z in J?{...J,[Z]:K(i.IndexedAccessor.Resolve($,[Z]),R,J[Z])}:J,z);if(!i.TypeGuard.TTransform($.unevaluatedProperties))return O($,se);let ee=Object.getOwnPropertyNames(se),ce=$.unevaluatedProperties,V=ee.reduce((J,Z)=>re.includes(Z)?J:{...J,[Z]:O(ce,J[Z])},se);return O($,V)}function H($,R,z){return O($,K($.not,R,z))}function U($,R,z){if(!(0,t.IsPlainObject)(z))return O($,z);let re=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),se=re.reduce((J,Z)=>Z in J?{...J,[Z]:K($.properties[Z],R,J[Z])}:J,z);if(!i.TypeGuard.TSchema($.additionalProperties))return O($,se);let ee=Object.getOwnPropertyNames(se),ce=$.additionalProperties,V=ee.reduce((J,Z)=>re.includes(Z)?J:{...J,[Z]:O(ce,J[Z])},se);return O($,V)}function k($,R,z){if(!(0,t.IsPlainObject)(z))return O($,z);let re=Object.getOwnPropertyNames($.patternProperties)[0],se=new RegExp(re),ee=Object.getOwnPropertyNames(z).reduce((Z,me)=>se.test(me)?{...Z,[me]:K($.patternProperties[re],R,Z[me])}:Z,z);if(!i.TypeGuard.TSchema($.additionalProperties))return O($,ee);let ce=Object.getOwnPropertyNames(ee),V=$.additionalProperties,J=ce.reduce((Z,me)=>se.test(me)?Z:{...Z,[me]:O(V,Z[me])},ee);return O($,J)}function F($,R,z){let re=(0,r.Deref)($,R);return O($,K(re,R,z))}function G($,R,z){let re=(0,r.Deref)($,R);return O($,K(re,R,z))}function B($,R,z){return(0,t.IsArray)(z)&&(0,t.IsArray)($.items)?O($,$.items.map((re,se)=>K(re,R,z[se]))):O($,z)}function Y($,R,z){let re=O($,z);for(let se of $.anyOf)if((0,n.Check)(se,R,re))return K(se,R,re);return re}function K($,R,z){let re=typeof $.$id=="string"?[...R,$]:R,se=$;switch($[i.Kind]){case"Array":return T(se,re,z);case"Intersect":return L(se,re,z);case"Not":return H(se,re,z);case"Object":return U(se,re,z);case"Record":return k(se,re,z);case"Ref":return F(se,re,z);case"Symbol":return O(se,z);case"This":return G(se,re,z);case"Tuple":return B(se,re,z);case"Union":return Y(se,re,z);default:return O(se,z)}}function te($,R,z){return K($,R,z)}S.Decode=te})(f||(e.DecodeTransform=f={}));var p;(function(S){function O($,R){try{return i.TypeGuard.TTransform($)?$[i.Transform].Encode(R):R}catch(z){throw new u($,R,z)}}function T($,R,z){let re=O($,z);return(0,t.IsArray)(re)?re.map(se=>K($.items,R,se)):re}function L($,R,z){let re=O($,z);if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return re;let se=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),ee=se.reduce((J,Z)=>Z in re?{...J,[Z]:K(i.IndexedAccessor.Resolve($,[Z]),R,J[Z])}:J,re);if(!i.TypeGuard.TTransform($.unevaluatedProperties))return O($,ee);let ce=Object.getOwnPropertyNames(ee),V=$.unevaluatedProperties;return ce.reduce((J,Z)=>se.includes(Z)?J:{...J,[Z]:O(V,J[Z])},ee)}function H($,R,z){return O($.not,O($,z))}function U($,R,z){let re=O($,z);if(!(0,t.IsPlainObject)(z))return re;let se=i.KeyResolver.ResolveKeys($,{includePatterns:!1}),ee=se.reduce((J,Z)=>Z in J?{...J,[Z]:K($.properties[Z],R,J[Z])}:J,re);if(!i.TypeGuard.TSchema($.additionalProperties))return ee;let ce=Object.getOwnPropertyNames(ee),V=$.additionalProperties;return ce.reduce((J,Z)=>se.includes(Z)?J:{...J,[Z]:O(V,J[Z])},ee)}function k($,R,z){let re=O($,z);if(!(0,t.IsPlainObject)(z))return re;let se=Object.getOwnPropertyNames($.patternProperties)[0],ee=new RegExp(se),ce=Object.getOwnPropertyNames(z).reduce((Z,me)=>ee.test(me)?{...Z,[me]:K($.patternProperties[se],R,Z[me])}:Z,re);if(!i.TypeGuard.TSchema($.additionalProperties))return O($,ce);let V=Object.getOwnPropertyNames(ce),J=$.additionalProperties;return V.reduce((Z,me)=>ee.test(me)?Z:{...Z,[me]:O(J,Z[me])},ce)}function F($,R,z){let re=(0,r.Deref)($,R),se=K(re,R,z);return O($,se)}function G($,R,z){let re=(0,r.Deref)($,R),se=K(re,R,z);return O($,se)}function B($,R,z){let re=O($,z);return(0,t.IsArray)($.items)?$.items.map((se,ee)=>K(se,R,re[ee])):[]}function Y($,R,z){for(let re of $.anyOf){if(!(0,n.Check)(re,R,z))continue;let se=K(re,R,z);return O($,se)}for(let re of $.anyOf){let se=K(re,R,z);if((0,n.Check)($,R,se))return O($,se)}return O($,z)}function K($,R,z){let re=typeof $.$id=="string"?[...R,$]:R,se=$;switch($[i.Kind]){case"Array":return T(se,re,z);case"Intersect":return L(se,re,z);case"Not":return H(se,re,z);case"Object":return U(se,re,z);case"Record":return k(se,re,z);case"Ref":return F(se,re,z);case"This":return G(se,re,z);case"Tuple":return B(se,re,z);case"Union":return Y(se,re,z);default:return O(se,z)}}function te($,R,z){return K($,R,z)}S.Encode=te})(p||(e.EncodeTransform=p={}))}}),F0=Ye({"../../../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=V0(),r=ri(),n=Va(),i=Xd(),o=La(),a=Vu(),s=Gr(),u=class{constructor(U,k,F,G){this.schema=U,this.references=k,this.checkFunc=F,this.code=G,this.hasTransform=t.HasTransform.Has(U,k)}Code(){return this.code}Errors(U){return(0,n.Errors)(this.schema,this.references,U)}Check(U){return this.checkFunc(U)}Decode(U){if(!this.checkFunc(U))throw new t.TransformDecodeCheckError(this.schema,U,this.Errors(U).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,U):U}Encode(U){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,U):U;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,U,this.Errors(U).First());return k}};e.TypeCheck=u;var l;(function(U){function k(Y){return Y===36}U.DollarSign=k;function F(Y){return Y===95}U.IsUnderscore=F;function G(Y){return Y>=65&&Y<=90||Y>=97&&Y<=122}U.IsAlpha=G;function B(Y){return Y>=48&&Y<=57}U.IsNumeric=B})(l||(l={}));var f;(function(U){function k(Y){return Y.length===0?!1:l.IsNumeric(Y.charCodeAt(0))}function F(Y){if(k(Y))return!1;for(let K=0;K<Y.length;K++){let te=Y.charCodeAt(K);if(!(l.IsAlpha(te)||l.IsNumeric(te)||l.DollarSign(te)||l.IsUnderscore(te)))return!1}return!0}function G(Y){return Y.replace(/'/g,"\\'")}function B(Y,K){return F(K)?`${Y}.${K}`:`${Y}['${G(K)}']`}U.Encode=B})(f||(f={}));var p;(function(U){function k(F){let G=[];for(let B=0;B<F.length;B++){let Y=F.charCodeAt(B);l.IsNumeric(Y)||l.IsAlpha(Y)?G.push(F.charAt(B)):G.push(`_${Y}_`)}return G.join("").replace(/__/g,"_")}U.Encode=k})(p||(p={}));var S;(function(U){function k(F){return F.replace(/'/g,"\\'")}U.Escape=k})(S||(S={}));var O=class extends s.TypeBoxError{constructor(U){super("Unknown type"),this.schema=U}};e.TypeCompilerUnknownTypeError=O;var T=class extends s.TypeBoxError{constructor(U){super("Preflight validation check failed to guard for the given schema"),this.schema=U}};e.TypeCompilerTypeGuardError=T;var L;(function(U){function k(K,te,$){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${te}' in ${K} ? ${$} : true)`:`(${f.Encode(K,te)} !== undefined ? ${$} : true)`}U.IsExactOptionalProperty=k;function F(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null)`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}))`}U.IsObjectLike=F;function G(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null && !(${K} instanceof Date) && !(${K} instanceof Uint8Array))`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}) && !(${K} instanceof Date) && !(${K} instanceof Uint8Array))`}U.IsRecordLike=G;function B(K){return i.TypeSystemPolicy.AllowNaN?`typeof ${K} === 'number'`:`(typeof ${K} === 'number' && Number.isFinite(${K}))`}U.IsNumberLike=B;function Y(K){return i.TypeSystemPolicy.AllowNullVoid?`(${K} === undefined || ${K} === null)`:`${K} === undefined`}U.IsVoidLike=Y})(L||(e.Policy=L={}));var H;(function(U){function k(I){return I[s.Kind]==="Any"||I[s.Kind]==="Unknown"}function*F(I,pe,C){yield"true"}function*G(I,pe,C){yield`Array.isArray(${C})`;let[_e,ae]=[ze("value","any"),ze("acc","number")];(0,r.IsNumber)(I.maxItems)&&(yield`${C}.length <= ${I.maxItems}`),(0,r.IsNumber)(I.minItems)&&(yield`${C}.length >= ${I.minItems}`);let he=ie(I.items,pe,"value");if(yield`${C}.every((${_e}) => ${he})`,s.TypeGuard.TSchema(I.contains)||(0,r.IsNumber)(I.minContains)||(0,r.IsNumber)(I.maxContains)){let Ne=s.TypeGuard.TSchema(I.contains)?I.contains:s.Type.Never(),Ke=ie(Ne,pe,"value"),lt=(0,r.IsNumber)(I.minContains)?[`(count >= ${I.minContains})`]:[],it=(0,r.IsNumber)(I.maxContains)?[`(count <= ${I.maxContains})`]:[],ft=`const count = value.reduce((${ae}, ${_e}) => ${Ke} ? acc + 1 : acc, 0)`,Er=["(count > 0)",...lt,...it].join(" && ");yield`((${_e}) => { ${ft}; return ${Er}})(${C})`}I.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*B(I,pe,C){yield`(typeof value === 'object' && Symbol.asyncIterator in ${C})`}function*Y(I,pe,C){yield`(typeof ${C} === 'bigint')`,(0,r.IsBigInt)(I.exclusiveMaximum)&&(yield`${C} < BigInt(${I.exclusiveMaximum})`),(0,r.IsBigInt)(I.exclusiveMinimum)&&(yield`${C} > BigInt(${I.exclusiveMinimum})`),(0,r.IsBigInt)(I.maximum)&&(yield`${C} <= BigInt(${I.maximum})`),(0,r.IsBigInt)(I.minimum)&&(yield`${C} >= BigInt(${I.minimum})`),(0,r.IsBigInt)(I.multipleOf)&&(yield`(${C} % BigInt(${I.multipleOf})) === 0`)}function*K(I,pe,C){yield`(typeof ${C} === 'boolean')`}function*te(I,pe,C){yield*W(I.returns,pe,`${C}.prototype`)}function*$(I,pe,C){yield`(${C} instanceof Date) && Number.isFinite(${C}.getTime())`,(0,r.IsNumber)(I.exclusiveMaximumTimestamp)&&(yield`${C}.getTime() < ${I.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(I.exclusiveMinimumTimestamp)&&(yield`${C}.getTime() > ${I.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(I.maximumTimestamp)&&(yield`${C}.getTime() <= ${I.maximumTimestamp}`),(0,r.IsNumber)(I.minimumTimestamp)&&(yield`${C}.getTime() >= ${I.minimumTimestamp}`),(0,r.IsNumber)(I.multipleOfTimestamp)&&(yield`(${C}.getTime() % ${I.multipleOfTimestamp}) === 0`)}function*R(I,pe,C){yield`(typeof ${C} === 'function')`}function*z(I,pe,C){yield`(typeof ${C} === 'number' && Number.isInteger(${C}))`,(0,r.IsNumber)(I.exclusiveMaximum)&&(yield`${C} < ${I.exclusiveMaximum}`),(0,r.IsNumber)(I.exclusiveMinimum)&&(yield`${C} > ${I.exclusiveMinimum}`),(0,r.IsNumber)(I.maximum)&&(yield`${C} <= ${I.maximum}`),(0,r.IsNumber)(I.minimum)&&(yield`${C} >= ${I.minimum}`),(0,r.IsNumber)(I.multipleOf)&&(yield`(${C} % ${I.multipleOf}) === 0`)}function*re(I,pe,C){let _e=I.allOf.map(ae=>ie(ae,pe,C)).join(" && ");if(I.unevaluatedProperties===!1){let ae=Ee(`${new RegExp(s.KeyResolver.ResolvePattern(I))};`),he=`Object.getOwnPropertyNames(${C}).every(key => ${ae}.test(key))`;yield`(${_e} && ${he})`}else if(s.TypeGuard.TSchema(I.unevaluatedProperties)){let ae=Ee(`${new RegExp(s.KeyResolver.ResolvePattern(I))};`),he=`Object.getOwnPropertyNames(${C}).every(key => ${ae}.test(key) || ${ie(I.unevaluatedProperties,pe,`${C}[key]`)})`;yield`(${_e} && ${he})`}else yield`(${_e})`}function*se(I,pe,C){yield`(typeof value === 'object' && Symbol.iterator in ${C})`}function*ee(I,pe,C){typeof I.const=="number"||typeof I.const=="boolean"?yield`(${C} === ${I.const})`:yield`(${C} === '${S.Escape(I.const)}')`}function*ce(I,pe,C){yield"false"}function*V(I,pe,C){yield`(!${ie(I.not,pe,C)})`}function*J(I,pe,C){yield`(${C} === null)`}function*Z(I,pe,C){yield L.IsNumberLike(C),(0,r.IsNumber)(I.exclusiveMaximum)&&(yield`${C} < ${I.exclusiveMaximum}`),(0,r.IsNumber)(I.exclusiveMinimum)&&(yield`${C} > ${I.exclusiveMinimum}`),(0,r.IsNumber)(I.maximum)&&(yield`${C} <= ${I.maximum}`),(0,r.IsNumber)(I.minimum)&&(yield`${C} >= ${I.minimum}`),(0,r.IsNumber)(I.multipleOf)&&(yield`(${C} % ${I.multipleOf}) === 0`)}function*me(I,pe,C){yield L.IsObjectLike(C),(0,r.IsNumber)(I.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${I.minProperties}`),(0,r.IsNumber)(I.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${I.maxProperties}`);let _e=Object.getOwnPropertyNames(I.properties);for(let ae of _e){let he=f.Encode(C,ae),Ne=I.properties[ae];if(I.required&&I.required.includes(ae))yield*W(Ne,pe,he),(s.ExtendsUndefined.Check(Ne)||k(Ne))&&(yield`('${ae}' in ${C})`);else{let Ke=ie(Ne,pe,he);yield L.IsExactOptionalProperty(C,ae,Ke)}}if(I.additionalProperties===!1)if(I.required&&I.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 I.additionalProperties=="object"){let ae=ie(I.additionalProperties,pe,`${C}[key]`),he=`[${_e.map(Ne=>`'${Ne}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${C}).every(key => ${he}.includes(key) || ${ae}))`}}function*d(I,pe,C){yield`(typeof value === 'object' && typeof ${C}.then === 'function')`}function*w(I,pe,C){yield L.IsRecordLike(C),(0,r.IsNumber)(I.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${I.minProperties}`),(0,r.IsNumber)(I.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${I.maxProperties}`);let[_e,ae]=Object.entries(I.patternProperties)[0],he=Ee(`${new RegExp(_e)}`),Ne=ie(ae,pe,"value"),Ke=s.TypeGuard.TSchema(I.additionalProperties)?ie(I.additionalProperties,pe,C):I.additionalProperties===!1?"false":"true",lt=`(${he}.test(key) ? ${Ne} : ${Ke})`;yield`(Object.entries(${C}).every(([key, value]) => ${lt}))`}function*x(I,pe,C){let _e=(0,o.Deref)(I,pe);if(ne.functions.has(I.$ref))return yield`${ve(I.$ref)}(${C})`;yield*W(_e,pe,C)}function*P(I,pe,C){yield`(typeof ${C} === 'string')`,(0,r.IsNumber)(I.maxLength)&&(yield`${C}.length <= ${I.maxLength}`),(0,r.IsNumber)(I.minLength)&&(yield`${C}.length >= ${I.minLength}`),I.pattern!==void 0&&(yield`${Ee(`${new RegExp(I.pattern)};`)}.test(${C})`),I.format!==void 0&&(yield`format('${I.format}', ${C})`)}function*j(I,pe,C){yield`(typeof ${C} === 'symbol')`}function*N(I,pe,C){yield`(typeof ${C} === 'string')`,yield`${Ee(`${new RegExp(I.pattern)};`)}.test(${C})`}function*g(I,pe,C){yield`${ve(I.$ref)}(${C})`}function*A(I,pe,C){if(yield`Array.isArray(${C})`,I.items===void 0)return yield`${C}.length === 0`;yield`(${C}.length === ${I.maxItems})`;for(let _e=0;_e<I.items.length;_e++)yield`${ie(I.items[_e],pe,`${C}[${_e}]`)}`}function*_(I,pe,C){yield`${C} === undefined`}function*c(I,pe,C){yield`(${I.anyOf.map(_e=>ie(_e,pe,C)).join(" || ")})`}function*E(I,pe,C){yield`${C} instanceof Uint8Array`,(0,r.IsNumber)(I.maxByteLength)&&(yield`(${C}.length <= ${I.maxByteLength})`),(0,r.IsNumber)(I.minByteLength)&&(yield`(${C}.length >= ${I.minByteLength})`)}function*v(I,pe,C){yield"true"}function*b(I,pe,C){yield L.IsVoidLike(C)}function*M(I,pe,C){let _e=ne.instances.size;ne.instances.set(_e,I),yield`kind('${I[s.Kind]}', ${_e}, ${C})`}function*W(I,pe,C,_e=!0){let ae=(0,r.IsString)(I.$id)?[...pe,I]:pe,he=I;if(_e&&(0,r.IsString)(I.$id)){let Ne=ve(I.$id);if(ne.functions.has(Ne))return yield`${Ne}(${C})`;{let Ke=Be(Ne,I,pe,"value",!1);return ne.functions.set(Ne,Ke),yield`${Ne}(${C})`}}switch(he[s.Kind]){case"Any":return yield*F(he,ae,C);case"Array":return yield*G(he,ae,C);case"AsyncIterator":return yield*B(he,ae,C);case"BigInt":return yield*Y(he,ae,C);case"Boolean":return yield*K(he,ae,C);case"Constructor":return yield*te(he,ae,C);case"Date":return yield*$(he,ae,C);case"Function":return yield*R(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*me(he,ae,C);case"Promise":return yield*d(he,ae,C);case"Record":return yield*w(he,ae,C);case"Ref":return yield*x(he,ae,C);case"String":return yield*P(he,ae,C);case"Symbol":return yield*j(he,ae,C);case"TemplateLiteral":return yield*N(he,ae,C);case"This":return yield*g(he,ae,C);case"Tuple":return yield*A(he,ae,C);case"Undefined":return yield*_(he,ae,C);case"Union":return yield*c(he,ae,C);case"Uint8Array":return yield*E(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 O(I);return yield*M(he,ae,C)}}let ne={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function ie(I,pe,C,_e=!0){return`(${[...W(I,pe,C,_e)].join(" && ")})`}function ve(I){return`check_${p.Encode(I)}`}function Ee(I){let pe=`local_${ne.variables.size}`;return ne.variables.set(pe,`const ${pe} = ${I}`),pe}function Be(I,pe,C,_e,ae=!0){let[he,Ne]=[`
|
|
49
|
+
`,ft=>"".padStart(ft," ")],Ke=ze("value","any"),lt=qr("boolean"),it=[...W(pe,C,_e,ae)].map(ft=>`${Ne(4)}${ft}`).join(` &&${he}`);return`function ${I}(${Ke})${lt} {${he}${Ne(2)}return (${he}${it}${he}${Ne(2)})
|
|
50
|
+
}`}function ze(I,pe){let C=ne.language==="typescript"?`: ${pe}`:"";return`${I}${C}`}function qr(I){return ne.language==="typescript"?`: ${I}`:""}function Te(I,pe,C){let _e=Be("check",I,pe,"value"),ae=ze("value","any"),he=qr("boolean"),Ne=[...ne.functions.values()],Ke=[...ne.variables.values()],lt=(0,r.IsString)(I.$id)?`return function check(${ae})${he} {
|
|
51
|
+
return ${ve(I.$id)}(value)
|
|
52
|
+
}`:`return ${_e}`;return[...Ke,...Ne,lt].join(`
|
|
53
|
+
`)}function Or(...I){let pe={language:"javascript"},[C,_e,ae]=I.length===2&&(0,r.IsArray)(I[1])?[I[0],I[1],pe]:I.length===2&&!(0,r.IsArray)(I[1])?[I[0],[],I[1]]:I.length===3?[I[0],I[1],I[2]]:I.length===1?[I[0],[],pe]:[null,[],pe];if(ne.language=ae.language,ne.variables.clear(),ne.functions.clear(),ne.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)}U.Code=Or;function Wr(I,pe=[]){let C=Or(I,pe,{language:"javascript"}),_e=globalThis.Function("kind","format","hash",C),ae=new Map(ne.instances);function he(it,ft,Er){if(!s.TypeRegistry.Has(it)||!ae.has(ft))return!1;let In=s.TypeRegistry.Get(it),Sn=ae.get(ft);return In(Sn,Er)}function Ne(it,ft){return s.FormatRegistry.Has(it)?s.FormatRegistry.Get(it)(ft):!1}function Ke(it){return(0,a.Hash)(it)}let lt=_e(he,Ne,Ke);return new u(I,pe,lt,C)}U.Compile=Wr})(H||(e.TypeCompiler=H={}))}}),z0=Ye({"../../../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=D0();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(F0(),e)}}),na=wr(U0(),1),K0=wr(B0(),1),Zd=!1,ep=!1;na.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Zd=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(ep=process?.env?.LOGGER_PERF_PREFIX==="true"));var G0={prefix:void 0,time:Zd,delta:ep,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},ms=[],tp=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(",")}]`}},rp=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},xi=!1,ke=class dt{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=dt.INFO,r={}){r=Object.assign({},G0,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(...S){let O=S[S.length-1];return O===i?O():(o(...S.slice(0,-1)),(async()=>{try{let T=O();return T instanceof Promise?await T:T}finally{console.groupEnd()}})())}let p=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?p:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:p})},s=a(t>=dt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error(u.map(l=>typeof l=="string"?l:(0,K0.default)(l)).join(" "))),WARN:a(t>=dt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=dt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=dt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=dt.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")?["",dt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(xi?n.push(new rp("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();dt.firstLog||(dt.firstLog=i,dt.lastLog=i);let o=new tp(i-dt.firstLog,i-dt.lastLog,t,r);return dt.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}}}};na.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(ms&&ms.length){for(let t of ms)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof tp))return null;xi||(xi=!0);let t=ke.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof rp?(xi||(xi=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var q0=typeof global=="object"&&global&&global.Object===Object&&global,np=q0,W0=typeof self=="object"&&self&&self.Object===Object&&self,H0=np||W0||Function("return this")(),wt=H0,J0=wt.Symbol,or=J0,ip=Object.prototype,Q0=ip.hasOwnProperty,Y0=ip.toString,wi=or?or.toStringTag:void 0;function X0(e){var t=Q0.call(e,wi),r=e[wi];try{e[wi]=void 0;var n=!0}catch{}var i=Y0.call(e);return n&&(t?e[wi]=r:delete e[wi]),i}var Z0=X0,ew=Object.prototype,tw=ew.toString;function rw(e){return tw.call(e)}var nw=rw,iw="[object Null]",ow="[object Undefined]",bc=or?or.toStringTag:void 0;function aw(e){return e==null?e===void 0?ow:iw:bc&&bc in Object(e)?Z0(e):nw(e)}var ni=aw;function sw(e){return e!=null&&typeof e=="object"}var Dr=sw,uw="[object Symbol]";function lw(e){return typeof e=="symbol"||Dr(e)&&ni(e)==uw}var Dn=lw;function cw(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 op=cw,fw=Array.isArray,Xt=fw,dw=1/0,vc=or?or.prototype:void 0,wc=vc?vc.toString:void 0;function ap(e){if(typeof e=="string")return e;if(Xt(e))return op(e,ap)+"";if(Dn(e))return wc?wc.call(e):"";var t=e+"";return t=="0"&&1/e==-dw?"-0":t}var pw=ap,hw=/\s/;function yw(e){for(var t=e.length;t--&&hw.test(e.charAt(t)););return t}var gw=yw,mw=/^\s+/;function bw(e){return e&&e.slice(0,gw(e)+1).replace(mw,"")}var vw=bw;function ww(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var gr=ww,_c=NaN,_w=/^[-+]0x[0-9a-f]+$/i,Tw=/^0b[01]+$/i,Ow=/^0o[0-7]+$/i,Ew=parseInt;function Aw(e){if(typeof e=="number")return e;if(Dn(e))return _c;if(gr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=gr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=vw(e);var r=Tw.test(e);return r||Ow.test(e)?Ew(e.slice(2),r?2:8):_w.test(e)?_c:+e}var xw=Aw,Tc=1/0,Iw=17976931348623157e292;function Sw(e){if(!e)return e===0?e:0;if(e=xw(e),e===Tc||e===-Tc){var t=e<0?-1:1;return t*Iw}return e===e?e:0}var kw=Sw;function $w(e){var t=kw(e),r=t%1;return t===t?r?t-r:t:0}var Oc=$w;function jw(e){return e}var Fa=jw,Cw="[object AsyncFunction]",Nw="[object Function]",Mw="[object GeneratorFunction]",Pw="[object Proxy]";function Uw(e){if(!gr(e))return!1;var t=ni(e);return t==Nw||t==Mw||t==Cw||t==Pw}var sp=Uw,Bw=wt["__core-js_shared__"],bs=Bw,Ec=function(){var e=/[^.]+$/.exec(bs&&bs.keys&&bs.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Rw(e){return!!Ec&&Ec in e}var Dw=Rw,Lw=Function.prototype,Vw=Lw.toString;function Fw(e){if(e!=null){try{return Vw.call(e)}catch{}try{return e+""}catch{}}return""}var yn=Fw,zw=/[\\^$.*+?()[\]{}|]/g,Kw=/^\[object .+?Constructor\]$/,Gw=Function.prototype,qw=Object.prototype,Ww=Gw.toString,Hw=qw.hasOwnProperty,Jw=RegExp("^"+Ww.call(Hw).replace(zw,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Qw(e){if(!gr(e)||Dw(e))return!1;var t=sp(e)?Jw:Kw;return t.test(yn(e))}var Yw=Qw;function Xw(e,t){return e?.[t]}var Zw=Xw;function e1(e,t){var r=Zw(e,t);return Yw(r)?r:void 0}var gn=e1,t1=gn(wt,"WeakMap"),Ri=t1,r1=Ri&&new Ri,ia=r1,n1=ia?function(e,t){return ia.set(e,t),e}:Fa,up=n1,Ac=Object.create,i1=function(){function e(){}return function(t){if(!gr(t))return{};if(Ac)return Ac(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),Fu=i1;function o1(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=Fu(e.prototype),n=e.apply(r,t);return gr(n)?n:r}}var Di=o1,a1=1;function s1(e,t,r){var n=t&a1,i=Di(e);function o(){var a=this&&this!==wt&&this instanceof o?i:e;return a.apply(n?r:this,arguments)}return o}var u1=s1;function l1(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 zu=l1,c1=Math.max;function f1(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,l=c1(o-a,0),f=Array(u+l),p=!n;++s<u;)f[s]=t[s];for(;++i<a;)(p||i<o)&&(f[r[i]]=e[i]);for(;l--;)f[s++]=e[i++];return f}var lp=f1,d1=Math.max;function p1(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,u=-1,l=t.length,f=d1(o-s,0),p=Array(f+l),S=!n;++i<f;)p[i]=e[i];for(var O=i;++u<l;)p[O+u]=t[u];for(;++a<s;)(S||i<o)&&(p[O+r[a]]=e[i++]);return p}var cp=p1;function h1(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var y1=h1;function g1(){}var Ku=g1,m1=4294967295;function oa(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m1,this.__views__=[]}oa.prototype=Fu(Ku.prototype);oa.prototype.constructor=oa;var Gu=oa;function b1(){}var fp=b1,v1=ia?function(e){return ia.get(e)}:fp,dp=v1,w1={},xc=w1,_1=Object.prototype,T1=_1.hasOwnProperty;function O1(e){for(var t=e.name+"",r=xc[t],n=T1.call(xc,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var E1=O1;function aa(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}aa.prototype=Fu(Ku.prototype);aa.prototype.constructor=aa;var Ys=aa;function A1(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var pp=A1;function x1(e){if(e instanceof Gu)return e.clone();var t=new Ys(e.__wrapped__,e.__chain__);return t.__actions__=pp(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var I1=x1,S1=Object.prototype,k1=S1.hasOwnProperty;function sa(e){if(Dr(e)&&!Xt(e)&&!(e instanceof Gu)){if(e instanceof Ys)return e;if(k1.call(e,"__wrapped__"))return I1(e)}return new Ys(e)}sa.prototype=Ku.prototype;sa.prototype.constructor=sa;var $1=sa;function j1(e){var t=E1(e),r=$1[t];if(typeof r!="function"||!(t in Gu.prototype))return!1;if(e===r)return!0;var n=dp(r);return!!n&&e===n[0]}var C1=j1,N1=800,M1=16,P1=Date.now;function U1(e){var t=0,r=0;return function(){var n=P1(),i=M1-(n-r);if(r=n,i>0){if(++t>=N1)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var hp=U1,B1=hp(up),yp=B1,R1=/\{\n\/\* \[wrapped with (.+)\] \*/,D1=/,? & /;function L1(e){var t=e.match(R1);return t?t[1].split(D1):[]}var V1=L1,F1=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function z1(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(F1,`{
|
|
55
|
+
/* [wrapped with `+t+`] */
|
|
56
|
+
`)}var K1=z1;function G1(e){return function(){return e}}var q1=G1,W1=function(){try{var e=gn(Object,"defineProperty");return e({},"",{}),e}catch{}}(),ua=W1,H1=ua?function(e,t){return ua(e,"toString",{configurable:!0,enumerable:!1,value:q1(t),writable:!0})}:Fa,J1=H1,Q1=hp(J1),qu=Q1;function Y1(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var X1=Y1;function Z1(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 e_=Z1;function t_(e){return e!==e}var r_=t_;function n_(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var i_=n_;function o_(e,t,r){return t===t?i_(e,t,r):e_(e,r_,r)}var a_=o_;function s_(e,t){var r=e==null?0:e.length;return!!r&&a_(e,t,0)>-1}var gp=s_,u_=1,l_=2,c_=8,f_=16,d_=32,p_=64,h_=128,y_=256,g_=512,m_=[["ary",h_],["bind",u_],["bindKey",l_],["curry",c_],["curryRight",f_],["flip",g_],["partial",d_],["partialRight",p_],["rearg",y_]];function b_(e,t){return X1(m_,function(r){var n="_."+r[0];t&r[1]&&!gp(e,n)&&e.push(n)}),e.sort()}var v_=b_;function w_(e,t,r){var n=t+"";return qu(e,K1(n,v_(V1(n),r)))}var mp=w_,__=1,T_=2,O_=4,E_=8,Ic=32,Sc=64;function A_(e,t,r,n,i,o,a,s,u,l){var f=t&E_,p=f?a:void 0,S=f?void 0:a,O=f?o:void 0,T=f?void 0:o;t|=f?Ic:Sc,t&=~(f?Sc:Ic),t&O_||(t&=~(__|T_));var L=[e,t,i,O,p,T,S,s,u,l],H=r.apply(void 0,L);return C1(e)&&yp(H,L),H.placeholder=n,mp(H,e,t)}var bp=A_;function x_(e){var t=e;return t.placeholder}var Wu=x_,I_=9007199254740991,S_=/^(?:0|[1-9]\d*)$/;function k_(e,t){var r=typeof e;return t=t??I_,!!t&&(r=="number"||r!="symbol"&&S_.test(e))&&e>-1&&e%1==0&&e<t}var za=k_,$_=Math.min;function j_(e,t){for(var r=e.length,n=$_(t.length,r),i=pp(e);n--;){var o=t[n];e[n]=za(o,r)?i[o]:void 0}return e}var C_=j_,kc="__lodash_placeholder__";function N_(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===kc)&&(e[r]=kc,o[i++]=r)}return o}var Li=N_,M_=1,P_=2,U_=8,B_=16,R_=128,D_=512;function vp(e,t,r,n,i,o,a,s,u,l){var f=t&R_,p=t&M_,S=t&P_,O=t&(U_|B_),T=t&D_,L=S?void 0:Di(e);function H(){for(var U=arguments.length,k=Array(U),F=U;F--;)k[F]=arguments[F];if(O)var G=Wu(H),B=y1(k,G);if(n&&(k=lp(k,n,i,O)),o&&(k=cp(k,o,a,O)),U-=B,O&&U<l){var Y=Li(k,G);return bp(e,t,vp,H.placeholder,r,k,Y,s,u,l-U)}var K=p?r:this,te=S?K[e]:e;return U=k.length,s?k=C_(k,s):T&&U>1&&k.reverse(),f&&u<U&&(k.length=u),this&&this!==wt&&this instanceof H&&(te=L||Di(te)),te.apply(K,k)}return H}var wp=vp;function L_(e,t,r){var n=Di(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=Wu(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:Li(a,u);if(o-=l.length,o<r)return bp(e,t,wp,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==wt&&this instanceof i?n:e;return zu(f,this,a)}return i}var V_=L_,F_=1;function z_(e,t,r,n){var i=t&F_,o=Di(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,p=Array(f+u),S=this&&this!==wt&&this instanceof a?o:e;++l<f;)p[l]=n[l];for(;u--;)p[l++]=arguments[++s];return zu(S,i?r:this,p)}return a}var K_=z_,$c="__lodash_placeholder__",vs=1,G_=2,q_=4,jc=8,_i=128,Cc=256,W_=Math.min;function H_(e,t){var r=e[1],n=t[1],i=r|n,o=i<(vs|G_|_i),a=n==_i&&r==jc||n==_i&&r==Cc&&e[7].length<=t[8]||n==(_i|Cc)&&t[7].length<=t[8]&&r==jc;if(!(o||a))return e;n&vs&&(e[2]=t[2],i|=r&vs?0:q_);var s=t[3];if(s){var u=e[3];e[3]=u?lp(u,s,t[4]):s,e[4]=u?Li(e[3],$c):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?cp(u,s,t[6]):s,e[6]=u?Li(e[5],$c):t[6]),s=t[7],s&&(e[7]=s),n&_i&&(e[8]=e[8]==null?t[8]:W_(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var J_=H_,Q_="Expected a function",Nc=1,Y_=2,ws=8,_s=16,Ts=32,Mc=64,Pc=Math.max;function X_(e,t,r,n,i,o,a,s){var u=t&Y_;if(!u&&typeof e!="function")throw new TypeError(Q_);var l=n?n.length:0;if(l||(t&=~(Ts|Mc),n=i=void 0),a=a===void 0?a:Pc(Oc(a),0),s=s===void 0?s:Oc(s),l-=i?i.length:0,t&Mc){var f=n,p=i;n=i=void 0}var S=u?void 0:dp(e),O=[e,t,r,n,i,f,p,o,a,s];if(S&&J_(O,S),e=O[0],t=O[1],r=O[2],n=O[3],i=O[4],s=O[9]=O[9]===void 0?u?0:e.length:Pc(O[9]-l,0),!s&&t&(ws|_s)&&(t&=~(ws|_s)),!t||t==Nc)var T=u1(e,t,r);else t==ws||t==_s?T=V_(e,t,s):(t==Ts||t==(Nc|Ts))&&!i.length?T=K_(e,t,r,n):T=wp.apply(void 0,O);var L=S?up:yp;return mp(L(T,O),e,t)}var Z_=X_;function eT(e,t,r){t=="__proto__"&&ua?ua(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var tT=eT;function rT(e,t){return e===t||e!==e&&t!==t}var Hu=rT,nT=Object.prototype,iT=nT.hasOwnProperty;function oT(e,t,r){var n=e[t];(!(iT.call(e,t)&&Hu(n,r))||r===void 0&&!(t in e))&&tT(e,t,r)}var aT=oT,Uc=Math.max;function sT(e,t,r){return t=Uc(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=Uc(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),zu(e,this,s)}}var _p=sT;function uT(e,t){return qu(_p(e,t,Fa),e+"")}var Tp=uT,lT=9007199254740991;function cT(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=lT}var Ju=cT;function fT(e){return e!=null&&Ju(e.length)&&!sp(e)}var Op=fT,dT=Object.prototype;function pT(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||dT;return e===r}var hT=pT;function yT(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var gT=yT,mT="[object Arguments]";function bT(e){return Dr(e)&&ni(e)==mT}var Bc=bT,Ep=Object.prototype,vT=Ep.hasOwnProperty,wT=Ep.propertyIsEnumerable,_T=Bc(function(){return arguments}())?Bc:function(e){return Dr(e)&&vT.call(e,"callee")&&!wT.call(e,"callee")},Qu=_T;function TT(){return!1}var OT=TT,Ap=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Rc=Ap&&typeof module=="object"&&module&&!module.nodeType&&module,ET=Rc&&Rc.exports===Ap,Dc=ET?wt.Buffer:void 0,AT=Dc?Dc.isBuffer:void 0,xT=AT||OT,Xs=xT,IT="[object Arguments]",ST="[object Array]",kT="[object Boolean]",$T="[object Date]",jT="[object Error]",CT="[object Function]",NT="[object Map]",MT="[object Number]",PT="[object Object]",UT="[object RegExp]",BT="[object Set]",RT="[object String]",DT="[object WeakMap]",LT="[object ArrayBuffer]",VT="[object DataView]",FT="[object Float32Array]",zT="[object Float64Array]",KT="[object Int8Array]",GT="[object Int16Array]",qT="[object Int32Array]",WT="[object Uint8Array]",HT="[object Uint8ClampedArray]",JT="[object Uint16Array]",QT="[object Uint32Array]",Re={};Re[FT]=Re[zT]=Re[KT]=Re[GT]=Re[qT]=Re[WT]=Re[HT]=Re[JT]=Re[QT]=!0;Re[IT]=Re[ST]=Re[LT]=Re[kT]=Re[VT]=Re[$T]=Re[jT]=Re[CT]=Re[NT]=Re[MT]=Re[PT]=Re[UT]=Re[BT]=Re[RT]=Re[DT]=!1;function YT(e){return Dr(e)&&Ju(e.length)&&!!Re[ni(e)]}var XT=YT;function ZT(e){return function(t){return e(t)}}var xp=ZT,Ip=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ji=Ip&&typeof module=="object"&&module&&!module.nodeType&&module,e2=ji&&ji.exports===Ip,Os=e2&&np.process,t2=function(){try{var e=ji&&ji.require&&ji.require("util").types;return e||Os&&Os.binding&&Os.binding("util")}catch{}}(),Lc=t2,Vc=Lc&&Lc.isTypedArray,r2=Vc?xp(Vc):XT,Sp=r2,n2=Object.prototype,i2=n2.hasOwnProperty;function o2(e,t){var r=Xt(e),n=!r&&Qu(e),i=!r&&!n&&Xs(e),o=!r&&!n&&!i&&Sp(e),a=r||n||i||o,s=a?gT(e.length,String):[],u=s.length;for(var l in e)(t||i2.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||za(l,u)))&&s.push(l);return s}var a2=o2;function s2(e,t){return function(r){return e(t(r))}}var u2=s2,l2=u2(Object.keys,Object),c2=l2,f2=Object.prototype,d2=f2.hasOwnProperty;function p2(e){if(!hT(e))return c2(e);var t=[];for(var r in Object(e))d2.call(e,r)&&r!="constructor"&&t.push(r);return t}var h2=p2;function y2(e){return Op(e)?a2(e):h2(e)}var kp=y2,g2=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,m2=/^\w*$/;function b2(e,t){if(Xt(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||Dn(e)?!0:m2.test(e)||!g2.test(e)||t!=null&&e in Object(t)}var Yu=b2,v2=gn(Object,"create"),Vi=v2;function w2(){this.__data__=Vi?Vi(null):{},this.size=0}var _2=w2;function T2(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var O2=T2,E2="__lodash_hash_undefined__",A2=Object.prototype,x2=A2.hasOwnProperty;function I2(e){var t=this.__data__;if(Vi){var r=t[e];return r===E2?void 0:r}return x2.call(t,e)?t[e]:void 0}var S2=I2,k2=Object.prototype,$2=k2.hasOwnProperty;function j2(e){var t=this.__data__;return Vi?t[e]!==void 0:$2.call(t,e)}var C2=j2,N2="__lodash_hash_undefined__";function M2(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Vi&&t===void 0?N2:t,this}var P2=M2;function ii(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])}}ii.prototype.clear=_2;ii.prototype.delete=O2;ii.prototype.get=S2;ii.prototype.has=C2;ii.prototype.set=P2;var Fc=ii;function U2(){this.__data__=[],this.size=0}var B2=U2;function R2(e,t){for(var r=e.length;r--;)if(Hu(e[r][0],t))return r;return-1}var Ka=R2,D2=Array.prototype,L2=D2.splice;function V2(e){var t=this.__data__,r=Ka(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():L2.call(t,r,1),--this.size,!0}var F2=V2;function z2(e){var t=this.__data__,r=Ka(t,e);return r<0?void 0:t[r][1]}var K2=z2;function G2(e){return Ka(this.__data__,e)>-1}var q2=G2;function W2(e,t){var r=this.__data__,n=Ka(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var H2=W2;function oi(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])}}oi.prototype.clear=B2;oi.prototype.delete=F2;oi.prototype.get=K2;oi.prototype.has=q2;oi.prototype.set=H2;var Ga=oi,J2=gn(wt,"Map"),Fi=J2;function Q2(){this.size=0,this.__data__={hash:new Fc,map:new(Fi||Ga),string:new Fc}}var Y2=Q2;function X2(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Z2=X2;function eO(e,t){var r=e.__data__;return Z2(t)?r[typeof t=="string"?"string":"hash"]:r.map}var qa=eO;function tO(e){var t=qa(this,e).delete(e);return this.size-=t?1:0,t}var rO=tO;function nO(e){return qa(this,e).get(e)}var iO=nO;function oO(e){return qa(this,e).has(e)}var aO=oO;function sO(e,t){var r=qa(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var uO=sO;function ai(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])}}ai.prototype.clear=Y2;ai.prototype.delete=rO;ai.prototype.get=iO;ai.prototype.has=aO;ai.prototype.set=uO;var Wa=ai,lO="Expected a function";function Xu(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(lO);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(Xu.Cache||Wa),r}Xu.Cache=Wa;var cO=Xu,fO=500;function dO(e){var t=cO(e,function(n){return r.size===fO&&r.clear(),n}),r=t.cache;return t}var pO=dO,hO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yO=/\\(\\)?/g,gO=pO(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(hO,function(r,n,i,o){t.push(i?o.replace(yO,"$1"):n||r)}),t}),mO=gO;function bO(e){return e==null?"":pw(e)}var vO=bO;function wO(e,t){return Xt(e)?e:Yu(e,t)?[e]:mO(vO(e))}var Ha=wO,_O=1/0;function TO(e){if(typeof e=="string"||Dn(e))return e;var t=e+"";return t=="0"&&1/e==-_O?"-0":t}var io=TO;function OO(e,t){t=Ha(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[io(t[r++])];return r&&r==n?e:void 0}var Zu=OO;function EO(e,t,r){var n=e==null?void 0:Zu(e,t);return n===void 0?r:n}var AO=EO;function xO(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var $p=xO,zc=or?or.isConcatSpreadable:void 0;function IO(e){return Xt(e)||Qu(e)||!!(zc&&e&&e[zc])}var SO=IO;function jp(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=SO),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?jp(s,t-1,r,n,i):$p(i,s):n||(i[i.length]=s)}return i}var kO=jp;function $O(e){var t=e==null?0:e.length;return t?kO(e,1):[]}var jO=$O;function CO(e){return qu(_p(e,void 0,jO),e+"")}var NO=CO;function MO(){this.__data__=new Ga,this.size=0}var PO=MO;function UO(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var BO=UO;function RO(e){return this.__data__.get(e)}var DO=RO;function LO(e){return this.__data__.has(e)}var VO=LO,FO=200;function zO(e,t){var r=this.__data__;if(r instanceof Ga){var n=r.__data__;if(!Fi||n.length<FO-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Wa(n)}return r.set(e,t),this.size=r.size,this}var KO=zO;function si(e){var t=this.__data__=new Ga(e);this.size=t.size}si.prototype.clear=PO;si.prototype.delete=BO;si.prototype.get=DO;si.prototype.has=VO;si.prototype.set=KO;var So=si;function GO(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 qO=GO;function WO(){return[]}var HO=WO,JO=Object.prototype,QO=JO.propertyIsEnumerable,Kc=Object.getOwnPropertySymbols,YO=Kc?function(e){return e==null?[]:(e=Object(e),qO(Kc(e),function(t){return QO.call(e,t)}))}:HO,XO=YO;function ZO(e,t,r){var n=t(e);return Xt(e)?n:$p(n,r(e))}var eE=ZO;function tE(e){return eE(e,kp,XO)}var Gc=tE,rE=gn(wt,"DataView"),Zs=rE,nE=gn(wt,"Promise"),eu=nE,iE=gn(wt,"Set"),Pn=iE,qc="[object Map]",oE="[object Object]",Wc="[object Promise]",Hc="[object Set]",Jc="[object WeakMap]",Qc="[object DataView]",aE=yn(Zs),sE=yn(Fi),uE=yn(eu),lE=yn(Pn),cE=yn(Ri),Zr=ni;(Zs&&Zr(new Zs(new ArrayBuffer(1)))!=Qc||Fi&&Zr(new Fi)!=qc||eu&&Zr(eu.resolve())!=Wc||Pn&&Zr(new Pn)!=Hc||Ri&&Zr(new Ri)!=Jc)&&(Zr=function(e){var t=ni(e),r=t==oE?e.constructor:void 0,n=r?yn(r):"";if(n)switch(n){case aE:return Qc;case sE:return qc;case uE:return Wc;case lE:return Hc;case cE:return Jc}return t});var Yc=Zr,fE=wt.Uint8Array,Xc=fE,dE="__lodash_hash_undefined__";function pE(e){return this.__data__.set(e,dE),this}var hE=pE;function yE(e){return this.__data__.has(e)}var gE=yE;function la(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Wa;++t<r;)this.add(e[t])}la.prototype.add=la.prototype.push=hE;la.prototype.has=gE;var Cp=la;function mE(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 bE=mE;function vE(e,t){return e.has(t)}var Np=vE,wE=1,_E=2;function TE(e,t,r,n,i,o){var a=r&wE,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 p=-1,S=!0,O=r&_E?new Cp:void 0;for(o.set(e,t),o.set(t,e);++p<s;){var T=e[p],L=t[p];if(n)var H=a?n(L,T,p,t,e,o):n(T,L,p,e,t,o);if(H!==void 0){if(H)continue;S=!1;break}if(O){if(!bE(t,function(U,k){if(!Np(O,k)&&(T===U||i(T,U,r,n,o)))return O.push(k)})){S=!1;break}}else if(!(T===L||i(T,L,r,n,o))){S=!1;break}}return o.delete(e),o.delete(t),S}var Mp=TE;function OE(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var EE=OE;function AE(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Pp=AE,xE=1,IE=2,SE="[object Boolean]",kE="[object Date]",$E="[object Error]",jE="[object Map]",CE="[object Number]",NE="[object RegExp]",ME="[object Set]",PE="[object String]",UE="[object Symbol]",BE="[object ArrayBuffer]",RE="[object DataView]",Zc=or?or.prototype:void 0,Es=Zc?Zc.valueOf:void 0;function DE(e,t,r,n,i,o,a){switch(r){case RE:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case BE:return!(e.byteLength!=t.byteLength||!o(new Xc(e),new Xc(t)));case SE:case kE:case CE:return Hu(+e,+t);case $E:return e.name==t.name&&e.message==t.message;case NE:case PE:return e==t+"";case jE:var s=EE;case ME:var u=n&xE;if(s||(s=Pp),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=IE,a.set(e,t);var f=Mp(s(e),s(t),n,i,o,a);return a.delete(e),f;case UE:if(Es)return Es.call(e)==Es.call(t)}return!1}var LE=DE,VE=1,FE=Object.prototype,zE=FE.hasOwnProperty;function KE(e,t,r,n,i,o){var a=r&VE,s=Gc(e),u=s.length,l=Gc(t),f=l.length;if(u!=f&&!a)return!1;for(var p=u;p--;){var S=s[p];if(!(a?S in t:zE.call(t,S)))return!1}var O=o.get(e),T=o.get(t);if(O&&T)return O==t&&T==e;var L=!0;o.set(e,t),o.set(t,e);for(var H=a;++p<u;){S=s[p];var U=e[S],k=t[S];if(n)var F=a?n(k,U,S,t,e,o):n(U,k,S,e,t,o);if(!(F===void 0?U===k||i(U,k,r,n,o):F)){L=!1;break}H||(H=S=="constructor")}if(L&&!H){var G=e.constructor,B=t.constructor;G!=B&&"constructor"in e&&"constructor"in t&&!(typeof G=="function"&&G instanceof G&&typeof B=="function"&&B instanceof B)&&(L=!1)}return o.delete(e),o.delete(t),L}var GE=KE,qE=1,ef="[object Arguments]",tf="[object Array]",To="[object Object]",WE=Object.prototype,rf=WE.hasOwnProperty;function HE(e,t,r,n,i,o){var a=Xt(e),s=Xt(t),u=a?tf:Yc(e),l=s?tf:Yc(t);u=u==ef?To:u,l=l==ef?To:l;var f=u==To,p=l==To,S=u==l;if(S&&Xs(e)){if(!Xs(t))return!1;a=!0,f=!1}if(S&&!f)return o||(o=new So),a||Sp(e)?Mp(e,t,r,n,i,o):LE(e,t,u,r,n,i,o);if(!(r&qE)){var O=f&&rf.call(e,"__wrapped__"),T=p&&rf.call(t,"__wrapped__");if(O||T){var L=O?e.value():e,H=T?t.value():t;return o||(o=new So),i(L,H,r,n,o)}}return S?(o||(o=new So),GE(e,t,r,n,i,o)):!1}var JE=HE;function Up(e,t,r,n,i){return e===t?!0:e==null||t==null||!Dr(e)&&!Dr(t)?e!==e&&t!==t:JE(e,t,r,n,Up,i)}var Bp=Up,QE=1,YE=2;function XE(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 p=new So;if(n)var S=n(l,f,u,e,t,p);if(!(S===void 0?Bp(f,l,QE|YE,n,p):S))return!1}}return!0}var ZE=XE;function eA(e){return e===e&&!gr(e)}var Rp=eA;function tA(e){for(var t=kp(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Rp(i)]}return t}var rA=tA;function nA(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var Dp=nA;function iA(e){var t=rA(e);return t.length==1&&t[0][2]?Dp(t[0][0],t[0][1]):function(r){return r===e||ZE(r,e,t)}}var oA=iA;function aA(e,t){return e!=null&&t in Object(e)}var sA=aA;function uA(e,t,r){t=Ha(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=io(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&&Ju(i)&&za(a,i)&&(Xt(e)||Qu(e)))}var lA=uA;function cA(e,t){return e!=null&&lA(e,t,sA)}var Lp=cA,fA=1,dA=2;function pA(e,t){return Yu(e)&&Rp(t)?Dp(io(e),t):function(r){var n=AO(r,e);return n===void 0&&n===t?Lp(r,e):Bp(t,n,fA|dA)}}var hA=pA;function yA(e){return function(t){return t?.[e]}}var gA=yA;function mA(e){return function(t){return Zu(t,e)}}var bA=mA;function vA(e){return Yu(e)?gA(io(e)):bA(e)}var wA=vA;function _A(e){return typeof e=="function"?e:e==null?Fa:typeof e=="object"?Xt(e)?hA(e[0],e[1]):oA(e):wA(e)}var TA=_A;function OA(e){return Dr(e)&&Op(e)}var EA=OA;function AA(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 xA=AA,IA=200;function SA(e,t,r,n){var i=-1,o=gp,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;r&&(t=op(t,xp(r))),n?(o=xA,a=!1):t.length>=IA&&(o=Np,a=!1,t=new Cp(t));e:for(;++i<s;){var f=e[i],p=r==null?f:r(f);if(f=n||f!==0?f:0,a&&p===p){for(var S=l;S--;)if(t[S]===p)continue e;u.push(f)}else o(t,p,n)||u.push(f)}return u}var kA=SA;function $A(e,t,r,n){if(!gr(e))return e;t=Ha(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=io(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=gr(f)?f:za(t[i+1])?[]:{})}aT(s,u,l),s=s[u]}return e}var jA=$A;function CA(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=Zu(e,a);r(s,a)&&jA(o,Ha(a,e),s)}return o}var NA=CA,MA=32,el=Tp(function(e,t){var r=Li(t,Wu(el));return Z_(e,MA,void 0,t,r)});el.placeholder={};var PA=el;function UA(e,t){return NA(e,t,function(r,n){return Lp(e,n)})}var BA=UA,RA=NO(function(e,t){return e==null?{}:BA(e,t)}),nf=RA,DA=4294967295,LA=DA-1,VA=Math.floor,FA=Math.min;function zA(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=Dn(t),l=t===void 0;i<o;){var f=VA((i+o)/2),p=r(e[f]),S=p!==void 0,O=p===null,T=p===p,L=Dn(p);if(a)var H=n||T;else l?H=T&&(n||S):s?H=T&&S&&(n||!O):u?H=T&&S&&!O&&(n||!L):O||L?H=!1:H=n?p<=t:p<t;H?i=f+1:o=f}return FA(o,LA)}var KA=zA;function GA(e,t,r){return KA(e,t,TA(r,2))}var qA=GA,WA=1/0,wC=Pn&&1/Pp(new Pn([,-0]))[1]==WA?function(e){return new Pn(e)}:fp,HA=Tp(function(e,t){return EA(e)?kA(e,t):[]}),of=HA,Vp=wr(R0(),1),_C=Vp.default.configure,zi=Vp.default,As=100,{WARN:JA,LOG:TC,DEBUG:Qe,VERBOSE:Oe,ERROR:OC}=ke.setup(ke.INFO),ca=Le.set();Xv({enforceActions:"always"});if(!new class{xyz}().hasOwnProperty("xyz"))throw new Error("Transpiler is not configured correctly");var qe=({caller:e,thread:t,pattern:r,args:n})=>De(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:zi(n)}}`:""}`));function QA(e,t){return De(()=>We.structural(e.get(),t.get()))}function oo(e,t){return We.shallow(e.applogs,t.applogs)}function tl(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(Oe.isEnabled&&Oe("queryNodesComparer",r,n,i),!We.structural(n.variables,i.variables))return Oe.isEnabled&&Oe("[queryNodesComparer] changed vars:",r,n,i),!1;if(!oo(n.logsOfThisNode,i.logsOfThisNode))return Oe.isEnabled&&Oe("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Oe.isEnabled&&Oe("[queryNodesComparer] equal:",{a:e,b:t}),!0}var YA=0;function qt(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++YA}{${t}}`;Oe.isEnabled&&Oe(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=Fp(e,s=>{i?De(()=>(r??We.structural)(i,s))?Qe.isEnabled&&Qe(`[${n}] update skipped`,{updatedItems:s,observableArr:i}):(i.replace(s),Qe.isEnabled&&Qe(`[${n}] updated`,{updatedItems:s,observableArr:i})):i=Le.array(s,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var a=Yt(i);Qe(`[${n}] deps`,{disposeAutorun:o,rootsAtom:a,observableArr:i,observers:Xo(i)}),Ui(()=>ca.add(a))}return Oe.isEnabled&&Ra(i,()=>{Oe(`[${n}] observed`,Xo(i),{rootsAtom:a,observableArr:i})}),Yn(i,()=>{Oe.isEnabled&&Oe(`[${n}] dispose`),a&&Ui(()=>ca.delete(a)),o()}),i}var XA=0;function ZA(e,{name:t}={}){let r=`observableSetMap@${++XA}{${t}}`;Oe.isEnabled&&Oe(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=Fp(e,a=>{if(!n)n=Le.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=De(()=>{let l=new Set(n.values()),f=new Set;for(let p of a)n.has(p)?(Oe.isEnabled&&Oe(`[${r}] unchanged`,p,{updatedItems:a,observableSet:n}),l.delete(p)):f.add(p);return Qe.isEnabled&&Qe(`[${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=Yt(n);Qe.isEnabled&&Qe(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:Xo(n)}),Ui(()=>ca.add(o))}return Oe.isEnabled&&Ra(n,()=>{Oe(`[${r}] observed`,Xo(n),{rootsAtom:o,observableSet:n})}),Yn(n,()=>{Oe.isEnabled&&Oe(`[${r}] dispose`),o&&Ui(()=>ca.delete(o)),i()}),n}function Fp(e,t=null,{name:r}={}){Qe.isEnabled&&Qe("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new ir(n,function(...s){Qe.isEnabled&&Qe(`[${n}] reaction.invalidate`,s),a()});function a(){o.track(function(){let s=As&&performance.now();Qe.isEnabled&&Qe(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),Qe.isEnabled&&Qe(`[${n}] runAndTrack =>`,i),Ui(()=>{t?.(i)}),As&&performance.now()-s>As&&JA(`[${n}] took ${performance.now()-s}ms`)})}return a(),Qe.isEnabled&&Qe(`[${n}] deps of reaction`,{reaction:o,result:i,deps:Da(o)}),()=>{Oe.isEnabled&&Oe(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function Ze(e,t,r=!1){if(on(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=De(()=>{let O=s;for(let T=0;T<s.length;T++)s[T]instanceof Ln&&s===O&&(O=s.slice());return O}),f=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...s)}}`:""}`;for(let[O,T]of a.entries())if(tx(O,l)){u=T;break}else if(Oe.isEnabled)for(let L=0;L<O.length;L++)O[L]instanceof Ln&&O[L].name===s[L].name&&We.structural(of(O,O[L]),of(l,l[L]))&&Oe.force(`[${f}] threadState mismatch => cachebust`,{diffFields:Object.keys(O[L]).filter(H=>!We.structural(O[L][H],s[L][H])),cacheArg:O[L],freshArg:s[L]});if(u){let O=u.get();return Oe.isEnabled&&Oe(`[${f}] cache hit`,{untrackedArgs:l,cachedResult:O}),O}if(!o.keepAlive&&!xv())return!n&&jv().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);Oe.isEnabled&&Oe(`[${f}] new computation`,{untrackedArgs:l});let p,S=Ge(()=>(Oe.isEnabled&&Oe(`[${f}] update->rerun`,De(()=>({args:s})),t),Oe.isEnabled&&Vd(),p=t.apply(this,s)),{...o,name:f});if(Oe.isEnabled&&Oe(`[${f}] deps`,Da(S),{untrackedArgs:l}),a.set(l,S),!o.keepAlive){let O=Yn(S,()=>{Oe.isEnabled&&Oe(`[${f}] dispose`,S),O(),a.delete(l),o.onCleanup&&o.onCleanup(p,...s),p=void 0})}return S.get()}}function ex(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 tx(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]instanceof Ln){if(t[r]!==e[r])return!1}else if(!We.structural(e[r],t[r]))return!1;return!0}var{WARN:af,LOG:EC,DEBUG:rx,VERBOSE:AC,ERROR:Yr}=ke.setup(ke.INFO,{prefix:"[thread]"});function Lr(e){return e.init!==void 0}var Ln=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:ra(t),this.filters=r,De(()=>this.parents?.length===0)&&af("[Thread] empty parents array",e),i.skipObservable||Xn(this,{applogsCids:Ge,applogsByCid:Ge,insert:jt,size:Ge,isEmpty:Ge,firstLog:Ge,latestLog:Ge},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw Yr("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Yr("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Yr("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw Yr("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw Yr("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw Yr("[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):af("unsubscribe called for non-existent",e)}notifySubscribers(e){rx(`[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 Yr("[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 De(()=>this.size)}get nameAndSizeUntracked(){return De(()=>`${this.name} (${this.size})`)}get prettyName(){return ex(this.name)}get hasParents(){return!!this.parents?.length}},nx=class zp extends Ln{static fromArray(t,r){return new zp(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},ix={};Qd(ix,{code:()=>lh,decode:()=>gl,encode:()=>yl,format:()=>mf,name:()=>yS,parse:()=>mS,stringify:()=>mf});var ox=["string","number","bigint","symbol"],ax=["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 sx(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return ox.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":ux(e)?"Buffer":lx(e)||"Object"}function ux(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function lx(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(ax.includes(t))return t}var D=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}};D.uint=new D(0,"uint",!0);D.negint=new D(1,"negint",!0);D.bytes=new D(2,"bytes",!0);D.string=new D(3,"string",!0);D.array=new D(4,"array",!1);D.map=new D(5,"map",!1);D.tag=new D(6,"tag",!1);D.float=new D(7,"float",!0);D.false=new D(7,"false",!0);D.true=new D(7,"true",!0);D.null=new D(7,"null",!0);D.undefined=new D(7,"undefined",!0);D.break=new D(7,"break",!0);var oe=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}`}},ui=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",cx=new TextDecoder,fx=new TextEncoder;function fa(e){return ui&&globalThis.Buffer.isBuffer(e)}function rl(e){return e instanceof Uint8Array?fa(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var dx=ui?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):uf(e,t,r):(e,t,r)=>r-t>64?cx.decode(e.subarray(t,r)):uf(e,t,r),Kp=ui?e=>e.length>64?globalThis.Buffer.from(e):sf(e):e=>e.length>64?fx.encode(e):sf(e),nl=ui?(e,t,r)=>fa(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),px=ui?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),rl(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},hx=ui?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function yx(e,t){if(fa(e)&&fa(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 sf(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 uf(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 Gp(n)}var lf=4096;function Gp(e){let t=e.length;if(t<=lf)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=lf));return r}var gx=256,qp=class{constructor(e=gx){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=hx(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=nl(r,0,this.cursor)}else t=px(this.chunks,this.cursor);return e&&this.reset(),t}},be="CBOR decode error:",tn="CBOR encode error:",ao=[];ao[23]=1;ao[24]=2;ao[25]=3;ao[26]=5;ao[27]=9;function li(e,t,r){if(e.length-t<r)throw new Error(`${be} not enough data for type`)}var tt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function mn(e,t,r){li(e,t,1);let n=e[t];if(r.strict===!0&&n<tt[0])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function bn(e,t,r){li(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<tt[1])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function vn(e,t,r){li(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<tt[2])throw new Error(`${be} integer encoded in more bytes than necessary (strict decode)`);return n}function wn(e,t,r){li(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<tt[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 mx(e,t,r,n){return new oe(D.uint,mn(e,t+1,n),2)}function bx(e,t,r,n){return new oe(D.uint,bn(e,t+1,n),3)}function vx(e,t,r,n){return new oe(D.uint,vn(e,t+1,n),5)}function wx(e,t,r,n){return new oe(D.uint,wn(e,t+1,n),9)}function _n(e,t){return Dt(e,0,t.value)}function Dt(e,t,r){if(r<tt[0]){let n=Number(r);e.push([t|n])}else if(r<tt[1]){let n=Number(r);e.push([t|24,n])}else if(r<tt[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<tt[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<tt[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`)}}_n.encodedSize=function(e){return Dt.encodedSize(e.value)};Dt.encodedSize=function(e){return e<tt[0]?1:e<tt[1]?2:e<tt[2]?3:e<tt[3]?5:9};_n.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function _x(e,t,r,n){return new oe(D.negint,-1-mn(e,t+1,n),2)}function Tx(e,t,r,n){return new oe(D.negint,-1-bn(e,t+1,n),3)}function Ox(e,t,r,n){return new oe(D.negint,-1-vn(e,t+1,n),5)}var il=BigInt(-1),Wp=BigInt(1);function Ex(e,t,r,n){let i=wn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new oe(D.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${be} integers outside of the safe integer range are not supported`);return new oe(D.negint,il-BigInt(i),9)}function ol(e,t){let r=t.value,n=typeof r=="bigint"?r*il-Wp:r*-1-1;Dt(e,t.type.majorEncoded,n)}ol.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*il-Wp:t*-1-1;return r<tt[0]?1:r<tt[1]?2:r<tt[2]?3:r<tt[3]?5:9};ol.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function so(e,t,r,n){li(e,t,r+n);let i=nl(e,t+r,t+r+n);return new oe(D.bytes,i,r+n)}function Ax(e,t,r,n){return so(e,t,1,r)}function xx(e,t,r,n){return so(e,t,2,mn(e,t+1,n))}function Ix(e,t,r,n){return so(e,t,3,bn(e,t+1,n))}function Sx(e,t,r,n){return so(e,t,5,vn(e,t+1,n))}function kx(e,t,r,n){let i=wn(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 da(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===D.string?Kp(e.value):e.value),e.encodedBytes}function Ja(e,t){let r=da(t);Dt(e,t.type.majorEncoded,r.length),e.push(r)}Ja.encodedSize=function(e){let t=da(e);return Dt.encodedSize(t.length)+t.length};Ja.compareTokens=function(e,t){return $x(da(e),da(t))};function $x(e,t){return e.length<t.length?-1:e.length>t.length?1:yx(e,t)}function uo(e,t,r,n,i){let o=r+n;li(e,t,o);let a=new oe(D.string,dx(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=nl(e,t+r,t+o)),a}function jx(e,t,r,n){return uo(e,t,1,r,n)}function Cx(e,t,r,n){return uo(e,t,2,mn(e,t+1,n),n)}function Nx(e,t,r,n){return uo(e,t,3,bn(e,t+1,n),n)}function Mx(e,t,r,n){return uo(e,t,5,vn(e,t+1,n),n)}function Px(e,t,r,n){let i=wn(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 Ux=Ja;function ci(e,t,r,n){return new oe(D.array,n,r)}function Bx(e,t,r,n){return ci(e,t,1,r)}function Rx(e,t,r,n){return ci(e,t,2,mn(e,t+1,n))}function Dx(e,t,r,n){return ci(e,t,3,bn(e,t+1,n))}function Lx(e,t,r,n){return ci(e,t,5,vn(e,t+1,n))}function Vx(e,t,r,n){let i=wn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer array lengths not supported`);return ci(e,t,9,i)}function Fx(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return ci(e,t,1,1/0)}function al(e,t){Dt(e,D.array.majorEncoded,t.value)}al.compareTokens=_n.compareTokens;al.encodedSize=function(e){return Dt.encodedSize(e.value)};function fi(e,t,r,n){return new oe(D.map,n,r)}function zx(e,t,r,n){return fi(e,t,1,r)}function Kx(e,t,r,n){return fi(e,t,2,mn(e,t+1,n))}function Gx(e,t,r,n){return fi(e,t,3,bn(e,t+1,n))}function qx(e,t,r,n){return fi(e,t,5,vn(e,t+1,n))}function Wx(e,t,r,n){let i=wn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${be} 64-bit integer map lengths not supported`);return fi(e,t,9,i)}function Hx(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return fi(e,t,1,1/0)}function sl(e,t){Dt(e,D.map.majorEncoded,t.value)}sl.compareTokens=_n.compareTokens;sl.encodedSize=function(e){return Dt.encodedSize(e.value)};function Jx(e,t,r,n){return new oe(D.tag,r,1)}function Qx(e,t,r,n){return new oe(D.tag,mn(e,t+1,n),2)}function Yx(e,t,r,n){return new oe(D.tag,bn(e,t+1,n),3)}function Xx(e,t,r,n){return new oe(D.tag,vn(e,t+1,n),5)}function Zx(e,t,r,n){return new oe(D.tag,wn(e,t+1,n),9)}function ul(e,t){Dt(e,D.tag.majorEncoded,t.value)}ul.compareTokens=_n.compareTokens;ul.encodedSize=function(e){return Dt.encodedSize(e.value)};var eI=20,tI=21,rI=22,nI=23;function iI(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${be} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new oe(D.null,null,1):new oe(D.undefined,void 0,1)}function oI(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${be} indefinite length items not allowed`);return new oe(D.break,void 0,1)}function ll(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 oe(D.float,e,t)}function aI(e,t,r,n){return ll(fl(e,t+1),3,n)}function sI(e,t,r,n){return ll(dl(e,t+1),5,n)}function uI(e,t,r,n){return ll(Yp(e,t+1),9,n)}function cl(e,t,r){let n=t.value;if(n===!1)e.push([D.float.majorEncoded|eI]);else if(n===!0)e.push([D.float.majorEncoded|tI]);else if(n===null)e.push([D.float.majorEncoded|rI]);else if(n===void 0)e.push([D.float.majorEncoded|nI]);else{let i,o=!1;(!r||r.float64!==!0)&&(Jp(n),i=fl(zt,1),n===i||Number.isNaN(n)?(zt[0]=249,e.push(zt.slice(0,3)),o=!0):(Qp(n),i=dl(zt,1),n===i&&(zt[0]=250,e.push(zt.slice(0,5)),o=!0))),o||(lI(n),i=Yp(zt,1),zt[0]=251,e.push(zt.slice(0,9)))}}cl.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){Jp(r);let n=fl(zt,1);if(r===n||Number.isNaN(r))return 3;if(Qp(r),n=dl(zt,1),r===n)return 5}return 9};var Hp=new ArrayBuffer(9),Et=new DataView(Hp,1),zt=new Uint8Array(Hp,0);function Jp(e){if(e===1/0)Et.setUint16(0,31744,!1);else if(e===-1/0)Et.setUint16(0,64512,!1);else if(Number.isNaN(e))Et.setUint16(0,32256,!1);else{Et.setFloat32(0,e);let t=Et.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Et.setUint16(0,31744,!1);else if(r===0)Et.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Et.setUint16(0,0):i<-14?Et.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Et.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function fl(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 Qp(e){Et.setFloat32(0,e,!1)}function dl(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 lI(e){Et.setFloat64(0,e,!1)}function Yp(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)}cl.compareTokens=_n.compareTokens;function je(e,t,r){throw new Error(`${be} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Qa(e){return()=>{throw new Error(`${be} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=je;le[24]=mx;le[25]=bx;le[26]=vx;le[27]=wx;le[28]=je;le[29]=je;le[30]=je;le[31]=je;for(let e=32;e<=55;e++)le[e]=je;le[56]=_x;le[57]=Tx;le[58]=Ox;le[59]=Ex;le[60]=je;le[61]=je;le[62]=je;le[63]=je;for(let e=64;e<=87;e++)le[e]=Ax;le[88]=xx;le[89]=Ix;le[90]=Sx;le[91]=kx;le[92]=je;le[93]=je;le[94]=je;le[95]=Qa("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=jx;le[120]=Cx;le[121]=Nx;le[122]=Mx;le[123]=Px;le[124]=je;le[125]=je;le[126]=je;le[127]=Qa("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=Bx;le[152]=Rx;le[153]=Dx;le[154]=Lx;le[155]=Vx;le[156]=je;le[157]=je;le[158]=je;le[159]=Fx;for(let e=160;e<=183;e++)le[e]=zx;le[184]=Kx;le[185]=Gx;le[186]=qx;le[187]=Wx;le[188]=je;le[189]=je;le[190]=je;le[191]=Hx;for(let e=192;e<=215;e++)le[e]=Jx;le[216]=Qx;le[217]=Yx;le[218]=Xx;le[219]=Zx;le[220]=je;le[221]=je;le[222]=je;le[223]=je;for(let e=224;e<=243;e++)le[e]=Qa("simple values are not supported");le[244]=je;le[245]=je;le[246]=je;le[247]=iI;le[248]=Qa("simple values are not supported");le[249]=aI;le[250]=sI;le[251]=uI;le[252]=je;le[253]=je;le[254]=je;le[255]=oI;var ur=[];for(let e=0;e<24;e++)ur[e]=new oe(D.uint,e,1);for(let e=-1;e>=-24;e--)ur[31-e]=new oe(D.negint,e,1);ur[64]=new oe(D.bytes,new Uint8Array(0),1);ur[96]=new oe(D.string,"",1);ur[128]=new oe(D.array,0,1);ur[160]=new oe(D.map,0,1);ur[244]=new oe(D.false,!1,1);ur[245]=new oe(D.true,!0,1);ur[246]=new oe(D.null,null,1);function cI(){let e=[];return e[D.uint.major]=_n,e[D.negint.major]=ol,e[D.bytes.major]=Ja,e[D.string.major]=Ux,e[D.array.major]=al,e[D.map.major]=sl,e[D.tag.major]=ul,e[D.float.major]=cl,e}var xC=cI(),xs=new qp,cf=class Xp{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(`${tn} object contains circular references`);return new Xp(r,t)}},xr={null:new oe(D.null,null),undefined:new oe(D.undefined,void 0),true:new oe(D.true,!0),false:new oe(D.false,!1),emptyArray:new oe(D.array,0),emptyMap:new oe(D.map,0)},Vr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new oe(D.float,e):e>=0?new oe(D.uint,e):new oe(D.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new oe(D.uint,e):new oe(D.negint,e)},Uint8Array(e,t,r,n){return new oe(D.bytes,e)},string(e,t,r,n){return new oe(D.string,e)},boolean(e,t,r,n){return e?xr.true:xr.false},null(e,t,r,n){return xr.null},undefined(e,t,r,n){return xr.undefined},ArrayBuffer(e,t,r,n){return new oe(D.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new oe(D.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[xr.emptyArray,new oe(D.break)]:xr.emptyArray;n=cf.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=ko(a,r,n);return r.addBreakTokens?[new oe(D.array,e.length),i,new oe(D.break)]:[new oe(D.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?[xr.emptyMap,new oe(D.break)]:xr.emptyMap;n=cf.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[ko(l,r,n),ko(i?e.get(l):e[l],r,n)];return fI(s,r),r.addBreakTokens?[new oe(D.map,a),s,new oe(D.break)]:[new oe(D.map,a),s]}};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 ko(e,t={},r){let n=sx(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(`${tn} unsupported type: ${n}`);return o(e,n,t,r)}function fI(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Zp(e,t,r,n){if(Array.isArray(t))for(let i of t)Zp(e,i,r,n);else r[t.type.major](e,t,n)}function dI(e,t,r){let n=ko(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let i=r.quickEncodeToken(n);if(i)return i;let o=t[n.type.major];if(o.encodedSize){let a=o.encodedSize(n,r),s=new qp(a);if(o(s,n,r),s.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return rl(s.chunks[0])}}return xs.reset(),Zp(xs,n,t,r),xs.toBytes(!0)}var pI={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},hI=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=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}},Ki=Symbol.for("DONE"),Ya=Symbol.for("BREAK");function yI(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=Gi(t,r);if(o===Ya){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed array`)}if(o===Ki)throw new Error(`${be} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function gI(e,t,r){let n=r.useMaps===!0,i=n?void 0:{},o=n?new Map:void 0;for(let a=0;a<e.value;a++){let s=Gi(t,r);if(s===Ya){if(e.value===1/0)break;throw new Error(`${be} got unexpected break to lengthed map`)}if(s===Ki)throw new Error(`${be} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof s!="string")throw new Error(`${be} non-string keys not supported (got ${typeof s})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(s)||!n&&s in i))throw new Error(`${be} found repeat map key "${s}"`);let u=Gi(t,r);if(u===Ki)throw new Error(`${be} found map but not enough entries (got ${a} [no value], expected ${e.value})`);n?o.set(s,u):i[s]=u}return n?o:i}function Gi(e,t){if(e.done())return Ki;let r=e.next();if(r.type===D.break)return Ya;if(r.type.terminal)return r.value;if(r.type===D.array)return yI(r,e,t);if(r.type===D.map)return gI(r,e,t);if(r.type===D.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=Gi(e,t);return t.tags[r.value](n)}throw new Error(`${be} tag not supported (${r.value})`)}throw new Error("unsupported")}function mI(e,t){if(!(e instanceof Uint8Array))throw new Error(`${be} data to decode must be a Uint8Array`);t=Object.assign({},pI,t);let r=t.tokenizer||new hI(e,t),n=Gi(r,t);if(n===Ki)throw new Error(`${be} did not find any content to decode`);if(n===Ya)throw new Error(`${be} got unexpected break`);return[n,e.subarray(r.pos())]}function bI(e,t){let[r,n]=mI(e,t);if(n.length>0)throw new Error(`${be} too many terminals, data makes no sense`);return r}var vI=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===D.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===D.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[D.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)}[D.negint.major](e,t){this[D.uint.major](e,t)}[D.bytes.major](e,t){throw new Error(`${tn} unsupported type: Uint8Array`)}[D.string.major](e,t){this.prefix(e);let r=Kp(JSON.stringify(t.value));e.push(r.length>32?rl(r):r)}[D.array.major](e,t){this.prefix(e),this.inRecursive.push({type:D.array,elements:0}),e.push([91])}[D.map.major](e,t){this.prefix(e),this.inRecursive.push({type:D.map,elements:0}),e.push([123])}[D.tag.major](e,t){}[D.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===D.array)e.push([93]);else if(o.type===D.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(`${tn} 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 wI(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${tn} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==D.string||n.type!==D.string)throw new Error(`${tn} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${tn} unexpected duplicate map keys, this is not supported`)}var _I={addBreakTokens:!0,mapSorter:wI};function TI(e,t){return t=Object.assign({},_I,t),dI(e,new vI,t)}var eh=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 oe(D.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 oe(D.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new oe(o>=0?D.uint:D.negint,o,this._pos-e):new oe(o>=0?D.uint:D.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 oe(D.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 oe(D.string,Gp(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 oe(D.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new oe(D.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new oe(D.null,null,4);case 102:return this.expect([102,97,108,115,101]),new oe(D.false,!1,5);case 116:return this.expect([116,114,117,101]),new oe(D.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 oe(D.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 oe(D.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 oe(D.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 oe(D.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 OI(e,t){return t=Object.assign({tokenizer:new eh(e,t)},t),bI(e,t)}var IC=new Uint8Array(0);function EI(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 pl(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 AI(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 p(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 L=0,H=0,U=0,k=T.length;U!==k&&T[U]===0;)U++,L++;for(var F=(k-U)*f+1>>>0,G=new Uint8Array(F);U!==k;){for(var B=T[U],Y=0,K=F-1;(B!==0||Y<H)&&K!==-1;K--,Y++)B+=256*G[K]>>>0,G[K]=B%s>>>0,B=B/s>>>0;if(B!==0)throw new Error("Non-zero carry");H=Y,U++}for(var te=F-H;te!==F&&G[te]===0;)te++;for(var $=u.repeat(L);te<F;++te)$+=e.charAt(G[te]);return $}function S(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var L=0;if(T[L]!==" "){for(var H=0,U=0;T[L]===u;)H++,L++;for(var k=(T.length-L)*l+1>>>0,F=new Uint8Array(k);T[L];){var G=r[T.charCodeAt(L)];if(G===255)return;for(var B=0,Y=k-1;(G!==0||B<U)&&Y!==-1;Y--,B++)G+=s*F[Y]>>>0,F[Y]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");U=B,L++}if(T[L]!==" "){for(var K=k-U;K!==k&&F[K]===0;)K++;for(var te=new Uint8Array(H+(k-K)),$=H;K!==k;)te[$++]=F[K++];return te}}}function O(T){var L=S(T);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:S,decode:O}}var xI=AI,II=xI,SI=II,kI=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")}},$I=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 th(this,e)}},jI=class{decoders;constructor(e){this.decoders=e}or(e){return th(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 th(e,t){return new jI({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var CI=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 kI(e,t,r),this.decoder=new $I(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function rh({name:e,prefix:t,encode:r,decode:n}){return new CI(e,t,r,n)}function Xa({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=SI(r,e);return rh({prefix:t,name:e,encode:n,decode:o=>pl(i(o))})}function NI(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 MI(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 PI(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=PI(n);return rh({prefix:t,name:e,encode(o){return MI(o,n,r)},decode(o){return NI(o,i,r,e)}})}var $o=_t({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),SC=_t({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),kC=_t({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),$C=_t({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),jC=_t({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),CC=_t({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),NC=_t({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),MC=_t({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),PC=_t({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),jo=Xa({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),UC=Xa({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Cr=Xa({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),BC=Xa({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),nh={};Qd(nh,{Digest:()=>Za,create:()=>hl,decode:()=>oh,equals:()=>ah,hasCode:()=>eS});var UI=ih,ff=128,BI=127,RI=~BI,DI=Math.pow(2,31);function ih(e,t,r){t=t||[],r=r||0;for(var n=r;e>=DI;)t[r++]=e&255|ff,e/=128;for(;e&RI;)t[r++]=e&255|ff,e>>>=7;return t[r]=e|0,ih.bytes=r-n+1,t}var LI=tu,VI=128,df=127;function tu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw tu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&df)<<i:(a&df)*Math.pow(2,i),i+=7}while(a>=VI);return tu.bytes=o-n,r}var FI=Math.pow(2,7),zI=Math.pow(2,14),KI=Math.pow(2,21),GI=Math.pow(2,28),qI=Math.pow(2,35),WI=Math.pow(2,42),HI=Math.pow(2,49),JI=Math.pow(2,56),QI=Math.pow(2,63),YI=function(e){return e<FI?1:e<zI?2:e<KI?3:e<GI?4:e<qI?5:e<WI?6:e<HI?7:e<JI?8:e<QI?9:10},XI={encode:UI,decode:LI,encodingLength:YI},ZI=XI,pa=ZI;function ru(e,t=0){return[pa.decode(e,t),pa.decode.bytes]}function ha(e,t,r=0){return pa.encode(e,t,r),t}function ya(e){return pa.encodingLength(e)}function hl(e,t){let r=t.byteLength,n=ya(e),i=n+ya(r),o=new Uint8Array(i+r);return ha(e,o,0),ha(r,o,n),o.set(t,i),new Za(e,r,t,o)}function oh(e){let t=pl(e),[r,n]=ru(t),[i,o]=ru(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new Za(r,i,a,t)}function ah(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&EI(e.bytes,r.bytes)}}var Za=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function eS(e,t){return e.code===t}function pf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return rS(r,nu(e),t??Cr.encoder);default:return nS(r,nu(e),t??$o.encoder)}}var hf=new WeakMap;function nu(e){let t=hf.get(e);if(t==null){let r=new Map;return hf.set(e,r),r}return t}var Mt=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!==Ti)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==iS)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=hl(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&&ah(t.multihash,n.multihash)}toString(t){return pf(this,t)}toJSON(){return{"/":pf(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??yf(n,i,o.bytes))}else if(r[oS]===!0){let{version:n,multihash:i,code:o}=r,a=oh(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!==Ti)throw new Error(`Version 0 CID must use dag-pb (code: ${Ti}) block encoding`);return new st(t,r,n,n.bytes)}case 1:{let i=yf(t,r,n.bytes);return new st(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return st.create(0,Ti,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=pl(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 Za(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[p,S]=ru(t.subarray(r));return r+=S,p},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]=tS(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 nu(o).set(n,t),o}};function tS(e,t){switch(e[0]){case"Q":{let r=t??Cr;return[Cr.prefix,r.decode(`${Cr.prefix}${e}`)]}case Cr.prefix:{let r=t??Cr;return[Cr.prefix,r.decode(e)]}case $o.prefix:{let r=t??$o;return[$o.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, base36 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}}}function rS(e,t,r){let{prefix:n}=r;if(n!==Cr.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 nS(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,iS=18;function yf(e,t,r){let n=ya(e),i=n+ya(t),o=new Uint8Array(i+r.byteLength);return ha(e,o,0),ha(t,o,n),o.set(r,i),o}var oS=Symbol.for("@ipld/js-cid/CID"),aS=20;function sh({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new sS(e,t,r,n,i)}var sS=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??aS,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?gf(r,this.code,t?.truncate):r.then(n=>gf(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function gf(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 hl(t,e)}var uh=_t({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),RC=_t({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),DC=_t({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),LC=_t({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function uS(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function lS(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Mt.asCID(e);if(!t)return null;let r=t.toString();return[new oe(D.map,1/0,1),new oe(D.string,"/",1),new oe(D.string,r,r.length),new oe(D.break,void 0,1)]}function ga(e){let t=uh.encode(e).slice(1);return[new oe(D.map,1/0,1),new oe(D.string,"/",1),new oe(D.map,1/0,1),new oe(D.string,"bytes",5),new oe(D.string,t,t.length),new oe(D.break,void 0,1),new oe(D.break,void 0,1)]}function Vt(e){return ga(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function cS(e){return ga(new Uint8Array(e))}function fS(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function dS(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 pS={typeEncoders:{Object:lS,Buffer:ga,Uint8Array:ga,Int8Array:Vt,Uint16Array:Vt,Int16Array:Vt,Uint32Array:Vt,Int32Array:Vt,Float32Array:Vt,Float64Array:Vt,Uint8ClampedArray:Vt,BigInt64Array:Vt,BigUint64Array:Vt,DataView:Vt,ArrayBuffer:cS,undefined:fS,number:dS}},hS=class extends eh{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===D.map){let t=this._next();if(t.type===D.string&&t.value==="/"){let r=this._next();if(r.type===D.string){if(this._next().type!==D.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new oe(D.tag,42,0)}if(r.type===D.map){let n=this._next();if(n.type===D.string&&n.value==="bytes"){let i=this._next();if(i.type===D.string){for(let a=0;a<2;a++)if(this._next().type!==D.break)throw new Error("Invalid encoded Bytes form");let o=uh.decode(`m${i.value}`);return new oe(D.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},iu={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};iu.tags[42]=Mt.parse;var yS="dag-json",lh=297,yl=e=>TI(e,pS),gl=e=>{let t=uS(e),r=Object.assign(iu,{tokenizer:new hS(t,iu)});return OI(t,r)},mf=e=>gS.decode(yl(e)),gS=new TextDecoder,mS=e=>gl(bS.encode(e)),bS=new TextEncoder;function vS(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ch(e,t,r=""){let n=vS(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 bf(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 wS(e,t){ch(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 ou(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Is(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function er(e,t){return e<<32-t|e>>>t}function _S(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 TS=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function OS(e,t,r){return e&t^~e&r}function ES(e,t,r){return e&t^e&r^t&r}var AS=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=Is(this.buffer)}update(e){bf(this),ch(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=Is(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){bf(this),wS(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,ou(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=Is(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()}},Ir=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),xS=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]),Sr=new Uint32Array(64),IS=class extends AS{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)Sr[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let p=Sr[f-15],S=Sr[f-2],O=er(p,7)^er(p,18)^p>>>3,T=er(S,17)^er(S,19)^S>>>10;Sr[f]=T+Sr[f-7]+O+Sr[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 p=er(a,6)^er(a,11)^er(a,25),S=l+p+OS(a,s,u)+xS[f]+Sr[f]|0,O=(er(r,2)^er(r,13)^er(r,22))+ES(r,n,i)|0;l=u,u=s,s=a,a=o+S|0,o=i,i=n,n=r,r=S+O|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(){ou(Sr)}destroy(){this.set(0,0,0,0,0,0,0,0),ou(this.buffer)}},SS=class extends IS{A=Ir[0]|0;B=Ir[1]|0;C=Ir[2]|0;D=Ir[3]|0;E=Ir[4]|0;F=Ir[5]|0;G=Ir[6]|0;H=Ir[7]|0;constructor(){super(32)}},kS=_S(()=>new SS,TS(1)),Xe=wr(Gr(),1),fh=wr(z0(),1),vf=e=>Xe.Type.Union([e,Xe.Type.Null()]),dh=/^(k51qz|baguq)[0-9a-z]{56,57}$/,$S=/^[0-9A-Fa-f]{7,8}$/g;Xe.FormatRegistry.Set("EntityID",e=>!!e.match($S)||!!e.match(dh));var jS=Xe.Type.String(),au=e=>e?.enc instanceof Uint8Array;Xe.FormatRegistry.Set("CID",e=>!!e.match(dh));var ph=Xe.Type.String({format:"CID"}),CS=/^http([s]?):\/\/.*\..*/;Xe.FormatRegistry.Set("URL",e=>!!e.match(CS));var VC=Xe.Type.String({format:"URL"}),hh=Xe.Type.Object({en:jS,at:Xe.Type.String(),vl:vf(Xe.Type.Union([Xe.Type.String(),Xe.Type.Boolean(),Xe.Type.Number()])),ts:Xe.Type.String(),ag:Xe.Type.String(),pv:vf(ph)}),wf=fh.TypeCompiler.Compile(hh),FC=wf.Check.bind(wf),NS=Xe.Type.Composite([Xe.Type.Object({cid:ph}),hh]),su=fh.TypeCompiler.Compile(NS),MS=e=>Array.from(su.Errors(e)),yh=su.Check.bind(su);function gh(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var PS=sh({name:"sha2-256",code:18,encode:gh("SHA-256")}),zC=sh({name:"sha2-512",code:19,encode:gh("SHA-512")}),{WARN:_f,LOG:KC,DEBUG:US,VERBOSE:ma,ERROR:BS}=ke.setup(ke.INFO),RS=114;function DS(e,t=["cid"]){if(!e)throw BS("falsy log",e);let r=e.cid;if(au(e))return r||(r=ml(mh(e).bytes).toString()),_f("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(_f(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?ma("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function LS(e){return ml(VS(e).bytes)}function VS(e){return mh(DS(e)?.log)}function ml(e){let t=kS(e),r=nh.create(PS.code,t),n=Mt.create(1,lh,r);return ma("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function mh(e){US("[encodeBlock]",e);let t=yl(e);return{bytes:t,cid:ml(t)}}function FS(e){let t=null,r=[];try{t=Mt.parse(e)}catch(n){ma("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=Mt.parse(e,jo)}catch(n){ma("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&bl(t)}}function bl(e){return e.code===RS}function uu(e){return typeof e=="string"?Mt.parse(e):typeof e.toV1!="function"?Mt.decode(e.bytes):e}function bh(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=uu(e),n=uu(t);return r.toV1().toString()===n.toV1().toString()}function Tf(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 zS(e,t){let r=Tf(e),n=Tf(t);return+r<+n}var{WARN:GC,LOG:qC,DEBUG:WC,VERBOSE:KS,ERROR:Of}=ke.setup(ke.INFO),GS=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),vh=(e,t,r)=>We.structural(nf(t,e),nf(r,e)),qS=(e,t,r="asc")=>GS(e.ts,t.ts,r),HC=PA(vh,["en","at"]);function qi(e,t="asc"){return e.sort((r,n)=>qS(r,n,t))}var WS=(e,t)=>zS(new Date(e.ts),new Date(t.ts)),wh=e=>{let t=new Map;for(let r of e){if(!r)throw Of("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!r.cid)throw Of("applog with missing CID",r),new Error("applog with missing CID");let n=r.cid;t.has(n)?KS("Skipping duplicate applog:",[t.get(n),r]):t.set(n,r)}return Array.from(t.values())};function HS(e){return typeof e=="string"&&e.startsWith("?")}function JS(e){return e.slice(1)}function _h(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(HS(o)){let a=JS(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function QS(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 Th=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},Ef=function(e){return Th(e)/e.length},At={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return At.max(e)-At.min(e)},midrange:function(e){return At.range(e)/2},sum:Th,mean:Ef,average:Ef,median:function(e){e.sort(function(r,n){return r-n});var t=e.length/2;return t%1?e[t-.5]:(e[t-1]+e[t])/2},modes:function(e){if(!e.length)return[];var t={},r=0,n=[];return e.forEach(function(i){t[i]?t[i]++:t[i]=1,t[i]>r?(n=[i],r=t[i]):t[i]===r&&(n.push(i),r=t[i])}),n},variance:function(e){var t=At.mean(e);return At.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(At.variance(e))},meanAbsoluteDeviation:function(e){var t=At.mean(e);return At.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=At.mean(e),r=At.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};At.average=At.mean;function Oh(){return new Date().toISOString()}var{WARN:YS,LOG:JC,DEBUG:XS,VERBOSE:QC,ERROR:ba}=ke.setup(ke.INFO);function ZS(e,t){let r=Oh(),n=t;return e.map(i=>ek(i,{ts:r,threadForPv:n}))}function ek(e,{ts:t,threadForPv:r}={}){let n=nk(e,t??Oh()),i=ik(n,r),o=LS(i).toString();e.cid&&e.cid!==o&&YS("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(!yh(a))throw ba(`Bogus Applog ${JSON.stringify(a)}`,MS(a));return Object.freeze(a)}function tk(e){return!!e.ts}function rk(e){return!!e.pv}function nk(e,t){return tk(e)?e:{...e,ts:t}}function ik(e,t){if(e.pv!==void 0)return e;if(t){let{en:r,at:n}=e,i=t.findLast(a=>a.en==r&&a.at==n);if(vh(["en","at","vl","ts","ag"],e,i))throw ba("[withPvFrom] Same as previous:",{log:e,pv:i,thread:t});let o=(e.pv!==void 0?e.pv:i?.cid)??null;return{...e,pv:o}}else{if(!rk(e))throw ba("[withPvFrom] no thread and no pv:",e);return e}}function lu(e){let t=()=>(De(()=>e.length<2&&XS(`joinThreads with count=${e.length}`)),qi(wh(e.flatMap(i=>{let o=i.applogs;if(!o)throw ba("falsy applogs of thread",i),new Error("falsy applogs of thread");return o})))),r=De(()=>t()),n=jt(function(i,o){return Lr(i)?{init:De(()=>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 vl(De(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:Af,LOG:YC,DEBUG:xf,VERBOSE:Xr,ERROR:If}=ke.setup(ke.INFO),vl=class Eh extends Ln{constructor(t,r,n,i,o,a=null){super(t,r,n,o?Le.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=a,Xn(this,{onParentUpdate:jt}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new Eh(`${r}<${t.nameAndSizeUntracked}>`,t,t.filters,t._applogs,null,n)}_parentSubscriptions=null;insert(t){let r=this._writeMapper?this._writeMapper(t):t;if(!(this._writeMapper&&!r))return this.parents.forEach(n=>n.insert(r))}insertRaw(t){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=Ut(()=>{this.parents.length||Af("MappedThread has no parents",this),Xr(`[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)&&Xr(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),Xr(`[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)Xr(`[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 If("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);xf(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&Af(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:De(()=>hr(t.applogs))})})}onParentUpdate(t,r){Xr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(Xr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),Lr(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(qA(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!Lr(r)&&r.removed?.includes(i))xf("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw If(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}Xr(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,Da(this._applogs)),this.notifySubscribers(n)}get readOnly(){return!1}},{WARN:XC,LOG:ZC,DEBUG:eN,VERBOSE:Ss,ERROR:ok}=ke.setup(ke.INFO),Vn=Ze("rollingFilter",function(e,t,r={}){let n=sk(t),i=Sf(n),o=Le.array(De(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${zi(n)}}`}`}),a=f=>{let p;return Lr(f)?p={init:i(f.init)}:p={added:i(f.added),removed:f.removed},Ss(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",p),p},s=new vl(`${e.name} | ${r.name||`rollingFilter{${zi(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=qv(()=>hr(t),f=>{Ss(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=Sf(n),s.triggerRemap()}),l=Yn(o,()=>{Ss(`rollingFilter<${De(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:oo,argsDebugName:(e,t,r)=>qe({caller:"rollingFilter",thread:e,pattern:t,args:r})}),ak=Ze("rollingMapper",function(e,t,r={}){let n=De(()=>t.call(null,{init:e.applogs},e));if(!Lr(n))throw ok("Initial run must return init event");let i=n.init;return new vl(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:oo,argsDebugName:(e,t,r)=>qe({caller:"rollingMapper",thread:e,args:r})}),tN=Ze("rollingAcc",function(e,t,r,n={}){let i=jt(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}`:""}}`}),sk=function(e){let t=De(function(){return Object.fromEntries(Object.entries(hr(e)).map(([r,n])=>[hr(r),hr(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function Sf(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(!QS(n,i,o))return!1}return!0})}}var{WARN:uk,LOG:lk,DEBUG:ck,VERBOSE:fk,ERROR:Co}=ke.setup(ke.INFO),dk=class extends Ln{constructor(e,t=[],r){super(e,null,r,t),Xn(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){let t=ZS(e,this);return this.insertRaw(t)}insertRaw(e){let t=wh(e);if(t.length!==e.length)throw Co(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});let r=e.filter(o=>!yh(o));if(r.length)throw Co(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw Co(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(!e.length){uk("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof lo)?lk:ck)("Inserting:",e.length===1?e[0]:e,{ds:this}),qi(e);let i=this._applogs.length&&WS(e[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...e),i&&qi(this._applogs),this.notifySubscribers({added:e,removed:null}),this.persist(e),e}get readOnly(){return!1}},lo=class No extends dk{constructor(t,r,n,i){super(t,r,n),this._readOnly=i,Xn(this,{_applogs:Le.shallow})}static empty(t){return No.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new No(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new No(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(fk("[InMem.persist] no persist for",t),this.readOnly)throw Co("[persist] called for readOnly thread")}},{WARN:rN,LOG:nN,DEBUG:iN,VERBOSE:oN,ERROR:aN}=ke.setup(ke.INFO),{WARN:sN,LOG:uN,DEBUG:lN,VERBOSE:cN,ERROR:fN}=ke.setup(ke.INFO),pk=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,Xn(this,{threadOfTrail:Ge})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?lu([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},Ah=class{constructor(e){this.nodes=e,Xn(this,{threadOfAllTrails:Ge,size:Ge,isEmpty:Ge})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return De(()=>this.records.length)}get records(){return qt(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return lu(qt(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return qt(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return qt(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return lu(qt(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:dN,LOG:es,DEBUG:mr,VERBOSE:xe,ERROR:sn}=ke.setup(ke.INFO,{prefix:"[q]"}),ks=null,pN=Ze("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(xe(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return mr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw sn("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=ak(e,function(o,a){let s=Lr(o),u,l=[],f=s?null:[];s?(n=new Map,u=o.init):u=o.added;let p;for(let S=t?0:u.length-1;t?S<u.length:S>=0;t?S++:S--){let O=u[S],T=O.en+"|"+O.at;if(p&&(t?p>O.ts:p<O.ts))throw sn("lastWriteWins.mapper logs not sorted:",p,t?">":"<",O.ts,{log:O,i:S,newLogs:u,inverseToOnlyReturnFirstLogs:t});p=O.ts;let L=n.get(T);(!L||(t?L.ts>O.ts:L.ts<O.ts))&&(L&&!s&&f.push(L),l.push(O),n.set(T,O))}return qi(l),xe.isDisabled||xe(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([S,O])=>[S,O?.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 xe.isDisabled||Ut(()=>{xe(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:oo,argsDebugName:e=>qe({caller:"lastWriteWins",thread:e})}),hN=Ze("withoutDeleted",function(e){if(xe.isEnabled&&xe(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw sn("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=Vn(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});xe.isEnabled&&xe(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,De(function(){return[...t.applogs]}));let r=qe({caller:"allDeletedEntities",thread:e}),n=ZA(function(){return t.map(i=>i.en)},{name:r});return xe.isEnabled&&Ut(()=>{xe(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),Vn(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:oo}),xh=Ze("query",function e(t,r,n={},i={}){_k();let o=Ih(t);mr(`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=hk(o,s,u,i);return xe.isDisabled||Ut(()=>xe("query result:",hr(l))),l},{equals:tl,argsDebugName:(e,t,r)=>qe({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),hk=Ze("queryStep",function(e,t,r,n={}){if(mr(`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]=_h(r,a?.variables??{});xe("[queryStep.doQuery] patternWithoutVars: ",s);let l=Vn(e,s),f=ts(u),p=qt(function(){let S=l.map(O=>({log:O,vars:f(O)}));return xe.isEnabled&&xe("[queryStep.doQuery] step node:",a?.variables," =>",S,"from:",De(()=>l.applogs)),S.map(({log:O,vars:T})=>{let L=Object.assign({},a?.variables,T);return new pk(nx.fromArray([O],qe({caller:"QueryNode",thread:l,pattern:`${zi(L)}@${zi(s)}`})),L,a)})},{name:qe({caller:"doQuery.mapNodes",thread:l,pattern:r})});return xe.isEnabled&&Ut(()=>xe("[queryStep.doQuery] resultNodes:",[...p])),n.debug&&es("[queryStep] step result:",De(()=>p.map(({variables:S,logsOfThisNode:O})=>({variables:S,thread:O})))),p}let o=qt(function(){return mr(`[queryStep] Running with ${t?.nodes?.length} input nodes:`),t?[...t.nodes.flatMap(i)]:[...i(null)]},{name:qe({caller:"queryStep",thread:e,pattern:r})});return xe.isEnabled&&Ut(()=>xe("[queryStep] observableResultNodes:",[...o])),new Ah(o)},{equals:tl,argsDebugName:(e,t,r)=>qe({caller:"queryStep",thread:e,pattern:r})}),yN=Ze("queryNot",function(e,t,r,n={}){let i=t.nodes;mr(`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]=_h(a,s??{});xe("[queryNot] patternWithoutVars: ",u);let f=Vn(e,u);return xe("[queryNot] step node:",s," =>",f.size,"applogs"),xe.isDisabled||xe("[queryNot] step node:",s," => empty?",De(()=>f.applogs)),n.debug&&es("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new Ah(i)},{equals:tl,argsDebugName:(e,t,r)=>qe({caller:"queryNot",thread:e,pattern:r})}),gN=Ze("filterAndMap",function(e,t,r){mr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=Vn(e,t);xe.isEnabled&&(xe("[filterAndMap] filtered:",n.untrackedSize),Ut(()=>xe("[filterAndMap] filtered:",n.applogs)));let i=qe({thread:e,pattern:t,caller:"filterAndMap"}),o=qt(()=>mk(n,r),{name:i});return xe.isDisabled||Ut(()=>xe("[filterAndMap] mapped:",o)),o},{equals:We.structural,argsDebugName:(e,t)=>qe({caller:"filterAndMap",thread:e,pattern:t})}),mN=Ze("queryAndMap",function(e,t,r,n={}){let i=Ih(e);mr(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=qe({thread:i,caller:"queryAndMap"}),a=xh(i,t);xe("[queryAndMap] filtered count:",a.untrackedSize);let s=qt(()=>bk(a,r),{name:o});return xe.isDisabled||Ut(()=>xe("[queryAndMap] result:",hr(s))),s},{equals:We.structural,argsDebugName:(e,t)=>qe({caller:"queryAndMap",thread:e,pattern:t})}),bN=Ze("queryEntity",function(e,t,r,n){mr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=Vn(e,{en:r,at:vk(t,n)});return xe("queryEntity applogs:",i.applogs),Ge(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:o,vl:a})=>[o.slice(t.length+1),a])))},{equals:QA,argsDebugName:(e,t,r)=>qe({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),vN=Ze("agentsOfThread",function(e){mr(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Le.map(),r=jt(i=>{for(let o of Lr(i)?i.init:i.added){let a=t.get(o.ag)??0;t.set(o.ag,a+1)}for(let o of!Lr(i)&&i.removed||[]){let a=t.get(o.ag);if(!a||a<1)throw sn("[agentsOfThread] number is now negative",{log:o,event:i,mapped:t,prev:a});t.set(o.ag,a-1)}es(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return Ra(t,n),t}),yk=Ze("entityOverlap",function(e,t){return es(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),Ge(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),wN=Ze("entityOverlapCount",function(e,t){return Ge(()=>yk(e,t).get().length)}),gk=Ze("querySingle",function(e,t,r={}){let n=xh(e,t,r);return Ge(()=>{if(n.isEmpty)return null;if(n.size>1)throw sn("[querySingle] got",n.size,"results:",n);let i=n.nodes[0].logsOfThisNode;if(i.size!=1)throw sn("[querySingle] single result, but got",i.size,"logs:",i.applogs);return i.applogs[0]})},{equals:We.structural,argsDebugName:(e,t)=>qe({caller:"querySingle",thread:e,pattern:t})}),_N=Ze("querySingleAndMap",function(e,t,r,n={}){let i=gk(e,t,n);return Ge(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:ts(r)(o)})},{equals:We.structural,argsDebugName:(e,t)=>qe({caller:"querySingleAndMap",thread:e,pattern:t})}),mk=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map(ts(t))},bk=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 sn(`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=>ts(t)(e))};function ts(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function vk(e,t){return t.map(r=>wk(e,r))}function wk(e,t){return`${e}/${t}`}function Ih(e,t){return Array.isArray(e)?lo.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function _k(){if(ks!=null&&performance.now()>=ks)throw new Tk(ks)}var Tk=class extends Error{constructor(e){super(e)}},Ok=Ye({"../../../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}}}),Ek=Ye({"../../../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,p,S=o.length;do{if(f>=S||l>49)throw i.bytes=0,new RangeError("Could not decode varint");p=o[f++],s+=l<28?(p&n)<<l:(p&n)*Math.pow(2,l),l+=7}while(p>=r);return i.bytes=f-u,s}}}),Ak=Ye({"../../../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(p){return p<r?1:p<n?2:p<i?3:p<o?4:p<a?5:p<s?6:p<u?7:p<l?8:p<f?9:10}}}),wl=Ye({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:Ok(),decode:Ek(),encodingLength:Ak()}}}),xk=["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 Ik(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":Sk(e)||"Object"}function Sk(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(xk.includes(t))return t}var q=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}};q.uint=new q(0,"uint",!0);q.negint=new q(1,"negint",!0);q.bytes=new q(2,"bytes",!0);q.string=new q(3,"string",!0);q.array=new q(4,"array",!1);q.map=new q(5,"map",!1);q.tag=new q(6,"tag",!1);q.float=new q(7,"float",!0);q.false=new q(7,"false",!0);q.true=new q(7,"true",!0);q.null=new q(7,"null",!0);q.undefined=new q(7,"undefined",!0);q.break=new q(7,"break",!0);var ye=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}`}},co=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",kk=new TextEncoder;function va(e){return co&&globalThis.Buffer.isBuffer(e)}function Sh(e){return e instanceof Uint8Array?va(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var $k=24,jk=200,Ck=co?e=>e.length>=$k?globalThis.Buffer.from(e):kf(e):e=>e.length>=jk?kk.encode(e):kf(e),cr=e=>Uint8Array.from(e),Nk=co?(e,t,r)=>va(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Mk=co?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Sh(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},Pk=co?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function kh(e,t){if(va(e)&&va(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 kf(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 Uk=256,$h=class{constructor(e=Uk){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=Pk(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=Nk(r,0,this.cursor)}else t=Mk(this.chunks,this.cursor);return e&&this.reset(),t}},Bk=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}},Ve="CBOR decode error:",jh="CBOR encode error:",fo=[];fo[23]=1;fo[24]=2;fo[25]=3;fo[26]=5;fo[27]=9;function di(e,t,r){if(e.length-t<r)throw new Error(`${Ve} not enough data for type`)}var rt=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Tn(e,t,r){di(e,t,1);let n=e[t];if(r.strict===!0&&n<rt[0])throw new Error(`${Ve} integer encoded in more bytes than necessary (strict decode)`);return n}function On(e,t,r){di(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<rt[1])throw new Error(`${Ve} integer encoded in more bytes than necessary (strict decode)`);return n}function En(e,t,r){di(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(`${Ve} integer encoded in more bytes than necessary (strict decode)`);return n}function An(e,t,r){di(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(`${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 Rk(e,t,r,n){return new ye(q.uint,Tn(e,t+1,n),2)}function Dk(e,t,r,n){return new ye(q.uint,On(e,t+1,n),3)}function Lk(e,t,r,n){return new ye(q.uint,En(e,t+1,n),5)}function Vk(e,t,r,n){return new ye(q.uint,An(e,t+1,n),9)}function xn(e,t){return Lt(e,0,t.value)}function Lt(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(`${Ve} encountered BigInt larger than allowable range`)}}xn.encodedSize=function(e){return Lt.encodedSize(e.value)};Lt.encodedSize=function(e){return e<rt[0]?1:e<rt[1]?2:e<rt[2]?3:e<rt[3]?5:9};xn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Fk(e,t,r,n){return new ye(q.negint,-1-Tn(e,t+1,n),2)}function zk(e,t,r,n){return new ye(q.negint,-1-On(e,t+1,n),3)}function Kk(e,t,r,n){return new ye(q.negint,-1-En(e,t+1,n),5)}var _l=BigInt(-1),Ch=BigInt(1);function Gk(e,t,r,n){let i=An(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ye(q.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ve} integers outside of the safe integer range are not supported`);return new ye(q.negint,_l-BigInt(i),9)}function Tl(e,t){let r=t.value,n=typeof r=="bigint"?r*_l-Ch:r*-1-1;Lt(e,t.type.majorEncoded,n)}Tl.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*_l-Ch:t*-1-1;return r<rt[0]?1:r<rt[1]?2:r<rt[2]?3:r<rt[3]?5:9};Tl.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function po(e,t,r,n){di(e,t,r+n);let i=e.slice(t+r,t+r+n);return new ye(q.bytes,i,r+n)}function qk(e,t,r,n){return po(e,t,1,r)}function Wk(e,t,r,n){return po(e,t,2,Tn(e,t+1,n))}function Hk(e,t,r,n){return po(e,t,3,On(e,t+1,n))}function Jk(e,t,r,n){return po(e,t,5,En(e,t+1,n))}function Qk(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer bytes lengths not supported`);return po(e,t,9,i)}function wa(e){return e.encodedBytes===void 0&&(e.encodedBytes=q.equals(e.type,q.string)?Ck(e.value):e.value),e.encodedBytes}function rs(e,t){let r=wa(t);Lt(e,t.type.majorEncoded,r.length),e.push(r)}rs.encodedSize=function(e){let t=wa(e);return Lt.encodedSize(t.length)+t.length};rs.compareTokens=function(e,t){return Yk(wa(e),wa(t))};function Yk(e,t){return e.length<t.length?-1:e.length>t.length?1:kh(e,t)}var $f=new TextDecoder,Xk=32;function Zk(e,t,r){if(r-t<Xk){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return $f.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return $f.decode(e.subarray(t,r))}function ho(e,t,r,n,i){let o=r+n;di(e,t,o);let a=new ye(q.string,Zk(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function e$(e,t,r,n){return ho(e,t,1,r,n)}function t$(e,t,r,n){return ho(e,t,2,Tn(e,t+1,n),n)}function r$(e,t,r,n){return ho(e,t,3,On(e,t+1,n),n)}function n$(e,t,r,n){return ho(e,t,5,En(e,t+1,n),n)}function i$(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer string lengths not supported`);return ho(e,t,9,i,n)}var o$=rs;function pi(e,t,r,n){return new ye(q.array,n,r)}function a$(e,t,r,n){return pi(e,t,1,r)}function s$(e,t,r,n){return pi(e,t,2,Tn(e,t+1,n))}function u$(e,t,r,n){return pi(e,t,3,On(e,t+1,n))}function l$(e,t,r,n){return pi(e,t,5,En(e,t+1,n))}function c$(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer array lengths not supported`);return pi(e,t,9,i)}function f$(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ve} indefinite length items not allowed`);return pi(e,t,1,1/0)}function Ol(e,t){Lt(e,q.array.majorEncoded,t.value)}Ol.compareTokens=xn.compareTokens;Ol.encodedSize=function(e){return Lt.encodedSize(e.value)};function hi(e,t,r,n){return new ye(q.map,n,r)}function d$(e,t,r,n){return hi(e,t,1,r)}function p$(e,t,r,n){return hi(e,t,2,Tn(e,t+1,n))}function h$(e,t,r,n){return hi(e,t,3,On(e,t+1,n))}function y$(e,t,r,n){return hi(e,t,5,En(e,t+1,n))}function g$(e,t,r,n){let i=An(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ve} 64-bit integer map lengths not supported`);return hi(e,t,9,i)}function m$(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ve} indefinite length items not allowed`);return hi(e,t,1,1/0)}function El(e,t){Lt(e,q.map.majorEncoded,t.value)}El.compareTokens=xn.compareTokens;El.encodedSize=function(e){return Lt.encodedSize(e.value)};function b$(e,t,r,n){return new ye(q.tag,r,1)}function v$(e,t,r,n){return new ye(q.tag,Tn(e,t+1,n),2)}function w$(e,t,r,n){return new ye(q.tag,On(e,t+1,n),3)}function _$(e,t,r,n){return new ye(q.tag,En(e,t+1,n),5)}function T$(e,t,r,n){return new ye(q.tag,An(e,t+1,n),9)}function Al(e,t){Lt(e,q.tag.majorEncoded,t.value)}Al.compareTokens=xn.compareTokens;Al.encodedSize=function(e){return Lt.encodedSize(e.value)};var Nh=20,Mh=21,Ph=22,Uh=23;function O$(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ve} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ye(q.null,null,1):new ye(q.undefined,void 0,1)}function E$(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ve} indefinite length items not allowed`);return new ye(q.break,void 0,1)}function xl(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 ye(q.float,e,t)}function A$(e,t,r,n){return xl(Sl(e,t+1),3,n)}function x$(e,t,r,n){return xl(kl(e,t+1),5,n)}function I$(e,t,r,n){return xl(Lh(e,t+1),9,n)}function Il(e,t,r){let n=t.value;if(n===!1)e.push([q.float.majorEncoded|Nh]);else if(n===!0)e.push([q.float.majorEncoded|Mh]);else if(n===null)e.push([q.float.majorEncoded|Ph]);else if(n===void 0)e.push([q.float.majorEncoded|Uh]);else{let i,o=!1;(!r||r.float64!==!0)&&(Rh(n),i=Sl(Kt,1),n===i||Number.isNaN(n)?(Kt[0]=249,e.push(Kt.slice(0,3)),o=!0):(Dh(n),i=kl(Kt,1),n===i&&(Kt[0]=250,e.push(Kt.slice(0,5)),o=!0))),o||(S$(n),i=Lh(Kt,1),Kt[0]=251,e.push(Kt.slice(0,9)))}}Il.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){Rh(r);let n=Sl(Kt,1);if(r===n||Number.isNaN(r))return 3;if(Dh(r),n=kl(Kt,1),r===n)return 5}return 9};var Bh=new ArrayBuffer(9),xt=new DataView(Bh,1),Kt=new Uint8Array(Bh,0);function Rh(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 Sl(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 Dh(e){xt.setFloat32(0,e,!1)}function kl(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 S$(e){xt.setFloat64(0,e,!1)}function Lh(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)}Il.compareTokens=xn.compareTokens;function Ce(e,t,r){throw new Error(`${Ve} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function ns(e){return()=>{throw new Error(`${Ve} ${e}`)}}var fe=[];for(let e=0;e<=23;e++)fe[e]=Ce;fe[24]=Rk;fe[25]=Dk;fe[26]=Lk;fe[27]=Vk;fe[28]=Ce;fe[29]=Ce;fe[30]=Ce;fe[31]=Ce;for(let e=32;e<=55;e++)fe[e]=Ce;fe[56]=Fk;fe[57]=zk;fe[58]=Kk;fe[59]=Gk;fe[60]=Ce;fe[61]=Ce;fe[62]=Ce;fe[63]=Ce;for(let e=64;e<=87;e++)fe[e]=qk;fe[88]=Wk;fe[89]=Hk;fe[90]=Jk;fe[91]=Qk;fe[92]=Ce;fe[93]=Ce;fe[94]=Ce;fe[95]=ns("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)fe[e]=e$;fe[120]=t$;fe[121]=r$;fe[122]=n$;fe[123]=i$;fe[124]=Ce;fe[125]=Ce;fe[126]=Ce;fe[127]=ns("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)fe[e]=a$;fe[152]=s$;fe[153]=u$;fe[154]=l$;fe[155]=c$;fe[156]=Ce;fe[157]=Ce;fe[158]=Ce;fe[159]=f$;for(let e=160;e<=183;e++)fe[e]=d$;fe[184]=p$;fe[185]=h$;fe[186]=y$;fe[187]=g$;fe[188]=Ce;fe[189]=Ce;fe[190]=Ce;fe[191]=m$;for(let e=192;e<=215;e++)fe[e]=b$;fe[216]=v$;fe[217]=w$;fe[218]=_$;fe[219]=T$;fe[220]=Ce;fe[221]=Ce;fe[222]=Ce;fe[223]=Ce;for(let e=224;e<=243;e++)fe[e]=ns("simple values are not supported");fe[244]=Ce;fe[245]=Ce;fe[246]=Ce;fe[247]=O$;fe[248]=ns("simple values are not supported");fe[249]=A$;fe[250]=x$;fe[251]=I$;fe[252]=Ce;fe[253]=Ce;fe[254]=Ce;fe[255]=E$;var _r=[];for(let e=0;e<24;e++)_r[e]=new ye(q.uint,e,1);for(let e=-1;e>=-24;e--)_r[31-e]=new ye(q.negint,e,1);_r[64]=new ye(q.bytes,new Uint8Array(0),1);_r[96]=new ye(q.string,"",1);_r[128]=new ye(q.array,0,1);_r[160]=new ye(q.map,0,1);_r[244]=new ye(q.false,!1,1);_r[245]=new ye(q.true,!0,1);_r[246]=new ye(q.null,null,1);function k$(e){switch(e.type){case q.false:return cr([244]);case q.true:return cr([245]);case q.null:return cr([246]);case q.bytes:return e.value.length?void 0:cr([64]);case q.string:return e.value===""?cr([96]):void 0;case q.array:return e.value===0?cr([128]):void 0;case q.map:return e.value===0?cr([160]):void 0;case q.uint:return e.value<24?cr([Number(e.value)]):void 0;case q.negint:if(e.value>=-24)return cr([31-Number(e.value)])}}var $$=Object.freeze({float64:!0,mapSorter:M$,quickEncodeToken:k$});function Vh(){let e=[];return e[q.uint.major]=xn,e[q.negint.major]=Tl,e[q.bytes.major]=rs,e[q.string.major]=o$,e[q.array.major]=Ol,e[q.map.major]=El,e[q.tag.major]=Al,e[q.float.major]=Il,e}var j$=Vh(),C$=new $h,jf=class Fh{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(`${jh} object contains circular references`);return new Fh(r,t)}},kr={null:new ye(q.null,null),undefined:new ye(q.undefined,void 0),true:new ye(q.true,!0),false:new ye(q.false,!1),emptyArray:new ye(q.array,0),emptyMap:new ye(q.map,0)},Fr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ye(q.float,e):e>=0?new ye(q.uint,e):new ye(q.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ye(q.uint,e):new ye(q.negint,e)},Uint8Array(e,t,r,n){return new ye(q.bytes,e)},string(e,t,r,n){return new ye(q.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 ye(q.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ye(q.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[kr.emptyArray,new ye(q.break)]:kr.emptyArray;n=jf.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Mo(a,r,n);return r.addBreakTokens?[new ye(q.array,e.length),i,new ye(q.break)]:[new ye(q.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=jf.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let p=i?e.get(f):e[f];u&&p===void 0||(s[l++]=[Mo(f,r,n),Mo(p,r,n)])}l<a&&(s.length=l)}return s?.length?(N$(s,r),r.addBreakTokens?[new ye(q.map,s.length),s,new ye(q.break)]:[new ye(q.map,s.length),s]):r.addBreakTokens===!0?[kr.emptyMap,new ye(q.break)]:kr.emptyMap}};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 Mo(e,t={},r){let n=Ik(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(`${jh} unsupported type: ${n}`);return o(e,n,t,r)}function N$(e,t){t.mapSorter&&e.sort(t.mapSorter)}function M$(e,t){if(e[0]instanceof ye&&t[0]instanceof ye){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Cf(r.value)),n._keyBytes||(n._keyBytes=Cf(n.value)),kh(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Cf(e){return P$(e,j$,$$)}function zh(e,t,r,n){if(Array.isArray(t))for(let i of t)zh(e,i,r,n);else r[t.type.major](e,t,n)}var TN=q.uint.majorEncoded,ON=q.negint.majorEncoded,EN=q.bytes.majorEncoded,AN=q.string.majorEncoded,xN=q.array.majorEncoded,IN=q.float.majorEncoded|Nh,SN=q.float.majorEncoded|Mh,kN=q.float.majorEncoded|Ph,$N=q.float.majorEncoded|Uh,jN=BigInt(-1),CN=BigInt(1);function P$(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Bk(n):C$,a=Mo(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 $h(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():Sh(o.chunks[0])}}return o.reset(),zh(o,a,t,r),o.toBytes(!0)}var NN=Symbol.for("DONE"),MN=Symbol.for("BREAK"),PN=new Uint8Array(0);function U$(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 $l(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 B$(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 p(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 L=0,H=0,U=0,k=T.length;U!==k&&T[U]===0;)U++,L++;for(var F=(k-U)*f+1>>>0,G=new Uint8Array(F);U!==k;){for(var B=T[U],Y=0,K=F-1;(B!==0||Y<H)&&K!==-1;K--,Y++)B+=256*G[K]>>>0,G[K]=B%s>>>0,B=B/s>>>0;if(B!==0)throw new Error("Non-zero carry");H=Y,U++}for(var te=F-H;te!==F&&G[te]===0;)te++;for(var $=u.repeat(L);te<F;++te)$+=e.charAt(G[te]);return $}function S(T){if(typeof T!="string")throw new TypeError("Expected String");if(T.length===0)return new Uint8Array;var L=0;if(T[L]!==" "){for(var H=0,U=0;T[L]===u;)H++,L++;for(var k=(T.length-L)*l+1>>>0,F=new Uint8Array(k);T[L];){var G=r[T.charCodeAt(L)];if(G===255)return;for(var B=0,Y=k-1;(G!==0||B<U)&&Y!==-1;Y--,B++)G+=s*F[Y]>>>0,F[Y]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");U=B,L++}if(T[L]!==" "){for(var K=k-U;K!==k&&F[K]===0;)K++;for(var te=new Uint8Array(H+(k-K)),$=H;K!==k;)te[$++]=F[K++];return te}}}function O(T){var L=S(T);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:p,decodeUnsafe:S,decode:O}}var R$=B$,D$=R$,L$=D$,V$=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")}},F$=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 Kh(this,e)}},z$=class{decoders;constructor(e){this.decoders=e}or(e){return Kh(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 Kh(e,t){return new z$({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var K$=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 V$(e,t,r),this.decoder=new F$(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Gh({name:e,prefix:t,encode:r,decode:n}){return new K$(e,t,r,n)}function is({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=L$(r,e);return Gh({prefix:t,name:e,encode:n,decode:o=>$l(i(o))})}function G$(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 q$(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 W$(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=W$(n);return Gh({prefix:t,name:e,encode(o){return q$(o,n,r)},decode(o){return G$(o,i,r,e)}})}var Po=Tr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),UN=Tr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),BN=Tr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),RN=Tr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),DN=Tr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),LN=Tr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),VN=Tr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),FN=Tr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),zN=Tr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),$s=is({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),KN=is({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Nr=is({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),GN=is({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),H$=qh,Nf=128,J$=127,Q$=~J$,Y$=Math.pow(2,31);function qh(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Y$;)t[r++]=e&255|Nf,e/=128;for(;e&Q$;)t[r++]=e&255|Nf,e>>>=7;return t[r]=e|0,qh.bytes=r-n+1,t}var X$=cu,Z$=128,Mf=127;function cu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw cu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Mf)<<i:(a&Mf)*Math.pow(2,i),i+=7}while(a>=Z$);return cu.bytes=o-n,r}var ej=Math.pow(2,7),tj=Math.pow(2,14),rj=Math.pow(2,21),nj=Math.pow(2,28),ij=Math.pow(2,35),oj=Math.pow(2,42),aj=Math.pow(2,49),sj=Math.pow(2,56),uj=Math.pow(2,63),lj=function(e){return e<ej?1:e<tj?2:e<rj?3:e<nj?4:e<ij?5:e<oj?6:e<aj?7:e<sj?8:e<uj?9:10},cj={encode:H$,decode:X$,encodingLength:lj},fj=cj,_a=fj;function fu(e,t=0){return[_a.decode(e,t),_a.decode.bytes]}function Ta(e,t,r=0){return _a.encode(e,t,r),t}function Oa(e){return _a.encodingLength(e)}function dj(e,t){let r=t.byteLength,n=Oa(e),i=n+Oa(r),o=new Uint8Array(i+r);return Ta(e,o,0),Ta(r,o,n),o.set(t,i),new jl(e,r,t,o)}function pj(e){let t=$l(e),[r,n]=fu(t),[i,o]=fu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new jl(r,i,a,t)}function hj(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&U$(e.bytes,r.bytes)}}var jl=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Pf(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return gj(r,du(e),t??Nr.encoder);default:return mj(r,du(e),t??Po.encoder)}}var Uf=new WeakMap;function du(e){let t=Uf.get(e);if(t==null){let r=new Map;return Uf.set(e,r),r}return t}var Wh=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!==Oi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==bj)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=dj(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&&hj(t.multihash,n.multihash)}toString(t){return Pf(this,t)}toJSON(){return{"/":Pf(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??Bf(n,i,o.bytes))}else if(r[vj]===!0){let{version:n,multihash:i,code:o}=r,a=pj(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!==Oi)throw new Error(`Version 0 CID must use dag-pb (code: ${Oi}) block encoding`);return new ut(t,r,n,n.bytes)}case 1:{let i=Bf(t,r,n.bytes);return new ut(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ut.create(0,Oi,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=$l(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 jl(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[p,S]=fu(t.subarray(r));return r+=S,p},i=n(),o=Oi;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]=yj(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 du(o).set(n,t),o}};function yj(e,t){switch(e[0]){case"Q":{let r=t??Nr;return[Nr.prefix,r.decode(`${Nr.prefix}${e}`)]}case Nr.prefix:{let r=t??Nr;return[Nr.prefix,r.decode(e)]}case Po.prefix:{let r=t??Po;return[Po.prefix,r.decode(e)]}case $s.prefix:{let r=t??$s;return[$s.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 gj(e,t,r){let{prefix:n}=r;if(n!==Nr.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 mj(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 Oi=112,bj=18;function Bf(e,t,r){let n=Oa(e),i=n+Oa(t),o=new Uint8Array(i+r.byteLength);return Ta(e,o,0),Ta(t,o,n),o.set(r,i),o}var vj=Symbol.for("@ipld/js-cid/CID"),Hh=42;function wj(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Wh.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new ye(q.tag,Hh),new ye(q.bytes,r)]}function _j(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Tj(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 Oj(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 Rf={float64:!0,typeEncoders:{Map:Oj,Object:wj,undefined:_j,number:Tj}},qN={...Rf,typeEncoders:{...Rf.typeEncoders}};function Ej(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Wh.decode(e.subarray(1))}var pu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};pu.tags[Hh]=Ej;var WN={...pu,tags:pu.tags.slice()},HN=wr(wl(),1),Ur={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},Ii={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Ur.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Ur.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:Ur.Int,CarV1HeaderOrV2Pragma:e=>{if(Ur.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)"](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=Ii.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}},Si={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Ur.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Ur.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:Ur.Int,CarV1HeaderOrV2Pragma:e=>{if(Ur.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)"](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=Si.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}},JN={toTyped:Ii.CarV1HeaderOrV2Pragma,toRepresentation:Si.CarV1HeaderOrV2Pragma},QN=Vh(),YN=wr(wl(),1),XN=[new ye(q.map,2),new ye(q.string,"version"),new ye(q.uint,1),new ye(q.string,"roots")],ZN=new ye(q.tag,42),e5=wr(wl(),1),{WARN:Jh,LOG:t5,DEBUG:js,VERBOSE:Cl,ERROR:$n}=ke.setup(ke.INFO);async function Aj(e){let t=await Ij(e);return await xj(t)}async function xj({rootCID:e,blockStore:t},r=[],n){if(!e||!t)throw $n("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 $n("[decodePubFromBlocks] pub chain has a loop",{currentCID:f,visited:[...s]});s.add(f);let p=await Cn(t,a);if(Cl("[decodePubFromBlocks] root:",f,p,{blockStore:t}),!p)throw $n("[decodePubFromBlocks] root not found in blockStore",{blockStore:t,currentCID:f});let S;if(p?.info){u||(u=p.applogs);let L=await Cn(t,p.applogs);S=await $j(L,t),o||(o=await Cn(t,p.info),js("new format - infoLogs",o.logs.map(H=>({[H.toString()]:H}))))}else S=p.applogs;let O=async L=>{let H=L,U=await Cn(t,H);if(!U)throw $n("Could not find applog CID in pub blocks:",H.toString(),{cid:H,root:p,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${H.toString()}`);return U.pv instanceof Mt&&(U.pv=U.pv.toV1().toString()),{...U,cid:H.toV1().toString()}},T=await Promise.all(S.map(O));if(i=i.concat(T),!p.prev)break;if(n&&bh(p.prev,n)){js("[decodePubFromBlocks] stopping at stopAtCID:",n.toString());break}if(!await t.get(p.prev))throw $n("[decodePubFromBlocks] prev snapshot missing from blockStore",{currentCID:f,prev:p.prev.toString(),stopAtCID:n?.toString(),visited:[...s]});a=p.prev}let l={cid:e,info:o?{...o,logs:await Promise.all(o.logs.map(async f=>{let p=f,S=await Cn(t,p);if(!S)throw $n("Could not find info log CID in pub blocks:",p.toString(),{cid:p,blockStore:t}),new Error(`Could not find info log CID in pub blocks: ${p.toString()}`);return S.pv instanceof Mt&&(S.pv=S.pv.toV1().toString()),{...S,cid:p.toV1().toString()}}))}:null,applogsCID:u,applogs:i};return js("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),blockStore:t,applogs:i}),l}async function Ij(e){let t=(await e.getRoots()).map(n=>(typeof n.toV1=="function"?n:Mt.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:Mt.decode(n.bytes);Cl({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&Jh("Unexpected roots count:",t),{rootCID:Mt.parse(t[0]),blockStore:{get:n=>r.get(n.toV1().toString())}}}async function Cn(e,t){try{var r=await e.get(t);if(!r)return Jh("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return gl(r)}function Sj(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(Cl("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:r5,LOG:n5,DEBUG:i5,VERBOSE:o5,ERROR:kj}=ke.setup(ke.INFO);async function $j(e,t){return jj(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Cn(t,r);if(!n.logs)throw kj("Weird chunk",n);return n.logs}))).flat():e.logs}function jj(e){return e.chunks}var Ea=Wi(vy(),1),Cj=Wi(wy(),1),Qh=!1,Yh=!1;Ea.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(Qh=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(Yh=process?.env?.LOGGER_PERF_PREFIX==="true"));var Nj={prefix:void 0,time:Qh,delta:Yh,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Cs=[],Xh=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(",")}]`}},Zh=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},ki=!1,Fn=class pt{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=pt.INFO,r={}){r=Object.assign({},Nj,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(...S){let O=S[S.length-1];return O===i?O():(o(...S.slice(0,-1)),(async()=>{try{let T=O();return T instanceof Promise?await T:T}finally{console.groupEnd()}})())}let p=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?p:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:p})},s=a(t>=pt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,Cj.default)(u))),WARN:a(t>=pt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=pt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=pt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=pt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Ea.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Ea.isBrowser&&navigator.userAgent.includes("Chrome")?["",pt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(ki?n.push(new Zh("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();pt.firstLog||(pt.firstLog=i,pt.lastLog=i);let o=new Xh(i-pt.firstLog,i-pt.lastLog,t,r);return pt.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}}}};Ea.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Cs&&Cs.length){for(let t of Cs)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof Xh))return null;ki||(ki=!0);let t=Fn.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof Zh?(ki||(ki=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var{WARN:Mj,LOG:a5,DEBUG:Ci,VERBOSE:s5,ERROR:os}=Fn.setup(Fn.INFO),Nl=["https://trustless-gateway.link/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function Ml(e,{readOnly:t=!0,pinnedCID:r,gateways:n=Nl}={}){let{cid:i,errors:o,isIpns:a}=FS(e);if(!i)throw os("Failed to parse pubID",e,o);Ci("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await ey(i),{applogs:u,info:l}=await Aj(s),f=u.filter(au);f.length&&Mj(`Found ${f.length} encrypted logs - skipping`);let p=u.filter(O=>!au(O));qi(p);let S=lo.fromArray(p,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:S,encryptedCount:f.length}}async function ey(e,t=Nl){return e=uu(e),Ci("Retrieving:",e,e.toString(),"from",t),await Pl(t,async(r,n)=>{var i=ty(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await Pj(o,i);Ci("[retrieveCar] GW result",{result:a,gateway:r});let s=await od.fromIterable(a);Ci("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!bl(e)&&!bh(e,u))throw os("Fetched CAR has different CID",u.toString(),"than the one asked for:",e.toString());return s})}function ty(e,t,r="all"){let n=new URL(e.url),i=bl(t),o=`${n}${i?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=${r}`;return Ci({isIpns:i,url:o}),o}async function Pj(e,t){if(!e?.ok||!e?.body)throw os("[retrieveCar] unexpected response",e?.statusText,{url:t});return Sj(e.body.getReader())}async function Pl(e,t,r=1){try{return await Promise.any(ra(e).map(async n=>{try{return await t(n,r)}catch(i){throw os("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await Pl(e,t,r+1);throw new Error("[Gateway] no valid results after 3 attempts via: "+ra(e).map(({url:i})=>i)+`
|
|
63
|
+
`+n.errors.map(i=>i.message))}}var{WARN:UM,LOG:BM,DEBUG:RM,VERBOSE:DM,ERROR:LM}=ke.setup(ke.INFO),{WARN:Uj,LOG:VM,DEBUG:Bj,VERBOSE:as,ERROR:FM}=ke.setup(ke.INFO),zM=Ze("queryDivergencesByPrev",function(e){Bj(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("lastWriteWins")&&Uj("queryDivergencesByPrev on thread lastWriteWins",e);let t=qt(()=>{let r=new Map,n=new Set;as("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())),as("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 lo(qe({caller:"DivergenceLeaf",thread:e,pattern:`leaf: ${i}`}),r.get(i),e.filters,!0);return{log:o.latestLog,thread:o}})},{name:qe({caller:"queryDivergencesByPrev",thread:e})});return as.isDisabled||Ut(()=>as("[queryDivergencesByPrev] result:",hr(t))),t},{equals:We.structural}),{WARN:KM,LOG:GM,DEBUG:qM,VERBOSE:WM,ERROR:HM}=Fn.setup(Fn.INFO);var{WARN:XM,LOG:ZM,DEBUG:eP,VERBOSE:tP,ERROR:rP}=fs.setup(fs.INFO),Rj="https://nftstorage.link";async function nP(e,{readOnly:t=!0,pinnedCID:r}={}){return Ml(e,{readOnly:t,pinnedCID:r,gateways:[{url:Rj}]})}export{Rj as a,nP as b};
|
|
64
|
+
/*! Bundled license information:
|
|
65
|
+
|
|
66
|
+
lodash-es/lodash.js:
|
|
67
|
+
(**
|
|
68
|
+
* @license
|
|
69
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
70
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
71
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
72
|
+
* Released under MIT license <https://lodash.com/license>
|
|
73
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
74
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
75
|
+
*)
|
|
76
|
+
|
|
77
|
+
@noble/hashes/utils.js:
|
|
78
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
79
|
+
*/
|
|
80
|
+
//# sourceMappingURL=chunk-6ZXE5LGO.min.js.map
|