@wovin/connect-nftstorage 0.0.26 → 0.1.1
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.
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import{e as Vs}from"./chunk-BKKH6BET.min.js";var hg=Object.create,kd=Object.defineProperty,yg=Object.getOwnPropertyDescriptor,gg=Object.getOwnPropertyNames,mg=Object.getPrototypeOf,bg=Object.prototype.hasOwnProperty,si=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vg=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of gg(t))!bg.call(e,i)&&i!==r&&kd(e,i,{get:()=>t[i],enumerable:!(n=yg(t,i))||n.enumerable});return e},yo=(e,t,r)=>(r=e!=null?hg(mg(e)):{},vg(t||!e||!e.__esModule?kd(r,"default",{value:e,enumerable:!0}):r,e)),wg=si((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}}),_g=si((e,t)=>{"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,I=o.length;do{if(f>=I||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}),Tg=si((e,t)=>{"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}),Ku=si((e,t)=>{"use strict";t.exports={encode:wg(),decode:_g(),encodingLength:Tg()}}),Eg=si(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}),xg=si((e,t)=>{"use strict";t.exports=function(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,o=n.cmp&&function(s){return function(u){return function(l,f){var d={key:l,value:u[l]},I={key:f,value:u[f]};return s(d,I)}}}(n.cmp),a=[];return function s(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,I=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<I.length;l++){var E=I[l],T=s(u[E]);T&&(f&&(f+=","),f+=JSON.stringify(E)+":"+T)}return a.splice(d,1),"{"+f+"}"}}(r)}}),Og=["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 Ag(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":Sg(e)||"Object"}function Sg(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Og.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 we=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}`}},go=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Ig=new TextEncoder;function ua(e){return go&&globalThis.Buffer.isBuffer(e)}function Gu(e){return e instanceof Uint8Array?ua(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var kg=24,jg=200,$g=go?e=>e.length>=kg?globalThis.Buffer.from(e):Ec(e):e=>e.length>=jg?Ig.encode(e):Ec(e),vr=e=>Uint8Array.from(e),Cg=go?(e,t,r)=>ua(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Ng=go?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Gu(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},Ug=go?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function jd(e,t){if(ua(e)&&ua(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 Ec(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 Pg=256,$d=class{constructor(e=Pg){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=Ug(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=Cg(r,0,this.cursor)}else t=Ng(this.chunks,this.cursor);return e&&this.reset(),t}},Bg=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}},Ie="CBOR decode error:",Cd="CBOR encode error:",mo=[];mo[23]=1;mo[24]=2;mo[25]=3;mo[26]=5;mo[27]=9;function ui(e,t,r){if(e.length-t<r)throw new Error(`${Ie} not enough data for type`)}var ot=[24,256,65536,4294967296,BigInt("18446744073709551616")];function _n(e,t,r){ui(e,t,1);let n=e[t];if(r.strict===!0&&n<ot[0])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function Tn(e,t,r){ui(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ot[1])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function En(e,t,r){ui(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ot[2])throw new Error(`${Ie} integer encoded in more bytes than necessary (strict decode)`);return n}function xn(e,t,r){ui(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<ot[3])throw new Error(`${Ie} 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(`${Ie} integers outside of the safe integer range are not supported`)}function Dg(e,t,r,n){return new we(q.uint,_n(e,t+1,n),2)}function Rg(e,t,r,n){return new we(q.uint,Tn(e,t+1,n),3)}function Mg(e,t,r,n){return new we(q.uint,En(e,t+1,n),5)}function Lg(e,t,r,n){return new we(q.uint,xn(e,t+1,n),9)}function On(e,t){return Kt(e,0,t.value)}function Kt(e,t,r){if(r<ot[0]){let n=Number(r);e.push([t|n])}else if(r<ot[1]){let n=Number(r);e.push([t|24,n])}else if(r<ot[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ot[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<ot[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(`${Ie} encountered BigInt larger than allowable range`)}}On.encodedSize=function(e){return Kt.encodedSize(e.value)};Kt.encodedSize=function(e){return e<ot[0]?1:e<ot[1]?2:e<ot[2]?3:e<ot[3]?5:9};On.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Vg(e,t,r,n){return new we(q.negint,-1-_n(e,t+1,n),2)}function Fg(e,t,r,n){return new we(q.negint,-1-Tn(e,t+1,n),3)}function zg(e,t,r,n){return new we(q.negint,-1-En(e,t+1,n),5)}var qu=BigInt(-1),Nd=BigInt(1);function Kg(e,t,r,n){let i=xn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new we(q.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ie} integers outside of the safe integer range are not supported`);return new we(q.negint,qu-BigInt(i),9)}function Wu(e,t){let r=t.value,n=typeof r=="bigint"?r*qu-Nd:r*-1-1;Kt(e,t.type.majorEncoded,n)}Wu.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*qu-Nd:t*-1-1;return r<ot[0]?1:r<ot[1]?2:r<ot[2]?3:r<ot[3]?5:9};Wu.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function bo(e,t,r,n){ui(e,t,r+n);let i=e.slice(t+r,t+r+n);return new we(q.bytes,i,r+n)}function Gg(e,t,r,n){return bo(e,t,1,r)}function qg(e,t,r,n){return bo(e,t,2,_n(e,t+1,n))}function Wg(e,t,r,n){return bo(e,t,3,Tn(e,t+1,n))}function Jg(e,t,r,n){return bo(e,t,5,En(e,t+1,n))}function Hg(e,t,r,n){let i=xn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer bytes lengths not supported`);return bo(e,t,9,i)}function la(e){return e.encodedBytes===void 0&&(e.encodedBytes=q.equals(e.type,q.string)?$g(e.value):e.value),e.encodedBytes}function Ya(e,t){let r=la(t);Kt(e,t.type.majorEncoded,r.length),e.push(r)}Ya.encodedSize=function(e){let t=la(e);return Kt.encodedSize(t.length)+t.length};Ya.compareTokens=function(e,t){return Xg(la(e),la(t))};function Xg(e,t){return e.length<t.length?-1:e.length>t.length?1:jd(e,t)}var xc=new TextDecoder,Qg=32;function Zg(e,t,r){if(r-t<Qg){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return xc.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return xc.decode(e.subarray(t,r))}function vo(e,t,r,n,i){let o=r+n;ui(e,t,o);let a=new we(q.string,Zg(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function Yg(e,t,r,n){return vo(e,t,1,r,n)}function em(e,t,r,n){return vo(e,t,2,_n(e,t+1,n),n)}function tm(e,t,r,n){return vo(e,t,3,Tn(e,t+1,n),n)}function rm(e,t,r,n){return vo(e,t,5,En(e,t+1,n),n)}function nm(e,t,r,n){let i=xn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer string lengths not supported`);return vo(e,t,9,i,n)}var im=Ya;function li(e,t,r,n){return new we(q.array,n,r)}function om(e,t,r,n){return li(e,t,1,r)}function am(e,t,r,n){return li(e,t,2,_n(e,t+1,n))}function sm(e,t,r,n){return li(e,t,3,Tn(e,t+1,n))}function um(e,t,r,n){return li(e,t,5,En(e,t+1,n))}function lm(e,t,r,n){let i=xn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer array lengths not supported`);return li(e,t,9,i)}function cm(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return li(e,t,1,1/0)}function Ju(e,t){Kt(e,q.array.majorEncoded,t.value)}Ju.compareTokens=On.compareTokens;Ju.encodedSize=function(e){return Kt.encodedSize(e.value)};function ci(e,t,r,n){return new we(q.map,n,r)}function fm(e,t,r,n){return ci(e,t,1,r)}function dm(e,t,r,n){return ci(e,t,2,_n(e,t+1,n))}function pm(e,t,r,n){return ci(e,t,3,Tn(e,t+1,n))}function hm(e,t,r,n){return ci(e,t,5,En(e,t+1,n))}function ym(e,t,r,n){let i=xn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ie} 64-bit integer map lengths not supported`);return ci(e,t,9,i)}function gm(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return ci(e,t,1,1/0)}function Hu(e,t){Kt(e,q.map.majorEncoded,t.value)}Hu.compareTokens=On.compareTokens;Hu.encodedSize=function(e){return Kt.encodedSize(e.value)};function mm(e,t,r,n){return new we(q.tag,r,1)}function bm(e,t,r,n){return new we(q.tag,_n(e,t+1,n),2)}function vm(e,t,r,n){return new we(q.tag,Tn(e,t+1,n),3)}function wm(e,t,r,n){return new we(q.tag,En(e,t+1,n),5)}function _m(e,t,r,n){return new we(q.tag,xn(e,t+1,n),9)}function Xu(e,t){Kt(e,q.tag.majorEncoded,t.value)}Xu.compareTokens=On.compareTokens;Xu.encodedSize=function(e){return Kt.encodedSize(e.value)};var Ud=20,Pd=21,Bd=22,Dd=23;function Tm(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ie} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new we(q.null,null,1):new we(q.undefined,void 0,1)}function Em(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ie} indefinite length items not allowed`);return new we(q.break,void 0,1)}function Qu(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ie} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ie} Infinity values are not supported`)}return new we(q.float,e,t)}function xm(e,t,r,n){return Qu(Yu(e,t+1),3,n)}function Om(e,t,r,n){return Qu(el(e,t+1),5,n)}function Am(e,t,r,n){return Qu(Vd(e,t+1),9,n)}function Zu(e,t,r){let n=t.value;if(n===!1)e.push([q.float.majorEncoded|Ud]);else if(n===!0)e.push([q.float.majorEncoded|Pd]);else if(n===null)e.push([q.float.majorEncoded|Bd]);else if(n===void 0)e.push([q.float.majorEncoded|Dd]);else{let i,o=!1;(!r||r.float64!==!0)&&(Md(n),i=Yu(Xt,1),n===i||Number.isNaN(n)?(Xt[0]=249,e.push(Xt.slice(0,3)),o=!0):(Ld(n),i=el(Xt,1),n===i&&(Xt[0]=250,e.push(Xt.slice(0,5)),o=!0))),o||(Sm(n),i=Vd(Xt,1),Xt[0]=251,e.push(Xt.slice(0,9)))}}Zu.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){Md(r);let n=Yu(Xt,1);if(r===n||Number.isNaN(r))return 3;if(Ld(r),n=el(Xt,1),r===n)return 5}return 9};var Rd=new ArrayBuffer(9),kt=new DataView(Rd,1),Xt=new Uint8Array(Rd,0);function Md(e){if(e===1/0)kt.setUint16(0,31744,!1);else if(e===-1/0)kt.setUint16(0,64512,!1);else if(Number.isNaN(e))kt.setUint16(0,32256,!1);else{kt.setFloat32(0,e);let t=kt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)kt.setUint16(0,31744,!1);else if(r===0)kt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?kt.setUint16(0,0):i<-14?kt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):kt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Yu(e,t){if(e.length-t<2)throw new Error(`${Ie} 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 Ld(e){kt.setFloat32(0,e,!1)}function el(e,t){if(e.length-t<4)throw new Error(`${Ie} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function Sm(e){kt.setFloat64(0,e,!1)}function Vd(e,t){if(e.length-t<8)throw new Error(`${Ie} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Zu.compareTokens=On.compareTokens;function Ne(e,t,r){throw new Error(`${Ie} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function es(e){return()=>{throw new Error(`${Ie} ${e}`)}}var le=[];for(let e=0;e<=23;e++)le[e]=Ne;le[24]=Dg;le[25]=Rg;le[26]=Mg;le[27]=Lg;le[28]=Ne;le[29]=Ne;le[30]=Ne;le[31]=Ne;for(let e=32;e<=55;e++)le[e]=Ne;le[56]=Vg;le[57]=Fg;le[58]=zg;le[59]=Kg;le[60]=Ne;le[61]=Ne;le[62]=Ne;le[63]=Ne;for(let e=64;e<=87;e++)le[e]=Gg;le[88]=qg;le[89]=Wg;le[90]=Jg;le[91]=Hg;le[92]=Ne;le[93]=Ne;le[94]=Ne;le[95]=es("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)le[e]=Yg;le[120]=em;le[121]=tm;le[122]=rm;le[123]=nm;le[124]=Ne;le[125]=Ne;le[126]=Ne;le[127]=es("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)le[e]=om;le[152]=am;le[153]=sm;le[154]=um;le[155]=lm;le[156]=Ne;le[157]=Ne;le[158]=Ne;le[159]=cm;for(let e=160;e<=183;e++)le[e]=fm;le[184]=dm;le[185]=pm;le[186]=hm;le[187]=ym;le[188]=Ne;le[189]=Ne;le[190]=Ne;le[191]=gm;for(let e=192;e<=215;e++)le[e]=mm;le[216]=bm;le[217]=vm;le[218]=wm;le[219]=_m;le[220]=Ne;le[221]=Ne;le[222]=Ne;le[223]=Ne;for(let e=224;e<=243;e++)le[e]=es("simple values are not supported");le[244]=Ne;le[245]=Ne;le[246]=Ne;le[247]=Tm;le[248]=es("simple values are not supported");le[249]=xm;le[250]=Om;le[251]=Am;le[252]=Ne;le[253]=Ne;le[254]=Ne;le[255]=Em;var yr=[];for(let e=0;e<24;e++)yr[e]=new we(q.uint,e,1);for(let e=-1;e>=-24;e--)yr[31-e]=new we(q.negint,e,1);yr[64]=new we(q.bytes,new Uint8Array(0),1);yr[96]=new we(q.string,"",1);yr[128]=new we(q.array,0,1);yr[160]=new we(q.map,0,1);yr[244]=new we(q.false,!1,1);yr[245]=new we(q.true,!0,1);yr[246]=new we(q.null,null,1);function Im(e){switch(e.type){case q.false:return vr([244]);case q.true:return vr([245]);case q.null:return vr([246]);case q.bytes:return e.value.length?void 0:vr([64]);case q.string:return e.value===""?vr([96]):void 0;case q.array:return e.value===0?vr([128]):void 0;case q.map:return e.value===0?vr([160]):void 0;case q.uint:return e.value<24?vr([Number(e.value)]):void 0;case q.negint:if(e.value>=-24)return vr([31-Number(e.value)])}}var km=Object.freeze({float64:!0,mapSorter:Um,quickEncodeToken:Im});function jm(){let e=[];return e[q.uint.major]=On,e[q.negint.major]=Wu,e[q.bytes.major]=Ya,e[q.string.major]=im,e[q.array.major]=Ju,e[q.map.major]=Hu,e[q.tag.major]=Xu,e[q.float.major]=Zu,e}var $m=jm(),Cm=new $d,Oc=class Fd{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(`${Cd} object contains circular references`);return new Fd(r,t)}},Br={null:new we(q.null,null),undefined:new we(q.undefined,void 0),true:new we(q.true,!0),false:new we(q.false,!1),emptyArray:new we(q.array,0),emptyMap:new we(q.map,0)},Xr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new we(q.float,e):e>=0?new we(q.uint,e):new we(q.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new we(q.uint,e):new we(q.negint,e)},Uint8Array(e,t,r,n){return new we(q.bytes,e)},string(e,t,r,n){return new we(q.string,e)},boolean(e,t,r,n){return e?Br.true:Br.false},null(e,t,r,n){return Br.null},undefined(e,t,r,n){return Br.undefined},ArrayBuffer(e,t,r,n){return new we(q.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new we(q.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Br.emptyArray,new we(q.break)]:Br.emptyArray;n=Oc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Jo(a,r,n);return r.addBreakTokens?[new we(q.array,e.length),i,new we(q.break)]:[new we(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=Oc.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[Jo(f,r,n),Jo(d,r,n)])}l<a&&(s.length=l)}return s?.length?(Nm(s,r),r.addBreakTokens?[new we(q.map,s.length),s,new we(q.break)]:[new we(q.map,s.length),s]):r.addBreakTokens===!0?[Br.emptyMap,new we(q.break)]:Br.emptyMap}};Xr.Map=Xr.Object;Xr.Buffer=Xr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Xr[`${e}Array`]=Xr.DataView;function Jo(e,t={},r){let n=Ag(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Xr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Xr[n];if(!o)throw new Error(`${Cd} unsupported type: ${n}`);return o(e,n,t,r)}function Nm(e,t){t.mapSorter&&e.sort(t.mapSorter)}function Um(e,t){if(e[0]instanceof we&&t[0]instanceof we){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Ac(r.value)),n._keyBytes||(n._keyBytes=Ac(n.value)),jd(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Ac(e){return Pm(e,$m,km)}function zd(e,t,r,n){if(Array.isArray(t))for(let i of t)zd(e,i,r,n);else r[t.type.major](e,t,n)}var eN=q.uint.majorEncoded,tN=q.negint.majorEncoded,rN=q.bytes.majorEncoded,nN=q.string.majorEncoded,iN=q.array.majorEncoded,oN=q.float.majorEncoded|Ud,aN=q.float.majorEncoded|Pd,sN=q.float.majorEncoded|Bd,uN=q.float.majorEncoded|Dd,lN=BigInt(-1),cN=BigInt(1);function Pm(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Bg(n):Cm,a=Jo(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 $d(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():Gu(o.chunks[0])}}return o.reset(),zd(o,a,t,r),o.toBytes(!0)}var Bm={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},Dm=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=yr[e];if(t===void 0){let r=le[e];if(!r)throw new Error(`${Ie} 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}},eo=Symbol.for("DONE"),ts=Symbol.for("BREAK");function Rm(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=to(t,r);if(o===ts){if(e.value===1/0)break;throw new Error(`${Ie} got unexpected break to lengthed array`)}if(o===eo)throw new Error(`${Ie} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function Mm(e,t,r){let n=r.useMaps===!0,i=r.rejectDuplicateMapKeys===!0,o=n?void 0:{},a=n?new Map:void 0;for(let s=0;s<e.value;s++){let u=to(t,r);if(u===ts){if(e.value===1/0)break;throw new Error(`${Ie} got unexpected break to lengthed map`)}if(u===eo)throw new Error(`${Ie} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!n&&typeof u!="string")throw new Error(`${Ie} non-string keys not supported (got ${typeof u})`);if(i&&(n&&a.has(u)||!n&&Object.hasOwn(o,u)))throw new Error(`${Ie} found repeat map key "${u}"`);let l=to(t,r);if(l===eo)throw new Error(`${Ie} found map but not enough entries (got ${s} [no value], expected ${e.value})`);n?a.set(u,l):o[u]=l}return n?a:o}function to(e,t){if(e.done())return eo;let r=e.next();if(q.equals(r.type,q.break))return ts;if(r.type.terminal)return r.value;if(q.equals(r.type,q.array))return Rm(r,e,t);if(q.equals(r.type,q.map))return Mm(r,e,t);if(q.equals(r.type,q.tag)){if(t.tags&&typeof t.tags[r.value]=="function"){let n=to(e,t);return t.tags[r.value](n)}throw new Error(`${Ie} tag not supported (${r.value})`)}throw new Error("unsupported")}function Lm(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Ie} data to decode must be a Uint8Array`);t=Object.assign({},Bm,t);let r=Gu(e),n=t.tokenizer||new Dm(r,t),i=to(n,t);if(i===eo)throw new Error(`${Ie} did not find any content to decode`);if(i===ts)throw new Error(`${Ie} got unexpected break`);return[i,e.subarray(n.pos())]}function Vm(e,t){let[r,n]=Lm(e,t);if(n.length>0)throw new Error(`${Ie} too many terminals, data makes no sense`);return r}var fN=new Uint8Array(0);function Fm(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 tl(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 zm(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var L=0,H=0,B=0,k=T.length;B!==k&&T[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,G=new Uint8Array(F);B!==k;){for(var D=T[B],Q=0,K=F-1;(D!==0||Q<H)&&K!==-1;K--,Q++)D+=256*G[K]>>>0,G[K]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");H=Q,B++}for(var re=F-H;re!==F&&G[re]===0;)re++;for(var j=u.repeat(L);re<F;++re)j+=e.charAt(G[re]);return j}function I(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,B=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 D=0,Q=k-1;(G!==0||D<B)&&Q!==-1;Q--,D++)G+=s*F[Q]>>>0,F[Q]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");B=D,L++}if(T[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(H+(k-K)),j=H;K!==k;)re[j++]=F[K++];return re}}}function E(T){var L=I(T);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Km=zm,Gm=Km,qm=Gm,Wm=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")}},Jm=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 Kd(this,e)}},Hm=class{decoders;constructor(e){this.decoders=e}or(e){return Kd(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 Kd(e,t){return new Hm({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Xm=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 Wm(e,t,r),this.decoder=new Jm(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Gd({name:e,prefix:t,encode:r,decode:n}){return new Xm(e,t,r,n)}function rs({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=qm(r,e);return Gd({prefix:t,name:e,encode:n,decode:o=>tl(i(o))})}function Qm(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 Zm(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 Ym(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Ir({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=Ym(n);return Gd({prefix:t,name:e,encode(o){return Zm(o,n,r)},decode(o){return Qm(o,i,r,e)}})}var Ho=Ir({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),dN=Ir({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),pN=Ir({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),hN=Ir({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),yN=Ir({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),gN=Ir({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),mN=Ir({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),bN=Ir({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),vN=Ir({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Fs=rs({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),wN=rs({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Fr=rs({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_N=rs({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),eb=qd,Sc=128,tb=127,rb=~tb,nb=Math.pow(2,31);function qd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=nb;)t[r++]=e&255|Sc,e/=128;for(;e&rb;)t[r++]=e&255|Sc,e>>>=7;return t[r]=e|0,qd.bytes=r-n+1,t}var ib=lu,ob=128,Ic=127;function lu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw lu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Ic)<<i:(a&Ic)*Math.pow(2,i),i+=7}while(a>=ob);return lu.bytes=o-n,r}var ab=Math.pow(2,7),sb=Math.pow(2,14),ub=Math.pow(2,21),lb=Math.pow(2,28),cb=Math.pow(2,35),fb=Math.pow(2,42),db=Math.pow(2,49),pb=Math.pow(2,56),hb=Math.pow(2,63),yb=function(e){return e<ab?1:e<sb?2:e<ub?3:e<lb?4:e<cb?5:e<fb?6:e<db?7:e<pb?8:e<hb?9:10},gb={encode:eb,decode:ib,encodingLength:yb},mb=gb,ca=mb;function cu(e,t=0){return[ca.decode(e,t),ca.decode.bytes]}function fa(e,t,r=0){return ca.encode(e,t,r),t}function da(e){return ca.encodingLength(e)}function bb(e,t){let r=t.byteLength,n=da(e),i=n+da(r),o=new Uint8Array(i+r);return fa(e,o,0),fa(r,o,n),o.set(t,i),new rl(e,r,t,o)}function vb(e){let t=tl(e),[r,n]=cu(t),[i,o]=cu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new rl(r,i,a,t)}function wb(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Fm(e.bytes,r.bytes)}}var rl=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function kc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return Tb(r,fu(e),t??Fr.encoder);default:return Eb(r,fu(e),t??Ho.encoder)}}var jc=new WeakMap;function fu(e){let t=jc.get(e);if(t==null){let r=new Map;return jc.set(e,r),r}return t}var Wd=class ft{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!==Ri)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==xb)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ft.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=bb(t,r);return ft.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 ft.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&wb(t.multihash,n.multihash)}toString(t){return kc(this,t)}toJSON(){return{"/":kc(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 ft)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new ft(n,i,o,a??$c(n,i,o.bytes))}else if(r[Ob]===!0){let{version:n,multihash:i,code:o}=r,a=vb(i);return ft.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!==Ri)throw new Error(`Version 0 CID must use dag-pb (code: ${Ri}) block encoding`);return new ft(t,r,n,n.bytes)}case 1:{let i=$c(t,r,n.bytes);return new ft(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ft.create(0,Ri,t)}static createV1(t,r){return ft.create(1,t,r)}static decode(t){let[r,n]=ft.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=ft.inspectBytes(t),n=r.size-r.multihashSize,i=tl(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 rl(r.multihashCode,r.digestSize,o,i);return[r.version===0?ft.createV0(a):ft.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=cu(t.subarray(r));return r+=I,d},i=n(),o=Ri;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]=_b(t,r),o=ft.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return fu(o).set(n,t),o}};function _b(e,t){switch(e[0]){case"Q":{let r=t??Fr;return[Fr.prefix,r.decode(`${Fr.prefix}${e}`)]}case Fr.prefix:{let r=t??Fr;return[Fr.prefix,r.decode(e)]}case Ho.prefix:{let r=t??Ho;return[Ho.prefix,r.decode(e)]}case Fs.prefix:{let r=t??Fs;return[Fs.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 Tb(e,t,r){let{prefix:n}=r;if(n!==Fr.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 Eb(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 Ri=112,xb=18;function $c(e,t,r){let n=da(e),i=n+da(t),o=new Uint8Array(i+r.byteLength);return fa(e,o,0),fa(t,o,n),o.set(r,i),o}var Ob=Symbol.for("@ipld/js-cid/CID"),Jd=42;function Ab(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Wd.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new we(q.tag,Jd),new we(q.bytes,r)]}function Sb(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Ib(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 Cc={float64:!0,typeEncoders:{Object:Ab,undefined:Sb,number:Ib}},TN={...Cc,typeEncoders:{...Cc.typeEncoders}};function kb(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Wd.decode(e.subarray(1))}var pa={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};pa.tags[Jd]=kb;var EN={...pa,tags:pa.tags.slice()},jb=e=>Vm(e,pa),xN=new Uint8Array(0);function $b(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 nl(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 Cb(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var L=0,H=0,B=0,k=T.length;B!==k&&T[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,G=new Uint8Array(F);B!==k;){for(var D=T[B],Q=0,K=F-1;(D!==0||Q<H)&&K!==-1;K--,Q++)D+=256*G[K]>>>0,G[K]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");H=Q,B++}for(var re=F-H;re!==F&&G[re]===0;)re++;for(var j=u.repeat(L);re<F;++re)j+=e.charAt(G[re]);return j}function I(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,B=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 D=0,Q=k-1;(G!==0||D<B)&&Q!==-1;Q--,D++)G+=s*F[Q]>>>0,F[Q]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");B=D,L++}if(T[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(H+(k-K)),j=H;K!==k;)re[j++]=F[K++];return re}}}function E(T){var L=I(T);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Nb=Cb,Ub=Nb,Pb=Ub,Bb=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")}},Db=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Hd(this,e)}},Rb=class{decoders;constructor(e){this.decoders=e}or(e){return Hd(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Hd(e,t){return new Rb({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Mb=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 Bb(e,t,r),this.decoder=new Db(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Xd({name:e,prefix:t,encode:r,decode:n}){return new Mb(e,t,r,n)}function Qd({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=Pb(r,e);return Xd({prefix:t,name:e,encode:n,decode:o=>nl(i(o))})}function Lb(e,t,r,n){let i={};for(let f=0;f<t.length;++f)i[t[f]]=f;let o=e.length;for(;e[o-1]==="=";)--o;let a=new Uint8Array(o*r/8|0),s=0,u=0,l=0;for(let f=0;f<o;++f){let d=i[e[f]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);u=u<<r|d,s+=r,s>=8&&(s-=8,a[l++]=255&u>>s)}if(s>=r||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a}function Vb(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 kr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){return Xd({prefix:t,name:e,encode(i){return Vb(i,n,r)},decode(i){return Lb(i,n,r,e)}})}var Xo=kr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ON=kr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),AN=kr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),SN=kr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),IN=kr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),kN=kr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),jN=kr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),$N=kr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),CN=kr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),zr=Qd({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),NN=Qd({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Fb=Zd,Nc=128,zb=127,Kb=~zb,Gb=Math.pow(2,31);function Zd(e,t,r){t=t||[],r=r||0;for(var n=r;e>=Gb;)t[r++]=e&255|Nc,e/=128;for(;e&Kb;)t[r++]=e&255|Nc,e>>>=7;return t[r]=e|0,Zd.bytes=r-n+1,t}var qb=du,Wb=128,Uc=127;function du(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw du.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&Uc)<<i:(a&Uc)*Math.pow(2,i),i+=7}while(a>=Wb);return du.bytes=o-n,r}var Jb=Math.pow(2,7),Hb=Math.pow(2,14),Xb=Math.pow(2,21),Qb=Math.pow(2,28),Zb=Math.pow(2,35),Yb=Math.pow(2,42),ev=Math.pow(2,49),tv=Math.pow(2,56),rv=Math.pow(2,63),nv=function(e){return e<Jb?1:e<Hb?2:e<Xb?3:e<Qb?4:e<Zb?5:e<Yb?6:e<ev?7:e<tv?8:e<rv?9:10},iv={encode:Fb,decode:qb,encodingLength:nv},ov=iv,ha=ov;function pu(e,t=0){return[ha.decode(e,t),ha.decode.bytes]}function ya(e,t,r=0){return ha.encode(e,t,r),t}function ga(e){return ha.encodingLength(e)}function av(e,t){let r=t.byteLength,n=ga(e),i=n+ga(r),o=new Uint8Array(i+r);return ya(e,o,0),ya(r,o,n),o.set(t,i),new il(e,r,t,o)}function hu(e){let t=nl(e),[r,n]=pu(t),[i,o]=pu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new il(r,i,a,t)}function sv(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&$b(e.bytes,r.bytes)}}var il=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Pc(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return lv(r,yu(e),t??zr.encoder);default:return cv(r,yu(e),t??Xo.encoder)}}var Bc=new WeakMap;function yu(e){let t=Bc.get(e);if(t==null){let r=new Map;return Bc.set(e,r),r}return t}var Dc=class dt{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!==fv)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return dt.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=av(t,r);return dt.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 dt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&sv(t.multihash,n.multihash)}toString(t){return Pc(this,t)}toJSON(){return{"/":Pc(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let r=t;if(r instanceof dt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new dt(n,i,o,a??Rc(n,i,o.bytes))}else if(r[dv]===!0){let{version:n,multihash:i,code:o}=r,a=hu(i);return dt.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 dt(t,r,n,n.bytes)}case 1:{let i=Rc(t,r,n.bytes);return new dt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return dt.create(0,Mi,t)}static createV1(t,r){return dt.create(1,t,r)}static decode(t){let[r,n]=dt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=dt.inspectBytes(t),n=r.size-r.multihashSize,i=nl(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 il(r.multihashCode,r.digestSize,o,i);return[r.version===0?dt.createV0(a):dt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=pu(t.subarray(r));return r+=I,d},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]=uv(t,r),o=dt.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return yu(o).set(n,t),o}};function uv(e,t){switch(e[0]){case"Q":{let r=t??zr;return[zr.prefix,r.decode(`${zr.prefix}${e}`)]}case zr.prefix:{let r=t??zr;return[zr.prefix,r.decode(e)]}case Xo.prefix:{let r=t??Xo;return[Xo.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 lv(e,t,r){let{prefix:n}=r;if(n!==zr.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 cv(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,fv=18;function Rc(e,t,r){let n=ga(e),i=n+ga(t),o=new Uint8Array(i+r.byteLength);return ya(e,o,0),ya(t,o,n),o.set(r,i),o}var dv=Symbol.for("@ipld/js-cid/CID"),hn=yo(Ku(),1),zs={SHA2_256:18,LENGTH:32,DAG_PB:112},pv=40;function ma(e,t){if(!e.length)throw new Error("Unexpected end of data");let r=hn.default.decode(e);return t.seek(hn.default.decode.bytes),r}function hv(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 yv(e){hn.default.decode(e);let t=hn.default.decode.bytes,r=hn.default.decode(e.subarray(hn.default.decode.bytes)),n=hn.default.decode.bytes;return t+n+r}var qr={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},Gi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":qr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(qr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Gi["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=Gi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:qr.Int,CarV1HeaderOrV2Pragma:e=>{if(qr.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=Gi["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=Gi.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}},qi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":qr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(qr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=qi["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=qi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:qr.Int,CarV1HeaderOrV2Pragma:e=>{if(qr.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=qi["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=qi.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}},gv={toTyped:Gi.CarV1HeaderOrV2Pragma,toRepresentation:qi.CarV1HeaderOrV2Pragma},mv=["string","number","bigint","symbol"],bv=["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 vv(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return mv.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":wv(e)?"Buffer":_v(e)||"Object"}function wv(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function _v(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(bv.includes(t))return t}var Z=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}};Z.uint=new Z(0,"uint",!0);Z.negint=new Z(1,"negint",!0);Z.bytes=new Z(2,"bytes",!0);Z.string=new Z(3,"string",!0);Z.array=new Z(4,"array",!1);Z.map=new Z(5,"map",!1);Z.tag=new Z(6,"tag",!1);Z.float=new Z(7,"float",!0);Z.false=new Z(7,"false",!0);Z.true=new Z(7,"true",!0);Z.null=new Z(7,"null",!0);Z.undefined=new Z(7,"undefined",!0);Z.break=new Z(7,"break",!0);var ve=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}`}},fi=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",Tv=new TextDecoder,Ev=new TextEncoder;function ba(e){return fi&&globalThis.Buffer.isBuffer(e)}function xv(e){return e instanceof Uint8Array?ba(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Ov=fi?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Lc(e,t,r):(e,t,r)=>r-t>64?Tv.decode(e.subarray(t,r)):Lc(e,t,r),Av=fi?e=>e.length>64?globalThis.Buffer.from(e):Mc(e):e=>e.length>64?Ev.encode(e):Mc(e),ol=fi?(e,t,r)=>ba(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),Sv=fi?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),xv(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},Iv=fi?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function kv(e,t){if(ba(e)&&ba(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 Mc(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=i&63|128):(i&64512)===55296&&n+1<e.length&&(e.charCodeAt(n+1)&64512)===56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++n)&1023),t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=i&63|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=i&63|128)}return t}function Lc(e,t,r){let n=[];for(;t<r;){let i=e[t],o=null,a=i>239?4:i>223?3:i>191?2:1;if(t+a<=r){let s,u,l,f;switch(a){case 1:i<128&&(o=i);break;case 2:s=e[t+1],(s&192)===128&&(f=(i&31)<<6|s&63,f>127&&(o=f));break;case 3:s=e[t+1],u=e[t+2],(s&192)===128&&(u&192)===128&&(f=(i&15)<<12|(s&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:s=e[t+1],u=e[t+2],l=e[t+3],(s&192)===128&&(u&192)===128&&(l&192)===128&&(f=(i&15)<<18|(s&63)<<12|(u&63)<<6|l&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=a}return jv(n)}var Vc=4096;function jv(e){let t=e.length;if(t<=Vc)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Vc));return r}var $v=256,Cv=class{constructor(e=$v){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=Iv(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=ol(r,0,this.cursor)}else t=Sv(this.chunks,this.cursor);return e&&this.reset(),t}},Ge="CBOR decode error:",Yd="CBOR encode error:",wo=[];wo[23]=1;wo[24]=2;wo[25]=3;wo[26]=5;wo[27]=9;function di(e,t,r){if(e.length-t<r)throw new Error(`${Ge} not enough data for type`)}var at=[24,256,65536,4294967296,BigInt("18446744073709551616")];function An(e,t,r){di(e,t,1);let n=e[t];if(r.strict===!0&&n<at[0])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function Sn(e,t,r){di(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<at[1])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function In(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<at[2])throw new Error(`${Ge} integer encoded in more bytes than necessary (strict decode)`);return n}function kn(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<at[3])throw new Error(`${Ge} 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(`${Ge} integers outside of the safe integer range are not supported`)}function Nv(e,t,r,n){return new ve(Z.uint,An(e,t+1,n),2)}function Uv(e,t,r,n){return new ve(Z.uint,Sn(e,t+1,n),3)}function Pv(e,t,r,n){return new ve(Z.uint,In(e,t+1,n),5)}function Bv(e,t,r,n){return new ve(Z.uint,kn(e,t+1,n),9)}function jn(e,t){return Gt(e,0,t.value)}function Gt(e,t,r){if(r<at[0]){let n=Number(r);e.push([t|n])}else if(r<at[1]){let n=Number(r);e.push([t|24,n])}else if(r<at[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<at[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<at[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(`${Ge} encountered BigInt larger than allowable range`)}}jn.encodedSize=function(e){return Gt.encodedSize(e.value)};Gt.encodedSize=function(e){return e<at[0]?1:e<at[1]?2:e<at[2]?3:e<at[3]?5:9};jn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function Dv(e,t,r,n){return new ve(Z.negint,-1-An(e,t+1,n),2)}function Rv(e,t,r,n){return new ve(Z.negint,-1-Sn(e,t+1,n),3)}function Mv(e,t,r,n){return new ve(Z.negint,-1-In(e,t+1,n),5)}var al=BigInt(-1),ep=BigInt(1);function Lv(e,t,r,n){let i=kn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ve(Z.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ge} integers outside of the safe integer range are not supported`);return new ve(Z.negint,al-BigInt(i),9)}function sl(e,t){let r=t.value,n=typeof r=="bigint"?r*al-ep:r*-1-1;Gt(e,t.type.majorEncoded,n)}sl.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*al-ep:t*-1-1;return r<at[0]?1:r<at[1]?2:r<at[2]?3:r<at[3]?5:9};sl.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function _o(e,t,r,n){di(e,t,r+n);let i=ol(e,t+r,t+r+n);return new ve(Z.bytes,i,r+n)}function Vv(e,t,r,n){return _o(e,t,1,r)}function Fv(e,t,r,n){return _o(e,t,2,An(e,t+1,n))}function zv(e,t,r,n){return _o(e,t,3,Sn(e,t+1,n))}function Kv(e,t,r,n){return _o(e,t,5,In(e,t+1,n))}function Gv(e,t,r,n){let i=kn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer bytes lengths not supported`);return _o(e,t,9,i)}function va(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Z.string?Av(e.value):e.value),e.encodedBytes}function ns(e,t){let r=va(t);Gt(e,t.type.majorEncoded,r.length),e.push(r)}ns.encodedSize=function(e){let t=va(e);return Gt.encodedSize(t.length)+t.length};ns.compareTokens=function(e,t){return qv(va(e),va(t))};function qv(e,t){return e.length<t.length?-1:e.length>t.length?1:kv(e,t)}function To(e,t,r,n,i){let o=r+n;di(e,t,o);let a=new ve(Z.string,Ov(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=ol(e,t+r,t+o)),a}function Wv(e,t,r,n){return To(e,t,1,r,n)}function Jv(e,t,r,n){return To(e,t,2,An(e,t+1,n),n)}function Hv(e,t,r,n){return To(e,t,3,Sn(e,t+1,n),n)}function Xv(e,t,r,n){return To(e,t,5,In(e,t+1,n),n)}function Qv(e,t,r,n){let i=kn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer string lengths not supported`);return To(e,t,9,i,n)}var Zv=ns;function pi(e,t,r,n){return new ve(Z.array,n,r)}function Yv(e,t,r,n){return pi(e,t,1,r)}function e0(e,t,r,n){return pi(e,t,2,An(e,t+1,n))}function t0(e,t,r,n){return pi(e,t,3,Sn(e,t+1,n))}function r0(e,t,r,n){return pi(e,t,5,In(e,t+1,n))}function n0(e,t,r,n){let i=kn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer array lengths not supported`);return pi(e,t,9,i)}function i0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return pi(e,t,1,1/0)}function ul(e,t){Gt(e,Z.array.majorEncoded,t.value)}ul.compareTokens=jn.compareTokens;ul.encodedSize=function(e){return Gt.encodedSize(e.value)};function hi(e,t,r,n){return new ve(Z.map,n,r)}function o0(e,t,r,n){return hi(e,t,1,r)}function a0(e,t,r,n){return hi(e,t,2,An(e,t+1,n))}function s0(e,t,r,n){return hi(e,t,3,Sn(e,t+1,n))}function u0(e,t,r,n){return hi(e,t,5,In(e,t+1,n))}function l0(e,t,r,n){let i=kn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${Ge} 64-bit integer map lengths not supported`);return hi(e,t,9,i)}function c0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return hi(e,t,1,1/0)}function ll(e,t){Gt(e,Z.map.majorEncoded,t.value)}ll.compareTokens=jn.compareTokens;ll.encodedSize=function(e){return Gt.encodedSize(e.value)};function f0(e,t,r,n){return new ve(Z.tag,r,1)}function d0(e,t,r,n){return new ve(Z.tag,An(e,t+1,n),2)}function p0(e,t,r,n){return new ve(Z.tag,Sn(e,t+1,n),3)}function h0(e,t,r,n){return new ve(Z.tag,In(e,t+1,n),5)}function y0(e,t,r,n){return new ve(Z.tag,kn(e,t+1,n),9)}function cl(e,t){Gt(e,Z.tag.majorEncoded,t.value)}cl.compareTokens=jn.compareTokens;cl.encodedSize=function(e){return Gt.encodedSize(e.value)};var g0=20,m0=21,b0=22,v0=23;function w0(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ge} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ve(Z.null,null,1):new ve(Z.undefined,void 0,1)}function _0(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ge} indefinite length items not allowed`);return new ve(Z.break,void 0,1)}function fl(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ge} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ge} Infinity values are not supported`)}return new ve(Z.float,e,t)}function T0(e,t,r,n){return fl(pl(e,t+1),3,n)}function E0(e,t,r,n){return fl(hl(e,t+1),5,n)}function x0(e,t,r,n){return fl(ip(e,t+1),9,n)}function dl(e,t,r){let n=t.value;if(n===!1)e.push([Z.float.majorEncoded|g0]);else if(n===!0)e.push([Z.float.majorEncoded|m0]);else if(n===null)e.push([Z.float.majorEncoded|b0]);else if(n===void 0)e.push([Z.float.majorEncoded|v0]);else{let i,o=!1;(!r||r.float64!==!0)&&(rp(n),i=pl(Qt,1),n===i||Number.isNaN(n)?(Qt[0]=249,e.push(Qt.slice(0,3)),o=!0):(np(n),i=hl(Qt,1),n===i&&(Qt[0]=250,e.push(Qt.slice(0,5)),o=!0))),o||(O0(n),i=ip(Qt,1),Qt[0]=251,e.push(Qt.slice(0,9)))}}dl.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){rp(r);let n=pl(Qt,1);if(r===n||Number.isNaN(r))return 3;if(np(r),n=hl(Qt,1),r===n)return 5}return 9};var tp=new ArrayBuffer(9),jt=new DataView(tp,1),Qt=new Uint8Array(tp,0);function rp(e){if(e===1/0)jt.setUint16(0,31744,!1);else if(e===-1/0)jt.setUint16(0,64512,!1);else if(Number.isNaN(e))jt.setUint16(0,32256,!1);else{jt.setFloat32(0,e);let t=jt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)jt.setUint16(0,31744,!1);else if(r===0)jt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?jt.setUint16(0,0):i<-14?jt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):jt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function pl(e,t){if(e.length-t<2)throw new Error(`${Ge} 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 np(e){jt.setFloat32(0,e,!1)}function hl(e,t){if(e.length-t<4)throw new Error(`${Ge} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function O0(e){jt.setFloat64(0,e,!1)}function ip(e,t){if(e.length-t<8)throw new Error(`${Ge} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}dl.compareTokens=jn.compareTokens;function Ue(e,t,r){throw new Error(`${Ge} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function is(e){return()=>{throw new Error(`${Ge} ${e}`)}}var de=[];for(let e=0;e<=23;e++)de[e]=Ue;de[24]=Nv;de[25]=Uv;de[26]=Pv;de[27]=Bv;de[28]=Ue;de[29]=Ue;de[30]=Ue;de[31]=Ue;for(let e=32;e<=55;e++)de[e]=Ue;de[56]=Dv;de[57]=Rv;de[58]=Mv;de[59]=Lv;de[60]=Ue;de[61]=Ue;de[62]=Ue;de[63]=Ue;for(let e=64;e<=87;e++)de[e]=Vv;de[88]=Fv;de[89]=zv;de[90]=Kv;de[91]=Gv;de[92]=Ue;de[93]=Ue;de[94]=Ue;de[95]=is("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)de[e]=Wv;de[120]=Jv;de[121]=Hv;de[122]=Xv;de[123]=Qv;de[124]=Ue;de[125]=Ue;de[126]=Ue;de[127]=is("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)de[e]=Yv;de[152]=e0;de[153]=t0;de[154]=r0;de[155]=n0;de[156]=Ue;de[157]=Ue;de[158]=Ue;de[159]=i0;for(let e=160;e<=183;e++)de[e]=o0;de[184]=a0;de[185]=s0;de[186]=u0;de[187]=l0;de[188]=Ue;de[189]=Ue;de[190]=Ue;de[191]=c0;for(let e=192;e<=215;e++)de[e]=f0;de[216]=d0;de[217]=p0;de[218]=h0;de[219]=y0;de[220]=Ue;de[221]=Ue;de[222]=Ue;de[223]=Ue;for(let e=224;e<=243;e++)de[e]=is("simple values are not supported");de[244]=Ue;de[245]=Ue;de[246]=Ue;de[247]=w0;de[248]=is("simple values are not supported");de[249]=T0;de[250]=E0;de[251]=x0;de[252]=Ue;de[253]=Ue;de[254]=Ue;de[255]=_0;var jr=[];for(let e=0;e<24;e++)jr[e]=new ve(Z.uint,e,1);for(let e=-1;e>=-24;e--)jr[31-e]=new ve(Z.negint,e,1);jr[64]=new ve(Z.bytes,new Uint8Array(0),1);jr[96]=new ve(Z.string,"",1);jr[128]=new ve(Z.array,0,1);jr[160]=new ve(Z.map,0,1);jr[244]=new ve(Z.false,!1,1);jr[245]=new ve(Z.true,!0,1);jr[246]=new ve(Z.null,null,1);function op(){let e=[];return e[Z.uint.major]=jn,e[Z.negint.major]=sl,e[Z.bytes.major]=ns,e[Z.string.major]=Zv,e[Z.array.major]=ul,e[Z.map.major]=ll,e[Z.tag.major]=cl,e[Z.float.major]=dl,e}var UN=op(),PN=new Cv,Fc=class ap{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(`${Yd} object contains circular references`);return new ap(r,t)}},Dr={null:new ve(Z.null,null),undefined:new ve(Z.undefined,void 0),true:new ve(Z.true,!0),false:new ve(Z.false,!1),emptyArray:new ve(Z.array,0),emptyMap:new ve(Z.map,0)},Qr={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ve(Z.float,e):e>=0?new ve(Z.uint,e):new ve(Z.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ve(Z.uint,e):new ve(Z.negint,e)},Uint8Array(e,t,r,n){return new ve(Z.bytes,e)},string(e,t,r,n){return new ve(Z.string,e)},boolean(e,t,r,n){return e?Dr.true:Dr.false},null(e,t,r,n){return Dr.null},undefined(e,t,r,n){return Dr.undefined},ArrayBuffer(e,t,r,n){return new ve(Z.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ve(Z.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Dr.emptyArray,new ve(Z.break)]:Dr.emptyArray;n=Fc.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=Ks(a,r,n);return r.addBreakTokens?[new ve(Z.array,e.length),i,new ve(Z.break)]:[new ve(Z.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?[Dr.emptyMap,new ve(Z.break)]:Dr.emptyMap;n=Fc.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[Ks(l,r,n),Ks(i?e.get(l):e[l],r,n)];return A0(s,r),r.addBreakTokens?[new ve(Z.map,a),s,new ve(Z.break)]:[new ve(Z.map,a),s]}};Qr.Map=Qr.Object;Qr.Buffer=Qr.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Qr[`${e}Array`]=Qr.DataView;function Ks(e,t={},r){let n=vv(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||Qr[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=Qr[n];if(!o)throw new Error(`${Yd} unsupported type: ${n}`);return o(e,n,t,r)}function A0(e,t){t.mapSorter&&e.sort(t.mapSorter)}var BN=Symbol.for("DONE"),DN=Symbol.for("BREAK"),RN=op(),MN=yo(Ku(),1),LN=[new ve(Z.map,2),new ve(Z.string,"version"),new ve(Z.uint,1),new ve(Z.string,"roots")],VN=new ve(Z.tag,42);async function sp(e,t){let r=ma(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR header (zero length)");let n=await e.exactly(r,!0),i=jb(n);if(gv.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=hv(await e.exactly(pv,!0));e.seek(o.dataOffset-e.pos);let a=await sp(e,1);return Object.assign(a,o)}async function S0(e){let t=await e.exactly(2,!1);if(t[0]===zs.SHA2_256&&t[1]===zs.LENGTH){let a=await e.exactly(34,!0),s=hu(a);return Dc.create(0,zs.DAG_PB,s)}let r=ma(await e.upTo(8),e);if(r!==1)throw new Error(`Unexpected CID version (${r})`);let n=ma(await e.upTo(8),e),i=await e.exactly(yv(await e.upTo(8)),!0),o=hu(i);return Dc.create(r,n,o)}async function up(e){let t=e.pos,r=ma(await e.upTo(8),e);if(r===0)throw new Error("Invalid CAR section (zero length)");r+=e.pos-t;let n=await S0(e),i=r-Number(e.pos-t);return{cid:n,length:r,blockLength:i}}async function I0(e){let{cid:t,blockLength:r}=await up(e);return{bytes:await e.exactly(r,!0),cid:t}}async function k0(e){let t=e.pos,{cid:r,length:n,blockLength:i}=await up(e),o={cid:r,length:n,blockLength:i,offset:t,blockOffset:e.pos};return e.seek(o.blockLength),o}function j0(e){let t=(async()=>{let r=await sp(e);if(r.version===2){let n=e.pos-r.dataOffset;e=U0(e,r.dataSize-n)}return r})();return{header:()=>t,async*blocks(){for(await t;(await e.upTo(8)).length>0;)yield await I0(e)},async*blocksIndex(){for(await t;(await e.upTo(8)).length>0;)yield await k0(e)}}}function $0(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 C0(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 N0(e){let t=e[Symbol.asyncIterator]();async function r(){let n=await t.next();return n.done?null:n.value}return C0(r)}function U0(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 lp=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 zc($0(e))}static async fromIterable(e){if(!e||typeof e[Symbol.asyncIterator]!="function")throw new TypeError("fromIterable() requires an async iterable");return zc(N0(e))}};async function zc(e){let t=j0(e),r=await t.header(),n=[];for await(let i of t.blocks())n.push(i);return new lp(r,n)}var FN=yo(Ku(),1),P0={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"},B0=P0;function he(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:B0[e];throw typeof i=="function"&&(i=i.apply(null,r)),new Error("[MobX] "+i)}var D0={};function os(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:D0}var cp=Object.assign,wa=Object.getOwnPropertyDescriptor,fr=Object.defineProperty,Eo=Object.prototype,_a=[];Object.freeze(_a);var yl={};Object.freeze(yl);var R0=typeof Proxy<"u",M0=Object.toString();function fp(){R0||he("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function Li(e){Y.verifyProxies&&he("MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to "+e)}function qt(){return++Y.mobxGuid}function gl(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Qn=function(){};function We(e){return typeof e=="function"}function gn(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function as(e){return e!==null&&typeof e=="object"}function or(e){if(!as(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()===M0}function dp(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function ss(e,t,r){fr(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function pp(e,t,r){fr(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function rn(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return as(n)&&n[r]===!0}}function yi(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function L0(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function _r(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var hp=typeof Object.getOwnPropertySymbols<"u";function V0(e){var t=Object.keys(e);if(!hp)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return Eo.propertyIsEnumerable.call(e,n)})):t}var us=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:hp?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function gu(e){return typeof e=="string"?e:typeof e=="symbol"?e.toString():new String(e).toString()}function yp(e){return e===null?null:typeof e=="object"?""+e:e}function Mt(e,t){return Eo.hasOwnProperty.call(e,t)}var F0=Object.getOwnPropertyDescriptors||function(e){var t={};return us(e).forEach(function(r){t[r]=wa(e,r)}),t};function _t(e,t){return!!(e&t)}function Tt(e,t,r){return r?e|=t:e&=~t,e}function Kc(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 Gc(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,K0(n.key),n)}}function gi(e,t,r){return t&&Gc(e.prototype,t),r&&Gc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Zn(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=G0(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 Or(){return Or=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},Or.apply(null,arguments)}function gp(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,mu(e,t)}function mu(e,t){return mu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},mu(e,t)}function z0(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 K0(e){var t=z0(e,"string");return typeof t=="symbol"?t:t+""}function G0(e,t){if(e){if(typeof e=="string")return Kc(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)?Kc(e,t):void 0}}var wt=Symbol("mobx-stored-annotations");function dr(e){function t(r,n){if(Oo(n))return e.decorate_20223_(r,n);xo(r,n,e)}return Object.assign(t,e)}function xo(e,t,r){if(Mt(e,wt)||ss(e,wt,Or({},e[wt])),Ta(r)&&!Mt(e[wt],t)){var n=e.constructor.name+".prototype."+t.toString();he("'"+n+"' is decorated with 'override', but no such decorated member was found on prototype.")}q0(e,r,t),Ta(r)||(e[wt][t]=r)}function q0(e,t,r){if(!Ta(t)&&Mt(e[wt],r)){var n=e.constructor.name+".prototype."+r.toString(),i=e[wt][r].annotationType_,o=t.annotationType_;he("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 W0(e){return Mt(e,wt)||ss(e,wt,Or({},e[wt])),e[wt]}function Oo(e){return typeof e=="object"&&typeof e.kind=="string"}function ls(e,t){t.includes(e.kind)||he("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var Ee=Symbol("mobx administration"),nn=function(){function e(r){r===void 0&&(r="Atom@"+qt()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=$e.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=r}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return Cp(this)},t.reportChanged=function(){Bt(),Np(this),Dt()},t.toString=function(){return this.name_},gi(e,[{key:"isBeingObserved",get:function(){return _t(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Tt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return _t(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Tt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return _t(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Tt(this.flags_,e.diffValueMask_,r===1)}}])}();nn.isBeingObservedMask_=1;nn.isPendingUnobservationMask_=2;nn.diffValueMask_=4;var ml=rn("Atom",nn);function mp(e,t,r){t===void 0&&(t=Qn),r===void 0&&(r=Qn);var n=new nn(e);return t!==Qn&&hs(n,t),r!==Qn&&bi(n,r),n}function J0(e,t){return e===t}function H0(e,t){return xl(e,t)}function X0(e,t){return xl(e,t,1)}function Q0(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ze={identity:J0,structural:H0,default:Q0,shallow:X0};function mi(e,t,r){return ri(e)?e:Array.isArray(e)?Ke.array(e,{name:r}):or(e)?Ke.object(e,void 0,{name:r}):yi(e)?Ke.map(e,{name:r}):_r(e)?Ke.set(e,{name:r}):typeof e=="function"&&!bn(e)&&!io(e)?dp(e)?ti(e):ro(r,e):e}function Z0(e,t,r){if(e==null||vn(e)||wi(e)||gr(e)||er(e))return e;if(Array.isArray(e))return Ke.array(e,{name:r,deep:!1});if(or(e))return Ke.object(e,void 0,{name:r,deep:!1});if(yi(e))return Ke.map(e,{name:r,deep:!1});if(_r(e))return Ke.set(e,{name:r,deep:!1});he("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function cs(e){return e}function Y0(e,t){return ri(e)&&he("observable.struct should not be used with observable values"),xl(e,t)?t:e}var e1="override";function Ta(e){return e.annotationType_===e1}function Ao(e,t){return{annotationType_:e,options_:t,make_:t1,extend_:r1,decorate_20223_:n1}}function t1(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(bn(r.value))return 1;var o=bp(e,this,t,r,!1);return fr(n,t,o),2}function r1(e,t,r,n){var i=bp(e,this,t,r);return e.defineProperty_(t,i,n)}function n1(e,t){ls(t,["method","field"]);var r=t.kind,n=t.name,i=t.addInitializer,o=this,a=function(u){var l,f,d,I;return mn((l=(f=o.options_)==null?void 0:f.name)!=null?l:n.toString(),u,(d=(I=o.options_)==null?void 0:I.autoAction)!=null?d:!1)};if(r=="field")return function(u){var l,f=u;return bn(f)||(f=a(f)),(l=o.options_)!=null&&l.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(r=="method"){var s;return bn(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}he("Cannot apply '"+o.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
|
|
6
|
-
'`+o.annotationType_+"' can only be used on properties with a function value."))}function i1(e,t,r,n){var i=t.annotationType_,o=n.value;We(o)||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
7
|
-
'`+i+"' can only be used on properties with a function value."))}function bp(e,t,r,n,i){var o,a,s,u,l,f,d;i===void 0&&(i=Y.safeDescriptors),i1(e,t,r,n);var I=n.value;if((o=t.options_)!=null&&o.bound){var E;I=I.bind((E=e.proxy_)!=null?E:e.target_)}return{value:mn((a=(s=t.options_)==null?void 0:s.name)!=null?a:r.toString(),I,(u=(l=t.options_)==null?void 0:l.autoAction)!=null?u:!1,(f=t.options_)!=null&&f.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function vp(e,t){return{annotationType_:e,options_:t,make_:o1,extend_:a1,decorate_20223_:s1}}function o1(e,t,r,n){var i;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!Mt(e.target_,t)||!io(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(io(r.value))return 1;var o=wp(e,this,t,r,!1,!1);return fr(n,t,o),2}function a1(e,t,r,n){var i,o=wp(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,o,n)}function s1(e,t){var r;ls(t,["method"]);var n=t.name,i=t.addInitializer;return io(e)||(e=ti(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 u1(e,t,r,n){var i=t.annotationType_,o=n.value;We(o)||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
8
|
-
'`+i+"' can only be used on properties with a generator function value."))}function wp(e,t,r,n,i,o){o===void 0&&(o=Y.safeDescriptors),u1(e,t,r,n);var a=n.value;if(io(a)||(a=ti(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 bl(e,t){return{annotationType_:e,options_:t,make_:l1,extend_:c1,decorate_20223_:f1}}function l1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function c1(e,t,r,n){return d1(e,this,t,r),e.defineComputedProperty_(t,Or({},this.options_,{get:r.get,set:r.set}),n)}function f1(e,t){ls(t,["getter"]);var r=this,n=t.name,i=t.addInitializer;return i(function(){var o=_i(this)[Ee],a=Or({},r.options_,{get:e,context:this});a.name||(a.name=o.name_+"."+n.toString()),o.values_.set(n,new Ft(a))}),function(){return this[Ee].getObservablePropValue_(n)}}function d1(e,t,r,n){var i=t.annotationType_,o=n.get;o||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
9
|
-
'`+i+"' can only be used on getter(+setter) properties."))}function fs(e,t){return{annotationType_:e,options_:t,make_:p1,extend_:h1,decorate_20223_:y1}}function p1(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function h1(e,t,r,n){var i,o;return g1(e,this,t,r),e.defineObservableProperty_(t,r.value,(i=(o=this.options_)==null?void 0:o.enhancer)!=null?i:mi,n)}function y1(e,t){if(t.kind==="field")throw he("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");ls(t,["accessor"]);var r=this,n=t.kind,i=t.name,o=new WeakSet;function a(s,u){var l,f,d=_i(s)[Ee],I=new Hr(u,(l=(f=r.options_)==null?void 0:f.enhancer)!=null?l:mi,d.name_+"."+i.toString(),!1);d.values_.set(i,I),o.add(s)}if(n=="accessor")return{get:function(){return o.has(this)||a(this,e.get.call(this)),this[Ee].getObservablePropValue_(i)},set:function(s){return o.has(this)||a(this,s),this[Ee].setObservablePropValue_(i,s)},init:function(s){return o.has(this)||a(this,s),s}}}function g1(e,t,r,n){var i=t.annotationType_;"value"in n||he("Cannot apply '"+i+"' to '"+e.name_+"."+r.toString()+"':"+(`
|
|
10
|
-
'`+i+"' cannot be used on getter/setter properties"))}var m1="true",b1=_p();function _p(e){return{annotationType_:m1,options_:e,make_:v1,extend_:w1,decorate_20223_:_1}}function v1(e,t,r,n){var i,o;if(r.get)return Xe.make_(e,t,r,n);if(r.set){var a=mn(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(fr(n,t,{configurable:!0,set:a}),2)}if(n!==e.target_&&typeof r.value=="function"){var s;if(dp(r.value)){var u,l=(u=this.options_)!=null&&u.autoBind?ti.bound:ti;return l.make_(e,t,r,n)}var f=(s=this.options_)!=null&&s.autoBind?ro.bound:ro;return f.make_(e,t,r,n)}var d=((i=this.options_)==null?void 0:i.deep)===!1?Ke.ref:Ke;if(typeof r.value=="function"&&(o=this.options_)!=null&&o.autoBind){var I;r.value=r.value.bind((I=e.proxy_)!=null?I:e.target_)}return d.make_(e,t,r,n)}function w1(e,t,r,n){var i,o;if(r.get)return Xe.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:Y.safeDescriptors?e.isPlainObject_:!0,set:mn(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?Ke.ref:Ke;return s.extend_(e,t,r,n)}function _1(e,t){he("'"+this.annotationType_+"' cannot be used as a decorator")}var T1="observable",E1="observable.ref",x1="observable.shallow",O1="observable.struct",Tp={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Tp);function zo(e){return e||Tp}var bu=fs(T1),A1=fs(E1,{enhancer:cs}),S1=fs(x1,{enhancer:Z0}),I1=fs(O1,{enhancer:Y0}),Ep=dr(bu);function Ko(e){return e.deep===!0?mi:e.deep===!1?cs:j1(e.defaultDecorator)}function k1(e){var t;return e?(t=e.defaultDecorator)!=null?t:_p(e):void 0}function j1(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:mi}function xp(e,t,r){if(Oo(t))return bu.decorate_20223_(e,t);if(gn(t)){xo(e,t,bu);return}return ri(e)?e:or(e)?Ke.object(e,t,r):Array.isArray(e)?Ke.array(e,t):yi(e)?Ke.map(e,t):_r(e)?Ke.set(e,t):typeof e=="object"&&e!==null?e:Ke.box(e,t)}cp(xp,Ep);var $1={box:function(e,t){var r=zo(t);return new Hr(e,Ko(r),r.name,!0,r.equals)},array:function(e,t){var r=zo(t);return(Y.useProxies===!1||r.proxy===!1?Pw:Ow)(e,Ko(r),r.name)},map:function(e,t){var r=zo(t);return new Wp(e,Ko(r),r.name)},set:function(e,t){var r=zo(t);return new Jp(e,Ko(r),r.name)},object:function(e,t,r){return Cn(function(){return hw(Y.useProxies===!1||r?.proxy===!1?_i({},r):Tw({},r),e,t)})},ref:dr(A1),shallow:dr(S1),deep:Ep,struct:dr(I1)},Ke=cp(xp,$1),Op="computed",C1="computed.struct",vu=bl(Op),N1=bl(C1,{equals:Ze.structural}),Xe=function(e,t){if(Oo(t))return vu.decorate_20223_(e,t);if(gn(t))return xo(e,t,vu);if(or(e))return dr(bl(Op,e));We(e)||he("First argument to `computed` should be an expression."),We(t)&&he("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=or(t)?t:{};return r.get=e,r.name||(r.name=e.name||""),new Ft(r)};Object.assign(Xe,vu);Xe.struct=dr(N1);var qc,Wc,Ea=0,U1=1,P1=(qc=(Wc=wa(function(){},"name"))==null?void 0:Wc.configurable)!=null?qc:!1,Jc={value:"action",configurable:!0,writable:!1,enumerable:!1};function mn(e,t,r,n){r===void 0&&(r=!1),We(t)||he("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&he("actions should have valid names, got: '"+e+"'");function i(){return Ap(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},P1&&(Jc.value=e,fr(i,"name",Jc)),i}function Ap(e,t,r,n,i){var o=B1(e,t,n,i);try{return r.apply(n,i)}catch(a){throw o.error_=a,a}finally{D1(o)}}function B1(e,t,r,n){var i=lt()&&!!e,o=0;if(i){o=Date.now();var a=n?Array.from(n):_a;Et({type:wl,name:e,object:r,arguments:a})}var s=Y.trackingDerivation,u=!t||!s;Bt();var l=Y.allowStateChanges;u&&($n(),l=ds(!0));var f=vl(!0),d={runAsAction_:u,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:f,notifySpy_:i,startTime_:o,actionId_:U1++,parentActionId_:Ea};return Ea=d.actionId_,d}function D1(e){Ea!==e.actionId_&&he(30),Ea=e.parentActionId_,e.error_!==void 0&&(Y.suppressReactionErrors=!0),ps(e.prevAllowStateChanges_),Qi(e.prevAllowStateReads_),Dt(),e.runAsAction_&&Er(e.prevDerivation_),e.notifySpy_&&xt({time:Date.now()-e.startTime_}),Y.suppressReactionErrors=!1}function R1(e,t){var r=ds(e);try{return t()}finally{ps(r)}}function ds(e){var t=Y.allowStateChanges;return Y.allowStateChanges=e,t}function ps(e){Y.allowStateChanges=e}var M1="create",Hr=function(e){function t(n,i,o,a,s){var u;return o===void 0&&(o="ObservableValue@"+qt()),a===void 0&&(a=!0),s===void 0&&(s=Ze.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&<()&&ei({type:M1,object:u,observableKind:"value",debugObjectName:u.name_,newValue:""+u.value_}),u}gp(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!==Y.UNCHANGED){var o=lt();o&&Et({type:rr,object:this,observableKind:"value",debugObjectName:this.name_,newValue:n,oldValue:i}),this.setNewValue_(n),o&&xt()}},r.prepareNewValue_=function(n){if(cr(this),Ut(this)){var i=Pt(this,{object:this,type:rr,newValue:n});if(!i)return Y.UNCHANGED;n=i.newValue}return n=this.enhancer(n,this.value_,this.name_),this.equals(this.value_,n)?Y.UNCHANGED:n},r.setNewValue_=function(n){var i=this.value_;this.value_=n,this.reportChanged(),nr(this)&&ir(this,{type:rr,object:this,newValue:n,oldValue:i})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(n){return Io(this,n)},r.observe_=function(n,i){return i&&n({observableKind:"value",debugObjectName:this.name_,object:this,type:rr,newValue:this.value_,oldValue:void 0}),ko(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 yp(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t}(nn),L1=rn("ObservableValue",Hr),Ft=function(){function e(r){this.dependenciesState_=$e.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=$e.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new xa(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Lt.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||he(31),this.derivation=r.get,this.name_=r.name||"ComputedValue@"+qt(),r.set&&(this.setter_=mn(this.name_+"-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Ze.structural:Ze.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Q1(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&&he(32,this.name_,this.derivation),Y.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)wu(this)&&(this.warnAboutUntrackedRead_(),Bt(),this.value_=this.computeValue_(!1),Dt());else if(Cp(this),wu(this)){var r=Y.trackingContext;this.keepAlive_&&!r&&(Y.trackingContext=this),this.trackAndCompute()&&X1(this),Y.trackingContext=r}var n=this.value_;if(Qo(n))throw n.cause;return n},t.set=function(r){if(this.setter_){this.isRunningSetter&&he(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else he(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,n=this.dependenciesState_===$e.NOT_TRACKING_,i=this.computeValue_(!0),o=n||Qo(r)||Qo(i)||!this.equals_(r,i);return o&&(this.value_=i,lt()&&ei({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:r,newValue:i})),o},t.computeValue_=function(r){this.isComputing=!0;var n=ds(!1),i;if(r)i=Sp(this,this.derivation,this.scope_);else if(Y.disableErrorBoundaries===!0)i=this.derivation.call(this.scope_);else try{i=this.derivation.call(this.scope_)}catch(o){i=new xa(o)}return ps(n),this.isComputing=!1,i},t.suspend_=function(){this.keepAlive_||(_u(this),this.value_=void 0,this.isTracing_!==Lt.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 zt(function(){var s=i.get();if(!o||n){var u=$n();r({observableKind:"computed",debugObjectName:i.name_,type:rr,object:i,newValue:s,oldValue:a}),Er(u)}o=!1,a=s})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==Lt.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_:Y.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 yp(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},gi(e,[{key:"isComputing",get:function(){return _t(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=Tt(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return _t(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=Tt(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return _t(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Tt(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return _t(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Tt(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return _t(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Tt(this.flags_,e.diffValueMask_,r===1)}}])}();Ft.isComputingMask_=1;Ft.isRunningSetterMask_=2;Ft.isBeingObservedMask_=4;Ft.isPendingUnobservationMask_=8;Ft.diffValueMask_=16;var So=rn("ComputedValue",Ft),$e;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})($e||($e={}));var Lt;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Lt||(Lt={}));var xa=function(e){this.cause=void 0,this.cause=e};function Qo(e){return e instanceof xa}function wu(e){switch(e.dependenciesState_){case $e.UP_TO_DATE_:return!1;case $e.NOT_TRACKING_:case $e.STALE_:return!0;case $e.POSSIBLY_STALE_:{for(var t=vl(!0),r=$n(),n=e.observing_,i=n.length,o=0;o<i;o++){var a=n[o];if(So(a)){if(Y.disableErrorBoundaries)a.get();else try{a.get()}catch{return Er(r),Qi(t),!0}if(e.dependenciesState_===$e.STALE_)return Er(r),Qi(t),!0}}return Ip(e),Er(r),Qi(t),!1}}}function V1(){return Y.trackingDerivation!==null}function cr(e){var t=e.observers_.size>0;!Y.allowStateChanges&&(t||Y.enforceActions==="always")&&console.warn("[MobX] "+(Y.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 F1(e){!Y.allowStateReads&&Y.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Sp(e,t,r){var n=vl(!0);Ip(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++Y.runId;var i=Y.trackingDerivation;Y.trackingDerivation=e,Y.inBatch++;var o;if(Y.disableErrorBoundaries===!0)o=t.call(r);else try{o=t.call(r)}catch(a){o=new xa(a)}return Y.inBatch--,Y.trackingDerivation=i,K1(e),z1(e),Qi(n),o}function z1(e){e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:Y.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function K1(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=$e.UP_TO_DATE_,i=0,o=e.unboundDepsCount_,a=0;a<o;a++){var s=r[a];s.diffValue===0&&(s.diffValue=1,i!==a&&(r[i]=s),i++),s.dependenciesState_>n&&(n=s.dependenciesState_)}for(r.length=i,e.newObserving_=null,o=t.length;o--;){var u=t[o];u.diffValue===0&&jp(u,e),u.diffValue=0}for(;i--;){var l=r[i];l.diffValue===1&&(l.diffValue=0,H1(l,e))}n!==$e.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function _u(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)jp(t[r],e);e.dependenciesState_=$e.NOT_TRACKING_}function ze(e){var t=$n();try{return e()}finally{Er(t)}}function $n(){var e=Y.trackingDerivation;return Y.trackingDerivation=null,e}function Er(e){Y.trackingDerivation=e}function vl(e){var t=Y.allowStateReads;return Y.allowStateReads=e,t}function Qi(e){Y.allowStateReads=e}function Ip(e){if(e.dependenciesState_!==$e.UP_TO_DATE_){e.dependenciesState_=$e.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=$e.UP_TO_DATE_}}var Zo=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},Yo=!0,kp=!1,Y=function(){var e=os();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Yo=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Zo().version&&(Yo=!1),Yo?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Zo):(setTimeout(function(){kp||he(35)},1),new Zo)}();function G1(){if((Y.pendingReactions.length||Y.inBatch||Y.isRunningReactions)&&he(36),kp=!0,Yo){var e=os();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),Y=new Zo}}function q1(){return Y}function W1(e){return e.observers_&&e.observers_.size>0}function J1(e){return e.observers_}function H1(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function jp(e,t){e.observers_.delete(t),e.observers_.size===0&&$p(e)}function $p(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,Y.pendingUnobservations.push(e))}function Bt(){Y.inBatch++}function Dt(){if(--Y.inBatch===0){Bp();for(var e=Y.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 Ft&&r.suspend_())}Y.pendingUnobservations=[]}}function Cp(e){F1(e);var t=Y.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&Y.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&Y.inBatch>0&&$p(e),!1)}function Np(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===$e.UP_TO_DATE_&&(t.isTracing_!==Lt.NONE&&Up(t,e),t.onBecomeStale_()),t.dependenciesState_=$e.STALE_}))}function X1(e){e.lowestObserverState_!==$e.STALE_&&(e.lowestObserverState_=$e.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===$e.POSSIBLY_STALE_?(t.dependenciesState_=$e.STALE_,t.isTracing_!==Lt.NONE&&Up(t,e)):t.dependenciesState_===$e.UP_TO_DATE_&&(e.lowestObserverState_=$e.UP_TO_DATE_)}))}function Q1(e){e.lowestObserverState_===$e.UP_TO_DATE_&&(e.lowestObserverState_=$e.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===$e.UP_TO_DATE_&&(t.dependenciesState_=$e.POSSIBLY_STALE_,t.onBecomeStale_())}))}function Up(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Lt.BREAK){var r=[];Pp(ys(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 Ft?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
19
|
-
|
|
20
|
-
The dependencies for this derivation are:
|
|
21
|
-
|
|
22
|
-
`+r.join(`
|
|
23
|
-
`)+`
|
|
24
|
-
*/
|
|
25
|
-
`)()}}function Pp(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 Pp(n,t,r+1)})}var pr=function(){function e(r,n,i,o){r===void 0&&(r="Reaction@"+qt()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=$e.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Lt.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,Y.pendingReactions.push(this),Bp())},t.runReaction_=function(){if(!this.isDisposed){Bt(),this.isScheduled=!1;var r=Y.trackingContext;if(Y.trackingContext=this,wu(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&<()&&ei({name:this.name_,type:"scheduled-reaction"})}catch(n){this.reportExceptionInDerivation_(n)}}Y.trackingContext=r,Dt()}},t.track=function(r){if(!this.isDisposed){Bt();var n=lt(),i;n&&(i=Date.now(),Et({name:this.name_,type:"reaction"})),this.isRunning=!0;var o=Y.trackingContext;Y.trackingContext=this;var a=Sp(this,r,void 0);Y.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&_u(this),Qo(a)&&this.reportExceptionInDerivation_(a.cause),n&&xt({time:Date.now()-i}),Dt()}},t.reportExceptionInDerivation_=function(r){var n=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(Y.disableErrorBoundaries)throw r;var i="[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'";Y.suppressReactionErrors?console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(i,r),lt()&&ei({type:"error",name:this.name_,message:i,error:""+r}),Y.globalReactionErrorHandlers.forEach(function(o){return o(r,n)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Bt(),_u(this),Dt()))},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[Ee]=this,i},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){r===void 0&&(r=!1),Gp(this,r)},gi(e,[{key:"isDisposed",get:function(){return _t(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=Tt(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return _t(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=Tt(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return _t(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=Tt(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return _t(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=Tt(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return _t(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Tt(this.flags_,e.diffValueMask_,r===1)}}])}();pr.isDisposedMask_=1;pr.isScheduledMask_=2;pr.isTrackPendingMask_=4;pr.isRunningMask_=8;pr.diffValueMask_=16;var Hc=100,Tu=function(e){return e()};function Bp(){Y.inBatch>0||Y.isRunningReactions||Tu(Z1)}function Z1(){Y.isRunningReactions=!0;for(var e=Y.pendingReactions,t=0;e.length>0;){++t===Hc&&(console.error("Reaction doesn't converge to a stable state after "+Hc+" 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_()}Y.isRunningReactions=!1}var Oa=rn("Reaction",pr);function Y1(e){var t=Tu;Tu=function(r){return e(function(){return t(r)})}}function lt(){return!!Y.spyListeners.length}function ei(e){if(Y.spyListeners.length)for(var t=Y.spyListeners,r=0,n=t.length;r<n;r++)t[r](e)}function Et(e){var t=Or({},e,{spyReportStart:!0});ei(t)}var ew={type:"report-end",spyReportEnd:!0};function xt(e){ei(e?Or({},e,{type:"report-end",spyReportEnd:!0}):ew)}function tw(e){return Y.spyListeners.push(e),gl(function(){Y.spyListeners=Y.spyListeners.filter(function(t){return t!==e})})}var wl="action",rw="action.bound",Dp="autoAction",nw="autoAction.bound",Rp="<unnamed action>",Eu=Ao(wl),iw=Ao(rw,{bound:!0}),xu=Ao(Dp,{autoAction:!0}),ow=Ao(nw,{autoAction:!0,bound:!0});function Mp(e){var t=function(r,n){if(We(r))return mn(r.name||Rp,r,e);if(We(n))return mn(r,n,e);if(Oo(n))return(e?xu:Eu).decorate_20223_(r,n);if(gn(n))return xo(r,n,e?xu:Eu);if(gn(r))return dr(Ao(e?Dp:wl,{name:r,autoAction:e}));he("Invalid arguments for `action`")};return t}var Rt=Mp(!1);Object.assign(Rt,Eu);var ro=Mp(!0);Object.assign(ro,xu);Rt.bound=dr(iw);ro.bound=dr(ow);function no(e){return Ap(e.name||Rp,!1,e,this,void 0)}function bn(e){return We(e)&&e.isMobxAction===!0}function zt(e,t){var r,n,i,o;t===void 0&&(t=yl),We(e)||he("Autorun expects a function as first argument"),bn(e)&&he("Autorun does not accept actions since actions are untrackable");var a=(r=(n=t)==null?void 0:n.name)!=null?r:e.name||"Autorun@"+qt(),s=!t.scheduler&&!t.delay,u;if(s)u=new pr(a,function(){this.track(d)},t.onError,t.requiresObservable);else{var l=Lp(t),f=!1;u=new pr(a,function(){f||(f=!0,l(function(){f=!1,u.isDisposed||u.track(d)}))},t.onError,t.requiresObservable)}function d(){e(u)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||u.schedule_(),u.getDisposer_((o=t)==null?void 0:o.signal)}var aw=function(e){return e()};function Lp(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:aw}function sw(e,t,r){var n,i,o;r===void 0&&(r=yl),(!We(e)||!We(t))&&he("First and second argument to reaction should be functions"),or(r)||he("Third argument of reactions should be an object");var a=(n=r.name)!=null?n:"Reaction@"+qt(),s=Rt(a,r.onError?uw(r.onError,t):t),u=!r.scheduler&&!r.delay,l=Lp(r),f=!0,d=!1,I,E=r.compareStructural?Ze.structural:r.equals||Ze.default,T=new pr(a,function(){f||u?L():d||(d=!0,l(L))},r.onError,r.requiresObservable);function L(){if(d=!1,!T.isDisposed){var H=!1,B=I;T.track(function(){var k=R1(!1,function(){return e(T)});H=f||!E(I,k),I=k}),(f&&r.fireImmediately||!f&&H)&&s(I,B,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 uw(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var lw="onBO",cw="onBUO";function hs(e,t,r){return Vp(lw,e,t,r)}function bi(e,t,r){return Vp(cw,e,t,r)}function Vp(e,t,r,n){var i=typeof n=="function"?ar(t,r):ar(t),o=We(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 fw="never",Go="always",dw="observed";function pw(e){e.isolateGlobalState===!0&&G1();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(Y.useProxies=t===Go?!0:t===fw?!1:typeof Proxy<"u"),t==="ifavailable"&&(Y.verifyProxies=!0),r!==void 0){var n=r===Go?Go:r===dw;Y.enforceActions=n,Y.allowStateChanges=!(n===!0||n===Go)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(Y[i]=!!e[i])}),Y.allowStateReads=!Y.observableRequiresReaction,Y.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&Y1(e.reactionScheduler)}function hw(e,t,r,n){arguments.length>4&&he("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&he("'extendObservable' expects an object as first argument"),gr(e)&&he("'extendObservable' should not be used on maps, use map.merge instead"),or(t)||he("'extendObservable' only accepts plain objects as second argument"),(ri(t)||ri(r))&&he("Extending an object with another observable (object) is not supported");var i=F0(t);return Cn(function(){var o=_i(e,n)[Ee];us(i).forEach(function(a){o.extend_(a,i[a],r&&a in r?r[a]:!0)})}),e}function ys(e,t){return Fp(ar(e,t))}function Fp(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=yw(e.observing_).map(Fp)),t}function Aa(e,t){return zp(ar(e,t))}function zp(e){var t={name:e.name_};return W1(e)&&(t.observers=Array.from(J1(e)).map(zp)),t}function yw(e){return Array.from(new Set(e))}var gw=0;function Kp(){this.message="FLOW_CANCELLED"}Kp.prototype=Object.create(Error.prototype);var Gs=vp("flow"),mw=vp("flow.bound",{bound:!0}),ti=Object.assign(function(e,t){if(Oo(t))return Gs.decorate_20223_(e,t);if(gn(t))return xo(e,t,Gs);arguments.length!==1&&he("Flow expects single argument with generator function");var r=e,n=r.name||"<unnamed flow>",i=function(){var o=this,a=arguments,s=++gw,u=Rt(n+" - runid: "+s+" - init",r).apply(o,a),l,f=void 0,d=new Promise(function(I,E){var T=0;l=E;function L(k){f=void 0;var F;try{F=Rt(n+" - runid: "+s+" - yield "+T++,u.next).call(u,k)}catch(G){return E(G)}B(F)}function H(k){f=void 0;var F;try{F=Rt(n+" - runid: "+s+" - yield "+T++,u.throw).call(u,k)}catch(G){return E(G)}B(F)}function B(k){if(We(k?.then)){k.then(B,E);return}return k.done?I(k.value):(f=Promise.resolve(k.value),f.then(L,H))}L(void 0)});return d.cancel=Rt(n+" - runid: "+s+" - cancel",function(){try{f&&Xc(f);var I=u.return(void 0),E=Promise.resolve(I.value);E.then(Qn,Qn),Xc(E),l(new Kp)}catch(T){l(T)}}),d};return i.isMobXFlow=!0,i},Gs);ti.bound=dr(mw);function Xc(e){We(e.cancel)&&e.cancel()}function io(e){return e?.isMobXFlow===!0}function bw(e,t){return e?t!==void 0?gr(e)||wi(e)?he("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."):vn(e)?e[Ee].values_.has(t):!1:vn(e)||!!e[Ee]||ml(e)||Oa(e)||So(e):!1}function ri(e){return arguments.length!==1&&he("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),bw(e)}function vw(e){if(vn(e))return e[Ee].ownKeys_();he(38)}function qo(e,t,r){return e.set(t,r),r}function Hn(e,t){if(e==null||typeof e!="object"||e instanceof Date||!ri(e))return e;if(L1(e)||So(e))return Hn(e.get(),t);if(t.has(e))return t.get(e);if(wi(e)){var r=qo(t,e,new Array(e.length));return e.forEach(function(a,s){r[s]=Hn(a,t)}),r}if(er(e)){var n=qo(t,e,new Set);return e.forEach(function(a){n.add(Hn(a,t))}),n}if(gr(e)){var i=qo(t,e,new Map);return e.forEach(function(a,s){i.set(s,Hn(a,t))}),i}else{var o=qo(t,e,{});return vw(e).forEach(function(a){Eo.propertyIsEnumerable.call(e,a)&&(o[a]=Hn(e[a],t))}),o}}function xr(e,t){return t&&he("toJS no longer supports options"),Hn(e,new Map)}function Gp(){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=ww(r);if(!i)return he("'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_===Lt.NONE&&console.log("[mobx.trace] '"+i.name_+"' tracing enabled"),i.isTracing_=e?Lt.BREAK:Lt.LOG}function ww(e){switch(e.length){case 0:return Y.trackingDerivation;case 1:return ar(e[0]);case 2:return ar(e[0],e[1])}}function Tr(e,t){t===void 0&&(t=void 0),Bt();try{return e.apply(t)}finally{Dt()}}function cn(e){return e[Ee]}var _w={has:function(e,t){return Y.trackingDerivation&&Li("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),cn(e).has_(t)},get:function(e,t){return cn(e).get_(t)},set:function(e,t,r){var n;return gn(t)?(cn(e).values_.has(t)||Li("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(n=cn(e).set_(t,r,!0))!=null?n:!0):!1},deleteProperty:function(e,t){var r;return Li("delete properties from an observable object. Use 'remove' from 'mobx' instead."),gn(t)?(r=cn(e).delete_(t,!0))!=null?r:!0:!1},defineProperty:function(e,t,r){var n;return Li("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(n=cn(e).defineProperty_(t,r))!=null?n:!0},ownKeys:function(e){return Y.trackingDerivation&&Li("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),cn(e).ownKeys_()},preventExtensions:function(e){he(13)}};function Tw(e,t){var r,n;return fp(),e=_i(e,t),(n=(r=e[Ee]).proxy_)!=null?n:r.proxy_=new Proxy(e,_w)}function Ut(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Io(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),gl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Pt(e,t){var r=$n();try{for(var n=[].concat(e.interceptors_||[]),i=0,o=n.length;i<o&&(t=n[i](t),t&&!t.type&&he(14),!!t);i++);return t}finally{Er(r)}}function nr(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function ko(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),gl(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function ir(e,t){var r=$n(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,o=n.length;i<o;i++)n[i](t);Er(r)}}function vi(e,t,r){return Cn(function(){var n,i=_i(e,r)[Ee];t&&e[wt]&&he("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(n=t)!=null||(t=W0(e)),us(t).forEach(function(o){return i.make_(o,t[o])})}),e}var Qc="splice",rr="update",Ew=1e4,xw={get:function(e,t){var r=e[Ee];return t===Ee?r:t==="length"?r.getArrayLength_():typeof t=="string"&&!isNaN(t)?r.get_(parseInt(t)):Mt(Sa,t)?Sa[t]:e[t]},set:function(e,t,r){var n=e[Ee];return t==="length"&&n.setArrayLength_(r),typeof t=="symbol"||isNaN(t)?e[t]=r:n.set_(parseInt(t),r),!0},preventExtensions:function(){he(15)}},_l=function(){function e(r,n,i,o){r===void 0&&(r="ObservableArray@"+qt()),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 nn(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 Io(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}),ko(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&he("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_&&he(16),this.lastKnownLength_+=n,this.legacyMode_&&n>0&&Qp(r+n+1)},t.spliceWithArray_=function(r,n,i){var o=this;cr(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=_a),Ut(this)){var s=Pt(this,{object:this.proxy_,type:Qc,index:r,removedCount:n,added:i});if(!s)return _a;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<Ew){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_&<(),a=nr(this),s=a||o?{observableKind:"array",object:this.proxy_,type:rr,debugObjectName:this.atom_.name_,index:r,newValue:n,oldValue:i}:null;o&&Et(s),this.atom_.reportChanged(),a&&ir(this,s),o&&xt()},t.notifyArraySplice_=function(r,n,i){var o=!this.owned_&<(),a=nr(this),s=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Qc,index:r,removed:i,added:n,removedCount:i.length,addedCount:n.length}:null;o&&Et(s),this.atom_.reportChanged(),a&&ir(this,s),o&&xt()},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&&he(17,r,i.length),r<i.length){cr(this.atom_);var o=i[r];if(Ut(this)){var a=Pt(this,{type:rr,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 Ow(e,t,r,n){return r===void 0&&(r="ObservableArray@"+qt()),n===void 0&&(n=!1),fp(),Cn(function(){var i=new _l(r,t,n,!1);pp(i.values_,Ee,i);var o=new Proxy(i.values_,xw);return i.proxy_=o,e&&e.length&&i.spliceWithArray_(0,0,e),o})}var Sa={clear:function(){return this.splice(0)},replace:function(e){var t=this[Ee];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[Ee];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[Ee].spliceWithArray_(e,t,r)},push:function(){for(var e=this[Ee],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[Ee].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[Ee],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 Y.trackingDerivation&&he(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){Y.trackingDerivation&&he(37,"sort");var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[Ee],r=t.dehanceValues_(t.values_).indexOf(e);return r>-1?(this.splice(r,1),!0):!1}};Le("at",Ot);Le("concat",Ot);Le("flat",Ot);Le("includes",Ot);Le("indexOf",Ot);Le("join",Ot);Le("lastIndexOf",Ot);Le("slice",Ot);Le("toString",Ot);Le("toLocaleString",Ot);Le("toSorted",Ot);Le("toSpliced",Ot);Le("with",Ot);Le("every",ur);Le("filter",ur);Le("find",ur);Le("findIndex",ur);Le("findLast",ur);Le("findLastIndex",ur);Le("flatMap",ur);Le("forEach",ur);Le("map",ur);Le("some",ur);Le("toReversed",ur);Le("reduce",qp);Le("reduceRight",qp);function Le(e,t){typeof Array.prototype[e]=="function"&&(Sa[e]=t(e))}function Ot(e){return function(){var t=this[Ee];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function ur(e){return function(t,r){var n=this,i=this[Ee];i.atom_.reportObserved();var o=i.dehanceValues_(i.values_);return o[e](function(a,s){return t.call(r,a,s,n)})}}function qp(e){return function(){var t=this,r=this[Ee];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 Aw=rn("ObservableArrayAdministration",_l);function wi(e){return as(e)&&Aw(e[Ee])}var Sw={},Wr="add",Ia="delete",Wp=function(){function e(r,n,i){var o=this;n===void 0&&(n=mi),i===void 0&&(i="ObservableMap@"+qt()),this.enhancer_=void 0,this.name_=void 0,this[Ee]=Sw,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,We(Map)||he(18),Cn(function(){o.keysAtom_=mp(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(!Y.trackingDerivation)return this.has_(r);var i=this.hasMap_.get(r);if(!i){var o=i=new Hr(this.has_(r),cs,this.name_+"."+gu(r)+"?",!1);this.hasMap_.set(r,o),bi(o,function(){return n.hasMap_.delete(r)})}return i.get()},t.set=function(r,n){var i=this.has_(r);if(Ut(this)){var o=Pt(this,{type:i?rr:Wr,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(cr(this.keysAtom_),Ut(this)){var i=Pt(this,{type:Ia,object:this,name:r});if(!i)return!1}if(this.has_(r)){var o=lt(),a=nr(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Ia,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return o&&Et(s),Tr(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&&ir(this,s),o&&xt(),!0}return!1},t.updateValue_=function(r,n){var i=this.data_.get(r);if(n=i.prepareNewValue_(n),n!==Y.UNCHANGED){var o=lt(),a=nr(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:rr,object:this,oldValue:i.value_,name:r,newValue:n}:null;o&&Et(s),i.setNewValue_(n),a&&ir(this,s),o&&xt()}},t.addValue_=function(r,n){var i=this;cr(this.keysAtom_),Tr(function(){var u,l=new Hr(n,i.enhancer_,i.name_+"."+gu(r),!1);i.data_.set(r,l),n=l.value_,(u=i.hasMap_.get(r))==null||u.setNewValue_(!0),i.keysAtom_.reportChanged()});var o=lt(),a=nr(this),s=a||o?{observableKind:"map",debugObjectName:this.name_,type:Wr,object:this,name:r,newValue:n}:null;o&&Et(s),a&&ir(this,s),o&&xt()},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 Zc({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 Zc({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=Zn(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 gr(r)&&(r=new Map(r)),Tr(function(){or(r)?V0(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)}):yi(r)?(L0(r)||he(19,r),r.forEach(function(i,o){return n.set(o,i)})):r!=null&&he(20,r)}),this},t.clear=function(){var r=this;Tr(function(){ze(function(){for(var n=Zn(r.keys()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.replace=function(r){var n=this;return Tr(function(){for(var i=Iw(r),o=new Map,a=!1,s=Zn(n.data_.keys()),u;!(u=s()).done;){var l=u.value;if(!i.has(l)){var f=n.delete(l);if(f)a=!0;else{var d=n.data_.get(l);o.set(l,d)}}}for(var I=Zn(i.entries()),E;!(E=I()).done;){var T=E.value,L=T[0],H=T[1],B=n.data_.has(L);if(n.set(L,H),n.data_.has(L)){var k=n.data_.get(L);o.set(L,k),B||(a=!0)}}if(!a)if(n.data_.size!==o.size)n.keysAtom_.reportChanged();else for(var F=n.data_.keys(),G=o.keys(),D=F.next(),Q=G.next();!D.done;){if(D.value!==Q.value){n.keysAtom_.reportChanged();break}D=F.next(),Q=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&&he("`observe` doesn't support fireImmediately=true in combination with maps."),ko(this,r)},t.intercept_=function(r){return Io(this,r)},gi(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),gr=rn("ObservableMap",Wp);function Zc(e){return e[Symbol.toStringTag]="MapIterator",Ol(e)}function Iw(e){if(yi(e)||gr(e))return e;if(Array.isArray(e))return new Map(e);if(or(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return he(21,e)}var kw={},Jp=function(){function e(r,n,i){var o=this;n===void 0&&(n=mi),i===void 0&&(i="ObservableSet@"+qt()),this.name_=void 0,this[Ee]=kw,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,We(Set)||he(22),this.enhancer_=function(a,s){return n(a,s,i)},Cn(function(){o.atom_=mp(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;Tr(function(){ze(function(){for(var n=Zn(r.data_.values()),i;!(i=n()).done;){var o=i.value;r.delete(o)}})})},t.forEach=function(r,n){for(var i=Zn(this),o;!(o=i()).done;){var a=o.value;r.call(n,a,a,this)}},t.add=function(r){var n=this;if(cr(this.atom_),Ut(this)){var i=Pt(this,{type:Wr,object:this,newValue:r});if(!i)return this;r=i.newValue}if(!this.has(r)){Tr(function(){n.data_.add(n.enhancer_(r,void 0)),n.atom_.reportChanged()});var o=lt(),a=nr(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:Wr,object:this,newValue:r}:null;o&&Et(s),a&&ir(this,s),o&&xt()}return this},t.delete=function(r){var n=this;if(Ut(this)){var i=Pt(this,{type:Ia,object:this,oldValue:r});if(!i)return!1}if(this.has(r)){var o=lt(),a=nr(this),s=a||o?{observableKind:"set",debugObjectName:this.name_,type:Ia,object:this,oldValue:r}:null;return o&&Et(s),Tr(function(){n.atom_.reportChanged(),n.data_.delete(r)}),a&&ir(this,s),o&&xt(),!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 Yc({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 Yc({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(_r(r)&&!er(r))return r.intersection(this);var n=new Set(this);return n.intersection(r)},t.union=function(r){if(_r(r)&&!er(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(_r(r)&&!er(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(_r(r)&&!er(r))return r.isDisjointFrom(this);var n=new Set(this);return n.isDisjointFrom(r)},t.replace=function(r){var n=this;return er(r)&&(r=new Set(r)),Tr(function(){Array.isArray(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):_r(r)?(n.clear(),r.forEach(function(i){return n.add(i)})):r!=null&&he("Cannot initialize set from "+r)}),this},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support fireImmediately=true in combination with sets."),ko(this,r)},t.intercept_=function(r){return Io(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},gi(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),er=rn("ObservableSet",Jp);function Yc(e){return e[Symbol.toStringTag]="SetIterator",Ol(e)}var ef=Object.create(null),tf="remove",Ou=function(){function e(r,n,i,o){n===void 0&&(n=new Map),o===void 0&&(o=b1),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 nn(this.name_+".keys"),this.isPlainObject_=or(this.target_),Zp(this.defaultAnnotation_)||he("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 Ft)return i.set(n),!0;if(Ut(this)){var o=Pt(this,{type:rr,object:this.proxy_||this.target_,name:r,newValue:n});if(!o)return null;n=o.newValue}if(n=i.prepareNewValue_(n),n!==Y.UNCHANGED){var a=nr(this),s=lt(),u=a||s?{type:rr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:i.value_,name:r,newValue:n}:null;s&&Et(u),i.setNewValue_(n),a&&ir(this,u),s&&xt()}return!0},t.get_=function(r){return Y.trackingDerivation&&!Mt(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,n,i){return i===void 0&&(i=!1),Mt(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,n):i?Reflect.set(this.target_,r,n):(this.target_[r]=n,!0):this.extend_(r,{value:n,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,i)},t.has_=function(r){if(!Y.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var n=this.pendingKeys_.get(r);return n||(n=new Hr(r in this.target_,cs,this.name_+"."+gu(r)+"?",!1),this.pendingKeys_.set(r,n)),n.get()},t.make_=function(r,n){if(n===!0&&(n=this.defaultAnnotation_),n!==!1){if(of(this,n,r),!(r in this.target_)){var i;if((i=this.target_[wt])!=null&&i[r])return;he(1,n.annotationType_,this.name_+"."+r.toString())}for(var o=this.target_;o&&o!==Eo;){var a=wa(o,r);if(a){var s=n.make_(this,r,a,o);if(s===0)return;if(s===1)break}o=Object.getPrototypeOf(o)}nf(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);of(this,i,r);var a=i.extend_(this,r,n,o);return a&&nf(this,i,r),a},t.defineProperty_=function(r,n,i){i===void 0&&(i=!1),cr(this.keysAtom_);try{Bt();var o=this.delete_(r);if(!o)return o;if(Ut(this)){var a=Pt(this,{object:this.proxy_||this.target_,name:r,type:Wr,newValue:n.value});if(!a)return null;var s=a.newValue;n.value!==s&&(n=Or({},n,{value:s}))}if(i){if(!Reflect.defineProperty(this.target_,r,n))return!1}else fr(this.target_,r,n);this.notifyPropertyAddition_(r,n.value)}finally{Dt()}return!0},t.defineObservableProperty_=function(r,n,i,o){o===void 0&&(o=!1),cr(this.keysAtom_);try{Bt();var a=this.delete_(r);if(!a)return a;if(Ut(this)){var s=Pt(this,{object:this.proxy_||this.target_,name:r,type:Wr,newValue:n});if(!s)return null;n=s.newValue}var u=rf(r),l={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,r,l))return!1}else fr(this.target_,r,l);var f=new Hr(n,i,this.name_+"."+r.toString(),!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{Dt()}return!0},t.defineComputedProperty_=function(r,n,i){i===void 0&&(i=!1),cr(this.keysAtom_);try{Bt();var o=this.delete_(r);if(!o)return o;if(Ut(this)){var a=Pt(this,{object:this.proxy_||this.target_,name:r,type:Wr,newValue:void 0});if(!a)return null}n.name||(n.name=this.name_+"."+r.toString()),n.context=this.proxy_||this.target_;var s=rf(r),u={configurable:Y.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:s.get,set:s.set};if(i){if(!Reflect.defineProperty(this.target_,r,u))return!1}else fr(this.target_,r,u);this.values_.set(r,new Ft(n)),this.notifyPropertyAddition_(r,void 0)}finally{Dt()}return!0},t.delete_=function(r,n){if(n===void 0&&(n=!1),cr(this.keysAtom_),!Mt(this.target_,r))return!0;if(Ut(this)){var i=Pt(this,{object:this.proxy_||this.target_,name:r,type:tf});if(!i)return null}try{var o;Bt();var a=nr(this),s=lt(),u=this.values_.get(r),l=void 0;if(!u&&(a||s)){var f;l=(f=wa(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 Hr&&(l=u.value_),Np(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(r in this.target_),a||s){var d={type:tf,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:l,name:r};s&&Et(d),a&&ir(this,d),s&&xt()}}finally{Dt()}return!0},t.observe_=function(r,n){return n===!0&&he("`observe` doesn't support the fire immediately property for observable objects."),ko(this,r)},t.intercept_=function(r){return Io(this,r)},t.notifyPropertyAddition_=function(r,n){var i,o=nr(this),a=lt();if(o||a){var s=o||a?{type:Wr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:n}:null;a&&Et(s),o&&ir(this,s),a&&xt()}(i=this.pendingKeys_)==null||(i=i.get(r))==null||i.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),us(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function _i(e,t){var r;if(t&&vn(e)&&he("Options can't be provided for already observable objects."),Mt(e,Ee))return El(e)instanceof Ou||he("Cannot convert '"+ka(e)+`' into observable object:
|
|
26
|
-
The target is already observable of different type.
|
|
27
|
-
Extending builtins is not supported.`),e;Object.isExtensible(e)||he("Cannot make the designated object observable; it is not extensible");var n=(r=t?.name)!=null?r:(or(e)?"ObservableObject":e.constructor.name)+"@"+qt(),i=new Ou(e,new Map,String(n),k1(t));return ss(e,Ee,i),e}var jw=rn("ObservableObjectAdministration",Ou);function rf(e){return ef[e]||(ef[e]={get:function(){return this[Ee].getObservablePropValue_(e)},set:function(t){return this[Ee].setObservablePropValue_(e,t)}})}function vn(e){return as(e)?jw(e[Ee]):!1}function nf(e,t,r){var n;e.appliedAnnotations_[r]=t,(n=e.target_[wt])==null||delete n[r]}function of(e,t,r){if(Zp(t)||he("Cannot annotate '"+e.name_+"."+r.toString()+"': Invalid annotation."),!Ta(t)&&Mt(e.appliedAnnotations_,r)){var n=e.name_+"."+r.toString(),i=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;he("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 $w=Xp(0),Cw=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),qs=0,Hp=function(){};function Nw(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Nw(Hp,Array.prototype);var Tl=function(e){function t(n,i,o,a){var s;return o===void 0&&(o="ObservableArray@"+qt()),a===void 0&&(a=!1),s=e.call(this)||this,Cn(function(){var u=new _l(o,i,a,!0);u.proxy_=s,pp(s,Ee,u),n&&n.length&&s.spliceWithArray(0,0,n),Cw&&Object.defineProperty(s,"0",$w)}),s}gp(t,e);var r=t.prototype;return r.concat=function(){this[Ee].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 wi(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return Ol({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},gi(t,[{key:"length",get:function(){return this[Ee].getArrayLength_()},set:function(n){this[Ee].setArrayLength_(n)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Hp);Object.entries(Sa).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&ss(Tl.prototype,t,r)});function Xp(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ee].get_(e)},set:function(t){this[Ee].set_(e,t)}}}function Uw(e){fr(Tl.prototype,""+e,Xp(e))}function Qp(e){if(e>qs){for(var t=qs;t<e+100;t++)Uw(t);qs=e}}Qp(1e3);function Pw(e,t,r){return new Tl(e,t,r)}function ar(e,t){if(typeof e=="object"&&e!==null){if(wi(e))return t!==void 0&&he(23),e[Ee].atom_;if(er(e))return e.atom_;if(gr(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||he(25,t,ka(e)),r}if(vn(e)){if(!t)return he(26);var n=e[Ee].values_.get(t);return n||he(27,t,ka(e)),n}if(ml(e)||So(e)||Oa(e))return e}else if(We(e)&&Oa(e[Ee]))return e[Ee];he(28)}function El(e,t){if(e||he(29),t!==void 0)return El(ar(e,t));if(ml(e)||So(e)||Oa(e)||gr(e)||er(e))return e;if(e[Ee])return e[Ee];he(24,e)}function ka(e,t){var r;if(t!==void 0)r=ar(e,t);else{if(bn(e))return e.name;vn(e)||gr(e)||er(e)?r=El(e):r=ar(e)}return r.name_}function Cn(e){var t=$n(),r=ds(!0);Bt();try{return e()}finally{Dt(),ps(r),Er(t)}}var af=Eo.toString;function xl(e,t,r){return r===void 0&&(r=-1),Au(e,t,r)}function Au(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=af.call(e);if(a!==af.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=sf(e),t=sf(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&&!(We(u)&&u instanceof u&&We(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(!Au(e[f],t[f],r-1,n,i))return!1}else{var d=Object.keys(e),I=d.length;if(Object.keys(t).length!==I)return!1;for(var E=0;E<I;E++){var T=d[E];if(!(Mt(t,T)&&Au(e[T],t[T],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function sf(e){return wi(e)?e.slice():yi(e)||gr(e)||_r(e)||er(e)?Array.from(e.entries()):e}var uf,Bw=((uf=os().Iterator)==null?void 0:uf.prototype)||{};function Ol(e){return e[Symbol.iterator]=Dw,Object.assign(Object.create(Bw),e)}function Dw(){return this}function Zp(e){return e instanceof Object&&typeof e.annotationType_=="string"&&We(e.make_)&&We(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=os();typeof t[e]>"u"&&he("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:tw,extras:{getDebugName:ka},$mobx:Ee});var Rw=Object.create,Al=Object.defineProperty,Mw=Object.getOwnPropertyDescriptor,Yp=Object.getOwnPropertyNames,Lw=Object.getPrototypeOf,Vw=Object.prototype.hasOwnProperty,rt=(e,t)=>function(){return t||(0,e[Yp(e)[0]])((t={exports:{}}).exports,t),t.exports},eh=(e,t)=>{for(var r in t)Al(e,r,{get:t[r],enumerable:!0})},Fw=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Yp(t))!Vw.call(e,i)&&i!==r&&Al(e,i,{get:()=>t[i],enumerable:!(n=Mw(t,i))||n.enumerable});return e},$r=(e,t,r)=>(r=e!=null?Rw(Lw(e)):{},Fw(t||!e||!e.__esModule?Al(r,"default",{value:e,enumerable:!0}):r,e)),on=rt({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/typebox.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Type=e.JsonType=e.JavaScriptTypeBuilder=e.JsonTypeBuilder=e.TypeBuilder=e.TypeBuilderError=e.TransformEncodeBuilder=e.TransformDecodeBuilder=e.TemplateLiteralDslParser=e.TemplateLiteralGenerator=e.TemplateLiteralGeneratorError=e.TemplateLiteralFinite=e.TemplateLiteralFiniteError=e.TemplateLiteralParser=e.TemplateLiteralParserError=e.TemplateLiteralResolver=e.TemplateLiteralPattern=e.TemplateLiteralPatternError=e.UnionResolver=e.KeyArrayResolver=e.KeyArrayResolverError=e.KeyResolver=e.ObjectMap=e.Intrinsic=e.IndexedAccessor=e.TypeClone=e.TypeExtends=e.TypeExtendsResult=e.TypeExtendsError=e.ExtendsUndefined=e.TypeGuard=e.TypeGuardUnknownTypeError=e.ValueGuard=e.FormatRegistry=e.TypeBoxError=e.TypeRegistry=e.PatternStringExact=e.PatternNumberExact=e.PatternBooleanExact=e.PatternString=e.PatternNumber=e.PatternBoolean=e.Kind=e.Hint=e.Optional=e.Readonly=e.Transform=void 0,e.Transform=Symbol.for("TypeBox.Transform"),e.Readonly=Symbol.for("TypeBox.Readonly"),e.Optional=Symbol.for("TypeBox.Optional"),e.Hint=Symbol.for("TypeBox.Hint"),e.Kind=Symbol.for("TypeBox.Kind"),e.PatternBoolean="(true|false)",e.PatternNumber="(0|[1-9][0-9]*)",e.PatternString="(.*)",e.PatternBooleanExact=`^${e.PatternBoolean}$`,e.PatternNumberExact=`^${e.PatternNumber}$`,e.PatternStringExact=`^${e.PatternString}$`;var t;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function P(){return w.clear()}p.Clear=P;function $(_){return w.delete(_)}p.Delete=$;function N(_){return w.has(_)}p.Has=N;function g(_,c){w.set(_,c)}p.Set=g;function O(_){return w.get(_)}p.Get=O})(t||(e.TypeRegistry=t={}));var r=class extends Error{constructor(p){super(p)}};e.TypeBoxError=r;var n;(function(p){let w=new Map;function A(){return new Map(w)}p.Entries=A;function P(){return w.clear()}p.Clear=P;function $(_){return w.delete(_)}p.Delete=$;function N(_){return w.has(_)}p.Has=N;function g(_,c){w.set(_,c)}p.Set=g;function O(_){return w.get(_)}p.Get=O})(n||(e.FormatRegistry=n={}));var i;(function(p){function w(v){return Array.isArray(v)}p.IsArray=w;function A(v){return typeof v=="bigint"}p.IsBigInt=A;function P(v){return typeof v=="boolean"}p.IsBoolean=P;function $(v){return v instanceof globalThis.Date}p.IsDate=$;function N(v){return v===null}p.IsNull=N;function g(v){return typeof v=="number"}p.IsNumber=g;function O(v){return typeof v=="object"&&v!==null}p.IsObject=O;function _(v){return typeof v=="string"}p.IsString=_;function c(v){return v instanceof globalThis.Uint8Array}p.IsUint8Array=c;function x(v){return v===void 0}p.IsUndefined=x})(i||(e.ValueGuard=i={}));var o=class extends r{};e.TypeGuardUnknownTypeError=o;var a;(function(p){function w(m){try{return new RegExp(m),!0}catch{return!1}}function A(m){if(!i.IsString(m))return!1;for(let Re=0;Re<m.length;Re++){let It=m.charCodeAt(Re);if(It>=7&&It<=13||It===27||It===127)return!1}return!0}function P(m){return g(m)||et(m)}function $(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 O(m){return i.IsUndefined(m)||i.IsString(m)}function _(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)&&w(m)}function c(m){return i.IsUndefined(m)||i.IsString(m)&&A(m)}function x(m){return i.IsUndefined(m)||et(m)}function v(m){return Oe(m,"Any")&&O(m.$id)}p.TAny=v;function b(m){return Oe(m,"Array")&&m.type==="array"&&O(m.$id)&&et(m.items)&&N(m.minItems)&&N(m.maxItems)&&g(m.uniqueItems)&&x(m.contains)&&N(m.minContains)&&N(m.maxContains)}p.TArray=b;function U(m){return Oe(m,"AsyncIterator")&&m.type==="AsyncIterator"&&O(m.$id)&&et(m.items)}p.TAsyncIterator=U;function J(m){return Oe(m,"BigInt")&&m.type==="bigint"&&O(m.$id)&&$(m.exclusiveMaximum)&&$(m.exclusiveMinimum)&&$(m.maximum)&&$(m.minimum)&&$(m.multipleOf)}p.TBigInt=J;function ie(m){return Oe(m,"Boolean")&&m.type==="boolean"&&O(m.$id)}p.TBoolean=ie;function oe(m){return Oe(m,"Constructor")&&m.type==="Constructor"&&O(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Re=>et(Re))&&et(m.returns)}p.TConstructor=oe;function Te(m){return Oe(m,"Date")&&m.type==="Date"&&O(m.$id)&&N(m.exclusiveMaximumTimestamp)&&N(m.exclusiveMinimumTimestamp)&&N(m.maximumTimestamp)&&N(m.minimumTimestamp)&&N(m.multipleOfTimestamp)}p.TDate=Te;function Se(m){return Oe(m,"Function")&&m.type==="Function"&&O(m.$id)&&i.IsArray(m.parameters)&&m.parameters.every(Re=>et(Re))&&et(m.returns)}p.TFunction=Se;function Ve(m){return Oe(m,"Integer")&&m.type==="integer"&&O(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}p.TInteger=Ve;function Je(m){return Oe(m,"Intersect")&&!(i.IsString(m.type)&&m.type!=="object")&&i.IsArray(m.allOf)&&m.allOf.every(Re=>et(Re)&&!Bi(Re))&&O(m.type)&&(g(m.unevaluatedProperties)||x(m.unevaluatedProperties))&&O(m.$id)}p.TIntersect=Je;function an(m){return Oe(m,"Iterator")&&m.type==="Iterator"&&O(m.$id)&&et(m.items)}p.TIterator=an;function Oe(m,Re){return Ur(m)&&m[e.Kind]===Re}p.TKindOf=Oe;function Ur(m){return i.IsObject(m)&&e.Kind in m&&i.IsString(m[e.Kind])}p.TKind=Ur;function sn(m){return C(m)&&i.IsString(m.const)}p.TLiteralString=sn;function S(m){return C(m)&&i.IsNumber(m.const)}p.TLiteralNumber=S;function ye(m){return C(m)&&i.IsBoolean(m.const)}p.TLiteralBoolean=ye;function C(m){return Oe(m,"Literal")&&O(m.$id)&&(i.IsBoolean(m.const)||i.IsNumber(m.const)||i.IsString(m.const))}p.TLiteral=C;function xe(m){return Oe(m,"Never")&&i.IsObject(m.not)&&Object.getOwnPropertyNames(m.not).length===0}p.TNever=xe;function se(m){return Oe(m,"Not")&&et(m.not)}p.TNot=se;function ge(m){return Oe(m,"Null")&&m.type==="null"&&O(m.$id)}p.TNull=ge;function De(m){return Oe(m,"Number")&&m.type==="number"&&O(m.$id)&&N(m.exclusiveMaximum)&&N(m.exclusiveMinimum)&&N(m.maximum)&&N(m.minimum)&&N(m.multipleOf)}p.TNumber=De;function He(m){return Oe(m,"Object")&&m.type==="object"&&O(m.$id)&&i.IsObject(m.properties)&&P(m.additionalProperties)&&N(m.minProperties)&&N(m.maxProperties)&&Object.entries(m.properties).every(([Re,It])=>A(Re)&&et(It))}p.TObject=He;function yt(m){return Oe(m,"Promise")&&m.type==="Promise"&&O(m.$id)&&et(m.item)}p.TPromise=yt;function ct(m){return Oe(m,"Record")&&m.type==="object"&&O(m.$id)&&P(m.additionalProperties)&&i.IsObject(m.patternProperties)&&(Re=>{let It=Object.getOwnPropertyNames(Re.patternProperties);return It.length===1&&w(It[0])&&i.IsObject(Re.patternProperties)&&et(Re.patternProperties[It[0]])})(m)}p.TRecord=ct;function mt(m){return i.IsObject(m)&&e.Hint in m&&m[e.Hint]==="Recursive"}p.TRecursive=mt;function Pr(m){return Oe(m,"Ref")&&O(m.$id)&&i.IsString(m.$ref)}p.TRef=Pr;function Gn(m){return Oe(m,"String")&&m.type==="string"&&O(m.$id)&&N(m.minLength)&&N(m.maxLength)&&_(m.pattern)&&c(m.format)}p.TString=Gn;function qn(m){return Oe(m,"Symbol")&&m.type==="symbol"&&O(m.$id)}p.TSymbol=qn;function un(m){return Oe(m,"TemplateLiteral")&&m.type==="string"&&i.IsString(m.pattern)&&m.pattern[0]==="^"&&m.pattern[m.pattern.length-1]==="$"}p.TTemplateLiteral=un;function Lo(m){return Oe(m,"This")&&O(m.$id)&&i.IsString(m.$ref)}p.TThis=Lo;function Bi(m){return i.IsObject(m)&&e.Transform in m}p.TTransform=Bi;function Ye(m){return Oe(m,"Tuple")&&m.type==="array"&&O(m.$id)&&i.IsNumber(m.minItems)&&i.IsNumber(m.maxItems)&&m.minItems===m.maxItems&&(i.IsUndefined(m.items)&&i.IsUndefined(m.additionalItems)&&m.minItems===0||i.IsArray(m.items)&&m.items.every(Re=>et(Re)))}p.TTuple=Ye;function Vo(m){return Oe(m,"Undefined")&&m.type==="undefined"&&O(m.$id)}p.TUndefined=Vo;function Ds(m){return ln(m)&&m.anyOf.every(Re=>sn(Re)||S(Re))}p.TUnionLiteral=Ds;function ln(m){return Oe(m,"Union")&&O(m.$id)&&i.IsObject(m)&&i.IsArray(m.anyOf)&&m.anyOf.every(Re=>et(Re))}p.TUnion=ln;function Wn(m){return Oe(m,"Uint8Array")&&m.type==="Uint8Array"&&O(m.$id)&&N(m.minByteLength)&&N(m.maxByteLength)}p.TUint8Array=Wn;function gt(m){return Oe(m,"Unknown")&&O(m.$id)}p.TUnknown=gt;function Fo(m){return Oe(m,"Unsafe")}p.TUnsafe=Fo;function Di(m){return Oe(m,"Void")&&m.type==="void"&&O(m.$id)}p.TVoid=Di;function Rs(m){return i.IsObject(m)&&m[e.Readonly]==="Readonly"}p.TReadonly=Rs;function Ms(m){return i.IsObject(m)&&m[e.Optional]==="Optional"}p.TOptional=Ms;function et(m){return i.IsObject(m)&&(v(m)||b(m)||ie(m)||J(m)||U(m)||oe(m)||Te(m)||Se(m)||Ve(m)||Je(m)||an(m)||C(m)||xe(m)||se(m)||ge(m)||De(m)||He(m)||yt(m)||ct(m)||Pr(m)||Gn(m)||qn(m)||un(m)||Lo(m)||Ye(m)||Vo(m)||ln(m)||Wn(m)||gt(m)||Fo(m)||Di(m)||Ur(m)&&t.Has(m[e.Kind]))}p.TSchema=et})(a||(e.TypeGuard=a={}));var s;(function(p){function w(A){return A[e.Kind]==="Intersect"?A.allOf.every(P=>w(P)):A[e.Kind]==="Union"?A.anyOf.some(P=>w(P)):A[e.Kind]==="Undefined"?!0:A[e.Kind]==="Not"?!w(A.not):!1}p.Check=w})(s||(e.ExtendsUndefined=s={}));var u=class extends r{};e.TypeExtendsError=u;var l;(function(p){p[p.Union=0]="Union",p[p.True=1]="True",p[p.False=2]="False"})(l||(e.TypeExtendsResult=l={}));var f;(function(p){function w(y){return y===l.False?y:l.True}function A(y){throw new u(y)}function P(y){return a.TNever(y)||a.TIntersect(y)||a.TUnion(y)||a.TUnknown(y)||a.TAny(y)}function $(y,h){return a.TNever(h)?Oe(y,h):a.TIntersect(h)?Se(y,h):a.TUnion(h)?Ls(y,h):a.TUnknown(h)?Tc(y,h):a.TAny(h)?N(y,h):A("StructuralRight")}function N(y,h){return l.True}function g(y,h){return a.TIntersect(h)?Se(y,h):a.TUnion(h)&&h.anyOf.some(je=>a.TAny(je)||a.TUnknown(je))?l.True:a.TUnion(h)?l.Union:a.TUnknown(h)||a.TAny(h)?l.True:l.Union}function O(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)&&un(h)?l.True:P(h)?$(y,h):a.TArray(h)?w(Me(y.items,h.items)):l.False}function c(y,h){return P(h)?$(y,h):a.TAsyncIterator(h)?w(Me(y.items,h.items)):l.False}function x(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(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)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(y,h):a.TBoolean(h)?l.True:l.False}function U(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TConstructor(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((je,br)=>w(Me(h.parameters[br],je))===l.True)?w(Me(y.returns,h.returns)):l.False:l.False}function J(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(y,h):a.TDate(h)?l.True:l.False}function ie(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TFunction(h)?y.parameters.length>h.parameters.length?l.False:y.parameters.every((je,br)=>w(Me(h.parameters[br],je))===l.True)?w(Me(y.returns,h.returns)):l.False:l.False}function oe(y,h){return a.TLiteral(y)&&i.IsNumber(y.const)||a.TNumber(y)||a.TInteger(y)?l.True:l.False}function Te(y,h){return a.TInteger(h)||a.TNumber(h)?l.True:P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(y,h):l.False}function Se(y,h){return h.allOf.every(je=>Me(y,je)===l.True)?l.True:l.False}function Ve(y,h){return y.allOf.some(je=>Me(je,h)===l.True)?l.True:l.False}function Je(y,h){return P(h)?$(y,h):a.TIterator(h)?w(Me(y.items,h.items)):l.False}function an(y,h){return a.TLiteral(h)&&h.const===y.const?l.True:P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(y,h):a.TString(h)?Di(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):l.False}function Oe(y,h){return l.False}function Ur(y,h){return l.True}function sn(y){let[h,je]=[y,0];for(;a.TNot(h);)h=h.not,je+=1;return je%2===0?h:e.Type.Unknown()}function S(y,h){return a.TNot(y)?Me(sn(y),h):a.TNot(h)?Me(y,sn(h)):A("Invalid fallthrough for Not")}function ye(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(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 xe(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(y,h):a.TInteger(h)||a.TNumber(h)?l.True:l.False}function se(y,h){return Object.getOwnPropertyNames(y.properties).length===h}function ge(y){return un(y)}function De(y){return se(y,0)||se(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 He(y){return se(y,0)}function yt(y){return se(y,0)}function ct(y){return se(y,0)}function mt(y){return se(y,0)}function Pr(y){return un(y)}function Gn(y){let h=e.Type.Number();return se(y,0)||se(y,1)&&"length"in y.properties&&w(Me(y.properties.length,h))===l.True}function qn(y){return se(y,0)}function un(y){let h=e.Type.Number();return se(y,0)||se(y,1)&&"length"in y.properties&&w(Me(y.properties.length,h))===l.True}function Lo(y){let h=e.Type.Function([e.Type.Any()],e.Type.Any());return se(y,0)||se(y,1)&&"then"in y.properties&&w(Me(y.properties.then,h))===l.True}function Bi(y,h){return Me(y,h)===l.False||a.TOptional(y)&&!a.TOptional(h)?l.False:l.True}function Ye(y,h){return a.TUnknown(y)?l.False:a.TAny(y)?l.Union:a.TNever(y)||a.TLiteralString(y)&&ge(h)||a.TLiteralNumber(y)&&He(h)||a.TLiteralBoolean(y)&&yt(h)||a.TSymbol(y)&&De(h)||a.TBigInt(y)&&ct(h)||a.TString(y)&&ge(h)||a.TSymbol(y)&&De(h)||a.TNumber(y)&&He(h)||a.TInteger(y)&&He(h)||a.TBoolean(y)&&yt(h)||a.TUint8Array(y)&&Pr(h)||a.TDate(y)&&mt(h)||a.TConstructor(y)&&qn(h)||a.TFunction(y)&&Gn(h)?l.True:a.TRecord(y)&&a.TString(ln(y))?h[e.Hint]==="Record"?l.True:l.False:a.TRecord(y)&&a.TNumber(ln(y))&&se(h,0)?l.True:l.False}function Vo(y,h){return P(h)?$(y,h):a.TRecord(h)?gt(y,h):a.TObject(h)?(()=>{for(let je of Object.getOwnPropertyNames(h.properties)){if(!(je in y.properties)&&!a.TOptional(h.properties[je]))return l.False;if(a.TOptional(h.properties[je]))return l.True;if(Bi(y.properties[je],h.properties[je])===l.False)return l.False}return l.True})():l.False}function Ds(y,h){return P(h)?$(y,h):a.TObject(h)&&Lo(h)?l.True:a.TPromise(h)?w(Me(y.item,h.item)):l.False}function ln(y){return e.PatternNumberExact in y.patternProperties?e.Type.Number():e.PatternStringExact in y.patternProperties?e.Type.String():A("Unknown record key pattern")}function Wn(y){return e.PatternNumberExact in y.patternProperties?y.patternProperties[e.PatternNumberExact]:e.PatternStringExact in y.patternProperties?y.patternProperties[e.PatternStringExact]:A("Unable to get record value schema")}function gt(y,h){let[je,br]=[ln(h),Wn(h)];return a.TLiteralString(y)&&a.TNumber(je)&&w(Me(y,br))===l.True?l.True:a.TUint8Array(y)&&a.TNumber(je)||a.TString(y)&&a.TNumber(je)||a.TArray(y)&&a.TNumber(je)?Me(y,br):a.TObject(y)?(()=>{for(let pg of Object.getOwnPropertyNames(y.properties))if(Bi(br,y.properties[pg])===l.False)return l.False;return l.True})():l.False}function Fo(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?Me(Wn(y),Wn(h)):l.False}function Di(y,h){return a.TLiteral(y)&&i.IsString(y.const)||a.TString(y)?l.True:l.False}function Rs(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(y,h):a.TString(h)?l.True:l.False}function Ms(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(y,h):a.TSymbol(h)?l.True:l.False}function et(y,h){return a.TTemplateLiteral(y)?Me(D.Resolve(y),h):a.TTemplateLiteral(h)?Me(y,D.Resolve(h)):A("Invalid fallthrough for TemplateLiteral")}function m(y,h){return a.TArray(h)&&y.items!==void 0&&y.items.every(je=>Me(je,h.items)===l.True)}function Re(y,h){return a.TNever(y)?l.True:a.TUnknown(y)?l.False:a.TAny(y)?l.Union:l.False}function It(y,h){return P(h)?$(y,h):a.TObject(h)&&un(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((je,br)=>Me(je,h.items[br])===l.True)?l.True:l.False:l.False}function ag(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(y,h):a.TUint8Array(h)?l.True:l.False}function sg(y,h){return P(h)?$(y,h):a.TObject(h)?Ye(y,h):a.TRecord(h)?gt(y,h):a.TVoid(h)?cg(y,h):a.TUndefined(h)?l.True:l.False}function Ls(y,h){return h.anyOf.some(je=>Me(y,je)===l.True)?l.True:l.False}function ug(y,h){return y.anyOf.every(je=>Me(je,h)===l.True)?l.True:l.False}function Tc(y,h){return l.True}function lg(y,h){return a.TNever(h)?Oe(y,h):a.TIntersect(h)?Se(y,h):a.TUnion(h)?Ls(y,h):a.TAny(h)?N(y,h):a.TString(h)?Di(y,h):a.TNumber(h)?C(y,h):a.TInteger(h)?oe(y,h):a.TBoolean(h)?v(y,h):a.TArray(h)?O(y,h):a.TTuple(h)?Re(y,h):a.TObject(h)?Ye(y,h):a.TUnknown(h)?l.True:l.False}function cg(y,h){return a.TUndefined(y)||a.TUndefined(y)?l.True:l.False}function fg(y,h){return a.TIntersect(h)?Se(y,h):a.TUnion(h)?Ls(y,h):a.TUnknown(h)?Tc(y,h):a.TAny(h)?N(y,h):a.TObject(h)?Ye(y,h):a.TVoid(h)?l.True:l.False}function Me(y,h){return a.TTemplateLiteral(y)||a.TTemplateLiteral(h)?et(y,h):a.TNot(y)||a.TNot(h)?S(y,h):a.TAny(y)?g(y,h):a.TArray(y)?_(y,h):a.TBigInt(y)?x(y,h):a.TBoolean(y)?b(y,h):a.TAsyncIterator(y)?c(y,h):a.TConstructor(y)?U(y,h):a.TDate(y)?J(y,h):a.TFunction(y)?ie(y,h):a.TInteger(y)?Te(y,h):a.TIntersect(y)?Ve(y,h):a.TIterator(y)?Je(y,h):a.TLiteral(y)?an(y,h):a.TNever(y)?Ur(y,h):a.TNull(y)?ye(y,h):a.TNumber(y)?xe(y,h):a.TObject(y)?Vo(y,h):a.TRecord(y)?Fo(y,h):a.TString(y)?Rs(y,h):a.TSymbol(y)?Ms(y,h):a.TTuple(y)?It(y,h):a.TPromise(y)?Ds(y,h):a.TUint8Array(y)?ag(y,h):a.TUndefined(y)?sg(y,h):a.TUnion(y)?ug(y,h):a.TUnknown(y)?lg(y,h):a.TVoid(y)?fg(y,h):A(`Unknown left type operand '${y[e.Kind]}'`)}function dg(y,h){return Me(y,h)}p.Extends=dg})(f||(e.TypeExtends=f={}));var d;(function(p){function w(_){return _.map(c=>N(c))}function A(_){return new Date(_.getTime())}function P(_){return new Uint8Array(_)}function $(_){let c=Object.getOwnPropertyNames(_).reduce((v,b)=>({...v,[b]:N(_[b])}),{}),x=Object.getOwnPropertySymbols(_).reduce((v,b)=>({...v,[b]:N(_[b])}),{});return{...c,...x}}function N(_){return i.IsArray(_)?w(_):i.IsDate(_)?A(_):i.IsUint8Array(_)?P(_):i.IsObject(_)?$(_):_}function g(_){return _.map(c=>O(c))}p.Rest=g;function O(_,c={}){return{...N(_),...c}}p.Type=O})(d||(e.TypeClone=d={}));var I;(function(p){function w(U){return U.map(J=>{let{[e.Optional]:ie,...oe}=d.Type(J);return oe})}function A(U){return U.every(J=>a.TOptional(J))}function P(U){return U.some(J=>a.TOptional(J))}function $(U){return A(U.allOf)?e.Type.Optional(e.Type.Intersect(w(U.allOf))):U}function N(U){return P(U.anyOf)?e.Type.Optional(e.Type.Union(w(U.anyOf))):U}function g(U){return U[e.Kind]==="Intersect"?$(U):U[e.Kind]==="Union"?N(U):U}function O(U,J){let ie=U.allOf.reduce((oe,Te)=>{let Se=v(Te,J);return Se[e.Kind]==="Never"?oe:[...oe,Se]},[]);return g(e.Type.Intersect(ie))}function _(U,J){let ie=U.anyOf.map(oe=>v(oe,J));return g(e.Type.Union(ie))}function c(U,J){let ie=U.properties[J];return i.IsUndefined(ie)?e.Type.Never():e.Type.Union([ie])}function x(U,J){let ie=U.items;if(i.IsUndefined(ie))return e.Type.Never();let oe=ie[J];return i.IsUndefined(oe)?e.Type.Never():oe}function v(U,J){return U[e.Kind]==="Intersect"?O(U,J):U[e.Kind]==="Union"?_(U,J):U[e.Kind]==="Object"?c(U,J):U[e.Kind]==="Tuple"?x(U,J):e.Type.Never()}function b(U,J,ie={}){let oe=J.map(Te=>v(U,Te.toString()));return g(e.Type.Union(oe,ie))}p.Resolve=b})(I||(e.IndexedAccessor=I={}));var E;(function(p){function w(x){let[v,b]=[x.slice(0,1),x.slice(1)];return`${v.toLowerCase()}${b}`}function A(x){let[v,b]=[x.slice(0,1),x.slice(1)];return`${v.toUpperCase()}${b}`}function P(x){return x.toUpperCase()}function $(x){return x.toLowerCase()}function N(x,v){let b=K.ParseExact(x.pattern);if(!j.Check(b))return{...x,pattern:g(x.pattern,v)};let U=[...z.Generate(b)].map(oe=>e.Type.Literal(oe)),J=O(U,v),ie=e.Type.Union(J);return e.Type.TemplateLiteral([ie])}function g(x,v){return typeof x=="string"?v==="Uncapitalize"?w(x):v==="Capitalize"?A(x):v==="Uppercase"?P(x):v==="Lowercase"?$(x):x:x.toString()}function O(x,v){if(x.length===0)return[];let[b,...U]=x;return[c(b,v),...O(U,v)]}function _(x,v){return a.TTemplateLiteral(x)?N(x,v):a.TUnion(x)?e.Type.Union(O(x.anyOf,v)):a.TLiteral(x)?e.Type.Literal(g(x.const,v)):x}function c(x,v){return _(x,v)}p.Map=c})(E||(e.Intrinsic=E={}));var T;(function(p){function w(g,O){return e.Type.Intersect(g.allOf.map(_=>$(_,O)),{...g})}function A(g,O){return e.Type.Union(g.anyOf.map(_=>$(_,O)),{...g})}function P(g,O){return O(g)}function $(g,O){return g[e.Kind]==="Intersect"?w(g,O):g[e.Kind]==="Union"?A(g,O):g[e.Kind]==="Object"?P(g,O):g}function N(g,O,_){return{...$(d.Type(g),O),..._}}p.Map=N})(T||(e.ObjectMap=T={}));var L;(function(p){function w(c){return c[0]==="^"&&c[c.length-1]==="$"?c.slice(1,c.length-1):c}function A(c,x){return c.allOf.reduce((v,b)=>[...v,...g(b,x)],[])}function P(c,x){let v=c.anyOf.map(b=>g(b,x));return[...v.reduce((b,U)=>U.map(J=>v.every(ie=>ie.includes(J))?b.add(J):b)[0],new Set)]}function $(c,x){return Object.getOwnPropertyNames(c.properties)}function N(c,x){return x.includePatterns?Object.getOwnPropertyNames(c.patternProperties):[]}function g(c,x){return a.TIntersect(c)?A(c,x):a.TUnion(c)?P(c,x):a.TObject(c)?$(c,x):a.TRecord(c)?N(c,x):[]}function O(c,x){return[...new Set(g(c,x))]}p.ResolveKeys=O;function _(c){return`^(${O(c,{includePatterns:!0}).map(x=>`(${w(x)})`).join("|")})$`}p.ResolvePattern=_})(L||(e.KeyResolver=L={}));var H=class extends r{};e.KeyArrayResolverError=H;var B;(function(p){function w(A){return Array.isArray(A)?A:a.TUnionLiteral(A)?A.anyOf.map(P=>P.const.toString()):a.TLiteral(A)?[A.const]:a.TTemplateLiteral(A)?(()=>{let P=K.ParseExact(A.pattern);if(!j.Check(P))throw new H("Cannot resolve keys from infinite template expression");return[...z.Generate(P)]})():[]}p.Resolve=w})(B||(e.KeyArrayResolver=B={}));var k;(function(p){function*w(P){for(let $ of P.anyOf)$[e.Kind]==="Union"?yield*w($):yield $}function A(P){return e.Type.Union([...w(P)],{...P})}p.Resolve=A})(k||(e.UnionResolver=k={}));var F=class extends r{};e.TemplateLiteralPatternError=F;var G;(function(p){function w(N){throw new F(N)}function A(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(O=>P(O,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}${A(N.const.toString())}`:a.TBoolean(N)?`${g}${e.PatternBoolean}`:w(`Unexpected Kind '${N[e.Kind]}'`)}function $(N){return`^${N.map(g=>P(g,"")).join("")}$`}p.Create=$})(G||(e.TemplateLiteralPattern=G={}));var D;(function(p){function w(A){let P=K.ParseExact(A.pattern);if(!j.Check(P))return e.Type.String();let $=[...z.Generate(P)].map(N=>e.Type.Literal(N));return e.Type.Union($)}p.Resolve=w})(D||(e.TemplateLiteralResolver=D={}));var Q=class extends r{};e.TemplateLiteralParserError=Q;var K;(function(p){function w(U,J,ie){return U[J]===ie&&U.charCodeAt(J-1)!==92}function A(U,J){return w(U,J,"(")}function P(U,J){return w(U,J,")")}function $(U,J){return w(U,J,"|")}function N(U){if(!(A(U,0)&&P(U,U.length-1)))return!1;let J=0;for(let ie=0;ie<U.length;ie++)if(A(U,ie)&&(J+=1),P(U,ie)&&(J-=1),J===0&&ie!==U.length-1)return!1;return!0}function g(U){return U.slice(1,U.length-1)}function O(U){let J=0;for(let ie=0;ie<U.length;ie++)if(A(U,ie)&&(J+=1),P(U,ie)&&(J-=1),$(U,ie)&&J===0)return!0;return!1}function _(U){for(let J=0;J<U.length;J++)if(A(U,J))return!0;return!1}function c(U){let[J,ie]=[0,0],oe=[];for(let Se=0;Se<U.length;Se++)if(A(U,Se)&&(J+=1),P(U,Se)&&(J-=1),$(U,Se)&&J===0){let Ve=U.slice(ie,Se);Ve.length>0&&oe.push(v(Ve)),ie=Se+1}let Te=U.slice(ie);return Te.length>0&&oe.push(v(Te)),oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"or",expr:oe}}function x(U){function J(Te,Se){if(!A(Te,Se))throw new Q("TemplateLiteralParser: Index must point to open parens");let Ve=0;for(let Je=Se;Je<Te.length;Je++)if(A(Te,Je)&&(Ve+=1),P(Te,Je)&&(Ve-=1),Ve===0)return[Se,Je];throw new Q("TemplateLiteralParser: Unclosed group parens in expression")}function ie(Te,Se){for(let Ve=Se;Ve<Te.length;Ve++)if(A(Te,Ve))return[Se,Ve];return[Se,Te.length]}let oe=[];for(let Te=0;Te<U.length;Te++)if(A(U,Te)){let[Se,Ve]=J(U,Te),Je=U.slice(Se,Ve+1);oe.push(v(Je)),Te=Ve}else{let[Se,Ve]=ie(U,Te),Je=U.slice(Se,Ve);Je.length>0&&oe.push(v(Je)),Te=Ve-1}return oe.length===0?{type:"const",const:""}:oe.length===1?oe[0]:{type:"and",expr:oe}}function v(U){return N(U)?v(g(U)):O(U)?c(U):_(U)?x(U):{type:"const",const:U}}p.Parse=v;function b(U){return v(U.slice(1,U.length-1))}p.ParseExact=b})(K||(e.TemplateLiteralParser=K={}));var re=class extends r{};e.TemplateLiteralFiniteError=re;var j;(function(p){function w(g){throw new re(g)}function A(g){return g.type==="or"&&g.expr.length===2&&g.expr[0].type==="const"&&g.expr[0].const==="0"&&g.expr[1].type==="const"&&g.expr[1].const==="[1-9][0-9]*"}function 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 $(g){return g.type==="const"&&g.const===".*"}function N(g){return P(g)?!0:A(g)||$(g)?!1:g.type==="and"?g.expr.every(O=>N(O)):g.type==="or"?g.expr.every(O=>N(O)):g.type==="const"?!0:w("Unknown expression type")}p.Check=N})(j||(e.TemplateLiteralFinite=j={}));var R=class extends r{};e.TemplateLiteralGeneratorError=R;var z;(function(p){function*w(g){if(g.length===1)return yield*g[0];for(let O of g[0])for(let _ of w(g.slice(1)))yield`${O}${_}`}function*A(g){return yield*w(g.expr.map(O=>[...N(O)]))}function*P(g){for(let O of g.expr)yield*N(O)}function*$(g){return yield g.const}function*N(g){return g.type==="and"?yield*A(g):g.type==="or"?yield*P(g):g.type==="const"?yield*$(g):(()=>{throw new R("Unknown expression")})()}p.Generate=N})(z||(e.TemplateLiteralGenerator=z={}));var ne;(function(p){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 O=g.split("|").map(_=>e.Type.Literal(_.trim()));return O.length===0?e.Type.Never():O.length===1?O[0]:e.Type.Union(O)})()}function*A(N){if(N[1]!=="{"){let g=e.Type.Literal("$"),O=P(N.slice(1));return yield*[g,...O]}for(let g=2;g<N.length;g++)if(N[g]==="}"){let O=w(N.slice(2,g)),_=P(N.slice(g+1));return yield*[...O,..._]}yield e.Type.Literal(N)}function*P(N){for(let g=0;g<N.length;g++)if(N[g]==="$"){let O=e.Type.Literal(N.slice(0,g)),_=A(N.slice(g));return yield*[O,..._]}yield e.Type.Literal(N)}function $(N){return[...P(N)]}p.Parse=$})(ne||(e.TemplateLiteralDslParser=ne={}));var ue=class{constructor(p){this.schema=p}Decode(p){return new te(this.schema,p)}};e.TransformDecodeBuilder=ue;var te=class{constructor(p,w){this.schema=p,this.decode=w}Encode(p){let w=d.Type(this.schema);return a.TTransform(w)?(()=>{let A={Encode:P=>w[e.Transform].Encode(p(P)),Decode:P=>this.decode(w[e.Transform].Decode(P))};return{...w,[e.Transform]:A}})():(()=>{let A={Decode:this.decode,Encode:p};return{...w,[e.Transform]:A}})()}};e.TransformEncodeBuilder=te;var fe=0,V=class extends r{};e.TypeBuilderError=V;var X=class{Create(p){return p}Throw(p){throw new V(p)}Discard(p,w){return w.reduce((A,P)=>{let{[P]:$,...N}=A;return N},p)}Strict(p){return JSON.parse(JSON.stringify(p))}};e.TypeBuilder=X;var ee=class extends X{ReadonlyOptional(p){return this.Readonly(this.Optional(p))}Readonly(p){return{...d.Type(p),[e.Readonly]:"Readonly"}}Optional(p){return{...d.Type(p),[e.Optional]:"Optional"}}Any(p={}){return this.Create({...p,[e.Kind]:"Any"})}Array(p,w={}){return this.Create({...w,[e.Kind]:"Array",type:"array",items:d.Type(p)})}Boolean(p={}){return this.Create({...p,[e.Kind]:"Boolean",type:"boolean"})}Capitalize(p,w={}){return{...E.Map(d.Type(p),"Capitalize"),...w}}Composite(p,w){let A=e.Type.Intersect(p,{}),P=L.ResolveKeys(A,{includePatterns:!1}).reduce(($,N)=>({...$,[N]:e.Type.Index(A,[N])}),{});return e.Type.Object(P,w)}Enum(p,w={}){if(i.IsUndefined(p))return this.Throw("Enum undefined or empty");let A=Object.getOwnPropertyNames(p).filter($=>isNaN($)).map($=>p[$]),P=[...new Set(A)].map($=>e.Type.Literal($));return this.Union(P,{...w,[e.Hint]:"Enum"})}Extends(p,w,A,P,$={}){switch(f.Extends(p,w)){case l.Union:return this.Union([d.Type(A,$),d.Type(P,$)]);case l.True:return d.Type(A,$);case l.False:return d.Type(P,$)}}Exclude(p,w,A={}){return a.TTemplateLiteral(p)?this.Exclude(D.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Exclude(p,D.Resolve(w),A):a.TUnion(p)?(()=>{let P=p.anyOf.filter($=>f.Extends($,w)===l.False);return P.length===1?d.Type(P[0],A):this.Union(P,A)})():f.Extends(p,w)!==l.False?this.Never(A):d.Type(p,A)}Extract(p,w,A={}){return a.TTemplateLiteral(p)?this.Extract(D.Resolve(p),w,A):a.TTemplateLiteral(w)?this.Extract(p,D.Resolve(w),A):a.TUnion(p)?(()=>{let P=p.anyOf.filter($=>f.Extends($,w)!==l.False);return P.length===1?d.Type(P[0],A):this.Union(P,A)})():f.Extends(p,w)!==l.False?d.Type(p,A):this.Never(A)}Index(p,w,A={}){return a.TArray(p)&&a.TNumber(w)?d.Type(p.items,A):a.TTuple(p)&&a.TNumber(w)?(()=>{let P=(i.IsUndefined(p.items)?[]:p.items).map($=>d.Type($));return this.Union(P,A)})():(()=>{let P=B.Resolve(w),$=d.Type(p);return I.Resolve($,P,A)})()}Integer(p={}){return this.Create({...p,[e.Kind]:"Integer",type:"integer"})}Intersect(p,w={}){if(p.length===0)return e.Type.Never();if(p.length===1)return d.Type(p[0],w);p.some(N=>a.TTransform(N))&&this.Throw("Cannot intersect transform types");let A=p.every(N=>a.TObject(N)),P=d.Rest(p),$=a.TSchema(w.unevaluatedProperties)?{unevaluatedProperties:d.Type(w.unevaluatedProperties)}:{};return w.unevaluatedProperties===!1||a.TSchema(w.unevaluatedProperties)||A?this.Create({...w,...$,[e.Kind]:"Intersect",type:"object",allOf:P}):this.Create({...w,...$,[e.Kind]:"Intersect",allOf:P})}KeyOf(p,w={}){return a.TRecord(p)?(()=>{let A=Object.getOwnPropertyNames(p.patternProperties)[0];return A===e.PatternNumberExact?this.Number(w):A===e.PatternStringExact?this.String(w):this.Throw("Unable to resolve key type from Record key pattern")})():a.TTuple(p)?(()=>{let A=(i.IsUndefined(p.items)?[]:p.items).map((P,$)=>e.Type.Literal($.toString()));return this.Union(A,w)})():a.TArray(p)?this.Number(w):(()=>{let A=L.ResolveKeys(p,{includePatterns:!1});if(A.length===0)return this.Never(w);let P=A.map($=>this.Literal($));return this.Union(P,w)})()}Literal(p,w={}){return this.Create({...w,[e.Kind]:"Literal",const:p,type:typeof p})}Lowercase(p,w={}){return{...E.Map(d.Type(p),"Lowercase"),...w}}Never(p={}){return this.Create({...p,[e.Kind]:"Never",not:{}})}Not(p,w){return this.Create({...w,[e.Kind]:"Not",not:d.Type(p)})}Null(p={}){return this.Create({...p,[e.Kind]:"Null",type:"null"})}Number(p={}){return this.Create({...p,[e.Kind]:"Number",type:"number"})}Object(p,w={}){let A=Object.getOwnPropertyNames(p),P=A.filter(O=>a.TOptional(p[O])),$=A.filter(O=>!P.includes(O)),N=a.TSchema(w.additionalProperties)?{additionalProperties:d.Type(w.additionalProperties)}:{},g=A.reduce((O,_)=>({...O,[_]:d.Type(p[_])}),{});return $.length>0?this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g,required:$}):this.Create({...w,...N,[e.Kind]:"Object",type:"object",properties:g})}Omit(p,w,A={}){let P=B.Resolve(w);return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),$=>{i.IsArray($.required)&&($.required=$.required.filter(N=>!P.includes(N)),$.required.length===0&&delete $.required);for(let N of Object.getOwnPropertyNames($.properties))P.includes(N)&&delete $.properties[N];return this.Create($)},A)}Partial(p,w={}){return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let P=Object.getOwnPropertyNames(A.properties).reduce(($,N)=>({...$,[N]:this.Optional(A.properties[N])}),{});return this.Object(P,this.Discard(A,["required"]))},w)}Pick(p,w,A={}){let P=B.Resolve(w);return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),$=>{i.IsArray($.required)&&($.required=$.required.filter(N=>P.includes(N)),$.required.length===0&&delete $.required);for(let N of Object.getOwnPropertyNames($.properties))P.includes(N)||delete $.properties[N];return this.Create($)},A)}Record(p,w,A={}){return a.TTemplateLiteral(p)?(()=>{let P=K.ParseExact(p.pattern);return j.Check(P)?this.Object([...z.Generate(P)].reduce(($,N)=>({...$,[N]:d.Type(w)}),{}),A):this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[p.pattern]:d.Type(w)}})})():a.TUnion(p)?(()=>{let P=k.Resolve(p);if(a.TUnionLiteral(P)){let $=P.anyOf.reduce((N,g)=>({...N,[g.const]:d.Type(w)}),{});return this.Object($,{...A,[e.Hint]:"Record"})}else this.Throw("Record key of type union contains non-literal types")})():a.TLiteral(p)?i.IsString(p.const)||i.IsNumber(p.const)?this.Object({[p.const]:d.Type(w)},A):this.Throw("Record key of type literal is not of type string or number"):a.TInteger(p)||a.TNumber(p)?this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[e.PatternNumberExact]:d.Type(w)}}):a.TString(p)?(()=>{let P=i.IsUndefined(p.pattern)?e.PatternStringExact:p.pattern;return this.Create({...A,[e.Kind]:"Record",type:"object",patternProperties:{[P]:d.Type(w)}})})():this.Never()}Recursive(p,w={}){i.IsUndefined(w.$id)&&(w.$id=`T${fe++}`);let A=p({[e.Kind]:"This",$ref:`${w.$id}`});return A.$id=w.$id,this.Create({...w,[e.Hint]:"Recursive",...A})}Ref(p,w={}){return i.IsString(p)?this.Create({...w,[e.Kind]:"Ref",$ref:p}):(i.IsUndefined(p.$id)&&this.Throw("Reference target type must specify an $id"),this.Create({...w,[e.Kind]:"Ref",$ref:p.$id}))}Required(p,w={}){return T.Map(this.Discard(d.Type(p),["$id",e.Transform]),A=>{let P=Object.getOwnPropertyNames(A.properties).reduce(($,N)=>({...$,[N]:this.Discard(A.properties[N],[e.Optional])}),{});return this.Object(P,A)},w)}Rest(p){return a.TTuple(p)&&!i.IsUndefined(p.items)?d.Rest(p.items):a.TIntersect(p)?d.Rest(p.allOf):a.TUnion(p)?d.Rest(p.anyOf):[]}String(p={}){return this.Create({...p,[e.Kind]:"String",type:"string"})}TemplateLiteral(p,w={}){let A=i.IsString(p)?G.Create(ne.Parse(p)):G.Create(p);return this.Create({...w,[e.Kind]:"TemplateLiteral",type:"string",pattern:A})}Transform(p){return new ue(p)}Tuple(p,w={}){let[A,P,$]=[!1,p.length,p.length],N=d.Rest(p),g=p.length>0?{...w,[e.Kind]:"Tuple",type:"array",items:N,additionalItems:A,minItems:P,maxItems:$}:{...w,[e.Kind]:"Tuple",type:"array",minItems:P,maxItems:$};return this.Create(g)}Uncapitalize(p,w={}){return{...E.Map(d.Type(p),"Uncapitalize"),...w}}Union(p,w={}){return a.TTemplateLiteral(p)?D.Resolve(p):(()=>{let A=p;if(A.length===0)return this.Never(w);if(A.length===1)return this.Create(d.Type(A[0],w));let P=d.Rest(A);return this.Create({...w,[e.Kind]:"Union",anyOf:P})})()}Unknown(p={}){return this.Create({...p,[e.Kind]:"Unknown"})}Unsafe(p={}){return this.Create({...p,[e.Kind]:p[e.Kind]||"Unsafe"})}Uppercase(p,w={}){return{...E.Map(d.Type(p),"Uppercase"),...w}}};e.JsonTypeBuilder=ee;var be=class extends ee{AsyncIterator(p,w={}){return this.Create({...w,[e.Kind]:"AsyncIterator",type:"AsyncIterator",items:d.Type(p)})}Awaited(p,w={}){let A=P=>P.length>0?(()=>{let[$,...N]=P;return[this.Awaited($),...A(N)]})():P;return a.TIntersect(p)?e.Type.Intersect(A(p.allOf)):a.TUnion(p)?e.Type.Union(A(p.anyOf)):a.TPromise(p)?this.Awaited(p.item):d.Type(p,w)}BigInt(p={}){return this.Create({...p,[e.Kind]:"BigInt",type:"bigint"})}ConstructorParameters(p,w={}){return this.Tuple([...p.parameters],{...w})}Constructor(p,w,A){let[P,$]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Constructor",type:"Constructor",parameters:P,returns:$})}Date(p={}){return this.Create({...p,[e.Kind]:"Date",type:"Date"})}Function(p,w,A){let[P,$]=[d.Rest(p),d.Type(w)];return this.Create({...A,[e.Kind]:"Function",type:"Function",parameters:P,returns:$})}InstanceType(p,w={}){return d.Type(p.returns,w)}Iterator(p,w={}){return this.Create({...w,[e.Kind]:"Iterator",type:"Iterator",items:d.Type(p)})}Parameters(p,w={}){return this.Tuple(p.parameters,{...w})}Promise(p,w={}){return this.Create({...w,[e.Kind]:"Promise",type:"Promise",item:d.Type(p)})}RegExp(p,w={}){let A=i.IsString(p)?p:p.source;return this.Create({...w,[e.Kind]:"String",type:"string",pattern:A})}RegEx(p,w={}){return this.RegExp(p,w)}ReturnType(p,w={}){return d.Type(p.returns,w)}Symbol(p){return this.Create({...p,[e.Kind]:"Symbol",type:"symbol"})}Undefined(p={}){return this.Create({...p,[e.Kind]:"Undefined",type:"undefined"})}Uint8Array(p={}){return this.Create({...p,[e.Kind]:"Uint8Array",type:"Uint8Array"})}Void(p={}){return this.Create({...p,[e.Kind]:"Void",type:"void"})}};e.JavaScriptTypeBuilder=be,e.JsonType=new ee,e.Type=new be}}),Ti=$r(on(),1),{String:zw,Optional:Kw,Boolean:Gw,Object:qw,Number:Ww}=Ti.Type,Jw=zw.bind(Ti.Type),Hw=Ww.bind(Ti.Type),zN=qw.bind(Ti.Type),KN=Kw.bind(Ti.Type),Xw=Gw.bind(Ti.Type),GN=Jw(),qN=Hw(),WN=Xw();function ja(e){return Array.isArray(e)?e:[e]}var Qw=rt({"../../../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}}),Zw=rt({"../../../node_modules/.pnpm/fast-json-stable-stringify@2.1.0/node_modules/fast-json-stable-stringify/index.js"(e,t){"use strict";t.exports=function(r,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var i=typeof n.cycles=="boolean"?n.cycles:!1,o=n.cmp&&function(s){return function(u){return function(l,f){var d={key:l,value:u[l]},I={key:f,value:u[f]};return s(d,I)}}}(n.cmp),a=[];return function s(u){if(u&&u.toJSON&&typeof u.toJSON=="function"&&(u=u.toJSON()),u!==void 0){if(typeof u=="number")return isFinite(u)?""+u:"null";if(typeof u!="object")return JSON.stringify(u);var l,f;if(Array.isArray(u)){for(f="[",l=0;l<u.length;l++)l&&(f+=","),f+=s(u[l])||"null";return f+"]"}if(u===null)return"null";if(a.indexOf(u)!==-1){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var d=a.push(u)-1,I=Object.keys(u).sort(o&&o(u));for(f="",l=0;l<I.length;l++){var E=I[l],T=s(u[E]);T&&(f&&(f+=","),f+=JSON.stringify(E)+":"+T)}return a.splice(d,1),"{"+f+"}"}}(r)}}}),Yw=rt({"../../../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=B();n.configure=B,n.stringify=n,n.default=n,e.stringify=n,e.configure=B,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 D=k[G],Q=G;for(;Q!==0&&k[Q-1]>D;)k[Q]=k[Q-1],Q--;k[Q]=D}return k}var s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function u(k){return s.call(k)!==void 0&&k.length!==0}function l(k,F,G){k.length<G&&(G=k.length);let D=F===","?"":" ",Q=`"0":${D}${k[0]}`;for(let K=1;K<G;K++)Q+=`${F}"${K}":${D}${k[K]}`;return Q}function f(k){if(r.call(k,"circularValue")){let F=k.circularValue;if(typeof F=="string")return`"${F}"`;if(F==null)return F;if(F===Error||F===TypeError)return{toString(){throw new TypeError("Converting circular structure to JSON")}};throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function d(k){let F;if(r.call(k,"deterministic")&&(F=k.deterministic,typeof F!="boolean"&&typeof F!="function"))throw new TypeError('The "deterministic" argument must be of type boolean or comparator function');return F===void 0?!0:F}function I(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 E(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 D=`Object can not safely be stringified. Received type ${typeof G}`;throw typeof G!="function"&&(D+=` (${G.toString()})`),new Error(D)}}}function B(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),D=I(k,"bigint"),Q=d(k),K=typeof Q=="function"?Q:void 0,re=E(k,"maximumDepth"),j=E(k,"maximumBreadth");function R(fe,V,X,ee,be,p){let w=V[fe];switch(typeof w=="object"&&w!==null&&typeof w.toJSON=="function"&&(w=w.toJSON(fe)),w=ee.call(V,fe,w),typeof w){case"string":return o(w);case"object":{if(w===null)return"null";if(X.indexOf(w)!==-1)return G;let A="",P=",",$=p;if(Array.isArray(w)){if(w.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(w),be!==""&&(p+=be,A+=`
|
|
31
|
-
${p}`,P=`,
|
|
32
|
-
${p}`);let x=Math.min(w.length,j),v=0;for(;v<x-1;v++){let U=R(String(v),w,X,ee,be,p);A+=U!==void 0?U:"null",A+=P}let b=R(String(v),w,X,ee,be,p);if(A+=b!==void 0?b:"null",w.length-1>j){let U=w.length-j-1;A+=`${P}"... ${T(U)} not stringified"`}return be!==""&&(A+=`
|
|
33
|
-
${$}`),X.pop(),`[${A}]`}let N=Object.keys(w),g=N.length;if(g===0)return"{}";if(re<X.length+1)return'"[Object]"';let O="",_="";be!==""&&(p+=be,P=`,
|
|
34
|
-
${p}`,O=" ");let c=Math.min(g,j);Q&&!u(w)&&(N=a(N,K)),X.push(w);for(let x=0;x<c;x++){let v=N[x],b=R(v,w,X,ee,be,p);b!==void 0&&(A+=`${_}${o(v)}:${O}${b}`,_=P)}if(g>j){let x=g-j;A+=`${_}"...":${O}"${T(x)} not stringified"`,_=P}return be!==""&&_.length>1&&(A=`
|
|
35
|
-
${p}${A}
|
|
36
|
-
${$}`),X.pop(),`{${A}}`}case"number":return isFinite(w)?String(w):F?F(w):"null";case"boolean":return w===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(w);default:return F?F(w):void 0}}function z(fe,V,X,ee,be,p){switch(typeof V=="object"&&V!==null&&typeof V.toJSON=="function"&&(V=V.toJSON(fe)),typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(X.indexOf(V)!==-1)return G;let w=p,A="",P=",";if(Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V),be!==""&&(p+=be,A+=`
|
|
37
|
-
${p}`,P=`,
|
|
38
|
-
${p}`);let g=Math.min(V.length,j),O=0;for(;O<g-1;O++){let c=z(String(O),V[O],X,ee,be,p);A+=c!==void 0?c:"null",A+=P}let _=z(String(O),V[O],X,ee,be,p);if(A+=_!==void 0?_:"null",V.length-1>j){let c=V.length-j-1;A+=`${P}"... ${T(c)} not stringified"`}return be!==""&&(A+=`
|
|
39
|
-
${w}`),X.pop(),`[${A}]`}X.push(V);let $="";be!==""&&(p+=be,P=`,
|
|
40
|
-
${p}`,$=" ");let N="";for(let g of ee){let O=z(g,V[g],X,ee,be,p);O!==void 0&&(A+=`${N}${o(g)}:${$}${O}`,N=P)}return be!==""&&N.length>1&&(A=`
|
|
41
|
-
${p}${A}
|
|
42
|
-
${w}`),X.pop(),`{${A}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(V);default:return F?F(V):void 0}}function ne(fe,V,X,ee,be){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(fe),typeof V!="object")return ne(fe,V,X,ee,be);if(V===null)return"null"}if(X.indexOf(V)!==-1)return G;let p=be;if(Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V),be+=ee;let O=`
|
|
43
|
-
${be}`,_=`,
|
|
44
|
-
${be}`,c=Math.min(V.length,j),x=0;for(;x<c-1;x++){let b=ne(String(x),V[x],X,ee,be);O+=b!==void 0?b:"null",O+=_}let v=ne(String(x),V[x],X,ee,be);if(O+=v!==void 0?v:"null",V.length-1>j){let b=V.length-j-1;O+=`${_}"... ${T(b)} not stringified"`}return O+=`
|
|
45
|
-
${p}`,X.pop(),`[${O}]`}let w=Object.keys(V),A=w.length;if(A===0)return"{}";if(re<X.length+1)return'"[Object]"';be+=ee;let P=`,
|
|
46
|
-
${be}`,$="",N="",g=Math.min(A,j);u(V)&&($+=l(V,P,j),w=w.slice(V.length),g-=V.length,N=P),Q&&(w=a(w,K)),X.push(V);for(let O=0;O<g;O++){let _=w[O],c=ne(_,V[_],X,ee,be);c!==void 0&&($+=`${N}${o(_)}: ${c}`,N=P)}if(A>j){let O=A-j;$+=`${N}"...": "${T(O)} not stringified"`,N=P}return N!==""&&($=`
|
|
47
|
-
${be}${$}
|
|
48
|
-
${p}`),X.pop(),`{${$}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(V);default:return F?F(V):void 0}}function ue(fe,V,X){switch(typeof V){case"string":return o(V);case"object":{if(V===null)return"null";if(typeof V.toJSON=="function"){if(V=V.toJSON(fe),typeof V!="object")return ue(fe,V,X);if(V===null)return"null"}if(X.indexOf(V)!==-1)return G;let ee="",be=V.length!==void 0;if(be&&Array.isArray(V)){if(V.length===0)return"[]";if(re<X.length+1)return'"[Array]"';X.push(V);let $=Math.min(V.length,j),N=0;for(;N<$-1;N++){let O=ue(String(N),V[N],X);ee+=O!==void 0?O:"null",ee+=","}let g=ue(String(N),V[N],X);if(ee+=g!==void 0?g:"null",V.length-1>j){let O=V.length-j-1;ee+=`,"... ${T(O)} not stringified"`}return X.pop(),`[${ee}]`}let p=Object.keys(V),w=p.length;if(w===0)return"{}";if(re<X.length+1)return'"[Object]"';let A="",P=Math.min(w,j);be&&u(V)&&(ee+=l(V,",",j),p=p.slice(V.length),P-=V.length,A=","),Q&&(p=a(p,K)),X.push(V);for(let $=0;$<P;$++){let N=p[$],g=ue(N,V[N],X);g!==void 0&&(ee+=`${A}${o(N)}:${g}`,A=",")}if(w>j){let $=w-j;ee+=`${A}"...":"${T($)} not stringified"`}return X.pop(),`{${ee}}`}case"number":return isFinite(V)?String(V):F?F(V):"null";case"boolean":return V===!0?"true":"false";case"undefined":return;case"bigint":if(D)return String(V);default:return F?F(V):void 0}}function te(fe,V,X){if(arguments.length>1){let ee="";if(typeof X=="number"?ee=" ".repeat(Math.min(X,10)):typeof X=="string"&&(ee=X.slice(0,10)),V!=null){if(typeof V=="function")return R("",{"":fe},[],V,ee,"");if(Array.isArray(V))return z("",fe,[],L(V),ee,"")}if(ee.length!==0)return ne("",fe,[],ee,"")}return ue("",fe,[])}return te}}}),Ei=rt({"../../../node_modules/.pnpm/@sinclair+typebox@0.31.28/node_modules/@sinclair/typebox/value/guard.js"(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IsValueType=e.IsSymbol=e.IsFunction=e.IsString=e.IsBigInt=e.IsInteger=e.IsNumber=e.IsBoolean=e.IsNull=e.IsUndefined=e.IsArray=e.IsObject=e.IsPlainObject=e.HasPropertyKey=e.IsDate=e.IsUint8Array=e.IsPromise=e.IsTypedArray=e.IsIterator=e.IsAsyncIterator=void 0;function t(D){return l(D)&&Symbol.asyncIterator in D}e.IsAsyncIterator=t;function r(D){return l(D)&&Symbol.iterator in D}e.IsIterator=r;function n(D){return ArrayBuffer.isView(D)}e.IsTypedArray=n;function i(D){return D instanceof Promise}e.IsPromise=i;function o(D){return D instanceof Uint8Array}e.IsUint8Array=o;function a(D){return D instanceof Date&&Number.isFinite(D.getTime())}e.IsDate=a;function s(D,Q){return Q in D}e.HasPropertyKey=s;function u(D){return l(D)&&k(D.constructor)&&D.constructor.name==="Object"}e.IsPlainObject=u;function l(D){return D!==null&&typeof D=="object"}e.IsObject=l;function f(D){return Array.isArray(D)&&!ArrayBuffer.isView(D)}e.IsArray=f;function d(D){return D===void 0}e.IsUndefined=d;function I(D){return D===null}e.IsNull=I;function E(D){return typeof D=="boolean"}e.IsBoolean=E;function T(D){return typeof D=="number"}e.IsNumber=T;function L(D){return T(D)&&Number.isInteger(D)}e.IsInteger=L;function H(D){return typeof D=="bigint"}e.IsBigInt=H;function B(D){return typeof D=="string"}e.IsString=B;function k(D){return typeof D=="function"}e.IsFunction=k;function F(D){return typeof D=="symbol"}e.IsSymbol=F;function G(D){return H(D)||E(D)||I(D)||T(D)||B(D)||F(D)||d(D)}e.IsValueType=G}}),th=rt({"../../../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=Ei(),r=ms(),n=on(),i=class extends n.TypeBoxError{constructor(f){super(`Duplicate type kind '${f}' detected`)}};e.TypeSystemDuplicateTypeKind=i;var o=class extends n.TypeBoxError{constructor(f){super(`Duplicate string format '${f}' detected`)}};e.TypeSystemDuplicateFormat=o;var a;(function(f){function d(E,T){if(n.TypeRegistry.Has(E))throw new i(E);return n.TypeRegistry.Set(E,T),(L={})=>n.Type.Unsafe({...L,[n.Kind]:E})}f.Type=d;function I(E,T){if(n.FormatRegistry.Has(E))throw new o(E);return n.FormatRegistry.Set(E,T),E}f.Format=I})(a||(e.TypeSystem=a={}));var s;(function(f){let d=l;function I(){d=l}f.Reset=I;function E(L){d=L}f.Set=E;function T(){return d}f.Get=T})(s||(e.TypeSystemErrorFunction=s={}));var u;(function(f){f.ExactOptionalPropertyTypes=!1,f.AllowArrayObject=!1,f.AllowNaN=!1,f.AllowNullVoid=!1;function d(H,B){return f.ExactOptionalPropertyTypes?B in H:H[B]!==void 0}f.IsExactOptionalProperty=d;function I(H){let B=(0,t.IsObject)(H);return f.AllowArrayObject?B:B&&!(0,t.IsArray)(H)}f.IsObjectLike=I;function E(H){return I(H)&&!(H instanceof Date)&&!(H instanceof Uint8Array)}f.IsRecordLike=E;function T(H){let B=(0,t.IsNumber)(H);return f.AllowNaN?B:B&&Number.isFinite(H)}f.IsNumberLike=T;function L(H){let B=(0,t.IsUndefined)(H);return f.AllowNullVoid?B||H===null:B}f.IsVoidLike=L})(u||(e.TypeSystemPolicy=u={}));function l(f,d){switch(d){case r.ValueErrorType.ArrayContains:return"Expected array to contain at least one matching value";case r.ValueErrorType.ArrayMaxContains:return`Expected array to contain no more than ${f.maxContains} matching values`;case r.ValueErrorType.ArrayMinContains:return`Expected array to contain at least ${f.minContains} matching values`;case r.ValueErrorType.ArrayMaxItems:return`Expected array length to be less or equal to ${f.maxItems}`;case r.ValueErrorType.ArrayMinItems:return`Expected array length to be greater or equal to ${f.minItems}`;case r.ValueErrorType.ArrayUniqueItems:return"Expected array elements to be unique";case r.ValueErrorType.Array:return"Expected array";case r.ValueErrorType.AsyncIterator:return"Expected AsyncIterator";case r.ValueErrorType.BigIntExclusiveMaximum:return`Expected bigint to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.BigIntExclusiveMinimum:return`Expected bigint to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.BigIntMaximum:return`Expected bigint to be less or equal to ${f.maximum}`;case r.ValueErrorType.BigIntMinimum:return`Expected bigint to be greater or equal to ${f.minimum}`;case r.ValueErrorType.BigIntMultipleOf:return`Expected bigint to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.BigInt:return"Expected bigint";case r.ValueErrorType.Boolean:return"Expected boolean";case r.ValueErrorType.DateExclusiveMinimumTimestamp:return`Expected Date timestamp to be greater than ${f.exclusiveMinimumTimestamp}`;case r.ValueErrorType.DateExclusiveMaximumTimestamp:return`Expected Date timestamp to be less than ${f.exclusiveMaximumTimestamp}`;case r.ValueErrorType.DateMinimumTimestamp:return`Expected Date timestamp to be greater or equal to ${f.minimumTimestamp}`;case r.ValueErrorType.DateMaximumTimestamp:return`Expected Date timestamp to be less or equal to ${f.maximumTimestamp}`;case r.ValueErrorType.DateMultipleOfTimestamp:return`Expected Date timestamp to be a multiple of ${f.multipleOfTimestamp}`;case r.ValueErrorType.Date:return"Expected Date";case r.ValueErrorType.Function:return"Expected function";case r.ValueErrorType.IntegerExclusiveMaximum:return`Expected integer to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.IntegerExclusiveMinimum:return`Expected integer to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.IntegerMaximum:return`Expected integer to be less or equal to ${f.maximum}`;case r.ValueErrorType.IntegerMinimum:return`Expected integer to be greater or equal to ${f.minimum}`;case r.ValueErrorType.IntegerMultipleOf:return`Expected integer to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.Integer:return"Expected integer";case r.ValueErrorType.IntersectUnevaluatedProperties:return"Unexpected property";case r.ValueErrorType.Intersect:return"Expected all values to match";case r.ValueErrorType.Iterator:return"Expected Iterator";case r.ValueErrorType.Literal:return`Expected ${typeof f.const=="string"?`'${f.const}'`:f.const}`;case r.ValueErrorType.Never:return"Never";case r.ValueErrorType.Not:return"Value should not match";case r.ValueErrorType.Null:return"Expected null";case r.ValueErrorType.NumberExclusiveMaximum:return`Expected number to be less than ${f.exclusiveMaximum}`;case r.ValueErrorType.NumberExclusiveMinimum:return`Expected number to be greater than ${f.exclusiveMinimum}`;case r.ValueErrorType.NumberMaximum:return`Expected number to be less or equal to ${f.maximum}`;case r.ValueErrorType.NumberMinimum:return`Expected number to be greater or equal to ${f.minimum}`;case r.ValueErrorType.NumberMultipleOf:return`Expected number to be a multiple of ${f.multipleOf}`;case r.ValueErrorType.Number:return"Expected number";case r.ValueErrorType.Object:return"Expected object";case r.ValueErrorType.ObjectAdditionalProperties:return"Unexpected property";case r.ValueErrorType.ObjectMaxProperties:return`Expected object to have no more than ${f.maxProperties} properties`;case r.ValueErrorType.ObjectMinProperties:return`Expected object to have at least ${f.minProperties} properties`;case r.ValueErrorType.ObjectRequiredProperty:return"Required property";case r.ValueErrorType.Promise:return"Expected Promise";case r.ValueErrorType.StringFormatUnknown:return`Unknown format '${f.format}'`;case r.ValueErrorType.StringFormat:return`Expected string to match '${f.format}' format`;case r.ValueErrorType.StringMaxLength:return`Expected string length less or equal to ${f.maxLength}`;case r.ValueErrorType.StringMinLength:return`Expected string length greater or equal to ${f.minLength}`;case r.ValueErrorType.StringPattern:return`Expected string to match '${f.pattern}'`;case r.ValueErrorType.String:return"Expected string";case r.ValueErrorType.Symbol:return"Expected symbol";case r.ValueErrorType.TupleLength:return`Expected tuple to have ${f.maxItems||0} elements`;case r.ValueErrorType.Tuple:return"Expected tuple";case r.ValueErrorType.Uint8ArrayMaxByteLength:return`Expected byte length less or equal to ${f.maxByteLength}`;case r.ValueErrorType.Uint8ArrayMinByteLength:return`Expected byte length greater or equal to ${f.minByteLength}`;case r.ValueErrorType.Uint8Array:return"Expected Uint8Array";case r.ValueErrorType.Undefined:return"Expected undefined";case r.ValueErrorType.Union:return"Expected union value";case r.ValueErrorType.Void:return"Expected void";case r.ValueErrorType.Kind:return`Expected kind '${f[n.Kind]}'`;default:return"Unknown error type"}}e.DefaultErrorFunction=l}}),gs=rt({"../../../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=on(),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}}),Sl=rt({"../../../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=Ei(),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*d(R){let z=R===0?1:Math.ceil(Math.floor(Math.log2(R)+1)/8);for(let ne=0;ne<z;ne++)yield R>>8*(z-1-ne)&255}function I(R){re(n.Array);for(let z of R)K(z)}function E(R){re(n.Boolean),re(R?1:0)}function T(R){re(n.BigInt),l.setBigInt64(0,R);for(let z of f)re(z)}function L(R){re(n.Date),K(R.getTime())}function H(R){re(n.Null)}function B(R){re(n.Number),l.setFloat64(0,R);for(let z of f)re(z)}function k(R){re(n.Object);for(let z of globalThis.Object.keys(R).sort())K(z),K(R[z])}function F(R){re(n.String);for(let z=0;z<R.length;z++)for(let ne of d(R.charCodeAt(z)))re(ne)}function G(R){re(n.Symbol),K(R.description)}function D(R){re(n.Uint8Array);for(let z=0;z<R.length;z++)re(R[z])}function Q(R){return re(n.Undefined)}function K(R){if((0,t.IsArray)(R))return I(R);if((0,t.IsBoolean)(R))return E(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 B(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 D(R);if((0,t.IsUndefined)(R))return Q(R);throw new r(R)}function re(R){i=i^s[R],i=i*o%a}function j(R){return i=BigInt("14695981039346656037"),K(R),i}e.Hash=j}}),ms=rt({"../../../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=Ei(),r=th(),n=gs(),i=Sl(),o=on(),a;(function(c){c[c.ArrayContains=0]="ArrayContains",c[c.ArrayMaxContains=1]="ArrayMaxContains",c[c.ArrayMaxItems=2]="ArrayMaxItems",c[c.ArrayMinContains=3]="ArrayMinContains",c[c.ArrayMinItems=4]="ArrayMinItems",c[c.ArrayUniqueItems=5]="ArrayUniqueItems",c[c.Array=6]="Array",c[c.AsyncIterator=7]="AsyncIterator",c[c.BigIntExclusiveMaximum=8]="BigIntExclusiveMaximum",c[c.BigIntExclusiveMinimum=9]="BigIntExclusiveMinimum",c[c.BigIntMaximum=10]="BigIntMaximum",c[c.BigIntMinimum=11]="BigIntMinimum",c[c.BigIntMultipleOf=12]="BigIntMultipleOf",c[c.BigInt=13]="BigInt",c[c.Boolean=14]="Boolean",c[c.DateExclusiveMaximumTimestamp=15]="DateExclusiveMaximumTimestamp",c[c.DateExclusiveMinimumTimestamp=16]="DateExclusiveMinimumTimestamp",c[c.DateMaximumTimestamp=17]="DateMaximumTimestamp",c[c.DateMinimumTimestamp=18]="DateMinimumTimestamp",c[c.DateMultipleOfTimestamp=19]="DateMultipleOfTimestamp",c[c.Date=20]="Date",c[c.Function=21]="Function",c[c.IntegerExclusiveMaximum=22]="IntegerExclusiveMaximum",c[c.IntegerExclusiveMinimum=23]="IntegerExclusiveMinimum",c[c.IntegerMaximum=24]="IntegerMaximum",c[c.IntegerMinimum=25]="IntegerMinimum",c[c.IntegerMultipleOf=26]="IntegerMultipleOf",c[c.Integer=27]="Integer",c[c.IntersectUnevaluatedProperties=28]="IntersectUnevaluatedProperties",c[c.Intersect=29]="Intersect",c[c.Iterator=30]="Iterator",c[c.Kind=31]="Kind",c[c.Literal=32]="Literal",c[c.Never=33]="Never",c[c.Not=34]="Not",c[c.Null=35]="Null",c[c.NumberExclusiveMaximum=36]="NumberExclusiveMaximum",c[c.NumberExclusiveMinimum=37]="NumberExclusiveMinimum",c[c.NumberMaximum=38]="NumberMaximum",c[c.NumberMinimum=39]="NumberMinimum",c[c.NumberMultipleOf=40]="NumberMultipleOf",c[c.Number=41]="Number",c[c.ObjectAdditionalProperties=42]="ObjectAdditionalProperties",c[c.ObjectMaxProperties=43]="ObjectMaxProperties",c[c.ObjectMinProperties=44]="ObjectMinProperties",c[c.ObjectRequiredProperty=45]="ObjectRequiredProperty",c[c.Object=46]="Object",c[c.Promise=47]="Promise",c[c.StringFormatUnknown=48]="StringFormatUnknown",c[c.StringFormat=49]="StringFormat",c[c.StringMaxLength=50]="StringMaxLength",c[c.StringMinLength=51]="StringMinLength",c[c.StringPattern=52]="StringPattern",c[c.String=53]="String",c[c.Symbol=54]="Symbol",c[c.TupleLength=55]="TupleLength",c[c.Tuple=56]="Tuple",c[c.Uint8ArrayMaxByteLength=57]="Uint8ArrayMaxByteLength",c[c.Uint8ArrayMinByteLength=58]="Uint8ArrayMinByteLength",c[c.Uint8Array=59]="Uint8Array",c[c.Undefined=60]="Undefined",c[c.Union=61]="Union",c[c.Void=62]="Void"})(a||(e.ValueErrorType=a={}));var s=class extends o.TypeBoxError{constructor(c){super("Unknown type"),this.schema=c}};e.ValueErrorsUnknownTypeError=s;function u(c){return c.replace(/~/g,"~0").replace(/\//g,"~1")}e.EscapeKey=u;function l(c){return c!==void 0}var f=class{constructor(c){this.iterator=c}[Symbol.iterator](){return this.iterator}First(){let c=this.iterator.next();return c.done?void 0:c.value}};e.ValueErrorIterator=f;function d(c,x,v,b){return{type:c,schema:x,path:v,value:b,message:r.TypeSystemErrorFunction.Get()(x,c)}}function*I(c,x,v,b){}function*E(c,x,v,b){if(!(0,t.IsArray)(b))return yield d(a.Array,c,v,b);l(c.minItems)&&!(b.length>=c.minItems)&&(yield d(a.ArrayMinItems,c,v,b)),l(c.maxItems)&&!(b.length<=c.maxItems)&&(yield d(a.ArrayMaxItems,c,v,b));for(let ie=0;ie<b.length;ie++)yield*O(c.items,x,`${v}/${ie}`,b[ie]);if(c.uniqueItems===!0&&!function(){let ie=new Set;for(let oe of b){let Te=(0,i.Hash)(oe);if(ie.has(Te))return!1;ie.add(Te)}return!0}()&&(yield d(a.ArrayUniqueItems,c,v,b)),!(l(c.contains)||l(c.minContains)||l(c.maxContains)))return;let U=l(c.contains)?c.contains:o.Type.Never(),J=b.reduce((ie,oe,Te)=>O(U,x,`${v}${Te}`,oe).next().done===!0?ie+1:ie,0);J===0&&(yield d(a.ArrayContains,c,v,b)),(0,t.IsNumber)(c.minContains)&&J<c.minContains&&(yield d(a.ArrayMinContains,c,v,b)),(0,t.IsNumber)(c.maxContains)&&J>c.maxContains&&(yield d(a.ArrayMaxContains,c,v,b))}function*T(c,x,v,b){(0,t.IsAsyncIterator)(b)||(yield d(a.AsyncIterator,c,v,b))}function*L(c,x,v,b){if(!(0,t.IsBigInt)(b))return yield d(a.BigInt,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.BigIntExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.BigIntExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.BigIntMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.BigIntMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==BigInt(0)&&(yield d(a.BigIntMultipleOf,c,v,b))}function*H(c,x,v,b){(0,t.IsBoolean)(b)||(yield d(a.Boolean,c,v,b))}function*B(c,x,v,b){yield*O(c.returns,x,v,b.prototype)}function*k(c,x,v,b){if(!(0,t.IsDate)(b))return yield d(a.Date,c,v,b);l(c.exclusiveMaximumTimestamp)&&!(b.getTime()<c.exclusiveMaximumTimestamp)&&(yield d(a.DateExclusiveMaximumTimestamp,c,v,b)),l(c.exclusiveMinimumTimestamp)&&!(b.getTime()>c.exclusiveMinimumTimestamp)&&(yield d(a.DateExclusiveMinimumTimestamp,c,v,b)),l(c.maximumTimestamp)&&!(b.getTime()<=c.maximumTimestamp)&&(yield d(a.DateMaximumTimestamp,c,v,b)),l(c.minimumTimestamp)&&!(b.getTime()>=c.minimumTimestamp)&&(yield d(a.DateMinimumTimestamp,c,v,b)),l(c.multipleOfTimestamp)&&b.getTime()%c.multipleOfTimestamp!==0&&(yield d(a.DateMultipleOfTimestamp,c,v,b))}function*F(c,x,v,b){(0,t.IsFunction)(b)||(yield d(a.Function,c,v,b))}function*G(c,x,v,b){if(!(0,t.IsInteger)(b))return yield d(a.Integer,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.IntegerExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.IntegerExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.IntegerMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.IntegerMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.IntegerMultipleOf,c,v,b))}function*D(c,x,v,b){for(let U of c.allOf){let J=O(U,x,v,b).next();J.done||(yield d(a.Intersect,c,v,b),yield J.value)}if(c.unevaluatedProperties===!1){let U=new RegExp(o.KeyResolver.ResolvePattern(c));for(let J of Object.getOwnPropertyNames(b))U.test(J)||(yield d(a.IntersectUnevaluatedProperties,c,`${v}/${J}`,b))}if(typeof c.unevaluatedProperties=="object"){let U=new RegExp(o.KeyResolver.ResolvePattern(c));for(let J of Object.getOwnPropertyNames(b))if(!U.test(J)){let ie=O(c.unevaluatedProperties,x,`${v}/${J}`,b[J]).next();ie.done||(yield ie.value)}}}function*Q(c,x,v,b){(0,t.IsIterator)(b)||(yield d(a.Iterator,c,v,b))}function*K(c,x,v,b){b!==c.const&&(yield d(a.Literal,c,v,b))}function*re(c,x,v,b){yield d(a.Never,c,v,b)}function*j(c,x,v,b){O(c.not,x,v,b).next().done===!0&&(yield d(a.Not,c,v,b))}function*R(c,x,v,b){(0,t.IsNull)(b)||(yield d(a.Null,c,v,b))}function*z(c,x,v,b){if(!r.TypeSystemPolicy.IsNumberLike(b))return yield d(a.Number,c,v,b);l(c.exclusiveMaximum)&&!(b<c.exclusiveMaximum)&&(yield d(a.NumberExclusiveMaximum,c,v,b)),l(c.exclusiveMinimum)&&!(b>c.exclusiveMinimum)&&(yield d(a.NumberExclusiveMinimum,c,v,b)),l(c.maximum)&&!(b<=c.maximum)&&(yield d(a.NumberMaximum,c,v,b)),l(c.minimum)&&!(b>=c.minimum)&&(yield d(a.NumberMinimum,c,v,b)),l(c.multipleOf)&&b%c.multipleOf!==0&&(yield d(a.NumberMultipleOf,c,v,b))}function*ne(c,x,v,b){if(!r.TypeSystemPolicy.IsObjectLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let U=Array.isArray(c.required)?c.required:[],J=Object.getOwnPropertyNames(c.properties),ie=Object.getOwnPropertyNames(b);for(let oe of U)ie.includes(oe)||(yield d(a.ObjectRequiredProperty,c.properties[oe],`${v}/${u(oe)}`,void 0));if(c.additionalProperties===!1)for(let oe of ie)J.includes(oe)||(yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,b[oe]));if(typeof c.additionalProperties=="object")for(let oe of ie)J.includes(oe)||(yield*O(c.additionalProperties,x,`${v}/${u(oe)}`,b[oe]));for(let oe of J){let Te=c.properties[oe];c.required&&c.required.includes(oe)?(yield*O(Te,x,`${v}/${u(oe)}`,b[oe]),o.ExtendsUndefined.Check(c)&&!(oe in b)&&(yield d(a.ObjectRequiredProperty,Te,`${v}/${u(oe)}`,void 0))):r.TypeSystemPolicy.IsExactOptionalProperty(b,oe)&&(yield*O(Te,x,`${v}/${u(oe)}`,b[oe]))}}function*ue(c,x,v,b){(0,t.IsPromise)(b)||(yield d(a.Promise,c,v,b))}function*te(c,x,v,b){if(!r.TypeSystemPolicy.IsRecordLike(b))return yield d(a.Object,c,v,b);l(c.minProperties)&&!(Object.getOwnPropertyNames(b).length>=c.minProperties)&&(yield d(a.ObjectMinProperties,c,v,b)),l(c.maxProperties)&&!(Object.getOwnPropertyNames(b).length<=c.maxProperties)&&(yield d(a.ObjectMaxProperties,c,v,b));let[U,J]=Object.entries(c.patternProperties)[0],ie=new RegExp(U);for(let[oe,Te]of Object.entries(b))ie.test(oe)&&(yield*O(J,x,`${v}/${u(oe)}`,Te));if(typeof c.additionalProperties=="object")for(let[oe,Te]of Object.entries(b))ie.test(oe)||(yield*O(c.additionalProperties,x,`${v}/${u(oe)}`,Te));if(c.additionalProperties===!1){for(let[oe,Te]of Object.entries(b))if(!ie.test(oe))return yield d(a.ObjectAdditionalProperties,c,`${v}/${u(oe)}`,Te)}}function*fe(c,x,v,b){yield*O((0,n.Deref)(c,x),x,v,b)}function*V(c,x,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);l(c.minLength)&&!(b.length>=c.minLength)&&(yield d(a.StringMinLength,c,v,b)),l(c.maxLength)&&!(b.length<=c.maxLength)&&(yield d(a.StringMaxLength,c,v,b)),(0,t.IsString)(c.pattern)&&(new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))),(0,t.IsString)(c.format)&&(o.FormatRegistry.Has(c.format)?o.FormatRegistry.Get(c.format)(b)||(yield d(a.StringFormat,c,v,b)):yield d(a.StringFormatUnknown,c,v,b))}function*X(c,x,v,b){(0,t.IsSymbol)(b)||(yield d(a.Symbol,c,v,b))}function*ee(c,x,v,b){if(!(0,t.IsString)(b))return yield d(a.String,c,v,b);new RegExp(c.pattern).test(b)||(yield d(a.StringPattern,c,v,b))}function*be(c,x,v,b){yield*O((0,n.Deref)(c,x),x,v,b)}function*p(c,x,v,b){if(!(0,t.IsArray)(b))return yield d(a.Tuple,c,v,b);if(c.items===void 0&&b.length!==0)return yield d(a.TupleLength,c,v,b);if(b.length!==c.maxItems)return yield d(a.TupleLength,c,v,b);if(c.items)for(let U=0;U<c.items.length;U++)yield*O(c.items[U],x,`${v}/${U}`,b[U])}function*w(c,x,v,b){(0,t.IsUndefined)(b)||(yield d(a.Undefined,c,v,b))}function*A(c,x,v,b){let U=0;for(let J of c.anyOf){let ie=[...O(J,x,v,b)];if(ie.length===0)return;U+=ie.length}U>0&&(yield d(a.Union,c,v,b))}function*P(c,x,v,b){if(!(0,t.IsUint8Array)(b))return yield d(a.Uint8Array,c,v,b);l(c.maxByteLength)&&!(b.length<=c.maxByteLength)&&(yield d(a.Uint8ArrayMaxByteLength,c,v,b)),l(c.minByteLength)&&!(b.length>=c.minByteLength)&&(yield d(a.Uint8ArrayMinByteLength,c,v,b))}function*$(c,x,v,b){}function*N(c,x,v,b){r.TypeSystemPolicy.IsVoidLike(b)||(yield d(a.Void,c,v,b))}function*g(c,x,v,b){o.TypeRegistry.Get(c[o.Kind])(c,b)||(yield d(a.Kind,c,v,b))}function*O(c,x,v,b){let U=l(c.$id)?[...x,c]:x,J=c;switch(J[o.Kind]){case"Any":return yield*I(J,U,v,b);case"Array":return yield*E(J,U,v,b);case"AsyncIterator":return yield*T(J,U,v,b);case"BigInt":return yield*L(J,U,v,b);case"Boolean":return yield*H(J,U,v,b);case"Constructor":return yield*B(J,U,v,b);case"Date":return yield*k(J,U,v,b);case"Function":return yield*F(J,U,v,b);case"Integer":return yield*G(J,U,v,b);case"Intersect":return yield*D(J,U,v,b);case"Iterator":return yield*Q(J,U,v,b);case"Literal":return yield*K(J,U,v,b);case"Never":return yield*re(J,U,v,b);case"Not":return yield*j(J,U,v,b);case"Null":return yield*R(J,U,v,b);case"Number":return yield*z(J,U,v,b);case"Object":return yield*ne(J,U,v,b);case"Promise":return yield*ue(J,U,v,b);case"Record":return yield*te(J,U,v,b);case"Ref":return yield*fe(J,U,v,b);case"String":return yield*V(J,U,v,b);case"Symbol":return yield*X(J,U,v,b);case"TemplateLiteral":return yield*ee(J,U,v,b);case"This":return yield*be(J,U,v,b);case"Tuple":return yield*p(J,U,v,b);case"Undefined":return yield*w(J,U,v,b);case"Union":return yield*A(J,U,v,b);case"Uint8Array":return yield*P(J,U,v,b);case"Unknown":return yield*$(J,U,v,b);case"Void":return yield*N(J,U,v,b);default:if(!o.TypeRegistry.Has(J[o.Kind]))throw new s(c);return yield*g(J,U,v,b)}}function _(...c){let x=c.length===3?O(c[0],c[1],"",c[2]):O(c[0],[],"",c[1]);return new f(x)}e.Errors=_}}),e2=rt({"../../../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(ms(),e)}}),rh=rt({"../../../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=ms();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),r(th(),e)}}),t2=rt({"../../../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=Ei(),r=rh(),n=gs(),i=Sl(),o=on(),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,O,_){return!0}function f(g,O,_){if(!(0,t.IsArray)(_)||u(g.minItems)&&!(_.length>=g.minItems)||u(g.maxItems)&&!(_.length<=g.maxItems)||!_.every(v=>$(g.items,O,v))||g.uniqueItems===!0&&!function(){let v=new Set;for(let b of _){let U=(0,i.Hash)(b);if(v.has(U))return!1;v.add(U)}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(),x=_.reduce((v,b)=>$(c,O,b)?v+1:v,0);return!(x===0||(0,t.IsNumber)(g.minContains)&&x<g.minContains||(0,t.IsNumber)(g.maxContains)&&x>g.maxContains)}function d(g,O,_){return(0,t.IsAsyncIterator)(_)}function I(g,O,_){return!(!(0,t.IsBigInt)(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.minimum)&&!(_>=g.minimum)||u(g.multipleOf)&&_%g.multipleOf!==BigInt(0))}function E(g,O,_){return(0,t.IsBoolean)(_)}function T(g,O,_){return $(g.returns,O,_.prototype)}function L(g,O,_){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,O,_){return(0,t.IsFunction)(_)}function B(g,O,_){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,O,_){let c=g.allOf.every(x=>$(x,O,_));if(g.unevaluatedProperties===!1){let x=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>x.test(b));return c&&v}else if(o.TypeGuard.TSchema(g.unevaluatedProperties)){let x=new RegExp(o.KeyResolver.ResolvePattern(g)),v=Object.getOwnPropertyNames(_).every(b=>x.test(b)||$(g.unevaluatedProperties,O,_[b]));return c&&v}else return c}function F(g,O,_){return(0,t.IsIterator)(_)}function G(g,O,_){return _===g.const}function D(g,O,_){return!1}function Q(g,O,_){return!$(g.not,O,_)}function K(g,O,_){return(0,t.IsNull)(_)}function re(g,O,_){return!(!r.TypeSystemPolicy.IsNumberLike(_)||u(g.exclusiveMaximum)&&!(_<g.exclusiveMaximum)||u(g.exclusiveMinimum)&&!(_>g.exclusiveMinimum)||u(g.minimum)&&!(_>=g.minimum)||u(g.maximum)&&!(_<=g.maximum)||u(g.multipleOf)&&_%g.multipleOf!==0)}function j(g,O,_){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 x of c){let v=g.properties[x];if(g.required&&g.required.includes(x)){if(!$(v,O,_[x])||(o.ExtendsUndefined.Check(v)||s(v))&&!(x in _))return!1}else if(r.TypeSystemPolicy.IsExactOptionalProperty(_,x)&&!$(v,O,_[x]))return!1}if(g.additionalProperties===!1){let x=Object.getOwnPropertyNames(_);return g.required&&g.required.length===c.length&&x.length===c.length?!0:x.every(v=>c.includes(v))}else return typeof g.additionalProperties=="object"?Object.getOwnPropertyNames(_).every(x=>c.includes(x)||$(g.additionalProperties,O,_[x])):!0}function R(g,O,_){return(0,t.IsPromise)(_)}function z(g,O,_){if(!r.TypeSystemPolicy.IsRecordLike(_)||u(g.minProperties)&&!(Object.getOwnPropertyNames(_).length>=g.minProperties)||u(g.maxProperties)&&!(Object.getOwnPropertyNames(_).length<=g.maxProperties))return!1;let[c,x]=Object.entries(g.patternProperties)[0],v=new RegExp(c),b=Object.entries(_).every(([ie,oe])=>v.test(ie)?$(x,O,oe):!0),U=typeof g.additionalProperties=="object"?Object.entries(_).every(([ie,oe])=>v.test(ie)?!0:$(g.additionalProperties,O,oe)):!0,J=g.additionalProperties===!1?Object.getOwnPropertyNames(_).every(ie=>v.test(ie)):!0;return b&&U&&J}function ne(g,O,_){return $((0,n.Deref)(g,O),O,_)}function ue(g,O,_){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 te(g,O,_){return(0,t.IsSymbol)(_)}function fe(g,O,_){return(0,t.IsString)(_)&&new RegExp(g.pattern).test(_)}function V(g,O,_){return $((0,n.Deref)(g,O),O,_)}function X(g,O,_){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(!$(g.items[c],O,_[c]))return!1;return!0}function ee(g,O,_){return(0,t.IsUndefined)(_)}function be(g,O,_){return g.anyOf.some(c=>$(c,O,_))}function p(g,O,_){return!(!(0,t.IsUint8Array)(_)||u(g.maxByteLength)&&!(_.length<=g.maxByteLength)||u(g.minByteLength)&&!(_.length>=g.minByteLength))}function w(g,O,_){return!0}function A(g,O,_){return r.TypeSystemPolicy.IsVoidLike(_)}function P(g,O,_){return o.TypeRegistry.Has(g[o.Kind])?o.TypeRegistry.Get(g[o.Kind])(g,_):!1}function $(g,O,_){let c=u(g.$id)?[...O,g]:O,x=g;switch(x[o.Kind]){case"Any":return l(x,c,_);case"Array":return f(x,c,_);case"AsyncIterator":return d(x,c,_);case"BigInt":return I(x,c,_);case"Boolean":return E(x,c,_);case"Constructor":return T(x,c,_);case"Date":return L(x,c,_);case"Function":return H(x,c,_);case"Integer":return B(x,c,_);case"Intersect":return k(x,c,_);case"Iterator":return F(x,c,_);case"Literal":return G(x,c,_);case"Never":return D(x,c,_);case"Not":return Q(x,c,_);case"Null":return K(x,c,_);case"Number":return re(x,c,_);case"Object":return j(x,c,_);case"Promise":return R(x,c,_);case"Record":return z(x,c,_);case"Ref":return ne(x,c,_);case"String":return ue(x,c,_);case"Symbol":return te(x,c,_);case"TemplateLiteral":return fe(x,c,_);case"This":return V(x,c,_);case"Tuple":return X(x,c,_);case"Undefined":return ee(x,c,_);case"Union":return be(x,c,_);case"Uint8Array":return p(x,c,_);case"Unknown":return w(x,c,_);case"Void":return A(x,c,_);default:if(!o.TypeRegistry.Has(x[o.Kind]))throw new a(x);return P(x,c,_)}}function N(...g){return g.length===3?$(g[0],g[1],g[2]):$(g[0],[],g[1])}e.Check=N}}),r2=rt({"../../../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=Ei(),r=gs(),n=t2(),i=on(),o=class extends i.TypeBoxError{constructor(I,E,T){super("Unable to decode due to invalid value"),this.schema=I,this.value=E,this.error=T}};e.TransformDecodeCheckError=o;var a=class extends i.TypeBoxError{constructor(I,E,T){super("Unable to encode due to invalid value"),this.schema=I,this.value=E,this.error=T}};e.TransformEncodeCheckError=a;var s=class extends i.TypeBoxError{constructor(I,E,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=I,this.value=E}};e.TransformDecodeError=s;var u=class extends i.TypeBoxError{constructor(I,E,T){super(`${T instanceof Error?T.message:"Unknown error"}`),this.schema=I,this.value=E}};e.TransformEncodeError=u;var l;(function(I){function E(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function T(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function L(te,fe){return i.TypeGuard.TTransform(te)||z(te.returns,fe)||te.parameters.some(V=>z(V,fe))}function H(te,fe){return i.TypeGuard.TTransform(te)||z(te.returns,fe)||te.parameters.some(V=>z(V,fe))}function B(te,fe){return i.TypeGuard.TTransform(te)||i.TypeGuard.TTransform(te.unevaluatedProperties)||te.allOf.some(V=>z(V,fe))}function k(te,fe){return i.TypeGuard.TTransform(te)||z(te.items,fe)}function F(te,fe){return i.TypeGuard.TTransform(te)||z(te.not,fe)}function G(te,fe){return i.TypeGuard.TTransform(te)||Object.values(te.properties).some(V=>z(V,fe))||i.TypeGuard.TSchema(te.additionalProperties)&&z(te.additionalProperties,fe)}function D(te,fe){return i.TypeGuard.TTransform(te)||z(te.item,fe)}function Q(te,fe){let V=Object.getOwnPropertyNames(te.patternProperties)[0],X=te.patternProperties[V];return i.TypeGuard.TTransform(te)||z(X,fe)||i.TypeGuard.TSchema(te.additionalProperties)&&i.TypeGuard.TTransform(te.additionalProperties)}function K(te,fe){return i.TypeGuard.TTransform(te)?!0:z((0,r.Deref)(te,fe),fe)}function re(te,fe){return i.TypeGuard.TTransform(te)?!0:z((0,r.Deref)(te,fe),fe)}function j(te,fe){return i.TypeGuard.TTransform(te)||!(0,t.IsUndefined)(te.items)&&te.items.some(V=>z(V,fe))}function R(te,fe){return i.TypeGuard.TTransform(te)||te.anyOf.some(V=>z(V,fe))}function z(te,fe){let V=(0,t.IsString)(te.$id)?[...fe,te]:fe,X=te;if(te.$id&&ne.has(te.$id))return!1;switch(te.$id&&ne.add(te.$id),te[i.Kind]){case"Array":return E(X,V);case"AsyncIterator":return T(X,V);case"Constructor":return L(X,V);case"Function":return H(X,V);case"Intersect":return B(X,V);case"Iterator":return k(X,V);case"Not":return F(X,V);case"Object":return G(X,V);case"Promise":return D(X,V);case"Record":return Q(X,V);case"Ref":return K(X,V);case"This":return re(X,V);case"Tuple":return j(X,V);case"Union":return R(X,V);default:return i.TypeGuard.TTransform(te)}}let ne=new Set;function ue(te,fe){return ne.clear(),z(te,fe)}I.Has=ue})(l||(e.HasTransform=l={}));var f;(function(I){function E(j,R){try{return i.TypeGuard.TTransform(j)?j[i.Transform].Decode(R):R}catch(z){throw new s(j,R,z)}}function T(j,R,z){return(0,t.IsArray)(z)?E(j,z.map(ne=>K(j.items,R,ne))):E(j,z)}function L(j,R,z){if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return E(j,z);let ne=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),ue=ne.reduce((X,ee)=>ee in X?{...X,[ee]:K(i.IndexedAccessor.Resolve(j,[ee]),R,X[ee])}:X,z);if(!i.TypeGuard.TTransform(j.unevaluatedProperties))return E(j,ue);let te=Object.getOwnPropertyNames(ue),fe=j.unevaluatedProperties,V=te.reduce((X,ee)=>ne.includes(ee)?X:{...X,[ee]:E(fe,X[ee])},ue);return E(j,V)}function H(j,R,z){return E(j,K(j.not,R,z))}function B(j,R,z){if(!(0,t.IsPlainObject)(z))return E(j,z);let ne=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),ue=ne.reduce((X,ee)=>ee in X?{...X,[ee]:K(j.properties[ee],R,X[ee])}:X,z);if(!i.TypeGuard.TSchema(j.additionalProperties))return E(j,ue);let te=Object.getOwnPropertyNames(ue),fe=j.additionalProperties,V=te.reduce((X,ee)=>ne.includes(ee)?X:{...X,[ee]:E(fe,X[ee])},ue);return E(j,V)}function k(j,R,z){if(!(0,t.IsPlainObject)(z))return E(j,z);let ne=Object.getOwnPropertyNames(j.patternProperties)[0],ue=new RegExp(ne),te=Object.getOwnPropertyNames(z).reduce((ee,be)=>ue.test(be)?{...ee,[be]:K(j.patternProperties[ne],R,ee[be])}:ee,z);if(!i.TypeGuard.TSchema(j.additionalProperties))return E(j,te);let fe=Object.getOwnPropertyNames(te),V=j.additionalProperties,X=fe.reduce((ee,be)=>ue.test(be)?ee:{...ee,[be]:E(V,ee[be])},te);return E(j,X)}function F(j,R,z){let ne=(0,r.Deref)(j,R);return E(j,K(ne,R,z))}function G(j,R,z){let ne=(0,r.Deref)(j,R);return E(j,K(ne,R,z))}function D(j,R,z){return(0,t.IsArray)(z)&&(0,t.IsArray)(j.items)?E(j,j.items.map((ne,ue)=>K(ne,R,z[ue]))):E(j,z)}function Q(j,R,z){let ne=E(j,z);for(let ue of j.anyOf)if((0,n.Check)(ue,R,ne))return K(ue,R,ne);return ne}function K(j,R,z){let ne=typeof j.$id=="string"?[...R,j]:R,ue=j;switch(j[i.Kind]){case"Array":return T(ue,ne,z);case"Intersect":return L(ue,ne,z);case"Not":return H(ue,ne,z);case"Object":return B(ue,ne,z);case"Record":return k(ue,ne,z);case"Ref":return F(ue,ne,z);case"Symbol":return E(ue,z);case"This":return G(ue,ne,z);case"Tuple":return D(ue,ne,z);case"Union":return Q(ue,ne,z);default:return E(ue,z)}}function re(j,R,z){return K(j,R,z)}I.Decode=re})(f||(e.DecodeTransform=f={}));var d;(function(I){function E(j,R){try{return i.TypeGuard.TTransform(j)?j[i.Transform].Encode(R):R}catch(z){throw new u(j,R,z)}}function T(j,R,z){let ne=E(j,z);return(0,t.IsArray)(ne)?ne.map(ue=>K(j.items,R,ue)):ne}function L(j,R,z){let ne=E(j,z);if(!(0,t.IsPlainObject)(z)||(0,t.IsValueType)(z))return ne;let ue=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),te=ue.reduce((X,ee)=>ee in ne?{...X,[ee]:K(i.IndexedAccessor.Resolve(j,[ee]),R,X[ee])}:X,ne);if(!i.TypeGuard.TTransform(j.unevaluatedProperties))return E(j,te);let fe=Object.getOwnPropertyNames(te),V=j.unevaluatedProperties;return fe.reduce((X,ee)=>ue.includes(ee)?X:{...X,[ee]:E(V,X[ee])},te)}function H(j,R,z){return E(j.not,E(j,z))}function B(j,R,z){let ne=E(j,z);if(!(0,t.IsPlainObject)(z))return ne;let ue=i.KeyResolver.ResolveKeys(j,{includePatterns:!1}),te=ue.reduce((X,ee)=>ee in X?{...X,[ee]:K(j.properties[ee],R,X[ee])}:X,ne);if(!i.TypeGuard.TSchema(j.additionalProperties))return te;let fe=Object.getOwnPropertyNames(te),V=j.additionalProperties;return fe.reduce((X,ee)=>ue.includes(ee)?X:{...X,[ee]:E(V,X[ee])},te)}function k(j,R,z){let ne=E(j,z);if(!(0,t.IsPlainObject)(z))return ne;let ue=Object.getOwnPropertyNames(j.patternProperties)[0],te=new RegExp(ue),fe=Object.getOwnPropertyNames(z).reduce((ee,be)=>te.test(be)?{...ee,[be]:K(j.patternProperties[ue],R,ee[be])}:ee,ne);if(!i.TypeGuard.TSchema(j.additionalProperties))return E(j,fe);let V=Object.getOwnPropertyNames(fe),X=j.additionalProperties;return V.reduce((ee,be)=>te.test(be)?ee:{...ee,[be]:E(X,ee[be])},fe)}function F(j,R,z){let ne=(0,r.Deref)(j,R),ue=K(ne,R,z);return E(j,ue)}function G(j,R,z){let ne=(0,r.Deref)(j,R),ue=K(ne,R,z);return E(j,ue)}function D(j,R,z){let ne=E(j,z);return(0,t.IsArray)(j.items)?j.items.map((ue,te)=>K(ue,R,ne[te])):[]}function Q(j,R,z){for(let ne of j.anyOf){if(!(0,n.Check)(ne,R,z))continue;let ue=K(ne,R,z);return E(j,ue)}for(let ne of j.anyOf){let ue=K(ne,R,z);if((0,n.Check)(j,R,ue))return E(j,ue)}return E(j,z)}function K(j,R,z){let ne=typeof j.$id=="string"?[...R,j]:R,ue=j;switch(j[i.Kind]){case"Array":return T(ue,ne,z);case"Intersect":return L(ue,ne,z);case"Not":return H(ue,ne,z);case"Object":return B(ue,ne,z);case"Record":return k(ue,ne,z);case"Ref":return F(ue,ne,z);case"This":return G(ue,ne,z);case"Tuple":return D(ue,ne,z);case"Union":return Q(ue,ne,z);default:return E(ue,z)}}function re(j,R,z){return K(j,R,z)}I.Encode=re})(d||(e.EncodeTransform=d={}))}}),n2=rt({"../../../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=r2(),r=Ei(),n=ms(),i=rh(),o=gs(),a=Sl(),s=on(),u=class{constructor(B,k,F,G){this.schema=B,this.references=k,this.checkFunc=F,this.code=G,this.hasTransform=t.HasTransform.Has(B,k)}Code(){return this.code}Errors(B){return(0,n.Errors)(this.schema,this.references,B)}Check(B){return this.checkFunc(B)}Decode(B){if(!this.checkFunc(B))throw new t.TransformDecodeCheckError(this.schema,B,this.Errors(B).First());return this.hasTransform?t.DecodeTransform.Decode(this.schema,this.references,B):B}Encode(B){let k=this.hasTransform?t.EncodeTransform.Encode(this.schema,this.references,B):B;if(!this.checkFunc(k))throw new t.TransformEncodeCheckError(this.schema,B,this.Errors(B).First());return k}};e.TypeCheck=u;var l;(function(B){function k(Q){return Q===36}B.DollarSign=k;function F(Q){return Q===95}B.IsUnderscore=F;function G(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}B.IsAlpha=G;function D(Q){return Q>=48&&Q<=57}B.IsNumeric=D})(l||(l={}));var f;(function(B){function k(Q){return Q.length===0?!1:l.IsNumeric(Q.charCodeAt(0))}function F(Q){if(k(Q))return!1;for(let K=0;K<Q.length;K++){let re=Q.charCodeAt(K);if(!(l.IsAlpha(re)||l.IsNumeric(re)||l.DollarSign(re)||l.IsUnderscore(re)))return!1}return!0}function G(Q){return Q.replace(/'/g,"\\'")}function D(Q,K){return F(K)?`${Q}.${K}`:`${Q}['${G(K)}']`}B.Encode=D})(f||(f={}));var d;(function(B){function k(F){let G=[];for(let D=0;D<F.length;D++){let Q=F.charCodeAt(D);l.IsNumeric(Q)||l.IsAlpha(Q)?G.push(F.charAt(D)):G.push(`_${Q}_`)}return G.join("").replace(/__/g,"_")}B.Encode=k})(d||(d={}));var I;(function(B){function k(F){return F.replace(/'/g,"\\'")}B.Escape=k})(I||(I={}));var E=class extends s.TypeBoxError{constructor(B){super("Unknown type"),this.schema=B}};e.TypeCompilerUnknownTypeError=E;var T=class extends s.TypeBoxError{constructor(B){super("Preflight validation check failed to guard for the given schema"),this.schema=B}};e.TypeCompilerTypeGuardError=T;var L;(function(B){function k(K,re,j){return i.TypeSystemPolicy.ExactOptionalPropertyTypes?`('${re}' in ${K} ? ${j} : true)`:`(${f.Encode(K,re)} !== undefined ? ${j} : true)`}B.IsExactOptionalProperty=k;function F(K){return i.TypeSystemPolicy.AllowArrayObject?`(typeof ${K} === 'object' && ${K} !== null)`:`(typeof ${K} === 'object' && ${K} !== null && !Array.isArray(${K}))`}B.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))`}B.IsRecordLike=G;function D(K){return i.TypeSystemPolicy.AllowNaN?`typeof ${K} === 'number'`:`(typeof ${K} === 'number' && Number.isFinite(${K}))`}B.IsNumberLike=D;function Q(K){return i.TypeSystemPolicy.AllowNullVoid?`(${K} === undefined || ${K} === null)`:`${K} === undefined`}B.IsVoidLike=Q})(L||(e.Policy=L={}));var H;(function(B){function k(S){return S[s.Kind]==="Any"||S[s.Kind]==="Unknown"}function*F(S,ye,C){yield"true"}function*G(S,ye,C){yield`Array.isArray(${C})`;let[xe,se]=[Je("value","any"),Je("acc","number")];(0,r.IsNumber)(S.maxItems)&&(yield`${C}.length <= ${S.maxItems}`),(0,r.IsNumber)(S.minItems)&&(yield`${C}.length >= ${S.minItems}`);let ge=oe(S.items,ye,"value");if(yield`${C}.every((${xe}) => ${ge})`,s.TypeGuard.TSchema(S.contains)||(0,r.IsNumber)(S.minContains)||(0,r.IsNumber)(S.maxContains)){let De=s.TypeGuard.TSchema(S.contains)?S.contains:s.Type.Never(),He=oe(De,ye,"value"),yt=(0,r.IsNumber)(S.minContains)?[`(count >= ${S.minContains})`]:[],ct=(0,r.IsNumber)(S.maxContains)?[`(count <= ${S.maxContains})`]:[],mt=`const count = value.reduce((${se}, ${xe}) => ${He} ? acc + 1 : acc, 0)`,Pr=["(count > 0)",...yt,...ct].join(" && ");yield`((${xe}) => { ${mt}; return ${Pr}})(${C})`}S.uniqueItems===!0&&(yield`((${xe}) => { const set = new Set(); for(const element of value) { const hashed = hash(element); if(set.has(hashed)) { return false } else { set.add(hashed) } } return true } )(${C})`)}function*D(S,ye,C){yield`(typeof value === 'object' && Symbol.asyncIterator in ${C})`}function*Q(S,ye,C){yield`(typeof ${C} === 'bigint')`,(0,r.IsBigInt)(S.exclusiveMaximum)&&(yield`${C} < BigInt(${S.exclusiveMaximum})`),(0,r.IsBigInt)(S.exclusiveMinimum)&&(yield`${C} > BigInt(${S.exclusiveMinimum})`),(0,r.IsBigInt)(S.maximum)&&(yield`${C} <= BigInt(${S.maximum})`),(0,r.IsBigInt)(S.minimum)&&(yield`${C} >= BigInt(${S.minimum})`),(0,r.IsBigInt)(S.multipleOf)&&(yield`(${C} % BigInt(${S.multipleOf})) === 0`)}function*K(S,ye,C){yield`(typeof ${C} === 'boolean')`}function*re(S,ye,C){yield*J(S.returns,ye,`${C}.prototype`)}function*j(S,ye,C){yield`(${C} instanceof Date) && Number.isFinite(${C}.getTime())`,(0,r.IsNumber)(S.exclusiveMaximumTimestamp)&&(yield`${C}.getTime() < ${S.exclusiveMaximumTimestamp}`),(0,r.IsNumber)(S.exclusiveMinimumTimestamp)&&(yield`${C}.getTime() > ${S.exclusiveMinimumTimestamp}`),(0,r.IsNumber)(S.maximumTimestamp)&&(yield`${C}.getTime() <= ${S.maximumTimestamp}`),(0,r.IsNumber)(S.minimumTimestamp)&&(yield`${C}.getTime() >= ${S.minimumTimestamp}`),(0,r.IsNumber)(S.multipleOfTimestamp)&&(yield`(${C}.getTime() % ${S.multipleOfTimestamp}) === 0`)}function*R(S,ye,C){yield`(typeof ${C} === 'function')`}function*z(S,ye,C){yield`(typeof ${C} === 'number' && Number.isInteger(${C}))`,(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*ne(S,ye,C){let xe=S.allOf.map(se=>oe(se,ye,C)).join(" && ");if(S.unevaluatedProperties===!1){let se=Se(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),ge=`Object.getOwnPropertyNames(${C}).every(key => ${se}.test(key))`;yield`(${xe} && ${ge})`}else if(s.TypeGuard.TSchema(S.unevaluatedProperties)){let se=Se(`${new RegExp(s.KeyResolver.ResolvePattern(S))};`),ge=`Object.getOwnPropertyNames(${C}).every(key => ${se}.test(key) || ${oe(S.unevaluatedProperties,ye,`${C}[key]`)})`;yield`(${xe} && ${ge})`}else yield`(${xe})`}function*ue(S,ye,C){yield`(typeof value === 'object' && Symbol.iterator in ${C})`}function*te(S,ye,C){typeof S.const=="number"||typeof S.const=="boolean"?yield`(${C} === ${S.const})`:yield`(${C} === '${I.Escape(S.const)}')`}function*fe(S,ye,C){yield"false"}function*V(S,ye,C){yield`(!${oe(S.not,ye,C)})`}function*X(S,ye,C){yield`(${C} === null)`}function*ee(S,ye,C){yield L.IsNumberLike(C),(0,r.IsNumber)(S.exclusiveMaximum)&&(yield`${C} < ${S.exclusiveMaximum}`),(0,r.IsNumber)(S.exclusiveMinimum)&&(yield`${C} > ${S.exclusiveMinimum}`),(0,r.IsNumber)(S.maximum)&&(yield`${C} <= ${S.maximum}`),(0,r.IsNumber)(S.minimum)&&(yield`${C} >= ${S.minimum}`),(0,r.IsNumber)(S.multipleOf)&&(yield`(${C} % ${S.multipleOf}) === 0`)}function*be(S,ye,C){yield L.IsObjectLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let xe=Object.getOwnPropertyNames(S.properties);for(let se of xe){let ge=f.Encode(C,se),De=S.properties[se];if(S.required&&S.required.includes(se))yield*J(De,ye,ge),(s.ExtendsUndefined.Check(De)||k(De))&&(yield`('${se}' in ${C})`);else{let He=oe(De,ye,ge);yield L.IsExactOptionalProperty(C,se,He)}}if(S.additionalProperties===!1)if(S.required&&S.required.length===xe.length)yield`Object.getOwnPropertyNames(${C}).length === ${xe.length}`;else{let se=`[${xe.map(ge=>`'${ge}'`).join(", ")}]`;yield`Object.getOwnPropertyNames(${C}).every(key => ${se}.includes(key))`}if(typeof S.additionalProperties=="object"){let se=oe(S.additionalProperties,ye,`${C}[key]`),ge=`[${xe.map(De=>`'${De}'`).join(", ")}]`;yield`(Object.getOwnPropertyNames(${C}).every(key => ${ge}.includes(key) || ${se}))`}}function*p(S,ye,C){yield`(typeof value === 'object' && typeof ${C}.then === 'function')`}function*w(S,ye,C){yield L.IsRecordLike(C),(0,r.IsNumber)(S.minProperties)&&(yield`Object.getOwnPropertyNames(${C}).length >= ${S.minProperties}`),(0,r.IsNumber)(S.maxProperties)&&(yield`Object.getOwnPropertyNames(${C}).length <= ${S.maxProperties}`);let[xe,se]=Object.entries(S.patternProperties)[0],ge=Se(`${new RegExp(xe)}`),De=oe(se,ye,"value"),He=s.TypeGuard.TSchema(S.additionalProperties)?oe(S.additionalProperties,ye,C):S.additionalProperties===!1?"false":"true",yt=`(${ge}.test(key) ? ${De} : ${He})`;yield`(Object.entries(${C}).every(([key, value]) => ${yt}))`}function*A(S,ye,C){let xe=(0,o.Deref)(S,ye);if(ie.functions.has(S.$ref))return yield`${Te(S.$ref)}(${C})`;yield*J(xe,ye,C)}function*P(S,ye,C){yield`(typeof ${C} === 'string')`,(0,r.IsNumber)(S.maxLength)&&(yield`${C}.length <= ${S.maxLength}`),(0,r.IsNumber)(S.minLength)&&(yield`${C}.length >= ${S.minLength}`),S.pattern!==void 0&&(yield`${Se(`${new RegExp(S.pattern)};`)}.test(${C})`),S.format!==void 0&&(yield`format('${S.format}', ${C})`)}function*$(S,ye,C){yield`(typeof ${C} === 'symbol')`}function*N(S,ye,C){yield`(typeof ${C} === 'string')`,yield`${Se(`${new RegExp(S.pattern)};`)}.test(${C})`}function*g(S,ye,C){yield`${Te(S.$ref)}(${C})`}function*O(S,ye,C){if(yield`Array.isArray(${C})`,S.items===void 0)return yield`${C}.length === 0`;yield`(${C}.length === ${S.maxItems})`;for(let xe=0;xe<S.items.length;xe++)yield`${oe(S.items[xe],ye,`${C}[${xe}]`)}`}function*_(S,ye,C){yield`${C} === undefined`}function*c(S,ye,C){yield`(${S.anyOf.map(xe=>oe(xe,ye,C)).join(" || ")})`}function*x(S,ye,C){yield`${C} instanceof Uint8Array`,(0,r.IsNumber)(S.maxByteLength)&&(yield`(${C}.length <= ${S.maxByteLength})`),(0,r.IsNumber)(S.minByteLength)&&(yield`(${C}.length >= ${S.minByteLength})`)}function*v(S,ye,C){yield"true"}function*b(S,ye,C){yield L.IsVoidLike(C)}function*U(S,ye,C){let xe=ie.instances.size;ie.instances.set(xe,S),yield`kind('${S[s.Kind]}', ${xe}, ${C})`}function*J(S,ye,C,xe=!0){let se=(0,r.IsString)(S.$id)?[...ye,S]:ye,ge=S;if(xe&&(0,r.IsString)(S.$id)){let De=Te(S.$id);if(ie.functions.has(De))return yield`${De}(${C})`;{let He=Ve(De,S,ye,"value",!1);return ie.functions.set(De,He),yield`${De}(${C})`}}switch(ge[s.Kind]){case"Any":return yield*F(ge,se,C);case"Array":return yield*G(ge,se,C);case"AsyncIterator":return yield*D(ge,se,C);case"BigInt":return yield*Q(ge,se,C);case"Boolean":return yield*K(ge,se,C);case"Constructor":return yield*re(ge,se,C);case"Date":return yield*j(ge,se,C);case"Function":return yield*R(ge,se,C);case"Integer":return yield*z(ge,se,C);case"Intersect":return yield*ne(ge,se,C);case"Iterator":return yield*ue(ge,se,C);case"Literal":return yield*te(ge,se,C);case"Never":return yield*fe(ge,se,C);case"Not":return yield*V(ge,se,C);case"Null":return yield*X(ge,se,C);case"Number":return yield*ee(ge,se,C);case"Object":return yield*be(ge,se,C);case"Promise":return yield*p(ge,se,C);case"Record":return yield*w(ge,se,C);case"Ref":return yield*A(ge,se,C);case"String":return yield*P(ge,se,C);case"Symbol":return yield*$(ge,se,C);case"TemplateLiteral":return yield*N(ge,se,C);case"This":return yield*g(ge,se,C);case"Tuple":return yield*O(ge,se,C);case"Undefined":return yield*_(ge,se,C);case"Union":return yield*c(ge,se,C);case"Uint8Array":return yield*x(ge,se,C);case"Unknown":return yield*v(ge,se,C);case"Void":return yield*b(ge,se,C);default:if(!s.TypeRegistry.Has(ge[s.Kind]))throw new E(S);return yield*U(ge,se,C)}}let ie={language:"javascript",functions:new Map,variables:new Map,instances:new Map};function oe(S,ye,C,xe=!0){return`(${[...J(S,ye,C,xe)].join(" && ")})`}function Te(S){return`check_${d.Encode(S)}`}function Se(S){let ye=`local_${ie.variables.size}`;return ie.variables.set(ye,`const ${ye} = ${S}`),ye}function Ve(S,ye,C,xe,se=!0){let[ge,De]=[`
|
|
49
|
-
`,mt=>"".padStart(mt," ")],He=Je("value","any"),yt=an("boolean"),ct=[...J(ye,C,xe,se)].map(mt=>`${De(4)}${mt}`).join(` &&${ge}`);return`function ${S}(${He})${yt} {${ge}${De(2)}return (${ge}${ct}${ge}${De(2)})
|
|
50
|
-
}`}function Je(S,ye){let C=ie.language==="typescript"?`: ${ye}`:"";return`${S}${C}`}function an(S){return ie.language==="typescript"?`: ${S}`:""}function Oe(S,ye,C){let xe=Ve("check",S,ye,"value"),se=Je("value","any"),ge=an("boolean"),De=[...ie.functions.values()],He=[...ie.variables.values()],yt=(0,r.IsString)(S.$id)?`return function check(${se})${ge} {
|
|
51
|
-
return ${Te(S.$id)}(value)
|
|
52
|
-
}`:`return ${xe}`;return[...He,...De,yt].join(`
|
|
53
|
-
`)}function Ur(...S){let ye={language:"javascript"},[C,xe,se]=S.length===2&&(0,r.IsArray)(S[1])?[S[0],S[1],ye]:S.length===2&&!(0,r.IsArray)(S[1])?[S[0],[],S[1]]:S.length===3?[S[0],S[1],S[2]]:S.length===1?[S[0],[],ye]:[null,[],ye];if(ie.language=se.language,ie.variables.clear(),ie.functions.clear(),ie.instances.clear(),!s.TypeGuard.TSchema(C))throw new T(C);for(let ge of xe)if(!s.TypeGuard.TSchema(ge))throw new T(ge);return Oe(C,xe,se)}B.Code=Ur;function sn(S,ye=[]){let C=Ur(S,ye,{language:"javascript"}),xe=globalThis.Function("kind","format","hash",C),se=new Map(ie.instances);function ge(ct,mt,Pr){if(!s.TypeRegistry.Has(ct)||!se.has(mt))return!1;let Gn=s.TypeRegistry.Get(ct),qn=se.get(mt);return Gn(qn,Pr)}function De(ct,mt){return s.FormatRegistry.Has(ct)?s.FormatRegistry.Get(ct)(mt):!1}function He(ct){return(0,a.Hash)(ct)}let yt=xe(ge,De,He);return new u(S,ye,yt,C)}B.Compile=sn})(H||(e.TypeCompiler=H={}))}}),i2=rt({"../../../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=e2();Object.defineProperty(e,"ValueErrorType",{enumerable:!0,get:function(){return n.ValueErrorType}}),Object.defineProperty(e,"ValueErrorIterator",{enumerable:!0,get:function(){return n.ValueErrorIterator}}),r(n2(),e)}}),$a=$r(Qw(),1),o2=$r(Zw(),1),nh=!1,ih=!1;$a.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(nh=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(ih=process?.env?.LOGGER_PERF_PREFIX==="true"));var a2={prefix:void 0,time:nh,delta:ih,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},Ws=[],oh=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(",")}]`}},ah=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Wi=!1,Ce=class bt{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=bt.INFO,r={}){r=Object.assign({},a2,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(...I){let E=I[I.length-1];return E===i?E():(o(...I.slice(0,-1)),(async()=>{try{let T=E();return T instanceof Promise?await T:T}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=bt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error(u.map(l=>typeof l=="string"?l:(0,o2.default)(l)).join(" "))),WARN:a(t>=bt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=bt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=bt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=bt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if($a.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=$a.isBrowser&&navigator.userAgent.includes("Chrome")?["",bt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Wi?n.push(new ah("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();bt.firstLog||(bt.firstLog=i,bt.lastLog=i);let o=new oh(i-bt.firstLog,i-bt.lastLog,t,r);return bt.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}}}};$a.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(Ws&&Ws.length){for(let t of Ws)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof oh))return null;Wi||(Wi=!0);let t=Ce.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof ah?(Wi||(Wi=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var s2=typeof global=="object"&&global&&global.Object===Object&&global,sh=s2,u2=typeof self=="object"&&self&&self.Object===Object&&self,l2=sh||u2||Function("return this")(),At=l2,c2=At.Symbol,hr=c2,uh=Object.prototype,f2=uh.hasOwnProperty,d2=uh.toString,Vi=hr?hr.toStringTag:void 0;function p2(e){var t=f2.call(e,Vi),r=e[Vi];try{e[Vi]=void 0;var n=!0}catch{}var i=d2.call(e);return n&&(t?e[Vi]=r:delete e[Vi]),i}var h2=p2,y2=Object.prototype,g2=y2.toString;function m2(e){return g2.call(e)}var b2=m2,v2="[object Null]",w2="[object Undefined]",lf=hr?hr.toStringTag:void 0;function _2(e){return e==null?e===void 0?w2:v2:lf&&lf in Object(e)?h2(e):b2(e)}var xi=_2;function T2(e){return e!=null&&typeof e=="object"}var Zr=T2,E2="[object Symbol]";function x2(e){return typeof e=="symbol"||Zr(e)&&xi(e)==E2}var ni=x2;function O2(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 lh=O2,A2=Array.isArray,sr=A2,S2=1/0,cf=hr?hr.prototype:void 0,ff=cf?cf.toString:void 0;function ch(e){if(typeof e=="string")return e;if(sr(e))return lh(e,ch)+"";if(ni(e))return ff?ff.call(e):"";var t=e+"";return t=="0"&&1/e==-S2?"-0":t}var I2=ch,k2=/\s/;function j2(e){for(var t=e.length;t--&&k2.test(e.charAt(t)););return t}var $2=j2,C2=/^\s+/;function N2(e){return e&&e.slice(0,$2(e)+1).replace(C2,"")}var U2=N2;function P2(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ar=P2,df=NaN,B2=/^[-+]0x[0-9a-f]+$/i,D2=/^0b[01]+$/i,R2=/^0o[0-7]+$/i,M2=parseInt;function L2(e){if(typeof e=="number")return e;if(ni(e))return df;if(Ar(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ar(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=U2(e);var r=D2.test(e);return r||R2.test(e)?M2(e.slice(2),r?2:8):B2.test(e)?df:+e}var V2=L2,pf=1/0,F2=17976931348623157e292;function z2(e){if(!e)return e===0?e:0;if(e=V2(e),e===pf||e===-pf){var t=e<0?-1:1;return t*F2}return e===e?e:0}var K2=z2;function G2(e){var t=K2(e),r=t%1;return t===t?r?t-r:t:0}var hf=G2;function q2(e){return e}var bs=q2,W2="[object AsyncFunction]",J2="[object Function]",H2="[object GeneratorFunction]",X2="[object Proxy]";function Q2(e){if(!Ar(e))return!1;var t=xi(e);return t==J2||t==H2||t==W2||t==X2}var fh=Q2,Z2=At["__core-js_shared__"],Js=Z2,yf=function(){var e=/[^.]+$/.exec(Js&&Js.keys&&Js.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Y2(e){return!!yf&&yf in e}var e_=Y2,t_=Function.prototype,r_=t_.toString;function n_(e){if(e!=null){try{return r_.call(e)}catch{}try{return e+""}catch{}}return""}var Nn=n_,i_=/[\\^$.*+?()[\]{}|]/g,o_=/^\[object .+?Constructor\]$/,a_=Function.prototype,s_=Object.prototype,u_=a_.toString,l_=s_.hasOwnProperty,c_=RegExp("^"+u_.call(l_).replace(i_,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f_(e){if(!Ar(e)||e_(e))return!1;var t=fh(e)?c_:o_;return t.test(Nn(e))}var d_=f_;function p_(e,t){return e?.[t]}var h_=p_;function y_(e,t){var r=h_(e,t);return d_(r)?r:void 0}var Un=y_,g_=Un(At,"WeakMap"),oo=g_,m_=oo&&new oo,Ca=m_,b_=Ca?function(e,t){return Ca.set(e,t),e}:bs,dh=b_,gf=Object.create,v_=function(){function e(){}return function(t){if(!Ar(t))return{};if(gf)return gf(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}(),Il=v_;function w_(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=Il(e.prototype),n=e.apply(r,t);return Ar(n)?n:r}}var ao=w_,__=1;function T_(e,t,r){var n=t&__,i=ao(e);function o(){var a=this&&this!==At&&this instanceof o?i:e;return a.apply(n?r:this,arguments)}return o}var E_=T_;function x_(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 kl=x_,O_=Math.max;function A_(e,t,r,n){for(var i=-1,o=e.length,a=r.length,s=-1,u=t.length,l=O_(o-a,0),f=Array(u+l),d=!n;++s<u;)f[s]=t[s];for(;++i<a;)(d||i<o)&&(f[r[i]]=e[i]);for(;l--;)f[s++]=e[i++];return f}var ph=A_,S_=Math.max;function I_(e,t,r,n){for(var i=-1,o=e.length,a=-1,s=r.length,u=-1,l=t.length,f=S_(o-s,0),d=Array(f+l),I=!n;++i<f;)d[i]=e[i];for(var E=i;++u<l;)d[E+u]=t[u];for(;++a<s;)(I||i<o)&&(d[E+r[a]]=e[i++]);return d}var hh=I_;function k_(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var j_=k_;function $_(){}var jl=$_,C_=4294967295;function Na(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=C_,this.__views__=[]}Na.prototype=Il(jl.prototype);Na.prototype.constructor=Na;var $l=Na;function N_(){}var yh=N_,U_=Ca?function(e){return Ca.get(e)}:yh,gh=U_,P_={},mf=P_,B_=Object.prototype,D_=B_.hasOwnProperty;function R_(e){for(var t=e.name+"",r=mf[t],n=D_.call(mf,t)?r.length:0;n--;){var i=r[n],o=i.func;if(o==null||o==e)return i.name}return t}var M_=R_;function Ua(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}Ua.prototype=Il(jl.prototype);Ua.prototype.constructor=Ua;var Su=Ua;function L_(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}var mh=L_;function V_(e){if(e instanceof $l)return e.clone();var t=new Su(e.__wrapped__,e.__chain__);return t.__actions__=mh(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var F_=V_,z_=Object.prototype,K_=z_.hasOwnProperty;function Pa(e){if(Zr(e)&&!sr(e)&&!(e instanceof $l)){if(e instanceof Su)return e;if(K_.call(e,"__wrapped__"))return F_(e)}return new Su(e)}Pa.prototype=jl.prototype;Pa.prototype.constructor=Pa;var G_=Pa;function q_(e){var t=M_(e),r=G_[t];if(typeof r!="function"||!(t in $l.prototype))return!1;if(e===r)return!0;var n=gh(r);return!!n&&e===n[0]}var W_=q_,J_=800,H_=16,X_=Date.now;function Q_(e){var t=0,r=0;return function(){var n=X_(),i=H_-(n-r);if(r=n,i>0){if(++t>=J_)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var bh=Q_,Z_=bh(dh),vh=Z_,Y_=/\{\n\/\* \[wrapped with (.+)\] \*/,eT=/,? & /;function tT(e){var t=e.match(Y_);return t?t[1].split(eT):[]}var rT=tT,nT=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function iT(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(nT,`{
|
|
55
|
-
/* [wrapped with `+t+`] */
|
|
56
|
-
`)}var oT=iT;function aT(e){return function(){return e}}var sT=aT,uT=function(){try{var e=Un(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Ba=uT,lT=Ba?function(e,t){return Ba(e,"toString",{configurable:!0,enumerable:!1,value:sT(t),writable:!0})}:bs,cT=lT,fT=bh(cT),Cl=fT;function dT(e,t){for(var r=-1,n=e==null?0:e.length;++r<n&&t(e[r],r,e)!==!1;);return e}var pT=dT;function hT(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 yT=hT;function gT(e){return e!==e}var mT=gT;function bT(e,t,r){for(var n=r-1,i=e.length;++n<i;)if(e[n]===t)return n;return-1}var vT=bT;function wT(e,t,r){return t===t?vT(e,t,r):yT(e,mT,r)}var _T=wT;function TT(e,t){var r=e==null?0:e.length;return!!r&&_T(e,t,0)>-1}var wh=TT,ET=1,xT=2,OT=8,AT=16,ST=32,IT=64,kT=128,jT=256,$T=512,CT=[["ary",kT],["bind",ET],["bindKey",xT],["curry",OT],["curryRight",AT],["flip",$T],["partial",ST],["partialRight",IT],["rearg",jT]];function NT(e,t){return pT(CT,function(r){var n="_."+r[0];t&r[1]&&!wh(e,n)&&e.push(n)}),e.sort()}var UT=NT;function PT(e,t,r){var n=t+"";return Cl(e,oT(n,UT(rT(n),r)))}var _h=PT,BT=1,DT=2,RT=4,MT=8,bf=32,vf=64;function LT(e,t,r,n,i,o,a,s,u,l){var f=t&MT,d=f?a:void 0,I=f?void 0:a,E=f?o:void 0,T=f?void 0:o;t|=f?bf:vf,t&=~(f?vf:bf),t&RT||(t&=~(BT|DT));var L=[e,t,i,E,d,T,I,s,u,l],H=r.apply(void 0,L);return W_(e)&&vh(H,L),H.placeholder=n,_h(H,e,t)}var Th=LT;function VT(e){var t=e;return t.placeholder}var Nl=VT,FT=9007199254740991,zT=/^(?:0|[1-9]\d*)$/;function KT(e,t){var r=typeof e;return t=t??FT,!!t&&(r=="number"||r!="symbol"&&zT.test(e))&&e>-1&&e%1==0&&e<t}var vs=KT,GT=Math.min;function qT(e,t){for(var r=e.length,n=GT(t.length,r),i=mh(e);n--;){var o=t[n];e[n]=vs(o,r)?i[o]:void 0}return e}var WT=qT,wf="__lodash_placeholder__";function JT(e,t){for(var r=-1,n=e.length,i=0,o=[];++r<n;){var a=e[r];(a===t||a===wf)&&(e[r]=wf,o[i++]=r)}return o}var so=JT,HT=1,XT=2,QT=8,ZT=16,YT=128,eE=512;function Eh(e,t,r,n,i,o,a,s,u,l){var f=t&YT,d=t&HT,I=t&XT,E=t&(QT|ZT),T=t&eE,L=I?void 0:ao(e);function H(){for(var B=arguments.length,k=Array(B),F=B;F--;)k[F]=arguments[F];if(E)var G=Nl(H),D=j_(k,G);if(n&&(k=ph(k,n,i,E)),o&&(k=hh(k,o,a,E)),B-=D,E&&B<l){var Q=so(k,G);return Th(e,t,Eh,H.placeholder,r,k,Q,s,u,l-B)}var K=d?r:this,re=I?K[e]:e;return B=k.length,s?k=WT(k,s):T&&B>1&&k.reverse(),f&&u<B&&(k.length=u),this&&this!==At&&this instanceof H&&(re=L||ao(re)),re.apply(K,k)}return H}var xh=Eh;function tE(e,t,r){var n=ao(e);function i(){for(var o=arguments.length,a=Array(o),s=o,u=Nl(i);s--;)a[s]=arguments[s];var l=o<3&&a[0]!==u&&a[o-1]!==u?[]:so(a,u);if(o-=l.length,o<r)return Th(e,t,xh,i.placeholder,void 0,a,l,void 0,void 0,r-o);var f=this&&this!==At&&this instanceof i?n:e;return kl(f,this,a)}return i}var rE=tE,nE=1;function iE(e,t,r,n){var i=t&nE,o=ao(e);function a(){for(var s=-1,u=arguments.length,l=-1,f=n.length,d=Array(f+u),I=this&&this!==At&&this instanceof a?o:e;++l<f;)d[l]=n[l];for(;u--;)d[l++]=arguments[++s];return kl(I,i?r:this,d)}return a}var oE=iE,_f="__lodash_placeholder__",Hs=1,aE=2,sE=4,Tf=8,Fi=128,Ef=256,uE=Math.min;function lE(e,t){var r=e[1],n=t[1],i=r|n,o=i<(Hs|aE|Fi),a=n==Fi&&r==Tf||n==Fi&&r==Ef&&e[7].length<=t[8]||n==(Fi|Ef)&&t[7].length<=t[8]&&r==Tf;if(!(o||a))return e;n&Hs&&(e[2]=t[2],i|=r&Hs?0:sE);var s=t[3];if(s){var u=e[3];e[3]=u?ph(u,s,t[4]):s,e[4]=u?so(e[3],_f):t[4]}return s=t[5],s&&(u=e[5],e[5]=u?hh(u,s,t[6]):s,e[6]=u?so(e[5],_f):t[6]),s=t[7],s&&(e[7]=s),n&Fi&&(e[8]=e[8]==null?t[8]:uE(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=i,e}var cE=lE,fE="Expected a function",xf=1,dE=2,Xs=8,Qs=16,Zs=32,Of=64,Af=Math.max;function pE(e,t,r,n,i,o,a,s){var u=t&dE;if(!u&&typeof e!="function")throw new TypeError(fE);var l=n?n.length:0;if(l||(t&=~(Zs|Of),n=i=void 0),a=a===void 0?a:Af(hf(a),0),s=s===void 0?s:hf(s),l-=i?i.length:0,t&Of){var f=n,d=i;n=i=void 0}var I=u?void 0:gh(e),E=[e,t,r,n,i,f,d,o,a,s];if(I&&cE(E,I),e=E[0],t=E[1],r=E[2],n=E[3],i=E[4],s=E[9]=E[9]===void 0?u?0:e.length:Af(E[9]-l,0),!s&&t&(Xs|Qs)&&(t&=~(Xs|Qs)),!t||t==xf)var T=E_(e,t,r);else t==Xs||t==Qs?T=rE(e,t,s):(t==Zs||t==(xf|Zs))&&!i.length?T=oE(e,t,r,n):T=xh.apply(void 0,E);var L=I?dh:vh;return _h(L(T,E),e,t)}var hE=pE;function yE(e,t,r){t=="__proto__"&&Ba?Ba(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}var gE=yE;function mE(e,t){return e===t||e!==e&&t!==t}var Ul=mE,bE=Object.prototype,vE=bE.hasOwnProperty;function wE(e,t,r){var n=e[t];(!(vE.call(e,t)&&Ul(n,r))||r===void 0&&!(t in e))&&gE(e,t,r)}var _E=wE,Sf=Math.max;function TE(e,t,r){return t=Sf(t===void 0?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=Sf(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),kl(e,this,s)}}var Oh=TE;function EE(e,t){return Cl(Oh(e,t,bs),e+"")}var Ah=EE,xE=9007199254740991;function OE(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=xE}var Pl=OE;function AE(e){return e!=null&&Pl(e.length)&&!fh(e)}var Sh=AE,SE=Object.prototype;function IE(e){var t=e&&e.constructor,r=typeof t=="function"&&t.prototype||SE;return e===r}var kE=IE;function jE(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}var $E=jE,CE="[object Arguments]";function NE(e){return Zr(e)&&xi(e)==CE}var If=NE,Ih=Object.prototype,UE=Ih.hasOwnProperty,PE=Ih.propertyIsEnumerable,BE=If(function(){return arguments}())?If:function(e){return Zr(e)&&UE.call(e,"callee")&&!PE.call(e,"callee")},Bl=BE;function DE(){return!1}var RE=DE,kh=typeof exports=="object"&&exports&&!exports.nodeType&&exports,kf=kh&&typeof module=="object"&&module&&!module.nodeType&&module,ME=kf&&kf.exports===kh,jf=ME?At.Buffer:void 0,LE=jf?jf.isBuffer:void 0,VE=LE||RE,Iu=VE,FE="[object Arguments]",zE="[object Array]",KE="[object Boolean]",GE="[object Date]",qE="[object Error]",WE="[object Function]",JE="[object Map]",HE="[object Number]",XE="[object Object]",QE="[object RegExp]",ZE="[object Set]",YE="[object String]",ex="[object WeakMap]",tx="[object ArrayBuffer]",rx="[object DataView]",nx="[object Float32Array]",ix="[object Float64Array]",ox="[object Int8Array]",ax="[object Int16Array]",sx="[object Int32Array]",ux="[object Uint8Array]",lx="[object Uint8ClampedArray]",cx="[object Uint16Array]",fx="[object Uint32Array]",Fe={};Fe[nx]=Fe[ix]=Fe[ox]=Fe[ax]=Fe[sx]=Fe[ux]=Fe[lx]=Fe[cx]=Fe[fx]=!0;Fe[FE]=Fe[zE]=Fe[tx]=Fe[KE]=Fe[rx]=Fe[GE]=Fe[qE]=Fe[WE]=Fe[JE]=Fe[HE]=Fe[XE]=Fe[QE]=Fe[ZE]=Fe[YE]=Fe[ex]=!1;function dx(e){return Zr(e)&&Pl(e.length)&&!!Fe[xi(e)]}var px=dx;function hx(e){return function(t){return e(t)}}var jh=hx,$h=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zi=$h&&typeof module=="object"&&module&&!module.nodeType&&module,yx=Zi&&Zi.exports===$h,Ys=yx&&sh.process,gx=function(){try{var e=Zi&&Zi.require&&Zi.require("util").types;return e||Ys&&Ys.binding&&Ys.binding("util")}catch{}}(),$f=gx,Cf=$f&&$f.isTypedArray,mx=Cf?jh(Cf):px,Ch=mx,bx=Object.prototype,vx=bx.hasOwnProperty;function wx(e,t){var r=sr(e),n=!r&&Bl(e),i=!r&&!n&&Iu(e),o=!r&&!n&&!i&&Ch(e),a=r||n||i||o,s=a?$E(e.length,String):[],u=s.length;for(var l in e)(t||vx.call(e,l))&&!(a&&(l=="length"||i&&(l=="offset"||l=="parent")||o&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||vs(l,u)))&&s.push(l);return s}var _x=wx;function Tx(e,t){return function(r){return e(t(r))}}var Ex=Tx,xx=Ex(Object.keys,Object),Ox=xx,Ax=Object.prototype,Sx=Ax.hasOwnProperty;function Ix(e){if(!kE(e))return Ox(e);var t=[];for(var r in Object(e))Sx.call(e,r)&&r!="constructor"&&t.push(r);return t}var kx=Ix;function jx(e){return Sh(e)?_x(e):kx(e)}var Nh=jx,$x=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Cx=/^\w*$/;function Nx(e,t){if(sr(e))return!1;var r=typeof e;return r=="number"||r=="symbol"||r=="boolean"||e==null||ni(e)?!0:Cx.test(e)||!$x.test(e)||t!=null&&e in Object(t)}var Dl=Nx,Ux=Un(Object,"create"),uo=Ux;function Px(){this.__data__=uo?uo(null):{},this.size=0}var Bx=Px;function Dx(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Rx=Dx,Mx="__lodash_hash_undefined__",Lx=Object.prototype,Vx=Lx.hasOwnProperty;function Fx(e){var t=this.__data__;if(uo){var r=t[e];return r===Mx?void 0:r}return Vx.call(t,e)?t[e]:void 0}var zx=Fx,Kx=Object.prototype,Gx=Kx.hasOwnProperty;function qx(e){var t=this.__data__;return uo?t[e]!==void 0:Gx.call(t,e)}var Wx=qx,Jx="__lodash_hash_undefined__";function Hx(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=uo&&t===void 0?Jx:t,this}var Xx=Hx;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=Bx;Oi.prototype.delete=Rx;Oi.prototype.get=zx;Oi.prototype.has=Wx;Oi.prototype.set=Xx;var Nf=Oi;function Qx(){this.__data__=[],this.size=0}var Zx=Qx;function Yx(e,t){for(var r=e.length;r--;)if(Ul(e[r][0],t))return r;return-1}var ws=Yx,eO=Array.prototype,tO=eO.splice;function rO(e){var t=this.__data__,r=ws(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():tO.call(t,r,1),--this.size,!0}var nO=rO;function iO(e){var t=this.__data__,r=ws(t,e);return r<0?void 0:t[r][1]}var oO=iO;function aO(e){return ws(this.__data__,e)>-1}var sO=aO;function uO(e,t){var r=this.__data__,n=ws(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this}var lO=uO;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=Zx;Ai.prototype.delete=nO;Ai.prototype.get=oO;Ai.prototype.has=sO;Ai.prototype.set=lO;var _s=Ai,cO=Un(At,"Map"),lo=cO;function fO(){this.size=0,this.__data__={hash:new Nf,map:new(lo||_s),string:new Nf}}var dO=fO;function pO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var hO=pO;function yO(e,t){var r=e.__data__;return hO(t)?r[typeof t=="string"?"string":"hash"]:r.map}var Ts=yO;function gO(e){var t=Ts(this,e).delete(e);return this.size-=t?1:0,t}var mO=gO;function bO(e){return Ts(this,e).get(e)}var vO=bO;function wO(e){return Ts(this,e).has(e)}var _O=wO;function TO(e,t){var r=Ts(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this}var EO=TO;function Si(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])}}Si.prototype.clear=dO;Si.prototype.delete=mO;Si.prototype.get=vO;Si.prototype.has=_O;Si.prototype.set=EO;var Es=Si,xO="Expected a function";function Rl(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(xO);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(Rl.Cache||Es),r}Rl.Cache=Es;var OO=Rl,AO=500;function SO(e){var t=OO(e,function(n){return r.size===AO&&r.clear(),n}),r=t.cache;return t}var IO=SO,kO=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,jO=/\\(\\)?/g,$O=IO(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(kO,function(r,n,i,o){t.push(i?o.replace(jO,"$1"):n||r)}),t}),CO=$O;function NO(e){return e==null?"":I2(e)}var UO=NO;function PO(e,t){return sr(e)?e:Dl(e,t)?[e]:CO(UO(e))}var xs=PO,BO=1/0;function DO(e){if(typeof e=="string"||ni(e))return e;var t=e+"";return t=="0"&&1/e==-BO?"-0":t}var jo=DO;function RO(e,t){t=xs(t,e);for(var r=0,n=t.length;e!=null&&r<n;)e=e[jo(t[r++])];return r&&r==n?e:void 0}var Ml=RO;function MO(e,t,r){var n=e==null?void 0:Ml(e,t);return n===void 0?r:n}var LO=MO;function VO(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}var Uh=VO,Uf=hr?hr.isConcatSpreadable:void 0;function FO(e){return sr(e)||Bl(e)||!!(Uf&&e&&e[Uf])}var zO=FO;function Ph(e,t,r,n,i){var o=-1,a=e.length;for(r||(r=zO),i||(i=[]);++o<a;){var s=e[o];t>0&&r(s)?t>1?Ph(s,t-1,r,n,i):Uh(i,s):n||(i[i.length]=s)}return i}var KO=Ph;function GO(e){var t=e==null?0:e.length;return t?KO(e,1):[]}var qO=GO;function WO(e){return Cl(Oh(e,void 0,qO),e+"")}var JO=WO;function HO(){this.__data__=new _s,this.size=0}var XO=HO;function QO(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}var ZO=QO;function YO(e){return this.__data__.get(e)}var eA=YO;function tA(e){return this.__data__.has(e)}var rA=tA,nA=200;function iA(e,t){var r=this.__data__;if(r instanceof _s){var n=r.__data__;if(!lo||n.length<nA-1)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Es(n)}return r.set(e,t),this.size=r.size,this}var oA=iA;function Ii(e){var t=this.__data__=new _s(e);this.size=t.size}Ii.prototype.clear=XO;Ii.prototype.delete=ZO;Ii.prototype.get=eA;Ii.prototype.has=rA;Ii.prototype.set=oA;var ea=Ii;function aA(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 sA=aA;function uA(){return[]}var lA=uA,cA=Object.prototype,fA=cA.propertyIsEnumerable,Pf=Object.getOwnPropertySymbols,dA=Pf?function(e){return e==null?[]:(e=Object(e),sA(Pf(e),function(t){return fA.call(e,t)}))}:lA,pA=dA;function hA(e,t,r){var n=t(e);return sr(e)?n:Uh(n,r(e))}var yA=hA;function gA(e){return yA(e,Nh,pA)}var Bf=gA,mA=Un(At,"DataView"),ku=mA,bA=Un(At,"Promise"),ju=bA,vA=Un(At,"Set"),Yn=vA,Df="[object Map]",wA="[object Object]",Rf="[object Promise]",Mf="[object Set]",Lf="[object WeakMap]",Vf="[object DataView]",_A=Nn(ku),TA=Nn(lo),EA=Nn(ju),xA=Nn(Yn),OA=Nn(oo),pn=xi;(ku&&pn(new ku(new ArrayBuffer(1)))!=Vf||lo&&pn(new lo)!=Df||ju&&pn(ju.resolve())!=Rf||Yn&&pn(new Yn)!=Mf||oo&&pn(new oo)!=Lf)&&(pn=function(e){var t=xi(e),r=t==wA?e.constructor:void 0,n=r?Nn(r):"";if(n)switch(n){case _A:return Vf;case TA:return Df;case EA:return Rf;case xA:return Mf;case OA:return Lf}return t});var Ff=pn,AA=At.Uint8Array,zf=AA,SA="__lodash_hash_undefined__";function IA(e){return this.__data__.set(e,SA),this}var kA=IA;function jA(e){return this.__data__.has(e)}var $A=jA;function Da(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new Es;++t<r;)this.add(e[t])}Da.prototype.add=Da.prototype.push=kA;Da.prototype.has=$A;var Bh=Da;function CA(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 NA=CA;function UA(e,t){return e.has(t)}var Dh=UA,PA=1,BA=2;function DA(e,t,r,n,i,o){var a=r&PA,s=e.length,u=t.length;if(s!=u&&!(a&&u>s))return!1;var l=o.get(e),f=o.get(t);if(l&&f)return l==t&&f==e;var d=-1,I=!0,E=r&BA?new Bh:void 0;for(o.set(e,t),o.set(t,e);++d<s;){var T=e[d],L=t[d];if(n)var H=a?n(L,T,d,t,e,o):n(T,L,d,e,t,o);if(H!==void 0){if(H)continue;I=!1;break}if(E){if(!NA(t,function(B,k){if(!Dh(E,k)&&(T===B||i(T,B,r,n,o)))return E.push(k)})){I=!1;break}}else if(!(T===L||i(T,L,r,n,o))){I=!1;break}}return o.delete(e),o.delete(t),I}var Rh=DA;function RA(e){var t=-1,r=Array(e.size);return e.forEach(function(n,i){r[++t]=[i,n]}),r}var MA=RA;function LA(e){var t=-1,r=Array(e.size);return e.forEach(function(n){r[++t]=n}),r}var Mh=LA,VA=1,FA=2,zA="[object Boolean]",KA="[object Date]",GA="[object Error]",qA="[object Map]",WA="[object Number]",JA="[object RegExp]",HA="[object Set]",XA="[object String]",QA="[object Symbol]",ZA="[object ArrayBuffer]",YA="[object DataView]",Kf=hr?hr.prototype:void 0,eu=Kf?Kf.valueOf:void 0;function eS(e,t,r,n,i,o,a){switch(r){case YA:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ZA:return!(e.byteLength!=t.byteLength||!o(new zf(e),new zf(t)));case zA:case KA:case WA:return Ul(+e,+t);case GA:return e.name==t.name&&e.message==t.message;case JA:case XA:return e==t+"";case qA:var s=MA;case HA:var u=n&VA;if(s||(s=Mh),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;n|=FA,a.set(e,t);var f=Rh(s(e),s(t),n,i,o,a);return a.delete(e),f;case QA:if(eu)return eu.call(e)==eu.call(t)}return!1}var tS=eS,rS=1,nS=Object.prototype,iS=nS.hasOwnProperty;function oS(e,t,r,n,i,o){var a=r&rS,s=Bf(e),u=s.length,l=Bf(t),f=l.length;if(u!=f&&!a)return!1;for(var d=u;d--;){var I=s[d];if(!(a?I in t:iS.call(t,I)))return!1}var E=o.get(e),T=o.get(t);if(E&&T)return E==t&&T==e;var L=!0;o.set(e,t),o.set(t,e);for(var H=a;++d<u;){I=s[d];var B=e[I],k=t[I];if(n)var F=a?n(k,B,I,t,e,o):n(B,k,I,e,t,o);if(!(F===void 0?B===k||i(B,k,r,n,o):F)){L=!1;break}H||(H=I=="constructor")}if(L&&!H){var G=e.constructor,D=t.constructor;G!=D&&"constructor"in e&&"constructor"in t&&!(typeof G=="function"&&G instanceof G&&typeof D=="function"&&D instanceof D)&&(L=!1)}return o.delete(e),o.delete(t),L}var aS=oS,sS=1,Gf="[object Arguments]",qf="[object Array]",Wo="[object Object]",uS=Object.prototype,Wf=uS.hasOwnProperty;function lS(e,t,r,n,i,o){var a=sr(e),s=sr(t),u=a?qf:Ff(e),l=s?qf:Ff(t);u=u==Gf?Wo:u,l=l==Gf?Wo:l;var f=u==Wo,d=l==Wo,I=u==l;if(I&&Iu(e)){if(!Iu(t))return!1;a=!0,f=!1}if(I&&!f)return o||(o=new ea),a||Ch(e)?Rh(e,t,r,n,i,o):tS(e,t,u,r,n,i,o);if(!(r&sS)){var E=f&&Wf.call(e,"__wrapped__"),T=d&&Wf.call(t,"__wrapped__");if(E||T){var L=E?e.value():e,H=T?t.value():t;return o||(o=new ea),i(L,H,r,n,o)}}return I?(o||(o=new ea),aS(e,t,r,n,i,o)):!1}var cS=lS;function Lh(e,t,r,n,i){return e===t?!0:e==null||t==null||!Zr(e)&&!Zr(t)?e!==e&&t!==t:cS(e,t,r,n,Lh,i)}var Vh=Lh,fS=1,dS=2;function pS(e,t,r,n){var i=r.length,o=i,a=!n;if(e==null)return!o;for(e=Object(e);i--;){var s=r[i];if(a&&s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++i<o;){s=r[i];var u=s[0],l=e[u],f=s[1];if(a&&s[2]){if(l===void 0&&!(u in e))return!1}else{var d=new ea;if(n)var I=n(l,f,u,e,t,d);if(!(I===void 0?Vh(f,l,fS|dS,n,d):I))return!1}}return!0}var hS=pS;function yS(e){return e===e&&!Ar(e)}var Fh=yS;function gS(e){for(var t=Nh(e),r=t.length;r--;){var n=t[r],i=e[n];t[r]=[n,i,Fh(i)]}return t}var mS=gS;function bS(e,t){return function(r){return r==null?!1:r[e]===t&&(t!==void 0||e in Object(r))}}var zh=bS;function vS(e){var t=mS(e);return t.length==1&&t[0][2]?zh(t[0][0],t[0][1]):function(r){return r===e||hS(r,e,t)}}var wS=vS;function _S(e,t){return e!=null&&t in Object(e)}var TS=_S;function ES(e,t,r){t=xs(t,e);for(var n=-1,i=t.length,o=!1;++n<i;){var a=jo(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&&Pl(i)&&vs(a,i)&&(sr(e)||Bl(e)))}var xS=ES;function OS(e,t){return e!=null&&xS(e,t,TS)}var Kh=OS,AS=1,SS=2;function IS(e,t){return Dl(e)&&Fh(t)?zh(jo(e),t):function(r){var n=LO(r,e);return n===void 0&&n===t?Kh(r,e):Vh(t,n,AS|SS)}}var kS=IS;function jS(e){return function(t){return t?.[e]}}var $S=jS;function CS(e){return function(t){return Ml(t,e)}}var NS=CS;function US(e){return Dl(e)?$S(jo(e)):NS(e)}var PS=US;function BS(e){return typeof e=="function"?e:e==null?bs:typeof e=="object"?sr(e)?kS(e[0],e[1]):wS(e):PS(e)}var DS=BS;function RS(e){return Zr(e)&&Sh(e)}var MS=RS;function LS(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 VS=LS,FS=200;function zS(e,t,r,n){var i=-1,o=wh,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;r&&(t=lh(t,jh(r))),n?(o=VS,a=!1):t.length>=FS&&(o=Dh,a=!1,t=new Bh(t));e:for(;++i<s;){var f=e[i],d=r==null?f:r(f);if(f=n||f!==0?f:0,a&&d===d){for(var I=l;I--;)if(t[I]===d)continue e;u.push(f)}else o(t,d,n)||u.push(f)}return u}var KS=zS;function GS(e,t,r,n){if(!Ar(e))return e;t=xs(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var u=jo(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=Ar(f)?f:vs(t[i+1])?[]:{})}_E(s,u,l),s=s[u]}return e}var qS=GS;function WS(e,t,r){for(var n=-1,i=t.length,o={};++n<i;){var a=t[n],s=Ml(e,a);r(s,a)&&qS(o,xs(a,e),s)}return o}var JS=WS,HS=32,Ll=Ah(function(e,t){var r=so(t,Nl(Ll));return hE(e,HS,void 0,t,r)});Ll.placeholder={};var XS=Ll;function QS(e,t){return JS(e,t,function(r,n){return Kh(e,n)})}var ZS=QS,YS=JO(function(e,t){return e==null?{}:ZS(e,t)}),Jf=YS,eI=4294967295,tI=eI-1,rI=Math.floor,nI=Math.min;function iI(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=ni(t),l=t===void 0;i<o;){var f=rI((i+o)/2),d=r(e[f]),I=d!==void 0,E=d===null,T=d===d,L=ni(d);if(a)var H=n||T;else l?H=T&&(n||I):s?H=T&&I&&(n||!E):u?H=T&&I&&!E&&(n||!L):E||L?H=!1:H=n?d<=t:d<t;H?i=f+1:o=f}return nI(o,tI)}var oI=iI;function aI(e,t,r){return oI(e,t,DS(r,2))}var sI=aI,uI=1/0,JN=Yn&&1/Mh(new Yn([,-0]))[1]==uI?function(e){return new Yn(e)}:yh,lI=Ah(function(e,t){return MS(e)?KS(e,t):[]}),Hf=lI,Gh=$r(Yw(),1),HN=Gh.default.configure,co=Gh.default,tu=100,{WARN:cI,LOG:XN,DEBUG:tt,VERBOSE:Ae,ERROR:QN}=Ce.setup(Ce.INFO),Ra=Ke.set();pw({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})=>ze(()=>(n=n||r,`${!Array.isArray(t)&&t?.name?t.name+" | ":""}${e??"caller?"}${n?`{${typeof n=="string"?n:co(n)}}`:""}`));function fI(e,t){return ze(()=>Ze.structural(e.get(),t.get()))}function $o(e,t){return Ze.shallow(e.applogs,t.applogs)}function Vl(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(Ae.isEnabled&&Ae("queryNodesComparer",r,n,i),!Ze.structural(n.variables,i.variables))return Ae.isEnabled&&Ae("[queryNodesComparer] changed vars:",r,n,i),!1;if(!$o(n.logsOfThisNode,i.logsOfThisNode))return Ae.isEnabled&&Ae("[queryNodesComparer] changed logsOfThisNode:",r,n,i),!1}return Ae.isEnabled&&Ae("[queryNodesComparer] equal:",{a:e,b:t}),!0}var dI=0;function tr(e,{name:t,equals:r}={}){let n=`observableArrayMap@${++dI}{${t}}`;Ae.isEnabled&&Ae(`[${n}] create`,{fnname:e.name,fn:e,name:t,equals:r});let i,o=qh(e,s=>{i?ze(()=>(r??Ze.structural)(i,s))?tt.isEnabled&&tt(`[${n}] update skipped`,{updatedItems:s,observableArr:i}):(i.replace(s),tt.isEnabled&&tt(`[${n}] updated`,{updatedItems:s,observableArr:i})):i=Ke.array(s,{deep:!1,name:t,equals:r})},{name:n});if(n.includes("useRoots")){var a=ar(i);tt(`[${n}] deps`,{disposeAutorun:o,rootsAtom:a,observableArr:i,observers:Aa(i)}),no(()=>Ra.add(a))}return Ae.isEnabled&&hs(i,()=>{Ae(`[${n}] observed`,Aa(i),{rootsAtom:a,observableArr:i})}),bi(i,()=>{Ae.isEnabled&&Ae(`[${n}] dispose`),a&&no(()=>Ra.delete(a)),o()}),i}var pI=0;function hI(e,{name:t}={}){let r=`observableSetMap@${++pI}{${t}}`;Ae.isEnabled&&Ae(`[${r}] create`,{fnname:e.name,fn:e,name:t});let n,i=qh(e,a=>{if(!n)n=Ke.set(a,{deep:!1,name:t});else{let{deleted:s,added:u}=ze(()=>{let l=new Set(n.values()),f=new Set;for(let d of a)n.has(d)?(Ae.isEnabled&&Ae(`[${r}] unchanged`,d,{updatedItems:a,observableSet:n}),l.delete(d)):f.add(d);return tt.isEnabled&&tt(`[${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=ar(n);tt.isEnabled&&tt(`[${r}] deps`,{disposeAutorun:i,rootsAtom:o,observableSet:n,observers:Aa(n)}),no(()=>Ra.add(o))}return Ae.isEnabled&&hs(n,()=>{Ae(`[${r}] observed`,Aa(n),{rootsAtom:o,observableSet:n})}),bi(n,()=>{Ae.isEnabled&&Ae(`[${r}] dispose`),o&&no(()=>Ra.delete(o)),i()}),n}function qh(e,t=null,{name:r}={}){tt.isEnabled&&tt("[autorunButAlsoImmediately] create",{fnname:e.name,fn:e,name:r});let n=`${r}.autorunImm`,i,o=new pr(n,function(...s){tt.isEnabled&&tt(`[${n}] reaction.invalidate`,s),a()});function a(){o.track(function(){let s=tu&&performance.now();tt.isEnabled&&tt(`[${n}] runAndTrack:`,{name:r??e.name,fn:e}),i=e(),tt.isEnabled&&tt(`[${n}] runAndTrack =>`,i),no(()=>{t?.(i)}),tu&&performance.now()-s>tu&&cI(`[${n}] took ${performance.now()-s}ms`)})}return a(),tt.isEnabled&&tt(`[${n}] deps of reaction`,{reaction:o,result:i,deps:ys(o)}),()=>{Ae.isEnabled&&Ae(`[${n}] dispose`),setTimeout(()=>o.dispose())}}function it(e,t,r=!1){if(bn(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=ze(()=>{let E=s;for(let T=0;T<s.length;T++)s[T]instanceof ii&&s===E&&(E=s.slice());return E}),f=`computedFnDeepCompare(${e||t.name}#${++i})${o.argsDebugName?`{${o.argsDebugName(...s)}}`:""}`;for(let[E,T]of a.entries())if(gI(E,l)){u=T;break}else if(Ae.isEnabled)for(let L=0;L<E.length;L++)E[L]instanceof ii&&E[L].name===s[L].name&&Ze.structural(Hf(E,E[L]),Hf(l,l[L]))&&Ae.force(`[${f}] threadState mismatch => cachebust`,{diffFields:Object.keys(E[L]).filter(H=>!Ze.structural(E[L][H],s[L][H])),cacheArg:E[L],freshArg:s[L]});if(u){let E=u.get();return Ae.isEnabled&&Ae(`[${f}] cache hit`,{untrackedArgs:l,cachedResult:E}),E}if(!o.keepAlive&&!V1())return!n&&q1().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);Ae.isEnabled&&Ae(`[${f}] new computation`,{untrackedArgs:l});let d,I=Xe(()=>(Ae.isEnabled&&Ae(`[${f}] update->rerun`,ze(()=>({args:s})),t),Ae.isEnabled&&Gp(),d=t.apply(this,s)),{...o,name:f});if(Ae.isEnabled&&Ae(`[${f}] deps`,ys(I),{untrackedArgs:l}),a.set(l,I),!o.keepAlive){let E=bi(I,()=>{Ae.isEnabled&&Ae(`[${f}] dispose`,I),E(),a.delete(l),o.onCleanup&&o.onCleanup(d,...s),d=void 0})}return I.get()}}function yI(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 gI(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]instanceof ii){if(t[r]!==e[r])return!1}else if(!Ze.structural(e[r],t[r]))return!1;return!0}var{WARN:Xf,LOG:ZN,DEBUG:mI,VERBOSE:YN,ERROR:fn}=Ce.setup(Ce.INFO,{prefix:"[thread]"});function Yr(e){return e.init!==void 0}var ii=class{constructor(e,t,r,n=[],i={}){this.name=e,this._applogs=n,this.parents=t===null?null:ja(t),this.filters=r,ze(()=>this.parents?.length===0)&&Xf("[Thread] empty parents array",e),i.skipObservable||vi(this,{applogsCids:Xe,applogsByCid:Xe,insert:Rt,size:Xe,isEmpty:Xe,firstLog:Xe,latestLog:Xe},{name:`Thread{${e}}`})}filters;parents;_subscribers=[];get readOnly(){return this.parents.length!==1?!0:this.parents[0].readOnly}insert(e){if(this.readOnly)throw fn("[Thread] insert() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw fn("[Thread] insert() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw fn("[Thread] insert() called on thread with multiple parents:",this.nameAndSizeUntracked);return this.parents[0].insert(e)}insertRaw(e){if(this.readOnly)throw fn("[Thread] insertRaw() called on read-only thread:",this.nameAndSizeUntracked);if(!this.parents)throw fn("[Thread] insertRaw() called on non-writable thread without parents:",this.nameAndSizeUntracked);if(this.parents?.length!==1)throw fn("[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):Xf("unsubscribe called for non-existent",e)}notifySubscribers(e){mI(`[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 fn("[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 ze(()=>this.size)}get nameAndSizeUntracked(){return ze(()=>`${this.name} (${this.size})`)}get prettyName(){return yI(this.name)}get hasParents(){return!!this.parents?.length}},bI=class Wh extends ii{static fromArray(t,r){return new Wh(r||"static",null,[],t)}constructor(t,r,n,i){super(t,r,n,i,{skipObservable:!0})}get readOnly(){return!0}},vI={};eh(vI,{code:()=>py,decode:()=>rc,encode:()=>tc,format:()=>sd,name:()=>jj,parse:()=>Cj,stringify:()=>sd});var wI=["string","number","bigint","symbol"],_I=["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 TI(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;return wI.includes(t)?t:t==="function"?"Function":Array.isArray(e)?"Array":EI(e)?"Buffer":xI(e)||"Object"}function EI(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}function xI(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(_I.includes(t))return t}var M=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}};M.uint=new M(0,"uint",!0);M.negint=new M(1,"negint",!0);M.bytes=new M(2,"bytes",!0);M.string=new M(3,"string",!0);M.array=new M(4,"array",!1);M.map=new M(5,"map",!1);M.tag=new M(6,"tag",!1);M.float=new M(7,"float",!0);M.false=new M(7,"false",!0);M.true=new M(7,"true",!0);M.null=new M(7,"null",!0);M.undefined=new M(7,"undefined",!0);M.break=new M(7,"break",!0);var ae=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}`}},ki=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",OI=new TextDecoder,AI=new TextEncoder;function Ma(e){return ki&&globalThis.Buffer.isBuffer(e)}function Fl(e){return e instanceof Uint8Array?Ma(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var SI=ki?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):Zf(e,t,r):(e,t,r)=>r-t>64?OI.decode(e.subarray(t,r)):Zf(e,t,r),Jh=ki?e=>e.length>64?globalThis.Buffer.from(e):Qf(e):e=>e.length>64?AI.encode(e):Qf(e),zl=ki?(e,t,r)=>Ma(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),II=ki?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Fl(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},kI=ki?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function jI(e,t){if(Ma(e)&&Ma(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 Qf(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 Zf(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 Hh(n)}var Yf=4096;function Hh(e){let t=e.length;if(t<=Yf)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Yf));return r}var $I=256,Xh=class{constructor(e=$I){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=kI(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=zl(r,0,this.cursor)}else t=II(this.chunks,this.cursor);return e&&this.reset(),t}},_e="CBOR decode error:",yn="CBOR encode error:",Co=[];Co[23]=1;Co[24]=2;Co[25]=3;Co[26]=5;Co[27]=9;function ji(e,t,r){if(e.length-t<r)throw new Error(`${_e} not enough data for type`)}var st=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Pn(e,t,r){ji(e,t,1);let n=e[t];if(r.strict===!0&&n<st[0])throw new Error(`${_e} integer encoded in more bytes than necessary (strict decode)`);return n}function Bn(e,t,r){ji(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<st[1])throw new Error(`${_e} integer encoded in more bytes than necessary (strict decode)`);return n}function Dn(e,t,r){ji(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<st[2])throw new Error(`${_e} integer encoded in more bytes than necessary (strict decode)`);return n}function Rn(e,t,r){ji(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<st[3])throw new Error(`${_e} 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(`${_e} integers outside of the safe integer range are not supported`)}function CI(e,t,r,n){return new ae(M.uint,Pn(e,t+1,n),2)}function NI(e,t,r,n){return new ae(M.uint,Bn(e,t+1,n),3)}function UI(e,t,r,n){return new ae(M.uint,Dn(e,t+1,n),5)}function PI(e,t,r,n){return new ae(M.uint,Rn(e,t+1,n),9)}function Mn(e,t){return Wt(e,0,t.value)}function Wt(e,t,r){if(r<st[0]){let n=Number(r);e.push([t|n])}else if(r<st[1]){let n=Number(r);e.push([t|24,n])}else if(r<st[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<st[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<st[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(`${_e} encountered BigInt larger than allowable range`)}}Mn.encodedSize=function(e){return Wt.encodedSize(e.value)};Wt.encodedSize=function(e){return e<st[0]?1:e<st[1]?2:e<st[2]?3:e<st[3]?5:9};Mn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function BI(e,t,r,n){return new ae(M.negint,-1-Pn(e,t+1,n),2)}function DI(e,t,r,n){return new ae(M.negint,-1-Bn(e,t+1,n),3)}function RI(e,t,r,n){return new ae(M.negint,-1-Dn(e,t+1,n),5)}var Kl=BigInt(-1),Qh=BigInt(1);function MI(e,t,r,n){let i=Rn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new ae(M.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${_e} integers outside of the safe integer range are not supported`);return new ae(M.negint,Kl-BigInt(i),9)}function Gl(e,t){let r=t.value,n=typeof r=="bigint"?r*Kl-Qh:r*-1-1;Wt(e,t.type.majorEncoded,n)}Gl.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*Kl-Qh:t*-1-1;return r<st[0]?1:r<st[1]?2:r<st[2]?3:r<st[3]?5:9};Gl.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function No(e,t,r,n){ji(e,t,r+n);let i=zl(e,t+r,t+r+n);return new ae(M.bytes,i,r+n)}function LI(e,t,r,n){return No(e,t,1,r)}function VI(e,t,r,n){return No(e,t,2,Pn(e,t+1,n))}function FI(e,t,r,n){return No(e,t,3,Bn(e,t+1,n))}function zI(e,t,r,n){return No(e,t,5,Dn(e,t+1,n))}function KI(e,t,r,n){let i=Rn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer bytes lengths not supported`);return No(e,t,9,i)}function La(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===M.string?Jh(e.value):e.value),e.encodedBytes}function Os(e,t){let r=La(t);Wt(e,t.type.majorEncoded,r.length),e.push(r)}Os.encodedSize=function(e){let t=La(e);return Wt.encodedSize(t.length)+t.length};Os.compareTokens=function(e,t){return GI(La(e),La(t))};function GI(e,t){return e.length<t.length?-1:e.length>t.length?1:jI(e,t)}function Uo(e,t,r,n,i){let o=r+n;ji(e,t,o);let a=new ae(M.string,SI(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=zl(e,t+r,t+o)),a}function qI(e,t,r,n){return Uo(e,t,1,r,n)}function WI(e,t,r,n){return Uo(e,t,2,Pn(e,t+1,n),n)}function JI(e,t,r,n){return Uo(e,t,3,Bn(e,t+1,n),n)}function HI(e,t,r,n){return Uo(e,t,5,Dn(e,t+1,n),n)}function XI(e,t,r,n){let i=Rn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer string lengths not supported`);return Uo(e,t,9,i,n)}var QI=Os;function $i(e,t,r,n){return new ae(M.array,n,r)}function ZI(e,t,r,n){return $i(e,t,1,r)}function YI(e,t,r,n){return $i(e,t,2,Pn(e,t+1,n))}function ek(e,t,r,n){return $i(e,t,3,Bn(e,t+1,n))}function tk(e,t,r,n){return $i(e,t,5,Dn(e,t+1,n))}function rk(e,t,r,n){let i=Rn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer array lengths not supported`);return $i(e,t,9,i)}function nk(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${_e} indefinite length items not allowed`);return $i(e,t,1,1/0)}function ql(e,t){Wt(e,M.array.majorEncoded,t.value)}ql.compareTokens=Mn.compareTokens;ql.encodedSize=function(e){return Wt.encodedSize(e.value)};function Ci(e,t,r,n){return new ae(M.map,n,r)}function ik(e,t,r,n){return Ci(e,t,1,r)}function ok(e,t,r,n){return Ci(e,t,2,Pn(e,t+1,n))}function ak(e,t,r,n){return Ci(e,t,3,Bn(e,t+1,n))}function sk(e,t,r,n){return Ci(e,t,5,Dn(e,t+1,n))}function uk(e,t,r,n){let i=Rn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${_e} 64-bit integer map lengths not supported`);return Ci(e,t,9,i)}function lk(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${_e} indefinite length items not allowed`);return Ci(e,t,1,1/0)}function Wl(e,t){Wt(e,M.map.majorEncoded,t.value)}Wl.compareTokens=Mn.compareTokens;Wl.encodedSize=function(e){return Wt.encodedSize(e.value)};function ck(e,t,r,n){return new ae(M.tag,r,1)}function fk(e,t,r,n){return new ae(M.tag,Pn(e,t+1,n),2)}function dk(e,t,r,n){return new ae(M.tag,Bn(e,t+1,n),3)}function pk(e,t,r,n){return new ae(M.tag,Dn(e,t+1,n),5)}function hk(e,t,r,n){return new ae(M.tag,Rn(e,t+1,n),9)}function Jl(e,t){Wt(e,M.tag.majorEncoded,t.value)}Jl.compareTokens=Mn.compareTokens;Jl.encodedSize=function(e){return Wt.encodedSize(e.value)};var yk=20,gk=21,mk=22,bk=23;function vk(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${_e} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new ae(M.null,null,1):new ae(M.undefined,void 0,1)}function wk(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${_e} indefinite length items not allowed`);return new ae(M.break,void 0,1)}function Hl(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${_e} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${_e} Infinity values are not supported`)}return new ae(M.float,e,t)}function _k(e,t,r,n){return Hl(Ql(e,t+1),3,n)}function Tk(e,t,r,n){return Hl(Zl(e,t+1),5,n)}function Ek(e,t,r,n){return Hl(ty(e,t+1),9,n)}function Xl(e,t,r){let n=t.value;if(n===!1)e.push([M.float.majorEncoded|yk]);else if(n===!0)e.push([M.float.majorEncoded|gk]);else if(n===null)e.push([M.float.majorEncoded|mk]);else if(n===void 0)e.push([M.float.majorEncoded|bk]);else{let i,o=!1;(!r||r.float64!==!0)&&(Yh(n),i=Ql(Zt,1),n===i||Number.isNaN(n)?(Zt[0]=249,e.push(Zt.slice(0,3)),o=!0):(ey(n),i=Zl(Zt,1),n===i&&(Zt[0]=250,e.push(Zt.slice(0,5)),o=!0))),o||(xk(n),i=ty(Zt,1),Zt[0]=251,e.push(Zt.slice(0,9)))}}Xl.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){Yh(r);let n=Ql(Zt,1);if(r===n||Number.isNaN(r))return 3;if(ey(r),n=Zl(Zt,1),r===n)return 5}return 9};var Zh=new ArrayBuffer(9),$t=new DataView(Zh,1),Zt=new Uint8Array(Zh,0);function Yh(e){if(e===1/0)$t.setUint16(0,31744,!1);else if(e===-1/0)$t.setUint16(0,64512,!1);else if(Number.isNaN(e))$t.setUint16(0,32256,!1);else{$t.setFloat32(0,e);let t=$t.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)$t.setUint16(0,31744,!1);else if(r===0)$t.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?$t.setUint16(0,0):i<-14?$t.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):$t.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function Ql(e,t){if(e.length-t<2)throw new Error(`${_e} 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 ey(e){$t.setFloat32(0,e,!1)}function Zl(e,t){if(e.length-t<4)throw new Error(`${_e} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function xk(e){$t.setFloat64(0,e,!1)}function ty(e,t){if(e.length-t<8)throw new Error(`${_e} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}Xl.compareTokens=Mn.compareTokens;function Pe(e,t,r){throw new Error(`${_e} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function As(e){return()=>{throw new Error(`${_e} ${e}`)}}var ce=[];for(let e=0;e<=23;e++)ce[e]=Pe;ce[24]=CI;ce[25]=NI;ce[26]=UI;ce[27]=PI;ce[28]=Pe;ce[29]=Pe;ce[30]=Pe;ce[31]=Pe;for(let e=32;e<=55;e++)ce[e]=Pe;ce[56]=BI;ce[57]=DI;ce[58]=RI;ce[59]=MI;ce[60]=Pe;ce[61]=Pe;ce[62]=Pe;ce[63]=Pe;for(let e=64;e<=87;e++)ce[e]=LI;ce[88]=VI;ce[89]=FI;ce[90]=zI;ce[91]=KI;ce[92]=Pe;ce[93]=Pe;ce[94]=Pe;ce[95]=As("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)ce[e]=qI;ce[120]=WI;ce[121]=JI;ce[122]=HI;ce[123]=XI;ce[124]=Pe;ce[125]=Pe;ce[126]=Pe;ce[127]=As("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)ce[e]=ZI;ce[152]=YI;ce[153]=ek;ce[154]=tk;ce[155]=rk;ce[156]=Pe;ce[157]=Pe;ce[158]=Pe;ce[159]=nk;for(let e=160;e<=183;e++)ce[e]=ik;ce[184]=ok;ce[185]=ak;ce[186]=sk;ce[187]=uk;ce[188]=Pe;ce[189]=Pe;ce[190]=Pe;ce[191]=lk;for(let e=192;e<=215;e++)ce[e]=ck;ce[216]=fk;ce[217]=dk;ce[218]=pk;ce[219]=hk;ce[220]=Pe;ce[221]=Pe;ce[222]=Pe;ce[223]=Pe;for(let e=224;e<=243;e++)ce[e]=As("simple values are not supported");ce[244]=Pe;ce[245]=Pe;ce[246]=Pe;ce[247]=vk;ce[248]=As("simple values are not supported");ce[249]=_k;ce[250]=Tk;ce[251]=Ek;ce[252]=Pe;ce[253]=Pe;ce[254]=Pe;ce[255]=wk;var mr=[];for(let e=0;e<24;e++)mr[e]=new ae(M.uint,e,1);for(let e=-1;e>=-24;e--)mr[31-e]=new ae(M.negint,e,1);mr[64]=new ae(M.bytes,new Uint8Array(0),1);mr[96]=new ae(M.string,"",1);mr[128]=new ae(M.array,0,1);mr[160]=new ae(M.map,0,1);mr[244]=new ae(M.false,!1,1);mr[245]=new ae(M.true,!0,1);mr[246]=new ae(M.null,null,1);function Ok(){let e=[];return e[M.uint.major]=Mn,e[M.negint.major]=Gl,e[M.bytes.major]=Os,e[M.string.major]=QI,e[M.array.major]=ql,e[M.map.major]=Wl,e[M.tag.major]=Jl,e[M.float.major]=Xl,e}var e8=Ok(),ru=new Xh,ed=class ry{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(`${yn} object contains circular references`);return new ry(r,t)}},Rr={null:new ae(M.null,null),undefined:new ae(M.undefined,void 0),true:new ae(M.true,!0),false:new ae(M.false,!1),emptyArray:new ae(M.array,0),emptyMap:new ae(M.map,0)},en={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new ae(M.float,e):e>=0?new ae(M.uint,e):new ae(M.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new ae(M.uint,e):new ae(M.negint,e)},Uint8Array(e,t,r,n){return new ae(M.bytes,e)},string(e,t,r,n){return new ae(M.string,e)},boolean(e,t,r,n){return e?Rr.true:Rr.false},null(e,t,r,n){return Rr.null},undefined(e,t,r,n){return Rr.undefined},ArrayBuffer(e,t,r,n){return new ae(M.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new ae(M.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Rr.emptyArray,new ae(M.break)]:Rr.emptyArray;n=ed.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=ta(a,r,n);return r.addBreakTokens?[new ae(M.array,e.length),i,new ae(M.break)]:[new ae(M.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?[Rr.emptyMap,new ae(M.break)]:Rr.emptyMap;n=ed.createCheck(n,e);let s=[],u=0;for(let l of o)s[u++]=[ta(l,r,n),ta(i?e.get(l):e[l],r,n)];return Ak(s,r),r.addBreakTokens?[new ae(M.map,a),s,new ae(M.break)]:[new ae(M.map,a),s]}};en.Map=en.Object;en.Buffer=en.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))en[`${e}Array`]=en.DataView;function ta(e,t={},r){let n=TI(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||en[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=en[n];if(!o)throw new Error(`${yn} unsupported type: ${n}`);return o(e,n,t,r)}function Ak(e,t){t.mapSorter&&e.sort(t.mapSorter)}function ny(e,t,r,n){if(Array.isArray(t))for(let i of t)ny(e,i,r,n);else r[t.type.major](e,t,n)}function Sk(e,t,r){let n=ta(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 Xh(a);if(o(s,n,r),s.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return Fl(s.chunks[0])}}return ru.reset(),ny(ru,n,t,r),ru.toBytes(!0)}var Ik={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},kk=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=mr[e];if(t===void 0){let r=ce[e];if(!r)throw new Error(`${_e} 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}},fo=Symbol.for("DONE"),Ss=Symbol.for("BREAK");function jk(e,t,r){let n=[];for(let i=0;i<e.value;i++){let o=po(t,r);if(o===Ss){if(e.value===1/0)break;throw new Error(`${_e} got unexpected break to lengthed array`)}if(o===fo)throw new Error(`${_e} found array but not enough entries (got ${i}, expected ${e.value})`);n[i]=o}return n}function $k(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=po(t,r);if(s===Ss){if(e.value===1/0)break;throw new Error(`${_e} got unexpected break to lengthed map`)}if(s===fo)throw new Error(`${_e} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(n!==!0&&typeof s!="string")throw new Error(`${_e} non-string keys not supported (got ${typeof s})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(s)||!n&&s in i))throw new Error(`${_e} found repeat map key "${s}"`);let u=po(t,r);if(u===fo)throw new Error(`${_e} 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 po(e,t){if(e.done())return fo;let r=e.next();if(r.type===M.break)return Ss;if(r.type.terminal)return r.value;if(r.type===M.array)return jk(r,e,t);if(r.type===M.map)return $k(r,e,t);if(r.type===M.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=po(e,t);return t.tags[r.value](n)}throw new Error(`${_e} tag not supported (${r.value})`)}throw new Error("unsupported")}function Ck(e,t){if(!(e instanceof Uint8Array))throw new Error(`${_e} data to decode must be a Uint8Array`);t=Object.assign({},Ik,t);let r=t.tokenizer||new kk(e,t),n=po(r,t);if(n===fo)throw new Error(`${_e} did not find any content to decode`);if(n===Ss)throw new Error(`${_e} got unexpected break`);return[n,e.subarray(r.pos())]}function Nk(e,t){let[r,n]=Ck(e,t);if(n.length>0)throw new Error(`${_e} too many terminals, data makes no sense`);return r}var Uk=class extends Array{constructor(){super(),this.inRecursive=[]}prefix(e){let t=this.inRecursive[this.inRecursive.length-1];t&&(t.type===M.array&&(t.elements++,t.elements!==1&&e.push([44])),t.type===M.map&&(t.elements++,t.elements!==1&&(t.elements%2===1?e.push([44]):e.push([58]))))}[M.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)}[M.negint.major](e,t){this[M.uint.major](e,t)}[M.bytes.major](e,t){throw new Error(`${yn} unsupported type: Uint8Array`)}[M.string.major](e,t){this.prefix(e);let r=Jh(JSON.stringify(t.value));e.push(r.length>32?Fl(r):r)}[M.array.major](e,t){this.prefix(e),this.inRecursive.push({type:M.array,elements:0}),e.push([91])}[M.map.major](e,t){this.prefix(e),this.inRecursive.push({type:M.map,elements:0}),e.push([123])}[M.tag.major](e,t){}[M.float.major](e,t){if(t.type.name==="break"){let o=this.inRecursive.pop();if(o){if(o.type===M.array)e.push([93]);else if(o.type===M.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(`${yn} 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 Pk(e,t){if(Array.isArray(e[0])||Array.isArray(t[0]))throw new Error(`${yn} complex map keys are not supported`);let r=e[0],n=t[0];if(r.type!==M.string||n.type!==M.string)throw new Error(`${yn} non-string map keys are not supported`);if(r<n)return-1;if(r>n)return 1;throw new Error(`${yn} unexpected duplicate map keys, this is not supported`)}var Bk={addBreakTokens:!0,mapSorter:Pk};function Dk(e,t){return t=Object.assign({},Bk,t),Sk(e,new Uk,t)}var iy=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(`${_e} 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(`${_e} 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 ae(M.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(`${_e} unexpected token at position ${this._pos}`);if(!this.done()&&this.ch()===46){if(r)throw new Error(`${_e} 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 ae(M.float,o,this._pos-e):this.options.allowBigInt!==!0||Number.isSafeInteger(o)?new ae(o>=0?M.uint:M.negint,o,this._pos-e):new ae(o>=0?M.uint:M.negint,BigInt(i),this._pos-e)}parseString(){if(this.ch()!==34)throw new Error(`${_e} 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 ae(M.string,s,o)}}let e=this._pos,t=[],r=()=>{if(this._pos+4>=this.data.length)throw new Error(`${_e} 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(`${_e} 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(`${_e} 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(`${_e} 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(`${_e} unexpected string escape character at position ${this._pos}`)}break;case 34:return this._pos++,new ae(M.string,Hh(t),this._pos-e);default:if(i<32)throw new Error(`${_e} invalid control character at position ${this._pos}`);i<128?(t.push(i),this._pos++):n()}}throw new Error(`${_e} unexpected end of string at position ${this._pos}`)}parseValue(){switch(this.ch()){case 123:return this.modeStack.push("obj-start"),this._pos++,new ae(M.map,1/0,1);case 91:return this.modeStack.push("array-start"),this._pos++,new ae(M.array,1/0,1);case 34:return this.parseString();case 110:return this.expect([110,117,108,108]),new ae(M.null,null,4);case 102:return this.expect([102,97,108,115,101]),new ae(M.false,!1,5);case 116:return this.expect([116,114,117,101]),new ae(M.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(`${_e} 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 ae(M.break,void 0,1);if(this.ch()!==44)throw new Error(`${_e} 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 ae(M.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 ae(M.break,void 0,1);if(this.ch()!==44)throw new Error(`${_e} 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 ae(M.break,void 0,1);let e=this.parseString();if(this.skipWhitespace(),this.ch()!==58)throw new Error(`${_e} 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(`${_e} unexpected parse state at position ${this._pos}; this shouldn't happen`)}}};function Rk(e,t){return t=Object.assign({tokenizer:new iy(e,t)},t),Nk(e,t)}var t8=new Uint8Array(0);function Mk(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 Yl(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 Lk(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var L=0,H=0,B=0,k=T.length;B!==k&&T[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,G=new Uint8Array(F);B!==k;){for(var D=T[B],Q=0,K=F-1;(D!==0||Q<H)&&K!==-1;K--,Q++)D+=256*G[K]>>>0,G[K]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");H=Q,B++}for(var re=F-H;re!==F&&G[re]===0;)re++;for(var j=u.repeat(L);re<F;++re)j+=e.charAt(G[re]);return j}function I(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,B=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 D=0,Q=k-1;(G!==0||D<B)&&Q!==-1;Q--,D++)G+=s*F[Q]>>>0,F[Q]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");B=D,L++}if(T[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(H+(k-K)),j=H;K!==k;)re[j++]=F[K++];return re}}}function E(T){var L=I(T);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Vk=Lk,Fk=Vk,zk=Fk,Kk=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")}},Gk=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 oy(this,e)}},qk=class{decoders;constructor(e){this.decoders=e}or(e){return oy(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 oy(e,t){return new qk({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var Wk=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 Kk(e,t,r),this.decoder=new Gk(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function ay({name:e,prefix:t,encode:r,decode:n}){return new Wk(e,t,r,n)}function Is({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=zk(r,e);return ay({prefix:t,name:e,encode:n,decode:o=>Yl(i(o))})}function Jk(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 Hk(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 Xk(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function St({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=Xk(n);return ay({prefix:t,name:e,encode(o){return Hk(o,n,r)},decode(o){return Jk(o,i,r,e)}})}var ra=St({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),r8=St({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),n8=St({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),i8=St({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),o8=St({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),a8=St({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),s8=St({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),u8=St({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),l8=St({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),na=Is({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),c8=Is({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Kr=Is({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),f8=Is({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),sy={};eh(sy,{Digest:()=>ks,create:()=>ec,decode:()=>ly,equals:()=>cy,hasCode:()=>yj});var Qk=uy,td=128,Zk=127,Yk=~Zk,ej=Math.pow(2,31);function uy(e,t,r){t=t||[],r=r||0;for(var n=r;e>=ej;)t[r++]=e&255|td,e/=128;for(;e&Yk;)t[r++]=e&255|td,e>>>=7;return t[r]=e|0,uy.bytes=r-n+1,t}var tj=$u,rj=128,rd=127;function $u(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw $u.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&rd)<<i:(a&rd)*Math.pow(2,i),i+=7}while(a>=rj);return $u.bytes=o-n,r}var nj=Math.pow(2,7),ij=Math.pow(2,14),oj=Math.pow(2,21),aj=Math.pow(2,28),sj=Math.pow(2,35),uj=Math.pow(2,42),lj=Math.pow(2,49),cj=Math.pow(2,56),fj=Math.pow(2,63),dj=function(e){return e<nj?1:e<ij?2:e<oj?3:e<aj?4:e<sj?5:e<uj?6:e<lj?7:e<cj?8:e<fj?9:10},pj={encode:Qk,decode:tj,encodingLength:dj},hj=pj,Va=hj;function Cu(e,t=0){return[Va.decode(e,t),Va.decode.bytes]}function Fa(e,t,r=0){return Va.encode(e,t,r),t}function za(e){return Va.encodingLength(e)}function ec(e,t){let r=t.byteLength,n=za(e),i=n+za(r),o=new Uint8Array(i+r);return Fa(e,o,0),Fa(r,o,n),o.set(t,i),new ks(e,r,t,o)}function ly(e){let t=Yl(e),[r,n]=Cu(t),[i,o]=Cu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new ks(r,i,a,t)}function cy(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Mk(e.bytes,r.bytes)}}var ks=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function yj(e,t){return e.code===t}function nd(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return mj(r,Nu(e),t??Kr.encoder);default:return bj(r,Nu(e),t??ra.encoder)}}var id=new WeakMap;function Nu(e){let t=id.get(e);if(t==null){let r=new Map;return id.set(e,r),r}return t}var Vt=class pt{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!==zi)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==vj)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return pt.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=ec(t,r);return pt.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 pt.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&cy(t.multihash,n.multihash)}toString(t){return nd(this,t)}toJSON(){return{"/":nd(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 pt)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new pt(n,i,o,a??od(n,i,o.bytes))}else if(r[wj]===!0){let{version:n,multihash:i,code:o}=r,a=ly(i);return pt.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!==zi)throw new Error(`Version 0 CID must use dag-pb (code: ${zi}) block encoding`);return new pt(t,r,n,n.bytes)}case 1:{let i=od(t,r,n.bytes);return new pt(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return pt.create(0,zi,t)}static createV1(t,r){return pt.create(1,t,r)}static decode(t){let[r,n]=pt.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=pt.inspectBytes(t),n=r.size-r.multihashSize,i=Yl(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 ks(r.multihashCode,r.digestSize,o,i);return[r.version===0?pt.createV0(a):pt.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=Cu(t.subarray(r));return r+=I,d},i=n(),o=zi;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]=gj(t,r),o=pt.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 gj(e,t){switch(e[0]){case"Q":{let r=t??Kr;return[Kr.prefix,r.decode(`${Kr.prefix}${e}`)]}case Kr.prefix:{let r=t??Kr;return[Kr.prefix,r.decode(e)]}case ra.prefix:{let r=t??ra;return[ra.prefix,r.decode(e)]}case na.prefix:{let r=t??na;return[na.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 mj(e,t,r){let{prefix:n}=r;if(n!==Kr.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 bj(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 zi=112,vj=18;function od(e,t,r){let n=za(e),i=n+za(t),o=new Uint8Array(i+r.byteLength);return Fa(e,o,0),Fa(t,o,n),o.set(r,i),o}var wj=Symbol.for("@ipld/js-cid/CID"),_j=20;function fy({name:e,code:t,encode:r,minDigestLength:n,maxDigestLength:i}){return new Tj(e,t,r,n,i)}var Tj=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,t,r,n,i){this.name=e,this.code=t,this.encode=r,this.minDigestLength=n??_j,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?ad(r,this.code,t?.truncate):r.then(n=>ad(n,this.code,t?.truncate))}else throw Error("Unknown type, must be binary type")}};function ad(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 ec(t,e)}var dy=St({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),d8=St({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),p8=St({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),h8=St({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});function Ej(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function xj(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Vt.asCID(e);if(!t)return null;let r=t.toString();return[new ae(M.map,1/0,1),new ae(M.string,"/",1),new ae(M.string,r,r.length),new ae(M.break,void 0,1)]}function Ka(e){let t=dy.encode(e).slice(1);return[new ae(M.map,1/0,1),new ae(M.string,"/",1),new ae(M.map,1/0,1),new ae(M.string,"bytes",5),new ae(M.string,t,t.length),new ae(M.break,void 0,1),new ae(M.break,void 0,1)]}function Ht(e){return Ka(new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function Oj(e){return Ka(new Uint8Array(e))}function Aj(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function Sj(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 Ij={typeEncoders:{Object:xj,Buffer:Ka,Uint8Array:Ka,Int8Array:Ht,Uint16Array:Ht,Int16Array:Ht,Uint32Array:Ht,Int32Array:Ht,Float32Array:Ht,Float64Array:Ht,Uint8ClampedArray:Ht,BigInt64Array:Ht,BigUint64Array:Ht,DataView:Ht,ArrayBuffer:Oj,undefined:Aj,number:Sj}},kj=class extends iy{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===M.map){let t=this._next();if(t.type===M.string&&t.value==="/"){let r=this._next();if(r.type===M.string){if(this._next().type!==M.break)throw new Error("Invalid encoded CID form");return this.tokenBuffer.push(r),new ae(M.tag,42,0)}if(r.type===M.map){let n=this._next();if(n.type===M.string&&n.value==="bytes"){let i=this._next();if(i.type===M.string){for(let a=0;a<2;a++)if(this._next().type!==M.break)throw new Error("Invalid encoded Bytes form");let o=dy.decode(`m${i.value}`);return new ae(M.bytes,o,i.value.length)}this.tokenBuffer.push(i)}this.tokenBuffer.push(n)}this.tokenBuffer.push(r)}this.tokenBuffer.push(t)}return e}},Uu={allowIndefinite:!1,allowUndefined:!1,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};Uu.tags[42]=Vt.parse;var jj="dag-json",py=297,tc=e=>Dk(e,Ij),rc=e=>{let t=Ej(e),r=Object.assign(Uu,{tokenizer:new kj(t,Uu)});return Rk(t,r)},sd=e=>$j.decode(tc(e)),$j=new TextDecoder,Cj=e=>rc(Nj.encode(e)),Nj=new TextEncoder;function Uj(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function hy(e,t,r=""){let n=Uj(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 ud(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 Pj(e,t){hy(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 Pu(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function nu(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function lr(e,t){return e<<32-t|e>>>t}function Bj(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 Dj=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function Rj(e,t,r){return e&t^~e&r}function Mj(e,t,r){return e&t^e&r^t&r}var Lj=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=nu(this.buffer)}update(e){ud(this),hy(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=nu(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){ud(this),Pj(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:o}=this;t[o++]=128,Pu(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=nu(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()}},Mr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Vj=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]),Lr=new Uint32Array(64),Fj=class extends Lj{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)Lr[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){let d=Lr[f-15],I=Lr[f-2],E=lr(d,7)^lr(d,18)^d>>>3,T=lr(I,17)^lr(I,19)^I>>>10;Lr[f]=T+Lr[f-7]+E+Lr[f-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:u,H:l}=this;for(let f=0;f<64;f++){let d=lr(a,6)^lr(a,11)^lr(a,25),I=l+d+Rj(a,s,u)+Vj[f]+Lr[f]|0,E=(lr(r,2)^lr(r,13)^lr(r,22))+Mj(r,n,i)|0;l=u,u=s,s=a,a=o+I|0,o=i,i=n,n=r,r=I+E|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(r,n,i,o,a,s,u,l)}roundClean(){Pu(Lr)}destroy(){this.set(0,0,0,0,0,0,0,0),Pu(this.buffer)}},zj=class extends Fj{A=Mr[0]|0;B=Mr[1]|0;C=Mr[2]|0;D=Mr[3]|0;E=Mr[4]|0;F=Mr[5]|0;G=Mr[6]|0;H=Mr[7]|0;constructor(){super(32)}},Kj=Bj(()=>new zj,Dj(1)),nt=$r(on(),1),yy=$r(i2(),1),ld=e=>nt.Type.Union([e,nt.Type.Null()]),gy=/^(k51qz|baguq)[0-9a-z]{56,57}$/,Gj=/^[0-9A-Fa-f]{7,8}$/g;nt.FormatRegistry.Set("EntityID",e=>!!e.match(Gj)||!!e.match(gy));var qj=nt.Type.String(),Bu=e=>e?.enc instanceof Uint8Array;nt.FormatRegistry.Set("CID",e=>!!e.match(gy));var my=nt.Type.String({format:"CID"}),Wj=/^http([s]?):\/\/.*\..*/;nt.FormatRegistry.Set("URL",e=>!!e.match(Wj));var y8=nt.Type.String({format:"URL"}),by=nt.Type.Object({en:qj,at:nt.Type.String(),vl:ld(nt.Type.Union([nt.Type.String(),nt.Type.Boolean(),nt.Type.Number()])),ts:nt.Type.String(),ag:nt.Type.String(),pv:ld(my)}),cd=yy.TypeCompiler.Compile(by),g8=cd.Check.bind(cd),Jj=nt.Type.Composite([nt.Type.Object({cid:my}),by]),Du=yy.TypeCompiler.Compile(Jj),Hj=e=>Array.from(Du.Errors(e)),vy=Du.Check.bind(Du);function wy(e){return async t=>new Uint8Array(await crypto.subtle.digest(e,t))}var Xj=fy({name:"sha2-256",code:18,encode:wy("SHA-256")}),m8=fy({name:"sha2-512",code:19,encode:wy("SHA-512")}),{WARN:fd,LOG:b8,DEBUG:Qj,VERBOSE:Ga,ERROR:Zj}=Ce.setup(Ce.INFO),Yj=114;function e$(e,t=["cid"]){if(!e)throw Zj("falsy log",e);let r=e.cid;if(Bu(e))return r||(r=nc(_y(e).bytes).toString()),fd("preparing an encrypted applog - really?"),{log:e,cid:r};let n={};for(let[i,o]of Object.entries(e))o===void 0&&(fd(`log.${i} is undefined, which is not allowed - encoding as null`,e),o=null),t.includes(i)?Ga("excluding app log",{key:i,val:o}):n[i]=o;return{log:n,cid:r}}function t$(e){return nc(r$(e).bytes)}function r$(e){return _y(e$(e)?.log)}function nc(e){let t=Kj(e),r=sy.create(Xj.code,t),n=Vt.create(1,py,r);return Ga("[getCidSync]",{bytes:e,hash:t,digest:r,cid:n}),n}function _y(e){Qj("[encodeBlock]",e);let t=tc(e);return{bytes:t,cid:nc(t)}}function n$(e){let t=null,r=[];try{t=Vt.parse(e)}catch(n){Ga("[retrieveThread] couldn't parse pubID with default base"),r.push(n)}if(!t)try{t=Vt.parse(e,na)}catch(n){Ga("[retrieveThread] couldn't parse pubID with base36"),r.push(n)}return{cid:t,errors:t?null:r,isIpns:t&&ic(t)}}function ic(e){return e.code===Yj}function Ru(e){return typeof e=="string"?Vt.parse(e):typeof e.toV1!="function"?Vt.decode(e.bytes):e}function Ty(e,t){if(!e||!t)throw new Error(`[areCidsEqual] invalid params: ${e}, ${t}`);if(e===t)return!0;let r=Ru(e),n=Ru(t);return r.toV1().toString()===n.toV1().toString()}function dd(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 i$(e,t){let r=dd(e),n=dd(t);return+r<+n}var{WARN:v8,LOG:w8,DEBUG:_8,VERBOSE:o$,ERROR:pd}=Ce.setup(Ce.INFO),a$=(e,t,r="asc")=>r==="asc"?e.localeCompare(t,"en-US"):t.localeCompare(e,"en-US"),Ey=(e,t,r)=>Ze.structural(Jf(t,e),Jf(r,e)),s$=(e,t,r="asc")=>a$(e.ts,t.ts,r),T8=XS(Ey,["en","at"]);function ho(e,t="asc"){return e.sort((r,n)=>s$(r,n,t))}var u$=(e,t)=>i$(new Date(e.ts),new Date(t.ts)),xy=e=>{let t=new Map;for(let r of e){if(!r)throw pd("falsy entry in applogs",e),new Error("falsy entry in applogs");if(!r.cid)throw pd("applog with missing CID",r),new Error("applog with missing CID");let n=r.cid;t.has(n)?o$("Skipping duplicate applog:",[t.get(n),r]):t.set(n,r)}return Array.from(t.values())};function l$(e){return typeof e=="string"&&e.startsWith("?")}function c$(e){return e.slice(1)}function Oy(e,t){let r={},n={};for(let[i,o]of Object.entries(e))if(l$(o)){let a=c$(o),s=t[a];s?n[i]=s:r[i]=a}else n[i]=o;return[n,r]}function f$(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 Ay=function(e){for(var t=0,r=0,n=e.length;r<n;r++)t+=e[r];return t},hd=function(e){return Ay(e)/e.length},Ct={max:function(e){return Math.max.apply(null,e)},min:function(e){return Math.min.apply(null,e)},range:function(e){return Ct.max(e)-Ct.min(e)},midrange:function(e){return Ct.range(e)/2},sum:Ay,mean:hd,average:hd,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=Ct.mean(e);return Ct.mean(e.map(function(r){return Math.pow(r-t,2)}))},standardDeviation:function(e){return Math.sqrt(Ct.variance(e))},meanAbsoluteDeviation:function(e){var t=Ct.mean(e);return Ct.mean(e.map(function(r){return Math.abs(r-t)}))},zScores:function(e){var t=Ct.mean(e),r=Ct.standardDeviation(e);return e.map(function(n){return(n-t)/r})}};Ct.average=Ct.mean;function Sy(){return new Date().toISOString()}var{WARN:d$,LOG:E8,DEBUG:p$,VERBOSE:x8,ERROR:qa}=Ce.setup(Ce.INFO);function h$(e,t){let r=Sy(),n=t;return e.map(i=>y$(i,{ts:r,threadForPv:n}))}function y$(e,{ts:t,threadForPv:r}={}){let n=b$(e,t??Sy()),i=v$(n,r),o=t$(i).toString();e.cid&&e.cid!==o&&d$("[finalizeApplogForInsert] overwriting wrong CID",{log:e,cid:o,logWithPv:i});let a={...i,cid:o};if(!vy(a))throw qa(`Bogus Applog ${JSON.stringify(a)}`,Hj(a));return Object.freeze(a)}function g$(e){return!!e.ts}function m$(e){return!!e.pv}function b$(e,t){return g$(e)?e:{...e,ts:t}}function v$(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(Ey(["en","at","vl","ts","ag"],e,i))throw qa("[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(!m$(e))throw qa("[withPvFrom] no thread and no pv:",e);return e}}function Mu(e){let t=()=>(ze(()=>e.length<2&&p$(`joinThreads with count=${e.length}`)),ho(xy(e.flatMap(i=>{let o=i.applogs;if(!o)throw qa("falsy applogs of thread",i),new Error("falsy applogs of thread");return o})))),r=ze(()=>t()),n=Rt(function(i,o){return Yr(i)?{init:ze(()=>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 oc(ze(()=>`join(~ ${e.map(i=>i.name).join(", ")})`),e,["?"],r,n)}var{WARN:yd,LOG:O8,DEBUG:gd,VERBOSE:dn,ERROR:md}=Ce.setup(Ce.INFO),oc=class Iy extends ii{constructor(t,r,n,i,o,a=null){super(t,r,n,o?Ke.array([...i],{deep:!1,name:`${t}.array`}):i),this.name=t,this._initialLogs=i,this._eventMapper=o,this._writeMapper=a,vi(this,{onParentUpdate:Rt}),o&&this.subscribeToParents()}static mapWrites(t,r,n){return new Iy(`${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=zt(()=>{this.parents.length||yd("MappedThread has no parents",this),dn(`[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)&&dn(`[MappedThread: ${this.name}] Skipping re-sub to parent`,n.nameAndSizeUntracked),dn(`[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)dn(`[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 md("triggerRemap on a thread that is not actually mapping?!",this.nameAndSizeUntracked);gd(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap`),this.parents.length!==1&&yd(`MappedThread{${this.nameAndSizeUntracked}} triggerRemap with parentCount=${this.parents.length} - not meant for this`),this.parents.forEach(t=>{this.onParentUpdate(t,{init:ze(()=>xr(t.applogs))})})}onParentUpdate(t,r){dn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate`,r);let n=this._eventMapper?this._eventMapper(r,t):r;if(this._eventMapper)if(dn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => mapped`,n),Yr(n))this._applogs.replace([...n.init]);else{for(let i of n.added)this._applogs.splice(sI(this._applogs,i,"ts"),0,i);if(n.removed){for(let i of n.removed)if(!this._applogs.remove(i))if(!Yr(r)&&r.removed?.includes(i))gd("Ignoring remove event for non-existent because it was part of parent event's removed",i,r);else throw md(`MappedThread{${this.name}} toRemove contained log that doesn't exist`,i,{thread:this,event:r,mapResult:n})}}dn(`MappedThread{${this.nameAndSizeUntracked}} parentUpdate => deps?`,ys(this._applogs)),this.notifySubscribers(n)}get readOnly(){return!1}},{WARN:A8,LOG:S8,DEBUG:I8,VERBOSE:iu,ERROR:w$}=Ce.setup(Ce.INFO),oi=it("rollingFilter",function(e,t,r={}){let n=T$(t),i=bd(n),o=Ke.array(ze(function(){return i(e.applogs)}),{deep:!1,name:`${e.name} | ${r.name||`rollingFilter.array{${co(n)}}`}`}),a=f=>{let d;return Yr(f)?d={init:i(f.init)}:d={added:i(f.added),removed:f.removed},iu(`rollingFilter{${e.nameAndSizeUntracked} | ${r.name?` '${r.name}'}`:""} parentUpdate`,n,f,"=>",d),d},s=new oc(`${e.name} | ${r.name||`rollingFilter{${co(n)}}`}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],o,a),u=sw(()=>xr(t),f=>{iu(`rollingFilter<${e.nameAndSizeUntracked}>${r.name?` '${r.name}'`:""} patternUpdate`,n,"=>",f),n=f,i=bd(n),s.triggerRemap()}),l=bi(o,()=>{iu(`rollingFilter<${ze(()=>e.name)}>${r.name?` '${r.name}'`:""} unobserve`,n),u(),l()});return s},{equals:$o,argsDebugName:(e,t,r)=>Qe({caller:"rollingFilter",thread:e,pattern:t,args:r})}),_$=it("rollingMapper",function(e,t,r={}){let n=ze(()=>t.call(null,{init:e.applogs},e));if(!Yr(n))throw w$("Initial run must return init event");let i=n.init;return new oc(`${e.name} | ${r.name||"rollingMapper"}`,e,[...e.filters,...r.extraFilterName?[r.extraFilterName]:[]],i,t)},{equals:$o,argsDebugName:(e,t,r)=>Qe({caller:"rollingMapper",thread:e,args:r})}),k8=it("rollingAcc",function(e,t,r,n={}){let i=Rt(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}`:""}}`}),T$=function(e){let t=ze(function(){return Object.fromEntries(Object.entries(xr(e)).map(([r,n])=>[xr(r),xr(n)]))});if(!Object.entries(t).length)throw new Error("Pattern is empty");return t};function bd(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(!f$(n,i,o))return!1}return!0})}}var{WARN:E$,LOG:x$,DEBUG:O$,VERBOSE:A$,ERROR:ia}=Ce.setup(Ce.INFO),S$=class extends ii{constructor(e,t=[],r){super(e,null,r,t),vi(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=h$(e,this);return this.insertRaw(t)}insertRaw(e){let t=xy(e);if(t.length!==e.length)throw ia(`[insertRaw] duplicate applogs passed: ${e.length-t.length}`,{appLogsToInsert:e,deduplicated:t});let r=e.filter(o=>!vy(o));if(r.length)throw ia(`[insertRaw] bogus applogs passed: ${r.length}`,{bogus:r});let n=e.filter(o=>this.hasApplog(o,!1));if(n.length)throw ia(`[insertRaw] already existing applogs passed: ${n.length}`,{existing:n});if(!e.length){E$("[insertRaw] skipping empty insert empty logs array");return}(!this.hasParents&&!(this instanceof Po)?x$:O$)("Inserting:",e.length===1?e[0]:e,{ds:this}),ho(e);let i=this._applogs.length&&u$(e[0],this._applogs[this._applogs.length-1]);return this._applogs.push(...e),i&&ho(this._applogs),this.notifySubscribers({added:e,removed:null}),this.persist(e),e}get readOnly(){return!1}},Po=class oa extends S${constructor(t,r,n,i){super(t,r,n),this._readOnly=i,vi(this,{_applogs:Ke.shallow})}static empty(t){return oa.fromArray([],t??"empty in-memory",!1)}static fromArray(t,r,n=!1){return new oa(r??"in-memory",t,[],n)}static fromReadOnlyArray(t,r){return new oa(r??"in-memory",t,[],!0)}get readOnly(){return this._readOnly}async persist(t){if(A$("[InMem.persist] no persist for",t),this.readOnly)throw ia("[persist] called for readOnly thread")}},{WARN:j8,LOG:$8,DEBUG:C8,VERBOSE:N8,ERROR:U8}=Ce.setup(Ce.INFO),{WARN:P8,LOG:B8,DEBUG:D8,VERBOSE:R8,ERROR:M8}=Ce.setup(Ce.INFO),I$=class{constructor(e,t,r=null){this.logsOfThisNode=e,this.variables=t,this.prevNode=r,vi(this,{threadOfTrail:Xe})}get record(){return this.variables}get threadOfTrail(){return this.prevNode?Mu([this.logsOfThisNode,this.prevNode.threadOfTrail]):this.logsOfThisNode}get trailLogs(){return this.threadOfTrail.applogs}},ky=class{constructor(e){this.nodes=e,vi(this,{threadOfAllTrails:Xe,size:Xe,isEmpty:Xe})}get size(){return this.records.length}get isEmpty(){return this.records.length===0}get untrackedSize(){return ze(()=>this.records.length)}get records(){return tr(()=>this.nodes.map(({variables:e})=>e),{name:"QueryResult.records"})}get leafNodeThread(){return Mu(tr(()=>this.nodes.map(({logsOfThisNode:e})=>e),{name:"QueryResult.leafNodeThread"}))}get leafNodeLogSet(){return tr(()=>this.nodes.map(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogSet"})}get leafNodeLogs(){return tr(()=>this.nodes.flatMap(({logsOfThisNode:e})=>e.applogs),{name:"QueryResult.leafNodeLogs"})}get threadOfAllTrails(){return Mu(tr(()=>this.nodes.map(e=>e.threadOfTrail),{name:"QueryResult.threadOfAllTrails"}))}get thread(){return this.threadOfAllTrails}get allApplogs(){return this.threadOfAllTrails.applogs}},{WARN:L8,LOG:js,DEBUG:Sr,VERBOSE:ke,ERROR:wn}=Ce.setup(Ce.INFO,{prefix:"[q]"}),ou=null,V8=it("lastWriteWins",function(e,{inverseToOnlyReturnFirstLogs:t,tolerateAlreadyFiltered:r}={}){if(ke(`lastWriteWins${t?".inversed":""} < ${e.nameAndSizeUntracked} > initializing`),e.filters.includes("lastWriteWins")){if(r)return Sr("[lastWriteWins] already filtered, but tolerateAlreadyFiltered=true, so returning"),e;throw wn("thread already filtered lastWriteWins:",e.filters,{name:e.name})}let n,i=_$(e,function(o,a){let s=Yr(o),u,l=[],f=s?null:[];s?(n=new Map,u=o.init):u=o.added;let d;for(let I=t?0:u.length-1;t?I<u.length:I>=0;t?I++:I--){let E=u[I],T=E.en+"|"+E.at;if(d&&(t?d>E.ts:d<E.ts))throw wn("lastWriteWins.mapper logs not sorted:",d,t?">":"<",E.ts,{log:E,i:I,newLogs:u,inverseToOnlyReturnFirstLogs:t});d=E.ts;let L=n.get(T);(!L||(t?L.ts>E.ts:L.ts<E.ts))&&(L&&!s&&f.push(L),l.push(E),n.set(T,E))}return ho(l),ke.isDisabled||ke(`lastWriteWins${t?".inversed":""}<${e.nameAndSizeUntracked}> mapped event`,s?{...Object.fromEntries(Object.entries(o).map(([I,E])=>[I,E?.length])),toAdd:l.length,toRemove:f}:{...o,toAdd:l,toRemove:f}),s?{init:l}:{added:l,removed:f}},{name:`lastWriteWins${t?".inversed":""}`,extraFilterName:"lastWriteWins"});return ke.isDisabled||zt(()=>{ke(`lastWriteWins<${e.nameAndSizeUntracked}> filtered down to`,i.applogs.length)}),i},{equals:$o,argsDebugName:e=>Qe({caller:"lastWriteWins",thread:e})}),F8=it("withoutDeleted",function(e){if(ke.isEnabled&&ke(`withoutDeleted<${e.nameAndSizeUntracked}>`),e.filters.includes("withoutDeleted"))throw wn("thread already filtered withoutDeleted:",e.filters,{name:e.name});let t=oi(e,{at:["isDeleted","relation/isDeleted","block/isDeleted"],vl:!0},{name:"isDeleted"});ke.isEnabled&&ke(`withoutDeleted<${e.nameAndSizeUntracked}> deletionLogs:`,ze(function(){return[...t.applogs]}));let r=Qe({caller:"allDeletedEntities",thread:e}),n=hI(function(){return t.map(i=>i.en)},{name:r});return ke.isEnabled&&zt(()=>{ke(`withoutDeleted<${e.nameAndSizeUntracked}> deleted:`,[...n])}),oi(e,{"!en":n},{name:"withoutDeleted",extraFilterName:"withoutDeleted"})},{equals:$o}),jy=it("query",function e(t,r,n={},i={}){B$();let o=$y(t);Sr(`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=k$(o,s,u,i);return ke.isDisabled||zt(()=>ke("query result:",xr(l))),l},{equals:Vl,argsDebugName:(e,t,r)=>Qe({caller:"query",thread:e,args:r?{pattern:t,startVars:r}:t})}),k$=it("queryStep",function(e,t,r,n={}){if(Sr(`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]=Oy(r,a?.variables??{});ke("[queryStep.doQuery] patternWithoutVars: ",s);let l=oi(e,s),f=$s(u),d=tr(function(){let I=l.map(E=>({log:E,vars:f(E)}));return ke.isEnabled&&ke("[queryStep.doQuery] step node:",a?.variables," =>",I,"from:",ze(()=>l.applogs)),I.map(({log:E,vars:T})=>{let L=Object.assign({},a?.variables,T);return new I$(bI.fromArray([E],Qe({caller:"QueryNode",thread:l,pattern:`${co(L)}@${co(s)}`})),L,a)})},{name:Qe({caller:"doQuery.mapNodes",thread:l,pattern:r})});return ke.isEnabled&&zt(()=>ke("[queryStep.doQuery] resultNodes:",[...d])),n.debug&&js("[queryStep] step result:",ze(()=>d.map(({variables:I,logsOfThisNode:E})=>({variables:I,thread:E})))),d}let o=tr(function(){return Sr(`[queryStep] Running with ${t?.nodes?.length} input nodes:`),t?[...t.nodes.flatMap(i)]:[...i(null)]},{name:Qe({caller:"queryStep",thread:e,pattern:r})});return ke.isEnabled&&zt(()=>ke("[queryStep] observableResultNodes:",[...o])),new ky(o)},{equals:Vl,argsDebugName:(e,t,r)=>Qe({caller:"queryStep",thread:e,pattern:r})}),z8=it("queryNot",function(e,t,r,n={}){let i=t.nodes;Sr(`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]=Oy(a,s??{});ke("[queryNot] patternWithoutVars: ",u);let f=oi(e,u);return ke("[queryNot] step node:",s," =>",f.size,"applogs"),ke.isDisabled||ke("[queryNot] step node:",s," => empty?",ze(()=>f.applogs)),n.debug&&js("[queryNot] node result:",s,"=>",f.applogs),f.isEmpty})}return new ky(i)},{equals:Vl,argsDebugName:(e,t,r)=>Qe({caller:"queryNot",thread:e,pattern:r})}),K8=it("filterAndMap",function(e,t,r){Sr(`filterAndMap<${e.nameAndSizeUntracked}>`,t);let n=oi(e,t);ke.isEnabled&&(ke("[filterAndMap] filtered:",n.untrackedSize),zt(()=>ke("[filterAndMap] filtered:",n.applogs)));let i=Qe({thread:e,pattern:t,caller:"filterAndMap"}),o=tr(()=>C$(n,r),{name:i});return ke.isDisabled||zt(()=>ke("[filterAndMap] mapped:",o)),o},{equals:Ze.structural,argsDebugName:(e,t)=>Qe({caller:"filterAndMap",thread:e,pattern:t})}),G8=it("queryAndMap",function(e,t,r,n={}){let i=$y(e);Sr(`queryAndMap<${i.nameAndSizeUntracked}>`,{patternOrPatterns:t,variables:n,map:r});let o=Qe({thread:i,caller:"queryAndMap"}),a=jy(i,t);ke("[queryAndMap] filtered count:",a.untrackedSize);let s=tr(()=>N$(a,r),{name:o});return ke.isDisabled||zt(()=>ke("[queryAndMap] result:",xr(s))),s},{equals:Ze.structural,argsDebugName:(e,t)=>Qe({caller:"queryAndMap",thread:e,pattern:t})}),q8=it("queryEntity",function(e,t,r,n){Sr(`queryEntity<${e.nameAndSizeUntracked}>`,r,t);let i=oi(e,{en:r,at:U$(t,n)});return ke("queryEntity applogs:",i.applogs),Xe(()=>i.isEmpty?null:Object.fromEntries(i.map(({at:o,vl:a})=>[o.slice(t.length+1),a])))},{equals:fI,argsDebugName:(e,t,r)=>Qe({caller:"queryEntity",thread:e,args:{name:t,entityID:r}})}),W8=it("agentsOfThread",function(e){Sr(`agentsOfThread<${e.nameAndSizeUntracked}>`);let t=Ke.map(),r=Rt(i=>{for(let o of Yr(i)?i.init:i.added){let a=t.get(o.ag)??0;t.set(o.ag,a+1)}for(let o of!Yr(i)&&i.removed||[]){let a=t.get(o.ag);if(!a||a<1)throw wn("[agentsOfThread] number is now negative",{log:o,event:i,mapped:t,prev:a});t.set(o.ag,a-1)}js(`agentsOfThread<${e.nameAndSizeUntracked}> processed event`,{event:i,mapped:t})});r({init:e.applogs});let n=e.subscribe(r);return hs(t,n),t}),j$=it("entityOverlap",function(e,t){return js(`entityOverlap<${e.nameAndSizeUntracked}, ${t.nameAndSizeUntracked}>`),Xe(()=>{let r=new Set(e.map(i=>i.en)),n=new Set(t.map(i=>i.en));return[...r].filter(i=>n.has(i))})}),J8=it("entityOverlapCount",function(e,t){return Xe(()=>j$(e,t).get().length)}),$$=it("querySingle",function(e,t,r={}){let n=jy(e,t,r);return Xe(()=>{if(n.isEmpty)return null;if(n.size>1)throw wn("[querySingle] got",n.size,"results:",n);let i=n.nodes[0].logsOfThisNode;if(i.size!=1)throw wn("[querySingle] single result, but got",i.size,"logs:",i.applogs);return i.applogs[0]})},{equals:Ze.structural,argsDebugName:(e,t)=>Qe({caller:"querySingle",thread:e,pattern:t})}),H8=it("querySingleAndMap",function(e,t,r,n={}){let i=$$(e,t,n);return Xe(()=>{let o=i.get();if(o)return typeof r=="string"?o[r]:$s(r)(o)})},{equals:Ze.structural,argsDebugName:(e,t)=>Qe({caller:"querySingleAndMap",thread:e,pattern:t})}),C$=function(e,t){return typeof t=="function"?e.map(t):typeof t=="string"?e.map(r=>r[t]):e.map($s(t))},N$=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 wn(`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=>$s(t)(e))};function $s(e){return t=>Object.entries(e).reduce((r,[n,i])=>(r[i]=t[n],r),{})}function U$(e,t){return t.map(r=>P$(e,r))}function P$(e,t){return`${e}/${t}`}function $y(e,t){return Array.isArray(e)?Po.fromArray(e,t||`threadFromArray[${e.length}]`,!0):e}function B$(){if(ou!=null&&performance.now()>=ou)throw new D$(ou)}var D$=class extends Error{constructor(e){super(e)}},R$=rt({"../../../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}}}),M$=rt({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/decode.js"(e,t){"use strict";t.exports=i;var r=128,n=127;function i(o,u){var s=0,u=u||0,l=0,f=u,d,I=o.length;do{if(f>=I||l>49)throw i.bytes=0,new RangeError("Could not decode varint");d=o[f++],s+=l<28?(d&n)<<l:(d&n)*Math.pow(2,l),l+=7}while(d>=r);return i.bytes=f-u,s}}}),L$=rt({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/length.js"(e,t){"use strict";var r=Math.pow(2,7),n=Math.pow(2,14),i=Math.pow(2,21),o=Math.pow(2,28),a=Math.pow(2,35),s=Math.pow(2,42),u=Math.pow(2,49),l=Math.pow(2,56),f=Math.pow(2,63);t.exports=function(d){return d<r?1:d<n?2:d<i?3:d<o?4:d<a?5:d<s?6:d<u?7:d<l?8:d<f?9:10}}}),ac=rt({"../../../node_modules/.pnpm/varint@6.0.0/node_modules/varint/index.js"(e,t){"use strict";t.exports={encode:R$(),decode:M$(),encodingLength:L$()}}}),V$=["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 F$(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":z$(e)||"Object"}function z$(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(V$.includes(t))return t}var W=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}};W.uint=new W(0,"uint",!0);W.negint=new W(1,"negint",!0);W.bytes=new W(2,"bytes",!0);W.string=new W(3,"string",!0);W.array=new W(4,"array",!1);W.map=new W(5,"map",!1);W.tag=new W(6,"tag",!1);W.float=new W(7,"float",!0);W.false=new W(7,"false",!0);W.true=new W(7,"true",!0);W.null=new W(7,"null",!0);W.undefined=new W(7,"undefined",!0);W.break=new W(7,"break",!0);var me=class{constructor(e,t,r){this.type=e,this.value=t,this.encodedLength=r,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},Bo=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",K$=new TextEncoder;function Wa(e){return Bo&&globalThis.Buffer.isBuffer(e)}function Cy(e){return e instanceof Uint8Array?Wa(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var G$=24,q$=200,W$=Bo?e=>e.length>=G$?globalThis.Buffer.from(e):vd(e):e=>e.length>=q$?K$.encode(e):vd(e),wr=e=>Uint8Array.from(e),J$=Bo?(e,t,r)=>Wa(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),H$=Bo?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),Cy(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},X$=Bo?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Ny(e,t){if(Wa(e)&&Wa(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 vd(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 Q$=256,Uy=class{constructor(e=Q$){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=X$(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=J$(r,0,this.cursor)}else t=H$(this.chunks,this.cursor);return e&&this.reset(),t}},Z$=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}},qe="CBOR decode error:",Py="CBOR encode error:",Do=[];Do[23]=1;Do[24]=2;Do[25]=3;Do[26]=5;Do[27]=9;function Ni(e,t,r){if(e.length-t<r)throw new Error(`${qe} not enough data for type`)}var ut=[24,256,65536,4294967296,BigInt("18446744073709551616")];function Ln(e,t,r){Ni(e,t,1);let n=e[t];if(r.strict===!0&&n<ut[0])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function Vn(e,t,r){Ni(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<ut[1])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function Fn(e,t,r){Ni(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<ut[2])throw new Error(`${qe} integer encoded in more bytes than necessary (strict decode)`);return n}function zn(e,t,r){Ni(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<ut[3])throw new Error(`${qe} 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(`${qe} integers outside of the safe integer range are not supported`)}function Y$(e,t,r,n){return new me(W.uint,Ln(e,t+1,n),2)}function e5(e,t,r,n){return new me(W.uint,Vn(e,t+1,n),3)}function t5(e,t,r,n){return new me(W.uint,Fn(e,t+1,n),5)}function r5(e,t,r,n){return new me(W.uint,zn(e,t+1,n),9)}function Kn(e,t){return Jt(e,0,t.value)}function Jt(e,t,r){if(r<ut[0]){let n=Number(r);e.push([t|n])}else if(r<ut[1]){let n=Number(r);e.push([t|24,n])}else if(r<ut[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<ut[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<ut[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(`${qe} encountered BigInt larger than allowable range`)}}Kn.encodedSize=function(e){return Jt.encodedSize(e.value)};Jt.encodedSize=function(e){return e<ut[0]?1:e<ut[1]?2:e<ut[2]?3:e<ut[3]?5:9};Kn.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};function n5(e,t,r,n){return new me(W.negint,-1-Ln(e,t+1,n),2)}function i5(e,t,r,n){return new me(W.negint,-1-Vn(e,t+1,n),3)}function o5(e,t,r,n){return new me(W.negint,-1-Fn(e,t+1,n),5)}var sc=BigInt(-1),By=BigInt(1);function a5(e,t,r,n){let i=zn(e,t+1,n);if(typeof i!="bigint"){let o=-1-i;if(o>=Number.MIN_SAFE_INTEGER)return new me(W.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${qe} integers outside of the safe integer range are not supported`);return new me(W.negint,sc-BigInt(i),9)}function uc(e,t){let r=t.value,n=typeof r=="bigint"?r*sc-By:r*-1-1;Jt(e,t.type.majorEncoded,n)}uc.encodedSize=function(e){let t=e.value,r=typeof t=="bigint"?t*sc-By:t*-1-1;return r<ut[0]?1:r<ut[1]?2:r<ut[2]?3:r<ut[3]?5:9};uc.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function Ro(e,t,r,n){Ni(e,t,r+n);let i=e.slice(t+r,t+r+n);return new me(W.bytes,i,r+n)}function s5(e,t,r,n){return Ro(e,t,1,r)}function u5(e,t,r,n){return Ro(e,t,2,Ln(e,t+1,n))}function l5(e,t,r,n){return Ro(e,t,3,Vn(e,t+1,n))}function c5(e,t,r,n){return Ro(e,t,5,Fn(e,t+1,n))}function f5(e,t,r,n){let i=zn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer bytes lengths not supported`);return Ro(e,t,9,i)}function Ja(e){return e.encodedBytes===void 0&&(e.encodedBytes=W.equals(e.type,W.string)?W$(e.value):e.value),e.encodedBytes}function Cs(e,t){let r=Ja(t);Jt(e,t.type.majorEncoded,r.length),e.push(r)}Cs.encodedSize=function(e){let t=Ja(e);return Jt.encodedSize(t.length)+t.length};Cs.compareTokens=function(e,t){return d5(Ja(e),Ja(t))};function d5(e,t){return e.length<t.length?-1:e.length>t.length?1:Ny(e,t)}var wd=new TextDecoder,p5=32;function h5(e,t,r){if(r-t<p5){let n="";for(let i=t;i<r;i++){let o=e[i];if(o&128)return wd.decode(e.subarray(t,r));n+=String.fromCharCode(o)}return n}return wd.decode(e.subarray(t,r))}function Mo(e,t,r,n,i){let o=r+n;Ni(e,t,o);let a=new me(W.string,h5(e,t+r,t+o),o);return i.retainStringBytes===!0&&(a.byteValue=e.slice(t+r,t+o)),a}function y5(e,t,r,n){return Mo(e,t,1,r,n)}function g5(e,t,r,n){return Mo(e,t,2,Ln(e,t+1,n),n)}function m5(e,t,r,n){return Mo(e,t,3,Vn(e,t+1,n),n)}function b5(e,t,r,n){return Mo(e,t,5,Fn(e,t+1,n),n)}function v5(e,t,r,n){let i=zn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer string lengths not supported`);return Mo(e,t,9,i,n)}var w5=Cs;function Ui(e,t,r,n){return new me(W.array,n,r)}function _5(e,t,r,n){return Ui(e,t,1,r)}function T5(e,t,r,n){return Ui(e,t,2,Ln(e,t+1,n))}function E5(e,t,r,n){return Ui(e,t,3,Vn(e,t+1,n))}function x5(e,t,r,n){return Ui(e,t,5,Fn(e,t+1,n))}function O5(e,t,r,n){let i=zn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer array lengths not supported`);return Ui(e,t,9,i)}function A5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return Ui(e,t,1,1/0)}function lc(e,t){Jt(e,W.array.majorEncoded,t.value)}lc.compareTokens=Kn.compareTokens;lc.encodedSize=function(e){return Jt.encodedSize(e.value)};function Pi(e,t,r,n){return new me(W.map,n,r)}function S5(e,t,r,n){return Pi(e,t,1,r)}function I5(e,t,r,n){return Pi(e,t,2,Ln(e,t+1,n))}function k5(e,t,r,n){return Pi(e,t,3,Vn(e,t+1,n))}function j5(e,t,r,n){return Pi(e,t,5,Fn(e,t+1,n))}function $5(e,t,r,n){let i=zn(e,t+1,n);if(typeof i=="bigint")throw new Error(`${qe} 64-bit integer map lengths not supported`);return Pi(e,t,9,i)}function C5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return Pi(e,t,1,1/0)}function cc(e,t){Jt(e,W.map.majorEncoded,t.value)}cc.compareTokens=Kn.compareTokens;cc.encodedSize=function(e){return Jt.encodedSize(e.value)};function N5(e,t,r,n){return new me(W.tag,r,1)}function U5(e,t,r,n){return new me(W.tag,Ln(e,t+1,n),2)}function P5(e,t,r,n){return new me(W.tag,Vn(e,t+1,n),3)}function B5(e,t,r,n){return new me(W.tag,Fn(e,t+1,n),5)}function D5(e,t,r,n){return new me(W.tag,zn(e,t+1,n),9)}function fc(e,t){Jt(e,W.tag.majorEncoded,t.value)}fc.compareTokens=Kn.compareTokens;fc.encodedSize=function(e){return Jt.encodedSize(e.value)};var Dy=20,Ry=21,My=22,Ly=23;function R5(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${qe} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new me(W.null,null,1):new me(W.undefined,void 0,1)}function M5(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${qe} indefinite length items not allowed`);return new me(W.break,void 0,1)}function dc(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${qe} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${qe} Infinity values are not supported`)}return new me(W.float,e,t)}function L5(e,t,r,n){return dc(hc(e,t+1),3,n)}function V5(e,t,r,n){return dc(yc(e,t+1),5,n)}function F5(e,t,r,n){return dc(Ky(e,t+1),9,n)}function pc(e,t,r){let n=t.value;if(n===!1)e.push([W.float.majorEncoded|Dy]);else if(n===!0)e.push([W.float.majorEncoded|Ry]);else if(n===null)e.push([W.float.majorEncoded|My]);else if(n===void 0)e.push([W.float.majorEncoded|Ly]);else{let i,o=!1;(!r||r.float64!==!0)&&(Fy(n),i=hc(Yt,1),n===i||Number.isNaN(n)?(Yt[0]=249,e.push(Yt.slice(0,3)),o=!0):(zy(n),i=yc(Yt,1),n===i&&(Yt[0]=250,e.push(Yt.slice(0,5)),o=!0))),o||(z5(n),i=Ky(Yt,1),Yt[0]=251,e.push(Yt.slice(0,9)))}}pc.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){Fy(r);let n=hc(Yt,1);if(r===n||Number.isNaN(r))return 3;if(zy(r),n=yc(Yt,1),r===n)return 5}return 9};var Vy=new ArrayBuffer(9),Nt=new DataView(Vy,1),Yt=new Uint8Array(Vy,0);function Fy(e){if(e===1/0)Nt.setUint16(0,31744,!1);else if(e===-1/0)Nt.setUint16(0,64512,!1);else if(Number.isNaN(e))Nt.setUint16(0,32256,!1);else{Nt.setFloat32(0,e);let t=Nt.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Nt.setUint16(0,31744,!1);else if(r===0)Nt.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let i=r-127;i<-24?Nt.setUint16(0,0):i<-14?Nt.setUint16(0,(t&2147483648)>>16|1<<24+i,!1):Nt.setUint16(0,(t&2147483648)>>16|i+15<<10|n>>13,!1)}}}function hc(e,t){if(e.length-t<2)throw new Error(`${qe} 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 zy(e){Nt.setFloat32(0,e,!1)}function yc(e,t){if(e.length-t<4)throw new Error(`${qe} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}function z5(e){Nt.setFloat64(0,e,!1)}function Ky(e,t){if(e.length-t<8)throw new Error(`${qe} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}pc.compareTokens=Kn.compareTokens;function Be(e,t,r){throw new Error(`${qe} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}function Ns(e){return()=>{throw new Error(`${qe} ${e}`)}}var pe=[];for(let e=0;e<=23;e++)pe[e]=Be;pe[24]=Y$;pe[25]=e5;pe[26]=t5;pe[27]=r5;pe[28]=Be;pe[29]=Be;pe[30]=Be;pe[31]=Be;for(let e=32;e<=55;e++)pe[e]=Be;pe[56]=n5;pe[57]=i5;pe[58]=o5;pe[59]=a5;pe[60]=Be;pe[61]=Be;pe[62]=Be;pe[63]=Be;for(let e=64;e<=87;e++)pe[e]=s5;pe[88]=u5;pe[89]=l5;pe[90]=c5;pe[91]=f5;pe[92]=Be;pe[93]=Be;pe[94]=Be;pe[95]=Ns("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)pe[e]=y5;pe[120]=g5;pe[121]=m5;pe[122]=b5;pe[123]=v5;pe[124]=Be;pe[125]=Be;pe[126]=Be;pe[127]=Ns("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)pe[e]=_5;pe[152]=T5;pe[153]=E5;pe[154]=x5;pe[155]=O5;pe[156]=Be;pe[157]=Be;pe[158]=Be;pe[159]=A5;for(let e=160;e<=183;e++)pe[e]=S5;pe[184]=I5;pe[185]=k5;pe[186]=j5;pe[187]=$5;pe[188]=Be;pe[189]=Be;pe[190]=Be;pe[191]=C5;for(let e=192;e<=215;e++)pe[e]=N5;pe[216]=U5;pe[217]=P5;pe[218]=B5;pe[219]=D5;pe[220]=Be;pe[221]=Be;pe[222]=Be;pe[223]=Be;for(let e=224;e<=243;e++)pe[e]=Ns("simple values are not supported");pe[244]=Be;pe[245]=Be;pe[246]=Be;pe[247]=R5;pe[248]=Ns("simple values are not supported");pe[249]=L5;pe[250]=V5;pe[251]=F5;pe[252]=Be;pe[253]=Be;pe[254]=Be;pe[255]=M5;var Cr=[];for(let e=0;e<24;e++)Cr[e]=new me(W.uint,e,1);for(let e=-1;e>=-24;e--)Cr[31-e]=new me(W.negint,e,1);Cr[64]=new me(W.bytes,new Uint8Array(0),1);Cr[96]=new me(W.string,"",1);Cr[128]=new me(W.array,0,1);Cr[160]=new me(W.map,0,1);Cr[244]=new me(W.false,!1,1);Cr[245]=new me(W.true,!0,1);Cr[246]=new me(W.null,null,1);function K5(e){switch(e.type){case W.false:return wr([244]);case W.true:return wr([245]);case W.null:return wr([246]);case W.bytes:return e.value.length?void 0:wr([64]);case W.string:return e.value===""?wr([96]):void 0;case W.array:return e.value===0?wr([128]):void 0;case W.map:return e.value===0?wr([160]):void 0;case W.uint:return e.value<24?wr([Number(e.value)]):void 0;case W.negint:if(e.value>=-24)return wr([31-Number(e.value)])}}var G5=Object.freeze({float64:!0,mapSorter:H5,quickEncodeToken:K5});function Gy(){let e=[];return e[W.uint.major]=Kn,e[W.negint.major]=uc,e[W.bytes.major]=Cs,e[W.string.major]=w5,e[W.array.major]=lc,e[W.map.major]=cc,e[W.tag.major]=fc,e[W.float.major]=pc,e}var q5=Gy(),W5=new Uy,_d=class qy{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(`${Py} object contains circular references`);return new qy(r,t)}},Vr={null:new me(W.null,null),undefined:new me(W.undefined,void 0),true:new me(W.true,!0),false:new me(W.false,!1),emptyArray:new me(W.array,0),emptyMap:new me(W.map,0)},tn={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new me(W.float,e):e>=0?new me(W.uint,e):new me(W.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new me(W.uint,e):new me(W.negint,e)},Uint8Array(e,t,r,n){return new me(W.bytes,e)},string(e,t,r,n){return new me(W.string,e)},boolean(e,t,r,n){return e?Vr.true:Vr.false},null(e,t,r,n){return Vr.null},undefined(e,t,r,n){return Vr.undefined},ArrayBuffer(e,t,r,n){return new me(W.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new me(W.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Vr.emptyArray,new me(W.break)]:Vr.emptyArray;n=_d.createCheck(n,e);let i=[],o=0;for(let a of e)i[o++]=aa(a,r,n);return r.addBreakTokens?[new me(W.array,e.length),i,new me(W.break)]:[new me(W.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=_d.createCheck(n,e);let u=!i&&r.ignoreUndefinedProperties,l=0;for(let f of o){let d=i?e.get(f):e[f];u&&d===void 0||(s[l++]=[aa(f,r,n),aa(d,r,n)])}l<a&&(s.length=l)}return s?.length?(J5(s,r),r.addBreakTokens?[new me(W.map,s.length),s,new me(W.break)]:[new me(W.map,s.length),s]):r.addBreakTokens===!0?[Vr.emptyMap,new me(W.break)]:Vr.emptyMap}};tn.Map=tn.Object;tn.Buffer=tn.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))tn[`${e}Array`]=tn.DataView;function aa(e,t={},r){let n=F$(e),i=t&&t.typeEncoders&&t.typeEncoders[n]||tn[n];if(typeof i=="function"){let a=i(e,n,t,r);if(a!=null)return a}let o=tn[n];if(!o)throw new Error(`${Py} unsupported type: ${n}`);return o(e,n,t,r)}function J5(e,t){t.mapSorter&&e.sort(t.mapSorter)}function H5(e,t){if(e[0]instanceof me&&t[0]instanceof me){let r=e[0],n=t[0];return r._keyBytes||(r._keyBytes=Td(r.value)),n._keyBytes||(n._keyBytes=Td(n.value)),Ny(r._keyBytes,n._keyBytes)}throw new Error("rfc8949MapSorter: complex key types are not supported yet")}function Td(e){return X5(e,q5,G5)}function Wy(e,t,r,n){if(Array.isArray(t))for(let i of t)Wy(e,i,r,n);else r[t.type.major](e,t,n)}var X8=W.uint.majorEncoded,Q8=W.negint.majorEncoded,Z8=W.bytes.majorEncoded,Y8=W.string.majorEncoded,eU=W.array.majorEncoded,tU=W.float.majorEncoded|Dy,rU=W.float.majorEncoded|Ry,nU=W.float.majorEncoded|My,iU=W.float.majorEncoded|Ly,oU=BigInt(-1),aU=BigInt(1);function X5(e,t,r,n){let i=n instanceof Uint8Array,o=i?new Z$(n):W5,a=aa(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 Uy(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():Cy(o.chunks[0])}}return o.reset(),Wy(o,a,t,r),o.toBytes(!0)}var sU=Symbol.for("DONE"),uU=Symbol.for("BREAK"),lU=new Uint8Array(0);function Q5(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 gc(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 Z5(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(r[a]!==255)throw new TypeError(o+" is ambiguous");r[a]=i}var s=e.length,u=e.charAt(0),l=Math.log(s)/Math.log(256),f=Math.log(256)/Math.log(s);function d(T){if(T instanceof Uint8Array||(ArrayBuffer.isView(T)?T=new Uint8Array(T.buffer,T.byteOffset,T.byteLength):Array.isArray(T)&&(T=Uint8Array.from(T))),!(T instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(T.length===0)return"";for(var L=0,H=0,B=0,k=T.length;B!==k&&T[B]===0;)B++,L++;for(var F=(k-B)*f+1>>>0,G=new Uint8Array(F);B!==k;){for(var D=T[B],Q=0,K=F-1;(D!==0||Q<H)&&K!==-1;K--,Q++)D+=256*G[K]>>>0,G[K]=D%s>>>0,D=D/s>>>0;if(D!==0)throw new Error("Non-zero carry");H=Q,B++}for(var re=F-H;re!==F&&G[re]===0;)re++;for(var j=u.repeat(L);re<F;++re)j+=e.charAt(G[re]);return j}function I(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,B=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 D=0,Q=k-1;(G!==0||D<B)&&Q!==-1;Q--,D++)G+=s*F[Q]>>>0,F[Q]=G%256>>>0,G=G/256>>>0;if(G!==0)throw new Error("Non-zero carry");B=D,L++}if(T[L]!==" "){for(var K=k-B;K!==k&&F[K]===0;)K++;for(var re=new Uint8Array(H+(k-K)),j=H;K!==k;)re[j++]=F[K++];return re}}}function E(T){var L=I(T);if(L)return L;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:I,decode:E}}var Y5=Z5,eC=Y5,tC=eC,rC=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")}},nC=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 Jy(this,e)}},iC=class{decoders;constructor(e){this.decoders=e}or(e){return Jy(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 Jy(e,t){return new iC({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var oC=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 rC(e,t,r),this.decoder=new nC(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Hy({name:e,prefix:t,encode:r,decode:n}){return new oC(e,t,r,n)}function Us({name:e,prefix:t,alphabet:r}){let{encode:n,decode:i}=tC(r,e);return Hy({prefix:t,name:e,encode:n,decode:o=>gc(i(o))})}function aC(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 sC(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 uC(e){let t={};for(let r=0;r<e.length;++r)t[e[r]]=r;return t}function Nr({name:e,prefix:t,bitsPerChar:r,alphabet:n}){let i=uC(n);return Hy({prefix:t,name:e,encode(o){return sC(o,n,r)},decode(o){return aC(o,i,r,e)}})}var sa=Nr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),cU=Nr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),fU=Nr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),dU=Nr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pU=Nr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hU=Nr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),yU=Nr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gU=Nr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mU=Nr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),au=Us({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),bU=Us({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Gr=Us({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),vU=Us({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),lC=Xy,Ed=128,cC=127,fC=~cC,dC=Math.pow(2,31);function Xy(e,t,r){t=t||[],r=r||0;for(var n=r;e>=dC;)t[r++]=e&255|Ed,e/=128;for(;e&fC;)t[r++]=e&255|Ed,e>>>=7;return t[r]=e|0,Xy.bytes=r-n+1,t}var pC=Lu,hC=128,xd=127;function Lu(e,n){var r=0,n=n||0,i=0,o=n,a,s=e.length;do{if(o>=s)throw Lu.bytes=0,new RangeError("Could not decode varint");a=e[o++],r+=i<28?(a&xd)<<i:(a&xd)*Math.pow(2,i),i+=7}while(a>=hC);return Lu.bytes=o-n,r}var yC=Math.pow(2,7),gC=Math.pow(2,14),mC=Math.pow(2,21),bC=Math.pow(2,28),vC=Math.pow(2,35),wC=Math.pow(2,42),_C=Math.pow(2,49),TC=Math.pow(2,56),EC=Math.pow(2,63),xC=function(e){return e<yC?1:e<gC?2:e<mC?3:e<bC?4:e<vC?5:e<wC?6:e<_C?7:e<TC?8:e<EC?9:10},OC={encode:lC,decode:pC,encodingLength:xC},AC=OC,Ha=AC;function Vu(e,t=0){return[Ha.decode(e,t),Ha.decode.bytes]}function Xa(e,t,r=0){return Ha.encode(e,t,r),t}function Qa(e){return Ha.encodingLength(e)}function SC(e,t){let r=t.byteLength,n=Qa(e),i=n+Qa(r),o=new Uint8Array(i+r);return Xa(e,o,0),Xa(r,o,n),o.set(t,i),new mc(e,r,t,o)}function IC(e){let t=gc(e),[r,n]=Vu(t),[i,o]=Vu(t.subarray(n)),a=t.subarray(n+o);if(a.byteLength!==i)throw new Error("Incorrect length");return new mc(r,i,a,t)}function kC(e,t){if(e===t)return!0;{let r=t;return e.code===r.code&&e.size===r.size&&r.bytes instanceof Uint8Array&&Q5(e.bytes,r.bytes)}}var mc=class{code;size;digest;bytes;constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}};function Od(e,t){let{bytes:r,version:n}=e;switch(n){case 0:return $C(r,Fu(e),t??Gr.encoder);default:return CC(r,Fu(e),t??sa.encoder)}}var Ad=new WeakMap;function Fu(e){let t=Ad.get(e);if(t==null){let r=new Map;return Ad.set(e,r),r}return t}var Qy=class ht{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!==Ki)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==NC)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ht.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=SC(t,r);return ht.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 ht.equals(this,t)}static equals(t,r){let n=r;return n!=null&&t.code===n.code&&t.version===n.version&&kC(t.multihash,n.multihash)}toString(t){return Od(this,t)}toJSON(){return{"/":Od(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 ht)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:a}=r;return new ht(n,i,o,a??Sd(n,i,o.bytes))}else if(r[UC]===!0){let{version:n,multihash:i,code:o}=r,a=IC(i);return ht.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!==Ki)throw new Error(`Version 0 CID must use dag-pb (code: ${Ki}) block encoding`);return new ht(t,r,n,n.bytes)}case 1:{let i=Sd(t,r,n.bytes);return new ht(t,r,n,i)}default:throw new Error("Invalid version")}}static createV0(t){return ht.create(0,Ki,t)}static createV1(t,r){return ht.create(1,t,r)}static decode(t){let[r,n]=ht.decodeFirst(t);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(t){let r=ht.inspectBytes(t),n=r.size-r.multihashSize,i=gc(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 mc(r.multihashCode,r.digestSize,o,i);return[r.version===0?ht.createV0(a):ht.createV1(r.codec,a),t.subarray(r.size)]}static inspectBytes(t){let r=0,n=()=>{let[d,I]=Vu(t.subarray(r));return r+=I,d},i=n(),o=Ki;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]=jC(t,r),o=ht.decode(i);if(o.version===0&&t[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Fu(o).set(n,t),o}};function jC(e,t){switch(e[0]){case"Q":{let r=t??Gr;return[Gr.prefix,r.decode(`${Gr.prefix}${e}`)]}case Gr.prefix:{let r=t??Gr;return[Gr.prefix,r.decode(e)]}case sa.prefix:{let r=t??sa;return[sa.prefix,r.decode(e)]}case au.prefix:{let r=t??au;return[au.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 $C(e,t,r){let{prefix:n}=r;if(n!==Gr.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 CC(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 Ki=112,NC=18;function Sd(e,t,r){let n=Qa(e),i=n+Qa(t),o=new Uint8Array(i+r.byteLength);return Xa(e,o,0),Xa(t,o,n),o.set(r,i),o}var UC=Symbol.for("@ipld/js-cid/CID"),Zy=42;function PC(e){if(e.asCID!==e&&e["/"]!==e.bytes)return null;let t=Qy.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new me(W.tag,Zy),new me(W.bytes,r)]}function BC(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function DC(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 RC(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 Id={float64:!0,typeEncoders:{Map:RC,Object:PC,undefined:BC,number:DC}},wU={...Id,typeEncoders:{...Id.typeEncoders}};function MC(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Qy.decode(e.subarray(1))}var zu={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:[]};zu.tags[Zy]=MC;var _U={...zu,tags:zu.tags.slice()},TU=$r(ac(),1),Jr={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},Ji={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Jr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Jr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Ji["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Ji["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Jr.Int,CarV1HeaderOrV2Pragma:e=>{if(Jr.Map(e)===void 0)return;let t=Object.entries(e),r=e,n=1;for(let i=0;i<t.length;i++){let[o,a]=t[i];switch(o){case"roots":{let s=Ji["CarV1HeaderOrV2Pragma > roots (anon)"](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=Ji.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}},Hi={"CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)":Jr.Link,"CarV1HeaderOrV2Pragma > roots (anon)":e=>{if(Jr.List(e)!==void 0){for(let t=0;t<e.length;t++){let r=e[t];if(r=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](r),r===void 0)return;if(r!==e[t]){let n=e.slice(0,t);for(let i=t;i<e.length;i++){let o=e[i];if(o=Hi["CarV1HeaderOrV2Pragma > roots (anon) > valueType (anon)"](o),o===void 0)return;n.push(o)}return n}}return e}},Int:Jr.Int,CarV1HeaderOrV2Pragma:e=>{if(Jr.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=Hi["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=Hi.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}},EU={toTyped:Ji.CarV1HeaderOrV2Pragma,toRepresentation:Hi.CarV1HeaderOrV2Pragma},xU=Gy(),OU=$r(ac(),1),AU=[new me(W.map,2),new me(W.string,"version"),new me(W.uint,1),new me(W.string,"roots")],SU=new me(W.tag,42),IU=$r(ac(),1),{WARN:Yy,LOG:kU,DEBUG:su,VERBOSE:bc,ERROR:Jn}=Ce.setup(Ce.INFO);async function LC(e){let t=await FC(e);return await VC(t)}async function VC({rootCID:e,blockStore:t},r=[],n){if(!e||!t)throw Jn("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 Jn("[decodePubFromBlocks] pub chain has a loop",{currentCID:f,visited:[...s]});s.add(f);let d=await Xn(t,a);if(bc("[decodePubFromBlocks] root:",f,d,{blockStore:t}),!d)throw Jn("[decodePubFromBlocks] root not found in blockStore",{blockStore:t,currentCID:f});let I;if(d?.info){u||(u=d.applogs);let L=await Xn(t,d.applogs);I=await GC(L,t),o||(o=await Xn(t,d.info),su("new format - infoLogs",o.logs.map(H=>({[H.toString()]:H}))))}else I=d.applogs;let E=async L=>{let H=L,B=await Xn(t,H);if(!B)throw Jn("Could not find applog CID in pub blocks:",H.toString(),{cid:H,root:d,blockStore:t}),new Error(`Could not find applog CID in pub blocks: ${H.toString()}`);return B.pv instanceof Vt&&(B.pv=B.pv.toV1().toString()),{...B,cid:H.toV1().toString()}},T=await Promise.all(I.map(E));if(i=i.concat(T),!d.prev)break;if(n&&Ty(d.prev,n)){su("[decodePubFromBlocks] stopping at stopAtCID:",n.toString());break}if(!await t.get(d.prev))throw Jn("[decodePubFromBlocks] prev snapshot missing from blockStore",{currentCID:f,prev:d.prev.toString(),stopAtCID:n?.toString(),visited:[...s]});a=d.prev}let l={cid:e,info:o?{...o,logs:await Promise.all(o.logs.map(async f=>{let d=f,I=await Xn(t,d);if(!I)throw Jn("Could not find info log CID in pub blocks:",d.toString(),{cid:d,blockStore:t}),new Error(`Could not find info log CID in pub blocks: ${d.toString()}`);return I.pv instanceof Vt&&(I.pv=I.pv.toV1().toString()),{...I,cid:d.toV1().toString()}}))}:null,applogsCID:u,applogs:i};return su("[decodePubFromBlocks] result:",l,{rootCID:e.toString(),blockStore:t,applogs:i}),l}async function FC(e){let t=(await e.getRoots()).map(n=>(typeof n.toV1=="function"?n:Vt.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:Vt.decode(n.bytes);bc({cidFromCarblocks:n,cid:o}),r.set(o.toV1().toString(),i)}return t.length!==1&&Yy("Unexpected roots count:",t),{rootCID:Vt.parse(t[0]),blockStore:{get:n=>r.get(n.toV1().toString())}}}async function Xn(e,t){try{var r=await e.get(t);if(!r)return Yy("returning null"),null}catch(n){if(n.message==="Not Found")return null;throw n}return rc(r)}function zC(e){return async function*(){for(;;){let{done:t,value:r}=await e.read();if(bc("[car] chunk",{done:t,value:r}),t)break;yield r}}()}var{WARN:jU,LOG:$U,DEBUG:CU,VERBOSE:NU,ERROR:KC}=Ce.setup(Ce.INFO);async function GC(e,t){return qC(e)?(await Promise.all(e.chunks.map(async r=>{let n=await Xn(t,r);if(!n.logs)throw KC("Weird chunk",n);return n.logs}))).flat():e.logs}function qC(e){return e.chunks}var Za=yo(Eg(),1),WC=yo(xg(),1),eg=!1,tg=!1;Za.isNode&&(process?.env?.LOGGER_TIME_PREFIX&&(eg=process?.env?.LOGGER_TIME_PREFIX==="true"),process?.env?.LOGGER_PERF_PREFIX&&(tg=process?.env?.LOGGER_PERF_PREFIX==="true"));var JC={prefix:void 0,time:eg,delta:tg,dimDebugOnServer:!0,printOriginOnServer:!0,serverInspectOptions:{},customFormattersOnServer:!0,printStackLinesOnServer:!1,dim:!0},uu=[],rg=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(",")}]`}},ng=class{constructor(e,t){Object.assign(this,{style:e,string:t})}},Xi=!1,ai=class vt{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=vt.INFO,r={}){r=Object.assign({},JC,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(...I){let E=I[I.length-1];return E===i?E():(o(...I.slice(0,-1)),(async()=>{try{let T=E();return T instanceof Promise?await T:T}finally{console.groupEnd()}})())}let d=Object.assign(l.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:l});return u?d:Object.assign(i.bind({}),{isEnabled:u,isDisabled:!u,group:f,force:d})},s=a(t>=vt.ERROR,this.wrapLog(console.error,r));return{ERROR:(...u)=>(s(...u),new Error((0,WC.default)(u))),WARN:a(t>=vt.WARN,this.wrapLog(console.warn,r)),LOG:a(t>=vt.INFO,this.wrapLog(console.log,r)),DEBUG:a(t>=vt.DEBUG,this.wrapLog(console.log,{...r,dim:r.dimDebugOnServer})),VERBOSE:a(t>=vt.VERBOSE,this.wrapLog(console.debug,{...r,dim:r.dimDebugOnServer}))}}static wrapLog(t,r){if(Za.isNode)return t.bind(console);{let n=[];if(r.time||r.delta){let i=Za.isBrowser&&navigator.userAgent.includes("Chrome")?["",vt.timeStr(!!r.time,!!r.delta)]:[];n.push(...i)}return r.prefix&&(Xi?n.push(new ng("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();vt.firstLog||(vt.firstLog=i,vt.lastLog=i);let o=new rg(i-vt.firstLog,i-vt.lastLog,t,r);return vt.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}}}};Za.isBrowser&&(window.devtoolsFormatters=window.devtoolsFormatters??[],window.devtoolsFormatters.push({header:e=>{if(uu&&uu.length){for(let t of uu)if(t.match(e))return["span",{},t.format(e)]}return null},hasBody:()=>!0},{header:e=>{if(!(e instanceof rg))return null;Xi||(Xi=!0);let t=ai.timeStr(e.time,e.delta);return["span",{style:"font-weight: light; color: grey"},t?.toString()]},hasBody:()=>!1},{header:e=>e instanceof ng?(Xi||(Xi=!0),["span",{style:"font-weight: light; color: grey; "},e.string]):null,hasBody:()=>!1}));var{WARN:HC,LOG:UU,DEBUG:Yi,VERBOSE:PU,ERROR:Ps}=ai.setup(ai.INFO),vc=["https://trustless-gateway.link/","https://ipfs.4everland.io/"].map(e=>({url:e}));async function wc(e,{readOnly:t=!0,pinnedCID:r,gateways:n=vc}={}){let{cid:i,errors:o,isIpns:a}=n$(e);if(!i)throw Ps("Failed to parse pubID",e,o);Yi("[retrieveThread] parsedPubID",{cid:i.toString(),errors:o,isIpns:a});let s=await ig(i),{applogs:u,info:l}=await LC(s),f=u.filter(Bu);f.length&&HC(`Found ${f.length} encrypted logs - skipping`);let d=u.filter(E=>!Bu(E));ho(d);let I=Po.fromArray(d,`preview${e&&e!==i.toString()?"-"+e:""}@${i.toString()}`,t);return{cid:i,info:l,thread:I,encryptedCount:f.length}}async function ig(e,t=vc){return e=Ru(e),Yi("Retrieving:",e,e.toString(),"from",t),await _c(t,async(r,n)=>{var i=og(r,e);n>1&&(i+=`&cache-bust=${performance.now()}`);let o=await fetch(i),a=await XC(o,i);Yi("[retrieveCar] GW result",{result:a,gateway:r});let s=await lp.fromIterable(a);Yi("[retrieveCar] GW decodeResult",{car:s,gateway:r});let u=(await s.getRoots())[0];if(!ic(e)&&!Ty(e,u))throw Ps("Fetched CAR has different CID",u.toString(),"than the one asked for:",e.toString());return s})}function og(e,t,r="all"){let n=new URL(e.url),i=ic(t),o=`${n}${i?"ipns/":"ipfs/"}${t.toString()}?format=car&dag-scope=${r}`;return Yi({isIpns:i,url:o}),o}async function XC(e,t){if(!e?.ok||!e?.body)throw Ps("[retrieveCar] unexpected response",e?.statusText,{url:t});return zC(e.body.getReader())}async function _c(e,t,r=1){try{return await Promise.any(ja(e).map(async n=>{try{return await t(n,r)}catch(i){throw Ps("still trying",i),i instanceof Error?i:new Error(`[retrieveCar] error: ${i}`)}}))}catch(n){if(r<3)return await _c(e,t,r+1);throw new Error("[Gateway] no valid results after 3 attempts via: "+ja(e).map(({url:i})=>i)+`
|
|
63
|
-
`+n.errors.map(i=>i.message))}}var{WARN:h6,LOG:y6,DEBUG:g6,VERBOSE:m6,ERROR:b6}=Ce.setup(Ce.INFO),{WARN:QC,LOG:v6,DEBUG:ZC,VERBOSE:Bs,ERROR:w6}=Ce.setup(Ce.INFO),_6=it("queryDivergencesByPrev",function(e){ZC(`queryDivergencesByPrev<${e.nameAndSizeUntracked}>`),e.filters.includes("lastWriteWins")&&QC("queryDivergencesByPrev on thread lastWriteWins",e);let t=tr(()=>{let r=new Map,n=new Set;Bs("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())),Bs("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 Po(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 Bs.isDisabled||zt(()=>Bs("[queryDivergencesByPrev] result:",xr(t))),t},{equals:Ze.structural}),{WARN:T6,LOG:E6,DEBUG:x6,VERBOSE:O6,ERROR:A6}=ai.setup(ai.INFO);var{WARN:j6,LOG:$6,DEBUG:C6,VERBOSE:N6,ERROR:U6}=Vs.setup(Vs.INFO),YC="https://nftstorage.link";async function P6(e,{readOnly:t=!0,pinnedCID:r}={}){return wc(e,{readOnly:t,pinnedCID:r,gateways:[{url:YC}]})}export{YC as a,P6 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-ROMFFL4Y.min.js.map
|