@junobuild/core-standalone 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/canisterStatus-T6OA6ZHD.js +2 -0
- package/dist/browser/chunk-Q5TR3LMW.js +69 -0
- package/dist/browser/chunk-Q5TR3LMW.js.map +7 -0
- package/dist/browser/index.js +10 -10
- package/dist/browser/index.js.map +3 -3
- package/dist/node/index.mjs +29 -29
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/types/errors.types.d.ts +2 -0
- package/dist/workers/auth.worker.js +10 -10
- package/dist/workers/auth.worker.js.map +4 -4
- package/package.json +6 -6
- package/dist/browser/canisterStatus-5OKD4GZC.js +0 -2
- package/dist/browser/chunk-YQER5335.js +0 -69
- package/dist/browser/chunk-YQER5335.js.map +0 -7
- /package/dist/browser/{canisterStatus-5OKD4GZC.js.map → canisterStatus-T6OA6ZHD.js.map} +0 -0
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
var $u=Object.create;var Un=Object.defineProperty;var Gu=Object.getOwnPropertyDescriptor;var Hu=Object.getOwnPropertyNames;var Vu=Object.getPrototypeOf,ju=Object.prototype.hasOwnProperty;var Yu=(r,e)=>()=>(r&&(e=r(r=0)),e);var je=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),is=(r,e)=>{for(var t in e)Un(r,t,{get:e[t],enumerable:!0})},No=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Hu(e))!ju.call(r,i)&&i!==t&&Un(r,i,{get:()=>e[i],enumerable:!(n=Gu(e,i))||n.enumerable});return r};var Xr=(r,e,t)=>(t=r!=null?$u(Vu(r)):{},No(e||!r||!r.__esModule?Un(t,"default",{value:r,enumerable:!0}):t,r)),zu=r=>No(Un({},"__esModule",{value:!0}),r);var sa={};is(sa,{Buffer:()=>z,INSPECT_MAX_BYTES:()=>Yo,SlowBuffer:()=>pf,isBuffer:()=>na,kMaxLength:()=>uf});function Ho(){ds=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0,t=r.length;e<t;++e)Ut[e]=r[e],pt[r.charCodeAt(e)]=e;pt[45]=62,pt[95]=63}function sf(r){ds||Ho();var e,t,n,i,s,o,c=r.length;if(c%4>0)throw new Error("Invalid string. Length must be a multiple of 4");s=r[c-2]==="="?2:r[c-1]==="="?1:0,o=new nf(c*3/4-s),n=s>0?c-4:c;var a=0;for(e=0,t=0;e<n;e+=4,t+=3)i=pt[r.charCodeAt(e)]<<18|pt[r.charCodeAt(e+1)]<<12|pt[r.charCodeAt(e+2)]<<6|pt[r.charCodeAt(e+3)],o[a++]=i>>16&255,o[a++]=i>>8&255,o[a++]=i&255;return s===2?(i=pt[r.charCodeAt(e)]<<2|pt[r.charCodeAt(e+1)]>>4,o[a++]=i&255):s===1&&(i=pt[r.charCodeAt(e)]<<10|pt[r.charCodeAt(e+1)]<<4|pt[r.charCodeAt(e+2)]>>2,o[a++]=i>>8&255,o[a++]=i&255),o}function of(r){return Ut[r>>18&63]+Ut[r>>12&63]+Ut[r>>6&63]+Ut[r&63]}function af(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16)+(r[s+1]<<8)+r[s+2],i.push(of(n));return i.join("")}function Co(r){ds||Ho();for(var e,t=r.length,n=t%3,i="",s=[],o=16383,c=0,a=t-n;c<a;c+=o)s.push(af(r,c,c+o>a?a:c+o));return n===1?(e=r[t-1],i+=Ut[e>>2],i+=Ut[e<<4&63],i+="=="):n===2&&(e=(r[t-2]<<8)+r[t-1],i+=Ut[e>>10],i+=Ut[e>>4&63],i+=Ut[e<<2&63],i+="="),s.push(i),s.join("")}function $n(r,e,t,n,i){var s,o,c=i*8-n-1,a=(1<<c)-1,p=a>>1,m=-7,g=t?i-1:0,y=t?-1:1,_=r[e+g];for(g+=y,s=_&(1<<-m)-1,_>>=-m,m+=c;m>0;s=s*256+r[e+g],g+=y,m-=8);for(o=s&(1<<-m)-1,s>>=-m,m+=n;m>0;o=o*256+r[e+g],g+=y,m-=8);if(s===0)s=1-p;else{if(s===a)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-p}return(_?-1:1)*o*Math.pow(2,s-n)}function Vo(r,e,t,n,i,s){var o,c,a,p=s*8-i-1,m=(1<<p)-1,g=m>>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,f=n?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=m):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+g>=1?e+=y/a:e+=y*Math.pow(2,1-g),e*a>=2&&(o++,a/=2),o+g>=m?(c=0,o=m):o+g>=1?(c=(e*a-1)*Math.pow(2,i),o=o+g):(c=e*Math.pow(2,g-1)*Math.pow(2,i),o=0));i>=8;r[t+_]=c&255,_+=f,c/=256,i-=8);for(o=o<<i|c,p+=i;p>0;r[t+_]=o&255,_+=f,o/=256,p-=8);r[t+_-f]|=P*128}function qn(){return z.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Gt(r,e){if(qn()<e)throw new RangeError("Invalid typed array length");return z.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=z.prototype):(r===null&&(r=new z(e)),r.length=e),r}function z(r,e,t){if(!z.TYPED_ARRAY_SUPPORT&&!(this instanceof z))return new z(r,e,t);if(typeof r=="number"){if(typeof e=="string")throw new Error("If encoding is specified then the first argument must be a string");return ps(this,r)}return zo(this,r,e,t)}function zo(r,e,t,n){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?hf(r,e,t,n):typeof e=="string"?lf(r,e,t):df(r,e)}function Zo(r){if(typeof r!="number")throw new TypeError('"size" argument must be a number');if(r<0)throw new RangeError('"size" argument must not be negative')}function ff(r,e,t,n){return Zo(e),e<=0?Gt(r,e):t!==void 0?typeof n=="string"?Gt(r,e).fill(t,n):Gt(r,e).fill(t):Gt(r,e)}function ps(r,e){if(Zo(e),r=Gt(r,e<0?0:ms(e)|0),!z.TYPED_ARRAY_SUPPORT)for(var t=0;t<e;++t)r[t]=0;return r}function lf(r,e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!z.isEncoding(t))throw new TypeError('"encoding" must be a valid string encoding');var n=Wo(e,t)|0;r=Gt(r,n);var i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function hs(r,e){var t=e.length<0?0:ms(e.length)|0;r=Gt(r,t);for(var n=0;n<t;n+=1)r[n]=e[n]&255;return r}function hf(r,e,t,n){if(e.byteLength,t<0||e.byteLength<t)throw new RangeError("'offset' is out of bounds");if(e.byteLength<t+(n||0))throw new RangeError("'length' is out of bounds");return t===void 0&&n===void 0?e=new Uint8Array(e):n===void 0?e=new Uint8Array(e,t):e=new Uint8Array(e,t,n),z.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=z.prototype):r=hs(r,e),r}function df(r,e){if(Ft(e)){var t=ms(e.length)|0;return r=Gt(r,t),r.length===0||e.copy(r,0,0,t),r}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Ff(e.length)?Gt(r,0):hs(r,e);if(e.type==="Buffer"&&jo(e.data))return hs(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ms(r){if(r>=qn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+qn().toString(16)+" bytes");return r|0}function pf(r){return+r!=r&&(r=0),z.alloc(+r)}function Ft(r){return!!(r!=null&&r._isBuffer)}function Wo(r,e){if(Ft(r))return r.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;typeof r!="string"&&(r=""+r);var t=r.length;if(t===0)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return Cn(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return ra(r).length;default:if(n)return Cn(r).length;e=(""+e).toLowerCase(),n=!0}}function mf(r,e,t){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Af(this,e,t);case"utf8":case"utf-8":return Qo(this,e,t);case"ascii":return vf(this,e,t);case"latin1":case"binary":return If(this,e,t);case"base64":return _f(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Bf(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function xr(r,e,t){var n=r[e];r[e]=r[t],r[t]=n}function Ko(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=z.from(e,n)),Ft(e))return e.length===0?-1:$o(r,e,t,n,i);if(typeof e=="number")return e=e&255,z.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):$o(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function $o(r,e,t,n,i){var s=1,o=r.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,c/=2,t/=2}function a(_,f){return s===1?_[f]:_.readUInt16BE(f*s)}var p;if(i){var m=-1;for(p=t;p<o;p++)if(a(r,p)===a(e,m===-1?0:p-m)){if(m===-1&&(m=p),p-m+1===c)return m*s}else m!==-1&&(p-=p-m),m=-1}else for(t+c>o&&(t=o-c),p=t;p>=0;p--){for(var g=!0,y=0;y<c;y++)if(a(r,p+y)!==a(e,y)){g=!1;break}if(g)return p}return-1}function gf(r,e,t,n){t=Number(t)||0;var i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;var s=e.length;if(s%2!==0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o<n;++o){var c=parseInt(e.substr(o*2,2),16);if(isNaN(c))return o;r[t+o]=c}return o}function bf(r,e,t,n){return Vn(Cn(e,r.length-t),r,t,n)}function Xo(r,e,t,n){return Vn(Of(e),r,t,n)}function wf(r,e,t,n){return Xo(r,e,t,n)}function yf(r,e,t,n){return Vn(ra(e),r,t,n)}function xf(r,e,t,n){return Vn(Uf(e,r.length-t),r,t,n)}function _f(r,e,t){return e===0&&t===r.length?Co(r):Co(r.slice(e,t))}function Qo(r,e,t){t=Math.min(r.length,t);for(var n=[],i=e;i<t;){var s=r[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=t){var a,p,m,g;switch(c){case 1:s<128&&(o=s);break;case 2:a=r[i+1],(a&192)===128&&(g=(s&31)<<6|a&63,g>127&&(o=g));break;case 3:a=r[i+1],p=r[i+2],(a&192)===128&&(p&192)===128&&(g=(s&15)<<12|(a&63)<<6|p&63,g>2047&&(g<55296||g>57343)&&(o=g));break;case 4:a=r[i+1],p=r[i+2],m=r[i+3],(a&192)===128&&(p&192)===128&&(m&192)===128&&(g=(s&15)<<18|(a&63)<<12|(p&63)<<6|m&63,g>65535&&g<1114112&&(o=g))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return Ef(n)}function Ef(r){var e=r.length;if(e<=Go)return String.fromCharCode.apply(String,r);for(var t="",n=0;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Go));return t}function vf(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function If(r,e,t){var n="";t=Math.min(r.length,t);for(var i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function Af(r,e,t){var n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);for(var i="",s=e;s<t;++s)i+=Rf(r[s]);return i}function Bf(r,e,t){for(var n=r.slice(e,t),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}function ze(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}function st(r,e,t,n,i,s){if(!Ft(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}function Gn(r,e,t,n){e<0&&(e=65535+e+1);for(var i=0,s=Math.min(r.length-t,2);i<s;++i)r[t+i]=(e&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function Hn(r,e,t,n){e<0&&(e=4294967295+e+1);for(var i=0,s=Math.min(r.length-t,4);i<s;++i)r[t+i]=e>>>(n?i:3-i)*8&255}function Jo(r,e,t,n,i,s){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function ea(r,e,t,n,i){return i||Jo(r,e,t,4),Vo(r,e,t,n,23,4),t+4}function ta(r,e,t,n,i){return i||Jo(r,e,t,8),Vo(r,e,t,n,52,8),t+8}function Tf(r){if(r=Nf(r).replace(Sf,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Nf(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Rf(r){return r<16?"0"+r.toString(16):r.toString(16)}function Cn(r,e){e=e||1/0;for(var t,n=r.length,i=null,s=[],o=0;o<n;++o){if(t=r.charCodeAt(o),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function Of(r){for(var e=[],t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function Uf(r,e){for(var t,n,i,s=[],o=0;o<r.length&&!((e-=2)<0);++o)t=r.charCodeAt(o),n=t>>8,i=t%256,s.push(i),s.push(n);return s}function ra(r){return sf(Tf(r))}function Vn(r,e,t,n){for(var i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function Ff(r){return r!==r}function na(r){return r!=null&&(!!r._isBuffer||ia(r)||Pf(r))}function ia(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Pf(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&ia(r.slice(0,0))}var Ut,pt,nf,ds,cf,jo,Yo,uf,Go,Sf,oa=Yu(()=>{Ut=[],pt=[],nf=typeof Uint8Array<"u"?Uint8Array:Array,ds=!1;cf={}.toString,jo=Array.isArray||function(r){return cf.call(r)=="[object Array]"};Yo=50;z.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;uf=qn();z.poolSize=8192;z._augment=function(r){return r.__proto__=z.prototype,r};z.from=function(r,e,t){return zo(null,r,e,t)};z.TYPED_ARRAY_SUPPORT&&(z.prototype.__proto__=Uint8Array.prototype,z.__proto__=Uint8Array);z.alloc=function(r,e,t){return ff(null,r,e,t)};z.allocUnsafe=function(r){return ps(null,r)};z.allocUnsafeSlow=function(r){return ps(null,r)};z.isBuffer=na;z.compare=function(e,t){if(!Ft(e)||!Ft(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,i=t.length,s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==t[s]){n=e[s],i=t[s];break}return n<i?-1:i<n?1:0};z.isEncoding=function(e){switch(String(e).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}};z.concat=function(e,t){if(!jo(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return z.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=z.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){var o=e[n];if(!Ft(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(i,s),s+=o.length}return i};z.byteLength=Wo;z.prototype._isBuffer=!0;z.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)xr(this,t,t+1);return this};z.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)xr(this,t,t+3),xr(this,t+1,t+2);return this};z.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)xr(this,t,t+7),xr(this,t+1,t+6),xr(this,t+2,t+5),xr(this,t+3,t+4);return this};z.prototype.toString=function(){var e=this.length|0;return e===0?"":arguments.length===0?Qo(this,0,e):mf.apply(this,arguments)};z.prototype.equals=function(e){if(!Ft(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:z.compare(this,e)===0};z.prototype.inspect=function(){var e="",t=Yo;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"};z.prototype.compare=function(e,t,n,i,s){if(!Ft(e))throw new TypeError("Argument must be a Buffer");if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0;if(i>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;for(var o=s-i,c=n-t,a=Math.min(o,c),p=this.slice(i,s),m=e.slice(t,n),g=0;g<a;++g)if(p[g]!==m[g]){o=p[g],c=m[g];break}return o<c?-1:c<o?1:0};z.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};z.prototype.indexOf=function(e,t,n){return Ko(this,e,t,n,!0)};z.prototype.lastIndexOf=function(e,t,n){return Ko(this,e,t,n,!1)};z.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t|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");var s=this.length-t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return gf(this,e,t,n);case"utf8":case"utf-8":return bf(this,e,t,n);case"ascii":return Xo(this,e,t,n);case"latin1":case"binary":return wf(this,e,t,n);case"base64":return yf(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xf(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Go=4096;z.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var i;if(z.TYPED_ARRAY_SUPPORT)i=this.subarray(e,t),i.__proto__=z.prototype;else{var s=t-e;i=new z(s,void 0);for(var o=0;o<s;++o)i[o]=this[o+e]}return i};z.prototype.readUIntLE=function(e,t,n){e=e|0,t=t|0,n||ze(e,t,this.length);for(var i=this[e],s=1,o=0;++o<t&&(s*=256);)i+=this[e+o]*s;return i};z.prototype.readUIntBE=function(e,t,n){e=e|0,t=t|0,n||ze(e,t,this.length);for(var i=this[e+--t],s=1;t>0&&(s*=256);)i+=this[e+--t]*s;return i};z.prototype.readUInt8=function(e,t){return t||ze(e,1,this.length),this[e]};z.prototype.readUInt16LE=function(e,t){return t||ze(e,2,this.length),this[e]|this[e+1]<<8};z.prototype.readUInt16BE=function(e,t){return t||ze(e,2,this.length),this[e]<<8|this[e+1]};z.prototype.readUInt32LE=function(e,t){return t||ze(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};z.prototype.readUInt32BE=function(e,t){return t||ze(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};z.prototype.readIntLE=function(e,t,n){e=e|0,t=t|0,n||ze(e,t,this.length);for(var i=this[e],s=1,o=0;++o<t&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i};z.prototype.readIntBE=function(e,t,n){e=e|0,t=t|0,n||ze(e,t,this.length);for(var i=t,s=1,o=this[e+--i];i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};z.prototype.readInt8=function(e,t){return t||ze(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};z.prototype.readInt16LE=function(e,t){t||ze(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};z.prototype.readInt16BE=function(e,t){t||ze(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};z.prototype.readInt32LE=function(e,t){return t||ze(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};z.prototype.readInt32BE=function(e,t){return t||ze(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};z.prototype.readFloatLE=function(e,t){return t||ze(e,4,this.length),$n(this,e,!0,23,4)};z.prototype.readFloatBE=function(e,t){return t||ze(e,4,this.length),$n(this,e,!1,23,4)};z.prototype.readDoubleLE=function(e,t){return t||ze(e,8,this.length),$n(this,e,!0,52,8)};z.prototype.readDoubleBE=function(e,t){return t||ze(e,8,this.length),$n(this,e,!1,52,8)};z.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;st(this,e,t,n,s,0)}var o=1,c=0;for(this[t]=e&255;++c<n&&(o*=256);)this[t+c]=e/o&255;return t+n};z.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;st(this,e,t,n,s,0)}var o=n-1,c=1;for(this[t+o]=e&255;--o>=0&&(c*=256);)this[t+o]=e/c&255;return t+n};z.prototype.writeUInt8=function(e,t,n){return e=+e,t=t|0,n||st(this,e,t,1,255,0),z.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=e&255,t+1};z.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t|0,n||st(this,e,t,2,65535,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):Gn(this,e,t,!0),t+2};z.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t|0,n||st(this,e,t,2,65535,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):Gn(this,e,t,!1),t+2};z.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t|0,n||st(this,e,t,4,4294967295,0),z.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255):Hn(this,e,t,!0),t+4};z.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t|0,n||st(this,e,t,4,4294967295,0),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):Hn(this,e,t,!1),t+4};z.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t|0,!i){var s=Math.pow(2,8*n-1);st(this,e,t,n,s-1,-s)}var o=0,c=1,a=0;for(this[t]=e&255;++o<n&&(c*=256);)e<0&&a===0&&this[t+o-1]!==0&&(a=1),this[t+o]=(e/c>>0)-a&255;return t+n};z.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t|0,!i){var s=Math.pow(2,8*n-1);st(this,e,t,n,s-1,-s)}var o=n-1,c=1,a=0;for(this[t+o]=e&255;--o>=0&&(c*=256);)e<0&&a===0&&this[t+o+1]!==0&&(a=1),this[t+o]=(e/c>>0)-a&255;return t+n};z.prototype.writeInt8=function(e,t,n){return e=+e,t=t|0,n||st(this,e,t,1,127,-128),z.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=e&255,t+1};z.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t|0,n||st(this,e,t,2,32767,-32768),z.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8):Gn(this,e,t,!0),t+2};z.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t|0,n||st(this,e,t,2,32767,-32768),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=e&255):Gn(this,e,t,!1),t+2};z.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t|0,n||st(this,e,t,4,2147483647,-2147483648),z.TYPED_ARRAY_SUPPORT?(this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Hn(this,e,t,!0),t+4};z.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t|0,n||st(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),z.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255):Hn(this,e,t,!1),t+4};z.prototype.writeFloatLE=function(e,t,n){return ea(this,e,t,!0,n)};z.prototype.writeFloatBE=function(e,t,n){return ea(this,e,t,!1,n)};z.prototype.writeDoubleLE=function(e,t,n){return ta(this,e,t,!0,n)};z.prototype.writeDoubleBE=function(e,t,n){return ta(this,e,t,!1,n)};z.prototype.copy=function(e,t,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);var s=i-n,o;if(this===e&&n<t&&t<i)for(o=s-1;o>=0;--o)e[o+t]=this[o+n];else if(s<1e3||!z.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s};z.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),e.length===1){var s=e.charCodeAt(0);s<256&&(e=s)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!z.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof e=="number"&&(e=e&255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var o;if(typeof e=="number")for(o=t;o<n;++o)this[o]=e;else{var c=Ft(e)?e:Cn(new z(e,i).toString()),a=c.length;for(o=0;o<n-t;++o)this[o+t]=c[o%a]}return this};Sf=/[^+\/0-9A-Za-z-_]/g});var rn=je((zh,jn)=>{var _r=(oa(),zu(sa));if(_r&&_r.default){jn.exports=_r.default;for(let r in _r)jn.exports[r]=_r[r]}else _r&&(jn.exports=_r)});var aa=je(gs=>{gs.read=function(r,e,t,n,i){var s,o,c=i*8-n-1,a=(1<<c)-1,p=a>>1,m=-7,g=t?i-1:0,y=t?-1:1,_=r[e+g];for(g+=y,s=_&(1<<-m)-1,_>>=-m,m+=c;m>0;s=s*256+r[e+g],g+=y,m-=8);for(o=s&(1<<-m)-1,s>>=-m,m+=n;m>0;o=o*256+r[e+g],g+=y,m-=8);if(s===0)s=1-p;else{if(s===a)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-p}return(_?-1:1)*o*Math.pow(2,s-n)};gs.write=function(r,e,t,n,i,s){var o,c,a,p=s*8-i-1,m=(1<<p)-1,g=m>>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,f=n?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=m):(o=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-o))<1&&(o--,a*=2),o+g>=1?e+=y/a:e+=y*Math.pow(2,1-g),e*a>=2&&(o++,a/=2),o+g>=m?(c=0,o=m):o+g>=1?(c=(e*a-1)*Math.pow(2,i),o=o+g):(c=e*Math.pow(2,g-1)*Math.pow(2,i),o=0));i>=8;r[t+_]=c&255,_+=f,c/=256,i-=8);for(o=o<<i|c,p+=i;p>0;r[t+_]=o&255,_+=f,o/=256,p-=8);r[t+_-f]|=P*128}});var nn=je((ca,Yn)=>{(function(r){"use strict";var e,t=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,n=Math.ceil,i=Math.floor,s="[BigNumber Error] ",o=s+"Number primitive has more than 15 significant digits: ",c=1e14,a=14,p=9007199254740991,m=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],g=1e7,y=1e9;function _(I){var G,j,Z,k=R.prototype={constructor:R,toString:null,valueOf:null},fe=new R(1),re=20,te=4,b=-7,v=21,q=-1e7,O=1e7,U=!1,C=1,W=0,ue={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},ce="0123456789abcdefghijklmnopqrstuvwxyz",V=!0;function R(u,l){var d,B,E,A,M,w,S,L,N=this;if(!(N instanceof R))return new R(u,l);if(l==null){if(u&&u._isBigNumber===!0){N.s=u.s,!u.c||u.e>O?N.c=N.e=null:u.e<q?N.c=[N.e=0]:(N.e=u.e,N.c=u.c.slice());return}if((w=typeof u=="number")&&u*0==0){if(N.s=1/u<0?(u=-u,-1):1,u===~~u){for(A=0,M=u;M>=10;M/=10,A++);A>O?N.c=N.e=null:(N.e=A,N.c=[u]);return}L=String(u)}else{if(!t.test(L=String(u)))return Z(N,L,w);N.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(A=L.indexOf("."))>-1&&(L=L.replace(".","")),(M=L.search(/e/i))>0?(A<0&&(A=M),A+=+L.slice(M+1),L=L.substring(0,M)):A<0&&(A=L.length)}else{if(F(l,2,ce.length,"Base"),l==10&&V)return N=new R(u),ae(N,re+N.e+1,te);if(L=String(u),w=typeof u=="number"){if(u*0!=0)return Z(N,L,w,l);if(N.s=1/u<0?(L=L.slice(1),-1):1,R.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(o+u)}else N.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(d=ce.slice(0,l),A=M=0,S=L.length;M<S;M++)if(d.indexOf(B=L.charAt(M))<0){if(B=="."){if(M>A){A=S;continue}}else if(!E&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){E=!0,M=-1,A=0;continue}return Z(N,String(u),w,l)}w=!1,L=j(L,l,10,N.s),(A=L.indexOf("."))>-1?L=L.replace(".",""):A=L.length}for(M=0;L.charCodeAt(M)===48;M++);for(S=L.length;L.charCodeAt(--S)===48;);if(L=L.slice(M,++S)){if(S-=M,w&&R.DEBUG&&S>15&&(u>p||u!==i(u)))throw Error(o+N.s*u);if((A=A-M-1)>O)N.c=N.e=null;else if(A<q)N.c=[N.e=0];else{if(N.e=A,N.c=[],M=(A+1)%a,A<0&&(M+=a),M<S){for(M&&N.c.push(+L.slice(0,M)),S-=a;M<S;)N.c.push(+L.slice(M,M+=a));M=a-(L=L.slice(M)).length}else M-=S;for(;M--;L+="0");N.c.push(+L)}}else N.c=[N.e=0]}R.clone=_,R.ROUND_UP=0,R.ROUND_DOWN=1,R.ROUND_CEIL=2,R.ROUND_FLOOR=3,R.ROUND_HALF_UP=4,R.ROUND_HALF_DOWN=5,R.ROUND_HALF_EVEN=6,R.ROUND_HALF_CEIL=7,R.ROUND_HALF_FLOOR=8,R.EUCLID=9,R.config=R.set=function(u){var l,d;if(u!=null)if(typeof u=="object"){if(u.hasOwnProperty(l="DECIMAL_PLACES")&&(d=u[l],F(d,0,y,l),re=d),u.hasOwnProperty(l="ROUNDING_MODE")&&(d=u[l],F(d,0,8,l),te=d),u.hasOwnProperty(l="EXPONENTIAL_AT")&&(d=u[l],d&&d.pop?(F(d[0],-y,0,l),F(d[1],0,y,l),b=d[0],v=d[1]):(F(d,-y,y,l),b=-(v=d<0?-d:d))),u.hasOwnProperty(l="RANGE"))if(d=u[l],d&&d.pop)F(d[0],-y,-1,l),F(d[1],1,y,l),q=d[0],O=d[1];else if(F(d,-y,y,l),d)q=-(O=d<0?-d:d);else throw Error(s+l+" cannot be zero: "+d);if(u.hasOwnProperty(l="CRYPTO"))if(d=u[l],d===!!d)if(d)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))U=d;else throw U=!d,Error(s+"crypto unavailable");else U=d;else throw Error(s+l+" not true or false: "+d);if(u.hasOwnProperty(l="MODULO_MODE")&&(d=u[l],F(d,0,9,l),C=d),u.hasOwnProperty(l="POW_PRECISION")&&(d=u[l],F(d,0,y,l),W=d),u.hasOwnProperty(l="FORMAT"))if(d=u[l],typeof d=="object")ue=d;else throw Error(s+l+" not an object: "+d);if(u.hasOwnProperty(l="ALPHABET"))if(d=u[l],typeof d=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(d))V=d.slice(0,10)=="0123456789",ce=d;else throw Error(s+l+" invalid: "+d)}else throw Error(s+"Object expected: "+u);return{DECIMAL_PLACES:re,ROUNDING_MODE:te,EXPONENTIAL_AT:[b,v],RANGE:[q,O],CRYPTO:U,MODULO_MODE:C,POW_PRECISION:W,FORMAT:ue,ALPHABET:ce}},R.isBigNumber=function(u){if(!u||u._isBigNumber!==!0)return!1;if(!R.DEBUG)return!0;var l,d,B=u.c,E=u.e,A=u.s;e:if({}.toString.call(B)=="[object Array]"){if((A===1||A===-1)&&E>=-y&&E<=y&&E===i(E)){if(B[0]===0){if(E===0&&B.length===1)return!0;break e}if(l=(E+1)%a,l<1&&(l+=a),String(B[0]).length==l){for(l=0;l<B.length;l++)if(d=B[l],d<0||d>=c||d!==i(d))break e;if(d!==0)return!0}}}else if(B===null&&E===null&&(A===null||A===1||A===-1))return!0;throw Error(s+"Invalid BigNumber: "+u)},R.maximum=R.max=function(){return Q(arguments,-1)},R.minimum=R.min=function(){return Q(arguments,1)},R.random=function(){var u=9007199254740992,l=Math.random()*u&2097151?function(){return i(Math.random()*u)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(d){var B,E,A,M,w,S=0,L=[],N=new R(fe);if(d==null?d=re:F(d,0,y),M=n(d/a),U)if(crypto.getRandomValues){for(B=crypto.getRandomValues(new Uint32Array(M*=2));S<M;)w=B[S]*131072+(B[S+1]>>>11),w>=9e15?(E=crypto.getRandomValues(new Uint32Array(2)),B[S]=E[0],B[S+1]=E[1]):(L.push(w%1e14),S+=2);S=M/2}else if(crypto.randomBytes){for(B=crypto.randomBytes(M*=7);S<M;)w=(B[S]&31)*281474976710656+B[S+1]*1099511627776+B[S+2]*4294967296+B[S+3]*16777216+(B[S+4]<<16)+(B[S+5]<<8)+B[S+6],w>=9e15?crypto.randomBytes(7).copy(B,S):(L.push(w%1e14),S+=7);S=M/7}else throw U=!1,Error(s+"crypto unavailable");if(!U)for(;S<M;)w=l(),w<9e15&&(L[S++]=w%1e14);for(M=L[--S],d%=a,M&&d&&(w=m[a-d],L[S]=i(M/w)*w);L[S]===0;L.pop(),S--);if(S<0)L=[A=0];else{for(A=-1;L[0]===0;L.splice(0,1),A-=a);for(S=1,w=L[0];w>=10;w/=10,S++);S<a&&(A-=a-S)}return N.e=A,N.c=L,N}}(),R.sum=function(){for(var u=1,l=arguments,d=new R(l[0]);u<l.length;)d=d.plus(l[u++]);return d},j=function(){var u="0123456789";function l(d,B,E,A){for(var M,w=[0],S,L=0,N=d.length;L<N;){for(S=w.length;S--;w[S]*=B);for(w[0]+=A.indexOf(d.charAt(L++)),M=0;M<w.length;M++)w[M]>E-1&&(w[M+1]==null&&(w[M+1]=0),w[M+1]+=w[M]/E|0,w[M]%=E)}return w.reverse()}return function(d,B,E,A,M){var w,S,L,N,H,K,ie,de,Ee=d.indexOf("."),Ne=re,he=te;for(Ee>=0&&(N=W,W=0,d=d.replace(".",""),de=new R(B),K=de.pow(d.length-Ee),W=N,de.c=l(Y(P(K.c),K.e,"0"),10,E,u),de.e=de.c.length),ie=l(d,B,E,M?(w=ce,u):(w=u,ce)),L=N=ie.length;ie[--N]==0;ie.pop());if(!ie[0])return w.charAt(0);if(Ee<0?--L:(K.c=ie,K.e=L,K.s=A,K=G(K,de,Ne,he,E),ie=K.c,H=K.r,L=K.e),S=L+Ne+1,Ee=ie[S],N=E/2,H=H||S<0||ie[S+1]!=null,H=he<4?(Ee!=null||H)&&(he==0||he==(K.s<0?3:2)):Ee>N||Ee==N&&(he==4||H||he==6&&ie[S-1]&1||he==(K.s<0?8:7)),S<1||!ie[0])d=H?Y(w.charAt(1),-Ne,w.charAt(0)):w.charAt(0);else{if(ie.length=S,H)for(--E;++ie[--S]>E;)ie[S]=0,S||(++L,ie=[1].concat(ie));for(N=ie.length;!ie[--N];);for(Ee=0,d="";Ee<=N;d+=w.charAt(ie[Ee++]));d=Y(d,L,w.charAt(0))}return d}}(),G=function(){function u(B,E,A){var M,w,S,L,N=0,H=B.length,K=E%g,ie=E/g|0;for(B=B.slice();H--;)S=B[H]%g,L=B[H]/g|0,M=ie*S+L*K,w=K*S+M%g*g+N,N=(w/A|0)+(M/g|0)+ie*L,B[H]=w%A;return N&&(B=[N].concat(B)),B}function l(B,E,A,M){var w,S;if(A!=M)S=A>M?1:-1;else for(w=S=0;w<A;w++)if(B[w]!=E[w]){S=B[w]>E[w]?1:-1;break}return S}function d(B,E,A,M){for(var w=0;A--;)B[A]-=w,w=B[A]<E[A]?1:0,B[A]=w*M+B[A]-E[A];for(;!B[0]&&B.length>1;B.splice(0,1));}return function(B,E,A,M,w){var S,L,N,H,K,ie,de,Ee,Ne,he,oe,Me,Xt,gr,br,dt,ye,it=B.s==E.s?1:-1,We=B.c,Re=E.c;if(!We||!We[0]||!Re||!Re[0])return new R(!B.s||!E.s||(We?Re&&We[0]==Re[0]:!Re)?NaN:We&&We[0]==0||!Re?it*0:it/0);for(Ee=new R(it),Ne=Ee.c=[],L=B.e-E.e,it=A+L+1,w||(w=c,L=f(B.e/a)-f(E.e/a),it=it/a|0),N=0;Re[N]==(We[N]||0);N++);if(Re[N]>(We[N]||0)&&L--,it<0)Ne.push(1),H=!0;else{for(gr=We.length,dt=Re.length,N=0,it+=2,K=i(w/(Re[0]+1)),K>1&&(Re=u(Re,K,w),We=u(We,K,w),dt=Re.length,gr=We.length),Xt=dt,he=We.slice(0,dt),oe=he.length;oe<dt;he[oe++]=0);ye=Re.slice(),ye=[0].concat(ye),br=Re[0],Re[1]>=w/2&&br++;do{if(K=0,S=l(Re,he,dt,oe),S<0){if(Me=he[0],dt!=oe&&(Me=Me*w+(he[1]||0)),K=i(Me/br),K>1)for(K>=w&&(K=w-1),ie=u(Re,K,w),de=ie.length,oe=he.length;l(ie,he,de,oe)==1;)K--,d(ie,dt<de?ye:Re,de,w),de=ie.length,S=1;else K==0&&(S=K=1),ie=Re.slice(),de=ie.length;if(de<oe&&(ie=[0].concat(ie)),d(he,ie,oe,w),oe=he.length,S==-1)for(;l(Re,he,dt,oe)<1;)K++,d(he,dt<oe?ye:Re,oe,w),oe=he.length}else S===0&&(K++,he=[0]);Ne[N++]=K,he[0]?he[oe++]=We[Xt]||0:(he=[We[Xt]],oe=1)}while((Xt++<gr||he[0]!=null)&&it--);H=he[0]!=null,Ne[0]||Ne.splice(0,1)}if(w==c){for(N=1,it=Ne[0];it>=10;it/=10,N++);ae(Ee,A+(Ee.e=N+L*a-1)+1,M,H)}else Ee.e=L,Ee.r=+H;return Ee}}();function h(u,l,d,B){var E,A,M,w,S;if(d==null?d=te:F(d,0,8),!u.c)return u.toString();if(E=u.c[0],M=u.e,l==null)S=P(u.c),S=B==1||B==2&&(M<=b||M>=v)?D(S,M):Y(S,M,"0");else if(u=ae(new R(u),l,d),A=u.e,S=P(u.c),w=S.length,B==1||B==2&&(l<=A||A<=b)){for(;w<l;S+="0",w++);S=D(S,A)}else if(l-=M,S=Y(S,A,"0"),A+1>w){if(--l>0)for(S+=".";l--;S+="0");}else if(l+=A-w,l>0)for(A+1==w&&(S+=".");l--;S+="0");return u.s<0&&E?"-"+S:S}function Q(u,l){for(var d,B,E=1,A=new R(u[0]);E<u.length;E++)B=new R(u[E]),(!B.s||(d=T(A,B))===l||d===0&&A.s===l)&&(A=B);return A}function J(u,l,d){for(var B=1,E=l.length;!l[--E];l.pop());for(E=l[0];E>=10;E/=10,B++);return(d=B+d*a-1)>O?u.c=u.e=null:d<q?u.c=[u.e=0]:(u.e=d,u.c=l),u}Z=function(){var u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,l=/^([^.]+)\.$/,d=/^\.([^.]+)$/,B=/^-?(Infinity|NaN)$/,E=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,M,w,S){var L,N=w?M:M.replace(E,"");if(B.test(N))A.s=isNaN(N)?null:N<0?-1:1;else{if(!w&&(N=N.replace(u,function(H,K,ie){return L=(ie=ie.toLowerCase())=="x"?16:ie=="b"?2:8,!S||S==L?K:H}),S&&(L=S,N=N.replace(l,"$1").replace(d,"0.$1")),M!=N))return new R(N,L);if(R.DEBUG)throw Error(s+"Not a"+(S?" base "+S:"")+" number: "+M);A.s=null}A.c=A.e=null}}();function ae(u,l,d,B){var E,A,M,w,S,L,N,H=u.c,K=m;if(H){e:{for(E=1,w=H[0];w>=10;w/=10,E++);if(A=l-E,A<0)A+=a,M=l,S=H[L=0],N=i(S/K[E-M-1]%10);else if(L=n((A+1)/a),L>=H.length)if(B){for(;H.length<=L;H.push(0));S=N=0,E=1,A%=a,M=A-a+1}else break e;else{for(S=w=H[L],E=1;w>=10;w/=10,E++);A%=a,M=A-a+E,N=M<0?0:i(S/K[E-M-1]%10)}if(B=B||l<0||H[L+1]!=null||(M<0?S:S%K[E-M-1]),B=d<4?(N||B)&&(d==0||d==(u.s<0?3:2)):N>5||N==5&&(d==4||B||d==6&&(A>0?M>0?S/K[E-M]:0:H[L-1])%10&1||d==(u.s<0?8:7)),l<1||!H[0])return H.length=0,B?(l-=u.e+1,H[0]=K[(a-l%a)%a],u.e=-l||0):H[0]=u.e=0,u;if(A==0?(H.length=L,w=1,L--):(H.length=L+1,w=K[a-A],H[L]=M>0?i(S/K[E-M]%K[M])*w:0),B)for(;;)if(L==0){for(A=1,M=H[0];M>=10;M/=10,A++);for(M=H[0]+=w,w=1;M>=10;M/=10,w++);A!=w&&(u.e++,H[0]==c&&(H[0]=1));break}else{if(H[L]+=w,H[L]!=c)break;H[L--]=0,w=1}for(A=H.length;H[--A]===0;H.pop());}u.e>O?u.c=u.e=null:u.e<q&&(u.c=[u.e=0])}return u}function X(u){var l,d=u.e;return d===null?u.toString():(l=P(u.c),l=d<=b||d>=v?D(l,d):Y(l,d,"0"),u.s<0?"-"+l:l)}return k.absoluteValue=k.abs=function(){var u=new R(this);return u.s<0&&(u.s=1),u},k.comparedTo=function(u,l){return T(this,new R(u,l))},k.decimalPlaces=k.dp=function(u,l){var d,B,E,A=this;if(u!=null)return F(u,0,y),l==null?l=te:F(l,0,8),ae(new R(A),u+A.e+1,l);if(!(d=A.c))return null;if(B=((E=d.length-1)-f(this.e/a))*a,E=d[E])for(;E%10==0;E/=10,B--);return B<0&&(B=0),B},k.dividedBy=k.div=function(u,l){return G(this,new R(u,l),re,te)},k.dividedToIntegerBy=k.idiv=function(u,l){return G(this,new R(u,l),0,1)},k.exponentiatedBy=k.pow=function(u,l){var d,B,E,A,M,w,S,L,N,H=this;if(u=new R(u),u.c&&!u.isInteger())throw Error(s+"Exponent not an integer: "+X(u));if(l!=null&&(l=new R(l)),w=u.e>14,!H.c||!H.c[0]||H.c[0]==1&&!H.e&&H.c.length==1||!u.c||!u.c[0])return N=new R(Math.pow(+X(H),w?u.s*(2-$(u)):+X(u))),l?N.mod(l):N;if(S=u.s<0,l){if(l.c?!l.c[0]:!l.s)return new R(NaN);B=!S&&H.isInteger()&&l.isInteger(),B&&(H=H.mod(l))}else{if(u.e>9&&(H.e>0||H.e<-1||(H.e==0?H.c[0]>1||w&&H.c[1]>=24e7:H.c[0]<8e13||w&&H.c[0]<=9999975e7)))return A=H.s<0&&$(u)?-0:0,H.e>-1&&(A=1/A),new R(S?1/A:A);W&&(A=n(W/a+2))}for(w?(d=new R(.5),S&&(u.s=1),L=$(u)):(E=Math.abs(+X(u)),L=E%2),N=new R(fe);;){if(L){if(N=N.times(H),!N.c)break;A?N.c.length>A&&(N.c.length=A):B&&(N=N.mod(l))}if(E){if(E=i(E/2),E===0)break;L=E%2}else if(u=u.times(d),ae(u,u.e+1,1),u.e>14)L=$(u);else{if(E=+X(u),E===0)break;L=E%2}H=H.times(H),A?H.c&&H.c.length>A&&(H.c.length=A):B&&(H=H.mod(l))}return B?N:(S&&(N=fe.div(N)),l?N.mod(l):A?ae(N,W,te,M):N)},k.integerValue=function(u){var l=new R(this);return u==null?u=te:F(u,0,8),ae(l,l.e+1,u)},k.isEqualTo=k.eq=function(u,l){return T(this,new R(u,l))===0},k.isFinite=function(){return!!this.c},k.isGreaterThan=k.gt=function(u,l){return T(this,new R(u,l))>0},k.isGreaterThanOrEqualTo=k.gte=function(u,l){return(l=T(this,new R(u,l)))===1||l===0},k.isInteger=function(){return!!this.c&&f(this.e/a)>this.c.length-2},k.isLessThan=k.lt=function(u,l){return T(this,new R(u,l))<0},k.isLessThanOrEqualTo=k.lte=function(u,l){return(l=T(this,new R(u,l)))===-1||l===0},k.isNaN=function(){return!this.s},k.isNegative=function(){return this.s<0},k.isPositive=function(){return this.s>0},k.isZero=function(){return!!this.c&&this.c[0]==0},k.minus=function(u,l){var d,B,E,A,M=this,w=M.s;if(u=new R(u,l),l=u.s,!w||!l)return new R(NaN);if(w!=l)return u.s=-l,M.plus(u);var S=M.e/a,L=u.e/a,N=M.c,H=u.c;if(!S||!L){if(!N||!H)return N?(u.s=-l,u):new R(H?M:NaN);if(!N[0]||!H[0])return H[0]?(u.s=-l,u):new R(N[0]?M:te==3?-0:0)}if(S=f(S),L=f(L),N=N.slice(),w=S-L){for((A=w<0)?(w=-w,E=N):(L=S,E=H),E.reverse(),l=w;l--;E.push(0));E.reverse()}else for(B=(A=(w=N.length)<(l=H.length))?w:l,w=l=0;l<B;l++)if(N[l]!=H[l]){A=N[l]<H[l];break}if(A&&(E=N,N=H,H=E,u.s=-u.s),l=(B=H.length)-(d=N.length),l>0)for(;l--;N[d++]=0);for(l=c-1;B>w;){if(N[--B]<H[B]){for(d=B;d&&!N[--d];N[d]=l);--N[d],N[B]+=c}N[B]-=H[B]}for(;N[0]==0;N.splice(0,1),--L);return N[0]?J(u,N,L):(u.s=te==3?-1:1,u.c=[u.e=0],u)},k.modulo=k.mod=function(u,l){var d,B,E=this;return u=new R(u,l),!E.c||!u.s||u.c&&!u.c[0]?new R(NaN):!u.c||E.c&&!E.c[0]?new R(E):(C==9?(B=u.s,u.s=1,d=G(E,u,0,3),u.s=B,d.s*=B):d=G(E,u,0,C),u=E.minus(d.times(u)),!u.c[0]&&C==1&&(u.s=E.s),u)},k.multipliedBy=k.times=function(u,l){var d,B,E,A,M,w,S,L,N,H,K,ie,de,Ee,Ne,he=this,oe=he.c,Me=(u=new R(u,l)).c;if(!oe||!Me||!oe[0]||!Me[0])return!he.s||!u.s||oe&&!oe[0]&&!Me||Me&&!Me[0]&&!oe?u.c=u.e=u.s=null:(u.s*=he.s,!oe||!Me?u.c=u.e=null:(u.c=[0],u.e=0)),u;for(B=f(he.e/a)+f(u.e/a),u.s*=he.s,S=oe.length,H=Me.length,S<H&&(de=oe,oe=Me,Me=de,E=S,S=H,H=E),E=S+H,de=[];E--;de.push(0));for(Ee=c,Ne=g,E=H;--E>=0;){for(d=0,K=Me[E]%Ne,ie=Me[E]/Ne|0,M=S,A=E+M;A>E;)L=oe[--M]%Ne,N=oe[M]/Ne|0,w=ie*L+N*K,L=K*L+w%Ne*Ne+de[A]+d,d=(L/Ee|0)+(w/Ne|0)+ie*N,de[A--]=L%Ee;de[A]=d}return d?++B:de.splice(0,1),J(u,de,B)},k.negated=function(){var u=new R(this);return u.s=-u.s||null,u},k.plus=function(u,l){var d,B=this,E=B.s;if(u=new R(u,l),l=u.s,!E||!l)return new R(NaN);if(E!=l)return u.s=-l,B.minus(u);var A=B.e/a,M=u.e/a,w=B.c,S=u.c;if(!A||!M){if(!w||!S)return new R(E/0);if(!w[0]||!S[0])return S[0]?u:new R(w[0]?B:E*0)}if(A=f(A),M=f(M),w=w.slice(),E=A-M){for(E>0?(M=A,d=S):(E=-E,d=w),d.reverse();E--;d.push(0));d.reverse()}for(E=w.length,l=S.length,E-l<0&&(d=S,S=w,w=d,l=E),E=0;l;)E=(w[--l]=w[l]+S[l]+E)/c|0,w[l]=c===w[l]?0:w[l]%c;return E&&(w=[E].concat(w),++M),J(u,w,M)},k.precision=k.sd=function(u,l){var d,B,E,A=this;if(u!=null&&u!==!!u)return F(u,1,y),l==null?l=te:F(l,0,8),ae(new R(A),u,l);if(!(d=A.c))return null;if(E=d.length-1,B=E*a+1,E=d[E]){for(;E%10==0;E/=10,B--);for(E=d[0];E>=10;E/=10,B++);}return u&&A.e+1>B&&(B=A.e+1),B},k.shiftedBy=function(u){return F(u,-p,p),this.times("1e"+u)},k.squareRoot=k.sqrt=function(){var u,l,d,B,E,A=this,M=A.c,w=A.s,S=A.e,L=re+4,N=new R("0.5");if(w!==1||!M||!M[0])return new R(!w||w<0&&(!M||M[0])?NaN:M?A:1/0);if(w=Math.sqrt(+X(A)),w==0||w==1/0?(l=P(M),(l.length+S)%2==0&&(l+="0"),w=Math.sqrt(+l),S=f((S+1)/2)-(S<0||S%2),w==1/0?l="5e"+S:(l=w.toExponential(),l=l.slice(0,l.indexOf("e")+1)+S),d=new R(l)):d=new R(w+""),d.c[0]){for(S=d.e,w=S+L,w<3&&(w=0);;)if(E=d,d=N.times(E.plus(G(A,E,L,1))),P(E.c).slice(0,w)===(l=P(d.c)).slice(0,w))if(d.e<S&&--w,l=l.slice(w-3,w+1),l=="9999"||!B&&l=="4999"){if(!B&&(ae(E,E.e+re+2,0),E.times(E).eq(A))){d=E;break}L+=4,w+=4,B=1}else{(!+l||!+l.slice(1)&&l.charAt(0)=="5")&&(ae(d,d.e+re+2,1),u=!d.times(d).eq(A));break}}return ae(d,d.e+re+1,te,u)},k.toExponential=function(u,l){return u!=null&&(F(u,0,y),u++),h(this,u,l,1)},k.toFixed=function(u,l){return u!=null&&(F(u,0,y),u=u+this.e+1),h(this,u,l)},k.toFormat=function(u,l,d){var B,E=this;if(d==null)u!=null&&l&&typeof l=="object"?(d=l,l=null):u&&typeof u=="object"?(d=u,u=l=null):d=ue;else if(typeof d!="object")throw Error(s+"Argument not an object: "+d);if(B=E.toFixed(u,l),E.c){var A,M=B.split("."),w=+d.groupSize,S=+d.secondaryGroupSize,L=d.groupSeparator||"",N=M[0],H=M[1],K=E.s<0,ie=K?N.slice(1):N,de=ie.length;if(S&&(A=w,w=S,S=A,de-=A),w>0&&de>0){for(A=de%w||w,N=ie.substr(0,A);A<de;A+=w)N+=L+ie.substr(A,w);S>0&&(N+=L+ie.slice(A)),K&&(N="-"+N)}B=H?N+(d.decimalSeparator||"")+((S=+d.fractionGroupSize)?H.replace(new RegExp("\\d{"+S+"}\\B","g"),"$&"+(d.fractionGroupSeparator||"")):H):N}return(d.prefix||"")+B+(d.suffix||"")},k.toFraction=function(u){var l,d,B,E,A,M,w,S,L,N,H,K,ie=this,de=ie.c;if(u!=null&&(w=new R(u),!w.isInteger()&&(w.c||w.s!==1)||w.lt(fe)))throw Error(s+"Argument "+(w.isInteger()?"out of range: ":"not an integer: ")+X(w));if(!de)return new R(ie);for(l=new R(fe),L=d=new R(fe),B=S=new R(fe),K=P(de),A=l.e=K.length-ie.e-1,l.c[0]=m[(M=A%a)<0?a+M:M],u=!u||w.comparedTo(l)>0?A>0?l:L:w,M=O,O=1/0,w=new R(K),S.c[0]=0;N=G(w,l,0,1),E=d.plus(N.times(B)),E.comparedTo(u)!=1;)d=B,B=E,L=S.plus(N.times(E=L)),S=E,l=w.minus(N.times(E=l)),w=E;return E=G(u.minus(d),B,0,1),S=S.plus(E.times(L)),d=d.plus(E.times(B)),S.s=L.s=ie.s,A=A*2,H=G(L,B,A,te).minus(ie).abs().comparedTo(G(S,d,A,te).minus(ie).abs())<1?[L,B]:[S,d],O=M,H},k.toNumber=function(){return+X(this)},k.toPrecision=function(u,l){return u!=null&&F(u,1,y),h(this,u,l,2)},k.toString=function(u){var l,d=this,B=d.s,E=d.e;return E===null?B?(l="Infinity",B<0&&(l="-"+l)):l="NaN":(u==null?l=E<=b||E>=v?D(P(d.c),E):Y(P(d.c),E,"0"):u===10&&V?(d=ae(new R(d),re+E+1,te),l=Y(P(d.c),d.e,"0")):(F(u,2,ce.length,"Base"),l=j(Y(P(d.c),E,"0"),10,u,B,!0)),B<0&&d.c[0]&&(l="-"+l)),l},k.valueOf=k.toJSON=function(){return X(this)},k._isBigNumber=!0,I!=null&&R.set(I),R}function f(I){var G=I|0;return I>0||I===G?G:G-1}function P(I){for(var G,j,Z=1,k=I.length,fe=I[0]+"";Z<k;){for(G=I[Z++]+"",j=a-G.length;j--;G="0"+G);fe+=G}for(k=fe.length;fe.charCodeAt(--k)===48;);return fe.slice(0,k+1||1)}function T(I,G){var j,Z,k=I.c,fe=G.c,re=I.s,te=G.s,b=I.e,v=G.e;if(!re||!te)return null;if(j=k&&!k[0],Z=fe&&!fe[0],j||Z)return j?Z?0:-te:re;if(re!=te)return re;if(j=re<0,Z=b==v,!k||!fe)return Z?0:!k^j?1:-1;if(!Z)return b>v^j?1:-1;for(te=(b=k.length)<(v=fe.length)?b:v,re=0;re<te;re++)if(k[re]!=fe[re])return k[re]>fe[re]^j?1:-1;return b==v?0:b>v^j?1:-1}function F(I,G,j,Z){if(I<G||I>j||I!==i(I))throw Error(s+(Z||"Argument")+(typeof I=="number"?I<G||I>j?" out of range: ":" not an integer: ":" not a primitive number: ")+String(I))}function $(I){var G=I.c.length-1;return f(I.e/a)==G&&I.c[G]%2!=0}function D(I,G){return(I.length>1?I.charAt(0)+"."+I.slice(1):I)+(G<0?"e":"e+")+G}function Y(I,G,j){var Z,k;if(G<0){for(k=j+".";++G;k+=j);I=k+I}else if(Z=I.length,++G>Z){for(k=j,G-=Z;--G;k+=j);I+=k}else G<Z&&(I=I.slice(0,G)+"."+I.slice(G));return I}e=_(),e.default=e.BigNumber=e,typeof define=="function"&&define.amd?define(function(){return e}):typeof Yn<"u"&&Yn.exports?Yn.exports=e:(r||(r=typeof self<"u"&&self?self:window),r.BigNumber=e)})(ca)});var fa=je((Wh,ua)=>{ua.exports=function(e,t,n){var i=new e.Uint8Array(n),s=t.pushInt,o=t.pushInt32,c=t.pushInt32Neg,a=t.pushInt64,p=t.pushInt64Neg,m=t.pushFloat,g=t.pushFloatSingle,y=t.pushFloatDouble,_=t.pushTrue,f=t.pushFalse,P=t.pushUndefined,T=t.pushNull,F=t.pushInfinity,$=t.pushInfinityNeg,D=t.pushNaN,Y=t.pushNaNNeg,I=t.pushArrayStart,G=t.pushArrayStartFixed,j=t.pushArrayStartFixed32,Z=t.pushArrayStartFixed64,k=t.pushObjectStart,fe=t.pushObjectStartFixed,re=t.pushObjectStartFixed32,te=t.pushObjectStartFixed64,b=t.pushByteString,v=t.pushByteStringStart,q=t.pushUtf8String,O=t.pushUtf8StringStart,U=t.pushSimpleUnassigned,C=t.pushTagStart,W=t.pushTagStart4,ue=t.pushTagStart8,ce=t.pushTagUnassigned,V=t.pushBreak,R=e.Math.pow,h=0,Q=0,J=0;function ae(x){for(x=x|0,h=0,Q=x;(h|0)<(Q|0)&&(J=Cu[i[h]&255](i[h]|0)|0,!((J|0)>0)););return J|0}function X(x){return x=x|0,((h|0)+(x|0)|0)<(Q|0)?0:1}function u(x){return x=x|0,i[x|0]<<8|i[x+1|0]|0}function l(x){return x=x|0,i[x|0]<<24|i[x+1|0]<<16|i[x+2|0]<<8|i[x+3|0]|0}function d(x){return x=x|0,s(x|0),h=h+1|0,0}function B(x){return x=x|0,X(1)|0?1:(s(i[h+1|0]|0),h=h+2|0,0)}function E(x){return x=x|0,X(2)|0?1:(s(u(h+1|0)|0),h=h+3|0,0)}function A(x){return x=x|0,X(4)|0?1:(o(u(h+1|0)|0,u(h+3|0)|0),h=h+5|0,0)}function M(x){return x=x|0,X(8)|0?1:(a(u(h+1|0)|0,u(h+3|0)|0,u(h+5|0)|0,u(h+7|0)|0),h=h+9|0,0)}function w(x){return x=x|0,s(-1-(x-32|0)|0),h=h+1|0,0}function S(x){return x=x|0,X(1)|0?1:(s(-1-(i[h+1|0]|0)|0),h=h+2|0,0)}function L(x){x=x|0;var be=0;return X(2)|0?1:(be=u(h+1|0)|0,s(-1-(be|0)|0),h=h+3|0,0)}function N(x){return x=x|0,X(4)|0?1:(c(u(h+1|0)|0,u(h+3|0)|0),h=h+5|0,0)}function H(x){return x=x|0,X(8)|0?1:(p(u(h+1|0)|0,u(h+3|0)|0,u(h+5|0)|0,u(h+7|0)|0),h=h+9|0,0)}function K(x){x=x|0;var be=0,we=0,pe=0;return pe=x-64|0,X(pe|0)|0?1:(be=h+1|0,we=(h+1|0)+(pe|0)|0,b(be|0,we|0),h=we|0,0)}function ie(x){x=x|0;var be=0,we=0,pe=0;return X(1)|0||(pe=i[h+1|0]|0,be=h+2|0,we=(h+2|0)+(pe|0)|0,X(pe+1|0)|0)?1:(b(be|0,we|0),h=we|0,0)}function de(x){x=x|0;var be=0,we=0,pe=0;return X(2)|0||(pe=u(h+1|0)|0,be=h+3|0,we=(h+3|0)+(pe|0)|0,X(pe+2|0)|0)?1:(b(be|0,we|0),h=we|0,0)}function Ee(x){x=x|0;var be=0,we=0,pe=0;return X(4)|0||(pe=l(h+1|0)|0,be=h+5|0,we=(h+5|0)+(pe|0)|0,X(pe+4|0)|0)?1:(b(be|0,we|0),h=we|0,0)}function Ne(x){return x=x|0,1}function he(x){return x=x|0,v(),h=h+1|0,0}function oe(x){x=x|0;var be=0,we=0,pe=0;return pe=x-96|0,X(pe|0)|0?1:(be=h+1|0,we=(h+1|0)+(pe|0)|0,q(be|0,we|0),h=we|0,0)}function Me(x){x=x|0;var be=0,we=0,pe=0;return X(1)|0||(pe=i[h+1|0]|0,be=h+2|0,we=(h+2|0)+(pe|0)|0,X(pe+1|0)|0)?1:(q(be|0,we|0),h=we|0,0)}function Xt(x){x=x|0;var be=0,we=0,pe=0;return X(2)|0||(pe=u(h+1|0)|0,be=h+3|0,we=(h+3|0)+(pe|0)|0,X(pe+2|0)|0)?1:(q(be|0,we|0),h=we|0,0)}function gr(x){x=x|0;var be=0,we=0,pe=0;return X(4)|0||(pe=l(h+1|0)|0,be=h+5|0,we=(h+5|0)+(pe|0)|0,X(pe+4|0)|0)?1:(q(be|0,we|0),h=we|0,0)}function br(x){return x=x|0,1}function dt(x){return x=x|0,O(),h=h+1|0,0}function ye(x){return x=x|0,G(x-128|0),h=h+1|0,0}function it(x){return x=x|0,X(1)|0?1:(G(i[h+1|0]|0),h=h+2|0,0)}function We(x){return x=x|0,X(2)|0?1:(G(u(h+1|0)|0),h=h+3|0,0)}function Re(x){return x=x|0,X(4)|0?1:(j(u(h+1|0)|0,u(h+3|0)|0),h=h+5|0,0)}function xu(x){return x=x|0,X(8)|0?1:(Z(u(h+1|0)|0,u(h+3|0)|0,u(h+5|0)|0,u(h+7|0)|0),h=h+9|0,0)}function _u(x){return x=x|0,I(),h=h+1|0,0}function Oe(x){x=x|0;var be=0;return be=x-160|0,X(be|0)|0?1:(fe(be|0),h=h+1|0,0)}function Eu(x){return x=x|0,X(1)|0?1:(fe(i[h+1|0]|0),h=h+2|0,0)}function vu(x){return x=x|0,X(2)|0?1:(fe(u(h+1|0)|0),h=h+3|0,0)}function Iu(x){return x=x|0,X(4)|0?1:(re(u(h+1|0)|0,u(h+3|0)|0),h=h+5|0,0)}function Au(x){return x=x|0,X(8)|0?1:(te(u(h+1|0)|0,u(h+3|0)|0,u(h+5|0)|0,u(h+7|0)|0),h=h+9|0,0)}function Bu(x){return x=x|0,k(),h=h+1|0,0}function Rr(x){return x=x|0,C(x-192|0|0),h=h+1|0,0}function lh(x){return x=x|0,C(x|0),h=h+1|0,0}function hh(x){return x=x|0,C(x|0),h=h+1|0,0}function dh(x){return x=x|0,C(x|0),h=h+1|0,0}function ph(x){return x=x|0,C(x|0),h=h+1|0,0}function Ve(x){return x=x|0,C(x-192|0|0),h=h+1|0,0}function mh(x){return x=x|0,C(x|0),h=h+1|0,0}function gh(x){return x=x|0,C(x|0),h=h+1|0,0}function bh(x){return x=x|0,C(x|0),h=h+1|0,0}function Su(x){return x=x|0,X(1)|0?1:(C(i[h+1|0]|0),h=h+2|0,0)}function Tu(x){return x=x|0,X(2)|0?1:(C(u(h+1|0)|0),h=h+3|0,0)}function Nu(x){return x=x|0,X(4)|0?1:(W(u(h+1|0)|0,u(h+3|0)|0),h=h+5|0,0)}function Ru(x){return x=x|0,X(8)|0?1:(ue(u(h+1|0)|0,u(h+3|0)|0,u(h+5|0)|0,u(h+7|0)|0),h=h+9|0,0)}function De(x){return x=x|0,U((x|0)-224|0),h=h+1|0,0}function Ou(x){return x=x|0,f(),h=h+1|0,0}function Uu(x){return x=x|0,_(),h=h+1|0,0}function Fu(x){return x=x|0,T(),h=h+1|0,0}function Pu(x){return x=x|0,P(),h=h+1|0,0}function Lu(x){return x=x|0,X(1)|0?1:(U(i[h+1|0]|0),h=h+2|0,0)}function Mu(x){x=x|0;var be=0,we=0,pe=1,On=0,Kr=0,wh=0;return X(2)|0?1:(be=i[h+1|0]|0,we=i[h+2|0]|0,(be|0)&128&&(pe=-1),On=+(((be|0)&124)>>2),Kr=+(((be|0)&3)<<8|we),+On==0?m(+(+pe*5960464477539063e-23*+Kr)):+On==31?+pe==1?+Kr>0?D():F():+Kr>0?Y():$():m(+(+pe*R(2,+(+On-25))*+(1024+Kr))),h=h+3|0,0)}function Du(x){return x=x|0,X(4)|0?1:(g(i[h+1|0]|0,i[h+2|0]|0,i[h+3|0]|0,i[h+4|0]|0),h=h+5|0,0)}function ku(x){return x=x|0,X(8)|0?1:(y(i[h+1|0]|0,i[h+2|0]|0,i[h+3|0]|0,i[h+4|0]|0,i[h+5|0]|0,i[h+6|0]|0,i[h+7|0]|0,i[h+8|0]|0),h=h+9|0,0)}function ve(x){return x=x|0,1}function qu(x){return x=x|0,V(),h=h+1|0,0}var Cu=[d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,d,B,E,A,M,ve,ve,ve,ve,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,S,L,N,H,ve,ve,ve,ve,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,K,ie,de,Ee,Ne,ve,ve,ve,he,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,oe,Me,Xt,gr,br,ve,ve,ve,dt,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,ye,it,We,Re,xu,ve,ve,ve,_u,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Oe,Eu,vu,Iu,Au,ve,ve,ve,Bu,Rr,Rr,Rr,Rr,Rr,Rr,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Ve,Su,Tu,Nu,Ru,ve,ve,ve,ve,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,Ou,Uu,Fu,Pu,Lu,Mu,Du,ku,ve,ve,ve,qu];return{parse:ae}}});var sn=je(ut=>{"use strict";var bs=nn().BigNumber;ut.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7};ut.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36};ut.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31};ut.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23};ut.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")};ut.SHIFT32=Math.pow(2,32);ut.SHIFT16=Math.pow(2,16);ut.MAX_SAFE_HIGH=2097151;ut.NEG_ONE=new bs(-1);ut.TEN=new bs(10);ut.TWO=new bs(2);ut.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5}});var zn=je(mt=>{"use strict";var{Buffer:Lf}=rn(),ha=nn().BigNumber,da=sn(),la=da.SHIFT32,Mf=da.SHIFT16,Df=2097151;mt.parseHalf=function(e){var t,n,i;return i=e[0]&128?-1:1,t=(e[0]&124)>>2,n=(e[0]&3)<<8|e[1],t?t===31?i*(n?NaN:1/0):i*Math.pow(2,t-25)*(1024+n):i*5960464477539063e-23*n};function kf(r){return r<16?"0"+r.toString(16):r.toString(16)}mt.arrayBufferToBignumber=function(r){let e=r.byteLength,t="";for(let n=0;n<e;n++)t+=kf(r[n]);return new ha(t,16)};mt.buildMap=r=>{let e=new Map,t=Object.keys(r),n=t.length;for(let i=0;i<n;i++)e.set(t[i],r[t[i]]);return e};mt.buildInt32=(r,e)=>r*Mf+e;mt.buildInt64=(r,e,t,n)=>{let i=mt.buildInt32(r,e),s=mt.buildInt32(t,n);return i>Df?new ha(i).times(la).plus(s):i*la+s};mt.writeHalf=function(e,t){let n=Lf.allocUnsafe(4);n.writeFloatBE(t,0);let i=n.readUInt32BE(0);if(i&8191)return!1;var s=i>>16&32768;let o=i>>23&255,c=i&8388607;if(o>=113&&o<=142)s+=(o-112<<10)+(c>>13);else if(o>=103&&o<113){if(c&(1<<126-o)-1)return!1;s+=c+8388608>>126-o}else return!1;return e.writeUInt16BE(s,0),!0};mt.keySorter=function(r,e){var t=r[0].byteLength,n=e[0].byteLength;return t>n?1:n>t?-1:r[0].compare(e[0])};mt.isNegativeZero=r=>r===0&&1/r<0;mt.nextPowerOf2=r=>{let e=0;if(r&&!(r&r-1))return r;for(;r!==0;)r>>=1,e+=1;return 1<<e}});var _s=je((Qh,pa)=>{"use strict";var xs=sn(),qf=xs.MT,Zn=xs.SIMPLE,ws=xs.SYMS,ys=class r{constructor(e){if(typeof e!="number")throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(e|0)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,qf.SIMPLE_FLOAT)}static isSimple(e){return e instanceof r}static decode(e,t){switch(t==null&&(t=!0),e){case Zn.FALSE:return!1;case Zn.TRUE:return!0;case Zn.NULL:return t?null:ws.NULL;case Zn.UNDEFINED:return t?void 0:ws.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return ws.BREAK;default:return new r(e)}}};pa.exports=ys});var vs=je((Jh,ma)=>{"use strict";var Es=class r{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,typeof this.tag!="number")throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(this.tag|0)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,n;if(n=e?.[this.tag],typeof n!="function"&&(n=r["_tag"+this.tag],typeof n!="function"))return this;try{return n.call(r,this.value)}catch(i){return t=i,this.err=t,this}}};ma.exports=Es});var Bs=je((ed,ba)=>{"use strict";var ga=self.location?self.location.protocol+"//"+self.location.host:"",Is=self.URL,As=class{constructor(e="",t=ga){this.super=new Is(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}};function Cf(r){if(typeof r=="string")return new Is(r).toString();if(!(r instanceof Is)){let e=r.username&&r.password?`${r.username}:${r.password}@`:"",t=r.auth?r.auth+"@":"",n=r.port?":"+r.port:"",i=r.protocol?r.protocol+"//":"",s=r.host||"",o=r.hostname||"",c=r.search||(r.query?"?"+r.query:""),a=r.hash||"",p=r.pathname||"",m=r.path||p+c;return`${i}${e||t}${s||o+n}${m}${a}`}}ba.exports={URLWithLegacySupport:As,URLSearchParams:self.URLSearchParams,defaultBase:ga,format:Cf}});var xa=je((td,ya)=>{"use strict";var{URLWithLegacySupport:wa,format:$f}=Bs();ya.exports=(r,e={},t={},n)=>{let i=e.protocol?e.protocol.replace(":",""):"http";i=(t[i]||n||i)+":";let s;try{s=new wa(r)}catch{s={}}let o=Object.assign({},e,{protocol:i||s.protocol,host:e.host||s.host});return new wa(r,$f(o)).toString()}});var Ss=je((rd,_a)=>{"use strict";var{URLWithLegacySupport:Gf,format:Hf,URLSearchParams:Vf,defaultBase:jf}=Bs(),Yf=xa();_a.exports={URL:Gf,URLSearchParams:Vf,format:Hf,relative:Yf,defaultBase:jf}});var Ts=je((nd,va)=>{"use strict";var{Buffer:Fr}=rn(),Ea=aa(),zf=nn().BigNumber,Zf=fa(),et=zn(),_e=sn(),Wf=_s(),Kf=vs(),{URL:Xf}=Ss(),on=class r{constructor(e){e=e||{},!e.size||e.size<65536?e.size=65536:e.size=et.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=Fr.from(this._heap),this._reset(),this._knownTags=Object.assign({0:t=>new Date(t),1:t=>new Date(t*1e3),2:t=>et.arrayBufferToBignumber(t),3:t=>_e.NEG_ONE.minus(et.arrayBufferToBignumber(t)),4:t=>_e.TEN.pow(t[0]).times(t[1]),5:t=>_e.TWO.pow(t[0]).times(t[1]),32:t=>new Xf(t),35:t=>new RegExp(t)},e.tags),this.parser=Zf(globalThis,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case _e.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case _e.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case _e.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case _e.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case _e.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case _e.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length));break;default:break}this._currentParent&&this._currentParent.type===_e.PARENT.TAG&&this._dec()}_dec(){let e=this._currentParent;e.length<0||(e.length--,e.length===0&&this._closeParent())}_push(e,t){let n=this._currentParent;switch(n.values++,n.type){case _e.PARENT.ARRAY:case _e.PARENT.BYTE_STRING:case _e.PARENT.UTF8_STRING:n.length>-1?this._ref[this._ref.length-n.length]=e:this._ref.push(e),this._dec();break;case _e.PARENT.OBJECT:n.tmpKey!=null?(this._ref[n.tmpKey]=e,n.tmpKey=null,this._dec()):(n.tmpKey=e,typeof n.tmpKey!="string"&&(n.type=_e.PARENT.MAP,n.ref=et.buildMap(n.ref)));break;case _e.PARENT.MAP:n.tmpKey!=null?(this._ref.set(n.tmpKey,e),n.tmpKey=null,this._dec()):n.tmpKey=e;break;case _e.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,n){this._parents[this._depth]={type:t,length:n,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:_e.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){let n=this._knownTags[e];return n?n(t):new Kf(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,t){return Fr.concat(e)}createByteStringFromHeap(e,t){return e===t?Fr.alloc(0):Fr.from(this._heap.slice(e,t))}createInt(e){return e}createInt32(e,t){return et.buildInt32(e,t)}createInt64(e,t,n,i){return et.buildInt64(e,t,n,i)}createFloat(e){return e}createFloatSingle(e,t,n,i){return Ea.read([e,t,n,i],0,!1,23,4)}createFloatDouble(e,t,n,i,s,o,c,a){return Ea.read([e,t,n,i,s,o,c,a],0,!1,52,8)}createInt32Neg(e,t){return-1-et.buildInt32(e,t)}createInt64Neg(e,t,n,i){let s=et.buildInt32(e,t),o=et.buildInt32(n,i);return s>_e.MAX_SAFE_HIGH?_e.NEG_ONE.minus(new zf(s).times(_e.SHIFT32).plus(o)):-1-(s*_e.SHIFT32+o)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new Wf(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,n,i){this._push(this.createInt64(e,t,n,i))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,n,i){this._push(this.createFloatSingle(e,t,n,i))}pushFloatDouble(e,t,n,i,s,o,c,a){this._push(this.createFloatDouble(e,t,n,i,s,o,c,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,n,i){this._push(this.createInt64Neg(e,t,n,i))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],_e.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){let n=et.buildInt32(e,t);this._createArrayStartFixed(n)}pushArrayStartFixed64(e,t,n,i){let s=et.buildInt64(e,t,n,i);this._createArrayStartFixed(s)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){let n=et.buildInt32(e,t);this._createObjectStartFixed(n)}pushObjectStartFixed64(e,t,n,i){let s=et.buildInt64(e,t,n,i);this._createObjectStartFixed(s)}pushByteStringStart(){this._parents[this._depth]={type:_e.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:_e.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:_e.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(et.buildInt32(e,t))}pushTagStart8(e,t,n,i){this.pushTagStart(et.buildInt64(e,t,n,i))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){if(e===0){this._push(this.createObject({}));return}this._createParent({},_e.PARENT.OBJECT,e)}_createArrayStartFixed(e){if(e===0){this._push(this.createArray([]));return}this._createParent(new Array(e),_e.PARENT.ARRAY,e)}_decode(e){if(e.byteLength===0)throw new Error("Input too short");this._reset(),this._heap8.set(e);let t=this.parser.parse(e.byteLength);if(this._depth>1){for(;this._currentParent.length===0;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(this._res.length===0)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,t){return typeof e=="string"&&(e=Fr.from(e,t||"hex")),new r({size:e.length}).decodeFirst(e)}static decodeAll(e,t){return typeof e=="string"&&(e=Fr.from(e,t||"hex")),new r({size:e.length}).decodeAll(e)}};on.decodeFirst=on.decode;va.exports=on});var Ba=je((id,Aa)=>{"use strict";var{Buffer:Ns}=rn(),Qf=Ts(),Jf=zn(),Rs=class r extends Qf{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,n,i){return super.createInt64(e,t,n,i).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,n,i){return super.createInt64Neg(e,t,n,i).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){let t=super.createFloat(e);return Jf.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,n,i){return`${super.createFloatSingle(e,t,n,i)}_2`}createFloatDouble(e,t,n,i,s,o,c,a){return`${super.createFloatDouble(e,t,n,i,s,o,c,a)}_3`}createByteString(e,t){let n=e.join(", ");return t===-1?`(_ ${n})`:`h'${n}`}createByteStringFromHeap(e,t){return`h'${Ns.from(super.createByteStringFromHeap(e,t)).toString("hex")}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){let n=super.createArray(e,t);return t===-1?`[_ ${n.join(", ")}]`:`[${n.join(", ")}]`}createMap(e,t){let n=super.createMap(e),i=Array.from(n.keys()).reduce(Ia(n),"");return t===-1?`{_ ${i}}`:`{${i}}`}createObject(e,t){let n=super.createObject(e),i=Object.keys(n).reduce(Ia(n),"");return t===-1?`{_ ${i}}`:`{${i}}`}createUtf8String(e,t){let n=e.join(", ");return t===-1?`(_ ${n})`:`"${n}"`}createUtf8StringFromHeap(e,t){return`"${Ns.from(super.createUtf8StringFromHeap(e,t)).toString("utf8")}"`}static diagnose(e,t){return typeof e=="string"&&(e=Ns.from(e,t||"hex")),new r().decodeFirst(e)}};Aa.exports=Rs;function Ia(r){return(e,t)=>e?`${e}, ${t}: ${r[t]}`:`${t}: ${r[t]}`}});var Oa=je((sd,Ra)=>{"use strict";var{Buffer:Pt}=rn(),{URL:e0}=Ss(),Us=nn().BigNumber,Os=zn(),$e=sn(),yt=$e.MT,Wn=$e.NUMBYTES,Sa=$e.SHIFT32,Ta=$e.SYMS,Pr=$e.TAG,t0=$e.MT.SIMPLE_FLOAT<<5|$e.NUMBYTES.TWO,r0=$e.MT.SIMPLE_FLOAT<<5|$e.NUMBYTES.FOUR,n0=$e.MT.SIMPLE_FLOAT<<5|$e.NUMBYTES.EIGHT,i0=$e.MT.SIMPLE_FLOAT<<5|$e.SIMPLE.TRUE,s0=$e.MT.SIMPLE_FLOAT<<5|$e.SIMPLE.FALSE,o0=$e.MT.SIMPLE_FLOAT<<5|$e.SIMPLE.UNDEFINED,Na=$e.MT.SIMPLE_FLOAT<<5|$e.SIMPLE.NULL,a0=new Us("0x20000000000000"),c0=Pt.from("f97e00","hex"),u0=Pt.from("f9fc00","hex"),f0=Pt.from("f97c00","hex");function l0(r){return{}.toString.call(r).slice(8,-1)}var Fs=class r{constructor(e){e=e||{},this.streaming=typeof e.stream=="function",this.onData=e.stream,this.semanticTypes=[[e0,this._pushUrl],[Us,this._pushBigNumber]];let t=e.genTypes||[],n=t.length;for(let i=0;i<n;i++)this.addSemanticType(t[i][0],t[i][1]);this._reset()}addSemanticType(e,t){let n=this.semanticTypes.length;for(let i=0;i<n;i++)if(this.semanticTypes[i][0]===e){let o=this.semanticTypes[i][1];return this.semanticTypes[i][1]=t,o}return this.semanticTypes.push([e,t]),null}push(e){return e&&(this.result[this.offset]=e,this.resultMethod[this.offset]=0,this.resultLength[this.offset]=e.length,this.offset++,this.streaming&&this.onData(this.finalize())),!0}pushWrite(e,t,n){return this.result[this.offset]=e,this.resultMethod[this.offset]=t,this.resultLength[this.offset]=n,this.offset++,this.streaming&&this.onData(this.finalize()),!0}_pushUInt8(e){return this.pushWrite(e,1,1)}_pushUInt16BE(e){return this.pushWrite(e,2,2)}_pushUInt32BE(e){return this.pushWrite(e,3,4)}_pushDoubleBE(e){return this.pushWrite(e,4,8)}_pushNaN(){return this.push(c0)}_pushInfinity(e){let t=e<0?u0:f0;return this.push(t)}_pushFloat(e){let t=Pt.allocUnsafe(2);if(Os.writeHalf(t,e)&&Os.parseHalf(t)===e)return this._pushUInt8(t0)&&this.push(t);let n=Pt.allocUnsafe(4);return n.writeFloatBE(e,0),n.readFloatBE(0)===e?this._pushUInt8(r0)&&this.push(n):this._pushUInt8(n0)&&this._pushDoubleBE(e)}_pushInt(e,t,n){let i=t<<5;return e<24?this._pushUInt8(i|e):e<=255?this._pushUInt8(i|Wn.ONE)&&this._pushUInt8(e):e<=65535?this._pushUInt8(i|Wn.TWO)&&this._pushUInt16BE(e):e<=4294967295?this._pushUInt8(i|Wn.FOUR)&&this._pushUInt32BE(e):e<=Number.MAX_SAFE_INTEGER?this._pushUInt8(i|Wn.EIGHT)&&this._pushUInt32BE(Math.floor(e/Sa))&&this._pushUInt32BE(e%Sa):t===yt.NEG_INT?this._pushFloat(n):this._pushFloat(e)}_pushIntNum(e){return e<0?this._pushInt(-e-1,yt.NEG_INT,e):this._pushInt(e,yt.POS_INT)}_pushNumber(e){switch(!1){case e===e:return this._pushNaN(e);case isFinite(e):return this._pushInfinity(e);case e%1!==0:return this._pushIntNum(e);default:return this._pushFloat(e)}}_pushString(e){let t=Pt.byteLength(e,"utf8");return this._pushInt(t,yt.UTF8_STRING)&&this.pushWrite(e,5,t)}_pushBoolean(e){return this._pushUInt8(e?i0:s0)}_pushUndefined(e){return this._pushUInt8(o0)}_pushArray(e,t){let n=t.length;if(!e._pushInt(n,yt.ARRAY))return!1;for(let i=0;i<n;i++)if(!e.pushAny(t[i]))return!1;return!0}_pushTag(e){return this._pushInt(e,yt.TAG)}_pushDate(e,t){return e._pushTag(Pr.DATE_EPOCH)&&e.pushAny(Math.round(t/1e3))}_pushBuffer(e,t){return e._pushInt(t.length,yt.BYTE_STRING)&&e.push(t)}_pushNoFilter(e,t){return e._pushBuffer(e,t.slice())}_pushRegexp(e,t){return e._pushTag(Pr.REGEXP)&&e.pushAny(t.source)}_pushSet(e,t){if(!e._pushInt(t.size,yt.ARRAY))return!1;for(let n of t)if(!e.pushAny(n))return!1;return!0}_pushUrl(e,t){return e._pushTag(Pr.URI)&&e.pushAny(t.format())}_pushBigint(e){let t=Pr.POS_BIGINT;e.isNegative()&&(e=e.negated().minus(1),t=Pr.NEG_BIGINT);let n=e.toString(16);n.length%2&&(n="0"+n);let i=Pt.from(n,"hex");return this._pushTag(t)&&this._pushBuffer(this,i)}_pushBigNumber(e,t){if(t.isNaN())return e._pushNaN();if(!t.isFinite())return e._pushInfinity(t.isNegative()?-1/0:1/0);if(t.isInteger())return e._pushBigint(t);if(!(e._pushTag(Pr.DECIMAL_FRAC)&&e._pushInt(2,yt.ARRAY)))return!1;let n=t.decimalPlaces(),i=t.multipliedBy(new Us(10).pow(n));return e._pushIntNum(-n)?i.abs().isLessThan(a0)?e._pushIntNum(i.toNumber()):e._pushBigint(i):!1}_pushMap(e,t){return e._pushInt(t.size,yt.MAP)?this._pushRawMap(t.size,Array.from(t)):!1}_pushObject(e){if(!e)return this._pushUInt8(Na);for(var t=this.semanticTypes.length,n=0;n<t;n++)if(e instanceof this.semanticTypes[n][0])return this.semanticTypes[n][1].call(e,this,e);var i=e.encodeCBOR;if(typeof i=="function")return i.call(e,this);var s=Object.keys(e),o=s.length;return this._pushInt(o,yt.MAP)?this._pushRawMap(o,s.map(c=>[c,e[c]])):!1}_pushRawMap(e,t){t=t.map(function(i){return i[0]=r.encode(i[0]),i}).sort(Os.keySorter);for(var n=0;n<e;n++)if(!this.push(t[n][0])||!this.pushAny(t[n][1]))return!1;return!0}write(e){return this.pushAny(e)}pushAny(e){var t=l0(e);switch(t){case"Number":return this._pushNumber(e);case"String":return this._pushString(e);case"Boolean":return this._pushBoolean(e);case"Object":return this._pushObject(e);case"Array":return this._pushArray(this,e);case"Uint8Array":return this._pushBuffer(this,Pt.isBuffer(e)?e:Pt.from(e));case"Null":return this._pushUInt8(Na);case"Undefined":return this._pushUndefined(e);case"Map":return this._pushMap(this,e);case"Set":return this._pushSet(this,e);case"URL":return this._pushUrl(this,e);case"BigNumber":return this._pushBigNumber(this,e);case"Date":return this._pushDate(this,e);case"RegExp":return this._pushRegexp(this,e);case"Symbol":switch(e){case Ta.NULL:return this._pushObject(null);case Ta.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+e.toString())}default:throw new Error("Unknown type: "+typeof e+", "+(e?e.toString():""))}}finalize(){if(this.offset===0)return null;for(var e=this.result,t=this.resultLength,n=this.resultMethod,i=this.offset,s=0,o=0;o<i;o++)s+=t[o];var c=Pt.allocUnsafe(s),a=0,p=0;for(o=0;o<i;o++){switch(p=t[o],n[o]){case 0:e[o].copy(c,a);break;case 1:c.writeUInt8(e[o],a,!0);break;case 2:c.writeUInt16BE(e[o],a,!0);break;case 3:c.writeUInt32BE(e[o],a,!0);break;case 4:c.writeDoubleBE(e[o],a,!0);break;case 5:c.write(e[o],a,p,"utf8");break;default:throw new Error("unkown method")}a+=p}var m=c;return this._reset(),m}_reset(){this.result=[],this.resultMethod=[],this.resultLength=[],this.offset=0}static encode(e){let t=new r;if(!t.pushAny(e))throw new Error("Failed to encode input");return t.finalize()}};Ra.exports=Fs});var Ps=je(Ge=>{"use strict";Ge.Diagnose=Ba();Ge.Decoder=Ts();Ge.Encoder=Oa();Ge.Simple=_s();Ge.Tagged=vs();Ge.decodeAll=Ge.Decoder.decodeAll;Ge.decodeFirst=Ge.Decoder.decodeFirst;Ge.diagnose=Ge.Diagnose.diagnose;Ge.encode=Ge.Encoder.encode;Ge.decode=Ge.Decoder.decode;Ge.leveldb={decode:Ge.Decoder.decodeAll,encode:Ge.Encoder.encode,buffer:!0,name:"cbor"}});var Ds=je(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});var h0=9007199254740992;function Ht(r,...e){let t=new Uint8Array(r.byteLength+e.reduce((i,s)=>i+s.byteLength,0));t.set(new Uint8Array(r),0);let n=r.byteLength;for(let i of e)t.set(new Uint8Array(i),n),n+=i.byteLength;return t.buffer}function xt(r,e,t){t=t.replace(/[^0-9a-fA-F]/g,"");let n=2**(e-24);t=t.slice(-n*2).padStart(n*2,"0");let i=[(r<<5)+e].concat(t.match(/../g).map(s=>parseInt(s,16)));return new Uint8Array(i).buffer}function Kn(r,e){if(e<24)return new Uint8Array([(r<<5)+e]).buffer;{let t=e<=255?24:e<=65535?25:e<=4294967295?26:27;return xt(r,t,e.toString(16))}}function Ua(r){let e=[];for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);n<128?e.push(n):n<2048?e.push(192|n>>6,128|n&63):n<55296||n>=57344?e.push(224|n>>12,128|n>>6&63,128|n&63):(t++,n=(n&1023)<<10|r.charCodeAt(t)&1023,e.push(240|n>>18,128|n>>12&63,128|n>>6&63,128|n&63))}return Ht(new Uint8Array(Kn(3,r.length)),new Uint8Array(e))}function d0(r,e){if(r==14277111)return Ht(new Uint8Array([217,217,247]),e);if(r<24)return Ht(new Uint8Array([192+r]),e);{let t=r<=255?24:r<=65535?25:r<=4294967295?26:27,n=2**(t-24),i=r.toString(16).slice(-n*2).padStart(n*2,"0"),s=[192+t].concat(i.match(/../g).map(o=>parseInt(o,16)));return new Uint8Array(s).buffer}}Ae.tagged=d0;function an(r){return new Uint8Array(r).buffer}Ae.raw=an;function Ls(r){if(isNaN(r))throw new RangeError("Invalid number.");r=Math.min(Math.max(0,r),23);let e=[0+r];return new Uint8Array(e).buffer}Ae.uSmall=Ls;function Fa(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),255),r=r.toString(16),xt(0,24,r)}Ae.u8=Fa;function Pa(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),65535),r=r.toString(16),xt(0,25,r)}Ae.u16=Pa;function La(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),4294967295),r=r.toString(16),xt(0,26,r)}Ae.u32=La;function Ms(r,e){if(typeof r=="string"&&e==16){if(r.match(/[^0-9a-fA-F]/))throw new RangeError("Invalid number.");return xt(0,27,r)}if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,r),h0),r=r.toString(16),xt(0,27,r)}Ae.u64=Ms;function Ma(r){if(isNaN(r))throw new RangeError("Invalid number.");if(r===0)return Ls(0);r=Math.min(Math.max(0,-r),24)-1;let e=[32+r];return new Uint8Array(e).buffer}Ae.iSmall=Ma;function Da(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),255),r=r.toString(16),xt(1,24,r)}Ae.i8=Da;function ka(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),65535),r=r.toString(16),xt(1,25,r)}Ae.i16=ka;function qa(r,e){if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),4294967295),r=r.toString(16),xt(1,26,r)}Ae.i32=qa;function Ca(r,e){if(typeof r=="string"&&e==16){if(r.startsWith("-")?r=r.slice(1):r="0",r.match(/[^0-9a-fA-F]/)||r.length>16)throw new RangeError("Invalid number.");let t=!1,n=r.split("").reduceRight((i,s)=>{if(t)return s+i;let o=parseInt(s,16)-1;return o>=0?(t=!0,o.toString(16)+i):"f"+i},"");return t?xt(1,27,n):Ms(0)}if(r=parseInt(""+r,e),isNaN(r))throw new RangeError("Invalid number.");return r=Math.min(Math.max(0,-r-1),9007199254740992),r=r.toString(16),xt(1,27,r)}Ae.i64=Ca;function p0(r){return r>=0?r<24?Ls(r):r<=255?Fa(r):r<=65535?Pa(r):r<=4294967295?La(r):Ms(r):r>=-24?Ma(r):r>=-255?Da(r):r>=-65535?ka(r):r>=-4294967295?qa(r):Ca(r)}Ae.number=p0;function m0(r){return Ht(Kn(2,r.byteLength),r)}Ae.bytes=m0;function g0(r){return Ua(r)}Ae.string=g0;function b0(r){return Ht(Kn(4,r.length),...r)}Ae.array=b0;function w0(r,e=!1){r instanceof Map||(r=new Map(Object.entries(r)));let t=Array.from(r.entries());return e&&(t=t.sort(([n],[i])=>n.localeCompare(i))),Ht(Kn(5,r.size),...t.map(([n,i])=>Ht(Ua(n),i)))}Ae.map=w0;function y0(r){let e=new Float32Array([r]);return Ht(new Uint8Array([250]),new Uint8Array(e.buffer))}Ae.singleFloat=y0;function x0(r){let e=new Float64Array([r]);return Ht(new Uint8Array([251]),new Uint8Array(e.buffer))}Ae.doubleFloat=x0;function _0(r){return r?$a():Ga()}Ae.bool=_0;function $a(){return an(new Uint8Array([245]))}Ae.true_=$a;function Ga(){return an(new Uint8Array([244]))}Ae.false_=Ga;function E0(){return an(new Uint8Array([246]))}Ae.null_=E0;function v0(){return an(new Uint8Array([247]))}Ae.undefined_=v0});var Ha=je(er=>{"use strict";var I0=er&&er.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e};Object.defineProperty(er,"__esModule",{value:!0});var _t=I0(Ds()),A0=[ArrayBuffer,Uint8Array,Uint16Array,Uint32Array,Int8Array,Int16Array,Int32Array,Float32Array,Float64Array],Xn=class{constructor(e,t=!1){this._serializer=e,this._stable=t,this.name="jsonDefault",this.priority=-100}match(e){return["undefined","boolean","number","string","object"].indexOf(typeof e)!=-1}encode(e){switch(typeof e){case"undefined":return _t.undefined_();case"boolean":return _t.bool(e);case"number":return Math.floor(e)===e?_t.number(e):_t.doubleFloat(e);case"string":return _t.string(e);case"object":if(e===null)return _t.null_();if(Array.isArray(e))return _t.array(e.map(t=>this._serializer.serializeValue(t)));if(A0.find(t=>e instanceof t))return _t.bytes(e.buffer);if(Object.getOwnPropertyNames(e).indexOf("toJSON")!==-1)return this.encode(e.toJSON());if(e instanceof Map){let t=new Map;for(let[n,i]of e.entries())t.set(n,this._serializer.serializeValue(i));return _t.map(t,this._stable)}else{let t=new Map;for(let[n,i]of Object.entries(e))t.set(n,this._serializer.serializeValue(i));return _t.map(t,this._stable)}default:throw new Error("Invalid value.")}}};er.JsonDefaultCborEncoder=Xn;var Qn=class{constructor(){this.name="cborEncoder",this.priority=-90}match(e){return typeof e=="object"&&typeof e.toCBOR=="function"}encode(e){return e.toCBOR()}};er.ToCborEncoder=Qn;var Jn=class{constructor(){this._encoders=new Set}static withDefaultEncoders(e=!1){let t=new this;return t.addEncoder(new Xn(t,e)),t.addEncoder(new Qn),t}removeEncoder(e){for(let t of this._encoders.values())t.name==e&&this._encoders.delete(t)}addEncoder(e){this._encoders.add(e)}getEncoderFor(e){let t=null;for(let n of this._encoders)(!t||n.priority>t.priority)&&n.match(e)&&(t=n);if(t===null)throw new Error("Could not find an encoder for value.");return t}serializeValue(e){return this.getEncoderFor(e).encode(e)}serialize(e){return this.serializeValue(e)}};er.CborSerializer=Jn;var ks=class extends Jn{serialize(e){return _t.raw(new Uint8Array([...new Uint8Array([217,217,247]),...new Uint8Array(super.serializeValue(e))]))}};er.SelfDescribeCborSerializer=ks});var ei=je(Er=>{"use strict";function B0(r){for(var e in r)Er.hasOwnProperty(e)||(Er[e]=r[e])}var S0=Er&&Er.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)Object.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e.default=r,e};Object.defineProperty(Er,"__esModule",{value:!0});B0(Ha());var T0=S0(Ds());Er.value=T0});var Fn="abcdefghijklmnopqrstuvwxyz234567",Or=Object.create(null);for(let r=0;r<Fn.length;r++)Or[Fn[r]]=r;Or[0]=Or.o;Or[1]=Or.i;function Ro(r){let e=0,t=0,n="";function i(s){return e<0?t|=s>>-e:t=s<<e&248,e>3?(e-=8,1):(e<4&&(n+=Fn[t>>3],e+=5),0)}for(let s=0;s<r.length;)s+=i(r[s]);return n+(e<0?Fn[t>>3]:"")}function Oo(r){let e=0,t=0,n=new Uint8Array(r.length*4/3|0),i=0;function s(o){let c=Or[o.toLowerCase()];if(c===void 0)throw new Error(`Invalid character: ${JSON.stringify(o)}`);c<<=3,t|=c>>>e,e+=5,e>=8&&(n[i++]=t,e-=8,e>0?t=c<<5-e&255:t=0)}for(let o of r)s(o);return n.slice(0,i)}var Zu=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 Uo(r){let e=new Uint8Array(r),t=-1;for(let n=0;n<e.length;n++){let s=(e[n]^t)&255;t=Zu[s]^t>>>8}return(t^-1)>>>0}function Wu(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function ss(r,...e){if(!Wu(r))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(r.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${r.length}`)}function os(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function Fo(r,e){ss(r);let t=e.outputLen;if(r.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var wr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Ln=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),wt=(r,e)=>r<<32-e|r>>>e;var Bh=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Po(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function as(r){return typeof r=="string"&&(r=Po(r)),ss(r),r}var Pn=class{clone(){return this._cloneInto()}},Sh={}.toString;function Qr(r){let e=n=>r().update(as(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function Mn(r=32){if(wr&&typeof wr.getRandomValues=="function")return wr.getRandomValues(new Uint8Array(r));if(wr&&typeof wr.randomBytes=="function")return wr.randomBytes(r);throw new Error("crypto.getRandomValues must be defined")}function Ku(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(t>>i&s),c=Number(t&s),a=n?4:0,p=n?0:4;r.setUint32(e+a,o,n),r.setUint32(e+p,c,n)}var Lo=(r,e,t)=>r&e^~r&t,Mo=(r,e,t)=>r&e^r&t^e&t,Ur=class extends Pn{constructor(e,t,n,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Ln(this.buffer)}update(e){os(this);let{view:t,buffer:n,blockLen:i}=this;e=as(e);let s=e.length;for(let o=0;o<s;){let c=Math.min(i-this.pos,s-o);if(c===i){let a=Ln(e);for(;i<=s-o;o+=i)this.process(a,o);continue}n.set(e.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){os(this),Fo(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:i,isLE:s}=this,{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(n,0),o=0);for(let g=o;g<i;g++)t[g]=0;Ku(n,i-8,BigInt(this.length*8),s),this.process(n,0);let c=Ln(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let p=a/4,m=this.get();if(p>m.length)throw new Error("_sha2: outputLen bigger than state");for(let g=0;g<p;g++)c.setUint32(4*g,m[g],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:n,length:i,finished:s,destroyed:o,pos:c}=this;return e.length=i,e.pos=c,e.finished=s,e.destroyed=o,i%t&&e.buffer.set(n),e}};var Xu=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Qt=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Jt=new Uint32Array(64),Dn=class extends Ur{constructor(){super(64,32,8,!1),this.A=Qt[0]|0,this.B=Qt[1]|0,this.C=Qt[2]|0,this.D=Qt[3]|0,this.E=Qt[4]|0,this.F=Qt[5]|0,this.G=Qt[6]|0,this.H=Qt[7]|0}get(){let{A:e,B:t,C:n,D:i,E:s,F:o,G:c,H:a}=this;return[e,t,n,i,s,o,c,a]}set(e,t,n,i,s,o,c,a){this.A=e|0,this.B=t|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=a|0}process(e,t){for(let g=0;g<16;g++,t+=4)Jt[g]=e.getUint32(t,!1);for(let g=16;g<64;g++){let y=Jt[g-15],_=Jt[g-2],f=wt(y,7)^wt(y,18)^y>>>3,P=wt(_,17)^wt(_,19)^_>>>10;Jt[g]=P+Jt[g-7]+f+Jt[g-16]|0}let{A:n,B:i,C:s,D:o,E:c,F:a,G:p,H:m}=this;for(let g=0;g<64;g++){let y=wt(c,6)^wt(c,11)^wt(c,25),_=m+y+Lo(c,a,p)+Xu[g]+Jt[g]|0,P=(wt(n,2)^wt(n,13)^wt(n,22))+Mo(n,i,s)|0;m=p,p=a,a=c,c=o+_|0,o=s,s=i,i=n,n=_+P|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,a=a+this.F|0,p=p+this.G|0,m=m+this.H|0,this.set(n,i,s,o,c,a,p,m)}roundClean(){Jt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},cs=class extends Dn{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}},Jr=Qr(()=>new Dn),Do=Qr(()=>new cs);function ko(r){return Do.create().update(new Uint8Array(r)).digest()}var kn="__principal__",Qu=2,qo=4,Ju="aaaaa-aa",ef=r=>{var e;return new Uint8Array(((e=r.match(/.{1,2}/g))!==null&&e!==void 0?e:[]).map(t=>parseInt(t,16)))},tf=r=>r.reduce((e,t)=>e+t.toString(16).padStart(2,"0"),""),me=class r{constructor(e){this._arr=e,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([qo]))}static managementCanister(){return this.fromHex(Ju)}static selfAuthenticating(e){let t=ko(e);return new this(new Uint8Array([...t,Qu]))}static from(e){if(typeof e=="string")return r.fromText(e);if(Object.getPrototypeOf(e)===Uint8Array.prototype)return new r(e);if(typeof e=="object"&&e!==null&&e._isPrincipal===!0)return new r(e._arr);throw new Error(`Impossible to convert ${JSON.stringify(e)} to Principal.`)}static fromHex(e){return new this(ef(e))}static fromText(e){let t=e;if(e.includes(kn)){let o=JSON.parse(e);kn in o&&(t=o[kn])}let n=t.toLowerCase().replace(/-/g,""),i=Oo(n);i=i.slice(4,i.length);let s=new this(i);if(s.toText()!==t)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${t}" may not be a valid Principal ID).`);return s}static fromUint8Array(e){return new this(e)}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===qo}toUint8Array(){return this._arr}toHex(){return tf(this._arr).toUpperCase()}toText(){let e=new ArrayBuffer(4);new DataView(e).setUint32(0,Uo(this._arr));let n=new Uint8Array(e),i=Uint8Array.from(this._arr),s=new Uint8Array([...n,...i]),c=Ro(s).match(/.{1,5}/g);if(!c)throw new Error;return c.join("-")}toString(){return this.toText()}toJSON(){return{[kn]:this.toText()}}compareTo(e){for(let t=0;t<Math.min(this._arr.length,e._arr.length);t++){if(this._arr[t]<e._arr[t])return"lt";if(this._arr[t]>e._arr[t])return"gt"}return this._arr.length<e._arr.length?"lt":this._arr.length>e._arr.length?"gt":"eq"}ltEq(e){let t=this.compareTo(e);return t=="lt"||t=="eq"}gtEq(e){let t=this.compareTo(e);return t=="gt"||t=="eq"}};var us;(function(r){r[r.SysFatal=1]="SysFatal",r[r.SysTransient=2]="SysTransient",r[r.DestinationInvalid=3]="DestinationInvalid",r[r.CanisterReject=4]="CanisterReject",r[r.CanisterError=5]="CanisterError"})(us||(us={}));function Ke(...r){let e=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0)),t=0;for(let n of r)e.set(new Uint8Array(n),t),t+=n.byteLength;return e.buffer}function ct(r){return[...new Uint8Array(r)].map(e=>e.toString(16).padStart(2,"0")).join("")}var rf=new RegExp(/^[0-9a-fA-F]+$/);function yr(r){if(!rf.test(r))throw new Error("Invalid hexadecimal string.");let e=[...r].reduce((t,n,i)=>(t[i/2|0]=(t[i/2|0]||"")+n,t),[]).map(t=>Number.parseInt(t,16));return new Uint8Array(e).buffer}function fs(r,e){if(r.byteLength!==e.byteLength)return r.byteLength-e.byteLength;let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]!==n[i])return t[i]-n[i];return 0}function tn(r,e){return fs(r,e)===0}function en(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function ls(r){return r instanceof Uint8Array?en(r):r instanceof ArrayBuffer?r:Array.isArray(r)?en(new Uint8Array(r)):"buffer"in r?ls(r.buffer):en(new Uint8Array(r))}var Ye=class r extends Error{constructor(e){super(e),this.message=e,this.name="AgentError",this.__proto__=r.prototype,Object.setPrototypeOf(this,r.prototype)}};var ja=Xr(Ps()),vr=Xr(ei()),Ya=Xr(ei());var qs=class{get name(){return"Principal"}get priority(){return 0}match(e){return e&&e._isPrincipal===!0}encode(e){return vr.value.bytes(e.toUint8Array())}},Cs=class{get name(){return"Buffer"}get priority(){return 1}match(e){return e instanceof ArrayBuffer||ArrayBuffer.isView(e)}encode(e){return vr.value.bytes(new Uint8Array(e))}},$s=class{get name(){return"BigInt"}get priority(){return 1}match(e){return typeof e=="bigint"}encode(e){return e>BigInt(0)?vr.value.tagged(2,vr.value.bytes(yr(e.toString(16)))):vr.value.tagged(3,vr.value.bytes(yr((BigInt("-1")*e).toString(16))))}},ti=Ya.SelfDescribeCborSerializer.withDefaultEncoders(!0);ti.addEncoder(new qs);ti.addEncoder(new Cs);ti.addEncoder(new $s);var Gs;(function(r){r[r.Uint64LittleEndian=71]="Uint64LittleEndian",r[r.Semantic=55799]="Semantic"})(Gs||(Gs={}));function ri(r){return ti.serialize(r)}function Va(r){let e=r.byteLength,t=BigInt(0);for(let n=0;n<e;n++)t=t*BigInt(256)+BigInt(r[n]);return t}var Hs=class extends ja.default.Decoder{createByteString(e){return Ke(...e)}createByteStringFromHeap(e,t){return e===t?new ArrayBuffer(0):new Uint8Array(this._heap.slice(e,t))}};function gt(r){let e=new Uint8Array(r),t=new Hs({size:e.byteLength,tags:{2:n=>Va(n),3:n=>-Va(n),[Gs.Semantic]:n=>n}});try{return t.decodeFirst(e)}catch(n){throw new Error(`Failed to decode CBOR: ${n}, input: ${ct(e)}`)}}var Xs={};is(Xs,{Bool:()=>Ja,BoolClass:()=>ci,ConstructType:()=>Mt,Empty:()=>Xa,EmptyClass:()=>oi,FixedIntClass:()=>jt,FixedNatClass:()=>Lt,Float32:()=>ic,Float64:()=>sc,FloatClass:()=>un,Func:()=>_c,FuncClass:()=>ln,Int:()=>rc,Int16:()=>ac,Int32:()=>cc,Int64:()=>uc,Int8:()=>oc,IntClass:()=>li,Nat:()=>nc,Nat16:()=>lc,Nat32:()=>hc,Nat64:()=>dc,Nat8:()=>fc,NatClass:()=>hi,Null:()=>ec,NullClass:()=>ui,Opt:()=>bc,OptClass:()=>Dr,PrimitiveType:()=>ot,Principal:()=>pc,PrincipalClass:()=>gi,Rec:()=>xc,RecClass:()=>nr,Record:()=>wc,RecordClass:()=>fn,Reserved:()=>Qa,ReservedClass:()=>Mr,Service:()=>Ec,ServiceClass:()=>bi,Text:()=>tc,TextClass:()=>fi,Tuple:()=>mc,TupleClass:()=>pi,Type:()=>Lr,Unknown:()=>U0,UnknownClass:()=>ai,Variant:()=>yc,VariantClass:()=>mi,Vec:()=>gc,VecClass:()=>di,Visitor:()=>si,decode:()=>O0,encode:()=>R0});function xe(...r){let e=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0)),t=0;for(let n of r)e.set(new Uint8Array(n),t),t+=n.byteLength;return e}var Et=class{constructor(e,t=e?.byteLength||0){this._buffer=Ys(e||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,t)}get buffer(){return Ys(this._view.slice())}get byteLength(){return this._view.byteLength}read(e){let t=this._view.subarray(0,e);return this._view=this._view.subarray(e),t.slice().buffer}readUint8(){let e=this._view[0];return this._view=this._view.subarray(1),e}write(e){let t=new Uint8Array(e),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+t.byteLength>=this._buffer.byteLength?this.alloc(t.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+t.byteLength),this._view.set(t,n)}get end(){return this._view.byteLength===0}alloc(e){let t=new ArrayBuffer((this._buffer.byteLength+e)*1.2|0),n=new Uint8Array(t,0,this._view.byteLength+e);n.set(this._view),this._buffer=t,this._view=n}};function js(r){return new DataView(r.buffer,r.byteOffset,r.byteLength).buffer}function Ys(r){return r instanceof Uint8Array?js(r):r instanceof ArrayBuffer?r:Array.isArray(r)?js(new Uint8Array(r)):"buffer"in r?Ys(r.buffer):js(new Uint8Array(r))}function N0(r){let t=new TextEncoder().encode(r),n=0;for(let i of t)n=(n*223+i)%2**32;return n}function vt(r){if(/^_\d+_$/.test(r)||/^_0x[0-9a-fA-F]+_$/.test(r)){let e=+r.slice(1,-1);if(Number.isSafeInteger(e)&&e>=0&&e<2**32)return e}return N0(r)}function za(){throw new Error("unexpected end of buffer")}function rr(r,e){return r.byteLength<e&&za(),r.read(e)}function tr(r){let e=r.readUint8();return e===void 0&&za(),e}function Se(r){if(typeof r=="number"&&(r=BigInt(r)),r<BigInt(0))throw new Error("Cannot leb encode negative values.");let e=(r===BigInt(0)?0:Math.ceil(Math.log2(Number(r))))+1,t=new Et(new ArrayBuffer(e),0);for(;;){let n=Number(r&BigInt(127));if(r/=BigInt(128),r===BigInt(0)){t.write(new Uint8Array([n]));break}else t.write(new Uint8Array([n|128]))}return t.buffer}function ke(r){let e=BigInt(1),t=BigInt(0),n;do n=tr(r),t+=BigInt(n&127).valueOf()*e,e*=BigInt(128);while(n>=128);return t}function qe(r){typeof r=="number"&&(r=BigInt(r));let e=r<BigInt(0);e&&(r=-r-BigInt(1));let t=(r===BigInt(0)?0:Math.ceil(Math.log2(Number(r))))+1,n=new Et(new ArrayBuffer(t),0);for(;;){let s=i(r);if(r/=BigInt(128),e&&r===BigInt(0)&&s&64||!e&&r===BigInt(0)&&!(s&64)){n.write(new Uint8Array([s]));break}else n.write(new Uint8Array([s|128]))}function i(s){let o=s%BigInt(128);return Number(e?BigInt(128)-o-BigInt(1):o)}return n.buffer}function Vt(r){let e=new Uint8Array(r.buffer),t=0;for(;t<e.byteLength;t++)if(e[t]<128){if(!(e[t]&64))return ke(r);break}let n=new Uint8Array(rr(r,t+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 Za(r,e){if(BigInt(r)<BigInt(0))throw new Error("Cannot write negative values.");return zs(r,e)}function zs(r,e){r=BigInt(r);let t=new Et(new ArrayBuffer(Math.min(1,e)),0),n=0,i=BigInt(256),s=BigInt(0),o=Number(r%i);for(t.write(new Uint8Array([o]));++n<e;)r<0&&s===BigInt(0)&&o!==0&&(s=BigInt(1)),o=Number((r/i-s)%BigInt(256)),t.write(new Uint8Array([o])),i*=BigInt(256);return t.buffer}function Zs(r,e){let t=BigInt(tr(r)),n=BigInt(1),i=0;for(;++i<e;){n*=BigInt(256);let s=BigInt(tr(r));t=t+n*s}return t}function Wa(r,e){let t=Zs(r,e),n=BigInt(2)**(BigInt(8)*BigInt(e-1)+BigInt(7));return t>=n&&(t-=n*BigInt(2)),t}function ni(r){let e=BigInt(r);if(r<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<e}var ii="DIDL",Ka=400;function cn(r,e,t){return r.map((n,i)=>t(n,e[i]))}var Ws=class{constructor(){this._typs=[],this._idx=new Map}has(e){return this._idx.has(e.name)}add(e,t){let n=this._typs.length;this._idx.set(e.name,n),this._typs.push(t)}merge(e,t){let n=this._idx.get(e.name),i=this._idx.get(t);if(n===void 0)throw new Error("Missing type index for "+e);if(i===void 0)throw new Error("Missing type index for "+t);this._typs[n]=this._typs[i],this._typs.splice(i,1),this._idx.delete(t)}encode(){let e=Se(this._typs.length),t=xe(...this._typs);return xe(e,t)}indexOf(e){if(!this._idx.has(e))throw new Error("Missing type index for "+e);return qe(this._idx.get(e)||0)}},si=class{visitType(e,t){throw new Error("Not implemented")}visitPrimitive(e,t){return this.visitType(e,t)}visitEmpty(e,t){return this.visitPrimitive(e,t)}visitBool(e,t){return this.visitPrimitive(e,t)}visitNull(e,t){return this.visitPrimitive(e,t)}visitReserved(e,t){return this.visitPrimitive(e,t)}visitText(e,t){return this.visitPrimitive(e,t)}visitNumber(e,t){return this.visitPrimitive(e,t)}visitInt(e,t){return this.visitNumber(e,t)}visitNat(e,t){return this.visitNumber(e,t)}visitFloat(e,t){return this.visitPrimitive(e,t)}visitFixedInt(e,t){return this.visitNumber(e,t)}visitFixedNat(e,t){return this.visitNumber(e,t)}visitPrincipal(e,t){return this.visitPrimitive(e,t)}visitConstruct(e,t){return this.visitType(e,t)}visitVec(e,t,n){return this.visitConstruct(e,n)}visitOpt(e,t,n){return this.visitConstruct(e,n)}visitRecord(e,t,n){return this.visitConstruct(e,n)}visitTuple(e,t,n){let i=t.map((s,o)=>[`_${o}_`,s]);return this.visitRecord(e,i,n)}visitVariant(e,t,n){return this.visitConstruct(e,n)}visitRec(e,t,n){return this.visitConstruct(t,n)}visitFunc(e,t){return this.visitConstruct(e,t)}visitService(e,t){return this.visitConstruct(e,t)}},Lr=class{display(){return this.name}valueToString(e){return Ue(e)}buildTypeTable(e){e.has(this)||this._buildTypeTableImpl(e)}},ot=class extends Lr{checkType(e){if(this.name!==e.name)throw new Error(`type mismatch: type on the wire ${e.name}, expect type ${this.name}`);return e}_buildTypeTableImpl(e){}},Mt=class extends Lr{checkType(e){if(e instanceof nr){let t=e.getType();if(typeof t>"u")throw new Error("type mismatch with uninitialized type");return t}throw new Error(`type mismatch: type on the wire ${e.name}, expect type ${this.name}`)}encodeType(e){return e.indexOf(this.name)}},oi=class extends ot{accept(e,t){return e.visitEmpty(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return qe(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},ai=class extends Lr{checkType(e){throw new Error("Method not implemented for unknown.")}accept(e,t){throw e.visitType(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(){throw new Error("Unknown cannot appear as a function argument")}valueToString(){throw new Error("Unknown cannot appear as a value")}encodeType(){throw new Error("Unknown cannot be serialized")}decodeValue(e,t){let n=t.decodeValue(e,t);Object(n)!==n&&(n=Object(n));let i;return t instanceof nr?i=()=>t.getType():i=()=>t,Object.defineProperty(n,"type",{value:i,writable:!0,enumerable:!1,configurable:!0}),n}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}},ci=class extends ot{accept(e,t){return e.visitBool(this,t)}covariant(e){if(typeof e=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){return new Uint8Array([e?1:0])}encodeType(){return qe(-2)}decodeValue(e,t){switch(this.checkType(t),tr(e)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},ui=class extends ot{accept(e,t){return e.visitNull(this,t)}covariant(e){if(e===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return qe(-1)}decodeValue(e,t){return this.checkType(t),null}get name(){return"null"}},Mr=class extends ot{accept(e,t){return e.visitReserved(this,t)}covariant(e){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return qe(-16)}decodeValue(e,t){return t.name!==this.name&&t.decodeValue(e,t),null}get name(){return"reserved"}},fi=class extends ot{accept(e,t){return e.visitText(this,t)}covariant(e){if(typeof e=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){let t=new TextEncoder().encode(e),n=Se(t.byteLength);return xe(n,t)}encodeType(){return qe(-15)}decodeValue(e,t){this.checkType(t);let n=ke(e),i=rr(e,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(i)}get name(){return"text"}valueToString(e){return'"'+e+'"'}},li=class extends ot{accept(e,t){return e.visitInt(this,t)}covariant(e){if(typeof e=="bigint"||Number.isInteger(e))return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){return qe(e)}encodeType(){return qe(-4)}decodeValue(e,t){return this.checkType(t),Vt(e)}get name(){return"int"}valueToString(e){return e.toString()}},hi=class extends ot{accept(e,t){return e.visitNat(this,t)}covariant(e){if(typeof e=="bigint"&&e>=BigInt(0)||Number.isInteger(e)&&e>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){return Se(e)}encodeType(){return qe(-3)}decodeValue(e,t){return this.checkType(t),ke(e)}get name(){return"nat"}valueToString(e){return e.toString()}},un=class extends ot{constructor(e){if(super(),this._bits=e,e!==32&&e!==64)throw new Error("not a valid float type")}accept(e,t){return e.visitFloat(this,t)}covariant(e){if(typeof e=="number"||e instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){let t=new ArrayBuffer(this._bits/8),n=new DataView(t);return this._bits===32?n.setFloat32(0,e,!0):n.setFloat64(0,e,!0),t}encodeType(){let e=this._bits===32?-13:-14;return qe(e)}decodeValue(e,t){this.checkType(t);let n=rr(e,this._bits/8),i=new DataView(n);return this._bits===32?i.getFloat32(0,!0):i.getFloat64(0,!0)}get name(){return"float"+this._bits}valueToString(e){return e.toString()}},jt=class extends ot{constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedInt(this,t)}covariant(e){let t=ni(this._bits-1)*BigInt(-1),n=ni(this._bits-1)-BigInt(1),i=!1;if(typeof e=="bigint")i=e>=t&&e<=n;else if(Number.isInteger(e)){let s=BigInt(e);i=s>=t&&s<=n}else i=!1;if(i)return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){return zs(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return qe(-9-e)}decodeValue(e,t){this.checkType(t);let n=Wa(e,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(e){return e.toString()}},Lt=class extends ot{constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedNat(this,t)}covariant(e){let t=ni(this._bits),n=!1;if(typeof e=="bigint"&&e>=BigInt(0)?n=e<t:Number.isInteger(e)&&e>=0?n=BigInt(e)<t:n=!1,n)return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){return Za(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return qe(-5-e)}decodeValue(e,t){this.checkType(t);let n=Zs(e,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(e){return e.toString()}},di=class r extends Mt{constructor(e){super(),this._type=e,this._blobOptimization=!1,e instanceof Lt&&e._bits===8&&(this._blobOptimization=!0)}accept(e,t){return e.visitVec(this,this._type,t)}covariant(e){let t=this._type instanceof Lt?this._type._bits:this._type instanceof jt?this._type._bits:0;if(ArrayBuffer.isView(e)&&t==e.BYTES_PER_ELEMENT*8||Array.isArray(e)&&e.every((n,i)=>{try{return this._type.covariant(n)}catch(s){throw new Error(`Invalid ${this.display()} argument:
|
|
2
|
-
|
|
3
|
-
index ${i} -> ${s.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){let t=Se(e.length);if(this._blobOptimization)return xe(t,new Uint8Array(e));if(ArrayBuffer.isView(e))return xe(t,new Uint8Array(e.buffer));let n=new Et(new ArrayBuffer(t.byteLength+e.length),0);n.write(t);for(let i of e){let s=this._type.encodeValue(i);n.write(new Uint8Array(s))}return n.buffer}_buildTypeTableImpl(e){this._type.buildTypeTable(e);let t=qe(-19),n=this._type.encodeType(e);e.add(this,xe(t,n))}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("Not a vector type");let i=Number(ke(e));if(this._type instanceof Lt){if(this._type._bits==8)return new Uint8Array(e.read(i));if(this._type._bits==16)return new Uint16Array(e.read(i*2));if(this._type._bits==32)return new Uint32Array(e.read(i*4));if(this._type._bits==64)return new BigUint64Array(e.read(i*8))}if(this._type instanceof jt){if(this._type._bits==8)return new Int8Array(e.read(i));if(this._type._bits==16)return new Int16Array(e.read(i*2));if(this._type._bits==32)return new Int32Array(e.read(i*4));if(this._type._bits==64)return new BigInt64Array(e.read(i*8))}let s=[];for(let o=0;o<i;o++)s.push(this._type.decodeValue(e,n._type));return s}get name(){return`vec ${this._type.name}`}display(){return`vec ${this._type.display()}`}valueToString(e){return"vec {"+e.map(n=>this._type.valueToString(n)).join("; ")+"}"}},Dr=class r extends Mt{constructor(e){super(),this._type=e}accept(e,t){return e.visitOpt(this,this._type,t)}covariant(e){try{if(Array.isArray(e)&&(e.length===0||e.length===1&&this._type.covariant(e[0])))return!0}catch(t){throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}
|
|
4
|
-
|
|
5
|
-
-> ${t.message}`)}throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){return e.length===0?new Uint8Array([0]):xe(new Uint8Array([1]),this._type.encodeValue(e[0]))}_buildTypeTableImpl(e){this._type.buildTypeTable(e);let t=qe(-18),n=this._type.encodeType(e);e.add(this,xe(t,n))}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("Not an option type");switch(tr(e)){case 0:return[];case 1:return[this._type.decodeValue(e,n._type)];default:throw new Error("Not an option value")}}get name(){return`opt ${this._type.name}`}display(){return`opt ${this._type.display()}`}valueToString(e){return e.length===0?"null":`opt ${this._type.valueToString(e[0])}`}},fn=class r extends Mt{constructor(e={}){super(),this._fields=Object.entries(e).sort((t,n)=>vt(t[0])-vt(n[0]))}accept(e,t){return e.visitRecord(this,this._fields,t)}tryAsTuple(){let e=[];for(let t=0;t<this._fields.length;t++){let[n,i]=this._fields[t];if(n!==`_${t}_`)return null;e.push(i)}return e}covariant(e){if(typeof e=="object"&&this._fields.every(([t,n])=>{if(!e.hasOwnProperty(t))throw new Error(`Record is missing key "${t}".`);try{return n.covariant(e[t])}catch(i){throw new Error(`Invalid ${this.display()} argument:
|
|
6
|
-
|
|
7
|
-
field ${t} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){let t=this._fields.map(([i])=>e[i]),n=cn(this._fields,t,([,i],s)=>i.encodeValue(s));return xe(...n)}_buildTypeTableImpl(e){this._fields.forEach(([s,o])=>o.buildTypeTable(e));let t=qe(-20),n=Se(this._fields.length),i=this._fields.map(([s,o])=>xe(Se(vt(s)),o.encodeType(e)));e.add(this,xe(t,n,xe(...i)))}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("Not a record type");let i={},s=0,o=0;for(;o<n._fields.length;){let[c,a]=n._fields[o];if(s>=this._fields.length){a.decodeValue(e,a),o++;continue}let[p,m]=this._fields[s],g=vt(this._fields[s][0]),y=vt(c);if(g===y)i[p]=m.decodeValue(e,a),s++,o++;else if(y>g)if(m instanceof Dr||m instanceof Mr)i[p]=[],s++;else throw new Error("Cannot find required field "+p);else a.decodeValue(e,a),o++}for(let[c,a]of this._fields.slice(s))if(a instanceof Dr||a instanceof Mr)i[c]=[];else throw new Error("Cannot find required field "+c);return i}get name(){return`record {${this._fields.map(([t,n])=>t+":"+n.name).join("; ")}}`}display(){return`record {${this._fields.map(([t,n])=>t+":"+n.display()).join("; ")}}`}valueToString(e){let t=this._fields.map(([i])=>e[i]);return`record {${cn(this._fields,t,([i,s],o)=>i+"="+s.valueToString(o)).join("; ")}}`}},pi=class r extends fn{constructor(e){let t={};e.forEach((n,i)=>t["_"+i+"_"]=n),super(t),this._components=e}accept(e,t){return e.visitTuple(this,this._components,t)}covariant(e){if(Array.isArray(e)&&e.length>=this._fields.length&&this._components.every((t,n)=>{try{return t.covariant(e[n])}catch(i){throw new Error(`Invalid ${this.display()} argument:
|
|
8
|
-
|
|
9
|
-
index ${n} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){let t=cn(this._components,e,(n,i)=>n.encodeValue(i));return xe(...t)}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("not a tuple type");if(n._components.length<this._components.length)throw new Error("tuple mismatch");let i=[];for(let[s,o]of n._components.entries())s>=this._components.length?o.decodeValue(e,o):i.push(this._components[s].decodeValue(e,o));return i}display(){return`record {${this._components.map(t=>t.display()).join("; ")}}`}valueToString(e){return`record {${cn(this._components,e,(n,i)=>n.valueToString(i)).join("; ")}}`}},mi=class r extends Mt{constructor(e={}){super(),this._fields=Object.entries(e).sort((t,n)=>vt(t[0])-vt(n[0]))}accept(e,t){return e.visitVariant(this,this._fields,t)}covariant(e){if(typeof e=="object"&&Object.entries(e).length===1&&this._fields.every(([t,n])=>{try{return!e.hasOwnProperty(t)||n.covariant(e[t])}catch(i){throw new Error(`Invalid ${this.display()} argument:
|
|
10
|
-
|
|
11
|
-
variant ${t} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){for(let t=0;t<this._fields.length;t++){let[n,i]=this._fields[t];if(e.hasOwnProperty(n)){let s=Se(t),o=i.encodeValue(e[n]);return xe(s,o)}}throw Error("Variant has no data: "+e)}_buildTypeTableImpl(e){this._fields.forEach(([,s])=>{s.buildTypeTable(e)});let t=qe(-21),n=Se(this._fields.length),i=this._fields.map(([s,o])=>xe(Se(vt(s)),o.encodeType(e)));e.add(this,xe(t,n,...i))}decodeValue(e,t){let n=this.checkType(t);if(!(n instanceof r))throw new Error("Not a variant type");let i=Number(ke(e));if(i>=n._fields.length)throw Error("Invalid variant index: "+i);let[s,o]=n._fields[i];for(let[c,a]of this._fields)if(vt(s)===vt(c)){let p=a.decodeValue(e,o);return{[c]:p}}throw new Error("Cannot find field hash "+s)}get name(){return`variant {${this._fields.map(([t,n])=>t+":"+n.name).join("; ")}}`}display(){return`variant {${this._fields.map(([t,n])=>t+(n.name==="null"?"":`:${n.display()}`)).join("; ")}}`}valueToString(e){for(let[t,n]of this._fields)if(e.hasOwnProperty(t)){let i=n.valueToString(e[t]);return i==="null"?`variant {${t}}`:`variant {${t}=${i}}`}throw new Error("Variant has no data: "+e)}},nr=class r extends Mt{constructor(){super(...arguments),this._id=r._counter++,this._type=void 0}accept(e,t){if(!this._type)throw Error("Recursive type uninitialized.");return e.visitRec(this,this._type,t)}fill(e){this._type=e}getType(){return this._type}covariant(e){if(this._type&&this._type.covariant(e))return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.encodeValue(e)}_buildTypeTableImpl(e){if(!this._type)throw Error("Recursive type uninitialized.");e.add(this,new Uint8Array([])),this._type.buildTypeTable(e),e.merge(this,this._type.name)}decodeValue(e,t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.decodeValue(e,t)}get name(){return`rec_${this._id}`}display(){if(!this._type)throw Error("Recursive type uninitialized.");return`\u03BC${this.name}.${this._type.name}`}valueToString(e){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.valueToString(e)}};nr._counter=0;function Ks(r){if(tr(r)!==1)throw new Error("Cannot decode principal");let t=Number(ke(r));return me.fromUint8Array(new Uint8Array(rr(r,t)))}var gi=class extends ot{accept(e,t){return e.visitPrincipal(this,t)}covariant(e){if(e&&e._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){let t=e.toUint8Array(),n=Se(t.byteLength);return xe(new Uint8Array([1]),n,t)}encodeType(){return qe(-24)}decodeValue(e,t){return this.checkType(t),Ks(e)}get name(){return"principal"}valueToString(e){return`${this.name} "${e.toText()}"`}},ln=class extends Mt{constructor(e,t,n=[]){super(),this.argTypes=e,this.retTypes=t,this.annotations=n}static argsToString(e,t){if(e.length!==t.length)throw new Error("arity mismatch");return"("+e.map((n,i)=>n.valueToString(t[i])).join(", ")+")"}accept(e,t){return e.visitFunc(this,t)}covariant(e){if(Array.isArray(e)&&e.length===2&&e[0]&&e[0]._isPrincipal&&typeof e[1]=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue([e,t]){let n=e.toUint8Array(),i=Se(n.byteLength),s=xe(new Uint8Array([1]),i,n),o=new TextEncoder().encode(t),c=Se(o.byteLength);return xe(new Uint8Array([1]),s,c,o)}_buildTypeTableImpl(e){this.argTypes.forEach(p=>p.buildTypeTable(e)),this.retTypes.forEach(p=>p.buildTypeTable(e));let t=qe(-22),n=Se(this.argTypes.length),i=xe(...this.argTypes.map(p=>p.encodeType(e))),s=Se(this.retTypes.length),o=xe(...this.retTypes.map(p=>p.encodeType(e))),c=Se(this.annotations.length),a=xe(...this.annotations.map(p=>this.encodeAnnotation(p)));e.add(this,xe(t,n,i,s,o,c,a))}decodeValue(e){if(tr(e)!==1)throw new Error("Cannot decode function reference");let n=Ks(e),i=Number(ke(e)),s=rr(e,i),c=new TextDecoder("utf8",{fatal:!0}).decode(s);return[n,c]}get name(){let e=this.argTypes.map(i=>i.name).join(", "),t=this.retTypes.map(i=>i.name).join(", "),n=" "+this.annotations.join(" ");return`(${e}) -> (${t})${n}`}valueToString([e,t]){return`func "${e.toText()}".${t}`}display(){let e=this.argTypes.map(i=>i.display()).join(", "),t=this.retTypes.map(i=>i.display()).join(", "),n=" "+this.annotations.join(" ");return`(${e}) \u2192 (${t})${n}`}encodeAnnotation(e){if(e==="query")return new Uint8Array([1]);if(e==="oneway")return new Uint8Array([2]);if(e==="composite_query")return new Uint8Array([3]);throw new Error("Illegal function annotation")}},bi=class extends Mt{constructor(e){super(),this._fields=Object.entries(e).sort((t,n)=>t[0]<n[0]?-1:t[0]>n[0]?1:0)}accept(e,t){return e.visitService(this,t)}covariant(e){if(e&&e._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${Ue(e)}`)}encodeValue(e){let t=e.toUint8Array(),n=Se(t.length);return xe(new Uint8Array([1]),n,t)}_buildTypeTableImpl(e){this._fields.forEach(([s,o])=>o.buildTypeTable(e));let t=qe(-23),n=Se(this._fields.length),i=this._fields.map(([s,o])=>{let c=new TextEncoder().encode(s),a=Se(c.length);return xe(a,c,o.encodeType(e))});e.add(this,xe(t,n,...i))}decodeValue(e){return Ks(e)}get name(){return`service {${this._fields.map(([t,n])=>t+":"+n.name).join("; ")}}`}valueToString(e){return`service "${e.toText()}"`}};function Ue(r){let e=JSON.stringify(r,(t,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return e&&e.length>Ka?e.substring(0,Ka-3)+"...":e}function R0(r,e){if(e.length<r.length)throw Error("Wrong number of message arguments");let t=new Ws;r.forEach(a=>a.buildTypeTable(t));let n=new TextEncoder().encode(ii),i=t.encode(),s=Se(e.length),o=xe(...r.map(a=>a.encodeType(t))),c=xe(...cn(r,e,(a,p)=>{try{a.covariant(p)}catch(m){throw new Error(m.message+`
|
|
12
|
-
|
|
13
|
-
`)}return a.encodeValue(p)}));return xe(n,i,s,o,c)}function O0(r,e){let t=new Et(e);if(e.byteLength<ii.length)throw new Error("Message length smaller than magic number");let n=rr(t,ii.length),i=new TextDecoder().decode(n);if(i!==ii)throw new Error("Wrong magic number: "+JSON.stringify(i));function s(_){let f=[],P=Number(ke(_));for(let $=0;$<P;$++){let D=Number(Vt(_));switch(D){case-18:case-19:{let Y=Number(Vt(_));f.push([D,Y]);break}case-20:case-21:{let Y=[],I=Number(ke(_)),G;for(;I--;){let j=Number(ke(_));if(j>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof G=="number"&&G>=j)throw new Error("field id collision or not sorted");G=j;let Z=Number(Vt(_));Y.push([j,Z])}f.push([D,Y]);break}case-22:{let Y=[],I=Number(ke(_));for(;I--;)Y.push(Number(Vt(_)));let G=[],j=Number(ke(_));for(;j--;)G.push(Number(Vt(_)));let Z=[],k=Number(ke(_));for(;k--;)switch(Number(ke(_))){case 1:{Z.push("query");break}case 2:{Z.push("oneway");break}case 3:{Z.push("composite_query");break}default:throw new Error("unknown annotation")}f.push([D,[Y,G,Z]]);break}case-23:{let Y=Number(ke(_)),I=[];for(;Y--;){let G=Number(ke(_)),j=new TextDecoder().decode(rr(_,G)),Z=Vt(_);I.push([j,Z])}f.push([D,I]);break}default:throw new Error("Illegal op_code: "+D)}}let T=[],F=Number(ke(_));for(let $=0;$<F;$++)T.push(Number(Vt(_)));return[f,T]}let[o,c]=s(t);if(c.length<r.length)throw new Error("Wrong number of return values");let a=o.map(_=>xc());function p(_){if(_<-24)throw new Error("future value not supported");if(_<0)switch(_){case-1:return ec;case-2:return Ja;case-3:return nc;case-4:return rc;case-5:return fc;case-6:return lc;case-7:return hc;case-8:return dc;case-9:return oc;case-10:return ac;case-11:return cc;case-12:return uc;case-13:return ic;case-14:return sc;case-15:return tc;case-16:return Qa;case-17:return Xa;case-24:return pc;default:throw new Error("Illegal op_code: "+_)}if(_>=o.length)throw new Error("type index out of range");return a[_]}function m(_){switch(_[0]){case-19:{let f=p(_[1]);return gc(f)}case-18:{let f=p(_[1]);return bc(f)}case-20:{let f={};for(let[F,$]of _[1]){let D=`_${F}_`;f[D]=p($)}let P=wc(f),T=P.tryAsTuple();return Array.isArray(T)?mc(...T):P}case-21:{let f={};for(let[P,T]of _[1]){let F=`_${P}_`;f[F]=p(T)}return yc(f)}case-22:{let[f,P,T]=_[1];return _c(f.map(F=>p(F)),P.map(F=>p(F)),T)}case-23:{let f={},P=_[1];for(let[T,F]of P){let $=p(F);if($ instanceof nr&&($=$.getType()),!($ instanceof ln))throw new Error("Illegal service definition: services can only contain functions");f[T]=$}return Ec(f)}default:throw new Error("Illegal op_code: "+_[0])}}o.forEach((_,f)=>{if(_[0]===-22){let P=m(_);a[f].fill(P)}}),o.forEach((_,f)=>{if(_[0]!==-22){let P=m(_);a[f].fill(P)}});let g=c.map(_=>p(_)),y=r.map((_,f)=>_.decodeValue(t,g[f]));for(let _=r.length;_<g.length;_++)g[_].decodeValue(t,g[_]);if(t.byteLength>0)throw new Error("decode: Left-over bytes");return y}var Xa=new oi,Qa=new Mr,U0=new ai,Ja=new ci,ec=new ui,tc=new fi,rc=new li,nc=new hi,ic=new un(32),sc=new un(64),oc=new jt(8),ac=new jt(16),cc=new jt(32),uc=new jt(64),fc=new Lt(8),lc=new Lt(16),hc=new Lt(32),dc=new Lt(64),pc=new gi;function mc(...r){return new pi(r)}function gc(r){return new di(r)}function bc(r){return new Dr(r)}function wc(r){return new fn(r)}function yc(r){return new mi(r)}function xc(){return new nr}function _c(r,e,t=[]){return new ln(r,e,t)}function Ec(r){return new bi(r)}var vc=Xr(Ps());function bt(r){return en(Jr.create().update(new Uint8Array(r)).digest())}function wi(r){if(r instanceof vc.default.Tagged)return wi(r.value);if(typeof r=="string")return Ic(r);if(typeof r=="number")return bt(Se(r));if(r instanceof ArrayBuffer||ArrayBuffer.isView(r))return bt(r);if(Array.isArray(r)){let e=r.map(wi);return bt(Ke(...e))}else{if(r&&typeof r=="object"&&r._isPrincipal)return bt(r.toUint8Array());if(typeof r=="object"&&r!==null&&typeof r.toHash=="function")return wi(r.toHash());if(typeof r=="object")return dn(r);if(typeof r=="bigint")return bt(Se(r))}throw Object.assign(new Error(`Attempt to hash a value of unsupported type: ${r}`),{value:r})}var Ic=r=>{let e=new TextEncoder().encode(r);return bt(e)};function hn(r){return dn(r)}function dn(r){let n=Object.entries(r).filter(([,o])=>o!==void 0).map(([o,c])=>{let a=Ic(o),p=wi(c);return[a,p]}).sort(([o],[c])=>fs(o,c)),i=Ke(...n.map(o=>Ke(...o)));return bt(i)}var Ei={};is(Ei,{aInRange:()=>Bt,abool:()=>ir,abytes:()=>It,bitGet:()=>no,bitLen:()=>zt,bitMask:()=>or,bitSet:()=>k0,bytesToHex:()=>At,bytesToNumberBE:()=>Xe,bytesToNumberLE:()=>sr,concatBytes:()=>Ie,createHmacDrbg:()=>Sc,ensureBytes:()=>Ce,equalBytes:()=>D0,hexToBytes:()=>pn,hexToNumber:()=>ro,inRange:()=>xi,isBytes:()=>kr,memoized:()=>Zt,notImplemented:()=>_i,numberToBytesBE:()=>Fe,numberToBytesLE:()=>Ir,numberToHexUnpadded:()=>to,numberToVarBytesBE:()=>M0,utf8ToBytes:()=>mn,validateObject:()=>St});var eo=BigInt(0),yi=BigInt(1),P0=BigInt(2);function kr(r){return r instanceof Uint8Array||r!=null&&typeof r=="object"&&r.constructor.name==="Uint8Array"}function It(r){if(!kr(r))throw new Error("Uint8Array expected")}function ir(r,e){if(typeof e!="boolean")throw new Error(`${r} must be valid boolean, got "${e}".`)}var L0=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function At(r){It(r);let e="";for(let t=0;t<r.length;t++)e+=L0[r[t]];return e}function to(r){let e=r.toString(16);return e.length&1?`0${e}`:e}function ro(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}var Yt={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Ac(r){if(r>=Yt._0&&r<=Yt._9)return r-Yt._0;if(r>=Yt._A&&r<=Yt._F)return r-(Yt._A-10);if(r>=Yt._a&&r<=Yt._f)return r-(Yt._a-10)}function pn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let e=r.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(t);for(let i=0,s=0;i<t;i++,s+=2){let o=Ac(r.charCodeAt(s)),c=Ac(r.charCodeAt(s+1));if(o===void 0||c===void 0){let a=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+a+'" at index '+s)}n[i]=o*16+c}return n}function Xe(r){return ro(At(r))}function sr(r){return It(r),ro(At(Uint8Array.from(r).reverse()))}function Fe(r,e){return pn(r.toString(16).padStart(e*2,"0"))}function Ir(r,e){return Fe(r,e).reverse()}function M0(r){return pn(to(r))}function Ce(r,e,t){let n;if(typeof e=="string")try{n=pn(e)}catch(s){throw new Error(`${r} must be valid hex string, got "${e}". Cause: ${s}`)}else if(kr(e))n=Uint8Array.from(e);else throw new Error(`${r} must be hex string or Uint8Array`);let i=n.length;if(typeof t=="number"&&i!==t)throw new Error(`${r} expected ${t} bytes, got ${i}`);return n}function Ie(...r){let e=0;for(let n=0;n<r.length;n++){let i=r[n];It(i),e+=i.length}let t=new Uint8Array(e);for(let n=0,i=0;n<r.length;n++){let s=r[n];t.set(s,i),i+=s.length}return t}function D0(r,e){if(r.length!==e.length)return!1;let t=0;for(let n=0;n<r.length;n++)t|=r[n]^e[n];return t===0}function mn(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}var Qs=r=>typeof r=="bigint"&&eo<=r;function xi(r,e,t){return Qs(r)&&Qs(e)&&Qs(t)&&e<=r&&r<t}function Bt(r,e,t,n){if(!xi(e,t,n))throw new Error(`expected valid ${r}: ${t} <= n < ${n}, got ${typeof e} ${e}`)}function zt(r){let e;for(e=0;r>eo;r>>=yi,e+=1);return e}function no(r,e){return r>>BigInt(e)&yi}function k0(r,e,t){return r|(t?yi:eo)<<BigInt(e)}var or=r=>(P0<<BigInt(r-1))-yi,Js=r=>new Uint8Array(r),Bc=r=>Uint8Array.from(r);function Sc(r,e,t){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let n=Js(r),i=Js(r),s=0,o=()=>{n.fill(1),i.fill(0),s=0},c=(...g)=>t(i,n,...g),a=(g=Js())=>{i=c(Bc([0]),g),n=c(),g.length!==0&&(i=c(Bc([1]),g),n=c())},p=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let g=0,y=[];for(;g<e;){n=c();let _=n.slice();y.push(_),g+=n.length}return Ie(...y)};return(g,y)=>{o(),a(g);let _;for(;!(_=y(p()));)a();return o(),_}}var q0={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||kr(r),isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function St(r,e,t={}){let n=(i,s,o)=>{let c=q0[s];if(typeof c!="function")throw new Error(`Invalid validator "${s}", expected function`);let a=r[i];if(!(o&&a===void 0)&&!c(a,r))throw new Error(`Invalid param ${String(i)}=${a} (${typeof a}), expected ${s}`)};for(let[i,s]of Object.entries(e))n(i,s,!1);for(let[i,s]of Object.entries(t))n(i,s,!0);return r}var _i=()=>{throw new Error("not implemented")};function Zt(r){let e=new WeakMap;return(t,...n)=>{let i=e.get(t);if(i!==void 0)return i;let s=r(t,...n);return e.set(t,s),s}}var He=BigInt(0),Te=BigInt(1),ar=BigInt(2),C0=BigInt(3),io=BigInt(4),Tc=BigInt(5),Nc=BigInt(8),$0=BigInt(9),G0=BigInt(16);function Be(r,e){let t=r%e;return t>=He?t:e+t}function H0(r,e,t){if(t<=He||e<He)throw new Error("Expected power/modulo > 0");if(t===Te)return He;let n=Te;for(;e>He;)e&Te&&(n=n*r%t),r=r*r%t,e>>=Te;return n}function Tt(r,e,t){let n=r;for(;e-- >He;)n*=n,n%=t;return n}function so(r,e){if(r===He||e<=He)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=Be(r,e),n=e,i=He,s=Te,o=Te,c=He;for(;t!==He;){let p=n/t,m=n%t,g=i-o*p,y=s-c*p;n=t,t=m,i=o,s=c,o=g,c=y}if(n!==Te)throw new Error("invert: does not exist");return Be(i,e)}function V0(r){let e=(r-Te)/ar,t,n,i;for(t=r-Te,n=0;t%ar===He;t/=ar,n++);for(i=ar;i<r&&H0(i,e,r)!==r-Te;i++);if(n===1){let o=(r+Te)/io;return function(a,p){let m=a.pow(p,o);if(!a.eql(a.sqr(m),p))throw new Error("Cannot find square root");return m}}let s=(t+Te)/ar;return function(c,a){if(c.pow(a,e)===c.neg(c.ONE))throw new Error("Cannot find square root");let p=n,m=c.pow(c.mul(c.ONE,i),t),g=c.pow(a,s),y=c.pow(a,t);for(;!c.eql(y,c.ONE);){if(c.eql(y,c.ZERO))return c.ZERO;let _=1;for(let P=c.sqr(y);_<p&&!c.eql(P,c.ONE);_++)P=c.sqr(P);let f=c.pow(m,Te<<BigInt(p-_-1));m=c.sqr(f),g=c.mul(g,f),y=c.mul(y,m),p=_}return g}}function j0(r){if(r%io===C0){let e=(r+Te)/io;return function(n,i){let s=n.pow(i,e);if(!n.eql(n.sqr(s),i))throw new Error("Cannot find square root");return s}}if(r%Nc===Tc){let e=(r-Tc)/Nc;return function(n,i){let s=n.mul(i,ar),o=n.pow(s,e),c=n.mul(i,o),a=n.mul(n.mul(c,ar),o),p=n.mul(c,n.sub(a,n.ONE));if(!n.eql(n.sqr(p),i))throw new Error("Cannot find square root");return p}}return r%G0,V0(r)}var Rc=(r,e)=>(Be(r,e)&Te)===Te,Y0=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function vi(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=Y0.reduce((n,i)=>(n[i]="function",n),e);return St(r,t)}function gn(r,e,t){if(t<He)throw new Error("Expected power > 0");if(t===He)return r.ONE;if(t===Te)return e;let n=r.ONE,i=e;for(;t>He;)t&Te&&(n=r.mul(n,i)),i=r.sqr(i),t>>=Te;return n}function bn(r,e){let t=new Array(e.length),n=e.reduce((s,o,c)=>r.is0(o)?s:(t[c]=s,r.mul(s,o)),r.ONE),i=r.inv(n);return e.reduceRight((s,o,c)=>r.is0(o)?s:(t[c]=r.mul(s,t[c]),r.mul(s,o)),i),t}function Oc(r){let e=(r-Te)/ar;return(t,n)=>t.pow(n,e)}function oo(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Dt(r,e,t=!1,n={}){if(r<=He)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:i,nByteLength:s}=oo(r,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let o=j0(r),c=Object.freeze({ORDER:r,BITS:i,BYTES:s,MASK:or(i),ZERO:He,ONE:Te,create:a=>Be(a,r),isValid:a=>{if(typeof a!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof a}`);return He<=a&&a<r},is0:a=>a===He,isOdd:a=>(a&Te)===Te,neg:a=>Be(-a,r),eql:(a,p)=>a===p,sqr:a=>Be(a*a,r),add:(a,p)=>Be(a+p,r),sub:(a,p)=>Be(a-p,r),mul:(a,p)=>Be(a*p,r),pow:(a,p)=>gn(c,a,p),div:(a,p)=>Be(a*so(p,r),r),sqrN:a=>a*a,addN:(a,p)=>a+p,subN:(a,p)=>a-p,mulN:(a,p)=>a*p,inv:a=>so(a,r),sqrt:n.sqrt||(a=>o(c,a)),invertBatch:a=>bn(c,a),cmov:(a,p,m)=>m?p:a,toBytes:a=>t?Ir(a,s):Fe(a,s),fromBytes:a=>{if(a.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${a.length}`);return t?sr(a):Xe(a)}});return Object.freeze(c)}function Uc(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let e=r.toString(2).length;return Math.ceil(e/8)}function Ii(r){let e=Uc(r);return e+Math.ceil(e/2)}function ao(r,e,t=!1){let n=r.length,i=Uc(e),s=Ii(e);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let o=t?Xe(r):sr(r),c=Be(o,e-Te)+Te;return t?Ir(c,i):Fe(c,i)}var z0=Xe;function cr(r,e){if(wn(r),wn(e),r<0||r>=1<<8*e)throw new Error(`bad I2OSP call: value=${r} length=${e}`);let t=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)t[n]=r&255,r>>>=8;return new Uint8Array(t)}function Z0(r,e){let t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r[n]^e[n];return t}function wn(r){if(!Number.isSafeInteger(r))throw new Error("number expected")}function W0(r,e,t,n){It(r),It(e),wn(t),e.length>255&&(e=n(Ie(mn("H2C-OVERSIZE-DST-"),e)));let{outputLen:i,blockLen:s}=n,o=Math.ceil(t/i);if(t>65535||o>255)throw new Error("expand_message_xmd: invalid lenInBytes");let c=Ie(e,cr(e.length,1)),a=cr(0,s),p=cr(t,2),m=new Array(o),g=n(Ie(a,r,p,cr(0,1),c));m[0]=n(Ie(g,cr(1,1),c));for(let _=1;_<=o;_++){let f=[Z0(g,m[_-1]),cr(_+1,1),c];m[_]=n(Ie(...f))}return Ie(...m).slice(0,t)}function K0(r,e,t,n,i){if(It(r),It(e),wn(t),e.length>255){let s=Math.ceil(2*n/8);e=i.create({dkLen:s}).update(mn("H2C-OVERSIZE-DST-")).update(e).digest()}if(t>65535||e.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:t}).update(r).update(cr(t,2)).update(e).update(cr(e.length,1)).digest()}function Fc(r,e,t){St(t,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:n,k:i,m:s,hash:o,expand:c,DST:a}=t;It(r),wn(e);let p=typeof a=="string"?mn(a):a,m=n.toString(2).length,g=Math.ceil((m+i)/8),y=e*s*g,_;if(c==="xmd")_=W0(r,p,y,o);else if(c==="xof")_=K0(r,p,y,i,o);else if(c==="_internal_pass")_=r;else throw new Error('expand must be "xmd" or "xof"');let f=new Array(e);for(let P=0;P<e;P++){let T=new Array(s);for(let F=0;F<s;F++){let $=g*(F+P*s),D=_.subarray($,$+g);T[F]=Be(z0(D),n)}f[P]=T}return f}function uo(r,e){let t=e.map(n=>Array.from(n).reverse());return(n,i)=>{let[s,o,c,a]=t.map(p=>p.reduce((m,g)=>r.add(r.mul(m,n),g)));return n=r.div(s,o),i=r.mul(i,r.div(c,a)),{x:n,y:i}}}function fo(r,e,t){if(typeof e!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(n,i){let s=Fc(n,2,{...t,DST:t.DST,...i}),o=r.fromAffine(e(s[0])),c=r.fromAffine(e(s[1])),a=o.add(c).clearCofactor();return a.assertValidity(),a},encodeToCurve(n,i){let s=Fc(n,1,{...t,DST:t.encodeDST,...i}),o=r.fromAffine(e(s[0])).clearCofactor();return o.assertValidity(),o},mapToCurve(n){if(!Array.isArray(n))throw new Error("mapToCurve: expected array of bigints");for(let s of n)if(typeof s!="bigint")throw new Error(`mapToCurve: expected array of bigints, got ${s} in array`);let i=r.fromAffine(e(n)).clearCofactor();return i.assertValidity(),i}}}var X0=BigInt(0),lo=BigInt(1),ho=new WeakMap,Pc=new WeakMap;function Ai(r,e){let t=(s,o)=>{let c=o.negate();return s?c:o},n=s=>{if(!Number.isSafeInteger(s)||s<=0||s>e)throw new Error(`Wrong window size=${s}, should be [1..${e}]`)},i=s=>{n(s);let o=Math.ceil(e/s)+1,c=2**(s-1);return{windows:o,windowSize:c}};return{constTimeNegate:t,unsafeLadder(s,o){let c=r.ZERO,a=s;for(;o>X0;)o&lo&&(c=c.add(a)),a=a.double(),o>>=lo;return c},precomputeWindow(s,o){let{windows:c,windowSize:a}=i(o),p=[],m=s,g=m;for(let y=0;y<c;y++){g=m,p.push(g);for(let _=1;_<a;_++)g=g.add(m),p.push(g);m=g.double()}return p},wNAF(s,o,c){let{windows:a,windowSize:p}=i(s),m=r.ZERO,g=r.BASE,y=BigInt(2**s-1),_=2**s,f=BigInt(s);for(let P=0;P<a;P++){let T=P*p,F=Number(c&y);c>>=f,F>p&&(F-=_,c+=lo);let $=T,D=T+Math.abs(F)-1,Y=P%2!==0,I=F<0;F===0?g=g.add(t(Y,o[$])):m=m.add(t(I,o[D]))}return{p:m,f:g}},wNAFCached(s,o,c){let a=Pc.get(s)||1,p=ho.get(s);return p||(p=this.precomputeWindow(s,a),a!==1&&ho.set(s,c(p))),this.wNAF(a,p,o)},setWindowSize(s,o){n(o),Pc.set(s,o),ho.delete(s)}}}function Bi(r,e,t,n){if(!Array.isArray(t)||!Array.isArray(n)||n.length!==t.length)throw new Error("arrays of points and scalars must have equal length");n.forEach((m,g)=>{if(!e.isValid(m))throw new Error(`wrong scalar at index ${g}`)}),t.forEach((m,g)=>{if(!(m instanceof r))throw new Error(`wrong point at index ${g}`)});let i=zt(BigInt(t.length)),s=i>12?i-3:i>4?i-2:i?2:1,o=(1<<s)-1,c=new Array(o+1).fill(r.ZERO),a=Math.floor((e.BITS-1)/s)*s,p=r.ZERO;for(let m=a;m>=0;m-=s){c.fill(r.ZERO);for(let y=0;y<n.length;y++){let _=n[y],f=Number(_>>BigInt(m)&BigInt(o));c[f]=c[f].add(t[y])}let g=r.ZERO;for(let y=c.length-1,_=r.ZERO;y>0;y--)_=_.add(c[y]),g=g.add(_);if(p=p.add(g),m!==0)for(let y=0;y<s;y++)p=p.double()}return p}function Si(r){return vi(r.Fp),St(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...oo(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function Q0(r){let e=Si(r);St(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:t,Fp:n,a:i}=e;if(t){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}var{bytesToNumberBE:Wd,hexToBytes:Kd}=Ei;var Ar=BigInt(0),Pe=BigInt(1),ur=BigInt(2),Ti=BigInt(3),Lc=BigInt(4);function po(r){let e=Q0(r),{Fp:t}=e,n=Dt(e.n,e.nBitLength),i=e.toBytes||((P,T,F)=>{let $=T.toAffine();return Ie(Uint8Array.from([4]),t.toBytes($.x),t.toBytes($.y))}),s=e.fromBytes||(P=>{let T=P.subarray(1),F=t.fromBytes(T.subarray(0,t.BYTES)),$=t.fromBytes(T.subarray(t.BYTES,2*t.BYTES));return{x:F,y:$}});function o(P){let{a:T,b:F}=e,$=t.sqr(P),D=t.mul($,P);return t.add(t.add(D,t.mul(P,T)),F)}if(!t.eql(t.sqr(e.Gy),o(e.Gx)))throw new Error("bad generator point: equation left != right");function c(P){return xi(P,Pe,e.n)}function a(P){let{allowedPrivateKeyLengths:T,nByteLength:F,wrapPrivateKey:$,n:D}=e;if(T&&typeof P!="bigint"){if(kr(P)&&(P=At(P)),typeof P!="string"||!T.includes(P.length))throw new Error("Invalid key");P=P.padStart(F*2,"0")}let Y;try{Y=typeof P=="bigint"?P:Xe(Ce("private key",P,F))}catch{throw new Error(`private key must be ${F} bytes, hex or bigint, not ${typeof P}`)}return $&&(Y=Be(Y,D)),Bt("private key",Y,Pe,D),Y}function p(P){if(!(P instanceof y))throw new Error("ProjectivePoint expected")}let m=Zt((P,T)=>{let{px:F,py:$,pz:D}=P;if(t.eql(D,t.ONE))return{x:F,y:$};let Y=P.is0();T==null&&(T=Y?t.ONE:t.inv(D));let I=t.mul(F,T),G=t.mul($,T),j=t.mul(D,T);if(Y)return{x:t.ZERO,y:t.ZERO};if(!t.eql(j,t.ONE))throw new Error("invZ was invalid");return{x:I,y:G}}),g=Zt(P=>{if(P.is0()){if(e.allowInfinityPoint&&!t.is0(P.py))return;throw new Error("bad point: ZERO")}let{x:T,y:F}=P.toAffine();if(!t.isValid(T)||!t.isValid(F))throw new Error("bad point: x or y not FE");let $=t.sqr(F),D=o(T);if(!t.eql($,D))throw new Error("bad point: equation left != right");if(!P.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class y{constructor(T,F,$){if(this.px=T,this.py=F,this.pz=$,T==null||!t.isValid(T))throw new Error("x required");if(F==null||!t.isValid(F))throw new Error("y required");if($==null||!t.isValid($))throw new Error("z required");Object.freeze(this)}static fromAffine(T){let{x:F,y:$}=T||{};if(!T||!t.isValid(F)||!t.isValid($))throw new Error("invalid affine point");if(T instanceof y)throw new Error("projective point not allowed");let D=Y=>t.eql(Y,t.ZERO);return D(F)&&D($)?y.ZERO:new y(F,$,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(T){let F=t.invertBatch(T.map($=>$.pz));return T.map(($,D)=>$.toAffine(F[D])).map(y.fromAffine)}static fromHex(T){let F=y.fromAffine(s(Ce("pointHex",T)));return F.assertValidity(),F}static fromPrivateKey(T){return y.BASE.multiply(a(T))}static msm(T,F){return Bi(y,n,T,F)}_setWindowSize(T){f.setWindowSize(this,T)}assertValidity(){g(this)}hasEvenY(){let{y:T}=this.toAffine();if(t.isOdd)return!t.isOdd(T);throw new Error("Field doesn't support isOdd")}equals(T){p(T);let{px:F,py:$,pz:D}=this,{px:Y,py:I,pz:G}=T,j=t.eql(t.mul(F,G),t.mul(Y,D)),Z=t.eql(t.mul($,G),t.mul(I,D));return j&&Z}negate(){return new y(this.px,t.neg(this.py),this.pz)}double(){let{a:T,b:F}=e,$=t.mul(F,Ti),{px:D,py:Y,pz:I}=this,G=t.ZERO,j=t.ZERO,Z=t.ZERO,k=t.mul(D,D),fe=t.mul(Y,Y),re=t.mul(I,I),te=t.mul(D,Y);return te=t.add(te,te),Z=t.mul(D,I),Z=t.add(Z,Z),G=t.mul(T,Z),j=t.mul($,re),j=t.add(G,j),G=t.sub(fe,j),j=t.add(fe,j),j=t.mul(G,j),G=t.mul(te,G),Z=t.mul($,Z),re=t.mul(T,re),te=t.sub(k,re),te=t.mul(T,te),te=t.add(te,Z),Z=t.add(k,k),k=t.add(Z,k),k=t.add(k,re),k=t.mul(k,te),j=t.add(j,k),re=t.mul(Y,I),re=t.add(re,re),k=t.mul(re,te),G=t.sub(G,k),Z=t.mul(re,fe),Z=t.add(Z,Z),Z=t.add(Z,Z),new y(G,j,Z)}add(T){p(T);let{px:F,py:$,pz:D}=this,{px:Y,py:I,pz:G}=T,j=t.ZERO,Z=t.ZERO,k=t.ZERO,fe=e.a,re=t.mul(e.b,Ti),te=t.mul(F,Y),b=t.mul($,I),v=t.mul(D,G),q=t.add(F,$),O=t.add(Y,I);q=t.mul(q,O),O=t.add(te,b),q=t.sub(q,O),O=t.add(F,D);let U=t.add(Y,G);return O=t.mul(O,U),U=t.add(te,v),O=t.sub(O,U),U=t.add($,D),j=t.add(I,G),U=t.mul(U,j),j=t.add(b,v),U=t.sub(U,j),k=t.mul(fe,O),j=t.mul(re,v),k=t.add(j,k),j=t.sub(b,k),k=t.add(b,k),Z=t.mul(j,k),b=t.add(te,te),b=t.add(b,te),v=t.mul(fe,v),O=t.mul(re,O),b=t.add(b,v),v=t.sub(te,v),v=t.mul(fe,v),O=t.add(O,v),te=t.mul(b,O),Z=t.add(Z,te),te=t.mul(U,O),j=t.mul(q,j),j=t.sub(j,te),te=t.mul(q,b),k=t.mul(U,k),k=t.add(k,te),new y(j,Z,k)}subtract(T){return this.add(T.negate())}is0(){return this.equals(y.ZERO)}wNAF(T){return f.wNAFCached(this,T,y.normalizeZ)}multiplyUnsafe(T){Bt("scalar",T,Ar,e.n);let F=y.ZERO;if(T===Ar)return F;if(T===Pe)return this;let{endo:$}=e;if(!$)return f.unsafeLadder(this,T);let{k1neg:D,k1:Y,k2neg:I,k2:G}=$.splitScalar(T),j=F,Z=F,k=this;for(;Y>Ar||G>Ar;)Y&Pe&&(j=j.add(k)),G&Pe&&(Z=Z.add(k)),k=k.double(),Y>>=Pe,G>>=Pe;return D&&(j=j.negate()),I&&(Z=Z.negate()),Z=new y(t.mul(Z.px,$.beta),Z.py,Z.pz),j.add(Z)}multiply(T){let{endo:F,n:$}=e;Bt("scalar",T,Pe,$);let D,Y;if(F){let{k1neg:I,k1:G,k2neg:j,k2:Z}=F.splitScalar(T),{p:k,f:fe}=this.wNAF(G),{p:re,f:te}=this.wNAF(Z);k=f.constTimeNegate(I,k),re=f.constTimeNegate(j,re),re=new y(t.mul(re.px,F.beta),re.py,re.pz),D=k.add(re),Y=fe.add(te)}else{let{p:I,f:G}=this.wNAF(T);D=I,Y=G}return y.normalizeZ([D,Y])[0]}multiplyAndAddUnsafe(T,F,$){let D=y.BASE,Y=(G,j)=>j===Ar||j===Pe||!G.equals(D)?G.multiplyUnsafe(j):G.multiply(j),I=Y(this,F).add(Y(T,$));return I.is0()?void 0:I}toAffine(T){return m(this,T)}isTorsionFree(){let{h:T,isTorsionFree:F}=e;if(T===Pe)return!0;if(F)return F(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:T,clearCofactor:F}=e;return T===Pe?this:F?F(y,this):this.multiplyUnsafe(e.h)}toRawBytes(T=!0){return ir("isCompressed",T),this.assertValidity(),i(y,this,T)}toHex(T=!0){return ir("isCompressed",T),At(this.toRawBytes(T))}}y.BASE=new y(e.Gx,e.Gy,t.ONE),y.ZERO=new y(t.ZERO,t.ONE,t.ZERO);let _=e.nBitLength,f=Ai(y,e.endo?Math.ceil(_/2):_);return{CURVE:e,ProjectivePoint:y,normPrivateKeyToScalar:a,weierstrassEquation:o,isWithinCurveOrder:c}}function J0(r,e){let t=r.ORDER,n=Ar;for(let f=t-Pe;f%ur===Ar;f/=ur)n+=Pe;let i=n,s=ur<<i-Pe-Pe,o=s*ur,c=(t-Pe)/o,a=(c-Pe)/ur,p=o-Pe,m=s,g=r.pow(e,c),y=r.pow(e,(c+Pe)/ur),_=(f,P)=>{let T=g,F=r.pow(P,p),$=r.sqr(F);$=r.mul($,P);let D=r.mul(f,$);D=r.pow(D,a),D=r.mul(D,F),F=r.mul(D,P),$=r.mul(D,f);let Y=r.mul($,F);D=r.pow(Y,m);let I=r.eql(D,r.ONE);F=r.mul($,y),D=r.mul(Y,T),$=r.cmov(F,$,I),Y=r.cmov(D,Y,I);for(let G=i;G>Pe;G--){let j=G-ur;j=ur<<j-Pe;let Z=r.pow(Y,j),k=r.eql(Z,r.ONE);F=r.mul($,T),T=r.mul(T,T),Z=r.mul(Y,T),$=r.cmov(F,$,k),Y=r.cmov(Z,Y,k)}return{isValid:I,value:$}};if(r.ORDER%Lc===Ti){let f=(r.ORDER-Ti)/Lc,P=r.sqrt(r.neg(e));_=(T,F)=>{let $=r.sqr(F),D=r.mul(T,F);$=r.mul($,D);let Y=r.pow($,f);Y=r.mul(Y,D);let I=r.mul(Y,P),G=r.mul(r.sqr(Y),F),j=r.eql(G,T),Z=r.cmov(I,Y,j);return{isValid:j,value:Z}}}return _}function mo(r,e){if(vi(r),!r.isValid(e.A)||!r.isValid(e.B)||!r.isValid(e.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");let t=J0(r,e.Z);if(!r.isOdd)throw new Error("Fp.isOdd is not implemented!");return n=>{let i,s,o,c,a,p,m,g;i=r.sqr(n),i=r.mul(i,e.Z),s=r.sqr(i),s=r.add(s,i),o=r.add(s,r.ONE),o=r.mul(o,e.B),c=r.cmov(e.Z,r.neg(s),!r.eql(s,r.ZERO)),c=r.mul(c,e.A),s=r.sqr(o),p=r.sqr(c),a=r.mul(p,e.A),s=r.add(s,a),s=r.mul(s,o),p=r.mul(p,c),a=r.mul(p,e.B),s=r.add(s,a),m=r.mul(i,o);let{isValid:y,value:_}=t(s,p);g=r.mul(i,n),g=r.mul(g,_),m=r.cmov(m,o,y),g=r.cmov(g,_,y);let f=r.isOdd(n)===r.isOdd(g);return g=r.cmov(r.neg(g),g,f),m=r.div(m,c),{x:m,y:g}}}var el=BigInt(0),Ni=BigInt(1),Mc=BigInt(2),qr=BigInt(3);function tl(r){let e=[];for(;r>Ni;r>>=Ni)(r&Ni)===el?e.unshift(0):(r&qr)===qr?(e.unshift(-1),r+=Ni):e.unshift(1);return e}function Dc(r){let{Fp:e,Fr:t,Fp2:n,Fp6:i,Fp12:s}=r.fields,o=r.params.xNegative,c=r.params.twistType,a=po({n:t.ORDER,...r.G1}),p=Object.assign(a,fo(a.ProjectivePoint,r.G1.mapToCurve,{...r.htfDefaults,...r.G1.htfDefaults})),m=po({n:t.ORDER,...r.G2}),g=Object.assign(m,fo(m.ProjectivePoint,r.G2.mapToCurve,{...r.htfDefaults,...r.G2.htfDefaults})),y;if(c==="multiplicative")y=(V,R,h,Q,J,ae)=>s.mul014(Q,V,n.mul(R,J),n.mul(h,ae));else if(c==="divisive")y=(V,R,h,Q,J,ae)=>s.mul034(Q,n.mul(h,ae),n.mul(R,J),V);else throw new Error("bls: unknown twist type");let _=n.div(n.ONE,n.mul(n.ONE,Mc));function f(V,R,h,Q){let J=n.sqr(h),ae=n.sqr(Q),X=n.mulByB(n.mul(ae,qr)),u=n.mul(X,qr),l=n.sub(n.sub(n.sqr(n.add(h,Q)),ae),J),d=n.sub(X,J),B=n.mul(n.sqr(R),qr),E=n.neg(l);return V.push([d,B,E]),R=n.mul(n.mul(n.mul(n.sub(J,u),R),h),_),h=n.sub(n.sqr(n.mul(n.add(J,u),_)),n.mul(n.sqr(X),qr)),Q=n.mul(J,l),{Rx:R,Ry:h,Rz:Q}}function P(V,R,h,Q,J,ae){let X=n.sub(h,n.mul(ae,Q)),u=n.sub(R,n.mul(J,Q)),l=n.sub(n.mul(X,J),n.mul(u,ae)),d=n.neg(X),B=u;V.push([l,d,B]);let E=n.sqr(u),A=n.mul(E,u),M=n.mul(E,R),w=n.add(n.sub(A,n.mul(M,Mc)),n.mul(n.sqr(X),Q));return R=n.mul(u,w),h=n.sub(n.mul(n.sub(M,w),X),n.mul(A,h)),Q=n.mul(Q,A),{Rx:R,Ry:h,Rz:Q}}let T=tl(r.params.ateLoopSize),F=Zt(V=>{let R=V,{x:h,y:Q}=R.toAffine(),J=h,ae=Q,X=n.neg(Q),u=J,l=ae,d=n.ONE,B=[];for(let E of T){let A=[];({Rx:u,Ry:l,Rz:d}=f(A,u,l,d)),E&&({Rx:u,Ry:l,Rz:d}=P(A,u,l,d,J,E===-1?X:ae)),B.push(A)}if(r.postPrecompute){let E=B[B.length-1];r.postPrecompute(u,l,d,J,ae,P.bind(null,E))}return B});function $(V,R=!1){let h=s.ONE;if(V.length){let Q=V[0][0].length;for(let J=0;J<Q;J++){h=s.sqr(h);for(let[ae,X,u]of V)for(let[l,d,B]of ae[J])h=y(l,d,B,h,X,u)}}return o&&(h=s.conjugate(h)),R?s.finalExponentiate(h):h}function D(V,R=!0){let h=[];p.ProjectivePoint.normalizeZ(V.map(({g1:Q})=>Q)),g.ProjectivePoint.normalizeZ(V.map(({g2:Q})=>Q));for(let{g1:Q,g2:J}of V){if(Q.equals(p.ProjectivePoint.ZERO)||J.equals(g.ProjectivePoint.ZERO))throw new Error("pairing is not available for ZERO point");Q.assertValidity(),J.assertValidity();let ae=Q.toAffine();h.push([F(J),ae.x,ae.y])}return $(h,R)}function Y(V,R,h=!0){return D([{g1:V,g2:R}],h)}let I={randomPrivateKey:()=>{let V=Ii(t.ORDER);return ao(r.randomBytes(V),t.ORDER)},calcPairingPrecomputes:F},{ShortSignature:G}=r.G1,{Signature:j}=r.G2;function Z(V){return V instanceof p.ProjectivePoint?V:p.ProjectivePoint.fromHex(V)}function k(V,R){return V instanceof p.ProjectivePoint?V:p.hashToCurve(Ce("point",V),R)}function fe(V){return V instanceof g.ProjectivePoint?V:j.fromHex(V)}function re(V,R){return V instanceof g.ProjectivePoint?V:g.hashToCurve(Ce("point",V),R)}function te(V){return p.ProjectivePoint.fromPrivateKey(V).toRawBytes(!0)}function b(V){return g.ProjectivePoint.fromPrivateKey(V).toRawBytes(!0)}function v(V,R,h){let Q=re(V,h);Q.assertValidity();let J=Q.multiply(p.normPrivateKeyToScalar(R));return V instanceof g.ProjectivePoint?J:j.toRawBytes(J)}function q(V,R,h){let Q=k(V,h);Q.assertValidity();let J=Q.multiply(p.normPrivateKeyToScalar(R));return V instanceof p.ProjectivePoint?J:G.toRawBytes(J)}function O(V,R,h,Q){let J=Z(h),ae=re(R,Q),X=p.ProjectivePoint.BASE,u=fe(V),l=D([{g1:J.negate(),g2:ae},{g1:X,g2:u}]);return s.eql(l,s.ONE)}function U(V,R,h,Q){let J=fe(h),ae=k(R,Q),X=g.ProjectivePoint.BASE,u=Z(V),l=D([{g1:ae,g2:J},{g1:u,g2:X.negate()}]);return s.eql(l,s.ONE)}function C(V){if(!V.length)throw new Error("Expected non-empty array");let h=V.map(Z).reduce((Q,J)=>Q.add(J),p.ProjectivePoint.ZERO);return V[0]instanceof p.ProjectivePoint?(h.assertValidity(),h):h.toRawBytes(!0)}function W(V){if(!V.length)throw new Error("Expected non-empty array");let h=V.map(fe).reduce((Q,J)=>Q.add(J),g.ProjectivePoint.ZERO);return V[0]instanceof g.ProjectivePoint?(h.assertValidity(),h):j.toRawBytes(h)}function ue(V){if(!V.length)throw new Error("Expected non-empty array");let h=V.map(Z).reduce((Q,J)=>Q.add(J),p.ProjectivePoint.ZERO);return V[0]instanceof p.ProjectivePoint?(h.assertValidity(),h):G.toRawBytes(h)}function ce(V,R,h,Q){if(!R.length)throw new Error("Expected non-empty messages array");if(h.length!==R.length)throw new Error("Pubkey count should equal msg count");let J=fe(V),ae=R.map(d=>re(d,Q)),X=h.map(Z),u=new Map;for(let d=0;d<X.length;d++){let B=X[d],E=ae[d],A=u.get(E);A===void 0&&(A=[],u.set(E,A)),A.push(B)}let l=[];try{for(let[d,B]of u){let E=B.reduce((A,M)=>A.add(M));l.push({g1:E,g2:d})}return l.push({g1:p.ProjectivePoint.BASE.negate(),g2:J}),s.eql(D(l),s.ONE)}catch{return!1}}return p.ProjectivePoint.BASE._setWindowSize(4),{getPublicKey:te,getPublicKeyForShortSignatures:b,sign:v,signShortSignature:q,verify:O,verifyBatch:ce,verifyShortSignature:U,aggregatePublicKeys:C,aggregateSignatures:W,aggregateShortSignatures:ue,millerLoopBatch:$,pairing:Y,pairingBatch:D,G1:p,G2:g,Signature:j,ShortSignature:G,fields:{Fr:t,Fp:e,Fp2:n,Fp6:i,Fp12:s},params:{ateLoopSize:r.params.ateLoopSize,r:r.params.r,G1b:r.G1.b,G2b:r.G2.b},utils:I}}var rl=BigInt(0),Cr=BigInt(1),Wt=BigInt(2),kc=BigInt(3);function go(r,e,t,n,i=1,s){let o=BigInt(s===void 0?n:s),c=t**BigInt(n),a=[];for(let p=0;p<i;p++){let m=BigInt(p+1),g=[];for(let y=0,_=Cr;y<n;y++){let f=(m*_-m)/o%c;g.push(r.pow(e,f)),_*=t}a.push(g)}return a}function qc(r,e,t){let n=e.pow(t,(r.ORDER-Cr)/kc),i=e.pow(t,(r.ORDER-Cr)/Wt);function s(y,_){let f=e.mul(e.frobeniusMap(y,1),n),P=e.mul(e.frobeniusMap(_,1),i);return[f,P]}let o=e.pow(t,(r.ORDER**Wt-Cr)/kc),c=e.pow(t,(r.ORDER**Wt-Cr)/Wt);if(!e.eql(c,e.neg(e.ONE)))throw new Error("psiFrobenius: PSI2_Y!==-1");function a(y,_){return[e.mul(y,o),e.neg(_)]}let p=y=>(_,f)=>{let P=f.toAffine(),T=y(P.x,P.y);return _.fromAffine({x:T[0],y:T[1]})},m=p(s),g=p(a);return{psi:s,psi2:a,G2psi:m,G2psi2:g,PSI_X:n,PSI_Y:i,PSI2_X:o,PSI2_Y:c}}function Cc(r){let{ORDER:e}=r,t=Dt(e),n=t.create(r.NONRESIDUE||BigInt(-1)),i=Oc(e),s=t.div(t.ONE,Wt),o=go(t,n,t.ORDER,2)[0],c=({c0:b,c1:v},{c0:q,c1:O})=>({c0:t.add(b,q),c1:t.add(v,O)}),a=({c0:b,c1:v},{c0:q,c1:O})=>({c0:t.sub(b,q),c1:t.sub(v,O)}),p=({c0:b,c1:v},q)=>{if(typeof q=="bigint")return{c0:t.mul(b,q),c1:t.mul(v,q)};let{c0:O,c1:U}=q,C=t.mul(b,O),W=t.mul(v,U),ue=t.sub(C,W),ce=t.sub(t.mul(t.add(b,v),t.add(O,U)),t.add(C,W));return{c0:ue,c1:ce}},m=({c0:b,c1:v})=>{let q=t.add(b,v),O=t.sub(b,v),U=t.add(b,b);return{c0:t.mul(q,O),c1:t.mul(U,v)}},g=b=>{if(b.length!==2)throw new Error("Invalid tuple");let v=b.map(q=>t.create(q));return{c0:v[0],c1:v[1]}},y=e*e,_=g(r.FP2_NONRESIDUE),f={ORDER:y,NONRESIDUE:_,BITS:zt(y),BYTES:Math.ceil(zt(y)/8),MASK:or(zt(y)),ZERO:{c0:t.ZERO,c1:t.ZERO},ONE:{c0:t.ONE,c1:t.ZERO},create:b=>b,isValid:({c0:b,c1:v})=>typeof b=="bigint"&&typeof v=="bigint",is0:({c0:b,c1:v})=>t.is0(b)&&t.is0(v),eql:({c0:b,c1:v},{c0:q,c1:O})=>t.eql(b,q)&&t.eql(v,O),neg:({c0:b,c1:v})=>({c0:t.neg(b),c1:t.neg(v)}),pow:(b,v)=>gn(f,b,v),invertBatch:b=>bn(f,b),add:c,sub:a,mul:p,sqr:m,addN:c,subN:a,mulN:p,sqrN:m,div:(b,v)=>f.mul(b,typeof v=="bigint"?t.inv(t.create(v)):f.inv(v)),inv:({c0:b,c1:v})=>{let q=t.inv(t.create(b*b+v*v));return{c0:t.mul(q,t.create(b)),c1:t.mul(q,t.create(-v))}},sqrt:b=>{if(r.Fp2sqrt)return r.Fp2sqrt(b);let{c0:v,c1:q}=b;if(t.is0(q))return t.eql(i(t,v),t.ONE)?f.create({c0:t.sqrt(v),c1:t.ZERO}):f.create({c0:t.ZERO,c1:t.sqrt(t.div(v,n))});let O=t.sqrt(t.sub(t.sqr(v),t.mul(t.sqr(q),n))),U=t.mul(t.add(O,v),s),C=i(t,U);!t.is0(C)&&!t.eql(C,t.ONE)&&(U=t.sub(U,O));let W=t.sqrt(U),ue=f.create({c0:W,c1:t.div(t.mul(q,s),W)});if(!f.eql(f.sqr(ue),b))throw new Error("Cannot find square root");let ce=ue,V=f.neg(ce),{re:R,im:h}=f.reim(ce),{re:Q,im:J}=f.reim(V);return h>J||h===J&&R>Q?ce:V},isOdd:b=>{let{re:v,im:q}=f.reim(b),O=v%Wt,U=v===rl,C=q%Wt;return BigInt(O||U&&C)==Cr},fromBytes(b){if(b.length!==f.BYTES)throw new Error(`fromBytes wrong length=${b.length}`);return{c0:t.fromBytes(b.subarray(0,t.BYTES)),c1:t.fromBytes(b.subarray(t.BYTES))}},toBytes:({c0:b,c1:v})=>Ie(t.toBytes(b),t.toBytes(v)),cmov:({c0:b,c1:v},{c0:q,c1:O},U)=>({c0:t.cmov(b,q,U),c1:t.cmov(v,O,U)}),reim:({c0:b,c1:v})=>({re:b,im:v}),mulByNonresidue:({c0:b,c1:v})=>f.mul({c0:b,c1:v},_),mulByB:r.Fp2mulByB,fromBigTuple:g,frobeniusMap:({c0:b,c1:v},q)=>({c0:b,c1:t.mul(v,o[q%2])})},P=({c0:b,c1:v,c2:q},{c0:O,c1:U,c2:C})=>({c0:f.add(b,O),c1:f.add(v,U),c2:f.add(q,C)}),T=({c0:b,c1:v,c2:q},{c0:O,c1:U,c2:C})=>({c0:f.sub(b,O),c1:f.sub(v,U),c2:f.sub(q,C)}),F=({c0:b,c1:v,c2:q},O)=>{if(typeof O=="bigint")return{c0:f.mul(b,O),c1:f.mul(v,O),c2:f.mul(q,O)};let{c0:U,c1:C,c2:W}=O,ue=f.mul(b,U),ce=f.mul(v,C),V=f.mul(q,W);return{c0:f.add(ue,f.mulByNonresidue(f.sub(f.mul(f.add(v,q),f.add(C,W)),f.add(ce,V)))),c1:f.add(f.sub(f.mul(f.add(b,v),f.add(U,C)),f.add(ue,ce)),f.mulByNonresidue(V)),c2:f.sub(f.add(ce,f.mul(f.add(b,q),f.add(U,W))),f.add(ue,V))}},$=({c0:b,c1:v,c2:q})=>{let O=f.sqr(b),U=f.mul(f.mul(b,v),Wt),C=f.mul(f.mul(v,q),Wt),W=f.sqr(q);return{c0:f.add(f.mulByNonresidue(C),O),c1:f.add(f.mulByNonresidue(W),U),c2:f.sub(f.sub(f.add(f.add(U,f.sqr(f.add(f.sub(b,v),q))),C),O),W)}},[D,Y]=go(f,_,t.ORDER,6,2,3),I={ORDER:f.ORDER,BITS:3*f.BITS,BYTES:3*f.BYTES,MASK:or(3*f.BITS),ZERO:{c0:f.ZERO,c1:f.ZERO,c2:f.ZERO},ONE:{c0:f.ONE,c1:f.ZERO,c2:f.ZERO},create:b=>b,isValid:({c0:b,c1:v,c2:q})=>f.isValid(b)&&f.isValid(v)&&f.isValid(q),is0:({c0:b,c1:v,c2:q})=>f.is0(b)&&f.is0(v)&&f.is0(q),neg:({c0:b,c1:v,c2:q})=>({c0:f.neg(b),c1:f.neg(v),c2:f.neg(q)}),eql:({c0:b,c1:v,c2:q},{c0:O,c1:U,c2:C})=>f.eql(b,O)&&f.eql(v,U)&&f.eql(q,C),sqrt:_i,div:(b,v)=>I.mul(b,typeof v=="bigint"?t.inv(t.create(v)):I.inv(v)),pow:(b,v)=>gn(I,b,v),invertBatch:b=>bn(I,b),add:P,sub:T,mul:F,sqr:$,addN:P,subN:T,mulN:F,sqrN:$,inv:({c0:b,c1:v,c2:q})=>{let O=f.sub(f.sqr(b),f.mulByNonresidue(f.mul(q,v))),U=f.sub(f.mulByNonresidue(f.sqr(q)),f.mul(b,v)),C=f.sub(f.sqr(v),f.mul(b,q)),W=f.inv(f.add(f.mulByNonresidue(f.add(f.mul(q,U),f.mul(v,C))),f.mul(b,O)));return{c0:f.mul(W,O),c1:f.mul(W,U),c2:f.mul(W,C)}},fromBytes:b=>{if(b.length!==I.BYTES)throw new Error(`fromBytes wrong length=${b.length}`);return{c0:f.fromBytes(b.subarray(0,f.BYTES)),c1:f.fromBytes(b.subarray(f.BYTES,2*f.BYTES)),c2:f.fromBytes(b.subarray(2*f.BYTES))}},toBytes:({c0:b,c1:v,c2:q})=>Ie(f.toBytes(b),f.toBytes(v),f.toBytes(q)),cmov:({c0:b,c1:v,c2:q},{c0:O,c1:U,c2:C},W)=>({c0:f.cmov(b,O,W),c1:f.cmov(v,U,W),c2:f.cmov(q,C,W)}),fromBigSix:b=>{if(!Array.isArray(b)||b.length!==6)throw new Error("Invalid Fp6 usage");return{c0:f.fromBigTuple(b.slice(0,2)),c1:f.fromBigTuple(b.slice(2,4)),c2:f.fromBigTuple(b.slice(4,6))}},frobeniusMap:({c0:b,c1:v,c2:q},O)=>({c0:f.frobeniusMap(b,O),c1:f.mul(f.frobeniusMap(v,O),D[O%6]),c2:f.mul(f.frobeniusMap(q,O),Y[O%6])}),mulByFp2:({c0:b,c1:v,c2:q},O)=>({c0:f.mul(b,O),c1:f.mul(v,O),c2:f.mul(q,O)}),mulByNonresidue:({c0:b,c1:v,c2:q})=>({c0:f.mulByNonresidue(q),c1:b,c2:v}),mul1:({c0:b,c1:v,c2:q},O)=>({c0:f.mulByNonresidue(f.mul(q,O)),c1:f.mul(b,O),c2:f.mul(v,O)}),mul01({c0:b,c1:v,c2:q},O,U){let C=f.mul(b,O),W=f.mul(v,U);return{c0:f.add(f.mulByNonresidue(f.sub(f.mul(f.add(v,q),U),W)),C),c1:f.sub(f.sub(f.mul(f.add(O,U),f.add(b,v)),C),W),c2:f.add(f.sub(f.mul(f.add(b,q),O),C),W)}}},G=go(f,_,t.ORDER,12,1,6)[0],j=({c0:b,c1:v},{c0:q,c1:O})=>({c0:I.add(b,q),c1:I.add(v,O)}),Z=({c0:b,c1:v},{c0:q,c1:O})=>({c0:I.sub(b,q),c1:I.sub(v,O)}),k=({c0:b,c1:v},q)=>{if(typeof q=="bigint")return{c0:I.mul(b,q),c1:I.mul(v,q)};let{c0:O,c1:U}=q,C=I.mul(b,O),W=I.mul(v,U);return{c0:I.add(C,I.mulByNonresidue(W)),c1:I.sub(I.mul(I.add(b,v),I.add(O,U)),I.add(C,W))}},fe=({c0:b,c1:v})=>{let q=I.mul(b,v);return{c0:I.sub(I.sub(I.mul(I.add(I.mulByNonresidue(v),b),I.add(b,v)),q),I.mulByNonresidue(q)),c1:I.add(q,q)}};function re(b,v){let q=f.sqr(b),O=f.sqr(v);return{first:f.add(f.mulByNonresidue(O),q),second:f.sub(f.sub(f.sqr(f.add(b,v)),q),O)}}let te={ORDER:f.ORDER,BITS:2*f.BITS,BYTES:2*f.BYTES,MASK:or(2*f.BITS),ZERO:{c0:I.ZERO,c1:I.ZERO},ONE:{c0:I.ONE,c1:I.ZERO},create:b=>b,isValid:({c0:b,c1:v})=>I.isValid(b)&&I.isValid(v),is0:({c0:b,c1:v})=>I.is0(b)&&I.is0(v),neg:({c0:b,c1:v})=>({c0:I.neg(b),c1:I.neg(v)}),eql:({c0:b,c1:v},{c0:q,c1:O})=>I.eql(b,q)&&I.eql(v,O),sqrt:_i,inv:({c0:b,c1:v})=>{let q=I.inv(I.sub(I.sqr(b),I.mulByNonresidue(I.sqr(v))));return{c0:I.mul(b,q),c1:I.neg(I.mul(v,q))}},div:(b,v)=>te.mul(b,typeof v=="bigint"?t.inv(t.create(v)):te.inv(v)),pow:(b,v)=>gn(te,b,v),invertBatch:b=>bn(te,b),add:j,sub:Z,mul:k,sqr:fe,addN:j,subN:Z,mulN:k,sqrN:fe,fromBytes:b=>{if(b.length!==te.BYTES)throw new Error(`fromBytes wrong length=${b.length}`);return{c0:I.fromBytes(b.subarray(0,I.BYTES)),c1:I.fromBytes(b.subarray(I.BYTES))}},toBytes:({c0:b,c1:v})=>Ie(I.toBytes(b),I.toBytes(v)),cmov:({c0:b,c1:v},{c0:q,c1:O},U)=>({c0:I.cmov(b,q,U),c1:I.cmov(v,O,U)}),fromBigTwelve:b=>({c0:I.fromBigSix(b.slice(0,6)),c1:I.fromBigSix(b.slice(6,12))}),frobeniusMap(b,v){let{c0:q,c1:O,c2:U}=I.frobeniusMap(b.c1,v),C=G[v%12];return{c0:I.frobeniusMap(b.c0,v),c1:I.create({c0:f.mul(q,C),c1:f.mul(O,C),c2:f.mul(U,C)})}},mulByFp2:({c0:b,c1:v},q)=>({c0:I.mulByFp2(b,q),c1:I.mulByFp2(v,q)}),conjugate:({c0:b,c1:v})=>({c0:b,c1:I.neg(v)}),mul014:({c0:b,c1:v},q,O,U)=>{let C=I.mul01(b,q,O),W=I.mul1(v,U);return{c0:I.add(I.mulByNonresidue(W),C),c1:I.sub(I.sub(I.mul01(I.add(v,b),q,f.add(O,U)),C),W)}},mul034:({c0:b,c1:v},q,O,U)=>{let C=I.create({c0:f.mul(b.c0,q),c1:f.mul(b.c1,q),c2:f.mul(b.c2,q)}),W=I.mul01(v,O,U),ue=I.mul01(I.add(b,v),f.add(q,O),U);return{c0:I.add(I.mulByNonresidue(W),C),c1:I.sub(ue,I.add(C,W))}},_cyclotomicSquare:r.Fp12cyclotomicSquare,_cyclotomicExp:r.Fp12cyclotomicExp,finalExponentiate:r.Fp12finalExponentiate};return{Fp:t,Fp2:f,Fp6:I,Fp4Square:re,Fp12:te}}var tt=BigInt(0),Ui=BigInt(1),Ze=BigInt(2),Ri=BigInt(3),yn=BigInt(4),fr=BigInt("0xd201000000010000"),nl=zt(fr),{Fp:ne,Fp2:se,Fp6:yo,Fp4Square:bo,Fp12:ge}=Cc({ORDER:BigInt("0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab"),FP2_NONRESIDUE:[Ui,Ui],Fp2mulByB:({c0:r,c1:e})=>{let t=ne.mul(r,yn),n=ne.mul(e,yn);return{c0:ne.sub(t,n),c1:ne.add(t,n)}},Fp12cyclotomicSquare:({c0:r,c1:e})=>{let{c0:t,c1:n,c2:i}=r,{c0:s,c1:o,c2:c}=e,{first:a,second:p}=bo(t,o),{first:m,second:g}=bo(s,i),{first:y,second:_}=bo(n,c),f=se.mulByNonresidue(_);return{c0:yo.create({c0:se.add(se.mul(se.sub(a,t),Ze),a),c1:se.add(se.mul(se.sub(m,n),Ze),m),c2:se.add(se.mul(se.sub(y,i),Ze),y)}),c1:yo.create({c0:se.add(se.mul(se.add(f,s),Ze),f),c1:se.add(se.mul(se.add(p,o),Ze),p),c2:se.add(se.mul(se.add(g,c),Ze),g)})}},Fp12cyclotomicExp(r,e){let t=ge.ONE;for(let n=nl-1;n>=0;n--)t=ge._cyclotomicSquare(t),no(e,n)&&(t=ge.mul(t,r));return t},Fp12finalExponentiate:r=>{let e=fr,t=ge.div(ge.frobeniusMap(r,6),r),n=ge.mul(ge.frobeniusMap(t,2),t),i=ge.conjugate(ge._cyclotomicExp(n,e)),s=ge.mul(ge.conjugate(ge._cyclotomicSquare(n)),i),o=ge.conjugate(ge._cyclotomicExp(s,e)),c=ge.conjugate(ge._cyclotomicExp(o,e)),a=ge.mul(ge.conjugate(ge._cyclotomicExp(c,e)),ge._cyclotomicSquare(i)),p=ge.conjugate(ge._cyclotomicExp(a,e)),m=ge.frobeniusMap(ge.mul(i,c),2),g=ge.frobeniusMap(ge.mul(o,n),3),y=ge.frobeniusMap(ge.mul(a,ge.conjugate(n)),1),_=ge.mul(ge.mul(p,ge.conjugate(s)),n);return ge.mul(ge.mul(ge.mul(m,g),y),_)}}),$c=Dt(BigInt("0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001")),il=uo(se,[[["0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6","0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97d6"],["0x0","0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71a"],["0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71e","0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38d"],["0x171d6541fa38ccfaed6dea691f5fb614cb14b4e7f4e810aa22d6108f142b85757098e38d0f671c7188e2aaaaaaaa5ed1","0x0"]],[["0x0","0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa63"],["0xc","0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa9f"],["0x1","0x0"]],[["0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706","0x1530477c7ab4113b59a4c18b076d11930f7da5d4a07f649bf54439d87d27e500fc8c25ebf8c92f6812cfc71c71c6d706"],["0x0","0x5c759507e8e333ebb5b7a9a47d7ed8532c52d39fd3a042a88b58423c50ae15d5c2638e343d9c71c6238aaaaaaaa97be"],["0x11560bf17baa99bc32126fced787c88f984f87adf7ae0c7f9a208c6b4f20a4181472aaa9cb8d555526a9ffffffffc71c","0x8ab05f8bdd54cde190937e76bc3e447cc27c3d6fbd7063fcd104635a790520c0a395554e5c6aaaa9354ffffffffe38f"],["0x124c9ad43b6cf79bfbf7043de3811ad0761b0f37a1e26286b0e977c69aa274524e79097a56dc4bd9e1b371c71c718b10","0x0"]],[["0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb","0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa8fb"],["0x0","0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffa9d3"],["0x12","0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaa99"],["0x1","0x0"]]].map(r=>r.map(e=>se.fromBigTuple(e.map(BigInt))))),sl=uo(ne,[["0x11a05f2b1e833340b809101dd99815856b303e88a2d7005ff2627b56cdb4e2c85610c2d5f2e62d6eaeac1662734649b7","0x17294ed3e943ab2f0588bab22147a81c7c17e75b2f6a8417f565e33c70d1e86b4838f2a6f318c356e834eef1b3cb83bb","0xd54005db97678ec1d1048c5d10a9a1bce032473295983e56878e501ec68e25c958c3e3d2a09729fe0179f9dac9edcb0","0x1778e7166fcc6db74e0609d307e55412d7f5e4656a8dbf25f1b33289f1b330835336e25ce3107193c5b388641d9b6861","0xe99726a3199f4436642b4b3e4118e5499db995a1257fb3f086eeb65982fac18985a286f301e77c451154ce9ac8895d9","0x1630c3250d7313ff01d1201bf7a74ab5db3cb17dd952799b9ed3ab9097e68f90a0870d2dcae73d19cd13c1c66f652983","0xd6ed6553fe44d296a3726c38ae652bfb11586264f0f8ce19008e218f9c86b2a8da25128c1052ecaddd7f225a139ed84","0x17b81e7701abdbe2e8743884d1117e53356de5ab275b4db1a682c62ef0f2753339b7c8f8c8f475af9ccb5618e3f0c88e","0x80d3cf1f9a78fc47b90b33563be990dc43b756ce79f5574a2c596c928c5d1de4fa295f296b74e956d71986a8497e317","0x169b1f8e1bcfa7c42e0c37515d138f22dd2ecb803a0c5c99676314baf4bb1b7fa3190b2edc0327797f241067be390c9e","0x10321da079ce07e272d8ec09d2565b0dfa7dccdde6787f96d50af36003b14866f69b771f8c285decca67df3f1605fb7b","0x6e08c248e260e70bd1e962381edee3d31d79d7e22c837bc23c0bf1bc24c6b68c24b1b80b64d391fa9c8ba2e8ba2d229"],["0x8ca8d548cff19ae18b2e62f4bd3fa6f01d5ef4ba35b48ba9c9588617fc8ac62b558d681be343df8993cf9fa40d21b1c","0x12561a5deb559c4348b4711298e536367041e8ca0cf0800c0126c2588c48bf5713daa8846cb026e9e5c8276ec82b3bff","0xb2962fe57a3225e8137e629bff2991f6f89416f5a718cd1fca64e00b11aceacd6a3d0967c94fedcfcc239ba5cb83e19","0x3425581a58ae2fec83aafef7c40eb545b08243f16b1655154cca8abc28d6fd04976d5243eecf5c4130de8938dc62cd8","0x13a8e162022914a80a6f1d5f43e7a07dffdfc759a12062bb8d6b44e833b306da9bd29ba81f35781d539d395b3532a21e","0xe7355f8e4e667b955390f7f0506c6e9395735e9ce9cad4d0a43bcef24b8982f7400d24bc4228f11c02df9a29f6304a5","0x772caacf16936190f3e0c63e0596721570f5799af53a1894e2e073062aede9cea73b3538f0de06cec2574496ee84a3a","0x14a7ac2a9d64a8b230b3f5b074cf01996e7f63c21bca68a81996e1cdf9822c580fa5b9489d11e2d311f7d99bbdcc5a5e","0xa10ecf6ada54f825e920b3dafc7a3cce07f8d1d7161366b74100da67f39883503826692abba43704776ec3a79a1d641","0x95fc13ab9e92ad4476d6e3eb3a56680f682b4ee96f7d03776df533978f31c1593174e4b4b7865002d6384d168ecdd0a","0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"],["0x90d97c81ba24ee0259d1f094980dcfa11ad138e48a869522b52af6c956543d3cd0c7aee9b3ba3c2be9845719707bb33","0x134996a104ee5811d51036d776fb46831223e96c254f383d0f906343eb67ad34d6c56711962fa8bfe097e75a2e41c696","0xcc786baa966e66f4a384c86a3b49942552e2d658a31ce2c344be4b91400da7d26d521628b00523b8dfe240c72de1f6","0x1f86376e8981c217898751ad8746757d42aa7b90eeb791c09e4a3ec03251cf9de405aba9ec61deca6355c77b0e5f4cb","0x8cc03fdefe0ff135caf4fe2a21529c4195536fbe3ce50b879833fd221351adc2ee7f8dc099040a841b6daecf2e8fedb","0x16603fca40634b6a2211e11db8f0a6a074a7d0d4afadb7bd76505c3d3ad5544e203f6326c95a807299b23ab13633a5f0","0x4ab0b9bcfac1bbcb2c977d027796b3ce75bb8ca2be184cb5231413c4d634f3747a87ac2460f415ec961f8855fe9d6f2","0x987c8d5333ab86fde9926bd2ca6c674170a05bfe3bdd81ffd038da6c26c842642f64550fedfe935a15e4ca31870fb29","0x9fc4018bd96684be88c9e221e4da1bb8f3abd16679dc26c1e8b6e6a1f20cabe69d65201c78607a360370e577bdba587","0xe1bba7a1186bdb5223abde7ada14a23c42a0ca7915af6fe06985e7ed1e4d43b9b3f7055dd4eba6f2bafaaebca731c30","0x19713e47937cd1be0dfd0b8f1d43fb93cd2fcbcb6caf493fd1183e416389e61031bf3a5cce3fbafce813711ad011c132","0x18b46a908f36f6deb918c143fed2edcc523559b8aaf0c2462e6bfe7f911f643249d9cdf41b44d606ce07c8a4d0074d8e","0xb182cac101b9399d155096004f53f447aa7b12a3426b08ec02710e807b4633f06c851c1919211f20d4c04f00b971ef8","0x245a394ad1eca9b72fc00ae7be315dc757b3b080d4c158013e6632d3c40659cc6cf90ad1c232a6442d9d3f5db980133","0x5c129645e44cf1102a159f748c4a3fc5e673d81d7e86568d9ab0f5d396a7ce46ba1049b6579afb7866b1e715475224b","0x15e6be4e990f03ce4ea50b3b42df2eb5cb181d8f84965a3957add4fa95af01b2b665027efec01c7704b456be69c8b604"],["0x16112c4c3a9c98b252181140fad0eae9601a6de578980be6eec3232b5be72e7a07f3688ef60c206d01479253b03663c1","0x1962d75c2381201e1a0cbd6c43c348b885c84ff731c4d59ca4a10356f453e01f78a4260763529e3532f6102c2e49a03d","0x58df3306640da276faaae7d6e8eb15778c4855551ae7f310c35a5dd279cd2eca6757cd636f96f891e2538b53dbf67f2","0x16b7d288798e5395f20d23bf89edb4d1d115c5dbddbcd30e123da489e726af41727364f2c28297ada8d26d98445f5416","0xbe0e079545f43e4b00cc912f8228ddcc6d19c9f0f69bbb0542eda0fc9dec916a20b15dc0fd2ededda39142311a5001d","0x8d9e5297186db2d9fb266eaac783182b70152c65550d881c5ecd87b6f0f5a6449f38db9dfa9cce202c6477faaf9b7ac","0x166007c08a99db2fc3ba8734ace9824b5eecfdfa8d0cf8ef5dd365bc400a0051d5fa9c01a58b1fb93d1a1399126a775c","0x16a3ef08be3ea7ea03bcddfabba6ff6ee5a4375efa1f4fd7feb34fd206357132b920f5b00801dee460ee415a15812ed9","0x1866c8ed336c61231a1be54fd1d74cc4f9fb0ce4c6af5920abc5750c4bf39b4852cfe2f7bb9248836b233d9d55535d4a","0x167a55cda70a6e1cea820597d94a84903216f763e13d87bb5308592e7ea7d4fbc7385ea3d529b35e346ef48bb8913f55","0x4d2f259eea405bd48f010a01ad2911d9c6dd039bb61a6290e591b36e636a5c871a5c29f4f83060400f8b49cba8f6aa8","0xaccbb67481d033ff5852c1e48c50c477f94ff8aefce42d28c0f9a88cea7913516f968986f7ebbea9684b529e2561092","0xad6b9514c767fe3c3613144b45f1496543346d98adf02267d5ceef9a00d9b8693000763e3b90ac11e99b138573345cc","0x2660400eb2e4f3b628bdd0d53cd76f2bf565b94e72927c1cb748df27942480e420517bd8714cc80d1fadc1326ed06f7","0xe0fa1d816ddc03e6b24255e0d7819c171c40f65e273b853324efcd6356caa205ca2f570f13497804415473a1d634b8f","0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"]].map(r=>r.map(e=>BigInt(e)))),ol=mo(se,{A:se.create({c0:ne.create(tt),c1:ne.create(BigInt(240))}),B:se.create({c0:ne.create(BigInt(1012)),c1:ne.create(BigInt(1012))}),Z:se.create({c0:ne.create(BigInt(-2)),c1:ne.create(BigInt(-1))})}),al=mo(ne,{A:ne.create(BigInt("0x144698a3b8e9433d693a02c96d4982b0ea985383ee66a8d8e8981aefd881ac98936f8da0e0f97f5cf428082d584c1d")),B:ne.create(BigInt("0x12e2908d11688030018b12e8753eee3b2016c1f0f24f4070a0b9c14fcef35ef55a23215a316ceaa5d1cc48e98e172be0")),Z:ne.create(BigInt(11))}),{G2psi:Gc,G2psi2:cl}=qc(ne,se,se.div(se.ONE,se.NONRESIDUE)),wo=Object.freeze({DST:"BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_",encodeDST:"BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_NUL_",p:ne.ORDER,m:2,k:128,expand:"xmd",hash:Jr}),Fi=xn(ne.toBytes(tt),{infinity:!0,compressed:!0});function Oi(r){r=r.slice();let e=r[0]&224,t=!!(e>>7&1),n=!!(e>>6&1),i=!!(e>>5&1);return r[0]&=31,{compressed:t,infinity:n,sort:i,value:r}}function xn(r,e){if(r[0]&224)throw new Error("setMask: non-empty mask");return e.compressed&&(r[0]|=128),e.infinity&&(r[0]|=64),e.sort&&(r[0]|=32),r}function Hc(r){r.assertValidity();let e=r.equals(ft.G1.ProjectivePoint.ZERO),{x:t,y:n}=r.toAffine();if(e)return Fi.slice();let i=ne.ORDER,s=!!(n*Ze/i);return xn(Fe(t,ne.BYTES),{compressed:!0,sort:s})}function Vc(r){r.assertValidity();let e=ne.BYTES;if(r.equals(ft.G2.ProjectivePoint.ZERO))return Ie(Fi,Fe(tt,e));let{x:t,y:n}=r.toAffine(),{re:i,im:s}=se.reim(t),{re:o,im:c}=se.reim(n),p=!!((c>tt?c*Ze:o*Ze)/ne.ORDER&Ui),m=i;return Ie(xn(Fe(s,e),{sort:p,compressed:!0}),Fe(m,e))}var ft=Dc({fields:{Fp:ne,Fp2:se,Fp6:yo,Fp12:ge,Fr:$c},G1:{Fp:ne,h:BigInt("0x396c8c005555e1568c00aaab0000aaab"),Gx:BigInt("0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb"),Gy:BigInt("0x08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1"),a:ne.ZERO,b:yn,htfDefaults:{...wo,m:1,DST:"BLS_SIG_BLS12381G1_XMD:SHA-256_SSWU_RO_NUL_"},wrapPrivateKey:!0,allowInfinityPoint:!0,isTorsionFree:(r,e)=>{let t=BigInt("0x5f19672fdf76ce51ba69c6076a0f77eaddb3a93be6f89688de17d813620a00022e01fffffffefffe"),n=new r(ne.mul(e.px,t),e.py,e.pz);return e.multiplyUnsafe(fr).negate().multiplyUnsafe(fr).equals(n)},clearCofactor:(r,e)=>e.multiplyUnsafe(fr).add(e),mapToCurve:r=>{let{x:e,y:t}=al(ne.create(r[0]));return sl(e,t)},fromBytes:r=>{let{compressed:e,infinity:t,sort:n,value:i}=Oi(r);if(i.length===48&&e){let s=ne.ORDER,o=Xe(i),c=ne.create(o&ne.MASK);if(t){if(c!==tt)throw new Error("G1: non-empty compressed point at infinity");return{x:tt,y:tt}}let a=ne.add(ne.pow(c,Ri),ne.create(ft.params.G1b)),p=ne.sqrt(a);if(!p)throw new Error("Invalid compressed G1 point");return p*Ze/s!==BigInt(n)&&(p=ne.neg(p)),{x:ne.create(c),y:ne.create(p)}}else if(i.length===96&&!e){let s=Xe(i.subarray(0,ne.BYTES)),o=Xe(i.subarray(ne.BYTES));if(t){if(s!==tt||o!==tt)throw new Error("G1: non-empty point at infinity");return ft.G1.ProjectivePoint.ZERO.toAffine()}return{x:ne.create(s),y:ne.create(o)}}else throw new Error("Invalid point G1, expected 48/96 bytes")},toBytes:(r,e,t)=>{let n=e.equals(r.ZERO),{x:i,y:s}=e.toAffine();if(t){if(n)return Fi.slice();let o=ne.ORDER,c=!!(s*Ze/o);return xn(Fe(i,ne.BYTES),{compressed:!0,sort:c})}else return n?Ie(new Uint8Array([64]),new Uint8Array(2*ne.BYTES-1)):Ie(Fe(i,ne.BYTES),Fe(s,ne.BYTES))},ShortSignature:{fromHex(r){let{infinity:e,sort:t,value:n}=Oi(Ce("signatureHex",r,48)),i=ne.ORDER,s=Xe(n);if(e)return ft.G1.ProjectivePoint.ZERO;let o=ne.create(s&ne.MASK),c=ne.add(ne.pow(o,Ri),ne.create(ft.params.G1b)),a=ne.sqrt(c);if(!a)throw new Error("Invalid compressed G1 point");let p=BigInt(t);a*Ze/i!==p&&(a=ne.neg(a));let m=ft.G1.ProjectivePoint.fromAffine({x:o,y:a});return m.assertValidity(),m},toRawBytes(r){return Hc(r)},toHex(r){return At(Hc(r))}}},G2:{Fp:se,h:BigInt("0x5d543a95414e7f1091d50792876a202cd91de4547085abaa68a205b2e5a7ddfa628f1cb4d9e82ef21537e293a6691ae1616ec6e786f0c70cf1c38e31c7238e5"),Gx:se.fromBigTuple([BigInt("0x024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb8"),BigInt("0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e")]),Gy:se.fromBigTuple([BigInt("0x0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801"),BigInt("0x0606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be")]),a:se.ZERO,b:se.fromBigTuple([yn,yn]),hEff:BigInt("0xbc69f08f2ee75b3584c6a0ea91b352888e2a8e9145ad7689986ff031508ffe1329c2f178731db956d82bf015d1212b02ec0ec69d7477c1ae954cbc06689f6a359894c0adebbf6b4e8020005aaa95551"),htfDefaults:{...wo},wrapPrivateKey:!0,allowInfinityPoint:!0,mapToCurve:r=>{let{x:e,y:t}=ol(se.fromBigTuple(r));return il(e,t)},isTorsionFree:(r,e)=>e.multiplyUnsafe(fr).negate().equals(Gc(r,e)),clearCofactor:(r,e)=>{let t=fr,n=e.multiplyUnsafe(t).negate(),i=Gc(r,e),s=e.double();return s=cl(r,s),s=s.subtract(i),i=n.add(i),i=i.multiplyUnsafe(t).negate(),s=s.add(i),s=s.subtract(n),s.subtract(e)},fromBytes:r=>{let{compressed:e,infinity:t,sort:n,value:i}=Oi(r);if(!e&&!t&&n||!e&&t&&n||n&&t&&e)throw new Error("Invalid encoding flag: "+(r[0]&224));let s=ne.BYTES,o=(c,a,p)=>Xe(c.slice(a,p));if(i.length===96&&e){let c=ft.params.G2b,a=ne.ORDER;if(t){if(i.reduce((P,T)=>P!==0?T+1:T,0)>0)throw new Error("Invalid compressed G2 point");return{x:se.ZERO,y:se.ZERO}}let p=o(i,0,s),m=o(i,s,2*s),g=se.create({c0:ne.create(m),c1:ne.create(p)}),y=se.add(se.pow(g,Ri),c),_=se.sqrt(y),f=_.c1===tt?_.c0*Ze/a:_.c1*Ze/a?Ui:tt;return _=n&&f>0?_:se.neg(_),{x:g,y:_}}else if(i.length===192&&!e){if(t){if(i.reduce((g,y)=>g!==0?y+1:y,0)>0)throw new Error("Invalid uncompressed G2 point");return{x:se.ZERO,y:se.ZERO}}let c=o(i,0,s),a=o(i,s,2*s),p=o(i,2*s,3*s),m=o(i,3*s,4*s);return{x:se.fromBigTuple([a,c]),y:se.fromBigTuple([m,p])}}else throw new Error("Invalid point G2, expected 96/192 bytes")},toBytes:(r,e,t)=>{let{BYTES:n,ORDER:i}=ne,s=e.equals(r.ZERO),{x:o,y:c}=e.toAffine();if(t){if(s)return Ie(Fi,Fe(tt,n));let a=!!(c.c1===tt?c.c0*Ze/i:c.c1*Ze/i);return Ie(xn(Fe(o.c1,n),{compressed:!0,sort:a}),Fe(o.c0,n))}else{if(s)return Ie(new Uint8Array([64]),new Uint8Array(4*n-1));let{re:a,im:p}=se.reim(o),{re:m,im:g}=se.reim(c);return Ie(Fe(p,n),Fe(a,n),Fe(g,n),Fe(m,n))}},Signature:{fromHex(r){let{infinity:e,sort:t,value:n}=Oi(Ce("signatureHex",r)),i=ne.ORDER,s=n.length/2;if(s!==48&&s!==96)throw new Error("Invalid compressed signature length, must be 96 or 192");let o=Xe(n.slice(0,s)),c=Xe(n.slice(s));if(e)return ft.G2.ProjectivePoint.ZERO;let a=ne.create(o&ne.MASK),p=ne.create(c),m=se.create({c0:p,c1:a}),g=se.add(se.pow(m,Ri),ft.params.G2b),y=se.sqrt(g);if(!y)throw new Error("Failed to find a square root");let{re:_,im:f}=se.reim(y),P=BigInt(t),T=f>tt&&f*Ze/i!==P,F=f===tt&&_*Ze/i!==P;(T||F)&&(y=se.neg(y));let $=ft.G2.ProjectivePoint.fromAffine({x:m,y});return $.assertValidity(),$},toRawBytes(r){return Vc(r)},toHex(r){return At(Vc(r))}}},params:{ateLoopSize:fr,r:$c.ORDER,xNegative:!0,twistType:"multiplicative"},htfDefaults:wo,hash:Jr,randomBytes:Mn});function jc(r,e,t){let n=typeof r=="string"?r:ct(r),i=typeof e=="string"?e:ct(e),s=typeof t=="string"?t:ct(t);return ft.verifyShortSignature(i,s,n)}var xo=r=>ke(new Et(r)),$r=r=>{let e=xo(r);return new Date(Number(e)/1e6)};var fl=function(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t},ll=new TextEncoder().encode(`
|
|
14
|
-
ic-request`),Yc=class{getPrincipal(){return this._principal||(this._principal=me.selfAuthenticating(new Uint8Array(this.getPublicKey().toDer()))),this._principal}async transformRequest(e){let{body:t}=e,n=fl(e,["body"]),i=await hn(t);return Object.assign(Object.assign({},n),{body:{content:t,sender_pubkey:this.getPublicKey().toDer(),sender_sig:await this.sign(Ke(ll,i))}})}},Pi=class{getPrincipal(){return me.anonymous()}async transformRequest(e){return Object.assign(Object.assign({},e),{body:{content:e.body}})}};var Zc=Xr(ei());var _n=()=>{if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){let r=new Uint32Array(1);return window.crypto.getRandomValues(r),r[0]}if(typeof crypto<"u"&&crypto.getRandomValues){let r=new Uint32Array(1);return crypto.getRandomValues(r),r[0]}return typeof crypto<"u"&&crypto.randomInt?crypto.randomInt(0,4294967295):Math.floor(Math.random()*4294967295)};var Li;(function(r){r.Call="call"})(Li||(Li={}));function Gr(){let r=new ArrayBuffer(16),e=new DataView(r),t=_n(),n=_n(),i=_n(),s=_n();return e.setUint32(0,t),e.setUint32(4,n),e.setUint32(8,i),e.setUint32(12,s),r}var zc=BigInt(1e6),hl=60*1e3,lr=class{constructor(e){if(e<90*1e3){let c=BigInt(Date.now()+e)*zc/BigInt(1e9);this._value=c*BigInt(1e9);return}let s=BigInt(Math.floor(Date.now()+e-hl))*zc/BigInt(1e9)/BigInt(60)*BigInt(60)*BigInt(1e9);this._value=s}toCBOR(){return Zc.value.u64(this._value.toString(16),16)}toHash(){return Se(this._value)}};function _o(r=Gr){return async e=>{let t=e.request.headers;e.request.headers=t,e.endpoint==="call"&&(e.body.nonce=r())}}function Hr(r){let e=[];return r.forEach((t,n)=>{e.push([n,t])}),e}var Vr=class extends Ye{constructor(e,t){super(e),this.response=t,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}};var Mi=BigInt(4294967295),Eo=BigInt(32);function Wc(r,e=!1){return e?{h:Number(r&Mi),l:Number(r>>Eo&Mi)}:{h:Number(r>>Eo&Mi)|0,l:Number(r&Mi)|0}}function dl(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;i<r.length;i++){let{h:s,l:o}=Wc(r[i],e);[t[i],n[i]]=[s,o]}return[t,n]}var pl=(r,e)=>BigInt(r>>>0)<<Eo|BigInt(e>>>0),ml=(r,e,t)=>r>>>t,gl=(r,e,t)=>r<<32-t|e>>>t,bl=(r,e,t)=>r>>>t|e<<32-t,wl=(r,e,t)=>r<<32-t|e>>>t,yl=(r,e,t)=>r<<64-t|e>>>t-32,xl=(r,e,t)=>r>>>t-32|e<<64-t,_l=(r,e)=>e,El=(r,e)=>r,vl=(r,e,t)=>r<<t|e>>>32-t,Il=(r,e,t)=>e<<t|r>>>32-t,Al=(r,e,t)=>e<<t-32|r>>>64-t,Bl=(r,e,t)=>r<<t-32|e>>>64-t;function Sl(r,e,t,n){let i=(e>>>0)+(n>>>0);return{h:r+t+(i/2**32|0)|0,l:i|0}}var Tl=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Nl=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Rl=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Ol=(r,e,t,n,i)=>e+t+n+i+(r/2**32|0)|0,Ul=(r,e,t,n,i)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(i>>>0),Fl=(r,e,t,n,i,s)=>e+t+n+i+s+(r/2**32|0)|0;var Pl={fromBig:Wc,split:dl,toBig:pl,shrSH:ml,shrSL:gl,rotrSH:bl,rotrSL:wl,rotrBH:yl,rotrBL:xl,rotr32H:_l,rotr32L:El,rotlSH:vl,rotlSL:Il,rotlBH:Al,rotlBL:Bl,add:Sl,add3L:Tl,add3H:Nl,add4L:Rl,add4H:Ol,add5H:Fl,add5L:Ul},le=Pl;var[Ll,Ml]=le.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))),hr=new Uint32Array(80),dr=new Uint32Array(80),vo=class extends Ur{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:i,Ch:s,Cl:o,Dh:c,Dl:a,Eh:p,El:m,Fh:g,Fl:y,Gh:_,Gl:f,Hh:P,Hl:T}=this;return[e,t,n,i,s,o,c,a,p,m,g,y,_,f,P,T]}set(e,t,n,i,s,o,c,a,p,m,g,y,_,f,P,T){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=a|0,this.Eh=p|0,this.El=m|0,this.Fh=g|0,this.Fl=y|0,this.Gh=_|0,this.Gl=f|0,this.Hh=P|0,this.Hl=T|0}process(e,t){for(let D=0;D<16;D++,t+=4)hr[D]=e.getUint32(t),dr[D]=e.getUint32(t+=4);for(let D=16;D<80;D++){let Y=hr[D-15]|0,I=dr[D-15]|0,G=le.rotrSH(Y,I,1)^le.rotrSH(Y,I,8)^le.shrSH(Y,I,7),j=le.rotrSL(Y,I,1)^le.rotrSL(Y,I,8)^le.shrSL(Y,I,7),Z=hr[D-2]|0,k=dr[D-2]|0,fe=le.rotrSH(Z,k,19)^le.rotrBH(Z,k,61)^le.shrSH(Z,k,6),re=le.rotrSL(Z,k,19)^le.rotrBL(Z,k,61)^le.shrSL(Z,k,6),te=le.add4L(j,re,dr[D-7],dr[D-16]),b=le.add4H(te,G,fe,hr[D-7],hr[D-16]);hr[D]=b|0,dr[D]=te|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:c,Cl:a,Dh:p,Dl:m,Eh:g,El:y,Fh:_,Fl:f,Gh:P,Gl:T,Hh:F,Hl:$}=this;for(let D=0;D<80;D++){let Y=le.rotrSH(g,y,14)^le.rotrSH(g,y,18)^le.rotrBH(g,y,41),I=le.rotrSL(g,y,14)^le.rotrSL(g,y,18)^le.rotrBL(g,y,41),G=g&_^~g&P,j=y&f^~y&T,Z=le.add5L($,I,j,Ml[D],dr[D]),k=le.add5H(Z,F,Y,G,Ll[D],hr[D]),fe=Z|0,re=le.rotrSH(n,i,28)^le.rotrBH(n,i,34)^le.rotrBH(n,i,39),te=le.rotrSL(n,i,28)^le.rotrBL(n,i,34)^le.rotrBL(n,i,39),b=n&s^n&c^s&c,v=i&o^i&a^o&a;F=P|0,$=T|0,P=_|0,T=f|0,_=g|0,f=y|0,{h:g,l:y}=le.add(p|0,m|0,k|0,fe|0),p=c|0,m=a|0,c=s|0,a=o|0,s=n|0,o=i|0;let q=le.add3L(fe,te,v);n=le.add3H(q,k,re,b),i=q|0}({h:n,l:i}=le.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=le.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l:a}=le.add(this.Ch|0,this.Cl|0,c|0,a|0),{h:p,l:m}=le.add(this.Dh|0,this.Dl|0,p|0,m|0),{h:g,l:y}=le.add(this.Eh|0,this.El|0,g|0,y|0),{h:_,l:f}=le.add(this.Fh|0,this.Fl|0,_|0,f|0),{h:P,l:T}=le.add(this.Gh|0,this.Gl|0,P|0,T|0),{h:F,l:$}=le.add(this.Hh|0,this.Hl|0,F|0,$|0),this.set(n,i,s,o,c,a,p,m,g,y,_,f,P,T,F,$)}roundClean(){hr.fill(0),dr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Kc=Qr(()=>new vo);var Nt=BigInt(0),at=BigInt(1),Di=BigInt(2),Dl=BigInt(8),kl={zip215:!0};function ql(r){let e=Si(r);return St(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Xc(r){let e=ql(r),{Fp:t,n,prehash:i,hash:s,randomBytes:o,nByteLength:c,h:a}=e,p=Di<<BigInt(c*8)-at,m=t.create,g=Dt(e.n,e.nBitLength),y=e.uvRatio||((O,U)=>{try{return{isValid:!0,value:t.sqrt(O*t.inv(U))}}catch{return{isValid:!1,value:Nt}}}),_=e.adjustScalarBytes||(O=>O),f=e.domain||((O,U,C)=>{if(ir("phflag",C),U.length||C)throw new Error("Contexts/pre-hash are not supported");return O});function P(O,U){Bt("coordinate "+O,U,Nt,p)}function T(O){if(!(O instanceof D))throw new Error("ExtendedPoint expected")}let F=Zt((O,U)=>{let{ex:C,ey:W,ez:ue}=O,ce=O.is0();U==null&&(U=ce?Dl:t.inv(ue));let V=m(C*U),R=m(W*U),h=m(ue*U);if(ce)return{x:Nt,y:at};if(h!==at)throw new Error("invZ was invalid");return{x:V,y:R}}),$=Zt(O=>{let{a:U,d:C}=e;if(O.is0())throw new Error("bad point: ZERO");let{ex:W,ey:ue,ez:ce,et:V}=O,R=m(W*W),h=m(ue*ue),Q=m(ce*ce),J=m(Q*Q),ae=m(R*U),X=m(Q*m(ae+h)),u=m(J+m(C*m(R*h)));if(X!==u)throw new Error("bad point: equation left != right (1)");let l=m(W*ue),d=m(ce*V);if(l!==d)throw new Error("bad point: equation left != right (2)");return!0});class D{constructor(U,C,W,ue){this.ex=U,this.ey=C,this.ez=W,this.et=ue,P("x",U),P("y",C),P("z",W),P("t",ue),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(U){if(U instanceof D)throw new Error("extended point not allowed");let{x:C,y:W}=U||{};return P("x",C),P("y",W),new D(C,W,at,m(C*W))}static normalizeZ(U){let C=t.invertBatch(U.map(W=>W.ez));return U.map((W,ue)=>W.toAffine(C[ue])).map(D.fromAffine)}static msm(U,C){return Bi(D,g,U,C)}_setWindowSize(U){G.setWindowSize(this,U)}assertValidity(){$(this)}equals(U){T(U);let{ex:C,ey:W,ez:ue}=this,{ex:ce,ey:V,ez:R}=U,h=m(C*R),Q=m(ce*ue),J=m(W*R),ae=m(V*ue);return h===Q&&J===ae}is0(){return this.equals(D.ZERO)}negate(){return new D(m(-this.ex),this.ey,this.ez,m(-this.et))}double(){let{a:U}=e,{ex:C,ey:W,ez:ue}=this,ce=m(C*C),V=m(W*W),R=m(Di*m(ue*ue)),h=m(U*ce),Q=C+W,J=m(m(Q*Q)-ce-V),ae=h+V,X=ae-R,u=h-V,l=m(J*X),d=m(ae*u),B=m(J*u),E=m(X*ae);return new D(l,d,E,B)}add(U){T(U);let{a:C,d:W}=e,{ex:ue,ey:ce,ez:V,et:R}=this,{ex:h,ey:Q,ez:J,et:ae}=U;if(C===BigInt(-1)){let H=m((ce-ue)*(Q+h)),K=m((ce+ue)*(Q-h)),ie=m(K-H);if(ie===Nt)return this.double();let de=m(V*Di*ae),Ee=m(R*Di*J),Ne=Ee+de,he=K+H,oe=Ee-de,Me=m(Ne*ie),Xt=m(he*oe),gr=m(Ne*oe),br=m(ie*he);return new D(Me,Xt,br,gr)}let X=m(ue*h),u=m(ce*Q),l=m(R*W*ae),d=m(V*J),B=m((ue+ce)*(h+Q)-X-u),E=d-l,A=d+l,M=m(u-C*X),w=m(B*E),S=m(A*M),L=m(B*M),N=m(E*A);return new D(w,S,N,L)}subtract(U){return this.add(U.negate())}wNAF(U){return G.wNAFCached(this,U,D.normalizeZ)}multiply(U){let C=U;Bt("scalar",C,at,n);let{p:W,f:ue}=this.wNAF(C);return D.normalizeZ([W,ue])[0]}multiplyUnsafe(U){let C=U;return Bt("scalar",C,Nt,n),C===Nt?I:this.equals(I)||C===at?this:this.equals(Y)?this.wNAF(C).p:G.unsafeLadder(this,C)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return G.unsafeLadder(this,n).is0()}toAffine(U){return F(this,U)}clearCofactor(){let{h:U}=e;return U===at?this:this.multiplyUnsafe(U)}static fromHex(U,C=!1){let{d:W,a:ue}=e,ce=t.BYTES;U=Ce("pointHex",U,ce),ir("zip215",C);let V=U.slice(),R=U[ce-1];V[ce-1]=R&-129;let h=sr(V),Q=C?p:t.ORDER;Bt("pointHex.y",h,Nt,Q);let J=m(h*h),ae=m(J-at),X=m(W*J-ue),{isValid:u,value:l}=y(ae,X);if(!u)throw new Error("Point.fromHex: invalid y coordinate");let d=(l&at)===at,B=(R&128)!==0;if(!C&&l===Nt&&B)throw new Error("Point.fromHex: x=0 and x_0=1");return B!==d&&(l=m(-l)),D.fromAffine({x:l,y:h})}static fromPrivateKey(U){return k(U).point}toRawBytes(){let{x:U,y:C}=this.toAffine(),W=Ir(C,t.BYTES);return W[W.length-1]|=U&at?128:0,W}toHex(){return At(this.toRawBytes())}}D.BASE=new D(e.Gx,e.Gy,at,m(e.Gx*e.Gy)),D.ZERO=new D(Nt,at,at,Nt);let{BASE:Y,ZERO:I}=D,G=Ai(D,c*8);function j(O){return Be(O,n)}function Z(O){return j(sr(O))}function k(O){let U=c;O=Ce("private key",O,U);let C=Ce("hashed private key",s(O),2*U),W=_(C.slice(0,U)),ue=C.slice(U,2*U),ce=Z(W),V=Y.multiply(ce),R=V.toRawBytes();return{head:W,prefix:ue,scalar:ce,point:V,pointBytes:R}}function fe(O){return k(O).pointBytes}function re(O=new Uint8Array,...U){let C=Ie(...U);return Z(s(f(C,Ce("context",O),!!i)))}function te(O,U,C={}){O=Ce("message",O),i&&(O=i(O));let{prefix:W,scalar:ue,pointBytes:ce}=k(U),V=re(C.context,W,O),R=Y.multiply(V).toRawBytes(),h=re(C.context,R,ce,O),Q=j(V+h*ue);Bt("signature.s",Q,Nt,n);let J=Ie(R,Ir(Q,t.BYTES));return Ce("result",J,c*2)}let b=kl;function v(O,U,C,W=b){let{context:ue,zip215:ce}=W,V=t.BYTES;O=Ce("signature",O,2*V),U=Ce("message",U),ce!==void 0&&ir("zip215",ce),i&&(U=i(U));let R=sr(O.slice(V,2*V)),h,Q,J;try{h=D.fromHex(C,ce),Q=D.fromHex(O.slice(0,V),ce),J=Y.multiplyUnsafe(R)}catch{return!1}if(!ce&&h.isSmallOrder())return!1;let ae=re(ue,Q.toRawBytes(),h.toRawBytes(),U);return Q.add(h.multiplyUnsafe(ae)).subtract(J).clearCofactor().equals(D.ZERO)}return Y._setWindowSize(8),{CURVE:e,getPublicKey:fe,sign:te,verify:v,ExtendedPoint:D,utils:{getExtendedPublicKey:k,randomPrivateKey:()=>o(t.BYTES),precompute(O=8,U=D.BASE){return U._setWindowSize(O),U.multiply(BigInt(3)),U}}}}var Io=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Qc=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),Vp=BigInt(0),Cl=BigInt(1),Jc=BigInt(2),jp=BigInt(3),$l=BigInt(5),Gl=BigInt(8);function Hl(r){let e=BigInt(10),t=BigInt(20),n=BigInt(40),i=BigInt(80),s=Io,c=r*r%s*r%s,a=Tt(c,Jc,s)*c%s,p=Tt(a,Cl,s)*r%s,m=Tt(p,$l,s)*p%s,g=Tt(m,e,s)*m%s,y=Tt(g,t,s)*g%s,_=Tt(y,n,s)*y%s,f=Tt(_,i,s)*_%s,P=Tt(f,i,s)*_%s,T=Tt(P,e,s)*m%s;return{pow_p_5_8:Tt(T,Jc,s)*r%s,b2:c}}function Vl(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function jl(r,e){let t=Io,n=Be(e*e*e,t),i=Be(n*n*e,t),s=Hl(r*i).pow_p_5_8,o=Be(r*n*s,t),c=Be(e*o*o,t),a=o,p=Be(o*Qc,t),m=c===r,g=c===Be(-r,t),y=c===Be(-r*Qc,t);return m&&(o=a),(g||y)&&(o=p),Rc(o,t)&&(o=Be(-o,t)),{isValid:m||g,value:o}}var Yl=Dt(Io,void 0,!0),zl={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Yl,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Gl,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Kc,randomBytes:Mn,adjustScalarBytes:Vl,uvRatio:jl},eu=Xc(zl);var tu=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},rt=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Qe,En,ru,nu,ki=class{constructor(e={}){Qe.set(this,void 0),En.set(this,void 0),this[ru]=this.entries.bind(this),this[nu]="ExpirableMap";let{source:t=[],expirationTime:n=10*60*1e3}=e,i=Date.now();tu(this,Qe,new Map([...t].map(([s,o])=>[s,{value:o,timestamp:i}])),"f"),tu(this,En,n,"f")}prune(){let e=Date.now();for(let[t,n]of rt(this,Qe,"f").entries())e-n.timestamp>rt(this,En,"f")&&rt(this,Qe,"f").delete(t);return this}set(e,t){this.prune();let n={value:t,timestamp:Date.now()};return rt(this,Qe,"f").set(e,n),this}get(e){let t=rt(this,Qe,"f").get(e);if(t!==void 0){if(Date.now()-t.timestamp>rt(this,En,"f")){rt(this,Qe,"f").delete(e);return}return t.value}}clear(){rt(this,Qe,"f").clear()}entries(){let e=rt(this,Qe,"f").entries();return function*(){for(let[n,i]of e)yield[n,i.value]}()}values(){let e=rt(this,Qe,"f").values();return function*(){for(let n of e)yield n.value}()}keys(){return rt(this,Qe,"f").keys()}forEach(e,t){for(let[n,i]of rt(this,Qe,"f").entries())e.call(t,i.value,n,this)}has(e){return rt(this,Qe,"f").has(e)}delete(e){return rt(this,Qe,"f").delete(e)}get size(){return rt(this,Qe,"f").size}};Qe=new WeakMap,En=new WeakMap,ru=Symbol.iterator,nu=Symbol.toStringTag;var iu=r=>{if(r<=127)return 1;if(r<=255)return 2;if(r<=65535)return 3;if(r<=16777215)return 4;throw new Error("Length too long (> 4 bytes)")},su=(r,e,t)=>{if(t<=127)return r[e]=t,1;if(t<=255)return r[e]=129,r[e+1]=t,2;if(t<=65535)return r[e]=130,r[e+1]=t>>8,r[e+2]=t,3;if(t<=16777215)return r[e]=131,r[e+1]=t>>16,r[e+2]=t>>8,r[e+3]=t,4;throw new Error("Length too long (> 4 bytes)")},Ao=(r,e)=>{if(r[e]<128)return 1;if(r[e]===128)throw new Error("Invalid length 0");if(r[e]===129)return 2;if(r[e]===130)return 3;if(r[e]===131)return 4;throw new Error("Length too long (> 4 bytes)")},Zl=(r,e)=>{let t=Ao(r,e);if(t===1)return r[e];if(t===2)return r[e+1];if(t===3)return(r[e+1]<<8)+r[e+2];if(t===4)return(r[e+1]<<16)+(r[e+2]<<8)+r[e+3];throw new Error("Length too long (> 4 bytes)")},Wp=Uint8Array.from([48,12,6,10,43,6,1,4,1,131,184,67,1,1]),Bo=Uint8Array.from([48,5,6,3,43,101,112]),Kp=Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10]);function ou(r,e){let t=2+iu(r.byteLength+1),n=e.byteLength+t+r.byteLength,i=0,s=new Uint8Array(1+iu(n)+n);return s[i++]=48,i+=su(s,i,n),s.set(e,i),i+=e.byteLength,s[i++]=3,i+=su(s,i,r.byteLength+1),s[i++]=0,s.set(new Uint8Array(r),i),s}var au=(r,e)=>{let t=0,n=(c,a)=>{if(i[t++]!==c)throw new Error("Expected: "+a)},i=new Uint8Array(r);if(n(48,"sequence"),t+=Ao(i,t),!tn(i.slice(t,t+e.byteLength),e))throw new Error("Not the expected OID.");t+=e.byteLength,n(3,"bit string");let s=Zl(i,t)-1;t+=Ao(i,t),n(0,"0 padding");let o=i.slice(t);if(s!==o.length)throw new Error(`DER payload mismatch: Expected length ${s} actual length ${o.length}`);return o};var cu=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},uu=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},qi,Ci,vn=class r{constructor(e){if(qi.set(this,void 0),Ci.set(this,void 0),e.byteLength!==r.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");cu(this,qi,e,"f"),cu(this,Ci,r.derEncode(e),"f")}static from(e){return this.fromDer(e.toDer())}static fromRaw(e){return new r(e)}static fromDer(e){return new r(this.derDecode(e))}static derEncode(e){return ou(e,Bo).buffer}static derDecode(e){let t=au(e,Bo);if(t.length!==this.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");return t}get rawKey(){return uu(this,qi,"f")}get derKey(){return uu(this,Ci,"f")}toDer(){return this.derKey}toRaw(){return this.rawKey}};qi=new WeakMap,Ci=new WeakMap;vn.RAW_KEY_LENGTH=32;var So=class{constructor(){this.observers=[]}subscribe(e){this.observers.push(e)}unsubscribe(e){this.observers=this.observers.filter(t=>t!==e)}notify(e,...t){this.observers.forEach(n=>n(e,...t))}},$i=class extends So{constructor(){super()}print(e,...t){this.notify({message:e,level:"info"},...t)}warn(e,...t){this.notify({message:e,level:"warn"},...t)}error(e,t,...n){this.notify({message:e,level:"error",error:t},...n)}};var kt=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Je=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},qt,Gi,Hi,Vi,ji,Yi,zi,Zi,jr;var In=class r{constructor(e=r.default){qt.set(this,void 0),Gi.set(this,void 0),Hi.set(this,void 0),Vi.set(this,void 0),ji.set(this,void 0),Yi.set(this,void 0),zi.set(this,void 0),Zi.set(this,void 0),jr.set(this,0);let{initialInterval:t=500,randomizationFactor:n=.5,multiplier:i=1.5,maxInterval:s=6e4,maxElapsedTime:o=9e5,maxIterations:c=10,date:a=Date}=e;kt(this,qt,t,"f"),kt(this,Gi,n,"f"),kt(this,Hi,i,"f"),kt(this,Vi,s,"f"),kt(this,Zi,a,"f"),kt(this,ji,a.now(),"f"),kt(this,Yi,o,"f"),kt(this,zi,c,"f")}get ellapsedTimeInMsec(){return Je(this,Zi,"f").now()-Je(this,ji,"f")}get currentInterval(){return Je(this,qt,"f")}get count(){return Je(this,jr,"f")}get randomValueFromInterval(){let e=Je(this,Gi,"f")*Je(this,qt,"f"),t=Je(this,qt,"f")-e,n=Je(this,qt,"f")+e;return Math.random()*(n-t)+t}incrementCurrentInterval(){var e;return kt(this,qt,Math.min(Je(this,qt,"f")*Je(this,Hi,"f"),Je(this,Vi,"f")),"f"),kt(this,jr,(e=Je(this,jr,"f"),e++,e),"f"),Je(this,qt,"f")}next(){return this.ellapsedTimeInMsec>=Je(this,Yi,"f")||Je(this,jr,"f")>=Je(this,zi,"f")?null:(this.incrementCurrentInterval(),this.randomValueFromInterval)}};qt=new WeakMap,Gi=new WeakMap,Hi=new WeakMap,Vi=new WeakMap,ji=new WeakMap,Yi=new WeakMap,zi=new WeakMap,Zi=new WeakMap,jr=new WeakMap;In.default={initialInterval:500,randomizationFactor:.5,multiplier:1.5,maxInterval:6e4,maxElapsedTime:9e5,maxIterations:10,date:Date};var nt=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},ee=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},$t,Ct,pr,Zr,An,Bn,Rt,Ki,Ot,Br,Sr,Sn,Yr,zr,Tr,Nr,du,Xi,Qi,fu;(function(r){r.Received="received",r.Processing="processing",r.Replied="replied",r.Rejected="rejected",r.Unknown="unknown",r.Done="done"})(fu||(fu={}));var Wi=60*1e3,Kl="308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae",pu="aaaaa-aa",Xl="ic0.app",Ql=".ic0.app",Jl="icp0.io",eh=".icp0.io",th="icp-api.io",rh=".icp-api.io",Tn=class extends Ye{constructor(e){super(e),this.message=e}},Wr=class extends Ye{constructor(e){super(e),this.message=e}};function nh(){let r;if(typeof window<"u")if(window.fetch)r=window.fetch.bind(window);else throw new Tn("Fetch implementation was not available. You appear to be in a browser context, but window.fetch was not present.");else if(typeof globalThis<"u")if(globalThis.fetch)r=globalThis.fetch.bind(globalThis);else throw new Tn("Fetch implementation was not available. You appear to be in a Node.js context, but global.fetch was not available.");else typeof self<"u"&&self.fetch&&(r=self.fetch.bind(self));if(r)return r;throw new Tn("Fetch implementation was not available. Please provide fetch to the HttpAgent constructor, or ensure it is available in the window or global context.")}function ih(r){let e;if(r!==void 0)!r.match(/^[a-z]+:/)&&typeof window<"u"?e=new URL(window.location.protocol+"//"+r):e=new URL(r);else{let t=["ic0.app","icp0.io","127.0.0.1","localhost"],n=[".github.dev",".gitpod.io"],i=typeof window<"u"?window.location:void 0,s=i?.hostname,o;s&&typeof s=="string"&&(n.some(c=>s.endsWith(c))?o=s:o=t.find(c=>s.endsWith(c))),i&&o?e=new URL(`${i.protocol}//${o}${i.port?":"+i.port:""}`):e=new URL("https://icp-api.io")}return e.toString()}var lu=class r{constructor(e={}){var t;$t.add(this),Ct.set(this,void 0),pr.set(this,void 0),Zr.set(this,void 0),An.set(this,void 0),Bn.set(this,0),Rt.set(this,void 0),Ki.set(this,!1),Ot.set(this,void 0),Br.set(this,void 0),Sr.set(this,void 0),this._isAgent=!0,this.config={},Sn.set(this,0),this.log=new $i,Yr.set(this,[]),zr.set(this,[]),Tr.set(this,new ki({expirationTime:5*60*1e3})),Nr.set(this,!0),Qi.set(this,(s,o)=>{if(ee(this,Nr,"f")===!1)return s;if(!o)throw new lt("Invalid signature from replica signed query: no matching node key found.");let{status:c,signatures:a=[],requestId:p}=s,m=new TextEncoder().encode("\vic-response");for(let g of a){let{timestamp:y,identity:_}=g,f=me.fromUint8Array(_).toText(),P;if(c==="replied"){let{reply:Y}=s;P=dn({status:c,reply:Y,timestamp:BigInt(y),request_id:p})}else if(c==="rejected"){let{reject_code:Y,reject_message:I,error_code:G}=s;P=dn({status:c,reject_code:Y,reject_message:I,error_code:G,timestamp:BigInt(y),request_id:p})}else throw new Error(`Unknown status: ${c}`);let T=Ke(m,new Uint8Array(P)),F=o?.nodeKeys.get(f);if(!F)throw new lt("Invalid signature from replica signed query: no matching node key found.");let $=vn.fromDer(F).rawKey;if(eu.verify(g.signature,new Uint8Array(T),new Uint8Array($)))return s;throw new lt(`Invalid signature from replica ${f} signed query.`)}return s}),this.config=e,nt(this,pr,e.fetch||nh()||fetch.bind(globalThis),"f"),nt(this,Zr,e.fetchOptions,"f"),nt(this,An,e.callOptions,"f"),this.rootKey=e.rootKey?e.rootKey:yr(Kl);let n=ih(e.host);this.host=new URL(n),e.verifyQuerySignatures!==void 0&&nt(this,Nr,e.verifyQuerySignatures,"f"),nt(this,Ot,(t=e.retryTimes)!==null&&t!==void 0?t:3,"f");let i=()=>new In({maxIterations:ee(this,Ot,"f")});if(nt(this,Br,e.backoffStrategy||i,"f"),this.host.hostname.endsWith(Ql)?this.host.hostname=Xl:this.host.hostname.endsWith(eh)?this.host.hostname=Jl:this.host.hostname.endsWith(rh)&&(this.host.hostname=th),e.credentials){let{name:s,password:o}=e.credentials;nt(this,Rt,`${s}${o?":"+o:""}`,"f")}if(nt(this,Ct,Promise.resolve(e.identity||new Pi),"f"),e.ingressExpiryInMinutes&&e.ingressExpiryInMinutes>5)throw new Ye(`The maximum ingress expiry time is 5 minutes. Provided ingress expiry time is ${e.ingressExpiryInMinutes} minutes.`);if(e.ingressExpiryInMinutes&&e.ingressExpiryInMinutes<=0)throw new Ye(`Ingress expiry time must be greater than 0. Provided ingress expiry time is ${e.ingressExpiryInMinutes} minutes.`);nt(this,Sr,e.ingressExpiryInMinutes||5,"f"),this.addTransform("update",_o(Gr)),e.useQueryNonces&&this.addTransform("query",_o(Gr)),e.logToConsole&&this.log.subscribe(s=>{s.level==="error"?console.error(s.message):s.level==="warn"?console.warn(s.message):console.log(s.message)})}get waterMark(){return ee(this,Sn,"f")}static createSync(e={}){return new this(Object.assign({},e))}static async create(e={shouldFetchRootKey:!1}){let t=r.createSync(e),n=[t.syncTime()];return t.host.toString()!=="https://icp-api.io"&&e.shouldFetchRootKey&&n.push(t.fetchRootKey()),await Promise.all(n),t}static async from(e){var t;try{return"config"in e?await r.create(e.config):await r.create({fetch:e._fetch,fetchOptions:e._fetchOptions,callOptions:e._callOptions,host:e._host.toString(),identity:(t=e._identity)!==null&&t!==void 0?t:void 0})}catch{throw new Ye("Failed to create agent from provided agent")}}isLocal(){let e=this.host.hostname;return e==="127.0.0.1"||e.endsWith("127.0.0.1")}addTransform(e,t,n=t.priority||0){if(e==="update"){let i=ee(this,zr,"f").findIndex(s=>(s.priority||0)<n);ee(this,zr,"f").splice(i>=0?i:ee(this,zr,"f").length,0,Object.assign(t,{priority:n}))}else if(e==="query"){let i=ee(this,Yr,"f").findIndex(s=>(s.priority||0)<n);ee(this,Yr,"f").splice(i>=0?i:ee(this,Yr,"f").length,0,Object.assign(t,{priority:n}))}}async getPrincipal(){if(!ee(this,Ct,"f"))throw new Wr("This identity has expired due this application's security policy. Please refresh your authentication.");return(await ee(this,Ct,"f")).getPrincipal()}async call(e,t,n){var i;let s=(i=t.callSync)!==null&&i!==void 0?i:!0,o=await(n!==void 0?await n:await ee(this,Ct,"f"));if(!o)throw new Wr("This identity has expired due this application's security policy. Please refresh your authentication.");let c=me.from(e),a=t.effectiveCanisterId?me.from(t.effectiveCanisterId):c,p=o.getPrincipal()||me.anonymous(),m=new lr(ee(this,Sr,"f")*Wi);Math.abs(ee(this,Bn,"f"))>1e3*30&&(m=new lr(ee(this,Sr,"f")*Wi+ee(this,Bn,"f")));let g={request_type:Li.Call,canister_id:c,method_name:t.methodName,arg:t.arg,sender:p,ingress_expiry:m},y=await this._transform({request:{body:null,method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},ee(this,Rt,"f")?{Authorization:"Basic "+btoa(ee(this,Rt,"f"))}:{})},endpoint:"call",body:g}),_=y.body.nonce?f(y.body.nonce):void 0;g.nonce=_;function f(F){return new Uint8Array(F)}y=await o.transformRequest(y);let P=ri(y.body),T=ee(this,Br,"f").call(this);try{let F=()=>(this.log.print(`fetching "/api/v3/canister/${a.toText()}/call" with request:`,y),ee(this,pr,"f").call(this,""+new URL(`/api/v3/canister/${a.toText()}/call`,this.host),Object.assign(Object.assign(Object.assign({},ee(this,An,"f")),y.request),{body:P}))),$=()=>(this.log.print(`fetching "/api/v2/canister/${a.toText()}/call" with request:`,y),ee(this,pr,"f").call(this,""+new URL(`/api/v2/canister/${a.toText()}/call`,this.host),Object.assign(Object.assign(Object.assign({},ee(this,An,"f")),y.request),{body:P}))),D=ee(this,$t,"m",Xi).call(this,{request:s?F:$,backoff:T,tries:0}),[Y,I]=await Promise.all([D,hn(g)]),G=await Y.arrayBuffer(),j=Y.status===200&&G.byteLength>0?gt(G):null;if(j&&"certificate"in j){let Z=await this.parseTimeFromResponse({certificate:j.certificate});nt(this,Sn,Z,"f")}return{requestId:I,response:{ok:Y.ok,status:Y.status,statusText:Y.statusText,body:j,headers:Hr(Y.headers)},requestDetails:g}}catch(F){if(F.message.includes("v3 api not supported."))return this.log.warn("v3 api not supported. Fall back to v2"),this.call(e,Object.assign(Object.assign({},t),{callSync:!1}),n);throw this.log.error("Error while making call:",F),F}}async query(e,t,n){let i=ee(this,Br,"f").call(this),s=t.effectiveCanisterId?me.from(t.effectiveCanisterId):me.from(e);this.log.print(`ecid ${s.toString()}`),this.log.print(`canisterId ${e.toString()}`);let o=async()=>{let _=await(n!==void 0?n:ee(this,Ct,"f"));if(!_)throw new Wr("This identity has expired due this application's security policy. Please refresh your authentication.");let f=me.from(e),P=_?.getPrincipal()||me.anonymous(),T={request_type:"query",canister_id:f,method_name:t.methodName,arg:t.arg,sender:P,ingress_expiry:new lr(ee(this,Sr,"f")*Wi)},F=await hn(T),$=await this._transform({request:{method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},ee(this,Rt,"f")?{Authorization:"Basic "+btoa(ee(this,Rt,"f"))}:{})},endpoint:"read",body:T});$=await _?.transformRequest($);let D=ri($.body),Y={canister:f.toText(),ecid:s,transformedRequest:$,body:D,requestId:F,backoff:i,tries:0};return{requestDetails:T,query:await ee(this,$t,"m",du).call(this,Y)}},c=async()=>{if(!ee(this,Nr,"f"))return;let _=ee(this,Tr,"f").get(s.toString());return _||(await this.fetchSubnetKeys(s.toString()),ee(this,Tr,"f").get(s.toString()))},[a,p]=await Promise.all([o(),c()]),{requestDetails:m,query:g}=a,y=Object.assign(Object.assign({},g),{requestDetails:m});if(this.log.print("Query response:",y),!ee(this,Nr,"f"))return y;try{return ee(this,Qi,"f").call(this,y,p)}catch{this.log.warn("Query response verification failed. Retrying with fresh subnet keys."),ee(this,Tr,"f").delete(e.toString()),await this.fetchSubnetKeys(s.toString());let f=ee(this,Tr,"f").get(e.toString());if(!f)throw new lt("Invalid signature from replica signed query: no matching node key found.");return ee(this,Qi,"f").call(this,y,f)}}async createReadStateRequest(e,t){let n=await(t!==void 0?await t:await ee(this,Ct,"f"));if(!n)throw new Wr("This identity has expired due this application's security policy. Please refresh your authentication.");let i=n?.getPrincipal()||me.anonymous(),s=await this._transform({request:{method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},ee(this,Rt,"f")?{Authorization:"Basic "+btoa(ee(this,Rt,"f"))}:{})},endpoint:"read_state",body:{request_type:"read_state",paths:e.paths,sender:i,ingress_expiry:new lr(ee(this,Sr,"f")*Wi)}});return n?.transformRequest(s)}async readState(e,t,n,i){let s=typeof e=="string"?me.fromText(e):e,o=i??await this.createReadStateRequest(t,n),c=Object.assign(Object.assign({},o.body),{ingress_expiry:new lr(3e5)}),a=ri(c);this.log.print(`fetching "/api/v2/canister/${s}/read_state" with request:`,o);let p=ee(this,Br,"f").call(this);try{let m=await ee(this,$t,"m",Xi).call(this,{request:()=>ee(this,pr,"f").call(this,""+new URL(`/api/v2/canister/${s.toString()}/read_state`,this.host),Object.assign(Object.assign(Object.assign({},ee(this,Zr,"f")),o.request),{body:a})),backoff:p,tries:0});if(!m.ok)throw new Error(`Server returned an error:
|
|
15
|
-
Code: ${m.status} (${m.statusText})
|
|
16
|
-
Body: ${await m.text()}
|
|
17
|
-
`);let g=gt(await m.arrayBuffer());this.log.print("Read state response:",g);let y=await this.parseTimeFromResponse(g);return y>0&&(this.log.print("Read state response time:",y),nt(this,Sn,y,"f")),g}catch(m){throw this.log.error("Caught exception while attempting to read state",m),m}}async parseTimeFromResponse(e){let t;if(e.certificate){let n=gt(e.certificate);if(n&&"tree"in n)t=n.tree;else throw new Error("Could not decode time from response");let i=mr(["time"],t);if(i.status!==Le.Found)throw new Error("Time was not found in the response or was not in its expected format.");if(!(i.value instanceof ArrayBuffer)&&!ArrayBuffer.isView(i))throw new Error("Time was not found in the response or was not in its expected format.");let s=$r(ls(i.value));return this.log.print("Time from response:",s),this.log.print("Time from response in milliseconds:",Number(s)),Number(s)}else this.log.warn("No certificate found in response");return 0}async syncTime(e){let t=await import("./canisterStatus-5OKD4GZC.js"),n=Date.now();try{e||this.log.print("Syncing time with the IC. No canisterId provided, so falling back to ryjl3-tyaaa-aaaaa-aaaba-cai");let s=(await t.request({canisterId:e??me.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:this,paths:["time"]})).get("time");s&&nt(this,Bn,Number(s)-Number(n),"f")}catch(i){this.log.error("Caught exception while attempting to sync time",i)}}async status(){let e=ee(this,Rt,"f")?{Authorization:"Basic "+btoa(ee(this,Rt,"f"))}:{};this.log.print('fetching "/api/v2/status"');let t=ee(this,Br,"f").call(this),n=await ee(this,$t,"m",Xi).call(this,{backoff:t,request:()=>ee(this,pr,"f").call(this,""+new URL("/api/v2/status",this.host),Object.assign({headers:e},ee(this,Zr,"f"))),tries:0});return gt(await n.arrayBuffer())}async fetchRootKey(){if(!ee(this,Ki,"f")){let e=await this.status();this.rootKey=e.root_key,nt(this,Ki,!0,"f")}return this.rootKey}invalidateIdentity(){nt(this,Ct,null,"f")}replaceIdentity(e){nt(this,Ct,Promise.resolve(e),"f")}async fetchSubnetKeys(e){let t=me.from(e),i=(await hu({canisterId:t,paths:["subnet"],agent:this})).get("subnet");if(i&&typeof i=="object"&&"nodeKeys"in i)return ee(this,Tr,"f").set(t.toText(),i),i}_transform(e){let t=Promise.resolve(e);if(e.endpoint==="call")for(let n of ee(this,zr,"f"))t=t.then(i=>n(i).then(s=>s||i));else for(let n of ee(this,Yr,"f"))t=t.then(i=>n(i).then(s=>s||i));return t}};Ct=new WeakMap,pr=new WeakMap,Zr=new WeakMap,An=new WeakMap,Bn=new WeakMap,Rt=new WeakMap,Ki=new WeakMap,Ot=new WeakMap,Br=new WeakMap,Sr=new WeakMap,Sn=new WeakMap,Yr=new WeakMap,zr=new WeakMap,Tr=new WeakMap,Nr=new WeakMap,Qi=new WeakMap,$t=new WeakSet,du=async function r(e){var t,n;let{ecid:i,transformedRequest:s,body:o,requestId:c,backoff:a,tries:p}=e,m=p===0?0:a.next();if(this.log.print(`fetching "/api/v2/canister/${i.toString()}/query" with tries:`,{tries:p,backoff:a,delay:m}),m===null)throw new Ye(`Timestamp failed to pass the watermark after retrying the configured ${ee(this,Ot,"f")} times. We cannot guarantee the integrity of the response since it could be a replay attack.`);m>0&&await new Promise(f=>setTimeout(f,m));let g;try{this.log.print(`fetching "/api/v2/canister/${i.toString()}/query" with request:`,s);let f=await ee(this,pr,"f").call(this,""+new URL(`/api/v2/canister/${i.toString()}/query`,this.host),Object.assign(Object.assign(Object.assign({},ee(this,Zr,"f")),s.request),{body:o}));if(f.status===200){let P=gt(await f.arrayBuffer());g=Object.assign(Object.assign({},P),{httpDetails:{ok:f.ok,status:f.status,statusText:f.statusText,headers:Hr(f.headers)},requestId:c})}else throw new Vr(`Gateway returned an error:
|
|
18
|
-
Code: ${f.status} (${f.statusText})
|
|
19
|
-
Body: ${await f.text()}
|
|
20
|
-
`,{ok:f.ok,status:f.status,statusText:f.statusText,headers:Hr(f.headers)})}catch(f){if(p<ee(this,Ot,"f"))return this.log.warn(`Caught exception while attempting to make query:
|
|
21
|
-
${f}
|
|
22
|
-
Retrying query.`),await ee(this,$t,"m",r).call(this,Object.assign(Object.assign({},e),{tries:p+1}));throw f}let y=(n=(t=g.signatures)===null||t===void 0?void 0:t[0])===null||n===void 0?void 0:n.timestamp;if(!ee(this,Nr,"f"))return g;if(!y)throw new Error("Timestamp not found in query response. This suggests a malformed or malicious response.");let _=Number(BigInt(y)/BigInt(1e6));if(this.log.print("watermark and timestamp",{waterMark:this.waterMark,timestamp:_}),Number(this.waterMark)>_){let f=new Ye("Timestamp is below the watermark. Retrying query.");if(this.log.error("Timestamp is below",f,{timestamp:y,waterMark:this.waterMark}),p<ee(this,Ot,"f"))return await ee(this,$t,"m",r).call(this,Object.assign(Object.assign({},e),{tries:p+1}));throw new Ye(`Timestamp failed to pass the watermark after retrying the configured ${ee(this,Ot,"f")} times. We cannot guarantee the integrity of the response since it could be a replay attack.`)}return g},Xi=async function r(e){let{request:t,backoff:n,tries:i}=e,s=i===0?0:n.next();if(s===null)throw new Ye(`Timestamp failed to pass the watermark after retrying the configured ${ee(this,Ot,"f")} times. We cannot guarantee the integrity of the response since it could be a replay attack.`);s>0&&await new Promise(p=>setTimeout(p,s));let o;try{o=await t()}catch(p){if(ee(this,Ot,"f")>i)return this.log.warn(`Caught exception while attempting to make request:
|
|
23
|
-
${p}
|
|
24
|
-
Retrying request.`),await ee(this,$t,"m",r).call(this,{request:t,backoff:n,tries:i+1});throw p}if(o.ok)return o;let c=await o.clone().text(),a=`Server returned an error:
|
|
25
|
-
Code: ${o.status} (${o.statusText})
|
|
26
|
-
Body: ${c}
|
|
27
|
-
`;if(o.status===404&&o.url.includes("api/v3"))throw new Vr("v3 api not supported. Fall back to v2",{ok:o.ok,status:o.status,statusText:o.statusText,headers:Hr(o.headers)});if(i<ee(this,Ot,"f"))return await ee(this,$t,"m",r).call(this,{request:t,backoff:n,tries:i+1});throw new Vr(a,{ok:o.ok,status:o.status,statusText:o.statusText,headers:Hr(o.headers)})};var mu;(function(r){r.Error="err",r.GetPrincipal="gp",r.GetPrincipalResponse="gpr",r.Query="q",r.QueryResponse="qr",r.Call="c",r.CallResponse="cr",r.ReadState="rs",r.ReadStateResponse="rsr",r.Status="s",r.StatusResponse="sr"})(mu||(mu={}));function A1(){let r=typeof window>"u"?typeof globalThis>"u"?typeof self>"u"?void 0:self.ic.agent:globalThis.ic.agent:window.ic.agent;if(!r)throw new Error("No Agent could be found.");return r}var lt=class extends Ye{constructor(e){super(`Invalid certificate: ${e}`)}},ht;(function(r){r[r.Empty=0]="Empty",r[r.Fork=1]="Fork",r[r.Labeled=2]="Labeled",r[r.Leaf=3]="Leaf",r[r.Pruned=4]="Pruned"})(ht||(ht={}));function sh(r,e){let t=new Uint8Array(r),n=new Uint8Array(e);for(let i=0;i<t.length;i++)if(t[i]>n[i])return!0;return!1}var ts=class r{constructor(e,t,n,i,s=5){this._rootKey=t,this._canisterId=n,this._blsVerify=i,this._maxAgeInMinutes=s,this.cert=gt(new Uint8Array(e))}static async create(e){let t=r.createUnverified(e);return await t.verify(),t}static createUnverified(e){let t=e.blsVerify;return t||(t=jc),new r(e.certificate,e.rootKey,e.canisterId,t,e.maxAgeInMinutes)}lookup(e){return mr(e,this.cert.tree)}lookup_label(e){return this.lookup([e])}async verify(){let e=await Ji(this.cert.tree),t=await this._checkDelegationAndGetKey(this.cert.delegation),n=this.cert.signature,i=ah(t),s=Ke(Rn("ic-state-root"),e),o=!1,c=rs(this.lookup(["time"]));if(!c)throw new lt("Certificate does not contain a time");let a=5*60*1e3,p=this._maxAgeInMinutes*60*1e3,m=Date.now(),g=m-p,y=m+a,_=$r(c);if(_.getTime()<g)throw new lt(`Certificate is signed more than ${this._maxAgeInMinutes} minutes in the past. Certificate time: `+_.toISOString()+" Current time: "+new Date(m).toISOString());if(_.getTime()>y)throw new lt("Certificate is signed more than 5 minutes in the future. Certificate time: "+_.toISOString()+" Current time: "+new Date(m).toISOString());try{o=await this._blsVerify(new Uint8Array(i),new Uint8Array(n),new Uint8Array(s))}catch{o=!1}if(!o)throw new lt("Signature verification failed")}async _checkDelegationAndGetKey(e){if(!e)return this._rootKey;let t=await r.createUnverified({certificate:e.certificate,rootKey:this._rootKey,canisterId:this._canisterId,blsVerify:this._blsVerify,maxAgeInMinutes:1/0});if(t.cert.delegation)throw new lt("Delegation certificates cannot be nested");if(await t.verify(),this._canisterId.toString()!==pu&&!To({canisterId:this._canisterId,subnetId:me.fromUint8Array(new Uint8Array(e.subnet_id)),tree:t.cert.tree}))throw new lt(`Canister ${this._canisterId} not in range of delegations for subnet 0x${ct(e.subnet_id)}`);let n=rs(t.lookup(["subnet",e.subnet_id,"public_key"]));if(!n)throw new Error(`Could not find subnet key for subnet 0x${ct(e.subnet_id)}`);return n}},Nn=yr("308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100"),oh=96;function ah(r){let e=Nn.byteLength+oh;if(r.byteLength!==e)throw new TypeError(`BLS DER-encoded public key must be ${e} bytes long`);let t=r.slice(0,Nn.byteLength);if(!tn(t,Nn))throw new TypeError(`BLS DER-encoded public key is invalid. Expect the following prefix: ${Nn}, but get ${t}`);return r.slice(Nn.byteLength)}function rs(r){if(r.status===Le.Found){if(r.value instanceof ArrayBuffer)return r.value;if(r.value instanceof Uint8Array)return r.value.buffer}}async function Ji(r){switch(r[0]){case ht.Empty:return bt(Rn("ic-hashtree-empty"));case ht.Pruned:return r[1];case ht.Leaf:return bt(Ke(Rn("ic-hashtree-leaf"),r[1]));case ht.Labeled:return bt(Ke(Rn("ic-hashtree-labeled"),r[1],await Ji(r[2])));case ht.Fork:return bt(Ke(Rn("ic-hashtree-fork"),await Ji(r[1]),await Ji(r[2])));default:throw new Error("unreachable")}}function Rn(r){let e=new Uint8Array([r.length]),t=new TextEncoder().encode(r);return Ke(e,t)}var Le;(function(r){r.Unknown="unknown",r.Absent="absent",r.Found="found"})(Le||(Le={}));var Kt;(function(r){r.Less="less",r.Greater="greater"})(Kt||(Kt={}));function mr(r,e){if(r.length===0)switch(e[0]){case ht.Leaf:{if(!e[1])throw new Error("Invalid tree structure for leaf");return e[1]instanceof ArrayBuffer?{status:Le.Found,value:e[1]}:e[1]instanceof Uint8Array?{status:Le.Found,value:e[1].buffer}:{status:Le.Found,value:e[1]}}default:return{status:Le.Found,value:e}}let t=typeof r[0]=="string"?new TextEncoder().encode(r[0]):r[0],n=es(t,e);switch(n.status){case Le.Found:return mr(r.slice(1),n.value);case Kt.Greater:case Kt.Less:return{status:Le.Absent};default:return n}}function ns(r){switch(r[0]){case ht.Empty:return[];case ht.Fork:return ns(r[1]).concat(ns(r[2]));default:return[r]}}function es(r,e){switch(e[0]){case ht.Labeled:return sh(r,e[1])?{status:Kt.Greater}:tn(r,e[1])?{status:Le.Found,value:e[2]}:{status:Kt.Less};case ht.Fork:let t=es(r,e[1]);switch(t.status){case Kt.Greater:{let n=es(r,e[2]);return n.status===Kt.Less?{status:Le.Absent}:n}case Le.Unknown:{let n=es(r,e[2]);return n.status===Kt.Less?{status:Le.Unknown}:n}default:return t}case ht.Pruned:return{status:Le.Unknown};default:return{status:Le.Absent}}}function To(r){let{canisterId:e,subnetId:t,tree:n}=r,i=mr(["subnet",t.toUint8Array(),"canister_ranges"],n);if(i.status!==Le.Found||!(i.value instanceof ArrayBuffer))throw new Error(`Could not find canister ranges for subnet ${t}`);return gt(i.value).map(a=>[me.fromUint8Array(a[0]),me.fromUint8Array(a[1])]).some(a=>a[0].ltEq(e)&&a[1].gtEq(e))}var gu=class{constructor(e,t,n){this.key=e,this.path=t,this.decodeStrategy=n}},hu=async r=>{let{agent:e,paths:t}=r,n=me.from(r.canisterId),i=[...new Set(t)],s=i.map(a=>bu(a,n)),o=new Map,c=i.map((a,p)=>(async()=>{var m;try{let g=await e.readState(n,{paths:[s[p]]}),y=await ts.create({certificate:g.certificate,rootKey:e.rootKey,canisterId:n}),_=(T,F)=>{if(F==="subnet"){let $=ch(g.certificate,n,e.rootKey);return{path:F,data:$}}else return{path:F,data:rs(T.lookup(bu(F,n)))}},{path:f,data:P}=_(y,i[p]);if(!P)console.warn(`Expected to find result for path ${f}, but instead found nothing.`),typeof f=="string"?o.set(f,null):o.set(f.key,null);else switch(f){case"time":{o.set(f,$r(P));break}case"controllers":{o.set(f,fh(P));break}case"module_hash":{o.set(f,wu(P));break}case"subnet":{o.set(f,P);break}case"candid":{o.set(f,new TextDecoder().decode(P));break}default:if(typeof f!="string"&&"key"in f&&"path"in f)switch(f.decodeStrategy){case"raw":o.set(f.key,P);break;case"leb128":{o.set(f.key,xo(P));break}case"cbor":{o.set(f.key,yu(P));break}case"hex":{o.set(f.key,wu(P));break}case"utf-8":o.set(f.key,uh(P))}}}catch(g){if(!((m=g?.message)===null||m===void 0)&&m.includes("Invalid certificate"))throw new Ye(g.message);typeof a!="string"&&"key"in a&&"path"in a?o.set(a.key,null):o.set(a,null),console.group(),console.warn(`Expected to find result for path ${a}, but instead found nothing.`),console.warn(g),console.groupEnd()}})());return await Promise.all(c),o},ch=(r,e,t)=>{if(!e._isPrincipal)throw new Error("Invalid canisterId");let n=gt(new Uint8Array(r)),i=n.tree,s=n.delegation,o;if(s&&s.subnet_id?o=me.fromUint8Array(new Uint8Array(s.subnet_id)):!s&&typeof t<"u"?(o=me.selfAuthenticating(new Uint8Array(t)),s={subnet_id:o.toUint8Array(),certificate:new ArrayBuffer(0)}):(o=me.selfAuthenticating(me.fromText("tdb26-jop6k-aogll-7ltgs-eruif-6kk7m-qpktf-gdiqx-mxtrf-vb5e6-eqe").toUint8Array()),s={subnet_id:o.toUint8Array(),certificate:new ArrayBuffer(0)}),!To({canisterId:e,subnetId:o,tree:i}))throw new Error("Canister not in range");let a=mr(["subnet",s.subnet_id,"node"],i);if(a.status!==Le.Found)throw new Error("Node not found");if(a.value instanceof ArrayBuffer)throw new Error("Invalid node tree");let p=ns(a.value),m=new Map;return p.forEach(g=>{let y=me.from(new Uint8Array(g[1])).toText(),_=mr(["public_key"],g[2]);if(_.status!==Le.Found)throw new Error("Public key not found");let f=_.value;if(f.byteLength!==44)throw new Error("Invalid public key length");m.set(y,f)}),{subnetId:me.fromUint8Array(new Uint8Array(s.subnet_id)).toText(),nodeKeys:m}},bu=(r,e)=>{let t=new TextEncoder,n=s=>new DataView(t.encode(s).buffer).buffer,i=new DataView(e.toUint8Array().buffer).buffer;switch(r){case"time":return[n("time")];case"controllers":return[n("canister"),i,n("controllers")];case"module_hash":return[n("canister"),i,n("module_hash")];case"subnet":return[n("subnet")];case"candid":return[n("canister"),i,n("metadata"),n("candid:service")];default:if("key"in r&&"path"in r)if(typeof r.path=="string"||r.path instanceof ArrayBuffer){let s=r.path,o=typeof s=="string"?n(s):s;return[n("canister"),i,n("metadata"),o]}else return r.path}throw new Error(`An unexpeected error was encountered while encoding your path for canister status. Please ensure that your path, ${r} was formatted correctly.`)},wu=r=>ct(r),yu=r=>gt(r),uh=r=>new TextDecoder().decode(r),fh=r=>yu(r).map(t=>me.fromUint8Array(new Uint8Array(t)));export{je as a,is as b,Xr as c,aa as d,us as e,me as f,ct as g,yr as h,tn as i,en as j,ls as k,Ye as l,Ys as m,Xs as n,Ps as o,hn as p,Yc as q,Pi as r,ei as s,lr as t,ts as u,rs as v,gu as w,hu as x,ch as y,bu as z,eu as A,Bo as B,ou as C,au as D,fu as E,lu as F,A1 as G};
|
|
28
|
-
/*!
|
|
29
|
-
* The buffer module from node.js, for the browser.
|
|
30
|
-
*
|
|
31
|
-
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
32
|
-
* @license MIT
|
|
33
|
-
*/
|
|
34
|
-
/*! Bundled license information:
|
|
35
|
-
|
|
36
|
-
ieee754/index.js:
|
|
37
|
-
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
38
|
-
|
|
39
|
-
@noble/hashes/esm/utils.js:
|
|
40
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
41
|
-
|
|
42
|
-
@noble/curves/esm/abstract/utils.js:
|
|
43
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
44
|
-
|
|
45
|
-
@noble/curves/esm/abstract/modular.js:
|
|
46
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
47
|
-
|
|
48
|
-
@noble/curves/esm/abstract/curve.js:
|
|
49
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
50
|
-
|
|
51
|
-
@noble/curves/esm/abstract/weierstrass.js:
|
|
52
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
53
|
-
|
|
54
|
-
@noble/curves/esm/abstract/bls.js:
|
|
55
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
56
|
-
|
|
57
|
-
@noble/curves/esm/abstract/tower.js:
|
|
58
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
59
|
-
|
|
60
|
-
@noble/curves/esm/bls12-381.js:
|
|
61
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
62
|
-
|
|
63
|
-
@noble/curves/esm/abstract/edwards.js:
|
|
64
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
65
|
-
|
|
66
|
-
@noble/curves/esm/ed25519.js:
|
|
67
|
-
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
68
|
-
*/
|
|
69
|
-
//# sourceMappingURL=chunk-YQER5335.js.map
|