droplinked-web3-kit 0.0.21 → 0.0.23

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/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  */(function(Ie){const Fe=n,Le=ke,He=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ie.Buffer=se,Ie.SlowBuffer=Ne,Ie.INSPECT_MAX_BYTES=50;const ze=2147483647;Ie.kMaxLength=ze;const{Uint8Array:Je,ArrayBuffer:Xe,SharedArrayBuffer:Ue}=globalThis;se.TYPED_ARRAY_SUPPORT=$t(),!se.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function $t(){try{const Qe=new Je(1),Ke={foo:function(){return 42}};return Object.setPrototypeOf(Ke,Je.prototype),Object.setPrototypeOf(Qe,Ke),Qe.foo()===42}catch{return!1}}Object.defineProperty(se.prototype,"parent",{enumerable:!0,get:function(){if(se.isBuffer(this))return this.buffer}}),Object.defineProperty(se.prototype,"offset",{enumerable:!0,get:function(){if(se.isBuffer(this))return this.byteOffset}});function _e(Qe){if(Qe>ze)throw new RangeError('The value "'+Qe+'" is invalid for option "size"');const Ke=new Je(Qe);return Object.setPrototypeOf(Ke,se.prototype),Ke}function se(Qe,Ke,Ye){if(typeof Qe=="number"){if(typeof Ke=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ve(Qe)}return ce(Qe,Ke,Ye)}se.poolSize=8192;function ce(Qe,Ke,Ye){if(typeof Qe=="string")return we(Qe,Ke);if(Xe.isView(Qe))return be(Qe);if(Qe==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Qe);if(hn(Qe,Xe)||Qe&&hn(Qe.buffer,Xe)||typeof Ue<"u"&&(hn(Qe,Ue)||Qe&&hn(Qe.buffer,Ue)))return ue(Qe,Ke,Ye);if(typeof Qe=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Pt=Qe.valueOf&&Qe.valueOf();if(Pt!=null&&Pt!==Qe)return se.from(Pt,Ke,Ye);const Gt=ge(Qe);if(Gt)return Gt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Qe[Symbol.toPrimitive]=="function")return se.from(Qe[Symbol.toPrimitive]("string"),Ke,Ye);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Qe)}se.from=function(Qe,Ke,Ye){return ce(Qe,Ke,Ye)},Object.setPrototypeOf(se.prototype,Je.prototype),Object.setPrototypeOf(se,Je);function de(Qe){if(typeof Qe!="number")throw new TypeError('"size" argument must be of type number');if(Qe<0)throw new RangeError('The value "'+Qe+'" is invalid for option "size"')}function he(Qe,Ke,Ye){return de(Qe),Qe<=0?_e(Qe):Ke!==void 0?typeof Ye=="string"?_e(Qe).fill(Ke,Ye):_e(Qe).fill(Ke):_e(Qe)}se.alloc=function(Qe,Ke,Ye){return he(Qe,Ke,Ye)};function ve(Qe){return de(Qe),_e(Qe<0?0:Re(Qe)|0)}se.allocUnsafe=function(Qe){return ve(Qe)},se.allocUnsafeSlow=function(Qe){return ve(Qe)};function we(Qe,Ke){if((typeof Ke!="string"||Ke==="")&&(Ke="utf8"),!se.isEncoding(Ke))throw new TypeError("Unknown encoding: "+Ke);const Ye=qe(Qe,Ke)|0;let Pt=_e(Ye);const Gt=Pt.write(Qe,Ke);return Gt!==Ye&&(Pt=Pt.slice(0,Gt)),Pt}function Ae(Qe){const Ke=Qe.length<0?0:Re(Qe.length)|0,Ye=_e(Ke);for(let Pt=0;Pt<Ke;Pt+=1)Ye[Pt]=Qe[Pt]&255;return Ye}function be(Qe){if(hn(Qe,Je)){const Ke=new Je(Qe);return ue(Ke.buffer,Ke.byteOffset,Ke.byteLength)}return Ae(Qe)}function ue(Qe,Ke,Ye){if(Ke<0||Qe.byteLength<Ke)throw new RangeError('"offset" is outside of buffer bounds');if(Qe.byteLength<Ke+(Ye||0))throw new RangeError('"length" is outside of buffer bounds');let Pt;return Ke===void 0&&Ye===void 0?Pt=new Je(Qe):Ye===void 0?Pt=new Je(Qe,Ke):Pt=new Je(Qe,Ke,Ye),Object.setPrototypeOf(Pt,se.prototype),Pt}function ge(Qe){if(se.isBuffer(Qe)){const Ke=Re(Qe.length)|0,Ye=_e(Ke);return Ye.length===0||Qe.copy(Ye,0,0,Ke),Ye}if(Qe.length!==void 0)return typeof Qe.length!="number"||Cn(Qe.length)?_e(0):Ae(Qe);if(Qe.type==="Buffer"&&Array.isArray(Qe.data))return Ae(Qe.data)}function Re(Qe){if(Qe>=ze)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ze.toString(16)+" bytes");return Qe|0}function Ne(Qe){return+Qe!=Qe&&(Qe=0),se.alloc(+Qe)}se.isBuffer=function(Ke){return Ke!=null&&Ke._isBuffer===!0&&Ke!==se.prototype},se.compare=function(Ke,Ye){if(hn(Ke,Je)&&(Ke=se.from(Ke,Ke.offset,Ke.byteLength)),hn(Ye,Je)&&(Ye=se.from(Ye,Ye.offset,Ye.byteLength)),!se.isBuffer(Ke)||!se.isBuffer(Ye))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Ke===Ye)return 0;let Pt=Ke.length,Gt=Ye.length;for(let gn=0,Yt=Math.min(Pt,Gt);gn<Yt;++gn)if(Ke[gn]!==Ye[gn]){Pt=Ke[gn],Gt=Ye[gn];break}return Pt<Gt?-1:Gt<Pt?1:0},se.isEncoding=function(Ke){switch(String(Ke).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}},se.concat=function(Ke,Ye){if(!Array.isArray(Ke))throw new TypeError('"list" argument must be an Array of Buffers');if(Ke.length===0)return se.alloc(0);let Pt;if(Ye===void 0)for(Ye=0,Pt=0;Pt<Ke.length;++Pt)Ye+=Ke[Pt].length;const Gt=se.allocUnsafe(Ye);let gn=0;for(Pt=0;Pt<Ke.length;++Pt){let Yt=Ke[Pt];if(hn(Yt,Je))gn+Yt.length>Gt.length?(se.isBuffer(Yt)||(Yt=se.from(Yt)),Yt.copy(Gt,gn)):Je.prototype.set.call(Gt,Yt,gn);else if(se.isBuffer(Yt))Yt.copy(Gt,gn);else throw new TypeError('"list" argument must be an Array of Buffers');gn+=Yt.length}return Gt};function qe(Qe,Ke){if(se.isBuffer(Qe))return Qe.length;if(Xe.isView(Qe)||hn(Qe,Xe))return Qe.byteLength;if(typeof Qe!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Qe);const Ye=Qe.length,Pt=arguments.length>2&&arguments[2]===!0;if(!Pt&&Ye===0)return 0;let Gt=!1;for(;;)switch(Ke){case"ascii":case"latin1":case"binary":return Ye;case"utf8":case"utf-8":return Mn(Qe).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ye*2;case"hex":return Ye>>>1;case"base64":return Bn(Qe).length;default:if(Gt)return Pt?-1:Mn(Qe).length;Ke=(""+Ke).toLowerCase(),Gt=!0}}se.byteLength=qe;function Pe(Qe,Ke,Ye){let Pt=!1;if((Ke===void 0||Ke<0)&&(Ke=0),Ke>this.length||((Ye===void 0||Ye>this.length)&&(Ye=this.length),Ye<=0)||(Ye>>>=0,Ke>>>=0,Ye<=Ke))return"";for(Qe||(Qe="utf8");;)switch(Qe){case"hex":return En(this,Ke,Ye);case"utf8":case"utf-8":return Dt(this,Ke,Ye);case"ascii":return Vt(this,Ke,Ye);case"latin1":case"binary":return Kt(this,Ke,Ye);case"base64":return jt(this,Ke,Ye);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return en(this,Ke,Ye);default:if(Pt)throw new TypeError("Unknown encoding: "+Qe);Qe=(Qe+"").toLowerCase(),Pt=!0}}se.prototype._isBuffer=!0;function Ge(Qe,Ke,Ye){const Pt=Qe[Ke];Qe[Ke]=Qe[Ye],Qe[Ye]=Pt}se.prototype.swap16=function(){const Ke=this.length;if(Ke%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let Ye=0;Ye<Ke;Ye+=2)Ge(this,Ye,Ye+1);return this},se.prototype.swap32=function(){const Ke=this.length;if(Ke%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let Ye=0;Ye<Ke;Ye+=4)Ge(this,Ye,Ye+3),Ge(this,Ye+1,Ye+2);return this},se.prototype.swap64=function(){const Ke=this.length;if(Ke%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let Ye=0;Ye<Ke;Ye+=8)Ge(this,Ye,Ye+7),Ge(this,Ye+1,Ye+6),Ge(this,Ye+2,Ye+5),Ge(this,Ye+3,Ye+4);return this},se.prototype.toString=function(){const Ke=this.length;return Ke===0?"":arguments.length===0?Dt(this,0,Ke):Pe.apply(this,arguments)},se.prototype.toLocaleString=se.prototype.toString,se.prototype.equals=function(Ke){if(!se.isBuffer(Ke))throw new TypeError("Argument must be a Buffer");return this===Ke?!0:se.compare(this,Ke)===0},se.prototype.inspect=function(){let Ke="";const Ye=Ie.INSPECT_MAX_BYTES;return Ke=this.toString("hex",0,Ye).replace(/(.{2})/g,"$1 ").trim(),this.length>Ye&&(Ke+=" ... "),"<Buffer "+Ke+">"},He&&(se.prototype[He]=se.prototype.inspect),se.prototype.compare=function(Ke,Ye,Pt,Gt,gn){if(hn(Ke,Je)&&(Ke=se.from(Ke,Ke.offset,Ke.byteLength)),!se.isBuffer(Ke))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Ke);if(Ye===void 0&&(Ye=0),Pt===void 0&&(Pt=Ke?Ke.length:0),Gt===void 0&&(Gt=0),gn===void 0&&(gn=this.length),Ye<0||Pt>Ke.length||Gt<0||gn>this.length)throw new RangeError("out of range index");if(Gt>=gn&&Ye>=Pt)return 0;if(Gt>=gn)return-1;if(Ye>=Pt)return 1;if(Ye>>>=0,Pt>>>=0,Gt>>>=0,gn>>>=0,this===Ke)return 0;let Yt=gn-Gt,cn=Pt-Ye;const $n=Math.min(Yt,cn),fn=this.slice(Gt,gn),pn=Ke.slice(Ye,Pt);for(let Rn=0;Rn<$n;++Rn)if(fn[Rn]!==pn[Rn]){Yt=fn[Rn],cn=pn[Rn];break}return Yt<cn?-1:cn<Yt?1:0};function Ce(Qe,Ke,Ye,Pt,Gt){if(Qe.length===0)return-1;if(typeof Ye=="string"?(Pt=Ye,Ye=0):Ye>2147483647?Ye=2147483647:Ye<-2147483648&&(Ye=-2147483648),Ye=+Ye,Cn(Ye)&&(Ye=Gt?0:Qe.length-1),Ye<0&&(Ye=Qe.length+Ye),Ye>=Qe.length){if(Gt)return-1;Ye=Qe.length-1}else if(Ye<0)if(Gt)Ye=0;else return-1;if(typeof Ke=="string"&&(Ke=se.from(Ke,Pt)),se.isBuffer(Ke))return Ke.length===0?-1:De(Qe,Ke,Ye,Pt,Gt);if(typeof Ke=="number")return Ke=Ke&255,typeof Je.prototype.indexOf=="function"?Gt?Je.prototype.indexOf.call(Qe,Ke,Ye):Je.prototype.lastIndexOf.call(Qe,Ke,Ye):De(Qe,[Ke],Ye,Pt,Gt);throw new TypeError("val must be string, number or Buffer")}function De(Qe,Ke,Ye,Pt,Gt){let gn=1,Yt=Qe.length,cn=Ke.length;if(Pt!==void 0&&(Pt=String(Pt).toLowerCase(),Pt==="ucs2"||Pt==="ucs-2"||Pt==="utf16le"||Pt==="utf-16le")){if(Qe.length<2||Ke.length<2)return-1;gn=2,Yt/=2,cn/=2,Ye/=2}function $n(pn,Rn){return gn===1?pn[Rn]:pn.readUInt16BE(Rn*gn)}let fn;if(Gt){let pn=-1;for(fn=Ye;fn<Yt;fn++)if($n(Qe,fn)===$n(Ke,pn===-1?0:fn-pn)){if(pn===-1&&(pn=fn),fn-pn+1===cn)return pn*gn}else pn!==-1&&(fn-=fn-pn),pn=-1}else for(Ye+cn>Yt&&(Ye=Yt-cn),fn=Ye;fn>=0;fn--){let pn=!0;for(let Rn=0;Rn<cn;Rn++)if($n(Qe,fn+Rn)!==$n(Ke,Rn)){pn=!1;break}if(pn)return fn}return-1}se.prototype.includes=function(Ke,Ye,Pt){return this.indexOf(Ke,Ye,Pt)!==-1},se.prototype.indexOf=function(Ke,Ye,Pt){return Ce(this,Ke,Ye,Pt,!0)},se.prototype.lastIndexOf=function(Ke,Ye,Pt){return Ce(this,Ke,Ye,Pt,!1)};function je(Qe,Ke,Ye,Pt){Ye=Number(Ye)||0;const Gt=Qe.length-Ye;Pt?(Pt=Number(Pt),Pt>Gt&&(Pt=Gt)):Pt=Gt;const gn=Ke.length;Pt>gn/2&&(Pt=gn/2);let Yt;for(Yt=0;Yt<Pt;++Yt){const cn=parseInt(Ke.substr(Yt*2,2),16);if(Cn(cn))return Yt;Qe[Ye+Yt]=cn}return Yt}function Ve(Qe,Ke,Ye,Pt){return un(Mn(Ke,Qe.length-Ye),Qe,Ye,Pt)}function Mt(Qe,Ke,Ye,Pt){return un(sn(Ke),Qe,Ye,Pt)}function Oe(Qe,Ke,Ye,Pt){return un(Bn(Ke),Qe,Ye,Pt)}function We(Qe,Ke,Ye,Pt){return un(ln(Ke,Qe.length-Ye),Qe,Ye,Pt)}se.prototype.write=function(Ke,Ye,Pt,Gt){if(Ye===void 0)Gt="utf8",Pt=this.length,Ye=0;else if(Pt===void 0&&typeof Ye=="string")Gt=Ye,Pt=this.length,Ye=0;else if(isFinite(Ye))Ye=Ye>>>0,isFinite(Pt)?(Pt=Pt>>>0,Gt===void 0&&(Gt="utf8")):(Gt=Pt,Pt=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const gn=this.length-Ye;if((Pt===void 0||Pt>gn)&&(Pt=gn),Ke.length>0&&(Pt<0||Ye<0)||Ye>this.length)throw new RangeError("Attempt to write outside buffer bounds");Gt||(Gt="utf8");let Yt=!1;for(;;)switch(Gt){case"hex":return je(this,Ke,Ye,Pt);case"utf8":case"utf-8":return Ve(this,Ke,Ye,Pt);case"ascii":case"latin1":case"binary":return Mt(this,Ke,Ye,Pt);case"base64":return Oe(this,Ke,Ye,Pt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return We(this,Ke,Ye,Pt);default:if(Yt)throw new TypeError("Unknown encoding: "+Gt);Gt=(""+Gt).toLowerCase(),Yt=!0}},se.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function jt(Qe,Ke,Ye){return Ke===0&&Ye===Qe.length?Fe.fromByteArray(Qe):Fe.fromByteArray(Qe.slice(Ke,Ye))}function Dt(Qe,Ke,Ye){Ye=Math.min(Qe.length,Ye);const Pt=[];let Gt=Ke;for(;Gt<Ye;){const gn=Qe[Gt];let Yt=null,cn=gn>239?4:gn>223?3:gn>191?2:1;if(Gt+cn<=Ye){let $n,fn,pn,Rn;switch(cn){case 1:gn<128&&(Yt=gn);break;case 2:$n=Qe[Gt+1],($n&192)===128&&(Rn=(gn&31)<<6|$n&63,Rn>127&&(Yt=Rn));break;case 3:$n=Qe[Gt+1],fn=Qe[Gt+2],($n&192)===128&&(fn&192)===128&&(Rn=(gn&15)<<12|($n&63)<<6|fn&63,Rn>2047&&(Rn<55296||Rn>57343)&&(Yt=Rn));break;case 4:$n=Qe[Gt+1],fn=Qe[Gt+2],pn=Qe[Gt+3],($n&192)===128&&(fn&192)===128&&(pn&192)===128&&(Rn=(gn&15)<<18|($n&63)<<12|(fn&63)<<6|pn&63,Rn>65535&&Rn<1114112&&(Yt=Rn))}}Yt===null?(Yt=65533,cn=1):Yt>65535&&(Yt-=65536,Pt.push(Yt>>>10&1023|55296),Yt=56320|Yt&1023),Pt.push(Yt),Gt+=cn}return vn(Pt)}const Ht=4096;function vn(Qe){const Ke=Qe.length;if(Ke<=Ht)return String.fromCharCode.apply(String,Qe);let Ye="",Pt=0;for(;Pt<Ke;)Ye+=String.fromCharCode.apply(String,Qe.slice(Pt,Pt+=Ht));return Ye}function Vt(Qe,Ke,Ye){let Pt="";Ye=Math.min(Qe.length,Ye);for(let Gt=Ke;Gt<Ye;++Gt)Pt+=String.fromCharCode(Qe[Gt]&127);return Pt}function Kt(Qe,Ke,Ye){let Pt="";Ye=Math.min(Qe.length,Ye);for(let Gt=Ke;Gt<Ye;++Gt)Pt+=String.fromCharCode(Qe[Gt]);return Pt}function En(Qe,Ke,Ye){const Pt=Qe.length;(!Ke||Ke<0)&&(Ke=0),(!Ye||Ye<0||Ye>Pt)&&(Ye=Pt);let Gt="";for(let gn=Ke;gn<Ye;++gn)Gt+=yn[Qe[gn]];return Gt}function en(Qe,Ke,Ye){const Pt=Qe.slice(Ke,Ye);let Gt="";for(let gn=0;gn<Pt.length-1;gn+=2)Gt+=String.fromCharCode(Pt[gn]+Pt[gn+1]*256);return Gt}se.prototype.slice=function(Ke,Ye){const Pt=this.length;Ke=~~Ke,Ye=Ye===void 0?Pt:~~Ye,Ke<0?(Ke+=Pt,Ke<0&&(Ke=0)):Ke>Pt&&(Ke=Pt),Ye<0?(Ye+=Pt,Ye<0&&(Ye=0)):Ye>Pt&&(Ye=Pt),Ye<Ke&&(Ye=Ke);const Gt=this.subarray(Ke,Ye);return Object.setPrototypeOf(Gt,se.prototype),Gt};function Xt(Qe,Ke,Ye){if(Qe%1!==0||Qe<0)throw new RangeError("offset is not uint");if(Qe+Ke>Ye)throw new RangeError("Trying to access beyond buffer length")}se.prototype.readUintLE=se.prototype.readUIntLE=function(Ke,Ye,Pt){Ke=Ke>>>0,Ye=Ye>>>0,Pt||Xt(Ke,Ye,this.length);let Gt=this[Ke],gn=1,Yt=0;for(;++Yt<Ye&&(gn*=256);)Gt+=this[Ke+Yt]*gn;return Gt},se.prototype.readUintBE=se.prototype.readUIntBE=function(Ke,Ye,Pt){Ke=Ke>>>0,Ye=Ye>>>0,Pt||Xt(Ke,Ye,this.length);let Gt=this[Ke+--Ye],gn=1;for(;Ye>0&&(gn*=256);)Gt+=this[Ke+--Ye]*gn;return Gt},se.prototype.readUint8=se.prototype.readUInt8=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,1,this.length),this[Ke]},se.prototype.readUint16LE=se.prototype.readUInt16LE=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,2,this.length),this[Ke]|this[Ke+1]<<8},se.prototype.readUint16BE=se.prototype.readUInt16BE=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,2,this.length),this[Ke]<<8|this[Ke+1]},se.prototype.readUint32LE=se.prototype.readUInt32LE=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,4,this.length),(this[Ke]|this[Ke+1]<<8|this[Ke+2]<<16)+this[Ke+3]*16777216},se.prototype.readUint32BE=se.prototype.readUInt32BE=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,4,this.length),this[Ke]*16777216+(this[Ke+1]<<16|this[Ke+2]<<8|this[Ke+3])},se.prototype.readBigUInt64LE=xn(function(Ke){Ke=Ke>>>0,nn(Ke,"offset");const Ye=this[Ke],Pt=this[Ke+7];(Ye===void 0||Pt===void 0)&&Sn(Ke,this.length-8);const Gt=Ye+this[++Ke]*2**8+this[++Ke]*2**16+this[++Ke]*2**24,gn=this[++Ke]+this[++Ke]*2**8+this[++Ke]*2**16+Pt*2**24;return BigInt(Gt)+(BigInt(gn)<<BigInt(32))}),se.prototype.readBigUInt64BE=xn(function(Ke){Ke=Ke>>>0,nn(Ke,"offset");const Ye=this[Ke],Pt=this[Ke+7];(Ye===void 0||Pt===void 0)&&Sn(Ke,this.length-8);const Gt=Ye*2**24+this[++Ke]*2**16+this[++Ke]*2**8+this[++Ke],gn=this[++Ke]*2**24+this[++Ke]*2**16+this[++Ke]*2**8+Pt;return(BigInt(Gt)<<BigInt(32))+BigInt(gn)}),se.prototype.readIntLE=function(Ke,Ye,Pt){Ke=Ke>>>0,Ye=Ye>>>0,Pt||Xt(Ke,Ye,this.length);let Gt=this[Ke],gn=1,Yt=0;for(;++Yt<Ye&&(gn*=256);)Gt+=this[Ke+Yt]*gn;return gn*=128,Gt>=gn&&(Gt-=Math.pow(2,8*Ye)),Gt},se.prototype.readIntBE=function(Ke,Ye,Pt){Ke=Ke>>>0,Ye=Ye>>>0,Pt||Xt(Ke,Ye,this.length);let Gt=Ye,gn=1,Yt=this[Ke+--Gt];for(;Gt>0&&(gn*=256);)Yt+=this[Ke+--Gt]*gn;return gn*=128,Yt>=gn&&(Yt-=Math.pow(2,8*Ye)),Yt},se.prototype.readInt8=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,1,this.length),this[Ke]&128?(255-this[Ke]+1)*-1:this[Ke]},se.prototype.readInt16LE=function(Ke,Ye){Ke=Ke>>>0,Ye||Xt(Ke,2,this.length);const Pt=this[Ke]|this[Ke+1]<<8;return Pt&32768?Pt|4294901760:Pt},se.prototype.readInt16BE=function(Ke,Ye){Ke=Ke>>>0,Ye||Xt(Ke,2,this.length);const Pt=this[Ke+1]|this[Ke]<<8;return Pt&32768?Pt|4294901760:Pt},se.prototype.readInt32LE=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,4,this.length),this[Ke]|this[Ke+1]<<8|this[Ke+2]<<16|this[Ke+3]<<24},se.prototype.readInt32BE=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,4,this.length),this[Ke]<<24|this[Ke+1]<<16|this[Ke+2]<<8|this[Ke+3]},se.prototype.readBigInt64LE=xn(function(Ke){Ke=Ke>>>0,nn(Ke,"offset");const Ye=this[Ke],Pt=this[Ke+7];(Ye===void 0||Pt===void 0)&&Sn(Ke,this.length-8);const Gt=this[Ke+4]+this[Ke+5]*2**8+this[Ke+6]*2**16+(Pt<<24);return(BigInt(Gt)<<BigInt(32))+BigInt(Ye+this[++Ke]*2**8+this[++Ke]*2**16+this[++Ke]*2**24)}),se.prototype.readBigInt64BE=xn(function(Ke){Ke=Ke>>>0,nn(Ke,"offset");const Ye=this[Ke],Pt=this[Ke+7];(Ye===void 0||Pt===void 0)&&Sn(Ke,this.length-8);const Gt=(Ye<<24)+this[++Ke]*2**16+this[++Ke]*2**8+this[++Ke];return(BigInt(Gt)<<BigInt(32))+BigInt(this[++Ke]*2**24+this[++Ke]*2**16+this[++Ke]*2**8+Pt)}),se.prototype.readFloatLE=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,4,this.length),Le.read(this,Ke,!0,23,4)},se.prototype.readFloatBE=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,4,this.length),Le.read(this,Ke,!1,23,4)},se.prototype.readDoubleLE=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,8,this.length),Le.read(this,Ke,!0,52,8)},se.prototype.readDoubleBE=function(Ke,Ye){return Ke=Ke>>>0,Ye||Xt(Ke,8,this.length),Le.read(this,Ke,!1,52,8)};function _n(Qe,Ke,Ye,Pt,Gt,gn){if(!se.isBuffer(Qe))throw new TypeError('"buffer" argument must be a Buffer instance');if(Ke>Gt||Ke<gn)throw new RangeError('"value" argument is out of bounds');if(Ye+Pt>Qe.length)throw new RangeError("Index out of range")}se.prototype.writeUintLE=se.prototype.writeUIntLE=function(Ke,Ye,Pt,Gt){if(Ke=+Ke,Ye=Ye>>>0,Pt=Pt>>>0,!Gt){const cn=Math.pow(2,8*Pt)-1;_n(this,Ke,Ye,Pt,cn,0)}let gn=1,Yt=0;for(this[Ye]=Ke&255;++Yt<Pt&&(gn*=256);)this[Ye+Yt]=Ke/gn&255;return Ye+Pt},se.prototype.writeUintBE=se.prototype.writeUIntBE=function(Ke,Ye,Pt,Gt){if(Ke=+Ke,Ye=Ye>>>0,Pt=Pt>>>0,!Gt){const cn=Math.pow(2,8*Pt)-1;_n(this,Ke,Ye,Pt,cn,0)}let gn=Pt-1,Yt=1;for(this[Ye+gn]=Ke&255;--gn>=0&&(Yt*=256);)this[Ye+gn]=Ke/Yt&255;return Ye+Pt},se.prototype.writeUint8=se.prototype.writeUInt8=function(Ke,Ye,Pt){return Ke=+Ke,Ye=Ye>>>0,Pt||_n(this,Ke,Ye,1,255,0),this[Ye]=Ke&255,Ye+1},se.prototype.writeUint16LE=se.prototype.writeUInt16LE=function(Ke,Ye,Pt){return Ke=+Ke,Ye=Ye>>>0,Pt||_n(this,Ke,Ye,2,65535,0),this[Ye]=Ke&255,this[Ye+1]=Ke>>>8,Ye+2},se.prototype.writeUint16BE=se.prototype.writeUInt16BE=function(Ke,Ye,Pt){return Ke=+Ke,Ye=Ye>>>0,Pt||_n(this,Ke,Ye,2,65535,0),this[Ye]=Ke>>>8,this[Ye+1]=Ke&255,Ye+2},se.prototype.writeUint32LE=se.prototype.writeUInt32LE=function(Ke,Ye,Pt){return Ke=+Ke,Ye=Ye>>>0,Pt||_n(this,Ke,Ye,4,4294967295,0),this[Ye+3]=Ke>>>24,this[Ye+2]=Ke>>>16,this[Ye+1]=Ke>>>8,this[Ye]=Ke&255,Ye+4},se.prototype.writeUint32BE=se.prototype.writeUInt32BE=function(Ke,Ye,Pt){return Ke=+Ke,Ye=Ye>>>0,Pt||_n(this,Ke,Ye,4,4294967295,0),this[Ye]=Ke>>>24,this[Ye+1]=Ke>>>16,this[Ye+2]=Ke>>>8,this[Ye+3]=Ke&255,Ye+4};function Ze(Qe,Ke,Ye,Pt,Gt){tn(Ke,Pt,Gt,Qe,Ye,7);let gn=Number(Ke&BigInt(4294967295));Qe[Ye++]=gn,gn=gn>>8,Qe[Ye++]=gn,gn=gn>>8,Qe[Ye++]=gn,gn=gn>>8,Qe[Ye++]=gn;let Yt=Number(Ke>>BigInt(32)&BigInt(4294967295));return Qe[Ye++]=Yt,Yt=Yt>>8,Qe[Ye++]=Yt,Yt=Yt>>8,Qe[Ye++]=Yt,Yt=Yt>>8,Qe[Ye++]=Yt,Ye}function Rt(Qe,Ke,Ye,Pt,Gt){tn(Ke,Pt,Gt,Qe,Ye,7);let gn=Number(Ke&BigInt(4294967295));Qe[Ye+7]=gn,gn=gn>>8,Qe[Ye+6]=gn,gn=gn>>8,Qe[Ye+5]=gn,gn=gn>>8,Qe[Ye+4]=gn;let Yt=Number(Ke>>BigInt(32)&BigInt(4294967295));return Qe[Ye+3]=Yt,Yt=Yt>>8,Qe[Ye+2]=Yt,Yt=Yt>>8,Qe[Ye+1]=Yt,Yt=Yt>>8,Qe[Ye]=Yt,Ye+8}se.prototype.writeBigUInt64LE=xn(function(Ke,Ye=0){return Ze(this,Ke,Ye,BigInt(0),BigInt("0xffffffffffffffff"))}),se.prototype.writeBigUInt64BE=xn(function(Ke,Ye=0){return Rt(this,Ke,Ye,BigInt(0),BigInt("0xffffffffffffffff"))}),se.prototype.writeIntLE=function(Ke,Ye,Pt,Gt){if(Ke=+Ke,Ye=Ye>>>0,!Gt){const $n=Math.pow(2,8*Pt-1);_n(this,Ke,Ye,Pt,$n-1,-$n)}let gn=0,Yt=1,cn=0;for(this[Ye]=Ke&255;++gn<Pt&&(Yt*=256);)Ke<0&&cn===0&&this[Ye+gn-1]!==0&&(cn=1),this[Ye+gn]=(Ke/Yt>>0)-cn&255;return Ye+Pt},se.prototype.writeIntBE=function(Ke,Ye,Pt,Gt){if(Ke=+Ke,Ye=Ye>>>0,!Gt){const $n=Math.pow(2,8*Pt-1);_n(this,Ke,Ye,Pt,$n-1,-$n)}let gn=Pt-1,Yt=1,cn=0;for(this[Ye+gn]=Ke&255;--gn>=0&&(Yt*=256);)Ke<0&&cn===0&&this[Ye+gn+1]!==0&&(cn=1),this[Ye+gn]=(Ke/Yt>>0)-cn&255;return Ye+Pt},se.prototype.writeInt8=function(Ke,Ye,Pt){return Ke=+Ke,Ye=Ye>>>0,Pt||_n(this,Ke,Ye,1,127,-128),Ke<0&&(Ke=255+Ke+1),this[Ye]=Ke&255,Ye+1},se.prototype.writeInt16LE=function(Ke,Ye,Pt){return Ke=+Ke,Ye=Ye>>>0,Pt||_n(this,Ke,Ye,2,32767,-32768),this[Ye]=Ke&255,this[Ye+1]=Ke>>>8,Ye+2},se.prototype.writeInt16BE=function(Ke,Ye,Pt){return Ke=+Ke,Ye=Ye>>>0,Pt||_n(this,Ke,Ye,2,32767,-32768),this[Ye]=Ke>>>8,this[Ye+1]=Ke&255,Ye+2},se.prototype.writeInt32LE=function(Ke,Ye,Pt){return Ke=+Ke,Ye=Ye>>>0,Pt||_n(this,Ke,Ye,4,2147483647,-2147483648),this[Ye]=Ke&255,this[Ye+1]=Ke>>>8,this[Ye+2]=Ke>>>16,this[Ye+3]=Ke>>>24,Ye+4},se.prototype.writeInt32BE=function(Ke,Ye,Pt){return Ke=+Ke,Ye=Ye>>>0,Pt||_n(this,Ke,Ye,4,2147483647,-2147483648),Ke<0&&(Ke=4294967295+Ke+1),this[Ye]=Ke>>>24,this[Ye+1]=Ke>>>16,this[Ye+2]=Ke>>>8,this[Ye+3]=Ke&255,Ye+4},se.prototype.writeBigInt64LE=xn(function(Ke,Ye=0){return Ze(this,Ke,Ye,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),se.prototype.writeBigInt64BE=xn(function(Ke,Ye=0){return Rt(this,Ke,Ye,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Qt(Qe,Ke,Ye,Pt,Gt,gn){if(Ye+Pt>Qe.length)throw new RangeError("Index out of range");if(Ye<0)throw new RangeError("Index out of range")}function Ft(Qe,Ke,Ye,Pt,Gt){return Ke=+Ke,Ye=Ye>>>0,Gt||Qt(Qe,Ke,Ye,4),Le.write(Qe,Ke,Ye,Pt,23,4),Ye+4}se.prototype.writeFloatLE=function(Ke,Ye,Pt){return Ft(this,Ke,Ye,!0,Pt)},se.prototype.writeFloatBE=function(Ke,Ye,Pt){return Ft(this,Ke,Ye,!1,Pt)};function Wt(Qe,Ke,Ye,Pt,Gt){return Ke=+Ke,Ye=Ye>>>0,Gt||Qt(Qe,Ke,Ye,8),Le.write(Qe,Ke,Ye,Pt,52,8),Ye+8}se.prototype.writeDoubleLE=function(Ke,Ye,Pt){return Wt(this,Ke,Ye,!0,Pt)},se.prototype.writeDoubleBE=function(Ke,Ye,Pt){return Wt(this,Ke,Ye,!1,Pt)},se.prototype.copy=function(Ke,Ye,Pt,Gt){if(!se.isBuffer(Ke))throw new TypeError("argument should be a Buffer");if(Pt||(Pt=0),!Gt&&Gt!==0&&(Gt=this.length),Ye>=Ke.length&&(Ye=Ke.length),Ye||(Ye=0),Gt>0&&Gt<Pt&&(Gt=Pt),Gt===Pt||Ke.length===0||this.length===0)return 0;if(Ye<0)throw new RangeError("targetStart out of bounds");if(Pt<0||Pt>=this.length)throw new RangeError("Index out of range");if(Gt<0)throw new RangeError("sourceEnd out of bounds");Gt>this.length&&(Gt=this.length),Ke.length-Ye<Gt-Pt&&(Gt=Ke.length-Ye+Pt);const gn=Gt-Pt;return this===Ke&&typeof Je.prototype.copyWithin=="function"?this.copyWithin(Ye,Pt,Gt):Je.prototype.set.call(Ke,this.subarray(Pt,Gt),Ye),gn},se.prototype.fill=function(Ke,Ye,Pt,Gt){if(typeof Ke=="string"){if(typeof Ye=="string"?(Gt=Ye,Ye=0,Pt=this.length):typeof Pt=="string"&&(Gt=Pt,Pt=this.length),Gt!==void 0&&typeof Gt!="string")throw new TypeError("encoding must be a string");if(typeof Gt=="string"&&!se.isEncoding(Gt))throw new TypeError("Unknown encoding: "+Gt);if(Ke.length===1){const Yt=Ke.charCodeAt(0);(Gt==="utf8"&&Yt<128||Gt==="latin1")&&(Ke=Yt)}}else typeof Ke=="number"?Ke=Ke&255:typeof Ke=="boolean"&&(Ke=Number(Ke));if(Ye<0||this.length<Ye||this.length<Pt)throw new RangeError("Out of range index");if(Pt<=Ye)return this;Ye=Ye>>>0,Pt=Pt===void 0?this.length:Pt>>>0,Ke||(Ke=0);let gn;if(typeof Ke=="number")for(gn=Ye;gn<Pt;++gn)this[gn]=Ke;else{const Yt=se.isBuffer(Ke)?Ke:se.from(Ke,Gt),cn=Yt.length;if(cn===0)throw new TypeError('The value "'+Ke+'" is invalid for argument "value"');for(gn=0;gn<Pt-Ye;++gn)this[gn+Ye]=Yt[gn%cn]}return this};const an={};function Zt(Qe,Ke,Ye){an[Qe]=class extends Ye{constructor(){super(),Object.defineProperty(this,"message",{value:Ke.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Qe}]`,this.stack,delete this.name}get code(){return Qe}set code(Gt){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Gt,writable:!0})}toString(){return`${this.name} [${Qe}]: ${this.message}`}}}Zt("ERR_BUFFER_OUT_OF_BOUNDS",function(Qe){return Qe?`${Qe} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Zt("ERR_INVALID_ARG_TYPE",function(Qe,Ke){return`The "${Qe}" argument must be of type number. Received type ${typeof Ke}`},TypeError),Zt("ERR_OUT_OF_RANGE",function(Qe,Ke,Ye){let Pt=`The value of "${Qe}" is out of range.`,Gt=Ye;return Number.isInteger(Ye)&&Math.abs(Ye)>2**32?Gt=Jt(String(Ye)):typeof Ye=="bigint"&&(Gt=String(Ye),(Ye>BigInt(2)**BigInt(32)||Ye<-(BigInt(2)**BigInt(32)))&&(Gt=Jt(Gt)),Gt+="n"),Pt+=` It must be ${Ke}. Received ${Gt}`,Pt},RangeError);function Jt(Qe){let Ke="",Ye=Qe.length;const Pt=Qe[0]==="-"?1:0;for(;Ye>=Pt+4;Ye-=3)Ke=`_${Qe.slice(Ye-3,Ye)}${Ke}`;return`${Qe.slice(0,Ye)}${Ke}`}function An(Qe,Ke,Ye){nn(Ke,"offset"),(Qe[Ke]===void 0||Qe[Ke+Ye]===void 0)&&Sn(Ke,Qe.length-(Ye+1))}function tn(Qe,Ke,Ye,Pt,Gt,gn){if(Qe>Ye||Qe<Ke){const Yt=typeof Ke=="bigint"?"n":"";let cn;throw Ke===0||Ke===BigInt(0)?cn=`>= 0${Yt} and < 2${Yt} ** ${(gn+1)*8}${Yt}`:cn=`>= -(2${Yt} ** ${(gn+1)*8-1}${Yt}) and < 2 ** ${(gn+1)*8-1}${Yt}`,new an.ERR_OUT_OF_RANGE("value",cn,Qe)}An(Pt,Gt,gn)}function nn(Qe,Ke){if(typeof Qe!="number")throw new an.ERR_INVALID_ARG_TYPE(Ke,"number",Qe)}function Sn(Qe,Ke,Ye){throw Math.floor(Qe)!==Qe?(nn(Qe,Ye),new an.ERR_OUT_OF_RANGE("offset","an integer",Qe)):Ke<0?new an.ERR_BUFFER_OUT_OF_BOUNDS:new an.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${Ke}`,Qe)}const rn=/[^+/0-9A-Za-z-_]/g;function dn(Qe){if(Qe=Qe.split("=")[0],Qe=Qe.trim().replace(rn,""),Qe.length<2)return"";for(;Qe.length%4!==0;)Qe=Qe+"=";return Qe}function Mn(Qe,Ke){Ke=Ke||1/0;let Ye;const Pt=Qe.length;let Gt=null;const gn=[];for(let Yt=0;Yt<Pt;++Yt){if(Ye=Qe.charCodeAt(Yt),Ye>55295&&Ye<57344){if(!Gt){if(Ye>56319){(Ke-=3)>-1&&gn.push(239,191,189);continue}else if(Yt+1===Pt){(Ke-=3)>-1&&gn.push(239,191,189);continue}Gt=Ye;continue}if(Ye<56320){(Ke-=3)>-1&&gn.push(239,191,189),Gt=Ye;continue}Ye=(Gt-55296<<10|Ye-56320)+65536}else Gt&&(Ke-=3)>-1&&gn.push(239,191,189);if(Gt=null,Ye<128){if((Ke-=1)<0)break;gn.push(Ye)}else if(Ye<2048){if((Ke-=2)<0)break;gn.push(Ye>>6|192,Ye&63|128)}else if(Ye<65536){if((Ke-=3)<0)break;gn.push(Ye>>12|224,Ye>>6&63|128,Ye&63|128)}else if(Ye<1114112){if((Ke-=4)<0)break;gn.push(Ye>>18|240,Ye>>12&63|128,Ye>>6&63|128,Ye&63|128)}else throw new Error("Invalid code point")}return gn}function sn(Qe){const Ke=[];for(let Ye=0;Ye<Qe.length;++Ye)Ke.push(Qe.charCodeAt(Ye)&255);return Ke}function ln(Qe,Ke){let Ye,Pt,Gt;const gn=[];for(let Yt=0;Yt<Qe.length&&!((Ke-=2)<0);++Yt)Ye=Qe.charCodeAt(Yt),Pt=Ye>>8,Gt=Ye%256,gn.push(Gt),gn.push(Pt);return gn}function Bn(Qe){return Fe.toByteArray(dn(Qe))}function un(Qe,Ke,Ye,Pt){let Gt;for(Gt=0;Gt<Pt&&!(Gt+Ye>=Ke.length||Gt>=Qe.length);++Gt)Ke[Gt+Ye]=Qe[Gt];return Gt}function hn(Qe,Ke){return Qe instanceof Ke||Qe!=null&&Qe.constructor!=null&&Qe.constructor.name!=null&&Qe.constructor.name===Ke.name}function Cn(Qe){return Qe!==Qe}const yn=function(){const Qe="0123456789abcdef",Ke=new Array(256);for(let Ye=0;Ye<16;++Ye){const Pt=Ye*16;for(let Gt=0;Gt<16;++Gt)Ke[Pt+Gt]=Qe[Ye]+Qe[Gt]}return Ke}();function xn(Qe){return typeof BigInt>"u"?Nn:Qe}function Nn(){throw new Error("BigInt not supported")}})(t);const Te=t.Buffer;c.Blob=t.Blob,c.BlobOptions=t.BlobOptions,c.Buffer=t.Buffer,c.File=t.File,c.FileOptions=t.FileOptions,c.INSPECT_MAX_BYTES=t.INSPECT_MAX_BYTES,c.SlowBuffer=t.SlowBuffer,c.TranscodeEncoding=t.TranscodeEncoding,c.atob=t.atob,c.btoa=t.btoa,c.constants=t.constants,c.default=Te,c.isAscii=t.isAscii,c.isUtf8=t.isUtf8,c.kMaxLength=t.kMaxLength,c.kStringMaxLength=t.kStringMaxLength,c.resolveObjectURL=t.resolveObjectURL,c.transcode=t.transcode})(dist$1);const Buffer$7=getDefaultExportFromCjs$2(dist$1);bn$8.exports;(function(c){(function(t,n){function ie(ce,de){if(!ce)throw new Error(de||"Assertion failed")}function fe(ce,de){ce.super_=de;var he=function(){};he.prototype=de.prototype,ce.prototype=new he,ce.prototype.constructor=ce}function ae(ce,de,he){if(ae.isBN(ce))return ce;this.negative=0,this.words=null,this.length=0,this.red=null,ce!==null&&((de==="le"||de==="be")&&(he=de,de=10),this._init(ce||0,de||10,he||"be"))}typeof t=="object"?t.exports=ae:n.BN=ae,ae.BN=ae,ae.wordSize=26;var le;try{typeof window<"u"&&typeof window.Buffer<"u"?le=window.Buffer:le=dist$1.Buffer}catch{}ae.isBN=function(de){return de instanceof ae?!0:de!==null&&typeof de=="object"&&de.constructor.wordSize===ae.wordSize&&Array.isArray(de.words)},ae.max=function(de,he){return de.cmp(he)>0?de:he},ae.min=function(de,he){return de.cmp(he)<0?de:he},ae.prototype._init=function(de,he,ve){if(typeof de=="number")return this._initNumber(de,he,ve);if(typeof de=="object")return this._initArray(de,he,ve);he==="hex"&&(he=16),ie(he===(he|0)&&he>=2&&he<=36),de=de.toString().replace(/\s+/g,"");var we=0;de[0]==="-"&&(we++,this.negative=1),we<de.length&&(he===16?this._parseHex(de,we,ve):(this._parseBase(de,he,we),ve==="le"&&this._initArray(this.toArray(),he,ve)))},ae.prototype._initNumber=function(de,he,ve){de<0&&(this.negative=1,de=-de),de<67108864?(this.words=[de&67108863],this.length=1):de<4503599627370496?(this.words=[de&67108863,de/67108864&67108863],this.length=2):(ie(de<9007199254740992),this.words=[de&67108863,de/67108864&67108863,1],this.length=3),ve==="le"&&this._initArray(this.toArray(),he,ve)},ae.prototype._initArray=function(de,he,ve){if(ie(typeof de.length=="number"),de.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(de.length/3),this.words=new Array(this.length);for(var we=0;we<this.length;we++)this.words[we]=0;var Ae,be,ue=0;if(ve==="be")for(we=de.length-1,Ae=0;we>=0;we-=3)be=de[we]|de[we-1]<<8|de[we-2]<<16,this.words[Ae]|=be<<ue&67108863,this.words[Ae+1]=be>>>26-ue&67108863,ue+=24,ue>=26&&(ue-=26,Ae++);else if(ve==="le")for(we=0,Ae=0;we<de.length;we+=3)be=de[we]|de[we+1]<<8|de[we+2]<<16,this.words[Ae]|=be<<ue&67108863,this.words[Ae+1]=be>>>26-ue&67108863,ue+=24,ue>=26&&(ue-=26,Ae++);return this._strip()};function pe(ce,de){var he=ce.charCodeAt(de);if(he>=48&&he<=57)return he-48;if(he>=65&&he<=70)return he-55;if(he>=97&&he<=102)return he-87;ie(!1,"Invalid character in "+ce)}function me(ce,de,he){var ve=pe(ce,he);return he-1>=de&&(ve|=pe(ce,he-1)<<4),ve}ae.prototype._parseHex=function(de,he,ve){this.length=Math.ceil((de.length-he)/6),this.words=new Array(this.length);for(var we=0;we<this.length;we++)this.words[we]=0;var Ae=0,be=0,ue;if(ve==="be")for(we=de.length-1;we>=he;we-=2)ue=me(de,he,we)<<Ae,this.words[be]|=ue&67108863,Ae>=18?(Ae-=18,be+=1,this.words[be]|=ue>>>26):Ae+=8;else{var ge=de.length-he;for(we=ge%2===0?he+1:he;we<de.length;we+=2)ue=me(de,he,we)<<Ae,this.words[be]|=ue&67108863,Ae>=18?(Ae-=18,be+=1,this.words[be]|=ue>>>26):Ae+=8}this._strip()};function ye(ce,de,he,ve){for(var we=0,Ae=0,be=Math.min(ce.length,he),ue=de;ue<be;ue++){var ge=ce.charCodeAt(ue)-48;we*=ve,ge>=49?Ae=ge-49+10:ge>=17?Ae=ge-17+10:Ae=ge,ie(ge>=0&&Ae<ve,"Invalid character"),we+=Ae}return we}ae.prototype._parseBase=function(de,he,ve){this.words=[0],this.length=1;for(var we=0,Ae=1;Ae<=67108863;Ae*=he)we++;we--,Ae=Ae/he|0;for(var be=de.length-ve,ue=be%we,ge=Math.min(be,be-ue)+ve,Re=0,Ne=ve;Ne<ge;Ne+=we)Re=ye(de,Ne,Ne+we,he),this.imuln(Ae),this.words[0]+Re<67108864?this.words[0]+=Re:this._iaddn(Re);if(ue!==0){var qe=1;for(Re=ye(de,Ne,de.length,he),Ne=0;Ne<ue;Ne++)qe*=he;this.imuln(qe),this.words[0]+Re<67108864?this.words[0]+=Re:this._iaddn(Re)}this._strip()},ae.prototype.copy=function(de){de.words=new Array(this.length);for(var he=0;he<this.length;he++)de.words[he]=this.words[he];de.length=this.length,de.negative=this.negative,de.red=this.red};function xe(ce,de){ce.words=de.words,ce.length=de.length,ce.negative=de.negative,ce.red=de.red}if(ae.prototype._move=function(de){xe(de,this)},ae.prototype.clone=function(){var de=new ae(null);return this.copy(de),de},ae.prototype._expand=function(de){for(;this.length<de;)this.words[this.length++]=0;return this},ae.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},ae.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{ae.prototype[Symbol.for("nodejs.util.inspect.custom")]=Ee}catch{ae.prototype.inspect=Ee}else ae.prototype.inspect=Ee;function Ee(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var Se=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Me=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Be=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];ae.prototype.toString=function(de,he){de=de||10,he=he|0||1;var ve;if(de===16||de==="hex"){ve="";for(var we=0,Ae=0,be=0;be<this.length;be++){var ue=this.words[be],ge=((ue<<we|Ae)&16777215).toString(16);Ae=ue>>>24-we&16777215,we+=2,we>=26&&(we-=26,be--),Ae!==0||be!==this.length-1?ve=Se[6-ge.length]+ge+ve:ve=ge+ve}for(Ae!==0&&(ve=Ae.toString(16)+ve);ve.length%he!==0;)ve="0"+ve;return this.negative!==0&&(ve="-"+ve),ve}if(de===(de|0)&&de>=2&&de<=36){var Re=Me[de],Ne=Be[de];ve="";var qe=this.clone();for(qe.negative=0;!qe.isZero();){var Pe=qe.modrn(Ne).toString(de);qe=qe.idivn(Ne),qe.isZero()?ve=Pe+ve:ve=Se[Re-Pe.length]+Pe+ve}for(this.isZero()&&(ve="0"+ve);ve.length%he!==0;)ve="0"+ve;return this.negative!==0&&(ve="-"+ve),ve}ie(!1,"Base should be between 2 and 36")},ae.prototype.toNumber=function(){var de=this.words[0];return this.length===2?de+=this.words[1]*67108864:this.length===3&&this.words[2]===1?de+=4503599627370496+this.words[1]*67108864:this.length>2&&ie(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-de:de},ae.prototype.toJSON=function(){return this.toString(16,2)},le&&(ae.prototype.toBuffer=function(de,he){return this.toArrayLike(le,de,he)}),ae.prototype.toArray=function(de,he){return this.toArrayLike(Array,de,he)};var $e=function(de,he){return de.allocUnsafe?de.allocUnsafe(he):new de(he)};ae.prototype.toArrayLike=function(de,he,ve){this._strip();var we=this.byteLength(),Ae=ve||Math.max(1,we);ie(we<=Ae,"byte array longer than desired length"),ie(Ae>0,"Requested array length <= 0");var be=$e(de,Ae),ue=he==="le"?"LE":"BE";return this["_toArrayLike"+ue](be,we),be},ae.prototype._toArrayLikeLE=function(de,he){for(var ve=0,we=0,Ae=0,be=0;Ae<this.length;Ae++){var ue=this.words[Ae]<<be|we;de[ve++]=ue&255,ve<de.length&&(de[ve++]=ue>>8&255),ve<de.length&&(de[ve++]=ue>>16&255),be===6?(ve<de.length&&(de[ve++]=ue>>24&255),we=0,be=0):(we=ue>>>24,be+=2)}if(ve<de.length)for(de[ve++]=we;ve<de.length;)de[ve++]=0},ae.prototype._toArrayLikeBE=function(de,he){for(var ve=de.length-1,we=0,Ae=0,be=0;Ae<this.length;Ae++){var ue=this.words[Ae]<<be|we;de[ve--]=ue&255,ve>=0&&(de[ve--]=ue>>8&255),ve>=0&&(de[ve--]=ue>>16&255),be===6?(ve>=0&&(de[ve--]=ue>>24&255),we=0,be=0):(we=ue>>>24,be+=2)}if(ve>=0)for(de[ve--]=we;ve>=0;)de[ve--]=0},Math.clz32?ae.prototype._countBits=function(de){return 32-Math.clz32(de)}:ae.prototype._countBits=function(de){var he=de,ve=0;return he>=4096&&(ve+=13,he>>>=13),he>=64&&(ve+=7,he>>>=7),he>=8&&(ve+=4,he>>>=4),he>=2&&(ve+=2,he>>>=2),ve+he},ae.prototype._zeroBits=function(de){if(de===0)return 26;var he=de,ve=0;return he&8191||(ve+=13,he>>>=13),he&127||(ve+=7,he>>>=7),he&15||(ve+=4,he>>>=4),he&3||(ve+=2,he>>>=2),he&1||ve++,ve},ae.prototype.bitLength=function(){var de=this.words[this.length-1],he=this._countBits(de);return(this.length-1)*26+he};function ke(ce){for(var de=new Array(ce.bitLength()),he=0;he<de.length;he++){var ve=he/26|0,we=he%26;de[he]=ce.words[ve]>>>we&1}return de}ae.prototype.zeroBits=function(){if(this.isZero())return 0;for(var de=0,he=0;he<this.length;he++){var ve=this._zeroBits(this.words[he]);if(de+=ve,ve!==26)break}return de},ae.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},ae.prototype.toTwos=function(de){return this.negative!==0?this.abs().inotn(de).iaddn(1):this.clone()},ae.prototype.fromTwos=function(de){return this.testn(de-1)?this.notn(de).iaddn(1).ineg():this.clone()},ae.prototype.isNeg=function(){return this.negative!==0},ae.prototype.neg=function(){return this.clone().ineg()},ae.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},ae.prototype.iuor=function(de){for(;this.length<de.length;)this.words[this.length++]=0;for(var he=0;he<de.length;he++)this.words[he]=this.words[he]|de.words[he];return this._strip()},ae.prototype.ior=function(de){return ie((this.negative|de.negative)===0),this.iuor(de)},ae.prototype.or=function(de){return this.length>de.length?this.clone().ior(de):de.clone().ior(this)},ae.prototype.uor=function(de){return this.length>de.length?this.clone().iuor(de):de.clone().iuor(this)},ae.prototype.iuand=function(de){var he;this.length>de.length?he=de:he=this;for(var ve=0;ve<he.length;ve++)this.words[ve]=this.words[ve]&de.words[ve];return this.length=he.length,this._strip()},ae.prototype.iand=function(de){return ie((this.negative|de.negative)===0),this.iuand(de)},ae.prototype.and=function(de){return this.length>de.length?this.clone().iand(de):de.clone().iand(this)},ae.prototype.uand=function(de){return this.length>de.length?this.clone().iuand(de):de.clone().iuand(this)},ae.prototype.iuxor=function(de){var he,ve;this.length>de.length?(he=this,ve=de):(he=de,ve=this);for(var we=0;we<ve.length;we++)this.words[we]=he.words[we]^ve.words[we];if(this!==he)for(;we<he.length;we++)this.words[we]=he.words[we];return this.length=he.length,this._strip()},ae.prototype.ixor=function(de){return ie((this.negative|de.negative)===0),this.iuxor(de)},ae.prototype.xor=function(de){return this.length>de.length?this.clone().ixor(de):de.clone().ixor(this)},ae.prototype.uxor=function(de){return this.length>de.length?this.clone().iuxor(de):de.clone().iuxor(this)},ae.prototype.inotn=function(de){ie(typeof de=="number"&&de>=0);var he=Math.ceil(de/26)|0,ve=de%26;this._expand(he),ve>0&&he--;for(var we=0;we<he;we++)this.words[we]=~this.words[we]&67108863;return ve>0&&(this.words[we]=~this.words[we]&67108863>>26-ve),this._strip()},ae.prototype.notn=function(de){return this.clone().inotn(de)},ae.prototype.setn=function(de,he){ie(typeof de=="number"&&de>=0);var ve=de/26|0,we=de%26;return this._expand(ve+1),he?this.words[ve]=this.words[ve]|1<<we:this.words[ve]=this.words[ve]&~(1<<we),this._strip()},ae.prototype.iadd=function(de){var he;if(this.negative!==0&&de.negative===0)return this.negative=0,he=this.isub(de),this.negative^=1,this._normSign();if(this.negative===0&&de.negative!==0)return de.negative=0,he=this.isub(de),de.negative=1,he._normSign();var ve,we;this.length>de.length?(ve=this,we=de):(ve=de,we=this);for(var Ae=0,be=0;be<we.length;be++)he=(ve.words[be]|0)+(we.words[be]|0)+Ae,this.words[be]=he&67108863,Ae=he>>>26;for(;Ae!==0&&be<ve.length;be++)he=(ve.words[be]|0)+Ae,this.words[be]=he&67108863,Ae=he>>>26;if(this.length=ve.length,Ae!==0)this.words[this.length]=Ae,this.length++;else if(ve!==this)for(;be<ve.length;be++)this.words[be]=ve.words[be];return this},ae.prototype.add=function(de){var he;return de.negative!==0&&this.negative===0?(de.negative=0,he=this.sub(de),de.negative^=1,he):de.negative===0&&this.negative!==0?(this.negative=0,he=de.sub(this),this.negative=1,he):this.length>de.length?this.clone().iadd(de):de.clone().iadd(this)},ae.prototype.isub=function(de){if(de.negative!==0){de.negative=0;var he=this.iadd(de);return de.negative=1,he._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(de),this.negative=1,this._normSign();var ve=this.cmp(de);if(ve===0)return this.negative=0,this.length=1,this.words[0]=0,this;var we,Ae;ve>0?(we=this,Ae=de):(we=de,Ae=this);for(var be=0,ue=0;ue<Ae.length;ue++)he=(we.words[ue]|0)-(Ae.words[ue]|0)+be,be=he>>26,this.words[ue]=he&67108863;for(;be!==0&&ue<we.length;ue++)he=(we.words[ue]|0)+be,be=he>>26,this.words[ue]=he&67108863;if(be===0&&ue<we.length&&we!==this)for(;ue<we.length;ue++)this.words[ue]=we.words[ue];return this.length=Math.max(this.length,ue),we!==this&&(this.negative=1),this._strip()},ae.prototype.sub=function(de){return this.clone().isub(de)};function Te(ce,de,he){he.negative=de.negative^ce.negative;var ve=ce.length+de.length|0;he.length=ve,ve=ve-1|0;var we=ce.words[0]|0,Ae=de.words[0]|0,be=we*Ae,ue=be&67108863,ge=be/67108864|0;he.words[0]=ue;for(var Re=1;Re<ve;Re++){for(var Ne=ge>>>26,qe=ge&67108863,Pe=Math.min(Re,de.length-1),Ge=Math.max(0,Re-ce.length+1);Ge<=Pe;Ge++){var Ce=Re-Ge|0;we=ce.words[Ce]|0,Ae=de.words[Ge]|0,be=we*Ae+qe,Ne+=be/67108864|0,qe=be&67108863}he.words[Re]=qe|0,ge=Ne|0}return ge!==0?he.words[Re]=ge|0:he.length--,he._strip()}var Ie=function(de,he,ve){var we=de.words,Ae=he.words,be=ve.words,ue=0,ge,Re,Ne,qe=we[0]|0,Pe=qe&8191,Ge=qe>>>13,Ce=we[1]|0,De=Ce&8191,je=Ce>>>13,Ve=we[2]|0,Mt=Ve&8191,Oe=Ve>>>13,We=we[3]|0,jt=We&8191,Dt=We>>>13,Ht=we[4]|0,vn=Ht&8191,Vt=Ht>>>13,Kt=we[5]|0,En=Kt&8191,en=Kt>>>13,Xt=we[6]|0,_n=Xt&8191,Ze=Xt>>>13,Rt=we[7]|0,Qt=Rt&8191,Ft=Rt>>>13,Wt=we[8]|0,an=Wt&8191,Zt=Wt>>>13,Jt=we[9]|0,An=Jt&8191,tn=Jt>>>13,nn=Ae[0]|0,Sn=nn&8191,rn=nn>>>13,dn=Ae[1]|0,Mn=dn&8191,sn=dn>>>13,ln=Ae[2]|0,Bn=ln&8191,un=ln>>>13,hn=Ae[3]|0,Cn=hn&8191,yn=hn>>>13,xn=Ae[4]|0,Nn=xn&8191,Qe=xn>>>13,Ke=Ae[5]|0,Ye=Ke&8191,Pt=Ke>>>13,Gt=Ae[6]|0,gn=Gt&8191,Yt=Gt>>>13,cn=Ae[7]|0,$n=cn&8191,fn=cn>>>13,pn=Ae[8]|0,Rn=pn&8191,mn=pn>>>13,wn=Ae[9]|0,kn=wn&8191,Tn=wn>>>13;ve.negative=de.negative^he.negative,ve.length=19,ge=Math.imul(Pe,Sn),Re=Math.imul(Pe,rn),Re=Re+Math.imul(Ge,Sn)|0,Ne=Math.imul(Ge,rn);var In=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(In>>>26)|0,In&=67108863,ge=Math.imul(De,Sn),Re=Math.imul(De,rn),Re=Re+Math.imul(je,Sn)|0,Ne=Math.imul(je,rn),ge=ge+Math.imul(Pe,Mn)|0,Re=Re+Math.imul(Pe,sn)|0,Re=Re+Math.imul(Ge,Mn)|0,Ne=Ne+Math.imul(Ge,sn)|0;var Pn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,ge=Math.imul(Mt,Sn),Re=Math.imul(Mt,rn),Re=Re+Math.imul(Oe,Sn)|0,Ne=Math.imul(Oe,rn),ge=ge+Math.imul(De,Mn)|0,Re=Re+Math.imul(De,sn)|0,Re=Re+Math.imul(je,Mn)|0,Ne=Ne+Math.imul(je,sn)|0,ge=ge+Math.imul(Pe,Bn)|0,Re=Re+Math.imul(Pe,un)|0,Re=Re+Math.imul(Ge,Bn)|0,Ne=Ne+Math.imul(Ge,un)|0;var On=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(On>>>26)|0,On&=67108863,ge=Math.imul(jt,Sn),Re=Math.imul(jt,rn),Re=Re+Math.imul(Dt,Sn)|0,Ne=Math.imul(Dt,rn),ge=ge+Math.imul(Mt,Mn)|0,Re=Re+Math.imul(Mt,sn)|0,Re=Re+Math.imul(Oe,Mn)|0,Ne=Ne+Math.imul(Oe,sn)|0,ge=ge+Math.imul(De,Bn)|0,Re=Re+Math.imul(De,un)|0,Re=Re+Math.imul(je,Bn)|0,Ne=Ne+Math.imul(je,un)|0,ge=ge+Math.imul(Pe,Cn)|0,Re=Re+Math.imul(Pe,yn)|0,Re=Re+Math.imul(Ge,Cn)|0,Ne=Ne+Math.imul(Ge,yn)|0;var Dn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,ge=Math.imul(vn,Sn),Re=Math.imul(vn,rn),Re=Re+Math.imul(Vt,Sn)|0,Ne=Math.imul(Vt,rn),ge=ge+Math.imul(jt,Mn)|0,Re=Re+Math.imul(jt,sn)|0,Re=Re+Math.imul(Dt,Mn)|0,Ne=Ne+Math.imul(Dt,sn)|0,ge=ge+Math.imul(Mt,Bn)|0,Re=Re+Math.imul(Mt,un)|0,Re=Re+Math.imul(Oe,Bn)|0,Ne=Ne+Math.imul(Oe,un)|0,ge=ge+Math.imul(De,Cn)|0,Re=Re+Math.imul(De,yn)|0,Re=Re+Math.imul(je,Cn)|0,Ne=Ne+Math.imul(je,yn)|0,ge=ge+Math.imul(Pe,Nn)|0,Re=Re+Math.imul(Pe,Qe)|0,Re=Re+Math.imul(Ge,Nn)|0,Ne=Ne+Math.imul(Ge,Qe)|0;var Ln=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,ge=Math.imul(En,Sn),Re=Math.imul(En,rn),Re=Re+Math.imul(en,Sn)|0,Ne=Math.imul(en,rn),ge=ge+Math.imul(vn,Mn)|0,Re=Re+Math.imul(vn,sn)|0,Re=Re+Math.imul(Vt,Mn)|0,Ne=Ne+Math.imul(Vt,sn)|0,ge=ge+Math.imul(jt,Bn)|0,Re=Re+Math.imul(jt,un)|0,Re=Re+Math.imul(Dt,Bn)|0,Ne=Ne+Math.imul(Dt,un)|0,ge=ge+Math.imul(Mt,Cn)|0,Re=Re+Math.imul(Mt,yn)|0,Re=Re+Math.imul(Oe,Cn)|0,Ne=Ne+Math.imul(Oe,yn)|0,ge=ge+Math.imul(De,Nn)|0,Re=Re+Math.imul(De,Qe)|0,Re=Re+Math.imul(je,Nn)|0,Ne=Ne+Math.imul(je,Qe)|0,ge=ge+Math.imul(Pe,Ye)|0,Re=Re+Math.imul(Pe,Pt)|0,Re=Re+Math.imul(Ge,Ye)|0,Ne=Ne+Math.imul(Ge,Pt)|0;var Fn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,ge=Math.imul(_n,Sn),Re=Math.imul(_n,rn),Re=Re+Math.imul(Ze,Sn)|0,Ne=Math.imul(Ze,rn),ge=ge+Math.imul(En,Mn)|0,Re=Re+Math.imul(En,sn)|0,Re=Re+Math.imul(en,Mn)|0,Ne=Ne+Math.imul(en,sn)|0,ge=ge+Math.imul(vn,Bn)|0,Re=Re+Math.imul(vn,un)|0,Re=Re+Math.imul(Vt,Bn)|0,Ne=Ne+Math.imul(Vt,un)|0,ge=ge+Math.imul(jt,Cn)|0,Re=Re+Math.imul(jt,yn)|0,Re=Re+Math.imul(Dt,Cn)|0,Ne=Ne+Math.imul(Dt,yn)|0,ge=ge+Math.imul(Mt,Nn)|0,Re=Re+Math.imul(Mt,Qe)|0,Re=Re+Math.imul(Oe,Nn)|0,Ne=Ne+Math.imul(Oe,Qe)|0,ge=ge+Math.imul(De,Ye)|0,Re=Re+Math.imul(De,Pt)|0,Re=Re+Math.imul(je,Ye)|0,Ne=Ne+Math.imul(je,Pt)|0,ge=ge+Math.imul(Pe,gn)|0,Re=Re+Math.imul(Pe,Yt)|0,Re=Re+Math.imul(Ge,gn)|0,Ne=Ne+Math.imul(Ge,Yt)|0;var qn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(qn>>>26)|0,qn&=67108863,ge=Math.imul(Qt,Sn),Re=Math.imul(Qt,rn),Re=Re+Math.imul(Ft,Sn)|0,Ne=Math.imul(Ft,rn),ge=ge+Math.imul(_n,Mn)|0,Re=Re+Math.imul(_n,sn)|0,Re=Re+Math.imul(Ze,Mn)|0,Ne=Ne+Math.imul(Ze,sn)|0,ge=ge+Math.imul(En,Bn)|0,Re=Re+Math.imul(En,un)|0,Re=Re+Math.imul(en,Bn)|0,Ne=Ne+Math.imul(en,un)|0,ge=ge+Math.imul(vn,Cn)|0,Re=Re+Math.imul(vn,yn)|0,Re=Re+Math.imul(Vt,Cn)|0,Ne=Ne+Math.imul(Vt,yn)|0,ge=ge+Math.imul(jt,Nn)|0,Re=Re+Math.imul(jt,Qe)|0,Re=Re+Math.imul(Dt,Nn)|0,Ne=Ne+Math.imul(Dt,Qe)|0,ge=ge+Math.imul(Mt,Ye)|0,Re=Re+Math.imul(Mt,Pt)|0,Re=Re+Math.imul(Oe,Ye)|0,Ne=Ne+Math.imul(Oe,Pt)|0,ge=ge+Math.imul(De,gn)|0,Re=Re+Math.imul(De,Yt)|0,Re=Re+Math.imul(je,gn)|0,Ne=Ne+Math.imul(je,Yt)|0,ge=ge+Math.imul(Pe,$n)|0,Re=Re+Math.imul(Pe,fn)|0,Re=Re+Math.imul(Ge,$n)|0,Ne=Ne+Math.imul(Ge,fn)|0;var Un=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Un>>>26)|0,Un&=67108863,ge=Math.imul(an,Sn),Re=Math.imul(an,rn),Re=Re+Math.imul(Zt,Sn)|0,Ne=Math.imul(Zt,rn),ge=ge+Math.imul(Qt,Mn)|0,Re=Re+Math.imul(Qt,sn)|0,Re=Re+Math.imul(Ft,Mn)|0,Ne=Ne+Math.imul(Ft,sn)|0,ge=ge+Math.imul(_n,Bn)|0,Re=Re+Math.imul(_n,un)|0,Re=Re+Math.imul(Ze,Bn)|0,Ne=Ne+Math.imul(Ze,un)|0,ge=ge+Math.imul(En,Cn)|0,Re=Re+Math.imul(En,yn)|0,Re=Re+Math.imul(en,Cn)|0,Ne=Ne+Math.imul(en,yn)|0,ge=ge+Math.imul(vn,Nn)|0,Re=Re+Math.imul(vn,Qe)|0,Re=Re+Math.imul(Vt,Nn)|0,Ne=Ne+Math.imul(Vt,Qe)|0,ge=ge+Math.imul(jt,Ye)|0,Re=Re+Math.imul(jt,Pt)|0,Re=Re+Math.imul(Dt,Ye)|0,Ne=Ne+Math.imul(Dt,Pt)|0,ge=ge+Math.imul(Mt,gn)|0,Re=Re+Math.imul(Mt,Yt)|0,Re=Re+Math.imul(Oe,gn)|0,Ne=Ne+Math.imul(Oe,Yt)|0,ge=ge+Math.imul(De,$n)|0,Re=Re+Math.imul(De,fn)|0,Re=Re+Math.imul(je,$n)|0,Ne=Ne+Math.imul(je,fn)|0,ge=ge+Math.imul(Pe,Rn)|0,Re=Re+Math.imul(Pe,mn)|0,Re=Re+Math.imul(Ge,Rn)|0,Ne=Ne+Math.imul(Ge,mn)|0;var Kn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Kn>>>26)|0,Kn&=67108863,ge=Math.imul(An,Sn),Re=Math.imul(An,rn),Re=Re+Math.imul(tn,Sn)|0,Ne=Math.imul(tn,rn),ge=ge+Math.imul(an,Mn)|0,Re=Re+Math.imul(an,sn)|0,Re=Re+Math.imul(Zt,Mn)|0,Ne=Ne+Math.imul(Zt,sn)|0,ge=ge+Math.imul(Qt,Bn)|0,Re=Re+Math.imul(Qt,un)|0,Re=Re+Math.imul(Ft,Bn)|0,Ne=Ne+Math.imul(Ft,un)|0,ge=ge+Math.imul(_n,Cn)|0,Re=Re+Math.imul(_n,yn)|0,Re=Re+Math.imul(Ze,Cn)|0,Ne=Ne+Math.imul(Ze,yn)|0,ge=ge+Math.imul(En,Nn)|0,Re=Re+Math.imul(En,Qe)|0,Re=Re+Math.imul(en,Nn)|0,Ne=Ne+Math.imul(en,Qe)|0,ge=ge+Math.imul(vn,Ye)|0,Re=Re+Math.imul(vn,Pt)|0,Re=Re+Math.imul(Vt,Ye)|0,Ne=Ne+Math.imul(Vt,Pt)|0,ge=ge+Math.imul(jt,gn)|0,Re=Re+Math.imul(jt,Yt)|0,Re=Re+Math.imul(Dt,gn)|0,Ne=Ne+Math.imul(Dt,Yt)|0,ge=ge+Math.imul(Mt,$n)|0,Re=Re+Math.imul(Mt,fn)|0,Re=Re+Math.imul(Oe,$n)|0,Ne=Ne+Math.imul(Oe,fn)|0,ge=ge+Math.imul(De,Rn)|0,Re=Re+Math.imul(De,mn)|0,Re=Re+Math.imul(je,Rn)|0,Ne=Ne+Math.imul(je,mn)|0,ge=ge+Math.imul(Pe,kn)|0,Re=Re+Math.imul(Pe,Tn)|0,Re=Re+Math.imul(Ge,kn)|0,Ne=Ne+Math.imul(Ge,Tn)|0;var Hn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,ge=Math.imul(An,Mn),Re=Math.imul(An,sn),Re=Re+Math.imul(tn,Mn)|0,Ne=Math.imul(tn,sn),ge=ge+Math.imul(an,Bn)|0,Re=Re+Math.imul(an,un)|0,Re=Re+Math.imul(Zt,Bn)|0,Ne=Ne+Math.imul(Zt,un)|0,ge=ge+Math.imul(Qt,Cn)|0,Re=Re+Math.imul(Qt,yn)|0,Re=Re+Math.imul(Ft,Cn)|0,Ne=Ne+Math.imul(Ft,yn)|0,ge=ge+Math.imul(_n,Nn)|0,Re=Re+Math.imul(_n,Qe)|0,Re=Re+Math.imul(Ze,Nn)|0,Ne=Ne+Math.imul(Ze,Qe)|0,ge=ge+Math.imul(En,Ye)|0,Re=Re+Math.imul(En,Pt)|0,Re=Re+Math.imul(en,Ye)|0,Ne=Ne+Math.imul(en,Pt)|0,ge=ge+Math.imul(vn,gn)|0,Re=Re+Math.imul(vn,Yt)|0,Re=Re+Math.imul(Vt,gn)|0,Ne=Ne+Math.imul(Vt,Yt)|0,ge=ge+Math.imul(jt,$n)|0,Re=Re+Math.imul(jt,fn)|0,Re=Re+Math.imul(Dt,$n)|0,Ne=Ne+Math.imul(Dt,fn)|0,ge=ge+Math.imul(Mt,Rn)|0,Re=Re+Math.imul(Mt,mn)|0,Re=Re+Math.imul(Oe,Rn)|0,Ne=Ne+Math.imul(Oe,mn)|0,ge=ge+Math.imul(De,kn)|0,Re=Re+Math.imul(De,Tn)|0,Re=Re+Math.imul(je,kn)|0,Ne=Ne+Math.imul(je,Tn)|0;var jn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(jn>>>26)|0,jn&=67108863,ge=Math.imul(An,Bn),Re=Math.imul(An,un),Re=Re+Math.imul(tn,Bn)|0,Ne=Math.imul(tn,un),ge=ge+Math.imul(an,Cn)|0,Re=Re+Math.imul(an,yn)|0,Re=Re+Math.imul(Zt,Cn)|0,Ne=Ne+Math.imul(Zt,yn)|0,ge=ge+Math.imul(Qt,Nn)|0,Re=Re+Math.imul(Qt,Qe)|0,Re=Re+Math.imul(Ft,Nn)|0,Ne=Ne+Math.imul(Ft,Qe)|0,ge=ge+Math.imul(_n,Ye)|0,Re=Re+Math.imul(_n,Pt)|0,Re=Re+Math.imul(Ze,Ye)|0,Ne=Ne+Math.imul(Ze,Pt)|0,ge=ge+Math.imul(En,gn)|0,Re=Re+Math.imul(En,Yt)|0,Re=Re+Math.imul(en,gn)|0,Ne=Ne+Math.imul(en,Yt)|0,ge=ge+Math.imul(vn,$n)|0,Re=Re+Math.imul(vn,fn)|0,Re=Re+Math.imul(Vt,$n)|0,Ne=Ne+Math.imul(Vt,fn)|0,ge=ge+Math.imul(jt,Rn)|0,Re=Re+Math.imul(jt,mn)|0,Re=Re+Math.imul(Dt,Rn)|0,Ne=Ne+Math.imul(Dt,mn)|0,ge=ge+Math.imul(Mt,kn)|0,Re=Re+Math.imul(Mt,Tn)|0,Re=Re+Math.imul(Oe,kn)|0,Ne=Ne+Math.imul(Oe,Tn)|0;var zn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(zn>>>26)|0,zn&=67108863,ge=Math.imul(An,Cn),Re=Math.imul(An,yn),Re=Re+Math.imul(tn,Cn)|0,Ne=Math.imul(tn,yn),ge=ge+Math.imul(an,Nn)|0,Re=Re+Math.imul(an,Qe)|0,Re=Re+Math.imul(Zt,Nn)|0,Ne=Ne+Math.imul(Zt,Qe)|0,ge=ge+Math.imul(Qt,Ye)|0,Re=Re+Math.imul(Qt,Pt)|0,Re=Re+Math.imul(Ft,Ye)|0,Ne=Ne+Math.imul(Ft,Pt)|0,ge=ge+Math.imul(_n,gn)|0,Re=Re+Math.imul(_n,Yt)|0,Re=Re+Math.imul(Ze,gn)|0,Ne=Ne+Math.imul(Ze,Yt)|0,ge=ge+Math.imul(En,$n)|0,Re=Re+Math.imul(En,fn)|0,Re=Re+Math.imul(en,$n)|0,Ne=Ne+Math.imul(en,fn)|0,ge=ge+Math.imul(vn,Rn)|0,Re=Re+Math.imul(vn,mn)|0,Re=Re+Math.imul(Vt,Rn)|0,Ne=Ne+Math.imul(Vt,mn)|0,ge=ge+Math.imul(jt,kn)|0,Re=Re+Math.imul(jt,Tn)|0,Re=Re+Math.imul(Dt,kn)|0,Ne=Ne+Math.imul(Dt,Tn)|0;var Gn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,ge=Math.imul(An,Nn),Re=Math.imul(An,Qe),Re=Re+Math.imul(tn,Nn)|0,Ne=Math.imul(tn,Qe),ge=ge+Math.imul(an,Ye)|0,Re=Re+Math.imul(an,Pt)|0,Re=Re+Math.imul(Zt,Ye)|0,Ne=Ne+Math.imul(Zt,Pt)|0,ge=ge+Math.imul(Qt,gn)|0,Re=Re+Math.imul(Qt,Yt)|0,Re=Re+Math.imul(Ft,gn)|0,Ne=Ne+Math.imul(Ft,Yt)|0,ge=ge+Math.imul(_n,$n)|0,Re=Re+Math.imul(_n,fn)|0,Re=Re+Math.imul(Ze,$n)|0,Ne=Ne+Math.imul(Ze,fn)|0,ge=ge+Math.imul(En,Rn)|0,Re=Re+Math.imul(En,mn)|0,Re=Re+Math.imul(en,Rn)|0,Ne=Ne+Math.imul(en,mn)|0,ge=ge+Math.imul(vn,kn)|0,Re=Re+Math.imul(vn,Tn)|0,Re=Re+Math.imul(Vt,kn)|0,Ne=Ne+Math.imul(Vt,Tn)|0;var Wn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,ge=Math.imul(An,Ye),Re=Math.imul(An,Pt),Re=Re+Math.imul(tn,Ye)|0,Ne=Math.imul(tn,Pt),ge=ge+Math.imul(an,gn)|0,Re=Re+Math.imul(an,Yt)|0,Re=Re+Math.imul(Zt,gn)|0,Ne=Ne+Math.imul(Zt,Yt)|0,ge=ge+Math.imul(Qt,$n)|0,Re=Re+Math.imul(Qt,fn)|0,Re=Re+Math.imul(Ft,$n)|0,Ne=Ne+Math.imul(Ft,fn)|0,ge=ge+Math.imul(_n,Rn)|0,Re=Re+Math.imul(_n,mn)|0,Re=Re+Math.imul(Ze,Rn)|0,Ne=Ne+Math.imul(Ze,mn)|0,ge=ge+Math.imul(En,kn)|0,Re=Re+Math.imul(En,Tn)|0,Re=Re+Math.imul(en,kn)|0,Ne=Ne+Math.imul(en,Tn)|0;var Vn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,ge=Math.imul(An,gn),Re=Math.imul(An,Yt),Re=Re+Math.imul(tn,gn)|0,Ne=Math.imul(tn,Yt),ge=ge+Math.imul(an,$n)|0,Re=Re+Math.imul(an,fn)|0,Re=Re+Math.imul(Zt,$n)|0,Ne=Ne+Math.imul(Zt,fn)|0,ge=ge+Math.imul(Qt,Rn)|0,Re=Re+Math.imul(Qt,mn)|0,Re=Re+Math.imul(Ft,Rn)|0,Ne=Ne+Math.imul(Ft,mn)|0,ge=ge+Math.imul(_n,kn)|0,Re=Re+Math.imul(_n,Tn)|0,Re=Re+Math.imul(Ze,kn)|0,Ne=Ne+Math.imul(Ze,Tn)|0;var Zn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,ge=Math.imul(An,$n),Re=Math.imul(An,fn),Re=Re+Math.imul(tn,$n)|0,Ne=Math.imul(tn,fn),ge=ge+Math.imul(an,Rn)|0,Re=Re+Math.imul(an,mn)|0,Re=Re+Math.imul(Zt,Rn)|0,Ne=Ne+Math.imul(Zt,mn)|0,ge=ge+Math.imul(Qt,kn)|0,Re=Re+Math.imul(Qt,Tn)|0,Re=Re+Math.imul(Ft,kn)|0,Ne=Ne+Math.imul(Ft,Tn)|0;var Jn=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,ge=Math.imul(An,Rn),Re=Math.imul(An,mn),Re=Re+Math.imul(tn,Rn)|0,Ne=Math.imul(tn,mn),ge=ge+Math.imul(an,kn)|0,Re=Re+Math.imul(an,Tn)|0,Re=Re+Math.imul(Zt,kn)|0,Ne=Ne+Math.imul(Zt,Tn)|0;var ti=(ue+ge|0)+((Re&8191)<<13)|0;ue=(Ne+(Re>>>13)|0)+(ti>>>26)|0,ti&=67108863,ge=Math.imul(An,kn),Re=Math.imul(An,Tn),Re=Re+Math.imul(tn,kn)|0,Ne=Math.imul(tn,Tn);var ri=(ue+ge|0)+((Re&8191)<<13)|0;return ue=(Ne+(Re>>>13)|0)+(ri>>>26)|0,ri&=67108863,be[0]=In,be[1]=Pn,be[2]=On,be[3]=Dn,be[4]=Ln,be[5]=Fn,be[6]=qn,be[7]=Un,be[8]=Kn,be[9]=Hn,be[10]=jn,be[11]=zn,be[12]=Gn,be[13]=Wn,be[14]=Vn,be[15]=Zn,be[16]=Jn,be[17]=ti,be[18]=ri,ue!==0&&(be[19]=ue,ve.length++),ve};Math.imul||(Ie=Te);function Fe(ce,de,he){he.negative=de.negative^ce.negative,he.length=ce.length+de.length;for(var ve=0,we=0,Ae=0;Ae<he.length-1;Ae++){var be=we;we=0;for(var ue=ve&67108863,ge=Math.min(Ae,de.length-1),Re=Math.max(0,Ae-ce.length+1);Re<=ge;Re++){var Ne=Ae-Re,qe=ce.words[Ne]|0,Pe=de.words[Re]|0,Ge=qe*Pe,Ce=Ge&67108863;be=be+(Ge/67108864|0)|0,Ce=Ce+ue|0,ue=Ce&67108863,be=be+(Ce>>>26)|0,we+=be>>>26,be&=67108863}he.words[Ae]=ue,ve=be,be=we}return ve!==0?he.words[Ae]=ve:he.length--,he._strip()}function Le(ce,de,he){return Fe(ce,de,he)}ae.prototype.mulTo=function(de,he){var ve,we=this.length+de.length;return this.length===10&&de.length===10?ve=Ie(this,de,he):we<63?ve=Te(this,de,he):we<1024?ve=Fe(this,de,he):ve=Le(this,de,he),ve},ae.prototype.mul=function(de){var he=new ae(null);return he.words=new Array(this.length+de.length),this.mulTo(de,he)},ae.prototype.mulf=function(de){var he=new ae(null);return he.words=new Array(this.length+de.length),Le(this,de,he)},ae.prototype.imul=function(de){return this.clone().mulTo(de,this)},ae.prototype.imuln=function(de){var he=de<0;he&&(de=-de),ie(typeof de=="number"),ie(de<67108864);for(var ve=0,we=0;we<this.length;we++){var Ae=(this.words[we]|0)*de,be=(Ae&67108863)+(ve&67108863);ve>>=26,ve+=Ae/67108864|0,ve+=be>>>26,this.words[we]=be&67108863}return ve!==0&&(this.words[we]=ve,this.length++),this.length=de===0?1:this.length,he?this.ineg():this},ae.prototype.muln=function(de){return this.clone().imuln(de)},ae.prototype.sqr=function(){return this.mul(this)},ae.prototype.isqr=function(){return this.imul(this.clone())},ae.prototype.pow=function(de){var he=ke(de);if(he.length===0)return new ae(1);for(var ve=this,we=0;we<he.length&&he[we]===0;we++,ve=ve.sqr());if(++we<he.length)for(var Ae=ve.sqr();we<he.length;we++,Ae=Ae.sqr())he[we]!==0&&(ve=ve.mul(Ae));return ve},ae.prototype.iushln=function(de){ie(typeof de=="number"&&de>=0);var he=de%26,ve=(de-he)/26,we=67108863>>>26-he<<26-he,Ae;if(he!==0){var be=0;for(Ae=0;Ae<this.length;Ae++){var ue=this.words[Ae]&we,ge=(this.words[Ae]|0)-ue<<he;this.words[Ae]=ge|be,be=ue>>>26-he}be&&(this.words[Ae]=be,this.length++)}if(ve!==0){for(Ae=this.length-1;Ae>=0;Ae--)this.words[Ae+ve]=this.words[Ae];for(Ae=0;Ae<ve;Ae++)this.words[Ae]=0;this.length+=ve}return this._strip()},ae.prototype.ishln=function(de){return ie(this.negative===0),this.iushln(de)},ae.prototype.iushrn=function(de,he,ve){ie(typeof de=="number"&&de>=0);var we;he?we=(he-he%26)/26:we=0;var Ae=de%26,be=Math.min((de-Ae)/26,this.length),ue=67108863^67108863>>>Ae<<Ae,ge=ve;if(we-=be,we=Math.max(0,we),ge){for(var Re=0;Re<be;Re++)ge.words[Re]=this.words[Re];ge.length=be}if(be!==0)if(this.length>be)for(this.length-=be,Re=0;Re<this.length;Re++)this.words[Re]=this.words[Re+be];else this.words[0]=0,this.length=1;var Ne=0;for(Re=this.length-1;Re>=0&&(Ne!==0||Re>=we);Re--){var qe=this.words[Re]|0;this.words[Re]=Ne<<26-Ae|qe>>>Ae,Ne=qe&ue}return ge&&Ne!==0&&(ge.words[ge.length++]=Ne),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},ae.prototype.ishrn=function(de,he,ve){return ie(this.negative===0),this.iushrn(de,he,ve)},ae.prototype.shln=function(de){return this.clone().ishln(de)},ae.prototype.ushln=function(de){return this.clone().iushln(de)},ae.prototype.shrn=function(de){return this.clone().ishrn(de)},ae.prototype.ushrn=function(de){return this.clone().iushrn(de)},ae.prototype.testn=function(de){ie(typeof de=="number"&&de>=0);var he=de%26,ve=(de-he)/26,we=1<<he;if(this.length<=ve)return!1;var Ae=this.words[ve];return!!(Ae&we)},ae.prototype.imaskn=function(de){ie(typeof de=="number"&&de>=0);var he=de%26,ve=(de-he)/26;if(ie(this.negative===0,"imaskn works only with positive numbers"),this.length<=ve)return this;if(he!==0&&ve++,this.length=Math.min(ve,this.length),he!==0){var we=67108863^67108863>>>he<<he;this.words[this.length-1]&=we}return this._strip()},ae.prototype.maskn=function(de){return this.clone().imaskn(de)},ae.prototype.iaddn=function(de){return ie(typeof de=="number"),ie(de<67108864),de<0?this.isubn(-de):this.negative!==0?this.length===1&&(this.words[0]|0)<=de?(this.words[0]=de-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(de),this.negative=1,this):this._iaddn(de)},ae.prototype._iaddn=function(de){this.words[0]+=de;for(var he=0;he<this.length&&this.words[he]>=67108864;he++)this.words[he]-=67108864,he===this.length-1?this.words[he+1]=1:this.words[he+1]++;return this.length=Math.max(this.length,he+1),this},ae.prototype.isubn=function(de){if(ie(typeof de=="number"),ie(de<67108864),de<0)return this.iaddn(-de);if(this.negative!==0)return this.negative=0,this.iaddn(de),this.negative=1,this;if(this.words[0]-=de,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var he=0;he<this.length&&this.words[he]<0;he++)this.words[he]+=67108864,this.words[he+1]-=1;return this._strip()},ae.prototype.addn=function(de){return this.clone().iaddn(de)},ae.prototype.subn=function(de){return this.clone().isubn(de)},ae.prototype.iabs=function(){return this.negative=0,this},ae.prototype.abs=function(){return this.clone().iabs()},ae.prototype._ishlnsubmul=function(de,he,ve){var we=de.length+ve,Ae;this._expand(we);var be,ue=0;for(Ae=0;Ae<de.length;Ae++){be=(this.words[Ae+ve]|0)+ue;var ge=(de.words[Ae]|0)*he;be-=ge&67108863,ue=(be>>26)-(ge/67108864|0),this.words[Ae+ve]=be&67108863}for(;Ae<this.length-ve;Ae++)be=(this.words[Ae+ve]|0)+ue,ue=be>>26,this.words[Ae+ve]=be&67108863;if(ue===0)return this._strip();for(ie(ue===-1),ue=0,Ae=0;Ae<this.length;Ae++)be=-(this.words[Ae]|0)+ue,ue=be>>26,this.words[Ae]=be&67108863;return this.negative=1,this._strip()},ae.prototype._wordDiv=function(de,he){var ve=this.length-de.length,we=this.clone(),Ae=de,be=Ae.words[Ae.length-1]|0,ue=this._countBits(be);ve=26-ue,ve!==0&&(Ae=Ae.ushln(ve),we.iushln(ve),be=Ae.words[Ae.length-1]|0);var ge=we.length-Ae.length,Re;if(he!=="mod"){Re=new ae(null),Re.length=ge+1,Re.words=new Array(Re.length);for(var Ne=0;Ne<Re.length;Ne++)Re.words[Ne]=0}var qe=we.clone()._ishlnsubmul(Ae,1,ge);qe.negative===0&&(we=qe,Re&&(Re.words[ge]=1));for(var Pe=ge-1;Pe>=0;Pe--){var Ge=(we.words[Ae.length+Pe]|0)*67108864+(we.words[Ae.length+Pe-1]|0);for(Ge=Math.min(Ge/be|0,67108863),we._ishlnsubmul(Ae,Ge,Pe);we.negative!==0;)Ge--,we.negative=0,we._ishlnsubmul(Ae,1,Pe),we.isZero()||(we.negative^=1);Re&&(Re.words[Pe]=Ge)}return Re&&Re._strip(),we._strip(),he!=="div"&&ve!==0&&we.iushrn(ve),{div:Re||null,mod:we}},ae.prototype.divmod=function(de,he,ve){if(ie(!de.isZero()),this.isZero())return{div:new ae(0),mod:new ae(0)};var we,Ae,be;return this.negative!==0&&de.negative===0?(be=this.neg().divmod(de,he),he!=="mod"&&(we=be.div.neg()),he!=="div"&&(Ae=be.mod.neg(),ve&&Ae.negative!==0&&Ae.iadd(de)),{div:we,mod:Ae}):this.negative===0&&de.negative!==0?(be=this.divmod(de.neg(),he),he!=="mod"&&(we=be.div.neg()),{div:we,mod:be.mod}):this.negative&de.negative?(be=this.neg().divmod(de.neg(),he),he!=="div"&&(Ae=be.mod.neg(),ve&&Ae.negative!==0&&Ae.isub(de)),{div:be.div,mod:Ae}):de.length>this.length||this.cmp(de)<0?{div:new ae(0),mod:this}:de.length===1?he==="div"?{div:this.divn(de.words[0]),mod:null}:he==="mod"?{div:null,mod:new ae(this.modrn(de.words[0]))}:{div:this.divn(de.words[0]),mod:new ae(this.modrn(de.words[0]))}:this._wordDiv(de,he)},ae.prototype.div=function(de){return this.divmod(de,"div",!1).div},ae.prototype.mod=function(de){return this.divmod(de,"mod",!1).mod},ae.prototype.umod=function(de){return this.divmod(de,"mod",!0).mod},ae.prototype.divRound=function(de){var he=this.divmod(de);if(he.mod.isZero())return he.div;var ve=he.div.negative!==0?he.mod.isub(de):he.mod,we=de.ushrn(1),Ae=de.andln(1),be=ve.cmp(we);return be<0||Ae===1&&be===0?he.div:he.div.negative!==0?he.div.isubn(1):he.div.iaddn(1)},ae.prototype.modrn=function(de){var he=de<0;he&&(de=-de),ie(de<=67108863);for(var ve=(1<<26)%de,we=0,Ae=this.length-1;Ae>=0;Ae--)we=(ve*we+(this.words[Ae]|0))%de;return he?-we:we},ae.prototype.modn=function(de){return this.modrn(de)},ae.prototype.idivn=function(de){var he=de<0;he&&(de=-de),ie(de<=67108863);for(var ve=0,we=this.length-1;we>=0;we--){var Ae=(this.words[we]|0)+ve*67108864;this.words[we]=Ae/de|0,ve=Ae%de}return this._strip(),he?this.ineg():this},ae.prototype.divn=function(de){return this.clone().idivn(de)},ae.prototype.egcd=function(de){ie(de.negative===0),ie(!de.isZero());var he=this,ve=de.clone();he.negative!==0?he=he.umod(de):he=he.clone();for(var we=new ae(1),Ae=new ae(0),be=new ae(0),ue=new ae(1),ge=0;he.isEven()&&ve.isEven();)he.iushrn(1),ve.iushrn(1),++ge;for(var Re=ve.clone(),Ne=he.clone();!he.isZero();){for(var qe=0,Pe=1;!(he.words[0]&Pe)&&qe<26;++qe,Pe<<=1);if(qe>0)for(he.iushrn(qe);qe-- >0;)(we.isOdd()||Ae.isOdd())&&(we.iadd(Re),Ae.isub(Ne)),we.iushrn(1),Ae.iushrn(1);for(var Ge=0,Ce=1;!(ve.words[0]&Ce)&&Ge<26;++Ge,Ce<<=1);if(Ge>0)for(ve.iushrn(Ge);Ge-- >0;)(be.isOdd()||ue.isOdd())&&(be.iadd(Re),ue.isub(Ne)),be.iushrn(1),ue.iushrn(1);he.cmp(ve)>=0?(he.isub(ve),we.isub(be),Ae.isub(ue)):(ve.isub(he),be.isub(we),ue.isub(Ae))}return{a:be,b:ue,gcd:ve.iushln(ge)}},ae.prototype._invmp=function(de){ie(de.negative===0),ie(!de.isZero());var he=this,ve=de.clone();he.negative!==0?he=he.umod(de):he=he.clone();for(var we=new ae(1),Ae=new ae(0),be=ve.clone();he.cmpn(1)>0&&ve.cmpn(1)>0;){for(var ue=0,ge=1;!(he.words[0]&ge)&&ue<26;++ue,ge<<=1);if(ue>0)for(he.iushrn(ue);ue-- >0;)we.isOdd()&&we.iadd(be),we.iushrn(1);for(var Re=0,Ne=1;!(ve.words[0]&Ne)&&Re<26;++Re,Ne<<=1);if(Re>0)for(ve.iushrn(Re);Re-- >0;)Ae.isOdd()&&Ae.iadd(be),Ae.iushrn(1);he.cmp(ve)>=0?(he.isub(ve),we.isub(Ae)):(ve.isub(he),Ae.isub(we))}var qe;return he.cmpn(1)===0?qe=we:qe=Ae,qe.cmpn(0)<0&&qe.iadd(de),qe},ae.prototype.gcd=function(de){if(this.isZero())return de.abs();if(de.isZero())return this.abs();var he=this.clone(),ve=de.clone();he.negative=0,ve.negative=0;for(var we=0;he.isEven()&&ve.isEven();we++)he.iushrn(1),ve.iushrn(1);do{for(;he.isEven();)he.iushrn(1);for(;ve.isEven();)ve.iushrn(1);var Ae=he.cmp(ve);if(Ae<0){var be=he;he=ve,ve=be}else if(Ae===0||ve.cmpn(1)===0)break;he.isub(ve)}while(!0);return ve.iushln(we)},ae.prototype.invm=function(de){return this.egcd(de).a.umod(de)},ae.prototype.isEven=function(){return(this.words[0]&1)===0},ae.prototype.isOdd=function(){return(this.words[0]&1)===1},ae.prototype.andln=function(de){return this.words[0]&de},ae.prototype.bincn=function(de){ie(typeof de=="number");var he=de%26,ve=(de-he)/26,we=1<<he;if(this.length<=ve)return this._expand(ve+1),this.words[ve]|=we,this;for(var Ae=we,be=ve;Ae!==0&&be<this.length;be++){var ue=this.words[be]|0;ue+=Ae,Ae=ue>>>26,ue&=67108863,this.words[be]=ue}return Ae!==0&&(this.words[be]=Ae,this.length++),this},ae.prototype.isZero=function(){return this.length===1&&this.words[0]===0},ae.prototype.cmpn=function(de){var he=de<0;if(this.negative!==0&&!he)return-1;if(this.negative===0&&he)return 1;this._strip();var ve;if(this.length>1)ve=1;else{he&&(de=-de),ie(de<=67108863,"Number is too big");var we=this.words[0]|0;ve=we===de?0:we<de?-1:1}return this.negative!==0?-ve|0:ve},ae.prototype.cmp=function(de){if(this.negative!==0&&de.negative===0)return-1;if(this.negative===0&&de.negative!==0)return 1;var he=this.ucmp(de);return this.negative!==0?-he|0:he},ae.prototype.ucmp=function(de){if(this.length>de.length)return 1;if(this.length<de.length)return-1;for(var he=0,ve=this.length-1;ve>=0;ve--){var we=this.words[ve]|0,Ae=de.words[ve]|0;if(we!==Ae){we<Ae?he=-1:we>Ae&&(he=1);break}}return he},ae.prototype.gtn=function(de){return this.cmpn(de)===1},ae.prototype.gt=function(de){return this.cmp(de)===1},ae.prototype.gten=function(de){return this.cmpn(de)>=0},ae.prototype.gte=function(de){return this.cmp(de)>=0},ae.prototype.ltn=function(de){return this.cmpn(de)===-1},ae.prototype.lt=function(de){return this.cmp(de)===-1},ae.prototype.lten=function(de){return this.cmpn(de)<=0},ae.prototype.lte=function(de){return this.cmp(de)<=0},ae.prototype.eqn=function(de){return this.cmpn(de)===0},ae.prototype.eq=function(de){return this.cmp(de)===0},ae.red=function(de){return new _e(de)},ae.prototype.toRed=function(de){return ie(!this.red,"Already a number in reduction context"),ie(this.negative===0,"red works only with positives"),de.convertTo(this)._forceRed(de)},ae.prototype.fromRed=function(){return ie(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},ae.prototype._forceRed=function(de){return this.red=de,this},ae.prototype.forceRed=function(de){return ie(!this.red,"Already a number in reduction context"),this._forceRed(de)},ae.prototype.redAdd=function(de){return ie(this.red,"redAdd works only with red numbers"),this.red.add(this,de)},ae.prototype.redIAdd=function(de){return ie(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,de)},ae.prototype.redSub=function(de){return ie(this.red,"redSub works only with red numbers"),this.red.sub(this,de)},ae.prototype.redISub=function(de){return ie(this.red,"redISub works only with red numbers"),this.red.isub(this,de)},ae.prototype.redShl=function(de){return ie(this.red,"redShl works only with red numbers"),this.red.shl(this,de)},ae.prototype.redMul=function(de){return ie(this.red,"redMul works only with red numbers"),this.red._verify2(this,de),this.red.mul(this,de)},ae.prototype.redIMul=function(de){return ie(this.red,"redMul works only with red numbers"),this.red._verify2(this,de),this.red.imul(this,de)},ae.prototype.redSqr=function(){return ie(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},ae.prototype.redISqr=function(){return ie(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},ae.prototype.redSqrt=function(){return ie(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},ae.prototype.redInvm=function(){return ie(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},ae.prototype.redNeg=function(){return ie(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},ae.prototype.redPow=function(de){return ie(this.red&&!de.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,de)};var He={k256:null,p224:null,p192:null,p25519:null};function ze(ce,de){this.name=ce,this.p=new ae(de,16),this.n=this.p.bitLength(),this.k=new ae(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}ze.prototype._tmp=function(){var de=new ae(null);return de.words=new Array(Math.ceil(this.n/13)),de},ze.prototype.ireduce=function(de){var he=de,ve;do this.split(he,this.tmp),he=this.imulK(he),he=he.iadd(this.tmp),ve=he.bitLength();while(ve>this.n);var we=ve<this.n?-1:he.ucmp(this.p);return we===0?(he.words[0]=0,he.length=1):we>0?he.isub(this.p):he.strip!==void 0?he.strip():he._strip(),he},ze.prototype.split=function(de,he){de.iushrn(this.n,0,he)},ze.prototype.imulK=function(de){return de.imul(this.k)};function Je(){ze.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}fe(Je,ze),Je.prototype.split=function(de,he){for(var ve=4194303,we=Math.min(de.length,9),Ae=0;Ae<we;Ae++)he.words[Ae]=de.words[Ae];if(he.length=we,de.length<=9){de.words[0]=0,de.length=1;return}var be=de.words[9];for(he.words[he.length++]=be&ve,Ae=10;Ae<de.length;Ae++){var ue=de.words[Ae]|0;de.words[Ae-10]=(ue&ve)<<4|be>>>22,be=ue}be>>>=22,de.words[Ae-10]=be,be===0&&de.length>10?de.length-=10:de.length-=9},Je.prototype.imulK=function(de){de.words[de.length]=0,de.words[de.length+1]=0,de.length+=2;for(var he=0,ve=0;ve<de.length;ve++){var we=de.words[ve]|0;he+=we*977,de.words[ve]=he&67108863,he=we*64+(he/67108864|0)}return de.words[de.length-1]===0&&(de.length--,de.words[de.length-1]===0&&de.length--),de};function Xe(){ze.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}fe(Xe,ze);function Ue(){ze.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}fe(Ue,ze);function $t(){ze.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}fe($t,ze),$t.prototype.imulK=function(de){for(var he=0,ve=0;ve<de.length;ve++){var we=(de.words[ve]|0)*19+he,Ae=we&67108863;we>>>=26,de.words[ve]=Ae,he=we}return he!==0&&(de.words[de.length++]=he),de},ae._prime=function(de){if(He[de])return He[de];var he;if(de==="k256")he=new Je;else if(de==="p224")he=new Xe;else if(de==="p192")he=new Ue;else if(de==="p25519")he=new $t;else throw new Error("Unknown prime "+de);return He[de]=he,he};function _e(ce){if(typeof ce=="string"){var de=ae._prime(ce);this.m=de.p,this.prime=de}else ie(ce.gtn(1),"modulus must be greater than 1"),this.m=ce,this.prime=null}_e.prototype._verify1=function(de){ie(de.negative===0,"red works only with positives"),ie(de.red,"red works only with red numbers")},_e.prototype._verify2=function(de,he){ie((de.negative|he.negative)===0,"red works only with positives"),ie(de.red&&de.red===he.red,"red works only with red numbers")},_e.prototype.imod=function(de){return this.prime?this.prime.ireduce(de)._forceRed(this):(xe(de,de.umod(this.m)._forceRed(this)),de)},_e.prototype.neg=function(de){return de.isZero()?de.clone():this.m.sub(de)._forceRed(this)},_e.prototype.add=function(de,he){this._verify2(de,he);var ve=de.add(he);return ve.cmp(this.m)>=0&&ve.isub(this.m),ve._forceRed(this)},_e.prototype.iadd=function(de,he){this._verify2(de,he);var ve=de.iadd(he);return ve.cmp(this.m)>=0&&ve.isub(this.m),ve},_e.prototype.sub=function(de,he){this._verify2(de,he);var ve=de.sub(he);return ve.cmpn(0)<0&&ve.iadd(this.m),ve._forceRed(this)},_e.prototype.isub=function(de,he){this._verify2(de,he);var ve=de.isub(he);return ve.cmpn(0)<0&&ve.iadd(this.m),ve},_e.prototype.shl=function(de,he){return this._verify1(de),this.imod(de.ushln(he))},_e.prototype.imul=function(de,he){return this._verify2(de,he),this.imod(de.imul(he))},_e.prototype.mul=function(de,he){return this._verify2(de,he),this.imod(de.mul(he))},_e.prototype.isqr=function(de){return this.imul(de,de.clone())},_e.prototype.sqr=function(de){return this.mul(de,de)},_e.prototype.sqrt=function(de){if(de.isZero())return de.clone();var he=this.m.andln(3);if(ie(he%2===1),he===3){var ve=this.m.add(new ae(1)).iushrn(2);return this.pow(de,ve)}for(var we=this.m.subn(1),Ae=0;!we.isZero()&&we.andln(1)===0;)Ae++,we.iushrn(1);ie(!we.isZero());var be=new ae(1).toRed(this),ue=be.redNeg(),ge=this.m.subn(1).iushrn(1),Re=this.m.bitLength();for(Re=new ae(2*Re*Re).toRed(this);this.pow(Re,ge).cmp(ue)!==0;)Re.redIAdd(ue);for(var Ne=this.pow(Re,we),qe=this.pow(de,we.addn(1).iushrn(1)),Pe=this.pow(de,we),Ge=Ae;Pe.cmp(be)!==0;){for(var Ce=Pe,De=0;Ce.cmp(be)!==0;De++)Ce=Ce.redSqr();ie(De<Ge);var je=this.pow(Ne,new ae(1).iushln(Ge-De-1));qe=qe.redMul(je),Ne=je.redSqr(),Pe=Pe.redMul(Ne),Ge=De}return qe},_e.prototype.invm=function(de){var he=de._invmp(this.m);return he.negative!==0?(he.negative=0,this.imod(he).redNeg()):this.imod(he)},_e.prototype.pow=function(de,he){if(he.isZero())return new ae(1).toRed(this);if(he.cmpn(1)===0)return de.clone();var ve=4,we=new Array(1<<ve);we[0]=new ae(1).toRed(this),we[1]=de;for(var Ae=2;Ae<we.length;Ae++)we[Ae]=this.mul(we[Ae-1],de);var be=we[0],ue=0,ge=0,Re=he.bitLength()%26;for(Re===0&&(Re=26),Ae=he.length-1;Ae>=0;Ae--){for(var Ne=he.words[Ae],qe=Re-1;qe>=0;qe--){var Pe=Ne>>qe&1;if(be!==we[0]&&(be=this.sqr(be)),Pe===0&&ue===0){ge=0;continue}ue<<=1,ue|=Pe,ge++,!(ge!==ve&&(Ae!==0||qe!==0))&&(be=this.mul(be,we[ue]),ge=0,ue=0)}Re=26}return be},_e.prototype.convertTo=function(de){var he=de.umod(this.m);return he===de?he.clone():he},_e.prototype.convertFrom=function(de){var he=de.clone();return he.red=null,he},ae.mont=function(de){return new se(de)};function se(ce){_e.call(this,ce),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new ae(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}fe(se,_e),se.prototype.convertTo=function(de){return this.imod(de.ushln(this.shift))},se.prototype.convertFrom=function(de){var he=this.imod(de.mul(this.rinv));return he.red=null,he},se.prototype.imul=function(de,he){if(de.isZero()||he.isZero())return de.words[0]=0,de.length=1,de;var ve=de.imul(he),we=ve.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Ae=ve.isub(we).iushrn(this.shift),be=Ae;return Ae.cmp(this.m)>=0?be=Ae.isub(this.m):Ae.cmpn(0)<0&&(be=Ae.iadd(this.m)),be._forceRed(this)},se.prototype.mul=function(de,he){if(de.isZero()||he.isZero())return new ae(0)._forceRed(this);var ve=de.mul(he),we=ve.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Ae=ve.isub(we).iushrn(this.shift),be=Ae;return Ae.cmp(this.m)>=0?be=Ae.isub(this.m):Ae.cmpn(0)<0&&(be=Ae.iadd(this.m)),be._forceRed(this)},se.prototype.invm=function(de){var he=this.imod(de._invmp(this.m).mul(this.r2));return he._forceRed(this)}})(c,commonjsGlobal)})(bn$8);var bnExports$3=bn$8.exports;const BN$8=getDefaultExportFromCjs$2(bnExports$3),version$u="logger/5.8.0";let _permanentCensorErrors=!1,_censorErrors=!1;const LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};let _logLevel=LogLevels.default,_globalLogger=null;function _checkNormalize(){try{const c=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{c.push(t)}}),c.length)throw new Error("missing "+c.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(c){return c.message}return null}const _normalizeError=_checkNormalize();var LogLevel;(function(c){c.DEBUG="DEBUG",c.INFO="INFO",c.WARNING="WARNING",c.ERROR="ERROR",c.OFF="OFF"})(LogLevel||(LogLevel={}));var ErrorCode;(function(c){c.UNKNOWN_ERROR="UNKNOWN_ERROR",c.NOT_IMPLEMENTED="NOT_IMPLEMENTED",c.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",c.NETWORK_ERROR="NETWORK_ERROR",c.SERVER_ERROR="SERVER_ERROR",c.TIMEOUT="TIMEOUT",c.BUFFER_OVERRUN="BUFFER_OVERRUN",c.NUMERIC_FAULT="NUMERIC_FAULT",c.MISSING_NEW="MISSING_NEW",c.INVALID_ARGUMENT="INVALID_ARGUMENT",c.MISSING_ARGUMENT="MISSING_ARGUMENT",c.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",c.CALL_EXCEPTION="CALL_EXCEPTION",c.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",c.NONCE_EXPIRED="NONCE_EXPIRED",c.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",c.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",c.TRANSACTION_REPLACED="TRANSACTION_REPLACED",c.ACTION_REJECTED="ACTION_REJECTED"})(ErrorCode||(ErrorCode={}));const HEX="0123456789abcdef";class Logger{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,n){const ie=t.toLowerCase();LogLevels[ie]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(_logLevel>LogLevels[ie])&&console.log.apply(console,n)}debug(...t){this._log(Logger.levels.DEBUG,t)}info(...t){this._log(Logger.levels.INFO,t)}warn(...t){this._log(Logger.levels.WARNING,t)}makeError(t,n,ie){if(_censorErrors)return this.makeError("censored error",n,{});n||(n=Logger.errors.UNKNOWN_ERROR),ie||(ie={});const fe=[];Object.keys(ie).forEach(me=>{const ye=ie[me];try{if(ye instanceof Uint8Array){let xe="";for(let Ee=0;Ee<ye.length;Ee++)xe+=HEX[ye[Ee]>>4],xe+=HEX[ye[Ee]&15];fe.push(me+"=Uint8Array(0x"+xe+")")}else fe.push(me+"="+JSON.stringify(ye))}catch{fe.push(me+"="+JSON.stringify(ie[me].toString()))}}),fe.push(`code=${n}`),fe.push(`version=${this.version}`);const ae=t;let le="";switch(n){case ErrorCode.NUMERIC_FAULT:{le="NUMERIC_FAULT";const me=t;switch(me){case"overflow":case"underflow":case"division-by-zero":le+="-"+me;break;case"negative-power":case"negative-width":le+="-unsupported";break;case"unbound-bitwise-result":le+="-unbound-result";break}break}case ErrorCode.CALL_EXCEPTION:case ErrorCode.INSUFFICIENT_FUNDS:case ErrorCode.MISSING_NEW:case ErrorCode.NONCE_EXPIRED:case ErrorCode.REPLACEMENT_UNDERPRICED:case ErrorCode.TRANSACTION_REPLACED:case ErrorCode.UNPREDICTABLE_GAS_LIMIT:le=n;break}le&&(t+=" [ See: https://links.ethers.org/v5-errors-"+le+" ]"),fe.length&&(t+=" ("+fe.join(", ")+")");const pe=new Error(t);return pe.reason=ae,pe.code=n,Object.keys(ie).forEach(function(me){pe[me]=ie[me]}),pe}throwError(t,n,ie){throw this.makeError(t,n,ie)}throwArgumentError(t,n,ie){return this.throwError(t,Logger.errors.INVALID_ARGUMENT,{argument:n,value:ie})}assert(t,n,ie,fe){t||this.throwError(n,ie,fe)}assertArgument(t,n,ie,fe){t||this.throwArgumentError(n,ie,fe)}checkNormalize(t){_normalizeError&&this.throwError("platform missing String.prototype.normalize",Logger.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}checkSafeUint53(t,n){typeof t=="number"&&(n==null&&(n="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(n,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(n,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,n,ie){ie?ie=": "+ie:ie="",t<n&&this.throwError("missing argument"+ie,Logger.errors.MISSING_ARGUMENT,{count:t,expectedCount:n}),t>n&&this.throwError("too many arguments"+ie,Logger.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:n})}checkNew(t,n){(t===Object||t==null)&&this.throwError("missing new",Logger.errors.MISSING_NEW,{name:n.name})}checkAbstract(t,n){t===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",Logger.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",Logger.errors.MISSING_NEW,{name:n.name})}static globalLogger(){return _globalLogger||(_globalLogger=new Logger(version$u)),_globalLogger}static setCensorship(t,n){if(!t&&n&&this.globalLogger().throwError("cannot permanently disable censorship",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),_permanentCensorErrors){if(!t)return;this.globalLogger().throwError("error censorship permanent",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!t,_permanentCensorErrors=!!n}static setLogLevel(t){const n=LogLevels[t.toLowerCase()];if(n==null){Logger.globalLogger().warn("invalid log level - "+t);return}_logLevel=n}static from(t){return new Logger(t)}}Logger.errors=ErrorCode;Logger.levels=LogLevel;const lib_esm$k=Object.freeze(Object.defineProperty({__proto__:null,get ErrorCode(){return ErrorCode},get LogLevel(){return LogLevel},Logger},Symbol.toStringTag,{value:"Module"})),version$t="bytes/5.8.0",logger$x=new Logger(version$t);function isHexable(c){return!!c.toHexString}function addSlice(c){return c.slice||(c.slice=function(){const t=Array.prototype.slice.call(arguments);return addSlice(new Uint8Array(Array.prototype.slice.apply(c,t)))}),c}function isBytesLike(c){return isHexString(c)&&!(c.length%2)||isBytes$1(c)}function isInteger(c){return typeof c=="number"&&c==c&&c%1===0}function isBytes$1(c){if(c==null)return!1;if(c.constructor===Uint8Array)return!0;if(typeof c=="string"||!isInteger(c.length)||c.length<0)return!1;for(let t=0;t<c.length;t++){const n=c[t];if(!isInteger(n)||n<0||n>=256)return!1}return!0}function arrayify(c,t){if(t||(t={}),typeof c=="number"){logger$x.checkSafeUint53(c,"invalid arrayify value");const n=[];for(;c;)n.unshift(c&255),c=parseInt(String(c/256));return n.length===0&&n.push(0),addSlice(new Uint8Array(n))}if(t.allowMissingPrefix&&typeof c=="string"&&c.substring(0,2)!=="0x"&&(c="0x"+c),isHexable(c)&&(c=c.toHexString()),isHexString(c)){let n=c.substring(2);n.length%2&&(t.hexPad==="left"?n="0"+n:t.hexPad==="right"?n+="0":logger$x.throwArgumentError("hex data is odd-length","value",c));const ie=[];for(let fe=0;fe<n.length;fe+=2)ie.push(parseInt(n.substring(fe,fe+2),16));return addSlice(new Uint8Array(ie))}return isBytes$1(c)?addSlice(new Uint8Array(c)):logger$x.throwArgumentError("invalid arrayify value","value",c)}function concat$1(c){const t=c.map(fe=>arrayify(fe)),n=t.reduce((fe,ae)=>fe+ae.length,0),ie=new Uint8Array(n);return t.reduce((fe,ae)=>(ie.set(ae,fe),fe+ae.length),0),addSlice(ie)}function stripZeros(c){let t=arrayify(c);if(t.length===0)return t;let n=0;for(;n<t.length&&t[n]===0;)n++;return n&&(t=t.slice(n)),t}function zeroPad(c,t){c=arrayify(c),c.length>t&&logger$x.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(c,t-c.length),addSlice(n)}function isHexString(c,t){return!(typeof c!="string"||!c.match(/^0x[0-9A-Fa-f]*$/)||t&&c.length!==2+2*t)}const HexCharacters="0123456789abcdef";function hexlify(c,t){if(t||(t={}),typeof c=="number"){logger$x.checkSafeUint53(c,"invalid hexlify value");let n="";for(;c;)n=HexCharacters[c&15]+n,c=Math.floor(c/16);return n.length?(n.length%2&&(n="0"+n),"0x"+n):"0x00"}if(typeof c=="bigint")return c=c.toString(16),c.length%2?"0x0"+c:"0x"+c;if(t.allowMissingPrefix&&typeof c=="string"&&c.substring(0,2)!=="0x"&&(c="0x"+c),isHexable(c))return c.toHexString();if(isHexString(c))return c.length%2&&(t.hexPad==="left"?c="0x0"+c.substring(2):t.hexPad==="right"?c+="0":logger$x.throwArgumentError("hex data is odd-length","value",c)),c.toLowerCase();if(isBytes$1(c)){let n="0x";for(let ie=0;ie<c.length;ie++){let fe=c[ie];n+=HexCharacters[(fe&240)>>4]+HexCharacters[fe&15]}return n}return logger$x.throwArgumentError("invalid hexlify value","value",c)}function hexDataLength(c){if(typeof c!="string")c=hexlify(c);else if(!isHexString(c)||c.length%2)return null;return(c.length-2)/2}function hexDataSlice(c,t,n){return typeof c!="string"?c=hexlify(c):(!isHexString(c)||c.length%2)&&logger$x.throwArgumentError("invalid hexData","value",c),t=2+2*t,n!=null?"0x"+c.substring(t,2+2*n):"0x"+c.substring(t)}function hexConcat(c){let t="0x";return c.forEach(n=>{t+=hexlify(n).substring(2)}),t}function hexValue(c){const t=hexStripZeros(hexlify(c,{hexPad:"left"}));return t==="0x"?"0x0":t}function hexStripZeros(c){typeof c!="string"&&(c=hexlify(c)),isHexString(c)||logger$x.throwArgumentError("invalid hex string","value",c),c=c.substring(2);let t=0;for(;t<c.length&&c[t]==="0";)t++;return"0x"+c.substring(t)}function hexZeroPad(c,t){for(typeof c!="string"?c=hexlify(c):isHexString(c)||logger$x.throwArgumentError("invalid hex string","value",c),c.length>2*t+2&&logger$x.throwArgumentError("value out of range","value",arguments[1]);c.length<2*t+2;)c="0x0"+c.substring(2);return c}function splitSignature(c){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(isBytesLike(c)){let n=arrayify(c);n.length===64?(t.v=27+(n[32]>>7),n[32]&=127,t.r=hexlify(n.slice(0,32)),t.s=hexlify(n.slice(32,64))):n.length===65?(t.r=hexlify(n.slice(0,32)),t.s=hexlify(n.slice(32,64)),t.v=n[64]):logger$x.throwArgumentError("invalid signature string","signature",c),t.v<27&&(t.v===0||t.v===1?t.v+=27:logger$x.throwArgumentError("signature invalid v byte","signature",c)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=hexlify(n.slice(32,64))}else{if(t.r=c.r,t.s=c.s,t.v=c.v,t.recoveryParam=c.recoveryParam,t._vs=c._vs,t._vs!=null){const fe=zeroPad(arrayify(t._vs),32);t._vs=hexlify(fe);const ae=fe[0]>=128?1:0;t.recoveryParam==null?t.recoveryParam=ae:t.recoveryParam!==ae&&logger$x.throwArgumentError("signature recoveryParam mismatch _vs","signature",c),fe[0]&=127;const le=hexlify(fe);t.s==null?t.s=le:t.s!==le&&logger$x.throwArgumentError("signature v mismatch _vs","signature",c)}if(t.recoveryParam==null)t.v==null?logger$x.throwArgumentError("signature missing v and recoveryParam","signature",c):t.v===0||t.v===1?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(t.v==null)t.v=27+t.recoveryParam;else{const fe=t.v===0||t.v===1?t.v:1-t.v%2;t.recoveryParam!==fe&&logger$x.throwArgumentError("signature recoveryParam mismatch v","signature",c)}t.r==null||!isHexString(t.r)?logger$x.throwArgumentError("signature missing or invalid r","signature",c):t.r=hexZeroPad(t.r,32),t.s==null||!isHexString(t.s)?logger$x.throwArgumentError("signature missing or invalid s","signature",c):t.s=hexZeroPad(t.s,32);const n=arrayify(t.s);n[0]>=128&&logger$x.throwArgumentError("signature s out of range","signature",c),t.recoveryParam&&(n[0]|=128);const ie=hexlify(n);t._vs&&(isHexString(t._vs)||logger$x.throwArgumentError("signature invalid _vs","signature",c),t._vs=hexZeroPad(t._vs,32)),t._vs==null?t._vs=ie:t._vs!==ie&&logger$x.throwArgumentError("signature _vs mismatch v and s","signature",c)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function joinSignature(c){return c=splitSignature(c),hexlify(concat$1([c.r,c.s,c.recoveryParam?"0x1c":"0x1b"]))}const lib_esm$j=Object.freeze(Object.defineProperty({__proto__:null,arrayify,concat:concat$1,hexConcat,hexDataLength,hexDataSlice,hexStripZeros,hexValue,hexZeroPad,hexlify,isBytes:isBytes$1,isBytesLike,isHexString,joinSignature,splitSignature,stripZeros,zeroPad},Symbol.toStringTag,{value:"Module"})),version$s="bignumber/5.8.0";var BN$7=BN$8.BN;const logger$w=new Logger(version$s),_constructorGuard$4={},MAX_SAFE=9007199254740991;function isBigNumberish(c){return c!=null&&(BigNumber.isBigNumber(c)||typeof c=="number"&&c%1===0||typeof c=="string"&&!!c.match(/^-?[0-9]+$/)||isHexString(c)||typeof c=="bigint"||isBytes$1(c))}let _warnedToStringRadix=!1;class BigNumber{constructor(t,n){t!==_constructorGuard$4&&logger$w.throwError("cannot call constructor directly; use BigNumber.from",Logger.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=n,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return toBigNumber(toBN(this).fromTwos(t))}toTwos(t){return toBigNumber(toBN(this).toTwos(t))}abs(){return this._hex[0]==="-"?BigNumber.from(this._hex.substring(1)):this}add(t){return toBigNumber(toBN(this).add(toBN(t)))}sub(t){return toBigNumber(toBN(this).sub(toBN(t)))}div(t){return BigNumber.from(t).isZero()&&throwFault$1("division-by-zero","div"),toBigNumber(toBN(this).div(toBN(t)))}mul(t){return toBigNumber(toBN(this).mul(toBN(t)))}mod(t){const n=toBN(t);return n.isNeg()&&throwFault$1("division-by-zero","mod"),toBigNumber(toBN(this).umod(n))}pow(t){const n=toBN(t);return n.isNeg()&&throwFault$1("negative-power","pow"),toBigNumber(toBN(this).pow(n))}and(t){const n=toBN(t);return(this.isNegative()||n.isNeg())&&throwFault$1("unbound-bitwise-result","and"),toBigNumber(toBN(this).and(n))}or(t){const n=toBN(t);return(this.isNegative()||n.isNeg())&&throwFault$1("unbound-bitwise-result","or"),toBigNumber(toBN(this).or(n))}xor(t){const n=toBN(t);return(this.isNegative()||n.isNeg())&&throwFault$1("unbound-bitwise-result","xor"),toBigNumber(toBN(this).xor(n))}mask(t){return(this.isNegative()||t<0)&&throwFault$1("negative-width","mask"),toBigNumber(toBN(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&throwFault$1("negative-width","shl"),toBigNumber(toBN(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&throwFault$1("negative-width","shr"),toBigNumber(toBN(this).shrn(t))}eq(t){return toBN(this).eq(toBN(t))}lt(t){return toBN(this).lt(toBN(t))}lte(t){return toBN(this).lte(toBN(t))}gt(t){return toBN(this).gt(toBN(t))}gte(t){return toBN(this).gte(toBN(t))}isNegative(){return this._hex[0]==="-"}isZero(){return toBN(this).isZero()}toNumber(){try{return toBN(this).toNumber()}catch{throwFault$1("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return logger$w.throwError("this platform does not support BigInt",Logger.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?_warnedToStringRadix||(_warnedToStringRadix=!0,logger$w.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?logger$w.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Logger.errors.UNEXPECTED_ARGUMENT,{}):logger$w.throwError("BigNumber.toString does not accept parameters",Logger.errors.UNEXPECTED_ARGUMENT,{})),toBN(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof BigNumber)return t;if(typeof t=="string")return t.match(/^-?0x[0-9a-f]+$/i)?new BigNumber(_constructorGuard$4,toHex$2(t)):t.match(/^-?[0-9]+$/)?new BigNumber(_constructorGuard$4,toHex$2(new BN$7(t))):logger$w.throwArgumentError("invalid BigNumber string","value",t);if(typeof t=="number")return t%1&&throwFault$1("underflow","BigNumber.from",t),(t>=MAX_SAFE||t<=-MAX_SAFE)&&throwFault$1("overflow","BigNumber.from",t),BigNumber.from(String(t));const n=t;if(typeof n=="bigint")return BigNumber.from(n.toString());if(isBytes$1(n))return BigNumber.from(hexlify(n));if(n)if(n.toHexString){const ie=n.toHexString();if(typeof ie=="string")return BigNumber.from(ie)}else{let ie=n._hex;if(ie==null&&n.type==="BigNumber"&&(ie=n.hex),typeof ie=="string"&&(isHexString(ie)||ie[0]==="-"&&isHexString(ie.substring(1))))return BigNumber.from(ie)}return logger$w.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!!(t&&t._isBigNumber)}}function toHex$2(c){if(typeof c!="string")return toHex$2(c.toString(16));if(c[0]==="-")return c=c.substring(1),c[0]==="-"&&logger$w.throwArgumentError("invalid hex","value",c),c=toHex$2(c),c==="0x00"?c:"-"+c;if(c.substring(0,2)!=="0x"&&(c="0x"+c),c==="0x")return"0x00";for(c.length%2&&(c="0x0"+c.substring(2));c.length>4&&c.substring(0,4)==="0x00";)c="0x"+c.substring(4);return c}function toBigNumber(c){return BigNumber.from(toHex$2(c))}function toBN(c){const t=BigNumber.from(c).toHexString();return t[0]==="-"?new BN$7("-"+t.substring(3),16):new BN$7(t.substring(2),16)}function throwFault$1(c,t,n){const ie={fault:c,operation:t};return n!=null&&(ie.value=n),logger$w.throwError(c,Logger.errors.NUMERIC_FAULT,ie)}function _base36To16(c){return new BN$7(c,36).toString(16)}function _base16To36(c){return new BN$7(c,16).toString(36)}const logger$v=new Logger(version$s),_constructorGuard$3={},Zero$2=BigNumber.from(0),NegativeOne$2=BigNumber.from(-1);function throwFault(c,t,n,ie){const fe={fault:t,operation:n};return ie!==void 0&&(fe.value=ie),logger$v.throwError(c,Logger.errors.NUMERIC_FAULT,fe)}let zeros="0";for(;zeros.length<256;)zeros+=zeros;function getMultiplier(c){if(typeof c!="number")try{c=BigNumber.from(c).toNumber()}catch{}return typeof c=="number"&&c>=0&&c<=256&&!(c%1)?"1"+zeros.substring(0,c):logger$v.throwArgumentError("invalid decimal size","decimals",c)}function formatFixed(c,t){t==null&&(t=0);const n=getMultiplier(t);c=BigNumber.from(c);const ie=c.lt(Zero$2);ie&&(c=c.mul(NegativeOne$2));let fe=c.mod(n).toString();for(;fe.length<n.length-1;)fe="0"+fe;fe=fe.match(/^([0-9]*[1-9]|0)(0*)/)[1];const ae=c.div(n).toString();return n.length===1?c=ae:c=ae+"."+fe,ie&&(c="-"+c),c}function parseFixed(c,t){t==null&&(t=0);const n=getMultiplier(t);(typeof c!="string"||!c.match(/^-?[0-9.]+$/))&&logger$v.throwArgumentError("invalid decimal value","value",c);const ie=c.substring(0,1)==="-";ie&&(c=c.substring(1)),c==="."&&logger$v.throwArgumentError("missing value","value",c);const fe=c.split(".");fe.length>2&&logger$v.throwArgumentError("too many decimal points","value",c);let ae=fe[0],le=fe[1];for(ae||(ae="0"),le||(le="0");le[le.length-1]==="0";)le=le.substring(0,le.length-1);for(le.length>n.length-1&&throwFault("fractional component exceeds decimals","underflow","parseFixed"),le===""&&(le="0");le.length<n.length-1;)le+="0";const pe=BigNumber.from(ae),me=BigNumber.from(le);let ye=pe.mul(n).add(me);return ie&&(ye=ye.mul(NegativeOne$2)),ye}class FixedFormat{constructor(t,n,ie,fe){t!==_constructorGuard$3&&logger$v.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Logger.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=n,this.width=ie,this.decimals=fe,this.name=(n?"":"u")+"fixed"+String(ie)+"x"+String(fe),this._multiplier=getMultiplier(fe),Object.freeze(this)}static from(t){if(t instanceof FixedFormat)return t;typeof t=="number"&&(t=`fixed128x${t}`);let n=!0,ie=128,fe=18;if(typeof t=="string"){if(t!=="fixed")if(t==="ufixed")n=!1;else{const ae=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);ae||logger$v.throwArgumentError("invalid fixed format","format",t),n=ae[1]!=="u",ie=parseInt(ae[2]),fe=parseInt(ae[3])}}else if(t){const ae=(le,pe,me)=>t[le]==null?me:(typeof t[le]!==pe&&logger$v.throwArgumentError("invalid fixed format ("+le+" not "+pe+")","format."+le,t[le]),t[le]);n=ae("signed","boolean",n),ie=ae("width","number",ie),fe=ae("decimals","number",fe)}return ie%8&&logger$v.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",ie),fe>80&&logger$v.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",fe),new FixedFormat(_constructorGuard$3,n,ie,fe)}}class FixedNumber{constructor(t,n,ie,fe){t!==_constructorGuard$3&&logger$v.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Logger.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=fe,this._hex=n,this._value=ie,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&logger$v.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const n=parseFixed(this._value,this.format.decimals),ie=parseFixed(t._value,t.format.decimals);return FixedNumber.fromValue(n.add(ie),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const n=parseFixed(this._value,this.format.decimals),ie=parseFixed(t._value,t.format.decimals);return FixedNumber.fromValue(n.sub(ie),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const n=parseFixed(this._value,this.format.decimals),ie=parseFixed(t._value,t.format.decimals);return FixedNumber.fromValue(n.mul(ie).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const n=parseFixed(this._value,this.format.decimals),ie=parseFixed(t._value,t.format.decimals);return FixedNumber.fromValue(n.mul(this.format._multiplier).div(ie),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");t.length===1&&t.push("0");let n=FixedNumber.from(t[0],this.format);const ie=!t[1].match(/^(0*)$/);return this.isNegative()&&ie&&(n=n.subUnsafe(ONE.toFormat(n.format))),n}ceiling(){const t=this.toString().split(".");t.length===1&&t.push("0");let n=FixedNumber.from(t[0],this.format);const ie=!t[1].match(/^(0*)$/);return!this.isNegative()&&ie&&(n=n.addUnsafe(ONE.toFormat(n.format))),n}round(t){t==null&&(t=0);const n=this.toString().split(".");if(n.length===1&&n.push("0"),(t<0||t>80||t%1)&&logger$v.throwArgumentError("invalid decimal count","decimals",t),n[1].length<=t)return this;const ie=FixedNumber.from("1"+zeros.substring(0,t),this.format),fe=BUMP.toFormat(this.format);return this.mulUnsafe(ie).addUnsafe(fe).floor().divUnsafe(ie)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(t){if(t==null)return this._hex;t%8&&logger$v.throwArgumentError("invalid byte width","width",t);const n=BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString();return hexZeroPad(n,t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return FixedNumber.fromString(this._value,t)}static fromValue(t,n,ie){return ie==null&&n!=null&&!isBigNumberish(n)&&(ie=n,n=null),n==null&&(n=0),ie==null&&(ie="fixed"),FixedNumber.fromString(formatFixed(t,n),FixedFormat.from(ie))}static fromString(t,n){n==null&&(n="fixed");const ie=FixedFormat.from(n),fe=parseFixed(t,ie.decimals);!ie.signed&&fe.lt(Zero$2)&&throwFault("unsigned value cannot be negative","overflow","value",t);let ae=null;ie.signed?ae=fe.toTwos(ie.width).toHexString():(ae=fe.toHexString(),ae=hexZeroPad(ae,ie.width/8));const le=formatFixed(fe,ie.decimals);return new FixedNumber(_constructorGuard$3,ae,le,ie)}static fromBytes(t,n){n==null&&(n="fixed");const ie=FixedFormat.from(n);if(arrayify(t).length>ie.width/8)throw new Error("overflow");let fe=BigNumber.from(t);ie.signed&&(fe=fe.fromTwos(ie.width));const ae=fe.toTwos((ie.signed?0:1)+ie.width).toHexString(),le=formatFixed(fe,ie.decimals);return new FixedNumber(_constructorGuard$3,ae,le,ie)}static from(t,n){if(typeof t=="string")return FixedNumber.fromString(t,n);if(isBytes$1(t))return FixedNumber.fromBytes(t,n);try{return FixedNumber.fromValue(t,0,n)}catch(ie){if(ie.code!==Logger.errors.INVALID_ARGUMENT)throw ie}return logger$v.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!!(t&&t._isFixedNumber)}}const ONE=FixedNumber.from(1),BUMP=FixedNumber.from("0.5"),version$r="properties/5.8.0";var __awaiter$l=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$u=new Logger(version$r);function defineReadOnly(c,t,n){Object.defineProperty(c,t,{enumerable:!0,value:n,writable:!1})}function getStatic(c,t){for(let n=0;n<32;n++){if(c[t])return c[t];if(!c.prototype||typeof c.prototype!="object")break;c=Object.getPrototypeOf(c.prototype).constructor}return null}function resolveProperties(c){return __awaiter$l(this,void 0,void 0,function*(){const t=Object.keys(c).map(ie=>{const fe=c[ie];return Promise.resolve(fe).then(ae=>({key:ie,value:ae}))});return(yield Promise.all(t)).reduce((ie,fe)=>(ie[fe.key]=fe.value,ie),{})})}function checkProperties(c,t){(!c||typeof c!="object")&&logger$u.throwArgumentError("invalid object","object",c),Object.keys(c).forEach(n=>{t[n]||logger$u.throwArgumentError("invalid object key - "+n,"transaction:"+n,c)})}function shallowCopy(c){const t={};for(const n in c)t[n]=c[n];return t}const opaque={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function _isFrozen(c){if(c==null||opaque[typeof c])return!0;if(Array.isArray(c)||typeof c=="object"){if(!Object.isFrozen(c))return!1;const t=Object.keys(c);for(let n=0;n<t.length;n++){let ie=null;try{ie=c[t[n]]}catch{continue}if(!_isFrozen(ie))return!1}return!0}return logger$u.throwArgumentError(`Cannot deepCopy ${typeof c}`,"object",c)}function _deepCopy(c){if(_isFrozen(c))return c;if(Array.isArray(c))return Object.freeze(c.map(t=>deepCopy(t)));if(typeof c=="object"){const t={};for(const n in c){const ie=c[n];ie!==void 0&&defineReadOnly(t,n,deepCopy(ie))}return t}return logger$u.throwArgumentError(`Cannot deepCopy ${typeof c}`,"object",c)}function deepCopy(c){return _deepCopy(c)}class Description{constructor(t){for(const n in t)this[n]=deepCopy(t[n])}}const lib_esm$i=Object.freeze(Object.defineProperty({__proto__:null,Description,checkProperties,deepCopy,defineReadOnly,getStatic,resolveProperties,shallowCopy},Symbol.toStringTag,{value:"Module"})),version$q="abi/5.8.0",logger$t=new Logger(version$q),_constructorGuard$2={};let ModifiersBytes={calldata:!0,memory:!0,storage:!0},ModifiersNest={calldata:!0,memory:!0};function checkModifier(c,t){if(c==="bytes"||c==="string"){if(ModifiersBytes[t])return!0}else if(c==="address"){if(t==="payable")return!0}else if((c.indexOf("[")>=0||c==="tuple")&&ModifiersNest[t])return!0;return(ModifiersBytes[t]||t==="payable")&&logger$t.throwArgumentError("invalid modifier","name",t),!1}function parseParamType(c,t){let n=c;function ie(pe){logger$t.throwArgumentError(`unexpected character at position ${pe}`,"param",c)}c=c.replace(/\s/g," ");function fe(pe){let me={type:"",name:"",parent:pe,state:{allowType:!0}};return t&&(me.indexed=!1),me}let ae={type:"",name:"",state:{allowType:!0}},le=ae;for(let pe=0;pe<c.length;pe++){let me=c[pe];switch(me){case"(":le.state.allowType&&le.type===""?le.type="tuple":le.state.allowParams||ie(pe),le.state.allowType=!1,le.type=verifyType(le.type),le.components=[fe(le)],le=le.components[0];break;case")":delete le.state,le.name==="indexed"&&(t||ie(pe),le.indexed=!0,le.name=""),checkModifier(le.type,le.name)&&(le.name=""),le.type=verifyType(le.type);let ye=le;le=le.parent,le||ie(pe),delete ye.parent,le.state.allowParams=!1,le.state.allowName=!0,le.state.allowArray=!0;break;case",":delete le.state,le.name==="indexed"&&(t||ie(pe),le.indexed=!0,le.name=""),checkModifier(le.type,le.name)&&(le.name=""),le.type=verifyType(le.type);let xe=fe(le.parent);le.parent.components.push(xe),delete le.parent,le=xe;break;case" ":le.state.allowType&&le.type!==""&&(le.type=verifyType(le.type),delete le.state.allowType,le.state.allowName=!0,le.state.allowParams=!0),le.state.allowName&&le.name!==""&&(le.name==="indexed"?(t||ie(pe),le.indexed&&ie(pe),le.indexed=!0,le.name=""):checkModifier(le.type,le.name)?le.name="":le.state.allowName=!1);break;case"[":le.state.allowArray||ie(pe),le.type+=me,le.state.allowArray=!1,le.state.allowName=!1,le.state.readArray=!0;break;case"]":le.state.readArray||ie(pe),le.type+=me,le.state.readArray=!1,le.state.allowArray=!0,le.state.allowName=!0;break;default:le.state.allowType?(le.type+=me,le.state.allowParams=!0,le.state.allowArray=!0):le.state.allowName?(le.name+=me,delete le.state.allowArray):le.state.readArray?le.type+=me:ie(pe)}}return le.parent&&logger$t.throwArgumentError("unexpected eof","param",c),delete ae.state,le.name==="indexed"?(t||ie(n.length-7),le.indexed&&ie(n.length-7),le.indexed=!0,le.name=""):checkModifier(le.type,le.name)&&(le.name=""),ae.type=verifyType(ae.type),ae}function populate(c,t){for(let n in t)defineReadOnly(c,n,t[n])}const FormatTypes=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),paramTypeArray=new RegExp(/^(.*)\[([0-9]*)\]$/);class ParamType{constructor(t,n){t!==_constructorGuard$2&&logger$t.throwError("use fromString",Logger.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),populate(this,n);let ie=this.type.match(paramTypeArray);ie?populate(this,{arrayLength:parseInt(ie[2]||"-1"),arrayChildren:ParamType.fromObject({type:ie[1],components:this.components}),baseType:"array"}):populate(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=FormatTypes.sighash),FormatTypes[t]||logger$t.throwArgumentError("invalid format type","format",t),t===FormatTypes.json){let ie={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(ie.indexed=this.indexed),this.components&&(ie.components=this.components.map(fe=>JSON.parse(fe.format(t)))),JSON.stringify(ie)}let n="";return this.baseType==="array"?(n+=this.arrayChildren.format(t),n+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(t!==FormatTypes.sighash&&(n+=this.type),n+="("+this.components.map(ie=>ie.format(t)).join(t===FormatTypes.full?", ":",")+")"):n+=this.type,t!==FormatTypes.sighash&&(this.indexed===!0&&(n+=" indexed"),t===FormatTypes.full&&this.name&&(n+=" "+this.name)),n}static from(t,n){return typeof t=="string"?ParamType.fromString(t,n):ParamType.fromObject(t)}static fromObject(t){return ParamType.isParamType(t)?t:new ParamType(_constructorGuard$2,{name:t.name||null,type:verifyType(t.type),indexed:t.indexed==null?null:!!t.indexed,components:t.components?t.components.map(ParamType.fromObject):null})}static fromString(t,n){function ie(fe){return ParamType.fromObject({name:fe.name,type:fe.type,indexed:fe.indexed,components:fe.components})}return ie(parseParamType(t,!!n))}static isParamType(t){return!!(t!=null&&t._isParamType)}}function parseParams(c,t){return splitNesting(c).map(n=>ParamType.fromString(n,t))}class Fragment{constructor(t,n){t!==_constructorGuard$2&&logger$t.throwError("use a static from method",Logger.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),populate(this,n),this._isFragment=!0,Object.freeze(this)}static from(t){return Fragment.isFragment(t)?t:typeof t=="string"?Fragment.fromString(t):Fragment.fromObject(t)}static fromObject(t){if(Fragment.isFragment(t))return t;switch(t.type){case"function":return FunctionFragment.fromObject(t);case"event":return EventFragment.fromObject(t);case"constructor":return ConstructorFragment.fromObject(t);case"error":return ErrorFragment.fromObject(t);case"fallback":case"receive":return null}return logger$t.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return t=t.replace(/\s/g," "),t=t.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),t=t.trim(),t.split(" ")[0]==="event"?EventFragment.fromString(t.substring(5).trim()):t.split(" ")[0]==="function"?FunctionFragment.fromString(t.substring(8).trim()):t.split("(")[0].trim()==="constructor"?ConstructorFragment.fromString(t.trim()):t.split(" ")[0]==="error"?ErrorFragment.fromString(t.substring(5).trim()):logger$t.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!!(t&&t._isFragment)}}class EventFragment extends Fragment{format(t){if(t||(t=FormatTypes.sighash),FormatTypes[t]||logger$t.throwArgumentError("invalid format type","format",t),t===FormatTypes.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(ie=>JSON.parse(ie.format(t)))});let n="";return t!==FormatTypes.sighash&&(n+="event "),n+=this.name+"("+this.inputs.map(ie=>ie.format(t)).join(t===FormatTypes.full?", ":",")+") ",t!==FormatTypes.sighash&&this.anonymous&&(n+="anonymous "),n.trim()}static from(t){return typeof t=="string"?EventFragment.fromString(t):EventFragment.fromObject(t)}static fromObject(t){if(EventFragment.isEventFragment(t))return t;t.type!=="event"&&logger$t.throwArgumentError("invalid event object","value",t);const n={name:verifyIdentifier(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(ParamType.fromObject):[],type:"event"};return new EventFragment(_constructorGuard$2,n)}static fromString(t){let n=t.match(regexParen);n||logger$t.throwArgumentError("invalid event string","value",t);let ie=!1;return n[3].split(" ").forEach(fe=>{switch(fe.trim()){case"anonymous":ie=!0;break;case"":break;default:logger$t.warn("unknown modifier: "+fe)}}),EventFragment.fromObject({name:n[1].trim(),anonymous:ie,inputs:parseParams(n[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&t.type==="event"}}function parseGas(c,t){t.gas=null;let n=c.split("@");return n.length!==1?(n.length>2&&logger$t.throwArgumentError("invalid human-readable ABI signature","value",c),n[1].match(/^[0-9]+$/)||logger$t.throwArgumentError("invalid human-readable ABI signature gas","value",c),t.gas=BigNumber.from(n[1]),n[0]):c}function parseModifiers(c,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",c.split(" ").forEach(n=>{switch(n.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+n)}})}function verifyState(c){let t={constant:!1,payable:!0,stateMutability:"payable"};return c.stateMutability!=null?(t.stateMutability=c.stateMutability,t.constant=t.stateMutability==="view"||t.stateMutability==="pure",c.constant!=null&&!!c.constant!==t.constant&&logger$t.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",c),t.payable=t.stateMutability==="payable",c.payable!=null&&!!c.payable!==t.payable&&logger$t.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",c)):c.payable!=null?(t.payable=!!c.payable,c.constant==null&&!t.payable&&c.type!=="constructor"&&logger$t.throwArgumentError("unable to determine stateMutability","value",c),t.constant=!!c.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&logger$t.throwArgumentError("cannot have constant payable function","value",c)):c.constant!=null?(t.constant=!!c.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):c.type!=="constructor"&&logger$t.throwArgumentError("unable to determine stateMutability","value",c),t}class ConstructorFragment extends Fragment{format(t){if(t||(t=FormatTypes.sighash),FormatTypes[t]||logger$t.throwArgumentError("invalid format type","format",t),t===FormatTypes.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(ie=>JSON.parse(ie.format(t)))});t===FormatTypes.sighash&&logger$t.throwError("cannot format a constructor for sighash",Logger.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let n="constructor("+this.inputs.map(ie=>ie.format(t)).join(t===FormatTypes.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(n+=this.stateMutability+" "),n.trim()}static from(t){return typeof t=="string"?ConstructorFragment.fromString(t):ConstructorFragment.fromObject(t)}static fromObject(t){if(ConstructorFragment.isConstructorFragment(t))return t;t.type!=="constructor"&&logger$t.throwArgumentError("invalid constructor object","value",t);let n=verifyState(t);n.constant&&logger$t.throwArgumentError("constructor cannot be constant","value",t);const ie={name:null,type:t.type,inputs:t.inputs?t.inputs.map(ParamType.fromObject):[],payable:n.payable,stateMutability:n.stateMutability,gas:t.gas?BigNumber.from(t.gas):null};return new ConstructorFragment(_constructorGuard$2,ie)}static fromString(t){let n={type:"constructor"};t=parseGas(t,n);let ie=t.match(regexParen);return(!ie||ie[1].trim()!=="constructor")&&logger$t.throwArgumentError("invalid constructor string","value",t),n.inputs=parseParams(ie[2].trim(),!1),parseModifiers(ie[3].trim(),n),ConstructorFragment.fromObject(n)}static isConstructorFragment(t){return t&&t._isFragment&&t.type==="constructor"}}class FunctionFragment extends ConstructorFragment{format(t){if(t||(t=FormatTypes.sighash),FormatTypes[t]||logger$t.throwArgumentError("invalid format type","format",t),t===FormatTypes.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(ie=>JSON.parse(ie.format(t))),outputs:this.outputs.map(ie=>JSON.parse(ie.format(t)))});let n="";return t!==FormatTypes.sighash&&(n+="function "),n+=this.name+"("+this.inputs.map(ie=>ie.format(t)).join(t===FormatTypes.full?", ":",")+") ",t!==FormatTypes.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(n+=this.stateMutability+" "):this.constant&&(n+="view "),this.outputs&&this.outputs.length&&(n+="returns ("+this.outputs.map(ie=>ie.format(t)).join(", ")+") "),this.gas!=null&&(n+="@"+this.gas.toString()+" ")),n.trim()}static from(t){return typeof t=="string"?FunctionFragment.fromString(t):FunctionFragment.fromObject(t)}static fromObject(t){if(FunctionFragment.isFunctionFragment(t))return t;t.type!=="function"&&logger$t.throwArgumentError("invalid function object","value",t);let n=verifyState(t);const ie={type:t.type,name:verifyIdentifier(t.name),constant:n.constant,inputs:t.inputs?t.inputs.map(ParamType.fromObject):[],outputs:t.outputs?t.outputs.map(ParamType.fromObject):[],payable:n.payable,stateMutability:n.stateMutability,gas:t.gas?BigNumber.from(t.gas):null};return new FunctionFragment(_constructorGuard$2,ie)}static fromString(t){let n={type:"function"};t=parseGas(t,n);let ie=t.split(" returns ");ie.length>2&&logger$t.throwArgumentError("invalid function string","value",t);let fe=ie[0].match(regexParen);if(fe||logger$t.throwArgumentError("invalid function signature","value",t),n.name=fe[1].trim(),n.name&&verifyIdentifier(n.name),n.inputs=parseParams(fe[2],!1),parseModifiers(fe[3].trim(),n),ie.length>1){let ae=ie[1].match(regexParen);(ae[1].trim()!=""||ae[3].trim()!="")&&logger$t.throwArgumentError("unexpected tokens","value",t),n.outputs=parseParams(ae[2],!1)}else n.outputs=[];return FunctionFragment.fromObject(n)}static isFunctionFragment(t){return t&&t._isFragment&&t.type==="function"}}function checkForbidden(c){const t=c.format();return(t==="Error(string)"||t==="Panic(uint256)")&&logger$t.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",c),c}class ErrorFragment extends Fragment{format(t){if(t||(t=FormatTypes.sighash),FormatTypes[t]||logger$t.throwArgumentError("invalid format type","format",t),t===FormatTypes.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(ie=>JSON.parse(ie.format(t)))});let n="";return t!==FormatTypes.sighash&&(n+="error "),n+=this.name+"("+this.inputs.map(ie=>ie.format(t)).join(t===FormatTypes.full?", ":",")+") ",n.trim()}static from(t){return typeof t=="string"?ErrorFragment.fromString(t):ErrorFragment.fromObject(t)}static fromObject(t){if(ErrorFragment.isErrorFragment(t))return t;t.type!=="error"&&logger$t.throwArgumentError("invalid error object","value",t);const n={type:t.type,name:verifyIdentifier(t.name),inputs:t.inputs?t.inputs.map(ParamType.fromObject):[]};return checkForbidden(new ErrorFragment(_constructorGuard$2,n))}static fromString(t){let n={type:"error"},ie=t.match(regexParen);return ie||logger$t.throwArgumentError("invalid error signature","value",t),n.name=ie[1].trim(),n.name&&verifyIdentifier(n.name),n.inputs=parseParams(ie[2],!1),checkForbidden(ErrorFragment.fromObject(n))}static isErrorFragment(t){return t&&t._isFragment&&t.type==="error"}}function verifyType(c){return c.match(/^uint($|[^1-9])/)?c="uint256"+c.substring(4):c.match(/^int($|[^1-9])/)&&(c="int256"+c.substring(3)),c}const regexIdentifier=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function verifyIdentifier(c){return(!c||!c.match(regexIdentifier))&&logger$t.throwArgumentError(`invalid identifier "${c}"`,"value",c),c}const regexParen=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function splitNesting(c){c=c.trim();let t=[],n="",ie=0;for(let fe=0;fe<c.length;fe++){let ae=c[fe];ae===","&&ie===0?(t.push(n),n=""):(n+=ae,ae==="("?ie++:ae===")"&&(ie--,ie===-1&&logger$t.throwArgumentError("unbalanced parenthesis","value",c)))}return n&&t.push(n),t}const logger$s=new Logger(version$q);function checkResultErrors(c){const t=[],n=function(ie,fe){if(Array.isArray(fe))for(let ae in fe){const le=ie.slice();le.push(ae);try{n(le,fe[ae])}catch(pe){t.push({path:le,error:pe})}}};return n([],c),t}class Coder{constructor(t,n,ie,fe){this.name=t,this.type=n,this.localName=ie,this.dynamic=fe}_throwError(t,n){logger$s.throwArgumentError(t,this.localName,n)}}class Writer{constructor(t){defineReadOnly(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return hexConcat(this._data)}get length(){return this._dataLength}_writeData(t){return this._data.push(t),this._dataLength+=t.length,t.length}appendWriter(t){return this._writeData(concat$1(t._data))}writeBytes(t){let n=arrayify(t);const ie=n.length%this.wordSize;return ie&&(n=concat$1([n,this._padding.slice(ie)])),this._writeData(n)}_getValue(t){let n=arrayify(BigNumber.from(t));return n.length>this.wordSize&&logger$s.throwError("value out-of-bounds",Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:n.length}),n.length%this.wordSize&&(n=concat$1([this._padding.slice(n.length%this.wordSize),n])),n}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,n=>{this._data[t]=this._getValue(n)}}}class Reader{constructor(t,n,ie,fe){defineReadOnly(this,"_data",arrayify(t)),defineReadOnly(this,"wordSize",n||32),defineReadOnly(this,"_coerceFunc",ie),defineReadOnly(this,"allowLoose",fe),this._offset=0}get data(){return hexlify(this._data)}get consumed(){return this._offset}static coerce(t,n){let ie=t.match("^u?int([0-9]+)$");return ie&&parseInt(ie[1])<=48&&(n=n.toNumber()),n}coerce(t,n){return this._coerceFunc?this._coerceFunc(t,n):Reader.coerce(t,n)}_peekBytes(t,n,ie){let fe=Math.ceil(n/this.wordSize)*this.wordSize;return this._offset+fe>this._data.length&&(this.allowLoose&&ie&&this._offset+n<=this._data.length?fe=n:logger$s.throwError("data out-of-bounds",Logger.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+fe})),this._data.slice(this._offset,this._offset+fe)}subReader(t){return new Reader(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,n){let ie=this._peekBytes(0,t,!!n);return this._offset+=ie.length,ie.slice(0,t)}readValue(){return BigNumber.from(this.readBytes(this.wordSize))}}function getDefaultExportFromCjs$1(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var browser$e={exports:{}},process=browser$e.exports={},cachedSetTimeout,cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout=setTimeout:cachedSetTimeout=defaultSetTimout}catch{cachedSetTimeout=defaultSetTimout}try{typeof clearTimeout=="function"?cachedClearTimeout=clearTimeout:cachedClearTimeout=defaultClearTimeout}catch{cachedClearTimeout=defaultClearTimeout}})();function runTimeout(c){if(cachedSetTimeout===setTimeout)return setTimeout(c,0);if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout)return cachedSetTimeout=setTimeout,setTimeout(c,0);try{return cachedSetTimeout(c,0)}catch{try{return cachedSetTimeout.call(null,c,0)}catch{return cachedSetTimeout.call(this,c,0)}}}function runClearTimeout(c){if(cachedClearTimeout===clearTimeout)return clearTimeout(c);if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout)return cachedClearTimeout=clearTimeout,clearTimeout(c);try{return cachedClearTimeout(c)}catch{try{return cachedClearTimeout.call(null,c)}catch{return cachedClearTimeout.call(this,c)}}}var queue=[],draining=!1,currentQueue,queueIndex=-1;function cleanUpNextTick(){!draining||!currentQueue||(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var c=runTimeout(cleanUpNextTick);draining=!0;for(var t=queue.length;t;){for(currentQueue=queue,queue=[];++queueIndex<t;)currentQueue&&currentQueue[queueIndex].run();queueIndex=-1,t=queue.length}currentQueue=null,draining=!1,runClearTimeout(c)}}process.nextTick=function(c){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];queue.push(new Item(c,t)),queue.length===1&&!draining&&runTimeout(drainQueue)};function Item(c,t){this.fun=c,this.array=t}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=!0;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(c){return[]};process.binding=function(c){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(c){throw new Error("process.chdir is not supported")};process.umask=function(){return 0};var browserExports=browser$e.exports;const process$1=getDefaultExportFromCjs$1(browserExports);var sha3$3={exports:{}};(function(c){(function(){var t="input is invalid type",n="finalize already called",ie=typeof window=="object",fe=ie?window:{};fe.JS_SHA3_NO_WINDOW&&(ie=!1);var ae=!ie&&typeof self=="object",le=!fe.JS_SHA3_NO_NODE_JS&&typeof process$1=="object"&&process$1.versions&&process$1.versions.node;le?fe=globalThis:ae&&(fe=self);var pe=!fe.JS_SHA3_NO_COMMON_JS&&!0&&c.exports,me=!fe.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",ye="0123456789abcdef".split(""),xe=[31,7936,2031616,520093696],Ee=[4,1024,262144,67108864],Se=[1,256,65536,16777216],Me=[6,1536,393216,100663296],Be=[0,8,16,24],$e=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],ke=[224,256,384,512],Te=[128,256],Ie=["hex","buffer","arrayBuffer","array","digest"],Fe={128:168,256:136};(fe.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(Pe){return Object.prototype.toString.call(Pe)==="[object Array]"}),me&&(fe.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(Pe){return typeof Pe=="object"&&Pe.buffer&&Pe.buffer.constructor===ArrayBuffer});for(var Le=function(Pe,Ge,Ce){return function(De){return new Re(Pe,Ge,Pe).update(De)[Ce]()}},He=function(Pe,Ge,Ce){return function(De,je){return new Re(Pe,Ge,je).update(De)[Ce]()}},ze=function(Pe,Ge,Ce){return function(De,je,Ve,Mt){return de["cshake"+Pe].update(De,je,Ve,Mt)[Ce]()}},Je=function(Pe,Ge,Ce){return function(De,je,Ve,Mt){return de["kmac"+Pe].update(De,je,Ve,Mt)[Ce]()}},Xe=function(Pe,Ge,Ce,De){for(var je=0;je<Ie.length;++je){var Ve=Ie[je];Pe[Ve]=Ge(Ce,De,Ve)}return Pe},Ue=function(Pe,Ge){var Ce=Le(Pe,Ge,"hex");return Ce.create=function(){return new Re(Pe,Ge,Pe)},Ce.update=function(De){return Ce.create().update(De)},Xe(Ce,Le,Pe,Ge)},$t=function(Pe,Ge){var Ce=He(Pe,Ge,"hex");return Ce.create=function(De){return new Re(Pe,Ge,De)},Ce.update=function(De,je){return Ce.create(je).update(De)},Xe(Ce,He,Pe,Ge)},_e=function(Pe,Ge){var Ce=Fe[Pe],De=ze(Pe,Ge,"hex");return De.create=function(je,Ve,Mt){return!Ve&&!Mt?de["shake"+Pe].create(je):new Re(Pe,Ge,je).bytepad([Ve,Mt],Ce)},De.update=function(je,Ve,Mt,Oe){return De.create(Ve,Mt,Oe).update(je)},Xe(De,ze,Pe,Ge)},se=function(Pe,Ge){var Ce=Fe[Pe],De=Je(Pe,Ge,"hex");return De.create=function(je,Ve,Mt){return new Ne(Pe,Ge,Ve).bytepad(["KMAC",Mt],Ce).bytepad([je],Ce)},De.update=function(je,Ve,Mt,Oe){return De.create(je,Mt,Oe).update(Ve)},Xe(De,Je,Pe,Ge)},ce=[{name:"keccak",padding:Se,bits:ke,createMethod:Ue},{name:"sha3",padding:Me,bits:ke,createMethod:Ue},{name:"shake",padding:xe,bits:Te,createMethod:$t},{name:"cshake",padding:Ee,bits:Te,createMethod:_e},{name:"kmac",padding:Ee,bits:Te,createMethod:se}],de={},he=[],ve=0;ve<ce.length;++ve)for(var we=ce[ve],Ae=we.bits,be=0;be<Ae.length;++be){var ue=we.name+"_"+Ae[be];if(he.push(ue),de[ue]=we.createMethod(Ae[be],we.padding),we.name!=="sha3"){var ge=we.name+Ae[be];he.push(ge),de[ge]=de[ue]}}function Re(Pe,Ge,Ce){this.blocks=[],this.s=[],this.padding=Ge,this.outputBits=Ce,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(Pe<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Ce>>5,this.extraBytes=(Ce&31)>>3;for(var De=0;De<50;++De)this.s[De]=0}Re.prototype.update=function(Pe){if(this.finalized)throw new Error(n);var Ge,Ce=typeof Pe;if(Ce!=="string"){if(Ce==="object"){if(Pe===null)throw new Error(t);if(me&&Pe.constructor===ArrayBuffer)Pe=new Uint8Array(Pe);else if(!Array.isArray(Pe)&&(!me||!ArrayBuffer.isView(Pe)))throw new Error(t)}else throw new Error(t);Ge=!0}for(var De=this.blocks,je=this.byteCount,Ve=Pe.length,Mt=this.blockCount,Oe=0,We=this.s,jt,Dt;Oe<Ve;){if(this.reset)for(this.reset=!1,De[0]=this.block,jt=1;jt<Mt+1;++jt)De[jt]=0;if(Ge)for(jt=this.start;Oe<Ve&&jt<je;++Oe)De[jt>>2]|=Pe[Oe]<<Be[jt++&3];else for(jt=this.start;Oe<Ve&&jt<je;++Oe)Dt=Pe.charCodeAt(Oe),Dt<128?De[jt>>2]|=Dt<<Be[jt++&3]:Dt<2048?(De[jt>>2]|=(192|Dt>>6)<<Be[jt++&3],De[jt>>2]|=(128|Dt&63)<<Be[jt++&3]):Dt<55296||Dt>=57344?(De[jt>>2]|=(224|Dt>>12)<<Be[jt++&3],De[jt>>2]|=(128|Dt>>6&63)<<Be[jt++&3],De[jt>>2]|=(128|Dt&63)<<Be[jt++&3]):(Dt=65536+((Dt&1023)<<10|Pe.charCodeAt(++Oe)&1023),De[jt>>2]|=(240|Dt>>18)<<Be[jt++&3],De[jt>>2]|=(128|Dt>>12&63)<<Be[jt++&3],De[jt>>2]|=(128|Dt>>6&63)<<Be[jt++&3],De[jt>>2]|=(128|Dt&63)<<Be[jt++&3]);if(this.lastByteIndex=jt,jt>=je){for(this.start=jt-je,this.block=De[Mt],jt=0;jt<Mt;++jt)We[jt]^=De[jt];qe(We),this.reset=!0}else this.start=jt}return this},Re.prototype.encode=function(Pe,Ge){var Ce=Pe&255,De=1,je=[Ce];for(Pe=Pe>>8,Ce=Pe&255;Ce>0;)je.unshift(Ce),Pe=Pe>>8,Ce=Pe&255,++De;return Ge?je.push(De):je.unshift(De),this.update(je),je.length},Re.prototype.encodeString=function(Pe){var Ge,Ce=typeof Pe;if(Ce!=="string"){if(Ce==="object"){if(Pe===null)throw new Error(t);if(me&&Pe.constructor===ArrayBuffer)Pe=new Uint8Array(Pe);else if(!Array.isArray(Pe)&&(!me||!ArrayBuffer.isView(Pe)))throw new Error(t)}else throw new Error(t);Ge=!0}var De=0,je=Pe.length;if(Ge)De=je;else for(var Ve=0;Ve<Pe.length;++Ve){var Mt=Pe.charCodeAt(Ve);Mt<128?De+=1:Mt<2048?De+=2:Mt<55296||Mt>=57344?De+=3:(Mt=65536+((Mt&1023)<<10|Pe.charCodeAt(++Ve)&1023),De+=4)}return De+=this.encode(De*8),this.update(Pe),De},Re.prototype.bytepad=function(Pe,Ge){for(var Ce=this.encode(Ge),De=0;De<Pe.length;++De)Ce+=this.encodeString(Pe[De]);var je=Ge-Ce%Ge,Ve=[];return Ve.length=je,this.update(Ve),this},Re.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var Pe=this.blocks,Ge=this.lastByteIndex,Ce=this.blockCount,De=this.s;if(Pe[Ge>>2]|=this.padding[Ge&3],this.lastByteIndex===this.byteCount)for(Pe[0]=Pe[Ce],Ge=1;Ge<Ce+1;++Ge)Pe[Ge]=0;for(Pe[Ce-1]|=2147483648,Ge=0;Ge<Ce;++Ge)De[Ge]^=Pe[Ge];qe(De)}},Re.prototype.toString=Re.prototype.hex=function(){this.finalize();for(var Pe=this.blockCount,Ge=this.s,Ce=this.outputBlocks,De=this.extraBytes,je=0,Ve=0,Mt="",Oe;Ve<Ce;){for(je=0;je<Pe&&Ve<Ce;++je,++Ve)Oe=Ge[je],Mt+=ye[Oe>>4&15]+ye[Oe&15]+ye[Oe>>12&15]+ye[Oe>>8&15]+ye[Oe>>20&15]+ye[Oe>>16&15]+ye[Oe>>28&15]+ye[Oe>>24&15];Ve%Pe===0&&(qe(Ge),je=0)}return De&&(Oe=Ge[je],Mt+=ye[Oe>>4&15]+ye[Oe&15],De>1&&(Mt+=ye[Oe>>12&15]+ye[Oe>>8&15]),De>2&&(Mt+=ye[Oe>>20&15]+ye[Oe>>16&15])),Mt},Re.prototype.arrayBuffer=function(){this.finalize();var Pe=this.blockCount,Ge=this.s,Ce=this.outputBlocks,De=this.extraBytes,je=0,Ve=0,Mt=this.outputBits>>3,Oe;De?Oe=new ArrayBuffer(Ce+1<<2):Oe=new ArrayBuffer(Mt);for(var We=new Uint32Array(Oe);Ve<Ce;){for(je=0;je<Pe&&Ve<Ce;++je,++Ve)We[Ve]=Ge[je];Ve%Pe===0&&qe(Ge)}return De&&(We[je]=Ge[je],Oe=Oe.slice(0,Mt)),Oe},Re.prototype.buffer=Re.prototype.arrayBuffer,Re.prototype.digest=Re.prototype.array=function(){this.finalize();for(var Pe=this.blockCount,Ge=this.s,Ce=this.outputBlocks,De=this.extraBytes,je=0,Ve=0,Mt=[],Oe,We;Ve<Ce;){for(je=0;je<Pe&&Ve<Ce;++je,++Ve)Oe=Ve<<2,We=Ge[je],Mt[Oe]=We&255,Mt[Oe+1]=We>>8&255,Mt[Oe+2]=We>>16&255,Mt[Oe+3]=We>>24&255;Ve%Pe===0&&qe(Ge)}return De&&(Oe=Ve<<2,We=Ge[je],Mt[Oe]=We&255,De>1&&(Mt[Oe+1]=We>>8&255),De>2&&(Mt[Oe+2]=We>>16&255)),Mt};function Ne(Pe,Ge,Ce){Re.call(this,Pe,Ge,Ce)}Ne.prototype=new Re,Ne.prototype.finalize=function(){return this.encode(this.outputBits,!0),Re.prototype.finalize.call(this)};var qe=function(Pe){var Ge,Ce,De,je,Ve,Mt,Oe,We,jt,Dt,Ht,vn,Vt,Kt,En,en,Xt,_n,Ze,Rt,Qt,Ft,Wt,an,Zt,Jt,An,tn,nn,Sn,rn,dn,Mn,sn,ln,Bn,un,hn,Cn,yn,xn,Nn,Qe,Ke,Ye,Pt,Gt,gn,Yt,cn,$n,fn,pn,Rn,mn,wn,kn,Tn,In,Pn,On,Dn,Ln;for(De=0;De<48;De+=2)je=Pe[0]^Pe[10]^Pe[20]^Pe[30]^Pe[40],Ve=Pe[1]^Pe[11]^Pe[21]^Pe[31]^Pe[41],Mt=Pe[2]^Pe[12]^Pe[22]^Pe[32]^Pe[42],Oe=Pe[3]^Pe[13]^Pe[23]^Pe[33]^Pe[43],We=Pe[4]^Pe[14]^Pe[24]^Pe[34]^Pe[44],jt=Pe[5]^Pe[15]^Pe[25]^Pe[35]^Pe[45],Dt=Pe[6]^Pe[16]^Pe[26]^Pe[36]^Pe[46],Ht=Pe[7]^Pe[17]^Pe[27]^Pe[37]^Pe[47],vn=Pe[8]^Pe[18]^Pe[28]^Pe[38]^Pe[48],Vt=Pe[9]^Pe[19]^Pe[29]^Pe[39]^Pe[49],Ge=vn^(Mt<<1|Oe>>>31),Ce=Vt^(Oe<<1|Mt>>>31),Pe[0]^=Ge,Pe[1]^=Ce,Pe[10]^=Ge,Pe[11]^=Ce,Pe[20]^=Ge,Pe[21]^=Ce,Pe[30]^=Ge,Pe[31]^=Ce,Pe[40]^=Ge,Pe[41]^=Ce,Ge=je^(We<<1|jt>>>31),Ce=Ve^(jt<<1|We>>>31),Pe[2]^=Ge,Pe[3]^=Ce,Pe[12]^=Ge,Pe[13]^=Ce,Pe[22]^=Ge,Pe[23]^=Ce,Pe[32]^=Ge,Pe[33]^=Ce,Pe[42]^=Ge,Pe[43]^=Ce,Ge=Mt^(Dt<<1|Ht>>>31),Ce=Oe^(Ht<<1|Dt>>>31),Pe[4]^=Ge,Pe[5]^=Ce,Pe[14]^=Ge,Pe[15]^=Ce,Pe[24]^=Ge,Pe[25]^=Ce,Pe[34]^=Ge,Pe[35]^=Ce,Pe[44]^=Ge,Pe[45]^=Ce,Ge=We^(vn<<1|Vt>>>31),Ce=jt^(Vt<<1|vn>>>31),Pe[6]^=Ge,Pe[7]^=Ce,Pe[16]^=Ge,Pe[17]^=Ce,Pe[26]^=Ge,Pe[27]^=Ce,Pe[36]^=Ge,Pe[37]^=Ce,Pe[46]^=Ge,Pe[47]^=Ce,Ge=Dt^(je<<1|Ve>>>31),Ce=Ht^(Ve<<1|je>>>31),Pe[8]^=Ge,Pe[9]^=Ce,Pe[18]^=Ge,Pe[19]^=Ce,Pe[28]^=Ge,Pe[29]^=Ce,Pe[38]^=Ge,Pe[39]^=Ce,Pe[48]^=Ge,Pe[49]^=Ce,Kt=Pe[0],En=Pe[1],Pt=Pe[11]<<4|Pe[10]>>>28,Gt=Pe[10]<<4|Pe[11]>>>28,tn=Pe[20]<<3|Pe[21]>>>29,nn=Pe[21]<<3|Pe[20]>>>29,Pn=Pe[31]<<9|Pe[30]>>>23,On=Pe[30]<<9|Pe[31]>>>23,Nn=Pe[40]<<18|Pe[41]>>>14,Qe=Pe[41]<<18|Pe[40]>>>14,sn=Pe[2]<<1|Pe[3]>>>31,ln=Pe[3]<<1|Pe[2]>>>31,en=Pe[13]<<12|Pe[12]>>>20,Xt=Pe[12]<<12|Pe[13]>>>20,gn=Pe[22]<<10|Pe[23]>>>22,Yt=Pe[23]<<10|Pe[22]>>>22,Sn=Pe[33]<<13|Pe[32]>>>19,rn=Pe[32]<<13|Pe[33]>>>19,Dn=Pe[42]<<2|Pe[43]>>>30,Ln=Pe[43]<<2|Pe[42]>>>30,Rn=Pe[5]<<30|Pe[4]>>>2,mn=Pe[4]<<30|Pe[5]>>>2,Bn=Pe[14]<<6|Pe[15]>>>26,un=Pe[15]<<6|Pe[14]>>>26,_n=Pe[25]<<11|Pe[24]>>>21,Ze=Pe[24]<<11|Pe[25]>>>21,cn=Pe[34]<<15|Pe[35]>>>17,$n=Pe[35]<<15|Pe[34]>>>17,dn=Pe[45]<<29|Pe[44]>>>3,Mn=Pe[44]<<29|Pe[45]>>>3,an=Pe[6]<<28|Pe[7]>>>4,Zt=Pe[7]<<28|Pe[6]>>>4,wn=Pe[17]<<23|Pe[16]>>>9,kn=Pe[16]<<23|Pe[17]>>>9,hn=Pe[26]<<25|Pe[27]>>>7,Cn=Pe[27]<<25|Pe[26]>>>7,Rt=Pe[36]<<21|Pe[37]>>>11,Qt=Pe[37]<<21|Pe[36]>>>11,fn=Pe[47]<<24|Pe[46]>>>8,pn=Pe[46]<<24|Pe[47]>>>8,Ke=Pe[8]<<27|Pe[9]>>>5,Ye=Pe[9]<<27|Pe[8]>>>5,Jt=Pe[18]<<20|Pe[19]>>>12,An=Pe[19]<<20|Pe[18]>>>12,Tn=Pe[29]<<7|Pe[28]>>>25,In=Pe[28]<<7|Pe[29]>>>25,yn=Pe[38]<<8|Pe[39]>>>24,xn=Pe[39]<<8|Pe[38]>>>24,Ft=Pe[48]<<14|Pe[49]>>>18,Wt=Pe[49]<<14|Pe[48]>>>18,Pe[0]=Kt^~en&_n,Pe[1]=En^~Xt&Ze,Pe[10]=an^~Jt&tn,Pe[11]=Zt^~An&nn,Pe[20]=sn^~Bn&hn,Pe[21]=ln^~un&Cn,Pe[30]=Ke^~Pt&gn,Pe[31]=Ye^~Gt&Yt,Pe[40]=Rn^~wn&Tn,Pe[41]=mn^~kn&In,Pe[2]=en^~_n&Rt,Pe[3]=Xt^~Ze&Qt,Pe[12]=Jt^~tn&Sn,Pe[13]=An^~nn&rn,Pe[22]=Bn^~hn&yn,Pe[23]=un^~Cn&xn,Pe[32]=Pt^~gn&cn,Pe[33]=Gt^~Yt&$n,Pe[42]=wn^~Tn&Pn,Pe[43]=kn^~In&On,Pe[4]=_n^~Rt&Ft,Pe[5]=Ze^~Qt&Wt,Pe[14]=tn^~Sn&dn,Pe[15]=nn^~rn&Mn,Pe[24]=hn^~yn&Nn,Pe[25]=Cn^~xn&Qe,Pe[34]=gn^~cn&fn,Pe[35]=Yt^~$n&pn,Pe[44]=Tn^~Pn&Dn,Pe[45]=In^~On&Ln,Pe[6]=Rt^~Ft&Kt,Pe[7]=Qt^~Wt&En,Pe[16]=Sn^~dn&an,Pe[17]=rn^~Mn&Zt,Pe[26]=yn^~Nn&sn,Pe[27]=xn^~Qe&ln,Pe[36]=cn^~fn&Ke,Pe[37]=$n^~pn&Ye,Pe[46]=Pn^~Dn&Rn,Pe[47]=On^~Ln&mn,Pe[8]=Ft^~Kt&en,Pe[9]=Wt^~En&Xt,Pe[18]=dn^~an&Jt,Pe[19]=Mn^~Zt&An,Pe[28]=Nn^~sn&Bn,Pe[29]=Qe^~ln&un,Pe[38]=fn^~Ke&Pt,Pe[39]=pn^~Ye&Gt,Pe[48]=Dn^~Rn&wn,Pe[49]=Ln^~mn&kn,Pe[0]^=$e[De],Pe[1]^=$e[De+1]};if(pe)c.exports=de;else for(ve=0;ve<he.length;++ve)fe[he[ve]]=de[he[ve]]})()})(sha3$3);var sha3Exports$1=sha3$3.exports;const sha3$2=getDefaultExportFromCjs$2(sha3Exports$1);function keccak256$1(c){return"0x"+sha3$2.keccak_256(arrayify(c))}const lib_esm$h=Object.freeze(Object.defineProperty({__proto__:null,keccak256:keccak256$1},Symbol.toStringTag,{value:"Module"})),version$p="rlp/5.8.0",logger$r=new Logger(version$p);function arrayifyInteger(c){const t=[];for(;c;)t.unshift(c&255),c>>=8;return t}function unarrayifyInteger(c,t,n){let ie=0;for(let fe=0;fe<n;fe++)ie=ie*256+c[t+fe];return ie}function _encode(c){if(Array.isArray(c)){let ie=[];if(c.forEach(function(ae){ie=ie.concat(_encode(ae))}),ie.length<=55)return ie.unshift(192+ie.length),ie;const fe=arrayifyInteger(ie.length);return fe.unshift(247+fe.length),fe.concat(ie)}isBytesLike(c)||logger$r.throwArgumentError("RLP object must be BytesLike","object",c);const t=Array.prototype.slice.call(arrayify(c));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const n=arrayifyInteger(t.length);return n.unshift(183+n.length),n.concat(t)}function encode$a(c){return hexlify(_encode(c))}function _decodeChildren(c,t,n,ie){const fe=[];for(;n<t+1+ie;){const ae=_decode(c,n);fe.push(ae.result),n+=ae.consumed,n>t+1+ie&&logger$r.throwError("child data too short",Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+ie,result:fe}}function _decode(c,t){if(c.length===0&&logger$r.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{}),c[t]>=248){const n=c[t]-247;t+1+n>c.length&&logger$r.throwError("data short segment too short",Logger.errors.BUFFER_OVERRUN,{});const ie=unarrayifyInteger(c,t+1,n);return t+1+n+ie>c.length&&logger$r.throwError("data long segment too short",Logger.errors.BUFFER_OVERRUN,{}),_decodeChildren(c,t,t+1+n,n+ie)}else if(c[t]>=192){const n=c[t]-192;return t+1+n>c.length&&logger$r.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{}),_decodeChildren(c,t,t+1,n)}else if(c[t]>=184){const n=c[t]-183;t+1+n>c.length&&logger$r.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{});const ie=unarrayifyInteger(c,t+1,n);t+1+n+ie>c.length&&logger$r.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{});const fe=hexlify(c.slice(t+1+n,t+1+n+ie));return{consumed:1+n+ie,result:fe}}else if(c[t]>=128){const n=c[t]-128;t+1+n>c.length&&logger$r.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{});const ie=hexlify(c.slice(t+1,t+1+n));return{consumed:1+n,result:ie}}return{consumed:1,result:hexlify(c[t])}}function decode$b(c){const t=arrayify(c),n=_decode(t,0);return n.consumed!==t.length&&logger$r.throwArgumentError("invalid rlp data","data",c),n.result}const lib_esm$g=Object.freeze(Object.defineProperty({__proto__:null,decode:decode$b,encode:encode$a},Symbol.toStringTag,{value:"Module"})),version$o="address/5.8.0",logger$q=new Logger(version$o);function getChecksumAddress(c){isHexString(c,20)||logger$q.throwArgumentError("invalid address","address",c),c=c.toLowerCase();const t=c.substring(2).split(""),n=new Uint8Array(40);for(let fe=0;fe<40;fe++)n[fe]=t[fe].charCodeAt(0);const ie=arrayify(keccak256$1(n));for(let fe=0;fe<40;fe+=2)ie[fe>>1]>>4>=8&&(t[fe]=t[fe].toUpperCase()),(ie[fe>>1]&15)>=8&&(t[fe+1]=t[fe+1].toUpperCase());return"0x"+t.join("")}const MAX_SAFE_INTEGER=9007199254740991;function log10(c){return Math.log10?Math.log10(c):Math.log(c)/Math.LN10}const ibanLookup={};for(let c=0;c<10;c++)ibanLookup[String(c)]=String(c);for(let c=0;c<26;c++)ibanLookup[String.fromCharCode(65+c)]=String(10+c);const safeDigits=Math.floor(log10(MAX_SAFE_INTEGER));function ibanChecksum(c){c=c.toUpperCase(),c=c.substring(4)+c.substring(0,2)+"00";let t=c.split("").map(ie=>ibanLookup[ie]).join("");for(;t.length>=safeDigits;){let ie=t.substring(0,safeDigits);t=parseInt(ie,10)%97+t.substring(ie.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n="0"+n;return n}function getAddress(c){let t=null;if(typeof c!="string"&&logger$q.throwArgumentError("invalid address","address",c),c.match(/^(0x)?[0-9a-fA-F]{40}$/))c.substring(0,2)!=="0x"&&(c="0x"+c),t=getChecksumAddress(c),c.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==c&&logger$q.throwArgumentError("bad address checksum","address",c);else if(c.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(c.substring(2,4)!==ibanChecksum(c)&&logger$q.throwArgumentError("bad icap checksum","address",c),t=_base36To16(c.substring(4));t.length<40;)t="0"+t;t=getChecksumAddress("0x"+t)}else logger$q.throwArgumentError("invalid address","address",c);return t}function isAddress(c){try{return getAddress(c),!0}catch{}return!1}function getIcapAddress(c){let t=_base16To36(getAddress(c).substring(2)).toUpperCase();for(;t.length<30;)t="0"+t;return"XE"+ibanChecksum("XE00"+t)+t}function getContractAddress(c){let t=null;try{t=getAddress(c.from)}catch{logger$q.throwArgumentError("missing from address","transaction",c)}const n=stripZeros(arrayify(BigNumber.from(c.nonce).toHexString()));return getAddress(hexDataSlice(keccak256$1(encode$a([t,n])),12))}function getCreate2Address(c,t,n){return hexDataLength(t)!==32&&logger$q.throwArgumentError("salt must be 32 bytes","salt",t),hexDataLength(n)!==32&&logger$q.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",n),getAddress(hexDataSlice(keccak256$1(concat$1(["0xff",getAddress(c),t,n])),12))}const lib_esm$f=Object.freeze(Object.defineProperty({__proto__:null,getAddress,getContractAddress,getCreate2Address,getIcapAddress,isAddress},Symbol.toStringTag,{value:"Module"}));class AddressCoder extends Coder{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,n){try{n=getAddress(n)}catch(ie){this._throwError(ie.message,n)}return t.writeValue(n)}decode(t){return getAddress(hexZeroPad(t.readValue().toHexString(),20))}}class AnonymousCoder extends Coder{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,n){return this.coder.encode(t,n)}decode(t){return this.coder.decode(t)}}const logger$p=new Logger(version$q);function pack$1(c,t,n){let ie=null;if(Array.isArray(n))ie=n;else if(n&&typeof n=="object"){let me={};ie=t.map(ye=>{const xe=ye.localName;return xe||logger$p.throwError("cannot encode object for signature with missing names",Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:ye,value:n}),me[xe]&&logger$p.throwError("cannot encode object for signature with duplicate names",Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:ye,value:n}),me[xe]=!0,n[xe]})}else logger$p.throwArgumentError("invalid tuple value","tuple",n);t.length!==ie.length&&logger$p.throwArgumentError("types/value length mismatch","tuple",n);let fe=new Writer(c.wordSize),ae=new Writer(c.wordSize),le=[];t.forEach((me,ye)=>{let xe=ie[ye];if(me.dynamic){let Ee=ae.length;me.encode(ae,xe);let Se=fe.writeUpdatableValue();le.push(Me=>{Se(Me+Ee)})}else me.encode(fe,xe)}),le.forEach(me=>{me(fe.length)});let pe=c.appendWriter(fe);return pe+=c.appendWriter(ae),pe}function unpack(c,t){let n=[],ie=c.subReader(0);t.forEach(ae=>{let le=null;if(ae.dynamic){let pe=c.readValue(),me=ie.subReader(pe.toNumber());try{le=ae.decode(me)}catch(ye){if(ye.code===Logger.errors.BUFFER_OVERRUN)throw ye;le=ye,le.baseType=ae.name,le.name=ae.localName,le.type=ae.type}}else try{le=ae.decode(c)}catch(pe){if(pe.code===Logger.errors.BUFFER_OVERRUN)throw pe;le=pe,le.baseType=ae.name,le.name=ae.localName,le.type=ae.type}le!=null&&n.push(le)});const fe=t.reduce((ae,le)=>{const pe=le.localName;return pe&&(ae[pe]||(ae[pe]=0),ae[pe]++),ae},{});t.forEach((ae,le)=>{let pe=ae.localName;if(!pe||fe[pe]!==1||(pe==="length"&&(pe="_length"),n[pe]!=null))return;const me=n[le];me instanceof Error?Object.defineProperty(n,pe,{enumerable:!0,get:()=>{throw me}}):n[pe]=me});for(let ae=0;ae<n.length;ae++){const le=n[ae];le instanceof Error&&Object.defineProperty(n,ae,{enumerable:!0,get:()=>{throw le}})}return Object.freeze(n)}class ArrayCoder extends Coder{constructor(t,n,ie){const fe=t.type+"["+(n>=0?n:"")+"]",ae=n===-1||t.dynamic;super("array",fe,ie,ae),this.coder=t,this.length=n}defaultValue(){const t=this.coder.defaultValue(),n=[];for(let ie=0;ie<this.length;ie++)n.push(t);return n}encode(t,n){Array.isArray(n)||this._throwError("expected array value",n);let ie=this.length;ie===-1&&(ie=n.length,t.writeValue(n.length)),logger$p.checkArgumentCount(n.length,ie,"coder array"+(this.localName?" "+this.localName:""));let fe=[];for(let ae=0;ae<n.length;ae++)fe.push(this.coder);return pack$1(t,fe,n)}decode(t){let n=this.length;n===-1&&(n=t.readValue().toNumber(),n*32>t._data.length&&logger$p.throwError("insufficient data length",Logger.errors.BUFFER_OVERRUN,{length:t._data.length,count:n}));let ie=[];for(let fe=0;fe<n;fe++)ie.push(new AnonymousCoder(this.coder));return t.coerce(this.name,unpack(t,ie))}}class BooleanCoder extends Coder{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,n){return t.writeValue(n?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class DynamicBytesCoder extends Coder{constructor(t,n){super(t,t,n,!0)}defaultValue(){return"0x"}encode(t,n){n=arrayify(n);let ie=t.writeValue(n.length);return ie+=t.writeBytes(n),ie}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class BytesCoder extends DynamicBytesCoder{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,hexlify(super.decode(t)))}}class FixedBytesCoder extends Coder{constructor(t,n){let ie="bytes"+String(t);super(ie,ie,n,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,n){let ie=arrayify(n);return ie.length!==this.size&&this._throwError("incorrect data length",n),t.writeBytes(ie)}decode(t){return t.coerce(this.name,hexlify(t.readBytes(this.size)))}}class NullCoder extends Coder{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,n){return n!=null&&this._throwError("not null",n),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}const AddressZero="0x0000000000000000000000000000000000000000",NegativeOne$1=BigNumber.from(-1),Zero$1=BigNumber.from(0),One$1=BigNumber.from(1),MaxUint256$1=BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),HashZero="0x0000000000000000000000000000000000000000000000000000000000000000";class NumberCoder extends Coder{constructor(t,n,ie){const fe=(n?"int":"uint")+t*8;super(fe,fe,ie,!1),this.size=t,this.signed=n}defaultValue(){return 0}encode(t,n){let ie=BigNumber.from(n),fe=MaxUint256$1.mask(t.wordSize*8);if(this.signed){let ae=fe.mask(this.size*8-1);(ie.gt(ae)||ie.lt(ae.add(One$1).mul(NegativeOne$1)))&&this._throwError("value out-of-bounds",n)}else(ie.lt(Zero$1)||ie.gt(fe.mask(this.size*8)))&&this._throwError("value out-of-bounds",n);return ie=ie.toTwos(this.size*8).mask(this.size*8),this.signed&&(ie=ie.fromTwos(this.size*8).toTwos(8*t.wordSize)),t.writeValue(ie)}decode(t){let n=t.readValue().mask(this.size*8);return this.signed&&(n=n.fromTwos(this.size*8)),t.coerce(this.name,n)}}const version$n="strings/5.8.0",logger$o=new Logger(version$n);var UnicodeNormalizationForm;(function(c){c.current="",c.NFC="NFC",c.NFD="NFD",c.NFKC="NFKC",c.NFKD="NFKD"})(UnicodeNormalizationForm||(UnicodeNormalizationForm={}));var Utf8ErrorReason;(function(c){c.UNEXPECTED_CONTINUE="unexpected continuation byte",c.BAD_PREFIX="bad codepoint prefix",c.OVERRUN="string overrun",c.MISSING_CONTINUE="missing continuation byte",c.OUT_OF_RANGE="out of UTF-8 range",c.UTF16_SURROGATE="UTF-16 surrogate",c.OVERLONG="overlong representation"})(Utf8ErrorReason||(Utf8ErrorReason={}));function errorFunc(c,t,n,ie,fe){return logger$o.throwArgumentError(`invalid codepoint at offset ${t}; ${c}`,"bytes",n)}function ignoreFunc(c,t,n,ie,fe){if(c===Utf8ErrorReason.BAD_PREFIX||c===Utf8ErrorReason.UNEXPECTED_CONTINUE){let ae=0;for(let le=t+1;le<n.length&&n[le]>>6===2;le++)ae++;return ae}return c===Utf8ErrorReason.OVERRUN?n.length-t-1:0}function replaceFunc(c,t,n,ie,fe){return c===Utf8ErrorReason.OVERLONG?(ie.push(fe),0):(ie.push(65533),ignoreFunc(c,t,n))}const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(c,t){t==null&&(t=Utf8ErrorFuncs.error),c=arrayify(c);const n=[];let ie=0;for(;ie<c.length;){const fe=c[ie++];if(!(fe>>7)){n.push(fe);continue}let ae=null,le=null;if((fe&224)===192)ae=1,le=127;else if((fe&240)===224)ae=2,le=2047;else if((fe&248)===240)ae=3,le=65535;else{(fe&192)===128?ie+=t(Utf8ErrorReason.UNEXPECTED_CONTINUE,ie-1,c,n):ie+=t(Utf8ErrorReason.BAD_PREFIX,ie-1,c,n);continue}if(ie-1+ae>=c.length){ie+=t(Utf8ErrorReason.OVERRUN,ie-1,c,n);continue}let pe=fe&(1<<8-ae-1)-1;for(let me=0;me<ae;me++){let ye=c[ie];if((ye&192)!=128){ie+=t(Utf8ErrorReason.MISSING_CONTINUE,ie,c,n),pe=null;break}pe=pe<<6|ye&63,ie++}if(pe!==null){if(pe>1114111){ie+=t(Utf8ErrorReason.OUT_OF_RANGE,ie-1-ae,c,n,pe);continue}if(pe>=55296&&pe<=57343){ie+=t(Utf8ErrorReason.UTF16_SURROGATE,ie-1-ae,c,n,pe);continue}if(pe<=le){ie+=t(Utf8ErrorReason.OVERLONG,ie-1-ae,c,n,pe);continue}n.push(pe)}}return n}function toUtf8Bytes(c,t=UnicodeNormalizationForm.current){t!=UnicodeNormalizationForm.current&&(logger$o.checkNormalize(),c=c.normalize(t));let n=[];for(let ie=0;ie<c.length;ie++){const fe=c.charCodeAt(ie);if(fe<128)n.push(fe);else if(fe<2048)n.push(fe>>6|192),n.push(fe&63|128);else if((fe&64512)==55296){ie++;const ae=c.charCodeAt(ie);if(ie>=c.length||(ae&64512)!==56320)throw new Error("invalid utf-8 string");const le=65536+((fe&1023)<<10)+(ae&1023);n.push(le>>18|240),n.push(le>>12&63|128),n.push(le>>6&63|128),n.push(le&63|128)}else n.push(fe>>12|224),n.push(fe>>6&63|128),n.push(fe&63|128)}return arrayify(n)}function escapeChar(c){const t="0000"+c.toString(16);return"\\u"+t.substring(t.length-4)}function _toEscapedUtf8String(c,t){return'"'+getUtf8CodePoints(c,t).map(n=>{if(n<256){switch(n){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(n>=32&&n<127)return String.fromCharCode(n)}return n<=65535?escapeChar(n):(n-=65536,escapeChar((n>>10&1023)+55296)+escapeChar((n&1023)+56320))}).join("")+'"'}function _toUtf8String(c){return c.map(t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10&1023)+55296,(t&1023)+56320))).join("")}function toUtf8String(c,t){return _toUtf8String(getUtf8CodePoints(c,t))}function toUtf8CodePoints(c,t=UnicodeNormalizationForm.current){return getUtf8CodePoints(toUtf8Bytes(c,t))}function formatBytes32String(c){const t=toUtf8Bytes(c);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return hexlify(concat$1([t,HashZero]).slice(0,32))}function parseBytes32String(c){const t=arrayify(c);if(t.length!==32)throw new Error("invalid bytes32 - not 32 bytes long");if(t[31]!==0)throw new Error("invalid bytes32 string - no null terminator");let n=31;for(;t[n-1]===0;)n--;return toUtf8String(t.slice(0,n))}function bytes2(c){if(c.length%4!==0)throw new Error("bad data");let t=[];for(let n=0;n<c.length;n+=4)t.push(parseInt(c.substring(n,n+4),16));return t}function createTable(c,t){t||(t=function(fe){return[parseInt(fe,16)]});let n=0,ie={};return c.split(",").forEach(fe=>{let ae=fe.split(":");n+=parseInt(ae[0],16),ie[n]=t(ae[1])}),ie}function createRangeTable(c){let t=0;return c.split(",").map(n=>{let ie=n.split("-");ie.length===1?ie[1]="0":ie[1]===""&&(ie[1]="1");let fe=t+parseInt(ie[0],16);return t=parseInt(ie[1],16),{l:fe,h:t}})}function matchMap(c,t){let n=0;for(let ie=0;ie<t.length;ie++){let fe=t[ie];if(n+=fe.l,c>=n&&c<=n+fe.h&&(c-n)%(fe.d||1)===0){if(fe.e&&fe.e.indexOf(c-n)!==-1)continue;return fe}}return null}const Table_A_1_ranges=createRangeTable("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),Table_B_1_flags="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(c=>parseInt(c,16)),Table_B_2_ranges=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],Table_B_2_lut_abs=createTable("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Table_B_2_lut_rel=createTable("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Table_B_2_complex=createTable("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",bytes2),Table_C_ranges=createRangeTable("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function flatten(c){return c.reduce((t,n)=>(n.forEach(ie=>{t.push(ie)}),t),[])}function _nameprepTableA1(c){return!!matchMap(c,Table_A_1_ranges)}function _nameprepTableB2(c){let t=matchMap(c,Table_B_2_ranges);if(t)return[c+t.s];let n=Table_B_2_lut_abs[c];if(n)return n;let ie=Table_B_2_lut_rel[c];if(ie)return[c+ie[0]];let fe=Table_B_2_complex[c];return fe||null}function _nameprepTableC(c){return!!matchMap(c,Table_C_ranges)}function nameprep(c){if(c.match(/^[a-z0-9-]*$/i)&&c.length<=59)return c.toLowerCase();let t=toUtf8CodePoints(c);t=flatten(t.map(ie=>{if(Table_B_1_flags.indexOf(ie)>=0)return[];if(ie>=65024&&ie<=65039)return[];let fe=_nameprepTableB2(ie);return fe||[ie]})),t=toUtf8CodePoints(_toUtf8String(t),UnicodeNormalizationForm.NFKC),t.forEach(ie=>{if(_nameprepTableC(ie))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")}),t.forEach(ie=>{if(_nameprepTableA1(ie))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")});let n=_toUtf8String(t);if(n.substring(0,1)==="-"||n.substring(2,4)==="--"||n.substring(n.length-1)==="-")throw new Error("invalid hyphen");return n}const lib_esm$e=Object.freeze(Object.defineProperty({__proto__:null,get UnicodeNormalizationForm(){return UnicodeNormalizationForm},Utf8ErrorFuncs,get Utf8ErrorReason(){return Utf8ErrorReason},_toEscapedUtf8String,formatBytes32String,nameprep,parseBytes32String,toUtf8Bytes,toUtf8CodePoints,toUtf8String},Symbol.toStringTag,{value:"Module"}));class StringCoder extends DynamicBytesCoder{constructor(t){super("string",t)}defaultValue(){return""}encode(t,n){return super.encode(t,toUtf8Bytes(n))}decode(t){return toUtf8String(super.decode(t))}}class TupleCoder extends Coder{constructor(t,n){let ie=!1;const fe=[];t.forEach(le=>{le.dynamic&&(ie=!0),fe.push(le.type)});const ae="tuple("+fe.join(",")+")";super("tuple",ae,n,ie),this.coders=t}defaultValue(){const t=[];this.coders.forEach(ie=>{t.push(ie.defaultValue())});const n=this.coders.reduce((ie,fe)=>{const ae=fe.localName;return ae&&(ie[ae]||(ie[ae]=0),ie[ae]++),ie},{});return this.coders.forEach((ie,fe)=>{let ae=ie.localName;!ae||n[ae]!==1||(ae==="length"&&(ae="_length"),t[ae]==null&&(t[ae]=t[fe]))}),Object.freeze(t)}encode(t,n){return pack$1(t,this.coders,n)}decode(t){return t.coerce(this.name,unpack(t,this.coders))}}const logger$n=new Logger(version$q),paramTypeBytes=new RegExp(/^bytes([0-9]*)$/),paramTypeNumber=new RegExp(/^(u?int)([0-9]*)$/);class AbiCoder{constructor(t){defineReadOnly(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new AddressCoder(t.name);case"bool":return new BooleanCoder(t.name);case"string":return new StringCoder(t.name);case"bytes":return new BytesCoder(t.name);case"array":return new ArrayCoder(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new TupleCoder((t.components||[]).map(ie=>this._getCoder(ie)),t.name);case"":return new NullCoder(t.name)}let n=t.type.match(paramTypeNumber);if(n){let ie=parseInt(n[2]||"256");return(ie===0||ie>256||ie%8!==0)&&logger$n.throwArgumentError("invalid "+n[1]+" bit length","param",t),new NumberCoder(ie/8,n[1]==="int",t.name)}if(n=t.type.match(paramTypeBytes),n){let ie=parseInt(n[1]);return(ie===0||ie>32)&&logger$n.throwArgumentError("invalid bytes length","param",t),new FixedBytesCoder(ie,t.name)}return logger$n.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,n){return new Reader(t,this._getWordSize(),this.coerceFunc,n)}_getWriter(){return new Writer(this._getWordSize())}getDefaultValue(t){const n=t.map(fe=>this._getCoder(ParamType.from(fe)));return new TupleCoder(n,"_").defaultValue()}encode(t,n){t.length!==n.length&&logger$n.throwError("types/values length mismatch",Logger.errors.INVALID_ARGUMENT,{count:{types:t.length,values:n.length},value:{types:t,values:n}});const ie=t.map(le=>this._getCoder(ParamType.from(le))),fe=new TupleCoder(ie,"_"),ae=this._getWriter();return fe.encode(ae,n),ae.data}decode(t,n,ie){const fe=t.map(le=>this._getCoder(ParamType.from(le)));return new TupleCoder(fe,"_").decode(this._getReader(arrayify(n),ie))}}const defaultAbiCoder=new AbiCoder;function id(c){return keccak256$1(toUtf8Bytes(c))}const version$m="hash/5.8.0";function decode$a(c){c=atob(c);const t=[];for(let n=0;n<c.length;n++)t.push(c.charCodeAt(n));return arrayify(t)}function encode$9(c){c=arrayify(c);let t="";for(let n=0;n<c.length;n++)t+=String.fromCharCode(c[n]);return btoa(t)}const lib_esm$d=Object.freeze(Object.defineProperty({__proto__:null,decode:decode$a,encode:encode$9},Symbol.toStringTag,{value:"Module"}));function flat(c,t){t==null&&(t=1);const n=[],ie=n.forEach,fe=function(ae,le){ie.call(ae,function(pe){le>0&&Array.isArray(pe)?fe(pe,le-1):n.push(pe)})};return fe(c,t),n}function fromEntries(c){const t={};for(let n=0;n<c.length;n++){const ie=c[n];t[ie[0]]=ie[1]}return t}function decode_arithmetic(c){let t=0;function n(){return c[t++]<<8|c[t++]}let ie=n(),fe=1,ae=[0,1];for(let He=1;He<ie;He++)ae.push(fe+=n());let le=n(),pe=t;t+=le;let me=0,ye=0;function xe(){return me==0&&(ye=ye<<8|c[t++],me=8),ye>>--me&1}const Ee=31,Se=Math.pow(2,Ee),Me=Se>>>1,Be=Me>>1,$e=Se-1;let ke=0;for(let He=0;He<Ee;He++)ke=ke<<1|xe();let Te=[],Ie=0,Fe=Se;for(;;){let He=Math.floor(((ke-Ie+1)*fe-1)/Fe),ze=0,Je=ie;for(;Je-ze>1;){let $t=ze+Je>>>1;He<ae[$t]?Je=$t:ze=$t}if(ze==0)break;Te.push(ze);let Xe=Ie+Math.floor(Fe*ae[ze]/fe),Ue=Ie+Math.floor(Fe*ae[ze+1]/fe)-1;for(;!((Xe^Ue)&Me);)ke=ke<<1&$e|xe(),Xe=Xe<<1&$e,Ue=Ue<<1&$e|1;for(;Xe&~Ue&Be;)ke=ke&Me|ke<<1&$e>>>1|xe(),Xe=Xe<<1^Me,Ue=(Ue^Me)<<1|Me|1;Ie=Xe,Fe=1+Ue-Xe}let Le=ie-4;return Te.map(He=>{switch(He-Le){case 3:return Le+65792+(c[pe++]<<16|c[pe++]<<8|c[pe++]);case 2:return Le+256+(c[pe++]<<8|c[pe++]);case 1:return Le+c[pe++];default:return He-1}})}function read_payload(c){let t=0;return()=>c[t++]}function read_compressed_payload(c){return read_payload(decode_arithmetic(c))}function signed(c){return c&1?~c>>1:c>>1}function read_counts(c,t){let n=Array(c);for(let ie=0;ie<c;ie++)n[ie]=1+t();return n}function read_ascending(c,t){let n=Array(c);for(let ie=0,fe=-1;ie<c;ie++)n[ie]=fe+=1+t();return n}function read_deltas(c,t){let n=Array(c);for(let ie=0,fe=0;ie<c;ie++)n[ie]=fe+=signed(t());return n}function read_member_array(c,t){let n=read_ascending(c(),c),ie=c(),fe=read_ascending(ie,c),ae=read_counts(ie,c);for(let le=0;le<ie;le++)for(let pe=0;pe<ae[le];pe++)n.push(fe[le]+pe);return t?n.map(le=>t[le]):n}function read_mapped_map(c){let t=[];for(;;){let n=c();if(n==0)break;t.push(read_linear_table(n,c))}for(;;){let n=c()-1;if(n<0)break;t.push(read_replacement_table(n,c))}return fromEntries(flat(t))}function read_zero_terminated_array(c){let t=[];for(;;){let n=c();if(n==0)break;t.push(n)}return t}function read_transposed(c,t,n){let ie=Array(c).fill(void 0).map(()=>[]);for(let fe=0;fe<t;fe++)read_deltas(c,n).forEach((ae,le)=>ie[le].push(ae));return ie}function read_linear_table(c,t){let n=1+t(),ie=t(),fe=read_zero_terminated_array(t),ae=read_transposed(fe.length,1+c,t);return flat(ae.map((le,pe)=>{const me=le[0],ye=le.slice(1);return Array(fe[pe]).fill(void 0).map((xe,Ee)=>{let Se=Ee*ie;return[me+Ee*n,ye.map(Me=>Me+Se)]})}))}function read_replacement_table(c,t){let n=1+t();return read_transposed(n,1+c,t).map(fe=>[fe[0],fe.slice(1)])}function read_emoji_trie(c){let t=read_member_array(c).sort((ie,fe)=>ie-fe);return n();function n(){let ie=[];for(;;){let ye=read_member_array(c,t);if(ye.length==0)break;ie.push({set:new Set(ye),node:n()})}ie.sort((ye,xe)=>xe.set.size-ye.set.size);let fe=c(),ae=fe%3;fe=fe/3|0;let le=!!(fe&1);fe>>=1;let pe=fe==1,me=fe==2;return{branches:ie,valid:ae,fe0f:le,save:pe,check:me}}}function getData(){return read_compressed_payload(decode$a("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const r$2=getData(),VALID=new Set(read_member_array(r$2)),IGNORED=new Set(read_member_array(r$2)),MAPPED=read_mapped_map(r$2),EMOJI_ROOT=read_emoji_trie(r$2),HYPHEN=45,UNDERSCORE=95;function explode_cp(c){return toUtf8CodePoints(c)}function filter_fe0f(c){return c.filter(t=>t!=65039)}function ens_normalize_post_check(c){for(let t of c.split(".")){let n=explode_cp(t);try{for(let ie=n.lastIndexOf(UNDERSCORE)-1;ie>=0;ie--)if(n[ie]!==UNDERSCORE)throw new Error("underscore only allowed at start");if(n.length>=4&&n.every(ie=>ie<128)&&n[2]===HYPHEN&&n[3]===HYPHEN)throw new Error("invalid label extension")}catch(ie){throw new Error(`Invalid label "${t}": ${ie.message}`)}}return c}function ens_normalize(c){return ens_normalize_post_check(normalize(c,filter_fe0f))}function normalize(c,t){let n=explode_cp(c).reverse(),ie=[];for(;n.length;){let fe=consume_emoji_reversed(n);if(fe){ie.push(...t(fe));continue}let ae=n.pop();if(VALID.has(ae)){ie.push(ae);continue}if(IGNORED.has(ae))continue;let le=MAPPED[ae];if(le){ie.push(...le);continue}throw new Error(`Disallowed codepoint: 0x${ae.toString(16).toUpperCase()}`)}return ens_normalize_post_check(nfc(String.fromCodePoint(...ie)))}function nfc(c){return c.normalize("NFC")}function consume_emoji_reversed(c,t){var n;let ie=EMOJI_ROOT,fe,ae,le=[],pe=c.length;for(;pe;){let me=c[--pe];if(ie=(n=ie.branches.find(ye=>ye.set.has(me)))===null||n===void 0?void 0:n.node,!ie)break;if(ie.save)ae=me;else if(ie.check&&me===ae)break;le.push(me),ie.fe0f&&(le.push(65039),pe>0&&c[pe-1]==65039&&pe--),ie.valid&&(fe=le.slice(),ie.valid==2&&fe.splice(1,1),c.length=pe)}return fe}const logger$m=new Logger(version$m),Zeros$1=new Uint8Array(32);Zeros$1.fill(0);function checkComponent(c){if(c.length===0)throw new Error("invalid ENS name; empty component");return c}function ensNameSplit(c){const t=toUtf8Bytes(ens_normalize(c)),n=[];if(c.length===0)return n;let ie=0;for(let fe=0;fe<t.length;fe++)t[fe]===46&&(n.push(checkComponent(t.slice(ie,fe))),ie=fe+1);if(ie>=t.length)throw new Error("invalid ENS name; empty component");return n.push(checkComponent(t.slice(ie))),n}function ensNormalize(c){return ensNameSplit(c).map(t=>toUtf8String(t)).join(".")}function isValidName(c){try{return ensNameSplit(c).length!==0}catch{}return!1}function namehash$1(c){typeof c!="string"&&logger$m.throwArgumentError("invalid ENS name; not a string","name",c);let t=Zeros$1;const n=ensNameSplit(c);for(;n.length;)t=keccak256$1(concat$1([t,keccak256$1(n.pop())]));return hexlify(t)}function dnsEncode(c){return hexlify(concat$1(ensNameSplit(c).map(t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const n=new Uint8Array(t.length+1);return n.set(t,1),n[0]=n.length-1,n})))+"00"}const messagePrefix=`Ethereum Signed Message:
7
7
  `;function hashMessage(c){return typeof c=="string"&&(c=toUtf8Bytes(c)),keccak256$1(concat$1([toUtf8Bytes(messagePrefix),toUtf8Bytes(String(c.length)),c]))}var __awaiter$k=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$l=new Logger(version$m),padding=new Uint8Array(32);padding.fill(0);const NegativeOne=BigNumber.from(-1),Zero=BigNumber.from(0),One=BigNumber.from(1),MaxUint256=BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function hexPadRight(c){const t=arrayify(c),n=t.length%32;return n?hexConcat([t,padding.slice(n)]):hexlify(t)}const hexTrue=hexZeroPad(One.toHexString(),32),hexFalse=hexZeroPad(Zero.toHexString(),32),domainFieldTypes={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},domainFieldNames=["name","version","chainId","verifyingContract","salt"];function checkString(c){return function(t){return typeof t!="string"&&logger$l.throwArgumentError(`invalid domain value for ${JSON.stringify(c)}`,`domain.${c}`,t),t}}const domainChecks={name:checkString("name"),version:checkString("version"),chainId:function(c){try{return BigNumber.from(c).toString()}catch{}return logger$l.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",c)},verifyingContract:function(c){try{return getAddress(c).toLowerCase()}catch{}return logger$l.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",c)},salt:function(c){try{const t=arrayify(c);if(t.length!==32)throw new Error("bad length");return hexlify(t)}catch{}return logger$l.throwArgumentError('invalid domain value "salt"',"domain.salt",c)}};function getBaseEncoder(c){{const t=c.match(/^(u?)int(\d*)$/);if(t){const n=t[1]==="",ie=parseInt(t[2]||"256");(ie%8!==0||ie>256||t[2]&&t[2]!==String(ie))&&logger$l.throwArgumentError("invalid numeric width","type",c);const fe=MaxUint256.mask(n?ie-1:ie),ae=n?fe.add(One).mul(NegativeOne):Zero;return function(le){const pe=BigNumber.from(le);return(pe.lt(ae)||pe.gt(fe))&&logger$l.throwArgumentError(`value out-of-bounds for ${c}`,"value",le),hexZeroPad(pe.toTwos(256).toHexString(),32)}}}{const t=c.match(/^bytes(\d+)$/);if(t){const n=parseInt(t[1]);return(n===0||n>32||t[1]!==String(n))&&logger$l.throwArgumentError("invalid bytes width","type",c),function(ie){return arrayify(ie).length!==n&&logger$l.throwArgumentError(`invalid length for ${c}`,"value",ie),hexPadRight(ie)}}}switch(c){case"address":return function(t){return hexZeroPad(getAddress(t),32)};case"bool":return function(t){return t?hexTrue:hexFalse};case"bytes":return function(t){return keccak256$1(t)};case"string":return function(t){return id(t)}}return null}function encodeType(c,t){return`${c}(${t.map(({name:n,type:ie})=>ie+" "+n).join(",")})`}class TypedDataEncoder{constructor(t){defineReadOnly(this,"types",Object.freeze(deepCopy(t))),defineReadOnly(this,"_encoderCache",{}),defineReadOnly(this,"_types",{});const n={},ie={},fe={};Object.keys(t).forEach(pe=>{n[pe]={},ie[pe]=[],fe[pe]={}});for(const pe in t){const me={};t[pe].forEach(ye=>{me[ye.name]&&logger$l.throwArgumentError(`duplicate variable name ${JSON.stringify(ye.name)} in ${JSON.stringify(pe)}`,"types",t),me[ye.name]=!0;const xe=ye.type.match(/^([^\x5b]*)(\x5b|$)/)[1];xe===pe&&logger$l.throwArgumentError(`circular type reference to ${JSON.stringify(xe)}`,"types",t),!getBaseEncoder(xe)&&(ie[xe]||logger$l.throwArgumentError(`unknown type ${JSON.stringify(xe)}`,"types",t),ie[xe].push(pe),n[pe][xe]=!0)})}const ae=Object.keys(ie).filter(pe=>ie[pe].length===0);ae.length===0?logger$l.throwArgumentError("missing primary type","types",t):ae.length>1&&logger$l.throwArgumentError(`ambiguous primary types or unused types: ${ae.map(pe=>JSON.stringify(pe)).join(", ")}`,"types",t),defineReadOnly(this,"primaryType",ae[0]);function le(pe,me){me[pe]&&logger$l.throwArgumentError(`circular type reference to ${JSON.stringify(pe)}`,"types",t),me[pe]=!0,Object.keys(n[pe]).forEach(ye=>{ie[ye]&&(le(ye,me),Object.keys(me).forEach(xe=>{fe[xe][ye]=!0}))}),delete me[pe]}le(this.primaryType,{});for(const pe in fe){const me=Object.keys(fe[pe]);me.sort(),this._types[pe]=encodeType(pe,t[pe])+me.map(ye=>encodeType(ye,t[ye])).join("")}}getEncoder(t){let n=this._encoderCache[t];return n||(n=this._encoderCache[t]=this._getEncoder(t)),n}_getEncoder(t){{const fe=getBaseEncoder(t);if(fe)return fe}const n=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const fe=n[1],ae=this.getEncoder(fe),le=parseInt(n[3]);return pe=>{le>=0&&pe.length!==le&&logger$l.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",pe);let me=pe.map(ae);return this._types[fe]&&(me=me.map(keccak256$1)),keccak256$1(hexConcat(me))}}const ie=this.types[t];if(ie){const fe=id(this._types[t]);return ae=>{const le=ie.map(({name:pe,type:me})=>{const ye=this.getEncoder(me)(ae[pe]);return this._types[me]?keccak256$1(ye):ye});return le.unshift(fe),hexConcat(le)}}return logger$l.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const n=this._types[t];return n||logger$l.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),n}encodeData(t,n){return this.getEncoder(t)(n)}hashStruct(t,n){return keccak256$1(this.encodeData(t,n))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,n,ie){if(getBaseEncoder(t))return ie(t,n);const fe=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(fe){const le=fe[1],pe=parseInt(fe[3]);return pe>=0&&n.length!==pe&&logger$l.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",n),n.map(me=>this._visit(le,me,ie))}const ae=this.types[t];return ae?ae.reduce((le,{name:pe,type:me})=>(le[pe]=this._visit(me,n[pe],ie),le),{}):logger$l.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,n){return this._visit(this.primaryType,t,n)}static from(t){return new TypedDataEncoder(t)}static getPrimaryType(t){return TypedDataEncoder.from(t).primaryType}static hashStruct(t,n,ie){return TypedDataEncoder.from(n).hashStruct(t,ie)}static hashDomain(t){const n=[];for(const ie in t){const fe=domainFieldTypes[ie];fe||logger$l.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(ie)}`,"domain",t),n.push({name:ie,type:fe})}return n.sort((ie,fe)=>domainFieldNames.indexOf(ie.name)-domainFieldNames.indexOf(fe.name)),TypedDataEncoder.hashStruct("EIP712Domain",{EIP712Domain:n},t)}static encode(t,n,ie){return hexConcat(["0x1901",TypedDataEncoder.hashDomain(t),TypedDataEncoder.from(n).hash(ie)])}static hash(t,n,ie){return keccak256$1(TypedDataEncoder.encode(t,n,ie))}static resolveNames(t,n,ie,fe){return __awaiter$k(this,void 0,void 0,function*(){t=shallowCopy(t);const ae={};t.verifyingContract&&!isHexString(t.verifyingContract,20)&&(ae[t.verifyingContract]="0x");const le=TypedDataEncoder.from(n);le.visit(ie,(pe,me)=>(pe==="address"&&!isHexString(me,20)&&(ae[me]="0x"),me));for(const pe in ae)ae[pe]=yield fe(pe);return t.verifyingContract&&ae[t.verifyingContract]&&(t.verifyingContract=ae[t.verifyingContract]),ie=le.visit(ie,(pe,me)=>pe==="address"&&ae[me]?ae[me]:me),{domain:t,value:ie}})}static getPayload(t,n,ie){TypedDataEncoder.hashDomain(t);const fe={},ae=[];domainFieldNames.forEach(me=>{const ye=t[me];ye!=null&&(fe[me]=domainChecks[me](ye),ae.push({name:me,type:domainFieldTypes[me]}))});const le=TypedDataEncoder.from(n),pe=shallowCopy(n);return pe.EIP712Domain?logger$l.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",n):pe.EIP712Domain=ae,le.encode(ie),{types:pe,domain:fe,primaryType:le.primaryType,message:le.visit(ie,(me,ye)=>{if(me.match(/^bytes(\d*)/))return hexlify(arrayify(ye));if(me.match(/^u?int/))return BigNumber.from(ye).toString();switch(me){case"address":return ye.toLowerCase();case"bool":return!!ye;case"string":return typeof ye!="string"&&logger$l.throwArgumentError("invalid string","value",ye),ye}return logger$l.throwArgumentError("unsupported type","type",me)})}}}const lib_esm$c=Object.freeze(Object.defineProperty({__proto__:null,_TypedDataEncoder:TypedDataEncoder,dnsEncode,ensNormalize,hashMessage,id,isValidName,messagePrefix,namehash:namehash$1},Symbol.toStringTag,{value:"Module"})),logger$k=new Logger(version$q);class LogDescription extends Description{}class TransactionDescription extends Description{}class ErrorDescription extends Description{}class Indexed extends Description{static isIndexed(t){return!!(t&&t._isIndexed)}}const BuiltinErrors={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function wrapAccessError(c,t){const n=new Error(`deferred error during ABI decoding triggered accessing ${c}`);return n.error=t,n}class Interface{constructor(t){let n=[];typeof t=="string"?n=JSON.parse(t):n=t,defineReadOnly(this,"fragments",n.map(ie=>Fragment.from(ie)).filter(ie=>ie!=null)),defineReadOnly(this,"_abiCoder",getStatic(new.target,"getAbiCoder")()),defineReadOnly(this,"functions",{}),defineReadOnly(this,"errors",{}),defineReadOnly(this,"events",{}),defineReadOnly(this,"structs",{}),this.fragments.forEach(ie=>{let fe=null;switch(ie.type){case"constructor":if(this.deploy){logger$k.warn("duplicate definition - constructor");return}defineReadOnly(this,"deploy",ie);return;case"function":fe=this.functions;break;case"event":fe=this.events;break;case"error":fe=this.errors;break;default:return}let ae=ie.format();if(fe[ae]){logger$k.warn("duplicate definition - "+ae);return}fe[ae]=ie}),this.deploy||defineReadOnly(this,"deploy",ConstructorFragment.from({payable:!1,type:"constructor"})),defineReadOnly(this,"_isInterface",!0)}format(t){t||(t=FormatTypes.full),t===FormatTypes.sighash&&logger$k.throwArgumentError("interface does not support formatting sighash","format",t);const n=this.fragments.map(ie=>ie.format(t));return t===FormatTypes.json?JSON.stringify(n.map(ie=>JSON.parse(ie))):n}static getAbiCoder(){return defaultAbiCoder}static getAddress(t){return getAddress(t)}static getSighash(t){return hexDataSlice(id(t.format()),0,4)}static getEventTopic(t){return id(t.format())}getFunction(t){if(isHexString(t)){for(const ie in this.functions)if(t===this.getSighash(ie))return this.functions[ie];logger$k.throwArgumentError("no matching function","sighash",t)}if(t.indexOf("(")===-1){const ie=t.trim(),fe=Object.keys(this.functions).filter(ae=>ae.split("(")[0]===ie);return fe.length===0?logger$k.throwArgumentError("no matching function","name",ie):fe.length>1&&logger$k.throwArgumentError("multiple matching functions","name",ie),this.functions[fe[0]]}const n=this.functions[FunctionFragment.fromString(t).format()];return n||logger$k.throwArgumentError("no matching function","signature",t),n}getEvent(t){if(isHexString(t)){const ie=t.toLowerCase();for(const fe in this.events)if(ie===this.getEventTopic(fe))return this.events[fe];logger$k.throwArgumentError("no matching event","topichash",ie)}if(t.indexOf("(")===-1){const ie=t.trim(),fe=Object.keys(this.events).filter(ae=>ae.split("(")[0]===ie);return fe.length===0?logger$k.throwArgumentError("no matching event","name",ie):fe.length>1&&logger$k.throwArgumentError("multiple matching events","name",ie),this.events[fe[0]]}const n=this.events[EventFragment.fromString(t).format()];return n||logger$k.throwArgumentError("no matching event","signature",t),n}getError(t){if(isHexString(t)){const ie=getStatic(this.constructor,"getSighash");for(const fe in this.errors){const ae=this.errors[fe];if(t===ie(ae))return this.errors[fe]}logger$k.throwArgumentError("no matching error","sighash",t)}if(t.indexOf("(")===-1){const ie=t.trim(),fe=Object.keys(this.errors).filter(ae=>ae.split("(")[0]===ie);return fe.length===0?logger$k.throwArgumentError("no matching error","name",ie):fe.length>1&&logger$k.throwArgumentError("multiple matching errors","name",ie),this.errors[fe[0]]}const n=this.errors[FunctionFragment.fromString(t).format()];return n||logger$k.throwArgumentError("no matching error","signature",t),n}getSighash(t){if(typeof t=="string")try{t=this.getFunction(t)}catch(n){try{t=this.getError(t)}catch{throw n}}return getStatic(this.constructor,"getSighash")(t)}getEventTopic(t){return typeof t=="string"&&(t=this.getEvent(t)),getStatic(this.constructor,"getEventTopic")(t)}_decodeParams(t,n){return this._abiCoder.decode(t,n)}_encodeParams(t,n){return this._abiCoder.encode(t,n)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,n){typeof t=="string"&&(t=this.getError(t));const ie=arrayify(n);return hexlify(ie.slice(0,4))!==this.getSighash(t)&&logger$k.throwArgumentError(`data signature does not match error ${t.name}.`,"data",hexlify(ie)),this._decodeParams(t.inputs,ie.slice(4))}encodeErrorResult(t,n){return typeof t=="string"&&(t=this.getError(t)),hexlify(concat$1([this.getSighash(t),this._encodeParams(t.inputs,n||[])]))}decodeFunctionData(t,n){typeof t=="string"&&(t=this.getFunction(t));const ie=arrayify(n);return hexlify(ie.slice(0,4))!==this.getSighash(t)&&logger$k.throwArgumentError(`data signature does not match function ${t.name}.`,"data",hexlify(ie)),this._decodeParams(t.inputs,ie.slice(4))}encodeFunctionData(t,n){return typeof t=="string"&&(t=this.getFunction(t)),hexlify(concat$1([this.getSighash(t),this._encodeParams(t.inputs,n||[])]))}decodeFunctionResult(t,n){typeof t=="string"&&(t=this.getFunction(t));let ie=arrayify(n),fe=null,ae="",le=null,pe=null,me=null;switch(ie.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,ie)}catch{}break;case 4:{const ye=hexlify(ie.slice(0,4)),xe=BuiltinErrors[ye];if(xe)le=this._abiCoder.decode(xe.inputs,ie.slice(4)),pe=xe.name,me=xe.signature,xe.reason&&(fe=le[0]),pe==="Error"?ae=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(le[0])}`:pe==="Panic"&&(ae=`; VM Exception while processing transaction: reverted with panic code ${le[0]}`);else try{const Ee=this.getError(ye);le=this._abiCoder.decode(Ee.inputs,ie.slice(4)),pe=Ee.name,me=Ee.format()}catch{}break}}return logger$k.throwError("call revert exception"+ae,Logger.errors.CALL_EXCEPTION,{method:t.format(),data:hexlify(n),errorArgs:le,errorName:pe,errorSignature:me,reason:fe})}encodeFunctionResult(t,n){return typeof t=="string"&&(t=this.getFunction(t)),hexlify(this._abiCoder.encode(t.outputs,n||[]))}encodeFilterTopics(t,n){typeof t=="string"&&(t=this.getEvent(t)),n.length>t.inputs.length&&logger$k.throwError("too many arguments for "+t.format(),Logger.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:n});let ie=[];t.anonymous||ie.push(this.getEventTopic(t));const fe=(ae,le)=>ae.type==="string"?id(le):ae.type==="bytes"?keccak256$1(hexlify(le)):(ae.type==="bool"&&typeof le=="boolean"&&(le=le?"0x01":"0x00"),ae.type.match(/^u?int/)&&(le=BigNumber.from(le).toHexString()),ae.type==="address"&&this._abiCoder.encode(["address"],[le]),hexZeroPad(hexlify(le),32));for(n.forEach((ae,le)=>{let pe=t.inputs[le];if(!pe.indexed){ae!=null&&logger$k.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+pe.name,ae);return}ae==null?ie.push(null):pe.baseType==="array"||pe.baseType==="tuple"?logger$k.throwArgumentError("filtering with tuples or arrays not supported","contract."+pe.name,ae):Array.isArray(ae)?ie.push(ae.map(me=>fe(pe,me))):ie.push(fe(pe,ae))});ie.length&&ie[ie.length-1]===null;)ie.pop();return ie}encodeEventLog(t,n){typeof t=="string"&&(t=this.getEvent(t));const ie=[],fe=[],ae=[];return t.anonymous||ie.push(this.getEventTopic(t)),n.length!==t.inputs.length&&logger$k.throwArgumentError("event arguments/values mismatch","values",n),t.inputs.forEach((le,pe)=>{const me=n[pe];if(le.indexed)if(le.type==="string")ie.push(id(me));else if(le.type==="bytes")ie.push(keccak256$1(me));else{if(le.baseType==="tuple"||le.baseType==="array")throw new Error("not implemented");ie.push(this._abiCoder.encode([le.type],[me]))}else fe.push(le),ae.push(me)}),{data:this._abiCoder.encode(fe,ae),topics:ie}}decodeEventLog(t,n,ie){if(typeof t=="string"&&(t=this.getEvent(t)),ie!=null&&!t.anonymous){let Se=this.getEventTopic(t);(!isHexString(ie[0],32)||ie[0].toLowerCase()!==Se)&&logger$k.throwError("fragment/topic mismatch",Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:Se,value:ie[0]}),ie=ie.slice(1)}let fe=[],ae=[],le=[];t.inputs.forEach((Se,Me)=>{Se.indexed?Se.type==="string"||Se.type==="bytes"||Se.baseType==="tuple"||Se.baseType==="array"?(fe.push(ParamType.fromObject({type:"bytes32",name:Se.name})),le.push(!0)):(fe.push(Se),le.push(!1)):(ae.push(Se),le.push(!1))});let pe=ie!=null?this._abiCoder.decode(fe,concat$1(ie)):null,me=this._abiCoder.decode(ae,n,!0),ye=[],xe=0,Ee=0;t.inputs.forEach((Se,Me)=>{if(Se.indexed)if(pe==null)ye[Me]=new Indexed({_isIndexed:!0,hash:null});else if(le[Me])ye[Me]=new Indexed({_isIndexed:!0,hash:pe[Ee++]});else try{ye[Me]=pe[Ee++]}catch(Be){ye[Me]=Be}else try{ye[Me]=me[xe++]}catch(Be){ye[Me]=Be}if(Se.name&&ye[Se.name]==null){const Be=ye[Me];Be instanceof Error?Object.defineProperty(ye,Se.name,{enumerable:!0,get:()=>{throw wrapAccessError(`property ${JSON.stringify(Se.name)}`,Be)}}):ye[Se.name]=Be}});for(let Se=0;Se<ye.length;Se++){const Me=ye[Se];Me instanceof Error&&Object.defineProperty(ye,Se,{enumerable:!0,get:()=>{throw wrapAccessError(`index ${Se}`,Me)}})}return Object.freeze(ye)}parseTransaction(t){let n=this.getFunction(t.data.substring(0,10).toLowerCase());return n?new TransactionDescription({args:this._abiCoder.decode(n.inputs,"0x"+t.data.substring(10)),functionFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n),value:BigNumber.from(t.value||"0")}):null}parseLog(t){let n=this.getEvent(t.topics[0]);return!n||n.anonymous?null:new LogDescription({eventFragment:n,name:n.name,signature:n.format(),topic:this.getEventTopic(n),args:this.decodeEventLog(n,t.data,t.topics)})}parseError(t){const n=hexlify(t);let ie=this.getError(n.substring(0,10).toLowerCase());return ie?new ErrorDescription({args:this._abiCoder.decode(ie.inputs,"0x"+n.substring(10)),errorFragment:ie,name:ie.name,signature:ie.format(),sighash:this.getSighash(ie)}):null}static isInterface(t){return!!(t&&t._isInterface)}}const lib_esm$b=Object.freeze(Object.defineProperty({__proto__:null,AbiCoder,ConstructorFragment,ErrorFragment,EventFragment,FormatTypes,Fragment,FunctionFragment,Indexed,Interface,LogDescription,ParamType,TransactionDescription,checkResultErrors,defaultAbiCoder},Symbol.toStringTag,{value:"Module"})),version$l="abstract-provider/5.8.0";var __awaiter$j=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$j=new Logger(version$l);class ForkEvent extends Description{static isForkEvent(t){return!!(t&&t._isForkEvent)}}class Provider{constructor(){logger$j.checkAbstract(new.target,Provider),defineReadOnly(this,"_isProvider",!0)}getFeeData(){return __awaiter$j(this,void 0,void 0,function*(){const{block:t,gasPrice:n}=yield resolveProperties({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(le=>null)});let ie=null,fe=null,ae=null;return t&&t.baseFeePerGas&&(ie=t.baseFeePerGas,ae=BigNumber.from("1500000000"),fe=t.baseFeePerGas.mul(2).add(ae)),{lastBaseFeePerGas:ie,maxFeePerGas:fe,maxPriorityFeePerGas:ae,gasPrice:n}})}addListener(t,n){return this.on(t,n)}removeListener(t,n){return this.off(t,n)}static isProvider(t){return!!(t&&t._isProvider)}}const version$k="abstract-signer/5.8.0";var __awaiter$i=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$i=new Logger(version$k),allowedTransactionKeys$2=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],forwardErrors=[Logger.errors.INSUFFICIENT_FUNDS,Logger.errors.NONCE_EXPIRED,Logger.errors.REPLACEMENT_UNDERPRICED];class Signer{constructor(){logger$i.checkAbstract(new.target,Signer),defineReadOnly(this,"_isSigner",!0)}getBalance(t){return __awaiter$i(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)})}getTransactionCount(t){return __awaiter$i(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)})}estimateGas(t){return __awaiter$i(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const n=yield resolveProperties(this.checkTransaction(t));return yield this.provider.estimateGas(n)})}call(t,n){return __awaiter$i(this,void 0,void 0,function*(){this._checkProvider("call");const ie=yield resolveProperties(this.checkTransaction(t));return yield this.provider.call(ie,n)})}sendTransaction(t){return __awaiter$i(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const n=yield this.populateTransaction(t),ie=yield this.signTransaction(n);return yield this.provider.sendTransaction(ie)})}getChainId(){return __awaiter$i(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return __awaiter$i(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return __awaiter$i(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(t){return __awaiter$i(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)})}checkTransaction(t){for(const ie in t)allowedTransactionKeys$2.indexOf(ie)===-1&&logger$i.throwArgumentError("invalid transaction key: "+ie,"transaction",t);const n=shallowCopy(t);return n.from==null?n.from=this.getAddress():n.from=Promise.all([Promise.resolve(n.from),this.getAddress()]).then(ie=>(ie[0].toLowerCase()!==ie[1].toLowerCase()&&logger$i.throwArgumentError("from address mismatch","transaction",t),ie[0])),n}populateTransaction(t){return __awaiter$i(this,void 0,void 0,function*(){const n=yield resolveProperties(this.checkTransaction(t));n.to!=null&&(n.to=Promise.resolve(n.to).then(fe=>__awaiter$i(this,void 0,void 0,function*(){if(fe==null)return null;const ae=yield this.resolveName(fe);return ae==null&&logger$i.throwArgumentError("provided ENS name resolves to null","tx.to",fe),ae})),n.to.catch(fe=>{}));const ie=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||ie)?logger$i.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t):(n.type===0||n.type===1)&&ie&&logger$i.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1)n.gasPrice==null&&(n.gasPrice=this.getGasPrice());else{const fe=yield this.getFeeData();if(n.type==null)if(fe.maxFeePerGas!=null&&fe.maxPriorityFeePerGas!=null)if(n.type=2,n.gasPrice!=null){const ae=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=ae,n.maxPriorityFeePerGas=ae}else n.maxFeePerGas==null&&(n.maxFeePerGas=fe.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=fe.maxPriorityFeePerGas);else fe.gasPrice!=null?(ie&&logger$i.throwError("network does not support EIP-1559",Logger.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),n.gasPrice==null&&(n.gasPrice=fe.gasPrice),n.type=0):logger$i.throwError("failed to get consistent fee data",Logger.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else n.type===2&&(n.maxFeePerGas==null&&(n.maxFeePerGas=fe.maxFeePerGas),n.maxPriorityFeePerGas==null&&(n.maxPriorityFeePerGas=fe.maxPriorityFeePerGas))}return n.nonce==null&&(n.nonce=this.getTransactionCount("pending")),n.gasLimit==null&&(n.gasLimit=this.estimateGas(n).catch(fe=>{if(forwardErrors.indexOf(fe.code)>=0)throw fe;return logger$i.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:fe,tx:n})})),n.chainId==null?n.chainId=this.getChainId():n.chainId=Promise.all([Promise.resolve(n.chainId),this.getChainId()]).then(fe=>(fe[1]!==0&&fe[0]!==fe[1]&&logger$i.throwArgumentError("chainId address mismatch","transaction",t),fe[0])),yield resolveProperties(n)})}_checkProvider(t){this.provider||logger$i.throwError("missing provider",Logger.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!!(t&&t._isSigner)}}class VoidSigner extends Signer{constructor(t,n){super(),defineReadOnly(this,"address",t),defineReadOnly(this,"provider",n||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,n){return Promise.resolve().then(()=>{logger$i.throwError(t,Logger.errors.UNSUPPORTED_OPERATION,{operation:n})})}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,n,ie){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new VoidSigner(this.address,t)}}var hash$4={},utils$o={},minimalisticAssert$1=assert$h;function assert$h(c,t){if(!c)throw new Error(t||"Assertion failed")}assert$h.equal=function(t,n,ie){if(t!=n)throw new Error(ie||"Assertion failed: "+t+" != "+n)};var inherits_browser$1={exports:{}},hasRequiredInherits_browser;function requireInherits_browser(){return hasRequiredInherits_browser||(hasRequiredInherits_browser=1,typeof Object.create=="function"?inherits_browser$1.exports=function(t,n){n&&(t.super_=n,t.prototype=Object.create(n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:inherits_browser$1.exports=function(t,n){if(n){t.super_=n;var ie=function(){};ie.prototype=n.prototype,t.prototype=new ie,t.prototype.constructor=t}}),inherits_browser$1.exports}var assert$g=minimalisticAssert$1,inherits$3=requireInherits_browser();utils$o.inherits=inherits$3;function isSurrogatePair(c,t){return(c.charCodeAt(t)&64512)!==55296||t<0||t+1>=c.length?!1:(c.charCodeAt(t+1)&64512)===56320}function toArray(c,t){if(Array.isArray(c))return c.slice();if(!c)return[];var n=[];if(typeof c=="string")if(t){if(t==="hex")for(c=c.replace(/[^a-z0-9]+/ig,""),c.length%2!==0&&(c="0"+c),fe=0;fe<c.length;fe+=2)n.push(parseInt(c[fe]+c[fe+1],16))}else for(var ie=0,fe=0;fe<c.length;fe++){var ae=c.charCodeAt(fe);ae<128?n[ie++]=ae:ae<2048?(n[ie++]=ae>>6|192,n[ie++]=ae&63|128):isSurrogatePair(c,fe)?(ae=65536+((ae&1023)<<10)+(c.charCodeAt(++fe)&1023),n[ie++]=ae>>18|240,n[ie++]=ae>>12&63|128,n[ie++]=ae>>6&63|128,n[ie++]=ae&63|128):(n[ie++]=ae>>12|224,n[ie++]=ae>>6&63|128,n[ie++]=ae&63|128)}else for(fe=0;fe<c.length;fe++)n[fe]=c[fe]|0;return n}utils$o.toArray=toArray;function toHex$1(c){for(var t="",n=0;n<c.length;n++)t+=zero2(c[n].toString(16));return t}utils$o.toHex=toHex$1;function htonl(c){var t=c>>>24|c>>>8&65280|c<<8&16711680|(c&255)<<24;return t>>>0}utils$o.htonl=htonl;function toHex32(c,t){for(var n="",ie=0;ie<c.length;ie++){var fe=c[ie];t==="little"&&(fe=htonl(fe)),n+=zero8(fe.toString(16))}return n}utils$o.toHex32=toHex32;function zero2(c){return c.length===1?"0"+c:c}utils$o.zero2=zero2;function zero8(c){return c.length===7?"0"+c:c.length===6?"00"+c:c.length===5?"000"+c:c.length===4?"0000"+c:c.length===3?"00000"+c:c.length===2?"000000"+c:c.length===1?"0000000"+c:c}utils$o.zero8=zero8;function join32(c,t,n,ie){var fe=n-t;assert$g(fe%4===0);for(var ae=new Array(fe/4),le=0,pe=t;le<ae.length;le++,pe+=4){var me;ie==="big"?me=c[pe]<<24|c[pe+1]<<16|c[pe+2]<<8|c[pe+3]:me=c[pe+3]<<24|c[pe+2]<<16|c[pe+1]<<8|c[pe],ae[le]=me>>>0}return ae}utils$o.join32=join32;function split32(c,t){for(var n=new Array(c.length*4),ie=0,fe=0;ie<c.length;ie++,fe+=4){var ae=c[ie];t==="big"?(n[fe]=ae>>>24,n[fe+1]=ae>>>16&255,n[fe+2]=ae>>>8&255,n[fe+3]=ae&255):(n[fe+3]=ae>>>24,n[fe+2]=ae>>>16&255,n[fe+1]=ae>>>8&255,n[fe]=ae&255)}return n}utils$o.split32=split32;function rotr32$1(c,t){return c>>>t|c<<32-t}utils$o.rotr32=rotr32$1;function rotl32$2(c,t){return c<<t|c>>>32-t}utils$o.rotl32=rotl32$2;function sum32$3(c,t){return c+t>>>0}utils$o.sum32=sum32$3;function sum32_3$1(c,t,n){return c+t+n>>>0}utils$o.sum32_3=sum32_3$1;function sum32_4$2(c,t,n,ie){return c+t+n+ie>>>0}utils$o.sum32_4=sum32_4$2;function sum32_5$2(c,t,n,ie,fe){return c+t+n+ie+fe>>>0}utils$o.sum32_5=sum32_5$2;function sum64$1(c,t,n,ie){var fe=c[t],ae=c[t+1],le=ie+ae>>>0,pe=(le<ie?1:0)+n+fe;c[t]=pe>>>0,c[t+1]=le}utils$o.sum64=sum64$1;function sum64_hi$1(c,t,n,ie){var fe=t+ie>>>0,ae=(fe<t?1:0)+c+n;return ae>>>0}utils$o.sum64_hi=sum64_hi$1;function sum64_lo$1(c,t,n,ie){var fe=t+ie;return fe>>>0}utils$o.sum64_lo=sum64_lo$1;function sum64_4_hi$1(c,t,n,ie,fe,ae,le,pe){var me=0,ye=t;ye=ye+ie>>>0,me+=ye<t?1:0,ye=ye+ae>>>0,me+=ye<ae?1:0,ye=ye+pe>>>0,me+=ye<pe?1:0;var xe=c+n+fe+le+me;return xe>>>0}utils$o.sum64_4_hi=sum64_4_hi$1;function sum64_4_lo$1(c,t,n,ie,fe,ae,le,pe){var me=t+ie+ae+pe;return me>>>0}utils$o.sum64_4_lo=sum64_4_lo$1;function sum64_5_hi$1(c,t,n,ie,fe,ae,le,pe,me,ye){var xe=0,Ee=t;Ee=Ee+ie>>>0,xe+=Ee<t?1:0,Ee=Ee+ae>>>0,xe+=Ee<ae?1:0,Ee=Ee+pe>>>0,xe+=Ee<pe?1:0,Ee=Ee+ye>>>0,xe+=Ee<ye?1:0;var Se=c+n+fe+le+me+xe;return Se>>>0}utils$o.sum64_5_hi=sum64_5_hi$1;function sum64_5_lo$1(c,t,n,ie,fe,ae,le,pe,me,ye){var xe=t+ie+ae+pe+ye;return xe>>>0}utils$o.sum64_5_lo=sum64_5_lo$1;function rotr64_hi$1(c,t,n){var ie=t<<32-n|c>>>n;return ie>>>0}utils$o.rotr64_hi=rotr64_hi$1;function rotr64_lo$1(c,t,n){var ie=c<<32-n|t>>>n;return ie>>>0}utils$o.rotr64_lo=rotr64_lo$1;function shr64_hi$1(c,t,n){return c>>>n}utils$o.shr64_hi=shr64_hi$1;function shr64_lo$1(c,t,n){var ie=c<<32-n|t>>>n;return ie>>>0}utils$o.shr64_lo=shr64_lo$1;var common$6={},utils$n=utils$o,assert$f=minimalisticAssert$1;function BlockHash$4(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}common$6.BlockHash=BlockHash$4;BlockHash$4.prototype.update=function(t,n){if(t=utils$n.toArray(t,n),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var ie=t.length%this._delta8;this.pending=t.slice(t.length-ie,t.length),this.pending.length===0&&(this.pending=null),t=utils$n.join32(t,0,t.length-ie,this.endian);for(var fe=0;fe<t.length;fe+=this._delta32)this._update(t,fe,fe+this._delta32)}return this};BlockHash$4.prototype.digest=function(t){return this.update(this._pad()),assert$f(this.pending===null),this._digest(t)};BlockHash$4.prototype._pad=function(){var t=this.pendingTotal,n=this._delta8,ie=n-(t+this.padLength)%n,fe=new Array(ie+this.padLength);fe[0]=128;for(var ae=1;ae<ie;ae++)fe[ae]=0;if(t<<=3,this.endian==="big"){for(var le=8;le<this.padLength;le++)fe[ae++]=0;fe[ae++]=0,fe[ae++]=0,fe[ae++]=0,fe[ae++]=0,fe[ae++]=t>>>24&255,fe[ae++]=t>>>16&255,fe[ae++]=t>>>8&255,fe[ae++]=t&255}else for(fe[ae++]=t&255,fe[ae++]=t>>>8&255,fe[ae++]=t>>>16&255,fe[ae++]=t>>>24&255,fe[ae++]=0,fe[ae++]=0,fe[ae++]=0,fe[ae++]=0,le=8;le<this.padLength;le++)fe[ae++]=0;return fe};var sha$1={},common$5={},utils$m=utils$o,rotr32=utils$m.rotr32;function ft_1$1(c,t,n,ie){if(c===0)return ch32$1(t,n,ie);if(c===1||c===3)return p32(t,n,ie);if(c===2)return maj32$1(t,n,ie)}common$5.ft_1=ft_1$1;function ch32$1(c,t,n){return c&t^~c&n}common$5.ch32=ch32$1;function maj32$1(c,t,n){return c&t^c&n^t&n}common$5.maj32=maj32$1;function p32(c,t,n){return c^t^n}common$5.p32=p32;function s0_256$1(c){return rotr32(c,2)^rotr32(c,13)^rotr32(c,22)}common$5.s0_256=s0_256$1;function s1_256$1(c){return rotr32(c,6)^rotr32(c,11)^rotr32(c,25)}common$5.s1_256=s1_256$1;function g0_256$1(c){return rotr32(c,7)^rotr32(c,18)^c>>>3}common$5.g0_256=g0_256$1;function g1_256$1(c){return rotr32(c,17)^rotr32(c,19)^c>>>10}common$5.g1_256=g1_256$1;var utils$l=utils$o,common$4=common$6,shaCommon$1=common$5,rotl32$1=utils$l.rotl32,sum32$2=utils$l.sum32,sum32_5$1=utils$l.sum32_5,ft_1=shaCommon$1.ft_1,BlockHash$3=common$4.BlockHash,sha1_K=[1518500249,1859775393,2400959708,3395469782];function SHA1(){if(!(this instanceof SHA1))return new SHA1;BlockHash$3.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}utils$l.inherits(SHA1,BlockHash$3);var _1=SHA1;SHA1.blockSize=512;SHA1.outSize=160;SHA1.hmacStrength=80;SHA1.padLength=64;SHA1.prototype._update=function(t,n){for(var ie=this.W,fe=0;fe<16;fe++)ie[fe]=t[n+fe];for(;fe<ie.length;fe++)ie[fe]=rotl32$1(ie[fe-3]^ie[fe-8]^ie[fe-14]^ie[fe-16],1);var ae=this.h[0],le=this.h[1],pe=this.h[2],me=this.h[3],ye=this.h[4];for(fe=0;fe<ie.length;fe++){var xe=~~(fe/20),Ee=sum32_5$1(rotl32$1(ae,5),ft_1(xe,le,pe,me),ye,ie[fe],sha1_K[xe]);ye=me,me=pe,pe=rotl32$1(le,30),le=ae,ae=Ee}this.h[0]=sum32$2(this.h[0],ae),this.h[1]=sum32$2(this.h[1],le),this.h[2]=sum32$2(this.h[2],pe),this.h[3]=sum32$2(this.h[3],me),this.h[4]=sum32$2(this.h[4],ye)};SHA1.prototype._digest=function(t){return t==="hex"?utils$l.toHex32(this.h,"big"):utils$l.split32(this.h,"big")};var utils$k=utils$o,common$3=common$6,shaCommon=common$5,assert$e=minimalisticAssert$1,sum32$1=utils$k.sum32,sum32_4$1=utils$k.sum32_4,sum32_5=utils$k.sum32_5,ch32=shaCommon.ch32,maj32=shaCommon.maj32,s0_256=shaCommon.s0_256,s1_256=shaCommon.s1_256,g0_256=shaCommon.g0_256,g1_256=shaCommon.g1_256,BlockHash$2=common$3.BlockHash,sha256_K=[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];function SHA256$2(){if(!(this instanceof SHA256$2))return new SHA256$2;BlockHash$2.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=sha256_K,this.W=new Array(64)}utils$k.inherits(SHA256$2,BlockHash$2);var _256=SHA256$2;SHA256$2.blockSize=512;SHA256$2.outSize=256;SHA256$2.hmacStrength=192;SHA256$2.padLength=64;SHA256$2.prototype._update=function(t,n){for(var ie=this.W,fe=0;fe<16;fe++)ie[fe]=t[n+fe];for(;fe<ie.length;fe++)ie[fe]=sum32_4$1(g1_256(ie[fe-2]),ie[fe-7],g0_256(ie[fe-15]),ie[fe-16]);var ae=this.h[0],le=this.h[1],pe=this.h[2],me=this.h[3],ye=this.h[4],xe=this.h[5],Ee=this.h[6],Se=this.h[7];for(assert$e(this.k.length===ie.length),fe=0;fe<ie.length;fe++){var Me=sum32_5(Se,s1_256(ye),ch32(ye,xe,Ee),this.k[fe],ie[fe]),Be=sum32$1(s0_256(ae),maj32(ae,le,pe));Se=Ee,Ee=xe,xe=ye,ye=sum32$1(me,Me),me=pe,pe=le,le=ae,ae=sum32$1(Me,Be)}this.h[0]=sum32$1(this.h[0],ae),this.h[1]=sum32$1(this.h[1],le),this.h[2]=sum32$1(this.h[2],pe),this.h[3]=sum32$1(this.h[3],me),this.h[4]=sum32$1(this.h[4],ye),this.h[5]=sum32$1(this.h[5],xe),this.h[6]=sum32$1(this.h[6],Ee),this.h[7]=sum32$1(this.h[7],Se)};SHA256$2.prototype._digest=function(t){return t==="hex"?utils$k.toHex32(this.h,"big"):utils$k.split32(this.h,"big")};var utils$j=utils$o,SHA256$1=_256;function SHA224(){if(!(this instanceof SHA224))return new SHA224;SHA256$1.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}utils$j.inherits(SHA224,SHA256$1);var _224=SHA224;SHA224.blockSize=512;SHA224.outSize=224;SHA224.hmacStrength=192;SHA224.padLength=64;SHA224.prototype._digest=function(t){return t==="hex"?utils$j.toHex32(this.h.slice(0,7),"big"):utils$j.split32(this.h.slice(0,7),"big")};var utils$i=utils$o,common$2=common$6,assert$d=minimalisticAssert$1,rotr64_hi=utils$i.rotr64_hi,rotr64_lo=utils$i.rotr64_lo,shr64_hi=utils$i.shr64_hi,shr64_lo=utils$i.shr64_lo,sum64=utils$i.sum64,sum64_hi=utils$i.sum64_hi,sum64_lo=utils$i.sum64_lo,sum64_4_hi=utils$i.sum64_4_hi,sum64_4_lo=utils$i.sum64_4_lo,sum64_5_hi=utils$i.sum64_5_hi,sum64_5_lo=utils$i.sum64_5_lo,BlockHash$1=common$2.BlockHash,sha512_K=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function SHA512$2(){if(!(this instanceof SHA512$2))return new SHA512$2;BlockHash$1.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=sha512_K,this.W=new Array(160)}utils$i.inherits(SHA512$2,BlockHash$1);var _512=SHA512$2;SHA512$2.blockSize=1024;SHA512$2.outSize=512;SHA512$2.hmacStrength=192;SHA512$2.padLength=128;SHA512$2.prototype._prepareBlock=function(t,n){for(var ie=this.W,fe=0;fe<32;fe++)ie[fe]=t[n+fe];for(;fe<ie.length;fe+=2){var ae=g1_512_hi(ie[fe-4],ie[fe-3]),le=g1_512_lo(ie[fe-4],ie[fe-3]),pe=ie[fe-14],me=ie[fe-13],ye=g0_512_hi(ie[fe-30],ie[fe-29]),xe=g0_512_lo(ie[fe-30],ie[fe-29]),Ee=ie[fe-32],Se=ie[fe-31];ie[fe]=sum64_4_hi(ae,le,pe,me,ye,xe,Ee,Se),ie[fe+1]=sum64_4_lo(ae,le,pe,me,ye,xe,Ee,Se)}};SHA512$2.prototype._update=function(t,n){this._prepareBlock(t,n);var ie=this.W,fe=this.h[0],ae=this.h[1],le=this.h[2],pe=this.h[3],me=this.h[4],ye=this.h[5],xe=this.h[6],Ee=this.h[7],Se=this.h[8],Me=this.h[9],Be=this.h[10],$e=this.h[11],ke=this.h[12],Te=this.h[13],Ie=this.h[14],Fe=this.h[15];assert$d(this.k.length===ie.length);for(var Le=0;Le<ie.length;Le+=2){var He=Ie,ze=Fe,Je=s1_512_hi(Se,Me),Xe=s1_512_lo(Se,Me),Ue=ch64_hi(Se,Me,Be,$e,ke),$t=ch64_lo(Se,Me,Be,$e,ke,Te),_e=this.k[Le],se=this.k[Le+1],ce=ie[Le],de=ie[Le+1],he=sum64_5_hi(He,ze,Je,Xe,Ue,$t,_e,se,ce,de),ve=sum64_5_lo(He,ze,Je,Xe,Ue,$t,_e,se,ce,de);He=s0_512_hi(fe,ae),ze=s0_512_lo(fe,ae),Je=maj64_hi(fe,ae,le,pe,me),Xe=maj64_lo(fe,ae,le,pe,me,ye);var we=sum64_hi(He,ze,Je,Xe),Ae=sum64_lo(He,ze,Je,Xe);Ie=ke,Fe=Te,ke=Be,Te=$e,Be=Se,$e=Me,Se=sum64_hi(xe,Ee,he,ve),Me=sum64_lo(Ee,Ee,he,ve),xe=me,Ee=ye,me=le,ye=pe,le=fe,pe=ae,fe=sum64_hi(he,ve,we,Ae),ae=sum64_lo(he,ve,we,Ae)}sum64(this.h,0,fe,ae),sum64(this.h,2,le,pe),sum64(this.h,4,me,ye),sum64(this.h,6,xe,Ee),sum64(this.h,8,Se,Me),sum64(this.h,10,Be,$e),sum64(this.h,12,ke,Te),sum64(this.h,14,Ie,Fe)};SHA512$2.prototype._digest=function(t){return t==="hex"?utils$i.toHex32(this.h,"big"):utils$i.split32(this.h,"big")};function ch64_hi(c,t,n,ie,fe){var ae=c&n^~c&fe;return ae<0&&(ae+=4294967296),ae}function ch64_lo(c,t,n,ie,fe,ae){var le=t&ie^~t&ae;return le<0&&(le+=4294967296),le}function maj64_hi(c,t,n,ie,fe){var ae=c&n^c&fe^n&fe;return ae<0&&(ae+=4294967296),ae}function maj64_lo(c,t,n,ie,fe,ae){var le=t&ie^t&ae^ie&ae;return le<0&&(le+=4294967296),le}function s0_512_hi(c,t){var n=rotr64_hi(c,t,28),ie=rotr64_hi(t,c,2),fe=rotr64_hi(t,c,7),ae=n^ie^fe;return ae<0&&(ae+=4294967296),ae}function s0_512_lo(c,t){var n=rotr64_lo(c,t,28),ie=rotr64_lo(t,c,2),fe=rotr64_lo(t,c,7),ae=n^ie^fe;return ae<0&&(ae+=4294967296),ae}function s1_512_hi(c,t){var n=rotr64_hi(c,t,14),ie=rotr64_hi(c,t,18),fe=rotr64_hi(t,c,9),ae=n^ie^fe;return ae<0&&(ae+=4294967296),ae}function s1_512_lo(c,t){var n=rotr64_lo(c,t,14),ie=rotr64_lo(c,t,18),fe=rotr64_lo(t,c,9),ae=n^ie^fe;return ae<0&&(ae+=4294967296),ae}function g0_512_hi(c,t){var n=rotr64_hi(c,t,1),ie=rotr64_hi(c,t,8),fe=shr64_hi(c,t,7),ae=n^ie^fe;return ae<0&&(ae+=4294967296),ae}function g0_512_lo(c,t){var n=rotr64_lo(c,t,1),ie=rotr64_lo(c,t,8),fe=shr64_lo(c,t,7),ae=n^ie^fe;return ae<0&&(ae+=4294967296),ae}function g1_512_hi(c,t){var n=rotr64_hi(c,t,19),ie=rotr64_hi(t,c,29),fe=shr64_hi(c,t,6),ae=n^ie^fe;return ae<0&&(ae+=4294967296),ae}function g1_512_lo(c,t){var n=rotr64_lo(c,t,19),ie=rotr64_lo(t,c,29),fe=shr64_lo(c,t,6),ae=n^ie^fe;return ae<0&&(ae+=4294967296),ae}var utils$h=utils$o,SHA512$1=_512;function SHA384(){if(!(this instanceof SHA384))return new SHA384;SHA512$1.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}utils$h.inherits(SHA384,SHA512$1);var _384=SHA384;SHA384.blockSize=1024;SHA384.outSize=384;SHA384.hmacStrength=192;SHA384.padLength=128;SHA384.prototype._digest=function(t){return t==="hex"?utils$h.toHex32(this.h.slice(0,12),"big"):utils$h.split32(this.h.slice(0,12),"big")};sha$1.sha1=_1;sha$1.sha224=_224;sha$1.sha256=_256;sha$1.sha384=_384;sha$1.sha512=_512;var ripemd={},utils$g=utils$o,common$1=common$6,rotl32=utils$g.rotl32,sum32=utils$g.sum32,sum32_3=utils$g.sum32_3,sum32_4=utils$g.sum32_4,BlockHash=common$1.BlockHash;function RIPEMD160$1(){if(!(this instanceof RIPEMD160$1))return new RIPEMD160$1;BlockHash.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}utils$g.inherits(RIPEMD160$1,BlockHash);ripemd.ripemd160=RIPEMD160$1;RIPEMD160$1.blockSize=512;RIPEMD160$1.outSize=160;RIPEMD160$1.hmacStrength=192;RIPEMD160$1.padLength=64;RIPEMD160$1.prototype._update=function(t,n){for(var ie=this.h[0],fe=this.h[1],ae=this.h[2],le=this.h[3],pe=this.h[4],me=ie,ye=fe,xe=ae,Ee=le,Se=pe,Me=0;Me<80;Me++){var Be=sum32(rotl32(sum32_4(ie,f$2(Me,fe,ae,le),t[r$1[Me]+n],K$3(Me)),s$2[Me]),pe);ie=pe,pe=le,le=rotl32(ae,10),ae=fe,fe=Be,Be=sum32(rotl32(sum32_4(me,f$2(79-Me,ye,xe,Ee),t[rh[Me]+n],Kh(Me)),sh[Me]),Se),me=Se,Se=Ee,Ee=rotl32(xe,10),xe=ye,ye=Be}Be=sum32_3(this.h[1],ae,Ee),this.h[1]=sum32_3(this.h[2],le,Se),this.h[2]=sum32_3(this.h[3],pe,me),this.h[3]=sum32_3(this.h[4],ie,ye),this.h[4]=sum32_3(this.h[0],fe,xe),this.h[0]=Be};RIPEMD160$1.prototype._digest=function(t){return t==="hex"?utils$g.toHex32(this.h,"little"):utils$g.split32(this.h,"little")};function f$2(c,t,n,ie){return c<=15?t^n^ie:c<=31?t&n|~t&ie:c<=47?(t|~n)^ie:c<=63?t&ie|n&~ie:t^(n|~ie)}function K$3(c){return c<=15?0:c<=31?1518500249:c<=47?1859775393:c<=63?2400959708:2840853838}function Kh(c){return c<=15?1352829926:c<=31?1548603684:c<=47?1836072691:c<=63?2053994217:0}var r$1=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],rh=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],s$2=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],sh=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],utils$f=utils$o,assert$c=minimalisticAssert$1;function Hmac(c,t,n){if(!(this instanceof Hmac))return new Hmac(c,t,n);this.Hash=c,this.blockSize=c.blockSize/8,this.outSize=c.outSize/8,this.inner=null,this.outer=null,this._init(utils$f.toArray(t,n))}var hmac$1=Hmac;Hmac.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),assert$c(t.length<=this.blockSize);for(var n=t.length;n<this.blockSize;n++)t.push(0);for(n=0;n<t.length;n++)t[n]^=54;for(this.inner=new this.Hash().update(t),n=0;n<t.length;n++)t[n]^=106;this.outer=new this.Hash().update(t)};Hmac.prototype.update=function(t,n){return this.inner.update(t,n),this};Hmac.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};(function(c){var t=c;t.utils=utils$o,t.common=common$6,t.sha=sha$1,t.ripemd=ripemd,t.hmac=hmac$1,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160})(hash$4);const hash$3=getDefaultExportFromCjs$2(hash$4);function createCommonjsModule(c,t,n){return n={path:t,exports:{},require:function(ie,fe){return commonjsRequire$1(ie,fe??n.path)}},c(n,n.exports),n.exports}function commonjsRequire$1(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var minimalisticAssert=assert$b;function assert$b(c,t){if(!c)throw new Error(t||"Assertion failed")}assert$b.equal=function(t,n,ie){if(t!=n)throw new Error(ie||"Assertion failed: "+t+" != "+n)};var utils_1$7=createCommonjsModule(function(c,t){var n=t;function ie(le,pe){if(Array.isArray(le))return le.slice();if(!le)return[];var me=[];if(typeof le!="string"){for(var ye=0;ye<le.length;ye++)me[ye]=le[ye]|0;return me}if(pe==="hex"){le=le.replace(/[^a-z0-9]+/ig,""),le.length%2!==0&&(le="0"+le);for(var ye=0;ye<le.length;ye+=2)me.push(parseInt(le[ye]+le[ye+1],16))}else for(var ye=0;ye<le.length;ye++){var xe=le.charCodeAt(ye),Ee=xe>>8,Se=xe&255;Ee?me.push(Ee,Se):me.push(Se)}return me}n.toArray=ie;function fe(le){return le.length===1?"0"+le:le}n.zero2=fe;function ae(le){for(var pe="",me=0;me<le.length;me++)pe+=fe(le[me].toString(16));return pe}n.toHex=ae,n.encode=function(pe,me){return me==="hex"?ae(pe):pe}}),utils_1$1$1=createCommonjsModule(function(c,t){var n=t;n.assert=minimalisticAssert,n.toArray=utils_1$7.toArray,n.zero2=utils_1$7.zero2,n.toHex=utils_1$7.toHex,n.encode=utils_1$7.encode;function ie(me,ye,xe){var Ee=new Array(Math.max(me.bitLength(),xe)+1),Se;for(Se=0;Se<Ee.length;Se+=1)Ee[Se]=0;var Me=1<<ye+1,Be=me.clone();for(Se=0;Se<Ee.length;Se++){var $e,ke=Be.andln(Me-1);Be.isOdd()?(ke>(Me>>1)-1?$e=(Me>>1)-ke:$e=ke,Be.isubn($e)):$e=0,Ee[Se]=$e,Be.iushrn(1)}return Ee}n.getNAF=ie;function fe(me,ye){var xe=[[],[]];me=me.clone(),ye=ye.clone();for(var Ee=0,Se=0,Me;me.cmpn(-Ee)>0||ye.cmpn(-Se)>0;){var Be=me.andln(3)+Ee&3,$e=ye.andln(3)+Se&3;Be===3&&(Be=-1),$e===3&&($e=-1);var ke;Be&1?(Me=me.andln(7)+Ee&7,(Me===3||Me===5)&&$e===2?ke=-Be:ke=Be):ke=0,xe[0].push(ke);var Te;$e&1?(Me=ye.andln(7)+Se&7,(Me===3||Me===5)&&Be===2?Te=-$e:Te=$e):Te=0,xe[1].push(Te),2*Ee===ke+1&&(Ee=1-Ee),2*Se===Te+1&&(Se=1-Se),me.iushrn(1),ye.iushrn(1)}return xe}n.getJSF=fe;function ae(me,ye,xe){var Ee="_"+ye;me.prototype[ye]=function(){return this[Ee]!==void 0?this[Ee]:this[Ee]=xe.call(this)}}n.cachedProperty=ae;function le(me){return typeof me=="string"?n.toArray(me,"hex"):me}n.parseBytes=le;function pe(me){return new BN$8(me,"hex","le")}n.intFromLE=pe}),getNAF$1=utils_1$1$1.getNAF,getJSF$1=utils_1$1$1.getJSF,assert$1$1=utils_1$1$1.assert;function BaseCurve$1(c,t){this.type=c,this.p=new BN$8(t.p,16),this.red=t.prime?BN$8.red(t.prime):BN$8.mont(this.p),this.zero=new BN$8(0).toRed(this.red),this.one=new BN$8(1).toRed(this.red),this.two=new BN$8(2).toRed(this.red),this.n=t.n&&new BN$8(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var base$5=BaseCurve$1;BaseCurve$1.prototype.point=function(){throw new Error("Not implemented")};BaseCurve$1.prototype.validate=function(){throw new Error("Not implemented")};BaseCurve$1.prototype._fixedNafMul=function(t,n){assert$1$1(t.precomputed);var ie=t._getDoubles(),fe=getNAF$1(n,1,this._bitLength),ae=(1<<ie.step+1)-(ie.step%2===0?2:1);ae/=3;var le=[],pe,me;for(pe=0;pe<fe.length;pe+=ie.step){me=0;for(var ye=pe+ie.step-1;ye>=pe;ye--)me=(me<<1)+fe[ye];le.push(me)}for(var xe=this.jpoint(null,null,null),Ee=this.jpoint(null,null,null),Se=ae;Se>0;Se--){for(pe=0;pe<le.length;pe++)me=le[pe],me===Se?Ee=Ee.mixedAdd(ie.points[pe]):me===-Se&&(Ee=Ee.mixedAdd(ie.points[pe].neg()));xe=xe.add(Ee)}return xe.toP()};BaseCurve$1.prototype._wnafMul=function(t,n){var ie=4,fe=t._getNAFPoints(ie);ie=fe.wnd;for(var ae=fe.points,le=getNAF$1(n,ie,this._bitLength),pe=this.jpoint(null,null,null),me=le.length-1;me>=0;me--){for(var ye=0;me>=0&&le[me]===0;me--)ye++;if(me>=0&&ye++,pe=pe.dblp(ye),me<0)break;var xe=le[me];assert$1$1(xe!==0),t.type==="affine"?xe>0?pe=pe.mixedAdd(ae[xe-1>>1]):pe=pe.mixedAdd(ae[-xe-1>>1].neg()):xe>0?pe=pe.add(ae[xe-1>>1]):pe=pe.add(ae[-xe-1>>1].neg())}return t.type==="affine"?pe.toP():pe};BaseCurve$1.prototype._wnafMulAdd=function(t,n,ie,fe,ae){var le=this._wnafT1,pe=this._wnafT2,me=this._wnafT3,ye=0,xe,Ee,Se;for(xe=0;xe<fe;xe++){Se=n[xe];var Me=Se._getNAFPoints(t);le[xe]=Me.wnd,pe[xe]=Me.points}for(xe=fe-1;xe>=1;xe-=2){var Be=xe-1,$e=xe;if(le[Be]!==1||le[$e]!==1){me[Be]=getNAF$1(ie[Be],le[Be],this._bitLength),me[$e]=getNAF$1(ie[$e],le[$e],this._bitLength),ye=Math.max(me[Be].length,ye),ye=Math.max(me[$e].length,ye);continue}var ke=[n[Be],null,null,n[$e]];n[Be].y.cmp(n[$e].y)===0?(ke[1]=n[Be].add(n[$e]),ke[2]=n[Be].toJ().mixedAdd(n[$e].neg())):n[Be].y.cmp(n[$e].y.redNeg())===0?(ke[1]=n[Be].toJ().mixedAdd(n[$e]),ke[2]=n[Be].add(n[$e].neg())):(ke[1]=n[Be].toJ().mixedAdd(n[$e]),ke[2]=n[Be].toJ().mixedAdd(n[$e].neg()));var Te=[-3,-1,-5,-7,0,7,5,1,3],Ie=getJSF$1(ie[Be],ie[$e]);for(ye=Math.max(Ie[0].length,ye),me[Be]=new Array(ye),me[$e]=new Array(ye),Ee=0;Ee<ye;Ee++){var Fe=Ie[0][Ee]|0,Le=Ie[1][Ee]|0;me[Be][Ee]=Te[(Fe+1)*3+(Le+1)],me[$e][Ee]=0,pe[Be]=ke}}var He=this.jpoint(null,null,null),ze=this._wnafT4;for(xe=ye;xe>=0;xe--){for(var Je=0;xe>=0;){var Xe=!0;for(Ee=0;Ee<fe;Ee++)ze[Ee]=me[Ee][xe]|0,ze[Ee]!==0&&(Xe=!1);if(!Xe)break;Je++,xe--}if(xe>=0&&Je++,He=He.dblp(Je),xe<0)break;for(Ee=0;Ee<fe;Ee++){var Ue=ze[Ee];Ue!==0&&(Ue>0?Se=pe[Ee][Ue-1>>1]:Ue<0&&(Se=pe[Ee][-Ue-1>>1].neg()),Se.type==="affine"?He=He.mixedAdd(Se):He=He.add(Se))}}for(xe=0;xe<fe;xe++)pe[xe]=null;return ae?He:He.toP()};function BasePoint$1(c,t){this.curve=c,this.type=t,this.precomputed=null}BaseCurve$1.BasePoint=BasePoint$1;BasePoint$1.prototype.eq=function(){throw new Error("Not implemented")};BasePoint$1.prototype.validate=function(){return this.curve.validate(this)};BaseCurve$1.prototype.decodePoint=function(t,n){t=utils_1$1$1.toArray(t,n);var ie=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*ie){t[0]===6?assert$1$1(t[t.length-1]%2===0):t[0]===7&&assert$1$1(t[t.length-1]%2===1);var fe=this.point(t.slice(1,1+ie),t.slice(1+ie,1+2*ie));return fe}else if((t[0]===2||t[0]===3)&&t.length-1===ie)return this.pointFromX(t.slice(1,1+ie),t[0]===3);throw new Error("Unknown point format")};BasePoint$1.prototype.encodeCompressed=function(t){return this.encode(t,!0)};BasePoint$1.prototype._encode=function(t){var n=this.curve.p.byteLength(),ie=this.getX().toArray("be",n);return t?[this.getY().isEven()?2:3].concat(ie):[4].concat(ie,this.getY().toArray("be",n))};BasePoint$1.prototype.encode=function(t,n){return utils_1$1$1.encode(this._encode(n),t)};BasePoint$1.prototype.precompute=function(t){if(this.precomputed)return this;var n={doubles:null,naf:null,beta:null};return n.naf=this._getNAFPoints(8),n.doubles=this._getDoubles(4,t),n.beta=this._getBeta(),this.precomputed=n,this};BasePoint$1.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var n=this.precomputed.doubles;return n?n.points.length>=Math.ceil((t.bitLength()+1)/n.step):!1};BasePoint$1.prototype._getDoubles=function(t,n){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var ie=[this],fe=this,ae=0;ae<n;ae+=t){for(var le=0;le<t;le++)fe=fe.dbl();ie.push(fe)}return{step:t,points:ie}};BasePoint$1.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var n=[this],ie=(1<<t)-1,fe=ie===1?null:this.dbl(),ae=1;ae<ie;ae++)n[ae]=n[ae-1].add(fe);return{wnd:t,points:n}};BasePoint$1.prototype._getBeta=function(){return null};BasePoint$1.prototype.dblp=function(t){for(var n=this,ie=0;ie<t;ie++)n=n.dbl();return n};var inherits_browser=createCommonjsModule(function(c){typeof Object.create=="function"?c.exports=function(n,ie){ie&&(n.super_=ie,n.prototype=Object.create(ie.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}))}:c.exports=function(n,ie){if(ie){n.super_=ie;var fe=function(){};fe.prototype=ie.prototype,n.prototype=new fe,n.prototype.constructor=n}}}),assert$2$1=utils_1$1$1.assert;function ShortCurve$1(c){base$5.call(this,"short",c),this.a=new BN$8(c.a,16).toRed(this.red),this.b=new BN$8(c.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(c),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}inherits_browser(ShortCurve$1,base$5);var short_1=ShortCurve$1;ShortCurve$1.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var n,ie;if(t.beta)n=new BN$8(t.beta,16).toRed(this.red);else{var fe=this._getEndoRoots(this.p);n=fe[0].cmp(fe[1])<0?fe[0]:fe[1],n=n.toRed(this.red)}if(t.lambda)ie=new BN$8(t.lambda,16);else{var ae=this._getEndoRoots(this.n);this.g.mul(ae[0]).x.cmp(this.g.x.redMul(n))===0?ie=ae[0]:(ie=ae[1],assert$2$1(this.g.mul(ie).x.cmp(this.g.x.redMul(n))===0))}var le;return t.basis?le=t.basis.map(function(pe){return{a:new BN$8(pe.a,16),b:new BN$8(pe.b,16)}}):le=this._getEndoBasis(ie),{beta:n,lambda:ie,basis:le}}};ShortCurve$1.prototype._getEndoRoots=function(t){var n=t===this.p?this.red:BN$8.mont(t),ie=new BN$8(2).toRed(n).redInvm(),fe=ie.redNeg(),ae=new BN$8(3).toRed(n).redNeg().redSqrt().redMul(ie),le=fe.redAdd(ae).fromRed(),pe=fe.redSub(ae).fromRed();return[le,pe]};ShortCurve$1.prototype._getEndoBasis=function(t){for(var n=this.n.ushrn(Math.floor(this.n.bitLength()/2)),ie=t,fe=this.n.clone(),ae=new BN$8(1),le=new BN$8(0),pe=new BN$8(0),me=new BN$8(1),ye,xe,Ee,Se,Me,Be,$e,ke=0,Te,Ie;ie.cmpn(0)!==0;){var Fe=fe.div(ie);Te=fe.sub(Fe.mul(ie)),Ie=pe.sub(Fe.mul(ae));var Le=me.sub(Fe.mul(le));if(!Ee&&Te.cmp(n)<0)ye=$e.neg(),xe=ae,Ee=Te.neg(),Se=Ie;else if(Ee&&++ke===2)break;$e=Te,fe=ie,ie=Te,pe=ae,ae=Ie,me=le,le=Le}Me=Te.neg(),Be=Ie;var He=Ee.sqr().add(Se.sqr()),ze=Me.sqr().add(Be.sqr());return ze.cmp(He)>=0&&(Me=ye,Be=xe),Ee.negative&&(Ee=Ee.neg(),Se=Se.neg()),Me.negative&&(Me=Me.neg(),Be=Be.neg()),[{a:Ee,b:Se},{a:Me,b:Be}]};ShortCurve$1.prototype._endoSplit=function(t){var n=this.endo.basis,ie=n[0],fe=n[1],ae=fe.b.mul(t).divRound(this.n),le=ie.b.neg().mul(t).divRound(this.n),pe=ae.mul(ie.a),me=le.mul(fe.a),ye=ae.mul(ie.b),xe=le.mul(fe.b),Ee=t.sub(pe).sub(me),Se=ye.add(xe).neg();return{k1:Ee,k2:Se}};ShortCurve$1.prototype.pointFromX=function(t,n){t=new BN$8(t,16),t.red||(t=t.toRed(this.red));var ie=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),fe=ie.redSqrt();if(fe.redSqr().redSub(ie).cmp(this.zero)!==0)throw new Error("invalid point");var ae=fe.fromRed().isOdd();return(n&&!ae||!n&&ae)&&(fe=fe.redNeg()),this.point(t,fe)};ShortCurve$1.prototype.validate=function(t){if(t.inf)return!0;var n=t.x,ie=t.y,fe=this.a.redMul(n),ae=n.redSqr().redMul(n).redIAdd(fe).redIAdd(this.b);return ie.redSqr().redISub(ae).cmpn(0)===0};ShortCurve$1.prototype._endoWnafMulAdd=function(t,n,ie){for(var fe=this._endoWnafT1,ae=this._endoWnafT2,le=0;le<t.length;le++){var pe=this._endoSplit(n[le]),me=t[le],ye=me._getBeta();pe.k1.negative&&(pe.k1.ineg(),me=me.neg(!0)),pe.k2.negative&&(pe.k2.ineg(),ye=ye.neg(!0)),fe[le*2]=me,fe[le*2+1]=ye,ae[le*2]=pe.k1,ae[le*2+1]=pe.k2}for(var xe=this._wnafMulAdd(1,fe,ae,le*2,ie),Ee=0;Ee<le*2;Ee++)fe[Ee]=null,ae[Ee]=null;return xe};function Point$3(c,t,n,ie){base$5.BasePoint.call(this,c,"affine"),t===null&&n===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new BN$8(t,16),this.y=new BN$8(n,16),ie&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}inherits_browser(Point$3,base$5.BasePoint);ShortCurve$1.prototype.point=function(t,n,ie){return new Point$3(this,t,n,ie)};ShortCurve$1.prototype.pointFromJSON=function(t,n){return Point$3.fromJSON(this,t,n)};Point$3.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var n=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var ie=this.curve,fe=function(ae){return ie.point(ae.x.redMul(ie.endo.beta),ae.y)};t.beta=n,n.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(fe)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(fe)}}}return n}};Point$3.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};Point$3.fromJSON=function(t,n,ie){typeof n=="string"&&(n=JSON.parse(n));var fe=t.point(n[0],n[1],ie);if(!n[2])return fe;function ae(pe){return t.point(pe[0],pe[1],ie)}var le=n[2];return fe.precomputed={beta:null,doubles:le.doubles&&{step:le.doubles.step,points:[fe].concat(le.doubles.points.map(ae))},naf:le.naf&&{wnd:le.naf.wnd,points:[fe].concat(le.naf.points.map(ae))}},fe};Point$3.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Point$3.prototype.isInfinity=function(){return this.inf};Point$3.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var n=this.y.redSub(t.y);n.cmpn(0)!==0&&(n=n.redMul(this.x.redSub(t.x).redInvm()));var ie=n.redSqr().redISub(this.x).redISub(t.x),fe=n.redMul(this.x.redSub(ie)).redISub(this.y);return this.curve.point(ie,fe)};Point$3.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var n=this.curve.a,ie=this.x.redSqr(),fe=t.redInvm(),ae=ie.redAdd(ie).redIAdd(ie).redIAdd(n).redMul(fe),le=ae.redSqr().redISub(this.x.redAdd(this.x)),pe=ae.redMul(this.x.redSub(le)).redISub(this.y);return this.curve.point(le,pe)};Point$3.prototype.getX=function(){return this.x.fromRed()};Point$3.prototype.getY=function(){return this.y.fromRed()};Point$3.prototype.mul=function(t){return t=new BN$8(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)};Point$3.prototype.mulAdd=function(t,n,ie){var fe=[this,n],ae=[t,ie];return this.curve.endo?this.curve._endoWnafMulAdd(fe,ae):this.curve._wnafMulAdd(1,fe,ae,2)};Point$3.prototype.jmulAdd=function(t,n,ie){var fe=[this,n],ae=[t,ie];return this.curve.endo?this.curve._endoWnafMulAdd(fe,ae,!0):this.curve._wnafMulAdd(1,fe,ae,2,!0)};Point$3.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)};Point$3.prototype.neg=function(t){if(this.inf)return this;var n=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var ie=this.precomputed,fe=function(ae){return ae.neg()};n.precomputed={naf:ie.naf&&{wnd:ie.naf.wnd,points:ie.naf.points.map(fe)},doubles:ie.doubles&&{step:ie.doubles.step,points:ie.doubles.points.map(fe)}}}return n};Point$3.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function JPoint$1(c,t,n,ie){base$5.BasePoint.call(this,c,"jacobian"),t===null&&n===null&&ie===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new BN$8(0)):(this.x=new BN$8(t,16),this.y=new BN$8(n,16),this.z=new BN$8(ie,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}inherits_browser(JPoint$1,base$5.BasePoint);ShortCurve$1.prototype.jpoint=function(t,n,ie){return new JPoint$1(this,t,n,ie)};JPoint$1.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),n=t.redSqr(),ie=this.x.redMul(n),fe=this.y.redMul(n).redMul(t);return this.curve.point(ie,fe)};JPoint$1.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};JPoint$1.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var n=t.z.redSqr(),ie=this.z.redSqr(),fe=this.x.redMul(n),ae=t.x.redMul(ie),le=this.y.redMul(n.redMul(t.z)),pe=t.y.redMul(ie.redMul(this.z)),me=fe.redSub(ae),ye=le.redSub(pe);if(me.cmpn(0)===0)return ye.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var xe=me.redSqr(),Ee=xe.redMul(me),Se=fe.redMul(xe),Me=ye.redSqr().redIAdd(Ee).redISub(Se).redISub(Se),Be=ye.redMul(Se.redISub(Me)).redISub(le.redMul(Ee)),$e=this.z.redMul(t.z).redMul(me);return this.curve.jpoint(Me,Be,$e)};JPoint$1.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var n=this.z.redSqr(),ie=this.x,fe=t.x.redMul(n),ae=this.y,le=t.y.redMul(n).redMul(this.z),pe=ie.redSub(fe),me=ae.redSub(le);if(pe.cmpn(0)===0)return me.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ye=pe.redSqr(),xe=ye.redMul(pe),Ee=ie.redMul(ye),Se=me.redSqr().redIAdd(xe).redISub(Ee).redISub(Ee),Me=me.redMul(Ee.redISub(Se)).redISub(ae.redMul(xe)),Be=this.z.redMul(pe);return this.curve.jpoint(Se,Me,Be)};JPoint$1.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var n;if(this.curve.zeroA||this.curve.threeA){var ie=this;for(n=0;n<t;n++)ie=ie.dbl();return ie}var fe=this.curve.a,ae=this.curve.tinv,le=this.x,pe=this.y,me=this.z,ye=me.redSqr().redSqr(),xe=pe.redAdd(pe);for(n=0;n<t;n++){var Ee=le.redSqr(),Se=xe.redSqr(),Me=Se.redSqr(),Be=Ee.redAdd(Ee).redIAdd(Ee).redIAdd(fe.redMul(ye)),$e=le.redMul(Se),ke=Be.redSqr().redISub($e.redAdd($e)),Te=$e.redISub(ke),Ie=Be.redMul(Te);Ie=Ie.redIAdd(Ie).redISub(Me);var Fe=xe.redMul(me);n+1<t&&(ye=ye.redMul(Me)),le=ke,me=Fe,xe=Ie}return this.curve.jpoint(le,xe.redMul(ae),me)};JPoint$1.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};JPoint$1.prototype._zeroDbl=function(){var t,n,ie;if(this.zOne){var fe=this.x.redSqr(),ae=this.y.redSqr(),le=ae.redSqr(),pe=this.x.redAdd(ae).redSqr().redISub(fe).redISub(le);pe=pe.redIAdd(pe);var me=fe.redAdd(fe).redIAdd(fe),ye=me.redSqr().redISub(pe).redISub(pe),xe=le.redIAdd(le);xe=xe.redIAdd(xe),xe=xe.redIAdd(xe),t=ye,n=me.redMul(pe.redISub(ye)).redISub(xe),ie=this.y.redAdd(this.y)}else{var Ee=this.x.redSqr(),Se=this.y.redSqr(),Me=Se.redSqr(),Be=this.x.redAdd(Se).redSqr().redISub(Ee).redISub(Me);Be=Be.redIAdd(Be);var $e=Ee.redAdd(Ee).redIAdd(Ee),ke=$e.redSqr(),Te=Me.redIAdd(Me);Te=Te.redIAdd(Te),Te=Te.redIAdd(Te),t=ke.redISub(Be).redISub(Be),n=$e.redMul(Be.redISub(t)).redISub(Te),ie=this.y.redMul(this.z),ie=ie.redIAdd(ie)}return this.curve.jpoint(t,n,ie)};JPoint$1.prototype._threeDbl=function(){var t,n,ie;if(this.zOne){var fe=this.x.redSqr(),ae=this.y.redSqr(),le=ae.redSqr(),pe=this.x.redAdd(ae).redSqr().redISub(fe).redISub(le);pe=pe.redIAdd(pe);var me=fe.redAdd(fe).redIAdd(fe).redIAdd(this.curve.a),ye=me.redSqr().redISub(pe).redISub(pe);t=ye;var xe=le.redIAdd(le);xe=xe.redIAdd(xe),xe=xe.redIAdd(xe),n=me.redMul(pe.redISub(ye)).redISub(xe),ie=this.y.redAdd(this.y)}else{var Ee=this.z.redSqr(),Se=this.y.redSqr(),Me=this.x.redMul(Se),Be=this.x.redSub(Ee).redMul(this.x.redAdd(Ee));Be=Be.redAdd(Be).redIAdd(Be);var $e=Me.redIAdd(Me);$e=$e.redIAdd($e);var ke=$e.redAdd($e);t=Be.redSqr().redISub(ke),ie=this.y.redAdd(this.z).redSqr().redISub(Se).redISub(Ee);var Te=Se.redSqr();Te=Te.redIAdd(Te),Te=Te.redIAdd(Te),Te=Te.redIAdd(Te),n=Be.redMul($e.redISub(t)).redISub(Te)}return this.curve.jpoint(t,n,ie)};JPoint$1.prototype._dbl=function(){var t=this.curve.a,n=this.x,ie=this.y,fe=this.z,ae=fe.redSqr().redSqr(),le=n.redSqr(),pe=ie.redSqr(),me=le.redAdd(le).redIAdd(le).redIAdd(t.redMul(ae)),ye=n.redAdd(n);ye=ye.redIAdd(ye);var xe=ye.redMul(pe),Ee=me.redSqr().redISub(xe.redAdd(xe)),Se=xe.redISub(Ee),Me=pe.redSqr();Me=Me.redIAdd(Me),Me=Me.redIAdd(Me),Me=Me.redIAdd(Me);var Be=me.redMul(Se).redISub(Me),$e=ie.redAdd(ie).redMul(fe);return this.curve.jpoint(Ee,Be,$e)};JPoint$1.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),n=this.y.redSqr(),ie=this.z.redSqr(),fe=n.redSqr(),ae=t.redAdd(t).redIAdd(t),le=ae.redSqr(),pe=this.x.redAdd(n).redSqr().redISub(t).redISub(fe);pe=pe.redIAdd(pe),pe=pe.redAdd(pe).redIAdd(pe),pe=pe.redISub(le);var me=pe.redSqr(),ye=fe.redIAdd(fe);ye=ye.redIAdd(ye),ye=ye.redIAdd(ye),ye=ye.redIAdd(ye);var xe=ae.redIAdd(pe).redSqr().redISub(le).redISub(me).redISub(ye),Ee=n.redMul(xe);Ee=Ee.redIAdd(Ee),Ee=Ee.redIAdd(Ee);var Se=this.x.redMul(me).redISub(Ee);Se=Se.redIAdd(Se),Se=Se.redIAdd(Se);var Me=this.y.redMul(xe.redMul(ye.redISub(xe)).redISub(pe.redMul(me)));Me=Me.redIAdd(Me),Me=Me.redIAdd(Me),Me=Me.redIAdd(Me);var Be=this.z.redAdd(pe).redSqr().redISub(ie).redISub(me);return this.curve.jpoint(Se,Me,Be)};JPoint$1.prototype.mul=function(t,n){return t=new BN$8(t,n),this.curve._wnafMul(this,t)};JPoint$1.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var n=this.z.redSqr(),ie=t.z.redSqr();if(this.x.redMul(ie).redISub(t.x.redMul(n)).cmpn(0)!==0)return!1;var fe=n.redMul(this.z),ae=ie.redMul(t.z);return this.y.redMul(ae).redISub(t.y.redMul(fe)).cmpn(0)===0};JPoint$1.prototype.eqXToP=function(t){var n=this.z.redSqr(),ie=t.toRed(this.curve.red).redMul(n);if(this.x.cmp(ie)===0)return!0;for(var fe=t.clone(),ae=this.curve.redN.redMul(n);;){if(fe.iadd(this.curve.n),fe.cmp(this.curve.p)>=0)return!1;if(ie.redIAdd(ae),this.x.cmp(ie)===0)return!0}};JPoint$1.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};JPoint$1.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var curve_1=createCommonjsModule(function(c,t){var n=t;n.base=base$5,n.short=short_1,n.mont=null,n.edwards=null}),curves_1=createCommonjsModule(function(c,t){var n=t,ie=utils_1$1$1.assert;function fe(pe){pe.type==="short"?this.curve=new curve_1.short(pe):pe.type==="edwards"?this.curve=new curve_1.edwards(pe):this.curve=new curve_1.mont(pe),this.g=this.curve.g,this.n=this.curve.n,this.hash=pe.hash,ie(this.g.validate(),"Invalid curve"),ie(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}n.PresetCurve=fe;function ae(pe,me){Object.defineProperty(n,pe,{configurable:!0,enumerable:!0,get:function(){var ye=new fe(me);return Object.defineProperty(n,pe,{configurable:!0,enumerable:!0,value:ye}),ye}})}ae("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:hash$3.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),ae("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:hash$3.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),ae("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:hash$3.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),ae("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:hash$3.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),ae("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:hash$3.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),ae("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash$3.sha256,gRed:!1,g:["9"]}),ae("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:hash$3.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var le;try{le=null.crash()}catch{le=void 0}ae("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:hash$3.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",le]})});function HmacDRBG$1(c){if(!(this instanceof HmacDRBG$1))return new HmacDRBG$1(c);this.hash=c.hash,this.predResist=!!c.predResist,this.outLen=this.hash.outSize,this.minEntropy=c.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=utils_1$7.toArray(c.entropy,c.entropyEnc||"hex"),n=utils_1$7.toArray(c.nonce,c.nonceEnc||"hex"),ie=utils_1$7.toArray(c.pers,c.persEnc||"hex");minimalisticAssert(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,ie)}var hmacDrbg$1=HmacDRBG$1;HmacDRBG$1.prototype._init=function(t,n,ie){var fe=t.concat(n).concat(ie);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var ae=0;ae<this.V.length;ae++)this.K[ae]=0,this.V[ae]=1;this._update(fe),this._reseed=1,this.reseedInterval=281474976710656};HmacDRBG$1.prototype._hmac=function(){return new hash$3.hmac(this.hash,this.K)};HmacDRBG$1.prototype._update=function(t){var n=this._hmac().update(this.V).update([0]);t&&(n=n.update(t)),this.K=n.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())};HmacDRBG$1.prototype.reseed=function(t,n,ie,fe){typeof n!="string"&&(fe=ie,ie=n,n=null),t=utils_1$7.toArray(t,n),ie=utils_1$7.toArray(ie,fe),minimalisticAssert(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(ie||[])),this._reseed=1};HmacDRBG$1.prototype.generate=function(t,n,ie,fe){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof n!="string"&&(fe=ie,ie=n,n=null),ie&&(ie=utils_1$7.toArray(ie,fe||"hex"),this._update(ie));for(var ae=[];ae.length<t;)this.V=this._hmac().update(this.V).digest(),ae=ae.concat(this.V);var le=ae.slice(0,t);return this._update(ie),this._reseed++,utils_1$7.encode(le,n)};var assert$3$1=utils_1$1$1.assert;function KeyPair$3(c,t){this.ec=c,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var key$2=KeyPair$3;KeyPair$3.fromPublic=function(t,n,ie){return n instanceof KeyPair$3?n:new KeyPair$3(t,{pub:n,pubEnc:ie})};KeyPair$3.fromPrivate=function(t,n,ie){return n instanceof KeyPair$3?n:new KeyPair$3(t,{priv:n,privEnc:ie})};KeyPair$3.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};KeyPair$3.prototype.getPublic=function(t,n){return typeof t=="string"&&(n=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),n?this.pub.encode(n,t):this.pub};KeyPair$3.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv};KeyPair$3.prototype._importPrivate=function(t,n){this.priv=new BN$8(t,n||16),this.priv=this.priv.umod(this.ec.curve.n)};KeyPair$3.prototype._importPublic=function(t,n){if(t.x||t.y){this.ec.curve.type==="mont"?assert$3$1(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&assert$3$1(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,n)};KeyPair$3.prototype.derive=function(t){return t.validate()||assert$3$1(t.validate(),"public point not validated"),t.mul(this.priv).getX()};KeyPair$3.prototype.sign=function(t,n,ie){return this.ec.sign(t,this,n,ie)};KeyPair$3.prototype.verify=function(t,n,ie){return this.ec.verify(t,n,this,void 0,ie)};KeyPair$3.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var assert$4$1=utils_1$1$1.assert;function Signature$3(c,t){if(c instanceof Signature$3)return c;this._importDER(c,t)||(assert$4$1(c.r&&c.s,"Signature without r or s"),this.r=new BN$8(c.r,16),this.s=new BN$8(c.s,16),c.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=c.recoveryParam)}var signature$3=Signature$3;function Position$1(){this.place=0}function getLength$1(c,t){var n=c[t.place++];if(!(n&128))return n;var ie=n&15;if(ie===0||ie>4||c[t.place]===0)return!1;for(var fe=0,ae=0,le=t.place;ae<ie;ae++,le++)fe<<=8,fe|=c[le],fe>>>=0;return fe<=127?!1:(t.place=le,fe)}function rmPadding$1(c){for(var t=0,n=c.length-1;!c[t]&&!(c[t+1]&128)&&t<n;)t++;return t===0?c:c.slice(t)}Signature$3.prototype._importDER=function(t,n){t=utils_1$1$1.toArray(t,n);var ie=new Position$1;if(t[ie.place++]!==48)return!1;var fe=getLength$1(t,ie);if(fe===!1||fe+ie.place!==t.length||t[ie.place++]!==2)return!1;var ae=getLength$1(t,ie);if(ae===!1||t[ie.place]&128)return!1;var le=t.slice(ie.place,ae+ie.place);if(ie.place+=ae,t[ie.place++]!==2)return!1;var pe=getLength$1(t,ie);if(pe===!1||t.length!==pe+ie.place||t[ie.place]&128)return!1;var me=t.slice(ie.place,pe+ie.place);if(le[0]===0)if(le[1]&128)le=le.slice(1);else return!1;if(me[0]===0)if(me[1]&128)me=me.slice(1);else return!1;return this.r=new BN$8(le),this.s=new BN$8(me),this.recoveryParam=null,!0};function constructLength$1(c,t){if(t<128){c.push(t);return}var n=1+(Math.log(t)/Math.LN2>>>3);for(c.push(n|128);--n;)c.push(t>>>(n<<3)&255);c.push(t)}Signature$3.prototype.toDER=function(t){var n=this.r.toArray(),ie=this.s.toArray();for(n[0]&128&&(n=[0].concat(n)),ie[0]&128&&(ie=[0].concat(ie)),n=rmPadding$1(n),ie=rmPadding$1(ie);!ie[0]&&!(ie[1]&128);)ie=ie.slice(1);var fe=[2];constructLength$1(fe,n.length),fe=fe.concat(n),fe.push(2),constructLength$1(fe,ie.length);var ae=fe.concat(ie),le=[48];return constructLength$1(le,ae.length),le=le.concat(ae),utils_1$1$1.encode(le,t)};var rand=function(){throw new Error("unsupported")},assert$5$1=utils_1$1$1.assert;function EC(c){if(!(this instanceof EC))return new EC(c);typeof c=="string"&&(assert$5$1(Object.prototype.hasOwnProperty.call(curves_1,c),"Unknown curve "+c),c=curves_1[c]),c instanceof curves_1.PresetCurve&&(c={curve:c}),this.curve=c.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=c.curve.g,this.g.precompute(c.curve.n.bitLength()+1),this.hash=c.hash||c.curve.hash}var ec$1=EC;EC.prototype.keyPair=function(t){return new key$2(this,t)};EC.prototype.keyFromPrivate=function(t,n){return key$2.fromPrivate(this,t,n)};EC.prototype.keyFromPublic=function(t,n){return key$2.fromPublic(this,t,n)};EC.prototype.genKeyPair=function(t){t||(t={});for(var n=new hmacDrbg$1({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||rand(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),ie=this.n.byteLength(),fe=this.n.sub(new BN$8(2));;){var ae=new BN$8(n.generate(ie));if(!(ae.cmp(fe)>0))return ae.iaddn(1),this.keyFromPrivate(ae)}};EC.prototype._truncateToN=function(t,n,ie){var fe;if(BN$8.isBN(t)||typeof t=="number")t=new BN$8(t,16),fe=t.byteLength();else if(typeof t=="object")fe=t.length,t=new BN$8(t,16);else{var ae=t.toString();fe=ae.length+1>>>1,t=new BN$8(ae,16)}typeof ie!="number"&&(ie=fe*8);var le=ie-this.n.bitLength();return le>0&&(t=t.ushrn(le)),!n&&t.cmp(this.n)>=0?t.sub(this.n):t};EC.prototype.sign=function(t,n,ie,fe){if(typeof ie=="object"&&(fe=ie,ie=null),fe||(fe={}),typeof t!="string"&&typeof t!="number"&&!BN$8.isBN(t)){assert$5$1(typeof t=="object"&&t&&typeof t.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),assert$5$1(t.length>>>0===t.length);for(var ae=0;ae<t.length;ae++)assert$5$1((t[ae]&255)===t[ae])}n=this.keyFromPrivate(n,ie),t=this._truncateToN(t,!1,fe.msgBitLength),assert$5$1(!t.isNeg(),"Can not sign a negative message");var le=this.n.byteLength(),pe=n.getPrivate().toArray("be",le),me=t.toArray("be",le);assert$5$1(new BN$8(me).eq(t),"Can not sign message");for(var ye=new hmacDrbg$1({hash:this.hash,entropy:pe,nonce:me,pers:fe.pers,persEnc:fe.persEnc||"utf8"}),xe=this.n.sub(new BN$8(1)),Ee=0;;Ee++){var Se=fe.k?fe.k(Ee):new BN$8(ye.generate(this.n.byteLength()));if(Se=this._truncateToN(Se,!0),!(Se.cmpn(1)<=0||Se.cmp(xe)>=0)){var Me=this.g.mul(Se);if(!Me.isInfinity()){var Be=Me.getX(),$e=Be.umod(this.n);if($e.cmpn(0)!==0){var ke=Se.invm(this.n).mul($e.mul(n.getPrivate()).iadd(t));if(ke=ke.umod(this.n),ke.cmpn(0)!==0){var Te=(Me.getY().isOdd()?1:0)|(Be.cmp($e)!==0?2:0);return fe.canonical&&ke.cmp(this.nh)>0&&(ke=this.n.sub(ke),Te^=1),new signature$3({r:$e,s:ke,recoveryParam:Te})}}}}}};EC.prototype.verify=function(t,n,ie,fe,ae){ae||(ae={}),t=this._truncateToN(t,!1,ae.msgBitLength),ie=this.keyFromPublic(ie,fe),n=new signature$3(n,"hex");var le=n.r,pe=n.s;if(le.cmpn(1)<0||le.cmp(this.n)>=0||pe.cmpn(1)<0||pe.cmp(this.n)>=0)return!1;var me=pe.invm(this.n),ye=me.mul(t).umod(this.n),xe=me.mul(le).umod(this.n),Ee;return this.curve._maxwellTrick?(Ee=this.g.jmulAdd(ye,ie.getPublic(),xe),Ee.isInfinity()?!1:Ee.eqXToP(le)):(Ee=this.g.mulAdd(ye,ie.getPublic(),xe),Ee.isInfinity()?!1:Ee.getX().umod(this.n).cmp(le)===0)};EC.prototype.recoverPubKey=function(c,t,n,ie){assert$5$1((3&n)===n,"The recovery param is more than two bits"),t=new signature$3(t,ie);var fe=this.n,ae=new BN$8(c),le=t.r,pe=t.s,me=n&1,ye=n>>1;if(le.cmp(this.curve.p.umod(this.curve.n))>=0&&ye)throw new Error("Unable to find sencond key candinate");ye?le=this.curve.pointFromX(le.add(this.curve.n),me):le=this.curve.pointFromX(le,me);var xe=t.r.invm(fe),Ee=fe.sub(ae).mul(xe).umod(fe),Se=pe.mul(xe).umod(fe);return this.g.mulAdd(Ee,le,Se)};EC.prototype.getKeyRecoveryParam=function(c,t,n,ie){if(t=new signature$3(t,ie),t.recoveryParam!==null)return t.recoveryParam;for(var fe=0;fe<4;fe++){var ae;try{ae=this.recoverPubKey(c,t,fe)}catch{continue}if(ae.eq(n))return fe}throw new Error("Unable to find valid recovery factor")};var elliptic_1=createCommonjsModule(function(c,t){var n=t;n.version="6.6.1",n.utils=utils_1$1$1,n.rand=function(){throw new Error("unsupported")},n.curve=curve_1,n.curves=curves_1,n.ec=ec$1,n.eddsa=null}),EC$1=elliptic_1.ec;const version$j="signing-key/5.8.0",logger$h=new Logger(version$j);let _curve=null;function getCurve(){return _curve||(_curve=new EC$1("secp256k1")),_curve}class SigningKey{constructor(t){defineReadOnly(this,"curve","secp256k1"),defineReadOnly(this,"privateKey",hexlify(t)),hexDataLength(this.privateKey)!==32&&logger$h.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const n=getCurve().keyFromPrivate(arrayify(this.privateKey));defineReadOnly(this,"publicKey","0x"+n.getPublic(!1,"hex")),defineReadOnly(this,"compressedPublicKey","0x"+n.getPublic(!0,"hex")),defineReadOnly(this,"_isSigningKey",!0)}_addPoint(t){const n=getCurve().keyFromPublic(arrayify(this.publicKey)),ie=getCurve().keyFromPublic(arrayify(t));return"0x"+n.pub.add(ie.pub).encodeCompressed("hex")}signDigest(t){const n=getCurve().keyFromPrivate(arrayify(this.privateKey)),ie=arrayify(t);ie.length!==32&&logger$h.throwArgumentError("bad digest length","digest",t);const fe=n.sign(ie,{canonical:!0});return splitSignature({recoveryParam:fe.recoveryParam,r:hexZeroPad("0x"+fe.r.toString(16),32),s:hexZeroPad("0x"+fe.s.toString(16),32)})}computeSharedSecret(t){const n=getCurve().keyFromPrivate(arrayify(this.privateKey)),ie=getCurve().keyFromPublic(arrayify(computePublicKey(t)));return hexZeroPad("0x"+n.derive(ie.getPublic()).toString(16),32)}static isSigningKey(t){return!!(t&&t._isSigningKey)}}function recoverPublicKey(c,t){const n=splitSignature(t),ie={r:arrayify(n.r),s:arrayify(n.s)};return"0x"+getCurve().recoverPubKey(arrayify(c),ie,n.recoveryParam).encode("hex",!1)}function computePublicKey(c,t){const n=arrayify(c);if(n.length===32){const ie=new SigningKey(n);return t?"0x"+getCurve().keyFromPrivate(n).getPublic(!0,"hex"):ie.publicKey}else{if(n.length===33)return t?hexlify(n):"0x"+getCurve().keyFromPublic(n).getPublic(!1,"hex");if(n.length===65)return t?"0x"+getCurve().keyFromPublic(n).getPublic(!0,"hex"):hexlify(n)}return logger$h.throwArgumentError("invalid public or private key","key","[REDACTED]")}const lib_esm$a=Object.freeze(Object.defineProperty({__proto__:null,SigningKey,computePublicKey,recoverPublicKey},Symbol.toStringTag,{value:"Module"})),version$i="transactions/5.8.0",logger$g=new Logger(version$i);var TransactionTypes;(function(c){c[c.legacy=0]="legacy",c[c.eip2930=1]="eip2930",c[c.eip1559=2]="eip1559"})(TransactionTypes||(TransactionTypes={}));function handleAddress(c){return c==="0x"?null:getAddress(c)}function handleNumber(c){return c==="0x"?Zero$1:BigNumber.from(c)}const transactionFields=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],allowedTransactionKeys$1={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function computeAddress(c){const t=computePublicKey(c);return getAddress(hexDataSlice(keccak256$1(hexDataSlice(t,1)),12))}function recoverAddress(c,t){return computeAddress(recoverPublicKey(arrayify(c),t))}function formatNumber(c,t){const n=stripZeros(BigNumber.from(c).toHexString());return n.length>32&&logger$g.throwArgumentError("invalid length for "+t,"transaction:"+t,c),n}function accessSetify(c,t){return{address:getAddress(c),storageKeys:(t||[]).map((n,ie)=>(hexDataLength(n)!==32&&logger$g.throwArgumentError("invalid access list storageKey",`accessList[${c}:${ie}]`,n),n.toLowerCase()))}}function accessListify(c){if(Array.isArray(c))return c.map((n,ie)=>Array.isArray(n)?(n.length>2&&logger$g.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${ie}]`,n),accessSetify(n[0],n[1])):accessSetify(n.address,n.storageKeys));const t=Object.keys(c).map(n=>{const ie=c[n].reduce((fe,ae)=>(fe[ae]=!0,fe),{});return accessSetify(n,Object.keys(ie).sort())});return t.sort((n,ie)=>n.address.localeCompare(ie.address)),t}function formatAccessList(c){return accessListify(c).map(t=>[t.address,t.storageKeys])}function _serializeEip1559(c,t){if(c.gasPrice!=null){const ie=BigNumber.from(c.gasPrice),fe=BigNumber.from(c.maxFeePerGas||0);ie.eq(fe)||logger$g.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:ie,maxFeePerGas:fe})}const n=[formatNumber(c.chainId||0,"chainId"),formatNumber(c.nonce||0,"nonce"),formatNumber(c.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),formatNumber(c.maxFeePerGas||0,"maxFeePerGas"),formatNumber(c.gasLimit||0,"gasLimit"),c.to!=null?getAddress(c.to):"0x",formatNumber(c.value||0,"value"),c.data||"0x",formatAccessList(c.accessList||[])];if(t){const ie=splitSignature(t);n.push(formatNumber(ie.recoveryParam,"recoveryParam")),n.push(stripZeros(ie.r)),n.push(stripZeros(ie.s))}return hexConcat(["0x02",encode$a(n)])}function _serializeEip2930(c,t){const n=[formatNumber(c.chainId||0,"chainId"),formatNumber(c.nonce||0,"nonce"),formatNumber(c.gasPrice||0,"gasPrice"),formatNumber(c.gasLimit||0,"gasLimit"),c.to!=null?getAddress(c.to):"0x",formatNumber(c.value||0,"value"),c.data||"0x",formatAccessList(c.accessList||[])];if(t){const ie=splitSignature(t);n.push(formatNumber(ie.recoveryParam,"recoveryParam")),n.push(stripZeros(ie.r)),n.push(stripZeros(ie.s))}return hexConcat(["0x01",encode$a(n)])}function _serialize(c,t){checkProperties(c,allowedTransactionKeys$1);const n=[];transactionFields.forEach(function(le){let pe=c[le.name]||[];const me={};le.numeric&&(me.hexPad="left"),pe=arrayify(hexlify(pe,me)),le.length&&pe.length!==le.length&&pe.length>0&&logger$g.throwArgumentError("invalid length for "+le.name,"transaction:"+le.name,pe),le.maxLength&&(pe=stripZeros(pe),pe.length>le.maxLength&&logger$g.throwArgumentError("invalid length for "+le.name,"transaction:"+le.name,pe)),n.push(hexlify(pe))});let ie=0;if(c.chainId!=null?(ie=c.chainId,typeof ie!="number"&&logger$g.throwArgumentError("invalid transaction.chainId","transaction",c)):t&&!isBytesLike(t)&&t.v>28&&(ie=Math.floor((t.v-35)/2)),ie!==0&&(n.push(hexlify(ie)),n.push("0x"),n.push("0x")),!t)return encode$a(n);const fe=splitSignature(t);let ae=27+fe.recoveryParam;return ie!==0?(n.pop(),n.pop(),n.pop(),ae+=ie*2+8,fe.v>28&&fe.v!==ae&&logger$g.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):fe.v!==ae&&logger$g.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),n.push(hexlify(ae)),n.push(stripZeros(arrayify(fe.r))),n.push(stripZeros(arrayify(fe.s))),encode$a(n)}function serialize$1(c,t){if(c.type==null||c.type===0)return c.accessList!=null&&logger$g.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",c),_serialize(c,t);switch(c.type){case 1:return _serializeEip2930(c,t);case 2:return _serializeEip1559(c,t)}return logger$g.throwError(`unsupported transaction type: ${c.type}`,Logger.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:c.type})}function _parseEipSignature(c,t,n){try{const ie=handleNumber(t[0]).toNumber();if(ie!==0&&ie!==1)throw new Error("bad recid");c.v=ie}catch{logger$g.throwArgumentError("invalid v for transaction type: 1","v",t[0])}c.r=hexZeroPad(t[1],32),c.s=hexZeroPad(t[2],32);try{const ie=keccak256$1(n(c));c.from=recoverAddress(ie,{r:c.r,s:c.s,recoveryParam:c.v})}catch{}}function _parseEip1559(c){const t=decode$b(c.slice(1));t.length!==9&&t.length!==12&&logger$g.throwArgumentError("invalid component count for transaction type: 2","payload",hexlify(c));const n=handleNumber(t[2]),ie=handleNumber(t[3]),fe={type:2,chainId:handleNumber(t[0]).toNumber(),nonce:handleNumber(t[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:ie,gasPrice:null,gasLimit:handleNumber(t[4]),to:handleAddress(t[5]),value:handleNumber(t[6]),data:t[7],accessList:accessListify(t[8])};return t.length===9||(fe.hash=keccak256$1(c),_parseEipSignature(fe,t.slice(9),_serializeEip1559)),fe}function _parseEip2930(c){const t=decode$b(c.slice(1));t.length!==8&&t.length!==11&&logger$g.throwArgumentError("invalid component count for transaction type: 1","payload",hexlify(c));const n={type:1,chainId:handleNumber(t[0]).toNumber(),nonce:handleNumber(t[1]).toNumber(),gasPrice:handleNumber(t[2]),gasLimit:handleNumber(t[3]),to:handleAddress(t[4]),value:handleNumber(t[5]),data:t[6],accessList:accessListify(t[7])};return t.length===8||(n.hash=keccak256$1(c),_parseEipSignature(n,t.slice(8),_serializeEip2930)),n}function _parse(c){const t=decode$b(c);t.length!==9&&t.length!==6&&logger$g.throwArgumentError("invalid raw transaction","rawTransaction",c);const n={nonce:handleNumber(t[0]).toNumber(),gasPrice:handleNumber(t[1]),gasLimit:handleNumber(t[2]),to:handleAddress(t[3]),value:handleNumber(t[4]),data:t[5],chainId:0};if(t.length===6)return n;try{n.v=BigNumber.from(t[6]).toNumber()}catch{return n}if(n.r=hexZeroPad(t[7],32),n.s=hexZeroPad(t[8],32),BigNumber.from(n.r).isZero()&&BigNumber.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let ie=n.v-27;const fe=t.slice(0,6);n.chainId!==0&&(fe.push(hexlify(n.chainId)),fe.push("0x"),fe.push("0x"),ie-=n.chainId*2+8);const ae=keccak256$1(encode$a(fe));try{n.from=recoverAddress(ae,{r:hexlify(n.r),s:hexlify(n.s),recoveryParam:ie})}catch{}n.hash=keccak256$1(c)}return n.type=null,n}function parse$2(c){const t=arrayify(c);if(t[0]>127)return _parse(t);switch(t[0]){case 1:return _parseEip2930(t);case 2:return _parseEip1559(t)}return logger$g.throwError(`unsupported transaction type: ${t[0]}`,Logger.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}const lib_esm$9=Object.freeze(Object.defineProperty({__proto__:null,get TransactionTypes(){return TransactionTypes},accessListify,computeAddress,parse:parse$2,recoverAddress,serialize:serialize$1},Symbol.toStringTag,{value:"Module"})),version$h="contracts/5.8.0";var __awaiter$h=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$f=new Logger(version$h);function resolveName(c,t){return __awaiter$h(this,void 0,void 0,function*(){const n=yield t;typeof n!="string"&&logger$f.throwArgumentError("invalid address or ENS name","name",n);try{return getAddress(n)}catch{}c||logger$f.throwError("a provider or signer is needed to resolve ENS names",Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const ie=yield c.resolveName(n);return ie==null&&logger$f.throwArgumentError("resolver or addr is not configured for ENS name","name",n),ie})}function resolveAddresses(c,t,n){return __awaiter$h(this,void 0,void 0,function*(){return Array.isArray(n)?yield Promise.all(n.map((ie,fe)=>resolveAddresses(c,Array.isArray(t)?t[fe]:t[ie.name],ie))):n.type==="address"?yield resolveName(c,t):n.type==="tuple"?yield resolveAddresses(c,t,n.components):n.baseType==="array"?Array.isArray(t)?yield Promise.all(t.map(ie=>resolveAddresses(c,ie,n.arrayChildren))):Promise.reject(logger$f.makeError("invalid value for array",Logger.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t})}function populateTransaction(c,t,n){return __awaiter$h(this,void 0,void 0,function*(){let ie={};n.length===t.inputs.length+1&&typeof n[n.length-1]=="object"&&(ie=shallowCopy(n.pop())),logger$f.checkArgumentCount(n.length,t.inputs.length,"passed to contract"),c.signer?ie.from?ie.from=resolveProperties({override:resolveName(c.signer,ie.from),signer:c.signer.getAddress()}).then(ye=>__awaiter$h(this,void 0,void 0,function*(){return getAddress(ye.signer)!==ye.override&&logger$f.throwError("Contract with a Signer cannot override from",Logger.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),ye.override})):ie.from=c.signer.getAddress():ie.from&&(ie.from=resolveName(c.provider,ie.from));const fe=yield resolveProperties({args:resolveAddresses(c.signer||c.provider,n,t.inputs),address:c.resolvedAddress,overrides:resolveProperties(ie)||{}}),ae=c.interface.encodeFunctionData(t,fe.args),le={data:ae,to:fe.address},pe=fe.overrides;if(pe.nonce!=null&&(le.nonce=BigNumber.from(pe.nonce).toNumber()),pe.gasLimit!=null&&(le.gasLimit=BigNumber.from(pe.gasLimit)),pe.gasPrice!=null&&(le.gasPrice=BigNumber.from(pe.gasPrice)),pe.maxFeePerGas!=null&&(le.maxFeePerGas=BigNumber.from(pe.maxFeePerGas)),pe.maxPriorityFeePerGas!=null&&(le.maxPriorityFeePerGas=BigNumber.from(pe.maxPriorityFeePerGas)),pe.from!=null&&(le.from=pe.from),pe.type!=null&&(le.type=pe.type),pe.accessList!=null&&(le.accessList=accessListify(pe.accessList)),le.gasLimit==null&&t.gas!=null){let ye=21e3;const xe=arrayify(ae);for(let Ee=0;Ee<xe.length;Ee++)ye+=4,xe[Ee]&&(ye+=64);le.gasLimit=BigNumber.from(t.gas).add(ye)}if(pe.value){const ye=BigNumber.from(pe.value);!ye.isZero()&&!t.payable&&logger$f.throwError("non-payable method cannot override value",Logger.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:ie.value}),le.value=ye}pe.customData&&(le.customData=shallowCopy(pe.customData)),pe.ccipReadEnabled&&(le.ccipReadEnabled=!!pe.ccipReadEnabled),delete ie.nonce,delete ie.gasLimit,delete ie.gasPrice,delete ie.from,delete ie.value,delete ie.type,delete ie.accessList,delete ie.maxFeePerGas,delete ie.maxPriorityFeePerGas,delete ie.customData,delete ie.ccipReadEnabled;const me=Object.keys(ie).filter(ye=>ie[ye]!=null);return me.length&&logger$f.throwError(`cannot override ${me.map(ye=>JSON.stringify(ye)).join(",")}`,Logger.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:me}),le})}function buildPopulate(c,t){return function(...n){return populateTransaction(c,t,n)}}function buildEstimate(c,t){const n=c.signer||c.provider;return function(...ie){return __awaiter$h(this,void 0,void 0,function*(){n||logger$f.throwError("estimate require a provider or signer",Logger.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const fe=yield populateTransaction(c,t,ie);return yield n.estimateGas(fe)})}}function addContractWait(c,t){const n=t.wait.bind(t);t.wait=ie=>n(ie).then(fe=>(fe.events=fe.logs.map(ae=>{let le=deepCopy(ae),pe=null;try{pe=c.interface.parseLog(ae)}catch{}return pe&&(le.args=pe.args,le.decode=(me,ye)=>c.interface.decodeEventLog(pe.eventFragment,me,ye),le.event=pe.name,le.eventSignature=pe.signature),le.removeListener=()=>c.provider,le.getBlock=()=>c.provider.getBlock(fe.blockHash),le.getTransaction=()=>c.provider.getTransaction(fe.transactionHash),le.getTransactionReceipt=()=>Promise.resolve(fe),le}),fe))}function buildCall(c,t,n){const ie=c.signer||c.provider;return function(...fe){return __awaiter$h(this,void 0,void 0,function*(){let ae;if(fe.length===t.inputs.length+1&&typeof fe[fe.length-1]=="object"){const me=shallowCopy(fe.pop());me.blockTag!=null&&(ae=yield me.blockTag),delete me.blockTag,fe.push(me)}c.deployTransaction!=null&&(yield c._deployed(ae));const le=yield populateTransaction(c,t,fe),pe=yield ie.call(le,ae);try{let me=c.interface.decodeFunctionResult(t,pe);return n&&t.outputs.length===1&&(me=me[0]),me}catch(me){throw me.code===Logger.errors.CALL_EXCEPTION&&(me.address=c.address,me.args=fe,me.transaction=le),me}})}}function buildSend(c,t){return function(...n){return __awaiter$h(this,void 0,void 0,function*(){c.signer||logger$f.throwError("sending a transaction requires a signer",Logger.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),c.deployTransaction!=null&&(yield c._deployed());const ie=yield populateTransaction(c,t,n),fe=yield c.signer.sendTransaction(ie);return addContractWait(c,fe),fe})}}function buildDefault(c,t,n){return t.constant?buildCall(c,t,n):buildSend(c,t)}function getEventTag$1(c){return c.address&&(c.topics==null||c.topics.length===0)?"*":(c.address||"*")+"@"+(c.topics?c.topics.map(t=>Array.isArray(t)?t.join("|"):t).join(":"):"")}class RunningEvent{constructor(t,n){defineReadOnly(this,"tag",t),defineReadOnly(this,"filter",n),this._listeners=[]}addListener(t,n){this._listeners.push({listener:t,once:n})}removeListener(t){let n=!1;this._listeners=this._listeners.filter(ie=>n||ie.listener!==t?!0:(n=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(t=>t.listener)}listenerCount(){return this._listeners.length}run(t){const n=this.listenerCount();return this._listeners=this._listeners.filter(ie=>{const fe=t.slice();return setTimeout(()=>{ie.listener.apply(this,fe)},0),!ie.once}),n}prepareEvent(t){}getEmit(t){return[t]}}class ErrorRunningEvent extends RunningEvent{constructor(){super("error",null)}}class FragmentRunningEvent extends RunningEvent{constructor(t,n,ie,fe){const ae={address:t};let le=n.getEventTopic(ie);fe?(le!==fe[0]&&logger$f.throwArgumentError("topic mismatch","topics",fe),ae.topics=fe.slice()):ae.topics=[le],super(getEventTag$1(ae),ae),defineReadOnly(this,"address",t),defineReadOnly(this,"interface",n),defineReadOnly(this,"fragment",ie)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(n,ie)=>this.interface.decodeEventLog(this.fragment,n,ie);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(n){t.args=null,t.decodeError=n}}getEmit(t){const n=checkResultErrors(t.args);if(n.length)throw n[0].error;const ie=(t.args||[]).slice();return ie.push(t),ie}}class WildcardRunningEvent extends RunningEvent{constructor(t,n){super("*",{address:t}),defineReadOnly(this,"address",t),defineReadOnly(this,"interface",n)}prepareEvent(t){super.prepareEvent(t);try{const n=this.interface.parseLog(t);t.event=n.name,t.eventSignature=n.signature,t.decode=(ie,fe)=>this.interface.decodeEventLog(n.eventFragment,ie,fe),t.args=n.args}catch{}}}class BaseContract{constructor(t,n,ie){defineReadOnly(this,"interface",getStatic(new.target,"getInterface")(n)),ie==null?(defineReadOnly(this,"provider",null),defineReadOnly(this,"signer",null)):Signer.isSigner(ie)?(defineReadOnly(this,"provider",ie.provider||null),defineReadOnly(this,"signer",ie)):Provider.isProvider(ie)?(defineReadOnly(this,"provider",ie),defineReadOnly(this,"signer",null)):logger$f.throwArgumentError("invalid signer or provider","signerOrProvider",ie),defineReadOnly(this,"callStatic",{}),defineReadOnly(this,"estimateGas",{}),defineReadOnly(this,"functions",{}),defineReadOnly(this,"populateTransaction",{}),defineReadOnly(this,"filters",{});{const le={};Object.keys(this.interface.events).forEach(pe=>{const me=this.interface.events[pe];defineReadOnly(this.filters,pe,(...ye)=>({address:this.address,topics:this.interface.encodeFilterTopics(me,ye)})),le[me.name]||(le[me.name]=[]),le[me.name].push(pe)}),Object.keys(le).forEach(pe=>{const me=le[pe];me.length===1?defineReadOnly(this.filters,pe,this.filters[me[0]]):logger$f.warn(`Duplicate definition of ${pe} (${me.join(", ")})`)})}if(defineReadOnly(this,"_runningEvents",{}),defineReadOnly(this,"_wrappedEmits",{}),t==null&&logger$f.throwArgumentError("invalid contract address or ENS name","addressOrName",t),defineReadOnly(this,"address",t),this.provider)defineReadOnly(this,"resolvedAddress",resolveName(this.provider,t));else try{defineReadOnly(this,"resolvedAddress",Promise.resolve(getAddress(t)))}catch{logger$f.throwError("provider is required to use ENS name as contract address",Logger.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(le=>{});const fe={},ae={};Object.keys(this.interface.functions).forEach(le=>{const pe=this.interface.functions[le];if(ae[le]){logger$f.warn(`Duplicate ABI entry for ${JSON.stringify(le)}`);return}ae[le]=!0;{const me=pe.name;fe[`%${me}`]||(fe[`%${me}`]=[]),fe[`%${me}`].push(le)}this[le]==null&&defineReadOnly(this,le,buildDefault(this,pe,!0)),this.functions[le]==null&&defineReadOnly(this.functions,le,buildDefault(this,pe,!1)),this.callStatic[le]==null&&defineReadOnly(this.callStatic,le,buildCall(this,pe,!0)),this.populateTransaction[le]==null&&defineReadOnly(this.populateTransaction,le,buildPopulate(this,pe)),this.estimateGas[le]==null&&defineReadOnly(this.estimateGas,le,buildEstimate(this,pe))}),Object.keys(fe).forEach(le=>{const pe=fe[le];if(pe.length>1)return;le=le.substring(1);const me=pe[0];try{this[le]==null&&defineReadOnly(this,le,this[me])}catch{}this.functions[le]==null&&defineReadOnly(this.functions,le,this.functions[me]),this.callStatic[le]==null&&defineReadOnly(this.callStatic,le,this.callStatic[me]),this.populateTransaction[le]==null&&defineReadOnly(this.populateTransaction,le,this.populateTransaction[me]),this.estimateGas[le]==null&&defineReadOnly(this.estimateGas,le,this.estimateGas[me])})}static getContractAddress(t){return getContractAddress(t)}static getInterface(t){return Interface.isInterface(t)?t:new Interface(t)}deployed(){return this._deployed()}_deployed(t){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,t).then(n=>(n==="0x"&&logger$f.throwError("contract not deployed",Logger.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(t){this.signer||logger$f.throwError("sending a transactions require a signer",Logger.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const n=shallowCopy(t||{});return["from","to"].forEach(function(ie){n[ie]!=null&&logger$f.throwError("cannot override "+ie,Logger.errors.UNSUPPORTED_OPERATION,{operation:ie})}),n.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(n))}connect(t){typeof t=="string"&&(t=new VoidSigner(t,this.provider));const n=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&defineReadOnly(n,"deployTransaction",this.deployTransaction),n}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return Indexed.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if(typeof t=="string"){if(t==="error")return this._normalizeRunningEvent(new ErrorRunningEvent);if(t==="event")return this._normalizeRunningEvent(new RunningEvent("event",null));if(t==="*")return this._normalizeRunningEvent(new WildcardRunningEvent(this.address,this.interface));const n=this.interface.getEvent(t);return this._normalizeRunningEvent(new FragmentRunningEvent(this.address,this.interface,n))}if(t.topics&&t.topics.length>0){try{const ie=t.topics[0];if(typeof ie!="string")throw new Error("invalid topic");const fe=this.interface.getEvent(ie);return this._normalizeRunningEvent(new FragmentRunningEvent(this.address,this.interface,fe,t.topics))}catch{}const n={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new RunningEvent(getEventTag$1(n),n))}return this._normalizeRunningEvent(new WildcardRunningEvent(this.address,this.interface))}_checkRunningEvents(t){if(t.listenerCount()===0){delete this._runningEvents[t.tag];const n=this._wrappedEmits[t.tag];n&&t.filter&&(this.provider.off(t.filter,n),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,n,ie){const fe=deepCopy(n);return fe.removeListener=()=>{ie&&(t.removeListener(ie),this._checkRunningEvents(t))},fe.getBlock=()=>this.provider.getBlock(n.blockHash),fe.getTransaction=()=>this.provider.getTransaction(n.transactionHash),fe.getTransactionReceipt=()=>this.provider.getTransactionReceipt(n.transactionHash),t.prepareEvent(fe),fe}_addEventListener(t,n,ie){if(this.provider||logger$f.throwError("events require a provider or a signer with a provider",Logger.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(n,ie),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const fe=ae=>{let le=this._wrapEvent(t,ae,n);if(le.decodeError==null)try{const pe=t.getEmit(le);this.emit(t.filter,...pe)}catch(pe){le.decodeError=pe.error}t.filter!=null&&this.emit("event",le),le.decodeError!=null&&this.emit("error",le.decodeError,le)};this._wrappedEmits[t.tag]=fe,t.filter!=null&&this.provider.on(t.filter,fe)}}queryFilter(t,n,ie){const fe=this._getRunningEvent(t),ae=shallowCopy(fe.filter);return typeof n=="string"&&isHexString(n,32)?(ie!=null&&logger$f.throwArgumentError("cannot specify toBlock with blockhash","toBlock",ie),ae.blockHash=n):(ae.fromBlock=n??0,ae.toBlock=ie??"latest"),this.provider.getLogs(ae).then(le=>le.map(pe=>this._wrapEvent(fe,pe,null)))}on(t,n){return this._addEventListener(this._getRunningEvent(t),n,!1),this}once(t,n){return this._addEventListener(this._getRunningEvent(t),n,!0),this}emit(t,...n){if(!this.provider)return!1;const ie=this._getRunningEvent(t),fe=ie.run(n)>0;return this._checkRunningEvents(ie),fe}listenerCount(t){return this.provider?t==null?Object.keys(this._runningEvents).reduce((n,ie)=>n+this._runningEvents[ie].listenerCount(),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(t==null){const n=[];for(let ie in this._runningEvents)this._runningEvents[ie].listeners().forEach(fe=>{n.push(fe)});return n}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(t==null){for(const ie in this._runningEvents){const fe=this._runningEvents[ie];fe.removeAllListeners(),this._checkRunningEvents(fe)}return this}const n=this._getRunningEvent(t);return n.removeAllListeners(),this._checkRunningEvents(n),this}off(t,n){if(!this.provider)return this;const ie=this._getRunningEvent(t);return ie.removeListener(n),this._checkRunningEvents(ie),this}removeListener(t,n){return this.off(t,n)}}class Contract extends BaseContract{}class BaseX{constructor(t){defineReadOnly(this,"alphabet",t),defineReadOnly(this,"base",t.length),defineReadOnly(this,"_alphabetMap",{}),defineReadOnly(this,"_leader",t.charAt(0));for(let n=0;n<t.length;n++)this._alphabetMap[t.charAt(n)]=n}encode(t){let n=arrayify(t);if(n.length===0)return"";let ie=[0];for(let ae=0;ae<n.length;++ae){let le=n[ae];for(let pe=0;pe<ie.length;++pe)le+=ie[pe]<<8,ie[pe]=le%this.base,le=le/this.base|0;for(;le>0;)ie.push(le%this.base),le=le/this.base|0}let fe="";for(let ae=0;n[ae]===0&&ae<n.length-1;++ae)fe+=this._leader;for(let ae=ie.length-1;ae>=0;--ae)fe+=this.alphabet[ie[ae]];return fe}decode(t){if(typeof t!="string")throw new TypeError("Expected String");let n=[];if(t.length===0)return new Uint8Array(n);n.push(0);for(let ie=0;ie<t.length;ie++){let fe=this._alphabetMap[t[ie]];if(fe===void 0)throw new Error("Non-base"+this.base+" character");let ae=fe;for(let le=0;le<n.length;++le)ae+=n[le]*this.base,n[le]=ae&255,ae>>=8;for(;ae>0;)n.push(ae&255),ae>>=8}for(let ie=0;t[ie]===this._leader&&ie<t.length-1;++ie)n.push(0);return arrayify(new Uint8Array(n.reverse()))}}const Base32=new BaseX("abcdefghijklmnopqrstuvwxyz234567"),Base58=new BaseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),lib_esm$8=Object.freeze(Object.defineProperty({__proto__:null,Base32,Base58,BaseX},Symbol.toStringTag,{value:"Module"}));var SupportedAlgorithm;(function(c){c.sha256="sha256",c.sha512="sha512"})(SupportedAlgorithm||(SupportedAlgorithm={}));const version$g="sha2/5.8.0",logger$e=new Logger(version$g);function ripemd160$1(c){return"0x"+hash$3.ripemd160().update(arrayify(c)).digest("hex")}function sha256$7(c){return"0x"+hash$3.sha256().update(arrayify(c)).digest("hex")}function sha512$4(c){return"0x"+hash$3.sha512().update(arrayify(c)).digest("hex")}function computeHmac(c,t,n){return SupportedAlgorithm[c]||logger$e.throwError("unsupported algorithm "+c,Logger.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:c}),"0x"+hash$3.hmac(hash$3[c],arrayify(t)).update(arrayify(n)).digest("hex")}const lib_esm$7=Object.freeze(Object.defineProperty({__proto__:null,get SupportedAlgorithm(){return SupportedAlgorithm},computeHmac,ripemd160:ripemd160$1,sha256:sha256$7,sha512:sha512$4},Symbol.toStringTag,{value:"Module"}));function pbkdf2$1(c,t,n,ie,fe){c=arrayify(c),t=arrayify(t);let ae,le=1;const pe=new Uint8Array(ie),me=new Uint8Array(t.length+4);me.set(t);let ye,xe;for(let Ee=1;Ee<=le;Ee++){me[t.length]=Ee>>24&255,me[t.length+1]=Ee>>16&255,me[t.length+2]=Ee>>8&255,me[t.length+3]=Ee&255;let Se=arrayify(computeHmac(fe,c,me));ae||(ae=Se.length,xe=new Uint8Array(ae),le=Math.ceil(ie/ae),ye=ie-(le-1)*ae),xe.set(Se);for(let $e=1;$e<n;$e++){Se=arrayify(computeHmac(fe,c,Se));for(let ke=0;ke<ae;ke++)xe[ke]^=Se[ke]}const Me=(Ee-1)*ae,Be=Ee===le?ye:ae;pe.set(arrayify(xe).slice(0,Be),Me)}return hexlify(pe)}const version$f="wordlists/5.8.0",logger$d=new Logger(version$f);class Wordlist{constructor(t){logger$d.checkAbstract(new.target,Wordlist),defineReadOnly(this,"locale",t)}split(t){return t.toLowerCase().split(/ +/g)}join(t){return t.join(" ")}static check(t){const n=[];for(let ie=0;ie<2048;ie++){const fe=t.getWord(ie);if(ie!==t.getWordIndex(fe))return"0x";n.push(fe)}return id(n.join(`
8
8
  `)+`
9
- `)}static register(t,n){n||(n=t.locale)}}const words="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo";let wordlist=null;function loadWords(c){if(wordlist==null&&(wordlist=words.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Wordlist.check(c)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw wordlist=null,new Error("BIP39 Wordlist for en (English) FAILED")}class LangEn extends Wordlist{constructor(){super("en")}getWord(t){return loadWords(this),wordlist[t]}getWordIndex(t){return loadWords(this),wordlist.indexOf(t)}}const langEn=new LangEn;Wordlist.register(langEn);const wordlists={en:langEn},version$e="hdnode/5.8.0",logger$c=new Logger(version$e),N$3=BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),MasterSecret=toUtf8Bytes("Bitcoin seed"),HardenedBit=2147483648;function getUpperMask(c){return(1<<c)-1<<8-c}function getLowerMask(c){return(1<<c)-1}function bytes32(c){return hexZeroPad(hexlify(c),32)}function base58check(c){return Base58.encode(concat$1([c,hexDataSlice(sha256$7(sha256$7(c)),0,4)]))}function getWordlist(c){if(c==null)return wordlists.en;if(typeof c=="string"){const t=wordlists[c];return t==null&&logger$c.throwArgumentError("unknown locale","wordlist",c),t}return c}const _constructorGuard$1={},defaultPath="m/44'/60'/0'/0/0";class HDNode{constructor(t,n,ie,fe,ae,le,pe,me){if(t!==_constructorGuard$1)throw new Error("HDNode constructor cannot be called directly");if(n){const ye=new SigningKey(n);defineReadOnly(this,"privateKey",ye.privateKey),defineReadOnly(this,"publicKey",ye.compressedPublicKey)}else defineReadOnly(this,"privateKey",null),defineReadOnly(this,"publicKey",hexlify(ie));defineReadOnly(this,"parentFingerprint",fe),defineReadOnly(this,"fingerprint",hexDataSlice(ripemd160$1(sha256$7(this.publicKey)),0,4)),defineReadOnly(this,"address",computeAddress(this.publicKey)),defineReadOnly(this,"chainCode",ae),defineReadOnly(this,"index",le),defineReadOnly(this,"depth",pe),me==null?(defineReadOnly(this,"mnemonic",null),defineReadOnly(this,"path",null)):typeof me=="string"?(defineReadOnly(this,"mnemonic",null),defineReadOnly(this,"path",me)):(defineReadOnly(this,"mnemonic",me),defineReadOnly(this,"path",me.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return base58check(concat$1([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",hexlify(this.depth),this.parentFingerprint,hexZeroPad(hexlify(this.index),4),this.chainCode,this.privateKey!=null?concat$1(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new HDNode(_constructorGuard$1,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let n=this.path;n&&(n+="/"+(t&~HardenedBit));const ie=new Uint8Array(37);if(t&HardenedBit){if(!this.privateKey)throw new Error("cannot derive child of neutered node");ie.set(arrayify(this.privateKey),1),n&&(n+="'")}else ie.set(arrayify(this.publicKey));for(let Ee=24;Ee>=0;Ee-=8)ie[33+(Ee>>3)]=t>>24-Ee&255;const fe=arrayify(computeHmac(SupportedAlgorithm.sha512,this.chainCode,ie)),ae=fe.slice(0,32),le=fe.slice(32);let pe=null,me=null;this.privateKey?pe=bytes32(BigNumber.from(ae).add(this.privateKey).mod(N$3)):me=new SigningKey(hexlify(ae))._addPoint(this.publicKey);let ye=n;const xe=this.mnemonic;return xe&&(ye=Object.freeze({phrase:xe.phrase,path:n,locale:xe.locale||"en"})),new HDNode(_constructorGuard$1,pe,me,this.fingerprint,bytes32(le),t,this.depth+1,ye)}derivePath(t){const n=t.split("/");if(n.length===0||n[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+t);n[0]==="m"&&n.shift();let ie=this;for(let fe=0;fe<n.length;fe++){const ae=n[fe];if(ae.match(/^[0-9]+'$/)){const le=parseInt(ae.substring(0,ae.length-1));if(le>=HardenedBit)throw new Error("invalid path index - "+ae);ie=ie._derive(HardenedBit+le)}else if(ae.match(/^[0-9]+$/)){const le=parseInt(ae);if(le>=HardenedBit)throw new Error("invalid path index - "+ae);ie=ie._derive(le)}else throw new Error("invalid path component - "+ae)}return ie}static _fromSeed(t,n){const ie=arrayify(t);if(ie.length<16||ie.length>64)throw new Error("invalid seed");const fe=arrayify(computeHmac(SupportedAlgorithm.sha512,MasterSecret,ie));return new HDNode(_constructorGuard$1,bytes32(fe.slice(0,32)),null,"0x00000000",bytes32(fe.slice(32)),0,0,n)}static fromMnemonic(t,n,ie){return ie=getWordlist(ie),t=entropyToMnemonic(mnemonicToEntropy(t,ie),ie),HDNode._fromSeed(mnemonicToSeed(t,n),{phrase:t,path:"m",locale:ie.locale})}static fromSeed(t){return HDNode._fromSeed(t,null)}static fromExtendedKey(t){const n=Base58.decode(t);(n.length!==82||base58check(n.slice(0,78))!==t)&&logger$c.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const ie=n[4],fe=hexlify(n.slice(5,9)),ae=parseInt(hexlify(n.slice(9,13)).substring(2),16),le=hexlify(n.slice(13,45)),pe=n.slice(45,78);switch(hexlify(n.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new HDNode(_constructorGuard$1,null,hexlify(pe),fe,le,ae,ie,null);case"0x0488ade4":case"0x04358394 ":if(pe[0]!==0)break;return new HDNode(_constructorGuard$1,hexlify(pe.slice(1)),null,fe,le,ae,ie,null)}return logger$c.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function mnemonicToSeed(c,t){t||(t="");const n=toUtf8Bytes("mnemonic"+t,UnicodeNormalizationForm.NFKD);return pbkdf2$1(toUtf8Bytes(c,UnicodeNormalizationForm.NFKD),n,2048,64,"sha512")}function mnemonicToEntropy(c,t){t=getWordlist(t),logger$c.checkNormalize();const n=t.split(c);if(n.length%3!==0)throw new Error("invalid mnemonic");const ie=arrayify(new Uint8Array(Math.ceil(11*n.length/8)));let fe=0;for(let ye=0;ye<n.length;ye++){let xe=t.getWordIndex(n[ye].normalize("NFKD"));if(xe===-1)throw new Error("invalid mnemonic");for(let Ee=0;Ee<11;Ee++)xe&1<<10-Ee&&(ie[fe>>3]|=1<<7-fe%8),fe++}const ae=32*n.length/3,le=n.length/3,pe=getUpperMask(le);if((arrayify(sha256$7(ie.slice(0,ae/8)))[0]&pe)!==(ie[ie.length-1]&pe))throw new Error("invalid checksum");return hexlify(ie.slice(0,ae/8))}function entropyToMnemonic(c,t){if(t=getWordlist(t),c=arrayify(c),c.length%4!==0||c.length<16||c.length>32)throw new Error("invalid entropy");const n=[0];let ie=11;for(let le=0;le<c.length;le++)ie>8?(n[n.length-1]<<=8,n[n.length-1]|=c[le],ie-=8):(n[n.length-1]<<=ie,n[n.length-1]|=c[le]>>8-ie,n.push(c[le]&getLowerMask(8-ie)),ie+=3);const fe=c.length/4,ae=arrayify(sha256$7(c))[0]&getUpperMask(fe);return n[n.length-1]<<=fe,n[n.length-1]|=ae>>8-fe,t.join(n.map(le=>t.getWord(le)))}function isValidMnemonic(c,t){try{return mnemonicToEntropy(c,t),!0}catch{}return!1}function getAccountPath(c){return(typeof c!="number"||c<0||c>=HardenedBit||c%1)&&logger$c.throwArgumentError("invalid account index","index",c),`m/44'/60'/${c}'/0/0`}const lib_esm$6=Object.freeze(Object.defineProperty({__proto__:null,HDNode,defaultPath,entropyToMnemonic,getAccountPath,isValidMnemonic,mnemonicToEntropy,mnemonicToSeed},Symbol.toStringTag,{value:"Module"})),version$d="random/5.8.0",logger$b=new Logger(version$d);function getGlobal(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof globalThis<"u")return globalThis;throw new Error("unable to locate global object")}const anyGlobal=getGlobal();let crypto$3=anyGlobal.crypto||anyGlobal.msCrypto;(!crypto$3||!crypto$3.getRandomValues)&&(logger$b.warn("WARNING: Missing strong random number source"),crypto$3={getRandomValues:function(c){return logger$b.throwError("no secure random source avaialble",Logger.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function randomBytes$1(c){(c<=0||c>1024||c%1||c!=c)&&logger$b.throwArgumentError("invalid length","length",c);const t=new Uint8Array(c);return crypto$3.getRandomValues(t),arrayify(t)}function shuffled(c){c=c.slice();for(let t=c.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1)),ie=c[t];c[t]=c[n],c[n]=ie}return c}const lib_esm$5=Object.freeze(Object.defineProperty({__proto__:null,randomBytes:randomBytes$1,shuffled},Symbol.toStringTag,{value:"Module"}));var aesJs={exports:{}};(function(c,t){(function(n){function ie(ge){return parseInt(ge)===ge}function fe(ge){if(!ie(ge.length))return!1;for(var Re=0;Re<ge.length;Re++)if(!ie(ge[Re])||ge[Re]<0||ge[Re]>255)return!1;return!0}function ae(ge,Re){if(ge.buffer&&ArrayBuffer.isView(ge)&&ge.name==="Uint8Array")return Re&&(ge.slice?ge=ge.slice():ge=Array.prototype.slice.call(ge)),ge;if(Array.isArray(ge)){if(!fe(ge))throw new Error("Array contains invalid value: "+ge);return new Uint8Array(ge)}if(ie(ge.length)&&fe(ge))return new Uint8Array(ge);throw new Error("unsupported array-like object")}function le(ge){return new Uint8Array(ge)}function pe(ge,Re,Ne,qe,Pe){(qe!=null||Pe!=null)&&(ge.slice?ge=ge.slice(qe,Pe):ge=Array.prototype.slice.call(ge,qe,Pe)),Re.set(ge,Ne)}var me=function(){function ge(Ne){var qe=[],Pe=0;for(Ne=encodeURI(Ne);Pe<Ne.length;){var Ge=Ne.charCodeAt(Pe++);Ge===37?(qe.push(parseInt(Ne.substr(Pe,2),16)),Pe+=2):qe.push(Ge)}return ae(qe)}function Re(Ne){for(var qe=[],Pe=0;Pe<Ne.length;){var Ge=Ne[Pe];Ge<128?(qe.push(String.fromCharCode(Ge)),Pe++):Ge>191&&Ge<224?(qe.push(String.fromCharCode((Ge&31)<<6|Ne[Pe+1]&63)),Pe+=2):(qe.push(String.fromCharCode((Ge&15)<<12|(Ne[Pe+1]&63)<<6|Ne[Pe+2]&63)),Pe+=3)}return qe.join("")}return{toBytes:ge,fromBytes:Re}}(),ye=function(){function ge(qe){for(var Pe=[],Ge=0;Ge<qe.length;Ge+=2)Pe.push(parseInt(qe.substr(Ge,2),16));return Pe}var Re="0123456789abcdef";function Ne(qe){for(var Pe=[],Ge=0;Ge<qe.length;Ge++){var Ce=qe[Ge];Pe.push(Re[(Ce&240)>>4]+Re[Ce&15])}return Pe.join("")}return{toBytes:ge,fromBytes:Ne}}(),xe={16:10,24:12,32:14},Ee=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Se=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Me=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Be=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],$e=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],ke=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Te=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Ie=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Fe=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Le=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],He=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],ze=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Je=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Xe=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Ue=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function $t(ge){for(var Re=[],Ne=0;Ne<ge.length;Ne+=4)Re.push(ge[Ne]<<24|ge[Ne+1]<<16|ge[Ne+2]<<8|ge[Ne+3]);return Re}var _e=function(ge){if(!(this instanceof _e))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:ae(ge,!0)}),this._prepare()};_e.prototype._prepare=function(){var ge=xe[this.key.length];if(ge==null)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var Re=0;Re<=ge;Re++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(var Ne=(ge+1)*4,qe=this.key.length/4,Pe=$t(this.key),Ge,Re=0;Re<qe;Re++)Ge=Re>>2,this._Ke[Ge][Re%4]=Pe[Re],this._Kd[ge-Ge][Re%4]=Pe[Re];for(var Ce=0,De=qe,je;De<Ne;){if(je=Pe[qe-1],Pe[0]^=Se[je>>16&255]<<24^Se[je>>8&255]<<16^Se[je&255]<<8^Se[je>>24&255]^Ee[Ce]<<24,Ce+=1,qe!=8)for(var Re=1;Re<qe;Re++)Pe[Re]^=Pe[Re-1];else{for(var Re=1;Re<qe/2;Re++)Pe[Re]^=Pe[Re-1];je=Pe[qe/2-1],Pe[qe/2]^=Se[je&255]^Se[je>>8&255]<<8^Se[je>>16&255]<<16^Se[je>>24&255]<<24;for(var Re=qe/2+1;Re<qe;Re++)Pe[Re]^=Pe[Re-1]}for(var Re=0,Ve,Mt;Re<qe&&De<Ne;)Ve=De>>2,Mt=De%4,this._Ke[Ve][Mt]=Pe[Re],this._Kd[ge-Ve][Mt]=Pe[Re++],De++}for(var Ve=1;Ve<ge;Ve++)for(var Mt=0;Mt<4;Mt++)je=this._Kd[Ve][Mt],this._Kd[Ve][Mt]=ze[je>>24&255]^Je[je>>16&255]^Xe[je>>8&255]^Ue[je&255]},_e.prototype.encrypt=function(ge){if(ge.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var Re=this._Ke.length-1,Ne=[0,0,0,0],qe=$t(ge),Pe=0;Pe<4;Pe++)qe[Pe]^=this._Ke[0][Pe];for(var Ge=1;Ge<Re;Ge++){for(var Pe=0;Pe<4;Pe++)Ne[Pe]=Be[qe[Pe]>>24&255]^$e[qe[(Pe+1)%4]>>16&255]^ke[qe[(Pe+2)%4]>>8&255]^Te[qe[(Pe+3)%4]&255]^this._Ke[Ge][Pe];qe=Ne.slice()}for(var Ce=le(16),De,Pe=0;Pe<4;Pe++)De=this._Ke[Re][Pe],Ce[4*Pe]=(Se[qe[Pe]>>24&255]^De>>24)&255,Ce[4*Pe+1]=(Se[qe[(Pe+1)%4]>>16&255]^De>>16)&255,Ce[4*Pe+2]=(Se[qe[(Pe+2)%4]>>8&255]^De>>8)&255,Ce[4*Pe+3]=(Se[qe[(Pe+3)%4]&255]^De)&255;return Ce},_e.prototype.decrypt=function(ge){if(ge.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var Re=this._Kd.length-1,Ne=[0,0,0,0],qe=$t(ge),Pe=0;Pe<4;Pe++)qe[Pe]^=this._Kd[0][Pe];for(var Ge=1;Ge<Re;Ge++){for(var Pe=0;Pe<4;Pe++)Ne[Pe]=Ie[qe[Pe]>>24&255]^Fe[qe[(Pe+3)%4]>>16&255]^Le[qe[(Pe+2)%4]>>8&255]^He[qe[(Pe+1)%4]&255]^this._Kd[Ge][Pe];qe=Ne.slice()}for(var Ce=le(16),De,Pe=0;Pe<4;Pe++)De=this._Kd[Re][Pe],Ce[4*Pe]=(Me[qe[Pe]>>24&255]^De>>24)&255,Ce[4*Pe+1]=(Me[qe[(Pe+3)%4]>>16&255]^De>>16)&255,Ce[4*Pe+2]=(Me[qe[(Pe+2)%4]>>8&255]^De>>8)&255,Ce[4*Pe+3]=(Me[qe[(Pe+1)%4]&255]^De)&255;return Ce};var se=function(ge){if(!(this instanceof se))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new _e(ge)};se.prototype.encrypt=function(ge){if(ge=ae(ge),ge.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var Re=le(ge.length),Ne=le(16),qe=0;qe<ge.length;qe+=16)pe(ge,Ne,0,qe,qe+16),Ne=this._aes.encrypt(Ne),pe(Ne,Re,qe);return Re},se.prototype.decrypt=function(ge){if(ge=ae(ge),ge.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var Re=le(ge.length),Ne=le(16),qe=0;qe<ge.length;qe+=16)pe(ge,Ne,0,qe,qe+16),Ne=this._aes.decrypt(Ne),pe(Ne,Re,qe);return Re};var ce=function(ge,Re){if(!(this instanceof ce))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",!Re)Re=le(16);else if(Re.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)");this._lastCipherblock=ae(Re,!0),this._aes=new _e(ge)};ce.prototype.encrypt=function(ge){if(ge=ae(ge),ge.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var Re=le(ge.length),Ne=le(16),qe=0;qe<ge.length;qe+=16){pe(ge,Ne,0,qe,qe+16);for(var Pe=0;Pe<16;Pe++)Ne[Pe]^=this._lastCipherblock[Pe];this._lastCipherblock=this._aes.encrypt(Ne),pe(this._lastCipherblock,Re,qe)}return Re},ce.prototype.decrypt=function(ge){if(ge=ae(ge),ge.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var Re=le(ge.length),Ne=le(16),qe=0;qe<ge.length;qe+=16){pe(ge,Ne,0,qe,qe+16),Ne=this._aes.decrypt(Ne);for(var Pe=0;Pe<16;Pe++)Re[qe+Pe]=Ne[Pe]^this._lastCipherblock[Pe];pe(ge,this._lastCipherblock,0,qe,qe+16)}return Re};var de=function(ge,Re,Ne){if(!(this instanceof de))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",!Re)Re=le(16);else if(Re.length!=16)throw new Error("invalid initialation vector size (must be 16 size)");Ne||(Ne=1),this.segmentSize=Ne,this._shiftRegister=ae(Re,!0),this._aes=new _e(ge)};de.prototype.encrypt=function(ge){if(ge.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var Re=ae(ge,!0),Ne,qe=0;qe<Re.length;qe+=this.segmentSize){Ne=this._aes.encrypt(this._shiftRegister);for(var Pe=0;Pe<this.segmentSize;Pe++)Re[qe+Pe]^=Ne[Pe];pe(this._shiftRegister,this._shiftRegister,0,this.segmentSize),pe(Re,this._shiftRegister,16-this.segmentSize,qe,qe+this.segmentSize)}return Re},de.prototype.decrypt=function(ge){if(ge.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var Re=ae(ge,!0),Ne,qe=0;qe<Re.length;qe+=this.segmentSize){Ne=this._aes.encrypt(this._shiftRegister);for(var Pe=0;Pe<this.segmentSize;Pe++)Re[qe+Pe]^=Ne[Pe];pe(this._shiftRegister,this._shiftRegister,0,this.segmentSize),pe(ge,this._shiftRegister,16-this.segmentSize,qe,qe+this.segmentSize)}return Re};var he=function(ge,Re){if(!(this instanceof he))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",!Re)Re=le(16);else if(Re.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)");this._lastPrecipher=ae(Re,!0),this._lastPrecipherIndex=16,this._aes=new _e(ge)};he.prototype.encrypt=function(ge){for(var Re=ae(ge,!0),Ne=0;Ne<Re.length;Ne++)this._lastPrecipherIndex===16&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),Re[Ne]^=this._lastPrecipher[this._lastPrecipherIndex++];return Re},he.prototype.decrypt=he.prototype.encrypt;var ve=function(ge){if(!(this instanceof ve))throw Error("Counter must be instanitated with `new`");ge!==0&&!ge&&(ge=1),typeof ge=="number"?(this._counter=le(16),this.setValue(ge)):this.setBytes(ge)};ve.prototype.setValue=function(ge){if(typeof ge!="number"||parseInt(ge)!=ge)throw new Error("invalid counter value (must be an integer)");for(var Re=15;Re>=0;--Re)this._counter[Re]=ge%256,ge=ge>>8},ve.prototype.setBytes=function(ge){if(ge=ae(ge,!0),ge.length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=ge},ve.prototype.increment=function(){for(var ge=15;ge>=0;ge--)if(this._counter[ge]===255)this._counter[ge]=0;else{this._counter[ge]++;break}};var we=function(ge,Re){if(!(this instanceof we))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",Re instanceof ve||(Re=new ve(Re)),this._counter=Re,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new _e(ge)};we.prototype.encrypt=function(ge){for(var Re=ae(ge,!0),Ne=0;Ne<Re.length;Ne++)this._remainingCounterIndex===16&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),Re[Ne]^=this._remainingCounter[this._remainingCounterIndex++];return Re},we.prototype.decrypt=we.prototype.encrypt;function Ae(ge){ge=ae(ge,!0);var Re=16-ge.length%16,Ne=le(ge.length+Re);pe(ge,Ne);for(var qe=ge.length;qe<Ne.length;qe++)Ne[qe]=Re;return Ne}function be(ge){if(ge=ae(ge,!0),ge.length<16)throw new Error("PKCS#7 invalid length");var Re=ge[ge.length-1];if(Re>16)throw new Error("PKCS#7 padding byte out of range");for(var Ne=ge.length-Re,qe=0;qe<Re;qe++)if(ge[Ne+qe]!==Re)throw new Error("PKCS#7 invalid padding byte");var Pe=le(Ne);return pe(ge,Pe,0,0,Ne),Pe}var ue={AES:_e,Counter:ve,ModeOfOperation:{ecb:se,cbc:ce,cfb:de,ofb:he,ctr:we},utils:{hex:ye,utf8:me},padding:{pkcs7:{pad:Ae,strip:be}},_arrayTest:{coerceArray:ae,createArray:le,copyArray:pe}};c.exports=ue})()})(aesJs);var aesJsExports=aesJs.exports;const aes$1=getDefaultExportFromCjs$2(aesJsExports),version$c="json-wallets/5.8.0";function looseArrayify(c){return typeof c=="string"&&c.substring(0,2)!=="0x"&&(c="0x"+c),arrayify(c)}function zpad(c,t){for(c=String(c);c.length<t;)c="0"+c;return c}function getPassword(c){return typeof c=="string"?toUtf8Bytes(c,UnicodeNormalizationForm.NFKC):arrayify(c)}function searchPath(c,t){let n=c;const ie=t.toLowerCase().split("/");for(let fe=0;fe<ie.length;fe++){let ae=null;for(const le in n)if(le.toLowerCase()===ie[fe]){ae=n[le];break}if(ae===null)return null;n=ae}return n}function uuidV4(c){const t=arrayify(c);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const n=hexlify(t);return[n.substring(2,10),n.substring(10,14),n.substring(14,18),n.substring(18,22),n.substring(22,34)].join("-")}const logger$a=new Logger(version$c);class CrowdsaleAccount extends Description{isCrowdsaleAccount(t){return!!(t&&t._isCrowdsaleAccount)}}function decrypt$1(c,t){const n=JSON.parse(c);t=getPassword(t);const ie=getAddress(searchPath(n,"ethaddr")),fe=looseArrayify(searchPath(n,"encseed"));(!fe||fe.length%16!==0)&&logger$a.throwArgumentError("invalid encseed","json",c);const ae=arrayify(pbkdf2$1(t,t,2e3,32,"sha256")).slice(0,16),le=fe.slice(0,16),pe=fe.slice(16),me=new aes$1.ModeOfOperation.cbc(ae,le),ye=aes$1.padding.pkcs7.strip(arrayify(me.decrypt(pe)));let xe="";for(let Me=0;Me<ye.length;Me++)xe+=String.fromCharCode(ye[Me]);const Ee=toUtf8Bytes(xe),Se=keccak256$1(Ee);return new CrowdsaleAccount({_isCrowdsaleAccount:!0,address:ie,privateKey:Se})}function isCrowdsaleWallet(c){let t=null;try{t=JSON.parse(c)}catch{return!1}return t.encseed&&t.ethaddr}function isKeystoreWallet(c){let t=null;try{t=JSON.parse(c)}catch{return!1}return!(!t.version||parseInt(t.version)!==t.version||parseInt(t.version)!==3)}function getJsonWalletAddress(c){if(isCrowdsaleWallet(c))try{return getAddress(JSON.parse(c).ethaddr)}catch{return null}if(isKeystoreWallet(c))try{return getAddress(JSON.parse(c).address)}catch{return null}return null}var scrypt$1={exports:{}};(function(c,t){(function(n){function fe($e){const ke=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]);let Te=1779033703,Ie=3144134277,Fe=1013904242,Le=2773480762,He=1359893119,ze=2600822924,Je=528734635,Xe=1541459225;const Ue=new Uint32Array(64);function $t(we){let Ae=0,be=we.length;for(;be>=64;){let ue=Te,ge=Ie,Re=Fe,Ne=Le,qe=He,Pe=ze,Ge=Je,Ce=Xe,De,je,Ve,Mt,Oe;for(je=0;je<16;je++)Ve=Ae+je*4,Ue[je]=(we[Ve]&255)<<24|(we[Ve+1]&255)<<16|(we[Ve+2]&255)<<8|we[Ve+3]&255;for(je=16;je<64;je++)De=Ue[je-2],Mt=(De>>>17|De<<15)^(De>>>19|De<<13)^De>>>10,De=Ue[je-15],Oe=(De>>>7|De<<25)^(De>>>18|De<<14)^De>>>3,Ue[je]=(Mt+Ue[je-7]|0)+(Oe+Ue[je-16]|0)|0;for(je=0;je<64;je++)Mt=(((qe>>>6|qe<<26)^(qe>>>11|qe<<21)^(qe>>>25|qe<<7))+(qe&Pe^~qe&Ge)|0)+(Ce+(ke[je]+Ue[je]|0)|0)|0,Oe=((ue>>>2|ue<<30)^(ue>>>13|ue<<19)^(ue>>>22|ue<<10))+(ue&ge^ue&Re^ge&Re)|0,Ce=Ge,Ge=Pe,Pe=qe,qe=Ne+Mt|0,Ne=Re,Re=ge,ge=ue,ue=Mt+Oe|0;Te=Te+ue|0,Ie=Ie+ge|0,Fe=Fe+Re|0,Le=Le+Ne|0,He=He+qe|0,ze=ze+Pe|0,Je=Je+Ge|0,Xe=Xe+Ce|0,Ae+=64,be-=64}}$t($e);let _e,se=$e.length%64,ce=$e.length/536870912|0,de=$e.length<<3,he=se<56?56:120,ve=$e.slice($e.length-se,$e.length);for(ve.push(128),_e=se+1;_e<he;_e++)ve.push(0);return ve.push(ce>>>24&255),ve.push(ce>>>16&255),ve.push(ce>>>8&255),ve.push(ce>>>0&255),ve.push(de>>>24&255),ve.push(de>>>16&255),ve.push(de>>>8&255),ve.push(de>>>0&255),$t(ve),[Te>>>24&255,Te>>>16&255,Te>>>8&255,Te>>>0&255,Ie>>>24&255,Ie>>>16&255,Ie>>>8&255,Ie>>>0&255,Fe>>>24&255,Fe>>>16&255,Fe>>>8&255,Fe>>>0&255,Le>>>24&255,Le>>>16&255,Le>>>8&255,Le>>>0&255,He>>>24&255,He>>>16&255,He>>>8&255,He>>>0&255,ze>>>24&255,ze>>>16&255,ze>>>8&255,ze>>>0&255,Je>>>24&255,Je>>>16&255,Je>>>8&255,Je>>>0&255,Xe>>>24&255,Xe>>>16&255,Xe>>>8&255,Xe>>>0&255]}function ae($e,ke,Te){$e=$e.length<=64?$e:fe($e);const Ie=64+ke.length+4,Fe=new Array(Ie),Le=new Array(64);let He,ze=[];for(He=0;He<64;He++)Fe[He]=54;for(He=0;He<$e.length;He++)Fe[He]^=$e[He];for(He=0;He<ke.length;He++)Fe[64+He]=ke[He];for(He=Ie-4;He<Ie;He++)Fe[He]=0;for(He=0;He<64;He++)Le[He]=92;for(He=0;He<$e.length;He++)Le[He]^=$e[He];function Je(){for(let Xe=Ie-1;Xe>=Ie-4;Xe--){if(Fe[Xe]++,Fe[Xe]<=255)return;Fe[Xe]=0}}for(;Te>=32;)Je(),ze=ze.concat(fe(Le.concat(fe(Fe)))),Te-=32;return Te>0&&(Je(),ze=ze.concat(fe(Le.concat(fe(Fe))).slice(0,Te))),ze}function le($e,ke,Te,Ie,Fe){let Le;for(xe($e,(2*Te-1)*16,Fe,0,16),Le=0;Le<2*Te;Le++)ye($e,Le*16,Fe,16),me(Fe,Ie),xe(Fe,0,$e,ke+Le*16,16);for(Le=0;Le<Te;Le++)xe($e,ke+Le*2*16,$e,Le*16,16);for(Le=0;Le<Te;Le++)xe($e,ke+(Le*2+1)*16,$e,(Le+Te)*16,16)}function pe($e,ke){return $e<<ke|$e>>>32-ke}function me($e,ke){xe($e,0,ke,0,16);for(let Te=8;Te>0;Te-=2)ke[4]^=pe(ke[0]+ke[12],7),ke[8]^=pe(ke[4]+ke[0],9),ke[12]^=pe(ke[8]+ke[4],13),ke[0]^=pe(ke[12]+ke[8],18),ke[9]^=pe(ke[5]+ke[1],7),ke[13]^=pe(ke[9]+ke[5],9),ke[1]^=pe(ke[13]+ke[9],13),ke[5]^=pe(ke[1]+ke[13],18),ke[14]^=pe(ke[10]+ke[6],7),ke[2]^=pe(ke[14]+ke[10],9),ke[6]^=pe(ke[2]+ke[14],13),ke[10]^=pe(ke[6]+ke[2],18),ke[3]^=pe(ke[15]+ke[11],7),ke[7]^=pe(ke[3]+ke[15],9),ke[11]^=pe(ke[7]+ke[3],13),ke[15]^=pe(ke[11]+ke[7],18),ke[1]^=pe(ke[0]+ke[3],7),ke[2]^=pe(ke[1]+ke[0],9),ke[3]^=pe(ke[2]+ke[1],13),ke[0]^=pe(ke[3]+ke[2],18),ke[6]^=pe(ke[5]+ke[4],7),ke[7]^=pe(ke[6]+ke[5],9),ke[4]^=pe(ke[7]+ke[6],13),ke[5]^=pe(ke[4]+ke[7],18),ke[11]^=pe(ke[10]+ke[9],7),ke[8]^=pe(ke[11]+ke[10],9),ke[9]^=pe(ke[8]+ke[11],13),ke[10]^=pe(ke[9]+ke[8],18),ke[12]^=pe(ke[15]+ke[14],7),ke[13]^=pe(ke[12]+ke[15],9),ke[14]^=pe(ke[13]+ke[12],13),ke[15]^=pe(ke[14]+ke[13],18);for(let Te=0;Te<16;++Te)$e[Te]+=ke[Te]}function ye($e,ke,Te,Ie){for(let Fe=0;Fe<Ie;Fe++)Te[Fe]^=$e[ke+Fe]}function xe($e,ke,Te,Ie,Fe){for(;Fe--;)Te[Ie++]=$e[ke++]}function Ee($e){if(!$e||typeof $e.length!="number")return!1;for(let ke=0;ke<$e.length;ke++){const Te=$e[ke];if(typeof Te!="number"||Te%1||Te<0||Te>=256)return!1}return!0}function Se($e,ke){if(typeof $e!="number"||$e%1)throw new Error("invalid "+ke);return $e}function Me($e,ke,Te,Ie,Fe,Le,He){if(Te=Se(Te,"N"),Ie=Se(Ie,"r"),Fe=Se(Fe,"p"),Le=Se(Le,"dkLen"),Te===0||Te&Te-1)throw new Error("N must be power of 2");if(Te>2147483647/128/Ie)throw new Error("N too large");if(Ie>2147483647/128/Fe)throw new Error("r too large");if(!Ee($e))throw new Error("password must be an array or buffer");if($e=Array.prototype.slice.call($e),!Ee(ke))throw new Error("salt must be an array or buffer");ke=Array.prototype.slice.call(ke);let ze=ae($e,ke,Fe*128*Ie);const Je=new Uint32Array(Fe*32*Ie);for(let qe=0;qe<Je.length;qe++){const Pe=qe*4;Je[qe]=(ze[Pe+3]&255)<<24|(ze[Pe+2]&255)<<16|(ze[Pe+1]&255)<<8|(ze[Pe+0]&255)<<0}const Xe=new Uint32Array(64*Ie),Ue=new Uint32Array(32*Ie*Te),$t=32*Ie,_e=new Uint32Array(16),se=new Uint32Array(16),ce=Fe*Te*2;let de=0,he=null,ve=!1,we=0,Ae=0,be,ue;const ge=He?parseInt(1e3/Ie):4294967295,Re=typeof setImmediate<"u"?setImmediate:setTimeout,Ne=function(){if(ve)return He(new Error("cancelled"),de/ce);let qe;switch(we){case 0:ue=Ae*32*Ie,xe(Je,ue,Xe,0,$t),we=1,be=0;case 1:qe=Te-be,qe>ge&&(qe=ge);for(let Ge=0;Ge<qe;Ge++)xe(Xe,0,Ue,(be+Ge)*$t,$t),le(Xe,$t,Ie,_e,se);if(be+=qe,de+=qe,He){const Ge=parseInt(1e3*de/ce);if(Ge!==he){if(ve=He(null,de/ce),ve)break;he=Ge}}if(be<Te)break;be=0,we=2;case 2:qe=Te-be,qe>ge&&(qe=ge);for(let Ge=0;Ge<qe;Ge++){const Ce=(2*Ie-1)*16,De=Xe[Ce]&Te-1;ye(Ue,De*$t,Xe,$t),le(Xe,$t,Ie,_e,se)}if(be+=qe,de+=qe,He){const Ge=parseInt(1e3*de/ce);if(Ge!==he){if(ve=He(null,de/ce),ve)break;he=Ge}}if(be<Te)break;if(xe(Xe,0,Je,ue,$t),Ae++,Ae<Fe){we=0;break}ze=[];for(let Ge=0;Ge<Je.length;Ge++)ze.push(Je[Ge]>>0&255),ze.push(Je[Ge]>>8&255),ze.push(Je[Ge]>>16&255),ze.push(Je[Ge]>>24&255);const Pe=ae($e,ze,Le);return He&&He(null,1,Pe),Pe}He&&Re(Ne)};if(!He)for(;;){const qe=Ne();if(qe!=null)return qe}Ne()}const Be={scrypt:function($e,ke,Te,Ie,Fe,Le,He){return new Promise(function(ze,Je){let Xe=0;He&&He(0),Me($e,ke,Te,Ie,Fe,Le,function(Ue,$t,_e){if(Ue)Je(Ue);else if(_e)He&&Xe!==1&&He(1),ze(new Uint8Array(_e));else if(He&&$t!==Xe)return Xe=$t,He($t)})})},syncScrypt:function($e,ke,Te,Ie,Fe,Le){return new Uint8Array(Me($e,ke,Te,Ie,Fe,Le))}};c.exports=Be})()})(scrypt$1);var scryptExports=scrypt$1.exports;const scrypt=getDefaultExportFromCjs$2(scryptExports);var __awaiter$g=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$9=new Logger(version$c);function hasMnemonic$1(c){return c!=null&&c.mnemonic&&c.mnemonic.phrase}class KeystoreAccount extends Description{isKeystoreAccount(t){return!!(t&&t._isKeystoreAccount)}}function _decrypt(c,t,n){if(searchPath(c,"crypto/cipher")==="aes-128-ctr"){const fe=looseArrayify(searchPath(c,"crypto/cipherparams/iv")),ae=new aes$1.Counter(fe),le=new aes$1.ModeOfOperation.ctr(t,ae);return arrayify(le.decrypt(n))}return null}function _getAccount(c,t){const n=looseArrayify(searchPath(c,"crypto/ciphertext"));if(hexlify(keccak256$1(concat$1([t.slice(16,32),n]))).substring(2)!==searchPath(c,"crypto/mac").toLowerCase())throw new Error("invalid password");const fe=_decrypt(c,t.slice(0,16),n);fe||logger$9.throwError("unsupported cipher",Logger.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const ae=t.slice(32,64),le=computeAddress(fe);if(c.address){let me=c.address.toLowerCase();if(me.substring(0,2)!=="0x"&&(me="0x"+me),getAddress(me)!==le)throw new Error("address mismatch")}const pe={_isKeystoreAccount:!0,address:le,privateKey:hexlify(fe)};if(searchPath(c,"x-ethers/version")==="0.1"){const me=looseArrayify(searchPath(c,"x-ethers/mnemonicCiphertext")),ye=looseArrayify(searchPath(c,"x-ethers/mnemonicCounter")),xe=new aes$1.Counter(ye),Ee=new aes$1.ModeOfOperation.ctr(ae,xe),Se=searchPath(c,"x-ethers/path")||defaultPath,Me=searchPath(c,"x-ethers/locale")||"en",Be=arrayify(Ee.decrypt(me));try{const $e=entropyToMnemonic(Be,Me),ke=HDNode.fromMnemonic($e,null,Me).derivePath(Se);if(ke.privateKey!=pe.privateKey)throw new Error("mnemonic mismatch");pe.mnemonic=ke.mnemonic}catch($e){if($e.code!==Logger.errors.INVALID_ARGUMENT||$e.argument!=="wordlist")throw $e}}return new KeystoreAccount(pe)}function pbkdf2Sync(c,t,n,ie,fe){return arrayify(pbkdf2$1(c,t,n,ie,fe))}function pbkdf2(c,t,n,ie,fe){return Promise.resolve(pbkdf2Sync(c,t,n,ie,fe))}function _computeKdfKey(c,t,n,ie,fe){const ae=getPassword(t),le=searchPath(c,"crypto/kdf");if(le&&typeof le=="string"){const pe=function(me,ye){return logger$9.throwArgumentError("invalid key-derivation function parameters",me,ye)};if(le.toLowerCase()==="scrypt"){const me=looseArrayify(searchPath(c,"crypto/kdfparams/salt")),ye=parseInt(searchPath(c,"crypto/kdfparams/n")),xe=parseInt(searchPath(c,"crypto/kdfparams/r")),Ee=parseInt(searchPath(c,"crypto/kdfparams/p"));(!ye||!xe||!Ee)&&pe("kdf",le),ye&ye-1&&pe("N",ye);const Se=parseInt(searchPath(c,"crypto/kdfparams/dklen"));return Se!==32&&pe("dklen",Se),ie(ae,me,ye,xe,Ee,64,fe)}else if(le.toLowerCase()==="pbkdf2"){const me=looseArrayify(searchPath(c,"crypto/kdfparams/salt"));let ye=null;const xe=searchPath(c,"crypto/kdfparams/prf");xe==="hmac-sha256"?ye="sha256":xe==="hmac-sha512"?ye="sha512":pe("prf",xe);const Ee=parseInt(searchPath(c,"crypto/kdfparams/c")),Se=parseInt(searchPath(c,"crypto/kdfparams/dklen"));return Se!==32&&pe("dklen",Se),n(ae,me,Ee,Se,ye)}}return logger$9.throwArgumentError("unsupported key-derivation function","kdf",le)}function decryptSync(c,t){const n=JSON.parse(c),ie=_computeKdfKey(n,t,pbkdf2Sync,scrypt.syncScrypt);return _getAccount(n,ie)}function decrypt(c,t,n){return __awaiter$g(this,void 0,void 0,function*(){const ie=JSON.parse(c),fe=yield _computeKdfKey(ie,t,pbkdf2,scrypt.scrypt,n);return _getAccount(ie,fe)})}function encrypt(c,t,n,ie){try{if(getAddress(c.address)!==computeAddress(c.privateKey))throw new Error("address/privateKey mismatch");if(hasMnemonic$1(c)){const ke=c.mnemonic;if(HDNode.fromMnemonic(ke.phrase,null,ke.locale).derivePath(ke.path||defaultPath).privateKey!=c.privateKey)throw new Error("mnemonic mismatch")}}catch(ke){return Promise.reject(ke)}typeof n=="function"&&!ie&&(ie=n,n={}),n||(n={});const fe=arrayify(c.privateKey),ae=getPassword(t);let le=null,pe=null,me=null;if(hasMnemonic$1(c)){const ke=c.mnemonic;le=arrayify(mnemonicToEntropy(ke.phrase,ke.locale||"en")),pe=ke.path||defaultPath,me=ke.locale||"en"}let ye=n.client;ye||(ye="ethers.js");let xe=null;n.salt?xe=arrayify(n.salt):xe=randomBytes$1(32);let Ee=null;if(n.iv){if(Ee=arrayify(n.iv),Ee.length!==16)throw new Error("invalid iv")}else Ee=randomBytes$1(16);let Se=null;if(n.uuid){if(Se=arrayify(n.uuid),Se.length!==16)throw new Error("invalid uuid")}else Se=randomBytes$1(16);let Me=1<<17,Be=8,$e=1;return n.scrypt&&(n.scrypt.N&&(Me=n.scrypt.N),n.scrypt.r&&(Be=n.scrypt.r),n.scrypt.p&&($e=n.scrypt.p)),scrypt.scrypt(ae,xe,Me,Be,$e,64,ie).then(ke=>{ke=arrayify(ke);const Te=ke.slice(0,16),Ie=ke.slice(16,32),Fe=ke.slice(32,64),Le=new aes$1.Counter(Ee),He=new aes$1.ModeOfOperation.ctr(Te,Le),ze=arrayify(He.encrypt(fe)),Je=keccak256$1(concat$1([Ie,ze])),Xe={address:c.address.substring(2).toLowerCase(),id:uuidV4(Se),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:hexlify(Ee).substring(2)},ciphertext:hexlify(ze).substring(2),kdf:"scrypt",kdfparams:{salt:hexlify(xe).substring(2),n:Me,dklen:32,p:$e,r:Be},mac:Je.substring(2)}};if(le){const Ue=randomBytes$1(16),$t=new aes$1.Counter(Ue),_e=new aes$1.ModeOfOperation.ctr(Fe,$t),se=arrayify(_e.encrypt(le)),ce=new Date,de=ce.getUTCFullYear()+"-"+zpad(ce.getUTCMonth()+1,2)+"-"+zpad(ce.getUTCDate(),2)+"T"+zpad(ce.getUTCHours(),2)+"-"+zpad(ce.getUTCMinutes(),2)+"-"+zpad(ce.getUTCSeconds(),2)+".0Z";Xe["x-ethers"]={client:ye,gethFilename:"UTC--"+de+"--"+Xe.address,mnemonicCounter:hexlify(Ue).substring(2),mnemonicCiphertext:hexlify(se).substring(2),path:pe,locale:me,version:"0.1"}}return JSON.stringify(Xe)})}function decryptJsonWallet(c,t,n){if(isCrowdsaleWallet(c)){n&&n(0);const ie=decrypt$1(c,t);return n&&n(1),Promise.resolve(ie)}return isKeystoreWallet(c)?decrypt(c,t,n):Promise.reject(new Error("invalid JSON wallet"))}function decryptJsonWalletSync(c,t){if(isCrowdsaleWallet(c))return decrypt$1(c,t);if(isKeystoreWallet(c))return decryptSync(c,t);throw new Error("invalid JSON wallet")}const lib_esm$4=Object.freeze(Object.defineProperty({__proto__:null,decryptCrowdsale:decrypt$1,decryptJsonWallet,decryptJsonWalletSync,decryptKeystore:decrypt,decryptKeystoreSync:decryptSync,encryptKeystore:encrypt,getJsonWalletAddress,isCrowdsaleWallet,isKeystoreWallet},Symbol.toStringTag,{value:"Module"})),version$b="wallet/5.8.0";var __awaiter$f=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$8=new Logger(version$b);function isAccount(c){return c!=null&&isHexString(c.privateKey,32)&&c.address!=null}function hasMnemonic(c){const t=c.mnemonic;return t&&t.phrase}class Wallet extends Signer{constructor(t,n){if(super(),isAccount(t)){const ie=new SigningKey(t.privateKey);if(defineReadOnly(this,"_signingKey",()=>ie),defineReadOnly(this,"address",computeAddress(this.publicKey)),this.address!==getAddress(t.address)&&logger$8.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),hasMnemonic(t)){const fe=t.mnemonic;defineReadOnly(this,"_mnemonic",()=>({phrase:fe.phrase,path:fe.path||defaultPath,locale:fe.locale||"en"}));const ae=this.mnemonic,le=HDNode.fromMnemonic(ae.phrase,null,ae.locale).derivePath(ae.path);computeAddress(le.privateKey)!==this.address&&logger$8.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else defineReadOnly(this,"_mnemonic",()=>null)}else{if(SigningKey.isSigningKey(t))t.curve!=="secp256k1"&&logger$8.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),defineReadOnly(this,"_signingKey",()=>t);else{typeof t=="string"&&t.match(/^[0-9a-f]*$/i)&&t.length===64&&(t="0x"+t);const ie=new SigningKey(t);defineReadOnly(this,"_signingKey",()=>ie)}defineReadOnly(this,"_mnemonic",()=>null),defineReadOnly(this,"address",computeAddress(this.publicKey))}n&&!Provider.isProvider(n)&&logger$8.throwArgumentError("invalid provider","provider",n),defineReadOnly(this,"provider",n||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(t){return new Wallet(this,t)}signTransaction(t){return resolveProperties(t).then(n=>{n.from!=null&&(getAddress(n.from)!==this.address&&logger$8.throwArgumentError("transaction from address mismatch","transaction.from",t.from),delete n.from);const ie=this._signingKey().signDigest(keccak256$1(serialize$1(n)));return serialize$1(n,ie)})}signMessage(t){return __awaiter$f(this,void 0,void 0,function*(){return joinSignature(this._signingKey().signDigest(hashMessage(t)))})}_signTypedData(t,n,ie){return __awaiter$f(this,void 0,void 0,function*(){const fe=yield TypedDataEncoder.resolveNames(t,n,ie,ae=>(this.provider==null&&logger$8.throwError("cannot resolve ENS names without a provider",Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:ae}),this.provider.resolveName(ae)));return joinSignature(this._signingKey().signDigest(TypedDataEncoder.hash(fe.domain,n,fe.value)))})}encrypt(t,n,ie){if(typeof n=="function"&&!ie&&(ie=n,n={}),ie&&typeof ie!="function")throw new Error("invalid callback");return n||(n={}),encrypt(this,t,n,ie)}static createRandom(t){let n=randomBytes$1(16);t||(t={}),t.extraEntropy&&(n=arrayify(hexDataSlice(keccak256$1(concat$1([n,t.extraEntropy])),0,16)));const ie=entropyToMnemonic(n,t.locale);return Wallet.fromMnemonic(ie,t.path,t.locale)}static fromEncryptedJson(t,n,ie){return decryptJsonWallet(t,n,ie).then(fe=>new Wallet(fe))}static fromEncryptedJsonSync(t,n){return new Wallet(decryptJsonWalletSync(t,n))}static fromMnemonic(t,n,ie){return n||(n=defaultPath),new Wallet(HDNode.fromMnemonic(t,null,ie).derivePath(n))}}function verifyMessage(c,t){return recoverAddress(hashMessage(c),t)}function verifyTypedData(c,t,n,ie){return recoverAddress(TypedDataEncoder.hash(c,t,n),ie)}const lib_esm$3=Object.freeze(Object.defineProperty({__proto__:null,Wallet,verifyMessage,verifyTypedData},Symbol.toStringTag,{value:"Module"})),version$a="networks/5.8.0",logger$7=new Logger(version$a);function isRenetworkable(c){return c&&typeof c.renetwork=="function"}function ethDefaultProvider(c){const t=function(n,ie){ie==null&&(ie={});const fe=[];if(n.InfuraProvider&&ie.infura!=="-")try{fe.push(new n.InfuraProvider(c,ie.infura))}catch{}if(n.EtherscanProvider&&ie.etherscan!=="-")try{fe.push(new n.EtherscanProvider(c,ie.etherscan))}catch{}if(n.AlchemyProvider&&ie.alchemy!=="-")try{fe.push(new n.AlchemyProvider(c,ie.alchemy))}catch{}if(n.PocketProvider&&ie.pocket!=="-"){const ae=["goerli","ropsten","rinkeby","sepolia"];try{const le=new n.PocketProvider(c,ie.pocket);le.network&&ae.indexOf(le.network.name)===-1&&fe.push(le)}catch{}}if(n.CloudflareProvider&&ie.cloudflare!=="-")try{fe.push(new n.CloudflareProvider(c))}catch{}if(n.AnkrProvider&&ie.ankr!=="-")try{const ae=["ropsten"],le=new n.AnkrProvider(c,ie.ankr);le.network&&ae.indexOf(le.network.name)===-1&&fe.push(le)}catch{}if(n.QuickNodeProvider&&ie.quicknode!=="-")try{fe.push(new n.QuickNodeProvider(c,ie.quicknode))}catch{}if(fe.length===0)return null;if(n.FallbackProvider){let ae=1;return ie.quorum!=null?ae=ie.quorum:c==="homestead"&&(ae=2),new n.FallbackProvider(fe,ae)}return fe[0]};return t.renetwork=function(n){return ethDefaultProvider(n)},t}function etcDefaultProvider(c,t){const n=function(ie,fe){return ie.JsonRpcProvider?new ie.JsonRpcProvider(c,t):null};return n.renetwork=function(ie){return etcDefaultProvider(c,ie)},n}const homestead={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:ethDefaultProvider("homestead")},ropsten={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:ethDefaultProvider("ropsten")},classicMordor={chainId:63,name:"classicMordor",_defaultProvider:etcDefaultProvider("https://www.ethercluster.com/mordor","classicMordor")},networks$2={unspecified:{chainId:0,name:"unspecified"},homestead,mainnet:homestead,morden:{chainId:2,name:"morden"},ropsten,testnet:ropsten,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:ethDefaultProvider("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:ethDefaultProvider("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:ethDefaultProvider("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"sepolia",_defaultProvider:ethDefaultProvider("sepolia")},holesky:{chainId:17e3,name:"holesky",_defaultProvider:ethDefaultProvider("holesky")},classic:{chainId:61,name:"classic",_defaultProvider:etcDefaultProvider("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor,classicTestnet:classicMordor,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:etcDefaultProvider("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:ethDefaultProvider("matic")},maticmum:{chainId:80001,name:"maticmum",_defaultProvider:ethDefaultProvider("maticmum")},optimism:{chainId:10,name:"optimism",_defaultProvider:ethDefaultProvider("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},"optimism-sepolia":{chainId:11155420,name:"optimism-sepolia"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},"arbitrum-sepolia":{chainId:421614,name:"arbitrum-sepolia"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function getNetwork(c){if(c==null)return null;if(typeof c=="number"){for(const ie in networks$2){const fe=networks$2[ie];if(fe.chainId===c)return{name:fe.name,chainId:fe.chainId,ensAddress:fe.ensAddress||null,_defaultProvider:fe._defaultProvider||null}}return{chainId:c,name:"unknown"}}if(typeof c=="string"){const ie=networks$2[c];return ie==null?null:{name:ie.name,chainId:ie.chainId,ensAddress:ie.ensAddress,_defaultProvider:ie._defaultProvider||null}}const t=networks$2[c.name];if(!t)return typeof c.chainId!="number"&&logger$7.throwArgumentError("invalid network chainId","network",c),c;c.chainId!==0&&c.chainId!==t.chainId&&logger$7.throwArgumentError("network chainId mismatch","network",c);let n=c._defaultProvider||null;return n==null&&t._defaultProvider&&(isRenetworkable(t._defaultProvider)?n=t._defaultProvider.renetwork(c):n=t._defaultProvider),{name:c.name,chainId:t.chainId,ensAddress:c.ensAddress||t.ensAddress||null,_defaultProvider:n}}const version$9="web/5.8.0";var __awaiter$e=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};function getUrl(c,t){return __awaiter$e(this,void 0,void 0,function*(){t==null&&(t={});const n={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(t.skipFetchSetup!==!0&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),t.fetchOptions!=null){const le=t.fetchOptions;le.mode&&(n.mode=le.mode),le.cache&&(n.cache=le.cache),le.credentials&&(n.credentials=le.credentials),le.redirect&&(n.redirect=le.redirect),le.referrer&&(n.referrer=le.referrer)}const ie=yield fetch(c,n),fe=yield ie.arrayBuffer(),ae={};return ie.headers.forEach?ie.headers.forEach((le,pe)=>{ae[pe.toLowerCase()]=le}):ie.headers.keys().forEach(le=>{ae[le.toLowerCase()]=ie.headers.get(le)}),{headers:ae,statusCode:ie.status,statusMessage:ie.statusText,body:arrayify(new Uint8Array(fe))}})}var __awaiter$d=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$6=new Logger(version$9);function staller(c){return new Promise(t=>{setTimeout(t,c)})}function bodyify(c,t){if(c==null)return null;if(typeof c=="string")return c;if(isBytesLike(c)){if(t&&(t.split("/")[0]==="text"||t.split(";")[0].trim()==="application/json"))try{return toUtf8String(c)}catch{}return hexlify(c)}return c}function unpercent(c){return toUtf8Bytes(c.replace(/%([0-9a-f][0-9a-f])/gi,(t,n)=>String.fromCharCode(parseInt(n,16))))}function _fetchData(c,t,n){const ie=typeof c=="object"&&c.throttleLimit!=null?c.throttleLimit:12;logger$6.assertArgument(ie>0&&ie%1===0,"invalid connection throttle limit","connection.throttleLimit",ie);const fe=typeof c=="object"?c.throttleCallback:null,ae=typeof c=="object"&&typeof c.throttleSlotInterval=="number"?c.throttleSlotInterval:100;logger$6.assertArgument(ae>0&&ae%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",ae);const le=typeof c=="object"?!!c.errorPassThrough:!1,pe={};let me=null;const ye={method:"GET"};let xe=!1,Ee=2*60*1e3;if(typeof c=="string")me=c;else if(typeof c=="object"){if((c==null||c.url==null)&&logger$6.throwArgumentError("missing URL","connection.url",c),me=c.url,typeof c.timeout=="number"&&c.timeout>0&&(Ee=c.timeout),c.headers)for(const Te in c.headers)pe[Te.toLowerCase()]={key:Te,value:String(c.headers[Te])},["if-none-match","if-modified-since"].indexOf(Te.toLowerCase())>=0&&(xe=!0);if(ye.allowGzip=!!c.allowGzip,c.user!=null&&c.password!=null){me.substring(0,6)!=="https:"&&c.allowInsecureAuthentication!==!0&&logger$6.throwError("basic authentication requires a secure https url",Logger.errors.INVALID_ARGUMENT,{argument:"url",url:me,user:c.user,password:"[REDACTED]"});const Te=c.user+":"+c.password;pe.authorization={key:"Authorization",value:"Basic "+encode$9(toUtf8Bytes(Te))}}c.skipFetchSetup!=null&&(ye.skipFetchSetup=!!c.skipFetchSetup),c.fetchOptions!=null&&(ye.fetchOptions=shallowCopy(c.fetchOptions))}const Se=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),Me=me?me.match(Se):null;if(Me)try{const Te={statusCode:200,statusMessage:"OK",headers:{"content-type":Me[1]||"text/plain"},body:Me[2]?decode$a(Me[3]):unpercent(Me[3])};let Ie=Te.body;return n&&(Ie=n(Te.body,Te)),Promise.resolve(Ie)}catch(Te){logger$6.throwError("processing response error",Logger.errors.SERVER_ERROR,{body:bodyify(Me[1],Me[2]),error:Te,requestBody:null,requestMethod:"GET",url:me})}t&&(ye.method="POST",ye.body=t,pe["content-type"]==null&&(pe["content-type"]={key:"Content-Type",value:"application/octet-stream"}),pe["content-length"]==null&&(pe["content-length"]={key:"Content-Length",value:String(t.length)}));const Be={};Object.keys(pe).forEach(Te=>{const Ie=pe[Te];Be[Ie.key]=Ie.value}),ye.headers=Be;const $e=function(){let Te=null;return{promise:new Promise(function(Le,He){Ee&&(Te=setTimeout(()=>{Te!=null&&(Te=null,He(logger$6.makeError("timeout",Logger.errors.TIMEOUT,{requestBody:bodyify(ye.body,Be["content-type"]),requestMethod:ye.method,timeout:Ee,url:me})))},Ee))}),cancel:function(){Te!=null&&(clearTimeout(Te),Te=null)}}}(),ke=function(){return __awaiter$d(this,void 0,void 0,function*(){for(let Te=0;Te<ie;Te++){let Ie=null;try{if(Ie=yield getUrl(me,ye),Te<ie){if(Ie.statusCode===301||Ie.statusCode===302){const Le=Ie.headers.location||"";if(ye.method==="GET"&&Le.match(/^https:/)){me=Ie.headers.location;continue}}else if(Ie.statusCode===429){let Le=!0;if(fe&&(Le=yield fe(Te,me)),Le){let He=0;const ze=Ie.headers["retry-after"];typeof ze=="string"&&ze.match(/^[1-9][0-9]*$/)?He=parseInt(ze)*1e3:He=ae*parseInt(String(Math.random()*Math.pow(2,Te))),yield staller(He);continue}}}}catch(Le){Ie=Le.response,Ie==null&&($e.cancel(),logger$6.throwError("missing response",Logger.errors.SERVER_ERROR,{requestBody:bodyify(ye.body,Be["content-type"]),requestMethod:ye.method,serverError:Le,url:me}))}let Fe=Ie.body;if(xe&&Ie.statusCode===304?Fe=null:!le&&(Ie.statusCode<200||Ie.statusCode>=300)&&($e.cancel(),logger$6.throwError("bad response",Logger.errors.SERVER_ERROR,{status:Ie.statusCode,headers:Ie.headers,body:bodyify(Fe,Ie.headers?Ie.headers["content-type"]:null),requestBody:bodyify(ye.body,Be["content-type"]),requestMethod:ye.method,url:me})),n)try{const Le=yield n(Fe,Ie);return $e.cancel(),Le}catch(Le){if(Le.throttleRetry&&Te<ie){let He=!0;if(fe&&(He=yield fe(Te,me)),He){const ze=ae*parseInt(String(Math.random()*Math.pow(2,Te)));yield staller(ze);continue}}$e.cancel(),logger$6.throwError("processing response error",Logger.errors.SERVER_ERROR,{body:bodyify(Fe,Ie.headers?Ie.headers["content-type"]:null),error:Le,requestBody:bodyify(ye.body,Be["content-type"]),requestMethod:ye.method,url:me})}return $e.cancel(),Fe}return logger$6.throwError("failed response",Logger.errors.SERVER_ERROR,{requestBody:bodyify(ye.body,Be["content-type"]),requestMethod:ye.method,url:me})})}();return Promise.race([$e.promise,ke])}function fetchJson(c,t,n){let ie=(ae,le)=>{let pe=null;if(ae!=null)try{pe=JSON.parse(toUtf8String(ae))}catch(me){logger$6.throwError("invalid JSON",Logger.errors.SERVER_ERROR,{body:ae,error:me})}return n&&(pe=n(pe,le)),pe},fe=null;if(t!=null){fe=toUtf8Bytes(t);const ae=typeof c=="string"?{url:c}:shallowCopy(c);ae.headers?Object.keys(ae.headers).filter(pe=>pe.toLowerCase()==="content-type").length!==0||(ae.headers=shallowCopy(ae.headers),ae.headers["content-type"]="application/json"):ae.headers={"content-type":"application/json"},c=ae}return _fetchData(c,fe,ie)}function poll(c,t){return t||(t={}),t=shallowCopy(t),t.floor==null&&(t.floor=0),t.ceiling==null&&(t.ceiling=1e4),t.interval==null&&(t.interval=250),new Promise(function(n,ie){let fe=null,ae=!1;const le=()=>ae?!1:(ae=!0,fe&&clearTimeout(fe),!0);t.timeout&&(fe=setTimeout(()=>{le()&&ie(new Error("timeout"))},t.timeout));const pe=t.retryLimit;let me=0;function ye(){return c().then(function(xe){if(xe!==void 0)le()&&n(xe);else if(t.oncePoll)t.oncePoll.once("poll",ye);else if(t.onceBlock)t.onceBlock.once("block",ye);else if(!ae){if(me++,me>pe){le()&&ie(new Error("retry limit reached"));return}let Ee=t.interval*parseInt(String(Math.random()*Math.pow(2,me)));Ee<t.floor&&(Ee=t.floor),Ee>t.ceiling&&(Ee=t.ceiling),setTimeout(ye,Ee)}return null},function(xe){le()&&ie(xe)})}ye()})}const lib_esm$2=Object.freeze(Object.defineProperty({__proto__:null,_fetchData,fetchJson,poll},Symbol.toStringTag,{value:"Module"}));var ALPHABET$2="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ALPHABET_MAP$1={};for(var z$3=0;z$3<ALPHABET$2.length;z$3++){var x$2=ALPHABET$2.charAt(z$3);if(ALPHABET_MAP$1[x$2]!==void 0)throw new TypeError(x$2+" is ambiguous");ALPHABET_MAP$1[x$2]=z$3}function polymodStep$1(c){var t=c>>25;return(c&33554431)<<5^-(t>>0&1)&996825010^-(t>>1&1)&642813549^-(t>>2&1)&513874426^-(t>>3&1)&1027748829^-(t>>4&1)&705979059}function prefixChk$1(c){for(var t=1,n=0;n<c.length;++n){var ie=c.charCodeAt(n);if(ie<33||ie>126)return"Invalid prefix ("+c+")";t=polymodStep$1(t)^ie>>5}for(t=polymodStep$1(t),n=0;n<c.length;++n){var fe=c.charCodeAt(n);t=polymodStep$1(t)^fe&31}return t}function encode$8(c,t,n){if(n=n||90,c.length+7+t.length>n)throw new TypeError("Exceeds length limit");c=c.toLowerCase();var ie=prefixChk$1(c);if(typeof ie=="string")throw new Error(ie);for(var fe=c+"1",ae=0;ae<t.length;++ae){var le=t[ae];if(le>>5)throw new Error("Non 5-bit word");ie=polymodStep$1(ie)^le,fe+=ALPHABET$2.charAt(le)}for(ae=0;ae<6;++ae)ie=polymodStep$1(ie);for(ie^=1,ae=0;ae<6;++ae){var pe=ie>>(5-ae)*5&31;fe+=ALPHABET$2.charAt(pe)}return fe}function __decode(c,t){if(t=t||90,c.length<8)return c+" too short";if(c.length>t)return"Exceeds length limit";var n=c.toLowerCase(),ie=c.toUpperCase();if(c!==n&&c!==ie)return"Mixed-case string "+c;c=n;var fe=c.lastIndexOf("1");if(fe===-1)return"No separator character for "+c;if(fe===0)return"Missing prefix for "+c;var ae=c.slice(0,fe),le=c.slice(fe+1);if(le.length<6)return"Data too short";var pe=prefixChk$1(ae);if(typeof pe=="string")return pe;for(var me=[],ye=0;ye<le.length;++ye){var xe=le.charAt(ye),Ee=ALPHABET_MAP$1[xe];if(Ee===void 0)return"Unknown character "+xe;pe=polymodStep$1(pe)^Ee,!(ye+6>=le.length)&&me.push(Ee)}return pe!==1?"Invalid checksum for "+c:{prefix:ae,words:me}}function decodeUnsafe(){var c=__decode.apply(null,arguments);if(typeof c=="object")return c}function decode$9(c){var t=__decode.apply(null,arguments);if(typeof t=="object")return t;throw new Error(t)}function convert$1(c,t,n,ie){for(var fe=0,ae=0,le=(1<<n)-1,pe=[],me=0;me<c.length;++me)for(fe=fe<<t|c[me],ae+=t;ae>=n;)ae-=n,pe.push(fe>>ae&le);if(ie)ae>0&&pe.push(fe<<n-ae&le);else{if(ae>=t)return"Excess padding";if(fe<<n-ae&le)return"Non-zero padding"}return pe}function toWordsUnsafe(c){var t=convert$1(c,8,5,!0);if(Array.isArray(t))return t}function toWords$1(c){var t=convert$1(c,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)}function fromWordsUnsafe$1(c){var t=convert$1(c,5,8,!1);if(Array.isArray(t))return t}function fromWords$1(c){var t=convert$1(c,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}var bech32$1={decodeUnsafe,decode:decode$9,encode:encode$8,toWordsUnsafe,toWords:toWords$1,fromWordsUnsafe:fromWordsUnsafe$1,fromWords:fromWords$1};const bech32$2=getDefaultExportFromCjs$2(bech32$1),version$8="providers/5.8.0",logger$5=new Logger(version$8);class Formatter{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},n=this.address.bind(this),ie=this.bigNumber.bind(this),fe=this.blockTag.bind(this),ae=this.data.bind(this),le=this.hash.bind(this),pe=this.hex.bind(this),me=this.number.bind(this),ye=this.type.bind(this),xe=Ee=>this.data(Ee,!0);return t.transaction={hash:le,type:ye,accessList:Formatter.allowNull(this.accessList.bind(this),null),blockHash:Formatter.allowNull(le,null),blockNumber:Formatter.allowNull(me,null),transactionIndex:Formatter.allowNull(me,null),confirmations:Formatter.allowNull(me,null),from:n,gasPrice:Formatter.allowNull(ie),maxPriorityFeePerGas:Formatter.allowNull(ie),maxFeePerGas:Formatter.allowNull(ie),gasLimit:ie,to:Formatter.allowNull(n,null),value:ie,nonce:me,data:ae,r:Formatter.allowNull(this.uint256),s:Formatter.allowNull(this.uint256),v:Formatter.allowNull(me),creates:Formatter.allowNull(n,null),raw:Formatter.allowNull(ae)},t.transactionRequest={from:Formatter.allowNull(n),nonce:Formatter.allowNull(me),gasLimit:Formatter.allowNull(ie),gasPrice:Formatter.allowNull(ie),maxPriorityFeePerGas:Formatter.allowNull(ie),maxFeePerGas:Formatter.allowNull(ie),to:Formatter.allowNull(n),value:Formatter.allowNull(ie),data:Formatter.allowNull(xe),type:Formatter.allowNull(me),accessList:Formatter.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:me,blockNumber:me,transactionHash:le,address:n,topics:Formatter.arrayOf(le),data:ae,logIndex:me,blockHash:le},t.receipt={to:Formatter.allowNull(this.address,null),from:Formatter.allowNull(this.address,null),contractAddress:Formatter.allowNull(n,null),transactionIndex:me,root:Formatter.allowNull(pe),gasUsed:ie,logsBloom:Formatter.allowNull(ae),blockHash:le,transactionHash:le,logs:Formatter.arrayOf(this.receiptLog.bind(this)),blockNumber:me,confirmations:Formatter.allowNull(me,null),cumulativeGasUsed:ie,effectiveGasPrice:Formatter.allowNull(ie),status:Formatter.allowNull(me),type:ye},t.block={hash:Formatter.allowNull(le),parentHash:le,number:me,timestamp:me,nonce:Formatter.allowNull(pe),difficulty:this.difficulty.bind(this),gasLimit:ie,gasUsed:ie,miner:Formatter.allowNull(n),extraData:ae,transactions:Formatter.allowNull(Formatter.arrayOf(le)),baseFeePerGas:Formatter.allowNull(ie)},t.blockWithTransactions=shallowCopy(t.block),t.blockWithTransactions.transactions=Formatter.allowNull(Formatter.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Formatter.allowNull(fe,void 0),toBlock:Formatter.allowNull(fe,void 0),blockHash:Formatter.allowNull(le,void 0),address:Formatter.allowNull(n,void 0),topics:Formatter.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Formatter.allowNull(me),blockHash:Formatter.allowNull(le),transactionIndex:me,removed:Formatter.allowNull(this.boolean.bind(this)),address:n,data:Formatter.allowFalsish(ae,"0x"),topics:Formatter.arrayOf(le),transactionHash:le,logIndex:me},t}accessList(t){return accessListify(t||[])}number(t){return t==="0x"?0:BigNumber.from(t).toNumber()}type(t){return t==="0x"||t==null?0:BigNumber.from(t).toNumber()}bigNumber(t){return BigNumber.from(t)}boolean(t){if(typeof t=="boolean")return t;if(typeof t=="string"){if(t=t.toLowerCase(),t==="true")return!0;if(t==="false")return!1}throw new Error("invalid boolean - "+t)}hex(t,n){return typeof t=="string"&&(!n&&t.substring(0,2)!=="0x"&&(t="0x"+t),isHexString(t))?t.toLowerCase():logger$5.throwArgumentError("invalid hash","value",t)}data(t,n){const ie=this.hex(t,n);if(ie.length%2!==0)throw new Error("invalid data; odd-length - "+t);return ie}address(t){return getAddress(t)}callAddress(t){if(!isHexString(t,32))return null;const n=getAddress(hexDataSlice(t,12));return n===AddressZero?null:n}contractAddress(t){return getContractAddress(t)}blockTag(t){if(t==null)return"latest";if(t==="earliest")return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if(typeof t=="number"||isHexString(t))return hexValue(t);throw new Error("invalid blockTag")}hash(t,n){const ie=this.hex(t,n);return hexDataLength(ie)!==32?logger$5.throwArgumentError("invalid hash","value",t):ie}difficulty(t){if(t==null)return null;const n=BigNumber.from(t);try{return n.toNumber()}catch{}return null}uint256(t){if(!isHexString(t))throw new Error("invalid uint256");return hexZeroPad(t,32)}_block(t,n){t.author!=null&&t.miner==null&&(t.miner=t.author);const ie=t._difficulty!=null?t._difficulty:t.difficulty,fe=Formatter.check(n,t);return fe._difficulty=ie==null?null:BigNumber.from(ie),fe}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Formatter.check(this.formats.transactionRequest,t)}transactionResponse(t){t.gas!=null&&t.gasLimit==null&&(t.gasLimit=t.gas),t.to&&BigNumber.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),t.input!=null&&t.data==null&&(t.data=t.input),t.to==null&&t.creates==null&&(t.creates=this.contractAddress(t)),(t.type===1||t.type===2)&&t.accessList==null&&(t.accessList=[]);const n=Formatter.check(this.formats.transaction,t);if(t.chainId!=null){let ie=t.chainId;isHexString(ie)&&(ie=BigNumber.from(ie).toNumber()),n.chainId=ie}else{let ie=t.networkId;ie==null&&n.v==null&&(ie=t.chainId),isHexString(ie)&&(ie=BigNumber.from(ie).toNumber()),typeof ie!="number"&&n.v!=null&&(ie=(n.v-35)/2,ie<0&&(ie=0),ie=parseInt(ie)),typeof ie!="number"&&(ie=0),n.chainId=ie}return n.blockHash&&n.blockHash.replace(/0/g,"")==="x"&&(n.blockHash=null),n}transaction(t){return parse$2(t)}receiptLog(t){return Formatter.check(this.formats.receiptLog,t)}receipt(t){const n=Formatter.check(this.formats.receipt,t);if(n.root!=null)if(n.root.length<=4){const ie=BigNumber.from(n.root).toNumber();ie===0||ie===1?(n.status!=null&&n.status!==ie&&logger$5.throwArgumentError("alt-root-status/status mismatch","value",{root:n.root,status:n.status}),n.status=ie,delete n.root):logger$5.throwArgumentError("invalid alt-root-status","value.root",n.root)}else n.root.length!==66&&logger$5.throwArgumentError("invalid root hash","value.root",n.root);return n.status!=null&&(n.byzantium=!0),n}topics(t){return Array.isArray(t)?t.map(n=>this.topics(n)):t!=null?this.hash(t,!0):null}filter(t){return Formatter.check(this.formats.filter,t)}filterLog(t){return Formatter.check(this.formats.filterLog,t)}static check(t,n){const ie={};for(const fe in t)try{const ae=t[fe](n[fe]);ae!==void 0&&(ie[fe]=ae)}catch(ae){throw ae.checkKey=fe,ae.checkValue=n[fe],ae}return ie}static allowNull(t,n){return function(ie){return ie==null?n:t(ie)}}static allowFalsish(t,n){return function(ie){return ie?t(ie):n}}static arrayOf(t){return function(n){if(!Array.isArray(n))throw new Error("not an array");const ie=[];return n.forEach(function(fe){ie.push(t(fe))}),ie}}}var __awaiter$c=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$4=new Logger(version$8),MAX_CCIP_REDIRECTS=10;function checkTopic(c){return c==null?"null":(hexDataLength(c)!==32&&logger$4.throwArgumentError("invalid topic","topic",c),c.toLowerCase())}function serializeTopics(c){for(c=c.slice();c.length>0&&c[c.length-1]==null;)c.pop();return c.map(t=>{if(Array.isArray(t)){const n={};t.forEach(fe=>{n[checkTopic(fe)]=!0});const ie=Object.keys(n);return ie.sort(),ie.join("|")}else return checkTopic(t)}).join("&")}function deserializeTopics(c){return c===""?[]:c.split(/&/g).map(t=>{if(t==="")return[];const n=t.split("|").map(ie=>ie==="null"?null:ie);return n.length===1?n[0]:n})}function getEventTag(c){if(typeof c=="string"){if(c=c.toLowerCase(),hexDataLength(c)===32)return"tx:"+c;if(c.indexOf(":")===-1)return c}else{if(Array.isArray(c))return"filter:*:"+serializeTopics(c);if(ForkEvent.isForkEvent(c))throw logger$4.warn("not implemented"),new Error("not implemented");if(c&&typeof c=="object")return"filter:"+(c.address||"*")+":"+serializeTopics(c.topics||[])}throw new Error("invalid event - "+c)}function getTime(){return new Date().getTime()}function stall(c){return new Promise(t=>{setTimeout(t,c)})}const PollableEvents=["block","network","pending","poll"];let Event$1=class{constructor(t,n,ie){defineReadOnly(this,"tag",t),defineReadOnly(this,"listener",n),defineReadOnly(this,"once",ie),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return t[0]!=="tx"?null:t[1]}get filter(){const t=this.tag.split(":");if(t[0]!=="filter")return null;const n=t[1],ie=deserializeTopics(t[2]),fe={};return ie.length>0&&(fe.topics=ie),n&&n!=="*"&&(fe.address=n),fe}pollable(){return this.tag.indexOf(":")>=0||PollableEvents.indexOf(this.tag)>=0}};const coinInfos={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function bytes32ify(c){return hexZeroPad(BigNumber.from(c).toHexString(),32)}function base58Encode(c){return Base58.encode(concat$1([c,hexDataSlice(sha256$7(sha256$7(c)),0,4)]))}const matcherIpfs=new RegExp("^(ipfs)://(.*)$","i"),matchers=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),matcherIpfs,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function _parseString(c,t){try{return toUtf8String(_parseBytes(c,t))}catch{}return null}function _parseBytes(c,t){if(c==="0x")return null;const n=BigNumber.from(hexDataSlice(c,t,t+32)).toNumber(),ie=BigNumber.from(hexDataSlice(c,n,n+32)).toNumber();return hexDataSlice(c,n+32,n+32+ie)}function getIpfsLink(c){return c.match(/^ipfs:\/\/ipfs\//i)?c=c.substring(12):c.match(/^ipfs:\/\//i)?c=c.substring(7):logger$4.throwArgumentError("unsupported IPFS format","link",c),`https://gateway.ipfs.io/ipfs/${c}`}function numPad(c){const t=arrayify(c);if(t.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(t,32-t.length),n}function bytesPad(c){if(c.length%32===0)return c;const t=new Uint8Array(Math.ceil(c.length/32)*32);return t.set(c),t}function encodeBytes(c){const t=[];let n=0;for(let ie=0;ie<c.length;ie++)t.push(null),n+=32;for(let ie=0;ie<c.length;ie++){const fe=arrayify(c[ie]);t[ie]=numPad(n),t.push(numPad(fe.length)),t.push(bytesPad(fe)),n+=32+Math.ceil(fe.length/32)*32}return hexConcat(t)}class Resolver{constructor(t,n,ie,fe){defineReadOnly(this,"provider",t),defineReadOnly(this,"name",ie),defineReadOnly(this,"address",t.formatter.address(n)),defineReadOnly(this,"_resolvedAddress",fe)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(t=>BigNumber.from(t).eq(1)).catch(t=>{if(t.code===Logger.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t})),this._supportsEip2544}_fetch(t,n){return __awaiter$c(this,void 0,void 0,function*(){const ie={to:this.address,ccipReadEnabled:!0,data:hexConcat([t,namehash$1(this.name),n||"0x"])};let fe=!1;(yield this.supportsWildcard())&&(fe=!0,ie.data=hexConcat(["0x9061b923",encodeBytes([dnsEncode(this.name),ie.data])]));try{let ae=yield this.provider.call(ie);return arrayify(ae).length%32===4&&logger$4.throwError("resolver threw error",Logger.errors.CALL_EXCEPTION,{transaction:ie,data:ae}),fe&&(ae=_parseBytes(ae,0)),ae}catch(ae){if(ae.code===Logger.errors.CALL_EXCEPTION)return null;throw ae}})}_fetchBytes(t,n){return __awaiter$c(this,void 0,void 0,function*(){const ie=yield this._fetch(t,n);return ie!=null?_parseBytes(ie,0):null})}_getAddress(t,n){const ie=coinInfos[String(t)];if(ie==null&&logger$4.throwError(`unsupported coin type: ${t}`,Logger.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),ie.ilk==="eth")return this.provider.formatter.address(n);const fe=arrayify(n);if(ie.p2pkh!=null){const ae=n.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(ae){const le=parseInt(ae[1],16);if(ae[2].length===le*2&&le>=1&&le<=75)return base58Encode(concat$1([[ie.p2pkh],"0x"+ae[2]]))}}if(ie.p2sh!=null){const ae=n.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(ae){const le=parseInt(ae[1],16);if(ae[2].length===le*2&&le>=1&&le<=75)return base58Encode(concat$1([[ie.p2sh],"0x"+ae[2]]))}}if(ie.prefix!=null){const ae=fe[1];let le=fe[0];if(le===0?ae!==20&&ae!==32&&(le=-1):le=-1,le>=0&&fe.length===2+ae&&ae>=1&&ae<=75){const pe=bech32$2.toWords(fe.slice(2));return pe.unshift(le),bech32$2.encode(ie.prefix,pe)}}return null}getAddress(t){return __awaiter$c(this,void 0,void 0,function*(){if(t==null&&(t=60),t===60)try{const fe=yield this._fetch("0x3b3b57de");return fe==="0x"||fe===HashZero?null:this.provider.formatter.callAddress(fe)}catch(fe){if(fe.code===Logger.errors.CALL_EXCEPTION)return null;throw fe}const n=yield this._fetchBytes("0xf1cb7e06",bytes32ify(t));if(n==null||n==="0x")return null;const ie=this._getAddress(t,n);return ie==null&&logger$4.throwError("invalid or unsupported coin data",Logger.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:n}),ie})}getAvatar(){return __awaiter$c(this,void 0,void 0,function*(){const t=[{type:"name",content:this.name}];try{const n=yield this.getText("avatar");if(n==null)return null;for(let ie=0;ie<matchers.length;ie++){const fe=n.match(matchers[ie]);if(fe==null)continue;const ae=fe[1].toLowerCase();switch(ae){case"https":return t.push({type:"url",content:n}),{linkage:t,url:n};case"data":return t.push({type:"data",content:n}),{linkage:t,url:n};case"ipfs":return t.push({type:"ipfs",content:n}),{linkage:t,url:getIpfsLink(n)};case"erc721":case"erc1155":{const le=ae==="erc721"?"0xc87b56dd":"0x0e89341c";t.push({type:ae,content:n});const pe=this._resolvedAddress||(yield this.getAddress()),me=(fe[2]||"").split("/");if(me.length!==2)return null;const ye=yield this.provider.formatter.address(me[0]),xe=hexZeroPad(BigNumber.from(me[1]).toHexString(),32);if(ae==="erc721"){const $e=this.provider.formatter.callAddress(yield this.provider.call({to:ye,data:hexConcat(["0x6352211e",xe])}));if(pe!==$e)return null;t.push({type:"owner",content:$e})}else if(ae==="erc1155"){const $e=BigNumber.from(yield this.provider.call({to:ye,data:hexConcat(["0x00fdd58e",hexZeroPad(pe,32),xe])}));if($e.isZero())return null;t.push({type:"balance",content:$e.toString()})}const Ee={to:this.provider.formatter.address(me[0]),data:hexConcat([le,xe])};let Se=_parseString(yield this.provider.call(Ee),0);if(Se==null)return null;t.push({type:"metadata-url-base",content:Se}),ae==="erc1155"&&(Se=Se.replace("{id}",xe.substring(2)),t.push({type:"metadata-url-expanded",content:Se})),Se.match(/^ipfs:/i)&&(Se=getIpfsLink(Se)),t.push({type:"metadata-url",content:Se});const Me=yield fetchJson(Se);if(!Me)return null;t.push({type:"metadata",content:JSON.stringify(Me)});let Be=Me.image;if(typeof Be!="string")return null;if(!Be.match(/^(https:\/\/|data:)/i)){if(Be.match(matcherIpfs)==null)return null;t.push({type:"url-ipfs",content:Be}),Be=getIpfsLink(Be)}return t.push({type:"url",content:Be}),{linkage:t,url:Be}}}}}catch{}return null})}getContentHash(){return __awaiter$c(this,void 0,void 0,function*(){const t=yield this._fetchBytes("0xbc1c58d1");if(t==null||t==="0x")return null;const n=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const le=parseInt(n[3],16);if(n[4].length===le*2)return"ipfs://"+Base58.encode("0x"+n[1])}const ie=t.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(ie){const le=parseInt(ie[3],16);if(ie[4].length===le*2)return"ipns://"+Base58.encode("0x"+ie[1])}const fe=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(fe&&fe[1].length===32*2)return"bzz://"+fe[1];const ae=t.match(/^0x90b2c605([0-9a-f]*)$/);if(ae&&ae[1].length===34*2){const le={"=":"","+":"-","/":"_"};return"sia://"+encode$9("0x"+ae[1]).replace(/[=+\/]/g,me=>le[me])}return logger$4.throwError("invalid or unsupported content hash data",Logger.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})})}getText(t){return __awaiter$c(this,void 0,void 0,function*(){let n=toUtf8Bytes(t);n=concat$1([bytes32ify(64),bytes32ify(n.length),n]),n.length%32!==0&&(n=concat$1([n,hexZeroPad("0x",32-t.length%32)]));const ie=yield this._fetchBytes("0x59d1d43c",hexlify(n));return ie==null||ie==="0x"?null:toUtf8String(ie)})}}let defaultFormatter=null,nextPollId=1;class BaseProvider extends Provider{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),defineReadOnly(this,"anyNetwork",t==="any"),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch(n=>{}),this._ready().catch(n=>{});else{const n=getStatic(new.target,"getNetwork")(t);n?(defineReadOnly(this,"_network",n),this.emit("network",n,null)):logger$4.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return __awaiter$c(this,void 0,void 0,function*(){if(this._network==null){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch{}t==null&&(t=yield this.detectNetwork()),t||logger$4.throwError("no network detected",Logger.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=t:defineReadOnly(this,"_network",t),this.emit("network",t,null))}return this._network})}get ready(){return poll(()=>this._ready().then(t=>t,t=>{if(!(t.code===Logger.errors.NETWORK_ERROR&&t.event==="noNetwork"))throw t}))}static getFormatter(){return defaultFormatter==null&&(defaultFormatter=new Formatter),defaultFormatter}static getNetwork(t){return getNetwork(t??"homestead")}ccipReadFetch(t,n,ie){return __awaiter$c(this,void 0,void 0,function*(){if(this.disableCcipRead||ie.length===0)return null;const fe=t.to.toLowerCase(),ae=n.toLowerCase(),le=[];for(let pe=0;pe<ie.length;pe++){const me=ie[pe],ye=me.replace("{sender}",fe).replace("{data}",ae),xe=me.indexOf("{data}")>=0?null:JSON.stringify({data:ae,sender:fe}),Ee=yield fetchJson({url:ye,errorPassThrough:!0},xe,(Me,Be)=>(Me.status=Be.statusCode,Me));if(Ee.data)return Ee.data;const Se=Ee.message||"unknown error";if(Ee.status>=400&&Ee.status<500)return logger$4.throwError(`response not found during CCIP fetch: ${Se}`,Logger.errors.SERVER_ERROR,{url:me,errorMessage:Se});le.push(Se)}return logger$4.throwError(`error encountered during CCIP fetch: ${le.map(pe=>JSON.stringify(pe)).join(", ")}`,Logger.errors.SERVER_ERROR,{urls:ie,errorMessages:le})})}_getInternalBlockNumber(t){return __awaiter$c(this,void 0,void 0,function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const fe=this._internalBlockNumber;try{const ae=yield fe;if(getTime()-ae.respTime<=t)return ae.blockNumber;break}catch{if(this._internalBlockNumber===fe)break}}const n=getTime(),ie=resolveProperties({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(fe=>null,fe=>fe)}).then(({blockNumber:fe,networkError:ae})=>{if(ae)throw this._internalBlockNumber===ie&&(this._internalBlockNumber=null),ae;const le=getTime();return fe=BigNumber.from(fe).toNumber(),fe<this._maxInternalBlockNumber&&(fe=this._maxInternalBlockNumber),this._maxInternalBlockNumber=fe,this._setFastBlockNumber(fe),{blockNumber:fe,reqTime:n,respTime:le}});return this._internalBlockNumber=ie,ie.catch(fe=>{this._internalBlockNumber===ie&&(this._internalBlockNumber=null)}),(yield ie).blockNumber})}poll(){return __awaiter$c(this,void 0,void 0,function*(){const t=nextPollId++,n=[];let ie=null;try{ie=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(fe){this.emit("error",fe);return}if(this._setFastBlockNumber(ie),this.emit("poll",t,ie),ie===this._lastBlockNumber){this.emit("didPoll",t);return}if(this._emitted.block===-2&&(this._emitted.block=ie-1),Math.abs(this._emitted.block-ie)>1e3)logger$4.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${ie})`),this.emit("error",logger$4.makeError("network block skew detected",Logger.errors.NETWORK_ERROR,{blockNumber:ie,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",ie);else for(let fe=this._emitted.block+1;fe<=ie;fe++)this.emit("block",fe);this._emitted.block!==ie&&(this._emitted.block=ie,Object.keys(this._emitted).forEach(fe=>{if(fe==="block")return;const ae=this._emitted[fe];ae!=="pending"&&ie-ae>12&&delete this._emitted[fe]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=ie-1),this._events.forEach(fe=>{switch(fe.type){case"tx":{const ae=fe.hash;let le=this.getTransactionReceipt(ae).then(pe=>(!pe||pe.blockNumber==null||(this._emitted["t:"+ae]=pe.blockNumber,this.emit(ae,pe)),null)).catch(pe=>{this.emit("error",pe)});n.push(le);break}case"filter":{if(!fe._inflight){fe._inflight=!0,fe._lastBlockNumber===-2&&(fe._lastBlockNumber=ie-1);const ae=fe.filter;ae.fromBlock=fe._lastBlockNumber+1,ae.toBlock=ie;const le=ae.toBlock-this._maxFilterBlockRange;le>ae.fromBlock&&(ae.fromBlock=le),ae.fromBlock<0&&(ae.fromBlock=0);const pe=this.getLogs(ae).then(me=>{fe._inflight=!1,me.length!==0&&me.forEach(ye=>{ye.blockNumber>fe._lastBlockNumber&&(fe._lastBlockNumber=ye.blockNumber),this._emitted["b:"+ye.blockHash]=ye.blockNumber,this._emitted["t:"+ye.transactionHash]=ye.blockNumber,this.emit(ae,ye)})}).catch(me=>{this.emit("error",me),fe._inflight=!1});n.push(pe)}break}}}),this._lastBlockNumber=ie,Promise.all(n).then(()=>{this.emit("didPoll",t)}).catch(fe=>{this.emit("error",fe)})})}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return __awaiter$c(this,void 0,void 0,function*(){return logger$4.throwError("provider does not support network detection",Logger.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return __awaiter$c(this,void 0,void 0,function*(){const t=yield this._ready(),n=yield this.detectNetwork();if(t.chainId!==n.chainId){if(this.anyNetwork)return this._network=n,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",n,t),yield stall(0),this._network;const ie=logger$4.makeError("underlying network changed",Logger.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:n});throw this.emit("error",ie),ie}return t})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(t=>{this._setFastBlockNumber(t)},t=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(t){t&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if(typeof t!="number"||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const t=getTime();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then(n=>((this._fastBlockNumber==null||n>this._fastBlockNumber)&&(this._fastBlockNumber=n),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(t){this._fastBlockNumber!=null&&t<this._fastBlockNumber||(this._fastQueryDate=getTime(),(this._fastBlockNumber==null||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,n,ie){return __awaiter$c(this,void 0,void 0,function*(){return this._waitForTransaction(t,n??1,ie||0,null)})}_waitForTransaction(t,n,ie,fe){return __awaiter$c(this,void 0,void 0,function*(){const ae=yield this.getTransactionReceipt(t);return(ae?ae.confirmations:0)>=n?ae:new Promise((le,pe)=>{const me=[];let ye=!1;const xe=function(){return ye?!0:(ye=!0,me.forEach(Se=>{Se()}),!1)},Ee=Se=>{Se.confirmations<n||xe()||le(Se)};if(this.on(t,Ee),me.push(()=>{this.removeListener(t,Ee)}),fe){let Se=fe.startBlock,Me=null;const Be=$e=>__awaiter$c(this,void 0,void 0,function*(){ye||(yield stall(1e3),this.getTransactionCount(fe.from).then(ke=>__awaiter$c(this,void 0,void 0,function*(){if(!ye){if(ke<=fe.nonce)Se=$e;else{{const Te=yield this.getTransaction(t);if(Te&&Te.blockNumber!=null)return}for(Me==null&&(Me=Se-3,Me<fe.startBlock&&(Me=fe.startBlock));Me<=$e;){if(ye)return;const Te=yield this.getBlockWithTransactions(Me);for(let Ie=0;Ie<Te.transactions.length;Ie++){const Fe=Te.transactions[Ie];if(Fe.hash===t)return;if(Fe.from===fe.from&&Fe.nonce===fe.nonce){if(ye)return;const Le=yield this.waitForTransaction(Fe.hash,n);if(xe())return;let He="replaced";Fe.data===fe.data&&Fe.to===fe.to&&Fe.value.eq(fe.value)?He="repriced":Fe.data==="0x"&&Fe.from===Fe.to&&Fe.value.isZero()&&(He="cancelled"),pe(logger$4.makeError("transaction was replaced",Logger.errors.TRANSACTION_REPLACED,{cancelled:He==="replaced"||He==="cancelled",reason:He,replacement:this._wrapTransaction(Fe),hash:t,receipt:Le}));return}}Me++}}ye||this.once("block",Be)}}),ke=>{ye||this.once("block",Be)}))});if(ye)return;this.once("block",Be),me.push(()=>{this.removeListener("block",Be)})}if(typeof ie=="number"&&ie>0){const Se=setTimeout(()=>{xe()||pe(logger$4.makeError("timeout exceeded",Logger.errors.TIMEOUT,{timeout:ie}))},ie);Se.unref&&Se.unref(),me.push(()=>{clearTimeout(Se)})}})})}getBlockNumber(){return __awaiter$c(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return BigNumber.from(t)}catch(n){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:n})}})}getBalance(t,n){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const ie=yield resolveProperties({address:this._getAddress(t),blockTag:this._getBlockTag(n)}),fe=yield this.perform("getBalance",ie);try{return BigNumber.from(fe)}catch(ae){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"getBalance",params:ie,result:fe,error:ae})}})}getTransactionCount(t,n){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const ie=yield resolveProperties({address:this._getAddress(t),blockTag:this._getBlockTag(n)}),fe=yield this.perform("getTransactionCount",ie);try{return BigNumber.from(fe).toNumber()}catch(ae){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"getTransactionCount",params:ie,result:fe,error:ae})}})}getCode(t,n){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const ie=yield resolveProperties({address:this._getAddress(t),blockTag:this._getBlockTag(n)}),fe=yield this.perform("getCode",ie);try{return hexlify(fe)}catch(ae){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"getCode",params:ie,result:fe,error:ae})}})}getStorageAt(t,n,ie){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const fe=yield resolveProperties({address:this._getAddress(t),blockTag:this._getBlockTag(ie),position:Promise.resolve(n).then(le=>hexValue(le))}),ae=yield this.perform("getStorageAt",fe);try{return hexlify(ae)}catch(le){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"getStorageAt",params:fe,result:ae,error:le})}})}_wrapTransaction(t,n,ie){if(n!=null&&hexDataLength(n)!==32)throw new Error("invalid response - sendTransaction");const fe=t;return n!=null&&t.hash!==n&&logger$4.throwError("Transaction hash mismatch from Provider.sendTransaction.",Logger.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:n}),fe.wait=(ae,le)=>__awaiter$c(this,void 0,void 0,function*(){ae==null&&(ae=1),le==null&&(le=0);let pe;ae!==0&&ie!=null&&(pe={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:ie});const me=yield this._waitForTransaction(t.hash,ae,le,pe);return me==null&&ae===0?null:(this._emitted["t:"+t.hash]=me.blockNumber,me.status===0&&logger$4.throwError("transaction failed",Logger.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:me}),me)}),fe}sendTransaction(t){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield Promise.resolve(t).then(ae=>hexlify(ae)),ie=this.formatter.transaction(t);ie.confirmations==null&&(ie.confirmations=0);const fe=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const ae=yield this.perform("sendTransaction",{signedTransaction:n});return this._wrapTransaction(ie,ae,fe)}catch(ae){throw ae.transaction=ie,ae.transactionHash=ie.hash,ae}})}_getTransactionRequest(t){return __awaiter$c(this,void 0,void 0,function*(){const n=yield t,ie={};return["from","to"].forEach(fe=>{n[fe]!=null&&(ie[fe]=Promise.resolve(n[fe]).then(ae=>ae?this._getAddress(ae):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(fe=>{n[fe]!=null&&(ie[fe]=Promise.resolve(n[fe]).then(ae=>ae?BigNumber.from(ae):null))}),["type"].forEach(fe=>{n[fe]!=null&&(ie[fe]=Promise.resolve(n[fe]).then(ae=>ae??null))}),n.accessList&&(ie.accessList=this.formatter.accessList(n.accessList)),["data"].forEach(fe=>{n[fe]!=null&&(ie[fe]=Promise.resolve(n[fe]).then(ae=>ae?hexlify(ae):null))}),this.formatter.transactionRequest(yield resolveProperties(ie))})}_getFilter(t){return __awaiter$c(this,void 0,void 0,function*(){t=yield t;const n={};return t.address!=null&&(n.address=this._getAddress(t.address)),["blockHash","topics"].forEach(ie=>{t[ie]!=null&&(n[ie]=t[ie])}),["fromBlock","toBlock"].forEach(ie=>{t[ie]!=null&&(n[ie]=this._getBlockTag(t[ie]))}),this.formatter.filter(yield resolveProperties(n))})}_call(t,n,ie){return __awaiter$c(this,void 0,void 0,function*(){ie>=MAX_CCIP_REDIRECTS&&logger$4.throwError("CCIP read exceeded maximum redirections",Logger.errors.SERVER_ERROR,{redirects:ie,transaction:t});const fe=t.to,ae=yield this.perform("call",{transaction:t,blockTag:n});if(ie>=0&&n==="latest"&&fe!=null&&ae.substring(0,10)==="0x556f1830"&&hexDataLength(ae)%32===4)try{const le=hexDataSlice(ae,4),pe=hexDataSlice(le,0,32);BigNumber.from(pe).eq(fe)||logger$4.throwError("CCIP Read sender did not match",Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:ae});const me=[],ye=BigNumber.from(hexDataSlice(le,32,64)).toNumber(),xe=BigNumber.from(hexDataSlice(le,ye,ye+32)).toNumber(),Ee=hexDataSlice(le,ye+32);for(let Te=0;Te<xe;Te++){const Ie=_parseString(Ee,Te*32);Ie==null&&logger$4.throwError("CCIP Read contained corrupt URL string",Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:ae}),me.push(Ie)}const Se=_parseBytes(le,64);BigNumber.from(hexDataSlice(le,100,128)).isZero()||logger$4.throwError("CCIP Read callback selector included junk",Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:ae});const Me=hexDataSlice(le,96,100),Be=_parseBytes(le,128),$e=yield this.ccipReadFetch(t,Se,me);$e==null&&logger$4.throwError("CCIP Read disabled or provided no URLs",Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:ae});const ke={to:fe,data:hexConcat([Me,encodeBytes([$e,Be])])};return this._call(ke,n,ie+1)}catch(le){if(le.code===Logger.errors.SERVER_ERROR)throw le}try{return hexlify(ae)}catch(le){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"call",params:{transaction:t,blockTag:n},result:ae,error:le})}})}call(t,n){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const ie=yield resolveProperties({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(n),ccipReadEnabled:Promise.resolve(t.ccipReadEnabled)});return this._call(ie.transaction,ie.blockTag,ie.ccipReadEnabled?0:-1)})}estimateGas(t){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield resolveProperties({transaction:this._getTransactionRequest(t)}),ie=yield this.perform("estimateGas",n);try{return BigNumber.from(ie)}catch(fe){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"estimateGas",params:n,result:ie,error:fe})}})}_getAddress(t){return __awaiter$c(this,void 0,void 0,function*(){t=yield t,typeof t!="string"&&logger$4.throwArgumentError("invalid address or ENS name","name",t);const n=yield this.resolveName(t);return n==null&&logger$4.throwError("ENS name not configured",Logger.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),n})}_getBlock(t,n){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;let ie=-128;const fe={includeTransactions:!!n};if(isHexString(t,32))fe.blockHash=t;else try{fe.blockTag=yield this._getBlockTag(t),isHexString(fe.blockTag)&&(ie=parseInt(fe.blockTag.substring(2),16))}catch{logger$4.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return poll(()=>__awaiter$c(this,void 0,void 0,function*(){const ae=yield this.perform("getBlock",fe);if(ae==null)return fe.blockHash!=null&&this._emitted["b:"+fe.blockHash]==null||fe.blockTag!=null&&ie>this._emitted.block?null:void 0;if(n){let le=null;for(let me=0;me<ae.transactions.length;me++){const ye=ae.transactions[me];if(ye.blockNumber==null)ye.confirmations=0;else if(ye.confirmations==null){le==null&&(le=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let xe=le-ye.blockNumber+1;xe<=0&&(xe=1),ye.confirmations=xe}}const pe=this.formatter.blockWithTransactions(ae);return pe.transactions=pe.transactions.map(me=>this._wrapTransaction(me)),pe}return this.formatter.block(ae)}),{oncePoll:this})})}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;const n={transactionHash:this.formatter.hash(t,!0)};return poll(()=>__awaiter$c(this,void 0,void 0,function*(){const ie=yield this.perform("getTransaction",n);if(ie==null)return this._emitted["t:"+t]==null?null:void 0;const fe=this.formatter.transactionResponse(ie);if(fe.blockNumber==null)fe.confirmations=0;else if(fe.confirmations==null){let le=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-fe.blockNumber+1;le<=0&&(le=1),fe.confirmations=le}return this._wrapTransaction(fe)}),{oncePoll:this})})}getTransactionReceipt(t){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;const n={transactionHash:this.formatter.hash(t,!0)};return poll(()=>__awaiter$c(this,void 0,void 0,function*(){const ie=yield this.perform("getTransactionReceipt",n);if(ie==null)return this._emitted["t:"+t]==null?null:void 0;if(ie.blockHash==null)return;const fe=this.formatter.receipt(ie);if(fe.blockNumber==null)fe.confirmations=0;else if(fe.confirmations==null){let le=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-fe.blockNumber+1;le<=0&&(le=1),fe.confirmations=le}return fe}),{oncePoll:this})})}getLogs(t){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield resolveProperties({filter:this._getFilter(t)}),ie=yield this.perform("getLogs",n);return ie.forEach(fe=>{fe.removed==null&&(fe.removed=!1)}),Formatter.arrayOf(this.formatter.filterLog.bind(this.formatter))(ie)})}getEtherPrice(){return __awaiter$c(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(t){return __awaiter$c(this,void 0,void 0,function*(){if(t=yield t,typeof t=="number"&&t<0){t%1&&logger$4.throwArgumentError("invalid BlockTag","blockTag",t);let n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return n+=t,n<0&&(n=0),this.formatter.blockTag(n)}return this.formatter.blockTag(t)})}getResolver(t){return __awaiter$c(this,void 0,void 0,function*(){let n=t;for(;;){if(n===""||n==="."||t!=="eth"&&n==="eth")return null;const ie=yield this._getResolver(n,"getResolver");if(ie!=null){const fe=new Resolver(this,ie,t);return n!==t&&!(yield fe.supportsWildcard())?null:fe}n=n.split(".").slice(1).join(".")}})}_getResolver(t,n){return __awaiter$c(this,void 0,void 0,function*(){n==null&&(n="ENS");const ie=yield this.getNetwork();ie.ensAddress||logger$4.throwError("network does not support ENS",Logger.errors.UNSUPPORTED_OPERATION,{operation:n,network:ie.name});try{const fe=yield this.call({to:ie.ensAddress,data:"0x0178b8bf"+namehash$1(t).substring(2)});return this.formatter.callAddress(fe)}catch{}return null})}resolveName(t){return __awaiter$c(this,void 0,void 0,function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(ie){if(isHexString(t))throw ie}typeof t!="string"&&logger$4.throwArgumentError("invalid ENS name","name",t);const n=yield this.getResolver(t);return n?yield n.getAddress():null})}lookupAddress(t){return __awaiter$c(this,void 0,void 0,function*(){t=yield t,t=this.formatter.address(t);const n=t.substring(2).toLowerCase()+".addr.reverse",ie=yield this._getResolver(n,"lookupAddress");if(ie==null)return null;const fe=_parseString(yield this.call({to:ie,data:"0x691f3431"+namehash$1(n).substring(2)}),0);return(yield this.resolveName(fe))!=t?null:fe})}getAvatar(t){return __awaiter$c(this,void 0,void 0,function*(){let n=null;if(isHexString(t)){const ae=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",le=yield this._getResolver(ae,"getAvatar");if(!le)return null;n=new Resolver(this,le,ae);try{const pe=yield n.getAvatar();if(pe)return pe.url}catch(pe){if(pe.code!==Logger.errors.CALL_EXCEPTION)throw pe}try{const pe=_parseString(yield this.call({to:le,data:"0x691f3431"+namehash$1(ae).substring(2)}),0);n=yield this.getResolver(pe)}catch(pe){if(pe.code!==Logger.errors.CALL_EXCEPTION)throw pe;return null}}else if(n=yield this.getResolver(t),!n)return null;const ie=yield n.getAvatar();return ie==null?null:ie.url})}perform(t,n){return logger$4.throwError(t+" not implemented",Logger.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter(n=>n.pollable()).length>0}_stopEvent(t){this.polling=this._events.filter(n=>n.pollable()).length>0}_addEventListener(t,n,ie){const fe=new Event$1(getEventTag(t),n,ie);return this._events.push(fe),this._startEvent(fe),this}on(t,n){return this._addEventListener(t,n,!1)}once(t,n){return this._addEventListener(t,n,!0)}emit(t,...n){let ie=!1,fe=[],ae=getEventTag(t);return this._events=this._events.filter(le=>le.tag!==ae?!0:(setTimeout(()=>{le.listener.apply(this,n)},0),ie=!0,le.once?(fe.push(le),!1):!0)),fe.forEach(le=>{this._stopEvent(le)}),ie}listenerCount(t){if(!t)return this._events.length;let n=getEventTag(t);return this._events.filter(ie=>ie.tag===n).length}listeners(t){if(t==null)return this._events.map(ie=>ie.listener);let n=getEventTag(t);return this._events.filter(ie=>ie.tag===n).map(ie=>ie.listener)}off(t,n){if(n==null)return this.removeAllListeners(t);const ie=[];let fe=!1,ae=getEventTag(t);return this._events=this._events.filter(le=>le.tag!==ae||le.listener!=n||fe?!0:(fe=!0,ie.push(le),!1)),ie.forEach(le=>{this._stopEvent(le)}),this}removeAllListeners(t){let n=[];if(t==null)n=this._events,this._events=[];else{const ie=getEventTag(t);this._events=this._events.filter(fe=>fe.tag!==ie?!0:(n.push(fe),!1))}return n.forEach(ie=>{this._stopEvent(ie)}),this}}var __awaiter$b=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$3=new Logger(version$8),errorGas=["call","estimateGas"];function spelunk(c,t){if(c==null)return null;if(typeof c.message=="string"&&c.message.match("reverted")){const n=isHexString(c.data)?c.data:null;if(!t||n)return{message:c.message,data:n}}if(typeof c=="object"){for(const n in c){const ie=spelunk(c[n],t);if(ie)return ie}return null}if(typeof c=="string")try{return spelunk(JSON.parse(c),t)}catch{}return null}function checkError(c,t,n){const ie=n.transaction||n.signedTransaction;if(c==="call"){const ae=spelunk(t,!0);if(ae)return ae.data;logger$3.throwError("missing revert data in call exception; Transaction reverted without a reason string",Logger.errors.CALL_EXCEPTION,{data:"0x",transaction:ie,error:t})}if(c==="estimateGas"){let ae=spelunk(t.body,!1);ae==null&&(ae=spelunk(t,!1)),ae&&logger$3.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Logger.errors.UNPREDICTABLE_GAS_LIMIT,{reason:ae.message,method:c,transaction:ie,error:t})}let fe=t.message;throw t.code===Logger.errors.SERVER_ERROR&&t.error&&typeof t.error.message=="string"?fe=t.error.message:typeof t.body=="string"?fe=t.body:typeof t.responseText=="string"&&(fe=t.responseText),fe=(fe||"").toLowerCase(),fe.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&logger$3.throwError("insufficient funds for intrinsic transaction cost",Logger.errors.INSUFFICIENT_FUNDS,{error:t,method:c,transaction:ie}),fe.match(/nonce (is )?too low/i)&&logger$3.throwError("nonce has already been used",Logger.errors.NONCE_EXPIRED,{error:t,method:c,transaction:ie}),fe.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&logger$3.throwError("replacement fee too low",Logger.errors.REPLACEMENT_UNDERPRICED,{error:t,method:c,transaction:ie}),fe.match(/only replay-protected/i)&&logger$3.throwError("legacy pre-eip-155 transactions not supported",Logger.errors.UNSUPPORTED_OPERATION,{error:t,method:c,transaction:ie}),errorGas.indexOf(c)>=0&&fe.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&logger$3.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:c,transaction:ie}),t}function timer(c){return new Promise(function(t){setTimeout(t,c)})}function getResult(c){if(c.error){const t=new Error(c.error.message);throw t.code=c.error.code,t.data=c.error.data,t}return c.result}function getLowerCase(c){return c&&c.toLowerCase()}const _constructorGuard={};class JsonRpcSigner extends Signer{constructor(t,n,ie){if(super(),t!==_constructorGuard)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");defineReadOnly(this,"provider",n),ie==null&&(ie=0),typeof ie=="string"?(defineReadOnly(this,"_address",this.provider.formatter.address(ie)),defineReadOnly(this,"_index",null)):typeof ie=="number"?(defineReadOnly(this,"_index",ie),defineReadOnly(this,"_address",null)):logger$3.throwArgumentError("invalid address or index","addressOrIndex",ie)}connect(t){return logger$3.throwError("cannot alter JSON-RPC Signer connection",Logger.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new UncheckedJsonRpcSigner(_constructorGuard,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(t=>(t.length<=this._index&&logger$3.throwError("unknown account #"+this._index,Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index])))}sendUncheckedTransaction(t){t=shallowCopy(t);const n=this.getAddress().then(ie=>(ie&&(ie=ie.toLowerCase()),ie));if(t.gasLimit==null){const ie=shallowCopy(t);ie.from=n,t.gasLimit=this.provider.estimateGas(ie)}return t.to!=null&&(t.to=Promise.resolve(t.to).then(ie=>__awaiter$b(this,void 0,void 0,function*(){if(ie==null)return null;const fe=yield this.provider.resolveName(ie);return fe==null&&logger$3.throwArgumentError("provided ENS name resolves to null","tx.to",ie),fe}))),resolveProperties({tx:resolveProperties(t),sender:n}).then(({tx:ie,sender:fe})=>{ie.from!=null?ie.from.toLowerCase()!==fe&&logger$3.throwArgumentError("from address mismatch","transaction",t):ie.from=fe;const ae=this.provider.constructor.hexlifyTransaction(ie,{from:!0});return this.provider.send("eth_sendTransaction",[ae]).then(le=>le,le=>(typeof le.message=="string"&&le.message.match(/user denied/i)&&logger$3.throwError("user rejected transaction",Logger.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:ie}),checkError("sendTransaction",le,ae)))})}signTransaction(t){return logger$3.throwError("signing transactions is unsupported",Logger.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return __awaiter$b(this,void 0,void 0,function*(){const n=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),ie=yield this.sendUncheckedTransaction(t);try{return yield poll(()=>__awaiter$b(this,void 0,void 0,function*(){const fe=yield this.provider.getTransaction(ie);if(fe!==null)return this.provider._wrapTransaction(fe,ie,n)}),{oncePoll:this.provider})}catch(fe){throw fe.transactionHash=ie,fe}})}signMessage(t){return __awaiter$b(this,void 0,void 0,function*(){const n=typeof t=="string"?toUtf8Bytes(t):t,ie=yield this.getAddress();try{return yield this.provider.send("personal_sign",[hexlify(n),ie.toLowerCase()])}catch(fe){throw typeof fe.message=="string"&&fe.message.match(/user denied/i)&&logger$3.throwError("user rejected signing",Logger.errors.ACTION_REJECTED,{action:"signMessage",from:ie,messageData:t}),fe}})}_legacySignMessage(t){return __awaiter$b(this,void 0,void 0,function*(){const n=typeof t=="string"?toUtf8Bytes(t):t,ie=yield this.getAddress();try{return yield this.provider.send("eth_sign",[ie.toLowerCase(),hexlify(n)])}catch(fe){throw typeof fe.message=="string"&&fe.message.match(/user denied/i)&&logger$3.throwError("user rejected signing",Logger.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:ie,messageData:t}),fe}})}_signTypedData(t,n,ie){return __awaiter$b(this,void 0,void 0,function*(){const fe=yield TypedDataEncoder.resolveNames(t,n,ie,le=>this.provider.resolveName(le)),ae=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[ae.toLowerCase(),JSON.stringify(TypedDataEncoder.getPayload(fe.domain,n,fe.value))])}catch(le){throw typeof le.message=="string"&&le.message.match(/user denied/i)&&logger$3.throwError("user rejected signing",Logger.errors.ACTION_REJECTED,{action:"_signTypedData",from:ae,messageData:{domain:fe.domain,types:n,value:fe.value}}),le}})}unlock(t){return __awaiter$b(this,void 0,void 0,function*(){const n=this.provider,ie=yield this.getAddress();return n.send("personal_unlockAccount",[ie.toLowerCase(),t,null])})}}class UncheckedJsonRpcSigner extends JsonRpcSigner{sendTransaction(t){return this.sendUncheckedTransaction(t).then(n=>({hash:n,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:ie=>this.provider.waitForTransaction(n,ie)}))}}const allowedTransactionKeys={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class JsonRpcProvider extends BaseProvider{constructor(t,n){let ie=n;ie==null&&(ie=new Promise((fe,ae)=>{setTimeout(()=>{this.detectNetwork().then(le=>{fe(le)},le=>{ae(le)})},0)})),super(ie),t||(t=getStatic(this.constructor,"defaultUrl")()),typeof t=="string"?defineReadOnly(this,"connection",Object.freeze({url:t})):defineReadOnly(this,"connection",Object.freeze(shallowCopy(t))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return __awaiter$b(this,void 0,void 0,function*(){yield timer(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch{try{t=yield this.send("net_version",[])}catch{}}if(t!=null){const n=getStatic(this.constructor,"getNetwork");try{return n(BigNumber.from(t).toNumber())}catch(ie){return logger$3.throwError("could not detect network",Logger.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:ie})}}return logger$3.throwError("could not detect network",Logger.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(t){return new JsonRpcSigner(_constructorGuard,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(t=>t.map(n=>this.formatter.address(n)))}send(t,n){const ie={method:t,params:n,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:deepCopy(ie),provider:this});const fe=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(fe&&this._cache[t])return this._cache[t];const ae=fetchJson(this.connection,JSON.stringify(ie),getResult).then(le=>(this.emit("debug",{action:"response",request:ie,response:le,provider:this}),le),le=>{throw this.emit("debug",{action:"response",error:le,request:ie,provider:this}),le});return fe&&(this._cache[t]=ae,setTimeout(()=>{this._cache[t]=null},0)),ae}prepareRequest(t,n){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[getLowerCase(n.address),n.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[getLowerCase(n.address),n.blockTag]];case"getCode":return["eth_getCode",[getLowerCase(n.address),n.blockTag]];case"getStorageAt":return["eth_getStorageAt",[getLowerCase(n.address),hexZeroPad(n.position,32),n.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[n.signedTransaction]];case"getBlock":return n.blockTag?["eth_getBlockByNumber",[n.blockTag,!!n.includeTransactions]]:n.blockHash?["eth_getBlockByHash",[n.blockHash,!!n.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[n.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[n.transactionHash]];case"call":return["eth_call",[getStatic(this.constructor,"hexlifyTransaction")(n.transaction,{from:!0}),n.blockTag]];case"estimateGas":return["eth_estimateGas",[getStatic(this.constructor,"hexlifyTransaction")(n.transaction,{from:!0})]];case"getLogs":return n.filter&&n.filter.address!=null&&(n.filter.address=getLowerCase(n.filter.address)),["eth_getLogs",[n.filter]]}return null}perform(t,n){return __awaiter$b(this,void 0,void 0,function*(){if(t==="call"||t==="estimateGas"){const fe=n.transaction;if(fe&&fe.type!=null&&BigNumber.from(fe.type).isZero()&&fe.maxFeePerGas==null&&fe.maxPriorityFeePerGas==null){const ae=yield this.getFeeData();ae.maxFeePerGas==null&&ae.maxPriorityFeePerGas==null&&(n=shallowCopy(n),n.transaction=shallowCopy(fe),delete n.transaction.type)}}const ie=this.prepareRequest(t,n);ie==null&&logger$3.throwError(t+" not implemented",Logger.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(ie[0],ie[1])}catch(fe){return checkError(t,fe,n)}})}_startEvent(t){t.tag==="pending"&&this._startPending(),super._startEvent(t)}_startPending(){if(this._pendingFilter!=null)return;const t=this,n=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=n,n.then(function(ie){function fe(){t.send("eth_getFilterChanges",[ie]).then(function(ae){if(t._pendingFilter!=n)return null;let le=Promise.resolve();return ae.forEach(function(pe){t._emitted["t:"+pe.toLowerCase()]="pending",le=le.then(function(){return t.getTransaction(pe).then(function(me){return t.emit("pending",me),null})})}),le.then(function(){return timer(1e3)})}).then(function(){if(t._pendingFilter!=n){t.send("eth_uninstallFilter",[ie]);return}return setTimeout(function(){fe()},0),null}).catch(ae=>{})}return fe(),ie}).catch(ie=>{})}_stopEvent(t){t.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,n){const ie=shallowCopy(allowedTransactionKeys);if(n)for(const ae in n)n[ae]&&(ie[ae]=!0);checkProperties(t,ie);const fe={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(ae){if(t[ae]==null)return;const le=hexValue(BigNumber.from(t[ae]));ae==="gasLimit"&&(ae="gas"),fe[ae]=le}),["from","to","data"].forEach(function(ae){t[ae]!=null&&(fe[ae]=hexlify(t[ae]))}),t.accessList&&(fe.accessList=accessListify(t.accessList)),fe}}const logger$2=new Logger(version$8);let _nextId=1;function buildWeb3LegacyFetcher(c,t){const n="Web3LegacyFetcher";return function(ie,fe){const ae={method:ie,params:fe,id:_nextId++,jsonrpc:"2.0"};return new Promise((le,pe)=>{this.emit("debug",{action:"request",fetcher:n,request:deepCopy(ae),provider:this}),t(ae,(me,ye)=>{if(me)return this.emit("debug",{action:"response",fetcher:n,error:me,request:ae,provider:this}),pe(me);if(this.emit("debug",{action:"response",fetcher:n,request:ae,response:ye,provider:this}),ye.error){const xe=new Error(ye.error.message);return xe.code=ye.error.code,xe.data=ye.error.data,pe(xe)}le(ye.result)})})}}function buildEip1193Fetcher(c){return function(t,n){n==null&&(n=[]);const ie={method:t,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:deepCopy(ie),provider:this}),c.request(ie).then(fe=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:ie,response:fe,provider:this}),fe),fe=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:ie,error:fe,provider:this}),fe})}}class Web3Provider extends JsonRpcProvider{constructor(t,n){t==null&&logger$2.throwArgumentError("missing provider","provider",t);let ie=null,fe=null,ae=null;typeof t=="function"?(ie="unknown:",fe=t):(ie=t.host||t.path||"",!ie&&t.isMetaMask&&(ie="metamask"),ae=t,t.request?(ie===""&&(ie="eip-1193:"),fe=buildEip1193Fetcher(t)):t.sendAsync?fe=buildWeb3LegacyFetcher(t,t.sendAsync.bind(t)):t.send?fe=buildWeb3LegacyFetcher(t,t.send.bind(t)):logger$2.throwArgumentError("unsupported provider","provider",t),ie||(ie="unknown:")),super(ie,n),defineReadOnly(this,"jsonRpcFetchFunc",fe),defineReadOnly(this,"provider",ae)}send(t,n){return this.jsonRpcFetchFunc(t,n)}}const version$7="solidity/5.8.0",regexBytes=new RegExp("^bytes([0-9]+)$"),regexNumber=new RegExp("^(u?int)([0-9]*)$"),regexArray=new RegExp("^(.*)\\[([0-9]*)\\]$"),Zeros="0000000000000000000000000000000000000000000000000000000000000000",logger$1=new Logger(version$7);function _pack(c,t,n){switch(c){case"address":return n?zeroPad(t,32):arrayify(t);case"string":return toUtf8Bytes(t);case"bytes":return arrayify(t);case"bool":return t=t?"0x01":"0x00",n?zeroPad(t,32):arrayify(t)}let ie=c.match(regexNumber);if(ie){let fe=parseInt(ie[2]||"256");return(ie[2]&&String(fe)!==ie[2]||fe%8!==0||fe===0||fe>256)&&logger$1.throwArgumentError("invalid number type","type",c),n&&(fe=256),t=BigNumber.from(t).toTwos(fe),zeroPad(t,fe/8)}if(ie=c.match(regexBytes),ie){const fe=parseInt(ie[1]);return(String(fe)!==ie[1]||fe===0||fe>32)&&logger$1.throwArgumentError("invalid bytes type","type",c),arrayify(t).byteLength!==fe&&logger$1.throwArgumentError(`invalid value for ${c}`,"value",t),n?arrayify((t+Zeros).substring(0,66)):t}if(ie=c.match(regexArray),ie&&Array.isArray(t)){const fe=ie[1];parseInt(ie[2]||String(t.length))!=t.length&&logger$1.throwArgumentError(`invalid array length for ${c}`,"value",t);const le=[];return t.forEach(function(pe){le.push(_pack(fe,pe,!0))}),concat$1(le)}return logger$1.throwArgumentError("invalid type","type",c)}function pack(c,t){c.length!=t.length&&logger$1.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const n=[];return c.forEach(function(ie,fe){n.push(_pack(ie,t[fe]))}),hexlify(concat$1(n))}function keccak256(c,t){return keccak256$1(pack(c,t))}function sha256$6(c,t){return sha256$7(pack(c,t))}const lib_esm$1=Object.freeze(Object.defineProperty({__proto__:null,keccak256,pack,sha256:sha256$6},Symbol.toStringTag,{value:"Module"})),version$6="units/5.8.0",logger=new Logger(version$6),names$2=["wei","kwei","mwei","gwei","szabo","finney","ether"];function commify(c){const t=String(c).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||c==="."||c==="-.")&&logger.throwArgumentError("invalid value","value",c);let n=t[0],ie="";for(n.substring(0,1)==="-"&&(ie="-",n=n.substring(1));n.substring(0,1)==="0";)n=n.substring(1);n===""&&(n="0");let fe="";for(t.length===2&&(fe="."+(t[1]||"0"));fe.length>2&&fe[fe.length-1]==="0";)fe=fe.substring(0,fe.length-1);const ae=[];for(;n.length;)if(n.length<=3){ae.unshift(n);break}else{const le=n.length-3;ae.unshift(n.substring(le)),n=n.substring(0,le)}return ie+ae.join(",")+fe}function formatUnits(c,t){if(typeof t=="string"){const n=names$2.indexOf(t);n!==-1&&(t=3*n)}return formatFixed(c,t??18)}function parseUnits(c,t){if(typeof c!="string"&&logger.throwArgumentError("value must be a string","value",c),typeof t=="string"){const n=names$2.indexOf(t);n!==-1&&(t=3*n)}return parseFixed(c,t??18)}function formatEther(c){return formatUnits(c,18)}function parseEther(c){return parseUnits(c,18)}const lib_esm=Object.freeze(Object.defineProperty({__proto__:null,commify,formatEther,formatUnits,parseEther,parseUnits},Symbol.toStringTag,{value:"Module"}));class defaultModal{waiting(t){console.log(`Waiting: ${t}`)}success(t){console.log(`Success: ${t}`)}error(t){console.log(`Error: ${t}`)}close(){console.log("Close")}}const deployerABI=[{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"newFee",type:"uint256"}],name:"DroplinkedFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"newHeartBeat",type:"uint256"}],name:"HeartBeatUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"shop",type:"address"},{indexed:!1,internalType:"address",name:"nftContract",type:"address"}],name:"ShopDeployed",type:"event"},{inputs:[{internalType:"bytes",name:"bytecode",type:"bytes"},{internalType:"bytes32",name:"salt",type:"bytes32"}],name:"deployShop",outputs:[{internalType:"address",name:"shop",type:"address"},{internalType:"address",name:"nftContract",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"droplinkedFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"droplinkedWallet",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDroplinkedFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getHeartBeat",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"heartBeat",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_heartBeat",type:"uint256"},{internalType:"address",name:"_droplinkedWallet",type:"address"},{internalType:"uint256",name:"_droplinkedFee",type:"uint256"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"nftContracts",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"shopOwner",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"nftOwners",outputs:[{internalType:"address",name:"nftContracts",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newFee",type:"uint256"}],name:"setDroplinkedFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newHeartBeat",type:"uint256"}],name:"setHeartBeat",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"shopAddresses",outputs:[{internalType:"contract IDropShop",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"shopCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"shopOwner",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"shopOwners",outputs:[{internalType:"address",name:"shops",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],shopABI=[{inputs:[{internalType:"string",name:"_shopName",type:"string"},{internalType:"string",name:"_shopAddress",type:"string"},{internalType:"address",name:"_shopOwner",type:"address"},{internalType:"string",name:"_shopLogo",type:"string"},{internalType:"string",name:"_shopDescription",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AccessDenied",type:"error"},{inputs:[],name:"AffiliatePOD",type:"error"},{inputs:[],name:"AlreadyClaimed",type:"error"},{inputs:[{internalType:"address",name:"requester",type:"address"},{internalType:"uint256",name:"productId",type:"uint256"}],name:"AlreadyRequested",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"producer",type:"address"}],name:"NotEnoughTokens",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"ProductDoesntExist",type:"error"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"ProductExists",type:"error"},{inputs:[],name:"ReentrancyGuardReentrantCall",type:"error"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"RequestAlreadyConfirmed",type:"error"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"RequestDoesntExist",type:"error"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"RequestNotConfirmed",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"}],name:"ShopDoesNotOwnToken",type:"error"},{inputs:[],name:"oldPrice",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"requestId",type:"uint256"},{indexed:!0,internalType:"address",name:"approver",type:"address"}],name:"AffiliateRequestApproved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"requestId",type:"uint256"},{indexed:!0,internalType:"address",name:"disapprover",type:"address"}],name:"AffiliateRequestDisapproved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"requestId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"productId",type:"uint256"},{indexed:!1,internalType:"address",name:"requester",type:"address"}],name:"AffiliateRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"count",type:"uint256"}],name:"BatchProductRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"productId",type:"uint256"},{indexed:!0,internalType:"address",name:"claimer",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ProductClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"productId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"string",name:"uri",type:"string"}],name:"ProductRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"productId",type:"uint256"},{indexed:!0,internalType:"address",name:"owner",type:"address"}],name:"ProductUnregistered",type:"event"},{inputs:[],name:"affiliateRequestCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"affiliateRequests",outputs:[{internalType:"address",name:"publisher",type:"address"},{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"bool",name:"isConfirmed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"approveRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"manager",type:"address"},{internalType:"bytes",name:"signature",type:"bytes"},{components:[{components:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"uint256",name:"nullifier",type:"uint256"}],internalType:"struct PurchasedItem[]",name:"cart",type:"tuple[]"},{internalType:"address",name:"shop",type:"address"}],internalType:"struct PurchaseSignature",name:"purchaseSignature",type:"tuple"}],name:"claimPurchase",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"disapproveRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"droplinkedManagerWallet",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"getAffiliate",outputs:[{components:[{internalType:"address",name:"publisher",type:"address"},{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"bool",name:"isConfirmed",type:"bool"}],internalType:"struct AffiliateRequest",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getAffiliateRequestCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"messageHash",type:"bytes32"}],name:"getEthSignedMessageHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{components:[{components:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"uint256",name:"nullifier",type:"uint256"}],internalType:"struct PurchasedItem[]",name:"cart",type:"tuple[]"},{internalType:"address",name:"shop",type:"address"}],internalType:"struct PurchaseSignature",name:"data",type:"tuple"}],name:"getMessageHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"getProduct",outputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"}],internalType:"struct Product",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getProductCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"}],internalType:"struct Product",name:"product",type:"tuple"}],name:"getProductId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"nftAddress",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getProductIdV2",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"affiliateId",type:"uint256"}],name:"getProductViaAffiliateId",outputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"}],internalType:"struct Product",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getShopAddress",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"getShopDescription",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"getShopLogo",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"getShopName",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"getShopOwner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"address",name:"requester",type:"address"}],name:"isRequestSubmited",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"managers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"nftAddress",type:"address"},{internalType:"string",name:"uri",type:"string"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bool",name:"accepted",type:"bool"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"},{internalType:"uint256",name:"royalty",type:"uint256"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"}],internalType:"struct RecordData",name:"mintData",type:"tuple"}],name:"mintAndRegister",outputs:[{internalType:"uint256",name:"productId",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"nftAddress",type:"address"},{internalType:"string",name:"uri",type:"string"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bool",name:"accepted",type:"bool"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"},{internalType:"uint256",name:"royalty",type:"uint256"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"}],internalType:"struct RecordData[]",name:"recordData",type:"tuple[]"}],name:"mintAndRegisterBatch",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"nullifiers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256[]",name:"",type:"uint256[]"},{internalType:"uint256[]",name:"",type:"uint256[]"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC1155BatchReceived",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC1155Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC721Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"productCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"products",outputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"ethSignedMessageHash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"recoverSigner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"}],internalType:"struct Product",name:"p",type:"tuple"}],name:"registerProduct",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"requestAffiliate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"manager",type:"address"}],name:"revokeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"manager",type:"address"}],name:"setManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"shopInfo",outputs:[{internalType:"string",name:"shopName",type:"string"},{internalType:"string",name:"shopAddress",type:"string"},{internalType:"string",name:"shopLogo",type:"string"},{internalType:"string",name:"shopDescription",type:"string"},{internalType:"address",name:"shopOwner",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"sig",type:"bytes"}],name:"splitSignature",outputs:[{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"},{internalType:"uint8",name:"v",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newManager",type:"address"}],name:"transferManagerShip",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"unregisterProduct",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newManagerWallet",type:"address"}],name:"updateDroplinkedManagerWallet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"signer",type:"address"},{internalType:"bytes",name:"signature",type:"bytes"},{components:[{components:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"uint256",name:"nullifier",type:"uint256"}],internalType:"struct PurchasedItem[]",name:"cart",type:"tuple[]"},{internalType:"address",name:"shop",type:"address"}],internalType:"struct PurchaseSignature",name:"data",type:"tuple"}],name:"verifyPurchase",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"pure",type:"function"}],erc20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],paymentProxyABI=[{inputs:[{internalType:"uint256",name:"_heartBeat",type:"uint256"},{internalType:"address",name:"_chainLinkProvider",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[{internalType:"uint256",name:"priceTimestamp",type:"uint256"},{internalType:"uint256",name:"currentTimestamp",type:"uint256"}],name:"oldPrice",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"newHeartBeat",type:"uint256"}],name:"HeartBeatChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"memo",type:"string"}],name:"ProductPurchased",type:"event"},{inputs:[{internalType:"uint256",name:"_heartBeat",type:"uint256"}],name:"changeHeartBeat",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256[]",name:"tbdValues",type:"uint256[]"},{internalType:"address[]",name:"tbdReceivers",type:"address[]"},{internalType:"address",name:"currency",type:"address"},{internalType:"uint80",name:"roundId",type:"uint80"},{internalType:"string",name:"memo",type:"string"}],name:"droplinkedPurchase",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"heartBeat",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];function getShopABI(){return shopABI}function getPaymentProxyABI(){return paymentProxyABI}async function uploadMetadata(c,t,n){return(await(await n.post("uploader/cdn-upload-json",{json:{data:c,key:`record-metadata/${t}.json`}})).json()).url}async function updateUris(c,t,n){return(await(await n.put(`web3/record/transactions/${c}/uris`,{json:{uris:t}})).json()).data}async function updateHash(c,t,n){return(await(await n.put(`web3/record/transactions/${c}/hash`,{json:{transactionHash:t}})).json()).data}async function getCartData(c,t,n,ie,fe){const ae=await(await fe.get(`web3/payment/distribution/${c}/${t}/${n}/${ie}`)).json();return{paymentData:ae.data,orderID:ae.orderID}}async function getAirdropData(c,t){return await(await t.get(`nfts/airdrop/${c}`)).json()}async function getNonce(c,t){return await(await t.get(`web3/auth/nonce?wallet=${c}`)).json()}async function checkWallet(c,t){if((await c.getAddress()).toLocaleLowerCase()!==t.toLocaleLowerCase())throw new Error("Address does not match signer address")}function getTransactionLink({blockchain:c,transactionHash:t,isTestnet:n=!1}){const ie=t.trim();switch(c.toUpperCase()){case"CASPER":return`https://${n?"testnet.":""}cspr.live/deploy/${ie}`;case"STACKS":return`https://explorer.hiro.so/txid/${ie}?chain=${n?"testnet":"mainnet"}`;case"POLYGON":return`https://${n?"amoy.":""}polygonscan.com/tx/${ie}`;case"XRPLSIDECHAIN":return`https://evm-sidechain.xrpl.org/tx/${ie}`;case"BINANCE":return`https://${n?"testnet.":""}bscscan.com/tx/${ie}`;case"NEAR":return`https://explorer.${n?"testnet":"mainnet"}.aurora.dev/tx/${ie}`;case"BASE":return`https://base${n?"-sepolia":""}.blockscout.com/tx/${ie}`;case"LINEA":return`https://${n?"sepolia.":""}lineascan.build/tx/${ie}`;case"ETH":return`https://${n?"sepolia.":""}etherscan.io/tx/${ie}`;case"SOLANA":return`https://explorer.solana.com/tx/${ie}?cluster=${n?"devnet":"mainnet"}`;case"REDBELLY":return n?`https://redbelly.testnet.routescan.io/tx/${ie}`:`https://redbelly.routescan.io/tx/${ie}`;case"SKALE":return`https://${n?"giant-half-dual-testnet.explorer.testnet.skalenodes.com":"honorable-steel-rasalhague.explorer.mainnet.skalenodes.com"}/tx/${ie}`;case"BITLAYER":return n?`https://testnet.btrscan.com/tx/${ie}`:`https://www.btrscan.com/tx/${ie}`;default:return""}}const sixify=c=>c.toString().padStart(6,"0");async function getConstructorArgs(c,t,n){return[c.shopName||"",c.shopAddress||"",n,c.shopLogo||"",c.shopDescription||"",t]}async function deployEVMShop(c,t,n){console.log({...c,...t,...n});const{modalInterface:ie}=t,{address:fe,chain:ae,network:le,provider:pe}=c,me=pe.getSigner();ie.waiting("got the signer: "+await me.getAddress()),await checkWallet(me,fe);const ye=await getDeployerAddress(ae,le);ie.waiting("Got deployer contract address");const xe=new Contract(ye,deployerABI,me);ie.waiting("Getting shop bytecode");const Ee=await getShopByteCode();ie.waiting("got bytecode");const Se="0x"+fe.split("0x")[1]+"000000000000000000"+sixify(Math.floor(Math.random()*1e6)+1);ie.waiting("created salt"),console.log(Se);const Me=await getConstructorArgs(n,ye,fe);ie.waiting("created constructor args"),console.log(Me);const Be=defaultAbiCoder.encode(["string","string","address","string","string","address"],Me);ie.waiting("Created bytecodeWithArgs"),console.log(Be);try{let $e;const ke=Ee+Be.split("0x")[1];console.log({fullBytecode:ke}),c.gasPredictable?(ie.waiting("CallStatic to estimate gas"),await xe.callStatic.deployShop(ke,Se),ie.waiting("Sending transaction"),$e=await xe.deployShop(ke,Se,{})):(ie.waiting("Sending transaction"),$e=await xe.deployShop(ke,Se)),ie.waiting("Waiting for confirmation...");const Te=await $e.wait();ie.waiting("Transaction confirmed, extracting data...");const Fe=Te.logs.map(ze=>{try{return xe.interface.parseLog(ze)}catch{return null}}).filter(ze=>ze!=null).find(ze=>ze.name==="ShopDeployed"),Le=Fe.args.shop,He=Fe.args.nftContract;return ie.success("Deployment successful!"),{transactionHash:$e.hash,deployedShopAddress:Le,deployedNFTAddress:He}}catch($e){if(ie.error("Error during deployment."),$e.code.toString()==="ACTION_REJECTED")throw ie.error("Transaction Rejected"),new UserDeniedException;try{const ke=xe.interface.parseError($e.data);throw ie.error(`Contract error: ${ke}`),ke}catch(ke){throw ie.error("Unhandled error during deployment."),new Error(ke||"Unknown error occurred.")}}}class ChainError extends Error{constructor(t){super(t),this.name=new.target.name}}class ShopError extends Error{constructor(t){super(t),this.name=new.target.name}}class WalletError extends ChainError{}class Unauthorized extends ChainError{constructor(t,n,ie){super(`Unauthorized access to ${t} from ${n} to ${ie}`),this.method=t,this.from=n,this.to=ie}}class FieldNotFound extends ChainError{constructor(t){super(`Field not found: ${t}`),this.field=t}}class AccountChangedException extends ChainError{constructor(t){super(`Account changed: ${t}`)}}class Web3CallbackFailed extends ShopError{constructor(t){super(`Web3 callback failed: ${t}`)}}class ChainNotImplementedException extends ChainError{constructor(t){super(`Chain not implemented: ${t}`)}}class MetadataUploadFailedException extends ChainError{constructor(t){super(`Metadata upload failed: ${t}`)}}class WalletNotFoundException extends WalletError{constructor(){super("EVM Wallet not found")}}class MetaMaskNotFoundException extends WalletError{constructor(){super("MetaMask is not installed")}}class AccountAccessDeniedException extends WalletError{constructor(){super("Account access request denied by the user")}}class NoAccountsFoundException extends WalletError{constructor(){super("No accounts were found in the wallet")}}class SignatureRequestDeniedException extends WalletError{constructor(){super("Signature request was denied by the user")}}class ChainSwitchException extends WalletError{constructor(){super("Failed to switch chains")}}class UserDeniedException extends WalletError{constructor(){super("User denied the request")}}class InsufficientBalanceException extends WalletError{constructor(){super("Insufficient balance to cover the transaction cost")}}class InsufficientTokenBalanceException extends WalletError{constructor(){super("Insufficient token balance")}}class InvalidParametersException extends ChainError{constructor(t){super(`Invalid parameters: ${t}`)}}const chainNames={[Chain.BINANCE]:{[Network.TESTNET]:{chainName:"Smart Chain - Testnet",chainId:"0x61",nativeCurrency:{name:"TBNB",decimals:18,symbol:"tBNB"},rpcUrls:["https://bsc-testnet-dataseed.bnbchain.org/"]},[Network.MAINNET]:{chainName:"Smart Chain",chainId:"0x38",nativeCurrency:{name:"BNB",decimals:18,symbol:"BNB"},rpcUrls:["https://bsc-dataseed.binance.org/"]}},[Chain.POLYGON]:{[Network.TESTNET]:{chainName:"Polygon Amoy Testnet",chainId:"0x13882",nativeCurrency:{name:"MATIC",decimals:18,symbol:"MATIC"},rpcUrls:["https://rpc-amoy.polygon.technology"]},[Network.MAINNET]:{chainName:"Polygon Mainnet",chainId:"0x89",nativeCurrency:{name:"MATIC",decimals:18,symbol:"MATIC"},rpcUrls:["https://polygon-rpc.com/"]}},[Chain.XRPLSIDECHAIN]:{[Network.TESTNET]:{chainName:"XRPL EVM Sidechain",chainId:"0x15f902",nativeCurrency:{name:"XRP",decimals:18,symbol:"XRP"},rpcUrls:["https://rpc-evm-sidechain.xrpl.org"]},[Network.MAINNET]:{chainName:"XRPL EVM Sidechain",chainId:"0x15f902",nativeCurrency:{name:"XRP",decimals:18,symbol:"XRP"},rpcUrls:["https://rpc-evm-sidechain.xrpl.org"]}},[Chain.CASPER]:{[Network.TESTNET]:{chainName:"Smart Chain - Testnet",chainId:"0x38",nativeCurrency:{name:"BNB",decimals:18,symbol:"BNB"},rpcUrls:["https://data-seed-prebsc-1-s1.binance.org:8545/"]},[Network.MAINNET]:{chainName:"Smart Chain",chainId:"0x61",nativeCurrency:{name:"BNB",decimals:18,symbol:"BNB"},rpcUrls:["https://data-seed-prebsc-1-s1.binance.org:8545/"]}},[Chain.STACKS]:{[Network.TESTNET]:{chainName:"Smart Chain - Testnet",chainId:"0x38",nativeCurrency:{name:"BNB",decimals:18,symbol:"BNB"},rpcUrls:["https://data-seed-prebsc-1-s1.binance.org:8545/"]},[Network.MAINNET]:{chainName:"Smart Chain",chainId:"0x61",nativeCurrency:{name:"BNB",decimals:18,symbol:"BNB"},rpcUrls:["https://data-seed-prebsc-1-s1.binance.org:8545/"]}},[Chain.NEAR]:{[Network.TESTNET]:{chainName:"Aurora Testnet",chainId:"0x4e454153",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://testnet.aurora.dev"]},[Network.MAINNET]:{chainName:"Aurora Mainnet",chainId:"0x4e454152",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://mainnet.aurora.dev"]}},[Chain.SKALE]:{[Network.TESTNET]:{chainName:"SKALE Testnet Calypso Hub",chainId:"0x3A14269B",nativeCurrency:{name:"sFUEL",decimals:18,symbol:"sFUEL"},rpcUrls:["https://testnet.skalenodes.com/v1/giant-half-dual-testnet"]},[Network.MAINNET]:{chainName:"SKALE Calypso Hub",chainId:"0x5D456C62",nativeCurrency:{name:"sFUEL",decimals:18,symbol:"sFUEL"},rpcUrls:["https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague"]}},[Chain.BASE]:{[Network.TESTNET]:{chainName:"Base Sepolia",chainId:"0x14a34",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://sepolia.base.org"]},[Network.MAINNET]:{chainName:"Base Mainnet",chainId:"0x2105",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://mainnet.base.org/"]}},[Chain.LINEA]:{[Network.MAINNET]:{chainName:"Linea",chainId:"0xe708",nativeCurrency:{name:"ETH",decimals:18,symbol:"LineaETH"},rpcUrls:["https://rpc.linea.build"]},[Network.TESTNET]:{chainName:"Linea",chainId:"0xe705",nativeCurrency:{name:"ETH",decimals:18,symbol:"LineaETH"},rpcUrls:["https://rpc.sepolia.linea.build"]}},[Chain.ETH]:{[Network.MAINNET]:{chainName:"Ethereum",chainId:"0x1",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://mainnet.infura.io/v3/"]},[Network.TESTNET]:{chainName:"Sepolia",chainId:"0xaa36a7",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://eth-sepolia.public.blastapi.io/"]}},[Chain.REDBELLY]:{[Network.TESTNET]:{chainName:"Redbelly Network Testnet",chainId:"0x99",nativeCurrency:{name:"RBNT",decimals:18,symbol:"RBNT"},rpcUrls:["https://governors.testnet.redbelly.network"]},[Network.MAINNET]:{chainName:"Redbelly Network Mainnet",chainId:"0x97",nativeCurrency:{name:"RBNT",decimals:18,symbol:"RBNT"},rpcUrls:["https://governors.mainnet.redbelly.network"]}},[Chain.BITLAYER]:{[Network.MAINNET]:{chainName:"Bitlayer Mainnet",chainId:"0x310C5",nativeCurrency:{name:"BTC",decimals:18,symbol:"BTC"},rpcUrls:["https://rpc.bitlayer.org"]},[Network.TESTNET]:{chainName:"Bitlayer Testnet",chainId:"0x3106A",nativeCurrency:{name:"BTC",decimals:18,symbol:"BTC"},rpcUrls:["https://testnet-rpc.bitlayer.org"]}}},isMetamaskInstalled=()=>{const{ethereum:c}=window;return!!(c&&c.isMetaMask)},isCoinBaseInstalled=()=>{var t;const{ethereum:c}=window;return!!(c&&((t=c.providers)!=null&&t.some(n=>n.isCoinbaseWallet)))};async function getAccounts(c){try{const t=await c.request({method:"eth_accounts"});return!t||t.length===0?[]:t}catch(t){throw new WalletError(`Failed to retrieve accounts: ${t}`)}}function isWalletInstalled(c){var t,n;if(["POLYGON","XRPLSIDECHAIN","NEAR","BINANCE","BASE","LINEA","ETH","REDBELLY","SKALE","BITLAYER"].includes(c.toUpperCase()))return{installed:isMetamaskInstalled(),walletName:"MetaMask wallet"};if(c==="SOLANA")return{installed:(n=(t=window.phantom)==null?void 0:t.solana)==null?void 0:n.isPhantom,walletName:"Phantom wallet"};throw c==="CASPER"?new WalletNotFoundException:new WalletNotFoundException}async function isWalletConnected(c){const t=await getAccounts(c);return t&&t.length>0}async function isChainCorrect(c,t,n){try{const ie=await c.request({method:"eth_chainId"});return String(ie).toLowerCase()===chainNames[t][n].chainId.toLowerCase()}catch(ie){throw console.error(`Failed to verify the correct chain: ${ie.message}`),new ChainSwitchException}}async function changeChain(c,t,n){try{await c.request({method:"wallet_switchEthereumChain",params:[{chainId:chainNames[t][n].chainId}]})}catch(ie){throw console.error(`Failed to switch chain: ${ie.message}`),new ChainSwitchException}}async function requestAccounts(c){try{return await c.request({method:"eth_requestAccounts"})}catch(t){throw console.error(t),new UserDeniedException}}async function getBalance(c,t){return Number(await c.provider.request({method:"eth_getBalance",params:[t,"latest"]}))}async function addChain(c,t,n,ie){try{const fe=c.provider;if(ie.waiting("Adding chain..."),!isWalletInstalled(t))throw new WalletNotFoundException;await isWalletConnected(fe)||(ie.waiting("Requesting account access..."),await requestAccounts(fe));const ae=chainNames[t][n];await fe.request({method:"wallet_addEthereumChain",params:[{chainName:ae.chainName,chainId:ae.chainId,nativeCurrency:ae.nativeCurrency,rpcUrls:ae.rpcUrls}]})}catch(fe){console.warn("Chain already added or error occurred while adding chain:",fe)}}async function evmLogin(c,t,n,ie,fe){const ae=c.provider;try{if(ie.waiting("Connecting to wallet..."),!isWalletInstalled(t))throw new WalletNotFoundException;await isWalletConnected(ae)||(ie.waiting("Requesting account access..."),await requestAccounts(ae));const le=(await getAccounts(ae))[0],pe=chainNames[t][n];try{ie.waiting("Adding chain..."),await ae.request({method:"wallet_addEthereumChain",params:[{chainName:pe.chainName,chainId:pe.chainId,nativeCurrency:pe.nativeCurrency,rpcUrls:pe.rpcUrls}]})}catch(Be){console.warn("Chain already added or error occurred while adding chain:",Be)}const me=await(await fe.post("web3/sFuelDistribution",{json:{wallet:le,isTestnet:n===Network.TESTNET}})).json();console.log(me),ie.waiting("Signing message...");const ye=await getNonce(le,fe),xe=new Date().toLocaleString(),Ee=`Welcome to Droplinked! Please sign this message to verify your ownership over your wallet and log in. - Nonce: ${ye} - Date: ${xe}`,Me=await c.getSigner().signMessage(Ee);return{address:le,signature:Me,nonce:ye,date:xe}}catch(le){throw ie.error(le instanceof UserDeniedException?"User denied the request":"An error occurred while connecting to the wallet"),le}}function getRecordData(c,t,n){const{acceptsManageWallet:ie,amount:fe,royalty:ae,type:le}=c;return{nftAddress:n,uri:t,amount:fe,accepted:ie,affiliatePercentage:ae,royalty:ae,nftType:NFTType.ERC1155,productType:le}}async function prepareRecordData(c,t,n,ie){const{nftContract:fe,modalInterface:ae}=ie;if(!fe)throw new FieldNotFound("nftContract");const{description:le}=n,{skuID:pe}=t,me={...t,...n};ae.waiting("Uploading metadata...");const ye={...me.skuProperties},xe={name:me.productTitle,description:le,image:me.imageUrl,properties:ye},Ee=await uploadMetadata(xe,pe,ie.axiosInstance);ae.waiting(`Metadata uploaded: ${Ee}`),ae.waiting("Getting recordData");const Se=getRecordData(me,Ee,fe);return ae.waiting("Got recordData"),Se}async function recordProduct(c,t,n,ie){const{modalInterface:fe,nftContract:ae,shopContractAddress:le}=t;if(!ae||!le)throw new FieldNotFound("nftContract||shopContractAddress");console.log({nftContract:ae,shopContractAddress:le});const pe=c.provider.getSigner();fe.waiting("Connecting to wallet..."),await checkWallet(pe,c.address),fe.waiting("Getting shop contract...");const me=new Contract(le,getShopABI(),pe);try{const ye=await Promise.all(ie.map(Ee=>prepareRecordData(c,Ee,n,t)));console.log({products:ye});let xe;if(c.gasPredictable){fe.waiting("CallStatic..."),await me.callStatic.mintAndRegisterBatch(ye),fe.waiting("Estimating gas...");const Ee=(await me.estimateGas.mintAndRegisterBatch(ye)).toBigInt();fe.waiting("Got gas estimation: "+Ee),fe.waiting("Getting the gasPrice of the network...");const Se=(await getGasPrice(c.provider)).valueOf();fe.waiting("Got gas price: "+Se),fe.waiting("Sending transaction..."),xe=await me.mintAndRegisterBatch(ye)}else fe.waiting("Sending transaction..."),xe=await me.mintAndRegisterBatch(ye);return await xe.wait(),fe.success("Transaction successful"),{transactionHash:xe.hash,metadataUrls:ye.map(Ee=>Ee.uri)}}catch(ye){if(ye.code&&ye.code.toString()==="ACTION_REJECTED")throw t.modalInterface.error("Transaction Rejected"),new Error("Transaction Rejected");try{if(ye.data&&ye.data!=="0x"){const xe=me.interface.parseError(ye.data);throw xe.name==="OwnableUnauthorizedAccount"?(t.modalInterface.error("You are not the owner of the shop"),new Unauthorized("record",c.address,le)):(t.modalInterface.error(xe.name),t.modalInterface.error(ye),ye)}else throw fe.error("Transaction reverted without reason"),ye}catch(xe){throw fe.error(`Unexpected error: ${xe}`),xe}}}var utils$e={};const require$$0$3=getAugmentedNamespace(lib_esm$b),require$$1$2=getAugmentedNamespace(lib_esm$f),require$$2$3=getAugmentedNamespace(lib_esm$d),require$$3=getAugmentedNamespace(lib_esm$8),require$$4$3=getAugmentedNamespace(lib_esm$j),require$$5=getAugmentedNamespace(lib_esm$c),require$$6$2=getAugmentedNamespace(lib_esm$6),require$$7=getAugmentedNamespace(lib_esm$4),require$$8=getAugmentedNamespace(lib_esm$h),require$$9=getAugmentedNamespace(lib_esm$k),require$$10=getAugmentedNamespace(lib_esm$7),require$$11$1=getAugmentedNamespace(lib_esm$1),require$$12=getAugmentedNamespace(lib_esm$5),require$$13=getAugmentedNamespace(lib_esm$i),require$$14=getAugmentedNamespace(lib_esm$g),require$$15=getAugmentedNamespace(lib_esm$a),require$$16=getAugmentedNamespace(lib_esm$e),require$$17$1=getAugmentedNamespace(lib_esm$9),require$$18=getAugmentedNamespace(lib_esm),require$$19=getAugmentedNamespace(lib_esm$3),require$$20=getAugmentedNamespace(lib_esm$2);(function(c){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(_e,se,ce,de){de===void 0&&(de=ce),Object.defineProperty(_e,de,{enumerable:!0,get:function(){return se[ce]}})}:function(_e,se,ce,de){de===void 0&&(de=ce),_e[de]=se[ce]}),n=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(_e,se){Object.defineProperty(_e,"default",{enumerable:!0,value:se})}:function(_e,se){_e.default=se}),ie=commonjsGlobal&&commonjsGlobal.__importStar||function(_e){if(_e&&_e.__esModule)return _e;var se={};if(_e!=null)for(var ce in _e)ce!=="default"&&Object.prototype.hasOwnProperty.call(_e,ce)&&t(se,_e,ce);return n(se,_e),se};Object.defineProperty(c,"__esModule",{value:!0}),c.formatBytes32String=c.Utf8ErrorFuncs=c.toUtf8String=c.toUtf8CodePoints=c.toUtf8Bytes=c._toEscapedUtf8String=c.nameprep=c.hexDataSlice=c.hexDataLength=c.hexZeroPad=c.hexValue=c.hexStripZeros=c.hexConcat=c.isHexString=c.hexlify=c.base64=c.base58=c.TransactionDescription=c.LogDescription=c.Interface=c.SigningKey=c.HDNode=c.defaultPath=c.isBytesLike=c.isBytes=c.zeroPad=c.stripZeros=c.concat=c.arrayify=c.shallowCopy=c.resolveProperties=c.getStatic=c.defineReadOnly=c.deepCopy=c.checkProperties=c.poll=c.fetchJson=c._fetchData=c.RLP=c.Logger=c.checkResultErrors=c.FormatTypes=c.ParamType=c.FunctionFragment=c.EventFragment=c.ErrorFragment=c.ConstructorFragment=c.Fragment=c.defaultAbiCoder=c.AbiCoder=void 0,c.Indexed=c.Utf8ErrorReason=c.UnicodeNormalizationForm=c.SupportedAlgorithm=c.mnemonicToSeed=c.isValidMnemonic=c.entropyToMnemonic=c.mnemonicToEntropy=c.getAccountPath=c.verifyTypedData=c.verifyMessage=c.recoverPublicKey=c.computePublicKey=c.recoverAddress=c.computeAddress=c.getJsonWalletAddress=c.TransactionTypes=c.serializeTransaction=c.parseTransaction=c.accessListify=c.joinSignature=c.splitSignature=c.soliditySha256=c.solidityKeccak256=c.solidityPack=c.shuffled=c.randomBytes=c.sha512=c.sha256=c.ripemd160=c.keccak256=c.computeHmac=c.commify=c.parseUnits=c.formatUnits=c.parseEther=c.formatEther=c.isAddress=c.getCreate2Address=c.getContractAddress=c.getIcapAddress=c.getAddress=c._TypedDataEncoder=c.id=c.isValidName=c.namehash=c.hashMessage=c.dnsEncode=c.parseBytes32String=void 0;var fe=require$$0$3;Object.defineProperty(c,"AbiCoder",{enumerable:!0,get:function(){return fe.AbiCoder}}),Object.defineProperty(c,"checkResultErrors",{enumerable:!0,get:function(){return fe.checkResultErrors}}),Object.defineProperty(c,"ConstructorFragment",{enumerable:!0,get:function(){return fe.ConstructorFragment}}),Object.defineProperty(c,"defaultAbiCoder",{enumerable:!0,get:function(){return fe.defaultAbiCoder}}),Object.defineProperty(c,"ErrorFragment",{enumerable:!0,get:function(){return fe.ErrorFragment}}),Object.defineProperty(c,"EventFragment",{enumerable:!0,get:function(){return fe.EventFragment}}),Object.defineProperty(c,"FormatTypes",{enumerable:!0,get:function(){return fe.FormatTypes}}),Object.defineProperty(c,"Fragment",{enumerable:!0,get:function(){return fe.Fragment}}),Object.defineProperty(c,"FunctionFragment",{enumerable:!0,get:function(){return fe.FunctionFragment}}),Object.defineProperty(c,"Indexed",{enumerable:!0,get:function(){return fe.Indexed}}),Object.defineProperty(c,"Interface",{enumerable:!0,get:function(){return fe.Interface}}),Object.defineProperty(c,"LogDescription",{enumerable:!0,get:function(){return fe.LogDescription}}),Object.defineProperty(c,"ParamType",{enumerable:!0,get:function(){return fe.ParamType}}),Object.defineProperty(c,"TransactionDescription",{enumerable:!0,get:function(){return fe.TransactionDescription}});var ae=require$$1$2;Object.defineProperty(c,"getAddress",{enumerable:!0,get:function(){return ae.getAddress}}),Object.defineProperty(c,"getCreate2Address",{enumerable:!0,get:function(){return ae.getCreate2Address}}),Object.defineProperty(c,"getContractAddress",{enumerable:!0,get:function(){return ae.getContractAddress}}),Object.defineProperty(c,"getIcapAddress",{enumerable:!0,get:function(){return ae.getIcapAddress}}),Object.defineProperty(c,"isAddress",{enumerable:!0,get:function(){return ae.isAddress}});var le=ie(require$$2$3);c.base64=le;var pe=require$$3;Object.defineProperty(c,"base58",{enumerable:!0,get:function(){return pe.Base58}});var me=require$$4$3;Object.defineProperty(c,"arrayify",{enumerable:!0,get:function(){return me.arrayify}}),Object.defineProperty(c,"concat",{enumerable:!0,get:function(){return me.concat}}),Object.defineProperty(c,"hexConcat",{enumerable:!0,get:function(){return me.hexConcat}}),Object.defineProperty(c,"hexDataSlice",{enumerable:!0,get:function(){return me.hexDataSlice}}),Object.defineProperty(c,"hexDataLength",{enumerable:!0,get:function(){return me.hexDataLength}}),Object.defineProperty(c,"hexlify",{enumerable:!0,get:function(){return me.hexlify}}),Object.defineProperty(c,"hexStripZeros",{enumerable:!0,get:function(){return me.hexStripZeros}}),Object.defineProperty(c,"hexValue",{enumerable:!0,get:function(){return me.hexValue}}),Object.defineProperty(c,"hexZeroPad",{enumerable:!0,get:function(){return me.hexZeroPad}}),Object.defineProperty(c,"isBytes",{enumerable:!0,get:function(){return me.isBytes}}),Object.defineProperty(c,"isBytesLike",{enumerable:!0,get:function(){return me.isBytesLike}}),Object.defineProperty(c,"isHexString",{enumerable:!0,get:function(){return me.isHexString}}),Object.defineProperty(c,"joinSignature",{enumerable:!0,get:function(){return me.joinSignature}}),Object.defineProperty(c,"zeroPad",{enumerable:!0,get:function(){return me.zeroPad}}),Object.defineProperty(c,"splitSignature",{enumerable:!0,get:function(){return me.splitSignature}}),Object.defineProperty(c,"stripZeros",{enumerable:!0,get:function(){return me.stripZeros}});var ye=require$$5;Object.defineProperty(c,"_TypedDataEncoder",{enumerable:!0,get:function(){return ye._TypedDataEncoder}}),Object.defineProperty(c,"dnsEncode",{enumerable:!0,get:function(){return ye.dnsEncode}}),Object.defineProperty(c,"hashMessage",{enumerable:!0,get:function(){return ye.hashMessage}}),Object.defineProperty(c,"id",{enumerable:!0,get:function(){return ye.id}}),Object.defineProperty(c,"isValidName",{enumerable:!0,get:function(){return ye.isValidName}}),Object.defineProperty(c,"namehash",{enumerable:!0,get:function(){return ye.namehash}});var xe=require$$6$2;Object.defineProperty(c,"defaultPath",{enumerable:!0,get:function(){return xe.defaultPath}}),Object.defineProperty(c,"entropyToMnemonic",{enumerable:!0,get:function(){return xe.entropyToMnemonic}}),Object.defineProperty(c,"getAccountPath",{enumerable:!0,get:function(){return xe.getAccountPath}}),Object.defineProperty(c,"HDNode",{enumerable:!0,get:function(){return xe.HDNode}}),Object.defineProperty(c,"isValidMnemonic",{enumerable:!0,get:function(){return xe.isValidMnemonic}}),Object.defineProperty(c,"mnemonicToEntropy",{enumerable:!0,get:function(){return xe.mnemonicToEntropy}}),Object.defineProperty(c,"mnemonicToSeed",{enumerable:!0,get:function(){return xe.mnemonicToSeed}});var Ee=require$$7;Object.defineProperty(c,"getJsonWalletAddress",{enumerable:!0,get:function(){return Ee.getJsonWalletAddress}});var Se=require$$8;Object.defineProperty(c,"keccak256",{enumerable:!0,get:function(){return Se.keccak256}});var Me=require$$9;Object.defineProperty(c,"Logger",{enumerable:!0,get:function(){return Me.Logger}});var Be=require$$10;Object.defineProperty(c,"computeHmac",{enumerable:!0,get:function(){return Be.computeHmac}}),Object.defineProperty(c,"ripemd160",{enumerable:!0,get:function(){return Be.ripemd160}}),Object.defineProperty(c,"sha256",{enumerable:!0,get:function(){return Be.sha256}}),Object.defineProperty(c,"sha512",{enumerable:!0,get:function(){return Be.sha512}});var $e=require$$11$1;Object.defineProperty(c,"solidityKeccak256",{enumerable:!0,get:function(){return $e.keccak256}}),Object.defineProperty(c,"solidityPack",{enumerable:!0,get:function(){return $e.pack}}),Object.defineProperty(c,"soliditySha256",{enumerable:!0,get:function(){return $e.sha256}});var ke=require$$12;Object.defineProperty(c,"randomBytes",{enumerable:!0,get:function(){return ke.randomBytes}}),Object.defineProperty(c,"shuffled",{enumerable:!0,get:function(){return ke.shuffled}});var Te=require$$13;Object.defineProperty(c,"checkProperties",{enumerable:!0,get:function(){return Te.checkProperties}}),Object.defineProperty(c,"deepCopy",{enumerable:!0,get:function(){return Te.deepCopy}}),Object.defineProperty(c,"defineReadOnly",{enumerable:!0,get:function(){return Te.defineReadOnly}}),Object.defineProperty(c,"getStatic",{enumerable:!0,get:function(){return Te.getStatic}}),Object.defineProperty(c,"resolveProperties",{enumerable:!0,get:function(){return Te.resolveProperties}}),Object.defineProperty(c,"shallowCopy",{enumerable:!0,get:function(){return Te.shallowCopy}});var Ie=ie(require$$14);c.RLP=Ie;var Fe=require$$15;Object.defineProperty(c,"computePublicKey",{enumerable:!0,get:function(){return Fe.computePublicKey}}),Object.defineProperty(c,"recoverPublicKey",{enumerable:!0,get:function(){return Fe.recoverPublicKey}}),Object.defineProperty(c,"SigningKey",{enumerable:!0,get:function(){return Fe.SigningKey}});var Le=require$$16;Object.defineProperty(c,"formatBytes32String",{enumerable:!0,get:function(){return Le.formatBytes32String}}),Object.defineProperty(c,"nameprep",{enumerable:!0,get:function(){return Le.nameprep}}),Object.defineProperty(c,"parseBytes32String",{enumerable:!0,get:function(){return Le.parseBytes32String}}),Object.defineProperty(c,"_toEscapedUtf8String",{enumerable:!0,get:function(){return Le._toEscapedUtf8String}}),Object.defineProperty(c,"toUtf8Bytes",{enumerable:!0,get:function(){return Le.toUtf8Bytes}}),Object.defineProperty(c,"toUtf8CodePoints",{enumerable:!0,get:function(){return Le.toUtf8CodePoints}}),Object.defineProperty(c,"toUtf8String",{enumerable:!0,get:function(){return Le.toUtf8String}}),Object.defineProperty(c,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return Le.Utf8ErrorFuncs}});var He=require$$17$1;Object.defineProperty(c,"accessListify",{enumerable:!0,get:function(){return He.accessListify}}),Object.defineProperty(c,"computeAddress",{enumerable:!0,get:function(){return He.computeAddress}}),Object.defineProperty(c,"parseTransaction",{enumerable:!0,get:function(){return He.parse}}),Object.defineProperty(c,"recoverAddress",{enumerable:!0,get:function(){return He.recoverAddress}}),Object.defineProperty(c,"serializeTransaction",{enumerable:!0,get:function(){return He.serialize}}),Object.defineProperty(c,"TransactionTypes",{enumerable:!0,get:function(){return He.TransactionTypes}});var ze=require$$18;Object.defineProperty(c,"commify",{enumerable:!0,get:function(){return ze.commify}}),Object.defineProperty(c,"formatEther",{enumerable:!0,get:function(){return ze.formatEther}}),Object.defineProperty(c,"parseEther",{enumerable:!0,get:function(){return ze.parseEther}}),Object.defineProperty(c,"formatUnits",{enumerable:!0,get:function(){return ze.formatUnits}}),Object.defineProperty(c,"parseUnits",{enumerable:!0,get:function(){return ze.parseUnits}});var Je=require$$19;Object.defineProperty(c,"verifyMessage",{enumerable:!0,get:function(){return Je.verifyMessage}}),Object.defineProperty(c,"verifyTypedData",{enumerable:!0,get:function(){return Je.verifyTypedData}});var Xe=require$$20;Object.defineProperty(c,"_fetchData",{enumerable:!0,get:function(){return Xe._fetchData}}),Object.defineProperty(c,"fetchJson",{enumerable:!0,get:function(){return Xe.fetchJson}}),Object.defineProperty(c,"poll",{enumerable:!0,get:function(){return Xe.poll}});var Ue=require$$10;Object.defineProperty(c,"SupportedAlgorithm",{enumerable:!0,get:function(){return Ue.SupportedAlgorithm}});var $t=require$$16;Object.defineProperty(c,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return $t.UnicodeNormalizationForm}}),Object.defineProperty(c,"Utf8ErrorReason",{enumerable:!0,get:function(){return $t.Utf8ErrorReason}})})(utils$e);const SkaleUsdcAddressForTestnet="0x2aebcdc4f9f9149a50422fff86198cb0939ea165",SkaleUsdcAddressForMainnet="0x7Cf76E740Cb23b99337b21F392F22c47Ad910c67";async function handleCustomTokenApproval(c,t,n,ie,fe){if(fe.waiting("Initiating token approval..."),!c.tokenAddress)throw new InvalidParametersException("Token address is not set");try{const ae=new Contract(c.tokenAddress,erc20ABI,n);console.log({signerAddress:ie,customTokenContract:ae});const le=await ae.balanceOf(ie);fe.waiting("Calculating total sum...");const pe=c.tbdValues.reduce((ye,xe)=>ye.add(BigNumber.from(xe)),BigNumber.from(0));if(fe.waiting("Checking token balance..."),le.lt(pe))throw new InsufficientTokenBalanceException;fe.waiting("Approving tokens...");const me=await ae.approve(t,MaxUint256$1);fe.waiting("Waiting for approval confirmation..."),await me.wait(),fe.waiting("Token approval confirmed")}catch(ae){handleError(ae)}}const droplinked_payment=async function(c,t,n){const{modalInterface:ie}=t,{provider:fe,chain:ae,network:le,address:pe}=c;if(!n.tbdReceivers.every(utils$e.isAddress))throw new InvalidParametersException("Invalid receiver address found");if(!n.tbdValues.every(Se=>BigNumber.from(Se).gt(0)))throw new InvalidParametersException("tbdValues must be positive numbers");n.chainLinkRoundId=n.chainLinkRoundId||"0";const me=fe.getSigner();if(ie.waiting("Got signer..."),!n.tbdValues)throw new InvalidParametersException(`Invalid tbdValues: ${n.tbdValues}`);if(!n.tbdReceivers)throw new InvalidParametersException(`Invalid tbdReceivers: ${n.tbdReceivers}`);if(!n.memo)throw new InvalidParametersException(`Memo is required for payment, current memo: ${n.memo}`);if(n.tbdReceivers.length!==n.tbdValues.length)throw new InvalidParametersException("tbdReceivers and tbdValues must be the same length");const ye=(await me.getAddress()).toLowerCase();if(ye!==pe.toLowerCase())throw new Unauthorized("droplinked_payment",ye,pe);ie.waiting("Initial checks done...");let xe;try{xe=await getProxyAddress(ae,le)}catch(Se){throw new Error("Failed to get contract address: "+Se.message)}let Ee;try{Ee=new Contract(xe,getPaymentProxyABI(),me)}catch(Se){throw new Error("Failed to create contract instance: "+Se.message)}ie.waiting("Got contract...");try{if(ie.waiting(`
9
+ `)}static register(t,n){n||(n=t.locale)}}const words="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo";let wordlist=null;function loadWords(c){if(wordlist==null&&(wordlist=words.replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),Wordlist.check(c)!=="0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"))throw wordlist=null,new Error("BIP39 Wordlist for en (English) FAILED")}class LangEn extends Wordlist{constructor(){super("en")}getWord(t){return loadWords(this),wordlist[t]}getWordIndex(t){return loadWords(this),wordlist.indexOf(t)}}const langEn=new LangEn;Wordlist.register(langEn);const wordlists={en:langEn},version$e="hdnode/5.8.0",logger$c=new Logger(version$e),N$3=BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),MasterSecret=toUtf8Bytes("Bitcoin seed"),HardenedBit=2147483648;function getUpperMask(c){return(1<<c)-1<<8-c}function getLowerMask(c){return(1<<c)-1}function bytes32(c){return hexZeroPad(hexlify(c),32)}function base58check(c){return Base58.encode(concat$1([c,hexDataSlice(sha256$7(sha256$7(c)),0,4)]))}function getWordlist(c){if(c==null)return wordlists.en;if(typeof c=="string"){const t=wordlists[c];return t==null&&logger$c.throwArgumentError("unknown locale","wordlist",c),t}return c}const _constructorGuard$1={},defaultPath="m/44'/60'/0'/0/0";class HDNode{constructor(t,n,ie,fe,ae,le,pe,me){if(t!==_constructorGuard$1)throw new Error("HDNode constructor cannot be called directly");if(n){const ye=new SigningKey(n);defineReadOnly(this,"privateKey",ye.privateKey),defineReadOnly(this,"publicKey",ye.compressedPublicKey)}else defineReadOnly(this,"privateKey",null),defineReadOnly(this,"publicKey",hexlify(ie));defineReadOnly(this,"parentFingerprint",fe),defineReadOnly(this,"fingerprint",hexDataSlice(ripemd160$1(sha256$7(this.publicKey)),0,4)),defineReadOnly(this,"address",computeAddress(this.publicKey)),defineReadOnly(this,"chainCode",ae),defineReadOnly(this,"index",le),defineReadOnly(this,"depth",pe),me==null?(defineReadOnly(this,"mnemonic",null),defineReadOnly(this,"path",null)):typeof me=="string"?(defineReadOnly(this,"mnemonic",null),defineReadOnly(this,"path",me)):(defineReadOnly(this,"mnemonic",me),defineReadOnly(this,"path",me.path))}get extendedKey(){if(this.depth>=256)throw new Error("Depth too large!");return base58check(concat$1([this.privateKey!=null?"0x0488ADE4":"0x0488B21E",hexlify(this.depth),this.parentFingerprint,hexZeroPad(hexlify(this.index),4),this.chainCode,this.privateKey!=null?concat$1(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new HDNode(_constructorGuard$1,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(t){if(t>4294967295)throw new Error("invalid index - "+String(t));let n=this.path;n&&(n+="/"+(t&~HardenedBit));const ie=new Uint8Array(37);if(t&HardenedBit){if(!this.privateKey)throw new Error("cannot derive child of neutered node");ie.set(arrayify(this.privateKey),1),n&&(n+="'")}else ie.set(arrayify(this.publicKey));for(let Ee=24;Ee>=0;Ee-=8)ie[33+(Ee>>3)]=t>>24-Ee&255;const fe=arrayify(computeHmac(SupportedAlgorithm.sha512,this.chainCode,ie)),ae=fe.slice(0,32),le=fe.slice(32);let pe=null,me=null;this.privateKey?pe=bytes32(BigNumber.from(ae).add(this.privateKey).mod(N$3)):me=new SigningKey(hexlify(ae))._addPoint(this.publicKey);let ye=n;const xe=this.mnemonic;return xe&&(ye=Object.freeze({phrase:xe.phrase,path:n,locale:xe.locale||"en"})),new HDNode(_constructorGuard$1,pe,me,this.fingerprint,bytes32(le),t,this.depth+1,ye)}derivePath(t){const n=t.split("/");if(n.length===0||n[0]==="m"&&this.depth!==0)throw new Error("invalid path - "+t);n[0]==="m"&&n.shift();let ie=this;for(let fe=0;fe<n.length;fe++){const ae=n[fe];if(ae.match(/^[0-9]+'$/)){const le=parseInt(ae.substring(0,ae.length-1));if(le>=HardenedBit)throw new Error("invalid path index - "+ae);ie=ie._derive(HardenedBit+le)}else if(ae.match(/^[0-9]+$/)){const le=parseInt(ae);if(le>=HardenedBit)throw new Error("invalid path index - "+ae);ie=ie._derive(le)}else throw new Error("invalid path component - "+ae)}return ie}static _fromSeed(t,n){const ie=arrayify(t);if(ie.length<16||ie.length>64)throw new Error("invalid seed");const fe=arrayify(computeHmac(SupportedAlgorithm.sha512,MasterSecret,ie));return new HDNode(_constructorGuard$1,bytes32(fe.slice(0,32)),null,"0x00000000",bytes32(fe.slice(32)),0,0,n)}static fromMnemonic(t,n,ie){return ie=getWordlist(ie),t=entropyToMnemonic(mnemonicToEntropy(t,ie),ie),HDNode._fromSeed(mnemonicToSeed(t,n),{phrase:t,path:"m",locale:ie.locale})}static fromSeed(t){return HDNode._fromSeed(t,null)}static fromExtendedKey(t){const n=Base58.decode(t);(n.length!==82||base58check(n.slice(0,78))!==t)&&logger$c.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const ie=n[4],fe=hexlify(n.slice(5,9)),ae=parseInt(hexlify(n.slice(9,13)).substring(2),16),le=hexlify(n.slice(13,45)),pe=n.slice(45,78);switch(hexlify(n.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new HDNode(_constructorGuard$1,null,hexlify(pe),fe,le,ae,ie,null);case"0x0488ade4":case"0x04358394 ":if(pe[0]!==0)break;return new HDNode(_constructorGuard$1,hexlify(pe.slice(1)),null,fe,le,ae,ie,null)}return logger$c.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function mnemonicToSeed(c,t){t||(t="");const n=toUtf8Bytes("mnemonic"+t,UnicodeNormalizationForm.NFKD);return pbkdf2$1(toUtf8Bytes(c,UnicodeNormalizationForm.NFKD),n,2048,64,"sha512")}function mnemonicToEntropy(c,t){t=getWordlist(t),logger$c.checkNormalize();const n=t.split(c);if(n.length%3!==0)throw new Error("invalid mnemonic");const ie=arrayify(new Uint8Array(Math.ceil(11*n.length/8)));let fe=0;for(let ye=0;ye<n.length;ye++){let xe=t.getWordIndex(n[ye].normalize("NFKD"));if(xe===-1)throw new Error("invalid mnemonic");for(let Ee=0;Ee<11;Ee++)xe&1<<10-Ee&&(ie[fe>>3]|=1<<7-fe%8),fe++}const ae=32*n.length/3,le=n.length/3,pe=getUpperMask(le);if((arrayify(sha256$7(ie.slice(0,ae/8)))[0]&pe)!==(ie[ie.length-1]&pe))throw new Error("invalid checksum");return hexlify(ie.slice(0,ae/8))}function entropyToMnemonic(c,t){if(t=getWordlist(t),c=arrayify(c),c.length%4!==0||c.length<16||c.length>32)throw new Error("invalid entropy");const n=[0];let ie=11;for(let le=0;le<c.length;le++)ie>8?(n[n.length-1]<<=8,n[n.length-1]|=c[le],ie-=8):(n[n.length-1]<<=ie,n[n.length-1]|=c[le]>>8-ie,n.push(c[le]&getLowerMask(8-ie)),ie+=3);const fe=c.length/4,ae=arrayify(sha256$7(c))[0]&getUpperMask(fe);return n[n.length-1]<<=fe,n[n.length-1]|=ae>>8-fe,t.join(n.map(le=>t.getWord(le)))}function isValidMnemonic(c,t){try{return mnemonicToEntropy(c,t),!0}catch{}return!1}function getAccountPath(c){return(typeof c!="number"||c<0||c>=HardenedBit||c%1)&&logger$c.throwArgumentError("invalid account index","index",c),`m/44'/60'/${c}'/0/0`}const lib_esm$6=Object.freeze(Object.defineProperty({__proto__:null,HDNode,defaultPath,entropyToMnemonic,getAccountPath,isValidMnemonic,mnemonicToEntropy,mnemonicToSeed},Symbol.toStringTag,{value:"Module"})),version$d="random/5.8.0",logger$b=new Logger(version$d);function getGlobal(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof globalThis<"u")return globalThis;throw new Error("unable to locate global object")}const anyGlobal=getGlobal();let crypto$3=anyGlobal.crypto||anyGlobal.msCrypto;(!crypto$3||!crypto$3.getRandomValues)&&(logger$b.warn("WARNING: Missing strong random number source"),crypto$3={getRandomValues:function(c){return logger$b.throwError("no secure random source avaialble",Logger.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});function randomBytes$1(c){(c<=0||c>1024||c%1||c!=c)&&logger$b.throwArgumentError("invalid length","length",c);const t=new Uint8Array(c);return crypto$3.getRandomValues(t),arrayify(t)}function shuffled(c){c=c.slice();for(let t=c.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1)),ie=c[t];c[t]=c[n],c[n]=ie}return c}const lib_esm$5=Object.freeze(Object.defineProperty({__proto__:null,randomBytes:randomBytes$1,shuffled},Symbol.toStringTag,{value:"Module"}));var aesJs={exports:{}};(function(c,t){(function(n){function ie(ge){return parseInt(ge)===ge}function fe(ge){if(!ie(ge.length))return!1;for(var Re=0;Re<ge.length;Re++)if(!ie(ge[Re])||ge[Re]<0||ge[Re]>255)return!1;return!0}function ae(ge,Re){if(ge.buffer&&ArrayBuffer.isView(ge)&&ge.name==="Uint8Array")return Re&&(ge.slice?ge=ge.slice():ge=Array.prototype.slice.call(ge)),ge;if(Array.isArray(ge)){if(!fe(ge))throw new Error("Array contains invalid value: "+ge);return new Uint8Array(ge)}if(ie(ge.length)&&fe(ge))return new Uint8Array(ge);throw new Error("unsupported array-like object")}function le(ge){return new Uint8Array(ge)}function pe(ge,Re,Ne,qe,Pe){(qe!=null||Pe!=null)&&(ge.slice?ge=ge.slice(qe,Pe):ge=Array.prototype.slice.call(ge,qe,Pe)),Re.set(ge,Ne)}var me=function(){function ge(Ne){var qe=[],Pe=0;for(Ne=encodeURI(Ne);Pe<Ne.length;){var Ge=Ne.charCodeAt(Pe++);Ge===37?(qe.push(parseInt(Ne.substr(Pe,2),16)),Pe+=2):qe.push(Ge)}return ae(qe)}function Re(Ne){for(var qe=[],Pe=0;Pe<Ne.length;){var Ge=Ne[Pe];Ge<128?(qe.push(String.fromCharCode(Ge)),Pe++):Ge>191&&Ge<224?(qe.push(String.fromCharCode((Ge&31)<<6|Ne[Pe+1]&63)),Pe+=2):(qe.push(String.fromCharCode((Ge&15)<<12|(Ne[Pe+1]&63)<<6|Ne[Pe+2]&63)),Pe+=3)}return qe.join("")}return{toBytes:ge,fromBytes:Re}}(),ye=function(){function ge(qe){for(var Pe=[],Ge=0;Ge<qe.length;Ge+=2)Pe.push(parseInt(qe.substr(Ge,2),16));return Pe}var Re="0123456789abcdef";function Ne(qe){for(var Pe=[],Ge=0;Ge<qe.length;Ge++){var Ce=qe[Ge];Pe.push(Re[(Ce&240)>>4]+Re[Ce&15])}return Pe.join("")}return{toBytes:ge,fromBytes:Ne}}(),xe={16:10,24:12,32:14},Ee=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Se=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Me=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Be=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],$e=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],ke=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],Te=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Ie=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Fe=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Le=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],He=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],ze=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Je=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Xe=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Ue=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function $t(ge){for(var Re=[],Ne=0;Ne<ge.length;Ne+=4)Re.push(ge[Ne]<<24|ge[Ne+1]<<16|ge[Ne+2]<<8|ge[Ne+3]);return Re}var _e=function(ge){if(!(this instanceof _e))throw Error("AES must be instanitated with `new`");Object.defineProperty(this,"key",{value:ae(ge,!0)}),this._prepare()};_e.prototype._prepare=function(){var ge=xe[this.key.length];if(ge==null)throw new Error("invalid key size (must be 16, 24 or 32 bytes)");this._Ke=[],this._Kd=[];for(var Re=0;Re<=ge;Re++)this._Ke.push([0,0,0,0]),this._Kd.push([0,0,0,0]);for(var Ne=(ge+1)*4,qe=this.key.length/4,Pe=$t(this.key),Ge,Re=0;Re<qe;Re++)Ge=Re>>2,this._Ke[Ge][Re%4]=Pe[Re],this._Kd[ge-Ge][Re%4]=Pe[Re];for(var Ce=0,De=qe,je;De<Ne;){if(je=Pe[qe-1],Pe[0]^=Se[je>>16&255]<<24^Se[je>>8&255]<<16^Se[je&255]<<8^Se[je>>24&255]^Ee[Ce]<<24,Ce+=1,qe!=8)for(var Re=1;Re<qe;Re++)Pe[Re]^=Pe[Re-1];else{for(var Re=1;Re<qe/2;Re++)Pe[Re]^=Pe[Re-1];je=Pe[qe/2-1],Pe[qe/2]^=Se[je&255]^Se[je>>8&255]<<8^Se[je>>16&255]<<16^Se[je>>24&255]<<24;for(var Re=qe/2+1;Re<qe;Re++)Pe[Re]^=Pe[Re-1]}for(var Re=0,Ve,Mt;Re<qe&&De<Ne;)Ve=De>>2,Mt=De%4,this._Ke[Ve][Mt]=Pe[Re],this._Kd[ge-Ve][Mt]=Pe[Re++],De++}for(var Ve=1;Ve<ge;Ve++)for(var Mt=0;Mt<4;Mt++)je=this._Kd[Ve][Mt],this._Kd[Ve][Mt]=ze[je>>24&255]^Je[je>>16&255]^Xe[je>>8&255]^Ue[je&255]},_e.prototype.encrypt=function(ge){if(ge.length!=16)throw new Error("invalid plaintext size (must be 16 bytes)");for(var Re=this._Ke.length-1,Ne=[0,0,0,0],qe=$t(ge),Pe=0;Pe<4;Pe++)qe[Pe]^=this._Ke[0][Pe];for(var Ge=1;Ge<Re;Ge++){for(var Pe=0;Pe<4;Pe++)Ne[Pe]=Be[qe[Pe]>>24&255]^$e[qe[(Pe+1)%4]>>16&255]^ke[qe[(Pe+2)%4]>>8&255]^Te[qe[(Pe+3)%4]&255]^this._Ke[Ge][Pe];qe=Ne.slice()}for(var Ce=le(16),De,Pe=0;Pe<4;Pe++)De=this._Ke[Re][Pe],Ce[4*Pe]=(Se[qe[Pe]>>24&255]^De>>24)&255,Ce[4*Pe+1]=(Se[qe[(Pe+1)%4]>>16&255]^De>>16)&255,Ce[4*Pe+2]=(Se[qe[(Pe+2)%4]>>8&255]^De>>8)&255,Ce[4*Pe+3]=(Se[qe[(Pe+3)%4]&255]^De)&255;return Ce},_e.prototype.decrypt=function(ge){if(ge.length!=16)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var Re=this._Kd.length-1,Ne=[0,0,0,0],qe=$t(ge),Pe=0;Pe<4;Pe++)qe[Pe]^=this._Kd[0][Pe];for(var Ge=1;Ge<Re;Ge++){for(var Pe=0;Pe<4;Pe++)Ne[Pe]=Ie[qe[Pe]>>24&255]^Fe[qe[(Pe+3)%4]>>16&255]^Le[qe[(Pe+2)%4]>>8&255]^He[qe[(Pe+1)%4]&255]^this._Kd[Ge][Pe];qe=Ne.slice()}for(var Ce=le(16),De,Pe=0;Pe<4;Pe++)De=this._Kd[Re][Pe],Ce[4*Pe]=(Me[qe[Pe]>>24&255]^De>>24)&255,Ce[4*Pe+1]=(Me[qe[(Pe+3)%4]>>16&255]^De>>16)&255,Ce[4*Pe+2]=(Me[qe[(Pe+2)%4]>>8&255]^De>>8)&255,Ce[4*Pe+3]=(Me[qe[(Pe+1)%4]&255]^De)&255;return Ce};var se=function(ge){if(!(this instanceof se))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new _e(ge)};se.prototype.encrypt=function(ge){if(ge=ae(ge),ge.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var Re=le(ge.length),Ne=le(16),qe=0;qe<ge.length;qe+=16)pe(ge,Ne,0,qe,qe+16),Ne=this._aes.encrypt(Ne),pe(Ne,Re,qe);return Re},se.prototype.decrypt=function(ge){if(ge=ae(ge),ge.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var Re=le(ge.length),Ne=le(16),qe=0;qe<ge.length;qe+=16)pe(ge,Ne,0,qe,qe+16),Ne=this._aes.decrypt(Ne),pe(Ne,Re,qe);return Re};var ce=function(ge,Re){if(!(this instanceof ce))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Block Chaining",this.name="cbc",!Re)Re=le(16);else if(Re.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)");this._lastCipherblock=ae(Re,!0),this._aes=new _e(ge)};ce.prototype.encrypt=function(ge){if(ge=ae(ge),ge.length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var Re=le(ge.length),Ne=le(16),qe=0;qe<ge.length;qe+=16){pe(ge,Ne,0,qe,qe+16);for(var Pe=0;Pe<16;Pe++)Ne[Pe]^=this._lastCipherblock[Pe];this._lastCipherblock=this._aes.encrypt(Ne),pe(this._lastCipherblock,Re,qe)}return Re},ce.prototype.decrypt=function(ge){if(ge=ae(ge),ge.length%16!==0)throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");for(var Re=le(ge.length),Ne=le(16),qe=0;qe<ge.length;qe+=16){pe(ge,Ne,0,qe,qe+16),Ne=this._aes.decrypt(Ne);for(var Pe=0;Pe<16;Pe++)Re[qe+Pe]=Ne[Pe]^this._lastCipherblock[Pe];pe(ge,this._lastCipherblock,0,qe,qe+16)}return Re};var de=function(ge,Re,Ne){if(!(this instanceof de))throw Error("AES must be instanitated with `new`");if(this.description="Cipher Feedback",this.name="cfb",!Re)Re=le(16);else if(Re.length!=16)throw new Error("invalid initialation vector size (must be 16 size)");Ne||(Ne=1),this.segmentSize=Ne,this._shiftRegister=ae(Re,!0),this._aes=new _e(ge)};de.prototype.encrypt=function(ge){if(ge.length%this.segmentSize!=0)throw new Error("invalid plaintext size (must be segmentSize bytes)");for(var Re=ae(ge,!0),Ne,qe=0;qe<Re.length;qe+=this.segmentSize){Ne=this._aes.encrypt(this._shiftRegister);for(var Pe=0;Pe<this.segmentSize;Pe++)Re[qe+Pe]^=Ne[Pe];pe(this._shiftRegister,this._shiftRegister,0,this.segmentSize),pe(Re,this._shiftRegister,16-this.segmentSize,qe,qe+this.segmentSize)}return Re},de.prototype.decrypt=function(ge){if(ge.length%this.segmentSize!=0)throw new Error("invalid ciphertext size (must be segmentSize bytes)");for(var Re=ae(ge,!0),Ne,qe=0;qe<Re.length;qe+=this.segmentSize){Ne=this._aes.encrypt(this._shiftRegister);for(var Pe=0;Pe<this.segmentSize;Pe++)Re[qe+Pe]^=Ne[Pe];pe(this._shiftRegister,this._shiftRegister,0,this.segmentSize),pe(ge,this._shiftRegister,16-this.segmentSize,qe,qe+this.segmentSize)}return Re};var he=function(ge,Re){if(!(this instanceof he))throw Error("AES must be instanitated with `new`");if(this.description="Output Feedback",this.name="ofb",!Re)Re=le(16);else if(Re.length!=16)throw new Error("invalid initialation vector size (must be 16 bytes)");this._lastPrecipher=ae(Re,!0),this._lastPrecipherIndex=16,this._aes=new _e(ge)};he.prototype.encrypt=function(ge){for(var Re=ae(ge,!0),Ne=0;Ne<Re.length;Ne++)this._lastPrecipherIndex===16&&(this._lastPrecipher=this._aes.encrypt(this._lastPrecipher),this._lastPrecipherIndex=0),Re[Ne]^=this._lastPrecipher[this._lastPrecipherIndex++];return Re},he.prototype.decrypt=he.prototype.encrypt;var ve=function(ge){if(!(this instanceof ve))throw Error("Counter must be instanitated with `new`");ge!==0&&!ge&&(ge=1),typeof ge=="number"?(this._counter=le(16),this.setValue(ge)):this.setBytes(ge)};ve.prototype.setValue=function(ge){if(typeof ge!="number"||parseInt(ge)!=ge)throw new Error("invalid counter value (must be an integer)");for(var Re=15;Re>=0;--Re)this._counter[Re]=ge%256,ge=ge>>8},ve.prototype.setBytes=function(ge){if(ge=ae(ge,!0),ge.length!=16)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=ge},ve.prototype.increment=function(){for(var ge=15;ge>=0;ge--)if(this._counter[ge]===255)this._counter[ge]=0;else{this._counter[ge]++;break}};var we=function(ge,Re){if(!(this instanceof we))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",Re instanceof ve||(Re=new ve(Re)),this._counter=Re,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new _e(ge)};we.prototype.encrypt=function(ge){for(var Re=ae(ge,!0),Ne=0;Ne<Re.length;Ne++)this._remainingCounterIndex===16&&(this._remainingCounter=this._aes.encrypt(this._counter._counter),this._remainingCounterIndex=0,this._counter.increment()),Re[Ne]^=this._remainingCounter[this._remainingCounterIndex++];return Re},we.prototype.decrypt=we.prototype.encrypt;function Ae(ge){ge=ae(ge,!0);var Re=16-ge.length%16,Ne=le(ge.length+Re);pe(ge,Ne);for(var qe=ge.length;qe<Ne.length;qe++)Ne[qe]=Re;return Ne}function be(ge){if(ge=ae(ge,!0),ge.length<16)throw new Error("PKCS#7 invalid length");var Re=ge[ge.length-1];if(Re>16)throw new Error("PKCS#7 padding byte out of range");for(var Ne=ge.length-Re,qe=0;qe<Re;qe++)if(ge[Ne+qe]!==Re)throw new Error("PKCS#7 invalid padding byte");var Pe=le(Ne);return pe(ge,Pe,0,0,Ne),Pe}var ue={AES:_e,Counter:ve,ModeOfOperation:{ecb:se,cbc:ce,cfb:de,ofb:he,ctr:we},utils:{hex:ye,utf8:me},padding:{pkcs7:{pad:Ae,strip:be}},_arrayTest:{coerceArray:ae,createArray:le,copyArray:pe}};c.exports=ue})()})(aesJs);var aesJsExports=aesJs.exports;const aes$1=getDefaultExportFromCjs$2(aesJsExports),version$c="json-wallets/5.8.0";function looseArrayify(c){return typeof c=="string"&&c.substring(0,2)!=="0x"&&(c="0x"+c),arrayify(c)}function zpad(c,t){for(c=String(c);c.length<t;)c="0"+c;return c}function getPassword(c){return typeof c=="string"?toUtf8Bytes(c,UnicodeNormalizationForm.NFKC):arrayify(c)}function searchPath(c,t){let n=c;const ie=t.toLowerCase().split("/");for(let fe=0;fe<ie.length;fe++){let ae=null;for(const le in n)if(le.toLowerCase()===ie[fe]){ae=n[le];break}if(ae===null)return null;n=ae}return n}function uuidV4(c){const t=arrayify(c);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const n=hexlify(t);return[n.substring(2,10),n.substring(10,14),n.substring(14,18),n.substring(18,22),n.substring(22,34)].join("-")}const logger$a=new Logger(version$c);class CrowdsaleAccount extends Description{isCrowdsaleAccount(t){return!!(t&&t._isCrowdsaleAccount)}}function decrypt$1(c,t){const n=JSON.parse(c);t=getPassword(t);const ie=getAddress(searchPath(n,"ethaddr")),fe=looseArrayify(searchPath(n,"encseed"));(!fe||fe.length%16!==0)&&logger$a.throwArgumentError("invalid encseed","json",c);const ae=arrayify(pbkdf2$1(t,t,2e3,32,"sha256")).slice(0,16),le=fe.slice(0,16),pe=fe.slice(16),me=new aes$1.ModeOfOperation.cbc(ae,le),ye=aes$1.padding.pkcs7.strip(arrayify(me.decrypt(pe)));let xe="";for(let Me=0;Me<ye.length;Me++)xe+=String.fromCharCode(ye[Me]);const Ee=toUtf8Bytes(xe),Se=keccak256$1(Ee);return new CrowdsaleAccount({_isCrowdsaleAccount:!0,address:ie,privateKey:Se})}function isCrowdsaleWallet(c){let t=null;try{t=JSON.parse(c)}catch{return!1}return t.encseed&&t.ethaddr}function isKeystoreWallet(c){let t=null;try{t=JSON.parse(c)}catch{return!1}return!(!t.version||parseInt(t.version)!==t.version||parseInt(t.version)!==3)}function getJsonWalletAddress(c){if(isCrowdsaleWallet(c))try{return getAddress(JSON.parse(c).ethaddr)}catch{return null}if(isKeystoreWallet(c))try{return getAddress(JSON.parse(c).address)}catch{return null}return null}var scrypt$1={exports:{}};(function(c,t){(function(n){function fe($e){const ke=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]);let Te=1779033703,Ie=3144134277,Fe=1013904242,Le=2773480762,He=1359893119,ze=2600822924,Je=528734635,Xe=1541459225;const Ue=new Uint32Array(64);function $t(we){let Ae=0,be=we.length;for(;be>=64;){let ue=Te,ge=Ie,Re=Fe,Ne=Le,qe=He,Pe=ze,Ge=Je,Ce=Xe,De,je,Ve,Mt,Oe;for(je=0;je<16;je++)Ve=Ae+je*4,Ue[je]=(we[Ve]&255)<<24|(we[Ve+1]&255)<<16|(we[Ve+2]&255)<<8|we[Ve+3]&255;for(je=16;je<64;je++)De=Ue[je-2],Mt=(De>>>17|De<<15)^(De>>>19|De<<13)^De>>>10,De=Ue[je-15],Oe=(De>>>7|De<<25)^(De>>>18|De<<14)^De>>>3,Ue[je]=(Mt+Ue[je-7]|0)+(Oe+Ue[je-16]|0)|0;for(je=0;je<64;je++)Mt=(((qe>>>6|qe<<26)^(qe>>>11|qe<<21)^(qe>>>25|qe<<7))+(qe&Pe^~qe&Ge)|0)+(Ce+(ke[je]+Ue[je]|0)|0)|0,Oe=((ue>>>2|ue<<30)^(ue>>>13|ue<<19)^(ue>>>22|ue<<10))+(ue&ge^ue&Re^ge&Re)|0,Ce=Ge,Ge=Pe,Pe=qe,qe=Ne+Mt|0,Ne=Re,Re=ge,ge=ue,ue=Mt+Oe|0;Te=Te+ue|0,Ie=Ie+ge|0,Fe=Fe+Re|0,Le=Le+Ne|0,He=He+qe|0,ze=ze+Pe|0,Je=Je+Ge|0,Xe=Xe+Ce|0,Ae+=64,be-=64}}$t($e);let _e,se=$e.length%64,ce=$e.length/536870912|0,de=$e.length<<3,he=se<56?56:120,ve=$e.slice($e.length-se,$e.length);for(ve.push(128),_e=se+1;_e<he;_e++)ve.push(0);return ve.push(ce>>>24&255),ve.push(ce>>>16&255),ve.push(ce>>>8&255),ve.push(ce>>>0&255),ve.push(de>>>24&255),ve.push(de>>>16&255),ve.push(de>>>8&255),ve.push(de>>>0&255),$t(ve),[Te>>>24&255,Te>>>16&255,Te>>>8&255,Te>>>0&255,Ie>>>24&255,Ie>>>16&255,Ie>>>8&255,Ie>>>0&255,Fe>>>24&255,Fe>>>16&255,Fe>>>8&255,Fe>>>0&255,Le>>>24&255,Le>>>16&255,Le>>>8&255,Le>>>0&255,He>>>24&255,He>>>16&255,He>>>8&255,He>>>0&255,ze>>>24&255,ze>>>16&255,ze>>>8&255,ze>>>0&255,Je>>>24&255,Je>>>16&255,Je>>>8&255,Je>>>0&255,Xe>>>24&255,Xe>>>16&255,Xe>>>8&255,Xe>>>0&255]}function ae($e,ke,Te){$e=$e.length<=64?$e:fe($e);const Ie=64+ke.length+4,Fe=new Array(Ie),Le=new Array(64);let He,ze=[];for(He=0;He<64;He++)Fe[He]=54;for(He=0;He<$e.length;He++)Fe[He]^=$e[He];for(He=0;He<ke.length;He++)Fe[64+He]=ke[He];for(He=Ie-4;He<Ie;He++)Fe[He]=0;for(He=0;He<64;He++)Le[He]=92;for(He=0;He<$e.length;He++)Le[He]^=$e[He];function Je(){for(let Xe=Ie-1;Xe>=Ie-4;Xe--){if(Fe[Xe]++,Fe[Xe]<=255)return;Fe[Xe]=0}}for(;Te>=32;)Je(),ze=ze.concat(fe(Le.concat(fe(Fe)))),Te-=32;return Te>0&&(Je(),ze=ze.concat(fe(Le.concat(fe(Fe))).slice(0,Te))),ze}function le($e,ke,Te,Ie,Fe){let Le;for(xe($e,(2*Te-1)*16,Fe,0,16),Le=0;Le<2*Te;Le++)ye($e,Le*16,Fe,16),me(Fe,Ie),xe(Fe,0,$e,ke+Le*16,16);for(Le=0;Le<Te;Le++)xe($e,ke+Le*2*16,$e,Le*16,16);for(Le=0;Le<Te;Le++)xe($e,ke+(Le*2+1)*16,$e,(Le+Te)*16,16)}function pe($e,ke){return $e<<ke|$e>>>32-ke}function me($e,ke){xe($e,0,ke,0,16);for(let Te=8;Te>0;Te-=2)ke[4]^=pe(ke[0]+ke[12],7),ke[8]^=pe(ke[4]+ke[0],9),ke[12]^=pe(ke[8]+ke[4],13),ke[0]^=pe(ke[12]+ke[8],18),ke[9]^=pe(ke[5]+ke[1],7),ke[13]^=pe(ke[9]+ke[5],9),ke[1]^=pe(ke[13]+ke[9],13),ke[5]^=pe(ke[1]+ke[13],18),ke[14]^=pe(ke[10]+ke[6],7),ke[2]^=pe(ke[14]+ke[10],9),ke[6]^=pe(ke[2]+ke[14],13),ke[10]^=pe(ke[6]+ke[2],18),ke[3]^=pe(ke[15]+ke[11],7),ke[7]^=pe(ke[3]+ke[15],9),ke[11]^=pe(ke[7]+ke[3],13),ke[15]^=pe(ke[11]+ke[7],18),ke[1]^=pe(ke[0]+ke[3],7),ke[2]^=pe(ke[1]+ke[0],9),ke[3]^=pe(ke[2]+ke[1],13),ke[0]^=pe(ke[3]+ke[2],18),ke[6]^=pe(ke[5]+ke[4],7),ke[7]^=pe(ke[6]+ke[5],9),ke[4]^=pe(ke[7]+ke[6],13),ke[5]^=pe(ke[4]+ke[7],18),ke[11]^=pe(ke[10]+ke[9],7),ke[8]^=pe(ke[11]+ke[10],9),ke[9]^=pe(ke[8]+ke[11],13),ke[10]^=pe(ke[9]+ke[8],18),ke[12]^=pe(ke[15]+ke[14],7),ke[13]^=pe(ke[12]+ke[15],9),ke[14]^=pe(ke[13]+ke[12],13),ke[15]^=pe(ke[14]+ke[13],18);for(let Te=0;Te<16;++Te)$e[Te]+=ke[Te]}function ye($e,ke,Te,Ie){for(let Fe=0;Fe<Ie;Fe++)Te[Fe]^=$e[ke+Fe]}function xe($e,ke,Te,Ie,Fe){for(;Fe--;)Te[Ie++]=$e[ke++]}function Ee($e){if(!$e||typeof $e.length!="number")return!1;for(let ke=0;ke<$e.length;ke++){const Te=$e[ke];if(typeof Te!="number"||Te%1||Te<0||Te>=256)return!1}return!0}function Se($e,ke){if(typeof $e!="number"||$e%1)throw new Error("invalid "+ke);return $e}function Me($e,ke,Te,Ie,Fe,Le,He){if(Te=Se(Te,"N"),Ie=Se(Ie,"r"),Fe=Se(Fe,"p"),Le=Se(Le,"dkLen"),Te===0||Te&Te-1)throw new Error("N must be power of 2");if(Te>2147483647/128/Ie)throw new Error("N too large");if(Ie>2147483647/128/Fe)throw new Error("r too large");if(!Ee($e))throw new Error("password must be an array or buffer");if($e=Array.prototype.slice.call($e),!Ee(ke))throw new Error("salt must be an array or buffer");ke=Array.prototype.slice.call(ke);let ze=ae($e,ke,Fe*128*Ie);const Je=new Uint32Array(Fe*32*Ie);for(let qe=0;qe<Je.length;qe++){const Pe=qe*4;Je[qe]=(ze[Pe+3]&255)<<24|(ze[Pe+2]&255)<<16|(ze[Pe+1]&255)<<8|(ze[Pe+0]&255)<<0}const Xe=new Uint32Array(64*Ie),Ue=new Uint32Array(32*Ie*Te),$t=32*Ie,_e=new Uint32Array(16),se=new Uint32Array(16),ce=Fe*Te*2;let de=0,he=null,ve=!1,we=0,Ae=0,be,ue;const ge=He?parseInt(1e3/Ie):4294967295,Re=typeof setImmediate<"u"?setImmediate:setTimeout,Ne=function(){if(ve)return He(new Error("cancelled"),de/ce);let qe;switch(we){case 0:ue=Ae*32*Ie,xe(Je,ue,Xe,0,$t),we=1,be=0;case 1:qe=Te-be,qe>ge&&(qe=ge);for(let Ge=0;Ge<qe;Ge++)xe(Xe,0,Ue,(be+Ge)*$t,$t),le(Xe,$t,Ie,_e,se);if(be+=qe,de+=qe,He){const Ge=parseInt(1e3*de/ce);if(Ge!==he){if(ve=He(null,de/ce),ve)break;he=Ge}}if(be<Te)break;be=0,we=2;case 2:qe=Te-be,qe>ge&&(qe=ge);for(let Ge=0;Ge<qe;Ge++){const Ce=(2*Ie-1)*16,De=Xe[Ce]&Te-1;ye(Ue,De*$t,Xe,$t),le(Xe,$t,Ie,_e,se)}if(be+=qe,de+=qe,He){const Ge=parseInt(1e3*de/ce);if(Ge!==he){if(ve=He(null,de/ce),ve)break;he=Ge}}if(be<Te)break;if(xe(Xe,0,Je,ue,$t),Ae++,Ae<Fe){we=0;break}ze=[];for(let Ge=0;Ge<Je.length;Ge++)ze.push(Je[Ge]>>0&255),ze.push(Je[Ge]>>8&255),ze.push(Je[Ge]>>16&255),ze.push(Je[Ge]>>24&255);const Pe=ae($e,ze,Le);return He&&He(null,1,Pe),Pe}He&&Re(Ne)};if(!He)for(;;){const qe=Ne();if(qe!=null)return qe}Ne()}const Be={scrypt:function($e,ke,Te,Ie,Fe,Le,He){return new Promise(function(ze,Je){let Xe=0;He&&He(0),Me($e,ke,Te,Ie,Fe,Le,function(Ue,$t,_e){if(Ue)Je(Ue);else if(_e)He&&Xe!==1&&He(1),ze(new Uint8Array(_e));else if(He&&$t!==Xe)return Xe=$t,He($t)})})},syncScrypt:function($e,ke,Te,Ie,Fe,Le){return new Uint8Array(Me($e,ke,Te,Ie,Fe,Le))}};c.exports=Be})()})(scrypt$1);var scryptExports=scrypt$1.exports;const scrypt=getDefaultExportFromCjs$2(scryptExports);var __awaiter$g=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$9=new Logger(version$c);function hasMnemonic$1(c){return c!=null&&c.mnemonic&&c.mnemonic.phrase}class KeystoreAccount extends Description{isKeystoreAccount(t){return!!(t&&t._isKeystoreAccount)}}function _decrypt(c,t,n){if(searchPath(c,"crypto/cipher")==="aes-128-ctr"){const fe=looseArrayify(searchPath(c,"crypto/cipherparams/iv")),ae=new aes$1.Counter(fe),le=new aes$1.ModeOfOperation.ctr(t,ae);return arrayify(le.decrypt(n))}return null}function _getAccount(c,t){const n=looseArrayify(searchPath(c,"crypto/ciphertext"));if(hexlify(keccak256$1(concat$1([t.slice(16,32),n]))).substring(2)!==searchPath(c,"crypto/mac").toLowerCase())throw new Error("invalid password");const fe=_decrypt(c,t.slice(0,16),n);fe||logger$9.throwError("unsupported cipher",Logger.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const ae=t.slice(32,64),le=computeAddress(fe);if(c.address){let me=c.address.toLowerCase();if(me.substring(0,2)!=="0x"&&(me="0x"+me),getAddress(me)!==le)throw new Error("address mismatch")}const pe={_isKeystoreAccount:!0,address:le,privateKey:hexlify(fe)};if(searchPath(c,"x-ethers/version")==="0.1"){const me=looseArrayify(searchPath(c,"x-ethers/mnemonicCiphertext")),ye=looseArrayify(searchPath(c,"x-ethers/mnemonicCounter")),xe=new aes$1.Counter(ye),Ee=new aes$1.ModeOfOperation.ctr(ae,xe),Se=searchPath(c,"x-ethers/path")||defaultPath,Me=searchPath(c,"x-ethers/locale")||"en",Be=arrayify(Ee.decrypt(me));try{const $e=entropyToMnemonic(Be,Me),ke=HDNode.fromMnemonic($e,null,Me).derivePath(Se);if(ke.privateKey!=pe.privateKey)throw new Error("mnemonic mismatch");pe.mnemonic=ke.mnemonic}catch($e){if($e.code!==Logger.errors.INVALID_ARGUMENT||$e.argument!=="wordlist")throw $e}}return new KeystoreAccount(pe)}function pbkdf2Sync(c,t,n,ie,fe){return arrayify(pbkdf2$1(c,t,n,ie,fe))}function pbkdf2(c,t,n,ie,fe){return Promise.resolve(pbkdf2Sync(c,t,n,ie,fe))}function _computeKdfKey(c,t,n,ie,fe){const ae=getPassword(t),le=searchPath(c,"crypto/kdf");if(le&&typeof le=="string"){const pe=function(me,ye){return logger$9.throwArgumentError("invalid key-derivation function parameters",me,ye)};if(le.toLowerCase()==="scrypt"){const me=looseArrayify(searchPath(c,"crypto/kdfparams/salt")),ye=parseInt(searchPath(c,"crypto/kdfparams/n")),xe=parseInt(searchPath(c,"crypto/kdfparams/r")),Ee=parseInt(searchPath(c,"crypto/kdfparams/p"));(!ye||!xe||!Ee)&&pe("kdf",le),ye&ye-1&&pe("N",ye);const Se=parseInt(searchPath(c,"crypto/kdfparams/dklen"));return Se!==32&&pe("dklen",Se),ie(ae,me,ye,xe,Ee,64,fe)}else if(le.toLowerCase()==="pbkdf2"){const me=looseArrayify(searchPath(c,"crypto/kdfparams/salt"));let ye=null;const xe=searchPath(c,"crypto/kdfparams/prf");xe==="hmac-sha256"?ye="sha256":xe==="hmac-sha512"?ye="sha512":pe("prf",xe);const Ee=parseInt(searchPath(c,"crypto/kdfparams/c")),Se=parseInt(searchPath(c,"crypto/kdfparams/dklen"));return Se!==32&&pe("dklen",Se),n(ae,me,Ee,Se,ye)}}return logger$9.throwArgumentError("unsupported key-derivation function","kdf",le)}function decryptSync(c,t){const n=JSON.parse(c),ie=_computeKdfKey(n,t,pbkdf2Sync,scrypt.syncScrypt);return _getAccount(n,ie)}function decrypt(c,t,n){return __awaiter$g(this,void 0,void 0,function*(){const ie=JSON.parse(c),fe=yield _computeKdfKey(ie,t,pbkdf2,scrypt.scrypt,n);return _getAccount(ie,fe)})}function encrypt(c,t,n,ie){try{if(getAddress(c.address)!==computeAddress(c.privateKey))throw new Error("address/privateKey mismatch");if(hasMnemonic$1(c)){const ke=c.mnemonic;if(HDNode.fromMnemonic(ke.phrase,null,ke.locale).derivePath(ke.path||defaultPath).privateKey!=c.privateKey)throw new Error("mnemonic mismatch")}}catch(ke){return Promise.reject(ke)}typeof n=="function"&&!ie&&(ie=n,n={}),n||(n={});const fe=arrayify(c.privateKey),ae=getPassword(t);let le=null,pe=null,me=null;if(hasMnemonic$1(c)){const ke=c.mnemonic;le=arrayify(mnemonicToEntropy(ke.phrase,ke.locale||"en")),pe=ke.path||defaultPath,me=ke.locale||"en"}let ye=n.client;ye||(ye="ethers.js");let xe=null;n.salt?xe=arrayify(n.salt):xe=randomBytes$1(32);let Ee=null;if(n.iv){if(Ee=arrayify(n.iv),Ee.length!==16)throw new Error("invalid iv")}else Ee=randomBytes$1(16);let Se=null;if(n.uuid){if(Se=arrayify(n.uuid),Se.length!==16)throw new Error("invalid uuid")}else Se=randomBytes$1(16);let Me=1<<17,Be=8,$e=1;return n.scrypt&&(n.scrypt.N&&(Me=n.scrypt.N),n.scrypt.r&&(Be=n.scrypt.r),n.scrypt.p&&($e=n.scrypt.p)),scrypt.scrypt(ae,xe,Me,Be,$e,64,ie).then(ke=>{ke=arrayify(ke);const Te=ke.slice(0,16),Ie=ke.slice(16,32),Fe=ke.slice(32,64),Le=new aes$1.Counter(Ee),He=new aes$1.ModeOfOperation.ctr(Te,Le),ze=arrayify(He.encrypt(fe)),Je=keccak256$1(concat$1([Ie,ze])),Xe={address:c.address.substring(2).toLowerCase(),id:uuidV4(Se),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:hexlify(Ee).substring(2)},ciphertext:hexlify(ze).substring(2),kdf:"scrypt",kdfparams:{salt:hexlify(xe).substring(2),n:Me,dklen:32,p:$e,r:Be},mac:Je.substring(2)}};if(le){const Ue=randomBytes$1(16),$t=new aes$1.Counter(Ue),_e=new aes$1.ModeOfOperation.ctr(Fe,$t),se=arrayify(_e.encrypt(le)),ce=new Date,de=ce.getUTCFullYear()+"-"+zpad(ce.getUTCMonth()+1,2)+"-"+zpad(ce.getUTCDate(),2)+"T"+zpad(ce.getUTCHours(),2)+"-"+zpad(ce.getUTCMinutes(),2)+"-"+zpad(ce.getUTCSeconds(),2)+".0Z";Xe["x-ethers"]={client:ye,gethFilename:"UTC--"+de+"--"+Xe.address,mnemonicCounter:hexlify(Ue).substring(2),mnemonicCiphertext:hexlify(se).substring(2),path:pe,locale:me,version:"0.1"}}return JSON.stringify(Xe)})}function decryptJsonWallet(c,t,n){if(isCrowdsaleWallet(c)){n&&n(0);const ie=decrypt$1(c,t);return n&&n(1),Promise.resolve(ie)}return isKeystoreWallet(c)?decrypt(c,t,n):Promise.reject(new Error("invalid JSON wallet"))}function decryptJsonWalletSync(c,t){if(isCrowdsaleWallet(c))return decrypt$1(c,t);if(isKeystoreWallet(c))return decryptSync(c,t);throw new Error("invalid JSON wallet")}const lib_esm$4=Object.freeze(Object.defineProperty({__proto__:null,decryptCrowdsale:decrypt$1,decryptJsonWallet,decryptJsonWalletSync,decryptKeystore:decrypt,decryptKeystoreSync:decryptSync,encryptKeystore:encrypt,getJsonWalletAddress,isCrowdsaleWallet,isKeystoreWallet},Symbol.toStringTag,{value:"Module"})),version$b="wallet/5.8.0";var __awaiter$f=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$8=new Logger(version$b);function isAccount(c){return c!=null&&isHexString(c.privateKey,32)&&c.address!=null}function hasMnemonic(c){const t=c.mnemonic;return t&&t.phrase}class Wallet extends Signer{constructor(t,n){if(super(),isAccount(t)){const ie=new SigningKey(t.privateKey);if(defineReadOnly(this,"_signingKey",()=>ie),defineReadOnly(this,"address",computeAddress(this.publicKey)),this.address!==getAddress(t.address)&&logger$8.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),hasMnemonic(t)){const fe=t.mnemonic;defineReadOnly(this,"_mnemonic",()=>({phrase:fe.phrase,path:fe.path||defaultPath,locale:fe.locale||"en"}));const ae=this.mnemonic,le=HDNode.fromMnemonic(ae.phrase,null,ae.locale).derivePath(ae.path);computeAddress(le.privateKey)!==this.address&&logger$8.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else defineReadOnly(this,"_mnemonic",()=>null)}else{if(SigningKey.isSigningKey(t))t.curve!=="secp256k1"&&logger$8.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),defineReadOnly(this,"_signingKey",()=>t);else{typeof t=="string"&&t.match(/^[0-9a-f]*$/i)&&t.length===64&&(t="0x"+t);const ie=new SigningKey(t);defineReadOnly(this,"_signingKey",()=>ie)}defineReadOnly(this,"_mnemonic",()=>null),defineReadOnly(this,"address",computeAddress(this.publicKey))}n&&!Provider.isProvider(n)&&logger$8.throwArgumentError("invalid provider","provider",n),defineReadOnly(this,"provider",n||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(t){return new Wallet(this,t)}signTransaction(t){return resolveProperties(t).then(n=>{n.from!=null&&(getAddress(n.from)!==this.address&&logger$8.throwArgumentError("transaction from address mismatch","transaction.from",t.from),delete n.from);const ie=this._signingKey().signDigest(keccak256$1(serialize$1(n)));return serialize$1(n,ie)})}signMessage(t){return __awaiter$f(this,void 0,void 0,function*(){return joinSignature(this._signingKey().signDigest(hashMessage(t)))})}_signTypedData(t,n,ie){return __awaiter$f(this,void 0,void 0,function*(){const fe=yield TypedDataEncoder.resolveNames(t,n,ie,ae=>(this.provider==null&&logger$8.throwError("cannot resolve ENS names without a provider",Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:ae}),this.provider.resolveName(ae)));return joinSignature(this._signingKey().signDigest(TypedDataEncoder.hash(fe.domain,n,fe.value)))})}encrypt(t,n,ie){if(typeof n=="function"&&!ie&&(ie=n,n={}),ie&&typeof ie!="function")throw new Error("invalid callback");return n||(n={}),encrypt(this,t,n,ie)}static createRandom(t){let n=randomBytes$1(16);t||(t={}),t.extraEntropy&&(n=arrayify(hexDataSlice(keccak256$1(concat$1([n,t.extraEntropy])),0,16)));const ie=entropyToMnemonic(n,t.locale);return Wallet.fromMnemonic(ie,t.path,t.locale)}static fromEncryptedJson(t,n,ie){return decryptJsonWallet(t,n,ie).then(fe=>new Wallet(fe))}static fromEncryptedJsonSync(t,n){return new Wallet(decryptJsonWalletSync(t,n))}static fromMnemonic(t,n,ie){return n||(n=defaultPath),new Wallet(HDNode.fromMnemonic(t,null,ie).derivePath(n))}}function verifyMessage(c,t){return recoverAddress(hashMessage(c),t)}function verifyTypedData(c,t,n,ie){return recoverAddress(TypedDataEncoder.hash(c,t,n),ie)}const lib_esm$3=Object.freeze(Object.defineProperty({__proto__:null,Wallet,verifyMessage,verifyTypedData},Symbol.toStringTag,{value:"Module"})),version$a="networks/5.8.0",logger$7=new Logger(version$a);function isRenetworkable(c){return c&&typeof c.renetwork=="function"}function ethDefaultProvider(c){const t=function(n,ie){ie==null&&(ie={});const fe=[];if(n.InfuraProvider&&ie.infura!=="-")try{fe.push(new n.InfuraProvider(c,ie.infura))}catch{}if(n.EtherscanProvider&&ie.etherscan!=="-")try{fe.push(new n.EtherscanProvider(c,ie.etherscan))}catch{}if(n.AlchemyProvider&&ie.alchemy!=="-")try{fe.push(new n.AlchemyProvider(c,ie.alchemy))}catch{}if(n.PocketProvider&&ie.pocket!=="-"){const ae=["goerli","ropsten","rinkeby","sepolia"];try{const le=new n.PocketProvider(c,ie.pocket);le.network&&ae.indexOf(le.network.name)===-1&&fe.push(le)}catch{}}if(n.CloudflareProvider&&ie.cloudflare!=="-")try{fe.push(new n.CloudflareProvider(c))}catch{}if(n.AnkrProvider&&ie.ankr!=="-")try{const ae=["ropsten"],le=new n.AnkrProvider(c,ie.ankr);le.network&&ae.indexOf(le.network.name)===-1&&fe.push(le)}catch{}if(n.QuickNodeProvider&&ie.quicknode!=="-")try{fe.push(new n.QuickNodeProvider(c,ie.quicknode))}catch{}if(fe.length===0)return null;if(n.FallbackProvider){let ae=1;return ie.quorum!=null?ae=ie.quorum:c==="homestead"&&(ae=2),new n.FallbackProvider(fe,ae)}return fe[0]};return t.renetwork=function(n){return ethDefaultProvider(n)},t}function etcDefaultProvider(c,t){const n=function(ie,fe){return ie.JsonRpcProvider?new ie.JsonRpcProvider(c,t):null};return n.renetwork=function(ie){return etcDefaultProvider(c,ie)},n}const homestead={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:ethDefaultProvider("homestead")},ropsten={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:ethDefaultProvider("ropsten")},classicMordor={chainId:63,name:"classicMordor",_defaultProvider:etcDefaultProvider("https://www.ethercluster.com/mordor","classicMordor")},networks$2={unspecified:{chainId:0,name:"unspecified"},homestead,mainnet:homestead,morden:{chainId:2,name:"morden"},ropsten,testnet:ropsten,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:ethDefaultProvider("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:ethDefaultProvider("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:ethDefaultProvider("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"sepolia",_defaultProvider:ethDefaultProvider("sepolia")},holesky:{chainId:17e3,name:"holesky",_defaultProvider:ethDefaultProvider("holesky")},classic:{chainId:61,name:"classic",_defaultProvider:etcDefaultProvider("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor,classicTestnet:classicMordor,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:etcDefaultProvider("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:ethDefaultProvider("matic")},maticmum:{chainId:80001,name:"maticmum",_defaultProvider:ethDefaultProvider("maticmum")},optimism:{chainId:10,name:"optimism",_defaultProvider:ethDefaultProvider("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},"optimism-sepolia":{chainId:11155420,name:"optimism-sepolia"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},"arbitrum-sepolia":{chainId:421614,name:"arbitrum-sepolia"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function getNetwork(c){if(c==null)return null;if(typeof c=="number"){for(const ie in networks$2){const fe=networks$2[ie];if(fe.chainId===c)return{name:fe.name,chainId:fe.chainId,ensAddress:fe.ensAddress||null,_defaultProvider:fe._defaultProvider||null}}return{chainId:c,name:"unknown"}}if(typeof c=="string"){const ie=networks$2[c];return ie==null?null:{name:ie.name,chainId:ie.chainId,ensAddress:ie.ensAddress,_defaultProvider:ie._defaultProvider||null}}const t=networks$2[c.name];if(!t)return typeof c.chainId!="number"&&logger$7.throwArgumentError("invalid network chainId","network",c),c;c.chainId!==0&&c.chainId!==t.chainId&&logger$7.throwArgumentError("network chainId mismatch","network",c);let n=c._defaultProvider||null;return n==null&&t._defaultProvider&&(isRenetworkable(t._defaultProvider)?n=t._defaultProvider.renetwork(c):n=t._defaultProvider),{name:c.name,chainId:t.chainId,ensAddress:c.ensAddress||t.ensAddress||null,_defaultProvider:n}}const version$9="web/5.8.0";var __awaiter$e=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};function getUrl(c,t){return __awaiter$e(this,void 0,void 0,function*(){t==null&&(t={});const n={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(t.skipFetchSetup!==!0&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),t.fetchOptions!=null){const le=t.fetchOptions;le.mode&&(n.mode=le.mode),le.cache&&(n.cache=le.cache),le.credentials&&(n.credentials=le.credentials),le.redirect&&(n.redirect=le.redirect),le.referrer&&(n.referrer=le.referrer)}const ie=yield fetch(c,n),fe=yield ie.arrayBuffer(),ae={};return ie.headers.forEach?ie.headers.forEach((le,pe)=>{ae[pe.toLowerCase()]=le}):ie.headers.keys().forEach(le=>{ae[le.toLowerCase()]=ie.headers.get(le)}),{headers:ae,statusCode:ie.status,statusMessage:ie.statusText,body:arrayify(new Uint8Array(fe))}})}var __awaiter$d=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$6=new Logger(version$9);function staller(c){return new Promise(t=>{setTimeout(t,c)})}function bodyify(c,t){if(c==null)return null;if(typeof c=="string")return c;if(isBytesLike(c)){if(t&&(t.split("/")[0]==="text"||t.split(";")[0].trim()==="application/json"))try{return toUtf8String(c)}catch{}return hexlify(c)}return c}function unpercent(c){return toUtf8Bytes(c.replace(/%([0-9a-f][0-9a-f])/gi,(t,n)=>String.fromCharCode(parseInt(n,16))))}function _fetchData(c,t,n){const ie=typeof c=="object"&&c.throttleLimit!=null?c.throttleLimit:12;logger$6.assertArgument(ie>0&&ie%1===0,"invalid connection throttle limit","connection.throttleLimit",ie);const fe=typeof c=="object"?c.throttleCallback:null,ae=typeof c=="object"&&typeof c.throttleSlotInterval=="number"?c.throttleSlotInterval:100;logger$6.assertArgument(ae>0&&ae%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",ae);const le=typeof c=="object"?!!c.errorPassThrough:!1,pe={};let me=null;const ye={method:"GET"};let xe=!1,Ee=2*60*1e3;if(typeof c=="string")me=c;else if(typeof c=="object"){if((c==null||c.url==null)&&logger$6.throwArgumentError("missing URL","connection.url",c),me=c.url,typeof c.timeout=="number"&&c.timeout>0&&(Ee=c.timeout),c.headers)for(const Te in c.headers)pe[Te.toLowerCase()]={key:Te,value:String(c.headers[Te])},["if-none-match","if-modified-since"].indexOf(Te.toLowerCase())>=0&&(xe=!0);if(ye.allowGzip=!!c.allowGzip,c.user!=null&&c.password!=null){me.substring(0,6)!=="https:"&&c.allowInsecureAuthentication!==!0&&logger$6.throwError("basic authentication requires a secure https url",Logger.errors.INVALID_ARGUMENT,{argument:"url",url:me,user:c.user,password:"[REDACTED]"});const Te=c.user+":"+c.password;pe.authorization={key:"Authorization",value:"Basic "+encode$9(toUtf8Bytes(Te))}}c.skipFetchSetup!=null&&(ye.skipFetchSetup=!!c.skipFetchSetup),c.fetchOptions!=null&&(ye.fetchOptions=shallowCopy(c.fetchOptions))}const Se=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),Me=me?me.match(Se):null;if(Me)try{const Te={statusCode:200,statusMessage:"OK",headers:{"content-type":Me[1]||"text/plain"},body:Me[2]?decode$a(Me[3]):unpercent(Me[3])};let Ie=Te.body;return n&&(Ie=n(Te.body,Te)),Promise.resolve(Ie)}catch(Te){logger$6.throwError("processing response error",Logger.errors.SERVER_ERROR,{body:bodyify(Me[1],Me[2]),error:Te,requestBody:null,requestMethod:"GET",url:me})}t&&(ye.method="POST",ye.body=t,pe["content-type"]==null&&(pe["content-type"]={key:"Content-Type",value:"application/octet-stream"}),pe["content-length"]==null&&(pe["content-length"]={key:"Content-Length",value:String(t.length)}));const Be={};Object.keys(pe).forEach(Te=>{const Ie=pe[Te];Be[Ie.key]=Ie.value}),ye.headers=Be;const $e=function(){let Te=null;return{promise:new Promise(function(Le,He){Ee&&(Te=setTimeout(()=>{Te!=null&&(Te=null,He(logger$6.makeError("timeout",Logger.errors.TIMEOUT,{requestBody:bodyify(ye.body,Be["content-type"]),requestMethod:ye.method,timeout:Ee,url:me})))},Ee))}),cancel:function(){Te!=null&&(clearTimeout(Te),Te=null)}}}(),ke=function(){return __awaiter$d(this,void 0,void 0,function*(){for(let Te=0;Te<ie;Te++){let Ie=null;try{if(Ie=yield getUrl(me,ye),Te<ie){if(Ie.statusCode===301||Ie.statusCode===302){const Le=Ie.headers.location||"";if(ye.method==="GET"&&Le.match(/^https:/)){me=Ie.headers.location;continue}}else if(Ie.statusCode===429){let Le=!0;if(fe&&(Le=yield fe(Te,me)),Le){let He=0;const ze=Ie.headers["retry-after"];typeof ze=="string"&&ze.match(/^[1-9][0-9]*$/)?He=parseInt(ze)*1e3:He=ae*parseInt(String(Math.random()*Math.pow(2,Te))),yield staller(He);continue}}}}catch(Le){Ie=Le.response,Ie==null&&($e.cancel(),logger$6.throwError("missing response",Logger.errors.SERVER_ERROR,{requestBody:bodyify(ye.body,Be["content-type"]),requestMethod:ye.method,serverError:Le,url:me}))}let Fe=Ie.body;if(xe&&Ie.statusCode===304?Fe=null:!le&&(Ie.statusCode<200||Ie.statusCode>=300)&&($e.cancel(),logger$6.throwError("bad response",Logger.errors.SERVER_ERROR,{status:Ie.statusCode,headers:Ie.headers,body:bodyify(Fe,Ie.headers?Ie.headers["content-type"]:null),requestBody:bodyify(ye.body,Be["content-type"]),requestMethod:ye.method,url:me})),n)try{const Le=yield n(Fe,Ie);return $e.cancel(),Le}catch(Le){if(Le.throttleRetry&&Te<ie){let He=!0;if(fe&&(He=yield fe(Te,me)),He){const ze=ae*parseInt(String(Math.random()*Math.pow(2,Te)));yield staller(ze);continue}}$e.cancel(),logger$6.throwError("processing response error",Logger.errors.SERVER_ERROR,{body:bodyify(Fe,Ie.headers?Ie.headers["content-type"]:null),error:Le,requestBody:bodyify(ye.body,Be["content-type"]),requestMethod:ye.method,url:me})}return $e.cancel(),Fe}return logger$6.throwError("failed response",Logger.errors.SERVER_ERROR,{requestBody:bodyify(ye.body,Be["content-type"]),requestMethod:ye.method,url:me})})}();return Promise.race([$e.promise,ke])}function fetchJson(c,t,n){let ie=(ae,le)=>{let pe=null;if(ae!=null)try{pe=JSON.parse(toUtf8String(ae))}catch(me){logger$6.throwError("invalid JSON",Logger.errors.SERVER_ERROR,{body:ae,error:me})}return n&&(pe=n(pe,le)),pe},fe=null;if(t!=null){fe=toUtf8Bytes(t);const ae=typeof c=="string"?{url:c}:shallowCopy(c);ae.headers?Object.keys(ae.headers).filter(pe=>pe.toLowerCase()==="content-type").length!==0||(ae.headers=shallowCopy(ae.headers),ae.headers["content-type"]="application/json"):ae.headers={"content-type":"application/json"},c=ae}return _fetchData(c,fe,ie)}function poll(c,t){return t||(t={}),t=shallowCopy(t),t.floor==null&&(t.floor=0),t.ceiling==null&&(t.ceiling=1e4),t.interval==null&&(t.interval=250),new Promise(function(n,ie){let fe=null,ae=!1;const le=()=>ae?!1:(ae=!0,fe&&clearTimeout(fe),!0);t.timeout&&(fe=setTimeout(()=>{le()&&ie(new Error("timeout"))},t.timeout));const pe=t.retryLimit;let me=0;function ye(){return c().then(function(xe){if(xe!==void 0)le()&&n(xe);else if(t.oncePoll)t.oncePoll.once("poll",ye);else if(t.onceBlock)t.onceBlock.once("block",ye);else if(!ae){if(me++,me>pe){le()&&ie(new Error("retry limit reached"));return}let Ee=t.interval*parseInt(String(Math.random()*Math.pow(2,me)));Ee<t.floor&&(Ee=t.floor),Ee>t.ceiling&&(Ee=t.ceiling),setTimeout(ye,Ee)}return null},function(xe){le()&&ie(xe)})}ye()})}const lib_esm$2=Object.freeze(Object.defineProperty({__proto__:null,_fetchData,fetchJson,poll},Symbol.toStringTag,{value:"Module"}));var ALPHABET$2="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ALPHABET_MAP$1={};for(var z$3=0;z$3<ALPHABET$2.length;z$3++){var x$2=ALPHABET$2.charAt(z$3);if(ALPHABET_MAP$1[x$2]!==void 0)throw new TypeError(x$2+" is ambiguous");ALPHABET_MAP$1[x$2]=z$3}function polymodStep$1(c){var t=c>>25;return(c&33554431)<<5^-(t>>0&1)&996825010^-(t>>1&1)&642813549^-(t>>2&1)&513874426^-(t>>3&1)&1027748829^-(t>>4&1)&705979059}function prefixChk$1(c){for(var t=1,n=0;n<c.length;++n){var ie=c.charCodeAt(n);if(ie<33||ie>126)return"Invalid prefix ("+c+")";t=polymodStep$1(t)^ie>>5}for(t=polymodStep$1(t),n=0;n<c.length;++n){var fe=c.charCodeAt(n);t=polymodStep$1(t)^fe&31}return t}function encode$8(c,t,n){if(n=n||90,c.length+7+t.length>n)throw new TypeError("Exceeds length limit");c=c.toLowerCase();var ie=prefixChk$1(c);if(typeof ie=="string")throw new Error(ie);for(var fe=c+"1",ae=0;ae<t.length;++ae){var le=t[ae];if(le>>5)throw new Error("Non 5-bit word");ie=polymodStep$1(ie)^le,fe+=ALPHABET$2.charAt(le)}for(ae=0;ae<6;++ae)ie=polymodStep$1(ie);for(ie^=1,ae=0;ae<6;++ae){var pe=ie>>(5-ae)*5&31;fe+=ALPHABET$2.charAt(pe)}return fe}function __decode(c,t){if(t=t||90,c.length<8)return c+" too short";if(c.length>t)return"Exceeds length limit";var n=c.toLowerCase(),ie=c.toUpperCase();if(c!==n&&c!==ie)return"Mixed-case string "+c;c=n;var fe=c.lastIndexOf("1");if(fe===-1)return"No separator character for "+c;if(fe===0)return"Missing prefix for "+c;var ae=c.slice(0,fe),le=c.slice(fe+1);if(le.length<6)return"Data too short";var pe=prefixChk$1(ae);if(typeof pe=="string")return pe;for(var me=[],ye=0;ye<le.length;++ye){var xe=le.charAt(ye),Ee=ALPHABET_MAP$1[xe];if(Ee===void 0)return"Unknown character "+xe;pe=polymodStep$1(pe)^Ee,!(ye+6>=le.length)&&me.push(Ee)}return pe!==1?"Invalid checksum for "+c:{prefix:ae,words:me}}function decodeUnsafe(){var c=__decode.apply(null,arguments);if(typeof c=="object")return c}function decode$9(c){var t=__decode.apply(null,arguments);if(typeof t=="object")return t;throw new Error(t)}function convert$1(c,t,n,ie){for(var fe=0,ae=0,le=(1<<n)-1,pe=[],me=0;me<c.length;++me)for(fe=fe<<t|c[me],ae+=t;ae>=n;)ae-=n,pe.push(fe>>ae&le);if(ie)ae>0&&pe.push(fe<<n-ae&le);else{if(ae>=t)return"Excess padding";if(fe<<n-ae&le)return"Non-zero padding"}return pe}function toWordsUnsafe(c){var t=convert$1(c,8,5,!0);if(Array.isArray(t))return t}function toWords$1(c){var t=convert$1(c,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)}function fromWordsUnsafe$1(c){var t=convert$1(c,5,8,!1);if(Array.isArray(t))return t}function fromWords$1(c){var t=convert$1(c,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}var bech32$1={decodeUnsafe,decode:decode$9,encode:encode$8,toWordsUnsafe,toWords:toWords$1,fromWordsUnsafe:fromWordsUnsafe$1,fromWords:fromWords$1};const bech32$2=getDefaultExportFromCjs$2(bech32$1),version$8="providers/5.8.0",logger$5=new Logger(version$8);class Formatter{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},n=this.address.bind(this),ie=this.bigNumber.bind(this),fe=this.blockTag.bind(this),ae=this.data.bind(this),le=this.hash.bind(this),pe=this.hex.bind(this),me=this.number.bind(this),ye=this.type.bind(this),xe=Ee=>this.data(Ee,!0);return t.transaction={hash:le,type:ye,accessList:Formatter.allowNull(this.accessList.bind(this),null),blockHash:Formatter.allowNull(le,null),blockNumber:Formatter.allowNull(me,null),transactionIndex:Formatter.allowNull(me,null),confirmations:Formatter.allowNull(me,null),from:n,gasPrice:Formatter.allowNull(ie),maxPriorityFeePerGas:Formatter.allowNull(ie),maxFeePerGas:Formatter.allowNull(ie),gasLimit:ie,to:Formatter.allowNull(n,null),value:ie,nonce:me,data:ae,r:Formatter.allowNull(this.uint256),s:Formatter.allowNull(this.uint256),v:Formatter.allowNull(me),creates:Formatter.allowNull(n,null),raw:Formatter.allowNull(ae)},t.transactionRequest={from:Formatter.allowNull(n),nonce:Formatter.allowNull(me),gasLimit:Formatter.allowNull(ie),gasPrice:Formatter.allowNull(ie),maxPriorityFeePerGas:Formatter.allowNull(ie),maxFeePerGas:Formatter.allowNull(ie),to:Formatter.allowNull(n),value:Formatter.allowNull(ie),data:Formatter.allowNull(xe),type:Formatter.allowNull(me),accessList:Formatter.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:me,blockNumber:me,transactionHash:le,address:n,topics:Formatter.arrayOf(le),data:ae,logIndex:me,blockHash:le},t.receipt={to:Formatter.allowNull(this.address,null),from:Formatter.allowNull(this.address,null),contractAddress:Formatter.allowNull(n,null),transactionIndex:me,root:Formatter.allowNull(pe),gasUsed:ie,logsBloom:Formatter.allowNull(ae),blockHash:le,transactionHash:le,logs:Formatter.arrayOf(this.receiptLog.bind(this)),blockNumber:me,confirmations:Formatter.allowNull(me,null),cumulativeGasUsed:ie,effectiveGasPrice:Formatter.allowNull(ie),status:Formatter.allowNull(me),type:ye},t.block={hash:Formatter.allowNull(le),parentHash:le,number:me,timestamp:me,nonce:Formatter.allowNull(pe),difficulty:this.difficulty.bind(this),gasLimit:ie,gasUsed:ie,miner:Formatter.allowNull(n),extraData:ae,transactions:Formatter.allowNull(Formatter.arrayOf(le)),baseFeePerGas:Formatter.allowNull(ie)},t.blockWithTransactions=shallowCopy(t.block),t.blockWithTransactions.transactions=Formatter.allowNull(Formatter.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:Formatter.allowNull(fe,void 0),toBlock:Formatter.allowNull(fe,void 0),blockHash:Formatter.allowNull(le,void 0),address:Formatter.allowNull(n,void 0),topics:Formatter.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:Formatter.allowNull(me),blockHash:Formatter.allowNull(le),transactionIndex:me,removed:Formatter.allowNull(this.boolean.bind(this)),address:n,data:Formatter.allowFalsish(ae,"0x"),topics:Formatter.arrayOf(le),transactionHash:le,logIndex:me},t}accessList(t){return accessListify(t||[])}number(t){return t==="0x"?0:BigNumber.from(t).toNumber()}type(t){return t==="0x"||t==null?0:BigNumber.from(t).toNumber()}bigNumber(t){return BigNumber.from(t)}boolean(t){if(typeof t=="boolean")return t;if(typeof t=="string"){if(t=t.toLowerCase(),t==="true")return!0;if(t==="false")return!1}throw new Error("invalid boolean - "+t)}hex(t,n){return typeof t=="string"&&(!n&&t.substring(0,2)!=="0x"&&(t="0x"+t),isHexString(t))?t.toLowerCase():logger$5.throwArgumentError("invalid hash","value",t)}data(t,n){const ie=this.hex(t,n);if(ie.length%2!==0)throw new Error("invalid data; odd-length - "+t);return ie}address(t){return getAddress(t)}callAddress(t){if(!isHexString(t,32))return null;const n=getAddress(hexDataSlice(t,12));return n===AddressZero?null:n}contractAddress(t){return getContractAddress(t)}blockTag(t){if(t==null)return"latest";if(t==="earliest")return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if(typeof t=="number"||isHexString(t))return hexValue(t);throw new Error("invalid blockTag")}hash(t,n){const ie=this.hex(t,n);return hexDataLength(ie)!==32?logger$5.throwArgumentError("invalid hash","value",t):ie}difficulty(t){if(t==null)return null;const n=BigNumber.from(t);try{return n.toNumber()}catch{}return null}uint256(t){if(!isHexString(t))throw new Error("invalid uint256");return hexZeroPad(t,32)}_block(t,n){t.author!=null&&t.miner==null&&(t.miner=t.author);const ie=t._difficulty!=null?t._difficulty:t.difficulty,fe=Formatter.check(n,t);return fe._difficulty=ie==null?null:BigNumber.from(ie),fe}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return Formatter.check(this.formats.transactionRequest,t)}transactionResponse(t){t.gas!=null&&t.gasLimit==null&&(t.gasLimit=t.gas),t.to&&BigNumber.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),t.input!=null&&t.data==null&&(t.data=t.input),t.to==null&&t.creates==null&&(t.creates=this.contractAddress(t)),(t.type===1||t.type===2)&&t.accessList==null&&(t.accessList=[]);const n=Formatter.check(this.formats.transaction,t);if(t.chainId!=null){let ie=t.chainId;isHexString(ie)&&(ie=BigNumber.from(ie).toNumber()),n.chainId=ie}else{let ie=t.networkId;ie==null&&n.v==null&&(ie=t.chainId),isHexString(ie)&&(ie=BigNumber.from(ie).toNumber()),typeof ie!="number"&&n.v!=null&&(ie=(n.v-35)/2,ie<0&&(ie=0),ie=parseInt(ie)),typeof ie!="number"&&(ie=0),n.chainId=ie}return n.blockHash&&n.blockHash.replace(/0/g,"")==="x"&&(n.blockHash=null),n}transaction(t){return parse$2(t)}receiptLog(t){return Formatter.check(this.formats.receiptLog,t)}receipt(t){const n=Formatter.check(this.formats.receipt,t);if(n.root!=null)if(n.root.length<=4){const ie=BigNumber.from(n.root).toNumber();ie===0||ie===1?(n.status!=null&&n.status!==ie&&logger$5.throwArgumentError("alt-root-status/status mismatch","value",{root:n.root,status:n.status}),n.status=ie,delete n.root):logger$5.throwArgumentError("invalid alt-root-status","value.root",n.root)}else n.root.length!==66&&logger$5.throwArgumentError("invalid root hash","value.root",n.root);return n.status!=null&&(n.byzantium=!0),n}topics(t){return Array.isArray(t)?t.map(n=>this.topics(n)):t!=null?this.hash(t,!0):null}filter(t){return Formatter.check(this.formats.filter,t)}filterLog(t){return Formatter.check(this.formats.filterLog,t)}static check(t,n){const ie={};for(const fe in t)try{const ae=t[fe](n[fe]);ae!==void 0&&(ie[fe]=ae)}catch(ae){throw ae.checkKey=fe,ae.checkValue=n[fe],ae}return ie}static allowNull(t,n){return function(ie){return ie==null?n:t(ie)}}static allowFalsish(t,n){return function(ie){return ie?t(ie):n}}static arrayOf(t){return function(n){if(!Array.isArray(n))throw new Error("not an array");const ie=[];return n.forEach(function(fe){ie.push(t(fe))}),ie}}}var __awaiter$c=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$4=new Logger(version$8),MAX_CCIP_REDIRECTS=10;function checkTopic(c){return c==null?"null":(hexDataLength(c)!==32&&logger$4.throwArgumentError("invalid topic","topic",c),c.toLowerCase())}function serializeTopics(c){for(c=c.slice();c.length>0&&c[c.length-1]==null;)c.pop();return c.map(t=>{if(Array.isArray(t)){const n={};t.forEach(fe=>{n[checkTopic(fe)]=!0});const ie=Object.keys(n);return ie.sort(),ie.join("|")}else return checkTopic(t)}).join("&")}function deserializeTopics(c){return c===""?[]:c.split(/&/g).map(t=>{if(t==="")return[];const n=t.split("|").map(ie=>ie==="null"?null:ie);return n.length===1?n[0]:n})}function getEventTag(c){if(typeof c=="string"){if(c=c.toLowerCase(),hexDataLength(c)===32)return"tx:"+c;if(c.indexOf(":")===-1)return c}else{if(Array.isArray(c))return"filter:*:"+serializeTopics(c);if(ForkEvent.isForkEvent(c))throw logger$4.warn("not implemented"),new Error("not implemented");if(c&&typeof c=="object")return"filter:"+(c.address||"*")+":"+serializeTopics(c.topics||[])}throw new Error("invalid event - "+c)}function getTime(){return new Date().getTime()}function stall(c){return new Promise(t=>{setTimeout(t,c)})}const PollableEvents=["block","network","pending","poll"];let Event$1=class{constructor(t,n,ie){defineReadOnly(this,"tag",t),defineReadOnly(this,"listener",n),defineReadOnly(this,"once",ie),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const t=this.tag.split(":");return t[0]!=="tx"?null:t[1]}get filter(){const t=this.tag.split(":");if(t[0]!=="filter")return null;const n=t[1],ie=deserializeTopics(t[2]),fe={};return ie.length>0&&(fe.topics=ie),n&&n!=="*"&&(fe.address=n),fe}pollable(){return this.tag.indexOf(":")>=0||PollableEvents.indexOf(this.tag)>=0}};const coinInfos={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function bytes32ify(c){return hexZeroPad(BigNumber.from(c).toHexString(),32)}function base58Encode(c){return Base58.encode(concat$1([c,hexDataSlice(sha256$7(sha256$7(c)),0,4)]))}const matcherIpfs=new RegExp("^(ipfs)://(.*)$","i"),matchers=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),matcherIpfs,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function _parseString(c,t){try{return toUtf8String(_parseBytes(c,t))}catch{}return null}function _parseBytes(c,t){if(c==="0x")return null;const n=BigNumber.from(hexDataSlice(c,t,t+32)).toNumber(),ie=BigNumber.from(hexDataSlice(c,n,n+32)).toNumber();return hexDataSlice(c,n+32,n+32+ie)}function getIpfsLink(c){return c.match(/^ipfs:\/\/ipfs\//i)?c=c.substring(12):c.match(/^ipfs:\/\//i)?c=c.substring(7):logger$4.throwArgumentError("unsupported IPFS format","link",c),`https://gateway.ipfs.io/ipfs/${c}`}function numPad(c){const t=arrayify(c);if(t.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(t,32-t.length),n}function bytesPad(c){if(c.length%32===0)return c;const t=new Uint8Array(Math.ceil(c.length/32)*32);return t.set(c),t}function encodeBytes(c){const t=[];let n=0;for(let ie=0;ie<c.length;ie++)t.push(null),n+=32;for(let ie=0;ie<c.length;ie++){const fe=arrayify(c[ie]);t[ie]=numPad(n),t.push(numPad(fe.length)),t.push(bytesPad(fe)),n+=32+Math.ceil(fe.length/32)*32}return hexConcat(t)}class Resolver{constructor(t,n,ie,fe){defineReadOnly(this,"provider",t),defineReadOnly(this,"name",ie),defineReadOnly(this,"address",t.formatter.address(n)),defineReadOnly(this,"_resolvedAddress",fe)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then(t=>BigNumber.from(t).eq(1)).catch(t=>{if(t.code===Logger.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t})),this._supportsEip2544}_fetch(t,n){return __awaiter$c(this,void 0,void 0,function*(){const ie={to:this.address,ccipReadEnabled:!0,data:hexConcat([t,namehash$1(this.name),n||"0x"])};let fe=!1;(yield this.supportsWildcard())&&(fe=!0,ie.data=hexConcat(["0x9061b923",encodeBytes([dnsEncode(this.name),ie.data])]));try{let ae=yield this.provider.call(ie);return arrayify(ae).length%32===4&&logger$4.throwError("resolver threw error",Logger.errors.CALL_EXCEPTION,{transaction:ie,data:ae}),fe&&(ae=_parseBytes(ae,0)),ae}catch(ae){if(ae.code===Logger.errors.CALL_EXCEPTION)return null;throw ae}})}_fetchBytes(t,n){return __awaiter$c(this,void 0,void 0,function*(){const ie=yield this._fetch(t,n);return ie!=null?_parseBytes(ie,0):null})}_getAddress(t,n){const ie=coinInfos[String(t)];if(ie==null&&logger$4.throwError(`unsupported coin type: ${t}`,Logger.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),ie.ilk==="eth")return this.provider.formatter.address(n);const fe=arrayify(n);if(ie.p2pkh!=null){const ae=n.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(ae){const le=parseInt(ae[1],16);if(ae[2].length===le*2&&le>=1&&le<=75)return base58Encode(concat$1([[ie.p2pkh],"0x"+ae[2]]))}}if(ie.p2sh!=null){const ae=n.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(ae){const le=parseInt(ae[1],16);if(ae[2].length===le*2&&le>=1&&le<=75)return base58Encode(concat$1([[ie.p2sh],"0x"+ae[2]]))}}if(ie.prefix!=null){const ae=fe[1];let le=fe[0];if(le===0?ae!==20&&ae!==32&&(le=-1):le=-1,le>=0&&fe.length===2+ae&&ae>=1&&ae<=75){const pe=bech32$2.toWords(fe.slice(2));return pe.unshift(le),bech32$2.encode(ie.prefix,pe)}}return null}getAddress(t){return __awaiter$c(this,void 0,void 0,function*(){if(t==null&&(t=60),t===60)try{const fe=yield this._fetch("0x3b3b57de");return fe==="0x"||fe===HashZero?null:this.provider.formatter.callAddress(fe)}catch(fe){if(fe.code===Logger.errors.CALL_EXCEPTION)return null;throw fe}const n=yield this._fetchBytes("0xf1cb7e06",bytes32ify(t));if(n==null||n==="0x")return null;const ie=this._getAddress(t,n);return ie==null&&logger$4.throwError("invalid or unsupported coin data",Logger.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:n}),ie})}getAvatar(){return __awaiter$c(this,void 0,void 0,function*(){const t=[{type:"name",content:this.name}];try{const n=yield this.getText("avatar");if(n==null)return null;for(let ie=0;ie<matchers.length;ie++){const fe=n.match(matchers[ie]);if(fe==null)continue;const ae=fe[1].toLowerCase();switch(ae){case"https":return t.push({type:"url",content:n}),{linkage:t,url:n};case"data":return t.push({type:"data",content:n}),{linkage:t,url:n};case"ipfs":return t.push({type:"ipfs",content:n}),{linkage:t,url:getIpfsLink(n)};case"erc721":case"erc1155":{const le=ae==="erc721"?"0xc87b56dd":"0x0e89341c";t.push({type:ae,content:n});const pe=this._resolvedAddress||(yield this.getAddress()),me=(fe[2]||"").split("/");if(me.length!==2)return null;const ye=yield this.provider.formatter.address(me[0]),xe=hexZeroPad(BigNumber.from(me[1]).toHexString(),32);if(ae==="erc721"){const $e=this.provider.formatter.callAddress(yield this.provider.call({to:ye,data:hexConcat(["0x6352211e",xe])}));if(pe!==$e)return null;t.push({type:"owner",content:$e})}else if(ae==="erc1155"){const $e=BigNumber.from(yield this.provider.call({to:ye,data:hexConcat(["0x00fdd58e",hexZeroPad(pe,32),xe])}));if($e.isZero())return null;t.push({type:"balance",content:$e.toString()})}const Ee={to:this.provider.formatter.address(me[0]),data:hexConcat([le,xe])};let Se=_parseString(yield this.provider.call(Ee),0);if(Se==null)return null;t.push({type:"metadata-url-base",content:Se}),ae==="erc1155"&&(Se=Se.replace("{id}",xe.substring(2)),t.push({type:"metadata-url-expanded",content:Se})),Se.match(/^ipfs:/i)&&(Se=getIpfsLink(Se)),t.push({type:"metadata-url",content:Se});const Me=yield fetchJson(Se);if(!Me)return null;t.push({type:"metadata",content:JSON.stringify(Me)});let Be=Me.image;if(typeof Be!="string")return null;if(!Be.match(/^(https:\/\/|data:)/i)){if(Be.match(matcherIpfs)==null)return null;t.push({type:"url-ipfs",content:Be}),Be=getIpfsLink(Be)}return t.push({type:"url",content:Be}),{linkage:t,url:Be}}}}}catch{}return null})}getContentHash(){return __awaiter$c(this,void 0,void 0,function*(){const t=yield this._fetchBytes("0xbc1c58d1");if(t==null||t==="0x")return null;const n=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const le=parseInt(n[3],16);if(n[4].length===le*2)return"ipfs://"+Base58.encode("0x"+n[1])}const ie=t.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(ie){const le=parseInt(ie[3],16);if(ie[4].length===le*2)return"ipns://"+Base58.encode("0x"+ie[1])}const fe=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(fe&&fe[1].length===32*2)return"bzz://"+fe[1];const ae=t.match(/^0x90b2c605([0-9a-f]*)$/);if(ae&&ae[1].length===34*2){const le={"=":"","+":"-","/":"_"};return"sia://"+encode$9("0x"+ae[1]).replace(/[=+\/]/g,me=>le[me])}return logger$4.throwError("invalid or unsupported content hash data",Logger.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})})}getText(t){return __awaiter$c(this,void 0,void 0,function*(){let n=toUtf8Bytes(t);n=concat$1([bytes32ify(64),bytes32ify(n.length),n]),n.length%32!==0&&(n=concat$1([n,hexZeroPad("0x",32-t.length%32)]));const ie=yield this._fetchBytes("0x59d1d43c",hexlify(n));return ie==null||ie==="0x"?null:toUtf8String(ie)})}}let defaultFormatter=null,nextPollId=1;class BaseProvider extends Provider{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),defineReadOnly(this,"anyNetwork",t==="any"),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch(n=>{}),this._ready().catch(n=>{});else{const n=getStatic(new.target,"getNetwork")(t);n?(defineReadOnly(this,"_network",n),this.emit("network",n,null)):logger$4.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return __awaiter$c(this,void 0,void 0,function*(){if(this._network==null){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch{}t==null&&(t=yield this.detectNetwork()),t||logger$4.throwError("no network detected",Logger.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=t:defineReadOnly(this,"_network",t),this.emit("network",t,null))}return this._network})}get ready(){return poll(()=>this._ready().then(t=>t,t=>{if(!(t.code===Logger.errors.NETWORK_ERROR&&t.event==="noNetwork"))throw t}))}static getFormatter(){return defaultFormatter==null&&(defaultFormatter=new Formatter),defaultFormatter}static getNetwork(t){return getNetwork(t??"homestead")}ccipReadFetch(t,n,ie){return __awaiter$c(this,void 0,void 0,function*(){if(this.disableCcipRead||ie.length===0)return null;const fe=t.to.toLowerCase(),ae=n.toLowerCase(),le=[];for(let pe=0;pe<ie.length;pe++){const me=ie[pe],ye=me.replace("{sender}",fe).replace("{data}",ae),xe=me.indexOf("{data}")>=0?null:JSON.stringify({data:ae,sender:fe}),Ee=yield fetchJson({url:ye,errorPassThrough:!0},xe,(Me,Be)=>(Me.status=Be.statusCode,Me));if(Ee.data)return Ee.data;const Se=Ee.message||"unknown error";if(Ee.status>=400&&Ee.status<500)return logger$4.throwError(`response not found during CCIP fetch: ${Se}`,Logger.errors.SERVER_ERROR,{url:me,errorMessage:Se});le.push(Se)}return logger$4.throwError(`error encountered during CCIP fetch: ${le.map(pe=>JSON.stringify(pe)).join(", ")}`,Logger.errors.SERVER_ERROR,{urls:ie,errorMessages:le})})}_getInternalBlockNumber(t){return __awaiter$c(this,void 0,void 0,function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const fe=this._internalBlockNumber;try{const ae=yield fe;if(getTime()-ae.respTime<=t)return ae.blockNumber;break}catch{if(this._internalBlockNumber===fe)break}}const n=getTime(),ie=resolveProperties({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(fe=>null,fe=>fe)}).then(({blockNumber:fe,networkError:ae})=>{if(ae)throw this._internalBlockNumber===ie&&(this._internalBlockNumber=null),ae;const le=getTime();return fe=BigNumber.from(fe).toNumber(),fe<this._maxInternalBlockNumber&&(fe=this._maxInternalBlockNumber),this._maxInternalBlockNumber=fe,this._setFastBlockNumber(fe),{blockNumber:fe,reqTime:n,respTime:le}});return this._internalBlockNumber=ie,ie.catch(fe=>{this._internalBlockNumber===ie&&(this._internalBlockNumber=null)}),(yield ie).blockNumber})}poll(){return __awaiter$c(this,void 0,void 0,function*(){const t=nextPollId++,n=[];let ie=null;try{ie=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(fe){this.emit("error",fe);return}if(this._setFastBlockNumber(ie),this.emit("poll",t,ie),ie===this._lastBlockNumber){this.emit("didPoll",t);return}if(this._emitted.block===-2&&(this._emitted.block=ie-1),Math.abs(this._emitted.block-ie)>1e3)logger$4.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${ie})`),this.emit("error",logger$4.makeError("network block skew detected",Logger.errors.NETWORK_ERROR,{blockNumber:ie,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",ie);else for(let fe=this._emitted.block+1;fe<=ie;fe++)this.emit("block",fe);this._emitted.block!==ie&&(this._emitted.block=ie,Object.keys(this._emitted).forEach(fe=>{if(fe==="block")return;const ae=this._emitted[fe];ae!=="pending"&&ie-ae>12&&delete this._emitted[fe]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=ie-1),this._events.forEach(fe=>{switch(fe.type){case"tx":{const ae=fe.hash;let le=this.getTransactionReceipt(ae).then(pe=>(!pe||pe.blockNumber==null||(this._emitted["t:"+ae]=pe.blockNumber,this.emit(ae,pe)),null)).catch(pe=>{this.emit("error",pe)});n.push(le);break}case"filter":{if(!fe._inflight){fe._inflight=!0,fe._lastBlockNumber===-2&&(fe._lastBlockNumber=ie-1);const ae=fe.filter;ae.fromBlock=fe._lastBlockNumber+1,ae.toBlock=ie;const le=ae.toBlock-this._maxFilterBlockRange;le>ae.fromBlock&&(ae.fromBlock=le),ae.fromBlock<0&&(ae.fromBlock=0);const pe=this.getLogs(ae).then(me=>{fe._inflight=!1,me.length!==0&&me.forEach(ye=>{ye.blockNumber>fe._lastBlockNumber&&(fe._lastBlockNumber=ye.blockNumber),this._emitted["b:"+ye.blockHash]=ye.blockNumber,this._emitted["t:"+ye.transactionHash]=ye.blockNumber,this.emit(ae,ye)})}).catch(me=>{this.emit("error",me),fe._inflight=!1});n.push(pe)}break}}}),this._lastBlockNumber=ie,Promise.all(n).then(()=>{this.emit("didPoll",t)}).catch(fe=>{this.emit("error",fe)})})}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return __awaiter$c(this,void 0,void 0,function*(){return logger$4.throwError("provider does not support network detection",Logger.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return __awaiter$c(this,void 0,void 0,function*(){const t=yield this._ready(),n=yield this.detectNetwork();if(t.chainId!==n.chainId){if(this.anyNetwork)return this._network=n,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",n,t),yield stall(0),this._network;const ie=logger$4.makeError("underlying network changed",Logger.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:n});throw this.emit("error",ie),ie}return t})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(t=>{this._setFastBlockNumber(t)},t=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(t){t&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!t&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(t){if(typeof t!="number"||t<=0||parseInt(String(t))!=t)throw new Error("invalid polling interval");this._pollingInterval=t,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const t=getTime();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then(n=>((this._fastBlockNumber==null||n>this._fastBlockNumber)&&(this._fastBlockNumber=n),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(t){this._fastBlockNumber!=null&&t<this._fastBlockNumber||(this._fastQueryDate=getTime(),(this._fastBlockNumber==null||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,n,ie){return __awaiter$c(this,void 0,void 0,function*(){return this._waitForTransaction(t,n??1,ie||0,null)})}_waitForTransaction(t,n,ie,fe){return __awaiter$c(this,void 0,void 0,function*(){const ae=yield this.getTransactionReceipt(t);return(ae?ae.confirmations:0)>=n?ae:new Promise((le,pe)=>{const me=[];let ye=!1;const xe=function(){return ye?!0:(ye=!0,me.forEach(Se=>{Se()}),!1)},Ee=Se=>{Se.confirmations<n||xe()||le(Se)};if(this.on(t,Ee),me.push(()=>{this.removeListener(t,Ee)}),fe){let Se=fe.startBlock,Me=null;const Be=$e=>__awaiter$c(this,void 0,void 0,function*(){ye||(yield stall(1e3),this.getTransactionCount(fe.from).then(ke=>__awaiter$c(this,void 0,void 0,function*(){if(!ye){if(ke<=fe.nonce)Se=$e;else{{const Te=yield this.getTransaction(t);if(Te&&Te.blockNumber!=null)return}for(Me==null&&(Me=Se-3,Me<fe.startBlock&&(Me=fe.startBlock));Me<=$e;){if(ye)return;const Te=yield this.getBlockWithTransactions(Me);for(let Ie=0;Ie<Te.transactions.length;Ie++){const Fe=Te.transactions[Ie];if(Fe.hash===t)return;if(Fe.from===fe.from&&Fe.nonce===fe.nonce){if(ye)return;const Le=yield this.waitForTransaction(Fe.hash,n);if(xe())return;let He="replaced";Fe.data===fe.data&&Fe.to===fe.to&&Fe.value.eq(fe.value)?He="repriced":Fe.data==="0x"&&Fe.from===Fe.to&&Fe.value.isZero()&&(He="cancelled"),pe(logger$4.makeError("transaction was replaced",Logger.errors.TRANSACTION_REPLACED,{cancelled:He==="replaced"||He==="cancelled",reason:He,replacement:this._wrapTransaction(Fe),hash:t,receipt:Le}));return}}Me++}}ye||this.once("block",Be)}}),ke=>{ye||this.once("block",Be)}))});if(ye)return;this.once("block",Be),me.push(()=>{this.removeListener("block",Be)})}if(typeof ie=="number"&&ie>0){const Se=setTimeout(()=>{xe()||pe(logger$4.makeError("timeout exceeded",Logger.errors.TIMEOUT,{timeout:ie}))},ie);Se.unref&&Se.unref(),me.push(()=>{clearTimeout(Se)})}})})}getBlockNumber(){return __awaiter$c(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return BigNumber.from(t)}catch(n){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:n})}})}getBalance(t,n){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const ie=yield resolveProperties({address:this._getAddress(t),blockTag:this._getBlockTag(n)}),fe=yield this.perform("getBalance",ie);try{return BigNumber.from(fe)}catch(ae){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"getBalance",params:ie,result:fe,error:ae})}})}getTransactionCount(t,n){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const ie=yield resolveProperties({address:this._getAddress(t),blockTag:this._getBlockTag(n)}),fe=yield this.perform("getTransactionCount",ie);try{return BigNumber.from(fe).toNumber()}catch(ae){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"getTransactionCount",params:ie,result:fe,error:ae})}})}getCode(t,n){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const ie=yield resolveProperties({address:this._getAddress(t),blockTag:this._getBlockTag(n)}),fe=yield this.perform("getCode",ie);try{return hexlify(fe)}catch(ae){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"getCode",params:ie,result:fe,error:ae})}})}getStorageAt(t,n,ie){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const fe=yield resolveProperties({address:this._getAddress(t),blockTag:this._getBlockTag(ie),position:Promise.resolve(n).then(le=>hexValue(le))}),ae=yield this.perform("getStorageAt",fe);try{return hexlify(ae)}catch(le){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"getStorageAt",params:fe,result:ae,error:le})}})}_wrapTransaction(t,n,ie){if(n!=null&&hexDataLength(n)!==32)throw new Error("invalid response - sendTransaction");const fe=t;return n!=null&&t.hash!==n&&logger$4.throwError("Transaction hash mismatch from Provider.sendTransaction.",Logger.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:n}),fe.wait=(ae,le)=>__awaiter$c(this,void 0,void 0,function*(){ae==null&&(ae=1),le==null&&(le=0);let pe;ae!==0&&ie!=null&&(pe={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:ie});const me=yield this._waitForTransaction(t.hash,ae,le,pe);return me==null&&ae===0?null:(this._emitted["t:"+t.hash]=me.blockNumber,me.status===0&&logger$4.throwError("transaction failed",Logger.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:me}),me)}),fe}sendTransaction(t){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield Promise.resolve(t).then(ae=>hexlify(ae)),ie=this.formatter.transaction(t);ie.confirmations==null&&(ie.confirmations=0);const fe=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const ae=yield this.perform("sendTransaction",{signedTransaction:n});return this._wrapTransaction(ie,ae,fe)}catch(ae){throw ae.transaction=ie,ae.transactionHash=ie.hash,ae}})}_getTransactionRequest(t){return __awaiter$c(this,void 0,void 0,function*(){const n=yield t,ie={};return["from","to"].forEach(fe=>{n[fe]!=null&&(ie[fe]=Promise.resolve(n[fe]).then(ae=>ae?this._getAddress(ae):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(fe=>{n[fe]!=null&&(ie[fe]=Promise.resolve(n[fe]).then(ae=>ae?BigNumber.from(ae):null))}),["type"].forEach(fe=>{n[fe]!=null&&(ie[fe]=Promise.resolve(n[fe]).then(ae=>ae??null))}),n.accessList&&(ie.accessList=this.formatter.accessList(n.accessList)),["data"].forEach(fe=>{n[fe]!=null&&(ie[fe]=Promise.resolve(n[fe]).then(ae=>ae?hexlify(ae):null))}),this.formatter.transactionRequest(yield resolveProperties(ie))})}_getFilter(t){return __awaiter$c(this,void 0,void 0,function*(){t=yield t;const n={};return t.address!=null&&(n.address=this._getAddress(t.address)),["blockHash","topics"].forEach(ie=>{t[ie]!=null&&(n[ie]=t[ie])}),["fromBlock","toBlock"].forEach(ie=>{t[ie]!=null&&(n[ie]=this._getBlockTag(t[ie]))}),this.formatter.filter(yield resolveProperties(n))})}_call(t,n,ie){return __awaiter$c(this,void 0,void 0,function*(){ie>=MAX_CCIP_REDIRECTS&&logger$4.throwError("CCIP read exceeded maximum redirections",Logger.errors.SERVER_ERROR,{redirects:ie,transaction:t});const fe=t.to,ae=yield this.perform("call",{transaction:t,blockTag:n});if(ie>=0&&n==="latest"&&fe!=null&&ae.substring(0,10)==="0x556f1830"&&hexDataLength(ae)%32===4)try{const le=hexDataSlice(ae,4),pe=hexDataSlice(le,0,32);BigNumber.from(pe).eq(fe)||logger$4.throwError("CCIP Read sender did not match",Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:ae});const me=[],ye=BigNumber.from(hexDataSlice(le,32,64)).toNumber(),xe=BigNumber.from(hexDataSlice(le,ye,ye+32)).toNumber(),Ee=hexDataSlice(le,ye+32);for(let Te=0;Te<xe;Te++){const Ie=_parseString(Ee,Te*32);Ie==null&&logger$4.throwError("CCIP Read contained corrupt URL string",Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:ae}),me.push(Ie)}const Se=_parseBytes(le,64);BigNumber.from(hexDataSlice(le,100,128)).isZero()||logger$4.throwError("CCIP Read callback selector included junk",Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:ae});const Me=hexDataSlice(le,96,100),Be=_parseBytes(le,128),$e=yield this.ccipReadFetch(t,Se,me);$e==null&&logger$4.throwError("CCIP Read disabled or provided no URLs",Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:ae});const ke={to:fe,data:hexConcat([Me,encodeBytes([$e,Be])])};return this._call(ke,n,ie+1)}catch(le){if(le.code===Logger.errors.SERVER_ERROR)throw le}try{return hexlify(ae)}catch(le){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"call",params:{transaction:t,blockTag:n},result:ae,error:le})}})}call(t,n){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const ie=yield resolveProperties({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(n),ccipReadEnabled:Promise.resolve(t.ccipReadEnabled)});return this._call(ie.transaction,ie.blockTag,ie.ccipReadEnabled?0:-1)})}estimateGas(t){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield resolveProperties({transaction:this._getTransactionRequest(t)}),ie=yield this.perform("estimateGas",n);try{return BigNumber.from(ie)}catch(fe){return logger$4.throwError("bad result from backend",Logger.errors.SERVER_ERROR,{method:"estimateGas",params:n,result:ie,error:fe})}})}_getAddress(t){return __awaiter$c(this,void 0,void 0,function*(){t=yield t,typeof t!="string"&&logger$4.throwArgumentError("invalid address or ENS name","name",t);const n=yield this.resolveName(t);return n==null&&logger$4.throwError("ENS name not configured",Logger.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),n})}_getBlock(t,n){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;let ie=-128;const fe={includeTransactions:!!n};if(isHexString(t,32))fe.blockHash=t;else try{fe.blockTag=yield this._getBlockTag(t),isHexString(fe.blockTag)&&(ie=parseInt(fe.blockTag.substring(2),16))}catch{logger$4.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return poll(()=>__awaiter$c(this,void 0,void 0,function*(){const ae=yield this.perform("getBlock",fe);if(ae==null)return fe.blockHash!=null&&this._emitted["b:"+fe.blockHash]==null||fe.blockTag!=null&&ie>this._emitted.block?null:void 0;if(n){let le=null;for(let me=0;me<ae.transactions.length;me++){const ye=ae.transactions[me];if(ye.blockNumber==null)ye.confirmations=0;else if(ye.confirmations==null){le==null&&(le=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let xe=le-ye.blockNumber+1;xe<=0&&(xe=1),ye.confirmations=xe}}const pe=this.formatter.blockWithTransactions(ae);return pe.transactions=pe.transactions.map(me=>this._wrapTransaction(me)),pe}return this.formatter.block(ae)}),{oncePoll:this})})}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;const n={transactionHash:this.formatter.hash(t,!0)};return poll(()=>__awaiter$c(this,void 0,void 0,function*(){const ie=yield this.perform("getTransaction",n);if(ie==null)return this._emitted["t:"+t]==null?null:void 0;const fe=this.formatter.transactionResponse(ie);if(fe.blockNumber==null)fe.confirmations=0;else if(fe.confirmations==null){let le=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-fe.blockNumber+1;le<=0&&(le=1),fe.confirmations=le}return this._wrapTransaction(fe)}),{oncePoll:this})})}getTransactionReceipt(t){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork(),t=yield t;const n={transactionHash:this.formatter.hash(t,!0)};return poll(()=>__awaiter$c(this,void 0,void 0,function*(){const ie=yield this.perform("getTransactionReceipt",n);if(ie==null)return this._emitted["t:"+t]==null?null:void 0;if(ie.blockHash==null)return;const fe=this.formatter.receipt(ie);if(fe.blockNumber==null)fe.confirmations=0;else if(fe.confirmations==null){let le=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-fe.blockNumber+1;le<=0&&(le=1),fe.confirmations=le}return fe}),{oncePoll:this})})}getLogs(t){return __awaiter$c(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield resolveProperties({filter:this._getFilter(t)}),ie=yield this.perform("getLogs",n);return ie.forEach(fe=>{fe.removed==null&&(fe.removed=!1)}),Formatter.arrayOf(this.formatter.filterLog.bind(this.formatter))(ie)})}getEtherPrice(){return __awaiter$c(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(t){return __awaiter$c(this,void 0,void 0,function*(){if(t=yield t,typeof t=="number"&&t<0){t%1&&logger$4.throwArgumentError("invalid BlockTag","blockTag",t);let n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return n+=t,n<0&&(n=0),this.formatter.blockTag(n)}return this.formatter.blockTag(t)})}getResolver(t){return __awaiter$c(this,void 0,void 0,function*(){let n=t;for(;;){if(n===""||n==="."||t!=="eth"&&n==="eth")return null;const ie=yield this._getResolver(n,"getResolver");if(ie!=null){const fe=new Resolver(this,ie,t);return n!==t&&!(yield fe.supportsWildcard())?null:fe}n=n.split(".").slice(1).join(".")}})}_getResolver(t,n){return __awaiter$c(this,void 0,void 0,function*(){n==null&&(n="ENS");const ie=yield this.getNetwork();ie.ensAddress||logger$4.throwError("network does not support ENS",Logger.errors.UNSUPPORTED_OPERATION,{operation:n,network:ie.name});try{const fe=yield this.call({to:ie.ensAddress,data:"0x0178b8bf"+namehash$1(t).substring(2)});return this.formatter.callAddress(fe)}catch{}return null})}resolveName(t){return __awaiter$c(this,void 0,void 0,function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(ie){if(isHexString(t))throw ie}typeof t!="string"&&logger$4.throwArgumentError("invalid ENS name","name",t);const n=yield this.getResolver(t);return n?yield n.getAddress():null})}lookupAddress(t){return __awaiter$c(this,void 0,void 0,function*(){t=yield t,t=this.formatter.address(t);const n=t.substring(2).toLowerCase()+".addr.reverse",ie=yield this._getResolver(n,"lookupAddress");if(ie==null)return null;const fe=_parseString(yield this.call({to:ie,data:"0x691f3431"+namehash$1(n).substring(2)}),0);return(yield this.resolveName(fe))!=t?null:fe})}getAvatar(t){return __awaiter$c(this,void 0,void 0,function*(){let n=null;if(isHexString(t)){const ae=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",le=yield this._getResolver(ae,"getAvatar");if(!le)return null;n=new Resolver(this,le,ae);try{const pe=yield n.getAvatar();if(pe)return pe.url}catch(pe){if(pe.code!==Logger.errors.CALL_EXCEPTION)throw pe}try{const pe=_parseString(yield this.call({to:le,data:"0x691f3431"+namehash$1(ae).substring(2)}),0);n=yield this.getResolver(pe)}catch(pe){if(pe.code!==Logger.errors.CALL_EXCEPTION)throw pe;return null}}else if(n=yield this.getResolver(t),!n)return null;const ie=yield n.getAvatar();return ie==null?null:ie.url})}perform(t,n){return logger$4.throwError(t+" not implemented",Logger.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter(n=>n.pollable()).length>0}_stopEvent(t){this.polling=this._events.filter(n=>n.pollable()).length>0}_addEventListener(t,n,ie){const fe=new Event$1(getEventTag(t),n,ie);return this._events.push(fe),this._startEvent(fe),this}on(t,n){return this._addEventListener(t,n,!1)}once(t,n){return this._addEventListener(t,n,!0)}emit(t,...n){let ie=!1,fe=[],ae=getEventTag(t);return this._events=this._events.filter(le=>le.tag!==ae?!0:(setTimeout(()=>{le.listener.apply(this,n)},0),ie=!0,le.once?(fe.push(le),!1):!0)),fe.forEach(le=>{this._stopEvent(le)}),ie}listenerCount(t){if(!t)return this._events.length;let n=getEventTag(t);return this._events.filter(ie=>ie.tag===n).length}listeners(t){if(t==null)return this._events.map(ie=>ie.listener);let n=getEventTag(t);return this._events.filter(ie=>ie.tag===n).map(ie=>ie.listener)}off(t,n){if(n==null)return this.removeAllListeners(t);const ie=[];let fe=!1,ae=getEventTag(t);return this._events=this._events.filter(le=>le.tag!==ae||le.listener!=n||fe?!0:(fe=!0,ie.push(le),!1)),ie.forEach(le=>{this._stopEvent(le)}),this}removeAllListeners(t){let n=[];if(t==null)n=this._events,this._events=[];else{const ie=getEventTag(t);this._events=this._events.filter(fe=>fe.tag!==ie?!0:(n.push(fe),!1))}return n.forEach(ie=>{this._stopEvent(ie)}),this}}var __awaiter$b=function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})};const logger$3=new Logger(version$8),errorGas=["call","estimateGas"];function spelunk(c,t){if(c==null)return null;if(typeof c.message=="string"&&c.message.match("reverted")){const n=isHexString(c.data)?c.data:null;if(!t||n)return{message:c.message,data:n}}if(typeof c=="object"){for(const n in c){const ie=spelunk(c[n],t);if(ie)return ie}return null}if(typeof c=="string")try{return spelunk(JSON.parse(c),t)}catch{}return null}function checkError(c,t,n){const ie=n.transaction||n.signedTransaction;if(c==="call"){const ae=spelunk(t,!0);if(ae)return ae.data;logger$3.throwError("missing revert data in call exception; Transaction reverted without a reason string",Logger.errors.CALL_EXCEPTION,{data:"0x",transaction:ie,error:t})}if(c==="estimateGas"){let ae=spelunk(t.body,!1);ae==null&&(ae=spelunk(t,!1)),ae&&logger$3.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Logger.errors.UNPREDICTABLE_GAS_LIMIT,{reason:ae.message,method:c,transaction:ie,error:t})}let fe=t.message;throw t.code===Logger.errors.SERVER_ERROR&&t.error&&typeof t.error.message=="string"?fe=t.error.message:typeof t.body=="string"?fe=t.body:typeof t.responseText=="string"&&(fe=t.responseText),fe=(fe||"").toLowerCase(),fe.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&logger$3.throwError("insufficient funds for intrinsic transaction cost",Logger.errors.INSUFFICIENT_FUNDS,{error:t,method:c,transaction:ie}),fe.match(/nonce (is )?too low/i)&&logger$3.throwError("nonce has already been used",Logger.errors.NONCE_EXPIRED,{error:t,method:c,transaction:ie}),fe.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&logger$3.throwError("replacement fee too low",Logger.errors.REPLACEMENT_UNDERPRICED,{error:t,method:c,transaction:ie}),fe.match(/only replay-protected/i)&&logger$3.throwError("legacy pre-eip-155 transactions not supported",Logger.errors.UNSUPPORTED_OPERATION,{error:t,method:c,transaction:ie}),errorGas.indexOf(c)>=0&&fe.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&logger$3.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:c,transaction:ie}),t}function timer(c){return new Promise(function(t){setTimeout(t,c)})}function getResult(c){if(c.error){const t=new Error(c.error.message);throw t.code=c.error.code,t.data=c.error.data,t}return c.result}function getLowerCase(c){return c&&c.toLowerCase()}const _constructorGuard={};class JsonRpcSigner extends Signer{constructor(t,n,ie){if(super(),t!==_constructorGuard)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");defineReadOnly(this,"provider",n),ie==null&&(ie=0),typeof ie=="string"?(defineReadOnly(this,"_address",this.provider.formatter.address(ie)),defineReadOnly(this,"_index",null)):typeof ie=="number"?(defineReadOnly(this,"_index",ie),defineReadOnly(this,"_address",null)):logger$3.throwArgumentError("invalid address or index","addressOrIndex",ie)}connect(t){return logger$3.throwError("cannot alter JSON-RPC Signer connection",Logger.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new UncheckedJsonRpcSigner(_constructorGuard,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(t=>(t.length<=this._index&&logger$3.throwError("unknown account #"+this._index,Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index])))}sendUncheckedTransaction(t){t=shallowCopy(t);const n=this.getAddress().then(ie=>(ie&&(ie=ie.toLowerCase()),ie));if(t.gasLimit==null){const ie=shallowCopy(t);ie.from=n,t.gasLimit=this.provider.estimateGas(ie)}return t.to!=null&&(t.to=Promise.resolve(t.to).then(ie=>__awaiter$b(this,void 0,void 0,function*(){if(ie==null)return null;const fe=yield this.provider.resolveName(ie);return fe==null&&logger$3.throwArgumentError("provided ENS name resolves to null","tx.to",ie),fe}))),resolveProperties({tx:resolveProperties(t),sender:n}).then(({tx:ie,sender:fe})=>{ie.from!=null?ie.from.toLowerCase()!==fe&&logger$3.throwArgumentError("from address mismatch","transaction",t):ie.from=fe;const ae=this.provider.constructor.hexlifyTransaction(ie,{from:!0});return this.provider.send("eth_sendTransaction",[ae]).then(le=>le,le=>(typeof le.message=="string"&&le.message.match(/user denied/i)&&logger$3.throwError("user rejected transaction",Logger.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:ie}),checkError("sendTransaction",le,ae)))})}signTransaction(t){return logger$3.throwError("signing transactions is unsupported",Logger.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return __awaiter$b(this,void 0,void 0,function*(){const n=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),ie=yield this.sendUncheckedTransaction(t);try{return yield poll(()=>__awaiter$b(this,void 0,void 0,function*(){const fe=yield this.provider.getTransaction(ie);if(fe!==null)return this.provider._wrapTransaction(fe,ie,n)}),{oncePoll:this.provider})}catch(fe){throw fe.transactionHash=ie,fe}})}signMessage(t){return __awaiter$b(this,void 0,void 0,function*(){const n=typeof t=="string"?toUtf8Bytes(t):t,ie=yield this.getAddress();try{return yield this.provider.send("personal_sign",[hexlify(n),ie.toLowerCase()])}catch(fe){throw typeof fe.message=="string"&&fe.message.match(/user denied/i)&&logger$3.throwError("user rejected signing",Logger.errors.ACTION_REJECTED,{action:"signMessage",from:ie,messageData:t}),fe}})}_legacySignMessage(t){return __awaiter$b(this,void 0,void 0,function*(){const n=typeof t=="string"?toUtf8Bytes(t):t,ie=yield this.getAddress();try{return yield this.provider.send("eth_sign",[ie.toLowerCase(),hexlify(n)])}catch(fe){throw typeof fe.message=="string"&&fe.message.match(/user denied/i)&&logger$3.throwError("user rejected signing",Logger.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:ie,messageData:t}),fe}})}_signTypedData(t,n,ie){return __awaiter$b(this,void 0,void 0,function*(){const fe=yield TypedDataEncoder.resolveNames(t,n,ie,le=>this.provider.resolveName(le)),ae=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[ae.toLowerCase(),JSON.stringify(TypedDataEncoder.getPayload(fe.domain,n,fe.value))])}catch(le){throw typeof le.message=="string"&&le.message.match(/user denied/i)&&logger$3.throwError("user rejected signing",Logger.errors.ACTION_REJECTED,{action:"_signTypedData",from:ae,messageData:{domain:fe.domain,types:n,value:fe.value}}),le}})}unlock(t){return __awaiter$b(this,void 0,void 0,function*(){const n=this.provider,ie=yield this.getAddress();return n.send("personal_unlockAccount",[ie.toLowerCase(),t,null])})}}class UncheckedJsonRpcSigner extends JsonRpcSigner{sendTransaction(t){return this.sendUncheckedTransaction(t).then(n=>({hash:n,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:ie=>this.provider.waitForTransaction(n,ie)}))}}const allowedTransactionKeys={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class JsonRpcProvider extends BaseProvider{constructor(t,n){let ie=n;ie==null&&(ie=new Promise((fe,ae)=>{setTimeout(()=>{this.detectNetwork().then(le=>{fe(le)},le=>{ae(le)})},0)})),super(ie),t||(t=getStatic(this.constructor,"defaultUrl")()),typeof t=="string"?defineReadOnly(this,"connection",Object.freeze({url:t})):defineReadOnly(this,"connection",Object.freeze(shallowCopy(t))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return __awaiter$b(this,void 0,void 0,function*(){yield timer(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch{try{t=yield this.send("net_version",[])}catch{}}if(t!=null){const n=getStatic(this.constructor,"getNetwork");try{return n(BigNumber.from(t).toNumber())}catch(ie){return logger$3.throwError("could not detect network",Logger.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:ie})}}return logger$3.throwError("could not detect network",Logger.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(t){return new JsonRpcSigner(_constructorGuard,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(t=>t.map(n=>this.formatter.address(n)))}send(t,n){const ie={method:t,params:n,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:deepCopy(ie),provider:this});const fe=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(fe&&this._cache[t])return this._cache[t];const ae=fetchJson(this.connection,JSON.stringify(ie),getResult).then(le=>(this.emit("debug",{action:"response",request:ie,response:le,provider:this}),le),le=>{throw this.emit("debug",{action:"response",error:le,request:ie,provider:this}),le});return fe&&(this._cache[t]=ae,setTimeout(()=>{this._cache[t]=null},0)),ae}prepareRequest(t,n){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[getLowerCase(n.address),n.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[getLowerCase(n.address),n.blockTag]];case"getCode":return["eth_getCode",[getLowerCase(n.address),n.blockTag]];case"getStorageAt":return["eth_getStorageAt",[getLowerCase(n.address),hexZeroPad(n.position,32),n.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[n.signedTransaction]];case"getBlock":return n.blockTag?["eth_getBlockByNumber",[n.blockTag,!!n.includeTransactions]]:n.blockHash?["eth_getBlockByHash",[n.blockHash,!!n.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[n.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[n.transactionHash]];case"call":return["eth_call",[getStatic(this.constructor,"hexlifyTransaction")(n.transaction,{from:!0}),n.blockTag]];case"estimateGas":return["eth_estimateGas",[getStatic(this.constructor,"hexlifyTransaction")(n.transaction,{from:!0})]];case"getLogs":return n.filter&&n.filter.address!=null&&(n.filter.address=getLowerCase(n.filter.address)),["eth_getLogs",[n.filter]]}return null}perform(t,n){return __awaiter$b(this,void 0,void 0,function*(){if(t==="call"||t==="estimateGas"){const fe=n.transaction;if(fe&&fe.type!=null&&BigNumber.from(fe.type).isZero()&&fe.maxFeePerGas==null&&fe.maxPriorityFeePerGas==null){const ae=yield this.getFeeData();ae.maxFeePerGas==null&&ae.maxPriorityFeePerGas==null&&(n=shallowCopy(n),n.transaction=shallowCopy(fe),delete n.transaction.type)}}const ie=this.prepareRequest(t,n);ie==null&&logger$3.throwError(t+" not implemented",Logger.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(ie[0],ie[1])}catch(fe){return checkError(t,fe,n)}})}_startEvent(t){t.tag==="pending"&&this._startPending(),super._startEvent(t)}_startPending(){if(this._pendingFilter!=null)return;const t=this,n=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=n,n.then(function(ie){function fe(){t.send("eth_getFilterChanges",[ie]).then(function(ae){if(t._pendingFilter!=n)return null;let le=Promise.resolve();return ae.forEach(function(pe){t._emitted["t:"+pe.toLowerCase()]="pending",le=le.then(function(){return t.getTransaction(pe).then(function(me){return t.emit("pending",me),null})})}),le.then(function(){return timer(1e3)})}).then(function(){if(t._pendingFilter!=n){t.send("eth_uninstallFilter",[ie]);return}return setTimeout(function(){fe()},0),null}).catch(ae=>{})}return fe(),ie}).catch(ie=>{})}_stopEvent(t){t.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,n){const ie=shallowCopy(allowedTransactionKeys);if(n)for(const ae in n)n[ae]&&(ie[ae]=!0);checkProperties(t,ie);const fe={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(ae){if(t[ae]==null)return;const le=hexValue(BigNumber.from(t[ae]));ae==="gasLimit"&&(ae="gas"),fe[ae]=le}),["from","to","data"].forEach(function(ae){t[ae]!=null&&(fe[ae]=hexlify(t[ae]))}),t.accessList&&(fe.accessList=accessListify(t.accessList)),fe}}const logger$2=new Logger(version$8);let _nextId=1;function buildWeb3LegacyFetcher(c,t){const n="Web3LegacyFetcher";return function(ie,fe){const ae={method:ie,params:fe,id:_nextId++,jsonrpc:"2.0"};return new Promise((le,pe)=>{this.emit("debug",{action:"request",fetcher:n,request:deepCopy(ae),provider:this}),t(ae,(me,ye)=>{if(me)return this.emit("debug",{action:"response",fetcher:n,error:me,request:ae,provider:this}),pe(me);if(this.emit("debug",{action:"response",fetcher:n,request:ae,response:ye,provider:this}),ye.error){const xe=new Error(ye.error.message);return xe.code=ye.error.code,xe.data=ye.error.data,pe(xe)}le(ye.result)})})}}function buildEip1193Fetcher(c){return function(t,n){n==null&&(n=[]);const ie={method:t,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:deepCopy(ie),provider:this}),c.request(ie).then(fe=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:ie,response:fe,provider:this}),fe),fe=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:ie,error:fe,provider:this}),fe})}}class Web3Provider extends JsonRpcProvider{constructor(t,n){t==null&&logger$2.throwArgumentError("missing provider","provider",t);let ie=null,fe=null,ae=null;typeof t=="function"?(ie="unknown:",fe=t):(ie=t.host||t.path||"",!ie&&t.isMetaMask&&(ie="metamask"),ae=t,t.request?(ie===""&&(ie="eip-1193:"),fe=buildEip1193Fetcher(t)):t.sendAsync?fe=buildWeb3LegacyFetcher(t,t.sendAsync.bind(t)):t.send?fe=buildWeb3LegacyFetcher(t,t.send.bind(t)):logger$2.throwArgumentError("unsupported provider","provider",t),ie||(ie="unknown:")),super(ie,n),defineReadOnly(this,"jsonRpcFetchFunc",fe),defineReadOnly(this,"provider",ae)}send(t,n){return this.jsonRpcFetchFunc(t,n)}}const version$7="solidity/5.8.0",regexBytes=new RegExp("^bytes([0-9]+)$"),regexNumber=new RegExp("^(u?int)([0-9]*)$"),regexArray=new RegExp("^(.*)\\[([0-9]*)\\]$"),Zeros="0000000000000000000000000000000000000000000000000000000000000000",logger$1=new Logger(version$7);function _pack(c,t,n){switch(c){case"address":return n?zeroPad(t,32):arrayify(t);case"string":return toUtf8Bytes(t);case"bytes":return arrayify(t);case"bool":return t=t?"0x01":"0x00",n?zeroPad(t,32):arrayify(t)}let ie=c.match(regexNumber);if(ie){let fe=parseInt(ie[2]||"256");return(ie[2]&&String(fe)!==ie[2]||fe%8!==0||fe===0||fe>256)&&logger$1.throwArgumentError("invalid number type","type",c),n&&(fe=256),t=BigNumber.from(t).toTwos(fe),zeroPad(t,fe/8)}if(ie=c.match(regexBytes),ie){const fe=parseInt(ie[1]);return(String(fe)!==ie[1]||fe===0||fe>32)&&logger$1.throwArgumentError("invalid bytes type","type",c),arrayify(t).byteLength!==fe&&logger$1.throwArgumentError(`invalid value for ${c}`,"value",t),n?arrayify((t+Zeros).substring(0,66)):t}if(ie=c.match(regexArray),ie&&Array.isArray(t)){const fe=ie[1];parseInt(ie[2]||String(t.length))!=t.length&&logger$1.throwArgumentError(`invalid array length for ${c}`,"value",t);const le=[];return t.forEach(function(pe){le.push(_pack(fe,pe,!0))}),concat$1(le)}return logger$1.throwArgumentError("invalid type","type",c)}function pack(c,t){c.length!=t.length&&logger$1.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const n=[];return c.forEach(function(ie,fe){n.push(_pack(ie,t[fe]))}),hexlify(concat$1(n))}function keccak256(c,t){return keccak256$1(pack(c,t))}function sha256$6(c,t){return sha256$7(pack(c,t))}const lib_esm$1=Object.freeze(Object.defineProperty({__proto__:null,keccak256,pack,sha256:sha256$6},Symbol.toStringTag,{value:"Module"})),version$6="units/5.8.0",logger=new Logger(version$6),names$2=["wei","kwei","mwei","gwei","szabo","finney","ether"];function commify(c){const t=String(c).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||c==="."||c==="-.")&&logger.throwArgumentError("invalid value","value",c);let n=t[0],ie="";for(n.substring(0,1)==="-"&&(ie="-",n=n.substring(1));n.substring(0,1)==="0";)n=n.substring(1);n===""&&(n="0");let fe="";for(t.length===2&&(fe="."+(t[1]||"0"));fe.length>2&&fe[fe.length-1]==="0";)fe=fe.substring(0,fe.length-1);const ae=[];for(;n.length;)if(n.length<=3){ae.unshift(n);break}else{const le=n.length-3;ae.unshift(n.substring(le)),n=n.substring(0,le)}return ie+ae.join(",")+fe}function formatUnits(c,t){if(typeof t=="string"){const n=names$2.indexOf(t);n!==-1&&(t=3*n)}return formatFixed(c,t??18)}function parseUnits(c,t){if(typeof c!="string"&&logger.throwArgumentError("value must be a string","value",c),typeof t=="string"){const n=names$2.indexOf(t);n!==-1&&(t=3*n)}return parseFixed(c,t??18)}function formatEther(c){return formatUnits(c,18)}function parseEther(c){return parseUnits(c,18)}const lib_esm=Object.freeze(Object.defineProperty({__proto__:null,commify,formatEther,formatUnits,parseEther,parseUnits},Symbol.toStringTag,{value:"Module"}));class defaultModal{waiting(t){console.log(`Waiting: ${t}`)}success(t){console.log(`Success: ${t}`)}error(t){console.log(`Error: ${t}`)}close(){console.log("Close")}}const deployerABI=[{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"newFee",type:"uint256"}],name:"DroplinkedFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"newHeartBeat",type:"uint256"}],name:"HeartBeatUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"shop",type:"address"},{indexed:!1,internalType:"address",name:"nftContract",type:"address"}],name:"ShopDeployed",type:"event"},{inputs:[{internalType:"bytes",name:"bytecode",type:"bytes"},{internalType:"bytes32",name:"salt",type:"bytes32"}],name:"deployShop",outputs:[{internalType:"address",name:"shop",type:"address"},{internalType:"address",name:"nftContract",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"droplinkedFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"droplinkedWallet",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDroplinkedFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getHeartBeat",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"heartBeat",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_heartBeat",type:"uint256"},{internalType:"address",name:"_droplinkedWallet",type:"address"},{internalType:"uint256",name:"_droplinkedFee",type:"uint256"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"nftContracts",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"shopOwner",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"nftOwners",outputs:[{internalType:"address",name:"nftContracts",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newFee",type:"uint256"}],name:"setDroplinkedFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newHeartBeat",type:"uint256"}],name:"setHeartBeat",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"shopAddresses",outputs:[{internalType:"contract IDropShop",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"shopCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"shopOwner",type:"address"},{internalType:"uint256",name:"",type:"uint256"}],name:"shopOwners",outputs:[{internalType:"address",name:"shops",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}],shopABI=[{inputs:[{internalType:"string",name:"_shopName",type:"string"},{internalType:"string",name:"_shopAddress",type:"string"},{internalType:"address",name:"_shopOwner",type:"address"},{internalType:"string",name:"_shopLogo",type:"string"},{internalType:"string",name:"_shopDescription",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AccessDenied",type:"error"},{inputs:[],name:"AffiliatePOD",type:"error"},{inputs:[],name:"AlreadyClaimed",type:"error"},{inputs:[{internalType:"address",name:"requester",type:"address"},{internalType:"uint256",name:"productId",type:"uint256"}],name:"AlreadyRequested",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"producer",type:"address"}],name:"NotEnoughTokens",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"ProductDoesntExist",type:"error"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"ProductExists",type:"error"},{inputs:[],name:"ReentrancyGuardReentrantCall",type:"error"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"RequestAlreadyConfirmed",type:"error"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"RequestDoesntExist",type:"error"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"RequestNotConfirmed",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"}],name:"ShopDoesNotOwnToken",type:"error"},{inputs:[],name:"oldPrice",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"requestId",type:"uint256"},{indexed:!0,internalType:"address",name:"approver",type:"address"}],name:"AffiliateRequestApproved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"requestId",type:"uint256"},{indexed:!0,internalType:"address",name:"disapprover",type:"address"}],name:"AffiliateRequestDisapproved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"requestId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"productId",type:"uint256"},{indexed:!1,internalType:"address",name:"requester",type:"address"}],name:"AffiliateRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"count",type:"uint256"}],name:"BatchProductRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"productId",type:"uint256"},{indexed:!0,internalType:"address",name:"claimer",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"ProductClaimed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"productId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"string",name:"uri",type:"string"}],name:"ProductRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"productId",type:"uint256"},{indexed:!0,internalType:"address",name:"owner",type:"address"}],name:"ProductUnregistered",type:"event"},{inputs:[],name:"affiliateRequestCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"affiliateRequests",outputs:[{internalType:"address",name:"publisher",type:"address"},{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"bool",name:"isConfirmed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"approveRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"manager",type:"address"},{internalType:"bytes",name:"signature",type:"bytes"},{components:[{components:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"uint256",name:"nullifier",type:"uint256"}],internalType:"struct PurchasedItem[]",name:"cart",type:"tuple[]"},{internalType:"address",name:"shop",type:"address"}],internalType:"struct PurchaseSignature",name:"purchaseSignature",type:"tuple"}],name:"claimPurchase",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"disapproveRequest",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"droplinkedManagerWallet",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"requestId",type:"uint256"}],name:"getAffiliate",outputs:[{components:[{internalType:"address",name:"publisher",type:"address"},{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"bool",name:"isConfirmed",type:"bool"}],internalType:"struct AffiliateRequest",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getAffiliateRequestCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"messageHash",type:"bytes32"}],name:"getEthSignedMessageHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{components:[{components:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"uint256",name:"nullifier",type:"uint256"}],internalType:"struct PurchasedItem[]",name:"cart",type:"tuple[]"},{internalType:"address",name:"shop",type:"address"}],internalType:"struct PurchaseSignature",name:"data",type:"tuple"}],name:"getMessageHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"getProduct",outputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"}],internalType:"struct Product",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getProductCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"}],internalType:"struct Product",name:"product",type:"tuple"}],name:"getProductId",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"nftAddress",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getProductIdV2",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"affiliateId",type:"uint256"}],name:"getProductViaAffiliateId",outputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"}],internalType:"struct Product",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getShopAddress",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"getShopDescription",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"getShopLogo",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"getShopName",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"getShopOwner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"address",name:"requester",type:"address"}],name:"isRequestSubmited",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"managers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"nftAddress",type:"address"},{internalType:"string",name:"uri",type:"string"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bool",name:"accepted",type:"bool"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"},{internalType:"uint256",name:"royalty",type:"uint256"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"}],internalType:"struct RecordData",name:"mintData",type:"tuple"}],name:"mintAndRegister",outputs:[{internalType:"uint256",name:"productId",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"nftAddress",type:"address"},{internalType:"string",name:"uri",type:"string"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bool",name:"accepted",type:"bool"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"},{internalType:"uint256",name:"royalty",type:"uint256"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"}],internalType:"struct RecordData[]",name:"recordData",type:"tuple[]"}],name:"mintAndRegisterBatch",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"nullifiers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256[]",name:"",type:"uint256[]"},{internalType:"uint256[]",name:"",type:"uint256[]"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC1155BatchReceived",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC1155Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC721Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"productCount",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"products",outputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"ethSignedMessageHash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"recoverSigner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"pure",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"nftAddress",type:"address"},{internalType:"enum NFTType",name:"nftType",type:"uint8"},{internalType:"enum ProductType",name:"productType",type:"uint8"},{internalType:"uint256",name:"affiliatePercentage",type:"uint256"}],internalType:"struct Product",name:"p",type:"tuple"}],name:"registerProduct",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"requestAffiliate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"manager",type:"address"}],name:"revokeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"manager",type:"address"}],name:"setManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"shopInfo",outputs:[{internalType:"string",name:"shopName",type:"string"},{internalType:"string",name:"shopAddress",type:"string"},{internalType:"string",name:"shopLogo",type:"string"},{internalType:"string",name:"shopDescription",type:"string"},{internalType:"address",name:"shopOwner",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"sig",type:"bytes"}],name:"splitSignature",outputs:[{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"},{internalType:"uint8",name:"v",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newManager",type:"address"}],name:"transferManagerShip",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"productId",type:"uint256"}],name:"unregisterProduct",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newManagerWallet",type:"address"}],name:"updateDroplinkedManagerWallet",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"signer",type:"address"},{internalType:"bytes",name:"signature",type:"bytes"},{components:[{components:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"productId",type:"uint256"},{internalType:"uint256",name:"nullifier",type:"uint256"}],internalType:"struct PurchasedItem[]",name:"cart",type:"tuple[]"},{internalType:"address",name:"shop",type:"address"}],internalType:"struct PurchaseSignature",name:"data",type:"tuple"}],name:"verifyPurchase",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"pure",type:"function"}],erc20ABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],paymentProxyABI=[{inputs:[{internalType:"uint256",name:"_heartBeat",type:"uint256"},{internalType:"address",name:"_chainLinkProvider",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[{internalType:"uint256",name:"priceTimestamp",type:"uint256"},{internalType:"uint256",name:"currentTimestamp",type:"uint256"}],name:"oldPrice",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"newHeartBeat",type:"uint256"}],name:"HeartBeatChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"memo",type:"string"}],name:"ProductPurchased",type:"event"},{inputs:[{internalType:"uint256",name:"_heartBeat",type:"uint256"}],name:"changeHeartBeat",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256[]",name:"tbdValues",type:"uint256[]"},{internalType:"address[]",name:"tbdReceivers",type:"address[]"},{internalType:"address",name:"currency",type:"address"},{internalType:"uint80",name:"roundId",type:"uint80"},{internalType:"string",name:"memo",type:"string"}],name:"droplinkedPurchase",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"heartBeat",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];function getShopABI(){return shopABI}function getPaymentProxyABI(){return paymentProxyABI}async function uploadMetadata(c,t,n){return(await(await n.post("uploader/cdn-upload-json",{json:{data:c,key:`record-metadata/${t}.json`}})).json()).url}async function updateUris(c,t,n){return(await(await n.put(`web3/record/transactions/${c}/uris`,{json:{uris:t}})).json()).data}async function updateHash(c,t,n){return(await(await n.put(`web3/record/transactions/${c}/hash`,{json:{transactionHash:t}})).json()).data}async function getCartData(c,t,n,ie){const fe=await(await ie.get(`web3/payment/distribution/${c}/${t}/${n}`)).json();return{paymentData:fe.data,orderID:fe.orderID}}async function getAirdropData(c,t){return await(await t.get(`nfts/airdrop/${c}`)).json()}async function getNonce(c,t){return await(await t.get(`web3/auth/nonce?wallet=${c}`)).json()}async function checkWallet(c,t){if((await c.getAddress()).toLocaleLowerCase()!==t.toLocaleLowerCase())throw new Error("Address does not match signer address")}function getTransactionLink({blockchain:c,transactionHash:t,isTestnet:n=!1}){const ie=t.trim();switch(c.toUpperCase()){case"CASPER":return`https://${n?"testnet.":""}cspr.live/deploy/${ie}`;case"STACKS":return`https://explorer.hiro.so/txid/${ie}?chain=${n?"testnet":"mainnet"}`;case"POLYGON":return`https://${n?"amoy.":""}polygonscan.com/tx/${ie}`;case"XRPLSIDECHAIN":return`https://evm-sidechain.xrpl.org/tx/${ie}`;case"BINANCE":return`https://${n?"testnet.":""}bscscan.com/tx/${ie}`;case"NEAR":return`https://explorer.${n?"testnet":"mainnet"}.aurora.dev/tx/${ie}`;case"BASE":return`https://base${n?"-sepolia":""}.blockscout.com/tx/${ie}`;case"LINEA":return`https://${n?"sepolia.":""}lineascan.build/tx/${ie}`;case"ETH":return`https://${n?"sepolia.":""}etherscan.io/tx/${ie}`;case"SOLANA":return`https://explorer.solana.com/tx/${ie}?cluster=${n?"devnet":"mainnet"}`;case"REDBELLY":return n?`https://redbelly.testnet.routescan.io/tx/${ie}`:`https://redbelly.routescan.io/tx/${ie}`;case"SKALE":return`https://${n?"giant-half-dual-testnet.explorer.testnet.skalenodes.com":"honorable-steel-rasalhague.explorer.mainnet.skalenodes.com"}/tx/${ie}`;case"BITLAYER":return n?`https://testnet.btrscan.com/tx/${ie}`:`https://www.btrscan.com/tx/${ie}`;default:return""}}const sixify=c=>c.toString().padStart(6,"0");async function getConstructorArgs(c,t,n){return[c.shopName||"",c.shopAddress||"",n,c.shopLogo||"",c.shopDescription||"",t]}async function deployEVMShop(c,t,n){console.log({...c,...t,...n});const{modalInterface:ie}=t,{address:fe,chain:ae,network:le,provider:pe}=c,me=pe.getSigner();ie.waiting("got the signer: "+await me.getAddress()),await checkWallet(me,fe);const ye=await getDeployerAddress(ae,le);ie.waiting("Got deployer contract address");const xe=new Contract(ye,deployerABI,me);ie.waiting("Getting shop bytecode");const Ee=await getShopByteCode();ie.waiting("got bytecode");const Se="0x"+fe.split("0x")[1]+"000000000000000000"+sixify(Math.floor(Math.random()*1e6)+1);ie.waiting("created salt"),console.log(Se);const Me=await getConstructorArgs(n,ye,fe);ie.waiting("created constructor args"),console.log(Me);const Be=defaultAbiCoder.encode(["string","string","address","string","string","address"],Me);ie.waiting("Created bytecodeWithArgs"),console.log(Be);try{let $e;const ke=Ee+Be.split("0x")[1];console.log({fullBytecode:ke}),c.gasPredictable?(ie.waiting("CallStatic to estimate gas"),await xe.callStatic.deployShop(ke,Se),ie.waiting("Sending transaction"),$e=await xe.deployShop(ke,Se,{})):(ie.waiting("Sending transaction"),$e=await xe.deployShop(ke,Se)),ie.waiting("Waiting for confirmation...");const Te=await $e.wait();ie.waiting("Transaction confirmed, extracting data...");const Fe=Te.logs.map(ze=>{try{return xe.interface.parseLog(ze)}catch{return null}}).filter(ze=>ze!=null).find(ze=>ze.name==="ShopDeployed"),Le=Fe.args.shop,He=Fe.args.nftContract;return ie.success("Deployment successful!"),{transactionHash:$e.hash,deployedShopAddress:Le,deployedNFTAddress:He}}catch($e){if(ie.error("Error during deployment."),$e.code.toString()==="ACTION_REJECTED")throw ie.error("Transaction Rejected"),new UserDeniedException;try{const ke=xe.interface.parseError($e.data);throw ie.error(`Contract error: ${ke}`),ke}catch(ke){throw ie.error("Unhandled error during deployment."),new Error(ke||"Unknown error occurred.")}}}class ChainError extends Error{constructor(t){super(t),this.name=new.target.name}}class ShopError extends Error{constructor(t){super(t),this.name=new.target.name}}class WalletError extends ChainError{}class Unauthorized extends ChainError{constructor(t,n,ie){super(`Unauthorized access to ${t} from ${n} to ${ie}`),this.method=t,this.from=n,this.to=ie}}class FieldNotFound extends ChainError{constructor(t){super(`Field not found: ${t}`),this.field=t}}class AccountChangedException extends ChainError{constructor(t){super(`Account changed: ${t}`)}}class Web3CallbackFailed extends ShopError{constructor(t){super(`Web3 callback failed: ${t}`)}}class ChainNotImplementedException extends ChainError{constructor(t){super(`Chain not implemented: ${t}`)}}class MetadataUploadFailedException extends ChainError{constructor(t){super(`Metadata upload failed: ${t}`)}}class WalletNotFoundException extends WalletError{constructor(){super("EVM Wallet not found")}}class MetaMaskNotFoundException extends WalletError{constructor(){super("MetaMask is not installed")}}class AccountAccessDeniedException extends WalletError{constructor(){super("Account access request denied by the user")}}class NoAccountsFoundException extends WalletError{constructor(){super("No accounts were found in the wallet")}}class SignatureRequestDeniedException extends WalletError{constructor(){super("Signature request was denied by the user")}}class ChainSwitchException extends WalletError{constructor(){super("Failed to switch chains")}}class UserDeniedException extends WalletError{constructor(){super("User denied the request")}}class InsufficientBalanceException extends WalletError{constructor(){super("Insufficient balance to cover the transaction cost")}}class InsufficientTokenBalanceException extends WalletError{constructor(){super("Insufficient token balance")}}class InvalidParametersException extends ChainError{constructor(t){super(`Invalid parameters: ${t}`)}}const chainNames={[Chain.BINANCE]:{[Network.TESTNET]:{chainName:"Smart Chain - Testnet",chainId:"0x61",nativeCurrency:{name:"TBNB",decimals:18,symbol:"tBNB"},rpcUrls:["https://bsc-testnet-dataseed.bnbchain.org/"]},[Network.MAINNET]:{chainName:"Smart Chain",chainId:"0x38",nativeCurrency:{name:"BNB",decimals:18,symbol:"BNB"},rpcUrls:["https://bsc-dataseed.binance.org/"]}},[Chain.POLYGON]:{[Network.TESTNET]:{chainName:"Polygon Amoy Testnet",chainId:"0x13882",nativeCurrency:{name:"MATIC",decimals:18,symbol:"MATIC"},rpcUrls:["https://rpc-amoy.polygon.technology"]},[Network.MAINNET]:{chainName:"Polygon Mainnet",chainId:"0x89",nativeCurrency:{name:"MATIC",decimals:18,symbol:"MATIC"},rpcUrls:["https://polygon-rpc.com/"]}},[Chain.XRPLSIDECHAIN]:{[Network.TESTNET]:{chainName:"XRPL EVM Sidechain",chainId:"0x15f902",nativeCurrency:{name:"XRP",decimals:18,symbol:"XRP"},rpcUrls:["https://rpc-evm-sidechain.xrpl.org"]},[Network.MAINNET]:{chainName:"XRPL EVM Sidechain",chainId:"0x15f902",nativeCurrency:{name:"XRP",decimals:18,symbol:"XRP"},rpcUrls:["https://rpc-evm-sidechain.xrpl.org"]}},[Chain.CASPER]:{[Network.TESTNET]:{chainName:"Smart Chain - Testnet",chainId:"0x38",nativeCurrency:{name:"BNB",decimals:18,symbol:"BNB"},rpcUrls:["https://data-seed-prebsc-1-s1.binance.org:8545/"]},[Network.MAINNET]:{chainName:"Smart Chain",chainId:"0x61",nativeCurrency:{name:"BNB",decimals:18,symbol:"BNB"},rpcUrls:["https://data-seed-prebsc-1-s1.binance.org:8545/"]}},[Chain.STACKS]:{[Network.TESTNET]:{chainName:"Smart Chain - Testnet",chainId:"0x38",nativeCurrency:{name:"BNB",decimals:18,symbol:"BNB"},rpcUrls:["https://data-seed-prebsc-1-s1.binance.org:8545/"]},[Network.MAINNET]:{chainName:"Smart Chain",chainId:"0x61",nativeCurrency:{name:"BNB",decimals:18,symbol:"BNB"},rpcUrls:["https://data-seed-prebsc-1-s1.binance.org:8545/"]}},[Chain.NEAR]:{[Network.TESTNET]:{chainName:"Aurora Testnet",chainId:"0x4e454153",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://testnet.aurora.dev"]},[Network.MAINNET]:{chainName:"Aurora Mainnet",chainId:"0x4e454152",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://mainnet.aurora.dev"]}},[Chain.SKALE]:{[Network.TESTNET]:{chainName:"SKALE Testnet Calypso Hub",chainId:"0x3A14269B",nativeCurrency:{name:"sFUEL",decimals:18,symbol:"sFUEL"},rpcUrls:["https://testnet.skalenodes.com/v1/giant-half-dual-testnet"]},[Network.MAINNET]:{chainName:"SKALE Calypso Hub",chainId:"0x5D456C62",nativeCurrency:{name:"sFUEL",decimals:18,symbol:"sFUEL"},rpcUrls:["https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague"]}},[Chain.BASE]:{[Network.TESTNET]:{chainName:"Base Sepolia",chainId:"0x14a34",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://sepolia.base.org"]},[Network.MAINNET]:{chainName:"Base Mainnet",chainId:"0x2105",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://mainnet.base.org/"]}},[Chain.LINEA]:{[Network.MAINNET]:{chainName:"Linea",chainId:"0xe708",nativeCurrency:{name:"ETH",decimals:18,symbol:"LineaETH"},rpcUrls:["https://rpc.linea.build"]},[Network.TESTNET]:{chainName:"Linea",chainId:"0xe705",nativeCurrency:{name:"ETH",decimals:18,symbol:"LineaETH"},rpcUrls:["https://rpc.sepolia.linea.build"]}},[Chain.ETH]:{[Network.MAINNET]:{chainName:"Ethereum",chainId:"0x1",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://mainnet.infura.io/v3/"]},[Network.TESTNET]:{chainName:"Sepolia",chainId:"0xaa36a7",nativeCurrency:{name:"ETH",decimals:18,symbol:"ETH"},rpcUrls:["https://eth-sepolia.public.blastapi.io/"]}},[Chain.REDBELLY]:{[Network.TESTNET]:{chainName:"Redbelly Network Testnet",chainId:"0x99",nativeCurrency:{name:"RBNT",decimals:18,symbol:"RBNT"},rpcUrls:["https://governors.testnet.redbelly.network"]},[Network.MAINNET]:{chainName:"Redbelly Network Mainnet",chainId:"0x97",nativeCurrency:{name:"RBNT",decimals:18,symbol:"RBNT"},rpcUrls:["https://governors.mainnet.redbelly.network"]}},[Chain.BITLAYER]:{[Network.MAINNET]:{chainName:"Bitlayer Mainnet",chainId:"0x310C5",nativeCurrency:{name:"BTC",decimals:18,symbol:"BTC"},rpcUrls:["https://rpc.bitlayer.org"]},[Network.TESTNET]:{chainName:"Bitlayer Testnet",chainId:"0x3106A",nativeCurrency:{name:"BTC",decimals:18,symbol:"BTC"},rpcUrls:["https://testnet-rpc.bitlayer.org"]}}},isMetamaskInstalled=()=>{const{ethereum:c}=window;return!!(c&&c.isMetaMask)},isCoinBaseInstalled=()=>{var t;const{ethereum:c}=window;return!!(c&&((t=c.providers)!=null&&t.some(n=>n.isCoinbaseWallet)))};async function getAccounts(c){try{const t=await c.request({method:"eth_accounts"});return!t||t.length===0?[]:t}catch(t){throw new WalletError(`Failed to retrieve accounts: ${t}`)}}function isWalletInstalled(c){var t,n;if(["POLYGON","XRPLSIDECHAIN","NEAR","BINANCE","BASE","LINEA","ETH","REDBELLY","SKALE","BITLAYER"].includes(c.toUpperCase()))return{installed:isMetamaskInstalled(),walletName:"MetaMask wallet"};if(c==="SOLANA")return{installed:(n=(t=window.phantom)==null?void 0:t.solana)==null?void 0:n.isPhantom,walletName:"Phantom wallet"};throw c==="CASPER"?new WalletNotFoundException:new WalletNotFoundException}async function isWalletConnected(c){const t=await getAccounts(c);return t&&t.length>0}async function isChainCorrect(c,t,n){try{const ie=await c.request({method:"eth_chainId"});return String(ie).toLowerCase()===chainNames[t][n].chainId.toLowerCase()}catch(ie){throw console.error(`Failed to verify the correct chain: ${ie.message}`),new ChainSwitchException}}async function changeChain(c,t,n){try{await c.request({method:"wallet_switchEthereumChain",params:[{chainId:chainNames[t][n].chainId}]})}catch(ie){throw console.error(`Failed to switch chain: ${ie.message}`),new ChainSwitchException}}async function requestAccounts(c){try{return await c.request({method:"eth_requestAccounts"})}catch(t){throw console.error(t),new UserDeniedException}}async function getBalance(c,t){return Number(await c.provider.request({method:"eth_getBalance",params:[t,"latest"]}))}async function addChain(c,t,n,ie){try{const fe=c.provider;if(ie.waiting("Adding chain..."),!isWalletInstalled(t))throw new WalletNotFoundException;await isWalletConnected(fe)||(ie.waiting("Requesting account access..."),await requestAccounts(fe));const ae=chainNames[t][n];await fe.request({method:"wallet_addEthereumChain",params:[{chainName:ae.chainName,chainId:ae.chainId,nativeCurrency:ae.nativeCurrency,rpcUrls:ae.rpcUrls}]})}catch(fe){console.warn("Chain already added or error occurred while adding chain:",fe)}}async function evmLogin(c,t,n,ie,fe){const ae=c.provider;try{if(ie.waiting("Connecting to wallet..."),!isWalletInstalled(t))throw new WalletNotFoundException;await isWalletConnected(ae)||(ie.waiting("Requesting account access..."),await requestAccounts(ae));const le=(await getAccounts(ae))[0],pe=chainNames[t][n];try{ie.waiting("Adding chain..."),await ae.request({method:"wallet_addEthereumChain",params:[{chainName:pe.chainName,chainId:pe.chainId,nativeCurrency:pe.nativeCurrency,rpcUrls:pe.rpcUrls}]})}catch(Be){console.warn("Chain already added or error occurred while adding chain:",Be)}const me=await(await fe.post("web3/sFuelDistribution",{json:{wallet:le,isTestnet:n===Network.TESTNET}})).json();console.log(me),ie.waiting("Signing message...");const ye=await getNonce(le,fe),xe=new Date().toLocaleString(),Ee=`Welcome to Droplinked! Please sign this message to verify your ownership over your wallet and log in. - Nonce: ${ye} - Date: ${xe}`,Me=await c.getSigner().signMessage(Ee);return{address:le,signature:Me,nonce:ye,date:xe}}catch(le){throw ie.error(le instanceof UserDeniedException?"User denied the request":"An error occurred while connecting to the wallet"),le}}function getRecordData(c,t,n){const{acceptsManageWallet:ie,amount:fe,royalty:ae,type:le}=c;return{nftAddress:n,uri:t,amount:fe,accepted:ie,affiliatePercentage:ae,royalty:ae,nftType:NFTType.ERC1155,productType:le}}async function prepareRecordData(c,t,n,ie){const{nftContract:fe,modalInterface:ae}=ie;if(!fe)throw new FieldNotFound("nftContract");const{description:le}=n,{skuID:pe}=t,me={...t,...n};ae.waiting("Uploading metadata...");const ye={...me.skuProperties},xe={name:me.productTitle,description:le,image:me.imageUrl,properties:ye},Ee=await uploadMetadata(xe,pe,ie.axiosInstance);ae.waiting(`Metadata uploaded: ${Ee}`),ae.waiting("Getting recordData");const Se=getRecordData(me,Ee,fe);return ae.waiting("Got recordData"),Se}async function recordProduct(c,t,n,ie){const{modalInterface:fe,nftContract:ae,shopContractAddress:le}=t;if(!ae||!le)throw new FieldNotFound("nftContract||shopContractAddress");console.log({nftContract:ae,shopContractAddress:le});const pe=c.provider.getSigner();fe.waiting("Connecting to wallet..."),await checkWallet(pe,c.address),fe.waiting("Getting shop contract...");const me=new Contract(le,getShopABI(),pe);try{const ye=await Promise.all(ie.map(Ee=>prepareRecordData(c,Ee,n,t)));console.log({products:ye});let xe;if(c.gasPredictable){fe.waiting("CallStatic..."),await me.callStatic.mintAndRegisterBatch(ye),fe.waiting("Estimating gas...");const Ee=(await me.estimateGas.mintAndRegisterBatch(ye)).toBigInt();fe.waiting("Got gas estimation: "+Ee),fe.waiting("Getting the gasPrice of the network...");const Se=(await getGasPrice(c.provider)).valueOf();fe.waiting("Got gas price: "+Se),fe.waiting("Sending transaction..."),xe=await me.mintAndRegisterBatch(ye)}else fe.waiting("Sending transaction..."),xe=await me.mintAndRegisterBatch(ye);return await xe.wait(),fe.success("Transaction successful"),{transactionHash:xe.hash,metadataUrls:ye.map(Ee=>Ee.uri)}}catch(ye){if(ye.code&&ye.code.toString()==="ACTION_REJECTED")throw t.modalInterface.error("Transaction Rejected"),new Error("Transaction Rejected");try{if(ye.data&&ye.data!=="0x"){const xe=me.interface.parseError(ye.data);throw xe.name==="OwnableUnauthorizedAccount"?(t.modalInterface.error("You are not the owner of the shop"),new Unauthorized("record",c.address,le)):(t.modalInterface.error(xe.name),t.modalInterface.error(ye),ye)}else throw fe.error("Transaction reverted without reason"),ye}catch(xe){throw fe.error(`Unexpected error: ${xe}`),xe}}}var utils$e={};const require$$0$3=getAugmentedNamespace(lib_esm$b),require$$1$2=getAugmentedNamespace(lib_esm$f),require$$2$3=getAugmentedNamespace(lib_esm$d),require$$3=getAugmentedNamespace(lib_esm$8),require$$4$3=getAugmentedNamespace(lib_esm$j),require$$5=getAugmentedNamespace(lib_esm$c),require$$6$2=getAugmentedNamespace(lib_esm$6),require$$7=getAugmentedNamespace(lib_esm$4),require$$8=getAugmentedNamespace(lib_esm$h),require$$9=getAugmentedNamespace(lib_esm$k),require$$10=getAugmentedNamespace(lib_esm$7),require$$11$1=getAugmentedNamespace(lib_esm$1),require$$12=getAugmentedNamespace(lib_esm$5),require$$13=getAugmentedNamespace(lib_esm$i),require$$14=getAugmentedNamespace(lib_esm$g),require$$15=getAugmentedNamespace(lib_esm$a),require$$16=getAugmentedNamespace(lib_esm$e),require$$17$1=getAugmentedNamespace(lib_esm$9),require$$18=getAugmentedNamespace(lib_esm),require$$19=getAugmentedNamespace(lib_esm$3),require$$20=getAugmentedNamespace(lib_esm$2);(function(c){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(_e,se,ce,de){de===void 0&&(de=ce),Object.defineProperty(_e,de,{enumerable:!0,get:function(){return se[ce]}})}:function(_e,se,ce,de){de===void 0&&(de=ce),_e[de]=se[ce]}),n=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(_e,se){Object.defineProperty(_e,"default",{enumerable:!0,value:se})}:function(_e,se){_e.default=se}),ie=commonjsGlobal&&commonjsGlobal.__importStar||function(_e){if(_e&&_e.__esModule)return _e;var se={};if(_e!=null)for(var ce in _e)ce!=="default"&&Object.prototype.hasOwnProperty.call(_e,ce)&&t(se,_e,ce);return n(se,_e),se};Object.defineProperty(c,"__esModule",{value:!0}),c.formatBytes32String=c.Utf8ErrorFuncs=c.toUtf8String=c.toUtf8CodePoints=c.toUtf8Bytes=c._toEscapedUtf8String=c.nameprep=c.hexDataSlice=c.hexDataLength=c.hexZeroPad=c.hexValue=c.hexStripZeros=c.hexConcat=c.isHexString=c.hexlify=c.base64=c.base58=c.TransactionDescription=c.LogDescription=c.Interface=c.SigningKey=c.HDNode=c.defaultPath=c.isBytesLike=c.isBytes=c.zeroPad=c.stripZeros=c.concat=c.arrayify=c.shallowCopy=c.resolveProperties=c.getStatic=c.defineReadOnly=c.deepCopy=c.checkProperties=c.poll=c.fetchJson=c._fetchData=c.RLP=c.Logger=c.checkResultErrors=c.FormatTypes=c.ParamType=c.FunctionFragment=c.EventFragment=c.ErrorFragment=c.ConstructorFragment=c.Fragment=c.defaultAbiCoder=c.AbiCoder=void 0,c.Indexed=c.Utf8ErrorReason=c.UnicodeNormalizationForm=c.SupportedAlgorithm=c.mnemonicToSeed=c.isValidMnemonic=c.entropyToMnemonic=c.mnemonicToEntropy=c.getAccountPath=c.verifyTypedData=c.verifyMessage=c.recoverPublicKey=c.computePublicKey=c.recoverAddress=c.computeAddress=c.getJsonWalletAddress=c.TransactionTypes=c.serializeTransaction=c.parseTransaction=c.accessListify=c.joinSignature=c.splitSignature=c.soliditySha256=c.solidityKeccak256=c.solidityPack=c.shuffled=c.randomBytes=c.sha512=c.sha256=c.ripemd160=c.keccak256=c.computeHmac=c.commify=c.parseUnits=c.formatUnits=c.parseEther=c.formatEther=c.isAddress=c.getCreate2Address=c.getContractAddress=c.getIcapAddress=c.getAddress=c._TypedDataEncoder=c.id=c.isValidName=c.namehash=c.hashMessage=c.dnsEncode=c.parseBytes32String=void 0;var fe=require$$0$3;Object.defineProperty(c,"AbiCoder",{enumerable:!0,get:function(){return fe.AbiCoder}}),Object.defineProperty(c,"checkResultErrors",{enumerable:!0,get:function(){return fe.checkResultErrors}}),Object.defineProperty(c,"ConstructorFragment",{enumerable:!0,get:function(){return fe.ConstructorFragment}}),Object.defineProperty(c,"defaultAbiCoder",{enumerable:!0,get:function(){return fe.defaultAbiCoder}}),Object.defineProperty(c,"ErrorFragment",{enumerable:!0,get:function(){return fe.ErrorFragment}}),Object.defineProperty(c,"EventFragment",{enumerable:!0,get:function(){return fe.EventFragment}}),Object.defineProperty(c,"FormatTypes",{enumerable:!0,get:function(){return fe.FormatTypes}}),Object.defineProperty(c,"Fragment",{enumerable:!0,get:function(){return fe.Fragment}}),Object.defineProperty(c,"FunctionFragment",{enumerable:!0,get:function(){return fe.FunctionFragment}}),Object.defineProperty(c,"Indexed",{enumerable:!0,get:function(){return fe.Indexed}}),Object.defineProperty(c,"Interface",{enumerable:!0,get:function(){return fe.Interface}}),Object.defineProperty(c,"LogDescription",{enumerable:!0,get:function(){return fe.LogDescription}}),Object.defineProperty(c,"ParamType",{enumerable:!0,get:function(){return fe.ParamType}}),Object.defineProperty(c,"TransactionDescription",{enumerable:!0,get:function(){return fe.TransactionDescription}});var ae=require$$1$2;Object.defineProperty(c,"getAddress",{enumerable:!0,get:function(){return ae.getAddress}}),Object.defineProperty(c,"getCreate2Address",{enumerable:!0,get:function(){return ae.getCreate2Address}}),Object.defineProperty(c,"getContractAddress",{enumerable:!0,get:function(){return ae.getContractAddress}}),Object.defineProperty(c,"getIcapAddress",{enumerable:!0,get:function(){return ae.getIcapAddress}}),Object.defineProperty(c,"isAddress",{enumerable:!0,get:function(){return ae.isAddress}});var le=ie(require$$2$3);c.base64=le;var pe=require$$3;Object.defineProperty(c,"base58",{enumerable:!0,get:function(){return pe.Base58}});var me=require$$4$3;Object.defineProperty(c,"arrayify",{enumerable:!0,get:function(){return me.arrayify}}),Object.defineProperty(c,"concat",{enumerable:!0,get:function(){return me.concat}}),Object.defineProperty(c,"hexConcat",{enumerable:!0,get:function(){return me.hexConcat}}),Object.defineProperty(c,"hexDataSlice",{enumerable:!0,get:function(){return me.hexDataSlice}}),Object.defineProperty(c,"hexDataLength",{enumerable:!0,get:function(){return me.hexDataLength}}),Object.defineProperty(c,"hexlify",{enumerable:!0,get:function(){return me.hexlify}}),Object.defineProperty(c,"hexStripZeros",{enumerable:!0,get:function(){return me.hexStripZeros}}),Object.defineProperty(c,"hexValue",{enumerable:!0,get:function(){return me.hexValue}}),Object.defineProperty(c,"hexZeroPad",{enumerable:!0,get:function(){return me.hexZeroPad}}),Object.defineProperty(c,"isBytes",{enumerable:!0,get:function(){return me.isBytes}}),Object.defineProperty(c,"isBytesLike",{enumerable:!0,get:function(){return me.isBytesLike}}),Object.defineProperty(c,"isHexString",{enumerable:!0,get:function(){return me.isHexString}}),Object.defineProperty(c,"joinSignature",{enumerable:!0,get:function(){return me.joinSignature}}),Object.defineProperty(c,"zeroPad",{enumerable:!0,get:function(){return me.zeroPad}}),Object.defineProperty(c,"splitSignature",{enumerable:!0,get:function(){return me.splitSignature}}),Object.defineProperty(c,"stripZeros",{enumerable:!0,get:function(){return me.stripZeros}});var ye=require$$5;Object.defineProperty(c,"_TypedDataEncoder",{enumerable:!0,get:function(){return ye._TypedDataEncoder}}),Object.defineProperty(c,"dnsEncode",{enumerable:!0,get:function(){return ye.dnsEncode}}),Object.defineProperty(c,"hashMessage",{enumerable:!0,get:function(){return ye.hashMessage}}),Object.defineProperty(c,"id",{enumerable:!0,get:function(){return ye.id}}),Object.defineProperty(c,"isValidName",{enumerable:!0,get:function(){return ye.isValidName}}),Object.defineProperty(c,"namehash",{enumerable:!0,get:function(){return ye.namehash}});var xe=require$$6$2;Object.defineProperty(c,"defaultPath",{enumerable:!0,get:function(){return xe.defaultPath}}),Object.defineProperty(c,"entropyToMnemonic",{enumerable:!0,get:function(){return xe.entropyToMnemonic}}),Object.defineProperty(c,"getAccountPath",{enumerable:!0,get:function(){return xe.getAccountPath}}),Object.defineProperty(c,"HDNode",{enumerable:!0,get:function(){return xe.HDNode}}),Object.defineProperty(c,"isValidMnemonic",{enumerable:!0,get:function(){return xe.isValidMnemonic}}),Object.defineProperty(c,"mnemonicToEntropy",{enumerable:!0,get:function(){return xe.mnemonicToEntropy}}),Object.defineProperty(c,"mnemonicToSeed",{enumerable:!0,get:function(){return xe.mnemonicToSeed}});var Ee=require$$7;Object.defineProperty(c,"getJsonWalletAddress",{enumerable:!0,get:function(){return Ee.getJsonWalletAddress}});var Se=require$$8;Object.defineProperty(c,"keccak256",{enumerable:!0,get:function(){return Se.keccak256}});var Me=require$$9;Object.defineProperty(c,"Logger",{enumerable:!0,get:function(){return Me.Logger}});var Be=require$$10;Object.defineProperty(c,"computeHmac",{enumerable:!0,get:function(){return Be.computeHmac}}),Object.defineProperty(c,"ripemd160",{enumerable:!0,get:function(){return Be.ripemd160}}),Object.defineProperty(c,"sha256",{enumerable:!0,get:function(){return Be.sha256}}),Object.defineProperty(c,"sha512",{enumerable:!0,get:function(){return Be.sha512}});var $e=require$$11$1;Object.defineProperty(c,"solidityKeccak256",{enumerable:!0,get:function(){return $e.keccak256}}),Object.defineProperty(c,"solidityPack",{enumerable:!0,get:function(){return $e.pack}}),Object.defineProperty(c,"soliditySha256",{enumerable:!0,get:function(){return $e.sha256}});var ke=require$$12;Object.defineProperty(c,"randomBytes",{enumerable:!0,get:function(){return ke.randomBytes}}),Object.defineProperty(c,"shuffled",{enumerable:!0,get:function(){return ke.shuffled}});var Te=require$$13;Object.defineProperty(c,"checkProperties",{enumerable:!0,get:function(){return Te.checkProperties}}),Object.defineProperty(c,"deepCopy",{enumerable:!0,get:function(){return Te.deepCopy}}),Object.defineProperty(c,"defineReadOnly",{enumerable:!0,get:function(){return Te.defineReadOnly}}),Object.defineProperty(c,"getStatic",{enumerable:!0,get:function(){return Te.getStatic}}),Object.defineProperty(c,"resolveProperties",{enumerable:!0,get:function(){return Te.resolveProperties}}),Object.defineProperty(c,"shallowCopy",{enumerable:!0,get:function(){return Te.shallowCopy}});var Ie=ie(require$$14);c.RLP=Ie;var Fe=require$$15;Object.defineProperty(c,"computePublicKey",{enumerable:!0,get:function(){return Fe.computePublicKey}}),Object.defineProperty(c,"recoverPublicKey",{enumerable:!0,get:function(){return Fe.recoverPublicKey}}),Object.defineProperty(c,"SigningKey",{enumerable:!0,get:function(){return Fe.SigningKey}});var Le=require$$16;Object.defineProperty(c,"formatBytes32String",{enumerable:!0,get:function(){return Le.formatBytes32String}}),Object.defineProperty(c,"nameprep",{enumerable:!0,get:function(){return Le.nameprep}}),Object.defineProperty(c,"parseBytes32String",{enumerable:!0,get:function(){return Le.parseBytes32String}}),Object.defineProperty(c,"_toEscapedUtf8String",{enumerable:!0,get:function(){return Le._toEscapedUtf8String}}),Object.defineProperty(c,"toUtf8Bytes",{enumerable:!0,get:function(){return Le.toUtf8Bytes}}),Object.defineProperty(c,"toUtf8CodePoints",{enumerable:!0,get:function(){return Le.toUtf8CodePoints}}),Object.defineProperty(c,"toUtf8String",{enumerable:!0,get:function(){return Le.toUtf8String}}),Object.defineProperty(c,"Utf8ErrorFuncs",{enumerable:!0,get:function(){return Le.Utf8ErrorFuncs}});var He=require$$17$1;Object.defineProperty(c,"accessListify",{enumerable:!0,get:function(){return He.accessListify}}),Object.defineProperty(c,"computeAddress",{enumerable:!0,get:function(){return He.computeAddress}}),Object.defineProperty(c,"parseTransaction",{enumerable:!0,get:function(){return He.parse}}),Object.defineProperty(c,"recoverAddress",{enumerable:!0,get:function(){return He.recoverAddress}}),Object.defineProperty(c,"serializeTransaction",{enumerable:!0,get:function(){return He.serialize}}),Object.defineProperty(c,"TransactionTypes",{enumerable:!0,get:function(){return He.TransactionTypes}});var ze=require$$18;Object.defineProperty(c,"commify",{enumerable:!0,get:function(){return ze.commify}}),Object.defineProperty(c,"formatEther",{enumerable:!0,get:function(){return ze.formatEther}}),Object.defineProperty(c,"parseEther",{enumerable:!0,get:function(){return ze.parseEther}}),Object.defineProperty(c,"formatUnits",{enumerable:!0,get:function(){return ze.formatUnits}}),Object.defineProperty(c,"parseUnits",{enumerable:!0,get:function(){return ze.parseUnits}});var Je=require$$19;Object.defineProperty(c,"verifyMessage",{enumerable:!0,get:function(){return Je.verifyMessage}}),Object.defineProperty(c,"verifyTypedData",{enumerable:!0,get:function(){return Je.verifyTypedData}});var Xe=require$$20;Object.defineProperty(c,"_fetchData",{enumerable:!0,get:function(){return Xe._fetchData}}),Object.defineProperty(c,"fetchJson",{enumerable:!0,get:function(){return Xe.fetchJson}}),Object.defineProperty(c,"poll",{enumerable:!0,get:function(){return Xe.poll}});var Ue=require$$10;Object.defineProperty(c,"SupportedAlgorithm",{enumerable:!0,get:function(){return Ue.SupportedAlgorithm}});var $t=require$$16;Object.defineProperty(c,"UnicodeNormalizationForm",{enumerable:!0,get:function(){return $t.UnicodeNormalizationForm}}),Object.defineProperty(c,"Utf8ErrorReason",{enumerable:!0,get:function(){return $t.Utf8ErrorReason}})})(utils$e);const SkaleUsdcAddressForTestnet="0x2aebcdc4f9f9149a50422fff86198cb0939ea165",SkaleUsdcAddressForMainnet="0x7Cf76E740Cb23b99337b21F392F22c47Ad910c67";async function handleCustomTokenApproval(c,t,n,ie,fe){if(fe.waiting("Initiating token approval..."),!c.tokenAddress)throw new InvalidParametersException("Token address is not set");try{const ae=new Contract(c.tokenAddress,erc20ABI,n);console.log({signerAddress:ie,customTokenContract:ae});const le=await ae.balanceOf(ie);fe.waiting("Calculating total sum...");const pe=c.tbdValues.reduce((ye,xe)=>ye.add(BigNumber.from(xe)),BigNumber.from(0));if(fe.waiting("Checking token balance..."),le.lt(pe))throw new InsufficientTokenBalanceException;fe.waiting("Approving tokens...");const me=await ae.approve(t,MaxUint256$1);fe.waiting("Waiting for approval confirmation..."),await me.wait(),fe.waiting("Token approval confirmed")}catch(ae){handleError(ae)}}const droplinked_payment=async function(c,t,n){const{modalInterface:ie}=t,{provider:fe,chain:ae,network:le,address:pe}=c;if(!n.tbdReceivers.every(utils$e.isAddress))throw new InvalidParametersException("Invalid receiver address found");if(!n.tbdValues.every(Se=>BigNumber.from(Se).gt(0)))throw new InvalidParametersException("tbdValues must be positive numbers");n.chainLinkRoundId=n.chainLinkRoundId||"0";const me=fe.getSigner();if(ie.waiting("Got signer..."),!n.tbdValues)throw new InvalidParametersException(`Invalid tbdValues: ${n.tbdValues}`);if(!n.tbdReceivers)throw new InvalidParametersException(`Invalid tbdReceivers: ${n.tbdReceivers}`);if(!n.memo)throw new InvalidParametersException(`Memo is required for payment, current memo: ${n.memo}`);if(n.tbdReceivers.length!==n.tbdValues.length)throw new InvalidParametersException("tbdReceivers and tbdValues must be the same length");const ye=(await me.getAddress()).toLowerCase();if(ye!==pe.toLowerCase())throw new Unauthorized("droplinked_payment",ye,pe);ie.waiting("Initial checks done...");let xe;try{xe=await getProxyAddress(ae,le)}catch(Se){throw new Error("Failed to get contract address: "+Se.message)}let Ee;try{Ee=new Contract(xe,getPaymentProxyABI(),me)}catch(Se){throw new Error("Failed to create contract instance: "+Se.message)}ie.waiting("Got contract...");try{if(ie.waiting(`
10
10
  Purchase Details:
11
11
  data.tbdValues: ${n.tbdValues}
12
12
  data.tbdReceivers: ${n.tbdReceivers}
@@ -14,7 +14,7 @@
14
14
  data.chainLinkRoundId: ${n.chainLinkRoundId}
15
15
  data.memo: ${n.memo}
16
16
  data.totalPrice: ${Number(n.totalPrice)}
17
- `),ae===Chain.SKALE)return await skalePayment(n,le,me,Ee,pe,xe,ie);const Se=n.tokenAddress&&n.tokenAddress!==ZERO_ADDRESS;ie.waiting(`The payment is custom? ${Se}`),Se?await handleCustomTokenApproval(n,xe,me,ye,ie):n.tbdValues=n.tbdValues.map(Le=>parseInt(Le.toString(),10)),ie.waiting("Performing static call...");try{await Ee.callStatic.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{value:Se?BigNumber.from(0):n.totalPrice})}catch(Le){throw new Error("Transaction will fail: "+Le.message)}ie.waiting("Static Call done");let Me;try{Me=await getGasPrice$1(fe)}catch(Le){throw new Error("Failed to get gas price: "+Le.message)}ie.waiting(`Got gas price: ${Me}`),ie.waiting("Calling estimate gas...");let Be;try{Be=await Ee.estimateGas.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{value:Se?BigNumber.from(0):n.totalPrice})}catch(Le){throw new Error(`Gas estimation failed: ${Le.message}. Please check the transaction parameters.`)}ie.waiting(`gas estimation done: ${Be.toString()}`);const $e=Be.mul(105).div(100),ke=Se?BigNumber.from(0):BigNumber.from(n.totalPrice);ie.waiting(`Gas limit: ${$e.toString()}, gas price: ${Me.toString()}, base: ${ke.toString()}`);let Te;try{Te=await fe.getBalance(pe)}catch(Le){throw new Error("Failed to get user balance: "+Le.message)}ie.waiting(`User balance: ${Te}`);const Ie=ke.add($e.mul(Me));if(Te.lt(Ie))throw new InsufficientBalanceException;ie.waiting("Calling purchase...");const Fe=await Ee.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{gasLimit:$e,value:Se?BigNumber.from(0):n.totalPrice});return ie.waiting("Waiting for transaction..."),await Fe.wait(),ie.waiting("Transaction done"),{transactionHash:Fe.hash,cryptoAmount:n.totalPrice}}catch(Se){handleError(Se)}},skalePayment=async function(c,t,n,ie,fe,ae,le){try{const pe=t===Network.TESTNET?SkaleUsdcAddressForTestnet:SkaleUsdcAddressForMainnet;return c.tokenAddress=pe,await handleCustomTokenApproval(c,ae,n,fe,le),{transactionHash:(await ie.droplinkedPurchase(c.tbdValues,c.tbdReceivers,pe,"0",c.memo)).hash,cryptoAmount:c.totalPrice}}catch(pe){handleError(pe)}};function handleError(c){var t;throw c instanceof Error?((t=c.code)==null?void 0:t.toString())==="ACTION_REJECTED"||c.message.includes("User denied")||c.message.includes("User cancelled transaction")?new UserDeniedException:c:new Error("An unknown error occurred")}async function claimNFT(c,t,n){console.log({data:c,chainConfig:t,context:n});const{modalInterface:ie}=n,fe=t.provider.getSigner(),ae=getShopABI();ie.waiting("Claiming NFTs...");const le=new Contract(n.shopContractAddress,ae,fe);try{ie.waiting("Claiming NFTs..."),console.log(DROPLINKED_MANAGER,c.signature.signature,{cart:c.signature.purchaseData.map(ye=>({amount:ye.amount,productId:ye.productId,nullifier:ye.nullifier})),shop:n.shopContractAddress});const pe=c.signature.purchaseData.map(ye=>({amount:ye.amount,productId:BigNumber.from(ye.productId),nullifier:BigNumber.from(ye.nullifier)})),me=await le.claimPurchase(DROPLINKED_MANAGER,c.signature.signature,{cart:pe,shop:n.shopContractAddress});return ie.waiting("Waiting for transaction..."),await me.wait(),ie.success("Claimed NFTs!"),{transactionHash:me.hash}}catch(pe){if(console.error(pe),pe.code&&pe.code.toString()==="ACTION_REJECTED")throw n.modalInterface.error("Transaction Rejected"),new Error("Transaction Rejected");try{const me=le.interface.parseError(pe.data);throw me.name==="OwnableUnauthorizedAccount"&&n.modalInterface.error(me.name),n.modalInterface.error(pe),pe}catch(me){throw ie.error(`Unexpected error: ${me}`),me}}}var TokenStandard=(c=>(c.ERC721="ERC721",c.ERC1155="ERC1155",c.ERC20="ERC20",c))(TokenStandard||{});const airdropABI=[{inputs:[],name:"ArrayLengthMismatch",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"airdropId",type:"string"}],name:"AirdropDone",type:"event"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address[]",name:"recipients",type:"address[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"string",name:"memo",type:"string"}],name:"distributeERC1155",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address[]",name:"recipients",type:"address[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"string",name:"memo",type:"string"}],name:"distributeERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address[]",name:"recipients",type:"address[]"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"string",name:"memo",type:"string"}],name:"distributeERC721",outputs:[],stateMutability:"nonpayable",type:"function"}];async function sendTransaction(c,t,n,ie,fe){try{return await c.callStatic[t](...n),await c[t](...n)}catch(ae){throw fe.error(`Error simulating ${t} transaction ${ie+1}: ${ae.message}`),ae}}async function approveTokenForAirdrop(c,t,n,ie,fe){if(n!==TokenStandard.ERC1155)throw new Error("Only ERC1155 tokens are supported right now");const ae=["function setApprovalForAll(address, bool) public"],le=new Contract(t,ae,ie);fe.waiting("Approving token for airdrop..."),await(await le.setApprovalForAll(c,!0)).wait(),fe.waiting("Token approved for airdrop")}async function airdrop(c,t,n){const ie=t.modalInterface,fe=c.provider.getSigner();ie.waiting("Connecting to wallet..."),await checkWallet(fe,c.address),ie.waiting("Getting airdrop contract address...");const ae=await getAirdropAddress(c.chain,c.network),le=new Contract(ae,airdropABI,fe);await approveTokenForAirdrop(ae,n.tokenAddress,n.type,fe,ie),ie.waiting("Initializing airdrop");const pe=ye=>{const xe=[],Ee=[];for(const Se of ye)xe.push(Se.receiver),Ee.push(Se.amount);return{receivers:xe,amounts:Ee}},me=(ye,xe,Ee=300)=>{const Se=[];for(let Me=0;Me<ye.length;Me+=Ee)Se.push({receivers:ye.slice(Me,Me+Ee),amounts:xe.slice(Me,Me+Ee)});return Se};try{let ye;const{receivers:xe,amounts:Ee}=pe(n.receivers),Se=n.chunkSize||300,Me=me(xe,Ee,Se),Be=[];for(const[$e,ke]of Me.entries())ie.waiting(`Processing transaction ${$e+1} of ${Me.length}`),n.type===TokenStandard.ERC1155?ye=await sendTransaction(le,"distributeERC1155",[n.tokenAddress,n.tokenId,ke.receivers,ke.amounts,n.airdropId],$e,ie):n.type===TokenStandard.ERC20?ye=await sendTransaction(le,"distributeERC20",[n.tokenAddress,ke.receivers,ke.amounts,n.airdropId],$e,ie):n.type===TokenStandard.ERC721&&(ye=await sendTransaction(le,"distributeERC721",[n.tokenAddress,ke.receivers,ke.amounts,n.airdropId],$e,ie)),ie.waiting(`Transaction ${$e+1} sent: ${ye.hash}`),Be.push(ye.hash),await ye.wait(),ie.waiting(`Transaction ${$e+1} confirmed`);return{transactionHashes:Be}}catch(ye){if(ye.code&&ye.code.toString()==="ACTION_REJECTED")throw t.modalInterface.error("Transaction Rejected"),new Error("Transaction Rejected");try{const xe=le.interface.parseError(ye.data);throw t.modalInterface.error(xe.name),t.modalInterface.error(ye),ye}catch(xe){throw t.modalInterface.error(`Unexpected error: ${xe}`),xe}}}async function getShopInfo(c,t,n){const ie=(await(await n.get(`shops/v2/public/${t}`)).json()).data.deployedContracts.filter(fe=>fe.type===c);return ie.length===0?{nftContractAddress:"",shopContractAddress:""}:{nftContractAddress:ie[0].deployedNFTAddress,shopContractAddress:ie[0].deployedShopAddress}}async function getProductData(c,t){return(await(await t.get(`product-v2/public/${c}`)).json()).data}async function transformProductData(c,t){const n=await getProductData(c,t);if(!n||n.skus.length===0)throw new Error("Product not found or no SKUs available");return{productData:{acceptsManageWallet:!0,commission:n.affiliate.commissionPercent||0,description:n.description,productTitle:n.title,royalty:n.skus[0].royalty||0,type:ProductType[n.type.toUpperCase()]||ProductType.DIGITAL},skuData:n.skus.map(ie=>{var fe;return{amount:ie.inventory.quantity,imageUrl:((fe=n.images[n.defaultImageIndex])==null?void 0:fe.original)||"",skuID:ie.id,skuProperties:ie}})}}async function web3Callback(c,t,n,ie){const fe={"X-API-KEY":"ho8homr9e8p4fwii7tjiz41xs4hlbl2h4i"};return(await(await ky.create({headers:fe,prefixUrl:n==="TESTNET"?"https://web3dev.droplinked.com/":"https://web3.droplinked.com/"}).post("transactions",{json:{transaction_id:c,callback_url:ie,chain:t,network:n},headers:fe})).json()).data}async function startRecord(c,t,n,ie,fe,ae){return(await(await ae.post("web3/record/transactions",{json:{uris:fe,network:ie,data:{productId:c,skuIds:t},productId:c,skuIds:t,metadata:{},shopId:n,txType:"RECORD"}})).json()).data.id}async function startPayment(c,t,n,ie,fe,ae){return(await(await ae.post("web3/payment/transactions",{json:{network:n,token:t,shopId:fe,orderId:c}})).json()).data.data}class EVMProvider{constructor(t,n,ie){this.chain=Chain.BINANCE,this.network=Network.TESTNET,this.modalInterface=new defaultModal,this.wallet=ChainWallet.Metamask,this.chain=t,this.network=n,this.gasPredictable=ie,this.address=ZERO_ADDRESS,this.axiosInstance=ky.create({prefixUrl:this.network===Network.MAINNET?"https://apiv3.droplinked.com":"https://apiv3dev.droplinked.com"})}unstoppableLogin(t,n){throw new Error("Method not implemented.")}getBaseUrl(){return this.network===Network.MAINNET?"https://apiv3.droplinked.com":this.network===Network.TESTNET?"https://apiv3dev.droplinked.com":"http://127.0.0.1:3000"}setAxiosInstance(t){return this.axiosInstance=t,this}setNFTContractAddress(t){return this.nftContractAddress=t,this}setShopContractAddress(t){return this.shopContractAddress=t,this}setWallet(t){return this.wallet=t,this}setModal(t){return this.modalInterface=t,this}async customPayment(t){return await this.handleChain(),await droplinked_payment(this.getChainConfig(),this.getContext(),t)}async claimNFTs(t){return await this.handleWallet(this.address),await this.handleChain(),(await claimNFT(t,this.getChainConfig(),this.getContext())).transactionHash}getWalletProvider(){const t=window.ethereum;if(!t)throw new WalletNotFoundException;if(t.providerMap)if(this.wallet===ChainWallet.Metamask){if(!t.providerMap.get("MetaMask"))throw new WalletNotFoundException;return new Web3Provider(t.providers.find(n=>n.isMetaMask))}else if(this.wallet===ChainWallet.CoinBase){if(!t.providerMap.get("CoinbaseWallet"))throw new WalletNotFoundException;return new Web3Provider(t.providers.find(n=>n.isCoinbaseWallet))}else if(this.wallet===ChainWallet.Phantom){if(!t.providerMap.get("CoinbaseWallet"))throw new WalletNotFoundException;return new Web3Provider(t.providers.find(n=>n.isCoinbaseWallet))}else throw new Error("Wallet not implemented");else{if(this.wallet===ChainWallet.CoinBase){if(!window.ethereum.isCoinbaseWallet)throw new WalletNotFoundException}else if(this.wallet===ChainWallet.Metamask&&!window.ethereum.isMetaMask)throw new WalletNotFoundException;return new Web3Provider(window.ethereum)}}async deployShop(t){return await this.handleWallet(this.address),await this.handleChain(),await deployEVMShop(this.getChainConfig(),{axiosInstance:this.axiosInstance,modalInterface:this.modalInterface},t)}setAddress(t){return this.address=t,this}async handleChain(){const t=this.getWalletProvider();await addChain(t,this.chain,this.network,this.modalInterface),await isChainCorrect(t.provider,this.chain,this.network)||(console.log("Changing chain..."),await changeChain(t.provider,this.chain,this.network))}async handleWallet(t){if(!isMetamaskInstalled())throw this.modalInterface.error("Metamask is not installed"),new WalletNotFoundException;this.modalInterface.waiting("Getting accounts...");const ie=this.getWalletProvider().provider,fe=await getAccounts(ie);if(!isWalletConnected(ie)||fe.length===0){this.modalInterface.waiting("Please connect your wallet");const{address:ae}=await this.walletLogin();t.toLocaleLowerCase()!==ae.toLocaleLowerCase()&&(await window.ethereum.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}),await this.handleWallet(t))}if(String(fe[0]).toLocaleLowerCase()!==t.toLocaleLowerCase()&&t!==""&&(this.modalInterface.waiting("Change your account based on the one you used to login..."),await window.ethereum.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}),this.handleWallet(t)),this.chain===Chain.SKALE){const ae=await(await this.axiosInstance.post("web3/sFuelDistribution",{json:{wallet:this.address,isTestnet:this.network===Network.TESTNET}})).json();console.log(ae)}this.modalInterface.success("Wallet connected")}getChainConfig(){return{address:this.address,chain:this.chain,network:this.network,provider:this.getWalletProvider(),gasPredictable:this.gasPredictable}}getContext(){return{axiosInstance:this.axiosInstance,modalInterface:this.modalInterface,nftContract:this.nftContractAddress,shopContractAddress:this.shopContractAddress}}async walletLogin(){const{address:t,signature:n,date:ie,nonce:fe}=await evmLogin(this.getWalletProvider(),this.chain,this.network,this.modalInterface,this.axiosInstance);return this.address=t,{address:t,signature:n,date:ie,nonce:fe}}checkDeployment(){if(!this.nftContractAddress)throw new Error("NFT contract address not set");if(!this.shopContractAddress)throw new Error("Shop contract address not set")}async recordProduct(t){const{productData:n,skuData:ie}=await transformProductData(t,this.axiosInstance);if(this.checkDeployment(),!this.shopId)throw new FieldNotFound("shopId");const fe=await startRecord(t,ie.map(me=>me.skuID),this.shopId,this.chain,[],this.axiosInstance);await this.handleWallet(this.address),await this.handleChain();const ae=await recordProduct(this.getChainConfig(),this.getContext(),n,ie);await updateUris(fe,ae.metadataUrls,this.axiosInstance),await updateHash(fe,ae.transactionHash,this.axiosInstance);const le=`${this.getBaseUrl()}/web3/record/callback/events/${fe}`;if(!await web3Callback(ae.transactionHash,this.chain,Network[this.network],le))throw new Web3CallbackFailed(`txHash: ${ae.transactionHash}`);return{...ae,transactionId:fe,transactionHashUrl:getTransactionLink({blockchain:this.chain,transactionHash:ae.transactionHash,isTestnet:this.network!==Network.MAINNET})}}setShopId(t){return this.shopId=t,this}async executeAirdrop(t){const n=await getAirdropData(t,this.axiosInstance);return await this.handleWallet(this.address),await this.handleChain(),await airdrop(this.getChainConfig(),this.getContext(),{type:TokenStandard.ERC1155,airdropId:t,receivers:n.receivers,tokenAddress:n.tokenAddress,tokenId:n.tokenId,chunkSize:300})}async payment(t){await this.handleWallet(this.address),await this.handleChain();const{orderID:n,paymentToken:ie,paymentType:fe}=t;if(!this.shopId)throw new FieldNotFound("shopId");const ae=await startPayment(n,ie,fe,this.address,this.shopId,this.axiosInstance),le=await getCartData(n,ie,fe,this.address,this.axiosInstance),pe=le.paymentData;console.log({paymentData:pe});const me=await droplinked_payment(this.getChainConfig(),this.getContext(),pe);if(!await web3Callback(me.transactionHash,this.chain,Network[this.network],`${this.getBaseUrl()}/web3/payment/callback`))throw new Web3CallbackFailed(`txHash: ${me.transactionHash}`);return{...me,orderID:le.orderID,transactionId:ae}}async getPaymentData(t,n,ie){return await getCartData(t,ie,n,this.address,this.axiosInstance)}async paymentWithToken(t,n,ie,fe=18){await this.handleWallet(this.address),await this.handleChain();const ae=erc20ABI,le=this.getWalletProvider().getSigner(),pe=new Contract(ie,ae,le);try{await pe.callStatic.transfer(t,BigInt(Math.floor(n*1e6))*BigInt(10**(fe-6)));const me=(await pe.estimateGas.transfer(t,BigInt(Math.floor(n*1e6))*BigInt(10**(fe-6)))).toBigInt().valueOf(),ye=(await getGasPrice$1(this.getWalletProvider())).valueOf();return(await pe.transfer(t,BigInt(Math.floor(n*1e6))*BigInt(10**(fe-6)),{gasPrice:ye*BigInt(105)/BigInt(100),gasLimit:me*BigInt(105)/BigInt(100)})).hash}catch(me){throw me.reason?me.reason==="ERC20: transfer amount exceeds balance"?new Error("Insufficient token balance"):me.reason==="insufficient funds for gas * price + value"?new Error("Insufficient ETH balance"):me.reason==="bad result from backend"?new Error("Something went wrong, check your eth and token balance"):new Error(me.reason):me}}}var Web3Actions=(c=>(c.LOGIN="LOGIN",c.DEPLOY="DEPLOY",c.RECORD="RECORD",c.PAYMENT="PAYMENT",c.CLAIM="CLAIM",c.AIRDROP="AIRDROP",c))(Web3Actions||{});const crypto$2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes(c){return c instanceof Uint8Array||ArrayBuffer.isView(c)&&c.constructor.name==="Uint8Array"}function anumber(c){if(!Number.isSafeInteger(c)||c<0)throw new Error("positive integer expected, got "+c)}function abytes(c,...t){if(!isBytes(c))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(c.length))throw new Error("Uint8Array expected of length "+t+", got length="+c.length)}function ahash(c){if(typeof c!="function"||typeof c.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");anumber(c.outputLen),anumber(c.blockLen)}function aexists(c,t=!0){if(c.destroyed)throw new Error("Hash instance has been destroyed");if(t&&c.finished)throw new Error("Hash#digest() has already been called")}function aoutput(c,t){abytes(c);const n=t.outputLen;if(c.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function clean(...c){for(let t=0;t<c.length;t++)c[t].fill(0)}function createView(c){return new DataView(c.buffer,c.byteOffset,c.byteLength)}function rotr(c,t){return c<<32-t|c>>>t}const hasHexBuiltin=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",hexes=Array.from({length:256},(c,t)=>t.toString(16).padStart(2,"0"));function bytesToHex(c){if(abytes(c),hasHexBuiltin)return c.toHex();let t="";for(let n=0;n<c.length;n++)t+=hexes[c[n]];return t}const asciis={_0:48,_9:57,A:65,F:70,a:97,f:102};function asciiToBase16(c){if(c>=asciis._0&&c<=asciis._9)return c-asciis._0;if(c>=asciis.A&&c<=asciis.F)return c-(asciis.A-10);if(c>=asciis.a&&c<=asciis.f)return c-(asciis.a-10)}function hexToBytes(c){if(typeof c!="string")throw new Error("hex string expected, got "+typeof c);if(hasHexBuiltin)return Uint8Array.fromHex(c);const t=c.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const ie=new Uint8Array(n);for(let fe=0,ae=0;fe<n;fe++,ae+=2){const le=asciiToBase16(c.charCodeAt(ae)),pe=asciiToBase16(c.charCodeAt(ae+1));if(le===void 0||pe===void 0){const me=c[ae]+c[ae+1];throw new Error('hex string expected, got non-hex character "'+me+'" at index '+ae)}ie[fe]=le*16+pe}return ie}function utf8ToBytes(c){if(typeof c!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(c))}function toBytes(c){return typeof c=="string"&&(c=utf8ToBytes(c)),abytes(c),c}function concatBytes(...c){let t=0;for(let ie=0;ie<c.length;ie++){const fe=c[ie];abytes(fe),t+=fe.length}const n=new Uint8Array(t);for(let ie=0,fe=0;ie<c.length;ie++){const ae=c[ie];n.set(ae,fe),fe+=ae.length}return n}class Hash{}function createHasher(c){const t=ie=>c().update(toBytes(ie)).digest(),n=c();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>c(),t}function randomBytes(c=32){if(crypto$2&&typeof crypto$2.getRandomValues=="function")return crypto$2.getRandomValues(new Uint8Array(c));if(crypto$2&&typeof crypto$2.randomBytes=="function")return Uint8Array.from(crypto$2.randomBytes(c));throw new Error("crypto.getRandomValues must be defined")}function setBigUint64(c,t,n,ie){if(typeof c.setBigUint64=="function")return c.setBigUint64(t,n,ie);const fe=BigInt(32),ae=BigInt(4294967295),le=Number(n>>fe&ae),pe=Number(n&ae),me=ie?4:0,ye=ie?0:4;c.setUint32(t+me,le,ie),c.setUint32(t+ye,pe,ie)}function Chi(c,t,n){return c&t^~c&n}function Maj(c,t,n){return c&t^c&n^t&n}class HashMD extends Hash{constructor(t,n,ie,fe){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=ie,this.isLE=fe,this.buffer=new Uint8Array(t),this.view=createView(this.buffer)}update(t){aexists(this),t=toBytes(t),abytes(t);const{view:n,buffer:ie,blockLen:fe}=this,ae=t.length;for(let le=0;le<ae;){const pe=Math.min(fe-this.pos,ae-le);if(pe===fe){const me=createView(t);for(;fe<=ae-le;le+=fe)this.process(me,le);continue}ie.set(t.subarray(le,le+pe),this.pos),this.pos+=pe,le+=pe,this.pos===fe&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){aexists(this),aoutput(t,this),this.finished=!0;const{buffer:n,view:ie,blockLen:fe,isLE:ae}=this;let{pos:le}=this;n[le++]=128,clean(this.buffer.subarray(le)),this.padOffset>fe-le&&(this.process(ie,0),le=0);for(let Ee=le;Ee<fe;Ee++)n[Ee]=0;setBigUint64(ie,fe-8,BigInt(this.length*8),ae),this.process(ie,0);const pe=createView(t),me=this.outputLen;if(me%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const ye=me/4,xe=this.get();if(ye>xe.length)throw new Error("_sha2: outputLen bigger than state");for(let Ee=0;Ee<ye;Ee++)pe.setUint32(4*Ee,xe[Ee],ae)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const ie=t.slice(0,n);return this.destroy(),ie}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:ie,length:fe,finished:ae,destroyed:le,pos:pe}=this;return t.destroyed=le,t.finished=ae,t.length=fe,t.pos=pe,fe%n&&t.buffer.set(ie),t}clone(){return this._cloneInto()}}const SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(c,t=!1){return t?{h:Number(c&U32_MASK64),l:Number(c>>_32n&U32_MASK64)}:{h:Number(c>>_32n&U32_MASK64)|0,l:Number(c&U32_MASK64)|0}}function split(c,t=!1){const n=c.length;let ie=new Uint32Array(n),fe=new Uint32Array(n);for(let ae=0;ae<n;ae++){const{h:le,l:pe}=fromBig(c[ae],t);[ie[ae],fe[ae]]=[le,pe]}return[ie,fe]}const shrSH=(c,t,n)=>c>>>n,shrSL=(c,t,n)=>c<<32-n|t>>>n,rotrSH=(c,t,n)=>c>>>n|t<<32-n,rotrSL=(c,t,n)=>c<<32-n|t>>>n,rotrBH=(c,t,n)=>c<<64-n|t>>>n-32,rotrBL=(c,t,n)=>c>>>n-32|t<<64-n;function add(c,t,n,ie){const fe=(t>>>0)+(ie>>>0);return{h:c+n+(fe/2**32|0)|0,l:fe|0}}const add3L=(c,t,n)=>(c>>>0)+(t>>>0)+(n>>>0),add3H=(c,t,n,ie)=>t+n+ie+(c/2**32|0)|0,add4L=(c,t,n,ie)=>(c>>>0)+(t>>>0)+(n>>>0)+(ie>>>0),add4H=(c,t,n,ie,fe)=>t+n+ie+fe+(c/2**32|0)|0,add5L=(c,t,n,ie,fe)=>(c>>>0)+(t>>>0)+(n>>>0)+(ie>>>0)+(fe>>>0),add5H=(c,t,n,ie,fe,ae)=>t+n+ie+fe+ae+(c/2**32|0)|0,SHA256_K=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),SHA256_W=new Uint32Array(64);class SHA256 extends HashMD{constructor(t=32){super(64,t,8,!1),this.A=SHA256_IV[0]|0,this.B=SHA256_IV[1]|0,this.C=SHA256_IV[2]|0,this.D=SHA256_IV[3]|0,this.E=SHA256_IV[4]|0,this.F=SHA256_IV[5]|0,this.G=SHA256_IV[6]|0,this.H=SHA256_IV[7]|0}get(){const{A:t,B:n,C:ie,D:fe,E:ae,F:le,G:pe,H:me}=this;return[t,n,ie,fe,ae,le,pe,me]}set(t,n,ie,fe,ae,le,pe,me){this.A=t|0,this.B=n|0,this.C=ie|0,this.D=fe|0,this.E=ae|0,this.F=le|0,this.G=pe|0,this.H=me|0}process(t,n){for(let Ee=0;Ee<16;Ee++,n+=4)SHA256_W[Ee]=t.getUint32(n,!1);for(let Ee=16;Ee<64;Ee++){const Se=SHA256_W[Ee-15],Me=SHA256_W[Ee-2],Be=rotr(Se,7)^rotr(Se,18)^Se>>>3,$e=rotr(Me,17)^rotr(Me,19)^Me>>>10;SHA256_W[Ee]=$e+SHA256_W[Ee-7]+Be+SHA256_W[Ee-16]|0}let{A:ie,B:fe,C:ae,D:le,E:pe,F:me,G:ye,H:xe}=this;for(let Ee=0;Ee<64;Ee++){const Se=rotr(pe,6)^rotr(pe,11)^rotr(pe,25),Me=xe+Se+Chi(pe,me,ye)+SHA256_K[Ee]+SHA256_W[Ee]|0,$e=(rotr(ie,2)^rotr(ie,13)^rotr(ie,22))+Maj(ie,fe,ae)|0;xe=ye,ye=me,me=pe,pe=le+Me|0,le=ae,ae=fe,fe=ie,ie=Me+$e|0}ie=ie+this.A|0,fe=fe+this.B|0,ae=ae+this.C|0,le=le+this.D|0,pe=pe+this.E|0,me=me+this.F|0,ye=ye+this.G|0,xe=xe+this.H|0,this.set(ie,fe,ae,le,pe,me,ye,xe)}roundClean(){clean(SHA256_W)}destroy(){this.set(0,0,0,0,0,0,0,0),clean(this.buffer)}}const K512=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(c=>BigInt(c))),SHA512_Kh=K512[0],SHA512_Kl=K512[1],SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends HashMD{constructor(t=64){super(128,t,16,!1),this.Ah=SHA512_IV[0]|0,this.Al=SHA512_IV[1]|0,this.Bh=SHA512_IV[2]|0,this.Bl=SHA512_IV[3]|0,this.Ch=SHA512_IV[4]|0,this.Cl=SHA512_IV[5]|0,this.Dh=SHA512_IV[6]|0,this.Dl=SHA512_IV[7]|0,this.Eh=SHA512_IV[8]|0,this.El=SHA512_IV[9]|0,this.Fh=SHA512_IV[10]|0,this.Fl=SHA512_IV[11]|0,this.Gh=SHA512_IV[12]|0,this.Gl=SHA512_IV[13]|0,this.Hh=SHA512_IV[14]|0,this.Hl=SHA512_IV[15]|0}get(){const{Ah:t,Al:n,Bh:ie,Bl:fe,Ch:ae,Cl:le,Dh:pe,Dl:me,Eh:ye,El:xe,Fh:Ee,Fl:Se,Gh:Me,Gl:Be,Hh:$e,Hl:ke}=this;return[t,n,ie,fe,ae,le,pe,me,ye,xe,Ee,Se,Me,Be,$e,ke]}set(t,n,ie,fe,ae,le,pe,me,ye,xe,Ee,Se,Me,Be,$e,ke){this.Ah=t|0,this.Al=n|0,this.Bh=ie|0,this.Bl=fe|0,this.Ch=ae|0,this.Cl=le|0,this.Dh=pe|0,this.Dl=me|0,this.Eh=ye|0,this.El=xe|0,this.Fh=Ee|0,this.Fl=Se|0,this.Gh=Me|0,this.Gl=Be|0,this.Hh=$e|0,this.Hl=ke|0}process(t,n){for(let Fe=0;Fe<16;Fe++,n+=4)SHA512_W_H[Fe]=t.getUint32(n),SHA512_W_L[Fe]=t.getUint32(n+=4);for(let Fe=16;Fe<80;Fe++){const Le=SHA512_W_H[Fe-15]|0,He=SHA512_W_L[Fe-15]|0,ze=rotrSH(Le,He,1)^rotrSH(Le,He,8)^shrSH(Le,He,7),Je=rotrSL(Le,He,1)^rotrSL(Le,He,8)^shrSL(Le,He,7),Xe=SHA512_W_H[Fe-2]|0,Ue=SHA512_W_L[Fe-2]|0,$t=rotrSH(Xe,Ue,19)^rotrBH(Xe,Ue,61)^shrSH(Xe,Ue,6),_e=rotrSL(Xe,Ue,19)^rotrBL(Xe,Ue,61)^shrSL(Xe,Ue,6),se=add4L(Je,_e,SHA512_W_L[Fe-7],SHA512_W_L[Fe-16]),ce=add4H(se,ze,$t,SHA512_W_H[Fe-7],SHA512_W_H[Fe-16]);SHA512_W_H[Fe]=ce|0,SHA512_W_L[Fe]=se|0}let{Ah:ie,Al:fe,Bh:ae,Bl:le,Ch:pe,Cl:me,Dh:ye,Dl:xe,Eh:Ee,El:Se,Fh:Me,Fl:Be,Gh:$e,Gl:ke,Hh:Te,Hl:Ie}=this;for(let Fe=0;Fe<80;Fe++){const Le=rotrSH(Ee,Se,14)^rotrSH(Ee,Se,18)^rotrBH(Ee,Se,41),He=rotrSL(Ee,Se,14)^rotrSL(Ee,Se,18)^rotrBL(Ee,Se,41),ze=Ee&Me^~Ee&$e,Je=Se&Be^~Se&ke,Xe=add5L(Ie,He,Je,SHA512_Kl[Fe],SHA512_W_L[Fe]),Ue=add5H(Xe,Te,Le,ze,SHA512_Kh[Fe],SHA512_W_H[Fe]),$t=Xe|0,_e=rotrSH(ie,fe,28)^rotrBH(ie,fe,34)^rotrBH(ie,fe,39),se=rotrSL(ie,fe,28)^rotrBL(ie,fe,34)^rotrBL(ie,fe,39),ce=ie&ae^ie&pe^ae&pe,de=fe&le^fe&me^le&me;Te=$e|0,Ie=ke|0,$e=Me|0,ke=Be|0,Me=Ee|0,Be=Se|0,{h:Ee,l:Se}=add(ye|0,xe|0,Ue|0,$t|0),ye=pe|0,xe=me|0,pe=ae|0,me=le|0,ae=ie|0,le=fe|0;const he=add3L($t,se,de);ie=add3H(he,Ue,_e,ce),fe=he|0}({h:ie,l:fe}=add(this.Ah|0,this.Al|0,ie|0,fe|0)),{h:ae,l:le}=add(this.Bh|0,this.Bl|0,ae|0,le|0),{h:pe,l:me}=add(this.Ch|0,this.Cl|0,pe|0,me|0),{h:ye,l:xe}=add(this.Dh|0,this.Dl|0,ye|0,xe|0),{h:Ee,l:Se}=add(this.Eh|0,this.El|0,Ee|0,Se|0),{h:Me,l:Be}=add(this.Fh|0,this.Fl|0,Me|0,Be|0),{h:$e,l:ke}=add(this.Gh|0,this.Gl|0,$e|0,ke|0),{h:Te,l:Ie}=add(this.Hh|0,this.Hl|0,Te|0,Ie|0),this.set(ie,fe,ae,le,pe,me,ye,xe,Ee,Se,Me,Be,$e,ke,Te,Ie)}roundClean(){clean(SHA512_W_H,SHA512_W_L)}destroy(){clean(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha256$5=createHasher(()=>new SHA256),sha512$3=createHasher(()=>new SHA512);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$5=BigInt(1);function _abool2(c,t=""){if(typeof c!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof c)}return c}function _abytes2(c,t,n=""){const ie=isBytes(c),fe=c==null?void 0:c.length,ae=t!==void 0;if(!ie||ae&&fe!==t){const le=n&&`"${n}" `,pe=ae?` of length ${t}`:"",me=ie?`length=${fe}`:`type=${typeof c}`;throw new Error(le+"expected Uint8Array"+pe+", got "+me)}return c}function numberToHexUnpadded(c){const t=c.toString(16);return t.length&1?"0"+t:t}function hexToNumber(c){if(typeof c!="string")throw new Error("hex string expected, got "+typeof c);return c===""?_0n$4:BigInt("0x"+c)}function bytesToNumberBE(c){return hexToNumber(bytesToHex(c))}function bytesToNumberLE(c){return abytes(c),hexToNumber(bytesToHex(Uint8Array.from(c).reverse()))}function numberToBytesBE(c,t){return hexToBytes(c.toString(16).padStart(t*2,"0"))}function numberToBytesLE(c,t){return numberToBytesBE(c,t).reverse()}function ensureBytes(c,t,n){let ie;if(typeof t=="string")try{ie=hexToBytes(t)}catch(ae){throw new Error(c+" must be hex string or Uint8Array, cause: "+ae)}else if(isBytes(t))ie=Uint8Array.from(t);else throw new Error(c+" must be hex string or Uint8Array");const fe=ie.length;if(typeof n=="number"&&fe!==n)throw new Error(c+" of length "+n+" expected, got "+fe);return ie}function copyBytes(c){return Uint8Array.from(c)}const isPosBig=c=>typeof c=="bigint"&&_0n$4<=c;function inRange$1(c,t,n){return isPosBig(c)&&isPosBig(t)&&isPosBig(n)&&t<=c&&c<n}function aInRange(c,t,n,ie){if(!inRange$1(t,n,ie))throw new Error("expected valid "+c+": "+n+" <= n < "+ie+", got "+t)}function bitLen(c){let t;for(t=0;c>_0n$4;c>>=_1n$5,t+=1);return t}const bitMask=c=>(_1n$5<<BigInt(c))-_1n$5;function createHmacDrbg(c,t,n){if(typeof c!="number"||c<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const ie=Me=>new Uint8Array(Me),fe=Me=>Uint8Array.of(Me);let ae=ie(c),le=ie(c),pe=0;const me=()=>{ae.fill(1),le.fill(0),pe=0},ye=(...Me)=>n(le,ae,...Me),xe=(Me=ie(0))=>{le=ye(fe(0),Me),ae=ye(),Me.length!==0&&(le=ye(fe(1),Me),ae=ye())},Ee=()=>{if(pe++>=1e3)throw new Error("drbg: tried 1000 values");let Me=0;const Be=[];for(;Me<t;){ae=ye();const $e=ae.slice();Be.push($e),Me+=ae.length}return concatBytes(...Be)};return(Me,Be)=>{me(),xe(Me);let $e;for(;!($e=Be(Ee()));)xe();return me(),$e}}function _validateObject(c,t,n={}){if(!c||typeof c!="object")throw new Error("expected valid options object");function ie(fe,ae,le){const pe=c[fe];if(le&&pe===void 0)return;const me=typeof pe;if(me!==ae||pe===null)throw new Error(`param "${fe}" is invalid: expected ${ae}, got ${me}`)}Object.entries(t).forEach(([fe,ae])=>ie(fe,ae,!1)),Object.entries(n).forEach(([fe,ae])=>ie(fe,ae,!0))}function memoized(c){const t=new WeakMap;return(n,...ie)=>{const fe=t.get(n);if(fe!==void 0)return fe;const ae=c(n,...ie);return t.set(n,ae),ae}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$3=BigInt(0),_1n$4=BigInt(1),_2n$4=BigInt(2),_3n$1=BigInt(3),_4n$1=BigInt(4),_5n$1=BigInt(5),_7n=BigInt(7),_8n$2=BigInt(8),_9n=BigInt(9),_16n=BigInt(16);function mod(c,t){const n=c%t;return n>=_0n$3?n:t+n}function pow2(c,t,n){let ie=c;for(;t-- >_0n$3;)ie*=ie,ie%=n;return ie}function invert(c,t){if(c===_0n$3)throw new Error("invert: expected non-zero number");if(t<=_0n$3)throw new Error("invert: expected positive modulus, got "+t);let n=mod(c,t),ie=t,fe=_0n$3,ae=_1n$4;for(;n!==_0n$3;){const pe=ie/n,me=ie%n,ye=fe-ae*pe;ie=n,n=me,fe=ae,ae=ye}if(ie!==_1n$4)throw new Error("invert: does not exist");return mod(fe,t)}function assertIsSquare(c,t,n){if(!c.eql(c.sqr(t),n))throw new Error("Cannot find square root")}function sqrt3mod4(c,t){const n=(c.ORDER+_1n$4)/_4n$1,ie=c.pow(t,n);return assertIsSquare(c,ie,t),ie}function sqrt5mod8(c,t){const n=(c.ORDER-_5n$1)/_8n$2,ie=c.mul(t,_2n$4),fe=c.pow(ie,n),ae=c.mul(t,fe),le=c.mul(c.mul(ae,_2n$4),fe),pe=c.mul(ae,c.sub(le,c.ONE));return assertIsSquare(c,pe,t),pe}function sqrt9mod16(c){const t=Field(c),n=tonelliShanks(c),ie=n(t,t.neg(t.ONE)),fe=n(t,ie),ae=n(t,t.neg(ie)),le=(c+_7n)/_16n;return(pe,me)=>{let ye=pe.pow(me,le),xe=pe.mul(ye,ie);const Ee=pe.mul(ye,fe),Se=pe.mul(ye,ae),Me=pe.eql(pe.sqr(xe),me),Be=pe.eql(pe.sqr(Ee),me);ye=pe.cmov(ye,xe,Me),xe=pe.cmov(Se,Ee,Be);const $e=pe.eql(pe.sqr(xe),me),ke=pe.cmov(ye,xe,$e);return assertIsSquare(pe,ke,me),ke}}function tonelliShanks(c){if(c<_3n$1)throw new Error("sqrt is not defined for small field");let t=c-_1n$4,n=0;for(;t%_2n$4===_0n$3;)t/=_2n$4,n++;let ie=_2n$4;const fe=Field(c);for(;FpLegendre(fe,ie)===1;)if(ie++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return sqrt3mod4;let ae=fe.pow(ie,t);const le=(t+_1n$4)/_2n$4;return function(me,ye){if(me.is0(ye))return ye;if(FpLegendre(me,ye)!==1)throw new Error("Cannot find square root");let xe=n,Ee=me.mul(me.ONE,ae),Se=me.pow(ye,t),Me=me.pow(ye,le);for(;!me.eql(Se,me.ONE);){if(me.is0(Se))return me.ZERO;let Be=1,$e=me.sqr(Se);for(;!me.eql($e,me.ONE);)if(Be++,$e=me.sqr($e),Be===xe)throw new Error("Cannot find square root");const ke=_1n$4<<BigInt(xe-Be-1),Te=me.pow(Ee,ke);xe=Be,Ee=me.sqr(Te),Se=me.mul(Se,Ee),Me=me.mul(Me,Te)}return Me}}function FpSqrt(c){return c%_4n$1===_3n$1?sqrt3mod4:c%_8n$2===_5n$1?sqrt5mod8:c%_16n===_9n?sqrt9mod16(c):tonelliShanks(c)}const isNegativeLE=(c,t)=>(mod(c,t)&_1n$4)===_1n$4,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(c){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=FIELD_FIELDS.reduce((ie,fe)=>(ie[fe]="function",ie),t);return _validateObject(c,n),c}function FpPow(c,t,n){if(n<_0n$3)throw new Error("invalid exponent, negatives unsupported");if(n===_0n$3)return c.ONE;if(n===_1n$4)return t;let ie=c.ONE,fe=t;for(;n>_0n$3;)n&_1n$4&&(ie=c.mul(ie,fe)),fe=c.sqr(fe),n>>=_1n$4;return ie}function FpInvertBatch(c,t,n=!1){const ie=new Array(t.length).fill(n?c.ZERO:void 0),fe=t.reduce((le,pe,me)=>c.is0(pe)?le:(ie[me]=le,c.mul(le,pe)),c.ONE),ae=c.inv(fe);return t.reduceRight((le,pe,me)=>c.is0(pe)?le:(ie[me]=c.mul(le,ie[me]),c.mul(le,pe)),ae),ie}function FpLegendre(c,t){const n=(c.ORDER-_1n$4)/_2n$4,ie=c.pow(t,n),fe=c.eql(ie,c.ONE),ae=c.eql(ie,c.ZERO),le=c.eql(ie,c.neg(c.ONE));if(!fe&&!ae&&!le)throw new Error("invalid Legendre symbol result");return fe?1:ae?0:-1}function nLength(c,t){t!==void 0&&anumber(t);const n=t!==void 0?t:c.toString(2).length,ie=Math.ceil(n/8);return{nBitLength:n,nByteLength:ie}}function Field(c,t,n=!1,ie={}){if(c<=_0n$3)throw new Error("invalid field: expected ORDER > 0, got "+c);let fe,ae,le=!1,pe;if(typeof t=="object"&&t!=null){if(ie.sqrt||n)throw new Error("cannot specify opts in two arguments");const Se=t;Se.BITS&&(fe=Se.BITS),Se.sqrt&&(ae=Se.sqrt),typeof Se.isLE=="boolean"&&(n=Se.isLE),typeof Se.modFromBytes=="boolean"&&(le=Se.modFromBytes),pe=Se.allowedLengths}else typeof t=="number"&&(fe=t),ie.sqrt&&(ae=ie.sqrt);const{nBitLength:me,nByteLength:ye}=nLength(c,fe);if(ye>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let xe;const Ee=Object.freeze({ORDER:c,isLE:n,BITS:me,BYTES:ye,MASK:bitMask(me),ZERO:_0n$3,ONE:_1n$4,allowedLengths:pe,create:Se=>mod(Se,c),isValid:Se=>{if(typeof Se!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof Se);return _0n$3<=Se&&Se<c},is0:Se=>Se===_0n$3,isValidNot0:Se=>!Ee.is0(Se)&&Ee.isValid(Se),isOdd:Se=>(Se&_1n$4)===_1n$4,neg:Se=>mod(-Se,c),eql:(Se,Me)=>Se===Me,sqr:Se=>mod(Se*Se,c),add:(Se,Me)=>mod(Se+Me,c),sub:(Se,Me)=>mod(Se-Me,c),mul:(Se,Me)=>mod(Se*Me,c),pow:(Se,Me)=>FpPow(Ee,Se,Me),div:(Se,Me)=>mod(Se*invert(Me,c),c),sqrN:Se=>Se*Se,addN:(Se,Me)=>Se+Me,subN:(Se,Me)=>Se-Me,mulN:(Se,Me)=>Se*Me,inv:Se=>invert(Se,c),sqrt:ae||(Se=>(xe||(xe=FpSqrt(c)),xe(Ee,Se))),toBytes:Se=>n?numberToBytesLE(Se,ye):numberToBytesBE(Se,ye),fromBytes:(Se,Me=!0)=>{if(pe){if(!pe.includes(Se.length)||Se.length>ye)throw new Error("Field.fromBytes: expected "+pe+" bytes, got "+Se.length);const $e=new Uint8Array(ye);$e.set(Se,n?0:$e.length-Se.length),Se=$e}if(Se.length!==ye)throw new Error("Field.fromBytes: expected "+ye+" bytes, got "+Se.length);let Be=n?bytesToNumberLE(Se):bytesToNumberBE(Se);if(le&&(Be=mod(Be,c)),!Me&&!Ee.isValid(Be))throw new Error("invalid field element: outside of range 0..ORDER");return Be},invertBatch:Se=>FpInvertBatch(Ee,Se),cmov:(Se,Me,Be)=>Be?Me:Se});return Object.freeze(Ee)}function getFieldBytesLength(c){if(typeof c!="bigint")throw new Error("field order must be bigint");const t=c.toString(2).length;return Math.ceil(t/8)}function getMinHashLength(c){const t=getFieldBytesLength(c);return t+Math.ceil(t/2)}function mapHashToField(c,t,n=!1){const ie=c.length,fe=getFieldBytesLength(t),ae=getMinHashLength(t);if(ie<16||ie<ae||ie>1024)throw new Error("expected "+ae+"-1024 bytes of input, got "+ie);const le=n?bytesToNumberLE(c):bytesToNumberBE(c),pe=mod(le,t-_1n$4)+_1n$4;return n?numberToBytesLE(pe,fe):numberToBytesBE(pe,fe)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$2=BigInt(0),_1n$3=BigInt(1);function negateCt(c,t){const n=t.negate();return c?n:t}function normalizeZ(c,t){const n=FpInvertBatch(c.Fp,t.map(ie=>ie.Z));return t.map((ie,fe)=>c.fromAffine(ie.toAffine(n[fe])))}function validateW(c,t){if(!Number.isSafeInteger(c)||c<=0||c>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+c)}function calcWOpts(c,t){validateW(c,t);const n=Math.ceil(t/c)+1,ie=2**(c-1),fe=2**c,ae=bitMask(c),le=BigInt(c);return{windows:n,windowSize:ie,mask:ae,maxNumber:fe,shiftBy:le}}function calcOffsets(c,t,n){const{windowSize:ie,mask:fe,maxNumber:ae,shiftBy:le}=n;let pe=Number(c&fe),me=c>>le;pe>ie&&(pe-=ae,me+=_1n$3);const ye=t*ie,xe=ye+Math.abs(pe)-1,Ee=pe===0,Se=pe<0,Me=t%2!==0;return{nextN:me,offset:xe,isZero:Ee,isNeg:Se,isNegF:Me,offsetF:ye}}function validateMSMPoints(c,t){if(!Array.isArray(c))throw new Error("array expected");c.forEach((n,ie)=>{if(!(n instanceof t))throw new Error("invalid point at index "+ie)})}function validateMSMScalars(c,t){if(!Array.isArray(c))throw new Error("array of scalars expected");c.forEach((n,ie)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+ie)})}const pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function getW(c){return pointWindowSizes.get(c)||1}function assert0(c){if(c!==_0n$2)throw new Error("invalid wNAF")}class wNAF{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,ie=this.ZERO){let fe=t;for(;n>_0n$2;)n&_1n$3&&(ie=ie.add(fe)),fe=fe.double(),n>>=_1n$3;return ie}precomputeWindow(t,n){const{windows:ie,windowSize:fe}=calcWOpts(n,this.bits),ae=[];let le=t,pe=le;for(let me=0;me<ie;me++){pe=le,ae.push(pe);for(let ye=1;ye<fe;ye++)pe=pe.add(le),ae.push(pe);le=pe.double()}return ae}wNAF(t,n,ie){if(!this.Fn.isValid(ie))throw new Error("invalid scalar");let fe=this.ZERO,ae=this.BASE;const le=calcWOpts(t,this.bits);for(let pe=0;pe<le.windows;pe++){const{nextN:me,offset:ye,isZero:xe,isNeg:Ee,isNegF:Se,offsetF:Me}=calcOffsets(ie,pe,le);ie=me,xe?ae=ae.add(negateCt(Se,n[Me])):fe=fe.add(negateCt(Ee,n[ye]))}return assert0(ie),{p:fe,f:ae}}wNAFUnsafe(t,n,ie,fe=this.ZERO){const ae=calcWOpts(t,this.bits);for(let le=0;le<ae.windows&&ie!==_0n$2;le++){const{nextN:pe,offset:me,isZero:ye,isNeg:xe}=calcOffsets(ie,le,ae);if(ie=pe,!ye){const Ee=n[me];fe=fe.add(xe?Ee.negate():Ee)}}return assert0(ie),fe}getPrecomputes(t,n,ie){let fe=pointPrecomputes.get(n);return fe||(fe=this.precomputeWindow(n,t),t!==1&&(typeof ie=="function"&&(fe=ie(fe)),pointPrecomputes.set(n,fe))),fe}cached(t,n,ie){const fe=getW(t);return this.wNAF(fe,this.getPrecomputes(fe,t,ie),n)}unsafe(t,n,ie,fe){const ae=getW(t);return ae===1?this._unsafeLadder(t,n,fe):this.wNAFUnsafe(ae,this.getPrecomputes(ae,t,ie),n,fe)}createCache(t,n){validateW(n,this.bits),pointWindowSizes.set(t,n),pointPrecomputes.delete(t)}hasCache(t){return getW(t)!==1}}function mulEndoUnsafe(c,t,n,ie){let fe=t,ae=c.ZERO,le=c.ZERO;for(;n>_0n$2||ie>_0n$2;)n&_1n$3&&(ae=ae.add(fe)),ie&_1n$3&&(le=le.add(fe)),fe=fe.double(),n>>=_1n$3,ie>>=_1n$3;return{p1:ae,p2:le}}function pippenger(c,t,n,ie){validateMSMPoints(n,c),validateMSMScalars(ie,t);const fe=n.length,ae=ie.length;if(fe!==ae)throw new Error("arrays of points and scalars must have equal length");const le=c.ZERO,pe=bitLen(BigInt(fe));let me=1;pe>12?me=pe-3:pe>4?me=pe-2:pe>0&&(me=2);const ye=bitMask(me),xe=new Array(Number(ye)+1).fill(le),Ee=Math.floor((t.BITS-1)/me)*me;let Se=le;for(let Me=Ee;Me>=0;Me-=me){xe.fill(le);for(let $e=0;$e<ae;$e++){const ke=ie[$e],Te=Number(ke>>BigInt(Me)&ye);xe[Te]=xe[Te].add(n[$e])}let Be=le;for(let $e=xe.length-1,ke=le;$e>0;$e--)ke=ke.add(xe[$e]),Be=Be.add(ke);if(Se=Se.add(Be),Me!==0)for(let $e=0;$e<me;$e++)Se=Se.double()}return Se}function createField(c,t,n){if(t){if(t.ORDER!==c)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return validateField(t),t}else return Field(c,{isLE:n})}function _createCurveFields(c,t,n={},ie){if(ie===void 0&&(ie=c==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${c} CURVE object`);for(const me of["p","n","h"]){const ye=t[me];if(!(typeof ye=="bigint"&&ye>_0n$2))throw new Error(`CURVE.${me} must be positive bigint`)}const fe=createField(t.p,n.Fp,ie),ae=createField(t.n,n.Fn,ie),pe=["Gx","Gy","a",c==="weierstrass"?"b":"d"];for(const me of pe)if(!fe.isValid(t[me]))throw new Error(`CURVE.${me} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:fe,Fn:ae}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$2=BigInt(1),_2n$3=BigInt(2),_8n$1=BigInt(8);function isEdValidXY(c,t,n,ie){const fe=c.sqr(n),ae=c.sqr(ie),le=c.add(c.mul(t.a,fe),ae),pe=c.add(c.ONE,c.mul(t.d,c.mul(fe,ae)));return c.eql(le,pe)}function edwards$1(c,t={}){const n=_createCurveFields("edwards",c,t,t.FpFnLE),{Fp:ie,Fn:fe}=n;let ae=n.CURVE;const{h:le}=ae;_validateObject(t,{},{uvRatio:"function"});const pe=_2n$3<<BigInt(fe.BYTES*8)-_1n$2,me=ke=>ie.create(ke),ye=t.uvRatio||((ke,Te)=>{try{return{isValid:!0,value:ie.sqrt(ie.div(ke,Te))}}catch{return{isValid:!1,value:_0n$1}}});if(!isEdValidXY(ie,ae,ae.Gx,ae.Gy))throw new Error("bad curve params: generator point");function xe(ke,Te,Ie=!1){const Fe=Ie?_1n$2:_0n$1;return aInRange("coordinate "+ke,Te,Fe,pe),Te}function Ee(ke){if(!(ke instanceof Be))throw new Error("ExtendedPoint expected")}const Se=memoized((ke,Te)=>{const{X:Ie,Y:Fe,Z:Le}=ke,He=ke.is0();Te==null&&(Te=He?_8n$1:ie.inv(Le));const ze=me(Ie*Te),Je=me(Fe*Te),Xe=ie.mul(Le,Te);if(He)return{x:_0n$1,y:_1n$2};if(Xe!==_1n$2)throw new Error("invZ was invalid");return{x:ze,y:Je}}),Me=memoized(ke=>{const{a:Te,d:Ie}=ae;if(ke.is0())throw new Error("bad point: ZERO");const{X:Fe,Y:Le,Z:He,T:ze}=ke,Je=me(Fe*Fe),Xe=me(Le*Le),Ue=me(He*He),$t=me(Ue*Ue),_e=me(Je*Te),se=me(Ue*me(_e+Xe)),ce=me($t+me(Ie*me(Je*Xe)));if(se!==ce)throw new Error("bad point: equation left != right (1)");const de=me(Fe*Le),he=me(He*ze);if(de!==he)throw new Error("bad point: equation left != right (2)");return!0});class Be{constructor(Te,Ie,Fe,Le){this.X=xe("x",Te),this.Y=xe("y",Ie),this.Z=xe("z",Fe,!0),this.T=xe("t",Le),Object.freeze(this)}static CURVE(){return ae}static fromAffine(Te){if(Te instanceof Be)throw new Error("extended point not allowed");const{x:Ie,y:Fe}=Te||{};return xe("x",Ie),xe("y",Fe),new Be(Ie,Fe,_1n$2,me(Ie*Fe))}static fromBytes(Te,Ie=!1){const Fe=ie.BYTES,{a:Le,d:He}=ae;Te=copyBytes(_abytes2(Te,Fe,"point")),_abool2(Ie,"zip215");const ze=copyBytes(Te),Je=Te[Fe-1];ze[Fe-1]=Je&-129;const Xe=bytesToNumberLE(ze),Ue=Ie?pe:ie.ORDER;aInRange("point.y",Xe,_0n$1,Ue);const $t=me(Xe*Xe),_e=me($t-_1n$2),se=me(He*$t-Le);let{isValid:ce,value:de}=ye(_e,se);if(!ce)throw new Error("bad point: invalid y coordinate");const he=(de&_1n$2)===_1n$2,ve=(Je&128)!==0;if(!Ie&&de===_0n$1&&ve)throw new Error("bad point: x=0 and x_0=1");return ve!==he&&(de=me(-de)),Be.fromAffine({x:de,y:Xe})}static fromHex(Te,Ie=!1){return Be.fromBytes(ensureBytes("point",Te),Ie)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(Te=8,Ie=!0){return $e.createCache(this,Te),Ie||this.multiply(_2n$3),this}assertValidity(){Me(this)}equals(Te){Ee(Te);const{X:Ie,Y:Fe,Z:Le}=this,{X:He,Y:ze,Z:Je}=Te,Xe=me(Ie*Je),Ue=me(He*Le),$t=me(Fe*Je),_e=me(ze*Le);return Xe===Ue&&$t===_e}is0(){return this.equals(Be.ZERO)}negate(){return new Be(me(-this.X),this.Y,this.Z,me(-this.T))}double(){const{a:Te}=ae,{X:Ie,Y:Fe,Z:Le}=this,He=me(Ie*Ie),ze=me(Fe*Fe),Je=me(_2n$3*me(Le*Le)),Xe=me(Te*He),Ue=Ie+Fe,$t=me(me(Ue*Ue)-He-ze),_e=Xe+ze,se=_e-Je,ce=Xe-ze,de=me($t*se),he=me(_e*ce),ve=me($t*ce),we=me(se*_e);return new Be(de,he,we,ve)}add(Te){Ee(Te);const{a:Ie,d:Fe}=ae,{X:Le,Y:He,Z:ze,T:Je}=this,{X:Xe,Y:Ue,Z:$t,T:_e}=Te,se=me(Le*Xe),ce=me(He*Ue),de=me(Je*Fe*_e),he=me(ze*$t),ve=me((Le+He)*(Xe+Ue)-se-ce),we=he-de,Ae=he+de,be=me(ce-Ie*se),ue=me(ve*we),ge=me(Ae*be),Re=me(ve*be),Ne=me(we*Ae);return new Be(ue,ge,Ne,Re)}subtract(Te){return this.add(Te.negate())}multiply(Te){if(!fe.isValidNot0(Te))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:Ie,f:Fe}=$e.cached(this,Te,Le=>normalizeZ(Be,Le));return normalizeZ(Be,[Ie,Fe])[0]}multiplyUnsafe(Te,Ie=Be.ZERO){if(!fe.isValid(Te))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return Te===_0n$1?Be.ZERO:this.is0()||Te===_1n$2?this:$e.unsafe(this,Te,Fe=>normalizeZ(Be,Fe),Ie)}isSmallOrder(){return this.multiplyUnsafe(le).is0()}isTorsionFree(){return $e.unsafe(this,ae.n).is0()}toAffine(Te){return Se(this,Te)}clearCofactor(){return le===_1n$2?this:this.multiplyUnsafe(le)}toBytes(){const{x:Te,y:Ie}=this.toAffine(),Fe=ie.toBytes(Ie);return Fe[Fe.length-1]|=Te&_1n$2?128:0,Fe}toHex(){return bytesToHex(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(Te){return normalizeZ(Be,Te)}static msm(Te,Ie){return pippenger(Be,fe,Te,Ie)}_setWindowSize(Te){this.precompute(Te)}toRawBytes(){return this.toBytes()}}Be.BASE=new Be(ae.Gx,ae.Gy,_1n$2,me(ae.Gx*ae.Gy)),Be.ZERO=new Be(_0n$1,_1n$2,_1n$2,_0n$1),Be.Fp=ie,Be.Fn=fe;const $e=new wNAF(Be,fe.BITS);return Be.BASE.precompute(8),Be}function eddsa$1(c,t,n={}){if(typeof t!="function")throw new Error('"hash" function param is required');_validateObject(n,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:ie}=n,{BASE:fe,Fp:ae,Fn:le}=c,pe=n.randomBytes||randomBytes,me=n.adjustScalarBytes||(Ue=>Ue),ye=n.domain||((Ue,$t,_e)=>{if(_abool2(_e,"phflag"),$t.length||_e)throw new Error("Contexts/pre-hash are not supported");return Ue});function xe(Ue){return le.create(bytesToNumberLE(Ue))}function Ee(Ue){const $t=Fe.secretKey;Ue=ensureBytes("private key",Ue,$t);const _e=ensureBytes("hashed private key",t(Ue),2*$t),se=me(_e.slice(0,$t)),ce=_e.slice($t,2*$t),de=xe(se);return{head:se,prefix:ce,scalar:de}}function Se(Ue){const{head:$t,prefix:_e,scalar:se}=Ee(Ue),ce=fe.multiply(se),de=ce.toBytes();return{head:$t,prefix:_e,scalar:se,point:ce,pointBytes:de}}function Me(Ue){return Se(Ue).pointBytes}function Be(Ue=Uint8Array.of(),...$t){const _e=concatBytes(...$t);return xe(t(ye(_e,ensureBytes("context",Ue),!!ie)))}function $e(Ue,$t,_e={}){Ue=ensureBytes("message",Ue),ie&&(Ue=ie(Ue));const{prefix:se,scalar:ce,pointBytes:de}=Se($t),he=Be(_e.context,se,Ue),ve=fe.multiply(he).toBytes(),we=Be(_e.context,ve,de,Ue),Ae=le.create(he+we*ce);if(!le.isValid(Ae))throw new Error("sign failed: invalid s");const be=concatBytes(ve,le.toBytes(Ae));return _abytes2(be,Fe.signature,"result")}const ke={zip215:!0};function Te(Ue,$t,_e,se=ke){const{context:ce,zip215:de}=se,he=Fe.signature;Ue=ensureBytes("signature",Ue,he),$t=ensureBytes("message",$t),_e=ensureBytes("publicKey",_e,Fe.publicKey),de!==void 0&&_abool2(de,"zip215"),ie&&($t=ie($t));const ve=he/2,we=Ue.subarray(0,ve),Ae=bytesToNumberLE(Ue.subarray(ve,he));let be,ue,ge;try{be=c.fromBytes(_e,de),ue=c.fromBytes(we,de),ge=fe.multiplyUnsafe(Ae)}catch{return!1}if(!de&&be.isSmallOrder())return!1;const Re=Be(ce,ue.toBytes(),be.toBytes(),$t);return ue.add(be.multiplyUnsafe(Re)).subtract(ge).clearCofactor().is0()}const Ie=ae.BYTES,Fe={secretKey:Ie,publicKey:Ie,signature:2*Ie,seed:Ie};function Le(Ue=pe(Fe.seed)){return _abytes2(Ue,Fe.seed,"seed")}function He(Ue){const $t=Xe.randomSecretKey(Ue);return{secretKey:$t,publicKey:Me($t)}}function ze(Ue){return isBytes(Ue)&&Ue.length===le.BYTES}function Je(Ue,$t){try{return!!c.fromBytes(Ue,$t)}catch{return!1}}const Xe={getExtendedPublicKey:Se,randomSecretKey:Le,isValidSecretKey:ze,isValidPublicKey:Je,toMontgomery(Ue){const{y:$t}=c.fromBytes(Ue),_e=Fe.publicKey,se=_e===32;if(!se&&_e!==57)throw new Error("only defined for 25519 and 448");const ce=se?ae.div(_1n$2+$t,_1n$2-$t):ae.div($t-_1n$2,$t+_1n$2);return ae.toBytes(ce)},toMontgomerySecret(Ue){const $t=Fe.secretKey;_abytes2(Ue,$t);const _e=t(Ue.subarray(0,$t));return me(_e).subarray(0,$t)},randomPrivateKey:Le,precompute(Ue=8,$t=c.BASE){return $t.precompute(Ue,!1)}};return Object.freeze({keygen:He,getPublicKey:Me,sign:$e,verify:Te,utils:Xe,Point:c,lengths:Fe})}function _eddsa_legacy_opts_to_new(c){const t={a:c.a,d:c.d,p:c.Fp.ORDER,n:c.n,h:c.h,Gx:c.Gx,Gy:c.Gy},n=c.Fp,ie=Field(t.n,c.nBitLength,!0),fe={Fp:n,Fn:ie,uvRatio:c.uvRatio},ae={randomBytes:c.randomBytes,adjustScalarBytes:c.adjustScalarBytes,domain:c.domain,prehash:c.prehash,mapToCurve:c.mapToCurve};return{CURVE:t,curveOpts:fe,hash:c.hash,eddsaOpts:ae}}function _eddsa_new_output_to_legacy(c,t){const n=t.Point;return Object.assign({},t,{ExtendedPoint:n,CURVE:c,nBitLength:n.Fn.BITS,nByteLength:n.Fn.BYTES})}function twistedEdwards(c){const{CURVE:t,curveOpts:n,hash:ie,eddsaOpts:fe}=_eddsa_legacy_opts_to_new(c),ae=edwards$1(t,n),le=eddsa$1(ae,ie,fe);return _eddsa_new_output_to_legacy(c,le)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _1n$1=BigInt(1),_2n$2=BigInt(2);BigInt(3);const _5n=BigInt(5),_8n=BigInt(8),ed25519_CURVE_p=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),ed25519_CURVE={p:ed25519_CURVE_p,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:_8n,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function ed25519_pow_2_252_3(c){const t=BigInt(10),n=BigInt(20),ie=BigInt(40),fe=BigInt(80),ae=ed25519_CURVE_p,pe=c*c%ae*c%ae,me=pow2(pe,_2n$2,ae)*pe%ae,ye=pow2(me,_1n$1,ae)*c%ae,xe=pow2(ye,_5n,ae)*ye%ae,Ee=pow2(xe,t,ae)*xe%ae,Se=pow2(Ee,n,ae)*Ee%ae,Me=pow2(Se,ie,ae)*Se%ae,Be=pow2(Me,fe,ae)*Me%ae,$e=pow2(Be,fe,ae)*Me%ae,ke=pow2($e,t,ae)*xe%ae;return{pow_p_5_8:pow2(ke,_2n$2,ae)*c%ae,b2:pe}}function adjustScalarBytes(c){return c[0]&=248,c[31]&=127,c[31]|=64,c}const ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function uvRatio(c,t){const n=ed25519_CURVE_p,ie=mod(t*t*t,n),fe=mod(ie*ie*t,n),ae=ed25519_pow_2_252_3(c*fe).pow_p_5_8;let le=mod(c*ie*ae,n);const pe=mod(t*le*le,n),me=le,ye=mod(le*ED25519_SQRT_M1,n),xe=pe===c,Ee=pe===mod(-c,n),Se=pe===mod(-c*ED25519_SQRT_M1,n);return xe&&(le=me),(Ee||Se)&&(le=ye),isNegativeLE(le,n)&&(le=mod(-le,n)),{isValid:xe||Ee,value:le}}const Fp=Field(ed25519_CURVE.p,{isLE:!0}),ed25519Defaults={...ed25519_CURVE,Fp,hash:sha512$3,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults);var safeBuffer$2={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(c,t){var n=dist$1,ie=n.Buffer;function fe(le,pe){for(var me in le)pe[me]=le[me]}ie.from&&ie.alloc&&ie.allocUnsafe&&ie.allocUnsafeSlow?c.exports=n:(fe(n,t),t.Buffer=ae);function ae(le,pe,me){return ie(le,pe,me)}ae.prototype=Object.create(ie.prototype),fe(ie,ae),ae.from=function(le,pe,me){if(typeof le=="number")throw new TypeError("Argument must not be a number");return ie(le,pe,me)},ae.alloc=function(le,pe,me){if(typeof le!="number")throw new TypeError("Argument must be a number");var ye=ie(le);return pe!==void 0?typeof me=="string"?ye.fill(pe,me):ye.fill(pe):ye.fill(0),ye},ae.allocUnsafe=function(le){if(typeof le!="number")throw new TypeError("Argument must be a number");return ie(le)},ae.allocUnsafeSlow=function(le){if(typeof le!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(le)}})(safeBuffer$2,safeBuffer$2.exports);var safeBufferExports=safeBuffer$2.exports,_Buffer=safeBufferExports.Buffer;function base$4(c){if(c.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var ie=0;ie<c.length;ie++){var fe=c.charAt(ie),ae=fe.charCodeAt(0);if(t[ae]!==255)throw new TypeError(fe+" is ambiguous");t[ae]=ie}var le=c.length,pe=c.charAt(0),me=Math.log(le)/Math.log(256),ye=Math.log(256)/Math.log(le);function xe(Me){if((Array.isArray(Me)||Me instanceof Uint8Array)&&(Me=_Buffer.from(Me)),!_Buffer.isBuffer(Me))throw new TypeError("Expected Buffer");if(Me.length===0)return"";for(var Be=0,$e=0,ke=0,Te=Me.length;ke!==Te&&Me[ke]===0;)ke++,Be++;for(var Ie=(Te-ke)*ye+1>>>0,Fe=new Uint8Array(Ie);ke!==Te;){for(var Le=Me[ke],He=0,ze=Ie-1;(Le!==0||He<$e)&&ze!==-1;ze--,He++)Le+=256*Fe[ze]>>>0,Fe[ze]=Le%le>>>0,Le=Le/le>>>0;if(Le!==0)throw new Error("Non-zero carry");$e=He,ke++}for(var Je=Ie-$e;Je!==Ie&&Fe[Je]===0;)Je++;for(var Xe=pe.repeat(Be);Je<Ie;++Je)Xe+=c.charAt(Fe[Je]);return Xe}function Ee(Me){if(typeof Me!="string")throw new TypeError("Expected String");if(Me.length===0)return _Buffer.alloc(0);for(var Be=0,$e=0,ke=0;Me[Be]===pe;)$e++,Be++;for(var Te=(Me.length-Be)*me+1>>>0,Ie=new Uint8Array(Te);Be<Me.length;){var Fe=Me.charCodeAt(Be);if(Fe>255)return;var Le=t[Fe];if(Le===255)return;for(var He=0,ze=Te-1;(Le!==0||He<ke)&&ze!==-1;ze--,He++)Le+=le*Ie[ze]>>>0,Ie[ze]=Le%256>>>0,Le=Le/256>>>0;if(Le!==0)throw new Error("Non-zero carry");ke=He,Be++}for(var Je=Te-ke;Je!==Te&&Ie[Je]===0;)Je++;var Xe=_Buffer.allocUnsafe($e+(Te-Je));Xe.fill(0,0,$e);for(var Ue=$e;Je!==Te;)Xe[Ue++]=Ie[Je++];return Xe}function Se(Me){var Be=Ee(Me);if(Be)return Be;throw new Error("Non-base"+le+" character")}return{encode:xe,decodeUnsafe:Ee,decode:Se}}var src$7=base$4;const e$1=getDefaultExportFromCjs$2(src$7);var basex=src$7,ALPHABET$1="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$2=basex(ALPHABET$1);const o$1=getDefaultExportFromCjs$2(bs58$2),sha256$4=sha256$5;var lib={};function inRange(c,t,n){return t<=c&&c<=n}function ToDictionary(c){if(c===void 0)return{};if(c===Object(c))return c;throw TypeError("Could not convert argument to dictionary")}function stringToCodePoints(c){for(var t=String(c),n=t.length,ie=0,fe=[];ie<n;){var ae=t.charCodeAt(ie);if(ae<55296||ae>57343)fe.push(ae);else if(56320<=ae&&ae<=57343)fe.push(65533);else if(55296<=ae&&ae<=56319)if(ie===n-1)fe.push(65533);else{var le=c.charCodeAt(ie+1);if(56320<=le&&le<=57343){var pe=ae&1023,me=le&1023;fe.push(65536+(pe<<10)+me),ie+=1}else fe.push(65533)}ie+=1}return fe}function codePointsToString(c){for(var t="",n=0;n<c.length;++n){var ie=c[n];ie<=65535?t+=String.fromCharCode(ie):(ie-=65536,t+=String.fromCharCode((ie>>10)+55296,(ie&1023)+56320))}return t}var end_of_stream=-1;function Stream(c){this.tokens=[].slice.call(c)}Stream.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():end_of_stream},prepend:function(c){if(Array.isArray(c))for(var t=c;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(c)},push:function(c){if(Array.isArray(c))for(var t=c;t.length;)this.tokens.push(t.shift());else this.tokens.push(c)}};var finished=-1;function decoderError(c,t){if(c)throw TypeError("Decoder error");return t||65533}var DEFAULT_ENCODING="utf-8";function TextDecoder$1(c,t){if(!(this instanceof TextDecoder$1))return new TextDecoder$1(c,t);if(c=c!==void 0?String(c).toLowerCase():DEFAULT_ENCODING,c!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");t=ToDictionary(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}TextDecoder$1.prototype={decode:function(t,n){var ie;typeof t=="object"&&t instanceof ArrayBuffer?ie=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?ie=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):ie=new Uint8Array(0),n=ToDictionary(n),this._streaming||(this._decoder=new UTF8Decoder({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!n.stream;for(var fe=new Stream(ie),ae=[],le;!fe.endOfStream()&&(le=this._decoder.handler(fe,fe.read()),le!==finished);)le!==null&&(Array.isArray(le)?ae.push.apply(ae,le):ae.push(le));if(!this._streaming){do{if(le=this._decoder.handler(fe,fe.read()),le===finished)break;le!==null&&(Array.isArray(le)?ae.push.apply(ae,le):ae.push(le))}while(!fe.endOfStream());this._decoder=null}return ae.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(ae[0]===65279?(this._BOMseen=!0,ae.shift()):this._BOMseen=!0),codePointsToString(ae)}};function TextEncoder$1(c,t){if(!(this instanceof TextEncoder$1))return new TextEncoder$1(c,t);if(c=c!==void 0?String(c).toLowerCase():DEFAULT_ENCODING,c!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");t=ToDictionary(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}TextEncoder$1.prototype={encode:function(t,n){t=t?String(t):"",n=ToDictionary(n),this._streaming||(this._encoder=new UTF8Encoder(this._options)),this._streaming=!!n.stream;for(var ie=[],fe=new Stream(stringToCodePoints(t)),ae;!fe.endOfStream()&&(ae=this._encoder.handler(fe,fe.read()),ae!==finished);)Array.isArray(ae)?ie.push.apply(ie,ae):ie.push(ae);if(!this._streaming){for(;ae=this._encoder.handler(fe,fe.read()),ae!==finished;)Array.isArray(ae)?ie.push.apply(ie,ae):ie.push(ae);this._encoder=null}return new Uint8Array(ie)}};function UTF8Decoder(c){var t=c.fatal,n=0,ie=0,fe=0,ae=128,le=191;this.handler=function(pe,me){if(me===end_of_stream&&fe!==0)return fe=0,decoderError(t);if(me===end_of_stream)return finished;if(fe===0){if(inRange(me,0,127))return me;if(inRange(me,194,223))fe=1,n=me-192;else if(inRange(me,224,239))me===224&&(ae=160),me===237&&(le=159),fe=2,n=me-224;else if(inRange(me,240,244))me===240&&(ae=144),me===244&&(le=143),fe=3,n=me-240;else return decoderError(t);return n=n<<6*fe,null}if(!inRange(me,ae,le))return n=fe=ie=0,ae=128,le=191,pe.prepend(me),decoderError(t);if(ae=128,le=191,ie+=1,n+=me-128<<6*(fe-ie),ie!==fe)return null;var ye=n;return n=fe=ie=0,ye}}function UTF8Encoder(c){c.fatal,this.handler=function(t,n){if(n===end_of_stream)return finished;if(inRange(n,0,127))return n;var ie,fe;inRange(n,128,2047)?(ie=1,fe=192):inRange(n,2048,65535)?(ie=2,fe=224):inRange(n,65536,1114111)&&(ie=3,fe=240);for(var ae=[(n>>6*ie)+fe];ie>0;){var le=n>>6*(ie-1);ae.push(128|le&63),ie-=1}return ae}}const encoding$1=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:TextDecoder$1,TextEncoder:TextEncoder$1},Symbol.toStringTag,{value:"Module"})),require$$2$2=getAugmentedNamespace(encoding$1);var __createBinding$b=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n),Object.defineProperty(c,ie,{enumerable:!0,get:function(){return t[n]}})}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$b=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__decorate=commonjsGlobal&&commonjsGlobal.__decorate||function(c,t,n,ie){var fe=arguments.length,ae=fe<3?t:ie===null?ie=Object.getOwnPropertyDescriptor(t,n):ie,le;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ae=Reflect.decorate(c,t,n,ie);else for(var pe=c.length-1;pe>=0;pe--)(le=c[pe])&&(ae=(fe<3?le(ae):fe>3?le(t,n,ae):le(t,n))||ae);return fe>3&&ae&&Object.defineProperty(t,n,ae),ae},__importStar$b=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.hasOwnProperty.call(c,n)&&__createBinding$b(t,c,n);return __setModuleDefault$b(t,c),t},__importDefault$a=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(lib,"__esModule",{value:!0});var deserializeUnchecked_1=lib.deserializeUnchecked=deserialize_1=lib.deserialize=serialize_1=lib.serialize=lib.BinaryReader=lib.BinaryWriter=lib.BorshError=lib.baseDecode=lib.baseEncode=void 0;const bn_js_1$1=__importDefault$a(bnExports$3),bs58_1$1=__importDefault$a(bs58$2),encoding=__importStar$b(require$$2$2),ResolvedTextDecoder=typeof TextDecoder!="function"?encoding.TextDecoder:TextDecoder,textDecoder=new ResolvedTextDecoder("utf-8",{fatal:!0});function baseEncode(c){return typeof c=="string"&&(c=Buffer$7.from(c,"utf8")),bs58_1$1.default.encode(Buffer$7.from(c))}lib.baseEncode=baseEncode;function baseDecode(c){return Buffer$7.from(bs58_1$1.default.decode(c))}lib.baseDecode=baseDecode;const INITIAL_LENGTH=1024;class BorshError extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}lib.BorshError=BorshError;class BinaryWriter{constructor(){this.buf=Buffer$7.alloc(INITIAL_LENGTH),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer$7.concat([this.buf,Buffer$7.alloc(INITIAL_LENGTH)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer$7.concat([Buffer$7.from(this.buf.subarray(0,this.length)),t,Buffer$7.alloc(INITIAL_LENGTH)]),this.length+=t.length}writeString(t){this.maybeResize();const n=Buffer$7.from(t,"utf8");this.writeU32(n.length),this.writeBuffer(n)}writeFixedArray(t){this.writeBuffer(Buffer$7.from(t))}writeArray(t,n){this.maybeResize(),this.writeU32(t.length);for(const ie of t)this.maybeResize(),n(ie)}toArray(){return this.buf.subarray(0,this.length)}}lib.BinaryWriter=BinaryWriter;function handlingRangeError(c,t,n){const ie=n.value;n.value=function(...fe){try{return ie.apply(this,fe)}catch(ae){if(ae instanceof RangeError){const le=ae.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(le)>=0)throw new BorshError("Reached the end of buffer when deserializing")}throw ae}}}class BinaryReader{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new bn_js_1$1.default(t,"le")}readU128(){const t=this.readBuffer(16);return new bn_js_1$1.default(t,"le")}readU256(){const t=this.readBuffer(32);return new bn_js_1$1.default(t,"le")}readU512(){const t=this.readBuffer(64);return new bn_js_1$1.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new BorshError(`Expected buffer length ${t} isn't within bounds`);const n=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,n}readString(){const t=this.readU32(),n=this.readBuffer(t);try{return textDecoder.decode(n)}catch(ie){throw new BorshError(`Error decoding UTF-8 string: ${ie}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const n=this.readU32(),ie=Array();for(let fe=0;fe<n;++fe)ie.push(t());return ie}}__decorate([handlingRangeError],BinaryReader.prototype,"readU8",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU16",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU32",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU64",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU128",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU256",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU512",null);__decorate([handlingRangeError],BinaryReader.prototype,"readString",null);__decorate([handlingRangeError],BinaryReader.prototype,"readFixedArray",null);__decorate([handlingRangeError],BinaryReader.prototype,"readArray",null);lib.BinaryReader=BinaryReader;function capitalizeFirstLetter(c){return c.charAt(0).toUpperCase()+c.slice(1)}function serializeField(c,t,n,ie,fe){try{if(typeof ie=="string")fe[`write${capitalizeFirstLetter(ie)}`](n);else if(ie instanceof Array)if(typeof ie[0]=="number"){if(n.length!==ie[0])throw new BorshError(`Expecting byte array of length ${ie[0]}, but got ${n.length} bytes`);fe.writeFixedArray(n)}else if(ie.length===2&&typeof ie[1]=="number"){if(n.length!==ie[1])throw new BorshError(`Expecting byte array of length ${ie[1]}, but got ${n.length} bytes`);for(let ae=0;ae<ie[1];ae++)serializeField(c,null,n[ae],ie[0],fe)}else fe.writeArray(n,ae=>{serializeField(c,t,ae,ie[0],fe)});else if(ie.kind!==void 0)switch(ie.kind){case"option":{n==null?fe.writeU8(0):(fe.writeU8(1),serializeField(c,t,n,ie.type,fe));break}case"map":{fe.writeU32(n.size),n.forEach((ae,le)=>{serializeField(c,t,le,ie.key,fe),serializeField(c,t,ae,ie.value,fe)});break}default:throw new BorshError(`FieldType ${ie} unrecognized`)}else serializeStruct(c,n,fe)}catch(ae){throw ae instanceof BorshError&&ae.addToFieldPath(t),ae}}function serializeStruct(c,t,n){if(typeof t.borshSerialize=="function"){t.borshSerialize(n);return}const ie=c.get(t.constructor);if(!ie)throw new BorshError(`Class ${t.constructor.name} is missing in schema`);if(ie.kind==="struct")ie.fields.map(([fe,ae])=>{serializeField(c,fe,t[fe],ae,n)});else if(ie.kind==="enum"){const fe=t[ie.field];for(let ae=0;ae<ie.values.length;++ae){const[le,pe]=ie.values[ae];if(le===fe){n.writeU8(ae),serializeField(c,le,t[le],pe,n);break}}}else throw new BorshError(`Unexpected schema kind: ${ie.kind} for ${t.constructor.name}`)}function serialize(c,t,n=BinaryWriter){const ie=new n;return serializeStruct(c,t,ie),ie.toArray()}var serialize_1=lib.serialize=serialize;function deserializeField(c,t,n,ie){try{if(typeof n=="string")return ie[`read${capitalizeFirstLetter(n)}`]();if(n instanceof Array){if(typeof n[0]=="number")return ie.readFixedArray(n[0]);if(typeof n[1]=="number"){const fe=[];for(let ae=0;ae<n[1];ae++)fe.push(deserializeField(c,null,n[0],ie));return fe}else return ie.readArray(()=>deserializeField(c,t,n[0],ie))}if(n.kind==="option")return ie.readU8()?deserializeField(c,t,n.type,ie):void 0;if(n.kind==="map"){let fe=new Map;const ae=ie.readU32();for(let le=0;le<ae;le++){const pe=deserializeField(c,t,n.key,ie),me=deserializeField(c,t,n.value,ie);fe.set(pe,me)}return fe}return deserializeStruct(c,n,ie)}catch(fe){throw fe instanceof BorshError&&fe.addToFieldPath(t),fe}}function deserializeStruct(c,t,n){if(typeof t.borshDeserialize=="function")return t.borshDeserialize(n);const ie=c.get(t);if(!ie)throw new BorshError(`Class ${t.name} is missing in schema`);if(ie.kind==="struct"){const fe={};for(const[ae,le]of c.get(t).fields)fe[ae]=deserializeField(c,ae,le,n);return new t(fe)}if(ie.kind==="enum"){const fe=n.readU8();if(fe>=ie.values.length)throw new BorshError(`Enum index: ${fe} is out of range`);const[ae,le]=ie.values[fe],pe=deserializeField(c,ae,le,n);return new t({[ae]:pe})}throw new BorshError(`Unexpected schema kind: ${ie.kind} for ${t.constructor.name}`)}function deserialize(c,t,n,ie=BinaryReader){const fe=new ie(n),ae=deserializeStruct(c,t,fe);if(fe.offset<n.length)throw new BorshError(`Unexpected ${n.length-fe.offset} bytes after deserialized data`);return ae}var deserialize_1=lib.deserialize=deserialize;function deserializeUnchecked(c,t,n,ie=BinaryReader){const fe=new ie(n);return deserializeStruct(c,t,fe)}deserializeUnchecked_1=lib.deserializeUnchecked=deserializeUnchecked;var Layout$1={};Object.defineProperty(Layout$1,"__esModule",{value:!0});Layout$1.s16=Layout$1.s8=Layout$1.nu64be=Layout$1.u48be=Layout$1.u40be=Layout$1.u32be=Layout$1.u24be=Layout$1.u16be=nu64=Layout$1.nu64=Layout$1.u48=Layout$1.u40=u32=Layout$1.u32=Layout$1.u24=u16=Layout$1.u16=u8=Layout$1.u8=offset=Layout$1.offset=Layout$1.greedy=Layout$1.Constant=Layout$1.UTF8=Layout$1.CString=Layout$1.Blob=Layout$1.Boolean=Layout$1.BitField=Layout$1.BitStructure=Layout$1.VariantLayout=Layout$1.Union=Layout$1.UnionLayoutDiscriminator=Layout$1.UnionDiscriminator=Layout$1.Structure=Layout$1.Sequence=Layout$1.DoubleBE=Layout$1.Double=Layout$1.FloatBE=Layout$1.Float=Layout$1.NearInt64BE=Layout$1.NearInt64=Layout$1.NearUInt64BE=Layout$1.NearUInt64=Layout$1.IntBE=Layout$1.Int=Layout$1.UIntBE=Layout$1.UInt=Layout$1.OffsetLayout=Layout$1.GreedyCount=Layout$1.ExternalLayout=Layout$1.bindConstructorLayout=Layout$1.nameWithProperty=Layout$1.Layout=Layout$1.uint8ArrayToBuffer=Layout$1.checkUint8Array=void 0;Layout$1.constant=Layout$1.utf8=Layout$1.cstr=blob=Layout$1.blob=Layout$1.unionLayoutDiscriminator=Layout$1.union=seq=Layout$1.seq=Layout$1.bits=struct=Layout$1.struct=Layout$1.f64be=Layout$1.f64=Layout$1.f32be=Layout$1.f32=Layout$1.ns64be=Layout$1.s48be=Layout$1.s40be=Layout$1.s32be=Layout$1.s24be=Layout$1.s16be=ns64=Layout$1.ns64=Layout$1.s48=Layout$1.s40=Layout$1.s32=Layout$1.s24=void 0;const buffer_1$2=dist$1;function checkUint8Array(c){if(!(c instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}Layout$1.checkUint8Array=checkUint8Array;function uint8ArrayToBuffer(c){return checkUint8Array(c),buffer_1$2.Buffer.from(c.buffer,c.byteOffset,c.length)}Layout$1.uint8ArrayToBuffer=uint8ArrayToBuffer;class Layout{constructor(t,n){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=n}makeDestinationObject(){return{}}getSpan(t,n){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const n=Object.create(this.constructor.prototype);return Object.assign(n,this),n.property=t,n}fromArray(t){}}Layout$1.Layout=Layout;function nameWithProperty(c,t){return t.property?c+"["+t.property+"]":c}Layout$1.nameWithProperty=nameWithProperty;function bindConstructorLayout(c,t){if(typeof c!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(c,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Layout))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");c.layout_=t,t.boundConstructor_=c,t.makeDestinationObject=()=>new c,Object.defineProperty(c.prototype,"encode",{value(n,ie){return t.encode(this,n,ie)},writable:!0}),Object.defineProperty(c,"decode",{value(n,ie){return t.decode(n,ie)},writable:!0})}Layout$1.bindConstructorLayout=bindConstructorLayout;class ExternalLayout extends Layout{isCount(){throw new Error("ExternalLayout is abstract")}}Layout$1.ExternalLayout=ExternalLayout;class GreedyCount extends ExternalLayout{constructor(t=1,n){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,n),this.elementSpan=t}isCount(){return!0}decode(t,n=0){checkUint8Array(t);const ie=t.length-n;return Math.floor(ie/this.elementSpan)}encode(t,n,ie){return 0}}Layout$1.GreedyCount=GreedyCount;class OffsetLayout extends ExternalLayout{constructor(t,n=0,ie){if(!(t instanceof Layout))throw new TypeError("layout must be a Layout");if(!Number.isInteger(n))throw new TypeError("offset must be integer or undefined");super(t.span,ie||t.property),this.layout=t,this.offset=n}isCount(){return this.layout instanceof UInt||this.layout instanceof UIntBE}decode(t,n=0){return this.layout.decode(t,n+this.offset)}encode(t,n,ie=0){return this.layout.encode(t,n,ie+this.offset)}}Layout$1.OffsetLayout=OffsetLayout;class UInt extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readUIntLE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeUIntLE(t,ie,this.span),this.span}}Layout$1.UInt=UInt;class UIntBE extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readUIntBE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeUIntBE(t,ie,this.span),this.span}}Layout$1.UIntBE=UIntBE;class Int extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readIntLE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeIntLE(t,ie,this.span),this.span}}Layout$1.Int=Int;class IntBE extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readIntBE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeIntBE(t,ie,this.span),this.span}}Layout$1.IntBE=IntBE;const V2E32=Math.pow(2,32);function divmodInt64(c){const t=Math.floor(c/V2E32),n=c-t*V2E32;return{hi32:t,lo32:n}}function roundedInt64(c,t){return c*V2E32+t}class NearUInt64 extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readUInt32LE(n),ae=ie.readUInt32LE(n+4);return roundedInt64(ae,fe)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeUInt32LE(fe.lo32,ie),ae.writeUInt32LE(fe.hi32,ie+4),8}}Layout$1.NearUInt64=NearUInt64;class NearUInt64BE extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readUInt32BE(n),ae=ie.readUInt32BE(n+4);return roundedInt64(fe,ae)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeUInt32BE(fe.hi32,ie),ae.writeUInt32BE(fe.lo32,ie+4),8}}Layout$1.NearUInt64BE=NearUInt64BE;class NearInt64 extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readUInt32LE(n),ae=ie.readInt32LE(n+4);return roundedInt64(ae,fe)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeUInt32LE(fe.lo32,ie),ae.writeInt32LE(fe.hi32,ie+4),8}}Layout$1.NearInt64=NearInt64;class NearInt64BE extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readInt32BE(n),ae=ie.readUInt32BE(n+4);return roundedInt64(fe,ae)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeInt32BE(fe.hi32,ie),ae.writeUInt32BE(fe.lo32,ie+4),8}}Layout$1.NearInt64BE=NearInt64BE;class Float extends Layout{constructor(t){super(4,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readFloatLE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeFloatLE(t,ie),4}}Layout$1.Float=Float;class FloatBE extends Layout{constructor(t){super(4,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readFloatBE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeFloatBE(t,ie),4}}Layout$1.FloatBE=FloatBE;class Double extends Layout{constructor(t){super(8,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readDoubleLE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeDoubleLE(t,ie),8}}Layout$1.Double=Double;class DoubleBE extends Layout{constructor(t){super(8,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readDoubleBE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeDoubleBE(t,ie),8}}Layout$1.DoubleBE=DoubleBE;class Sequence extends Layout{constructor(t,n,ie){if(!(t instanceof Layout))throw new TypeError("elementLayout must be a Layout");if(!(n instanceof ExternalLayout&&n.isCount()||Number.isInteger(n)&&0<=n))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let fe=-1;!(n instanceof ExternalLayout)&&0<t.span&&(fe=n*t.span),super(fe,ie),this.elementLayout=t,this.count=n}getSpan(t,n=0){if(0<=this.span)return this.span;let ie=0,fe=this.count;if(fe instanceof ExternalLayout&&(fe=fe.decode(t,n)),0<this.elementLayout.span)ie=fe*this.elementLayout.span;else{let ae=0;for(;ae<fe;)ie+=this.elementLayout.getSpan(t,n+ie),++ae}return ie}decode(t,n=0){const ie=[];let fe=0,ae=this.count;for(ae instanceof ExternalLayout&&(ae=ae.decode(t,n));fe<ae;)ie.push(this.elementLayout.decode(t,n)),n+=this.elementLayout.getSpan(t,n),fe+=1;return ie}encode(t,n,ie=0){const fe=this.elementLayout,ae=t.reduce((le,pe)=>le+fe.encode(pe,n,ie+le),0);return this.count instanceof ExternalLayout&&this.count.encode(t.length,n,ie),ae}}Layout$1.Sequence=Sequence;class Structure extends Layout{constructor(t,n,ie){if(!(Array.isArray(t)&&t.reduce((ae,le)=>ae&&le instanceof Layout,!0)))throw new TypeError("fields must be array of Layout instances");typeof n=="boolean"&&ie===void 0&&(ie=n,n=void 0);for(const ae of t)if(0>ae.span&&ae.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let fe=-1;try{fe=t.reduce((ae,le)=>ae+le.getSpan(),0)}catch{}super(fe,n),this.fields=t,this.decodePrefixes=!!ie}getSpan(t,n=0){if(0<=this.span)return this.span;let ie=0;try{ie=this.fields.reduce((fe,ae)=>{const le=ae.getSpan(t,n);return n+=le,fe+le},0)}catch{throw new RangeError("indeterminate span")}return ie}decode(t,n=0){checkUint8Array(t);const ie=this.makeDestinationObject();for(const fe of this.fields)if(fe.property!==void 0&&(ie[fe.property]=fe.decode(t,n)),n+=fe.getSpan(t,n),this.decodePrefixes&&t.length===n)break;return ie}encode(t,n,ie=0){const fe=ie;let ae=0,le=0;for(const pe of this.fields){let me=pe.span;if(le=0<me?me:0,pe.property!==void 0){const ye=t[pe.property];ye!==void 0&&(le=pe.encode(ye,n,ie),0>me&&(me=pe.getSpan(n,ie)))}ae=ie,ie+=me}return ae+le-fe}fromArray(t){const n=this.makeDestinationObject();for(const ie of this.fields)ie.property!==void 0&&0<t.length&&(n[ie.property]=t.shift());return n}layoutFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const n of this.fields)if(n.property===t)return n}offsetOf(t){if(typeof t!="string")throw new TypeError("property must be string");let n=0;for(const ie of this.fields){if(ie.property===t)return n;0>ie.span?n=-1:0<=n&&(n+=ie.span)}}}Layout$1.Structure=Structure;class UnionDiscriminator{constructor(t){this.property=t}decode(t,n){throw new Error("UnionDiscriminator is abstract")}encode(t,n,ie){throw new Error("UnionDiscriminator is abstract")}}Layout$1.UnionDiscriminator=UnionDiscriminator;class UnionLayoutDiscriminator extends UnionDiscriminator{constructor(t,n){if(!(t instanceof ExternalLayout&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(n||t.property||"variant"),this.layout=t}decode(t,n){return this.layout.decode(t,n)}encode(t,n,ie){return this.layout.encode(t,n,ie)}}Layout$1.UnionLayoutDiscriminator=UnionLayoutDiscriminator;class Union extends Layout{constructor(t,n,ie){let fe;if(t instanceof UInt||t instanceof UIntBE)fe=new UnionLayoutDiscriminator(new OffsetLayout(t));else if(t instanceof ExternalLayout&&t.isCount())fe=new UnionLayoutDiscriminator(t);else if(t instanceof UnionDiscriminator)fe=t;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(n===void 0&&(n=null),!(n===null||n instanceof Layout))throw new TypeError("defaultLayout must be null or a Layout");if(n!==null){if(0>n.span)throw new Error("defaultLayout must have constant span");n.property===void 0&&(n=n.replicate("content"))}let ae=-1;n&&(ae=n.span,0<=ae&&(t instanceof UInt||t instanceof UIntBE)&&(ae+=fe.layout.span)),super(ae,ie),this.discriminator=fe,this.usesPrefixDiscriminator=t instanceof UInt||t instanceof UIntBE,this.defaultLayout=n,this.registry={};let le=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(pe){return le(pe)},this.configGetSourceVariant=function(pe){le=pe.bind(this)}}getSpan(t,n=0){if(0<=this.span)return this.span;const ie=this.getVariant(t,n);if(!ie)throw new Error("unable to determine span for unrecognized variant");return ie.getSpan(t,n)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const n=this.registry[t[this.discriminator.property]];if(n&&(!n.layout||n.property&&Object.prototype.hasOwnProperty.call(t,n.property)))return n}else for(const n in this.registry){const ie=this.registry[n];if(ie.property&&Object.prototype.hasOwnProperty.call(t,ie.property))return ie}throw new Error("unable to infer src variant")}decode(t,n=0){let ie;const fe=this.discriminator,ae=fe.decode(t,n),le=this.registry[ae];if(le===void 0){const pe=this.defaultLayout;let me=0;this.usesPrefixDiscriminator&&(me=fe.layout.span),ie=this.makeDestinationObject(),ie[fe.property]=ae,ie[pe.property]=pe.decode(t,n+me)}else ie=le.decode(t,n);return ie}encode(t,n,ie=0){const fe=this.getSourceVariant(t);if(fe===void 0){const ae=this.discriminator,le=this.defaultLayout;let pe=0;return this.usesPrefixDiscriminator&&(pe=ae.layout.span),ae.encode(t[ae.property],n,ie),pe+le.encode(t[le.property],n,ie+pe)}return fe.encode(t,n,ie)}addVariant(t,n,ie){const fe=new VariantLayout(this,t,n,ie);return this.registry[t]=fe,fe}getVariant(t,n=0){let ie;return t instanceof Uint8Array?ie=this.discriminator.decode(t,n):ie=t,this.registry[ie]}}Layout$1.Union=Union;class VariantLayout extends Layout{constructor(t,n,ie,fe){if(!(t instanceof Union))throw new TypeError("union must be a Union");if(!Number.isInteger(n)||0>n)throw new TypeError("variant must be a (non-negative) integer");if(typeof ie=="string"&&fe===void 0&&(fe=ie,ie=null),ie){if(!(ie instanceof Layout))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=ie.span&&ie.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof fe!="string")throw new TypeError("variant must have a String property")}let ae=t.span;0>t.span&&(ae=ie?ie.span:0,0<=ae&&t.usesPrefixDiscriminator&&(ae+=t.discriminator.layout.span)),super(ae,fe),this.union=t,this.variant=n,this.layout=ie||null}getSpan(t,n=0){if(0<=this.span)return this.span;let ie=0;this.union.usesPrefixDiscriminator&&(ie=this.union.discriminator.layout.span);let fe=0;return this.layout&&(fe=this.layout.getSpan(t,n+ie)),ie+fe}decode(t,n=0){const ie=this.makeDestinationObject();if(this!==this.union.getVariant(t,n))throw new Error("variant mismatch");let fe=0;return this.union.usesPrefixDiscriminator&&(fe=this.union.discriminator.layout.span),this.layout?ie[this.property]=this.layout.decode(t,n+fe):this.property?ie[this.property]=!0:this.union.usesPrefixDiscriminator&&(ie[this.union.discriminator.property]=this.variant),ie}encode(t,n,ie=0){let fe=0;if(this.union.usesPrefixDiscriminator&&(fe=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,n,ie);let ae=fe;if(this.layout&&(this.layout.encode(t[this.property],n,ie+fe),ae+=this.layout.getSpan(n,ie+fe),0<=this.union.span&&ae>this.union.span))throw new Error("encoded variant overruns containing union");return ae}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}Layout$1.VariantLayout=VariantLayout;function fixBitwiseResult(c){return 0>c&&(c+=4294967296),c}class BitStructure extends Layout{constructor(t,n,ie){if(!(t instanceof UInt||t instanceof UIntBE))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof n=="string"&&ie===void 0&&(ie=n,n=!1),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,ie),this.word=t,this.msb=!!n,this.fields=[];let fe=0;this._packedSetValue=function(ae){return fe=fixBitwiseResult(ae),this},this._packedGetValue=function(){return fe}}decode(t,n=0){const ie=this.makeDestinationObject(),fe=this.word.decode(t,n);this._packedSetValue(fe);for(const ae of this.fields)ae.property!==void 0&&(ie[ae.property]=ae.decode(t));return ie}encode(t,n,ie=0){const fe=this.word.decode(n,ie);this._packedSetValue(fe);for(const ae of this.fields)if(ae.property!==void 0){const le=t[ae.property];le!==void 0&&ae.encode(le)}return this.word.encode(this._packedGetValue(),n,ie)}addField(t,n){const ie=new BitField(this,t,n);return this.fields.push(ie),ie}addBoolean(t){const n=new Boolean$1(this,t);return this.fields.push(n),n}fieldFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const n of this.fields)if(n.property===t)return n}}Layout$1.BitStructure=BitStructure;class BitField{constructor(t,n,ie){if(!(t instanceof BitStructure))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(n)||0>=n)throw new TypeError("bits must be positive integer");const fe=8*t.span,ae=t.fields.reduce((le,pe)=>le+pe.bits,0);if(n+ae>fe)throw new Error("bits too long for span remainder ("+(fe-ae)+" of "+fe+" remain)");this.container=t,this.bits=n,this.valueMask=(1<<n)-1,n===32&&(this.valueMask=4294967295),this.start=ae,this.container.msb&&(this.start=fe-ae-n),this.wordMask=fixBitwiseResult(this.valueMask<<this.start),this.property=ie}decode(t,n){const ie=this.container._packedGetValue();return fixBitwiseResult(ie&this.wordMask)>>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==fixBitwiseResult(t&this.valueMask))throw new TypeError(nameWithProperty("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const n=this.container._packedGetValue(),ie=fixBitwiseResult(t<<this.start);this.container._packedSetValue(fixBitwiseResult(n&~this.wordMask)|ie)}}Layout$1.BitField=BitField;let Boolean$1=class extends BitField{constructor(t,n){super(t,1,n)}decode(t,n){return!!super.decode(t,n)}encode(t){typeof t=="boolean"&&(t=+t),super.encode(t)}};Layout$1.Boolean=Boolean$1;let Blob$1=class extends Layout{constructor(t,n){if(!(t instanceof ExternalLayout&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let ie=-1;t instanceof ExternalLayout||(ie=t),super(ie,n),this.length=t}getSpan(t,n){let ie=this.span;return 0>ie&&(ie=this.length.decode(t,n)),ie}decode(t,n=0){let ie=this.span;return 0>ie&&(ie=this.length.decode(t,n)),uint8ArrayToBuffer(t).slice(n,n+ie)}encode(t,n,ie){let fe=this.length;if(this.length instanceof ExternalLayout&&(fe=t.length),!(t instanceof Uint8Array&&fe===t.length))throw new TypeError(nameWithProperty("Blob.encode",this)+" requires (length "+fe+") Uint8Array as src");if(ie+fe>n.length)throw new RangeError("encoding overruns Uint8Array");const ae=uint8ArrayToBuffer(t);return uint8ArrayToBuffer(n).write(ae.toString("hex"),ie,fe,"hex"),this.length instanceof ExternalLayout&&this.length.encode(fe,n,ie),fe}};Layout$1.Blob=Blob$1;class CString extends Layout{constructor(t){super(-1,t)}getSpan(t,n=0){checkUint8Array(t);let ie=n;for(;ie<t.length&&t[ie]!==0;)ie+=1;return 1+ie-n}decode(t,n=0){const ie=this.getSpan(t,n);return uint8ArrayToBuffer(t).slice(n,n+ie-1).toString("utf-8")}encode(t,n,ie=0){typeof t!="string"&&(t=String(t));const fe=buffer_1$2.Buffer.from(t,"utf8"),ae=fe.length;if(ie+ae>n.length)throw new RangeError("encoding overruns Buffer");const le=uint8ArrayToBuffer(n);return fe.copy(le,ie),le[ie+ae]=0,ae+1}}Layout$1.CString=CString;class UTF8 extends Layout{constructor(t,n){if(typeof t=="string"&&n===void 0&&(n=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,n),this.maxSpan=t}getSpan(t,n=0){return checkUint8Array(t),t.length-n}decode(t,n=0){const ie=this.getSpan(t,n);if(0<=this.maxSpan&&this.maxSpan<ie)throw new RangeError("text length exceeds maxSpan");return uint8ArrayToBuffer(t).slice(n,n+ie).toString("utf-8")}encode(t,n,ie=0){typeof t!="string"&&(t=String(t));const fe=buffer_1$2.Buffer.from(t,"utf8"),ae=fe.length;if(0<=this.maxSpan&&this.maxSpan<ae)throw new RangeError("text length exceeds maxSpan");if(ie+ae>n.length)throw new RangeError("encoding overruns Buffer");return fe.copy(uint8ArrayToBuffer(n),ie),ae}}Layout$1.UTF8=UTF8;class Constant extends Layout{constructor(t,n){super(0,n),this.value=t}decode(t,n){return this.value}encode(t,n,ie){return 0}}Layout$1.Constant=Constant;Layout$1.greedy=(c,t)=>new GreedyCount(c,t);var offset=Layout$1.offset=(c,t,n)=>new OffsetLayout(c,t,n),u8=Layout$1.u8=c=>new UInt(1,c),u16=Layout$1.u16=c=>new UInt(2,c);Layout$1.u24=c=>new UInt(3,c);var u32=Layout$1.u32=c=>new UInt(4,c);Layout$1.u40=c=>new UInt(5,c);Layout$1.u48=c=>new UInt(6,c);var nu64=Layout$1.nu64=c=>new NearUInt64(c);Layout$1.u16be=c=>new UIntBE(2,c);Layout$1.u24be=c=>new UIntBE(3,c);Layout$1.u32be=c=>new UIntBE(4,c);Layout$1.u40be=c=>new UIntBE(5,c);Layout$1.u48be=c=>new UIntBE(6,c);Layout$1.nu64be=c=>new NearUInt64BE(c);Layout$1.s8=c=>new Int(1,c);Layout$1.s16=c=>new Int(2,c);Layout$1.s24=c=>new Int(3,c);Layout$1.s32=c=>new Int(4,c);Layout$1.s40=c=>new Int(5,c);Layout$1.s48=c=>new Int(6,c);var ns64=Layout$1.ns64=c=>new NearInt64(c);Layout$1.s16be=c=>new IntBE(2,c);Layout$1.s24be=c=>new IntBE(3,c);Layout$1.s32be=c=>new IntBE(4,c);Layout$1.s40be=c=>new IntBE(5,c);Layout$1.s48be=c=>new IntBE(6,c);Layout$1.ns64be=c=>new NearInt64BE(c);Layout$1.f32=c=>new Float(c);Layout$1.f32be=c=>new FloatBE(c);Layout$1.f64=c=>new Double(c);Layout$1.f64be=c=>new DoubleBE(c);var struct=Layout$1.struct=(c,t,n)=>new Structure(c,t,n);Layout$1.bits=(c,t,n)=>new BitStructure(c,t,n);var seq=Layout$1.seq=(c,t,n)=>new Sequence(c,t,n);Layout$1.union=(c,t,n)=>new Union(c,t,n);Layout$1.unionLayoutDiscriminator=(c,t)=>new UnionLayoutDiscriminator(c,t);var blob=Layout$1.blob=(c,t)=>new Blob$1(c,t);Layout$1.cstr=c=>new CString(c);Layout$1.utf8=(c,t)=>new UTF8(c,t);Layout$1.constant=(c,t)=>new Constant(c,t);var browser$d={};Object.defineProperty(browser$d,"__esModule",{value:!0});function toBigIntLE(c){{const t=Buffer$7.from(c);t.reverse();const n=t.toString("hex");return n.length===0?BigInt(0):BigInt(`0x${n}`)}}var toBigIntLE_1=browser$d.toBigIntLE=toBigIntLE;function toBigIntBE(c){{const t=c.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}}browser$d.toBigIntBE=toBigIntBE;function toBufferLE(c,t){{const n=c.toString(16),ie=Buffer$7.from(n.padStart(t*2,"0").slice(0,t*2),"hex");return ie.reverse(),ie}}var toBufferLE_1=browser$d.toBufferLE=toBufferLE;function toBufferBE(c,t){{const n=c.toString(16);return Buffer$7.from(n.padStart(t*2,"0").slice(0,t*2),"hex")}}browser$d.toBufferBE=toBufferBE;class StructError extends TypeError{constructor(t,n){let ie;const{message:fe,explanation:ae,...le}=t,{path:pe}=t,me=pe.length===0?fe:`At path: ${pe.join(".")} -- ${fe}`;super(ae??me),ae!=null&&(this.cause=me),Object.assign(this,le),this.name=this.constructor.name,this.failures=()=>ie??(ie=[t,...n()])}}function isIterable(c){return isObject$1(c)&&typeof c[Symbol.iterator]=="function"}function isObject$1(c){return typeof c=="object"&&c!=null}function isNonArrayObject(c){return isObject$1(c)&&!Array.isArray(c)}function print$2(c){return typeof c=="symbol"?c.toString():typeof c=="string"?JSON.stringify(c):`${c}`}function shiftIterator(c){const{done:t,value:n}=c.next();return t?void 0:n}function toFailure(c,t,n,ie){if(c===!0)return;c===!1?c={}:typeof c=="string"&&(c={message:c});const{path:fe,branch:ae}=t,{type:le}=n,{refinement:pe,message:me=`Expected a value of type \`${le}\`${pe?` with refinement \`${pe}\``:""}, but received: \`${print$2(ie)}\``}=c;return{value:ie,type:le,refinement:pe,key:fe[fe.length-1],path:fe,branch:ae,...c,message:me}}function*toFailures(c,t,n,ie){isIterable(c)||(c=[c]);for(const fe of c){const ae=toFailure(fe,t,n,ie);ae&&(yield ae)}}function*run(c,t,n={}){const{path:ie=[],branch:fe=[c],coerce:ae=!1,mask:le=!1}=n,pe={path:ie,branch:fe,mask:le};ae&&(c=t.coercer(c,pe));let me="valid";for(const ye of t.validator(c,pe))ye.explanation=n.message,me="not_valid",yield[ye,void 0];for(let[ye,xe,Ee]of t.entries(c,pe)){const Se=run(xe,Ee,{path:ye===void 0?ie:[...ie,ye],branch:ye===void 0?fe:[...fe,xe],coerce:ae,mask:le,message:n.message});for(const Me of Se)Me[0]?(me=Me[0].refinement!=null?"not_refined":"not_valid",yield[Me[0],void 0]):ae&&(xe=Me[1],ye===void 0?c=xe:c instanceof Map?c.set(ye,xe):c instanceof Set?c.add(xe):isObject$1(c)&&(xe!==void 0||ye in c)&&(c[ye]=xe))}if(me!=="not_valid")for(const ye of t.refiner(c,pe))ye.explanation=n.message,me="not_refined",yield[ye,void 0];me==="valid"&&(yield[void 0,c])}let Struct$1=class{constructor(t){const{type:n,schema:ie,validator:fe,refiner:ae,coercer:le=me=>me,entries:pe=function*(){}}=t;this.type=n,this.schema=ie,this.entries=pe,this.coercer=le,fe?this.validator=(me,ye)=>{const xe=fe(me,ye);return toFailures(xe,ye,this,me)}:this.validator=()=>[],ae?this.refiner=(me,ye)=>{const xe=ae(me,ye);return toFailures(xe,ye,this,me)}:this.refiner=()=>[]}assert(t,n){return assert$a(t,this,n)}create(t,n){return create(t,this,n)}is(t){return is(t,this)}mask(t,n){return mask(t,this,n)}validate(t,n={}){return validate$1(t,this,n)}};function assert$a(c,t,n){const ie=validate$1(c,t,{message:n});if(ie[0])throw ie[0]}function create(c,t,n){const ie=validate$1(c,t,{coerce:!0,message:n});if(ie[0])throw ie[0];return ie[1]}function mask(c,t,n){const ie=validate$1(c,t,{coerce:!0,mask:!0,message:n});if(ie[0])throw ie[0];return ie[1]}function is(c,t){return!validate$1(c,t)[0]}function validate$1(c,t,n={}){const ie=run(c,t,n),fe=shiftIterator(ie);return fe[0]?[new StructError(fe[0],function*(){for(const le of ie)le[0]&&(yield le[0])}),void 0]:[void 0,fe[1]]}function define(c,t){return new Struct$1({type:c,schema:null,validator:t})}function any(){return define("any",()=>!0)}function array(c){return new Struct$1({type:"array",schema:c,*entries(t){if(c&&Array.isArray(t))for(const[n,ie]of t.entries())yield[n,ie,c]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${print$2(t)}`}})}function boolean(){return define("boolean",c=>typeof c=="boolean")}function instance(c){return define("instance",t=>t instanceof c||`Expected a \`${c.name}\` instance, but received: ${print$2(t)}`)}function literal(c){const t=print$2(c),n=typeof c;return new Struct$1({type:"literal",schema:n==="string"||n==="number"||n==="boolean"?c:null,validator(ie){return ie===c||`Expected the literal \`${t}\`, but received: ${print$2(ie)}`}})}function never(){return define("never",()=>!1)}function nullable(c){return new Struct$1({...c,validator:(t,n)=>t===null||c.validator(t,n),refiner:(t,n)=>t===null||c.refiner(t,n)})}function number(){return define("number",c=>typeof c=="number"&&!isNaN(c)||`Expected a number, but received: ${print$2(c)}`)}function optional(c){return new Struct$1({...c,validator:(t,n)=>t===void 0||c.validator(t,n),refiner:(t,n)=>t===void 0||c.refiner(t,n)})}function record(c,t){return new Struct$1({type:"record",schema:null,*entries(n){if(isObject$1(n))for(const ie in n){const fe=n[ie];yield[ie,ie,c],yield[ie,fe,t]}},validator(n){return isNonArrayObject(n)||`Expected an object, but received: ${print$2(n)}`},coercer(n){return isNonArrayObject(n)?{...n}:n}})}function string(){return define("string",c=>typeof c=="string"||`Expected a string, but received: ${print$2(c)}`)}function tuple(c){const t=never();return new Struct$1({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const ie=Math.max(c.length,n.length);for(let fe=0;fe<ie;fe++)yield[fe,n[fe],c[fe]||t]}},validator(n){return Array.isArray(n)||`Expected an array, but received: ${print$2(n)}`},coercer(n){return Array.isArray(n)?n.slice():n}})}function type$1(c){const t=Object.keys(c);return new Struct$1({type:"type",schema:c,*entries(n){if(isObject$1(n))for(const ie of t)yield[ie,n[ie],c[ie]]},validator(n){return isNonArrayObject(n)||`Expected an object, but received: ${print$2(n)}`},coercer(n){return isNonArrayObject(n)?{...n}:n}})}function union(c){const t=c.map(n=>n.type).join(" | ");return new Struct$1({type:"union",schema:null,coercer(n,ie){for(const fe of c){const[ae,le]=fe.validate(n,{coerce:!0,mask:ie.mask});if(!ae)return le}return n},validator(n,ie){const fe=[];for(const ae of c){const[...le]=run(n,ae,ie),[pe]=le;if(pe[0])for(const[me]of le)me&&fe.push(me);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${print$2(n)}`,...fe]}})}function unknown(){return define("unknown",()=>!0)}function coerce(c,t,n){return new Struct$1({...c,coercer:(ie,fe)=>is(ie,t)?c.coercer(n(ie,fe),fe):c.coercer(ie,fe)})}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const REGEX$1=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate(c){return typeof c=="string"&&REGEX$1.test(c)}var byteToHex=[];for(var i$3=0;i$3<256;++i$3)byteToHex.push((i$3+256).toString(16).substr(1));function stringify(c){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(byteToHex[c[t+0]]+byteToHex[c[t+1]]+byteToHex[c[t+2]]+byteToHex[c[t+3]]+"-"+byteToHex[c[t+4]]+byteToHex[c[t+5]]+"-"+byteToHex[c[t+6]]+byteToHex[c[t+7]]+"-"+byteToHex[c[t+8]]+byteToHex[c[t+9]]+"-"+byteToHex[c[t+10]]+byteToHex[c[t+11]]+byteToHex[c[t+12]]+byteToHex[c[t+13]]+byteToHex[c[t+14]]+byteToHex[c[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}var _nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1(c,t,n){var ie=t&&n||0,fe=t||new Array(16);c=c||{};var ae=c.node||_nodeId,le=c.clockseq!==void 0?c.clockseq:_clockseq;if(ae==null||le==null){var pe=c.random||(c.rng||rng)();ae==null&&(ae=_nodeId=[pe[0]|1,pe[1],pe[2],pe[3],pe[4],pe[5]]),le==null&&(le=_clockseq=(pe[6]<<8|pe[7])&16383)}var me=c.msecs!==void 0?c.msecs:Date.now(),ye=c.nsecs!==void 0?c.nsecs:_lastNSecs+1,xe=me-_lastMSecs+(ye-_lastNSecs)/1e4;if(xe<0&&c.clockseq===void 0&&(le=le+1&16383),(xe<0||me>_lastMSecs)&&c.nsecs===void 0&&(ye=0),ye>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=me,_lastNSecs=ye,_clockseq=le,me+=122192928e5;var Ee=((me&268435455)*1e4+ye)%4294967296;fe[ie++]=Ee>>>24&255,fe[ie++]=Ee>>>16&255,fe[ie++]=Ee>>>8&255,fe[ie++]=Ee&255;var Se=me/4294967296*1e4&268435455;fe[ie++]=Se>>>8&255,fe[ie++]=Se&255,fe[ie++]=Se>>>24&15|16,fe[ie++]=Se>>>16&255,fe[ie++]=le>>>8|128,fe[ie++]=le&255;for(var Me=0;Me<6;++Me)fe[ie+Me]=ae[Me];return t||stringify(fe)}function parse$1(c){if(!validate(c))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(c.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=t&255,n[4]=(t=parseInt(c.slice(9,13),16))>>>8,n[5]=t&255,n[6]=(t=parseInt(c.slice(14,18),16))>>>8,n[7]=t&255,n[8]=(t=parseInt(c.slice(19,23),16))>>>8,n[9]=t&255,n[10]=(t=parseInt(c.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=t&255,n}function stringToBytes(c){c=unescape(encodeURIComponent(c));for(var t=[],n=0;n<c.length;++n)t.push(c.charCodeAt(n));return t}var DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",URL$1="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function v35(c,t,n){function ie(fe,ae,le,pe){if(typeof fe=="string"&&(fe=stringToBytes(fe)),typeof ae=="string"&&(ae=parse$1(ae)),ae.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var me=new Uint8Array(16+fe.length);if(me.set(ae),me.set(fe,ae.length),me=n(me),me[6]=me[6]&15|t,me[8]=me[8]&63|128,le){pe=pe||0;for(var ye=0;ye<16;++ye)le[pe+ye]=me[ye];return le}return stringify(me)}try{ie.name=c}catch{}return ie.DNS=DNS,ie.URL=URL$1,ie}function md5$3(c){if(typeof c=="string"){var t=unescape(encodeURIComponent(c));c=new Uint8Array(t.length);for(var n=0;n<t.length;++n)c[n]=t.charCodeAt(n)}return md5ToHexEncodedArray(wordsToMd5(bytesToWords(c),c.length*8))}function md5ToHexEncodedArray(c){for(var t=[],n=c.length*32,ie="0123456789abcdef",fe=0;fe<n;fe+=8){var ae=c[fe>>5]>>>fe%32&255,le=parseInt(ie.charAt(ae>>>4&15)+ie.charAt(ae&15),16);t.push(le)}return t}function getOutputLength(c){return(c+64>>>9<<4)+14+1}function wordsToMd5(c,t){c[t>>5]|=128<<t%32,c[getOutputLength(t)-1]=t;for(var n=1732584193,ie=-271733879,fe=-1732584194,ae=271733878,le=0;le<c.length;le+=16){var pe=n,me=ie,ye=fe,xe=ae;n=md5ff(n,ie,fe,ae,c[le],7,-680876936),ae=md5ff(ae,n,ie,fe,c[le+1],12,-389564586),fe=md5ff(fe,ae,n,ie,c[le+2],17,606105819),ie=md5ff(ie,fe,ae,n,c[le+3],22,-1044525330),n=md5ff(n,ie,fe,ae,c[le+4],7,-176418897),ae=md5ff(ae,n,ie,fe,c[le+5],12,1200080426),fe=md5ff(fe,ae,n,ie,c[le+6],17,-1473231341),ie=md5ff(ie,fe,ae,n,c[le+7],22,-45705983),n=md5ff(n,ie,fe,ae,c[le+8],7,1770035416),ae=md5ff(ae,n,ie,fe,c[le+9],12,-1958414417),fe=md5ff(fe,ae,n,ie,c[le+10],17,-42063),ie=md5ff(ie,fe,ae,n,c[le+11],22,-1990404162),n=md5ff(n,ie,fe,ae,c[le+12],7,1804603682),ae=md5ff(ae,n,ie,fe,c[le+13],12,-40341101),fe=md5ff(fe,ae,n,ie,c[le+14],17,-1502002290),ie=md5ff(ie,fe,ae,n,c[le+15],22,1236535329),n=md5gg(n,ie,fe,ae,c[le+1],5,-165796510),ae=md5gg(ae,n,ie,fe,c[le+6],9,-1069501632),fe=md5gg(fe,ae,n,ie,c[le+11],14,643717713),ie=md5gg(ie,fe,ae,n,c[le],20,-373897302),n=md5gg(n,ie,fe,ae,c[le+5],5,-701558691),ae=md5gg(ae,n,ie,fe,c[le+10],9,38016083),fe=md5gg(fe,ae,n,ie,c[le+15],14,-660478335),ie=md5gg(ie,fe,ae,n,c[le+4],20,-405537848),n=md5gg(n,ie,fe,ae,c[le+9],5,568446438),ae=md5gg(ae,n,ie,fe,c[le+14],9,-1019803690),fe=md5gg(fe,ae,n,ie,c[le+3],14,-187363961),ie=md5gg(ie,fe,ae,n,c[le+8],20,1163531501),n=md5gg(n,ie,fe,ae,c[le+13],5,-1444681467),ae=md5gg(ae,n,ie,fe,c[le+2],9,-51403784),fe=md5gg(fe,ae,n,ie,c[le+7],14,1735328473),ie=md5gg(ie,fe,ae,n,c[le+12],20,-1926607734),n=md5hh(n,ie,fe,ae,c[le+5],4,-378558),ae=md5hh(ae,n,ie,fe,c[le+8],11,-2022574463),fe=md5hh(fe,ae,n,ie,c[le+11],16,1839030562),ie=md5hh(ie,fe,ae,n,c[le+14],23,-35309556),n=md5hh(n,ie,fe,ae,c[le+1],4,-1530992060),ae=md5hh(ae,n,ie,fe,c[le+4],11,1272893353),fe=md5hh(fe,ae,n,ie,c[le+7],16,-155497632),ie=md5hh(ie,fe,ae,n,c[le+10],23,-1094730640),n=md5hh(n,ie,fe,ae,c[le+13],4,681279174),ae=md5hh(ae,n,ie,fe,c[le],11,-358537222),fe=md5hh(fe,ae,n,ie,c[le+3],16,-722521979),ie=md5hh(ie,fe,ae,n,c[le+6],23,76029189),n=md5hh(n,ie,fe,ae,c[le+9],4,-640364487),ae=md5hh(ae,n,ie,fe,c[le+12],11,-421815835),fe=md5hh(fe,ae,n,ie,c[le+15],16,530742520),ie=md5hh(ie,fe,ae,n,c[le+2],23,-995338651),n=md5ii(n,ie,fe,ae,c[le],6,-198630844),ae=md5ii(ae,n,ie,fe,c[le+7],10,1126891415),fe=md5ii(fe,ae,n,ie,c[le+14],15,-1416354905),ie=md5ii(ie,fe,ae,n,c[le+5],21,-57434055),n=md5ii(n,ie,fe,ae,c[le+12],6,1700485571),ae=md5ii(ae,n,ie,fe,c[le+3],10,-1894986606),fe=md5ii(fe,ae,n,ie,c[le+10],15,-1051523),ie=md5ii(ie,fe,ae,n,c[le+1],21,-2054922799),n=md5ii(n,ie,fe,ae,c[le+8],6,1873313359),ae=md5ii(ae,n,ie,fe,c[le+15],10,-30611744),fe=md5ii(fe,ae,n,ie,c[le+6],15,-1560198380),ie=md5ii(ie,fe,ae,n,c[le+13],21,1309151649),n=md5ii(n,ie,fe,ae,c[le+4],6,-145523070),ae=md5ii(ae,n,ie,fe,c[le+11],10,-1120210379),fe=md5ii(fe,ae,n,ie,c[le+2],15,718787259),ie=md5ii(ie,fe,ae,n,c[le+9],21,-343485551),n=safeAdd(n,pe),ie=safeAdd(ie,me),fe=safeAdd(fe,ye),ae=safeAdd(ae,xe)}return[n,ie,fe,ae]}function bytesToWords(c){if(c.length===0)return[];for(var t=c.length*8,n=new Uint32Array(getOutputLength(t)),ie=0;ie<t;ie+=8)n[ie>>5]|=(c[ie/8]&255)<<ie%32;return n}function safeAdd(c,t){var n=(c&65535)+(t&65535),ie=(c>>16)+(t>>16)+(n>>16);return ie<<16|n&65535}function bitRotateLeft(c,t){return c<<t|c>>>32-t}function md5cmn(c,t,n,ie,fe,ae){return safeAdd(bitRotateLeft(safeAdd(safeAdd(t,c),safeAdd(ie,ae)),fe),n)}function md5ff(c,t,n,ie,fe,ae,le){return md5cmn(t&n|~t&ie,c,t,fe,ae,le)}function md5gg(c,t,n,ie,fe,ae,le){return md5cmn(t&ie|n&~ie,c,t,fe,ae,le)}function md5hh(c,t,n,ie,fe,ae,le){return md5cmn(t^n^ie,c,t,fe,ae,le)}function md5ii(c,t,n,ie,fe,ae,le){return md5cmn(n^(t|~ie),c,t,fe,ae,le)}var v3=v35("v3",48,md5$3);function v4(c,t,n){c=c||{};var ie=c.random||(c.rng||rng)();if(ie[6]=ie[6]&15|64,ie[8]=ie[8]&63|128,t){n=n||0;for(var fe=0;fe<16;++fe)t[n+fe]=ie[fe];return t}return stringify(ie)}function f$1(c,t,n,ie){switch(c){case 0:return t&n^~t&ie;case 1:return t^n^ie;case 2:return t&n^t&ie^n&ie;case 3:return t^n^ie}}function ROTL(c,t){return c<<t|c>>>32-t}function sha1$3(c){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof c=="string"){var ie=unescape(encodeURIComponent(c));c=[];for(var fe=0;fe<ie.length;++fe)c.push(ie.charCodeAt(fe))}else Array.isArray(c)||(c=Array.prototype.slice.call(c));c.push(128);for(var ae=c.length/4+2,le=Math.ceil(ae/16),pe=new Array(le),me=0;me<le;++me){for(var ye=new Uint32Array(16),xe=0;xe<16;++xe)ye[xe]=c[me*64+xe*4]<<24|c[me*64+xe*4+1]<<16|c[me*64+xe*4+2]<<8|c[me*64+xe*4+3];pe[me]=ye}pe[le-1][14]=(c.length-1)*8/Math.pow(2,32),pe[le-1][14]=Math.floor(pe[le-1][14]),pe[le-1][15]=(c.length-1)*8&4294967295;for(var Ee=0;Ee<le;++Ee){for(var Se=new Uint32Array(80),Me=0;Me<16;++Me)Se[Me]=pe[Ee][Me];for(var Be=16;Be<80;++Be)Se[Be]=ROTL(Se[Be-3]^Se[Be-8]^Se[Be-14]^Se[Be-16],1);for(var $e=n[0],ke=n[1],Te=n[2],Ie=n[3],Fe=n[4],Le=0;Le<80;++Le){var He=Math.floor(Le/20),ze=ROTL($e,5)+f$1(He,ke,Te,Ie)+Fe+t[He]+Se[Le]>>>0;Fe=Ie,Ie=Te,Te=ROTL(ke,30)>>>0,ke=$e,$e=ze}n[0]=n[0]+$e>>>0,n[1]=n[1]+ke>>>0,n[2]=n[2]+Te>>>0,n[3]=n[3]+Ie>>>0,n[4]=n[4]+Fe>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var v5=v35("v5",80,sha1$3);const nil="00000000-0000-0000-0000-000000000000";function version$5(c){if(!validate(c))throw TypeError("Invalid UUID");return parseInt(c.substr(14,1),16)}const esmBrowser=Object.freeze(Object.defineProperty({__proto__:null,NIL:nil,parse:parse$1,stringify,v1,v3,v4,v5,validate,version:version$5},Symbol.toStringTag,{value:"Module"})),require$$0$2=getAugmentedNamespace(esmBrowser),uuid$1=require$$0$2.v4,generateRequest$1=function(c,t,n,ie){if(typeof c!="string")throw new TypeError(c+" must be a string");ie=ie||{};const fe=typeof ie.version=="number"?ie.version:2;if(fe!==1&&fe!==2)throw new TypeError(fe+" must be 1 or 2");const ae={method:c};if(fe===2&&(ae.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");ae.params=t}if(typeof n>"u"){const le=typeof ie.generator=="function"?ie.generator:function(){return uuid$1()};ae.id=le(ae,ie)}else fe===2&&n===null?ie.notificationIdNull&&(ae.id=null):ae.id=n;return ae};var generateRequest_1=generateRequest$1;const uuid=require$$0$2.v4,generateRequest=generateRequest_1,ClientBrowser=function(c,t){if(!(this instanceof ClientBrowser))return new ClientBrowser(c,t);t||(t={}),this.options={reviver:typeof t.reviver<"u"?t.reviver:null,replacer:typeof t.replacer<"u"?t.replacer:null,generator:typeof t.generator<"u"?t.generator:function(){return uuid()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=c};var browser$c=ClientBrowser;ClientBrowser.prototype.request=function(c,t,n,ie){const fe=this;let ae=null;const le=Array.isArray(c)&&typeof t=="function";if(this.options.version===1&&le)throw new TypeError("JSON-RPC 1.0 does not support batching");if(le||!le&&c&&typeof c=="object"&&typeof t=="function")ie=t,ae=c;else{typeof n=="function"&&(ie=n,n=void 0);const ye=typeof ie=="function";try{ae=generateRequest(c,t,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(xe){if(ye)return ie(xe);throw xe}if(!ye)return ae}let me;try{me=JSON.stringify(ae,this.options.replacer)}catch(ye){return ie(ye)}return this.callServer(me,function(ye,xe){fe._parseResponse(ye,xe,ie)}),ae};ClientBrowser.prototype._parseResponse=function(c,t,n){if(c){n(c);return}if(!t)return n();let ie;try{ie=JSON.parse(t,this.options.reviver)}catch(fe){return n(fe)}if(n.length===3)if(Array.isArray(ie)){const fe=function(le){return typeof le.error<"u"},ae=function(le){return!fe(le)};return n(null,ie.filter(fe),ie.filter(ae))}else return n(null,ie.error,ie.result);n(null,ie)};const RpcClient=getDefaultExportFromCjs$2(browser$c);var eventemitter3={exports:{}};(function(c){var t=Object.prototype.hasOwnProperty,n="~";function ie(){}Object.create&&(ie.prototype=Object.create(null),new ie().__proto__||(n=!1));function fe(me,ye,xe){this.fn=me,this.context=ye,this.once=xe||!1}function ae(me,ye,xe,Ee,Se){if(typeof xe!="function")throw new TypeError("The listener must be a function");var Me=new fe(xe,Ee||me,Se),Be=n?n+ye:ye;return me._events[Be]?me._events[Be].fn?me._events[Be]=[me._events[Be],Me]:me._events[Be].push(Me):(me._events[Be]=Me,me._eventsCount++),me}function le(me,ye){--me._eventsCount===0?me._events=new ie:delete me._events[ye]}function pe(){this._events=new ie,this._eventsCount=0}pe.prototype.eventNames=function(){var ye=[],xe,Ee;if(this._eventsCount===0)return ye;for(Ee in xe=this._events)t.call(xe,Ee)&&ye.push(n?Ee.slice(1):Ee);return Object.getOwnPropertySymbols?ye.concat(Object.getOwnPropertySymbols(xe)):ye},pe.prototype.listeners=function(ye){var xe=n?n+ye:ye,Ee=this._events[xe];if(!Ee)return[];if(Ee.fn)return[Ee.fn];for(var Se=0,Me=Ee.length,Be=new Array(Me);Se<Me;Se++)Be[Se]=Ee[Se].fn;return Be},pe.prototype.listenerCount=function(ye){var xe=n?n+ye:ye,Ee=this._events[xe];return Ee?Ee.fn?1:Ee.length:0},pe.prototype.emit=function(ye,xe,Ee,Se,Me,Be){var $e=n?n+ye:ye;if(!this._events[$e])return!1;var ke=this._events[$e],Te=arguments.length,Ie,Fe;if(ke.fn){switch(ke.once&&this.removeListener(ye,ke.fn,void 0,!0),Te){case 1:return ke.fn.call(ke.context),!0;case 2:return ke.fn.call(ke.context,xe),!0;case 3:return ke.fn.call(ke.context,xe,Ee),!0;case 4:return ke.fn.call(ke.context,xe,Ee,Se),!0;case 5:return ke.fn.call(ke.context,xe,Ee,Se,Me),!0;case 6:return ke.fn.call(ke.context,xe,Ee,Se,Me,Be),!0}for(Fe=1,Ie=new Array(Te-1);Fe<Te;Fe++)Ie[Fe-1]=arguments[Fe];ke.fn.apply(ke.context,Ie)}else{var Le=ke.length,He;for(Fe=0;Fe<Le;Fe++)switch(ke[Fe].once&&this.removeListener(ye,ke[Fe].fn,void 0,!0),Te){case 1:ke[Fe].fn.call(ke[Fe].context);break;case 2:ke[Fe].fn.call(ke[Fe].context,xe);break;case 3:ke[Fe].fn.call(ke[Fe].context,xe,Ee);break;case 4:ke[Fe].fn.call(ke[Fe].context,xe,Ee,Se);break;default:if(!Ie)for(He=1,Ie=new Array(Te-1);He<Te;He++)Ie[He-1]=arguments[He];ke[Fe].fn.apply(ke[Fe].context,Ie)}}return!0},pe.prototype.on=function(ye,xe,Ee){return ae(this,ye,xe,Ee,!1)},pe.prototype.once=function(ye,xe,Ee){return ae(this,ye,xe,Ee,!0)},pe.prototype.removeListener=function(ye,xe,Ee,Se){var Me=n?n+ye:ye;if(!this._events[Me])return this;if(!xe)return le(this,Me),this;var Be=this._events[Me];if(Be.fn)Be.fn===xe&&(!Se||Be.once)&&(!Ee||Be.context===Ee)&&le(this,Me);else{for(var $e=0,ke=[],Te=Be.length;$e<Te;$e++)(Be[$e].fn!==xe||Se&&!Be[$e].once||Ee&&Be[$e].context!==Ee)&&ke.push(Be[$e]);ke.length?this._events[Me]=ke.length===1?ke[0]:ke:le(this,Me)}return this},pe.prototype.removeAllListeners=function(ye){var xe;return ye?(xe=n?n+ye:ye,this._events[xe]&&le(this,xe)):(this._events=new ie,this._eventsCount=0),this},pe.prototype.off=pe.prototype.removeListener,pe.prototype.addListener=pe.prototype.on,pe.prefixed=n,pe.EventEmitter=pe,c.exports=pe})(eventemitter3);var eventemitter3Exports=eventemitter3.exports;const EventEmitter=getDefaultExportFromCjs$2(eventemitter3Exports);var WebSocketBrowserImpl=class extends EventEmitter{constructor(t,n,ie){super();Xn(this,"socket");this.socket=new window.WebSocket(t,ie),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=fe=>this.emit("message",fe.data),this.socket.onerror=fe=>this.emit("error",fe),this.socket.onclose=fe=>{this.emit("close",fe.code,fe.reason)}}send(t,n,ie){const fe=ie||n;try{this.socket.send(t),fe()}catch(ae){fe(ae)}}close(t,n){this.socket.close(t,n)}addEventListener(t,n,ie){this.socket.addEventListener(t,n,ie)}};function WebSocket(c,t){return new WebSocketBrowserImpl(c,t)}var DefaultDataPack=class{encode(c){return JSON.stringify(c)}decode(c){return JSON.parse(c)}},CommonClient=class extends EventEmitter{constructor(t,n="ws://localhost:8080",{autoconnect:ie=!0,reconnect:fe=!0,reconnect_interval:ae=1e3,max_reconnects:le=5,...pe}={},me,ye){super();Xn(this,"address");Xn(this,"rpc_id");Xn(this,"queue");Xn(this,"options");Xn(this,"autoconnect");Xn(this,"ready");Xn(this,"reconnect");Xn(this,"reconnect_timer_id");Xn(this,"reconnect_interval");Xn(this,"max_reconnects");Xn(this,"rest_options");Xn(this,"current_reconnects");Xn(this,"generate_request_id");Xn(this,"socket");Xn(this,"webSocketFactory");Xn(this,"dataPack");this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=n,this.autoconnect=ie,this.ready=!1,this.reconnect=fe,this.reconnect_timer_id=void 0,this.reconnect_interval=ae,this.max_reconnects=le,this.rest_options=pe,this.current_reconnects=0,this.generate_request_id=me||(()=>typeof this.rpc_id=="number"?++this.rpc_id:Number(this.rpc_id)+1),ye?this.dataPack=ye:this.dataPack=new DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(t,n,ie,fe){return!fe&&typeof ie=="object"&&(fe=ie,ie=null),new Promise((ae,le)=>{if(!this.ready)return le(new Error("socket not ready"));const pe=this.generate_request_id(t,n),me={jsonrpc:"2.0",method:t,params:n||void 0,id:pe};this.socket.send(this.dataPack.encode(me),fe,ye=>{if(ye)return le(ye);this.queue[pe]={promise:[ae,le]},ie&&(this.queue[pe].timeout=setTimeout(()=>{delete this.queue[pe],le(new Error("reply timeout"))},ie))})})}async login(t){const n=await this.call("rpc.login",t);if(!n)throw new Error("authentication failed");return n}async listMethods(){return await this.call("__listMethods")}notify(t,n){return new Promise((ie,fe)=>{if(!this.ready)return fe(new Error("socket not ready"));const ae={jsonrpc:"2.0",method:t,params:n};this.socket.send(this.dataPack.encode(ae),le=>{if(le)return fe(le);ie()})})}async subscribe(t){typeof t=="string"&&(t=[t]);const n=await this.call("rpc.on",t);if(typeof t=="string"&&n[t]!=="ok")throw new Error("Failed subscribing to an event '"+t+"' with: "+n[t]);return n}async unsubscribe(t){typeof t=="string"&&(t=[t]);const n=await this.call("rpc.off",t);if(typeof t=="string"&&n[t]!=="ok")throw new Error("Failed unsubscribing from an event with: "+n);return n}close(t,n){this.socket&&this.socket.close(t||1e3,n)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return this.reconnect_timer_id!==void 0}willReconnect(){return this.reconnect&&(this.max_reconnects===0||this.current_reconnects<this.max_reconnects)}_connect(t,n){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,n),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:ie})=>{ie instanceof ArrayBuffer&&(ie=dist$1.Buffer.from(ie).toString());try{ie=this.dataPack.decode(ie)}catch{return}if(ie.notification&&this.listeners(ie.notification).length){if(!Object.keys(ie.params).length)return this.emit(ie.notification);const fe=[ie.notification];if(ie.params.constructor===Object)fe.push(ie.params);else for(let ae=0;ae<ie.params.length;ae++)fe.push(ie.params[ae]);return Promise.resolve().then(()=>{this.emit.apply(this,fe)})}if(!this.queue[ie.id])return ie.method?Promise.resolve().then(()=>{this.emit(ie.method,ie==null?void 0:ie.params)}):void 0;"error"in ie=="result"in ie&&this.queue[ie.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[ie.id].timeout&&clearTimeout(this.queue[ie.id].timeout),ie.error?this.queue[ie.id].promise[1](ie.error):this.queue[ie.id].promise[0](ie.result),delete this.queue[ie.id]}),this.socket.addEventListener("error",ie=>this.emit("error",ie)),this.socket.addEventListener("close",({code:ie,reason:fe})=>{this.ready&&setTimeout(()=>this.emit("close",ie,fe),0),this.ready=!1,this.socket=void 0,ie!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)?this.reconnect_timer_id=setTimeout(()=>this._connect(t,n),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",ie,fe),1))})}};class HMAC extends Hash{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,ahash(t);const ie=toBytes(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const fe=this.blockLen,ae=new Uint8Array(fe);ae.set(ie.length>fe?t.create().update(ie).digest():ie);for(let le=0;le<ae.length;le++)ae[le]^=54;this.iHash.update(ae),this.oHash=t.create();for(let le=0;le<ae.length;le++)ae[le]^=106;this.oHash.update(ae),clean(ae)}update(t){return aexists(this),this.iHash.update(t),this}digestInto(t){aexists(this),abytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:ie,finished:fe,destroyed:ae,blockLen:le,outputLen:pe}=this;return t=t,t.finished=fe,t.destroyed=ae,t.blockLen=le,t.outputLen=pe,t.oHash=n._cloneInto(t.oHash),t.iHash=ie._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const hmac=(c,t,n)=>new HMAC(c,t).update(n).digest();hmac.create=(c,t)=>new HMAC(c,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const divNearest=(c,t)=>(c+(c>=0?t:-t)/_2n$1)/t;function _splitEndoScalar(c,t,n){const[[ie,fe],[ae,le]]=t,pe=divNearest(le*c,n),me=divNearest(-fe*c,n);let ye=c-pe*ie-me*ae,xe=-pe*fe-me*le;const Ee=ye<_0n,Se=xe<_0n;Ee&&(ye=-ye),Se&&(xe=-xe);const Me=bitMask(Math.ceil(bitLen(n)/2))+_1n;if(ye<_0n||ye>=Me||xe<_0n||xe>=Me)throw new Error("splitScalar (endomorphism): failed, k="+c);return{k1neg:Ee,k1:ye,k2neg:Se,k2:xe}}function validateSigFormat(c){if(!["compact","recovered","der"].includes(c))throw new Error('Signature format must be "compact", "recovered", or "der"');return c}function validateSigOpts(c,t){const n={};for(let ie of Object.keys(t))n[ie]=c[ie]===void 0?t[ie]:c[ie];return _abool2(n.lowS,"lowS"),_abool2(n.prehash,"prehash"),n.format!==void 0&&validateSigFormat(n.format),n}class DERErr extends Error{constructor(t=""){super(t)}}const DER={Err:DERErr,_tlv:{encode:(c,t)=>{const{Err:n}=DER;if(c<0||c>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const ie=t.length/2,fe=numberToHexUnpadded(ie);if(fe.length/2&128)throw new n("tlv.encode: long form length too big");const ae=ie>127?numberToHexUnpadded(fe.length/2|128):"";return numberToHexUnpadded(c)+ae+fe+t},decode(c,t){const{Err:n}=DER;let ie=0;if(c<0||c>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[ie++]!==c)throw new n("tlv.decode: wrong tlv");const fe=t[ie++],ae=!!(fe&128);let le=0;if(!ae)le=fe;else{const me=fe&127;if(!me)throw new n("tlv.decode(long): indefinite length not supported");if(me>4)throw new n("tlv.decode(long): byte length is too big");const ye=t.subarray(ie,ie+me);if(ye.length!==me)throw new n("tlv.decode: length bytes not complete");if(ye[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const xe of ye)le=le<<8|xe;if(ie+=me,le<128)throw new n("tlv.decode(long): not minimal encoding")}const pe=t.subarray(ie,ie+le);if(pe.length!==le)throw new n("tlv.decode: wrong value length");return{v:pe,l:t.subarray(ie+le)}}},_int:{encode(c){const{Err:t}=DER;if(c<_0n)throw new t("integer: negative integers are not allowed");let n=numberToHexUnpadded(c);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(c){const{Err:t}=DER;if(c[0]&128)throw new t("invalid signature integer: negative");if(c[0]===0&&!(c[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return bytesToNumberBE(c)}},toSig(c){const{Err:t,_int:n,_tlv:ie}=DER,fe=ensureBytes("signature",c),{v:ae,l:le}=ie.decode(48,fe);if(le.length)throw new t("invalid signature: left bytes after parsing");const{v:pe,l:me}=ie.decode(2,ae),{v:ye,l:xe}=ie.decode(2,me);if(xe.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(pe),s:n.decode(ye)}},hexFromSig(c){const{_tlv:t,_int:n}=DER,ie=t.encode(2,n.encode(c.r)),fe=t.encode(2,n.encode(c.s)),ae=ie+fe;return t.encode(48,ae)}},_0n=BigInt(0),_1n=BigInt(1),_2n$1=BigInt(2),_3n=BigInt(3),_4n=BigInt(4);function _normFnElement(c,t){const{BYTES:n}=c;let ie;if(typeof t=="bigint")ie=t;else{let fe=ensureBytes("private key",t);try{ie=c.fromBytes(fe)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!c.isValidNot0(ie))throw new Error("invalid private key: out of range [1..N-1]");return ie}function weierstrassN(c,t={}){const n=_createCurveFields("weierstrass",c,t),{Fp:ie,Fn:fe}=n;let ae=n.CURVE;const{h:le,n:pe}=ae;_validateObject(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:me}=t;if(me&&(!ie.is0(ae.a)||typeof me.beta!="bigint"||!Array.isArray(me.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const ye=getWLengths(ie,fe);function xe(){if(!ie.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function Ee(se,ce,de){const{x:he,y:ve}=ce.toAffine(),we=ie.toBytes(he);if(_abool2(de,"isCompressed"),de){xe();const Ae=!ie.isOdd(ve);return concatBytes(pprefix(Ae),we)}else return concatBytes(Uint8Array.of(4),we,ie.toBytes(ve))}function Se(se){_abytes2(se,void 0,"Point");const{publicKey:ce,publicKeyUncompressed:de}=ye,he=se.length,ve=se[0],we=se.subarray(1);if(he===ce&&(ve===2||ve===3)){const Ae=ie.fromBytes(we);if(!ie.isValid(Ae))throw new Error("bad point: is not on curve, wrong x");const be=$e(Ae);let ue;try{ue=ie.sqrt(be)}catch(Ne){const qe=Ne instanceof Error?": "+Ne.message:"";throw new Error("bad point: is not on curve, sqrt error"+qe)}xe();const ge=ie.isOdd(ue);return(ve&1)===1!==ge&&(ue=ie.neg(ue)),{x:Ae,y:ue}}else if(he===de&&ve===4){const Ae=ie.BYTES,be=ie.fromBytes(we.subarray(0,Ae)),ue=ie.fromBytes(we.subarray(Ae,Ae*2));if(!ke(be,ue))throw new Error("bad point: is not on curve");return{x:be,y:ue}}else throw new Error(`bad point: got length ${he}, expected compressed=${ce} or uncompressed=${de}`)}const Me=t.toBytes||Ee,Be=t.fromBytes||Se;function $e(se){const ce=ie.sqr(se),de=ie.mul(ce,se);return ie.add(ie.add(de,ie.mul(se,ae.a)),ae.b)}function ke(se,ce){const de=ie.sqr(ce),he=$e(se);return ie.eql(de,he)}if(!ke(ae.Gx,ae.Gy))throw new Error("bad curve params: generator point");const Te=ie.mul(ie.pow(ae.a,_3n),_4n),Ie=ie.mul(ie.sqr(ae.b),BigInt(27));if(ie.is0(ie.add(Te,Ie)))throw new Error("bad curve params: a or b");function Fe(se,ce,de=!1){if(!ie.isValid(ce)||de&&ie.is0(ce))throw new Error(`bad point coordinate ${se}`);return ce}function Le(se){if(!(se instanceof Ue))throw new Error("ProjectivePoint expected")}function He(se){if(!me||!me.basises)throw new Error("no endo");return _splitEndoScalar(se,me.basises,fe.ORDER)}const ze=memoized((se,ce)=>{const{X:de,Y:he,Z:ve}=se;if(ie.eql(ve,ie.ONE))return{x:de,y:he};const we=se.is0();ce==null&&(ce=we?ie.ONE:ie.inv(ve));const Ae=ie.mul(de,ce),be=ie.mul(he,ce),ue=ie.mul(ve,ce);if(we)return{x:ie.ZERO,y:ie.ZERO};if(!ie.eql(ue,ie.ONE))throw new Error("invZ was invalid");return{x:Ae,y:be}}),Je=memoized(se=>{if(se.is0()){if(t.allowInfinityPoint&&!ie.is0(se.Y))return;throw new Error("bad point: ZERO")}const{x:ce,y:de}=se.toAffine();if(!ie.isValid(ce)||!ie.isValid(de))throw new Error("bad point: x or y not field elements");if(!ke(ce,de))throw new Error("bad point: equation left != right");if(!se.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function Xe(se,ce,de,he,ve){return de=new Ue(ie.mul(de.X,se),de.Y,de.Z),ce=negateCt(he,ce),de=negateCt(ve,de),ce.add(de)}class Ue{constructor(ce,de,he){this.X=Fe("x",ce),this.Y=Fe("y",de,!0),this.Z=Fe("z",he),Object.freeze(this)}static CURVE(){return ae}static fromAffine(ce){const{x:de,y:he}=ce||{};if(!ce||!ie.isValid(de)||!ie.isValid(he))throw new Error("invalid affine point");if(ce instanceof Ue)throw new Error("projective point not allowed");return ie.is0(de)&&ie.is0(he)?Ue.ZERO:new Ue(de,he,ie.ONE)}static fromBytes(ce){const de=Ue.fromAffine(Be(_abytes2(ce,void 0,"point")));return de.assertValidity(),de}static fromHex(ce){return Ue.fromBytes(ensureBytes("pointHex",ce))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(ce=8,de=!0){return _e.createCache(this,ce),de||this.multiply(_3n),this}assertValidity(){Je(this)}hasEvenY(){const{y:ce}=this.toAffine();if(!ie.isOdd)throw new Error("Field doesn't support isOdd");return!ie.isOdd(ce)}equals(ce){Le(ce);const{X:de,Y:he,Z:ve}=this,{X:we,Y:Ae,Z:be}=ce,ue=ie.eql(ie.mul(de,be),ie.mul(we,ve)),ge=ie.eql(ie.mul(he,be),ie.mul(Ae,ve));return ue&&ge}negate(){return new Ue(this.X,ie.neg(this.Y),this.Z)}double(){const{a:ce,b:de}=ae,he=ie.mul(de,_3n),{X:ve,Y:we,Z:Ae}=this;let be=ie.ZERO,ue=ie.ZERO,ge=ie.ZERO,Re=ie.mul(ve,ve),Ne=ie.mul(we,we),qe=ie.mul(Ae,Ae),Pe=ie.mul(ve,we);return Pe=ie.add(Pe,Pe),ge=ie.mul(ve,Ae),ge=ie.add(ge,ge),be=ie.mul(ce,ge),ue=ie.mul(he,qe),ue=ie.add(be,ue),be=ie.sub(Ne,ue),ue=ie.add(Ne,ue),ue=ie.mul(be,ue),be=ie.mul(Pe,be),ge=ie.mul(he,ge),qe=ie.mul(ce,qe),Pe=ie.sub(Re,qe),Pe=ie.mul(ce,Pe),Pe=ie.add(Pe,ge),ge=ie.add(Re,Re),Re=ie.add(ge,Re),Re=ie.add(Re,qe),Re=ie.mul(Re,Pe),ue=ie.add(ue,Re),qe=ie.mul(we,Ae),qe=ie.add(qe,qe),Re=ie.mul(qe,Pe),be=ie.sub(be,Re),ge=ie.mul(qe,Ne),ge=ie.add(ge,ge),ge=ie.add(ge,ge),new Ue(be,ue,ge)}add(ce){Le(ce);const{X:de,Y:he,Z:ve}=this,{X:we,Y:Ae,Z:be}=ce;let ue=ie.ZERO,ge=ie.ZERO,Re=ie.ZERO;const Ne=ae.a,qe=ie.mul(ae.b,_3n);let Pe=ie.mul(de,we),Ge=ie.mul(he,Ae),Ce=ie.mul(ve,be),De=ie.add(de,he),je=ie.add(we,Ae);De=ie.mul(De,je),je=ie.add(Pe,Ge),De=ie.sub(De,je),je=ie.add(de,ve);let Ve=ie.add(we,be);return je=ie.mul(je,Ve),Ve=ie.add(Pe,Ce),je=ie.sub(je,Ve),Ve=ie.add(he,ve),ue=ie.add(Ae,be),Ve=ie.mul(Ve,ue),ue=ie.add(Ge,Ce),Ve=ie.sub(Ve,ue),Re=ie.mul(Ne,je),ue=ie.mul(qe,Ce),Re=ie.add(ue,Re),ue=ie.sub(Ge,Re),Re=ie.add(Ge,Re),ge=ie.mul(ue,Re),Ge=ie.add(Pe,Pe),Ge=ie.add(Ge,Pe),Ce=ie.mul(Ne,Ce),je=ie.mul(qe,je),Ge=ie.add(Ge,Ce),Ce=ie.sub(Pe,Ce),Ce=ie.mul(Ne,Ce),je=ie.add(je,Ce),Pe=ie.mul(Ge,je),ge=ie.add(ge,Pe),Pe=ie.mul(Ve,je),ue=ie.mul(De,ue),ue=ie.sub(ue,Pe),Pe=ie.mul(De,Ge),Re=ie.mul(Ve,Re),Re=ie.add(Re,Pe),new Ue(ue,ge,Re)}subtract(ce){return this.add(ce.negate())}is0(){return this.equals(Ue.ZERO)}multiply(ce){const{endo:de}=t;if(!fe.isValidNot0(ce))throw new Error("invalid scalar: out of range");let he,ve;const we=Ae=>_e.cached(this,Ae,be=>normalizeZ(Ue,be));if(de){const{k1neg:Ae,k1:be,k2neg:ue,k2:ge}=He(ce),{p:Re,f:Ne}=we(be),{p:qe,f:Pe}=we(ge);ve=Ne.add(Pe),he=Xe(de.beta,Re,qe,Ae,ue)}else{const{p:Ae,f:be}=we(ce);he=Ae,ve=be}return normalizeZ(Ue,[he,ve])[0]}multiplyUnsafe(ce){const{endo:de}=t,he=this;if(!fe.isValid(ce))throw new Error("invalid scalar: out of range");if(ce===_0n||he.is0())return Ue.ZERO;if(ce===_1n)return he;if(_e.hasCache(this))return this.multiply(ce);if(de){const{k1neg:ve,k1:we,k2neg:Ae,k2:be}=He(ce),{p1:ue,p2:ge}=mulEndoUnsafe(Ue,he,we,be);return Xe(de.beta,ue,ge,ve,Ae)}else return _e.unsafe(he,ce)}multiplyAndAddUnsafe(ce,de,he){const ve=this.multiplyUnsafe(de).add(ce.multiplyUnsafe(he));return ve.is0()?void 0:ve}toAffine(ce){return ze(this,ce)}isTorsionFree(){const{isTorsionFree:ce}=t;return le===_1n?!0:ce?ce(Ue,this):_e.unsafe(this,pe).is0()}clearCofactor(){const{clearCofactor:ce}=t;return le===_1n?this:ce?ce(Ue,this):this.multiplyUnsafe(le)}isSmallOrder(){return this.multiplyUnsafe(le).is0()}toBytes(ce=!0){return _abool2(ce,"isCompressed"),this.assertValidity(),Me(Ue,this,ce)}toHex(ce=!0){return bytesToHex(this.toBytes(ce))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(ce=!0){return this.toBytes(ce)}_setWindowSize(ce){this.precompute(ce)}static normalizeZ(ce){return normalizeZ(Ue,ce)}static msm(ce,de){return pippenger(Ue,fe,ce,de)}static fromPrivateKey(ce){return Ue.BASE.multiply(_normFnElement(fe,ce))}}Ue.BASE=new Ue(ae.Gx,ae.Gy,ie.ONE),Ue.ZERO=new Ue(ie.ZERO,ie.ONE,ie.ZERO),Ue.Fp=ie,Ue.Fn=fe;const $t=fe.BITS,_e=new wNAF(Ue,t.endo?Math.ceil($t/2):$t);return Ue.BASE.precompute(8),Ue}function pprefix(c){return Uint8Array.of(c?2:3)}function getWLengths(c,t){return{secretKey:t.BYTES,publicKey:1+c.BYTES,publicKeyUncompressed:1+2*c.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function ecdh(c,t={}){const{Fn:n}=c,ie=t.randomBytes||randomBytes,fe=Object.assign(getWLengths(c.Fp,n),{seed:getMinHashLength(n.ORDER)});function ae(Me){try{return!!_normFnElement(n,Me)}catch{return!1}}function le(Me,Be){const{publicKey:$e,publicKeyUncompressed:ke}=fe;try{const Te=Me.length;return Be===!0&&Te!==$e||Be===!1&&Te!==ke?!1:!!c.fromBytes(Me)}catch{return!1}}function pe(Me=ie(fe.seed)){return mapHashToField(_abytes2(Me,fe.seed,"seed"),n.ORDER)}function me(Me,Be=!0){return c.BASE.multiply(_normFnElement(n,Me)).toBytes(Be)}function ye(Me){const Be=pe(Me);return{secretKey:Be,publicKey:me(Be)}}function xe(Me){if(typeof Me=="bigint")return!1;if(Me instanceof c)return!0;const{secretKey:Be,publicKey:$e,publicKeyUncompressed:ke}=fe;if(n.allowedLengths||Be===$e)return;const Te=ensureBytes("key",Me).length;return Te===$e||Te===ke}function Ee(Me,Be,$e=!0){if(xe(Me)===!0)throw new Error("first arg must be private key");if(xe(Be)===!1)throw new Error("second arg must be public key");const ke=_normFnElement(n,Me);return c.fromHex(Be).multiply(ke).toBytes($e)}return Object.freeze({getPublicKey:me,getSharedSecret:Ee,keygen:ye,Point:c,utils:{isValidSecretKey:ae,isValidPublicKey:le,randomSecretKey:pe,isValidPrivateKey:ae,randomPrivateKey:pe,normPrivateKeyToScalar:Me=>_normFnElement(n,Me),precompute(Me=8,Be=c.BASE){return Be.precompute(Me,!1)}},lengths:fe})}function ecdsa(c,t,n={}){ahash(t),_validateObject(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const ie=n.randomBytes||randomBytes,fe=n.hmac||((de,...he)=>hmac(t,de,concatBytes(...he))),{Fp:ae,Fn:le}=c,{ORDER:pe,BITS:me}=le,{keygen:ye,getPublicKey:xe,getSharedSecret:Ee,utils:Se,lengths:Me}=ecdh(c,n),Be={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},$e="compact";function ke(de){const he=pe>>_1n;return de>he}function Te(de,he){if(!le.isValidNot0(he))throw new Error(`invalid signature ${de}: out of range 1..Point.Fn.ORDER`);return he}function Ie(de,he){validateSigFormat(he);const ve=Me.signature,we=he==="compact"?ve:he==="recovered"?ve+1:void 0;return _abytes2(de,we,`${he} signature`)}class Fe{constructor(he,ve,we){this.r=Te("r",he),this.s=Te("s",ve),we!=null&&(this.recovery=we),Object.freeze(this)}static fromBytes(he,ve=$e){Ie(he,ve);let we;if(ve==="der"){const{r:ge,s:Re}=DER.toSig(_abytes2(he));return new Fe(ge,Re)}ve==="recovered"&&(we=he[0],ve="compact",he=he.subarray(1));const Ae=le.BYTES,be=he.subarray(0,Ae),ue=he.subarray(Ae,Ae*2);return new Fe(le.fromBytes(be),le.fromBytes(ue),we)}static fromHex(he,ve){return this.fromBytes(hexToBytes(he),ve)}addRecoveryBit(he){return new Fe(this.r,this.s,he)}recoverPublicKey(he){const ve=ae.ORDER,{r:we,s:Ae,recovery:be}=this;if(be==null||![0,1,2,3].includes(be))throw new Error("recovery id invalid");if(pe*_2n$1<ve&&be>1)throw new Error("recovery id is ambiguous for h>1 curve");const ge=be===2||be===3?we+pe:we;if(!ae.isValid(ge))throw new Error("recovery id 2 or 3 invalid");const Re=ae.toBytes(ge),Ne=c.fromBytes(concatBytes(pprefix((be&1)===0),Re)),qe=le.inv(ge),Pe=He(ensureBytes("msgHash",he)),Ge=le.create(-Pe*qe),Ce=le.create(Ae*qe),De=c.BASE.multiplyUnsafe(Ge).add(Ne.multiplyUnsafe(Ce));if(De.is0())throw new Error("point at infinify");return De.assertValidity(),De}hasHighS(){return ke(this.s)}toBytes(he=$e){if(validateSigFormat(he),he==="der")return hexToBytes(DER.hexFromSig(this));const ve=le.toBytes(this.r),we=le.toBytes(this.s);if(he==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return concatBytes(Uint8Array.of(this.recovery),ve,we)}return concatBytes(ve,we)}toHex(he){return bytesToHex(this.toBytes(he))}assertValidity(){}static fromCompact(he){return Fe.fromBytes(ensureBytes("sig",he),"compact")}static fromDER(he){return Fe.fromBytes(ensureBytes("sig",he),"der")}normalizeS(){return this.hasHighS()?new Fe(this.r,le.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return bytesToHex(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return bytesToHex(this.toBytes("compact"))}}const Le=n.bits2int||function(he){if(he.length>8192)throw new Error("input is too large");const ve=bytesToNumberBE(he),we=he.length*8-me;return we>0?ve>>BigInt(we):ve},He=n.bits2int_modN||function(he){return le.create(Le(he))},ze=bitMask(me);function Je(de){return aInRange("num < 2^"+me,de,_0n,ze),le.toBytes(de)}function Xe(de,he){return _abytes2(de,void 0,"message"),he?_abytes2(t(de),void 0,"prehashed message"):de}function Ue(de,he,ve){if(["recovered","canonical"].some(Ge=>Ge in ve))throw new Error("sign() legacy options not supported");const{lowS:we,prehash:Ae,extraEntropy:be}=validateSigOpts(ve,Be);de=Xe(de,Ae);const ue=He(de),ge=_normFnElement(le,he),Re=[Je(ge),Je(ue)];if(be!=null&&be!==!1){const Ge=be===!0?ie(Me.secretKey):be;Re.push(ensureBytes("extraEntropy",Ge))}const Ne=concatBytes(...Re),qe=ue;function Pe(Ge){const Ce=Le(Ge);if(!le.isValidNot0(Ce))return;const De=le.inv(Ce),je=c.BASE.multiply(Ce).toAffine(),Ve=le.create(je.x);if(Ve===_0n)return;const Mt=le.create(De*le.create(qe+Ve*ge));if(Mt===_0n)return;let Oe=(je.x===Ve?0:2)|Number(je.y&_1n),We=Mt;return we&&ke(Mt)&&(We=le.neg(Mt),Oe^=1),new Fe(Ve,We,Oe)}return{seed:Ne,k2sig:Pe}}function $t(de,he,ve={}){de=ensureBytes("message",de);const{seed:we,k2sig:Ae}=Ue(de,he,ve);return createHmacDrbg(t.outputLen,le.BYTES,fe)(we,Ae)}function _e(de){let he;const ve=typeof de=="string"||isBytes(de),we=!ve&&de!==null&&typeof de=="object"&&typeof de.r=="bigint"&&typeof de.s=="bigint";if(!ve&&!we)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(we)he=new Fe(de.r,de.s);else if(ve){try{he=Fe.fromBytes(ensureBytes("sig",de),"der")}catch(Ae){if(!(Ae instanceof DER.Err))throw Ae}if(!he)try{he=Fe.fromBytes(ensureBytes("sig",de),"compact")}catch{return!1}}return he||!1}function se(de,he,ve,we={}){const{lowS:Ae,prehash:be,format:ue}=validateSigOpts(we,Be);if(ve=ensureBytes("publicKey",ve),he=Xe(ensureBytes("message",he),be),"strict"in we)throw new Error("options.strict was renamed to lowS");const ge=ue===void 0?_e(de):Fe.fromBytes(ensureBytes("sig",de),ue);if(ge===!1)return!1;try{const Re=c.fromBytes(ve);if(Ae&&ge.hasHighS())return!1;const{r:Ne,s:qe}=ge,Pe=He(he),Ge=le.inv(qe),Ce=le.create(Pe*Ge),De=le.create(Ne*Ge),je=c.BASE.multiplyUnsafe(Ce).add(Re.multiplyUnsafe(De));return je.is0()?!1:le.create(je.x)===Ne}catch{return!1}}function ce(de,he,ve={}){const{prehash:we}=validateSigOpts(ve,Be);return he=Xe(he,we),Fe.fromBytes(de,"recovered").recoverPublicKey(he).toBytes()}return Object.freeze({keygen:ye,getPublicKey:xe,getSharedSecret:Ee,utils:Se,lengths:Me,Point:c,sign:$t,verify:se,recoverPublicKey:ce,Signature:Fe,hash:t})}function _weierstrass_legacy_opts_to_new(c){const t={a:c.a,b:c.b,p:c.Fp.ORDER,n:c.n,h:c.h,Gx:c.Gx,Gy:c.Gy},n=c.Fp;let ie=c.allowedPrivateKeyLengths?Array.from(new Set(c.allowedPrivateKeyLengths.map(le=>Math.ceil(le/2)))):void 0;const fe=Field(t.n,{BITS:c.nBitLength,allowedLengths:ie,modFromBytes:c.wrapPrivateKey}),ae={Fp:n,Fn:fe,allowInfinityPoint:c.allowInfinityPoint,endo:c.endo,isTorsionFree:c.isTorsionFree,clearCofactor:c.clearCofactor,fromBytes:c.fromBytes,toBytes:c.toBytes};return{CURVE:t,curveOpts:ae}}function _ecdsa_legacy_opts_to_new(c){const{CURVE:t,curveOpts:n}=_weierstrass_legacy_opts_to_new(c),ie={hmac:c.hmac,randomBytes:c.randomBytes,lowS:c.lowS,bits2int:c.bits2int,bits2int_modN:c.bits2int_modN};return{CURVE:t,curveOpts:n,hash:c.hash,ecdsaOpts:ie}}function _ecdsa_new_output_to_legacy(c,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},c,nLength(n.Fn.ORDER,n.Fn.BITS))})}function weierstrass(c){const{CURVE:t,curveOpts:n,hash:ie,ecdsaOpts:fe}=_ecdsa_legacy_opts_to_new(c),ae=weierstrassN(t,n),le=ecdsa(ae,ie,fe);return _ecdsa_new_output_to_legacy(c,le)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function createCurve(c,t){const n=ie=>weierstrass({...c,hash:ie});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1_CURVE={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},secp256k1_ENDO={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},_2n=BigInt(2);function sqrtMod(c){const t=secp256k1_CURVE.p,n=BigInt(3),ie=BigInt(6),fe=BigInt(11),ae=BigInt(22),le=BigInt(23),pe=BigInt(44),me=BigInt(88),ye=c*c*c%t,xe=ye*ye*c%t,Ee=pow2(xe,n,t)*xe%t,Se=pow2(Ee,n,t)*xe%t,Me=pow2(Se,_2n,t)*ye%t,Be=pow2(Me,fe,t)*Me%t,$e=pow2(Be,ae,t)*Be%t,ke=pow2($e,pe,t)*$e%t,Te=pow2(ke,me,t)*ke%t,Ie=pow2(Te,pe,t)*$e%t,Fe=pow2(Ie,n,t)*xe%t,Le=pow2(Fe,le,t)*Be%t,He=pow2(Le,ie,t)*ye%t,ze=pow2(He,_2n,t);if(!Fpk1.eql(Fpk1.sqr(ze),c))throw new Error("Cannot find square root");return ze}const Fpk1=Field(secp256k1_CURVE.p,{sqrt:sqrtMod}),secp256k1$1=createCurve({...secp256k1_CURVE,Fp:Fpk1,lowS:!0,endo:secp256k1_ENDO},sha256$5);ed25519.utils.randomPrivateKey;ed25519.getPublicKey;function isOnCurve(c){try{return ed25519.ExtendedPoint.fromHex(c),!0}catch{return!1}}const sign$2=(c,t)=>ed25519.sign(c,t.slice(0,32)),verify$1=ed25519.verify,toBuffer$1=c=>dist$1.Buffer.isBuffer(c)?c:c instanceof Uint8Array?dist$1.Buffer.from(c.buffer,c.byteOffset,c.byteLength):dist$1.Buffer.from(c);class Struct{constructor(t){Object.assign(this,t)}encode(){return dist$1.Buffer.from(serialize_1(SOLANA_SCHEMA,this))}static decode(t){return deserialize_1(SOLANA_SCHEMA,this,t)}static decodeUnchecked(t){return deserializeUnchecked_1(SOLANA_SCHEMA,this,t)}}const SOLANA_SCHEMA=new Map;var _PublicKey;const MAX_SEED_LENGTH=32,PUBLIC_KEY_LENGTH=32;function isPublicKeyData(c){return c._bn!==void 0}let uniquePublicKeyCounter=1;class PublicKey extends Struct{constructor(t){if(super({}),this._bn=void 0,isPublicKeyData(t))this._bn=t._bn;else{if(typeof t=="string"){const n=o$1.decode(t);if(n.length!=PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input");this._bn=new BN$8(n)}else this._bn=new BN$8(t);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input")}}static unique(){const t=new PublicKey(uniquePublicKeyCounter);return uniquePublicKeyCounter+=1,new PublicKey(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return o$1.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(dist$1.Buffer);if(t.length===PUBLIC_KEY_LENGTH)return t;const n=dist$1.Buffer.alloc(32);return t.copy(n,32-t.length),n}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,n,ie){const fe=dist$1.Buffer.concat([t.toBuffer(),dist$1.Buffer.from(n),ie.toBuffer()]),ae=sha256$4(fe);return new PublicKey(ae)}static createProgramAddressSync(t,n){let ie=dist$1.Buffer.alloc(0);t.forEach(function(ae){if(ae.length>MAX_SEED_LENGTH)throw new TypeError("Max seed length exceeded");ie=dist$1.Buffer.concat([ie,toBuffer$1(ae)])}),ie=dist$1.Buffer.concat([ie,n.toBuffer(),dist$1.Buffer.from("ProgramDerivedAddress")]);const fe=sha256$4(ie);if(isOnCurve(fe))throw new Error("Invalid seeds, address must fall off the curve");return new PublicKey(fe)}static async createProgramAddress(t,n){return this.createProgramAddressSync(t,n)}static findProgramAddressSync(t,n){let ie=255,fe;for(;ie!=0;){try{const ae=t.concat(dist$1.Buffer.from([ie]));fe=this.createProgramAddressSync(ae,n)}catch(ae){if(ae instanceof TypeError)throw ae;ie--;continue}return[fe,ie]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,n){return this.findProgramAddressSync(t,n)}static isOnCurve(t){const n=new PublicKey(t);return isOnCurve(n.toBytes())}}_PublicKey=PublicKey;PublicKey.default=new _PublicKey("11111111111111111111111111111111");SOLANA_SCHEMA.set(PublicKey,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey("BPFLoader1111111111111111111111111111111111");const PACKET_DATA_SIZE=1232,VERSION_PREFIX_MASK=127,SIGNATURE_LENGTH_IN_BYTES=64;class TransactionExpiredBlockheightExceededError extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(TransactionExpiredBlockheightExceededError.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class TransactionExpiredTimeoutError extends Error{constructor(t,n){super(`Transaction was not confirmed in ${n.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(TransactionExpiredTimeoutError.prototype,"name",{value:"TransactionExpiredTimeoutError"});class TransactionExpiredNonceInvalidError extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(TransactionExpiredNonceInvalidError.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class MessageAccountKeys{constructor(t,n){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=n}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const n of this.keySegments()){if(t<n.length)return n[t];t-=n.length}}get length(){return this.keySegments().flat().length}compileInstructions(t){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const ie=new Map;this.keySegments().flat().forEach((ae,le)=>{ie.set(ae.toBase58(),le)});const fe=ae=>{const le=ie.get(ae.toBase58());if(le===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return le};return t.map(ae=>({programIdIndex:fe(ae.programId),accountKeyIndexes:ae.keys.map(le=>fe(le.pubkey)),data:ae.data}))}}const publicKey$1=(c="publicKey")=>blob(32,c),signature$2=(c="signature")=>blob(64,c),rustString=(c="string")=>{const t=struct([u32("length"),u32("lengthPadding"),blob(offset(u32(),-8),"chars")],c),n=t.decode.bind(t),ie=t.encode.bind(t),fe=t;return fe.decode=(ae,le)=>n(ae,le).chars.toString(),fe.encode=(ae,le,pe)=>{const me={chars:dist$1.Buffer.from(ae,"utf8")};return ie(me,le,pe)},fe.alloc=ae=>u32().span+u32().span+dist$1.Buffer.from(ae,"utf8").length,fe},authorized=(c="authorized")=>struct([publicKey$1("staker"),publicKey$1("withdrawer")],c),lockup=(c="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$1("custodian")],c),voteInit=(c="voteInit")=>struct([publicKey$1("nodePubkey"),publicKey$1("authorizedVoter"),publicKey$1("authorizedWithdrawer"),u8("commission")],c),voteAuthorizeWithSeedArgs=(c="voteAuthorizeWithSeedArgs")=>struct([u32("voteAuthorizationType"),publicKey$1("currentAuthorityDerivedKeyOwnerPubkey"),rustString("currentAuthorityDerivedKeySeed"),publicKey$1("newAuthorized")],c);function getAlloc(c,t){const n=fe=>{if(fe.span>=0)return fe.span;if(typeof fe.alloc=="function")return fe.alloc(t[fe.property]);if("count"in fe&&"elementLayout"in fe){const ae=t[fe.property];if(Array.isArray(ae))return ae.length*n(fe.elementLayout)}else if("fields"in fe)return getAlloc({layout:fe},t[fe.property]);return 0};let ie=0;return c.layout.fields.forEach(fe=>{ie+=n(fe)}),ie}function decodeLength(c){let t=0,n=0;for(;;){let ie=c.shift();if(t|=(ie&127)<<n*7,n+=1,!(ie&128))break}return t}function encodeLength(c,t){let n=t;for(;;){let ie=n&127;if(n>>=7,n==0){c.push(ie);break}else ie|=128,c.push(ie)}}function assert$9(c,t){if(!c)throw new Error(t||"Assertion failed")}class CompiledKeys{constructor(t,n){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=n}static compile(t,n){const ie=new Map,fe=le=>{const pe=le.toBase58();let me=ie.get(pe);return me===void 0&&(me={isSigner:!1,isWritable:!1,isInvoked:!1},ie.set(pe,me)),me},ae=fe(n);ae.isSigner=!0,ae.isWritable=!0;for(const le of t){fe(le.programId).isInvoked=!0;for(const pe of le.keys){const me=fe(pe.pubkey);me.isSigner||(me.isSigner=pe.isSigner),me.isWritable||(me.isWritable=pe.isWritable)}}return new CompiledKeys(n,ie)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];assert$9(t.length<=256,"Max static account keys length exceeded");const n=t.filter(([,me])=>me.isSigner&&me.isWritable),ie=t.filter(([,me])=>me.isSigner&&!me.isWritable),fe=t.filter(([,me])=>!me.isSigner&&me.isWritable),ae=t.filter(([,me])=>!me.isSigner&&!me.isWritable),le={numRequiredSignatures:n.length+ie.length,numReadonlySignedAccounts:ie.length,numReadonlyUnsignedAccounts:ae.length};{assert$9(n.length>0,"Expected at least one writable signer key");const[me]=n[0];assert$9(me===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const pe=[...n.map(([me])=>new PublicKey(me)),...ie.map(([me])=>new PublicKey(me)),...fe.map(([me])=>new PublicKey(me)),...ae.map(([me])=>new PublicKey(me))];return[le,pe]}extractTableLookup(t){const[n,ie]=this.drainKeysFoundInLookupTable(t.state.addresses,le=>!le.isSigner&&!le.isInvoked&&le.isWritable),[fe,ae]=this.drainKeysFoundInLookupTable(t.state.addresses,le=>!le.isSigner&&!le.isInvoked&&!le.isWritable);if(!(n.length===0&&fe.length===0))return[{accountKey:t.key,writableIndexes:n,readonlyIndexes:fe},{writable:ie,readonly:ae}]}drainKeysFoundInLookupTable(t,n){const ie=new Array,fe=new Array;for(const[ae,le]of this.keyMetaMap.entries())if(n(le)){const pe=new PublicKey(ae),me=t.findIndex(ye=>ye.equals(pe));me>=0&&(assert$9(me<256,"Max lookup table index exceeded"),ie.push(me),fe.push(pe),this.keyMetaMap.delete(ae))}return[ie,fe]}}const END_OF_BUFFER_ERROR_MESSAGE="Reached end of buffer unexpectedly";function guardedShift(c){if(c.length===0)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return c.shift()}function guardedSplice(c,...t){const[n]=t;if(t.length===2?n+(t[1]??0)>c.length:n>=c.length)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return c.splice(...t)}class Message{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(n=>new PublicKey(n)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(n=>this.indexToProgramIds.set(n.programIdIndex,this.accountKeys[n.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:o$1.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new MessageAccountKeys(this.staticAccountKeys)}static compile(t){const n=CompiledKeys.compile(t.instructions,t.payerKey),[ie,fe]=n.getMessageComponents(),le=new MessageAccountKeys(fe).compileInstructions(t.instructions).map(pe=>({programIdIndex:pe.programIdIndex,accounts:pe.accountKeyIndexes,data:o$1.encode(pe.data)}));return new Message({header:ie,accountKeys:fe,recentBlockhash:t.recentBlockhash,instructions:le})}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const n=this.header.numRequiredSignatures;if(t>=this.header.numRequiredSignatures){const ie=t-n,ae=this.accountKeys.length-n-this.header.numReadonlyUnsignedAccounts;return ie<ae}else{const ie=n-this.header.numReadonlySignedAccounts;return t<ie}}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((t,n)=>!this.isProgramId(n))}serialize(){const t=this.accountKeys.length;let n=[];encodeLength(n,t);const ie=this.instructions.map(Ee=>{const{accounts:Se,programIdIndex:Me}=Ee,Be=Array.from(o$1.decode(Ee.data));let $e=[];encodeLength($e,Se.length);let ke=[];return encodeLength(ke,Be.length),{programIdIndex:Me,keyIndicesCount:dist$1.Buffer.from($e),keyIndices:Se,dataLength:dist$1.Buffer.from(ke),data:Be}});let fe=[];encodeLength(fe,ie.length);let ae=dist$1.Buffer.alloc(PACKET_DATA_SIZE);dist$1.Buffer.from(fe).copy(ae);let le=fe.length;ie.forEach(Ee=>{const Me=struct([u8("programIdIndex"),blob(Ee.keyIndicesCount.length,"keyIndicesCount"),seq(u8("keyIndex"),Ee.keyIndices.length,"keyIndices"),blob(Ee.dataLength.length,"dataLength"),seq(u8("userdatum"),Ee.data.length,"data")]).encode(Ee,ae,le);le+=Me}),ae=ae.slice(0,le);const pe=struct([blob(1,"numRequiredSignatures"),blob(1,"numReadonlySignedAccounts"),blob(1,"numReadonlyUnsignedAccounts"),blob(n.length,"keyCount"),seq(publicKey$1("key"),t,"keys"),publicKey$1("recentBlockhash")]),me={numRequiredSignatures:dist$1.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:dist$1.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:dist$1.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:dist$1.Buffer.from(n),keys:this.accountKeys.map(Ee=>toBuffer$1(Ee.toBytes())),recentBlockhash:o$1.decode(this.recentBlockhash)};let ye=dist$1.Buffer.alloc(2048);const xe=pe.encode(me,ye);return ae.copy(ye,xe),ye.slice(0,xe+ae.length)}static from(t){let n=[...t];const ie=guardedShift(n);if(ie!==(ie&VERSION_PREFIX_MASK))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const fe=guardedShift(n),ae=guardedShift(n),le=decodeLength(n);let pe=[];for(let Se=0;Se<le;Se++){const Me=guardedSplice(n,0,PUBLIC_KEY_LENGTH);pe.push(new PublicKey(dist$1.Buffer.from(Me)))}const me=guardedSplice(n,0,PUBLIC_KEY_LENGTH),ye=decodeLength(n);let xe=[];for(let Se=0;Se<ye;Se++){const Me=guardedShift(n),Be=decodeLength(n),$e=guardedSplice(n,0,Be),ke=decodeLength(n),Te=guardedSplice(n,0,ke),Ie=o$1.encode(dist$1.Buffer.from(Te));xe.push({programIdIndex:Me,accounts:$e,data:Ie})}const Ee={header:{numRequiredSignatures:ie,numReadonlySignedAccounts:fe,numReadonlyUnsignedAccounts:ae},recentBlockhash:o$1.encode(dist$1.Buffer.from(me)),accountKeys:pe,instructions:xe};return new Message(Ee)}}class MessageV0{constructor(t){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let t=0;for(const n of this.addressTableLookups)t+=n.readonlyIndexes.length+n.writableIndexes.length;return t}getAccountKeys(t){let n;if(t&&"accountKeysFromLookups"in t&&t.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=t.accountKeysFromLookups.writable.length+t.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");n=t.accountKeysFromLookups}else if(t&&"addressLookupTableAccounts"in t&&t.addressLookupTableAccounts)n=this.resolveAddressTableLookups(t.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new MessageAccountKeys(this.staticAccountKeys,n)}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const n=this.header.numRequiredSignatures,ie=this.staticAccountKeys.length;if(t>=ie){const fe=t-ie,ae=this.addressTableLookups.reduce((le,pe)=>le+pe.writableIndexes.length,0);return fe<ae}else if(t>=this.header.numRequiredSignatures){const fe=t-n,le=ie-n-this.header.numReadonlyUnsignedAccounts;return fe<le}else{const fe=n-this.header.numReadonlySignedAccounts;return t<fe}}resolveAddressTableLookups(t){const n={writable:[],readonly:[]};for(const ie of this.addressTableLookups){const fe=t.find(ae=>ae.key.equals(ie.accountKey));if(!fe)throw new Error(`Failed to find address lookup table account for table key ${ie.accountKey.toBase58()}`);for(const ae of ie.writableIndexes)if(ae<fe.state.addresses.length)n.writable.push(fe.state.addresses[ae]);else throw new Error(`Failed to find address for index ${ae} in address lookup table ${ie.accountKey.toBase58()}`);for(const ae of ie.readonlyIndexes)if(ae<fe.state.addresses.length)n.readonly.push(fe.state.addresses[ae]);else throw new Error(`Failed to find address for index ${ae} in address lookup table ${ie.accountKey.toBase58()}`)}return n}static compile(t){const n=CompiledKeys.compile(t.instructions,t.payerKey),ie=new Array,fe={writable:new Array,readonly:new Array},ae=t.addressLookupTableAccounts||[];for(const xe of ae){const Ee=n.extractTableLookup(xe);if(Ee!==void 0){const[Se,{writable:Me,readonly:Be}]=Ee;ie.push(Se),fe.writable.push(...Me),fe.readonly.push(...Be)}}const[le,pe]=n.getMessageComponents(),ye=new MessageAccountKeys(pe,fe).compileInstructions(t.instructions);return new MessageV0({header:le,staticAccountKeys:pe,recentBlockhash:t.recentBlockhash,compiledInstructions:ye,addressTableLookups:ie})}serialize(){const t=Array();encodeLength(t,this.staticAccountKeys.length);const n=this.serializeInstructions(),ie=Array();encodeLength(ie,this.compiledInstructions.length);const fe=this.serializeAddressTableLookups(),ae=Array();encodeLength(ae,this.addressTableLookups.length);const le=struct([u8("prefix"),struct([u8("numRequiredSignatures"),u8("numReadonlySignedAccounts"),u8("numReadonlyUnsignedAccounts")],"header"),blob(t.length,"staticAccountKeysLength"),seq(publicKey$1(),this.staticAccountKeys.length,"staticAccountKeys"),publicKey$1("recentBlockhash"),blob(ie.length,"instructionsLength"),blob(n.length,"serializedInstructions"),blob(ae.length,"addressTableLookupsLength"),blob(fe.length,"serializedAddressTableLookups")]),pe=new Uint8Array(PACKET_DATA_SIZE),ye=le.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map(xe=>xe.toBytes()),recentBlockhash:o$1.decode(this.recentBlockhash),instructionsLength:new Uint8Array(ie),serializedInstructions:n,addressTableLookupsLength:new Uint8Array(ae),serializedAddressTableLookups:fe},pe);return pe.slice(0,ye)}serializeInstructions(){let t=0;const n=new Uint8Array(PACKET_DATA_SIZE);for(const ie of this.compiledInstructions){const fe=Array();encodeLength(fe,ie.accountKeyIndexes.length);const ae=Array();encodeLength(ae,ie.data.length);const le=struct([u8("programIdIndex"),blob(fe.length,"encodedAccountKeyIndexesLength"),seq(u8(),ie.accountKeyIndexes.length,"accountKeyIndexes"),blob(ae.length,"encodedDataLength"),blob(ie.data.length,"data")]);t+=le.encode({programIdIndex:ie.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(fe),accountKeyIndexes:ie.accountKeyIndexes,encodedDataLength:new Uint8Array(ae),data:ie.data},n,t)}return n.slice(0,t)}serializeAddressTableLookups(){let t=0;const n=new Uint8Array(PACKET_DATA_SIZE);for(const ie of this.addressTableLookups){const fe=Array();encodeLength(fe,ie.writableIndexes.length);const ae=Array();encodeLength(ae,ie.readonlyIndexes.length);const le=struct([publicKey$1("accountKey"),blob(fe.length,"encodedWritableIndexesLength"),seq(u8(),ie.writableIndexes.length,"writableIndexes"),blob(ae.length,"encodedReadonlyIndexesLength"),seq(u8(),ie.readonlyIndexes.length,"readonlyIndexes")]);t+=le.encode({accountKey:ie.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(fe),writableIndexes:ie.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(ae),readonlyIndexes:ie.readonlyIndexes},n,t)}return n.slice(0,t)}static deserialize(t){let n=[...t];const ie=guardedShift(n),fe=ie&VERSION_PREFIX_MASK;assert$9(ie!==fe,"Expected versioned message but received legacy message");const ae=fe;assert$9(ae===0,`Expected versioned message with version 0 but found version ${ae}`);const le={numRequiredSignatures:guardedShift(n),numReadonlySignedAccounts:guardedShift(n),numReadonlyUnsignedAccounts:guardedShift(n)},pe=[],me=decodeLength(n);for(let Be=0;Be<me;Be++)pe.push(new PublicKey(guardedSplice(n,0,PUBLIC_KEY_LENGTH)));const ye=o$1.encode(guardedSplice(n,0,PUBLIC_KEY_LENGTH)),xe=decodeLength(n),Ee=[];for(let Be=0;Be<xe;Be++){const $e=guardedShift(n),ke=decodeLength(n),Te=guardedSplice(n,0,ke),Ie=decodeLength(n),Fe=new Uint8Array(guardedSplice(n,0,Ie));Ee.push({programIdIndex:$e,accountKeyIndexes:Te,data:Fe})}const Se=decodeLength(n),Me=[];for(let Be=0;Be<Se;Be++){const $e=new PublicKey(guardedSplice(n,0,PUBLIC_KEY_LENGTH)),ke=decodeLength(n),Te=guardedSplice(n,0,ke),Ie=decodeLength(n),Fe=guardedSplice(n,0,Ie);Me.push({accountKey:$e,writableIndexes:Te,readonlyIndexes:Fe})}return new MessageV0({header:le,staticAccountKeys:pe,recentBlockhash:ye,compiledInstructions:Ee,addressTableLookups:Me})}}const VersionedMessage={deserializeMessageVersion(c){const t=c[0],n=t&VERSION_PREFIX_MASK;return n===t?"legacy":n},deserialize:c=>{const t=VersionedMessage.deserializeMessageVersion(c);if(t==="legacy")return Message.from(c);if(t===0)return MessageV0.deserialize(c);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let TransactionStatus=function(c){return c[c.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",c[c.PROCESSED=1]="PROCESSED",c[c.TIMED_OUT=2]="TIMED_OUT",c[c.NONCE_INVALID=3]="NONCE_INVALID",c}({});const DEFAULT_SIGNATURE=dist$1.Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);class TransactionInstruction{constructor(t){this.keys=void 0,this.programId=void 0,this.data=dist$1.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:n,isWritable:ie})=>({pubkey:t.toJSON(),isSigner:n,isWritable:ie})),programId:this.programId.toJSON(),data:[...this.data]}}}class Transaction{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:n,nonceInfo:ie}=t;this.minNonceContextSlot=n,this.nonceInfo=ie}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:n,lastValidBlockHeight:ie}=t;this.recentBlockhash=n,this.lastValidBlockHeight=ie}else{const{recentBlockhash:n,nonceInfo:ie}=t;ie&&(this.nonceInfo=ie),this.recentBlockhash=n}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(n=>{"instructions"in n?this.instructions=this.instructions.concat(n.instructions):"data"in n&&"programId"in n&&"keys"in n?this.instructions.push(n):this.instructions.push(new TransactionInstruction(n))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?n=[this.nonceInfo.nonceInstruction,...this.instructions]:n=this.instructions):(t=this.recentBlockhash,n=this.instructions),!t)throw new Error("Transaction recentBlockhash required");n.length<1&&console.warn("No instructions provided");let ie;if(this.feePayer)ie=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)ie=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let $e=0;$e<n.length;$e++)if(n[$e].programId===void 0)throw new Error(`Transaction instruction index ${$e} has undefined program id`);const fe=[],ae=[];n.forEach($e=>{$e.keys.forEach(Te=>{ae.push({...Te})});const ke=$e.programId.toString();fe.includes(ke)||fe.push(ke)}),fe.forEach($e=>{ae.push({pubkey:new PublicKey($e),isSigner:!1,isWritable:!1})});const le=[];ae.forEach($e=>{const ke=$e.pubkey.toString(),Te=le.findIndex(Ie=>Ie.pubkey.toString()===ke);Te>-1?(le[Te].isWritable=le[Te].isWritable||$e.isWritable,le[Te].isSigner=le[Te].isSigner||$e.isSigner):le.push($e)}),le.sort(function($e,ke){if($e.isSigner!==ke.isSigner)return $e.isSigner?-1:1;if($e.isWritable!==ke.isWritable)return $e.isWritable?-1:1;const Te={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return $e.pubkey.toBase58().localeCompare(ke.pubkey.toBase58(),"en",Te)});const pe=le.findIndex($e=>$e.pubkey.equals(ie));if(pe>-1){const[$e]=le.splice(pe,1);$e.isSigner=!0,$e.isWritable=!0,le.unshift($e)}else le.unshift({pubkey:ie,isSigner:!0,isWritable:!0});for(const $e of this.signatures){const ke=le.findIndex(Te=>Te.pubkey.equals($e.publicKey));if(ke>-1)le[ke].isSigner||(le[ke].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${$e.publicKey.toString()}`)}let me=0,ye=0,xe=0;const Ee=[],Se=[];le.forEach(({pubkey:$e,isSigner:ke,isWritable:Te})=>{ke?(Ee.push($e.toString()),me+=1,Te||(ye+=1)):(Se.push($e.toString()),Te||(xe+=1))});const Me=Ee.concat(Se),Be=n.map($e=>{const{data:ke,programId:Te}=$e;return{programIdIndex:Me.indexOf(Te.toString()),accounts:$e.keys.map(Ie=>Me.indexOf(Ie.pubkey.toString())),data:o$1.encode(ke)}});return Be.forEach($e=>{assert$9($e.programIdIndex>=0),$e.accounts.forEach(ke=>assert$9(ke>=0))}),new Message({header:{numRequiredSignatures:me,numReadonlySignedAccounts:ye,numReadonlyUnsignedAccounts:xe},accountKeys:Me,recentBlockhash:t,instructions:Be})}_compile(){const t=this.compileMessage(),n=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===n.length&&this.signatures.every((fe,ae)=>n[ae].equals(fe.publicKey))||(this.signatures=n.map(ie=>({signature:null,publicKey:ie}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");const n=new Set;this.signatures=t.filter(ie=>{const fe=ie.toString();return n.has(fe)?!1:(n.add(fe),!0)}).map(ie=>({signature:null,publicKey:ie}))}sign(...t){if(t.length===0)throw new Error("No signers");const n=new Set,ie=[];for(const ae of t){const le=ae.publicKey.toString();n.has(le)||(n.add(le),ie.push(ae))}this.signatures=ie.map(ae=>({signature:null,publicKey:ae.publicKey}));const fe=this._compile();this._partialSign(fe,...ie)}partialSign(...t){if(t.length===0)throw new Error("No signers");const n=new Set,ie=[];for(const ae of t){const le=ae.publicKey.toString();n.has(le)||(n.add(le),ie.push(ae))}const fe=this._compile();this._partialSign(fe,...ie)}_partialSign(t,...n){const ie=t.serialize();n.forEach(fe=>{const ae=sign$2(ie,fe.secretKey);this._addSignature(fe.publicKey,toBuffer$1(ae))})}addSignature(t,n){this._compile(),this._addSignature(t,n)}_addSignature(t,n){assert$9(n.length===64);const ie=this.signatures.findIndex(fe=>t.equals(fe.publicKey));if(ie<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[ie].signature=dist$1.Buffer.from(n)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,n){const ie={};for(const{signature:fe,publicKey:ae}of this.signatures)fe===null?n&&(ie.missing||(ie.missing=[])).push(ae):verify$1(fe,t,ae.toBytes())||(ie.invalid||(ie.invalid=[])).push(ae);return ie.invalid||ie.missing?ie:void 0}serialize(t){const{requireAllSignatures:n,verifySignatures:ie}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),fe=this.serializeMessage();if(ie){const ae=this._getMessageSignednessErrors(fe,n);if(ae){let le="Signature verification failed.";throw ae.invalid&&(le+=`
17
+ `),ae===Chain.SKALE)return await skalePayment(n,le,me,Ee,pe,xe,ie);const Se=n.tokenAddress&&n.tokenAddress!==ZERO_ADDRESS;ie.waiting(`The payment is custom? ${Se}`),Se?await handleCustomTokenApproval(n,xe,me,ye,ie):n.tbdValues=n.tbdValues.map(Le=>parseInt(Le.toString(),10)),ie.waiting("Performing static call...");try{await Ee.callStatic.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{value:Se?BigNumber.from(0):n.totalPrice})}catch(Le){throw new Error("Transaction will fail: "+Le.message)}ie.waiting("Static Call done");let Me;try{Me=await getGasPrice$1(fe)}catch(Le){throw new Error("Failed to get gas price: "+Le.message)}ie.waiting(`Got gas price: ${Me}`),ie.waiting("Calling estimate gas...");let Be;try{Be=await Ee.estimateGas.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{value:Se?BigNumber.from(0):n.totalPrice})}catch(Le){throw new Error(`Gas estimation failed: ${Le.message}. Please check the transaction parameters.`)}ie.waiting(`gas estimation done: ${Be.toString()}`);const $e=Be.mul(105).div(100),ke=Se?BigNumber.from(0):BigNumber.from(n.totalPrice);ie.waiting(`Gas limit: ${$e.toString()}, gas price: ${Me.toString()}, base: ${ke.toString()}`);let Te;try{Te=await fe.getBalance(pe)}catch(Le){throw new Error("Failed to get user balance: "+Le.message)}ie.waiting(`User balance: ${Te}`);const Ie=ke.add($e.mul(Me));if(Te.lt(Ie))throw new InsufficientBalanceException;ie.waiting("Calling purchase...");const Fe=await Ee.droplinkedPurchase(n.tbdValues,n.tbdReceivers,n.tokenAddress,n.chainLinkRoundId,n.memo,{gasLimit:$e,value:Se?BigNumber.from(0):n.totalPrice});return ie.waiting("Waiting for transaction..."),await Fe.wait(),ie.waiting("Transaction done"),{transactionHash:Fe.hash,cryptoAmount:n.totalPrice}}catch(Se){handleError(Se)}},skalePayment=async function(c,t,n,ie,fe,ae,le){try{const pe=t===Network.TESTNET?SkaleUsdcAddressForTestnet:SkaleUsdcAddressForMainnet;return c.tokenAddress=pe,await handleCustomTokenApproval(c,ae,n,fe,le),{transactionHash:(await ie.droplinkedPurchase(c.tbdValues,c.tbdReceivers,pe,"0",c.memo)).hash,cryptoAmount:c.totalPrice}}catch(pe){handleError(pe)}};function handleError(c){var t;throw c instanceof Error?((t=c.code)==null?void 0:t.toString())==="ACTION_REJECTED"||c.message.includes("User denied")||c.message.includes("User cancelled transaction")?new UserDeniedException:c:new Error("An unknown error occurred")}async function claimNFT(c,t,n){console.log({data:c,chainConfig:t,context:n});const{modalInterface:ie}=n,fe=t.provider.getSigner(),ae=getShopABI();ie.waiting("Claiming NFTs...");const le=new Contract(n.shopContractAddress,ae,fe);try{ie.waiting("Claiming NFTs..."),console.log(DROPLINKED_MANAGER,c.signature.signature,{cart:c.signature.purchaseData.map(ye=>({amount:ye.amount,productId:ye.productId,nullifier:ye.nullifier})),shop:n.shopContractAddress});const pe=c.signature.purchaseData.map(ye=>({amount:ye.amount,productId:BigNumber.from(ye.productId),nullifier:BigNumber.from(ye.nullifier)})),me=await le.claimPurchase(DROPLINKED_MANAGER,c.signature.signature,{cart:pe,shop:n.shopContractAddress});return ie.waiting("Waiting for transaction..."),await me.wait(),ie.success("Claimed NFTs!"),{transactionHash:me.hash}}catch(pe){if(console.error(pe),pe.code&&pe.code.toString()==="ACTION_REJECTED")throw n.modalInterface.error("Transaction Rejected"),new Error("Transaction Rejected");try{const me=le.interface.parseError(pe.data);throw me.name==="OwnableUnauthorizedAccount"&&n.modalInterface.error(me.name),n.modalInterface.error(pe),pe}catch(me){throw ie.error(`Unexpected error: ${me}`),me}}}var TokenStandard=(c=>(c.ERC721="ERC721",c.ERC1155="ERC1155",c.ERC20="ERC20",c))(TokenStandard||{});const airdropABI=[{inputs:[],name:"ArrayLengthMismatch",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"airdropId",type:"string"}],name:"AirdropDone",type:"event"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address[]",name:"recipients",type:"address[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"string",name:"memo",type:"string"}],name:"distributeERC1155",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address[]",name:"recipients",type:"address[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"string",name:"memo",type:"string"}],name:"distributeERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address[]",name:"recipients",type:"address[]"},{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"},{internalType:"string",name:"memo",type:"string"}],name:"distributeERC721",outputs:[],stateMutability:"nonpayable",type:"function"}];async function sendTransaction(c,t,n,ie,fe){try{return await c.callStatic[t](...n),await c[t](...n)}catch(ae){throw fe.error(`Error simulating ${t} transaction ${ie+1}: ${ae.message}`),ae}}async function approveTokenForAirdrop(c,t,n,ie,fe){if(n!==TokenStandard.ERC1155)throw new Error("Only ERC1155 tokens are supported right now");const ae=["function setApprovalForAll(address, bool) public"],le=new Contract(t,ae,ie);fe.waiting("Approving token for airdrop..."),await(await le.setApprovalForAll(c,!0)).wait(),fe.waiting("Token approved for airdrop")}async function airdrop(c,t,n){const ie=t.modalInterface,fe=c.provider.getSigner();ie.waiting("Connecting to wallet..."),await checkWallet(fe,c.address),ie.waiting("Getting airdrop contract address...");const ae=await getAirdropAddress(c.chain,c.network),le=new Contract(ae,airdropABI,fe);await approveTokenForAirdrop(ae,n.tokenAddress,n.type,fe,ie),ie.waiting("Initializing airdrop");const pe=ye=>{const xe=[],Ee=[];for(const Se of ye)xe.push(Se.receiver),Ee.push(Se.amount);return{receivers:xe,amounts:Ee}},me=(ye,xe,Ee=300)=>{const Se=[];for(let Me=0;Me<ye.length;Me+=Ee)Se.push({receivers:ye.slice(Me,Me+Ee),amounts:xe.slice(Me,Me+Ee)});return Se};try{let ye;const{receivers:xe,amounts:Ee}=pe(n.receivers),Se=n.chunkSize||300,Me=me(xe,Ee,Se),Be=[];for(const[$e,ke]of Me.entries())ie.waiting(`Processing transaction ${$e+1} of ${Me.length}`),n.type===TokenStandard.ERC1155?ye=await sendTransaction(le,"distributeERC1155",[n.tokenAddress,n.tokenId,ke.receivers,ke.amounts,n.airdropId],$e,ie):n.type===TokenStandard.ERC20?ye=await sendTransaction(le,"distributeERC20",[n.tokenAddress,ke.receivers,ke.amounts,n.airdropId],$e,ie):n.type===TokenStandard.ERC721&&(ye=await sendTransaction(le,"distributeERC721",[n.tokenAddress,ke.receivers,ke.amounts,n.airdropId],$e,ie)),ie.waiting(`Transaction ${$e+1} sent: ${ye.hash}`),Be.push(ye.hash),await ye.wait(),ie.waiting(`Transaction ${$e+1} confirmed`);return{transactionHashes:Be}}catch(ye){if(ye.code&&ye.code.toString()==="ACTION_REJECTED")throw t.modalInterface.error("Transaction Rejected"),new Error("Transaction Rejected");try{const xe=le.interface.parseError(ye.data);throw t.modalInterface.error(xe.name),t.modalInterface.error(ye),ye}catch(xe){throw t.modalInterface.error(`Unexpected error: ${xe}`),xe}}}async function getShopInfo(c,t,n){const ie=(await(await n.get(`shops/v2/public/${t}`)).json()).data.deployedContracts.filter(fe=>fe.type===c);return ie.length===0?{nftContractAddress:"",shopContractAddress:""}:{nftContractAddress:ie[0].deployedNFTAddress,shopContractAddress:ie[0].deployedShopAddress}}async function getProductData(c,t){return(await(await t.get(`product-v2/public/${c}`)).json()).data}async function transformProductData(c,t){const n=await getProductData(c,t);if(!n||n.skus.length===0)throw new Error("Product not found or no SKUs available");return{productData:{acceptsManageWallet:!0,commission:n.affiliate.commissionPercent||0,description:n.description,productTitle:n.title,royalty:n.skus[0].royalty||0,type:ProductType[n.type.toUpperCase()]||ProductType.DIGITAL},skuData:n.skus.map(ie=>{var fe;return{amount:ie.inventory.quantity,imageUrl:((fe=n.images[n.defaultImageIndex])==null?void 0:fe.original)||"",skuID:ie.id,skuProperties:ie}})}}async function web3Callback(c,t,n,ie){const fe={"X-API-KEY":"ho8homr9e8p4fwii7tjiz41xs4hlbl2h4i"};return(await(await ky.create({headers:fe,prefixUrl:n==="TESTNET"?"https://web3dev.droplinked.com/":"https://web3.droplinked.com/"}).post("transactions",{json:{transaction_id:c,callback_url:ie,chain:t,network:n},headers:fe})).json()).data}async function startRecord(c,t,n,ie,fe,ae){return(await(await ae.post("web3/record/transactions",{json:{uris:fe,network:ie,data:{productId:c,skuIds:t},productId:c,skuIds:t,metadata:{},shopId:n,txType:"RECORD"}})).json()).data.id}async function startPayment(c,t,n,ie,fe,ae){return(await(await ae.post("web3/payment/transactions",{json:{network:n,token:t,shopId:fe,orderId:c}})).json()).data.data}class EVMProvider{constructor(t,n,ie){this.chain=Chain.BINANCE,this.network=Network.TESTNET,this.modalInterface=new defaultModal,this.wallet=ChainWallet.Metamask,this.chain=t,this.network=n,this.gasPredictable=ie,this.address=ZERO_ADDRESS,this.axiosInstance=ky.create({prefixUrl:this.network===Network.MAINNET?"https://apiv3.droplinked.com":"https://apiv3dev.droplinked.com"})}unstoppableLogin(t,n){throw new Error("Method not implemented.")}getBaseUrl(){return this.network===Network.MAINNET?"https://apiv3.droplinked.com":this.network===Network.TESTNET?"https://apiv3dev.droplinked.com":"http://127.0.0.1:3000"}setAxiosInstance(t){return this.axiosInstance=t,this}setNFTContractAddress(t){return this.nftContractAddress=t,this}setShopContractAddress(t){return this.shopContractAddress=t,this}setWallet(t){return this.wallet=t,this}setModal(t){return this.modalInterface=t,this}async customPayment(t){return await this.handleChain(),await droplinked_payment(this.getChainConfig(),this.getContext(),t)}async claimNFTs(t){return await this.handleWallet(this.address),await this.handleChain(),(await claimNFT(t,this.getChainConfig(),this.getContext())).transactionHash}getWalletProvider(){const t=window.ethereum;if(!t)throw new WalletNotFoundException;if(t.providerMap)if(this.wallet===ChainWallet.Metamask){if(!t.providerMap.get("MetaMask"))throw new WalletNotFoundException;return new Web3Provider(t.providers.find(n=>n.isMetaMask))}else if(this.wallet===ChainWallet.CoinBase){if(!t.providerMap.get("CoinbaseWallet"))throw new WalletNotFoundException;return new Web3Provider(t.providers.find(n=>n.isCoinbaseWallet))}else if(this.wallet===ChainWallet.Phantom){if(!t.providerMap.get("CoinbaseWallet"))throw new WalletNotFoundException;return new Web3Provider(t.providers.find(n=>n.isCoinbaseWallet))}else throw new Error("Wallet not implemented");else{if(this.wallet===ChainWallet.CoinBase){if(!window.ethereum.isCoinbaseWallet)throw new WalletNotFoundException}else if(this.wallet===ChainWallet.Metamask&&!window.ethereum.isMetaMask)throw new WalletNotFoundException;return new Web3Provider(window.ethereum)}}async deployShop(t){return await this.handleWallet(this.address),await this.handleChain(),await deployEVMShop(this.getChainConfig(),{axiosInstance:this.axiosInstance,modalInterface:this.modalInterface},t)}setAddress(t){return this.address=t,this}async handleChain(){const t=this.getWalletProvider();await addChain(t,this.chain,this.network,this.modalInterface),await isChainCorrect(t.provider,this.chain,this.network)||(console.log("Changing chain..."),await changeChain(t.provider,this.chain,this.network))}async handleWallet(t){if(!isMetamaskInstalled())throw this.modalInterface.error("Metamask is not installed"),new WalletNotFoundException;this.modalInterface.waiting("Getting accounts...");const ie=this.getWalletProvider().provider,fe=await getAccounts(ie);if(!isWalletConnected(ie)||fe.length===0){this.modalInterface.waiting("Please connect your wallet");const{address:ae}=await this.walletLogin();t.toLocaleLowerCase()!==ae.toLocaleLowerCase()&&(await window.ethereum.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}),await this.handleWallet(t))}if(String(fe[0]).toLocaleLowerCase()!==t.toLocaleLowerCase()&&t!==""&&(this.modalInterface.waiting("Change your account based on the one you used to login..."),await window.ethereum.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}),this.handleWallet(t)),this.chain===Chain.SKALE){const ae=await(await this.axiosInstance.post("web3/sFuelDistribution",{json:{wallet:this.address,isTestnet:this.network===Network.TESTNET}})).json();console.log(ae)}this.modalInterface.success("Wallet connected")}getChainConfig(){return{address:this.address,chain:this.chain,network:this.network,provider:this.getWalletProvider(),gasPredictable:this.gasPredictable}}getContext(){return{axiosInstance:this.axiosInstance,modalInterface:this.modalInterface,nftContract:this.nftContractAddress,shopContractAddress:this.shopContractAddress}}async walletLogin(){const{address:t,signature:n,date:ie,nonce:fe}=await evmLogin(this.getWalletProvider(),this.chain,this.network,this.modalInterface,this.axiosInstance);return this.address=t,{address:t,signature:n,date:ie,nonce:fe}}checkDeployment(){if(!this.nftContractAddress)throw new Error("NFT contract address not set");if(!this.shopContractAddress)throw new Error("Shop contract address not set")}async recordProduct(t){const{productData:n,skuData:ie}=await transformProductData(t,this.axiosInstance);if(this.checkDeployment(),!this.shopId)throw new FieldNotFound("shopId");const fe=await startRecord(t,ie.map(me=>me.skuID),this.shopId,this.chain,[],this.axiosInstance);await this.handleWallet(this.address),await this.handleChain();const ae=await recordProduct(this.getChainConfig(),this.getContext(),n,ie);await updateUris(fe,ae.metadataUrls,this.axiosInstance),await updateHash(fe,ae.transactionHash,this.axiosInstance);const le=`${this.getBaseUrl()}/web3/record/callback/events/${fe}`;if(!await web3Callback(ae.transactionHash,this.chain,Network[this.network],le))throw new Web3CallbackFailed(`txHash: ${ae.transactionHash}`);return{...ae,transactionId:fe,transactionHashUrl:getTransactionLink({blockchain:this.chain,transactionHash:ae.transactionHash,isTestnet:this.network!==Network.MAINNET})}}setShopId(t){return this.shopId=t,this}async executeAirdrop(t){const n=await getAirdropData(t,this.axiosInstance);return await this.handleWallet(this.address),await this.handleChain(),await airdrop(this.getChainConfig(),this.getContext(),{type:TokenStandard.ERC1155,airdropId:t,receivers:n.receivers,tokenAddress:n.tokenAddress,tokenId:n.tokenId,chunkSize:300})}async payment(t){await this.handleWallet(this.address),await this.handleChain();const{orderID:n,paymentToken:ie,paymentType:fe}=t;if(!this.shopId)throw new FieldNotFound("shopId");const ae=await startPayment(n,ie,fe,this.address,this.shopId,this.axiosInstance),le=await getCartData(n,ie,fe,this.axiosInstance),pe=le.paymentData;console.log({paymentData:pe});const me=await droplinked_payment(this.getChainConfig(),this.getContext(),pe);if(!await web3Callback(me.transactionHash,this.chain,Network[this.network],`${this.getBaseUrl()}/web3/payment/callback`))throw new Web3CallbackFailed(`txHash: ${me.transactionHash}`);return{...me,orderID:le.orderID,transactionId:ae}}async getPaymentData(t,n,ie){return await getCartData(t,ie,n,this.axiosInstance)}async paymentWithToken(t,n,ie,fe=18){await this.handleWallet(this.address),await this.handleChain();const ae=erc20ABI,le=this.getWalletProvider().getSigner(),pe=new Contract(ie,ae,le);try{await pe.callStatic.transfer(t,BigInt(Math.floor(n*1e6))*BigInt(10**(fe-6)));const me=(await pe.estimateGas.transfer(t,BigInt(Math.floor(n*1e6))*BigInt(10**(fe-6)))).toBigInt().valueOf(),ye=(await getGasPrice$1(this.getWalletProvider())).valueOf();return(await pe.transfer(t,BigInt(Math.floor(n*1e6))*BigInt(10**(fe-6)),{gasPrice:ye*BigInt(105)/BigInt(100),gasLimit:me*BigInt(105)/BigInt(100)})).hash}catch(me){throw me.reason?me.reason==="ERC20: transfer amount exceeds balance"?new Error("Insufficient token balance"):me.reason==="insufficient funds for gas * price + value"?new Error("Insufficient ETH balance"):me.reason==="bad result from backend"?new Error("Something went wrong, check your eth and token balance"):new Error(me.reason):me}}}var Web3Actions=(c=>(c.LOGIN="LOGIN",c.DEPLOY="DEPLOY",c.RECORD="RECORD",c.PAYMENT="PAYMENT",c.CLAIM="CLAIM",c.AIRDROP="AIRDROP",c))(Web3Actions||{});const crypto$2=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes(c){return c instanceof Uint8Array||ArrayBuffer.isView(c)&&c.constructor.name==="Uint8Array"}function anumber(c){if(!Number.isSafeInteger(c)||c<0)throw new Error("positive integer expected, got "+c)}function abytes(c,...t){if(!isBytes(c))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(c.length))throw new Error("Uint8Array expected of length "+t+", got length="+c.length)}function ahash(c){if(typeof c!="function"||typeof c.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");anumber(c.outputLen),anumber(c.blockLen)}function aexists(c,t=!0){if(c.destroyed)throw new Error("Hash instance has been destroyed");if(t&&c.finished)throw new Error("Hash#digest() has already been called")}function aoutput(c,t){abytes(c);const n=t.outputLen;if(c.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function clean(...c){for(let t=0;t<c.length;t++)c[t].fill(0)}function createView(c){return new DataView(c.buffer,c.byteOffset,c.byteLength)}function rotr(c,t){return c<<32-t|c>>>t}const hasHexBuiltin=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",hexes=Array.from({length:256},(c,t)=>t.toString(16).padStart(2,"0"));function bytesToHex(c){if(abytes(c),hasHexBuiltin)return c.toHex();let t="";for(let n=0;n<c.length;n++)t+=hexes[c[n]];return t}const asciis={_0:48,_9:57,A:65,F:70,a:97,f:102};function asciiToBase16(c){if(c>=asciis._0&&c<=asciis._9)return c-asciis._0;if(c>=asciis.A&&c<=asciis.F)return c-(asciis.A-10);if(c>=asciis.a&&c<=asciis.f)return c-(asciis.a-10)}function hexToBytes(c){if(typeof c!="string")throw new Error("hex string expected, got "+typeof c);if(hasHexBuiltin)return Uint8Array.fromHex(c);const t=c.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const ie=new Uint8Array(n);for(let fe=0,ae=0;fe<n;fe++,ae+=2){const le=asciiToBase16(c.charCodeAt(ae)),pe=asciiToBase16(c.charCodeAt(ae+1));if(le===void 0||pe===void 0){const me=c[ae]+c[ae+1];throw new Error('hex string expected, got non-hex character "'+me+'" at index '+ae)}ie[fe]=le*16+pe}return ie}function utf8ToBytes(c){if(typeof c!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(c))}function toBytes(c){return typeof c=="string"&&(c=utf8ToBytes(c)),abytes(c),c}function concatBytes(...c){let t=0;for(let ie=0;ie<c.length;ie++){const fe=c[ie];abytes(fe),t+=fe.length}const n=new Uint8Array(t);for(let ie=0,fe=0;ie<c.length;ie++){const ae=c[ie];n.set(ae,fe),fe+=ae.length}return n}class Hash{}function createHasher(c){const t=ie=>c().update(toBytes(ie)).digest(),n=c();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>c(),t}function randomBytes(c=32){if(crypto$2&&typeof crypto$2.getRandomValues=="function")return crypto$2.getRandomValues(new Uint8Array(c));if(crypto$2&&typeof crypto$2.randomBytes=="function")return Uint8Array.from(crypto$2.randomBytes(c));throw new Error("crypto.getRandomValues must be defined")}function setBigUint64(c,t,n,ie){if(typeof c.setBigUint64=="function")return c.setBigUint64(t,n,ie);const fe=BigInt(32),ae=BigInt(4294967295),le=Number(n>>fe&ae),pe=Number(n&ae),me=ie?4:0,ye=ie?0:4;c.setUint32(t+me,le,ie),c.setUint32(t+ye,pe,ie)}function Chi(c,t,n){return c&t^~c&n}function Maj(c,t,n){return c&t^c&n^t&n}class HashMD extends Hash{constructor(t,n,ie,fe){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=ie,this.isLE=fe,this.buffer=new Uint8Array(t),this.view=createView(this.buffer)}update(t){aexists(this),t=toBytes(t),abytes(t);const{view:n,buffer:ie,blockLen:fe}=this,ae=t.length;for(let le=0;le<ae;){const pe=Math.min(fe-this.pos,ae-le);if(pe===fe){const me=createView(t);for(;fe<=ae-le;le+=fe)this.process(me,le);continue}ie.set(t.subarray(le,le+pe),this.pos),this.pos+=pe,le+=pe,this.pos===fe&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){aexists(this),aoutput(t,this),this.finished=!0;const{buffer:n,view:ie,blockLen:fe,isLE:ae}=this;let{pos:le}=this;n[le++]=128,clean(this.buffer.subarray(le)),this.padOffset>fe-le&&(this.process(ie,0),le=0);for(let Ee=le;Ee<fe;Ee++)n[Ee]=0;setBigUint64(ie,fe-8,BigInt(this.length*8),ae),this.process(ie,0);const pe=createView(t),me=this.outputLen;if(me%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const ye=me/4,xe=this.get();if(ye>xe.length)throw new Error("_sha2: outputLen bigger than state");for(let Ee=0;Ee<ye;Ee++)pe.setUint32(4*Ee,xe[Ee],ae)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const ie=t.slice(0,n);return this.destroy(),ie}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:ie,length:fe,finished:ae,destroyed:le,pos:pe}=this;return t.destroyed=le,t.finished=ae,t.length=fe,t.pos=pe,fe%n&&t.buffer.set(ie),t}clone(){return this._cloneInto()}}const SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(c,t=!1){return t?{h:Number(c&U32_MASK64),l:Number(c>>_32n&U32_MASK64)}:{h:Number(c>>_32n&U32_MASK64)|0,l:Number(c&U32_MASK64)|0}}function split(c,t=!1){const n=c.length;let ie=new Uint32Array(n),fe=new Uint32Array(n);for(let ae=0;ae<n;ae++){const{h:le,l:pe}=fromBig(c[ae],t);[ie[ae],fe[ae]]=[le,pe]}return[ie,fe]}const shrSH=(c,t,n)=>c>>>n,shrSL=(c,t,n)=>c<<32-n|t>>>n,rotrSH=(c,t,n)=>c>>>n|t<<32-n,rotrSL=(c,t,n)=>c<<32-n|t>>>n,rotrBH=(c,t,n)=>c<<64-n|t>>>n-32,rotrBL=(c,t,n)=>c>>>n-32|t<<64-n;function add(c,t,n,ie){const fe=(t>>>0)+(ie>>>0);return{h:c+n+(fe/2**32|0)|0,l:fe|0}}const add3L=(c,t,n)=>(c>>>0)+(t>>>0)+(n>>>0),add3H=(c,t,n,ie)=>t+n+ie+(c/2**32|0)|0,add4L=(c,t,n,ie)=>(c>>>0)+(t>>>0)+(n>>>0)+(ie>>>0),add4H=(c,t,n,ie,fe)=>t+n+ie+fe+(c/2**32|0)|0,add5L=(c,t,n,ie,fe)=>(c>>>0)+(t>>>0)+(n>>>0)+(ie>>>0)+(fe>>>0),add5H=(c,t,n,ie,fe,ae)=>t+n+ie+fe+ae+(c/2**32|0)|0,SHA256_K=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),SHA256_W=new Uint32Array(64);class SHA256 extends HashMD{constructor(t=32){super(64,t,8,!1),this.A=SHA256_IV[0]|0,this.B=SHA256_IV[1]|0,this.C=SHA256_IV[2]|0,this.D=SHA256_IV[3]|0,this.E=SHA256_IV[4]|0,this.F=SHA256_IV[5]|0,this.G=SHA256_IV[6]|0,this.H=SHA256_IV[7]|0}get(){const{A:t,B:n,C:ie,D:fe,E:ae,F:le,G:pe,H:me}=this;return[t,n,ie,fe,ae,le,pe,me]}set(t,n,ie,fe,ae,le,pe,me){this.A=t|0,this.B=n|0,this.C=ie|0,this.D=fe|0,this.E=ae|0,this.F=le|0,this.G=pe|0,this.H=me|0}process(t,n){for(let Ee=0;Ee<16;Ee++,n+=4)SHA256_W[Ee]=t.getUint32(n,!1);for(let Ee=16;Ee<64;Ee++){const Se=SHA256_W[Ee-15],Me=SHA256_W[Ee-2],Be=rotr(Se,7)^rotr(Se,18)^Se>>>3,$e=rotr(Me,17)^rotr(Me,19)^Me>>>10;SHA256_W[Ee]=$e+SHA256_W[Ee-7]+Be+SHA256_W[Ee-16]|0}let{A:ie,B:fe,C:ae,D:le,E:pe,F:me,G:ye,H:xe}=this;for(let Ee=0;Ee<64;Ee++){const Se=rotr(pe,6)^rotr(pe,11)^rotr(pe,25),Me=xe+Se+Chi(pe,me,ye)+SHA256_K[Ee]+SHA256_W[Ee]|0,$e=(rotr(ie,2)^rotr(ie,13)^rotr(ie,22))+Maj(ie,fe,ae)|0;xe=ye,ye=me,me=pe,pe=le+Me|0,le=ae,ae=fe,fe=ie,ie=Me+$e|0}ie=ie+this.A|0,fe=fe+this.B|0,ae=ae+this.C|0,le=le+this.D|0,pe=pe+this.E|0,me=me+this.F|0,ye=ye+this.G|0,xe=xe+this.H|0,this.set(ie,fe,ae,le,pe,me,ye,xe)}roundClean(){clean(SHA256_W)}destroy(){this.set(0,0,0,0,0,0,0,0),clean(this.buffer)}}const K512=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(c=>BigInt(c))),SHA512_Kh=K512[0],SHA512_Kl=K512[1],SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends HashMD{constructor(t=64){super(128,t,16,!1),this.Ah=SHA512_IV[0]|0,this.Al=SHA512_IV[1]|0,this.Bh=SHA512_IV[2]|0,this.Bl=SHA512_IV[3]|0,this.Ch=SHA512_IV[4]|0,this.Cl=SHA512_IV[5]|0,this.Dh=SHA512_IV[6]|0,this.Dl=SHA512_IV[7]|0,this.Eh=SHA512_IV[8]|0,this.El=SHA512_IV[9]|0,this.Fh=SHA512_IV[10]|0,this.Fl=SHA512_IV[11]|0,this.Gh=SHA512_IV[12]|0,this.Gl=SHA512_IV[13]|0,this.Hh=SHA512_IV[14]|0,this.Hl=SHA512_IV[15]|0}get(){const{Ah:t,Al:n,Bh:ie,Bl:fe,Ch:ae,Cl:le,Dh:pe,Dl:me,Eh:ye,El:xe,Fh:Ee,Fl:Se,Gh:Me,Gl:Be,Hh:$e,Hl:ke}=this;return[t,n,ie,fe,ae,le,pe,me,ye,xe,Ee,Se,Me,Be,$e,ke]}set(t,n,ie,fe,ae,le,pe,me,ye,xe,Ee,Se,Me,Be,$e,ke){this.Ah=t|0,this.Al=n|0,this.Bh=ie|0,this.Bl=fe|0,this.Ch=ae|0,this.Cl=le|0,this.Dh=pe|0,this.Dl=me|0,this.Eh=ye|0,this.El=xe|0,this.Fh=Ee|0,this.Fl=Se|0,this.Gh=Me|0,this.Gl=Be|0,this.Hh=$e|0,this.Hl=ke|0}process(t,n){for(let Fe=0;Fe<16;Fe++,n+=4)SHA512_W_H[Fe]=t.getUint32(n),SHA512_W_L[Fe]=t.getUint32(n+=4);for(let Fe=16;Fe<80;Fe++){const Le=SHA512_W_H[Fe-15]|0,He=SHA512_W_L[Fe-15]|0,ze=rotrSH(Le,He,1)^rotrSH(Le,He,8)^shrSH(Le,He,7),Je=rotrSL(Le,He,1)^rotrSL(Le,He,8)^shrSL(Le,He,7),Xe=SHA512_W_H[Fe-2]|0,Ue=SHA512_W_L[Fe-2]|0,$t=rotrSH(Xe,Ue,19)^rotrBH(Xe,Ue,61)^shrSH(Xe,Ue,6),_e=rotrSL(Xe,Ue,19)^rotrBL(Xe,Ue,61)^shrSL(Xe,Ue,6),se=add4L(Je,_e,SHA512_W_L[Fe-7],SHA512_W_L[Fe-16]),ce=add4H(se,ze,$t,SHA512_W_H[Fe-7],SHA512_W_H[Fe-16]);SHA512_W_H[Fe]=ce|0,SHA512_W_L[Fe]=se|0}let{Ah:ie,Al:fe,Bh:ae,Bl:le,Ch:pe,Cl:me,Dh:ye,Dl:xe,Eh:Ee,El:Se,Fh:Me,Fl:Be,Gh:$e,Gl:ke,Hh:Te,Hl:Ie}=this;for(let Fe=0;Fe<80;Fe++){const Le=rotrSH(Ee,Se,14)^rotrSH(Ee,Se,18)^rotrBH(Ee,Se,41),He=rotrSL(Ee,Se,14)^rotrSL(Ee,Se,18)^rotrBL(Ee,Se,41),ze=Ee&Me^~Ee&$e,Je=Se&Be^~Se&ke,Xe=add5L(Ie,He,Je,SHA512_Kl[Fe],SHA512_W_L[Fe]),Ue=add5H(Xe,Te,Le,ze,SHA512_Kh[Fe],SHA512_W_H[Fe]),$t=Xe|0,_e=rotrSH(ie,fe,28)^rotrBH(ie,fe,34)^rotrBH(ie,fe,39),se=rotrSL(ie,fe,28)^rotrBL(ie,fe,34)^rotrBL(ie,fe,39),ce=ie&ae^ie&pe^ae&pe,de=fe&le^fe&me^le&me;Te=$e|0,Ie=ke|0,$e=Me|0,ke=Be|0,Me=Ee|0,Be=Se|0,{h:Ee,l:Se}=add(ye|0,xe|0,Ue|0,$t|0),ye=pe|0,xe=me|0,pe=ae|0,me=le|0,ae=ie|0,le=fe|0;const he=add3L($t,se,de);ie=add3H(he,Ue,_e,ce),fe=he|0}({h:ie,l:fe}=add(this.Ah|0,this.Al|0,ie|0,fe|0)),{h:ae,l:le}=add(this.Bh|0,this.Bl|0,ae|0,le|0),{h:pe,l:me}=add(this.Ch|0,this.Cl|0,pe|0,me|0),{h:ye,l:xe}=add(this.Dh|0,this.Dl|0,ye|0,xe|0),{h:Ee,l:Se}=add(this.Eh|0,this.El|0,Ee|0,Se|0),{h:Me,l:Be}=add(this.Fh|0,this.Fl|0,Me|0,Be|0),{h:$e,l:ke}=add(this.Gh|0,this.Gl|0,$e|0,ke|0),{h:Te,l:Ie}=add(this.Hh|0,this.Hl|0,Te|0,Ie|0),this.set(ie,fe,ae,le,pe,me,ye,xe,Ee,Se,Me,Be,$e,ke,Te,Ie)}roundClean(){clean(SHA512_W_H,SHA512_W_L)}destroy(){clean(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha256$5=createHasher(()=>new SHA256),sha512$3=createHasher(()=>new SHA512);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$5=BigInt(1);function _abool2(c,t=""){if(typeof c!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof c)}return c}function _abytes2(c,t,n=""){const ie=isBytes(c),fe=c==null?void 0:c.length,ae=t!==void 0;if(!ie||ae&&fe!==t){const le=n&&`"${n}" `,pe=ae?` of length ${t}`:"",me=ie?`length=${fe}`:`type=${typeof c}`;throw new Error(le+"expected Uint8Array"+pe+", got "+me)}return c}function numberToHexUnpadded(c){const t=c.toString(16);return t.length&1?"0"+t:t}function hexToNumber(c){if(typeof c!="string")throw new Error("hex string expected, got "+typeof c);return c===""?_0n$4:BigInt("0x"+c)}function bytesToNumberBE(c){return hexToNumber(bytesToHex(c))}function bytesToNumberLE(c){return abytes(c),hexToNumber(bytesToHex(Uint8Array.from(c).reverse()))}function numberToBytesBE(c,t){return hexToBytes(c.toString(16).padStart(t*2,"0"))}function numberToBytesLE(c,t){return numberToBytesBE(c,t).reverse()}function ensureBytes(c,t,n){let ie;if(typeof t=="string")try{ie=hexToBytes(t)}catch(ae){throw new Error(c+" must be hex string or Uint8Array, cause: "+ae)}else if(isBytes(t))ie=Uint8Array.from(t);else throw new Error(c+" must be hex string or Uint8Array");const fe=ie.length;if(typeof n=="number"&&fe!==n)throw new Error(c+" of length "+n+" expected, got "+fe);return ie}function copyBytes(c){return Uint8Array.from(c)}const isPosBig=c=>typeof c=="bigint"&&_0n$4<=c;function inRange$1(c,t,n){return isPosBig(c)&&isPosBig(t)&&isPosBig(n)&&t<=c&&c<n}function aInRange(c,t,n,ie){if(!inRange$1(t,n,ie))throw new Error("expected valid "+c+": "+n+" <= n < "+ie+", got "+t)}function bitLen(c){let t;for(t=0;c>_0n$4;c>>=_1n$5,t+=1);return t}const bitMask=c=>(_1n$5<<BigInt(c))-_1n$5;function createHmacDrbg(c,t,n){if(typeof c!="number"||c<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const ie=Me=>new Uint8Array(Me),fe=Me=>Uint8Array.of(Me);let ae=ie(c),le=ie(c),pe=0;const me=()=>{ae.fill(1),le.fill(0),pe=0},ye=(...Me)=>n(le,ae,...Me),xe=(Me=ie(0))=>{le=ye(fe(0),Me),ae=ye(),Me.length!==0&&(le=ye(fe(1),Me),ae=ye())},Ee=()=>{if(pe++>=1e3)throw new Error("drbg: tried 1000 values");let Me=0;const Be=[];for(;Me<t;){ae=ye();const $e=ae.slice();Be.push($e),Me+=ae.length}return concatBytes(...Be)};return(Me,Be)=>{me(),xe(Me);let $e;for(;!($e=Be(Ee()));)xe();return me(),$e}}function _validateObject(c,t,n={}){if(!c||typeof c!="object")throw new Error("expected valid options object");function ie(fe,ae,le){const pe=c[fe];if(le&&pe===void 0)return;const me=typeof pe;if(me!==ae||pe===null)throw new Error(`param "${fe}" is invalid: expected ${ae}, got ${me}`)}Object.entries(t).forEach(([fe,ae])=>ie(fe,ae,!1)),Object.entries(n).forEach(([fe,ae])=>ie(fe,ae,!0))}function memoized(c){const t=new WeakMap;return(n,...ie)=>{const fe=t.get(n);if(fe!==void 0)return fe;const ae=c(n,...ie);return t.set(n,ae),ae}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$3=BigInt(0),_1n$4=BigInt(1),_2n$4=BigInt(2),_3n$1=BigInt(3),_4n$1=BigInt(4),_5n$1=BigInt(5),_7n=BigInt(7),_8n$2=BigInt(8),_9n=BigInt(9),_16n=BigInt(16);function mod(c,t){const n=c%t;return n>=_0n$3?n:t+n}function pow2(c,t,n){let ie=c;for(;t-- >_0n$3;)ie*=ie,ie%=n;return ie}function invert(c,t){if(c===_0n$3)throw new Error("invert: expected non-zero number");if(t<=_0n$3)throw new Error("invert: expected positive modulus, got "+t);let n=mod(c,t),ie=t,fe=_0n$3,ae=_1n$4;for(;n!==_0n$3;){const pe=ie/n,me=ie%n,ye=fe-ae*pe;ie=n,n=me,fe=ae,ae=ye}if(ie!==_1n$4)throw new Error("invert: does not exist");return mod(fe,t)}function assertIsSquare(c,t,n){if(!c.eql(c.sqr(t),n))throw new Error("Cannot find square root")}function sqrt3mod4(c,t){const n=(c.ORDER+_1n$4)/_4n$1,ie=c.pow(t,n);return assertIsSquare(c,ie,t),ie}function sqrt5mod8(c,t){const n=(c.ORDER-_5n$1)/_8n$2,ie=c.mul(t,_2n$4),fe=c.pow(ie,n),ae=c.mul(t,fe),le=c.mul(c.mul(ae,_2n$4),fe),pe=c.mul(ae,c.sub(le,c.ONE));return assertIsSquare(c,pe,t),pe}function sqrt9mod16(c){const t=Field(c),n=tonelliShanks(c),ie=n(t,t.neg(t.ONE)),fe=n(t,ie),ae=n(t,t.neg(ie)),le=(c+_7n)/_16n;return(pe,me)=>{let ye=pe.pow(me,le),xe=pe.mul(ye,ie);const Ee=pe.mul(ye,fe),Se=pe.mul(ye,ae),Me=pe.eql(pe.sqr(xe),me),Be=pe.eql(pe.sqr(Ee),me);ye=pe.cmov(ye,xe,Me),xe=pe.cmov(Se,Ee,Be);const $e=pe.eql(pe.sqr(xe),me),ke=pe.cmov(ye,xe,$e);return assertIsSquare(pe,ke,me),ke}}function tonelliShanks(c){if(c<_3n$1)throw new Error("sqrt is not defined for small field");let t=c-_1n$4,n=0;for(;t%_2n$4===_0n$3;)t/=_2n$4,n++;let ie=_2n$4;const fe=Field(c);for(;FpLegendre(fe,ie)===1;)if(ie++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return sqrt3mod4;let ae=fe.pow(ie,t);const le=(t+_1n$4)/_2n$4;return function(me,ye){if(me.is0(ye))return ye;if(FpLegendre(me,ye)!==1)throw new Error("Cannot find square root");let xe=n,Ee=me.mul(me.ONE,ae),Se=me.pow(ye,t),Me=me.pow(ye,le);for(;!me.eql(Se,me.ONE);){if(me.is0(Se))return me.ZERO;let Be=1,$e=me.sqr(Se);for(;!me.eql($e,me.ONE);)if(Be++,$e=me.sqr($e),Be===xe)throw new Error("Cannot find square root");const ke=_1n$4<<BigInt(xe-Be-1),Te=me.pow(Ee,ke);xe=Be,Ee=me.sqr(Te),Se=me.mul(Se,Ee),Me=me.mul(Me,Te)}return Me}}function FpSqrt(c){return c%_4n$1===_3n$1?sqrt3mod4:c%_8n$2===_5n$1?sqrt5mod8:c%_16n===_9n?sqrt9mod16(c):tonelliShanks(c)}const isNegativeLE=(c,t)=>(mod(c,t)&_1n$4)===_1n$4,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(c){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=FIELD_FIELDS.reduce((ie,fe)=>(ie[fe]="function",ie),t);return _validateObject(c,n),c}function FpPow(c,t,n){if(n<_0n$3)throw new Error("invalid exponent, negatives unsupported");if(n===_0n$3)return c.ONE;if(n===_1n$4)return t;let ie=c.ONE,fe=t;for(;n>_0n$3;)n&_1n$4&&(ie=c.mul(ie,fe)),fe=c.sqr(fe),n>>=_1n$4;return ie}function FpInvertBatch(c,t,n=!1){const ie=new Array(t.length).fill(n?c.ZERO:void 0),fe=t.reduce((le,pe,me)=>c.is0(pe)?le:(ie[me]=le,c.mul(le,pe)),c.ONE),ae=c.inv(fe);return t.reduceRight((le,pe,me)=>c.is0(pe)?le:(ie[me]=c.mul(le,ie[me]),c.mul(le,pe)),ae),ie}function FpLegendre(c,t){const n=(c.ORDER-_1n$4)/_2n$4,ie=c.pow(t,n),fe=c.eql(ie,c.ONE),ae=c.eql(ie,c.ZERO),le=c.eql(ie,c.neg(c.ONE));if(!fe&&!ae&&!le)throw new Error("invalid Legendre symbol result");return fe?1:ae?0:-1}function nLength(c,t){t!==void 0&&anumber(t);const n=t!==void 0?t:c.toString(2).length,ie=Math.ceil(n/8);return{nBitLength:n,nByteLength:ie}}function Field(c,t,n=!1,ie={}){if(c<=_0n$3)throw new Error("invalid field: expected ORDER > 0, got "+c);let fe,ae,le=!1,pe;if(typeof t=="object"&&t!=null){if(ie.sqrt||n)throw new Error("cannot specify opts in two arguments");const Se=t;Se.BITS&&(fe=Se.BITS),Se.sqrt&&(ae=Se.sqrt),typeof Se.isLE=="boolean"&&(n=Se.isLE),typeof Se.modFromBytes=="boolean"&&(le=Se.modFromBytes),pe=Se.allowedLengths}else typeof t=="number"&&(fe=t),ie.sqrt&&(ae=ie.sqrt);const{nBitLength:me,nByteLength:ye}=nLength(c,fe);if(ye>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let xe;const Ee=Object.freeze({ORDER:c,isLE:n,BITS:me,BYTES:ye,MASK:bitMask(me),ZERO:_0n$3,ONE:_1n$4,allowedLengths:pe,create:Se=>mod(Se,c),isValid:Se=>{if(typeof Se!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof Se);return _0n$3<=Se&&Se<c},is0:Se=>Se===_0n$3,isValidNot0:Se=>!Ee.is0(Se)&&Ee.isValid(Se),isOdd:Se=>(Se&_1n$4)===_1n$4,neg:Se=>mod(-Se,c),eql:(Se,Me)=>Se===Me,sqr:Se=>mod(Se*Se,c),add:(Se,Me)=>mod(Se+Me,c),sub:(Se,Me)=>mod(Se-Me,c),mul:(Se,Me)=>mod(Se*Me,c),pow:(Se,Me)=>FpPow(Ee,Se,Me),div:(Se,Me)=>mod(Se*invert(Me,c),c),sqrN:Se=>Se*Se,addN:(Se,Me)=>Se+Me,subN:(Se,Me)=>Se-Me,mulN:(Se,Me)=>Se*Me,inv:Se=>invert(Se,c),sqrt:ae||(Se=>(xe||(xe=FpSqrt(c)),xe(Ee,Se))),toBytes:Se=>n?numberToBytesLE(Se,ye):numberToBytesBE(Se,ye),fromBytes:(Se,Me=!0)=>{if(pe){if(!pe.includes(Se.length)||Se.length>ye)throw new Error("Field.fromBytes: expected "+pe+" bytes, got "+Se.length);const $e=new Uint8Array(ye);$e.set(Se,n?0:$e.length-Se.length),Se=$e}if(Se.length!==ye)throw new Error("Field.fromBytes: expected "+ye+" bytes, got "+Se.length);let Be=n?bytesToNumberLE(Se):bytesToNumberBE(Se);if(le&&(Be=mod(Be,c)),!Me&&!Ee.isValid(Be))throw new Error("invalid field element: outside of range 0..ORDER");return Be},invertBatch:Se=>FpInvertBatch(Ee,Se),cmov:(Se,Me,Be)=>Be?Me:Se});return Object.freeze(Ee)}function getFieldBytesLength(c){if(typeof c!="bigint")throw new Error("field order must be bigint");const t=c.toString(2).length;return Math.ceil(t/8)}function getMinHashLength(c){const t=getFieldBytesLength(c);return t+Math.ceil(t/2)}function mapHashToField(c,t,n=!1){const ie=c.length,fe=getFieldBytesLength(t),ae=getMinHashLength(t);if(ie<16||ie<ae||ie>1024)throw new Error("expected "+ae+"-1024 bytes of input, got "+ie);const le=n?bytesToNumberLE(c):bytesToNumberBE(c),pe=mod(le,t-_1n$4)+_1n$4;return n?numberToBytesLE(pe,fe):numberToBytesBE(pe,fe)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$2=BigInt(0),_1n$3=BigInt(1);function negateCt(c,t){const n=t.negate();return c?n:t}function normalizeZ(c,t){const n=FpInvertBatch(c.Fp,t.map(ie=>ie.Z));return t.map((ie,fe)=>c.fromAffine(ie.toAffine(n[fe])))}function validateW(c,t){if(!Number.isSafeInteger(c)||c<=0||c>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+c)}function calcWOpts(c,t){validateW(c,t);const n=Math.ceil(t/c)+1,ie=2**(c-1),fe=2**c,ae=bitMask(c),le=BigInt(c);return{windows:n,windowSize:ie,mask:ae,maxNumber:fe,shiftBy:le}}function calcOffsets(c,t,n){const{windowSize:ie,mask:fe,maxNumber:ae,shiftBy:le}=n;let pe=Number(c&fe),me=c>>le;pe>ie&&(pe-=ae,me+=_1n$3);const ye=t*ie,xe=ye+Math.abs(pe)-1,Ee=pe===0,Se=pe<0,Me=t%2!==0;return{nextN:me,offset:xe,isZero:Ee,isNeg:Se,isNegF:Me,offsetF:ye}}function validateMSMPoints(c,t){if(!Array.isArray(c))throw new Error("array expected");c.forEach((n,ie)=>{if(!(n instanceof t))throw new Error("invalid point at index "+ie)})}function validateMSMScalars(c,t){if(!Array.isArray(c))throw new Error("array of scalars expected");c.forEach((n,ie)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+ie)})}const pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function getW(c){return pointWindowSizes.get(c)||1}function assert0(c){if(c!==_0n$2)throw new Error("invalid wNAF")}class wNAF{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,ie=this.ZERO){let fe=t;for(;n>_0n$2;)n&_1n$3&&(ie=ie.add(fe)),fe=fe.double(),n>>=_1n$3;return ie}precomputeWindow(t,n){const{windows:ie,windowSize:fe}=calcWOpts(n,this.bits),ae=[];let le=t,pe=le;for(let me=0;me<ie;me++){pe=le,ae.push(pe);for(let ye=1;ye<fe;ye++)pe=pe.add(le),ae.push(pe);le=pe.double()}return ae}wNAF(t,n,ie){if(!this.Fn.isValid(ie))throw new Error("invalid scalar");let fe=this.ZERO,ae=this.BASE;const le=calcWOpts(t,this.bits);for(let pe=0;pe<le.windows;pe++){const{nextN:me,offset:ye,isZero:xe,isNeg:Ee,isNegF:Se,offsetF:Me}=calcOffsets(ie,pe,le);ie=me,xe?ae=ae.add(negateCt(Se,n[Me])):fe=fe.add(negateCt(Ee,n[ye]))}return assert0(ie),{p:fe,f:ae}}wNAFUnsafe(t,n,ie,fe=this.ZERO){const ae=calcWOpts(t,this.bits);for(let le=0;le<ae.windows&&ie!==_0n$2;le++){const{nextN:pe,offset:me,isZero:ye,isNeg:xe}=calcOffsets(ie,le,ae);if(ie=pe,!ye){const Ee=n[me];fe=fe.add(xe?Ee.negate():Ee)}}return assert0(ie),fe}getPrecomputes(t,n,ie){let fe=pointPrecomputes.get(n);return fe||(fe=this.precomputeWindow(n,t),t!==1&&(typeof ie=="function"&&(fe=ie(fe)),pointPrecomputes.set(n,fe))),fe}cached(t,n,ie){const fe=getW(t);return this.wNAF(fe,this.getPrecomputes(fe,t,ie),n)}unsafe(t,n,ie,fe){const ae=getW(t);return ae===1?this._unsafeLadder(t,n,fe):this.wNAFUnsafe(ae,this.getPrecomputes(ae,t,ie),n,fe)}createCache(t,n){validateW(n,this.bits),pointWindowSizes.set(t,n),pointPrecomputes.delete(t)}hasCache(t){return getW(t)!==1}}function mulEndoUnsafe(c,t,n,ie){let fe=t,ae=c.ZERO,le=c.ZERO;for(;n>_0n$2||ie>_0n$2;)n&_1n$3&&(ae=ae.add(fe)),ie&_1n$3&&(le=le.add(fe)),fe=fe.double(),n>>=_1n$3,ie>>=_1n$3;return{p1:ae,p2:le}}function pippenger(c,t,n,ie){validateMSMPoints(n,c),validateMSMScalars(ie,t);const fe=n.length,ae=ie.length;if(fe!==ae)throw new Error("arrays of points and scalars must have equal length");const le=c.ZERO,pe=bitLen(BigInt(fe));let me=1;pe>12?me=pe-3:pe>4?me=pe-2:pe>0&&(me=2);const ye=bitMask(me),xe=new Array(Number(ye)+1).fill(le),Ee=Math.floor((t.BITS-1)/me)*me;let Se=le;for(let Me=Ee;Me>=0;Me-=me){xe.fill(le);for(let $e=0;$e<ae;$e++){const ke=ie[$e],Te=Number(ke>>BigInt(Me)&ye);xe[Te]=xe[Te].add(n[$e])}let Be=le;for(let $e=xe.length-1,ke=le;$e>0;$e--)ke=ke.add(xe[$e]),Be=Be.add(ke);if(Se=Se.add(Be),Me!==0)for(let $e=0;$e<me;$e++)Se=Se.double()}return Se}function createField(c,t,n){if(t){if(t.ORDER!==c)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return validateField(t),t}else return Field(c,{isLE:n})}function _createCurveFields(c,t,n={},ie){if(ie===void 0&&(ie=c==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${c} CURVE object`);for(const me of["p","n","h"]){const ye=t[me];if(!(typeof ye=="bigint"&&ye>_0n$2))throw new Error(`CURVE.${me} must be positive bigint`)}const fe=createField(t.p,n.Fp,ie),ae=createField(t.n,n.Fn,ie),pe=["Gx","Gy","a",c==="weierstrass"?"b":"d"];for(const me of pe)if(!fe.isValid(t[me]))throw new Error(`CURVE.${me} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:fe,Fn:ae}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$2=BigInt(1),_2n$3=BigInt(2),_8n$1=BigInt(8);function isEdValidXY(c,t,n,ie){const fe=c.sqr(n),ae=c.sqr(ie),le=c.add(c.mul(t.a,fe),ae),pe=c.add(c.ONE,c.mul(t.d,c.mul(fe,ae)));return c.eql(le,pe)}function edwards$1(c,t={}){const n=_createCurveFields("edwards",c,t,t.FpFnLE),{Fp:ie,Fn:fe}=n;let ae=n.CURVE;const{h:le}=ae;_validateObject(t,{},{uvRatio:"function"});const pe=_2n$3<<BigInt(fe.BYTES*8)-_1n$2,me=ke=>ie.create(ke),ye=t.uvRatio||((ke,Te)=>{try{return{isValid:!0,value:ie.sqrt(ie.div(ke,Te))}}catch{return{isValid:!1,value:_0n$1}}});if(!isEdValidXY(ie,ae,ae.Gx,ae.Gy))throw new Error("bad curve params: generator point");function xe(ke,Te,Ie=!1){const Fe=Ie?_1n$2:_0n$1;return aInRange("coordinate "+ke,Te,Fe,pe),Te}function Ee(ke){if(!(ke instanceof Be))throw new Error("ExtendedPoint expected")}const Se=memoized((ke,Te)=>{const{X:Ie,Y:Fe,Z:Le}=ke,He=ke.is0();Te==null&&(Te=He?_8n$1:ie.inv(Le));const ze=me(Ie*Te),Je=me(Fe*Te),Xe=ie.mul(Le,Te);if(He)return{x:_0n$1,y:_1n$2};if(Xe!==_1n$2)throw new Error("invZ was invalid");return{x:ze,y:Je}}),Me=memoized(ke=>{const{a:Te,d:Ie}=ae;if(ke.is0())throw new Error("bad point: ZERO");const{X:Fe,Y:Le,Z:He,T:ze}=ke,Je=me(Fe*Fe),Xe=me(Le*Le),Ue=me(He*He),$t=me(Ue*Ue),_e=me(Je*Te),se=me(Ue*me(_e+Xe)),ce=me($t+me(Ie*me(Je*Xe)));if(se!==ce)throw new Error("bad point: equation left != right (1)");const de=me(Fe*Le),he=me(He*ze);if(de!==he)throw new Error("bad point: equation left != right (2)");return!0});class Be{constructor(Te,Ie,Fe,Le){this.X=xe("x",Te),this.Y=xe("y",Ie),this.Z=xe("z",Fe,!0),this.T=xe("t",Le),Object.freeze(this)}static CURVE(){return ae}static fromAffine(Te){if(Te instanceof Be)throw new Error("extended point not allowed");const{x:Ie,y:Fe}=Te||{};return xe("x",Ie),xe("y",Fe),new Be(Ie,Fe,_1n$2,me(Ie*Fe))}static fromBytes(Te,Ie=!1){const Fe=ie.BYTES,{a:Le,d:He}=ae;Te=copyBytes(_abytes2(Te,Fe,"point")),_abool2(Ie,"zip215");const ze=copyBytes(Te),Je=Te[Fe-1];ze[Fe-1]=Je&-129;const Xe=bytesToNumberLE(ze),Ue=Ie?pe:ie.ORDER;aInRange("point.y",Xe,_0n$1,Ue);const $t=me(Xe*Xe),_e=me($t-_1n$2),se=me(He*$t-Le);let{isValid:ce,value:de}=ye(_e,se);if(!ce)throw new Error("bad point: invalid y coordinate");const he=(de&_1n$2)===_1n$2,ve=(Je&128)!==0;if(!Ie&&de===_0n$1&&ve)throw new Error("bad point: x=0 and x_0=1");return ve!==he&&(de=me(-de)),Be.fromAffine({x:de,y:Xe})}static fromHex(Te,Ie=!1){return Be.fromBytes(ensureBytes("point",Te),Ie)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(Te=8,Ie=!0){return $e.createCache(this,Te),Ie||this.multiply(_2n$3),this}assertValidity(){Me(this)}equals(Te){Ee(Te);const{X:Ie,Y:Fe,Z:Le}=this,{X:He,Y:ze,Z:Je}=Te,Xe=me(Ie*Je),Ue=me(He*Le),$t=me(Fe*Je),_e=me(ze*Le);return Xe===Ue&&$t===_e}is0(){return this.equals(Be.ZERO)}negate(){return new Be(me(-this.X),this.Y,this.Z,me(-this.T))}double(){const{a:Te}=ae,{X:Ie,Y:Fe,Z:Le}=this,He=me(Ie*Ie),ze=me(Fe*Fe),Je=me(_2n$3*me(Le*Le)),Xe=me(Te*He),Ue=Ie+Fe,$t=me(me(Ue*Ue)-He-ze),_e=Xe+ze,se=_e-Je,ce=Xe-ze,de=me($t*se),he=me(_e*ce),ve=me($t*ce),we=me(se*_e);return new Be(de,he,we,ve)}add(Te){Ee(Te);const{a:Ie,d:Fe}=ae,{X:Le,Y:He,Z:ze,T:Je}=this,{X:Xe,Y:Ue,Z:$t,T:_e}=Te,se=me(Le*Xe),ce=me(He*Ue),de=me(Je*Fe*_e),he=me(ze*$t),ve=me((Le+He)*(Xe+Ue)-se-ce),we=he-de,Ae=he+de,be=me(ce-Ie*se),ue=me(ve*we),ge=me(Ae*be),Re=me(ve*be),Ne=me(we*Ae);return new Be(ue,ge,Ne,Re)}subtract(Te){return this.add(Te.negate())}multiply(Te){if(!fe.isValidNot0(Te))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:Ie,f:Fe}=$e.cached(this,Te,Le=>normalizeZ(Be,Le));return normalizeZ(Be,[Ie,Fe])[0]}multiplyUnsafe(Te,Ie=Be.ZERO){if(!fe.isValid(Te))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return Te===_0n$1?Be.ZERO:this.is0()||Te===_1n$2?this:$e.unsafe(this,Te,Fe=>normalizeZ(Be,Fe),Ie)}isSmallOrder(){return this.multiplyUnsafe(le).is0()}isTorsionFree(){return $e.unsafe(this,ae.n).is0()}toAffine(Te){return Se(this,Te)}clearCofactor(){return le===_1n$2?this:this.multiplyUnsafe(le)}toBytes(){const{x:Te,y:Ie}=this.toAffine(),Fe=ie.toBytes(Ie);return Fe[Fe.length-1]|=Te&_1n$2?128:0,Fe}toHex(){return bytesToHex(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(Te){return normalizeZ(Be,Te)}static msm(Te,Ie){return pippenger(Be,fe,Te,Ie)}_setWindowSize(Te){this.precompute(Te)}toRawBytes(){return this.toBytes()}}Be.BASE=new Be(ae.Gx,ae.Gy,_1n$2,me(ae.Gx*ae.Gy)),Be.ZERO=new Be(_0n$1,_1n$2,_1n$2,_0n$1),Be.Fp=ie,Be.Fn=fe;const $e=new wNAF(Be,fe.BITS);return Be.BASE.precompute(8),Be}function eddsa$1(c,t,n={}){if(typeof t!="function")throw new Error('"hash" function param is required');_validateObject(n,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:ie}=n,{BASE:fe,Fp:ae,Fn:le}=c,pe=n.randomBytes||randomBytes,me=n.adjustScalarBytes||(Ue=>Ue),ye=n.domain||((Ue,$t,_e)=>{if(_abool2(_e,"phflag"),$t.length||_e)throw new Error("Contexts/pre-hash are not supported");return Ue});function xe(Ue){return le.create(bytesToNumberLE(Ue))}function Ee(Ue){const $t=Fe.secretKey;Ue=ensureBytes("private key",Ue,$t);const _e=ensureBytes("hashed private key",t(Ue),2*$t),se=me(_e.slice(0,$t)),ce=_e.slice($t,2*$t),de=xe(se);return{head:se,prefix:ce,scalar:de}}function Se(Ue){const{head:$t,prefix:_e,scalar:se}=Ee(Ue),ce=fe.multiply(se),de=ce.toBytes();return{head:$t,prefix:_e,scalar:se,point:ce,pointBytes:de}}function Me(Ue){return Se(Ue).pointBytes}function Be(Ue=Uint8Array.of(),...$t){const _e=concatBytes(...$t);return xe(t(ye(_e,ensureBytes("context",Ue),!!ie)))}function $e(Ue,$t,_e={}){Ue=ensureBytes("message",Ue),ie&&(Ue=ie(Ue));const{prefix:se,scalar:ce,pointBytes:de}=Se($t),he=Be(_e.context,se,Ue),ve=fe.multiply(he).toBytes(),we=Be(_e.context,ve,de,Ue),Ae=le.create(he+we*ce);if(!le.isValid(Ae))throw new Error("sign failed: invalid s");const be=concatBytes(ve,le.toBytes(Ae));return _abytes2(be,Fe.signature,"result")}const ke={zip215:!0};function Te(Ue,$t,_e,se=ke){const{context:ce,zip215:de}=se,he=Fe.signature;Ue=ensureBytes("signature",Ue,he),$t=ensureBytes("message",$t),_e=ensureBytes("publicKey",_e,Fe.publicKey),de!==void 0&&_abool2(de,"zip215"),ie&&($t=ie($t));const ve=he/2,we=Ue.subarray(0,ve),Ae=bytesToNumberLE(Ue.subarray(ve,he));let be,ue,ge;try{be=c.fromBytes(_e,de),ue=c.fromBytes(we,de),ge=fe.multiplyUnsafe(Ae)}catch{return!1}if(!de&&be.isSmallOrder())return!1;const Re=Be(ce,ue.toBytes(),be.toBytes(),$t);return ue.add(be.multiplyUnsafe(Re)).subtract(ge).clearCofactor().is0()}const Ie=ae.BYTES,Fe={secretKey:Ie,publicKey:Ie,signature:2*Ie,seed:Ie};function Le(Ue=pe(Fe.seed)){return _abytes2(Ue,Fe.seed,"seed")}function He(Ue){const $t=Xe.randomSecretKey(Ue);return{secretKey:$t,publicKey:Me($t)}}function ze(Ue){return isBytes(Ue)&&Ue.length===le.BYTES}function Je(Ue,$t){try{return!!c.fromBytes(Ue,$t)}catch{return!1}}const Xe={getExtendedPublicKey:Se,randomSecretKey:Le,isValidSecretKey:ze,isValidPublicKey:Je,toMontgomery(Ue){const{y:$t}=c.fromBytes(Ue),_e=Fe.publicKey,se=_e===32;if(!se&&_e!==57)throw new Error("only defined for 25519 and 448");const ce=se?ae.div(_1n$2+$t,_1n$2-$t):ae.div($t-_1n$2,$t+_1n$2);return ae.toBytes(ce)},toMontgomerySecret(Ue){const $t=Fe.secretKey;_abytes2(Ue,$t);const _e=t(Ue.subarray(0,$t));return me(_e).subarray(0,$t)},randomPrivateKey:Le,precompute(Ue=8,$t=c.BASE){return $t.precompute(Ue,!1)}};return Object.freeze({keygen:He,getPublicKey:Me,sign:$e,verify:Te,utils:Xe,Point:c,lengths:Fe})}function _eddsa_legacy_opts_to_new(c){const t={a:c.a,d:c.d,p:c.Fp.ORDER,n:c.n,h:c.h,Gx:c.Gx,Gy:c.Gy},n=c.Fp,ie=Field(t.n,c.nBitLength,!0),fe={Fp:n,Fn:ie,uvRatio:c.uvRatio},ae={randomBytes:c.randomBytes,adjustScalarBytes:c.adjustScalarBytes,domain:c.domain,prehash:c.prehash,mapToCurve:c.mapToCurve};return{CURVE:t,curveOpts:fe,hash:c.hash,eddsaOpts:ae}}function _eddsa_new_output_to_legacy(c,t){const n=t.Point;return Object.assign({},t,{ExtendedPoint:n,CURVE:c,nBitLength:n.Fn.BITS,nByteLength:n.Fn.BYTES})}function twistedEdwards(c){const{CURVE:t,curveOpts:n,hash:ie,eddsaOpts:fe}=_eddsa_legacy_opts_to_new(c),ae=edwards$1(t,n),le=eddsa$1(ae,ie,fe);return _eddsa_new_output_to_legacy(c,le)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _1n$1=BigInt(1),_2n$2=BigInt(2);BigInt(3);const _5n=BigInt(5),_8n=BigInt(8),ed25519_CURVE_p=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),ed25519_CURVE={p:ed25519_CURVE_p,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:_8n,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function ed25519_pow_2_252_3(c){const t=BigInt(10),n=BigInt(20),ie=BigInt(40),fe=BigInt(80),ae=ed25519_CURVE_p,pe=c*c%ae*c%ae,me=pow2(pe,_2n$2,ae)*pe%ae,ye=pow2(me,_1n$1,ae)*c%ae,xe=pow2(ye,_5n,ae)*ye%ae,Ee=pow2(xe,t,ae)*xe%ae,Se=pow2(Ee,n,ae)*Ee%ae,Me=pow2(Se,ie,ae)*Se%ae,Be=pow2(Me,fe,ae)*Me%ae,$e=pow2(Be,fe,ae)*Me%ae,ke=pow2($e,t,ae)*xe%ae;return{pow_p_5_8:pow2(ke,_2n$2,ae)*c%ae,b2:pe}}function adjustScalarBytes(c){return c[0]&=248,c[31]&=127,c[31]|=64,c}const ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function uvRatio(c,t){const n=ed25519_CURVE_p,ie=mod(t*t*t,n),fe=mod(ie*ie*t,n),ae=ed25519_pow_2_252_3(c*fe).pow_p_5_8;let le=mod(c*ie*ae,n);const pe=mod(t*le*le,n),me=le,ye=mod(le*ED25519_SQRT_M1,n),xe=pe===c,Ee=pe===mod(-c,n),Se=pe===mod(-c*ED25519_SQRT_M1,n);return xe&&(le=me),(Ee||Se)&&(le=ye),isNegativeLE(le,n)&&(le=mod(-le,n)),{isValid:xe||Ee,value:le}}const Fp=Field(ed25519_CURVE.p,{isLE:!0}),ed25519Defaults={...ed25519_CURVE,Fp,hash:sha512$3,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults);var safeBuffer$2={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(c,t){var n=dist$1,ie=n.Buffer;function fe(le,pe){for(var me in le)pe[me]=le[me]}ie.from&&ie.alloc&&ie.allocUnsafe&&ie.allocUnsafeSlow?c.exports=n:(fe(n,t),t.Buffer=ae);function ae(le,pe,me){return ie(le,pe,me)}ae.prototype=Object.create(ie.prototype),fe(ie,ae),ae.from=function(le,pe,me){if(typeof le=="number")throw new TypeError("Argument must not be a number");return ie(le,pe,me)},ae.alloc=function(le,pe,me){if(typeof le!="number")throw new TypeError("Argument must be a number");var ye=ie(le);return pe!==void 0?typeof me=="string"?ye.fill(pe,me):ye.fill(pe):ye.fill(0),ye},ae.allocUnsafe=function(le){if(typeof le!="number")throw new TypeError("Argument must be a number");return ie(le)},ae.allocUnsafeSlow=function(le){if(typeof le!="number")throw new TypeError("Argument must be a number");return n.SlowBuffer(le)}})(safeBuffer$2,safeBuffer$2.exports);var safeBufferExports=safeBuffer$2.exports,_Buffer=safeBufferExports.Buffer;function base$4(c){if(c.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var ie=0;ie<c.length;ie++){var fe=c.charAt(ie),ae=fe.charCodeAt(0);if(t[ae]!==255)throw new TypeError(fe+" is ambiguous");t[ae]=ie}var le=c.length,pe=c.charAt(0),me=Math.log(le)/Math.log(256),ye=Math.log(256)/Math.log(le);function xe(Me){if((Array.isArray(Me)||Me instanceof Uint8Array)&&(Me=_Buffer.from(Me)),!_Buffer.isBuffer(Me))throw new TypeError("Expected Buffer");if(Me.length===0)return"";for(var Be=0,$e=0,ke=0,Te=Me.length;ke!==Te&&Me[ke]===0;)ke++,Be++;for(var Ie=(Te-ke)*ye+1>>>0,Fe=new Uint8Array(Ie);ke!==Te;){for(var Le=Me[ke],He=0,ze=Ie-1;(Le!==0||He<$e)&&ze!==-1;ze--,He++)Le+=256*Fe[ze]>>>0,Fe[ze]=Le%le>>>0,Le=Le/le>>>0;if(Le!==0)throw new Error("Non-zero carry");$e=He,ke++}for(var Je=Ie-$e;Je!==Ie&&Fe[Je]===0;)Je++;for(var Xe=pe.repeat(Be);Je<Ie;++Je)Xe+=c.charAt(Fe[Je]);return Xe}function Ee(Me){if(typeof Me!="string")throw new TypeError("Expected String");if(Me.length===0)return _Buffer.alloc(0);for(var Be=0,$e=0,ke=0;Me[Be]===pe;)$e++,Be++;for(var Te=(Me.length-Be)*me+1>>>0,Ie=new Uint8Array(Te);Be<Me.length;){var Fe=Me.charCodeAt(Be);if(Fe>255)return;var Le=t[Fe];if(Le===255)return;for(var He=0,ze=Te-1;(Le!==0||He<ke)&&ze!==-1;ze--,He++)Le+=le*Ie[ze]>>>0,Ie[ze]=Le%256>>>0,Le=Le/256>>>0;if(Le!==0)throw new Error("Non-zero carry");ke=He,Be++}for(var Je=Te-ke;Je!==Te&&Ie[Je]===0;)Je++;var Xe=_Buffer.allocUnsafe($e+(Te-Je));Xe.fill(0,0,$e);for(var Ue=$e;Je!==Te;)Xe[Ue++]=Ie[Je++];return Xe}function Se(Me){var Be=Ee(Me);if(Be)return Be;throw new Error("Non-base"+le+" character")}return{encode:xe,decodeUnsafe:Ee,decode:Se}}var src$7=base$4;const e$1=getDefaultExportFromCjs$2(src$7);var basex=src$7,ALPHABET$1="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$2=basex(ALPHABET$1);const o$1=getDefaultExportFromCjs$2(bs58$2),sha256$4=sha256$5;var lib={};function inRange(c,t,n){return t<=c&&c<=n}function ToDictionary(c){if(c===void 0)return{};if(c===Object(c))return c;throw TypeError("Could not convert argument to dictionary")}function stringToCodePoints(c){for(var t=String(c),n=t.length,ie=0,fe=[];ie<n;){var ae=t.charCodeAt(ie);if(ae<55296||ae>57343)fe.push(ae);else if(56320<=ae&&ae<=57343)fe.push(65533);else if(55296<=ae&&ae<=56319)if(ie===n-1)fe.push(65533);else{var le=c.charCodeAt(ie+1);if(56320<=le&&le<=57343){var pe=ae&1023,me=le&1023;fe.push(65536+(pe<<10)+me),ie+=1}else fe.push(65533)}ie+=1}return fe}function codePointsToString(c){for(var t="",n=0;n<c.length;++n){var ie=c[n];ie<=65535?t+=String.fromCharCode(ie):(ie-=65536,t+=String.fromCharCode((ie>>10)+55296,(ie&1023)+56320))}return t}var end_of_stream=-1;function Stream(c){this.tokens=[].slice.call(c)}Stream.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():end_of_stream},prepend:function(c){if(Array.isArray(c))for(var t=c;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(c)},push:function(c){if(Array.isArray(c))for(var t=c;t.length;)this.tokens.push(t.shift());else this.tokens.push(c)}};var finished=-1;function decoderError(c,t){if(c)throw TypeError("Decoder error");return t||65533}var DEFAULT_ENCODING="utf-8";function TextDecoder$1(c,t){if(!(this instanceof TextDecoder$1))return new TextDecoder$1(c,t);if(c=c!==void 0?String(c).toLowerCase():DEFAULT_ENCODING,c!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");t=ToDictionary(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}TextDecoder$1.prototype={decode:function(t,n){var ie;typeof t=="object"&&t instanceof ArrayBuffer?ie=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?ie=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):ie=new Uint8Array(0),n=ToDictionary(n),this._streaming||(this._decoder=new UTF8Decoder({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!n.stream;for(var fe=new Stream(ie),ae=[],le;!fe.endOfStream()&&(le=this._decoder.handler(fe,fe.read()),le!==finished);)le!==null&&(Array.isArray(le)?ae.push.apply(ae,le):ae.push(le));if(!this._streaming){do{if(le=this._decoder.handler(fe,fe.read()),le===finished)break;le!==null&&(Array.isArray(le)?ae.push.apply(ae,le):ae.push(le))}while(!fe.endOfStream());this._decoder=null}return ae.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(ae[0]===65279?(this._BOMseen=!0,ae.shift()):this._BOMseen=!0),codePointsToString(ae)}};function TextEncoder$1(c,t){if(!(this instanceof TextEncoder$1))return new TextEncoder$1(c,t);if(c=c!==void 0?String(c).toLowerCase():DEFAULT_ENCODING,c!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");t=ToDictionary(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}TextEncoder$1.prototype={encode:function(t,n){t=t?String(t):"",n=ToDictionary(n),this._streaming||(this._encoder=new UTF8Encoder(this._options)),this._streaming=!!n.stream;for(var ie=[],fe=new Stream(stringToCodePoints(t)),ae;!fe.endOfStream()&&(ae=this._encoder.handler(fe,fe.read()),ae!==finished);)Array.isArray(ae)?ie.push.apply(ie,ae):ie.push(ae);if(!this._streaming){for(;ae=this._encoder.handler(fe,fe.read()),ae!==finished;)Array.isArray(ae)?ie.push.apply(ie,ae):ie.push(ae);this._encoder=null}return new Uint8Array(ie)}};function UTF8Decoder(c){var t=c.fatal,n=0,ie=0,fe=0,ae=128,le=191;this.handler=function(pe,me){if(me===end_of_stream&&fe!==0)return fe=0,decoderError(t);if(me===end_of_stream)return finished;if(fe===0){if(inRange(me,0,127))return me;if(inRange(me,194,223))fe=1,n=me-192;else if(inRange(me,224,239))me===224&&(ae=160),me===237&&(le=159),fe=2,n=me-224;else if(inRange(me,240,244))me===240&&(ae=144),me===244&&(le=143),fe=3,n=me-240;else return decoderError(t);return n=n<<6*fe,null}if(!inRange(me,ae,le))return n=fe=ie=0,ae=128,le=191,pe.prepend(me),decoderError(t);if(ae=128,le=191,ie+=1,n+=me-128<<6*(fe-ie),ie!==fe)return null;var ye=n;return n=fe=ie=0,ye}}function UTF8Encoder(c){c.fatal,this.handler=function(t,n){if(n===end_of_stream)return finished;if(inRange(n,0,127))return n;var ie,fe;inRange(n,128,2047)?(ie=1,fe=192):inRange(n,2048,65535)?(ie=2,fe=224):inRange(n,65536,1114111)&&(ie=3,fe=240);for(var ae=[(n>>6*ie)+fe];ie>0;){var le=n>>6*(ie-1);ae.push(128|le&63),ie-=1}return ae}}const encoding$1=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:TextDecoder$1,TextEncoder:TextEncoder$1},Symbol.toStringTag,{value:"Module"})),require$$2$2=getAugmentedNamespace(encoding$1);var __createBinding$b=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n),Object.defineProperty(c,ie,{enumerable:!0,get:function(){return t[n]}})}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$b=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__decorate=commonjsGlobal&&commonjsGlobal.__decorate||function(c,t,n,ie){var fe=arguments.length,ae=fe<3?t:ie===null?ie=Object.getOwnPropertyDescriptor(t,n):ie,le;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ae=Reflect.decorate(c,t,n,ie);else for(var pe=c.length-1;pe>=0;pe--)(le=c[pe])&&(ae=(fe<3?le(ae):fe>3?le(t,n,ae):le(t,n))||ae);return fe>3&&ae&&Object.defineProperty(t,n,ae),ae},__importStar$b=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.hasOwnProperty.call(c,n)&&__createBinding$b(t,c,n);return __setModuleDefault$b(t,c),t},__importDefault$a=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(lib,"__esModule",{value:!0});var deserializeUnchecked_1=lib.deserializeUnchecked=deserialize_1=lib.deserialize=serialize_1=lib.serialize=lib.BinaryReader=lib.BinaryWriter=lib.BorshError=lib.baseDecode=lib.baseEncode=void 0;const bn_js_1$1=__importDefault$a(bnExports$3),bs58_1$1=__importDefault$a(bs58$2),encoding=__importStar$b(require$$2$2),ResolvedTextDecoder=typeof TextDecoder!="function"?encoding.TextDecoder:TextDecoder,textDecoder=new ResolvedTextDecoder("utf-8",{fatal:!0});function baseEncode(c){return typeof c=="string"&&(c=Buffer$7.from(c,"utf8")),bs58_1$1.default.encode(Buffer$7.from(c))}lib.baseEncode=baseEncode;function baseDecode(c){return Buffer$7.from(bs58_1$1.default.decode(c))}lib.baseDecode=baseDecode;const INITIAL_LENGTH=1024;class BorshError extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}lib.BorshError=BorshError;class BinaryWriter{constructor(){this.buf=Buffer$7.alloc(INITIAL_LENGTH),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer$7.concat([this.buf,Buffer$7.alloc(INITIAL_LENGTH)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Buffer$7.from(new bn_js_1$1.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Buffer$7.concat([Buffer$7.from(this.buf.subarray(0,this.length)),t,Buffer$7.alloc(INITIAL_LENGTH)]),this.length+=t.length}writeString(t){this.maybeResize();const n=Buffer$7.from(t,"utf8");this.writeU32(n.length),this.writeBuffer(n)}writeFixedArray(t){this.writeBuffer(Buffer$7.from(t))}writeArray(t,n){this.maybeResize(),this.writeU32(t.length);for(const ie of t)this.maybeResize(),n(ie)}toArray(){return this.buf.subarray(0,this.length)}}lib.BinaryWriter=BinaryWriter;function handlingRangeError(c,t,n){const ie=n.value;n.value=function(...fe){try{return ie.apply(this,fe)}catch(ae){if(ae instanceof RangeError){const le=ae.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(le)>=0)throw new BorshError("Reached the end of buffer when deserializing")}throw ae}}}class BinaryReader{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new bn_js_1$1.default(t,"le")}readU128(){const t=this.readBuffer(16);return new bn_js_1$1.default(t,"le")}readU256(){const t=this.readBuffer(32);return new bn_js_1$1.default(t,"le")}readU512(){const t=this.readBuffer(64);return new bn_js_1$1.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new BorshError(`Expected buffer length ${t} isn't within bounds`);const n=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,n}readString(){const t=this.readU32(),n=this.readBuffer(t);try{return textDecoder.decode(n)}catch(ie){throw new BorshError(`Error decoding UTF-8 string: ${ie}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const n=this.readU32(),ie=Array();for(let fe=0;fe<n;++fe)ie.push(t());return ie}}__decorate([handlingRangeError],BinaryReader.prototype,"readU8",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU16",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU32",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU64",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU128",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU256",null);__decorate([handlingRangeError],BinaryReader.prototype,"readU512",null);__decorate([handlingRangeError],BinaryReader.prototype,"readString",null);__decorate([handlingRangeError],BinaryReader.prototype,"readFixedArray",null);__decorate([handlingRangeError],BinaryReader.prototype,"readArray",null);lib.BinaryReader=BinaryReader;function capitalizeFirstLetter(c){return c.charAt(0).toUpperCase()+c.slice(1)}function serializeField(c,t,n,ie,fe){try{if(typeof ie=="string")fe[`write${capitalizeFirstLetter(ie)}`](n);else if(ie instanceof Array)if(typeof ie[0]=="number"){if(n.length!==ie[0])throw new BorshError(`Expecting byte array of length ${ie[0]}, but got ${n.length} bytes`);fe.writeFixedArray(n)}else if(ie.length===2&&typeof ie[1]=="number"){if(n.length!==ie[1])throw new BorshError(`Expecting byte array of length ${ie[1]}, but got ${n.length} bytes`);for(let ae=0;ae<ie[1];ae++)serializeField(c,null,n[ae],ie[0],fe)}else fe.writeArray(n,ae=>{serializeField(c,t,ae,ie[0],fe)});else if(ie.kind!==void 0)switch(ie.kind){case"option":{n==null?fe.writeU8(0):(fe.writeU8(1),serializeField(c,t,n,ie.type,fe));break}case"map":{fe.writeU32(n.size),n.forEach((ae,le)=>{serializeField(c,t,le,ie.key,fe),serializeField(c,t,ae,ie.value,fe)});break}default:throw new BorshError(`FieldType ${ie} unrecognized`)}else serializeStruct(c,n,fe)}catch(ae){throw ae instanceof BorshError&&ae.addToFieldPath(t),ae}}function serializeStruct(c,t,n){if(typeof t.borshSerialize=="function"){t.borshSerialize(n);return}const ie=c.get(t.constructor);if(!ie)throw new BorshError(`Class ${t.constructor.name} is missing in schema`);if(ie.kind==="struct")ie.fields.map(([fe,ae])=>{serializeField(c,fe,t[fe],ae,n)});else if(ie.kind==="enum"){const fe=t[ie.field];for(let ae=0;ae<ie.values.length;++ae){const[le,pe]=ie.values[ae];if(le===fe){n.writeU8(ae),serializeField(c,le,t[le],pe,n);break}}}else throw new BorshError(`Unexpected schema kind: ${ie.kind} for ${t.constructor.name}`)}function serialize(c,t,n=BinaryWriter){const ie=new n;return serializeStruct(c,t,ie),ie.toArray()}var serialize_1=lib.serialize=serialize;function deserializeField(c,t,n,ie){try{if(typeof n=="string")return ie[`read${capitalizeFirstLetter(n)}`]();if(n instanceof Array){if(typeof n[0]=="number")return ie.readFixedArray(n[0]);if(typeof n[1]=="number"){const fe=[];for(let ae=0;ae<n[1];ae++)fe.push(deserializeField(c,null,n[0],ie));return fe}else return ie.readArray(()=>deserializeField(c,t,n[0],ie))}if(n.kind==="option")return ie.readU8()?deserializeField(c,t,n.type,ie):void 0;if(n.kind==="map"){let fe=new Map;const ae=ie.readU32();for(let le=0;le<ae;le++){const pe=deserializeField(c,t,n.key,ie),me=deserializeField(c,t,n.value,ie);fe.set(pe,me)}return fe}return deserializeStruct(c,n,ie)}catch(fe){throw fe instanceof BorshError&&fe.addToFieldPath(t),fe}}function deserializeStruct(c,t,n){if(typeof t.borshDeserialize=="function")return t.borshDeserialize(n);const ie=c.get(t);if(!ie)throw new BorshError(`Class ${t.name} is missing in schema`);if(ie.kind==="struct"){const fe={};for(const[ae,le]of c.get(t).fields)fe[ae]=deserializeField(c,ae,le,n);return new t(fe)}if(ie.kind==="enum"){const fe=n.readU8();if(fe>=ie.values.length)throw new BorshError(`Enum index: ${fe} is out of range`);const[ae,le]=ie.values[fe],pe=deserializeField(c,ae,le,n);return new t({[ae]:pe})}throw new BorshError(`Unexpected schema kind: ${ie.kind} for ${t.constructor.name}`)}function deserialize(c,t,n,ie=BinaryReader){const fe=new ie(n),ae=deserializeStruct(c,t,fe);if(fe.offset<n.length)throw new BorshError(`Unexpected ${n.length-fe.offset} bytes after deserialized data`);return ae}var deserialize_1=lib.deserialize=deserialize;function deserializeUnchecked(c,t,n,ie=BinaryReader){const fe=new ie(n);return deserializeStruct(c,t,fe)}deserializeUnchecked_1=lib.deserializeUnchecked=deserializeUnchecked;var Layout$1={};Object.defineProperty(Layout$1,"__esModule",{value:!0});Layout$1.s16=Layout$1.s8=Layout$1.nu64be=Layout$1.u48be=Layout$1.u40be=Layout$1.u32be=Layout$1.u24be=Layout$1.u16be=nu64=Layout$1.nu64=Layout$1.u48=Layout$1.u40=u32=Layout$1.u32=Layout$1.u24=u16=Layout$1.u16=u8=Layout$1.u8=offset=Layout$1.offset=Layout$1.greedy=Layout$1.Constant=Layout$1.UTF8=Layout$1.CString=Layout$1.Blob=Layout$1.Boolean=Layout$1.BitField=Layout$1.BitStructure=Layout$1.VariantLayout=Layout$1.Union=Layout$1.UnionLayoutDiscriminator=Layout$1.UnionDiscriminator=Layout$1.Structure=Layout$1.Sequence=Layout$1.DoubleBE=Layout$1.Double=Layout$1.FloatBE=Layout$1.Float=Layout$1.NearInt64BE=Layout$1.NearInt64=Layout$1.NearUInt64BE=Layout$1.NearUInt64=Layout$1.IntBE=Layout$1.Int=Layout$1.UIntBE=Layout$1.UInt=Layout$1.OffsetLayout=Layout$1.GreedyCount=Layout$1.ExternalLayout=Layout$1.bindConstructorLayout=Layout$1.nameWithProperty=Layout$1.Layout=Layout$1.uint8ArrayToBuffer=Layout$1.checkUint8Array=void 0;Layout$1.constant=Layout$1.utf8=Layout$1.cstr=blob=Layout$1.blob=Layout$1.unionLayoutDiscriminator=Layout$1.union=seq=Layout$1.seq=Layout$1.bits=struct=Layout$1.struct=Layout$1.f64be=Layout$1.f64=Layout$1.f32be=Layout$1.f32=Layout$1.ns64be=Layout$1.s48be=Layout$1.s40be=Layout$1.s32be=Layout$1.s24be=Layout$1.s16be=ns64=Layout$1.ns64=Layout$1.s48=Layout$1.s40=Layout$1.s32=Layout$1.s24=void 0;const buffer_1$2=dist$1;function checkUint8Array(c){if(!(c instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}Layout$1.checkUint8Array=checkUint8Array;function uint8ArrayToBuffer(c){return checkUint8Array(c),buffer_1$2.Buffer.from(c.buffer,c.byteOffset,c.length)}Layout$1.uint8ArrayToBuffer=uint8ArrayToBuffer;class Layout{constructor(t,n){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=n}makeDestinationObject(){return{}}getSpan(t,n){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const n=Object.create(this.constructor.prototype);return Object.assign(n,this),n.property=t,n}fromArray(t){}}Layout$1.Layout=Layout;function nameWithProperty(c,t){return t.property?c+"["+t.property+"]":c}Layout$1.nameWithProperty=nameWithProperty;function bindConstructorLayout(c,t){if(typeof c!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(c,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Layout))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");c.layout_=t,t.boundConstructor_=c,t.makeDestinationObject=()=>new c,Object.defineProperty(c.prototype,"encode",{value(n,ie){return t.encode(this,n,ie)},writable:!0}),Object.defineProperty(c,"decode",{value(n,ie){return t.decode(n,ie)},writable:!0})}Layout$1.bindConstructorLayout=bindConstructorLayout;class ExternalLayout extends Layout{isCount(){throw new Error("ExternalLayout is abstract")}}Layout$1.ExternalLayout=ExternalLayout;class GreedyCount extends ExternalLayout{constructor(t=1,n){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,n),this.elementSpan=t}isCount(){return!0}decode(t,n=0){checkUint8Array(t);const ie=t.length-n;return Math.floor(ie/this.elementSpan)}encode(t,n,ie){return 0}}Layout$1.GreedyCount=GreedyCount;class OffsetLayout extends ExternalLayout{constructor(t,n=0,ie){if(!(t instanceof Layout))throw new TypeError("layout must be a Layout");if(!Number.isInteger(n))throw new TypeError("offset must be integer or undefined");super(t.span,ie||t.property),this.layout=t,this.offset=n}isCount(){return this.layout instanceof UInt||this.layout instanceof UIntBE}decode(t,n=0){return this.layout.decode(t,n+this.offset)}encode(t,n,ie=0){return this.layout.encode(t,n,ie+this.offset)}}Layout$1.OffsetLayout=OffsetLayout;class UInt extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readUIntLE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeUIntLE(t,ie,this.span),this.span}}Layout$1.UInt=UInt;class UIntBE extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readUIntBE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeUIntBE(t,ie,this.span),this.span}}Layout$1.UIntBE=UIntBE;class Int extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readIntLE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeIntLE(t,ie,this.span),this.span}}Layout$1.Int=Int;class IntBE extends Layout{constructor(t,n){if(super(t,n),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,n=0){return uint8ArrayToBuffer(t).readIntBE(n,this.span)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeIntBE(t,ie,this.span),this.span}}Layout$1.IntBE=IntBE;const V2E32=Math.pow(2,32);function divmodInt64(c){const t=Math.floor(c/V2E32),n=c-t*V2E32;return{hi32:t,lo32:n}}function roundedInt64(c,t){return c*V2E32+t}class NearUInt64 extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readUInt32LE(n),ae=ie.readUInt32LE(n+4);return roundedInt64(ae,fe)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeUInt32LE(fe.lo32,ie),ae.writeUInt32LE(fe.hi32,ie+4),8}}Layout$1.NearUInt64=NearUInt64;class NearUInt64BE extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readUInt32BE(n),ae=ie.readUInt32BE(n+4);return roundedInt64(fe,ae)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeUInt32BE(fe.hi32,ie),ae.writeUInt32BE(fe.lo32,ie+4),8}}Layout$1.NearUInt64BE=NearUInt64BE;class NearInt64 extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readUInt32LE(n),ae=ie.readInt32LE(n+4);return roundedInt64(ae,fe)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeUInt32LE(fe.lo32,ie),ae.writeInt32LE(fe.hi32,ie+4),8}}Layout$1.NearInt64=NearInt64;class NearInt64BE extends Layout{constructor(t){super(8,t)}decode(t,n=0){const ie=uint8ArrayToBuffer(t),fe=ie.readInt32BE(n),ae=ie.readUInt32BE(n+4);return roundedInt64(fe,ae)}encode(t,n,ie=0){const fe=divmodInt64(t),ae=uint8ArrayToBuffer(n);return ae.writeInt32BE(fe.hi32,ie),ae.writeUInt32BE(fe.lo32,ie+4),8}}Layout$1.NearInt64BE=NearInt64BE;class Float extends Layout{constructor(t){super(4,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readFloatLE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeFloatLE(t,ie),4}}Layout$1.Float=Float;class FloatBE extends Layout{constructor(t){super(4,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readFloatBE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeFloatBE(t,ie),4}}Layout$1.FloatBE=FloatBE;class Double extends Layout{constructor(t){super(8,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readDoubleLE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeDoubleLE(t,ie),8}}Layout$1.Double=Double;class DoubleBE extends Layout{constructor(t){super(8,t)}decode(t,n=0){return uint8ArrayToBuffer(t).readDoubleBE(n)}encode(t,n,ie=0){return uint8ArrayToBuffer(n).writeDoubleBE(t,ie),8}}Layout$1.DoubleBE=DoubleBE;class Sequence extends Layout{constructor(t,n,ie){if(!(t instanceof Layout))throw new TypeError("elementLayout must be a Layout");if(!(n instanceof ExternalLayout&&n.isCount()||Number.isInteger(n)&&0<=n))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let fe=-1;!(n instanceof ExternalLayout)&&0<t.span&&(fe=n*t.span),super(fe,ie),this.elementLayout=t,this.count=n}getSpan(t,n=0){if(0<=this.span)return this.span;let ie=0,fe=this.count;if(fe instanceof ExternalLayout&&(fe=fe.decode(t,n)),0<this.elementLayout.span)ie=fe*this.elementLayout.span;else{let ae=0;for(;ae<fe;)ie+=this.elementLayout.getSpan(t,n+ie),++ae}return ie}decode(t,n=0){const ie=[];let fe=0,ae=this.count;for(ae instanceof ExternalLayout&&(ae=ae.decode(t,n));fe<ae;)ie.push(this.elementLayout.decode(t,n)),n+=this.elementLayout.getSpan(t,n),fe+=1;return ie}encode(t,n,ie=0){const fe=this.elementLayout,ae=t.reduce((le,pe)=>le+fe.encode(pe,n,ie+le),0);return this.count instanceof ExternalLayout&&this.count.encode(t.length,n,ie),ae}}Layout$1.Sequence=Sequence;class Structure extends Layout{constructor(t,n,ie){if(!(Array.isArray(t)&&t.reduce((ae,le)=>ae&&le instanceof Layout,!0)))throw new TypeError("fields must be array of Layout instances");typeof n=="boolean"&&ie===void 0&&(ie=n,n=void 0);for(const ae of t)if(0>ae.span&&ae.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let fe=-1;try{fe=t.reduce((ae,le)=>ae+le.getSpan(),0)}catch{}super(fe,n),this.fields=t,this.decodePrefixes=!!ie}getSpan(t,n=0){if(0<=this.span)return this.span;let ie=0;try{ie=this.fields.reduce((fe,ae)=>{const le=ae.getSpan(t,n);return n+=le,fe+le},0)}catch{throw new RangeError("indeterminate span")}return ie}decode(t,n=0){checkUint8Array(t);const ie=this.makeDestinationObject();for(const fe of this.fields)if(fe.property!==void 0&&(ie[fe.property]=fe.decode(t,n)),n+=fe.getSpan(t,n),this.decodePrefixes&&t.length===n)break;return ie}encode(t,n,ie=0){const fe=ie;let ae=0,le=0;for(const pe of this.fields){let me=pe.span;if(le=0<me?me:0,pe.property!==void 0){const ye=t[pe.property];ye!==void 0&&(le=pe.encode(ye,n,ie),0>me&&(me=pe.getSpan(n,ie)))}ae=ie,ie+=me}return ae+le-fe}fromArray(t){const n=this.makeDestinationObject();for(const ie of this.fields)ie.property!==void 0&&0<t.length&&(n[ie.property]=t.shift());return n}layoutFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const n of this.fields)if(n.property===t)return n}offsetOf(t){if(typeof t!="string")throw new TypeError("property must be string");let n=0;for(const ie of this.fields){if(ie.property===t)return n;0>ie.span?n=-1:0<=n&&(n+=ie.span)}}}Layout$1.Structure=Structure;class UnionDiscriminator{constructor(t){this.property=t}decode(t,n){throw new Error("UnionDiscriminator is abstract")}encode(t,n,ie){throw new Error("UnionDiscriminator is abstract")}}Layout$1.UnionDiscriminator=UnionDiscriminator;class UnionLayoutDiscriminator extends UnionDiscriminator{constructor(t,n){if(!(t instanceof ExternalLayout&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(n||t.property||"variant"),this.layout=t}decode(t,n){return this.layout.decode(t,n)}encode(t,n,ie){return this.layout.encode(t,n,ie)}}Layout$1.UnionLayoutDiscriminator=UnionLayoutDiscriminator;class Union extends Layout{constructor(t,n,ie){let fe;if(t instanceof UInt||t instanceof UIntBE)fe=new UnionLayoutDiscriminator(new OffsetLayout(t));else if(t instanceof ExternalLayout&&t.isCount())fe=new UnionLayoutDiscriminator(t);else if(t instanceof UnionDiscriminator)fe=t;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(n===void 0&&(n=null),!(n===null||n instanceof Layout))throw new TypeError("defaultLayout must be null or a Layout");if(n!==null){if(0>n.span)throw new Error("defaultLayout must have constant span");n.property===void 0&&(n=n.replicate("content"))}let ae=-1;n&&(ae=n.span,0<=ae&&(t instanceof UInt||t instanceof UIntBE)&&(ae+=fe.layout.span)),super(ae,ie),this.discriminator=fe,this.usesPrefixDiscriminator=t instanceof UInt||t instanceof UIntBE,this.defaultLayout=n,this.registry={};let le=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(pe){return le(pe)},this.configGetSourceVariant=function(pe){le=pe.bind(this)}}getSpan(t,n=0){if(0<=this.span)return this.span;const ie=this.getVariant(t,n);if(!ie)throw new Error("unable to determine span for unrecognized variant");return ie.getSpan(t,n)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const n=this.registry[t[this.discriminator.property]];if(n&&(!n.layout||n.property&&Object.prototype.hasOwnProperty.call(t,n.property)))return n}else for(const n in this.registry){const ie=this.registry[n];if(ie.property&&Object.prototype.hasOwnProperty.call(t,ie.property))return ie}throw new Error("unable to infer src variant")}decode(t,n=0){let ie;const fe=this.discriminator,ae=fe.decode(t,n),le=this.registry[ae];if(le===void 0){const pe=this.defaultLayout;let me=0;this.usesPrefixDiscriminator&&(me=fe.layout.span),ie=this.makeDestinationObject(),ie[fe.property]=ae,ie[pe.property]=pe.decode(t,n+me)}else ie=le.decode(t,n);return ie}encode(t,n,ie=0){const fe=this.getSourceVariant(t);if(fe===void 0){const ae=this.discriminator,le=this.defaultLayout;let pe=0;return this.usesPrefixDiscriminator&&(pe=ae.layout.span),ae.encode(t[ae.property],n,ie),pe+le.encode(t[le.property],n,ie+pe)}return fe.encode(t,n,ie)}addVariant(t,n,ie){const fe=new VariantLayout(this,t,n,ie);return this.registry[t]=fe,fe}getVariant(t,n=0){let ie;return t instanceof Uint8Array?ie=this.discriminator.decode(t,n):ie=t,this.registry[ie]}}Layout$1.Union=Union;class VariantLayout extends Layout{constructor(t,n,ie,fe){if(!(t instanceof Union))throw new TypeError("union must be a Union");if(!Number.isInteger(n)||0>n)throw new TypeError("variant must be a (non-negative) integer");if(typeof ie=="string"&&fe===void 0&&(fe=ie,ie=null),ie){if(!(ie instanceof Layout))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=ie.span&&ie.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof fe!="string")throw new TypeError("variant must have a String property")}let ae=t.span;0>t.span&&(ae=ie?ie.span:0,0<=ae&&t.usesPrefixDiscriminator&&(ae+=t.discriminator.layout.span)),super(ae,fe),this.union=t,this.variant=n,this.layout=ie||null}getSpan(t,n=0){if(0<=this.span)return this.span;let ie=0;this.union.usesPrefixDiscriminator&&(ie=this.union.discriminator.layout.span);let fe=0;return this.layout&&(fe=this.layout.getSpan(t,n+ie)),ie+fe}decode(t,n=0){const ie=this.makeDestinationObject();if(this!==this.union.getVariant(t,n))throw new Error("variant mismatch");let fe=0;return this.union.usesPrefixDiscriminator&&(fe=this.union.discriminator.layout.span),this.layout?ie[this.property]=this.layout.decode(t,n+fe):this.property?ie[this.property]=!0:this.union.usesPrefixDiscriminator&&(ie[this.union.discriminator.property]=this.variant),ie}encode(t,n,ie=0){let fe=0;if(this.union.usesPrefixDiscriminator&&(fe=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,n,ie);let ae=fe;if(this.layout&&(this.layout.encode(t[this.property],n,ie+fe),ae+=this.layout.getSpan(n,ie+fe),0<=this.union.span&&ae>this.union.span))throw new Error("encoded variant overruns containing union");return ae}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}Layout$1.VariantLayout=VariantLayout;function fixBitwiseResult(c){return 0>c&&(c+=4294967296),c}class BitStructure extends Layout{constructor(t,n,ie){if(!(t instanceof UInt||t instanceof UIntBE))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof n=="string"&&ie===void 0&&(ie=n,n=!1),4<t.span)throw new RangeError("word cannot exceed 32 bits");super(t.span,ie),this.word=t,this.msb=!!n,this.fields=[];let fe=0;this._packedSetValue=function(ae){return fe=fixBitwiseResult(ae),this},this._packedGetValue=function(){return fe}}decode(t,n=0){const ie=this.makeDestinationObject(),fe=this.word.decode(t,n);this._packedSetValue(fe);for(const ae of this.fields)ae.property!==void 0&&(ie[ae.property]=ae.decode(t));return ie}encode(t,n,ie=0){const fe=this.word.decode(n,ie);this._packedSetValue(fe);for(const ae of this.fields)if(ae.property!==void 0){const le=t[ae.property];le!==void 0&&ae.encode(le)}return this.word.encode(this._packedGetValue(),n,ie)}addField(t,n){const ie=new BitField(this,t,n);return this.fields.push(ie),ie}addBoolean(t){const n=new Boolean$1(this,t);return this.fields.push(n),n}fieldFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const n of this.fields)if(n.property===t)return n}}Layout$1.BitStructure=BitStructure;class BitField{constructor(t,n,ie){if(!(t instanceof BitStructure))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(n)||0>=n)throw new TypeError("bits must be positive integer");const fe=8*t.span,ae=t.fields.reduce((le,pe)=>le+pe.bits,0);if(n+ae>fe)throw new Error("bits too long for span remainder ("+(fe-ae)+" of "+fe+" remain)");this.container=t,this.bits=n,this.valueMask=(1<<n)-1,n===32&&(this.valueMask=4294967295),this.start=ae,this.container.msb&&(this.start=fe-ae-n),this.wordMask=fixBitwiseResult(this.valueMask<<this.start),this.property=ie}decode(t,n){const ie=this.container._packedGetValue();return fixBitwiseResult(ie&this.wordMask)>>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==fixBitwiseResult(t&this.valueMask))throw new TypeError(nameWithProperty("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const n=this.container._packedGetValue(),ie=fixBitwiseResult(t<<this.start);this.container._packedSetValue(fixBitwiseResult(n&~this.wordMask)|ie)}}Layout$1.BitField=BitField;let Boolean$1=class extends BitField{constructor(t,n){super(t,1,n)}decode(t,n){return!!super.decode(t,n)}encode(t){typeof t=="boolean"&&(t=+t),super.encode(t)}};Layout$1.Boolean=Boolean$1;let Blob$1=class extends Layout{constructor(t,n){if(!(t instanceof ExternalLayout&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let ie=-1;t instanceof ExternalLayout||(ie=t),super(ie,n),this.length=t}getSpan(t,n){let ie=this.span;return 0>ie&&(ie=this.length.decode(t,n)),ie}decode(t,n=0){let ie=this.span;return 0>ie&&(ie=this.length.decode(t,n)),uint8ArrayToBuffer(t).slice(n,n+ie)}encode(t,n,ie){let fe=this.length;if(this.length instanceof ExternalLayout&&(fe=t.length),!(t instanceof Uint8Array&&fe===t.length))throw new TypeError(nameWithProperty("Blob.encode",this)+" requires (length "+fe+") Uint8Array as src");if(ie+fe>n.length)throw new RangeError("encoding overruns Uint8Array");const ae=uint8ArrayToBuffer(t);return uint8ArrayToBuffer(n).write(ae.toString("hex"),ie,fe,"hex"),this.length instanceof ExternalLayout&&this.length.encode(fe,n,ie),fe}};Layout$1.Blob=Blob$1;class CString extends Layout{constructor(t){super(-1,t)}getSpan(t,n=0){checkUint8Array(t);let ie=n;for(;ie<t.length&&t[ie]!==0;)ie+=1;return 1+ie-n}decode(t,n=0){const ie=this.getSpan(t,n);return uint8ArrayToBuffer(t).slice(n,n+ie-1).toString("utf-8")}encode(t,n,ie=0){typeof t!="string"&&(t=String(t));const fe=buffer_1$2.Buffer.from(t,"utf8"),ae=fe.length;if(ie+ae>n.length)throw new RangeError("encoding overruns Buffer");const le=uint8ArrayToBuffer(n);return fe.copy(le,ie),le[ie+ae]=0,ae+1}}Layout$1.CString=CString;class UTF8 extends Layout{constructor(t,n){if(typeof t=="string"&&n===void 0&&(n=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,n),this.maxSpan=t}getSpan(t,n=0){return checkUint8Array(t),t.length-n}decode(t,n=0){const ie=this.getSpan(t,n);if(0<=this.maxSpan&&this.maxSpan<ie)throw new RangeError("text length exceeds maxSpan");return uint8ArrayToBuffer(t).slice(n,n+ie).toString("utf-8")}encode(t,n,ie=0){typeof t!="string"&&(t=String(t));const fe=buffer_1$2.Buffer.from(t,"utf8"),ae=fe.length;if(0<=this.maxSpan&&this.maxSpan<ae)throw new RangeError("text length exceeds maxSpan");if(ie+ae>n.length)throw new RangeError("encoding overruns Buffer");return fe.copy(uint8ArrayToBuffer(n),ie),ae}}Layout$1.UTF8=UTF8;class Constant extends Layout{constructor(t,n){super(0,n),this.value=t}decode(t,n){return this.value}encode(t,n,ie){return 0}}Layout$1.Constant=Constant;Layout$1.greedy=(c,t)=>new GreedyCount(c,t);var offset=Layout$1.offset=(c,t,n)=>new OffsetLayout(c,t,n),u8=Layout$1.u8=c=>new UInt(1,c),u16=Layout$1.u16=c=>new UInt(2,c);Layout$1.u24=c=>new UInt(3,c);var u32=Layout$1.u32=c=>new UInt(4,c);Layout$1.u40=c=>new UInt(5,c);Layout$1.u48=c=>new UInt(6,c);var nu64=Layout$1.nu64=c=>new NearUInt64(c);Layout$1.u16be=c=>new UIntBE(2,c);Layout$1.u24be=c=>new UIntBE(3,c);Layout$1.u32be=c=>new UIntBE(4,c);Layout$1.u40be=c=>new UIntBE(5,c);Layout$1.u48be=c=>new UIntBE(6,c);Layout$1.nu64be=c=>new NearUInt64BE(c);Layout$1.s8=c=>new Int(1,c);Layout$1.s16=c=>new Int(2,c);Layout$1.s24=c=>new Int(3,c);Layout$1.s32=c=>new Int(4,c);Layout$1.s40=c=>new Int(5,c);Layout$1.s48=c=>new Int(6,c);var ns64=Layout$1.ns64=c=>new NearInt64(c);Layout$1.s16be=c=>new IntBE(2,c);Layout$1.s24be=c=>new IntBE(3,c);Layout$1.s32be=c=>new IntBE(4,c);Layout$1.s40be=c=>new IntBE(5,c);Layout$1.s48be=c=>new IntBE(6,c);Layout$1.ns64be=c=>new NearInt64BE(c);Layout$1.f32=c=>new Float(c);Layout$1.f32be=c=>new FloatBE(c);Layout$1.f64=c=>new Double(c);Layout$1.f64be=c=>new DoubleBE(c);var struct=Layout$1.struct=(c,t,n)=>new Structure(c,t,n);Layout$1.bits=(c,t,n)=>new BitStructure(c,t,n);var seq=Layout$1.seq=(c,t,n)=>new Sequence(c,t,n);Layout$1.union=(c,t,n)=>new Union(c,t,n);Layout$1.unionLayoutDiscriminator=(c,t)=>new UnionLayoutDiscriminator(c,t);var blob=Layout$1.blob=(c,t)=>new Blob$1(c,t);Layout$1.cstr=c=>new CString(c);Layout$1.utf8=(c,t)=>new UTF8(c,t);Layout$1.constant=(c,t)=>new Constant(c,t);var browser$d={};Object.defineProperty(browser$d,"__esModule",{value:!0});function toBigIntLE(c){{const t=Buffer$7.from(c);t.reverse();const n=t.toString("hex");return n.length===0?BigInt(0):BigInt(`0x${n}`)}}var toBigIntLE_1=browser$d.toBigIntLE=toBigIntLE;function toBigIntBE(c){{const t=c.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}}browser$d.toBigIntBE=toBigIntBE;function toBufferLE(c,t){{const n=c.toString(16),ie=Buffer$7.from(n.padStart(t*2,"0").slice(0,t*2),"hex");return ie.reverse(),ie}}var toBufferLE_1=browser$d.toBufferLE=toBufferLE;function toBufferBE(c,t){{const n=c.toString(16);return Buffer$7.from(n.padStart(t*2,"0").slice(0,t*2),"hex")}}browser$d.toBufferBE=toBufferBE;class StructError extends TypeError{constructor(t,n){let ie;const{message:fe,explanation:ae,...le}=t,{path:pe}=t,me=pe.length===0?fe:`At path: ${pe.join(".")} -- ${fe}`;super(ae??me),ae!=null&&(this.cause=me),Object.assign(this,le),this.name=this.constructor.name,this.failures=()=>ie??(ie=[t,...n()])}}function isIterable(c){return isObject$1(c)&&typeof c[Symbol.iterator]=="function"}function isObject$1(c){return typeof c=="object"&&c!=null}function isNonArrayObject(c){return isObject$1(c)&&!Array.isArray(c)}function print$2(c){return typeof c=="symbol"?c.toString():typeof c=="string"?JSON.stringify(c):`${c}`}function shiftIterator(c){const{done:t,value:n}=c.next();return t?void 0:n}function toFailure(c,t,n,ie){if(c===!0)return;c===!1?c={}:typeof c=="string"&&(c={message:c});const{path:fe,branch:ae}=t,{type:le}=n,{refinement:pe,message:me=`Expected a value of type \`${le}\`${pe?` with refinement \`${pe}\``:""}, but received: \`${print$2(ie)}\``}=c;return{value:ie,type:le,refinement:pe,key:fe[fe.length-1],path:fe,branch:ae,...c,message:me}}function*toFailures(c,t,n,ie){isIterable(c)||(c=[c]);for(const fe of c){const ae=toFailure(fe,t,n,ie);ae&&(yield ae)}}function*run(c,t,n={}){const{path:ie=[],branch:fe=[c],coerce:ae=!1,mask:le=!1}=n,pe={path:ie,branch:fe,mask:le};ae&&(c=t.coercer(c,pe));let me="valid";for(const ye of t.validator(c,pe))ye.explanation=n.message,me="not_valid",yield[ye,void 0];for(let[ye,xe,Ee]of t.entries(c,pe)){const Se=run(xe,Ee,{path:ye===void 0?ie:[...ie,ye],branch:ye===void 0?fe:[...fe,xe],coerce:ae,mask:le,message:n.message});for(const Me of Se)Me[0]?(me=Me[0].refinement!=null?"not_refined":"not_valid",yield[Me[0],void 0]):ae&&(xe=Me[1],ye===void 0?c=xe:c instanceof Map?c.set(ye,xe):c instanceof Set?c.add(xe):isObject$1(c)&&(xe!==void 0||ye in c)&&(c[ye]=xe))}if(me!=="not_valid")for(const ye of t.refiner(c,pe))ye.explanation=n.message,me="not_refined",yield[ye,void 0];me==="valid"&&(yield[void 0,c])}let Struct$1=class{constructor(t){const{type:n,schema:ie,validator:fe,refiner:ae,coercer:le=me=>me,entries:pe=function*(){}}=t;this.type=n,this.schema=ie,this.entries=pe,this.coercer=le,fe?this.validator=(me,ye)=>{const xe=fe(me,ye);return toFailures(xe,ye,this,me)}:this.validator=()=>[],ae?this.refiner=(me,ye)=>{const xe=ae(me,ye);return toFailures(xe,ye,this,me)}:this.refiner=()=>[]}assert(t,n){return assert$a(t,this,n)}create(t,n){return create(t,this,n)}is(t){return is(t,this)}mask(t,n){return mask(t,this,n)}validate(t,n={}){return validate$1(t,this,n)}};function assert$a(c,t,n){const ie=validate$1(c,t,{message:n});if(ie[0])throw ie[0]}function create(c,t,n){const ie=validate$1(c,t,{coerce:!0,message:n});if(ie[0])throw ie[0];return ie[1]}function mask(c,t,n){const ie=validate$1(c,t,{coerce:!0,mask:!0,message:n});if(ie[0])throw ie[0];return ie[1]}function is(c,t){return!validate$1(c,t)[0]}function validate$1(c,t,n={}){const ie=run(c,t,n),fe=shiftIterator(ie);return fe[0]?[new StructError(fe[0],function*(){for(const le of ie)le[0]&&(yield le[0])}),void 0]:[void 0,fe[1]]}function define(c,t){return new Struct$1({type:c,schema:null,validator:t})}function any(){return define("any",()=>!0)}function array(c){return new Struct$1({type:"array",schema:c,*entries(t){if(c&&Array.isArray(t))for(const[n,ie]of t.entries())yield[n,ie,c]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${print$2(t)}`}})}function boolean(){return define("boolean",c=>typeof c=="boolean")}function instance(c){return define("instance",t=>t instanceof c||`Expected a \`${c.name}\` instance, but received: ${print$2(t)}`)}function literal(c){const t=print$2(c),n=typeof c;return new Struct$1({type:"literal",schema:n==="string"||n==="number"||n==="boolean"?c:null,validator(ie){return ie===c||`Expected the literal \`${t}\`, but received: ${print$2(ie)}`}})}function never(){return define("never",()=>!1)}function nullable(c){return new Struct$1({...c,validator:(t,n)=>t===null||c.validator(t,n),refiner:(t,n)=>t===null||c.refiner(t,n)})}function number(){return define("number",c=>typeof c=="number"&&!isNaN(c)||`Expected a number, but received: ${print$2(c)}`)}function optional(c){return new Struct$1({...c,validator:(t,n)=>t===void 0||c.validator(t,n),refiner:(t,n)=>t===void 0||c.refiner(t,n)})}function record(c,t){return new Struct$1({type:"record",schema:null,*entries(n){if(isObject$1(n))for(const ie in n){const fe=n[ie];yield[ie,ie,c],yield[ie,fe,t]}},validator(n){return isNonArrayObject(n)||`Expected an object, but received: ${print$2(n)}`},coercer(n){return isNonArrayObject(n)?{...n}:n}})}function string(){return define("string",c=>typeof c=="string"||`Expected a string, but received: ${print$2(c)}`)}function tuple(c){const t=never();return new Struct$1({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const ie=Math.max(c.length,n.length);for(let fe=0;fe<ie;fe++)yield[fe,n[fe],c[fe]||t]}},validator(n){return Array.isArray(n)||`Expected an array, but received: ${print$2(n)}`},coercer(n){return Array.isArray(n)?n.slice():n}})}function type$1(c){const t=Object.keys(c);return new Struct$1({type:"type",schema:c,*entries(n){if(isObject$1(n))for(const ie of t)yield[ie,n[ie],c[ie]]},validator(n){return isNonArrayObject(n)||`Expected an object, but received: ${print$2(n)}`},coercer(n){return isNonArrayObject(n)?{...n}:n}})}function union(c){const t=c.map(n=>n.type).join(" | ");return new Struct$1({type:"union",schema:null,coercer(n,ie){for(const fe of c){const[ae,le]=fe.validate(n,{coerce:!0,mask:ie.mask});if(!ae)return le}return n},validator(n,ie){const fe=[];for(const ae of c){const[...le]=run(n,ae,ie),[pe]=le;if(pe[0])for(const[me]of le)me&&fe.push(me);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${print$2(n)}`,...fe]}})}function unknown(){return define("unknown",()=>!0)}function coerce(c,t,n){return new Struct$1({...c,coercer:(ie,fe)=>is(ie,t)?c.coercer(n(ie,fe),fe):c.coercer(ie,fe)})}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const REGEX$1=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate(c){return typeof c=="string"&&REGEX$1.test(c)}var byteToHex=[];for(var i$3=0;i$3<256;++i$3)byteToHex.push((i$3+256).toString(16).substr(1));function stringify(c){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(byteToHex[c[t+0]]+byteToHex[c[t+1]]+byteToHex[c[t+2]]+byteToHex[c[t+3]]+"-"+byteToHex[c[t+4]]+byteToHex[c[t+5]]+"-"+byteToHex[c[t+6]]+byteToHex[c[t+7]]+"-"+byteToHex[c[t+8]]+byteToHex[c[t+9]]+"-"+byteToHex[c[t+10]]+byteToHex[c[t+11]]+byteToHex[c[t+12]]+byteToHex[c[t+13]]+byteToHex[c[t+14]]+byteToHex[c[t+15]]).toLowerCase();if(!validate(n))throw TypeError("Stringified UUID is invalid");return n}var _nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1(c,t,n){var ie=t&&n||0,fe=t||new Array(16);c=c||{};var ae=c.node||_nodeId,le=c.clockseq!==void 0?c.clockseq:_clockseq;if(ae==null||le==null){var pe=c.random||(c.rng||rng)();ae==null&&(ae=_nodeId=[pe[0]|1,pe[1],pe[2],pe[3],pe[4],pe[5]]),le==null&&(le=_clockseq=(pe[6]<<8|pe[7])&16383)}var me=c.msecs!==void 0?c.msecs:Date.now(),ye=c.nsecs!==void 0?c.nsecs:_lastNSecs+1,xe=me-_lastMSecs+(ye-_lastNSecs)/1e4;if(xe<0&&c.clockseq===void 0&&(le=le+1&16383),(xe<0||me>_lastMSecs)&&c.nsecs===void 0&&(ye=0),ye>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=me,_lastNSecs=ye,_clockseq=le,me+=122192928e5;var Ee=((me&268435455)*1e4+ye)%4294967296;fe[ie++]=Ee>>>24&255,fe[ie++]=Ee>>>16&255,fe[ie++]=Ee>>>8&255,fe[ie++]=Ee&255;var Se=me/4294967296*1e4&268435455;fe[ie++]=Se>>>8&255,fe[ie++]=Se&255,fe[ie++]=Se>>>24&15|16,fe[ie++]=Se>>>16&255,fe[ie++]=le>>>8|128,fe[ie++]=le&255;for(var Me=0;Me<6;++Me)fe[ie+Me]=ae[Me];return t||stringify(fe)}function parse$1(c){if(!validate(c))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(c.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=t&255,n[4]=(t=parseInt(c.slice(9,13),16))>>>8,n[5]=t&255,n[6]=(t=parseInt(c.slice(14,18),16))>>>8,n[7]=t&255,n[8]=(t=parseInt(c.slice(19,23),16))>>>8,n[9]=t&255,n[10]=(t=parseInt(c.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=t&255,n}function stringToBytes(c){c=unescape(encodeURIComponent(c));for(var t=[],n=0;n<c.length;++n)t.push(c.charCodeAt(n));return t}var DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",URL$1="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function v35(c,t,n){function ie(fe,ae,le,pe){if(typeof fe=="string"&&(fe=stringToBytes(fe)),typeof ae=="string"&&(ae=parse$1(ae)),ae.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var me=new Uint8Array(16+fe.length);if(me.set(ae),me.set(fe,ae.length),me=n(me),me[6]=me[6]&15|t,me[8]=me[8]&63|128,le){pe=pe||0;for(var ye=0;ye<16;++ye)le[pe+ye]=me[ye];return le}return stringify(me)}try{ie.name=c}catch{}return ie.DNS=DNS,ie.URL=URL$1,ie}function md5$3(c){if(typeof c=="string"){var t=unescape(encodeURIComponent(c));c=new Uint8Array(t.length);for(var n=0;n<t.length;++n)c[n]=t.charCodeAt(n)}return md5ToHexEncodedArray(wordsToMd5(bytesToWords(c),c.length*8))}function md5ToHexEncodedArray(c){for(var t=[],n=c.length*32,ie="0123456789abcdef",fe=0;fe<n;fe+=8){var ae=c[fe>>5]>>>fe%32&255,le=parseInt(ie.charAt(ae>>>4&15)+ie.charAt(ae&15),16);t.push(le)}return t}function getOutputLength(c){return(c+64>>>9<<4)+14+1}function wordsToMd5(c,t){c[t>>5]|=128<<t%32,c[getOutputLength(t)-1]=t;for(var n=1732584193,ie=-271733879,fe=-1732584194,ae=271733878,le=0;le<c.length;le+=16){var pe=n,me=ie,ye=fe,xe=ae;n=md5ff(n,ie,fe,ae,c[le],7,-680876936),ae=md5ff(ae,n,ie,fe,c[le+1],12,-389564586),fe=md5ff(fe,ae,n,ie,c[le+2],17,606105819),ie=md5ff(ie,fe,ae,n,c[le+3],22,-1044525330),n=md5ff(n,ie,fe,ae,c[le+4],7,-176418897),ae=md5ff(ae,n,ie,fe,c[le+5],12,1200080426),fe=md5ff(fe,ae,n,ie,c[le+6],17,-1473231341),ie=md5ff(ie,fe,ae,n,c[le+7],22,-45705983),n=md5ff(n,ie,fe,ae,c[le+8],7,1770035416),ae=md5ff(ae,n,ie,fe,c[le+9],12,-1958414417),fe=md5ff(fe,ae,n,ie,c[le+10],17,-42063),ie=md5ff(ie,fe,ae,n,c[le+11],22,-1990404162),n=md5ff(n,ie,fe,ae,c[le+12],7,1804603682),ae=md5ff(ae,n,ie,fe,c[le+13],12,-40341101),fe=md5ff(fe,ae,n,ie,c[le+14],17,-1502002290),ie=md5ff(ie,fe,ae,n,c[le+15],22,1236535329),n=md5gg(n,ie,fe,ae,c[le+1],5,-165796510),ae=md5gg(ae,n,ie,fe,c[le+6],9,-1069501632),fe=md5gg(fe,ae,n,ie,c[le+11],14,643717713),ie=md5gg(ie,fe,ae,n,c[le],20,-373897302),n=md5gg(n,ie,fe,ae,c[le+5],5,-701558691),ae=md5gg(ae,n,ie,fe,c[le+10],9,38016083),fe=md5gg(fe,ae,n,ie,c[le+15],14,-660478335),ie=md5gg(ie,fe,ae,n,c[le+4],20,-405537848),n=md5gg(n,ie,fe,ae,c[le+9],5,568446438),ae=md5gg(ae,n,ie,fe,c[le+14],9,-1019803690),fe=md5gg(fe,ae,n,ie,c[le+3],14,-187363961),ie=md5gg(ie,fe,ae,n,c[le+8],20,1163531501),n=md5gg(n,ie,fe,ae,c[le+13],5,-1444681467),ae=md5gg(ae,n,ie,fe,c[le+2],9,-51403784),fe=md5gg(fe,ae,n,ie,c[le+7],14,1735328473),ie=md5gg(ie,fe,ae,n,c[le+12],20,-1926607734),n=md5hh(n,ie,fe,ae,c[le+5],4,-378558),ae=md5hh(ae,n,ie,fe,c[le+8],11,-2022574463),fe=md5hh(fe,ae,n,ie,c[le+11],16,1839030562),ie=md5hh(ie,fe,ae,n,c[le+14],23,-35309556),n=md5hh(n,ie,fe,ae,c[le+1],4,-1530992060),ae=md5hh(ae,n,ie,fe,c[le+4],11,1272893353),fe=md5hh(fe,ae,n,ie,c[le+7],16,-155497632),ie=md5hh(ie,fe,ae,n,c[le+10],23,-1094730640),n=md5hh(n,ie,fe,ae,c[le+13],4,681279174),ae=md5hh(ae,n,ie,fe,c[le],11,-358537222),fe=md5hh(fe,ae,n,ie,c[le+3],16,-722521979),ie=md5hh(ie,fe,ae,n,c[le+6],23,76029189),n=md5hh(n,ie,fe,ae,c[le+9],4,-640364487),ae=md5hh(ae,n,ie,fe,c[le+12],11,-421815835),fe=md5hh(fe,ae,n,ie,c[le+15],16,530742520),ie=md5hh(ie,fe,ae,n,c[le+2],23,-995338651),n=md5ii(n,ie,fe,ae,c[le],6,-198630844),ae=md5ii(ae,n,ie,fe,c[le+7],10,1126891415),fe=md5ii(fe,ae,n,ie,c[le+14],15,-1416354905),ie=md5ii(ie,fe,ae,n,c[le+5],21,-57434055),n=md5ii(n,ie,fe,ae,c[le+12],6,1700485571),ae=md5ii(ae,n,ie,fe,c[le+3],10,-1894986606),fe=md5ii(fe,ae,n,ie,c[le+10],15,-1051523),ie=md5ii(ie,fe,ae,n,c[le+1],21,-2054922799),n=md5ii(n,ie,fe,ae,c[le+8],6,1873313359),ae=md5ii(ae,n,ie,fe,c[le+15],10,-30611744),fe=md5ii(fe,ae,n,ie,c[le+6],15,-1560198380),ie=md5ii(ie,fe,ae,n,c[le+13],21,1309151649),n=md5ii(n,ie,fe,ae,c[le+4],6,-145523070),ae=md5ii(ae,n,ie,fe,c[le+11],10,-1120210379),fe=md5ii(fe,ae,n,ie,c[le+2],15,718787259),ie=md5ii(ie,fe,ae,n,c[le+9],21,-343485551),n=safeAdd(n,pe),ie=safeAdd(ie,me),fe=safeAdd(fe,ye),ae=safeAdd(ae,xe)}return[n,ie,fe,ae]}function bytesToWords(c){if(c.length===0)return[];for(var t=c.length*8,n=new Uint32Array(getOutputLength(t)),ie=0;ie<t;ie+=8)n[ie>>5]|=(c[ie/8]&255)<<ie%32;return n}function safeAdd(c,t){var n=(c&65535)+(t&65535),ie=(c>>16)+(t>>16)+(n>>16);return ie<<16|n&65535}function bitRotateLeft(c,t){return c<<t|c>>>32-t}function md5cmn(c,t,n,ie,fe,ae){return safeAdd(bitRotateLeft(safeAdd(safeAdd(t,c),safeAdd(ie,ae)),fe),n)}function md5ff(c,t,n,ie,fe,ae,le){return md5cmn(t&n|~t&ie,c,t,fe,ae,le)}function md5gg(c,t,n,ie,fe,ae,le){return md5cmn(t&ie|n&~ie,c,t,fe,ae,le)}function md5hh(c,t,n,ie,fe,ae,le){return md5cmn(t^n^ie,c,t,fe,ae,le)}function md5ii(c,t,n,ie,fe,ae,le){return md5cmn(n^(t|~ie),c,t,fe,ae,le)}var v3=v35("v3",48,md5$3);function v4(c,t,n){c=c||{};var ie=c.random||(c.rng||rng)();if(ie[6]=ie[6]&15|64,ie[8]=ie[8]&63|128,t){n=n||0;for(var fe=0;fe<16;++fe)t[n+fe]=ie[fe];return t}return stringify(ie)}function f$1(c,t,n,ie){switch(c){case 0:return t&n^~t&ie;case 1:return t^n^ie;case 2:return t&n^t&ie^n&ie;case 3:return t^n^ie}}function ROTL(c,t){return c<<t|c>>>32-t}function sha1$3(c){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof c=="string"){var ie=unescape(encodeURIComponent(c));c=[];for(var fe=0;fe<ie.length;++fe)c.push(ie.charCodeAt(fe))}else Array.isArray(c)||(c=Array.prototype.slice.call(c));c.push(128);for(var ae=c.length/4+2,le=Math.ceil(ae/16),pe=new Array(le),me=0;me<le;++me){for(var ye=new Uint32Array(16),xe=0;xe<16;++xe)ye[xe]=c[me*64+xe*4]<<24|c[me*64+xe*4+1]<<16|c[me*64+xe*4+2]<<8|c[me*64+xe*4+3];pe[me]=ye}pe[le-1][14]=(c.length-1)*8/Math.pow(2,32),pe[le-1][14]=Math.floor(pe[le-1][14]),pe[le-1][15]=(c.length-1)*8&4294967295;for(var Ee=0;Ee<le;++Ee){for(var Se=new Uint32Array(80),Me=0;Me<16;++Me)Se[Me]=pe[Ee][Me];for(var Be=16;Be<80;++Be)Se[Be]=ROTL(Se[Be-3]^Se[Be-8]^Se[Be-14]^Se[Be-16],1);for(var $e=n[0],ke=n[1],Te=n[2],Ie=n[3],Fe=n[4],Le=0;Le<80;++Le){var He=Math.floor(Le/20),ze=ROTL($e,5)+f$1(He,ke,Te,Ie)+Fe+t[He]+Se[Le]>>>0;Fe=Ie,Ie=Te,Te=ROTL(ke,30)>>>0,ke=$e,$e=ze}n[0]=n[0]+$e>>>0,n[1]=n[1]+ke>>>0,n[2]=n[2]+Te>>>0,n[3]=n[3]+Ie>>>0,n[4]=n[4]+Fe>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var v5=v35("v5",80,sha1$3);const nil="00000000-0000-0000-0000-000000000000";function version$5(c){if(!validate(c))throw TypeError("Invalid UUID");return parseInt(c.substr(14,1),16)}const esmBrowser=Object.freeze(Object.defineProperty({__proto__:null,NIL:nil,parse:parse$1,stringify,v1,v3,v4,v5,validate,version:version$5},Symbol.toStringTag,{value:"Module"})),require$$0$2=getAugmentedNamespace(esmBrowser),uuid$1=require$$0$2.v4,generateRequest$1=function(c,t,n,ie){if(typeof c!="string")throw new TypeError(c+" must be a string");ie=ie||{};const fe=typeof ie.version=="number"?ie.version:2;if(fe!==1&&fe!==2)throw new TypeError(fe+" must be 1 or 2");const ae={method:c};if(fe===2&&(ae.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");ae.params=t}if(typeof n>"u"){const le=typeof ie.generator=="function"?ie.generator:function(){return uuid$1()};ae.id=le(ae,ie)}else fe===2&&n===null?ie.notificationIdNull&&(ae.id=null):ae.id=n;return ae};var generateRequest_1=generateRequest$1;const uuid=require$$0$2.v4,generateRequest=generateRequest_1,ClientBrowser=function(c,t){if(!(this instanceof ClientBrowser))return new ClientBrowser(c,t);t||(t={}),this.options={reviver:typeof t.reviver<"u"?t.reviver:null,replacer:typeof t.replacer<"u"?t.replacer:null,generator:typeof t.generator<"u"?t.generator:function(){return uuid()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=c};var browser$c=ClientBrowser;ClientBrowser.prototype.request=function(c,t,n,ie){const fe=this;let ae=null;const le=Array.isArray(c)&&typeof t=="function";if(this.options.version===1&&le)throw new TypeError("JSON-RPC 1.0 does not support batching");if(le||!le&&c&&typeof c=="object"&&typeof t=="function")ie=t,ae=c;else{typeof n=="function"&&(ie=n,n=void 0);const ye=typeof ie=="function";try{ae=generateRequest(c,t,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(xe){if(ye)return ie(xe);throw xe}if(!ye)return ae}let me;try{me=JSON.stringify(ae,this.options.replacer)}catch(ye){return ie(ye)}return this.callServer(me,function(ye,xe){fe._parseResponse(ye,xe,ie)}),ae};ClientBrowser.prototype._parseResponse=function(c,t,n){if(c){n(c);return}if(!t)return n();let ie;try{ie=JSON.parse(t,this.options.reviver)}catch(fe){return n(fe)}if(n.length===3)if(Array.isArray(ie)){const fe=function(le){return typeof le.error<"u"},ae=function(le){return!fe(le)};return n(null,ie.filter(fe),ie.filter(ae))}else return n(null,ie.error,ie.result);n(null,ie)};const RpcClient=getDefaultExportFromCjs$2(browser$c);var eventemitter3={exports:{}};(function(c){var t=Object.prototype.hasOwnProperty,n="~";function ie(){}Object.create&&(ie.prototype=Object.create(null),new ie().__proto__||(n=!1));function fe(me,ye,xe){this.fn=me,this.context=ye,this.once=xe||!1}function ae(me,ye,xe,Ee,Se){if(typeof xe!="function")throw new TypeError("The listener must be a function");var Me=new fe(xe,Ee||me,Se),Be=n?n+ye:ye;return me._events[Be]?me._events[Be].fn?me._events[Be]=[me._events[Be],Me]:me._events[Be].push(Me):(me._events[Be]=Me,me._eventsCount++),me}function le(me,ye){--me._eventsCount===0?me._events=new ie:delete me._events[ye]}function pe(){this._events=new ie,this._eventsCount=0}pe.prototype.eventNames=function(){var ye=[],xe,Ee;if(this._eventsCount===0)return ye;for(Ee in xe=this._events)t.call(xe,Ee)&&ye.push(n?Ee.slice(1):Ee);return Object.getOwnPropertySymbols?ye.concat(Object.getOwnPropertySymbols(xe)):ye},pe.prototype.listeners=function(ye){var xe=n?n+ye:ye,Ee=this._events[xe];if(!Ee)return[];if(Ee.fn)return[Ee.fn];for(var Se=0,Me=Ee.length,Be=new Array(Me);Se<Me;Se++)Be[Se]=Ee[Se].fn;return Be},pe.prototype.listenerCount=function(ye){var xe=n?n+ye:ye,Ee=this._events[xe];return Ee?Ee.fn?1:Ee.length:0},pe.prototype.emit=function(ye,xe,Ee,Se,Me,Be){var $e=n?n+ye:ye;if(!this._events[$e])return!1;var ke=this._events[$e],Te=arguments.length,Ie,Fe;if(ke.fn){switch(ke.once&&this.removeListener(ye,ke.fn,void 0,!0),Te){case 1:return ke.fn.call(ke.context),!0;case 2:return ke.fn.call(ke.context,xe),!0;case 3:return ke.fn.call(ke.context,xe,Ee),!0;case 4:return ke.fn.call(ke.context,xe,Ee,Se),!0;case 5:return ke.fn.call(ke.context,xe,Ee,Se,Me),!0;case 6:return ke.fn.call(ke.context,xe,Ee,Se,Me,Be),!0}for(Fe=1,Ie=new Array(Te-1);Fe<Te;Fe++)Ie[Fe-1]=arguments[Fe];ke.fn.apply(ke.context,Ie)}else{var Le=ke.length,He;for(Fe=0;Fe<Le;Fe++)switch(ke[Fe].once&&this.removeListener(ye,ke[Fe].fn,void 0,!0),Te){case 1:ke[Fe].fn.call(ke[Fe].context);break;case 2:ke[Fe].fn.call(ke[Fe].context,xe);break;case 3:ke[Fe].fn.call(ke[Fe].context,xe,Ee);break;case 4:ke[Fe].fn.call(ke[Fe].context,xe,Ee,Se);break;default:if(!Ie)for(He=1,Ie=new Array(Te-1);He<Te;He++)Ie[He-1]=arguments[He];ke[Fe].fn.apply(ke[Fe].context,Ie)}}return!0},pe.prototype.on=function(ye,xe,Ee){return ae(this,ye,xe,Ee,!1)},pe.prototype.once=function(ye,xe,Ee){return ae(this,ye,xe,Ee,!0)},pe.prototype.removeListener=function(ye,xe,Ee,Se){var Me=n?n+ye:ye;if(!this._events[Me])return this;if(!xe)return le(this,Me),this;var Be=this._events[Me];if(Be.fn)Be.fn===xe&&(!Se||Be.once)&&(!Ee||Be.context===Ee)&&le(this,Me);else{for(var $e=0,ke=[],Te=Be.length;$e<Te;$e++)(Be[$e].fn!==xe||Se&&!Be[$e].once||Ee&&Be[$e].context!==Ee)&&ke.push(Be[$e]);ke.length?this._events[Me]=ke.length===1?ke[0]:ke:le(this,Me)}return this},pe.prototype.removeAllListeners=function(ye){var xe;return ye?(xe=n?n+ye:ye,this._events[xe]&&le(this,xe)):(this._events=new ie,this._eventsCount=0),this},pe.prototype.off=pe.prototype.removeListener,pe.prototype.addListener=pe.prototype.on,pe.prefixed=n,pe.EventEmitter=pe,c.exports=pe})(eventemitter3);var eventemitter3Exports=eventemitter3.exports;const EventEmitter=getDefaultExportFromCjs$2(eventemitter3Exports);var WebSocketBrowserImpl=class extends EventEmitter{constructor(t,n,ie){super();Xn(this,"socket");this.socket=new window.WebSocket(t,ie),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=fe=>this.emit("message",fe.data),this.socket.onerror=fe=>this.emit("error",fe),this.socket.onclose=fe=>{this.emit("close",fe.code,fe.reason)}}send(t,n,ie){const fe=ie||n;try{this.socket.send(t),fe()}catch(ae){fe(ae)}}close(t,n){this.socket.close(t,n)}addEventListener(t,n,ie){this.socket.addEventListener(t,n,ie)}};function WebSocket(c,t){return new WebSocketBrowserImpl(c,t)}var DefaultDataPack=class{encode(c){return JSON.stringify(c)}decode(c){return JSON.parse(c)}},CommonClient=class extends EventEmitter{constructor(t,n="ws://localhost:8080",{autoconnect:ie=!0,reconnect:fe=!0,reconnect_interval:ae=1e3,max_reconnects:le=5,...pe}={},me,ye){super();Xn(this,"address");Xn(this,"rpc_id");Xn(this,"queue");Xn(this,"options");Xn(this,"autoconnect");Xn(this,"ready");Xn(this,"reconnect");Xn(this,"reconnect_timer_id");Xn(this,"reconnect_interval");Xn(this,"max_reconnects");Xn(this,"rest_options");Xn(this,"current_reconnects");Xn(this,"generate_request_id");Xn(this,"socket");Xn(this,"webSocketFactory");Xn(this,"dataPack");this.webSocketFactory=t,this.queue={},this.rpc_id=0,this.address=n,this.autoconnect=ie,this.ready=!1,this.reconnect=fe,this.reconnect_timer_id=void 0,this.reconnect_interval=ae,this.max_reconnects=le,this.rest_options=pe,this.current_reconnects=0,this.generate_request_id=me||(()=>typeof this.rpc_id=="number"?++this.rpc_id:Number(this.rpc_id)+1),ye?this.dataPack=ye:this.dataPack=new DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(t,n,ie,fe){return!fe&&typeof ie=="object"&&(fe=ie,ie=null),new Promise((ae,le)=>{if(!this.ready)return le(new Error("socket not ready"));const pe=this.generate_request_id(t,n),me={jsonrpc:"2.0",method:t,params:n||void 0,id:pe};this.socket.send(this.dataPack.encode(me),fe,ye=>{if(ye)return le(ye);this.queue[pe]={promise:[ae,le]},ie&&(this.queue[pe].timeout=setTimeout(()=>{delete this.queue[pe],le(new Error("reply timeout"))},ie))})})}async login(t){const n=await this.call("rpc.login",t);if(!n)throw new Error("authentication failed");return n}async listMethods(){return await this.call("__listMethods")}notify(t,n){return new Promise((ie,fe)=>{if(!this.ready)return fe(new Error("socket not ready"));const ae={jsonrpc:"2.0",method:t,params:n};this.socket.send(this.dataPack.encode(ae),le=>{if(le)return fe(le);ie()})})}async subscribe(t){typeof t=="string"&&(t=[t]);const n=await this.call("rpc.on",t);if(typeof t=="string"&&n[t]!=="ok")throw new Error("Failed subscribing to an event '"+t+"' with: "+n[t]);return n}async unsubscribe(t){typeof t=="string"&&(t=[t]);const n=await this.call("rpc.off",t);if(typeof t=="string"&&n[t]!=="ok")throw new Error("Failed unsubscribing from an event with: "+n);return n}close(t,n){this.socket&&this.socket.close(t||1e3,n)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return this.reconnect_timer_id!==void 0}willReconnect(){return this.reconnect&&(this.max_reconnects===0||this.current_reconnects<this.max_reconnects)}_connect(t,n){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,n),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:ie})=>{ie instanceof ArrayBuffer&&(ie=dist$1.Buffer.from(ie).toString());try{ie=this.dataPack.decode(ie)}catch{return}if(ie.notification&&this.listeners(ie.notification).length){if(!Object.keys(ie.params).length)return this.emit(ie.notification);const fe=[ie.notification];if(ie.params.constructor===Object)fe.push(ie.params);else for(let ae=0;ae<ie.params.length;ae++)fe.push(ie.params[ae]);return Promise.resolve().then(()=>{this.emit.apply(this,fe)})}if(!this.queue[ie.id])return ie.method?Promise.resolve().then(()=>{this.emit(ie.method,ie==null?void 0:ie.params)}):void 0;"error"in ie=="result"in ie&&this.queue[ie.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[ie.id].timeout&&clearTimeout(this.queue[ie.id].timeout),ie.error?this.queue[ie.id].promise[1](ie.error):this.queue[ie.id].promise[0](ie.result),delete this.queue[ie.id]}),this.socket.addEventListener("error",ie=>this.emit("error",ie)),this.socket.addEventListener("close",({code:ie,reason:fe})=>{this.ready&&setTimeout(()=>this.emit("close",ie,fe),0),this.ready=!1,this.socket=void 0,ie!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)?this.reconnect_timer_id=setTimeout(()=>this._connect(t,n),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",ie,fe),1))})}};class HMAC extends Hash{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,ahash(t);const ie=toBytes(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const fe=this.blockLen,ae=new Uint8Array(fe);ae.set(ie.length>fe?t.create().update(ie).digest():ie);for(let le=0;le<ae.length;le++)ae[le]^=54;this.iHash.update(ae),this.oHash=t.create();for(let le=0;le<ae.length;le++)ae[le]^=106;this.oHash.update(ae),clean(ae)}update(t){return aexists(this),this.iHash.update(t),this}digestInto(t){aexists(this),abytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:ie,finished:fe,destroyed:ae,blockLen:le,outputLen:pe}=this;return t=t,t.finished=fe,t.destroyed=ae,t.blockLen=le,t.outputLen=pe,t.oHash=n._cloneInto(t.oHash),t.iHash=ie._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const hmac=(c,t,n)=>new HMAC(c,t).update(n).digest();hmac.create=(c,t)=>new HMAC(c,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const divNearest=(c,t)=>(c+(c>=0?t:-t)/_2n$1)/t;function _splitEndoScalar(c,t,n){const[[ie,fe],[ae,le]]=t,pe=divNearest(le*c,n),me=divNearest(-fe*c,n);let ye=c-pe*ie-me*ae,xe=-pe*fe-me*le;const Ee=ye<_0n,Se=xe<_0n;Ee&&(ye=-ye),Se&&(xe=-xe);const Me=bitMask(Math.ceil(bitLen(n)/2))+_1n;if(ye<_0n||ye>=Me||xe<_0n||xe>=Me)throw new Error("splitScalar (endomorphism): failed, k="+c);return{k1neg:Ee,k1:ye,k2neg:Se,k2:xe}}function validateSigFormat(c){if(!["compact","recovered","der"].includes(c))throw new Error('Signature format must be "compact", "recovered", or "der"');return c}function validateSigOpts(c,t){const n={};for(let ie of Object.keys(t))n[ie]=c[ie]===void 0?t[ie]:c[ie];return _abool2(n.lowS,"lowS"),_abool2(n.prehash,"prehash"),n.format!==void 0&&validateSigFormat(n.format),n}class DERErr extends Error{constructor(t=""){super(t)}}const DER={Err:DERErr,_tlv:{encode:(c,t)=>{const{Err:n}=DER;if(c<0||c>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const ie=t.length/2,fe=numberToHexUnpadded(ie);if(fe.length/2&128)throw new n("tlv.encode: long form length too big");const ae=ie>127?numberToHexUnpadded(fe.length/2|128):"";return numberToHexUnpadded(c)+ae+fe+t},decode(c,t){const{Err:n}=DER;let ie=0;if(c<0||c>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[ie++]!==c)throw new n("tlv.decode: wrong tlv");const fe=t[ie++],ae=!!(fe&128);let le=0;if(!ae)le=fe;else{const me=fe&127;if(!me)throw new n("tlv.decode(long): indefinite length not supported");if(me>4)throw new n("tlv.decode(long): byte length is too big");const ye=t.subarray(ie,ie+me);if(ye.length!==me)throw new n("tlv.decode: length bytes not complete");if(ye[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const xe of ye)le=le<<8|xe;if(ie+=me,le<128)throw new n("tlv.decode(long): not minimal encoding")}const pe=t.subarray(ie,ie+le);if(pe.length!==le)throw new n("tlv.decode: wrong value length");return{v:pe,l:t.subarray(ie+le)}}},_int:{encode(c){const{Err:t}=DER;if(c<_0n)throw new t("integer: negative integers are not allowed");let n=numberToHexUnpadded(c);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(c){const{Err:t}=DER;if(c[0]&128)throw new t("invalid signature integer: negative");if(c[0]===0&&!(c[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return bytesToNumberBE(c)}},toSig(c){const{Err:t,_int:n,_tlv:ie}=DER,fe=ensureBytes("signature",c),{v:ae,l:le}=ie.decode(48,fe);if(le.length)throw new t("invalid signature: left bytes after parsing");const{v:pe,l:me}=ie.decode(2,ae),{v:ye,l:xe}=ie.decode(2,me);if(xe.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(pe),s:n.decode(ye)}},hexFromSig(c){const{_tlv:t,_int:n}=DER,ie=t.encode(2,n.encode(c.r)),fe=t.encode(2,n.encode(c.s)),ae=ie+fe;return t.encode(48,ae)}},_0n=BigInt(0),_1n=BigInt(1),_2n$1=BigInt(2),_3n=BigInt(3),_4n=BigInt(4);function _normFnElement(c,t){const{BYTES:n}=c;let ie;if(typeof t=="bigint")ie=t;else{let fe=ensureBytes("private key",t);try{ie=c.fromBytes(fe)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!c.isValidNot0(ie))throw new Error("invalid private key: out of range [1..N-1]");return ie}function weierstrassN(c,t={}){const n=_createCurveFields("weierstrass",c,t),{Fp:ie,Fn:fe}=n;let ae=n.CURVE;const{h:le,n:pe}=ae;_validateObject(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:me}=t;if(me&&(!ie.is0(ae.a)||typeof me.beta!="bigint"||!Array.isArray(me.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const ye=getWLengths(ie,fe);function xe(){if(!ie.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function Ee(se,ce,de){const{x:he,y:ve}=ce.toAffine(),we=ie.toBytes(he);if(_abool2(de,"isCompressed"),de){xe();const Ae=!ie.isOdd(ve);return concatBytes(pprefix(Ae),we)}else return concatBytes(Uint8Array.of(4),we,ie.toBytes(ve))}function Se(se){_abytes2(se,void 0,"Point");const{publicKey:ce,publicKeyUncompressed:de}=ye,he=se.length,ve=se[0],we=se.subarray(1);if(he===ce&&(ve===2||ve===3)){const Ae=ie.fromBytes(we);if(!ie.isValid(Ae))throw new Error("bad point: is not on curve, wrong x");const be=$e(Ae);let ue;try{ue=ie.sqrt(be)}catch(Ne){const qe=Ne instanceof Error?": "+Ne.message:"";throw new Error("bad point: is not on curve, sqrt error"+qe)}xe();const ge=ie.isOdd(ue);return(ve&1)===1!==ge&&(ue=ie.neg(ue)),{x:Ae,y:ue}}else if(he===de&&ve===4){const Ae=ie.BYTES,be=ie.fromBytes(we.subarray(0,Ae)),ue=ie.fromBytes(we.subarray(Ae,Ae*2));if(!ke(be,ue))throw new Error("bad point: is not on curve");return{x:be,y:ue}}else throw new Error(`bad point: got length ${he}, expected compressed=${ce} or uncompressed=${de}`)}const Me=t.toBytes||Ee,Be=t.fromBytes||Se;function $e(se){const ce=ie.sqr(se),de=ie.mul(ce,se);return ie.add(ie.add(de,ie.mul(se,ae.a)),ae.b)}function ke(se,ce){const de=ie.sqr(ce),he=$e(se);return ie.eql(de,he)}if(!ke(ae.Gx,ae.Gy))throw new Error("bad curve params: generator point");const Te=ie.mul(ie.pow(ae.a,_3n),_4n),Ie=ie.mul(ie.sqr(ae.b),BigInt(27));if(ie.is0(ie.add(Te,Ie)))throw new Error("bad curve params: a or b");function Fe(se,ce,de=!1){if(!ie.isValid(ce)||de&&ie.is0(ce))throw new Error(`bad point coordinate ${se}`);return ce}function Le(se){if(!(se instanceof Ue))throw new Error("ProjectivePoint expected")}function He(se){if(!me||!me.basises)throw new Error("no endo");return _splitEndoScalar(se,me.basises,fe.ORDER)}const ze=memoized((se,ce)=>{const{X:de,Y:he,Z:ve}=se;if(ie.eql(ve,ie.ONE))return{x:de,y:he};const we=se.is0();ce==null&&(ce=we?ie.ONE:ie.inv(ve));const Ae=ie.mul(de,ce),be=ie.mul(he,ce),ue=ie.mul(ve,ce);if(we)return{x:ie.ZERO,y:ie.ZERO};if(!ie.eql(ue,ie.ONE))throw new Error("invZ was invalid");return{x:Ae,y:be}}),Je=memoized(se=>{if(se.is0()){if(t.allowInfinityPoint&&!ie.is0(se.Y))return;throw new Error("bad point: ZERO")}const{x:ce,y:de}=se.toAffine();if(!ie.isValid(ce)||!ie.isValid(de))throw new Error("bad point: x or y not field elements");if(!ke(ce,de))throw new Error("bad point: equation left != right");if(!se.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function Xe(se,ce,de,he,ve){return de=new Ue(ie.mul(de.X,se),de.Y,de.Z),ce=negateCt(he,ce),de=negateCt(ve,de),ce.add(de)}class Ue{constructor(ce,de,he){this.X=Fe("x",ce),this.Y=Fe("y",de,!0),this.Z=Fe("z",he),Object.freeze(this)}static CURVE(){return ae}static fromAffine(ce){const{x:de,y:he}=ce||{};if(!ce||!ie.isValid(de)||!ie.isValid(he))throw new Error("invalid affine point");if(ce instanceof Ue)throw new Error("projective point not allowed");return ie.is0(de)&&ie.is0(he)?Ue.ZERO:new Ue(de,he,ie.ONE)}static fromBytes(ce){const de=Ue.fromAffine(Be(_abytes2(ce,void 0,"point")));return de.assertValidity(),de}static fromHex(ce){return Ue.fromBytes(ensureBytes("pointHex",ce))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(ce=8,de=!0){return _e.createCache(this,ce),de||this.multiply(_3n),this}assertValidity(){Je(this)}hasEvenY(){const{y:ce}=this.toAffine();if(!ie.isOdd)throw new Error("Field doesn't support isOdd");return!ie.isOdd(ce)}equals(ce){Le(ce);const{X:de,Y:he,Z:ve}=this,{X:we,Y:Ae,Z:be}=ce,ue=ie.eql(ie.mul(de,be),ie.mul(we,ve)),ge=ie.eql(ie.mul(he,be),ie.mul(Ae,ve));return ue&&ge}negate(){return new Ue(this.X,ie.neg(this.Y),this.Z)}double(){const{a:ce,b:de}=ae,he=ie.mul(de,_3n),{X:ve,Y:we,Z:Ae}=this;let be=ie.ZERO,ue=ie.ZERO,ge=ie.ZERO,Re=ie.mul(ve,ve),Ne=ie.mul(we,we),qe=ie.mul(Ae,Ae),Pe=ie.mul(ve,we);return Pe=ie.add(Pe,Pe),ge=ie.mul(ve,Ae),ge=ie.add(ge,ge),be=ie.mul(ce,ge),ue=ie.mul(he,qe),ue=ie.add(be,ue),be=ie.sub(Ne,ue),ue=ie.add(Ne,ue),ue=ie.mul(be,ue),be=ie.mul(Pe,be),ge=ie.mul(he,ge),qe=ie.mul(ce,qe),Pe=ie.sub(Re,qe),Pe=ie.mul(ce,Pe),Pe=ie.add(Pe,ge),ge=ie.add(Re,Re),Re=ie.add(ge,Re),Re=ie.add(Re,qe),Re=ie.mul(Re,Pe),ue=ie.add(ue,Re),qe=ie.mul(we,Ae),qe=ie.add(qe,qe),Re=ie.mul(qe,Pe),be=ie.sub(be,Re),ge=ie.mul(qe,Ne),ge=ie.add(ge,ge),ge=ie.add(ge,ge),new Ue(be,ue,ge)}add(ce){Le(ce);const{X:de,Y:he,Z:ve}=this,{X:we,Y:Ae,Z:be}=ce;let ue=ie.ZERO,ge=ie.ZERO,Re=ie.ZERO;const Ne=ae.a,qe=ie.mul(ae.b,_3n);let Pe=ie.mul(de,we),Ge=ie.mul(he,Ae),Ce=ie.mul(ve,be),De=ie.add(de,he),je=ie.add(we,Ae);De=ie.mul(De,je),je=ie.add(Pe,Ge),De=ie.sub(De,je),je=ie.add(de,ve);let Ve=ie.add(we,be);return je=ie.mul(je,Ve),Ve=ie.add(Pe,Ce),je=ie.sub(je,Ve),Ve=ie.add(he,ve),ue=ie.add(Ae,be),Ve=ie.mul(Ve,ue),ue=ie.add(Ge,Ce),Ve=ie.sub(Ve,ue),Re=ie.mul(Ne,je),ue=ie.mul(qe,Ce),Re=ie.add(ue,Re),ue=ie.sub(Ge,Re),Re=ie.add(Ge,Re),ge=ie.mul(ue,Re),Ge=ie.add(Pe,Pe),Ge=ie.add(Ge,Pe),Ce=ie.mul(Ne,Ce),je=ie.mul(qe,je),Ge=ie.add(Ge,Ce),Ce=ie.sub(Pe,Ce),Ce=ie.mul(Ne,Ce),je=ie.add(je,Ce),Pe=ie.mul(Ge,je),ge=ie.add(ge,Pe),Pe=ie.mul(Ve,je),ue=ie.mul(De,ue),ue=ie.sub(ue,Pe),Pe=ie.mul(De,Ge),Re=ie.mul(Ve,Re),Re=ie.add(Re,Pe),new Ue(ue,ge,Re)}subtract(ce){return this.add(ce.negate())}is0(){return this.equals(Ue.ZERO)}multiply(ce){const{endo:de}=t;if(!fe.isValidNot0(ce))throw new Error("invalid scalar: out of range");let he,ve;const we=Ae=>_e.cached(this,Ae,be=>normalizeZ(Ue,be));if(de){const{k1neg:Ae,k1:be,k2neg:ue,k2:ge}=He(ce),{p:Re,f:Ne}=we(be),{p:qe,f:Pe}=we(ge);ve=Ne.add(Pe),he=Xe(de.beta,Re,qe,Ae,ue)}else{const{p:Ae,f:be}=we(ce);he=Ae,ve=be}return normalizeZ(Ue,[he,ve])[0]}multiplyUnsafe(ce){const{endo:de}=t,he=this;if(!fe.isValid(ce))throw new Error("invalid scalar: out of range");if(ce===_0n||he.is0())return Ue.ZERO;if(ce===_1n)return he;if(_e.hasCache(this))return this.multiply(ce);if(de){const{k1neg:ve,k1:we,k2neg:Ae,k2:be}=He(ce),{p1:ue,p2:ge}=mulEndoUnsafe(Ue,he,we,be);return Xe(de.beta,ue,ge,ve,Ae)}else return _e.unsafe(he,ce)}multiplyAndAddUnsafe(ce,de,he){const ve=this.multiplyUnsafe(de).add(ce.multiplyUnsafe(he));return ve.is0()?void 0:ve}toAffine(ce){return ze(this,ce)}isTorsionFree(){const{isTorsionFree:ce}=t;return le===_1n?!0:ce?ce(Ue,this):_e.unsafe(this,pe).is0()}clearCofactor(){const{clearCofactor:ce}=t;return le===_1n?this:ce?ce(Ue,this):this.multiplyUnsafe(le)}isSmallOrder(){return this.multiplyUnsafe(le).is0()}toBytes(ce=!0){return _abool2(ce,"isCompressed"),this.assertValidity(),Me(Ue,this,ce)}toHex(ce=!0){return bytesToHex(this.toBytes(ce))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(ce=!0){return this.toBytes(ce)}_setWindowSize(ce){this.precompute(ce)}static normalizeZ(ce){return normalizeZ(Ue,ce)}static msm(ce,de){return pippenger(Ue,fe,ce,de)}static fromPrivateKey(ce){return Ue.BASE.multiply(_normFnElement(fe,ce))}}Ue.BASE=new Ue(ae.Gx,ae.Gy,ie.ONE),Ue.ZERO=new Ue(ie.ZERO,ie.ONE,ie.ZERO),Ue.Fp=ie,Ue.Fn=fe;const $t=fe.BITS,_e=new wNAF(Ue,t.endo?Math.ceil($t/2):$t);return Ue.BASE.precompute(8),Ue}function pprefix(c){return Uint8Array.of(c?2:3)}function getWLengths(c,t){return{secretKey:t.BYTES,publicKey:1+c.BYTES,publicKeyUncompressed:1+2*c.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function ecdh(c,t={}){const{Fn:n}=c,ie=t.randomBytes||randomBytes,fe=Object.assign(getWLengths(c.Fp,n),{seed:getMinHashLength(n.ORDER)});function ae(Me){try{return!!_normFnElement(n,Me)}catch{return!1}}function le(Me,Be){const{publicKey:$e,publicKeyUncompressed:ke}=fe;try{const Te=Me.length;return Be===!0&&Te!==$e||Be===!1&&Te!==ke?!1:!!c.fromBytes(Me)}catch{return!1}}function pe(Me=ie(fe.seed)){return mapHashToField(_abytes2(Me,fe.seed,"seed"),n.ORDER)}function me(Me,Be=!0){return c.BASE.multiply(_normFnElement(n,Me)).toBytes(Be)}function ye(Me){const Be=pe(Me);return{secretKey:Be,publicKey:me(Be)}}function xe(Me){if(typeof Me=="bigint")return!1;if(Me instanceof c)return!0;const{secretKey:Be,publicKey:$e,publicKeyUncompressed:ke}=fe;if(n.allowedLengths||Be===$e)return;const Te=ensureBytes("key",Me).length;return Te===$e||Te===ke}function Ee(Me,Be,$e=!0){if(xe(Me)===!0)throw new Error("first arg must be private key");if(xe(Be)===!1)throw new Error("second arg must be public key");const ke=_normFnElement(n,Me);return c.fromHex(Be).multiply(ke).toBytes($e)}return Object.freeze({getPublicKey:me,getSharedSecret:Ee,keygen:ye,Point:c,utils:{isValidSecretKey:ae,isValidPublicKey:le,randomSecretKey:pe,isValidPrivateKey:ae,randomPrivateKey:pe,normPrivateKeyToScalar:Me=>_normFnElement(n,Me),precompute(Me=8,Be=c.BASE){return Be.precompute(Me,!1)}},lengths:fe})}function ecdsa(c,t,n={}){ahash(t),_validateObject(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const ie=n.randomBytes||randomBytes,fe=n.hmac||((de,...he)=>hmac(t,de,concatBytes(...he))),{Fp:ae,Fn:le}=c,{ORDER:pe,BITS:me}=le,{keygen:ye,getPublicKey:xe,getSharedSecret:Ee,utils:Se,lengths:Me}=ecdh(c,n),Be={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},$e="compact";function ke(de){const he=pe>>_1n;return de>he}function Te(de,he){if(!le.isValidNot0(he))throw new Error(`invalid signature ${de}: out of range 1..Point.Fn.ORDER`);return he}function Ie(de,he){validateSigFormat(he);const ve=Me.signature,we=he==="compact"?ve:he==="recovered"?ve+1:void 0;return _abytes2(de,we,`${he} signature`)}class Fe{constructor(he,ve,we){this.r=Te("r",he),this.s=Te("s",ve),we!=null&&(this.recovery=we),Object.freeze(this)}static fromBytes(he,ve=$e){Ie(he,ve);let we;if(ve==="der"){const{r:ge,s:Re}=DER.toSig(_abytes2(he));return new Fe(ge,Re)}ve==="recovered"&&(we=he[0],ve="compact",he=he.subarray(1));const Ae=le.BYTES,be=he.subarray(0,Ae),ue=he.subarray(Ae,Ae*2);return new Fe(le.fromBytes(be),le.fromBytes(ue),we)}static fromHex(he,ve){return this.fromBytes(hexToBytes(he),ve)}addRecoveryBit(he){return new Fe(this.r,this.s,he)}recoverPublicKey(he){const ve=ae.ORDER,{r:we,s:Ae,recovery:be}=this;if(be==null||![0,1,2,3].includes(be))throw new Error("recovery id invalid");if(pe*_2n$1<ve&&be>1)throw new Error("recovery id is ambiguous for h>1 curve");const ge=be===2||be===3?we+pe:we;if(!ae.isValid(ge))throw new Error("recovery id 2 or 3 invalid");const Re=ae.toBytes(ge),Ne=c.fromBytes(concatBytes(pprefix((be&1)===0),Re)),qe=le.inv(ge),Pe=He(ensureBytes("msgHash",he)),Ge=le.create(-Pe*qe),Ce=le.create(Ae*qe),De=c.BASE.multiplyUnsafe(Ge).add(Ne.multiplyUnsafe(Ce));if(De.is0())throw new Error("point at infinify");return De.assertValidity(),De}hasHighS(){return ke(this.s)}toBytes(he=$e){if(validateSigFormat(he),he==="der")return hexToBytes(DER.hexFromSig(this));const ve=le.toBytes(this.r),we=le.toBytes(this.s);if(he==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return concatBytes(Uint8Array.of(this.recovery),ve,we)}return concatBytes(ve,we)}toHex(he){return bytesToHex(this.toBytes(he))}assertValidity(){}static fromCompact(he){return Fe.fromBytes(ensureBytes("sig",he),"compact")}static fromDER(he){return Fe.fromBytes(ensureBytes("sig",he),"der")}normalizeS(){return this.hasHighS()?new Fe(this.r,le.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return bytesToHex(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return bytesToHex(this.toBytes("compact"))}}const Le=n.bits2int||function(he){if(he.length>8192)throw new Error("input is too large");const ve=bytesToNumberBE(he),we=he.length*8-me;return we>0?ve>>BigInt(we):ve},He=n.bits2int_modN||function(he){return le.create(Le(he))},ze=bitMask(me);function Je(de){return aInRange("num < 2^"+me,de,_0n,ze),le.toBytes(de)}function Xe(de,he){return _abytes2(de,void 0,"message"),he?_abytes2(t(de),void 0,"prehashed message"):de}function Ue(de,he,ve){if(["recovered","canonical"].some(Ge=>Ge in ve))throw new Error("sign() legacy options not supported");const{lowS:we,prehash:Ae,extraEntropy:be}=validateSigOpts(ve,Be);de=Xe(de,Ae);const ue=He(de),ge=_normFnElement(le,he),Re=[Je(ge),Je(ue)];if(be!=null&&be!==!1){const Ge=be===!0?ie(Me.secretKey):be;Re.push(ensureBytes("extraEntropy",Ge))}const Ne=concatBytes(...Re),qe=ue;function Pe(Ge){const Ce=Le(Ge);if(!le.isValidNot0(Ce))return;const De=le.inv(Ce),je=c.BASE.multiply(Ce).toAffine(),Ve=le.create(je.x);if(Ve===_0n)return;const Mt=le.create(De*le.create(qe+Ve*ge));if(Mt===_0n)return;let Oe=(je.x===Ve?0:2)|Number(je.y&_1n),We=Mt;return we&&ke(Mt)&&(We=le.neg(Mt),Oe^=1),new Fe(Ve,We,Oe)}return{seed:Ne,k2sig:Pe}}function $t(de,he,ve={}){de=ensureBytes("message",de);const{seed:we,k2sig:Ae}=Ue(de,he,ve);return createHmacDrbg(t.outputLen,le.BYTES,fe)(we,Ae)}function _e(de){let he;const ve=typeof de=="string"||isBytes(de),we=!ve&&de!==null&&typeof de=="object"&&typeof de.r=="bigint"&&typeof de.s=="bigint";if(!ve&&!we)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(we)he=new Fe(de.r,de.s);else if(ve){try{he=Fe.fromBytes(ensureBytes("sig",de),"der")}catch(Ae){if(!(Ae instanceof DER.Err))throw Ae}if(!he)try{he=Fe.fromBytes(ensureBytes("sig",de),"compact")}catch{return!1}}return he||!1}function se(de,he,ve,we={}){const{lowS:Ae,prehash:be,format:ue}=validateSigOpts(we,Be);if(ve=ensureBytes("publicKey",ve),he=Xe(ensureBytes("message",he),be),"strict"in we)throw new Error("options.strict was renamed to lowS");const ge=ue===void 0?_e(de):Fe.fromBytes(ensureBytes("sig",de),ue);if(ge===!1)return!1;try{const Re=c.fromBytes(ve);if(Ae&&ge.hasHighS())return!1;const{r:Ne,s:qe}=ge,Pe=He(he),Ge=le.inv(qe),Ce=le.create(Pe*Ge),De=le.create(Ne*Ge),je=c.BASE.multiplyUnsafe(Ce).add(Re.multiplyUnsafe(De));return je.is0()?!1:le.create(je.x)===Ne}catch{return!1}}function ce(de,he,ve={}){const{prehash:we}=validateSigOpts(ve,Be);return he=Xe(he,we),Fe.fromBytes(de,"recovered").recoverPublicKey(he).toBytes()}return Object.freeze({keygen:ye,getPublicKey:xe,getSharedSecret:Ee,utils:Se,lengths:Me,Point:c,sign:$t,verify:se,recoverPublicKey:ce,Signature:Fe,hash:t})}function _weierstrass_legacy_opts_to_new(c){const t={a:c.a,b:c.b,p:c.Fp.ORDER,n:c.n,h:c.h,Gx:c.Gx,Gy:c.Gy},n=c.Fp;let ie=c.allowedPrivateKeyLengths?Array.from(new Set(c.allowedPrivateKeyLengths.map(le=>Math.ceil(le/2)))):void 0;const fe=Field(t.n,{BITS:c.nBitLength,allowedLengths:ie,modFromBytes:c.wrapPrivateKey}),ae={Fp:n,Fn:fe,allowInfinityPoint:c.allowInfinityPoint,endo:c.endo,isTorsionFree:c.isTorsionFree,clearCofactor:c.clearCofactor,fromBytes:c.fromBytes,toBytes:c.toBytes};return{CURVE:t,curveOpts:ae}}function _ecdsa_legacy_opts_to_new(c){const{CURVE:t,curveOpts:n}=_weierstrass_legacy_opts_to_new(c),ie={hmac:c.hmac,randomBytes:c.randomBytes,lowS:c.lowS,bits2int:c.bits2int,bits2int_modN:c.bits2int_modN};return{CURVE:t,curveOpts:n,hash:c.hash,ecdsaOpts:ie}}function _ecdsa_new_output_to_legacy(c,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},c,nLength(n.Fn.ORDER,n.Fn.BITS))})}function weierstrass(c){const{CURVE:t,curveOpts:n,hash:ie,ecdsaOpts:fe}=_ecdsa_legacy_opts_to_new(c),ae=weierstrassN(t,n),le=ecdsa(ae,ie,fe);return _ecdsa_new_output_to_legacy(c,le)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function createCurve(c,t){const n=ie=>weierstrass({...c,hash:ie});return{...n(t),create:n}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1_CURVE={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},secp256k1_ENDO={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},_2n=BigInt(2);function sqrtMod(c){const t=secp256k1_CURVE.p,n=BigInt(3),ie=BigInt(6),fe=BigInt(11),ae=BigInt(22),le=BigInt(23),pe=BigInt(44),me=BigInt(88),ye=c*c*c%t,xe=ye*ye*c%t,Ee=pow2(xe,n,t)*xe%t,Se=pow2(Ee,n,t)*xe%t,Me=pow2(Se,_2n,t)*ye%t,Be=pow2(Me,fe,t)*Me%t,$e=pow2(Be,ae,t)*Be%t,ke=pow2($e,pe,t)*$e%t,Te=pow2(ke,me,t)*ke%t,Ie=pow2(Te,pe,t)*$e%t,Fe=pow2(Ie,n,t)*xe%t,Le=pow2(Fe,le,t)*Be%t,He=pow2(Le,ie,t)*ye%t,ze=pow2(He,_2n,t);if(!Fpk1.eql(Fpk1.sqr(ze),c))throw new Error("Cannot find square root");return ze}const Fpk1=Field(secp256k1_CURVE.p,{sqrt:sqrtMod}),secp256k1$1=createCurve({...secp256k1_CURVE,Fp:Fpk1,lowS:!0,endo:secp256k1_ENDO},sha256$5);ed25519.utils.randomPrivateKey;ed25519.getPublicKey;function isOnCurve(c){try{return ed25519.ExtendedPoint.fromHex(c),!0}catch{return!1}}const sign$2=(c,t)=>ed25519.sign(c,t.slice(0,32)),verify$1=ed25519.verify,toBuffer$1=c=>dist$1.Buffer.isBuffer(c)?c:c instanceof Uint8Array?dist$1.Buffer.from(c.buffer,c.byteOffset,c.byteLength):dist$1.Buffer.from(c);class Struct{constructor(t){Object.assign(this,t)}encode(){return dist$1.Buffer.from(serialize_1(SOLANA_SCHEMA,this))}static decode(t){return deserialize_1(SOLANA_SCHEMA,this,t)}static decodeUnchecked(t){return deserializeUnchecked_1(SOLANA_SCHEMA,this,t)}}const SOLANA_SCHEMA=new Map;var _PublicKey;const MAX_SEED_LENGTH=32,PUBLIC_KEY_LENGTH=32;function isPublicKeyData(c){return c._bn!==void 0}let uniquePublicKeyCounter=1;class PublicKey extends Struct{constructor(t){if(super({}),this._bn=void 0,isPublicKeyData(t))this._bn=t._bn;else{if(typeof t=="string"){const n=o$1.decode(t);if(n.length!=PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input");this._bn=new BN$8(n)}else this._bn=new BN$8(t);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input")}}static unique(){const t=new PublicKey(uniquePublicKeyCounter);return uniquePublicKeyCounter+=1,new PublicKey(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return o$1.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(dist$1.Buffer);if(t.length===PUBLIC_KEY_LENGTH)return t;const n=dist$1.Buffer.alloc(32);return t.copy(n,32-t.length),n}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,n,ie){const fe=dist$1.Buffer.concat([t.toBuffer(),dist$1.Buffer.from(n),ie.toBuffer()]),ae=sha256$4(fe);return new PublicKey(ae)}static createProgramAddressSync(t,n){let ie=dist$1.Buffer.alloc(0);t.forEach(function(ae){if(ae.length>MAX_SEED_LENGTH)throw new TypeError("Max seed length exceeded");ie=dist$1.Buffer.concat([ie,toBuffer$1(ae)])}),ie=dist$1.Buffer.concat([ie,n.toBuffer(),dist$1.Buffer.from("ProgramDerivedAddress")]);const fe=sha256$4(ie);if(isOnCurve(fe))throw new Error("Invalid seeds, address must fall off the curve");return new PublicKey(fe)}static async createProgramAddress(t,n){return this.createProgramAddressSync(t,n)}static findProgramAddressSync(t,n){let ie=255,fe;for(;ie!=0;){try{const ae=t.concat(dist$1.Buffer.from([ie]));fe=this.createProgramAddressSync(ae,n)}catch(ae){if(ae instanceof TypeError)throw ae;ie--;continue}return[fe,ie]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,n){return this.findProgramAddressSync(t,n)}static isOnCurve(t){const n=new PublicKey(t);return isOnCurve(n.toBytes())}}_PublicKey=PublicKey;PublicKey.default=new _PublicKey("11111111111111111111111111111111");SOLANA_SCHEMA.set(PublicKey,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey("BPFLoader1111111111111111111111111111111111");const PACKET_DATA_SIZE=1232,VERSION_PREFIX_MASK=127,SIGNATURE_LENGTH_IN_BYTES=64;class TransactionExpiredBlockheightExceededError extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(TransactionExpiredBlockheightExceededError.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class TransactionExpiredTimeoutError extends Error{constructor(t,n){super(`Transaction was not confirmed in ${n.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(TransactionExpiredTimeoutError.prototype,"name",{value:"TransactionExpiredTimeoutError"});class TransactionExpiredNonceInvalidError extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(TransactionExpiredNonceInvalidError.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class MessageAccountKeys{constructor(t,n){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=n}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const n of this.keySegments()){if(t<n.length)return n[t];t-=n.length}}get length(){return this.keySegments().flat().length}compileInstructions(t){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const ie=new Map;this.keySegments().flat().forEach((ae,le)=>{ie.set(ae.toBase58(),le)});const fe=ae=>{const le=ie.get(ae.toBase58());if(le===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return le};return t.map(ae=>({programIdIndex:fe(ae.programId),accountKeyIndexes:ae.keys.map(le=>fe(le.pubkey)),data:ae.data}))}}const publicKey$1=(c="publicKey")=>blob(32,c),signature$2=(c="signature")=>blob(64,c),rustString=(c="string")=>{const t=struct([u32("length"),u32("lengthPadding"),blob(offset(u32(),-8),"chars")],c),n=t.decode.bind(t),ie=t.encode.bind(t),fe=t;return fe.decode=(ae,le)=>n(ae,le).chars.toString(),fe.encode=(ae,le,pe)=>{const me={chars:dist$1.Buffer.from(ae,"utf8")};return ie(me,le,pe)},fe.alloc=ae=>u32().span+u32().span+dist$1.Buffer.from(ae,"utf8").length,fe},authorized=(c="authorized")=>struct([publicKey$1("staker"),publicKey$1("withdrawer")],c),lockup=(c="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$1("custodian")],c),voteInit=(c="voteInit")=>struct([publicKey$1("nodePubkey"),publicKey$1("authorizedVoter"),publicKey$1("authorizedWithdrawer"),u8("commission")],c),voteAuthorizeWithSeedArgs=(c="voteAuthorizeWithSeedArgs")=>struct([u32("voteAuthorizationType"),publicKey$1("currentAuthorityDerivedKeyOwnerPubkey"),rustString("currentAuthorityDerivedKeySeed"),publicKey$1("newAuthorized")],c);function getAlloc(c,t){const n=fe=>{if(fe.span>=0)return fe.span;if(typeof fe.alloc=="function")return fe.alloc(t[fe.property]);if("count"in fe&&"elementLayout"in fe){const ae=t[fe.property];if(Array.isArray(ae))return ae.length*n(fe.elementLayout)}else if("fields"in fe)return getAlloc({layout:fe},t[fe.property]);return 0};let ie=0;return c.layout.fields.forEach(fe=>{ie+=n(fe)}),ie}function decodeLength(c){let t=0,n=0;for(;;){let ie=c.shift();if(t|=(ie&127)<<n*7,n+=1,!(ie&128))break}return t}function encodeLength(c,t){let n=t;for(;;){let ie=n&127;if(n>>=7,n==0){c.push(ie);break}else ie|=128,c.push(ie)}}function assert$9(c,t){if(!c)throw new Error(t||"Assertion failed")}class CompiledKeys{constructor(t,n){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=n}static compile(t,n){const ie=new Map,fe=le=>{const pe=le.toBase58();let me=ie.get(pe);return me===void 0&&(me={isSigner:!1,isWritable:!1,isInvoked:!1},ie.set(pe,me)),me},ae=fe(n);ae.isSigner=!0,ae.isWritable=!0;for(const le of t){fe(le.programId).isInvoked=!0;for(const pe of le.keys){const me=fe(pe.pubkey);me.isSigner||(me.isSigner=pe.isSigner),me.isWritable||(me.isWritable=pe.isWritable)}}return new CompiledKeys(n,ie)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];assert$9(t.length<=256,"Max static account keys length exceeded");const n=t.filter(([,me])=>me.isSigner&&me.isWritable),ie=t.filter(([,me])=>me.isSigner&&!me.isWritable),fe=t.filter(([,me])=>!me.isSigner&&me.isWritable),ae=t.filter(([,me])=>!me.isSigner&&!me.isWritable),le={numRequiredSignatures:n.length+ie.length,numReadonlySignedAccounts:ie.length,numReadonlyUnsignedAccounts:ae.length};{assert$9(n.length>0,"Expected at least one writable signer key");const[me]=n[0];assert$9(me===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const pe=[...n.map(([me])=>new PublicKey(me)),...ie.map(([me])=>new PublicKey(me)),...fe.map(([me])=>new PublicKey(me)),...ae.map(([me])=>new PublicKey(me))];return[le,pe]}extractTableLookup(t){const[n,ie]=this.drainKeysFoundInLookupTable(t.state.addresses,le=>!le.isSigner&&!le.isInvoked&&le.isWritable),[fe,ae]=this.drainKeysFoundInLookupTable(t.state.addresses,le=>!le.isSigner&&!le.isInvoked&&!le.isWritable);if(!(n.length===0&&fe.length===0))return[{accountKey:t.key,writableIndexes:n,readonlyIndexes:fe},{writable:ie,readonly:ae}]}drainKeysFoundInLookupTable(t,n){const ie=new Array,fe=new Array;for(const[ae,le]of this.keyMetaMap.entries())if(n(le)){const pe=new PublicKey(ae),me=t.findIndex(ye=>ye.equals(pe));me>=0&&(assert$9(me<256,"Max lookup table index exceeded"),ie.push(me),fe.push(pe),this.keyMetaMap.delete(ae))}return[ie,fe]}}const END_OF_BUFFER_ERROR_MESSAGE="Reached end of buffer unexpectedly";function guardedShift(c){if(c.length===0)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return c.shift()}function guardedSplice(c,...t){const[n]=t;if(t.length===2?n+(t[1]??0)>c.length:n>=c.length)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return c.splice(...t)}class Message{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(n=>new PublicKey(n)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(n=>this.indexToProgramIds.set(n.programIdIndex,this.accountKeys[n.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:o$1.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new MessageAccountKeys(this.staticAccountKeys)}static compile(t){const n=CompiledKeys.compile(t.instructions,t.payerKey),[ie,fe]=n.getMessageComponents(),le=new MessageAccountKeys(fe).compileInstructions(t.instructions).map(pe=>({programIdIndex:pe.programIdIndex,accounts:pe.accountKeyIndexes,data:o$1.encode(pe.data)}));return new Message({header:ie,accountKeys:fe,recentBlockhash:t.recentBlockhash,instructions:le})}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const n=this.header.numRequiredSignatures;if(t>=this.header.numRequiredSignatures){const ie=t-n,ae=this.accountKeys.length-n-this.header.numReadonlyUnsignedAccounts;return ie<ae}else{const ie=n-this.header.numReadonlySignedAccounts;return t<ie}}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((t,n)=>!this.isProgramId(n))}serialize(){const t=this.accountKeys.length;let n=[];encodeLength(n,t);const ie=this.instructions.map(Ee=>{const{accounts:Se,programIdIndex:Me}=Ee,Be=Array.from(o$1.decode(Ee.data));let $e=[];encodeLength($e,Se.length);let ke=[];return encodeLength(ke,Be.length),{programIdIndex:Me,keyIndicesCount:dist$1.Buffer.from($e),keyIndices:Se,dataLength:dist$1.Buffer.from(ke),data:Be}});let fe=[];encodeLength(fe,ie.length);let ae=dist$1.Buffer.alloc(PACKET_DATA_SIZE);dist$1.Buffer.from(fe).copy(ae);let le=fe.length;ie.forEach(Ee=>{const Me=struct([u8("programIdIndex"),blob(Ee.keyIndicesCount.length,"keyIndicesCount"),seq(u8("keyIndex"),Ee.keyIndices.length,"keyIndices"),blob(Ee.dataLength.length,"dataLength"),seq(u8("userdatum"),Ee.data.length,"data")]).encode(Ee,ae,le);le+=Me}),ae=ae.slice(0,le);const pe=struct([blob(1,"numRequiredSignatures"),blob(1,"numReadonlySignedAccounts"),blob(1,"numReadonlyUnsignedAccounts"),blob(n.length,"keyCount"),seq(publicKey$1("key"),t,"keys"),publicKey$1("recentBlockhash")]),me={numRequiredSignatures:dist$1.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:dist$1.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:dist$1.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:dist$1.Buffer.from(n),keys:this.accountKeys.map(Ee=>toBuffer$1(Ee.toBytes())),recentBlockhash:o$1.decode(this.recentBlockhash)};let ye=dist$1.Buffer.alloc(2048);const xe=pe.encode(me,ye);return ae.copy(ye,xe),ye.slice(0,xe+ae.length)}static from(t){let n=[...t];const ie=guardedShift(n);if(ie!==(ie&VERSION_PREFIX_MASK))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const fe=guardedShift(n),ae=guardedShift(n),le=decodeLength(n);let pe=[];for(let Se=0;Se<le;Se++){const Me=guardedSplice(n,0,PUBLIC_KEY_LENGTH);pe.push(new PublicKey(dist$1.Buffer.from(Me)))}const me=guardedSplice(n,0,PUBLIC_KEY_LENGTH),ye=decodeLength(n);let xe=[];for(let Se=0;Se<ye;Se++){const Me=guardedShift(n),Be=decodeLength(n),$e=guardedSplice(n,0,Be),ke=decodeLength(n),Te=guardedSplice(n,0,ke),Ie=o$1.encode(dist$1.Buffer.from(Te));xe.push({programIdIndex:Me,accounts:$e,data:Ie})}const Ee={header:{numRequiredSignatures:ie,numReadonlySignedAccounts:fe,numReadonlyUnsignedAccounts:ae},recentBlockhash:o$1.encode(dist$1.Buffer.from(me)),accountKeys:pe,instructions:xe};return new Message(Ee)}}class MessageV0{constructor(t){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let t=0;for(const n of this.addressTableLookups)t+=n.readonlyIndexes.length+n.writableIndexes.length;return t}getAccountKeys(t){let n;if(t&&"accountKeysFromLookups"in t&&t.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=t.accountKeysFromLookups.writable.length+t.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");n=t.accountKeysFromLookups}else if(t&&"addressLookupTableAccounts"in t&&t.addressLookupTableAccounts)n=this.resolveAddressTableLookups(t.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new MessageAccountKeys(this.staticAccountKeys,n)}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const n=this.header.numRequiredSignatures,ie=this.staticAccountKeys.length;if(t>=ie){const fe=t-ie,ae=this.addressTableLookups.reduce((le,pe)=>le+pe.writableIndexes.length,0);return fe<ae}else if(t>=this.header.numRequiredSignatures){const fe=t-n,le=ie-n-this.header.numReadonlyUnsignedAccounts;return fe<le}else{const fe=n-this.header.numReadonlySignedAccounts;return t<fe}}resolveAddressTableLookups(t){const n={writable:[],readonly:[]};for(const ie of this.addressTableLookups){const fe=t.find(ae=>ae.key.equals(ie.accountKey));if(!fe)throw new Error(`Failed to find address lookup table account for table key ${ie.accountKey.toBase58()}`);for(const ae of ie.writableIndexes)if(ae<fe.state.addresses.length)n.writable.push(fe.state.addresses[ae]);else throw new Error(`Failed to find address for index ${ae} in address lookup table ${ie.accountKey.toBase58()}`);for(const ae of ie.readonlyIndexes)if(ae<fe.state.addresses.length)n.readonly.push(fe.state.addresses[ae]);else throw new Error(`Failed to find address for index ${ae} in address lookup table ${ie.accountKey.toBase58()}`)}return n}static compile(t){const n=CompiledKeys.compile(t.instructions,t.payerKey),ie=new Array,fe={writable:new Array,readonly:new Array},ae=t.addressLookupTableAccounts||[];for(const xe of ae){const Ee=n.extractTableLookup(xe);if(Ee!==void 0){const[Se,{writable:Me,readonly:Be}]=Ee;ie.push(Se),fe.writable.push(...Me),fe.readonly.push(...Be)}}const[le,pe]=n.getMessageComponents(),ye=new MessageAccountKeys(pe,fe).compileInstructions(t.instructions);return new MessageV0({header:le,staticAccountKeys:pe,recentBlockhash:t.recentBlockhash,compiledInstructions:ye,addressTableLookups:ie})}serialize(){const t=Array();encodeLength(t,this.staticAccountKeys.length);const n=this.serializeInstructions(),ie=Array();encodeLength(ie,this.compiledInstructions.length);const fe=this.serializeAddressTableLookups(),ae=Array();encodeLength(ae,this.addressTableLookups.length);const le=struct([u8("prefix"),struct([u8("numRequiredSignatures"),u8("numReadonlySignedAccounts"),u8("numReadonlyUnsignedAccounts")],"header"),blob(t.length,"staticAccountKeysLength"),seq(publicKey$1(),this.staticAccountKeys.length,"staticAccountKeys"),publicKey$1("recentBlockhash"),blob(ie.length,"instructionsLength"),blob(n.length,"serializedInstructions"),blob(ae.length,"addressTableLookupsLength"),blob(fe.length,"serializedAddressTableLookups")]),pe=new Uint8Array(PACKET_DATA_SIZE),ye=le.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map(xe=>xe.toBytes()),recentBlockhash:o$1.decode(this.recentBlockhash),instructionsLength:new Uint8Array(ie),serializedInstructions:n,addressTableLookupsLength:new Uint8Array(ae),serializedAddressTableLookups:fe},pe);return pe.slice(0,ye)}serializeInstructions(){let t=0;const n=new Uint8Array(PACKET_DATA_SIZE);for(const ie of this.compiledInstructions){const fe=Array();encodeLength(fe,ie.accountKeyIndexes.length);const ae=Array();encodeLength(ae,ie.data.length);const le=struct([u8("programIdIndex"),blob(fe.length,"encodedAccountKeyIndexesLength"),seq(u8(),ie.accountKeyIndexes.length,"accountKeyIndexes"),blob(ae.length,"encodedDataLength"),blob(ie.data.length,"data")]);t+=le.encode({programIdIndex:ie.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(fe),accountKeyIndexes:ie.accountKeyIndexes,encodedDataLength:new Uint8Array(ae),data:ie.data},n,t)}return n.slice(0,t)}serializeAddressTableLookups(){let t=0;const n=new Uint8Array(PACKET_DATA_SIZE);for(const ie of this.addressTableLookups){const fe=Array();encodeLength(fe,ie.writableIndexes.length);const ae=Array();encodeLength(ae,ie.readonlyIndexes.length);const le=struct([publicKey$1("accountKey"),blob(fe.length,"encodedWritableIndexesLength"),seq(u8(),ie.writableIndexes.length,"writableIndexes"),blob(ae.length,"encodedReadonlyIndexesLength"),seq(u8(),ie.readonlyIndexes.length,"readonlyIndexes")]);t+=le.encode({accountKey:ie.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(fe),writableIndexes:ie.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(ae),readonlyIndexes:ie.readonlyIndexes},n,t)}return n.slice(0,t)}static deserialize(t){let n=[...t];const ie=guardedShift(n),fe=ie&VERSION_PREFIX_MASK;assert$9(ie!==fe,"Expected versioned message but received legacy message");const ae=fe;assert$9(ae===0,`Expected versioned message with version 0 but found version ${ae}`);const le={numRequiredSignatures:guardedShift(n),numReadonlySignedAccounts:guardedShift(n),numReadonlyUnsignedAccounts:guardedShift(n)},pe=[],me=decodeLength(n);for(let Be=0;Be<me;Be++)pe.push(new PublicKey(guardedSplice(n,0,PUBLIC_KEY_LENGTH)));const ye=o$1.encode(guardedSplice(n,0,PUBLIC_KEY_LENGTH)),xe=decodeLength(n),Ee=[];for(let Be=0;Be<xe;Be++){const $e=guardedShift(n),ke=decodeLength(n),Te=guardedSplice(n,0,ke),Ie=decodeLength(n),Fe=new Uint8Array(guardedSplice(n,0,Ie));Ee.push({programIdIndex:$e,accountKeyIndexes:Te,data:Fe})}const Se=decodeLength(n),Me=[];for(let Be=0;Be<Se;Be++){const $e=new PublicKey(guardedSplice(n,0,PUBLIC_KEY_LENGTH)),ke=decodeLength(n),Te=guardedSplice(n,0,ke),Ie=decodeLength(n),Fe=guardedSplice(n,0,Ie);Me.push({accountKey:$e,writableIndexes:Te,readonlyIndexes:Fe})}return new MessageV0({header:le,staticAccountKeys:pe,recentBlockhash:ye,compiledInstructions:Ee,addressTableLookups:Me})}}const VersionedMessage={deserializeMessageVersion(c){const t=c[0],n=t&VERSION_PREFIX_MASK;return n===t?"legacy":n},deserialize:c=>{const t=VersionedMessage.deserializeMessageVersion(c);if(t==="legacy")return Message.from(c);if(t===0)return MessageV0.deserialize(c);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let TransactionStatus=function(c){return c[c.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",c[c.PROCESSED=1]="PROCESSED",c[c.TIMED_OUT=2]="TIMED_OUT",c[c.NONCE_INVALID=3]="NONCE_INVALID",c}({});const DEFAULT_SIGNATURE=dist$1.Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);class TransactionInstruction{constructor(t){this.keys=void 0,this.programId=void 0,this.data=dist$1.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:n,isWritable:ie})=>({pubkey:t.toJSON(),isSigner:n,isWritable:ie})),programId:this.programId.toJSON(),data:[...this.data]}}}class Transaction{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:n,nonceInfo:ie}=t;this.minNonceContextSlot=n,this.nonceInfo=ie}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:n,lastValidBlockHeight:ie}=t;this.recentBlockhash=n,this.lastValidBlockHeight=ie}else{const{recentBlockhash:n,nonceInfo:ie}=t;ie&&(this.nonceInfo=ie),this.recentBlockhash=n}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(n=>{"instructions"in n?this.instructions=this.instructions.concat(n.instructions):"data"in n&&"programId"in n&&"keys"in n?this.instructions.push(n):this.instructions.push(new TransactionInstruction(n))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?n=[this.nonceInfo.nonceInstruction,...this.instructions]:n=this.instructions):(t=this.recentBlockhash,n=this.instructions),!t)throw new Error("Transaction recentBlockhash required");n.length<1&&console.warn("No instructions provided");let ie;if(this.feePayer)ie=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)ie=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let $e=0;$e<n.length;$e++)if(n[$e].programId===void 0)throw new Error(`Transaction instruction index ${$e} has undefined program id`);const fe=[],ae=[];n.forEach($e=>{$e.keys.forEach(Te=>{ae.push({...Te})});const ke=$e.programId.toString();fe.includes(ke)||fe.push(ke)}),fe.forEach($e=>{ae.push({pubkey:new PublicKey($e),isSigner:!1,isWritable:!1})});const le=[];ae.forEach($e=>{const ke=$e.pubkey.toString(),Te=le.findIndex(Ie=>Ie.pubkey.toString()===ke);Te>-1?(le[Te].isWritable=le[Te].isWritable||$e.isWritable,le[Te].isSigner=le[Te].isSigner||$e.isSigner):le.push($e)}),le.sort(function($e,ke){if($e.isSigner!==ke.isSigner)return $e.isSigner?-1:1;if($e.isWritable!==ke.isWritable)return $e.isWritable?-1:1;const Te={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return $e.pubkey.toBase58().localeCompare(ke.pubkey.toBase58(),"en",Te)});const pe=le.findIndex($e=>$e.pubkey.equals(ie));if(pe>-1){const[$e]=le.splice(pe,1);$e.isSigner=!0,$e.isWritable=!0,le.unshift($e)}else le.unshift({pubkey:ie,isSigner:!0,isWritable:!0});for(const $e of this.signatures){const ke=le.findIndex(Te=>Te.pubkey.equals($e.publicKey));if(ke>-1)le[ke].isSigner||(le[ke].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${$e.publicKey.toString()}`)}let me=0,ye=0,xe=0;const Ee=[],Se=[];le.forEach(({pubkey:$e,isSigner:ke,isWritable:Te})=>{ke?(Ee.push($e.toString()),me+=1,Te||(ye+=1)):(Se.push($e.toString()),Te||(xe+=1))});const Me=Ee.concat(Se),Be=n.map($e=>{const{data:ke,programId:Te}=$e;return{programIdIndex:Me.indexOf(Te.toString()),accounts:$e.keys.map(Ie=>Me.indexOf(Ie.pubkey.toString())),data:o$1.encode(ke)}});return Be.forEach($e=>{assert$9($e.programIdIndex>=0),$e.accounts.forEach(ke=>assert$9(ke>=0))}),new Message({header:{numRequiredSignatures:me,numReadonlySignedAccounts:ye,numReadonlyUnsignedAccounts:xe},accountKeys:Me,recentBlockhash:t,instructions:Be})}_compile(){const t=this.compileMessage(),n=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===n.length&&this.signatures.every((fe,ae)=>n[ae].equals(fe.publicKey))||(this.signatures=n.map(ie=>({signature:null,publicKey:ie}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");const n=new Set;this.signatures=t.filter(ie=>{const fe=ie.toString();return n.has(fe)?!1:(n.add(fe),!0)}).map(ie=>({signature:null,publicKey:ie}))}sign(...t){if(t.length===0)throw new Error("No signers");const n=new Set,ie=[];for(const ae of t){const le=ae.publicKey.toString();n.has(le)||(n.add(le),ie.push(ae))}this.signatures=ie.map(ae=>({signature:null,publicKey:ae.publicKey}));const fe=this._compile();this._partialSign(fe,...ie)}partialSign(...t){if(t.length===0)throw new Error("No signers");const n=new Set,ie=[];for(const ae of t){const le=ae.publicKey.toString();n.has(le)||(n.add(le),ie.push(ae))}const fe=this._compile();this._partialSign(fe,...ie)}_partialSign(t,...n){const ie=t.serialize();n.forEach(fe=>{const ae=sign$2(ie,fe.secretKey);this._addSignature(fe.publicKey,toBuffer$1(ae))})}addSignature(t,n){this._compile(),this._addSignature(t,n)}_addSignature(t,n){assert$9(n.length===64);const ie=this.signatures.findIndex(fe=>t.equals(fe.publicKey));if(ie<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[ie].signature=dist$1.Buffer.from(n)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,n){const ie={};for(const{signature:fe,publicKey:ae}of this.signatures)fe===null?n&&(ie.missing||(ie.missing=[])).push(ae):verify$1(fe,t,ae.toBytes())||(ie.invalid||(ie.invalid=[])).push(ae);return ie.invalid||ie.missing?ie:void 0}serialize(t){const{requireAllSignatures:n,verifySignatures:ie}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),fe=this.serializeMessage();if(ie){const ae=this._getMessageSignednessErrors(fe,n);if(ae){let le="Signature verification failed.";throw ae.invalid&&(le+=`
18
18
  Invalid signature for public key${ae.invalid.length===1?"":"(s)"} [\`${ae.invalid.map(pe=>pe.toBase58()).join("`, `")}\`].`),ae.missing&&(le+=`
19
19
  Missing signature for public key${ae.missing.length===1?"":"(s)"} [\`${ae.missing.map(pe=>pe.toBase58()).join("`, `")}\`].`),new Error(le)}}return this._serialize(fe)}_serialize(t){const{signatures:n}=this,ie=[];encodeLength(ie,n.length);const fe=ie.length+n.length*64+t.length,ae=dist$1.Buffer.alloc(fe);return assert$9(n.length<256),dist$1.Buffer.from(ie).copy(ae,0),n.forEach(({signature:le},pe)=>{le!==null&&(assert$9(le.length===64,"signature has invalid length"),dist$1.Buffer.from(le).copy(ae,ie.length+pe*64))}),t.copy(ae,ie.length+n.length*64),assert$9(ae.length<=PACKET_DATA_SIZE,`Transaction too large: ${ae.length} > ${PACKET_DATA_SIZE}`),ae}get keys(){return assert$9(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return assert$9(this.instructions.length===1),this.instructions[0].programId}get data(){return assert$9(this.instructions.length===1),this.instructions[0].data}static from(t){let n=[...t];const ie=decodeLength(n);let fe=[];for(let ae=0;ae<ie;ae++){const le=guardedSplice(n,0,SIGNATURE_LENGTH_IN_BYTES);fe.push(o$1.encode(dist$1.Buffer.from(le)))}return Transaction.populate(Message.from(n),fe)}static populate(t,n=[]){const ie=new Transaction;return ie.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(ie.feePayer=t.accountKeys[0]),n.forEach((fe,ae)=>{const le={signature:fe==o$1.encode(DEFAULT_SIGNATURE)?null:o$1.decode(fe),publicKey:t.accountKeys[ae]};ie.signatures.push(le)}),t.instructions.forEach(fe=>{const ae=fe.accounts.map(le=>{const pe=t.accountKeys[le];return{pubkey:pe,isSigner:ie.signatures.some(me=>me.publicKey.toString()===pe.toString())||t.isAccountSigner(le),isWritable:t.isAccountWritable(le)}});ie.instructions.push(new TransactionInstruction({keys:ae,programId:t.accountKeys[fe.programIdIndex],data:o$1.decode(fe.data)}))}),ie._message=t,ie._json=ie.toJSON(),ie}}class TransactionMessage{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,n){const{header:ie,compiledInstructions:fe,recentBlockhash:ae}=t,{numRequiredSignatures:le,numReadonlySignedAccounts:pe,numReadonlyUnsignedAccounts:me}=ie,ye=le-pe;assert$9(ye>0,"Message header is invalid");const xe=t.staticAccountKeys.length-le-me;assert$9(xe>=0,"Message header is invalid");const Ee=t.getAccountKeys(n),Se=Ee.get(0);if(Se===void 0)throw new Error("Failed to decompile message because no account keys were found");const Me=[];for(const Be of fe){const $e=[];for(const Te of Be.accountKeyIndexes){const Ie=Ee.get(Te);if(Ie===void 0)throw new Error(`Failed to find key for account key index ${Te}`);const Fe=Te<le;let Le;Fe?Le=Te<ye:Te<Ee.staticAccountKeys.length?Le=Te-le<xe:Le=Te-Ee.staticAccountKeys.length<Ee.accountKeysFromLookups.writable.length,$e.push({pubkey:Ie,isSigner:Te<ie.numRequiredSignatures,isWritable:Le})}const ke=Ee.get(Be.programIdIndex);if(ke===void 0)throw new Error(`Failed to find program id for program id index ${Be.programIdIndex}`);Me.push(new TransactionInstruction({programId:ke,data:toBuffer$1(Be.data),keys:$e}))}return new TransactionMessage({payerKey:Se,instructions:Me,recentBlockhash:ae})}compileToLegacyMessage(){return Message.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}compileToV0Message(t){return MessageV0.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:t})}}class VersionedTransaction{get version(){return this.message.version}constructor(t,n){if(this.signatures=void 0,this.message=void 0,n!==void 0)assert$9(n.length===t.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=n;else{const ie=[];for(let fe=0;fe<t.header.numRequiredSignatures;fe++)ie.push(new Uint8Array(SIGNATURE_LENGTH_IN_BYTES));this.signatures=ie}this.message=t}serialize(){const t=this.message.serialize(),n=Array();encodeLength(n,this.signatures.length);const ie=struct([blob(n.length,"encodedSignaturesLength"),seq(signature$2(),this.signatures.length,"signatures"),blob(t.length,"serializedMessage")]),fe=new Uint8Array(2048),ae=ie.encode({encodedSignaturesLength:new Uint8Array(n),signatures:this.signatures,serializedMessage:t},fe);return fe.slice(0,ae)}static deserialize(t){let n=[...t];const ie=[],fe=decodeLength(n);for(let le=0;le<fe;le++)ie.push(new Uint8Array(guardedSplice(n,0,SIGNATURE_LENGTH_IN_BYTES)));const ae=VersionedMessage.deserialize(new Uint8Array(n));return new VersionedTransaction(ae,ie)}sign(t){const n=this.message.serialize(),ie=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(const fe of t){const ae=ie.findIndex(le=>le.equals(fe.publicKey));assert$9(ae>=0,`Cannot sign with non signer key ${fe.publicKey.toBase58()}`),this.signatures[ae]=sign$2(n,fe.secretKey)}}addSignature(t,n){assert$9(n.byteLength===64,"Signature must be 64 bytes long");const fe=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(ae=>ae.equals(t));assert$9(fe>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[fe]=n}}const NUM_TICKS_PER_SECOND=160,DEFAULT_TICKS_PER_SLOT=64,NUM_SLOTS_PER_SECOND=NUM_TICKS_PER_SECOND/DEFAULT_TICKS_PER_SLOT,MS_PER_SLOT=1e3/NUM_SLOTS_PER_SECOND;new PublicKey("SysvarC1ock11111111111111111111111111111111");new PublicKey("SysvarEpochSchedu1e111111111111111111111111");new PublicKey("Sysvar1nstructions1111111111111111111111111");const SYSVAR_RECENT_BLOCKHASHES_PUBKEY=new PublicKey("SysvarRecentB1ockHashes11111111111111111111"),SYSVAR_RENT_PUBKEY=new PublicKey("SysvarRent111111111111111111111111111111111");new PublicKey("SysvarRewards111111111111111111111111111111");new PublicKey("SysvarS1otHashes111111111111111111111111111");new PublicKey("SysvarS1otHistory11111111111111111111111111");new PublicKey("SysvarStakeHistory1111111111111111111111111");class SendTransactionError extends Error{constructor({action:t,signature:n,transactionMessage:ie,logs:fe}){const ae=fe?`Logs:
20
20
  ${JSON.stringify(fe.slice(-10),null,2)}. `:"",le="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";let pe;switch(t){case"send":pe=`Transaction ${n} resulted in an error.
@@ -32,7 +32,7 @@ Message: ${ie}.
32
32
  `))):je=Re.stylize("[Circular]","special")),Je(De)){if(Ce&&Ge.match(/^\d+$/))return je;De=JSON.stringify(""+Ge),De.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(De=De.slice(1,-1),De=Re.stylize(De,"name")):(De=De.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),De=Re.stylize(De,"string"))}return De+": "+je}function $e(Re,Ne,qe){var Pe=Re.reduce(function(Ge,Ce){return Ce.indexOf(`
33
33
  `)>=0,Ge+Ce.replace(/\u001b\[\d\d?m/g,"").length+1},0);return Pe>60?qe[0]+(Ne===""?"":Ne+`
34
34
  `)+" "+Re.join(`,
35
- `)+" "+qe[1]:qe[0]+Ne+" "+Re.join(", ")+" "+qe[1]}c.types=requireTypes();function ke(Re){return Array.isArray(Re)}c.isArray=ke;function Te(Re){return typeof Re=="boolean"}c.isBoolean=Te;function Ie(Re){return Re===null}c.isNull=Ie;function Fe(Re){return Re==null}c.isNullOrUndefined=Fe;function Le(Re){return typeof Re=="number"}c.isNumber=Le;function He(Re){return typeof Re=="string"}c.isString=He;function ze(Re){return typeof Re=="symbol"}c.isSymbol=ze;function Je(Re){return Re===void 0}c.isUndefined=Je;function Xe(Re){return Ue(Re)&&de(Re)==="[object RegExp]"}c.isRegExp=Xe,c.types.isRegExp=Xe;function Ue(Re){return typeof Re=="object"&&Re!==null}c.isObject=Ue;function $t(Re){return Ue(Re)&&de(Re)==="[object Date]"}c.isDate=$t,c.types.isDate=$t;function _e(Re){return Ue(Re)&&(de(Re)==="[object Error]"||Re instanceof Error)}c.isError=_e,c.types.isNativeError=_e;function se(Re){return typeof Re=="function"}c.isFunction=se;function ce(Re){return Re===null||typeof Re=="boolean"||typeof Re=="number"||typeof Re=="string"||typeof Re=="symbol"||typeof Re>"u"}c.isPrimitive=ce,c.isBuffer=requireIsBufferBrowser();function de(Re){return Object.prototype.toString.call(Re)}function he(Re){return Re<10?"0"+Re.toString(10):Re.toString(10)}var ve=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function we(){var Re=new Date,Ne=[he(Re.getHours()),he(Re.getMinutes()),he(Re.getSeconds())].join(":");return[Re.getDate(),ve[Re.getMonth()],Ne].join(" ")}c.log=function(){console.log("%s - %s",we(),c.format.apply(c,arguments))},c.inherits=requireInherits_browser(),c._extend=function(Re,Ne){if(!Ne||!Ue(Ne))return Re;for(var qe=Object.keys(Ne),Pe=qe.length;Pe--;)Re[qe[Pe]]=Ne[qe[Pe]];return Re};function Ae(Re,Ne){return Object.prototype.hasOwnProperty.call(Re,Ne)}var be=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;c.promisify=function(Ne){if(typeof Ne!="function")throw new TypeError('The "original" argument must be of type Function');if(be&&Ne[be]){var qe=Ne[be];if(typeof qe!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(qe,be,{value:qe,enumerable:!1,writable:!1,configurable:!0}),qe}function qe(){for(var Pe,Ge,Ce=new Promise(function(Ve,Mt){Pe=Ve,Ge=Mt}),De=[],je=0;je<arguments.length;je++)De.push(arguments[je]);De.push(function(Ve,Mt){Ve?Ge(Ve):Pe(Mt)});try{Ne.apply(this,De)}catch(Ve){Ge(Ve)}return Ce}return Object.setPrototypeOf(qe,Object.getPrototypeOf(Ne)),be&&Object.defineProperty(qe,be,{value:qe,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(qe,t(Ne))},c.promisify.custom=be;function ue(Re,Ne){if(!Re){var qe=new Error("Promise was rejected with a falsy value");qe.reason=Re,Re=qe}return Ne(Re)}function ge(Re){if(typeof Re!="function")throw new TypeError('The "original" argument must be of type Function');function Ne(){for(var qe=[],Pe=0;Pe<arguments.length;Pe++)qe.push(arguments[Pe]);var Ge=qe.pop();if(typeof Ge!="function")throw new TypeError("The last argument must be of type Function");var Ce=this,De=function(){return Ge.apply(Ce,arguments)};Re.apply(this,qe).then(function(je){process$1.nextTick(De.bind(null,null,je))},function(je){process$1.nextTick(ue.bind(null,je,De))})}return Object.setPrototypeOf(Ne,Object.getPrototypeOf(Re)),Object.defineProperties(Ne,t(Re)),Ne}c.callbackify=ge}(util$6)),util$6}Object.defineProperty(utf8,"__esModule",{value:!0});utf8.encode=utf8.decode=void 0;const common_1=common;function decode$7(c){return(common_1.isBrowser?new TextDecoder("utf-8"):new(requireUtil$1()).TextDecoder("utf-8")).decode(c)}utf8.decode=decode$7;function encode$6(c){return(common_1.isBrowser?new TextEncoder:new(requireUtil$1()).TextEncoder("utf-8")).encode(c)}utf8.encode=encode$6;var bs58$1={},__importDefault$9=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(bs58$1,"__esModule",{value:!0});bs58$1.decode=bs58$1.encode=void 0;const bs58_1=__importDefault$9(bs58$2);function encode$5(c){return bs58_1.default.encode(c)}bs58$1.encode=encode$5;function decode$6(c){return bs58_1.default.decode(c)}bs58$1.decode=decode$6;var base64$5={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$2=0,len=code.length;i$2<len;++i$2)lookup[i$2]=code[i$2],revLookup[code.charCodeAt(i$2)]=i$2;revLookup[45]=62;revLookup[95]=63;function getLens(c){var t=c.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=c.indexOf("=");n===-1&&(n=t);var ie=n===t?0:4-n%4;return[n,ie]}function byteLength(c){var t=getLens(c),n=t[0],ie=t[1];return(n+ie)*3/4-ie}function _byteLength(c,t,n){return(t+n)*3/4-n}function toByteArray(c){var t,n=getLens(c),ie=n[0],fe=n[1],ae=new Arr(_byteLength(c,ie,fe)),le=0,pe=fe>0?ie-4:ie,me;for(me=0;me<pe;me+=4)t=revLookup[c.charCodeAt(me)]<<18|revLookup[c.charCodeAt(me+1)]<<12|revLookup[c.charCodeAt(me+2)]<<6|revLookup[c.charCodeAt(me+3)],ae[le++]=t>>16&255,ae[le++]=t>>8&255,ae[le++]=t&255;return fe===2&&(t=revLookup[c.charCodeAt(me)]<<2|revLookup[c.charCodeAt(me+1)]>>4,ae[le++]=t&255),fe===1&&(t=revLookup[c.charCodeAt(me)]<<10|revLookup[c.charCodeAt(me+1)]<<4|revLookup[c.charCodeAt(me+2)]>>2,ae[le++]=t>>8&255,ae[le++]=t&255),ae}function tripletToBase64(c){return lookup[c>>18&63]+lookup[c>>12&63]+lookup[c>>6&63]+lookup[c&63]}function encodeChunk(c,t,n){for(var ie,fe=[],ae=t;ae<n;ae+=3)ie=(c[ae]<<16&16711680)+(c[ae+1]<<8&65280)+(c[ae+2]&255),fe.push(tripletToBase64(ie));return fe.join("")}function fromByteArray(c){for(var t,n=c.length,ie=n%3,fe=[],ae=16383,le=0,pe=n-ie;le<pe;le+=ae)fe.push(encodeChunk(c,le,le+ae>pe?pe:le+ae));return ie===1?(t=c[n-1],fe.push(lookup[t>>2]+lookup[t<<4&63]+"==")):ie===2&&(t=(c[n-2]<<8)+c[n-1],fe.push(lookup[t>>10]+lookup[t>>4&63]+lookup[t<<2&63]+"=")),fe.join("")}var __createBinding$a=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$a=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$a=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$a(t,c,n);return __setModuleDefault$a(t,c),t};Object.defineProperty(base64$5,"__esModule",{value:!0});base64$5.decode=base64$5.encode=void 0;const buffer_1=dist$1,base64$4=__importStar$a(base64Js);function encode$4(c){return base64$4.fromByteArray(c)}base64$5.encode=encode$4;function decode$5(c){return buffer_1.Buffer.from(base64$4.toByteArray(c))}base64$5.decode=decode$5;var __createBinding$9=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$9=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$9=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$9(t,c,n);return __setModuleDefault$9(t,c),t};Object.defineProperty(bytes,"__esModule",{value:!0});bytes.base64=bs58=bytes.bs58=bytes.utf8=bytes.hex=void 0;bytes.hex=__importStar$9(hex);bytes.utf8=__importStar$9(utf8);var bs58=bytes.bs58=__importStar$9(bs58$1);bytes.base64=__importStar$9(base64$5);class SolanaProvider{constructor(t){this.modalInterface=new defaultModal,this.wallet=ChainWallet.Phantom,this.network=t,this.axiosInstance=ky.create({prefixUrl:this.network===Network.MAINNET?"https://apiv3.droplinked.com":"https://apiv3dev.droplinked.com"}),this.address="",this.connection=this.getConnection()}executeAirdrop(t){throw new Error("Method not implemented.")}customPayment(t){throw new Error("Method not implemented.")}unstoppableLogin(t,n){throw new Error("Method not implemented.")}claimNFTs(t){throw new Error("Method not implemented.")}setAxiosInstance(t){return this.axiosInstance=t,this}async walletLogin(){if(!window.solana||!window.solana.isPhantom)throw window.open("https://phantom.app/","_blank"),new WalletNotFoundException;const t=window.solana,n=await t.connect(),ie=await getNonce(n.publicKey.toString(),this.axiosInstance),fe=new Date().toLocaleString(),ae=`Welcome to Droplinked! Please sign this message to verify your ownership over your wallet and log in. - Nonce: ${ie} - Date: ${fe}`,le=new TextEncoder().encode(ae),pe=utils$e.base58.encode((await t.signMessage(le,"utf8")).signature);return{address:n.publicKey.toString(),signature:pe,nonce:ie,date:fe}}deployShop(t){throw new Error("Method not implemented.")}recordProduct(t){throw new Error("Method not implemented.")}setShopId(t){return this.shopId=t,this}async delay(t){return new Promise(n=>setTimeout(n,t))}checkPhantomWallet(){if(!window.solana||!window.solana.isPhantom)throw window.open("https://phantom.app/","_blank"),new WalletNotFoundException}getConnection(){return this.connection?this.connection:(this.connection=new Connection(this.network===Network.MAINNET?"https://multi-greatest-voice.solana-mainnet.quiknode.pro/908c9dd72998ac69ec2205d5cdb2eccd654dfd0b":clusterApiUrl("devnet"),"confirmed"),this.connection)}async waitForTransactionConfirmation(t,n){const ie=await t.getLatestBlockhash();try{await t.confirmTransaction({blockhash:ie.blockhash,lastValidBlockHeight:ie.lastValidBlockHeight,signature:n})}catch(fe){throw console.error("Error confirming transaction:",fe),new Error(`Failed to confirm transaction: ${fe instanceof Error?fe.message:String(fe)}`)}for(;;){await this.delay(1500);try{if(await t.getParsedTransaction(n))break}catch(fe){console.warn("Error checking transaction status:",fe)}}await this.delay(1e3)}async getMintProgramAndDecimals(t,n){var le;const ie=await t.getAccountInfo(n,"confirmed");if(!ie)throw new Error("Mint account not found on chain");const fe=((le=ie.owner)==null?void 0:le.toBase58())===TOKEN_2022_PROGRAM_ID.toBase58()?TOKEN_2022_PROGRAM_ID:TOKEN_PROGRAM_ID,ae=await getMint(t,n,void 0,fe);return{programId:fe,decimals:ae.decimals}}detectChainId(t){const n=t.toLowerCase();return n.includes("devnet")?"solana:devnet":n.includes("testnet")?"solana:testnet":"solana:mainnet"}async connectWalletOrThrow(){const t=this.wallet,n={[ChainWallet.Metamask]:"MetaMask",[ChainWallet.Phantom]:"Phantom"};if(t!==ChainWallet.Metamask&&t!==ChainWallet.Phantom)throw new WalletNotFoundException;const ie=n[t],ae=(getWallets().get()||[]).filter(Ee=>{var Se;return((Se=Ee==null?void 0:Ee.features)==null?void 0:Se["standard:connect"])&&(Ee.features["solana:signAndSendTransaction"]||Ee.features["solana:signTransaction"])&&Ee.name===ie});if(!ae.length)throw new Error("No compatible Solana wallet found (install a Wallet-Standard Solana wallet, e.g. MetaMask Solana Snap).");const le=ae[0],{accounts:pe}=await le.features["standard:connect"].connect();if(!(pe!=null&&pe.length))throw new Error("No account returned by the wallet.");const me=pe[0],ye=me.publicKey||me.address||me.addressBytes,xe=new PublicKey(ye);return{wallet:le,account:me,publicKey:xe}}rescaleUnits(t,n,ie){if(n===ie)return t;const fe=Math.abs(n-ie);return n>ie?t/BigInt(10**fe):t*BigInt(10**fe)}async payment(t){try{const{paymentData:n,orderID:ie}=await getCartData(t.orderID,t.paymentToken,t.paymentType,this.address,this.axiosInstance),{tbdReceivers:fe,tbdValues:ae,totalPrice:le,tokenAddress:pe}=n,me=this.getConnection(),ye=this.detectChainId(me._rpcEndpoint??""),{wallet:xe,account:Ee,publicKey:Se}=await this.connectWalletOrThrow(),Me=new PublicKey(pe),{programId:Be,decimals:$e}=await this.getMintProgramAndDecimals(me,Me),ke=fe.map($t=>new PublicKey($t)),Te=getAssociatedTokenAddressSync(Me,Se,!1,Be),Ie=ke.map($t=>getAssociatedTokenAddressSync(Me,$t,!1,Be)),Fe=[];Fe.push(createAssociatedTokenAccountIdempotentInstruction(Se,Te,Se,Me,Be));for(let $t=0;$t<ke.length;$t++)Fe.push(createAssociatedTokenAccountIdempotentInstruction(Se,Ie[$t],ke[$t],Me,Be));for(let $t=0;$t<Ie.length;$t++){const _e=BigNumber.from(ae[$t]).toBigInt();Fe.push(createTransferCheckedInstruction(Te,Me,Ie[$t],Se,_e,$e,[],Be))}const{blockhash:Le,lastValidBlockHeight:He}=await me.getLatestBlockhash("finalized"),ze=new TransactionMessage({payerKey:Se,recentBlockhash:Le,instructions:Fe}).compileToV0Message(),Xe=new VersionedTransaction(ze).serialize();let Ue;try{if(xe.features["solana:signAndSendTransaction"]){const $t=await xe.features["solana:signAndSendTransaction"].signAndSendTransaction({transaction:Xe,chain:ye,account:Ee});Ue=bs58.encode($t[0].signature)}else{const{signedTransaction:$t}=await xe.features["solana:signTransaction"].signTransaction({transaction:Xe,chain:ye,account:Ee}),_e=typeof($t==null?void 0:$t.serialize)=="function"?$t.serialize():$t;Ue=await me.sendRawTransaction(_e,{skipPreflight:!1})}}catch($t){if(($t==null?void 0:$t.message)==="User rejected the request.")throw new Error("User rejected the transaction.");const _e=new Transaction({feePayer:Se,recentBlockhash:Le});for(const se of Fe)_e.add(se);if(xe.features["solana:signAndSendTransaction"]){const se=_e.serialize({requireAllSignatures:!1,verifySignatures:!1}),ce=await xe.features["solana:signAndSendTransaction"].signAndSendTransaction({transaction:se,chain:ye,account:Ee});Ue=bs58.encode(ce[0].signature)}else{const{signedTransaction:se}=await xe.features["solana:signTransaction"].signTransaction({transaction:_e.serialize({requireAllSignatures:!1,verifySignatures:!1}),chain:ye,account:Ee}),ce=typeof(se==null?void 0:se.serialize)=="function"?se.serialize():se;Ue=await me.sendRawTransaction(ce,{skipPreflight:!1})}}return await me.confirmTransaction({signature:Ue,blockhash:Le,lastValidBlockHeight:He},"confirmed"),{transactionHash:Ue,cryptoAmount:le,orderID:ie,transactionId:""}}catch(n){throw console.error("Payment error:",n),new Error(`Payment failed: ${n instanceof Error?n.message:String(n)}`)}}toBaseUnits(t,n){const ie=String(t).trim();if(!/^\d+(\.\d+)?$/.test(ie))throw new Error("Invalid amount");const[fe,ae=""]=ie.split("."),le=(ae+"0".repeat(n)).slice(0,n);return BigInt(fe+le)}async paymentWithToken(t,n,ie){try{const fe=this.getConnection(),ae=this.detectChainId(fe._rpcEndpoint??""),{wallet:le,account:pe,publicKey:me}=await this.connectWalletOrThrow(),ye=new PublicKey(ie),{programId:xe,decimals:Ee}=await this.getMintProgramAndDecimals(fe,ye),Se=new PublicKey(t),Me=getAssociatedTokenAddressSync(ye,me,!1,xe),Be=getAssociatedTokenAddressSync(ye,Se,!1,xe),$e=[];$e.push(createAssociatedTokenAccountIdempotentInstruction(me,Me,me,ye,xe),createAssociatedTokenAccountIdempotentInstruction(me,Be,Se,ye,xe));const ke=this.toBaseUnits(n,Ee);$e.push(createTransferCheckedInstruction(Me,ye,Be,me,ke,Ee,[],xe));const{blockhash:Te,lastValidBlockHeight:Ie}=await fe.getLatestBlockhash("finalized"),Fe=new TransactionMessage({payerKey:me,recentBlockhash:Te,instructions:$e}).compileToV0Message(),He=new VersionedTransaction(Fe).serialize();let ze;try{if(le.features["solana:signAndSendTransaction"]){const{signature:Je}=await le.features["solana:signAndSendTransaction"].signAndSendTransaction({transaction:He,chain:ae,account:pe});ze=Je}else{const{signedTransaction:Je}=await le.features["solana:signTransaction"].signTransaction({transaction:He,chain:ae,account:pe}),Xe=typeof(Je==null?void 0:Je.serialize)=="function"?Je.serialize():Je;ze=await fe.sendRawTransaction(Xe,{skipPreflight:!1})}}catch(Je){if((Je==null?void 0:Je.message)==="User rejected the request.")throw new Error("User rejected the transaction.");const Xe=new Transaction({feePayer:me,recentBlockhash:Te});for(const Ue of $e)Xe.add(Ue);if(le.features["solana:signAndSendTransaction"]){const Ue=Xe.serialize({requireAllSignatures:!1,verifySignatures:!1}),{signature:$t}=await le.features["solana:signAndSendTransaction"].signAndSendTransaction({transaction:Ue,chain:ae,account:pe});ze=$t}else{const{signedTransaction:Ue}=await le.features["solana:signTransaction"].signTransaction({transaction:Xe.serialize({requireAllSignatures:!1,verifySignatures:!1}),chain:ae,account:pe}),$t=typeof(Ue==null?void 0:Ue.serialize)=="function"?Ue.serialize():Ue;ze=await fe.sendRawTransaction($t,{skipPreflight:!1})}}return await fe.confirmTransaction({signature:ze,blockhash:Te,lastValidBlockHeight:Ie},"confirmed"),ze}catch(fe){throw console.error("Token payment error:",fe),new Error(`Token transfer failed: ${fe instanceof Error?fe.message:String(fe)}`)}}setAddress(t){return this.address=t,this}setWallet(t){return this.wallet=t,this}setModal(t){return this.modalInterface=t,this}setNFTContractAddress(t){return this.nftContractAddress=t,this}setShopContractAddress(t){return this.shopContractAddress=t,this}getPaymentData(t,n,ie){throw new Error("Method not implemented.")}}var r=function(){function c(t){t===void 0&&(t=c.defaultCreateUrl),this.createURL=void 0,this.createURL=t}return c.defaultCreateUrl=function(t,n){return"https://"+t+".ipns.dweb.link"+n.replace(/^\/?/,"/")},c.prototype.resolve=function(t){try{var n,ie,fe;if(t.startsWith("/ipfs/")||t.startsWith("/ipns/"))fe=t.substring(1,5),n=t.substring(6).split("/")[0],ie=t.substring(6+n.length);else{var ae=new URL(t);if(ae.hash!==""||ae.password!==""||ae.port!==""||ae.search!==""||ae.username!=="")throw new Error("invalid ipfs uri");fe=ae.protocol.substring(0,4),n=ae.hostname,ie=ae.pathname}if(fe!=="ipfs")throw new Error("only ipfs is supported, (not ipns)");return Promise.resolve(fetch(this.createURL(n,ie)).then(function(le){return le.ok?le.text():Promise.reject(new Error("bad response"))}))}catch(le){return Promise.reject(le)}},c}(),e=function(){function c(t){this.options=void 0,this.options=t}return c.prototype.resolve=function(t,n){try{var ie,fe="";if(t.includes("@")){var ae=t.split("@",1);fe=ae[0],ie=ae[1]}else ie=t;var le="http://openid.net/specs/connect/1.0/issuer";return Promise.resolve(this.options.webfingerResolver.resolve(ie,fe,le,n)).then(function(pe){var me,ye=(me=pe.links)==null?void 0:me.find(function(xe){return xe.rel===le});if(!ye||!ye.href)throw new Error("bad jrd");return Promise.resolve(fetch(ye.href+"/.well-known/openid-configuration").then(function(xe){return xe.ok?xe.json():Promise.reject(new Error("bad openid-configuration response"))}))})}catch(pe){return Promise.reject(pe)}},c}();function o(c,t,n){if(!c.s){if(n instanceof i$1){if(!n.s)return void(n.o=o.bind(null,c,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(o.bind(null,c,t),o.bind(null,c,2));c.s=t,c.v=n;const ie=c.o;ie&&ie(c)}}var i$1=function(){function c(){}return c.prototype.then=function(t,n){var ie=new c,fe=this.s;if(fe){var ae=1&fe?t:n;if(ae){try{o(ie,1,ae(this.v))}catch(le){o(ie,2,le)}return ie}return this}return this.o=function(le){try{var pe=le.v;1&le.s?o(ie,1,t?t(pe):pe):n?o(ie,1,n(pe)):o(ie,2,pe)}catch(me){o(ie,2,me)}},ie},c}();if(typeof window<"u"){var s$1=window;s$1.UAUTH_VERSION=s$1.UAUTH_VERSION||{},s$1.UAUTH_VERSION.COMMON="3.0.1"}var u$1=function(){function c(t){this.options=void 0,this.options=t}return c.prototype.resolve=function(t,n,ie,fe){try{var ae=this,le="webfinger."+n+"."+ie;return Promise.resolve(ae.options.domainResolver.records(t,[le])).then(function(pe){function me(Me){if(xe.subject!==ye)throw new Error("resource invalid");return xe}var ye=n?"acct:"+n+"@"+t:""+t;if(!pe[le])return{subject:ye,links:[{rel:ie,href:fe}]};var xe,Ee=JSON.parse(pe[le]),Se=typeof Ee.host=="string"?Promise.resolve(fetch("/.well-known/webfinger?"+new URLSearchParams({resource:ye,rel:ie}).toString(),{headers:{Host:Ee.host}}).then(function(Me){return Me.ok?Me.json():Promise.reject(new Error("bad webfinger response"))})).then(function(Me){xe=Me}):function(){if(typeof Ee.uri=="string"){var Me=new URL(Ee.uri);return function(Be,$e){var ke,Te=-1;e:{for(var Ie=0;Ie<$e.length;Ie++){var Fe=$e[Ie][0];if(Fe){var Le=Fe();if(Le&&Le.then)break e;if(Le===Be){Te=Ie;break}}else Te=Ie}if(Te!==-1){do{for(var He=$e[Te][1];!He;)Te++,He=$e[Te][1];var ze=He();if(ze&&ze.then){ke=!0;break e}var Je=$e[Te][2];Te++}while(Je&&!Je());return ze}}var Xe=new i$1,Ue=o.bind(null,Xe,2);return(ke?ze.then($t):Le.then(function _e(se){for(;;){if(se===Be){Te=Ie;break}if(++Ie===$e.length){if(Te!==-1)break;return void o(Xe,1,de)}if(Fe=$e[Ie][0]){if((se=Fe())&&se.then)return void se.then(_e).then(void 0,Ue)}else Te=Ie}do{for(var ce=$e[Te][1];!ce;)Te++,ce=$e[Te][1];var de=ce();if(de&&de.then)return void de.then($t).then(void 0,Ue);var he=$e[Te][2];Te++}while(he&&!he());o(Xe,1,de)})).then(void 0,Ue),Xe;function $t(_e){for(;;){var se=$e[Te][2];if(!se||se())break;Te++;for(var ce=$e[Te][1];!ce;)Te++,ce=$e[Te][1];if((_e=ce())&&_e.then)return void _e.then($t).then(void 0,Ue)}o(Xe,1,_e)}}(Me.protocol,[[function(){return"http:"}],[function(){return"https:"},function(){return Promise.resolve(fetch(Me.toString()).then(function(Be){return Be.ok?Be.json():Promise.reject(new Error("bad webfinger response"))})).then(function(Be){xe=Be})}],[function(){return"ipfs:"},function(){return Promise.resolve(ae.options.ipfsResolver.resolve(Ee.uri)).then(function(Be){xe=JSON.parse(Be)})}],[function(){return"ipns:"}],[function(){return"swarm:"}],[void 0,function(){throw new Error("uri scheme not supported")}]])}if(typeof Ee.value!="string")throw new Error("bad webfinger record");xe=JSON.parse(Ee.value)}();return Se&&Se.then?Se.then(me):me()})}catch(pe){return Promise.reject(pe)}},c}(),build={},Resolution$1={},bn$7={exports:{}};bn$7.exports;(function(c){(function(t,n){function ie(_e,se){if(!_e)throw new Error(se||"Assertion failed")}function fe(_e,se){_e.super_=se;var ce=function(){};ce.prototype=se.prototype,_e.prototype=new ce,_e.prototype.constructor=_e}function ae(_e,se,ce){if(ae.isBN(_e))return _e;this.negative=0,this.words=null,this.length=0,this.red=null,_e!==null&&((se==="le"||se==="be")&&(ce=se,se=10),this._init(_e||0,se||10,ce||"be"))}typeof t=="object"?t.exports=ae:n.BN=ae,ae.BN=ae,ae.wordSize=26;var le;try{typeof window<"u"&&typeof window.Buffer<"u"?le=window.Buffer:le=dist$1.Buffer}catch{}ae.isBN=function(se){return se instanceof ae?!0:se!==null&&typeof se=="object"&&se.constructor.wordSize===ae.wordSize&&Array.isArray(se.words)},ae.max=function(se,ce){return se.cmp(ce)>0?se:ce},ae.min=function(se,ce){return se.cmp(ce)<0?se:ce},ae.prototype._init=function(se,ce,de){if(typeof se=="number")return this._initNumber(se,ce,de);if(typeof se=="object")return this._initArray(se,ce,de);ce==="hex"&&(ce=16),ie(ce===(ce|0)&&ce>=2&&ce<=36),se=se.toString().replace(/\s+/g,"");var he=0;se[0]==="-"&&(he++,this.negative=1),he<se.length&&(ce===16?this._parseHex(se,he,de):(this._parseBase(se,ce,he),de==="le"&&this._initArray(this.toArray(),ce,de)))},ae.prototype._initNumber=function(se,ce,de){se<0&&(this.negative=1,se=-se),se<67108864?(this.words=[se&67108863],this.length=1):se<4503599627370496?(this.words=[se&67108863,se/67108864&67108863],this.length=2):(ie(se<9007199254740992),this.words=[se&67108863,se/67108864&67108863,1],this.length=3),de==="le"&&this._initArray(this.toArray(),ce,de)},ae.prototype._initArray=function(se,ce,de){if(ie(typeof se.length=="number"),se.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(se.length/3),this.words=new Array(this.length);for(var he=0;he<this.length;he++)this.words[he]=0;var ve,we,Ae=0;if(de==="be")for(he=se.length-1,ve=0;he>=0;he-=3)we=se[he]|se[he-1]<<8|se[he-2]<<16,this.words[ve]|=we<<Ae&67108863,this.words[ve+1]=we>>>26-Ae&67108863,Ae+=24,Ae>=26&&(Ae-=26,ve++);else if(de==="le")for(he=0,ve=0;he<se.length;he+=3)we=se[he]|se[he+1]<<8|se[he+2]<<16,this.words[ve]|=we<<Ae&67108863,this.words[ve+1]=we>>>26-Ae&67108863,Ae+=24,Ae>=26&&(Ae-=26,ve++);return this.strip()};function pe(_e,se){var ce=_e.charCodeAt(se);return ce>=65&&ce<=70?ce-55:ce>=97&&ce<=102?ce-87:ce-48&15}function me(_e,se,ce){var de=pe(_e,ce);return ce-1>=se&&(de|=pe(_e,ce-1)<<4),de}ae.prototype._parseHex=function(se,ce,de){this.length=Math.ceil((se.length-ce)/6),this.words=new Array(this.length);for(var he=0;he<this.length;he++)this.words[he]=0;var ve=0,we=0,Ae;if(de==="be")for(he=se.length-1;he>=ce;he-=2)Ae=me(se,ce,he)<<ve,this.words[we]|=Ae&67108863,ve>=18?(ve-=18,we+=1,this.words[we]|=Ae>>>26):ve+=8;else{var be=se.length-ce;for(he=be%2===0?ce+1:ce;he<se.length;he+=2)Ae=me(se,ce,he)<<ve,this.words[we]|=Ae&67108863,ve>=18?(ve-=18,we+=1,this.words[we]|=Ae>>>26):ve+=8}this.strip()};function ye(_e,se,ce,de){for(var he=0,ve=Math.min(_e.length,ce),we=se;we<ve;we++){var Ae=_e.charCodeAt(we)-48;he*=de,Ae>=49?he+=Ae-49+10:Ae>=17?he+=Ae-17+10:he+=Ae}return he}ae.prototype._parseBase=function(se,ce,de){this.words=[0],this.length=1;for(var he=0,ve=1;ve<=67108863;ve*=ce)he++;he--,ve=ve/ce|0;for(var we=se.length-de,Ae=we%he,be=Math.min(we,we-Ae)+de,ue=0,ge=de;ge<be;ge+=he)ue=ye(se,ge,ge+he,ce),this.imuln(ve),this.words[0]+ue<67108864?this.words[0]+=ue:this._iaddn(ue);if(Ae!==0){var Re=1;for(ue=ye(se,ge,se.length,ce),ge=0;ge<Ae;ge++)Re*=ce;this.imuln(Re),this.words[0]+ue<67108864?this.words[0]+=ue:this._iaddn(ue)}this.strip()},ae.prototype.copy=function(se){se.words=new Array(this.length);for(var ce=0;ce<this.length;ce++)se.words[ce]=this.words[ce];se.length=this.length,se.negative=this.negative,se.red=this.red},ae.prototype.clone=function(){var se=new ae(null);return this.copy(se),se},ae.prototype._expand=function(se){for(;this.length<se;)this.words[this.length++]=0;return this},ae.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},ae.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},ae.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var xe=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Ee=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Se=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];ae.prototype.toString=function(se,ce){se=se||10,ce=ce|0||1;var de;if(se===16||se==="hex"){de="";for(var he=0,ve=0,we=0;we<this.length;we++){var Ae=this.words[we],be=((Ae<<he|ve)&16777215).toString(16);ve=Ae>>>24-he&16777215,he+=2,he>=26&&(he-=26,we--),ve!==0||we!==this.length-1?de=xe[6-be.length]+be+de:de=be+de}for(ve!==0&&(de=ve.toString(16)+de);de.length%ce!==0;)de="0"+de;return this.negative!==0&&(de="-"+de),de}if(se===(se|0)&&se>=2&&se<=36){var ue=Ee[se],ge=Se[se];de="";var Re=this.clone();for(Re.negative=0;!Re.isZero();){var Ne=Re.modn(ge).toString(se);Re=Re.idivn(ge),Re.isZero()?de=Ne+de:de=xe[ue-Ne.length]+Ne+de}for(this.isZero()&&(de="0"+de);de.length%ce!==0;)de="0"+de;return this.negative!==0&&(de="-"+de),de}ie(!1,"Base should be between 2 and 36")},ae.prototype.toNumber=function(){var se=this.words[0];return this.length===2?se+=this.words[1]*67108864:this.length===3&&this.words[2]===1?se+=4503599627370496+this.words[1]*67108864:this.length>2&&ie(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-se:se},ae.prototype.toJSON=function(){return this.toString(16)},ae.prototype.toBuffer=function(se,ce){return ie(typeof le<"u"),this.toArrayLike(le,se,ce)},ae.prototype.toArray=function(se,ce){return this.toArrayLike(Array,se,ce)},ae.prototype.toArrayLike=function(se,ce,de){var he=this.byteLength(),ve=de||Math.max(1,he);ie(he<=ve,"byte array longer than desired length"),ie(ve>0,"Requested array length <= 0"),this.strip();var we=ce==="le",Ae=new se(ve),be,ue,ge=this.clone();if(we){for(ue=0;!ge.isZero();ue++)be=ge.andln(255),ge.iushrn(8),Ae[ue]=be;for(;ue<ve;ue++)Ae[ue]=0}else{for(ue=0;ue<ve-he;ue++)Ae[ue]=0;for(ue=0;!ge.isZero();ue++)be=ge.andln(255),ge.iushrn(8),Ae[ve-ue-1]=be}return Ae},Math.clz32?ae.prototype._countBits=function(se){return 32-Math.clz32(se)}:ae.prototype._countBits=function(se){var ce=se,de=0;return ce>=4096&&(de+=13,ce>>>=13),ce>=64&&(de+=7,ce>>>=7),ce>=8&&(de+=4,ce>>>=4),ce>=2&&(de+=2,ce>>>=2),de+ce},ae.prototype._zeroBits=function(se){if(se===0)return 26;var ce=se,de=0;return ce&8191||(de+=13,ce>>>=13),ce&127||(de+=7,ce>>>=7),ce&15||(de+=4,ce>>>=4),ce&3||(de+=2,ce>>>=2),ce&1||de++,de},ae.prototype.bitLength=function(){var se=this.words[this.length-1],ce=this._countBits(se);return(this.length-1)*26+ce};function Me(_e){for(var se=new Array(_e.bitLength()),ce=0;ce<se.length;ce++){var de=ce/26|0,he=ce%26;se[ce]=(_e.words[de]&1<<he)>>>he}return se}ae.prototype.zeroBits=function(){if(this.isZero())return 0;for(var se=0,ce=0;ce<this.length;ce++){var de=this._zeroBits(this.words[ce]);if(se+=de,de!==26)break}return se},ae.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},ae.prototype.toTwos=function(se){return this.negative!==0?this.abs().inotn(se).iaddn(1):this.clone()},ae.prototype.fromTwos=function(se){return this.testn(se-1)?this.notn(se).iaddn(1).ineg():this.clone()},ae.prototype.isNeg=function(){return this.negative!==0},ae.prototype.neg=function(){return this.clone().ineg()},ae.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},ae.prototype.iuor=function(se){for(;this.length<se.length;)this.words[this.length++]=0;for(var ce=0;ce<se.length;ce++)this.words[ce]=this.words[ce]|se.words[ce];return this.strip()},ae.prototype.ior=function(se){return ie((this.negative|se.negative)===0),this.iuor(se)},ae.prototype.or=function(se){return this.length>se.length?this.clone().ior(se):se.clone().ior(this)},ae.prototype.uor=function(se){return this.length>se.length?this.clone().iuor(se):se.clone().iuor(this)},ae.prototype.iuand=function(se){var ce;this.length>se.length?ce=se:ce=this;for(var de=0;de<ce.length;de++)this.words[de]=this.words[de]&se.words[de];return this.length=ce.length,this.strip()},ae.prototype.iand=function(se){return ie((this.negative|se.negative)===0),this.iuand(se)},ae.prototype.and=function(se){return this.length>se.length?this.clone().iand(se):se.clone().iand(this)},ae.prototype.uand=function(se){return this.length>se.length?this.clone().iuand(se):se.clone().iuand(this)},ae.prototype.iuxor=function(se){var ce,de;this.length>se.length?(ce=this,de=se):(ce=se,de=this);for(var he=0;he<de.length;he++)this.words[he]=ce.words[he]^de.words[he];if(this!==ce)for(;he<ce.length;he++)this.words[he]=ce.words[he];return this.length=ce.length,this.strip()},ae.prototype.ixor=function(se){return ie((this.negative|se.negative)===0),this.iuxor(se)},ae.prototype.xor=function(se){return this.length>se.length?this.clone().ixor(se):se.clone().ixor(this)},ae.prototype.uxor=function(se){return this.length>se.length?this.clone().iuxor(se):se.clone().iuxor(this)},ae.prototype.inotn=function(se){ie(typeof se=="number"&&se>=0);var ce=Math.ceil(se/26)|0,de=se%26;this._expand(ce),de>0&&ce--;for(var he=0;he<ce;he++)this.words[he]=~this.words[he]&67108863;return de>0&&(this.words[he]=~this.words[he]&67108863>>26-de),this.strip()},ae.prototype.notn=function(se){return this.clone().inotn(se)},ae.prototype.setn=function(se,ce){ie(typeof se=="number"&&se>=0);var de=se/26|0,he=se%26;return this._expand(de+1),ce?this.words[de]=this.words[de]|1<<he:this.words[de]=this.words[de]&~(1<<he),this.strip()},ae.prototype.iadd=function(se){var ce;if(this.negative!==0&&se.negative===0)return this.negative=0,ce=this.isub(se),this.negative^=1,this._normSign();if(this.negative===0&&se.negative!==0)return se.negative=0,ce=this.isub(se),se.negative=1,ce._normSign();var de,he;this.length>se.length?(de=this,he=se):(de=se,he=this);for(var ve=0,we=0;we<he.length;we++)ce=(de.words[we]|0)+(he.words[we]|0)+ve,this.words[we]=ce&67108863,ve=ce>>>26;for(;ve!==0&&we<de.length;we++)ce=(de.words[we]|0)+ve,this.words[we]=ce&67108863,ve=ce>>>26;if(this.length=de.length,ve!==0)this.words[this.length]=ve,this.length++;else if(de!==this)for(;we<de.length;we++)this.words[we]=de.words[we];return this},ae.prototype.add=function(se){var ce;return se.negative!==0&&this.negative===0?(se.negative=0,ce=this.sub(se),se.negative^=1,ce):se.negative===0&&this.negative!==0?(this.negative=0,ce=se.sub(this),this.negative=1,ce):this.length>se.length?this.clone().iadd(se):se.clone().iadd(this)},ae.prototype.isub=function(se){if(se.negative!==0){se.negative=0;var ce=this.iadd(se);return se.negative=1,ce._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(se),this.negative=1,this._normSign();var de=this.cmp(se);if(de===0)return this.negative=0,this.length=1,this.words[0]=0,this;var he,ve;de>0?(he=this,ve=se):(he=se,ve=this);for(var we=0,Ae=0;Ae<ve.length;Ae++)ce=(he.words[Ae]|0)-(ve.words[Ae]|0)+we,we=ce>>26,this.words[Ae]=ce&67108863;for(;we!==0&&Ae<he.length;Ae++)ce=(he.words[Ae]|0)+we,we=ce>>26,this.words[Ae]=ce&67108863;if(we===0&&Ae<he.length&&he!==this)for(;Ae<he.length;Ae++)this.words[Ae]=he.words[Ae];return this.length=Math.max(this.length,Ae),he!==this&&(this.negative=1),this.strip()},ae.prototype.sub=function(se){return this.clone().isub(se)};function Be(_e,se,ce){ce.negative=se.negative^_e.negative;var de=_e.length+se.length|0;ce.length=de,de=de-1|0;var he=_e.words[0]|0,ve=se.words[0]|0,we=he*ve,Ae=we&67108863,be=we/67108864|0;ce.words[0]=Ae;for(var ue=1;ue<de;ue++){for(var ge=be>>>26,Re=be&67108863,Ne=Math.min(ue,se.length-1),qe=Math.max(0,ue-_e.length+1);qe<=Ne;qe++){var Pe=ue-qe|0;he=_e.words[Pe]|0,ve=se.words[qe]|0,we=he*ve+Re,ge+=we/67108864|0,Re=we&67108863}ce.words[ue]=Re|0,be=ge|0}return be!==0?ce.words[ue]=be|0:ce.length--,ce.strip()}var $e=function(se,ce,de){var he=se.words,ve=ce.words,we=de.words,Ae=0,be,ue,ge,Re=he[0]|0,Ne=Re&8191,qe=Re>>>13,Pe=he[1]|0,Ge=Pe&8191,Ce=Pe>>>13,De=he[2]|0,je=De&8191,Ve=De>>>13,Mt=he[3]|0,Oe=Mt&8191,We=Mt>>>13,jt=he[4]|0,Dt=jt&8191,Ht=jt>>>13,vn=he[5]|0,Vt=vn&8191,Kt=vn>>>13,En=he[6]|0,en=En&8191,Xt=En>>>13,_n=he[7]|0,Ze=_n&8191,Rt=_n>>>13,Qt=he[8]|0,Ft=Qt&8191,Wt=Qt>>>13,an=he[9]|0,Zt=an&8191,Jt=an>>>13,An=ve[0]|0,tn=An&8191,nn=An>>>13,Sn=ve[1]|0,rn=Sn&8191,dn=Sn>>>13,Mn=ve[2]|0,sn=Mn&8191,ln=Mn>>>13,Bn=ve[3]|0,un=Bn&8191,hn=Bn>>>13,Cn=ve[4]|0,yn=Cn&8191,xn=Cn>>>13,Nn=ve[5]|0,Qe=Nn&8191,Ke=Nn>>>13,Ye=ve[6]|0,Pt=Ye&8191,Gt=Ye>>>13,gn=ve[7]|0,Yt=gn&8191,cn=gn>>>13,$n=ve[8]|0,fn=$n&8191,pn=$n>>>13,Rn=ve[9]|0,mn=Rn&8191,wn=Rn>>>13;de.negative=se.negative^ce.negative,de.length=19,be=Math.imul(Ne,tn),ue=Math.imul(Ne,nn),ue=ue+Math.imul(qe,tn)|0,ge=Math.imul(qe,nn);var kn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(kn>>>26)|0,kn&=67108863,be=Math.imul(Ge,tn),ue=Math.imul(Ge,nn),ue=ue+Math.imul(Ce,tn)|0,ge=Math.imul(Ce,nn),be=be+Math.imul(Ne,rn)|0,ue=ue+Math.imul(Ne,dn)|0,ue=ue+Math.imul(qe,rn)|0,ge=ge+Math.imul(qe,dn)|0;var Tn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,be=Math.imul(je,tn),ue=Math.imul(je,nn),ue=ue+Math.imul(Ve,tn)|0,ge=Math.imul(Ve,nn),be=be+Math.imul(Ge,rn)|0,ue=ue+Math.imul(Ge,dn)|0,ue=ue+Math.imul(Ce,rn)|0,ge=ge+Math.imul(Ce,dn)|0,be=be+Math.imul(Ne,sn)|0,ue=ue+Math.imul(Ne,ln)|0,ue=ue+Math.imul(qe,sn)|0,ge=ge+Math.imul(qe,ln)|0;var In=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(In>>>26)|0,In&=67108863,be=Math.imul(Oe,tn),ue=Math.imul(Oe,nn),ue=ue+Math.imul(We,tn)|0,ge=Math.imul(We,nn),be=be+Math.imul(je,rn)|0,ue=ue+Math.imul(je,dn)|0,ue=ue+Math.imul(Ve,rn)|0,ge=ge+Math.imul(Ve,dn)|0,be=be+Math.imul(Ge,sn)|0,ue=ue+Math.imul(Ge,ln)|0,ue=ue+Math.imul(Ce,sn)|0,ge=ge+Math.imul(Ce,ln)|0,be=be+Math.imul(Ne,un)|0,ue=ue+Math.imul(Ne,hn)|0,ue=ue+Math.imul(qe,un)|0,ge=ge+Math.imul(qe,hn)|0;var Pn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,be=Math.imul(Dt,tn),ue=Math.imul(Dt,nn),ue=ue+Math.imul(Ht,tn)|0,ge=Math.imul(Ht,nn),be=be+Math.imul(Oe,rn)|0,ue=ue+Math.imul(Oe,dn)|0,ue=ue+Math.imul(We,rn)|0,ge=ge+Math.imul(We,dn)|0,be=be+Math.imul(je,sn)|0,ue=ue+Math.imul(je,ln)|0,ue=ue+Math.imul(Ve,sn)|0,ge=ge+Math.imul(Ve,ln)|0,be=be+Math.imul(Ge,un)|0,ue=ue+Math.imul(Ge,hn)|0,ue=ue+Math.imul(Ce,un)|0,ge=ge+Math.imul(Ce,hn)|0,be=be+Math.imul(Ne,yn)|0,ue=ue+Math.imul(Ne,xn)|0,ue=ue+Math.imul(qe,yn)|0,ge=ge+Math.imul(qe,xn)|0;var On=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(On>>>26)|0,On&=67108863,be=Math.imul(Vt,tn),ue=Math.imul(Vt,nn),ue=ue+Math.imul(Kt,tn)|0,ge=Math.imul(Kt,nn),be=be+Math.imul(Dt,rn)|0,ue=ue+Math.imul(Dt,dn)|0,ue=ue+Math.imul(Ht,rn)|0,ge=ge+Math.imul(Ht,dn)|0,be=be+Math.imul(Oe,sn)|0,ue=ue+Math.imul(Oe,ln)|0,ue=ue+Math.imul(We,sn)|0,ge=ge+Math.imul(We,ln)|0,be=be+Math.imul(je,un)|0,ue=ue+Math.imul(je,hn)|0,ue=ue+Math.imul(Ve,un)|0,ge=ge+Math.imul(Ve,hn)|0,be=be+Math.imul(Ge,yn)|0,ue=ue+Math.imul(Ge,xn)|0,ue=ue+Math.imul(Ce,yn)|0,ge=ge+Math.imul(Ce,xn)|0,be=be+Math.imul(Ne,Qe)|0,ue=ue+Math.imul(Ne,Ke)|0,ue=ue+Math.imul(qe,Qe)|0,ge=ge+Math.imul(qe,Ke)|0;var Dn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,be=Math.imul(en,tn),ue=Math.imul(en,nn),ue=ue+Math.imul(Xt,tn)|0,ge=Math.imul(Xt,nn),be=be+Math.imul(Vt,rn)|0,ue=ue+Math.imul(Vt,dn)|0,ue=ue+Math.imul(Kt,rn)|0,ge=ge+Math.imul(Kt,dn)|0,be=be+Math.imul(Dt,sn)|0,ue=ue+Math.imul(Dt,ln)|0,ue=ue+Math.imul(Ht,sn)|0,ge=ge+Math.imul(Ht,ln)|0,be=be+Math.imul(Oe,un)|0,ue=ue+Math.imul(Oe,hn)|0,ue=ue+Math.imul(We,un)|0,ge=ge+Math.imul(We,hn)|0,be=be+Math.imul(je,yn)|0,ue=ue+Math.imul(je,xn)|0,ue=ue+Math.imul(Ve,yn)|0,ge=ge+Math.imul(Ve,xn)|0,be=be+Math.imul(Ge,Qe)|0,ue=ue+Math.imul(Ge,Ke)|0,ue=ue+Math.imul(Ce,Qe)|0,ge=ge+Math.imul(Ce,Ke)|0,be=be+Math.imul(Ne,Pt)|0,ue=ue+Math.imul(Ne,Gt)|0,ue=ue+Math.imul(qe,Pt)|0,ge=ge+Math.imul(qe,Gt)|0;var Ln=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,be=Math.imul(Ze,tn),ue=Math.imul(Ze,nn),ue=ue+Math.imul(Rt,tn)|0,ge=Math.imul(Rt,nn),be=be+Math.imul(en,rn)|0,ue=ue+Math.imul(en,dn)|0,ue=ue+Math.imul(Xt,rn)|0,ge=ge+Math.imul(Xt,dn)|0,be=be+Math.imul(Vt,sn)|0,ue=ue+Math.imul(Vt,ln)|0,ue=ue+Math.imul(Kt,sn)|0,ge=ge+Math.imul(Kt,ln)|0,be=be+Math.imul(Dt,un)|0,ue=ue+Math.imul(Dt,hn)|0,ue=ue+Math.imul(Ht,un)|0,ge=ge+Math.imul(Ht,hn)|0,be=be+Math.imul(Oe,yn)|0,ue=ue+Math.imul(Oe,xn)|0,ue=ue+Math.imul(We,yn)|0,ge=ge+Math.imul(We,xn)|0,be=be+Math.imul(je,Qe)|0,ue=ue+Math.imul(je,Ke)|0,ue=ue+Math.imul(Ve,Qe)|0,ge=ge+Math.imul(Ve,Ke)|0,be=be+Math.imul(Ge,Pt)|0,ue=ue+Math.imul(Ge,Gt)|0,ue=ue+Math.imul(Ce,Pt)|0,ge=ge+Math.imul(Ce,Gt)|0,be=be+Math.imul(Ne,Yt)|0,ue=ue+Math.imul(Ne,cn)|0,ue=ue+Math.imul(qe,Yt)|0,ge=ge+Math.imul(qe,cn)|0;var Fn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,be=Math.imul(Ft,tn),ue=Math.imul(Ft,nn),ue=ue+Math.imul(Wt,tn)|0,ge=Math.imul(Wt,nn),be=be+Math.imul(Ze,rn)|0,ue=ue+Math.imul(Ze,dn)|0,ue=ue+Math.imul(Rt,rn)|0,ge=ge+Math.imul(Rt,dn)|0,be=be+Math.imul(en,sn)|0,ue=ue+Math.imul(en,ln)|0,ue=ue+Math.imul(Xt,sn)|0,ge=ge+Math.imul(Xt,ln)|0,be=be+Math.imul(Vt,un)|0,ue=ue+Math.imul(Vt,hn)|0,ue=ue+Math.imul(Kt,un)|0,ge=ge+Math.imul(Kt,hn)|0,be=be+Math.imul(Dt,yn)|0,ue=ue+Math.imul(Dt,xn)|0,ue=ue+Math.imul(Ht,yn)|0,ge=ge+Math.imul(Ht,xn)|0,be=be+Math.imul(Oe,Qe)|0,ue=ue+Math.imul(Oe,Ke)|0,ue=ue+Math.imul(We,Qe)|0,ge=ge+Math.imul(We,Ke)|0,be=be+Math.imul(je,Pt)|0,ue=ue+Math.imul(je,Gt)|0,ue=ue+Math.imul(Ve,Pt)|0,ge=ge+Math.imul(Ve,Gt)|0,be=be+Math.imul(Ge,Yt)|0,ue=ue+Math.imul(Ge,cn)|0,ue=ue+Math.imul(Ce,Yt)|0,ge=ge+Math.imul(Ce,cn)|0,be=be+Math.imul(Ne,fn)|0,ue=ue+Math.imul(Ne,pn)|0,ue=ue+Math.imul(qe,fn)|0,ge=ge+Math.imul(qe,pn)|0;var qn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(qn>>>26)|0,qn&=67108863,be=Math.imul(Zt,tn),ue=Math.imul(Zt,nn),ue=ue+Math.imul(Jt,tn)|0,ge=Math.imul(Jt,nn),be=be+Math.imul(Ft,rn)|0,ue=ue+Math.imul(Ft,dn)|0,ue=ue+Math.imul(Wt,rn)|0,ge=ge+Math.imul(Wt,dn)|0,be=be+Math.imul(Ze,sn)|0,ue=ue+Math.imul(Ze,ln)|0,ue=ue+Math.imul(Rt,sn)|0,ge=ge+Math.imul(Rt,ln)|0,be=be+Math.imul(en,un)|0,ue=ue+Math.imul(en,hn)|0,ue=ue+Math.imul(Xt,un)|0,ge=ge+Math.imul(Xt,hn)|0,be=be+Math.imul(Vt,yn)|0,ue=ue+Math.imul(Vt,xn)|0,ue=ue+Math.imul(Kt,yn)|0,ge=ge+Math.imul(Kt,xn)|0,be=be+Math.imul(Dt,Qe)|0,ue=ue+Math.imul(Dt,Ke)|0,ue=ue+Math.imul(Ht,Qe)|0,ge=ge+Math.imul(Ht,Ke)|0,be=be+Math.imul(Oe,Pt)|0,ue=ue+Math.imul(Oe,Gt)|0,ue=ue+Math.imul(We,Pt)|0,ge=ge+Math.imul(We,Gt)|0,be=be+Math.imul(je,Yt)|0,ue=ue+Math.imul(je,cn)|0,ue=ue+Math.imul(Ve,Yt)|0,ge=ge+Math.imul(Ve,cn)|0,be=be+Math.imul(Ge,fn)|0,ue=ue+Math.imul(Ge,pn)|0,ue=ue+Math.imul(Ce,fn)|0,ge=ge+Math.imul(Ce,pn)|0,be=be+Math.imul(Ne,mn)|0,ue=ue+Math.imul(Ne,wn)|0,ue=ue+Math.imul(qe,mn)|0,ge=ge+Math.imul(qe,wn)|0;var Un=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Un>>>26)|0,Un&=67108863,be=Math.imul(Zt,rn),ue=Math.imul(Zt,dn),ue=ue+Math.imul(Jt,rn)|0,ge=Math.imul(Jt,dn),be=be+Math.imul(Ft,sn)|0,ue=ue+Math.imul(Ft,ln)|0,ue=ue+Math.imul(Wt,sn)|0,ge=ge+Math.imul(Wt,ln)|0,be=be+Math.imul(Ze,un)|0,ue=ue+Math.imul(Ze,hn)|0,ue=ue+Math.imul(Rt,un)|0,ge=ge+Math.imul(Rt,hn)|0,be=be+Math.imul(en,yn)|0,ue=ue+Math.imul(en,xn)|0,ue=ue+Math.imul(Xt,yn)|0,ge=ge+Math.imul(Xt,xn)|0,be=be+Math.imul(Vt,Qe)|0,ue=ue+Math.imul(Vt,Ke)|0,ue=ue+Math.imul(Kt,Qe)|0,ge=ge+Math.imul(Kt,Ke)|0,be=be+Math.imul(Dt,Pt)|0,ue=ue+Math.imul(Dt,Gt)|0,ue=ue+Math.imul(Ht,Pt)|0,ge=ge+Math.imul(Ht,Gt)|0,be=be+Math.imul(Oe,Yt)|0,ue=ue+Math.imul(Oe,cn)|0,ue=ue+Math.imul(We,Yt)|0,ge=ge+Math.imul(We,cn)|0,be=be+Math.imul(je,fn)|0,ue=ue+Math.imul(je,pn)|0,ue=ue+Math.imul(Ve,fn)|0,ge=ge+Math.imul(Ve,pn)|0,be=be+Math.imul(Ge,mn)|0,ue=ue+Math.imul(Ge,wn)|0,ue=ue+Math.imul(Ce,mn)|0,ge=ge+Math.imul(Ce,wn)|0;var Kn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Kn>>>26)|0,Kn&=67108863,be=Math.imul(Zt,sn),ue=Math.imul(Zt,ln),ue=ue+Math.imul(Jt,sn)|0,ge=Math.imul(Jt,ln),be=be+Math.imul(Ft,un)|0,ue=ue+Math.imul(Ft,hn)|0,ue=ue+Math.imul(Wt,un)|0,ge=ge+Math.imul(Wt,hn)|0,be=be+Math.imul(Ze,yn)|0,ue=ue+Math.imul(Ze,xn)|0,ue=ue+Math.imul(Rt,yn)|0,ge=ge+Math.imul(Rt,xn)|0,be=be+Math.imul(en,Qe)|0,ue=ue+Math.imul(en,Ke)|0,ue=ue+Math.imul(Xt,Qe)|0,ge=ge+Math.imul(Xt,Ke)|0,be=be+Math.imul(Vt,Pt)|0,ue=ue+Math.imul(Vt,Gt)|0,ue=ue+Math.imul(Kt,Pt)|0,ge=ge+Math.imul(Kt,Gt)|0,be=be+Math.imul(Dt,Yt)|0,ue=ue+Math.imul(Dt,cn)|0,ue=ue+Math.imul(Ht,Yt)|0,ge=ge+Math.imul(Ht,cn)|0,be=be+Math.imul(Oe,fn)|0,ue=ue+Math.imul(Oe,pn)|0,ue=ue+Math.imul(We,fn)|0,ge=ge+Math.imul(We,pn)|0,be=be+Math.imul(je,mn)|0,ue=ue+Math.imul(je,wn)|0,ue=ue+Math.imul(Ve,mn)|0,ge=ge+Math.imul(Ve,wn)|0;var Hn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,be=Math.imul(Zt,un),ue=Math.imul(Zt,hn),ue=ue+Math.imul(Jt,un)|0,ge=Math.imul(Jt,hn),be=be+Math.imul(Ft,yn)|0,ue=ue+Math.imul(Ft,xn)|0,ue=ue+Math.imul(Wt,yn)|0,ge=ge+Math.imul(Wt,xn)|0,be=be+Math.imul(Ze,Qe)|0,ue=ue+Math.imul(Ze,Ke)|0,ue=ue+Math.imul(Rt,Qe)|0,ge=ge+Math.imul(Rt,Ke)|0,be=be+Math.imul(en,Pt)|0,ue=ue+Math.imul(en,Gt)|0,ue=ue+Math.imul(Xt,Pt)|0,ge=ge+Math.imul(Xt,Gt)|0,be=be+Math.imul(Vt,Yt)|0,ue=ue+Math.imul(Vt,cn)|0,ue=ue+Math.imul(Kt,Yt)|0,ge=ge+Math.imul(Kt,cn)|0,be=be+Math.imul(Dt,fn)|0,ue=ue+Math.imul(Dt,pn)|0,ue=ue+Math.imul(Ht,fn)|0,ge=ge+Math.imul(Ht,pn)|0,be=be+Math.imul(Oe,mn)|0,ue=ue+Math.imul(Oe,wn)|0,ue=ue+Math.imul(We,mn)|0,ge=ge+Math.imul(We,wn)|0;var jn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(jn>>>26)|0,jn&=67108863,be=Math.imul(Zt,yn),ue=Math.imul(Zt,xn),ue=ue+Math.imul(Jt,yn)|0,ge=Math.imul(Jt,xn),be=be+Math.imul(Ft,Qe)|0,ue=ue+Math.imul(Ft,Ke)|0,ue=ue+Math.imul(Wt,Qe)|0,ge=ge+Math.imul(Wt,Ke)|0,be=be+Math.imul(Ze,Pt)|0,ue=ue+Math.imul(Ze,Gt)|0,ue=ue+Math.imul(Rt,Pt)|0,ge=ge+Math.imul(Rt,Gt)|0,be=be+Math.imul(en,Yt)|0,ue=ue+Math.imul(en,cn)|0,ue=ue+Math.imul(Xt,Yt)|0,ge=ge+Math.imul(Xt,cn)|0,be=be+Math.imul(Vt,fn)|0,ue=ue+Math.imul(Vt,pn)|0,ue=ue+Math.imul(Kt,fn)|0,ge=ge+Math.imul(Kt,pn)|0,be=be+Math.imul(Dt,mn)|0,ue=ue+Math.imul(Dt,wn)|0,ue=ue+Math.imul(Ht,mn)|0,ge=ge+Math.imul(Ht,wn)|0;var zn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(zn>>>26)|0,zn&=67108863,be=Math.imul(Zt,Qe),ue=Math.imul(Zt,Ke),ue=ue+Math.imul(Jt,Qe)|0,ge=Math.imul(Jt,Ke),be=be+Math.imul(Ft,Pt)|0,ue=ue+Math.imul(Ft,Gt)|0,ue=ue+Math.imul(Wt,Pt)|0,ge=ge+Math.imul(Wt,Gt)|0,be=be+Math.imul(Ze,Yt)|0,ue=ue+Math.imul(Ze,cn)|0,ue=ue+Math.imul(Rt,Yt)|0,ge=ge+Math.imul(Rt,cn)|0,be=be+Math.imul(en,fn)|0,ue=ue+Math.imul(en,pn)|0,ue=ue+Math.imul(Xt,fn)|0,ge=ge+Math.imul(Xt,pn)|0,be=be+Math.imul(Vt,mn)|0,ue=ue+Math.imul(Vt,wn)|0,ue=ue+Math.imul(Kt,mn)|0,ge=ge+Math.imul(Kt,wn)|0;var Gn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,be=Math.imul(Zt,Pt),ue=Math.imul(Zt,Gt),ue=ue+Math.imul(Jt,Pt)|0,ge=Math.imul(Jt,Gt),be=be+Math.imul(Ft,Yt)|0,ue=ue+Math.imul(Ft,cn)|0,ue=ue+Math.imul(Wt,Yt)|0,ge=ge+Math.imul(Wt,cn)|0,be=be+Math.imul(Ze,fn)|0,ue=ue+Math.imul(Ze,pn)|0,ue=ue+Math.imul(Rt,fn)|0,ge=ge+Math.imul(Rt,pn)|0,be=be+Math.imul(en,mn)|0,ue=ue+Math.imul(en,wn)|0,ue=ue+Math.imul(Xt,mn)|0,ge=ge+Math.imul(Xt,wn)|0;var Wn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,be=Math.imul(Zt,Yt),ue=Math.imul(Zt,cn),ue=ue+Math.imul(Jt,Yt)|0,ge=Math.imul(Jt,cn),be=be+Math.imul(Ft,fn)|0,ue=ue+Math.imul(Ft,pn)|0,ue=ue+Math.imul(Wt,fn)|0,ge=ge+Math.imul(Wt,pn)|0,be=be+Math.imul(Ze,mn)|0,ue=ue+Math.imul(Ze,wn)|0,ue=ue+Math.imul(Rt,mn)|0,ge=ge+Math.imul(Rt,wn)|0;var Vn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,be=Math.imul(Zt,fn),ue=Math.imul(Zt,pn),ue=ue+Math.imul(Jt,fn)|0,ge=Math.imul(Jt,pn),be=be+Math.imul(Ft,mn)|0,ue=ue+Math.imul(Ft,wn)|0,ue=ue+Math.imul(Wt,mn)|0,ge=ge+Math.imul(Wt,wn)|0;var Zn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,be=Math.imul(Zt,mn),ue=Math.imul(Zt,wn),ue=ue+Math.imul(Jt,mn)|0,ge=Math.imul(Jt,wn);var Jn=(Ae+be|0)+((ue&8191)<<13)|0;return Ae=(ge+(ue>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,we[0]=kn,we[1]=Tn,we[2]=In,we[3]=Pn,we[4]=On,we[5]=Dn,we[6]=Ln,we[7]=Fn,we[8]=qn,we[9]=Un,we[10]=Kn,we[11]=Hn,we[12]=jn,we[13]=zn,we[14]=Gn,we[15]=Wn,we[16]=Vn,we[17]=Zn,we[18]=Jn,Ae!==0&&(we[19]=Ae,de.length++),de};Math.imul||($e=Be);function ke(_e,se,ce){ce.negative=se.negative^_e.negative,ce.length=_e.length+se.length;for(var de=0,he=0,ve=0;ve<ce.length-1;ve++){var we=he;he=0;for(var Ae=de&67108863,be=Math.min(ve,se.length-1),ue=Math.max(0,ve-_e.length+1);ue<=be;ue++){var ge=ve-ue,Re=_e.words[ge]|0,Ne=se.words[ue]|0,qe=Re*Ne,Pe=qe&67108863;we=we+(qe/67108864|0)|0,Pe=Pe+Ae|0,Ae=Pe&67108863,we=we+(Pe>>>26)|0,he+=we>>>26,we&=67108863}ce.words[ve]=Ae,de=we,we=he}return de!==0?ce.words[ve]=de:ce.length--,ce.strip()}function Te(_e,se,ce){var de=new Ie;return de.mulp(_e,se,ce)}ae.prototype.mulTo=function(se,ce){var de,he=this.length+se.length;return this.length===10&&se.length===10?de=$e(this,se,ce):he<63?de=Be(this,se,ce):he<1024?de=ke(this,se,ce):de=Te(this,se,ce),de};function Ie(_e,se){this.x=_e,this.y=se}Ie.prototype.makeRBT=function(se){for(var ce=new Array(se),de=ae.prototype._countBits(se)-1,he=0;he<se;he++)ce[he]=this.revBin(he,de,se);return ce},Ie.prototype.revBin=function(se,ce,de){if(se===0||se===de-1)return se;for(var he=0,ve=0;ve<ce;ve++)he|=(se&1)<<ce-ve-1,se>>=1;return he},Ie.prototype.permute=function(se,ce,de,he,ve,we){for(var Ae=0;Ae<we;Ae++)he[Ae]=ce[se[Ae]],ve[Ae]=de[se[Ae]]},Ie.prototype.transform=function(se,ce,de,he,ve,we){this.permute(we,se,ce,de,he,ve);for(var Ae=1;Ae<ve;Ae<<=1)for(var be=Ae<<1,ue=Math.cos(2*Math.PI/be),ge=Math.sin(2*Math.PI/be),Re=0;Re<ve;Re+=be)for(var Ne=ue,qe=ge,Pe=0;Pe<Ae;Pe++){var Ge=de[Re+Pe],Ce=he[Re+Pe],De=de[Re+Pe+Ae],je=he[Re+Pe+Ae],Ve=Ne*De-qe*je;je=Ne*je+qe*De,De=Ve,de[Re+Pe]=Ge+De,he[Re+Pe]=Ce+je,de[Re+Pe+Ae]=Ge-De,he[Re+Pe+Ae]=Ce-je,Pe!==be&&(Ve=ue*Ne-ge*qe,qe=ue*qe+ge*Ne,Ne=Ve)}},Ie.prototype.guessLen13b=function(se,ce){var de=Math.max(ce,se)|1,he=de&1,ve=0;for(de=de/2|0;de;de=de>>>1)ve++;return 1<<ve+1+he},Ie.prototype.conjugate=function(se,ce,de){if(!(de<=1))for(var he=0;he<de/2;he++){var ve=se[he];se[he]=se[de-he-1],se[de-he-1]=ve,ve=ce[he],ce[he]=-ce[de-he-1],ce[de-he-1]=-ve}},Ie.prototype.normalize13b=function(se,ce){for(var de=0,he=0;he<ce/2;he++){var ve=Math.round(se[2*he+1]/ce)*8192+Math.round(se[2*he]/ce)+de;se[he]=ve&67108863,ve<67108864?de=0:de=ve/67108864|0}return se},Ie.prototype.convert13b=function(se,ce,de,he){for(var ve=0,we=0;we<ce;we++)ve=ve+(se[we]|0),de[2*we]=ve&8191,ve=ve>>>13,de[2*we+1]=ve&8191,ve=ve>>>13;for(we=2*ce;we<he;++we)de[we]=0;ie(ve===0),ie((ve&-8192)===0)},Ie.prototype.stub=function(se){for(var ce=new Array(se),de=0;de<se;de++)ce[de]=0;return ce},Ie.prototype.mulp=function(se,ce,de){var he=2*this.guessLen13b(se.length,ce.length),ve=this.makeRBT(he),we=this.stub(he),Ae=new Array(he),be=new Array(he),ue=new Array(he),ge=new Array(he),Re=new Array(he),Ne=new Array(he),qe=de.words;qe.length=he,this.convert13b(se.words,se.length,Ae,he),this.convert13b(ce.words,ce.length,ge,he),this.transform(Ae,we,be,ue,he,ve),this.transform(ge,we,Re,Ne,he,ve);for(var Pe=0;Pe<he;Pe++){var Ge=be[Pe]*Re[Pe]-ue[Pe]*Ne[Pe];ue[Pe]=be[Pe]*Ne[Pe]+ue[Pe]*Re[Pe],be[Pe]=Ge}return this.conjugate(be,ue,he),this.transform(be,ue,qe,we,he,ve),this.conjugate(qe,we,he),this.normalize13b(qe,he),de.negative=se.negative^ce.negative,de.length=se.length+ce.length,de.strip()},ae.prototype.mul=function(se){var ce=new ae(null);return ce.words=new Array(this.length+se.length),this.mulTo(se,ce)},ae.prototype.mulf=function(se){var ce=new ae(null);return ce.words=new Array(this.length+se.length),Te(this,se,ce)},ae.prototype.imul=function(se){return this.clone().mulTo(se,this)},ae.prototype.imuln=function(se){ie(typeof se=="number"),ie(se<67108864);for(var ce=0,de=0;de<this.length;de++){var he=(this.words[de]|0)*se,ve=(he&67108863)+(ce&67108863);ce>>=26,ce+=he/67108864|0,ce+=ve>>>26,this.words[de]=ve&67108863}return ce!==0&&(this.words[de]=ce,this.length++),this.length=se===0?1:this.length,this},ae.prototype.muln=function(se){return this.clone().imuln(se)},ae.prototype.sqr=function(){return this.mul(this)},ae.prototype.isqr=function(){return this.imul(this.clone())},ae.prototype.pow=function(se){var ce=Me(se);if(ce.length===0)return new ae(1);for(var de=this,he=0;he<ce.length&&ce[he]===0;he++,de=de.sqr());if(++he<ce.length)for(var ve=de.sqr();he<ce.length;he++,ve=ve.sqr())ce[he]!==0&&(de=de.mul(ve));return de},ae.prototype.iushln=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26,he=67108863>>>26-ce<<26-ce,ve;if(ce!==0){var we=0;for(ve=0;ve<this.length;ve++){var Ae=this.words[ve]&he,be=(this.words[ve]|0)-Ae<<ce;this.words[ve]=be|we,we=Ae>>>26-ce}we&&(this.words[ve]=we,this.length++)}if(de!==0){for(ve=this.length-1;ve>=0;ve--)this.words[ve+de]=this.words[ve];for(ve=0;ve<de;ve++)this.words[ve]=0;this.length+=de}return this.strip()},ae.prototype.ishln=function(se){return ie(this.negative===0),this.iushln(se)},ae.prototype.iushrn=function(se,ce,de){ie(typeof se=="number"&&se>=0);var he;ce?he=(ce-ce%26)/26:he=0;var ve=se%26,we=Math.min((se-ve)/26,this.length),Ae=67108863^67108863>>>ve<<ve,be=de;if(he-=we,he=Math.max(0,he),be){for(var ue=0;ue<we;ue++)be.words[ue]=this.words[ue];be.length=we}if(we!==0)if(this.length>we)for(this.length-=we,ue=0;ue<this.length;ue++)this.words[ue]=this.words[ue+we];else this.words[0]=0,this.length=1;var ge=0;for(ue=this.length-1;ue>=0&&(ge!==0||ue>=he);ue--){var Re=this.words[ue]|0;this.words[ue]=ge<<26-ve|Re>>>ve,ge=Re&Ae}return be&&ge!==0&&(be.words[be.length++]=ge),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},ae.prototype.ishrn=function(se,ce,de){return ie(this.negative===0),this.iushrn(se,ce,de)},ae.prototype.shln=function(se){return this.clone().ishln(se)},ae.prototype.ushln=function(se){return this.clone().iushln(se)},ae.prototype.shrn=function(se){return this.clone().ishrn(se)},ae.prototype.ushrn=function(se){return this.clone().iushrn(se)},ae.prototype.testn=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26,he=1<<ce;if(this.length<=de)return!1;var ve=this.words[de];return!!(ve&he)},ae.prototype.imaskn=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26;if(ie(this.negative===0,"imaskn works only with positive numbers"),this.length<=de)return this;if(ce!==0&&de++,this.length=Math.min(de,this.length),ce!==0){var he=67108863^67108863>>>ce<<ce;this.words[this.length-1]&=he}return this.strip()},ae.prototype.maskn=function(se){return this.clone().imaskn(se)},ae.prototype.iaddn=function(se){return ie(typeof se=="number"),ie(se<67108864),se<0?this.isubn(-se):this.negative!==0?this.length===1&&(this.words[0]|0)<se?(this.words[0]=se-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(se),this.negative=1,this):this._iaddn(se)},ae.prototype._iaddn=function(se){this.words[0]+=se;for(var ce=0;ce<this.length&&this.words[ce]>=67108864;ce++)this.words[ce]-=67108864,ce===this.length-1?this.words[ce+1]=1:this.words[ce+1]++;return this.length=Math.max(this.length,ce+1),this},ae.prototype.isubn=function(se){if(ie(typeof se=="number"),ie(se<67108864),se<0)return this.iaddn(-se);if(this.negative!==0)return this.negative=0,this.iaddn(se),this.negative=1,this;if(this.words[0]-=se,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var ce=0;ce<this.length&&this.words[ce]<0;ce++)this.words[ce]+=67108864,this.words[ce+1]-=1;return this.strip()},ae.prototype.addn=function(se){return this.clone().iaddn(se)},ae.prototype.subn=function(se){return this.clone().isubn(se)},ae.prototype.iabs=function(){return this.negative=0,this},ae.prototype.abs=function(){return this.clone().iabs()},ae.prototype._ishlnsubmul=function(se,ce,de){var he=se.length+de,ve;this._expand(he);var we,Ae=0;for(ve=0;ve<se.length;ve++){we=(this.words[ve+de]|0)+Ae;var be=(se.words[ve]|0)*ce;we-=be&67108863,Ae=(we>>26)-(be/67108864|0),this.words[ve+de]=we&67108863}for(;ve<this.length-de;ve++)we=(this.words[ve+de]|0)+Ae,Ae=we>>26,this.words[ve+de]=we&67108863;if(Ae===0)return this.strip();for(ie(Ae===-1),Ae=0,ve=0;ve<this.length;ve++)we=-(this.words[ve]|0)+Ae,Ae=we>>26,this.words[ve]=we&67108863;return this.negative=1,this.strip()},ae.prototype._wordDiv=function(se,ce){var de=this.length-se.length,he=this.clone(),ve=se,we=ve.words[ve.length-1]|0,Ae=this._countBits(we);de=26-Ae,de!==0&&(ve=ve.ushln(de),he.iushln(de),we=ve.words[ve.length-1]|0);var be=he.length-ve.length,ue;if(ce!=="mod"){ue=new ae(null),ue.length=be+1,ue.words=new Array(ue.length);for(var ge=0;ge<ue.length;ge++)ue.words[ge]=0}var Re=he.clone()._ishlnsubmul(ve,1,be);Re.negative===0&&(he=Re,ue&&(ue.words[be]=1));for(var Ne=be-1;Ne>=0;Ne--){var qe=(he.words[ve.length+Ne]|0)*67108864+(he.words[ve.length+Ne-1]|0);for(qe=Math.min(qe/we|0,67108863),he._ishlnsubmul(ve,qe,Ne);he.negative!==0;)qe--,he.negative=0,he._ishlnsubmul(ve,1,Ne),he.isZero()||(he.negative^=1);ue&&(ue.words[Ne]=qe)}return ue&&ue.strip(),he.strip(),ce!=="div"&&de!==0&&he.iushrn(de),{div:ue||null,mod:he}},ae.prototype.divmod=function(se,ce,de){if(ie(!se.isZero()),this.isZero())return{div:new ae(0),mod:new ae(0)};var he,ve,we;return this.negative!==0&&se.negative===0?(we=this.neg().divmod(se,ce),ce!=="mod"&&(he=we.div.neg()),ce!=="div"&&(ve=we.mod.neg(),de&&ve.negative!==0&&ve.iadd(se)),{div:he,mod:ve}):this.negative===0&&se.negative!==0?(we=this.divmod(se.neg(),ce),ce!=="mod"&&(he=we.div.neg()),{div:he,mod:we.mod}):this.negative&se.negative?(we=this.neg().divmod(se.neg(),ce),ce!=="div"&&(ve=we.mod.neg(),de&&ve.negative!==0&&ve.isub(se)),{div:we.div,mod:ve}):se.length>this.length||this.cmp(se)<0?{div:new ae(0),mod:this}:se.length===1?ce==="div"?{div:this.divn(se.words[0]),mod:null}:ce==="mod"?{div:null,mod:new ae(this.modn(se.words[0]))}:{div:this.divn(se.words[0]),mod:new ae(this.modn(se.words[0]))}:this._wordDiv(se,ce)},ae.prototype.div=function(se){return this.divmod(se,"div",!1).div},ae.prototype.mod=function(se){return this.divmod(se,"mod",!1).mod},ae.prototype.umod=function(se){return this.divmod(se,"mod",!0).mod},ae.prototype.divRound=function(se){var ce=this.divmod(se);if(ce.mod.isZero())return ce.div;var de=ce.div.negative!==0?ce.mod.isub(se):ce.mod,he=se.ushrn(1),ve=se.andln(1),we=de.cmp(he);return we<0||ve===1&&we===0?ce.div:ce.div.negative!==0?ce.div.isubn(1):ce.div.iaddn(1)},ae.prototype.modn=function(se){ie(se<=67108863);for(var ce=(1<<26)%se,de=0,he=this.length-1;he>=0;he--)de=(ce*de+(this.words[he]|0))%se;return de},ae.prototype.idivn=function(se){ie(se<=67108863);for(var ce=0,de=this.length-1;de>=0;de--){var he=(this.words[de]|0)+ce*67108864;this.words[de]=he/se|0,ce=he%se}return this.strip()},ae.prototype.divn=function(se){return this.clone().idivn(se)},ae.prototype.egcd=function(se){ie(se.negative===0),ie(!se.isZero());var ce=this,de=se.clone();ce.negative!==0?ce=ce.umod(se):ce=ce.clone();for(var he=new ae(1),ve=new ae(0),we=new ae(0),Ae=new ae(1),be=0;ce.isEven()&&de.isEven();)ce.iushrn(1),de.iushrn(1),++be;for(var ue=de.clone(),ge=ce.clone();!ce.isZero();){for(var Re=0,Ne=1;!(ce.words[0]&Ne)&&Re<26;++Re,Ne<<=1);if(Re>0)for(ce.iushrn(Re);Re-- >0;)(he.isOdd()||ve.isOdd())&&(he.iadd(ue),ve.isub(ge)),he.iushrn(1),ve.iushrn(1);for(var qe=0,Pe=1;!(de.words[0]&Pe)&&qe<26;++qe,Pe<<=1);if(qe>0)for(de.iushrn(qe);qe-- >0;)(we.isOdd()||Ae.isOdd())&&(we.iadd(ue),Ae.isub(ge)),we.iushrn(1),Ae.iushrn(1);ce.cmp(de)>=0?(ce.isub(de),he.isub(we),ve.isub(Ae)):(de.isub(ce),we.isub(he),Ae.isub(ve))}return{a:we,b:Ae,gcd:de.iushln(be)}},ae.prototype._invmp=function(se){ie(se.negative===0),ie(!se.isZero());var ce=this,de=se.clone();ce.negative!==0?ce=ce.umod(se):ce=ce.clone();for(var he=new ae(1),ve=new ae(0),we=de.clone();ce.cmpn(1)>0&&de.cmpn(1)>0;){for(var Ae=0,be=1;!(ce.words[0]&be)&&Ae<26;++Ae,be<<=1);if(Ae>0)for(ce.iushrn(Ae);Ae-- >0;)he.isOdd()&&he.iadd(we),he.iushrn(1);for(var ue=0,ge=1;!(de.words[0]&ge)&&ue<26;++ue,ge<<=1);if(ue>0)for(de.iushrn(ue);ue-- >0;)ve.isOdd()&&ve.iadd(we),ve.iushrn(1);ce.cmp(de)>=0?(ce.isub(de),he.isub(ve)):(de.isub(ce),ve.isub(he))}var Re;return ce.cmpn(1)===0?Re=he:Re=ve,Re.cmpn(0)<0&&Re.iadd(se),Re},ae.prototype.gcd=function(se){if(this.isZero())return se.abs();if(se.isZero())return this.abs();var ce=this.clone(),de=se.clone();ce.negative=0,de.negative=0;for(var he=0;ce.isEven()&&de.isEven();he++)ce.iushrn(1),de.iushrn(1);do{for(;ce.isEven();)ce.iushrn(1);for(;de.isEven();)de.iushrn(1);var ve=ce.cmp(de);if(ve<0){var we=ce;ce=de,de=we}else if(ve===0||de.cmpn(1)===0)break;ce.isub(de)}while(!0);return de.iushln(he)},ae.prototype.invm=function(se){return this.egcd(se).a.umod(se)},ae.prototype.isEven=function(){return(this.words[0]&1)===0},ae.prototype.isOdd=function(){return(this.words[0]&1)===1},ae.prototype.andln=function(se){return this.words[0]&se},ae.prototype.bincn=function(se){ie(typeof se=="number");var ce=se%26,de=(se-ce)/26,he=1<<ce;if(this.length<=de)return this._expand(de+1),this.words[de]|=he,this;for(var ve=he,we=de;ve!==0&&we<this.length;we++){var Ae=this.words[we]|0;Ae+=ve,ve=Ae>>>26,Ae&=67108863,this.words[we]=Ae}return ve!==0&&(this.words[we]=ve,this.length++),this},ae.prototype.isZero=function(){return this.length===1&&this.words[0]===0},ae.prototype.cmpn=function(se){var ce=se<0;if(this.negative!==0&&!ce)return-1;if(this.negative===0&&ce)return 1;this.strip();var de;if(this.length>1)de=1;else{ce&&(se=-se),ie(se<=67108863,"Number is too big");var he=this.words[0]|0;de=he===se?0:he<se?-1:1}return this.negative!==0?-de|0:de},ae.prototype.cmp=function(se){if(this.negative!==0&&se.negative===0)return-1;if(this.negative===0&&se.negative!==0)return 1;var ce=this.ucmp(se);return this.negative!==0?-ce|0:ce},ae.prototype.ucmp=function(se){if(this.length>se.length)return 1;if(this.length<se.length)return-1;for(var ce=0,de=this.length-1;de>=0;de--){var he=this.words[de]|0,ve=se.words[de]|0;if(he!==ve){he<ve?ce=-1:he>ve&&(ce=1);break}}return ce},ae.prototype.gtn=function(se){return this.cmpn(se)===1},ae.prototype.gt=function(se){return this.cmp(se)===1},ae.prototype.gten=function(se){return this.cmpn(se)>=0},ae.prototype.gte=function(se){return this.cmp(se)>=0},ae.prototype.ltn=function(se){return this.cmpn(se)===-1},ae.prototype.lt=function(se){return this.cmp(se)===-1},ae.prototype.lten=function(se){return this.cmpn(se)<=0},ae.prototype.lte=function(se){return this.cmp(se)<=0},ae.prototype.eqn=function(se){return this.cmpn(se)===0},ae.prototype.eq=function(se){return this.cmp(se)===0},ae.red=function(se){return new Ue(se)},ae.prototype.toRed=function(se){return ie(!this.red,"Already a number in reduction context"),ie(this.negative===0,"red works only with positives"),se.convertTo(this)._forceRed(se)},ae.prototype.fromRed=function(){return ie(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},ae.prototype._forceRed=function(se){return this.red=se,this},ae.prototype.forceRed=function(se){return ie(!this.red,"Already a number in reduction context"),this._forceRed(se)},ae.prototype.redAdd=function(se){return ie(this.red,"redAdd works only with red numbers"),this.red.add(this,se)},ae.prototype.redIAdd=function(se){return ie(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,se)},ae.prototype.redSub=function(se){return ie(this.red,"redSub works only with red numbers"),this.red.sub(this,se)},ae.prototype.redISub=function(se){return ie(this.red,"redISub works only with red numbers"),this.red.isub(this,se)},ae.prototype.redShl=function(se){return ie(this.red,"redShl works only with red numbers"),this.red.shl(this,se)},ae.prototype.redMul=function(se){return ie(this.red,"redMul works only with red numbers"),this.red._verify2(this,se),this.red.mul(this,se)},ae.prototype.redIMul=function(se){return ie(this.red,"redMul works only with red numbers"),this.red._verify2(this,se),this.red.imul(this,se)},ae.prototype.redSqr=function(){return ie(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},ae.prototype.redISqr=function(){return ie(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},ae.prototype.redSqrt=function(){return ie(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},ae.prototype.redInvm=function(){return ie(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},ae.prototype.redNeg=function(){return ie(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},ae.prototype.redPow=function(se){return ie(this.red&&!se.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,se)};var Fe={k256:null,p224:null,p192:null,p25519:null};function Le(_e,se){this.name=_e,this.p=new ae(se,16),this.n=this.p.bitLength(),this.k=new ae(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Le.prototype._tmp=function(){var se=new ae(null);return se.words=new Array(Math.ceil(this.n/13)),se},Le.prototype.ireduce=function(se){var ce=se,de;do this.split(ce,this.tmp),ce=this.imulK(ce),ce=ce.iadd(this.tmp),de=ce.bitLength();while(de>this.n);var he=de<this.n?-1:ce.ucmp(this.p);return he===0?(ce.words[0]=0,ce.length=1):he>0?ce.isub(this.p):ce.strip!==void 0?ce.strip():ce._strip(),ce},Le.prototype.split=function(se,ce){se.iushrn(this.n,0,ce)},Le.prototype.imulK=function(se){return se.imul(this.k)};function He(){Le.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}fe(He,Le),He.prototype.split=function(se,ce){for(var de=4194303,he=Math.min(se.length,9),ve=0;ve<he;ve++)ce.words[ve]=se.words[ve];if(ce.length=he,se.length<=9){se.words[0]=0,se.length=1;return}var we=se.words[9];for(ce.words[ce.length++]=we&de,ve=10;ve<se.length;ve++){var Ae=se.words[ve]|0;se.words[ve-10]=(Ae&de)<<4|we>>>22,we=Ae}we>>>=22,se.words[ve-10]=we,we===0&&se.length>10?se.length-=10:se.length-=9},He.prototype.imulK=function(se){se.words[se.length]=0,se.words[se.length+1]=0,se.length+=2;for(var ce=0,de=0;de<se.length;de++){var he=se.words[de]|0;ce+=he*977,se.words[de]=ce&67108863,ce=he*64+(ce/67108864|0)}return se.words[se.length-1]===0&&(se.length--,se.words[se.length-1]===0&&se.length--),se};function ze(){Le.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}fe(ze,Le);function Je(){Le.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}fe(Je,Le);function Xe(){Le.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}fe(Xe,Le),Xe.prototype.imulK=function(se){for(var ce=0,de=0;de<se.length;de++){var he=(se.words[de]|0)*19+ce,ve=he&67108863;he>>>=26,se.words[de]=ve,ce=he}return ce!==0&&(se.words[se.length++]=ce),se},ae._prime=function(se){if(Fe[se])return Fe[se];var ce;if(se==="k256")ce=new He;else if(se==="p224")ce=new ze;else if(se==="p192")ce=new Je;else if(se==="p25519")ce=new Xe;else throw new Error("Unknown prime "+se);return Fe[se]=ce,ce};function Ue(_e){if(typeof _e=="string"){var se=ae._prime(_e);this.m=se.p,this.prime=se}else ie(_e.gtn(1),"modulus must be greater than 1"),this.m=_e,this.prime=null}Ue.prototype._verify1=function(se){ie(se.negative===0,"red works only with positives"),ie(se.red,"red works only with red numbers")},Ue.prototype._verify2=function(se,ce){ie((se.negative|ce.negative)===0,"red works only with positives"),ie(se.red&&se.red===ce.red,"red works only with red numbers")},Ue.prototype.imod=function(se){return this.prime?this.prime.ireduce(se)._forceRed(this):se.umod(this.m)._forceRed(this)},Ue.prototype.neg=function(se){return se.isZero()?se.clone():this.m.sub(se)._forceRed(this)},Ue.prototype.add=function(se,ce){this._verify2(se,ce);var de=se.add(ce);return de.cmp(this.m)>=0&&de.isub(this.m),de._forceRed(this)},Ue.prototype.iadd=function(se,ce){this._verify2(se,ce);var de=se.iadd(ce);return de.cmp(this.m)>=0&&de.isub(this.m),de},Ue.prototype.sub=function(se,ce){this._verify2(se,ce);var de=se.sub(ce);return de.cmpn(0)<0&&de.iadd(this.m),de._forceRed(this)},Ue.prototype.isub=function(se,ce){this._verify2(se,ce);var de=se.isub(ce);return de.cmpn(0)<0&&de.iadd(this.m),de},Ue.prototype.shl=function(se,ce){return this._verify1(se),this.imod(se.ushln(ce))},Ue.prototype.imul=function(se,ce){return this._verify2(se,ce),this.imod(se.imul(ce))},Ue.prototype.mul=function(se,ce){return this._verify2(se,ce),this.imod(se.mul(ce))},Ue.prototype.isqr=function(se){return this.imul(se,se.clone())},Ue.prototype.sqr=function(se){return this.mul(se,se)},Ue.prototype.sqrt=function(se){if(se.isZero())return se.clone();var ce=this.m.andln(3);if(ie(ce%2===1),ce===3){var de=this.m.add(new ae(1)).iushrn(2);return this.pow(se,de)}for(var he=this.m.subn(1),ve=0;!he.isZero()&&he.andln(1)===0;)ve++,he.iushrn(1);ie(!he.isZero());var we=new ae(1).toRed(this),Ae=we.redNeg(),be=this.m.subn(1).iushrn(1),ue=this.m.bitLength();for(ue=new ae(2*ue*ue).toRed(this);this.pow(ue,be).cmp(Ae)!==0;)ue.redIAdd(Ae);for(var ge=this.pow(ue,he),Re=this.pow(se,he.addn(1).iushrn(1)),Ne=this.pow(se,he),qe=ve;Ne.cmp(we)!==0;){for(var Pe=Ne,Ge=0;Pe.cmp(we)!==0;Ge++)Pe=Pe.redSqr();ie(Ge<qe);var Ce=this.pow(ge,new ae(1).iushln(qe-Ge-1));Re=Re.redMul(Ce),ge=Ce.redSqr(),Ne=Ne.redMul(ge),qe=Ge}return Re},Ue.prototype.invm=function(se){var ce=se._invmp(this.m);return ce.negative!==0?(ce.negative=0,this.imod(ce).redNeg()):this.imod(ce)},Ue.prototype.pow=function(se,ce){if(ce.isZero())return new ae(1).toRed(this);if(ce.cmpn(1)===0)return se.clone();var de=4,he=new Array(1<<de);he[0]=new ae(1).toRed(this),he[1]=se;for(var ve=2;ve<he.length;ve++)he[ve]=this.mul(he[ve-1],se);var we=he[0],Ae=0,be=0,ue=ce.bitLength()%26;for(ue===0&&(ue=26),ve=ce.length-1;ve>=0;ve--){for(var ge=ce.words[ve],Re=ue-1;Re>=0;Re--){var Ne=ge>>Re&1;if(we!==he[0]&&(we=this.sqr(we)),Ne===0&&Ae===0){be=0;continue}Ae<<=1,Ae|=Ne,be++,!(be!==de&&(ve!==0||Re!==0))&&(we=this.mul(we,he[Ae]),be=0,Ae=0)}ue=26}return we},Ue.prototype.convertTo=function(se){var ce=se.umod(this.m);return ce===se?ce.clone():ce},Ue.prototype.convertFrom=function(se){var ce=se.clone();return ce.red=null,ce},ae.mont=function(se){return new $t(se)};function $t(_e){Ue.call(this,_e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new ae(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}fe($t,Ue),$t.prototype.convertTo=function(se){return this.imod(se.ushln(this.shift))},$t.prototype.convertFrom=function(se){var ce=this.imod(se.mul(this.rinv));return ce.red=null,ce},$t.prototype.imul=function(se,ce){if(se.isZero()||ce.isZero())return se.words[0]=0,se.length=1,se;var de=se.imul(ce),he=de.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ve=de.isub(he).iushrn(this.shift),we=ve;return ve.cmp(this.m)>=0?we=ve.isub(this.m):ve.cmpn(0)<0&&(we=ve.iadd(this.m)),we._forceRed(this)},$t.prototype.mul=function(se,ce){if(se.isZero()||ce.isZero())return new ae(0)._forceRed(this);var de=se.mul(ce),he=de.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ve=de.isub(he).iushrn(this.shift),we=ve;return ve.cmp(this.m)>=0?we=ve.isub(this.m):ve.cmpn(0)<0&&(we=ve.iadd(this.m)),we._forceRed(this)},$t.prototype.invm=function(se){var ce=this.imod(se._invmp(this.m).mul(this.r2));return ce._forceRed(this)}})(c,commonjsGlobal)})(bn$7);var bnExports$2=bn$7.exports,Ens$1={},src$6={exports:{}},encode_1=encode$3,MSB$1=128,MSBALL=-128,INT=Math.pow(2,31);function encode$3(c,t,n){t=t||[],n=n||0;for(var ie=n;c>=INT;)t[n++]=c&255|MSB$1,c/=128;for(;c&MSBALL;)t[n++]=c&255|MSB$1,c>>>=7;return t[n]=c|0,encode$3.bytes=n-ie+1,t}var decode$4=read,MSB=128,REST=127;function read(c,ie){var n=0,ie=ie||0,fe=0,ae=ie,le,pe=c.length;do{if(ae>=pe)throw read.bytes=0,new RangeError("Could not decode varint");le=c[ae++],n+=fe<28?(le&REST)<<fe:(le&REST)*Math.pow(2,fe),fe+=7}while(le>=MSB);return read.bytes=ae-ie,n}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(c){return c<N1?1:c<N2?2:c<N3?3:c<N4?4:c<N5?5:c<N6?6:c<N7?7:c<N8?8:c<N9?9:10},varint$2={encode:encode_1,decode:decode$4,encodingLength:length};const identity$1=0,ip4$1=4,tcp$1=6,sha1$2=17,dccp$1=33,ip6$1=41,ip6zone$1=42,path$1=47,multicodec$2=48,multihash$1=49,multiaddr$1=50,multibase$2=51,dns$1=53,dns4$1=54,dns6$1=55,dnsaddr$1=56,protobuf$1=80,cbor$1=81,raw$1=85,rlp$1=96,bencode$1=99,sctp$1=132,md4$1=212,md5$2=213,bmt$1=214,zeronet$1=230,udp$1=273,udt$1=301,utp$1=302,unix$1=400,p2p$1=421,ipfs$1=421,https$1=443,onion$1=444,onion3$1=445,garlic64$1=446,garlic32$1=447,tls$1=448,quic$1=460,ws$1=477,wss$1=478,http$1=480,json$1=512,messagepack$1=513,x11$1=4352,require$$0$1={identity:identity$1,ip4:ip4$1,tcp:tcp$1,sha1:sha1$2,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,dccp:dccp$1,"murmur3-128":34,"murmur3-32":35,ip6:ip6$1,ip6zone:ip6zone$1,path:path$1,multicodec:multicodec$2,multihash:multihash$1,multiaddr:multiaddr$1,multibase:multibase$2,dns:dns$1,dns4:dns4$1,dns6:dns6$1,dnsaddr:dnsaddr$1,protobuf:protobuf$1,cbor:cbor$1,raw:raw$1,"dbl-sha2-256":86,rlp:rlp$1,bencode:bencode$1,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,sctp:sctp$1,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"bitcoin-block":176,"bitcoin-tx":177,"zcash-block":192,"zcash-tx":193,"stellar-block":208,"stellar-tx":209,md4:md4$1,md5:md5$2,bmt:bmt$1,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,zeronet:zeronet$1,"ed25519-pub":237,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,udp:udp$1,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,udt:udt$1,utp:utp$1,unix:unix$1,p2p:p2p$1,ipfs:ipfs$1,https:https$1,onion:onion$1,onion3:onion3$1,garlic64:garlic64$1,garlic32:garlic32$1,tls:tls$1,quic:quic$1,ws:ws$1,wss:wss$1,"p2p-websocket-star":479,http:http$1,json:json$1,messagepack:messagepack$1,x11:x11$1,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332},baseTable$3=require$$0$1,nameTable$1=new Map;for(const c in baseTable$3){const t=baseTable$3[c];nameTable$1.set(t,c)}var intTable$1=Object.freeze(nameTable$1);const varint$1=varint$2;var util$5={numberToBuffer:numberToBuffer$1,bufferToNumber:bufferToNumber$1,varintBufferEncode:varintBufferEncode$1,varintBufferDecode:varintBufferDecode$1,varintEncode:varintEncode$3};function bufferToNumber$1(c){return parseInt(c.toString("hex"),16)}function numberToBuffer$1(c){let t=c.toString(16);return t.length%2===1&&(t="0"+t),Buffer$7.from(t,"hex")}function varintBufferEncode$1(c){return Buffer$7.from(varint$1.encode(bufferToNumber$1(c)))}function varintBufferDecode$1(c){return numberToBuffer$1(varint$1.decode(c))}function varintEncode$3(c){return Buffer$7.from(varint$1.encode(c))}const baseTable$2=require$$0$1,varintEncode$2=util$5.varintEncode,varintTable$1={};for(const c in baseTable$2){const t=baseTable$2[c];varintTable$1[c]=varintEncode$2(t)}var varintTable_1$1=Object.freeze(varintTable$1),constants_1$3,hasRequiredConstants$2;function requireConstants$2(){if(hasRequiredConstants$2)return constants_1$3;hasRequiredConstants$2=1;const c=require$$0$1,t={};for(const[n,ie]of Object.entries(c))t[n.toUpperCase().replace(/-/g,"_")]=ie;return constants_1$3=Object.freeze(t),constants_1$3}var print$1,hasRequiredPrint$1;function requirePrint$1(){if(hasRequiredPrint$1)return print$1;hasRequiredPrint$1=1;const c=require$$0$1,t={};for(const[n,ie]of Object.entries(c))t[ie]===void 0&&(t[ie]=n);return print$1=Object.freeze(t),print$1}(function(c,t){const n=varint$2,ie=intTable$1,fe=varintTable_1$1,ae=util$5;t=c.exports,t.addPrefix=(pe,me)=>{let ye;if(Buffer$7.isBuffer(pe))ye=ae.varintBufferEncode(pe);else if(fe[pe])ye=fe[pe];else throw new Error("multicodec not recognized");return Buffer$7.concat([ye,me])},t.rmPrefix=pe=>(n.decode(pe),pe.slice(n.decode.bytes)),t.getCodec=pe=>{const me=n.decode(pe),ye=ie.get(me);if(ye===void 0)throw new Error(`Code ${me} not found`);return ye},t.getName=pe=>ie.get(pe),t.getNumber=pe=>{const me=fe[pe];if(me===void 0)throw new Error("Codec `"+pe+"` not found");return ae.varintBufferDecode(me)[0]},t.getCode=pe=>n.decode(pe),t.getCodeVarint=pe=>{const me=fe[pe];if(me===void 0)throw new Error("Codec `"+pe+"` not found");return me},t.getVarint=pe=>n.encode(pe);const le=requireConstants$2();Object.assign(t,le),t.print=requirePrint$1()})(src$6,src$6.exports);var srcExports$3=src$6.exports,profiles$2={},src$5={},src$4={exports:{}};let Base$6=class{constructor(t,n,ie,fe){this.name=t,this.code=n,this.alphabet=fe,ie&&fe&&(this.engine=ie(fe))}encode(t){return this.engine.encode(t)}decode(t){return this.engine.decode(t)}isImplemented(){return this.engine}};var base$3=Base$6;const{Buffer:Buffer$6}=dist$1;var base16$3=function(t){return{encode(n){return typeof n=="string"?Buffer$6.from(n).toString("hex"):n.toString("hex")},decode(n){for(const ie of n)if(t.indexOf(ie)<0)throw new Error("invalid base16 character");return Buffer$6.from(n,"hex")}}};function decode$3(c,t){c=c.replace(new RegExp("=","g"),"");const n=c.length;let ie=0,fe=0,ae=0;const le=new Uint8Array(n*5/8|0);for(let pe=0;pe<n;pe++)fe=fe<<5|t.indexOf(c[pe]),ie+=5,ie>=8&&(le[ae++]=fe>>>ie-8&255,ie-=8);return le.buffer}function encode$2(c,t){const n=c.byteLength,ie=new Uint8Array(c),fe=t.indexOf("=")===t.length-1;fe&&(t=t.substring(0,t.length-1));let ae=0,le=0,pe="";for(let me=0;me<n;me++)for(le=le<<8|ie[me],ae+=8;ae>=5;)pe+=t[le>>>ae-5&31],ae-=5;if(ae>0&&(pe+=t[le<<5-ae&31]),fe)for(;pe.length%8!==0;)pe+="=";return pe}var base32$3=function(t){return{encode(n){return encode$2(typeof n=="string"?Uint8Array.from(n):n,t)},decode(n){for(const ie of n)if(t.indexOf(ie)<0)throw new Error("invalid base32 character");return decode$3(n,t)}}};const{Buffer:Buffer$5}=dist$1;var base64$3=function(t){const n=t.indexOf("=")>-1,ie=t.indexOf("-")>-1&&t.indexOf("_")>-1;return{encode(fe){let ae="";typeof fe=="string"?ae=Buffer$5.from(fe).toString("base64"):ae=fe.toString("base64"),ie&&(ae=ae.replace(/\+/g,"-").replace(/\//g,"_"));const le=ae.indexOf("=");return le>0&&!n&&(ae=ae.substring(0,le)),ae},decode(fe){for(const ae of fe)if(t.indexOf(ae)<0)throw new Error("invalid base64 character");return Buffer$5.from(fe,"base64")}}};const Base$5=base$3,baseX$1=src$7,base16$2=base16$3,base32$2=base32$3,base64$2=base64$3,constants$3=[["base1","1","","1"],["base2","0",baseX$1,"01"],["base8","7",baseX$1,"01234567"],["base10","9",baseX$1,"0123456789"],["base16","f",base16$2,"0123456789abcdef"],["base32","b",base32$2,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",base32$2,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",base32$2,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",base32$2,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",base32$2,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",baseX$1,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",baseX$1,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",base64$2,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",base64$2,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",base64$2,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",base64$2,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],names$1=constants$3.reduce((c,t)=>(c[t[0]]=new Base$5(t[0],t[1],t[2],t[3]),c),{}),codes$1=constants$3.reduce((c,t)=>(c[t[1]]=names$1[t[0]],c),{});var constants_1$2={names:names$1,codes:codes$1};(function(c,t){const{Buffer:n}=dist$1,ie=constants_1$2;t=c.exports=fe,t.encode=ae,t.decode=le,t.isEncoded=pe,t.names=Object.freeze(Object.keys(ie.names)),t.codes=Object.freeze(Object.keys(ie.codes));function fe(xe,Ee){if(!Ee)throw new Error("requires an encoded buffer");const Se=ye(xe),Me=n.from(Se.code),Be=Se.name;return me(Be,Ee),n.concat([Me,Ee])}function ae(xe,Ee){const Se=ye(xe),Me=Se.name;return fe(Me,n.from(Se.encode(Ee)))}function le(xe){n.isBuffer(xe)&&(xe=xe.toString());const Ee=xe.substring(0,1);xe=xe.substring(1,xe.length),typeof xe=="string"&&(xe=n.from(xe));const Se=ye(Ee);return n.from(Se.decode(xe.toString()))}function pe(xe){if(n.isBuffer(xe)&&(xe=xe.toString()),Object.prototype.toString.call(xe)!=="[object String]")return!1;const Ee=xe.substring(0,1);try{return ye(Ee).name}catch{return!1}}function me(xe,Ee){ye(xe).decode(Ee.toString())}function ye(xe){let Ee;if(ie.names[xe])Ee=ie.names[xe];else if(ie.codes[xe])Ee=ie.codes[xe];else throw new Error("Unsupported encoding");if(!Ee.isImplemented())throw new Error("Base "+xe+" is not implemented yet");return Ee}})(src$4,src$4.exports);var srcExports$2=src$4.exports,constants$2={};constants$2.names=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,md4:212,md5:213,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048});constants$2.codes=Object.freeze({0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",212:"md4",213:"md5",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46e3:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"});constants$2.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46e3:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128});(function(c){const{Buffer:t}=dist$1,n=srcExports$2,ie=varint$2,fe=constants$2;c.names=fe.names,c.codes=fe.codes,c.defaultLengths=fe.defaultLengths,c.toHexString=function(pe){if(!t.isBuffer(pe))throw new Error("must be passed a buffer");return pe.toString("hex")},c.fromHexString=function(pe){return t.from(pe,"hex")},c.toB58String=function(pe){if(!t.isBuffer(pe))throw new Error("must be passed a buffer");return n.encode("base58btc",pe).toString().slice(1)},c.fromB58String=function(pe){let me=pe;return t.isBuffer(pe)&&(me=pe.toString()),n.decode("z"+me)},c.decode=function(pe){if(!t.isBuffer(pe))throw new Error("multihash must be a Buffer");if(pe.length<2)throw new Error("multihash too short. must be > 2 bytes.");const me=ie.decode(pe);if(!c.isValidCode(me))throw new Error(`multihash unknown function code: 0x${me.toString(16)}`);pe=pe.slice(ie.decode.bytes);const ye=ie.decode(pe);if(ye<0)throw new Error(`multihash invalid length: ${ye}`);if(pe=pe.slice(ie.decode.bytes),pe.length!==ye)throw new Error(`multihash length inconsistent: 0x${pe.toString("hex")}`);return{code:me,name:fe.codes[me],length:ye,digest:pe}},c.encode=function(pe,me,ye){if(!pe||me===void 0)throw new Error("multihash encode requires at least two args: digest, code");const xe=c.coerceCode(me);if(!t.isBuffer(pe))throw new Error("digest should be a Buffer");if(ye==null&&(ye=pe.length),ye&&pe.length!==ye)throw new Error("digest length should be equal to specified length.");return t.concat([t.from(ie.encode(xe)),t.from(ie.encode(ye)),pe])},c.coerceCode=function(pe){let me=pe;if(typeof pe=="string"){if(fe.names[pe]===void 0)throw new Error(`Unrecognized hash function named: ${pe}`);me=fe.names[pe]}if(typeof me!="number")throw new Error(`Hash function code should be a number. Got: ${me}`);if(fe.codes[me]===void 0&&!c.isAppCode(me))throw new Error(`Unrecognized function code: ${me}`);return me},c.isAppCode=function(pe){return pe>0&&pe<16},c.isValidCode=function(pe){return!!(c.isAppCode(pe)||fe.codes[pe])};function ae(le){c.decode(le)}c.validate=ae,c.prefix=function(pe){return ae(pe),pe.slice(0,2)}})(src$5);var src$3={exports:{}};let Base$4=class{constructor(t,n,ie,fe){this.name=t,this.code=n,this.alphabet=fe,ie&&fe&&(this.engine=ie(fe))}encode(t){return this.engine.encode(t)}decode(t){return this.engine.decode(t)}isImplemented(){return this.engine}};var base$2=Base$4;const{Buffer:Buffer$4}=dist$1;var base16$1=function(t){return{encode(n){return typeof n=="string"?Buffer$4.from(n).toString("hex"):n.toString("hex")},decode(n){for(const ie of n)if(t.indexOf(ie)<0)throw new Error("invalid base16 character");return Buffer$4.from(n,"hex")}}};function decode$2(c,t){c=c.replace(new RegExp("=","g"),"");const n=c.length;let ie=0,fe=0,ae=0;const le=new Uint8Array(n*5/8|0);for(let pe=0;pe<n;pe++)fe=fe<<5|t.indexOf(c[pe]),ie+=5,ie>=8&&(le[ae++]=fe>>>ie-8&255,ie-=8);return le.buffer}function encode$1(c,t){const n=c.byteLength,ie=new Uint8Array(c),fe=t.indexOf("=")===t.length-1;fe&&(t=t.substring(0,t.length-1));let ae=0,le=0,pe="";for(let me=0;me<n;me++)for(le=le<<8|ie[me],ae+=8;ae>=5;)pe+=t[le>>>ae-5&31],ae-=5;if(ae>0&&(pe+=t[le<<5-ae&31]),fe)for(;pe.length%8!==0;)pe+="=";return pe}var base32$1=function(t){return{encode(n){return encode$1(typeof n=="string"?Uint8Array.from(n):n,t)},decode(n){for(const ie of n)if(t.indexOf(ie)<0)throw new Error("invalid base32 character");return decode$2(n,t)}}};const{Buffer:Buffer$3}=dist$1;var base64$1=function(t){const n=t.indexOf("=")>-1,ie=t.indexOf("-")>-1&&t.indexOf("_")>-1;return{encode(fe){let ae="";typeof fe=="string"?ae=Buffer$3.from(fe).toString("base64"):ae=fe.toString("base64"),ie&&(ae=ae.replace(/\+/g,"-").replace(/\//g,"_"));const le=ae.indexOf("=");return le>0&&!n&&(ae=ae.substring(0,le)),ae},decode(fe){for(const ae of fe)if(t.indexOf(ae)<0)throw new Error("invalid base64 character");return Buffer$3.from(fe,"base64")}}};const Base$3=base$2,baseX=src$7,base16=base16$1,base32=base32$1,base64=base64$1,constants$1=[["base1","1","","1"],["base2","0",baseX,"01"],["base8","7",baseX,"01234567"],["base10","9",baseX,"0123456789"],["base16","f",base16,"0123456789abcdef"],["base32","b",base32,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",base32,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",base32,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",base32,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",base32,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",baseX,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",baseX,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",base64,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",base64,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",base64,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",base64,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],names=constants$1.reduce((c,t)=>(c[t[0]]=new Base$3(t[0],t[1],t[2],t[3]),c),{}),codes=constants$1.reduce((c,t)=>(c[t[1]]=names[t[0]],c),{});var constants_1$1={names,codes};(function(c,t){const{Buffer:n}=dist$1,ie=constants_1$1;t=c.exports=ae,t.encode=le,t.decode=pe,t.isEncoded=me,t.names=Object.freeze(Object.keys(ie.names)),t.codes=Object.freeze(Object.keys(ie.codes));const fe=new Error("Unsupported encoding");function ae(Ee,Se){if(!Se)throw new Error("requires an encoded buffer");const Me=xe(Ee),Be=n.from(Me.code),$e=Me.name;return ye($e,Se),n.concat([Be,Se])}function le(Ee,Se){const Me=xe(Ee),Be=Me.name;return ae(Be,n.from(Me.encode(Se)))}function pe(Ee){n.isBuffer(Ee)&&(Ee=Ee.toString());const Se=Ee.substring(0,1);Ee=Ee.substring(1,Ee.length),typeof Ee=="string"&&(Ee=n.from(Ee));const Me=xe(Se);return n.from(Me.decode(Ee.toString()))}function me(Ee){if(n.isBuffer(Ee)&&(Ee=Ee.toString()),Object.prototype.toString.call(Ee)!=="[object String]")return!1;const Se=Ee.substring(0,1);try{return xe(Se).name}catch{return!1}}function ye(Ee,Se){xe(Ee).decode(Se.toString())}function xe(Ee){let Se;if(ie.names[Ee])Se=ie.names[Ee];else if(ie.codes[Ee])Se=ie.codes[Ee];else throw fe;if(!Se.isImplemented())throw new Error("Base "+Ee+" is not implemented yet");return Se}})(src$3,src$3.exports);var srcExports$1=src$3.exports,src$2={exports:{}};const identity=0,ip4=4,tcp=6,sha1$1=17,blake3=30,dccp=33,ip6=41,ip6zone=42,path=47,multicodec$1=48,multihash=49,multiaddr=50,multibase$1=51,dns=53,dns4=54,dns6=55,dnsaddr=56,protobuf=80,cbor=81,raw=85,rlp=96,bencode=99,sctp=132,md4=212,md5$1=213,bmt=214,zeronet=230,udp=273,udt=301,utp=302,unix=400,p2p=421,ipfs=421,https=443,onion=444,onion3=445,garlic64=446,garlic32=447,tls=448,quic=460,ws=477,wss=478,http=480,json=512,messagepack=513,x11=4352,require$$4$2={identity,ip4,tcp,sha1:sha1$1,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3,dccp,"murmur3-128":34,"murmur3-32":35,ip6,ip6zone,path,multicodec:multicodec$1,multihash,multiaddr,multibase:multibase$1,dns,dns4,dns6,dnsaddr,protobuf,cbor,raw,"dbl-sha2-256":86,rlp,bencode,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,sctp,"dag-jose":133,"dag-cose":134,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"bitcoin-block":176,"bitcoin-tx":177,"bitcoin-witness-commitment":178,"zcash-block":192,"zcash-tx":193,"stellar-block":208,"stellar-tx":209,md4,md5:md5$1,bmt,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,zeronet,"secp256k1-pub":231,"bls12_381-g1-pub":234,"bls12_381-g2-pub":235,"x25519-pub":236,"ed25519-pub":237,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,udp,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,udt,utp,unix,p2p,ipfs,https,onion,onion3,garlic64,garlic32,tls,quic,ws,wss,"p2p-websocket-star":479,http,json,messagepack,"libp2p-peer-record":769,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082,"zeroxcert-imprint-256":52753,"fil-commitment-unsealed":61697,"fil-commitment-sealed":61698,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332},baseTable$1=require$$4$2,nameTable=new Map;for(const c in baseTable$1){const t=baseTable$1[c];nameTable.set(t,c)}var intTable=Object.freeze(nameTable);const varint=varint$2,{Buffer:Buffer$2}=dist$1;var util$4={numberToBuffer,bufferToNumber,varintBufferEncode,varintBufferDecode,varintEncode:varintEncode$1};function bufferToNumber(c){return parseInt(c.toString("hex"),16)}function numberToBuffer(c){let t=c.toString(16);return t.length%2===1&&(t="0"+t),Buffer$2.from(t,"hex")}function varintBufferEncode(c){return Buffer$2.from(varint.encode(bufferToNumber(c)))}function varintBufferDecode(c){return numberToBuffer(varint.decode(c))}function varintEncode$1(c){return Buffer$2.from(varint.encode(c))}const baseTable=require$$4$2,varintEncode=util$4.varintEncode,varintTable={};for(const c in baseTable){const t=baseTable[c];varintTable[c]=varintEncode(t)}var varintTable_1=Object.freeze(varintTable),constants_1,hasRequiredConstants$1;function requireConstants$1(){if(hasRequiredConstants$1)return constants_1;hasRequiredConstants$1=1;const c=require$$4$2,t={};for(const[n,ie]of Object.entries(c))t[n.toUpperCase().replace(/-/g,"_")]=ie;return constants_1=Object.freeze(t),constants_1}var print,hasRequiredPrint;function requirePrint(){if(hasRequiredPrint)return print;hasRequiredPrint=1;const c=require$$4$2,t={};for(const[n,ie]of Object.entries(c))t[ie]===void 0&&(t[ie]=n);return print=Object.freeze(t),print}(function(c,t){const{Buffer:n}=dist$1,ie=varint$2,fe=intTable,ae=varintTable_1,le=util$4;t=c.exports,t.addPrefix=(me,ye)=>{let xe;if(n.isBuffer(me))xe=le.varintBufferEncode(me);else if(ae[me])xe=ae[me];else throw new Error("multicodec not recognized");return n.concat([xe,ye])},t.rmPrefix=me=>(ie.decode(me),me.slice(ie.decode.bytes)),t.getCodec=me=>{const ye=ie.decode(me),xe=fe.get(ye);if(xe===void 0)throw new Error(`Code ${ye} not found`);return xe},t.getName=me=>fe.get(me),t.getNumber=me=>{const ye=ae[me];if(ye===void 0)throw new Error("Codec `"+me+"` not found");return le.varintBufferDecode(ye)[0]},t.getCode=me=>ie.decode(me),t.getCodeVarint=me=>{const ye=ae[me];if(ye===void 0)throw new Error("Codec `"+me+"` not found");return ye},t.getVarint=me=>ie.encode(me);const pe=requireConstants$1();Object.assign(t,pe),t.print=requirePrint()})(src$2,src$2.exports);var srcExports=src$2.exports;const mh$1=src$5,{Buffer:Buffer$1}=dist$1;var CIDUtil$1={checkCIDComponents:function(c){if(c==null)return"null values are not valid CIDs";if(!(c.version===0||c.version===1))return"Invalid version, must be a number equal to 1 or 0";if(typeof c.codec!="string")return"codec must be string";if(c.version===0){if(c.codec!=="dag-pb")return"codec must be 'dag-pb' for CIDv0";if(c.multibaseName!=="base58btc")return"multibaseName must be 'base58btc' for CIDv0"}if(!Buffer$1.isBuffer(c.multihash))return"multihash must be a Buffer";try{mh$1.validate(c.multihash)}catch(t){let n=t.message;return n||(n="Multihash validation failed"),n}}},cidUtil=CIDUtil$1,classIs={exports:{}};function withIs$1(c,{className:t,symbolName:n}){const ie=Symbol.for(n),fe={[t]:class extends c{constructor(...ae){super(...ae),Object.defineProperty(this,ie,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return fe[`is${t}`]=ae=>!!(ae&&ae[ie]),fe}function withIsProto(c,{className:t,symbolName:n,withoutNew:ie}){const fe=Symbol.for(n),ae={[t]:function(...le){if(ie&&!(this instanceof ae))return new ae(...le);const pe=c.call(this,...le)||this;return pe&&!pe[fe]&&Object.defineProperty(pe,fe,{value:!0}),pe}}[t];return ae.prototype=Object.create(c.prototype),ae.prototype.constructor=ae,Object.defineProperty(ae.prototype,Symbol.toStringTag,{get(){return t}}),ae[`is${t}`]=le=>!!(le&&le[fe]),ae}classIs.exports=withIs$1;classIs.exports.proto=withIsProto;var classIsExports=classIs.exports;const{Buffer}=dist$1,mh=src$5,multibase=srcExports$1,multicodec=srcExports,codecs=require$$4$2,CIDUtil=cidUtil,withIs=classIsExports;let CID$2=class Qn{constructor(t,n,ie,fe){if(_CID.isCID(t)){const ae=t;this.version=ae.version,this.codec=ae.codec,this.multihash=Buffer.from(ae.multihash),this.multibaseName=ae.multibaseName||(ae.version===0?"base58btc":"base32");return}if(typeof t=="string"){const ae=multibase.isEncoded(t);if(ae){const le=multibase.decode(t);this.version=parseInt(le.slice(0,1).toString("hex"),16),this.codec=multicodec.getCodec(le.slice(1)),this.multihash=multicodec.rmPrefix(le.slice(1)),this.multibaseName=ae}else this.version=0,this.codec="dag-pb",this.multihash=mh.fromB58String(t),this.multibaseName="base58btc";Qn.validateCID(this),Object.defineProperty(this,"string",{value:t});return}if(Buffer.isBuffer(t)){const ae=t.slice(0,1),le=parseInt(ae.toString("hex"),16);if(le===1){const pe=t;this.version=le,this.codec=multicodec.getCodec(pe.slice(1)),this.multihash=multicodec.rmPrefix(pe.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=t,this.multibaseName="base58btc";Qn.validateCID(this);return}this.version=t,this.codec=n,this.multihash=ie,this.multibaseName=fe||(t===0?"base58btc":"base32"),Qn.validateCID(this)}get buffer(){let t=this._buffer;if(!t){if(this.version===0)t=this.multihash;else if(this.version===1)t=Buffer.concat([Buffer.from("01","hex"),multicodec.getCodeVarint(this.codec),this.multihash]);else throw new Error("unsupported version");Object.defineProperty(this,"_buffer",{value:t})}return t}get prefix(){return Buffer.concat([Buffer.from(`0${this.version}`,"hex"),multicodec.getCodeVarint(this.codec),mh.prefix(this.multihash)])}toV0(){if(this.codec!=="dag-pb")throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:t,length:n}=mh.decode(this.multihash);if(t!=="sha2-256")throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(n!==32)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new _CID(0,this.codec,this.multihash)}toV1(){return new _CID(1,this.codec,this.multihash)}toBaseEncodedString(t=this.multibaseName){if(this.string&&t===this.multibaseName)return this.string;let n=null;if(this.version===0){if(t!=="base58btc")throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");n=mh.toB58String(this.multihash)}else if(this.version===1)n=multibase.encode(t,this.buffer).toString();else throw new Error("unsupported version");return t===this.multibaseName&&Object.defineProperty(this,"string",{value:n}),n}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(t){return this.toBaseEncodedString(t)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(t){return this.codec===t.codec&&this.version===t.version&&this.multihash.equals(t.multihash)}static validateCID(t){const n=CIDUtil.checkCIDComponents(t);if(n)throw new Error(n)}};const _CID=withIs(CID$2,{className:"CID",symbolName:"@ipld/js-cid/CID"});_CID.codecs=codecs;var src$1=_CID;const CID$1=src$1,multiH=src$5,hexStringToBuffer$1=c=>{let t=c.slice(0,2),n=c.slice(2),ie="";return t==="0x"?ie=n:ie=c,multiH.fromHexString(ie)},encodes={swarm:c=>{const t=multiH.encode(hexStringToBuffer$1(c),"keccak-256");return new CID$1(1,"swarm-manifest",t).buffer},ipfs:c=>{const t=multiH.fromB58String(c);return new CID$1(1,"dag-pb",t).buffer},utf8:c=>Buffer$7.from(c,"utf8")},decodes={hexMultiHash:c=>{const t=new CID$1(c);return multiH.decode(t.multihash).digest.toString("hex")},b58MultiHash:c=>{const t=new CID$1(c);return multiH.toB58String(t.multihash)},utf8:c=>c.toString("utf8")},profiles$1={"swarm-ns":{encode:encodes.swarm,decode:decodes.hexMultiHash},"ipfs-ns":{encode:encodes.ipfs,decode:decodes.b58MultiHash},"ipns-ns":{encode:encodes.ipfs,decode:decodes.b58MultiHash},default:{encode:encodes.utf8,decode:decodes.utf8}};profiles$2.hexStringToBuffer=hexStringToBuffer$1;profiles$2.profiles=profiles$1;var helpers={};const CID=src$1,cidV0ToV1Base32$1=c=>{let t=new CID(c);return t.version===0&&(t=t.toV1()),t.toString("base32")};helpers.cidV0ToV1Base32=cidV0ToV1Base32$1;const multiC=srcExports$3,{hexStringToBuffer,profiles}=profiles$2,{cidV0ToV1Base32}=helpers;var src={helpers:{cidV0ToV1Base32},decode:function(c){const t=hexStringToBuffer(c),n=multiC.getCodec(t),ie=multiC.rmPrefix(t);let fe=profiles[n];return fe||(fe=profiles.default),fe.decode(ie)},fromIpfs:function(c){return this.encode("ipfs-ns",c)},fromSwarm:function(c){return this.encode("swarm-ns",c)},encode:function(c,t){let n=profiles[c];n||(n=profiles.default);const ie=n.encode(t);return multiC.addPrefix(c,ie).toString("hex")},getCodec:function(c){let t=hexStringToBuffer(c);return multiC.getCodec(t)}},bip44Constants=[[2147483648,"BTC","Bitcoin"],[2147483649,"","Testnet (all coins)"],[2147483650,"LTC","Litecoin"],[2147483651,"DOGE","Dogecoin"],[2147483652,"RDD","Reddcoin"],[2147483653,"DASH","Dash (ex Darkcoin)"],[2147483654,"PPC","Peercoin"],[2147483655,"NMC","Namecoin"],[2147483656,"FTC","Feathercoin"],[2147483657,"XCP","Counterparty"],[2147483658,"BLK","Blackcoin"],[2147483659,"NSR","NuShares"],[2147483660,"NBT","NuBits"],[2147483661,"MZC","Mazacoin"],[2147483662,"VIA","Viacoin"],[2147483663,"XCH","ClearingHouse"],[2147483664,"RBY","Rubycoin"],[2147483665,"GRS","Groestlcoin"],[2147483666,"DGC","Digitalcoin"],[2147483667,"CCN","Cannacoin"],[2147483668,"DGB","DigiByte"],[2147483669,"","Open Assets"],[2147483670,"MONA","Monacoin"],[2147483671,"CLAM","Clams"],[2147483672,"XPM","Primecoin"],[2147483673,"NEOS","Neoscoin"],[2147483674,"JBS","Jumbucks"],[2147483675,"ZRC","ziftrCOIN"],[2147483676,"VTC","Vertcoin"],[2147483677,"NXT","NXT"],[2147483678,"BURST","Burst"],[2147483679,"MUE","MonetaryUnit"],[2147483680,"ZOOM","Zoom"],[2147483681,"VASH","Virtual Cash also known as VPNcoin"],[2147483682,"CDN","Canada eCoin"],[2147483683,"SDC","ShadowCash"],[2147483684,"PKB","ParkByte"],[2147483685,"PND","Pandacoin"],[2147483686,"START","StartCOIN"],[2147483687,"MOIN","MOIN"],[2147483688,"EXP","Expanse"],[2147483689,"EMC2","Einsteinium"],[2147483690,"DCR","Decred"],[2147483691,"XEM","NEM"],[2147483692,"PART","Particl"],[2147483693,"ARG","Argentum (dead)"],[2147483694,"","Libertas"],[2147483695,"","Posw coin"],[2147483696,"SHR","Shreeji"],[2147483697,"GCR","Global Currency Reserve (GCRcoin)"],[2147483698,"NVC","Novacoin"],[2147483699,"AC","Asiacoin"],[2147483700,"BTCD","BitcoinDark"],[2147483701,"DOPE","Dopecoin"],[2147483702,"TPC","Templecoin"],[2147483703,"AIB","AIB"],[2147483704,"EDRC","EDRCoin"],[2147483705,"SYS","Syscoin"],[2147483706,"SLR","Solarcoin"],[2147483707,"SMLY","Smileycoin"],[2147483708,"ETH","Ether"],[2147483709,"ETC","Ether Classic"],[2147483710,"PSB","Pesobit"],[2147483711,"LDCN","Landcoin (dead)"],[2147483712,"","Open Chain"],[2147483713,"XBC","Bitcoinplus"],[2147483714,"IOP","Internet of People"],[2147483715,"NXS","Nexus"],[2147483716,"INSN","InsaneCoin"],[2147483717,"OK","OKCash"],[2147483718,"BRIT","BritCoin"],[2147483719,"CMP","Compcoin"],[2147483720,"CRW","Crown"],[2147483721,"BELA","BelaCoin"],[2147483722,"ICX","ICON"],[2147483723,"FJC","FujiCoin"],[2147483724,"MIX","MIX"],[2147483725,"XVG","Verge Currency"],[2147483726,"EFL","Electronic Gulden"],[2147483727,"CLUB","ClubCoin"],[2147483728,"RICHX","RichCoin"],[2147483729,"POT","Potcoin"],[2147483730,"QRK","Quarkcoin"],[2147483731,"TRC","Terracoin"],[2147483732,"GRC","Gridcoin"],[2147483733,"AUR","Auroracoin"],[2147483734,"IXC","IXCoin"],[2147483735,"NLG","Gulden"],[2147483736,"BITB","BitBean"],[2147483737,"BTA","Bata"],[2147483738,"XMY","Myriadcoin"],[2147483739,"BSD","BitSend"],[2147483740,"UNO","Unobtanium"],[2147483741,"MTR","MasterTrader"],[2147483742,"GB","GoldBlocks"],[2147483743,"SHM","Saham"],[2147483744,"CRX","Chronos"],[2147483745,"BIQ","Ubiquoin"],[2147483746,"EVO","Evotion"],[2147483747,"STO","SaveTheOcean"],[2147483748,"BIGUP","BigUp"],[2147483749,"GAME","GameCredits"],[2147483750,"DLC","Dollarcoins"],[2147483751,"ZYD","Zayedcoin"],[2147483752,"DBIC","Dubaicoin"],[2147483753,"STRAT","Stratis"],[2147483754,"SH","Shilling"],[2147483755,"MARS","MarsCoin"],[2147483756,"UBQ","Ubiq"],[2147483757,"PTC","Pesetacoin"],[2147483758,"NRO","Neurocoin"],[2147483759,"ARK","ARK"],[2147483760,"USC","UltimateSecureCashMain"],[2147483761,"THC","Hempcoin"],[2147483762,"LINX","Linx"],[2147483763,"ECN","Ecoin"],[2147483764,"DNR","Denarius"],[2147483765,"PINK","Pinkcoin"],[2147483766,"ATOM","Atom"],[2147483767,"PIVX","Pivx"],[2147483768,"FLASH","Flashcoin"],[2147483769,"ZEN","Zencash"],[2147483770,"PUT","Putincoin"],[2147483771,"ZNY","BitZeny"],[2147483772,"UNIFY","Unify"],[2147483773,"XST","StealthCoin"],[2147483774,"BRK","Breakout Coin"],[2147483775,"VC","Vcash"],[2147483776,"XMR","Monero"],[2147483777,"VOX","Voxels"],[2147483778,"NAV","NavCoin"],[2147483779,"FCT","Factom Factoids"],[2147483780,"EC","Factom Entry Credits"],[2147483781,"ZEC","Zcash"],[2147483782,"LSK","Lisk"],[2147483783,"STEEM","Steem"],[2147483784,"XZC","ZCoin"],[2147483785,"RBTC","RSK"],[2147483786,"","Giftblock"],[2147483787,"RPT","RealPointCoin"],[2147483788,"LBC","LBRY Credits"],[2147483789,"KMD","Komodo"],[2147483790,"BSQ","bisq Token"],[2147483791,"RIC","Riecoin"],[2147483792,"XRP","Ripple"],[2147483793,"BCH","Bitcoin Cash"],[2147483794,"NEBL","Neblio"],[2147483795,"ZCL","ZClassic"],[2147483796,"XLM","Stellar Lumens"],[2147483797,"NLC2","NoLimitCoin2"],[2147483798,"WHL","WhaleCoin"],[2147483799,"ERC","EuropeCoin"],[2147483800,"DMD","Diamond"],[2147483801,"BTM","Bytom"],[2147483802,"BIO","Biocoin"],[2147483803,"XWCC","Whitecoin Classic"],[2147483804,"BTG","Bitcoin Gold"],[2147483805,"BTC2X","Bitcoin 2x"],[2147483806,"SSN","SuperSkynet"],[2147483807,"TOA","TOACoin"],[2147483808,"BTX","Bitcore"],[2147483809,"ACC","Adcoin"],[2147483810,"BCO","Bridgecoin"],[2147483811,"ELLA","Ellaism"],[2147483812,"PIRL","Pirl"],[2147483813,"NANO","Nano"],[2147483814,"VIVO","Vivo"],[2147483815,"FRST","Firstcoin"],[2147483816,"HNC","Helleniccoin"],[2147483817,"BUZZ","BUZZ"],[2147483818,"MBRS","Ember"],[2147483819,"HC","Hcash"],[2147483820,"HTML","HTMLCOIN"],[2147483821,"ODN","Obsidian"],[2147483822,"ONX","OnixCoin"],[2147483823,"RVN","Ravencoin"],[2147483824,"GBX","GoByte"],[2147483825,"BTCZ","BitcoinZ"],[2147483826,"POA","Poa"],[2147483827,"NYC","NewYorkCoin"],[2147483828,"MXT","MarteXcoin"],[2147483829,"WC","Wincoin"],[2147483830,"MNX","Minexcoin"],[2147483831,"BTCP","Bitcoin Private"],[2147483832,"MUSIC","Musicoin"],[2147483833,"BCA","Bitcoin Atom"],[2147483834,"CRAVE","Crave"],[2147483835,"STAK","STRAKS"],[2147483836,"WBTC","World Bitcoin"],[2147483837,"LCH","LiteCash"],[2147483838,"EXCL","ExclusiveCoin"],[2147483839,"","Lynx"],[2147483840,"LCC","LitecoinCash"],[2147483841,"XFE","Feirm"],[2147483842,"EOS","EOS"],[2147483843,"TRX","Tron"],[2147483844,"KOBO","Kobocoin"],[2147483845,"HUSH","HUSH"],[2147483846,"BANANO","Bananos"],[2147483847,"ETF","ETF"],[2147483848,"OMNI","Omni"],[2147483849,"BIFI","BitcoinFile"],[2147483850,"UFO","Uniform Fiscal Object"],[2147483851,"CNMC","Cryptonodes"],[2147483852,"BCN","Bytecoin"],[2147483853,"RIN","Ringo"],[2147483854,"ATP","PlatON"],[2147483855,"EVT","everiToken"],[2147483856,"ATN","ATN"],[2147483857,"BIS","Bismuth"],[2147483858,"NEET","NEETCOIN"],[2147483859,"BOPO","BopoChain"],[2147483860,"OOT","Utrum"],[2147483861,"ALIAS","Alias"],[2147483862,"MONK","Monkey Project"],[2147483863,"BOXY","BoxyCoin"],[2147483864,"FLO","Flo"],[2147483865,"MEC","Megacoin"],[2147483866,"BTDX","BitCloud"],[2147483867,"XAX","Artax"],[2147483868,"ANON","ANON"],[2147483869,"LTZ","LitecoinZ"],[2147483870,"BITG","Bitcoin Green"],[2147483871,"ICP","Internet Computer (DFINITY)"],[2147483872,"SMART","Smartcash"],[2147483873,"XUEZ","XUEZ"],[2147483874,"HLM","Helium"],[2147483875,"WEB","Webchain"],[2147483876,"ACM","Actinium"],[2147483877,"NOS","NOS Stable Coins"],[2147483878,"BITC","BitCash"],[2147483879,"HTH","Help The Homeless Coin"],[2147483880,"TZC","Trezarcoin"],[2147483881,"VAR","Varda"],[2147483882,"IOV","IOV"],[2147483883,"FIO","FIO"],[2147483884,"BSV","BitcoinSV"],[2147483885,"DXN","DEXON"],[2147483886,"QRL","Quantum Resistant Ledger"],[2147483887,"PCX","ChainX"],[2147483888,"LOKI","Loki"],[2147483889,"","Imagewallet"],[2147483890,"NIM","Nimiq"],[2147483891,"SOV","Sovereign Coin"],[2147483892,"JCT","Jibital Coin"],[2147483893,"SLP","Simple Ledger Protocol"],[2147483894,"EWT","Energy Web"],[2147483895,"UC","Ulord"],[2147483896,"EXOS","EXOS"],[2147483897,"ECA","Electra"],[2147483898,"SOOM","Soom"],[2147483899,"XRD","Redstone"],[2147483900,"FREE","FreeCoin"],[2147483901,"NPW","NewPowerCoin"],[2147483902,"BST","BlockStamp"],[2147483903,"","SmartHoldem"],[2147483904,"NANO","Bitcoin Nano"],[2147483905,"BTCC","Bitcoin Core"],[2147483906,"","Zen Protocol"],[2147483907,"ZEST","Zest"],[2147483908,"ABT","ArcBlock"],[2147483909,"PION","Pion"],[2147483910,"DT3","DreamTeam3"],[2147483911,"ZBUX","Zbux"],[2147483912,"KPL","Kepler"],[2147483913,"TPAY","TokenPay"],[2147483914,"ZILLA","ChainZilla"],[2147483915,"ANK","Anker"],[2147483916,"BCC","BCChain"],[2147483917,"HPB","HPB"],[2147483918,"ONE","ONE"],[2147483919,"SBC","SBC"],[2147483920,"IPC","IPChain"],[2147483921,"DMTC","Dominantchain"],[2147483922,"OGC","Onegram"],[2147483923,"SHIT","Shitcoin"],[2147483924,"ANDES","Andescoin"],[2147483925,"AREPA","Arepacoin"],[2147483926,"BOLI","Bolivarcoin"],[2147483927,"RIL","Rilcoin"],[2147483928,"HTR","Hathor Network"],[2147483929,"FCTID","Factom ID"],[2147483930,"BRAVO","BRAVO"],[2147483931,"ALGO","Algorand"],[2147483932,"BZX","Bitcoinzero"],[2147483933,"GXX","GravityCoin"],[2147483934,"HEAT","HEAT"],[2147483935,"XDN","DigitalNote"],[2147483936,"FSN","FUSION"],[2147483937,"CPC","Capricoin"],[2147483938,"BOLD","Bold"],[2147483939,"IOST","IOST"],[2147483940,"TKEY","Tkeycoin"],[2147483941,"USE","Usechain"],[2147483942,"BCZ","BitcoinCZ"],[2147483943,"IOC","Iocoin"],[2147483944,"ASF","Asofe"],[2147483945,"MASS","MASS"],[2147483946,"FAIR","FairCoin"],[2147483947,"NUKO","Nekonium"],[2147483948,"GNX","Genaro Network"],[2147483949,"DIVI","Divi Project"],[2147483950,"CMT","Community"],[2147483951,"EUNO","EUNO"],[2147483952,"IOTX","IoTeX"],[2147483953,"ONION","DeepOnion"],[2147483954,"8BIT","8Bit"],[2147483955,"ATC","AToken Coin"],[2147483956,"BTS","Bitshares"],[2147483957,"CKB","Nervos CKB"],[2147483958,"UGAS","Ultrain"],[2147483959,"ADS","Adshares"],[2147483960,"ARA","Aura"],[2147483961,"ZIL","Zilliqa"],[2147483962,"MOAC","MOAC"],[2147483963,"SWTC","SWTC"],[2147483964,"VNSC","vnscoin"],[2147483965,"PLUG","Pl^g"],[2147483966,"MAN","Matrix AI Network"],[2147483967,"ECC","ECCoin"],[2147483968,"RPD","Rapids"],[2147483969,"RAP","Rapture"],[2147483970,"GARD","Hashgard"],[2147483971,"ZER","Zero"],[2147483972,"EBST","eBoost"],[2147483973,"SHARD","Shard"],[2147483974,"LINDA","Linda Coin"],[2147483975,"CMM","Commercium"],[2147483976,"BLOCK","Blocknet"],[2147483977,"AUDAX","AUDAX"],[2147483978,"LUNA","Terra"],[2147483979,"ZPM","zPrime"],[2147483980,"KUVA","Kuva Utility Note"],[2147483981,"MEM","MemCoin"],[2147483982,"CS","Credits"],[2147483983,"SWIFT","SwiftCash"],[2147483984,"FIX","FIX"],[2147483985,"CPC","CPChain"],[2147483986,"VGO","VirtualGoodsToken"],[2147483987,"DVT","DeVault"],[2147483988,"N8V","N8VCoin"],[2147483989,"MTNS","OmotenashiCoin"],[2147483990,"BLAST","BLAST"],[2147483991,"DCT","DECENT"],[2147483992,"AUX","Auxilium"],[2147483993,"USDP","USDP"],[2147483994,"HTDF","HTDF"],[2147483995,"YEC","Ycash"],[2147483996,"QLC","QLC Chain"],[2147483997,"TEA","Icetea Blockchain"],[2147483998,"ARW","ArrowChain"],[2147483999,"MDM","Medium"],[2147484e3,"CYB","Cybex"],[2147484001,"LTO","LTO Network"],[2147484002,"DOT","Polkadot"],[2147484003,"AEON","Aeon"],[2147484004,"RES","Resistance"],[2147484005,"AYA","Aryacoin"],[2147484006,"DAPS","Dapscoin"],[2147484007,"CSC","CasinoCoin"],[2147484008,"VSYS","V Systems"],[2147484009,"NOLLAR","Nollar"],[2147484010,"XNOS","NOS"],[2147484011,"CPU","CPUchain"],[2147484012,"LAMB","Lambda Storage Chain"],[2147484013,"VCT","ValueCyber"],[2147484014,"CZR","Canonchain"],[2147484015,"ABBC","ABBC"],[2147484016,"HET","HET"],[2147484017,"XAS","Asch"],[2147484018,"VDL","Vidulum"],[2147484019,"MED","MediBloc"],[2147484020,"ZVC","ZVChain"],[2147484021,"VESTX","Vestx"],[2147484022,"DBT","DarkBit"],[2147484023,"SEOS","SuperEOS"],[2147484024,"MXW","Maxonrow"],[2147484025,"ZNZ","ZENZO"],[2147484026,"XCX","XChain"],[2147484027,"SOX","SonicX"],[2147484028,"NYZO","Nyzo"],[2147484029,"ULC","ULCoin"],[2147484030,"RYO","Ryo Currency"],[2147484031,"KAL","Kaleidochain"],[2147484032,"XSN","Stakenet"],[2147484033,"DOGEC","DogeCash"],[2147484034,"BMV","Bitcoin Matteo's Vision"],[2147484035,"QBC","Quebecoin"],[2147484036,"IMG","ImageCoin"],[2147484037,"QOS","QOS"],[2147484038,"PKT","PKT"],[2147484039,"LHD","LitecoinHD"],[2147484040,"CENNZ","CENNZnet"],[2147484041,"HSN","Hyper Speed Network"],[2147484042,"CRO","Crypto.com Chain"],[2147484043,"UMBRU","Umbru"],[2147484044,"TON","Free TON"],[2147484045,"NEAR","NEAR Protocol"],[2147484046,"XPC","XPChain"],[2147484047,"ZOC","01coin"],[2147484048,"NIX","NIX"],[2147484049,"UC","Utopiacoin"],[2147484050,"GALI","Galilel"],[2147484051,"OLT","Oneledger"],[2147484052,"XBI","XBI"],[2147484053,"DONU","DONU"],[2147484054,"EARTHS","Earths"],[2147484055,"HDD","HDDCash"],[2147484056,"SUGAR","Sugarchain"],[2147484057,"AILE","AileCoin"],[2147484058,"TENT","TENT"],[2147484059,"TAN","Tangerine Network"],[2147484060,"AIN","AIN"],[2147484061,"MSR","Masari"],[2147484062,"SUMO","Sumokoin"],[2147484063,"ETN","Electroneum"],[2147484064,"BYTZ","BYTZ"],[2147484065,"WOW","Wownero"],[2147484066,"XTNC","XtendCash"],[2147484067,"LTHN","Lethean"],[2147484068,"NODE","NodeHost"],[2147484069,"AGM","Argoneum"],[2147484070,"CCX","Conceal Network"],[2147484071,"TNET","Title Network"],[2147484072,"TELOS","TelosCoin"],[2147484073,"AION","Aion"],[2147484074,"BC","Bitcoin Confidential"],[2147484075,"KTV","KmushiCoin"],[2147484076,"ZCR","ZCore"],[2147484077,"ERG","Ergo"],[2147484078,"PESO","Criptopeso"],[2147484079,"BTC2","Bitcoin 2"],[2147484080,"XRPHD","XRPHD"],[2147484081,"WE","WE Coin"],[2147484082,"KSM","Kusama"],[2147484083,"PCN","Peepcoin"],[2147484084,"NCH","NetCloth"],[2147484085,"ICU","CHIPO"],[2147484086,"LN","LINK"],[2147484087,"DTP","DeVault Token Protocol"],[2147484088,"BTCR","Bitcoin Royale"],[2147484089,"AERGO","AERGO"],[2147484090,"XTH","Dothereum"],[2147484091,"LV","Lava"],[2147484092,"PHR","Phore"],[2147484093,"VITAE","Vitae"],[2147484094,"COCOS","Cocos-BCX"],[2147484095,"DIN","Dinero"],[2147484096,"SPL","Simplicity"],[2147484097,"YCE","MYCE"],[2147484098,"XLR","Solaris"],[2147484099,"KTS","Klimatas"],[2147484100,"DGLD","DGLD"],[2147484101,"XNS","Insolar"],[2147484102,"EM","EMPOW"],[2147484103,"SHN","ShineBlocks"],[2147484104,"SEELE","Seele"],[2147484105,"AE","æternity"],[2147484106,"ODX","ObsidianX"],[2147484107,"KAVA","Kava"],[2147484108,"GLEEC","GLEEC"],[2147484109,"FIL","Filecoin"],[2147484110,"RUTA","Rutanio"],[2147484111,"CSDT","CSDT"],[2147484112,"ETI","EtherInc"],[2147484113,"ZSLP","Zclassic Simple Ledger Protocol"],[2147484114,"ERE","EtherCore"],[2147484115,"DX","DxChain Token"],[2147484116,"CPS","Capricoin+"],[2147484117,"BTH","Bithereum"],[2147484118,"MESG","MESG"],[2147484119,"FIMK","FIMK"],[2147484120,"AR","Arweave"],[2147484121,"OGO","Origo"],[2147484122,"ROSE","Oasis Network"],[2147484123,"BARE","BARE Network"],[2147484124,"GLEEC","GleecBTC"],[2147484125,"CLR","Color Coin"],[2147484126,"RNG","Ring"],[2147484127,"OLO","Tool Global"],[2147484128,"PEXA","Pexa"],[2147484129,"MOON","Mooncoin"],[2147484130,"OCEAN","Ocean Protocol"],[2147484131,"BNT","Bluzelle Native"],[2147484132,"AMO","AMO Blockchain"],[2147484133,"FCH","FreeCash"],[2147484134,"LAT","LatticeX"],[2147484135,"COIN","Bitcoin Bank"],[2147484136,"VEO","Amoveo"],[2147484137,"CCA","Counos Coin"],[2147484138,"GFN","Graphene"],[2147484139,"BIP","Minter Network"],[2147484140,"KPG","Kunpeng Network"],[2147484141,"FIN","FINL Chain"],[2147484142,"BAND","Band"],[2147484143,"DROP","Dropil"],[2147484144,"BHT","Bluehelix Chain"],[2147484145,"LYRA","Scrypta"],[2147484146,"CS","Credits"],[2147484147,"RUPX","Rupaya"],[2147484148,"THETA","Theta"],[2147484149,"SOL","Solana"],[2147484150,"THT","ThoughtAI"],[2147484151,"CFX","Conflux"],[2147484152,"KUMA","Kumacoin"],[2147484153,"HASH","Provenance"],[2147484154,"CLX","CasperLabs"],[2147484155,"EARTH","EARTH"],[2147484156,"ERD","Elrond"],[2147484157,"CHI","Xaya"],[2147484158,"KOTO","Koto"],[2147484159,"OTC","θ"],[2147484160,"XRD","Radiant"],[2147484161,"SEELEN","Seele-N"],[2147484162,"AETH","AETH"],[2147484163,"DNA","Idena"],[2147484164,"VEE","Virtual Economy Era"],[2147484165,"SIERRA","SierraCoin"],[2147484166,"LET","Linkeye"],[2147484167,"BSC","Bitcoin Smart Contract"],[2147484168,"BTCV","BitcoinVIP"],[2147484169,"ABA","Dabacus"],[2147484170,"SCC","StakeCubeCoin"],[2147484171,"EDG","Edgeware"],[2147484172,"AMS","AmsterdamCoin"],[2147484173,"GOSS","GOSSIP Coin"],[2147484174,"BU","BUMO"],[2147484175,"GRAM","GRAM"],[2147484176,"YAP","Yapstone"],[2147484177,"SCRT","Secret Network"],[2147484178,"NOVO","Novo"],[2147484179,"GHOST","Ghost"],[2147484180,"HST","HST"],[2147484181,"PRJ","ProjectCoin"],[2147484182,"YOU","YOUChain"],[2147484183,"XHV","Haven Protocol"],[2147484184,"BYND","Beyondcoin"],[2147484185,"JOYS","Joys Digital"],[2147484186,"VAL","Valorbit"],[2147484187,"FLOW","Flow"],[2147484188,"SMESH","Spacemesh Coin"],[2147484189,"SCDO","SCDO"],[2147484190,"IQS","IQ-Cash"],[2147484191,"BIND","Compendia"],[2147484192,"COINEVO","Coinevo"],[2147484193,"SCRIBE","Scribe"],[2147484194,"HYN","Hyperion"],[2147484195,"BHP","BHP"],[2147484196,"BBC","BigBang Core"],[2147484197,"MKF","MarketFinance"],[2147484198,"XDC","XinFin.Network"],[2147484199,"STR","Straightedge"],[2147484200,"SUM","Sumcoin"],[2147484201,"HBC","HuobiChain"],[2147484202,"FLR","Flare Spark"],[2147484203,"BCS","Bitcoin Smart"],[2147484204,"KTS","Kratos"],[2147484205,"LKR","Lkrcoin"],[2147484206,"TAO","Tao"],[2147484207,"XWC","Whitecoin"],[2147484208,"DEAL","DEAL"],[2147484209,"NTY","Nexty"],[2147484210,"TOP","TOP NetWork"],[2147484211,"STARS","Stargaze"],[2147484212,"AG","Agoric"],[2147484213,"CICO","Coinicles"],[2147484214,"IRIS","Irisnet"],[2147484215,"NCG","Nine Chronicles"],[2147484216,"LRG","Large Coin"],[2147484217,"SERO","Super Zero Protocol"],[2147484218,"BDX","Beldex"],[2147484219,"CCXX","Counos X"],[2147484220,"SLS","Saluscoin"],[2147484221,"SRM","Serum"],[2147484222,"VLX","Velas"],[2147484223,"VIVT","VIDT Datalink"],[2147484224,"BPS","BitcoinPoS"],[2147484225,"NKN","NKN"],[2147484226,"ICL","ILCOIN"],[2147484227,"BONO","Bonorum"],[2147484228,"PLC","PLATINCOIN"],[2147484229,"DUN","Dune"],[2147484230,"DMCH","Darmacash"],[2147484231,"CTC","Creditcoin"],[2147484232,"KELP","Haidai Network"],[2147484233,"GBCR","GoldBCR"],[2147484234,"XDAG","XDAG"],[2147484235,"PRV","Incognito Privacy"],[2147484236,"SCAP","SafeCapital"],[2147484237,"TFUEL","Theta Fuel"],[2147484238,"GTM","Gentarium"],[2147484239,"RNL","RentalChain"],[2147484240,"GRIN","Grin"],[2147484241,"MWC","MimbleWimbleCoin"],[2147484242,"DOCK","[Dock][https://dock.io]"],[2147484243,"POLYX","Polymesh"],[2147484244,"DIVER","Divergenti"],[2147484245,"XEP","Electra Protocol"],[2147484246,"APN","Apron"],[2147484247,"TFC","Turbo File Coin"],[2147484248,"UTE","Unit-e"],[2147484249,"MTC","Metacoin"],[2147484250,"NC","NobodyCash"],[2147484258,"NOR","Noir"],[2147484266,"SSP","SmartShare"],[2147484273,"EAST","Eastcoin"],[2147484287,"BTSG","BitSong"],[2147484288,"LFC","Leofcoin"],[2147484311,"SFRX","EtherGem Sapphire"],[2147484314,"ACT","Achain"],[2147484315,"PRKL","Perkle"],[2147484316,"SSC","SelfSell"],[2147484317,"GC","GateChain"],[2147484326,"Voken","Voken"],[2147484328,"Evrynet","Evrynet"],[2147484334,"KAR","Karura Network"],[2147484336,"CET","CoinEx Chain"],[2147484346,"VEIL","Veil"],[2147484348,"XDAI","xDai"],[2147484359,"CHC","Chaincoin"],[2147484361,"XTL","Katal Chain"],[2147484362,"BNB","Binance"],[2147484363,"SIN","Sinovate"],[2147484373,"MCX","MultiCash"],[2147484379,"BMK","Bitmark"],[2147484395,"RAD","Centrifuge"],[2147484398,"XPRT","Persistence"],[2147484416,"BALLZ","Ballzcoin"],[2147484419,"BR","BR"],[2147484425,"BTW","Bitcoin World"],[2147484435,"ACA","Acala"],[2147484437,"TAU","Lamden"],[2147484448,"BEET","Beetle Coin"],[2147484449,"DST","DSTRA"],[2147484456,"QVT","Qvolta"],[2147484466,"VET","VeChain Token"],[2147484468,"CLO","Callisto"],[2147484479,"CRUZ","cruzbit"],[2147484500,"DSM","Desmos"],[2147484501,"PRCY","PRCY Coin"],[2147484516,"IF","Infinitefuture"],[2147484531,"ZBC","ZooBC"],[2147484534,"ADF","AD Token"],[2147484536,"NEO","NEO"],[2147484537,"TOMO","TOMO"],[2147484538,"XSEL","Seln"],[2147484547,"BCHA","BCHA"],[2147484548,"LMO","Lumeneo"],[2147484552,"","Helium"],[2147484555,"FIS","StaFi"],[2147484564,"META","Metadium"],[2147484565,"FRA","Findora"],[2147484573,"DIP","Dipper Network"],[2147484579,"RUNE","THORChain (RUNE)"],[2147484603,"LTP","LifetionCoin"],[2147484614,"MATIC","Matic"],[2147484618,"TWINS","TWINS"],[2147484636,"XAZAB","Xazab core"],[2147484637,"AIOZ","AIOZ"],[2147484644,"OKT","OKChain Token"],[2147484645,"SUM","Solidum"],[2147484646,"LBTC","Lightning Bitcoin"],[2147484647,"BCD","Bitcoin Diamond"],[2147484648,"BTN","Bitcoin New"],[2147484649,"TT","ThunderCore"],[2147484650,"BKT","BanKitt"],[2147484658,"HT","Huobi ECO Chain"],[2147484671,"ONE","HARMONY-ONE"],[2147484672,"ONT","Ontology"],[2147484674,"KEX","Kira Exchange Token"],[2147484675,"MCM","Mochimo"],[2147484680,"BTCR","BTCR"],[2147484759,"BBC","Big Bitcoin"],[2147484768,"RISE","RISE"],[2147484770,"CMT","CyberMiles Token"],[2147484776,"ETSC","Ethereum Social"],[2147484777,"DFI","DeFiChain"],[2147484785,"$DAG","Constellation Labs"],[2147484793,"CDY","Bitcoin Candy"],[2147484985,"DFC","Defcoin"],[2147485045,"HYC","Hycon"],[2147485172,"","Taler"],[2147485181,"BEAM","Beam"],[2147485264,"ELF","AELF"],[2147485266,"AUDL","AUDL"],[2147485268,"ATH","Atheios"],[2147485290,"NEW","Newton"],[2147485336,"BCX","BitcoinX"],[2147485377,"XTZ","Tezos"],[2147485424,"LBTC","Liquid BTC"],[2147485432,"JPYS","JPY Stablecoin"],[2147485463,"ADA","Cardano"],[2147485507,"TES","Teslacoin"],[2147485547,"SLPA","BCHA token"],[2147485549,"CLC","Classica"],[2147485567,"VIPS","VIPSTARCOIN"],[2147485574,"CITY","City Coin"],[2147485625,"XMX","Xuma"],[2147485632,"TRTL","TurtleCoin"],[2147485635,"EGEM","EtherGem"],[2147485637,"HODL","HOdlcoin"],[2147485638,"PHL","Placeholders"],[2147485639,"SC","Sia"],[2147485645,"POLIS","Polis"],[2147485646,"XMCC","Monoeci"],[2147485647,"COLX","ColossusXT"],[2147485648,"GIN","GinCoin"],[2147485649,"MNP","MNPCoin"],[2147485665,"KIN","Kin"],[2147485666,"EOSC","EOSClassic"],[2147485667,"GBT","GoldBean Token"],[2147485668,"PKC","PKC"],[2147485669,"SKT","Sukhavati"],[2147485696,"MCASH","MCashChain"],[2147485697,"TRUE","TrueChain"],[2147485760,"IoTE","IoTE"],[2147485869,"ASK","ASK"],[2147485949,"QTUM","QTUM"],[2147485950,"ETP","Metaverse"],[2147485951,"GXC","GXChain"],[2147485952,"CRP","CranePay"],[2147485953,"ELA","Elastos"],[2147485986,"SNOW","Snowblossom"],[2147486218,"AOA","Aurora"],[2147486542,"REOSC","REOSC Ecosystem"],[2147486651,"LUX","LUX"],[2147486678,"XHB","Hedera HBAR"],[2147486725,"COS","Contentos"],[2147487029,"DYN","Dynamic"],[2147487031,"SEQ","Sequence"],[2147487200,"DEO","Destocoin"],[2147487212,"DST","DeStream"],[2147486366,"NAS","Nebulas"],[2147486589,"BND","Blocknode"],[2147486924,"CCC","CodeChain"],[2147487025,"ROI","ROIcoin"],[2147487688,"FC8","FCH Network"],[2147487744,"YEE","YeeCo"],[2147487866,"IOTA","IOTA"],[2147487890,"AXE","Axe"],[2147487991,"XYM","Symbol"],[2147488896,"FIC","FIC"],[2147489001,"HNS","Handshake"],[2147489203,"FUND","Unification"],[2147489405,"STX","Blockstack"],[2147489568,"SLU","SILUBIUM"],[2147489708,"GO","GoChain GO"],[2147490314,"BPA","Bitcoin Pizza"],[2147490336,"SAFE","SAFE"],[2147490617,"ROGER","TheHolyrogerCoin"],[2147491425,"BTV","Bitvote"],[2147491648,"SKY","Skycoin"],[2147491865,"KLAY","KLAY"],[2147491987,"BTQ","BitcoinQuark"],[2147492092,"XCH","Chia"],[2147492536,"SBTC","Super Bitcoin"],[2147492612,"NULS","NULS"],[2147492647,"BTP","Bitcoin Pay"],[2147492648,"AVAX","Avalanche"],[2147493445,"NRG","Energi"],[2147493536,"BTF","Bitcoin Faith"],[2147493647,"GOD","Bitcoin God"],[2147493648,"FO","FIBOS"],[2147493939,"BTR","Bitcoin Rhodium"],[2147494759,"ESS","Essentia One"],[2147495993,"IPOS","IPOS"],[2147496234,"MINA","Mina"],[2147496755,"BTY","BitYuan"],[2147496756,"YCC","Yuan Chain Coin"],[2147499493,"SDGO","SanDeGo"],[2147499829,"XTX","Totem Live Network"],[2147500402,"ARDR","Ardor"],[2147502813,"SAFE","Safecoin"],[2147502815,"ZEL","ZelCash"],[2147502817,"RITO","Ritocoin"],[2147503684,"XND","ndau"],[2147506152,"PWR","PWRcoin"],[2147508900,"BELL","Bellcoin"],[2147509366,"CHX","Own"],[2147514750,"ESN","EtherSocial Network"],[2147514985,"","ThePower.io"],[2147517064,"TEO","Trust Eth reOrigin"],[2147517526,"BTCS","Bitcoin Stake"],[2147518600,"BTT","ByteTrade"],[2147521640,"FXTC","FixedTradeCoin"],[2147522969,"AMA","Amabig"],[2147532910,"EVE","evan.network"],[2147532992,"STASH","STASH"],[2147536400,"CELO","Celo"],[2147549184,"KETH","Krypton World"],[2147561425,"ZYN","Wethio"],[2147572536,"RYO","c0ban"],[2147583647,"WICC","Waykichain"],[2147588753,"STRAX","Strax"],[2147684273,"AKA","Akroma"],[2147553280,"GENOM","GENOM"],[2147730177,"ATS","ARTIS sigma1"],[2147907890,"X42","x42"],[2148150314,"VITE","Vite"],[2148372536,"SEA","Second Exchange Alliance"],[2148654985,"ILT","iOlite"],[2148796762,"ETHO","Ether-1"],[2148797148,"XERO","Xerom"],[2149195792,"LAX","LAPO"],[2151407659,"EPK","EPIK Protocol"],[2152225092,"HYD","Hydra Token"],[2152733001,"BCO","BitcoinOre"],[2152733002,"BHD","BitcoinHD"],[2152748110,"PTN","PalletOne"],[2153201998,"WAN","Wanchain"],[2153225212,"WAVES","Waves"],[2155046253,"SEM","Semux"],[2155051384,"ION","ION"],[2155308914,"WGR","WGR"],[2155308915,"OBSR","OBServer"],[2162602624,"XDS","XDS"],[2209201209,"AQUA","Aquachain"],[2236372536,"HATCH","Hatch"],[2239410657,"kUSD","kUSD"],[2247483645,"EQ","EQ"],[2247483646,"FLUID","Fluid Chains"],[2247483647,"QKC","QuarkChain"]],bn$6={exports:{}};bn$6.exports;(function(c){(function(t,n){function ie(_e,se){if(!_e)throw new Error(se||"Assertion failed")}function fe(_e,se){_e.super_=se;var ce=function(){};ce.prototype=se.prototype,_e.prototype=new ce,_e.prototype.constructor=_e}function ae(_e,se,ce){if(ae.isBN(_e))return _e;this.negative=0,this.words=null,this.length=0,this.red=null,_e!==null&&((se==="le"||se==="be")&&(ce=se,se=10),this._init(_e||0,se||10,ce||"be"))}typeof t=="object"?t.exports=ae:n.BN=ae,ae.BN=ae,ae.wordSize=26;var le;try{typeof window<"u"&&typeof window.Buffer<"u"?le=window.Buffer:le=dist$1.Buffer}catch{}ae.isBN=function(se){return se instanceof ae?!0:se!==null&&typeof se=="object"&&se.constructor.wordSize===ae.wordSize&&Array.isArray(se.words)},ae.max=function(se,ce){return se.cmp(ce)>0?se:ce},ae.min=function(se,ce){return se.cmp(ce)<0?se:ce},ae.prototype._init=function(se,ce,de){if(typeof se=="number")return this._initNumber(se,ce,de);if(typeof se=="object")return this._initArray(se,ce,de);ce==="hex"&&(ce=16),ie(ce===(ce|0)&&ce>=2&&ce<=36),se=se.toString().replace(/\s+/g,"");var he=0;se[0]==="-"&&(he++,this.negative=1),he<se.length&&(ce===16?this._parseHex(se,he,de):(this._parseBase(se,ce,he),de==="le"&&this._initArray(this.toArray(),ce,de)))},ae.prototype._initNumber=function(se,ce,de){se<0&&(this.negative=1,se=-se),se<67108864?(this.words=[se&67108863],this.length=1):se<4503599627370496?(this.words=[se&67108863,se/67108864&67108863],this.length=2):(ie(se<9007199254740992),this.words=[se&67108863,se/67108864&67108863,1],this.length=3),de==="le"&&this._initArray(this.toArray(),ce,de)},ae.prototype._initArray=function(se,ce,de){if(ie(typeof se.length=="number"),se.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(se.length/3),this.words=new Array(this.length);for(var he=0;he<this.length;he++)this.words[he]=0;var ve,we,Ae=0;if(de==="be")for(he=se.length-1,ve=0;he>=0;he-=3)we=se[he]|se[he-1]<<8|se[he-2]<<16,this.words[ve]|=we<<Ae&67108863,this.words[ve+1]=we>>>26-Ae&67108863,Ae+=24,Ae>=26&&(Ae-=26,ve++);else if(de==="le")for(he=0,ve=0;he<se.length;he+=3)we=se[he]|se[he+1]<<8|se[he+2]<<16,this.words[ve]|=we<<Ae&67108863,this.words[ve+1]=we>>>26-Ae&67108863,Ae+=24,Ae>=26&&(Ae-=26,ve++);return this.strip()};function pe(_e,se){var ce=_e.charCodeAt(se);return ce>=65&&ce<=70?ce-55:ce>=97&&ce<=102?ce-87:ce-48&15}function me(_e,se,ce){var de=pe(_e,ce);return ce-1>=se&&(de|=pe(_e,ce-1)<<4),de}ae.prototype._parseHex=function(se,ce,de){this.length=Math.ceil((se.length-ce)/6),this.words=new Array(this.length);for(var he=0;he<this.length;he++)this.words[he]=0;var ve=0,we=0,Ae;if(de==="be")for(he=se.length-1;he>=ce;he-=2)Ae=me(se,ce,he)<<ve,this.words[we]|=Ae&67108863,ve>=18?(ve-=18,we+=1,this.words[we]|=Ae>>>26):ve+=8;else{var be=se.length-ce;for(he=be%2===0?ce+1:ce;he<se.length;he+=2)Ae=me(se,ce,he)<<ve,this.words[we]|=Ae&67108863,ve>=18?(ve-=18,we+=1,this.words[we]|=Ae>>>26):ve+=8}this.strip()};function ye(_e,se,ce,de){for(var he=0,ve=Math.min(_e.length,ce),we=se;we<ve;we++){var Ae=_e.charCodeAt(we)-48;he*=de,Ae>=49?he+=Ae-49+10:Ae>=17?he+=Ae-17+10:he+=Ae}return he}ae.prototype._parseBase=function(se,ce,de){this.words=[0],this.length=1;for(var he=0,ve=1;ve<=67108863;ve*=ce)he++;he--,ve=ve/ce|0;for(var we=se.length-de,Ae=we%he,be=Math.min(we,we-Ae)+de,ue=0,ge=de;ge<be;ge+=he)ue=ye(se,ge,ge+he,ce),this.imuln(ve),this.words[0]+ue<67108864?this.words[0]+=ue:this._iaddn(ue);if(Ae!==0){var Re=1;for(ue=ye(se,ge,se.length,ce),ge=0;ge<Ae;ge++)Re*=ce;this.imuln(Re),this.words[0]+ue<67108864?this.words[0]+=ue:this._iaddn(ue)}this.strip()},ae.prototype.copy=function(se){se.words=new Array(this.length);for(var ce=0;ce<this.length;ce++)se.words[ce]=this.words[ce];se.length=this.length,se.negative=this.negative,se.red=this.red},ae.prototype.clone=function(){var se=new ae(null);return this.copy(se),se},ae.prototype._expand=function(se){for(;this.length<se;)this.words[this.length++]=0;return this},ae.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},ae.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},ae.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var xe=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Ee=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Se=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];ae.prototype.toString=function(se,ce){se=se||10,ce=ce|0||1;var de;if(se===16||se==="hex"){de="";for(var he=0,ve=0,we=0;we<this.length;we++){var Ae=this.words[we],be=((Ae<<he|ve)&16777215).toString(16);ve=Ae>>>24-he&16777215,he+=2,he>=26&&(he-=26,we--),ve!==0||we!==this.length-1?de=xe[6-be.length]+be+de:de=be+de}for(ve!==0&&(de=ve.toString(16)+de);de.length%ce!==0;)de="0"+de;return this.negative!==0&&(de="-"+de),de}if(se===(se|0)&&se>=2&&se<=36){var ue=Ee[se],ge=Se[se];de="";var Re=this.clone();for(Re.negative=0;!Re.isZero();){var Ne=Re.modn(ge).toString(se);Re=Re.idivn(ge),Re.isZero()?de=Ne+de:de=xe[ue-Ne.length]+Ne+de}for(this.isZero()&&(de="0"+de);de.length%ce!==0;)de="0"+de;return this.negative!==0&&(de="-"+de),de}ie(!1,"Base should be between 2 and 36")},ae.prototype.toNumber=function(){var se=this.words[0];return this.length===2?se+=this.words[1]*67108864:this.length===3&&this.words[2]===1?se+=4503599627370496+this.words[1]*67108864:this.length>2&&ie(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-se:se},ae.prototype.toJSON=function(){return this.toString(16)},ae.prototype.toBuffer=function(se,ce){return ie(typeof le<"u"),this.toArrayLike(le,se,ce)},ae.prototype.toArray=function(se,ce){return this.toArrayLike(Array,se,ce)},ae.prototype.toArrayLike=function(se,ce,de){var he=this.byteLength(),ve=de||Math.max(1,he);ie(he<=ve,"byte array longer than desired length"),ie(ve>0,"Requested array length <= 0"),this.strip();var we=ce==="le",Ae=new se(ve),be,ue,ge=this.clone();if(we){for(ue=0;!ge.isZero();ue++)be=ge.andln(255),ge.iushrn(8),Ae[ue]=be;for(;ue<ve;ue++)Ae[ue]=0}else{for(ue=0;ue<ve-he;ue++)Ae[ue]=0;for(ue=0;!ge.isZero();ue++)be=ge.andln(255),ge.iushrn(8),Ae[ve-ue-1]=be}return Ae},Math.clz32?ae.prototype._countBits=function(se){return 32-Math.clz32(se)}:ae.prototype._countBits=function(se){var ce=se,de=0;return ce>=4096&&(de+=13,ce>>>=13),ce>=64&&(de+=7,ce>>>=7),ce>=8&&(de+=4,ce>>>=4),ce>=2&&(de+=2,ce>>>=2),de+ce},ae.prototype._zeroBits=function(se){if(se===0)return 26;var ce=se,de=0;return ce&8191||(de+=13,ce>>>=13),ce&127||(de+=7,ce>>>=7),ce&15||(de+=4,ce>>>=4),ce&3||(de+=2,ce>>>=2),ce&1||de++,de},ae.prototype.bitLength=function(){var se=this.words[this.length-1],ce=this._countBits(se);return(this.length-1)*26+ce};function Me(_e){for(var se=new Array(_e.bitLength()),ce=0;ce<se.length;ce++){var de=ce/26|0,he=ce%26;se[ce]=(_e.words[de]&1<<he)>>>he}return se}ae.prototype.zeroBits=function(){if(this.isZero())return 0;for(var se=0,ce=0;ce<this.length;ce++){var de=this._zeroBits(this.words[ce]);if(se+=de,de!==26)break}return se},ae.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},ae.prototype.toTwos=function(se){return this.negative!==0?this.abs().inotn(se).iaddn(1):this.clone()},ae.prototype.fromTwos=function(se){return this.testn(se-1)?this.notn(se).iaddn(1).ineg():this.clone()},ae.prototype.isNeg=function(){return this.negative!==0},ae.prototype.neg=function(){return this.clone().ineg()},ae.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},ae.prototype.iuor=function(se){for(;this.length<se.length;)this.words[this.length++]=0;for(var ce=0;ce<se.length;ce++)this.words[ce]=this.words[ce]|se.words[ce];return this.strip()},ae.prototype.ior=function(se){return ie((this.negative|se.negative)===0),this.iuor(se)},ae.prototype.or=function(se){return this.length>se.length?this.clone().ior(se):se.clone().ior(this)},ae.prototype.uor=function(se){return this.length>se.length?this.clone().iuor(se):se.clone().iuor(this)},ae.prototype.iuand=function(se){var ce;this.length>se.length?ce=se:ce=this;for(var de=0;de<ce.length;de++)this.words[de]=this.words[de]&se.words[de];return this.length=ce.length,this.strip()},ae.prototype.iand=function(se){return ie((this.negative|se.negative)===0),this.iuand(se)},ae.prototype.and=function(se){return this.length>se.length?this.clone().iand(se):se.clone().iand(this)},ae.prototype.uand=function(se){return this.length>se.length?this.clone().iuand(se):se.clone().iuand(this)},ae.prototype.iuxor=function(se){var ce,de;this.length>se.length?(ce=this,de=se):(ce=se,de=this);for(var he=0;he<de.length;he++)this.words[he]=ce.words[he]^de.words[he];if(this!==ce)for(;he<ce.length;he++)this.words[he]=ce.words[he];return this.length=ce.length,this.strip()},ae.prototype.ixor=function(se){return ie((this.negative|se.negative)===0),this.iuxor(se)},ae.prototype.xor=function(se){return this.length>se.length?this.clone().ixor(se):se.clone().ixor(this)},ae.prototype.uxor=function(se){return this.length>se.length?this.clone().iuxor(se):se.clone().iuxor(this)},ae.prototype.inotn=function(se){ie(typeof se=="number"&&se>=0);var ce=Math.ceil(se/26)|0,de=se%26;this._expand(ce),de>0&&ce--;for(var he=0;he<ce;he++)this.words[he]=~this.words[he]&67108863;return de>0&&(this.words[he]=~this.words[he]&67108863>>26-de),this.strip()},ae.prototype.notn=function(se){return this.clone().inotn(se)},ae.prototype.setn=function(se,ce){ie(typeof se=="number"&&se>=0);var de=se/26|0,he=se%26;return this._expand(de+1),ce?this.words[de]=this.words[de]|1<<he:this.words[de]=this.words[de]&~(1<<he),this.strip()},ae.prototype.iadd=function(se){var ce;if(this.negative!==0&&se.negative===0)return this.negative=0,ce=this.isub(se),this.negative^=1,this._normSign();if(this.negative===0&&se.negative!==0)return se.negative=0,ce=this.isub(se),se.negative=1,ce._normSign();var de,he;this.length>se.length?(de=this,he=se):(de=se,he=this);for(var ve=0,we=0;we<he.length;we++)ce=(de.words[we]|0)+(he.words[we]|0)+ve,this.words[we]=ce&67108863,ve=ce>>>26;for(;ve!==0&&we<de.length;we++)ce=(de.words[we]|0)+ve,this.words[we]=ce&67108863,ve=ce>>>26;if(this.length=de.length,ve!==0)this.words[this.length]=ve,this.length++;else if(de!==this)for(;we<de.length;we++)this.words[we]=de.words[we];return this},ae.prototype.add=function(se){var ce;return se.negative!==0&&this.negative===0?(se.negative=0,ce=this.sub(se),se.negative^=1,ce):se.negative===0&&this.negative!==0?(this.negative=0,ce=se.sub(this),this.negative=1,ce):this.length>se.length?this.clone().iadd(se):se.clone().iadd(this)},ae.prototype.isub=function(se){if(se.negative!==0){se.negative=0;var ce=this.iadd(se);return se.negative=1,ce._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(se),this.negative=1,this._normSign();var de=this.cmp(se);if(de===0)return this.negative=0,this.length=1,this.words[0]=0,this;var he,ve;de>0?(he=this,ve=se):(he=se,ve=this);for(var we=0,Ae=0;Ae<ve.length;Ae++)ce=(he.words[Ae]|0)-(ve.words[Ae]|0)+we,we=ce>>26,this.words[Ae]=ce&67108863;for(;we!==0&&Ae<he.length;Ae++)ce=(he.words[Ae]|0)+we,we=ce>>26,this.words[Ae]=ce&67108863;if(we===0&&Ae<he.length&&he!==this)for(;Ae<he.length;Ae++)this.words[Ae]=he.words[Ae];return this.length=Math.max(this.length,Ae),he!==this&&(this.negative=1),this.strip()},ae.prototype.sub=function(se){return this.clone().isub(se)};function Be(_e,se,ce){ce.negative=se.negative^_e.negative;var de=_e.length+se.length|0;ce.length=de,de=de-1|0;var he=_e.words[0]|0,ve=se.words[0]|0,we=he*ve,Ae=we&67108863,be=we/67108864|0;ce.words[0]=Ae;for(var ue=1;ue<de;ue++){for(var ge=be>>>26,Re=be&67108863,Ne=Math.min(ue,se.length-1),qe=Math.max(0,ue-_e.length+1);qe<=Ne;qe++){var Pe=ue-qe|0;he=_e.words[Pe]|0,ve=se.words[qe]|0,we=he*ve+Re,ge+=we/67108864|0,Re=we&67108863}ce.words[ue]=Re|0,be=ge|0}return be!==0?ce.words[ue]=be|0:ce.length--,ce.strip()}var $e=function(se,ce,de){var he=se.words,ve=ce.words,we=de.words,Ae=0,be,ue,ge,Re=he[0]|0,Ne=Re&8191,qe=Re>>>13,Pe=he[1]|0,Ge=Pe&8191,Ce=Pe>>>13,De=he[2]|0,je=De&8191,Ve=De>>>13,Mt=he[3]|0,Oe=Mt&8191,We=Mt>>>13,jt=he[4]|0,Dt=jt&8191,Ht=jt>>>13,vn=he[5]|0,Vt=vn&8191,Kt=vn>>>13,En=he[6]|0,en=En&8191,Xt=En>>>13,_n=he[7]|0,Ze=_n&8191,Rt=_n>>>13,Qt=he[8]|0,Ft=Qt&8191,Wt=Qt>>>13,an=he[9]|0,Zt=an&8191,Jt=an>>>13,An=ve[0]|0,tn=An&8191,nn=An>>>13,Sn=ve[1]|0,rn=Sn&8191,dn=Sn>>>13,Mn=ve[2]|0,sn=Mn&8191,ln=Mn>>>13,Bn=ve[3]|0,un=Bn&8191,hn=Bn>>>13,Cn=ve[4]|0,yn=Cn&8191,xn=Cn>>>13,Nn=ve[5]|0,Qe=Nn&8191,Ke=Nn>>>13,Ye=ve[6]|0,Pt=Ye&8191,Gt=Ye>>>13,gn=ve[7]|0,Yt=gn&8191,cn=gn>>>13,$n=ve[8]|0,fn=$n&8191,pn=$n>>>13,Rn=ve[9]|0,mn=Rn&8191,wn=Rn>>>13;de.negative=se.negative^ce.negative,de.length=19,be=Math.imul(Ne,tn),ue=Math.imul(Ne,nn),ue=ue+Math.imul(qe,tn)|0,ge=Math.imul(qe,nn);var kn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(kn>>>26)|0,kn&=67108863,be=Math.imul(Ge,tn),ue=Math.imul(Ge,nn),ue=ue+Math.imul(Ce,tn)|0,ge=Math.imul(Ce,nn),be=be+Math.imul(Ne,rn)|0,ue=ue+Math.imul(Ne,dn)|0,ue=ue+Math.imul(qe,rn)|0,ge=ge+Math.imul(qe,dn)|0;var Tn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,be=Math.imul(je,tn),ue=Math.imul(je,nn),ue=ue+Math.imul(Ve,tn)|0,ge=Math.imul(Ve,nn),be=be+Math.imul(Ge,rn)|0,ue=ue+Math.imul(Ge,dn)|0,ue=ue+Math.imul(Ce,rn)|0,ge=ge+Math.imul(Ce,dn)|0,be=be+Math.imul(Ne,sn)|0,ue=ue+Math.imul(Ne,ln)|0,ue=ue+Math.imul(qe,sn)|0,ge=ge+Math.imul(qe,ln)|0;var In=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(In>>>26)|0,In&=67108863,be=Math.imul(Oe,tn),ue=Math.imul(Oe,nn),ue=ue+Math.imul(We,tn)|0,ge=Math.imul(We,nn),be=be+Math.imul(je,rn)|0,ue=ue+Math.imul(je,dn)|0,ue=ue+Math.imul(Ve,rn)|0,ge=ge+Math.imul(Ve,dn)|0,be=be+Math.imul(Ge,sn)|0,ue=ue+Math.imul(Ge,ln)|0,ue=ue+Math.imul(Ce,sn)|0,ge=ge+Math.imul(Ce,ln)|0,be=be+Math.imul(Ne,un)|0,ue=ue+Math.imul(Ne,hn)|0,ue=ue+Math.imul(qe,un)|0,ge=ge+Math.imul(qe,hn)|0;var Pn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,be=Math.imul(Dt,tn),ue=Math.imul(Dt,nn),ue=ue+Math.imul(Ht,tn)|0,ge=Math.imul(Ht,nn),be=be+Math.imul(Oe,rn)|0,ue=ue+Math.imul(Oe,dn)|0,ue=ue+Math.imul(We,rn)|0,ge=ge+Math.imul(We,dn)|0,be=be+Math.imul(je,sn)|0,ue=ue+Math.imul(je,ln)|0,ue=ue+Math.imul(Ve,sn)|0,ge=ge+Math.imul(Ve,ln)|0,be=be+Math.imul(Ge,un)|0,ue=ue+Math.imul(Ge,hn)|0,ue=ue+Math.imul(Ce,un)|0,ge=ge+Math.imul(Ce,hn)|0,be=be+Math.imul(Ne,yn)|0,ue=ue+Math.imul(Ne,xn)|0,ue=ue+Math.imul(qe,yn)|0,ge=ge+Math.imul(qe,xn)|0;var On=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(On>>>26)|0,On&=67108863,be=Math.imul(Vt,tn),ue=Math.imul(Vt,nn),ue=ue+Math.imul(Kt,tn)|0,ge=Math.imul(Kt,nn),be=be+Math.imul(Dt,rn)|0,ue=ue+Math.imul(Dt,dn)|0,ue=ue+Math.imul(Ht,rn)|0,ge=ge+Math.imul(Ht,dn)|0,be=be+Math.imul(Oe,sn)|0,ue=ue+Math.imul(Oe,ln)|0,ue=ue+Math.imul(We,sn)|0,ge=ge+Math.imul(We,ln)|0,be=be+Math.imul(je,un)|0,ue=ue+Math.imul(je,hn)|0,ue=ue+Math.imul(Ve,un)|0,ge=ge+Math.imul(Ve,hn)|0,be=be+Math.imul(Ge,yn)|0,ue=ue+Math.imul(Ge,xn)|0,ue=ue+Math.imul(Ce,yn)|0,ge=ge+Math.imul(Ce,xn)|0,be=be+Math.imul(Ne,Qe)|0,ue=ue+Math.imul(Ne,Ke)|0,ue=ue+Math.imul(qe,Qe)|0,ge=ge+Math.imul(qe,Ke)|0;var Dn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,be=Math.imul(en,tn),ue=Math.imul(en,nn),ue=ue+Math.imul(Xt,tn)|0,ge=Math.imul(Xt,nn),be=be+Math.imul(Vt,rn)|0,ue=ue+Math.imul(Vt,dn)|0,ue=ue+Math.imul(Kt,rn)|0,ge=ge+Math.imul(Kt,dn)|0,be=be+Math.imul(Dt,sn)|0,ue=ue+Math.imul(Dt,ln)|0,ue=ue+Math.imul(Ht,sn)|0,ge=ge+Math.imul(Ht,ln)|0,be=be+Math.imul(Oe,un)|0,ue=ue+Math.imul(Oe,hn)|0,ue=ue+Math.imul(We,un)|0,ge=ge+Math.imul(We,hn)|0,be=be+Math.imul(je,yn)|0,ue=ue+Math.imul(je,xn)|0,ue=ue+Math.imul(Ve,yn)|0,ge=ge+Math.imul(Ve,xn)|0,be=be+Math.imul(Ge,Qe)|0,ue=ue+Math.imul(Ge,Ke)|0,ue=ue+Math.imul(Ce,Qe)|0,ge=ge+Math.imul(Ce,Ke)|0,be=be+Math.imul(Ne,Pt)|0,ue=ue+Math.imul(Ne,Gt)|0,ue=ue+Math.imul(qe,Pt)|0,ge=ge+Math.imul(qe,Gt)|0;var Ln=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,be=Math.imul(Ze,tn),ue=Math.imul(Ze,nn),ue=ue+Math.imul(Rt,tn)|0,ge=Math.imul(Rt,nn),be=be+Math.imul(en,rn)|0,ue=ue+Math.imul(en,dn)|0,ue=ue+Math.imul(Xt,rn)|0,ge=ge+Math.imul(Xt,dn)|0,be=be+Math.imul(Vt,sn)|0,ue=ue+Math.imul(Vt,ln)|0,ue=ue+Math.imul(Kt,sn)|0,ge=ge+Math.imul(Kt,ln)|0,be=be+Math.imul(Dt,un)|0,ue=ue+Math.imul(Dt,hn)|0,ue=ue+Math.imul(Ht,un)|0,ge=ge+Math.imul(Ht,hn)|0,be=be+Math.imul(Oe,yn)|0,ue=ue+Math.imul(Oe,xn)|0,ue=ue+Math.imul(We,yn)|0,ge=ge+Math.imul(We,xn)|0,be=be+Math.imul(je,Qe)|0,ue=ue+Math.imul(je,Ke)|0,ue=ue+Math.imul(Ve,Qe)|0,ge=ge+Math.imul(Ve,Ke)|0,be=be+Math.imul(Ge,Pt)|0,ue=ue+Math.imul(Ge,Gt)|0,ue=ue+Math.imul(Ce,Pt)|0,ge=ge+Math.imul(Ce,Gt)|0,be=be+Math.imul(Ne,Yt)|0,ue=ue+Math.imul(Ne,cn)|0,ue=ue+Math.imul(qe,Yt)|0,ge=ge+Math.imul(qe,cn)|0;var Fn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,be=Math.imul(Ft,tn),ue=Math.imul(Ft,nn),ue=ue+Math.imul(Wt,tn)|0,ge=Math.imul(Wt,nn),be=be+Math.imul(Ze,rn)|0,ue=ue+Math.imul(Ze,dn)|0,ue=ue+Math.imul(Rt,rn)|0,ge=ge+Math.imul(Rt,dn)|0,be=be+Math.imul(en,sn)|0,ue=ue+Math.imul(en,ln)|0,ue=ue+Math.imul(Xt,sn)|0,ge=ge+Math.imul(Xt,ln)|0,be=be+Math.imul(Vt,un)|0,ue=ue+Math.imul(Vt,hn)|0,ue=ue+Math.imul(Kt,un)|0,ge=ge+Math.imul(Kt,hn)|0,be=be+Math.imul(Dt,yn)|0,ue=ue+Math.imul(Dt,xn)|0,ue=ue+Math.imul(Ht,yn)|0,ge=ge+Math.imul(Ht,xn)|0,be=be+Math.imul(Oe,Qe)|0,ue=ue+Math.imul(Oe,Ke)|0,ue=ue+Math.imul(We,Qe)|0,ge=ge+Math.imul(We,Ke)|0,be=be+Math.imul(je,Pt)|0,ue=ue+Math.imul(je,Gt)|0,ue=ue+Math.imul(Ve,Pt)|0,ge=ge+Math.imul(Ve,Gt)|0,be=be+Math.imul(Ge,Yt)|0,ue=ue+Math.imul(Ge,cn)|0,ue=ue+Math.imul(Ce,Yt)|0,ge=ge+Math.imul(Ce,cn)|0,be=be+Math.imul(Ne,fn)|0,ue=ue+Math.imul(Ne,pn)|0,ue=ue+Math.imul(qe,fn)|0,ge=ge+Math.imul(qe,pn)|0;var qn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(qn>>>26)|0,qn&=67108863,be=Math.imul(Zt,tn),ue=Math.imul(Zt,nn),ue=ue+Math.imul(Jt,tn)|0,ge=Math.imul(Jt,nn),be=be+Math.imul(Ft,rn)|0,ue=ue+Math.imul(Ft,dn)|0,ue=ue+Math.imul(Wt,rn)|0,ge=ge+Math.imul(Wt,dn)|0,be=be+Math.imul(Ze,sn)|0,ue=ue+Math.imul(Ze,ln)|0,ue=ue+Math.imul(Rt,sn)|0,ge=ge+Math.imul(Rt,ln)|0,be=be+Math.imul(en,un)|0,ue=ue+Math.imul(en,hn)|0,ue=ue+Math.imul(Xt,un)|0,ge=ge+Math.imul(Xt,hn)|0,be=be+Math.imul(Vt,yn)|0,ue=ue+Math.imul(Vt,xn)|0,ue=ue+Math.imul(Kt,yn)|0,ge=ge+Math.imul(Kt,xn)|0,be=be+Math.imul(Dt,Qe)|0,ue=ue+Math.imul(Dt,Ke)|0,ue=ue+Math.imul(Ht,Qe)|0,ge=ge+Math.imul(Ht,Ke)|0,be=be+Math.imul(Oe,Pt)|0,ue=ue+Math.imul(Oe,Gt)|0,ue=ue+Math.imul(We,Pt)|0,ge=ge+Math.imul(We,Gt)|0,be=be+Math.imul(je,Yt)|0,ue=ue+Math.imul(je,cn)|0,ue=ue+Math.imul(Ve,Yt)|0,ge=ge+Math.imul(Ve,cn)|0,be=be+Math.imul(Ge,fn)|0,ue=ue+Math.imul(Ge,pn)|0,ue=ue+Math.imul(Ce,fn)|0,ge=ge+Math.imul(Ce,pn)|0,be=be+Math.imul(Ne,mn)|0,ue=ue+Math.imul(Ne,wn)|0,ue=ue+Math.imul(qe,mn)|0,ge=ge+Math.imul(qe,wn)|0;var Un=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Un>>>26)|0,Un&=67108863,be=Math.imul(Zt,rn),ue=Math.imul(Zt,dn),ue=ue+Math.imul(Jt,rn)|0,ge=Math.imul(Jt,dn),be=be+Math.imul(Ft,sn)|0,ue=ue+Math.imul(Ft,ln)|0,ue=ue+Math.imul(Wt,sn)|0,ge=ge+Math.imul(Wt,ln)|0,be=be+Math.imul(Ze,un)|0,ue=ue+Math.imul(Ze,hn)|0,ue=ue+Math.imul(Rt,un)|0,ge=ge+Math.imul(Rt,hn)|0,be=be+Math.imul(en,yn)|0,ue=ue+Math.imul(en,xn)|0,ue=ue+Math.imul(Xt,yn)|0,ge=ge+Math.imul(Xt,xn)|0,be=be+Math.imul(Vt,Qe)|0,ue=ue+Math.imul(Vt,Ke)|0,ue=ue+Math.imul(Kt,Qe)|0,ge=ge+Math.imul(Kt,Ke)|0,be=be+Math.imul(Dt,Pt)|0,ue=ue+Math.imul(Dt,Gt)|0,ue=ue+Math.imul(Ht,Pt)|0,ge=ge+Math.imul(Ht,Gt)|0,be=be+Math.imul(Oe,Yt)|0,ue=ue+Math.imul(Oe,cn)|0,ue=ue+Math.imul(We,Yt)|0,ge=ge+Math.imul(We,cn)|0,be=be+Math.imul(je,fn)|0,ue=ue+Math.imul(je,pn)|0,ue=ue+Math.imul(Ve,fn)|0,ge=ge+Math.imul(Ve,pn)|0,be=be+Math.imul(Ge,mn)|0,ue=ue+Math.imul(Ge,wn)|0,ue=ue+Math.imul(Ce,mn)|0,ge=ge+Math.imul(Ce,wn)|0;var Kn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Kn>>>26)|0,Kn&=67108863,be=Math.imul(Zt,sn),ue=Math.imul(Zt,ln),ue=ue+Math.imul(Jt,sn)|0,ge=Math.imul(Jt,ln),be=be+Math.imul(Ft,un)|0,ue=ue+Math.imul(Ft,hn)|0,ue=ue+Math.imul(Wt,un)|0,ge=ge+Math.imul(Wt,hn)|0,be=be+Math.imul(Ze,yn)|0,ue=ue+Math.imul(Ze,xn)|0,ue=ue+Math.imul(Rt,yn)|0,ge=ge+Math.imul(Rt,xn)|0,be=be+Math.imul(en,Qe)|0,ue=ue+Math.imul(en,Ke)|0,ue=ue+Math.imul(Xt,Qe)|0,ge=ge+Math.imul(Xt,Ke)|0,be=be+Math.imul(Vt,Pt)|0,ue=ue+Math.imul(Vt,Gt)|0,ue=ue+Math.imul(Kt,Pt)|0,ge=ge+Math.imul(Kt,Gt)|0,be=be+Math.imul(Dt,Yt)|0,ue=ue+Math.imul(Dt,cn)|0,ue=ue+Math.imul(Ht,Yt)|0,ge=ge+Math.imul(Ht,cn)|0,be=be+Math.imul(Oe,fn)|0,ue=ue+Math.imul(Oe,pn)|0,ue=ue+Math.imul(We,fn)|0,ge=ge+Math.imul(We,pn)|0,be=be+Math.imul(je,mn)|0,ue=ue+Math.imul(je,wn)|0,ue=ue+Math.imul(Ve,mn)|0,ge=ge+Math.imul(Ve,wn)|0;var Hn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,be=Math.imul(Zt,un),ue=Math.imul(Zt,hn),ue=ue+Math.imul(Jt,un)|0,ge=Math.imul(Jt,hn),be=be+Math.imul(Ft,yn)|0,ue=ue+Math.imul(Ft,xn)|0,ue=ue+Math.imul(Wt,yn)|0,ge=ge+Math.imul(Wt,xn)|0,be=be+Math.imul(Ze,Qe)|0,ue=ue+Math.imul(Ze,Ke)|0,ue=ue+Math.imul(Rt,Qe)|0,ge=ge+Math.imul(Rt,Ke)|0,be=be+Math.imul(en,Pt)|0,ue=ue+Math.imul(en,Gt)|0,ue=ue+Math.imul(Xt,Pt)|0,ge=ge+Math.imul(Xt,Gt)|0,be=be+Math.imul(Vt,Yt)|0,ue=ue+Math.imul(Vt,cn)|0,ue=ue+Math.imul(Kt,Yt)|0,ge=ge+Math.imul(Kt,cn)|0,be=be+Math.imul(Dt,fn)|0,ue=ue+Math.imul(Dt,pn)|0,ue=ue+Math.imul(Ht,fn)|0,ge=ge+Math.imul(Ht,pn)|0,be=be+Math.imul(Oe,mn)|0,ue=ue+Math.imul(Oe,wn)|0,ue=ue+Math.imul(We,mn)|0,ge=ge+Math.imul(We,wn)|0;var jn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(jn>>>26)|0,jn&=67108863,be=Math.imul(Zt,yn),ue=Math.imul(Zt,xn),ue=ue+Math.imul(Jt,yn)|0,ge=Math.imul(Jt,xn),be=be+Math.imul(Ft,Qe)|0,ue=ue+Math.imul(Ft,Ke)|0,ue=ue+Math.imul(Wt,Qe)|0,ge=ge+Math.imul(Wt,Ke)|0,be=be+Math.imul(Ze,Pt)|0,ue=ue+Math.imul(Ze,Gt)|0,ue=ue+Math.imul(Rt,Pt)|0,ge=ge+Math.imul(Rt,Gt)|0,be=be+Math.imul(en,Yt)|0,ue=ue+Math.imul(en,cn)|0,ue=ue+Math.imul(Xt,Yt)|0,ge=ge+Math.imul(Xt,cn)|0,be=be+Math.imul(Vt,fn)|0,ue=ue+Math.imul(Vt,pn)|0,ue=ue+Math.imul(Kt,fn)|0,ge=ge+Math.imul(Kt,pn)|0,be=be+Math.imul(Dt,mn)|0,ue=ue+Math.imul(Dt,wn)|0,ue=ue+Math.imul(Ht,mn)|0,ge=ge+Math.imul(Ht,wn)|0;var zn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(zn>>>26)|0,zn&=67108863,be=Math.imul(Zt,Qe),ue=Math.imul(Zt,Ke),ue=ue+Math.imul(Jt,Qe)|0,ge=Math.imul(Jt,Ke),be=be+Math.imul(Ft,Pt)|0,ue=ue+Math.imul(Ft,Gt)|0,ue=ue+Math.imul(Wt,Pt)|0,ge=ge+Math.imul(Wt,Gt)|0,be=be+Math.imul(Ze,Yt)|0,ue=ue+Math.imul(Ze,cn)|0,ue=ue+Math.imul(Rt,Yt)|0,ge=ge+Math.imul(Rt,cn)|0,be=be+Math.imul(en,fn)|0,ue=ue+Math.imul(en,pn)|0,ue=ue+Math.imul(Xt,fn)|0,ge=ge+Math.imul(Xt,pn)|0,be=be+Math.imul(Vt,mn)|0,ue=ue+Math.imul(Vt,wn)|0,ue=ue+Math.imul(Kt,mn)|0,ge=ge+Math.imul(Kt,wn)|0;var Gn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,be=Math.imul(Zt,Pt),ue=Math.imul(Zt,Gt),ue=ue+Math.imul(Jt,Pt)|0,ge=Math.imul(Jt,Gt),be=be+Math.imul(Ft,Yt)|0,ue=ue+Math.imul(Ft,cn)|0,ue=ue+Math.imul(Wt,Yt)|0,ge=ge+Math.imul(Wt,cn)|0,be=be+Math.imul(Ze,fn)|0,ue=ue+Math.imul(Ze,pn)|0,ue=ue+Math.imul(Rt,fn)|0,ge=ge+Math.imul(Rt,pn)|0,be=be+Math.imul(en,mn)|0,ue=ue+Math.imul(en,wn)|0,ue=ue+Math.imul(Xt,mn)|0,ge=ge+Math.imul(Xt,wn)|0;var Wn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,be=Math.imul(Zt,Yt),ue=Math.imul(Zt,cn),ue=ue+Math.imul(Jt,Yt)|0,ge=Math.imul(Jt,cn),be=be+Math.imul(Ft,fn)|0,ue=ue+Math.imul(Ft,pn)|0,ue=ue+Math.imul(Wt,fn)|0,ge=ge+Math.imul(Wt,pn)|0,be=be+Math.imul(Ze,mn)|0,ue=ue+Math.imul(Ze,wn)|0,ue=ue+Math.imul(Rt,mn)|0,ge=ge+Math.imul(Rt,wn)|0;var Vn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,be=Math.imul(Zt,fn),ue=Math.imul(Zt,pn),ue=ue+Math.imul(Jt,fn)|0,ge=Math.imul(Jt,pn),be=be+Math.imul(Ft,mn)|0,ue=ue+Math.imul(Ft,wn)|0,ue=ue+Math.imul(Wt,mn)|0,ge=ge+Math.imul(Wt,wn)|0;var Zn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,be=Math.imul(Zt,mn),ue=Math.imul(Zt,wn),ue=ue+Math.imul(Jt,mn)|0,ge=Math.imul(Jt,wn);var Jn=(Ae+be|0)+((ue&8191)<<13)|0;return Ae=(ge+(ue>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,we[0]=kn,we[1]=Tn,we[2]=In,we[3]=Pn,we[4]=On,we[5]=Dn,we[6]=Ln,we[7]=Fn,we[8]=qn,we[9]=Un,we[10]=Kn,we[11]=Hn,we[12]=jn,we[13]=zn,we[14]=Gn,we[15]=Wn,we[16]=Vn,we[17]=Zn,we[18]=Jn,Ae!==0&&(we[19]=Ae,de.length++),de};Math.imul||($e=Be);function ke(_e,se,ce){ce.negative=se.negative^_e.negative,ce.length=_e.length+se.length;for(var de=0,he=0,ve=0;ve<ce.length-1;ve++){var we=he;he=0;for(var Ae=de&67108863,be=Math.min(ve,se.length-1),ue=Math.max(0,ve-_e.length+1);ue<=be;ue++){var ge=ve-ue,Re=_e.words[ge]|0,Ne=se.words[ue]|0,qe=Re*Ne,Pe=qe&67108863;we=we+(qe/67108864|0)|0,Pe=Pe+Ae|0,Ae=Pe&67108863,we=we+(Pe>>>26)|0,he+=we>>>26,we&=67108863}ce.words[ve]=Ae,de=we,we=he}return de!==0?ce.words[ve]=de:ce.length--,ce.strip()}function Te(_e,se,ce){var de=new Ie;return de.mulp(_e,se,ce)}ae.prototype.mulTo=function(se,ce){var de,he=this.length+se.length;return this.length===10&&se.length===10?de=$e(this,se,ce):he<63?de=Be(this,se,ce):he<1024?de=ke(this,se,ce):de=Te(this,se,ce),de};function Ie(_e,se){this.x=_e,this.y=se}Ie.prototype.makeRBT=function(se){for(var ce=new Array(se),de=ae.prototype._countBits(se)-1,he=0;he<se;he++)ce[he]=this.revBin(he,de,se);return ce},Ie.prototype.revBin=function(se,ce,de){if(se===0||se===de-1)return se;for(var he=0,ve=0;ve<ce;ve++)he|=(se&1)<<ce-ve-1,se>>=1;return he},Ie.prototype.permute=function(se,ce,de,he,ve,we){for(var Ae=0;Ae<we;Ae++)he[Ae]=ce[se[Ae]],ve[Ae]=de[se[Ae]]},Ie.prototype.transform=function(se,ce,de,he,ve,we){this.permute(we,se,ce,de,he,ve);for(var Ae=1;Ae<ve;Ae<<=1)for(var be=Ae<<1,ue=Math.cos(2*Math.PI/be),ge=Math.sin(2*Math.PI/be),Re=0;Re<ve;Re+=be)for(var Ne=ue,qe=ge,Pe=0;Pe<Ae;Pe++){var Ge=de[Re+Pe],Ce=he[Re+Pe],De=de[Re+Pe+Ae],je=he[Re+Pe+Ae],Ve=Ne*De-qe*je;je=Ne*je+qe*De,De=Ve,de[Re+Pe]=Ge+De,he[Re+Pe]=Ce+je,de[Re+Pe+Ae]=Ge-De,he[Re+Pe+Ae]=Ce-je,Pe!==be&&(Ve=ue*Ne-ge*qe,qe=ue*qe+ge*Ne,Ne=Ve)}},Ie.prototype.guessLen13b=function(se,ce){var de=Math.max(ce,se)|1,he=de&1,ve=0;for(de=de/2|0;de;de=de>>>1)ve++;return 1<<ve+1+he},Ie.prototype.conjugate=function(se,ce,de){if(!(de<=1))for(var he=0;he<de/2;he++){var ve=se[he];se[he]=se[de-he-1],se[de-he-1]=ve,ve=ce[he],ce[he]=-ce[de-he-1],ce[de-he-1]=-ve}},Ie.prototype.normalize13b=function(se,ce){for(var de=0,he=0;he<ce/2;he++){var ve=Math.round(se[2*he+1]/ce)*8192+Math.round(se[2*he]/ce)+de;se[he]=ve&67108863,ve<67108864?de=0:de=ve/67108864|0}return se},Ie.prototype.convert13b=function(se,ce,de,he){for(var ve=0,we=0;we<ce;we++)ve=ve+(se[we]|0),de[2*we]=ve&8191,ve=ve>>>13,de[2*we+1]=ve&8191,ve=ve>>>13;for(we=2*ce;we<he;++we)de[we]=0;ie(ve===0),ie((ve&-8192)===0)},Ie.prototype.stub=function(se){for(var ce=new Array(se),de=0;de<se;de++)ce[de]=0;return ce},Ie.prototype.mulp=function(se,ce,de){var he=2*this.guessLen13b(se.length,ce.length),ve=this.makeRBT(he),we=this.stub(he),Ae=new Array(he),be=new Array(he),ue=new Array(he),ge=new Array(he),Re=new Array(he),Ne=new Array(he),qe=de.words;qe.length=he,this.convert13b(se.words,se.length,Ae,he),this.convert13b(ce.words,ce.length,ge,he),this.transform(Ae,we,be,ue,he,ve),this.transform(ge,we,Re,Ne,he,ve);for(var Pe=0;Pe<he;Pe++){var Ge=be[Pe]*Re[Pe]-ue[Pe]*Ne[Pe];ue[Pe]=be[Pe]*Ne[Pe]+ue[Pe]*Re[Pe],be[Pe]=Ge}return this.conjugate(be,ue,he),this.transform(be,ue,qe,we,he,ve),this.conjugate(qe,we,he),this.normalize13b(qe,he),de.negative=se.negative^ce.negative,de.length=se.length+ce.length,de.strip()},ae.prototype.mul=function(se){var ce=new ae(null);return ce.words=new Array(this.length+se.length),this.mulTo(se,ce)},ae.prototype.mulf=function(se){var ce=new ae(null);return ce.words=new Array(this.length+se.length),Te(this,se,ce)},ae.prototype.imul=function(se){return this.clone().mulTo(se,this)},ae.prototype.imuln=function(se){ie(typeof se=="number"),ie(se<67108864);for(var ce=0,de=0;de<this.length;de++){var he=(this.words[de]|0)*se,ve=(he&67108863)+(ce&67108863);ce>>=26,ce+=he/67108864|0,ce+=ve>>>26,this.words[de]=ve&67108863}return ce!==0&&(this.words[de]=ce,this.length++),this.length=se===0?1:this.length,this},ae.prototype.muln=function(se){return this.clone().imuln(se)},ae.prototype.sqr=function(){return this.mul(this)},ae.prototype.isqr=function(){return this.imul(this.clone())},ae.prototype.pow=function(se){var ce=Me(se);if(ce.length===0)return new ae(1);for(var de=this,he=0;he<ce.length&&ce[he]===0;he++,de=de.sqr());if(++he<ce.length)for(var ve=de.sqr();he<ce.length;he++,ve=ve.sqr())ce[he]!==0&&(de=de.mul(ve));return de},ae.prototype.iushln=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26,he=67108863>>>26-ce<<26-ce,ve;if(ce!==0){var we=0;for(ve=0;ve<this.length;ve++){var Ae=this.words[ve]&he,be=(this.words[ve]|0)-Ae<<ce;this.words[ve]=be|we,we=Ae>>>26-ce}we&&(this.words[ve]=we,this.length++)}if(de!==0){for(ve=this.length-1;ve>=0;ve--)this.words[ve+de]=this.words[ve];for(ve=0;ve<de;ve++)this.words[ve]=0;this.length+=de}return this.strip()},ae.prototype.ishln=function(se){return ie(this.negative===0),this.iushln(se)},ae.prototype.iushrn=function(se,ce,de){ie(typeof se=="number"&&se>=0);var he;ce?he=(ce-ce%26)/26:he=0;var ve=se%26,we=Math.min((se-ve)/26,this.length),Ae=67108863^67108863>>>ve<<ve,be=de;if(he-=we,he=Math.max(0,he),be){for(var ue=0;ue<we;ue++)be.words[ue]=this.words[ue];be.length=we}if(we!==0)if(this.length>we)for(this.length-=we,ue=0;ue<this.length;ue++)this.words[ue]=this.words[ue+we];else this.words[0]=0,this.length=1;var ge=0;for(ue=this.length-1;ue>=0&&(ge!==0||ue>=he);ue--){var Re=this.words[ue]|0;this.words[ue]=ge<<26-ve|Re>>>ve,ge=Re&Ae}return be&&ge!==0&&(be.words[be.length++]=ge),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},ae.prototype.ishrn=function(se,ce,de){return ie(this.negative===0),this.iushrn(se,ce,de)},ae.prototype.shln=function(se){return this.clone().ishln(se)},ae.prototype.ushln=function(se){return this.clone().iushln(se)},ae.prototype.shrn=function(se){return this.clone().ishrn(se)},ae.prototype.ushrn=function(se){return this.clone().iushrn(se)},ae.prototype.testn=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26,he=1<<ce;if(this.length<=de)return!1;var ve=this.words[de];return!!(ve&he)},ae.prototype.imaskn=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26;if(ie(this.negative===0,"imaskn works only with positive numbers"),this.length<=de)return this;if(ce!==0&&de++,this.length=Math.min(de,this.length),ce!==0){var he=67108863^67108863>>>ce<<ce;this.words[this.length-1]&=he}return this.strip()},ae.prototype.maskn=function(se){return this.clone().imaskn(se)},ae.prototype.iaddn=function(se){return ie(typeof se=="number"),ie(se<67108864),se<0?this.isubn(-se):this.negative!==0?this.length===1&&(this.words[0]|0)<se?(this.words[0]=se-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(se),this.negative=1,this):this._iaddn(se)},ae.prototype._iaddn=function(se){this.words[0]+=se;for(var ce=0;ce<this.length&&this.words[ce]>=67108864;ce++)this.words[ce]-=67108864,ce===this.length-1?this.words[ce+1]=1:this.words[ce+1]++;return this.length=Math.max(this.length,ce+1),this},ae.prototype.isubn=function(se){if(ie(typeof se=="number"),ie(se<67108864),se<0)return this.iaddn(-se);if(this.negative!==0)return this.negative=0,this.iaddn(se),this.negative=1,this;if(this.words[0]-=se,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var ce=0;ce<this.length&&this.words[ce]<0;ce++)this.words[ce]+=67108864,this.words[ce+1]-=1;return this.strip()},ae.prototype.addn=function(se){return this.clone().iaddn(se)},ae.prototype.subn=function(se){return this.clone().isubn(se)},ae.prototype.iabs=function(){return this.negative=0,this},ae.prototype.abs=function(){return this.clone().iabs()},ae.prototype._ishlnsubmul=function(se,ce,de){var he=se.length+de,ve;this._expand(he);var we,Ae=0;for(ve=0;ve<se.length;ve++){we=(this.words[ve+de]|0)+Ae;var be=(se.words[ve]|0)*ce;we-=be&67108863,Ae=(we>>26)-(be/67108864|0),this.words[ve+de]=we&67108863}for(;ve<this.length-de;ve++)we=(this.words[ve+de]|0)+Ae,Ae=we>>26,this.words[ve+de]=we&67108863;if(Ae===0)return this.strip();for(ie(Ae===-1),Ae=0,ve=0;ve<this.length;ve++)we=-(this.words[ve]|0)+Ae,Ae=we>>26,this.words[ve]=we&67108863;return this.negative=1,this.strip()},ae.prototype._wordDiv=function(se,ce){var de=this.length-se.length,he=this.clone(),ve=se,we=ve.words[ve.length-1]|0,Ae=this._countBits(we);de=26-Ae,de!==0&&(ve=ve.ushln(de),he.iushln(de),we=ve.words[ve.length-1]|0);var be=he.length-ve.length,ue;if(ce!=="mod"){ue=new ae(null),ue.length=be+1,ue.words=new Array(ue.length);for(var ge=0;ge<ue.length;ge++)ue.words[ge]=0}var Re=he.clone()._ishlnsubmul(ve,1,be);Re.negative===0&&(he=Re,ue&&(ue.words[be]=1));for(var Ne=be-1;Ne>=0;Ne--){var qe=(he.words[ve.length+Ne]|0)*67108864+(he.words[ve.length+Ne-1]|0);for(qe=Math.min(qe/we|0,67108863),he._ishlnsubmul(ve,qe,Ne);he.negative!==0;)qe--,he.negative=0,he._ishlnsubmul(ve,1,Ne),he.isZero()||(he.negative^=1);ue&&(ue.words[Ne]=qe)}return ue&&ue.strip(),he.strip(),ce!=="div"&&de!==0&&he.iushrn(de),{div:ue||null,mod:he}},ae.prototype.divmod=function(se,ce,de){if(ie(!se.isZero()),this.isZero())return{div:new ae(0),mod:new ae(0)};var he,ve,we;return this.negative!==0&&se.negative===0?(we=this.neg().divmod(se,ce),ce!=="mod"&&(he=we.div.neg()),ce!=="div"&&(ve=we.mod.neg(),de&&ve.negative!==0&&ve.iadd(se)),{div:he,mod:ve}):this.negative===0&&se.negative!==0?(we=this.divmod(se.neg(),ce),ce!=="mod"&&(he=we.div.neg()),{div:he,mod:we.mod}):this.negative&se.negative?(we=this.neg().divmod(se.neg(),ce),ce!=="div"&&(ve=we.mod.neg(),de&&ve.negative!==0&&ve.isub(se)),{div:we.div,mod:ve}):se.length>this.length||this.cmp(se)<0?{div:new ae(0),mod:this}:se.length===1?ce==="div"?{div:this.divn(se.words[0]),mod:null}:ce==="mod"?{div:null,mod:new ae(this.modn(se.words[0]))}:{div:this.divn(se.words[0]),mod:new ae(this.modn(se.words[0]))}:this._wordDiv(se,ce)},ae.prototype.div=function(se){return this.divmod(se,"div",!1).div},ae.prototype.mod=function(se){return this.divmod(se,"mod",!1).mod},ae.prototype.umod=function(se){return this.divmod(se,"mod",!0).mod},ae.prototype.divRound=function(se){var ce=this.divmod(se);if(ce.mod.isZero())return ce.div;var de=ce.div.negative!==0?ce.mod.isub(se):ce.mod,he=se.ushrn(1),ve=se.andln(1),we=de.cmp(he);return we<0||ve===1&&we===0?ce.div:ce.div.negative!==0?ce.div.isubn(1):ce.div.iaddn(1)},ae.prototype.modn=function(se){ie(se<=67108863);for(var ce=(1<<26)%se,de=0,he=this.length-1;he>=0;he--)de=(ce*de+(this.words[he]|0))%se;return de},ae.prototype.idivn=function(se){ie(se<=67108863);for(var ce=0,de=this.length-1;de>=0;de--){var he=(this.words[de]|0)+ce*67108864;this.words[de]=he/se|0,ce=he%se}return this.strip()},ae.prototype.divn=function(se){return this.clone().idivn(se)},ae.prototype.egcd=function(se){ie(se.negative===0),ie(!se.isZero());var ce=this,de=se.clone();ce.negative!==0?ce=ce.umod(se):ce=ce.clone();for(var he=new ae(1),ve=new ae(0),we=new ae(0),Ae=new ae(1),be=0;ce.isEven()&&de.isEven();)ce.iushrn(1),de.iushrn(1),++be;for(var ue=de.clone(),ge=ce.clone();!ce.isZero();){for(var Re=0,Ne=1;!(ce.words[0]&Ne)&&Re<26;++Re,Ne<<=1);if(Re>0)for(ce.iushrn(Re);Re-- >0;)(he.isOdd()||ve.isOdd())&&(he.iadd(ue),ve.isub(ge)),he.iushrn(1),ve.iushrn(1);for(var qe=0,Pe=1;!(de.words[0]&Pe)&&qe<26;++qe,Pe<<=1);if(qe>0)for(de.iushrn(qe);qe-- >0;)(we.isOdd()||Ae.isOdd())&&(we.iadd(ue),Ae.isub(ge)),we.iushrn(1),Ae.iushrn(1);ce.cmp(de)>=0?(ce.isub(de),he.isub(we),ve.isub(Ae)):(de.isub(ce),we.isub(he),Ae.isub(ve))}return{a:we,b:Ae,gcd:de.iushln(be)}},ae.prototype._invmp=function(se){ie(se.negative===0),ie(!se.isZero());var ce=this,de=se.clone();ce.negative!==0?ce=ce.umod(se):ce=ce.clone();for(var he=new ae(1),ve=new ae(0),we=de.clone();ce.cmpn(1)>0&&de.cmpn(1)>0;){for(var Ae=0,be=1;!(ce.words[0]&be)&&Ae<26;++Ae,be<<=1);if(Ae>0)for(ce.iushrn(Ae);Ae-- >0;)he.isOdd()&&he.iadd(we),he.iushrn(1);for(var ue=0,ge=1;!(de.words[0]&ge)&&ue<26;++ue,ge<<=1);if(ue>0)for(de.iushrn(ue);ue-- >0;)ve.isOdd()&&ve.iadd(we),ve.iushrn(1);ce.cmp(de)>=0?(ce.isub(de),he.isub(ve)):(de.isub(ce),ve.isub(he))}var Re;return ce.cmpn(1)===0?Re=he:Re=ve,Re.cmpn(0)<0&&Re.iadd(se),Re},ae.prototype.gcd=function(se){if(this.isZero())return se.abs();if(se.isZero())return this.abs();var ce=this.clone(),de=se.clone();ce.negative=0,de.negative=0;for(var he=0;ce.isEven()&&de.isEven();he++)ce.iushrn(1),de.iushrn(1);do{for(;ce.isEven();)ce.iushrn(1);for(;de.isEven();)de.iushrn(1);var ve=ce.cmp(de);if(ve<0){var we=ce;ce=de,de=we}else if(ve===0||de.cmpn(1)===0)break;ce.isub(de)}while(!0);return de.iushln(he)},ae.prototype.invm=function(se){return this.egcd(se).a.umod(se)},ae.prototype.isEven=function(){return(this.words[0]&1)===0},ae.prototype.isOdd=function(){return(this.words[0]&1)===1},ae.prototype.andln=function(se){return this.words[0]&se},ae.prototype.bincn=function(se){ie(typeof se=="number");var ce=se%26,de=(se-ce)/26,he=1<<ce;if(this.length<=de)return this._expand(de+1),this.words[de]|=he,this;for(var ve=he,we=de;ve!==0&&we<this.length;we++){var Ae=this.words[we]|0;Ae+=ve,ve=Ae>>>26,Ae&=67108863,this.words[we]=Ae}return ve!==0&&(this.words[we]=ve,this.length++),this},ae.prototype.isZero=function(){return this.length===1&&this.words[0]===0},ae.prototype.cmpn=function(se){var ce=se<0;if(this.negative!==0&&!ce)return-1;if(this.negative===0&&ce)return 1;this.strip();var de;if(this.length>1)de=1;else{ce&&(se=-se),ie(se<=67108863,"Number is too big");var he=this.words[0]|0;de=he===se?0:he<se?-1:1}return this.negative!==0?-de|0:de},ae.prototype.cmp=function(se){if(this.negative!==0&&se.negative===0)return-1;if(this.negative===0&&se.negative!==0)return 1;var ce=this.ucmp(se);return this.negative!==0?-ce|0:ce},ae.prototype.ucmp=function(se){if(this.length>se.length)return 1;if(this.length<se.length)return-1;for(var ce=0,de=this.length-1;de>=0;de--){var he=this.words[de]|0,ve=se.words[de]|0;if(he!==ve){he<ve?ce=-1:he>ve&&(ce=1);break}}return ce},ae.prototype.gtn=function(se){return this.cmpn(se)===1},ae.prototype.gt=function(se){return this.cmp(se)===1},ae.prototype.gten=function(se){return this.cmpn(se)>=0},ae.prototype.gte=function(se){return this.cmp(se)>=0},ae.prototype.ltn=function(se){return this.cmpn(se)===-1},ae.prototype.lt=function(se){return this.cmp(se)===-1},ae.prototype.lten=function(se){return this.cmpn(se)<=0},ae.prototype.lte=function(se){return this.cmp(se)<=0},ae.prototype.eqn=function(se){return this.cmpn(se)===0},ae.prototype.eq=function(se){return this.cmp(se)===0},ae.red=function(se){return new Ue(se)},ae.prototype.toRed=function(se){return ie(!this.red,"Already a number in reduction context"),ie(this.negative===0,"red works only with positives"),se.convertTo(this)._forceRed(se)},ae.prototype.fromRed=function(){return ie(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},ae.prototype._forceRed=function(se){return this.red=se,this},ae.prototype.forceRed=function(se){return ie(!this.red,"Already a number in reduction context"),this._forceRed(se)},ae.prototype.redAdd=function(se){return ie(this.red,"redAdd works only with red numbers"),this.red.add(this,se)},ae.prototype.redIAdd=function(se){return ie(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,se)},ae.prototype.redSub=function(se){return ie(this.red,"redSub works only with red numbers"),this.red.sub(this,se)},ae.prototype.redISub=function(se){return ie(this.red,"redISub works only with red numbers"),this.red.isub(this,se)},ae.prototype.redShl=function(se){return ie(this.red,"redShl works only with red numbers"),this.red.shl(this,se)},ae.prototype.redMul=function(se){return ie(this.red,"redMul works only with red numbers"),this.red._verify2(this,se),this.red.mul(this,se)},ae.prototype.redIMul=function(se){return ie(this.red,"redMul works only with red numbers"),this.red._verify2(this,se),this.red.imul(this,se)},ae.prototype.redSqr=function(){return ie(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},ae.prototype.redISqr=function(){return ie(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},ae.prototype.redSqrt=function(){return ie(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},ae.prototype.redInvm=function(){return ie(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},ae.prototype.redNeg=function(){return ie(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},ae.prototype.redPow=function(se){return ie(this.red&&!se.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,se)};var Fe={k256:null,p224:null,p192:null,p25519:null};function Le(_e,se){this.name=_e,this.p=new ae(se,16),this.n=this.p.bitLength(),this.k=new ae(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Le.prototype._tmp=function(){var se=new ae(null);return se.words=new Array(Math.ceil(this.n/13)),se},Le.prototype.ireduce=function(se){var ce=se,de;do this.split(ce,this.tmp),ce=this.imulK(ce),ce=ce.iadd(this.tmp),de=ce.bitLength();while(de>this.n);var he=de<this.n?-1:ce.ucmp(this.p);return he===0?(ce.words[0]=0,ce.length=1):he>0?ce.isub(this.p):ce.strip!==void 0?ce.strip():ce._strip(),ce},Le.prototype.split=function(se,ce){se.iushrn(this.n,0,ce)},Le.prototype.imulK=function(se){return se.imul(this.k)};function He(){Le.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}fe(He,Le),He.prototype.split=function(se,ce){for(var de=4194303,he=Math.min(se.length,9),ve=0;ve<he;ve++)ce.words[ve]=se.words[ve];if(ce.length=he,se.length<=9){se.words[0]=0,se.length=1;return}var we=se.words[9];for(ce.words[ce.length++]=we&de,ve=10;ve<se.length;ve++){var Ae=se.words[ve]|0;se.words[ve-10]=(Ae&de)<<4|we>>>22,we=Ae}we>>>=22,se.words[ve-10]=we,we===0&&se.length>10?se.length-=10:se.length-=9},He.prototype.imulK=function(se){se.words[se.length]=0,se.words[se.length+1]=0,se.length+=2;for(var ce=0,de=0;de<se.length;de++){var he=se.words[de]|0;ce+=he*977,se.words[de]=ce&67108863,ce=he*64+(ce/67108864|0)}return se.words[se.length-1]===0&&(se.length--,se.words[se.length-1]===0&&se.length--),se};function ze(){Le.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}fe(ze,Le);function Je(){Le.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}fe(Je,Le);function Xe(){Le.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}fe(Xe,Le),Xe.prototype.imulK=function(se){for(var ce=0,de=0;de<se.length;de++){var he=(se.words[de]|0)*19+ce,ve=he&67108863;he>>>=26,se.words[de]=ve,ce=he}return ce!==0&&(se.words[se.length++]=ce),se},ae._prime=function(se){if(Fe[se])return Fe[se];var ce;if(se==="k256")ce=new He;else if(se==="p224")ce=new ze;else if(se==="p192")ce=new Je;else if(se==="p25519")ce=new Xe;else throw new Error("Unknown prime "+se);return Fe[se]=ce,ce};function Ue(_e){if(typeof _e=="string"){var se=ae._prime(_e);this.m=se.p,this.prime=se}else ie(_e.gtn(1),"modulus must be greater than 1"),this.m=_e,this.prime=null}Ue.prototype._verify1=function(se){ie(se.negative===0,"red works only with positives"),ie(se.red,"red works only with red numbers")},Ue.prototype._verify2=function(se,ce){ie((se.negative|ce.negative)===0,"red works only with positives"),ie(se.red&&se.red===ce.red,"red works only with red numbers")},Ue.prototype.imod=function(se){return this.prime?this.prime.ireduce(se)._forceRed(this):se.umod(this.m)._forceRed(this)},Ue.prototype.neg=function(se){return se.isZero()?se.clone():this.m.sub(se)._forceRed(this)},Ue.prototype.add=function(se,ce){this._verify2(se,ce);var de=se.add(ce);return de.cmp(this.m)>=0&&de.isub(this.m),de._forceRed(this)},Ue.prototype.iadd=function(se,ce){this._verify2(se,ce);var de=se.iadd(ce);return de.cmp(this.m)>=0&&de.isub(this.m),de},Ue.prototype.sub=function(se,ce){this._verify2(se,ce);var de=se.sub(ce);return de.cmpn(0)<0&&de.iadd(this.m),de._forceRed(this)},Ue.prototype.isub=function(se,ce){this._verify2(se,ce);var de=se.isub(ce);return de.cmpn(0)<0&&de.iadd(this.m),de},Ue.prototype.shl=function(se,ce){return this._verify1(se),this.imod(se.ushln(ce))},Ue.prototype.imul=function(se,ce){return this._verify2(se,ce),this.imod(se.imul(ce))},Ue.prototype.mul=function(se,ce){return this._verify2(se,ce),this.imod(se.mul(ce))},Ue.prototype.isqr=function(se){return this.imul(se,se.clone())},Ue.prototype.sqr=function(se){return this.mul(se,se)},Ue.prototype.sqrt=function(se){if(se.isZero())return se.clone();var ce=this.m.andln(3);if(ie(ce%2===1),ce===3){var de=this.m.add(new ae(1)).iushrn(2);return this.pow(se,de)}for(var he=this.m.subn(1),ve=0;!he.isZero()&&he.andln(1)===0;)ve++,he.iushrn(1);ie(!he.isZero());var we=new ae(1).toRed(this),Ae=we.redNeg(),be=this.m.subn(1).iushrn(1),ue=this.m.bitLength();for(ue=new ae(2*ue*ue).toRed(this);this.pow(ue,be).cmp(Ae)!==0;)ue.redIAdd(Ae);for(var ge=this.pow(ue,he),Re=this.pow(se,he.addn(1).iushrn(1)),Ne=this.pow(se,he),qe=ve;Ne.cmp(we)!==0;){for(var Pe=Ne,Ge=0;Pe.cmp(we)!==0;Ge++)Pe=Pe.redSqr();ie(Ge<qe);var Ce=this.pow(ge,new ae(1).iushln(qe-Ge-1));Re=Re.redMul(Ce),ge=Ce.redSqr(),Ne=Ne.redMul(ge),qe=Ge}return Re},Ue.prototype.invm=function(se){var ce=se._invmp(this.m);return ce.negative!==0?(ce.negative=0,this.imod(ce).redNeg()):this.imod(ce)},Ue.prototype.pow=function(se,ce){if(ce.isZero())return new ae(1).toRed(this);if(ce.cmpn(1)===0)return se.clone();var de=4,he=new Array(1<<de);he[0]=new ae(1).toRed(this),he[1]=se;for(var ve=2;ve<he.length;ve++)he[ve]=this.mul(he[ve-1],se);var we=he[0],Ae=0,be=0,ue=ce.bitLength()%26;for(ue===0&&(ue=26),ve=ce.length-1;ve>=0;ve--){for(var ge=ce.words[ve],Re=ue-1;Re>=0;Re--){var Ne=ge>>Re&1;if(we!==he[0]&&(we=this.sqr(we)),Ne===0&&Ae===0){be=0;continue}Ae<<=1,Ae|=Ne,be++,!(be!==de&&(ve!==0||Re!==0))&&(we=this.mul(we,he[Ae]),be=0,Ae=0)}ue=26}return we},Ue.prototype.convertTo=function(se){var ce=se.umod(this.m);return ce===se?ce.clone():ce},Ue.prototype.convertFrom=function(se){var ce=se.clone();return ce.red=null,ce},ae.mont=function(se){return new $t(se)};function $t(_e){Ue.call(this,_e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new ae(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}fe($t,Ue),$t.prototype.convertTo=function(se){return this.imod(se.ushln(this.shift))},$t.prototype.convertFrom=function(se){var ce=this.imod(se.mul(this.rinv));return ce.red=null,ce},$t.prototype.imul=function(se,ce){if(se.isZero()||ce.isZero())return se.words[0]=0,se.length=1,se;var de=se.imul(ce),he=de.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ve=de.isub(he).iushrn(this.shift),we=ve;return ve.cmp(this.m)>=0?we=ve.isub(this.m):ve.cmpn(0)<0&&(we=ve.iadd(this.m)),we._forceRed(this)},$t.prototype.mul=function(se,ce){if(se.isZero()||ce.isZero())return new ae(0)._forceRed(this);var de=se.mul(ce),he=de.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ve=de.isub(he).iushrn(this.shift),we=ve;return ve.cmp(this.m)>=0?we=ve.isub(this.m):ve.cmpn(0)<0&&(we=ve.iadd(this.m)),we._forceRed(this)},$t.prototype.invm=function(se){var ce=this.imod(se._invmp(this.m).mul(this.r2));return ce._forceRed(this)}})(c,commonjsGlobal)})(bn$6);var bnExports$1=bn$6.exports,dist={};Object.defineProperty(dist,"__esModule",{value:!0});var bech32m=dist.bech32m=bech32=dist.bech32=void 0;const ALPHABET="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ALPHABET_MAP={};for(let c=0;c<ALPHABET.length;c++){const t=ALPHABET.charAt(c);ALPHABET_MAP[t]=c}function polymodStep(c){const t=c>>25;return(c&33554431)<<5^-(t>>0&1)&996825010^-(t>>1&1)&642813549^-(t>>2&1)&513874426^-(t>>3&1)&1027748829^-(t>>4&1)&705979059}function prefixChk(c){let t=1;for(let n=0;n<c.length;++n){const ie=c.charCodeAt(n);if(ie<33||ie>126)return"Invalid prefix ("+c+")";t=polymodStep(t)^ie>>5}t=polymodStep(t);for(let n=0;n<c.length;++n){const ie=c.charCodeAt(n);t=polymodStep(t)^ie&31}return t}function convert(c,t,n,ie){let fe=0,ae=0;const le=(1<<n)-1,pe=[];for(let me=0;me<c.length;++me)for(fe=fe<<t|c[me],ae+=t;ae>=n;)ae-=n,pe.push(fe>>ae&le);if(ie)ae>0&&pe.push(fe<<n-ae&le);else{if(ae>=t)return"Excess padding";if(fe<<n-ae&le)return"Non-zero padding"}return pe}function toWords(c){return convert(c,8,5,!0)}function fromWordsUnsafe(c){const t=convert(c,5,8,!1);if(Array.isArray(t))return t}function fromWords(c){const t=convert(c,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function getLibraryFromEncoding(c){let t;c==="bech32"?t=1:t=734539939;function n(le,pe,me){if(me=me||90,le.length+7+pe.length>me)throw new TypeError("Exceeds length limit");le=le.toLowerCase();let ye=prefixChk(le);if(typeof ye=="string")throw new Error(ye);let xe=le+"1";for(let Ee=0;Ee<pe.length;++Ee){const Se=pe[Ee];if(Se>>5)throw new Error("Non 5-bit word");ye=polymodStep(ye)^Se,xe+=ALPHABET.charAt(Se)}for(let Ee=0;Ee<6;++Ee)ye=polymodStep(ye);ye^=t;for(let Ee=0;Ee<6;++Ee){const Se=ye>>(5-Ee)*5&31;xe+=ALPHABET.charAt(Se)}return xe}function ie(le,pe){if(pe=pe||90,le.length<8)return le+" too short";if(le.length>pe)return"Exceeds length limit";const me=le.toLowerCase(),ye=le.toUpperCase();if(le!==me&&le!==ye)return"Mixed-case string "+le;le=me;const xe=le.lastIndexOf("1");if(xe===-1)return"No separator character for "+le;if(xe===0)return"Missing prefix for "+le;const Ee=le.slice(0,xe),Se=le.slice(xe+1);if(Se.length<6)return"Data too short";let Me=prefixChk(Ee);if(typeof Me=="string")return Me;const Be=[];for(let $e=0;$e<Se.length;++$e){const ke=Se.charAt($e),Te=ALPHABET_MAP[ke];if(Te===void 0)return"Unknown character "+ke;Me=polymodStep(Me)^Te,!($e+6>=Se.length)&&Be.push(Te)}return Me!==t?"Invalid checksum for "+le:{prefix:Ee,words:Be}}function fe(le,pe){const me=ie(le,pe);if(typeof me=="object")return me}function ae(le,pe){const me=ie(le,pe);if(typeof me=="object")return me;throw new Error(me)}return{decodeUnsafe:fe,decode:ae,encode:n,toWords,fromWordsUnsafe,fromWords}}var bech32=dist.bech32=getLibraryFromEncoding("bech32");bech32m=dist.bech32m=getLibraryFromEncoding("bech32m");const ERROR_MSG_INPUT="Input must be an string, Buffer or Uint8Array";function normalizeInput(c){let t;if(c instanceof Uint8Array)t=c;else if(typeof c=="string")t=new TextEncoder().encode(c);else throw new Error(ERROR_MSG_INPUT);return t}function toHex(c){return Array.prototype.map.call(c,function(t){return(t<16?"0":"")+t.toString(16)}).join("")}function uint32ToHex(c){return(4294967296+c).toString(16).substring(1)}function debugPrint(c,t,n){let ie=`
35
+ `)+" "+qe[1]:qe[0]+Ne+" "+Re.join(", ")+" "+qe[1]}c.types=requireTypes();function ke(Re){return Array.isArray(Re)}c.isArray=ke;function Te(Re){return typeof Re=="boolean"}c.isBoolean=Te;function Ie(Re){return Re===null}c.isNull=Ie;function Fe(Re){return Re==null}c.isNullOrUndefined=Fe;function Le(Re){return typeof Re=="number"}c.isNumber=Le;function He(Re){return typeof Re=="string"}c.isString=He;function ze(Re){return typeof Re=="symbol"}c.isSymbol=ze;function Je(Re){return Re===void 0}c.isUndefined=Je;function Xe(Re){return Ue(Re)&&de(Re)==="[object RegExp]"}c.isRegExp=Xe,c.types.isRegExp=Xe;function Ue(Re){return typeof Re=="object"&&Re!==null}c.isObject=Ue;function $t(Re){return Ue(Re)&&de(Re)==="[object Date]"}c.isDate=$t,c.types.isDate=$t;function _e(Re){return Ue(Re)&&(de(Re)==="[object Error]"||Re instanceof Error)}c.isError=_e,c.types.isNativeError=_e;function se(Re){return typeof Re=="function"}c.isFunction=se;function ce(Re){return Re===null||typeof Re=="boolean"||typeof Re=="number"||typeof Re=="string"||typeof Re=="symbol"||typeof Re>"u"}c.isPrimitive=ce,c.isBuffer=requireIsBufferBrowser();function de(Re){return Object.prototype.toString.call(Re)}function he(Re){return Re<10?"0"+Re.toString(10):Re.toString(10)}var ve=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function we(){var Re=new Date,Ne=[he(Re.getHours()),he(Re.getMinutes()),he(Re.getSeconds())].join(":");return[Re.getDate(),ve[Re.getMonth()],Ne].join(" ")}c.log=function(){console.log("%s - %s",we(),c.format.apply(c,arguments))},c.inherits=requireInherits_browser(),c._extend=function(Re,Ne){if(!Ne||!Ue(Ne))return Re;for(var qe=Object.keys(Ne),Pe=qe.length;Pe--;)Re[qe[Pe]]=Ne[qe[Pe]];return Re};function Ae(Re,Ne){return Object.prototype.hasOwnProperty.call(Re,Ne)}var be=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;c.promisify=function(Ne){if(typeof Ne!="function")throw new TypeError('The "original" argument must be of type Function');if(be&&Ne[be]){var qe=Ne[be];if(typeof qe!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(qe,be,{value:qe,enumerable:!1,writable:!1,configurable:!0}),qe}function qe(){for(var Pe,Ge,Ce=new Promise(function(Ve,Mt){Pe=Ve,Ge=Mt}),De=[],je=0;je<arguments.length;je++)De.push(arguments[je]);De.push(function(Ve,Mt){Ve?Ge(Ve):Pe(Mt)});try{Ne.apply(this,De)}catch(Ve){Ge(Ve)}return Ce}return Object.setPrototypeOf(qe,Object.getPrototypeOf(Ne)),be&&Object.defineProperty(qe,be,{value:qe,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(qe,t(Ne))},c.promisify.custom=be;function ue(Re,Ne){if(!Re){var qe=new Error("Promise was rejected with a falsy value");qe.reason=Re,Re=qe}return Ne(Re)}function ge(Re){if(typeof Re!="function")throw new TypeError('The "original" argument must be of type Function');function Ne(){for(var qe=[],Pe=0;Pe<arguments.length;Pe++)qe.push(arguments[Pe]);var Ge=qe.pop();if(typeof Ge!="function")throw new TypeError("The last argument must be of type Function");var Ce=this,De=function(){return Ge.apply(Ce,arguments)};Re.apply(this,qe).then(function(je){process$1.nextTick(De.bind(null,null,je))},function(je){process$1.nextTick(ue.bind(null,je,De))})}return Object.setPrototypeOf(Ne,Object.getPrototypeOf(Re)),Object.defineProperties(Ne,t(Re)),Ne}c.callbackify=ge}(util$6)),util$6}Object.defineProperty(utf8,"__esModule",{value:!0});utf8.encode=utf8.decode=void 0;const common_1=common;function decode$7(c){return(common_1.isBrowser?new TextDecoder("utf-8"):new(requireUtil$1()).TextDecoder("utf-8")).decode(c)}utf8.decode=decode$7;function encode$6(c){return(common_1.isBrowser?new TextEncoder:new(requireUtil$1()).TextEncoder("utf-8")).encode(c)}utf8.encode=encode$6;var bs58$1={},__importDefault$9=commonjsGlobal&&commonjsGlobal.__importDefault||function(c){return c&&c.__esModule?c:{default:c}};Object.defineProperty(bs58$1,"__esModule",{value:!0});bs58$1.decode=bs58$1.encode=void 0;const bs58_1=__importDefault$9(bs58$2);function encode$5(c){return bs58_1.default.encode(c)}bs58$1.encode=encode$5;function decode$6(c){return bs58_1.default.decode(c)}bs58$1.decode=decode$6;var base64$5={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$2=0,len=code.length;i$2<len;++i$2)lookup[i$2]=code[i$2],revLookup[code.charCodeAt(i$2)]=i$2;revLookup[45]=62;revLookup[95]=63;function getLens(c){var t=c.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=c.indexOf("=");n===-1&&(n=t);var ie=n===t?0:4-n%4;return[n,ie]}function byteLength(c){var t=getLens(c),n=t[0],ie=t[1];return(n+ie)*3/4-ie}function _byteLength(c,t,n){return(t+n)*3/4-n}function toByteArray(c){var t,n=getLens(c),ie=n[0],fe=n[1],ae=new Arr(_byteLength(c,ie,fe)),le=0,pe=fe>0?ie-4:ie,me;for(me=0;me<pe;me+=4)t=revLookup[c.charCodeAt(me)]<<18|revLookup[c.charCodeAt(me+1)]<<12|revLookup[c.charCodeAt(me+2)]<<6|revLookup[c.charCodeAt(me+3)],ae[le++]=t>>16&255,ae[le++]=t>>8&255,ae[le++]=t&255;return fe===2&&(t=revLookup[c.charCodeAt(me)]<<2|revLookup[c.charCodeAt(me+1)]>>4,ae[le++]=t&255),fe===1&&(t=revLookup[c.charCodeAt(me)]<<10|revLookup[c.charCodeAt(me+1)]<<4|revLookup[c.charCodeAt(me+2)]>>2,ae[le++]=t>>8&255,ae[le++]=t&255),ae}function tripletToBase64(c){return lookup[c>>18&63]+lookup[c>>12&63]+lookup[c>>6&63]+lookup[c&63]}function encodeChunk(c,t,n){for(var ie,fe=[],ae=t;ae<n;ae+=3)ie=(c[ae]<<16&16711680)+(c[ae+1]<<8&65280)+(c[ae+2]&255),fe.push(tripletToBase64(ie));return fe.join("")}function fromByteArray(c){for(var t,n=c.length,ie=n%3,fe=[],ae=16383,le=0,pe=n-ie;le<pe;le+=ae)fe.push(encodeChunk(c,le,le+ae>pe?pe:le+ae));return ie===1?(t=c[n-1],fe.push(lookup[t>>2]+lookup[t<<4&63]+"==")):ie===2&&(t=(c[n-2]<<8)+c[n-1],fe.push(lookup[t>>10]+lookup[t>>4&63]+lookup[t<<2&63]+"=")),fe.join("")}var __createBinding$a=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$a=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$a=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$a(t,c,n);return __setModuleDefault$a(t,c),t};Object.defineProperty(base64$5,"__esModule",{value:!0});base64$5.decode=base64$5.encode=void 0;const buffer_1=dist$1,base64$4=__importStar$a(base64Js);function encode$4(c){return base64$4.fromByteArray(c)}base64$5.encode=encode$4;function decode$5(c){return buffer_1.Buffer.from(base64$4.toByteArray(c))}base64$5.decode=decode$5;var __createBinding$9=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(c,t,n,ie){ie===void 0&&(ie=n);var fe=Object.getOwnPropertyDescriptor(t,n);(!fe||("get"in fe?!t.__esModule:fe.writable||fe.configurable))&&(fe={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(c,ie,fe)}:function(c,t,n,ie){ie===void 0&&(ie=n),c[ie]=t[n]}),__setModuleDefault$9=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(c,t){Object.defineProperty(c,"default",{enumerable:!0,value:t})}:function(c,t){c.default=t}),__importStar$9=commonjsGlobal&&commonjsGlobal.__importStar||function(c){if(c&&c.__esModule)return c;var t={};if(c!=null)for(var n in c)n!=="default"&&Object.prototype.hasOwnProperty.call(c,n)&&__createBinding$9(t,c,n);return __setModuleDefault$9(t,c),t};Object.defineProperty(bytes,"__esModule",{value:!0});bytes.base64=bs58=bytes.bs58=bytes.utf8=bytes.hex=void 0;bytes.hex=__importStar$9(hex);bytes.utf8=__importStar$9(utf8);var bs58=bytes.bs58=__importStar$9(bs58$1);bytes.base64=__importStar$9(base64$5);class SolanaProvider{constructor(t){this.modalInterface=new defaultModal,this.wallet=ChainWallet.Phantom,this.network=t,this.axiosInstance=ky.create({prefixUrl:this.network===Network.MAINNET?"https://apiv3.droplinked.com":"https://apiv3dev.droplinked.com"}),this.address="",this.connection=this.getConnection()}executeAirdrop(t){throw new Error("Method not implemented.")}customPayment(t){throw new Error("Method not implemented.")}unstoppableLogin(t,n){throw new Error("Method not implemented.")}claimNFTs(t){throw new Error("Method not implemented.")}setAxiosInstance(t){return this.axiosInstance=t,this}async walletLogin(){if(!window.solana||!window.solana.isPhantom)throw window.open("https://phantom.app/","_blank"),new WalletNotFoundException;const t=window.solana,n=await t.connect(),ie=await getNonce(n.publicKey.toString(),this.axiosInstance),fe=new Date().toLocaleString(),ae=`Welcome to Droplinked! Please sign this message to verify your ownership over your wallet and log in. - Nonce: ${ie} - Date: ${fe}`,le=new TextEncoder().encode(ae),pe=utils$e.base58.encode((await t.signMessage(le,"utf8")).signature);return{address:n.publicKey.toString(),signature:pe,nonce:ie,date:fe}}deployShop(t){throw new Error("Method not implemented.")}recordProduct(t){throw new Error("Method not implemented.")}setShopId(t){return this.shopId=t,this}async delay(t){return new Promise(n=>setTimeout(n,t))}checkPhantomWallet(){if(!window.solana||!window.solana.isPhantom)throw window.open("https://phantom.app/","_blank"),new WalletNotFoundException}getConnection(){return this.connection?this.connection:(this.connection=new Connection(this.network===Network.MAINNET?"https://multi-greatest-voice.solana-mainnet.quiknode.pro/908c9dd72998ac69ec2205d5cdb2eccd654dfd0b":clusterApiUrl("devnet"),"confirmed"),this.connection)}async waitForTransactionConfirmation(t,n){const ie=await t.getLatestBlockhash();try{await t.confirmTransaction({blockhash:ie.blockhash,lastValidBlockHeight:ie.lastValidBlockHeight,signature:n})}catch(fe){throw console.error("Error confirming transaction:",fe),new Error(`Failed to confirm transaction: ${fe instanceof Error?fe.message:String(fe)}`)}for(;;){await this.delay(1500);try{if(await t.getParsedTransaction(n))break}catch(fe){console.warn("Error checking transaction status:",fe)}}await this.delay(1e3)}async getMintProgramAndDecimals(t,n){var le;const ie=await t.getAccountInfo(n,"confirmed");if(!ie)throw new Error("Mint account not found on chain");const fe=((le=ie.owner)==null?void 0:le.toBase58())===TOKEN_2022_PROGRAM_ID.toBase58()?TOKEN_2022_PROGRAM_ID:TOKEN_PROGRAM_ID,ae=await getMint(t,n,void 0,fe);return{programId:fe,decimals:ae.decimals}}detectChainId(t){const n=t.toLowerCase();return n.includes("devnet")?"solana:devnet":n.includes("testnet")?"solana:testnet":"solana:mainnet"}async connectWalletOrThrow(){const t=this.wallet,n={[ChainWallet.Metamask]:"MetaMask",[ChainWallet.Phantom]:"Phantom"};if(t!==ChainWallet.Metamask&&t!==ChainWallet.Phantom)throw new WalletNotFoundException;const ie=n[t],ae=(getWallets().get()||[]).filter(Ee=>{var Se;return((Se=Ee==null?void 0:Ee.features)==null?void 0:Se["standard:connect"])&&(Ee.features["solana:signAndSendTransaction"]||Ee.features["solana:signTransaction"])&&Ee.name===ie});if(!ae.length)throw new Error("No compatible Solana wallet found (install a Wallet-Standard Solana wallet, e.g. MetaMask Solana Snap).");const le=ae[0],{accounts:pe}=await le.features["standard:connect"].connect();if(!(pe!=null&&pe.length))throw new Error("No account returned by the wallet.");const me=pe[0],ye=me.publicKey||me.address||me.addressBytes,xe=new PublicKey(ye);return{wallet:le,account:me,publicKey:xe}}rescaleUnits(t,n,ie){if(n===ie)return t;const fe=Math.abs(n-ie);return n>ie?t/BigInt(10**fe):t*BigInt(10**fe)}async payment(t){try{const{paymentData:n,orderID:ie}=await getCartData(t.orderID,t.paymentToken,t.paymentType,this.axiosInstance),{tbdReceivers:fe,tbdValues:ae,totalPrice:le,tokenAddress:pe}=n,me=this.getConnection(),ye=this.detectChainId(me._rpcEndpoint??""),{wallet:xe,account:Ee,publicKey:Se}=await this.connectWalletOrThrow(),Me=new PublicKey(pe),{programId:Be,decimals:$e}=await this.getMintProgramAndDecimals(me,Me),ke=fe.map($t=>new PublicKey($t)),Te=getAssociatedTokenAddressSync(Me,Se,!1,Be),Ie=ke.map($t=>getAssociatedTokenAddressSync(Me,$t,!1,Be)),Fe=[];Fe.push(createAssociatedTokenAccountIdempotentInstruction(Se,Te,Se,Me,Be));for(let $t=0;$t<ke.length;$t++)Fe.push(createAssociatedTokenAccountIdempotentInstruction(Se,Ie[$t],ke[$t],Me,Be));for(let $t=0;$t<Ie.length;$t++){const _e=BigNumber.from(ae[$t]).toBigInt();Fe.push(createTransferCheckedInstruction(Te,Me,Ie[$t],Se,_e,$e,[],Be))}const{blockhash:Le,lastValidBlockHeight:He}=await me.getLatestBlockhash("finalized"),ze=new TransactionMessage({payerKey:Se,recentBlockhash:Le,instructions:Fe}).compileToV0Message(),Xe=new VersionedTransaction(ze).serialize();let Ue;try{if(xe.features["solana:signAndSendTransaction"]){const $t=await xe.features["solana:signAndSendTransaction"].signAndSendTransaction({transaction:Xe,chain:ye,account:Ee});Ue=bs58.encode($t[0].signature)}else{const{signedTransaction:$t}=await xe.features["solana:signTransaction"].signTransaction({transaction:Xe,chain:ye,account:Ee}),_e=typeof($t==null?void 0:$t.serialize)=="function"?$t.serialize():$t;Ue=await me.sendRawTransaction(_e,{skipPreflight:!1})}}catch($t){if(($t==null?void 0:$t.message)==="User rejected the request.")throw new Error("User rejected the transaction.");const _e=new Transaction({feePayer:Se,recentBlockhash:Le});for(const se of Fe)_e.add(se);if(xe.features["solana:signAndSendTransaction"]){const se=_e.serialize({requireAllSignatures:!1,verifySignatures:!1}),ce=await xe.features["solana:signAndSendTransaction"].signAndSendTransaction({transaction:se,chain:ye,account:Ee});Ue=bs58.encode(ce[0].signature)}else{const{signedTransaction:se}=await xe.features["solana:signTransaction"].signTransaction({transaction:_e.serialize({requireAllSignatures:!1,verifySignatures:!1}),chain:ye,account:Ee}),ce=typeof(se==null?void 0:se.serialize)=="function"?se.serialize():se;Ue=await me.sendRawTransaction(ce,{skipPreflight:!1})}}return await me.confirmTransaction({signature:Ue,blockhash:Le,lastValidBlockHeight:He},"confirmed"),{transactionHash:Ue,cryptoAmount:le,orderID:ie,transactionId:""}}catch(n){throw console.error("Payment error:",n),new Error(`Payment failed: ${n instanceof Error?n.message:String(n)}`)}}toBaseUnits(t,n){const ie=String(t).trim();if(!/^\d+(\.\d+)?$/.test(ie))throw new Error("Invalid amount");const[fe,ae=""]=ie.split("."),le=(ae+"0".repeat(n)).slice(0,n);return BigInt(fe+le)}async paymentWithToken(t,n,ie){try{const fe=this.getConnection(),ae=this.detectChainId(fe._rpcEndpoint??""),{wallet:le,account:pe,publicKey:me}=await this.connectWalletOrThrow(),ye=new PublicKey(ie),{programId:xe,decimals:Ee}=await this.getMintProgramAndDecimals(fe,ye),Se=new PublicKey(t),Me=getAssociatedTokenAddressSync(ye,me,!1,xe),Be=getAssociatedTokenAddressSync(ye,Se,!1,xe),$e=[];$e.push(createAssociatedTokenAccountIdempotentInstruction(me,Me,me,ye,xe),createAssociatedTokenAccountIdempotentInstruction(me,Be,Se,ye,xe));const ke=this.toBaseUnits(n,Ee);$e.push(createTransferCheckedInstruction(Me,ye,Be,me,ke,Ee,[],xe));const{blockhash:Te,lastValidBlockHeight:Ie}=await fe.getLatestBlockhash("finalized"),Fe=new TransactionMessage({payerKey:me,recentBlockhash:Te,instructions:$e}).compileToV0Message(),He=new VersionedTransaction(Fe).serialize();let ze;try{if(le.features["solana:signAndSendTransaction"]){const{signature:Je}=await le.features["solana:signAndSendTransaction"].signAndSendTransaction({transaction:He,chain:ae,account:pe});ze=Je}else{const{signedTransaction:Je}=await le.features["solana:signTransaction"].signTransaction({transaction:He,chain:ae,account:pe}),Xe=typeof(Je==null?void 0:Je.serialize)=="function"?Je.serialize():Je;ze=await fe.sendRawTransaction(Xe,{skipPreflight:!1})}}catch(Je){if((Je==null?void 0:Je.message)==="User rejected the request.")throw new Error("User rejected the transaction.");const Xe=new Transaction({feePayer:me,recentBlockhash:Te});for(const Ue of $e)Xe.add(Ue);if(le.features["solana:signAndSendTransaction"]){const Ue=Xe.serialize({requireAllSignatures:!1,verifySignatures:!1}),{signature:$t}=await le.features["solana:signAndSendTransaction"].signAndSendTransaction({transaction:Ue,chain:ae,account:pe});ze=$t}else{const{signedTransaction:Ue}=await le.features["solana:signTransaction"].signTransaction({transaction:Xe.serialize({requireAllSignatures:!1,verifySignatures:!1}),chain:ae,account:pe}),$t=typeof(Ue==null?void 0:Ue.serialize)=="function"?Ue.serialize():Ue;ze=await fe.sendRawTransaction($t,{skipPreflight:!1})}}return await fe.confirmTransaction({signature:ze,blockhash:Te,lastValidBlockHeight:Ie},"confirmed"),ze}catch(fe){throw console.error("Token payment error:",fe),new Error(`Token transfer failed: ${fe instanceof Error?fe.message:String(fe)}`)}}setAddress(t){return this.address=t,this}setWallet(t){return this.wallet=t,this}setModal(t){return this.modalInterface=t,this}setNFTContractAddress(t){return this.nftContractAddress=t,this}setShopContractAddress(t){return this.shopContractAddress=t,this}getPaymentData(t,n,ie){throw new Error("Method not implemented.")}}var r=function(){function c(t){t===void 0&&(t=c.defaultCreateUrl),this.createURL=void 0,this.createURL=t}return c.defaultCreateUrl=function(t,n){return"https://"+t+".ipns.dweb.link"+n.replace(/^\/?/,"/")},c.prototype.resolve=function(t){try{var n,ie,fe;if(t.startsWith("/ipfs/")||t.startsWith("/ipns/"))fe=t.substring(1,5),n=t.substring(6).split("/")[0],ie=t.substring(6+n.length);else{var ae=new URL(t);if(ae.hash!==""||ae.password!==""||ae.port!==""||ae.search!==""||ae.username!=="")throw new Error("invalid ipfs uri");fe=ae.protocol.substring(0,4),n=ae.hostname,ie=ae.pathname}if(fe!=="ipfs")throw new Error("only ipfs is supported, (not ipns)");return Promise.resolve(fetch(this.createURL(n,ie)).then(function(le){return le.ok?le.text():Promise.reject(new Error("bad response"))}))}catch(le){return Promise.reject(le)}},c}(),e=function(){function c(t){this.options=void 0,this.options=t}return c.prototype.resolve=function(t,n){try{var ie,fe="";if(t.includes("@")){var ae=t.split("@",1);fe=ae[0],ie=ae[1]}else ie=t;var le="http://openid.net/specs/connect/1.0/issuer";return Promise.resolve(this.options.webfingerResolver.resolve(ie,fe,le,n)).then(function(pe){var me,ye=(me=pe.links)==null?void 0:me.find(function(xe){return xe.rel===le});if(!ye||!ye.href)throw new Error("bad jrd");return Promise.resolve(fetch(ye.href+"/.well-known/openid-configuration").then(function(xe){return xe.ok?xe.json():Promise.reject(new Error("bad openid-configuration response"))}))})}catch(pe){return Promise.reject(pe)}},c}();function o(c,t,n){if(!c.s){if(n instanceof i$1){if(!n.s)return void(n.o=o.bind(null,c,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(o.bind(null,c,t),o.bind(null,c,2));c.s=t,c.v=n;const ie=c.o;ie&&ie(c)}}var i$1=function(){function c(){}return c.prototype.then=function(t,n){var ie=new c,fe=this.s;if(fe){var ae=1&fe?t:n;if(ae){try{o(ie,1,ae(this.v))}catch(le){o(ie,2,le)}return ie}return this}return this.o=function(le){try{var pe=le.v;1&le.s?o(ie,1,t?t(pe):pe):n?o(ie,1,n(pe)):o(ie,2,pe)}catch(me){o(ie,2,me)}},ie},c}();if(typeof window<"u"){var s$1=window;s$1.UAUTH_VERSION=s$1.UAUTH_VERSION||{},s$1.UAUTH_VERSION.COMMON="3.0.1"}var u$1=function(){function c(t){this.options=void 0,this.options=t}return c.prototype.resolve=function(t,n,ie,fe){try{var ae=this,le="webfinger."+n+"."+ie;return Promise.resolve(ae.options.domainResolver.records(t,[le])).then(function(pe){function me(Me){if(xe.subject!==ye)throw new Error("resource invalid");return xe}var ye=n?"acct:"+n+"@"+t:""+t;if(!pe[le])return{subject:ye,links:[{rel:ie,href:fe}]};var xe,Ee=JSON.parse(pe[le]),Se=typeof Ee.host=="string"?Promise.resolve(fetch("/.well-known/webfinger?"+new URLSearchParams({resource:ye,rel:ie}).toString(),{headers:{Host:Ee.host}}).then(function(Me){return Me.ok?Me.json():Promise.reject(new Error("bad webfinger response"))})).then(function(Me){xe=Me}):function(){if(typeof Ee.uri=="string"){var Me=new URL(Ee.uri);return function(Be,$e){var ke,Te=-1;e:{for(var Ie=0;Ie<$e.length;Ie++){var Fe=$e[Ie][0];if(Fe){var Le=Fe();if(Le&&Le.then)break e;if(Le===Be){Te=Ie;break}}else Te=Ie}if(Te!==-1){do{for(var He=$e[Te][1];!He;)Te++,He=$e[Te][1];var ze=He();if(ze&&ze.then){ke=!0;break e}var Je=$e[Te][2];Te++}while(Je&&!Je());return ze}}var Xe=new i$1,Ue=o.bind(null,Xe,2);return(ke?ze.then($t):Le.then(function _e(se){for(;;){if(se===Be){Te=Ie;break}if(++Ie===$e.length){if(Te!==-1)break;return void o(Xe,1,de)}if(Fe=$e[Ie][0]){if((se=Fe())&&se.then)return void se.then(_e).then(void 0,Ue)}else Te=Ie}do{for(var ce=$e[Te][1];!ce;)Te++,ce=$e[Te][1];var de=ce();if(de&&de.then)return void de.then($t).then(void 0,Ue);var he=$e[Te][2];Te++}while(he&&!he());o(Xe,1,de)})).then(void 0,Ue),Xe;function $t(_e){for(;;){var se=$e[Te][2];if(!se||se())break;Te++;for(var ce=$e[Te][1];!ce;)Te++,ce=$e[Te][1];if((_e=ce())&&_e.then)return void _e.then($t).then(void 0,Ue)}o(Xe,1,_e)}}(Me.protocol,[[function(){return"http:"}],[function(){return"https:"},function(){return Promise.resolve(fetch(Me.toString()).then(function(Be){return Be.ok?Be.json():Promise.reject(new Error("bad webfinger response"))})).then(function(Be){xe=Be})}],[function(){return"ipfs:"},function(){return Promise.resolve(ae.options.ipfsResolver.resolve(Ee.uri)).then(function(Be){xe=JSON.parse(Be)})}],[function(){return"ipns:"}],[function(){return"swarm:"}],[void 0,function(){throw new Error("uri scheme not supported")}]])}if(typeof Ee.value!="string")throw new Error("bad webfinger record");xe=JSON.parse(Ee.value)}();return Se&&Se.then?Se.then(me):me()})}catch(pe){return Promise.reject(pe)}},c}(),build={},Resolution$1={},bn$7={exports:{}};bn$7.exports;(function(c){(function(t,n){function ie(_e,se){if(!_e)throw new Error(se||"Assertion failed")}function fe(_e,se){_e.super_=se;var ce=function(){};ce.prototype=se.prototype,_e.prototype=new ce,_e.prototype.constructor=_e}function ae(_e,se,ce){if(ae.isBN(_e))return _e;this.negative=0,this.words=null,this.length=0,this.red=null,_e!==null&&((se==="le"||se==="be")&&(ce=se,se=10),this._init(_e||0,se||10,ce||"be"))}typeof t=="object"?t.exports=ae:n.BN=ae,ae.BN=ae,ae.wordSize=26;var le;try{typeof window<"u"&&typeof window.Buffer<"u"?le=window.Buffer:le=dist$1.Buffer}catch{}ae.isBN=function(se){return se instanceof ae?!0:se!==null&&typeof se=="object"&&se.constructor.wordSize===ae.wordSize&&Array.isArray(se.words)},ae.max=function(se,ce){return se.cmp(ce)>0?se:ce},ae.min=function(se,ce){return se.cmp(ce)<0?se:ce},ae.prototype._init=function(se,ce,de){if(typeof se=="number")return this._initNumber(se,ce,de);if(typeof se=="object")return this._initArray(se,ce,de);ce==="hex"&&(ce=16),ie(ce===(ce|0)&&ce>=2&&ce<=36),se=se.toString().replace(/\s+/g,"");var he=0;se[0]==="-"&&(he++,this.negative=1),he<se.length&&(ce===16?this._parseHex(se,he,de):(this._parseBase(se,ce,he),de==="le"&&this._initArray(this.toArray(),ce,de)))},ae.prototype._initNumber=function(se,ce,de){se<0&&(this.negative=1,se=-se),se<67108864?(this.words=[se&67108863],this.length=1):se<4503599627370496?(this.words=[se&67108863,se/67108864&67108863],this.length=2):(ie(se<9007199254740992),this.words=[se&67108863,se/67108864&67108863,1],this.length=3),de==="le"&&this._initArray(this.toArray(),ce,de)},ae.prototype._initArray=function(se,ce,de){if(ie(typeof se.length=="number"),se.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(se.length/3),this.words=new Array(this.length);for(var he=0;he<this.length;he++)this.words[he]=0;var ve,we,Ae=0;if(de==="be")for(he=se.length-1,ve=0;he>=0;he-=3)we=se[he]|se[he-1]<<8|se[he-2]<<16,this.words[ve]|=we<<Ae&67108863,this.words[ve+1]=we>>>26-Ae&67108863,Ae+=24,Ae>=26&&(Ae-=26,ve++);else if(de==="le")for(he=0,ve=0;he<se.length;he+=3)we=se[he]|se[he+1]<<8|se[he+2]<<16,this.words[ve]|=we<<Ae&67108863,this.words[ve+1]=we>>>26-Ae&67108863,Ae+=24,Ae>=26&&(Ae-=26,ve++);return this.strip()};function pe(_e,se){var ce=_e.charCodeAt(se);return ce>=65&&ce<=70?ce-55:ce>=97&&ce<=102?ce-87:ce-48&15}function me(_e,se,ce){var de=pe(_e,ce);return ce-1>=se&&(de|=pe(_e,ce-1)<<4),de}ae.prototype._parseHex=function(se,ce,de){this.length=Math.ceil((se.length-ce)/6),this.words=new Array(this.length);for(var he=0;he<this.length;he++)this.words[he]=0;var ve=0,we=0,Ae;if(de==="be")for(he=se.length-1;he>=ce;he-=2)Ae=me(se,ce,he)<<ve,this.words[we]|=Ae&67108863,ve>=18?(ve-=18,we+=1,this.words[we]|=Ae>>>26):ve+=8;else{var be=se.length-ce;for(he=be%2===0?ce+1:ce;he<se.length;he+=2)Ae=me(se,ce,he)<<ve,this.words[we]|=Ae&67108863,ve>=18?(ve-=18,we+=1,this.words[we]|=Ae>>>26):ve+=8}this.strip()};function ye(_e,se,ce,de){for(var he=0,ve=Math.min(_e.length,ce),we=se;we<ve;we++){var Ae=_e.charCodeAt(we)-48;he*=de,Ae>=49?he+=Ae-49+10:Ae>=17?he+=Ae-17+10:he+=Ae}return he}ae.prototype._parseBase=function(se,ce,de){this.words=[0],this.length=1;for(var he=0,ve=1;ve<=67108863;ve*=ce)he++;he--,ve=ve/ce|0;for(var we=se.length-de,Ae=we%he,be=Math.min(we,we-Ae)+de,ue=0,ge=de;ge<be;ge+=he)ue=ye(se,ge,ge+he,ce),this.imuln(ve),this.words[0]+ue<67108864?this.words[0]+=ue:this._iaddn(ue);if(Ae!==0){var Re=1;for(ue=ye(se,ge,se.length,ce),ge=0;ge<Ae;ge++)Re*=ce;this.imuln(Re),this.words[0]+ue<67108864?this.words[0]+=ue:this._iaddn(ue)}this.strip()},ae.prototype.copy=function(se){se.words=new Array(this.length);for(var ce=0;ce<this.length;ce++)se.words[ce]=this.words[ce];se.length=this.length,se.negative=this.negative,se.red=this.red},ae.prototype.clone=function(){var se=new ae(null);return this.copy(se),se},ae.prototype._expand=function(se){for(;this.length<se;)this.words[this.length++]=0;return this},ae.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},ae.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},ae.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var xe=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Ee=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Se=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];ae.prototype.toString=function(se,ce){se=se||10,ce=ce|0||1;var de;if(se===16||se==="hex"){de="";for(var he=0,ve=0,we=0;we<this.length;we++){var Ae=this.words[we],be=((Ae<<he|ve)&16777215).toString(16);ve=Ae>>>24-he&16777215,he+=2,he>=26&&(he-=26,we--),ve!==0||we!==this.length-1?de=xe[6-be.length]+be+de:de=be+de}for(ve!==0&&(de=ve.toString(16)+de);de.length%ce!==0;)de="0"+de;return this.negative!==0&&(de="-"+de),de}if(se===(se|0)&&se>=2&&se<=36){var ue=Ee[se],ge=Se[se];de="";var Re=this.clone();for(Re.negative=0;!Re.isZero();){var Ne=Re.modn(ge).toString(se);Re=Re.idivn(ge),Re.isZero()?de=Ne+de:de=xe[ue-Ne.length]+Ne+de}for(this.isZero()&&(de="0"+de);de.length%ce!==0;)de="0"+de;return this.negative!==0&&(de="-"+de),de}ie(!1,"Base should be between 2 and 36")},ae.prototype.toNumber=function(){var se=this.words[0];return this.length===2?se+=this.words[1]*67108864:this.length===3&&this.words[2]===1?se+=4503599627370496+this.words[1]*67108864:this.length>2&&ie(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-se:se},ae.prototype.toJSON=function(){return this.toString(16)},ae.prototype.toBuffer=function(se,ce){return ie(typeof le<"u"),this.toArrayLike(le,se,ce)},ae.prototype.toArray=function(se,ce){return this.toArrayLike(Array,se,ce)},ae.prototype.toArrayLike=function(se,ce,de){var he=this.byteLength(),ve=de||Math.max(1,he);ie(he<=ve,"byte array longer than desired length"),ie(ve>0,"Requested array length <= 0"),this.strip();var we=ce==="le",Ae=new se(ve),be,ue,ge=this.clone();if(we){for(ue=0;!ge.isZero();ue++)be=ge.andln(255),ge.iushrn(8),Ae[ue]=be;for(;ue<ve;ue++)Ae[ue]=0}else{for(ue=0;ue<ve-he;ue++)Ae[ue]=0;for(ue=0;!ge.isZero();ue++)be=ge.andln(255),ge.iushrn(8),Ae[ve-ue-1]=be}return Ae},Math.clz32?ae.prototype._countBits=function(se){return 32-Math.clz32(se)}:ae.prototype._countBits=function(se){var ce=se,de=0;return ce>=4096&&(de+=13,ce>>>=13),ce>=64&&(de+=7,ce>>>=7),ce>=8&&(de+=4,ce>>>=4),ce>=2&&(de+=2,ce>>>=2),de+ce},ae.prototype._zeroBits=function(se){if(se===0)return 26;var ce=se,de=0;return ce&8191||(de+=13,ce>>>=13),ce&127||(de+=7,ce>>>=7),ce&15||(de+=4,ce>>>=4),ce&3||(de+=2,ce>>>=2),ce&1||de++,de},ae.prototype.bitLength=function(){var se=this.words[this.length-1],ce=this._countBits(se);return(this.length-1)*26+ce};function Me(_e){for(var se=new Array(_e.bitLength()),ce=0;ce<se.length;ce++){var de=ce/26|0,he=ce%26;se[ce]=(_e.words[de]&1<<he)>>>he}return se}ae.prototype.zeroBits=function(){if(this.isZero())return 0;for(var se=0,ce=0;ce<this.length;ce++){var de=this._zeroBits(this.words[ce]);if(se+=de,de!==26)break}return se},ae.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},ae.prototype.toTwos=function(se){return this.negative!==0?this.abs().inotn(se).iaddn(1):this.clone()},ae.prototype.fromTwos=function(se){return this.testn(se-1)?this.notn(se).iaddn(1).ineg():this.clone()},ae.prototype.isNeg=function(){return this.negative!==0},ae.prototype.neg=function(){return this.clone().ineg()},ae.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},ae.prototype.iuor=function(se){for(;this.length<se.length;)this.words[this.length++]=0;for(var ce=0;ce<se.length;ce++)this.words[ce]=this.words[ce]|se.words[ce];return this.strip()},ae.prototype.ior=function(se){return ie((this.negative|se.negative)===0),this.iuor(se)},ae.prototype.or=function(se){return this.length>se.length?this.clone().ior(se):se.clone().ior(this)},ae.prototype.uor=function(se){return this.length>se.length?this.clone().iuor(se):se.clone().iuor(this)},ae.prototype.iuand=function(se){var ce;this.length>se.length?ce=se:ce=this;for(var de=0;de<ce.length;de++)this.words[de]=this.words[de]&se.words[de];return this.length=ce.length,this.strip()},ae.prototype.iand=function(se){return ie((this.negative|se.negative)===0),this.iuand(se)},ae.prototype.and=function(se){return this.length>se.length?this.clone().iand(se):se.clone().iand(this)},ae.prototype.uand=function(se){return this.length>se.length?this.clone().iuand(se):se.clone().iuand(this)},ae.prototype.iuxor=function(se){var ce,de;this.length>se.length?(ce=this,de=se):(ce=se,de=this);for(var he=0;he<de.length;he++)this.words[he]=ce.words[he]^de.words[he];if(this!==ce)for(;he<ce.length;he++)this.words[he]=ce.words[he];return this.length=ce.length,this.strip()},ae.prototype.ixor=function(se){return ie((this.negative|se.negative)===0),this.iuxor(se)},ae.prototype.xor=function(se){return this.length>se.length?this.clone().ixor(se):se.clone().ixor(this)},ae.prototype.uxor=function(se){return this.length>se.length?this.clone().iuxor(se):se.clone().iuxor(this)},ae.prototype.inotn=function(se){ie(typeof se=="number"&&se>=0);var ce=Math.ceil(se/26)|0,de=se%26;this._expand(ce),de>0&&ce--;for(var he=0;he<ce;he++)this.words[he]=~this.words[he]&67108863;return de>0&&(this.words[he]=~this.words[he]&67108863>>26-de),this.strip()},ae.prototype.notn=function(se){return this.clone().inotn(se)},ae.prototype.setn=function(se,ce){ie(typeof se=="number"&&se>=0);var de=se/26|0,he=se%26;return this._expand(de+1),ce?this.words[de]=this.words[de]|1<<he:this.words[de]=this.words[de]&~(1<<he),this.strip()},ae.prototype.iadd=function(se){var ce;if(this.negative!==0&&se.negative===0)return this.negative=0,ce=this.isub(se),this.negative^=1,this._normSign();if(this.negative===0&&se.negative!==0)return se.negative=0,ce=this.isub(se),se.negative=1,ce._normSign();var de,he;this.length>se.length?(de=this,he=se):(de=se,he=this);for(var ve=0,we=0;we<he.length;we++)ce=(de.words[we]|0)+(he.words[we]|0)+ve,this.words[we]=ce&67108863,ve=ce>>>26;for(;ve!==0&&we<de.length;we++)ce=(de.words[we]|0)+ve,this.words[we]=ce&67108863,ve=ce>>>26;if(this.length=de.length,ve!==0)this.words[this.length]=ve,this.length++;else if(de!==this)for(;we<de.length;we++)this.words[we]=de.words[we];return this},ae.prototype.add=function(se){var ce;return se.negative!==0&&this.negative===0?(se.negative=0,ce=this.sub(se),se.negative^=1,ce):se.negative===0&&this.negative!==0?(this.negative=0,ce=se.sub(this),this.negative=1,ce):this.length>se.length?this.clone().iadd(se):se.clone().iadd(this)},ae.prototype.isub=function(se){if(se.negative!==0){se.negative=0;var ce=this.iadd(se);return se.negative=1,ce._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(se),this.negative=1,this._normSign();var de=this.cmp(se);if(de===0)return this.negative=0,this.length=1,this.words[0]=0,this;var he,ve;de>0?(he=this,ve=se):(he=se,ve=this);for(var we=0,Ae=0;Ae<ve.length;Ae++)ce=(he.words[Ae]|0)-(ve.words[Ae]|0)+we,we=ce>>26,this.words[Ae]=ce&67108863;for(;we!==0&&Ae<he.length;Ae++)ce=(he.words[Ae]|0)+we,we=ce>>26,this.words[Ae]=ce&67108863;if(we===0&&Ae<he.length&&he!==this)for(;Ae<he.length;Ae++)this.words[Ae]=he.words[Ae];return this.length=Math.max(this.length,Ae),he!==this&&(this.negative=1),this.strip()},ae.prototype.sub=function(se){return this.clone().isub(se)};function Be(_e,se,ce){ce.negative=se.negative^_e.negative;var de=_e.length+se.length|0;ce.length=de,de=de-1|0;var he=_e.words[0]|0,ve=se.words[0]|0,we=he*ve,Ae=we&67108863,be=we/67108864|0;ce.words[0]=Ae;for(var ue=1;ue<de;ue++){for(var ge=be>>>26,Re=be&67108863,Ne=Math.min(ue,se.length-1),qe=Math.max(0,ue-_e.length+1);qe<=Ne;qe++){var Pe=ue-qe|0;he=_e.words[Pe]|0,ve=se.words[qe]|0,we=he*ve+Re,ge+=we/67108864|0,Re=we&67108863}ce.words[ue]=Re|0,be=ge|0}return be!==0?ce.words[ue]=be|0:ce.length--,ce.strip()}var $e=function(se,ce,de){var he=se.words,ve=ce.words,we=de.words,Ae=0,be,ue,ge,Re=he[0]|0,Ne=Re&8191,qe=Re>>>13,Pe=he[1]|0,Ge=Pe&8191,Ce=Pe>>>13,De=he[2]|0,je=De&8191,Ve=De>>>13,Mt=he[3]|0,Oe=Mt&8191,We=Mt>>>13,jt=he[4]|0,Dt=jt&8191,Ht=jt>>>13,vn=he[5]|0,Vt=vn&8191,Kt=vn>>>13,En=he[6]|0,en=En&8191,Xt=En>>>13,_n=he[7]|0,Ze=_n&8191,Rt=_n>>>13,Qt=he[8]|0,Ft=Qt&8191,Wt=Qt>>>13,an=he[9]|0,Zt=an&8191,Jt=an>>>13,An=ve[0]|0,tn=An&8191,nn=An>>>13,Sn=ve[1]|0,rn=Sn&8191,dn=Sn>>>13,Mn=ve[2]|0,sn=Mn&8191,ln=Mn>>>13,Bn=ve[3]|0,un=Bn&8191,hn=Bn>>>13,Cn=ve[4]|0,yn=Cn&8191,xn=Cn>>>13,Nn=ve[5]|0,Qe=Nn&8191,Ke=Nn>>>13,Ye=ve[6]|0,Pt=Ye&8191,Gt=Ye>>>13,gn=ve[7]|0,Yt=gn&8191,cn=gn>>>13,$n=ve[8]|0,fn=$n&8191,pn=$n>>>13,Rn=ve[9]|0,mn=Rn&8191,wn=Rn>>>13;de.negative=se.negative^ce.negative,de.length=19,be=Math.imul(Ne,tn),ue=Math.imul(Ne,nn),ue=ue+Math.imul(qe,tn)|0,ge=Math.imul(qe,nn);var kn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(kn>>>26)|0,kn&=67108863,be=Math.imul(Ge,tn),ue=Math.imul(Ge,nn),ue=ue+Math.imul(Ce,tn)|0,ge=Math.imul(Ce,nn),be=be+Math.imul(Ne,rn)|0,ue=ue+Math.imul(Ne,dn)|0,ue=ue+Math.imul(qe,rn)|0,ge=ge+Math.imul(qe,dn)|0;var Tn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,be=Math.imul(je,tn),ue=Math.imul(je,nn),ue=ue+Math.imul(Ve,tn)|0,ge=Math.imul(Ve,nn),be=be+Math.imul(Ge,rn)|0,ue=ue+Math.imul(Ge,dn)|0,ue=ue+Math.imul(Ce,rn)|0,ge=ge+Math.imul(Ce,dn)|0,be=be+Math.imul(Ne,sn)|0,ue=ue+Math.imul(Ne,ln)|0,ue=ue+Math.imul(qe,sn)|0,ge=ge+Math.imul(qe,ln)|0;var In=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(In>>>26)|0,In&=67108863,be=Math.imul(Oe,tn),ue=Math.imul(Oe,nn),ue=ue+Math.imul(We,tn)|0,ge=Math.imul(We,nn),be=be+Math.imul(je,rn)|0,ue=ue+Math.imul(je,dn)|0,ue=ue+Math.imul(Ve,rn)|0,ge=ge+Math.imul(Ve,dn)|0,be=be+Math.imul(Ge,sn)|0,ue=ue+Math.imul(Ge,ln)|0,ue=ue+Math.imul(Ce,sn)|0,ge=ge+Math.imul(Ce,ln)|0,be=be+Math.imul(Ne,un)|0,ue=ue+Math.imul(Ne,hn)|0,ue=ue+Math.imul(qe,un)|0,ge=ge+Math.imul(qe,hn)|0;var Pn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,be=Math.imul(Dt,tn),ue=Math.imul(Dt,nn),ue=ue+Math.imul(Ht,tn)|0,ge=Math.imul(Ht,nn),be=be+Math.imul(Oe,rn)|0,ue=ue+Math.imul(Oe,dn)|0,ue=ue+Math.imul(We,rn)|0,ge=ge+Math.imul(We,dn)|0,be=be+Math.imul(je,sn)|0,ue=ue+Math.imul(je,ln)|0,ue=ue+Math.imul(Ve,sn)|0,ge=ge+Math.imul(Ve,ln)|0,be=be+Math.imul(Ge,un)|0,ue=ue+Math.imul(Ge,hn)|0,ue=ue+Math.imul(Ce,un)|0,ge=ge+Math.imul(Ce,hn)|0,be=be+Math.imul(Ne,yn)|0,ue=ue+Math.imul(Ne,xn)|0,ue=ue+Math.imul(qe,yn)|0,ge=ge+Math.imul(qe,xn)|0;var On=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(On>>>26)|0,On&=67108863,be=Math.imul(Vt,tn),ue=Math.imul(Vt,nn),ue=ue+Math.imul(Kt,tn)|0,ge=Math.imul(Kt,nn),be=be+Math.imul(Dt,rn)|0,ue=ue+Math.imul(Dt,dn)|0,ue=ue+Math.imul(Ht,rn)|0,ge=ge+Math.imul(Ht,dn)|0,be=be+Math.imul(Oe,sn)|0,ue=ue+Math.imul(Oe,ln)|0,ue=ue+Math.imul(We,sn)|0,ge=ge+Math.imul(We,ln)|0,be=be+Math.imul(je,un)|0,ue=ue+Math.imul(je,hn)|0,ue=ue+Math.imul(Ve,un)|0,ge=ge+Math.imul(Ve,hn)|0,be=be+Math.imul(Ge,yn)|0,ue=ue+Math.imul(Ge,xn)|0,ue=ue+Math.imul(Ce,yn)|0,ge=ge+Math.imul(Ce,xn)|0,be=be+Math.imul(Ne,Qe)|0,ue=ue+Math.imul(Ne,Ke)|0,ue=ue+Math.imul(qe,Qe)|0,ge=ge+Math.imul(qe,Ke)|0;var Dn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,be=Math.imul(en,tn),ue=Math.imul(en,nn),ue=ue+Math.imul(Xt,tn)|0,ge=Math.imul(Xt,nn),be=be+Math.imul(Vt,rn)|0,ue=ue+Math.imul(Vt,dn)|0,ue=ue+Math.imul(Kt,rn)|0,ge=ge+Math.imul(Kt,dn)|0,be=be+Math.imul(Dt,sn)|0,ue=ue+Math.imul(Dt,ln)|0,ue=ue+Math.imul(Ht,sn)|0,ge=ge+Math.imul(Ht,ln)|0,be=be+Math.imul(Oe,un)|0,ue=ue+Math.imul(Oe,hn)|0,ue=ue+Math.imul(We,un)|0,ge=ge+Math.imul(We,hn)|0,be=be+Math.imul(je,yn)|0,ue=ue+Math.imul(je,xn)|0,ue=ue+Math.imul(Ve,yn)|0,ge=ge+Math.imul(Ve,xn)|0,be=be+Math.imul(Ge,Qe)|0,ue=ue+Math.imul(Ge,Ke)|0,ue=ue+Math.imul(Ce,Qe)|0,ge=ge+Math.imul(Ce,Ke)|0,be=be+Math.imul(Ne,Pt)|0,ue=ue+Math.imul(Ne,Gt)|0,ue=ue+Math.imul(qe,Pt)|0,ge=ge+Math.imul(qe,Gt)|0;var Ln=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,be=Math.imul(Ze,tn),ue=Math.imul(Ze,nn),ue=ue+Math.imul(Rt,tn)|0,ge=Math.imul(Rt,nn),be=be+Math.imul(en,rn)|0,ue=ue+Math.imul(en,dn)|0,ue=ue+Math.imul(Xt,rn)|0,ge=ge+Math.imul(Xt,dn)|0,be=be+Math.imul(Vt,sn)|0,ue=ue+Math.imul(Vt,ln)|0,ue=ue+Math.imul(Kt,sn)|0,ge=ge+Math.imul(Kt,ln)|0,be=be+Math.imul(Dt,un)|0,ue=ue+Math.imul(Dt,hn)|0,ue=ue+Math.imul(Ht,un)|0,ge=ge+Math.imul(Ht,hn)|0,be=be+Math.imul(Oe,yn)|0,ue=ue+Math.imul(Oe,xn)|0,ue=ue+Math.imul(We,yn)|0,ge=ge+Math.imul(We,xn)|0,be=be+Math.imul(je,Qe)|0,ue=ue+Math.imul(je,Ke)|0,ue=ue+Math.imul(Ve,Qe)|0,ge=ge+Math.imul(Ve,Ke)|0,be=be+Math.imul(Ge,Pt)|0,ue=ue+Math.imul(Ge,Gt)|0,ue=ue+Math.imul(Ce,Pt)|0,ge=ge+Math.imul(Ce,Gt)|0,be=be+Math.imul(Ne,Yt)|0,ue=ue+Math.imul(Ne,cn)|0,ue=ue+Math.imul(qe,Yt)|0,ge=ge+Math.imul(qe,cn)|0;var Fn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,be=Math.imul(Ft,tn),ue=Math.imul(Ft,nn),ue=ue+Math.imul(Wt,tn)|0,ge=Math.imul(Wt,nn),be=be+Math.imul(Ze,rn)|0,ue=ue+Math.imul(Ze,dn)|0,ue=ue+Math.imul(Rt,rn)|0,ge=ge+Math.imul(Rt,dn)|0,be=be+Math.imul(en,sn)|0,ue=ue+Math.imul(en,ln)|0,ue=ue+Math.imul(Xt,sn)|0,ge=ge+Math.imul(Xt,ln)|0,be=be+Math.imul(Vt,un)|0,ue=ue+Math.imul(Vt,hn)|0,ue=ue+Math.imul(Kt,un)|0,ge=ge+Math.imul(Kt,hn)|0,be=be+Math.imul(Dt,yn)|0,ue=ue+Math.imul(Dt,xn)|0,ue=ue+Math.imul(Ht,yn)|0,ge=ge+Math.imul(Ht,xn)|0,be=be+Math.imul(Oe,Qe)|0,ue=ue+Math.imul(Oe,Ke)|0,ue=ue+Math.imul(We,Qe)|0,ge=ge+Math.imul(We,Ke)|0,be=be+Math.imul(je,Pt)|0,ue=ue+Math.imul(je,Gt)|0,ue=ue+Math.imul(Ve,Pt)|0,ge=ge+Math.imul(Ve,Gt)|0,be=be+Math.imul(Ge,Yt)|0,ue=ue+Math.imul(Ge,cn)|0,ue=ue+Math.imul(Ce,Yt)|0,ge=ge+Math.imul(Ce,cn)|0,be=be+Math.imul(Ne,fn)|0,ue=ue+Math.imul(Ne,pn)|0,ue=ue+Math.imul(qe,fn)|0,ge=ge+Math.imul(qe,pn)|0;var qn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(qn>>>26)|0,qn&=67108863,be=Math.imul(Zt,tn),ue=Math.imul(Zt,nn),ue=ue+Math.imul(Jt,tn)|0,ge=Math.imul(Jt,nn),be=be+Math.imul(Ft,rn)|0,ue=ue+Math.imul(Ft,dn)|0,ue=ue+Math.imul(Wt,rn)|0,ge=ge+Math.imul(Wt,dn)|0,be=be+Math.imul(Ze,sn)|0,ue=ue+Math.imul(Ze,ln)|0,ue=ue+Math.imul(Rt,sn)|0,ge=ge+Math.imul(Rt,ln)|0,be=be+Math.imul(en,un)|0,ue=ue+Math.imul(en,hn)|0,ue=ue+Math.imul(Xt,un)|0,ge=ge+Math.imul(Xt,hn)|0,be=be+Math.imul(Vt,yn)|0,ue=ue+Math.imul(Vt,xn)|0,ue=ue+Math.imul(Kt,yn)|0,ge=ge+Math.imul(Kt,xn)|0,be=be+Math.imul(Dt,Qe)|0,ue=ue+Math.imul(Dt,Ke)|0,ue=ue+Math.imul(Ht,Qe)|0,ge=ge+Math.imul(Ht,Ke)|0,be=be+Math.imul(Oe,Pt)|0,ue=ue+Math.imul(Oe,Gt)|0,ue=ue+Math.imul(We,Pt)|0,ge=ge+Math.imul(We,Gt)|0,be=be+Math.imul(je,Yt)|0,ue=ue+Math.imul(je,cn)|0,ue=ue+Math.imul(Ve,Yt)|0,ge=ge+Math.imul(Ve,cn)|0,be=be+Math.imul(Ge,fn)|0,ue=ue+Math.imul(Ge,pn)|0,ue=ue+Math.imul(Ce,fn)|0,ge=ge+Math.imul(Ce,pn)|0,be=be+Math.imul(Ne,mn)|0,ue=ue+Math.imul(Ne,wn)|0,ue=ue+Math.imul(qe,mn)|0,ge=ge+Math.imul(qe,wn)|0;var Un=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Un>>>26)|0,Un&=67108863,be=Math.imul(Zt,rn),ue=Math.imul(Zt,dn),ue=ue+Math.imul(Jt,rn)|0,ge=Math.imul(Jt,dn),be=be+Math.imul(Ft,sn)|0,ue=ue+Math.imul(Ft,ln)|0,ue=ue+Math.imul(Wt,sn)|0,ge=ge+Math.imul(Wt,ln)|0,be=be+Math.imul(Ze,un)|0,ue=ue+Math.imul(Ze,hn)|0,ue=ue+Math.imul(Rt,un)|0,ge=ge+Math.imul(Rt,hn)|0,be=be+Math.imul(en,yn)|0,ue=ue+Math.imul(en,xn)|0,ue=ue+Math.imul(Xt,yn)|0,ge=ge+Math.imul(Xt,xn)|0,be=be+Math.imul(Vt,Qe)|0,ue=ue+Math.imul(Vt,Ke)|0,ue=ue+Math.imul(Kt,Qe)|0,ge=ge+Math.imul(Kt,Ke)|0,be=be+Math.imul(Dt,Pt)|0,ue=ue+Math.imul(Dt,Gt)|0,ue=ue+Math.imul(Ht,Pt)|0,ge=ge+Math.imul(Ht,Gt)|0,be=be+Math.imul(Oe,Yt)|0,ue=ue+Math.imul(Oe,cn)|0,ue=ue+Math.imul(We,Yt)|0,ge=ge+Math.imul(We,cn)|0,be=be+Math.imul(je,fn)|0,ue=ue+Math.imul(je,pn)|0,ue=ue+Math.imul(Ve,fn)|0,ge=ge+Math.imul(Ve,pn)|0,be=be+Math.imul(Ge,mn)|0,ue=ue+Math.imul(Ge,wn)|0,ue=ue+Math.imul(Ce,mn)|0,ge=ge+Math.imul(Ce,wn)|0;var Kn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Kn>>>26)|0,Kn&=67108863,be=Math.imul(Zt,sn),ue=Math.imul(Zt,ln),ue=ue+Math.imul(Jt,sn)|0,ge=Math.imul(Jt,ln),be=be+Math.imul(Ft,un)|0,ue=ue+Math.imul(Ft,hn)|0,ue=ue+Math.imul(Wt,un)|0,ge=ge+Math.imul(Wt,hn)|0,be=be+Math.imul(Ze,yn)|0,ue=ue+Math.imul(Ze,xn)|0,ue=ue+Math.imul(Rt,yn)|0,ge=ge+Math.imul(Rt,xn)|0,be=be+Math.imul(en,Qe)|0,ue=ue+Math.imul(en,Ke)|0,ue=ue+Math.imul(Xt,Qe)|0,ge=ge+Math.imul(Xt,Ke)|0,be=be+Math.imul(Vt,Pt)|0,ue=ue+Math.imul(Vt,Gt)|0,ue=ue+Math.imul(Kt,Pt)|0,ge=ge+Math.imul(Kt,Gt)|0,be=be+Math.imul(Dt,Yt)|0,ue=ue+Math.imul(Dt,cn)|0,ue=ue+Math.imul(Ht,Yt)|0,ge=ge+Math.imul(Ht,cn)|0,be=be+Math.imul(Oe,fn)|0,ue=ue+Math.imul(Oe,pn)|0,ue=ue+Math.imul(We,fn)|0,ge=ge+Math.imul(We,pn)|0,be=be+Math.imul(je,mn)|0,ue=ue+Math.imul(je,wn)|0,ue=ue+Math.imul(Ve,mn)|0,ge=ge+Math.imul(Ve,wn)|0;var Hn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,be=Math.imul(Zt,un),ue=Math.imul(Zt,hn),ue=ue+Math.imul(Jt,un)|0,ge=Math.imul(Jt,hn),be=be+Math.imul(Ft,yn)|0,ue=ue+Math.imul(Ft,xn)|0,ue=ue+Math.imul(Wt,yn)|0,ge=ge+Math.imul(Wt,xn)|0,be=be+Math.imul(Ze,Qe)|0,ue=ue+Math.imul(Ze,Ke)|0,ue=ue+Math.imul(Rt,Qe)|0,ge=ge+Math.imul(Rt,Ke)|0,be=be+Math.imul(en,Pt)|0,ue=ue+Math.imul(en,Gt)|0,ue=ue+Math.imul(Xt,Pt)|0,ge=ge+Math.imul(Xt,Gt)|0,be=be+Math.imul(Vt,Yt)|0,ue=ue+Math.imul(Vt,cn)|0,ue=ue+Math.imul(Kt,Yt)|0,ge=ge+Math.imul(Kt,cn)|0,be=be+Math.imul(Dt,fn)|0,ue=ue+Math.imul(Dt,pn)|0,ue=ue+Math.imul(Ht,fn)|0,ge=ge+Math.imul(Ht,pn)|0,be=be+Math.imul(Oe,mn)|0,ue=ue+Math.imul(Oe,wn)|0,ue=ue+Math.imul(We,mn)|0,ge=ge+Math.imul(We,wn)|0;var jn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(jn>>>26)|0,jn&=67108863,be=Math.imul(Zt,yn),ue=Math.imul(Zt,xn),ue=ue+Math.imul(Jt,yn)|0,ge=Math.imul(Jt,xn),be=be+Math.imul(Ft,Qe)|0,ue=ue+Math.imul(Ft,Ke)|0,ue=ue+Math.imul(Wt,Qe)|0,ge=ge+Math.imul(Wt,Ke)|0,be=be+Math.imul(Ze,Pt)|0,ue=ue+Math.imul(Ze,Gt)|0,ue=ue+Math.imul(Rt,Pt)|0,ge=ge+Math.imul(Rt,Gt)|0,be=be+Math.imul(en,Yt)|0,ue=ue+Math.imul(en,cn)|0,ue=ue+Math.imul(Xt,Yt)|0,ge=ge+Math.imul(Xt,cn)|0,be=be+Math.imul(Vt,fn)|0,ue=ue+Math.imul(Vt,pn)|0,ue=ue+Math.imul(Kt,fn)|0,ge=ge+Math.imul(Kt,pn)|0,be=be+Math.imul(Dt,mn)|0,ue=ue+Math.imul(Dt,wn)|0,ue=ue+Math.imul(Ht,mn)|0,ge=ge+Math.imul(Ht,wn)|0;var zn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(zn>>>26)|0,zn&=67108863,be=Math.imul(Zt,Qe),ue=Math.imul(Zt,Ke),ue=ue+Math.imul(Jt,Qe)|0,ge=Math.imul(Jt,Ke),be=be+Math.imul(Ft,Pt)|0,ue=ue+Math.imul(Ft,Gt)|0,ue=ue+Math.imul(Wt,Pt)|0,ge=ge+Math.imul(Wt,Gt)|0,be=be+Math.imul(Ze,Yt)|0,ue=ue+Math.imul(Ze,cn)|0,ue=ue+Math.imul(Rt,Yt)|0,ge=ge+Math.imul(Rt,cn)|0,be=be+Math.imul(en,fn)|0,ue=ue+Math.imul(en,pn)|0,ue=ue+Math.imul(Xt,fn)|0,ge=ge+Math.imul(Xt,pn)|0,be=be+Math.imul(Vt,mn)|0,ue=ue+Math.imul(Vt,wn)|0,ue=ue+Math.imul(Kt,mn)|0,ge=ge+Math.imul(Kt,wn)|0;var Gn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,be=Math.imul(Zt,Pt),ue=Math.imul(Zt,Gt),ue=ue+Math.imul(Jt,Pt)|0,ge=Math.imul(Jt,Gt),be=be+Math.imul(Ft,Yt)|0,ue=ue+Math.imul(Ft,cn)|0,ue=ue+Math.imul(Wt,Yt)|0,ge=ge+Math.imul(Wt,cn)|0,be=be+Math.imul(Ze,fn)|0,ue=ue+Math.imul(Ze,pn)|0,ue=ue+Math.imul(Rt,fn)|0,ge=ge+Math.imul(Rt,pn)|0,be=be+Math.imul(en,mn)|0,ue=ue+Math.imul(en,wn)|0,ue=ue+Math.imul(Xt,mn)|0,ge=ge+Math.imul(Xt,wn)|0;var Wn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,be=Math.imul(Zt,Yt),ue=Math.imul(Zt,cn),ue=ue+Math.imul(Jt,Yt)|0,ge=Math.imul(Jt,cn),be=be+Math.imul(Ft,fn)|0,ue=ue+Math.imul(Ft,pn)|0,ue=ue+Math.imul(Wt,fn)|0,ge=ge+Math.imul(Wt,pn)|0,be=be+Math.imul(Ze,mn)|0,ue=ue+Math.imul(Ze,wn)|0,ue=ue+Math.imul(Rt,mn)|0,ge=ge+Math.imul(Rt,wn)|0;var Vn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,be=Math.imul(Zt,fn),ue=Math.imul(Zt,pn),ue=ue+Math.imul(Jt,fn)|0,ge=Math.imul(Jt,pn),be=be+Math.imul(Ft,mn)|0,ue=ue+Math.imul(Ft,wn)|0,ue=ue+Math.imul(Wt,mn)|0,ge=ge+Math.imul(Wt,wn)|0;var Zn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,be=Math.imul(Zt,mn),ue=Math.imul(Zt,wn),ue=ue+Math.imul(Jt,mn)|0,ge=Math.imul(Jt,wn);var Jn=(Ae+be|0)+((ue&8191)<<13)|0;return Ae=(ge+(ue>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,we[0]=kn,we[1]=Tn,we[2]=In,we[3]=Pn,we[4]=On,we[5]=Dn,we[6]=Ln,we[7]=Fn,we[8]=qn,we[9]=Un,we[10]=Kn,we[11]=Hn,we[12]=jn,we[13]=zn,we[14]=Gn,we[15]=Wn,we[16]=Vn,we[17]=Zn,we[18]=Jn,Ae!==0&&(we[19]=Ae,de.length++),de};Math.imul||($e=Be);function ke(_e,se,ce){ce.negative=se.negative^_e.negative,ce.length=_e.length+se.length;for(var de=0,he=0,ve=0;ve<ce.length-1;ve++){var we=he;he=0;for(var Ae=de&67108863,be=Math.min(ve,se.length-1),ue=Math.max(0,ve-_e.length+1);ue<=be;ue++){var ge=ve-ue,Re=_e.words[ge]|0,Ne=se.words[ue]|0,qe=Re*Ne,Pe=qe&67108863;we=we+(qe/67108864|0)|0,Pe=Pe+Ae|0,Ae=Pe&67108863,we=we+(Pe>>>26)|0,he+=we>>>26,we&=67108863}ce.words[ve]=Ae,de=we,we=he}return de!==0?ce.words[ve]=de:ce.length--,ce.strip()}function Te(_e,se,ce){var de=new Ie;return de.mulp(_e,se,ce)}ae.prototype.mulTo=function(se,ce){var de,he=this.length+se.length;return this.length===10&&se.length===10?de=$e(this,se,ce):he<63?de=Be(this,se,ce):he<1024?de=ke(this,se,ce):de=Te(this,se,ce),de};function Ie(_e,se){this.x=_e,this.y=se}Ie.prototype.makeRBT=function(se){for(var ce=new Array(se),de=ae.prototype._countBits(se)-1,he=0;he<se;he++)ce[he]=this.revBin(he,de,se);return ce},Ie.prototype.revBin=function(se,ce,de){if(se===0||se===de-1)return se;for(var he=0,ve=0;ve<ce;ve++)he|=(se&1)<<ce-ve-1,se>>=1;return he},Ie.prototype.permute=function(se,ce,de,he,ve,we){for(var Ae=0;Ae<we;Ae++)he[Ae]=ce[se[Ae]],ve[Ae]=de[se[Ae]]},Ie.prototype.transform=function(se,ce,de,he,ve,we){this.permute(we,se,ce,de,he,ve);for(var Ae=1;Ae<ve;Ae<<=1)for(var be=Ae<<1,ue=Math.cos(2*Math.PI/be),ge=Math.sin(2*Math.PI/be),Re=0;Re<ve;Re+=be)for(var Ne=ue,qe=ge,Pe=0;Pe<Ae;Pe++){var Ge=de[Re+Pe],Ce=he[Re+Pe],De=de[Re+Pe+Ae],je=he[Re+Pe+Ae],Ve=Ne*De-qe*je;je=Ne*je+qe*De,De=Ve,de[Re+Pe]=Ge+De,he[Re+Pe]=Ce+je,de[Re+Pe+Ae]=Ge-De,he[Re+Pe+Ae]=Ce-je,Pe!==be&&(Ve=ue*Ne-ge*qe,qe=ue*qe+ge*Ne,Ne=Ve)}},Ie.prototype.guessLen13b=function(se,ce){var de=Math.max(ce,se)|1,he=de&1,ve=0;for(de=de/2|0;de;de=de>>>1)ve++;return 1<<ve+1+he},Ie.prototype.conjugate=function(se,ce,de){if(!(de<=1))for(var he=0;he<de/2;he++){var ve=se[he];se[he]=se[de-he-1],se[de-he-1]=ve,ve=ce[he],ce[he]=-ce[de-he-1],ce[de-he-1]=-ve}},Ie.prototype.normalize13b=function(se,ce){for(var de=0,he=0;he<ce/2;he++){var ve=Math.round(se[2*he+1]/ce)*8192+Math.round(se[2*he]/ce)+de;se[he]=ve&67108863,ve<67108864?de=0:de=ve/67108864|0}return se},Ie.prototype.convert13b=function(se,ce,de,he){for(var ve=0,we=0;we<ce;we++)ve=ve+(se[we]|0),de[2*we]=ve&8191,ve=ve>>>13,de[2*we+1]=ve&8191,ve=ve>>>13;for(we=2*ce;we<he;++we)de[we]=0;ie(ve===0),ie((ve&-8192)===0)},Ie.prototype.stub=function(se){for(var ce=new Array(se),de=0;de<se;de++)ce[de]=0;return ce},Ie.prototype.mulp=function(se,ce,de){var he=2*this.guessLen13b(se.length,ce.length),ve=this.makeRBT(he),we=this.stub(he),Ae=new Array(he),be=new Array(he),ue=new Array(he),ge=new Array(he),Re=new Array(he),Ne=new Array(he),qe=de.words;qe.length=he,this.convert13b(se.words,se.length,Ae,he),this.convert13b(ce.words,ce.length,ge,he),this.transform(Ae,we,be,ue,he,ve),this.transform(ge,we,Re,Ne,he,ve);for(var Pe=0;Pe<he;Pe++){var Ge=be[Pe]*Re[Pe]-ue[Pe]*Ne[Pe];ue[Pe]=be[Pe]*Ne[Pe]+ue[Pe]*Re[Pe],be[Pe]=Ge}return this.conjugate(be,ue,he),this.transform(be,ue,qe,we,he,ve),this.conjugate(qe,we,he),this.normalize13b(qe,he),de.negative=se.negative^ce.negative,de.length=se.length+ce.length,de.strip()},ae.prototype.mul=function(se){var ce=new ae(null);return ce.words=new Array(this.length+se.length),this.mulTo(se,ce)},ae.prototype.mulf=function(se){var ce=new ae(null);return ce.words=new Array(this.length+se.length),Te(this,se,ce)},ae.prototype.imul=function(se){return this.clone().mulTo(se,this)},ae.prototype.imuln=function(se){ie(typeof se=="number"),ie(se<67108864);for(var ce=0,de=0;de<this.length;de++){var he=(this.words[de]|0)*se,ve=(he&67108863)+(ce&67108863);ce>>=26,ce+=he/67108864|0,ce+=ve>>>26,this.words[de]=ve&67108863}return ce!==0&&(this.words[de]=ce,this.length++),this.length=se===0?1:this.length,this},ae.prototype.muln=function(se){return this.clone().imuln(se)},ae.prototype.sqr=function(){return this.mul(this)},ae.prototype.isqr=function(){return this.imul(this.clone())},ae.prototype.pow=function(se){var ce=Me(se);if(ce.length===0)return new ae(1);for(var de=this,he=0;he<ce.length&&ce[he]===0;he++,de=de.sqr());if(++he<ce.length)for(var ve=de.sqr();he<ce.length;he++,ve=ve.sqr())ce[he]!==0&&(de=de.mul(ve));return de},ae.prototype.iushln=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26,he=67108863>>>26-ce<<26-ce,ve;if(ce!==0){var we=0;for(ve=0;ve<this.length;ve++){var Ae=this.words[ve]&he,be=(this.words[ve]|0)-Ae<<ce;this.words[ve]=be|we,we=Ae>>>26-ce}we&&(this.words[ve]=we,this.length++)}if(de!==0){for(ve=this.length-1;ve>=0;ve--)this.words[ve+de]=this.words[ve];for(ve=0;ve<de;ve++)this.words[ve]=0;this.length+=de}return this.strip()},ae.prototype.ishln=function(se){return ie(this.negative===0),this.iushln(se)},ae.prototype.iushrn=function(se,ce,de){ie(typeof se=="number"&&se>=0);var he;ce?he=(ce-ce%26)/26:he=0;var ve=se%26,we=Math.min((se-ve)/26,this.length),Ae=67108863^67108863>>>ve<<ve,be=de;if(he-=we,he=Math.max(0,he),be){for(var ue=0;ue<we;ue++)be.words[ue]=this.words[ue];be.length=we}if(we!==0)if(this.length>we)for(this.length-=we,ue=0;ue<this.length;ue++)this.words[ue]=this.words[ue+we];else this.words[0]=0,this.length=1;var ge=0;for(ue=this.length-1;ue>=0&&(ge!==0||ue>=he);ue--){var Re=this.words[ue]|0;this.words[ue]=ge<<26-ve|Re>>>ve,ge=Re&Ae}return be&&ge!==0&&(be.words[be.length++]=ge),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},ae.prototype.ishrn=function(se,ce,de){return ie(this.negative===0),this.iushrn(se,ce,de)},ae.prototype.shln=function(se){return this.clone().ishln(se)},ae.prototype.ushln=function(se){return this.clone().iushln(se)},ae.prototype.shrn=function(se){return this.clone().ishrn(se)},ae.prototype.ushrn=function(se){return this.clone().iushrn(se)},ae.prototype.testn=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26,he=1<<ce;if(this.length<=de)return!1;var ve=this.words[de];return!!(ve&he)},ae.prototype.imaskn=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26;if(ie(this.negative===0,"imaskn works only with positive numbers"),this.length<=de)return this;if(ce!==0&&de++,this.length=Math.min(de,this.length),ce!==0){var he=67108863^67108863>>>ce<<ce;this.words[this.length-1]&=he}return this.strip()},ae.prototype.maskn=function(se){return this.clone().imaskn(se)},ae.prototype.iaddn=function(se){return ie(typeof se=="number"),ie(se<67108864),se<0?this.isubn(-se):this.negative!==0?this.length===1&&(this.words[0]|0)<se?(this.words[0]=se-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(se),this.negative=1,this):this._iaddn(se)},ae.prototype._iaddn=function(se){this.words[0]+=se;for(var ce=0;ce<this.length&&this.words[ce]>=67108864;ce++)this.words[ce]-=67108864,ce===this.length-1?this.words[ce+1]=1:this.words[ce+1]++;return this.length=Math.max(this.length,ce+1),this},ae.prototype.isubn=function(se){if(ie(typeof se=="number"),ie(se<67108864),se<0)return this.iaddn(-se);if(this.negative!==0)return this.negative=0,this.iaddn(se),this.negative=1,this;if(this.words[0]-=se,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var ce=0;ce<this.length&&this.words[ce]<0;ce++)this.words[ce]+=67108864,this.words[ce+1]-=1;return this.strip()},ae.prototype.addn=function(se){return this.clone().iaddn(se)},ae.prototype.subn=function(se){return this.clone().isubn(se)},ae.prototype.iabs=function(){return this.negative=0,this},ae.prototype.abs=function(){return this.clone().iabs()},ae.prototype._ishlnsubmul=function(se,ce,de){var he=se.length+de,ve;this._expand(he);var we,Ae=0;for(ve=0;ve<se.length;ve++){we=(this.words[ve+de]|0)+Ae;var be=(se.words[ve]|0)*ce;we-=be&67108863,Ae=(we>>26)-(be/67108864|0),this.words[ve+de]=we&67108863}for(;ve<this.length-de;ve++)we=(this.words[ve+de]|0)+Ae,Ae=we>>26,this.words[ve+de]=we&67108863;if(Ae===0)return this.strip();for(ie(Ae===-1),Ae=0,ve=0;ve<this.length;ve++)we=-(this.words[ve]|0)+Ae,Ae=we>>26,this.words[ve]=we&67108863;return this.negative=1,this.strip()},ae.prototype._wordDiv=function(se,ce){var de=this.length-se.length,he=this.clone(),ve=se,we=ve.words[ve.length-1]|0,Ae=this._countBits(we);de=26-Ae,de!==0&&(ve=ve.ushln(de),he.iushln(de),we=ve.words[ve.length-1]|0);var be=he.length-ve.length,ue;if(ce!=="mod"){ue=new ae(null),ue.length=be+1,ue.words=new Array(ue.length);for(var ge=0;ge<ue.length;ge++)ue.words[ge]=0}var Re=he.clone()._ishlnsubmul(ve,1,be);Re.negative===0&&(he=Re,ue&&(ue.words[be]=1));for(var Ne=be-1;Ne>=0;Ne--){var qe=(he.words[ve.length+Ne]|0)*67108864+(he.words[ve.length+Ne-1]|0);for(qe=Math.min(qe/we|0,67108863),he._ishlnsubmul(ve,qe,Ne);he.negative!==0;)qe--,he.negative=0,he._ishlnsubmul(ve,1,Ne),he.isZero()||(he.negative^=1);ue&&(ue.words[Ne]=qe)}return ue&&ue.strip(),he.strip(),ce!=="div"&&de!==0&&he.iushrn(de),{div:ue||null,mod:he}},ae.prototype.divmod=function(se,ce,de){if(ie(!se.isZero()),this.isZero())return{div:new ae(0),mod:new ae(0)};var he,ve,we;return this.negative!==0&&se.negative===0?(we=this.neg().divmod(se,ce),ce!=="mod"&&(he=we.div.neg()),ce!=="div"&&(ve=we.mod.neg(),de&&ve.negative!==0&&ve.iadd(se)),{div:he,mod:ve}):this.negative===0&&se.negative!==0?(we=this.divmod(se.neg(),ce),ce!=="mod"&&(he=we.div.neg()),{div:he,mod:we.mod}):this.negative&se.negative?(we=this.neg().divmod(se.neg(),ce),ce!=="div"&&(ve=we.mod.neg(),de&&ve.negative!==0&&ve.isub(se)),{div:we.div,mod:ve}):se.length>this.length||this.cmp(se)<0?{div:new ae(0),mod:this}:se.length===1?ce==="div"?{div:this.divn(se.words[0]),mod:null}:ce==="mod"?{div:null,mod:new ae(this.modn(se.words[0]))}:{div:this.divn(se.words[0]),mod:new ae(this.modn(se.words[0]))}:this._wordDiv(se,ce)},ae.prototype.div=function(se){return this.divmod(se,"div",!1).div},ae.prototype.mod=function(se){return this.divmod(se,"mod",!1).mod},ae.prototype.umod=function(se){return this.divmod(se,"mod",!0).mod},ae.prototype.divRound=function(se){var ce=this.divmod(se);if(ce.mod.isZero())return ce.div;var de=ce.div.negative!==0?ce.mod.isub(se):ce.mod,he=se.ushrn(1),ve=se.andln(1),we=de.cmp(he);return we<0||ve===1&&we===0?ce.div:ce.div.negative!==0?ce.div.isubn(1):ce.div.iaddn(1)},ae.prototype.modn=function(se){ie(se<=67108863);for(var ce=(1<<26)%se,de=0,he=this.length-1;he>=0;he--)de=(ce*de+(this.words[he]|0))%se;return de},ae.prototype.idivn=function(se){ie(se<=67108863);for(var ce=0,de=this.length-1;de>=0;de--){var he=(this.words[de]|0)+ce*67108864;this.words[de]=he/se|0,ce=he%se}return this.strip()},ae.prototype.divn=function(se){return this.clone().idivn(se)},ae.prototype.egcd=function(se){ie(se.negative===0),ie(!se.isZero());var ce=this,de=se.clone();ce.negative!==0?ce=ce.umod(se):ce=ce.clone();for(var he=new ae(1),ve=new ae(0),we=new ae(0),Ae=new ae(1),be=0;ce.isEven()&&de.isEven();)ce.iushrn(1),de.iushrn(1),++be;for(var ue=de.clone(),ge=ce.clone();!ce.isZero();){for(var Re=0,Ne=1;!(ce.words[0]&Ne)&&Re<26;++Re,Ne<<=1);if(Re>0)for(ce.iushrn(Re);Re-- >0;)(he.isOdd()||ve.isOdd())&&(he.iadd(ue),ve.isub(ge)),he.iushrn(1),ve.iushrn(1);for(var qe=0,Pe=1;!(de.words[0]&Pe)&&qe<26;++qe,Pe<<=1);if(qe>0)for(de.iushrn(qe);qe-- >0;)(we.isOdd()||Ae.isOdd())&&(we.iadd(ue),Ae.isub(ge)),we.iushrn(1),Ae.iushrn(1);ce.cmp(de)>=0?(ce.isub(de),he.isub(we),ve.isub(Ae)):(de.isub(ce),we.isub(he),Ae.isub(ve))}return{a:we,b:Ae,gcd:de.iushln(be)}},ae.prototype._invmp=function(se){ie(se.negative===0),ie(!se.isZero());var ce=this,de=se.clone();ce.negative!==0?ce=ce.umod(se):ce=ce.clone();for(var he=new ae(1),ve=new ae(0),we=de.clone();ce.cmpn(1)>0&&de.cmpn(1)>0;){for(var Ae=0,be=1;!(ce.words[0]&be)&&Ae<26;++Ae,be<<=1);if(Ae>0)for(ce.iushrn(Ae);Ae-- >0;)he.isOdd()&&he.iadd(we),he.iushrn(1);for(var ue=0,ge=1;!(de.words[0]&ge)&&ue<26;++ue,ge<<=1);if(ue>0)for(de.iushrn(ue);ue-- >0;)ve.isOdd()&&ve.iadd(we),ve.iushrn(1);ce.cmp(de)>=0?(ce.isub(de),he.isub(ve)):(de.isub(ce),ve.isub(he))}var Re;return ce.cmpn(1)===0?Re=he:Re=ve,Re.cmpn(0)<0&&Re.iadd(se),Re},ae.prototype.gcd=function(se){if(this.isZero())return se.abs();if(se.isZero())return this.abs();var ce=this.clone(),de=se.clone();ce.negative=0,de.negative=0;for(var he=0;ce.isEven()&&de.isEven();he++)ce.iushrn(1),de.iushrn(1);do{for(;ce.isEven();)ce.iushrn(1);for(;de.isEven();)de.iushrn(1);var ve=ce.cmp(de);if(ve<0){var we=ce;ce=de,de=we}else if(ve===0||de.cmpn(1)===0)break;ce.isub(de)}while(!0);return de.iushln(he)},ae.prototype.invm=function(se){return this.egcd(se).a.umod(se)},ae.prototype.isEven=function(){return(this.words[0]&1)===0},ae.prototype.isOdd=function(){return(this.words[0]&1)===1},ae.prototype.andln=function(se){return this.words[0]&se},ae.prototype.bincn=function(se){ie(typeof se=="number");var ce=se%26,de=(se-ce)/26,he=1<<ce;if(this.length<=de)return this._expand(de+1),this.words[de]|=he,this;for(var ve=he,we=de;ve!==0&&we<this.length;we++){var Ae=this.words[we]|0;Ae+=ve,ve=Ae>>>26,Ae&=67108863,this.words[we]=Ae}return ve!==0&&(this.words[we]=ve,this.length++),this},ae.prototype.isZero=function(){return this.length===1&&this.words[0]===0},ae.prototype.cmpn=function(se){var ce=se<0;if(this.negative!==0&&!ce)return-1;if(this.negative===0&&ce)return 1;this.strip();var de;if(this.length>1)de=1;else{ce&&(se=-se),ie(se<=67108863,"Number is too big");var he=this.words[0]|0;de=he===se?0:he<se?-1:1}return this.negative!==0?-de|0:de},ae.prototype.cmp=function(se){if(this.negative!==0&&se.negative===0)return-1;if(this.negative===0&&se.negative!==0)return 1;var ce=this.ucmp(se);return this.negative!==0?-ce|0:ce},ae.prototype.ucmp=function(se){if(this.length>se.length)return 1;if(this.length<se.length)return-1;for(var ce=0,de=this.length-1;de>=0;de--){var he=this.words[de]|0,ve=se.words[de]|0;if(he!==ve){he<ve?ce=-1:he>ve&&(ce=1);break}}return ce},ae.prototype.gtn=function(se){return this.cmpn(se)===1},ae.prototype.gt=function(se){return this.cmp(se)===1},ae.prototype.gten=function(se){return this.cmpn(se)>=0},ae.prototype.gte=function(se){return this.cmp(se)>=0},ae.prototype.ltn=function(se){return this.cmpn(se)===-1},ae.prototype.lt=function(se){return this.cmp(se)===-1},ae.prototype.lten=function(se){return this.cmpn(se)<=0},ae.prototype.lte=function(se){return this.cmp(se)<=0},ae.prototype.eqn=function(se){return this.cmpn(se)===0},ae.prototype.eq=function(se){return this.cmp(se)===0},ae.red=function(se){return new Ue(se)},ae.prototype.toRed=function(se){return ie(!this.red,"Already a number in reduction context"),ie(this.negative===0,"red works only with positives"),se.convertTo(this)._forceRed(se)},ae.prototype.fromRed=function(){return ie(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},ae.prototype._forceRed=function(se){return this.red=se,this},ae.prototype.forceRed=function(se){return ie(!this.red,"Already a number in reduction context"),this._forceRed(se)},ae.prototype.redAdd=function(se){return ie(this.red,"redAdd works only with red numbers"),this.red.add(this,se)},ae.prototype.redIAdd=function(se){return ie(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,se)},ae.prototype.redSub=function(se){return ie(this.red,"redSub works only with red numbers"),this.red.sub(this,se)},ae.prototype.redISub=function(se){return ie(this.red,"redISub works only with red numbers"),this.red.isub(this,se)},ae.prototype.redShl=function(se){return ie(this.red,"redShl works only with red numbers"),this.red.shl(this,se)},ae.prototype.redMul=function(se){return ie(this.red,"redMul works only with red numbers"),this.red._verify2(this,se),this.red.mul(this,se)},ae.prototype.redIMul=function(se){return ie(this.red,"redMul works only with red numbers"),this.red._verify2(this,se),this.red.imul(this,se)},ae.prototype.redSqr=function(){return ie(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},ae.prototype.redISqr=function(){return ie(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},ae.prototype.redSqrt=function(){return ie(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},ae.prototype.redInvm=function(){return ie(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},ae.prototype.redNeg=function(){return ie(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},ae.prototype.redPow=function(se){return ie(this.red&&!se.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,se)};var Fe={k256:null,p224:null,p192:null,p25519:null};function Le(_e,se){this.name=_e,this.p=new ae(se,16),this.n=this.p.bitLength(),this.k=new ae(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Le.prototype._tmp=function(){var se=new ae(null);return se.words=new Array(Math.ceil(this.n/13)),se},Le.prototype.ireduce=function(se){var ce=se,de;do this.split(ce,this.tmp),ce=this.imulK(ce),ce=ce.iadd(this.tmp),de=ce.bitLength();while(de>this.n);var he=de<this.n?-1:ce.ucmp(this.p);return he===0?(ce.words[0]=0,ce.length=1):he>0?ce.isub(this.p):ce.strip!==void 0?ce.strip():ce._strip(),ce},Le.prototype.split=function(se,ce){se.iushrn(this.n,0,ce)},Le.prototype.imulK=function(se){return se.imul(this.k)};function He(){Le.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}fe(He,Le),He.prototype.split=function(se,ce){for(var de=4194303,he=Math.min(se.length,9),ve=0;ve<he;ve++)ce.words[ve]=se.words[ve];if(ce.length=he,se.length<=9){se.words[0]=0,se.length=1;return}var we=se.words[9];for(ce.words[ce.length++]=we&de,ve=10;ve<se.length;ve++){var Ae=se.words[ve]|0;se.words[ve-10]=(Ae&de)<<4|we>>>22,we=Ae}we>>>=22,se.words[ve-10]=we,we===0&&se.length>10?se.length-=10:se.length-=9},He.prototype.imulK=function(se){se.words[se.length]=0,se.words[se.length+1]=0,se.length+=2;for(var ce=0,de=0;de<se.length;de++){var he=se.words[de]|0;ce+=he*977,se.words[de]=ce&67108863,ce=he*64+(ce/67108864|0)}return se.words[se.length-1]===0&&(se.length--,se.words[se.length-1]===0&&se.length--),se};function ze(){Le.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}fe(ze,Le);function Je(){Le.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}fe(Je,Le);function Xe(){Le.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}fe(Xe,Le),Xe.prototype.imulK=function(se){for(var ce=0,de=0;de<se.length;de++){var he=(se.words[de]|0)*19+ce,ve=he&67108863;he>>>=26,se.words[de]=ve,ce=he}return ce!==0&&(se.words[se.length++]=ce),se},ae._prime=function(se){if(Fe[se])return Fe[se];var ce;if(se==="k256")ce=new He;else if(se==="p224")ce=new ze;else if(se==="p192")ce=new Je;else if(se==="p25519")ce=new Xe;else throw new Error("Unknown prime "+se);return Fe[se]=ce,ce};function Ue(_e){if(typeof _e=="string"){var se=ae._prime(_e);this.m=se.p,this.prime=se}else ie(_e.gtn(1),"modulus must be greater than 1"),this.m=_e,this.prime=null}Ue.prototype._verify1=function(se){ie(se.negative===0,"red works only with positives"),ie(se.red,"red works only with red numbers")},Ue.prototype._verify2=function(se,ce){ie((se.negative|ce.negative)===0,"red works only with positives"),ie(se.red&&se.red===ce.red,"red works only with red numbers")},Ue.prototype.imod=function(se){return this.prime?this.prime.ireduce(se)._forceRed(this):se.umod(this.m)._forceRed(this)},Ue.prototype.neg=function(se){return se.isZero()?se.clone():this.m.sub(se)._forceRed(this)},Ue.prototype.add=function(se,ce){this._verify2(se,ce);var de=se.add(ce);return de.cmp(this.m)>=0&&de.isub(this.m),de._forceRed(this)},Ue.prototype.iadd=function(se,ce){this._verify2(se,ce);var de=se.iadd(ce);return de.cmp(this.m)>=0&&de.isub(this.m),de},Ue.prototype.sub=function(se,ce){this._verify2(se,ce);var de=se.sub(ce);return de.cmpn(0)<0&&de.iadd(this.m),de._forceRed(this)},Ue.prototype.isub=function(se,ce){this._verify2(se,ce);var de=se.isub(ce);return de.cmpn(0)<0&&de.iadd(this.m),de},Ue.prototype.shl=function(se,ce){return this._verify1(se),this.imod(se.ushln(ce))},Ue.prototype.imul=function(se,ce){return this._verify2(se,ce),this.imod(se.imul(ce))},Ue.prototype.mul=function(se,ce){return this._verify2(se,ce),this.imod(se.mul(ce))},Ue.prototype.isqr=function(se){return this.imul(se,se.clone())},Ue.prototype.sqr=function(se){return this.mul(se,se)},Ue.prototype.sqrt=function(se){if(se.isZero())return se.clone();var ce=this.m.andln(3);if(ie(ce%2===1),ce===3){var de=this.m.add(new ae(1)).iushrn(2);return this.pow(se,de)}for(var he=this.m.subn(1),ve=0;!he.isZero()&&he.andln(1)===0;)ve++,he.iushrn(1);ie(!he.isZero());var we=new ae(1).toRed(this),Ae=we.redNeg(),be=this.m.subn(1).iushrn(1),ue=this.m.bitLength();for(ue=new ae(2*ue*ue).toRed(this);this.pow(ue,be).cmp(Ae)!==0;)ue.redIAdd(Ae);for(var ge=this.pow(ue,he),Re=this.pow(se,he.addn(1).iushrn(1)),Ne=this.pow(se,he),qe=ve;Ne.cmp(we)!==0;){for(var Pe=Ne,Ge=0;Pe.cmp(we)!==0;Ge++)Pe=Pe.redSqr();ie(Ge<qe);var Ce=this.pow(ge,new ae(1).iushln(qe-Ge-1));Re=Re.redMul(Ce),ge=Ce.redSqr(),Ne=Ne.redMul(ge),qe=Ge}return Re},Ue.prototype.invm=function(se){var ce=se._invmp(this.m);return ce.negative!==0?(ce.negative=0,this.imod(ce).redNeg()):this.imod(ce)},Ue.prototype.pow=function(se,ce){if(ce.isZero())return new ae(1).toRed(this);if(ce.cmpn(1)===0)return se.clone();var de=4,he=new Array(1<<de);he[0]=new ae(1).toRed(this),he[1]=se;for(var ve=2;ve<he.length;ve++)he[ve]=this.mul(he[ve-1],se);var we=he[0],Ae=0,be=0,ue=ce.bitLength()%26;for(ue===0&&(ue=26),ve=ce.length-1;ve>=0;ve--){for(var ge=ce.words[ve],Re=ue-1;Re>=0;Re--){var Ne=ge>>Re&1;if(we!==he[0]&&(we=this.sqr(we)),Ne===0&&Ae===0){be=0;continue}Ae<<=1,Ae|=Ne,be++,!(be!==de&&(ve!==0||Re!==0))&&(we=this.mul(we,he[Ae]),be=0,Ae=0)}ue=26}return we},Ue.prototype.convertTo=function(se){var ce=se.umod(this.m);return ce===se?ce.clone():ce},Ue.prototype.convertFrom=function(se){var ce=se.clone();return ce.red=null,ce},ae.mont=function(se){return new $t(se)};function $t(_e){Ue.call(this,_e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new ae(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}fe($t,Ue),$t.prototype.convertTo=function(se){return this.imod(se.ushln(this.shift))},$t.prototype.convertFrom=function(se){var ce=this.imod(se.mul(this.rinv));return ce.red=null,ce},$t.prototype.imul=function(se,ce){if(se.isZero()||ce.isZero())return se.words[0]=0,se.length=1,se;var de=se.imul(ce),he=de.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ve=de.isub(he).iushrn(this.shift),we=ve;return ve.cmp(this.m)>=0?we=ve.isub(this.m):ve.cmpn(0)<0&&(we=ve.iadd(this.m)),we._forceRed(this)},$t.prototype.mul=function(se,ce){if(se.isZero()||ce.isZero())return new ae(0)._forceRed(this);var de=se.mul(ce),he=de.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ve=de.isub(he).iushrn(this.shift),we=ve;return ve.cmp(this.m)>=0?we=ve.isub(this.m):ve.cmpn(0)<0&&(we=ve.iadd(this.m)),we._forceRed(this)},$t.prototype.invm=function(se){var ce=this.imod(se._invmp(this.m).mul(this.r2));return ce._forceRed(this)}})(c,commonjsGlobal)})(bn$7);var bnExports$2=bn$7.exports,Ens$1={},src$6={exports:{}},encode_1=encode$3,MSB$1=128,MSBALL=-128,INT=Math.pow(2,31);function encode$3(c,t,n){t=t||[],n=n||0;for(var ie=n;c>=INT;)t[n++]=c&255|MSB$1,c/=128;for(;c&MSBALL;)t[n++]=c&255|MSB$1,c>>>=7;return t[n]=c|0,encode$3.bytes=n-ie+1,t}var decode$4=read,MSB=128,REST=127;function read(c,ie){var n=0,ie=ie||0,fe=0,ae=ie,le,pe=c.length;do{if(ae>=pe)throw read.bytes=0,new RangeError("Could not decode varint");le=c[ae++],n+=fe<28?(le&REST)<<fe:(le&REST)*Math.pow(2,fe),fe+=7}while(le>=MSB);return read.bytes=ae-ie,n}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(c){return c<N1?1:c<N2?2:c<N3?3:c<N4?4:c<N5?5:c<N6?6:c<N7?7:c<N8?8:c<N9?9:10},varint$2={encode:encode_1,decode:decode$4,encodingLength:length};const identity$1=0,ip4$1=4,tcp$1=6,sha1$2=17,dccp$1=33,ip6$1=41,ip6zone$1=42,path$1=47,multicodec$2=48,multihash$1=49,multiaddr$1=50,multibase$2=51,dns$1=53,dns4$1=54,dns6$1=55,dnsaddr$1=56,protobuf$1=80,cbor$1=81,raw$1=85,rlp$1=96,bencode$1=99,sctp$1=132,md4$1=212,md5$2=213,bmt$1=214,zeronet$1=230,udp$1=273,udt$1=301,utp$1=302,unix$1=400,p2p$1=421,ipfs$1=421,https$1=443,onion$1=444,onion3$1=445,garlic64$1=446,garlic32$1=447,tls$1=448,quic$1=460,ws$1=477,wss$1=478,http$1=480,json$1=512,messagepack$1=513,x11$1=4352,require$$0$1={identity:identity$1,ip4:ip4$1,tcp:tcp$1,sha1:sha1$2,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,dccp:dccp$1,"murmur3-128":34,"murmur3-32":35,ip6:ip6$1,ip6zone:ip6zone$1,path:path$1,multicodec:multicodec$2,multihash:multihash$1,multiaddr:multiaddr$1,multibase:multibase$2,dns:dns$1,dns4:dns4$1,dns6:dns6$1,dnsaddr:dnsaddr$1,protobuf:protobuf$1,cbor:cbor$1,raw:raw$1,"dbl-sha2-256":86,rlp:rlp$1,bencode:bencode$1,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,sctp:sctp$1,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"bitcoin-block":176,"bitcoin-tx":177,"zcash-block":192,"zcash-tx":193,"stellar-block":208,"stellar-tx":209,md4:md4$1,md5:md5$2,bmt:bmt$1,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,zeronet:zeronet$1,"ed25519-pub":237,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,udp:udp$1,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,udt:udt$1,utp:utp$1,unix:unix$1,p2p:p2p$1,ipfs:ipfs$1,https:https$1,onion:onion$1,onion3:onion3$1,garlic64:garlic64$1,garlic32:garlic32$1,tls:tls$1,quic:quic$1,ws:ws$1,wss:wss$1,"p2p-websocket-star":479,http:http$1,json:json$1,messagepack:messagepack$1,x11:x11$1,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332},baseTable$3=require$$0$1,nameTable$1=new Map;for(const c in baseTable$3){const t=baseTable$3[c];nameTable$1.set(t,c)}var intTable$1=Object.freeze(nameTable$1);const varint$1=varint$2;var util$5={numberToBuffer:numberToBuffer$1,bufferToNumber:bufferToNumber$1,varintBufferEncode:varintBufferEncode$1,varintBufferDecode:varintBufferDecode$1,varintEncode:varintEncode$3};function bufferToNumber$1(c){return parseInt(c.toString("hex"),16)}function numberToBuffer$1(c){let t=c.toString(16);return t.length%2===1&&(t="0"+t),Buffer$7.from(t,"hex")}function varintBufferEncode$1(c){return Buffer$7.from(varint$1.encode(bufferToNumber$1(c)))}function varintBufferDecode$1(c){return numberToBuffer$1(varint$1.decode(c))}function varintEncode$3(c){return Buffer$7.from(varint$1.encode(c))}const baseTable$2=require$$0$1,varintEncode$2=util$5.varintEncode,varintTable$1={};for(const c in baseTable$2){const t=baseTable$2[c];varintTable$1[c]=varintEncode$2(t)}var varintTable_1$1=Object.freeze(varintTable$1),constants_1$3,hasRequiredConstants$2;function requireConstants$2(){if(hasRequiredConstants$2)return constants_1$3;hasRequiredConstants$2=1;const c=require$$0$1,t={};for(const[n,ie]of Object.entries(c))t[n.toUpperCase().replace(/-/g,"_")]=ie;return constants_1$3=Object.freeze(t),constants_1$3}var print$1,hasRequiredPrint$1;function requirePrint$1(){if(hasRequiredPrint$1)return print$1;hasRequiredPrint$1=1;const c=require$$0$1,t={};for(const[n,ie]of Object.entries(c))t[ie]===void 0&&(t[ie]=n);return print$1=Object.freeze(t),print$1}(function(c,t){const n=varint$2,ie=intTable$1,fe=varintTable_1$1,ae=util$5;t=c.exports,t.addPrefix=(pe,me)=>{let ye;if(Buffer$7.isBuffer(pe))ye=ae.varintBufferEncode(pe);else if(fe[pe])ye=fe[pe];else throw new Error("multicodec not recognized");return Buffer$7.concat([ye,me])},t.rmPrefix=pe=>(n.decode(pe),pe.slice(n.decode.bytes)),t.getCodec=pe=>{const me=n.decode(pe),ye=ie.get(me);if(ye===void 0)throw new Error(`Code ${me} not found`);return ye},t.getName=pe=>ie.get(pe),t.getNumber=pe=>{const me=fe[pe];if(me===void 0)throw new Error("Codec `"+pe+"` not found");return ae.varintBufferDecode(me)[0]},t.getCode=pe=>n.decode(pe),t.getCodeVarint=pe=>{const me=fe[pe];if(me===void 0)throw new Error("Codec `"+pe+"` not found");return me},t.getVarint=pe=>n.encode(pe);const le=requireConstants$2();Object.assign(t,le),t.print=requirePrint$1()})(src$6,src$6.exports);var srcExports$3=src$6.exports,profiles$2={},src$5={},src$4={exports:{}};let Base$6=class{constructor(t,n,ie,fe){this.name=t,this.code=n,this.alphabet=fe,ie&&fe&&(this.engine=ie(fe))}encode(t){return this.engine.encode(t)}decode(t){return this.engine.decode(t)}isImplemented(){return this.engine}};var base$3=Base$6;const{Buffer:Buffer$6}=dist$1;var base16$3=function(t){return{encode(n){return typeof n=="string"?Buffer$6.from(n).toString("hex"):n.toString("hex")},decode(n){for(const ie of n)if(t.indexOf(ie)<0)throw new Error("invalid base16 character");return Buffer$6.from(n,"hex")}}};function decode$3(c,t){c=c.replace(new RegExp("=","g"),"");const n=c.length;let ie=0,fe=0,ae=0;const le=new Uint8Array(n*5/8|0);for(let pe=0;pe<n;pe++)fe=fe<<5|t.indexOf(c[pe]),ie+=5,ie>=8&&(le[ae++]=fe>>>ie-8&255,ie-=8);return le.buffer}function encode$2(c,t){const n=c.byteLength,ie=new Uint8Array(c),fe=t.indexOf("=")===t.length-1;fe&&(t=t.substring(0,t.length-1));let ae=0,le=0,pe="";for(let me=0;me<n;me++)for(le=le<<8|ie[me],ae+=8;ae>=5;)pe+=t[le>>>ae-5&31],ae-=5;if(ae>0&&(pe+=t[le<<5-ae&31]),fe)for(;pe.length%8!==0;)pe+="=";return pe}var base32$3=function(t){return{encode(n){return encode$2(typeof n=="string"?Uint8Array.from(n):n,t)},decode(n){for(const ie of n)if(t.indexOf(ie)<0)throw new Error("invalid base32 character");return decode$3(n,t)}}};const{Buffer:Buffer$5}=dist$1;var base64$3=function(t){const n=t.indexOf("=")>-1,ie=t.indexOf("-")>-1&&t.indexOf("_")>-1;return{encode(fe){let ae="";typeof fe=="string"?ae=Buffer$5.from(fe).toString("base64"):ae=fe.toString("base64"),ie&&(ae=ae.replace(/\+/g,"-").replace(/\//g,"_"));const le=ae.indexOf("=");return le>0&&!n&&(ae=ae.substring(0,le)),ae},decode(fe){for(const ae of fe)if(t.indexOf(ae)<0)throw new Error("invalid base64 character");return Buffer$5.from(fe,"base64")}}};const Base$5=base$3,baseX$1=src$7,base16$2=base16$3,base32$2=base32$3,base64$2=base64$3,constants$3=[["base1","1","","1"],["base2","0",baseX$1,"01"],["base8","7",baseX$1,"01234567"],["base10","9",baseX$1,"0123456789"],["base16","f",base16$2,"0123456789abcdef"],["base32","b",base32$2,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",base32$2,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",base32$2,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",base32$2,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",base32$2,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",baseX$1,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",baseX$1,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",base64$2,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",base64$2,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",base64$2,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",base64$2,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],names$1=constants$3.reduce((c,t)=>(c[t[0]]=new Base$5(t[0],t[1],t[2],t[3]),c),{}),codes$1=constants$3.reduce((c,t)=>(c[t[1]]=names$1[t[0]],c),{});var constants_1$2={names:names$1,codes:codes$1};(function(c,t){const{Buffer:n}=dist$1,ie=constants_1$2;t=c.exports=fe,t.encode=ae,t.decode=le,t.isEncoded=pe,t.names=Object.freeze(Object.keys(ie.names)),t.codes=Object.freeze(Object.keys(ie.codes));function fe(xe,Ee){if(!Ee)throw new Error("requires an encoded buffer");const Se=ye(xe),Me=n.from(Se.code),Be=Se.name;return me(Be,Ee),n.concat([Me,Ee])}function ae(xe,Ee){const Se=ye(xe),Me=Se.name;return fe(Me,n.from(Se.encode(Ee)))}function le(xe){n.isBuffer(xe)&&(xe=xe.toString());const Ee=xe.substring(0,1);xe=xe.substring(1,xe.length),typeof xe=="string"&&(xe=n.from(xe));const Se=ye(Ee);return n.from(Se.decode(xe.toString()))}function pe(xe){if(n.isBuffer(xe)&&(xe=xe.toString()),Object.prototype.toString.call(xe)!=="[object String]")return!1;const Ee=xe.substring(0,1);try{return ye(Ee).name}catch{return!1}}function me(xe,Ee){ye(xe).decode(Ee.toString())}function ye(xe){let Ee;if(ie.names[xe])Ee=ie.names[xe];else if(ie.codes[xe])Ee=ie.codes[xe];else throw new Error("Unsupported encoding");if(!Ee.isImplemented())throw new Error("Base "+xe+" is not implemented yet");return Ee}})(src$4,src$4.exports);var srcExports$2=src$4.exports,constants$2={};constants$2.names=Object.freeze({identity:0,sha1:17,"sha2-256":18,"sha2-512":19,"dbl-sha2-256":86,"sha3-224":23,"sha3-256":22,"sha3-384":21,"sha3-512":20,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,"murmur3-128":34,"murmur3-32":35,md4:212,md5:213,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"Skein256-8":45825,"Skein256-16":45826,"Skein256-24":45827,"Skein256-32":45828,"Skein256-40":45829,"Skein256-48":45830,"Skein256-56":45831,"Skein256-64":45832,"Skein256-72":45833,"Skein256-80":45834,"Skein256-88":45835,"Skein256-96":45836,"Skein256-104":45837,"Skein256-112":45838,"Skein256-120":45839,"Skein256-128":45840,"Skein256-136":45841,"Skein256-144":45842,"Skein256-152":45843,"Skein256-160":45844,"Skein256-168":45845,"Skein256-176":45846,"Skein256-184":45847,"Skein256-192":45848,"Skein256-200":45849,"Skein256-208":45850,"Skein256-216":45851,"Skein256-224":45852,"Skein256-232":45853,"Skein256-240":45854,"Skein256-248":45855,"Skein256-256":45856,"Skein512-8":45857,"Skein512-16":45858,"Skein512-24":45859,"Skein512-32":45860,"Skein512-40":45861,"Skein512-48":45862,"Skein512-56":45863,"Skein512-64":45864,"Skein512-72":45865,"Skein512-80":45866,"Skein512-88":45867,"Skein512-96":45868,"Skein512-104":45869,"Skein512-112":45870,"Skein512-120":45871,"Skein512-128":45872,"Skein512-136":45873,"Skein512-144":45874,"Skein512-152":45875,"Skein512-160":45876,"Skein512-168":45877,"Skein512-176":45878,"Skein512-184":45879,"Skein512-192":45880,"Skein512-200":45881,"Skein512-208":45882,"Skein512-216":45883,"Skein512-224":45884,"Skein512-232":45885,"Skein512-240":45886,"Skein512-248":45887,"Skein512-256":45888,"Skein512-264":45889,"Skein512-272":45890,"Skein512-280":45891,"Skein512-288":45892,"Skein512-296":45893,"Skein512-304":45894,"Skein512-312":45895,"Skein512-320":45896,"Skein512-328":45897,"Skein512-336":45898,"Skein512-344":45899,"Skein512-352":45900,"Skein512-360":45901,"Skein512-368":45902,"Skein512-376":45903,"Skein512-384":45904,"Skein512-392":45905,"Skein512-400":45906,"Skein512-408":45907,"Skein512-416":45908,"Skein512-424":45909,"Skein512-432":45910,"Skein512-440":45911,"Skein512-448":45912,"Skein512-456":45913,"Skein512-464":45914,"Skein512-472":45915,"Skein512-480":45916,"Skein512-488":45917,"Skein512-496":45918,"Skein512-504":45919,"Skein512-512":45920,"Skein1024-8":45921,"Skein1024-16":45922,"Skein1024-24":45923,"Skein1024-32":45924,"Skein1024-40":45925,"Skein1024-48":45926,"Skein1024-56":45927,"Skein1024-64":45928,"Skein1024-72":45929,"Skein1024-80":45930,"Skein1024-88":45931,"Skein1024-96":45932,"Skein1024-104":45933,"Skein1024-112":45934,"Skein1024-120":45935,"Skein1024-128":45936,"Skein1024-136":45937,"Skein1024-144":45938,"Skein1024-152":45939,"Skein1024-160":45940,"Skein1024-168":45941,"Skein1024-176":45942,"Skein1024-184":45943,"Skein1024-192":45944,"Skein1024-200":45945,"Skein1024-208":45946,"Skein1024-216":45947,"Skein1024-224":45948,"Skein1024-232":45949,"Skein1024-240":45950,"Skein1024-248":45951,"Skein1024-256":45952,"Skein1024-264":45953,"Skein1024-272":45954,"Skein1024-280":45955,"Skein1024-288":45956,"Skein1024-296":45957,"Skein1024-304":45958,"Skein1024-312":45959,"Skein1024-320":45960,"Skein1024-328":45961,"Skein1024-336":45962,"Skein1024-344":45963,"Skein1024-352":45964,"Skein1024-360":45965,"Skein1024-368":45966,"Skein1024-376":45967,"Skein1024-384":45968,"Skein1024-392":45969,"Skein1024-400":45970,"Skein1024-408":45971,"Skein1024-416":45972,"Skein1024-424":45973,"Skein1024-432":45974,"Skein1024-440":45975,"Skein1024-448":45976,"Skein1024-456":45977,"Skein1024-464":45978,"Skein1024-472":45979,"Skein1024-480":45980,"Skein1024-488":45981,"Skein1024-496":45982,"Skein1024-504":45983,"Skein1024-512":45984,"Skein1024-520":45985,"Skein1024-528":45986,"Skein1024-536":45987,"Skein1024-544":45988,"Skein1024-552":45989,"Skein1024-560":45990,"Skein1024-568":45991,"Skein1024-576":45992,"Skein1024-584":45993,"Skein1024-592":45994,"Skein1024-600":45995,"Skein1024-608":45996,"Skein1024-616":45997,"Skein1024-624":45998,"Skein1024-632":45999,"Skein1024-640":46e3,"Skein1024-648":46001,"Skein1024-656":46002,"Skein1024-664":46003,"Skein1024-672":46004,"Skein1024-680":46005,"Skein1024-688":46006,"Skein1024-696":46007,"Skein1024-704":46008,"Skein1024-712":46009,"Skein1024-720":46010,"Skein1024-728":46011,"Skein1024-736":46012,"Skein1024-744":46013,"Skein1024-752":46014,"Skein1024-760":46015,"Skein1024-768":46016,"Skein1024-776":46017,"Skein1024-784":46018,"Skein1024-792":46019,"Skein1024-800":46020,"Skein1024-808":46021,"Skein1024-816":46022,"Skein1024-824":46023,"Skein1024-832":46024,"Skein1024-840":46025,"Skein1024-848":46026,"Skein1024-856":46027,"Skein1024-864":46028,"Skein1024-872":46029,"Skein1024-880":46030,"Skein1024-888":46031,"Skein1024-896":46032,"Skein1024-904":46033,"Skein1024-912":46034,"Skein1024-920":46035,"Skein1024-928":46036,"Skein1024-936":46037,"Skein1024-944":46038,"Skein1024-952":46039,"Skein1024-960":46040,"Skein1024-968":46041,"Skein1024-976":46042,"Skein1024-984":46043,"Skein1024-992":46044,"Skein1024-1000":46045,"Skein1024-1008":46046,"Skein1024-1016":46047,"Skein1024-1024":46048});constants$2.codes=Object.freeze({0:"identity",17:"sha1",18:"sha2-256",19:"sha2-512",86:"dbl-sha2-256",23:"sha3-224",22:"sha3-256",21:"sha3-384",20:"sha3-512",24:"shake-128",25:"shake-256",26:"keccak-224",27:"keccak-256",28:"keccak-384",29:"keccak-512",34:"murmur3-128",35:"murmur3-32",212:"md4",213:"md5",45569:"blake2b-8",45570:"blake2b-16",45571:"blake2b-24",45572:"blake2b-32",45573:"blake2b-40",45574:"blake2b-48",45575:"blake2b-56",45576:"blake2b-64",45577:"blake2b-72",45578:"blake2b-80",45579:"blake2b-88",45580:"blake2b-96",45581:"blake2b-104",45582:"blake2b-112",45583:"blake2b-120",45584:"blake2b-128",45585:"blake2b-136",45586:"blake2b-144",45587:"blake2b-152",45588:"blake2b-160",45589:"blake2b-168",45590:"blake2b-176",45591:"blake2b-184",45592:"blake2b-192",45593:"blake2b-200",45594:"blake2b-208",45595:"blake2b-216",45596:"blake2b-224",45597:"blake2b-232",45598:"blake2b-240",45599:"blake2b-248",45600:"blake2b-256",45601:"blake2b-264",45602:"blake2b-272",45603:"blake2b-280",45604:"blake2b-288",45605:"blake2b-296",45606:"blake2b-304",45607:"blake2b-312",45608:"blake2b-320",45609:"blake2b-328",45610:"blake2b-336",45611:"blake2b-344",45612:"blake2b-352",45613:"blake2b-360",45614:"blake2b-368",45615:"blake2b-376",45616:"blake2b-384",45617:"blake2b-392",45618:"blake2b-400",45619:"blake2b-408",45620:"blake2b-416",45621:"blake2b-424",45622:"blake2b-432",45623:"blake2b-440",45624:"blake2b-448",45625:"blake2b-456",45626:"blake2b-464",45627:"blake2b-472",45628:"blake2b-480",45629:"blake2b-488",45630:"blake2b-496",45631:"blake2b-504",45632:"blake2b-512",45633:"blake2s-8",45634:"blake2s-16",45635:"blake2s-24",45636:"blake2s-32",45637:"blake2s-40",45638:"blake2s-48",45639:"blake2s-56",45640:"blake2s-64",45641:"blake2s-72",45642:"blake2s-80",45643:"blake2s-88",45644:"blake2s-96",45645:"blake2s-104",45646:"blake2s-112",45647:"blake2s-120",45648:"blake2s-128",45649:"blake2s-136",45650:"blake2s-144",45651:"blake2s-152",45652:"blake2s-160",45653:"blake2s-168",45654:"blake2s-176",45655:"blake2s-184",45656:"blake2s-192",45657:"blake2s-200",45658:"blake2s-208",45659:"blake2s-216",45660:"blake2s-224",45661:"blake2s-232",45662:"blake2s-240",45663:"blake2s-248",45664:"blake2s-256",45825:"Skein256-8",45826:"Skein256-16",45827:"Skein256-24",45828:"Skein256-32",45829:"Skein256-40",45830:"Skein256-48",45831:"Skein256-56",45832:"Skein256-64",45833:"Skein256-72",45834:"Skein256-80",45835:"Skein256-88",45836:"Skein256-96",45837:"Skein256-104",45838:"Skein256-112",45839:"Skein256-120",45840:"Skein256-128",45841:"Skein256-136",45842:"Skein256-144",45843:"Skein256-152",45844:"Skein256-160",45845:"Skein256-168",45846:"Skein256-176",45847:"Skein256-184",45848:"Skein256-192",45849:"Skein256-200",45850:"Skein256-208",45851:"Skein256-216",45852:"Skein256-224",45853:"Skein256-232",45854:"Skein256-240",45855:"Skein256-248",45856:"Skein256-256",45857:"Skein512-8",45858:"Skein512-16",45859:"Skein512-24",45860:"Skein512-32",45861:"Skein512-40",45862:"Skein512-48",45863:"Skein512-56",45864:"Skein512-64",45865:"Skein512-72",45866:"Skein512-80",45867:"Skein512-88",45868:"Skein512-96",45869:"Skein512-104",45870:"Skein512-112",45871:"Skein512-120",45872:"Skein512-128",45873:"Skein512-136",45874:"Skein512-144",45875:"Skein512-152",45876:"Skein512-160",45877:"Skein512-168",45878:"Skein512-176",45879:"Skein512-184",45880:"Skein512-192",45881:"Skein512-200",45882:"Skein512-208",45883:"Skein512-216",45884:"Skein512-224",45885:"Skein512-232",45886:"Skein512-240",45887:"Skein512-248",45888:"Skein512-256",45889:"Skein512-264",45890:"Skein512-272",45891:"Skein512-280",45892:"Skein512-288",45893:"Skein512-296",45894:"Skein512-304",45895:"Skein512-312",45896:"Skein512-320",45897:"Skein512-328",45898:"Skein512-336",45899:"Skein512-344",45900:"Skein512-352",45901:"Skein512-360",45902:"Skein512-368",45903:"Skein512-376",45904:"Skein512-384",45905:"Skein512-392",45906:"Skein512-400",45907:"Skein512-408",45908:"Skein512-416",45909:"Skein512-424",45910:"Skein512-432",45911:"Skein512-440",45912:"Skein512-448",45913:"Skein512-456",45914:"Skein512-464",45915:"Skein512-472",45916:"Skein512-480",45917:"Skein512-488",45918:"Skein512-496",45919:"Skein512-504",45920:"Skein512-512",45921:"Skein1024-8",45922:"Skein1024-16",45923:"Skein1024-24",45924:"Skein1024-32",45925:"Skein1024-40",45926:"Skein1024-48",45927:"Skein1024-56",45928:"Skein1024-64",45929:"Skein1024-72",45930:"Skein1024-80",45931:"Skein1024-88",45932:"Skein1024-96",45933:"Skein1024-104",45934:"Skein1024-112",45935:"Skein1024-120",45936:"Skein1024-128",45937:"Skein1024-136",45938:"Skein1024-144",45939:"Skein1024-152",45940:"Skein1024-160",45941:"Skein1024-168",45942:"Skein1024-176",45943:"Skein1024-184",45944:"Skein1024-192",45945:"Skein1024-200",45946:"Skein1024-208",45947:"Skein1024-216",45948:"Skein1024-224",45949:"Skein1024-232",45950:"Skein1024-240",45951:"Skein1024-248",45952:"Skein1024-256",45953:"Skein1024-264",45954:"Skein1024-272",45955:"Skein1024-280",45956:"Skein1024-288",45957:"Skein1024-296",45958:"Skein1024-304",45959:"Skein1024-312",45960:"Skein1024-320",45961:"Skein1024-328",45962:"Skein1024-336",45963:"Skein1024-344",45964:"Skein1024-352",45965:"Skein1024-360",45966:"Skein1024-368",45967:"Skein1024-376",45968:"Skein1024-384",45969:"Skein1024-392",45970:"Skein1024-400",45971:"Skein1024-408",45972:"Skein1024-416",45973:"Skein1024-424",45974:"Skein1024-432",45975:"Skein1024-440",45976:"Skein1024-448",45977:"Skein1024-456",45978:"Skein1024-464",45979:"Skein1024-472",45980:"Skein1024-480",45981:"Skein1024-488",45982:"Skein1024-496",45983:"Skein1024-504",45984:"Skein1024-512",45985:"Skein1024-520",45986:"Skein1024-528",45987:"Skein1024-536",45988:"Skein1024-544",45989:"Skein1024-552",45990:"Skein1024-560",45991:"Skein1024-568",45992:"Skein1024-576",45993:"Skein1024-584",45994:"Skein1024-592",45995:"Skein1024-600",45996:"Skein1024-608",45997:"Skein1024-616",45998:"Skein1024-624",45999:"Skein1024-632",46e3:"Skein1024-640",46001:"Skein1024-648",46002:"Skein1024-656",46003:"Skein1024-664",46004:"Skein1024-672",46005:"Skein1024-680",46006:"Skein1024-688",46007:"Skein1024-696",46008:"Skein1024-704",46009:"Skein1024-712",46010:"Skein1024-720",46011:"Skein1024-728",46012:"Skein1024-736",46013:"Skein1024-744",46014:"Skein1024-752",46015:"Skein1024-760",46016:"Skein1024-768",46017:"Skein1024-776",46018:"Skein1024-784",46019:"Skein1024-792",46020:"Skein1024-800",46021:"Skein1024-808",46022:"Skein1024-816",46023:"Skein1024-824",46024:"Skein1024-832",46025:"Skein1024-840",46026:"Skein1024-848",46027:"Skein1024-856",46028:"Skein1024-864",46029:"Skein1024-872",46030:"Skein1024-880",46031:"Skein1024-888",46032:"Skein1024-896",46033:"Skein1024-904",46034:"Skein1024-912",46035:"Skein1024-920",46036:"Skein1024-928",46037:"Skein1024-936",46038:"Skein1024-944",46039:"Skein1024-952",46040:"Skein1024-960",46041:"Skein1024-968",46042:"Skein1024-976",46043:"Skein1024-984",46044:"Skein1024-992",46045:"Skein1024-1000",46046:"Skein1024-1008",46047:"Skein1024-1016",46048:"Skein1024-1024"});constants$2.defaultLengths=Object.freeze({17:20,18:32,19:64,86:32,23:28,22:32,21:48,20:64,24:32,25:64,26:28,27:32,28:48,29:64,34:32,45569:1,45570:2,45571:3,45572:4,45573:5,45574:6,45575:7,45576:8,45577:9,45578:10,45579:11,45580:12,45581:13,45582:14,45583:15,45584:16,45585:17,45586:18,45587:19,45588:20,45589:21,45590:22,45591:23,45592:24,45593:25,45594:26,45595:27,45596:28,45597:29,45598:30,45599:31,45600:32,45601:33,45602:34,45603:35,45604:36,45605:37,45606:38,45607:39,45608:40,45609:41,45610:42,45611:43,45612:44,45613:45,45614:46,45615:47,45616:48,45617:49,45618:50,45619:51,45620:52,45621:53,45622:54,45623:55,45624:56,45625:57,45626:58,45627:59,45628:60,45629:61,45630:62,45631:63,45632:64,45633:1,45634:2,45635:3,45636:4,45637:5,45638:6,45639:7,45640:8,45641:9,45642:10,45643:11,45644:12,45645:13,45646:14,45647:15,45648:16,45649:17,45650:18,45651:19,45652:20,45653:21,45654:22,45655:23,45656:24,45657:25,45658:26,45659:27,45660:28,45661:29,45662:30,45663:31,45664:32,45825:1,45826:2,45827:3,45828:4,45829:5,45830:6,45831:7,45832:8,45833:9,45834:10,45835:11,45836:12,45837:13,45838:14,45839:15,45840:16,45841:17,45842:18,45843:19,45844:20,45845:21,45846:22,45847:23,45848:24,45849:25,45850:26,45851:27,45852:28,45853:29,45854:30,45855:31,45856:32,45857:1,45858:2,45859:3,45860:4,45861:5,45862:6,45863:7,45864:8,45865:9,45866:10,45867:11,45868:12,45869:13,45870:14,45871:15,45872:16,45873:17,45874:18,45875:19,45876:20,45877:21,45878:22,45879:23,45880:24,45881:25,45882:26,45883:27,45884:28,45885:29,45886:30,45887:31,45888:32,45889:33,45890:34,45891:35,45892:36,45893:37,45894:38,45895:39,45896:40,45897:41,45898:42,45899:43,45900:44,45901:45,45902:46,45903:47,45904:48,45905:49,45906:50,45907:51,45908:52,45909:53,45910:54,45911:55,45912:56,45913:57,45914:58,45915:59,45916:60,45917:61,45918:62,45919:63,45920:64,45921:1,45922:2,45923:3,45924:4,45925:5,45926:6,45927:7,45928:8,45929:9,45930:10,45931:11,45932:12,45933:13,45934:14,45935:15,45936:16,45937:17,45938:18,45939:19,45940:20,45941:21,45942:22,45943:23,45944:24,45945:25,45946:26,45947:27,45948:28,45949:29,45950:30,45951:31,45952:32,45953:33,45954:34,45955:35,45956:36,45957:37,45958:38,45959:39,45960:40,45961:41,45962:42,45963:43,45964:44,45965:45,45966:46,45967:47,45968:48,45969:49,45970:50,45971:51,45972:52,45973:53,45974:54,45975:55,45976:56,45977:57,45978:58,45979:59,45980:60,45981:61,45982:62,45983:63,45984:64,45985:65,45986:66,45987:67,45988:68,45989:69,45990:70,45991:71,45992:72,45993:73,45994:74,45995:75,45996:76,45997:77,45998:78,45999:79,46e3:80,46001:81,46002:82,46003:83,46004:84,46005:85,46006:86,46007:87,46008:88,46009:89,46010:90,46011:91,46012:92,46013:93,46014:94,46015:95,46016:96,46017:97,46018:98,46019:99,46020:100,46021:101,46022:102,46023:103,46024:104,46025:105,46026:106,46027:107,46028:108,46029:109,46030:110,46031:111,46032:112,46033:113,46034:114,46035:115,46036:116,46037:117,46038:118,46039:119,46040:120,46041:121,46042:122,46043:123,46044:124,46045:125,46046:126,46047:127,46048:128});(function(c){const{Buffer:t}=dist$1,n=srcExports$2,ie=varint$2,fe=constants$2;c.names=fe.names,c.codes=fe.codes,c.defaultLengths=fe.defaultLengths,c.toHexString=function(pe){if(!t.isBuffer(pe))throw new Error("must be passed a buffer");return pe.toString("hex")},c.fromHexString=function(pe){return t.from(pe,"hex")},c.toB58String=function(pe){if(!t.isBuffer(pe))throw new Error("must be passed a buffer");return n.encode("base58btc",pe).toString().slice(1)},c.fromB58String=function(pe){let me=pe;return t.isBuffer(pe)&&(me=pe.toString()),n.decode("z"+me)},c.decode=function(pe){if(!t.isBuffer(pe))throw new Error("multihash must be a Buffer");if(pe.length<2)throw new Error("multihash too short. must be > 2 bytes.");const me=ie.decode(pe);if(!c.isValidCode(me))throw new Error(`multihash unknown function code: 0x${me.toString(16)}`);pe=pe.slice(ie.decode.bytes);const ye=ie.decode(pe);if(ye<0)throw new Error(`multihash invalid length: ${ye}`);if(pe=pe.slice(ie.decode.bytes),pe.length!==ye)throw new Error(`multihash length inconsistent: 0x${pe.toString("hex")}`);return{code:me,name:fe.codes[me],length:ye,digest:pe}},c.encode=function(pe,me,ye){if(!pe||me===void 0)throw new Error("multihash encode requires at least two args: digest, code");const xe=c.coerceCode(me);if(!t.isBuffer(pe))throw new Error("digest should be a Buffer");if(ye==null&&(ye=pe.length),ye&&pe.length!==ye)throw new Error("digest length should be equal to specified length.");return t.concat([t.from(ie.encode(xe)),t.from(ie.encode(ye)),pe])},c.coerceCode=function(pe){let me=pe;if(typeof pe=="string"){if(fe.names[pe]===void 0)throw new Error(`Unrecognized hash function named: ${pe}`);me=fe.names[pe]}if(typeof me!="number")throw new Error(`Hash function code should be a number. Got: ${me}`);if(fe.codes[me]===void 0&&!c.isAppCode(me))throw new Error(`Unrecognized function code: ${me}`);return me},c.isAppCode=function(pe){return pe>0&&pe<16},c.isValidCode=function(pe){return!!(c.isAppCode(pe)||fe.codes[pe])};function ae(le){c.decode(le)}c.validate=ae,c.prefix=function(pe){return ae(pe),pe.slice(0,2)}})(src$5);var src$3={exports:{}};let Base$4=class{constructor(t,n,ie,fe){this.name=t,this.code=n,this.alphabet=fe,ie&&fe&&(this.engine=ie(fe))}encode(t){return this.engine.encode(t)}decode(t){return this.engine.decode(t)}isImplemented(){return this.engine}};var base$2=Base$4;const{Buffer:Buffer$4}=dist$1;var base16$1=function(t){return{encode(n){return typeof n=="string"?Buffer$4.from(n).toString("hex"):n.toString("hex")},decode(n){for(const ie of n)if(t.indexOf(ie)<0)throw new Error("invalid base16 character");return Buffer$4.from(n,"hex")}}};function decode$2(c,t){c=c.replace(new RegExp("=","g"),"");const n=c.length;let ie=0,fe=0,ae=0;const le=new Uint8Array(n*5/8|0);for(let pe=0;pe<n;pe++)fe=fe<<5|t.indexOf(c[pe]),ie+=5,ie>=8&&(le[ae++]=fe>>>ie-8&255,ie-=8);return le.buffer}function encode$1(c,t){const n=c.byteLength,ie=new Uint8Array(c),fe=t.indexOf("=")===t.length-1;fe&&(t=t.substring(0,t.length-1));let ae=0,le=0,pe="";for(let me=0;me<n;me++)for(le=le<<8|ie[me],ae+=8;ae>=5;)pe+=t[le>>>ae-5&31],ae-=5;if(ae>0&&(pe+=t[le<<5-ae&31]),fe)for(;pe.length%8!==0;)pe+="=";return pe}var base32$1=function(t){return{encode(n){return encode$1(typeof n=="string"?Uint8Array.from(n):n,t)},decode(n){for(const ie of n)if(t.indexOf(ie)<0)throw new Error("invalid base32 character");return decode$2(n,t)}}};const{Buffer:Buffer$3}=dist$1;var base64$1=function(t){const n=t.indexOf("=")>-1,ie=t.indexOf("-")>-1&&t.indexOf("_")>-1;return{encode(fe){let ae="";typeof fe=="string"?ae=Buffer$3.from(fe).toString("base64"):ae=fe.toString("base64"),ie&&(ae=ae.replace(/\+/g,"-").replace(/\//g,"_"));const le=ae.indexOf("=");return le>0&&!n&&(ae=ae.substring(0,le)),ae},decode(fe){for(const ae of fe)if(t.indexOf(ae)<0)throw new Error("invalid base64 character");return Buffer$3.from(fe,"base64")}}};const Base$3=base$2,baseX=src$7,base16=base16$1,base32=base32$1,base64=base64$1,constants$1=[["base1","1","","1"],["base2","0",baseX,"01"],["base8","7",baseX,"01234567"],["base10","9",baseX,"0123456789"],["base16","f",base16,"0123456789abcdef"],["base32","b",base32,"abcdefghijklmnopqrstuvwxyz234567"],["base32pad","c",base32,"abcdefghijklmnopqrstuvwxyz234567="],["base32hex","v",base32,"0123456789abcdefghijklmnopqrstuv"],["base32hexpad","t",base32,"0123456789abcdefghijklmnopqrstuv="],["base32z","h",base32,"ybndrfg8ejkmcpqxot1uwisza345h769"],["base58flickr","Z",baseX,"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"],["base58btc","z",baseX,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"],["base64","m",base64,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"],["base64pad","M",base64,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],["base64url","u",base64,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"],["base64urlpad","U",base64,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="]],names=constants$1.reduce((c,t)=>(c[t[0]]=new Base$3(t[0],t[1],t[2],t[3]),c),{}),codes=constants$1.reduce((c,t)=>(c[t[1]]=names[t[0]],c),{});var constants_1$1={names,codes};(function(c,t){const{Buffer:n}=dist$1,ie=constants_1$1;t=c.exports=ae,t.encode=le,t.decode=pe,t.isEncoded=me,t.names=Object.freeze(Object.keys(ie.names)),t.codes=Object.freeze(Object.keys(ie.codes));const fe=new Error("Unsupported encoding");function ae(Ee,Se){if(!Se)throw new Error("requires an encoded buffer");const Me=xe(Ee),Be=n.from(Me.code),$e=Me.name;return ye($e,Se),n.concat([Be,Se])}function le(Ee,Se){const Me=xe(Ee),Be=Me.name;return ae(Be,n.from(Me.encode(Se)))}function pe(Ee){n.isBuffer(Ee)&&(Ee=Ee.toString());const Se=Ee.substring(0,1);Ee=Ee.substring(1,Ee.length),typeof Ee=="string"&&(Ee=n.from(Ee));const Me=xe(Se);return n.from(Me.decode(Ee.toString()))}function me(Ee){if(n.isBuffer(Ee)&&(Ee=Ee.toString()),Object.prototype.toString.call(Ee)!=="[object String]")return!1;const Se=Ee.substring(0,1);try{return xe(Se).name}catch{return!1}}function ye(Ee,Se){xe(Ee).decode(Se.toString())}function xe(Ee){let Se;if(ie.names[Ee])Se=ie.names[Ee];else if(ie.codes[Ee])Se=ie.codes[Ee];else throw fe;if(!Se.isImplemented())throw new Error("Base "+Ee+" is not implemented yet");return Se}})(src$3,src$3.exports);var srcExports$1=src$3.exports,src$2={exports:{}};const identity=0,ip4=4,tcp=6,sha1$1=17,blake3=30,dccp=33,ip6=41,ip6zone=42,path=47,multicodec$1=48,multihash=49,multiaddr=50,multibase$1=51,dns=53,dns4=54,dns6=55,dnsaddr=56,protobuf=80,cbor=81,raw=85,rlp=96,bencode=99,sctp=132,md4=212,md5$1=213,bmt=214,zeronet=230,udp=273,udt=301,utp=302,unix=400,p2p=421,ipfs=421,https=443,onion=444,onion3=445,garlic64=446,garlic32=447,tls=448,quic=460,ws=477,wss=478,http=480,json=512,messagepack=513,x11=4352,require$$4$2={identity,ip4,tcp,sha1:sha1$1,"sha2-256":18,"sha2-512":19,"sha3-512":20,"sha3-384":21,"sha3-256":22,"sha3-224":23,"shake-128":24,"shake-256":25,"keccak-224":26,"keccak-256":27,"keccak-384":28,"keccak-512":29,blake3,dccp,"murmur3-128":34,"murmur3-32":35,ip6,ip6zone,path,multicodec:multicodec$1,multihash,multiaddr,multibase:multibase$1,dns,dns4,dns6,dnsaddr,protobuf,cbor,raw,"dbl-sha2-256":86,rlp,bencode,"dag-pb":112,"dag-cbor":113,"libp2p-key":114,"git-raw":120,"torrent-info":123,"torrent-file":124,"leofcoin-block":129,"leofcoin-tx":130,"leofcoin-pr":131,sctp,"dag-jose":133,"dag-cose":134,"eth-block":144,"eth-block-list":145,"eth-tx-trie":146,"eth-tx":147,"eth-tx-receipt-trie":148,"eth-tx-receipt":149,"eth-state-trie":150,"eth-account-snapshot":151,"eth-storage-trie":152,"bitcoin-block":176,"bitcoin-tx":177,"bitcoin-witness-commitment":178,"zcash-block":192,"zcash-tx":193,"stellar-block":208,"stellar-tx":209,md4,md5:md5$1,bmt,"decred-block":224,"decred-tx":225,"ipld-ns":226,"ipfs-ns":227,"swarm-ns":228,"ipns-ns":229,zeronet,"secp256k1-pub":231,"bls12_381-g1-pub":234,"bls12_381-g2-pub":235,"x25519-pub":236,"ed25519-pub":237,"dash-block":240,"dash-tx":241,"swarm-manifest":250,"swarm-feed":251,udp,"p2p-webrtc-star":275,"p2p-webrtc-direct":276,"p2p-stardust":277,"p2p-circuit":290,"dag-json":297,udt,utp,unix,p2p,ipfs,https,onion,onion3,garlic64,garlic32,tls,quic,ws,wss,"p2p-websocket-star":479,http,json,messagepack,"libp2p-peer-record":769,"sha2-256-trunc254-padded":4114,"ripemd-128":4178,"ripemd-160":4179,"ripemd-256":4180,"ripemd-320":4181,x11,"sm3-256":21325,"blake2b-8":45569,"blake2b-16":45570,"blake2b-24":45571,"blake2b-32":45572,"blake2b-40":45573,"blake2b-48":45574,"blake2b-56":45575,"blake2b-64":45576,"blake2b-72":45577,"blake2b-80":45578,"blake2b-88":45579,"blake2b-96":45580,"blake2b-104":45581,"blake2b-112":45582,"blake2b-120":45583,"blake2b-128":45584,"blake2b-136":45585,"blake2b-144":45586,"blake2b-152":45587,"blake2b-160":45588,"blake2b-168":45589,"blake2b-176":45590,"blake2b-184":45591,"blake2b-192":45592,"blake2b-200":45593,"blake2b-208":45594,"blake2b-216":45595,"blake2b-224":45596,"blake2b-232":45597,"blake2b-240":45598,"blake2b-248":45599,"blake2b-256":45600,"blake2b-264":45601,"blake2b-272":45602,"blake2b-280":45603,"blake2b-288":45604,"blake2b-296":45605,"blake2b-304":45606,"blake2b-312":45607,"blake2b-320":45608,"blake2b-328":45609,"blake2b-336":45610,"blake2b-344":45611,"blake2b-352":45612,"blake2b-360":45613,"blake2b-368":45614,"blake2b-376":45615,"blake2b-384":45616,"blake2b-392":45617,"blake2b-400":45618,"blake2b-408":45619,"blake2b-416":45620,"blake2b-424":45621,"blake2b-432":45622,"blake2b-440":45623,"blake2b-448":45624,"blake2b-456":45625,"blake2b-464":45626,"blake2b-472":45627,"blake2b-480":45628,"blake2b-488":45629,"blake2b-496":45630,"blake2b-504":45631,"blake2b-512":45632,"blake2s-8":45633,"blake2s-16":45634,"blake2s-24":45635,"blake2s-32":45636,"blake2s-40":45637,"blake2s-48":45638,"blake2s-56":45639,"blake2s-64":45640,"blake2s-72":45641,"blake2s-80":45642,"blake2s-88":45643,"blake2s-96":45644,"blake2s-104":45645,"blake2s-112":45646,"blake2s-120":45647,"blake2s-128":45648,"blake2s-136":45649,"blake2s-144":45650,"blake2s-152":45651,"blake2s-160":45652,"blake2s-168":45653,"blake2s-176":45654,"blake2s-184":45655,"blake2s-192":45656,"blake2s-200":45657,"blake2s-208":45658,"blake2s-216":45659,"blake2s-224":45660,"blake2s-232":45661,"blake2s-240":45662,"blake2s-248":45663,"blake2s-256":45664,"skein256-8":45825,"skein256-16":45826,"skein256-24":45827,"skein256-32":45828,"skein256-40":45829,"skein256-48":45830,"skein256-56":45831,"skein256-64":45832,"skein256-72":45833,"skein256-80":45834,"skein256-88":45835,"skein256-96":45836,"skein256-104":45837,"skein256-112":45838,"skein256-120":45839,"skein256-128":45840,"skein256-136":45841,"skein256-144":45842,"skein256-152":45843,"skein256-160":45844,"skein256-168":45845,"skein256-176":45846,"skein256-184":45847,"skein256-192":45848,"skein256-200":45849,"skein256-208":45850,"skein256-216":45851,"skein256-224":45852,"skein256-232":45853,"skein256-240":45854,"skein256-248":45855,"skein256-256":45856,"skein512-8":45857,"skein512-16":45858,"skein512-24":45859,"skein512-32":45860,"skein512-40":45861,"skein512-48":45862,"skein512-56":45863,"skein512-64":45864,"skein512-72":45865,"skein512-80":45866,"skein512-88":45867,"skein512-96":45868,"skein512-104":45869,"skein512-112":45870,"skein512-120":45871,"skein512-128":45872,"skein512-136":45873,"skein512-144":45874,"skein512-152":45875,"skein512-160":45876,"skein512-168":45877,"skein512-176":45878,"skein512-184":45879,"skein512-192":45880,"skein512-200":45881,"skein512-208":45882,"skein512-216":45883,"skein512-224":45884,"skein512-232":45885,"skein512-240":45886,"skein512-248":45887,"skein512-256":45888,"skein512-264":45889,"skein512-272":45890,"skein512-280":45891,"skein512-288":45892,"skein512-296":45893,"skein512-304":45894,"skein512-312":45895,"skein512-320":45896,"skein512-328":45897,"skein512-336":45898,"skein512-344":45899,"skein512-352":45900,"skein512-360":45901,"skein512-368":45902,"skein512-376":45903,"skein512-384":45904,"skein512-392":45905,"skein512-400":45906,"skein512-408":45907,"skein512-416":45908,"skein512-424":45909,"skein512-432":45910,"skein512-440":45911,"skein512-448":45912,"skein512-456":45913,"skein512-464":45914,"skein512-472":45915,"skein512-480":45916,"skein512-488":45917,"skein512-496":45918,"skein512-504":45919,"skein512-512":45920,"skein1024-8":45921,"skein1024-16":45922,"skein1024-24":45923,"skein1024-32":45924,"skein1024-40":45925,"skein1024-48":45926,"skein1024-56":45927,"skein1024-64":45928,"skein1024-72":45929,"skein1024-80":45930,"skein1024-88":45931,"skein1024-96":45932,"skein1024-104":45933,"skein1024-112":45934,"skein1024-120":45935,"skein1024-128":45936,"skein1024-136":45937,"skein1024-144":45938,"skein1024-152":45939,"skein1024-160":45940,"skein1024-168":45941,"skein1024-176":45942,"skein1024-184":45943,"skein1024-192":45944,"skein1024-200":45945,"skein1024-208":45946,"skein1024-216":45947,"skein1024-224":45948,"skein1024-232":45949,"skein1024-240":45950,"skein1024-248":45951,"skein1024-256":45952,"skein1024-264":45953,"skein1024-272":45954,"skein1024-280":45955,"skein1024-288":45956,"skein1024-296":45957,"skein1024-304":45958,"skein1024-312":45959,"skein1024-320":45960,"skein1024-328":45961,"skein1024-336":45962,"skein1024-344":45963,"skein1024-352":45964,"skein1024-360":45965,"skein1024-368":45966,"skein1024-376":45967,"skein1024-384":45968,"skein1024-392":45969,"skein1024-400":45970,"skein1024-408":45971,"skein1024-416":45972,"skein1024-424":45973,"skein1024-432":45974,"skein1024-440":45975,"skein1024-448":45976,"skein1024-456":45977,"skein1024-464":45978,"skein1024-472":45979,"skein1024-480":45980,"skein1024-488":45981,"skein1024-496":45982,"skein1024-504":45983,"skein1024-512":45984,"skein1024-520":45985,"skein1024-528":45986,"skein1024-536":45987,"skein1024-544":45988,"skein1024-552":45989,"skein1024-560":45990,"skein1024-568":45991,"skein1024-576":45992,"skein1024-584":45993,"skein1024-592":45994,"skein1024-600":45995,"skein1024-608":45996,"skein1024-616":45997,"skein1024-624":45998,"skein1024-632":45999,"skein1024-640":46e3,"skein1024-648":46001,"skein1024-656":46002,"skein1024-664":46003,"skein1024-672":46004,"skein1024-680":46005,"skein1024-688":46006,"skein1024-696":46007,"skein1024-704":46008,"skein1024-712":46009,"skein1024-720":46010,"skein1024-728":46011,"skein1024-736":46012,"skein1024-744":46013,"skein1024-752":46014,"skein1024-760":46015,"skein1024-768":46016,"skein1024-776":46017,"skein1024-784":46018,"skein1024-792":46019,"skein1024-800":46020,"skein1024-808":46021,"skein1024-816":46022,"skein1024-824":46023,"skein1024-832":46024,"skein1024-840":46025,"skein1024-848":46026,"skein1024-856":46027,"skein1024-864":46028,"skein1024-872":46029,"skein1024-880":46030,"skein1024-888":46031,"skein1024-896":46032,"skein1024-904":46033,"skein1024-912":46034,"skein1024-920":46035,"skein1024-928":46036,"skein1024-936":46037,"skein1024-944":46038,"skein1024-952":46039,"skein1024-960":46040,"skein1024-968":46041,"skein1024-976":46042,"skein1024-984":46043,"skein1024-992":46044,"skein1024-1000":46045,"skein1024-1008":46046,"skein1024-1016":46047,"skein1024-1024":46048,"poseidon-bls12_381-a2-fc1":46081,"poseidon-bls12_381-a2-fc1-sc":46082,"zeroxcert-imprint-256":52753,"fil-commitment-unsealed":61697,"fil-commitment-sealed":61698,"holochain-adr-v0":8417572,"holochain-adr-v1":8483108,"holochain-key-v0":9728292,"holochain-key-v1":9793828,"holochain-sig-v0":10645796,"holochain-sig-v1":10711332},baseTable$1=require$$4$2,nameTable=new Map;for(const c in baseTable$1){const t=baseTable$1[c];nameTable.set(t,c)}var intTable=Object.freeze(nameTable);const varint=varint$2,{Buffer:Buffer$2}=dist$1;var util$4={numberToBuffer,bufferToNumber,varintBufferEncode,varintBufferDecode,varintEncode:varintEncode$1};function bufferToNumber(c){return parseInt(c.toString("hex"),16)}function numberToBuffer(c){let t=c.toString(16);return t.length%2===1&&(t="0"+t),Buffer$2.from(t,"hex")}function varintBufferEncode(c){return Buffer$2.from(varint.encode(bufferToNumber(c)))}function varintBufferDecode(c){return numberToBuffer(varint.decode(c))}function varintEncode$1(c){return Buffer$2.from(varint.encode(c))}const baseTable=require$$4$2,varintEncode=util$4.varintEncode,varintTable={};for(const c in baseTable){const t=baseTable[c];varintTable[c]=varintEncode(t)}var varintTable_1=Object.freeze(varintTable),constants_1,hasRequiredConstants$1;function requireConstants$1(){if(hasRequiredConstants$1)return constants_1;hasRequiredConstants$1=1;const c=require$$4$2,t={};for(const[n,ie]of Object.entries(c))t[n.toUpperCase().replace(/-/g,"_")]=ie;return constants_1=Object.freeze(t),constants_1}var print,hasRequiredPrint;function requirePrint(){if(hasRequiredPrint)return print;hasRequiredPrint=1;const c=require$$4$2,t={};for(const[n,ie]of Object.entries(c))t[ie]===void 0&&(t[ie]=n);return print=Object.freeze(t),print}(function(c,t){const{Buffer:n}=dist$1,ie=varint$2,fe=intTable,ae=varintTable_1,le=util$4;t=c.exports,t.addPrefix=(me,ye)=>{let xe;if(n.isBuffer(me))xe=le.varintBufferEncode(me);else if(ae[me])xe=ae[me];else throw new Error("multicodec not recognized");return n.concat([xe,ye])},t.rmPrefix=me=>(ie.decode(me),me.slice(ie.decode.bytes)),t.getCodec=me=>{const ye=ie.decode(me),xe=fe.get(ye);if(xe===void 0)throw new Error(`Code ${ye} not found`);return xe},t.getName=me=>fe.get(me),t.getNumber=me=>{const ye=ae[me];if(ye===void 0)throw new Error("Codec `"+me+"` not found");return le.varintBufferDecode(ye)[0]},t.getCode=me=>ie.decode(me),t.getCodeVarint=me=>{const ye=ae[me];if(ye===void 0)throw new Error("Codec `"+me+"` not found");return ye},t.getVarint=me=>ie.encode(me);const pe=requireConstants$1();Object.assign(t,pe),t.print=requirePrint()})(src$2,src$2.exports);var srcExports=src$2.exports;const mh$1=src$5,{Buffer:Buffer$1}=dist$1;var CIDUtil$1={checkCIDComponents:function(c){if(c==null)return"null values are not valid CIDs";if(!(c.version===0||c.version===1))return"Invalid version, must be a number equal to 1 or 0";if(typeof c.codec!="string")return"codec must be string";if(c.version===0){if(c.codec!=="dag-pb")return"codec must be 'dag-pb' for CIDv0";if(c.multibaseName!=="base58btc")return"multibaseName must be 'base58btc' for CIDv0"}if(!Buffer$1.isBuffer(c.multihash))return"multihash must be a Buffer";try{mh$1.validate(c.multihash)}catch(t){let n=t.message;return n||(n="Multihash validation failed"),n}}},cidUtil=CIDUtil$1,classIs={exports:{}};function withIs$1(c,{className:t,symbolName:n}){const ie=Symbol.for(n),fe={[t]:class extends c{constructor(...ae){super(...ae),Object.defineProperty(this,ie,{value:!0})}get[Symbol.toStringTag](){return t}}}[t];return fe[`is${t}`]=ae=>!!(ae&&ae[ie]),fe}function withIsProto(c,{className:t,symbolName:n,withoutNew:ie}){const fe=Symbol.for(n),ae={[t]:function(...le){if(ie&&!(this instanceof ae))return new ae(...le);const pe=c.call(this,...le)||this;return pe&&!pe[fe]&&Object.defineProperty(pe,fe,{value:!0}),pe}}[t];return ae.prototype=Object.create(c.prototype),ae.prototype.constructor=ae,Object.defineProperty(ae.prototype,Symbol.toStringTag,{get(){return t}}),ae[`is${t}`]=le=>!!(le&&le[fe]),ae}classIs.exports=withIs$1;classIs.exports.proto=withIsProto;var classIsExports=classIs.exports;const{Buffer}=dist$1,mh=src$5,multibase=srcExports$1,multicodec=srcExports,codecs=require$$4$2,CIDUtil=cidUtil,withIs=classIsExports;let CID$2=class Qn{constructor(t,n,ie,fe){if(_CID.isCID(t)){const ae=t;this.version=ae.version,this.codec=ae.codec,this.multihash=Buffer.from(ae.multihash),this.multibaseName=ae.multibaseName||(ae.version===0?"base58btc":"base32");return}if(typeof t=="string"){const ae=multibase.isEncoded(t);if(ae){const le=multibase.decode(t);this.version=parseInt(le.slice(0,1).toString("hex"),16),this.codec=multicodec.getCodec(le.slice(1)),this.multihash=multicodec.rmPrefix(le.slice(1)),this.multibaseName=ae}else this.version=0,this.codec="dag-pb",this.multihash=mh.fromB58String(t),this.multibaseName="base58btc";Qn.validateCID(this),Object.defineProperty(this,"string",{value:t});return}if(Buffer.isBuffer(t)){const ae=t.slice(0,1),le=parseInt(ae.toString("hex"),16);if(le===1){const pe=t;this.version=le,this.codec=multicodec.getCodec(pe.slice(1)),this.multihash=multicodec.rmPrefix(pe.slice(1)),this.multibaseName="base32"}else this.version=0,this.codec="dag-pb",this.multihash=t,this.multibaseName="base58btc";Qn.validateCID(this);return}this.version=t,this.codec=n,this.multihash=ie,this.multibaseName=fe||(t===0?"base58btc":"base32"),Qn.validateCID(this)}get buffer(){let t=this._buffer;if(!t){if(this.version===0)t=this.multihash;else if(this.version===1)t=Buffer.concat([Buffer.from("01","hex"),multicodec.getCodeVarint(this.codec),this.multihash]);else throw new Error("unsupported version");Object.defineProperty(this,"_buffer",{value:t})}return t}get prefix(){return Buffer.concat([Buffer.from(`0${this.version}`,"hex"),multicodec.getCodeVarint(this.codec),mh.prefix(this.multihash)])}toV0(){if(this.codec!=="dag-pb")throw new Error("Cannot convert a non dag-pb CID to CIDv0");const{name:t,length:n}=mh.decode(this.multihash);if(t!=="sha2-256")throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");if(n!==32)throw new Error("Cannot convert non 32 byte multihash CID to CIDv0");return new _CID(0,this.codec,this.multihash)}toV1(){return new _CID(1,this.codec,this.multihash)}toBaseEncodedString(t=this.multibaseName){if(this.string&&t===this.multibaseName)return this.string;let n=null;if(this.version===0){if(t!=="base58btc")throw new Error("not supported with CIDv0, to support different bases, please migrate the instance do CIDv1, you can do that through cid.toV1()");n=mh.toB58String(this.multihash)}else if(this.version===1)n=multibase.encode(t,this.buffer).toString();else throw new Error("unsupported version");return t===this.multibaseName&&Object.defineProperty(this,"string",{value:n}),n}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}toString(t){return this.toBaseEncodedString(t)}toJSON(){return{codec:this.codec,version:this.version,hash:this.multihash}}equals(t){return this.codec===t.codec&&this.version===t.version&&this.multihash.equals(t.multihash)}static validateCID(t){const n=CIDUtil.checkCIDComponents(t);if(n)throw new Error(n)}};const _CID=withIs(CID$2,{className:"CID",symbolName:"@ipld/js-cid/CID"});_CID.codecs=codecs;var src$1=_CID;const CID$1=src$1,multiH=src$5,hexStringToBuffer$1=c=>{let t=c.slice(0,2),n=c.slice(2),ie="";return t==="0x"?ie=n:ie=c,multiH.fromHexString(ie)},encodes={swarm:c=>{const t=multiH.encode(hexStringToBuffer$1(c),"keccak-256");return new CID$1(1,"swarm-manifest",t).buffer},ipfs:c=>{const t=multiH.fromB58String(c);return new CID$1(1,"dag-pb",t).buffer},utf8:c=>Buffer$7.from(c,"utf8")},decodes={hexMultiHash:c=>{const t=new CID$1(c);return multiH.decode(t.multihash).digest.toString("hex")},b58MultiHash:c=>{const t=new CID$1(c);return multiH.toB58String(t.multihash)},utf8:c=>c.toString("utf8")},profiles$1={"swarm-ns":{encode:encodes.swarm,decode:decodes.hexMultiHash},"ipfs-ns":{encode:encodes.ipfs,decode:decodes.b58MultiHash},"ipns-ns":{encode:encodes.ipfs,decode:decodes.b58MultiHash},default:{encode:encodes.utf8,decode:decodes.utf8}};profiles$2.hexStringToBuffer=hexStringToBuffer$1;profiles$2.profiles=profiles$1;var helpers={};const CID=src$1,cidV0ToV1Base32$1=c=>{let t=new CID(c);return t.version===0&&(t=t.toV1()),t.toString("base32")};helpers.cidV0ToV1Base32=cidV0ToV1Base32$1;const multiC=srcExports$3,{hexStringToBuffer,profiles}=profiles$2,{cidV0ToV1Base32}=helpers;var src={helpers:{cidV0ToV1Base32},decode:function(c){const t=hexStringToBuffer(c),n=multiC.getCodec(t),ie=multiC.rmPrefix(t);let fe=profiles[n];return fe||(fe=profiles.default),fe.decode(ie)},fromIpfs:function(c){return this.encode("ipfs-ns",c)},fromSwarm:function(c){return this.encode("swarm-ns",c)},encode:function(c,t){let n=profiles[c];n||(n=profiles.default);const ie=n.encode(t);return multiC.addPrefix(c,ie).toString("hex")},getCodec:function(c){let t=hexStringToBuffer(c);return multiC.getCodec(t)}},bip44Constants=[[2147483648,"BTC","Bitcoin"],[2147483649,"","Testnet (all coins)"],[2147483650,"LTC","Litecoin"],[2147483651,"DOGE","Dogecoin"],[2147483652,"RDD","Reddcoin"],[2147483653,"DASH","Dash (ex Darkcoin)"],[2147483654,"PPC","Peercoin"],[2147483655,"NMC","Namecoin"],[2147483656,"FTC","Feathercoin"],[2147483657,"XCP","Counterparty"],[2147483658,"BLK","Blackcoin"],[2147483659,"NSR","NuShares"],[2147483660,"NBT","NuBits"],[2147483661,"MZC","Mazacoin"],[2147483662,"VIA","Viacoin"],[2147483663,"XCH","ClearingHouse"],[2147483664,"RBY","Rubycoin"],[2147483665,"GRS","Groestlcoin"],[2147483666,"DGC","Digitalcoin"],[2147483667,"CCN","Cannacoin"],[2147483668,"DGB","DigiByte"],[2147483669,"","Open Assets"],[2147483670,"MONA","Monacoin"],[2147483671,"CLAM","Clams"],[2147483672,"XPM","Primecoin"],[2147483673,"NEOS","Neoscoin"],[2147483674,"JBS","Jumbucks"],[2147483675,"ZRC","ziftrCOIN"],[2147483676,"VTC","Vertcoin"],[2147483677,"NXT","NXT"],[2147483678,"BURST","Burst"],[2147483679,"MUE","MonetaryUnit"],[2147483680,"ZOOM","Zoom"],[2147483681,"VASH","Virtual Cash also known as VPNcoin"],[2147483682,"CDN","Canada eCoin"],[2147483683,"SDC","ShadowCash"],[2147483684,"PKB","ParkByte"],[2147483685,"PND","Pandacoin"],[2147483686,"START","StartCOIN"],[2147483687,"MOIN","MOIN"],[2147483688,"EXP","Expanse"],[2147483689,"EMC2","Einsteinium"],[2147483690,"DCR","Decred"],[2147483691,"XEM","NEM"],[2147483692,"PART","Particl"],[2147483693,"ARG","Argentum (dead)"],[2147483694,"","Libertas"],[2147483695,"","Posw coin"],[2147483696,"SHR","Shreeji"],[2147483697,"GCR","Global Currency Reserve (GCRcoin)"],[2147483698,"NVC","Novacoin"],[2147483699,"AC","Asiacoin"],[2147483700,"BTCD","BitcoinDark"],[2147483701,"DOPE","Dopecoin"],[2147483702,"TPC","Templecoin"],[2147483703,"AIB","AIB"],[2147483704,"EDRC","EDRCoin"],[2147483705,"SYS","Syscoin"],[2147483706,"SLR","Solarcoin"],[2147483707,"SMLY","Smileycoin"],[2147483708,"ETH","Ether"],[2147483709,"ETC","Ether Classic"],[2147483710,"PSB","Pesobit"],[2147483711,"LDCN","Landcoin (dead)"],[2147483712,"","Open Chain"],[2147483713,"XBC","Bitcoinplus"],[2147483714,"IOP","Internet of People"],[2147483715,"NXS","Nexus"],[2147483716,"INSN","InsaneCoin"],[2147483717,"OK","OKCash"],[2147483718,"BRIT","BritCoin"],[2147483719,"CMP","Compcoin"],[2147483720,"CRW","Crown"],[2147483721,"BELA","BelaCoin"],[2147483722,"ICX","ICON"],[2147483723,"FJC","FujiCoin"],[2147483724,"MIX","MIX"],[2147483725,"XVG","Verge Currency"],[2147483726,"EFL","Electronic Gulden"],[2147483727,"CLUB","ClubCoin"],[2147483728,"RICHX","RichCoin"],[2147483729,"POT","Potcoin"],[2147483730,"QRK","Quarkcoin"],[2147483731,"TRC","Terracoin"],[2147483732,"GRC","Gridcoin"],[2147483733,"AUR","Auroracoin"],[2147483734,"IXC","IXCoin"],[2147483735,"NLG","Gulden"],[2147483736,"BITB","BitBean"],[2147483737,"BTA","Bata"],[2147483738,"XMY","Myriadcoin"],[2147483739,"BSD","BitSend"],[2147483740,"UNO","Unobtanium"],[2147483741,"MTR","MasterTrader"],[2147483742,"GB","GoldBlocks"],[2147483743,"SHM","Saham"],[2147483744,"CRX","Chronos"],[2147483745,"BIQ","Ubiquoin"],[2147483746,"EVO","Evotion"],[2147483747,"STO","SaveTheOcean"],[2147483748,"BIGUP","BigUp"],[2147483749,"GAME","GameCredits"],[2147483750,"DLC","Dollarcoins"],[2147483751,"ZYD","Zayedcoin"],[2147483752,"DBIC","Dubaicoin"],[2147483753,"STRAT","Stratis"],[2147483754,"SH","Shilling"],[2147483755,"MARS","MarsCoin"],[2147483756,"UBQ","Ubiq"],[2147483757,"PTC","Pesetacoin"],[2147483758,"NRO","Neurocoin"],[2147483759,"ARK","ARK"],[2147483760,"USC","UltimateSecureCashMain"],[2147483761,"THC","Hempcoin"],[2147483762,"LINX","Linx"],[2147483763,"ECN","Ecoin"],[2147483764,"DNR","Denarius"],[2147483765,"PINK","Pinkcoin"],[2147483766,"ATOM","Atom"],[2147483767,"PIVX","Pivx"],[2147483768,"FLASH","Flashcoin"],[2147483769,"ZEN","Zencash"],[2147483770,"PUT","Putincoin"],[2147483771,"ZNY","BitZeny"],[2147483772,"UNIFY","Unify"],[2147483773,"XST","StealthCoin"],[2147483774,"BRK","Breakout Coin"],[2147483775,"VC","Vcash"],[2147483776,"XMR","Monero"],[2147483777,"VOX","Voxels"],[2147483778,"NAV","NavCoin"],[2147483779,"FCT","Factom Factoids"],[2147483780,"EC","Factom Entry Credits"],[2147483781,"ZEC","Zcash"],[2147483782,"LSK","Lisk"],[2147483783,"STEEM","Steem"],[2147483784,"XZC","ZCoin"],[2147483785,"RBTC","RSK"],[2147483786,"","Giftblock"],[2147483787,"RPT","RealPointCoin"],[2147483788,"LBC","LBRY Credits"],[2147483789,"KMD","Komodo"],[2147483790,"BSQ","bisq Token"],[2147483791,"RIC","Riecoin"],[2147483792,"XRP","Ripple"],[2147483793,"BCH","Bitcoin Cash"],[2147483794,"NEBL","Neblio"],[2147483795,"ZCL","ZClassic"],[2147483796,"XLM","Stellar Lumens"],[2147483797,"NLC2","NoLimitCoin2"],[2147483798,"WHL","WhaleCoin"],[2147483799,"ERC","EuropeCoin"],[2147483800,"DMD","Diamond"],[2147483801,"BTM","Bytom"],[2147483802,"BIO","Biocoin"],[2147483803,"XWCC","Whitecoin Classic"],[2147483804,"BTG","Bitcoin Gold"],[2147483805,"BTC2X","Bitcoin 2x"],[2147483806,"SSN","SuperSkynet"],[2147483807,"TOA","TOACoin"],[2147483808,"BTX","Bitcore"],[2147483809,"ACC","Adcoin"],[2147483810,"BCO","Bridgecoin"],[2147483811,"ELLA","Ellaism"],[2147483812,"PIRL","Pirl"],[2147483813,"NANO","Nano"],[2147483814,"VIVO","Vivo"],[2147483815,"FRST","Firstcoin"],[2147483816,"HNC","Helleniccoin"],[2147483817,"BUZZ","BUZZ"],[2147483818,"MBRS","Ember"],[2147483819,"HC","Hcash"],[2147483820,"HTML","HTMLCOIN"],[2147483821,"ODN","Obsidian"],[2147483822,"ONX","OnixCoin"],[2147483823,"RVN","Ravencoin"],[2147483824,"GBX","GoByte"],[2147483825,"BTCZ","BitcoinZ"],[2147483826,"POA","Poa"],[2147483827,"NYC","NewYorkCoin"],[2147483828,"MXT","MarteXcoin"],[2147483829,"WC","Wincoin"],[2147483830,"MNX","Minexcoin"],[2147483831,"BTCP","Bitcoin Private"],[2147483832,"MUSIC","Musicoin"],[2147483833,"BCA","Bitcoin Atom"],[2147483834,"CRAVE","Crave"],[2147483835,"STAK","STRAKS"],[2147483836,"WBTC","World Bitcoin"],[2147483837,"LCH","LiteCash"],[2147483838,"EXCL","ExclusiveCoin"],[2147483839,"","Lynx"],[2147483840,"LCC","LitecoinCash"],[2147483841,"XFE","Feirm"],[2147483842,"EOS","EOS"],[2147483843,"TRX","Tron"],[2147483844,"KOBO","Kobocoin"],[2147483845,"HUSH","HUSH"],[2147483846,"BANANO","Bananos"],[2147483847,"ETF","ETF"],[2147483848,"OMNI","Omni"],[2147483849,"BIFI","BitcoinFile"],[2147483850,"UFO","Uniform Fiscal Object"],[2147483851,"CNMC","Cryptonodes"],[2147483852,"BCN","Bytecoin"],[2147483853,"RIN","Ringo"],[2147483854,"ATP","PlatON"],[2147483855,"EVT","everiToken"],[2147483856,"ATN","ATN"],[2147483857,"BIS","Bismuth"],[2147483858,"NEET","NEETCOIN"],[2147483859,"BOPO","BopoChain"],[2147483860,"OOT","Utrum"],[2147483861,"ALIAS","Alias"],[2147483862,"MONK","Monkey Project"],[2147483863,"BOXY","BoxyCoin"],[2147483864,"FLO","Flo"],[2147483865,"MEC","Megacoin"],[2147483866,"BTDX","BitCloud"],[2147483867,"XAX","Artax"],[2147483868,"ANON","ANON"],[2147483869,"LTZ","LitecoinZ"],[2147483870,"BITG","Bitcoin Green"],[2147483871,"ICP","Internet Computer (DFINITY)"],[2147483872,"SMART","Smartcash"],[2147483873,"XUEZ","XUEZ"],[2147483874,"HLM","Helium"],[2147483875,"WEB","Webchain"],[2147483876,"ACM","Actinium"],[2147483877,"NOS","NOS Stable Coins"],[2147483878,"BITC","BitCash"],[2147483879,"HTH","Help The Homeless Coin"],[2147483880,"TZC","Trezarcoin"],[2147483881,"VAR","Varda"],[2147483882,"IOV","IOV"],[2147483883,"FIO","FIO"],[2147483884,"BSV","BitcoinSV"],[2147483885,"DXN","DEXON"],[2147483886,"QRL","Quantum Resistant Ledger"],[2147483887,"PCX","ChainX"],[2147483888,"LOKI","Loki"],[2147483889,"","Imagewallet"],[2147483890,"NIM","Nimiq"],[2147483891,"SOV","Sovereign Coin"],[2147483892,"JCT","Jibital Coin"],[2147483893,"SLP","Simple Ledger Protocol"],[2147483894,"EWT","Energy Web"],[2147483895,"UC","Ulord"],[2147483896,"EXOS","EXOS"],[2147483897,"ECA","Electra"],[2147483898,"SOOM","Soom"],[2147483899,"XRD","Redstone"],[2147483900,"FREE","FreeCoin"],[2147483901,"NPW","NewPowerCoin"],[2147483902,"BST","BlockStamp"],[2147483903,"","SmartHoldem"],[2147483904,"NANO","Bitcoin Nano"],[2147483905,"BTCC","Bitcoin Core"],[2147483906,"","Zen Protocol"],[2147483907,"ZEST","Zest"],[2147483908,"ABT","ArcBlock"],[2147483909,"PION","Pion"],[2147483910,"DT3","DreamTeam3"],[2147483911,"ZBUX","Zbux"],[2147483912,"KPL","Kepler"],[2147483913,"TPAY","TokenPay"],[2147483914,"ZILLA","ChainZilla"],[2147483915,"ANK","Anker"],[2147483916,"BCC","BCChain"],[2147483917,"HPB","HPB"],[2147483918,"ONE","ONE"],[2147483919,"SBC","SBC"],[2147483920,"IPC","IPChain"],[2147483921,"DMTC","Dominantchain"],[2147483922,"OGC","Onegram"],[2147483923,"SHIT","Shitcoin"],[2147483924,"ANDES","Andescoin"],[2147483925,"AREPA","Arepacoin"],[2147483926,"BOLI","Bolivarcoin"],[2147483927,"RIL","Rilcoin"],[2147483928,"HTR","Hathor Network"],[2147483929,"FCTID","Factom ID"],[2147483930,"BRAVO","BRAVO"],[2147483931,"ALGO","Algorand"],[2147483932,"BZX","Bitcoinzero"],[2147483933,"GXX","GravityCoin"],[2147483934,"HEAT","HEAT"],[2147483935,"XDN","DigitalNote"],[2147483936,"FSN","FUSION"],[2147483937,"CPC","Capricoin"],[2147483938,"BOLD","Bold"],[2147483939,"IOST","IOST"],[2147483940,"TKEY","Tkeycoin"],[2147483941,"USE","Usechain"],[2147483942,"BCZ","BitcoinCZ"],[2147483943,"IOC","Iocoin"],[2147483944,"ASF","Asofe"],[2147483945,"MASS","MASS"],[2147483946,"FAIR","FairCoin"],[2147483947,"NUKO","Nekonium"],[2147483948,"GNX","Genaro Network"],[2147483949,"DIVI","Divi Project"],[2147483950,"CMT","Community"],[2147483951,"EUNO","EUNO"],[2147483952,"IOTX","IoTeX"],[2147483953,"ONION","DeepOnion"],[2147483954,"8BIT","8Bit"],[2147483955,"ATC","AToken Coin"],[2147483956,"BTS","Bitshares"],[2147483957,"CKB","Nervos CKB"],[2147483958,"UGAS","Ultrain"],[2147483959,"ADS","Adshares"],[2147483960,"ARA","Aura"],[2147483961,"ZIL","Zilliqa"],[2147483962,"MOAC","MOAC"],[2147483963,"SWTC","SWTC"],[2147483964,"VNSC","vnscoin"],[2147483965,"PLUG","Pl^g"],[2147483966,"MAN","Matrix AI Network"],[2147483967,"ECC","ECCoin"],[2147483968,"RPD","Rapids"],[2147483969,"RAP","Rapture"],[2147483970,"GARD","Hashgard"],[2147483971,"ZER","Zero"],[2147483972,"EBST","eBoost"],[2147483973,"SHARD","Shard"],[2147483974,"LINDA","Linda Coin"],[2147483975,"CMM","Commercium"],[2147483976,"BLOCK","Blocknet"],[2147483977,"AUDAX","AUDAX"],[2147483978,"LUNA","Terra"],[2147483979,"ZPM","zPrime"],[2147483980,"KUVA","Kuva Utility Note"],[2147483981,"MEM","MemCoin"],[2147483982,"CS","Credits"],[2147483983,"SWIFT","SwiftCash"],[2147483984,"FIX","FIX"],[2147483985,"CPC","CPChain"],[2147483986,"VGO","VirtualGoodsToken"],[2147483987,"DVT","DeVault"],[2147483988,"N8V","N8VCoin"],[2147483989,"MTNS","OmotenashiCoin"],[2147483990,"BLAST","BLAST"],[2147483991,"DCT","DECENT"],[2147483992,"AUX","Auxilium"],[2147483993,"USDP","USDP"],[2147483994,"HTDF","HTDF"],[2147483995,"YEC","Ycash"],[2147483996,"QLC","QLC Chain"],[2147483997,"TEA","Icetea Blockchain"],[2147483998,"ARW","ArrowChain"],[2147483999,"MDM","Medium"],[2147484e3,"CYB","Cybex"],[2147484001,"LTO","LTO Network"],[2147484002,"DOT","Polkadot"],[2147484003,"AEON","Aeon"],[2147484004,"RES","Resistance"],[2147484005,"AYA","Aryacoin"],[2147484006,"DAPS","Dapscoin"],[2147484007,"CSC","CasinoCoin"],[2147484008,"VSYS","V Systems"],[2147484009,"NOLLAR","Nollar"],[2147484010,"XNOS","NOS"],[2147484011,"CPU","CPUchain"],[2147484012,"LAMB","Lambda Storage Chain"],[2147484013,"VCT","ValueCyber"],[2147484014,"CZR","Canonchain"],[2147484015,"ABBC","ABBC"],[2147484016,"HET","HET"],[2147484017,"XAS","Asch"],[2147484018,"VDL","Vidulum"],[2147484019,"MED","MediBloc"],[2147484020,"ZVC","ZVChain"],[2147484021,"VESTX","Vestx"],[2147484022,"DBT","DarkBit"],[2147484023,"SEOS","SuperEOS"],[2147484024,"MXW","Maxonrow"],[2147484025,"ZNZ","ZENZO"],[2147484026,"XCX","XChain"],[2147484027,"SOX","SonicX"],[2147484028,"NYZO","Nyzo"],[2147484029,"ULC","ULCoin"],[2147484030,"RYO","Ryo Currency"],[2147484031,"KAL","Kaleidochain"],[2147484032,"XSN","Stakenet"],[2147484033,"DOGEC","DogeCash"],[2147484034,"BMV","Bitcoin Matteo's Vision"],[2147484035,"QBC","Quebecoin"],[2147484036,"IMG","ImageCoin"],[2147484037,"QOS","QOS"],[2147484038,"PKT","PKT"],[2147484039,"LHD","LitecoinHD"],[2147484040,"CENNZ","CENNZnet"],[2147484041,"HSN","Hyper Speed Network"],[2147484042,"CRO","Crypto.com Chain"],[2147484043,"UMBRU","Umbru"],[2147484044,"TON","Free TON"],[2147484045,"NEAR","NEAR Protocol"],[2147484046,"XPC","XPChain"],[2147484047,"ZOC","01coin"],[2147484048,"NIX","NIX"],[2147484049,"UC","Utopiacoin"],[2147484050,"GALI","Galilel"],[2147484051,"OLT","Oneledger"],[2147484052,"XBI","XBI"],[2147484053,"DONU","DONU"],[2147484054,"EARTHS","Earths"],[2147484055,"HDD","HDDCash"],[2147484056,"SUGAR","Sugarchain"],[2147484057,"AILE","AileCoin"],[2147484058,"TENT","TENT"],[2147484059,"TAN","Tangerine Network"],[2147484060,"AIN","AIN"],[2147484061,"MSR","Masari"],[2147484062,"SUMO","Sumokoin"],[2147484063,"ETN","Electroneum"],[2147484064,"BYTZ","BYTZ"],[2147484065,"WOW","Wownero"],[2147484066,"XTNC","XtendCash"],[2147484067,"LTHN","Lethean"],[2147484068,"NODE","NodeHost"],[2147484069,"AGM","Argoneum"],[2147484070,"CCX","Conceal Network"],[2147484071,"TNET","Title Network"],[2147484072,"TELOS","TelosCoin"],[2147484073,"AION","Aion"],[2147484074,"BC","Bitcoin Confidential"],[2147484075,"KTV","KmushiCoin"],[2147484076,"ZCR","ZCore"],[2147484077,"ERG","Ergo"],[2147484078,"PESO","Criptopeso"],[2147484079,"BTC2","Bitcoin 2"],[2147484080,"XRPHD","XRPHD"],[2147484081,"WE","WE Coin"],[2147484082,"KSM","Kusama"],[2147484083,"PCN","Peepcoin"],[2147484084,"NCH","NetCloth"],[2147484085,"ICU","CHIPO"],[2147484086,"LN","LINK"],[2147484087,"DTP","DeVault Token Protocol"],[2147484088,"BTCR","Bitcoin Royale"],[2147484089,"AERGO","AERGO"],[2147484090,"XTH","Dothereum"],[2147484091,"LV","Lava"],[2147484092,"PHR","Phore"],[2147484093,"VITAE","Vitae"],[2147484094,"COCOS","Cocos-BCX"],[2147484095,"DIN","Dinero"],[2147484096,"SPL","Simplicity"],[2147484097,"YCE","MYCE"],[2147484098,"XLR","Solaris"],[2147484099,"KTS","Klimatas"],[2147484100,"DGLD","DGLD"],[2147484101,"XNS","Insolar"],[2147484102,"EM","EMPOW"],[2147484103,"SHN","ShineBlocks"],[2147484104,"SEELE","Seele"],[2147484105,"AE","æternity"],[2147484106,"ODX","ObsidianX"],[2147484107,"KAVA","Kava"],[2147484108,"GLEEC","GLEEC"],[2147484109,"FIL","Filecoin"],[2147484110,"RUTA","Rutanio"],[2147484111,"CSDT","CSDT"],[2147484112,"ETI","EtherInc"],[2147484113,"ZSLP","Zclassic Simple Ledger Protocol"],[2147484114,"ERE","EtherCore"],[2147484115,"DX","DxChain Token"],[2147484116,"CPS","Capricoin+"],[2147484117,"BTH","Bithereum"],[2147484118,"MESG","MESG"],[2147484119,"FIMK","FIMK"],[2147484120,"AR","Arweave"],[2147484121,"OGO","Origo"],[2147484122,"ROSE","Oasis Network"],[2147484123,"BARE","BARE Network"],[2147484124,"GLEEC","GleecBTC"],[2147484125,"CLR","Color Coin"],[2147484126,"RNG","Ring"],[2147484127,"OLO","Tool Global"],[2147484128,"PEXA","Pexa"],[2147484129,"MOON","Mooncoin"],[2147484130,"OCEAN","Ocean Protocol"],[2147484131,"BNT","Bluzelle Native"],[2147484132,"AMO","AMO Blockchain"],[2147484133,"FCH","FreeCash"],[2147484134,"LAT","LatticeX"],[2147484135,"COIN","Bitcoin Bank"],[2147484136,"VEO","Amoveo"],[2147484137,"CCA","Counos Coin"],[2147484138,"GFN","Graphene"],[2147484139,"BIP","Minter Network"],[2147484140,"KPG","Kunpeng Network"],[2147484141,"FIN","FINL Chain"],[2147484142,"BAND","Band"],[2147484143,"DROP","Dropil"],[2147484144,"BHT","Bluehelix Chain"],[2147484145,"LYRA","Scrypta"],[2147484146,"CS","Credits"],[2147484147,"RUPX","Rupaya"],[2147484148,"THETA","Theta"],[2147484149,"SOL","Solana"],[2147484150,"THT","ThoughtAI"],[2147484151,"CFX","Conflux"],[2147484152,"KUMA","Kumacoin"],[2147484153,"HASH","Provenance"],[2147484154,"CLX","CasperLabs"],[2147484155,"EARTH","EARTH"],[2147484156,"ERD","Elrond"],[2147484157,"CHI","Xaya"],[2147484158,"KOTO","Koto"],[2147484159,"OTC","θ"],[2147484160,"XRD","Radiant"],[2147484161,"SEELEN","Seele-N"],[2147484162,"AETH","AETH"],[2147484163,"DNA","Idena"],[2147484164,"VEE","Virtual Economy Era"],[2147484165,"SIERRA","SierraCoin"],[2147484166,"LET","Linkeye"],[2147484167,"BSC","Bitcoin Smart Contract"],[2147484168,"BTCV","BitcoinVIP"],[2147484169,"ABA","Dabacus"],[2147484170,"SCC","StakeCubeCoin"],[2147484171,"EDG","Edgeware"],[2147484172,"AMS","AmsterdamCoin"],[2147484173,"GOSS","GOSSIP Coin"],[2147484174,"BU","BUMO"],[2147484175,"GRAM","GRAM"],[2147484176,"YAP","Yapstone"],[2147484177,"SCRT","Secret Network"],[2147484178,"NOVO","Novo"],[2147484179,"GHOST","Ghost"],[2147484180,"HST","HST"],[2147484181,"PRJ","ProjectCoin"],[2147484182,"YOU","YOUChain"],[2147484183,"XHV","Haven Protocol"],[2147484184,"BYND","Beyondcoin"],[2147484185,"JOYS","Joys Digital"],[2147484186,"VAL","Valorbit"],[2147484187,"FLOW","Flow"],[2147484188,"SMESH","Spacemesh Coin"],[2147484189,"SCDO","SCDO"],[2147484190,"IQS","IQ-Cash"],[2147484191,"BIND","Compendia"],[2147484192,"COINEVO","Coinevo"],[2147484193,"SCRIBE","Scribe"],[2147484194,"HYN","Hyperion"],[2147484195,"BHP","BHP"],[2147484196,"BBC","BigBang Core"],[2147484197,"MKF","MarketFinance"],[2147484198,"XDC","XinFin.Network"],[2147484199,"STR","Straightedge"],[2147484200,"SUM","Sumcoin"],[2147484201,"HBC","HuobiChain"],[2147484202,"FLR","Flare Spark"],[2147484203,"BCS","Bitcoin Smart"],[2147484204,"KTS","Kratos"],[2147484205,"LKR","Lkrcoin"],[2147484206,"TAO","Tao"],[2147484207,"XWC","Whitecoin"],[2147484208,"DEAL","DEAL"],[2147484209,"NTY","Nexty"],[2147484210,"TOP","TOP NetWork"],[2147484211,"STARS","Stargaze"],[2147484212,"AG","Agoric"],[2147484213,"CICO","Coinicles"],[2147484214,"IRIS","Irisnet"],[2147484215,"NCG","Nine Chronicles"],[2147484216,"LRG","Large Coin"],[2147484217,"SERO","Super Zero Protocol"],[2147484218,"BDX","Beldex"],[2147484219,"CCXX","Counos X"],[2147484220,"SLS","Saluscoin"],[2147484221,"SRM","Serum"],[2147484222,"VLX","Velas"],[2147484223,"VIVT","VIDT Datalink"],[2147484224,"BPS","BitcoinPoS"],[2147484225,"NKN","NKN"],[2147484226,"ICL","ILCOIN"],[2147484227,"BONO","Bonorum"],[2147484228,"PLC","PLATINCOIN"],[2147484229,"DUN","Dune"],[2147484230,"DMCH","Darmacash"],[2147484231,"CTC","Creditcoin"],[2147484232,"KELP","Haidai Network"],[2147484233,"GBCR","GoldBCR"],[2147484234,"XDAG","XDAG"],[2147484235,"PRV","Incognito Privacy"],[2147484236,"SCAP","SafeCapital"],[2147484237,"TFUEL","Theta Fuel"],[2147484238,"GTM","Gentarium"],[2147484239,"RNL","RentalChain"],[2147484240,"GRIN","Grin"],[2147484241,"MWC","MimbleWimbleCoin"],[2147484242,"DOCK","[Dock][https://dock.io]"],[2147484243,"POLYX","Polymesh"],[2147484244,"DIVER","Divergenti"],[2147484245,"XEP","Electra Protocol"],[2147484246,"APN","Apron"],[2147484247,"TFC","Turbo File Coin"],[2147484248,"UTE","Unit-e"],[2147484249,"MTC","Metacoin"],[2147484250,"NC","NobodyCash"],[2147484258,"NOR","Noir"],[2147484266,"SSP","SmartShare"],[2147484273,"EAST","Eastcoin"],[2147484287,"BTSG","BitSong"],[2147484288,"LFC","Leofcoin"],[2147484311,"SFRX","EtherGem Sapphire"],[2147484314,"ACT","Achain"],[2147484315,"PRKL","Perkle"],[2147484316,"SSC","SelfSell"],[2147484317,"GC","GateChain"],[2147484326,"Voken","Voken"],[2147484328,"Evrynet","Evrynet"],[2147484334,"KAR","Karura Network"],[2147484336,"CET","CoinEx Chain"],[2147484346,"VEIL","Veil"],[2147484348,"XDAI","xDai"],[2147484359,"CHC","Chaincoin"],[2147484361,"XTL","Katal Chain"],[2147484362,"BNB","Binance"],[2147484363,"SIN","Sinovate"],[2147484373,"MCX","MultiCash"],[2147484379,"BMK","Bitmark"],[2147484395,"RAD","Centrifuge"],[2147484398,"XPRT","Persistence"],[2147484416,"BALLZ","Ballzcoin"],[2147484419,"BR","BR"],[2147484425,"BTW","Bitcoin World"],[2147484435,"ACA","Acala"],[2147484437,"TAU","Lamden"],[2147484448,"BEET","Beetle Coin"],[2147484449,"DST","DSTRA"],[2147484456,"QVT","Qvolta"],[2147484466,"VET","VeChain Token"],[2147484468,"CLO","Callisto"],[2147484479,"CRUZ","cruzbit"],[2147484500,"DSM","Desmos"],[2147484501,"PRCY","PRCY Coin"],[2147484516,"IF","Infinitefuture"],[2147484531,"ZBC","ZooBC"],[2147484534,"ADF","AD Token"],[2147484536,"NEO","NEO"],[2147484537,"TOMO","TOMO"],[2147484538,"XSEL","Seln"],[2147484547,"BCHA","BCHA"],[2147484548,"LMO","Lumeneo"],[2147484552,"","Helium"],[2147484555,"FIS","StaFi"],[2147484564,"META","Metadium"],[2147484565,"FRA","Findora"],[2147484573,"DIP","Dipper Network"],[2147484579,"RUNE","THORChain (RUNE)"],[2147484603,"LTP","LifetionCoin"],[2147484614,"MATIC","Matic"],[2147484618,"TWINS","TWINS"],[2147484636,"XAZAB","Xazab core"],[2147484637,"AIOZ","AIOZ"],[2147484644,"OKT","OKChain Token"],[2147484645,"SUM","Solidum"],[2147484646,"LBTC","Lightning Bitcoin"],[2147484647,"BCD","Bitcoin Diamond"],[2147484648,"BTN","Bitcoin New"],[2147484649,"TT","ThunderCore"],[2147484650,"BKT","BanKitt"],[2147484658,"HT","Huobi ECO Chain"],[2147484671,"ONE","HARMONY-ONE"],[2147484672,"ONT","Ontology"],[2147484674,"KEX","Kira Exchange Token"],[2147484675,"MCM","Mochimo"],[2147484680,"BTCR","BTCR"],[2147484759,"BBC","Big Bitcoin"],[2147484768,"RISE","RISE"],[2147484770,"CMT","CyberMiles Token"],[2147484776,"ETSC","Ethereum Social"],[2147484777,"DFI","DeFiChain"],[2147484785,"$DAG","Constellation Labs"],[2147484793,"CDY","Bitcoin Candy"],[2147484985,"DFC","Defcoin"],[2147485045,"HYC","Hycon"],[2147485172,"","Taler"],[2147485181,"BEAM","Beam"],[2147485264,"ELF","AELF"],[2147485266,"AUDL","AUDL"],[2147485268,"ATH","Atheios"],[2147485290,"NEW","Newton"],[2147485336,"BCX","BitcoinX"],[2147485377,"XTZ","Tezos"],[2147485424,"LBTC","Liquid BTC"],[2147485432,"JPYS","JPY Stablecoin"],[2147485463,"ADA","Cardano"],[2147485507,"TES","Teslacoin"],[2147485547,"SLPA","BCHA token"],[2147485549,"CLC","Classica"],[2147485567,"VIPS","VIPSTARCOIN"],[2147485574,"CITY","City Coin"],[2147485625,"XMX","Xuma"],[2147485632,"TRTL","TurtleCoin"],[2147485635,"EGEM","EtherGem"],[2147485637,"HODL","HOdlcoin"],[2147485638,"PHL","Placeholders"],[2147485639,"SC","Sia"],[2147485645,"POLIS","Polis"],[2147485646,"XMCC","Monoeci"],[2147485647,"COLX","ColossusXT"],[2147485648,"GIN","GinCoin"],[2147485649,"MNP","MNPCoin"],[2147485665,"KIN","Kin"],[2147485666,"EOSC","EOSClassic"],[2147485667,"GBT","GoldBean Token"],[2147485668,"PKC","PKC"],[2147485669,"SKT","Sukhavati"],[2147485696,"MCASH","MCashChain"],[2147485697,"TRUE","TrueChain"],[2147485760,"IoTE","IoTE"],[2147485869,"ASK","ASK"],[2147485949,"QTUM","QTUM"],[2147485950,"ETP","Metaverse"],[2147485951,"GXC","GXChain"],[2147485952,"CRP","CranePay"],[2147485953,"ELA","Elastos"],[2147485986,"SNOW","Snowblossom"],[2147486218,"AOA","Aurora"],[2147486542,"REOSC","REOSC Ecosystem"],[2147486651,"LUX","LUX"],[2147486678,"XHB","Hedera HBAR"],[2147486725,"COS","Contentos"],[2147487029,"DYN","Dynamic"],[2147487031,"SEQ","Sequence"],[2147487200,"DEO","Destocoin"],[2147487212,"DST","DeStream"],[2147486366,"NAS","Nebulas"],[2147486589,"BND","Blocknode"],[2147486924,"CCC","CodeChain"],[2147487025,"ROI","ROIcoin"],[2147487688,"FC8","FCH Network"],[2147487744,"YEE","YeeCo"],[2147487866,"IOTA","IOTA"],[2147487890,"AXE","Axe"],[2147487991,"XYM","Symbol"],[2147488896,"FIC","FIC"],[2147489001,"HNS","Handshake"],[2147489203,"FUND","Unification"],[2147489405,"STX","Blockstack"],[2147489568,"SLU","SILUBIUM"],[2147489708,"GO","GoChain GO"],[2147490314,"BPA","Bitcoin Pizza"],[2147490336,"SAFE","SAFE"],[2147490617,"ROGER","TheHolyrogerCoin"],[2147491425,"BTV","Bitvote"],[2147491648,"SKY","Skycoin"],[2147491865,"KLAY","KLAY"],[2147491987,"BTQ","BitcoinQuark"],[2147492092,"XCH","Chia"],[2147492536,"SBTC","Super Bitcoin"],[2147492612,"NULS","NULS"],[2147492647,"BTP","Bitcoin Pay"],[2147492648,"AVAX","Avalanche"],[2147493445,"NRG","Energi"],[2147493536,"BTF","Bitcoin Faith"],[2147493647,"GOD","Bitcoin God"],[2147493648,"FO","FIBOS"],[2147493939,"BTR","Bitcoin Rhodium"],[2147494759,"ESS","Essentia One"],[2147495993,"IPOS","IPOS"],[2147496234,"MINA","Mina"],[2147496755,"BTY","BitYuan"],[2147496756,"YCC","Yuan Chain Coin"],[2147499493,"SDGO","SanDeGo"],[2147499829,"XTX","Totem Live Network"],[2147500402,"ARDR","Ardor"],[2147502813,"SAFE","Safecoin"],[2147502815,"ZEL","ZelCash"],[2147502817,"RITO","Ritocoin"],[2147503684,"XND","ndau"],[2147506152,"PWR","PWRcoin"],[2147508900,"BELL","Bellcoin"],[2147509366,"CHX","Own"],[2147514750,"ESN","EtherSocial Network"],[2147514985,"","ThePower.io"],[2147517064,"TEO","Trust Eth reOrigin"],[2147517526,"BTCS","Bitcoin Stake"],[2147518600,"BTT","ByteTrade"],[2147521640,"FXTC","FixedTradeCoin"],[2147522969,"AMA","Amabig"],[2147532910,"EVE","evan.network"],[2147532992,"STASH","STASH"],[2147536400,"CELO","Celo"],[2147549184,"KETH","Krypton World"],[2147561425,"ZYN","Wethio"],[2147572536,"RYO","c0ban"],[2147583647,"WICC","Waykichain"],[2147588753,"STRAX","Strax"],[2147684273,"AKA","Akroma"],[2147553280,"GENOM","GENOM"],[2147730177,"ATS","ARTIS sigma1"],[2147907890,"X42","x42"],[2148150314,"VITE","Vite"],[2148372536,"SEA","Second Exchange Alliance"],[2148654985,"ILT","iOlite"],[2148796762,"ETHO","Ether-1"],[2148797148,"XERO","Xerom"],[2149195792,"LAX","LAPO"],[2151407659,"EPK","EPIK Protocol"],[2152225092,"HYD","Hydra Token"],[2152733001,"BCO","BitcoinOre"],[2152733002,"BHD","BitcoinHD"],[2152748110,"PTN","PalletOne"],[2153201998,"WAN","Wanchain"],[2153225212,"WAVES","Waves"],[2155046253,"SEM","Semux"],[2155051384,"ION","ION"],[2155308914,"WGR","WGR"],[2155308915,"OBSR","OBServer"],[2162602624,"XDS","XDS"],[2209201209,"AQUA","Aquachain"],[2236372536,"HATCH","Hatch"],[2239410657,"kUSD","kUSD"],[2247483645,"EQ","EQ"],[2247483646,"FLUID","Fluid Chains"],[2247483647,"QKC","QuarkChain"]],bn$6={exports:{}};bn$6.exports;(function(c){(function(t,n){function ie(_e,se){if(!_e)throw new Error(se||"Assertion failed")}function fe(_e,se){_e.super_=se;var ce=function(){};ce.prototype=se.prototype,_e.prototype=new ce,_e.prototype.constructor=_e}function ae(_e,se,ce){if(ae.isBN(_e))return _e;this.negative=0,this.words=null,this.length=0,this.red=null,_e!==null&&((se==="le"||se==="be")&&(ce=se,se=10),this._init(_e||0,se||10,ce||"be"))}typeof t=="object"?t.exports=ae:n.BN=ae,ae.BN=ae,ae.wordSize=26;var le;try{typeof window<"u"&&typeof window.Buffer<"u"?le=window.Buffer:le=dist$1.Buffer}catch{}ae.isBN=function(se){return se instanceof ae?!0:se!==null&&typeof se=="object"&&se.constructor.wordSize===ae.wordSize&&Array.isArray(se.words)},ae.max=function(se,ce){return se.cmp(ce)>0?se:ce},ae.min=function(se,ce){return se.cmp(ce)<0?se:ce},ae.prototype._init=function(se,ce,de){if(typeof se=="number")return this._initNumber(se,ce,de);if(typeof se=="object")return this._initArray(se,ce,de);ce==="hex"&&(ce=16),ie(ce===(ce|0)&&ce>=2&&ce<=36),se=se.toString().replace(/\s+/g,"");var he=0;se[0]==="-"&&(he++,this.negative=1),he<se.length&&(ce===16?this._parseHex(se,he,de):(this._parseBase(se,ce,he),de==="le"&&this._initArray(this.toArray(),ce,de)))},ae.prototype._initNumber=function(se,ce,de){se<0&&(this.negative=1,se=-se),se<67108864?(this.words=[se&67108863],this.length=1):se<4503599627370496?(this.words=[se&67108863,se/67108864&67108863],this.length=2):(ie(se<9007199254740992),this.words=[se&67108863,se/67108864&67108863,1],this.length=3),de==="le"&&this._initArray(this.toArray(),ce,de)},ae.prototype._initArray=function(se,ce,de){if(ie(typeof se.length=="number"),se.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(se.length/3),this.words=new Array(this.length);for(var he=0;he<this.length;he++)this.words[he]=0;var ve,we,Ae=0;if(de==="be")for(he=se.length-1,ve=0;he>=0;he-=3)we=se[he]|se[he-1]<<8|se[he-2]<<16,this.words[ve]|=we<<Ae&67108863,this.words[ve+1]=we>>>26-Ae&67108863,Ae+=24,Ae>=26&&(Ae-=26,ve++);else if(de==="le")for(he=0,ve=0;he<se.length;he+=3)we=se[he]|se[he+1]<<8|se[he+2]<<16,this.words[ve]|=we<<Ae&67108863,this.words[ve+1]=we>>>26-Ae&67108863,Ae+=24,Ae>=26&&(Ae-=26,ve++);return this.strip()};function pe(_e,se){var ce=_e.charCodeAt(se);return ce>=65&&ce<=70?ce-55:ce>=97&&ce<=102?ce-87:ce-48&15}function me(_e,se,ce){var de=pe(_e,ce);return ce-1>=se&&(de|=pe(_e,ce-1)<<4),de}ae.prototype._parseHex=function(se,ce,de){this.length=Math.ceil((se.length-ce)/6),this.words=new Array(this.length);for(var he=0;he<this.length;he++)this.words[he]=0;var ve=0,we=0,Ae;if(de==="be")for(he=se.length-1;he>=ce;he-=2)Ae=me(se,ce,he)<<ve,this.words[we]|=Ae&67108863,ve>=18?(ve-=18,we+=1,this.words[we]|=Ae>>>26):ve+=8;else{var be=se.length-ce;for(he=be%2===0?ce+1:ce;he<se.length;he+=2)Ae=me(se,ce,he)<<ve,this.words[we]|=Ae&67108863,ve>=18?(ve-=18,we+=1,this.words[we]|=Ae>>>26):ve+=8}this.strip()};function ye(_e,se,ce,de){for(var he=0,ve=Math.min(_e.length,ce),we=se;we<ve;we++){var Ae=_e.charCodeAt(we)-48;he*=de,Ae>=49?he+=Ae-49+10:Ae>=17?he+=Ae-17+10:he+=Ae}return he}ae.prototype._parseBase=function(se,ce,de){this.words=[0],this.length=1;for(var he=0,ve=1;ve<=67108863;ve*=ce)he++;he--,ve=ve/ce|0;for(var we=se.length-de,Ae=we%he,be=Math.min(we,we-Ae)+de,ue=0,ge=de;ge<be;ge+=he)ue=ye(se,ge,ge+he,ce),this.imuln(ve),this.words[0]+ue<67108864?this.words[0]+=ue:this._iaddn(ue);if(Ae!==0){var Re=1;for(ue=ye(se,ge,se.length,ce),ge=0;ge<Ae;ge++)Re*=ce;this.imuln(Re),this.words[0]+ue<67108864?this.words[0]+=ue:this._iaddn(ue)}this.strip()},ae.prototype.copy=function(se){se.words=new Array(this.length);for(var ce=0;ce<this.length;ce++)se.words[ce]=this.words[ce];se.length=this.length,se.negative=this.negative,se.red=this.red},ae.prototype.clone=function(){var se=new ae(null);return this.copy(se),se},ae.prototype._expand=function(se){for(;this.length<se;)this.words[this.length++]=0;return this},ae.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},ae.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},ae.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var xe=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Ee=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Se=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];ae.prototype.toString=function(se,ce){se=se||10,ce=ce|0||1;var de;if(se===16||se==="hex"){de="";for(var he=0,ve=0,we=0;we<this.length;we++){var Ae=this.words[we],be=((Ae<<he|ve)&16777215).toString(16);ve=Ae>>>24-he&16777215,he+=2,he>=26&&(he-=26,we--),ve!==0||we!==this.length-1?de=xe[6-be.length]+be+de:de=be+de}for(ve!==0&&(de=ve.toString(16)+de);de.length%ce!==0;)de="0"+de;return this.negative!==0&&(de="-"+de),de}if(se===(se|0)&&se>=2&&se<=36){var ue=Ee[se],ge=Se[se];de="";var Re=this.clone();for(Re.negative=0;!Re.isZero();){var Ne=Re.modn(ge).toString(se);Re=Re.idivn(ge),Re.isZero()?de=Ne+de:de=xe[ue-Ne.length]+Ne+de}for(this.isZero()&&(de="0"+de);de.length%ce!==0;)de="0"+de;return this.negative!==0&&(de="-"+de),de}ie(!1,"Base should be between 2 and 36")},ae.prototype.toNumber=function(){var se=this.words[0];return this.length===2?se+=this.words[1]*67108864:this.length===3&&this.words[2]===1?se+=4503599627370496+this.words[1]*67108864:this.length>2&&ie(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-se:se},ae.prototype.toJSON=function(){return this.toString(16)},ae.prototype.toBuffer=function(se,ce){return ie(typeof le<"u"),this.toArrayLike(le,se,ce)},ae.prototype.toArray=function(se,ce){return this.toArrayLike(Array,se,ce)},ae.prototype.toArrayLike=function(se,ce,de){var he=this.byteLength(),ve=de||Math.max(1,he);ie(he<=ve,"byte array longer than desired length"),ie(ve>0,"Requested array length <= 0"),this.strip();var we=ce==="le",Ae=new se(ve),be,ue,ge=this.clone();if(we){for(ue=0;!ge.isZero();ue++)be=ge.andln(255),ge.iushrn(8),Ae[ue]=be;for(;ue<ve;ue++)Ae[ue]=0}else{for(ue=0;ue<ve-he;ue++)Ae[ue]=0;for(ue=0;!ge.isZero();ue++)be=ge.andln(255),ge.iushrn(8),Ae[ve-ue-1]=be}return Ae},Math.clz32?ae.prototype._countBits=function(se){return 32-Math.clz32(se)}:ae.prototype._countBits=function(se){var ce=se,de=0;return ce>=4096&&(de+=13,ce>>>=13),ce>=64&&(de+=7,ce>>>=7),ce>=8&&(de+=4,ce>>>=4),ce>=2&&(de+=2,ce>>>=2),de+ce},ae.prototype._zeroBits=function(se){if(se===0)return 26;var ce=se,de=0;return ce&8191||(de+=13,ce>>>=13),ce&127||(de+=7,ce>>>=7),ce&15||(de+=4,ce>>>=4),ce&3||(de+=2,ce>>>=2),ce&1||de++,de},ae.prototype.bitLength=function(){var se=this.words[this.length-1],ce=this._countBits(se);return(this.length-1)*26+ce};function Me(_e){for(var se=new Array(_e.bitLength()),ce=0;ce<se.length;ce++){var de=ce/26|0,he=ce%26;se[ce]=(_e.words[de]&1<<he)>>>he}return se}ae.prototype.zeroBits=function(){if(this.isZero())return 0;for(var se=0,ce=0;ce<this.length;ce++){var de=this._zeroBits(this.words[ce]);if(se+=de,de!==26)break}return se},ae.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},ae.prototype.toTwos=function(se){return this.negative!==0?this.abs().inotn(se).iaddn(1):this.clone()},ae.prototype.fromTwos=function(se){return this.testn(se-1)?this.notn(se).iaddn(1).ineg():this.clone()},ae.prototype.isNeg=function(){return this.negative!==0},ae.prototype.neg=function(){return this.clone().ineg()},ae.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},ae.prototype.iuor=function(se){for(;this.length<se.length;)this.words[this.length++]=0;for(var ce=0;ce<se.length;ce++)this.words[ce]=this.words[ce]|se.words[ce];return this.strip()},ae.prototype.ior=function(se){return ie((this.negative|se.negative)===0),this.iuor(se)},ae.prototype.or=function(se){return this.length>se.length?this.clone().ior(se):se.clone().ior(this)},ae.prototype.uor=function(se){return this.length>se.length?this.clone().iuor(se):se.clone().iuor(this)},ae.prototype.iuand=function(se){var ce;this.length>se.length?ce=se:ce=this;for(var de=0;de<ce.length;de++)this.words[de]=this.words[de]&se.words[de];return this.length=ce.length,this.strip()},ae.prototype.iand=function(se){return ie((this.negative|se.negative)===0),this.iuand(se)},ae.prototype.and=function(se){return this.length>se.length?this.clone().iand(se):se.clone().iand(this)},ae.prototype.uand=function(se){return this.length>se.length?this.clone().iuand(se):se.clone().iuand(this)},ae.prototype.iuxor=function(se){var ce,de;this.length>se.length?(ce=this,de=se):(ce=se,de=this);for(var he=0;he<de.length;he++)this.words[he]=ce.words[he]^de.words[he];if(this!==ce)for(;he<ce.length;he++)this.words[he]=ce.words[he];return this.length=ce.length,this.strip()},ae.prototype.ixor=function(se){return ie((this.negative|se.negative)===0),this.iuxor(se)},ae.prototype.xor=function(se){return this.length>se.length?this.clone().ixor(se):se.clone().ixor(this)},ae.prototype.uxor=function(se){return this.length>se.length?this.clone().iuxor(se):se.clone().iuxor(this)},ae.prototype.inotn=function(se){ie(typeof se=="number"&&se>=0);var ce=Math.ceil(se/26)|0,de=se%26;this._expand(ce),de>0&&ce--;for(var he=0;he<ce;he++)this.words[he]=~this.words[he]&67108863;return de>0&&(this.words[he]=~this.words[he]&67108863>>26-de),this.strip()},ae.prototype.notn=function(se){return this.clone().inotn(se)},ae.prototype.setn=function(se,ce){ie(typeof se=="number"&&se>=0);var de=se/26|0,he=se%26;return this._expand(de+1),ce?this.words[de]=this.words[de]|1<<he:this.words[de]=this.words[de]&~(1<<he),this.strip()},ae.prototype.iadd=function(se){var ce;if(this.negative!==0&&se.negative===0)return this.negative=0,ce=this.isub(se),this.negative^=1,this._normSign();if(this.negative===0&&se.negative!==0)return se.negative=0,ce=this.isub(se),se.negative=1,ce._normSign();var de,he;this.length>se.length?(de=this,he=se):(de=se,he=this);for(var ve=0,we=0;we<he.length;we++)ce=(de.words[we]|0)+(he.words[we]|0)+ve,this.words[we]=ce&67108863,ve=ce>>>26;for(;ve!==0&&we<de.length;we++)ce=(de.words[we]|0)+ve,this.words[we]=ce&67108863,ve=ce>>>26;if(this.length=de.length,ve!==0)this.words[this.length]=ve,this.length++;else if(de!==this)for(;we<de.length;we++)this.words[we]=de.words[we];return this},ae.prototype.add=function(se){var ce;return se.negative!==0&&this.negative===0?(se.negative=0,ce=this.sub(se),se.negative^=1,ce):se.negative===0&&this.negative!==0?(this.negative=0,ce=se.sub(this),this.negative=1,ce):this.length>se.length?this.clone().iadd(se):se.clone().iadd(this)},ae.prototype.isub=function(se){if(se.negative!==0){se.negative=0;var ce=this.iadd(se);return se.negative=1,ce._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(se),this.negative=1,this._normSign();var de=this.cmp(se);if(de===0)return this.negative=0,this.length=1,this.words[0]=0,this;var he,ve;de>0?(he=this,ve=se):(he=se,ve=this);for(var we=0,Ae=0;Ae<ve.length;Ae++)ce=(he.words[Ae]|0)-(ve.words[Ae]|0)+we,we=ce>>26,this.words[Ae]=ce&67108863;for(;we!==0&&Ae<he.length;Ae++)ce=(he.words[Ae]|0)+we,we=ce>>26,this.words[Ae]=ce&67108863;if(we===0&&Ae<he.length&&he!==this)for(;Ae<he.length;Ae++)this.words[Ae]=he.words[Ae];return this.length=Math.max(this.length,Ae),he!==this&&(this.negative=1),this.strip()},ae.prototype.sub=function(se){return this.clone().isub(se)};function Be(_e,se,ce){ce.negative=se.negative^_e.negative;var de=_e.length+se.length|0;ce.length=de,de=de-1|0;var he=_e.words[0]|0,ve=se.words[0]|0,we=he*ve,Ae=we&67108863,be=we/67108864|0;ce.words[0]=Ae;for(var ue=1;ue<de;ue++){for(var ge=be>>>26,Re=be&67108863,Ne=Math.min(ue,se.length-1),qe=Math.max(0,ue-_e.length+1);qe<=Ne;qe++){var Pe=ue-qe|0;he=_e.words[Pe]|0,ve=se.words[qe]|0,we=he*ve+Re,ge+=we/67108864|0,Re=we&67108863}ce.words[ue]=Re|0,be=ge|0}return be!==0?ce.words[ue]=be|0:ce.length--,ce.strip()}var $e=function(se,ce,de){var he=se.words,ve=ce.words,we=de.words,Ae=0,be,ue,ge,Re=he[0]|0,Ne=Re&8191,qe=Re>>>13,Pe=he[1]|0,Ge=Pe&8191,Ce=Pe>>>13,De=he[2]|0,je=De&8191,Ve=De>>>13,Mt=he[3]|0,Oe=Mt&8191,We=Mt>>>13,jt=he[4]|0,Dt=jt&8191,Ht=jt>>>13,vn=he[5]|0,Vt=vn&8191,Kt=vn>>>13,En=he[6]|0,en=En&8191,Xt=En>>>13,_n=he[7]|0,Ze=_n&8191,Rt=_n>>>13,Qt=he[8]|0,Ft=Qt&8191,Wt=Qt>>>13,an=he[9]|0,Zt=an&8191,Jt=an>>>13,An=ve[0]|0,tn=An&8191,nn=An>>>13,Sn=ve[1]|0,rn=Sn&8191,dn=Sn>>>13,Mn=ve[2]|0,sn=Mn&8191,ln=Mn>>>13,Bn=ve[3]|0,un=Bn&8191,hn=Bn>>>13,Cn=ve[4]|0,yn=Cn&8191,xn=Cn>>>13,Nn=ve[5]|0,Qe=Nn&8191,Ke=Nn>>>13,Ye=ve[6]|0,Pt=Ye&8191,Gt=Ye>>>13,gn=ve[7]|0,Yt=gn&8191,cn=gn>>>13,$n=ve[8]|0,fn=$n&8191,pn=$n>>>13,Rn=ve[9]|0,mn=Rn&8191,wn=Rn>>>13;de.negative=se.negative^ce.negative,de.length=19,be=Math.imul(Ne,tn),ue=Math.imul(Ne,nn),ue=ue+Math.imul(qe,tn)|0,ge=Math.imul(qe,nn);var kn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(kn>>>26)|0,kn&=67108863,be=Math.imul(Ge,tn),ue=Math.imul(Ge,nn),ue=ue+Math.imul(Ce,tn)|0,ge=Math.imul(Ce,nn),be=be+Math.imul(Ne,rn)|0,ue=ue+Math.imul(Ne,dn)|0,ue=ue+Math.imul(qe,rn)|0,ge=ge+Math.imul(qe,dn)|0;var Tn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,be=Math.imul(je,tn),ue=Math.imul(je,nn),ue=ue+Math.imul(Ve,tn)|0,ge=Math.imul(Ve,nn),be=be+Math.imul(Ge,rn)|0,ue=ue+Math.imul(Ge,dn)|0,ue=ue+Math.imul(Ce,rn)|0,ge=ge+Math.imul(Ce,dn)|0,be=be+Math.imul(Ne,sn)|0,ue=ue+Math.imul(Ne,ln)|0,ue=ue+Math.imul(qe,sn)|0,ge=ge+Math.imul(qe,ln)|0;var In=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(In>>>26)|0,In&=67108863,be=Math.imul(Oe,tn),ue=Math.imul(Oe,nn),ue=ue+Math.imul(We,tn)|0,ge=Math.imul(We,nn),be=be+Math.imul(je,rn)|0,ue=ue+Math.imul(je,dn)|0,ue=ue+Math.imul(Ve,rn)|0,ge=ge+Math.imul(Ve,dn)|0,be=be+Math.imul(Ge,sn)|0,ue=ue+Math.imul(Ge,ln)|0,ue=ue+Math.imul(Ce,sn)|0,ge=ge+Math.imul(Ce,ln)|0,be=be+Math.imul(Ne,un)|0,ue=ue+Math.imul(Ne,hn)|0,ue=ue+Math.imul(qe,un)|0,ge=ge+Math.imul(qe,hn)|0;var Pn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,be=Math.imul(Dt,tn),ue=Math.imul(Dt,nn),ue=ue+Math.imul(Ht,tn)|0,ge=Math.imul(Ht,nn),be=be+Math.imul(Oe,rn)|0,ue=ue+Math.imul(Oe,dn)|0,ue=ue+Math.imul(We,rn)|0,ge=ge+Math.imul(We,dn)|0,be=be+Math.imul(je,sn)|0,ue=ue+Math.imul(je,ln)|0,ue=ue+Math.imul(Ve,sn)|0,ge=ge+Math.imul(Ve,ln)|0,be=be+Math.imul(Ge,un)|0,ue=ue+Math.imul(Ge,hn)|0,ue=ue+Math.imul(Ce,un)|0,ge=ge+Math.imul(Ce,hn)|0,be=be+Math.imul(Ne,yn)|0,ue=ue+Math.imul(Ne,xn)|0,ue=ue+Math.imul(qe,yn)|0,ge=ge+Math.imul(qe,xn)|0;var On=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(On>>>26)|0,On&=67108863,be=Math.imul(Vt,tn),ue=Math.imul(Vt,nn),ue=ue+Math.imul(Kt,tn)|0,ge=Math.imul(Kt,nn),be=be+Math.imul(Dt,rn)|0,ue=ue+Math.imul(Dt,dn)|0,ue=ue+Math.imul(Ht,rn)|0,ge=ge+Math.imul(Ht,dn)|0,be=be+Math.imul(Oe,sn)|0,ue=ue+Math.imul(Oe,ln)|0,ue=ue+Math.imul(We,sn)|0,ge=ge+Math.imul(We,ln)|0,be=be+Math.imul(je,un)|0,ue=ue+Math.imul(je,hn)|0,ue=ue+Math.imul(Ve,un)|0,ge=ge+Math.imul(Ve,hn)|0,be=be+Math.imul(Ge,yn)|0,ue=ue+Math.imul(Ge,xn)|0,ue=ue+Math.imul(Ce,yn)|0,ge=ge+Math.imul(Ce,xn)|0,be=be+Math.imul(Ne,Qe)|0,ue=ue+Math.imul(Ne,Ke)|0,ue=ue+Math.imul(qe,Qe)|0,ge=ge+Math.imul(qe,Ke)|0;var Dn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,be=Math.imul(en,tn),ue=Math.imul(en,nn),ue=ue+Math.imul(Xt,tn)|0,ge=Math.imul(Xt,nn),be=be+Math.imul(Vt,rn)|0,ue=ue+Math.imul(Vt,dn)|0,ue=ue+Math.imul(Kt,rn)|0,ge=ge+Math.imul(Kt,dn)|0,be=be+Math.imul(Dt,sn)|0,ue=ue+Math.imul(Dt,ln)|0,ue=ue+Math.imul(Ht,sn)|0,ge=ge+Math.imul(Ht,ln)|0,be=be+Math.imul(Oe,un)|0,ue=ue+Math.imul(Oe,hn)|0,ue=ue+Math.imul(We,un)|0,ge=ge+Math.imul(We,hn)|0,be=be+Math.imul(je,yn)|0,ue=ue+Math.imul(je,xn)|0,ue=ue+Math.imul(Ve,yn)|0,ge=ge+Math.imul(Ve,xn)|0,be=be+Math.imul(Ge,Qe)|0,ue=ue+Math.imul(Ge,Ke)|0,ue=ue+Math.imul(Ce,Qe)|0,ge=ge+Math.imul(Ce,Ke)|0,be=be+Math.imul(Ne,Pt)|0,ue=ue+Math.imul(Ne,Gt)|0,ue=ue+Math.imul(qe,Pt)|0,ge=ge+Math.imul(qe,Gt)|0;var Ln=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,be=Math.imul(Ze,tn),ue=Math.imul(Ze,nn),ue=ue+Math.imul(Rt,tn)|0,ge=Math.imul(Rt,nn),be=be+Math.imul(en,rn)|0,ue=ue+Math.imul(en,dn)|0,ue=ue+Math.imul(Xt,rn)|0,ge=ge+Math.imul(Xt,dn)|0,be=be+Math.imul(Vt,sn)|0,ue=ue+Math.imul(Vt,ln)|0,ue=ue+Math.imul(Kt,sn)|0,ge=ge+Math.imul(Kt,ln)|0,be=be+Math.imul(Dt,un)|0,ue=ue+Math.imul(Dt,hn)|0,ue=ue+Math.imul(Ht,un)|0,ge=ge+Math.imul(Ht,hn)|0,be=be+Math.imul(Oe,yn)|0,ue=ue+Math.imul(Oe,xn)|0,ue=ue+Math.imul(We,yn)|0,ge=ge+Math.imul(We,xn)|0,be=be+Math.imul(je,Qe)|0,ue=ue+Math.imul(je,Ke)|0,ue=ue+Math.imul(Ve,Qe)|0,ge=ge+Math.imul(Ve,Ke)|0,be=be+Math.imul(Ge,Pt)|0,ue=ue+Math.imul(Ge,Gt)|0,ue=ue+Math.imul(Ce,Pt)|0,ge=ge+Math.imul(Ce,Gt)|0,be=be+Math.imul(Ne,Yt)|0,ue=ue+Math.imul(Ne,cn)|0,ue=ue+Math.imul(qe,Yt)|0,ge=ge+Math.imul(qe,cn)|0;var Fn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,be=Math.imul(Ft,tn),ue=Math.imul(Ft,nn),ue=ue+Math.imul(Wt,tn)|0,ge=Math.imul(Wt,nn),be=be+Math.imul(Ze,rn)|0,ue=ue+Math.imul(Ze,dn)|0,ue=ue+Math.imul(Rt,rn)|0,ge=ge+Math.imul(Rt,dn)|0,be=be+Math.imul(en,sn)|0,ue=ue+Math.imul(en,ln)|0,ue=ue+Math.imul(Xt,sn)|0,ge=ge+Math.imul(Xt,ln)|0,be=be+Math.imul(Vt,un)|0,ue=ue+Math.imul(Vt,hn)|0,ue=ue+Math.imul(Kt,un)|0,ge=ge+Math.imul(Kt,hn)|0,be=be+Math.imul(Dt,yn)|0,ue=ue+Math.imul(Dt,xn)|0,ue=ue+Math.imul(Ht,yn)|0,ge=ge+Math.imul(Ht,xn)|0,be=be+Math.imul(Oe,Qe)|0,ue=ue+Math.imul(Oe,Ke)|0,ue=ue+Math.imul(We,Qe)|0,ge=ge+Math.imul(We,Ke)|0,be=be+Math.imul(je,Pt)|0,ue=ue+Math.imul(je,Gt)|0,ue=ue+Math.imul(Ve,Pt)|0,ge=ge+Math.imul(Ve,Gt)|0,be=be+Math.imul(Ge,Yt)|0,ue=ue+Math.imul(Ge,cn)|0,ue=ue+Math.imul(Ce,Yt)|0,ge=ge+Math.imul(Ce,cn)|0,be=be+Math.imul(Ne,fn)|0,ue=ue+Math.imul(Ne,pn)|0,ue=ue+Math.imul(qe,fn)|0,ge=ge+Math.imul(qe,pn)|0;var qn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(qn>>>26)|0,qn&=67108863,be=Math.imul(Zt,tn),ue=Math.imul(Zt,nn),ue=ue+Math.imul(Jt,tn)|0,ge=Math.imul(Jt,nn),be=be+Math.imul(Ft,rn)|0,ue=ue+Math.imul(Ft,dn)|0,ue=ue+Math.imul(Wt,rn)|0,ge=ge+Math.imul(Wt,dn)|0,be=be+Math.imul(Ze,sn)|0,ue=ue+Math.imul(Ze,ln)|0,ue=ue+Math.imul(Rt,sn)|0,ge=ge+Math.imul(Rt,ln)|0,be=be+Math.imul(en,un)|0,ue=ue+Math.imul(en,hn)|0,ue=ue+Math.imul(Xt,un)|0,ge=ge+Math.imul(Xt,hn)|0,be=be+Math.imul(Vt,yn)|0,ue=ue+Math.imul(Vt,xn)|0,ue=ue+Math.imul(Kt,yn)|0,ge=ge+Math.imul(Kt,xn)|0,be=be+Math.imul(Dt,Qe)|0,ue=ue+Math.imul(Dt,Ke)|0,ue=ue+Math.imul(Ht,Qe)|0,ge=ge+Math.imul(Ht,Ke)|0,be=be+Math.imul(Oe,Pt)|0,ue=ue+Math.imul(Oe,Gt)|0,ue=ue+Math.imul(We,Pt)|0,ge=ge+Math.imul(We,Gt)|0,be=be+Math.imul(je,Yt)|0,ue=ue+Math.imul(je,cn)|0,ue=ue+Math.imul(Ve,Yt)|0,ge=ge+Math.imul(Ve,cn)|0,be=be+Math.imul(Ge,fn)|0,ue=ue+Math.imul(Ge,pn)|0,ue=ue+Math.imul(Ce,fn)|0,ge=ge+Math.imul(Ce,pn)|0,be=be+Math.imul(Ne,mn)|0,ue=ue+Math.imul(Ne,wn)|0,ue=ue+Math.imul(qe,mn)|0,ge=ge+Math.imul(qe,wn)|0;var Un=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Un>>>26)|0,Un&=67108863,be=Math.imul(Zt,rn),ue=Math.imul(Zt,dn),ue=ue+Math.imul(Jt,rn)|0,ge=Math.imul(Jt,dn),be=be+Math.imul(Ft,sn)|0,ue=ue+Math.imul(Ft,ln)|0,ue=ue+Math.imul(Wt,sn)|0,ge=ge+Math.imul(Wt,ln)|0,be=be+Math.imul(Ze,un)|0,ue=ue+Math.imul(Ze,hn)|0,ue=ue+Math.imul(Rt,un)|0,ge=ge+Math.imul(Rt,hn)|0,be=be+Math.imul(en,yn)|0,ue=ue+Math.imul(en,xn)|0,ue=ue+Math.imul(Xt,yn)|0,ge=ge+Math.imul(Xt,xn)|0,be=be+Math.imul(Vt,Qe)|0,ue=ue+Math.imul(Vt,Ke)|0,ue=ue+Math.imul(Kt,Qe)|0,ge=ge+Math.imul(Kt,Ke)|0,be=be+Math.imul(Dt,Pt)|0,ue=ue+Math.imul(Dt,Gt)|0,ue=ue+Math.imul(Ht,Pt)|0,ge=ge+Math.imul(Ht,Gt)|0,be=be+Math.imul(Oe,Yt)|0,ue=ue+Math.imul(Oe,cn)|0,ue=ue+Math.imul(We,Yt)|0,ge=ge+Math.imul(We,cn)|0,be=be+Math.imul(je,fn)|0,ue=ue+Math.imul(je,pn)|0,ue=ue+Math.imul(Ve,fn)|0,ge=ge+Math.imul(Ve,pn)|0,be=be+Math.imul(Ge,mn)|0,ue=ue+Math.imul(Ge,wn)|0,ue=ue+Math.imul(Ce,mn)|0,ge=ge+Math.imul(Ce,wn)|0;var Kn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Kn>>>26)|0,Kn&=67108863,be=Math.imul(Zt,sn),ue=Math.imul(Zt,ln),ue=ue+Math.imul(Jt,sn)|0,ge=Math.imul(Jt,ln),be=be+Math.imul(Ft,un)|0,ue=ue+Math.imul(Ft,hn)|0,ue=ue+Math.imul(Wt,un)|0,ge=ge+Math.imul(Wt,hn)|0,be=be+Math.imul(Ze,yn)|0,ue=ue+Math.imul(Ze,xn)|0,ue=ue+Math.imul(Rt,yn)|0,ge=ge+Math.imul(Rt,xn)|0,be=be+Math.imul(en,Qe)|0,ue=ue+Math.imul(en,Ke)|0,ue=ue+Math.imul(Xt,Qe)|0,ge=ge+Math.imul(Xt,Ke)|0,be=be+Math.imul(Vt,Pt)|0,ue=ue+Math.imul(Vt,Gt)|0,ue=ue+Math.imul(Kt,Pt)|0,ge=ge+Math.imul(Kt,Gt)|0,be=be+Math.imul(Dt,Yt)|0,ue=ue+Math.imul(Dt,cn)|0,ue=ue+Math.imul(Ht,Yt)|0,ge=ge+Math.imul(Ht,cn)|0,be=be+Math.imul(Oe,fn)|0,ue=ue+Math.imul(Oe,pn)|0,ue=ue+Math.imul(We,fn)|0,ge=ge+Math.imul(We,pn)|0,be=be+Math.imul(je,mn)|0,ue=ue+Math.imul(je,wn)|0,ue=ue+Math.imul(Ve,mn)|0,ge=ge+Math.imul(Ve,wn)|0;var Hn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,be=Math.imul(Zt,un),ue=Math.imul(Zt,hn),ue=ue+Math.imul(Jt,un)|0,ge=Math.imul(Jt,hn),be=be+Math.imul(Ft,yn)|0,ue=ue+Math.imul(Ft,xn)|0,ue=ue+Math.imul(Wt,yn)|0,ge=ge+Math.imul(Wt,xn)|0,be=be+Math.imul(Ze,Qe)|0,ue=ue+Math.imul(Ze,Ke)|0,ue=ue+Math.imul(Rt,Qe)|0,ge=ge+Math.imul(Rt,Ke)|0,be=be+Math.imul(en,Pt)|0,ue=ue+Math.imul(en,Gt)|0,ue=ue+Math.imul(Xt,Pt)|0,ge=ge+Math.imul(Xt,Gt)|0,be=be+Math.imul(Vt,Yt)|0,ue=ue+Math.imul(Vt,cn)|0,ue=ue+Math.imul(Kt,Yt)|0,ge=ge+Math.imul(Kt,cn)|0,be=be+Math.imul(Dt,fn)|0,ue=ue+Math.imul(Dt,pn)|0,ue=ue+Math.imul(Ht,fn)|0,ge=ge+Math.imul(Ht,pn)|0,be=be+Math.imul(Oe,mn)|0,ue=ue+Math.imul(Oe,wn)|0,ue=ue+Math.imul(We,mn)|0,ge=ge+Math.imul(We,wn)|0;var jn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(jn>>>26)|0,jn&=67108863,be=Math.imul(Zt,yn),ue=Math.imul(Zt,xn),ue=ue+Math.imul(Jt,yn)|0,ge=Math.imul(Jt,xn),be=be+Math.imul(Ft,Qe)|0,ue=ue+Math.imul(Ft,Ke)|0,ue=ue+Math.imul(Wt,Qe)|0,ge=ge+Math.imul(Wt,Ke)|0,be=be+Math.imul(Ze,Pt)|0,ue=ue+Math.imul(Ze,Gt)|0,ue=ue+Math.imul(Rt,Pt)|0,ge=ge+Math.imul(Rt,Gt)|0,be=be+Math.imul(en,Yt)|0,ue=ue+Math.imul(en,cn)|0,ue=ue+Math.imul(Xt,Yt)|0,ge=ge+Math.imul(Xt,cn)|0,be=be+Math.imul(Vt,fn)|0,ue=ue+Math.imul(Vt,pn)|0,ue=ue+Math.imul(Kt,fn)|0,ge=ge+Math.imul(Kt,pn)|0,be=be+Math.imul(Dt,mn)|0,ue=ue+Math.imul(Dt,wn)|0,ue=ue+Math.imul(Ht,mn)|0,ge=ge+Math.imul(Ht,wn)|0;var zn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(zn>>>26)|0,zn&=67108863,be=Math.imul(Zt,Qe),ue=Math.imul(Zt,Ke),ue=ue+Math.imul(Jt,Qe)|0,ge=Math.imul(Jt,Ke),be=be+Math.imul(Ft,Pt)|0,ue=ue+Math.imul(Ft,Gt)|0,ue=ue+Math.imul(Wt,Pt)|0,ge=ge+Math.imul(Wt,Gt)|0,be=be+Math.imul(Ze,Yt)|0,ue=ue+Math.imul(Ze,cn)|0,ue=ue+Math.imul(Rt,Yt)|0,ge=ge+Math.imul(Rt,cn)|0,be=be+Math.imul(en,fn)|0,ue=ue+Math.imul(en,pn)|0,ue=ue+Math.imul(Xt,fn)|0,ge=ge+Math.imul(Xt,pn)|0,be=be+Math.imul(Vt,mn)|0,ue=ue+Math.imul(Vt,wn)|0,ue=ue+Math.imul(Kt,mn)|0,ge=ge+Math.imul(Kt,wn)|0;var Gn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,be=Math.imul(Zt,Pt),ue=Math.imul(Zt,Gt),ue=ue+Math.imul(Jt,Pt)|0,ge=Math.imul(Jt,Gt),be=be+Math.imul(Ft,Yt)|0,ue=ue+Math.imul(Ft,cn)|0,ue=ue+Math.imul(Wt,Yt)|0,ge=ge+Math.imul(Wt,cn)|0,be=be+Math.imul(Ze,fn)|0,ue=ue+Math.imul(Ze,pn)|0,ue=ue+Math.imul(Rt,fn)|0,ge=ge+Math.imul(Rt,pn)|0,be=be+Math.imul(en,mn)|0,ue=ue+Math.imul(en,wn)|0,ue=ue+Math.imul(Xt,mn)|0,ge=ge+Math.imul(Xt,wn)|0;var Wn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,be=Math.imul(Zt,Yt),ue=Math.imul(Zt,cn),ue=ue+Math.imul(Jt,Yt)|0,ge=Math.imul(Jt,cn),be=be+Math.imul(Ft,fn)|0,ue=ue+Math.imul(Ft,pn)|0,ue=ue+Math.imul(Wt,fn)|0,ge=ge+Math.imul(Wt,pn)|0,be=be+Math.imul(Ze,mn)|0,ue=ue+Math.imul(Ze,wn)|0,ue=ue+Math.imul(Rt,mn)|0,ge=ge+Math.imul(Rt,wn)|0;var Vn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,be=Math.imul(Zt,fn),ue=Math.imul(Zt,pn),ue=ue+Math.imul(Jt,fn)|0,ge=Math.imul(Jt,pn),be=be+Math.imul(Ft,mn)|0,ue=ue+Math.imul(Ft,wn)|0,ue=ue+Math.imul(Wt,mn)|0,ge=ge+Math.imul(Wt,wn)|0;var Zn=(Ae+be|0)+((ue&8191)<<13)|0;Ae=(ge+(ue>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,be=Math.imul(Zt,mn),ue=Math.imul(Zt,wn),ue=ue+Math.imul(Jt,mn)|0,ge=Math.imul(Jt,wn);var Jn=(Ae+be|0)+((ue&8191)<<13)|0;return Ae=(ge+(ue>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,we[0]=kn,we[1]=Tn,we[2]=In,we[3]=Pn,we[4]=On,we[5]=Dn,we[6]=Ln,we[7]=Fn,we[8]=qn,we[9]=Un,we[10]=Kn,we[11]=Hn,we[12]=jn,we[13]=zn,we[14]=Gn,we[15]=Wn,we[16]=Vn,we[17]=Zn,we[18]=Jn,Ae!==0&&(we[19]=Ae,de.length++),de};Math.imul||($e=Be);function ke(_e,se,ce){ce.negative=se.negative^_e.negative,ce.length=_e.length+se.length;for(var de=0,he=0,ve=0;ve<ce.length-1;ve++){var we=he;he=0;for(var Ae=de&67108863,be=Math.min(ve,se.length-1),ue=Math.max(0,ve-_e.length+1);ue<=be;ue++){var ge=ve-ue,Re=_e.words[ge]|0,Ne=se.words[ue]|0,qe=Re*Ne,Pe=qe&67108863;we=we+(qe/67108864|0)|0,Pe=Pe+Ae|0,Ae=Pe&67108863,we=we+(Pe>>>26)|0,he+=we>>>26,we&=67108863}ce.words[ve]=Ae,de=we,we=he}return de!==0?ce.words[ve]=de:ce.length--,ce.strip()}function Te(_e,se,ce){var de=new Ie;return de.mulp(_e,se,ce)}ae.prototype.mulTo=function(se,ce){var de,he=this.length+se.length;return this.length===10&&se.length===10?de=$e(this,se,ce):he<63?de=Be(this,se,ce):he<1024?de=ke(this,se,ce):de=Te(this,se,ce),de};function Ie(_e,se){this.x=_e,this.y=se}Ie.prototype.makeRBT=function(se){for(var ce=new Array(se),de=ae.prototype._countBits(se)-1,he=0;he<se;he++)ce[he]=this.revBin(he,de,se);return ce},Ie.prototype.revBin=function(se,ce,de){if(se===0||se===de-1)return se;for(var he=0,ve=0;ve<ce;ve++)he|=(se&1)<<ce-ve-1,se>>=1;return he},Ie.prototype.permute=function(se,ce,de,he,ve,we){for(var Ae=0;Ae<we;Ae++)he[Ae]=ce[se[Ae]],ve[Ae]=de[se[Ae]]},Ie.prototype.transform=function(se,ce,de,he,ve,we){this.permute(we,se,ce,de,he,ve);for(var Ae=1;Ae<ve;Ae<<=1)for(var be=Ae<<1,ue=Math.cos(2*Math.PI/be),ge=Math.sin(2*Math.PI/be),Re=0;Re<ve;Re+=be)for(var Ne=ue,qe=ge,Pe=0;Pe<Ae;Pe++){var Ge=de[Re+Pe],Ce=he[Re+Pe],De=de[Re+Pe+Ae],je=he[Re+Pe+Ae],Ve=Ne*De-qe*je;je=Ne*je+qe*De,De=Ve,de[Re+Pe]=Ge+De,he[Re+Pe]=Ce+je,de[Re+Pe+Ae]=Ge-De,he[Re+Pe+Ae]=Ce-je,Pe!==be&&(Ve=ue*Ne-ge*qe,qe=ue*qe+ge*Ne,Ne=Ve)}},Ie.prototype.guessLen13b=function(se,ce){var de=Math.max(ce,se)|1,he=de&1,ve=0;for(de=de/2|0;de;de=de>>>1)ve++;return 1<<ve+1+he},Ie.prototype.conjugate=function(se,ce,de){if(!(de<=1))for(var he=0;he<de/2;he++){var ve=se[he];se[he]=se[de-he-1],se[de-he-1]=ve,ve=ce[he],ce[he]=-ce[de-he-1],ce[de-he-1]=-ve}},Ie.prototype.normalize13b=function(se,ce){for(var de=0,he=0;he<ce/2;he++){var ve=Math.round(se[2*he+1]/ce)*8192+Math.round(se[2*he]/ce)+de;se[he]=ve&67108863,ve<67108864?de=0:de=ve/67108864|0}return se},Ie.prototype.convert13b=function(se,ce,de,he){for(var ve=0,we=0;we<ce;we++)ve=ve+(se[we]|0),de[2*we]=ve&8191,ve=ve>>>13,de[2*we+1]=ve&8191,ve=ve>>>13;for(we=2*ce;we<he;++we)de[we]=0;ie(ve===0),ie((ve&-8192)===0)},Ie.prototype.stub=function(se){for(var ce=new Array(se),de=0;de<se;de++)ce[de]=0;return ce},Ie.prototype.mulp=function(se,ce,de){var he=2*this.guessLen13b(se.length,ce.length),ve=this.makeRBT(he),we=this.stub(he),Ae=new Array(he),be=new Array(he),ue=new Array(he),ge=new Array(he),Re=new Array(he),Ne=new Array(he),qe=de.words;qe.length=he,this.convert13b(se.words,se.length,Ae,he),this.convert13b(ce.words,ce.length,ge,he),this.transform(Ae,we,be,ue,he,ve),this.transform(ge,we,Re,Ne,he,ve);for(var Pe=0;Pe<he;Pe++){var Ge=be[Pe]*Re[Pe]-ue[Pe]*Ne[Pe];ue[Pe]=be[Pe]*Ne[Pe]+ue[Pe]*Re[Pe],be[Pe]=Ge}return this.conjugate(be,ue,he),this.transform(be,ue,qe,we,he,ve),this.conjugate(qe,we,he),this.normalize13b(qe,he),de.negative=se.negative^ce.negative,de.length=se.length+ce.length,de.strip()},ae.prototype.mul=function(se){var ce=new ae(null);return ce.words=new Array(this.length+se.length),this.mulTo(se,ce)},ae.prototype.mulf=function(se){var ce=new ae(null);return ce.words=new Array(this.length+se.length),Te(this,se,ce)},ae.prototype.imul=function(se){return this.clone().mulTo(se,this)},ae.prototype.imuln=function(se){ie(typeof se=="number"),ie(se<67108864);for(var ce=0,de=0;de<this.length;de++){var he=(this.words[de]|0)*se,ve=(he&67108863)+(ce&67108863);ce>>=26,ce+=he/67108864|0,ce+=ve>>>26,this.words[de]=ve&67108863}return ce!==0&&(this.words[de]=ce,this.length++),this.length=se===0?1:this.length,this},ae.prototype.muln=function(se){return this.clone().imuln(se)},ae.prototype.sqr=function(){return this.mul(this)},ae.prototype.isqr=function(){return this.imul(this.clone())},ae.prototype.pow=function(se){var ce=Me(se);if(ce.length===0)return new ae(1);for(var de=this,he=0;he<ce.length&&ce[he]===0;he++,de=de.sqr());if(++he<ce.length)for(var ve=de.sqr();he<ce.length;he++,ve=ve.sqr())ce[he]!==0&&(de=de.mul(ve));return de},ae.prototype.iushln=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26,he=67108863>>>26-ce<<26-ce,ve;if(ce!==0){var we=0;for(ve=0;ve<this.length;ve++){var Ae=this.words[ve]&he,be=(this.words[ve]|0)-Ae<<ce;this.words[ve]=be|we,we=Ae>>>26-ce}we&&(this.words[ve]=we,this.length++)}if(de!==0){for(ve=this.length-1;ve>=0;ve--)this.words[ve+de]=this.words[ve];for(ve=0;ve<de;ve++)this.words[ve]=0;this.length+=de}return this.strip()},ae.prototype.ishln=function(se){return ie(this.negative===0),this.iushln(se)},ae.prototype.iushrn=function(se,ce,de){ie(typeof se=="number"&&se>=0);var he;ce?he=(ce-ce%26)/26:he=0;var ve=se%26,we=Math.min((se-ve)/26,this.length),Ae=67108863^67108863>>>ve<<ve,be=de;if(he-=we,he=Math.max(0,he),be){for(var ue=0;ue<we;ue++)be.words[ue]=this.words[ue];be.length=we}if(we!==0)if(this.length>we)for(this.length-=we,ue=0;ue<this.length;ue++)this.words[ue]=this.words[ue+we];else this.words[0]=0,this.length=1;var ge=0;for(ue=this.length-1;ue>=0&&(ge!==0||ue>=he);ue--){var Re=this.words[ue]|0;this.words[ue]=ge<<26-ve|Re>>>ve,ge=Re&Ae}return be&&ge!==0&&(be.words[be.length++]=ge),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},ae.prototype.ishrn=function(se,ce,de){return ie(this.negative===0),this.iushrn(se,ce,de)},ae.prototype.shln=function(se){return this.clone().ishln(se)},ae.prototype.ushln=function(se){return this.clone().iushln(se)},ae.prototype.shrn=function(se){return this.clone().ishrn(se)},ae.prototype.ushrn=function(se){return this.clone().iushrn(se)},ae.prototype.testn=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26,he=1<<ce;if(this.length<=de)return!1;var ve=this.words[de];return!!(ve&he)},ae.prototype.imaskn=function(se){ie(typeof se=="number"&&se>=0);var ce=se%26,de=(se-ce)/26;if(ie(this.negative===0,"imaskn works only with positive numbers"),this.length<=de)return this;if(ce!==0&&de++,this.length=Math.min(de,this.length),ce!==0){var he=67108863^67108863>>>ce<<ce;this.words[this.length-1]&=he}return this.strip()},ae.prototype.maskn=function(se){return this.clone().imaskn(se)},ae.prototype.iaddn=function(se){return ie(typeof se=="number"),ie(se<67108864),se<0?this.isubn(-se):this.negative!==0?this.length===1&&(this.words[0]|0)<se?(this.words[0]=se-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(se),this.negative=1,this):this._iaddn(se)},ae.prototype._iaddn=function(se){this.words[0]+=se;for(var ce=0;ce<this.length&&this.words[ce]>=67108864;ce++)this.words[ce]-=67108864,ce===this.length-1?this.words[ce+1]=1:this.words[ce+1]++;return this.length=Math.max(this.length,ce+1),this},ae.prototype.isubn=function(se){if(ie(typeof se=="number"),ie(se<67108864),se<0)return this.iaddn(-se);if(this.negative!==0)return this.negative=0,this.iaddn(se),this.negative=1,this;if(this.words[0]-=se,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var ce=0;ce<this.length&&this.words[ce]<0;ce++)this.words[ce]+=67108864,this.words[ce+1]-=1;return this.strip()},ae.prototype.addn=function(se){return this.clone().iaddn(se)},ae.prototype.subn=function(se){return this.clone().isubn(se)},ae.prototype.iabs=function(){return this.negative=0,this},ae.prototype.abs=function(){return this.clone().iabs()},ae.prototype._ishlnsubmul=function(se,ce,de){var he=se.length+de,ve;this._expand(he);var we,Ae=0;for(ve=0;ve<se.length;ve++){we=(this.words[ve+de]|0)+Ae;var be=(se.words[ve]|0)*ce;we-=be&67108863,Ae=(we>>26)-(be/67108864|0),this.words[ve+de]=we&67108863}for(;ve<this.length-de;ve++)we=(this.words[ve+de]|0)+Ae,Ae=we>>26,this.words[ve+de]=we&67108863;if(Ae===0)return this.strip();for(ie(Ae===-1),Ae=0,ve=0;ve<this.length;ve++)we=-(this.words[ve]|0)+Ae,Ae=we>>26,this.words[ve]=we&67108863;return this.negative=1,this.strip()},ae.prototype._wordDiv=function(se,ce){var de=this.length-se.length,he=this.clone(),ve=se,we=ve.words[ve.length-1]|0,Ae=this._countBits(we);de=26-Ae,de!==0&&(ve=ve.ushln(de),he.iushln(de),we=ve.words[ve.length-1]|0);var be=he.length-ve.length,ue;if(ce!=="mod"){ue=new ae(null),ue.length=be+1,ue.words=new Array(ue.length);for(var ge=0;ge<ue.length;ge++)ue.words[ge]=0}var Re=he.clone()._ishlnsubmul(ve,1,be);Re.negative===0&&(he=Re,ue&&(ue.words[be]=1));for(var Ne=be-1;Ne>=0;Ne--){var qe=(he.words[ve.length+Ne]|0)*67108864+(he.words[ve.length+Ne-1]|0);for(qe=Math.min(qe/we|0,67108863),he._ishlnsubmul(ve,qe,Ne);he.negative!==0;)qe--,he.negative=0,he._ishlnsubmul(ve,1,Ne),he.isZero()||(he.negative^=1);ue&&(ue.words[Ne]=qe)}return ue&&ue.strip(),he.strip(),ce!=="div"&&de!==0&&he.iushrn(de),{div:ue||null,mod:he}},ae.prototype.divmod=function(se,ce,de){if(ie(!se.isZero()),this.isZero())return{div:new ae(0),mod:new ae(0)};var he,ve,we;return this.negative!==0&&se.negative===0?(we=this.neg().divmod(se,ce),ce!=="mod"&&(he=we.div.neg()),ce!=="div"&&(ve=we.mod.neg(),de&&ve.negative!==0&&ve.iadd(se)),{div:he,mod:ve}):this.negative===0&&se.negative!==0?(we=this.divmod(se.neg(),ce),ce!=="mod"&&(he=we.div.neg()),{div:he,mod:we.mod}):this.negative&se.negative?(we=this.neg().divmod(se.neg(),ce),ce!=="div"&&(ve=we.mod.neg(),de&&ve.negative!==0&&ve.isub(se)),{div:we.div,mod:ve}):se.length>this.length||this.cmp(se)<0?{div:new ae(0),mod:this}:se.length===1?ce==="div"?{div:this.divn(se.words[0]),mod:null}:ce==="mod"?{div:null,mod:new ae(this.modn(se.words[0]))}:{div:this.divn(se.words[0]),mod:new ae(this.modn(se.words[0]))}:this._wordDiv(se,ce)},ae.prototype.div=function(se){return this.divmod(se,"div",!1).div},ae.prototype.mod=function(se){return this.divmod(se,"mod",!1).mod},ae.prototype.umod=function(se){return this.divmod(se,"mod",!0).mod},ae.prototype.divRound=function(se){var ce=this.divmod(se);if(ce.mod.isZero())return ce.div;var de=ce.div.negative!==0?ce.mod.isub(se):ce.mod,he=se.ushrn(1),ve=se.andln(1),we=de.cmp(he);return we<0||ve===1&&we===0?ce.div:ce.div.negative!==0?ce.div.isubn(1):ce.div.iaddn(1)},ae.prototype.modn=function(se){ie(se<=67108863);for(var ce=(1<<26)%se,de=0,he=this.length-1;he>=0;he--)de=(ce*de+(this.words[he]|0))%se;return de},ae.prototype.idivn=function(se){ie(se<=67108863);for(var ce=0,de=this.length-1;de>=0;de--){var he=(this.words[de]|0)+ce*67108864;this.words[de]=he/se|0,ce=he%se}return this.strip()},ae.prototype.divn=function(se){return this.clone().idivn(se)},ae.prototype.egcd=function(se){ie(se.negative===0),ie(!se.isZero());var ce=this,de=se.clone();ce.negative!==0?ce=ce.umod(se):ce=ce.clone();for(var he=new ae(1),ve=new ae(0),we=new ae(0),Ae=new ae(1),be=0;ce.isEven()&&de.isEven();)ce.iushrn(1),de.iushrn(1),++be;for(var ue=de.clone(),ge=ce.clone();!ce.isZero();){for(var Re=0,Ne=1;!(ce.words[0]&Ne)&&Re<26;++Re,Ne<<=1);if(Re>0)for(ce.iushrn(Re);Re-- >0;)(he.isOdd()||ve.isOdd())&&(he.iadd(ue),ve.isub(ge)),he.iushrn(1),ve.iushrn(1);for(var qe=0,Pe=1;!(de.words[0]&Pe)&&qe<26;++qe,Pe<<=1);if(qe>0)for(de.iushrn(qe);qe-- >0;)(we.isOdd()||Ae.isOdd())&&(we.iadd(ue),Ae.isub(ge)),we.iushrn(1),Ae.iushrn(1);ce.cmp(de)>=0?(ce.isub(de),he.isub(we),ve.isub(Ae)):(de.isub(ce),we.isub(he),Ae.isub(ve))}return{a:we,b:Ae,gcd:de.iushln(be)}},ae.prototype._invmp=function(se){ie(se.negative===0),ie(!se.isZero());var ce=this,de=se.clone();ce.negative!==0?ce=ce.umod(se):ce=ce.clone();for(var he=new ae(1),ve=new ae(0),we=de.clone();ce.cmpn(1)>0&&de.cmpn(1)>0;){for(var Ae=0,be=1;!(ce.words[0]&be)&&Ae<26;++Ae,be<<=1);if(Ae>0)for(ce.iushrn(Ae);Ae-- >0;)he.isOdd()&&he.iadd(we),he.iushrn(1);for(var ue=0,ge=1;!(de.words[0]&ge)&&ue<26;++ue,ge<<=1);if(ue>0)for(de.iushrn(ue);ue-- >0;)ve.isOdd()&&ve.iadd(we),ve.iushrn(1);ce.cmp(de)>=0?(ce.isub(de),he.isub(ve)):(de.isub(ce),ve.isub(he))}var Re;return ce.cmpn(1)===0?Re=he:Re=ve,Re.cmpn(0)<0&&Re.iadd(se),Re},ae.prototype.gcd=function(se){if(this.isZero())return se.abs();if(se.isZero())return this.abs();var ce=this.clone(),de=se.clone();ce.negative=0,de.negative=0;for(var he=0;ce.isEven()&&de.isEven();he++)ce.iushrn(1),de.iushrn(1);do{for(;ce.isEven();)ce.iushrn(1);for(;de.isEven();)de.iushrn(1);var ve=ce.cmp(de);if(ve<0){var we=ce;ce=de,de=we}else if(ve===0||de.cmpn(1)===0)break;ce.isub(de)}while(!0);return de.iushln(he)},ae.prototype.invm=function(se){return this.egcd(se).a.umod(se)},ae.prototype.isEven=function(){return(this.words[0]&1)===0},ae.prototype.isOdd=function(){return(this.words[0]&1)===1},ae.prototype.andln=function(se){return this.words[0]&se},ae.prototype.bincn=function(se){ie(typeof se=="number");var ce=se%26,de=(se-ce)/26,he=1<<ce;if(this.length<=de)return this._expand(de+1),this.words[de]|=he,this;for(var ve=he,we=de;ve!==0&&we<this.length;we++){var Ae=this.words[we]|0;Ae+=ve,ve=Ae>>>26,Ae&=67108863,this.words[we]=Ae}return ve!==0&&(this.words[we]=ve,this.length++),this},ae.prototype.isZero=function(){return this.length===1&&this.words[0]===0},ae.prototype.cmpn=function(se){var ce=se<0;if(this.negative!==0&&!ce)return-1;if(this.negative===0&&ce)return 1;this.strip();var de;if(this.length>1)de=1;else{ce&&(se=-se),ie(se<=67108863,"Number is too big");var he=this.words[0]|0;de=he===se?0:he<se?-1:1}return this.negative!==0?-de|0:de},ae.prototype.cmp=function(se){if(this.negative!==0&&se.negative===0)return-1;if(this.negative===0&&se.negative!==0)return 1;var ce=this.ucmp(se);return this.negative!==0?-ce|0:ce},ae.prototype.ucmp=function(se){if(this.length>se.length)return 1;if(this.length<se.length)return-1;for(var ce=0,de=this.length-1;de>=0;de--){var he=this.words[de]|0,ve=se.words[de]|0;if(he!==ve){he<ve?ce=-1:he>ve&&(ce=1);break}}return ce},ae.prototype.gtn=function(se){return this.cmpn(se)===1},ae.prototype.gt=function(se){return this.cmp(se)===1},ae.prototype.gten=function(se){return this.cmpn(se)>=0},ae.prototype.gte=function(se){return this.cmp(se)>=0},ae.prototype.ltn=function(se){return this.cmpn(se)===-1},ae.prototype.lt=function(se){return this.cmp(se)===-1},ae.prototype.lten=function(se){return this.cmpn(se)<=0},ae.prototype.lte=function(se){return this.cmp(se)<=0},ae.prototype.eqn=function(se){return this.cmpn(se)===0},ae.prototype.eq=function(se){return this.cmp(se)===0},ae.red=function(se){return new Ue(se)},ae.prototype.toRed=function(se){return ie(!this.red,"Already a number in reduction context"),ie(this.negative===0,"red works only with positives"),se.convertTo(this)._forceRed(se)},ae.prototype.fromRed=function(){return ie(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},ae.prototype._forceRed=function(se){return this.red=se,this},ae.prototype.forceRed=function(se){return ie(!this.red,"Already a number in reduction context"),this._forceRed(se)},ae.prototype.redAdd=function(se){return ie(this.red,"redAdd works only with red numbers"),this.red.add(this,se)},ae.prototype.redIAdd=function(se){return ie(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,se)},ae.prototype.redSub=function(se){return ie(this.red,"redSub works only with red numbers"),this.red.sub(this,se)},ae.prototype.redISub=function(se){return ie(this.red,"redISub works only with red numbers"),this.red.isub(this,se)},ae.prototype.redShl=function(se){return ie(this.red,"redShl works only with red numbers"),this.red.shl(this,se)},ae.prototype.redMul=function(se){return ie(this.red,"redMul works only with red numbers"),this.red._verify2(this,se),this.red.mul(this,se)},ae.prototype.redIMul=function(se){return ie(this.red,"redMul works only with red numbers"),this.red._verify2(this,se),this.red.imul(this,se)},ae.prototype.redSqr=function(){return ie(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},ae.prototype.redISqr=function(){return ie(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},ae.prototype.redSqrt=function(){return ie(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},ae.prototype.redInvm=function(){return ie(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},ae.prototype.redNeg=function(){return ie(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},ae.prototype.redPow=function(se){return ie(this.red&&!se.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,se)};var Fe={k256:null,p224:null,p192:null,p25519:null};function Le(_e,se){this.name=_e,this.p=new ae(se,16),this.n=this.p.bitLength(),this.k=new ae(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Le.prototype._tmp=function(){var se=new ae(null);return se.words=new Array(Math.ceil(this.n/13)),se},Le.prototype.ireduce=function(se){var ce=se,de;do this.split(ce,this.tmp),ce=this.imulK(ce),ce=ce.iadd(this.tmp),de=ce.bitLength();while(de>this.n);var he=de<this.n?-1:ce.ucmp(this.p);return he===0?(ce.words[0]=0,ce.length=1):he>0?ce.isub(this.p):ce.strip!==void 0?ce.strip():ce._strip(),ce},Le.prototype.split=function(se,ce){se.iushrn(this.n,0,ce)},Le.prototype.imulK=function(se){return se.imul(this.k)};function He(){Le.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}fe(He,Le),He.prototype.split=function(se,ce){for(var de=4194303,he=Math.min(se.length,9),ve=0;ve<he;ve++)ce.words[ve]=se.words[ve];if(ce.length=he,se.length<=9){se.words[0]=0,se.length=1;return}var we=se.words[9];for(ce.words[ce.length++]=we&de,ve=10;ve<se.length;ve++){var Ae=se.words[ve]|0;se.words[ve-10]=(Ae&de)<<4|we>>>22,we=Ae}we>>>=22,se.words[ve-10]=we,we===0&&se.length>10?se.length-=10:se.length-=9},He.prototype.imulK=function(se){se.words[se.length]=0,se.words[se.length+1]=0,se.length+=2;for(var ce=0,de=0;de<se.length;de++){var he=se.words[de]|0;ce+=he*977,se.words[de]=ce&67108863,ce=he*64+(ce/67108864|0)}return se.words[se.length-1]===0&&(se.length--,se.words[se.length-1]===0&&se.length--),se};function ze(){Le.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}fe(ze,Le);function Je(){Le.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}fe(Je,Le);function Xe(){Le.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}fe(Xe,Le),Xe.prototype.imulK=function(se){for(var ce=0,de=0;de<se.length;de++){var he=(se.words[de]|0)*19+ce,ve=he&67108863;he>>>=26,se.words[de]=ve,ce=he}return ce!==0&&(se.words[se.length++]=ce),se},ae._prime=function(se){if(Fe[se])return Fe[se];var ce;if(se==="k256")ce=new He;else if(se==="p224")ce=new ze;else if(se==="p192")ce=new Je;else if(se==="p25519")ce=new Xe;else throw new Error("Unknown prime "+se);return Fe[se]=ce,ce};function Ue(_e){if(typeof _e=="string"){var se=ae._prime(_e);this.m=se.p,this.prime=se}else ie(_e.gtn(1),"modulus must be greater than 1"),this.m=_e,this.prime=null}Ue.prototype._verify1=function(se){ie(se.negative===0,"red works only with positives"),ie(se.red,"red works only with red numbers")},Ue.prototype._verify2=function(se,ce){ie((se.negative|ce.negative)===0,"red works only with positives"),ie(se.red&&se.red===ce.red,"red works only with red numbers")},Ue.prototype.imod=function(se){return this.prime?this.prime.ireduce(se)._forceRed(this):se.umod(this.m)._forceRed(this)},Ue.prototype.neg=function(se){return se.isZero()?se.clone():this.m.sub(se)._forceRed(this)},Ue.prototype.add=function(se,ce){this._verify2(se,ce);var de=se.add(ce);return de.cmp(this.m)>=0&&de.isub(this.m),de._forceRed(this)},Ue.prototype.iadd=function(se,ce){this._verify2(se,ce);var de=se.iadd(ce);return de.cmp(this.m)>=0&&de.isub(this.m),de},Ue.prototype.sub=function(se,ce){this._verify2(se,ce);var de=se.sub(ce);return de.cmpn(0)<0&&de.iadd(this.m),de._forceRed(this)},Ue.prototype.isub=function(se,ce){this._verify2(se,ce);var de=se.isub(ce);return de.cmpn(0)<0&&de.iadd(this.m),de},Ue.prototype.shl=function(se,ce){return this._verify1(se),this.imod(se.ushln(ce))},Ue.prototype.imul=function(se,ce){return this._verify2(se,ce),this.imod(se.imul(ce))},Ue.prototype.mul=function(se,ce){return this._verify2(se,ce),this.imod(se.mul(ce))},Ue.prototype.isqr=function(se){return this.imul(se,se.clone())},Ue.prototype.sqr=function(se){return this.mul(se,se)},Ue.prototype.sqrt=function(se){if(se.isZero())return se.clone();var ce=this.m.andln(3);if(ie(ce%2===1),ce===3){var de=this.m.add(new ae(1)).iushrn(2);return this.pow(se,de)}for(var he=this.m.subn(1),ve=0;!he.isZero()&&he.andln(1)===0;)ve++,he.iushrn(1);ie(!he.isZero());var we=new ae(1).toRed(this),Ae=we.redNeg(),be=this.m.subn(1).iushrn(1),ue=this.m.bitLength();for(ue=new ae(2*ue*ue).toRed(this);this.pow(ue,be).cmp(Ae)!==0;)ue.redIAdd(Ae);for(var ge=this.pow(ue,he),Re=this.pow(se,he.addn(1).iushrn(1)),Ne=this.pow(se,he),qe=ve;Ne.cmp(we)!==0;){for(var Pe=Ne,Ge=0;Pe.cmp(we)!==0;Ge++)Pe=Pe.redSqr();ie(Ge<qe);var Ce=this.pow(ge,new ae(1).iushln(qe-Ge-1));Re=Re.redMul(Ce),ge=Ce.redSqr(),Ne=Ne.redMul(ge),qe=Ge}return Re},Ue.prototype.invm=function(se){var ce=se._invmp(this.m);return ce.negative!==0?(ce.negative=0,this.imod(ce).redNeg()):this.imod(ce)},Ue.prototype.pow=function(se,ce){if(ce.isZero())return new ae(1).toRed(this);if(ce.cmpn(1)===0)return se.clone();var de=4,he=new Array(1<<de);he[0]=new ae(1).toRed(this),he[1]=se;for(var ve=2;ve<he.length;ve++)he[ve]=this.mul(he[ve-1],se);var we=he[0],Ae=0,be=0,ue=ce.bitLength()%26;for(ue===0&&(ue=26),ve=ce.length-1;ve>=0;ve--){for(var ge=ce.words[ve],Re=ue-1;Re>=0;Re--){var Ne=ge>>Re&1;if(we!==he[0]&&(we=this.sqr(we)),Ne===0&&Ae===0){be=0;continue}Ae<<=1,Ae|=Ne,be++,!(be!==de&&(ve!==0||Re!==0))&&(we=this.mul(we,he[Ae]),be=0,Ae=0)}ue=26}return we},Ue.prototype.convertTo=function(se){var ce=se.umod(this.m);return ce===se?ce.clone():ce},Ue.prototype.convertFrom=function(se){var ce=se.clone();return ce.red=null,ce},ae.mont=function(se){return new $t(se)};function $t(_e){Ue.call(this,_e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new ae(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}fe($t,Ue),$t.prototype.convertTo=function(se){return this.imod(se.ushln(this.shift))},$t.prototype.convertFrom=function(se){var ce=this.imod(se.mul(this.rinv));return ce.red=null,ce},$t.prototype.imul=function(se,ce){if(se.isZero()||ce.isZero())return se.words[0]=0,se.length=1,se;var de=se.imul(ce),he=de.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ve=de.isub(he).iushrn(this.shift),we=ve;return ve.cmp(this.m)>=0?we=ve.isub(this.m):ve.cmpn(0)<0&&(we=ve.iadd(this.m)),we._forceRed(this)},$t.prototype.mul=function(se,ce){if(se.isZero()||ce.isZero())return new ae(0)._forceRed(this);var de=se.mul(ce),he=de.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ve=de.isub(he).iushrn(this.shift),we=ve;return ve.cmp(this.m)>=0?we=ve.isub(this.m):ve.cmpn(0)<0&&(we=ve.iadd(this.m)),we._forceRed(this)},$t.prototype.invm=function(se){var ce=this.imod(se._invmp(this.m).mul(this.r2));return ce._forceRed(this)}})(c,commonjsGlobal)})(bn$6);var bnExports$1=bn$6.exports,dist={};Object.defineProperty(dist,"__esModule",{value:!0});var bech32m=dist.bech32m=bech32=dist.bech32=void 0;const ALPHABET="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ALPHABET_MAP={};for(let c=0;c<ALPHABET.length;c++){const t=ALPHABET.charAt(c);ALPHABET_MAP[t]=c}function polymodStep(c){const t=c>>25;return(c&33554431)<<5^-(t>>0&1)&996825010^-(t>>1&1)&642813549^-(t>>2&1)&513874426^-(t>>3&1)&1027748829^-(t>>4&1)&705979059}function prefixChk(c){let t=1;for(let n=0;n<c.length;++n){const ie=c.charCodeAt(n);if(ie<33||ie>126)return"Invalid prefix ("+c+")";t=polymodStep(t)^ie>>5}t=polymodStep(t);for(let n=0;n<c.length;++n){const ie=c.charCodeAt(n);t=polymodStep(t)^ie&31}return t}function convert(c,t,n,ie){let fe=0,ae=0;const le=(1<<n)-1,pe=[];for(let me=0;me<c.length;++me)for(fe=fe<<t|c[me],ae+=t;ae>=n;)ae-=n,pe.push(fe>>ae&le);if(ie)ae>0&&pe.push(fe<<n-ae&le);else{if(ae>=t)return"Excess padding";if(fe<<n-ae&le)return"Non-zero padding"}return pe}function toWords(c){return convert(c,8,5,!0)}function fromWordsUnsafe(c){const t=convert(c,5,8,!1);if(Array.isArray(t))return t}function fromWords(c){const t=convert(c,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function getLibraryFromEncoding(c){let t;c==="bech32"?t=1:t=734539939;function n(le,pe,me){if(me=me||90,le.length+7+pe.length>me)throw new TypeError("Exceeds length limit");le=le.toLowerCase();let ye=prefixChk(le);if(typeof ye=="string")throw new Error(ye);let xe=le+"1";for(let Ee=0;Ee<pe.length;++Ee){const Se=pe[Ee];if(Se>>5)throw new Error("Non 5-bit word");ye=polymodStep(ye)^Se,xe+=ALPHABET.charAt(Se)}for(let Ee=0;Ee<6;++Ee)ye=polymodStep(ye);ye^=t;for(let Ee=0;Ee<6;++Ee){const Se=ye>>(5-Ee)*5&31;xe+=ALPHABET.charAt(Se)}return xe}function ie(le,pe){if(pe=pe||90,le.length<8)return le+" too short";if(le.length>pe)return"Exceeds length limit";const me=le.toLowerCase(),ye=le.toUpperCase();if(le!==me&&le!==ye)return"Mixed-case string "+le;le=me;const xe=le.lastIndexOf("1");if(xe===-1)return"No separator character for "+le;if(xe===0)return"Missing prefix for "+le;const Ee=le.slice(0,xe),Se=le.slice(xe+1);if(Se.length<6)return"Data too short";let Me=prefixChk(Ee);if(typeof Me=="string")return Me;const Be=[];for(let $e=0;$e<Se.length;++$e){const ke=Se.charAt($e),Te=ALPHABET_MAP[ke];if(Te===void 0)return"Unknown character "+ke;Me=polymodStep(Me)^Te,!($e+6>=Se.length)&&Be.push(Te)}return Me!==t?"Invalid checksum for "+le:{prefix:Ee,words:Be}}function fe(le,pe){const me=ie(le,pe);if(typeof me=="object")return me}function ae(le,pe){const me=ie(le,pe);if(typeof me=="object")return me;throw new Error(me)}return{decodeUnsafe:fe,decode:ae,encode:n,toWords,fromWordsUnsafe,fromWords}}var bech32=dist.bech32=getLibraryFromEncoding("bech32");bech32m=dist.bech32m=getLibraryFromEncoding("bech32m");const ERROR_MSG_INPUT="Input must be an string, Buffer or Uint8Array";function normalizeInput(c){let t;if(c instanceof Uint8Array)t=c;else if(typeof c=="string")t=new TextEncoder().encode(c);else throw new Error(ERROR_MSG_INPUT);return t}function toHex(c){return Array.prototype.map.call(c,function(t){return(t<16?"0":"")+t.toString(16)}).join("")}function uint32ToHex(c){return(4294967296+c).toString(16).substring(1)}function debugPrint(c,t,n){let ie=`
36
36
  `+c+" = ";for(let fe=0;fe<t.length;fe+=2){if(n===32)ie+=uint32ToHex(t[fe]).toUpperCase(),ie+=" ",ie+=uint32ToHex(t[fe+1]).toUpperCase();else if(n===64)ie+=uint32ToHex(t[fe+1]).toUpperCase(),ie+=uint32ToHex(t[fe]).toUpperCase();else throw new Error("Invalid size "+n);fe%6===4?ie+=`
37
37
  `+new Array(c.length+4).join(" "):fe<t.length-2&&(ie+=" ")}console.log(ie)}function testSpeed(c,t,n){let ie=new Date().getTime();const fe=new Uint8Array(t);for(let le=0;le<t;le++)fe[le]=le%256;const ae=new Date().getTime();console.log("Generated random input in "+(ae-ie)+"ms"),ie=ae;for(let le=0;le<n;le++){const pe=c(fe),me=new Date().getTime(),ye=me-ie;ie=me,console.log("Hashed in "+ye+"ms: "+pe.substring(0,20)+"..."),console.log(Math.round(t/(1<<20)/(ye/1e3)*100)/100+" MB PER SECOND")}}var util$3={normalizeInput,toHex,debugPrint,testSpeed};const util$2=util$3;function ADD64AA(c,t,n){const ie=c[t]+c[n];let fe=c[t+1]+c[n+1];ie>=4294967296&&fe++,c[t]=ie,c[t+1]=fe}function ADD64AC(c,t,n,ie){let fe=c[t]+n;n<0&&(fe+=4294967296);let ae=c[t+1]+ie;fe>=4294967296&&ae++,c[t]=fe,c[t+1]=ae}function B2B_GET32(c,t){return c[t]^c[t+1]<<8^c[t+2]<<16^c[t+3]<<24}function B2B_G(c,t,n,ie,fe,ae){const le=m$3[fe],pe=m$3[fe+1],me=m$3[ae],ye=m$3[ae+1];ADD64AA(v$3,c,t),ADD64AC(v$3,c,le,pe);let xe=v$3[ie]^v$3[c],Ee=v$3[ie+1]^v$3[c+1];v$3[ie]=Ee,v$3[ie+1]=xe,ADD64AA(v$3,n,ie),xe=v$3[t]^v$3[n],Ee=v$3[t+1]^v$3[n+1],v$3[t]=xe>>>24^Ee<<8,v$3[t+1]=Ee>>>24^xe<<8,ADD64AA(v$3,c,t),ADD64AC(v$3,c,me,ye),xe=v$3[ie]^v$3[c],Ee=v$3[ie+1]^v$3[c+1],v$3[ie]=xe>>>16^Ee<<16,v$3[ie+1]=Ee>>>16^xe<<16,ADD64AA(v$3,n,ie),xe=v$3[t]^v$3[n],Ee=v$3[t+1]^v$3[n+1],v$3[t]=Ee>>>31^xe<<1,v$3[t+1]=xe>>>31^Ee<<1}const BLAKE2B_IV32=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),SIGMA8=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],SIGMA82=new Uint8Array(SIGMA8.map(function(c){return c*2})),v$3=new Uint32Array(32),m$3=new Uint32Array(32);function blake2bCompress(c,t){let n=0;for(n=0;n<16;n++)v$3[n]=c.h[n],v$3[n+16]=BLAKE2B_IV32[n];for(v$3[24]=v$3[24]^c.t,v$3[25]=v$3[25]^c.t/4294967296,t&&(v$3[28]=~v$3[28],v$3[29]=~v$3[29]),n=0;n<32;n++)m$3[n]=B2B_GET32(c.b,4*n);for(n=0;n<12;n++)B2B_G(0,8,16,24,SIGMA82[n*16+0],SIGMA82[n*16+1]),B2B_G(2,10,18,26,SIGMA82[n*16+2],SIGMA82[n*16+3]),B2B_G(4,12,20,28,SIGMA82[n*16+4],SIGMA82[n*16+5]),B2B_G(6,14,22,30,SIGMA82[n*16+6],SIGMA82[n*16+7]),B2B_G(0,10,20,30,SIGMA82[n*16+8],SIGMA82[n*16+9]),B2B_G(2,12,22,24,SIGMA82[n*16+10],SIGMA82[n*16+11]),B2B_G(4,14,16,26,SIGMA82[n*16+12],SIGMA82[n*16+13]),B2B_G(6,8,18,28,SIGMA82[n*16+14],SIGMA82[n*16+15]);for(n=0;n<16;n++)c.h[n]=c.h[n]^v$3[n]^v$3[n+16]}const parameterBlock=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function blake2bInit(c,t,n,ie){if(c===0||c>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(n&&n.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(ie&&ie.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const fe={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:c};parameterBlock.fill(0),parameterBlock[0]=c,t&&(parameterBlock[1]=t.length),parameterBlock[2]=1,parameterBlock[3]=1,n&&parameterBlock.set(n,32),ie&&parameterBlock.set(ie,48);for(let ae=0;ae<16;ae++)fe.h[ae]=BLAKE2B_IV32[ae]^B2B_GET32(parameterBlock,ae*4);return t&&(blake2bUpdate(fe,t),fe.c=128),fe}function blake2bUpdate(c,t){for(let n=0;n<t.length;n++)c.c===128&&(c.t+=c.c,blake2bCompress(c,!1),c.c=0),c.b[c.c++]=t[n]}function blake2bFinal(c){for(c.t+=c.c;c.c<128;)c.b[c.c++]=0;blake2bCompress(c,!0);const t=new Uint8Array(c.outlen);for(let n=0;n<c.outlen;n++)t[n]=c.h[n>>2]>>8*(n&3);return t}function blake2b(c,t,n,ie,fe){n=n||64,c=util$2.normalizeInput(c),ie&&(ie=util$2.normalizeInput(ie)),fe&&(fe=util$2.normalizeInput(fe));const ae=blake2bInit(n,t,ie,fe);return blake2bUpdate(ae,c),blake2bFinal(ae)}function blake2bHex(c,t,n,ie,fe){const ae=blake2b(c,t,n,ie,fe);return util$2.toHex(ae)}var blake2b_1={blake2b,blake2bHex,blake2bInit,blake2bUpdate,blake2bFinal};const util$1=util$3;function B2S_GET32(c,t){return c[t]^c[t+1]<<8^c[t+2]<<16^c[t+3]<<24}function B2S_G(c,t,n,ie,fe,ae){v$2[c]=v$2[c]+v$2[t]+fe,v$2[ie]=ROTR32(v$2[ie]^v$2[c],16),v$2[n]=v$2[n]+v$2[ie],v$2[t]=ROTR32(v$2[t]^v$2[n],12),v$2[c]=v$2[c]+v$2[t]+ae,v$2[ie]=ROTR32(v$2[ie]^v$2[c],8),v$2[n]=v$2[n]+v$2[ie],v$2[t]=ROTR32(v$2[t]^v$2[n],7)}function ROTR32(c,t){return c>>>t^c<<32-t}const BLAKE2S_IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),v$2=new Uint32Array(16),m$2=new Uint32Array(16);function blake2sCompress(c,t){let n=0;for(n=0;n<8;n++)v$2[n]=c.h[n],v$2[n+8]=BLAKE2S_IV[n];for(v$2[12]^=c.t,v$2[13]^=c.t/4294967296,t&&(v$2[14]=~v$2[14]),n=0;n<16;n++)m$2[n]=B2S_GET32(c.b,4*n);for(n=0;n<10;n++)B2S_G(0,4,8,12,m$2[SIGMA[n*16+0]],m$2[SIGMA[n*16+1]]),B2S_G(1,5,9,13,m$2[SIGMA[n*16+2]],m$2[SIGMA[n*16+3]]),B2S_G(2,6,10,14,m$2[SIGMA[n*16+4]],m$2[SIGMA[n*16+5]]),B2S_G(3,7,11,15,m$2[SIGMA[n*16+6]],m$2[SIGMA[n*16+7]]),B2S_G(0,5,10,15,m$2[SIGMA[n*16+8]],m$2[SIGMA[n*16+9]]),B2S_G(1,6,11,12,m$2[SIGMA[n*16+10]],m$2[SIGMA[n*16+11]]),B2S_G(2,7,8,13,m$2[SIGMA[n*16+12]],m$2[SIGMA[n*16+13]]),B2S_G(3,4,9,14,m$2[SIGMA[n*16+14]],m$2[SIGMA[n*16+15]]);for(n=0;n<8;n++)c.h[n]^=v$2[n]^v$2[n+8]}function blake2sInit(c,t){if(!(c>0&&c<=32))throw new Error("Incorrect output length, should be in [1, 32]");const n=t?t.length:0;if(t&&!(n>0&&n<=32))throw new Error("Incorrect key length, should be in [1, 32]");const ie={h:new Uint32Array(BLAKE2S_IV),b:new Uint8Array(64),c:0,t:0,outlen:c};return ie.h[0]^=16842752^n<<8^c,n>0&&(blake2sUpdate(ie,t),ie.c=64),ie}function blake2sUpdate(c,t){for(let n=0;n<t.length;n++)c.c===64&&(c.t+=c.c,blake2sCompress(c,!1),c.c=0),c.b[c.c++]=t[n]}function blake2sFinal(c){for(c.t+=c.c;c.c<64;)c.b[c.c++]=0;blake2sCompress(c,!0);const t=new Uint8Array(c.outlen);for(let n=0;n<c.outlen;n++)t[n]=c.h[n>>2]>>8*(n&3)&255;return t}function blake2s(c,t,n){n=n||32,c=util$1.normalizeInput(c);const ie=blake2sInit(n,t);return blake2sUpdate(ie,c),blake2sFinal(ie)}function blake2sHex(c,t,n){const ie=blake2s(c,t,n);return util$1.toHex(ie)}var blake2s_1={blake2s,blake2sHex,blake2sInit,blake2sUpdate,blake2sFinal};const b2b=blake2b_1,b2s=blake2s_1;var blakejs={blake2b:b2b.blake2b,blake2bHex:b2b.blake2bHex,blake2bInit:b2b.blake2bInit,blake2bUpdate:b2b.blake2bUpdate,blake2bFinal:b2b.blake2bFinal,blake2s:b2s.blake2s,blake2sHex:b2s.blake2sHex,blake2sInit:b2s.blake2sInit,blake2sUpdate:b2s.blake2sUpdate,blake2sFinal:b2s.blake2sFinal},sha3$1={},sponge={},permute={},chi={},copy=function(t,n){return function(ie,fe){var ae=fe*2,le=n*2;ie[ae]=t[le],ie[ae+1]=t[le+1]}},copy_1=copy;(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var t=n(copy_1);function n(ae){return ae&&ae.__esModule?ae:{default:ae}}var ie=function(le){for(var pe=le.A,me=le.C,ye=0;ye<25;ye+=5){for(var xe=0;xe<5;xe++)(0,t.default)(pe,ye+xe)(me,xe);for(var Ee=0;Ee<5;Ee++){var Se=(ye+Ee)*2,Me=(Ee+1)%5*2,Be=(Ee+2)%5*2;pe[Se]^=~me[Me]&me[Be],pe[Se+1]^=~me[Me+1]&me[Be+1]}}},fe=ie;c.default=fe})(chi);var iota={},roundConstants={};(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var t=new Uint32Array([0,1,0,32898,2147483648,32906,2147483648,2147516416,0,32907,0,2147483649,2147483648,2147516545,2147483648,32777,0,138,0,136,0,2147516425,0,2147483658,0,2147516555,2147483648,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,0,32778,2147483648,2147483658,2147483648,2147516545,2147483648,32896,0,2147483649,2147483648,2147516424]),n=t;c.default=n})(roundConstants);(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var t=n(roundConstants);function n(ae){return ae&&ae.__esModule?ae:{default:ae}}var ie=function(le){var pe=le.A,me=le.roundIndex,ye=me*2;pe[0]^=t.default[ye],pe[1]^=t.default[ye+1]},fe=ie;c.default=fe})(iota);var rhoPi={},piShuffles={};(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var t=[10,7,11,17,18,3,5,16,8,21,24,4,15,23,19,13,12,2,20,14,22,9,6,1],n=t;c.default=n})(piShuffles);var rhoOffsets={};(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var t=[1,3,6,10,15,21,28,36,45,55,2,14,27,41,56,8,25,43,62,18,39,61,20,44],n=t;c.default=n})(rhoOffsets);(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var t=fe(piShuffles),n=fe(rhoOffsets),ie=fe(copy_1);function fe(pe){return pe&&pe.__esModule?pe:{default:pe}}var ae=function(me){var ye=me.A,xe=me.C,Ee=me.W;(0,ie.default)(ye,1)(Ee,0);for(var Se=0,Me=0,Be=0,$e=32,ke=0;ke<24;ke++){var Te=t.default[ke],Ie=n.default[ke];(0,ie.default)(ye,Te)(xe,0),Se=Ee[0],Me=Ee[1],$e=32-Ie,Be=Ie<32?0:1,Ee[Be]=Se<<Ie|Me>>>$e,Ee[(Be+1)%2]=Me<<Ie|Se>>>$e,(0,ie.default)(Ee,0)(ye,Te),(0,ie.default)(xe,0)(Ee,0)}},le=ae;c.default=le})(rhoPi);var theta={};(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var t=n(copy_1);function n(ae){return ae&&ae.__esModule?ae:{default:ae}}var ie=function(le){for(var pe=le.A,me=le.C,ye=le.D,xe=le.W,Ee=0,Se=0,Me=0;Me<5;Me++){var Be=Me*2,$e=(Me+5)*2,ke=(Me+10)*2,Te=(Me+15)*2,Ie=(Me+20)*2;me[Be]=pe[Be]^pe[$e]^pe[ke]^pe[Te]^pe[Ie],me[Be+1]=pe[Be+1]^pe[$e+1]^pe[ke+1]^pe[Te+1]^pe[Ie+1]}for(var Fe=0;Fe<5;Fe++){(0,t.default)(me,(Fe+1)%5)(xe,0),Ee=xe[0],Se=xe[1],xe[0]=Ee<<1|Se>>>31,xe[1]=Se<<1|Ee>>>31,ye[Fe*2]=me[(Fe+4)%5*2]^xe[0],ye[Fe*2+1]=me[(Fe+4)%5*2+1]^xe[1];for(var Le=0;Le<25;Le+=5)pe[(Le+Fe)*2]^=ye[Fe*2],pe[(Le+Fe)*2+1]^=ye[Fe*2+1]}},fe=ie;c.default=fe})(theta);(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var t=ae(chi),n=ae(iota),ie=ae(rhoPi),fe=ae(theta);function ae(me){return me&&me.__esModule?me:{default:me}}var le=function(){var ye=new Uint32Array(10),xe=new Uint32Array(10),Ee=new Uint32Array(2);return function(Se){for(var Me=0;Me<24;Me++)(0,fe.default)({A:Se,C:ye,D:xe,W:Ee}),(0,ie.default)({A:Se,C:ye,W:Ee}),(0,t.default)({A:Se,C:ye}),(0,n.default)({A:Se,roundIndex:Me});ye.fill(0),xe.fill(0),Ee.fill(0)}},pe=le;c.default=pe})(permute);(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.default=void 0;var t=dist$1,n=ie(permute);function ie(me){return me&&me.__esModule?me:{default:me}}var fe=function(ye,xe){for(var Ee=0;Ee<ye.length;Ee+=8){var Se=Ee/4;xe[Se]^=ye[Ee+7]<<24|ye[Ee+6]<<16|ye[Ee+5]<<8|ye[Ee+4],xe[Se+1]^=ye[Ee+3]<<24|ye[Ee+2]<<16|ye[Ee+1]<<8|ye[Ee]}return xe},ae=function(ye,xe){for(var Ee=0;Ee<xe.length;Ee+=8){var Se=Ee/4;xe[Ee]=ye[Se+1],xe[Ee+1]=ye[Se+1]>>>8,xe[Ee+2]=ye[Se+1]>>>16,xe[Ee+3]=ye[Se+1]>>>24,xe[Ee+4]=ye[Se],xe[Ee+5]=ye[Se]>>>8,xe[Ee+6]=ye[Se]>>>16,xe[Ee+7]=ye[Se]>>>24}return xe},le=function(ye){var xe=this,Ee=ye.capacity,Se=ye.padding,Me=(0,n.default)(),Be=200,$e=Ee/8,ke=Be-Ee/4,Te=0,Ie=new Uint32Array(Be/4),Fe=t.Buffer.allocUnsafe(ke);return this.absorb=function(Le){for(var He=0;He<Le.length;He++)Fe[Te]=Le[He],Te+=1,Te>=ke&&(fe(Fe,Ie),Me(Ie),Te=0);return xe},this.squeeze=function(){var Le=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},He={buffer:Le.buffer||t.Buffer.allocUnsafe($e),padding:Le.padding||Se,queue:t.Buffer.allocUnsafe(Fe.length),state:new Uint32Array(Ie.length)};Fe.copy(He.queue);for(var ze=0;ze<Ie.length;ze++)He.state[ze]=Ie[ze];He.queue.fill(0,Te),He.queue[Te]|=He.padding,He.queue[ke-1]|=128,fe(He.queue,He.state);for(var Je=0;Je<He.buffer.length;Je+=ke)Me(He.state),ae(He.state,He.buffer.slice(Je,Je+ke));return He.buffer},this.reset=function(){return Fe.fill(0),Ie.fill(0),Te=0,xe},this},pe=le;c.default=pe})(sponge);(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.default=c.SHAKE=c.SHA3Hash=c.SHA3=c.Keccak=void 0;var t=dist$1,n=ie(sponge);function ie(xe){return xe&&xe.__esModule?xe:{default:xe}}var fe=function(Ee){var Se=Ee.allowedSizes,Me=Ee.defaultSize,Be=Ee.padding;return function $e(){var ke=this,Te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Me;if(!this||this.constructor!==$e)return new $e(Te);if(Se&&!Se.includes(Te))throw new Error("Unsupported hash length");var Ie=new n.default({capacity:Te});return this.update=function(Fe){var Le=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"utf8";if(t.Buffer.isBuffer(Fe))return Ie.absorb(Fe),ke;if(typeof Fe=="string")return ke.update(t.Buffer.from(Fe,Le));throw new TypeError("Not a string or buffer")},this.digest=function(){var Fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"binary",Le=typeof Fe=="string"?{format:Fe}:Fe,He=Ie.squeeze({buffer:Le.buffer,padding:Le.padding||Be});return Le.format&&Le.format!=="binary"?He.toString(Le.format):He},this.reset=function(){return Ie.reset(),ke},this}},ae=fe({allowedSizes:[224,256,384,512],defaultSize:512,padding:1});c.Keccak=ae;var le=fe({allowedSizes:[224,256,384,512],defaultSize:512,padding:6});c.SHA3=le;var pe=fe({allowedSizes:[128,256],defaultSize:256,padding:31});c.SHAKE=pe;var me=ae;c.SHA3Hash=me,le.SHA3Hash=me;var ye=le;c.default=ye})(sha3$1);var BigInteger={exports:{}};(function(c){var t=function(n){var ie=1e7,fe=7,ae=9007199254740992,le=Se(ae),pe=Math.log(ae);function me(Ze,Rt){return typeof Ze>"u"?me[0]:typeof Rt<"u"?+Rt==10?Xt(Ze):Dt(Ze,Rt):Xt(Ze)}function ye(Ze,Rt){this.value=Ze,this.sign=Rt,this.isSmall=!1}ye.prototype=Object.create(me.prototype);function xe(Ze){this.value=Ze,this.sign=Ze<0,this.isSmall=!0}xe.prototype=Object.create(me.prototype);function Ee(Ze){return-ae<Ze&&Ze<ae}function Se(Ze){return Ze<1e7?[Ze]:Ze<1e14?[Ze%1e7,Math.floor(Ze/1e7)]:[Ze%1e7,Math.floor(Ze/1e7)%1e7,Math.floor(Ze/1e14)]}function Me(Ze){Be(Ze);var Rt=Ze.length;if(Rt<4&&Ae(Ze,le)<0)switch(Rt){case 0:return 0;case 1:return Ze[0];case 2:return Ze[0]+Ze[1]*ie;default:return Ze[0]+(Ze[1]+Ze[2]*ie)*ie}return Ze}function Be(Ze){for(var Rt=Ze.length;Ze[--Rt]===0;);Ze.length=Rt+1}function $e(Ze){for(var Rt=new Array(Ze),Qt=-1;++Qt<Ze;)Rt[Qt]=0;return Rt}function ke(Ze){return Ze>0?Math.floor(Ze):Math.ceil(Ze)}function Te(Ze,Rt){var Qt=Ze.length,Ft=Rt.length,Wt=new Array(Qt),an=0,Zt=ie,Jt,An;for(An=0;An<Ft;An++)Jt=Ze[An]+Rt[An]+an,an=Jt>=Zt?1:0,Wt[An]=Jt-an*Zt;for(;An<Qt;)Jt=Ze[An]+an,an=Jt===Zt?1:0,Wt[An++]=Jt-an*Zt;return an>0&&Wt.push(an),Wt}function Ie(Ze,Rt){return Ze.length>=Rt.length?Te(Ze,Rt):Te(Rt,Ze)}function Fe(Ze,Rt){var Qt=Ze.length,Ft=new Array(Qt),Wt=ie,an,Zt;for(Zt=0;Zt<Qt;Zt++)an=Ze[Zt]-Wt+Rt,Rt=Math.floor(an/Wt),Ft[Zt]=an-Rt*Wt,Rt+=1;for(;Rt>0;)Ft[Zt++]=Rt%Wt,Rt=Math.floor(Rt/Wt);return Ft}ye.prototype.add=function(Ze){var Rt=Xt(Ze);if(this.sign!==Rt.sign)return this.subtract(Rt.negate());var Qt=this.value,Ft=Rt.value;return Rt.isSmall?new ye(Fe(Qt,Math.abs(Ft)),this.sign):new ye(Ie(Qt,Ft),this.sign)},ye.prototype.plus=ye.prototype.add,xe.prototype.add=function(Ze){var Rt=Xt(Ze),Qt=this.value;if(Qt<0!==Rt.sign)return this.subtract(Rt.negate());var Ft=Rt.value;if(Rt.isSmall){if(Ee(Qt+Ft))return new xe(Qt+Ft);Ft=Se(Math.abs(Ft))}return new ye(Fe(Ft,Math.abs(Qt)),Qt<0)},xe.prototype.plus=xe.prototype.add;function Le(Ze,Rt){var Qt=Ze.length,Ft=Rt.length,Wt=new Array(Qt),an=0,Zt=ie,Jt,An;for(Jt=0;Jt<Ft;Jt++)An=Ze[Jt]-an-Rt[Jt],An<0?(An+=Zt,an=1):an=0,Wt[Jt]=An;for(Jt=Ft;Jt<Qt;Jt++){if(An=Ze[Jt]-an,An<0)An+=Zt;else{Wt[Jt++]=An;break}Wt[Jt]=An}for(;Jt<Qt;Jt++)Wt[Jt]=Ze[Jt];return Be(Wt),Wt}function He(Ze,Rt,Qt){var Ft;return Ae(Ze,Rt)>=0?Ft=Le(Ze,Rt):(Ft=Le(Rt,Ze),Qt=!Qt),Ft=Me(Ft),typeof Ft=="number"?(Qt&&(Ft=-Ft),new xe(Ft)):new ye(Ft,Qt)}function ze(Ze,Rt,Qt){var Ft=Ze.length,Wt=new Array(Ft),an=-Rt,Zt=ie,Jt,An;for(Jt=0;Jt<Ft;Jt++)An=Ze[Jt]+an,an=Math.floor(An/Zt),An%=Zt,Wt[Jt]=An<0?An+Zt:An;return Wt=Me(Wt),typeof Wt=="number"?(Qt&&(Wt=-Wt),new xe(Wt)):new ye(Wt,Qt)}ye.prototype.subtract=function(Ze){var Rt=Xt(Ze);if(this.sign!==Rt.sign)return this.add(Rt.negate());var Qt=this.value,Ft=Rt.value;return Rt.isSmall?ze(Qt,Math.abs(Ft),this.sign):He(Qt,Ft,this.sign)},ye.prototype.minus=ye.prototype.subtract,xe.prototype.subtract=function(Ze){var Rt=Xt(Ze),Qt=this.value;if(Qt<0!==Rt.sign)return this.add(Rt.negate());var Ft=Rt.value;return Rt.isSmall?new xe(Qt-Ft):ze(Ft,Math.abs(Qt),Qt>=0)},xe.prototype.minus=xe.prototype.subtract,ye.prototype.negate=function(){return new ye(this.value,!this.sign)},xe.prototype.negate=function(){var Ze=this.sign,Rt=new xe(-this.value);return Rt.sign=!Ze,Rt},ye.prototype.abs=function(){return new ye(this.value,!1)},xe.prototype.abs=function(){return new xe(Math.abs(this.value))};function Je(Ze,Rt){var Qt=Ze.length,Ft=Rt.length,Wt=Qt+Ft,an=$e(Wt),Zt=ie,Jt,An,tn,nn,Sn;for(tn=0;tn<Qt;++tn){nn=Ze[tn];for(var rn=0;rn<Ft;++rn)Sn=Rt[rn],Jt=nn*Sn+an[tn+rn],An=Math.floor(Jt/Zt),an[tn+rn]=Jt-An*Zt,an[tn+rn+1]+=An}return Be(an),an}function Xe(Ze,Rt){var Qt=Ze.length,Ft=new Array(Qt),Wt=ie,an=0,Zt,Jt;for(Jt=0;Jt<Qt;Jt++)Zt=Ze[Jt]*Rt+an,an=Math.floor(Zt/Wt),Ft[Jt]=Zt-an*Wt;for(;an>0;)Ft[Jt++]=an%Wt,an=Math.floor(an/Wt);return Ft}function Ue(Ze,Rt){for(var Qt=[];Rt-- >0;)Qt.push(0);return Qt.concat(Ze)}function $t(Ze,Rt){var Qt=Math.max(Ze.length,Rt.length);if(Qt<=30)return Je(Ze,Rt);Qt=Math.ceil(Qt/2);var Ft=Ze.slice(Qt),Wt=Ze.slice(0,Qt),an=Rt.slice(Qt),Zt=Rt.slice(0,Qt),Jt=$t(Wt,Zt),An=$t(Ft,an),tn=$t(Ie(Wt,Ft),Ie(Zt,an)),nn=Ie(Ie(Jt,Ue(Le(Le(tn,Jt),An),Qt)),Ue(An,2*Qt));return Be(nn),nn}function _e(Ze,Rt){return-.012*Ze-.012*Rt+15e-6*Ze*Rt>0}ye.prototype.multiply=function(Ze){var Rt=Xt(Ze),Qt=this.value,Ft=Rt.value,Wt=this.sign!==Rt.sign,an;if(Rt.isSmall){if(Ft===0)return me[0];if(Ft===1)return this;if(Ft===-1)return this.negate();if(an=Math.abs(Ft),an<ie)return new ye(Xe(Qt,an),Wt);Ft=Se(an)}return _e(Qt.length,Ft.length)?new ye($t(Qt,Ft),Wt):new ye(Je(Qt,Ft),Wt)},ye.prototype.times=ye.prototype.multiply;function se(Ze,Rt,Qt){return Ze<ie?new ye(Xe(Rt,Ze),Qt):new ye(Je(Rt,Se(Ze)),Qt)}xe.prototype._multiplyBySmall=function(Ze){return Ee(Ze.value*this.value)?new xe(Ze.value*this.value):se(Math.abs(Ze.value),Se(Math.abs(this.value)),this.sign!==Ze.sign)},ye.prototype._multiplyBySmall=function(Ze){return Ze.value===0?me[0]:Ze.value===1?this:Ze.value===-1?this.negate():se(Math.abs(Ze.value),this.value,this.sign!==Ze.sign)},xe.prototype.multiply=function(Ze){return Xt(Ze)._multiplyBySmall(this)},xe.prototype.times=xe.prototype.multiply;function ce(Ze){var Rt=Ze.length,Qt=$e(Rt+Rt),Ft=ie,Wt,an,Zt,Jt,An;for(Zt=0;Zt<Rt;Zt++){Jt=Ze[Zt],an=0-Jt*Jt;for(var tn=Zt;tn<Rt;tn++)An=Ze[tn],Wt=2*(Jt*An)+Qt[Zt+tn]+an,an=Math.floor(Wt/Ft),Qt[Zt+tn]=Wt-an*Ft;Qt[Zt+Rt]=an}return Be(Qt),Qt}ye.prototype.square=function(){return new ye(ce(this.value),!1)},xe.prototype.square=function(){var Ze=this.value*this.value;return Ee(Ze)?new xe(Ze):new ye(ce(Se(Math.abs(this.value))),!1)};function de(Ze,Rt){var Qt=Ze.length,Ft=Rt.length,Wt=ie,an=$e(Rt.length),Zt=Rt[Ft-1],Jt=Math.ceil(Wt/(2*Zt)),An=Xe(Ze,Jt),tn=Xe(Rt,Jt),nn,Sn,rn,dn,Mn,sn,ln;for(An.length<=Qt&&An.push(0),tn.push(0),Zt=tn[Ft-1],Sn=Qt-Ft;Sn>=0;Sn--){for(nn=Wt-1,An[Sn+Ft]!==Zt&&(nn=Math.floor((An[Sn+Ft]*Wt+An[Sn+Ft-1])/Zt)),rn=0,dn=0,sn=tn.length,Mn=0;Mn<sn;Mn++)rn+=nn*tn[Mn],ln=Math.floor(rn/Wt),dn+=An[Sn+Mn]-(rn-ln*Wt),rn=ln,dn<0?(An[Sn+Mn]=dn+Wt,dn=-1):(An[Sn+Mn]=dn,dn=0);for(;dn!==0;){for(nn-=1,rn=0,Mn=0;Mn<sn;Mn++)rn+=An[Sn+Mn]-Wt+tn[Mn],rn<0?(An[Sn+Mn]=rn+Wt,rn=0):(An[Sn+Mn]=rn,rn=1);dn+=rn}an[Sn]=nn}return An=ve(An,Jt)[0],[Me(an),Me(An)]}function he(Ze,Rt){for(var Qt=Ze.length,Ft=Rt.length,Wt=[],an=[],Zt=ie,Jt,An,tn,nn,Sn;Qt;){if(an.unshift(Ze[--Qt]),Be(an),Ae(an,Rt)<0){Wt.push(0);continue}An=an.length,tn=an[An-1]*Zt+an[An-2],nn=Rt[Ft-1]*Zt+Rt[Ft-2],An>Ft&&(tn=(tn+1)*Zt),Jt=Math.ceil(tn/nn);do{if(Sn=Xe(Rt,Jt),Ae(Sn,an)<=0)break;Jt--}while(Jt);Wt.push(Jt),an=Le(an,Sn)}return Wt.reverse(),[Me(Wt),Me(an)]}function ve(Ze,Rt){var Qt=Ze.length,Ft=$e(Qt),Wt=ie,an,Zt,Jt,An;for(Jt=0,an=Qt-1;an>=0;--an)An=Jt*Wt+Ze[an],Zt=ke(An/Rt),Jt=An-Zt*Rt,Ft[an]=Zt|0;return[Ft,Jt|0]}function we(Ze,Rt){var Qt,Ft=Xt(Rt),Wt=Ze.value,an=Ft.value,Zt;if(an===0)throw new Error("Cannot divide by zero");if(Ze.isSmall)return Ft.isSmall?[new xe(ke(Wt/an)),new xe(Wt%an)]:[me[0],Ze];if(Ft.isSmall){if(an===1)return[Ze,me[0]];if(an==-1)return[Ze.negate(),me[0]];var Jt=Math.abs(an);if(Jt<ie){Qt=ve(Wt,Jt),Zt=Me(Qt[0]);var An=Qt[1];return Ze.sign&&(An=-An),typeof Zt=="number"?(Ze.sign!==Ft.sign&&(Zt=-Zt),[new xe(Zt),new xe(An)]):[new ye(Zt,Ze.sign!==Ft.sign),new xe(An)]}an=Se(Jt)}var tn=Ae(Wt,an);if(tn===-1)return[me[0],Ze];if(tn===0)return[me[Ze.sign===Ft.sign?1:-1],me[0]];Wt.length+an.length<=200?Qt=de(Wt,an):Qt=he(Wt,an),Zt=Qt[0];var nn=Ze.sign!==Ft.sign,Sn=Qt[1],rn=Ze.sign;return typeof Zt=="number"?(nn&&(Zt=-Zt),Zt=new xe(Zt)):Zt=new ye(Zt,nn),typeof Sn=="number"?(rn&&(Sn=-Sn),Sn=new xe(Sn)):Sn=new ye(Sn,rn),[Zt,Sn]}ye.prototype.divmod=function(Ze){var Rt=we(this,Ze);return{quotient:Rt[0],remainder:Rt[1]}},xe.prototype.divmod=ye.prototype.divmod,ye.prototype.divide=function(Ze){return we(this,Ze)[0]},xe.prototype.over=xe.prototype.divide=ye.prototype.over=ye.prototype.divide,ye.prototype.mod=function(Ze){return we(this,Ze)[1]},xe.prototype.remainder=xe.prototype.mod=ye.prototype.remainder=ye.prototype.mod,ye.prototype.pow=function(Ze){var Rt=Xt(Ze),Qt=this.value,Ft=Rt.value,Wt,an,Zt;if(Ft===0)return me[1];if(Qt===0)return me[0];if(Qt===1)return me[1];if(Qt===-1)return Rt.isEven()?me[1]:me[-1];if(Rt.sign)return me[0];if(!Rt.isSmall)throw new Error("The exponent "+Rt.toString()+" is too large.");if(this.isSmall&&Ee(Wt=Math.pow(Qt,Ft)))return new xe(ke(Wt));for(an=this,Zt=me[1];Ft&!0&&(Zt=Zt.times(an),--Ft),Ft!==0;)Ft/=2,an=an.square();return Zt},xe.prototype.pow=ye.prototype.pow,ye.prototype.modPow=function(Ze,Rt){if(Ze=Xt(Ze),Rt=Xt(Rt),Rt.isZero())throw new Error("Cannot take modPow with modulus 0");for(var Qt=me[1],Ft=this.mod(Rt);Ze.isPositive();){if(Ft.isZero())return me[0];Ze.isOdd()&&(Qt=Qt.multiply(Ft).mod(Rt)),Ze=Ze.divide(2),Ft=Ft.square().mod(Rt)}return Qt},xe.prototype.modPow=ye.prototype.modPow;function Ae(Ze,Rt){if(Ze.length!==Rt.length)return Ze.length>Rt.length?1:-1;for(var Qt=Ze.length-1;Qt>=0;Qt--)if(Ze[Qt]!==Rt[Qt])return Ze[Qt]>Rt[Qt]?1:-1;return 0}ye.prototype.compareAbs=function(Ze){var Rt=Xt(Ze),Qt=this.value,Ft=Rt.value;return Rt.isSmall?1:Ae(Qt,Ft)},xe.prototype.compareAbs=function(Ze){var Rt=Xt(Ze),Qt=Math.abs(this.value),Ft=Rt.value;return Rt.isSmall?(Ft=Math.abs(Ft),Qt===Ft?0:Qt>Ft?1:-1):-1},ye.prototype.compare=function(Ze){if(Ze===1/0)return-1;if(Ze===-1/0)return 1;var Rt=Xt(Ze),Qt=this.value,Ft=Rt.value;return this.sign!==Rt.sign?Rt.sign?1:-1:Rt.isSmall?this.sign?-1:1:Ae(Qt,Ft)*(this.sign?-1:1)},ye.prototype.compareTo=ye.prototype.compare,xe.prototype.compare=function(Ze){if(Ze===1/0)return-1;if(Ze===-1/0)return 1;var Rt=Xt(Ze),Qt=this.value,Ft=Rt.value;return Rt.isSmall?Qt==Ft?0:Qt>Ft?1:-1:Qt<0!==Rt.sign?Qt<0?-1:1:Qt<0?1:-1},xe.prototype.compareTo=xe.prototype.compare,ye.prototype.equals=function(Ze){return this.compare(Ze)===0},xe.prototype.eq=xe.prototype.equals=ye.prototype.eq=ye.prototype.equals,ye.prototype.notEquals=function(Ze){return this.compare(Ze)!==0},xe.prototype.neq=xe.prototype.notEquals=ye.prototype.neq=ye.prototype.notEquals,ye.prototype.greater=function(Ze){return this.compare(Ze)>0},xe.prototype.gt=xe.prototype.greater=ye.prototype.gt=ye.prototype.greater,ye.prototype.lesser=function(Ze){return this.compare(Ze)<0},xe.prototype.lt=xe.prototype.lesser=ye.prototype.lt=ye.prototype.lesser,ye.prototype.greaterOrEquals=function(Ze){return this.compare(Ze)>=0},xe.prototype.geq=xe.prototype.greaterOrEquals=ye.prototype.geq=ye.prototype.greaterOrEquals,ye.prototype.lesserOrEquals=function(Ze){return this.compare(Ze)<=0},xe.prototype.leq=xe.prototype.lesserOrEquals=ye.prototype.leq=ye.prototype.lesserOrEquals,ye.prototype.isEven=function(){return(this.value[0]&1)===0},xe.prototype.isEven=function(){return(this.value&1)===0},ye.prototype.isOdd=function(){return(this.value[0]&1)===1},xe.prototype.isOdd=function(){return(this.value&1)===1},ye.prototype.isPositive=function(){return!this.sign},xe.prototype.isPositive=function(){return this.value>0},ye.prototype.isNegative=function(){return this.sign},xe.prototype.isNegative=function(){return this.value<0},ye.prototype.isUnit=function(){return!1},xe.prototype.isUnit=function(){return Math.abs(this.value)===1},ye.prototype.isZero=function(){return!1},xe.prototype.isZero=function(){return this.value===0},ye.prototype.isDivisibleBy=function(Ze){var Rt=Xt(Ze),Qt=Rt.value;return Qt===0?!1:Qt===1?!0:Qt===2?this.isEven():this.mod(Rt).equals(me[0])},xe.prototype.isDivisibleBy=ye.prototype.isDivisibleBy;function be(Ze){var Rt=Ze.abs();if(Rt.isUnit())return!1;if(Rt.equals(2)||Rt.equals(3)||Rt.equals(5))return!0;if(Rt.isEven()||Rt.isDivisibleBy(3)||Rt.isDivisibleBy(5))return!1;if(Rt.lesser(49))return!0}function ue(Ze,Rt){for(var Qt=Ze.prev(),Ft=Qt,Wt=0,an,Zt,Jt;Ft.isEven();)Ft=Ft.divide(2),Wt++;e:for(Zt=0;Zt<Rt.length;Zt++)if(!Ze.lesser(Rt[Zt])&&(Jt=t(Rt[Zt]).modPow(Ft,Ze),!(Jt.equals(me[1])||Jt.equals(Qt)))){for(an=Wt-1;an!=0;an--){if(Jt=Jt.square().mod(Ze),Jt.isUnit())return!1;if(Jt.equals(Qt))continue e}return!1}return!0}ye.prototype.isPrime=function(Ze){var Rt=be(this);if(Rt!==n)return Rt;var Qt=this.abs(),Ft=Qt.bitLength();if(Ft<=64)return ue(Qt,[2,325,9375,28178,450775,9780504,1795265022]);for(var Wt=Math.log(2)*Ft,an=Math.ceil(Ze===!0?2*Math.pow(Wt,2):Wt),Zt=[],Jt=0;Jt<an;Jt++)Zt.push(t(Jt+2));return ue(Qt,Zt)},xe.prototype.isPrime=ye.prototype.isPrime,ye.prototype.isProbablePrime=function(Ze){var Rt=be(this);if(Rt!==n)return Rt;for(var Qt=this.abs(),Ft=Ze===n?5:Ze,Wt=[],an=0;an<Ft;an++)Wt.push(t.randBetween(2,Qt.minus(2)));return ue(Qt,Wt)},xe.prototype.isProbablePrime=ye.prototype.isProbablePrime,ye.prototype.modInv=function(Ze){for(var Rt=t.zero,Qt=t.one,Ft=Xt(Ze),Wt=this.abs(),an,Zt,Jt;!Wt.equals(t.zero);)an=Ft.divide(Wt),Zt=Rt,Jt=Ft,Rt=Qt,Ft=Wt,Qt=Zt.subtract(an.multiply(Qt)),Wt=Jt.subtract(an.multiply(Wt));if(!Ft.equals(1))throw new Error(this.toString()+" and "+Ze.toString()+" are not co-prime");return Rt.compare(0)===-1&&(Rt=Rt.add(Ze)),this.isNegative()?Rt.negate():Rt},xe.prototype.modInv=ye.prototype.modInv,ye.prototype.next=function(){var Ze=this.value;return this.sign?ze(Ze,1,this.sign):new ye(Fe(Ze,1),this.sign)},xe.prototype.next=function(){var Ze=this.value;return Ze+1<ae?new xe(Ze+1):new ye(le,!1)},ye.prototype.prev=function(){var Ze=this.value;return this.sign?new ye(Fe(Ze,1),!0):ze(Ze,1,this.sign)},xe.prototype.prev=function(){var Ze=this.value;return Ze-1>-ae?new xe(Ze-1):new ye(le,!0)};for(var ge=[1];2*ge[ge.length-1]<=ie;)ge.push(2*ge[ge.length-1]);var Re=ge.length,Ne=ge[Re-1];function qe(Ze){return(typeof Ze=="number"||typeof Ze=="string")&&+Math.abs(Ze)<=ie||Ze instanceof ye&&Ze.value.length<=1}ye.prototype.shiftLeft=function(Ze){if(!qe(Ze))throw new Error(String(Ze)+" is too large for shifting.");if(Ze=+Ze,Ze<0)return this.shiftRight(-Ze);var Rt=this;if(Rt.isZero())return Rt;for(;Ze>=Re;)Rt=Rt.multiply(Ne),Ze-=Re-1;return Rt.multiply(ge[Ze])},xe.prototype.shiftLeft=ye.prototype.shiftLeft,ye.prototype.shiftRight=function(Ze){var Rt;if(!qe(Ze))throw new Error(String(Ze)+" is too large for shifting.");if(Ze=+Ze,Ze<0)return this.shiftLeft(-Ze);for(var Qt=this;Ze>=Re;){if(Qt.isZero()||Qt.isNegative()&&Qt.isUnit())return Qt;Rt=we(Qt,Ne),Qt=Rt[1].isNegative()?Rt[0].prev():Rt[0],Ze-=Re-1}return Rt=we(Qt,ge[Ze]),Rt[1].isNegative()?Rt[0].prev():Rt[0]},xe.prototype.shiftRight=ye.prototype.shiftRight;function Pe(Ze,Rt,Qt){Rt=Xt(Rt);for(var Ft=Ze.isNegative(),Wt=Rt.isNegative(),an=Ft?Ze.not():Ze,Zt=Wt?Rt.not():Rt,Jt=0,An=0,tn=null,nn=null,Sn=[];!an.isZero()||!Zt.isZero();)tn=we(an,Ne),Jt=tn[1].toJSNumber(),Ft&&(Jt=Ne-1-Jt),nn=we(Zt,Ne),An=nn[1].toJSNumber(),Wt&&(An=Ne-1-An),an=tn[0],Zt=nn[0],Sn.push(Qt(Jt,An));for(var rn=Qt(Ft?1:0,Wt?1:0)!==0?t(-1):t(0),dn=Sn.length-1;dn>=0;dn-=1)rn=rn.multiply(Ne).add(t(Sn[dn]));return rn}ye.prototype.not=function(){return this.negate().prev()},xe.prototype.not=ye.prototype.not,ye.prototype.and=function(Ze){return Pe(this,Ze,function(Rt,Qt){return Rt&Qt})},xe.prototype.and=ye.prototype.and,ye.prototype.or=function(Ze){return Pe(this,Ze,function(Rt,Qt){return Rt|Qt})},xe.prototype.or=ye.prototype.or,ye.prototype.xor=function(Ze){return Pe(this,Ze,function(Rt,Qt){return Rt^Qt})},xe.prototype.xor=ye.prototype.xor;var Ge=1<<30,Ce=(ie&-ie)*(ie&-ie)|Ge;function De(Ze){var Rt=Ze.value,Qt=typeof Rt=="number"?Rt|Ge:Rt[0]+Rt[1]*ie|Ce;return Qt&-Qt}function je(Ze,Rt){if(Rt.compareTo(Ze)<=0){var Qt=je(Ze,Rt.square(Rt)),Ft=Qt.p,Wt=Qt.e,an=Ft.multiply(Rt);return an.compareTo(Ze)<=0?{p:an,e:Wt*2+1}:{p:Ft,e:Wt*2}}return{p:t(1),e:0}}ye.prototype.bitLength=function(){var Ze=this;return Ze.compareTo(t(0))<0&&(Ze=Ze.negate().subtract(t(1))),Ze.compareTo(t(0))===0?t(0):t(je(Ze,t(2)).e).add(t(1))},xe.prototype.bitLength=ye.prototype.bitLength;function Ve(Ze,Rt){return Ze=Xt(Ze),Rt=Xt(Rt),Ze.greater(Rt)?Ze:Rt}function Mt(Ze,Rt){return Ze=Xt(Ze),Rt=Xt(Rt),Ze.lesser(Rt)?Ze:Rt}function Oe(Ze,Rt){if(Ze=Xt(Ze).abs(),Rt=Xt(Rt).abs(),Ze.equals(Rt))return Ze;if(Ze.isZero())return Rt;if(Rt.isZero())return Ze;for(var Qt=me[1],Ft,Wt;Ze.isEven()&&Rt.isEven();)Ft=Math.min(De(Ze),De(Rt)),Ze=Ze.divide(Ft),Rt=Rt.divide(Ft),Qt=Qt.multiply(Ft);for(;Ze.isEven();)Ze=Ze.divide(De(Ze));do{for(;Rt.isEven();)Rt=Rt.divide(De(Rt));Ze.greater(Rt)&&(Wt=Rt,Rt=Ze,Ze=Wt),Rt=Rt.subtract(Ze)}while(!Rt.isZero());return Qt.isUnit()?Ze:Ze.multiply(Qt)}function We(Ze,Rt){return Ze=Xt(Ze).abs(),Rt=Xt(Rt).abs(),Ze.divide(Oe(Ze,Rt)).multiply(Rt)}function jt(Ze,Rt){Ze=Xt(Ze),Rt=Xt(Rt);var Qt=Mt(Ze,Rt),Ft=Ve(Ze,Rt),Wt=Ft.subtract(Qt).add(1);if(Wt.isSmall)return Qt.add(Math.floor(Math.random()*Wt));for(var an=Wt.value.length-1,Zt=[],Jt=!0,An=an;An>=0;An--){var tn=Jt?Wt.value[An]:ie,nn=ke(Math.random()*tn);Zt.unshift(nn),nn<tn&&(Jt=!1)}return Zt=Me(Zt),Qt.add(typeof Zt=="number"?new xe(Zt):new ye(Zt,!1))}var Dt=function(Ze,Rt){for(var Qt=Ze.length,Ft,Wt=Math.abs(Rt),Ft=0;Ft<Qt;Ft++){var an=Ze[Ft].toLowerCase();if(an!=="-"&&/[a-z0-9]/.test(an)){if(/[0-9]/.test(an)&&+an>=Wt){if(an==="1"&&Wt===1)continue;throw new Error(an+" is not a valid digit in base "+Rt+".")}else if(an.charCodeAt(0)-87>=Wt)throw new Error(an+" is not a valid digit in base "+Rt+".")}}if(2<=Rt&&Rt<=36&&Qt<=pe/Math.log(Rt)){var Zt=parseInt(Ze,Rt);if(isNaN(Zt))throw new Error(an+" is not a valid digit in base "+Rt+".");return new xe(parseInt(Ze,Rt))}Rt=Xt(Rt);var Jt=[],An=Ze[0]==="-";for(Ft=An?1:0;Ft<Ze.length;Ft++){var an=Ze[Ft].toLowerCase(),tn=an.charCodeAt(0);if(48<=tn&&tn<=57)Jt.push(Xt(an));else if(97<=tn&&tn<=122)Jt.push(Xt(an.charCodeAt(0)-87));else if(an==="<"){var nn=Ft;do Ft++;while(Ze[Ft]!==">");Jt.push(Xt(Ze.slice(nn+1,Ft)))}else throw new Error(an+" is not a valid character")}return Ht(Jt,Rt,An)};function Ht(Ze,Rt,Qt){var Ft=me[0],Wt=me[1],an;for(an=Ze.length-1;an>=0;an--)Ft=Ft.add(Ze[an].times(Wt)),Wt=Wt.times(Rt);return Qt?Ft.negate():Ft}function vn(Ze){return Ze<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(Ze):"<"+Ze+">"}function Vt(Ze,Rt){if(Rt=t(Rt),Rt.isZero()){if(Ze.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(Rt.equals(-1)){if(Ze.isZero())return{value:[0],isNegative:!1};if(Ze.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-Ze)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var Qt=Array.apply(null,Array(+Ze-1)).map(Array.prototype.valueOf,[0,1]);return Qt.unshift([1]),{value:[].concat.apply([],Qt),isNegative:!1}}var Ft=!1;if(Ze.isNegative()&&Rt.isPositive()&&(Ft=!0,Ze=Ze.abs()),Rt.equals(1))return Ze.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+Ze)).map(Number.prototype.valueOf,1),isNegative:Ft};for(var Wt=[],an=Ze,Zt;an.isNegative()||an.compareAbs(Rt)>=0;){Zt=an.divmod(Rt),an=Zt.quotient;var Jt=Zt.remainder;Jt.isNegative()&&(Jt=Rt.minus(Jt).abs(),an=an.next()),Wt.push(Jt.toJSNumber())}return Wt.push(an.toJSNumber()),{value:Wt.reverse(),isNegative:Ft}}function Kt(Ze,Rt){var Qt=Vt(Ze,Rt);return(Qt.isNegative?"-":"")+Qt.value.map(vn).join("")}ye.prototype.toArray=function(Ze){return Vt(this,Ze)},xe.prototype.toArray=function(Ze){return Vt(this,Ze)},ye.prototype.toString=function(Ze){if(Ze===n&&(Ze=10),Ze!==10)return Kt(this,Ze);for(var Rt=this.value,Qt=Rt.length,Ft=String(Rt[--Qt]),Wt="0000000",an;--Qt>=0;)an=String(Rt[Qt]),Ft+=Wt.slice(an.length)+an;var Zt=this.sign?"-":"";return Zt+Ft},xe.prototype.toString=function(Ze){return Ze===n&&(Ze=10),Ze!=10?Kt(this,Ze):String(this.value)},ye.prototype.toJSON=xe.prototype.toJSON=function(){return this.toString()},ye.prototype.valueOf=function(){return parseInt(this.toString(),10)},ye.prototype.toJSNumber=ye.prototype.valueOf,xe.prototype.valueOf=function(){return this.value},xe.prototype.toJSNumber=xe.prototype.valueOf;function En(Ze){if(Ee(+Ze)){var Rt=+Ze;if(Rt===ke(Rt))return new xe(Rt);throw new Error("Invalid integer: "+Ze)}var Qt=Ze[0]==="-";Qt&&(Ze=Ze.slice(1));var Ft=Ze.split(/e/i);if(Ft.length>2)throw new Error("Invalid integer: "+Ft.join("e"));if(Ft.length===2){var Wt=Ft[1];if(Wt[0]==="+"&&(Wt=Wt.slice(1)),Wt=+Wt,Wt!==ke(Wt)||!Ee(Wt))throw new Error("Invalid integer: "+Wt+" is not a valid exponent.");var an=Ft[0],Zt=an.indexOf(".");if(Zt>=0&&(Wt-=an.length-Zt-1,an=an.slice(0,Zt)+an.slice(Zt+1)),Wt<0)throw new Error("Cannot include negative exponent part for integers");an+=new Array(Wt+1).join("0"),Ze=an}var Jt=/^([0-9][0-9]*)$/.test(Ze);if(!Jt)throw new Error("Invalid integer: "+Ze);for(var An=[],tn=Ze.length,nn=fe,Sn=tn-nn;tn>0;)An.push(+Ze.slice(Sn,tn)),Sn-=nn,Sn<0&&(Sn=0),tn-=nn;return Be(An),new ye(An,Qt)}function en(Ze){if(Ee(Ze)){if(Ze!==ke(Ze))throw new Error(Ze+" is not an integer.");return new xe(Ze)}return En(Ze.toString())}function Xt(Ze){return typeof Ze=="number"?en(Ze):typeof Ze=="string"?En(Ze):Ze}for(var _n=0;_n<1e3;_n++)me[_n]=new xe(_n),_n>0&&(me[-_n]=new xe(-_n));return me.one=me[1],me.zero=me[0],me.minusOne=me[-1],me.max=Ve,me.min=Mt,me.gcd=Oe,me.lcm=We,me.isInstance=function(Ze){return Ze instanceof ye||Ze instanceof xe},me.randBetween=jt,me.fromArray=function(Ze,Rt,Qt){return Ht(Ze.map(Xt),Xt(Rt||10),Qt)},me}();c.hasOwnProperty("exports")&&(c.exports=t)})(BigInteger);var BigIntegerExports=BigInteger.exports;const i=getDefaultExportFromCjs$2(BigIntegerExports),ARRAY16=new Array(16),zl=initU8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),zr$1=initU8Array([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),sl=initU8Array([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),sr$1=initU8Array([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),hl=initU32Array([0,1518500249,1859775393,2400959708,2840853838]),hr$1=initU32Array([1352829926,1548603684,1836072691,2053994217,0]);function rotl(c,t){return c<<t|c>>>32-t}function fn1(c,t,n,ie,fe,ae,le,pe){return rotl(c+(t^n^ie)+ae+le|0,pe)+fe|0}function fn2(c,t,n,ie,fe,ae,le,pe){return rotl(c+(t&n|~t&ie)+ae+le|0,pe)+fe|0}function fn3(c,t,n,ie,fe,ae,le,pe){return rotl(c+((t|~n)^ie)+ae+le|0,pe)+fe|0}function fn4(c,t,n,ie,fe,ae,le,pe){return rotl(c+(t&ie|n&~ie)+ae+le|0,pe)+fe|0}function fn5(c,t,n,ie,fe,ae,le,pe){return rotl(c+(t^(n|~ie))+ae+le|0,pe)+fe|0}function readInt32LE(c,t){return t>>>=0,c[t]|c[t+1]<<8|c[t+2]<<16|c[t+3]<<24}function writeUInt32LE(c,t,n){return t=+t,n>>>=0,c[n+3]=t>>>24,c[n+2]=t>>>16,c[n+1]=t>>>8,c[n]=t&255,n+4}function writeInt32LE(c,t,n){return t=+t,n>>>=0,c[n]=t&255,c[n+1]=t>>>8,c[n+2]=t>>>16,c[n+3]=t>>>24,n+4}function initU32Array(c){return typeof Uint32Array<"u"?new Uint32Array(c):c}function initU8Array(c){return typeof Uint8Array<"u"?new Uint8Array(c):c}function createU8Array(c){return typeof Uint8Array<"u"?new Uint8Array(c):new Array(c)}class RIPEMD160{constructor(){this._block=createU8Array(64),this._blockSize=64,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1,this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}update(t){if(this._finalized)throw new Error("Digest already called");const n=this._block;let ie=0;for(;this._blockOffset+t.length-ie>=this._blockSize;){for(let fe=this._blockOffset;fe<this._blockSize;)n[fe++]=t[ie++];this._update(),this._blockOffset=0}for(;ie<t.length;)n[this._blockOffset++]=t[ie++];for(let fe=0,ae=t.length*8;ae>0;++fe)this._length[fe]+=ae,ae=this._length[fe]/4294967296|0,ae>0&&(this._length[fe]-=4294967296*ae);return this}_update(){const t=ARRAY16;for(let Me=0;Me<16;++Me)t[Me]=readInt32LE(this._block,Me*4);let n=this._a|0,ie=this._b|0,fe=this._c|0,ae=this._d|0,le=this._e|0,pe=this._a|0,me=this._b|0,ye=this._c|0,xe=this._d|0,Ee=this._e|0;for(let Me=0;Me<80;Me+=1){let Be,$e;Me<16?(Be=fn1(n,ie,fe,ae,le,t[zl[Me]],hl[0],sl[Me]),$e=fn5(pe,me,ye,xe,Ee,t[zr$1[Me]],hr$1[0],sr$1[Me])):Me<32?(Be=fn2(n,ie,fe,ae,le,t[zl[Me]],hl[1],sl[Me]),$e=fn4(pe,me,ye,xe,Ee,t[zr$1[Me]],hr$1[1],sr$1[Me])):Me<48?(Be=fn3(n,ie,fe,ae,le,t[zl[Me]],hl[2],sl[Me]),$e=fn3(pe,me,ye,xe,Ee,t[zr$1[Me]],hr$1[2],sr$1[Me])):Me<64?(Be=fn4(n,ie,fe,ae,le,t[zl[Me]],hl[3],sl[Me]),$e=fn2(pe,me,ye,xe,Ee,t[zr$1[Me]],hr$1[3],sr$1[Me])):(Be=fn5(n,ie,fe,ae,le,t[zl[Me]],hl[4],sl[Me]),$e=fn1(pe,me,ye,xe,Ee,t[zr$1[Me]],hr$1[4],sr$1[Me])),n=le,le=ae,ae=rotl(fe,10),fe=ie,ie=Be,pe=Ee,Ee=xe,xe=rotl(ye,10),ye=me,me=$e}const Se=this._b+fe+xe|0;this._b=this._c+ae+Ee|0,this._c=this._d+le+pe|0,this._d=this._e+n+me|0,this._e=this._a+ie+ye|0,this._a=Se}digest(){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),writeUInt32LE(this._block,this._length[0],56),writeUInt32LE(this._block,this._length[1],60),this._update();const t=createU8Array(20);writeInt32LE(t,this._a,0),writeInt32LE(t,this._b,4),writeInt32LE(t,this._c,8),writeInt32LE(t,this._d,12),writeInt32LE(t,this._e,16),this._block.fill(0),this._blockOffset=0;for(let n=0;n<4;++n)this._length[n]=0;return t}}var a$1="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",s=function(c){for(var t=c.toString(),n="",ie=0;ie<t.length;ie+=2)n+=String.fromCharCode(parseInt(t.substr(ie,2),16));return n},l$1=function(c){for(var t=new ArrayBuffer(5*c.length/8),n=new Uint8Array(t),ie=0;ie<c.length/8;ie++){for(var fe=[0,0,0,0,0,0,0,0],ae=0;ae<8;++ae)fe[ae]=a$1.indexOf(c[8*ie+ae]);n[5*ie+0]=fe[0]<<3|fe[1]>>2,n[5*ie+1]=(3&fe[1])<<6|fe[2]<<1|fe[3]>>4,n[5*ie+2]=(15&fe[3])<<4|fe[4]>>1,n[5*ie+3]=(1&fe[4])<<7|fe[5]<<2|fe[6]>>3,n[5*ie+4]=(7&fe[6])<<5|fe[7]}return n},d$1=function(c){var t=[],n=Math.floor(c.length/5),ie=c.length%5;if(ie!=0){for(var fe=0;fe<5-ie;fe++)c+="\0";n+=1}for(var ae=0;ae<n;ae++)t.push(a$1.charAt(c.charCodeAt(5*ae)>>3)),t.push(a$1.charAt((7&c.charCodeAt(5*ae))<<2|c.charCodeAt(5*ae+1)>>6)),t.push(a$1.charAt((63&c.charCodeAt(5*ae+1))>>1)),t.push(a$1.charAt((1&c.charCodeAt(5*ae+1))<<4|c.charCodeAt(5*ae+2)>>4)),t.push(a$1.charAt((15&c.charCodeAt(5*ae+2))<<1|c.charCodeAt(5*ae+3)>>7)),t.push(a$1.charAt((127&c.charCodeAt(5*ae+3))>>2)),t.push(a$1.charAt((3&c.charCodeAt(5*ae+3))<<3|c.charCodeAt(5*ae+4)>>5)),t.push(a$1.charAt(31&c.charCodeAt(5*ae+4)));var le=0;ie==1?le=6:ie==2?le=4:ie==3?le=3:ie==4&&(le=1);for(var pe=0;pe<le;pe++)t.pop();for(var me=0;me<le;me++)t.push("=");return t.join("")},p$1=function(c){var t=c.toString().toUpperCase().replace(/-/g,"");if(!t||t.length!==40)return!1;var n=v$1(l$1(t));return y$1(Buffer$7.from(n.slice(0,42),"hex"))===n.slice(42)},v$1=function(c){for(var t="",n=0;n<c.length;n++){var ie=Math.round(c[n]).toString(16);ie.length===1&&(ie="0"+ie),t+=ie}return t},y$1=function(c){return new sha3$1.Keccak(256).update(c).digest("hex").toString().substr(0,8)};function g$1(c,t){this._block=safeBufferExports.Buffer.alloc(c),this._finalSize=t,this._blockSize=c,this._len=0}g$1.prototype.update=function(c,t){typeof c=="string"&&(c=safeBufferExports.Buffer.from(c,t=t||"utf8"));for(var n=this._block,ie=this._blockSize,fe=c.length,ae=this._len,le=0;le<fe;){for(var pe=ae%ie,me=Math.min(fe-le,ie-pe),ye=0;ye<me;ye++)n[pe+ye]=c[le+ye];le+=me,(ae+=me)%ie==0&&this._update(n)}return this._len+=fe,this},g$1.prototype.digest=function(c){var t=this._len%this._blockSize;this._block[t]=128,this._block.fill(0,t+1),t>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var ie=(4294967295&n)>>>0;this._block.writeUInt32BE((n-ie)/4294967296,this._blockSize-8),this._block.writeUInt32BE(ie,this._blockSize-4)}this._update(this._block);var fe=this._hash();return c?fe.toString(c):fe},g$1.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var m$1,w$1,b$1=[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],_$2=new Array(64);function B$1(){this.init(),this._w=_$2,g$1.call(this,64,56)}function E$1(c,t,n){return n^c&(t^n)}function I$1(c,t,n){return c&t|n&(c|t)}function x$1(c){return(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10)}function S$1(c){return(c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7)}function A$1(c){return(c>>>7|c<<25)^(c>>>18|c<<14)^c>>>3}function z$2(c){return c.length!==void 0}m$1=B$1,(w$1=g$1)&&(m$1.super_=w$1,m$1.prototype=Object.create(w$1.prototype,{constructor:{value:m$1,enumerable:!1,writable:!0,configurable:!0}})),B$1.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},B$1.prototype._update=function(c){for(var t,n=this._w,ie=0|this._a,fe=0|this._b,ae=0|this._c,le=0|this._d,pe=0|this._e,me=0|this._f,ye=0|this._g,xe=0|this._h,Ee=0;Ee<16;++Ee)n[Ee]=c.readInt32BE(4*Ee);for(;Ee<64;++Ee)n[Ee]=0|(((t=n[Ee-2])>>>17|t<<15)^(t>>>19|t<<13)^t>>>10)+n[Ee-7]+A$1(n[Ee-15])+n[Ee-16];for(var Se=0;Se<64;++Se){var Me=xe+S$1(pe)+E$1(pe,me,ye)+b$1[Se]+n[Se]|0,Be=x$1(ie)+I$1(ie,fe,ae)|0;xe=ye,ye=me,me=pe,pe=le+Me|0,le=ae,ae=fe,fe=ie,ie=Me+Be|0}this._a=ie+this._a|0,this._b=fe+this._b|0,this._c=ae+this._c|0,this._d=le+this._d|0,this._e=pe+this._e|0,this._f=me+this._f|0,this._g=ye+this._g|0,this._h=xe+this._h|0},B$1.prototype._hash=function(){var c=safeBufferExports.Buffer.allocUnsafe(32);return c.writeInt32BE(this._a,0),c.writeInt32BE(this._b,4),c.writeInt32BE(this._c,8),c.writeInt32BE(this._d,12),c.writeInt32BE(this._e,16),c.writeInt32BE(this._f,20),c.writeInt32BE(this._g,24),c.writeInt32BE(this._h,28),c};var k$2=new(function(){function c(n){this.sha256=n.sha256,this.alphabet=n.alphabet,this.codec=e$1(this.alphabet),this.base=this.alphabet.length}var t=c.prototype;return t.encodeChecked=function(n){var ie=this.sha256(this.sha256(n)).slice(0,4);return this.encodeRaw(Buffer$7.from(function(){var fe=[];return[].slice.call(arguments).forEach(function(ae){if(z$2(ae))for(var le=0;le<ae.length;le++)fe.push(ae[le]);else fe.push(ae)}),fe}(n,ie)))},t.encodeRaw=function(n){return this.codec.encode(n)},t.decodeChecked=function(n){var ie=this.decodeRaw(n);if(ie.length<5)throw new Error("invalid_input_size: decoded data must have length >= 5");if(!this.verifyCheckSum(ie))throw new Error("checksum_invalid");return ie.slice(0,-4)},t.decodeRaw=function(n){return this.codec.decode(n)},t.verifyCheckSum=function(n){return function(ie,fe){if(ie.length!==fe.length)return!1;for(var ae=0;ae<ie.length;ae++)if(ie[ae]!==fe[ae])return!1;return!0}(this.sha256(this.sha256(n.slice(0,-4))).slice(0,4),n.slice(-4))},c}())({sha256:function(c){return new B$1().update(Buffer$7.from(c)).digest()},alphabet:"rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"}),O$1=function(c){return c.slice(0,2)==="0x"?c.slice(2):c},C$1=function(c,t){if(t===void 0&&(t=null),typeof c!="string")throw new Error("stripHexPrefix param must be type 'string', is currently type "+typeof c+".");for(var n,ie=O$1(c).toLowerCase(),fe=(n=(t!=null?t.toString()+"0x":"")+ie,new sha3$1.Keccak(256).update(n).digest()).toString("hex"),ae="0x",le=0;le<ie.length;le++)ae+=parseInt(fe[le],16)>=8?ie[le].toUpperCase():ie[le];return ae};function U$1(c,t){return function(n){return/^0x[0-9a-fA-F]{40}$/.test(n)}(c)&&C$1(c,t)===c}var P$2=function(c,t){if(!c)throw t},L$2=function(c,t){if(!Buffer$7.isBuffer(c))throw t},j$2=i.one,R$2=i.zero,q$2=i(3);function M$2(c,t){return c.and(j$2.shiftLeft(t)).notEquals(R$2)}function F$2(c){return i.fromArray(Array.prototype.slice.call(c,0),256)}function T$2(c,t){var n=c.toArray(256).value,ie=t?Math.max(t-n.length,0):0;return Buffer$7.from([].concat(Array(ie).fill(0),n))}function G$2(c,t,n,ie){P$2(ie!==void 0,"Missing Z coordinate"),this.curve=c,this.x=t,this.y=n,this.z=ie,this._zInv=null,this.compressed=!0}Object.defineProperty(G$2.prototype,"zInv",{get:function(){return this._zInv===null&&(this._zInv=this.z.modInv(this.curve.p)),this._zInv}}),Object.defineProperty(G$2.prototype,"affineX",{get:function(){return this.x.multiply(this.zInv).mod(this.curve.p)}}),Object.defineProperty(G$2.prototype,"affineY",{get:function(){return this.y.multiply(this.zInv).mod(this.curve.p)}}),G$2.fromAffine=function(c,t,n){return new G$2(c,t,n,j$2)},G$2.prototype.equals=function(c){return c===this||(this.curve.isInfinity(this)?this.curve.isInfinity(c):this.curve.isInfinity(c)?this.curve.isInfinity(this):c.y.multiply(this.z).subtract(this.y.multiply(c.z)).mod(this.curve.p).compare(R$2)===0&&c.x.multiply(this.z).subtract(this.x.multiply(c.z)).mod(this.curve.p).compare(R$2)===0)},G$2.prototype.negate=function(){var c=this.curve.p.subtract(this.y);return new G$2(this.curve,this.x,c,this.z)},G$2.prototype.add=function(c){if(this.curve.isInfinity(this))return c;if(this.curve.isInfinity(c))return this;var t=this.x,n=this.y,ie=c.x,fe=c.y.multiply(this.z).subtract(n.multiply(c.z)).mod(this.curve.p),ae=ie.multiply(this.z).subtract(t.multiply(c.z)).mod(this.curve.p);if(ae.compare(R$2)===0)return fe.compare(R$2)===0?this.twice():this.curve.infinity;var le=ae.square(),pe=le.multiply(ae),me=t.multiply(le),ye=fe.square().multiply(this.z),xe=ye.subtract(me.shiftLeft(1)).multiply(c.z).subtract(pe).multiply(ae).mod(this.curve.p),Ee=me.multiply(q$2).multiply(fe).subtract(n.multiply(pe)).subtract(ye.multiply(fe)).multiply(c.z).add(fe.multiply(pe)).mod(this.curve.p),Se=pe.multiply(this.z).multiply(c.z).mod(this.curve.p);return new G$2(this.curve,xe,Ee,Se)},G$2.prototype.twice=function(){if(this.curve.isInfinity(this))return this;if(this.y.compare(R$2)===0)return this.curve.infinity;var c=this.x,t=this.y,n=t.multiply(this.z).mod(this.curve.p),ie=n.multiply(t).mod(this.curve.p),fe=this.curve.a,ae=c.square().multiply(q$2);fe.compare(R$2)!==0&&(ae=ae.add(this.z.square().multiply(fe)));var le=(ae=ae.mod(this.curve.p)).square().subtract(c.shiftLeft(3).multiply(ie)).shiftLeft(1).multiply(n).mod(this.curve.p),pe=ae.multiply(q$2).multiply(c).subtract(ie.shiftLeft(1)).shiftLeft(2).multiply(ie).subtract(ae.pow(3)).mod(this.curve.p),me=n.pow(3).shiftLeft(3).mod(this.curve.p);return new G$2(this.curve,le,pe,me)},G$2.prototype.multiply=function(c){if(this.curve.isInfinity(this))return this;if(c.compare(R$2)===0)return this.curve.infinity;for(var t=c,n=t.multiply(q$2),ie=this.negate(),fe=this,ae=n.bitLength()-2;ae>0;--ae){var le=M$2(n,ae),pe=M$2(t,ae);fe=fe.twice(),le!==pe&&(fe=fe.add(le?this:ie))}return fe},G$2.prototype.multiplyTwo=function(c,t,n){for(var ie=Math.max(c.bitLength(),n.bitLength())-1,fe=this.curve.infinity,ae=this.add(t);ie>=0;){var le=M$2(c,ie),pe=M$2(n,ie);fe=fe.twice(),le?fe=fe.add(pe?ae:this):pe&&(fe=fe.add(t)),--ie}return fe},G$2.prototype.getEncoded=function(c){if(c==null&&(c=this.compressed),this.curve.isInfinity(this))return new Buffer$7("00","hex");var t,n=this.affineX,ie=this.affineY,fe=this.curve.pLength;return c?(t=new Buffer$7(1+fe)).writeUInt8(ie.isEven()?2:3,0):((t=new Buffer$7(1+fe+fe)).writeUInt8(4,0),T$2(ie,fe).copy(t,1+fe)),T$2(n,fe).copy(t,1),t},G$2.decodeFrom=function(c,t){var n,ie=t.readUInt8(0),fe=ie!==4,ae=Math.floor((c.p.bitLength()+7)/8),le=F$2(t.slice(1,1+ae));if(fe)P$2(t.length===ae+1,"Invalid sequence length"),P$2(ie===2||ie===3,"Invalid sequence tag"),n=c.pointFromX(ie===3,le);else{P$2(t.length===1+ae+ae,"Invalid sequence length");var pe=F$2(t.slice(1+ae));n=G$2.fromAffine(c,le,pe)}return n.compressed=fe,n},G$2.prototype.toString=function(){return this.curve.isInfinity(this)?"(INFINITY)":"("+this.affineX.toString()+","+this.affineY.toString()+")"};var H$2=i.zero,N$2=i.one;function X$2(c,t,n,ie,fe,ae,le){this.p=c,this.a=t,this.b=n,this.G=G$2.fromAffine(this,ie,fe),this.n=ae,this.h=le,this.infinity=new G$2(this,null,null,H$2),this.pOverFour=c.add(N$2).shiftRight(2),this.pLength=Math.floor((this.p.bitLength()+7)/8)}X$2.prototype.pointFromX=function(c,t){var n=t.pow(3).add(this.a.multiply(t)).add(this.b).mod(this.p).modPow(this.pOverFour,this.p),ie=n;return n.isEven()^!c&&(ie=this.p.subtract(ie)),G$2.fromAffine(this,t,ie)},X$2.prototype.isInfinity=function(c){return c===this.infinity||c.z.compare(H$2)===0&&c.y.compare(H$2)!==0},X$2.prototype.isOnCurve=function(c){if(this.isInfinity(c))return!0;var t=c.affineX,n=c.affineY,ie=this.a,fe=this.b,ae=this.p;if(t.compare(H$2)<0||t.compareTo(ae)>=0||n.compare(H$2)<0||n.compareTo(ae)>=0)return!1;var le=n.square().mod(ae),pe=t.pow(3).add(ie.multiply(t)).add(fe).mod(ae);return le.equals(pe)},X$2.prototype.validate=function(c){P$2(!this.isInfinity(c),"Point is at infinity"),P$2(this.isOnCurve(c),"Point is not on the curve");var t=c.multiply(this.n);return P$2(this.isInfinity(t),"Point is not a scalar multiple of G"),!0};var Y$2={p:"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",a:"00",b:"07",n:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",h:"01",Gx:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",Gy:"483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"};function K$2(c,t){return new sha3$1.SHA3(256).update(c).digest(t)}function Q$2(c){return Buffer$7.from(new RIPEMD160().update(c).digest())}function Z$2(c){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(L$2(c,"expecting keyBuffer<Buffer>"),t==="sha256x2"){var n=K$2(K$2(c)).slice(0,4);return o$1.encode(Buffer$7.concat([c,n]))}var ie=[c];t&&ie.push(Buffer$7.from(t));var fe=Q$2(Buffer$7.concat(ie)).slice(0,4);return o$1.encode(Buffer$7.concat([c,fe]))}function D$2(c){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;P$2(c,"private key expected");var n,ie=new Buffer$7(o$1.decode(c)),fe=ie.slice(-4),ae=ie.slice(0,-4);if(t==="sha256x2")n=K$2(K$2(ae)).slice(0,4);else{var le=[ae];t&&le.push(Buffer$7.from(t)),n=Q$2(Buffer$7.concat(le)).slice(0,4)}if(fe.toString("hex")!==n.toString("hex"))throw new Error("Invalid checksum, "+"".concat(fe.toString("hex")," != ").concat(n.toString("hex")));return ae}var V$2=function(c){var t=Y$2;if(!t)return null;var n=i(t.p,16),ie=i(t.a,16),fe=i(t.b,16),ae=i(t.n,16),le=i(t.h,16);return new X$2(n,ie,fe,i(t.Gx,16),i(t.Gy,16),ae,le)}();function J$2(c){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"EOS";if(typeof c=="string")return J$2.fromString(c,t);if(Buffer$7.isBuffer(c))return J$2.fromBuffer(c);if(typeof c=="object"&&c.Q)return J$2(c.Q);function n(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c.compressed;return c.getEncoded(ae)}function ie(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"EOS";return ae+Z$2(n())}function fe(){return n().toString("hex")}return{Q:c,toString:ie,toBuffer:n,toHex:fe}}J$2.isValid=function(c){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"EOS";try{return J$2(c,t),!0}catch{return!1}},J$2.fromBuffer=function(c){return J$2(G$2.decodeFrom(V$2,c))},J$2.fromString=function(c){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"EOS";try{return J$2.fromStringOrThrow(c,t)}catch{return null}},J$2.fromStringOrThrow=function(c){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"EOS",n=c.match(/^PUB_([A-Za-z0-9]+)_([A-Za-z0-9]+)$/);if(n===null){var ie=new RegExp("^"+t);return ie.test(c)&&(c=c.substring(t.length)),J$2.fromBuffer(D$2(c))}var fe=n[1],ae=n[2];return J$2.fromBuffer(D$2(ae,fe))},J$2.fromHex=function(c){return J$2.fromBuffer(new Buffer$7(c,"hex"))},J$2.fromStringHex=function(c){return J$2.fromString(new Buffer$7(c,"hex"))};var W$2=e$1("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),$$2=W$2.encode,tt$1=W$2.decode,rt$1=function(c){return c===void 0},et$1={ed25519PublicKey:48,ed25519SecretSeed:144,preAuthTx:152,sha256Hash:184},nt$1=function(c,t){if(typeof t!="string")throw new TypeError("encoded argument must be of type String");var n=tt$1(t),ie=n[0],fe=n.slice(0,-2),ae=fe.slice(1),le=n.slice(-2);if(t!==$$2(n))throw new Error("invalid encoded string");var pe=et$1[c];if(rt$1(pe))throw new Error(c+' is not a valid version byte name. expected one of "accountId" or "seed"');if(ie!==pe)throw new Error("invalid version byte. expected "+pe+", got "+ie);var me=ot$1(fe);if(!ft$1(me,le))throw new Error("invalid checksum");return Buffer$7.from(ae)},it$1=function(c,t){if(t===null||rt$1(t))throw new Error("cannot encode null data");var n=et$1[c];if(rt$1(n))throw new Error(c+' is not a valid version byte name. expected one of "ed25519PublicKey", "ed25519SecretSeed", "preAuthTx", "sha256Hash"');t=Buffer$7.from(t);var ie=Buffer$7.from([n]),fe=Buffer$7.concat([ie,t]),ae=ot$1(fe),le=Buffer$7.concat([fe,ae]);return $$2(le)},ot$1=function(c){var t=Buffer$7.alloc(2);return t.writeUInt16LE(function(n,ie){Buffer$7.isBuffer(n)||(n=new Buffer$7);for(var fe=0,ae=0;ae<n.length;ae++){var le=fe>>>8&255;le^=255&n[ae],fe=fe<<8&65535,fe^=le^=le>>>4,fe^=le=le<<5&65535,fe^=le=le<<7&65535}return fe}(c),0),t},ft$1=function(c,t){if(c.length!==t.length)return!1;if(c.length===0)return!0;for(var n=0;n<c.length;n+=1)if(c[n]!==t[n])return!1;return!0};function ut$1(c){return(ut$1=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(c)}function at$1(c,t){return(at$1=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,ie){return n.__proto__=ie,n})(c,t)}function st$1(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ht$1(c,t,n){return(ht$1=st$1()?Reflect.construct.bind():function(ie,fe,ae){var le=[null];le.push.apply(le,fe);var pe=new(Function.bind.apply(ie,le));return ae&&at$1(pe,ae.prototype),pe}).apply(null,arguments)}function ct$1(c){var t=typeof Map=="function"?new Map:void 0;return(ct$1=function(n){if(n===null||Function.toString.call(n).indexOf("[native code]")===-1)return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(n))return t.get(n);t.set(n,ie)}function ie(){return ht$1(n,arguments,ut$1(this).constructor)}return ie.prototype=Object.create(n.prototype,{constructor:{value:ie,enumerable:!1,writable:!0,configurable:!0}}),at$1(ie,n)})(c)}var lt$1=[0,1,2,42,43,68,69],dt$1=function(c){for(var t=new Uint8Array(c.length),n=0;n<c.length;n++)t[n]=c.charCodeAt(n);return t}("SS58PRE"),pt$1=function(c){var t,n;function ie(){return c.apply(this,arguments)||this}return n=c,(t=ie).prototype=Object.create(n.prototype),t.prototype.constructor=t,at$1(t,n),ie.prototype.toJSON=function(){return{_type:"AccountIndex",data:this+0}},ie}(ct$1(Number));function vt$1(c,t){c.length||(c=[c]),t.length||(t=[t]);var n=new Uint8Array(c.length+t.length);return n.set(c),n.set(t,c.length),n}function yt$1(c,t,n,ie,fe){var ae;if(t===void 0&&(t=42),n===void 0&&(n=null),ie===void 0&&(ie=null),lt$1.indexOf(t)===-1)throw new Error("Unknown ss58 address type",t);if(typeof c=="number"||c instanceof pt$1){var le=c<256?1:c<65536?2:c<1?4:8;if([1,2,4,8].indexOf(ie=ie||le)===-1)throw new Error("Invalid length");if(ie=Math.max(le,ie),n&&typeof n!="number")throw new Error("Invalid checksum length");switch(ie){case 1:n=1;break;case 2:n=[1,2].indexOf(n)+1||1;break;case 4:n=[1,2,3,4].indexOf(n)+1||1;break;case 8:n=[1,2,3,4,5,6,7,8].indexOf(n)+1||1}ae=function(ye,xe){var Ee=!1;ye<0&&(ye=-ye-1,Ee=!0);for(var Se=new Uint8Array(xe),Me=0;Me<xe;++Me)Se[Me]=ye%256,Ee&&(Se[Me]=255&~Se[Me]),ye/=256;return Se}(c,ie)}else{if(!(c instanceof Uint8Array)||c.length!==32&&c.length!==35)throw new Error("Unknown item to encode as ss58. Passing back.",c);n=2,fe=ae=c.length===35?c.slice(1,33):c}var pe=blake2b_1.blake2b(vt$1(dt$1,1&t?fe:vt$1(t,ae))),me=vt$1(vt$1(t,ae),pe.slice(0,n));return o$1.encode(Buffer$7.from(me))}function gt$1(c,t){var n;t===void 0&&(t=0);try{n=o$1.decode(c)}catch{return null}if(lt$1.indexOf(n[0])===-1||n.length<3)return null;var ie,fe=n.length<=3?1:n.length<=5?2:n.length<=9?4:n.length<=17?8:32,ae=n.length-1-fe,le=n.slice(1,1+fe);n.slice(1+n.length),fe===32&&(ie=le);var pe=fe<32?new pt$1(function(xe){var Ee=0,Se=1;return xe.forEach(function(Me){Ee+=Me*Se,Se*=256}),Ee}(le)):new Buffer$7.from(le);if(n[0]%1&&!ie&&!t)return null;for(var me=blake2b_1.blake2b(vt$1(dt$1,n[0]%1?ie||t(pe):n.slice(0,1+fe))),ye=0;ye<ae;++ye)if(me[ye]!==n[1+fe+ye])return null;return pe}function mt$1(c){var t=new Error;this.name=t.name="ValidationError",this.message=t.message=c,this.stack=t.stack}function wt$1(c,t){if(t==null&&(t="Assertion failed."),!c)throw new mt$1(t)}mt$1.prototype=Object.create(Error.prototype);var bt$1=function(){function c(t,n){this.hi=0|t,this.lo=0|n}return c.prototype.ushrn32=function(t){var n=this.lo;return(t&=63)==0||(t<32?(n>>>=t,n|=this.hi<<32-t):n=this.hi>>>t-32),n},c}(),_t=Buffer$7.allocUnsafe(105),Bt$1="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Et$1=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,15,-1,10,17,21,20,26,30,7,5,-1,-1,-1,-1,-1,-1,-1,29,-1,24,13,25,9,8,23,-1,18,22,31,27,19,-1,1,0,3,16,11,28,12,14,6,4,2,-1,-1,-1,-1,-1,-1,29,-1,24,13,25,9,8,23,-1,18,22,31,27,19,-1,1,0,3,16,11,28,12,14,6,4,2,-1,-1,-1,-1,-1],It$1=new bt$1(7,4294967295),xt$1=[new bt$1(152,4072443489),new bt$1(121,3077413346),new bt$1(243,1046459332),new bt$1(174,783016616),new bt$1(30,1329849456)];function St$1(c,t){var n=c,ie=n.hi>>>3;n.hi&=It$1.hi,n.lo&=It$1.lo,n.hi<<=5,n.hi|=n.lo>>>27,n.lo<<=5;for(var fe=0;fe<xt$1.length;fe++)ie>>>fe&1&&(n.hi^=xt$1[fe].hi,n.lo^=xt$1[fe].lo);return n.lo^=t,n}function At$1(c,t,n,ie,fe,ae,le){wt$1(Buffer$7.isBuffer(c)),wt$1(t>>>0===t),wt$1(Buffer$7.isBuffer(n)),wt$1(ie>>>0===ie),wt$1((255&fe)===fe),wt$1((255&ae)===ae),wt$1(typeof le=="boolean");for(var pe=(1<<ae)-1,me=0,ye=0;t<c.length;t++){var xe=c[t];if(xe>>>fe)throw new Error("Invalid bits.");for(me=me<<fe|xe,ye+=fe;ye>=ae;)n[ie++]=me>>>(ye-=ae)&pe}if(le)ye&&(n[ie++]=me<<ae-ye&pe);else if(ye>=fe||me<<ae-ye&pe)throw new Error("Invalid bits.");return wt$1(ie<=n.length),n.slice(0,ie)}function zt(c,t,n){if(wt$1(typeof c=="string"),wt$1((15&t)===t,"Invalid cashaddr type."),wt$1(Buffer$7.isBuffer(n)),c.length===0||c.length>83)throw new Error("Invalid cashaddr prefix.");var ie=function(ae){switch(wt$1(ae>>>0===ae),ae){case 20:return 0;case 24:return 1;case 28:return 2;case 32:return 3;case 40:return 4;case 48:return 5;case 56:return 6;case 64:return 7;default:throw new Error("Non standard length.")}}(n.length),fe=Buffer$7.allocUnsafe(n.length+1);return fe[0]=t<<3|ie,n.copy(fe,1),function(ae,le){wt$1(typeof ae=="string"),wt$1(Buffer$7.isBuffer(le));for(var pe=new bt$1(0,1),me="",ye=!1,xe=!1,Ee=0;Ee<ae.length;Ee++){var Se=ae.charCodeAt(Ee);if(65280&Se||!(Se>>>5))throw new Error("Invalid cashaddr character.");if(Se>=97&&Se<=122)xe=!0;else if(Se>=65&&Se<=90)ye=!0,Se=Se-65+97;else if(Se>=48&&Se<=57)throw new Error("Invalid cashaddr prefix.");St$1(pe,31&Se),me+=String.fromCharCode(Se)}if(xe&&ye)throw new Error("Invalid cashaddr prefix.");St$1(pe,0),me+=":";for(var Me=0;Me<le.length;Me++){var Be=le[Me];if(Be>>>5)throw new Error("Invalid cashaddr value.");St$1(pe,Be),me+=Bt$1[Be]}for(var $e=0;$e<8;$e++)St$1(pe,0);pe.lo^=1;for(var ke=0;ke<8;ke++){var Te=31&pe.ushrn32(5*(7-ke));me+=Bt$1[Te]}return me}(c,At$1(fe,0,_t,0,8,5,!0))}function kt(c,t){t===void 0&&(t="bitcoincash"),wt$1(typeof c=="string"),wt$1(typeof t=="string");var n=function(xe,Ee){if(wt$1(typeof xe=="string"),xe.length<8||xe.length>196)throw new Error("Invalid cashaddr data length.");for(var Se=!1,Me=!1,Be=!1,$e=0,ke=0;ke<xe.length;ke++){var Te=xe.charCodeAt(ke);if(Te>=97&&Te<=122)Se=!0;else if(Te>=65&&Te<=90)Me=!0;else if(Te>=48&&Te<=57)Be=!0;else{if(Te!==58)throw new Error("Invalid cashaddr character.");if(Be||ke===0||ke>83)throw new Error("Invalid cashaddr prefix.");if($e!==0)throw new Error("Invalid cashaddr separators.");$e=ke}}if(Me&&Se)throw new Error("Invalid cashaddr casing.");var Ie,Fe=new bt$1(0,1);$e===0?Ie=Ee.toLowerCase():(Ie=xe.substring(0,$e).toLowerCase(),$e+=1);for(var Le=0;Le<Ie.length;Le++)St$1(Fe,31&(32|Ie.charCodeAt(Le)));St$1(Fe,0);var He=xe.length-$e;if(He<=8||He>112)throw new Error("Invalid cashaddr data length.");for(var ze=Buffer$7.allocUnsafe(He),Je=$e;Je<xe.length;Je++){var Xe=xe.charCodeAt(Je),Ue=65408&Xe?-1:Et$1[Xe];if(Ue===-1)throw new Error("Invalid cashaddr character.");St$1(Fe,Ue),Je+8<xe.length&&(ze[Je-$e]=Ue)}if(Fe.hi!==0||Fe.lo!==1||Ie!==Ee)throw new Error("Invalid cashaddr checksum.");return[Ie,ze.slice(0,-8)]}(c,t),ie=n[0],fe=n[1],ae=5*fe.length&7;if(ae>=5)throw new Error("Invalid padding in data.");if(fe[fe.length-1]&(1<<ae)-1)throw new Error("Non zero padding.");var le=At$1(fe,0,fe,0,5,8,!1),pe=le[0]>>>3&31,me=le.slice(1),ye=20+4*(3&le[0]);if(4&le[0]&&(ye*=2),ye!==me.length)throw new Error("Invalid cashaddr data length.");return{prefix:ie,type:pe,hash:me}}var Ot$1=function(c){function t(n){var ie=n.slice(0,-4),fe=n.slice(-4),ae=c(ie);if(!(fe[0]^ae[0]|fe[1]^ae[1]|fe[2]^ae[2]|fe[3]^ae[3]))return ie}return{bs58Encode:function(n){var ie=c(n);return o$1.encode(Buffer$7.concat([n,ie],n.length+4))},bs58Decode:function(n){var ie=t(o$1.decode(n));if(!ie)throw new Error("Invalid checksum");return ie},decodeUnsafe:function(n){var ie=o$1.decodeUnsafe(n);if(ie)return t(ie)}}}(function(c){var t=new B$1().update(c).digest();return new B$1().update(t).digest()}),Ct$1=Ot$1.bs58Decode,Ut$1=Ot$1.bs58Encode,crc={exports:{}};(function(c){(function(){var t=typeof window=="object"?window:{},n=!t.JS_CRC_NO_NODE_JS&&typeof process$1=="object"&&process$1.versions&&process$1.versions.node;n&&(t=globalThis);var ie=!t.JS_CRC_NO_COMMON_JS&&!0&&c.exports,fe=!t.JS_CRC_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",ae="0123456789abcdef".split(""),le=[{name:"crc32",polynom:3988292384,initValue:-1,bytes:4},{name:"crc16",polynom:40961,initValue:0,bytes:2}],pe,me,ye,xe;for(pe=0;pe<le.length;++pe){var Ee=le[pe];for(Ee.method=function(Be){return function($e){return Se($e,Be)}}(Ee),Ee.table=[],me=0;me<256;++me){for(xe=me,ye=0;ye<8;++ye)xe=xe&1?Ee.polynom^xe>>>1:xe>>>1;Ee.table[me]=xe>>>0}}var Se=function(Be,$e){var ke=typeof Be!="string";ke&&fe&&Be instanceof ArrayBuffer&&(Be=new Uint8Array(Be));var Te=$e.initValue,Ie,Fe,Le=Be.length,He=$e.table;if(ke)for(Fe=0;Fe<Le;++Fe)Te=He[(Te^Be[Fe])&255]^Te>>>8;else for(Fe=0;Fe<Le;++Fe)Ie=Be.charCodeAt(Fe),Ie<128?Te=He[(Te^Ie)&255]^Te>>>8:Ie<2048?(Te=He[(Te^(192|Ie>>6))&255]^Te>>>8,Te=He[(Te^(128|Ie&63))&255]^Te>>>8):Ie<55296||Ie>=57344?(Te=He[(Te^(224|Ie>>12))&255]^Te>>>8,Te=He[(Te^(128|Ie>>6&63))&255]^Te>>>8,Te=He[(Te^(128|Ie&63))&255]^Te>>>8):(Ie=65536+((Ie&1023)<<10|Be.charCodeAt(++Fe)&1023),Te=He[(Te^(240|Ie>>18))&255]^Te>>>8,Te=He[(Te^(128|Ie>>12&63))&255]^Te>>>8,Te=He[(Te^(128|Ie>>6&63))&255]^Te>>>8,Te=He[(Te^(128|Ie&63))&255]^Te>>>8);Te^=$e.initValue;var ze="";return $e.bytes>2&&(ze+=ae[Te>>28&15]+ae[Te>>24&15]+ae[Te>>20&15]+ae[Te>>16&15]),ze+=ae[Te>>12&15]+ae[Te>>8&15]+ae[Te>>4&15]+ae[Te&15],ze},Me={};for(pe=0;pe<le.length;++pe){var Ee=le[pe];Me[Ee.name]=Ee.method}if(ie)c.exports=Me;else for(pe=0;pe<le.length;++pe){var Ee=le[pe];t[Ee.name]=Ee.method}})()})(crc);var crcExports=crc.exports,sha512$2={exports:{}};(function(c){(function(){var t="input is invalid type",n="finalize already called",ie=typeof window=="object",fe=ie?window:{};fe.JS_SHA512_NO_WINDOW&&(ie=!1);var ae=!ie&&typeof self=="object",le=!fe.JS_SHA512_NO_NODE_JS&&typeof process$1=="object"&&process$1.versions&&process$1.versions.node;le?fe=globalThis:ae&&(fe=self);var pe=!fe.JS_SHA512_NO_COMMON_JS&&!0&&c.exports,me=!fe.JS_SHA512_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",ye="0123456789abcdef".split(""),xe=[-2147483648,8388608,32768,128],Ee=[24,16,8,0],Se=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Me=["hex","array","digest","arrayBuffer"],Be=[];(fe.JS_SHA512_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(ze){return Object.prototype.toString.call(ze)==="[object Array]"}),me&&(fe.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(ze){return typeof ze=="object"&&ze.buffer&&ze.buffer.constructor===ArrayBuffer});var $e=function(ze,Je){return function(Xe){return new Fe(Je,!0).update(Xe)[ze]()}},ke=function(ze){var Je=$e("hex",ze);Je.create=function(){return new Fe(ze)},Je.update=function($t){return Je.create().update($t)};for(var Xe=0;Xe<Me.length;++Xe){var Ue=Me[Xe];Je[Ue]=$e(Ue,ze)}return Je},Te=function(ze,Je){return function(Xe,Ue){return new Le(Xe,Je,!0).update(Ue)[ze]()}},Ie=function(ze){var Je=Te("hex",ze);Je.create=function($t){return new Le($t,ze)},Je.update=function($t,_e){return Je.create($t).update(_e)};for(var Xe=0;Xe<Me.length;++Xe){var Ue=Me[Xe];Je[Ue]=Te(Ue,ze)}return Je};function Fe(ze,Je){Je?(Be[0]=Be[1]=Be[2]=Be[3]=Be[4]=Be[5]=Be[6]=Be[7]=Be[8]=Be[9]=Be[10]=Be[11]=Be[12]=Be[13]=Be[14]=Be[15]=Be[16]=Be[17]=Be[18]=Be[19]=Be[20]=Be[21]=Be[22]=Be[23]=Be[24]=Be[25]=Be[26]=Be[27]=Be[28]=Be[29]=Be[30]=Be[31]=Be[32]=0,this.blocks=Be):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ze==384?(this.h0h=3418070365,this.h0l=3238371032,this.h1h=1654270250,this.h1l=914150663,this.h2h=2438529370,this.h2l=812702999,this.h3h=355462360,this.h3l=4144912697,this.h4h=1731405415,this.h4l=4290775857,this.h5h=2394180231,this.h5l=1750603025,this.h6h=3675008525,this.h6l=1694076839,this.h7h=1203062813,this.h7l=3204075428):ze==256?(this.h0h=573645204,this.h0l=4230739756,this.h1h=2673172387,this.h1l=3360449730,this.h2h=596883563,this.h2l=1867755857,this.h3h=2520282905,this.h3l=1497426621,this.h4h=2519219938,this.h4l=2827943907,this.h5h=3193839141,this.h5l=1401305490,this.h6h=721525244,this.h6l=746961066,this.h7h=246885852,this.h7l=2177182882):ze==224?(this.h0h=2352822216,this.h0l=424955298,this.h1h=1944164710,this.h1l=2312950998,this.h2h=502970286,this.h2l=855612546,this.h3h=1738396948,this.h3l=1479516111,this.h4h=258812777,this.h4l=2077511080,this.h5h=2011393907,this.h5l=79989058,this.h6h=1067287976,this.h6l=1780299464,this.h7h=286451373,this.h7l=2446758561):(this.h0h=1779033703,this.h0l=4089235720,this.h1h=3144134277,this.h1l=2227873595,this.h2h=1013904242,this.h2l=4271175723,this.h3h=2773480762,this.h3l=1595750129,this.h4h=1359893119,this.h4l=2917565137,this.h5h=2600822924,this.h5l=725511199,this.h6h=528734635,this.h6l=4215389547,this.h7h=1541459225,this.h7l=327033209),this.bits=ze,this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1}Fe.prototype.update=function(ze){if(this.finalized)throw new Error(n);var Je,Xe=typeof ze;if(Xe!=="string"){if(Xe==="object"){if(ze===null)throw new Error(t);if(me&&ze.constructor===ArrayBuffer)ze=new Uint8Array(ze);else if(!Array.isArray(ze)&&(!me||!ArrayBuffer.isView(ze)))throw new Error(t)}else throw new Error(t);Je=!0}for(var Ue,$t=0,_e,se=ze.length,ce=this.blocks;$t<se;){if(this.hashed&&(this.hashed=!1,ce[0]=this.block,ce[1]=ce[2]=ce[3]=ce[4]=ce[5]=ce[6]=ce[7]=ce[8]=ce[9]=ce[10]=ce[11]=ce[12]=ce[13]=ce[14]=ce[15]=ce[16]=ce[17]=ce[18]=ce[19]=ce[20]=ce[21]=ce[22]=ce[23]=ce[24]=ce[25]=ce[26]=ce[27]=ce[28]=ce[29]=ce[30]=ce[31]=ce[32]=0),Je)for(_e=this.start;$t<se&&_e<128;++$t)ce[_e>>2]|=ze[$t]<<Ee[_e++&3];else for(_e=this.start;$t<se&&_e<128;++$t)Ue=ze.charCodeAt($t),Ue<128?ce[_e>>2]|=Ue<<Ee[_e++&3]:Ue<2048?(ce[_e>>2]|=(192|Ue>>6)<<Ee[_e++&3],ce[_e>>2]|=(128|Ue&63)<<Ee[_e++&3]):Ue<55296||Ue>=57344?(ce[_e>>2]|=(224|Ue>>12)<<Ee[_e++&3],ce[_e>>2]|=(128|Ue>>6&63)<<Ee[_e++&3],ce[_e>>2]|=(128|Ue&63)<<Ee[_e++&3]):(Ue=65536+((Ue&1023)<<10|ze.charCodeAt(++$t)&1023),ce[_e>>2]|=(240|Ue>>18)<<Ee[_e++&3],ce[_e>>2]|=(128|Ue>>12&63)<<Ee[_e++&3],ce[_e>>2]|=(128|Ue>>6&63)<<Ee[_e++&3],ce[_e>>2]|=(128|Ue&63)<<Ee[_e++&3]);this.lastByteIndex=_e,this.bytes+=_e-this.start,_e>=128?(this.block=ce[32],this.start=_e-128,this.hash(),this.hashed=!0):this.start=_e}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},Fe.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var ze=this.blocks,Je=this.lastByteIndex;ze[32]=this.block,ze[Je>>2]|=xe[Je&3],this.block=ze[32],Je>=112&&(this.hashed||this.hash(),ze[0]=this.block,ze[1]=ze[2]=ze[3]=ze[4]=ze[5]=ze[6]=ze[7]=ze[8]=ze[9]=ze[10]=ze[11]=ze[12]=ze[13]=ze[14]=ze[15]=ze[16]=ze[17]=ze[18]=ze[19]=ze[20]=ze[21]=ze[22]=ze[23]=ze[24]=ze[25]=ze[26]=ze[27]=ze[28]=ze[29]=ze[30]=ze[31]=ze[32]=0),ze[30]=this.hBytes<<3|this.bytes>>>29,ze[31]=this.bytes<<3,this.hash()}},Fe.prototype.hash=function(){var ze=this.h0h,Je=this.h0l,Xe=this.h1h,Ue=this.h1l,$t=this.h2h,_e=this.h2l,se=this.h3h,ce=this.h3l,de=this.h4h,he=this.h4l,ve=this.h5h,we=this.h5l,Ae=this.h6h,be=this.h6l,ue=this.h7h,ge=this.h7l,Re=this.blocks,Ne,qe,Pe,Ge,Ce,De,je,Ve,Mt,Oe,We,jt,Dt,Ht,vn,Vt,Kt,En,en,Xt,_n,Ze,Rt,Qt,Ft;for(Ne=32;Ne<160;Ne+=2)Xt=Re[Ne-30],_n=Re[Ne-29],qe=(Xt>>>1|_n<<31)^(Xt>>>8|_n<<24)^Xt>>>7,Pe=(_n>>>1|Xt<<31)^(_n>>>8|Xt<<24)^(_n>>>7|Xt<<25),Xt=Re[Ne-4],_n=Re[Ne-3],Ge=(Xt>>>19|_n<<13)^(_n>>>29|Xt<<3)^Xt>>>6,Ce=(_n>>>19|Xt<<13)^(Xt>>>29|_n<<3)^(_n>>>6|Xt<<26),Xt=Re[Ne-32],_n=Re[Ne-31],Ze=Re[Ne-14],Rt=Re[Ne-13],De=(Rt&65535)+(_n&65535)+(Pe&65535)+(Ce&65535),je=(Rt>>>16)+(_n>>>16)+(Pe>>>16)+(Ce>>>16)+(De>>>16),Ve=(Ze&65535)+(Xt&65535)+(qe&65535)+(Ge&65535)+(je>>>16),Mt=(Ze>>>16)+(Xt>>>16)+(qe>>>16)+(Ge>>>16)+(Ve>>>16),Re[Ne]=Mt<<16|Ve&65535,Re[Ne+1]=je<<16|De&65535;var Wt=ze,an=Je,Zt=Xe,Jt=Ue,An=$t,tn=_e,nn=se,Sn=ce,rn=de,dn=he,Mn=ve,sn=we,ln=Ae,Bn=be,un=ue,hn=ge;for(Vt=Zt&An,Kt=Jt&tn,Ne=0;Ne<160;Ne+=8)qe=(Wt>>>28|an<<4)^(an>>>2|Wt<<30)^(an>>>7|Wt<<25),Pe=(an>>>28|Wt<<4)^(Wt>>>2|an<<30)^(Wt>>>7|an<<25),Ge=(rn>>>14|dn<<18)^(rn>>>18|dn<<14)^(dn>>>9|rn<<23),Ce=(dn>>>14|rn<<18)^(dn>>>18|rn<<14)^(rn>>>9|dn<<23),Oe=Wt&Zt,We=an&Jt,En=Oe^Wt&An^Vt,en=We^an&tn^Kt,Qt=rn&Mn^~rn&ln,Ft=dn&sn^~dn&Bn,Xt=Re[Ne],_n=Re[Ne+1],Ze=Se[Ne],Rt=Se[Ne+1],De=(Rt&65535)+(_n&65535)+(Ft&65535)+(Ce&65535)+(hn&65535),je=(Rt>>>16)+(_n>>>16)+(Ft>>>16)+(Ce>>>16)+(hn>>>16)+(De>>>16),Ve=(Ze&65535)+(Xt&65535)+(Qt&65535)+(Ge&65535)+(un&65535)+(je>>>16),Mt=(Ze>>>16)+(Xt>>>16)+(Qt>>>16)+(Ge>>>16)+(un>>>16)+(Ve>>>16),Xt=Mt<<16|Ve&65535,_n=je<<16|De&65535,De=(en&65535)+(Pe&65535),je=(en>>>16)+(Pe>>>16)+(De>>>16),Ve=(En&65535)+(qe&65535)+(je>>>16),Mt=(En>>>16)+(qe>>>16)+(Ve>>>16),Ze=Mt<<16|Ve&65535,Rt=je<<16|De&65535,De=(Sn&65535)+(_n&65535),je=(Sn>>>16)+(_n>>>16)+(De>>>16),Ve=(nn&65535)+(Xt&65535)+(je>>>16),Mt=(nn>>>16)+(Xt>>>16)+(Ve>>>16),un=Mt<<16|Ve&65535,hn=je<<16|De&65535,De=(Rt&65535)+(_n&65535),je=(Rt>>>16)+(_n>>>16)+(De>>>16),Ve=(Ze&65535)+(Xt&65535)+(je>>>16),Mt=(Ze>>>16)+(Xt>>>16)+(Ve>>>16),nn=Mt<<16|Ve&65535,Sn=je<<16|De&65535,qe=(nn>>>28|Sn<<4)^(Sn>>>2|nn<<30)^(Sn>>>7|nn<<25),Pe=(Sn>>>28|nn<<4)^(nn>>>2|Sn<<30)^(nn>>>7|Sn<<25),Ge=(un>>>14|hn<<18)^(un>>>18|hn<<14)^(hn>>>9|un<<23),Ce=(hn>>>14|un<<18)^(hn>>>18|un<<14)^(un>>>9|hn<<23),jt=nn&Wt,Dt=Sn&an,En=jt^nn&Zt^Oe,en=Dt^Sn&Jt^We,Qt=un&rn^~un&Mn,Ft=hn&dn^~hn&sn,Xt=Re[Ne+2],_n=Re[Ne+3],Ze=Se[Ne+2],Rt=Se[Ne+3],De=(Rt&65535)+(_n&65535)+(Ft&65535)+(Ce&65535)+(Bn&65535),je=(Rt>>>16)+(_n>>>16)+(Ft>>>16)+(Ce>>>16)+(Bn>>>16)+(De>>>16),Ve=(Ze&65535)+(Xt&65535)+(Qt&65535)+(Ge&65535)+(ln&65535)+(je>>>16),Mt=(Ze>>>16)+(Xt>>>16)+(Qt>>>16)+(Ge>>>16)+(ln>>>16)+(Ve>>>16),Xt=Mt<<16|Ve&65535,_n=je<<16|De&65535,De=(en&65535)+(Pe&65535),je=(en>>>16)+(Pe>>>16)+(De>>>16),Ve=(En&65535)+(qe&65535)+(je>>>16),Mt=(En>>>16)+(qe>>>16)+(Ve>>>16),Ze=Mt<<16|Ve&65535,Rt=je<<16|De&65535,De=(tn&65535)+(_n&65535),je=(tn>>>16)+(_n>>>16)+(De>>>16),Ve=(An&65535)+(Xt&65535)+(je>>>16),Mt=(An>>>16)+(Xt>>>16)+(Ve>>>16),ln=Mt<<16|Ve&65535,Bn=je<<16|De&65535,De=(Rt&65535)+(_n&65535),je=(Rt>>>16)+(_n>>>16)+(De>>>16),Ve=(Ze&65535)+(Xt&65535)+(je>>>16),Mt=(Ze>>>16)+(Xt>>>16)+(Ve>>>16),An=Mt<<16|Ve&65535,tn=je<<16|De&65535,qe=(An>>>28|tn<<4)^(tn>>>2|An<<30)^(tn>>>7|An<<25),Pe=(tn>>>28|An<<4)^(An>>>2|tn<<30)^(An>>>7|tn<<25),Ge=(ln>>>14|Bn<<18)^(ln>>>18|Bn<<14)^(Bn>>>9|ln<<23),Ce=(Bn>>>14|ln<<18)^(Bn>>>18|ln<<14)^(ln>>>9|Bn<<23),Ht=An&nn,vn=tn&Sn,En=Ht^An&Wt^jt,en=vn^tn&an^Dt,Qt=ln&un^~ln&rn,Ft=Bn&hn^~Bn&dn,Xt=Re[Ne+4],_n=Re[Ne+5],Ze=Se[Ne+4],Rt=Se[Ne+5],De=(Rt&65535)+(_n&65535)+(Ft&65535)+(Ce&65535)+(sn&65535),je=(Rt>>>16)+(_n>>>16)+(Ft>>>16)+(Ce>>>16)+(sn>>>16)+(De>>>16),Ve=(Ze&65535)+(Xt&65535)+(Qt&65535)+(Ge&65535)+(Mn&65535)+(je>>>16),Mt=(Ze>>>16)+(Xt>>>16)+(Qt>>>16)+(Ge>>>16)+(Mn>>>16)+(Ve>>>16),Xt=Mt<<16|Ve&65535,_n=je<<16|De&65535,De=(en&65535)+(Pe&65535),je=(en>>>16)+(Pe>>>16)+(De>>>16),Ve=(En&65535)+(qe&65535)+(je>>>16),Mt=(En>>>16)+(qe>>>16)+(Ve>>>16),Ze=Mt<<16|Ve&65535,Rt=je<<16|De&65535,De=(Jt&65535)+(_n&65535),je=(Jt>>>16)+(_n>>>16)+(De>>>16),Ve=(Zt&65535)+(Xt&65535)+(je>>>16),Mt=(Zt>>>16)+(Xt>>>16)+(Ve>>>16),Mn=Mt<<16|Ve&65535,sn=je<<16|De&65535,De=(Rt&65535)+(_n&65535),je=(Rt>>>16)+(_n>>>16)+(De>>>16),Ve=(Ze&65535)+(Xt&65535)+(je>>>16),Mt=(Ze>>>16)+(Xt>>>16)+(Ve>>>16),Zt=Mt<<16|Ve&65535,Jt=je<<16|De&65535,qe=(Zt>>>28|Jt<<4)^(Jt>>>2|Zt<<30)^(Jt>>>7|Zt<<25),Pe=(Jt>>>28|Zt<<4)^(Zt>>>2|Jt<<30)^(Zt>>>7|Jt<<25),Ge=(Mn>>>14|sn<<18)^(Mn>>>18|sn<<14)^(sn>>>9|Mn<<23),Ce=(sn>>>14|Mn<<18)^(sn>>>18|Mn<<14)^(Mn>>>9|sn<<23),Vt=Zt&An,Kt=Jt&tn,En=Vt^Zt&nn^Ht,en=Kt^Jt&Sn^vn,Qt=Mn&ln^~Mn&un,Ft=sn&Bn^~sn&hn,Xt=Re[Ne+6],_n=Re[Ne+7],Ze=Se[Ne+6],Rt=Se[Ne+7],De=(Rt&65535)+(_n&65535)+(Ft&65535)+(Ce&65535)+(dn&65535),je=(Rt>>>16)+(_n>>>16)+(Ft>>>16)+(Ce>>>16)+(dn>>>16)+(De>>>16),Ve=(Ze&65535)+(Xt&65535)+(Qt&65535)+(Ge&65535)+(rn&65535)+(je>>>16),Mt=(Ze>>>16)+(Xt>>>16)+(Qt>>>16)+(Ge>>>16)+(rn>>>16)+(Ve>>>16),Xt=Mt<<16|Ve&65535,_n=je<<16|De&65535,De=(en&65535)+(Pe&65535),je=(en>>>16)+(Pe>>>16)+(De>>>16),Ve=(En&65535)+(qe&65535)+(je>>>16),Mt=(En>>>16)+(qe>>>16)+(Ve>>>16),Ze=Mt<<16|Ve&65535,Rt=je<<16|De&65535,De=(an&65535)+(_n&65535),je=(an>>>16)+(_n>>>16)+(De>>>16),Ve=(Wt&65535)+(Xt&65535)+(je>>>16),Mt=(Wt>>>16)+(Xt>>>16)+(Ve>>>16),rn=Mt<<16|Ve&65535,dn=je<<16|De&65535,De=(Rt&65535)+(_n&65535),je=(Rt>>>16)+(_n>>>16)+(De>>>16),Ve=(Ze&65535)+(Xt&65535)+(je>>>16),Mt=(Ze>>>16)+(Xt>>>16)+(Ve>>>16),Wt=Mt<<16|Ve&65535,an=je<<16|De&65535;De=(Je&65535)+(an&65535),je=(Je>>>16)+(an>>>16)+(De>>>16),Ve=(ze&65535)+(Wt&65535)+(je>>>16),Mt=(ze>>>16)+(Wt>>>16)+(Ve>>>16),this.h0h=Mt<<16|Ve&65535,this.h0l=je<<16|De&65535,De=(Ue&65535)+(Jt&65535),je=(Ue>>>16)+(Jt>>>16)+(De>>>16),Ve=(Xe&65535)+(Zt&65535)+(je>>>16),Mt=(Xe>>>16)+(Zt>>>16)+(Ve>>>16),this.h1h=Mt<<16|Ve&65535,this.h1l=je<<16|De&65535,De=(_e&65535)+(tn&65535),je=(_e>>>16)+(tn>>>16)+(De>>>16),Ve=($t&65535)+(An&65535)+(je>>>16),Mt=($t>>>16)+(An>>>16)+(Ve>>>16),this.h2h=Mt<<16|Ve&65535,this.h2l=je<<16|De&65535,De=(ce&65535)+(Sn&65535),je=(ce>>>16)+(Sn>>>16)+(De>>>16),Ve=(se&65535)+(nn&65535)+(je>>>16),Mt=(se>>>16)+(nn>>>16)+(Ve>>>16),this.h3h=Mt<<16|Ve&65535,this.h3l=je<<16|De&65535,De=(he&65535)+(dn&65535),je=(he>>>16)+(dn>>>16)+(De>>>16),Ve=(de&65535)+(rn&65535)+(je>>>16),Mt=(de>>>16)+(rn>>>16)+(Ve>>>16),this.h4h=Mt<<16|Ve&65535,this.h4l=je<<16|De&65535,De=(we&65535)+(sn&65535),je=(we>>>16)+(sn>>>16)+(De>>>16),Ve=(ve&65535)+(Mn&65535)+(je>>>16),Mt=(ve>>>16)+(Mn>>>16)+(Ve>>>16),this.h5h=Mt<<16|Ve&65535,this.h5l=je<<16|De&65535,De=(be&65535)+(Bn&65535),je=(be>>>16)+(Bn>>>16)+(De>>>16),Ve=(Ae&65535)+(ln&65535)+(je>>>16),Mt=(Ae>>>16)+(ln>>>16)+(Ve>>>16),this.h6h=Mt<<16|Ve&65535,this.h6l=je<<16|De&65535,De=(ge&65535)+(hn&65535),je=(ge>>>16)+(hn>>>16)+(De>>>16),Ve=(ue&65535)+(un&65535)+(je>>>16),Mt=(ue>>>16)+(un>>>16)+(Ve>>>16),this.h7h=Mt<<16|Ve&65535,this.h7l=je<<16|De&65535},Fe.prototype.hex=function(){this.finalize();var ze=this.h0h,Je=this.h0l,Xe=this.h1h,Ue=this.h1l,$t=this.h2h,_e=this.h2l,se=this.h3h,ce=this.h3l,de=this.h4h,he=this.h4l,ve=this.h5h,we=this.h5l,Ae=this.h6h,be=this.h6l,ue=this.h7h,ge=this.h7l,Re=this.bits,Ne=ye[ze>>28&15]+ye[ze>>24&15]+ye[ze>>20&15]+ye[ze>>16&15]+ye[ze>>12&15]+ye[ze>>8&15]+ye[ze>>4&15]+ye[ze&15]+ye[Je>>28&15]+ye[Je>>24&15]+ye[Je>>20&15]+ye[Je>>16&15]+ye[Je>>12&15]+ye[Je>>8&15]+ye[Je>>4&15]+ye[Je&15]+ye[Xe>>28&15]+ye[Xe>>24&15]+ye[Xe>>20&15]+ye[Xe>>16&15]+ye[Xe>>12&15]+ye[Xe>>8&15]+ye[Xe>>4&15]+ye[Xe&15]+ye[Ue>>28&15]+ye[Ue>>24&15]+ye[Ue>>20&15]+ye[Ue>>16&15]+ye[Ue>>12&15]+ye[Ue>>8&15]+ye[Ue>>4&15]+ye[Ue&15]+ye[$t>>28&15]+ye[$t>>24&15]+ye[$t>>20&15]+ye[$t>>16&15]+ye[$t>>12&15]+ye[$t>>8&15]+ye[$t>>4&15]+ye[$t&15]+ye[_e>>28&15]+ye[_e>>24&15]+ye[_e>>20&15]+ye[_e>>16&15]+ye[_e>>12&15]+ye[_e>>8&15]+ye[_e>>4&15]+ye[_e&15]+ye[se>>28&15]+ye[se>>24&15]+ye[se>>20&15]+ye[se>>16&15]+ye[se>>12&15]+ye[se>>8&15]+ye[se>>4&15]+ye[se&15];return Re>=256&&(Ne+=ye[ce>>28&15]+ye[ce>>24&15]+ye[ce>>20&15]+ye[ce>>16&15]+ye[ce>>12&15]+ye[ce>>8&15]+ye[ce>>4&15]+ye[ce&15]),Re>=384&&(Ne+=ye[de>>28&15]+ye[de>>24&15]+ye[de>>20&15]+ye[de>>16&15]+ye[de>>12&15]+ye[de>>8&15]+ye[de>>4&15]+ye[de&15]+ye[he>>28&15]+ye[he>>24&15]+ye[he>>20&15]+ye[he>>16&15]+ye[he>>12&15]+ye[he>>8&15]+ye[he>>4&15]+ye[he&15]+ye[ve>>28&15]+ye[ve>>24&15]+ye[ve>>20&15]+ye[ve>>16&15]+ye[ve>>12&15]+ye[ve>>8&15]+ye[ve>>4&15]+ye[ve&15]+ye[we>>28&15]+ye[we>>24&15]+ye[we>>20&15]+ye[we>>16&15]+ye[we>>12&15]+ye[we>>8&15]+ye[we>>4&15]+ye[we&15]),Re==512&&(Ne+=ye[Ae>>28&15]+ye[Ae>>24&15]+ye[Ae>>20&15]+ye[Ae>>16&15]+ye[Ae>>12&15]+ye[Ae>>8&15]+ye[Ae>>4&15]+ye[Ae&15]+ye[be>>28&15]+ye[be>>24&15]+ye[be>>20&15]+ye[be>>16&15]+ye[be>>12&15]+ye[be>>8&15]+ye[be>>4&15]+ye[be&15]+ye[ue>>28&15]+ye[ue>>24&15]+ye[ue>>20&15]+ye[ue>>16&15]+ye[ue>>12&15]+ye[ue>>8&15]+ye[ue>>4&15]+ye[ue&15]+ye[ge>>28&15]+ye[ge>>24&15]+ye[ge>>20&15]+ye[ge>>16&15]+ye[ge>>12&15]+ye[ge>>8&15]+ye[ge>>4&15]+ye[ge&15]),Ne},Fe.prototype.toString=Fe.prototype.hex,Fe.prototype.digest=function(){this.finalize();var ze=this.h0h,Je=this.h0l,Xe=this.h1h,Ue=this.h1l,$t=this.h2h,_e=this.h2l,se=this.h3h,ce=this.h3l,de=this.h4h,he=this.h4l,ve=this.h5h,we=this.h5l,Ae=this.h6h,be=this.h6l,ue=this.h7h,ge=this.h7l,Re=this.bits,Ne=[ze>>24&255,ze>>16&255,ze>>8&255,ze&255,Je>>24&255,Je>>16&255,Je>>8&255,Je&255,Xe>>24&255,Xe>>16&255,Xe>>8&255,Xe&255,Ue>>24&255,Ue>>16&255,Ue>>8&255,Ue&255,$t>>24&255,$t>>16&255,$t>>8&255,$t&255,_e>>24&255,_e>>16&255,_e>>8&255,_e&255,se>>24&255,se>>16&255,se>>8&255,se&255];return Re>=256&&Ne.push(ce>>24&255,ce>>16&255,ce>>8&255,ce&255),Re>=384&&Ne.push(de>>24&255,de>>16&255,de>>8&255,de&255,he>>24&255,he>>16&255,he>>8&255,he&255,ve>>24&255,ve>>16&255,ve>>8&255,ve&255,we>>24&255,we>>16&255,we>>8&255,we&255),Re==512&&Ne.push(Ae>>24&255,Ae>>16&255,Ae>>8&255,Ae&255,be>>24&255,be>>16&255,be>>8&255,be&255,ue>>24&255,ue>>16&255,ue>>8&255,ue&255,ge>>24&255,ge>>16&255,ge>>8&255,ge&255),Ne},Fe.prototype.array=Fe.prototype.digest,Fe.prototype.arrayBuffer=function(){this.finalize();var ze=this.bits,Je=new ArrayBuffer(ze/8),Xe=new DataView(Je);return Xe.setUint32(0,this.h0h),Xe.setUint32(4,this.h0l),Xe.setUint32(8,this.h1h),Xe.setUint32(12,this.h1l),Xe.setUint32(16,this.h2h),Xe.setUint32(20,this.h2l),Xe.setUint32(24,this.h3h),ze>=256&&Xe.setUint32(28,this.h3l),ze>=384&&(Xe.setUint32(32,this.h4h),Xe.setUint32(36,this.h4l),Xe.setUint32(40,this.h5h),Xe.setUint32(44,this.h5l)),ze==512&&(Xe.setUint32(48,this.h6h),Xe.setUint32(52,this.h6l),Xe.setUint32(56,this.h7h),Xe.setUint32(60,this.h7l)),Je},Fe.prototype.clone=function(){var ze=new Fe(this.bits,!1);return this.copyTo(ze),ze},Fe.prototype.copyTo=function(ze){var Je=0,Xe=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(Je=0;Je<Xe.length;++Je)ze[Xe[Je]]=this[Xe[Je]];for(Je=0;Je<this.blocks.length;++Je)ze.blocks[Je]=this.blocks[Je]};function Le(ze,Je,Xe){var Ue,$t=typeof ze;if($t!=="string"){if($t==="object"){if(ze===null)throw new Error(t);if(me&&ze.constructor===ArrayBuffer)ze=new Uint8Array(ze);else if(!Array.isArray(ze)&&(!me||!ArrayBuffer.isView(ze)))throw new Error(t)}else throw new Error(t);Ue=!0}var _e=ze.length;if(!Ue){for(var se=[],_e=ze.length,ce=0,de,he=0;he<_e;++he)de=ze.charCodeAt(he),de<128?se[ce++]=de:de<2048?(se[ce++]=192|de>>6,se[ce++]=128|de&63):de<55296||de>=57344?(se[ce++]=224|de>>12,se[ce++]=128|de>>6&63,se[ce++]=128|de&63):(de=65536+((de&1023)<<10|ze.charCodeAt(++he)&1023),se[ce++]=240|de>>18,se[ce++]=128|de>>12&63,se[ce++]=128|de>>6&63,se[ce++]=128|de&63);ze=se}ze.length>128&&(ze=new Fe(Je,!0).update(ze).array());for(var ve=[],we=[],he=0;he<128;++he){var Ae=ze[he]||0;ve[he]=92^Ae,we[he]=54^Ae}Fe.call(this,Je,Xe),this.update(we),this.oKeyPad=ve,this.inner=!0,this.sharedMemory=Xe}Le.prototype=new Fe,Le.prototype.finalize=function(){if(Fe.prototype.finalize.call(this),this.inner){this.inner=!1;var ze=this.array();Fe.call(this,this.bits,this.sharedMemory),this.update(this.oKeyPad),this.update(ze),Fe.prototype.finalize.call(this)}},Le.prototype.clone=function(){var ze=new Le([],this.bits,!1);this.copyTo(ze),ze.inner=this.inner;for(var Je=0;Je<this.oKeyPad.length;++Je)ze.oKeyPad[Je]=this.oKeyPad[Je];return ze};var He=ke(512);He.sha512=He,He.sha384=ke(384),He.sha512_256=ke(256),He.sha512_224=ke(224),He.sha512.hmac=Ie(512),He.sha384.hmac=Ie(384),He.sha512_256.hmac=Ie(256),He.sha512_224.hmac=Ie(224),pe?c.exports=He:(fe.sha512=He.sha512,fe.sha384=He.sha384,fe.sha512_256=He.sha512_256,fe.sha512_224=He.sha512_224)})()})(sha512$2);var sha512Exports=sha512$2.exports;const alphabet="13456789abcdefghijkmnopqrstuwxyz";function encode(c){if(c.constructor!==Uint8Array)throw new Error("View must be a Uint8Array!");const t=c.length,n=t*8%5,ie=n===0?0:5-n;let fe=0,ae="",le=0;for(var pe=0;pe<t;pe++)for(fe=fe<<8|c[pe],le+=8;le>=5;)ae+=alphabet[fe>>>le+ie-5&31],le-=5;return le>0&&(ae+=alphabet[fe<<5-(le+ie)&31]),ae}function readChar(c){var t=alphabet.indexOf(c);if(t===-1)throw new Error("Invalid character found: "+c);return t}function decode$1(c){if(typeof c!="string")throw new Error("Input must be a string!");var t=c.length;const n=t*5%8,ie=n===0?0:8-n;for(var fe=0,ae=0,le=0,pe=new Uint8Array(Math.ceil(t*5/8)),me=0;me<t;me++)ae=ae<<5|readChar(c[me]),fe+=5,fe>=8&&(pe[le++]=ae>>>fe+ie-8&255,fe-=8);return fe>0&&(pe[le++]=ae<<fe+ie-8&255),n!==0&&(pe=pe.slice(1)),pe}var nanoBase32={encode,decode:decode$1},sha256$3={exports:{}};(function(module){(function(){var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process$1=="object"&&process$1.versions&&process$1.versions.node;NODE_JS?root=globalThis:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&!0&&module.exports,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(c){return Object.prototype.toString.call(c)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(c){return typeof c=="object"&&c.buffer&&c.buffer.constructor===ArrayBuffer});var createOutputMethod=function(c,t){return function(n){return new Sha256(t,!0).update(n)[c]()}},createMethod=function(c){var t=createOutputMethod("hex",c);NODE_JS&&(t=nodeWrap(t,c)),t.create=function(){return new Sha256(c)},t.update=function(fe){return t.create().update(fe)};for(var n=0;n<OUTPUT_TYPES.length;++n){var ie=OUTPUT_TYPES[n];t[ie]=createOutputMethod(ie,c)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(c){if(typeof c=="string")return crypto.createHash(algorithm).update(c,"utf8").digest("hex");if(c==null)throw new Error(ERROR);return c.constructor===ArrayBuffer&&(c=new Uint8Array(c)),Array.isArray(c)||ArrayBuffer.isView(c)||c.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(c)).digest("hex"):method(c)};return nodeMethod},createHmacOutputMethod=function(c,t){return function(n,ie){return new HmacSha256(n,t,!0).update(ie)[c]()}},createHmacMethod=function(c){var t=createHmacOutputMethod("hex",c);t.create=function(fe){return new HmacSha256(fe,c)},t.update=function(fe,ae){return t.create(fe).update(ae)};for(var n=0;n<OUTPUT_TYPES.length;++n){var ie=OUTPUT_TYPES[n];t[ie]=createHmacOutputMethod(ie,c)}return t};function Sha256(c,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=c}Sha256.prototype.update=function(c){if(!this.finalized){var t,n=typeof c;if(n!=="string"){if(n==="object"){if(c===null)throw new Error(ERROR);if(ARRAY_BUFFER&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(c)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var ie,fe=0,ae,le=c.length,pe=this.blocks;fe<le;){if(this.hashed&&(this.hashed=!1,pe[0]=this.block,pe[16]=pe[1]=pe[2]=pe[3]=pe[4]=pe[5]=pe[6]=pe[7]=pe[8]=pe[9]=pe[10]=pe[11]=pe[12]=pe[13]=pe[14]=pe[15]=0),t)for(ae=this.start;fe<le&&ae<64;++fe)pe[ae>>2]|=c[fe]<<SHIFT[ae++&3];else for(ae=this.start;fe<le&&ae<64;++fe)ie=c.charCodeAt(fe),ie<128?pe[ae>>2]|=ie<<SHIFT[ae++&3]:ie<2048?(pe[ae>>2]|=(192|ie>>6)<<SHIFT[ae++&3],pe[ae>>2]|=(128|ie&63)<<SHIFT[ae++&3]):ie<55296||ie>=57344?(pe[ae>>2]|=(224|ie>>12)<<SHIFT[ae++&3],pe[ae>>2]|=(128|ie>>6&63)<<SHIFT[ae++&3],pe[ae>>2]|=(128|ie&63)<<SHIFT[ae++&3]):(ie=65536+((ie&1023)<<10|c.charCodeAt(++fe)&1023),pe[ae>>2]|=(240|ie>>18)<<SHIFT[ae++&3],pe[ae>>2]|=(128|ie>>12&63)<<SHIFT[ae++&3],pe[ae>>2]|=(128|ie>>6&63)<<SHIFT[ae++&3],pe[ae>>2]|=(128|ie&63)<<SHIFT[ae++&3]);this.lastByteIndex=ae,this.bytes+=ae-this.start,ae>=64?(this.block=pe[16],this.start=ae-64,this.hash(),this.hashed=!0):this.start=ae}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var c=this.blocks,t=this.lastByteIndex;c[16]=this.block,c[t>>2]|=EXTRA[t&3],this.block=c[16],t>=56&&(this.hashed||this.hash(),c[0]=this.block,c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),c[14]=this.hBytes<<3|this.bytes>>>29,c[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var c=this.h0,t=this.h1,n=this.h2,ie=this.h3,fe=this.h4,ae=this.h5,le=this.h6,pe=this.h7,me=this.blocks,ye,xe,Ee,Se,Me,Be,$e,ke,Te,Ie,Fe;for(ye=16;ye<64;++ye)Me=me[ye-15],xe=(Me>>>7|Me<<25)^(Me>>>18|Me<<14)^Me>>>3,Me=me[ye-2],Ee=(Me>>>17|Me<<15)^(Me>>>19|Me<<13)^Me>>>10,me[ye]=me[ye-16]+xe+me[ye-7]+Ee<<0;for(Fe=t&n,ye=0;ye<64;ye+=4)this.first?(this.is224?(ke=300032,Me=me[0]-1413257819,pe=Me-150054599<<0,ie=Me+24177077<<0):(ke=704751109,Me=me[0]-210244248,pe=Me-1521486534<<0,ie=Me+143694565<<0),this.first=!1):(xe=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),Ee=(fe>>>6|fe<<26)^(fe>>>11|fe<<21)^(fe>>>25|fe<<7),ke=c&t,Se=ke^c&n^Fe,$e=fe&ae^~fe&le,Me=pe+Ee+$e+K[ye]+me[ye],Be=xe+Se,pe=ie+Me<<0,ie=Me+Be<<0),xe=(ie>>>2|ie<<30)^(ie>>>13|ie<<19)^(ie>>>22|ie<<10),Ee=(pe>>>6|pe<<26)^(pe>>>11|pe<<21)^(pe>>>25|pe<<7),Te=ie&c,Se=Te^ie&t^ke,$e=pe&fe^~pe&ae,Me=le+Ee+$e+K[ye+1]+me[ye+1],Be=xe+Se,le=n+Me<<0,n=Me+Be<<0,xe=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),Ee=(le>>>6|le<<26)^(le>>>11|le<<21)^(le>>>25|le<<7),Ie=n&ie,Se=Ie^n&c^Te,$e=le&pe^~le&fe,Me=ae+Ee+$e+K[ye+2]+me[ye+2],Be=xe+Se,ae=t+Me<<0,t=Me+Be<<0,xe=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),Ee=(ae>>>6|ae<<26)^(ae>>>11|ae<<21)^(ae>>>25|ae<<7),Fe=t&n,Se=Fe^t&ie^Ie,$e=ae&le^~ae&pe,Me=fe+Ee+$e+K[ye+3]+me[ye+3],Be=xe+Se,fe=c+Me<<0,c=Me+Be<<0;this.h0=this.h0+c<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+ie<<0,this.h4=this.h4+fe<<0,this.h5=this.h5+ae<<0,this.h6=this.h6+le<<0,this.h7=this.h7+pe<<0},Sha256.prototype.hex=function(){this.finalize();var c=this.h0,t=this.h1,n=this.h2,ie=this.h3,fe=this.h4,ae=this.h5,le=this.h6,pe=this.h7,me=HEX_CHARS[c>>28&15]+HEX_CHARS[c>>24&15]+HEX_CHARS[c>>20&15]+HEX_CHARS[c>>16&15]+HEX_CHARS[c>>12&15]+HEX_CHARS[c>>8&15]+HEX_CHARS[c>>4&15]+HEX_CHARS[c&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[ie>>28&15]+HEX_CHARS[ie>>24&15]+HEX_CHARS[ie>>20&15]+HEX_CHARS[ie>>16&15]+HEX_CHARS[ie>>12&15]+HEX_CHARS[ie>>8&15]+HEX_CHARS[ie>>4&15]+HEX_CHARS[ie&15]+HEX_CHARS[fe>>28&15]+HEX_CHARS[fe>>24&15]+HEX_CHARS[fe>>20&15]+HEX_CHARS[fe>>16&15]+HEX_CHARS[fe>>12&15]+HEX_CHARS[fe>>8&15]+HEX_CHARS[fe>>4&15]+HEX_CHARS[fe&15]+HEX_CHARS[ae>>28&15]+HEX_CHARS[ae>>24&15]+HEX_CHARS[ae>>20&15]+HEX_CHARS[ae>>16&15]+HEX_CHARS[ae>>12&15]+HEX_CHARS[ae>>8&15]+HEX_CHARS[ae>>4&15]+HEX_CHARS[ae&15]+HEX_CHARS[le>>28&15]+HEX_CHARS[le>>24&15]+HEX_CHARS[le>>20&15]+HEX_CHARS[le>>16&15]+HEX_CHARS[le>>12&15]+HEX_CHARS[le>>8&15]+HEX_CHARS[le>>4&15]+HEX_CHARS[le&15];return this.is224||(me+=HEX_CHARS[pe>>28&15]+HEX_CHARS[pe>>24&15]+HEX_CHARS[pe>>20&15]+HEX_CHARS[pe>>16&15]+HEX_CHARS[pe>>12&15]+HEX_CHARS[pe>>8&15]+HEX_CHARS[pe>>4&15]+HEX_CHARS[pe&15]),me},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var c=this.h0,t=this.h1,n=this.h2,ie=this.h3,fe=this.h4,ae=this.h5,le=this.h6,pe=this.h7,me=[c>>24&255,c>>16&255,c>>8&255,c&255,t>>24&255,t>>16&255,t>>8&255,t&255,n>>24&255,n>>16&255,n>>8&255,n&255,ie>>24&255,ie>>16&255,ie>>8&255,ie&255,fe>>24&255,fe>>16&255,fe>>8&255,fe&255,ae>>24&255,ae>>16&255,ae>>8&255,ae&255,le>>24&255,le>>16&255,le>>8&255,le&255];return this.is224||me.push(pe>>24&255,pe>>16&255,pe>>8&255,pe&255),me},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var c=new ArrayBuffer(this.is224?28:32),t=new DataView(c);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),c};function HmacSha256(c,t,n){var ie,fe=typeof c;if(fe==="string"){var ae=[],le=c.length,pe=0,me;for(ie=0;ie<le;++ie)me=c.charCodeAt(ie),me<128?ae[pe++]=me:me<2048?(ae[pe++]=192|me>>6,ae[pe++]=128|me&63):me<55296||me>=57344?(ae[pe++]=224|me>>12,ae[pe++]=128|me>>6&63,ae[pe++]=128|me&63):(me=65536+((me&1023)<<10|c.charCodeAt(++ie)&1023),ae[pe++]=240|me>>18,ae[pe++]=128|me>>12&63,ae[pe++]=128|me>>6&63,ae[pe++]=128|me&63);c=ae}else if(fe==="object"){if(c===null)throw new Error(ERROR);if(ARRAY_BUFFER&&c.constructor===ArrayBuffer)c=new Uint8Array(c);else if(!Array.isArray(c)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(c)))throw new Error(ERROR)}else throw new Error(ERROR);c.length>64&&(c=new Sha256(t,!0).update(c).array());var ye=[],xe=[];for(ie=0;ie<64;++ie){var Ee=c[ie]||0;ye[ie]=92^Ee,xe[ie]=54^Ee}Sha256.call(this,t,n),this.update(xe),this.oKeyPad=ye,this.inner=!0,this.sharedMemory=n}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var c=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(c),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224)})()})(sha256$3);var sha256Exports$1=sha256$3.exports;function N$1(c,t){(t==null||t>c.length)&&(t=c.length);for(var n=0,ie=new Array(t);n<t;n++)ie[n]=c[n];return ie}function q$1(c,t){var n=typeof Symbol<"u"&&c[Symbol.iterator]||c["@@iterator"];if(n)return(n=n.call(c)).next.bind(n);if(Array.isArray(c)||(n=function(fe,ae){if(fe){if(typeof fe=="string")return N$1(fe,void 0);var le=Object.prototype.toString.call(fe).slice(8,-1);return le==="Object"&&fe.constructor&&(le=fe.constructor.name),le==="Map"||le==="Set"?Array.from(fe):le==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(le)?N$1(fe,void 0):void 0}}(c))||t){n&&(c=n);var ie=0;return function(){return ie>=c.length?{done:!0}:{done:!1,value:c[ie++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
38
38
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var T$1,L$1=(function(c){var t=function(n){var ie=1e7,fe=9007199254740992,ae=Ee(fe),le=Math.log(fe);function pe(Oe,We){return Oe===void 0?pe[0]:We!==void 0?+We==10?Ve(Oe):qe(Oe,We):Ve(Oe)}function me(Oe,We){this.value=Oe,this.sign=We,this.isSmall=!1}function ye(Oe){this.value=Oe,this.sign=Oe<0,this.isSmall=!0}function xe(Oe){return-fe<Oe&&Oe<fe}function Ee(Oe){return Oe<1e7?[Oe]:Oe<1e14?[Oe%1e7,Math.floor(Oe/1e7)]:[Oe%1e7,Math.floor(Oe/1e7)%1e7,Math.floor(Oe/1e14)]}function Se(Oe){Me(Oe);var We=Oe.length;if(We<4&&se(Oe,ae)<0)switch(We){case 0:return 0;case 1:return Oe[0];case 2:return Oe[0]+Oe[1]*ie;default:return Oe[0]+(Oe[1]+Oe[2]*ie)*ie}return Oe}function Me(Oe){for(var We=Oe.length;Oe[--We]===0;);Oe.length=We+1}function Be(Oe){for(var We=new Array(Oe),jt=-1;++jt<Oe;)We[jt]=0;return We}function $e(Oe){return Oe>0?Math.floor(Oe):Math.ceil(Oe)}function ke(Oe,We){var jt,Dt,Ht=Oe.length,vn=We.length,Vt=new Array(Ht),Kt=0,En=ie;for(Dt=0;Dt<vn;Dt++)Vt[Dt]=(jt=Oe[Dt]+We[Dt]+Kt)-(Kt=jt>=En?1:0)*En;for(;Dt<Ht;)jt=Oe[Dt]+Kt,Vt[Dt++]=jt-(Kt=jt===En?1:0)*En;return Kt>0&&Vt.push(Kt),Vt}function Te(Oe,We){return Oe.length>=We.length?ke(Oe,We):ke(We,Oe)}function Ie(Oe,We){var jt,Dt,Ht=Oe.length,vn=new Array(Ht),Vt=ie;for(Dt=0;Dt<Ht;Dt++)jt=Oe[Dt]-Vt+We,We=Math.floor(jt/Vt),vn[Dt]=jt-We*Vt,We+=1;for(;We>0;)vn[Dt++]=We%Vt,We=Math.floor(We/Vt);return vn}function Fe(Oe,We){var jt,Dt,Ht=Oe.length,vn=We.length,Vt=new Array(Ht),Kt=0;for(jt=0;jt<vn;jt++)(Dt=Oe[jt]-Kt-We[jt])<0?(Dt+=1e7,Kt=1):Kt=0,Vt[jt]=Dt;for(jt=vn;jt<Ht;jt++){if(!((Dt=Oe[jt]-Kt)<0)){Vt[jt++]=Dt;break}Vt[jt]=Dt+=1e7}for(;jt<Ht;jt++)Vt[jt]=Oe[jt];return Me(Vt),Vt}function Le(Oe,We,jt){var Dt,Ht,vn=Oe.length,Vt=new Array(vn),Kt=-We;for(Dt=0;Dt<vn;Dt++)Ht=Oe[Dt]+Kt,Kt=Math.floor(Ht/1e7),Vt[Dt]=(Ht%=1e7)<0?Ht+1e7:Ht;return typeof(Vt=Se(Vt))=="number"?(jt&&(Vt=-Vt),new ye(Vt)):new me(Vt,jt)}function He(Oe,We){var jt,Dt,Ht,vn,Vt=Oe.length,Kt=We.length,En=Be(Vt+Kt);for(Ht=0;Ht<Vt;++Ht){vn=Oe[Ht];for(var en=0;en<Kt;++en)jt=vn*We[en]+En[Ht+en],Dt=Math.floor(jt/1e7),En[Ht+en]=jt-1e7*Dt,En[Ht+en+1]+=Dt}return Me(En),En}function ze(Oe,We){var jt,Dt,Ht=Oe.length,vn=new Array(Ht),Vt=ie,Kt=0;for(Dt=0;Dt<Ht;Dt++)jt=Oe[Dt]*We+Kt,Kt=Math.floor(jt/Vt),vn[Dt]=jt-Kt*Vt;for(;Kt>0;)vn[Dt++]=Kt%Vt,Kt=Math.floor(Kt/Vt);return vn}function Je(Oe,We){for(var jt=[];We-- >0;)jt.push(0);return jt.concat(Oe)}function Xe(Oe,We,jt){return new me(Oe<ie?ze(We,Oe):He(We,Ee(Oe)),jt)}function Ue(Oe){var We,jt,Dt,Ht,vn=Oe.length,Vt=Be(vn+vn);for(Dt=0;Dt<vn;Dt++){jt=0-(Ht=Oe[Dt])*Ht;for(var Kt=Dt;Kt<vn;Kt++)We=Ht*Oe[Kt]*2+Vt[Dt+Kt]+jt,jt=Math.floor(We/1e7),Vt[Dt+Kt]=We-1e7*jt;Vt[Dt+vn]=jt}return Me(Vt),Vt}function $t(Oe,We){var jt,Dt,Ht,vn,Vt=Oe.length,Kt=Be(Vt);for(Ht=0,jt=Vt-1;jt>=0;--jt)Ht=(vn=1e7*Ht+Oe[jt])-(Dt=$e(vn/We))*We,Kt[jt]=0|Dt;return[Kt,0|Ht]}function _e(Oe,We){var jt,Dt,Ht=Ve(We),vn=Oe.value,Vt=Ht.value;if(Vt===0)throw new Error("Cannot divide by zero");if(Oe.isSmall)return Ht.isSmall?[new ye($e(vn/Vt)),new ye(vn%Vt)]:[pe[0],Oe];if(Ht.isSmall){if(Vt===1)return[Oe,pe[0]];if(Vt==-1)return[Oe.negate(),pe[0]];var Kt=Math.abs(Vt);if(Kt<ie){Dt=Se((jt=$t(vn,Kt))[0]);var En=jt[1];return Oe.sign&&(En=-En),typeof Dt=="number"?(Oe.sign!==Ht.sign&&(Dt=-Dt),[new ye(Dt),new ye(En)]):[new me(Dt,Oe.sign!==Ht.sign),new ye(En)]}Vt=Ee(Kt)}var en=se(vn,Vt);if(en===-1)return[pe[0],Oe];if(en===0)return[pe[Oe.sign===Ht.sign?1:-1],pe[0]];jt=vn.length+Vt.length<=200?function(Rt,Qt){var Ft,Wt,an,Zt,Jt,An,tn,nn=Rt.length,Sn=Qt.length,rn=ie,dn=Be(Qt.length),Mn=Qt[Sn-1],sn=Math.ceil(rn/(2*Mn)),ln=ze(Rt,sn),Bn=ze(Qt,sn);for(ln.length<=nn&&ln.push(0),Bn.push(0),Mn=Bn[Sn-1],Wt=nn-Sn;Wt>=0;Wt--){for(Ft=rn-1,ln[Wt+Sn]!==Mn&&(Ft=Math.floor((ln[Wt+Sn]*rn+ln[Wt+Sn-1])/Mn)),an=0,Zt=0,An=Bn.length,Jt=0;Jt<An;Jt++)an+=Ft*Bn[Jt],tn=Math.floor(an/rn),Zt+=ln[Wt+Jt]-(an-tn*rn),an=tn,Zt<0?(ln[Wt+Jt]=Zt+rn,Zt=-1):(ln[Wt+Jt]=Zt,Zt=0);for(;Zt!==0;){for(Ft-=1,an=0,Jt=0;Jt<An;Jt++)(an+=ln[Wt+Jt]-rn+Bn[Jt])<0?(ln[Wt+Jt]=an+rn,an=0):(ln[Wt+Jt]=an,an=1);Zt+=an}dn[Wt]=Ft}return ln=$t(ln,sn)[0],[Se(dn),Se(ln)]}(vn,Vt):function(Rt,Qt){for(var Ft,Wt,an,Zt,Jt=Rt.length,An=Qt.length,tn=[],nn=[];Jt;)if(nn.unshift(Rt[--Jt]),Me(nn),se(nn,Qt)<0)tn.push(0);else{an=1e7*nn[(Wt=nn.length)-1]+nn[Wt-2],Wt>An&&(an=1e7*(an+1)),Ft=Math.ceil(an/(1e7*Qt[An-1]+Qt[An-2]));do{if(se(Zt=ze(Qt,Ft),nn)<=0)break;Ft--}while(Ft);tn.push(Ft),nn=Fe(nn,Zt)}return tn.reverse(),[Se(tn),Se(nn)]}(vn,Vt);var Xt=Oe.sign!==Ht.sign,_n=jt[1],Ze=Oe.sign;return typeof(Dt=jt[0])=="number"?(Xt&&(Dt=-Dt),Dt=new ye(Dt)):Dt=new me(Dt,Xt),typeof _n=="number"?(Ze&&(_n=-_n),_n=new ye(_n)):_n=new me(_n,Ze),[Dt,_n]}function se(Oe,We){if(Oe.length!==We.length)return Oe.length>We.length?1:-1;for(var jt=Oe.length-1;jt>=0;jt--)if(Oe[jt]!==We[jt])return Oe[jt]>We[jt]?1:-1;return 0}function ce(Oe){var We=Oe.abs();return!We.isUnit()&&(!!(We.equals(2)||We.equals(3)||We.equals(5))||!(We.isEven()||We.isDivisibleBy(3)||We.isDivisibleBy(5))&&(!!We.lesser(49)||void 0))}function de(Oe,We){for(var jt,Dt,Ht,vn=Oe.prev(),Vt=vn,Kt=0;Vt.isEven();)Vt=Vt.divide(2),Kt++;e:for(Dt=0;Dt<We.length;Dt++)if(!Oe.lesser(We[Dt])&&!(Ht=t(We[Dt]).modPow(Vt,Oe)).equals(pe[1])&&!Ht.equals(vn)){for(jt=Kt-1;jt!=0;jt--){if((Ht=Ht.square().mod(Oe)).isUnit())return!1;if(Ht.equals(vn))continue e}return!1}return!0}me.prototype=Object.create(pe.prototype),ye.prototype=Object.create(pe.prototype),me.prototype.add=function(Oe){var We=Ve(Oe);if(this.sign!==We.sign)return this.subtract(We.negate());var jt=this.value,Dt=We.value;return new me(We.isSmall?Ie(jt,Math.abs(Dt)):Te(jt,Dt),this.sign)},me.prototype.plus=me.prototype.add,ye.prototype.add=function(Oe){var We=Ve(Oe),jt=this.value;if(jt<0!==We.sign)return this.subtract(We.negate());var Dt=We.value;if(We.isSmall){if(xe(jt+Dt))return new ye(jt+Dt);Dt=Ee(Math.abs(Dt))}return new me(Ie(Dt,Math.abs(jt)),jt<0)},ye.prototype.plus=ye.prototype.add,me.prototype.subtract=function(Oe){var We=Ve(Oe);if(this.sign!==We.sign)return this.add(We.negate());var jt=this.value,Dt=We.value;return We.isSmall?Le(jt,Math.abs(Dt),this.sign):function(Ht,vn,Vt){var Kt;return se(Ht,vn)>=0?Kt=Fe(Ht,vn):(Kt=Fe(vn,Ht),Vt=!Vt),typeof(Kt=Se(Kt))=="number"?(Vt&&(Kt=-Kt),new ye(Kt)):new me(Kt,Vt)}(jt,Dt,this.sign)},me.prototype.minus=me.prototype.subtract,ye.prototype.subtract=function(Oe){var We=Ve(Oe),jt=this.value;if(jt<0!==We.sign)return this.add(We.negate());var Dt=We.value;return We.isSmall?new ye(jt-Dt):Le(Dt,Math.abs(jt),jt>=0)},ye.prototype.minus=ye.prototype.subtract,me.prototype.negate=function(){return new me(this.value,!this.sign)},ye.prototype.negate=function(){var Oe=this.sign,We=new ye(-this.value);return We.sign=!Oe,We},me.prototype.abs=function(){return new me(this.value,!1)},ye.prototype.abs=function(){return new ye(Math.abs(this.value))},me.prototype.multiply=function(Oe){var We,jt,Dt,Ht=Ve(Oe),vn=this.value,Vt=Ht.value,Kt=this.sign!==Ht.sign;if(Ht.isSmall){if(Vt===0)return pe[0];if(Vt===1)return this;if(Vt===-1)return this.negate();if((We=Math.abs(Vt))<ie)return new me(ze(vn,We),Kt);Vt=Ee(We)}return-.012*(jt=vn.length)-.012*(Dt=Vt.length)+15e-6*jt*Dt>0?new me(function En(en,Xt){var _n=Math.max(en.length,Xt.length);if(_n<=30)return He(en,Xt);_n=Math.ceil(_n/2);var Ze=en.slice(_n),Rt=en.slice(0,_n),Qt=Xt.slice(_n),Ft=Xt.slice(0,_n),Wt=En(Rt,Ft),an=En(Ze,Qt),Zt=En(Te(Rt,Ze),Te(Ft,Qt)),Jt=Te(Te(Wt,Je(Fe(Fe(Zt,Wt),an),_n)),Je(an,2*_n));return Me(Jt),Jt}(vn,Vt),Kt):new me(He(vn,Vt),Kt)},me.prototype.times=me.prototype.multiply,ye.prototype._multiplyBySmall=function(Oe){return xe(Oe.value*this.value)?new ye(Oe.value*this.value):Xe(Math.abs(Oe.value),Ee(Math.abs(this.value)),this.sign!==Oe.sign)},me.prototype._multiplyBySmall=function(Oe){return Oe.value===0?pe[0]:Oe.value===1?this:Oe.value===-1?this.negate():Xe(Math.abs(Oe.value),this.value,this.sign!==Oe.sign)},ye.prototype.times=ye.prototype.multiply=function(Oe){return Ve(Oe)._multiplyBySmall(this)},me.prototype.square=function(){return new me(Ue(this.value),!1)},ye.prototype.square=function(){var Oe=this.value*this.value;return xe(Oe)?new ye(Oe):new me(Ue(Ee(Math.abs(this.value))),!1)},ye.prototype.divmod=me.prototype.divmod=function(Oe){var We=_e(this,Oe);return{quotient:We[0],remainder:We[1]}},ye.prototype.over=ye.prototype.divide=me.prototype.over=me.prototype.divide=function(Oe){return _e(this,Oe)[0]},ye.prototype.remainder=ye.prototype.mod=me.prototype.remainder=me.prototype.mod=function(Oe){return _e(this,Oe)[1]},me.prototype.pow=function(Oe){var We,jt,Dt,Ht=Ve(Oe),vn=this.value,Vt=Ht.value;if(Vt===0)return pe[1];if(vn===0)return pe[0];if(vn===1)return pe[1];if(vn===-1)return Ht.isEven()?pe[1]:pe[-1];if(Ht.sign)return pe[0];if(!Ht.isSmall)throw new Error("The exponent "+Ht.toString()+" is too large.");if(this.isSmall&&xe(We=Math.pow(vn,Vt)))return new ye($e(We));for(jt=this,Dt=pe[1];!0&Vt&&(Dt=Dt.times(jt),--Vt),Vt!==0;)Vt/=2,jt=jt.square();return Dt},ye.prototype.pow=me.prototype.pow,ye.prototype.modPow=me.prototype.modPow=function(Oe,We){if(Oe=Ve(Oe),(We=Ve(We)).isZero())throw new Error("Cannot take modPow with modulus 0");for(var jt=pe[1],Dt=this.mod(We);Oe.isPositive();){if(Dt.isZero())return pe[0];Oe.isOdd()&&(jt=jt.multiply(Dt).mod(We)),Oe=Oe.divide(2),Dt=Dt.square().mod(We)}return jt},me.prototype.compareAbs=function(Oe){var We=Ve(Oe);return We.isSmall?1:se(this.value,We.value)},ye.prototype.compareAbs=function(Oe){var We=Ve(Oe),jt=Math.abs(this.value),Dt=We.value;return We.isSmall?jt===(Dt=Math.abs(Dt))?0:jt>Dt?1:-1:-1},me.prototype.compareTo=me.prototype.compare=function(Oe){if(Oe===1/0)return-1;if(Oe===-1/0)return 1;var We=Ve(Oe);return this.sign!==We.sign?We.sign?1:-1:We.isSmall?this.sign?-1:1:se(this.value,We.value)*(this.sign?-1:1)},ye.prototype.compareTo=ye.prototype.compare=function(Oe){if(Oe===1/0)return-1;if(Oe===-1/0)return 1;var We=Ve(Oe),jt=this.value,Dt=We.value;return We.isSmall?jt==Dt?0:jt>Dt?1:-1:jt<0!==We.sign?jt<0?-1:1:jt<0?1:-1},ye.prototype.eq=ye.prototype.equals=me.prototype.eq=me.prototype.equals=function(Oe){return this.compare(Oe)===0},ye.prototype.neq=ye.prototype.notEquals=me.prototype.neq=me.prototype.notEquals=function(Oe){return this.compare(Oe)!==0},ye.prototype.gt=ye.prototype.greater=me.prototype.gt=me.prototype.greater=function(Oe){return this.compare(Oe)>0},ye.prototype.lt=ye.prototype.lesser=me.prototype.lt=me.prototype.lesser=function(Oe){return this.compare(Oe)<0},ye.prototype.geq=ye.prototype.greaterOrEquals=me.prototype.geq=me.prototype.greaterOrEquals=function(Oe){return this.compare(Oe)>=0},ye.prototype.leq=ye.prototype.lesserOrEquals=me.prototype.leq=me.prototype.lesserOrEquals=function(Oe){return this.compare(Oe)<=0},me.prototype.isEven=function(){return(1&this.value[0])==0},ye.prototype.isEven=function(){return(1&this.value)==0},me.prototype.isOdd=function(){return(1&this.value[0])==1},ye.prototype.isOdd=function(){return(1&this.value)==1},me.prototype.isPositive=function(){return!this.sign},ye.prototype.isPositive=function(){return this.value>0},me.prototype.isNegative=function(){return this.sign},ye.prototype.isNegative=function(){return this.value<0},me.prototype.isUnit=function(){return!1},ye.prototype.isUnit=function(){return Math.abs(this.value)===1},me.prototype.isZero=function(){return!1},ye.prototype.isZero=function(){return this.value===0},ye.prototype.isDivisibleBy=me.prototype.isDivisibleBy=function(Oe){var We=Ve(Oe),jt=We.value;return jt!==0&&(jt===1||(jt===2?this.isEven():this.mod(We).equals(pe[0])))},ye.prototype.isPrime=me.prototype.isPrime=function(Oe){var We=ce(this);if(We!==void 0)return We;var jt=this.abs(),Dt=jt.bitLength();if(Dt<=64)return de(jt,[2,325,9375,28178,450775,9780504,1795265022]);for(var Ht=Math.log(2)*Dt,vn=Math.ceil(Oe===!0?2*Math.pow(Ht,2):Ht),Vt=[],Kt=0;Kt<vn;Kt++)Vt.push(t(Kt+2));return de(jt,Vt)},ye.prototype.isProbablePrime=me.prototype.isProbablePrime=function(Oe){var We=ce(this);if(We!==void 0)return We;for(var jt=this.abs(),Dt=Oe===void 0?5:Oe,Ht=[],vn=0;vn<Dt;vn++)Ht.push(t.randBetween(2,jt.minus(2)));return de(jt,Ht)},ye.prototype.modInv=me.prototype.modInv=function(Oe){for(var We,jt,Dt,Ht=t.zero,vn=t.one,Vt=Ve(Oe),Kt=this.abs();!Kt.equals(t.zero);)We=Vt.divide(Kt),jt=Ht,Dt=Vt,Ht=vn,Vt=Kt,vn=jt.subtract(We.multiply(vn)),Kt=Dt.subtract(We.multiply(Kt));if(!Vt.equals(1))throw new Error(this.toString()+" and "+Oe.toString()+" are not co-prime");return Ht.compare(0)===-1&&(Ht=Ht.add(Oe)),this.isNegative()?Ht.negate():Ht},me.prototype.next=function(){var Oe=this.value;return this.sign?Le(Oe,1,this.sign):new me(Ie(Oe,1),this.sign)},ye.prototype.next=function(){var Oe=this.value;return Oe+1<fe?new ye(Oe+1):new me(ae,!1)},me.prototype.prev=function(){var Oe=this.value;return this.sign?new me(Ie(Oe,1),!0):Le(Oe,1,this.sign)},ye.prototype.prev=function(){var Oe=this.value;return Oe-1>-fe?new ye(Oe-1):new me(ae,!0)};for(var he=[1];2*he[he.length-1]<=ie;)he.push(2*he[he.length-1]);var ve=he.length,we=he[ve-1];function Ae(Oe){return(typeof Oe=="number"||typeof Oe=="string")&&+Math.abs(Oe)<=ie||Oe instanceof me&&Oe.value.length<=1}function be(Oe,We,jt){We=Ve(We);for(var Dt=Oe.isNegative(),Ht=We.isNegative(),vn=Dt?Oe.not():Oe,Vt=Ht?We.not():We,Kt=0,En=0,en=null,Xt=null,_n=[];!vn.isZero()||!Vt.isZero();)Kt=(en=_e(vn,we))[1].toJSNumber(),Dt&&(Kt=we-1-Kt),En=(Xt=_e(Vt,we))[1].toJSNumber(),Ht&&(En=we-1-En),vn=en[0],Vt=Xt[0],_n.push(jt(Kt,En));for(var Ze=jt(Dt?1:0,Ht?1:0)!==0?t(-1):t(0),Rt=_n.length-1;Rt>=0;Rt-=1)Ze=Ze.multiply(we).add(t(_n[Rt]));return Ze}function ue(Oe){var We=Oe.value,jt=typeof We=="number"?We|1<<30:We[0]+We[1]*ie|1073758208;return jt&-jt}function ge(Oe,We){return Oe=Ve(Oe),We=Ve(We),Oe.greater(We)?Oe:We}function Re(Oe,We){return Oe=Ve(Oe),We=Ve(We),Oe.lesser(We)?Oe:We}function Ne(Oe,We){if(Oe=Ve(Oe).abs(),We=Ve(We).abs(),Oe.equals(We))return Oe;if(Oe.isZero())return We;if(We.isZero())return Oe;for(var jt,Dt,Ht=pe[1];Oe.isEven()&&We.isEven();)jt=Math.min(ue(Oe),ue(We)),Oe=Oe.divide(jt),We=We.divide(jt),Ht=Ht.multiply(jt);for(;Oe.isEven();)Oe=Oe.divide(ue(Oe));do{for(;We.isEven();)We=We.divide(ue(We));Oe.greater(We)&&(Dt=We,We=Oe,Oe=Dt),We=We.subtract(Oe)}while(!We.isZero());return Ht.isUnit()?Oe:Oe.multiply(Ht)}ye.prototype.shiftLeft=me.prototype.shiftLeft=function(Oe){if(!Ae(Oe))throw new Error(String(Oe)+" is too large for shifting.");if((Oe=+Oe)<0)return this.shiftRight(-Oe);var We=this;if(We.isZero())return We;for(;Oe>=ve;)We=We.multiply(we),Oe-=ve-1;return We.multiply(he[Oe])},ye.prototype.shiftRight=me.prototype.shiftRight=function(Oe){var We;if(!Ae(Oe))throw new Error(String(Oe)+" is too large for shifting.");if((Oe=+Oe)<0)return this.shiftLeft(-Oe);for(var jt=this;Oe>=ve;){if(jt.isZero()||jt.isNegative()&&jt.isUnit())return jt;jt=(We=_e(jt,we))[1].isNegative()?We[0].prev():We[0],Oe-=ve-1}return(We=_e(jt,he[Oe]))[1].isNegative()?We[0].prev():We[0]},ye.prototype.not=me.prototype.not=function(){return this.negate().prev()},ye.prototype.and=me.prototype.and=function(Oe){return be(this,Oe,function(We,jt){return We&jt})},ye.prototype.or=me.prototype.or=function(Oe){return be(this,Oe,function(We,jt){return We|jt})},ye.prototype.xor=me.prototype.xor=function(Oe){return be(this,Oe,function(We,jt){return We^jt})},ye.prototype.bitLength=me.prototype.bitLength=function(){var Oe=this;return Oe.compareTo(t(0))<0&&(Oe=Oe.negate().subtract(t(1))),Oe.compareTo(t(0))===0?t(0):t(function We(jt,Dt){if(Dt.compareTo(jt)<=0){var Ht=We(jt,Dt.square(Dt)),vn=Ht.p,Vt=Ht.e,Kt=vn.multiply(Dt);return Kt.compareTo(jt)<=0?{p:Kt,e:2*Vt+1}:{p:vn,e:2*Vt}}return{p:t(1),e:0}}(Oe,t(2)).e).add(t(1))};var qe=function(Oe,We){for(var jt=Oe.length,Dt=Math.abs(We),Ht=0;Ht<jt;Ht++)if((En=Oe[Ht].toLowerCase())!=="-"&&/[a-z0-9]/.test(En)){if(/[0-9]/.test(En)&&+En>=Dt){if(En==="1"&&Dt===1)continue;throw new Error(En+" is not a valid digit in base "+We+".")}if(En.charCodeAt(0)-87>=Dt)throw new Error(En+" is not a valid digit in base "+We+".")}if(2<=We&&We<=36&&jt<=le/Math.log(We)){var vn=parseInt(Oe,We);if(isNaN(vn))throw new Error(En+" is not a valid digit in base "+We+".");return new ye(parseInt(Oe,We))}We=Ve(We);var Vt=[],Kt=Oe[0]==="-";for(Ht=Kt?1:0;Ht<Oe.length;Ht++){var En,en=(En=Oe[Ht].toLowerCase()).charCodeAt(0);if(48<=en&&en<=57)Vt.push(Ve(En));else if(97<=en&&en<=122)Vt.push(Ve(En.charCodeAt(0)-87));else{if(En!=="<")throw new Error(En+" is not a valid character");var Xt=Ht;do Ht++;while(Oe[Ht]!==">");Vt.push(Ve(Oe.slice(Xt+1,Ht)))}}return Pe(Vt,We,Kt)};function Pe(Oe,We,jt){var Dt,Ht=pe[0],vn=pe[1];for(Dt=Oe.length-1;Dt>=0;Dt--)Ht=Ht.add(Oe[Dt].times(vn)),vn=vn.times(We);return jt?Ht.negate():Ht}function Ge(Oe){return Oe<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(Oe):"<"+Oe+">"}function Ce(Oe,We){if((We=t(We)).isZero()){if(Oe.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(We.equals(-1)){if(Oe.isZero())return{value:[0],isNegative:!1};if(Oe.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-Oe)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var jt=Array.apply(null,Array(+Oe-1)).map(Array.prototype.valueOf,[0,1]);return jt.unshift([1]),{value:[].concat.apply([],jt),isNegative:!1}}var Dt=!1;if(Oe.isNegative()&&We.isPositive()&&(Dt=!0,Oe=Oe.abs()),We.equals(1))return Oe.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+Oe)).map(Number.prototype.valueOf,1),isNegative:Dt};for(var Ht,vn=[],Vt=Oe;Vt.isNegative()||Vt.compareAbs(We)>=0;){Ht=Vt.divmod(We),Vt=Ht.quotient;var Kt=Ht.remainder;Kt.isNegative()&&(Kt=We.minus(Kt).abs(),Vt=Vt.next()),vn.push(Kt.toJSNumber())}return vn.push(Vt.toJSNumber()),{value:vn.reverse(),isNegative:Dt}}function De(Oe,We){var jt=Ce(Oe,We);return(jt.isNegative?"-":"")+jt.value.map(Ge).join("")}function je(Oe){if(xe(+Oe)){var We=+Oe;if(We===$e(We))return new ye(We);throw new Error("Invalid integer: "+Oe)}var jt=Oe[0]==="-";jt&&(Oe=Oe.slice(1));var Dt=Oe.split(/e/i);if(Dt.length>2)throw new Error("Invalid integer: "+Dt.join("e"));if(Dt.length===2){var Ht=Dt[1];if(Ht[0]==="+"&&(Ht=Ht.slice(1)),(Ht=+Ht)!==$e(Ht)||!xe(Ht))throw new Error("Invalid integer: "+Ht+" is not a valid exponent.");var vn=Dt[0],Vt=vn.indexOf(".");if(Vt>=0&&(Ht-=vn.length-Vt-1,vn=vn.slice(0,Vt)+vn.slice(Vt+1)),Ht<0)throw new Error("Cannot include negative exponent part for integers");Oe=vn+=new Array(Ht+1).join("0")}if(!/^([0-9][0-9]*)$/.test(Oe))throw new Error("Invalid integer: "+Oe);for(var Kt=[],En=Oe.length,en=En-7;En>0;)Kt.push(+Oe.slice(en,En)),(en-=7)<0&&(en=0),En-=7;return Me(Kt),new me(Kt,jt)}function Ve(Oe){return typeof Oe=="number"?function(We){if(xe(We)){if(We!==$e(We))throw new Error(We+" is not an integer.");return new ye(We)}return je(We.toString())}(Oe):typeof Oe=="string"?je(Oe):Oe}me.prototype.toArray=function(Oe){return Ce(this,Oe)},ye.prototype.toArray=function(Oe){return Ce(this,Oe)},me.prototype.toString=function(Oe){if(Oe===void 0&&(Oe=10),Oe!==10)return De(this,Oe);for(var We,jt=this.value,Dt=jt.length,Ht=String(jt[--Dt]);--Dt>=0;)We=String(jt[Dt]),Ht+="0000000".slice(We.length)+We;return(this.sign?"-":"")+Ht},ye.prototype.toString=function(Oe){return Oe===void 0&&(Oe=10),Oe!=10?De(this,Oe):String(this.value)},me.prototype.toJSON=ye.prototype.toJSON=function(){return this.toString()},me.prototype.toJSNumber=me.prototype.valueOf=function(){return parseInt(this.toString(),10)},ye.prototype.toJSNumber=ye.prototype.valueOf=function(){return this.value};for(var Mt=0;Mt<1e3;Mt++)pe[Mt]=new ye(Mt),Mt>0&&(pe[-Mt]=new ye(-Mt));return pe.one=pe[1],pe.zero=pe[0],pe.minusOne=pe[-1],pe.max=ge,pe.min=Re,pe.gcd=Ne,pe.lcm=function(Oe,We){return Oe=Ve(Oe).abs(),We=Ve(We).abs(),Oe.divide(Ne(Oe,We)).multiply(We)},pe.isInstance=function(Oe){return Oe instanceof me||Oe instanceof ye},pe.randBetween=function(Oe,We){var jt=Re(Oe=Ve(Oe),We=Ve(We)),Dt=ge(Oe,We).subtract(jt).add(1);if(Dt.isSmall)return jt.add(Math.floor(Math.random()*Dt));for(var Ht=[],vn=!0,Vt=Dt.value.length-1;Vt>=0;Vt--){var Kt=vn?Dt.value[Vt]:ie,En=$e(Math.random()*Kt);Ht.unshift(En),En<Kt&&(vn=!1)}return Ht=Se(Ht),jt.add(typeof Ht=="number"?new ye(Ht):new me(Ht,!1))},pe.fromArray=function(Oe,We,jt){return Pe(Oe.map(Ve),Ve(We||10),jt)},pe}();c.hasOwnProperty("exports")&&(c.exports=t)}(T$1={path:void 0,exports:{},require:function(c,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}}),T$1.exports),R$1="0123456789ABCDEFGHJKMNPQRSTVWXYZ",k$1="0123456789abcdef";function F$1(c){return Buffer$7.from(sha256Exports$1.sha256.update(c).digest())}function M$1(c){return F$1(F$1(Buffer$7.from(c,"hex"))).slice(0,4).toString("hex")}function D$1(c){if(!c.match(/^[0-9a-fA-F]*$/))throw new Error("Not a hex-encoded string");c.length%2!=0&&(c="0"+c);for(var t=[],n=0,ie=(c=c.toLowerCase()).length-1;ie>=0;ie--)if(n<4){var fe=k$1.indexOf(c[ie])>>n,ae=0;ie!==0&&(ae=k$1.indexOf(c[ie-1]));var le=1+n;n=le,t.unshift(R$1[fe+(ae%(1<<le)<<5-le)])}else n=0;for(var pe=0,me=0;me<t.length&&t[me]==="0";me++)pe++;t=t.slice(pe);for(var ye=Buffer$7.from(c,"hex").toString().match(/^\u0000*/),xe=ye?ye[0].length:0,Ee=0;Ee<xe;Ee++)t.unshift(R$1[0]);return t.join("")}function X$1(c){return c.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")}var G$1=function(c,t){this.value=c,this.tag=t},V$1=function(c){this.value=c},Q$1=bnExports$1,W$1=function(){function c(n){n===void 0&&(n=Buffer$7.from([])),this.buffer=n,this.bytesRead=0}var t=c.prototype;return t.read=function(n){var ie=this.buffer.slice(0,n);return this.buffer=this.buffer.slice(n),this.bytesRead+=n,ie},t.write=function(n){this.buffer=Buffer$7.concat([this.buffer,Buffer$7.from(n)])},c}(),P$1=function(){function c(n){if(!n||n.length<1)throw new Error("Missing str in address");this.str=n}var t=c.prototype;return t.protocol=function(){if(this.str.length<1)throw Error("No address found.");return this.str[0]},t.payload=function(){if(this.str.length<1)throw Error("No address found.");return this.str.slice(1,this.str.length)},c}();function z$1(c){return blakejs.blake2b(Uint8Array.from(c),null,4)}function K$1(c,t){if(!t||!t.str)throw Error("Invalid address");var n="",ie=t.payload(),fe=t.protocol();switch(fe){case 0:var ae=function(Ee){for(var Se,Me=new Q$1(0),Be=0;Se=Ee.read(1)[0],Me.ior(new Q$1(127&Se).shln(Be)),Se>>7!=0;)Be+=7;return Me}(new W$1(ie)).toString();n=c+String(fe)+ae;break;default:var le=Buffer$7.from([fe]),pe=z$1(Buffer$7.concat([le,ie])),me=Buffer$7.concat([ie,Buffer$7.from(pe)]),ye=s(me.toString("hex")),xe=d$1(ye).replace(/=/g,"").toLowerCase();n=String(c)+String(fe)+xe}return n}function H$1(c,t){var n=Buffer$7.from([c]),ie=Buffer$7.concat([n,t]);return new P$1(ie)}var Z$1=[BigInt(1),BigInt(2),BigInt(4),BigInt(8),BigInt(16),BigInt(32),BigInt(64),BigInt(128),BigInt(256),BigInt(512),BigInt(1024),BigInt(2048),BigInt(4096),BigInt(8192),BigInt(16384),BigInt(32768),BigInt(65536),BigInt(131072),BigInt(262144),BigInt(471693),BigInt(419994),BigInt(397615),BigInt(395339),BigInt(275453),BigInt(273067),BigInt(268625),BigInt(144334),BigInt(141953),BigInt(137544),BigInt(126816),BigInt(122570),BigInt(116281),BigInt(114136),BigInt(107829),BigInt(103596),BigInt(101446),BigInt(90923),BigInt(86683),BigInt(84547),BigInt(78212),BigInt(76098),BigInt(71873),BigInt(63506),BigInt(57383),BigInt(53262),BigInt(51260),BigInt(45085),BigInt(43057),BigInt(38955),BigInt(28724),BigInt(26666),BigInt(22553),BigInt(14343),BigInt(2002),BigInt(1831),BigInt(1678),BigInt(1660),BigInt(1437),BigInt(1259),BigInt(948),BigInt(874),BigInt(729),BigInt(455),BigInt(63)],Y$1=function(c){this.codeword=c};function j$1(c,t){this.hi=c>>>0,this.lo=t>>>0}function J$1(c,t){return new j$1(c,t)}function _$1(){var c=arguments,t=c[0].hi,n=c[0].lo,ie=c.length-1;do t^=c[ie].hi,n^=c[ie].lo,ie--;while(ie>0);return new this.u64(t,n)}function $$1(c,t,n,ie,fe){fe|=0;for(var ae=0;ae<ie;)c[ae+t]=n[ae+fe],ae++}function rr(c){if(!c)return[];for(var t=c.length?1+(c.length-1>>>3):0,n=new Array(t),ie=0;ie<t;)n[ie]=new j$1(c[8*ie]<<24|c[8*ie+1]<<16|c[8*ie+2]<<8|c[8*ie+3],c[8*ie+4]<<24|c[8*ie+5]<<16|c[8*ie+6]<<8|c[8*ie+7]),ie++;return n}function tr(c){for(var t=new Array(c.length),n=c.length,ie=0;ie<n;)t[4*ie]=(4278190080&c[ie])>>>24,t[4*ie+1]=(16711680&c[ie])>>>16,t[4*ie+2]=(65280&c[ie])>>>8,t[4*ie+3]=255&c[ie],ie++;return t}Y$1.mainnet=new Y$1(BigInt(0)),Y$1.testnet=new Y$1(BigInt(7508831227132511e3)),Y$1.emulator=new Y$1(BigInt(2067532133767848e3)),j$1.prototype.set=function(c){this.lo=c.lo,this.hi=c.hi},j$1.prototype.add=function(c){var t,n,ie,fe;return fe=(this.hi>>>16)+(c.hi>>>16)+((ie=(65535&this.hi)+(65535&c.hi)+((n=(this.lo>>>16)+(c.lo>>>16)+((t=(65535&this.lo)+(65535&c.lo))>>>16))>>>16))>>>16),this.lo=n<<16|65535&t,this.hi=fe<<16|65535&ie,this},j$1.prototype.addOne=function(){this.lo===-1||this.lo===4294967295?(this.lo=0,this.hi++):this.lo++},j$1.prototype.plus=function(c){var t,n,ie,fe,ae=new j$1(0,0);return fe=(this.hi>>>16)+(c.hi>>>16)+((ie=(65535&this.hi)+(65535&c.hi)+((n=(this.lo>>>16)+(c.lo>>>16)+((t=(65535&this.lo)+(65535&c.lo))>>>16))>>>16))>>>16),ae.lo=n<<16|65535&t,ae.hi=fe<<16|65535&ie,ae},j$1.prototype.not=function(){return new j$1(~this.hi,~this.lo)},j$1.prototype.one=function(){return new j$1(0,1)},j$1.prototype.zero=function(){return new j$1(0,0)},j$1.prototype.neg=function(){return this.not().plus(this.one())},j$1.prototype.minus=function(c){return this.plus(c.neg())},j$1.prototype.isZero=function(){return this.lo===0&&this.hi===0},j$1.prototype.multiply=function(c){if(this.isZero())return this.zero();var t;if(((t=c)&&t.__isLong__)!==!0&&(c=function(Se){return isNaN(Se)||!isFinite(Se)?this.zero():new j$1(Se%1|0,Se/1|0)}(c)),c.isZero())return this.zero();var n=65535&this.hi,ie=this.lo>>>16,fe=65535&this.lo,ae=65535&c.hi,le=c.lo>>>16,pe=65535&c.lo,me=0,ye=0,xe=0,Ee=0;return xe+=(Ee+=fe*pe)>>>16,ye+=(xe+=ie*pe)>>>16,xe&=65535,ye+=(xe+=fe*le)>>>16,me+=(ye+=n*pe)>>>16,ye&=65535,me+=(ye+=ie*le)>>>16,ye&=65535,me+=(ye+=fe*ae)>>>16,me+=(this.hi>>>16)*pe+n*le+ie*ae+fe*(c.hi>>>16),new j$1((me&=65535)<<16|(ye&=65535),(xe&=65535)<<16|(Ee&=65535))},j$1.prototype.shiftLeft=function(c){c%=64;var t=new j$1(0,0);if(c===0)return this.clone();if(c>31)t.lo=0,t.hi=this.lo<<c-32;else{var n=this.lo>>>32-c;t.lo=this.lo<<c,t.hi=this.hi<<c|n}return t},j$1.prototype.setShiftLeft=function(c){if(c===0)return this;if(c>63&&(c%=64),c>31)this.hi=this.lo<<c-32,this.lo=0;else{var t=this.lo>>>32-c;this.lo<<=c,this.hi=this.hi<<c|t}return this},j$1.prototype.shiftRight=function(c){c%=64;var t=new j$1(0,0);if(c===0)return this.clone();if(c>=32)t.hi=0,t.lo=this.hi>>>c-32;else{var n=32-c,ie=this.hi<<n>>>n;t.hi=this.hi>>>c,t.lo=this.lo>>>c|ie<<n}return t},j$1.prototype.rotateLeft=function(c){if(c>32)return this.rotateRight(64-c);var t=new j$1(0,0);return c===0?(t.lo=this.lo>>>0,t.hi=this.hi>>>0):c===32?(t.lo=this.hi,t.hi=this.lo):(t.lo=this.lo<<c|this.hi>>>32-c,t.hi=this.hi<<c|this.lo>>>32-c),t},j$1.prototype.setRotateLeft=function(c){return c>32?this.setRotateRight(64-c):(c===0||(c===32?(t=this.lo,this.lo=this.hi,this.hi=t):(t=this.hi<<c|this.lo>>>32-c,this.lo=this.lo<<c|this.hi>>>32-c,this.hi=t)),this);var t},j$1.prototype.rotateRight=function(c){if(c>32)return this.rotateLeft(64-c);var t=new j$1(0,0);return c===0?(t.lo=this.lo>>>0,t.hi=this.hi>>>0):c===32?(t.lo=this.hi,t.hi=this.lo):(t.lo=this.hi<<32-c|this.lo>>>c,t.hi=this.lo<<32-c|this.hi>>>c),t},j$1.prototype.setFlip=function(){var c;return c=this.lo,this.lo=this.hi,this.hi=c,this},j$1.prototype.setRotateRight=function(c){return c>32?this.setRotateLeft(64-c):(c===0||(c===32?(t=this.lo,this.lo=this.hi,this.hi=t):(newHigh=this.lo<<32-c|this.hi>>>c,this.lo=this.hi<<32-c|this.lo>>>c,this.hi=newHigh)),this);var t},j$1.prototype.xor=function(c){var t=new j$1(0,0);return t.hi=this.hi^c.hi,t.lo=this.lo^c.lo,t},j$1.prototype.setxorOne=function(c){return this.hi^=c.hi,this.lo^=c.lo,this},j$1.prototype.and=function(c){var t=new j$1(0,0);return t.hi=this.hi&c.hi,t.lo=this.lo&c.lo,t},j$1.prototype.clone=function(){return new j$1(this.hi,this.lo)},j$1.prototype.setxor64=function(){for(var c=arguments,t=c.length;t--;)this.hi^=c[t].hi,this.lo^=c[t].lo;return this};var er="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function nr(c){var t,n,ie,fe,ae,le,pe=[],me=0;for(c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");me<c.length;)ie=er.indexOf(c.charAt(me++)),t=(15&(fe=er.indexOf(c.charAt(me++))))<<4|(ae=er.indexOf(c.charAt(me++)))>>2,n=(3&ae)<<6|(le=er.indexOf(c.charAt(me++))),pe.push(ie<<2|fe>>4),ae!==64&&pe.push(t),le!==64&&pe.push(n);return pe}var or=rr(nr("xjL0pfSXpcb4b5eEl+uE+O5esJmwx5nu9nqMjYz3jfb/6BcNF+UN/9YK3L3ct73W3hbIscinsd6RbfxU/DlUkWCQ8FDwwFBgAgcFAwUEAwLOLuCp4IepzlbRh32HrH1W58wrGSvVGee1E6ZipnFitU18MeYxmuZN7Fm1mrXDmuyPQM9FzwVFjx+jvJ28Pp0fiUnAQMAJQIn6aJKHku+H+u/QPxU/xRXvspQm6yZ/67KOzkDJQAfJjvvmHQsd7Qv7QW4v7C+C7EGzGqlnqX1ns19DHP0cvv1fRWAl6iWK6kUj+dq/2ka/I1NRAvcCpvdT5EWhlqHTluSbdu1b7S1bm3UoXcJd6sJ14cUkHCTZHOE91Omu6XquPUzyvmq+mGpMbILuWu7YWmx+vcNBw/xBfvXzBgIG8QL1g1LRT9EdT4NojORc5NBcaFFWB/QHovRR0Y1cNFy5NNH54RgIGOkI+eJMrpOu35Piqz6Vc5VNc6til/VT9cRTYiprQT9BVD8qCBwUDBQQDAiVY/ZS9jFSlUbpr2WvjGVGnX/iXuIhXp0wSHgoeGAoMDfP+KH4bqE3ChsRDxEUDwov68S1xF61Lw4VGwkbHAkOJH5aNlpINiQbrbabtjabG9+YRz1HpT3fzadqJmqBJs1O9btpu5xpTn8zTM1M/s1/6lC6n7rPn+oSPy0bLSQbEh2kuZ65Op4dWMScdJywdFg0RnIucmguNDZBdy13bC023BHNss2jsty0nSnuKXPutFtNFvsWtvtbpKUB9gFT9qR2oddN1+xNdrcUo2GjdWG3fTRJzkn6zn1S3417jaR7Ut2fQj5CoT7dXs2TcZO8cV4TsaKXoiaXE6aiBPUEV/WmuQG4aLhpaLkAAAAAAAAAAMG1dCx0mSzBQOCgYKCAYEDjwiEfId0f43k6Q8hD8sh5tpos7Sx37bbUDdm+2bO+1I1HykbKAUaNZxdw2XDO2Wdyr91L3eRLcpTted55M96UmP9n1Gcr1JiwkyPoI3vosIVb3kreEUqFuwa9a71ta7vFu34qfpEqxU97NOU0nuVP7dc6FjrBFu2G0lTFVBfFhpr4YtdiL9eaZpn/Vf/MVWYRtqeUpyKUEYrASs9KD8+K6dkwEDDJEOkEDgoGCggGBP5mmIGY54H+oKsL8Atb8KB4tMxEzPBEeCXw1brVSrolS3U+4z6W40uirA7zDl/zol1EGf4Zuv5dgNtbwFsbwIAFgIWKhQqKBT/T7K3sfq0/If7fvN9CvCFwqNhI2OBIcPH9DAQM+QTxYxl633rG32N3L1jBWO7Bd68wn3WfRXWvQuelY6WEY0IgcFAwUEAwIOXLLhou0Rrl/e8SDhLhDv2/CLdtt2Vtv4FV1EzUGUyBGCQ8FDwwFBgmeV81X0w1JsOycS9xnS/DvoY44Thn4b41yP2i/WqiNYjHT8xPC8yILmVLOUtcOS6TavlX+T1Xk1VYDfINqvJV/GGdgp3jgvx6s8lHyfRHesgn76zvi6zIuogy5zJv57oyT30rfWQrMuZCpJWk15XmwDv7oPuboMAZqrOYszKYGZ72aNFoJ9GeoyKBf4Fdf6NE7qpmqohmRFTWgn6CqH5UO93mq+Z2qzsLlZ6DnhaDC4zJRcpFA8qMx7x7KXuVKcdrBW7TbtbTayhsRDxEUDwopyyLeYtVeae8gT3iPWPivBYxJx0nLB0WrTeadppBdq3blk07Ta0722Se+lb6yFZkdKbSTtLoTnQUNiIeIigeFJLkdtt2P9uSDBIeCh4YCgxI/LRstJBsSLiPN+Q3a+S4n3jnXeclXZ+9D7JusmFuvUNpKu8qhu9DxDXxpvGTpsQ52uOo43KoOTHG96T3YqQx04pZN1m9N9PydIaLhv+L8tWDVjJWsTLVi07FQ8UNQ4tuhetZ69xZbtoYwrfCr7faAY6PjI8CjAGxHaxkrHlksZzxbdJtI9KcSXI74DuS4EnYH8e0x6u02Ky5FfoVQ/qs8/oJBwn9B/PPoG8lb4Ulz8og6q/qj6/K9H2JjonzjvRHZyDpII7pRxA4KBgoIBgQbwtk1WTe1W/wc4OIg/uI8Er7sW+xlG9KXMqWcpa4clw4VGwkbHAkOFdfCPEIrvFXcyFSx1Lmx3OXZPNR8zVRl8uuZSNljSPLoSWEfIRZfKHoV7+cv8uc6D5dYyFjfCE+lup83Xw33ZZhHn/cf8LcYQ2ckYaRGoYND5uUhZQehQ/gS6uQq9uQ4Hy6xkLG+EJ8cSZXxFfixHHMKeWq5YOqzJDjc9hzO9iQBgkPBQ8MBQb39AMBA/UB9xwqNhI2OBIcwjz+o/6fo8Jqi+Ff4dRfaq6+EPkQR/muaQJr0GvS0GkXv6iRqC6RF5lx6FjoKViZOlNpJ2l0Jzon99C50E65J9mRSDhIqTjZ6941EzXNE+sr5c6zzlazKyJ3VTNVRDMi0gTWu9a/u9KpOZBwkElwqQeHgImADokHM8Hyp/JmpzMt7MG2wVq2LTxaZiJmeCI8Fbitkq0qkhXJqWAgYIkgyYdc20nbFUmHqrAa/xpP/6pQ2Ih4iKB4UKUrjnqOUXqlA4mKj4oGjwNZShP4E7L4WQmSm4CbEoAJGiM5Fzk0FxplEHXadcraZdeEUzFTtTHXhNVRxlETxoTQA9O407u40ILcXsNeH8OCKeLLsMtSsClaw5l3mbR3Wh4tMxEzPBEeez1Gy0b2y3uotx/8H0v8qG0MYdZh2tZtLGJOOk5YOiw=")),ir=rr(nr("xsYy9KX0l6X4+G+XhJfrhO7uXrCZsMeZ9vZ6jI2M943//+gXDRflDdbWCty93Le93t4WyLHIp7GRkW38VPw5VGBgkPBQ8MBQAgIHBQMFBAPOzi7gqeCHqVZW0Yd9h6x95+fMKxkr1Rm1tROmYqZxYk1NfDHmMZrm7OxZtZq1w5qPj0DPRc8FRR8fo7ydvD6diYlJwEDACUD6+miSh5Lvh+/v0D8VP8UVsrKUJusmf+uOjs5AyUAHyfv75h0LHe0LQUFuL+wvguyzsxqpZ6l9Z19fQxz9HL79RUVgJeoliuojI/nav9pGv1NTUQL3Aqb35ORFoZah05abm3btW+0tW3V1KF3CXerC4eHFJBwk2Rw9PdTprul6rkxM8r5qvphqbGyC7lru2Fp+fr3DQcP8QfX18wYCBvECg4NS0U/RHU9oaIzkXOTQXFFRVgf0B6L00dGNXDRcuTT5+eEYCBjpCOLiTK6Trt+Tq6s+lXOVTXNiYpf1U/XEUyoqa0E/QVQ/CAgcFAwUEAyVlWP2UvYxUkZG6a9lr4xlnZ1/4l7iIV4wMEh4KHhgKDc3z/ih+G6hCgobEQ8RFA8vL+vEtcRetQ4OFRsJGxwJJCR+WjZaSDYbG622m7Y2m9/fmEc9R6U9zc2naiZqgSZOTvW7abucaX9/M0zNTP7N6upQup+6z58SEj8tGy0kGx0dpLmeuTqeWFjEnHScsHQ0NEZyLnJoLjY2QXctd2wt3NwRzbLNo7K0tJ0p7ilz7ltbTRb7Frb7pKSlAfYBU/Z2dqHXTdfsTbe3FKNho3VhfX00Sc5J+s5SUt+Ne42ke93dn0I+QqE+Xl7Nk3GTvHETE7Gil6Iml6amogT1BFf1ubkBuGi4aWgAAAAAAAAAAMHBtXQsdJksQEDgoGCggGDj48IhHyHdH3l5OkPIQ/LItraaLO0sd+3U1A3Zvtmzvo2NR8pGygFGZ2cXcNlwztlycq/dS93kS5SU7XneeTPemJj/Z9RnK9SwsJMj6CN76IWFW95K3hFKu7sGvWu9bWvFxbt+Kn6RKk9PezTlNJ7l7e3XOhY6wRaGhtJUxVQXxZqa+GLXYi/XZmaZ/1X/zFUREbanlKcilIqKwErPSg/P6enZMBAwyRAEBA4KBgoIBv7+ZpiBmOeBoKCrC/ALW/B4eLTMRMzwRCUl8NW61Uq6S0t1PuM+luOioqwO8w5f811dRBn+Gbr+gIDbW8BbG8AFBYCFioUKij8/0+yt7H6tISH+37zfQrxwcKjYSNjgSPHx/QwEDPkEY2MZet96xt93dy9YwVjuwa+vMJ91n0V1QkLnpWOlhGMgIHBQMFBAMOXlyy4aLtEa/f3vEg4S4Q6/vwi3bbdlbYGBVdRM1BlMGBgkPBQ8MBQmJnlfNV9MNcPDsnEvcZ0vvr6GOOE4Z+E1Ncj9ov1qooiIx0/MTwvMLi5lSzlLXDmTk2r5V/k9V1VVWA3yDary/PxhnYKd44J6erPJR8n0R8jIJ++s74usurqIMucyb+cyMk99K31kK+bmQqSVpNeVwMA7+6D7m6AZGaqzmLMymJ6e9mjRaCfRo6MigX+BXX9ERO6qZqqIZlRU1oJ+gqh+Ozvd5qvmdqsLC5Weg54Wg4yMyUXKRQPKx8e8eyl7lSlrawVu027W0ygobEQ8RFA8p6csi3mLVXm8vIE94j1j4hYWMScdJywdra03mnaaQXbb25ZNO02tO2RknvpW+shWdHSm0k7S6E4UFDYiHiIoHpKS5Hbbdj/bDAwSHgoeGApISPy0bLSQbLi4jzfkN2vkn594513nJV29vQ+ybrJhbkNDaSrvKobvxMQ18abxk6Y5OdrjqONyqDExxvek92Kk09OKWTdZvTfy8nSGi4b/i9XVg1YyVrEyi4tOxUPFDUNuboXrWevcWdraGMK3wq+3AQGOj4yPAoyxsR2sZKx5ZJyc8W3SbSPSSUlyO+A7kuDY2B/HtMertKysuRX6FUP68/P6CQcJ/QfPz6BvJW+FJcrKIOqv6o+v9PR9iY6J845HR2cg6SCO6RAQOCgYKCAYb28LZNVk3tXw8HODiIP7iEpK+7FvsZRvXFzKlnKWuHI4OFRsJGxwJFdXXwjxCK7xc3MhUsdS5seXl2TzUfM1UcvLrmUjZY0joaElhHyEWXzo6Fe/nL/LnD4+XWMhY3whlpbqfN18N91hYR5/3H/C3A0NnJGGkRqGDw+blIWUHoXg4EurkKvbkHx8usZCxvhCcXEmV8RX4sTMzCnlquWDqpCQ43PYczvYBgYJDwUPDAX39/QDAQP1ARwcKjYSNjgSwsI8/qP+n6NqaovhX+HUX66uvhD5EEf5aWkCa9Br0tAXF7+okagukZmZcehY6ClYOjpTaSdpdCcnJ/fQudBOudnZkUg4SKk46+veNRM1zRMrK+XOs85WsyIid1UzVUQz0tIE1rvWv7upqTmQcJBJcAcHh4CJgA6JMzPB8qfyZqctLezBtsFatjw8WmYiZngiFRW4rZKtKpLJyalgIGCJIIeHXNtJ2xVJqqqwGv8aT/9QUNiIeIigeKWlK456jlF6AwOJio+KBo9ZWUoT+BOy+AkJkpuAmxKAGhojORc5NBdlZRB12nXK2tfXhFMxU7UxhITVUcZRE8bQ0APTuNO7uIKC3F7DXh/DKSniy7DLUrBaWsOZd5m0dx4eLTMRMzwRe3s9RstG9suoqLcf/B9L/G1tDGHWYdrWLCxiTjpOWDo=")),ar=rr(nr("pcbGMvSl9JeE+Phvl4SX65nu7l6wmbDHjfb2eoyNjPcN///oFw0X5b3W1grcvdy3sd7eFsixyKdUkZFt/FT8OVBgYJDwUPDAAwICBwUDBQSpzs4u4Kngh31WVtGHfYesGefnzCsZK9VitbUTpmKmceZNTXwx5jGamuzsWbWatcNFj49Az0XPBZ0fH6O8nbw+QImJScBAwAmH+vpokoeS7xXv79A/FT/F67KylCbrJn/Jjo7OQMlABwv7++YdCx3t7EFBbi/sL4Jns7MaqWepff1fX0Mc/Ry+6kVFYCXqJYq/IyP52r/aRvdTU1EC9wKmluTkRaGWodNbm5t27VvtLcJ1dShdwl3qHOHhxSQcJNmuPT3U6a7pempMTPK+ar6YWmxsgu5a7thBfn69w0HD/AL19fMGAgbxT4ODUtFP0R1caGiM5Fzk0PRRUVYH9AeiNNHRjVw0XLkI+fnhGAgY6ZPi4kyuk67fc6urPpVzlU1TYmKX9VP1xD8qKmtBP0FUDAgIHBQMFBBSlZVj9lL2MWVGRumvZa+MXp2df+Je4iEoMDBIeCh4YKE3N8/4ofhuDwoKGxEPERS1Ly/rxLXEXgkODhUbCRscNiQkflo2WkibGxuttpu2Nj3f35hHPUelJs3Np2omaoFpTk71u2m7nM1/fzNMzUz+n+rqULqfus8bEhI/LRstJJ4dHaS5nrk6dFhYxJx0nLAuNDRGci5yaC02NkF3LXdsstzcEc2yzaPutLSdKe4pc/tbW00W+xa29qSkpQH2AVNNdnah103X7GG3txSjYaN1zn19NEnOSfp7UlLfjXuNpD7d3Z9CPkKhcV5ezZNxk7yXExOxopeiJvWmpqIE9QRXaLm5AbhouGkAAAAAAAAAACzBwbV0LHSZYEBA4KBgoIAf4+PCIR8h3ch5eTpDyEPy7ba2miztLHe+1NQN2b7Zs0aNjUfKRsoB2WdnF3DZcM5LcnKv3Uvd5N6UlO153nkz1JiY/2fUZyvosLCTI+gje0qFhVveSt4Ra7u7Br1rvW0qxcW7fip+keVPT3s05TSeFu3t1zoWOsHFhobSVMVUF9eamvhi12IvVWZmmf9V/8yUERG2p5SnIs+KisBKz0oPEOnp2TAQMMkGBAQOCgYKCIH+/maYgZjn8KCgqwvwC1tEeHi0zETM8LolJfDVutVK40tLdT7jPpbzoqKsDvMOX/5dXUQZ/hm6wICA21vAWxuKBQWAhYqFCq0/P9Psrex+vCEh/t+830JIcHCo2EjY4ATx8f0MBAz532NjGXrfesbBd3cvWMFY7nWvrzCfdZ9FY0JC56VjpYQwICBwUDBQQBrl5csuGi7RDv397xIOEuFtv78It223ZUyBgVXUTNQZFBgYJDwUPDA1JiZ5XzVfTC/Dw7JxL3Gd4b6+hjjhOGeiNTXI/aL9asyIiMdPzE8LOS4uZUs5S1xXk5Nq+Vf5PfJVVVgN8g2qgvz8YZ2CneNHenqzyUfJ9KzIyCfvrO+L57q6iDLnMm8rMjJPfSt9ZJXm5kKklaTXoMDAO/ug+5uYGRmqs5izMtGenvZo0Wgnf6OjIoF/gV1mRETuqmaqiH5UVNaCfoKoqzs73ear5naDCwuVnoOeFsqMjMlFykUDKcfHvHspe5XTa2sFbtNu1jwoKGxEPERQeaenLIt5i1XivLyBPeI9Yx0WFjEnHScsdq2tN5p2mkE729uWTTtNrVZkZJ76VvrITnR0ptJO0ugeFBQ2Ih4iKNuSkuR223Y/CgwMEh4KHhhsSEj8tGy0kOS4uI835DdrXZ+feOdd5yVuvb0Psm6yYe9DQ2kq7yqGpsTENfGm8ZOoOTna46jjcqQxMcb3pPdiN9PTilk3Wb2L8vJ0houG/zLV1YNWMlaxQ4uLTsVDxQ1Zbm6F61nr3Lfa2hjCt8KvjAEBjo+MjwJksbEdrGSsedKcnPFt0m0j4ElJcjvgO5K02Ngfx7THq/qsrLkV+hVDB/Pz+gkHCf0lz8+gbyVvha/KyiDqr+qPjvT0fYmOifPpR0dnIOkgjhgQEDgoGCgg1W9vC2TVZN6I8PBzg4iD+29KSvuxb7GUclxcypZylrgkODhUbCRscPFXV18I8Qiux3NzIVLHUuZRl5dk81HzNSPLy65lI2WNfKGhJYR8hFmc6OhXv5y/yyE+Pl1jIWN83ZaW6nzdfDfcYWEef9x/woYNDZyRhpEahQ8Pm5SFlB6Q4OBLq5Cr20J8fLrGQsb4xHFxJlfEV+KqzMwp5arlg9iQkONz2HM7BQYGCQ8FDwwB9/f0AwED9RIcHCo2EjY4o8LCPP6j/p9famqL4V/h1Pmurr4Q+RBH0GlpAmvQa9KRFxe/qJGoLliZmXHoWOgpJzo6U2knaXS5Jyf30LnQTjjZ2ZFIOEipE+vr3jUTNc2zKyvlzrPOVjMiIndVM1VEu9LSBNa71r9wqak5kHCQSYkHB4eAiYAOpzMzwfKn8ma2LS3swbbBWiI8PFpmImZ4khUVuK2SrSogycmpYCBgiUmHh1zbSdsV/6qqsBr/Gk94UFDYiHiIoHqlpSuOeo5RjwMDiYqPigb4WVlKE/gTsoAJCZKbgJsSFxoaIzkXOTTaZWUQddp1yjHX14RTMVO1xoSE1VHGURO40NAD07jTu8OCgtxew14fsCkp4suwy1J3WlrDmXeZtBEeHi0zETM8y3t7PUbLRvb8qKi3H/wfS9ZtbQxh1mHaOiwsYk46Tlg=")),ur=rr(nr("l6XGxjL0pfTrhPj4b5eEl8eZ7u5esJmw94329nqMjYzlDf//6BcNF7e91tYK3L3cp7He3hbIscg5VJGRbfxU/MBQYGCQ8FDwBAMCAgcFAwWHqc7OLuCp4Kx9VlbRh32H1Rnn58wrGStxYrW1E6ZipprmTU18MeYxw5rs7Fm1mrUFRY+PQM9Fzz6dHx+jvJ28CUCJiUnAQMDvh/r6aJKHksUV7+/QPxU/f+uyspQm6yYHyY6OzkDJQO0L+/vmHQsdguxBQW4v7C99Z7OzGqlnqb79X19DHP0ciupFRWAl6iVGvyMj+dq/2qb3U1NRAvcC05bk5EWhlqEtW5ubdu1b7erCdXUoXcJd2Rzh4cUkHCR6rj091Omu6ZhqTEzyvmq+2FpsbILuWu78QX5+vcNBw/EC9fXzBgIGHU+Dg1LRT9HQXGhojORc5KL0UVFWB/QHuTTR0Y1cNFzpCPn54RgIGN+T4uJMrpOuTXOrqz6Vc5XEU2Jil/VT9VQ/KiprQT9BEAwICBwUDBQxUpWVY/ZS9oxlRkbpr2WvIV6dnX/iXuJgKDAwSHgoeG6hNzfP+KH4FA8KChsRDxFetS8v68S1xBwJDg4VGwkbSDYkJH5aNlo2mxsbrbabtqU939+YRz1HgSbNzadqJmqcaU5O9btpu/7Nf38zTM1Mz5/q6lC6n7okGxISPy0bLTqeHR2kuZ65sHRYWMScdJxoLjQ0RnIucmwtNjZBdy13o7Lc3BHNss1z7rS0nSnuKbb7W1tNFvsWU/akpKUB9gHsTXZ2oddN13Vht7cUo2Gj+s59fTRJzkmke1JS3417jaE+3d2fQj5CvHFeXs2TcZMmlxMTsaKXolf1pqaiBPUEaWi5uQG4aLgAAAAAAAAAAJkswcG1dCx0gGBAQOCgYKDdH+PjwiEfIfLIeXk6Q8hDd+22tpos7SyzvtTUDdm+2QFGjY1HykbKztlnZxdw2XDkS3Jyr91L3TPelJTted55K9SYmP9n1Gd76LCwkyPoIxFKhYVb3krebWu7uwa9a72RKsXFu34qfp7lT097NOU0wRbt7dc6FjoXxYaG0lTFVC/Xmpr4YtdizFVmZpn/Vf8ilBERtqeUpw/PiorASs9KyRDp6dkwEDAIBgQEDgoGCueB/v5mmIGYW/CgoKsL8AvwRHh4tMxEzEq6JSXw1brVluNLS3U+4z5f86KirA7zDrr+XV1EGf4ZG8CAgNtbwFsKigUFgIWKhX6tPz/T7K3sQrwhIf7fvN/gSHBwqNhI2PkE8fH9DAQMxt9jYxl633ruwXd3L1jBWEV1r68wn3WfhGNCQuelY6VAMCAgcFAwUNEa5eXLLhou4Q79/e8SDhJlbb+/CLdttxlMgYFV1EzUMBQYGCQ8FDxMNSYmeV81X50vw8OycS9xZ+G+voY44ThqojU1yP2i/QvMiIjHT8xPXDkuLmVLOUs9V5OTavlX+aryVVVYDfIN44L8/GGdgp30R3p6s8lHyYusyMgn76zvb+e6uogy5zJkKzIyT30rfdeV5uZCpJWkm6DAwDv7oPsymBkZqrOYsyfRnp72aNFoXX+joyKBf4GIZkRE7qpmqqh+VFTWgn6Cdqs7O93mq+YWgwsLlZ6DngPKjIzJRcpFlSnHx7x7KXvW02trBW7TblA8KChsRDxEVXmnpyyLeYtj4ry8gT3iPSwdFhYxJx0nQXatrTeadpqtO9vblk07TchWZGSe+lb66E50dKbSTtIoHhQUNiIeIj/bkpLkdtt2GAoMDBIeCh6QbEhI/LRstGvkuLiPN+Q3JV2fn3jnXedhbr29D7JusobvQ0NpKu8qk6bExDXxpvFyqDk52uOo42KkMTHG96T3vTfT04pZN1n/i/LydIaLhrEy1dWDVjJWDUOLi07FQ8XcWW5uhetZ66+32toYwrfCAowBAY6PjI95ZLGxHaxkrCPSnJzxbdJtkuBJSXI74DurtNjYH8e0x0P6rKy5FfoV/Qfz8/oJBwmFJc/PoG8lb4+vysog6q/q84709H2JjomO6UdHZyDpICAYEBA4KBgo3tVvbwtk1WT7iPDwc4OIg5RvSkr7sW+xuHJcXMqWcpZwJDg4VGwkbK7xV1dfCPEI5sdzcyFSx1I1UZeXZPNR840jy8uuZSNlWXyhoSWEfITLnOjoV7+cv3whPj5dYyFjN92Wlup83XzC3GFhHn/cfxqGDQ2ckYaRHoUPD5uUhZTbkODgS6uQq/hCfHy6xkLG4sRxcSZXxFeDqszMKeWq5TvYkJDjc9hzDAUGBgkPBQ/1Aff39AMBAzgSHBwqNhI2n6PCwjz+o/7UX2pqi+Ff4Uf5rq6+EPkQ0tBpaQJr0GsukRcXv6iRqClYmZlx6FjodCc6OlNpJ2lOuScn99C50Kk42dmRSDhIzRPr6941EzVWsysr5c6zzkQzIiJ3VTNVv7vS0gTWu9ZJcKmpOZBwkA6JBweHgImAZqczM8Hyp/Jati0t7MG2wXgiPDxaZiJmKpIVFbitkq2JIMnJqWAgYBVJh4dc20nbT/+qqrAa/xqgeFBQ2Ih4iFF6paUrjnqOBo8DA4mKj4qy+FlZShP4ExKACQmSm4CbNBcaGiM5FznK2mVlEHXadbUx19eEUzFTE8aEhNVRxlG7uNDQA9O40x/DgoLcXsNeUrApKeLLsMu0d1paw5l3mTwRHh4tMxEz9st7ez1Gy0ZL/Kiotx/8H9rWbW0MYdZhWDosLGJOOk4=")),fr=rr(nr("9JelxsYy9KWX64T4+G+XhLDHme7uXrCZjPeN9vZ6jI0X5Q3//+gXDdy3vdbWCty9yKex3t4WyLH8OVSRkW38VPDAUGBgkPBQBQQDAgIHBQPgh6nOzi7gqYesfVZW0Yd9K9UZ5+fMKxmmcWK1tROmYjGa5k1NfDHmtcOa7OxZtZrPBUWPj0DPRbw+nR8fo7ydwAlAiYlJwECS74f6+miShz/FFe/v0D8VJn/rsrKUJutAB8mOjs5AyR3tC/v75h0LL4LsQUFuL+ypfWezsxqpZxy+/V9fQxz9JYrqRUVgJeraRr8jI/navwKm91NTUQL3odOW5ORFoZbtLVubm3btW13qwnV1KF3CJNkc4eHFJBzpeq49PdTprr6YakxM8r5q7thabGyC7lrD/EF+fr3DQQbxAvX18wYC0R1Pg4NS0U/k0FxoaIzkXAei9FFRVgf0XLk00dGNXDQY6Qj5+eEYCK7fk+LiTK6TlU1zq6s+lXP1xFNiYpf1U0FUPyoqa0E/FBAMCAgcFAz2MVKVlWP2Uq+MZUZG6a9l4iFenZ1/4l54YCgwMEh4KPhuoTc3z/ihERQPCgobEQ/EXrUvL+vEtRscCQ4OFRsJWkg2JCR+Wja2NpsbG622m0elPd/fmEc9aoEmzc2naia7nGlOTvW7aUz+zX9/M0zNus+f6upQup8tJBsSEj8tG7k6nh0dpLmenLB0WFjEnHRyaC40NEZyLndsLTY2QXctzaOy3NwRzbIpc+60tJ0p7ha2+1tbTRb7AVP2pKSlAfbX7E12dqHXTaN1Ybe3FKNhSfrOfX00Sc6NpHtSUt+Ne0KhPt3dn0I+k7xxXl7Nk3GiJpcTE7GilwRX9aamogT1uGloubkBuGgAAAAAAAAAAHSZLMHBtXQsoIBgQEDgoGAh3R/j48IhH0PyyHl5OkPILHfttraaLO3Zs77U1A3ZvsoBRo2NR8pGcM7ZZ2cXcNnd5Etycq/dS3kz3pSU7XneZyvUmJj/Z9Qje+iwsJMj6N4RSoWFW95KvW1ru7sGvWt+kSrFxbt+KjSe5U9PezTlOsEW7e3XOhZUF8WGhtJUxWIv15qa+GLX/8xVZmaZ/1WnIpQREbanlEoPz4qKwErPMMkQ6enZMBAKCAYEBA4KBpjngf7+ZpiBC1vwoKCrC/DM8ER4eLTMRNVKuiUl8NW6PpbjS0t1PuMOX/OioqwO8xm6/l1dRBn+WxvAgIDbW8CFCooFBYCFiux+rT8/0+yt30K8ISH+37zY4EhwcKjYSAz5BPHx/QwEesbfY2MZet9Y7sF3dy9YwZ9Fda+vMJ91pYRjQkLnpWNQQDAgIHBQMC7RGuXlyy4aEuEO/f3vEg63ZW2/vwi3bdQZTIGBVdRMPDAUGBgkPBRfTDUmJnlfNXGdL8PDsnEvOGfhvr6GOOH9aqI1Ncj9ok8LzIiIx0/MS1w5Li5lSzn5PVeTk2r5Vw2q8lVVWA3yneOC/PxhnYLJ9Ed6erPJR++LrMjIJ++sMm/nurqIMud9ZCsyMk99K6TXlebmQqSV+5ugwMA7+6CzMpgZGaqzmGgn0Z6e9mjRgV1/o6MigX+qiGZERO6qZoKoflRU1oJ+5narOzvd5queFoMLC5Weg0UDyoyMyUXKe5Upx8e8eylu1tNrawVu00RQPCgobEQ8i1V5p6csi3k9Y+K8vIE94icsHRYWMScdmkF2ra03mnZNrTvb25ZNO/rIVmRknvpW0uhOdHSm0k4iKB4UFDYiHnY/25KS5HbbHhgKDAwSHgq0kGxISPy0bDdr5Li4jzfk5yVdn594512yYW69vQ+ybiqG70NDaSrv8ZOmxMQ18abjcqg5OdrjqPdipDExxvekWb0309OKWTeG/4vy8nSGi1axMtXVg1YyxQ1Di4tOxUPr3FluboXrWcKvt9raGMK3jwKMAQGOj4yseWSxsR2sZG0j0pyc8W3SO5LgSUlyO+DHq7TY2B/HtBVD+qysuRX6Cf0H8/P6CQdvhSXPz6BvJeqPr8rKIOqvifOO9PR9iY4gjulHR2cg6SggGBAQOCgYZN7Vb28LZNWD+4jw8HODiLGUb0pK+7FvlrhyXFzKlnJscCQ4OFRsJAiu8VdXXwjxUubHc3MhUsfzNVGXl2TzUWWNI8vLrmUjhFl8oaElhHy/y5zo6Fe/nGN8IT4+XWMhfDfdlpbqfN1/wtxhYR5/3JEahg0NnJGGlB6FDw+blIWr25Dg4EurkMb4Qnx8usZCV+LEcXEmV8Tlg6rMzCnlqnM72JCQ43PYDwwFBgYJDwUD9QH39/QDATY4EhwcKjYS/p+jwsI8/qPh1F9qaovhXxBH+a6uvhD5a9LQaWkCa9CoLpEXF7+okegpWJmZcehYaXQnOjpTaSfQTrknJ/fQuUipONnZkUg4Nc0T6+veNRPOVrMrK+XOs1VEMyIid1Uz1r+70tIE1ruQSXCpqTmQcIAOiQcHh4CJ8manMzPB8qfBWrYtLezBtmZ4Ijw8WmYirSqSFRW4rZJgiSDJyalgINsVSYeHXNtJGk//qqqwGv+IoHhQUNiIeI5ReqWlK456igaPAwOJio8TsvhZWUoT+JsSgAkJkpuAOTQXGhojORd1ytplZRB12lO1MdfXhFMxURPGhITVUcbTu7jQ0APTuF4fw4KC3F7Dy1KwKSniy7CZtHdaWsOZdzM8ER4eLTMRRvbLe3s9RssfS/yoqLcf/GHa1m1tDGHWTlg6LCxiTjo=")),sr=rr(nr("pfSXpcbGMvSEl+uE+Phvl5mwx5nu7l6wjYz3jfb2eowNF+UN///oF73ct73W1grcscinsd7eFshU/DlUkZFt/FDwwFBgYJDwAwUEAwICBwWp4Iepzs4u4H2HrH1WVtGHGSvVGefnzCtipnFitbUTpuYxmuZNTXwxmrXDmuzsWbVFzwVFj49Az528Pp0fH6O8QMAJQImJScCHku+H+vpokhU/xRXv79A/6yZ/67KylCbJQAfJjo7OQAsd7Qv7++Yd7C+C7EFBbi9nqX1ns7Maqf0cvv1fX0Mc6iWK6kVFYCW/2ka/IyP52vcCpvdTU1EClqHTluTkRaFb7S1bm5t27cJd6sJ1dShdHCTZHOHhxSSu6XquPT3U6Wq+mGpMTPK+Wu7YWmxsgu5Bw/xBfn69wwIG8QL19fMGT9EdT4ODUtFc5NBcaGiM5PQHovRRUVYHNFy5NNHRjVwIGOkI+fnhGJOu35Pi4kyuc5VNc6urPpVT9cRTYmKX9T9BVD8qKmtBDBQQDAgIHBRS9jFSlZVj9mWvjGVGRumvXuIhXp2df+IoeGAoMDBIeKH4bqE3N8/4DxEUDwoKGxG1xF61Ly/rxAkbHAkODhUbNlpINiQkflqbtjabGxuttj1HpT3f35hHJmqBJs3Np2ppu5xpTk71u81M/s1/fzNMn7rPn+rqULobLSQbEhI/LZ65Op4dHaS5dJywdFhYxJwucmguNDRGci13bC02NkF3ss2jstzcEc3uKXPutLSdKfsWtvtbW00W9gFT9qSkpQFN1+xNdnah12GjdWG3txSjzkn6zn19NEl7jaR7UlLfjT5CoT7d3Z9CcZO8cV5ezZOXoiaXExOxovUEV/WmpqIEaLhpaLm5AbgAAAAAAAAAACx0mSzBwbV0YKCAYEBA4KAfId0f4+PCIchD8sh5eTpD7Sx37ba2miy+2bO+1NQN2UbKAUaNjUfK2XDO2WdnF3BL3eRLcnKv3d55M96UlO151Gcr1JiY/2foI3vosLCTI0reEUqFhVvea71ta7u7Br0qfpEqxcW7fuU0nuVPT3s0FjrBFu3t1zrFVBfFhobSVNdiL9eamvhiVf/MVWZmmf+UpyKUERG2p89KD8+KisBKEDDJEOnp2TAGCggGBAQOCoGY54H+/maY8Atb8KCgqwtEzPBEeHi0zLrVSrolJfDV4z6W40tLdT7zDl/zoqKsDv4Zuv5dXUQZwFsbwICA21uKhQqKBQWAha3sfq0/P9PsvN9CvCEh/t9I2OBIcHCo2AQM+QTx8f0M33rG32NjGXrBWO7Bd3cvWHWfRXWvrzCfY6WEY0JC56UwUEAwICBwUBou0Rrl5csuDhLhDv397xJtt2Vtv78It0zUGUyBgVXUFDwwFBgYJDw1X0w1JiZ5Xy9xnS/Dw7Jx4Thn4b6+hjii/WqiNTXI/cxPC8yIiMdPOUtcOS4uZUtX+T1Xk5Nq+fINqvJVVVgNgp3jgvz8YZ1HyfRHenqzyazvi6zIyCfv5zJv57q6iDIrfWQrMjJPfZWk15Xm5kKkoPuboMDAO/uYszKYGRmqs9FoJ9GenvZof4Fdf6OjIoFmqohmRETuqn6CqH5UVNaCq+Z2qzs73eaDnhaDCwuVnspFA8qMjMlFKXuVKcfHvHvTbtbTa2sFbjxEUDwoKGxEeYtVeaenLIviPWPivLyBPR0nLB0WFjEndppBdq2tN5o7Ta0729uWTVb6yFZkZJ76TtLoTnR0ptIeIigeFBQ2Itt2P9uSkuR2Ch4YCgwMEh5stJBsSEj8tOQ3a+S4uI83XeclXZ+feOdusmFuvb0Psu8qhu9DQ2kqpvGTpsTENfGo43KoOTna46T3YqQxMcb3N1m9N9PTilmLhv+L8vJ0hjJWsTLV1YNWQ8UNQ4uLTsVZ69xZbm6F67fCr7fa2hjCjI8CjAEBjo9krHlksbEdrNJtI9KcnPFt4DuS4ElJcju0x6u02Ngfx/oVQ/qsrLkVBwn9B/Pz+gklb4Ulz8+gb6/qj6/KyiDqjonzjvT0fYnpII7pR0dnIBgoIBgQEDgo1WTe1W9vC2SIg/uI8PBzg2+xlG9KSvuxcpa4clxcypYkbHAkODhUbPEIrvFXV18Ix1Lmx3NzIVJR8zVRl5dk8yNljSPLy65lfIRZfKGhJYScv8uc6OhXvyFjfCE+Pl1j3Xw33ZaW6nzcf8LcYWEef4aRGoYNDZyRhZQehQ8Pm5SQq9uQ4OBLq0LG+EJ8fLrGxFfixHFxJleq5YOqzMwp5dhzO9iQkONzBQ8MBQYGCQ8BA/UB9/f0AxI2OBIcHCo2o/6fo8LCPP5f4dRfamqL4fkQR/murr4Q0GvS0GlpAmuRqC6RFxe/qFjoKViZmXHoJ2l0Jzo6U2m50E65Jyf30DhIqTjZ2ZFIEzXNE+vr3jWzzlazKyvlzjNVRDMiIndVu9a/u9LSBNZwkElwqak5kImADokHB4eAp/JmpzMzwfK2wVq2LS3swSJmeCI8PFpmkq0qkhUVuK0gYIkgycmpYEnbFUmHh1zb/xpP/6qqsBp4iKB4UFDYiHqOUXqlpSuOj4oGjwMDiYr4E7L4WVlKE4CbEoAJCZKbFzk0FxoaIznadcraZWUQdTFTtTHX14RTxlETxoSE1VG407u40NAD08NeH8OCgtxesMtSsCkp4st3mbR3WlrDmREzPBEeHi0zy0b2y3t7PUb8H0v8qKi3H9Zh2tZtbQxhOk5YOiwsYk4=")),cr=rr(nr("9KX0l6XGxjKXhJfrhPj4b7CZsMeZ7u5ejI2M94329noXDRflDf//6Ny93Le91tYKyLHIp7He3hb8VPw5VJGRbfBQ8MBQYGCQBQMFBAMCAgfgqeCHqc7OLod9h6x9VlbRKxkr1Rnn58ymYqZxYrW1EzHmMZrmTU18tZq1w5rs7FnPRc8FRY+PQLydvD6dHx+jwEDACUCJiUmSh5Lvh/r6aD8VP8UV7+/QJusmf+uyspRAyUAHyY6Ozh0LHe0L+/vmL+wvguxBQW6pZ6l9Z7OzGhz9HL79X19DJeoliupFRWDav9pGvyMj+QL3Aqb3U1NRoZah05bk5EXtW+0tW5ubdl3CXerCdXUoJBwk2Rzh4cXprul6rj091L5qvphqTEzy7lru2FpsbILDQcP8QX5+vQYCBvEC9fXz0U/RHU+Dg1LkXOTQXGhojAf0B6L0UVFWXDRcuTTR0Y0YCBjpCPn54a6Trt+T4uJMlXOVTXOrqz71U/XEU2Jil0E/QVQ/KiprFAwUEAwICBz2UvYxUpWVY69lr4xlRkbp4l7iIV6dnX94KHhgKDAwSPih+G6hNzfPEQ8RFA8KChvEtcRetS8v6xsJGxwJDg4VWjZaSDYkJH62m7Y2mxsbrUc9R6U939+YaiZqgSbNzae7abucaU5O9UzNTP7Nf38zup+6z5/q6lAtGy0kGxISP7meuTqeHR2knHScsHRYWMRyLnJoLjQ0Rnctd2wtNjZBzbLNo7Lc3BEp7ilz7rS0nRb7Frb7W1tNAfYBU/akpKXXTdfsTXZ2oaNho3Vht7cUSc5J+s59fTSNe42ke1JS30I+QqE+3d2fk3GTvHFeXs2il6ImlxMTsQT1BFf1pqaiuGi4aWi5uQEAAAAAAAAAAHQsdJkswcG1oGCggGBAQOAhHyHdH+PjwkPIQ/LIeXk6LO0sd+22tprZvtmzvtTUDcpGygFGjY1HcNlwztlnZxfdS93kS3Jyr3neeTPelJTtZ9RnK9SYmP8j6CN76LCwk95K3hFKhYVbvWu9bWu7uwZ+Kn6RKsXFuzTlNJ7lT097OhY6wRbt7ddUxVQXxYaG0mLXYi/Xmpr4/1X/zFVmZpmnlKcilBERtkrPSg/PiorAMBAwyRDp6dkKBgoIBgQEDpiBmOeB/v5mC/ALW/CgoKvMRMzwRHh4tNW61Uq6JSXwPuM+luNLS3UO8w5f86KirBn+Gbr+XV1EW8BbG8CAgNuFioUKigUFgOyt7H6tPz/T37zfQrwhIf7YSNjgSHBwqAwEDPkE8fH9et96xt9jYxlYwVjuwXd3L591n0V1r68wpWOlhGNCQudQMFBAMCAgcC4aLtEa5eXLEg4S4Q79/e+3bbdlbb+/CNRM1BlMgYFVPBQ8MBQYGCRfNV9MNSYmeXEvcZ0vw8OyOOE4Z+G+vob9ov1qojU1yE/MTwvMiIjHSzlLXDkuLmX5V/k9V5OTag3yDaryVVVYnYKd44L8/GHJR8n0R3p6s++s74usyMgnMucyb+e6uoh9K31kKzIyT6SVpNeV5uZC+6D7m6DAwDuzmLMymBkZqmjRaCfRnp72gX+BXX+joyKqZqqIZkRE7oJ+gqh+VFTW5qvmdqs7O92eg54WgwsLlUXKRQPKjIzJeyl7lSnHx7xu027W02trBUQ8RFA8KChsi3mLVXmnpyw94j1j4ry8gScdJywdFhYxmnaaQXatrTdNO02tO9vblvpW+shWZGSe0k7S6E50dKYiHiIoHhQUNnbbdj/bkpLkHgoeGAoMDBK0bLSQbEhI/DfkN2vkuLiP513nJV2fn3iybrJhbr29DyrvKobvQ0Np8abxk6bExDXjqONyqDk52vek92KkMTHGWTdZvTfT04qGi4b/i/LydFYyVrEy1dWDxUPFDUOLi07rWevcWW5uhcK3wq+32toYj4yPAowBAY6sZKx5ZLGxHW3SbSPSnJzxO+A7kuBJSXLHtMertNjYHxX6FUP6rKy5CQcJ/Qfz8/pvJW+FJc/PoOqv6o+vysogiY6J84709H0g6SCO6UdHZygYKCAYEBA4ZNVk3tVvbwuDiIP7iPDwc7FvsZRvSkr7lnKWuHJcXMpsJGxwJDg4VAjxCK7xV1dfUsdS5sdzcyHzUfM1UZeXZGUjZY0jy8uuhHyEWXyhoSW/nL/LnOjoV2MhY3whPj5dfN18N92Wlup/3H/C3GFhHpGGkRqGDQ2clIWUHoUPD5urkKvbkODgS8ZCxvhCfHy6V8RX4sRxcSblquWDqszMKXPYczvYkJDjDwUPDAUGBgkDAQP1Aff39DYSNjgSHBwq/qP+n6PCwjzhX+HUX2pqixD5EEf5rq6+a9Br0tBpaQKokagukRcXv+hY6ClYmZlxaSdpdCc6OlPQudBOuScn90g4SKk42dmRNRM1zRPr697Os85Wsysr5VUzVUQzIiJ31rvWv7vS0gSQcJBJcKmpOYCJgA6JBweH8qfyZqczM8HBtsFati0t7GYiZngiPDxarZKtKpIVFbhgIGCJIMnJqdtJ2xVJh4dcGv8aT/+qqrCIeIigeFBQ2I56jlF6paUrio+KBo8DA4kT+BOy+FlZSpuAmxKACQmSORc5NBcaGiN12nXK2mVlEFMxU7Ux19eEUcZRE8aEhNXTuNO7uNDQA17DXh/DgoLcy7DLUrApKeKZd5m0d1pawzMRMzwRHh4tRstG9st7ez0f/B9L/Kiot2HWYdrWbW0MTjpOWDosLGI=")),hr=rr(nr("MvSl9JelxsZvl4SX64T4+F6wmbDHme7ueoyNjPeN9vboFw0X5Q3//wrcvdy3vdbWFsixyKex3t5t/FT8OVSRkZDwUPDAUGBgBwUDBQQDAgIu4Kngh6nOztGHfYesfVZWzCsZK9UZ5+cTpmKmcWK1tXwx5jGa5k1NWbWatcOa7OxAz0XPBUWPj6O8nbw+nR8fScBAwAlAiYlokoeS74f6+tA/FT/FFe/vlCbrJn/rsrLOQMlAB8mOjuYdCx3tC/v7bi/sL4LsQUEaqWepfWezs0Mc/Ry+/V9fYCXqJYrqRUX52r/aRr8jI1EC9wKm91NTRaGWodOW5OR27VvtLVubmyhdwl3qwnV1xSQcJNkc4eHU6a7peq49PfK+ar6YakxMgu5a7thabGy9w0HD/EF+fvMGAgbxAvX1UtFP0R1Pg4OM5Fzk0FxoaFYH9Aei9FFRjVw0XLk00dHhGAgY6Qj5+Uyuk67fk+LiPpVzlU1zq6uX9VP1xFNiYmtBP0FUPyoqHBQMFBAMCAhj9lL2MVKVlemvZa+MZUZGf+Je4iFenZ1IeCh4YCgwMM/4ofhuoTc3GxEPERQPCgrrxLXEXrUvLxUbCRscCQ4Oflo2Wkg2JCSttpu2NpsbG5hHPUelPd/fp2omaoEmzc31u2m7nGlOTjNMzUz+zX9/ULqfus+f6uo/LRstJBsSEqS5nrk6nh0dxJx0nLB0WFhGci5yaC40NEF3LXdsLTY2Ec2yzaOy3NydKe4pc+60tE0W+xa2+1tbpQH2AVP2pKSh103X7E12dhSjYaN1Ybe3NEnOSfrOfX3fjXuNpHtSUp9CPkKhPt3dzZNxk7xxXl6xopeiJpcTE6IE9QRX9aamAbhouGloubkAAAAAAAAAALV0LHSZLMHB4KBgoIBgQEDCIR8h3R/j4zpDyEPyyHl5miztLHfttrYN2b7Zs77U1EfKRsoBRo2NF3DZcM7ZZ2ev3Uvd5Etycu153nkz3pSU/2fUZyvUmJiTI+gje+iwsFveSt4RSoWFBr1rvW1ru7u7fip+kSrFxXs05TSe5U9P1zoWOsEW7e3SVMVUF8WGhvhi12Iv15qamf9V/8xVZma2p5SnIpQREcBKz0oPz4qK2TAQMMkQ6ekOCgYKCAYEBGaYgZjngf7+qwvwC1vwoKC0zETM8ER4ePDVutVKuiUldT7jPpbjS0usDvMOX/OiokQZ/hm6/l1d21vAWxvAgICAhYqFCooFBdPsrex+rT8//t+830K8ISGo2EjY4EhwcP0MBAz5BPHxGXrfesbfY2MvWMFY7sF3dzCfdZ9Fda+v56VjpYRjQkJwUDBQQDAgIMsuGi7RGuXl7xIOEuEO/f0It223ZW2/v1XUTNQZTIGBJDwUPDAUGBh5XzVfTDUmJrJxL3GdL8PDhjjhOGfhvr7I/aL9aqI1NcdPzE8LzIiIZUs5S1w5Li5q+Vf5PVeTk1gN8g2q8lVVYZ2CneOC/PyzyUfJ9Ed6eifvrO+LrMjIiDLnMm/nurpPfSt9ZCsyMkKklaTXlebmO/ug+5ugwMCqs5izMpgZGfZo0Wgn0Z6eIoF/gV1/o6PuqmaqiGZERNaCfoKoflRU3ear5narOzuVnoOeFoMLC8lFykUDyoyMvHspe5Upx8cFbtNu1tNra2xEPERQPCgoLIt5i1V5p6eBPeI9Y+K8vDEnHScsHRYWN5p2mkF2ra2WTTtNrTvb2576VvrIVmRkptJO0uhOdHQ2Ih4iKB4UFOR223Y/25KSEh4KHhgKDAz8tGy0kGxISI835Ddr5Li4eOdd5yVdn58Psm6yYW69vWkq7yqG70NDNfGm8ZOmxMTa46jjcqg5Ocb3pPdipDExilk3Wb0309N0houG/4vy8oNWMlaxMtXVTsVDxQ1Di4uF61nr3FlubhjCt8Kvt9rajo+MjwKMAQEdrGSseWSxsfFt0m0j0pyccjvgO5LgSUkfx7THq7TY2LkV+hVD+qys+gkHCf0H8/OgbyVvhSXPzyDqr+qPr8rKfYmOifOO9PRnIOkgjulHRzgoGCggGBAQC2TVZN7Vb29zg4iD+4jw8Puxb7GUb0pKypZylrhyXFxUbCRscCQ4OF8I8Qiu8VdXIVLHUubHc3Nk81HzNVGXl65lI2WNI8vLJYR8hFl8oaFXv5y/y5zo6F1jIWN8IT4+6nzdfDfdlpYef9x/wtxhYZyRhpEahg0Nm5SFlB6FDw9Lq5Cr25Dg4LrGQsb4Qnx8JlfEV+LEcXEp5arlg6rMzONz2HM72JCQCQ8FDwwFBgb0AwED9QH39yo2EjY4EhwcPP6j/p+jwsKL4V/h1F9qar4Q+RBH+a6uAmvQa9LQaWm/qJGoLpEXF3HoWOgpWJmZU2knaXQnOjr30LnQTrknJ5FIOEipONnZ3jUTNc0T6+vlzrPOVrMrK3dVM1VEMyIiBNa71r+70tI5kHCQSXCpqYeAiYAOiQcHwfKn8manMzPswbbBWrYtLVpmImZ4Ijw8uK2SrSqSFRWpYCBgiSDJyVzbSdsVSYeHsBr/Gk//qqrYiHiIoHhQUCuOeo5ReqWliYqPigaPAwNKE/gTsvhZWZKbgJsSgAkJIzkXOTQXGhoQddp1ytplZYRTMVO1MdfX1VHGURPGhIQD07jTu7jQ0Nxew14fw4KC4suwy1KwKSnDmXeZtHdaWi0zETM8ER4ePUbLRvbLe3u3H/wfS/yoqAxh1mHa1m1tYk46Tlg6LCw=")),lr=function(c,t){if(c===7)return 255&t.lo;var n=8*(7-c);if(n>=32)return t.hi>>>n-32&255;var ie=32-n;return 255&(t.lo>>>n|t.hi<<ie>>>ie<<ie)},dr=[J$1(0,0),J$1(0,16),J$1(0,32),J$1(0,48),J$1(0,64),J$1(0,80),J$1(0,96),J$1(0,112),J$1(0,128),J$1(0,144),J$1(0,160),J$1(0,176),J$1(0,192),J$1(0,208),J$1(0,224),J$1(0,240)],gr=[J$1(4294967295,4294967295),J$1(4294967295,4294967279),J$1(4294967295,4294967263),J$1(4294967295,4294967247),J$1(4294967295,4294967231),J$1(4294967295,4294967215),J$1(4294967295,4294967199),J$1(4294967295,4294967183),J$1(4294967295,4294967167),J$1(4294967295,4294967151),J$1(4294967295,4294967135),J$1(4294967295,4294967119),J$1(4294967295,4294967103),J$1(4294967295,4294967087),J$1(4294967295,4294967071),J$1(4294967295,4294967055)],pr=[J$1(0,0),J$1(0,1),J$1(0,2),J$1(0,3),J$1(0,4),J$1(0,5),J$1(0,6),J$1(0,7),J$1(0,8),J$1(0,9),J$1(0,10),J$1(0,11),J$1(0,12),J$1(0,13)],vr=function(c,t){for(var n=new Array(16),ie=new Array(16),fe=0;fe<16;fe++)ie[fe]=c[fe],n[fe]=ie[fe].xor(t[fe]);for(var ae=new Array(16),le=0;le<14;le++){for(var pe=0;pe<16;pe++)n[pe].setxor64(dr[pe].plus(pr[le]).setShiftLeft(56));for(var me=0;me<16;me++)ae[me]=_$1(or[lr(0,n[me])],ir[lr(1,n[me+1&15])],ar[lr(2,n[me+2&15])],ur[lr(3,n[me+3&15])],fr[lr(4,n[me+4&15])],sr[lr(5,n[me+5&15])],cr[lr(6,n[me+6&15])],hr[lr(7,n[me+11&15])]);var ye=n;n=ae,ae=ye}for(var xe=0;xe<14;xe++){for(var Ee=0;Ee<16;Ee++)ie[Ee].setxor64(pr[xe],gr[Ee]);for(var Se=0;Se<16;Se++)ae[Se]=_$1(or[lr(0,ie[Se+1&15])],ir[lr(1,ie[Se+3&15])],ar[lr(2,ie[Se+5&15])],ur[lr(3,ie[Se+11&15])],fr[lr(4,ie[Se+0&15])],sr[lr(5,ie[Se+2&15])],cr[lr(6,ie[Se+4&15])],hr[lr(7,ie[Se+6&15])]);var Me=ie;ie=ae,ae=Me}for(var Be=0;Be<16;Be++)t[Be].setxor64(n[Be],ie[Be])},wr=function(c,t,n){var ie,fe,ae=new Array(16);if(ie=c.buffer,n<c.buffer.length-(fe=c.ptr))return $$1(ie,fe,t,t.length),void(c.ptr=fe+=t.length);for($$1(ae,0,c.state,16);n>0;){var le=c.buffer.length-fe;if(le>n&&(le=n),$$1(ie,fe,t,le),fe+=le,t=t.slice(le),n-=le,fe===c.buffer.length){var pe=rr(ie);vr(pe,ae),c.count.addOne(),fe=0}}c.state=ae,c.ptr=fe};function mr$1(c,t,n){var ie;ie=t===1?c:t===2?tr(c):function(pe){for(var me=pe.length,ye=new Array(me),xe=0;xe<me;)ye[xe]=pe.charCodeAt(xe),xe++;return ye}(c);var fe={};fe.state=new Array(16);for(var ae=0;ae<15;ae++)fe.state[ae]=new j$1(0,0);fe.state[15]=new j$1(0,512),fe.ptr=0,fe.count=new j$1(0,0),fe.buffer=new Array(128),wr(fe,ie,ie.length);var le=function(pe){var me,ye,xe,Ee,Se,Me=pe.ptr,Be=new Array(136);Be[0]=128,Me<120?(me=128-Me,ye=pe.count.plus(J$1(0,1))):(me=256-Me,ye=pe.count.plus(J$1(0,2))),function(Ie,Fe,Le,He){for(var ze=0;ze<He;)Ie[ze+1]=0,ze++}(Be,0,0,me-9),(xe=Be)[Ee=me-8]=(Se=ye).hi>>>24,xe[Ee+1]=Se.hi>>>16&255,xe[Ee+2]=Se.hi>>>8&255,xe[Ee+3]=255&Se.hi,xe[Ee+4]=Se.lo>>>24,xe[Ee+5]=Se.lo>>>16&255,xe[Ee+6]=Se.lo>>>8&255,xe[Ee+7]=255&Se.lo,wr(pe,Be,me),function(Ie){var Fe=new Array(16);(function($t,_e,se,ce){for(var de=0;de<16;)$t[de+0]=se[de].clone(),de++})(Fe,0,Ie);for(var Le=new Array(16),He=0;He<14;He++){for(var ze=0;ze<16;ze++)Fe[ze].setxor64(dr[ze].plus(pr[He]).setShiftLeft(56));for(var Je=0;Je<16;Je++)Le[Je]=_$1(or[lr(0,Fe[Je])],ir[lr(1,Fe[Je+1&15])],ar[lr(2,Fe[Je+2&15])],ur[lr(3,Fe[Je+3&15])],fr[lr(4,Fe[Je+4&15])],sr[lr(5,Fe[Je+5&15])],cr[lr(6,Fe[Je+6&15])],hr[lr(7,Fe[Je+11&15])]);var Xe=Fe;Fe=Le,Le=Xe}for(var Ue=0;Ue<16;Ue++)Ie[Ue].setxor64(Fe[Ue])}(pe.state);for(var $e=new Array(16),ke=0,Te=8;ke<8;ke++,Te++)$e[2*ke]=pe.state[Te].hi,$e[2*ke+1]=pe.state[Te].lo;return $e}(fe);return n===2?le:n===1?tr(le):function(pe){for(var me="",ye=pe.length,xe=0;xe<ye;xe++){var Ee=pe[xe];Ee<0&&(Ee=4294967295+pe[xe]+1);for(var Se=Ee.toString(16);Se.length<8;)Se="0"+Se;me+=Se}return me}(le)}for(var yr={},Br="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Er=[],br=0;br<Br.length;br++)Er.push(Br.charCodeAt(br));var Ir=[0,2,3,5,6,7,9,10,11],Ar=Er.length;function Ur(c){var t=function(pe){if(pe.length%2!=0)throw Error("Hex string has invalid length!");for(var me=new Uint8Array(pe.length/2),ye=0;ye<pe.length/2;++ye)me[ye]=parseInt(pe.slice(2*ye,2*ye+2),16);return me}(c.toString("hex"));if(t.length===0)throw Error("Unrecognised address format");var n,ie=Math.floor(t.length/8),fe=t.length%8,ae=11*ie+Ir[fe],le=new Uint8Array(ae);for(n=0;n<ae;++n)le[n]=Er[0];for(n=0;n<ie;n++)le=yr.encodeBlock(t.subarray(8*n,8*n+8),le,11*n);return fe>0&&(le=yr.encodeBlock(t.subarray(8*ie,8*ie+fe),le,11*ie)),function(pe){for(var me=[],ye=0,xe=Object.keys(pe);ye<xe.length;ye++)me.push(String.fromCharCode(pe[Number(xe[ye])]));return me.join("")}(le)}function Sr(c){var t=function(pe){for(var me=new Uint8Array(pe.length),ye=0;ye<pe.length;ye++)me[ye]=pe.charCodeAt(ye);return me}(c);if(t.length===0)throw Error("Unrecognised address format");var n=Math.floor(t.length/11),ie=t.length%11,fe=Ir.indexOf(ie);if(fe<0)throw Error("Invalid encoded length");for(var ae=new Uint8Array(8*n+fe),le=0;le<n;le++)ae=yr.decodeBlock(t.subarray(11*le,11*le+11),ae,8*le);return ie>0&&(ae=yr.decodeBlock(t.subarray(11*n,11*n+ie),ae,8*n)),Buffer$7.from(function(pe){for(var me=[],ye=0,xe=Object.keys(pe);ye<xe.length;ye++)me.push(("0"+pe[Number(xe[ye])].toString(16)).slice(-2));return me.join("")}(ae),"hex")}function xr(c,t){return("00"+(98-function(n){for(var ie=n.split("").map(function(le){var pe=le.toUpperCase().charCodeAt(0);return pe>=48&&pe<=57?le:(pe-55).toString()}).join(""),fe="",ae=0;ae<Math.ceil(ie.length/6);ae++)fe=(parseInt(fe+ie.substr(6*ae,6),10)%97).toString();return parseInt(fe,10)}(c+t+"00"))).slice(-2)}function Cr(c){return c.replace(/^0x/,"")}function Or(c){return"0x"+Cr(c)}yr.encodeBlock=function(c,t,n){if(c.length<1||c.length>11)throw Error("Invalid block length: "+c.length);for(var ie=function(le){if(le.length<1||le.length>8)throw Error("Invalid input length");var pe=L$1.zero,me=L$1(2).pow(8),ye=0;switch(9-le.length){case 1:pe=pe.add(le[ye++]);case 2:pe=pe.multiply(me).add(le[ye++]);case 3:pe=pe.multiply(me).add(le[ye++]);case 4:pe=pe.multiply(me).add(le[ye++]);case 5:pe=pe.multiply(me).add(le[ye++]);case 6:pe=pe.multiply(me).add(le[ye++]);case 7:pe=pe.multiply(me).add(le[ye++]);case 8:pe=pe.multiply(me).add(le[ye++]);break;default:throw Error("Impossible condition")}return pe}(c),fe=Ir[c.length]-1;ie.compare(0)===1;){var ae=ie.divmod(Ar);ie=ae.quotient,t[n+fe]=Er[parseInt(ae.remainder.toString(),10)],fe--}return t},yr.decodeBlock=function(c,t,n){if(c.length<1||c.length>11)throw Error("Invalid block length: "+c.length);var ie=Ir.indexOf(c.length);if(ie<=0)throw Error("Invalid block size");for(var fe=L$1(0),ae=L$1(1),le=c.length-1;le>=0;le--){var pe=Er.indexOf(c[le]);if(pe<0)throw Error("Invalid symbol");var me=ae.multiply(pe).add(fe);if(me.compare(L$1(2).pow(64))===1)throw Error("Overflow");fe=me,ae=ae.multiply(Ar)}if(ie<8&&L$1(2).pow(8*ie).compare(fe)<=0)throw Error("Overflow 2");return t.set(function(ye,xe){var Ee=new Uint8Array(xe);if(xe<1||xe>8)throw Error("Invalid input length");for(var Se=L$1(2).pow(8),Me=xe-1;Me>=0;Me--)Ee[Me]=parseInt(ye.remainder(Se).toString(),10),ye=ye.divide(Se);return Ee}(fe,ie),n),t};var Nr=bnExports$1;function qr(c,t){return typeof c=="string"&&(c=c.toLowerCase()),typeof c=="string"&&function(n){return/^0x[0-9a-f]*$/i.test(n)}(c)&&!t?new Nr(Cr(c),"hex"):new Nr(c,t)}function Tr(c){return Or(c.toString("hex"))}var Lr=qr(0),Rr=qr(2).pow(qr(251));function kr(c){return typeof c=="number"&&c==c&&c%1==0}function Fr(c){var t,n,ie=Cr(function(le){(function(me,ye,xe,Ee){var Se="invalid "+Ee+" length",Me=qr(me);(function(Be,$e){if(!Be)throw new Error($e)})(Me.gte(qr(ye))&&Me.lt(qr(xe)),"Message not signable, "+Se+".")})(le,Lr,Rr,"Starknet Address");var pe=function(me){return Or(Cr(Tr(qr(me))).padStart(64,"0"))}(le);if(!pe.match(/^(0x)?[0-9a-fA-F]{64}$/))throw new Error("Invalid Address Format");return pe}(c)).toLowerCase().split(""),fe=function(le,pe){if(pe||(pe={}),typeof le=="number"){(function(Se,Me){if(typeof Se=="number"&&(Se<0||Se>=9007199254740991||Se%1))throw Me})(le,"invalid arrayify value");for(var me=[];le;)me.unshift(255&le),le=parseInt(String(le/256),10);return me.length===0&&me.push(0),new Uint8Array(me)}if(pe.allowMissingPrefix&&typeof le=="string"&&le.substring(0,2)!=="0x"&&(le="0x"+le),function(Se){return!!Se.toHexString}(le)&&(le=le.toHexString()),function(Se,Me){return!(typeof Se!="string"||!Se.match(/^0x[0-9A-Fa-f]*$/))}(le)){var ye=le.substring(2);if(ye.length%2)if(pe.hexPad==="left")ye="0"+ye;else{if(pe.hexPad!=="right")throw Error("hex data is odd-lengthvalue"+le);ye+="0"}for(var xe=[],Ee=0;Ee<ye.length;Ee+=2)xe.push(parseInt(ye.substring(Ee,Ee+2),16));return new Uint8Array(xe)}if(function(Se){if(Se==null)return!1;if(Se.constructor===Uint8Array)return!0;if(typeof Se=="string"||!kr(Se.length)||Se.length<0)return!1;for(var Me,Be=q$1(Se);!(Me=Be()).done;){var $e=Me.value;if(!kr($e)||$e<0||$e>=256)return!1}return!0}(le))return new Uint8Array(le)}((n=(t=Cr(Tr(qr(c)))).length%2==0?t:"0"+t,Or(new sha3$1.Keccak(256).update(Buffer$7.from(function(le){if(typeof le!="string")throw new TypeError("hexToBytes: expected string, got "+typeof le);if(le.length%2)throw new Error("hexToBytes: received invalid unpadded hex");for(var pe=new Uint8Array(le.length/2),me=0;me<pe.length;me++){var ye=2*me,xe=le.slice(ye,ye+2),Ee=Number.parseInt(xe,16);if(Number.isNaN(Ee)||Ee<0)throw new Error("Invalid byte sequence");pe[me]=Ee}return pe}(n))).digest().toString("hex"))),{hexPad:"left"});if(fe===void 0)throw Error("hashed is undefined");for(var ae=0;ae<ie.length;ae+=2)fe[ae>>1]>>4>=8&&(ie[ae]=ie[ae].toUpperCase()),(15&fe[ae>>1])>=8&&(ie[ae+1]=ie[ae+1].toUpperCase());return Or(ie.join(""))}qr(2).pow(qr(128)).add(qr(1));var Mr=bech32.decode,Dr=bech32.encode,Xr=bech32.fromWords,Gr=bech32.toWords,Vr=2147483648;function Qr(c,t){return function(n){var ie;switch(n.readUInt8(0)){case 118:if(n.readUInt8(1)!==169||n.readUInt8(n.length-2)!==136||n.readUInt8(n.length-1)!==172)throw Error("Unrecognised address format");return ie=Buffer$7.concat([Buffer$7.from(c),n.slice(3,3+n.readUInt8(2))]),Ut$1(ie);case 169:if(n.readUInt8(n.length-1)!==135)throw Error("Unrecognised address format");return ie=Buffer$7.concat([Buffer$7.from(t),n.slice(2,2+n.readUInt8(1))]),Ut$1(ie);default:throw Error("Unrecognised address format")}}}function Wr(c,t){return function(n){var ie=Ct$1(n),fe=function(ae){return ae.every(function(le,pe){return pe<ie.length&&le===ie.readUInt8(pe)})};if(c.some(fe))return Buffer$7.concat([Buffer$7.from([118,169,20]),ie.slice(c[0].length),Buffer$7.from([136,172])]);if(t.some(fe))return Buffer$7.concat([Buffer$7.from([169,20]),ie.slice(t[0].length),Buffer$7.from([135])]);throw Error("Unrecognised address format")}}var Pr=function(c,t,n,ie){return{coinType:t,decoder:Wr(n,ie),encoder:Qr(n[0],ie[0]),name:c}};function zr(c){return function(t){var n=t.readUInt8(0);if(n>=81&&n<=96)n-=80;else if(n!==0)throw Error("Unrecognised address format");var ie=[n].concat(Gr(t.slice(2,t.readUInt8(1)+2)));return Dr(c,ie)}}function Kr(c){return function(t){var n=Mr(t),ie=n.words;if(n.prefix!==c)throw Error("Unexpected human-readable part in bech32 encoded address");var fe=Xr(ie.slice(1)),ae=ie[0];return ae>0&&(ae+=80),Buffer$7.concat([Buffer$7.from([ae,fe.length]),Buffer$7.from(fe)])}}function Hr(c,t,n){var ie=zr(c),fe=Qr(t,n);return function(ae){try{return fe(ae)}catch{return ie(ae)}}}function Zr(c,t,n){var ie=Kr(c),fe=Wr(t,n);return function(ae){return ae.toLowerCase().startsWith(c+"1")?ie(ae):fe(ae)}}var Yr=function(c,t,n,ie,fe){return{coinType:t,decoder:Zr(n,ie,fe),encoder:Hr(n,ie[0],fe[0]),name:c}};function jr(c,t,n){var ie=ut(c),fe=Qr(t,n);return function(ae){try{return fe(ae)}catch{return ie(ae)}}}function Jr(c,t,n){var ie=Wr(t,n),fe=ft(c);return function(ae){return ae.toLowerCase().startsWith(c)?fe(ae):ie(ae)}}var _r=function(c,t,n,ie,fe){return{coinType:t,decoder:Jr(n,ie,fe),encoder:jr(n,ie[0],fe[0]),name:c}};function $r(c){var t,n=(t=mr$1(c,1,2),tr(t=(t=mr$1(t,2,2)).slice(0,8)));return Buffer$7.from(n)}function rt(c){var t=$r(c);return bs58$2.encode(Buffer$7.concat([c,t],c.length+4))}function tt(c){return function(t){return C$1(t.toString("hex"),c||null)}}function et(c){return function(t){var n=O$1(t);if(!U$1(t,c||null)&&n!==n.toLowerCase()&&n!==n.toUpperCase())throw Error("Invalid address checksum");return Buffer$7.from(O$1(t),"hex")}}var nt=function(c,t,n){return{coinType:t,decoder:et(n),encoder:tt(n),name:c}},ot=function(c){if(c>=2147483648)throw Error("chainId "+c+" must be less than 2147483648");return(2147483648|c)>>>0},it=function(c){if(!(2147483648&c))throw Error("coinType "+c+" is not an EVM chain");return(2147483647&c)>>0},at=function(c,t){return{coinType:ot(t),decoder:et(),encoder:tt(),name:c}};function ut(c,t){return function(n){return Dr(c,Gr(n),t)}}function ft(c,t){return function(n){var ie=Mr(n,t),fe=ie.words;if(ie.prefix!==c)throw Error("Unrecognised address format");return Buffer$7.from(Xr(fe))}}var st=function(c,t,n,ie){return{coinType:t,decoder:ft(n,ie),encoder:ut(n,ie),name:c}};function ct(c){return function(t){if(!J$2.isValid(t))throw Error("Unrecognised address format");return J$2.fromHex(t).toString().replace(/^.{3}/g,c)}}function ht(c){return function(t){if(!J$2.isValid(t))throw Error("Unrecognised address format");var n=new RegExp("^.{"+c.length+"}","g"),ie=t.replace(n,"EOS");return J$2(ie).toBuffer()}}var lt=function(c,t,n){return{coinType:t,decoder:ht(n),encoder:ct(n),name:c}};function dt(c){return Buffer$7.from(gt$1(c))}function gt(c){for(var t,n=O$1(c).toLowerCase(),ie=new sha3$1.Keccak(256).update(Buffer$7.from(n)).digest(),fe="0x",ae=n.length,le=0;le<ae;le++)t=ie[Math.floor(le/2)],le%2==0?t>>=4:t&=15,fe+=n[le]>"9"&&t<=7?n[le].toUpperCase():n[le];return fe}function pt(c){if(c.readInt8(0)!==5||c.readInt8(1)!==77||c.length!==26)return!1;var t,n=c.slice(-4),ie=(t=c.slice(0,-4),new sha3$1.Keccak(256).update(Buffer$7.from(blakejs.blake2b(Uint8Array.from(t),null,32))).digest().slice(0,4));return n.equals(ie)}var vt=[0,0,1,18,2,5,19,11,3,29,6,27,20,8,12,23,4,10,30,17,7,22,28,26,21,25,9,16,13,14,24,15],wt=[1,2,4,8,16,5,10,20,13,26,17,7,14,28,29,31,27,19,3,6,12,24,21,15,30,25,23,11,22,9,18,1],mt="23456789ABCDEFGHJKLMNPQRSTUVWXYZ",yt=[3,2,1,0,7,6,5,4,13,14,15,16,12,8,9,10,11];function Bt(c){return sha512Exports.sha512_256.update(c).hex().substr(-8)}var Et,bt,It,At,Ut,St,xt,Ct,Ot=function(c,t,n,ie){return{coinType:t,decoder:ie,encoder:n,name:c}},Nt=[Yr("BTC",0,"bc",[[0]],[[5]]),Yr("LTC",2,"ltc",[[48]],[[50],[5]]),Pr("DOGE",3,[[30]],[[22]]),Pr("RDD",4,[[61]],[[5]]),Pr("DASH",5,[[76]],[[16]]),Pr("PPC",6,[[55]],[[117]]),Ot("NMC",7,Ut$1,Ct$1),Pr("VIA",14,[[71]],[[33]]),(Et=[[36]],bt=[[5]],{coinType:17,decoder:function(c,t,n){var ie=Kr("grs"),fe=function(ae,le){return function(pe){var me=function(xe){var Ee=function(Se){var Me=Se.slice(0,-4),Be=Se.slice(-4),$e=$r(Me);return Be[0]^$e[0]|Be[1]^$e[1]|Be[2]^$e[2]|Be[3]^$e[3]?Buffer$7.from([]):Me}(bs58$2.decode(xe));if(Ee.length===0)throw new Error("Invalid checksum");return Ee}(pe),ye=function(xe){return xe.every(function(Ee,Se){return Se<me.length&&Ee===me.readUInt8(Se)})};if(ae.some(ye))return Buffer$7.concat([Buffer$7.from([118,169,20]),me.slice(ae[0].length),Buffer$7.from([136,172])]);if(le.some(ye))return Buffer$7.concat([Buffer$7.from([169,20]),me.slice(le[0].length),Buffer$7.from([135])]);throw Error("Unrecognised address format")}}(t,n);return function(ae){return ae.toLowerCase().startsWith("grs1")?ie(ae):fe(ae)}}(0,Et,bt),encoder:(At=Et[0],Ut=bt[0],St=zr("grs"),xt=function(c,t){return function(n){switch(n.readUInt8(0)){case 118:if(n.readUInt8(1)!==169||n.readUInt8(n.length-2)!==136||n.readUInt8(n.length-1)!==172)throw Error("Unrecognised address format");return rt(Buffer$7.concat([Buffer$7.from(c),n.slice(3,3+n.readUInt8(2))]));case 169:if(n.readUInt8(n.length-1)!==135)throw Error("Unrecognised address format");return rt(Buffer$7.concat([Buffer$7.from(t),n.slice(2,2+n.readUInt8(1))]));default:throw Error("Unrecognised address format")}}}(At,Ut),function(c){try{return xt(c)}catch{return St(c)}}),name:"GRS"}),Yr("DGB",20,"dgb",[[30]],[[63]]),Yr("MONA",22,"mona",[[50]],[[55],[5]]),Ot("DCR",42,bs58$2.encode,bs58$2.decode),Ot("XEM",43,function(c){return d$1(s(c.toString("hex")))},function(c){if(!p$1(c))throw Error("Unrecognised address format");var t=c.toString().toUpperCase().replace(/-/g,"");return l$1(t)}),Pr("AIB",55,[[23]],[[5]]),Yr("SYS",57,"sys",[[63]],[[5]]),nt("ETH",60),nt("ETC_LEGACY",61),Ot("ICX",74,function(c){if(c.length!==21)throw Error("Unrecognised address format");switch(c.readUInt8(0)){case 0:return"hx"+c.slice(1).toString("hex");case 1:return"cx"+c.slice(1).toString("hex");default:throw Error("Unrecognised address format")}},function(c){var t=c.slice(0,2),n=c.slice(2);switch(t){case"hx":return Buffer$7.concat([Buffer$7.from([0]),Buffer$7.from(n,"hex")]);case"cx":return Buffer$7.concat([Buffer$7.from([1]),Buffer$7.from(n,"hex")]);default:throw Error("Unrecognised address format")}}),Pr("XVG",77,[[30]],[[33]]),Pr("STRAT",105,[[63]],[[125]]),Ot("ARK",111,Ut$1,function(c){var t=Ct$1(c);if(t[0]!==23)throw Error("Unrecognised address format");return t}),st("ATOM",118,"cosmos"),st("ZIL",119,"zil"),st("EGLD",120,"erd"),Ot("ZEN",121,function(c){if(!(c.slice(0,2).equals(Buffer$7.from([32,137]))||c.slice(0,2).equals(Buffer$7.from([28,184]))||c.slice(0,2).equals(Buffer$7.from([32,150]))||c.slice(0,2).equals(Buffer$7.from([28,189]))||c.slice(0,2).equals(Buffer$7.from([22,154]))))throw Error("Unrecognised address format");return Ut$1(c)},function(c){if(!(c.startsWith("zn")||c.startsWith("zs")||c.startsWith("zc")||c.startsWith("t1")||c.startsWith("t3")))throw Error("Unrecognised address format");return Ct$1(c)}),Ot("XMR",128,Ur,Sr),_r("ZEC",133,"zs",[[28,184]],[[28,189]]),Ot("LSK",134,function(c){return L$1(c.toString("hex"),16).toString(10)+"L"},function(c){return function(t){if(t.length<2||t.length>22)throw new Error("Address length does not match requirements. Expected between 2 and 22 characters.");if(t[t.length-1]!=="L")throw new Error('Address format does not match requirements. Expected "L" at the end.');if(t.includes("."))throw new Error("Address format does not match requirements. Address includes invalid character: `.`.")}(c),Buffer$7.from(L$1(c.slice(0,-1)).toString(16),"hex")}),lt("STEEM",135,"STM"),Pr("FIRO",136,[[82]],[[7]]),nt("RSK",137,30),Pr("KMD",141,[[60]],[[85]]),Ot("XRP",144,function(c){return k$2.encodeChecked(c)},function(c){return k$2.decodeChecked(c)}),Ot("BCH",145,function(c){switch(c.readUInt8(0)){case 118:if(c.readUInt8(1)!==169||c.readUInt8(c.length-2)!==136||c.readUInt8(c.length-1)!==172)throw Error("Unrecognised address format");return zt("bitcoincash",0,c.slice(3,3+c.readUInt8(2)));case 169:if(c.readUInt8(c.length-1)!==135)throw Error("Unrecognised address format");return zt("bitcoincash",1,c.slice(2,2+c.readUInt8(1)));default:throw Error("Unrecognised address format")}},function(c){var t=Wr([[0]],[[5]]);try{return t(c)}catch{return function(ie){var fe=kt(ie),ae=fe.type,le=fe.hash;if(ae===0)return Buffer$7.concat([Buffer$7.from([118,169,20]),Buffer$7.from(le),Buffer$7.from([136,172])]);if(ae===1)return Buffer$7.concat([Buffer$7.from([169,20]),Buffer$7.from(le),Buffer$7.from([135])]);throw Error("Unrecognised address format")}(c)}}),Ot("XLM",148,function(c){return it$1("ed25519PublicKey",c)},function(c){return nt$1("ed25519PublicKey",c)}),Ot("BTM",153,zr("bm"),Kr("bm")),Yr("BTG",156,"btg",[[38]],[[23]]),Ot("NANO",165,function(c){var t=nanoBase32.encode(Uint8Array.from(c)),n=blakejs.blake2b(Uint8Array.from(c),null,5).reverse();return"nano_"+t+nanoBase32.encode(n)},function(c){var t=nanoBase32.decode(c.slice(5));return Buffer$7.from(t).slice(0,-5)}),Pr("RVN",175,[[60]],[[122]]),nt("POA_LEGACY",178),Yr("LCC",192,"lcc",[[28]],[[50],[5]]),lt("EOS",194,"EOS"),Ot("TRX",195,Ut$1,Ct$1),Ot("BCN",204,function(c){var t=new sha3$1.Keccak(256).update(c).digest().slice(0,4);return Ur(Buffer$7.concat([c,t]))},function(c){var t=Sr(c),n=t.slice(0,-68).toString("hex");if(t.length<68||n!=="06"&&n!=="cef622")throw Error("Unrecognised address format");var ie=t.slice(-4);if(!new sha3$1.Keccak(256).update(t.slice(0,-4)).digest().slice(0,4).equals(ie))throw Error("Invalid checksum");return t.slice(0,-4)}),lt("FIO",235,"FIO"),Ot("BSV",236,function(c){var t=Buffer$7.concat([Buffer$7.from([0]),c]);return Ut$1(t)},function(c){var t=Ct$1(c);if(t.length!==21)throw Error("Unrecognised address format");if(t[0]!==0)throw Error("Invalid version byte");return t.slice(1)}),Ot("NEO",239,Ut$1,Ct$1),Ot("NIM",242,function(c){var t=function(n,ie){ie===void 0&&(ie="0123456789ABCDEFGHJKLMNPQRSTUVXY");var fe,ae,le=3,pe=0,me="";for(ae=0;ae<n.length;ae++)me+=ie[31&(pe|(fe=n[ae])>>le)],le>5&&(me+=ie[31&fe>>(le-=5)]),pe=fe<<(le=5-le),le=8-le;for(le!==3&&(me+=ie[31&pe]);me.length%8!=0&&ie.length===33;)me+=ie[32];return me}(c);return("NQ"+xr(t,"NQ")+t).replace(/.{4}/g,"$& ").trim()},function(c){if(!c.startsWith("NQ"))throw Error("Unrecognised address format");var t=c.replace(/ /g,""),n=t.slice(2,4),ie=t.slice(4);if(n!==xr(ie,"NQ"))throw Error("Unrecognised address format");return function(fe,ae){ae===void 0&&(ae="0123456789ABCDEFGHJKLMNPQRSTUVXY");var le,pe={};ae.toUpperCase().split("").forEach(function(Ee,Se){Ee in pe||(pe[Ee]=Se)});var me=8,ye=0,xe=[];return fe.toUpperCase().split("").forEach(function(Ee){ae.length===33&&Ee===ae[32]||(le=255&pe[Ee],(me-=5)>0?ye|=le<<me:me<0?(xe.push(ye|le>>-me),ye=le<<(me+=8)&255):(xe.push(ye|le),me=8,ye=0))}),me!==8&&ye!==0&&xe.push(ye),Buffer$7.from(xe)}(ie)}),nt("EWT_LEGACY",246),Ot("ALGO",283,function(c){var t=Bt(c);return d$1(s(c.toString("hex").concat(t))).replace(/=/g,"")},function(c){var t=l$1(c);if(t.length!==36)throw Error("Unrecognised address format");var n=t.slice(0,-4),ie=t.slice(-4),fe=Bt(n);if(ie.toString("hex")!==fe)throw Error("Unrecognised address format");return n}),Ot("IOST",291,bs58$2.encode,bs58$2.decode),Pr("DIVI",301,[[30]],[[13]]),st("IOTX",304,"io"),lt("BTS",308,"BTS"),st("CKB",309,"ckb"),Ot("MRX",326,Ut$1,Ct$1),st("LUNA",330,"terra"),Ot("DOT",354,function(c){return yt$1(Uint8Array.from(c),0)},dt),Ot("VSYS",360,function(c){if(!pt(c))throw new Error("VSYS: Invalid checksum");return bs58$2.encode(c)},function(c){var t=c;if(c.startsWith("address:")&&(t=c.substr(c.length)),t.length>36)throw new Error("VSYS: Address length should not be more than 36");var n=bs58$2.decode(t);if(!pt(n))throw new Error("VSYS: Invalid checksum");return n}),lt("ABBC",367,"ABBC"),Ot("NEAR",397,function(c){var t=c.toString();if(t.length>64||t.length<2)throw Error("Invalid address format");return t},function(c){if(/(^(([a-z\d]+[\-_])*[a-z\d]+\.)*([a-z\d]+[\-_])*[a-z\d]+$)/g.test(c)){if(c.length>64||c.length<2)throw Error("Invalid address format");return Buffer$7.from(c)}throw Error("Invalid address string")}),Ot("ETN",415,function(c){var t=Buffer$7.concat([Buffer$7.from([18]),c]),n=new sha3$1.Keccak(256).update(t).digest().slice(0,4);return Ur(Buffer$7.concat([t,n]))},function(c){var t=Sr(c);if(t[0]!==18)throw Error("Unrecognised address format");var n=t.slice(65,69);if(!new sha3$1.Keccak(256).update(t.slice(0,65)).digest().slice(0,4).equals(n))throw Error("Invalid checksum");return t.slice(1,65)}),Ot("AION",425,function(c){return"0x".concat(c.toString("hex"))},function(c){var t=c;if(t==null||t.length===0||t.length<64||(t.startsWith("0x")&&(t=t.slice(2)),t.startsWith("a0")&&(t.length!==64||!t.substring(2).match("^[0-9A-Fa-f]+$"))))throw Error("Unrecognised address format");return Buffer$7.from(t,"hex")}),Ot("KSM",434,function(c){return yt$1(Uint8Array.from(c),2)},dt),Ot("AE",457,function(c){return"ak_"+Ut$1(c.slice(2))},function(c){return Buffer$7.concat([Buffer$7.from("0x"),Ct$1(c.split("_")[1])])}),st("KAVA",459,"kava"),Ot("FIL",461,function(c){return K$1("f",H$1(c[0],c.slice(1))).toString()},function(c){return function(t){(function(Me){if(!Me)throw Error("No bytes to validate.");if(Me.length<3)throw Error("Address is too short to validate.");if(Me[0]!=="f"&&Me[0]!=="t")throw Error("Unknown address network.");switch(Me[1]){case"0":if(Me.length>22)throw Error("Invalid ID address length.");break;case"1":if(Me.length!==41)throw Error("Invalid secp256k1 address length.");break;case"2":if(Me.length!==41)throw Error("Invalid Actor address length.");break;case"3":if(Me.length!==86)throw Error("Invalid BLS address length.");break;default:throw new Error("Invalid address protocol.")}})(t);var n,ie=t[0],fe=parseInt(t[1],10),ae=Buffer$7.from([fe]),le=t.slice(2);if(fe===0)return H$1(fe,Buffer$7.from((function(Me,Be){for(var $e=new Q$1(Me);;){var ke=$e.maskn(7).toNumber();if($e.ishrn(7),$e.isZero()){Be.write([ke]);break}Be.write([128|ke])}}(le,n=new W$1),n.buffer)));var pe,me,ye=Buffer$7.from(l$1(le.toUpperCase())),xe=ye.length,Ee=ye.slice(0,xe-4);if(pe=ye.slice(xe-4,xe),me=z$1(Buffer$7.concat([ae,Ee])),Buffer$7.compare(Buffer$7.from(me),pe))throw Error("Checksums don't match");var Se=H$1(fe,Ee);if(K$1(ie,Se)!==t)throw Error("Did not encode this address properly: "+t);return Se}(c).str}),Ot("AR",472,function(c){return c.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")},function(c){return c=(c=c.replace(/\-/g,"+").replace(/\_/g,"/")).concat("=".repeat(c.length%4==0?0:4-c.length%4)),Buffer$7.from(c,"base64")}),Pr("CCA",489,[[11]],[[5]]),nt("THETA_LEGACY",500),Ot("SOL",501,bs58$2.encode,bs58$2.decode),Ot("XHV",535,Ur,Sr),Ot("FLOW",539,function(c){var t=Buffer$7.alloc(8,0);return c.length>8&&(t=c.slice(-8)),c.copy(t,8-c.length),"0x"+t.toString("hex").toLowerCase()},function(c){if(!function(t,n){var ie=t;if((ie=BigInt(ie)^BigInt(n.codeword))===BigInt(0))return!1;for(var fe=BigInt(0),ae=0;ae<64;ae++)(BigInt(ie)&BigInt(1))===BigInt(1)&&(fe=BigInt(fe)^BigInt(Z$1[ae])),ie=BigInt(ie)>>BigInt(1);return fe===BigInt(0)&&ie===BigInt(0)}(BigInt(c),Y$1.mainnet))throw Error("Unrecognised address format");return Buffer$7.from(O$1(c).replace(/^0+/,""),"hex")}),st("IRIS",566,"iaa"),Pr("LRG",568,[[30]],[[13]]),Ot("SERO",569,function(c){return bs58$2.encode(c)},function(c){var t=bs58$2.decode(c);if(t.length===96)return t;throw Error("Unrecognised address format")}),Ot("BDX",570,Ur,Sr),Yr("CCXX",571,"ccx",[[137]],[[75],[5]]),Ot("SRM",573,bs58$2.encode,bs58$2.decode),Ot("VLX",574,bs58$2.encode,bs58$2.decode),Pr("BPS",576,[[0]],[[5]]),nt("TFUEL",589),st("GRIN",592,"grin"),nt("GNO_LEGACY",700),nt("VET",703),st("BNB",714,"bnb"),nt("CLO_LEGACY",820),lt("HIVE",825,"STM"),nt("TOMO_LEGACY",889),Ot("HNT",904,function(c){var t=Buffer$7.concat([Buffer$7.from([0]),c]);return Ut$1(t)},function(c){var t=Ct$1(c);if(t[0]!==0)throw Error("Invalid version byte");return t.slice(1)}),st("RUNE",931,"thor"),Yr("BCD",999,"bcd",[[0]],[[5]]),nt("TT_LEGACY",1001),nt("FTM_LEGACY",1007),st("ONE",1023,"one"),Ot("ONT",1024,function(c){return Ut$1(Buffer$7.concat([Buffer$7.from([23]),c]))},function(c){var t=Ct$1(c);switch(t.readUInt8(0)){case 23:return t.slice(1);default:throw Error("Unrecognised address format")}}),st("NOSTR",1237,"npub"),{coinType:1729,decoder:function(c){var t=Ct$1(c).slice(3);switch(c.substring(0,3)){case"tz1":return Buffer$7.concat([Buffer$7.from([0,0]),t]);case"tz2":return Buffer$7.concat([Buffer$7.from([0,1]),t]);case"tz3":return Buffer$7.concat([Buffer$7.from([0,2]),t]);case"KT1":return Buffer$7.concat([Buffer$7.from([1]),t,Buffer$7.from([0])]);default:throw Error("Unrecognised address format")}},encoder:function(c){if(c.length!==22&&c.length!==21)throw Error("Unrecognised address format");var t;switch(c.readUInt8(0)){case 0:if(c.readUInt8(1)===0)t=Buffer$7.from([6,161,159]);else if(c.readUInt8(1)===1)t=Buffer$7.from([6,161,161]);else{if(c.readUInt8(1)!==2)throw Error("Unrecognised address format");t=Buffer$7.from([6,161,164])}return Ut$1(Buffer$7.concat([t,c.slice(2)]));case 1:return t=Buffer$7.from([2,90,121]),Ut$1(Buffer$7.concat([t,c.slice(1,21)]));default:throw Error("Unrecognised address format")}},name:"XTZ"},{coinType:1815,decoder:function(c){var t=ft("addr",104);return function(n){return n.toLowerCase().startsWith("addr")?t(n):function(ie){var fe=bs58$2.decode(ie),ae=function(ye,xe,Ee){var Se=new DataView(ye),Me=new Uint8Array(ye),Be=0;function $e(Ue,$t){return Be+=Ue,$t}function ke(Ue){return $e(Ue,new Uint8Array(ye,Be,Ue))}function Te(){return $e(1,Me[Be])}function Ie(){return $e(2,Se.getUint16(Be))}function Fe(){return $e(4,Se.getUint32(Be))}function Le(){return Me[Be]===255&&(Be+=1,!0)}function He(Ue){if(Ue<24)return Ue;if(Ue===24)return Te();if(Ue===25)return Ie();if(Ue===26)return Fe();if(Ue===27)return 4294967296*Fe()+Fe();if(Ue===31)return-1;throw new Error("Invalid length encoding")}function ze(Ue){var $t=Te();if($t===255)return-1;var _e=He(31&$t);if(_e<0||$t>>5!==Ue)throw new Error("Invalid indefinite length element");return _e}function Je(Ue,$t){for(var _e=0;_e<$t;++_e){var se=Te();128&se&&(se<224?(se=(31&se)<<6|63&Te(),$t-=1):se<240?(se=(15&se)<<12|(63&Te())<<6|63&Te(),$t-=2):(se=(15&se)<<18|(63&Te())<<12|(63&Te())<<6|63&Te(),$t-=3)),se<65536?Ue.push(se):(Ue.push(55296|(se-=65536)>>10),Ue.push(56320|1023&se))}}var Xe=function Ue(){var $t,_e,se,ce=Te(),de=ce>>5,he=31&ce;if(de===7)switch(he){case 25:return function(){var qe=new ArrayBuffer(4),Pe=new DataView(qe),Ge=Ie(),Ce=32768&Ge,De=31744&Ge,je=1023&Ge;if(De===31744)De=261120;else if(De!==0)De+=114688;else if(je!==0)return(Ce?-1:1)*je*5960464477539063e-23;return Pe.setUint32(0,Ce<<16|De<<13|je<<13),Pe.getFloat32(0)}();case 26:return $e(4,Se.getFloat32(Be));case 27:return $e(8,Se.getFloat64(Be))}if((_e=He(he))<0&&(de<2||6<de))throw new Error("Invalid length");switch(de){case 0:return _e;case 1:return-1-_e;case 2:if(_e<0){var ve=[],we=0;for(_e=ze(de);_e>=0;)we+=_e,ve.push(ke(_e));var Ae=new Uint8Array(we),be=0;for($t=0;$t<ve.length;++$t)Ae.set(ve[$t],be),be+=ve[$t].length;return Ae}return ke(_e);case 3:var ue=[];if(_e<0)for(_e=ze(de);_e>=0;)Je(ue,_e);else Je(ue,_e);var ge="";for($t=0;$t<ue.length;$t+=8192)ge+=String.fromCharCode.apply(null,ue.slice($t,$t+8192));return ge;case 4:var Re;if(_e<0)for(Re=[];!Le();)Re.push(Ue());else for(Re=new Array(_e),$t=0;$t<_e;++$t)Re[$t]=Ue();return Re;case 5:var Ne={};for($t=0;$t<_e||_e<0&&!Le();++$t)Ne[Ue()]=Ue();return Ne;case 6:return se=Ue(),new G$1(se,_e);case 7:switch(_e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:return function(qe){return new V$1(qe)}(_e)}}}();if(Be!==ye.byteLength)throw new Error("Remaining bytes");return Xe}(fe.buffer.slice(fe.byteOffset,fe.byteOffset+fe.byteLength)),le=ae[0];if(le===void 0)throw Error("Unrecognised address format");var pe=ae[1],me=crcExports.crc32(le.value);if(parseInt(me,16)!==pe)throw Error("Unrecognised address format");return Buffer$7.from(le.value)}(n)}}(),encoder:function(c){var t=ut("addr",104);return function(n){try{return function(ie){var fe=crcExports.crc32(ie),ae=function(pe){var me,ye=new ArrayBuffer(256),xe=new DataView(ye),Ee=new Uint8Array(ye),Se=0;function Me(Xe){for(var Ue=ye.byteLength,$t=Se+Xe;Ue<$t;)Ue<<=1;if(Ue!==ye.byteLength){var _e=xe;ye=new ArrayBuffer(Ue),xe=new DataView(ye),Ee=new Uint8Array(ye);for(var se=Se+3>>2,ce=0;ce<se;++ce)xe.setUint32(ce<<2,_e.getUint32(ce<<2))}return me=Xe,xe}function Be(){Se+=me}function $e(Xe){Be(Me(1).setUint8(Se,Xe))}function ke(Xe){Me(Xe.length),Ee.set(Xe,Se),Be()}function Te(Xe){Be(Me(2).setUint16(Se,Xe))}function Ie(Xe){Be(Me(4).setUint32(Se,Xe))}function Fe(Xe){var Ue=Xe%4294967296,$t=(Xe-Ue)/4294967296,_e=Me(8);_e.setUint32(Se,$t),_e.setUint32(Se+4,Ue),Be()}function Le(Xe,Ue){Ue<24?$e(Xe<<5|Ue):Ue<256?($e(Xe<<5|24),$e(Ue)):Ue<65536?($e(Xe<<5|25),Te(Ue)):Ue<4294967296?($e(Xe<<5|26),Ie(Ue)):($e(Xe<<5|27),Fe(Ue))}if(function Xe(Ue){var $t,_e;if(Ue===!1)return $e(244);if(Ue===!0)return $e(245);if(Ue===null)return $e(246);if(Ue===void 0)return $e(247);if(_e=Ue,typeof Object.is=="function"?Object.is(_e,-0):_e===-0&&(_e!==0||1/_e==-1/0))return ke([249,128,0]);switch(typeof Ue){case"number":if(Math.floor(Ue)===Ue){if(0<=Ue&&Ue<=9007199254740992)return Le(0,Ue);if(-9007199254740992<=Ue&&Ue<0)return Le(1,-(Ue+1))}return $e(251),function(Ae){Be(Me(8).setFloat64(Se,Ae))}(Ue);case"string":var se=[];for($t=0;$t<Ue.length;$t++){var ce=Ue.charCodeAt($t);ce<128?se.push(ce):ce<2048?(se.push(192|ce>>6),se.push(128|63&ce)):(ce=(1023&ce)<<10,ce|=1023&Ue.charCodeAt(++$t),se.push(240|(ce+=65536)>>18),se.push(128|ce>>12&63),se.push(128|ce>>6&63),se.push(128|63&ce))}return Le(3,se.length),ke(se);default:var de,he;if(Array.isArray(Ue))for(Le(4,de=Ue.length),$t=0;$t<de;$t++)Xe(Ue[$t]);else if(Ue instanceof Uint8Array)Le(2,Ue.length),ke(Ue);else if(ArrayBuffer.isView(Ue))Le(2,(he=new Uint8Array(Ue.buffer)).length),ke(he);else if(Ue instanceof ArrayBuffer||typeof SharedArrayBuffer=="function"&&Ue instanceof SharedArrayBuffer)Le(2,(he=new Uint8Array(Ue)).length),ke(he);else if(Ue instanceof G$1)(function(Ae,be){Ae<=255?Ae<24?$e(192|Ae):($e(216),$e(Ae)):Ae<=65535?($e(217),Te(Ae)):Ae<=4294967295?($e(218),Ie(Ae)):($e(219),Fe(Ae))})(Ue.tag),Xe(Ue.value);else{var ve=Object.keys(Ue);for(Le(5,de=ve.length),$t=0;$t<de;$t++){var we=ve[$t];Xe(we),Xe(Ue[we])}}}}(pe),"slice"in ye)return ye.slice(0,Se);for(var He=new ArrayBuffer(Se),ze=new DataView(He),Je=0;Je<Se;++Je)ze.setUint8(Je,xe.getUint8(Je));return He}([new G$1(ie.buffer.slice(ie.byteOffset,ie.byteOffset+ie.byteLength),24),parseInt(fe,16)]),le=bs58$2.encode(Buffer$7.from(ae));if(!le.startsWith("Ae2")&&!le.startsWith("Ddz"))throw Error("Unrecognised address format");return le}(n)}catch{return t(n)}}}(),name:"ADA"},Ot("SC",1991,function(c){var t=blakejs.blake2bHex(Uint8Array.from(c),null,32).slice(0,12);return c.toString("hex")+t},function(c){if(c.length!==76)throw Error("Unrecognised address format");var t=Buffer$7.from(c.slice(0,64),"hex");if(c.slice(64)!==blakejs.blake2bHex(Uint8Array.from(t),null,32).slice(0,12))throw Error("Unrecognised address format");return t}),Ot("QTUM",2301,Ut$1,Ct$1),lt("GXC",2303,"GXC"),Ot("ELA",2305,bs58$2.encode,bs58$2.decode),Ot("NAS",2718,function(c){var t=new sha3$1.SHA3(256).update(c).digest().slice(0,4);return bs58$2.encode(Buffer$7.concat([c,t]))},function(c){var t=bs58$2.decode(c);if(t.length!==26||t[0]!==25||t[1]!==87&&t[1]!==88)throw Error("Unrecognised address format");var n=t.slice(0,22),ie=t.slice(-4);if(!new sha3$1.SHA3(256).update(n).digest().slice(0,4).equals(ie))throw Error("Invalid checksum");return n}),{coinType:3030,decoder:function(c){var t=Buffer$7.alloc(20),n=new DataView(t.buffer,0,20),ie=c.split(".");if(ie.length!==3)throw Error("Unrecognised address format");var fe=Number(ie[0]),ae=BigInt(ie[1]),le=BigInt(ie[2]);return n.setUint32(0,fe),n.setBigUint64(4,ae),n.setBigUint64(12,le),t},encoder:function(c){if(c.length!==20)throw Error("Unrecognised address format");var t=new DataView(c.buffer,0);return[t.getUint32(0),t.getBigUint64(4),t.getBigUint64(12)].join(".")},name:"HBAR"},{coinType:4218,decoder:function(c){var t=Mr(c,void 0),n=t.words;if(t.prefix!=="iota")throw Error("Unrecognised address format");return Buffer$7.from(Xr(n)).slice(1)},encoder:(Ct=Buffer$7.from([0]),function(c){return Dr("iota",Gr(Buffer$7.concat([Ct,c])),void 0)}),name:"IOTA"},Ot("HNS",5353,function(c){if(c.length!==20)throw Error("P2WPKH must be 20 bytes");var t=[0].concat(Gr(c));return Dr("hs",t)},function(c){var t=Mr(c),n=t.words;if(t.prefix!=="hs")throw Error("Unrecognised address format");var ie=n[0],fe=Xr(n.slice(1));if(ie!==0)throw Error("Bad program version");if(fe.length!==20)throw Error("Witness program hash is the wrong size");return Buffer$7.from(fe)}),Ot("STX",5757,function(c){var t=c.toString("hex"),n=t.substring(0,t.length-8);if(!n.match(/^[0-9a-fA-F]{40}$/))throw new Error("Invalid argument: not a hash160 hex string");(n=n.toLowerCase()).length%2!=0&&(n="0"+n);var ie={p2pkh:22,p2sh:20},fe=t.slice(-8),ae="",le="";return fe===M$1(""+ie.p2pkh.toString(16)+n)?(le="P",ae=D$1(""+n+fe)):fe===M$1(""+ie.p2sh.toString(16)+n)&&(le="M",ae=D$1(""+n+fe)),"S"+le+ae},function(c){if(c.length<=5)throw new Error("Invalid c32 address: invalid length");if(c[0]!=="S")throw new Error('Invalid c32 address: must start with "S"');var t=X$1(c.slice(1)),n=R$1.indexOf(t[0]).toString(16);n.length===1&&(n="0"+n);var ie=function(ae){if(!(ae=X$1(ae)).match("^["+R$1+"]*$"))throw new Error("Not a c32-encoded string");for(var le=ae.match("^"+R$1[0]+"*"),pe=le?le[0].length:0,me=[],ye=0,xe=0,Ee=ae.length-1;Ee>=0;Ee--){xe===4&&(me.unshift(k$1[ye]),xe=0,ye=0);var Se=(R$1.indexOf(ae[Ee])<<xe)+ye,Me=k$1[Se%16];if((ye=Se>>4)>1<<(xe+=1))throw new Error("Panic error in decoding.");me.unshift(Me)}me.unshift(k$1[ye]),me.length%2==1&&me.unshift("0");for(var Be=0,$e=0;$e<me.length&&me[$e]==="0";$e++)Be++;for(var ke=(me=me.slice(Be-Be%2)).join(""),Te=0;Te<pe;Te++)ke="00"+ke;return ke}(t.slice(1)),fe=ie.slice(-8);if(M$1(""+n+ie.substring(0,ie.length-8))!==fe)throw new Error("Invalid c32check string: checksum mismatch");return Buffer$7.from(ie,"hex")}),nt("GO_LEGACY",6060),{coinType:8444,decoder:function(c){var t=bech32m.decode(c,90),n=t.words;if(t.prefix!=="xch")throw Error("Unrecognised address format");return Buffer$7.from(bech32m.fromWords(n))},encoder:function(c){return bech32m.encode("xch",bech32m.toWords(c),90)},name:"XCH"},Ot("NULS",8964,function(c){for(var t=255&c[0]|(255&c[1])<<8,n=Buffer$7.allocUnsafe(c.length+1),ie=0,fe=0,ae=0;ae<c.length;ae++)n[ae]=ie=(ie=c[ae])>127?ie-256:ie,fe^=ie;n[c.length]=fe;var le="";if(t===1)le="NULS";else if(t===2)le="tNULS";else{var pe=Buffer$7.concat([Buffer$7.from([255&t>>0]),Buffer$7.from([255&t>>8])]);le=bs58$2.encode(pe).toUpperCase()}return le+["a","b","c","d","e"][le.length-1]+bs58$2.encode(n)},function(c){if(c.startsWith("NULS"))c=c.substring(5);else if(c.startsWith("tNULS"))c=c.substring(6);else for(var t=0;t<c.length;t++)if(c.charAt(t).charCodeAt(0)>=97){c=c.substring(t+1);break}for(var n=bs58$2.decode(c),ie=0,fe=0,ae=0;ae<n.length-1;ae++)n[ae]=ie=(ie=n[ae])>127?ie-256:ie,fe^=ie;if(fe<0&&(fe=256+fe),fe!==n[n.length-1])throw Error("Unrecognised address format");return n.slice(0,-1)}),Ot("AVAX",9e3,ut("avax"),(It=ft("avax"),function(c){var t=c.split("-");return It(t[1]||t[0])})),Ot("STRK",9004,function(c){return Fr("0x"+c.toString("hex"))},function(c){if(Fr(t=c)!==t)throw Error("Invalid checksum");var t;return Buffer$7.from(O$1(c),"hex")}),nt("NRG_LEGACY",9797),Ot("ARDR",16754,function(c){for(var t=c.toString("hex"),n=[],ie=0,fe=0;ie<t.length;ie+=2)n[yt[fe++]]=16*parseInt(t[ie],16)+parseInt(t[ie+1],16);for(var ae="",le=[],pe=0;pe<17;pe++){if(n[pe]>=mt.length||n.length!==17)throw Error("Unrecognised address format");ae+=mt[n[pe]],(pe<12&&(pe+1)%4==0||pe===16)&&(le.push(ae),ae="")}return"ARDOR-"+le.join("-")},function(c){var t=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];if((c=c.replace(/(^\s+)|(\s+$)/g,"").toUpperCase()).slice(0,5)!=="ARDOR"||c.split("-").length!==5)throw Error("Unrecognised address format");for(var n,ie=[],fe=0,ae=q$1(c=c.substr(c.indexOf("-")));!(n=ae()).done;){var le=mt.indexOf(n.value);if(le>=0&&(ie[fe++]=le,fe>17))throw Error("Unrecognised address format")}for(var pe=0,me=0;pe<fe;pe++)t[yt[me++]]=ie[pe];if(!function(ye){for(var xe,Ee,Se=0,Me=1;Me<5;Me++){for(var Be=0,$e=0;$e<31;$e++)if(!($e>12&&$e<27)){var ke=$e;$e>26&&(ke-=14),Be^=(Ee=wt[Me*$e%31],(xe=ye[ke])===0||Ee===0?0:wt[(vt[xe]+vt[Ee])%31])}Se|=Be}return Se===0}(t))throw Error("Unrecognised address format");return Buffer$7.from(t)}),_r("ZEL",19167,"za",[[28,184]],[[28,189]]),nt("CELO_LEGACY",52752),Pr("WICC",99999,[[73]],[[51]]),Ot("WAN",5718350,function(c){return gt("0x"+c.toString("hex"))},function(c){if(/^0x[0-9a-fA-F]{40}$/.test(t=c)&&gt(t)===t)return Buffer$7.from(O$1(c),"hex");throw Error("Invalid address checksum");var t}),Ot("WAVES",5741564,bs58$2.encode,function(c){var t=bs58$2.decode(c);if(t[0]!==1)throw Error("Bad program version");if(t[1]!==87||t.length!==26)throw Error("Unrecognised address format");var n=t.slice(0,22),ie=t.slice(22,26);if(!new sha3$1.Keccak(256).update(Buffer$7.from(blakejs.blake2b(Uint8Array.from(n),null,32))).digest().slice(0,4).equals(ie))throw Error("Invalid checksum");return t}),at("OP",10),at("CRO",25),at("BSC",56),at("GO",60),at("ETC",61),at("TOMO",88),at("POA",99),at("GNO",100),at("TT",108),at("MATIC",137),at("EWT",246),at("FTM",250),at("THETA",361),at("CLO",820),at("NRG",39797),at("ARB1",42161),at("CELO",42220),at("AVAXC",43114)],qt=Object.assign.apply(Object,[{}].concat(Nt.map(function(c){var t;return(t={})[c.name]=c,t}))),Tt=Object.assign.apply(Object,[{}].concat(Nt.map(function(c){var t;return(t={})[c.coinType]=c,t}))),Lt=new Proxy(Tt,{get:function(c,t){var n=parseInt(t,10);if(c[t])return c[t];if(2147483648&n){var ie=c[60];return{coinType:n,decoder:ie.decoder,encoder:ie.encoder,name:""}}}});const index_module=Object.freeze(Object.defineProperty({__proto__:null,SLIP44_MSB:Vr,convertCoinTypeToEVMChainId:it,convertEVMChainIdToCoinType:ot,formats:Nt,formatsByCoinType:Lt,formatsByName:qt},Symbol.toStringTag,{value:"Module"})),require$$2$1=getAugmentedNamespace(index_module);var ens={};Object.defineProperty(ens,"__esModule",{value:!0});ens.default=[{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"resolver",outputs:[{name:"",type:"address"}],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"label",type:"bytes32"},{name:"owner",type:"address"}],name:"setSubnodeOwner",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],payable:!1,type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"ttl",outputs:[{name:"",type:"uint64"}],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"resolver",type:"address"}],name:"setResolver",outputs:[],payable:!1,type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"owner",type:"address"}],name:"setOwner",outputs:[],payable:!1,type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"owner",type:"address"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!0,name:"label",type:"bytes32"},{indexed:!1,name:"owner",type:"address"}],name:"NewOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"resolver",type:"address"}],name:"NewResolver",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"ttl",type:"uint64"}],name:"NewTTL",type:"event"}];var resolver={},resolutionError={};(function(c){var t=commonjsGlobal&&commonjsGlobal.__extends||function(){var le=function(pe,me){return le=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(ye,xe){ye.__proto__=xe}||function(ye,xe){for(var Ee in xe)Object.prototype.hasOwnProperty.call(xe,Ee)&&(ye[Ee]=xe[Ee])},le(pe,me)};return function(pe,me){if(typeof me!="function"&&me!==null)throw new TypeError("Class extends value "+String(me)+" is not a constructor or null");le(pe,me);function ye(){this.constructor=pe}pe.prototype=me===null?Object.create(me):(ye.prototype=me.prototype,new ye)}}(),n;Object.defineProperty(c,"__esModule",{value:!0}),c.ResolutionError=c.ResolutionErrorCode=void 0;var ie;(function(le){le.UnregisteredDomain="UnregisteredDomain",le.UnspecifiedResolver="UnspecifiedResolver",le.UnsupportedDomain="UnsupportedDomain",le.UnsupportedService="UnsupportedService",le.UnsupportedMethod="UnsupportedMethod",le.UnspecifiedCurrency="UnspecifiedCurrency",le.UnsupportedCurrency="UnsupportedCurrency",le.IncorrectResolverInterface="IncorrectResolverInterface",le.RecordNotFound="RecordNotFound",le.MetadataEndpointError="MetadataEndpointError",le.ServiceProviderError="ServiceProviderError",le.InvalidTwitterVerification="InvalidTwitterVerification",le.InconsistentDomainArray="InconsistentDomainArray",le.InvalidDomainAddress="InvalidDomainAddress",le.InvalidUnsResolutionConfiguration="InvalidResolutionConfiguration"})(ie=c.ResolutionErrorCode||(c.ResolutionErrorCode={}));var fe=(n={},n[ie.UnregisteredDomain]=function(le){return"Domain ".concat(le.domain," is not registered")},n[ie.UnspecifiedResolver]=function(le){return"".concat(le.location?"".concat(le.location,": "):"","Domain ").concat(le.domain," is not configured")},n[ie.UnsupportedDomain]=function(le){return"Domain ".concat(le.domain," is not supported")},n[ie.UnsupportedMethod]=function(le){var pe,me=!((pe=le.domain)===null||pe===void 0)&&pe.endsWith(".zil")?" (if this method was called via the Resolution class with both UNS and ZNS providers configured not in the API mode, this error also means that the domain doesn't exist in UNS)":"";return"Method ".concat(le.methodName," is not supported for ").concat(le.domain).concat(me)},n[ie.InvalidTwitterVerification]=function(le){return"".concat(le.location?"".concat(le.location,": "):"","Domain ").concat(le.domain," has invalid Twitter signature verification")},n[ie.UnsupportedCurrency]=function(le){return"".concat(le.currencyTicker," is not supported")},n[ie.IncorrectResolverInterface]=function(le){return"Domain resolver is configured incorrectly for ".concat(le.method)},n[ie.RecordNotFound]=function(le){return"".concat(le.location?"".concat(le.location,": "):"","No ").concat(le.recordName," record found for ").concat(le.domain)},n[ie.ServiceProviderError]=function(le){return"< ".concat(le.providerMessage," >")},n[ie.MetadataEndpointError]=function(le){return"Failed to query tokenUri ".concat(le.tokenUri,". Error: ").concat(le.errorMessage)},n[ie.UnsupportedService]=function(le){return"Naming service ".concat(le.namingService," is not supported")},n[ie.InvalidDomainAddress]=function(le){return"Domain address ".concat(le.domain," is invalid")},n[ie.InvalidUnsResolutionConfiguration]=function(le){return"Resolution "},n),ae=function(le){t(pe,le);function pe(me,ye){ye===void 0&&(ye={});var xe=this,Ee=fe[me],Se=ye.domain,Me=ye.method,Be=ye.currencyTicker,$e=ye.methodName,ke=ye.recordName,Te=Ee(ye);return xe=le.call(this,Te)||this,xe.code=me,xe.domain=Se,xe.method=Me,xe.currencyTicker=Be,xe.name="ResolutionError",xe.methodName=$e,xe.recordName=ke,Object.setPrototypeOf(xe,pe.prototype),xe}return pe}(Error);c.ResolutionError=ae,c.default=ae})(resolutionError);var newResolver={};Object.defineProperty(newResolver,"__esModule",{value:!0});newResolver.default=[{constant:!0,inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"pure",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"},{internalType:"string",name:"value",type:"string"}],name:"setText",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"interfaceImplementer",outputs:[{internalType:"address",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"target",type:"address"},{internalType:"bool",name:"isAuthorised",type:"bool"}],name:"setAuthorisation",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentType",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setABI",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"name",type:"string"}],name:"setName",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"},{internalType:"bytes",name:"a",type:"bytes"}],name:"setAddr",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"pubkey",outputs:[{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"a",type:"address"}],name:"setAddr",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"},{internalType:"address",name:"implementer",type:"address"}],name:"setInterface",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"}],name:"addr",outputs:[{internalType:"bytes",name:"",type:"bytes"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"bytes32",name:"",type:"bytes32"},{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"}],name:"authorisations",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{inputs:[{internalType:"contract ENS",name:"_ens",type:"address"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"target",type:"address"},{indexed:!1,internalType:"bool",name:"isAuthorised",type:"bool"}],name:"AuthorisationChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"indexedKey",type:"string"},{indexed:!1,internalType:"string",name:"key",type:"string"}],name:"TextChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"x",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes4",name:"interfaceID",type:"bytes4"},{indexed:!1,internalType:"address",name:"implementer",type:"address"}],name:"InterfaceChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"coinType",type:"uint256"},{indexed:!1,internalType:"bytes",name:"newAddress",type:"bytes"}],name:"AddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"uint256",name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"}];var oldResolver={};Object.defineProperty(oldResolver,"__esModule",{value:!0});oldResolver.default=[{inputs:[{name:"ensAddr",type:"address"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!0,name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"x",type:"bytes32"},{indexed:!1,name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"indexedKey",type:"string"},{indexed:!1,name:"key",type:"string"}],name:"TextChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"node",type:"bytes32"},{indexed:!1,name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"addr",type:"address"}],name:"setAddr",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"name",type:"string"}],name:"setName",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"contentType",type:"uint256"},{name:"data",type:"bytes"}],name:"setABI",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{name:"node",type:"bytes32"},{name:"key",type:"string"},{name:"value",type:"string"}],name:"setText",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"},{name:"key",type:"string"}],name:"text",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"pubkey",outputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"},{name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{name:"",type:"uint256"},{name:"",type:"bytes"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"node",type:"bytes32"}],name:"contenthash",outputs:[{name:"",type:"bytes"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"pure",type:"function"}];var types$2={};(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.hasProvider=c.ZnsSupportedNetwork=c.EnsSupportedNetwork=c.UnsSupportedNetwork=c.EthCoinIndex=c.NullAddresses=c.NullAddress=void 0,c.NullAddress="0x0000000000000000000000000000000000000000",function(ie){ie[ie["0x"]=0]="0x",ie[ie["0x0000000000000000000000000000000000000000"]=1]="0x0000000000000000000000000000000000000000",ie[ie["0x0000000000000000000000000000000000000000000000000000000000000000"]=2]="0x0000000000000000000000000000000000000000000000000000000000000000"}(c.NullAddresses||(c.NullAddresses={})),c.EthCoinIndex="60";var t=function(){for(var ie=[],fe=0;fe<arguments.length;fe++)ie[fe]=arguments[fe];Object.freeze(ie);var ae=new Set(ie),le=function(ye){return ae.has(ye)},pe=function(ye){if(!le(ye)){var xe=JSON.stringify(ye),Ee=ie.map(function(Se){return JSON.stringify(Se)}).join(" | ");throw new TypeError("Value '".concat(xe,"' is not assignable to type '").concat(Ee,"'."))}return ye},me={guard:le,check:pe,values:ie};return Object.freeze(me)};c.UnsSupportedNetwork=t("mainnet","sepolia","polygon-mainnet","polygon-amoy","base-mainnet","base-sepolia"),c.EnsSupportedNetwork=t("mainnet","sepolia"),c.ZnsSupportedNetwork=t("mainnet","testnet");function n(ie){return ie&&!!ie.provider}c.hasProvider=n})(types$2);var publicTypes={};(function(c){Object.defineProperty(c,"__esModule",{value:!0}),c.BlockchainType=c.DnsRecordType=c.NamehashOptionsDefault=c.UnclaimedDomainResponse=c.NamingServiceName=c.UnsLocation=void 0,function(t){t.Layer1="UNSLayer1",t.Layer2="UNSLayer2"}(c.UnsLocation||(c.UnsLocation={})),function(t){t.UNS="UNS",t.UNS_BASE="UNS_BASE",t.ENS="ENS",t.ZNS="ZNS"}(c.NamingServiceName||(c.NamingServiceName={})),c.UnclaimedDomainResponse={addresses:{},meta:{domain:"",namehash:"",resolver:"",owner:null,type:"",ttl:0,blockchain:null},records:{}},c.NamehashOptionsDefault={format:"hex",prefix:!0,zns:!1},function(t){t.A="A",t.AAAA="AAAA",t.AFSDB="AFSDB",t.APL="APL",t.CAA="CAA",t.CDNSKEY="CDNSKEY",t.CDS="CDS",t.CERT="CERT",t.CNAME="CNAME",t.CSYNC="CSYNC",t.DHCID="DHCID",t.DLV="DLV",t.DNAME="DNAME",t.DNSKEY="DNSKEY",t.DS="DS",t.EUI48="EUI48",t.EUI64="EUI64",t.HINFO="HINFO",t.HIP="HIP",t.HTTPS="HTTPS",t.IPSECKEY="IPSECKEY",t.KEY="KEY",t.KX="KX",t.LOC="LOC",t.MX="MX",t.NAPTR="NAPTR",t.NS="NS",t.NSEC="NSEC",t.NSEC3="NSEC3",t.NSEC3PARAM="NSEC3PARAM",t.OPENPGPKEY="OPENPGPKEY",t.PTR="PTR",t.RP="RP",t.RRSIG="RRSIG",t.SIG="SIG",t.SMIMEA="SMIMEA",t.SOA="SOA",t.SRV="SRV",t.SSHFP="SSHFP",t.SVCB="SVCB",t.TA="TA",t.TKEY="TKEY",t.TLSA="TLSA",t.TSIG="TSIG",t.TXT="TXT",t.URI="URI",t.ZONEMD="ZONEMD"}(c.DnsRecordType||(c.DnsRecordType={})),function(t){t.ETH="ETH",t.POL="POL",t.ZIL="ZIL",t.BASE="BASE"}(c.BlockchainType||(c.BlockchainType={}))})(publicTypes);(function(c){var t=commonjsGlobal&&commonjsGlobal.__importDefault||function(pe){return pe&&pe.__esModule?pe:{default:pe}};Object.defineProperty(c,"__esModule",{value:!0}),c.OldResolverAddresses=void 0;var n=resolutionError,ie=t(newResolver),fe=t(oldResolver),ae=types$2,le=publicTypes;c.OldResolverAddresses=["0x5ffc014343cd971b7eb70732021e26c35b744cc4","0x1da022710df5002339274aadee8d58218e9d6ab5","0xda1756bb923af5d1a05e277cb1e54f1d0a127890"],c.default=function(pe,me){if(me===void 0||me===ae.EthCoinIndex)return fe.default;if(c.OldResolverAddresses.includes(pe.toLowerCase()))throw new n.ResolutionError(n.ResolutionErrorCode.IncorrectResolverInterface,{method:le.NamingServiceName.ENS});return ie.default}})(resolver);var nameWrapper={};Object.defineProperty(nameWrapper,"__esModule",{value:!0});nameWrapper.default=[{inputs:[{internalType:"contract ENS",name:"_ens",type:"address"},{internalType:"contract IBaseRegistrar",name:"_registrar",type:"address"},{internalType:"contract IMetadataService",name:"_metadataService",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"CannotUpgrade",type:"error"},{inputs:[],name:"IncompatibleParent",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"IncorrectTargetOwner",type:"error"},{inputs:[],name:"IncorrectTokenType",type:"error"},{inputs:[{internalType:"bytes32",name:"labelHash",type:"bytes32"},{internalType:"bytes32",name:"expectedLabelhash",type:"bytes32"}],name:"LabelMismatch",type:"error"},{inputs:[{internalType:"string",name:"label",type:"string"}],name:"LabelTooLong",type:"error"},{inputs:[],name:"LabelTooShort",type:"error"},{inputs:[],name:"NameIsNotWrapped",type:"error"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"OperationProhibited",type:"error"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"addr",type:"address"}],name:"Unauthorised",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"controller",type:"address"},{indexed:!1,internalType:"bool",name:"active",type:"bool"}],name:"ControllerChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"expiry",type:"uint64"}],name:"ExpiryExtended",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint32",name:"fuses",type:"uint32"}],name:"FusesSet",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"owner",type:"address"}],name:"NameUnwrapped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"uint32",name:"fuses",type:"uint32"},{indexed:!1,internalType:"uint64",name:"expiry",type:"uint64"}],name:"NameWrapped",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"values",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"_tokens",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint32",name:"fuseMask",type:"uint32"}],name:"allFusesBurned",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"accounts",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"addr",type:"address"}],name:"canExtendSubnames",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"addr",type:"address"}],name:"canModifyName",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"controllers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ens",outputs:[{internalType:"contract ENS",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"extendExpiry",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"operator",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"getData",outputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"isWrapped",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"metadataService",outputs:[{internalType:"contract IMetadataService",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"names",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"onERC721Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"owner",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_token",type:"address"},{internalType:"address",name:"_to",type:"address"},{internalType:"uint256",name:"_amount",type:"uint256"}],name:"recoverFunds",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"wrappedOwner",type:"address"},{internalType:"uint256",name:"duration",type:"uint256"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint16",name:"ownerControlledFuses",type:"uint16"}],name:"registerAndWrapETH2LD",outputs:[{internalType:"uint256",name:"registrarExpiry",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"registrar",outputs:[{internalType:"contract IBaseRegistrar",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"duration",type:"uint256"}],name:"renew",outputs:[{internalType:"uint256",name:"expires",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"setChildFuses",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"controller",type:"address"},{internalType:"bool",name:"active",type:"bool"}],name:"setController",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint16",name:"ownerControlledFuses",type:"uint16"}],name:"setFuses",outputs:[{internalType:"uint32",name:"",type:"uint32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IMetadataService",name:"_metadataService",type:"address"}],name:"setMetadataService",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"resolver",type:"address"}],name:"setResolver",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"owner",type:"address"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"setSubnodeOwner",outputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"uint64",name:"ttl",type:"uint64"},{internalType:"uint32",name:"fuses",type:"uint32"},{internalType:"uint64",name:"expiry",type:"uint64"}],name:"setSubnodeRecord",outputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint64",name:"ttl",type:"uint64"}],name:"setTTL",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract INameWrapperUpgrade",name:"_upgradeAddress",type:"address"}],name:"setUpgradeContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"parentNode",type:"bytes32"},{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"address",name:"controller",type:"address"}],name:"unwrap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"labelhash",type:"bytes32"},{internalType:"address",name:"registrant",type:"address"},{internalType:"address",name:"controller",type:"address"}],name:"unwrapETH2LD",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"name",type:"bytes"},{internalType:"bytes",name:"extraData",type:"bytes"}],name:"upgrade",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"upgradeContract",outputs:[{internalType:"contract INameWrapperUpgrade",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"name",type:"bytes"},{internalType:"address",name:"wrappedOwner",type:"address"},{internalType:"address",name:"resolver",type:"address"}],name:"wrap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"label",type:"string"},{internalType:"address",name:"wrappedOwner",type:"address"},{internalType:"uint16",name:"ownerControlledFuses",type:"uint16"},{internalType:"address",name:"resolver",type:"address"}],name:"wrapETH2LD",outputs:[{internalType:"uint64",name:"expiry",type:"uint64"}],stateMutability:"nonpayable",type:"function"}];var baseRegistrar={};Object.defineProperty(baseRegistrar,"__esModule",{value:!0});baseRegistrar.default=[{inputs:[{internalType:"contract ENS",name:"_ens",type:"address"},{internalType:"bytes32",name:"_baseNode",type:"bytes32"}],payable:!1,stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"controller",type:"address"}],name:"ControllerAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"controller",type:"address"}],name:"ControllerRemoved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"uint256",name:"expires",type:"uint256"}],name:"NameMigrated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!1,internalType:"uint256",name:"expires",type:"uint256"}],name:"NameRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"expires",type:"uint256"}],name:"NameRenewed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{constant:!0,inputs:[],name:"GRACE_PERIOD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"controller",type:"address"}],name:"addController",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"available",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"baseNode",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"address",name:"",type:"address"}],name:"controllers",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"ens",outputs:[{internalType:"contract ENS",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"isOwner",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"nameExpires",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"uint256",name:"id",type:"uint256"},{internalType:"address",name:"owner",type:"address"}],name:"reclaim",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"uint256",name:"id",type:"uint256"},{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"duration",type:"uint256"}],name:"register",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"uint256",name:"id",type:"uint256"},{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"duration",type:"uint256"}],name:"registerOnly",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"controller",type:"address"}],name:"removeController",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"duration",type:"uint256"}],name:"renew",outputs:[{internalType:"uint256",name:"",type:"uint256"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[],name:"renounceOwnership",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"safeTransferFrom",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"resolver",type:"address"}],name:"setResolver",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!1,inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],payable:!1,stateMutability:"nonpayable",type:"function"}];var reverseRegistrar={};Object.defineProperty(reverseRegistrar,"__esModule",{value:!0});reverseRegistrar.default=[{inputs:[{internalType:"contract ENS",name:"ensAddr",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"controller",type:"address"},{indexed:!1,internalType:"bool",name:"enabled",type:"bool"}],name:"ControllerChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"contract NameResolver",name:"resolver",type:"address"}],name:"DefaultResolverChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"addr",type:"address"},{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"}],name:"ReverseClaimed",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"claim",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"}],name:"claimForAddr",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"}],name:"claimWithResolver",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"controllers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultResolver",outputs:[{internalType:"contract NameResolver",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"ens",outputs:[{internalType:"contract ENS",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"}],name:"node",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"pure",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"controller",type:"address"},{internalType:"bool",name:"enabled",type:"bool"}],name:"setController",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"resolver",type:"address"}],name:"setDefaultResolver",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"name",type:"string"}],name:"setName",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"addr",type:"address"},{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"resolver",type:"address"},{internalType:"string",name:"name",type:"string"}],name:"setNameForAddr",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"}];var EthereumContract$1={},__awaiter$a=commonjsGlobal&&commonjsGlobal.__awaiter||function(c,t,n,ie){function fe(ae){return ae instanceof n?ae:new n(function(le){le(ae)})}return new(n||(n=Promise))(function(ae,le){function pe(xe){try{ye(ie.next(xe))}catch(Ee){le(Ee)}}function me(xe){try{ye(ie.throw(xe))}catch(Ee){le(Ee)}}function ye(xe){xe.done?ae(xe.value):fe(xe.value).then(pe,me)}ye((ie=ie.apply(c,t||[])).next())})},__generator$a=commonjsGlobal&&commonjsGlobal.__generator||function(c,t){var n={label:0,sent:function(){if(ae[0]&1)throw ae[1];return ae[1]},trys:[],ops:[]},ie,fe,ae,le;return le={next:pe(0),throw:pe(1),return:pe(2)},typeof Symbol=="function"&&(le[Symbol.iterator]=function(){return this}),le;function pe(ye){return function(xe){return me([ye,xe])}}function me(ye){if(ie)throw new TypeError("Generator is already executing.");for(;n;)try{if(ie=1,fe&&(ae=ye[0]&2?fe.return:ye[0]?fe.throw||((ae=fe.return)&&ae.call(fe),0):fe.next)&&!(ae=ae.call(fe,ye[1])).done)return ae;switch(fe=0,ae&&(ye=[ye[0]&2,ae.value]),ye[0]){case 0:case 1:ae=ye;break;case 4:return n.label++,{value:ye[1],done:!1};case 5:n.label++,fe=ye[1],ye=[0];continue;case 7:ye=n.ops.pop(),n.trys.pop();continue;default:if(ae=n.trys,!(ae=ae.length>0&&ae[ae.length-1])&&(ye[0]===6||ye[0]===2)){n=0;continue}if(ye[0]===3&&(!ae||ye[1]>ae[0]&&ye[1]<ae[3])){n.label=ye[1];break}if(ye[0]===6&&n.label<ae[1]){n.label=ae[1],ae=ye;break}if(ae&&n.label<ae[2]){n.label=ae[2],n.ops.push(ye);break}ae[2]&&n.ops.pop(),n.trys.pop();continue}ye=t.call(c,n)}catch(xe){ye=[6,xe],fe=0}finally{ie=ae=0}if(ye[0]&5)throw ye[1];return{value:ye[0]?ye[1]:void 0,done:!0}}};Object.defineProperty(EthereumContract$1,"__esModule",{value:!0});var abi_1=require$$0$3,EthereumContract=function(){function c(t,n,ie,fe){this.abi=t,this.address=n,this.provider=ie,this.coder=new abi_1.Interface(this.abi),this.apiKey=fe}return c.prototype.call=function(t,n){return __awaiter$a(this,void 0,void 0,function(){var ie,fe;return __generator$a(this,function(ae){switch(ae.label){case 0:return ie=this.coder.encodeFunctionData(t,n),[4,this.callEth(ie)];case 1:return fe=ae.sent(),!fe||fe==="0x"?[2,[]]:[2,this.coder.decodeFunctionResult(t,fe)]}})})},c.prototype.multicall=function(t){return __awaiter$a(this,void 0,void 0,function(){var n,ie,fe,ae,le,pe,me,ye,xe;return __generator$a(this,function(Ee){switch(Ee.label){case 0:for(n=[],ie=0,fe=t;ie<fe.length;ie++)ae=fe[ie],n.push(this.coder.encodeFunctionData(ae.method,ae.args));return le=this.coder.encodeFunctionData("multicall",[n]),[4,this.callEth(le)];case 1:if(pe=Ee.sent(),!pe||pe==="0x")return[2,[]];for(me=this.coder.decodeFunctionResult("multicall",pe),ye=[],xe=0;xe<me.results.length;xe++)ye.push(this.coder.decodeFunctionResult(t[xe].method,me.results[xe]));return[2,ye]}})})},c.prototype.fetchLogs=function(t,n,ie){return ie===void 0&&(ie="earliest"),__awaiter$a(this,void 0,void 0,function(){var fe,ae,le;return __generator$a(this,function(pe){switch(pe.label){case 0:return fe=this.coder.getEventTopic(t),ae=[{fromBlock:ie,toBlock:"latest",address:this.address,topics:[fe,n]}],le={method:"eth_getLogs",params:ae,apiKey:this.apiKey},[4,this.provider.request(le)];case 1:return[2,pe.sent()]}})})},c.prototype.callEth=function(t){return __awaiter$a(this,void 0,void 0,function(){var n,ie;return __generator$a(this,function(fe){switch(fe.label){case 0:return n=[{data:t,to:this.address},"latest"],ie={method:"eth_call",params:n,apiKey:this.apiKey},[4,this.provider.request(ie)];case 1:return[2,fe.sent()]}})})},c}();EthereumContract$1.default=EthereumContract;var utils$d={},Tlds$1={},Networking$1={},browserPonyfill={exports:{}};(function(c,t){var n=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof globalThis<"u"&&globalThis,ie=function(){function ae(){this.fetch=!1,this.DOMException=n.DOMException}return ae.prototype=n,new ae}();(function(ae){(function(le){var pe=typeof ae<"u"&&ae||typeof self<"u"&&self||typeof pe<"u"&&pe,me={searchParams:"URLSearchParams"in pe,iterable:"Symbol"in pe&&"iterator"in Symbol,blob:"FileReader"in pe&&"Blob"in pe&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in pe,arrayBuffer:"ArrayBuffer"in pe};function ye(he){return he&&DataView.prototype.isPrototypeOf(he)}if(me.arrayBuffer)var xe=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Ee=ArrayBuffer.isView||function(he){return he&&xe.indexOf(Object.prototype.toString.call(he))>-1};function Se(he){if(typeof he!="string"&&(he=String(he)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(he)||he==="")throw new TypeError('Invalid character in header field name: "'+he+'"');return he.toLowerCase()}function Me(he){return typeof he!="string"&&(he=String(he)),he}function Be(he){var ve={next:function(){var we=he.shift();return{done:we===void 0,value:we}}};return me.iterable&&(ve[Symbol.iterator]=function(){return ve}),ve}function $e(he){this.map={},he instanceof $e?he.forEach(function(ve,we){this.append(we,ve)},this):Array.isArray(he)?he.forEach(function(ve){this.append(ve[0],ve[1])},this):he&&Object.getOwnPropertyNames(he).forEach(function(ve){this.append(ve,he[ve])},this)}$e.prototype.append=function(he,ve){he=Se(he),ve=Me(ve);var we=this.map[he];this.map[he]=we?we+", "+ve:ve},$e.prototype.delete=function(he){delete this.map[Se(he)]},$e.prototype.get=function(he){return he=Se(he),this.has(he)?this.map[he]:null},$e.prototype.has=function(he){return this.map.hasOwnProperty(Se(he))},$e.prototype.set=function(he,ve){this.map[Se(he)]=Me(ve)},$e.prototype.forEach=function(he,ve){for(var we in this.map)this.map.hasOwnProperty(we)&&he.call(ve,this.map[we],we,this)},$e.prototype.keys=function(){var he=[];return this.forEach(function(ve,we){he.push(we)}),Be(he)},$e.prototype.values=function(){var he=[];return this.forEach(function(ve){he.push(ve)}),Be(he)},$e.prototype.entries=function(){var he=[];return this.forEach(function(ve,we){he.push([we,ve])}),Be(he)},me.iterable&&($e.prototype[Symbol.iterator]=$e.prototype.entries);function ke(he){if(he.bodyUsed)return Promise.reject(new TypeError("Already read"));he.bodyUsed=!0}function Te(he){return new Promise(function(ve,we){he.onload=function(){ve(he.result)},he.onerror=function(){we(he.error)}})}function Ie(he){var ve=new FileReader,we=Te(ve);return ve.readAsArrayBuffer(he),we}function Fe(he){var ve=new FileReader,we=Te(ve);return ve.readAsText(he),we}function Le(he){for(var ve=new Uint8Array(he),we=new Array(ve.length),Ae=0;Ae<ve.length;Ae++)we[Ae]=String.fromCharCode(ve[Ae]);return we.join("")}function He(he){if(he.slice)return he.slice(0);var ve=new Uint8Array(he.byteLength);return ve.set(new Uint8Array(he)),ve.buffer}function ze(){return this.bodyUsed=!1,this._initBody=function(he){this.bodyUsed=this.bodyUsed,this._bodyInit=he,he?typeof he=="string"?this._bodyText=he:me.blob&&Blob.prototype.isPrototypeOf(he)?this._bodyBlob=he:me.formData&&FormData.prototype.isPrototypeOf(he)?this._bodyFormData=he:me.searchParams&&URLSearchParams.prototype.isPrototypeOf(he)?this._bodyText=he.toString():me.arrayBuffer&&me.blob&&ye(he)?(this._bodyArrayBuffer=He(he.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):me.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(he)||Ee(he))?this._bodyArrayBuffer=He(he):this._bodyText=he=Object.prototype.toString.call(he):this._bodyText="",this.headers.get("content-type")||(typeof he=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):me.searchParams&&URLSearchParams.prototype.isPrototypeOf(he)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},me.blob&&(this.blob=function(){var he=ke(this);if(he)return he;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var he=ke(this);return he||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else return this.blob().then(Ie)}),this.text=function(){var he=ke(this);if(he)return he;if(this._bodyBlob)return Fe(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(Le(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},me.formData&&(this.formData=function(){return this.text().then($t)}),this.json=function(){return this.text().then(JSON.parse)},this}var Je=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function Xe(he){var ve=he.toUpperCase();return Je.indexOf(ve)>-1?ve:he}function Ue(he,ve){if(!(this instanceof Ue))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');ve=ve||{};var we=ve.body;if(he instanceof Ue){if(he.bodyUsed)throw new TypeError("Already read");this.url=he.url,this.credentials=he.credentials,ve.headers||(this.headers=new $e(he.headers)),this.method=he.method,this.mode=he.mode,this.signal=he.signal,!we&&he._bodyInit!=null&&(we=he._bodyInit,he.bodyUsed=!0)}else this.url=String(he);if(this.credentials=ve.credentials||this.credentials||"same-origin",(ve.headers||!this.headers)&&(this.headers=new $e(ve.headers)),this.method=Xe(ve.method||this.method||"GET"),this.mode=ve.mode||this.mode||null,this.signal=ve.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&we)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(we),(this.method==="GET"||this.method==="HEAD")&&(ve.cache==="no-store"||ve.cache==="no-cache")){var Ae=/([?&])_=[^&]*/;if(Ae.test(this.url))this.url=this.url.replace(Ae,"$1_="+new Date().getTime());else{var be=/\?/;this.url+=(be.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}Ue.prototype.clone=function(){return new Ue(this,{body:this._bodyInit})};function $t(he){var ve=new FormData;return he.trim().split("&").forEach(function(we){if(we){var Ae=we.split("="),be=Ae.shift().replace(/\+/g," "),ue=Ae.join("=").replace(/\+/g," ");ve.append(decodeURIComponent(be),decodeURIComponent(ue))}}),ve}function _e(he){var ve=new $e,we=he.replace(/\r?\n[\t ]+/g," ");return we.split("\r").map(function(Ae){return Ae.indexOf(`