UNPKG

@junobuild/analytics

Version:

Tracker for Juno analytics

3 lines (2 loc) 282 kB
"use strict";(()=>{var Wl=Object.create;var Oi=Object.defineProperty;var Zl=Object.getOwnPropertyDescriptor;var Xl=Object.getOwnPropertyNames;var Jl=Object.getPrototypeOf,Ql=Object.prototype.hasOwnProperty;var ht=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ht=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),qn=(e,t)=>{for(var r in t)Oi(e,r,{get:t[r],enumerable:!0})},Cc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xl(t))!Ql.call(e,i)&&i!==r&&Oi(e,i,{get:()=>t[i],enumerable:!(n=Zl(t,i))||n.enumerable});return e};var sn=(e,t,r)=>(r=e!=null?Wl(Jl(e)):{},Cc(t||!e||!e.__esModule?Oi(r,"default",{value:e,enumerable:!0}):r,e)),Ll=e=>Cc(Oi({},"__esModule",{value:!0}),e);function qc(e){let t=0,r=0,n="";function i(s){return t<0?r|=s>>-t:r=s<<t&248,t>3?(t-=8,1):(t<4&&(n+=Fi[r>>3],t+=5),0)}for(let s=0;s<e.length;)s+=i(e[s]);return n+(t<0?Fi[r>>3]:"")}function Vc(e){let t=0,r=0,n=new Uint8Array(e.length*4/3|0),i=0;function s(o){let a=on[o.toLowerCase()];if(a===void 0)throw new Error(`Invalid character: ${JSON.stringify(o)}`);a<<=3,r|=a>>>t,t+=5,t>=8&&(n[i++]=r,t-=8,t>0?r=a<<5-t&255:r=0)}for(let o of e)s(o);return n.slice(0,i)}var Fi,on,$c=ht(()=>{Fi="abcdefghijklmnopqrstuvwxyz234567",on=Object.create(null);for(let e=0;e<Fi.length;e++)on[Fi[e]]=e;on[0]=on.o;on[1]=on.i});function jc(e){let t=new Uint8Array(e),r=-1;for(let n=0;n<t.length;n++){let s=(t[n]^r)&255;r=Dl[s]^r>>>8}return(r^-1)>>>0}var Dl,Hc=ht(()=>{Dl=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117])});function th(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Ro(e,...t){if(!th(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function Oo(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 Gc(e,t){Ro(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var Fo=ht(()=>{});var $r,zc=ht(()=>{$r=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function Yc(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Uo(e){return typeof e=="string"&&(e=Yc(e)),Ro(e),e}function Vn(e){let t=n=>e().update(Uo(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Pi(e=32){if($r&&typeof $r.getRandomValues=="function")return $r.getRandomValues(new Uint8Array(e));if($r&&typeof $r.randomBytes=="function")return $r.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")}var Ii,Re,Sm,Ui,Nm,an=ht(()=>{zc();Fo();Ii=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Re=(e,t)=>e<<32-t|e>>>t,Sm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;Ui=class{clone(){return this._cloneInto()}},Nm={}.toString});function eh(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,l=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+l,a,n)}var Kc,Wc,cn,Io=ht(()=>{Fo();an();Kc=(e,t,r)=>e&t^~e&r,Wc=(e,t,r)=>e&t^e&r^t&r,cn=class extends Ui{constructor(t,r,n,i){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Ii(this.buffer)}update(t){Oo(this);let{view:r,buffer:n,blockLen:i}=this;t=Uo(t);let s=t.length;for(let o=0;o<s;){let a=Math.min(i-this.pos,s-o);if(a===i){let c=Ii(t);for(;i<=s-o;o+=i)this.process(c,o);continue}n.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Oo(this),Gc(t,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;r[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let d=o;d<i;d++)r[d]=0;eh(n,i-8,BigInt(this.length*8),s),this.process(n,0);let a=Ii(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=c/4,h=this.get();if(l>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<l;d++)a.setUint32(4*d,h[d],s)}digest(){let{buffer:t,outputLen:r}=this;this.digestInto(t);let n=t.slice(0,r);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:s,destroyed:o,pos:a}=this;return t.length=i,t.pos=a,t.finished=s,t.destroyed=o,i%r&&t.buffer.set(n),t}}});var rh,wr,br,ki,Po,$n,Zc,Mi=ht(()=>{Io();an();rh=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),wr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),br=new Uint32Array(64),ki=class extends cn{constructor(){super(64,32,8,!1),this.A=wr[0]|0,this.B=wr[1]|0,this.C=wr[2]|0,this.D=wr[3]|0,this.E=wr[4]|0,this.F=wr[5]|0,this.G=wr[6]|0,this.H=wr[7]|0}get(){let{A:t,B:r,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[t,r,n,i,s,o,a,c]}set(t,r,n,i,s,o,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,r){for(let d=0;d<16;d++,r+=4)br[d]=t.getUint32(r,!1);for(let d=16;d<64;d++){let g=br[d-15],w=br[d-2],f=Re(g,7)^Re(g,18)^g>>>3,O=Re(w,17)^Re(w,19)^w>>>10;br[d]=O+br[d-7]+f+br[d-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:l,H:h}=this;for(let d=0;d<64;d++){let g=Re(a,6)^Re(a,11)^Re(a,25),w=h+g+Kc(a,c,l)+rh[d]+br[d]|0,O=(Re(n,2)^Re(n,13)^Re(n,22))+Wc(n,i,s)|0;h=l,l=c,c=a,a=o+w|0,o=s,s=i,i=n,n=w+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,h=h+this.H|0,this.set(n,i,s,o,a,c,l,h)}roundClean(){br.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Po=class extends ki{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}},$n=Vn(()=>new ki),Zc=Vn(()=>new Po)});function Xc(e){return Zc.create().update(new Uint8Array(e)).digest()}var Jc=ht(()=>{Mi()});var Ci,nh,Qc,ih,sh,oh,dt,we=ht(()=>{$c();Hc();Jc();Ci="__principal__",nh=2,Qc=4,ih="aaaaa-aa",sh=e=>{var t;return new Uint8Array(((t=e.match(/.{1,2}/g))!==null&&t!==void 0?t:[]).map(r=>parseInt(r,16)))},oh=e=>e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),""),dt=class e{constructor(t){this._arr=t,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([Qc]))}static managementCanister(){return this.fromHex(ih)}static selfAuthenticating(t){let r=Xc(t);return new this(new Uint8Array([...r,nh]))}static from(t){if(typeof t=="string")return e.fromText(t);if(Object.getPrototypeOf(t)===Uint8Array.prototype)return new e(t);if(typeof t=="object"&&t!==null&&t._isPrincipal===!0)return new e(t._arr);throw new Error(`Impossible to convert ${JSON.stringify(t)} to Principal.`)}static fromHex(t){return new this(sh(t))}static fromText(t){let r=t;if(t.includes(Ci)){let o=JSON.parse(t);Ci in o&&(r=o[Ci])}let n=r.toLowerCase().replace(/-/g,""),i=Vc(n);i=i.slice(4,i.length);let s=new this(i);if(s.toText()!==r)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${r}" may not be a valid Principal ID).`);return s}static fromUint8Array(t){return new this(t)}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===Qc}toUint8Array(){return this._arr}toHex(){return oh(this._arr).toUpperCase()}toText(){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,jc(this._arr));let n=new Uint8Array(t),i=Uint8Array.from(this._arr),s=new Uint8Array([...n,...i]),a=qc(s).match(/.{1,5}/g);if(!a)throw new Error;return a.join("-")}toString(){return this.toText()}toJSON(){return{[Ci]:this.toText()}}compareTo(t){for(let r=0;r<Math.min(this._arr.length,t._arr.length);r++){if(this._arr[r]<t._arr[r])return"lt";if(this._arr[r]>t._arr[r])return"gt"}return this._arr.length<t._arr.length?"lt":this._arr.length>t._arr.length?"gt":"eq"}ltEq(t){let r=this.compareTo(t);return r=="lt"||r=="eq"}gtEq(t){let r=this.compareTo(t);return r=="gt"||r=="eq"}}});var tu=Ht(qi=>{"use strict";qi.byteLength=ch;qi.toByteArray=fh;qi.fromByteArray=dh;var Ye=[],ve=[],ah=typeof Uint8Array<"u"?Uint8Array:Array,ko="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(jr=0,Lc=ko.length;jr<Lc;++jr)Ye[jr]=ko[jr],ve[ko.charCodeAt(jr)]=jr;var jr,Lc;ve[45]=62;ve[95]=63;function Dc(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function ch(e){var t=Dc(e),r=t[0],n=t[1];return(r+n)*3/4-n}function uh(e,t,r){return(t+r)*3/4-r}function fh(e){var t,r=Dc(e),n=r[0],i=r[1],s=new ah(uh(e,n,i)),o=0,a=i>0?n-4:n,c;for(c=0;c<a;c+=4)t=ve[e.charCodeAt(c)]<<18|ve[e.charCodeAt(c+1)]<<12|ve[e.charCodeAt(c+2)]<<6|ve[e.charCodeAt(c+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=ve[e.charCodeAt(c)]<<2|ve[e.charCodeAt(c+1)]>>4,s[o++]=t&255),i===1&&(t=ve[e.charCodeAt(c)]<<10|ve[e.charCodeAt(c+1)]<<4|ve[e.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function lh(e){return Ye[e>>18&63]+Ye[e>>12&63]+Ye[e>>6&63]+Ye[e&63]}function hh(e,t,r){for(var n,i=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(lh(n));return i.join("")}function dh(e){for(var t,r=e.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(hh(e,o,o+s>a?a:o+s));return n===1?(t=e[r-1],i.push(Ye[t>>2]+Ye[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Ye[t>>10]+Ye[t>>4&63]+Ye[t<<2&63]+"=")),i.join("")}});var Co=Ht(Mo=>{Mo.read=function(e,t,r,n,i){var s,o,a=i*8-n-1,c=(1<<a)-1,l=c>>1,h=-7,d=r?i-1:0,g=r?-1:1,w=e[t+d];for(d+=g,s=w&(1<<-h)-1,w>>=-h,h+=a;h>0;s=s*256+e[t+d],d+=g,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=n;h>0;o=o*256+e[t+d],d+=g,h-=8);if(s===0)s=1-l;else{if(s===c)return o?NaN:(w?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-l}return(w?-1:1)*o*Math.pow(2,s-n)};Mo.write=function(e,t,r,n,i,s){var o,a,c,l=s*8-i-1,h=(1<<l)-1,d=h>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:s-1,f=n?1:-1,O=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?t+=g/c:t+=g*Math.pow(2,1-d),t*c>=2&&(o++,c/=2),o+d>=h?(a=0,o=h):o+d>=1?(a=(t*c-1)*Math.pow(2,i),o=o+d):(a=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+w]=a&255,w+=f,a/=256,i-=8);for(o=o<<i|a,l+=i;l>0;e[r+w]=o&255,w+=f,o/=256,l-=8);e[r+w-f]|=O*128}});var gu=Ht(hn=>{"use strict";var qo=tu(),fn=Co(),eu=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;hn.Buffer=H;hn.SlowBuffer=bh;hn.INSPECT_MAX_BYTES=50;var Vi=2147483647;hn.kMaxLength=Vi;H.TYPED_ARRAY_SUPPORT=ph();!H.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ph(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(H.prototype,"parent",{enumerable:!0,get:function(){if(H.isBuffer(this))return this.buffer}});Object.defineProperty(H.prototype,"offset",{enumerable:!0,get:function(){if(H.isBuffer(this))return this.byteOffset}});function sr(e){if(e>Vi)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,H.prototype),t}function H(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ho(e)}return su(e,t,r)}H.poolSize=8192;function su(e,t,r){if(typeof e=="string")return yh(e,t);if(ArrayBuffer.isView(e))return gh(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Ke(e,ArrayBuffer)||e&&Ke(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ke(e,SharedArrayBuffer)||e&&Ke(e.buffer,SharedArrayBuffer)))return $o(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(n!=null&&n!==e)return H.from(n,t,r);let i=wh(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return H.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}H.from=function(e,t,r){return su(e,t,r)};Object.setPrototypeOf(H.prototype,Uint8Array.prototype);Object.setPrototypeOf(H,Uint8Array);function ou(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function mh(e,t,r){return ou(e),e<=0?sr(e):t!==void 0?typeof r=="string"?sr(e).fill(t,r):sr(e).fill(t):sr(e)}H.alloc=function(e,t,r){return mh(e,t,r)};function Ho(e){return ou(e),sr(e<0?0:Go(e)|0)}H.allocUnsafe=function(e){return Ho(e)};H.allocUnsafeSlow=function(e){return Ho(e)};function yh(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!H.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=au(e,t)|0,n=sr(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}function Vo(e){let t=e.length<0?0:Go(e.length)|0,r=sr(t);for(let n=0;n<t;n+=1)r[n]=e[n]&255;return r}function gh(e){if(Ke(e,Uint8Array)){let t=new Uint8Array(e);return $o(t.buffer,t.byteOffset,t.byteLength)}return Vo(e)}function $o(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return t===void 0&&r===void 0?n=new Uint8Array(e):r===void 0?n=new Uint8Array(e,t):n=new Uint8Array(e,t,r),Object.setPrototypeOf(n,H.prototype),n}function wh(e){if(H.isBuffer(e)){let t=Go(e.length)|0,r=sr(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||Yo(e.length)?sr(0):Vo(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Vo(e.data)}function Go(e){if(e>=Vi)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Vi.toString(16)+" bytes");return e|0}function bh(e){return+e!=e&&(e=0),H.alloc(+e)}H.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==H.prototype};H.compare=function(t,r){if(Ke(t,Uint8Array)&&(t=H.from(t,t.offset,t.byteLength)),Ke(r,Uint8Array)&&(r=H.from(r,r.offset,r.byteLength)),!H.isBuffer(t)||!H.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let n=t.length,i=r.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(t[s]!==r[s]){n=t[s],i=r[s];break}return n<i?-1:i<n?1:0};H.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};H.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return H.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<t.length;++n)r+=t[n].length;let i=H.allocUnsafe(r),s=0;for(n=0;n<t.length;++n){let o=t[n];if(Ke(o,Uint8Array))s+o.length>i.length?(H.isBuffer(o)||(o=H.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(H.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function au(e,t){if(H.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Ke(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return jo(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return yu(e).length;default:if(i)return n?-1:jo(e).length;t=(""+t).toLowerCase(),i=!0}}H.byteLength=au;function xh(e,t,r){let n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return Oh(this,t,r);case"utf8":case"utf-8":return uu(this,t,r);case"ascii":return Nh(this,t,r);case"latin1":case"binary":return Rh(this,t,r);case"base64":return Th(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Fh(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}H.prototype._isBuffer=!0;function Hr(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}H.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)Hr(this,r,r+1);return this};H.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)Hr(this,r,r+3),Hr(this,r+1,r+2);return this};H.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)Hr(this,r,r+7),Hr(this,r+1,r+6),Hr(this,r+2,r+5),Hr(this,r+3,r+4);return this};H.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?uu(this,0,t):xh.apply(this,arguments)};H.prototype.toLocaleString=H.prototype.toString;H.prototype.equals=function(t){if(!H.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:H.compare(this,t)===0};H.prototype.inspect=function(){let t="",r=hn.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};eu&&(H.prototype[eu]=H.prototype.inspect);H.prototype.compare=function(t,r,n,i,s){if(Ke(t,Uint8Array)&&(t=H.from(t,t.offset,t.byteLength)),!H.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;let o=s-i,a=n-r,c=Math.min(o,a),l=this.slice(i,s),h=t.slice(r,n);for(let d=0;d<c;++d)if(l[d]!==h[d]){o=l[d],a=h[d];break}return o<a?-1:a<o?1:0};function cu(e,t,r,n,i){if(e.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Yo(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=H.from(t,n)),H.isBuffer(t))return t.length===0?-1:ru(e,t,r,n,i);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):ru(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ru(e,t,r,n,i){let s=1,o=e.length,a=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;s=2,o/=2,a/=2,r/=2}function c(h,d){return s===1?h[d]:h.readUInt16BE(d*s)}let l;if(i){let h=-1;for(l=r;l<o;l++)if(c(e,l)===c(t,h===-1?0:l-h)){if(h===-1&&(h=l),l-h+1===a)return h*s}else h!==-1&&(l-=l-h),h=-1}else for(r+a>o&&(r=o-a),l=r;l>=0;l--){let h=!0;for(let d=0;d<a;d++)if(c(e,l+d)!==c(t,d)){h=!1;break}if(h)return l}return-1}H.prototype.includes=function(t,r,n){return this.indexOf(t,r,n)!==-1};H.prototype.indexOf=function(t,r,n){return cu(this,t,r,n,!0)};H.prototype.lastIndexOf=function(t,r,n){return cu(this,t,r,n,!1)};function _h(e,t,r,n){r=Number(r)||0;let i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let s=t.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let a=parseInt(t.substr(o*2,2),16);if(Yo(a))return o;e[r+o]=a}return o}function Eh(e,t,r,n){return $i(jo(t,e.length-r),e,r,n)}function vh(e,t,r,n){return $i(kh(t),e,r,n)}function Bh(e,t,r,n){return $i(yu(t),e,r,n)}function Ah(e,t,r,n){return $i(Mh(t,e.length-r),e,r,n)}H.prototype.write=function(t,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return _h(this,t,r,n);case"utf8":case"utf-8":return Eh(this,t,r,n);case"ascii":case"latin1":case"binary":return vh(this,t,r,n);case"base64":return Bh(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ah(this,t,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};H.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Th(e,t,r){return t===0&&r===e.length?qo.fromByteArray(e):qo.fromByteArray(e.slice(t,r))}function uu(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let s=e[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a<=r){let c,l,h,d;switch(a){case 1:s<128&&(o=s);break;case 2:c=e[i+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=e[i+1],l=e[i+2],(c&192)===128&&(l&192)===128&&(d=(s&15)<<12|(c&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:c=e[i+1],l=e[i+2],h=e[i+3],(c&192)===128&&(l&192)===128&&(h&192)===128&&(d=(s&15)<<18|(c&63)<<12|(l&63)<<6|h&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return Sh(n)}var nu=4096;function Sh(e){let t=e.length;if(t<=nu)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=nu));return r}function Nh(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]&127);return n}function Rh(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Oh(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let s=t;s<r;++s)i+=Ch[e[s]];return i}function Fh(e,t,r){let n=e.slice(t,r),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}H.prototype.slice=function(t,r){let n=this.length;t=~~t,r=r===void 0?n:~~r,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<t&&(r=t);let i=this.subarray(t,r);return Object.setPrototypeOf(i,H.prototype),i};function Qt(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}H.prototype.readUintLE=H.prototype.readUIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Qt(t,r,this.length);let i=this[t],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[t+o]*s;return i};H.prototype.readUintBE=H.prototype.readUIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Qt(t,r,this.length);let i=this[t+--r],s=1;for(;r>0&&(s*=256);)i+=this[t+--r]*s;return i};H.prototype.readUint8=H.prototype.readUInt8=function(t,r){return t=t>>>0,r||Qt(t,1,this.length),this[t]};H.prototype.readUint16LE=H.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||Qt(t,2,this.length),this[t]|this[t+1]<<8};H.prototype.readUint16BE=H.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||Qt(t,2,this.length),this[t]<<8|this[t+1]};H.prototype.readUint32LE=H.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||Qt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};H.prototype.readUint32BE=H.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||Qt(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};H.prototype.readBigUInt64LE=xr(function(t){t=t>>>0,ln(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&jn(t,this.length-8);let i=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});H.prototype.readBigUInt64BE=xr(function(t){t=t>>>0,ln(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&jn(t,this.length-8);let i=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});H.prototype.readIntLE=function(t,r,n){t=t>>>0,r=r>>>0,n||Qt(t,r,this.length);let i=this[t],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[t+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*r)),i};H.prototype.readIntBE=function(t,r,n){t=t>>>0,r=r>>>0,n||Qt(t,r,this.length);let i=r,s=1,o=this[t+--i];for(;i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};H.prototype.readInt8=function(t,r){return t=t>>>0,r||Qt(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};H.prototype.readInt16LE=function(t,r){t=t>>>0,r||Qt(t,2,this.length);let n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};H.prototype.readInt16BE=function(t,r){t=t>>>0,r||Qt(t,2,this.length);let n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};H.prototype.readInt32LE=function(t,r){return t=t>>>0,r||Qt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};H.prototype.readInt32BE=function(t,r){return t=t>>>0,r||Qt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};H.prototype.readBigInt64LE=xr(function(t){t=t>>>0,ln(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&jn(t,this.length-8);let i=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});H.prototype.readBigInt64BE=xr(function(t){t=t>>>0,ln(t,"offset");let r=this[t],n=this[t+7];(r===void 0||n===void 0)&&jn(t,this.length-8);let i=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+n)});H.prototype.readFloatLE=function(t,r){return t=t>>>0,r||Qt(t,4,this.length),fn.read(this,t,!0,23,4)};H.prototype.readFloatBE=function(t,r){return t=t>>>0,r||Qt(t,4,this.length),fn.read(this,t,!1,23,4)};H.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||Qt(t,8,this.length),fn.read(this,t,!0,52,8)};H.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||Qt(t,8,this.length),fn.read(this,t,!1,52,8)};function he(e,t,r,n,i,s){if(!H.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}H.prototype.writeUintLE=H.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;he(this,t,r,n,a,0)}let s=1,o=0;for(this[r]=t&255;++o<n&&(s*=256);)this[r+o]=t/s&255;return r+n};H.prototype.writeUintBE=H.prototype.writeUIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;he(this,t,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=t&255;--s>=0&&(o*=256);)this[r+s]=t/o&255;return r+n};H.prototype.writeUint8=H.prototype.writeUInt8=function(t,r,n){return t=+t,r=r>>>0,n||he(this,t,r,1,255,0),this[r]=t&255,r+1};H.prototype.writeUint16LE=H.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||he(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};H.prototype.writeUint16BE=H.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||he(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};H.prototype.writeUint32LE=H.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||he(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};H.prototype.writeUint32BE=H.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||he(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function fu(e,t,r,n,i){mu(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s,s=s>>8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,r}function lu(e,t,r,n,i){mu(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s=s>>8,e[r+6]=s,s=s>>8,e[r+5]=s,s=s>>8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o=o>>8,e[r+2]=o,o=o>>8,e[r+1]=o,o=o>>8,e[r]=o,r+8}H.prototype.writeBigUInt64LE=xr(function(t,r=0){return fu(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});H.prototype.writeBigUInt64BE=xr(function(t,r=0){return lu(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});H.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let c=Math.pow(2,8*n-1);he(this,t,r,n,c-1,-c)}let s=0,o=1,a=0;for(this[r]=t&255;++s<n&&(o*=256);)t<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(t/o>>0)-a&255;return r+n};H.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r>>>0,!i){let c=Math.pow(2,8*n-1);he(this,t,r,n,c-1,-c)}let s=n-1,o=1,a=0;for(this[r+s]=t&255;--s>=0&&(o*=256);)t<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(t/o>>0)-a&255;return r+n};H.prototype.writeInt8=function(t,r,n){return t=+t,r=r>>>0,n||he(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};H.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r>>>0,n||he(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};H.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r>>>0,n||he(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};H.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r>>>0,n||he(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};H.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r>>>0,n||he(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};H.prototype.writeBigInt64LE=xr(function(t,r=0){return fu(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});H.prototype.writeBigInt64BE=xr(function(t,r=0){return lu(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function hu(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function du(e,t,r,n,i){return t=+t,r=r>>>0,i||hu(e,t,r,4,34028234663852886e22,-34028234663852886e22),fn.write(e,t,r,n,23,4),r+4}H.prototype.writeFloatLE=function(t,r,n){return du(this,t,r,!0,n)};H.prototype.writeFloatBE=function(t,r,n){return du(this,t,r,!1,n)};function pu(e,t,r,n,i){return t=+t,r=r>>>0,i||hu(e,t,r,8,17976931348623157e292,-17976931348623157e292),fn.write(e,t,r,n,52,8),r+8}H.prototype.writeDoubleLE=function(t,r,n){return pu(this,t,r,!0,n)};H.prototype.writeDoubleBE=function(t,r,n){return pu(this,t,r,!1,n)};H.prototype.copy=function(t,r,n,i){if(!H.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r<i-n&&(i=t.length-r+n);let s=i-n;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),r),s};H.prototype.fill=function(t,r,n,i){if(typeof t=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!H.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(t.length===1){let o=t.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(t=o)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);let s;if(typeof t=="number")for(s=r;s<n;++s)this[s]=t;else{let o=H.isBuffer(t)?t:H.from(t,i),a=o.length;if(a===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=o[s%a]}return this};var un={};function zo(e,t,r){un[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}zo("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);zo("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);zo("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=iu(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=iu(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);function iu(e){let t="",r=e.length,n=e[0]==="-"?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function Uh(e,t,r){ln(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&jn(t,e.length-(r+1))}function mu(e,t,r,n,i,s){if(e>r||e<t){let o=typeof t=="bigint"?"n":"",a;throw s>3?t===0||t===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${t}${o} and <= ${r}${o}`,new un.ERR_OUT_OF_RANGE("value",a,e)}Uh(n,i,s)}function ln(e,t){if(typeof e!="number")throw new un.ERR_INVALID_ARG_TYPE(t,"number",e)}function jn(e,t,r){throw Math.floor(e)!==e?(ln(e,r),new un.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new un.ERR_BUFFER_OUT_OF_BOUNDS:new un.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var Ih=/[^+/0-9A-Za-z-_]/g;function Ph(e){if(e=e.split("=")[0],e=e.trim().replace(Ih,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function jo(e,t){t=t||1/0;let r,n=e.length,i=null,s=[];for(let o=0;o<n;++o){if(r=e.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function kh(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function Mh(e,t){let r,n,i,s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}function yu(e){return qo.toByteArray(Ph(e))}function $i(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Ke(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Yo(e){return e!==e}var Ch=function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function xr(e){return typeof BigInt>"u"?qh:e}function qh(){throw new Error("BigInt not supported")}});var Hn,Ko=ht(()=>{(function(e){e[e.SysFatal=1]="SysFatal",e[e.SysTransient=2]="SysTransient",e[e.DestinationInvalid=3]="DestinationInvalid",e[e.CanisterReject=4]="CanisterReject",e[e.CanisterError=5]="CanisterError"})(Hn||(Hn={}))});function oe(...e){let t=new Uint8Array(e.reduce((n,i)=>n+i.byteLength,0)),r=0;for(let n of e)t.set(new Uint8Array(n),r),r+=n.byteLength;return t.buffer}function Bt(e){return[...new Uint8Array(e)].map(t=>t.toString(16).padStart(2,"0")).join("")}function Gr(e){if(!Vh.test(e))throw new Error("Invalid hexadecimal string.");let t=[...e].reduce((r,n,i)=>(r[i/2|0]=(r[i/2|0]||"")+n,r),[]).map(r=>Number.parseInt(r,16));return new Uint8Array(t).buffer}function Wo(e,t){if(e.byteLength!==t.byteLength)return e.byteLength-t.byteLength;let r=new Uint8Array(e),n=new Uint8Array(t);for(let i=0;i<r.length;i++)if(r[i]!==n[i])return r[i]-n[i];return 0}function zr(e,t){return Wo(e,t)===0}function Gn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).buffer}function Zo(e){return e instanceof Uint8Array?Gn(e):e instanceof ArrayBuffer?e:Array.isArray(e)?Gn(new Uint8Array(e)):"buffer"in e?Zo(e.buffer):Gn(new Uint8Array(e))}var Vh,de=ht(()=>{Vh=new RegExp(/^[0-9a-fA-F]+$/)});var Ft,dn=ht(()=>{we();Ko();de();Ft=class e extends Error{constructor(t){super(t),this.message=t,this.name="AgentError",this.__proto__=e.prototype,Object.setPrototypeOf(this,e.prototype)}}});function Et(...e){let t=new Uint8Array(e.reduce((n,i)=>n+i.byteLength,0)),r=0;for(let n of e)t.set(new Uint8Array(n),r),r+=n.byteLength;return t}function Xo(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).buffer}function zn(e){return e instanceof Uint8Array?Xo(e):e instanceof ArrayBuffer?e:Array.isArray(e)?Xo(new Uint8Array(e)):"buffer"in e?zn(e.buffer):Xo(new Uint8Array(e))}var Oe,ji=ht(()=>{Oe=class{constructor(t,r=t?.byteLength||0){this._buffer=zn(t||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return zn(this._view.slice())}get byteLength(){return this._view.byteLength}read(t){let r=this._view.subarray(0,t);return this._view=this._view.subarray(t),r.slice().buffer}readUint8(){let t=this._view[0];return this._view=this._view.subarray(1),t}write(t){let r=new Uint8Array(t),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+r.byteLength>=this._buffer.byteLength?this.alloc(r.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+r.byteLength),this._view.set(r,n)}get end(){return this._view.byteLength===0}alloc(t){let r=new ArrayBuffer((this._buffer.byteLength+t)*1.2|0),n=new Uint8Array(r,0,this._view.byteLength+t);n.set(this._view),this._buffer=r,this._view=n}}});function $h(e){let r=new TextEncoder().encode(e),n=0;for(let i of r)n=(n*223+i)%2**32;return n}function Fe(e){if(/^_\d+_$/.test(e)||/^_0x[0-9a-fA-F]+_$/.test(e)){let t=+e.slice(1,-1);if(Number.isSafeInteger(t)&&t>=0&&t<2**32)return t}return $h(e)}var Jo=ht(()=>{});function wu(){throw new Error("unexpected end of buffer")}function Er(e,t){return e.byteLength<t&&wu(),e.read(t)}function _r(e){let t=e.readUint8();return t===void 0&&wu(),t}function Pt(e){if(typeof e=="number"&&(e=BigInt(e)),e<BigInt(0))throw new Error("Cannot leb encode negative values.");let t=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,r=new Oe(new ArrayBuffer(t),0);for(;;){let n=Number(e&BigInt(127));if(e/=BigInt(128),e===BigInt(0)){r.write(new Uint8Array([n]));break}else r.write(new Uint8Array([n|128]))}return r.buffer}function Gt(e){let t=BigInt(1),r=BigInt(0),n;do n=_r(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}function zt(e){typeof e=="number"&&(e=BigInt(e));let t=e<BigInt(0);t&&(e=-e-BigInt(1));let r=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,n=new Oe(new ArrayBuffer(r),0);for(;;){let s=i(e);if(e/=BigInt(128),t&&e===BigInt(0)&&(s&64)!==0||!t&&e===BigInt(0)&&(s&64)===0){n.write(new Uint8Array([s]));break}else n.write(new Uint8Array([s|128]))}function i(s){let o=s%BigInt(128);return Number(t?BigInt(128)-o-BigInt(1):o)}return n.buffer}function or(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if((t[r]&64)===0)return Gt(e);break}let n=new Uint8Array(Er(e,r+1)),i=BigInt(0);for(let s=n.byteLength-1;s>=0;s--)i=i*BigInt(128)+BigInt(128-(n[s]&127)-1);return-i-BigInt(1)}function bu(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Qo(e,t)}function Qo(e,t){e=BigInt(e);let r=new Oe(new ArrayBuffer(Math.min(1,t)),0),n=0,i=BigInt(256),s=BigInt(0),o=Number(e%i);for(r.write(new Uint8Array([o]));++n<t;)e<0&&s===BigInt(0)&&o!==0&&(s=BigInt(1)),o=Number((e/i-s)%BigInt(256)),r.write(new Uint8Array([o])),i*=BigInt(256);return r.buffer}function Lo(e,t){let r=BigInt(_r(e)),n=BigInt(1),i=0;for(;++i<t;){n*=BigInt(256);let s=BigInt(_r(e));r=r+n*s}return r}function xu(e,t){let r=Lo(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}var Do=ht(()=>{ji()});function Hi(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var _u=ht(()=>{});var Br={};qn(Br,{Bool:()=>Au,BoolClass:()=>Wi,ConstructType:()=>Ze,Empty:()=>vu,EmptyClass:()=>Yi,FixedIntClass:()=>ar,FixedNatClass:()=>We,Float32:()=>Ou,Float64:()=>Fu,FloatClass:()=>Kn,Func:()=>Wu,FuncClass:()=>Zn,Int:()=>Nu,Int16:()=>Iu,Int32:()=>Pu,Int64:()=>ku,Int8:()=>Uu,IntClass:()=>Ji,Nat:()=>Ru,Nat16:()=>Cu,Nat32:()=>qu,Nat64:()=>Vu,Nat8:()=>Mu,NatClass:()=>Qi,Null:()=>Tu,NullClass:()=>Zi,Opt:()=>Gu,OptClass:()=>yn,PrimitiveType:()=>pe,Principal:()=>$u,PrincipalClass:()=>es,Rec:()=>Ku,RecClass:()=>vr,Record:()=>zu,RecordClass:()=>Wn,Reserved:()=>Bu,ReservedClass:()=>mn,Service:()=>Zu,ServiceClass:()=>rs,Text:()=>Su,TextClass:()=>Xi,Tuple:()=>ju,TupleClass:()=>Di,Type:()=>pn,Unknown:()=>Gh,UnknownClass:()=>Ki,Variant:()=>Yu,VariantClass:()=>ts,Vec:()=>Hu,VecClass:()=>Li,Visitor:()=>zi,decode:()=>Hh,encode:()=>jh});function Yn(e,t,r){return e.map((n,i)=>r(n,t[i]))}function ea(e){if(_r(e)!==1)throw new Error("Cannot decode principal");let r=Number(Gt(e));return dt.fromUint8Array(new Uint8Array(Er(e,r)))}function Ct(e){let t=JSON.stringify(e,(r,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>Eu?t.substring(0,Eu-3)+"...":t}function jh(e,t){if(t.length<e.length)throw Error("Wrong number of message arguments");let r=new ta;e.forEach(c=>c.buildTypeTable(r));let n=new TextEncoder().encode(Gi),i=r.encode(),s=Pt(t.length),o=Et(...e.map(c=>c.encodeType(r))),a=Et(...Yn(e,t,(c,l)=>{try{c.covariant(l)}catch(h){throw new Error(h.message+` `)}return c.encodeValue(l)}));return Et(n,i,s,o,a)}function Hh(e,t){let r=new Oe(t);if(t.byteLength<Gi.length)throw new Error("Message length smaller than magic number");let n=Er(r,Gi.length),i=new TextDecoder().decode(n);if(i!==Gi)throw new Error("Wrong magic number: "+JSON.stringify(i));function s(w){let f=[],O=Number(Gt(w));for(let j=0;j<O;j++){let S=Number(or(w));switch(S){case-18:case-19:{let K=Number(or(w));f.push([S,K]);break}case-20:case-21:{let K=[],_=Number(Gt(w)),$;for(;_--;){let z=Number(Gt(w));if(z>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof $=="number"&&$>=z)throw new Error("field id collision or not sorted");$=z;let Y=Number(or(w));K.push([z,Y])}f.push([S,K]);break}case-22:{let K=[],_=Number(Gt(w));for(;_--;)K.push(Number(or(w)));let $=[],z=Number(Gt(w));for(;z--;)$.push(Number(or(w)));let Y=[],M=Number(Gt(w));for(;M--;)switch(Number(Gt(w))){case 1:{Y.push("query");break}case 2:{Y.push("oneway");break}case 3:{Y.push("composite_query");break}default:throw new Error("unknown annotation")}f.push([S,[K,$,Y]]);break}case-23:{let K=Number(Gt(w)),_=[];for(;K--;){let $=Number(Gt(w)),z=new TextDecoder().decode(Er(w,$)),Y=or(w);_.push([z,Y])}f.push([S,_]);break}default:throw new Error("Illegal op_code: "+S)}}let N=[],F=Number(Gt(w));for(let j=0;j<F;j++)N.push(Number(or(w)));return[f,N]}let[o,a]=s(r);if(a.length<e.length)throw new Error("Wrong number of return values");let c=o.map(w=>Ku());function l(w){if(w<-24)throw new Error("future value not supported");if(w<0)switch(w){case-1:return Tu;case-2:return Au;case-3:return Ru;case-4:return Nu;case-5:return Mu;case-6:return Cu;case-7:return qu;case-8:return Vu;case-9:return Uu;case-10:return Iu;case-11:return Pu;case-12:return ku;case-13:return Ou;case-14:return Fu;case-15:return Su;case-16:return Bu;case-17:return vu;case-24:return $u;default:throw new Error("Illegal op_code: "+w)}if(w>=o.length)throw new Error("type index out of range");return c[w]}function h(w){switch(w[0]){case-19:{let f=l(w[1]);return Hu(f)}case-18:{let f=l(w[1]);return Gu(f)}case-20:{let f={};for(let[F,j]of w[1]){let S=`_${F}_`;f[S]=l(j)}let O=zu(f),N=O.tryAsTuple();return Array.isArray(N)?ju(...N):O}case-21:{let f={};for(let[O,N]of w[1]){let F=`_${O}_`;f[F]=l(N)}return Yu(f)}case-22:{let[f,O,N]=w[1];return Wu(f.map(F=>l(F)),O.map(F=>l(F)),N)}case-23:{let f={},O=w[1];for(let[N,F]of O){let j=l(F);if(j instanceof vr&&(j=j.getType()),!(j instanceof Zn))throw new Error("Illegal service definition: services can only contain functions");f[N]=j}return Zu(f)}default:throw new Error("Illegal op_code: "+w[0])}}o.forEach((w,f)=>{if(w[0]===-22){let O=h(w);c[f].fill(O)}}),o.forEach((w,f)=>{if(w[0]!==-22){let O=h(w);c[f].fill(O)}});let d=a.map(w=>l(w)),g=e.map((w,f)=>w.decodeValue(r,d[f]));for(let w=e.length;w<d.length;w++)d[w].decodeValue(r,d[w]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return g}function ju(...e){return new Di(e)}function Hu(e){return new Li(e)}function Gu(e){return new yn(e)}function zu(e){return new Wn(e)}function Yu(e){return new ts(e)}function Ku(){return new vr}function Wu(e,t,r=[]){return new Zn(e,t,r)}function Zu(e){return new rs(e)}var Gi,Eu,ta,zi,pn,pe,Ze,Yi,Ki,Wi,Zi,mn,Xi,Ji,Qi,Kn,ar,We,Li,yn,Wn,Di,ts,vr,es,Zn,rs,vu,Bu,Gh,Au,Tu,Su,Nu,Ru,Ou,Fu,Uu,Iu,Pu,ku,Mu,Cu,qu,Vu,$u,ra=ht(()=>{we();ji();Jo();Do();_u();Gi="DIDL",Eu=400;ta=class{constructor(){this._typs=[],this._idx=new Map}has(t){return this._idx.has(t.name)}add(t,r){let n=this._typs.length;this._idx.set(t.name,n),this._typs.push(r)}merge(t,r){let n=this._idx.get(t.name),i=this._idx.get(r);if(n===void 0)throw new Error("Missing type index for "+t);if(i===void 0)throw new Error("Missing type index for "+r);this._typs[n]=this._typs[i],this._typs.splice(i,1),this._idx.delete(r)}encode(){let t=Pt(this._typs.length),r=Et(...this._typs);return Et(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return zt(this._idx.get(t)||0)}},zi=class{visitType(t,r){throw new Error("Not implemented")}visitPrimitive(t,r){return this.visitType(t,r)}visitEmpty(t,r){return this.visitPrimitive(t,r)}visitBool(t,r){return this.visitPrimitive(t,r)}visitNull(t,r){return this.visitPrimitive(t,r