@depay/widgets 11.4.0 → 11.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ Q=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="functio
4
4
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
5
5
  !function(t,e){var n=Wn,r=n.Buffer;function i(t,e){for(var n in t)e[n]=t[n]}function o(t,e,n){return r(t,e,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=o),o.prototype=Object.create(r.prototype),i(r,o),o.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return r(t,e,n)},o.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=r(t);return void 0!==e?"string"==typeof n?i.fill(e,n):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}}(Fn,Fn.exports);var Yn=Fn.exports.Buffer;var Hn=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var r=0;r<t.length;r++){var i=t.charAt(r),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=r}var a=t.length,s=t.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return Yn.alloc(0);for(var n=0,r=0,i=0;t[n]===s;)r++,n++;for(var o=(t.length-n)*u+1>>>0,c=new Uint8Array(o);t[n];){var l=e[t.charCodeAt(n)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h<i)&&-1!==d;d--,h++)l+=a*c[d]>>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var f=o-i;f!==o&&0===c[f];)f++;var p=Yn.allocUnsafe(r+(o-f));p.fill(0,0,r);for(var m=r;f!==o;)p[m++]=c[f++];return p}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=Yn.from(e)),!Yn.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,f=u-1;(0!==h||d<r)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=u-r;p!==u&&0===l[p];)p++;for(var m=s.repeat(n);p<u;++p)m+=t.charAt(l[p]);return m},decodeUnsafe:l,decode:function(t){var e=l(t);if(e)return e;throw new Error("Non-base"+a+" character")}}},Vn=Hn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),qn=Vn,Gn=function(t,e,n){return t&e^t&n^e&n},Zn=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]),Jn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Xn=new Uint32Array(64),Kn=function(t){J(n,Ee);var e=it(n);function n(){var t;return V(this,n),(t=e.call(this,64,32,8,!1)).A=0|Jn[0],t.B=0|Jn[1],t.C=0|Jn[2],t.D=0|Jn[3],t.E=0|Jn[4],t.F=0|Jn[5],t.G=0|Jn[6],t.H=0|Jn[7],t}return G(n,[{key:"get",value:function(){return[this.A,this.B,this.C,this.D,this.E,this.F,this.G,this.H]}},{key:"set",value:function(t,e,n,r,i,o,a,s){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|r,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}},{key:"process",value:function(t,e){for(var n=0;n<16;n++,e+=4)Xn[n]=t.getUint32(e,!1);for(var r=16;r<64;r++){var i=Xn[r-15],o=Xn[r-2],a=Me(i,7)^Me(i,18)^i>>>3,s=Me(o,17)^Me(o,19)^o>>>10;Xn[r]=s+Xn[r-7]+a+Xn[r-16]|0}for(var u,c=this.A,l=this.B,h=this.C,d=this.D,f=this.E,p=this.F,m=this.G,g=this.H,y=0;y<64;y++){var v=g+(Me(f,6)^Me(f,11)^Me(f,25))+((u=f)&p^~u&m)+Zn[y]+Xn[y]|0,w=(Me(c,2)^Me(c,13)^Me(c,22))+Gn(c,l,h)|0;g=m,m=p,p=f,f=d+v|0,d=h,h=l,l=c,c=v+w|0}c=c+this.A|0,l=l+this.B|0,h=h+this.C|0,d=d+this.D|0,f=f+this.E|0,p=p+this.F|0,m=m+this.G|0,g=g+this.H|0,this.set(c,l,h,d,f,p,m,g)}},{key:"roundClean",value:function(){Xn.fill(0)}},{key:"destroy",value:function(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}]),n}(),$n=function(t){J(n,Kn);var e=it(n);function n(){var t;return V(this,n),(t=e.call(this)).A=-1056596264,t.B=914150663,t.C=812702999,t.D=-150054599,t.E=-4191439,t.F=1750603025,t.G=1694076839,t.H=-1090891868,t.outputLen=28,t}return G(n)}(),tr=Le((function(){return new Kn}));Le((function(){return new $n}));var er={};function nr(t,e,n){return e<=t&&t<=n}function rr(t){if(void 0===t)return{};if(t===Object(t))return t;throw TypeError("Could not convert argument to dictionary")}function ir(t){this.tokens=[].slice.call(t)}ir.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(t)},push:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.push(e.shift());else this.tokens.push(t)}};var or=-1;function ar(t,e){if(t)throw TypeError("Decoder error");return e||65533}var sr="utf-8";function ur(t,e){if(!(this instanceof ur))return new ur(t,e);if((t=void 0!==t?String(t).toLowerCase():sr)!==sr)throw new Error("Encoding not supported. Only utf-8 is supported");e=rr(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(e.fatal),this._ignoreBOM=Boolean(e.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function cr(t,e){if(!(this instanceof cr))return new cr(t,e);if((t=void 0!==t?String(t).toLowerCase():sr)!==sr)throw new Error("Encoding not supported. Only utf-8 is supported");e=rr(e),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(e.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function lr(t){var e=t.fatal,n=0,r=0,i=0,o=128,a=191;this.handler=function(t,s){if(-1===s&&0!==i)return i=0,ar(e);if(-1===s)return or;if(0===i){if(nr(s,0,127))return s;if(nr(s,194,223))i=1,n=s-192;else if(nr(s,224,239))224===s&&(o=160),237===s&&(a=159),i=2,n=s-224;else{if(!nr(s,240,244))return ar(e);240===s&&(o=144),244===s&&(a=143),i=3,n=s-240}return n<<=6*i,null}if(!nr(s,o,a))return n=i=r=0,o=128,a=191,t.prepend(s),ar(e);if(o=128,a=191,n+=s-128<<6*(i-(r+=1)),r!==i)return null;var u=n;return n=i=r=0,u}}function hr(t){t.fatal,this.handler=function(t,e){if(-1===e)return or;if(nr(e,0,127))return e;var n,r;nr(e,128,2047)?(n=1,r=192):nr(e,2048,65535)?(n=2,r=224):nr(e,65536,1114111)&&(n=3,r=240);for(var i=[(e>>6*n)+r];n>0;){var o=e>>6*(n-1);i.push(128|63&o),n-=1}return i}}ur.prototype={decode:function(t,e){var n;n="object"===F(t)&&t instanceof ArrayBuffer?new Uint8Array(t):"object"===F(t)&&"buffer"in t&&t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(0),e=rr(e),this._streaming||(this._decoder=new lr({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(e.stream);for(var r,i=new ir(n),o=[];!i.endOfStream()&&(r=this._decoder.handler(i,i.read()))!==or;)null!==r&&(Array.isArray(r)?o.push.apply(o,r):o.push(r));if(!this._streaming){do{if((r=this._decoder.handler(i,i.read()))===or)break;null!==r&&(Array.isArray(r)?o.push.apply(o,r):o.push(r))}while(!i.endOfStream());this._decoder=null}return o.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===o[0]?(this._BOMseen=!0,o.shift()):this._BOMseen=!0)),function(t){for(var e="",n=0;n<t.length;++n){var r=t[n];r<=65535?e+=String.fromCharCode(r):(r-=65536,e+=String.fromCharCode(55296+(r>>10),56320+(1023&r)))}return e}(o)}},cr.prototype={encode:function(t,e){t=t?String(t):"",e=rr(e),this._streaming||(this._encoder=new hr(this._options)),this._streaming=Boolean(e.stream);for(var n,r=[],i=new ir(function(t){for(var e=String(t),n=e.length,r=0,i=[];r<n;){var o=e.charCodeAt(r);if(o<55296||o>57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(r===n-1)i.push(65533);else{var a=t.charCodeAt(r+1);if(56320<=a&&a<=57343){var s=1023&o,u=1023&a;i.push(65536+(s<<10)+u),r+=1}else i.push(65533)}r+=1}return i}(t));!i.endOfStream()&&(n=this._encoder.handler(i,i.read()))!==or;)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;(n=this._encoder.handler(i,i.read()))!==or;)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}};var dr=R(Object.freeze({__proto__:null,TextEncoder:cr,TextDecoder:ur})),fr=P&&P.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),pr=P&&P.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),mr=P&&P.__decorate||function(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===("undefined"==typeof Reflect?"undefined":F(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a},gr=P&&P.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.hasOwnProperty.call(t,n)&&fr(e,t,n);return pr(e,t),e},yr=P&&P.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(er,"__esModule",{value:!0});var vr=er.deserializeUnchecked=Or=er.deserialize=Cr=er.serialize=er.BinaryReader=er.BinaryWriter=er.BorshError=er.baseDecode=er.baseEncode=void 0,wr=yr(Un.exports),br=yr(Vn),Mr=gr(dr),kr=new("function"!=typeof TextDecoder?Mr.TextDecoder:TextDecoder)("utf-8",{fatal:!0});er.baseEncode=function(t){return"string"==typeof t&&(t=Tt.from(t,"utf8")),br.default.encode(Tt.from(t))},er.baseDecode=function(t){return Tt.from(br.default.decode(t))};var Ar=1024,Lr=function(t){J(n,et(Error));var e=it(n);function n(t){var r;return V(this,n),(r=e.call(this,t)).fieldPath=[],r.originalMessage=t,r}return G(n,[{key:"addToFieldPath",value:function(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}]),n}();er.BorshError=Lr;var Er=function(){function t(){V(this,t),this.buf=Tt.alloc(Ar),this.length=0}return G(t,[{key:"maybeResize",value:function(){this.buf.length<16+this.length&&(this.buf=Tt.concat([this.buf,Tt.alloc(Ar)]))}},{key:"writeU8",value:function(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}},{key:"writeU16",value:function(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}},{key:"writeU32",value:function(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}},{key:"writeU64",value:function(t){this.maybeResize(),this.writeBuffer(Tt.from(new wr.default(t).toArray("le",8)))}},{key:"writeU128",value:function(t){this.maybeResize(),this.writeBuffer(Tt.from(new wr.default(t).toArray("le",16)))}},{key:"writeU256",value:function(t){this.maybeResize(),this.writeBuffer(Tt.from(new wr.default(t).toArray("le",32)))}},{key:"writeU512",value:function(t){this.maybeResize(),this.writeBuffer(Tt.from(new wr.default(t).toArray("le",64)))}},{key:"writeBuffer",value:function(t){this.buf=Tt.concat([Tt.from(this.buf.subarray(0,this.length)),t,Tt.alloc(Ar)]),this.length+=t.length}},{key:"writeString",value:function(t){this.maybeResize();var e=Tt.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}},{key:"writeFixedArray",value:function(t){this.writeBuffer(Tt.from(t))}},{key:"writeArray",value:function(t,e){this.maybeResize(),this.writeU32(t.length);var n,r=ft(t);try{for(r.s();!(n=r.n()).done;){var i=n.value;this.maybeResize(),e(i)}}catch(t){r.e(t)}finally{r.f()}}},{key:"toArray",value:function(){return this.buf.subarray(0,this.length)}}]),t}();function xr(t,e,n){var r=n.value;n.value=function(){try{for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r.apply(this,e)}catch(t){if(t instanceof RangeError){var i=t.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(i)>=0)throw new Lr("Reached the end of buffer when deserializing")}throw t}}}er.BinaryWriter=Er;var Nr=function(){function t(e){V(this,t),this.buf=e,this.offset=0}return G(t,[{key:"readU8",value:function(){var t=this.buf.readUInt8(this.offset);return this.offset+=1,t}},{key:"readU16",value:function(){var t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}},{key:"readU32",value:function(){var t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}},{key:"readU64",value:function(){var t=this.readBuffer(8);return new wr.default(t,"le")}},{key:"readU128",value:function(){var t=this.readBuffer(16);return new wr.default(t,"le")}},{key:"readU256",value:function(){var t=this.readBuffer(32);return new wr.default(t,"le")}},{key:"readU512",value:function(){var t=this.readBuffer(64);return new wr.default(t,"le")}},{key:"readBuffer",value:function(t){if(this.offset+t>this.buf.length)throw new Lr("Expected buffer length ".concat(t," isn't within bounds"));var e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}},{key:"readString",value:function(){var t=this.readU32(),e=this.readBuffer(t);try{return kr.decode(e)}catch(t){throw new Lr("Error decoding UTF-8 string: ".concat(t))}}},{key:"readFixedArray",value:function(t){return new Uint8Array(this.readBuffer(t))}},{key:"readArray",value:function(t){for(var e=this.readU32(),n=Array(),r=0;r<e;++r)n.push(t());return n}}]),t}();function Sr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Ir(t,e,n,r,i){try{if("string"==typeof r)i["write".concat(Sr(r))](n);else if(r instanceof Array)if("number"==typeof r[0]){if(n.length!==r[0])throw new Lr("Expecting byte array of length ".concat(r[0],", but got ").concat(n.length," bytes"));i.writeFixedArray(n)}else if(2===r.length&&"number"==typeof r[1]){if(n.length!==r[1])throw new Lr("Expecting byte array of length ".concat(r[1],", but got ").concat(n.length," bytes"));for(var o=0;o<r[1];o++)Ir(t,null,n[o],r[0],i)}else i.writeArray(n,(function(n){Ir(t,e,n,r[0],i)}));else if(void 0!==r.kind)switch(r.kind){case"option":null==n?i.writeU8(0):(i.writeU8(1),Ir(t,e,n,r.type,i));break;case"map":i.writeU32(n.size),n.forEach((function(n,o){Ir(t,e,o,r.key,i),Ir(t,e,n,r.value,i)}));break;default:throw new Lr("FieldType ".concat(r," unrecognized"))}else Tr(t,n,i)}catch(t){throw t instanceof Lr&&t.addToFieldPath(e),t}}function Tr(t,e,n){if("function"!=typeof e.borshSerialize){var r=t.get(e.constructor);if(!r)throw new Lr("Class ".concat(e.constructor.name," is missing in schema"));if("struct"===r.kind)r.fields.map((function(r){var i=at(r,2),o=i[0],a=i[1];Ir(t,o,e[o],a,n)}));else{if("enum"!==r.kind)throw new Lr("Unexpected schema kind: ".concat(r.kind," for ").concat(e.constructor.name));for(var i=e[r.field],o=0;o<r.values.length;++o){var a=at(r.values[o],2),s=a[0],u=a[1];if(s===i){n.writeU8(o),Ir(t,s,e[s],u,n);break}}}}else e.borshSerialize(n)}mr([xr],Nr.prototype,"readU8",null),mr([xr],Nr.prototype,"readU16",null),mr([xr],Nr.prototype,"readU32",null),mr([xr],Nr.prototype,"readU64",null),mr([xr],Nr.prototype,"readU128",null),mr([xr],Nr.prototype,"readU256",null),mr([xr],Nr.prototype,"readU512",null),mr([xr],Nr.prototype,"readString",null),mr([xr],Nr.prototype,"readFixedArray",null),mr([xr],Nr.prototype,"readArray",null),er.BinaryReader=Nr;var Cr=er.serialize=function(t,e){var n=new(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Er);return Tr(t,e,n),n.toArray()};function jr(t,e,n,r){try{if("string"==typeof n)return r["read".concat(Sr(n))]();if(n instanceof Array){if("number"==typeof n[0])return r.readFixedArray(n[0]);if("number"==typeof n[1]){for(var i=[],o=0;o<n[1];o++)i.push(jr(t,null,n[0],r));return i}return r.readArray((function(){return jr(t,e,n[0],r)}))}if("option"===n.kind)return r.readU8()?jr(t,e,n.type,r):void 0;if("map"===n.kind){for(var a=new Map,s=r.readU32(),u=0;u<s;u++){var c=jr(t,e,n.key,r),l=jr(t,e,n.value,r);a.set(c,l)}return a}return Dr(t,n,r)}catch(t){throw t instanceof Lr&&t.addToFieldPath(e),t}}function Dr(t,e,n){if("function"==typeof e.borshDeserialize)return e.borshDeserialize(n);var r=t.get(e);if(!r)throw new Lr("Class ".concat(e.name," is missing in schema"));if("struct"===r.kind){var i,o={},a=ft(t.get(e).fields);try{for(a.s();!(i=a.n()).done;){var s=at(i.value,2),u=s[0],c=s[1];o[u]=jr(t,u,c,n)}}catch(t){a.e(t)}finally{a.f()}return new e(o)}if("enum"===r.kind){var l=n.readU8();if(l>=r.values.length)throw new Lr("Enum index: ".concat(l," is out of range"));var h=at(r.values[l],2),d=h[0];return new e(Z({},d,jr(t,d,h[1],n)))}throw new Lr("Unexpected schema kind: ".concat(r.kind," for ").concat(e.constructor.name))}var Or=er.deserialize=function(t,e,n){var r=new(arguments.length>3&&void 0!==arguments[3]?arguments[3]:Nr)(n),i=Dr(t,e,r);if(r.offset<n.length)throw new Lr("Unexpected ".concat(n.length-r.offset," bytes after deserialized data"));return i};vr=er.deserializeUnchecked=function(t,e,n){return Dr(t,e,new(arguments.length>3&&void 0!==arguments[3]?arguments[3]:Nr)(n))};var _r={};Object.defineProperty(_r,"__esModule",{value:!0}),_r.s16=_r.s8=_r.nu64be=_r.u48be=_r.u40be=_r.u32be=_r.u24be=_r.u16be=Ai=_r.nu64=_r.u48=_r.u40=ki=_r.u32=_r.u24=Mi=_r.u16=bi=_r.u8=wi=_r.offset=_r.greedy=_r.Constant=_r.UTF8=_r.CString=_r.Blob=_r.Boolean=_r.BitField=_r.BitStructure=_r.VariantLayout=_r.Union=_r.UnionLayoutDiscriminator=_r.UnionDiscriminator=_r.Structure=_r.Sequence=_r.DoubleBE=_r.Double=_r.FloatBE=_r.Float=_r.NearInt64BE=_r.NearInt64=_r.NearUInt64BE=_r.NearUInt64=_r.IntBE=_r.Int=_r.UIntBE=_r.UInt=_r.OffsetLayout=_r.GreedyCount=_r.ExternalLayout=_r.bindConstructorLayout=_r.nameWithProperty=_r.Layout=_r.uint8ArrayToBuffer=_r.checkUint8Array=void 0,_r.constant=_r.utf8=_r.cstr=Ni=_r.blob=_r.unionLayoutDiscriminator=_r.union=xi=_r.seq=_r.bits=Ei=_r.struct=_r.f64be=_r.f64=_r.f32be=_r.f32=_r.ns64be=_r.s48be=_r.s40be=_r.s32be=_r.s24be=_r.s16be=Li=_r.ns64=_r.s48=_r.s40=_r.s32=_r.s24=void 0;var zr=Wn;function Pr(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function Br(t){return Pr(t),zr.Buffer.from(t.buffer,t.byteOffset,t.length)}_r.checkUint8Array=Pr,_r.uint8ArrayToBuffer=Br;var Rr=function(){function t(e,n){if(V(this,t),!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=n}return G(t,[{key:"makeDestinationObject",value:function(){return{}}},{key:"getSpan",value:function(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(t){var e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}},{key:"fromArray",value:function(t){}}]),t}();function Ur(t,e){return e.property?t+"["+e.property+"]":t}_r.Layout=Rr,_r.nameWithProperty=Ur,_r.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Rr))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=function(){return new t},Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};var Wr=function(t){J(n,Rr);var e=it(n);function n(){return V(this,n),e.apply(this,arguments)}return G(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}();_r.ExternalLayout=Wr;var Qr=function(t){J(n,Wr);var e=it(n);function n(){var t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1?arguments[1]:void 0;if(V(this,n),!Number.isInteger(r)||0>=r)throw new TypeError("elementSpan must be a (positive) integer");return(t=e.call(this,-1,i)).elementSpan=r,t}return G(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Pr(t);var n=t.length-e;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(t,e,n){return 0}}]),n}();_r.GreedyCount=Qr;var Fr=function(t){J(n,Wr);var e=it(n);function n(t){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2?arguments[2]:void 0;if(V(this,n),!(t instanceof Rr))throw new TypeError("layout must be a Layout");if(!Number.isInteger(i))throw new TypeError("offset must be integer or undefined");return(r=e.call(this,t.span,o||t.property)).layout=t,r.offset=i,r}return G(n,[{key:"isCount",value:function(){return this.layout instanceof Yr||this.layout instanceof Hr}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.layout.decode(t,e+this.offset)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.layout.encode(t,e,n+this.offset)}}]),n}();_r.OffsetLayout=Fr;var Yr=function(t){J(n,Rr);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Br(t).readUIntLE(e,this.span)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Br(e).writeUIntLE(t,n,this.span),this.span}}]),n}();_r.UInt=Yr;var Hr=function(t){J(n,Rr);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Br(t).readUIntBE(e,this.span)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Br(e).writeUIntBE(t,n,this.span),this.span}}]),n}();_r.UIntBE=Hr;var Vr=function(t){J(n,Rr);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Br(t).readIntLE(e,this.span)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Br(e).writeIntLE(t,n,this.span),this.span}}]),n}();_r.Int=Vr;var qr=function(t){J(n,Rr);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Br(t).readIntBE(e,this.span)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Br(e).writeIntBE(t,n,this.span),this.span}}]),n}();_r.IntBE=qr;var Gr=Math.pow(2,32);function Zr(t){var e=Math.floor(t/Gr);return{hi32:e,lo32:t-e*Gr}}function Jr(t,e){return t*Gr+e}var Xr=function(t){J(n,Rr);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Br(t),r=n.readUInt32LE(e);return Jr(n.readUInt32LE(e+4),r)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Zr(t),i=Br(e);return i.writeUInt32LE(r.lo32,n),i.writeUInt32LE(r.hi32,n+4),8}}]),n}();_r.NearUInt64=Xr;var Kr=function(t){J(n,Rr);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Br(t);return Jr(n.readUInt32BE(e),n.readUInt32BE(e+4))}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Zr(t),i=Br(e);return i.writeUInt32BE(r.hi32,n),i.writeUInt32BE(r.lo32,n+4),8}}]),n}();_r.NearUInt64BE=Kr;var $r=function(t){J(n,Rr);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Br(t),r=n.readUInt32LE(e);return Jr(n.readInt32LE(e+4),r)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Zr(t),i=Br(e);return i.writeUInt32LE(r.lo32,n),i.writeInt32LE(r.hi32,n+4),8}}]),n}();_r.NearInt64=$r;var ti=function(t){J(n,Rr);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Br(t);return Jr(n.readInt32BE(e),n.readUInt32BE(e+4))}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Zr(t),i=Br(e);return i.writeInt32BE(r.hi32,n),i.writeUInt32BE(r.lo32,n+4),8}}]),n}();_r.NearInt64BE=ti;var ei=function(t){J(n,Rr);var e=it(n);function n(t){return V(this,n),e.call(this,4,t)}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Br(t).readFloatLE(e)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Br(e).writeFloatLE(t,n),4}}]),n}();_r.Float=ei;var ni=function(t){J(n,Rr);var e=it(n);function n(t){return V(this,n),e.call(this,4,t)}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Br(t).readFloatBE(e)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Br(e).writeFloatBE(t,n),4}}]),n}();_r.FloatBE=ni;var ri=function(t){J(n,Rr);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Br(t).readDoubleLE(e)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Br(e).writeDoubleLE(t,n),8}}]),n}();_r.Double=ri;var ii=function(t){J(n,Rr);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Br(t).readDoubleBE(e)}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Br(e).writeDoubleBE(t,n),8}}]),n}();_r.DoubleBE=ii;var oi=function(t){J(n,Rr);var e=it(n);function n(t,r,i){var o;if(V(this,n),!(t instanceof Rr))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof Wr&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var a=-1;return!(r instanceof Wr)&&0<t.span&&(a=r*t.span),(o=e.call(this,a,i)).elementLayout=t,o.count=r,o}return G(n,[{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;var n=0,r=this.count;if(r instanceof Wr&&(r=r.decode(t,e)),0<this.elementLayout.span)n=r*this.elementLayout.span;else for(var i=0;i<r;)n+=this.elementLayout.getSpan(t,e+n),++i;return n}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=0,i=this.count;for(i instanceof Wr&&(i=i.decode(t,e));r<i;)n.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),r+=1;return n}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.elementLayout,i=t.reduce((function(t,i){return t+r.encode(i,e,n+t)}),0);return this.count instanceof Wr&&this.count.encode(t.length,e,n),i}}]),n}();_r.Sequence=oi;var ai=function(t){J(n,Rr);var e=it(n);function n(t,r,i){var o;if(V(this,n),!Array.isArray(t)||!t.reduce((function(t,e){return t&&e instanceof Rr}),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof r&&void 0===i&&(i=r,r=void 0);var a,s=ft(t);try{for(s.s();!(a=s.n()).done;){var u=a.value;if(0>u.span&&void 0===u.property)throw new Error("fields cannot contain unnamed variable-length layout")}}catch(t){s.e(t)}finally{s.f()}var c=-1;try{c=t.reduce((function(t,e){return t+e.getSpan()}),0)}catch(t){}return(o=e.call(this,c,r)).fields=t,o.decodePrefixes=!!i,o}return G(n,[{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Pr(t);var n,r=this.makeDestinationObject(),i=ft(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"encode",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=r,o=0,a=0,s=ft(this.fields);try{for(s.s();!(n=s.n()).done;){var u=n.value,c=u.span;if(a=0<c?c:0,void 0!==u.property){var l=t[u.property];void 0!==l&&(a=u.encode(l,e,r),0>c&&(c=u.getSpan(e,r)))}o=r,r+=c}}catch(t){s.e(t)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(t){var e,n=this.makeDestinationObject(),r=ft(this.fields);try{for(r.s();!(e=r.n()).done;){var i=e.value;void 0!==i.property&&0<t.length&&(n[i.property]=t.shift())}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"layoutFor",value:function(t){if("string"!=typeof t)throw new TypeError("property must be string");var e,n=ft(this.fields);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.property===t)return r}}catch(t){n.e(t)}finally{n.f()}}},{key:"offsetOf",value:function(t){if("string"!=typeof t)throw new TypeError("property must be string");var e,n=0,r=ft(this.fields);try{for(r.s();!(e=r.n()).done;){var i=e.value;if(i.property===t)return n;0>i.span?n=-1:0<=n&&(n+=i.span)}}catch(t){r.e(t)}finally{r.f()}}}]),n}();_r.Structure=ai;var si=function(){function t(e){V(this,t),this.property=e}return G(t,[{key:"decode",value:function(t,e){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(t,e,n){throw new Error("UnionDiscriminator is abstract")}}]),t}();_r.UnionDiscriminator=si;var ui=function(t){J(n,si);var e=it(n);function n(t,r){var i;if(V(this,n),!(t instanceof Wr&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=e.call(this,r||t.property||"variant")).layout=t,i}return G(n,[{key:"decode",value:function(t,e){return this.layout.decode(t,e)}},{key:"encode",value:function(t,e,n){return this.layout.encode(t,e,n)}}]),n}();_r.UnionLayoutDiscriminator=ui;var ci=function(t){J(n,Rr);var e=it(n);function n(t,r,i){var o,a;if(V(this,n),t instanceof Yr||t instanceof Hr)a=new ui(new Fr(t));else if(t instanceof Wr&&t.isCount())a=new ui(t);else{if(!(t instanceof si))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");a=t}if(void 0===r&&(r=null),!(null===r||r instanceof Rr))throw new TypeError("defaultLayout must be null or a Layout");if(null!==r){if(0>r.span)throw new Error("defaultLayout must have constant span");void 0===r.property&&(r=r.replicate("content"))}var s=-1;r&&0<=(s=r.span)&&(t instanceof Yr||t instanceof Hr)&&(s+=a.layout.span),(o=e.call(this,s,i)).discriminator=a,o.usesPrefixDiscriminator=t instanceof Yr||t instanceof Hr,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(rt(o));return o.getSourceVariant=function(t){return u(t)},o.configGetSourceVariant=function(t){u=t.bind(this)},o}return G(n,[{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;var n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}},{key:"defaultGetSourceVariant",value:function(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;var e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(var n in this.registry){var r=this.registry[n];if(r.property&&Object.prototype.hasOwnProperty.call(t,r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.discriminator,i=r.decode(t,n),o=this.registry[i];if(void 0===o){var a=this.defaultLayout,s=0;this.usesPrefixDiscriminator&&(s=r.layout.span),(e=this.makeDestinationObject())[r.property]=i,e[a.property]=a.decode(t,n+s)}else e=o.decode(t,n);return e}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.getSourceVariant(t);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(t[i.property],e,n),a+o.encode(t[o.property],e,n+a)}return r.encode(t,e,n)}},{key:"addVariant",value:function(t,e,n){var r=new li(this,t,e,n);return this.registry[t]=r,r}},{key:"getVariant",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e=t instanceof Uint8Array?this.discriminator.decode(t,n):t,this.registry[e]}}]),n}();_r.Union=ci;var li=function(t){J(n,Rr);var e=it(n);function n(t,r,i,o){var a;if(V(this,n),!(t instanceof ci))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof i&&void 0===o&&(o=i,i=null),i){if(!(i instanceof Rr))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=i.span&&i.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof o)throw new TypeError("variant must have a String property")}var s=t.span;return 0>t.span&&0<=(s=i?i.span:0)&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span),(a=e.call(this,s,o)).union=t,a.variant=r,a.layout=i||null,a}return G(n,[{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;var n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);var r=0;return this.layout&&(r=this.layout.getSpan(t,e+n)),n+r}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");var r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=0;if(this.union.usesPrefixDiscriminator&&(r=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,e,n);var i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(t){if(this.layout)return this.layout.fromArray(t)}}]),n}();function hi(t){return 0>t&&(t+=4294967296),t}_r.VariantLayout=li;var di=function(t){J(n,Rr);var e=it(n);function n(t,r,i){var o;if(V(this,n),!(t instanceof Yr||t instanceof Hr))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=!1),4<t.span)throw new RangeError("word cannot exceed 32 bits");(o=e.call(this,t.span,i)).word=t,o.msb=!!r,o.fields=[];var a=0;return o._packedSetValue=function(t){return a=hi(t),this},o._packedGetValue=function(){return a},o}return G(n,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.makeDestinationObject(),r=this.word.decode(t,e);this._packedSetValue(r);var i,o=ft(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;void 0!==a.property&&(n[a.property]=a.decode(t))}}catch(t){o.e(t)}finally{o.f()}return n}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.word.decode(e,n);this._packedSetValue(r);var i,o=ft(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(void 0!==a.property){var s=t[a.property];void 0!==s&&a.encode(s)}}}catch(t){o.e(t)}finally{o.f()}return this.word.encode(this._packedGetValue(),e,n)}},{key:"addField",value:function(t,e){var n=new fi(this,t,e);return this.fields.push(n),n}},{key:"addBoolean",value:function(t){var e=new pi(this,t);return this.fields.push(e),e}},{key:"fieldFor",value:function(t){if("string"!=typeof t)throw new TypeError("property must be string");var e,n=ft(this.fields);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.property===t)return r}}catch(t){n.e(t)}finally{n.f()}}}]),n}();_r.BitStructure=di;var fi=function(){function t(e,n,r){if(V(this,t),!(e instanceof di))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(n)||0>=n)throw new TypeError("bits must be positive integer");var i=8*e.span,o=e.fields.reduce((function(t,e){return t+e.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=n,this.valueMask=(1<<n)-1,32===n&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=i-o-n),this.wordMask=hi(this.valueMask<<this.start),this.property=r}return G(t,[{key:"decode",value:function(t,e){return hi(this.container._packedGetValue()&this.wordMask)>>>this.start}},{key:"encode",value:function(t){if("number"!=typeof t||!Number.isInteger(t)||t!==hi(t&this.valueMask))throw new TypeError(Ur("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var e=this.container._packedGetValue(),n=hi(t<<this.start);this.container._packedSetValue(hi(e&~this.wordMask)|n)}}]),t}();_r.BitField=fi;var pi=function(t){J(n,fi);var e=it(n);function n(t,r){return V(this,n),e.call(this,t,1,r)}return G(n,[{key:"decode",value:function(t,e){return!!ot(X(n.prototype),"decode",this).call(this,t,e)}},{key:"encode",value:function(t){"boolean"==typeof t&&(t=+t),ot(X(n.prototype),"encode",this).call(this,t)}}]),n}();_r.Boolean=pi;var mi=function(t){J(n,Rr);var e=it(n);function n(t,r){var i;if(V(this,n),!(t instanceof Wr&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var o=-1;return t instanceof Wr||(o=t),(i=e.call(this,o,r)).length=t,i}return G(n,[{key:"getSpan",value:function(t,e){var n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.span;return 0>n&&(n=this.length.decode(t,e)),Br(t).slice(e,e+n)}},{key:"encode",value:function(t,e,n){var r=this.length;if(this.length instanceof Wr&&(r=t.length),!(t instanceof Uint8Array&&r===t.length))throw new TypeError(Ur("Blob.encode",this)+" requires (length "+r+") Uint8Array as src");if(n+r>e.length)throw new RangeError("encoding overruns Uint8Array");var i=Br(t);return Br(e).write(i.toString("hex"),n,r,"hex"),this.length instanceof Wr&&this.length.encode(r,e,n),r}}]),n}();_r.Blob=mi;var gi=function(t){J(n,Rr);var e=it(n);function n(t){return V(this,n),e.call(this,-1,t)}return G(n,[{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Pr(t);for(var n=e;n<t.length&&0!==t[n];)n+=1;return 1+n-e}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.getSpan(t,e);return Br(t).slice(e,e+n-1).toString("utf-8")}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;"string"!=typeof t&&(t=String(t));var r=zr.Buffer.from(t,"utf8"),i=r.length;if(n+i>e.length)throw new RangeError("encoding overruns Buffer");var o=Br(e);return r.copy(o,n),o[n+i]=0,i+1}}]),n}();_r.CString=gi;var yi=function(t){J(n,Rr);var e=it(n);function n(t,r){var i;if(V(this,n),"string"==typeof t&&void 0===r&&(r=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");return(i=e.call(this,-1,r)).maxSpan=t,i}return G(n,[{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Pr(t),t.length-e}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");return Br(t).slice(e,e+n).toString("utf-8")}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;"string"!=typeof t&&(t=String(t));var r=zr.Buffer.from(t,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(Br(e),n),i}}]),n}();_r.UTF8=yi;var vi=function(t){J(n,Rr);var e=it(n);function n(t,r){var i;return V(this,n),(i=e.call(this,0,r)).value=t,i}return G(n,[{key:"decode",value:function(t,e){return this.value}},{key:"encode",value:function(t,e,n){return 0}}]),n}();_r.Constant=vi,_r.greedy=function(t,e){return new Qr(t,e)};var wi=_r.offset=function(t,e,n){return new Fr(t,e,n)},bi=_r.u8=function(t){return new Yr(1,t)},Mi=_r.u16=function(t){return new Yr(2,t)};_r.u24=function(t){return new Yr(3,t)};var ki=_r.u32=function(t){return new Yr(4,t)};_r.u40=function(t){return new Yr(5,t)},_r.u48=function(t){return new Yr(6,t)};var Ai=_r.nu64=function(t){return new Xr(t)};_r.u16be=function(t){return new Hr(2,t)},_r.u24be=function(t){return new Hr(3,t)},_r.u32be=function(t){return new Hr(4,t)},_r.u40be=function(t){return new Hr(5,t)},_r.u48be=function(t){return new Hr(6,t)},_r.nu64be=function(t){return new Kr(t)},_r.s8=function(t){return new Vr(1,t)},_r.s16=function(t){return new Vr(2,t)},_r.s24=function(t){return new Vr(3,t)},_r.s32=function(t){return new Vr(4,t)},_r.s40=function(t){return new Vr(5,t)},_r.s48=function(t){return new Vr(6,t)};var Li=_r.ns64=function(t){return new $r(t)};_r.s16be=function(t){return new qr(2,t)},_r.s24be=function(t){return new qr(3,t)},_r.s32be=function(t){return new qr(4,t)},_r.s40be=function(t){return new qr(5,t)},_r.s48be=function(t){return new qr(6,t)},_r.ns64be=function(t){return new ti(t)},_r.f32=function(t){return new ei(t)},_r.f32be=function(t){return new ni(t)},_r.f64=function(t){return new ri(t)},_r.f64be=function(t){return new ii(t)};var Ei=_r.struct=function(t,e,n){return new ai(t,e,n)};_r.bits=function(t,e,n){return new di(t,e,n)};var xi=_r.seq=function(t,e,n){return new oi(t,e,n)};_r.union=function(t,e,n){return new ci(t,e,n)},_r.unionLayoutDiscriminator=function(t,e){return new ui(t,e)};var Ni=_r.blob=function(t,e){return new mi(t,e)};_r.cstr=function(t){return new gi(t)},_r.utf8=function(t,e){return new yi(t,e)},_r.constant=function(t,e){return new vi(t,e)};var Si={};Object.defineProperty(Si,"__esModule",{value:!0});var Ii=Si.toBigIntLE=function(t){var e=Tt.from(t);e.reverse();var n=e.toString("hex");return 0===n.length?BigInt(0):BigInt("0x".concat(n))};Si.toBigIntBE=function(t){var e=t.toString("hex");return 0===e.length?BigInt(0):BigInt("0x".concat(e))};var Ti=Si.toBufferLE=function(t,e){var n=t.toString(16),r=Tt.from(n.padStart(2*e,"0").slice(0,2*e),"hex");return r.reverse(),r};Si.toBufferBE=function(t,e){var n=t.toString(16);return Tt.from(n.padStart(2*e,"0").slice(0,2*e),"hex")};var Ci=["message"],ji=Q().mark(Bi),Di=function(t){J(n,et(TypeError));var e=it(n);function n(t,r){var i,o;V(this,n);var a=t.message,s=nt(t,Ci),u=t.path,c=0===u.length?a:"At path: "+u.join(".")+" -- "+a;return i=e.call(this,c),Object.assign(rt(i),s),i.name=i.constructor.name,i.failures=function(){var e;return null!=(e=o)?e:o=[t].concat(st(r()))},i}return G(n)}();function Oi(t){return _i(t)&&"function"==typeof t[Symbol.iterator]}function _i(t){return"object"===F(t)&&null!=t}function zi(t){return"string"==typeof t?JSON.stringify(t):""+t}function Pi(t,e,n,r){if(!0!==t){!1===t?t={}:"string"==typeof t&&(t={message:t});var i=e.path,o=e.branch,a=n.type,s=t,u=s.refinement,c=s.message,l=void 0===c?"Expected a value of type `"+a+"`"+(u?" with refinement `"+u+"`":"")+", but received: `"+zi(r)+"`":c;return W(W({value:r,type:a,refinement:u,key:i[i.length-1],path:i,branch:o},t),{},{message:l})}}function Bi(t,e,n,r){var i,o,a,s;return Q().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:Oi(t)||(t=[t]),i=ft(t),u.prev=2,i.s();case 4:if((o=i.n()).done){u.next=12;break}if(a=o.value,!(s=Pi(a,e,n,r))){u.next=10;break}return u.next=10,s;case 10:u.next=4;break;case 12:u.next=17;break;case 14:u.prev=14,u.t0=u.catch(2),i.e(u.t0);case 17:return u.prev=17,i.f(),u.finish(17);case 20:case"end":return u.stop()}}),ji,null,[[2,14,17,20]])}function Ri(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Q().mark((function r(){var i,o,a,s,u,c,l,h,d,f,p,m,g,y,v,w,b,M,k,A,L,E,x,N,S,I,T;return Q().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(i=n.path,o=void 0===i?[]:i,a=n.branch,s=void 0===a?[t]:a,u=n.coerce,c=void 0!==u&&u,l=n.mask,h=void 0!==l&&l,d={path:o,branch:s},c&&(t=e.coercer(t,d),h&&"type"!==e.type&&_i(e.schema)&&_i(t)&&!Array.isArray(t)))for(f in t)void 0===e.schema[f]&&delete t[f];p=!0,m=ft(e.validator(t,d)),r.prev=5,m.s();case 7:if((g=m.n()).done){r.next=14;break}return y=g.value,p=!1,r.next=12,[y,void 0];case 12:r.next=7;break;case 14:r.next=19;break;case 16:r.prev=16,r.t0=r.catch(5),m.e(r.t0);case 19:return r.prev=19,m.f(),r.finish(19);case 22:v=ft(e.entries(t,d)),r.prev=23,v.s();case 25:if((w=v.n()).done){r.next=52;break}b=at(w.value,3),M=b[0],k=b[1],A=b[2],L=Ri(k,A,{path:void 0===M?o:[].concat(st(o),[M]),branch:void 0===M?s:[].concat(st(s),[k]),coerce:c,mask:h}),E=ft(L),r.prev=29,E.s();case 31:if((x=E.n()).done){r.next=42;break}if(!(N=x.value)[0]){r.next=39;break}return p=!1,r.next=37,[N[0],void 0];case 37:r.next=40;break;case 39:c&&(k=N[1],void 0===M?t=k:t instanceof Map?t.set(M,k):t instanceof Set?t.add(k):_i(t)&&(t[M]=k));case 40:r.next=31;break;case 42:r.next=47;break;case 44:r.prev=44,r.t1=r.catch(29),E.e(r.t1);case 47:return r.prev=47,E.f(),r.finish(47);case 50:r.next=25;break;case 52:r.next=57;break;case 54:r.prev=54,r.t2=r.catch(23),v.e(r.t2);case 57:return r.prev=57,v.f(),r.finish(57);case 60:if(!p){r.next=79;break}S=ft(e.refiner(t,d)),r.prev=62,S.s();case 64:if((I=S.n()).done){r.next=71;break}return T=I.value,p=!1,r.next=69,[T,void 0];case 69:r.next=64;break;case 71:r.next=76;break;case 73:r.prev=73,r.t3=r.catch(62),S.e(r.t3);case 76:return r.prev=76,S.f(),r.finish(76);case 79:if(!p){r.next=82;break}return r.next=82,[void 0,t];case 82:case"end":return r.stop()}}),r,null,[[5,16,19,22],[23,54,57,60],[29,44,47,50],[62,73,76,79]])}))()}var Ui,Wi=function(){function t(e){var n=this;V(this,t);var r=e.type,i=e.schema,o=e.validator,a=e.refiner,s=e.coercer,u=void 0===s?function(t){return t}:s,c=e.entries,l=void 0===c?Q().mark((function t(){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)})):c;this.type=r,this.schema=i,this.entries=l,this.coercer=u,this.validator=o?function(t,e){return Bi(o(t,e),e,n,t)}:function(){return[]},this.refiner=a?function(t,e){return Bi(a(t,e),e,n,t)}:function(){return[]}}return G(t,[{key:"assert",value:function(t){return Qi(t,this)}},{key:"create",value:function(t){return Fi(t,this)}},{key:"is",value:function(t){return Yi(t,this)}},{key:"mask",value:function(t){return function(t,e){var n=Hi(t,e,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(t,this)}},{key:"validate",value:function(t){return Hi(t,this,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}}]),t}();function Qi(t,e){var n=Hi(t,e);if(n[0])throw n[0]}function Fi(t,e){var n=Hi(t,e,{coerce:!0});if(n[0])throw n[0];return n[1]}function Yi(t,e){return!Hi(t,e)[0]}function Hi(t,e){var n=Ri(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),r=function(t){var e=t.next(),n=e.done,r=e.value;return n?void 0:r}(n);if(r[0]){var i=new Di(r[0],Q().mark((function t(){var e,r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=ft(n),t.prev=1,e.s();case 3:if((r=e.n()).done){t.next=10;break}if(!(i=r.value)[0]){t.next=8;break}return t.next=8,i[0];case 8:t.next=3;break;case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(1),e.e(t.t0);case 15:return t.prev=15,e.f(),t.finish(15);case 18:case"end":return t.stop()}}),t,null,[[1,12,15,18]])})));return[i,void 0]}return[void 0,r[1]]}function Vi(t,e){return new Wi({type:t,schema:null,validator:e})}function qi(t){return new Wi({type:"array",schema:t,entries:Q().mark((function e(n){var r,i,o,a,s;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t||!Array.isArray(n)){e.next=18;break}r=ft(n.entries()),e.prev=2,r.s();case 4:if((i=r.n()).done){e.next=10;break}return o=at(i.value,2),a=o[0],s=o[1],e.next=8,[a,s,t];case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),r.e(e.t0);case 15:return e.prev=15,r.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[2,12,15,18]])})),coercer:function(t){return Array.isArray(t)?t.slice():t},validator:function(t){return Array.isArray(t)||"Expected an array value, but received: "+zi(t)}})}function Gi(){return Vi("boolean",(function(t){return"boolean"==typeof t}))}function Zi(t){return Vi("instance",(function(e){return e instanceof t||"Expected a `"+t.name+"` instance, but received: "+zi(e)}))}function Ji(t){var e=zi(t),n=F(t);return new Wi({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?t:null,validator:function(n){return n===t||"Expected the literal `"+e+"`, but received: "+zi(n)}})}function Xi(t){return new Wi(W(W({},t),{},{validator:function(e,n){return null===e||t.validator(e,n)},refiner:function(e,n){return null===e||t.refiner(e,n)}}))}function Ki(){return Vi("number",(function(t){return"number"==typeof t&&!isNaN(t)||"Expected a number, but received: "+zi(t)}))}function $i(t){return new Wi(W(W({},t),{},{validator:function(e,n){return void 0===e||t.validator(e,n)},refiner:function(e,n){return void 0===e||t.refiner(e,n)}}))}function to(t,e){return new Wi({type:"record",schema:null,entries:Q().mark((function n(r){var i,o;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!_i(r)){n.next=11;break}n.t0=Q().keys(r);case 2:if((n.t1=n.t0()).done){n.next=11;break}return i=n.t1.value,o=r[i],n.next=7,[i,i,t];case 7:return n.next=9,[i,o,e];case 9:n.next=2;break;case 11:case"end":return n.stop()}}),n)})),validator:function(t){return _i(t)||"Expected an object, but received: "+zi(t)}})}function eo(){return Vi("string",(function(t){return"string"==typeof t||"Expected a string, but received: "+zi(t)}))}function no(t){var e=Vi("never",(function(){return!1}));return new Wi({type:"tuple",schema:null,entries:Q().mark((function n(r){var i,o;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!Array.isArray(r)){n.next=9;break}i=Math.max(t.length,r.length),o=0;case 3:if(!(o<i)){n.next=9;break}return n.next=6,[o,r[o],t[o]||e];case 6:o++,n.next=3;break;case 9:case"end":return n.stop()}}),n)})),validator:function(t){return Array.isArray(t)||"Expected an array, but received: "+zi(t)}})}function ro(t){var e=Object.keys(t);return new Wi({type:"type",schema:t,entries:Q().mark((function n(r){var i,o,a;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!_i(r)){n.next=18;break}i=ft(e),n.prev=2,i.s();case 4:if((o=i.n()).done){n.next=10;break}return a=o.value,n.next=8,[a,r[a],t[a]];case 8:n.next=4;break;case 10:n.next=15;break;case 12:n.prev=12,n.t0=n.catch(2),i.e(n.t0);case 15:return n.prev=15,i.f(),n.finish(15);case 18:case"end":return n.stop()}}),n,null,[[2,12,15,18]])})),validator:function(t){return _i(t)||"Expected an object, but received: "+zi(t)}})}function io(t){var e=t.map((function(t){return t.type})).join(" | ");return new Wi({type:"union",schema:null,validator:function(n,r){var i,o,a=[],s=ft(t);try{for(s.s();!(i=s.n()).done;){var u=Ri(n,i.value,r),c=(ut(o=u)||ct(o)||lt(o)||dt()).slice(0);if(!at(c,1)[0][0])return[];var l,h=ft(c);try{for(h.s();!(l=h.n()).done;){var d=at(l.value,1)[0];d&&a.push(d)}}catch(t){h.e(t)}finally{h.f()}}}catch(t){s.e(t)}finally{s.f()}return["Expected the value to satisfy a union of `"+e+"`, but received: "+zi(n)].concat(a)}})}function oo(){return Vi("unknown",(function(){return!0}))}function ao(t,e,n){return new Wi(W(W({},t),{},{coercer:function(r,i){return Yi(r,e)?t.coercer(n(r,i),i):t.coercer(r,i)}}))}var so=new Uint8Array(16);function uo(){if(!Ui&&!(Ui="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ui(so)}var co=/^(?:[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 lo(t){return"string"==typeof t&&co.test(t)}for(var ho,fo,po=[],mo=0;mo<256;++mo)po.push((mo+256).toString(16).substr(1));function go(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(po[t[e+0]]+po[t[e+1]]+po[t[e+2]]+po[t[e+3]]+"-"+po[t[e+4]]+po[t[e+5]]+"-"+po[t[e+6]]+po[t[e+7]]+"-"+po[t[e+8]]+po[t[e+9]]+"-"+po[t[e+10]]+po[t[e+11]]+po[t[e+12]]+po[t[e+13]]+po[t[e+14]]+po[t[e+15]]).toLowerCase();if(!lo(n))throw TypeError("Stringified UUID is invalid");return n}var yo=0,vo=0;function wo(t){if(!lo(t))throw TypeError("Invalid UUID");var e,n=new Uint8Array(16);return n[0]=(e=parseInt(t.slice(0,8),16))>>>24,n[1]=e>>>16&255,n[2]=e>>>8&255,n[3]=255&e,n[4]=(e=parseInt(t.slice(9,13),16))>>>8,n[5]=255&e,n[6]=(e=parseInt(t.slice(14,18),16))>>>8,n[7]=255&e,n[8]=(e=parseInt(t.slice(19,23),16))>>>8,n[9]=255&e,n[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,n[11]=e/4294967296&255,n[12]=e>>>24&255,n[13]=e>>>16&255,n[14]=e>>>8&255,n[15]=255&e,n}function bo(t,e,n){function r(t,r,i,o){if("string"==typeof t&&(t=function(t){t=unescape(encodeURIComponent(t));for(var e=[],n=0;n<t.length;++n)e.push(t.charCodeAt(n));return e}(t)),"string"==typeof r&&(r=wo(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+t.length);if(a.set(r),a.set(t,r.length),(a=n(a))[6]=15&a[6]|e,a[8]=63&a[8]|128,i){o=o||0;for(var s=0;s<16;++s)i[o+s]=a[s];return i}return go(a)}try{r.name=t}catch(t){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function Mo(t){return 14+(t+64>>>9<<4)+1}function ko(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function Ao(t,e,n,r,i,o){return ko((a=ko(ko(e,t),ko(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function Lo(t,e,n,r,i,o,a){return Ao(e&n|~e&r,t,e,i,o,a)}function Eo(t,e,n,r,i,o,a){return Ao(e&r|n&~r,t,e,i,o,a)}function xo(t,e,n,r,i,o,a){return Ao(e^n^r,t,e,i,o,a)}function No(t,e,n,r,i,o,a){return Ao(n^(e|~r),t,e,i,o,a)}var So=bo("v3",48,(function(t){if("string"==typeof t){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var n=0;n<e.length;++n)t[n]=e.charCodeAt(n)}return function(t){for(var e=[],n=32*t.length,r="0123456789abcdef",i=0;i<n;i+=8){var o=t[i>>5]>>>i%32&255,a=parseInt(r.charAt(o>>>4&15)+r.charAt(15&o),16);e.push(a)}return e}(function(t,e){t[e>>5]|=128<<e%32,t[Mo(e)-1]=e;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a<t.length;a+=16){var s=n,u=r,c=i,l=o;n=Lo(n,r,i,o,t[a],7,-680876936),o=Lo(o,n,r,i,t[a+1],12,-389564586),i=Lo(i,o,n,r,t[a+2],17,606105819),r=Lo(r,i,o,n,t[a+3],22,-1044525330),n=Lo(n,r,i,o,t[a+4],7,-176418897),o=Lo(o,n,r,i,t[a+5],12,1200080426),i=Lo(i,o,n,r,t[a+6],17,-1473231341),r=Lo(r,i,o,n,t[a+7],22,-45705983),n=Lo(n,r,i,o,t[a+8],7,1770035416),o=Lo(o,n,r,i,t[a+9],12,-1958414417),i=Lo(i,o,n,r,t[a+10],17,-42063),r=Lo(r,i,o,n,t[a+11],22,-1990404162),n=Lo(n,r,i,o,t[a+12],7,1804603682),o=Lo(o,n,r,i,t[a+13],12,-40341101),i=Lo(i,o,n,r,t[a+14],17,-1502002290),n=Eo(n,r=Lo(r,i,o,n,t[a+15],22,1236535329),i,o,t[a+1],5,-165796510),o=Eo(o,n,r,i,t[a+6],9,-1069501632),i=Eo(i,o,n,r,t[a+11],14,643717713),r=Eo(r,i,o,n,t[a],20,-373897302),n=Eo(n,r,i,o,t[a+5],5,-701558691),o=Eo(o,n,r,i,t[a+10],9,38016083),i=Eo(i,o,n,r,t[a+15],14,-660478335),r=Eo(r,i,o,n,t[a+4],20,-405537848),n=Eo(n,r,i,o,t[a+9],5,568446438),o=Eo(o,n,r,i,t[a+14],9,-1019803690),i=Eo(i,o,n,r,t[a+3],14,-187363961),r=Eo(r,i,o,n,t[a+8],20,1163531501),n=Eo(n,r,i,o,t[a+13],5,-1444681467),o=Eo(o,n,r,i,t[a+2],9,-51403784),i=Eo(i,o,n,r,t[a+7],14,1735328473),n=xo(n,r=Eo(r,i,o,n,t[a+12],20,-1926607734),i,o,t[a+5],4,-378558),o=xo(o,n,r,i,t[a+8],11,-2022574463),i=xo(i,o,n,r,t[a+11],16,1839030562),r=xo(r,i,o,n,t[a+14],23,-35309556),n=xo(n,r,i,o,t[a+1],4,-1530992060),o=xo(o,n,r,i,t[a+4],11,1272893353),i=xo(i,o,n,r,t[a+7],16,-155497632),r=xo(r,i,o,n,t[a+10],23,-1094730640),n=xo(n,r,i,o,t[a+13],4,681279174),o=xo(o,n,r,i,t[a],11,-358537222),i=xo(i,o,n,r,t[a+3],16,-722521979),r=xo(r,i,o,n,t[a+6],23,76029189),n=xo(n,r,i,o,t[a+9],4,-640364487),o=xo(o,n,r,i,t[a+12],11,-421815835),i=xo(i,o,n,r,t[a+15],16,530742520),n=No(n,r=xo(r,i,o,n,t[a+2],23,-995338651),i,o,t[a],6,-198630844),o=No(o,n,r,i,t[a+7],10,1126891415),i=No(i,o,n,r,t[a+14],15,-1416354905),r=No(r,i,o,n,t[a+5],21,-57434055),n=No(n,r,i,o,t[a+12],6,1700485571),o=No(o,n,r,i,t[a+3],10,-1894986606),i=No(i,o,n,r,t[a+10],15,-1051523),r=No(r,i,o,n,t[a+1],21,-2054922799),n=No(n,r,i,o,t[a+8],6,1873313359),o=No(o,n,r,i,t[a+15],10,-30611744),i=No(i,o,n,r,t[a+6],15,-1560198380),r=No(r,i,o,n,t[a+13],21,1309151649),n=No(n,r,i,o,t[a+4],6,-145523070),o=No(o,n,r,i,t[a+11],10,-1120210379),i=No(i,o,n,r,t[a+2],15,718787259),r=No(r,i,o,n,t[a+9],21,-343485551),n=ko(n,s),r=ko(r,u),i=ko(i,c),o=ko(o,l)}return[n,r,i,o]}(function(t){if(0===t.length)return[];for(var e=8*t.length,n=new Uint32Array(Mo(e)),r=0;r<e;r+=8)n[r>>5]|=(255&t[r/8])<<r%32;return n}(t),8*t.length))})),Io=So;function To(t,e,n,r){switch(t){case 0:return e&n^~e&r;case 1:case 3:return e^n^r;case 2:return e&n^e&r^n&r}}function Co(t,e){return t<<e|t>>>32-e}var jo=bo("v5",80,(function(t){var e=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof t){var r=unescape(encodeURIComponent(t));t=[];for(var i=0;i<r.length;++i)t.push(r.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,a=Math.ceil(o/16),s=new Array(a),u=0;u<a;++u){for(var c=new Uint32Array(16),l=0;l<16;++l)c[l]=t[64*u+4*l]<<24|t[64*u+4*l+1]<<16|t[64*u+4*l+2]<<8|t[64*u+4*l+3];s[u]=c}s[a-1][14]=8*(t.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(t.length-1)&4294967295;for(var h=0;h<a;++h){for(var d=new Uint32Array(80),f=0;f<16;++f)d[f]=s[h][f];for(var p=16;p<80;++p)d[p]=Co(d[p-3]^d[p-8]^d[p-14]^d[p-16],1);for(var m=n[0],g=n[1],y=n[2],v=n[3],w=n[4],b=0;b<80;++b){var M=Math.floor(b/20),k=Co(m,5)+To(M,g,y,v)+w+e[M]+d[b]>>>0;w=v,v=y,y=Co(g,30)>>>0,g=m,m=k}n[0]=n[0]+m>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+y>>>0,n[3]=n[3]+v>>>0,n[4]=n[4]+w>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),Do=jo;var Oo=Object.freeze({__proto__:null,v1:function(t,e,n){var r=e&&n||0,i=e||new Array(16),o=(t=t||{}).node||ho,a=void 0!==t.clockseq?t.clockseq:fo;if(null==o||null==a){var s=t.random||(t.rng||uo)();null==o&&(o=ho=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==a&&(a=fo=16383&(s[6]<<8|s[7]))}var u=void 0!==t.msecs?t.msecs:Date.now(),c=void 0!==t.nsecs?t.nsecs:vo+1,l=u-yo+(c-vo)/1e4;if(l<0&&void 0===t.clockseq&&(a=a+1&16383),(l<0||u>yo)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");yo=u,vo=c,fo=a;var h=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[r++]=h>>>24&255,i[r++]=h>>>16&255,i[r++]=h>>>8&255,i[r++]=255&h;var d=u/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=255&d,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var f=0;f<6;++f)i[r+f]=o[f];return e||go(i)},v3:Io,v4:function(t,e,n){var r=(t=t||{}).random||(t.rng||uo)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var i=0;i<16;++i)e[n+i]=r[i];return e}return go(r)},v5:Do,NIL:"00000000-0000-0000-0000-000000000000",version:function(t){if(!lo(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)},validate:lo,stringify:go,parse:wo}),_o=R(Oo),zo=_o.v4,Po=function(t,e,n,r){if("string"!=typeof t)throw new TypeError(t+" must be a string");var i="number"==typeof(r=r||{}).version?r.version:2;if(1!==i&&2!==i)throw new TypeError(i+" must be 1 or 2");var o={method:t};if(2===i&&(o.jsonrpc="2.0"),e){if("object"!==F(e)&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");o.params=e}if(void 0===n){var a="function"==typeof r.generator?r.generator:function(){return zo()};o.id=a(o,r)}else 2===i&&null===n?r.notificationIdNull&&(o.id=null):o.id=n;return o},Bo=_o.v4,Ro=Po,Uo=function t(e,n){if(!(this instanceof t))return new t(e,n);n||(n={}),this.options={reviver:void 0!==n.reviver?n.reviver:null,replacer:void 0!==n.replacer?n.replacer:null,generator:void 0!==n.generator?n.generator:function(){return Bo()},version:void 0!==n.version?n.version:2,notificationIdNull:"boolean"==typeof n.notificationIdNull&&n.notificationIdNull},this.callServer=e},Wo=Uo;Uo.prototype.request=function(t,e,n,r){var i=this,o=null,a=Array.isArray(t)&&"function"==typeof e;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");var s,u=!a&&t&&"object"===F(t)&&"function"==typeof e;if(a||u)r=e,o=t;else{"function"==typeof n&&(r=n,n=void 0);var c="function"==typeof r;try{o=Ro(t,e,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(t){if(c)return r(t);throw t}if(!c)return o}try{s=JSON.stringify(o,this.options.replacer)}catch(t){return r(t)}return this.callServer(s,(function(t,e){i._parseResponse(t,e,r)})),o},Uo.prototype._parseResponse=function(t,e,n){if(t)n(t);else{if(!e)return n();var r;try{r=JSON.parse(e,this.options.reviver)}catch(t){return n(t)}if(3===n.length){if(Array.isArray(r)){var i=function(t){return void 0!==t.error};return n(null,r.filter(i),r.filter((function(t){return!i(t)})))}return n(null,r.error,r.result)}n(null,r)}};var Qo,Fo=Wo,Yo={},Ho={exports:{}};(Qo=Ho).exports=function(t){return t&&t.__esModule?t:{default:t}},Qo.exports.__esModule=!0,Qo.exports.default=Qo.exports;var Vo,qo,Go,Zo,Jo={exports:{}},Xo={exports:{}};function Ko(){return Vo||(Vo=1,function(t){function e(n){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(Xo)),Xo.exports}function $o(){return qo||(qo=1,function(t){var e=Ko().default;function n(){
6
6
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
7
- t.exports=n=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var r={},i=Object.prototype,o=i.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof p?e:p,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return S()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=A(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var f={};function p(){}function m(){}function g(){}var y={};l(y,s,(function(){return this}));var v=Object.getPrototypeOf,w=v&&v(v(N([])));w&&w!==i&&o.call(w,s)&&(y=w);var b=g.prototype=p.prototype=Object.create(y);function M(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,n){function r(i,a,s,u){var c=d(t[i],t,a);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==e(h)&&o.call(h,"__await")?n.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):n.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;this._invoke=function(t,e){function o(){return new n((function(n,i){r(t,e,n,i)}))}return i=i?i.then(o,o):o()}}function A(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,A(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=d(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function N(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:S}}function S(){return{value:void 0,done:!0}}return m.prototype=g,l(b,"constructor",g),l(g,"constructor",m),m.displayName=l(g,c,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,l(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},r.awrap=function(t){return{__await:t}},M(k.prototype),l(k.prototype,u,(function(){return this})),r.AsyncIterator=k,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var a=new k(h(t,e,n,i),o);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},M(b),l(b,c,"Generator"),l(b,s,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},r.values=N,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(Jo)),Jo.exports}var ta,ea={exports:{}};var na,ra={exports:{}};function ia(){return na||(na=1,function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports}(ra)),ra.exports}var oa,aa={exports:{}};function sa(){return oa||(oa=1,function(t){function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports}(aa)),aa.exports}var ua,ca,la={exports:{}},ha={exports:{}};function da(){return ua||(ua=1,function(t){function e(n,r){return t.exports=e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n,r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(ha)),ha.exports}function fa(){return ca||(ca=1,function(t){var e=da();t.exports=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&e(t,n)},t.exports.__esModule=!0,t.exports.default=t.exports}(la)),la.exports}var pa,ma,ga={exports:{}},ya={exports:{}};function va(){return pa||(pa=1,function(t){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports.default=t.exports}(ya)),ya.exports}function wa(){return ma||(ma=1,function(t){var e=Ko().default,n=va();t.exports=function(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(t)},t.exports.__esModule=!0,t.exports.default=t.exports}(ga)),ga.exports}var ba,Ma={exports:{}};function ka(){return ba||(ba=1,function(t){function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(Ma)),Ma.exports}var Aa,La={exports:{}};function Ea(){return Aa||(Aa=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},s.prototype.emit=function(t,e,r,i,o,a){var s=n?n+t:t;if(!this._events[s])return!1;var u,c,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,a),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var d,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,i);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==e||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}(La)),La.exports}!function(t){var e=Ho.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=e(function(){if(Zo)return Go;Zo=1;var t=$o()();Go=t;try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":F(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return Go}()),r=e((ta||(ta=1,function(t){function e(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=t.apply(n,r);function s(t){e(a,i,o,s,u,"next",t)}function u(t){e(a,i,o,s,u,"throw",t)}s(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports}(ea)),ea.exports)),i=e(Ko()),o=e(ia()),a=e(sa()),s=e(fa()),u=e(wa()),c=e(ka()),l=Ea();function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,c.default)(t);if(e){var i=(0,c.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.default)(this,n)}}var d=function(t){(0,s.default)(f,t);var e,u,c,l,d=h(f);function f(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,f);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,h=void 0===l?1e3:l,p=r.max_reconnects,m=void 0===p?5:p,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(e=d.call(this)).webSocketFactory=t,e.queue={},e.rpc_id=0,e.address=n,e.autoconnect=s,e.ready=!1,e.reconnect=c,e.reconnect_timer_id=void 0,e.reconnect_interval=h,e.max_reconnects=m,e.rest_options=g,e.current_reconnects=0,e.generate_request_id=i||function(){return++e.rpc_id},e.autoconnect&&e._connect(e.address,Object.assign({autoconnect:e.autoconnect,reconnect:e.reconnect,reconnect_interval:e.reconnect_interval,max_reconnects:e.max_reconnects},e.rest_options)),e}return(0,a.default)(f,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(t,e,n,r){var o=this;return r||"object"!==(0,i.default)(n)||(r=n,n=null),new Promise((function(i,a){if(!o.ready)return a(new Error("socket not ready"));var s=o.generate_request_id(t,e),u={jsonrpc:"2.0",method:t,params:e||null,id:s};o.socket.send(JSON.stringify(u),r,(function(t){if(t)return a(t);o.queue[s]={promise:[i,a]},n&&(o.queue[s].timeout=setTimeout((function(){delete o.queue[s],a(new Error("reply timeout"))}),n))}))}))}},{key:"login",value:(l=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("rpc.login",e);case 2:if(r=t.sent){t.next=5;break}throw new Error("authentication failed");case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function t(){return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("__listMethods");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(t,e){var n=this;return new Promise((function(r,i){if(!n.ready)return i(new Error("socket not ready"));var o={jsonrpc:"2.0",method:t,params:e||null};n.socket.send(JSON.stringify(o),(function(t){if(t)return i(t);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.on",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed subscribing to an event '"+e+"' with: "+r[e]);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"unsubscribe",value:(e=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.off",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"close",value:function(t,e){this.socket.close(t||1e3,e)}},{key:"_connect",value:function(t,e){var n=this;clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(t){var e=t.data;e instanceof ArrayBuffer&&(e=Tt.from(e).toString());try{e=JSON.parse(e)}catch(t){return}if(e.notification&&n.listeners(e.notification).length){if(!Object.keys(e.params).length)return n.emit(e.notification);var r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(var i=0;i<e.params.length;i++)r.push(e.params[i]);return Promise.resolve().then((function(){n.emit.apply(n,r)}))}if(!n.queue[e.id])return e.method&&e.params?Promise.resolve().then((function(){n.emit(e.method,e.params)})):void 0;"error"in e=="result"in e&&n.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),n.queue[e.id].timeout&&clearTimeout(n.queue[e.id].timeout),e.error?n.queue[e.id].promise[1](e.error):n.queue[e.id].promise[0](e.result),delete n.queue[e.id]})),this.socket.addEventListener("error",(function(t){return n.emit("error",t)})),this.socket.addEventListener("close",(function(r){var i=r.code,o=r.reason;n.ready&&setTimeout((function(){return n.emit("close",i,o)}),0),n.ready=!1,n.socket=void 0,1e3!==i&&(n.current_reconnects++,n.reconnect&&(n.max_reconnects>n.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval)))}))}}]),f}(l.EventEmitter);t.default=d}(Yo);var xa=B(Yo),Na={};!function(t){var e=Ho.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t,e){return new u(t,e)};var n=e(ia()),r=e(sa()),i=e(fa()),o=e(wa()),a=e(ka());function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,a.default)(t);if(e){var i=(0,a.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,o.default)(this,n)}}var u=function(t){(0,i.default)(o,t);var e=s(o);function o(t,r,i){var a;return(0,n.default)(this,o),(a=e.call(this)).socket=new window.WebSocket(t,i),a.socket.onopen=function(){return a.emit("open")},a.socket.onmessage=function(t){return a.emit("message",t.data)},a.socket.onerror=function(t){return a.emit("error",t)},a.socket.onclose=function(t){a.emit("close",t.code,t.reason)},a}return(0,r.default)(o,[{key:"send",value:function(t,e,n){var r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,n){this.socket.addEventListener(t,e,n)}}]),o}(Ea().EventEmitter)}(Na);for(var Sa=B(Na),Ia=[],Ta=[],Ca=[],ja=BigInt(0),Da=BigInt(1),Oa=BigInt(2),_a=BigInt(7),za=BigInt(256),Pa=BigInt(113),Ba=0,Ra=Da,Ua=1,Wa=0;Ba<24;Ba++){var Qa=[Wa,(2*Ua+3*Wa)%5];Ua=Qa[0],Wa=Qa[1],Ia.push(2*(5*Wa+Ua)),Ta.push((Ba+1)*(Ba+2)/2%64);for(var Fa=ja,Ya=0;Ya<7;Ya++)(Ra=(Ra<<Da^(Ra>>_a)*Pa)%za)&Oa&&(Fa^=Da<<(Da<<BigInt(Ya))-Da);Ca.push(Fa)}var Ha=at(Te.split(Ca,!0),2),Va=Ha[0],qa=Ha[1],Ga=function(t,e,n){return n>32?Te.rotlBH(t,e,n):Te.rotlSH(t,e,n)},Za=function(t,e,n){return n>32?Te.rotlBL(t,e,n):Te.rotlSL(t,e,n)};var Ja=function(t){J(n,Ae);var e=it(n);function n(t,r,i){var o,a,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(V(this,n),(o=e.call(this)).blockLen=t,o.suffix=r,o.outputLen=i,o.enableXOF=s,o.rounds=u,o.pos=0,o.posOut=0,o.finished=!1,o.destroyed=!1,we.number(i),0>=o.blockLen||o.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");return o.state=new Uint8Array(200),o.state32=(a=o.state,new Uint32Array(a.buffer,a.byteOffset,Math.floor(a.byteLength/4))),o}return G(n,[{key:"keccak",value:function(){!function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,n=new Uint32Array(10),r=24-e;r<24;r++){for(var i=0;i<10;i++)n[i]=t[i]^t[i+10]^t[i+20]^t[i+30]^t[i+40];for(var o=0;o<10;o+=2)for(var a=(o+8)%10,s=(o+2)%10,u=n[s],c=n[s+1],l=Ga(u,c,1)^n[a],h=Za(u,c,1)^n[a+1],d=0;d<50;d+=10)t[o+d]^=l,t[o+d+1]^=h;for(var f=t[2],p=t[3],m=0;m<24;m++){var g=Ta[m],y=Ga(f,p,g),v=Za(f,p,g),w=Ia[m];f=t[w],p=t[w+1],t[w]=y,t[w+1]=v}for(var b=0;b<50;b+=10){for(var M=0;M<10;M++)n[M]=t[b+M];for(var k=0;k<10;k++)t[b+k]^=~n[(k+2)%10]&n[(k+4)%10]}t[0]^=Va[r],t[1]^=qa[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}},{key:"update",value:function(t){we.exists(this);for(var e=this.blockLen,n=this.state,r=(t=ke(t)).length,i=0;i<r;){for(var o=Math.min(e-this.pos,r-i),a=0;a<o;a++)n[this.pos++]^=t[i++];this.pos===e&&this.keccak()}return this}},{key:"finish",value:function(){if(!this.finished){this.finished=!0;var t=this.state,e=this.suffix,n=this.pos,r=this.blockLen;t[n]^=e,0!=(128&e)&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}}},{key:"writeInto",value:function(t){we.exists(this,!1),we.bytes(t),this.finish();for(var e=this.state,n=this.blockLen,r=0,i=t.length;r<i;){this.posOut>=n&&this.keccak();var o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}},{key:"xofInto",value:function(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}},{key:"xof",value:function(t){return we.number(t),this.xofInto(new Uint8Array(t))}},{key:"digestInto",value:function(t){if(we.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}},{key:"digest",value:function(){return this.digestInto(new Uint8Array(this.outputLen))}},{key:"destroy",value:function(){this.destroyed=!0,this.state.fill(0)}},{key:"_cloneInto",value:function(t){var e=this.blockLen,r=this.suffix,i=this.outputLen,o=this.rounds,a=this.enableXOF;return t||(t=new n(e,r,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}}]),n}(),Xa=function(t,e,n){return Le((function(){return new Ja(e,t,n)}))};Xa(6,144,28),Xa(6,136,32),Xa(6,104,48),Xa(6,72,64),Xa(1,144,28);var Ka=Xa(1,136,32);Xa(1,104,48),Xa(1,72,64);var $a=function(t,e,n){return r=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ja(e,t,void 0===r.dkLen?n:r.dkLen,!0)},i=function(t,e){return r(e).update(ke(t)).digest()},o=r({}),i.outputLen=o.outputLen,i.blockLen=o.blockLen,i.create=function(t){return r(t)},i;var r,i,o};$a(31,168,16),$a(31,136,32);var ts=function(t){J(n,Ae);var e=it(n);function n(t,r){var i;V(this,n),(i=e.call(this)).finished=!1,i.destroyed=!1,we.hash(t);var o=ke(r);if(i.iHash=t.create(),"function"!=typeof i.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");i.blockLen=i.iHash.blockLen,i.outputLen=i.iHash.outputLen;var a=i.blockLen,s=new Uint8Array(a);s.set(o.length>a?t.create().update(o).digest():o);for(var u=0;u<s.length;u++)s[u]^=54;i.iHash.update(s),i.oHash=t.create();for(var c=0;c<s.length;c++)s[c]^=106;return i.oHash.update(s),s.fill(0),i}return G(n,[{key:"update",value:function(t){return we.exists(this),this.iHash.update(t),this}},{key:"digestInto",value:function(t){we.exists(this),we.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}},{key:"digest",value:function(){var t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}},{key:"_cloneInto",value:function(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));var e=this.oHash,n=this.iHash,r=this.finished,i=this.destroyed,o=this.blockLen,a=this.outputLen;return t.finished=r,t.destroyed=i,t.blockLen=o,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}},{key:"destroy",value:function(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}]),n}(),es=function(t,e,n){return new ts(t,e).update(n).digest()};es.create=function(t,e){return new ts(t,e)};var ns=BigInt(0),rs=BigInt(1),is=BigInt(2),os=BigInt(3),as=BigInt(8),ss=Object.freeze({a:ns,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:rs,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),us=function(t,e){return(t+e/is)/e},cs=BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),ls=function(t){var e=ss.n,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-rs*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,a=BigInt("0x100000000000000000000000000000000"),s=us(o*t,e),u=us(-r*t,e),c=Us(t-s*n-u*i,e),l=Us(-s*r-u*o,e),h=c>a,d=l>a;if(h&&(c=e-c),d&&(l=e-l),c>a||l>a)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:h,k1:c,k2neg:d,k2:l}},hs=32,ds=32,fs=hs+1,ps=2*hs+1;function ms(t){var e=ss.a,n=ss.b,r=Us(t*t),i=Us(r*t);return Us(i+e*t+n)}var gs=ss.a===ns,ys=function(t){J(n,et(Error));var e=it(n);function n(t){return V(this,n),e.call(this,t)}return G(n)}();function vs(t){if(!(t instanceof ws))throw new TypeError("JacobianPoint expected")}var ws=function(){function t(e,n,r){V(this,t),this.x=e,this.y=n,this.z=r}return G(t,[{key:"equals",value:function(t){vs(t);var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=Us(r*r),u=Us(a*a),c=Us(e*u),l=Us(i*s),h=Us(Us(n*a)*u),d=Us(Us(o*r)*s);return c===l&&h===d}},{key:"negate",value:function(){return new t(this.x,Us(-this.y),this.z)}},{key:"double",value:function(){var e=this.x,n=this.y,r=this.z,i=Us(e*e),o=Us(n*n),a=Us(o*o),s=e+o,u=Us(is*(Us(s*s)-i-a)),c=Us(os*i),l=Us(c*c),h=Us(l-is*u);return new t(h,Us(c*(u-h)-as*a),Us(is*n*r))}},{key:"add",value:function(e){vs(e);var n=this.x,r=this.y,i=this.z,o=e.x,a=e.y,s=e.z;if(o===ns||a===ns)return this;if(n===ns||r===ns)return e;var u=Us(i*i),c=Us(s*s),l=Us(n*c),h=Us(o*u),d=Us(Us(r*s)*c),f=Us(Us(a*i)*u),p=Us(h-l),m=Us(f-d);if(p===ns)return m===ns?this.double():t.ZERO;var g=Us(p*p),y=Us(p*g),v=Us(l*g),w=Us(m*m-y-is*v);return new t(w,Us(m*(v-w)-d*y),Us(i*s*p))}},{key:"subtract",value:function(t){return this.add(t.negate())}},{key:"multiplyUnsafe",value:function(e){var n=t.ZERO;if("bigint"==typeof e&&e===ns)return n;var r=Rs(e);if(r===rs)return this;if(!gs){for(var i=n,o=this;r>ns;)r&rs&&(i=i.add(o)),o=o.double(),r>>=rs;return i}for(var a=ls(r),s=a.k1neg,u=a.k1,c=a.k2neg,l=a.k2,h=n,d=n,f=this;u>ns||l>ns;)u&rs&&(h=h.add(f)),l&rs&&(d=d.add(f)),f=f.double(),u>>=rs,l>>=rs;return s&&(h=h.negate()),c&&(d=d.negate()),d=new t(Us(d.x*cs),d.y,d.z),h.add(d)}},{key:"precomputeWindow",value:function(t){for(var e=gs?128/t+1:256/t+1,n=[],r=this,i=r,o=0;o<e;o++){i=r,n.push(i);for(var a=1;a<Math.pow(2,t-1);a++)i=i.add(r),n.push(i);r=i.double()}return n}},{key:"wNAF",value:function(e,n){!n&&this.equals(t.BASE)&&(n=ks.BASE);var r=n&&n._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");var i=n&&Ms.get(n);i||(i=this.precomputeWindow(r),n&&1!==r&&(i=t.normalizeZ(i),Ms.set(n,i)));for(var o=t.ZERO,a=t.BASE,s=1+(gs?128/r:256/r),u=Math.pow(2,r-1),c=BigInt(Math.pow(2,r)-1),l=Math.pow(2,r),h=BigInt(r),d=0;d<s;d++){var f=d*u,p=Number(e&c);e>>=h,p>u&&(p-=l,e+=rs);var m=f,g=f+Math.abs(p)-1,y=d%2!=0,v=p<0;0===p?a=a.add(bs(y,i[m])):o=o.add(bs(v,i[g]))}return{p:o,f:a}}},{key:"multiply",value:function(e,n){var r,i,o=Rs(e);if(gs){var a=ls(o),s=a.k1neg,u=a.k1,c=a.k2neg,l=a.k2,h=this.wNAF(u,n),d=h.p,f=h.f,p=this.wNAF(l,n),m=p.p,g=p.f;d=bs(s,d),m=new t(Us((m=bs(c,m)).x*cs),m.y,m.z),r=d.add(m),i=f.add(g)}else{var y=this.wNAF(o,n);r=y.p,i=y.f}return t.normalizeZ([r,i])[0]}},{key:"toAffine",value:function(e){var n=this.x,r=this.y,i=this.z,o=this.equals(t.ZERO);null==e&&(e=o?as:Qs(i));var a=e,s=Us(a*a),u=Us(s*a),c=Us(n*s),l=Us(r*u),h=Us(i*a);if(o)return ks.ZERO;if(h!==rs)throw new Error("invZ was invalid");return new ks(c,l)}}],[{key:"fromAffine",value:function(e){if(!(e instanceof ks))throw new TypeError("JacobianPoint#fromAffine: expected Point");return e.equals(ks.ZERO)?t.ZERO:new t(e.x,e.y,rs)}},{key:"toAffineBatch",value:function(t){var e=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ss.P,n=new Array(t.length),r=t.reduce((function(t,r,i){return r===ns?t:(n[i]=t,Us(t*r,e))}),rs),i=Qs(r,e);return t.reduceRight((function(t,r,i){return r===ns?t:(n[i]=Us(t*n[i],e),Us(t*r,e))}),i),n}(t.map((function(t){return t.z})));return t.map((function(t,n){return t.toAffine(e[n])}))}},{key:"normalizeZ",value:function(e){return t.toAffineBatch(e).map(t.fromAffine)}}]),t}();function bs(t,e){var n=e.negate();return t?n:e}ws.BASE=new ws(ss.Gx,ss.Gy,rs),ws.ZERO=new ws(ns,rs,ns);var Ms=new WeakMap,ks=function(){function t(e,n){V(this,t),this.x=e,this.y=n}return G(t,[{key:"_setWindowSize",value:function(t){this._WINDOW_SIZE=t,Ms.delete(this)}},{key:"hasEvenY",value:function(){return this.y%is===ns}},{key:"toRawBytes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return zs(this.toHex(t))}},{key:"toHex",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=js(this.x);if(t){var n=this.hasEvenY()?"02":"03";return"".concat(n).concat(e)}return"04".concat(e).concat(js(this.y))}},{key:"toHexX",value:function(){return this.toHex(!0).slice(2)}},{key:"toRawX",value:function(){return this.toRawBytes(!0).slice(1)}},{key:"assertValidity",value:function(){var t="Point is not on elliptic curve",e=this.x,n=this.y;if(!Vs(e)||!Vs(n))throw new Error(t);var r=Us(n*n);if(Us(r-ms(e))!==ns)throw new Error(t)}},{key:"equals",value:function(t){return this.x===t.x&&this.y===t.y}},{key:"negate",value:function(){return new t(this.x,Us(-this.y))}},{key:"double",value:function(){return ws.fromAffine(this).double().toAffine()}},{key:"add",value:function(t){return ws.fromAffine(this).add(ws.fromAffine(t)).toAffine()}},{key:"subtract",value:function(t){return this.add(t.negate())}},{key:"multiply",value:function(t){return ws.fromAffine(this).multiply(t,this).toAffine()}},{key:"multiplyAndAddUnsafe",value:function(e,n,r){var i=ws.fromAffine(this),o=n===ns||n===rs||this!==t.BASE?i.multiplyUnsafe(n):i.multiply(n),a=ws.fromAffine(e).multiplyUnsafe(r),s=o.add(a);return s.equals(ws.ZERO)?void 0:s.toAffine()}}],[{key:"fromCompressedHex",value:function(e){var n=32===e.length,r=Ps(n?e:e.subarray(1));if(!Vs(r))throw new Error("Point is not on curve");var i=function(t){var e=ss.P,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),s=BigInt(88),u=t*t*t%e,c=u*u*t%e,l=Ws(c,os)*c%e,h=Ws(l,os)*c%e,d=Ws(h,is)*u%e,f=Ws(d,r)*d%e,p=Ws(f,i)*f%e,m=Ws(p,a)*p%e,g=Ws(m,s)*m%e,y=Ws(g,a)*p%e,v=Ws(y,os)*c%e,w=Ws(v,o)*f%e,b=Ws(w,n)*u%e,M=Ws(b,is),k=M*M%e;if(k!==t)throw new Error("Cannot find square root");return M}(ms(r)),o=(i&rs)===rs;n?o&&(i=Us(-i)):1==(1&e[0])!==o&&(i=Us(-i));var a=new t(r,i);return a.assertValidity(),a}},{key:"fromUncompressedHex",value:function(e){var n=new t(Ps(e.subarray(1,hs+1)),Ps(e.subarray(hs+1,2*hs+1)));return n.assertValidity(),n}},{key:"fromHex",value:function(t){var e=Bs(t),n=e.length,r=e[0];if(n===hs)return this.fromCompressedHex(e);if(n===fs&&(2===r||3===r))return this.fromCompressedHex(e);if(n===ps&&4===r)return this.fromUncompressedHex(e);throw new Error("Point.fromHex: received invalid point. Expected 32-".concat(fs," compressed bytes or ").concat(ps," uncompressed bytes, not ").concat(n))}},{key:"fromPrivateKey",value:function(e){return t.BASE.multiply(Gs(e))}},{key:"fromSignature",value:function(e,n,r){var i=function(t){if(t instanceof Es)return t.assertValidity(),t;try{return Es.fromDER(t)}catch(e){return Es.fromCompact(t)}}(n),o=i.r,a=i.s;if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");var s=Fs(Bs(e)),u=ss.n,c=2===r||3===r?o+u:o,l=Qs(c,u),h=Us(-s*l,u),d=Us(a*l,u),f=1&r?"03":"02",p=t.fromHex(f+js(c)),m=t.BASE.multiplyAndAddUnsafe(p,h,d);if(!m)throw new Error("Cannot recover signature: point at infinify");return m.assertValidity(),m}}]),t}();function As(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function Ls(t){if(t.length<2||2!==t[0])throw new Error("Invalid signature integer tag: ".concat(Ss(t)));var e=t[1],n=t.subarray(2,e+2);if(!e||n.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:Ps(n),left:t.subarray(e+2)}}ks.BASE=new ks(ss.Gx,ss.Gy),ks.ZERO=new ks(ns,ns);var Es=function(){function t(e,n){V(this,t),this.r=e,this.s=n,this.assertValidity()}return G(t,[{key:"assertValidity",value:function(){var t=this.r,e=this.s;if(!Hs(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Hs(e))throw new Error("Invalid Signature: s must be 0 < s < n")}},{key:"hasHighS",value:function(){var t=ss.n>>rs;return this.s>t}},{key:"normalizeS",value:function(){return this.hasHighS()?new t(this.r,Us(-this.s,ss.n)):this}},{key:"toDERRawBytes",value:function(){return zs(this.toDERHex())}},{key:"toDERHex",value:function(){var t=As(Os(this.s)),e=As(Os(this.r)),n=t.length/2,r=e.length/2,i=Os(n),o=Os(r),a=Os(r+n+4);return"30".concat(a,"02").concat(o).concat(e,"02").concat(i).concat(t)}},{key:"toRawBytes",value:function(){return this.toDERRawBytes()}},{key:"toHex",value:function(){return this.toDERHex()}},{key:"toCompactRawBytes",value:function(){return zs(this.toCompactHex())}},{key:"toCompactHex",value:function(){return js(this.r)+js(this.s)}}],[{key:"fromCompact",value:function(e){var n=e instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof e&&!n)throw new TypeError("".concat(r,": Expected string or Uint8Array"));var i=n?Ss(e):e;if(128!==i.length)throw new Error("".concat(r,": Expected 64-byte hex"));return new t(_s(i.slice(0,64)),_s(i.slice(64,128)))}},{key:"fromDER",value:function(e){var n=e instanceof Uint8Array;if("string"!=typeof e&&!n)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");var r=function(t){if(t.length<2||48!=t[0])throw new Error("Invalid signature tag: ".concat(Ss(t)));if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");var e=Ls(t.subarray(2)),n=e.data,r=Ls(e.left),i=r.data,o=r.left;if(o.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(Ss(o)));return{r:n,s:i}}(n?e:zs(e));return new t(r.r,r.s)}},{key:"fromHex",value:function(t){return this.fromDER(t)}}]),t}();function xs(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(!e.every((function(t){return t instanceof Uint8Array})))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];for(var r=e.reduce((function(t,e){return t+e.length}),0),i=new Uint8Array(r),o=0,a=0;o<e.length;o++){var s=e[o];i.set(s,a),a+=s.length}return i}var Ns=Array.from({length:256},(function(t,e){return e.toString(16).padStart(2,"0")}));function Ss(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");for(var e="",n=0;n<t.length;n++)e+=Ns[t[n]];return e}var Is,Ts,Cs=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function js(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(ns<=t&&t<Cs))throw new Error("Expected number 0 <= n < 2^256");return t.toString(16).padStart(64,"0")}function Ds(t){var e=zs(js(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function Os(t){var e=t.toString(16);return 1&e.length?"0".concat(e):e}function _s(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+F(t));return BigInt("0x".concat(t))}function zs(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+F(t));if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);for(var e=new Uint8Array(t.length/2),n=0;n<e.length;n++){var r=2*n,i=t.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[n]=o}return e}function Ps(t){return _s(Ss(t))}function Bs(t){return t instanceof Uint8Array?Uint8Array.from(t):zs(t)}function Rs(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&Hs(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function Us(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ss.P,n=t%e;return n>=ns?n:e+n}function Ws(t,e){for(var n=ss.P,r=t;e-- >ns;)r*=r,r%=n;return r}function Qs(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ss.P;if(t===ns||e<=ns)throw new Error("invert: expected positive integers, got n=".concat(t," mod=").concat(e));for(var n=Us(t,e),r=e,i=ns,o=rs;n!==ns;){var a=r%n,s=i-o*(r/n);r=n,n=a,i=o,o=s}if(r!==rs)throw new Error("invert: does not exist");return Us(i,e)}function Fs(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=function(t){var e=8*t.length-8*ds,n=Ps(t);return e>0?n>>BigInt(e):n}(t);if(e)return n;var r=ss.n;return n>=r?n-r:n}var Ys=function(){function t(e,n){if(V(this,t),this.hashLen=e,this.qByteLen=n,"number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof n||n<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(e).fill(1),this.k=new Uint8Array(e).fill(0),this.counter=0}var e,n;return G(t,[{key:"hmac",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return ru.hmacSha256.apply(ru,[this.k].concat(e))}},{key:"hmacSync",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Ts.apply(void 0,[this.k].concat(e))}},{key:"checkSync",value:function(){if("function"!=typeof Ts)throw new ys("hmacSha256Sync needs to be set")}},{key:"incr",value:function(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}},{key:"reseed",value:(n=H(Q().mark((function t(){var e,n=arguments;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=n.length>0&&void 0!==n[0]?n[0]:new Uint8Array,t.next=3,this.hmac(this.v,Uint8Array.from([0]),e);case 3:return this.k=t.sent,t.next=6,this.hmac(this.v);case 6:if(this.v=t.sent,0!==e.length){t.next=9;break}return t.abrupt("return");case 9:return t.next=11,this.hmac(this.v,Uint8Array.from([1]),e);case 11:return this.k=t.sent,t.next=14,this.hmac(this.v);case 14:this.v=t.sent;case 15:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"reseedSync",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}},{key:"generate",value:(e=H(Q().mark((function t(){var e,n,r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.incr(),e=0,n=[];case 3:if(!(e<this.qByteLen)){t.next=12;break}return t.next=6,this.hmac(this.v);case 6:this.v=t.sent,r=this.v.slice(),n.push(r),e+=this.v.length,t.next=3;break;case 12:return t.abrupt("return",xs.apply(void 0,n));case 13:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"generateSync",value:function(){this.checkSync(),this.incr();for(var t=0,e=[];t<this.qByteLen;){this.v=this.hmacSync(this.v);var n=this.v.slice();e.push(n),t+=this.v.length}return xs.apply(void 0,e)}}]),t}();function Hs(t){return ns<t&&t<ss.n}function Vs(t){return ns<t&&t<ss.P}function qs(t,e,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=ss.n,o=Fs(t,!0);if(Hs(o)){var a=Qs(o,i),s=ks.BASE.multiply(o),u=Us(s.x,i);if(u!==ns){var c=Us(a*Us(e+n*u,i),i);if(c!==ns){var l=new Es(u,c),h=(s.x===l.r?0:2)|Number(s.y&rs);return r&&l.hasHighS()&&(l=l.normalizeS(),h^=1),{sig:l,recovery:h}}}}}function Gs(t){var e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(t.length!==2*ds)throw new Error("Expected 32 bytes of private key");e=_s(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(t.length!==ds)throw new Error("Expected 32 bytes of private key");e=Ps(t)}if(!Hs(e))throw new Error("Expected private key: 0 < key < n");return e}function Zs(t){return Ps(t.length>hs?t.slice(0,hs):t)}function Js(t){var e=Zs(t),n=Us(e,ss.n);return Xs(n<ns?e:n)}function Xs(t){return Ds(t)}function Ks(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=function(t,e,n){if(null==t)throw new Error('sign: expected valid message hash, not "'.concat(t,'"'));var r=Bs(t),i=Gs(e),o=[Xs(i),Js(r)];if(null!=n){!0===n&&(n=ru.randomBytes(hs));var a=Bs(n);if(a.length!==hs)throw new Error("sign: Expected ".concat(hs," bytes of extra data"));o.push(a)}return{seed:xs.apply(void 0,o),m:Zs(r),d:i}}(t,e,r.extraEntropy),o=i.seed,a=i.m,s=i.d,u=new Ys(32,ds);for(u.reseedSync(o);!(n=qs(u.generateSync(),a,s,r.canonical));)u.reseedSync();return function(t,e){var n=t.sig,r=t.recovery,i=Object.assign({canonical:!0,der:!0},e),o=i.der,a=i.recovered,s=o?n.toDERRawBytes():n.toCompactRawBytes();return a?[s,r]:s}(n,r)}ks.BASE._setWindowSize(8);var $s,tu,eu={node:Qe,web:"object"===("undefined"==typeof self?"undefined":F(self))&&"crypto"in self?self.crypto:void 0},nu={},ru={bytesToHex:Ss,hexToBytes:zs,concatBytes:xs,mod:Us,invert:Qs,isValidPrivateKey:function(t){try{return Gs(t),!0}catch(t){return!1}},_bigintTo32Bytes:Ds,_normalizePrivateKey:Gs,hashToPrivateKey:function(t){t=Bs(t);var e=ds+8;if(t.length<e||t.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return Ds(Us(Ps(t),ss.n-rs)+rs)},randomBytes:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(eu.web)return eu.web.getRandomValues(new Uint8Array(t));if(eu.node){var e=eu.node.randomBytes;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:function(){return ru.hashToPrivateKey(ru.randomBytes(ds+8))},precompute:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ks.BASE,n=e===ks.BASE?e:new ks(e.x,e.y);return n._setWindowSize(t),n.multiply(os),n},sha256:function(){var t=H(Q().mark((function t(){var e,n,r,i,o,a,s=arguments;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e=s.length,n=new Array(e),r=0;r<e;r++)n[r]=s[r];if(!eu.web){t.next=8;break}return t.next=4,eu.web.subtle.digest("SHA-256",xs.apply(void 0,n));case 4:return i=t.sent,t.abrupt("return",new Uint8Array(i));case 8:if(!eu.node){t.next=15;break}return o=eu.node.createHash,a=o("sha256"),n.forEach((function(t){return a.update(t)})),t.abrupt("return",Uint8Array.from(a.digest()));case 15:throw new Error("The environment doesn't have sha256 function");case 16:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),hmacSha256:(tu=H(Q().mark((function t(e){var n,r,i,o,a,s,u,c,l=arguments;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=l.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=l[i];if(!eu.web){t.next=12;break}return t.next=4,eu.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);case 4:return o=t.sent,a=xs.apply(void 0,r),t.next=8,eu.web.subtle.sign("HMAC",o,a);case 8:return s=t.sent,t.abrupt("return",new Uint8Array(s));case 12:if(!eu.node){t.next=19;break}return u=eu.node.createHmac,c=u("sha256",e),r.forEach((function(t){return c.update(t)})),t.abrupt("return",Uint8Array.from(c.digest()));case 19:throw new Error("The environment doesn't have hmac-sha256 function");case 20:case"end":return t.stop()}}),t)}))),function(t){return tu.apply(this,arguments)}),sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:($s=H(Q().mark((function t(e){var n,r,i,o,a,s=arguments;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(n=nu[e])){t.next=7;break}return t.next=4,ru.sha256(Uint8Array.from(e,(function(t){return t.charCodeAt(0)})));case 4:r=t.sent,n=xs(r,r),nu[e]=n;case 7:for(i=s.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=s[a];return t.abrupt("return",ru.sha256.apply(ru,[n].concat(o)));case 9:case"end":return t.stop()}}),t)}))),function(t){return $s.apply(this,arguments)}),taggedHashSync:function(t){if("function"!=typeof Is)throw new ys("sha256Sync is undefined, you need to set it");var e=nu[t];if(void 0===e){var n=Is(Uint8Array.from(t,(function(t){return t.charCodeAt(0)})));e=xs(n,n),nu[t]=e}for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return Is.apply(void 0,[e].concat(i))},_JacobianPoint:ws};Object.defineProperties(ru,{sha256Sync:{configurable:!1,get:function(){return Is},set:function(t){Is||(Is=t)}},hmacSha256Sync:{configurable:!1,get:function(){return Ts},set:function(t){Ts||(Ts=t)}}});var iu=["commitment"],ou=["encoding"],au=["commitment"],su=["commitment"];Rn.sha512Sync=function(){var t;return We((t=Rn).concatBytes.apply(t,arguments))};var uu=Rn.randomPrivateKey,cu=function(){var t=Rn.randomPrivateKey(),e=lu(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},lu=zn.getPublicKey;function hu(t){try{return cn.fromHex(t,!0),!0}catch(t){return!1}}var du=function(t,e){return zn.sign(t,e.slice(0,32))},fu=zn.verify,pu=function(t){return Tt.isBuffer(t)?t:t instanceof Uint8Array?Tt.from(t.buffer,t.byteOffset,t.byteLength):Tt.from(t)},mu=function(){function t(e){V(this,t),Object.assign(this,e)}return G(t,[{key:"encode",value:function(){return Tt.from(Cr(yu,this))}}],[{key:"decode",value:function(t){return Or(yu,this,t)}},{key:"decodeUnchecked",value:function(t){return vr(yu,this,t)}}]),t}(),gu=function(t){J(n,mu);var e=it(n);function n(t){var r;if(V(this,n),(r=e.call(this,t)).enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");return Object.keys(t).map((function(t){r.enum=t})),r}return G(n)}(),yu=new Map,vu=32;var wu=1,bu=function(t,e){J(a,mu);var n,r,i,o=it(a);function a(t){var e;if(V(this,a),(e=o.call(this,{}))._bn=void 0,function(t){return void 0!==t._bn}(t))e._bn=t._bn;else{if("string"==typeof t){var n=qn.decode(t);if(n.length!=vu)throw new Error("Invalid public key input");e._bn=new Qn(n)}else e._bn=new Qn(t);if(e._bn.byteLength()>vu)throw new Error("Invalid public key input")}return e}return G(a,[{key:"equals",value:function(t){return this._bn.eq(t._bn)}},{key:"toBase58",value:function(){return qn.encode(this.toBytes())}},{key:"toJSON",value:function(){return this.toBase58()}},{key:"toBytes",value:function(){var t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}},{key:"toBuffer",value:function(){var t=this._bn.toArrayLike(Tt);if(t.length===vu)return t;var e=Tt.alloc(32);return t.copy(e,32-t.length),e}},{key:e,get:function(){return"PublicKey(".concat(this.toString(),")")}},{key:"toString",value:function(){return this.toBase58()}}],[{key:"unique",value:function(){var t=new a(wu);return wu+=1,new a(t.toBuffer())}},{key:"createWithSeed",value:(i=H(Q().mark((function t(e,n,r){var i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=Tt.concat([e.toBuffer(),Tt.from(n),r.toBuffer()]),o=tr(i),t.abrupt("return",new a(o));case 3:case"end":return t.stop()}}),t)}))),function(t,e,n){return i.apply(this,arguments)})},{key:"createProgramAddressSync",value:function(t,e){var n=Tt.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=Tt.concat([n,pu(t)])})),n=Tt.concat([n,e.toBuffer(),Tt.from("ProgramDerivedAddress")]);var r=tr(n);if(hu(r))throw new Error("Invalid seeds, address must fall off the curve");return new a(r)}},{key:"createProgramAddress",value:(r=H(Q().mark((function t(e,n){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.createProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"findProgramAddressSync",value:function(t,e){for(var n,r=255;0!=r;){try{var i=t.concat(Tt.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}},{key:"findProgramAddress",value:(n=H(Q().mark((function t(e,n){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.findProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"isOnCurve",value:function(t){return hu(new a(t).toBytes())}}]),a}(0,Symbol.toStringTag);bu.default=new bu("11111111111111111111111111111111"),yu.set(bu,{kind:"struct",fields:[["_bn","u256"]]});var Mu=function(){function t(e){if(V(this,t),this._publicKey=void 0,this._secretKey=void 0,e){var n=pu(e);if(64!==e.length)throw new Error("bad secret key size");this._publicKey=n.slice(32,64),this._secretKey=n.slice(0,32)}else this._secretKey=pu(uu()),this._publicKey=pu(lu(this._secretKey))}return G(t,[{key:"publicKey",get:function(){return new bu(this._publicKey)}},{key:"secretKey",get:function(){return Tt.concat([this._secretKey,this._publicKey],64)}}]),t}(),ku=new bu("BPFLoader1111111111111111111111111111111111"),Au=1232,Lu=127,Eu=64,xu=function(t){J(n,et(Error));var e=it(n);function n(t){var r;return V(this,n),(r=e.call(this,"Signature ".concat(t," has expired: block height exceeded."))).signature=void 0,r.signature=t,r}return G(n)}();Object.defineProperty(xu.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var Nu=function(t){J(n,et(Error));var e=it(n);function n(t,r){var i;return V(this,n),(i=e.call(this,"Transaction was not confirmed in ".concat(r.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(t," using the Solana Explorer or CLI tools."))).signature=void 0,i.signature=t,i}return G(n)}();Object.defineProperty(Nu.prototype,"name",{value:"TransactionExpiredTimeoutError"});var Su=function(t){J(n,et(Error));var e=it(n);function n(t){var r;return V(this,n),(r=e.call(this,"Signature ".concat(t," has expired: the nonce is no longer valid."))).signature=void 0,r.signature=t,r}return G(n)}();Object.defineProperty(Su.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var Iu=function(){function t(e,n){V(this,t),this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=n}return G(t,[{key:"keySegments",value:function(){var t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}},{key:"get",value:function(t){var e,n=ft(this.keySegments());try{for(n.s();!(e=n.n()).done;){var r=e.value;if(t<r.length)return r[t];t-=r.length}}catch(t){n.e(t)}finally{n.f()}}},{key:"length",get:function(){return this.keySegments().flat().length}},{key:"compileInstructions",value:function(t){if(this.length>256)throw new Error("Account index overflow encountered during compilation");var e=new Map;this.keySegments().flat().forEach((function(t,n){e.set(t.toBase58(),n)}));var n=function(t){var n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((function(t){return{programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((function(t){return n(t.pubkey)})),data:t.data}}))}}]),t}(),Tu=function(){return Ni(32,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey")},Cu=function(){return Ni(64,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature")},ju=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",e=Ei([ki("length"),ki("lengthPadding"),Ni(wi(ki(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=function(t,e){return n(t,e).chars.toString()},i.encode=function(t,e,n){var i={chars:Tt.from(t,"utf8")};return r(i,e,n)},i.alloc=function(t){return ki().span+ki().span+Tt.from(t,"utf8").length},i};function Du(t,e){var n=function t(n){if(n.span>=0)return n.span;if("function"==typeof n.alloc)return n.alloc(e[n.property]);if("count"in n&&"elementLayout"in n){var r=e[n.property];if(Array.isArray(r))return r.length*t(n.elementLayout)}else if("fields"in n)return Du({layout:n},e[n.property]);return 0},r=0;return t.layout.fields.forEach((function(t){r+=n(t)})),r}function Ou(t){for(var e=0,n=0;;){var r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function _u(t,e){for(var n=e;;){var r=127&n;if(0==(n>>=7)){t.push(r);break}r|=128,t.push(r)}}function zu(t,e){if(!t)throw new Error(e||"Assertion failed")}var Pu,Bu=function(){function t(e,n){V(this,t),this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=n}return G(t,[{key:"getMessageComponents",value:function(){var t=st(this.keyMetaMap.entries());zu(t.length<=256,"Max static account keys length exceeded");var e=t.filter((function(t){var e=at(t,2)[1];return e.isSigner&&e.isWritable})),n=t.filter((function(t){var e=at(t,2)[1];return e.isSigner&&!e.isWritable})),r=t.filter((function(t){var e=at(t,2)[1];return!e.isSigner&&e.isWritable})),i=t.filter((function(t){var e=at(t,2)[1];return!e.isSigner&&!e.isWritable})),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};return zu(e.length>0,"Expected at least one writable signer key"),zu(at(e[0],1)[0]===this.payer.toBase58(),"Expected first writable signer key to be the fee payer"),[o,[].concat(st(e.map((function(t){var e=at(t,1)[0];return new bu(e)}))),st(n.map((function(t){var e=at(t,1)[0];return new bu(e)}))),st(r.map((function(t){var e=at(t,1)[0];return new bu(e)}))),st(i.map((function(t){var e=at(t,1)[0];return new bu(e)}))))]}},{key:"extractTableLookup",value:function(t){var e=at(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&t.isWritable})),2),n=e[0],r=e[1],i=at(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&!t.isWritable})),2),o=i[0],a=i[1];if(0!==n.length||0!==o.length)return[{accountKey:t.key,writableIndexes:n,readonlyIndexes:o},{writable:r,readonly:a}]}},{key:"drainKeysFoundInLookupTable",value:function(t,e){var n,r=this,i=new Array,o=new Array,a=ft(this.keyMetaMap.entries());try{var s=function(){var a=at(n.value,2),s=a[0],u=a[1];if(e(u)){var c=new bu(s),l=t.findIndex((function(t){return t.equals(c)}));l>=0&&(zu(l<256,"Max lookup table index exceeded"),i.push(l),o.push(c),r.keyMetaMap.delete(s))}};for(a.s();!(n=a.n()).done;)s()}catch(t){a.e(t)}finally{a.f()}return[i,o]}}],[{key:"compile",value:function(e,n){var r=new Map,i=function(t){var e=t.toBase58(),n=r.get(e);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,n)),n},o=i(n);o.isSigner=!0,o.isWritable=!0;var a,s=ft(e);try{for(s.s();!(a=s.n()).done;){var u=a.value;i(u.programId).isInvoked=!0;var c,l=ft(u.keys);try{for(l.s();!(c=l.n()).done;){var h=c.value,d=i(h.pubkey);d.isSigner||(d.isSigner=h.isSigner),d.isWritable||(d.isWritable=h.isWritable)}}catch(t){l.e(t)}finally{l.f()}}}catch(t){s.e(t)}finally{s.f()}return new t(n,r)}}]),t}(),Ru=function(){function t(e){var n=this;V(this,t),this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map((function(t){return new bu(t)})),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach((function(t){return n.indexToProgramIds.set(t.programIdIndex,n.accountKeys[t.programIdIndex])}))}return G(t,[{key:"version",get:function(){return"legacy"}},{key:"staticAccountKeys",get:function(){return this.accountKeys}},{key:"compiledInstructions",get:function(){return this.instructions.map((function(t){return{programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:qn.decode(t.data)}}))}},{key:"addressTableLookups",get:function(){return[]}},{key:"getAccountKeys",value:function(){return new Iu(this.staticAccountKeys)}},{key:"isAccountSigner",value:function(t){return t<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(t){var e=this.header.numRequiredSignatures;return t>=this.header.numRequiredSignatures?t-e<this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts:t<e-this.header.numReadonlySignedAccounts}},{key:"isProgramId",value:function(t){return this.indexToProgramIds.has(t)}},{key:"programIds",value:function(){return st(this.indexToProgramIds.values())}},{key:"nonProgramIds",value:function(){var t=this;return this.accountKeys.filter((function(e,n){return!t.isProgramId(n)}))}},{key:"serialize",value:function(){var t=this.accountKeys.length,e=[];_u(e,t);var n=this.instructions.map((function(t){var e=t.accounts,n=t.programIdIndex,r=Array.from(qn.decode(t.data)),i=[];_u(i,e.length);var o=[];return _u(o,r.length),{programIdIndex:n,keyIndicesCount:Tt.from(i),keyIndices:e,dataLength:Tt.from(o),data:r}})),r=[];_u(r,n.length);var i=Tt.alloc(Au);Tt.from(r).copy(i);var o=r.length;n.forEach((function(t){var e=Ei([bi("programIdIndex"),Ni(t.keyIndicesCount.length,"keyIndicesCount"),xi(bi("keyIndex"),t.keyIndices.length,"keyIndices"),Ni(t.dataLength.length,"dataLength"),xi(bi("userdatum"),t.data.length,"data")]).encode(t,i,o);o+=e})),i=i.slice(0,o);var a=Ei([Ni(1,"numRequiredSignatures"),Ni(1,"numReadonlySignedAccounts"),Ni(1,"numReadonlyUnsignedAccounts"),Ni(e.length,"keyCount"),xi(Tu("key"),t,"keys"),Tu("recentBlockhash")]),s={numRequiredSignatures:Tt.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Tt.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Tt.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Tt.from(e),keys:this.accountKeys.map((function(t){return pu(t.toBytes())})),recentBlockhash:qn.decode(this.recentBlockhash)},u=Tt.alloc(2048),c=a.encode(s,u);return i.copy(u,c),u.slice(0,c+i.length)}}],[{key:"compile",value:function(e){var n=at(Bu.compile(e.instructions,e.payerKey).getMessageComponents(),2),r=n[0],i=n[1],o=new Iu(i).compileInstructions(e.instructions).map((function(t){return{programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:qn.encode(t.data)}}));return new t({header:r,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:o})}},{key:"from",value:function(e){var n=st(e),r=n.shift();if(r!==(r&Lu))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");for(var i=n.shift(),o=n.shift(),a=Ou(n),s=[],u=0;u<a;u++){var c=n.slice(0,vu);n=n.slice(vu),s.push(new bu(Tt.from(c)))}for(var l=n.slice(0,vu),h=Ou(n=n.slice(vu)),d=[],f=0;f<h;f++){var p=n.shift(),m=Ou(n),g=n.slice(0,m),y=Ou(n=n.slice(m)),v=n.slice(0,y),w=qn.encode(Tt.from(v));n=n.slice(y),d.push({programIdIndex:p,accounts:g,data:w})}return new t({header:{numRequiredSignatures:r,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:o},recentBlockhash:qn.encode(Tt.from(l)),accountKeys:s,instructions:d})}}]),t}(),Uu=function(){function t(e){V(this,t),this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=e.header,this.staticAccountKeys=e.staticAccountKeys,this.recentBlockhash=e.recentBlockhash,this.compiledInstructions=e.compiledInstructions,this.addressTableLookups=e.addressTableLookups}return G(t,[{key:"version",get:function(){return 0}},{key:"numAccountKeysFromLookups",get:function(){var t,e=0,n=ft(this.addressTableLookups);try{for(n.s();!(t=n.n()).done;){var r=t.value;e+=r.readonlyIndexes.length+r.writableIndexes.length}}catch(t){n.e(t)}finally{n.f()}return e}},{key:"getAccountKeys",value:function(t){var e;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");e=t.accountKeysFromLookups}else if(t&&"addressLookupTableAccounts"in t&&t.addressLookupTableAccounts)e=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 Iu(this.staticAccountKeys,e)}},{key:"isAccountSigner",value:function(t){return t<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(t){var e=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;if(t>=n){var r=t-n,i=this.addressTableLookups.reduce((function(t,e){return t+e.writableIndexes.length}),0);return r<i}return t>=this.header.numRequiredSignatures?t-e<n-e-this.header.numReadonlyUnsignedAccounts:t<e-this.header.numReadonlySignedAccounts}},{key:"resolveAddressTableLookups",value:function(t){var e,n={writable:[],readonly:[]},r=ft(this.addressTableLookups);try{var i=function(){var r=e.value,i=t.find((function(t){return t.key.equals(r.accountKey)}));if(!i)throw new Error("Failed to find address lookup table account for table key ".concat(r.accountKey.toBase58()));var o,a=ft(r.writableIndexes);try{for(a.s();!(o=a.n()).done;){var s=o.value;if(!(s<i.state.addresses.length))throw new Error("Failed to find address for index ".concat(s," in address lookup table ").concat(r.accountKey.toBase58()));n.writable.push(i.state.addresses[s])}}catch(t){a.e(t)}finally{a.f()}var u,c=ft(r.readonlyIndexes);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(!(l<i.state.addresses.length))throw new Error("Failed to find address for index ".concat(l," in address lookup table ").concat(r.accountKey.toBase58()));n.readonly.push(i.state.addresses[l])}}catch(t){c.e(t)}finally{c.f()}};for(r.s();!(e=r.n()).done;)i()}catch(t){r.e(t)}finally{r.f()}return n}},{key:"serialize",value:function(){var t=Array();_u(t,this.staticAccountKeys.length);var e=this.serializeInstructions(),n=Array();_u(n,this.compiledInstructions.length);var r=this.serializeAddressTableLookups(),i=Array();_u(i,this.addressTableLookups.length);var o=Ei([bi("prefix"),Ei([bi("numRequiredSignatures"),bi("numReadonlySignedAccounts"),bi("numReadonlyUnsignedAccounts")],"header"),Ni(t.length,"staticAccountKeysLength"),xi(Tu(),this.staticAccountKeys.length,"staticAccountKeys"),Tu("recentBlockhash"),Ni(n.length,"instructionsLength"),Ni(e.length,"serializedInstructions"),Ni(i.length,"addressTableLookupsLength"),Ni(r.length,"serializedAddressTableLookups")]),a=new Uint8Array(Au),s=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map((function(t){return t.toBytes()})),recentBlockhash:qn.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},a);return a.slice(0,s)}},{key:"serializeInstructions",value:function(){var t,e=0,n=new Uint8Array(Au),r=ft(this.compiledInstructions);try{for(r.s();!(t=r.n()).done;){var i=t.value,o=Array();_u(o,i.accountKeyIndexes.length);var a=Array();_u(a,i.data.length),e+=Ei([bi("programIdIndex"),Ni(o.length,"encodedAccountKeyIndexesLength"),xi(bi(),i.accountKeyIndexes.length,"accountKeyIndexes"),Ni(a.length,"encodedDataLength"),Ni(i.data.length,"data")]).encode({programIdIndex:i.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(o),accountKeyIndexes:i.accountKeyIndexes,encodedDataLength:new Uint8Array(a),data:i.data},n,e)}}catch(t){r.e(t)}finally{r.f()}return n.slice(0,e)}},{key:"serializeAddressTableLookups",value:function(){var t,e=0,n=new Uint8Array(Au),r=ft(this.addressTableLookups);try{for(r.s();!(t=r.n()).done;){var i=t.value,o=Array();_u(o,i.writableIndexes.length);var a=Array();_u(a,i.readonlyIndexes.length),e+=Ei([Tu("accountKey"),Ni(o.length,"encodedWritableIndexesLength"),xi(bi(),i.writableIndexes.length,"writableIndexes"),Ni(a.length,"encodedReadonlyIndexesLength"),xi(bi(),i.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:i.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(o),writableIndexes:i.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(a),readonlyIndexes:i.readonlyIndexes},n,e)}}catch(t){r.e(t)}finally{r.f()}return n.slice(0,e)}}],[{key:"compile",value:function(e){var n,r=Bu.compile(e.instructions,e.payerKey),i=new Array,o={writable:new Array,readonly:new Array},a=ft(e.addressLookupTableAccounts||[]);try{for(a.s();!(n=a.n()).done;){var s=n.value,u=r.extractTableLookup(s);if(void 0!==u){var c,l,h=at(u,2),d=h[0],f=h[1],p=f.writable,m=f.readonly;i.push(d),(c=o.writable).push.apply(c,st(p)),(l=o.readonly).push.apply(l,st(m))}}}catch(t){a.e(t)}finally{a.f()}var g=at(r.getMessageComponents(),2),y=g[0],v=g[1],w=new Iu(v,o).compileInstructions(e.instructions);return new t({header:y,staticAccountKeys:v,recentBlockhash:e.recentBlockhash,compiledInstructions:w,addressTableLookups:i})}},{key:"deserialize",value:function(e){var n=st(e),r=n.shift(),i=r&Lu;zu(r!==i,"Expected versioned message but received legacy message");zu(0===i,"Expected versioned message with version 0 but found version ".concat(i));for(var o={numRequiredSignatures:n.shift(),numReadonlySignedAccounts:n.shift(),numReadonlyUnsignedAccounts:n.shift()},a=[],s=Ou(n),u=0;u<s;u++)a.push(new bu(n.splice(0,vu)));for(var c=qn.encode(n.splice(0,vu)),l=Ou(n),h=[],d=0;d<l;d++){var f=n.shift(),p=Ou(n),m=n.splice(0,p),g=Ou(n),y=new Uint8Array(n.splice(0,g));h.push({programIdIndex:f,accountKeyIndexes:m,data:y})}for(var v=Ou(n),w=[],b=0;b<v;b++){var M=new bu(n.splice(0,vu)),k=Ou(n),A=n.splice(0,k),L=Ou(n),E=n.splice(0,L);w.push({accountKey:M,writableIndexes:A,readonlyIndexes:E})}return new t({header:o,staticAccountKeys:a,recentBlockhash:c,compiledInstructions:h,addressTableLookups:w})}}]),t}(),Wu={deserializeMessageVersion:function(t){var e=t[0],n=e&Lu;return n===e?"legacy":n},deserialize:function(t){var e=Wu.deserializeMessageVersion(t);if("legacy"===e)return Ru.from(t);if(0===e)return Uu.deserialize(t);throw new Error("Transaction message version ".concat(e," deserialization is not supported"))}};!function(t){t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID"}(Pu||(Pu={}));var Qu=Tt.alloc(Eu).fill(0),Fu=function(){function t(e){V(this,t),this.keys=void 0,this.programId=void 0,this.data=Tt.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}return G(t,[{key:"toJSON",value:function(){return{keys:this.keys.map((function(t){var e=t.pubkey,n=t.isSigner,r=t.isWritable;return{pubkey:e.toJSON(),isSigner:n,isWritable:r}})),programId:this.programId.toJSON(),data:st(this.data)}}}]),t}(),Yu=function(){function t(e){if(V(this,t),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,e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){var n=e.minContextSlot,r=e.nonceInfo;this.minNonceContextSlot=n,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){var i=e.blockhash,o=e.lastValidBlockHeight;this.recentBlockhash=i,this.lastValidBlockHeight=o}else{var a=e.recentBlockhash,s=e.nonceInfo;s&&(this.nonceInfo=s),this.recentBlockhash=a}}var e;return G(t,[{key:"signature",get:function(){return this.signatures.length>0?this.signatures[0].signature:null}},{key:"toJSON",value:function(){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((function(t){return t.toJSON()})),signers:this.signatures.map((function(t){return t.publicKey.toJSON()}))}}},{key:"add",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(0===n.length)throw new Error("No instructions");return n.forEach((function(e){"instructions"in e?t.instructions=t.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?t.instructions.push(e):t.instructions.push(new Fu(e))})),this}},{key:"compileMessage",value:function(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;var t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction].concat(st(this.instructions)):this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(var r=0;r<e.length;r++)if(void 0===e[r].programId)throw new Error("Transaction instruction index ".concat(r," has undefined program id"));var i=[],o=[];e.forEach((function(t){t.keys.forEach((function(t){o.push(W({},t))}));var e=t.programId.toString();i.includes(e)||i.push(e)})),i.forEach((function(t){o.push({pubkey:new bu(t),isSigner:!1,isWritable:!1})}));var a=[];o.forEach((function(t){var e=t.pubkey.toString(),n=a.findIndex((function(t){return t.pubkey.toString()===e}));n>-1?(a[n].isWritable=a[n].isWritable||t.isWritable,a[n].isSigner=a[n].isSigner||t.isSigner):a.push(t)})),a.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58())}));var s=a.findIndex((function(t){return t.pubkey.equals(n)}));if(s>-1){var u=at(a.splice(s,1),1)[0];u.isSigner=!0,u.isWritable=!0,a.unshift(u)}else a.unshift({pubkey:n,isSigner:!0,isWritable:!0});var c,l=ft(this.signatures);try{var h=function(){var t=c.value,e=a.findIndex((function(e){return e.pubkey.equals(t.publicKey)}));if(!(e>-1))throw new Error("unknown signer: ".concat(t.publicKey.toString()));a[e].isSigner||(a[e].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."))};for(l.s();!(c=l.n()).done;)h()}catch(t){l.e(t)}finally{l.f()}var d=0,f=0,p=0,m=[],g=[];a.forEach((function(t){var e=t.pubkey,n=t.isSigner,r=t.isWritable;n?(m.push(e.toString()),d+=1,r||(f+=1)):(g.push(e.toString()),r||(p+=1))}));var y=m.concat(g),v=e.map((function(t){var e=t.data,n=t.programId;return{programIdIndex:y.indexOf(n.toString()),accounts:t.keys.map((function(t){return y.indexOf(t.pubkey.toString())})),data:qn.encode(e)}}));return v.forEach((function(t){zu(t.programIdIndex>=0),t.accounts.forEach((function(t){return zu(t>=0)}))})),new Ru({header:{numRequiredSignatures:d,numReadonlySignedAccounts:f,numReadonlyUnsignedAccounts:p},accountKeys:y,recentBlockhash:t,instructions:v})}},{key:"_compile",value:function(){var t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);if(this.signatures.length===e.length){var n=this.signatures.every((function(t,n){return e[n].equals(t.publicKey)}));if(n)return t}return this.signatures=e.map((function(t){return{signature:null,publicKey:t}})),t}},{key:"serializeMessage",value:function(){return this._compile().serialize()}},{key:"getEstimatedFee",value:(e=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getFeeForMessage(this.compileMessage());case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"setSigners",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)throw new Error("No signers");var r=new Set;this.signatures=e.filter((function(t){var e=t.toString();return!r.has(e)&&(r.add(e),!0)})).map((function(t){return{signature:null,publicKey:t}}))}},{key:"sign",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=e;o<a.length;o++){var s=a[o],u=s.publicKey.toString();r.has(u)||(r.add(u),i.push(s))}this.signatures=i.map((function(t){return{signature:null,publicKey:t.publicKey}}));var c=this._compile();this._partialSign.apply(this,[c].concat(i))}},{key:"partialSign",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=e;o<a.length;o++){var s=a[o],u=s.publicKey.toString();r.has(u)||(r.add(u),i.push(s))}var c=this._compile();this._partialSign.apply(this,[c].concat(i))}},{key:"_partialSign",value:function(t){for(var e=this,n=t.serialize(),r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];i.forEach((function(t){var r=du(n,t.secretKey);e._addSignature(t.publicKey,pu(r))}))}},{key:"addSignature",value:function(t,e){this._compile(),this._addSignature(t,e)}},{key:"_addSignature",value:function(t,e){zu(64===e.length);var n=this.signatures.findIndex((function(e){return t.equals(e.publicKey)}));if(n<0)throw new Error("unknown signer: ".concat(t.toString()));this.signatures[n].signature=Tt.from(e)}},{key:"verifySignatures",value:function(t){return this._verifySignatures(this.serializeMessage(),void 0===t||t)}},{key:"_verifySignatures",value:function(t,e){var n,r=ft(this.signatures);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i.signature,a=i.publicKey;if(null===o){if(e)return!1}else if(!fu(o,t,a.toBytes()))return!1}}catch(t){r.e(t)}finally{r.f()}return!0}},{key:"serialize",value:function(t){var e=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),n=e.requireAllSignatures,r=e.verifySignatures,i=this.serializeMessage();if(r&&!this._verifySignatures(i,n))throw new Error("Signature verification failed");return this._serialize(i)}},{key:"_serialize",value:function(t){var e=this.signatures,n=[];_u(n,e.length);var r=n.length+64*e.length+t.length,i=Tt.alloc(r);return zu(e.length<256),Tt.from(n).copy(i,0),e.forEach((function(t,e){var r=t.signature;null!==r&&(zu(64===r.length,"signature has invalid length"),Tt.from(r).copy(i,n.length+64*e))})),t.copy(i,n.length+64*e.length),zu(i.length<=Au,"Transaction too large: ".concat(i.length," > ").concat(Au)),i}},{key:"keys",get:function(){return zu(1===this.instructions.length),this.instructions[0].keys.map((function(t){return t.pubkey}))}},{key:"programId",get:function(){return zu(1===this.instructions.length),this.instructions[0].programId}},{key:"data",get:function(){return zu(1===this.instructions.length),this.instructions[0].data}}],[{key:"from",value:function(e){for(var n=st(e),r=Ou(n),i=[],o=0;o<r;o++){var a=n.slice(0,Eu);n=n.slice(Eu),i.push(qn.encode(Tt.from(a)))}return t.populate(Ru.from(n),i)}},{key:"populate",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=new t;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),n.forEach((function(t,n){var i={signature:t==qn.encode(Qu)?null:qn.decode(t),publicKey:e.accountKeys[n]};r.signatures.push(i)})),e.instructions.forEach((function(t){var n=t.accounts.map((function(t){var n=e.accountKeys[t];return{pubkey:n,isSigner:r.signatures.some((function(t){return t.publicKey.toString()===n.toString()}))||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}}));r.instructions.push(new Fu({keys:n,programId:e.accountKeys[t.programIdIndex],data:qn.decode(t.data)}))})),r._message=e,r._json=r.toJSON(),r}}]),t}(),Hu=function(){function t(e){V(this,t),this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}return G(t,[{key:"compileToLegacyMessage",value:function(){return Ru.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}},{key:"compileToV0Message",value:function(t){return Uu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:t})}}],[{key:"decompile",value:function(e,n){var r=e.header,i=e.compiledInstructions,o=e.recentBlockhash,a=r.numRequiredSignatures,s=r.numReadonlySignedAccounts,u=r.numReadonlyUnsignedAccounts,c=a-s;zu(c>0,"Message header is invalid");var l=e.staticAccountKeys.length-a-u;zu(l>=0,"Message header is invalid");var h=e.getAccountKeys(n),d=h.get(0);if(void 0===d)throw new Error("Failed to decompile message because no account keys were found");var f,p=[],m=ft(i);try{for(m.s();!(f=m.n()).done;){var g,y=f.value,v=[],w=ft(y.accountKeyIndexes);try{for(w.s();!(g=w.n()).done;){var b=g.value,M=h.get(b);if(void 0===M)throw new Error("Failed to find key for account key index ".concat(b));var k=void 0;k=b<a?b<c:b<h.staticAccountKeys.length?b-a<l:b-h.staticAccountKeys.length<h.accountKeysFromLookups.writable.length,v.push({pubkey:M,isSigner:b<r.numRequiredSignatures,isWritable:k})}}catch(t){w.e(t)}finally{w.f()}var A=h.get(y.programIdIndex);if(void 0===A)throw new Error("Failed to find program id for program id index ".concat(y.programIdIndex));p.push(new Fu({programId:A,data:pu(y.data),keys:v}))}}catch(t){m.e(t)}finally{m.f()}return new t({payerKey:d,instructions:p,recentBlockhash:o})}}]),t}(),Vu=function(){function t(e,n){if(V(this,t),this.signatures=void 0,this.message=void 0,void 0!==n)zu(n.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=n;else{for(var r=[],i=0;i<e.header.numRequiredSignatures;i++)r.push(new Uint8Array(Eu));this.signatures=r}this.message=e}return G(t,[{key:"version",get:function(){return this.message.version}},{key:"serialize",value:function(){var t=this.message.serialize(),e=Array();_u(e,this.signatures.length);var n=Ei([Ni(e.length,"encodedSignaturesLength"),xi(Cu(),this.signatures.length,"signatures"),Ni(t.length,"serializedMessage")]),r=new Uint8Array(2048),i=n.encode({encodedSignaturesLength:new Uint8Array(e),signatures:this.signatures,serializedMessage:t},r);return r.slice(0,i)}},{key:"sign",value:function(t){var e,n=this,r=this.message.serialize(),i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures),o=ft(t);try{var a=function(){var t=e.value,o=i.findIndex((function(e){return e.equals(t.publicKey)}));zu(o>=0,"Cannot sign with non signer key ".concat(t.publicKey.toBase58())),n.signatures[o]=du(r,t.secretKey)};for(o.s();!(e=o.n()).done;)a()}catch(t){o.e(t)}finally{o.f()}}},{key:"addSignature",value:function(t,e){zu(64===e.byteLength,"Signature must be 64 bytes long");var n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((function(e){return e.equals(t)}));zu(n>=0,"Can not add signature; `".concat(t.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=e}}],[{key:"deserialize",value:function(e){for(var n=st(e),r=[],i=Ou(n),o=0;o<i;o++)r.push(new Uint8Array(n.splice(0,Eu)));return new t(Wu.deserialize(new Uint8Array(n)),r)}}]),t}(),qu=new bu("SysvarC1ock11111111111111111111111111111111"),Gu=new bu("SysvarEpochSchedu1e111111111111111111111111"),Zu=new bu("Sysvar1nstructions1111111111111111111111111"),Ju=new bu("SysvarRecentB1ockHashes11111111111111111111"),Xu=new bu("SysvarRent111111111111111111111111111111111"),Ku=new bu("SysvarRewards111111111111111111111111111111"),$u=new bu("SysvarS1otHashes111111111111111111111111111"),tc=new bu("SysvarS1otHistory11111111111111111111111111"),ec=new bu("SysvarStakeHistory1111111111111111111111111");function nc(t,e,n,r){return rc.apply(this,arguments)}function rc(){return rc=H(Q().mark((function t(e,n,r,i){var o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},t.next=3,e.sendTransaction(n,r,o);case 3:if(a=t.sent,null==n.recentBlockhash||null==n.lastValidBlockHeight){t.next=10;break}return t.next=7,e.confirmTransaction({abortSignal:null==i?void 0:i.abortSignal,signature:a,blockhash:n.recentBlockhash,lastValidBlockHeight:n.lastValidBlockHeight},i&&i.commitment);case 7:s=t.sent.value,t.next=22;break;case 10:if(null==n.minNonceContextSlot||null==n.nonceInfo){t.next=18;break}return u=n.nonceInfo.nonceInstruction,c=u.keys[0].pubkey,t.next=15,e.confirmTransaction({abortSignal:null==i?void 0:i.abortSignal,minContextSlot:n.minNonceContextSlot,nonceAccountPubkey:c,nonceValue:n.nonceInfo.nonce,signature:a},i&&i.commitment);case 15:s=t.sent.value,t.next=22;break;case 18:return null!=(null==i?void 0:i.abortSignal)&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),t.next=21,e.confirmTransaction(a,i&&i.commitment);case 21:s=t.sent.value;case 22:if(!s.err){t.next=24;break}throw new Error("Transaction ".concat(a," failed (").concat(JSON.stringify(s),")"));case 24:return t.abrupt("return",a);case 25:case"end":return t.stop()}}),t)}))),rc.apply(this,arguments)}function ic(t){return new Promise((function(e){return setTimeout(e,t)}))}function oc(t,e){var n=t.layout.span>=0?t.layout.span:Du(t,e),r=Tt.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}function ac(t,e){var n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error("invalid instruction; instruction index mismatch ".concat(n.instruction," != ").concat(t.index));return n}var sc,uc=Ai("lamportsPerSignature"),cc=Ei([ki("version"),ki("state"),Tu("authorizedPubkey"),Tu("nonce"),Ei([uc],"feeCalculator")]),lc=cc.span,hc=function(){function t(e){V(this,t),this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}return G(t,null,[{key:"fromAccountData",value:function(e){var n=cc.decode(pu(e),0);return new t({authorizedPubkey:new bu(n.authorizedPubkey),nonce:new bu(n.nonce).toString(),feeCalculator:n.feeCalculator})}}]),t}(),dc=(sc=8,function(t){var e=Ni(sc,t),n=function(t){return{decode:t.decode.bind(t),encode:t.encode.bind(t)}}(e),r=n.encode,i=n.decode,o=e;return o.decode=function(t,e){var n=i(t,e);return Ii(Tt.from(n))},o.encode=function(t,e,n){var i=Ti(t,sc);return r(i,e,n)},o}),fc=function(){function t(){V(this,t)}return G(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=ki("instruction").decode(t.data),r=0,i=Object.entries(pc);r<i.length;r++){var o=at(i[r],2),a=o[0];if(o[1].index==n){e=a;break}}if(!e)throw new Error("Instruction type incorrect; not a SystemInstruction");return e}},{key:"decodeCreateAccount",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(pc.Create,t.data),n=e.lamports,r=e.space,i=e.programId;return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:n,space:r,programId:new bu(i)}}},{key:"decodeTransfer",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(pc.Transfer,t.data).lamports;return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}},{key:"decodeTransferWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(pc.TransferWithSeed,t.data),n=e.lamports,r=e.seed,i=e.programId;return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:n,seed:r,programId:new bu(i)}}},{key:"decodeAllocate",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);var e=ac(pc.Allocate,t.data).space;return{accountPubkey:t.keys[0].pubkey,space:e}}},{key:"decodeAllocateWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);var e=ac(pc.AllocateWithSeed,t.data),n=e.base,r=e.seed,i=e.space,o=e.programId;return{accountPubkey:t.keys[0].pubkey,basePubkey:new bu(n),seed:r,space:i,programId:new bu(o)}}},{key:"decodeAssign",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);var e=ac(pc.Assign,t.data).programId;return{accountPubkey:t.keys[0].pubkey,programId:new bu(e)}}},{key:"decodeAssignWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);var e=ac(pc.AssignWithSeed,t.data),n=e.base,r=e.seed,i=e.programId;return{accountPubkey:t.keys[0].pubkey,basePubkey:new bu(n),seed:r,programId:new bu(i)}}},{key:"decodeCreateWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(pc.CreateWithSeed,t.data),n=e.base,r=e.seed,i=e.lamports,o=e.space,a=e.programId;return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new bu(n),seed:r,lamports:i,space:o,programId:new bu(a)}}},{key:"decodeNonceInitialize",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(pc.InitializeNonceAccount,t.data).authorized;return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new bu(e)}}},{key:"decodeNonceAdvance",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),ac(pc.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}},{key:"decodeNonceWithdraw",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);var e=ac(pc.WithdrawNonceAccount,t.data).lamports;return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}},{key:"decodeNonceAuthorize",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(pc.AuthorizeNonceAccount,t.data).authorized;return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new bu(e)}}},{key:"checkProgramId",value:function(t){if(!t.equals(mc.programId))throw new Error("invalid instruction; programId is not SystemProgram")}},{key:"checkKeyLength",value:function(t,e){if(t.length<e)throw new Error("invalid instruction; found ".concat(t.length," keys, expected at least ").concat(e))}}]),t}(),pc=Object.freeze({Create:{index:0,layout:Ei([ki("instruction"),Li("lamports"),Li("space"),Tu("programId")])},Assign:{index:1,layout:Ei([ki("instruction"),Tu("programId")])},Transfer:{index:2,layout:Ei([ki("instruction"),dc("lamports")])},CreateWithSeed:{index:3,layout:Ei([ki("instruction"),Tu("base"),ju("seed"),Li("lamports"),Li("space"),Tu("programId")])},AdvanceNonceAccount:{index:4,layout:Ei([ki("instruction")])},WithdrawNonceAccount:{index:5,layout:Ei([ki("instruction"),Li("lamports")])},InitializeNonceAccount:{index:6,layout:Ei([ki("instruction"),Tu("authorized")])},AuthorizeNonceAccount:{index:7,layout:Ei([ki("instruction"),Tu("authorized")])},Allocate:{index:8,layout:Ei([ki("instruction"),Li("space")])},AllocateWithSeed:{index:9,layout:Ei([ki("instruction"),Tu("base"),ju("seed"),Li("space"),Tu("programId")])},AssignWithSeed:{index:10,layout:Ei([ki("instruction"),Tu("base"),ju("seed"),Tu("programId")])},TransferWithSeed:{index:11,layout:Ei([ki("instruction"),dc("lamports"),ju("seed"),Tu("programId")])},UpgradeNonceAccount:{index:12,layout:Ei([ki("instruction")])}}),mc=function(){function t(){V(this,t)}return G(t,null,[{key:"createAccount",value:function(t){var e=oc(pc.Create,{lamports:t.lamports,space:t.space,programId:pu(t.programId.toBuffer())});return new Fu({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}},{key:"transfer",value:function(t){var e,n;"basePubkey"in t?(e=oc(pc.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:pu(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]):(e=oc(pc.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]);return new Fu({keys:n,programId:this.programId,data:e})}},{key:"assign",value:function(t){var e,n;"basePubkey"in t?(e=oc(pc.AssignWithSeed,{base:pu(t.basePubkey.toBuffer()),seed:t.seed,programId:pu(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=oc(pc.Assign,{programId:pu(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]);return new Fu({keys:n,programId:this.programId,data:e})}},{key:"createAccountWithSeed",value:function(t){var e=oc(pc.CreateWithSeed,{base:pu(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:pu(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new Fu({keys:n,programId:this.programId,data:e})}},{key:"createNonceAccount",value:function(e){var n=new Yu;"basePubkey"in e&&"seed"in e?n.add(t.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:lc,programId:this.programId})):n.add(t.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:lc,programId:this.programId}));var r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return n.add(this.nonceInitialize(r)),n}},{key:"nonceInitialize",value:function(t){var e=oc(pc.InitializeNonceAccount,{authorized:pu(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Ju,isSigner:!1,isWritable:!1},{pubkey:Xu,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new Fu(n)}},{key:"nonceAdvance",value:function(t){var e=oc(pc.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Ju,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new Fu(n)}},{key:"nonceWithdraw",value:function(t){var e=oc(pc.WithdrawNonceAccount,{lamports:t.lamports});return new Fu({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:Ju,isSigner:!1,isWritable:!1},{pubkey:Xu,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}},{key:"nonceAuthorize",value:function(t){var e=oc(pc.AuthorizeNonceAccount,{authorized:pu(t.newAuthorizedPubkey.toBuffer())});return new Fu({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}},{key:"allocate",value:function(t){var e,n;"basePubkey"in t?(e=oc(pc.AllocateWithSeed,{base:pu(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:pu(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=oc(pc.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]);return new Fu({keys:n,programId:this.programId,data:e})}}]),t}();mc.programId=new bu("11111111111111111111111111111111");var gc=function(){function t(){V(this,t)}var e;return G(t,null,[{key:"getMinNumSignatures",value:function(e){return 2*(Math.ceil(e/t.chunkSize)+1+1)}},{key:"load",value:(e=H(Q().mark((function e(n,r,i,o,a){var s,u,c,l,h,d,f,p,m,g,y,v,w,b;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getMinimumBalanceForRentExemption(a.length);case 2:return s=e.sent,e.next=5,n.getAccountInfo(i.publicKey,"confirmed");case 5:if(u=e.sent,c=null,null===u){e.next=16;break}if(!u.executable){e.next=11;break}return console.error("Program load failed, account is already executable"),e.abrupt("return",!1);case 11:u.data.length!==a.length&&(c=c||new Yu).add(mc.allocate({accountPubkey:i.publicKey,space:a.length})),u.owner.equals(o)||(c=c||new Yu).add(mc.assign({accountPubkey:i.publicKey,programId:o})),u.lamports<s&&(c=c||new Yu).add(mc.transfer({fromPubkey:r.publicKey,toPubkey:i.publicKey,lamports:s-u.lamports})),e.next=17;break;case 16:c=(new Yu).add(mc.createAccount({fromPubkey:r.publicKey,newAccountPubkey:i.publicKey,lamports:s>0?s:1,space:a.length,programId:o}));case 17:if(null===c){e.next=20;break}return e.next=20,nc(n,c,[r,i],{commitment:"confirmed"});case 20:l=Ei([ki("instruction"),ki("offset"),ki("bytesLength"),ki("bytesLengthPadding"),xi(bi("byte"),wi(ki(),-8),"bytes")]),h=t.chunkSize,d=0,f=a,p=[];case 25:if(!(f.length>0)){e.next=39;break}if(m=f.slice(0,h),g=Tt.alloc(h+16),l.encode({instruction:0,offset:d,bytes:m,bytesLength:0,bytesLengthPadding:0},g),y=(new Yu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:g}),p.push(nc(n,y,[r,i],{commitment:"confirmed"})),!n._rpcEndpoint.includes("solana.com")){e.next=35;break}return e.next=35,ic(250);case 35:d+=h,f=f.slice(h),e.next=25;break;case 39:return e.next=41,Promise.all(p);case 41:return v=Ei([ki("instruction")]),w=Tt.alloc(v.span),v.encode({instruction:1},w),b=(new Yu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:Xu,isSigner:!1,isWritable:!1}],programId:o,data:w}),e.next=47,nc(n,b,[r,i],{commitment:"confirmed"});case 47:return e.abrupt("return",!0);case 48:case"end":return e.stop()}}),e)}))),function(t,n,r,i,o){return e.apply(this,arguments)})}]),t}();gc.chunkSize=932;var yc=new bu("BPFLoader2111111111111111111111111111111111"),vc=function(){function t(){V(this,t)}return G(t,null,[{key:"getMinNumSignatures",value:function(t){return gc.getMinNumSignatures(t)}},{key:"load",value:function(t,e,n,r,i){return gc.load(t,e,n,i,r)}}]),t}(),wc=Object.prototype.toString,bc=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function Mc(t,e){var n,r,i,o,a,s,u;if(!0===t)return"true";if(!1===t)return"false";switch(F(t)){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return Mc(t.toJSON(),e);if("[object Array]"===(u=wc.call(t))){for(i="[",r=t.length-1,n=0;n<r;n++)i+=Mc(t[n],!0)+",";return r>-1&&(i+=Mc(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=bc(t).sort()).length,i="",n=0;n<r;)void 0!==(s=Mc(t[a=o[n]],!1))&&(i&&(i+=","),i+=JSON.stringify(a)+":"+s),n++;return"{"+i+"}"}return JSON.stringify(t);case"function":case"undefined":return e?null:void 0;case"string":return JSON.stringify(t);default:return isFinite(t)?t:null}}var kc=function(t){var e=Mc(t,!1);if(void 0!==e)return""+e};function Ac(t){for(var e=0;t>1;)t/=2,e++;return e}var Lc=function(){function t(e,n,r,i,o){V(this,t),this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=n,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=o}return G(t,[{key:"getEpoch",value:function(t){return this.getEpochAndSlotIndex(t)[0]}},{key:"getEpochAndSlotIndex",value:function(t){if(t<this.firstNormalSlot){var e=Ac(function(t){return 0===t?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32))}(t+32+1))-Ac(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}var n=t-this.firstNormalSlot,r=Math.floor(n/this.slotsPerEpoch);return[this.firstNormalEpoch+r,n%this.slotsPerEpoch]}},{key:"getFirstSlotInEpoch",value:function(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}},{key:"getLastSlotInEpoch",value:function(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}},{key:"getSlotsInEpoch",value:function(t){return t<this.firstNormalEpoch?Math.pow(2,t+Ac(32)):this.slotsPerEpoch}}]),t}(),Ec=function(t){J(n,et(Error));var e=it(n);function n(t,r){var i;return V(this,n),(i=e.call(this,t)).logs=void 0,i.logs=r,i}return G(n)}(),xc=function(t){J(n,et(Error));var e=it(n);function n(t,r){var i,o=t.code,a=t.message,s=t.data;return V(this,n),(i=e.call(this,null!=r?"".concat(r,": ").concat(a):a)).code=void 0,i.data=void 0,i.code=o,i.data=s,i.name="SolanaJSONRPCError",i}return G(n)}(),Nc=globalThis.fetch,Sc=function(t){J(n,xa);var e=it(n);function n(t,r,i){var o;V(this,n);return(o=e.call(this,(function(t){var e=Sa(t,W({autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3},r));return o.underlyingSocket="socket"in e?e.socket:e,e}),t,r,i)).underlyingSocket=void 0,o}return G(n,[{key:"call",value:function(){for(var t,e,r=null===(t=this.underlyingSocket)||void 0===t?void 0:t.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(e=ot(X(n.prototype),"call",this)).call.apply(e,[this].concat(o)):Promise.reject(new Error("Tried to call a JSON-RPC method `"+o[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}},{key:"notify",value:function(){for(var t,e,r=null===(t=this.underlyingSocket)||void 0===t?void 0:t.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(e=ot(X(n.prototype),"notify",this)).call.apply(e,[this].concat(o)):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+o[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}}]),n}();var Ic=function(){function t(e){V(this,t),this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}return G(t,[{key:"isActive",value:function(){var t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}}],[{key:"deserialize",value:function(t){var e=function(t,e){var n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.typeIndex!==t.index)throw new Error("invalid account data; account type mismatch ".concat(n.typeIndex," != ").concat(t.index));return n}(Tc,t),n=t.length-56;zu(n>=0,"lookup table is invalid"),zu(n%32==0,"lookup table is invalid");var r=n/32,i=Ei([xi(Tu(),r,"addresses")]).decode(t.slice(56)).addresses;return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new bu(e.authority[0]):void 0,addresses:i.map((function(t){return new bu(t)}))}}}]),t}(),Tc={index:1,layout:Ei([ki("typeIndex"),dc("deactivationSlot"),Ai("lastExtendedSlot"),bi("lastExtendedStartIndex"),bi(),xi(Tu(),wi(bi(),-1),"authority")])},Cc=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;var jc=ao(Zi(bu),eo(),(function(t){return new bu(t)})),Dc=no([eo(),Ji("base64")]),Oc=ao(Zi(Tt),Dc,(function(t){return Tt.from(t[0],"base64")}));function _c(t){var e,n;if("string"==typeof t)e=t;else if(t){e=t.commitment,n=nt(t,iu)}return{commitment:e,config:n}}function zc(t){return io([ro({jsonrpc:Ji("2.0"),id:eo(),result:t}),ro({jsonrpc:Ji("2.0"),id:eo(),error:ro({code:oo(),message:eo(),data:$i(Vi("any",(function(){return!0})))})})])}var Pc=zc(oo());function Bc(t){return ao(zc(t),Pc,(function(e){return"error"in e?e:W(W({},e),{},{result:Fi(e.result,t)})}))}function Rc(t){return Bc(ro({context:ro({slot:Ki()}),value:t}))}function Uc(t){return ro({context:ro({slot:Ki()}),value:t})}function Wc(t,e){return 0===t?new Uu({header:e.header,staticAccountKeys:e.accountKeys.map((function(t){return new bu(t)})),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map((function(t){return{programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:qn.decode(t.data)}})),addressTableLookups:e.addressTableLookups}):new Ru(e)}var Qc=ro({foundation:Ki(),foundationTerm:Ki(),initial:Ki(),taper:Ki(),terminal:Ki()}),Fc=Bc(qi(Xi(ro({epoch:Ki(),effectiveSlot:Ki(),amount:Ki(),postBalance:Ki(),commission:$i(Xi(Ki()))})))),Yc=qi(ro({slot:Ki(),prioritizationFee:Ki()})),Hc=ro({total:Ki(),validator:Ki(),foundation:Ki(),epoch:Ki()}),Vc=ro({epoch:Ki(),slotIndex:Ki(),slotsInEpoch:Ki(),absoluteSlot:Ki(),blockHeight:$i(Ki()),transactionCount:$i(Ki())}),qc=ro({slotsPerEpoch:Ki(),leaderScheduleSlotOffset:Ki(),warmup:Gi(),firstNormalEpoch:Ki(),firstNormalSlot:Ki()}),Gc=to(eo(),qi(Ki())),Zc=Xi(io([ro({}),eo()])),Jc=ro({err:Zc}),Xc=Ji("receivedSignature"),Kc=ro({"solana-core":eo(),"feature-set":$i(Ki())}),$c=Rc(ro({err:Xi(io([ro({}),eo()])),logs:Xi(qi(eo())),accounts:$i(Xi(qi(Xi(ro({executable:Gi(),owner:eo(),lamports:Ki(),data:qi(eo()),rentEpoch:$i(Ki())}))))),unitsConsumed:$i(Ki()),returnData:$i(Xi(ro({programId:eo(),data:no([eo(),Ji("base64")])})))})),tl=Rc(ro({byIdentity:to(eo(),qi(Ki())),range:ro({firstSlot:Ki(),lastSlot:Ki()})}));var el=Bc(Qc),nl=Bc(Hc),rl=Bc(Yc),il=Bc(Vc),ol=Bc(qc),al=Bc(Gc),sl=Bc(Ki()),ul=Rc(ro({total:Ki(),circulating:Ki(),nonCirculating:Ki(),nonCirculatingAccounts:qi(jc)})),cl=ro({amount:eo(),uiAmount:Xi(Ki()),decimals:Ki(),uiAmountString:$i(eo())}),ll=Rc(qi(ro({address:jc,amount:eo(),uiAmount:Xi(Ki()),decimals:Ki(),uiAmountString:$i(eo())}))),hl=Rc(qi(ro({pubkey:jc,account:ro({executable:Gi(),owner:jc,lamports:Ki(),data:Oc,rentEpoch:Ki()})}))),dl=ro({program:eo(),parsed:oo(),space:Ki()}),fl=Rc(qi(ro({pubkey:jc,account:ro({executable:Gi(),owner:jc,lamports:Ki(),data:dl,rentEpoch:Ki()})}))),pl=Rc(qi(ro({lamports:Ki(),address:jc}))),ml=ro({executable:Gi(),owner:jc,lamports:Ki(),data:Oc,rentEpoch:Ki()}),gl=ro({pubkey:jc,account:ml}),yl=ao(io([Zi(Tt),dl]),io([Dc,dl]),(function(t){return Array.isArray(t)?Fi(t,Oc):t})),vl=ro({executable:Gi(),owner:jc,lamports:Ki(),data:yl,rentEpoch:Ki()}),wl=ro({pubkey:jc,account:vl}),bl=ro({state:io([Ji("active"),Ji("inactive"),Ji("activating"),Ji("deactivating")]),active:Ki(),inactive:Ki()}),Ml=Bc(qi(ro({signature:eo(),slot:Ki(),err:Zc,memo:Xi(eo()),blockTime:$i(Xi(Ki()))}))),kl=Bc(qi(ro({signature:eo(),slot:Ki(),err:Zc,memo:Xi(eo()),blockTime:$i(Xi(Ki()))}))),Al=ro({subscription:Ki(),result:Uc(ml)}),Ll=ro({pubkey:jc,account:ml}),El=ro({subscription:Ki(),result:Uc(Ll)}),xl=ro({parent:Ki(),slot:Ki(),root:Ki()}),Nl=ro({subscription:Ki(),result:xl}),Sl=io([ro({type:io([Ji("firstShredReceived"),Ji("completed"),Ji("optimisticConfirmation"),Ji("root")]),slot:Ki(),timestamp:Ki()}),ro({type:Ji("createdBank"),parent:Ki(),slot:Ki(),timestamp:Ki()}),ro({type:Ji("frozen"),slot:Ki(),timestamp:Ki(),stats:ro({numTransactionEntries:Ki(),numSuccessfulTransactions:Ki(),numFailedTransactions:Ki(),maxTransactionsPerEntry:Ki()})}),ro({type:Ji("dead"),slot:Ki(),timestamp:Ki(),err:eo()})]),Il=ro({subscription:Ki(),result:Sl}),Tl=ro({subscription:Ki(),result:Uc(io([Jc,Xc]))}),Cl=ro({subscription:Ki(),result:Ki()}),jl=ro({pubkey:eo(),gossip:Xi(eo()),tpu:Xi(eo()),rpc:Xi(eo()),version:Xi(eo())}),Dl=ro({votePubkey:eo(),nodePubkey:eo(),activatedStake:Ki(),epochVoteAccount:Gi(),epochCredits:qi(no([Ki(),Ki(),Ki()])),commission:Ki(),lastVote:Ki(),rootSlot:Xi(Ki())}),Ol=Bc(ro({current:qi(Dl),delinquent:qi(Dl)})),_l=io([Ji("processed"),Ji("confirmed"),Ji("finalized")]),zl=ro({slot:Ki(),confirmations:Xi(Ki()),err:Zc,confirmationStatus:$i(_l)}),Pl=Rc(qi(Xi(zl))),Bl=Bc(Ki()),Rl=ro({accountKey:jc,writableIndexes:qi(Ki()),readonlyIndexes:qi(Ki())}),Ul=ro({signatures:qi(eo()),message:ro({accountKeys:qi(eo()),header:ro({numRequiredSignatures:Ki(),numReadonlySignedAccounts:Ki(),numReadonlyUnsignedAccounts:Ki()}),instructions:qi(ro({accounts:qi(Ki()),data:eo(),programIdIndex:Ki()})),recentBlockhash:eo(),addressTableLookups:$i(qi(Rl))})}),Wl=ro({pubkey:jc,signer:Gi(),writable:Gi(),source:$i(io([Ji("transaction"),Ji("lookupTable")]))}),Ql=ro({accountKeys:qi(Wl),signatures:qi(eo())}),Fl=ro({parsed:oo(),program:eo(),programId:jc}),Yl=ro({accounts:qi(jc),data:eo(),programId:jc}),Hl=ao(io([Yl,Fl]),io([ro({parsed:oo(),program:eo(),programId:eo()}),ro({accounts:qi(eo()),data:eo(),programId:eo()})]),(function(t){return Fi(t,"accounts"in t?Yl:Fl)})),Vl=ro({signatures:qi(eo()),message:ro({accountKeys:qi(Wl),instructions:qi(Hl),recentBlockhash:eo(),addressTableLookups:$i(Xi(qi(Rl)))})}),ql=ro({accountIndex:Ki(),mint:eo(),owner:$i(eo()),uiTokenAmount:cl}),Gl=ro({writable:qi(jc),readonly:qi(jc)}),Zl=ro({err:Zc,fee:Ki(),innerInstructions:$i(Xi(qi(ro({index:Ki(),instructions:qi(ro({accounts:qi(Ki()),data:eo(),programIdIndex:Ki()}))})))),preBalances:qi(Ki()),postBalances:qi(Ki()),logMessages:$i(Xi(qi(eo()))),preTokenBalances:$i(Xi(qi(ql))),postTokenBalances:$i(Xi(qi(ql))),loadedAddresses:$i(Gl),computeUnitsConsumed:$i(Ki())}),Jl=ro({err:Zc,fee:Ki(),innerInstructions:$i(Xi(qi(ro({index:Ki(),instructions:qi(Hl)})))),preBalances:qi(Ki()),postBalances:qi(Ki()),logMessages:$i(Xi(qi(eo()))),preTokenBalances:$i(Xi(qi(ql))),postTokenBalances:$i(Xi(qi(ql))),loadedAddresses:$i(Gl),computeUnitsConsumed:$i(Ki())}),Xl=io([Ji(0),Ji("legacy")]),Kl=ro({pubkey:eo(),lamports:Ki(),postBalance:Xi(Ki()),rewardType:Xi(eo()),commission:$i(Xi(Ki()))}),$l=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),transactions:qi(ro({transaction:Ul,meta:Xi(Zl),version:$i(Xl)})),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),th=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),eh=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),transactions:qi(ro({transaction:Ql,meta:Xi(Zl),version:$i(Xl)})),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),nh=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),transactions:qi(ro({transaction:Vl,meta:Xi(Jl),version:$i(Xl)})),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),rh=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),transactions:qi(ro({transaction:Ql,meta:Xi(Jl),version:$i(Xl)})),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),ih=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),oh=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),transactions:qi(ro({transaction:Ul,meta:Xi(Zl)})),rewards:$i(qi(Kl)),blockTime:Xi(Ki())}))),ah=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),signatures:qi(eo()),blockTime:Xi(Ki())}))),sh=Bc(Xi(ro({slot:Ki(),meta:Zl,blockTime:$i(Xi(Ki())),transaction:Ul,version:$i(Xl)}))),uh=Bc(Xi(ro({slot:Ki(),transaction:Vl,meta:Xi(Jl),blockTime:$i(Xi(Ki())),version:$i(Xl)}))),ch=Rc(ro({blockhash:eo(),feeCalculator:ro({lamportsPerSignature:Ki()})})),lh=Rc(ro({blockhash:eo(),lastValidBlockHeight:Ki()})),hh=Bc(qi(ro({slot:Ki(),numTransactions:Ki(),numSlots:Ki(),samplePeriodSecs:Ki()}))),dh=Rc(Xi(ro({feeCalculator:ro({lamportsPerSignature:Ki()})}))),fh=Bc(eo()),ph=Bc(eo()),mh=ro({err:Zc,logs:qi(eo()),signature:eo()}),gh=ro({result:Uc(mh),subscription:Ki()}),yh={"solana-client":"js/".concat("0.0.0-development")},vh=function(){function t(e,n){var r,i,o,a,s,u,c,l=this;V(this,t),this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(r={},function(){var t=H(Q().mark((function t(e){var n,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=_c(e),o=i.commitment,a=i.config,s=l._buildArgs([],o,void 0,a),u=kc(s),r[u]=null!==(n=r[u])&&void 0!==n?n:H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,l._rpcRequest("getBlockHeight",s);case 3:if(e=t.sent,!("error"in(n=Fi(e,Bc(Ki()))))){t.next=7;break}throw new xc(n.error,"failed to get block height information");case 7:return t.abrupt("return",n.result);case 8:return t.prev=8,delete r[u],t.finish(8);case 11:case"end":return t.stop()}}),t,null,[[0,,8,11]])})))(),t.next=6,r[u];case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),n&&"string"==typeof n?this._commitment=n:n&&(this._commitment=n.commitment,this._confirmTransactionInitialTimeout=n.confirmTransactionInitialTimeout,i=n.wsEndpoint,o=n.httpHeaders,a=n.fetch,s=n.fetchMiddleware,u=n.disableRetryOnRateLimit,c=n.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(e),this._rpcWsEndpoint=i||function(t){var e=t.match(Cc);if(null==e)throw TypeError("Failed to validate endpoint URL `".concat(t,"`"));var n=at(e,4);n[0];var r=n[1],i=n[2],o=n[3],a=t.startsWith("https:")?"wss:":"ws:",s=null==i?null:parseInt(i.slice(1),10),u=null==s?"":":".concat(s+1);return"".concat(a,"//").concat(r).concat(u).concat(o)}(e),this._rpcClient=function(t,e,n,r,i,o){var a,s=n||Nc;null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=function(){var t=H(Q().mark((function t(e,n){var i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){try{r(e,n,(function(e,n){return t([e,n])}))}catch(t){i(t)}}));case 2:return i=t.sent,t.next=5,s.apply(void 0,st(i));case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}());var u=new Fo(function(){var n=H(Q().mark((function n(r,o){var u,c,l,h,d;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:u={method:"POST",body:r,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},e||{},yh)},n.prev=1,c=5,h=500;case 4:if(!a){n.next=10;break}return n.next=7,a(t,u);case 7:l=n.sent,n.next=13;break;case 10:return n.next=12,s(t,u);case 12:l=n.sent;case 13:if(429===l.status){n.next=15;break}return n.abrupt("break",26);case 15:if(!0!==i){n.next=17;break}return n.abrupt("break",26);case 17:if(0!=(c-=1)){n.next=20;break}return n.abrupt("break",26);case 20:return console.log("Server responded with ".concat(l.status," ").concat(l.statusText,". Retrying after ").concat(h,"ms delay...")),n.next=23,ic(h);case 23:h*=2;case 24:n.next=4;break;case 26:return n.next=28,l.text();case 28:d=n.sent,l.ok?o(null,d):o(new Error("".concat(l.status," ").concat(l.statusText,": ").concat(d))),n.next=35;break;case 32:n.prev=32,n.t0=n.catch(1),n.t0 instanceof Error&&o(n.t0);case 35:case"end":return n.stop()}}),n,null,[[1,32]])})));return function(t,e){return n.apply(this,arguments)}}(),{});return u}(e,o,a,s,u,c),this._rpcRequest=function(t){return function(e,n){return new Promise((function(r,i){t.request(e,n,(function(t,e){t?i(t):r(e)}))}))}}(this._rpcClient),this._rpcBatchRequest=function(t){return function(e){return new Promise((function(n,r){0===e.length&&n([]);var i=e.map((function(e){return t.request(e.methodName,e.args)}));t.request(i,(function(t,e){t?r(t):n(e)}))}))}}(this._rpcClient),this._rpcWebSocket=new Sc(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}var e,n,r,i,o,a,s,u,c,l,h,d,f,p,m,g,y,v,w,b,M,k,A,L,E,x,N,S,I,T,C,j,D,O,_,z,P,B,R,U,Y,q,Z,J,X,K,$,tt,et,rt,it,ot,ut,ct,lt,ht,dt,ft,pt,mt,gt,yt,vt,wt,bt,Mt,kt,At,Lt,Et,xt,Nt,St,It,Ct,jt,Dt,Ot,_t,zt,Pt,Bt,Rt,Ut,Wt,Qt,Ft,Yt;return G(t,[{key:"commitment",get:function(){return this._commitment}},{key:"rpcEndpoint",get:function(){return this._rpcEndpoint}},{key:"getBalanceAndContext",value:(Yt=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgs([e.toBase58()],i,void 0,o),t.next=4,this._rpcRequest("getBalance",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,Rc(Ki()))))){t.next=8;break}throw new xc(u.error,"failed to get balance for ".concat(e.toBase58()));case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return Yt.apply(this,arguments)})},{key:"getBalance",value:(Ft=H(Q().mark((function t(e,n){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getBalanceAndContext(e,n).then((function(t){return t.value})).catch((function(t){throw new Error("failed to get balance of account "+e.toBase58()+": "+t)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return Ft.apply(this,arguments)})},{key:"getBlockTime",value:(Qt=H(Q().mark((function t(e){var n,r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getBlockTime",[e]);case 2:if(n=t.sent,!("error"in(r=Fi(n,Bc(Xi(Ki())))))){t.next=6;break}throw new xc(r.error,"failed to get block time for slot ".concat(e));case 6:return t.abrupt("return",r.result);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return Qt.apply(this,arguments)})},{key:"getMinimumLedgerSlot",value:(Wt=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("minimumLedgerSlot",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,Bc(Ki()))))){t.next=6;break}throw new xc(n.error,"failed to get minimum ledger slot");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return Wt.apply(this,arguments)})},{key:"getFirstAvailableBlock",value:(Ut=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getFirstAvailableBlock",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,sl)))){t.next=6;break}throw new xc(n.error,"failed to get first available block");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return Ut.apply(this,arguments)})},{key:"getSupply",value:(Rt=H(Q().mark((function t(e){var n,r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={},n="string"==typeof e?{commitment:e}:e?W(W({},e),{},{commitment:e&&e.commitment||this.commitment}):{commitment:this.commitment},t.next=4,this._rpcRequest("getSupply",[n]);case 4:if(r=t.sent,!("error"in(i=Fi(r,ul)))){t.next=8;break}throw new xc(i.error,"failed to get supply");case 8:return t.abrupt("return",i.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return Rt.apply(this,arguments)})},{key:"getTokenSupply",value:(Bt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgs([e.toBase58()],n),t.next=3,this._rpcRequest("getTokenSupply",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,Rc(cl))))){t.next=7;break}throw new xc(o.error,"failed to get token supply");case 7:return t.abrupt("return",o.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return Bt.apply(this,arguments)})},{key:"getTokenAccountBalance",value:(Pt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgs([e.toBase58()],n),t.next=3,this._rpcRequest("getTokenAccountBalance",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,Rc(cl))))){t.next=7;break}throw new xc(o.error,"failed to get token account balance");case 7:return t.abrupt("return",o.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return Pt.apply(this,arguments)})},{key:"getTokenAccountsByOwner",value:(zt=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c,l;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=_c(r),o=i.commitment,a=i.config,s=[e.toBase58()],"mint"in n?s.push({mint:n.mint.toBase58()}):s.push({programId:n.programId.toBase58()}),u=this._buildArgs(s,o,"base64",a),t.next=6,this._rpcRequest("getTokenAccountsByOwner",u);case 6:if(c=t.sent,!("error"in(l=Fi(c,hl)))){t.next=10;break}throw new xc(l.error,"failed to get token accounts owned by account ".concat(e.toBase58()));case 10:return t.abrupt("return",l.result);case 11:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return zt.apply(this,arguments)})},{key:"getParsedTokenAccountsByOwner",value:(_t=H(Q().mark((function t(e,n,r){var i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=[e.toBase58()],"mint"in n?i.push({mint:n.mint.toBase58()}):i.push({programId:n.programId.toBase58()}),o=this._buildArgs(i,r,"jsonParsed"),t.next=5,this._rpcRequest("getTokenAccountsByOwner",o);case 5:if(a=t.sent,!("error"in(s=Fi(a,fl)))){t.next=9;break}throw new xc(s.error,"failed to get token accounts owned by account ".concat(e.toBase58()));case 9:return t.abrupt("return",s.result);case 10:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return _t.apply(this,arguments)})},{key:"getLargestAccounts",value:(Ot=H(Q().mark((function t(e){var n,r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=W(W({},e),{},{commitment:e&&e.commitment||this.commitment}),r=n.filter||n.commitment?[n]:[],t.next=4,this._rpcRequest("getLargestAccounts",r);case 4:if(i=t.sent,!("error"in(o=Fi(i,pl)))){t.next=8;break}throw new xc(o.error,"failed to get largest accounts");case 8:return t.abrupt("return",o.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return Ot.apply(this,arguments)})},{key:"getTokenLargestAccounts",value:(Dt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgs([e.toBase58()],n),t.next=3,this._rpcRequest("getTokenLargestAccounts",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,ll)))){t.next=7;break}throw new xc(o.error,"failed to get token largest accounts");case 7:return t.abrupt("return",o.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return Dt.apply(this,arguments)})},{key:"getAccountInfoAndContext",value:(jt=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgs([e.toBase58()],i,"base64",o),t.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,Rc(Xi(ml)))))){t.next=8;break}throw new xc(u.error,"failed to get info about account ".concat(e.toBase58()));case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return jt.apply(this,arguments)})},{key:"getParsedAccountInfo",value:(Ct=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgs([e.toBase58()],i,"jsonParsed",o),t.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,Rc(Xi(vl)))))){t.next=8;break}throw new xc(u.error,"failed to get info about account ".concat(e.toBase58()));case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return Ct.apply(this,arguments)})},{key:"getAccountInfo",value:(It=H(Q().mark((function t(e,n){var r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getAccountInfoAndContext(e,n);case 3:return r=t.sent,t.abrupt("return",r.value);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("failed to get info about account "+e.toBase58()+": "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t,e){return It.apply(this,arguments)})},{key:"getMultipleParsedAccounts",value:(St=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=e.map((function(t){return t.toBase58()})),s=this._buildArgs([a],i,"jsonParsed",o),t.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=t.sent,!("error"in(c=Fi(u,Rc(qi(Xi(vl))))))){t.next=9;break}throw new xc(c.error,"failed to get info for accounts ".concat(a));case 9:return t.abrupt("return",c.result);case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return St.apply(this,arguments)})},{key:"getMultipleAccountsInfoAndContext",value:(Nt=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=e.map((function(t){return t.toBase58()})),s=this._buildArgs([a],i,"base64",o),t.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=t.sent,!("error"in(c=Fi(u,Rc(qi(Xi(ml))))))){t.next=9;break}throw new xc(c.error,"failed to get info for accounts ".concat(a));case 9:return t.abrupt("return",c.result);case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return Nt.apply(this,arguments)})},{key:"getMultipleAccountsInfo",value:(xt=H(Q().mark((function t(e,n){var r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMultipleAccountsInfoAndContext(e,n);case 2:return r=t.sent,t.abrupt("return",r.value);case 4:case"end":return t.stop()}}),t,this)}))),function(t,e){return xt.apply(this,arguments)})},{key:"getStakeActivation",value:(Et=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=_c(n),o=i.commitment,a=i.config,s=this._buildArgs([e.toBase58()],o,void 0,W(W({},a),{},{epoch:null!=r?r:null==a?void 0:a.epoch})),t.next=4,this._rpcRequest("getStakeActivation",s);case 4:if(u=t.sent,!("error"in(c=Fi(u,Bc(bl))))){t.next=8;break}throw new xc(c.error,"failed to get Stake Activation ".concat(e.toBase58()));case 8:return t.abrupt("return",c.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return Et.apply(this,arguments)})},{key:"getProgramAccounts",value:(Lt=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c,l,h;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,s=(a=o||{}).encoding,u=nt(a,ou),c=this._buildArgs([e.toBase58()],i,s||"base64",u),t.next=5,this._rpcRequest("getProgramAccounts",c);case 5:if(l=t.sent,!("error"in(h=Fi(l,Bc(qi(gl)))))){t.next=9;break}throw new xc(h.error,"failed to get accounts owned by program ".concat(e.toBase58()));case 9:return t.abrupt("return",h.result);case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return Lt.apply(this,arguments)})},{key:"getParsedProgramAccounts",value:(At=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgs([e.toBase58()],i,"jsonParsed",o),t.next=4,this._rpcRequest("getProgramAccounts",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,Bc(qi(wl)))))){t.next=8;break}throw new xc(u.error,"failed to get accounts owned by program ".concat(e.toBase58()));case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return At.apply(this,arguments)})},{key:"confirmTransaction",value:(kt=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("string"!=typeof e){t.next=4;break}r=e,t.next=8;break;case 4:if(null===(i=(o=e).abortSignal)||void 0===i||!i.aborted){t.next=7;break}return t.abrupt("return",Promise.reject(o.abortSignal.reason));case 7:r=o.signature;case 8:t.prev=8,a=qn.decode(r),t.next=15;break;case 12:throw t.prev=12,t.t0=t.catch(8),new Error("signature must be base58 encoded: "+r);case 15:if(zu(64===a.length,"signature has invalid length"),"string"!=typeof e){t.next=22;break}return t.next=19,this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:n||this.commitment,signature:r});case 19:return t.abrupt("return",t.sent);case 22:if(!("lastValidBlockHeight"in e)){t.next=28;break}return t.next=25,this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:n||this.commitment,strategy:e});case 25:return t.abrupt("return",t.sent);case 28:return t.next=30,this.confirmTransactionUsingDurableNonceStrategy({commitment:n||this.commitment,strategy:e});case 30:return t.abrupt("return",t.sent);case 31:case"end":return t.stop()}}),t,this,[[8,12]])}))),function(t,e){return kt.apply(this,arguments)})},{key:"getCancellationPromise",value:function(t){return new Promise((function(e,n){null!=t&&(t.aborted?n(t.reason):t.addEventListener("abort",(function(){n(t.reason)})))}))}},{key:"getTransactionConfirmationPromise",value:function(t){var e,n,r=this,i=t.commitment,o=t.signature,a=!1;return{abortConfirmation:function(){n&&(n(),n=void 0),null!=e&&(r.removeSignatureListener(e),e=void 0)},confirmationPromise:new Promise((function(t,s){try{e=r.onSignature(o,(function(n,r){e=void 0;var i={context:r,value:n};t({__type:Pu.PROCESSED,response:i})}),i);var u=new Promise((function(t){null==e?t():n=r._onSubscriptionStateChange(e,(function(e){"subscribed"===e&&t()}))}));H(Q().mark((function e(){var n,c,l;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u;case 2:if(!a){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,r.getSignatureStatus(o);case 6:if(n=e.sent,!a){e.next=9;break}return e.abrupt("return");case 9:if(null!=n){e.next=11;break}return e.abrupt("return");case 11:if(c=n.context,null!=(l=n.value)){e.next=14;break}return e.abrupt("return");case 14:if(null==l||!l.err){e.next=18;break}s(l.err),e.next=29;break;case 18:e.t0=i,e.next="confirmed"===e.t0||"single"===e.t0||"singleGossip"===e.t0?21:"finalized"===e.t0||"max"===e.t0||"root"===e.t0?24:("processed"===e.t0||e.t0,27);break;case 21:if("processed"!==l.confirmationStatus){e.next=23;break}return e.abrupt("return");case 23:return e.abrupt("break",27);case 24:if("processed"!==l.confirmationStatus&&"confirmed"!==l.confirmationStatus){e.next=26;break}return e.abrupt("return");case 26:return e.abrupt("break",27);case 27:a=!0,t({__type:Pu.PROCESSED,response:{context:c,value:l}});case 29:case"end":return e.stop()}}),e)})))()}catch(t){s(t)}}))}}},{key:"confirmTransactionUsingBlockHeightExceedanceStrategy",value:(Mt=H(Q().mark((function t(e){var n,r,i,o,a,s,u,c,l,h,d,f,p,m=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.commitment,r=e.strategy,i=r.abortSignal,o=r.lastValidBlockHeight,a=r.signature,s=!1,u=new Promise((function(t){var e=function(){var t=H(Q().mark((function t(){var e;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m.getBlockHeight(n);case 3:return e=t.sent,t.abrupt("return",e);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",-1);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();H(Q().mark((function n(){var r;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e();case 2:if(r=n.sent,!s){n.next=5;break}return n.abrupt("return");case 5:if(!(r<=o)){n.next=17;break}return n.next=8,ic(1e3);case 8:if(!s){n.next=10;break}return n.abrupt("return");case 10:return n.next=12,e();case 12:if(r=n.sent,!s){n.next=15;break}return n.abrupt("return");case 15:n.next=5;break;case 17:t({__type:Pu.BLOCKHEIGHT_EXCEEDED});case 18:case"end":return n.stop()}}),n)})))()})),c=this.getTransactionConfirmationPromise({commitment:n,signature:a}),l=c.abortConfirmation,h=c.confirmationPromise,d=this.getCancellationPromise(i),t.prev=5,t.next=8,Promise.race([d,h,u]);case 8:if((p=t.sent).__type!==Pu.PROCESSED){t.next=13;break}f=p.response,t.next=14;break;case 13:throw new xu(a);case 14:return t.prev=14,s=!0,l(),t.finish(14);case 18:return t.abrupt("return",f);case 19:case"end":return t.stop()}}),t,this,[[5,,14,18]])}))),function(t){return Mt.apply(this,arguments)})},{key:"confirmTransactionUsingDurableNonceStrategy",value:(bt=H(Q().mark((function t(e){var n,r,i,o,a,s,u,c,l,h,d,f,p,m,g,y,v,w,b,M,k,A=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.commitment,r=e.strategy,i=r.abortSignal,o=r.minContextSlot,a=r.nonceAccountPubkey,s=r.nonceValue,u=r.signature,c=!1,l=new Promise((function(t){var e=s,r=null,i=function(){var t=H(Q().mark((function t(){var i,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,A.getNonceAndContext(a,{commitment:n,minContextSlot:o});case 3:return i=t.sent,s=i.context,u=i.value,r=s.slot,t.abrupt("return",null==u?void 0:u.nonce);case 10:return t.prev=10,t.t0=t.catch(0),t.abrupt("return",e);case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(){return t.apply(this,arguments)}}();H(Q().mark((function n(){return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i();case 2:if(e=n.sent,!c){n.next=5;break}return n.abrupt("return");case 5:if(s===e){n.next=9;break}return t({__type:Pu.NONCE_INVALID,slotInWhichNonceDidAdvance:r}),n.abrupt("return");case 9:return n.next=11,ic(2e3);case 11:if(!c){n.next=13;break}return n.abrupt("return");case 13:return n.next=15,i();case 15:if(e=n.sent,!c){n.next=18;break}return n.abrupt("return");case 18:n.next=5;break;case 20:case"end":return n.stop()}}),n)})))()})),h=this.getTransactionConfirmationPromise({commitment:n,signature:u}),d=h.abortConfirmation,f=h.confirmationPromise,p=this.getCancellationPromise(i),t.prev=5,t.next=8,Promise.race([p,f,l]);case 8:if((g=t.sent).__type!==Pu.PROCESSED){t.next=13;break}m=g.response,t.next=47;break;case 13:return t.next=16,this.getSignatureStatus(u);case 16:if(null!=(b=t.sent)){t.next=19;break}return t.abrupt("break",27);case 19:if(!(b.context.slot<(null!==(w=g.slotInWhichNonceDidAdvance)&&void 0!==w?w:o))){t.next=23;break}return t.next=22,ic(400);case 22:return t.abrupt("continue",13);case 23:return v=b,t.abrupt("break",27);case 27:if(null===(y=v)||void 0===y||!y.value){t.next=46;break}M=n||"finalized",k=v.value.confirmationStatus,t.t0=M,t.next="processed"===t.t0||"recent"===t.t0?33:"confirmed"===t.t0||"single"===t.t0||"singleGossip"===t.t0?36:"finalized"===t.t0||"max"===t.t0||"root"===t.t0?39:42;break;case 33:if("processed"===k||"confirmed"===k||"finalized"===k){t.next=35;break}throw new Su(u);case 35:case 38:case 41:return t.abrupt("break",43);case 36:if("confirmed"===k||"finalized"===k){t.next=38;break}throw new Su(u);case 39:if("finalized"===k){t.next=41;break}throw new Su(u);case 42:case 43:m={context:v.context,value:{err:v.value.err}},t.next=47;break;case 46:throw new Su(u);case 47:return t.prev=47,c=!0,d(),t.finish(47);case 51:return t.abrupt("return",m);case 52:case"end":return t.stop()}}),t,this,[[5,,47,51]])}))),function(t){return bt.apply(this,arguments)})},{key:"confirmTransactionUsingLegacyTimeoutStrategy",value:(wt=H(Q().mark((function t(e){var n,r,i,o,a,s,u,c,l,h=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.commitment,r=e.signature,o=new Promise((function(t){var e=h._confirmTransactionInitialTimeout||6e4;switch(n){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":e=h._confirmTransactionInitialTimeout||3e4}i=setTimeout((function(){return t({__type:Pu.TIMED_OUT,timeoutMs:e})}),e)})),a=this.getTransactionConfirmationPromise({commitment:n,signature:r}),s=a.abortConfirmation,u=a.confirmationPromise,t.prev=3,t.next=6,Promise.race([u,o]);case 6:if((l=t.sent).__type!==Pu.PROCESSED){t.next=11;break}c=l.response,t.next=12;break;case 11:throw new Nu(r,l.timeoutMs/1e3);case 12:return t.prev=12,clearTimeout(i),s(),t.finish(12);case 16:return t.abrupt("return",c);case 17:case"end":return t.stop()}}),t,this,[[3,,12,16]])}))),function(t){return wt.apply(this,arguments)})},{key:"getClusterNodes",value:(vt=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getClusterNodes",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,Bc(qi(jl)))))){t.next=6;break}throw new xc(n.error,"failed to get cluster nodes");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return vt.apply(this,arguments)})},{key:"getVoteAccounts",value:(yt=H(Q().mark((function t(e){var n,r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._buildArgs([],e),t.next=3,this._rpcRequest("getVoteAccounts",n);case 3:if(r=t.sent,!("error"in(i=Fi(r,Ol)))){t.next=7;break}throw new xc(i.error,"failed to get vote accounts");case 7:return t.abrupt("return",i.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t){return yt.apply(this,arguments)})},{key:"getSlot",value:(gt=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),t.next=4,this._rpcRequest("getSlot",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,Bc(Ki()))))){t.next=8;break}throw new xc(s.error,"failed to get slot");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return gt.apply(this,arguments)})},{key:"getSlotLeader",value:(mt=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),t.next=4,this._rpcRequest("getSlotLeader",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,Bc(eo()))))){t.next=8;break}throw new xc(s.error,"failed to get slot leader");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return mt.apply(this,arguments)})},{key:"getSlotLeaders",value:(pt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[e,n],t.next=3,this._rpcRequest("getSlotLeaders",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,Bc(qi(jc)))))){t.next=7;break}throw new xc(o.error,"failed to get slot leaders");case 7:return t.abrupt("return",o.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return pt.apply(this,arguments)})},{key:"getSignatureStatus",value:(ft=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignatureStatuses([e],n);case 2:return r=t.sent,i=r.context,zu(1===(o=r.value).length),a=o[0],t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return ft.apply(this,arguments)})},{key:"getSignatureStatuses",value:(dt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[e],n&&r.push(n),t.next=4,this._rpcRequest("getSignatureStatuses",r);case 4:if(i=t.sent,!("error"in(o=Fi(i,Pl)))){t.next=8;break}throw new xc(o.error,"failed to get signature status");case 8:return t.abrupt("return",o.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return dt.apply(this,arguments)})},{key:"getTransactionCount",value:(ht=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),t.next=4,this._rpcRequest("getTransactionCount",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,Bc(Ki()))))){t.next=8;break}throw new xc(s.error,"failed to get transaction count");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return ht.apply(this,arguments)})},{key:"getTotalSupply",value:(lt=H(Q().mark((function t(e){var n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0});case 2:return n=t.sent,t.abrupt("return",n.value.total);case 4:case"end":return t.stop()}}),t,this)}))),function(t){return lt.apply(this,arguments)})},{key:"getInflationGovernor",value:(ct=H(Q().mark((function t(e){var n,r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._buildArgs([],e),t.next=3,this._rpcRequest("getInflationGovernor",n);case 3:if(r=t.sent,!("error"in(i=Fi(r,el)))){t.next=7;break}throw new xc(i.error,"failed to get inflation");case 7:return t.abrupt("return",i.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t){return ct.apply(this,arguments)})},{key:"getInflationReward",value:(ut=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=_c(r),o=i.commitment,a=i.config,s=this._buildArgs([e.map((function(t){return t.toBase58()}))],o,void 0,W(W({},a),{},{epoch:null!=n?n:null==a?void 0:a.epoch})),t.next=4,this._rpcRequest("getInflationReward",s);case 4:if(u=t.sent,!("error"in(c=Fi(u,Fc)))){t.next=8;break}throw new xc(c.error,"failed to get inflation reward");case 8:return t.abrupt("return",c.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return ut.apply(this,arguments)})},{key:"getInflationRate",value:(ot=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getInflationRate",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,nl)))){t.next=6;break}throw new xc(n.error,"failed to get inflation rate");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return ot.apply(this,arguments)})},{key:"getEpochInfo",value:(it=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),t.next=4,this._rpcRequest("getEpochInfo",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,il)))){t.next=8;break}throw new xc(s.error,"failed to get epoch info");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return it.apply(this,arguments)})},{key:"getEpochSchedule",value:(rt=H(Q().mark((function t(){var e,n,r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getEpochSchedule",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,ol)))){t.next=6;break}throw new xc(n.error,"failed to get epoch schedule");case 6:return r=n.result,t.abrupt("return",new Lc(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot));case 8:case"end":return t.stop()}}),t,this)}))),function(){return rt.apply(this,arguments)})},{key:"getLeaderSchedule",value:(et=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getLeaderSchedule",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,al)))){t.next=6;break}throw new xc(n.error,"failed to get leader schedule");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return et.apply(this,arguments)})},{key:"getMinimumBalanceForRentExemption",value:(tt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgs([e],n),t.next=3,this._rpcRequest("getMinimumBalanceForRentExemption",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,Bl)))){t.next=8;break}return console.warn("Unable to fetch minimum balance for rent exemption"),t.abrupt("return",0);case 8:return t.abrupt("return",o.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return tt.apply(this,arguments)})},{key:"getRecentBlockhashAndContext",value:($=H(Q().mark((function t(e){var n,r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._buildArgs([],e),t.next=3,this._rpcRequest("getRecentBlockhash",n);case 3:if(r=t.sent,!("error"in(i=Fi(r,ch)))){t.next=7;break}throw new xc(i.error,"failed to get recent blockhash");case 7:return t.abrupt("return",i.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t){return $.apply(this,arguments)})},{key:"getRecentPerformanceSamples",value:(K=H(Q().mark((function t(e){var n,r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]);case 2:if(n=t.sent,!("error"in(r=Fi(n,hh)))){t.next=6;break}throw new xc(r.error,"failed to get recent performance samples");case 6:return t.abrupt("return",r.result);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return K.apply(this,arguments)})},{key:"getFeeCalculatorForBlockhash",value:(X=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgs([e],n),t.next=3,this._rpcRequest("getFeeCalculatorForBlockhash",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,dh)))){t.next=7;break}throw new xc(o.error,"failed to get fee calculator");case 7:return a=o.result,s=a.context,u=a.value,t.abrupt("return",{context:s,value:null!==u?u.feeCalculator:null});case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return X.apply(this,arguments)})},{key:"getFeeForMessage",value:(J=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=pu(e.serialize()).toString("base64"),i=this._buildArgs([r],n),t.next=4,this._rpcRequest("getFeeForMessage",i);case 4:if(o=t.sent,!("error"in(a=Fi(o,Rc(Xi(Ki())))))){t.next=8;break}throw new xc(a.error,"failed to get fee for message");case 8:if(null!==a.result){t.next=10;break}throw new Error("invalid blockhash");case 10:return t.abrupt("return",a.result);case 11:case"end":return t.stop()}}),t,this)}))),function(t,e){return J.apply(this,arguments)})},{key:"getRecentPrioritizationFees",value:(Z=H(Q().mark((function t(e){var n,r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=null==e||null===(n=e.lockedWritableAccounts)||void 0===n?void 0:n.map((function(t){return t.toBase58()})),i=this._buildArgs(null!=r&&r.length?[r]:[]),t.next=4,this._rpcRequest("getRecentPrioritizationFees",i);case 4:if(o=t.sent,!("error"in(a=Fi(o,rl)))){t.next=8;break}throw new xc(a.error,"failed to get recent prioritization fees");case 8:return t.abrupt("return",a.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return Z.apply(this,arguments)})},{key:"getRecentBlockhash",value:(q=H(Q().mark((function t(e){var n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getRecentBlockhashAndContext(e);case 3:return n=t.sent,t.abrupt("return",n.value);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("failed to get recent blockhash: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t){return q.apply(this,arguments)})},{key:"getLatestBlockhash",value:(Y=H(Q().mark((function t(e){var n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getLatestBlockhashAndContext(e);case 3:return n=t.sent,t.abrupt("return",n.value);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("failed to get recent blockhash: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t){return Y.apply(this,arguments)})},{key:"getLatestBlockhashAndContext",value:(U=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),t.next=4,this._rpcRequest("getLatestBlockhash",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,lh)))){t.next=8;break}throw new xc(s.error,"failed to get latest blockhash");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return U.apply(this,arguments)})},{key:"getVersion",value:(R=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getVersion",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,Bc(Kc))))){t.next=6;break}throw new xc(n.error,"failed to get version");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return R.apply(this,arguments)})},{key:"getGenesisHash",value:(B=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getGenesisHash",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,Bc(eo()))))){t.next=6;break}throw new xc(n.error,"failed to get genesis hash");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return B.apply(this,arguments)})},{key:"getBlock",value:(P=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c,l,h;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([e],i,void 0,o),t.next=4,this._rpcRequest("getBlock",a);case 4:s=t.sent,t.prev=5,t.t0=null==o?void 0:o.transactionDetails,t.next="accounts"===t.t0?9:"none"===t.t0?13:17;break;case 9:if(!("error"in(u=Fi(s,eh)))){t.next=12;break}throw u.error;case 12:return t.abrupt("return",u.result);case 13:if(!("error"in(c=Fi(s,th)))){t.next=16;break}throw c.error;case 16:return t.abrupt("return",c.result);case 17:if(!("error"in(l=Fi(s,$l)))){t.next=20;break}throw l.error;case 20:return h=l.result,t.abrupt("return",h?W(W({},h),{},{transactions:h.transactions.map((function(t){var e=t.transaction,n=t.meta,r=t.version;return{meta:n,transaction:W(W({},e),{},{message:Wc(r,e.message)}),version:r}}))}):null);case 22:t.next=27;break;case 24:throw t.prev=24,t.t1=t.catch(5),new xc(t.t1,"failed to get confirmed block");case 27:case"end":return t.stop()}}),t,this,[[5,24]])}))),function(t,e){return P.apply(this,arguments)})},{key:"getParsedBlock",value:(z=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c,l;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([e],i,"jsonParsed",o),t.next=4,this._rpcRequest("getBlock",a);case 4:s=t.sent,t.prev=5,t.t0=null==o?void 0:o.transactionDetails,t.next="accounts"===t.t0?9:"none"===t.t0?13:17;break;case 9:if(!("error"in(u=Fi(s,rh)))){t.next=12;break}throw u.error;case 12:return t.abrupt("return",u.result);case 13:if(!("error"in(c=Fi(s,ih)))){t.next=16;break}throw c.error;case 16:return t.abrupt("return",c.result);case 17:if(!("error"in(l=Fi(s,nh)))){t.next=20;break}throw l.error;case 20:return t.abrupt("return",l.result);case 21:t.next=26;break;case 23:throw t.prev=23,t.t1=t.catch(5),new xc(t.t1,"failed to get block");case 26:case"end":return t.stop()}}),t,this,[[5,23]])}))),function(t,e){return z.apply(this,arguments)})},{key:"getBlockProduction",value:(_=H(Q().mark((function t(e){var n,r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e?r=e:e&&(i=e.commitment,o=nt(e,au),r=i,n=o),a=this._buildArgs([],r,"base64",n),t.next=4,this._rpcRequest("getBlockProduction",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,tl)))){t.next=8;break}throw new xc(u.error,"failed to get block production information");case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return _.apply(this,arguments)})},{key:"getTransaction",value:(O=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([e],i,void 0,o),t.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,sh)))){t.next=8;break}throw new xc(u.error,"failed to get transaction");case 8:if(c=u.result){t.next=11;break}return t.abrupt("return",c);case 11:return t.abrupt("return",W(W({},c),{},{transaction:W(W({},c.transaction),{},{message:Wc(c.version,c.transaction.message)})}));case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return O.apply(this,arguments)})},{key:"getParsedTransaction",value:(D=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([e],i,"jsonParsed",o),t.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,uh)))){t.next=8;break}throw new xc(u.error,"failed to get transaction");case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return D.apply(this,arguments)})},{key:"getParsedTransactions",value:(j=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=e.map((function(t){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([t],i,"jsonParsed",o)}})),t.next=4,this._rpcBatchRequest(a);case 4:return s=t.sent,u=s.map((function(t){var e=Fi(t,uh);if("error"in e)throw new xc(e.error,"failed to get transactions");return e.result})),t.abrupt("return",u);case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return j.apply(this,arguments)})},{key:"getTransactions",value:(C=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=e.map((function(t){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([t],i,void 0,o)}})),t.next=4,this._rpcBatchRequest(a);case 4:return s=t.sent,u=s.map((function(t){var e=Fi(t,sh);if("error"in e)throw new xc(e.error,"failed to get transactions");var n=e.result;return n?W(W({},n),{},{transaction:W(W({},n.transaction),{},{message:Wc(n.version,n.transaction.message)})}):n})),t.abrupt("return",u);case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return C.apply(this,arguments)})},{key:"getConfirmedBlock",value:(T=H(Q().mark((function t(e,n){var r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgsAtLeastConfirmed([e],n),t.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,oh)))){t.next=7;break}throw new xc(o.error,"failed to get confirmed block");case 7:if(a=o.result){t.next=10;break}throw new Error("Confirmed block "+e+" not found");case 10:return s=W(W({},a),{},{transactions:a.transactions.map((function(t){var e=t.transaction,n=t.meta,r=new Ru(e.message);return{meta:n,transaction:W(W({},e),{},{message:r})}}))}),t.abrupt("return",W(W({},s),{},{transactions:s.transactions.map((function(t){var e=t.transaction;return{meta:t.meta,transaction:Yu.populate(e.message,e.signatures)}}))}));case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return T.apply(this,arguments)})},{key:"getBlocks",value:(I=H(Q().mark((function t(e,n,r){var i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed(void 0!==n?[e,n]:[e],r),t.next=3,this._rpcRequest("getBlocks",i);case 3:if(o=t.sent,!("error"in(a=Fi(o,Bc(qi(Ki())))))){t.next=7;break}throw new xc(a.error,"failed to get blocks");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return I.apply(this,arguments)})},{key:"getBlockSignatures",value:(S=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgsAtLeastConfirmed([e],n,void 0,{transactionDetails:"signatures",rewards:!1}),t.next=3,this._rpcRequest("getBlock",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,ah)))){t.next=7;break}throw new xc(o.error,"failed to get block");case 7:if(a=o.result){t.next=10;break}throw new Error("Block "+e+" not found");case 10:return t.abrupt("return",a);case 11:case"end":return t.stop()}}),t,this)}))),function(t,e){return S.apply(this,arguments)})},{key:"getConfirmedBlockSignatures",value:(N=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgsAtLeastConfirmed([e],n,void 0,{transactionDetails:"signatures",rewards:!1}),t.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,ah)))){t.next=7;break}throw new xc(o.error,"failed to get confirmed block");case 7:if(a=o.result){t.next=10;break}throw new Error("Confirmed block "+e+" not found");case 10:return t.abrupt("return",a);case 11:case"end":return t.stop()}}),t,this)}))),function(t,e){return N.apply(this,arguments)})},{key:"getConfirmedTransaction",value:(x=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgsAtLeastConfirmed([e],n),t.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,sh)))){t.next=7;break}throw new xc(o.error,"failed to get transaction");case 7:if(a=o.result){t.next=10;break}return t.abrupt("return",a);case 10:return s=new Ru(a.transaction.message),u=a.transaction.signatures,t.abrupt("return",W(W({},a),{},{transaction:Yu.populate(s,u)}));case 13:case"end":return t.stop()}}),t,this)}))),function(t,e){return x.apply(this,arguments)})},{key:"getParsedConfirmedTransaction",value:(E=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed"),t.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,uh)))){t.next=7;break}throw new xc(o.error,"failed to get confirmed transaction");case 7:return t.abrupt("return",o.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return E.apply(this,arguments)})},{key:"getParsedConfirmedTransactions",value:(L=H(Q().mark((function t(e,n){var r,i,o,a=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return{methodName:"getConfirmedTransaction",args:a._buildArgsAtLeastConfirmed([t],n,"jsonParsed")}})),t.next=3,this._rpcBatchRequest(r);case 3:return i=t.sent,o=i.map((function(t){var e=Fi(t,uh);if("error"in e)throw new xc(e.error,"failed to get confirmed transactions");return e.result})),t.abrupt("return",o);case 6:case"end":return t.stop()}}),t,this)}))),function(t,e){return L.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress",value:(A=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i={},t.next=3,this.getFirstAvailableBlock();case 3:o=t.sent;case 4:if("until"in i){t.next=24;break}if(!(--n<=0||n<o)){t.next=8;break}return t.abrupt("break",24);case 8:return t.prev=8,t.next=11,this.getConfirmedBlockSignatures(n,"finalized");case 11:(a=t.sent).signatures.length>0&&(i.until=a.signatures[a.signatures.length-1].toString()),t.next=22;break;case 15:if(t.prev=15,t.t0=t.catch(8),!(t.t0 instanceof Error&&t.t0.message.includes("skipped"))){t.next=21;break}return t.abrupt("continue",4);case 21:throw t.t0;case 22:t.next=4;break;case 24:return t.next=26,this.getSlot("finalized");case 26:s=t.sent;case 27:if("before"in i){t.next=47;break}if(!(++r>s)){t.next=31;break}return t.abrupt("break",47);case 31:return t.prev=31,t.next=34,this.getConfirmedBlockSignatures(r);case 34:(u=t.sent).signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString()),t.next=45;break;case 38:if(t.prev=38,t.t1=t.catch(31),!(t.t1 instanceof Error&&t.t1.message.includes("skipped"))){t.next=44;break}return t.abrupt("continue",27);case 44:throw t.t1;case 45:t.next=27;break;case 47:return t.next=49,this.getConfirmedSignaturesForAddress2(e,i);case 49:return c=t.sent,t.abrupt("return",c.map((function(t){return t.signature})));case 51:case"end":return t.stop()}}),t,this,[[8,15],[31,38]])}))),function(t,e,n){return A.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress2",value:(k=H(Q().mark((function t(e,n,r){var i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getConfirmedSignaturesForAddress2",i);case 3:if(o=t.sent,!("error"in(a=Fi(o,Ml)))){t.next=7;break}throw new xc(a.error,"failed to get confirmed signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return k.apply(this,arguments)})},{key:"getSignaturesForAddress",value:(M=H(Q().mark((function t(e,n,r){var i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getSignaturesForAddress",i);case 3:if(o=t.sent,!("error"in(a=Fi(o,kl)))){t.next=7;break}throw new xc(a.error,"failed to get signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return M.apply(this,arguments)})},{key:"getAddressLookupTable",value:(b=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=new Ic({key:e,state:Ic.deserialize(o.data)})),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return b.apply(this,arguments)})},{key:"getNonceAndContext",value:(w=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=hc.fromAccountData(o.data)),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return w.apply(this,arguments)})},{key:"getNonce",value:(v=H(Q().mark((function t(e,n){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getNonceAndContext(e,n).then((function(t){return t.value})).catch((function(t){throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return v.apply(this,arguments)})},{key:"requestAirdrop",value:(y=H(Q().mark((function t(e,n){var r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("requestAirdrop",[e.toBase58(),n]);case 2:if(r=t.sent,!("error"in(i=Fi(r,fh)))){t.next=6;break}throw new xc(i.error,"airdrop to ".concat(e.toBase58()," failed"));case 6:return t.abrupt("return",i.result);case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return y.apply(this,arguments)})},{key:"_blockhashWithExpiryBlockHeight",value:(g=H(Q().mark((function t(e){var n,r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=10;break}case 1:if(!this._pollingBlockhash){t.next=6;break}return t.next=4,ic(100);case 4:t.next=1;break;case 6:if(n=Date.now()-this._blockhashInfo.lastFetch,r=n>=3e4,null===this._blockhashInfo.latestBlockhash||r){t.next=10;break}return t.abrupt("return",this._blockhashInfo.latestBlockhash);case 10:return t.next=12,this._pollNewBlockhash();case 12:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return g.apply(this,arguments)})},{key:"_pollNewBlockhash",value:(m=H(Q().mark((function t(){var e,n,r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._pollingBlockhash=!0,t.prev=1,e=Date.now(),n=this._blockhashInfo.latestBlockhash,r=n?n.blockhash:null,i=0;case 6:if(!(i<50)){t.next=18;break}return t.next=9,this.getLatestBlockhash("finalized");case 9:if(o=t.sent,r===o.blockhash){t.next=13;break}return this._blockhashInfo={latestBlockhash:o,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t.abrupt("return",o);case 13:return t.next=15,ic(200);case 15:i++,t.next=6;break;case 18:throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-e,"ms"));case 19:return t.prev=19,this._pollingBlockhash=!1,t.finish(19);case 22:case"end":return t.stop()}}),t,this,[[1,,19,22]])}))),function(){return m.apply(this,arguments)})},{key:"getStakeMinimumDelegation",value:(p=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,"base64",i),t.next=4,this._rpcRequest("getStakeMinimumDelegation",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,Rc(Ki()))))){t.next=8;break}throw new xc(s.error,"failed to get stake minimum delegation");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"simulateTransaction",value:(f=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c,l,h,d,f,p,m,g,y,v,w,b,M,k,A,L,E,x,N,S,I;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("message"in e)){t.next=17;break}if(i=e.serialize(),o=Tt.from(i).toString("base64"),!Array.isArray(n)&&void 0===r){t.next=6;break}throw new Error("Invalid arguments");case 6:return(a=n||{}).encoding="base64","commitment"in a||(a.commitment=this.commitment),s=[o,a],t.next=12,this._rpcRequest("simulateTransaction",s);case 12:if(u=t.sent,!("error"in(c=Fi(u,$c)))){t.next=16;break}throw new Error("failed to simulate transaction: "+c.error.message);case 16:return t.abrupt("return",c.result);case 17:if(e instanceof Yu?(h=e,(l=new Yu).feePayer=h.feePayer,l.instructions=e.instructions,l.nonceInfo=h.nonceInfo,l.signatures=h.signatures):(l=Yu.populate(e))._message=l._json=void 0,void 0===n||Array.isArray(n)){t.next=20;break}throw new Error("Invalid arguments");case 20:if(d=n,!l.nonceInfo||!d){t.next=25;break}(f=l).sign.apply(f,st(d)),t.next=45;break;case 25:p=this._disableBlockhashCaching;case 26:return t.next=28,this._blockhashWithExpiryBlockHeight(p);case 28:if(g=t.sent,l.lastValidBlockHeight=g.lastValidBlockHeight,l.recentBlockhash=g.blockhash,d){t.next=33;break}return t.abrupt("break",45);case 33:if((m=l).sign.apply(m,st(d)),l.signature){t.next=36;break}throw new Error("!signature");case 36:if(y=l.signature.toString("base64"),this._blockhashInfo.simulatedSignatures.includes(y)||this._blockhashInfo.transactionSignatures.includes(y)){t.next=42;break}return this._blockhashInfo.simulatedSignatures.push(y),t.abrupt("break",45);case 42:p=!0;case 43:t.next=26;break;case 45:return v=l._compile(),w=v.serialize(),b=l._serialize(w),M=b.toString("base64"),k={encoding:"base64",commitment:this.commitment},r&&(A=(Array.isArray(r)?r:v.nonProgramIds()).map((function(t){return t.toBase58()})),k.accounts={encoding:"base64",addresses:A}),d&&(k.sigVerify=!0),L=[M,k],t.next=55,this._rpcRequest("simulateTransaction",L);case 55:if(E=t.sent,!("error"in(x=Fi(E,$c)))){t.next=60;break}throw"data"in x.error&&(N=x.error.data.logs)&&Array.isArray(N)&&(I=(S="\n ")+N.join(S),console.error(x.error.message,I)),new Ec("failed to simulate transaction: "+x.error.message,N);case 60:return t.abrupt("return",x.result);case 61:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return f.apply(this,arguments)})},{key:"sendTransaction",value:(d=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("version"in e)){t.next=7;break}if(!n||!Array.isArray(n)){t.next=3;break}throw new Error("Invalid arguments");case 3:return i=e.serialize(),t.next=6,this.sendRawTransaction(i,n);case 6:return t.abrupt("return",t.sent);case 7:if(void 0!==n&&Array.isArray(n)){t.next=9;break}throw new Error("Invalid arguments");case 9:if(o=n,!e.nonceInfo){t.next=14;break}e.sign.apply(e,st(o)),t.next=32;break;case 14:a=this._disableBlockhashCaching;case 15:return t.next=17,this._blockhashWithExpiryBlockHeight(a);case 17:if(s=t.sent,e.lastValidBlockHeight=s.lastValidBlockHeight,e.recentBlockhash=s.blockhash,e.sign.apply(e,st(o)),e.signature){t.next=23;break}throw new Error("!signature");case 23:if(u=e.signature.toString("base64"),this._blockhashInfo.transactionSignatures.includes(u)){t.next=29;break}return this._blockhashInfo.transactionSignatures.push(u),t.abrupt("break",32);case 29:a=!0;case 30:t.next=15;break;case 32:return c=e.serialize(),t.next=35,this.sendRawTransaction(c,r);case 35:return t.abrupt("return",t.sent);case 36:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return d.apply(this,arguments)})},{key:"sendRawTransaction",value:(h=H(Q().mark((function t(e,n){var r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=pu(e).toString("base64"),t.next=3,this.sendEncodedTransaction(r,n);case 3:return i=t.sent,t.abrupt("return",i);case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return h.apply(this,arguments)})},{key:"sendEncodedTransaction",value:(l=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={encoding:"base64"},i=n&&n.skipPreflight,o=n&&n.preflightCommitment||this.commitment,n&&null!=n.maxRetries&&(r.maxRetries=n.maxRetries),n&&null!=n.minContextSlot&&(r.minContextSlot=n.minContextSlot),i&&(r.skipPreflight=i),o&&(r.preflightCommitment=o),a=[e,r],t.next=10,this._rpcRequest("sendTransaction",a);case 10:if(s=t.sent,!("error"in(u=Fi(s,ph)))){t.next=15;break}throw"data"in u.error&&(c=u.error.data.logs),new Ec("failed to send transaction: "+u.error.message,c);case 15:return t.abrupt("return",u.result);case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return l.apply(this,arguments)})},{key:"_wsOnOpen",value:function(){var t=this;this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((function(){H(Q().mark((function e(){return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t._rpcWebSocket.notify("ping");case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})))()}),5e3),this._updateSubscriptions()}},{key:"_wsOnError",value:function(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}},{key:"_wsOnClose",value:function(t){var e=this;this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((function(t){var n=at(t,2),r=n[0],i=n[1];e._setSubscription(r,W(W({},i),{},{state:"pending"}))}))):this._updateSubscriptions()}},{key:"_setSubscription",value:function(t,e){var n,r=null===(n=this._subscriptionsByHash[t])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[t]=e,r!==e.state){var i=this._subscriptionStateChangeCallbacksByHash[t];i&&i.forEach((function(t){try{t(e.state)}catch(t){}}))}}},{key:"_onSubscriptionStateChange",value:function(t,e){var n,r=this,i=this._subscriptionHashByClientSubscriptionId[t];if(null==i)return function(){};var o=(n=this._subscriptionStateChangeCallbacksByHash)[i]||(n[i]=new Set);return o.add(e),function(){o.delete(e),0===o.size&&delete r._subscriptionStateChangeCallbacksByHash[i]}}},{key:"_updateSubscriptions",value:(c=H(Q().mark((function t(){var e,n,r=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==Object.keys(this._subscriptionsByHash).length){t.next=3;break}return this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((function(){r._rpcWebSocketIdleTimeout=null;try{r._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log("Error when closing socket connection: ".concat(t.message))}}),500)),t.abrupt("return");case 3:if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),this._rpcWebSocketConnected){t.next=7;break}return this._rpcWebSocket.connect(),t.abrupt("return");case 7:return e=this._rpcWebSocketGeneration,n=function(){return e===r._rpcWebSocketGeneration},t.next=11,Promise.all(Object.keys(this._subscriptionsByHash).map(function(){var t=H(Q().mark((function t(e){var i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(i=r._subscriptionsByHash[e])){t.next=3;break}return t.abrupt("return");case 3:t.t0=i.state,t.next="pending"===t.t0||"unsubscribed"===t.t0?6:"subscribed"===t.t0?15:19;break;case 6:if(0!==i.callbacks.size){t.next=12;break}return delete r._subscriptionsByHash[e],"unsubscribed"===i.state&&delete r._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],t.next=11,r._updateSubscriptions();case 11:return t.abrupt("return");case 12:return t.next=14,H(Q().mark((function t(){var o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i.args,a=i.method,t.prev=1,r._setSubscription(e,W(W({},i),{},{state:"subscribing"})),t.next=5,r._rpcWebSocket.call(a,o);case 5:return s=t.sent,r._setSubscription(e,W(W({},i),{},{serverSubscriptionId:s,state:"subscribed"})),r._subscriptionCallbacksByServerSubscriptionId[s]=i.callbacks,t.next=10,r._updateSubscriptions();case 10:t.next=20;break;case 12:if(t.prev=12,t.t0=t.catch(1),t.t0 instanceof Error&&console.error("".concat(a," error for argument"),o,t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,W(W({},i),{},{state:"pending"})),t.next=20,r._updateSubscriptions();case 20:case"end":return t.stop()}}),t,null,[[1,12]])})))();case 14:case 18:return t.abrupt("break",19);case 15:if(0!==i.callbacks.size){t.next=18;break}return t.next=18,H(Q().mark((function t(){var o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=i.serverSubscriptionId,a=i.unsubscribeMethod,!r._subscriptionsAutoDisposedByRpc.has(o)){t.next=5;break}r._subscriptionsAutoDisposedByRpc.delete(o),t.next=21;break;case 5:return r._setSubscription(e,W(W({},i),{},{state:"unsubscribing"})),r._setSubscription(e,W(W({},i),{},{state:"unsubscribing"})),t.prev=7,t.next=10,r._rpcWebSocket.call(a,[o]);case 10:t.next=21;break;case 12:if(t.prev=12,t.t0=t.catch(7),t.t0 instanceof Error&&console.error("".concat(a," error:"),t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,W(W({},i),{},{state:"subscribed"})),t.next=20,r._updateSubscriptions();case 20:return t.abrupt("return");case 21:return r._setSubscription(e,W(W({},i),{},{state:"unsubscribed"})),t.next=24,r._updateSubscriptions();case 24:case"end":return t.stop()}}),t,null,[[7,12]])})))();case 19:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 11:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"_handleServerNotification",value:function(t,e){var n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((function(t){try{t.apply(void 0,st(e))}catch(t){console.error(t)}}))}},{key:"_wsOnAccountNotification",value:function(t){var e=Fi(t,Al),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_makeSubscription",value:function(t,e){var n=this,r=this._nextClientSubscriptionId++,i=kc([t.method,e]),o=this._subscriptionsByHash[i];return void 0===o?this._subscriptionsByHash[i]=W(W({},t),{},{args:e,callbacks:new Set([t.callback]),state:"pending"}):o.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=H(Q().mark((function e(){var o;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return delete n._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete n._subscriptionHashByClientSubscriptionId[r],zu(void 0!==(o=n._subscriptionsByHash[i]),"Could not find a `Subscription` when tearing down client subscription #".concat(r)),o.callbacks.delete(t.callback),e.next=7,n._updateSubscriptions();case 7:case"end":return e.stop()}}),e)}))),this._updateSubscriptions(),r}},{key:"onAccountChange",value:function(t,e,n){var r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}},{key:"removeAccountChangeListener",value:(u=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"_wsOnProgramAccountNotification",value:function(t){var e=Fi(t,El),n=e.result,r=e.subscription;this._handleServerNotification(r,[{accountId:n.value.pubkey,accountInfo:n.value.account},n.context])}},{key:"onProgramAccountChange",value:function(t,e,n,r){var i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}},{key:"removeProgramAccountChangeListener",value:(s=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"program account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"onLogs",value:function(t,e,n){var r=this._buildArgs(["object"===F(t)?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}},{key:"removeOnLogsListener",value:(a=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"logs");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"_wsOnLogsNotification",value:function(t){var e=Fi(t,gh),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_wsOnSlotNotification",value:function(t){var e=Fi(t,Nl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotChange",value:function(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}},{key:"removeSlotChangeListener",value:(o=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"_wsOnSlotUpdatesNotification",value:function(t){var e=Fi(t,Il),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotUpdate",value:function(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}},{key:"removeSlotUpdateListener",value:(i=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot update");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"_unsubscribeClientSubscription",value:(r=H(Q().mark((function t(e,n){var r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=this._subscriptionDisposeFunctionsByClientSubscriptionId[e])){t.next=6;break}return t.next=4,r();case 4:t.next=7;break;case 6:console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(e,"` for '").concat(n,"' events ")+"could not be found.");case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"_buildArgs",value:function(t,e,n,r){var i=e||this._commitment;if(i||n||r){var o={};n&&(o.encoding=n),i&&(o.commitment=i),r&&(o=Object.assign(o,r)),t.push(o)}return t}},{key:"_buildArgsAtLeastConfirmed",value:function(t,e,n,r){var i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}},{key:"_wsOnSignatureNotification",value:function(t){var e=Fi(t,Tl),n=e.result,r=e.subscription;"receivedSignature"!==n.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===n.value?[{type:"received"},n.context]:[{type:"status",result:n.value},n.context])}},{key:"onSignature",value:function(t,e,n){var r=this,i=this._buildArgs([t],n||this._commitment||"finalized"),o=this._makeSubscription({callback:function(t,n){if("status"===t.type){e(t.result,n);try{r.removeSignatureListener(o)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return o}},{key:"onSignatureWithOptions",value:function(t,e,n){var r=this,i=W(W({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),o=i.commitment,a=nt(i,su),s=this._buildArgs([t],o,void 0,a),u=this._makeSubscription({callback:function(t,n){e(t,n);try{r.removeSignatureListener(u)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return u}},{key:"removeSignatureListener",value:(n=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"signature result");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"_wsOnRootNotification",value:function(t){var e=Fi(t,Cl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onRootChange",value:function(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}},{key:"removeRootChangeListener",value:(e=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"root change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),wh=function(){function t(e){V(this,t),this._keypair=void 0,this._keypair=null!=e?e:cu()}return G(t,[{key:"publicKey",get:function(){return new bu(this._keypair.publicKey)}},{key:"secretKey",get:function(){return new Uint8Array(this._keypair.secretKey)}}],[{key:"generate",value:function(){return new t(cu())}},{key:"fromSecretKey",value:function(e,n){if(64!==e.byteLength)throw new Error("bad secret key size");var r=e.slice(32,64);if(!n||!n.skipValidation)for(var i=e.slice(0,32),o=lu(i),a=0;a<32;a++)if(r[a]!==o[a])throw new Error("provided secretKey is invalid");return new t({publicKey:r,secretKey:e})}},{key:"fromSeed",value:function(e){var n=lu(e),r=new Uint8Array(64);return r.set(e),r.set(n,32),new t({publicKey:n,secretKey:r})}}]),t}(),bh=Object.freeze({CreateLookupTable:{index:0,layout:Ei([ki("instruction"),dc("recentSlot"),bi("bumpSeed")])},FreezeLookupTable:{index:1,layout:Ei([ki("instruction")])},ExtendLookupTable:{index:2,layout:Ei([ki("instruction"),dc(),xi(Tu(),wi(ki(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Ei([ki("instruction")])},CloseLookupTable:{index:4,layout:Ei([ki("instruction")])}}),Mh=function(){function t(){V(this,t)}return G(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=ki("instruction").decode(t.data),r=0,i=Object.entries(bh);r<i.length;r++){var o=at(i[r],2),a=o[0];if(o[1].index==n){e=a;break}}if(!e)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return e}},{key:"decodeCreateLookupTable",value:function(t){this.checkProgramId(t.programId),this.checkKeysLength(t.keys,4);var e=ac(bh.CreateLookupTable,t.data).recentSlot;return{authority:t.keys[1].pubkey,payer:t.keys[2].pubkey,recentSlot:Number(e)}}},{key:"decodeExtendLookupTable",value:function(t){if(this.checkProgramId(t.programId),t.keys.length<2)throw new Error("invalid instruction; found ".concat(t.keys.length," keys, expected at least 2"));var e=ac(bh.ExtendLookupTable,t.data).addresses;return{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,payer:t.keys.length>2?t.keys[2].pubkey:void 0,addresses:e.map((function(t){return new bu(t)}))}}},{key:"decodeCloseLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}},{key:"decodeFreezeLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"decodeDeactivateLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(kh.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}},{key:"checkKeysLength",value:function(t,e){if(t.length<e)throw new Error("invalid instruction; found ".concat(t.length," keys, expected at least ").concat(e))}}]),t}(),kh=function(){function t(){V(this,t)}return G(t,null,[{key:"createLookupTable",value:function(t){var e=at(bu.findProgramAddressSync([t.authority.toBuffer(),Ti(BigInt(t.recentSlot),8)],this.programId),2),n=e[0],r=e[1],i=oc(bh.CreateLookupTable,{recentSlot:BigInt(t.recentSlot),bumpSeed:r}),o=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:mc.programId,isSigner:!1,isWritable:!1}];return[new Fu({programId:this.programId,keys:o,data:i}),n]}},{key:"freezeLookupTable",value:function(t){var e=oc(bh.FreezeLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Fu({programId:this.programId,keys:n,data:e})}},{key:"extendLookupTable",value:function(t){var e=oc(bh.ExtendLookupTable,{addresses:t.addresses.map((function(t){return t.toBytes()}))}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:mc.programId,isSigner:!1,isWritable:!1}),new Fu({programId:this.programId,keys:n,data:e})}},{key:"deactivateLookupTable",value:function(t){var e=oc(bh.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Fu({programId:this.programId,keys:n,data:e})}},{key:"closeLookupTable",value:function(t){var e=oc(bh.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new Fu({programId:this.programId,keys:n,data:e})}}]),t}();kh.programId=new bu("AddressLookupTab1e1111111111111111111111111");var Ah=function(){function t(){V(this,t)}return G(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=bi("instruction").decode(t.data),r=0,i=Object.entries(Lh);r<i.length;r++){var o=at(i[r],2),a=o[0];if(o[1].index==n){e=a;break}}if(!e)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return e}},{key:"decodeRequestUnits",value:function(t){this.checkProgramId(t.programId);var e=ac(Lh.RequestUnits,t.data);return{units:e.units,additionalFee:e.additionalFee}}},{key:"decodeRequestHeapFrame",value:function(t){return this.checkProgramId(t.programId),{bytes:ac(Lh.RequestHeapFrame,t.data).bytes}}},{key:"decodeSetComputeUnitLimit",value:function(t){return this.checkProgramId(t.programId),{units:ac(Lh.SetComputeUnitLimit,t.data).units}}},{key:"decodeSetComputeUnitPrice",value:function(t){return this.checkProgramId(t.programId),{microLamports:ac(Lh.SetComputeUnitPrice,t.data).microLamports}}},{key:"checkProgramId",value:function(t){if(!t.equals(Eh.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}]),t}(),Lh=Object.freeze({RequestUnits:{index:0,layout:Ei([bi("instruction"),ki("units"),ki("additionalFee")])},RequestHeapFrame:{index:1,layout:Ei([bi("instruction"),ki("bytes")])},SetComputeUnitLimit:{index:2,layout:Ei([bi("instruction"),ki("units")])},SetComputeUnitPrice:{index:3,layout:Ei([bi("instruction"),dc("microLamports")])}}),Eh=function(){function t(){V(this,t)}return G(t,null,[{key:"requestUnits",value:function(t){var e=oc(Lh.RequestUnits,t);return new Fu({keys:[],programId:this.programId,data:e})}},{key:"requestHeapFrame",value:function(t){var e=oc(Lh.RequestHeapFrame,t);return new Fu({keys:[],programId:this.programId,data:e})}},{key:"setComputeUnitLimit",value:function(t){var e=oc(Lh.SetComputeUnitLimit,t);return new Fu({keys:[],programId:this.programId,data:e})}},{key:"setComputeUnitPrice",value:function(t){var e=oc(Lh.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new Fu({keys:[],programId:this.programId,data:e})}}]),t}();Eh.programId=new bu("ComputeBudget111111111111111111111111111111");var xh=Ei([bi("numSignatures"),bi("padding"),Mi("signatureOffset"),Mi("signatureInstructionIndex"),Mi("publicKeyOffset"),Mi("publicKeyInstructionIndex"),Mi("messageDataOffset"),Mi("messageDataSize"),Mi("messageInstructionIndex")]),Nh=function(){function t(){V(this,t)}return G(t,null,[{key:"createInstructionWithPublicKey",value:function(e){var n=e.publicKey,r=e.message,i=e.signature,o=e.instructionIndex;zu(32===n.length,"Public Key must be ".concat(32," bytes but received ").concat(n.length," bytes")),zu(64===i.length,"Signature must be ".concat(64," bytes but received ").concat(i.length," bytes"));var a=xh.span,s=a+n.length,u=s+i.length,c=Tt.alloc(u+r.length),l=null==o?65535:o;return xh.encode({numSignatures:1,padding:0,signatureOffset:s,signatureInstructionIndex:l,publicKeyOffset:a,publicKeyInstructionIndex:l,messageDataOffset:u,messageDataSize:r.length,messageInstructionIndex:l},c),c.fill(n,a),c.fill(i,s),c.fill(r,u),new Fu({keys:[],programId:t.programId,data:c})}},{key:"createInstructionWithPrivateKey",value:function(t){var e=t.privateKey,n=t.message,r=t.instructionIndex;zu(64===e.length,"Private key must be ".concat(64," bytes but received ").concat(e.length," bytes"));try{var i=wh.fromSecretKey(e),o=i.publicKey.toBytes(),a=du(n,i.secretKey);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,instructionIndex:r})}catch(t){throw new Error("Error creating instruction; ".concat(t))}}}]),t}();Nh.programId=new bu("Ed25519SigVerify111111111111111111111111111"),ru.hmacSha256Sync=function(t){for(var e=es.create(tr,t),n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.forEach((function(t){return e.update(t)})),e.digest()};ru.isValidPrivateKey;var Sh=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return ks.fromPrivateKey(t).toRawBytes(e)},Ih=Ei([bi("numSignatures"),Mi("signatureOffset"),bi("signatureInstructionIndex"),Mi("ethAddressOffset"),bi("ethAddressInstructionIndex"),Mi("messageDataOffset"),Mi("messageDataSize"),bi("messageInstructionIndex"),Ni(20,"ethAddress"),Ni(64,"signature"),bi("recoveryId")]),Th=function(){function t(){V(this,t)}return G(t,null,[{key:"publicKeyToEthAddress",value:function(t){zu(64===t.length,"Public key must be ".concat(64," bytes but received ").concat(t.length," bytes"));try{return Tt.from(Ka(pu(t))).slice(-20)}catch(t){throw new Error("Error constructing Ethereum address: ".concat(t))}}},{key:"createInstructionWithPublicKey",value:function(e){var n=e.publicKey,r=e.message,i=e.signature,o=e.recoveryId,a=e.instructionIndex;return t.createInstructionWithEthAddress({ethAddress:t.publicKeyToEthAddress(n),message:r,signature:i,recoveryId:o,instructionIndex:a})}},{key:"createInstructionWithEthAddress",value:function(e){var n,r=e.ethAddress,i=e.message,o=e.signature,a=e.recoveryId,s=e.instructionIndex,u=void 0===s?0:s;zu(20===(n="string"==typeof r?r.startsWith("0x")?Tt.from(r.substr(2),"hex"):Tt.from(r,"hex"):r).length,"Address must be ".concat(20," bytes but received ").concat(n.length," bytes"));var c=12+n.length,l=c+o.length+1,h=Tt.alloc(Ih.span+i.length);return Ih.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:u,ethAddressOffset:12,ethAddressInstructionIndex:u,messageDataOffset:l,messageDataSize:i.length,messageInstructionIndex:u,signature:pu(o),ethAddress:pu(n),recoveryId:a},h),h.fill(pu(i),Ih.span),new Fu({keys:[],programId:t.programId,data:h})}},{key:"createInstructionWithPrivateKey",value:function(t){var e=t.privateKey,n=t.message,r=t.instructionIndex;zu(32===e.length,"Private key must be ".concat(32," bytes but received ").concat(e.length," bytes"));try{var i=pu(e),o=Sh(i,!1).slice(1),a=Tt.from(Ka(pu(n))),s=at(Ks(a,i,{der:!1,recovered:!0}),2),u=s[0],c=s[1];return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:u,recoveryId:c,instructionIndex:r})}catch(t){throw new Error("Error creating instruction; ".concat(t))}}}]),t}();Th.programId=new bu("KeccakSecp256k11111111111111111111111111111");var Ch=new bu("StakeConfig11111111111111111111111111111111"),jh=G((function t(e,n){V(this,t),this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=n})),Dh=G((function t(e,n,r){V(this,t),this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=n,this.custodian=r}));Dh.default=new Dh(0,0,bu.default);var Oh=function(){function t(){V(this,t)}return G(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=ki("instruction").decode(t.data),r=0,i=Object.entries(_h);r<i.length;r++){var o=at(i[r],2),a=o[0];if(o[1].index==n){e=a;break}}if(!e)throw new Error("Instruction type incorrect; not a StakeInstruction");return e}},{key:"decodeInitialize",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(_h.Initialize,t.data),n=e.authorized,r=e.lockup;return{stakePubkey:t.keys[0].pubkey,authorized:new jh(new bu(n.staker),new bu(n.withdrawer)),lockup:new Dh(r.unixTimestamp,r.epoch,new bu(r.custodian))}}},{key:"decodeDelegate",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),ac(_h.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}},{key:"decodeAuthorize",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(_h.Authorize,t.data),n=e.newAuthorized,r=e.stakeAuthorizationType,i={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new bu(n),stakeAuthorizationType:{index:r}};return t.keys.length>3&&(i.custodianPubkey=t.keys[3].pubkey),i}},{key:"decodeAuthorizeWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(_h.AuthorizeWithSeed,t.data),n=e.newAuthorized,r=e.stakeAuthorizationType,i=e.authoritySeed,o=e.authorityOwner,a={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:i,authorityOwner:new bu(o),newAuthorizedPubkey:new bu(n),stakeAuthorizationType:{index:r}};return t.keys.length>3&&(a.custodianPubkey=t.keys[3].pubkey),a}},{key:"decodeSplit",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(_h.Split,t.data).lamports;return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}},{key:"decodeMerge",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),ac(_h.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}},{key:"decodeWithdraw",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);var e=ac(_h.Withdraw,t.data).lamports,n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}},{key:"decodeDeactivate",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),ac(_h.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(Ph.programId))throw new Error("invalid instruction; programId is not StakeProgram")}},{key:"checkKeyLength",value:function(t,e){if(t.length<e)throw new Error("invalid instruction; found ".concat(t.length," keys, expected at least ").concat(e))}}]),t}(),_h=Object.freeze({Initialize:{index:0,layout:Ei([ki("instruction"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"authorized";return Ei([Tu("staker"),Tu("withdrawer")],t)}(),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return Ei([Li("unixTimestamp"),Li("epoch"),Tu("custodian")],t)}()])},Authorize:{index:1,layout:Ei([ki("instruction"),Tu("newAuthorized"),ki("stakeAuthorizationType")])},Delegate:{index:2,layout:Ei([ki("instruction")])},Split:{index:3,layout:Ei([ki("instruction"),Li("lamports")])},Withdraw:{index:4,layout:Ei([ki("instruction"),Li("lamports")])},Deactivate:{index:5,layout:Ei([ki("instruction")])},Merge:{index:7,layout:Ei([ki("instruction")])},AuthorizeWithSeed:{index:8,layout:Ei([ki("instruction"),Tu("newAuthorized"),ki("stakeAuthorizationType"),ju("authoritySeed"),Tu("authorityOwner")])}}),zh=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),Ph=function(){function t(){V(this,t)}return G(t,null,[{key:"initialize",value:function(t){var e=t.stakePubkey,n=t.authorized,r=t.lockup||Dh.default,i=oc(_h.Initialize,{authorized:{staker:pu(n.staker.toBuffer()),withdrawer:pu(n.withdrawer.toBuffer())},lockup:{unixTimestamp:r.unixTimestamp,epoch:r.epoch,custodian:pu(r.custodian.toBuffer())}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Xu,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new Fu(o)}},{key:"createAccountWithSeed",value:function(t){var e=new Yu;e.add(mc.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"createAccount",value:function(t){var e=new Yu;e.add(mc.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"delegate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.votePubkey,i=oc(_h.Delegate);return(new Yu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:ec,isSigner:!1,isWritable:!1},{pubkey:Ch,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"authorize",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.stakeAuthorizationType,o=t.custodianPubkey,a=oc(_h.Authorize,{newAuthorized:pu(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Yu).add({keys:s,programId:this.programId,data:a})}},{key:"authorizeWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorityBase,r=t.authoritySeed,i=t.authorityOwner,o=t.newAuthorizedPubkey,a=t.stakeAuthorizationType,s=t.custodianPubkey,u=oc(_h.AuthorizeWithSeed,{newAuthorized:pu(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:pu(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:qu,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new Yu).add({keys:c,programId:this.programId,data:u})}},{key:"splitInstruction",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.lamports,o=oc(_h.Split,{lamports:i});return new Fu({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}},{key:"split",value:function(t){var e=new Yu;return e.add(mc.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}},{key:"splitWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.basePubkey,o=t.seed,a=t.lamports,s=new Yu;return s.add(mc.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}},{key:"merge",value:function(t){var e=t.stakePubkey,n=t.sourceStakePubKey,r=t.authorizedPubkey,i=oc(_h.Merge);return(new Yu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:ec,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"withdraw",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.toPubkey,i=t.lamports,o=t.custodianPubkey,a=oc(_h.Withdraw,{lamports:i}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:ec,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Yu).add({keys:s,programId:this.programId,data:a})}},{key:"deactivate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=oc(_h.Deactivate);return(new Yu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}]),t}();Ph.programId=new bu("Stake11111111111111111111111111111111111111"),Ph.space=200;var Bh=G((function t(e,n,r,i){V(this,t),this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=n,this.authorizedWithdrawer=r,this.commission=i})),Rh=function(){function t(){V(this,t)}return G(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=ki("instruction").decode(t.data),r=0,i=Object.entries(Uh);r<i.length;r++){var o=at(i[r],2),a=o[0];if(o[1].index==n){e=a;break}}if(!e)throw new Error("Instruction type incorrect; not a VoteInstruction");return e}},{key:"decodeInitializeAccount",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);var e=ac(Uh.InitializeAccount,t.data).voteInit;return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new Bh(new bu(e.nodePubkey),new bu(e.authorizedVoter),new bu(e.authorizedWithdrawer),e.commission)}}},{key:"decodeAuthorize",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(Uh.Authorize,t.data),n=e.newAuthorized,r=e.voteAuthorizationType;return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new bu(n),voteAuthorizationType:{index:r}}}},{key:"decodeAuthorizeWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(Uh.AuthorizeWithSeed,t.data).voteAuthorizeWithSeedArgs,n=e.currentAuthorityDerivedKeyOwnerPubkey,r=e.currentAuthorityDerivedKeySeed,i=e.newAuthorized,o=e.voteAuthorizationType;return{currentAuthorityDerivedKeyBasePubkey:t.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new bu(n),currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:new bu(i),voteAuthorizationType:{index:o},votePubkey:t.keys[0].pubkey}}},{key:"decodeWithdraw",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(Uh.Withdraw,t.data).lamports;return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(Qh.programId))throw new Error("invalid instruction; programId is not VoteProgram")}},{key:"checkKeyLength",value:function(t,e){if(t.length<e)throw new Error("invalid instruction; found ".concat(t.length," keys, expected at least ").concat(e))}}]),t}(),Uh=Object.freeze({InitializeAccount:{index:0,layout:Ei([ki("instruction"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteInit";return Ei([Tu("nodePubkey"),Tu("authorizedVoter"),Tu("authorizedWithdrawer"),bi("commission")],t)}()])},Authorize:{index:1,layout:Ei([ki("instruction"),Tu("newAuthorized"),ki("voteAuthorizationType")])},Withdraw:{index:3,layout:Ei([ki("instruction"),Li("lamports")])},AuthorizeWithSeed:{index:10,layout:Ei([ki("instruction"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return Ei([ki("voteAuthorizationType"),Tu("currentAuthorityDerivedKeyOwnerPubkey"),ju("currentAuthorityDerivedKeySeed"),Tu("newAuthorized")],t)}()])}}),Wh=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),Qh=function(){function t(){V(this,t)}return G(t,null,[{key:"initializeAccount",value:function(t){var e=t.votePubkey,n=t.nodePubkey,r=t.voteInit,i=oc(Uh.InitializeAccount,{voteInit:{nodePubkey:pu(r.nodePubkey.toBuffer()),authorizedVoter:pu(r.authorizedVoter.toBuffer()),authorizedWithdrawer:pu(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Xu,isSigner:!1,isWritable:!1},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new Fu(o)}},{key:"createAccount",value:function(t){var e=new Yu;return e.add(mc.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}},{key:"authorize",value:function(t){var e=t.votePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.voteAuthorizationType,o=oc(Uh.Authorize,{newAuthorized:pu(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Yu).add({keys:a,programId:this.programId,data:o})}},{key:"authorizeWithSeed",value:function(t){var e=t.currentAuthorityDerivedKeyBasePubkey,n=t.currentAuthorityDerivedKeyOwnerPubkey,r=t.currentAuthorityDerivedKeySeed,i=t.newAuthorizedPubkey,o=t.voteAuthorizationType,a=t.votePubkey,s=oc(Uh.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:pu(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:pu(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new Yu).add({keys:u,programId:this.programId,data:s})}},{key:"withdraw",value:function(t){var e=t.votePubkey,n=t.authorizedWithdrawerPubkey,r=t.lamports,i=t.toPubkey,o=oc(Uh.Withdraw,{lamports:r}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Yu).add({keys:a,programId:this.programId,data:o})}},{key:"safeWithdraw",value:function(e,n,r){if(e.lamports>n-r)throw new Error("Withdraw will leave vote account with insuffcient funds.");return t.withdraw(e)}}]),t}();Qh.programId=new bu("Vote111111111111111111111111111111111111111"),Qh.space=3731;var Fh=new bu("Va1idator1nfo111111111111111111111111111111"),Yh=ro({name:eo(),website:$i(eo()),details:$i(eo()),keybaseUsername:$i(eo())}),Hh=function(){function t(e,n){V(this,t),this.key=void 0,this.info=void 0,this.key=e,this.info=n}return G(t,null,[{key:"fromConfigData",value:function(e){var n=st(e);if(2!==Ou(n))return null;for(var r=[],i=0;i<2;i++){var o=new bu(n.slice(0,vu)),a=1===(n=n.slice(vu)).slice(0,1)[0];n=n.slice(1),r.push({publicKey:o,isSigner:a})}if(r[0].publicKey.equals(Fh)&&r[1].isSigner){var s=ju().decode(Tt.from(n)),u=JSON.parse(s);return Qi(u,Yh),new t(r[1].publicKey,u)}return null}}]),t}(),Vh=new bu("Vote111111111111111111111111111111111111111"),qh=Ei([Tu("nodePubkey"),Tu("authorizedWithdrawer"),bi("commission"),Ai(),xi(Ei([Ai("slot"),ki("confirmationCount")]),wi(ki(),-8),"votes"),bi("rootSlotValid"),Ai("rootSlot"),Ai(),xi(Ei([Ai("epoch"),Tu("authorizedVoter")]),wi(ki(),-8),"authorizedVoters"),Ei([xi(Ei([Tu("authorizedPubkey"),Ai("epochOfLastAuthorizedSwitch"),Ai("targetEpoch")]),32,"buf"),Ai("idx"),bi("isEmpty")],"priorVoters"),Ai(),xi(Ei([Ai("epoch"),Ai("credits"),Ai("prevCredits")]),wi(ki(),-8),"epochCredits"),Ei([Ai("slot"),Ai("timestamp")],"lastTimestamp")]),Gh=function(){function t(e){V(this,t),this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}return G(t,null,[{key:"fromAccountData",value:function(e){var n=qh.decode(pu(e),4),r=n.rootSlot;return n.rootSlotValid||(r=null),new t({nodePubkey:new bu(n.nodePubkey),authorizedWithdrawer:new bu(n.authorizedWithdrawer),commission:n.commission,votes:n.votes,rootSlot:r,authorizedVoters:n.authorizedVoters.map(Zh),priorVoters:Xh(n.priorVoters),epochCredits:n.epochCredits,lastTimestamp:n.lastTimestamp})}}]),t}();function Zh(t){var e=t.authorizedVoter;return{epoch:t.epoch,authorizedVoter:new bu(e)}}function Jh(t){var e=t.authorizedPubkey,n=t.epochOfLastAuthorizedSwitch,r=t.targetEpoch;return{authorizedPubkey:new bu(e),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function Xh(t){var e=t.buf,n=t.idx;return t.isEmpty?[]:[].concat(st(e.slice(n+1).map(Jh)),st(e.slice(0,n).map(Jh)))}var Kh={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function $h(){return $h=H(Q().mark((function t(e,n,r,i){var o,a,s,u,c,l,h;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r&&Object.prototype.hasOwnProperty.call(r,"lastValidBlockHeight")||r&&Object.prototype.hasOwnProperty.call(r,"nonceValue")?(o=r,a=i):a=r,s=a&&{skipPreflight:a.skipPreflight,preflightCommitment:a.preflightCommitment||a.commitment,minContextSlot:a.minContextSlot},t.next=4,e.sendRawTransaction(n,s);case 4:return u=t.sent,c=a&&a.commitment,l=o?e.confirmTransaction(o,c):e.confirmTransaction(u,c),t.next=9,l;case 9:if(!(h=t.sent.value).err){t.next=12;break}throw new Error("Raw transaction ".concat(u," failed (").concat(JSON.stringify(h),")"));case 12:return t.abrupt("return",u);case 13:case"end":return t.stop()}}),t)}))),$h.apply(this,arguments)}var td=Object.freeze({__proto__:null,Account:Mu,AddressLookupTableAccount:Ic,AddressLookupTableInstruction:Mh,AddressLookupTableProgram:kh,Authorized:jh,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:ku,BPF_LOADER_PROGRAM_ID:yc,BpfLoader:vc,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:Lh,ComputeBudgetInstruction:Ah,ComputeBudgetProgram:Eh,Connection:vh,Ed25519Program:Nh,Enum:gu,EpochSchedule:Lc,FeeCalculatorLayout:uc,Keypair:wh,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:bh,Loader:gc,Lockup:Dh,MAX_SEED_LENGTH:32,Message:Ru,MessageAccountKeys:Iu,MessageV0:Uu,NONCE_ACCOUNT_LENGTH:lc,NonceAccount:hc,PACKET_DATA_SIZE:Au,PUBLIC_KEY_LENGTH:vu,PublicKey:bu,SIGNATURE_LENGTH_IN_BYTES:Eu,SOLANA_SCHEMA:yu,STAKE_CONFIG_ID:Ch,STAKE_INSTRUCTION_LAYOUTS:_h,SYSTEM_INSTRUCTION_LAYOUTS:pc,SYSVAR_CLOCK_PUBKEY:qu,SYSVAR_EPOCH_SCHEDULE_PUBKEY:Gu,SYSVAR_INSTRUCTIONS_PUBKEY:Zu,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:Ju,SYSVAR_RENT_PUBKEY:Xu,SYSVAR_REWARDS_PUBKEY:Ku,SYSVAR_SLOT_HASHES_PUBKEY:$u,SYSVAR_SLOT_HISTORY_PUBKEY:tc,SYSVAR_STAKE_HISTORY_PUBKEY:ec,Secp256k1Program:Th,SendTransactionError:Ec,SolanaJSONRPCError:xc,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:zh,StakeInstruction:Oh,StakeProgram:Ph,Struct:mu,SystemInstruction:fc,SystemProgram:mc,Transaction:Yu,TransactionExpiredBlockheightExceededError:xu,TransactionExpiredNonceInvalidError:Su,TransactionExpiredTimeoutError:Nu,TransactionInstruction:Fu,TransactionMessage:Hu,get TransactionStatus(){return Pu},VALIDATOR_INFO_KEY:Fh,VERSION_PREFIX_MASK:Lu,VOTE_PROGRAM_ID:Vh,ValidatorInfo:Hh,VersionedMessage:Wu,VersionedTransaction:Vu,VoteAccount:Gh,VoteAuthorizationLayout:Wh,VoteInit:Bh,VoteInstruction:Rh,VoteProgram:Qh,clusterApiUrl:function(t,e){var n=!1===e?"http":"https";if(!t)return Kh[n].devnet;var r=Kh[n][t];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(t));return r},sendAndConfirmRawTransaction:function(t,e,n,r){return $h.apply(this,arguments)},sendAndConfirmTransaction:nc}),ed=R(td),nd={};Object.defineProperty(nd,"__esModule",{value:!0});var rd={ERROR_ASSOCIATION_PORT_OUT_OF_RANGE:"ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",ERROR_FORBIDDEN_WALLET_BASE_URL:"ERROR_FORBIDDEN_WALLET_BASE_URL",ERROR_SECURE_CONTEXT_REQUIRED:"ERROR_SECURE_CONTEXT_REQUIRED",ERROR_SESSION_CLOSED:"ERROR_SESSION_CLOSED",ERROR_SESSION_TIMEOUT:"ERROR_SESSION_TIMEOUT",ERROR_WALLET_NOT_FOUND:"ERROR_WALLET_NOT_FOUND"},id=function(t){J(n,et(Error));var e=it(n);function n(){var t;V(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=i[0],s=i[1],u=i[2];return(t=e.call(this,s)).code=a,t.data=u,t.name="SolanaMobileWalletAdapterError",t}return G(n)}(),od=function(t){J(n,et(Error));var e=it(n);function n(){var t;V(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=i[0],s=i[1],u=i[2],c=i[3];return(t=e.call(this,u)).code=s,t.data=c,t.jsonRpcMessageId=a,t.name="SolanaMobileWalletAdapterProtocolError",t}return G(n)}();function ad(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function sd(t,e){return ad(this,void 0,void 0,Q().mark((function n(){var r,i,o;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,crypto.subtle.exportKey("raw",t);case 2:return r=n.sent,n.next=5,crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},e,r);case 5:return i=n.sent,(o=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r),0),o.set(new Uint8Array(i),r.byteLength),n.abrupt("return",o);case 10:case"end":return n.stop()}}),n)})))}var ud=4;function cd(t){if(t>=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");var e=new ArrayBuffer(ud);return new DataView(e).setUint32(0,t,!1),new Uint8Array(e)}function ld(){return ad(this,void 0,void 0,Q().mark((function t(){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}function hd(){return ad(this,void 0,void 0,Q().mark((function t(){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}var dd,fd=12;function pd(t,e){return ad(this,void 0,void 0,Q().mark((function n(){var r,i,o,a,s;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=JSON.stringify(t),i=cd(t.id),o=new Uint8Array(fd),crypto.getRandomValues(o),n.next=6,crypto.subtle.encrypt(gd(i,o),e,(new TextEncoder).encode(r));case 6:return a=n.sent,(s=new Uint8Array(i.byteLength+o.byteLength+a.byteLength)).set(new Uint8Array(i),0),s.set(new Uint8Array(o),i.byteLength),s.set(new Uint8Array(a),i.byteLength+o.byteLength),n.abrupt("return",s);case 12:case"end":return n.stop()}}),n)})))}function md(t,e){return ad(this,void 0,void 0,Q().mark((function n(){var r,i,o,a,s,u;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.slice(0,ud),i=t.slice(ud,ud+fd),o=t.slice(ud+fd),n.next=5,crypto.subtle.decrypt(gd(r,i),e,o);case 5:if(a=n.sent,s=yd().decode(a),u=JSON.parse(s),!Object.hasOwnProperty.call(u,"error")){n.next=10;break}throw new od(u.id,u.error.code,u.error.message);case 10:return n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))}function gd(t,e){return{additionalData:t,iv:e,name:"AES-GCM",tagLength:128}}function yd(){return void 0===dd&&(dd=new TextDecoder("utf-8")),dd}function vd(t,e,n){return ad(this,void 0,void 0,Q().mark((function r(){var i,o,a,s,u,c,l;return Q().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Promise.all([crypto.subtle.exportKey("raw",e),crypto.subtle.importKey("raw",t,{name:"ECDH",namedCurve:"P-256"},!1,[])]);case 2:return i=r.sent,o=at(i,2),a=o[0],s=o[1],r.next=8,crypto.subtle.deriveBits({name:"ECDH",public:s},n,256);case 8:return u=r.sent,r.next=11,crypto.subtle.importKey("raw",u,"HKDF",!1,["deriveKey"]);case 11:return c=r.sent,r.next=14,crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(a),info:new Uint8Array},c,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"]);case 14:return l=r.sent,r.abrupt("return",l);case 16:case"end":return r.stop()}}),r)})))}function wd(t){if(t<49152||t>65535)throw new id(rd.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,"Association port number must be between 49152 and 65535. ".concat(t," given."),{port:t});return t}function bd(t){for(var e="",n=new Uint8Array(t),r=n.byteLength,i=0;i<r;i++)e+=String.fromCharCode(n[i]);return window.btoa(e)}var Md="solana-wallet";function kd(t){return t.replace(/(^\/+|\/+$)/g,"").split("/")}function Ad(t,e){var n=null;if(e){try{n=new URL(e)}catch(t){}if("https:"!==(null==n?void 0:n.protocol))throw new id(rd.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}n||(n=new URL("".concat(Md,":/")));var r=t.startsWith("/")?t:[].concat(st(kd(n.pathname)),st(kd(t))).join("/");return new URL(r,n)}function Ld(t,e,n){return ad(this,void 0,void 0,Q().mark((function r(){var i,o,a,s;return Q().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=wd(e),r.next=3,crypto.subtle.exportKey("raw",t);case 3:return o=r.sent,a=bd(o),(s=Ad("v1/associate/local",n)).searchParams.set("association",a.replace(/[/+=]/g,(function(t){return{"/":"_","+":"-","=":"."}[t]}))),s.searchParams.set("port","".concat(i)),r.abrupt("return",s);case 9:case"end":return r.stop()}}),r)})))}var Ed={Firefox:0,Other:1};var xd=null;function Nd(t,e){return ad(this,void 0,void 0,Q().mark((function n(){var r,i,o,a;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=wd(49152+Math.floor(16384*Math.random())),n.next=3,Ld(t,r,e);case 3:if("https:"!==(i=n.sent).protocol){n.next=8;break}window.location.assign(i),n.next=26;break;case 8:n.prev=8,o=-1!==navigator.userAgent.indexOf("Firefox/")?Ed.Firefox:Ed.Other,n.t0=o,n.next=n.t0===Ed.Firefox?13:n.t0===Ed.Other?15:20;break;case 13:return s=i,null==xd&&((xd=document.createElement("iframe")).style.display="none",document.body.appendChild(xd)),xd.contentWindow.location.href=s.toString(),n.abrupt("break",21);case 15:return a=new Promise((function(t,e){function n(){clearTimeout(i),window.removeEventListener("blur",r)}function r(){n(),t()}window.addEventListener("blur",r);var i=setTimeout((function(){n(),e()}),2e3)})),window.location.assign(i),n.next=19,a;case 19:return n.abrupt("break",21);case 20:case 21:n.next=26;break;case 23:throw n.prev=23,n.t1=n.catch(8),new id(rd.ERROR_WALLET_NOT_FOUND,"Found no installed wallet that supports the mobile wallet protocol.");case 26:return n.abrupt("return",r);case 27:case"end":return n.stop()}var s}),n,null,[[8,23]])})))}var Sd=[150,150,200,500,500,750,750,1e3],Id=3e4;function Td(){if("undefined"==typeof window||!0!==window.isSecureContext)throw new id(rd.ERROR_SECURE_CONTEXT_REQUIRED,"The mobile wallet adapter protocol must be used in a secure context (`https`).")}function Cd(t){var e;try{e=new URL(t)}catch(t){throw new id(rd.ERROR_FORBIDDEN_WALLET_BASE_URL,"Invalid base URL supplied by wallet")}if("https:"!==e.protocol)throw new id(rd.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}nd.SolanaMobileWalletAdapterError=id,nd.SolanaMobileWalletAdapterErrorCode=rd,nd.SolanaMobileWalletAdapterProtocolError=od,nd.SolanaMobileWalletAdapterProtocolErrorCode={ERROR_AUTHORIZATION_FAILED:-1,ERROR_INVALID_PAYLOADS:-2,ERROR_NOT_SIGNED:-3,ERROR_NOT_SUBMITTED:-4,ERROR_TOO_MANY_PAYLOADS:-5,ERROR_ATTEST_ORIGIN_ANDROID:-100},nd.transact=function(t,e){return ad(this,void 0,void 0,Q().mark((function n(){var r,i,o,a,s,u,c,l,h=this;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return Td(),n.next=3,ld();case 3:return r=n.sent,n.next=6,Nd(r.publicKey,null==e?void 0:e.baseUri);case 6:return i=n.sent,o="ws://localhost:".concat(i,"/solana-wallet"),s=function(){var t=st(Sd);return function(){return t.length>1?t.shift():t[0]}}(),u=1,c=0,l={__type:"disconnected"},n.abrupt("return",new Promise((function(e,n){var d,f,p,m={},g=function t(){return ad(h,void 0,void 0,Q().mark((function e(){var n,r;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("connecting"===l.__type){e.next=3;break}return console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(l.__type,"`.")),e.abrupt("return");case 3:return n=l.associationKeypair,d.removeEventListener("open",t),e.next=7,hd();case 7:return r=e.sent,e.t0=d,e.next=11,sd(r.publicKey,n.privateKey);case 11:e.t1=e.sent,e.t0.send.call(e.t0,e.t1),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};case 14:case"end":return e.stop()}}),e)})))},y=function(t){t.wasClean?l={__type:"disconnected"}:n(new id(rd.ERROR_SESSION_CLOSED,"The wallet session dropped unexpectedly (".concat(t.code,": ").concat(t.reason,")."),{closeEvent:t})),f()},v=function(t){return ad(h,void 0,void 0,Q().mark((function t(){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(f(),!(Date.now()-a>=Id)){t.next=5;break}n(new id(rd.ERROR_SESSION_TIMEOUT,"Failed to connect to the wallet websocket on port ".concat(i,"."))),t.next=8;break;case 5:return t.next=7,new Promise((function(t){var e=s();p=window.setTimeout(t,e)}));case 7:b();case 8:case"end":return t.stop()}}),t)})))},w=function(r){return ad(h,void 0,void 0,Q().mark((function i(){var o,a,s,h,p,g,y,v;return Q().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,r.data.arrayBuffer();case 2:o=i.sent,i.t0=l.__type,i.next="connected"===i.t0?6:"hello_req_sent"===i.t0?30:51;break;case 6:if(i.prev=6,a=o.slice(0,ud),(s=new DataView(a).getUint32(0,!1))===c+1){i.next=11;break}throw new Error("Encrypted message has invalid sequence number");case 11:return c=s,i.next=14,md(o,l.sharedSecret);case 14:h=i.sent,p=m[h.id],delete m[h.id],p.resolve(h.result),i.next=29;break;case 20:if(i.prev=20,i.t1=i.catch(6),!(i.t1 instanceof od)){i.next=28;break}g=m[i.t1.jsonRpcMessageId],delete m[i.t1.jsonRpcMessageId],g.reject(i.t1),i.next=29;break;case 28:throw i.t1;case 29:return i.abrupt("break",51);case 30:return i.next=32,vd(o,l.associationPublicKey,l.ecdhPrivateKey);case 32:return y=i.sent,l={__type:"connected",sharedSecret:y},v=new Proxy({},{get:function(t,e){if(null==t[e]){var n=e.toString().replace(/[A-Z]/g,(function(t){return"_".concat(t.toLowerCase())})).toLowerCase();t[e]=function(t){return ad(this,void 0,void 0,Q().mark((function r(){var i;return Q().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=u++,r.t0=d,r.next=4,pd({id:i,jsonrpc:"2.0",method:n,params:null!=t?t:{}},y);case 4:return r.t1=r.sent,r.t0.send.call(r.t0,r.t1),r.abrupt("return",new Promise((function(t,n){m[i]={resolve:function(r){switch(e){case"authorize":case"reauthorize":var i=r.wallet_uri_base;if(null!=i)try{Cd(i)}catch(t){return void n(t)}}t(r)},reject:n}})));case 7:case"end":return r.stop()}}),r)})))}}return t[e]},defineProperty:function(){return!1},deleteProperty:function(){return!1}}),i.prev=35,i.t2=e,i.next=39,t(v);case 39:i.t3=i.sent,(0,i.t2)(i.t3),i.next=46;break;case 43:i.prev=43,i.t4=i.catch(35),n(i.t4);case 46:return i.prev=46,f(),d.close(),i.finish(46);case 50:return i.abrupt("break",51);case 51:case"end":return i.stop()}}),i,null,[[6,20],[35,43,46,50]])})))},b=function(){f&&f(),l={__type:"connecting",associationKeypair:r},void 0===a&&(a=Date.now()),(d=new WebSocket(o,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",g),d.addEventListener("close",y),d.addEventListener("error",v),d.addEventListener("message",w),f=function(){window.clearTimeout(p),d.removeEventListener("open",g),d.removeEventListener("close",y),d.removeEventListener("error",v),d.removeEventListener("message",w)}};b()})));case 13:case"end":return n.stop()}}),n)})))};var jd=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var r=0;r<t.length;r++){var i=t.charAt(r),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=r}var a=t.length,s=t.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var n=0,r=0,i=0;t[n]===s;)r++,n++;for(var o=(t.length-n)*u+1>>>0,c=new Uint8Array(o);t[n];){var l=e[t.charCodeAt(n)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h<i)&&-1!==d;d--,h++)l+=a*c[d]>>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var f=o-i;f!==o&&0===c[f];)f++;for(var p=new Uint8Array(r+(o-f)),m=r;f!==o;)p[m++]=c[f++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,f=u-1;(0!==h||d<r)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=u-r;p!==u&&0===l[p];)p++;for(var m=s.repeat(n);p<u;++p)m+=t.charAt(l[p]);return m},decodeUnsafe:l,decode:function(t){var e=l(t);if(e)return e;throw new Error("Non-base"+a+" character")}}},Dd=jd("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Object.defineProperty(pt,"__esModule",{value:!0});var Od=ed,_d=nd;function zd(t){return t&&"object"===F(t)&&"default"in t?t:{default:t}}var Pd=zd(Dd);function Bd(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function Rd(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function Ud(t){var e;return window.btoa((e=String.fromCharCode).call.apply(e,[null].concat(st(t))))}function Wd(t){return new Uint8Array(window.atob(t).split("").map((function(t){return t.charCodeAt(0)})))}function Qd(t){return Ud("version"in t?t.serialize():t.serialize({requireAllSignatures:!1,verifySignatures:!1}))}function Fd(t){var e=t[0]*Od.SIGNATURE_LENGTH_IN_BYTES+1;return"legacy"===Od.VersionedMessage.deserializeMessageVersion(t.slice(e,t.length))?Od.Transaction.from(t):Od.VersionedTransaction.deserialize(t)}pt.transact=function(t,e){return Rd(this,void 0,void 0,Q().mark((function n(){var r;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(e){var n=new Proxy({},{get:function(t,n){if(null==t[n])switch(n){case"signAndSendTransactions":t[n]=function(t){var n=t.minContextSlot,r=t.transactions,i=Bd(t,["minContextSlot","transactions"]);return Rd(this,void 0,void 0,Q().mark((function t(){var o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=r.map(Qd),t.next=3,e.signAndSendTransactions(Object.assign(Object.assign(Object.assign({},i),null!=n?{options:{min_context_slot:n}}:null),{payloads:o}));case 3:return a=t.sent,s=a.signatures,u=s.map(Wd).map(Pd.default.encode),t.abrupt("return",u);case 7:case"end":return t.stop()}}),t)})))};break;case"signMessages":t[n]=function(t){var n=t.payloads,r=Bd(t,["payloads"]);return Rd(this,void 0,void 0,Q().mark((function t(){var i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=n.map(Ud),t.next=3,e.signMessages(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=t.sent,a=o.signed_payloads,s=a.map(Wd),t.abrupt("return",s);case 7:case"end":return t.stop()}}),t)})))};break;case"signTransactions":t[n]=function(t){var n=t.transactions,r=Bd(t,["transactions"]);return Rd(this,void 0,void 0,Q().mark((function t(){var i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=n.map(Qd),t.next=3,e.signTransactions(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=t.sent,a=o.signed_payloads,s=a.map(Wd),u=s.map(Fd),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))};break;default:t[n]=e[n]}return t[n]},defineProperty:function(){return!1},deleteProperty:function(){return!1}});return t(n)},n.next=3,_d.transact(r,e);case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n)})))};var Yd={},Hd=function(){function t(e,n){if(V(this,t),!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=n}return G(t,[{key:"makeDestinationObject",value:function(){return{}}},{key:"decode",value:function(t,e){throw new Error("Layout is abstract")}},{key:"encode",value:function(t,e,n){throw new Error("Layout is abstract")}},{key:"getSpan",value:function(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(t){var e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}},{key:"fromArray",value:function(t){}}]),t}();function Vd(t,e){return e.property?t+"["+e.property+"]":t}Yd.Layout=Hd,Yd.nameWithProperty=Vd,Yd.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Hd))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=function(){return new t},Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};var qd=function(t){J(n,Hd);var e=it(n);function n(){return V(this,n),e.apply(this,arguments)}return G(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}(),Gd=function(t){J(n,qd);var e=it(n);function n(t,r){var i;if(V(this,n),void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");return(i=e.call(this,-1,r)).elementSpan=t,i}return G(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.length-e;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(t,e,n){return 0}}]),n}(),Zd=function(t){J(n,qd);var e=it(n);function n(t,r,i){var o;if(V(this,n),!(t instanceof Hd))throw new TypeError("layout must be a Layout");if(void 0===r)r=0;else if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");return(o=e.call(this,t.span,i||t.property)).layout=t,o.offset=r,o}return G(n,[{key:"isCount",value:function(){return this.layout instanceof Jd||this.layout instanceof Xd}},{key:"decode",value:function(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}]),n}(),Jd=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}]),n}(),Xd=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}]),n}(),Kd=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntLE(t,n,this.span),this.span}}]),n}(),$d=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntBE(t,n,this.span),this.span}}]),n}(),tf=Math.pow(2,32);function ef(t){var e=Math.floor(t/tf);return{hi32:e,lo32:t-e*tf}}function nf(t,e){return t*tf+e}var rf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return nf(t.readUInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=ef(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}]),n}(),of=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),nf(t.readUInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=ef(t);return e.writeUInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(),af=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return nf(t.readInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=ef(t);return e.writeUInt32LE(r.lo32,n),e.writeInt32LE(r.hi32,n+4),8}}]),n}(),sf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),nf(t.readInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=ef(t);return e.writeInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(),uf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,4,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatLE(t,n),4}}]),n}(),cf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,4,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatBE(t,n),4}}]),n}(),lf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleLE(t,n),8}}]),n}(),hf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleBE(t,n),8}}]),n}(),df=function(t){J(n,Hd);var e=it(n);function n(t,r,i){var o;if(V(this,n),!(t instanceof Hd))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof qd&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var a=-1;return!(r instanceof qd)&&0<t.span&&(a=r*t.span),(o=e.call(this,a,i)).elementLayout=t,o.count=r,o}return G(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0,r=this.count;if(r instanceof qd&&(r=r.decode(t,e)),0<this.elementLayout.span)n=r*this.elementLayout.span;else for(var i=0;i<r;)n+=this.elementLayout.getSpan(t,e+n),++i;return n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=[],r=0,i=this.count;for(i instanceof qd&&(i=i.decode(t,e));r<i;)n.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),r+=1;return n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=this.elementLayout,i=t.reduce((function(t,i){return t+r.encode(i,e,n+t)}),0);return this.count instanceof qd&&this.count.encode(t.length,e,n),i}}]),n}(),ff=function(t){J(n,Hd);var e=it(n);function n(t,r,i){var o;if(V(this,n),!Array.isArray(t)||!t.reduce((function(t,e){return t&&e instanceof Hd}),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof r&&void 0===i&&(i=r,r=void 0);var a,s=ft(t);try{for(s.s();!(a=s.n()).done;){var u=a.value;if(0>u.span&&void 0===u.property)throw new Error("fields cannot contain unnamed variable-length layout")}}catch(t){s.e(t)}finally{s.f()}var c=-1;try{c=t.reduce((function(t,e){return t+e.getSpan()}),0)}catch(t){}return(o=e.call(this,c,r)).fields=t,o.decodePrefixes=!!i,o}return G(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n,r=this.makeDestinationObject(),i=ft(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r,i=n,o=0,a=0,s=ft(this.fields);try{for(s.s();!(r=s.n()).done;){var u=r.value,c=u.span;if(a=0<c?c:0,void 0!==u.property){var l=t[u.property];void 0!==l&&(a=u.encode(l,e,n),0>c&&(c=u.getSpan(e,n)))}o=n,n+=c}}catch(t){s.e(t)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(t){var e,n=this.makeDestinationObject(),r=ft(this.fields);try{for(r.s();!(e=r.n()).done;){var i=e.value;void 0!==i.property&&0<t.length&&(n[i.property]=t.shift())}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"layoutFor",value:function(t){if("string"!=typeof t)throw new TypeError("property must be string");var e,n=ft(this.fields);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.property===t)return r}}catch(t){n.e(t)}finally{n.f()}}},{key:"offsetOf",value:function(t){if("string"!=typeof t)throw new TypeError("property must be string");var e,n=0,r=ft(this.fields);try{for(r.s();!(e=r.n()).done;){var i=e.value;if(i.property===t)return n;0>i.span?n=-1:0<=n&&(n+=i.span)}}catch(t){r.e(t)}finally{r.f()}}}]),n}(),pf=function(){function t(e){V(this,t),this.property=e}return G(t,[{key:"decode",value:function(){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(){throw new Error("UnionDiscriminator is abstract")}}]),t}(),mf=function(t){J(n,pf);var e=it(n);function n(t,r){var i;if(V(this,n),!(t instanceof qd&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=e.call(this,r||t.property||"variant")).layout=t,i}return G(n,[{key:"decode",value:function(t,e){return this.layout.decode(t,e)}},{key:"encode",value:function(t,e,n){return this.layout.encode(t,e,n)}}]),n}(),gf=function(t){J(n,Hd);var e=it(n);function n(t,r,i){var o;V(this,n);var a=t instanceof Jd||t instanceof Xd;if(a)t=new mf(new Zd(t));else if(t instanceof qd&&t.isCount())t=new mf(t);else if(!(t instanceof pf))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===r&&(r=null),!(null===r||r instanceof Hd))throw new TypeError("defaultLayout must be null or a Layout");if(null!==r){if(0>r.span)throw new Error("defaultLayout must have constant span");void 0===r.property&&(r=r.replicate("content"))}var s=-1;r&&0<=(s=r.span)&&a&&(s+=t.layout.span),(o=e.call(this,s,i)).discriminator=t,o.usesPrefixDiscriminator=a,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(rt(o));return o.getSourceVariant=function(t){return u(t)},o.configGetSourceVariant=function(t){u=t.bind(this)},o}return G(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}},{key:"defaultGetSourceVariant",value:function(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;var e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(var n in this.registry){var r=this.registry[n];if(t.hasOwnProperty(r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(t,e){var n;void 0===e&&(e=0);var r=this.discriminator,i=r.decode(t,e),o=this.registry[i];if(void 0===o){var a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),(n=this.makeDestinationObject())[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+a)}else n=o.decode(t,e);return n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=this.getSourceVariant(t);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(t[i.property],e,n),a+o.encode(t[o.property],e,n+a)}return r.encode(t,e,n)}},{key:"addVariant",value:function(t,e,n){var r=new yf(this,t,e,n);return this.registry[t]=r,r}},{key:"getVariant",value:function(t,e){var n=t;return Tt.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}]),n}(),yf=function(t){J(n,Hd);var e=it(n);function n(t,r,i,o){var a;if(V(this,n),!(t instanceof gf))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof i&&void 0===o&&(o=i,i=null),i){if(!(i instanceof Hd))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=i.span&&i.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof o)throw new TypeError("variant must have a String property")}var s=t.span;return 0>t.span&&0<=(s=i?i.span:0)&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span),(a=e.call(this,s,o)).union=t,a.variant=r,a.layout=i||null,a}return G(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}},{key:"decode",value:function(t,e){var n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");var r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);var i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(t){if(this.layout)return this.layout.fromArray(t)}}]),n}();function vf(t){return 0>t&&(t+=4294967296),t}var wf=function(t){J(n,Hd);var e=it(n);function n(t,r,i){var o;if(V(this,n),!(t instanceof Jd||t instanceof Xd))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=void 0),4<t.span)throw new RangeError("word cannot exceed 32 bits");(o=e.call(this,t.span,i)).word=t,o.msb=!!r,o.fields=[];var a=0;return o._packedSetValue=function(t){return a=vf(t),this},o._packedGetValue=function(){return a},o}return G(n,[{key:"decode",value:function(t,e){var n=this.makeDestinationObject();void 0===e&&(e=0);var r=this.word.decode(t,e);this._packedSetValue(r);var i,o=ft(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;void 0!==a.property&&(n[a.property]=a.decode(r))}}catch(t){o.e(t)}finally{o.f()}return n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=this.word.decode(e,n);this._packedSetValue(r);var i,o=ft(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(void 0!==a.property){var s=t[a.property];void 0!==s&&a.encode(s)}}}catch(t){o.e(t)}finally{o.f()}return this.word.encode(this._packedGetValue(),e,n)}},{key:"addField",value:function(t,e){var n=new bf(this,t,e);return this.fields.push(n),n}},{key:"addBoolean",value:function(t){var e=new Mf(this,t);return this.fields.push(e),e}},{key:"fieldFor",value:function(t){if("string"!=typeof t)throw new TypeError("property must be string");var e,n=ft(this.fields);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.property===t)return r}}catch(t){n.e(t)}finally{n.f()}}}]),n}(),bf=function(){function t(e,n,r){if(V(this,t),!(e instanceof wf))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(n)||0>=n)throw new TypeError("bits must be positive integer");var i=8*e.span,o=e.fields.reduce((function(t,e){return t+e.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=n,this.valueMask=(1<<n)-1,32===n&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=i-o-n),this.wordMask=vf(this.valueMask<<this.start),this.property=r}return G(t,[{key:"decode",value:function(){return vf(this.container._packedGetValue()&this.wordMask)>>>this.start}},{key:"encode",value:function(t){if(!Number.isInteger(t)||t!==vf(t&this.valueMask))throw new TypeError(Vd("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var e=this.container._packedGetValue(),n=vf(t<<this.start);this.container._packedSetValue(vf(e&~this.wordMask)|n)}}]),t}(),Mf=function(t){J(n,bf);var e=it(n);function n(t,r){return V(this,n),e.call(this,t,1,r)}return G(n,[{key:"decode",value:function(t,e){return!!bf.prototype.decode.call(this,t,e)}},{key:"encode",value:function(t){return"boolean"==typeof t&&(t=+t),bf.prototype.encode.call(this,t)}}]),n}(),kf=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),!(t instanceof qd&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var o=-1;return t instanceof qd||(o=t),(i=e.call(this,o,r)).length=t,i}return G(n,[{key:"getSpan",value:function(t,e){var n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}},{key:"encode",value:function(t,e,n){var r=this.length;if(this.length instanceof qd&&(r=t.length),!Tt.isBuffer(t)||r!==t.length)throw new TypeError(Vd("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof qd&&this.length.encode(r,e,n),r}}]),n}(),Af=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,-1,t)}return G(n,[{key:"getSpan",value:function(t,e){if(!Tt.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);for(var n=e;n<t.length&&0!==t[n];)n+=1;return 1+n-e}},{key:"decode",value:function(t,e,n){void 0===e&&(e=0);var r=this.getSpan(t,e);return t.slice(e,e+r-1).toString("utf-8")}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());var r=new Tt(t,"utf8"),i=r.length;if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}]),n}(),Lf=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),"string"==typeof t&&void 0===r&&(r=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");return(i=e.call(this,-1,r)).maxSpan=t,i}return G(n,[{key:"getSpan",value:function(t,e){if(!Tt.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}},{key:"decode",value:function(t,e,n){void 0===e&&(e=0);var r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return t.slice(e,e+r).toString("utf-8")}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());var r=new Tt(t,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}]),n}(),Ef=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;return V(this,n),(i=e.call(this,0,r)).value=t,i}return G(n,[{key:"decode",value:function(t,e,n){return this.value}},{key:"encode",value:function(t,e,n){return 0}}]),n}();Yd.ExternalLayout=qd,Yd.GreedyCount=Gd,Yd.OffsetLayout=Zd,Yd.UInt=Jd,Yd.UIntBE=Xd,Yd.Int=Kd,Yd.IntBE=$d,Yd.Float=uf,Yd.FloatBE=cf,Yd.Double=lf,Yd.DoubleBE=hf,Yd.Sequence=df,Yd.Structure=ff,Yd.UnionDiscriminator=pf,Yd.UnionLayoutDiscriminator=mf,Yd.Union=gf,Yd.VariantLayout=yf,Yd.BitStructure=wf,Yd.BitField=bf,Yd.Boolean=Mf,Yd.Blob=kf,Yd.CString=Af,Yd.UTF8=Lf,Yd.Constant=Ef,Yd.greedy=function(t,e){return new Gd(t,e)},Yd.offset=function(t,e,n){return new Zd(t,e,n)},Yd.u8=function(t){return new Jd(1,t)},Yd.u16=function(t){return new Jd(2,t)},Yd.u24=function(t){return new Jd(3,t)},Yd.u32=function(t){return new Jd(4,t)},Yd.u40=function(t){return new Jd(5,t)},Yd.u48=function(t){return new Jd(6,t)},Yd.nu64=function(t){return new rf(t)},Yd.u16be=function(t){return new Xd(2,t)},Yd.u24be=function(t){return new Xd(3,t)},Yd.u32be=function(t){return new Xd(4,t)},Yd.u40be=function(t){return new Xd(5,t)},Yd.u48be=function(t){return new Xd(6,t)},Yd.nu64be=function(t){return new of(t)},Yd.s8=function(t){return new Kd(1,t)},Yd.s16=function(t){return new Kd(2,t)},Yd.s24=function(t){return new Kd(3,t)},Yd.s32=function(t){return new Kd(4,t)},Yd.s40=function(t){return new Kd(5,t)},Yd.s48=function(t){return new Kd(6,t)},Yd.ns64=function(t){return new af(t)},Yd.s16be=function(t){return new $d(2,t)},Yd.s24be=function(t){return new $d(3,t)},Yd.s32be=function(t){return new $d(4,t)},Yd.s40be=function(t){return new $d(5,t)},Yd.s48be=function(t){return new $d(6,t)},Yd.ns64be=function(t){return new sf(t)},Yd.f32=function(t){return new uf(t)},Yd.f32be=function(t){return new cf(t)},Yd.f64=function(t){return new lf(t)},Yd.f64be=function(t){return new hf(t)},Yd.struct=function(t,e,n){return new ff(t,e,n)},Yd.bits=function(t,e,n){return new wf(t,e,n)};var xf=Yd.seq=function(t,e,n){return new df(t,e,n)};Yd.union=function(t,e,n){return new gf(t,e,n)},Yd.unionLayoutDiscriminator=function(t,e){return new mf(t,e)},Yd.blob=function(t,e){return new kf(t,e)},Yd.cstr=function(t){return new Af(t)},Yd.utf8=function(t,e){return new Lf(t,e)},Yd.const=function(t,e){return new Ef(t,e)};var Nf={},Sf={exports:{}};!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"===F(t)?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Wn.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"===F(t)&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"===F(t))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype._move=function(t){c(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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];function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?m+r:h[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n++]=255&a,n<t.length&&(t[n++]=a>>8&255),n<t.length&&(t[n++]=a>>16&255),6===o?(n<t.length&&(t[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<t.length)for(t[n++]=r;n<t.length;)t[n++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var n=t.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n--]=255&a,n>=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,v=g>>>13,w=0|a[3],b=8191&w,M=w>>>13,k=0|a[4],A=8191&k,L=k>>>13,E=0|a[5],x=8191&E,N=E>>>13,S=0|a[6],I=8191&S,T=S>>>13,C=0|a[7],j=8191&C,D=C>>>13,O=0|a[8],_=8191&O,z=O>>>13,P=0|a[9],B=8191&P,R=P>>>13,U=0|s[0],W=8191&U,Q=U>>>13,F=0|s[1],Y=8191&F,H=F>>>13,V=0|s[2],q=8191&V,G=V>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,W))|0)+((8191&(i=(i=Math.imul(h,Q))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,Q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,W),i=(i=Math.imul(p,Q))+Math.imul(m,W)|0,o=Math.imul(m,Q);var yt=(c+(r=r+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,W),i=(i=Math.imul(y,Q))+Math.imul(v,W)|0,o=Math.imul(v,Q),r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,q)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(d,q)|0))<<13)|0;c=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,W),i=(i=Math.imul(b,Q))+Math.imul(M,W)|0,o=Math.imul(M,Q),r=r+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,G)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(A,W),i=(i=Math.imul(A,Q))+Math.imul(L,W)|0,o=Math.imul(L,Q),r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,G)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,W),i=(i=Math.imul(x,Q))+Math.imul(N,W)|0,o=Math.imul(N,Q),r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(b,q)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,G)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(I,W),i=(i=Math.imul(I,Q))+Math.imul(T,W)|0,o=Math.imul(T,Q),r=r+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(A,q)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,G)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Q))+Math.imul(D,W)|0,o=Math.imul(D,Q),r=r+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(x,q)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,G)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var At=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(_,W),i=(i=Math.imul(_,Q))+Math.imul(z,W)|0,o=Math.imul(z,Q),r=r+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,G)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Lt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,W),i=(i=Math.imul(B,Q))+Math.imul(R,W)|0,o=Math.imul(R,Q),r=r+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(z,Y)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,q)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,G)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,Y),i=(i=Math.imul(B,H))+Math.imul(R,Y)|0,o=Math.imul(R,H),r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(z,q)|0,o=o+Math.imul(z,G)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,q),i=(i=Math.imul(B,G))+Math.imul(R,q)|0,o=Math.imul(R,G),r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,X)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var Nt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,dt)|0;var St=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,dt)|0;var Tt=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var Ct=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,mt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=kt,u[7]=At,u[8]=Lt,u[9]=Et,u[10]=xt,u[11]=Nt,u[12]=St,u[13]=It,u[14]=Tt,u[15]=Ct,u[16]=jt,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function g(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(t,e,n){return g(t,e,n)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):n<63?p(this,t,e):n<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=t.words[r]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new L(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function L(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){L.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(M,w),r(k,w),r(A,w),A.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},L.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},L.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},L.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},L.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},L.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},L.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},L.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},L.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},L.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},L.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},L.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},L.prototype.isqr=function(t){return this.imul(t,t.clone())},L.prototype.sqr=function(t){return this.mul(t,t)},L.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},L.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},L.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},L.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},L.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,L),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(Sf,P),function(t){var e=P&&P.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;var n=Yd,r=ed,i=e(Sf.exports),o=Yd;Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return o.struct}});var a=function(t){J(r,t);var e=it(r);function r(t,i,o){var a;return V(this,r),(a=e.call(this,t,o)).blob=n.blob(t),a.signed=i,a}return G(r,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new i.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(Tt,"le",this.span),e,n)}}]),r}(n.Layout);function s(t){return new a(8,!1,t)}t.u64=s,t.i64=function(t){return new a(8,!0,t)},t.u128=function(t){return new a(16,!1,t)},t.i128=function(t){return new a(16,!0,t)};var u=function(t){J(n,t);var e=it(n);function n(t,r,i,o){var a;return V(this,n),(a=e.call(this,t.span,o)).layout=t,a.decoder=r,a.encoder=i,a}return G(n,[{key:"decode",value:function(t,e){return this.decoder(this.layout.decode(t,e))}},{key:"encode",value:function(t,e,n){return this.layout.encode(this.encoder(t),e,n)}},{key:"getSpan",value:function(t,e){return this.layout.getSpan(t,e)}}]),n}(n.Layout);t.publicKey=function(t){return new u(n.blob(32),(function(t){return new r.PublicKey(t)}),(function(t){return t.toBuffer()}),t)};var c=function(t){J(r,t);var e=it(r);function r(t,i){var o;return V(this,r),(o=e.call(this,-1,i)).layout=t,o.discriminator=n.u8(),o}return G(r,[{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}},{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}]),r}(n.Layout);function l(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function h(t){return t?1:0}function d(t){var e=n.u32("length"),r=n.struct([e,n.blob(n.offset(e,-e.span),"data")]);return new u(r,(function(t){return t.data}),(function(t){return{data:t}}),t)}t.option=function(t,e){return new c(t,e)},t.bool=function(t){return new u(n.u8(),l,h,t)},t.vec=function(t,e){var r=n.u32("length"),i=n.struct([r,n.seq(t,n.offset(r,-r.span),"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),e)},t.tagged=function(t,e,r){var i=n.struct([s("tag"),e.replicate("data")]);return new u(i,(function(e){var n=e.tag,r=e.data;if(!n.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+n.toString("hex"));return r}),(function(e){return{tag:t,data:e}}),r)},t.vecU8=d,t.str=function(t){return new u(d(),(function(t){return t.toString("utf-8")}),(function(t){return Tt.from(t,"utf-8")}),t)},t.rustEnum=function(t,e,r){var i=n.union(null!=r?r:n.u8(),e);return t.forEach((function(t,e){return i.addVariant(e,t,t.property)})),i},t.array=function(t,e,r){var i=n.struct([n.seq(t,e,"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),r)};var f=function(t){J(n,t);var e=it(n);function n(t,r,i){var o;return V(this,n),(o=e.call(this,t.span+r.span,i)).keyLayout=t,o.valueLayout=r,o}return G(n,[{key:"decode",value:function(t,e){return e=e||0,[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}},{key:"encode",value:function(t,e,n){n=n||0;var r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}},{key:"getSpan",value:function(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}]),n}(n.Layout);t.map=function(t,e,r){var i=n.u32("length"),o=n.struct([i,n.seq(new f(t,e),n.offset(i,-i.span),"values")]);return new u(o,(function(t){var e=t.values;return new Map(e)}),(function(t){return{values:Array.from(t.entries())}}),r)}}(Nf),pt.Web3MobileWallet;var If=pt.transact,Tf=Wn.Buffer,Cf=Un.exports,jf=Nf.struct([Nf.publicKey("mint"),Nf.publicKey("owner"),Nf.u64("amount"),Nf.u32("delegateOption"),Nf.publicKey("delegate"),Nf.u8("state"),Nf.u32("isNativeOption"),Nf.u64("isNative"),Nf.u64("delegatedAmount"),Nf.u32("closeAuthorityOption"),Nf.publicKey("closeAuthority")]);Nf.array;var Df=Nf.bool,Of=Nf.i128;Nf.i16;var _f=Nf.i32,zf=Nf.i64;Nf.i8,Nf.map;var Pf=Nf.option,Bf=Nf.publicKey,Rf=Nf.rustEnum,Uf=Nf.str,Wf=Nf.struct;Nf.tagged;var Qf=Nf.u128,Ff=Nf.u16,Yf=Nf.u32,Hf=Nf.u64,Vf=Nf.u8,qf=Nf.vec;Nf.vecU8;const Gf="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOTIgMTkyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxOTIgMTkyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxwYXRoIGZpbGw9IiNGMEI5MEIiIGQ9Ik01NCw0MS4xbDQyLTI0LjJsNDIsMjQuMmwtMTUuNCw4LjlMOTYsMzQuOUw2OS40LDUwTDU0LDQxLjF6IE0xMzgsNzEuN2wtMTUuNC04LjlMOTYsNzhMNjkuNCw2Mi43bC0xNS40LDl2MTgKCUw4MC42LDEwNXYzMC41bDE1LjQsOWwxNS40LTlWMTA1TDEzOCw4OS43VjcxLjd6IE0xMzgsMTIwLjN2LTE4bC0xNS40LDguOXYxOEMxMjIuNiwxMjkuMSwxMzgsMTIwLjMsMTM4LDEyMC4zeiBNMTQ4LjksMTI2LjQKCWwtMjYuNiwxNS4zdjE4bDQyLTI0LjJWODdsLTE1LjQsOUMxNDguOSw5NiwxNDguOSwxMjYuNCwxNDguOSwxMjYuNHogTTEzMy41LDU2LjRsMTUuNCw5djE4bDE1LjQtOXYtMThsLTE1LjQtOUwxMzMuNSw1Ni40CglMMTMzLjUsNTYuNHogTTgwLjYsMTQ4LjN2MThsMTUuNCw5bDE1LjQtOXYtMThMOTYsMTU3LjFMODAuNiwxNDguM3ogTTU0LDEyMC4zbDE1LjQsOXYtMTguMUw1NCwxMDIuM0w1NCwxMjAuM0w1NCwxMjAuM3oKCSBNODAuNiw1Ni40bDE1LjQsOWwxNS40LTlMOTYsNDcuNUM5Niw0Ny40LDgwLjYsNTYuNCw4MC42LDU2LjRMODAuNiw1Ni40eiBNNDMuMSw2NS40bDE1LjQtOWwtMTUuNC05bC0xNS40LDl2MThsMTUuNCw5TDQzLjEsNjUuNAoJTDQzLjEsNjUuNHogTTQzLjEsOTUuOUwyNy43LDg3djQ4LjVsNDIsMjQuMnYtMThsLTI2LjYtMTUuM1Y5NS45TDQzLjEsOTUuOXoiLz4KPC9zdmc+Cg==";var Zf={name:"bsc",id:"0x38",networkId:"56",namespace:"eip155",label:"BNB Smart Chain",fullName:"BNB Smart Chain Mainnet",logo:Gf,currency:{name:"BNB",symbol:"BNB",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"},wrapped:{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"},stables:{usd:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955","0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"]},explorer:"https://bscscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://bscscan.com/tx/${t.id||t}`:e?`https://bscscan.com/token/${e}`:n?`https://bscscan.com/address/${n}`:void 0,endpoints:["https://bsc-dataseed.binance.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed3.defibit.io"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"BNB",name:"Binance Coin",decimals:18,logo:Gf,type:"NATIVE"},{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",symbol:"WBNB",name:"Wrapped BNB",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png",type:"20"},{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:"BUSD",name:"BUSD Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56/logo.png",type:"20"},{address:"0x55d398326f99059fF775485246999027B3197955",symbol:"USDT",name:"Tether USD",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",type:"20"},{address:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",symbol:"USDC",name:"USD Coin",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d/logo.png",type:"20"},{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:"ETH",name:"Ethereum Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2170Ed0880ac9A755fd29B2688956BD959F933F8/logo.png",type:"20"},{address:"0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",symbol:"Cake",name:"PancakeSwap Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82/logo.png",type:"20"},{address:"0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",symbol:"BTCB",name:"BTCB Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://integrate.depay.com/tokens/bsc/0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb/image",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Jf="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiCgkgaW1hZ2UtcmVuZGVyaW5nPSJvcHRpbWl6ZVF1YWxpdHkiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiB0ZXh0LXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIgoJIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjgzLjUgMjgzLjUiCgkgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjgzLjUgMjgzLjU7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGc+Cgk8Zz4KCQk8cGF0aCBmaWxsPSIjMzQzNDM0IiBkPSJNMTQxLjcsMjUuOWwtMS41LDUuMnYxNTMuM2wxLjUsMS41bDcxLjItNDIuMUwxNDEuNywyNS45eiIvPgoJCTxwYXRoIGZpbGw9IiM4QzhDOEMiIGQ9Ik0xNDEuNywyNS45TDcwLjYsMTQzLjhsNzEuMSw0Mi4xdi03NC40VjI1Ljl6Ii8+CgkJPHBhdGggZmlsbD0iIzNDM0MzQiIgZD0iTTE0MS43LDE5OS40bC0wLjgsMS4xdjU0LjZsMC44LDIuNWw3MS4yLTEwMC4zTDE0MS43LDE5OS40eiIvPgoJCTxwYXRoIGZpbGw9IiM4QzhDOEMiIGQ9Ik0xNDEuNywyNTcuNnYtNTguMmwtNzEuMS00Mi4xTDE0MS43LDI1Ny42eiIvPgoJCTxwYXRoIGZpbGw9IiMxNDE0MTQiIGQ9Ik0xNDEuNywxODUuOWw3MS4yLTQyLjFsLTcxLjItMzIuM1YxODUuOXoiLz4KCQk8cGF0aCBmaWxsPSIjMzkzOTM5IiBkPSJNNzAuNiwxNDMuOGw3MS4xLDQyLjF2LTc0LjRMNzAuNiwxNDMuOHoiLz4KCTwvZz4KPC9nPgo8L3N2Zz4K";var Xf={name:"ethereum",id:"0x1",networkId:"1",namespace:"eip155",label:"Ethereum",fullName:"Ethereum Mainnet",logo:Jf,currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"},wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"},stables:{usd:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0x6B175474E89094C44Da98b954EedeAC495271d0F"]},explorer:"https://etherscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://etherscan.io/tx/${t.id||t}`:e?`https://etherscan.io/token/${e}`:n?`https://etherscan.io/address/${n}`:void 0,endpoints:["https://rpc.ankr.com/eth","https://eth.llamarpc.com","https://ethereum.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:Jf,type:"NATIVE"},{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",type:"20"},{address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xdAC17F958D2ee523a2206206994597C13D831ec7",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x6B175474E89094C44Da98b954EedeAC495271d0F",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x853d955aCEf822Db058eb8505911ED77F175b99e",symbol:"FRAX",name:"Frax",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x853d955aCEf822Db058eb8505911ED77F175b99e/logo.png",type:"20"},{address:"0x8E870D67F660D95d5be530380D0eC0bd388289E1",symbol:"USDP",name:"Pax Dollar",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x8E870D67F660D95d5be530380D0eC0bd388289E1/logo.png",type:"20"},{address:"0x956F47F50A910163D8BF957Cf5846D573E7f87CA",symbol:"FEI",name:"Fei USD",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x956F47F50A910163D8BF957Cf5846D573E7f87CA/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://integrate.depay.com/tokens/ethereum/0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb/image",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Kf="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgMTkyIDE5MiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTkyIDE5MjsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8ZyBpZD0iY2lyY2xlIj4KCTxnIGlkPSJGYW50b20tY2lyY2xlIj4KCQk8Y2lyY2xlIGlkPSJPdmFsIiBmaWxsUnVsZT0iZXZlbm9kZCIgY2xpcFJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiMxOTY5RkYiIGNsYXNzPSJzdDAiIGN4PSI5NiIgY3k9Ijk2IiByPSI4MC40Ii8+CgkJPHBhdGggaWQ9IlNoYXBlIiBmaWxsPSIjRkZGRkZGIiBkPSJNOTEuMSw0MS4yYzIuNy0xLjQsNi44LTEuNCw5LjUsMGwyNy42LDE0LjZjMS42LDAuOSwyLjUsMi4xLDIuNywzLjVoMHY3My4zCgkJCWMwLDEuNC0wLjksMi45LTIuNywzLjhsLTI3LjYsMTQuNmMtMi43LDEuNC02LjgsMS40LTkuNSwwbC0yNy42LTE0LjZjLTEuOC0wLjktMi42LTIuNC0yLjctMy44YzAtMC4xLDAtMC4zLDAtMC40bDAtNzIuNAoJCQljMC0wLjEsMC0wLjIsMC0wLjNsMC0wLjJoMGMwLjEtMS4zLDEtMi42LDIuNi0zLjVMOTEuMSw0MS4yeiBNMTI2LjYsOTkuOWwtMjYsMTMuN2MtMi43LDEuNC02LjgsMS40LTkuNSwwTDY1LjIsMTAwdjMyLjMKCQkJbDI1LjksMTMuNmMxLjUsMC44LDMuMSwxLjYsNC43LDEuN2wwLjEsMGMxLjUsMCwzLTAuOCw0LjYtMS41bDI2LjItMTMuOVY5OS45eiBNNTYuNSwxMzAuOWMwLDIuOCwwLjMsNC43LDEsNgoJCQljMC41LDEuMSwxLjMsMS45LDIuOCwyLjlsMC4xLDAuMWMwLjMsMC4yLDAuNywwLjQsMS4xLDAuN2wwLjUsMC4zbDEuNiwwLjlsLTIuMiwzLjdsLTEuNy0xLjFsLTAuMy0wLjJjLTAuNS0wLjMtMC45LTAuNi0xLjMtMC44CgkJCWMtNC4yLTIuOC01LjctNS45LTUuNy0xMi4zbDAtMC4ySDU2LjV6IE05My44LDgwLjVjLTAuMiwwLjEtMC40LDAuMS0wLjYsMC4yTDY1LjYsOTUuM2MwLDAtMC4xLDAtMC4xLDBsMCwwbDAsMGwwLjEsMGwyNy42LDE0LjYKCQkJYzAuMiwwLjEsMC40LDAuMiwwLjYsMC4yVjgwLjV6IE05OC4yLDgwLjV2MjkuOGMwLjItMC4xLDAuNC0wLjEsMC42LTAuMmwyNy42LTE0LjZjMCwwLDAuMSwwLDAuMSwwbDAsMGwwLDBsLTAuMSwwTDk4LjgsODAuNwoJCQlDOTguNiw4MC42LDk4LjQsODAuNSw5OC4yLDgwLjV6IE0xMjYuNiw2NC40bC0yNC44LDEzbDI0LjgsMTNWNjQuNHogTTY1LjIsNjQuNHYyNi4xbDI0LjgtMTNMNjUuMiw2NC40eiBNOTguNyw0NS4xCgkJCWMtMS40LTAuOC00LTAuOC01LjUsMEw2NS42LDU5LjdjMCwwLTAuMSwwLTAuMSwwbDAsMGwwLDBsMC4xLDBsMjcuNiwxNC42YzEuNCwwLjgsNCwwLjgsNS41LDBsMjcuNi0xNC42YzAsMCwwLjEsMCwwLjEsMGwwLDBsMCwwCgkJCWwtMC4xLDBMOTguNyw0NS4xeiBNMTMwLjcsNDYuNWwxLjcsMS4xbDAuMywwLjJjMC41LDAuMywwLjksMC42LDEuMywwLjhjNC4yLDIuOCw1LjcsNS45LDUuNywxMi4zbDAsMC4yaC00LjNjMC0yLjgtMC4zLTQuNy0xLTYKCQkJYy0wLjUtMS4xLTEuMy0xLjktMi44LTIuOWwtMC4xLTAuMWMtMC4zLTAuMi0wLjctMC40LTEuMS0wLjdsLTAuNS0wLjNsLTEuNi0wLjlMMTMwLjcsNDYuNXoiLz4KCTwvZz4KPC9nPgo8L3N2Zz4K";var $f={name:"fantom",id:"0xFA",networkId:"250",namespace:"eip155",label:"Fantom",fullName:"Fantom Opera",logo:Kf,currency:{name:"Fantom",symbol:"FTM",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"},wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83"},stables:{usd:["0x04068DA6C83AFCFA0e13ba15A6696662335D5B75","0x049d68029688eAbF473097a2fC38ef61633A3C7A","0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E"]},explorer:"https://ftmscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://ftmscan.com/tx/${t.id||t}`:e?`https://ftmscan.com/token/${e}`:n?`https://ftmscan.com/address/${n}`:void 0,endpoints:["https://rpc.ftm.tools","https://fantom.publicnode.com","https://rpc2.fantom.network"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"FTM",name:"Fantom",decimals:18,logo:Kf,type:"NATIVE"},{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",symbol:"WFTM",name:"Wrapped Fantom",decimals:18,logo:Kf,type:"20"},{address:"0x04068DA6C83AFCFA0e13ba15A6696662335D5B75",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"},{address:"0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://assets.spooky.fi/tokens/DAI.png",type:"20"},{address:"0x049d68029688eAbF473097a2fC38ef61633A3C7A",symbol:"fUSDT",name:"Frapped USDT",decimals:6,logo:"https://assets.spooky.fi/tokens/fUSDT.png",type:"20"},{address:"0x74b23882a30290451A17c44f4F05243b6b58C76d",symbol:"ETH",name:"Ethereum",decimals:18,logo:"https://assets.spooky.fi/tokens/wETH.png",type:"20"},{address:"0x321162Cd933E2Be498Cd2267a90534A804051b11",symbol:"BTC",name:"Bitcoin",decimals:8,logo:"https://assets.spooky.fi/tokens/wBTC.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const tp="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA0NS40IDQ1LjQiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ1LjQgNDUuNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8cGF0aCBmaWxsPSIjODI0N0U1IiBkPSJNMzEuOSwxNi42Yy0wLjctMC40LTEuNi0wLjQtMi4yLDBsLTUuMywzLjFsLTMuNSwybC01LjEsMy4xYy0wLjcsMC40LTEuNiwwLjQtMi4yLDBsLTQtMi40CgljLTAuNi0wLjQtMS4xLTEuMS0xLjEtMnYtNC42YzAtMC45LDAuNS0xLjYsMS4xLTJsNC0yLjNjMC43LTAuNCwxLjUtMC40LDIuMiwwbDQsMi40YzAuNywwLjQsMS4xLDEuMSwxLjEsMnYzLjFsMy41LTIuMXYtMy4yCgljMC0wLjktMC40LTEuNi0xLjEtMmwtNy41LTQuNGMtMC43LTAuNC0xLjUtMC40LTIuMiwwTDYsMTEuN2MtMC43LDAuNC0xLjEsMS4xLTEuMSwxLjh2OC43YzAsMC45LDAuNCwxLjYsMS4xLDJsNy42LDQuNAoJYzAuNywwLjQsMS41LDAuNCwyLjIsMGw1LjEtMi45bDMuNS0yLjFsNS4xLTIuOWMwLjctMC40LDEuNi0wLjQsMi4yLDBsNCwyLjNjMC43LDAuNCwxLjEsMS4xLDEuMSwydjQuNmMwLDAuOS0wLjQsMS42LTEuMSwyCglsLTMuOSwyLjNjLTAuNywwLjQtMS41LDAuNC0yLjIsMGwtNC0yLjNjLTAuNy0wLjQtMS4xLTEuMS0xLjEtMnYtMi45TDIxLDI4Ljd2My4xYzAsMC45LDAuNCwxLjYsMS4xLDJsNy41LDQuNAoJYzAuNywwLjQsMS41LDAuNCwyLjIsMGw3LjUtNC40YzAuNy0wLjQsMS4xLTEuMSwxLjEtMlYyM2MwLTAuOS0wLjQtMS42LTEuMS0yQzM5LjIsMjEsMzEuOSwxNi42LDMxLjksMTYuNnoiLz4KPC9zdmc+Cg==";var ep={name:"polygon",id:"0x89",networkId:"137",namespace:"eip155",label:"Polygon",fullName:"Polygon Mainnet",logo:tp,currency:{name:"Polygon",symbol:"MATIC",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"},wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"},stables:{usd:["0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174","0xc2132D05D31c914a87C6611C10748AEb04B58e8F","0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"]},explorer:"https://polygonscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://polygonscan.com/tx/${t.id||t}`:e?`https://polygonscan.com/token/${e}`:n?`https://polygonscan.com/address/${n}`:void 0,endpoints:["https://polygon-rpc.com","https://poly-rpc.gateway.pokt.network","https://polygon.llamarpc.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"MATIC",name:"Polygon",decimals:18,logo:tp,type:"NATIVE"},{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",symbol:"WMATIC",name:"Wrapped Matic",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0/logo.png",type:"20"},{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",type:"20"},{address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0xa3Fa99A148fA48D14Ed51d610c367C61876997F1",symbol:"miMATIC",name:"miMATIC",decimals:18,logo:"https://raw.githubusercontent.com/0xlaozi/qidao/main/images/mimatic-red.png",type:"20"},{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const np="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA0NS40IDQ1LjQiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ1LjQgNDUuNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8bGluZWFyR3JhZGllbnQgaWQ9IlNPTEFOQV9TVkdJRF8xIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjM1LjU5NzQiIHkxPSI3NzIuOTI3NyIgeDI9IjE4LjE0MjIiIHkyPSI4MDYuMzYxNiIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgLTc2NS43NjUpIj4KCTxzdG9wICBvZmZzZXQ9IjAiIHN0eWxlPSJzdG9wLWNvbG9yOiMwMEZGQTMiLz4KCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNEQzFGRkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPHBhdGggZmlsbD0idXJsKCNTT0xBTkFfU1ZHSURfMSkiIGQ9Ik0xMiwyOS4xYzAuMi0wLjIsMC41LTAuMywwLjctMC4zSDM4YzAuNSwwLDAuNywwLjYsMC40LDAuOWwtNSw1Yy0wLjIsMC4yLTAuNSwwLjMtMC43LDAuM0g3LjQKCUM2LjksMzUsNi43LDM0LjQsNywzNEwxMiwyOS4xeiIvPgo8bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzAwMDAwMTYwODY5NzIyMjI5NDY0Mzk5NzMwMDAwMDA5NDA3MDIxNTc4MjQ4MDg3NzExXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIyNy45NTk1IiB5MT0iNzY5LjEyNDQiIHgyPSIxMC41MDQzIiB5Mj0iODAyLjU1ODIiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIC03NjUuNzY1KSI+Cgk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojMDBGRkEzIi8+Cgk8c3RvcCAgb2Zmc2V0PSIxIiBzdHlsZT0ic3RvcC1jb2xvcjojREMxRkZGIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxwYXRoIHN0eWxlPSJmaWxsOnVybCgjU1ZHSURfMDAwMDAxNjA4Njk3MjIyMjk0NjQzOTk3MzAwMDAwMDk0MDcwMjE1NzgyNDgwODc3MTFfKTsiIGQ9Ik0xMiwxMC42YzAuMi0wLjIsMC41LTAuMywwLjctMC4zSDM4CgljMC41LDAsMC43LDAuNiwwLjQsMC45bC01LDVjLTAuMiwwLjItMC41LDAuMy0wLjcsMC4zSDcuNGMtMC41LDAtMC43LTAuNi0wLjQtMC45TDEyLDEwLjZ6Ii8+CjxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfMDAwMDAxMzkyODMyMTczNzg2NTYwOTQ4NjAwMDAwMDM2OTQ4OTUzNzkwNzgxMTY3ODJfIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjMxLjc0MDYiIHkxPSI3NzEuMDk4NSIgeDI9IjE0LjI4NTUiIHkyPSI4MDQuNTMyMyIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgLTc2NS43NjUpIj4KCTxzdG9wICBvZmZzZXQ9IjAiIHN0eWxlPSJzdG9wLWNvbG9yOiMwMEZGQTMiLz4KCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNEQzFGRkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPHBhdGggc3R5bGU9ImZpbGw6dXJsKCNTVkdJRF8wMDAwMDEzOTI4MzIxNzM3ODY1NjA5NDg2MDAwMDAwMzY5NDg5NTM3OTA3ODExNjc4Ml8pOyIgZD0iTTMzLjQsMTkuOGMtMC4yLTAuMi0wLjUtMC4zLTAuNy0wLjNINy40CgljLTAuNSwwLTAuNywwLjYtMC40LDAuOWw1LDVjMC4yLDAuMiwwLjUsMC4zLDAuNywwLjNIMzhjMC41LDAsMC43LTAuNiwwLjQtMC45TDMzLjQsMTkuOHoiLz4KPC9zdmc+Cg==";var rp={name:"solana",networkId:"mainnetBeta",namespace:"solana",label:"Solana",fullName:"Solana",logo:np,currency:{name:"Solana",symbol:"SOL",decimals:9,address:"11111111111111111111111111111111"},wrapped:{address:"So11111111111111111111111111111111111111112"},stables:{usd:["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]},explorer:"https://solscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://solscan.io/tx/${t.id||t}`:e?`https://solscan.io/token/${e}`:n?`https://solscan.io/address/${n}`:void 0,endpoints:["https://solana-mainnet.phantom.app/YBPpkkN4g91xDiAnTE9r0RcMkjg0sKUIWvAfoFVJ","https://mainnet-beta.solflare.network","https://solana-mainnet.rpc.extrnode.com"],rpc:"https://api.mainnet-beta.solana.com",tokens:[{address:"11111111111111111111111111111111",symbol:"SOL",name:"Solana",decimals:9,logo:np,type:"NATIVE"},{address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://img.raydium.io/icon/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png",type:"SPL"},{address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",symbol:"USDT",name:"USDT",decimals:6,logo:"https://img.raydium.io/icon/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB.png",type:"SPL"},{address:"7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj",symbol:"stSOL",name:"Lido Staked SOL",decimals:9,logo:"https://img.raydium.io/icon/7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj.png",type:"SPL"},{address:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",symbol:"BONK",name:"BONK",decimals:5,logo:"https://img.raydium.io/icon/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263.png",type:"SPL"},{address:"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",symbol:"SAMO",name:"Samoyed Coin",decimals:9,logo:"https://img.raydium.io/icon/7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU.png",type:"SPL"}],zero:"0",maxInt:"340282366920938463463374607431768211455"};const ip="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiCgkgdGV4dC1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iIGltYWdlLXJlbmRlcmluZz0ib3B0aW1pemVRdWFsaXR5IgoJIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDUuNCA0NS40IgoJIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ1LjQgNDUuNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgo8L3N0eWxlPgo8cGF0aCBmaWxsPSIjMDAzN0MxIiBkPSJNMjguOCwyMi44bC02LjEsMTAuNmwtNi4xLTEwLjdMMjguOCwyMi44TDI4LjgsMjIuOHogTTM0LjksMTkuMkgxMC41bDEyLjIsMjEuNEwzNC45LDE5LjJ6IE02LjUsMTIuMWwyLDMuNgoJaDI4LjNsMi4xLTMuNkg2LjV6Ii8+Cjwvc3ZnPgo=";var op={name:"velas",id:"0x6a",networkId:"106",namespace:"eip155",label:"VELAS",fullName:"Velas EVM Mainnet",logo:ip,currency:{name:"Velas",symbol:"VLX",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"},wrapped:{address:"0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126"},stables:{usd:["0xc111c29A988AE0C0087D97b33C6E6766808A3BD3","0x01445C31581c354b7338AC35693AB2001B50b9aE"]},explorer:"https://evmexplorer.velas.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://evmexplorer.velas.com/tx/${t.id||t}`:e?`https://evmexplorer.velas.com/token/${e}`:n?`https://evmexplorer.velas.com/address/${n}`:void 0,endpoints:["https://mainnet.velas.com/rpc","https://evmexplorer.velas.com/rpc","https://explorer.velas.com/rpc"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"VLX",name:"Velas",decimals:18,logo:ip,type:"NATIVE"},{address:"0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126",symbol:"WVLX",name:"Wrapped Velas",decimals:18,logo:"https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0xc579d1f3cf86749e05cd06f7ade17856c2ce3126/logo.png?raw=true",type:"20"},{address:"0xc111c29A988AE0C0087D97b33C6E6766808A3BD3",symbol:"BUSD",name:"Multichain BUSD",decimals:18,logo:"https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0xc111c29a988ae0c0087d97b33c6e6766808a3bd3/logo.png?raw=true",type:"20"},{address:"0x01445C31581c354b7338AC35693AB2001B50b9aE",symbol:"USDT",name:"Multichain USDT",decimals:6,logo:"https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0x01445c31581c354b7338ac35693ab2001b50b9ae/logo.png?raw=true",type:"20"},{address:"0x85219708c49aa701871Ad330A94EA0f41dFf24Ca",symbol:"ETH",name:"ETH",decimals:18,logo:"https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0x85219708c49aa701871ad330a94ea0f41dff24ca/logo.png?raw=true",type:"20"},{address:"0xaBf26902Fd7B624e0db40D31171eA9ddDf078351",symbol:"WAG",name:"WagyuSwap",decimals:18,logo:"https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0xabf26902fd7b624e0db40d31171ea9dddf078351/logo.png?raw=true",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const ap=[Xf,Zf,ep,rp,$f,op];for(var sp={ethereum:Xf,bsc:Zf,polygon:ep,solana:rp,fantom:$f,velas:op,all:ap,findById:function(t){let e=t;e.match("0x0")&&(e=e.replace(/0x0+/,"0x"));let n=ap.find((t=>t.id&&t.id.toLowerCase()==e.toLowerCase()));return n},findByNetworkId:function(t){t=t.toString();let e=ap.find((e=>e.networkId==t));return e},findByName:function(t){return ap.find((e=>e.name==t))}},up=function(t){var e=gp(t),n=e[0],r=e[1];return 3*(n+r)/4-r},cp=function(t){var e,n,r=gp(t),i=r[0],o=r[1],a=new fp(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),s=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)e=dp[t.charCodeAt(n)]<<18|dp[t.charCodeAt(n+1)]<<12|dp[t.charCodeAt(n+2)]<<6|dp[t.charCodeAt(n+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=255&e;2===o&&(e=dp[t.charCodeAt(n)]<<2|dp[t.charCodeAt(n+1)]>>4,a[s++]=255&e);1===o&&(e=dp[t.charCodeAt(n)]<<10|dp[t.charCodeAt(n+1)]<<4|dp[t.charCodeAt(n+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e);return a},lp=function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,a=0,s=n-r;a<s;a+=o)i.push(yp(t,a,a+o>s?s:a+o));1===r?(e=t[n-1],i.push(hp[e>>2]+hp[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(hp[e>>10]+hp[e>>4&63]+hp[e<<2&63]+"="));return i.join("")},hp=[],dp=[],fp="undefined"!=typeof Uint8Array?Uint8Array:Array,pp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mp=0;mp<64;++mp)hp[mp]=pp[mp],dp[pp.charCodeAt(mp)]=mp;function gp(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function yp(t,e,n){for(var r,i,o=[],a=e;a<n;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(hp[(i=r)>>18&63]+hp[i>>12&63]+hp[i>>6&63]+hp[63&i]);return o.join("")}dp["-".charCodeAt(0)]=62,dp["_".charCodeAt(0)]=63;var vp={byteLength:up,toByteArray:cp,fromByteArray:lp},wp=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},bp=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*m},Mp=o((function(t,e){const n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){+t!=t&&(t=0);return o.alloc(+t)},e.INSPECT_MAX_BYTES=50;const r=2147483647;function i(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|d(t,e);let r=i(n);const a=r.write(t,e);a!==n&&(r=r.slice(0,a));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(V(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(V(t,ArrayBuffer)||t&&V(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(V(t,SharedArrayBuffer)||t&&V(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,n);const a=function(t){if(o.isBuffer(t)){const e=0|h(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||q(t.length)?i(0):c(t);if("Buffer"===t.type&&Array.isArray(t.data))return c(t.data)}(t);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return s(t),i(t<0?0:0|h(t))}function c(t){const e=t.length<0?0:0|h(t.length),n=i(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function l(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,o.prototype),r}function h(t){if(t>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function d(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||V(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Y(t).length;default:if(i)return r?-1:F(t).length;e=(""+e).toLowerCase(),i=!0}}function f(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return E(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return k(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function p(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:g(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):g(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,n,r,i){let o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let r=-1;for(o=n;o<s;o++)if(c(t,o)===c(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===u)return r*a}else-1!==r&&(o-=o-r),r=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let r=0;r<u;r++)if(c(t,o+r)!==c(e,r)){n=!1;break}if(n)return o}return-1}function y(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(e.substr(2*a,2),16);if(q(r))return a;t[n+a]=r}return a}function v(t,e,n,r){return H(F(e,t.length-n),t,n,r)}function w(t,e,n,r){return H(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function b(t,e,n,r){return H(Y(e),t,n,r)}function M(t,e,n,r){return H(function(t,e){let n,r,i;const o=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function k(t,e,n){return 0===e&&n===t.length?vp.fromByteArray(t):vp.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,a=e>239?4:e>223?3:e>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],s=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(t){const e=t.length;if(e<=L)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=L));return n}(r)}e.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(t,e,n){return a(t,e,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(t,e,n){return function(t,e,n){return s(t),t<=0?i(t):void 0!==e?"string"==typeof n?i(t).fill(e,n):i(t).fill(e):i(t)}(t,e,n)},o.allocUnsafe=function(t){return u(t)},o.allocUnsafeSlow=function(t){return u(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if(V(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),V(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=o.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(V(e,Uint8Array))i+e.length>r.length?(o.isBuffer(e)||(e=o.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!o.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},o.byteLength=d,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)p(this,e,e+1);return this},o.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)p(this,e,e+3),p(this,e+1,e+2);return this},o.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)p(this,e,e+7),p(this,e+1,e+6),p(this,e+2,e+5),p(this,e+3,e+4);return this},o.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){let t="";const n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(t,e,n,r,i){if(V(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const u=Math.min(a,s),c=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<u;++t)if(c[t]!==l[t]){a=c[t],s=l[t];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},o.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},o.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},o.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return y(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return w(this,t,e,n);case"base64":return b(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const L=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function x(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function N(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=G[t[r]];return i}function S(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function I(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function T(t,e,n,r,i,a){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<a)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function C(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function j(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,4),bp(t,e,n,r,23,4),n+4}function _(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,8),bp(t,e,n,r,52,8),n+8}o.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readBigUInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||I(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){t>>>=0,e||I(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readBigInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),o.prototype.readBigInt64BE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),o.prototype.readFloatLE=function(t,e){return t>>>=0,e||I(t,4,this.length),wp(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||I(t,4,this.length),wp(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||I(t,8,this.length),wp(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||I(t,8,this.length),wp(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){T(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){T(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigUInt64LE=Z((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(t,e=0){return j(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);T(this,t,e,n,r-1,-r)}let i=0,o=1,a=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/o>>0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);T(this,t,e,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/o>>0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigInt64LE=Z((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(t,e=0){return j(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(t,e,n){return O(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return O(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return _(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return _(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},o.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const a=o.isBuffer(t)?t:o.from(t,r),s=a.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=a[i%s]}return this};const z={};function P(t,e,n){z[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function B(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function R(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new z.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){U(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function U(t,e){if("number"!=typeof t)throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw U(t,n),new z.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}P("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),P("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),P("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=B(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const Q=/[^+/0-9A-Za-z-_]/g;function F(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let a=0;a<r;++a){if(n=t.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Y(t){return vp.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function V(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}const G=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}})),kp=o((function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Mp.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype._move=function(t){c(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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];i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?m+r:h[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n++]=255&a,n<t.length&&(t[n++]=a>>8&255),n<t.length&&(t[n++]=a>>16&255),6===o?(n<t.length&&(t[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<t.length)for(t[n++]=r;n<t.length;)t[n++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var n=t.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n--]=255&a,n>=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,v=g>>>13,w=0|a[3],b=8191&w,M=w>>>13,k=0|a[4],A=8191&k,L=k>>>13,E=0|a[5],x=8191&E,N=E>>>13,S=0|a[6],I=8191&S,T=S>>>13,C=0|a[7],j=8191&C,D=C>>>13,O=0|a[8],_=8191&O,z=O>>>13,P=0|a[9],B=8191&P,R=P>>>13,U=0|s[0],W=8191&U,Q=U>>>13,F=0|s[1],Y=8191&F,H=F>>>13,V=0|s[2],q=8191&V,G=V>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,W))|0)+((8191&(i=(i=Math.imul(h,Q))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,Q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,W),i=(i=Math.imul(p,Q))+Math.imul(m,W)|0,o=Math.imul(m,Q);var yt=(c+(r=r+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,W),i=(i=Math.imul(y,Q))+Math.imul(v,W)|0,o=Math.imul(v,Q),r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,q)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(d,q)|0))<<13)|0;c=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,W),i=(i=Math.imul(b,Q))+Math.imul(M,W)|0,o=Math.imul(M,Q),r=r+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,G)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(A,W),i=(i=Math.imul(A,Q))+Math.imul(L,W)|0,o=Math.imul(L,Q),r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,G)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,W),i=(i=Math.imul(x,Q))+Math.imul(N,W)|0,o=Math.imul(N,Q),r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(b,q)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,G)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(I,W),i=(i=Math.imul(I,Q))+Math.imul(T,W)|0,o=Math.imul(T,Q),r=r+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(A,q)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,G)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Q))+Math.imul(D,W)|0,o=Math.imul(D,Q),r=r+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(x,q)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,G)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var At=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(_,W),i=(i=Math.imul(_,Q))+Math.imul(z,W)|0,o=Math.imul(z,Q),r=r+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,G)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Lt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,W),i=(i=Math.imul(B,Q))+Math.imul(R,W)|0,o=Math.imul(R,Q),r=r+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(z,Y)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,q)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,G)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,Y),i=(i=Math.imul(B,H))+Math.imul(R,Y)|0,o=Math.imul(R,H),r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(z,q)|0,o=o+Math.imul(z,G)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,q),i=(i=Math.imul(B,G))+Math.imul(R,q)|0,o=Math.imul(R,G),r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,X)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var Nt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,dt)|0;var St=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,dt)|0;var Tt=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var Ct=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,mt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=kt,u[7]=At,u[8]=Lt,u[9]=Et,u[10]=xt,u[11]=Nt,u[12]=St,u[13]=It,u[14]=Tt,u[15]=Ct,u[16]=jt,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function g(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(t,e,n){return g(t,e,n)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):n<63?p(this,t,e):n<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=t.words[r]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new L(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function L(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){L.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(M,w),r(k,w),r(A,w),A.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},L.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},L.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},L.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},L.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},L.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},L.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},L.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},L.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},L.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},L.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},L.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},L.prototype.isqr=function(t){return this.imul(t,t.clone())},L.prototype.sqr=function(t){return this.mul(t,t)},L.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},L.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},L.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},L.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},L.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,L),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));
7
+ t.exports=n=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var r={},i=Object.prototype,o=i.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof p?e:p,o=Object.create(i.prototype),a=new x(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return S()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=A(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),o}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var f={};function p(){}function m(){}function g(){}var y={};l(y,s,(function(){return this}));var v=Object.getPrototypeOf,w=v&&v(v(N([])));w&&w!==i&&o.call(w,s)&&(y=w);var b=g.prototype=p.prototype=Object.create(y);function M(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,n){function r(i,a,s,u){var c=d(t[i],t,a);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==e(h)&&o.call(h,"__await")?n.resolve(h.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):n.resolve(h).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;this._invoke=function(t,e){function o(){return new n((function(n,i){r(t,e,n,i)}))}return i=i?i.then(o,o):o()}}function A(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,A(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=d(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,f;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function N(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return r.next=r}}return{next:S}}function S(){return{value:void 0,done:!0}}return m.prototype=g,l(b,"constructor",g),l(g,"constructor",m),m.displayName=l(g,c,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,l(t,c,"GeneratorFunction")),t.prototype=Object.create(b),t},r.awrap=function(t){return{__await:t}},M(k.prototype),l(k.prototype,u,(function(){return this})),r.AsyncIterator=k,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var a=new k(h(t,e,n,i),o);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},M(b),l(b,c,"Generator"),l(b,s,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},r.values=N,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:N(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},r}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(Jo)),Jo.exports}var ta,ea={exports:{}};var na,ra={exports:{}};function ia(){return na||(na=1,function(t){t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},t.exports.__esModule=!0,t.exports.default=t.exports}(ra)),ra.exports}var oa,aa={exports:{}};function sa(){return oa||(oa=1,function(t){function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t},t.exports.__esModule=!0,t.exports.default=t.exports}(aa)),aa.exports}var ua,ca,la={exports:{}},ha={exports:{}};function da(){return ua||(ua=1,function(t){function e(n,r){return t.exports=e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},t.exports.__esModule=!0,t.exports.default=t.exports,e(n,r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(ha)),ha.exports}function fa(){return ca||(ca=1,function(t){var e=da();t.exports=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&e(t,n)},t.exports.__esModule=!0,t.exports.default=t.exports}(la)),la.exports}var pa,ma,ga={exports:{}},ya={exports:{}};function va(){return pa||(pa=1,function(t){t.exports=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t},t.exports.__esModule=!0,t.exports.default=t.exports}(ya)),ya.exports}function wa(){return ma||(ma=1,function(t){var e=Ko().default,n=va();t.exports=function(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(t)},t.exports.__esModule=!0,t.exports.default=t.exports}(ga)),ga.exports}var ba,Ma={exports:{}};function ka(){return ba||(ba=1,function(t){function e(n){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},t.exports.__esModule=!0,t.exports.default=t.exports,e(n)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports}(Ma)),Ma.exports}var Aa,La={exports:{}};function Ea(){return Aa||(Aa=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,a),u=n?n+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},s.prototype.emit=function(t,e,r,i,o,a){var s=n?n+t:t;if(!this._events[s])return!1;var u,c,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,a),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var d,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,i);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==e||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&a(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}(La)),La.exports}!function(t){var e=Ho.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=e(function(){if(Zo)return Go;Zo=1;var t=$o()();Go=t;try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":F(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}return Go}()),r=e((ta||(ta=1,function(t){function e(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}t.exports=function(t){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=t.apply(n,r);function s(t){e(a,i,o,s,u,"next",t)}function u(t){e(a,i,o,s,u,"throw",t)}s(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports}(ea)),ea.exports)),i=e(Ko()),o=e(ia()),a=e(sa()),s=e(fa()),u=e(wa()),c=e(ka()),l=Ea();function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,c.default)(t);if(e){var i=(0,c.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.default)(this,n)}}var d=function(t){(0,s.default)(f,t);var e,u,c,l,d=h(f);function f(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,f);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,h=void 0===l?1e3:l,p=r.max_reconnects,m=void 0===p?5:p,g=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(e=d.call(this)).webSocketFactory=t,e.queue={},e.rpc_id=0,e.address=n,e.autoconnect=s,e.ready=!1,e.reconnect=c,e.reconnect_timer_id=void 0,e.reconnect_interval=h,e.max_reconnects=m,e.rest_options=g,e.current_reconnects=0,e.generate_request_id=i||function(){return++e.rpc_id},e.autoconnect&&e._connect(e.address,Object.assign({autoconnect:e.autoconnect,reconnect:e.reconnect,reconnect_interval:e.reconnect_interval,max_reconnects:e.max_reconnects},e.rest_options)),e}return(0,a.default)(f,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(t,e,n,r){var o=this;return r||"object"!==(0,i.default)(n)||(r=n,n=null),new Promise((function(i,a){if(!o.ready)return a(new Error("socket not ready"));var s=o.generate_request_id(t,e),u={jsonrpc:"2.0",method:t,params:e||null,id:s};o.socket.send(JSON.stringify(u),r,(function(t){if(t)return a(t);o.queue[s]={promise:[i,a]},n&&(o.queue[s].timeout=setTimeout((function(){delete o.queue[s],a(new Error("reply timeout"))}),n))}))}))}},{key:"login",value:(l=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("rpc.login",e);case 2:if(r=t.sent){t.next=5;break}throw new Error("authentication failed");case 5:return t.abrupt("return",r);case 6:case"end":return t.stop()}}),t,this)}))),function(t){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function t(){return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.call("__listMethods");case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(t,e){var n=this;return new Promise((function(r,i){if(!n.ready)return i(new Error("socket not ready"));var o={jsonrpc:"2.0",method:t,params:e||null};n.socket.send(JSON.stringify(o),(function(t){if(t)return i(t);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.on",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed subscribing to an event '"+e+"' with: "+r[e]);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"unsubscribe",value:(e=(0,r.default)(n.default.mark((function t(e){var r;return n.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e&&(e=[e]),t.next=3,this.call("rpc.off",e);case 3:if(r=t.sent,"string"!=typeof e||"ok"===r[e]){t.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"close",value:function(t,e){this.socket.close(t||1e3,e)}},{key:"_connect",value:function(t,e){var n=this;clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,e),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(t){var e=t.data;e instanceof ArrayBuffer&&(e=Tt.from(e).toString());try{e=JSON.parse(e)}catch(t){return}if(e.notification&&n.listeners(e.notification).length){if(!Object.keys(e.params).length)return n.emit(e.notification);var r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(var i=0;i<e.params.length;i++)r.push(e.params[i]);return Promise.resolve().then((function(){n.emit.apply(n,r)}))}if(!n.queue[e.id])return e.method&&e.params?Promise.resolve().then((function(){n.emit(e.method,e.params)})):void 0;"error"in e=="result"in e&&n.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),n.queue[e.id].timeout&&clearTimeout(n.queue[e.id].timeout),e.error?n.queue[e.id].promise[1](e.error):n.queue[e.id].promise[0](e.result),delete n.queue[e.id]})),this.socket.addEventListener("error",(function(t){return n.emit("error",t)})),this.socket.addEventListener("close",(function(r){var i=r.code,o=r.reason;n.ready&&setTimeout((function(){return n.emit("close",i,o)}),0),n.ready=!1,n.socket=void 0,1e3!==i&&(n.current_reconnects++,n.reconnect&&(n.max_reconnects>n.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(t,e)}),n.reconnect_interval)))}))}}]),f}(l.EventEmitter);t.default=d}(Yo);var xa=B(Yo),Na={};!function(t){var e=Ho.exports;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t,e){return new u(t,e)};var n=e(ia()),r=e(sa()),i=e(fa()),o=e(wa()),a=e(ka());function s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=(0,a.default)(t);if(e){var i=(0,a.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,o.default)(this,n)}}var u=function(t){(0,i.default)(o,t);var e=s(o);function o(t,r,i){var a;return(0,n.default)(this,o),(a=e.call(this)).socket=new window.WebSocket(t,i),a.socket.onopen=function(){return a.emit("open")},a.socket.onmessage=function(t){return a.emit("message",t.data)},a.socket.onerror=function(t){return a.emit("error",t)},a.socket.onclose=function(t){a.emit("close",t.code,t.reason)},a}return(0,r.default)(o,[{key:"send",value:function(t,e,n){var r=n||e;try{this.socket.send(t),r()}catch(t){r(t)}}},{key:"close",value:function(t,e){this.socket.close(t,e)}},{key:"addEventListener",value:function(t,e,n){this.socket.addEventListener(t,e,n)}}]),o}(Ea().EventEmitter)}(Na);for(var Sa=B(Na),Ia=[],Ta=[],Ca=[],ja=BigInt(0),Da=BigInt(1),Oa=BigInt(2),_a=BigInt(7),za=BigInt(256),Pa=BigInt(113),Ba=0,Ra=Da,Ua=1,Wa=0;Ba<24;Ba++){var Qa=[Wa,(2*Ua+3*Wa)%5];Ua=Qa[0],Wa=Qa[1],Ia.push(2*(5*Wa+Ua)),Ta.push((Ba+1)*(Ba+2)/2%64);for(var Fa=ja,Ya=0;Ya<7;Ya++)(Ra=(Ra<<Da^(Ra>>_a)*Pa)%za)&Oa&&(Fa^=Da<<(Da<<BigInt(Ya))-Da);Ca.push(Fa)}var Ha=at(Te.split(Ca,!0),2),Va=Ha[0],qa=Ha[1],Ga=function(t,e,n){return n>32?Te.rotlBH(t,e,n):Te.rotlSH(t,e,n)},Za=function(t,e,n){return n>32?Te.rotlBL(t,e,n):Te.rotlSL(t,e,n)};var Ja=function(t){J(n,Ae);var e=it(n);function n(t,r,i){var o,a,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(V(this,n),(o=e.call(this)).blockLen=t,o.suffix=r,o.outputLen=i,o.enableXOF=s,o.rounds=u,o.pos=0,o.posOut=0,o.finished=!1,o.destroyed=!1,we.number(i),0>=o.blockLen||o.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");return o.state=new Uint8Array(200),o.state32=(a=o.state,new Uint32Array(a.buffer,a.byteOffset,Math.floor(a.byteLength/4))),o}return G(n,[{key:"keccak",value:function(){!function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,n=new Uint32Array(10),r=24-e;r<24;r++){for(var i=0;i<10;i++)n[i]=t[i]^t[i+10]^t[i+20]^t[i+30]^t[i+40];for(var o=0;o<10;o+=2)for(var a=(o+8)%10,s=(o+2)%10,u=n[s],c=n[s+1],l=Ga(u,c,1)^n[a],h=Za(u,c,1)^n[a+1],d=0;d<50;d+=10)t[o+d]^=l,t[o+d+1]^=h;for(var f=t[2],p=t[3],m=0;m<24;m++){var g=Ta[m],y=Ga(f,p,g),v=Za(f,p,g),w=Ia[m];f=t[w],p=t[w+1],t[w]=y,t[w+1]=v}for(var b=0;b<50;b+=10){for(var M=0;M<10;M++)n[M]=t[b+M];for(var k=0;k<10;k++)t[b+k]^=~n[(k+2)%10]&n[(k+4)%10]}t[0]^=Va[r],t[1]^=qa[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}},{key:"update",value:function(t){we.exists(this);for(var e=this.blockLen,n=this.state,r=(t=ke(t)).length,i=0;i<r;){for(var o=Math.min(e-this.pos,r-i),a=0;a<o;a++)n[this.pos++]^=t[i++];this.pos===e&&this.keccak()}return this}},{key:"finish",value:function(){if(!this.finished){this.finished=!0;var t=this.state,e=this.suffix,n=this.pos,r=this.blockLen;t[n]^=e,0!=(128&e)&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}}},{key:"writeInto",value:function(t){we.exists(this,!1),we.bytes(t),this.finish();for(var e=this.state,n=this.blockLen,r=0,i=t.length;r<i;){this.posOut>=n&&this.keccak();var o=Math.min(n-this.posOut,i-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}},{key:"xofInto",value:function(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}},{key:"xof",value:function(t){return we.number(t),this.xofInto(new Uint8Array(t))}},{key:"digestInto",value:function(t){if(we.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}},{key:"digest",value:function(){return this.digestInto(new Uint8Array(this.outputLen))}},{key:"destroy",value:function(){this.destroyed=!0,this.state.fill(0)}},{key:"_cloneInto",value:function(t){var e=this.blockLen,r=this.suffix,i=this.outputLen,o=this.rounds,a=this.enableXOF;return t||(t=new n(e,r,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}}]),n}(),Xa=function(t,e,n){return Le((function(){return new Ja(e,t,n)}))};Xa(6,144,28),Xa(6,136,32),Xa(6,104,48),Xa(6,72,64),Xa(1,144,28);var Ka=Xa(1,136,32);Xa(1,104,48),Xa(1,72,64);var $a=function(t,e,n){return r=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ja(e,t,void 0===r.dkLen?n:r.dkLen,!0)},i=function(t,e){return r(e).update(ke(t)).digest()},o=r({}),i.outputLen=o.outputLen,i.blockLen=o.blockLen,i.create=function(t){return r(t)},i;var r,i,o};$a(31,168,16),$a(31,136,32);var ts=function(t){J(n,Ae);var e=it(n);function n(t,r){var i;V(this,n),(i=e.call(this)).finished=!1,i.destroyed=!1,we.hash(t);var o=ke(r);if(i.iHash=t.create(),"function"!=typeof i.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");i.blockLen=i.iHash.blockLen,i.outputLen=i.iHash.outputLen;var a=i.blockLen,s=new Uint8Array(a);s.set(o.length>a?t.create().update(o).digest():o);for(var u=0;u<s.length;u++)s[u]^=54;i.iHash.update(s),i.oHash=t.create();for(var c=0;c<s.length;c++)s[c]^=106;return i.oHash.update(s),s.fill(0),i}return G(n,[{key:"update",value:function(t){return we.exists(this),this.iHash.update(t),this}},{key:"digestInto",value:function(t){we.exists(this),we.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}},{key:"digest",value:function(){var t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}},{key:"_cloneInto",value:function(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));var e=this.oHash,n=this.iHash,r=this.finished,i=this.destroyed,o=this.blockLen,a=this.outputLen;return t.finished=r,t.destroyed=i,t.blockLen=o,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}},{key:"destroy",value:function(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}]),n}(),es=function(t,e,n){return new ts(t,e).update(n).digest()};es.create=function(t,e){return new ts(t,e)};var ns=BigInt(0),rs=BigInt(1),is=BigInt(2),os=BigInt(3),as=BigInt(8),ss=Object.freeze({a:ns,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:rs,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),us=function(t,e){return(t+e/is)/e},cs=BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),ls=function(t){var e=ss.n,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-rs*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,a=BigInt("0x100000000000000000000000000000000"),s=us(o*t,e),u=us(-r*t,e),c=Us(t-s*n-u*i,e),l=Us(-s*r-u*o,e),h=c>a,d=l>a;if(h&&(c=e-c),d&&(l=e-l),c>a||l>a)throw new Error("splitScalarEndo: Endomorphism failed, k="+t);return{k1neg:h,k1:c,k2neg:d,k2:l}},hs=32,ds=32,fs=hs+1,ps=2*hs+1;function ms(t){var e=ss.a,n=ss.b,r=Us(t*t),i=Us(r*t);return Us(i+e*t+n)}var gs=ss.a===ns,ys=function(t){J(n,et(Error));var e=it(n);function n(t){return V(this,n),e.call(this,t)}return G(n)}();function vs(t){if(!(t instanceof ws))throw new TypeError("JacobianPoint expected")}var ws=function(){function t(e,n,r){V(this,t),this.x=e,this.y=n,this.z=r}return G(t,[{key:"equals",value:function(t){vs(t);var e=this.x,n=this.y,r=this.z,i=t.x,o=t.y,a=t.z,s=Us(r*r),u=Us(a*a),c=Us(e*u),l=Us(i*s),h=Us(Us(n*a)*u),d=Us(Us(o*r)*s);return c===l&&h===d}},{key:"negate",value:function(){return new t(this.x,Us(-this.y),this.z)}},{key:"double",value:function(){var e=this.x,n=this.y,r=this.z,i=Us(e*e),o=Us(n*n),a=Us(o*o),s=e+o,u=Us(is*(Us(s*s)-i-a)),c=Us(os*i),l=Us(c*c),h=Us(l-is*u);return new t(h,Us(c*(u-h)-as*a),Us(is*n*r))}},{key:"add",value:function(e){vs(e);var n=this.x,r=this.y,i=this.z,o=e.x,a=e.y,s=e.z;if(o===ns||a===ns)return this;if(n===ns||r===ns)return e;var u=Us(i*i),c=Us(s*s),l=Us(n*c),h=Us(o*u),d=Us(Us(r*s)*c),f=Us(Us(a*i)*u),p=Us(h-l),m=Us(f-d);if(p===ns)return m===ns?this.double():t.ZERO;var g=Us(p*p),y=Us(p*g),v=Us(l*g),w=Us(m*m-y-is*v);return new t(w,Us(m*(v-w)-d*y),Us(i*s*p))}},{key:"subtract",value:function(t){return this.add(t.negate())}},{key:"multiplyUnsafe",value:function(e){var n=t.ZERO;if("bigint"==typeof e&&e===ns)return n;var r=Rs(e);if(r===rs)return this;if(!gs){for(var i=n,o=this;r>ns;)r&rs&&(i=i.add(o)),o=o.double(),r>>=rs;return i}for(var a=ls(r),s=a.k1neg,u=a.k1,c=a.k2neg,l=a.k2,h=n,d=n,f=this;u>ns||l>ns;)u&rs&&(h=h.add(f)),l&rs&&(d=d.add(f)),f=f.double(),u>>=rs,l>>=rs;return s&&(h=h.negate()),c&&(d=d.negate()),d=new t(Us(d.x*cs),d.y,d.z),h.add(d)}},{key:"precomputeWindow",value:function(t){for(var e=gs?128/t+1:256/t+1,n=[],r=this,i=r,o=0;o<e;o++){i=r,n.push(i);for(var a=1;a<Math.pow(2,t-1);a++)i=i.add(r),n.push(i);r=i.double()}return n}},{key:"wNAF",value:function(e,n){!n&&this.equals(t.BASE)&&(n=ks.BASE);var r=n&&n._WINDOW_SIZE||1;if(256%r)throw new Error("Point#wNAF: Invalid precomputation window, must be power of 2");var i=n&&Ms.get(n);i||(i=this.precomputeWindow(r),n&&1!==r&&(i=t.normalizeZ(i),Ms.set(n,i)));for(var o=t.ZERO,a=t.BASE,s=1+(gs?128/r:256/r),u=Math.pow(2,r-1),c=BigInt(Math.pow(2,r)-1),l=Math.pow(2,r),h=BigInt(r),d=0;d<s;d++){var f=d*u,p=Number(e&c);e>>=h,p>u&&(p-=l,e+=rs);var m=f,g=f+Math.abs(p)-1,y=d%2!=0,v=p<0;0===p?a=a.add(bs(y,i[m])):o=o.add(bs(v,i[g]))}return{p:o,f:a}}},{key:"multiply",value:function(e,n){var r,i,o=Rs(e);if(gs){var a=ls(o),s=a.k1neg,u=a.k1,c=a.k2neg,l=a.k2,h=this.wNAF(u,n),d=h.p,f=h.f,p=this.wNAF(l,n),m=p.p,g=p.f;d=bs(s,d),m=new t(Us((m=bs(c,m)).x*cs),m.y,m.z),r=d.add(m),i=f.add(g)}else{var y=this.wNAF(o,n);r=y.p,i=y.f}return t.normalizeZ([r,i])[0]}},{key:"toAffine",value:function(e){var n=this.x,r=this.y,i=this.z,o=this.equals(t.ZERO);null==e&&(e=o?as:Qs(i));var a=e,s=Us(a*a),u=Us(s*a),c=Us(n*s),l=Us(r*u),h=Us(i*a);if(o)return ks.ZERO;if(h!==rs)throw new Error("invZ was invalid");return new ks(c,l)}}],[{key:"fromAffine",value:function(e){if(!(e instanceof ks))throw new TypeError("JacobianPoint#fromAffine: expected Point");return e.equals(ks.ZERO)?t.ZERO:new t(e.x,e.y,rs)}},{key:"toAffineBatch",value:function(t){var e=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ss.P,n=new Array(t.length),r=t.reduce((function(t,r,i){return r===ns?t:(n[i]=t,Us(t*r,e))}),rs),i=Qs(r,e);return t.reduceRight((function(t,r,i){return r===ns?t:(n[i]=Us(t*n[i],e),Us(t*r,e))}),i),n}(t.map((function(t){return t.z})));return t.map((function(t,n){return t.toAffine(e[n])}))}},{key:"normalizeZ",value:function(e){return t.toAffineBatch(e).map(t.fromAffine)}}]),t}();function bs(t,e){var n=e.negate();return t?n:e}ws.BASE=new ws(ss.Gx,ss.Gy,rs),ws.ZERO=new ws(ns,rs,ns);var Ms=new WeakMap,ks=function(){function t(e,n){V(this,t),this.x=e,this.y=n}return G(t,[{key:"_setWindowSize",value:function(t){this._WINDOW_SIZE=t,Ms.delete(this)}},{key:"hasEvenY",value:function(){return this.y%is===ns}},{key:"toRawBytes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return zs(this.toHex(t))}},{key:"toHex",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=js(this.x);if(t){var n=this.hasEvenY()?"02":"03";return"".concat(n).concat(e)}return"04".concat(e).concat(js(this.y))}},{key:"toHexX",value:function(){return this.toHex(!0).slice(2)}},{key:"toRawX",value:function(){return this.toRawBytes(!0).slice(1)}},{key:"assertValidity",value:function(){var t="Point is not on elliptic curve",e=this.x,n=this.y;if(!Vs(e)||!Vs(n))throw new Error(t);var r=Us(n*n);if(Us(r-ms(e))!==ns)throw new Error(t)}},{key:"equals",value:function(t){return this.x===t.x&&this.y===t.y}},{key:"negate",value:function(){return new t(this.x,Us(-this.y))}},{key:"double",value:function(){return ws.fromAffine(this).double().toAffine()}},{key:"add",value:function(t){return ws.fromAffine(this).add(ws.fromAffine(t)).toAffine()}},{key:"subtract",value:function(t){return this.add(t.negate())}},{key:"multiply",value:function(t){return ws.fromAffine(this).multiply(t,this).toAffine()}},{key:"multiplyAndAddUnsafe",value:function(e,n,r){var i=ws.fromAffine(this),o=n===ns||n===rs||this!==t.BASE?i.multiplyUnsafe(n):i.multiply(n),a=ws.fromAffine(e).multiplyUnsafe(r),s=o.add(a);return s.equals(ws.ZERO)?void 0:s.toAffine()}}],[{key:"fromCompressedHex",value:function(e){var n=32===e.length,r=Ps(n?e:e.subarray(1));if(!Vs(r))throw new Error("Point is not on curve");var i=function(t){var e=ss.P,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),s=BigInt(88),u=t*t*t%e,c=u*u*t%e,l=Ws(c,os)*c%e,h=Ws(l,os)*c%e,d=Ws(h,is)*u%e,f=Ws(d,r)*d%e,p=Ws(f,i)*f%e,m=Ws(p,a)*p%e,g=Ws(m,s)*m%e,y=Ws(g,a)*p%e,v=Ws(y,os)*c%e,w=Ws(v,o)*f%e,b=Ws(w,n)*u%e,M=Ws(b,is),k=M*M%e;if(k!==t)throw new Error("Cannot find square root");return M}(ms(r)),o=(i&rs)===rs;n?o&&(i=Us(-i)):1==(1&e[0])!==o&&(i=Us(-i));var a=new t(r,i);return a.assertValidity(),a}},{key:"fromUncompressedHex",value:function(e){var n=new t(Ps(e.subarray(1,hs+1)),Ps(e.subarray(hs+1,2*hs+1)));return n.assertValidity(),n}},{key:"fromHex",value:function(t){var e=Bs(t),n=e.length,r=e[0];if(n===hs)return this.fromCompressedHex(e);if(n===fs&&(2===r||3===r))return this.fromCompressedHex(e);if(n===ps&&4===r)return this.fromUncompressedHex(e);throw new Error("Point.fromHex: received invalid point. Expected 32-".concat(fs," compressed bytes or ").concat(ps," uncompressed bytes, not ").concat(n))}},{key:"fromPrivateKey",value:function(e){return t.BASE.multiply(Gs(e))}},{key:"fromSignature",value:function(e,n,r){var i=function(t){if(t instanceof Es)return t.assertValidity(),t;try{return Es.fromDER(t)}catch(e){return Es.fromCompact(t)}}(n),o=i.r,a=i.s;if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");var s=Fs(Bs(e)),u=ss.n,c=2===r||3===r?o+u:o,l=Qs(c,u),h=Us(-s*l,u),d=Us(a*l,u),f=1&r?"03":"02",p=t.fromHex(f+js(c)),m=t.BASE.multiplyAndAddUnsafe(p,h,d);if(!m)throw new Error("Cannot recover signature: point at infinify");return m.assertValidity(),m}}]),t}();function As(t){return Number.parseInt(t[0],16)>=8?"00"+t:t}function Ls(t){if(t.length<2||2!==t[0])throw new Error("Invalid signature integer tag: ".concat(Ss(t)));var e=t[1],n=t.subarray(2,e+2);if(!e||n.length!==e)throw new Error("Invalid signature integer: wrong length");if(0===n[0]&&n[1]<=127)throw new Error("Invalid signature integer: trailing length");return{data:Ps(n),left:t.subarray(e+2)}}ks.BASE=new ks(ss.Gx,ss.Gy),ks.ZERO=new ks(ns,ns);var Es=function(){function t(e,n){V(this,t),this.r=e,this.s=n,this.assertValidity()}return G(t,[{key:"assertValidity",value:function(){var t=this.r,e=this.s;if(!Hs(t))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Hs(e))throw new Error("Invalid Signature: s must be 0 < s < n")}},{key:"hasHighS",value:function(){var t=ss.n>>rs;return this.s>t}},{key:"normalizeS",value:function(){return this.hasHighS()?new t(this.r,Us(-this.s,ss.n)):this}},{key:"toDERRawBytes",value:function(){return zs(this.toDERHex())}},{key:"toDERHex",value:function(){var t=As(Os(this.s)),e=As(Os(this.r)),n=t.length/2,r=e.length/2,i=Os(n),o=Os(r),a=Os(r+n+4);return"30".concat(a,"02").concat(o).concat(e,"02").concat(i).concat(t)}},{key:"toRawBytes",value:function(){return this.toDERRawBytes()}},{key:"toHex",value:function(){return this.toDERHex()}},{key:"toCompactRawBytes",value:function(){return zs(this.toCompactHex())}},{key:"toCompactHex",value:function(){return js(this.r)+js(this.s)}}],[{key:"fromCompact",value:function(e){var n=e instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof e&&!n)throw new TypeError("".concat(r,": Expected string or Uint8Array"));var i=n?Ss(e):e;if(128!==i.length)throw new Error("".concat(r,": Expected 64-byte hex"));return new t(_s(i.slice(0,64)),_s(i.slice(64,128)))}},{key:"fromDER",value:function(e){var n=e instanceof Uint8Array;if("string"!=typeof e&&!n)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");var r=function(t){if(t.length<2||48!=t[0])throw new Error("Invalid signature tag: ".concat(Ss(t)));if(t[1]!==t.length-2)throw new Error("Invalid signature: incorrect length");var e=Ls(t.subarray(2)),n=e.data,r=Ls(e.left),i=r.data,o=r.left;if(o.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(Ss(o)));return{r:n,s:i}}(n?e:zs(e));return new t(r.r,r.s)}},{key:"fromHex",value:function(t){return this.fromDER(t)}}]),t}();function xs(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(!e.every((function(t){return t instanceof Uint8Array})))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];for(var r=e.reduce((function(t,e){return t+e.length}),0),i=new Uint8Array(r),o=0,a=0;o<e.length;o++){var s=e[o];i.set(s,a),a+=s.length}return i}var Ns=Array.from({length:256},(function(t,e){return e.toString(16).padStart(2,"0")}));function Ss(t){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");for(var e="",n=0;n<t.length;n++)e+=Ns[t[n]];return e}var Is,Ts,Cs=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function js(t){if("bigint"!=typeof t)throw new Error("Expected bigint");if(!(ns<=t&&t<Cs))throw new Error("Expected number 0 <= n < 2^256");return t.toString(16).padStart(64,"0")}function Ds(t){var e=zs(js(t));if(32!==e.length)throw new Error("Error: expected 32 bytes");return e}function Os(t){var e=t.toString(16);return 1&e.length?"0".concat(e):e}function _s(t){if("string"!=typeof t)throw new TypeError("hexToNumber: expected string, got "+F(t));return BigInt("0x".concat(t))}function zs(t){if("string"!=typeof t)throw new TypeError("hexToBytes: expected string, got "+F(t));if(t.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+t.length);for(var e=new Uint8Array(t.length/2),n=0;n<e.length;n++){var r=2*n,i=t.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");e[n]=o}return e}function Ps(t){return _s(Ss(t))}function Bs(t){return t instanceof Uint8Array?Uint8Array.from(t):zs(t)}function Rs(t){if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)return BigInt(t);if("bigint"==typeof t&&Hs(t))return t;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function Us(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ss.P,n=t%e;return n>=ns?n:e+n}function Ws(t,e){for(var n=ss.P,r=t;e-- >ns;)r*=r,r%=n;return r}function Qs(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ss.P;if(t===ns||e<=ns)throw new Error("invert: expected positive integers, got n=".concat(t," mod=").concat(e));for(var n=Us(t,e),r=e,i=ns,o=rs;n!==ns;){var a=r%n,s=i-o*(r/n);r=n,n=a,i=o,o=s}if(r!==rs)throw new Error("invert: does not exist");return Us(i,e)}function Fs(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=function(t){var e=8*t.length-8*ds,n=Ps(t);return e>0?n>>BigInt(e):n}(t);if(e)return n;var r=ss.n;return n>=r?n-r:n}var Ys=function(){function t(e,n){if(V(this,t),this.hashLen=e,this.qByteLen=n,"number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof n||n<2)throw new Error("qByteLen must be a number");this.v=new Uint8Array(e).fill(1),this.k=new Uint8Array(e).fill(0),this.counter=0}var e,n;return G(t,[{key:"hmac",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return ru.hmacSha256.apply(ru,[this.k].concat(e))}},{key:"hmacSync",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Ts.apply(void 0,[this.k].concat(e))}},{key:"checkSync",value:function(){if("function"!=typeof Ts)throw new ys("hmacSha256Sync needs to be set")}},{key:"incr",value:function(){if(this.counter>=1e3)throw new Error("Tried 1,000 k values for sign(), all were invalid");this.counter+=1}},{key:"reseed",value:(n=H(Q().mark((function t(){var e,n=arguments;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=n.length>0&&void 0!==n[0]?n[0]:new Uint8Array,t.next=3,this.hmac(this.v,Uint8Array.from([0]),e);case 3:return this.k=t.sent,t.next=6,this.hmac(this.v);case 6:if(this.v=t.sent,0!==e.length){t.next=9;break}return t.abrupt("return");case 9:return t.next=11,this.hmac(this.v,Uint8Array.from([1]),e);case 11:return this.k=t.sent,t.next=14,this.hmac(this.v);case 14:this.v=t.sent;case 15:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"reseedSync",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),t),this.v=this.hmacSync(this.v),0!==t.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),t),this.v=this.hmacSync(this.v))}},{key:"generate",value:(e=H(Q().mark((function t(){var e,n,r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.incr(),e=0,n=[];case 3:if(!(e<this.qByteLen)){t.next=12;break}return t.next=6,this.hmac(this.v);case 6:this.v=t.sent,r=this.v.slice(),n.push(r),e+=this.v.length,t.next=3;break;case 12:return t.abrupt("return",xs.apply(void 0,n));case 13:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"generateSync",value:function(){this.checkSync(),this.incr();for(var t=0,e=[];t<this.qByteLen;){this.v=this.hmacSync(this.v);var n=this.v.slice();e.push(n),t+=this.v.length}return xs.apply(void 0,e)}}]),t}();function Hs(t){return ns<t&&t<ss.n}function Vs(t){return ns<t&&t<ss.P}function qs(t,e,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=ss.n,o=Fs(t,!0);if(Hs(o)){var a=Qs(o,i),s=ks.BASE.multiply(o),u=Us(s.x,i);if(u!==ns){var c=Us(a*Us(e+n*u,i),i);if(c!==ns){var l=new Es(u,c),h=(s.x===l.r?0:2)|Number(s.y&rs);return r&&l.hasHighS()&&(l=l.normalizeS(),h^=1),{sig:l,recovery:h}}}}}function Gs(t){var e;if("bigint"==typeof t)e=t;else if("number"==typeof t&&Number.isSafeInteger(t)&&t>0)e=BigInt(t);else if("string"==typeof t){if(t.length!==2*ds)throw new Error("Expected 32 bytes of private key");e=_s(t)}else{if(!(t instanceof Uint8Array))throw new TypeError("Expected valid private key");if(t.length!==ds)throw new Error("Expected 32 bytes of private key");e=Ps(t)}if(!Hs(e))throw new Error("Expected private key: 0 < key < n");return e}function Zs(t){return Ps(t.length>hs?t.slice(0,hs):t)}function Js(t){var e=Zs(t),n=Us(e,ss.n);return Xs(n<ns?e:n)}function Xs(t){return Ds(t)}function Ks(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=function(t,e,n){if(null==t)throw new Error('sign: expected valid message hash, not "'.concat(t,'"'));var r=Bs(t),i=Gs(e),o=[Xs(i),Js(r)];if(null!=n){!0===n&&(n=ru.randomBytes(hs));var a=Bs(n);if(a.length!==hs)throw new Error("sign: Expected ".concat(hs," bytes of extra data"));o.push(a)}return{seed:xs.apply(void 0,o),m:Zs(r),d:i}}(t,e,r.extraEntropy),o=i.seed,a=i.m,s=i.d,u=new Ys(32,ds);for(u.reseedSync(o);!(n=qs(u.generateSync(),a,s,r.canonical));)u.reseedSync();return function(t,e){var n=t.sig,r=t.recovery,i=Object.assign({canonical:!0,der:!0},e),o=i.der,a=i.recovered,s=o?n.toDERRawBytes():n.toCompactRawBytes();return a?[s,r]:s}(n,r)}ks.BASE._setWindowSize(8);var $s,tu,eu={node:Qe,web:"object"===("undefined"==typeof self?"undefined":F(self))&&"crypto"in self?self.crypto:void 0},nu={},ru={bytesToHex:Ss,hexToBytes:zs,concatBytes:xs,mod:Us,invert:Qs,isValidPrivateKey:function(t){try{return Gs(t),!0}catch(t){return!1}},_bigintTo32Bytes:Ds,_normalizePrivateKey:Gs,hashToPrivateKey:function(t){t=Bs(t);var e=ds+8;if(t.length<e||t.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return Ds(Us(Ps(t),ss.n-rs)+rs)},randomBytes:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(eu.web)return eu.web.getRandomValues(new Uint8Array(t));if(eu.node){var e=eu.node.randomBytes;return Uint8Array.from(e(t))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:function(){return ru.hashToPrivateKey(ru.randomBytes(ds+8))},precompute:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ks.BASE,n=e===ks.BASE?e:new ks(e.x,e.y);return n._setWindowSize(t),n.multiply(os),n},sha256:function(){var t=H(Q().mark((function t(){var e,n,r,i,o,a,s=arguments;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e=s.length,n=new Array(e),r=0;r<e;r++)n[r]=s[r];if(!eu.web){t.next=8;break}return t.next=4,eu.web.subtle.digest("SHA-256",xs.apply(void 0,n));case 4:return i=t.sent,t.abrupt("return",new Uint8Array(i));case 8:if(!eu.node){t.next=15;break}return o=eu.node.createHash,a=o("sha256"),n.forEach((function(t){return a.update(t)})),t.abrupt("return",Uint8Array.from(a.digest()));case 15:throw new Error("The environment doesn't have sha256 function");case 16:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),hmacSha256:(tu=H(Q().mark((function t(e){var n,r,i,o,a,s,u,c,l=arguments;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=l.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=l[i];if(!eu.web){t.next=12;break}return t.next=4,eu.web.subtle.importKey("raw",e,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);case 4:return o=t.sent,a=xs.apply(void 0,r),t.next=8,eu.web.subtle.sign("HMAC",o,a);case 8:return s=t.sent,t.abrupt("return",new Uint8Array(s));case 12:if(!eu.node){t.next=19;break}return u=eu.node.createHmac,c=u("sha256",e),r.forEach((function(t){return c.update(t)})),t.abrupt("return",Uint8Array.from(c.digest()));case 19:throw new Error("The environment doesn't have hmac-sha256 function");case 20:case"end":return t.stop()}}),t)}))),function(t){return tu.apply(this,arguments)}),sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:($s=H(Q().mark((function t(e){var n,r,i,o,a,s=arguments;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(n=nu[e])){t.next=7;break}return t.next=4,ru.sha256(Uint8Array.from(e,(function(t){return t.charCodeAt(0)})));case 4:r=t.sent,n=xs(r,r),nu[e]=n;case 7:for(i=s.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=s[a];return t.abrupt("return",ru.sha256.apply(ru,[n].concat(o)));case 9:case"end":return t.stop()}}),t)}))),function(t){return $s.apply(this,arguments)}),taggedHashSync:function(t){if("function"!=typeof Is)throw new ys("sha256Sync is undefined, you need to set it");var e=nu[t];if(void 0===e){var n=Is(Uint8Array.from(t,(function(t){return t.charCodeAt(0)})));e=xs(n,n),nu[t]=e}for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return Is.apply(void 0,[e].concat(i))},_JacobianPoint:ws};Object.defineProperties(ru,{sha256Sync:{configurable:!1,get:function(){return Is},set:function(t){Is||(Is=t)}},hmacSha256Sync:{configurable:!1,get:function(){return Ts},set:function(t){Ts||(Ts=t)}}});var iu=["commitment"],ou=["encoding"],au=["commitment"],su=["commitment"];Rn.sha512Sync=function(){var t;return We((t=Rn).concatBytes.apply(t,arguments))};var uu=Rn.randomPrivateKey,cu=function(){var t=Rn.randomPrivateKey(),e=lu(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),{publicKey:e,secretKey:n}},lu=zn.getPublicKey;function hu(t){try{return cn.fromHex(t,!0),!0}catch(t){return!1}}var du=function(t,e){return zn.sign(t,e.slice(0,32))},fu=zn.verify,pu=function(t){return Tt.isBuffer(t)?t:t instanceof Uint8Array?Tt.from(t.buffer,t.byteOffset,t.byteLength):Tt.from(t)},mu=function(){function t(e){V(this,t),Object.assign(this,e)}return G(t,[{key:"encode",value:function(){return Tt.from(Cr(yu,this))}}],[{key:"decode",value:function(t){return Or(yu,this,t)}},{key:"decodeUnchecked",value:function(t){return vr(yu,this,t)}}]),t}(),gu=function(t){J(n,mu);var e=it(n);function n(t){var r;if(V(this,n),(r=e.call(this,t)).enum="",1!==Object.keys(t).length)throw new Error("Enum can only take single value");return Object.keys(t).map((function(t){r.enum=t})),r}return G(n)}(),yu=new Map,vu=32;var wu=1,bu=function(t,e){J(a,mu);var n,r,i,o=it(a);function a(t){var e;if(V(this,a),(e=o.call(this,{}))._bn=void 0,function(t){return void 0!==t._bn}(t))e._bn=t._bn;else{if("string"==typeof t){var n=qn.decode(t);if(n.length!=vu)throw new Error("Invalid public key input");e._bn=new Qn(n)}else e._bn=new Qn(t);if(e._bn.byteLength()>vu)throw new Error("Invalid public key input")}return e}return G(a,[{key:"equals",value:function(t){return this._bn.eq(t._bn)}},{key:"toBase58",value:function(){return qn.encode(this.toBytes())}},{key:"toJSON",value:function(){return this.toBase58()}},{key:"toBytes",value:function(){var t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}},{key:"toBuffer",value:function(){var t=this._bn.toArrayLike(Tt);if(t.length===vu)return t;var e=Tt.alloc(32);return t.copy(e,32-t.length),e}},{key:e,get:function(){return"PublicKey(".concat(this.toString(),")")}},{key:"toString",value:function(){return this.toBase58()}}],[{key:"unique",value:function(){var t=new a(wu);return wu+=1,new a(t.toBuffer())}},{key:"createWithSeed",value:(i=H(Q().mark((function t(e,n,r){var i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=Tt.concat([e.toBuffer(),Tt.from(n),r.toBuffer()]),o=tr(i),t.abrupt("return",new a(o));case 3:case"end":return t.stop()}}),t)}))),function(t,e,n){return i.apply(this,arguments)})},{key:"createProgramAddressSync",value:function(t,e){var n=Tt.alloc(0);t.forEach((function(t){if(t.length>32)throw new TypeError("Max seed length exceeded");n=Tt.concat([n,pu(t)])})),n=Tt.concat([n,e.toBuffer(),Tt.from("ProgramDerivedAddress")]);var r=tr(n);if(hu(r))throw new Error("Invalid seeds, address must fall off the curve");return new a(r)}},{key:"createProgramAddress",value:(r=H(Q().mark((function t(e,n){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.createProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"findProgramAddressSync",value:function(t,e){for(var n,r=255;0!=r;){try{var i=t.concat(Tt.from([r]));n=this.createProgramAddressSync(i,e)}catch(t){if(t instanceof TypeError)throw t;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}},{key:"findProgramAddress",value:(n=H(Q().mark((function t(e,n){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.findProgramAddressSync(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return n.apply(this,arguments)})},{key:"isOnCurve",value:function(t){return hu(new a(t).toBytes())}}]),a}(0,Symbol.toStringTag);bu.default=new bu("11111111111111111111111111111111"),yu.set(bu,{kind:"struct",fields:[["_bn","u256"]]});var Mu=function(){function t(e){if(V(this,t),this._publicKey=void 0,this._secretKey=void 0,e){var n=pu(e);if(64!==e.length)throw new Error("bad secret key size");this._publicKey=n.slice(32,64),this._secretKey=n.slice(0,32)}else this._secretKey=pu(uu()),this._publicKey=pu(lu(this._secretKey))}return G(t,[{key:"publicKey",get:function(){return new bu(this._publicKey)}},{key:"secretKey",get:function(){return Tt.concat([this._secretKey,this._publicKey],64)}}]),t}(),ku=new bu("BPFLoader1111111111111111111111111111111111"),Au=1232,Lu=127,Eu=64,xu=function(t){J(n,et(Error));var e=it(n);function n(t){var r;return V(this,n),(r=e.call(this,"Signature ".concat(t," has expired: block height exceeded."))).signature=void 0,r.signature=t,r}return G(n)}();Object.defineProperty(xu.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var Nu=function(t){J(n,et(Error));var e=it(n);function n(t,r){var i;return V(this,n),(i=e.call(this,"Transaction was not confirmed in ".concat(r.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(t," using the Solana Explorer or CLI tools."))).signature=void 0,i.signature=t,i}return G(n)}();Object.defineProperty(Nu.prototype,"name",{value:"TransactionExpiredTimeoutError"});var Su=function(t){J(n,et(Error));var e=it(n);function n(t){var r;return V(this,n),(r=e.call(this,"Signature ".concat(t," has expired: the nonce is no longer valid."))).signature=void 0,r.signature=t,r}return G(n)}();Object.defineProperty(Su.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var Iu=function(){function t(e,n){V(this,t),this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=n}return G(t,[{key:"keySegments",value:function(){var t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}},{key:"get",value:function(t){var e,n=ft(this.keySegments());try{for(n.s();!(e=n.n()).done;){var r=e.value;if(t<r.length)return r[t];t-=r.length}}catch(t){n.e(t)}finally{n.f()}}},{key:"length",get:function(){return this.keySegments().flat().length}},{key:"compileInstructions",value:function(t){if(this.length>256)throw new Error("Account index overflow encountered during compilation");var e=new Map;this.keySegments().flat().forEach((function(t,n){e.set(t.toBase58(),n)}));var n=function(t){var n=e.get(t.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return t.map((function(t){return{programIdIndex:n(t.programId),accountKeyIndexes:t.keys.map((function(t){return n(t.pubkey)})),data:t.data}}))}}]),t}(),Tu=function(){return Ni(32,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey")},Cu=function(){return Ni(64,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature")},ju=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",e=Ei([ki("length"),ki("lengthPadding"),Ni(wi(ki(),-8),"chars")],t),n=e.decode.bind(e),r=e.encode.bind(e),i=e;return i.decode=function(t,e){return n(t,e).chars.toString()},i.encode=function(t,e,n){var i={chars:Tt.from(t,"utf8")};return r(i,e,n)},i.alloc=function(t){return ki().span+ki().span+Tt.from(t,"utf8").length},i};function Du(t,e){var n=function t(n){if(n.span>=0)return n.span;if("function"==typeof n.alloc)return n.alloc(e[n.property]);if("count"in n&&"elementLayout"in n){var r=e[n.property];if(Array.isArray(r))return r.length*t(n.elementLayout)}else if("fields"in n)return Du({layout:n},e[n.property]);return 0},r=0;return t.layout.fields.forEach((function(t){r+=n(t)})),r}function Ou(t){for(var e=0,n=0;;){var r=t.shift();if(e|=(127&r)<<7*n,n+=1,0==(128&r))break}return e}function _u(t,e){for(var n=e;;){var r=127&n;if(0==(n>>=7)){t.push(r);break}r|=128,t.push(r)}}function zu(t,e){if(!t)throw new Error(e||"Assertion failed")}var Pu,Bu=function(){function t(e,n){V(this,t),this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=n}return G(t,[{key:"getMessageComponents",value:function(){var t=st(this.keyMetaMap.entries());zu(t.length<=256,"Max static account keys length exceeded");var e=t.filter((function(t){var e=at(t,2)[1];return e.isSigner&&e.isWritable})),n=t.filter((function(t){var e=at(t,2)[1];return e.isSigner&&!e.isWritable})),r=t.filter((function(t){var e=at(t,2)[1];return!e.isSigner&&e.isWritable})),i=t.filter((function(t){var e=at(t,2)[1];return!e.isSigner&&!e.isWritable})),o={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};return zu(e.length>0,"Expected at least one writable signer key"),zu(at(e[0],1)[0]===this.payer.toBase58(),"Expected first writable signer key to be the fee payer"),[o,[].concat(st(e.map((function(t){var e=at(t,1)[0];return new bu(e)}))),st(n.map((function(t){var e=at(t,1)[0];return new bu(e)}))),st(r.map((function(t){var e=at(t,1)[0];return new bu(e)}))),st(i.map((function(t){var e=at(t,1)[0];return new bu(e)}))))]}},{key:"extractTableLookup",value:function(t){var e=at(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&t.isWritable})),2),n=e[0],r=e[1],i=at(this.drainKeysFoundInLookupTable(t.state.addresses,(function(t){return!t.isSigner&&!t.isInvoked&&!t.isWritable})),2),o=i[0],a=i[1];if(0!==n.length||0!==o.length)return[{accountKey:t.key,writableIndexes:n,readonlyIndexes:o},{writable:r,readonly:a}]}},{key:"drainKeysFoundInLookupTable",value:function(t,e){var n,r=this,i=new Array,o=new Array,a=ft(this.keyMetaMap.entries());try{var s=function(){var a=at(n.value,2),s=a[0],u=a[1];if(e(u)){var c=new bu(s),l=t.findIndex((function(t){return t.equals(c)}));l>=0&&(zu(l<256,"Max lookup table index exceeded"),i.push(l),o.push(c),r.keyMetaMap.delete(s))}};for(a.s();!(n=a.n()).done;)s()}catch(t){a.e(t)}finally{a.f()}return[i,o]}}],[{key:"compile",value:function(e,n){var r=new Map,i=function(t){var e=t.toBase58(),n=r.get(e);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(e,n)),n},o=i(n);o.isSigner=!0,o.isWritable=!0;var a,s=ft(e);try{for(s.s();!(a=s.n()).done;){var u=a.value;i(u.programId).isInvoked=!0;var c,l=ft(u.keys);try{for(l.s();!(c=l.n()).done;){var h=c.value,d=i(h.pubkey);d.isSigner||(d.isSigner=h.isSigner),d.isWritable||(d.isWritable=h.isWritable)}}catch(t){l.e(t)}finally{l.f()}}}catch(t){s.e(t)}finally{s.f()}return new t(n,r)}}]),t}(),Ru=function(){function t(e){var n=this;V(this,t),this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map((function(t){return new bu(t)})),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach((function(t){return n.indexToProgramIds.set(t.programIdIndex,n.accountKeys[t.programIdIndex])}))}return G(t,[{key:"version",get:function(){return"legacy"}},{key:"staticAccountKeys",get:function(){return this.accountKeys}},{key:"compiledInstructions",get:function(){return this.instructions.map((function(t){return{programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:qn.decode(t.data)}}))}},{key:"addressTableLookups",get:function(){return[]}},{key:"getAccountKeys",value:function(){return new Iu(this.staticAccountKeys)}},{key:"isAccountSigner",value:function(t){return t<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(t){var e=this.header.numRequiredSignatures;return t>=this.header.numRequiredSignatures?t-e<this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts:t<e-this.header.numReadonlySignedAccounts}},{key:"isProgramId",value:function(t){return this.indexToProgramIds.has(t)}},{key:"programIds",value:function(){return st(this.indexToProgramIds.values())}},{key:"nonProgramIds",value:function(){var t=this;return this.accountKeys.filter((function(e,n){return!t.isProgramId(n)}))}},{key:"serialize",value:function(){var t=this.accountKeys.length,e=[];_u(e,t);var n=this.instructions.map((function(t){var e=t.accounts,n=t.programIdIndex,r=Array.from(qn.decode(t.data)),i=[];_u(i,e.length);var o=[];return _u(o,r.length),{programIdIndex:n,keyIndicesCount:Tt.from(i),keyIndices:e,dataLength:Tt.from(o),data:r}})),r=[];_u(r,n.length);var i=Tt.alloc(Au);Tt.from(r).copy(i);var o=r.length;n.forEach((function(t){var e=Ei([bi("programIdIndex"),Ni(t.keyIndicesCount.length,"keyIndicesCount"),xi(bi("keyIndex"),t.keyIndices.length,"keyIndices"),Ni(t.dataLength.length,"dataLength"),xi(bi("userdatum"),t.data.length,"data")]).encode(t,i,o);o+=e})),i=i.slice(0,o);var a=Ei([Ni(1,"numRequiredSignatures"),Ni(1,"numReadonlySignedAccounts"),Ni(1,"numReadonlyUnsignedAccounts"),Ni(e.length,"keyCount"),xi(Tu("key"),t,"keys"),Tu("recentBlockhash")]),s={numRequiredSignatures:Tt.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Tt.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Tt.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Tt.from(e),keys:this.accountKeys.map((function(t){return pu(t.toBytes())})),recentBlockhash:qn.decode(this.recentBlockhash)},u=Tt.alloc(2048),c=a.encode(s,u);return i.copy(u,c),u.slice(0,c+i.length)}}],[{key:"compile",value:function(e){var n=at(Bu.compile(e.instructions,e.payerKey).getMessageComponents(),2),r=n[0],i=n[1],o=new Iu(i).compileInstructions(e.instructions).map((function(t){return{programIdIndex:t.programIdIndex,accounts:t.accountKeyIndexes,data:qn.encode(t.data)}}));return new t({header:r,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:o})}},{key:"from",value:function(e){var n=st(e),r=n.shift();if(r!==(r&Lu))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");for(var i=n.shift(),o=n.shift(),a=Ou(n),s=[],u=0;u<a;u++){var c=n.slice(0,vu);n=n.slice(vu),s.push(new bu(Tt.from(c)))}for(var l=n.slice(0,vu),h=Ou(n=n.slice(vu)),d=[],f=0;f<h;f++){var p=n.shift(),m=Ou(n),g=n.slice(0,m),y=Ou(n=n.slice(m)),v=n.slice(0,y),w=qn.encode(Tt.from(v));n=n.slice(y),d.push({programIdIndex:p,accounts:g,data:w})}return new t({header:{numRequiredSignatures:r,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:o},recentBlockhash:qn.encode(Tt.from(l)),accountKeys:s,instructions:d})}}]),t}(),Uu=function(){function t(e){V(this,t),this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=e.header,this.staticAccountKeys=e.staticAccountKeys,this.recentBlockhash=e.recentBlockhash,this.compiledInstructions=e.compiledInstructions,this.addressTableLookups=e.addressTableLookups}return G(t,[{key:"version",get:function(){return 0}},{key:"numAccountKeysFromLookups",get:function(){var t,e=0,n=ft(this.addressTableLookups);try{for(n.s();!(t=n.n()).done;){var r=t.value;e+=r.readonlyIndexes.length+r.writableIndexes.length}}catch(t){n.e(t)}finally{n.f()}return e}},{key:"getAccountKeys",value:function(t){var e;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");e=t.accountKeysFromLookups}else if(t&&"addressLookupTableAccounts"in t&&t.addressLookupTableAccounts)e=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 Iu(this.staticAccountKeys,e)}},{key:"isAccountSigner",value:function(t){return t<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(t){var e=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;if(t>=n){var r=t-n,i=this.addressTableLookups.reduce((function(t,e){return t+e.writableIndexes.length}),0);return r<i}return t>=this.header.numRequiredSignatures?t-e<n-e-this.header.numReadonlyUnsignedAccounts:t<e-this.header.numReadonlySignedAccounts}},{key:"resolveAddressTableLookups",value:function(t){var e,n={writable:[],readonly:[]},r=ft(this.addressTableLookups);try{var i=function(){var r=e.value,i=t.find((function(t){return t.key.equals(r.accountKey)}));if(!i)throw new Error("Failed to find address lookup table account for table key ".concat(r.accountKey.toBase58()));var o,a=ft(r.writableIndexes);try{for(a.s();!(o=a.n()).done;){var s=o.value;if(!(s<i.state.addresses.length))throw new Error("Failed to find address for index ".concat(s," in address lookup table ").concat(r.accountKey.toBase58()));n.writable.push(i.state.addresses[s])}}catch(t){a.e(t)}finally{a.f()}var u,c=ft(r.readonlyIndexes);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(!(l<i.state.addresses.length))throw new Error("Failed to find address for index ".concat(l," in address lookup table ").concat(r.accountKey.toBase58()));n.readonly.push(i.state.addresses[l])}}catch(t){c.e(t)}finally{c.f()}};for(r.s();!(e=r.n()).done;)i()}catch(t){r.e(t)}finally{r.f()}return n}},{key:"serialize",value:function(){var t=Array();_u(t,this.staticAccountKeys.length);var e=this.serializeInstructions(),n=Array();_u(n,this.compiledInstructions.length);var r=this.serializeAddressTableLookups(),i=Array();_u(i,this.addressTableLookups.length);var o=Ei([bi("prefix"),Ei([bi("numRequiredSignatures"),bi("numReadonlySignedAccounts"),bi("numReadonlyUnsignedAccounts")],"header"),Ni(t.length,"staticAccountKeysLength"),xi(Tu(),this.staticAccountKeys.length,"staticAccountKeys"),Tu("recentBlockhash"),Ni(n.length,"instructionsLength"),Ni(e.length,"serializedInstructions"),Ni(i.length,"addressTableLookupsLength"),Ni(r.length,"serializedAddressTableLookups")]),a=new Uint8Array(Au),s=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map((function(t){return t.toBytes()})),recentBlockhash:qn.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},a);return a.slice(0,s)}},{key:"serializeInstructions",value:function(){var t,e=0,n=new Uint8Array(Au),r=ft(this.compiledInstructions);try{for(r.s();!(t=r.n()).done;){var i=t.value,o=Array();_u(o,i.accountKeyIndexes.length);var a=Array();_u(a,i.data.length),e+=Ei([bi("programIdIndex"),Ni(o.length,"encodedAccountKeyIndexesLength"),xi(bi(),i.accountKeyIndexes.length,"accountKeyIndexes"),Ni(a.length,"encodedDataLength"),Ni(i.data.length,"data")]).encode({programIdIndex:i.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(o),accountKeyIndexes:i.accountKeyIndexes,encodedDataLength:new Uint8Array(a),data:i.data},n,e)}}catch(t){r.e(t)}finally{r.f()}return n.slice(0,e)}},{key:"serializeAddressTableLookups",value:function(){var t,e=0,n=new Uint8Array(Au),r=ft(this.addressTableLookups);try{for(r.s();!(t=r.n()).done;){var i=t.value,o=Array();_u(o,i.writableIndexes.length);var a=Array();_u(a,i.readonlyIndexes.length),e+=Ei([Tu("accountKey"),Ni(o.length,"encodedWritableIndexesLength"),xi(bi(),i.writableIndexes.length,"writableIndexes"),Ni(a.length,"encodedReadonlyIndexesLength"),xi(bi(),i.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:i.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(o),writableIndexes:i.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(a),readonlyIndexes:i.readonlyIndexes},n,e)}}catch(t){r.e(t)}finally{r.f()}return n.slice(0,e)}}],[{key:"compile",value:function(e){var n,r=Bu.compile(e.instructions,e.payerKey),i=new Array,o={writable:new Array,readonly:new Array},a=ft(e.addressLookupTableAccounts||[]);try{for(a.s();!(n=a.n()).done;){var s=n.value,u=r.extractTableLookup(s);if(void 0!==u){var c,l,h=at(u,2),d=h[0],f=h[1],p=f.writable,m=f.readonly;i.push(d),(c=o.writable).push.apply(c,st(p)),(l=o.readonly).push.apply(l,st(m))}}}catch(t){a.e(t)}finally{a.f()}var g=at(r.getMessageComponents(),2),y=g[0],v=g[1],w=new Iu(v,o).compileInstructions(e.instructions);return new t({header:y,staticAccountKeys:v,recentBlockhash:e.recentBlockhash,compiledInstructions:w,addressTableLookups:i})}},{key:"deserialize",value:function(e){var n=st(e),r=n.shift(),i=r&Lu;zu(r!==i,"Expected versioned message but received legacy message");zu(0===i,"Expected versioned message with version 0 but found version ".concat(i));for(var o={numRequiredSignatures:n.shift(),numReadonlySignedAccounts:n.shift(),numReadonlyUnsignedAccounts:n.shift()},a=[],s=Ou(n),u=0;u<s;u++)a.push(new bu(n.splice(0,vu)));for(var c=qn.encode(n.splice(0,vu)),l=Ou(n),h=[],d=0;d<l;d++){var f=n.shift(),p=Ou(n),m=n.splice(0,p),g=Ou(n),y=new Uint8Array(n.splice(0,g));h.push({programIdIndex:f,accountKeyIndexes:m,data:y})}for(var v=Ou(n),w=[],b=0;b<v;b++){var M=new bu(n.splice(0,vu)),k=Ou(n),A=n.splice(0,k),L=Ou(n),E=n.splice(0,L);w.push({accountKey:M,writableIndexes:A,readonlyIndexes:E})}return new t({header:o,staticAccountKeys:a,recentBlockhash:c,compiledInstructions:h,addressTableLookups:w})}}]),t}(),Wu={deserializeMessageVersion:function(t){var e=t[0],n=e&Lu;return n===e?"legacy":n},deserialize:function(t){var e=Wu.deserializeMessageVersion(t);if("legacy"===e)return Ru.from(t);if(0===e)return Uu.deserialize(t);throw new Error("Transaction message version ".concat(e," deserialization is not supported"))}};!function(t){t[t.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",t[t.PROCESSED=1]="PROCESSED",t[t.TIMED_OUT=2]="TIMED_OUT",t[t.NONCE_INVALID=3]="NONCE_INVALID"}(Pu||(Pu={}));var Qu=Tt.alloc(Eu).fill(0),Fu=function(){function t(e){V(this,t),this.keys=void 0,this.programId=void 0,this.data=Tt.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}return G(t,[{key:"toJSON",value:function(){return{keys:this.keys.map((function(t){var e=t.pubkey,n=t.isSigner,r=t.isWritable;return{pubkey:e.toJSON(),isSigner:n,isWritable:r}})),programId:this.programId.toJSON(),data:st(this.data)}}}]),t}(),Yu=function(){function t(e){if(V(this,t),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,e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){var n=e.minContextSlot,r=e.nonceInfo;this.minNonceContextSlot=n,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){var i=e.blockhash,o=e.lastValidBlockHeight;this.recentBlockhash=i,this.lastValidBlockHeight=o}else{var a=e.recentBlockhash,s=e.nonceInfo;s&&(this.nonceInfo=s),this.recentBlockhash=a}}var e;return G(t,[{key:"signature",get:function(){return this.signatures.length>0?this.signatures[0].signature:null}},{key:"toJSON",value:function(){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((function(t){return t.toJSON()})),signers:this.signatures.map((function(t){return t.publicKey.toJSON()}))}}},{key:"add",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(0===n.length)throw new Error("No instructions");return n.forEach((function(e){"instructions"in e?t.instructions=t.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?t.instructions.push(e):t.instructions.push(new Fu(e))})),this}},{key:"compileMessage",value:function(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;var t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction].concat(st(this.instructions)):this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(var r=0;r<e.length;r++)if(void 0===e[r].programId)throw new Error("Transaction instruction index ".concat(r," has undefined program id"));var i=[],o=[];e.forEach((function(t){t.keys.forEach((function(t){o.push(W({},t))}));var e=t.programId.toString();i.includes(e)||i.push(e)})),i.forEach((function(t){o.push({pubkey:new bu(t),isSigner:!1,isWritable:!1})}));var a=[];o.forEach((function(t){var e=t.pubkey.toString(),n=a.findIndex((function(t){return t.pubkey.toString()===e}));n>-1?(a[n].isWritable=a[n].isWritable||t.isWritable,a[n].isSigner=a[n].isSigner||t.isSigner):a.push(t)})),a.sort((function(t,e){return t.isSigner!==e.isSigner?t.isSigner?-1:1:t.isWritable!==e.isWritable?t.isWritable?-1:1:t.pubkey.toBase58().localeCompare(e.pubkey.toBase58())}));var s=a.findIndex((function(t){return t.pubkey.equals(n)}));if(s>-1){var u=at(a.splice(s,1),1)[0];u.isSigner=!0,u.isWritable=!0,a.unshift(u)}else a.unshift({pubkey:n,isSigner:!0,isWritable:!0});var c,l=ft(this.signatures);try{var h=function(){var t=c.value,e=a.findIndex((function(e){return e.pubkey.equals(t.publicKey)}));if(!(e>-1))throw new Error("unknown signer: ".concat(t.publicKey.toString()));a[e].isSigner||(a[e].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."))};for(l.s();!(c=l.n()).done;)h()}catch(t){l.e(t)}finally{l.f()}var d=0,f=0,p=0,m=[],g=[];a.forEach((function(t){var e=t.pubkey,n=t.isSigner,r=t.isWritable;n?(m.push(e.toString()),d+=1,r||(f+=1)):(g.push(e.toString()),r||(p+=1))}));var y=m.concat(g),v=e.map((function(t){var e=t.data,n=t.programId;return{programIdIndex:y.indexOf(n.toString()),accounts:t.keys.map((function(t){return y.indexOf(t.pubkey.toString())})),data:qn.encode(e)}}));return v.forEach((function(t){zu(t.programIdIndex>=0),t.accounts.forEach((function(t){return zu(t>=0)}))})),new Ru({header:{numRequiredSignatures:d,numReadonlySignedAccounts:f,numReadonlyUnsignedAccounts:p},accountKeys:y,recentBlockhash:t,instructions:v})}},{key:"_compile",value:function(){var t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);if(this.signatures.length===e.length){var n=this.signatures.every((function(t,n){return e[n].equals(t.publicKey)}));if(n)return t}return this.signatures=e.map((function(t){return{signature:null,publicKey:t}})),t}},{key:"serializeMessage",value:function(){return this._compile().serialize()}},{key:"getEstimatedFee",value:(e=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getFeeForMessage(this.compileMessage());case 2:return t.abrupt("return",t.sent.value);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"setSigners",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)throw new Error("No signers");var r=new Set;this.signatures=e.filter((function(t){var e=t.toString();return!r.has(e)&&(r.add(e),!0)})).map((function(t){return{signature:null,publicKey:t}}))}},{key:"sign",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=e;o<a.length;o++){var s=a[o],u=s.publicKey.toString();r.has(u)||(r.add(u),i.push(s))}this.signatures=i.map((function(t){return{signature:null,publicKey:t.publicKey}}));var c=this._compile();this._partialSign.apply(this,[c].concat(i))}},{key:"partialSign",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=e;o<a.length;o++){var s=a[o],u=s.publicKey.toString();r.has(u)||(r.add(u),i.push(s))}var c=this._compile();this._partialSign.apply(this,[c].concat(i))}},{key:"_partialSign",value:function(t){for(var e=this,n=t.serialize(),r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];i.forEach((function(t){var r=du(n,t.secretKey);e._addSignature(t.publicKey,pu(r))}))}},{key:"addSignature",value:function(t,e){this._compile(),this._addSignature(t,e)}},{key:"_addSignature",value:function(t,e){zu(64===e.length);var n=this.signatures.findIndex((function(e){return t.equals(e.publicKey)}));if(n<0)throw new Error("unknown signer: ".concat(t.toString()));this.signatures[n].signature=Tt.from(e)}},{key:"verifySignatures",value:function(t){return this._verifySignatures(this.serializeMessage(),void 0===t||t)}},{key:"_verifySignatures",value:function(t,e){var n,r=ft(this.signatures);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i.signature,a=i.publicKey;if(null===o){if(e)return!1}else if(!fu(o,t,a.toBytes()))return!1}}catch(t){r.e(t)}finally{r.f()}return!0}},{key:"serialize",value:function(t){var e=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),n=e.requireAllSignatures,r=e.verifySignatures,i=this.serializeMessage();if(r&&!this._verifySignatures(i,n))throw new Error("Signature verification failed");return this._serialize(i)}},{key:"_serialize",value:function(t){var e=this.signatures,n=[];_u(n,e.length);var r=n.length+64*e.length+t.length,i=Tt.alloc(r);return zu(e.length<256),Tt.from(n).copy(i,0),e.forEach((function(t,e){var r=t.signature;null!==r&&(zu(64===r.length,"signature has invalid length"),Tt.from(r).copy(i,n.length+64*e))})),t.copy(i,n.length+64*e.length),zu(i.length<=Au,"Transaction too large: ".concat(i.length," > ").concat(Au)),i}},{key:"keys",get:function(){return zu(1===this.instructions.length),this.instructions[0].keys.map((function(t){return t.pubkey}))}},{key:"programId",get:function(){return zu(1===this.instructions.length),this.instructions[0].programId}},{key:"data",get:function(){return zu(1===this.instructions.length),this.instructions[0].data}}],[{key:"from",value:function(e){for(var n=st(e),r=Ou(n),i=[],o=0;o<r;o++){var a=n.slice(0,Eu);n=n.slice(Eu),i.push(qn.encode(Tt.from(a)))}return t.populate(Ru.from(n),i)}},{key:"populate",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=new t;return r.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(r.feePayer=e.accountKeys[0]),n.forEach((function(t,n){var i={signature:t==qn.encode(Qu)?null:qn.decode(t),publicKey:e.accountKeys[n]};r.signatures.push(i)})),e.instructions.forEach((function(t){var n=t.accounts.map((function(t){var n=e.accountKeys[t];return{pubkey:n,isSigner:r.signatures.some((function(t){return t.publicKey.toString()===n.toString()}))||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}}));r.instructions.push(new Fu({keys:n,programId:e.accountKeys[t.programIdIndex],data:qn.decode(t.data)}))})),r._message=e,r._json=r.toJSON(),r}}]),t}(),Hu=function(){function t(e){V(this,t),this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=e.payerKey,this.instructions=e.instructions,this.recentBlockhash=e.recentBlockhash}return G(t,[{key:"compileToLegacyMessage",value:function(){return Ru.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}},{key:"compileToV0Message",value:function(t){return Uu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:t})}}],[{key:"decompile",value:function(e,n){var r=e.header,i=e.compiledInstructions,o=e.recentBlockhash,a=r.numRequiredSignatures,s=r.numReadonlySignedAccounts,u=r.numReadonlyUnsignedAccounts,c=a-s;zu(c>0,"Message header is invalid");var l=e.staticAccountKeys.length-a-u;zu(l>=0,"Message header is invalid");var h=e.getAccountKeys(n),d=h.get(0);if(void 0===d)throw new Error("Failed to decompile message because no account keys were found");var f,p=[],m=ft(i);try{for(m.s();!(f=m.n()).done;){var g,y=f.value,v=[],w=ft(y.accountKeyIndexes);try{for(w.s();!(g=w.n()).done;){var b=g.value,M=h.get(b);if(void 0===M)throw new Error("Failed to find key for account key index ".concat(b));var k=void 0;k=b<a?b<c:b<h.staticAccountKeys.length?b-a<l:b-h.staticAccountKeys.length<h.accountKeysFromLookups.writable.length,v.push({pubkey:M,isSigner:b<r.numRequiredSignatures,isWritable:k})}}catch(t){w.e(t)}finally{w.f()}var A=h.get(y.programIdIndex);if(void 0===A)throw new Error("Failed to find program id for program id index ".concat(y.programIdIndex));p.push(new Fu({programId:A,data:pu(y.data),keys:v}))}}catch(t){m.e(t)}finally{m.f()}return new t({payerKey:d,instructions:p,recentBlockhash:o})}}]),t}(),Vu=function(){function t(e,n){if(V(this,t),this.signatures=void 0,this.message=void 0,void 0!==n)zu(n.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=n;else{for(var r=[],i=0;i<e.header.numRequiredSignatures;i++)r.push(new Uint8Array(Eu));this.signatures=r}this.message=e}return G(t,[{key:"version",get:function(){return this.message.version}},{key:"serialize",value:function(){var t=this.message.serialize(),e=Array();_u(e,this.signatures.length);var n=Ei([Ni(e.length,"encodedSignaturesLength"),xi(Cu(),this.signatures.length,"signatures"),Ni(t.length,"serializedMessage")]),r=new Uint8Array(2048),i=n.encode({encodedSignaturesLength:new Uint8Array(e),signatures:this.signatures,serializedMessage:t},r);return r.slice(0,i)}},{key:"sign",value:function(t){var e,n=this,r=this.message.serialize(),i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures),o=ft(t);try{var a=function(){var t=e.value,o=i.findIndex((function(e){return e.equals(t.publicKey)}));zu(o>=0,"Cannot sign with non signer key ".concat(t.publicKey.toBase58())),n.signatures[o]=du(r,t.secretKey)};for(o.s();!(e=o.n()).done;)a()}catch(t){o.e(t)}finally{o.f()}}},{key:"addSignature",value:function(t,e){zu(64===e.byteLength,"Signature must be 64 bytes long");var n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((function(e){return e.equals(t)}));zu(n>=0,"Can not add signature; `".concat(t.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=e}}],[{key:"deserialize",value:function(e){for(var n=st(e),r=[],i=Ou(n),o=0;o<i;o++)r.push(new Uint8Array(n.splice(0,Eu)));return new t(Wu.deserialize(new Uint8Array(n)),r)}}]),t}(),qu=new bu("SysvarC1ock11111111111111111111111111111111"),Gu=new bu("SysvarEpochSchedu1e111111111111111111111111"),Zu=new bu("Sysvar1nstructions1111111111111111111111111"),Ju=new bu("SysvarRecentB1ockHashes11111111111111111111"),Xu=new bu("SysvarRent111111111111111111111111111111111"),Ku=new bu("SysvarRewards111111111111111111111111111111"),$u=new bu("SysvarS1otHashes111111111111111111111111111"),tc=new bu("SysvarS1otHistory11111111111111111111111111"),ec=new bu("SysvarStakeHistory1111111111111111111111111");function nc(t,e,n,r){return rc.apply(this,arguments)}function rc(){return rc=H(Q().mark((function t(e,n,r,i){var o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},t.next=3,e.sendTransaction(n,r,o);case 3:if(a=t.sent,null==n.recentBlockhash||null==n.lastValidBlockHeight){t.next=10;break}return t.next=7,e.confirmTransaction({abortSignal:null==i?void 0:i.abortSignal,signature:a,blockhash:n.recentBlockhash,lastValidBlockHeight:n.lastValidBlockHeight},i&&i.commitment);case 7:s=t.sent.value,t.next=22;break;case 10:if(null==n.minNonceContextSlot||null==n.nonceInfo){t.next=18;break}return u=n.nonceInfo.nonceInstruction,c=u.keys[0].pubkey,t.next=15,e.confirmTransaction({abortSignal:null==i?void 0:i.abortSignal,minContextSlot:n.minNonceContextSlot,nonceAccountPubkey:c,nonceValue:n.nonceInfo.nonce,signature:a},i&&i.commitment);case 15:s=t.sent.value,t.next=22;break;case 18:return null!=(null==i?void 0:i.abortSignal)&&console.warn("sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` or a combination of `nonceInfo` and `minNonceContextSlot` are abortable."),t.next=21,e.confirmTransaction(a,i&&i.commitment);case 21:s=t.sent.value;case 22:if(!s.err){t.next=24;break}throw new Error("Transaction ".concat(a," failed (").concat(JSON.stringify(s),")"));case 24:return t.abrupt("return",a);case 25:case"end":return t.stop()}}),t)}))),rc.apply(this,arguments)}function ic(t){return new Promise((function(e){return setTimeout(e,t)}))}function oc(t,e){var n=t.layout.span>=0?t.layout.span:Du(t,e),r=Tt.alloc(n),i=Object.assign({instruction:t.index},e);return t.layout.encode(i,r),r}function ac(t,e){var n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.instruction!==t.index)throw new Error("invalid instruction; instruction index mismatch ".concat(n.instruction," != ").concat(t.index));return n}var sc,uc=Ai("lamportsPerSignature"),cc=Ei([ki("version"),ki("state"),Tu("authorizedPubkey"),Tu("nonce"),Ei([uc],"feeCalculator")]),lc=cc.span,hc=function(){function t(e){V(this,t),this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=e.authorizedPubkey,this.nonce=e.nonce,this.feeCalculator=e.feeCalculator}return G(t,null,[{key:"fromAccountData",value:function(e){var n=cc.decode(pu(e),0);return new t({authorizedPubkey:new bu(n.authorizedPubkey),nonce:new bu(n.nonce).toString(),feeCalculator:n.feeCalculator})}}]),t}(),dc=(sc=8,function(t){var e=Ni(sc,t),n=function(t){return{decode:t.decode.bind(t),encode:t.encode.bind(t)}}(e),r=n.encode,i=n.decode,o=e;return o.decode=function(t,e){var n=i(t,e);return Ii(Tt.from(n))},o.encode=function(t,e,n){var i=Ti(t,sc);return r(i,e,n)},o}),fc=function(){function t(){V(this,t)}return G(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=ki("instruction").decode(t.data),r=0,i=Object.entries(pc);r<i.length;r++){var o=at(i[r],2),a=o[0];if(o[1].index==n){e=a;break}}if(!e)throw new Error("Instruction type incorrect; not a SystemInstruction");return e}},{key:"decodeCreateAccount",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(pc.Create,t.data),n=e.lamports,r=e.space,i=e.programId;return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,lamports:n,space:r,programId:new bu(i)}}},{key:"decodeTransfer",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(pc.Transfer,t.data).lamports;return{fromPubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,lamports:e}}},{key:"decodeTransferWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(pc.TransferWithSeed,t.data),n=e.lamports,r=e.seed,i=e.programId;return{fromPubkey:t.keys[0].pubkey,basePubkey:t.keys[1].pubkey,toPubkey:t.keys[2].pubkey,lamports:n,seed:r,programId:new bu(i)}}},{key:"decodeAllocate",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);var e=ac(pc.Allocate,t.data).space;return{accountPubkey:t.keys[0].pubkey,space:e}}},{key:"decodeAllocateWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);var e=ac(pc.AllocateWithSeed,t.data),n=e.base,r=e.seed,i=e.space,o=e.programId;return{accountPubkey:t.keys[0].pubkey,basePubkey:new bu(n),seed:r,space:i,programId:new bu(o)}}},{key:"decodeAssign",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);var e=ac(pc.Assign,t.data).programId;return{accountPubkey:t.keys[0].pubkey,programId:new bu(e)}}},{key:"decodeAssignWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,1);var e=ac(pc.AssignWithSeed,t.data),n=e.base,r=e.seed,i=e.programId;return{accountPubkey:t.keys[0].pubkey,basePubkey:new bu(n),seed:r,programId:new bu(i)}}},{key:"decodeCreateWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(pc.CreateWithSeed,t.data),n=e.base,r=e.seed,i=e.lamports,o=e.space,a=e.programId;return{fromPubkey:t.keys[0].pubkey,newAccountPubkey:t.keys[1].pubkey,basePubkey:new bu(n),seed:r,lamports:i,space:o,programId:new bu(a)}}},{key:"decodeNonceInitialize",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(pc.InitializeNonceAccount,t.data).authorized;return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:new bu(e)}}},{key:"decodeNonceAdvance",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),ac(pc.AdvanceNonceAccount,t.data),{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}},{key:"decodeNonceWithdraw",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);var e=ac(pc.WithdrawNonceAccount,t.data).lamports;return{noncePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e}}},{key:"decodeNonceAuthorize",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(pc.AuthorizeNonceAccount,t.data).authorized;return{noncePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[1].pubkey,newAuthorizedPubkey:new bu(e)}}},{key:"checkProgramId",value:function(t){if(!t.equals(mc.programId))throw new Error("invalid instruction; programId is not SystemProgram")}},{key:"checkKeyLength",value:function(t,e){if(t.length<e)throw new Error("invalid instruction; found ".concat(t.length," keys, expected at least ").concat(e))}}]),t}(),pc=Object.freeze({Create:{index:0,layout:Ei([ki("instruction"),Li("lamports"),Li("space"),Tu("programId")])},Assign:{index:1,layout:Ei([ki("instruction"),Tu("programId")])},Transfer:{index:2,layout:Ei([ki("instruction"),dc("lamports")])},CreateWithSeed:{index:3,layout:Ei([ki("instruction"),Tu("base"),ju("seed"),Li("lamports"),Li("space"),Tu("programId")])},AdvanceNonceAccount:{index:4,layout:Ei([ki("instruction")])},WithdrawNonceAccount:{index:5,layout:Ei([ki("instruction"),Li("lamports")])},InitializeNonceAccount:{index:6,layout:Ei([ki("instruction"),Tu("authorized")])},AuthorizeNonceAccount:{index:7,layout:Ei([ki("instruction"),Tu("authorized")])},Allocate:{index:8,layout:Ei([ki("instruction"),Li("space")])},AllocateWithSeed:{index:9,layout:Ei([ki("instruction"),Tu("base"),ju("seed"),Li("space"),Tu("programId")])},AssignWithSeed:{index:10,layout:Ei([ki("instruction"),Tu("base"),ju("seed"),Tu("programId")])},TransferWithSeed:{index:11,layout:Ei([ki("instruction"),dc("lamports"),ju("seed"),Tu("programId")])},UpgradeNonceAccount:{index:12,layout:Ei([ki("instruction")])}}),mc=function(){function t(){V(this,t)}return G(t,null,[{key:"createAccount",value:function(t){var e=oc(pc.Create,{lamports:t.lamports,space:t.space,programId:pu(t.programId.toBuffer())});return new Fu({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}},{key:"transfer",value:function(t){var e,n;"basePubkey"in t?(e=oc(pc.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:pu(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]):(e=oc(pc.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]);return new Fu({keys:n,programId:this.programId,data:e})}},{key:"assign",value:function(t){var e,n;"basePubkey"in t?(e=oc(pc.AssignWithSeed,{base:pu(t.basePubkey.toBuffer()),seed:t.seed,programId:pu(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=oc(pc.Assign,{programId:pu(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]);return new Fu({keys:n,programId:this.programId,data:e})}},{key:"createAccountWithSeed",value:function(t){var e=oc(pc.CreateWithSeed,{base:pu(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:pu(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new Fu({keys:n,programId:this.programId,data:e})}},{key:"createNonceAccount",value:function(e){var n=new Yu;"basePubkey"in e&&"seed"in e?n.add(t.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:lc,programId:this.programId})):n.add(t.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:lc,programId:this.programId}));var r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return n.add(this.nonceInitialize(r)),n}},{key:"nonceInitialize",value:function(t){var e=oc(pc.InitializeNonceAccount,{authorized:pu(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Ju,isSigner:!1,isWritable:!1},{pubkey:Xu,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new Fu(n)}},{key:"nonceAdvance",value:function(t){var e=oc(pc.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Ju,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new Fu(n)}},{key:"nonceWithdraw",value:function(t){var e=oc(pc.WithdrawNonceAccount,{lamports:t.lamports});return new Fu({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:Ju,isSigner:!1,isWritable:!1},{pubkey:Xu,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}},{key:"nonceAuthorize",value:function(t){var e=oc(pc.AuthorizeNonceAccount,{authorized:pu(t.newAuthorizedPubkey.toBuffer())});return new Fu({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}},{key:"allocate",value:function(t){var e,n;"basePubkey"in t?(e=oc(pc.AllocateWithSeed,{base:pu(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:pu(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=oc(pc.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]);return new Fu({keys:n,programId:this.programId,data:e})}}]),t}();mc.programId=new bu("11111111111111111111111111111111");var gc=function(){function t(){V(this,t)}var e;return G(t,null,[{key:"getMinNumSignatures",value:function(e){return 2*(Math.ceil(e/t.chunkSize)+1+1)}},{key:"load",value:(e=H(Q().mark((function e(n,r,i,o,a){var s,u,c,l,h,d,f,p,m,g,y,v,w,b;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getMinimumBalanceForRentExemption(a.length);case 2:return s=e.sent,e.next=5,n.getAccountInfo(i.publicKey,"confirmed");case 5:if(u=e.sent,c=null,null===u){e.next=16;break}if(!u.executable){e.next=11;break}return console.error("Program load failed, account is already executable"),e.abrupt("return",!1);case 11:u.data.length!==a.length&&(c=c||new Yu).add(mc.allocate({accountPubkey:i.publicKey,space:a.length})),u.owner.equals(o)||(c=c||new Yu).add(mc.assign({accountPubkey:i.publicKey,programId:o})),u.lamports<s&&(c=c||new Yu).add(mc.transfer({fromPubkey:r.publicKey,toPubkey:i.publicKey,lamports:s-u.lamports})),e.next=17;break;case 16:c=(new Yu).add(mc.createAccount({fromPubkey:r.publicKey,newAccountPubkey:i.publicKey,lamports:s>0?s:1,space:a.length,programId:o}));case 17:if(null===c){e.next=20;break}return e.next=20,nc(n,c,[r,i],{commitment:"confirmed"});case 20:l=Ei([ki("instruction"),ki("offset"),ki("bytesLength"),ki("bytesLengthPadding"),xi(bi("byte"),wi(ki(),-8),"bytes")]),h=t.chunkSize,d=0,f=a,p=[];case 25:if(!(f.length>0)){e.next=39;break}if(m=f.slice(0,h),g=Tt.alloc(h+16),l.encode({instruction:0,offset:d,bytes:m,bytesLength:0,bytesLengthPadding:0},g),y=(new Yu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:g}),p.push(nc(n,y,[r,i],{commitment:"confirmed"})),!n._rpcEndpoint.includes("solana.com")){e.next=35;break}return e.next=35,ic(250);case 35:d+=h,f=f.slice(h),e.next=25;break;case 39:return e.next=41,Promise.all(p);case 41:return v=Ei([ki("instruction")]),w=Tt.alloc(v.span),v.encode({instruction:1},w),b=(new Yu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:Xu,isSigner:!1,isWritable:!1}],programId:o,data:w}),e.next=47,nc(n,b,[r,i],{commitment:"confirmed"});case 47:return e.abrupt("return",!0);case 48:case"end":return e.stop()}}),e)}))),function(t,n,r,i,o){return e.apply(this,arguments)})}]),t}();gc.chunkSize=932;var yc=new bu("BPFLoader2111111111111111111111111111111111"),vc=function(){function t(){V(this,t)}return G(t,null,[{key:"getMinNumSignatures",value:function(t){return gc.getMinNumSignatures(t)}},{key:"load",value:function(t,e,n,r,i){return gc.load(t,e,n,i,r)}}]),t}(),wc=Object.prototype.toString,bc=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};function Mc(t,e){var n,r,i,o,a,s,u;if(!0===t)return"true";if(!1===t)return"false";switch(F(t)){case"object":if(null===t)return null;if(t.toJSON&&"function"==typeof t.toJSON)return Mc(t.toJSON(),e);if("[object Array]"===(u=wc.call(t))){for(i="[",r=t.length-1,n=0;n<r;n++)i+=Mc(t[n],!0)+",";return r>-1&&(i+=Mc(t[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=bc(t).sort()).length,i="",n=0;n<r;)void 0!==(s=Mc(t[a=o[n]],!1))&&(i&&(i+=","),i+=JSON.stringify(a)+":"+s),n++;return"{"+i+"}"}return JSON.stringify(t);case"function":case"undefined":return e?null:void 0;case"string":return JSON.stringify(t);default:return isFinite(t)?t:null}}var kc=function(t){var e=Mc(t,!1);if(void 0!==e)return""+e};function Ac(t){for(var e=0;t>1;)t/=2,e++;return e}var Lc=function(){function t(e,n,r,i,o){V(this,t),this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=e,this.leaderScheduleSlotOffset=n,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=o}return G(t,[{key:"getEpoch",value:function(t){return this.getEpochAndSlotIndex(t)[0]}},{key:"getEpochAndSlotIndex",value:function(t){if(t<this.firstNormalSlot){var e=Ac(function(t){return 0===t?1:(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,1+(t|=t>>32))}(t+32+1))-Ac(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}var n=t-this.firstNormalSlot,r=Math.floor(n/this.slotsPerEpoch);return[this.firstNormalEpoch+r,n%this.slotsPerEpoch]}},{key:"getFirstSlotInEpoch",value:function(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}},{key:"getLastSlotInEpoch",value:function(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}},{key:"getSlotsInEpoch",value:function(t){return t<this.firstNormalEpoch?Math.pow(2,t+Ac(32)):this.slotsPerEpoch}}]),t}(),Ec=function(t){J(n,et(Error));var e=it(n);function n(t,r){var i;return V(this,n),(i=e.call(this,t)).logs=void 0,i.logs=r,i}return G(n)}(),xc=function(t){J(n,et(Error));var e=it(n);function n(t,r){var i,o=t.code,a=t.message,s=t.data;return V(this,n),(i=e.call(this,null!=r?"".concat(r,": ").concat(a):a)).code=void 0,i.data=void 0,i.code=o,i.data=s,i.name="SolanaJSONRPCError",i}return G(n)}(),Nc=globalThis.fetch,Sc=function(t){J(n,xa);var e=it(n);function n(t,r,i){var o;V(this,n);return(o=e.call(this,(function(t){var e=Sa(t,W({autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3},r));return o.underlyingSocket="socket"in e?e.socket:e,e}),t,r,i)).underlyingSocket=void 0,o}return G(n,[{key:"call",value:function(){for(var t,e,r=null===(t=this.underlyingSocket)||void 0===t?void 0:t.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(e=ot(X(n.prototype),"call",this)).call.apply(e,[this].concat(o)):Promise.reject(new Error("Tried to call a JSON-RPC method `"+o[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}},{key:"notify",value:function(){for(var t,e,r=null===(t=this.underlyingSocket)||void 0===t?void 0:t.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(e=ot(X(n.prototype),"notify",this)).call.apply(e,[this].concat(o)):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+o[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}}]),n}();var Ic=function(){function t(e){V(this,t),this.key=void 0,this.state=void 0,this.key=e.key,this.state=e.state}return G(t,[{key:"isActive",value:function(){var t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}}],[{key:"deserialize",value:function(t){var e=function(t,e){var n;try{n=t.layout.decode(e)}catch(t){throw new Error("invalid instruction; "+t)}if(n.typeIndex!==t.index)throw new Error("invalid account data; account type mismatch ".concat(n.typeIndex," != ").concat(t.index));return n}(Tc,t),n=t.length-56;zu(n>=0,"lookup table is invalid"),zu(n%32==0,"lookup table is invalid");var r=n/32,i=Ei([xi(Tu(),r,"addresses")]).decode(t.slice(56)).addresses;return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:0!==e.authority.length?new bu(e.authority[0]):void 0,addresses:i.map((function(t){return new bu(t)}))}}}]),t}(),Tc={index:1,layout:Ei([ki("typeIndex"),dc("deactivationSlot"),Ai("lastExtendedSlot"),bi("lastExtendedStartIndex"),bi(),xi(Tu(),wi(bi(),-1),"authority")])},Cc=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;var jc=ao(Zi(bu),eo(),(function(t){return new bu(t)})),Dc=no([eo(),Ji("base64")]),Oc=ao(Zi(Tt),Dc,(function(t){return Tt.from(t[0],"base64")}));function _c(t){var e,n;if("string"==typeof t)e=t;else if(t){e=t.commitment,n=nt(t,iu)}return{commitment:e,config:n}}function zc(t){return io([ro({jsonrpc:Ji("2.0"),id:eo(),result:t}),ro({jsonrpc:Ji("2.0"),id:eo(),error:ro({code:oo(),message:eo(),data:$i(Vi("any",(function(){return!0})))})})])}var Pc=zc(oo());function Bc(t){return ao(zc(t),Pc,(function(e){return"error"in e?e:W(W({},e),{},{result:Fi(e.result,t)})}))}function Rc(t){return Bc(ro({context:ro({slot:Ki()}),value:t}))}function Uc(t){return ro({context:ro({slot:Ki()}),value:t})}function Wc(t,e){return 0===t?new Uu({header:e.header,staticAccountKeys:e.accountKeys.map((function(t){return new bu(t)})),recentBlockhash:e.recentBlockhash,compiledInstructions:e.instructions.map((function(t){return{programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:qn.decode(t.data)}})),addressTableLookups:e.addressTableLookups}):new Ru(e)}var Qc=ro({foundation:Ki(),foundationTerm:Ki(),initial:Ki(),taper:Ki(),terminal:Ki()}),Fc=Bc(qi(Xi(ro({epoch:Ki(),effectiveSlot:Ki(),amount:Ki(),postBalance:Ki(),commission:$i(Xi(Ki()))})))),Yc=qi(ro({slot:Ki(),prioritizationFee:Ki()})),Hc=ro({total:Ki(),validator:Ki(),foundation:Ki(),epoch:Ki()}),Vc=ro({epoch:Ki(),slotIndex:Ki(),slotsInEpoch:Ki(),absoluteSlot:Ki(),blockHeight:$i(Ki()),transactionCount:$i(Ki())}),qc=ro({slotsPerEpoch:Ki(),leaderScheduleSlotOffset:Ki(),warmup:Gi(),firstNormalEpoch:Ki(),firstNormalSlot:Ki()}),Gc=to(eo(),qi(Ki())),Zc=Xi(io([ro({}),eo()])),Jc=ro({err:Zc}),Xc=Ji("receivedSignature"),Kc=ro({"solana-core":eo(),"feature-set":$i(Ki())}),$c=Rc(ro({err:Xi(io([ro({}),eo()])),logs:Xi(qi(eo())),accounts:$i(Xi(qi(Xi(ro({executable:Gi(),owner:eo(),lamports:Ki(),data:qi(eo()),rentEpoch:$i(Ki())}))))),unitsConsumed:$i(Ki()),returnData:$i(Xi(ro({programId:eo(),data:no([eo(),Ji("base64")])})))})),tl=Rc(ro({byIdentity:to(eo(),qi(Ki())),range:ro({firstSlot:Ki(),lastSlot:Ki()})}));var el=Bc(Qc),nl=Bc(Hc),rl=Bc(Yc),il=Bc(Vc),ol=Bc(qc),al=Bc(Gc),sl=Bc(Ki()),ul=Rc(ro({total:Ki(),circulating:Ki(),nonCirculating:Ki(),nonCirculatingAccounts:qi(jc)})),cl=ro({amount:eo(),uiAmount:Xi(Ki()),decimals:Ki(),uiAmountString:$i(eo())}),ll=Rc(qi(ro({address:jc,amount:eo(),uiAmount:Xi(Ki()),decimals:Ki(),uiAmountString:$i(eo())}))),hl=Rc(qi(ro({pubkey:jc,account:ro({executable:Gi(),owner:jc,lamports:Ki(),data:Oc,rentEpoch:Ki()})}))),dl=ro({program:eo(),parsed:oo(),space:Ki()}),fl=Rc(qi(ro({pubkey:jc,account:ro({executable:Gi(),owner:jc,lamports:Ki(),data:dl,rentEpoch:Ki()})}))),pl=Rc(qi(ro({lamports:Ki(),address:jc}))),ml=ro({executable:Gi(),owner:jc,lamports:Ki(),data:Oc,rentEpoch:Ki()}),gl=ro({pubkey:jc,account:ml}),yl=ao(io([Zi(Tt),dl]),io([Dc,dl]),(function(t){return Array.isArray(t)?Fi(t,Oc):t})),vl=ro({executable:Gi(),owner:jc,lamports:Ki(),data:yl,rentEpoch:Ki()}),wl=ro({pubkey:jc,account:vl}),bl=ro({state:io([Ji("active"),Ji("inactive"),Ji("activating"),Ji("deactivating")]),active:Ki(),inactive:Ki()}),Ml=Bc(qi(ro({signature:eo(),slot:Ki(),err:Zc,memo:Xi(eo()),blockTime:$i(Xi(Ki()))}))),kl=Bc(qi(ro({signature:eo(),slot:Ki(),err:Zc,memo:Xi(eo()),blockTime:$i(Xi(Ki()))}))),Al=ro({subscription:Ki(),result:Uc(ml)}),Ll=ro({pubkey:jc,account:ml}),El=ro({subscription:Ki(),result:Uc(Ll)}),xl=ro({parent:Ki(),slot:Ki(),root:Ki()}),Nl=ro({subscription:Ki(),result:xl}),Sl=io([ro({type:io([Ji("firstShredReceived"),Ji("completed"),Ji("optimisticConfirmation"),Ji("root")]),slot:Ki(),timestamp:Ki()}),ro({type:Ji("createdBank"),parent:Ki(),slot:Ki(),timestamp:Ki()}),ro({type:Ji("frozen"),slot:Ki(),timestamp:Ki(),stats:ro({numTransactionEntries:Ki(),numSuccessfulTransactions:Ki(),numFailedTransactions:Ki(),maxTransactionsPerEntry:Ki()})}),ro({type:Ji("dead"),slot:Ki(),timestamp:Ki(),err:eo()})]),Il=ro({subscription:Ki(),result:Sl}),Tl=ro({subscription:Ki(),result:Uc(io([Jc,Xc]))}),Cl=ro({subscription:Ki(),result:Ki()}),jl=ro({pubkey:eo(),gossip:Xi(eo()),tpu:Xi(eo()),rpc:Xi(eo()),version:Xi(eo())}),Dl=ro({votePubkey:eo(),nodePubkey:eo(),activatedStake:Ki(),epochVoteAccount:Gi(),epochCredits:qi(no([Ki(),Ki(),Ki()])),commission:Ki(),lastVote:Ki(),rootSlot:Xi(Ki())}),Ol=Bc(ro({current:qi(Dl),delinquent:qi(Dl)})),_l=io([Ji("processed"),Ji("confirmed"),Ji("finalized")]),zl=ro({slot:Ki(),confirmations:Xi(Ki()),err:Zc,confirmationStatus:$i(_l)}),Pl=Rc(qi(Xi(zl))),Bl=Bc(Ki()),Rl=ro({accountKey:jc,writableIndexes:qi(Ki()),readonlyIndexes:qi(Ki())}),Ul=ro({signatures:qi(eo()),message:ro({accountKeys:qi(eo()),header:ro({numRequiredSignatures:Ki(),numReadonlySignedAccounts:Ki(),numReadonlyUnsignedAccounts:Ki()}),instructions:qi(ro({accounts:qi(Ki()),data:eo(),programIdIndex:Ki()})),recentBlockhash:eo(),addressTableLookups:$i(qi(Rl))})}),Wl=ro({pubkey:jc,signer:Gi(),writable:Gi(),source:$i(io([Ji("transaction"),Ji("lookupTable")]))}),Ql=ro({accountKeys:qi(Wl),signatures:qi(eo())}),Fl=ro({parsed:oo(),program:eo(),programId:jc}),Yl=ro({accounts:qi(jc),data:eo(),programId:jc}),Hl=ao(io([Yl,Fl]),io([ro({parsed:oo(),program:eo(),programId:eo()}),ro({accounts:qi(eo()),data:eo(),programId:eo()})]),(function(t){return Fi(t,"accounts"in t?Yl:Fl)})),Vl=ro({signatures:qi(eo()),message:ro({accountKeys:qi(Wl),instructions:qi(Hl),recentBlockhash:eo(),addressTableLookups:$i(Xi(qi(Rl)))})}),ql=ro({accountIndex:Ki(),mint:eo(),owner:$i(eo()),uiTokenAmount:cl}),Gl=ro({writable:qi(jc),readonly:qi(jc)}),Zl=ro({err:Zc,fee:Ki(),innerInstructions:$i(Xi(qi(ro({index:Ki(),instructions:qi(ro({accounts:qi(Ki()),data:eo(),programIdIndex:Ki()}))})))),preBalances:qi(Ki()),postBalances:qi(Ki()),logMessages:$i(Xi(qi(eo()))),preTokenBalances:$i(Xi(qi(ql))),postTokenBalances:$i(Xi(qi(ql))),loadedAddresses:$i(Gl),computeUnitsConsumed:$i(Ki())}),Jl=ro({err:Zc,fee:Ki(),innerInstructions:$i(Xi(qi(ro({index:Ki(),instructions:qi(Hl)})))),preBalances:qi(Ki()),postBalances:qi(Ki()),logMessages:$i(Xi(qi(eo()))),preTokenBalances:$i(Xi(qi(ql))),postTokenBalances:$i(Xi(qi(ql))),loadedAddresses:$i(Gl),computeUnitsConsumed:$i(Ki())}),Xl=io([Ji(0),Ji("legacy")]),Kl=ro({pubkey:eo(),lamports:Ki(),postBalance:Xi(Ki()),rewardType:Xi(eo()),commission:$i(Xi(Ki()))}),$l=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),transactions:qi(ro({transaction:Ul,meta:Xi(Zl),version:$i(Xl)})),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),th=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),eh=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),transactions:qi(ro({transaction:Ql,meta:Xi(Zl),version:$i(Xl)})),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),nh=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),transactions:qi(ro({transaction:Vl,meta:Xi(Jl),version:$i(Xl)})),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),rh=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),transactions:qi(ro({transaction:Ql,meta:Xi(Jl),version:$i(Xl)})),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),ih=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),rewards:$i(qi(Kl)),blockTime:Xi(Ki()),blockHeight:Xi(Ki())}))),oh=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),transactions:qi(ro({transaction:Ul,meta:Xi(Zl)})),rewards:$i(qi(Kl)),blockTime:Xi(Ki())}))),ah=Bc(Xi(ro({blockhash:eo(),previousBlockhash:eo(),parentSlot:Ki(),signatures:qi(eo()),blockTime:Xi(Ki())}))),sh=Bc(Xi(ro({slot:Ki(),meta:Zl,blockTime:$i(Xi(Ki())),transaction:Ul,version:$i(Xl)}))),uh=Bc(Xi(ro({slot:Ki(),transaction:Vl,meta:Xi(Jl),blockTime:$i(Xi(Ki())),version:$i(Xl)}))),ch=Rc(ro({blockhash:eo(),feeCalculator:ro({lamportsPerSignature:Ki()})})),lh=Rc(ro({blockhash:eo(),lastValidBlockHeight:Ki()})),hh=Bc(qi(ro({slot:Ki(),numTransactions:Ki(),numSlots:Ki(),samplePeriodSecs:Ki()}))),dh=Rc(Xi(ro({feeCalculator:ro({lamportsPerSignature:Ki()})}))),fh=Bc(eo()),ph=Bc(eo()),mh=ro({err:Zc,logs:qi(eo()),signature:eo()}),gh=ro({result:Uc(mh),subscription:Ki()}),yh={"solana-client":"js/".concat("0.0.0-development")},vh=function(){function t(e,n){var r,i,o,a,s,u,c,l=this;V(this,t),this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(r={},function(){var t=H(Q().mark((function t(e){var n,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=_c(e),o=i.commitment,a=i.config,s=l._buildArgs([],o,void 0,a),u=kc(s),r[u]=null!==(n=r[u])&&void 0!==n?n:H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,l._rpcRequest("getBlockHeight",s);case 3:if(e=t.sent,!("error"in(n=Fi(e,Bc(Ki()))))){t.next=7;break}throw new xc(n.error,"failed to get block height information");case 7:return t.abrupt("return",n.result);case 8:return t.prev=8,delete r[u],t.finish(8);case 11:case"end":return t.stop()}}),t,null,[[0,,8,11]])})))(),t.next=6,r[u];case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),n&&"string"==typeof n?this._commitment=n:n&&(this._commitment=n.commitment,this._confirmTransactionInitialTimeout=n.confirmTransactionInitialTimeout,i=n.wsEndpoint,o=n.httpHeaders,a=n.fetch,s=n.fetchMiddleware,u=n.disableRetryOnRateLimit,c=n.httpAgent),this._rpcEndpoint=function(t){if(!1===/^https?:/.test(t))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return t}(e),this._rpcWsEndpoint=i||function(t){var e=t.match(Cc);if(null==e)throw TypeError("Failed to validate endpoint URL `".concat(t,"`"));var n=at(e,4);n[0];var r=n[1],i=n[2],o=n[3],a=t.startsWith("https:")?"wss:":"ws:",s=null==i?null:parseInt(i.slice(1),10),u=null==s?"":":".concat(s+1);return"".concat(a,"//").concat(r).concat(u).concat(o)}(e),this._rpcClient=function(t,e,n,r,i,o){var a,s=n||Nc;null!=o&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments."),r&&(a=function(){var t=H(Q().mark((function t(e,n){var i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,new Promise((function(t,i){try{r(e,n,(function(e,n){return t([e,n])}))}catch(t){i(t)}}));case 2:return i=t.sent,t.next=5,s.apply(void 0,st(i));case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}());var u=new Fo(function(){var n=H(Q().mark((function n(r,o){var u,c,l,h,d;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:u={method:"POST",body:r,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},e||{},yh)},n.prev=1,c=5,h=500;case 4:if(!a){n.next=10;break}return n.next=7,a(t,u);case 7:l=n.sent,n.next=13;break;case 10:return n.next=12,s(t,u);case 12:l=n.sent;case 13:if(429===l.status){n.next=15;break}return n.abrupt("break",26);case 15:if(!0!==i){n.next=17;break}return n.abrupt("break",26);case 17:if(0!=(c-=1)){n.next=20;break}return n.abrupt("break",26);case 20:return console.log("Server responded with ".concat(l.status," ").concat(l.statusText,". Retrying after ").concat(h,"ms delay...")),n.next=23,ic(h);case 23:h*=2;case 24:n.next=4;break;case 26:return n.next=28,l.text();case 28:d=n.sent,l.ok?o(null,d):o(new Error("".concat(l.status," ").concat(l.statusText,": ").concat(d))),n.next=35;break;case 32:n.prev=32,n.t0=n.catch(1),n.t0 instanceof Error&&o(n.t0);case 35:case"end":return n.stop()}}),n,null,[[1,32]])})));return function(t,e){return n.apply(this,arguments)}}(),{});return u}(e,o,a,s,u,c),this._rpcRequest=function(t){return function(e,n){return new Promise((function(r,i){t.request(e,n,(function(t,e){t?i(t):r(e)}))}))}}(this._rpcClient),this._rpcBatchRequest=function(t){return function(e){return new Promise((function(n,r){0===e.length&&n([]);var i=e.map((function(e){return t.request(e.methodName,e.args)}));t.request(i,(function(t,e){t?r(t):n(e)}))}))}}(this._rpcClient),this._rpcWebSocket=new Sc(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}var e,n,r,i,o,a,s,u,c,l,h,d,f,p,m,g,y,v,w,b,M,k,A,L,E,x,N,S,I,T,C,j,D,O,_,z,P,B,R,U,Y,q,Z,J,X,K,$,tt,et,rt,it,ot,ut,ct,lt,ht,dt,ft,pt,mt,gt,yt,vt,wt,bt,Mt,kt,At,Lt,Et,xt,Nt,St,It,Ct,jt,Dt,Ot,_t,zt,Pt,Bt,Rt,Ut,Wt,Qt,Ft,Yt;return G(t,[{key:"commitment",get:function(){return this._commitment}},{key:"rpcEndpoint",get:function(){return this._rpcEndpoint}},{key:"getBalanceAndContext",value:(Yt=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgs([e.toBase58()],i,void 0,o),t.next=4,this._rpcRequest("getBalance",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,Rc(Ki()))))){t.next=8;break}throw new xc(u.error,"failed to get balance for ".concat(e.toBase58()));case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return Yt.apply(this,arguments)})},{key:"getBalance",value:(Ft=H(Q().mark((function t(e,n){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getBalanceAndContext(e,n).then((function(t){return t.value})).catch((function(t){throw new Error("failed to get balance of account "+e.toBase58()+": "+t)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return Ft.apply(this,arguments)})},{key:"getBlockTime",value:(Qt=H(Q().mark((function t(e){var n,r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getBlockTime",[e]);case 2:if(n=t.sent,!("error"in(r=Fi(n,Bc(Xi(Ki())))))){t.next=6;break}throw new xc(r.error,"failed to get block time for slot ".concat(e));case 6:return t.abrupt("return",r.result);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return Qt.apply(this,arguments)})},{key:"getMinimumLedgerSlot",value:(Wt=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("minimumLedgerSlot",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,Bc(Ki()))))){t.next=6;break}throw new xc(n.error,"failed to get minimum ledger slot");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return Wt.apply(this,arguments)})},{key:"getFirstAvailableBlock",value:(Ut=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getFirstAvailableBlock",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,sl)))){t.next=6;break}throw new xc(n.error,"failed to get first available block");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return Ut.apply(this,arguments)})},{key:"getSupply",value:(Rt=H(Q().mark((function t(e){var n,r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={},n="string"==typeof e?{commitment:e}:e?W(W({},e),{},{commitment:e&&e.commitment||this.commitment}):{commitment:this.commitment},t.next=4,this._rpcRequest("getSupply",[n]);case 4:if(r=t.sent,!("error"in(i=Fi(r,ul)))){t.next=8;break}throw new xc(i.error,"failed to get supply");case 8:return t.abrupt("return",i.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return Rt.apply(this,arguments)})},{key:"getTokenSupply",value:(Bt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgs([e.toBase58()],n),t.next=3,this._rpcRequest("getTokenSupply",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,Rc(cl))))){t.next=7;break}throw new xc(o.error,"failed to get token supply");case 7:return t.abrupt("return",o.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return Bt.apply(this,arguments)})},{key:"getTokenAccountBalance",value:(Pt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgs([e.toBase58()],n),t.next=3,this._rpcRequest("getTokenAccountBalance",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,Rc(cl))))){t.next=7;break}throw new xc(o.error,"failed to get token account balance");case 7:return t.abrupt("return",o.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return Pt.apply(this,arguments)})},{key:"getTokenAccountsByOwner",value:(zt=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c,l;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=_c(r),o=i.commitment,a=i.config,s=[e.toBase58()],"mint"in n?s.push({mint:n.mint.toBase58()}):s.push({programId:n.programId.toBase58()}),u=this._buildArgs(s,o,"base64",a),t.next=6,this._rpcRequest("getTokenAccountsByOwner",u);case 6:if(c=t.sent,!("error"in(l=Fi(c,hl)))){t.next=10;break}throw new xc(l.error,"failed to get token accounts owned by account ".concat(e.toBase58()));case 10:return t.abrupt("return",l.result);case 11:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return zt.apply(this,arguments)})},{key:"getParsedTokenAccountsByOwner",value:(_t=H(Q().mark((function t(e,n,r){var i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=[e.toBase58()],"mint"in n?i.push({mint:n.mint.toBase58()}):i.push({programId:n.programId.toBase58()}),o=this._buildArgs(i,r,"jsonParsed"),t.next=5,this._rpcRequest("getTokenAccountsByOwner",o);case 5:if(a=t.sent,!("error"in(s=Fi(a,fl)))){t.next=9;break}throw new xc(s.error,"failed to get token accounts owned by account ".concat(e.toBase58()));case 9:return t.abrupt("return",s.result);case 10:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return _t.apply(this,arguments)})},{key:"getLargestAccounts",value:(Ot=H(Q().mark((function t(e){var n,r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=W(W({},e),{},{commitment:e&&e.commitment||this.commitment}),r=n.filter||n.commitment?[n]:[],t.next=4,this._rpcRequest("getLargestAccounts",r);case 4:if(i=t.sent,!("error"in(o=Fi(i,pl)))){t.next=8;break}throw new xc(o.error,"failed to get largest accounts");case 8:return t.abrupt("return",o.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return Ot.apply(this,arguments)})},{key:"getTokenLargestAccounts",value:(Dt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgs([e.toBase58()],n),t.next=3,this._rpcRequest("getTokenLargestAccounts",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,ll)))){t.next=7;break}throw new xc(o.error,"failed to get token largest accounts");case 7:return t.abrupt("return",o.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return Dt.apply(this,arguments)})},{key:"getAccountInfoAndContext",value:(jt=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgs([e.toBase58()],i,"base64",o),t.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,Rc(Xi(ml)))))){t.next=8;break}throw new xc(u.error,"failed to get info about account ".concat(e.toBase58()));case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return jt.apply(this,arguments)})},{key:"getParsedAccountInfo",value:(Ct=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgs([e.toBase58()],i,"jsonParsed",o),t.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,Rc(Xi(vl)))))){t.next=8;break}throw new xc(u.error,"failed to get info about account ".concat(e.toBase58()));case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return Ct.apply(this,arguments)})},{key:"getAccountInfo",value:(It=H(Q().mark((function t(e,n){var r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getAccountInfoAndContext(e,n);case 3:return r=t.sent,t.abrupt("return",r.value);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("failed to get info about account "+e.toBase58()+": "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t,e){return It.apply(this,arguments)})},{key:"getMultipleParsedAccounts",value:(St=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=e.map((function(t){return t.toBase58()})),s=this._buildArgs([a],i,"jsonParsed",o),t.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=t.sent,!("error"in(c=Fi(u,Rc(qi(Xi(vl))))))){t.next=9;break}throw new xc(c.error,"failed to get info for accounts ".concat(a));case 9:return t.abrupt("return",c.result);case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return St.apply(this,arguments)})},{key:"getMultipleAccountsInfoAndContext",value:(Nt=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=e.map((function(t){return t.toBase58()})),s=this._buildArgs([a],i,"base64",o),t.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=t.sent,!("error"in(c=Fi(u,Rc(qi(Xi(ml))))))){t.next=9;break}throw new xc(c.error,"failed to get info for accounts ".concat(a));case 9:return t.abrupt("return",c.result);case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return Nt.apply(this,arguments)})},{key:"getMultipleAccountsInfo",value:(xt=H(Q().mark((function t(e,n){var r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getMultipleAccountsInfoAndContext(e,n);case 2:return r=t.sent,t.abrupt("return",r.value);case 4:case"end":return t.stop()}}),t,this)}))),function(t,e){return xt.apply(this,arguments)})},{key:"getStakeActivation",value:(Et=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=_c(n),o=i.commitment,a=i.config,s=this._buildArgs([e.toBase58()],o,void 0,W(W({},a),{},{epoch:null!=r?r:null==a?void 0:a.epoch})),t.next=4,this._rpcRequest("getStakeActivation",s);case 4:if(u=t.sent,!("error"in(c=Fi(u,Bc(bl))))){t.next=8;break}throw new xc(c.error,"failed to get Stake Activation ".concat(e.toBase58()));case 8:return t.abrupt("return",c.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return Et.apply(this,arguments)})},{key:"getProgramAccounts",value:(Lt=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c,l,h;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,s=(a=o||{}).encoding,u=nt(a,ou),c=this._buildArgs([e.toBase58()],i,s||"base64",u),t.next=5,this._rpcRequest("getProgramAccounts",c);case 5:if(l=t.sent,!("error"in(h=Fi(l,Bc(qi(gl)))))){t.next=9;break}throw new xc(h.error,"failed to get accounts owned by program ".concat(e.toBase58()));case 9:return t.abrupt("return",h.result);case 10:case"end":return t.stop()}}),t,this)}))),function(t,e){return Lt.apply(this,arguments)})},{key:"getParsedProgramAccounts",value:(At=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgs([e.toBase58()],i,"jsonParsed",o),t.next=4,this._rpcRequest("getProgramAccounts",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,Bc(qi(wl)))))){t.next=8;break}throw new xc(u.error,"failed to get accounts owned by program ".concat(e.toBase58()));case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return At.apply(this,arguments)})},{key:"confirmTransaction",value:(kt=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("string"!=typeof e){t.next=4;break}r=e,t.next=8;break;case 4:if(null===(i=(o=e).abortSignal)||void 0===i||!i.aborted){t.next=7;break}return t.abrupt("return",Promise.reject(o.abortSignal.reason));case 7:r=o.signature;case 8:t.prev=8,a=qn.decode(r),t.next=15;break;case 12:throw t.prev=12,t.t0=t.catch(8),new Error("signature must be base58 encoded: "+r);case 15:if(zu(64===a.length,"signature has invalid length"),"string"!=typeof e){t.next=22;break}return t.next=19,this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:n||this.commitment,signature:r});case 19:return t.abrupt("return",t.sent);case 22:if(!("lastValidBlockHeight"in e)){t.next=28;break}return t.next=25,this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:n||this.commitment,strategy:e});case 25:return t.abrupt("return",t.sent);case 28:return t.next=30,this.confirmTransactionUsingDurableNonceStrategy({commitment:n||this.commitment,strategy:e});case 30:return t.abrupt("return",t.sent);case 31:case"end":return t.stop()}}),t,this,[[8,12]])}))),function(t,e){return kt.apply(this,arguments)})},{key:"getCancellationPromise",value:function(t){return new Promise((function(e,n){null!=t&&(t.aborted?n(t.reason):t.addEventListener("abort",(function(){n(t.reason)})))}))}},{key:"getTransactionConfirmationPromise",value:function(t){var e,n,r=this,i=t.commitment,o=t.signature,a=!1;return{abortConfirmation:function(){n&&(n(),n=void 0),null!=e&&(r.removeSignatureListener(e),e=void 0)},confirmationPromise:new Promise((function(t,s){try{e=r.onSignature(o,(function(n,r){e=void 0;var i={context:r,value:n};t({__type:Pu.PROCESSED,response:i})}),i);var u=new Promise((function(t){null==e?t():n=r._onSubscriptionStateChange(e,(function(e){"subscribed"===e&&t()}))}));H(Q().mark((function e(){var n,c,l;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u;case 2:if(!a){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,r.getSignatureStatus(o);case 6:if(n=e.sent,!a){e.next=9;break}return e.abrupt("return");case 9:if(null!=n){e.next=11;break}return e.abrupt("return");case 11:if(c=n.context,null!=(l=n.value)){e.next=14;break}return e.abrupt("return");case 14:if(null==l||!l.err){e.next=18;break}s(l.err),e.next=29;break;case 18:e.t0=i,e.next="confirmed"===e.t0||"single"===e.t0||"singleGossip"===e.t0?21:"finalized"===e.t0||"max"===e.t0||"root"===e.t0?24:("processed"===e.t0||e.t0,27);break;case 21:if("processed"!==l.confirmationStatus){e.next=23;break}return e.abrupt("return");case 23:return e.abrupt("break",27);case 24:if("processed"!==l.confirmationStatus&&"confirmed"!==l.confirmationStatus){e.next=26;break}return e.abrupt("return");case 26:return e.abrupt("break",27);case 27:a=!0,t({__type:Pu.PROCESSED,response:{context:c,value:l}});case 29:case"end":return e.stop()}}),e)})))()}catch(t){s(t)}}))}}},{key:"confirmTransactionUsingBlockHeightExceedanceStrategy",value:(Mt=H(Q().mark((function t(e){var n,r,i,o,a,s,u,c,l,h,d,f,p,m=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.commitment,r=e.strategy,i=r.abortSignal,o=r.lastValidBlockHeight,a=r.signature,s=!1,u=new Promise((function(t){var e=function(){var t=H(Q().mark((function t(){var e;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m.getBlockHeight(n);case 3:return e=t.sent,t.abrupt("return",e);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",-1);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(){return t.apply(this,arguments)}}();H(Q().mark((function n(){var r;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e();case 2:if(r=n.sent,!s){n.next=5;break}return n.abrupt("return");case 5:if(!(r<=o)){n.next=17;break}return n.next=8,ic(1e3);case 8:if(!s){n.next=10;break}return n.abrupt("return");case 10:return n.next=12,e();case 12:if(r=n.sent,!s){n.next=15;break}return n.abrupt("return");case 15:n.next=5;break;case 17:t({__type:Pu.BLOCKHEIGHT_EXCEEDED});case 18:case"end":return n.stop()}}),n)})))()})),c=this.getTransactionConfirmationPromise({commitment:n,signature:a}),l=c.abortConfirmation,h=c.confirmationPromise,d=this.getCancellationPromise(i),t.prev=5,t.next=8,Promise.race([d,h,u]);case 8:if((p=t.sent).__type!==Pu.PROCESSED){t.next=13;break}f=p.response,t.next=14;break;case 13:throw new xu(a);case 14:return t.prev=14,s=!0,l(),t.finish(14);case 18:return t.abrupt("return",f);case 19:case"end":return t.stop()}}),t,this,[[5,,14,18]])}))),function(t){return Mt.apply(this,arguments)})},{key:"confirmTransactionUsingDurableNonceStrategy",value:(bt=H(Q().mark((function t(e){var n,r,i,o,a,s,u,c,l,h,d,f,p,m,g,y,v,w,b,M,k,A=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.commitment,r=e.strategy,i=r.abortSignal,o=r.minContextSlot,a=r.nonceAccountPubkey,s=r.nonceValue,u=r.signature,c=!1,l=new Promise((function(t){var e=s,r=null,i=function(){var t=H(Q().mark((function t(){var i,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,A.getNonceAndContext(a,{commitment:n,minContextSlot:o});case 3:return i=t.sent,s=i.context,u=i.value,r=s.slot,t.abrupt("return",null==u?void 0:u.nonce);case 10:return t.prev=10,t.t0=t.catch(0),t.abrupt("return",e);case 13:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(){return t.apply(this,arguments)}}();H(Q().mark((function n(){return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i();case 2:if(e=n.sent,!c){n.next=5;break}return n.abrupt("return");case 5:if(s===e){n.next=9;break}return t({__type:Pu.NONCE_INVALID,slotInWhichNonceDidAdvance:r}),n.abrupt("return");case 9:return n.next=11,ic(2e3);case 11:if(!c){n.next=13;break}return n.abrupt("return");case 13:return n.next=15,i();case 15:if(e=n.sent,!c){n.next=18;break}return n.abrupt("return");case 18:n.next=5;break;case 20:case"end":return n.stop()}}),n)})))()})),h=this.getTransactionConfirmationPromise({commitment:n,signature:u}),d=h.abortConfirmation,f=h.confirmationPromise,p=this.getCancellationPromise(i),t.prev=5,t.next=8,Promise.race([p,f,l]);case 8:if((g=t.sent).__type!==Pu.PROCESSED){t.next=13;break}m=g.response,t.next=47;break;case 13:return t.next=16,this.getSignatureStatus(u);case 16:if(null!=(b=t.sent)){t.next=19;break}return t.abrupt("break",27);case 19:if(!(b.context.slot<(null!==(w=g.slotInWhichNonceDidAdvance)&&void 0!==w?w:o))){t.next=23;break}return t.next=22,ic(400);case 22:return t.abrupt("continue",13);case 23:return v=b,t.abrupt("break",27);case 27:if(null===(y=v)||void 0===y||!y.value){t.next=46;break}M=n||"finalized",k=v.value.confirmationStatus,t.t0=M,t.next="processed"===t.t0||"recent"===t.t0?33:"confirmed"===t.t0||"single"===t.t0||"singleGossip"===t.t0?36:"finalized"===t.t0||"max"===t.t0||"root"===t.t0?39:42;break;case 33:if("processed"===k||"confirmed"===k||"finalized"===k){t.next=35;break}throw new Su(u);case 35:case 38:case 41:return t.abrupt("break",43);case 36:if("confirmed"===k||"finalized"===k){t.next=38;break}throw new Su(u);case 39:if("finalized"===k){t.next=41;break}throw new Su(u);case 42:case 43:m={context:v.context,value:{err:v.value.err}},t.next=47;break;case 46:throw new Su(u);case 47:return t.prev=47,c=!0,d(),t.finish(47);case 51:return t.abrupt("return",m);case 52:case"end":return t.stop()}}),t,this,[[5,,47,51]])}))),function(t){return bt.apply(this,arguments)})},{key:"confirmTransactionUsingLegacyTimeoutStrategy",value:(wt=H(Q().mark((function t(e){var n,r,i,o,a,s,u,c,l,h=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.commitment,r=e.signature,o=new Promise((function(t){var e=h._confirmTransactionInitialTimeout||6e4;switch(n){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":e=h._confirmTransactionInitialTimeout||3e4}i=setTimeout((function(){return t({__type:Pu.TIMED_OUT,timeoutMs:e})}),e)})),a=this.getTransactionConfirmationPromise({commitment:n,signature:r}),s=a.abortConfirmation,u=a.confirmationPromise,t.prev=3,t.next=6,Promise.race([u,o]);case 6:if((l=t.sent).__type!==Pu.PROCESSED){t.next=11;break}c=l.response,t.next=12;break;case 11:throw new Nu(r,l.timeoutMs/1e3);case 12:return t.prev=12,clearTimeout(i),s(),t.finish(12);case 16:return t.abrupt("return",c);case 17:case"end":return t.stop()}}),t,this,[[3,,12,16]])}))),function(t){return wt.apply(this,arguments)})},{key:"getClusterNodes",value:(vt=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getClusterNodes",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,Bc(qi(jl)))))){t.next=6;break}throw new xc(n.error,"failed to get cluster nodes");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return vt.apply(this,arguments)})},{key:"getVoteAccounts",value:(yt=H(Q().mark((function t(e){var n,r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._buildArgs([],e),t.next=3,this._rpcRequest("getVoteAccounts",n);case 3:if(r=t.sent,!("error"in(i=Fi(r,Ol)))){t.next=7;break}throw new xc(i.error,"failed to get vote accounts");case 7:return t.abrupt("return",i.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t){return yt.apply(this,arguments)})},{key:"getSlot",value:(gt=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),t.next=4,this._rpcRequest("getSlot",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,Bc(Ki()))))){t.next=8;break}throw new xc(s.error,"failed to get slot");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return gt.apply(this,arguments)})},{key:"getSlotLeader",value:(mt=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),t.next=4,this._rpcRequest("getSlotLeader",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,Bc(eo()))))){t.next=8;break}throw new xc(s.error,"failed to get slot leader");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return mt.apply(this,arguments)})},{key:"getSlotLeaders",value:(pt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[e,n],t.next=3,this._rpcRequest("getSlotLeaders",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,Bc(qi(jc)))))){t.next=7;break}throw new xc(o.error,"failed to get slot leaders");case 7:return t.abrupt("return",o.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return pt.apply(this,arguments)})},{key:"getSignatureStatus",value:(ft=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSignatureStatuses([e],n);case 2:return r=t.sent,i=r.context,zu(1===(o=r.value).length),a=o[0],t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return ft.apply(this,arguments)})},{key:"getSignatureStatuses",value:(dt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=[e],n&&r.push(n),t.next=4,this._rpcRequest("getSignatureStatuses",r);case 4:if(i=t.sent,!("error"in(o=Fi(i,Pl)))){t.next=8;break}throw new xc(o.error,"failed to get signature status");case 8:return t.abrupt("return",o.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return dt.apply(this,arguments)})},{key:"getTransactionCount",value:(ht=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),t.next=4,this._rpcRequest("getTransactionCount",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,Bc(Ki()))))){t.next=8;break}throw new xc(s.error,"failed to get transaction count");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return ht.apply(this,arguments)})},{key:"getTotalSupply",value:(lt=H(Q().mark((function t(e){var n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getSupply({commitment:e,excludeNonCirculatingAccountsList:!0});case 2:return n=t.sent,t.abrupt("return",n.value.total);case 4:case"end":return t.stop()}}),t,this)}))),function(t){return lt.apply(this,arguments)})},{key:"getInflationGovernor",value:(ct=H(Q().mark((function t(e){var n,r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._buildArgs([],e),t.next=3,this._rpcRequest("getInflationGovernor",n);case 3:if(r=t.sent,!("error"in(i=Fi(r,el)))){t.next=7;break}throw new xc(i.error,"failed to get inflation");case 7:return t.abrupt("return",i.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t){return ct.apply(this,arguments)})},{key:"getInflationReward",value:(ut=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=_c(r),o=i.commitment,a=i.config,s=this._buildArgs([e.map((function(t){return t.toBase58()}))],o,void 0,W(W({},a),{},{epoch:null!=n?n:null==a?void 0:a.epoch})),t.next=4,this._rpcRequest("getInflationReward",s);case 4:if(u=t.sent,!("error"in(c=Fi(u,Fc)))){t.next=8;break}throw new xc(c.error,"failed to get inflation reward");case 8:return t.abrupt("return",c.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return ut.apply(this,arguments)})},{key:"getInflationRate",value:(ot=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getInflationRate",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,nl)))){t.next=6;break}throw new xc(n.error,"failed to get inflation rate");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return ot.apply(this,arguments)})},{key:"getEpochInfo",value:(it=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),t.next=4,this._rpcRequest("getEpochInfo",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,il)))){t.next=8;break}throw new xc(s.error,"failed to get epoch info");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return it.apply(this,arguments)})},{key:"getEpochSchedule",value:(rt=H(Q().mark((function t(){var e,n,r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getEpochSchedule",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,ol)))){t.next=6;break}throw new xc(n.error,"failed to get epoch schedule");case 6:return r=n.result,t.abrupt("return",new Lc(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot));case 8:case"end":return t.stop()}}),t,this)}))),function(){return rt.apply(this,arguments)})},{key:"getLeaderSchedule",value:(et=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getLeaderSchedule",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,al)))){t.next=6;break}throw new xc(n.error,"failed to get leader schedule");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return et.apply(this,arguments)})},{key:"getMinimumBalanceForRentExemption",value:(tt=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgs([e],n),t.next=3,this._rpcRequest("getMinimumBalanceForRentExemption",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,Bl)))){t.next=8;break}return console.warn("Unable to fetch minimum balance for rent exemption"),t.abrupt("return",0);case 8:return t.abrupt("return",o.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return tt.apply(this,arguments)})},{key:"getRecentBlockhashAndContext",value:($=H(Q().mark((function t(e){var n,r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=this._buildArgs([],e),t.next=3,this._rpcRequest("getRecentBlockhash",n);case 3:if(r=t.sent,!("error"in(i=Fi(r,ch)))){t.next=7;break}throw new xc(i.error,"failed to get recent blockhash");case 7:return t.abrupt("return",i.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t){return $.apply(this,arguments)})},{key:"getRecentPerformanceSamples",value:(K=H(Q().mark((function t(e){var n,r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getRecentPerformanceSamples",e?[e]:[]);case 2:if(n=t.sent,!("error"in(r=Fi(n,hh)))){t.next=6;break}throw new xc(r.error,"failed to get recent performance samples");case 6:return t.abrupt("return",r.result);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return K.apply(this,arguments)})},{key:"getFeeCalculatorForBlockhash",value:(X=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgs([e],n),t.next=3,this._rpcRequest("getFeeCalculatorForBlockhash",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,dh)))){t.next=7;break}throw new xc(o.error,"failed to get fee calculator");case 7:return a=o.result,s=a.context,u=a.value,t.abrupt("return",{context:s,value:null!==u?u.feeCalculator:null});case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return X.apply(this,arguments)})},{key:"getFeeForMessage",value:(J=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=pu(e.serialize()).toString("base64"),i=this._buildArgs([r],n),t.next=4,this._rpcRequest("getFeeForMessage",i);case 4:if(o=t.sent,!("error"in(a=Fi(o,Rc(Xi(Ki())))))){t.next=8;break}throw new xc(a.error,"failed to get fee for message");case 8:if(null!==a.result){t.next=10;break}throw new Error("invalid blockhash");case 10:return t.abrupt("return",a.result);case 11:case"end":return t.stop()}}),t,this)}))),function(t,e){return J.apply(this,arguments)})},{key:"getRecentPrioritizationFees",value:(Z=H(Q().mark((function t(e){var n,r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=null==e||null===(n=e.lockedWritableAccounts)||void 0===n?void 0:n.map((function(t){return t.toBase58()})),i=this._buildArgs(null!=r&&r.length?[r]:[]),t.next=4,this._rpcRequest("getRecentPrioritizationFees",i);case 4:if(o=t.sent,!("error"in(a=Fi(o,rl)))){t.next=8;break}throw new xc(a.error,"failed to get recent prioritization fees");case 8:return t.abrupt("return",a.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return Z.apply(this,arguments)})},{key:"getRecentBlockhash",value:(q=H(Q().mark((function t(e){var n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getRecentBlockhashAndContext(e);case 3:return n=t.sent,t.abrupt("return",n.value);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("failed to get recent blockhash: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t){return q.apply(this,arguments)})},{key:"getLatestBlockhash",value:(Y=H(Q().mark((function t(e){var n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.getLatestBlockhashAndContext(e);case 3:return n=t.sent,t.abrupt("return",n.value);case 7:throw t.prev=7,t.t0=t.catch(0),new Error("failed to get recent blockhash: "+t.t0);case 10:case"end":return t.stop()}}),t,this,[[0,7]])}))),function(t){return Y.apply(this,arguments)})},{key:"getLatestBlockhashAndContext",value:(U=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),t.next=4,this._rpcRequest("getLatestBlockhash",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,lh)))){t.next=8;break}throw new xc(s.error,"failed to get latest blockhash");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return U.apply(this,arguments)})},{key:"getVersion",value:(R=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getVersion",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,Bc(Kc))))){t.next=6;break}throw new xc(n.error,"failed to get version");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return R.apply(this,arguments)})},{key:"getGenesisHash",value:(B=H(Q().mark((function t(){var e,n;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("getGenesisHash",[]);case 2:if(e=t.sent,!("error"in(n=Fi(e,Bc(eo()))))){t.next=6;break}throw new xc(n.error,"failed to get genesis hash");case 6:return t.abrupt("return",n.result);case 7:case"end":return t.stop()}}),t,this)}))),function(){return B.apply(this,arguments)})},{key:"getBlock",value:(P=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c,l,h;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([e],i,void 0,o),t.next=4,this._rpcRequest("getBlock",a);case 4:s=t.sent,t.prev=5,t.t0=null==o?void 0:o.transactionDetails,t.next="accounts"===t.t0?9:"none"===t.t0?13:17;break;case 9:if(!("error"in(u=Fi(s,eh)))){t.next=12;break}throw u.error;case 12:return t.abrupt("return",u.result);case 13:if(!("error"in(c=Fi(s,th)))){t.next=16;break}throw c.error;case 16:return t.abrupt("return",c.result);case 17:if(!("error"in(l=Fi(s,$l)))){t.next=20;break}throw l.error;case 20:return h=l.result,t.abrupt("return",h?W(W({},h),{},{transactions:h.transactions.map((function(t){var e=t.transaction,n=t.meta,r=t.version;return{meta:n,transaction:W(W({},e),{},{message:Wc(r,e.message)}),version:r}}))}):null);case 22:t.next=27;break;case 24:throw t.prev=24,t.t1=t.catch(5),new xc(t.t1,"failed to get confirmed block");case 27:case"end":return t.stop()}}),t,this,[[5,24]])}))),function(t,e){return P.apply(this,arguments)})},{key:"getParsedBlock",value:(z=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c,l;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([e],i,"jsonParsed",o),t.next=4,this._rpcRequest("getBlock",a);case 4:s=t.sent,t.prev=5,t.t0=null==o?void 0:o.transactionDetails,t.next="accounts"===t.t0?9:"none"===t.t0?13:17;break;case 9:if(!("error"in(u=Fi(s,rh)))){t.next=12;break}throw u.error;case 12:return t.abrupt("return",u.result);case 13:if(!("error"in(c=Fi(s,ih)))){t.next=16;break}throw c.error;case 16:return t.abrupt("return",c.result);case 17:if(!("error"in(l=Fi(s,nh)))){t.next=20;break}throw l.error;case 20:return t.abrupt("return",l.result);case 21:t.next=26;break;case 23:throw t.prev=23,t.t1=t.catch(5),new xc(t.t1,"failed to get block");case 26:case"end":return t.stop()}}),t,this,[[5,23]])}))),function(t,e){return z.apply(this,arguments)})},{key:"getBlockProduction",value:(_=H(Q().mark((function t(e){var n,r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return"string"==typeof e?r=e:e&&(i=e.commitment,o=nt(e,au),r=i,n=o),a=this._buildArgs([],r,"base64",n),t.next=4,this._rpcRequest("getBlockProduction",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,tl)))){t.next=8;break}throw new xc(u.error,"failed to get block production information");case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return _.apply(this,arguments)})},{key:"getTransaction",value:(O=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([e],i,void 0,o),t.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,sh)))){t.next=8;break}throw new xc(u.error,"failed to get transaction");case 8:if(c=u.result){t.next=11;break}return t.abrupt("return",c);case 11:return t.abrupt("return",W(W({},c),{},{transaction:W(W({},c.transaction),{},{message:Wc(c.version,c.transaction.message)})}));case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return O.apply(this,arguments)})},{key:"getParsedTransaction",value:(D=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([e],i,"jsonParsed",o),t.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=t.sent,!("error"in(u=Fi(s,uh)))){t.next=8;break}throw new xc(u.error,"failed to get transaction");case 8:return t.abrupt("return",u.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t,e){return D.apply(this,arguments)})},{key:"getParsedTransactions",value:(j=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=e.map((function(t){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([t],i,"jsonParsed",o)}})),t.next=4,this._rpcBatchRequest(a);case 4:return s=t.sent,u=s.map((function(t){var e=Fi(t,uh);if("error"in e)throw new xc(e.error,"failed to get transactions");return e.result})),t.abrupt("return",u);case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return j.apply(this,arguments)})},{key:"getTransactions",value:(C=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=_c(n),i=r.commitment,o=r.config,a=e.map((function(t){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([t],i,void 0,o)}})),t.next=4,this._rpcBatchRequest(a);case 4:return s=t.sent,u=s.map((function(t){var e=Fi(t,sh);if("error"in e)throw new xc(e.error,"failed to get transactions");var n=e.result;return n?W(W({},n),{},{transaction:W(W({},n.transaction),{},{message:Wc(n.version,n.transaction.message)})}):n})),t.abrupt("return",u);case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return C.apply(this,arguments)})},{key:"getConfirmedBlock",value:(T=H(Q().mark((function t(e,n){var r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgsAtLeastConfirmed([e],n),t.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,oh)))){t.next=7;break}throw new xc(o.error,"failed to get confirmed block");case 7:if(a=o.result){t.next=10;break}throw new Error("Confirmed block "+e+" not found");case 10:return s=W(W({},a),{},{transactions:a.transactions.map((function(t){var e=t.transaction,n=t.meta,r=new Ru(e.message);return{meta:n,transaction:W(W({},e),{},{message:r})}}))}),t.abrupt("return",W(W({},s),{},{transactions:s.transactions.map((function(t){var e=t.transaction;return{meta:t.meta,transaction:Yu.populate(e.message,e.signatures)}}))}));case 12:case"end":return t.stop()}}),t,this)}))),function(t,e){return T.apply(this,arguments)})},{key:"getBlocks",value:(I=H(Q().mark((function t(e,n,r){var i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed(void 0!==n?[e,n]:[e],r),t.next=3,this._rpcRequest("getBlocks",i);case 3:if(o=t.sent,!("error"in(a=Fi(o,Bc(qi(Ki())))))){t.next=7;break}throw new xc(a.error,"failed to get blocks");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return I.apply(this,arguments)})},{key:"getBlockSignatures",value:(S=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgsAtLeastConfirmed([e],n,void 0,{transactionDetails:"signatures",rewards:!1}),t.next=3,this._rpcRequest("getBlock",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,ah)))){t.next=7;break}throw new xc(o.error,"failed to get block");case 7:if(a=o.result){t.next=10;break}throw new Error("Block "+e+" not found");case 10:return t.abrupt("return",a);case 11:case"end":return t.stop()}}),t,this)}))),function(t,e){return S.apply(this,arguments)})},{key:"getConfirmedBlockSignatures",value:(N=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgsAtLeastConfirmed([e],n,void 0,{transactionDetails:"signatures",rewards:!1}),t.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,ah)))){t.next=7;break}throw new xc(o.error,"failed to get confirmed block");case 7:if(a=o.result){t.next=10;break}throw new Error("Confirmed block "+e+" not found");case 10:return t.abrupt("return",a);case 11:case"end":return t.stop()}}),t,this)}))),function(t,e){return N.apply(this,arguments)})},{key:"getConfirmedTransaction",value:(x=H(Q().mark((function t(e,n){var r,i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgsAtLeastConfirmed([e],n),t.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,sh)))){t.next=7;break}throw new xc(o.error,"failed to get transaction");case 7:if(a=o.result){t.next=10;break}return t.abrupt("return",a);case 10:return s=new Ru(a.transaction.message),u=a.transaction.signatures,t.abrupt("return",W(W({},a),{},{transaction:Yu.populate(s,u)}));case 13:case"end":return t.stop()}}),t,this)}))),function(t,e){return x.apply(this,arguments)})},{key:"getParsedConfirmedTransaction",value:(E=H(Q().mark((function t(e,n){var r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this._buildArgsAtLeastConfirmed([e],n,"jsonParsed"),t.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=t.sent,!("error"in(o=Fi(i,uh)))){t.next=7;break}throw new xc(o.error,"failed to get confirmed transaction");case 7:return t.abrupt("return",o.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return E.apply(this,arguments)})},{key:"getParsedConfirmedTransactions",value:(L=H(Q().mark((function t(e,n){var r,i,o,a=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.map((function(t){return{methodName:"getConfirmedTransaction",args:a._buildArgsAtLeastConfirmed([t],n,"jsonParsed")}})),t.next=3,this._rpcBatchRequest(r);case 3:return i=t.sent,o=i.map((function(t){var e=Fi(t,uh);if("error"in e)throw new xc(e.error,"failed to get confirmed transactions");return e.result})),t.abrupt("return",o);case 6:case"end":return t.stop()}}),t,this)}))),function(t,e){return L.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress",value:(A=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i={},t.next=3,this.getFirstAvailableBlock();case 3:o=t.sent;case 4:if("until"in i){t.next=24;break}if(!(--n<=0||n<o)){t.next=8;break}return t.abrupt("break",24);case 8:return t.prev=8,t.next=11,this.getConfirmedBlockSignatures(n,"finalized");case 11:(a=t.sent).signatures.length>0&&(i.until=a.signatures[a.signatures.length-1].toString()),t.next=22;break;case 15:if(t.prev=15,t.t0=t.catch(8),!(t.t0 instanceof Error&&t.t0.message.includes("skipped"))){t.next=21;break}return t.abrupt("continue",4);case 21:throw t.t0;case 22:t.next=4;break;case 24:return t.next=26,this.getSlot("finalized");case 26:s=t.sent;case 27:if("before"in i){t.next=47;break}if(!(++r>s)){t.next=31;break}return t.abrupt("break",47);case 31:return t.prev=31,t.next=34,this.getConfirmedBlockSignatures(r);case 34:(u=t.sent).signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString()),t.next=45;break;case 38:if(t.prev=38,t.t1=t.catch(31),!(t.t1 instanceof Error&&t.t1.message.includes("skipped"))){t.next=44;break}return t.abrupt("continue",27);case 44:throw t.t1;case 45:t.next=27;break;case 47:return t.next=49,this.getConfirmedSignaturesForAddress2(e,i);case 49:return c=t.sent,t.abrupt("return",c.map((function(t){return t.signature})));case 51:case"end":return t.stop()}}),t,this,[[8,15],[31,38]])}))),function(t,e,n){return A.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress2",value:(k=H(Q().mark((function t(e,n,r){var i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getConfirmedSignaturesForAddress2",i);case 3:if(o=t.sent,!("error"in(a=Fi(o,Ml)))){t.next=7;break}throw new xc(a.error,"failed to get confirmed signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return k.apply(this,arguments)})},{key:"getSignaturesForAddress",value:(M=H(Q().mark((function t(e,n,r){var i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this._buildArgsAtLeastConfirmed([e.toBase58()],r,void 0,n),t.next=3,this._rpcRequest("getSignaturesForAddress",i);case 3:if(o=t.sent,!("error"in(a=Fi(o,kl)))){t.next=7;break}throw new xc(a.error,"failed to get signatures for address");case 7:return t.abrupt("return",a.result);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return M.apply(this,arguments)})},{key:"getAddressLookupTable",value:(b=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=new Ic({key:e,state:Ic.deserialize(o.data)})),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return b.apply(this,arguments)})},{key:"getNonceAndContext",value:(w=H(Q().mark((function t(e,n){var r,i,o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getAccountInfoAndContext(e,n);case 2:return r=t.sent,i=r.context,o=r.value,a=null,null!==o&&(a=hc.fromAccountData(o.data)),t.abrupt("return",{context:i,value:a});case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return w.apply(this,arguments)})},{key:"getNonce",value:(v=H(Q().mark((function t(e,n){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getNonceAndContext(e,n).then((function(t){return t.value})).catch((function(t){throw new Error("failed to get nonce for account "+e.toBase58()+": "+t)}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t,this)}))),function(t,e){return v.apply(this,arguments)})},{key:"requestAirdrop",value:(y=H(Q().mark((function t(e,n){var r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._rpcRequest("requestAirdrop",[e.toBase58(),n]);case 2:if(r=t.sent,!("error"in(i=Fi(r,fh)))){t.next=6;break}throw new xc(i.error,"airdrop to ".concat(e.toBase58()," failed"));case 6:return t.abrupt("return",i.result);case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return y.apply(this,arguments)})},{key:"_blockhashWithExpiryBlockHeight",value:(g=H(Q().mark((function t(e){var n,r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=10;break}case 1:if(!this._pollingBlockhash){t.next=6;break}return t.next=4,ic(100);case 4:t.next=1;break;case 6:if(n=Date.now()-this._blockhashInfo.lastFetch,r=n>=3e4,null===this._blockhashInfo.latestBlockhash||r){t.next=10;break}return t.abrupt("return",this._blockhashInfo.latestBlockhash);case 10:return t.next=12,this._pollNewBlockhash();case 12:return t.abrupt("return",t.sent);case 13:case"end":return t.stop()}}),t,this)}))),function(t){return g.apply(this,arguments)})},{key:"_pollNewBlockhash",value:(m=H(Q().mark((function t(){var e,n,r,i,o;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._pollingBlockhash=!0,t.prev=1,e=Date.now(),n=this._blockhashInfo.latestBlockhash,r=n?n.blockhash:null,i=0;case 6:if(!(i<50)){t.next=18;break}return t.next=9,this.getLatestBlockhash("finalized");case 9:if(o=t.sent,r===o.blockhash){t.next=13;break}return this._blockhashInfo={latestBlockhash:o,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},t.abrupt("return",o);case 13:return t.next=15,ic(200);case 15:i++,t.next=6;break;case 18:throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-e,"ms"));case 19:return t.prev=19,this._pollingBlockhash=!1,t.finish(19);case 22:case"end":return t.stop()}}),t,this,[[1,,19,22]])}))),function(){return m.apply(this,arguments)})},{key:"getStakeMinimumDelegation",value:(p=H(Q().mark((function t(e){var n,r,i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=_c(e),r=n.commitment,i=n.config,o=this._buildArgs([],r,"base64",i),t.next=4,this._rpcRequest("getStakeMinimumDelegation",o);case 4:if(a=t.sent,!("error"in(s=Fi(a,Rc(Ki()))))){t.next=8;break}throw new xc(s.error,"failed to get stake minimum delegation");case 8:return t.abrupt("return",s.result);case 9:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"simulateTransaction",value:(f=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c,l,h,d,f,p,m,g,y,v,w,b,M,k,A,L,E,x,N,S,I;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("message"in e)){t.next=17;break}if(i=e.serialize(),o=Tt.from(i).toString("base64"),!Array.isArray(n)&&void 0===r){t.next=6;break}throw new Error("Invalid arguments");case 6:return(a=n||{}).encoding="base64","commitment"in a||(a.commitment=this.commitment),s=[o,a],t.next=12,this._rpcRequest("simulateTransaction",s);case 12:if(u=t.sent,!("error"in(c=Fi(u,$c)))){t.next=16;break}throw new Error("failed to simulate transaction: "+c.error.message);case 16:return t.abrupt("return",c.result);case 17:if(e instanceof Yu?(h=e,(l=new Yu).feePayer=h.feePayer,l.instructions=e.instructions,l.nonceInfo=h.nonceInfo,l.signatures=h.signatures):(l=Yu.populate(e))._message=l._json=void 0,void 0===n||Array.isArray(n)){t.next=20;break}throw new Error("Invalid arguments");case 20:if(d=n,!l.nonceInfo||!d){t.next=25;break}(f=l).sign.apply(f,st(d)),t.next=45;break;case 25:p=this._disableBlockhashCaching;case 26:return t.next=28,this._blockhashWithExpiryBlockHeight(p);case 28:if(g=t.sent,l.lastValidBlockHeight=g.lastValidBlockHeight,l.recentBlockhash=g.blockhash,d){t.next=33;break}return t.abrupt("break",45);case 33:if((m=l).sign.apply(m,st(d)),l.signature){t.next=36;break}throw new Error("!signature");case 36:if(y=l.signature.toString("base64"),this._blockhashInfo.simulatedSignatures.includes(y)||this._blockhashInfo.transactionSignatures.includes(y)){t.next=42;break}return this._blockhashInfo.simulatedSignatures.push(y),t.abrupt("break",45);case 42:p=!0;case 43:t.next=26;break;case 45:return v=l._compile(),w=v.serialize(),b=l._serialize(w),M=b.toString("base64"),k={encoding:"base64",commitment:this.commitment},r&&(A=(Array.isArray(r)?r:v.nonProgramIds()).map((function(t){return t.toBase58()})),k.accounts={encoding:"base64",addresses:A}),d&&(k.sigVerify=!0),L=[M,k],t.next=55,this._rpcRequest("simulateTransaction",L);case 55:if(E=t.sent,!("error"in(x=Fi(E,$c)))){t.next=60;break}throw"data"in x.error&&(N=x.error.data.logs)&&Array.isArray(N)&&(I=(S="\n ")+N.join(S),console.error(x.error.message,I)),new Ec("failed to simulate transaction: "+x.error.message,N);case 60:return t.abrupt("return",x.result);case 61:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return f.apply(this,arguments)})},{key:"sendTransaction",value:(d=H(Q().mark((function t(e,n,r){var i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!("version"in e)){t.next=7;break}if(!n||!Array.isArray(n)){t.next=3;break}throw new Error("Invalid arguments");case 3:return i=e.serialize(),t.next=6,this.sendRawTransaction(i,n);case 6:return t.abrupt("return",t.sent);case 7:if(void 0!==n&&Array.isArray(n)){t.next=9;break}throw new Error("Invalid arguments");case 9:if(o=n,!e.nonceInfo){t.next=14;break}e.sign.apply(e,st(o)),t.next=32;break;case 14:a=this._disableBlockhashCaching;case 15:return t.next=17,this._blockhashWithExpiryBlockHeight(a);case 17:if(s=t.sent,e.lastValidBlockHeight=s.lastValidBlockHeight,e.recentBlockhash=s.blockhash,e.sign.apply(e,st(o)),e.signature){t.next=23;break}throw new Error("!signature");case 23:if(u=e.signature.toString("base64"),this._blockhashInfo.transactionSignatures.includes(u)){t.next=29;break}return this._blockhashInfo.transactionSignatures.push(u),t.abrupt("break",32);case 29:a=!0;case 30:t.next=15;break;case 32:return c=e.serialize(),t.next=35,this.sendRawTransaction(c,r);case 35:return t.abrupt("return",t.sent);case 36:case"end":return t.stop()}}),t,this)}))),function(t,e,n){return d.apply(this,arguments)})},{key:"sendRawTransaction",value:(h=H(Q().mark((function t(e,n){var r,i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=pu(e).toString("base64"),t.next=3,this.sendEncodedTransaction(r,n);case 3:return i=t.sent,t.abrupt("return",i);case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return h.apply(this,arguments)})},{key:"sendEncodedTransaction",value:(l=H(Q().mark((function t(e,n){var r,i,o,a,s,u,c;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={encoding:"base64"},i=n&&n.skipPreflight,o=n&&n.preflightCommitment||this.commitment,n&&null!=n.maxRetries&&(r.maxRetries=n.maxRetries),n&&null!=n.minContextSlot&&(r.minContextSlot=n.minContextSlot),i&&(r.skipPreflight=i),o&&(r.preflightCommitment=o),a=[e,r],t.next=10,this._rpcRequest("sendTransaction",a);case 10:if(s=t.sent,!("error"in(u=Fi(s,ph)))){t.next=15;break}throw"data"in u.error&&(c=u.error.data.logs),new Ec("failed to send transaction: "+u.error.message,c);case 15:return t.abrupt("return",u.result);case 16:case"end":return t.stop()}}),t,this)}))),function(t,e){return l.apply(this,arguments)})},{key:"_wsOnOpen",value:function(){var t=this;this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((function(){H(Q().mark((function e(){return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t._rpcWebSocket.notify("ping");case 3:e.next=7;break;case 5:e.prev=5,e.t0=e.catch(0);case 7:case"end":return e.stop()}}),e,null,[[0,5]])})))()}),5e3),this._updateSubscriptions()}},{key:"_wsOnError",value:function(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}},{key:"_wsOnClose",value:function(t){var e=this;this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),1e3!==t?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((function(t){var n=at(t,2),r=n[0],i=n[1];e._setSubscription(r,W(W({},i),{},{state:"pending"}))}))):this._updateSubscriptions()}},{key:"_setSubscription",value:function(t,e){var n,r=null===(n=this._subscriptionsByHash[t])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[t]=e,r!==e.state){var i=this._subscriptionStateChangeCallbacksByHash[t];i&&i.forEach((function(t){try{t(e.state)}catch(t){}}))}}},{key:"_onSubscriptionStateChange",value:function(t,e){var n,r=this,i=this._subscriptionHashByClientSubscriptionId[t];if(null==i)return function(){};var o=(n=this._subscriptionStateChangeCallbacksByHash)[i]||(n[i]=new Set);return o.add(e),function(){o.delete(e),0===o.size&&delete r._subscriptionStateChangeCallbacksByHash[i]}}},{key:"_updateSubscriptions",value:(c=H(Q().mark((function t(){var e,n,r=this;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(0!==Object.keys(this._subscriptionsByHash).length){t.next=3;break}return this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((function(){r._rpcWebSocketIdleTimeout=null;try{r._rpcWebSocket.close()}catch(t){t instanceof Error&&console.log("Error when closing socket connection: ".concat(t.message))}}),500)),t.abrupt("return");case 3:if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),this._rpcWebSocketConnected){t.next=7;break}return this._rpcWebSocket.connect(),t.abrupt("return");case 7:return e=this._rpcWebSocketGeneration,n=function(){return e===r._rpcWebSocketGeneration},t.next=11,Promise.all(Object.keys(this._subscriptionsByHash).map(function(){var t=H(Q().mark((function t(e){var i;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(i=r._subscriptionsByHash[e])){t.next=3;break}return t.abrupt("return");case 3:t.t0=i.state,t.next="pending"===t.t0||"unsubscribed"===t.t0?6:"subscribed"===t.t0?15:19;break;case 6:if(0!==i.callbacks.size){t.next=12;break}return delete r._subscriptionsByHash[e],"unsubscribed"===i.state&&delete r._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],t.next=11,r._updateSubscriptions();case 11:return t.abrupt("return");case 12:return t.next=14,H(Q().mark((function t(){var o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=i.args,a=i.method,t.prev=1,r._setSubscription(e,W(W({},i),{},{state:"subscribing"})),t.next=5,r._rpcWebSocket.call(a,o);case 5:return s=t.sent,r._setSubscription(e,W(W({},i),{},{serverSubscriptionId:s,state:"subscribed"})),r._subscriptionCallbacksByServerSubscriptionId[s]=i.callbacks,t.next=10,r._updateSubscriptions();case 10:t.next=20;break;case 12:if(t.prev=12,t.t0=t.catch(1),t.t0 instanceof Error&&console.error("".concat(a," error for argument"),o,t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,W(W({},i),{},{state:"pending"})),t.next=20,r._updateSubscriptions();case 20:case"end":return t.stop()}}),t,null,[[1,12]])})))();case 14:case 18:return t.abrupt("break",19);case 15:if(0!==i.callbacks.size){t.next=18;break}return t.next=18,H(Q().mark((function t(){var o,a;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=i.serverSubscriptionId,a=i.unsubscribeMethod,!r._subscriptionsAutoDisposedByRpc.has(o)){t.next=5;break}r._subscriptionsAutoDisposedByRpc.delete(o),t.next=21;break;case 5:return r._setSubscription(e,W(W({},i),{},{state:"unsubscribing"})),r._setSubscription(e,W(W({},i),{},{state:"unsubscribing"})),t.prev=7,t.next=10,r._rpcWebSocket.call(a,[o]);case 10:t.next=21;break;case 12:if(t.prev=12,t.t0=t.catch(7),t.t0 instanceof Error&&console.error("".concat(a," error:"),t.t0.message),n()){t.next=17;break}return t.abrupt("return");case 17:return r._setSubscription(e,W(W({},i),{},{state:"subscribed"})),t.next=20,r._updateSubscriptions();case 20:return t.abrupt("return");case 21:return r._setSubscription(e,W(W({},i),{},{state:"unsubscribed"})),t.next=24,r._updateSubscriptions();case 24:case"end":return t.stop()}}),t,null,[[7,12]])})))();case 19:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 11:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)})},{key:"_handleServerNotification",value:function(t,e){var n=this._subscriptionCallbacksByServerSubscriptionId[t];void 0!==n&&n.forEach((function(t){try{t.apply(void 0,st(e))}catch(t){console.error(t)}}))}},{key:"_wsOnAccountNotification",value:function(t){var e=Fi(t,Al),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_makeSubscription",value:function(t,e){var n=this,r=this._nextClientSubscriptionId++,i=kc([t.method,e]),o=this._subscriptionsByHash[i];return void 0===o?this._subscriptionsByHash[i]=W(W({},t),{},{args:e,callbacks:new Set([t.callback]),state:"pending"}):o.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=H(Q().mark((function e(){var o;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return delete n._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete n._subscriptionHashByClientSubscriptionId[r],zu(void 0!==(o=n._subscriptionsByHash[i]),"Could not find a `Subscription` when tearing down client subscription #".concat(r)),o.callbacks.delete(t.callback),e.next=7,n._updateSubscriptions();case 7:case"end":return e.stop()}}),e)}))),this._updateSubscriptions(),r}},{key:"onAccountChange",value:function(t,e,n){var r=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:e,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}},{key:"removeAccountChangeListener",value:(u=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return u.apply(this,arguments)})},{key:"_wsOnProgramAccountNotification",value:function(t){var e=Fi(t,El),n=e.result,r=e.subscription;this._handleServerNotification(r,[{accountId:n.value.pubkey,accountInfo:n.value.account},n.context])}},{key:"onProgramAccountChange",value:function(t,e,n,r){var i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:e,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}},{key:"removeProgramAccountChangeListener",value:(s=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"program account change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"onLogs",value:function(t,e,n){var r=this._buildArgs(["object"===F(t)?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:e,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}},{key:"removeOnLogsListener",value:(a=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"logs");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"_wsOnLogsNotification",value:function(t){var e=Fi(t,gh),n=e.result,r=e.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_wsOnSlotNotification",value:function(t){var e=Fi(t,Nl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotChange",value:function(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}},{key:"removeSlotChangeListener",value:(o=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"_wsOnSlotUpdatesNotification",value:function(t){var e=Fi(t,Il),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotUpdate",value:function(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}},{key:"removeSlotUpdateListener",value:(i=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"slot update");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"_unsubscribeClientSubscription",value:(r=H(Q().mark((function t(e,n){var r;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(r=this._subscriptionDisposeFunctionsByClientSubscriptionId[e])){t.next=6;break}return t.next=4,r();case 4:t.next=7;break;case 6:console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(e,"` for '").concat(n,"' events ")+"could not be found.");case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return r.apply(this,arguments)})},{key:"_buildArgs",value:function(t,e,n,r){var i=e||this._commitment;if(i||n||r){var o={};n&&(o.encoding=n),i&&(o.commitment=i),r&&(o=Object.assign(o,r)),t.push(o)}return t}},{key:"_buildArgsAtLeastConfirmed",value:function(t,e,n,r){var i=e||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,e,n,r)}},{key:"_wsOnSignatureNotification",value:function(t){var e=Fi(t,Tl),n=e.result,r=e.subscription;"receivedSignature"!==n.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===n.value?[{type:"received"},n.context]:[{type:"status",result:n.value},n.context])}},{key:"onSignature",value:function(t,e,n){var r=this,i=this._buildArgs([t],n||this._commitment||"finalized"),o=this._makeSubscription({callback:function(t,n){if("status"===t.type){e(t.result,n);try{r.removeSignatureListener(o)}catch(t){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return o}},{key:"onSignatureWithOptions",value:function(t,e,n){var r=this,i=W(W({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),o=i.commitment,a=nt(i,su),s=this._buildArgs([t],o,void 0,a),u=this._makeSubscription({callback:function(t,n){e(t,n);try{r.removeSignatureListener(u)}catch(t){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return u}},{key:"removeSignatureListener",value:(n=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"signature result");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"_wsOnRootNotification",value:function(t){var e=Fi(t,Cl),n=e.result,r=e.subscription;this._handleServerNotification(r,[n])}},{key:"onRootChange",value:function(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}},{key:"removeRootChangeListener",value:(e=H(Q().mark((function t(e){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._unsubscribeClientSubscription(e,"root change");case 2:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),t}(),wh=function(){function t(e){V(this,t),this._keypair=void 0,this._keypair=null!=e?e:cu()}return G(t,[{key:"publicKey",get:function(){return new bu(this._keypair.publicKey)}},{key:"secretKey",get:function(){return new Uint8Array(this._keypair.secretKey)}}],[{key:"generate",value:function(){return new t(cu())}},{key:"fromSecretKey",value:function(e,n){if(64!==e.byteLength)throw new Error("bad secret key size");var r=e.slice(32,64);if(!n||!n.skipValidation)for(var i=e.slice(0,32),o=lu(i),a=0;a<32;a++)if(r[a]!==o[a])throw new Error("provided secretKey is invalid");return new t({publicKey:r,secretKey:e})}},{key:"fromSeed",value:function(e){var n=lu(e),r=new Uint8Array(64);return r.set(e),r.set(n,32),new t({publicKey:n,secretKey:r})}}]),t}(),bh=Object.freeze({CreateLookupTable:{index:0,layout:Ei([ki("instruction"),dc("recentSlot"),bi("bumpSeed")])},FreezeLookupTable:{index:1,layout:Ei([ki("instruction")])},ExtendLookupTable:{index:2,layout:Ei([ki("instruction"),dc(),xi(Tu(),wi(ki(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Ei([ki("instruction")])},CloseLookupTable:{index:4,layout:Ei([ki("instruction")])}}),Mh=function(){function t(){V(this,t)}return G(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=ki("instruction").decode(t.data),r=0,i=Object.entries(bh);r<i.length;r++){var o=at(i[r],2),a=o[0];if(o[1].index==n){e=a;break}}if(!e)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return e}},{key:"decodeCreateLookupTable",value:function(t){this.checkProgramId(t.programId),this.checkKeysLength(t.keys,4);var e=ac(bh.CreateLookupTable,t.data).recentSlot;return{authority:t.keys[1].pubkey,payer:t.keys[2].pubkey,recentSlot:Number(e)}}},{key:"decodeExtendLookupTable",value:function(t){if(this.checkProgramId(t.programId),t.keys.length<2)throw new Error("invalid instruction; found ".concat(t.keys.length," keys, expected at least 2"));var e=ac(bh.ExtendLookupTable,t.data).addresses;return{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,payer:t.keys.length>2?t.keys[2].pubkey:void 0,addresses:e.map((function(t){return new bu(t)}))}}},{key:"decodeCloseLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,3),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey,recipient:t.keys[2].pubkey}}},{key:"decodeFreezeLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"decodeDeactivateLookupTable",value:function(t){return this.checkProgramId(t.programId),this.checkKeysLength(t.keys,2),{lookupTable:t.keys[0].pubkey,authority:t.keys[1].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(kh.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}},{key:"checkKeysLength",value:function(t,e){if(t.length<e)throw new Error("invalid instruction; found ".concat(t.length," keys, expected at least ").concat(e))}}]),t}(),kh=function(){function t(){V(this,t)}return G(t,null,[{key:"createLookupTable",value:function(t){var e=at(bu.findProgramAddressSync([t.authority.toBuffer(),Ti(BigInt(t.recentSlot),8)],this.programId),2),n=e[0],r=e[1],i=oc(bh.CreateLookupTable,{recentSlot:BigInt(t.recentSlot),bumpSeed:r}),o=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:mc.programId,isSigner:!1,isWritable:!1}];return[new Fu({programId:this.programId,keys:o,data:i}),n]}},{key:"freezeLookupTable",value:function(t){var e=oc(bh.FreezeLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Fu({programId:this.programId,keys:n,data:e})}},{key:"extendLookupTable",value:function(t){var e=oc(bh.ExtendLookupTable,{addresses:t.addresses.map((function(t){return t.toBytes()}))}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:mc.programId,isSigner:!1,isWritable:!1}),new Fu({programId:this.programId,keys:n,data:e})}},{key:"deactivateLookupTable",value:function(t){var e=oc(bh.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Fu({programId:this.programId,keys:n,data:e})}},{key:"closeLookupTable",value:function(t){var e=oc(bh.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new Fu({programId:this.programId,keys:n,data:e})}}]),t}();kh.programId=new bu("AddressLookupTab1e1111111111111111111111111");var Ah=function(){function t(){V(this,t)}return G(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=bi("instruction").decode(t.data),r=0,i=Object.entries(Lh);r<i.length;r++){var o=at(i[r],2),a=o[0];if(o[1].index==n){e=a;break}}if(!e)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return e}},{key:"decodeRequestUnits",value:function(t){this.checkProgramId(t.programId);var e=ac(Lh.RequestUnits,t.data);return{units:e.units,additionalFee:e.additionalFee}}},{key:"decodeRequestHeapFrame",value:function(t){return this.checkProgramId(t.programId),{bytes:ac(Lh.RequestHeapFrame,t.data).bytes}}},{key:"decodeSetComputeUnitLimit",value:function(t){return this.checkProgramId(t.programId),{units:ac(Lh.SetComputeUnitLimit,t.data).units}}},{key:"decodeSetComputeUnitPrice",value:function(t){return this.checkProgramId(t.programId),{microLamports:ac(Lh.SetComputeUnitPrice,t.data).microLamports}}},{key:"checkProgramId",value:function(t){if(!t.equals(Eh.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}]),t}(),Lh=Object.freeze({RequestUnits:{index:0,layout:Ei([bi("instruction"),ki("units"),ki("additionalFee")])},RequestHeapFrame:{index:1,layout:Ei([bi("instruction"),ki("bytes")])},SetComputeUnitLimit:{index:2,layout:Ei([bi("instruction"),ki("units")])},SetComputeUnitPrice:{index:3,layout:Ei([bi("instruction"),dc("microLamports")])}}),Eh=function(){function t(){V(this,t)}return G(t,null,[{key:"requestUnits",value:function(t){var e=oc(Lh.RequestUnits,t);return new Fu({keys:[],programId:this.programId,data:e})}},{key:"requestHeapFrame",value:function(t){var e=oc(Lh.RequestHeapFrame,t);return new Fu({keys:[],programId:this.programId,data:e})}},{key:"setComputeUnitLimit",value:function(t){var e=oc(Lh.SetComputeUnitLimit,t);return new Fu({keys:[],programId:this.programId,data:e})}},{key:"setComputeUnitPrice",value:function(t){var e=oc(Lh.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new Fu({keys:[],programId:this.programId,data:e})}}]),t}();Eh.programId=new bu("ComputeBudget111111111111111111111111111111");var xh=Ei([bi("numSignatures"),bi("padding"),Mi("signatureOffset"),Mi("signatureInstructionIndex"),Mi("publicKeyOffset"),Mi("publicKeyInstructionIndex"),Mi("messageDataOffset"),Mi("messageDataSize"),Mi("messageInstructionIndex")]),Nh=function(){function t(){V(this,t)}return G(t,null,[{key:"createInstructionWithPublicKey",value:function(e){var n=e.publicKey,r=e.message,i=e.signature,o=e.instructionIndex;zu(32===n.length,"Public Key must be ".concat(32," bytes but received ").concat(n.length," bytes")),zu(64===i.length,"Signature must be ".concat(64," bytes but received ").concat(i.length," bytes"));var a=xh.span,s=a+n.length,u=s+i.length,c=Tt.alloc(u+r.length),l=null==o?65535:o;return xh.encode({numSignatures:1,padding:0,signatureOffset:s,signatureInstructionIndex:l,publicKeyOffset:a,publicKeyInstructionIndex:l,messageDataOffset:u,messageDataSize:r.length,messageInstructionIndex:l},c),c.fill(n,a),c.fill(i,s),c.fill(r,u),new Fu({keys:[],programId:t.programId,data:c})}},{key:"createInstructionWithPrivateKey",value:function(t){var e=t.privateKey,n=t.message,r=t.instructionIndex;zu(64===e.length,"Private key must be ".concat(64," bytes but received ").concat(e.length," bytes"));try{var i=wh.fromSecretKey(e),o=i.publicKey.toBytes(),a=du(n,i.secretKey);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,instructionIndex:r})}catch(t){throw new Error("Error creating instruction; ".concat(t))}}}]),t}();Nh.programId=new bu("Ed25519SigVerify111111111111111111111111111"),ru.hmacSha256Sync=function(t){for(var e=es.create(tr,t),n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.forEach((function(t){return e.update(t)})),e.digest()};ru.isValidPrivateKey;var Sh=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return ks.fromPrivateKey(t).toRawBytes(e)},Ih=Ei([bi("numSignatures"),Mi("signatureOffset"),bi("signatureInstructionIndex"),Mi("ethAddressOffset"),bi("ethAddressInstructionIndex"),Mi("messageDataOffset"),Mi("messageDataSize"),bi("messageInstructionIndex"),Ni(20,"ethAddress"),Ni(64,"signature"),bi("recoveryId")]),Th=function(){function t(){V(this,t)}return G(t,null,[{key:"publicKeyToEthAddress",value:function(t){zu(64===t.length,"Public key must be ".concat(64," bytes but received ").concat(t.length," bytes"));try{return Tt.from(Ka(pu(t))).slice(-20)}catch(t){throw new Error("Error constructing Ethereum address: ".concat(t))}}},{key:"createInstructionWithPublicKey",value:function(e){var n=e.publicKey,r=e.message,i=e.signature,o=e.recoveryId,a=e.instructionIndex;return t.createInstructionWithEthAddress({ethAddress:t.publicKeyToEthAddress(n),message:r,signature:i,recoveryId:o,instructionIndex:a})}},{key:"createInstructionWithEthAddress",value:function(e){var n,r=e.ethAddress,i=e.message,o=e.signature,a=e.recoveryId,s=e.instructionIndex,u=void 0===s?0:s;zu(20===(n="string"==typeof r?r.startsWith("0x")?Tt.from(r.substr(2),"hex"):Tt.from(r,"hex"):r).length,"Address must be ".concat(20," bytes but received ").concat(n.length," bytes"));var c=12+n.length,l=c+o.length+1,h=Tt.alloc(Ih.span+i.length);return Ih.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:u,ethAddressOffset:12,ethAddressInstructionIndex:u,messageDataOffset:l,messageDataSize:i.length,messageInstructionIndex:u,signature:pu(o),ethAddress:pu(n),recoveryId:a},h),h.fill(pu(i),Ih.span),new Fu({keys:[],programId:t.programId,data:h})}},{key:"createInstructionWithPrivateKey",value:function(t){var e=t.privateKey,n=t.message,r=t.instructionIndex;zu(32===e.length,"Private key must be ".concat(32," bytes but received ").concat(e.length," bytes"));try{var i=pu(e),o=Sh(i,!1).slice(1),a=Tt.from(Ka(pu(n))),s=at(Ks(a,i,{der:!1,recovered:!0}),2),u=s[0],c=s[1];return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:u,recoveryId:c,instructionIndex:r})}catch(t){throw new Error("Error creating instruction; ".concat(t))}}}]),t}();Th.programId=new bu("KeccakSecp256k11111111111111111111111111111");var Ch=new bu("StakeConfig11111111111111111111111111111111"),jh=G((function t(e,n){V(this,t),this.staker=void 0,this.withdrawer=void 0,this.staker=e,this.withdrawer=n})),Dh=G((function t(e,n,r){V(this,t),this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=n,this.custodian=r}));Dh.default=new Dh(0,0,bu.default);var Oh=function(){function t(){V(this,t)}return G(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=ki("instruction").decode(t.data),r=0,i=Object.entries(_h);r<i.length;r++){var o=at(i[r],2),a=o[0];if(o[1].index==n){e=a;break}}if(!e)throw new Error("Instruction type incorrect; not a StakeInstruction");return e}},{key:"decodeInitialize",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(_h.Initialize,t.data),n=e.authorized,r=e.lockup;return{stakePubkey:t.keys[0].pubkey,authorized:new jh(new bu(n.staker),new bu(n.withdrawer)),lockup:new Dh(r.unixTimestamp,r.epoch,new bu(r.custodian))}}},{key:"decodeDelegate",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,6),ac(_h.Delegate,t.data),{stakePubkey:t.keys[0].pubkey,votePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[5].pubkey}}},{key:"decodeAuthorize",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(_h.Authorize,t.data),n=e.newAuthorized,r=e.stakeAuthorizationType,i={stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new bu(n),stakeAuthorizationType:{index:r}};return t.keys.length>3&&(i.custodianPubkey=t.keys[3].pubkey),i}},{key:"decodeAuthorizeWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,2);var e=ac(_h.AuthorizeWithSeed,t.data),n=e.newAuthorized,r=e.stakeAuthorizationType,i=e.authoritySeed,o=e.authorityOwner,a={stakePubkey:t.keys[0].pubkey,authorityBase:t.keys[1].pubkey,authoritySeed:i,authorityOwner:new bu(o),newAuthorizedPubkey:new bu(n),stakeAuthorizationType:{index:r}};return t.keys.length>3&&(a.custodianPubkey=t.keys[3].pubkey),a}},{key:"decodeSplit",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(_h.Split,t.data).lamports;return{stakePubkey:t.keys[0].pubkey,splitStakePubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[2].pubkey,lamports:e}}},{key:"decodeMerge",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),ac(_h.Merge,t.data),{stakePubkey:t.keys[0].pubkey,sourceStakePubKey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey}}},{key:"decodeWithdraw",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,5);var e=ac(_h.Withdraw,t.data).lamports,n={stakePubkey:t.keys[0].pubkey,toPubkey:t.keys[1].pubkey,authorizedPubkey:t.keys[4].pubkey,lamports:e};return t.keys.length>5&&(n.custodianPubkey=t.keys[5].pubkey),n}},{key:"decodeDeactivate",value:function(t){return this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3),ac(_h.Deactivate,t.data),{stakePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(Ph.programId))throw new Error("invalid instruction; programId is not StakeProgram")}},{key:"checkKeyLength",value:function(t,e){if(t.length<e)throw new Error("invalid instruction; found ".concat(t.length," keys, expected at least ").concat(e))}}]),t}(),_h=Object.freeze({Initialize:{index:0,layout:Ei([ki("instruction"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"authorized";return Ei([Tu("staker"),Tu("withdrawer")],t)}(),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return Ei([Li("unixTimestamp"),Li("epoch"),Tu("custodian")],t)}()])},Authorize:{index:1,layout:Ei([ki("instruction"),Tu("newAuthorized"),ki("stakeAuthorizationType")])},Delegate:{index:2,layout:Ei([ki("instruction")])},Split:{index:3,layout:Ei([ki("instruction"),Li("lamports")])},Withdraw:{index:4,layout:Ei([ki("instruction"),Li("lamports")])},Deactivate:{index:5,layout:Ei([ki("instruction")])},Merge:{index:7,layout:Ei([ki("instruction")])},AuthorizeWithSeed:{index:8,layout:Ei([ki("instruction"),Tu("newAuthorized"),ki("stakeAuthorizationType"),ju("authoritySeed"),Tu("authorityOwner")])}}),zh=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),Ph=function(){function t(){V(this,t)}return G(t,null,[{key:"initialize",value:function(t){var e=t.stakePubkey,n=t.authorized,r=t.lockup||Dh.default,i=oc(_h.Initialize,{authorized:{staker:pu(n.staker.toBuffer()),withdrawer:pu(n.withdrawer.toBuffer())},lockup:{unixTimestamp:r.unixTimestamp,epoch:r.epoch,custodian:pu(r.custodian.toBuffer())}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Xu,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new Fu(o)}},{key:"createAccountWithSeed",value:function(t){var e=new Yu;e.add(mc.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"createAccount",value:function(t){var e=new Yu;e.add(mc.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));var n=t.stakePubkey,r=t.authorized,i=t.lockup;return e.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"delegate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.votePubkey,i=oc(_h.Delegate);return(new Yu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:ec,isSigner:!1,isWritable:!1},{pubkey:Ch,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"authorize",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.stakeAuthorizationType,o=t.custodianPubkey,a=oc(_h.Authorize,{newAuthorized:pu(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Yu).add({keys:s,programId:this.programId,data:a})}},{key:"authorizeWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorityBase,r=t.authoritySeed,i=t.authorityOwner,o=t.newAuthorizedPubkey,a=t.stakeAuthorizationType,s=t.custodianPubkey,u=oc(_h.AuthorizeWithSeed,{newAuthorized:pu(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:pu(i.toBuffer())}),c=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:qu,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new Yu).add({keys:c,programId:this.programId,data:u})}},{key:"splitInstruction",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.lamports,o=oc(_h.Split,{lamports:i});return new Fu({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}},{key:"split",value:function(t){var e=new Yu;return e.add(mc.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}},{key:"splitWithSeed",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.splitStakePubkey,i=t.basePubkey,o=t.seed,a=t.lamports,s=new Yu;return s.add(mc.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}},{key:"merge",value:function(t){var e=t.stakePubkey,n=t.sourceStakePubKey,r=t.authorizedPubkey,i=oc(_h.Merge);return(new Yu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:ec,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"withdraw",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=t.toPubkey,i=t.lamports,o=t.custodianPubkey,a=oc(_h.Withdraw,{lamports:i}),s=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:ec,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Yu).add({keys:s,programId:this.programId,data:a})}},{key:"deactivate",value:function(t){var e=t.stakePubkey,n=t.authorizedPubkey,r=oc(_h.Deactivate);return(new Yu).add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}]),t}();Ph.programId=new bu("Stake11111111111111111111111111111111111111"),Ph.space=200;var Bh=G((function t(e,n,r,i){V(this,t),this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=e,this.authorizedVoter=n,this.authorizedWithdrawer=r,this.commission=i})),Rh=function(){function t(){V(this,t)}return G(t,null,[{key:"decodeInstructionType",value:function(t){this.checkProgramId(t.programId);for(var e,n=ki("instruction").decode(t.data),r=0,i=Object.entries(Uh);r<i.length;r++){var o=at(i[r],2),a=o[0];if(o[1].index==n){e=a;break}}if(!e)throw new Error("Instruction type incorrect; not a VoteInstruction");return e}},{key:"decodeInitializeAccount",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,4);var e=ac(Uh.InitializeAccount,t.data).voteInit;return{votePubkey:t.keys[0].pubkey,nodePubkey:t.keys[3].pubkey,voteInit:new Bh(new bu(e.nodePubkey),new bu(e.authorizedVoter),new bu(e.authorizedWithdrawer),e.commission)}}},{key:"decodeAuthorize",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(Uh.Authorize,t.data),n=e.newAuthorized,r=e.voteAuthorizationType;return{votePubkey:t.keys[0].pubkey,authorizedPubkey:t.keys[2].pubkey,newAuthorizedPubkey:new bu(n),voteAuthorizationType:{index:r}}}},{key:"decodeAuthorizeWithSeed",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(Uh.AuthorizeWithSeed,t.data).voteAuthorizeWithSeedArgs,n=e.currentAuthorityDerivedKeyOwnerPubkey,r=e.currentAuthorityDerivedKeySeed,i=e.newAuthorized,o=e.voteAuthorizationType;return{currentAuthorityDerivedKeyBasePubkey:t.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new bu(n),currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:new bu(i),voteAuthorizationType:{index:o},votePubkey:t.keys[0].pubkey}}},{key:"decodeWithdraw",value:function(t){this.checkProgramId(t.programId),this.checkKeyLength(t.keys,3);var e=ac(Uh.Withdraw,t.data).lamports;return{votePubkey:t.keys[0].pubkey,authorizedWithdrawerPubkey:t.keys[2].pubkey,lamports:e,toPubkey:t.keys[1].pubkey}}},{key:"checkProgramId",value:function(t){if(!t.equals(Qh.programId))throw new Error("invalid instruction; programId is not VoteProgram")}},{key:"checkKeyLength",value:function(t,e){if(t.length<e)throw new Error("invalid instruction; found ".concat(t.length," keys, expected at least ").concat(e))}}]),t}(),Uh=Object.freeze({InitializeAccount:{index:0,layout:Ei([ki("instruction"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteInit";return Ei([Tu("nodePubkey"),Tu("authorizedVoter"),Tu("authorizedWithdrawer"),bi("commission")],t)}()])},Authorize:{index:1,layout:Ei([ki("instruction"),Tu("newAuthorized"),ki("voteAuthorizationType")])},Withdraw:{index:3,layout:Ei([ki("instruction"),Li("lamports")])},AuthorizeWithSeed:{index:10,layout:Ei([ki("instruction"),function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return Ei([ki("voteAuthorizationType"),Tu("currentAuthorityDerivedKeyOwnerPubkey"),ju("currentAuthorityDerivedKeySeed"),Tu("newAuthorized")],t)}()])}}),Wh=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),Qh=function(){function t(){V(this,t)}return G(t,null,[{key:"initializeAccount",value:function(t){var e=t.votePubkey,n=t.nodePubkey,r=t.voteInit,i=oc(Uh.InitializeAccount,{voteInit:{nodePubkey:pu(r.nodePubkey.toBuffer()),authorizedVoter:pu(r.authorizedVoter.toBuffer()),authorizedWithdrawer:pu(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:Xu,isSigner:!1,isWritable:!1},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new Fu(o)}},{key:"createAccount",value:function(t){var e=new Yu;return e.add(mc.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}},{key:"authorize",value:function(t){var e=t.votePubkey,n=t.authorizedPubkey,r=t.newAuthorizedPubkey,i=t.voteAuthorizationType,o=oc(Uh.Authorize,{newAuthorized:pu(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Yu).add({keys:a,programId:this.programId,data:o})}},{key:"authorizeWithSeed",value:function(t){var e=t.currentAuthorityDerivedKeyBasePubkey,n=t.currentAuthorityDerivedKeyOwnerPubkey,r=t.currentAuthorityDerivedKeySeed,i=t.newAuthorizedPubkey,o=t.voteAuthorizationType,a=t.votePubkey,s=oc(Uh.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:pu(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:pu(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:qu,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return(new Yu).add({keys:u,programId:this.programId,data:s})}},{key:"withdraw",value:function(t){var e=t.votePubkey,n=t.authorizedWithdrawerPubkey,r=t.lamports,i=t.toPubkey,o=oc(Uh.Withdraw,{lamports:r}),a=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Yu).add({keys:a,programId:this.programId,data:o})}},{key:"safeWithdraw",value:function(e,n,r){if(e.lamports>n-r)throw new Error("Withdraw will leave vote account with insuffcient funds.");return t.withdraw(e)}}]),t}();Qh.programId=new bu("Vote111111111111111111111111111111111111111"),Qh.space=3731;var Fh=new bu("Va1idator1nfo111111111111111111111111111111"),Yh=ro({name:eo(),website:$i(eo()),details:$i(eo()),keybaseUsername:$i(eo())}),Hh=function(){function t(e,n){V(this,t),this.key=void 0,this.info=void 0,this.key=e,this.info=n}return G(t,null,[{key:"fromConfigData",value:function(e){var n=st(e);if(2!==Ou(n))return null;for(var r=[],i=0;i<2;i++){var o=new bu(n.slice(0,vu)),a=1===(n=n.slice(vu)).slice(0,1)[0];n=n.slice(1),r.push({publicKey:o,isSigner:a})}if(r[0].publicKey.equals(Fh)&&r[1].isSigner){var s=ju().decode(Tt.from(n)),u=JSON.parse(s);return Qi(u,Yh),new t(r[1].publicKey,u)}return null}}]),t}(),Vh=new bu("Vote111111111111111111111111111111111111111"),qh=Ei([Tu("nodePubkey"),Tu("authorizedWithdrawer"),bi("commission"),Ai(),xi(Ei([Ai("slot"),ki("confirmationCount")]),wi(ki(),-8),"votes"),bi("rootSlotValid"),Ai("rootSlot"),Ai(),xi(Ei([Ai("epoch"),Tu("authorizedVoter")]),wi(ki(),-8),"authorizedVoters"),Ei([xi(Ei([Tu("authorizedPubkey"),Ai("epochOfLastAuthorizedSwitch"),Ai("targetEpoch")]),32,"buf"),Ai("idx"),bi("isEmpty")],"priorVoters"),Ai(),xi(Ei([Ai("epoch"),Ai("credits"),Ai("prevCredits")]),wi(ki(),-8),"epochCredits"),Ei([Ai("slot"),Ai("timestamp")],"lastTimestamp")]),Gh=function(){function t(e){V(this,t),this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=e.nodePubkey,this.authorizedWithdrawer=e.authorizedWithdrawer,this.commission=e.commission,this.rootSlot=e.rootSlot,this.votes=e.votes,this.authorizedVoters=e.authorizedVoters,this.priorVoters=e.priorVoters,this.epochCredits=e.epochCredits,this.lastTimestamp=e.lastTimestamp}return G(t,null,[{key:"fromAccountData",value:function(e){var n=qh.decode(pu(e),4),r=n.rootSlot;return n.rootSlotValid||(r=null),new t({nodePubkey:new bu(n.nodePubkey),authorizedWithdrawer:new bu(n.authorizedWithdrawer),commission:n.commission,votes:n.votes,rootSlot:r,authorizedVoters:n.authorizedVoters.map(Zh),priorVoters:Xh(n.priorVoters),epochCredits:n.epochCredits,lastTimestamp:n.lastTimestamp})}}]),t}();function Zh(t){var e=t.authorizedVoter;return{epoch:t.epoch,authorizedVoter:new bu(e)}}function Jh(t){var e=t.authorizedPubkey,n=t.epochOfLastAuthorizedSwitch,r=t.targetEpoch;return{authorizedPubkey:new bu(e),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function Xh(t){var e=t.buf,n=t.idx;return t.isEmpty?[]:[].concat(st(e.slice(n+1).map(Jh)),st(e.slice(0,n).map(Jh)))}var Kh={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function $h(){return $h=H(Q().mark((function t(e,n,r,i){var o,a,s,u,c,l,h;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r&&Object.prototype.hasOwnProperty.call(r,"lastValidBlockHeight")||r&&Object.prototype.hasOwnProperty.call(r,"nonceValue")?(o=r,a=i):a=r,s=a&&{skipPreflight:a.skipPreflight,preflightCommitment:a.preflightCommitment||a.commitment,minContextSlot:a.minContextSlot},t.next=4,e.sendRawTransaction(n,s);case 4:return u=t.sent,c=a&&a.commitment,l=o?e.confirmTransaction(o,c):e.confirmTransaction(u,c),t.next=9,l;case 9:if(!(h=t.sent.value).err){t.next=12;break}throw new Error("Raw transaction ".concat(u," failed (").concat(JSON.stringify(h),")"));case 12:return t.abrupt("return",u);case 13:case"end":return t.stop()}}),t)}))),$h.apply(this,arguments)}var td=Object.freeze({__proto__:null,Account:Mu,AddressLookupTableAccount:Ic,AddressLookupTableInstruction:Mh,AddressLookupTableProgram:kh,Authorized:jh,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:ku,BPF_LOADER_PROGRAM_ID:yc,BpfLoader:vc,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:Lh,ComputeBudgetInstruction:Ah,ComputeBudgetProgram:Eh,Connection:vh,Ed25519Program:Nh,Enum:gu,EpochSchedule:Lc,FeeCalculatorLayout:uc,Keypair:wh,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:bh,Loader:gc,Lockup:Dh,MAX_SEED_LENGTH:32,Message:Ru,MessageAccountKeys:Iu,MessageV0:Uu,NONCE_ACCOUNT_LENGTH:lc,NonceAccount:hc,PACKET_DATA_SIZE:Au,PUBLIC_KEY_LENGTH:vu,PublicKey:bu,SIGNATURE_LENGTH_IN_BYTES:Eu,SOLANA_SCHEMA:yu,STAKE_CONFIG_ID:Ch,STAKE_INSTRUCTION_LAYOUTS:_h,SYSTEM_INSTRUCTION_LAYOUTS:pc,SYSVAR_CLOCK_PUBKEY:qu,SYSVAR_EPOCH_SCHEDULE_PUBKEY:Gu,SYSVAR_INSTRUCTIONS_PUBKEY:Zu,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:Ju,SYSVAR_RENT_PUBKEY:Xu,SYSVAR_REWARDS_PUBKEY:Ku,SYSVAR_SLOT_HASHES_PUBKEY:$u,SYSVAR_SLOT_HISTORY_PUBKEY:tc,SYSVAR_STAKE_HISTORY_PUBKEY:ec,Secp256k1Program:Th,SendTransactionError:Ec,SolanaJSONRPCError:xc,SolanaJSONRPCErrorCode:{JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP:-32001,JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE:-32002,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE:-32003,JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE:-32004,JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY:-32005,JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:-32006,JSON_RPC_SERVER_ERROR_SLOT_SKIPPED:-32007,JSON_RPC_SERVER_ERROR_NO_SNAPSHOT:-32008,JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:-32009,JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:-32010,JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE:-32011,JSON_RPC_SCAN_ERROR:-32012,JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH:-32013,JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:-32014,JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:-32015,JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED:-32016},StakeAuthorizationLayout:zh,StakeInstruction:Oh,StakeProgram:Ph,Struct:mu,SystemInstruction:fc,SystemProgram:mc,Transaction:Yu,TransactionExpiredBlockheightExceededError:xu,TransactionExpiredNonceInvalidError:Su,TransactionExpiredTimeoutError:Nu,TransactionInstruction:Fu,TransactionMessage:Hu,get TransactionStatus(){return Pu},VALIDATOR_INFO_KEY:Fh,VERSION_PREFIX_MASK:Lu,VOTE_PROGRAM_ID:Vh,ValidatorInfo:Hh,VersionedMessage:Wu,VersionedTransaction:Vu,VoteAccount:Gh,VoteAuthorizationLayout:Wh,VoteInit:Bh,VoteInstruction:Rh,VoteProgram:Qh,clusterApiUrl:function(t,e){var n=!1===e?"http":"https";if(!t)return Kh[n].devnet;var r=Kh[n][t];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(t));return r},sendAndConfirmRawTransaction:function(t,e,n,r){return $h.apply(this,arguments)},sendAndConfirmTransaction:nc}),ed=R(td),nd={};Object.defineProperty(nd,"__esModule",{value:!0});var rd={ERROR_ASSOCIATION_PORT_OUT_OF_RANGE:"ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",ERROR_FORBIDDEN_WALLET_BASE_URL:"ERROR_FORBIDDEN_WALLET_BASE_URL",ERROR_SECURE_CONTEXT_REQUIRED:"ERROR_SECURE_CONTEXT_REQUIRED",ERROR_SESSION_CLOSED:"ERROR_SESSION_CLOSED",ERROR_SESSION_TIMEOUT:"ERROR_SESSION_TIMEOUT",ERROR_WALLET_NOT_FOUND:"ERROR_WALLET_NOT_FOUND"},id=function(t){J(n,et(Error));var e=it(n);function n(){var t;V(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=i[0],s=i[1],u=i[2];return(t=e.call(this,s)).code=a,t.data=u,t.name="SolanaMobileWalletAdapterError",t}return G(n)}(),od=function(t){J(n,et(Error));var e=it(n);function n(){var t;V(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=i[0],s=i[1],u=i[2],c=i[3];return(t=e.call(this,u)).code=s,t.data=c,t.jsonRpcMessageId=a,t.name="SolanaMobileWalletAdapterProtocolError",t}return G(n)}();function ad(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function sd(t,e){return ad(this,void 0,void 0,Q().mark((function n(){var r,i,o;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,crypto.subtle.exportKey("raw",t);case 2:return r=n.sent,n.next=5,crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},e,r);case 5:return i=n.sent,(o=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r),0),o.set(new Uint8Array(i),r.byteLength),n.abrupt("return",o);case 10:case"end":return n.stop()}}),n)})))}var ud=4;function cd(t){if(t>=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");var e=new ArrayBuffer(ud);return new DataView(e).setUint32(0,t,!1),new Uint8Array(e)}function ld(){return ad(this,void 0,void 0,Q().mark((function t(){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}function hd(){return ad(this,void 0,void 0,Q().mark((function t(){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"]);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})))}var dd,fd=12;function pd(t,e){return ad(this,void 0,void 0,Q().mark((function n(){var r,i,o,a,s;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=JSON.stringify(t),i=cd(t.id),o=new Uint8Array(fd),crypto.getRandomValues(o),n.next=6,crypto.subtle.encrypt(gd(i,o),e,(new TextEncoder).encode(r));case 6:return a=n.sent,(s=new Uint8Array(i.byteLength+o.byteLength+a.byteLength)).set(new Uint8Array(i),0),s.set(new Uint8Array(o),i.byteLength),s.set(new Uint8Array(a),i.byteLength+o.byteLength),n.abrupt("return",s);case 12:case"end":return n.stop()}}),n)})))}function md(t,e){return ad(this,void 0,void 0,Q().mark((function n(){var r,i,o,a,s,u;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.slice(0,ud),i=t.slice(ud,ud+fd),o=t.slice(ud+fd),n.next=5,crypto.subtle.decrypt(gd(r,i),e,o);case 5:if(a=n.sent,s=yd().decode(a),u=JSON.parse(s),!Object.hasOwnProperty.call(u,"error")){n.next=10;break}throw new od(u.id,u.error.code,u.error.message);case 10:return n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))}function gd(t,e){return{additionalData:t,iv:e,name:"AES-GCM",tagLength:128}}function yd(){return void 0===dd&&(dd=new TextDecoder("utf-8")),dd}function vd(t,e,n){return ad(this,void 0,void 0,Q().mark((function r(){var i,o,a,s,u,c,l;return Q().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Promise.all([crypto.subtle.exportKey("raw",e),crypto.subtle.importKey("raw",t,{name:"ECDH",namedCurve:"P-256"},!1,[])]);case 2:return i=r.sent,o=at(i,2),a=o[0],s=o[1],r.next=8,crypto.subtle.deriveBits({name:"ECDH",public:s},n,256);case 8:return u=r.sent,r.next=11,crypto.subtle.importKey("raw",u,"HKDF",!1,["deriveKey"]);case 11:return c=r.sent,r.next=14,crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(a),info:new Uint8Array},c,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"]);case 14:return l=r.sent,r.abrupt("return",l);case 16:case"end":return r.stop()}}),r)})))}function wd(t){if(t<49152||t>65535)throw new id(rd.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,"Association port number must be between 49152 and 65535. ".concat(t," given."),{port:t});return t}function bd(t){for(var e="",n=new Uint8Array(t),r=n.byteLength,i=0;i<r;i++)e+=String.fromCharCode(n[i]);return window.btoa(e)}var Md="solana-wallet";function kd(t){return t.replace(/(^\/+|\/+$)/g,"").split("/")}function Ad(t,e){var n=null;if(e){try{n=new URL(e)}catch(t){}if("https:"!==(null==n?void 0:n.protocol))throw new id(rd.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}n||(n=new URL("".concat(Md,":/")));var r=t.startsWith("/")?t:[].concat(st(kd(n.pathname)),st(kd(t))).join("/");return new URL(r,n)}function Ld(t,e,n){return ad(this,void 0,void 0,Q().mark((function r(){var i,o,a,s;return Q().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=wd(e),r.next=3,crypto.subtle.exportKey("raw",t);case 3:return o=r.sent,a=bd(o),(s=Ad("v1/associate/local",n)).searchParams.set("association",a.replace(/[/+=]/g,(function(t){return{"/":"_","+":"-","=":"."}[t]}))),s.searchParams.set("port","".concat(i)),r.abrupt("return",s);case 9:case"end":return r.stop()}}),r)})))}var Ed={Firefox:0,Other:1};var xd=null;function Nd(t,e){return ad(this,void 0,void 0,Q().mark((function n(){var r,i,o,a;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=wd(49152+Math.floor(16384*Math.random())),n.next=3,Ld(t,r,e);case 3:if("https:"!==(i=n.sent).protocol){n.next=8;break}window.location.assign(i),n.next=26;break;case 8:n.prev=8,o=-1!==navigator.userAgent.indexOf("Firefox/")?Ed.Firefox:Ed.Other,n.t0=o,n.next=n.t0===Ed.Firefox?13:n.t0===Ed.Other?15:20;break;case 13:return s=i,null==xd&&((xd=document.createElement("iframe")).style.display="none",document.body.appendChild(xd)),xd.contentWindow.location.href=s.toString(),n.abrupt("break",21);case 15:return a=new Promise((function(t,e){function n(){clearTimeout(i),window.removeEventListener("blur",r)}function r(){n(),t()}window.addEventListener("blur",r);var i=setTimeout((function(){n(),e()}),2e3)})),window.location.assign(i),n.next=19,a;case 19:return n.abrupt("break",21);case 20:case 21:n.next=26;break;case 23:throw n.prev=23,n.t1=n.catch(8),new id(rd.ERROR_WALLET_NOT_FOUND,"Found no installed wallet that supports the mobile wallet protocol.");case 26:return n.abrupt("return",r);case 27:case"end":return n.stop()}var s}),n,null,[[8,23]])})))}var Sd=[150,150,200,500,500,750,750,1e3],Id=3e4;function Td(){if("undefined"==typeof window||!0!==window.isSecureContext)throw new id(rd.ERROR_SECURE_CONTEXT_REQUIRED,"The mobile wallet adapter protocol must be used in a secure context (`https`).")}function Cd(t){var e;try{e=new URL(t)}catch(t){throw new id(rd.ERROR_FORBIDDEN_WALLET_BASE_URL,"Invalid base URL supplied by wallet")}if("https:"!==e.protocol)throw new id(rd.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}nd.SolanaMobileWalletAdapterError=id,nd.SolanaMobileWalletAdapterErrorCode=rd,nd.SolanaMobileWalletAdapterProtocolError=od,nd.SolanaMobileWalletAdapterProtocolErrorCode={ERROR_AUTHORIZATION_FAILED:-1,ERROR_INVALID_PAYLOADS:-2,ERROR_NOT_SIGNED:-3,ERROR_NOT_SUBMITTED:-4,ERROR_TOO_MANY_PAYLOADS:-5,ERROR_ATTEST_ORIGIN_ANDROID:-100},nd.transact=function(t,e){return ad(this,void 0,void 0,Q().mark((function n(){var r,i,o,a,s,u,c,l,h=this;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return Td(),n.next=3,ld();case 3:return r=n.sent,n.next=6,Nd(r.publicKey,null==e?void 0:e.baseUri);case 6:return i=n.sent,o="ws://localhost:".concat(i,"/solana-wallet"),s=function(){var t=st(Sd);return function(){return t.length>1?t.shift():t[0]}}(),u=1,c=0,l={__type:"disconnected"},n.abrupt("return",new Promise((function(e,n){var d,f,p,m={},g=function t(){return ad(h,void 0,void 0,Q().mark((function e(){var n,r;return Q().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("connecting"===l.__type){e.next=3;break}return console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(l.__type,"`.")),e.abrupt("return");case 3:return n=l.associationKeypair,d.removeEventListener("open",t),e.next=7,hd();case 7:return r=e.sent,e.t0=d,e.next=11,sd(r.publicKey,n.privateKey);case 11:e.t1=e.sent,e.t0.send.call(e.t0,e.t1),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};case 14:case"end":return e.stop()}}),e)})))},y=function(t){t.wasClean?l={__type:"disconnected"}:n(new id(rd.ERROR_SESSION_CLOSED,"The wallet session dropped unexpectedly (".concat(t.code,": ").concat(t.reason,")."),{closeEvent:t})),f()},v=function(t){return ad(h,void 0,void 0,Q().mark((function t(){return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(f(),!(Date.now()-a>=Id)){t.next=5;break}n(new id(rd.ERROR_SESSION_TIMEOUT,"Failed to connect to the wallet websocket on port ".concat(i,"."))),t.next=8;break;case 5:return t.next=7,new Promise((function(t){var e=s();p=window.setTimeout(t,e)}));case 7:b();case 8:case"end":return t.stop()}}),t)})))},w=function(r){return ad(h,void 0,void 0,Q().mark((function i(){var o,a,s,h,p,g,y,v;return Q().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,r.data.arrayBuffer();case 2:o=i.sent,i.t0=l.__type,i.next="connected"===i.t0?6:"hello_req_sent"===i.t0?30:51;break;case 6:if(i.prev=6,a=o.slice(0,ud),(s=new DataView(a).getUint32(0,!1))===c+1){i.next=11;break}throw new Error("Encrypted message has invalid sequence number");case 11:return c=s,i.next=14,md(o,l.sharedSecret);case 14:h=i.sent,p=m[h.id],delete m[h.id],p.resolve(h.result),i.next=29;break;case 20:if(i.prev=20,i.t1=i.catch(6),!(i.t1 instanceof od)){i.next=28;break}g=m[i.t1.jsonRpcMessageId],delete m[i.t1.jsonRpcMessageId],g.reject(i.t1),i.next=29;break;case 28:throw i.t1;case 29:return i.abrupt("break",51);case 30:return i.next=32,vd(o,l.associationPublicKey,l.ecdhPrivateKey);case 32:return y=i.sent,l={__type:"connected",sharedSecret:y},v=new Proxy({},{get:function(t,e){if(null==t[e]){var n=e.toString().replace(/[A-Z]/g,(function(t){return"_".concat(t.toLowerCase())})).toLowerCase();t[e]=function(t){return ad(this,void 0,void 0,Q().mark((function r(){var i;return Q().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=u++,r.t0=d,r.next=4,pd({id:i,jsonrpc:"2.0",method:n,params:null!=t?t:{}},y);case 4:return r.t1=r.sent,r.t0.send.call(r.t0,r.t1),r.abrupt("return",new Promise((function(t,n){m[i]={resolve:function(r){switch(e){case"authorize":case"reauthorize":var i=r.wallet_uri_base;if(null!=i)try{Cd(i)}catch(t){return void n(t)}}t(r)},reject:n}})));case 7:case"end":return r.stop()}}),r)})))}}return t[e]},defineProperty:function(){return!1},deleteProperty:function(){return!1}}),i.prev=35,i.t2=e,i.next=39,t(v);case 39:i.t3=i.sent,(0,i.t2)(i.t3),i.next=46;break;case 43:i.prev=43,i.t4=i.catch(35),n(i.t4);case 46:return i.prev=46,f(),d.close(),i.finish(46);case 50:return i.abrupt("break",51);case 51:case"end":return i.stop()}}),i,null,[[6,20],[35,43,46,50]])})))},b=function(){f&&f(),l={__type:"connecting",associationKeypair:r},void 0===a&&(a=Date.now()),(d=new WebSocket(o,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",g),d.addEventListener("close",y),d.addEventListener("error",v),d.addEventListener("message",w),f=function(){window.clearTimeout(p),d.removeEventListener("open",g),d.removeEventListener("close",y),d.removeEventListener("error",v),d.removeEventListener("message",w)}};b()})));case 13:case"end":return n.stop()}}),n)})))};var jd=function(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var r=0;r<t.length;r++){var i=t.charAt(r),o=i.charCodeAt(0);if(255!==e[o])throw new TypeError(i+" is ambiguous");e[o]=r}var a=t.length,s=t.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(t){if("string"!=typeof t)throw new TypeError("Expected String");if(0===t.length)return new Uint8Array;for(var n=0,r=0,i=0;t[n]===s;)r++,n++;for(var o=(t.length-n)*u+1>>>0,c=new Uint8Array(o);t[n];){var l=e[t.charCodeAt(n)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h<i)&&-1!==d;d--,h++)l+=a*c[d]>>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var f=o-i;f!==o&&0===c[f];)f++;for(var p=new Uint8Array(r+(o-f)),m=r;f!==o;)p[m++]=c[f++];return p}return{encode:function(e){if(e instanceof Uint8Array||(ArrayBuffer.isView(e)?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):Array.isArray(e)&&(e=Uint8Array.from(e))),!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===e.length)return"";for(var n=0,r=0,i=0,o=e.length;i!==o&&0===e[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var h=e[i],d=0,f=u-1;(0!==h||d<r)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=u-r;p!==u&&0===l[p];)p++;for(var m=s.repeat(n);p<u;++p)m+=t.charAt(l[p]);return m},decodeUnsafe:l,decode:function(t){var e=l(t);if(e)return e;throw new Error("Non-base"+a+" character")}}},Dd=jd("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Object.defineProperty(pt,"__esModule",{value:!0});var Od=ed,_d=nd;function zd(t){return t&&"object"===F(t)&&"default"in t?t:{default:t}}var Pd=zd(Dd);function Bd(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function Rd(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function Ud(t){var e;return window.btoa((e=String.fromCharCode).call.apply(e,[null].concat(st(t))))}function Wd(t){return new Uint8Array(window.atob(t).split("").map((function(t){return t.charCodeAt(0)})))}function Qd(t){return Ud("version"in t?t.serialize():t.serialize({requireAllSignatures:!1,verifySignatures:!1}))}function Fd(t){var e=t[0]*Od.SIGNATURE_LENGTH_IN_BYTES+1;return"legacy"===Od.VersionedMessage.deserializeMessageVersion(t.slice(e,t.length))?Od.Transaction.from(t):Od.VersionedTransaction.deserialize(t)}pt.transact=function(t,e){return Rd(this,void 0,void 0,Q().mark((function n(){var r;return Q().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(e){var n=new Proxy({},{get:function(t,n){if(null==t[n])switch(n){case"signAndSendTransactions":t[n]=function(t){var n=t.minContextSlot,r=t.transactions,i=Bd(t,["minContextSlot","transactions"]);return Rd(this,void 0,void 0,Q().mark((function t(){var o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=r.map(Qd),t.next=3,e.signAndSendTransactions(Object.assign(Object.assign(Object.assign({},i),null!=n?{options:{min_context_slot:n}}:null),{payloads:o}));case 3:return a=t.sent,s=a.signatures,u=s.map(Wd).map(Pd.default.encode),t.abrupt("return",u);case 7:case"end":return t.stop()}}),t)})))};break;case"signMessages":t[n]=function(t){var n=t.payloads,r=Bd(t,["payloads"]);return Rd(this,void 0,void 0,Q().mark((function t(){var i,o,a,s;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=n.map(Ud),t.next=3,e.signMessages(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=t.sent,a=o.signed_payloads,s=a.map(Wd),t.abrupt("return",s);case 7:case"end":return t.stop()}}),t)})))};break;case"signTransactions":t[n]=function(t){var n=t.transactions,r=Bd(t,["transactions"]);return Rd(this,void 0,void 0,Q().mark((function t(){var i,o,a,s,u;return Q().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=n.map(Qd),t.next=3,e.signTransactions(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=t.sent,a=o.signed_payloads,s=a.map(Wd),u=s.map(Fd),t.abrupt("return",u);case 8:case"end":return t.stop()}}),t)})))};break;default:t[n]=e[n]}return t[n]},defineProperty:function(){return!1},deleteProperty:function(){return!1}});return t(n)},n.next=3,_d.transact(r,e);case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n)})))};var Yd={},Hd=function(){function t(e,n){if(V(this,t),!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=n}return G(t,[{key:"makeDestinationObject",value:function(){return{}}},{key:"decode",value:function(t,e){throw new Error("Layout is abstract")}},{key:"encode",value:function(t,e,n){throw new Error("Layout is abstract")}},{key:"getSpan",value:function(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(t){var e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}},{key:"fromArray",value:function(t){}}]),t}();function Vd(t,e){return e.property?t+"["+e.property+"]":t}Yd.Layout=Hd,Yd.nameWithProperty=Vd,Yd.bindConstructorLayout=function(t,e){if("function"!=typeof t)throw new TypeError("Class must be constructor");if(t.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof Hd))throw new TypeError("layout must be a Layout");if(e.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=function(){return new t},Object.defineProperty(t.prototype,"encode",{value:function(t,n){return e.encode(this,t,n)},writable:!0}),Object.defineProperty(t,"decode",{value:function(t,n){return e.decode(t,n)},writable:!0})};var qd=function(t){J(n,Hd);var e=it(n);function n(){return V(this,n),e.apply(this,arguments)}return G(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}(),Gd=function(t){J(n,qd);var e=it(n);function n(t,r){var i;if(V(this,n),void 0===t&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");return(i=e.call(this,-1,r)).elementSpan=t,i}return G(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.length-e;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(t,e,n){return 0}}]),n}(),Zd=function(t){J(n,qd);var e=it(n);function n(t,r,i){var o;if(V(this,n),!(t instanceof Hd))throw new TypeError("layout must be a Layout");if(void 0===r)r=0;else if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");return(o=e.call(this,t.span,i||t.property)).layout=t,o.offset=r,o}return G(n,[{key:"isCount",value:function(){return this.layout instanceof Jd||this.layout instanceof Xd}},{key:"decode",value:function(t,e){return void 0===e&&(e=0),this.layout.decode(t,e+this.offset)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),this.layout.encode(t,e,n+this.offset)}}]),n}(),Jd=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}]),n}(),Xd=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readUIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}]),n}(),Kd=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntLE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntLE(t,n,this.span),this.span}}]),n}(),$d=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),6<(i=e.call(this,t,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readIntBE(e,this.span)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeIntBE(t,n,this.span),this.span}}]),n}(),tf=Math.pow(2,32);function ef(t){var e=Math.floor(t/tf);return{hi32:e,lo32:t-e*tf}}function nf(t,e){return t*tf+e}var rf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return nf(t.readUInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=ef(t);return e.writeUInt32LE(r.lo32,n),e.writeUInt32LE(r.hi32,n+4),8}}]),n}(),of=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),nf(t.readUInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=ef(t);return e.writeUInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(),af=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=t.readUInt32LE(e);return nf(t.readInt32LE(e+4),n)}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=ef(t);return e.writeUInt32LE(r.lo32,n),e.writeInt32LE(r.hi32,n+4),8}}]),n}(),sf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),nf(t.readInt32BE(e),t.readUInt32BE(e+4))}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=ef(t);return e.writeInt32BE(r.hi32,n),e.writeUInt32BE(r.lo32,n+4),8}}]),n}(),uf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,4,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatLE(t,n),4}}]),n}(),cf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,4,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readFloatBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeFloatBE(t,n),4}}]),n}(),lf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleLE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleLE(t,n),8}}]),n}(),hf=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,8,t)}return G(n,[{key:"decode",value:function(t,e){return void 0===e&&(e=0),t.readDoubleBE(e)}},{key:"encode",value:function(t,e,n){return void 0===n&&(n=0),e.writeDoubleBE(t,n),8}}]),n}(),df=function(t){J(n,Hd);var e=it(n);function n(t,r,i){var o;if(V(this,n),!(t instanceof Hd))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof qd&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var a=-1;return!(r instanceof qd)&&0<t.span&&(a=r*t.span),(o=e.call(this,a,i)).elementLayout=t,o.count=r,o}return G(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0,r=this.count;if(r instanceof qd&&(r=r.decode(t,e)),0<this.elementLayout.span)n=r*this.elementLayout.span;else for(var i=0;i<r;)n+=this.elementLayout.getSpan(t,e+n),++i;return n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=[],r=0,i=this.count;for(i instanceof qd&&(i=i.decode(t,e));r<i;)n.push(this.elementLayout.decode(t,e)),e+=this.elementLayout.getSpan(t,e),r+=1;return n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=this.elementLayout,i=t.reduce((function(t,i){return t+r.encode(i,e,n+t)}),0);return this.count instanceof qd&&this.count.encode(t.length,e,n),i}}]),n}(),ff=function(t){J(n,Hd);var e=it(n);function n(t,r,i){var o;if(V(this,n),!Array.isArray(t)||!t.reduce((function(t,e){return t&&e instanceof Hd}),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof r&&void 0===i&&(i=r,r=void 0);var a,s=ft(t);try{for(s.s();!(a=s.n()).done;){var u=a.value;if(0>u.span&&void 0===u.property)throw new Error("fields cannot contain unnamed variable-length layout")}}catch(t){s.e(t)}finally{s.f()}var c=-1;try{c=t.reduce((function(t,e){return t+e.getSpan()}),0)}catch(t){}return(o=e.call(this,c,r)).fields=t,o.decodePrefixes=!!i,o}return G(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(t,e);return e+=i,n+i}),0)}catch(t){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n,r=this.makeDestinationObject(),i=ft(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(t,e)),e+=o.getSpan(t,e),this.decodePrefixes&&t.length===e)break}}catch(t){i.e(t)}finally{i.f()}return r}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r,i=n,o=0,a=0,s=ft(this.fields);try{for(s.s();!(r=s.n()).done;){var u=r.value,c=u.span;if(a=0<c?c:0,void 0!==u.property){var l=t[u.property];void 0!==l&&(a=u.encode(l,e,n),0>c&&(c=u.getSpan(e,n)))}o=n,n+=c}}catch(t){s.e(t)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(t){var e,n=this.makeDestinationObject(),r=ft(this.fields);try{for(r.s();!(e=r.n()).done;){var i=e.value;void 0!==i.property&&0<t.length&&(n[i.property]=t.shift())}}catch(t){r.e(t)}finally{r.f()}return n}},{key:"layoutFor",value:function(t){if("string"!=typeof t)throw new TypeError("property must be string");var e,n=ft(this.fields);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.property===t)return r}}catch(t){n.e(t)}finally{n.f()}}},{key:"offsetOf",value:function(t){if("string"!=typeof t)throw new TypeError("property must be string");var e,n=0,r=ft(this.fields);try{for(r.s();!(e=r.n()).done;){var i=e.value;if(i.property===t)return n;0>i.span?n=-1:0<=n&&(n+=i.span)}}catch(t){r.e(t)}finally{r.f()}}}]),n}(),pf=function(){function t(e){V(this,t),this.property=e}return G(t,[{key:"decode",value:function(){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(){throw new Error("UnionDiscriminator is abstract")}}]),t}(),mf=function(t){J(n,pf);var e=it(n);function n(t,r){var i;if(V(this,n),!(t instanceof qd&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=e.call(this,r||t.property||"variant")).layout=t,i}return G(n,[{key:"decode",value:function(t,e){return this.layout.decode(t,e)}},{key:"encode",value:function(t,e,n){return this.layout.encode(t,e,n)}}]),n}(),gf=function(t){J(n,Hd);var e=it(n);function n(t,r,i){var o;V(this,n);var a=t instanceof Jd||t instanceof Xd;if(a)t=new mf(new Zd(t));else if(t instanceof qd&&t.isCount())t=new mf(t);else if(!(t instanceof pf))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===r&&(r=null),!(null===r||r instanceof Hd))throw new TypeError("defaultLayout must be null or a Layout");if(null!==r){if(0>r.span)throw new Error("defaultLayout must have constant span");void 0===r.property&&(r=r.replicate("content"))}var s=-1;r&&0<=(s=r.span)&&a&&(s+=t.layout.span),(o=e.call(this,s,i)).discriminator=t,o.usesPrefixDiscriminator=a,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(rt(o));return o.getSourceVariant=function(t){return u(t)},o.configGetSourceVariant=function(t){u=t.bind(this)},o}return G(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}},{key:"defaultGetSourceVariant",value:function(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;var e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(var n in this.registry){var r=this.registry[n];if(t.hasOwnProperty(r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(t,e){var n;void 0===e&&(e=0);var r=this.discriminator,i=r.decode(t,e),o=this.registry[i];if(void 0===o){var a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),(n=this.makeDestinationObject())[r.property]=i,n[o.property]=this.defaultLayout.decode(t,e+a)}else n=o.decode(t,e);return n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=this.getSourceVariant(t);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(t[i.property],e,n),a+o.encode(t[o.property],e,n+a)}return r.encode(t,e,n)}},{key:"addVariant",value:function(t,e,n){var r=new yf(this,t,e,n);return this.registry[t]=r,r}},{key:"getVariant",value:function(t,e){var n=t;return Tt.isBuffer(t)&&(void 0===e&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}]),n}(),yf=function(t){J(n,Hd);var e=it(n);function n(t,r,i,o){var a;if(V(this,n),!(t instanceof gf))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof i&&void 0===o&&(o=i,i=null),i){if(!(i instanceof Hd))throw new TypeError("layout must be a Layout");if(null!==t.defaultLayout&&0<=i.span&&i.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof o)throw new TypeError("variant must have a String property")}var s=t.span;return 0>t.span&&0<=(s=i?i.span:0)&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span),(a=e.call(this,s,o)).union=t,a.variant=r,a.layout=i||null,a}return G(n,[{key:"getSpan",value:function(t,e){if(0<=this.span)return this.span;void 0===e&&(e=0);var n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}},{key:"decode",value:function(t,e){var n=this.makeDestinationObject();if(void 0===e&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");var r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);var i=r;if(this.layout&&(this.layout.encode(t[this.property],e,n+r),i+=this.layout.getSpan(e,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(t){if(this.layout)return this.layout.fromArray(t)}}]),n}();function vf(t){return 0>t&&(t+=4294967296),t}var wf=function(t){J(n,Hd);var e=it(n);function n(t,r,i){var o;if(V(this,n),!(t instanceof Jd||t instanceof Xd))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=void 0),4<t.span)throw new RangeError("word cannot exceed 32 bits");(o=e.call(this,t.span,i)).word=t,o.msb=!!r,o.fields=[];var a=0;return o._packedSetValue=function(t){return a=vf(t),this},o._packedGetValue=function(){return a},o}return G(n,[{key:"decode",value:function(t,e){var n=this.makeDestinationObject();void 0===e&&(e=0);var r=this.word.decode(t,e);this._packedSetValue(r);var i,o=ft(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;void 0!==a.property&&(n[a.property]=a.decode(r))}}catch(t){o.e(t)}finally{o.f()}return n}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0);var r=this.word.decode(e,n);this._packedSetValue(r);var i,o=ft(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(void 0!==a.property){var s=t[a.property];void 0!==s&&a.encode(s)}}}catch(t){o.e(t)}finally{o.f()}return this.word.encode(this._packedGetValue(),e,n)}},{key:"addField",value:function(t,e){var n=new bf(this,t,e);return this.fields.push(n),n}},{key:"addBoolean",value:function(t){var e=new Mf(this,t);return this.fields.push(e),e}},{key:"fieldFor",value:function(t){if("string"!=typeof t)throw new TypeError("property must be string");var e,n=ft(this.fields);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.property===t)return r}}catch(t){n.e(t)}finally{n.f()}}}]),n}(),bf=function(){function t(e,n,r){if(V(this,t),!(e instanceof wf))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(n)||0>=n)throw new TypeError("bits must be positive integer");var i=8*e.span,o=e.fields.reduce((function(t,e){return t+e.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=n,this.valueMask=(1<<n)-1,32===n&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=i-o-n),this.wordMask=vf(this.valueMask<<this.start),this.property=r}return G(t,[{key:"decode",value:function(){return vf(this.container._packedGetValue()&this.wordMask)>>>this.start}},{key:"encode",value:function(t){if(!Number.isInteger(t)||t!==vf(t&this.valueMask))throw new TypeError(Vd("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var e=this.container._packedGetValue(),n=vf(t<<this.start);this.container._packedSetValue(vf(e&~this.wordMask)|n)}}]),t}(),Mf=function(t){J(n,bf);var e=it(n);function n(t,r){return V(this,n),e.call(this,t,1,r)}return G(n,[{key:"decode",value:function(t,e){return!!bf.prototype.decode.call(this,t,e)}},{key:"encode",value:function(t){return"boolean"==typeof t&&(t=+t),bf.prototype.encode.call(this,t)}}]),n}(),kf=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),!(t instanceof qd&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var o=-1;return t instanceof qd||(o=t),(i=e.call(this,o,r)).length=t,i}return G(n,[{key:"getSpan",value:function(t,e){var n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}},{key:"decode",value:function(t,e){void 0===e&&(e=0);var n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}},{key:"encode",value:function(t,e,n){var r=this.length;if(this.length instanceof qd&&(r=t.length),!Tt.isBuffer(t)||r!==t.length)throw new TypeError(Vd("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,r,"hex"),this.length instanceof qd&&this.length.encode(r,e,n),r}}]),n}(),Af=function(t){J(n,Hd);var e=it(n);function n(t){return V(this,n),e.call(this,-1,t)}return G(n,[{key:"getSpan",value:function(t,e){if(!Tt.isBuffer(t))throw new TypeError("b must be a Buffer");void 0===e&&(e=0);for(var n=e;n<t.length&&0!==t[n];)n+=1;return 1+n-e}},{key:"decode",value:function(t,e,n){void 0===e&&(e=0);var r=this.getSpan(t,e);return t.slice(e,e+r-1).toString("utf-8")}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());var r=new Tt(t,"utf8"),i=r.length;if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),e[n+i]=0,i+1}}]),n}(),Lf=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;if(V(this,n),"string"==typeof t&&void 0===r&&(r=t,t=void 0),void 0===t)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");return(i=e.call(this,-1,r)).maxSpan=t,i}return G(n,[{key:"getSpan",value:function(t,e){if(!Tt.isBuffer(t))throw new TypeError("b must be a Buffer");return void 0===e&&(e=0),t.length-e}},{key:"decode",value:function(t,e,n){void 0===e&&(e=0);var r=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return t.slice(e,e+r).toString("utf-8")}},{key:"encode",value:function(t,e,n){void 0===n&&(n=0),"string"!=typeof t&&(t=t.toString());var r=new Tt(t,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>e.length)throw new RangeError("encoding overruns Buffer");return r.copy(e,n),i}}]),n}(),Ef=function(t){J(n,Hd);var e=it(n);function n(t,r){var i;return V(this,n),(i=e.call(this,0,r)).value=t,i}return G(n,[{key:"decode",value:function(t,e,n){return this.value}},{key:"encode",value:function(t,e,n){return 0}}]),n}();Yd.ExternalLayout=qd,Yd.GreedyCount=Gd,Yd.OffsetLayout=Zd,Yd.UInt=Jd,Yd.UIntBE=Xd,Yd.Int=Kd,Yd.IntBE=$d,Yd.Float=uf,Yd.FloatBE=cf,Yd.Double=lf,Yd.DoubleBE=hf,Yd.Sequence=df,Yd.Structure=ff,Yd.UnionDiscriminator=pf,Yd.UnionLayoutDiscriminator=mf,Yd.Union=gf,Yd.VariantLayout=yf,Yd.BitStructure=wf,Yd.BitField=bf,Yd.Boolean=Mf,Yd.Blob=kf,Yd.CString=Af,Yd.UTF8=Lf,Yd.Constant=Ef,Yd.greedy=function(t,e){return new Gd(t,e)},Yd.offset=function(t,e,n){return new Zd(t,e,n)},Yd.u8=function(t){return new Jd(1,t)},Yd.u16=function(t){return new Jd(2,t)},Yd.u24=function(t){return new Jd(3,t)},Yd.u32=function(t){return new Jd(4,t)},Yd.u40=function(t){return new Jd(5,t)},Yd.u48=function(t){return new Jd(6,t)},Yd.nu64=function(t){return new rf(t)},Yd.u16be=function(t){return new Xd(2,t)},Yd.u24be=function(t){return new Xd(3,t)},Yd.u32be=function(t){return new Xd(4,t)},Yd.u40be=function(t){return new Xd(5,t)},Yd.u48be=function(t){return new Xd(6,t)},Yd.nu64be=function(t){return new of(t)},Yd.s8=function(t){return new Kd(1,t)},Yd.s16=function(t){return new Kd(2,t)},Yd.s24=function(t){return new Kd(3,t)},Yd.s32=function(t){return new Kd(4,t)},Yd.s40=function(t){return new Kd(5,t)},Yd.s48=function(t){return new Kd(6,t)},Yd.ns64=function(t){return new af(t)},Yd.s16be=function(t){return new $d(2,t)},Yd.s24be=function(t){return new $d(3,t)},Yd.s32be=function(t){return new $d(4,t)},Yd.s40be=function(t){return new $d(5,t)},Yd.s48be=function(t){return new $d(6,t)},Yd.ns64be=function(t){return new sf(t)},Yd.f32=function(t){return new uf(t)},Yd.f32be=function(t){return new cf(t)},Yd.f64=function(t){return new lf(t)},Yd.f64be=function(t){return new hf(t)},Yd.struct=function(t,e,n){return new ff(t,e,n)},Yd.bits=function(t,e,n){return new wf(t,e,n)};var xf=Yd.seq=function(t,e,n){return new df(t,e,n)};Yd.union=function(t,e,n){return new gf(t,e,n)},Yd.unionLayoutDiscriminator=function(t,e){return new mf(t,e)},Yd.blob=function(t,e){return new kf(t,e)},Yd.cstr=function(t){return new Af(t)},Yd.utf8=function(t,e){return new Lf(t,e)},Yd.const=function(t,e){return new Ef(t,e)};var Nf={},Sf={exports:{}};!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"===F(t)?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Wn.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"===F(t)&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"===F(t))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype._move=function(t){c(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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];function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?m+r:h[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n++]=255&a,n<t.length&&(t[n++]=a>>8&255),n<t.length&&(t[n++]=a>>16&255),6===o?(n<t.length&&(t[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<t.length)for(t[n++]=r;n<t.length;)t[n++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var n=t.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n--]=255&a,n>=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,v=g>>>13,w=0|a[3],b=8191&w,M=w>>>13,k=0|a[4],A=8191&k,L=k>>>13,E=0|a[5],x=8191&E,N=E>>>13,S=0|a[6],I=8191&S,T=S>>>13,C=0|a[7],j=8191&C,D=C>>>13,O=0|a[8],_=8191&O,z=O>>>13,P=0|a[9],B=8191&P,R=P>>>13,U=0|s[0],W=8191&U,Q=U>>>13,F=0|s[1],Y=8191&F,H=F>>>13,V=0|s[2],q=8191&V,G=V>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,W))|0)+((8191&(i=(i=Math.imul(h,Q))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,Q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,W),i=(i=Math.imul(p,Q))+Math.imul(m,W)|0,o=Math.imul(m,Q);var yt=(c+(r=r+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,W),i=(i=Math.imul(y,Q))+Math.imul(v,W)|0,o=Math.imul(v,Q),r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,q)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(d,q)|0))<<13)|0;c=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,W),i=(i=Math.imul(b,Q))+Math.imul(M,W)|0,o=Math.imul(M,Q),r=r+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,G)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(A,W),i=(i=Math.imul(A,Q))+Math.imul(L,W)|0,o=Math.imul(L,Q),r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,G)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,W),i=(i=Math.imul(x,Q))+Math.imul(N,W)|0,o=Math.imul(N,Q),r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(b,q)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,G)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(I,W),i=(i=Math.imul(I,Q))+Math.imul(T,W)|0,o=Math.imul(T,Q),r=r+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(A,q)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,G)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Q))+Math.imul(D,W)|0,o=Math.imul(D,Q),r=r+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(x,q)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,G)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var At=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(_,W),i=(i=Math.imul(_,Q))+Math.imul(z,W)|0,o=Math.imul(z,Q),r=r+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,G)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Lt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,W),i=(i=Math.imul(B,Q))+Math.imul(R,W)|0,o=Math.imul(R,Q),r=r+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(z,Y)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,q)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,G)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,Y),i=(i=Math.imul(B,H))+Math.imul(R,Y)|0,o=Math.imul(R,H),r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(z,q)|0,o=o+Math.imul(z,G)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,q),i=(i=Math.imul(B,G))+Math.imul(R,q)|0,o=Math.imul(R,G),r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,X)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var Nt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,dt)|0;var St=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,dt)|0;var Tt=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var Ct=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,mt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=kt,u[7]=At,u[8]=Lt,u[9]=Et,u[10]=xt,u[11]=Nt,u[12]=St,u[13]=It,u[14]=Tt,u[15]=Ct,u[16]=jt,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function g(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(t,e,n){return g(t,e,n)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):n<63?p(this,t,e):n<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=t.words[r]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new L(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function L(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){L.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(M,w),r(k,w),r(A,w),A.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},L.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},L.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},L.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},L.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},L.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},L.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},L.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},L.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},L.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},L.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},L.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},L.prototype.isqr=function(t){return this.imul(t,t.clone())},L.prototype.sqr=function(t){return this.mul(t,t)},L.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},L.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},L.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},L.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},L.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,L),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(Sf,P),function(t){var e=P&&P.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(t,"__esModule",{value:!0}),t.map=t.array=t.rustEnum=t.str=t.vecU8=t.tagged=t.vec=t.bool=t.option=t.publicKey=t.i128=t.u128=t.i64=t.u64=t.struct=t.f64=t.f32=t.i32=t.u32=t.i16=t.u16=t.i8=t.u8=void 0;var n=Yd,r=ed,i=e(Sf.exports),o=Yd;Object.defineProperty(t,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(t,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(t,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(t,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(t,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(t,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(t,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(t,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(t,"struct",{enumerable:!0,get:function(){return o.struct}});var a=function(t){J(r,t);var e=it(r);function r(t,i,o){var a;return V(this,r),(a=e.call(this,t,o)).blob=n.blob(t),a.signed=i,a}return G(r,[{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new i.default(this.blob.decode(t,e),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}},{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(t=t.toTwos(8*this.span)),this.blob.encode(t.toArrayLike(Tt,"le",this.span),e,n)}}]),r}(n.Layout);function s(t){return new a(8,!1,t)}t.u64=s,t.i64=function(t){return new a(8,!0,t)},t.u128=function(t){return new a(16,!1,t)},t.i128=function(t){return new a(16,!0,t)};var u=function(t){J(n,t);var e=it(n);function n(t,r,i,o){var a;return V(this,n),(a=e.call(this,t.span,o)).layout=t,a.decoder=r,a.encoder=i,a}return G(n,[{key:"decode",value:function(t,e){return this.decoder(this.layout.decode(t,e))}},{key:"encode",value:function(t,e,n){return this.layout.encode(this.encoder(t),e,n)}},{key:"getSpan",value:function(t,e){return this.layout.getSpan(t,e)}}]),n}(n.Layout);t.publicKey=function(t){return new u(n.blob(32),(function(t){return new r.PublicKey(t)}),(function(t){return t.toBuffer()}),t)};var c=function(t){J(r,t);var e=it(r);function r(t,i){var o;return V(this,r),(o=e.call(this,-1,i)).layout=t,o.discriminator=n.u8(),o}return G(r,[{key:"encode",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==t?this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+1)+1)}},{key:"decode",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return null;if(1===n)return this.layout.decode(t,e+1);throw new Error("Invalid option "+this.property)}},{key:"getSpan",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(t,e);if(0===n)return 1;if(1===n)return this.layout.getSpan(t,e+1)+1;throw new Error("Invalid option "+this.property)}}]),r}(n.Layout);function l(t){if(0===t)return!1;if(1===t)return!0;throw new Error("Invalid bool: "+t)}function h(t){return t?1:0}function d(t){var e=n.u32("length"),r=n.struct([e,n.blob(n.offset(e,-e.span),"data")]);return new u(r,(function(t){return t.data}),(function(t){return{data:t}}),t)}t.option=function(t,e){return new c(t,e)},t.bool=function(t){return new u(n.u8(),l,h,t)},t.vec=function(t,e){var r=n.u32("length"),i=n.struct([r,n.seq(t,n.offset(r,-r.span),"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),e)},t.tagged=function(t,e,r){var i=n.struct([s("tag"),e.replicate("data")]);return new u(i,(function(e){var n=e.tag,r=e.data;if(!n.eq(t))throw new Error("Invalid tag, expected: "+t.toString("hex")+", got: "+n.toString("hex"));return r}),(function(e){return{tag:t,data:e}}),r)},t.vecU8=d,t.str=function(t){return new u(d(),(function(t){return t.toString("utf-8")}),(function(t){return Tt.from(t,"utf-8")}),t)},t.rustEnum=function(t,e,r){var i=n.union(null!=r?r:n.u8(),e);return t.forEach((function(t,e){return i.addVariant(e,t,t.property)})),i},t.array=function(t,e,r){var i=n.struct([n.seq(t,e,"values")]);return new u(i,(function(t){return t.values}),(function(t){return{values:t}}),r)};var f=function(t){J(n,t);var e=it(n);function n(t,r,i){var o;return V(this,n),(o=e.call(this,t.span+r.span,i)).keyLayout=t,o.valueLayout=r,o}return G(n,[{key:"decode",value:function(t,e){return e=e||0,[this.keyLayout.decode(t,e),this.valueLayout.decode(t,e+this.keyLayout.getSpan(t,e))]}},{key:"encode",value:function(t,e,n){n=n||0;var r=this.keyLayout.encode(t[0],e,n);return r+this.valueLayout.encode(t[1],e,n+r)}},{key:"getSpan",value:function(t,e){return this.keyLayout.getSpan(t,e)+this.valueLayout.getSpan(t,e)}}]),n}(n.Layout);t.map=function(t,e,r){var i=n.u32("length"),o=n.struct([i,n.seq(new f(t,e),n.offset(i,-i.span),"values")]);return new u(o,(function(t){var e=t.values;return new Map(e)}),(function(t){return{values:Array.from(t.entries())}}),r)}}(Nf),pt.Web3MobileWallet;var If=pt.transact,Tf=Wn.Buffer,Cf=Un.exports,jf=Nf.struct([Nf.publicKey("mint"),Nf.publicKey("owner"),Nf.u64("amount"),Nf.u32("delegateOption"),Nf.publicKey("delegate"),Nf.u8("state"),Nf.u32("isNativeOption"),Nf.u64("isNative"),Nf.u64("delegatedAmount"),Nf.u32("closeAuthorityOption"),Nf.publicKey("closeAuthority")]);Nf.array;var Df=Nf.bool,Of=Nf.i128;Nf.i16;var _f=Nf.i32,zf=Nf.i64;Nf.i8,Nf.map;var Pf=Nf.option,Bf=Nf.publicKey,Rf=Nf.rustEnum,Uf=Nf.str,Wf=Nf.struct;Nf.tagged;var Qf=Nf.u128,Ff=Nf.u16,Yf=Nf.u32,Hf=Nf.u64,Vf=Nf.u8,qf=Nf.vec;Nf.vecU8;const Gf="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAxOTIgMTkyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAxOTIgMTkyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxwYXRoIGZpbGw9IiNGMEI5MEIiIGQ9Ik01NCw0MS4xbDQyLTI0LjJsNDIsMjQuMmwtMTUuNCw4LjlMOTYsMzQuOUw2OS40LDUwTDU0LDQxLjF6IE0xMzgsNzEuN2wtMTUuNC04LjlMOTYsNzhMNjkuNCw2Mi43bC0xNS40LDl2MTgKCUw4MC42LDEwNXYzMC41bDE1LjQsOWwxNS40LTlWMTA1TDEzOCw4OS43VjcxLjd6IE0xMzgsMTIwLjN2LTE4bC0xNS40LDguOXYxOEMxMjIuNiwxMjkuMSwxMzgsMTIwLjMsMTM4LDEyMC4zeiBNMTQ4LjksMTI2LjQKCWwtMjYuNiwxNS4zdjE4bDQyLTI0LjJWODdsLTE1LjQsOUMxNDguOSw5NiwxNDguOSwxMjYuNCwxNDguOSwxMjYuNHogTTEzMy41LDU2LjRsMTUuNCw5djE4bDE1LjQtOXYtMThsLTE1LjQtOUwxMzMuNSw1Ni40CglMMTMzLjUsNTYuNHogTTgwLjYsMTQ4LjN2MThsMTUuNCw5bDE1LjQtOXYtMThMOTYsMTU3LjFMODAuNiwxNDguM3ogTTU0LDEyMC4zbDE1LjQsOXYtMTguMUw1NCwxMDIuM0w1NCwxMjAuM0w1NCwxMjAuM3oKCSBNODAuNiw1Ni40bDE1LjQsOWwxNS40LTlMOTYsNDcuNUM5Niw0Ny40LDgwLjYsNTYuNCw4MC42LDU2LjRMODAuNiw1Ni40eiBNNDMuMSw2NS40bDE1LjQtOWwtMTUuNC05bC0xNS40LDl2MThsMTUuNCw5TDQzLjEsNjUuNAoJTDQzLjEsNjUuNHogTTQzLjEsOTUuOUwyNy43LDg3djQ4LjVsNDIsMjQuMnYtMThsLTI2LjYtMTUuM1Y5NS45TDQzLjEsOTUuOXoiLz4KPC9zdmc+Cg==";var Zf={name:"bsc",id:"0x38",networkId:"56",namespace:"eip155",label:"BNB Smart Chain",fullName:"BNB Smart Chain Mainnet",logo:Gf,currency:{name:"BNB",symbol:"BNB",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"},wrapped:{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"},stables:{usd:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955","0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"]},explorer:"https://bscscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://bscscan.com/tx/${t.id||t}`:e?`https://bscscan.com/token/${e}`:n?`https://bscscan.com/address/${n}`:void 0,endpoints:["https://bsc-dataseed.binance.org","https://bsc-dataseed1.ninicoin.io","https://bsc-dataseed3.defibit.io"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"BNB",name:"Binance Coin",decimals:18,logo:Gf,type:"NATIVE"},{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",symbol:"WBNB",name:"Wrapped BNB",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png",type:"20"},{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:"BUSD",name:"BUSD Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56/logo.png",type:"20"},{address:"0x55d398326f99059fF775485246999027B3197955",symbol:"USDT",name:"Tether USD",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",type:"20"},{address:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",symbol:"USDC",name:"USD Coin",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d/logo.png",type:"20"},{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:"ETH",name:"Ethereum Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2170Ed0880ac9A755fd29B2688956BD959F933F8/logo.png",type:"20"},{address:"0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",symbol:"Cake",name:"PancakeSwap Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82/logo.png",type:"20"},{address:"0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",symbol:"BTCB",name:"BTCB Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://integrate.depay.com/tokens/bsc/0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb/image",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Jf="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiCgkgaW1hZ2UtcmVuZGVyaW5nPSJvcHRpbWl6ZVF1YWxpdHkiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIiB0ZXh0LXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIgoJIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjgzLjUgMjgzLjUiCgkgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjgzLjUgMjgzLjU7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGc+Cgk8Zz4KCQk8cGF0aCBmaWxsPSIjMzQzNDM0IiBkPSJNMTQxLjcsMjUuOWwtMS41LDUuMnYxNTMuM2wxLjUsMS41bDcxLjItNDIuMUwxNDEuNywyNS45eiIvPgoJCTxwYXRoIGZpbGw9IiM4QzhDOEMiIGQ9Ik0xNDEuNywyNS45TDcwLjYsMTQzLjhsNzEuMSw0Mi4xdi03NC40VjI1Ljl6Ii8+CgkJPHBhdGggZmlsbD0iIzNDM0MzQiIgZD0iTTE0MS43LDE5OS40bC0wLjgsMS4xdjU0LjZsMC44LDIuNWw3MS4yLTEwMC4zTDE0MS43LDE5OS40eiIvPgoJCTxwYXRoIGZpbGw9IiM4QzhDOEMiIGQ9Ik0xNDEuNywyNTcuNnYtNTguMmwtNzEuMS00Mi4xTDE0MS43LDI1Ny42eiIvPgoJCTxwYXRoIGZpbGw9IiMxNDE0MTQiIGQ9Ik0xNDEuNywxODUuOWw3MS4yLTQyLjFsLTcxLjItMzIuM1YxODUuOXoiLz4KCQk8cGF0aCBmaWxsPSIjMzkzOTM5IiBkPSJNNzAuNiwxNDMuOGw3MS4xLDQyLjF2LTc0LjRMNzAuNiwxNDMuOHoiLz4KCTwvZz4KPC9nPgo8L3N2Zz4K";var Xf={name:"ethereum",id:"0x1",networkId:"1",namespace:"eip155",label:"Ethereum",fullName:"Ethereum Mainnet",logo:Jf,currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"},wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"},stables:{usd:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7","0x6B175474E89094C44Da98b954EedeAC495271d0F"]},explorer:"https://etherscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://etherscan.io/tx/${t.id||t}`:e?`https://etherscan.io/token/${e}`:n?`https://etherscan.io/address/${n}`:void 0,endpoints:["https://rpc.ankr.com/eth","https://eth.llamarpc.com","https://ethereum.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:Jf,type:"NATIVE"},{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",type:"20"},{address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xdAC17F958D2ee523a2206206994597C13D831ec7",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x6B175474E89094C44Da98b954EedeAC495271d0F",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x853d955aCEf822Db058eb8505911ED77F175b99e",symbol:"FRAX",name:"Frax",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x853d955aCEf822Db058eb8505911ED77F175b99e/logo.png",type:"20"},{address:"0x8E870D67F660D95d5be530380D0eC0bd388289E1",symbol:"USDP",name:"Pax Dollar",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x8E870D67F660D95d5be530380D0eC0bd388289E1/logo.png",type:"20"},{address:"0x956F47F50A910163D8BF957Cf5846D573E7f87CA",symbol:"FEI",name:"Fei USD",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x956F47F50A910163D8BF957Cf5846D573E7f87CA/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://integrate.depay.com/tokens/ethereum/0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb/image",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Kf="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgMTkyIDE5MiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTkyIDE5MjsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8ZyBpZD0iY2lyY2xlIj4KCTxnIGlkPSJGYW50b20tY2lyY2xlIj4KCQk8Y2lyY2xlIGlkPSJPdmFsIiBmaWxsUnVsZT0iZXZlbm9kZCIgY2xpcFJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiMxOTY5RkYiIGNsYXNzPSJzdDAiIGN4PSI5NiIgY3k9Ijk2IiByPSI4MC40Ii8+CgkJPHBhdGggaWQ9IlNoYXBlIiBmaWxsPSIjRkZGRkZGIiBkPSJNOTEuMSw0MS4yYzIuNy0xLjQsNi44LTEuNCw5LjUsMGwyNy42LDE0LjZjMS42LDAuOSwyLjUsMi4xLDIuNywzLjVoMHY3My4zCgkJCWMwLDEuNC0wLjksMi45LTIuNywzLjhsLTI3LjYsMTQuNmMtMi43LDEuNC02LjgsMS40LTkuNSwwbC0yNy42LTE0LjZjLTEuOC0wLjktMi42LTIuNC0yLjctMy44YzAtMC4xLDAtMC4zLDAtMC40bDAtNzIuNAoJCQljMC0wLjEsMC0wLjIsMC0wLjNsMC0wLjJoMGMwLjEtMS4zLDEtMi42LDIuNi0zLjVMOTEuMSw0MS4yeiBNMTI2LjYsOTkuOWwtMjYsMTMuN2MtMi43LDEuNC02LjgsMS40LTkuNSwwTDY1LjIsMTAwdjMyLjMKCQkJbDI1LjksMTMuNmMxLjUsMC44LDMuMSwxLjYsNC43LDEuN2wwLjEsMGMxLjUsMCwzLTAuOCw0LjYtMS41bDI2LjItMTMuOVY5OS45eiBNNTYuNSwxMzAuOWMwLDIuOCwwLjMsNC43LDEsNgoJCQljMC41LDEuMSwxLjMsMS45LDIuOCwyLjlsMC4xLDAuMWMwLjMsMC4yLDAuNywwLjQsMS4xLDAuN2wwLjUsMC4zbDEuNiwwLjlsLTIuMiwzLjdsLTEuNy0xLjFsLTAuMy0wLjJjLTAuNS0wLjMtMC45LTAuNi0xLjMtMC44CgkJCWMtNC4yLTIuOC01LjctNS45LTUuNy0xMi4zbDAtMC4ySDU2LjV6IE05My44LDgwLjVjLTAuMiwwLjEtMC40LDAuMS0wLjYsMC4yTDY1LjYsOTUuM2MwLDAtMC4xLDAtMC4xLDBsMCwwbDAsMGwwLjEsMGwyNy42LDE0LjYKCQkJYzAuMiwwLjEsMC40LDAuMiwwLjYsMC4yVjgwLjV6IE05OC4yLDgwLjV2MjkuOGMwLjItMC4xLDAuNC0wLjEsMC42LTAuMmwyNy42LTE0LjZjMCwwLDAuMSwwLDAuMSwwbDAsMGwwLDBsLTAuMSwwTDk4LjgsODAuNwoJCQlDOTguNiw4MC42LDk4LjQsODAuNSw5OC4yLDgwLjV6IE0xMjYuNiw2NC40bC0yNC44LDEzbDI0LjgsMTNWNjQuNHogTTY1LjIsNjQuNHYyNi4xbDI0LjgtMTNMNjUuMiw2NC40eiBNOTguNyw0NS4xCgkJCWMtMS40LTAuOC00LTAuOC01LjUsMEw2NS42LDU5LjdjMCwwLTAuMSwwLTAuMSwwbDAsMGwwLDBsMC4xLDBsMjcuNiwxNC42YzEuNCwwLjgsNCwwLjgsNS41LDBsMjcuNi0xNC42YzAsMCwwLjEsMCwwLjEsMGwwLDBsMCwwCgkJCWwtMC4xLDBMOTguNyw0NS4xeiBNMTMwLjcsNDYuNWwxLjcsMS4xbDAuMywwLjJjMC41LDAuMywwLjksMC42LDEuMywwLjhjNC4yLDIuOCw1LjcsNS45LDUuNywxMi4zbDAsMC4yaC00LjNjMC0yLjgtMC4zLTQuNy0xLTYKCQkJYy0wLjUtMS4xLTEuMy0xLjktMi44LTIuOWwtMC4xLTAuMWMtMC4zLTAuMi0wLjctMC40LTEuMS0wLjdsLTAuNS0wLjNsLTEuNi0wLjlMMTMwLjcsNDYuNXoiLz4KCTwvZz4KPC9nPgo8L3N2Zz4K";var $f={name:"fantom",id:"0xFA",networkId:"250",namespace:"eip155",label:"Fantom",fullName:"Fantom Opera",logo:Kf,currency:{name:"Fantom",symbol:"FTM",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"},wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83"},stables:{usd:["0x04068DA6C83AFCFA0e13ba15A6696662335D5B75","0x049d68029688eAbF473097a2fC38ef61633A3C7A","0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E"]},explorer:"https://ftmscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://ftmscan.com/tx/${t.id||t}`:e?`https://ftmscan.com/token/${e}`:n?`https://ftmscan.com/address/${n}`:void 0,endpoints:["https://rpc.ftm.tools","https://fantom.publicnode.com","https://rpc2.fantom.network"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"FTM",name:"Fantom",decimals:18,logo:Kf,type:"NATIVE"},{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",symbol:"WFTM",name:"Wrapped Fantom",decimals:18,logo:Kf,type:"20"},{address:"0x04068DA6C83AFCFA0e13ba15A6696662335D5B75",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"},{address:"0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://assets.spooky.fi/tokens/DAI.png",type:"20"},{address:"0x049d68029688eAbF473097a2fC38ef61633A3C7A",symbol:"fUSDT",name:"Frapped USDT",decimals:6,logo:"https://assets.spooky.fi/tokens/fUSDT.png",type:"20"},{address:"0x74b23882a30290451A17c44f4F05243b6b58C76d",symbol:"ETH",name:"Ethereum",decimals:18,logo:"https://assets.spooky.fi/tokens/wETH.png",type:"20"},{address:"0x321162Cd933E2Be498Cd2267a90534A804051b11",symbol:"BTC",name:"Bitcoin",decimals:8,logo:"https://assets.spooky.fi/tokens/wBTC.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const tp="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI3LjIuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA0NS40IDQ1LjQiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ1LjQgNDUuNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiM4MjQ3RTU7fQo8L3N0eWxlPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNiwyMWMtMC43LDAuNC0xLjEsMS4xLTEuMSwydjguOGMwLDAuOSwwLjQsMS42LDEuMSwybDcuNSw0LjRjMC43LDAuNCwxLjUsMC40LDIuMiwwbDcuNS00LjQKCWMwLjctMC40LDEuMS0xLjEsMS4xLTJ2LTMuMWwtMy41LTJ2Mi45YzAsMC45LTAuNCwxLjYtMS4xLDJsLTQsMi4zYy0wLjcsMC40LTEuNSwwLjQtMi4yLDBsLTMuOS0yLjNjLTAuNy0wLjQtMS4xLTEuMS0xLjEtMlYyNQoJYzAtMC45LDAuNC0xLjYsMS4xLTJsNC0yLjNjMC42LTAuNCwxLjUtMC40LDIuMiwwbDUuMSwyLjlsMy41LDIuMWw1LjEsMi45YzAuNywwLjQsMS41LDAuNCwyLjIsMGw3LjYtNC40YzAuNy0wLjQsMS4xLTEuMSwxLjEtMgoJdi04LjdjMC0wLjctMC40LTEuNC0xLjEtMS44bC03LjYtNC40Yy0wLjctMC40LTEuNS0wLjQtMi4yLDBMMjIsMTEuN2MtMC43LDAuNC0xLjEsMS4xLTEuMSwydjMuMmwzLjUsMi4xdi0zLjFjMC0wLjksMC40LTEuNiwxLjEtMgoJbDQtMi40YzAuNy0wLjQsMS41LTAuNCwyLjIsMGw0LDIuM2MwLjYsMC40LDEuMSwxLjEsMS4xLDJ2NC42YzAsMC45LTAuNSwxLjYtMS4xLDJsLTQsMi40Yy0wLjYsMC40LTEuNSwwLjQtMi4yLDBsLTUuMS0zLjFsLTMuNS0yCglsLTUuMy0zLjFjLTAuNi0wLjQtMS41LTAuNC0yLjIsMEMxMy40LDE2LjYsNi4xLDIxLDYsMjF6Ii8+Cjwvc3ZnPgo=";var ep={name:"polygon",id:"0x89",networkId:"137",namespace:"eip155",label:"Polygon",fullName:"Polygon Mainnet",logo:tp,currency:{name:"Polygon",symbol:"MATIC",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"},wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270"},stables:{usd:["0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174","0xc2132D05D31c914a87C6611C10748AEb04B58e8F","0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063"]},explorer:"https://polygonscan.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://polygonscan.com/tx/${t.id||t}`:e?`https://polygonscan.com/token/${e}`:n?`https://polygonscan.com/address/${n}`:void 0,endpoints:["https://polygon-rpc.com","https://poly-rpc.gateway.pokt.network","https://polygon.llamarpc.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"MATIC",name:"Polygon",decimals:18,logo:tp,type:"NATIVE"},{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",symbol:"WMATIC",name:"Wrapped Matic",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0/logo.png",type:"20"},{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",type:"20"},{address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0xa3Fa99A148fA48D14Ed51d610c367C61876997F1",symbol:"miMATIC",name:"miMATIC",decimals:18,logo:"https://raw.githubusercontent.com/0xlaozi/qidao/main/images/mimatic-red.png",type:"20"},{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const np="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA0NS40IDQ1LjQiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ1LjQgNDUuNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8bGluZWFyR3JhZGllbnQgaWQ9IlNPTEFOQV9TVkdJRF8xIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjM1LjU5NzQiIHkxPSI3NzIuOTI3NyIgeDI9IjE4LjE0MjIiIHkyPSI4MDYuMzYxNiIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgLTc2NS43NjUpIj4KCTxzdG9wICBvZmZzZXQ9IjAiIHN0eWxlPSJzdG9wLWNvbG9yOiMwMEZGQTMiLz4KCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNEQzFGRkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPHBhdGggZmlsbD0idXJsKCNTT0xBTkFfU1ZHSURfMSkiIGQ9Ik0xMiwyOS4xYzAuMi0wLjIsMC41LTAuMywwLjctMC4zSDM4YzAuNSwwLDAuNywwLjYsMC40LDAuOWwtNSw1Yy0wLjIsMC4yLTAuNSwwLjMtMC43LDAuM0g3LjQKCUM2LjksMzUsNi43LDM0LjQsNywzNEwxMiwyOS4xeiIvPgo8bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzAwMDAwMTYwODY5NzIyMjI5NDY0Mzk5NzMwMDAwMDA5NDA3MDIxNTc4MjQ4MDg3NzExXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIyNy45NTk1IiB5MT0iNzY5LjEyNDQiIHgyPSIxMC41MDQzIiB5Mj0iODAyLjU1ODIiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgMSAwIC03NjUuNzY1KSI+Cgk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojMDBGRkEzIi8+Cgk8c3RvcCAgb2Zmc2V0PSIxIiBzdHlsZT0ic3RvcC1jb2xvcjojREMxRkZGIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxwYXRoIHN0eWxlPSJmaWxsOnVybCgjU1ZHSURfMDAwMDAxNjA4Njk3MjIyMjk0NjQzOTk3MzAwMDAwMDk0MDcwMjE1NzgyNDgwODc3MTFfKTsiIGQ9Ik0xMiwxMC42YzAuMi0wLjIsMC41LTAuMywwLjctMC4zSDM4CgljMC41LDAsMC43LDAuNiwwLjQsMC45bC01LDVjLTAuMiwwLjItMC41LDAuMy0wLjcsMC4zSDcuNGMtMC41LDAtMC43LTAuNi0wLjQtMC45TDEyLDEwLjZ6Ii8+CjxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfMDAwMDAxMzkyODMyMTczNzg2NTYwOTQ4NjAwMDAwMDM2OTQ4OTUzNzkwNzgxMTY3ODJfIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjMxLjc0MDYiIHkxPSI3NzEuMDk4NSIgeDI9IjE0LjI4NTUiIHkyPSI4MDQuNTMyMyIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDAgLTc2NS43NjUpIj4KCTxzdG9wICBvZmZzZXQ9IjAiIHN0eWxlPSJzdG9wLWNvbG9yOiMwMEZGQTMiLz4KCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNEQzFGRkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPHBhdGggc3R5bGU9ImZpbGw6dXJsKCNTVkdJRF8wMDAwMDEzOTI4MzIxNzM3ODY1NjA5NDg2MDAwMDAwMzY5NDg5NTM3OTA3ODExNjc4Ml8pOyIgZD0iTTMzLjQsMTkuOGMtMC4yLTAuMi0wLjUtMC4zLTAuNy0wLjNINy40CgljLTAuNSwwLTAuNywwLjYtMC40LDAuOWw1LDVjMC4yLDAuMiwwLjUsMC4zLDAuNywwLjNIMzhjMC41LDAsMC43LTAuNiwwLjQtMC45TDMzLjQsMTkuOHoiLz4KPC9zdmc+Cg==";var rp={name:"solana",networkId:"mainnetBeta",namespace:"solana",label:"Solana",fullName:"Solana",logo:np,currency:{name:"Solana",symbol:"SOL",decimals:9,address:"11111111111111111111111111111111"},wrapped:{address:"So11111111111111111111111111111111111111112"},stables:{usd:["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]},explorer:"https://solscan.io",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://solscan.io/tx/${t.id||t}`:e?`https://solscan.io/token/${e}`:n?`https://solscan.io/address/${n}`:void 0,endpoints:["https://solana-mainnet.phantom.app/YBPpkkN4g91xDiAnTE9r0RcMkjg0sKUIWvAfoFVJ","https://mainnet-beta.solflare.network","https://solana-mainnet.rpc.extrnode.com"],rpc:"https://api.mainnet-beta.solana.com",tokens:[{address:"11111111111111111111111111111111",symbol:"SOL",name:"Solana",decimals:9,logo:np,type:"NATIVE"},{address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://img.raydium.io/icon/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png",type:"SPL"},{address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",symbol:"USDT",name:"USDT",decimals:6,logo:"https://img.raydium.io/icon/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB.png",type:"SPL"},{address:"7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj",symbol:"stSOL",name:"Lido Staked SOL",decimals:9,logo:"https://img.raydium.io/icon/7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj.png",type:"SPL"},{address:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",symbol:"BONK",name:"BONK",decimals:5,logo:"https://img.raydium.io/icon/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263.png",type:"SPL"},{address:"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",symbol:"SAMO",name:"Samoyed Coin",decimals:9,logo:"https://img.raydium.io/icon/7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU.png",type:"SPL"}],zero:"0",maxInt:"340282366920938463463374607431768211455"};const ip="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB2ZXJzaW9uPSIxLjEiCgkgdGV4dC1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iIGltYWdlLXJlbmRlcmluZz0ib3B0aW1pemVRdWFsaXR5IgoJIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNDUuNCA0NS40IgoJIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDQ1LjQgNDUuNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgo8L3N0eWxlPgo8cGF0aCBmaWxsPSIjMDAzN0MxIiBkPSJNMjguOCwyMi44bC02LjEsMTAuNmwtNi4xLTEwLjdMMjguOCwyMi44TDI4LjgsMjIuOHogTTM0LjksMTkuMkgxMC41bDEyLjIsMjEuNEwzNC45LDE5LjJ6IE02LjUsMTIuMWwyLDMuNgoJaDI4LjNsMi4xLTMuNkg2LjV6Ii8+Cjwvc3ZnPgo=";var op={name:"velas",id:"0x6a",networkId:"106",namespace:"eip155",label:"VELAS",fullName:"Velas EVM Mainnet",logo:ip,currency:{name:"Velas",symbol:"VLX",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"},wrapped:{address:"0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126"},stables:{usd:["0xc111c29A988AE0C0087D97b33C6E6766808A3BD3","0x01445C31581c354b7338AC35693AB2001B50b9aE"]},explorer:"https://evmexplorer.velas.com",explorerUrlFor:({transaction:t,token:e,address:n})=>t?`https://evmexplorer.velas.com/tx/${t.id||t}`:e?`https://evmexplorer.velas.com/token/${e}`:n?`https://evmexplorer.velas.com/address/${n}`:void 0,endpoints:["https://mainnet.velas.com/rpc","https://evmexplorer.velas.com/rpc","https://explorer.velas.com/rpc"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"VLX",name:"Velas",decimals:18,logo:ip,type:"NATIVE"},{address:"0xc579D1f3CF86749E05CD06f7ADe17856c2CE3126",symbol:"WVLX",name:"Wrapped Velas",decimals:18,logo:"https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0xc579d1f3cf86749e05cd06f7ade17856c2ce3126/logo.png?raw=true",type:"20"},{address:"0xc111c29A988AE0C0087D97b33C6E6766808A3BD3",symbol:"BUSD",name:"Multichain BUSD",decimals:18,logo:"https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0xc111c29a988ae0c0087d97b33c6e6766808a3bd3/logo.png?raw=true",type:"20"},{address:"0x01445C31581c354b7338AC35693AB2001B50b9aE",symbol:"USDT",name:"Multichain USDT",decimals:6,logo:"https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0x01445c31581c354b7338ac35693ab2001b50b9ae/logo.png?raw=true",type:"20"},{address:"0x85219708c49aa701871Ad330A94EA0f41dFf24Ca",symbol:"ETH",name:"ETH",decimals:18,logo:"https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0x85219708c49aa701871ad330a94ea0f41dff24ca/logo.png?raw=true",type:"20"},{address:"0xaBf26902Fd7B624e0db40D31171eA9ddDf078351",symbol:"WAG",name:"WagyuSwap",decimals:18,logo:"https://github.com/wagyuswapapp/assets/blob/master/blockchains/velas/assets/0xabf26902fd7b624e0db40d31171ea9dddf078351/logo.png?raw=true",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const ap=[Xf,Zf,ep,rp,$f,op];for(var sp={ethereum:Xf,bsc:Zf,polygon:ep,solana:rp,fantom:$f,velas:op,all:ap,findById:function(t){let e=t;e.match("0x0")&&(e=e.replace(/0x0+/,"0x"));let n=ap.find((t=>t.id&&t.id.toLowerCase()==e.toLowerCase()));return n},findByNetworkId:function(t){t=t.toString();let e=ap.find((e=>e.networkId==t));return e},findByName:function(t){return ap.find((e=>e.name==t))}},up=function(t){var e=gp(t),n=e[0],r=e[1];return 3*(n+r)/4-r},cp=function(t){var e,n,r=gp(t),i=r[0],o=r[1],a=new fp(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),s=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)e=dp[t.charCodeAt(n)]<<18|dp[t.charCodeAt(n+1)]<<12|dp[t.charCodeAt(n+2)]<<6|dp[t.charCodeAt(n+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=255&e;2===o&&(e=dp[t.charCodeAt(n)]<<2|dp[t.charCodeAt(n+1)]>>4,a[s++]=255&e);1===o&&(e=dp[t.charCodeAt(n)]<<10|dp[t.charCodeAt(n+1)]<<4|dp[t.charCodeAt(n+2)]>>2,a[s++]=e>>8&255,a[s++]=255&e);return a},lp=function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,a=0,s=n-r;a<s;a+=o)i.push(yp(t,a,a+o>s?s:a+o));1===r?(e=t[n-1],i.push(hp[e>>2]+hp[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(hp[e>>10]+hp[e>>4&63]+hp[e<<2&63]+"="));return i.join("")},hp=[],dp=[],fp="undefined"!=typeof Uint8Array?Uint8Array:Array,pp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mp=0;mp<64;++mp)hp[mp]=pp[mp],dp[pp.charCodeAt(mp)]=mp;function gp(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function yp(t,e,n){for(var r,i,o=[],a=e;a<n;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(hp[(i=r)>>18&63]+hp[i>>12&63]+hp[i>>6&63]+hp[63&i]);return o.join("")}dp["-".charCodeAt(0)]=62,dp["_".charCodeAt(0)]=63;var vp={byteLength:up,toByteArray:cp,fromByteArray:lp},wp=function(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},bp=function(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*m},Mp=o((function(t,e){const n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){+t!=t&&(t=0);return o.alloc(+t)},e.INSPECT_MAX_BYTES=50;const r=2147483647;function i(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return a(t,e,n)}function a(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|d(t,e);let r=i(n);const a=r.write(t,e);a!==n&&(r=r.slice(0,a));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(V(t,Uint8Array)){const e=new Uint8Array(t);return l(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(V(t,ArrayBuffer)||t&&V(t.buffer,ArrayBuffer))return l(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(V(t,SharedArrayBuffer)||t&&V(t.buffer,SharedArrayBuffer)))return l(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,n);const a=function(t){if(o.isBuffer(t)){const e=0|h(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||q(t.length)?i(0):c(t);if("Buffer"===t.type&&Array.isArray(t.data))return c(t.data)}(t);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return s(t),i(t<0?0:0|h(t))}function c(t){const e=t.length<0?0:0|h(t.length),n=i(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function l(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,o.prototype),r}function h(t){if(t>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function d(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||V(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Y(t).length;default:if(i)return r?-1:F(t).length;e=(""+e).toLowerCase(),i=!0}}function f(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,n);case"utf8":case"utf-8":return A(this,e,n);case"ascii":return E(this,e,n);case"latin1":case"binary":return x(this,e,n);case"base64":return k(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function p(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:g(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):g(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,n,r,i){let o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let r=-1;for(o=n;o<s;o++)if(c(t,o)===c(e,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===u)return r*a}else-1!==r&&(o-=o-r),r=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let r=0;r<u;r++)if(c(t,o+r)!==c(e,r)){n=!1;break}if(n)return o}return-1}function y(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=e.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(e.substr(2*a,2),16);if(q(r))return a;t[n+a]=r}return a}function v(t,e,n,r){return H(F(e,t.length-n),t,n,r)}function w(t,e,n,r){return H(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function b(t,e,n,r){return H(Y(e),t,n,r)}function M(t,e,n,r){return H(function(t,e){let n,r,i;const o=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function k(t,e,n){return 0===e&&n===t.length?vp.fromByteArray(t):vp.fromByteArray(t.slice(e,n))}function A(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let o=null,a=e>239?4:e>223?3:e>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:e<128&&(o=e);break;case 2:n=t[i+1],128==(192&n)&&(u=(31&e)<<6|63&n,u>127&&(o=u));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(u=(15&e)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=t[i+1],r=t[i+2],s=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(t){const e=t.length;if(e<=L)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=L));return n}(r)}e.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(t,e,n){return a(t,e,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(t,e,n){return function(t,e,n){return s(t),t<=0?i(t):void 0!==e?"string"==typeof n?i(t).fill(e,n):i(t).fill(e):i(t)}(t,e,n)},o.allocUnsafe=function(t){return u(t)},o.allocUnsafeSlow=function(t){return u(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if(V(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),V(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=o.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(V(e,Uint8Array))i+e.length>r.length?(o.isBuffer(e)||(e=o.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!o.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},o.byteLength=d,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)p(this,e,e+1);return this},o.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)p(this,e,e+3),p(this,e+1,e+2);return this},o.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)p(this,e,e+7),p(this,e+1,e+6),p(this,e+2,e+5),p(this,e+3,e+4);return this},o.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?A(this,0,t):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){let t="";const n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(t,e,n,r,i){if(V(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(e>>>=0);const u=Math.min(a,s),c=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<u;++t)if(c[t]!==l[t]){a=c[t],s=l[t];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},o.prototype.indexOf=function(t,e,n){return m(this,t,e,n,!0)},o.prototype.lastIndexOf=function(t,e,n){return m(this,t,e,n,!1)},o.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return y(this,t,e,n);case"utf8":case"utf-8":return v(this,t,e,n);case"ascii":case"latin1":case"binary":return w(this,t,e,n);case"base64":return b(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const L=4096;function E(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function x(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function N(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=G[t[r]];return i}function S(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function I(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function T(t,e,n,r,i,a){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<a)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function C(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,a>>=8,t[n++]=a,n}function j(t,e,n,r,i){R(e,r,i,t,n,7);let o=Number(e&BigInt(4294967295));t[n+7]=o,o>>=8,t[n+6]=o,o>>=8,t[n+5]=o,o>>=8,t[n+4]=o;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=a,a>>=8,t[n+2]=a,a>>=8,t[n+1]=a,a>>=8,t[n]=a,n+8}function D(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,4),bp(t,e,n,r,23,4),n+4}function _(t,e,n,r,i){return e=+e,n>>>=0,i||D(t,0,n,8),bp(t,e,n,r,52,8),n+8}o.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||I(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readBigUInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=this[t],i=1,o=0;for(;++o<e&&(i*=256);)r+=this[t+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||I(t,e,this.length);let r=e,i=1,o=this[t+--r];for(;r>0&&(i*=256);)o+=this[t+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return t>>>=0,e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||I(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){t>>>=0,e||I(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readBigInt64LE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),o.prototype.readBigInt64BE=Z((function(t){U(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),o.prototype.readFloatLE=function(t,e){return t>>>=0,e||I(t,4,this.length),wp(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||I(t,4,this.length),wp(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||I(t,8,this.length),wp(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||I(t,8,this.length),wp(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){T(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){T(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigUInt64LE=Z((function(t,e=0){return C(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(t,e=0){return j(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);T(this,t,e,n,r-1,-r)}let i=0,o=1,a=0;for(this[e]=255&t;++i<n&&(o*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/o>>0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);T(this,t,e,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[e+i]=255&t;--i>=0&&(o*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/o>>0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeBigInt64LE=Z((function(t,e=0){return C(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(t,e=0){return j(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(t,e,n){return O(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return O(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return _(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return _(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},o.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const a=o.isBuffer(t)?t:o.from(t,r),s=a.length;if(0===s)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=a[i%s]}return this};const z={};function P(t,e,n){z[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function B(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function R(t,e,n,r,i,o){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=o>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new z.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){U(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,o)}function U(t,e){if("number"!=typeof t)throw new z.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw U(t,n),new z.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}P("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),P("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),P("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=B(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const Q=/[^+/0-9A-Za-z-_]/g;function F(t,e){let n;e=e||1/0;const r=t.length;let i=null;const o=[];for(let a=0;a<r;++a){if(n=t.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Y(t){return vp.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(Q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function V(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function q(t){return t!=t}const G=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Z(t){return"undefined"==typeof BigInt?J:t}function J(){throw new Error("BigInt not supported")}})),kp=o((function(t){!function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function r(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function i(t,e,n){if(i.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var o;"object"==typeof t?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Mp.Buffer}catch(t){}function a(t,e){var r=t.charCodeAt(e);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+t)}function s(t,e,n){var r=a(t,n);return n-1>=e&&(r|=a(t,n-1)<<4),r}function u(t,e,r,i){for(var o=0,a=0,s=Math.min(t.length,r),u=e;u<s;u++){var c=t.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(t,e){t.words=e.words,t.length=e.length,t.negative=e.negative,t.red=e.red}if(i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"==typeof t)return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<t.length&&(16===e?this._parseHex(t,i,r):(this._parseBase(t,e,i),"le"===r&&this._initArray(this.toArray(),e,r)))},i.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},i.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(t,e,n){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=t.length-1;r>=e;r-=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(t.length-e)%2==0?e+1:e;r<t.length;r+=2)i=s(t,e,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},i.prototype._move=function(t){c(t,this)},i.prototype.clone=function(){var t=new i(null);return this.copy(t),t},i.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(t){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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];i.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var c=d[t],l=f[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(t);r=(p=p.idivn(l)).isZero()?m+r:h[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(t,e){return this.toArrayLike(o,t,e)}),i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)};function p(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(t,e,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(t,e){return t.allocUnsafe?t.allocUnsafe(e):new t(e)}(t,o);return this["_toArrayLike"+("le"===e?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(t,e){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n++]=255&a,n<t.length&&(t[n++]=a>>8&255),n<t.length&&(t[n++]=a>>16&255),6===o?(n<t.length&&(t[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<t.length)for(t[n++]=r;n<t.length;)t[n++]=0},i.prototype._toArrayLikeBE=function(t,e){for(var n=t.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;t[n--]=255&a,n>=0&&(t[n--]=a>>8&255),n>=0&&(t[n--]=a>>16&255),6===o?(n>=0&&(t[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(t[n--]=r;n>=0;)t[n--]=0},Math.clz32?i.prototype._countBits=function(t){return 32-Math.clz32(t)}:i.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},i.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this._strip()},i.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},i.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this._strip()},i.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},i.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this._strip()},i.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},i.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(t){return this.clone().isub(t)};var m=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,v=g>>>13,w=0|a[3],b=8191&w,M=w>>>13,k=0|a[4],A=8191&k,L=k>>>13,E=0|a[5],x=8191&E,N=E>>>13,S=0|a[6],I=8191&S,T=S>>>13,C=0|a[7],j=8191&C,D=C>>>13,O=0|a[8],_=8191&O,z=O>>>13,P=0|a[9],B=8191&P,R=P>>>13,U=0|s[0],W=8191&U,Q=U>>>13,F=0|s[1],Y=8191&F,H=F>>>13,V=0|s[2],q=8191&V,G=V>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,W))|0)+((8191&(i=(i=Math.imul(h,Q))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,Q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,W),i=(i=Math.imul(p,Q))+Math.imul(m,W)|0,o=Math.imul(m,Q);var yt=(c+(r=r+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,W),i=(i=Math.imul(y,Q))+Math.imul(v,W)|0,o=Math.imul(v,Q),r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,q)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(d,q)|0))<<13)|0;c=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,W),i=(i=Math.imul(b,Q))+Math.imul(M,W)|0,o=Math.imul(M,Q),r=r+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,G)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(A,W),i=(i=Math.imul(A,Q))+Math.imul(L,W)|0,o=Math.imul(L,Q),r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,G)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,W),i=(i=Math.imul(x,Q))+Math.imul(N,W)|0,o=Math.imul(N,Q),r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(b,q)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,G)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(I,W),i=(i=Math.imul(I,Q))+Math.imul(T,W)|0,o=Math.imul(T,Q),r=r+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(A,q)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,G)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Q))+Math.imul(D,W)|0,o=Math.imul(D,Q),r=r+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(x,q)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,G)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var At=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(_,W),i=(i=Math.imul(_,Q))+Math.imul(z,W)|0,o=Math.imul(z,Q),r=r+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,G)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Lt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,W),i=(i=Math.imul(B,Q))+Math.imul(R,W)|0,o=Math.imul(R,Q),r=r+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(z,Y)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,q)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,G)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,Y),i=(i=Math.imul(B,H))+Math.imul(R,Y)|0,o=Math.imul(R,H),r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(z,q)|0,o=o+Math.imul(z,G)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,q),i=(i=Math.imul(B,G))+Math.imul(R,q)|0,o=Math.imul(R,G),r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,X)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var Nt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,dt)|0;var St=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,dt)|0;var Tt=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var Ct=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,mt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=kt,u[7]=At,u[8]=Lt,u[9]=Et,u[10]=xt,u[11]=Nt,u[12]=St,u[13]=It,u[14]=Tt,u[15]=Ct,u[16]=jt,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function g(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function y(t,e,n){return g(t,e,n)}Math.imul||(m=p),i.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?m(this,t,e):n<63?p(this,t,e):n<1024?g(this,t,e):y(this,t,e)},i.prototype.mul=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},i.prototype.mulf=function(t){var e=new i(null);return e.words=new Array(this.length+t.length),y(this,t,e)},i.prototype.imul=function(t){return this.clone().mulTo(t,this)},i.prototype.imuln=function(t){var e=t<0;e&&(t=-t),n("number"==typeof t),n(t<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*t,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),e?this.ineg():this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=t.words[r]>>>i&1}return e}(t);if(0===e.length)return new i(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var o=n.sqr();r<e.length;r++,o=o.sqr())0!==e[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<r;this.words[e]=u|a,a=s>>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},i.prototype.iushrn=function(t,e,r){var i;n("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<<e;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(t){return this.clone().imaskn(t)},i.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<=t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},i.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this._strip()},i.prototype.addn=function(t){return this.clone().iaddn(t)},i.prototype.subn=function(t){return this.clone().isubn(t)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(t,e,r){var i,o,a=t.length+r;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),o=t,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==e){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(o=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:o,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modrn(t.words[0]))}:this._wordDiv(t,e);var o,a,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},i.prototype.modrn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=(1<<26)%t,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%t;return e?-i:i},i.prototype.modn=function(t){return this.modrn(t)},i.prototype.idivn=function(t){var e=t<0;e&&(t=-t),n(t<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/t|0,r=o%t}return this._strip(),e?this.ineg():this},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),o.isub(s),a.isub(u)):(r.isub(e),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(o=0===e.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(t),o},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},i.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},i.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new L(t)},i.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var v={k256:null,p224:null,p192:null,p25519:null};function w(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function L(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function E(t){L.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(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)}w.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},w.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(t,e){t.iushrn(this.n,0,e)},w.prototype.imulK=function(t){return t.imul(this.k)},r(b,w),b.prototype.split=function(t,e){for(var n=4194303,r=Math.min(t.length,9),i=0;i<r;i++)e.words[i]=t.words[i];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(e.words[e.length++]=o&n,i=10;i<t.length;i++){var a=0|t.words[i];t.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,t.words[i-10]=o,0===o&&t.length>10?t.length-=10:t.length-=9},b.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},r(M,w),r(k,w),r(A,w),A.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(v[t])return v[t];var e;if("k256"===t)e=new b;else if("p224"===t)e=new M;else if("p192"===t)e=new k;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new A}return v[t]=e,e},L.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},L.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},L.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(c(t,t.umod(this.m)._forceRed(this)),t)},L.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},L.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},L.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},L.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},L.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},L.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},L.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},L.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},L.prototype.isqr=function(t){return this.imul(t,t.clone())},L.prototype.sqr=function(t){return this.mul(t,t)},L.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new i(1)).iushrn(2);return this.pow(t,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(t,o.addn(1).iushrn(1)),f=this.pow(t,o),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var y=this.pow(h,new i(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},L.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},L.prototype.pow=function(t,e){if(e.isZero())return new i(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var o=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},L.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},L.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new E(t)},r(E,L),E.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},E.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},E.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,r)}));
8
8
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */let Ap=!1,Lp=!1;const Ep={debug:1,default:2,info:2,warning:3,error:4,off:5};let xp=Ep.default,Np=null;const Sp=function(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach((e=>{try{if("test"!=="test".normalize(e))throw new Error("bad normalize")}catch(n){t.push(e)}})),t.length)throw new Error("missing "+t.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(t){return t.message}return null}();var Ip,Tp;!function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"}(Ip||(Ip={})),function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"}(Tp||(Tp={}));const Cp="0123456789abcdef";class jp{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();null==Ep[n]&&this.throwArgumentError("invalid log level name","logLevel",t),xp>Ep[n]||console.log.apply(console,e)}debug(...t){this._log(jp.levels.DEBUG,t)}info(...t){this._log(jp.levels.INFO,t)}warn(...t){this._log(jp.levels.WARNING,t)}makeError(t,e,n){if(Lp)return this.makeError("censored error",e,{});e||(e=jp.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((t=>{const e=n[t];try{if(e instanceof Uint8Array){let n="";for(let t=0;t<e.length;t++)n+=Cp[e[t]>>4],n+=Cp[15&e[t]];r.push(t+"=Uint8Array(0x"+n+")")}else r.push(t+"="+JSON.stringify(e))}catch(e){r.push(t+"="+JSON.stringify(n[t].toString()))}})),r.push(`code=${e}`),r.push(`version=${this.version}`);const i=t;let o="";switch(e){case Tp.NUMERIC_FAULT:{o="NUMERIC_FAULT";const e=t;switch(e){case"overflow":case"underflow":case"division-by-zero":o+="-"+e;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Tp.CALL_EXCEPTION:case Tp.INSUFFICIENT_FUNDS:case Tp.MISSING_NEW:case Tp.NONCE_EXPIRED:case Tp.REPLACEMENT_UNDERPRICED:case Tp.TRANSACTION_REPLACED:case Tp.UNPREDICTABLE_GAS_LIMIT:o=e}o&&(t+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(t+=" ("+r.join(", ")+")");const a=new Error(t);return a.reason=i,a.code=e,Object.keys(n).forEach((function(t){a[t]=n[t]})),a}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,jp.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,r){t||this.throwError(e,n,r)}assertArgument(t,e,n,r){t||this.throwArgumentError(e,n,r)}checkNormalize(t){Sp&&this.throwError("platform missing String.prototype.normalize",jp.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Sp})}checkSafeUint53(t,e){"number"==typeof t&&(null==e&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,jp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,jp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",t<e&&this.throwError("missing argument"+n,jp.errors.MISSING_ARGUMENT,{count:t,expectedCount:e}),t>e&&this.throwError("too many arguments"+n,jp.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&null!=t||this.throwError("missing new",jp.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",jp.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",jp.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Np||(Np=new jp("logger/5.7.0")),Np}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",jp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Ap){if(!t)return;this.globalLogger().throwError("error censorship permanent",jp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Lp=!!t,Ap=!!e}static setLogLevel(t){const e=Ep[t.toLowerCase()];null!=e?xp=e:jp.globalLogger().warn("invalid log level - "+t)}static from(t){return new jp(t)}}jp.errors=Tp,jp.levels=Ip;const Dp=new jp("bytes/5.7.0");function Op(t){return!!t.toHexString}function _p(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return _p(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function zp(t){return Qp(t)&&!(t.length%2)||Bp(t)}function Pp(t){return"number"==typeof t&&t==t&&t%1==0}function Bp(t){if(null==t)return!1;if(t.constructor===Uint8Array)return!0;if("string"==typeof t)return!1;if(!Pp(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const n=t[e];if(!Pp(n)||n<0||n>=256)return!1}return!0}function Rp(t,e){if(e||(e={}),"number"==typeof t){Dp.checkSafeUint53(t,"invalid arrayify value");const e=[];for(;t;)e.unshift(255&t),t=parseInt(String(t/256));return 0===e.length&&e.push(0),_p(new Uint8Array(e))}if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Op(t)&&(t=t.toHexString()),Qp(t)){let n=t.substring(2);n.length%2&&("left"===e.hexPad?n="0"+n:"right"===e.hexPad?n+="0":Dp.throwArgumentError("hex data is odd-length","value",t));const r=[];for(let t=0;t<n.length;t+=2)r.push(parseInt(n.substring(t,t+2),16));return _p(new Uint8Array(r))}return Bp(t)?_p(new Uint8Array(t)):Dp.throwArgumentError("invalid arrayify value","value",t)}function Up(t){const e=t.map((t=>Rp(t))),n=e.reduce(((t,e)=>t+e.length),0),r=new Uint8Array(n);return e.reduce(((t,e)=>(r.set(e,t),t+e.length)),0),_p(r)}function Wp(t){let e=Rp(t);if(0===e.length)return e;let n=0;for(;n<e.length&&0===e[n];)n++;return n&&(e=e.slice(n)),e}function Qp(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!e||t.length===2+2*e)}const Fp="0123456789abcdef";function Yp(t,e){if(e||(e={}),"number"==typeof t){Dp.checkSafeUint53(t,"invalid hexlify value");let e="";for(;t;)e=Fp[15&t]+e,t=Math.floor(t/16);return e.length?(e.length%2&&(e="0"+e),"0x"+e):"0x00"}if("bigint"==typeof t)return(t=t.toString(16)).length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&"string"==typeof t&&"0x"!==t.substring(0,2)&&(t="0x"+t),Op(t))return t.toHexString();if(Qp(t))return t.length%2&&("left"===e.hexPad?t="0x0"+t.substring(2):"right"===e.hexPad?t+="0":Dp.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Bp(t)){let e="0x";for(let n=0;n<t.length;n++){let r=t[n];e+=Fp[(240&r)>>4]+Fp[15&r]}return e}return Dp.throwArgumentError("invalid hexlify value","value",t)}function Hp(t){if("string"!=typeof t)t=Yp(t);else if(!Qp(t)||t.length%2)return null;return(t.length-2)/2}function Vp(t,e,n){return"string"!=typeof t?t=Yp(t):(!Qp(t)||t.length%2)&&Dp.throwArgumentError("invalid hexData","value",t),e=2+2*e,null!=n?"0x"+t.substring(e,2+2*n):"0x"+t.substring(e)}function qp(t){let e="0x";return t.forEach((t=>{e+=Yp(t).substring(2)})),e}function Gp(t){const e=function(t){"string"!=typeof t&&(t=Yp(t));Qp(t)||Dp.throwArgumentError("invalid hex string","value",t);t=t.substring(2);let e=0;for(;e<t.length&&"0"===t[e];)e++;return"0x"+t.substring(e)}(Yp(t,{hexPad:"left"}));return"0x"===e?"0x0":e}function Zp(t,e){for("string"!=typeof t?t=Yp(t):Qp(t)||Dp.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&Dp.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Jp(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(zp(t)){let n=Rp(t);64===n.length?(e.v=27+(n[32]>>7),n[32]&=127,e.r=Yp(n.slice(0,32)),e.s=Yp(n.slice(32,64))):65===n.length?(e.r=Yp(n.slice(0,32)),e.s=Yp(n.slice(32,64)),e.v=n[64]):Dp.throwArgumentError("invalid signature string","signature",t),e.v<27&&(0===e.v||1===e.v?e.v+=27:Dp.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(n[32]|=128),e._vs=Yp(n.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,null!=e._vs){const n=function(t,e){(t=Rp(t)).length>e&&Dp.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(e);return n.set(t,e-t.length),_p(n)}(Rp(e._vs),32);e._vs=Yp(n);const r=n[0]>=128?1:0;null==e.recoveryParam?e.recoveryParam=r:e.recoveryParam!==r&&Dp.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;const i=Yp(n);null==e.s?e.s=i:e.s!==i&&Dp.throwArgumentError("signature v mismatch _vs","signature",t)}if(null==e.recoveryParam)null==e.v?Dp.throwArgumentError("signature missing v and recoveryParam","signature",t):0===e.v||1===e.v?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(null==e.v)e.v=27+e.recoveryParam;else{const n=0===e.v||1===e.v?e.v:1-e.v%2;e.recoveryParam!==n&&Dp.throwArgumentError("signature recoveryParam mismatch v","signature",t)}null!=e.r&&Qp(e.r)?e.r=Zp(e.r,32):Dp.throwArgumentError("signature missing or invalid r","signature",t),null!=e.s&&Qp(e.s)?e.s=Zp(e.s,32):Dp.throwArgumentError("signature missing or invalid s","signature",t);const n=Rp(e.s);n[0]>=128&&Dp.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(n[0]|=128);const r=Yp(n);e._vs&&(Qp(e._vs)||Dp.throwArgumentError("signature invalid _vs","signature",t),e._vs=Zp(e._vs,32)),null==e._vs?e._vs=r:e._vs!==r&&Dp.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Xp="bignumber/5.7.0";var Kp=kp.BN;const $p=new jp(Xp),tm={},em=9007199254740991;let nm=!1;class rm{constructor(t,e){t!==tm&&$p.throwError("cannot call constructor directly; use BigNumber.from",jp.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=e,this._isBigNumber=!0,Object.freeze(this)}fromTwos(t){return om(am(this).fromTwos(t))}toTwos(t){return om(am(this).toTwos(t))}abs(){return"-"===this._hex[0]?rm.from(this._hex.substring(1)):this}add(t){return om(am(this).add(am(t)))}sub(t){return om(am(this).sub(am(t)))}div(t){return rm.from(t).isZero()&&sm("division-by-zero","div"),om(am(this).div(am(t)))}mul(t){return om(am(this).mul(am(t)))}mod(t){const e=am(t);return e.isNeg()&&sm("division-by-zero","mod"),om(am(this).umod(e))}pow(t){const e=am(t);return e.isNeg()&&sm("negative-power","pow"),om(am(this).pow(e))}and(t){const e=am(t);return(this.isNegative()||e.isNeg())&&sm("unbound-bitwise-result","and"),om(am(this).and(e))}or(t){const e=am(t);return(this.isNegative()||e.isNeg())&&sm("unbound-bitwise-result","or"),om(am(this).or(e))}xor(t){const e=am(t);return(this.isNegative()||e.isNeg())&&sm("unbound-bitwise-result","xor"),om(am(this).xor(e))}mask(t){return(this.isNegative()||t<0)&&sm("negative-width","mask"),om(am(this).maskn(t))}shl(t){return(this.isNegative()||t<0)&&sm("negative-width","shl"),om(am(this).shln(t))}shr(t){return(this.isNegative()||t<0)&&sm("negative-width","shr"),om(am(this).shrn(t))}eq(t){return am(this).eq(am(t))}lt(t){return am(this).lt(am(t))}lte(t){return am(this).lte(am(t))}gt(t){return am(this).gt(am(t))}gte(t){return am(this).gte(am(t))}isNegative(){return"-"===this._hex[0]}isZero(){return am(this).isZero()}toNumber(){try{return am(this).toNumber()}catch(t){sm("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(t){}return $p.throwError("this platform does not support BigInt",jp.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?nm||(nm=!0,$p.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?$p.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",jp.errors.UNEXPECTED_ARGUMENT,{}):$p.throwError("BigNumber.toString does not accept parameters",jp.errors.UNEXPECTED_ARGUMENT,{})),am(this).toString(10)}toHexString(){return this._hex}toJSON(t){return{type:"BigNumber",hex:this.toHexString()}}static from(t){if(t instanceof rm)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new rm(tm,im(t)):t.match(/^-?[0-9]+$/)?new rm(tm,im(new Kp(t))):$p.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&sm("underflow","BigNumber.from",t),(t>=em||t<=-em)&&sm("overflow","BigNumber.from",t),rm.from(String(t));const e=t;if("bigint"==typeof e)return rm.from(e.toString());if(Bp(e))return rm.from(Yp(e));if(e)if(e.toHexString){const t=e.toHexString();if("string"==typeof t)return rm.from(t)}else{let t=e._hex;if(null==t&&"BigNumber"===e.type&&(t=e.hex),"string"==typeof t&&(Qp(t)||"-"===t[0]&&Qp(t.substring(1))))return rm.from(t)}return $p.throwArgumentError("invalid BigNumber value","value",t)}static isBigNumber(t){return!(!t||!t._isBigNumber)}}function im(t){if("string"!=typeof t)return im(t.toString(16));if("-"===t[0])return"-"===(t=t.substring(1))[0]&&$p.throwArgumentError("invalid hex","value",t),"0x00"===(t=im(t))?t:"-"+t;if("0x"!==t.substring(0,2)&&(t="0x"+t),"0x"===t)return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&"0x00"===t.substring(0,4);)t="0x"+t.substring(4);return t}function om(t){return rm.from(im(t))}function am(t){const e=rm.from(t).toHexString();return"-"===e[0]?new Kp("-"+e.substring(3),16):new Kp(e.substring(2),16)}function sm(t,e,n){const r={fault:t,operation:e};return null!=n&&(r.value=n),$p.throwError(t,jp.errors.NUMERIC_FAULT,r)}const um=new jp(Xp),cm={},lm=rm.from(0),hm=rm.from(-1);function dm(t,e,n,r){const i={fault:e,operation:n};return void 0!==r&&(i.value=r),um.throwError(t,jp.errors.NUMERIC_FAULT,i)}let fm="0";for(;fm.length<256;)fm+=fm;function pm(t){if("number"!=typeof t)try{t=rm.from(t).toNumber()}catch(t){}return"number"==typeof t&&t>=0&&t<=256&&!(t%1)?"1"+fm.substring(0,t):um.throwArgumentError("invalid decimal size","decimals",t)}function mm(t,e){null==e&&(e=0);const n=pm(e),r=(t=rm.from(t)).lt(lm);r&&(t=t.mul(hm));let i=t.mod(n).toString();for(;i.length<n.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=t.div(n).toString();return t=1===n.length?o:o+"."+i,r&&(t="-"+t),t}function gm(t,e){null==e&&(e=0);const n=pm(e);"string"==typeof t&&t.match(/^-?[0-9.]+$/)||um.throwArgumentError("invalid decimal value","value",t);const r="-"===t.substring(0,1);r&&(t=t.substring(1)),"."===t&&um.throwArgumentError("missing value","value",t);const i=t.split(".");i.length>2&&um.throwArgumentError("too many decimal points","value",t);let o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&dm("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length<n.length-1;)a+="0";const s=rm.from(o),u=rm.from(a);let c=s.mul(n).add(u);return r&&(c=c.mul(hm)),c}class ym{constructor(t,e,n,r){t!==cm&&um.throwError("cannot use FixedFormat constructor; use FixedFormat.from",jp.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=e,this.width=n,this.decimals=r,this.name=(e?"":"u")+"fixed"+String(n)+"x"+String(r),this._multiplier=pm(r),Object.freeze(this)}static from(t){if(t instanceof ym)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,n=128,r=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const i=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||um.throwArgumentError("invalid fixed format","format",t),e="u"!==i[1],n=parseInt(i[2]),r=parseInt(i[3])}else if(t){const i=(e,n,r)=>null==t[e]?r:(typeof t[e]!==n&&um.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&um.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&um.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new ym(cm,e,n,r)}}class vm{constructor(t,e,n,r){t!==cm&&um.throwError("cannot use FixedNumber constructor; use FixedNumber.from",jp.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=e,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&um.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=gm(this._value,this.format.decimals),n=gm(t._value,t.format.decimals);return vm.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=gm(this._value,this.format.decimals),n=gm(t._value,t.format.decimals);return vm.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=gm(this._value,this.format.decimals),n=gm(t._value,t.format.decimals);return vm.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=gm(this._value,this.format.decimals),n=gm(t._value,t.format.decimals);return vm.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=vm.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(wm.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=vm.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(wm.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&um.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=vm.from("1"+fm.substring(0,t),this.format),r=bm.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(t){if(null==t)return this._hex;t%8&&um.throwArgumentError("invalid byte width","width",t);return Zp(rm.from(this._hex).fromTwos(this.format.width).toTwos(t).toHexString(),t/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return vm.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||function(t){return null!=t&&(rm.isBigNumber(t)||"number"==typeof t&&t%1==0||"string"==typeof t&&!!t.match(/^-?[0-9]+$/)||Qp(t)||"bigint"==typeof t||Bp(t))}(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),vm.fromString(mm(t,e),ym.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=ym.from(e),r=gm(t,n.decimals);!n.signed&&r.lt(lm)&&dm("unsigned value cannot be negative","overflow","value",t);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=Zp(i,n.width/8));const o=mm(r,n.decimals);return new vm(cm,i,o,n)}static fromBytes(t,e){null==e&&(e="fixed");const n=ym.from(e);if(Rp(t).length>n.width/8)throw new Error("overflow");let r=rm.from(t);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),o=mm(r,n.decimals);return new vm(cm,i,o,n)}static from(t,e){if("string"==typeof t)return vm.fromString(t,e);if(Bp(t))return vm.fromBytes(t,e);try{return vm.fromValue(t,0,e)}catch(t){if(t.code!==jp.errors.INVALID_ARGUMENT)throw t}return um.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const wm=vm.from(1),bm=vm.from("0.5");var Mm=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const km=new jp("properties/5.7.0");function Am(t,e,n){Object.defineProperty(t,e,{enumerable:!0,value:n,writable:!1})}function Lm(t,e){for(let n=0;n<32;n++){if(t[e])return t[e];if(!t.prototype||"object"!=typeof t.prototype)break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function Em(t){return Mm(this,void 0,void 0,(function*(){const e=Object.keys(t).map((e=>{const n=t[e];return Promise.resolve(n).then((t=>({key:e,value:t})))}));return(yield Promise.all(e)).reduce(((t,e)=>(t[e.key]=e.value,t)),{})}))}function xm(t){const e={};for(const n in t)e[n]=t[n];return e}const Nm={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Sm(t){if(null==t||Nm[typeof t])return!0;if(Array.isArray(t)||"object"==typeof t){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let n=0;n<e.length;n++){let r=null;try{r=t[e[n]]}catch(t){continue}if(!Sm(r))return!1}return!0}return km.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Im(t){if(Sm(t))return t;if(Array.isArray(t))return Object.freeze(t.map((t=>Tm(t))));if("object"==typeof t){const e={};for(const n in t){const r=t[n];void 0!==r&&Am(e,n,Tm(r))}return e}return km.throwArgumentError("Cannot deepCopy "+typeof t,"object",t)}function Tm(t){return Im(t)}class Cm{constructor(t){for(const e in t)this[e]=Tm(t[e])}}const jm="abi/5.7.0",Dm=new jp(jm),Om={};let _m={calldata:!0,memory:!0,storage:!0},zm={calldata:!0,memory:!0};function Pm(t,e){if("bytes"===t||"string"===t){if(_m[e])return!0}else if("address"===t){if("payable"===e)return!0}else if((t.indexOf("[")>=0||"tuple"===t)&&zm[e])return!0;return(_m[e]||"payable"===e)&&Dm.throwArgumentError("invalid modifier","name",e),!1}function Bm(t,e){for(let n in e)Am(t,n,e[n])}const Rm=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Um=new RegExp(/^(.*)\[([0-9]*)\]$/);class Wm{constructor(t,e){t!==Om&&Dm.throwError("use fromString",jp.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Bm(this,e);let n=this.type.match(Um);Bm(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:Wm.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(t){if(t||(t=Rm.sighash),Rm[t]||Dm.throwArgumentError("invalid format type","format",t),t===Rm.json){let e={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(e.indexed=this.indexed),this.components&&(e.components=this.components.map((e=>JSON.parse(e.format(t))))),JSON.stringify(e)}let e="";return"array"===this.baseType?(e+=this.arrayChildren.format(t),e+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(t!==Rm.sighash&&(e+=this.type),e+="("+this.components.map((e=>e.format(t))).join(t===Rm.full?", ":",")+")"):e+=this.type,t!==Rm.sighash&&(!0===this.indexed&&(e+=" indexed"),t===Rm.full&&this.name&&(e+=" "+this.name)),e}static from(t,e){return"string"==typeof t?Wm.fromString(t,e):Wm.fromObject(t)}static fromObject(t){return Wm.isParamType(t)?t:new Wm(Om,{name:t.name||null,type:Km(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(Wm.fromObject):null})}static fromString(t,e){return n=function(t,e){let n=t;function r(e){Dm.throwArgumentError(`unexpected character at position ${e}`,"param",t)}function i(t){let n={type:"",name:"",parent:t,state:{allowType:!0}};return e&&(n.indexed=!1),n}t=t.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let n=0;n<t.length;n++){let o=t[n];switch(o){case"(":a.state.allowType&&""===a.type?a.type="tuple":a.state.allowParams||r(n),a.state.allowType=!1,a.type=Km(a.type),a.components=[i(a)],a=a.components[0];break;case")":delete a.state,"indexed"===a.name&&(e||r(n),a.indexed=!0,a.name=""),Pm(a.type,a.name)&&(a.name=""),a.type=Km(a.type);let t=a;a=a.parent,a||r(n),delete t.parent,a.state.allowParams=!1,a.state.allowName=!0,a.state.allowArray=!0;break;case",":delete a.state,"indexed"===a.name&&(e||r(n),a.indexed=!0,a.name=""),Pm(a.type,a.name)&&(a.name=""),a.type=Km(a.type);let s=i(a.parent);a.parent.components.push(s),delete a.parent,a=s;break;case" ":a.state.allowType&&""!==a.type&&(a.type=Km(a.type),delete a.state.allowType,a.state.allowName=!0,a.state.allowParams=!0),a.state.allowName&&""!==a.name&&("indexed"===a.name?(e||r(n),a.indexed&&r(n),a.indexed=!0,a.name=""):Pm(a.type,a.name)?a.name="":a.state.allowName=!1);break;case"[":a.state.allowArray||r(n),a.type+=o,a.state.allowArray=!1,a.state.allowName=!1,a.state.readArray=!0;break;case"]":a.state.readArray||r(n),a.type+=o,a.state.readArray=!1,a.state.allowArray=!0,a.state.allowName=!0;break;default:a.state.allowType?(a.type+=o,a.state.allowParams=!0,a.state.allowArray=!0):a.state.allowName?(a.name+=o,delete a.state.allowArray):a.state.readArray?a.type+=o:r(n)}}return a.parent&&Dm.throwArgumentError("unexpected eof","param",t),delete o.state,"indexed"===a.name?(e||r(n.length-7),a.indexed&&r(n.length-7),a.indexed=!0,a.name=""):Pm(a.type,a.name)&&(a.name=""),o.type=Km(o.type),o}(t,!!e),Wm.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(t){return!(null==t||!t._isParamType)}}function Qm(t,e){return function(t){t=t.trim();let e=[],n="",r=0;for(let i=0;i<t.length;i++){let o=t[i];","===o&&0===r?(e.push(n),n=""):(n+=o,"("===o?r++:")"===o&&(r--,-1===r&&Dm.throwArgumentError("unbalanced parenthesis","value",t)))}n&&e.push(n);return e}(t).map((t=>Wm.fromString(t,e)))}class Fm{constructor(t,e){t!==Om&&Dm.throwError("use a static from method",jp.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Bm(this,e),this._isFragment=!0,Object.freeze(this)}static from(t){return Fm.isFragment(t)?t:"string"==typeof t?Fm.fromString(t):Fm.fromObject(t)}static fromObject(t){if(Fm.isFragment(t))return t;switch(t.type){case"function":return Zm.fromObject(t);case"event":return Ym.fromObject(t);case"constructor":return Gm.fromObject(t);case"error":return Xm.fromObject(t);case"fallback":case"receive":return null}return Dm.throwArgumentError("invalid fragment object","value",t)}static fromString(t){return"event"===(t=(t=(t=t.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Ym.fromString(t.substring(5).trim()):"function"===t.split(" ")[0]?Zm.fromString(t.substring(8).trim()):"constructor"===t.split("(")[0].trim()?Gm.fromString(t.trim()):"error"===t.split(" ")[0]?Xm.fromString(t.substring(5).trim()):Dm.throwArgumentError("unsupported fragment","value",t)}static isFragment(t){return!(!t||!t._isFragment)}}class Ym extends Fm{format(t){if(t||(t=Rm.sighash),Rm[t]||Dm.throwArgumentError("invalid format type","format",t),t===Rm.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Rm.sighash&&(e+="event "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Rm.full?", ":",")+") ",t!==Rm.sighash&&this.anonymous&&(e+="anonymous "),e.trim()}static from(t){return"string"==typeof t?Ym.fromString(t):Ym.fromObject(t)}static fromObject(t){if(Ym.isEventFragment(t))return t;"event"!==t.type&&Dm.throwArgumentError("invalid event object","value",t);const e={name:tg(t.name),anonymous:t.anonymous,inputs:t.inputs?t.inputs.map(Wm.fromObject):[],type:"event"};return new Ym(Om,e)}static fromString(t){let e=t.match(eg);e||Dm.throwArgumentError("invalid event string","value",t);let n=!1;return e[3].split(" ").forEach((t=>{switch(t.trim()){case"anonymous":n=!0;break;case"":break;default:Dm.warn("unknown modifier: "+t)}})),Ym.fromObject({name:e[1].trim(),anonymous:n,inputs:Qm(e[2],!0),type:"event"})}static isEventFragment(t){return t&&t._isFragment&&"event"===t.type}}function Hm(t,e){e.gas=null;let n=t.split("@");return 1!==n.length?(n.length>2&&Dm.throwArgumentError("invalid human-readable ABI signature","value",t),n[1].match(/^[0-9]+$/)||Dm.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=rm.from(n[1]),n[0]):t}function Vm(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach((t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}}))}function qm(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return null!=t.stateMutability?(e.stateMutability=t.stateMutability,e.constant="view"===e.stateMutability||"pure"===e.stateMutability,null!=t.constant&&!!t.constant!==e.constant&&Dm.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable="payable"===e.stateMutability,null!=t.payable&&!!t.payable!==e.payable&&Dm.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):null!=t.payable?(e.payable=!!t.payable,null!=t.constant||e.payable||"constructor"===t.type||Dm.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Dm.throwArgumentError("cannot have constant payable function","value",t)):null!=t.constant?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):"constructor"!==t.type&&Dm.throwArgumentError("unable to determine stateMutability","value",t),e}class Gm extends Fm{format(t){if(t||(t=Rm.sighash),Rm[t]||Dm.throwArgumentError("invalid format type","format",t),t===Rm.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});t===Rm.sighash&&Dm.throwError("cannot format a constructor for sighash",jp.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let e="constructor("+this.inputs.map((e=>e.format(t))).join(t===Rm.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "),e.trim()}static from(t){return"string"==typeof t?Gm.fromString(t):Gm.fromObject(t)}static fromObject(t){if(Gm.isConstructorFragment(t))return t;"constructor"!==t.type&&Dm.throwArgumentError("invalid constructor object","value",t);let e=qm(t);e.constant&&Dm.throwArgumentError("constructor cannot be constant","value",t);const n={name:null,type:t.type,inputs:t.inputs?t.inputs.map(Wm.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?rm.from(t.gas):null};return new Gm(Om,n)}static fromString(t){let e={type:"constructor"},n=(t=Hm(t,e)).match(eg);return n&&"constructor"===n[1].trim()||Dm.throwArgumentError("invalid constructor string","value",t),e.inputs=Qm(n[2].trim(),!1),Vm(n[3].trim(),e),Gm.fromObject(e)}static isConstructorFragment(t){return t&&t._isFragment&&"constructor"===t.type}}class Zm extends Gm{format(t){if(t||(t=Rm.sighash),Rm[t]||Dm.throwArgumentError("invalid format type","format",t),t===Rm.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((e=>JSON.parse(e.format(t)))),outputs:this.outputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Rm.sighash&&(e+="function "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Rm.full?", ":",")+") ",t!==Rm.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(e+=this.stateMutability+" "):this.constant&&(e+="view "),this.outputs&&this.outputs.length&&(e+="returns ("+this.outputs.map((e=>e.format(t))).join(", ")+") "),null!=this.gas&&(e+="@"+this.gas.toString()+" ")),e.trim()}static from(t){return"string"==typeof t?Zm.fromString(t):Zm.fromObject(t)}static fromObject(t){if(Zm.isFunctionFragment(t))return t;"function"!==t.type&&Dm.throwArgumentError("invalid function object","value",t);let e=qm(t);const n={type:t.type,name:tg(t.name),constant:e.constant,inputs:t.inputs?t.inputs.map(Wm.fromObject):[],outputs:t.outputs?t.outputs.map(Wm.fromObject):[],payable:e.payable,stateMutability:e.stateMutability,gas:t.gas?rm.from(t.gas):null};return new Zm(Om,n)}static fromString(t){let e={type:"function"},n=(t=Hm(t,e)).split(" returns ");n.length>2&&Dm.throwArgumentError("invalid function string","value",t);let r=n[0].match(eg);if(r||Dm.throwArgumentError("invalid function signature","value",t),e.name=r[1].trim(),e.name&&tg(e.name),e.inputs=Qm(r[2],!1),Vm(r[3].trim(),e),n.length>1){let r=n[1].match(eg);""==r[1].trim()&&""==r[3].trim()||Dm.throwArgumentError("unexpected tokens","value",t),e.outputs=Qm(r[2],!1)}else e.outputs=[];return Zm.fromObject(e)}static isFunctionFragment(t){return t&&t._isFragment&&"function"===t.type}}function Jm(t){const e=t.format();return"Error(string)"!==e&&"Panic(uint256)"!==e||Dm.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class Xm extends Fm{format(t){if(t||(t=Rm.sighash),Rm[t]||Dm.throwArgumentError("invalid format type","format",t),t===Rm.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((e=>JSON.parse(e.format(t))))});let e="";return t!==Rm.sighash&&(e+="error "),e+=this.name+"("+this.inputs.map((e=>e.format(t))).join(t===Rm.full?", ":",")+") ",e.trim()}static from(t){return"string"==typeof t?Xm.fromString(t):Xm.fromObject(t)}static fromObject(t){if(Xm.isErrorFragment(t))return t;"error"!==t.type&&Dm.throwArgumentError("invalid error object","value",t);const e={type:t.type,name:tg(t.name),inputs:t.inputs?t.inputs.map(Wm.fromObject):[]};return Jm(new Xm(Om,e))}static fromString(t){let e={type:"error"},n=t.match(eg);return n||Dm.throwArgumentError("invalid error signature","value",t),e.name=n[1].trim(),e.name&&tg(e.name),e.inputs=Qm(n[2],!1),Jm(Xm.fromObject(e))}static isErrorFragment(t){return t&&t._isFragment&&"error"===t.type}}function Km(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const $m=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tg(t){return t&&t.match($m)||Dm.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const eg=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const ng=new jp(jm);class rg{constructor(t,e,n,r){this.name=t,this.type=e,this.localName=n,this.dynamic=r}_throwError(t,e){ng.throwArgumentError(t,this.localName,e)}}class ig{constructor(t){Am(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}get data(){return qp(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(Up(t._data))}writeBytes(t){let e=Rp(t);const n=e.length%this.wordSize;return n&&(e=Up([e,this._padding.slice(n)])),this._writeData(e)}_getValue(t){let e=Rp(rm.from(t));return e.length>this.wordSize&&ng.throwError("value out-of-bounds",jp.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:e.length}),e.length%this.wordSize&&(e=Up([this._padding.slice(e.length%this.wordSize),e])),e}writeValue(t){return this._writeData(this._getValue(t))}writeUpdatableValue(){const t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,e=>{this._data[t]=this._getValue(e)}}}class og{constructor(t,e,n,r){Am(this,"_data",Rp(t)),Am(this,"wordSize",e||32),Am(this,"_coerceFunc",n),Am(this,"allowLoose",r),this._offset=0}get data(){return Yp(this._data)}get consumed(){return this._offset}static coerce(t,e){let n=t.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(e=e.toNumber()),e}coerce(t,e){return this._coerceFunc?this._coerceFunc(t,e):og.coerce(t,e)}_peekBytes(t,e,n){let r=Math.ceil(e/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+e<=this._data.length?r=e:ng.throwError("data out-of-bounds",jp.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(t){return new og(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(t,e){let n=this._peekBytes(0,t,!!e);return this._offset+=n.length,n.slice(0,t)}readValue(){return rm.from(this.readBytes(this.wordSize))}}var ag=o((function(t){!function(){var e="input is invalid type",n="object"==typeof window,i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==typeof self;!i.JS_SHA3_NO_NODE_JS&&"object"==typeof _&&_.versions&&_.versions.node?i=r:o&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&t.exports,s=!i.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,u="0123456789abcdef".split(""),c=[4,1024,262144,67108864],l=[0,8,16,24],h=[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],d=[224,256,384,512],f=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],m={128:168,256:136};!i.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!s||!i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});for(var g=function(t,e,n){return function(r){return new C(t,e,t).update(r)[n]()}},y=function(t,e,n){return function(r,i){return new C(t,e,i).update(r)[n]()}},v=function(t,e,n){return function(e,r,i,o){return A["cshake"+t].update(e,r,i,o)[n]()}},w=function(t,e,n){return function(e,r,i,o){return A["kmac"+t].update(e,r,i,o)[n]()}},b=function(t,e,n,r){for(var i=0;i<p.length;++i){var o=p[i];t[o]=e(n,r,o)}return t},M=function(t,e){var n=g(t,e,"hex");return n.create=function(){return new C(t,e,t)},n.update=function(t){return n.create().update(t)},b(n,g,t,e)},k=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:M},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:M},{name:"shake",padding:[31,7936,2031616,520093696],bits:f,createMethod:function(t,e){var n=y(t,e,"hex");return n.create=function(n){return new C(t,e,n)},n.update=function(t,e){return n.create(e).update(t)},b(n,y,t,e)}},{name:"cshake",padding:c,bits:f,createMethod:function(t,e){var n=m[t],r=v(t,0,"hex");return r.create=function(r,i,o){return i||o?new C(t,e,r).bytepad([i,o],n):A["shake"+t].create(r)},r.update=function(t,e,n,i){return r.create(e,n,i).update(t)},b(r,v,t,e)}},{name:"kmac",padding:c,bits:f,createMethod:function(t,e){var n=m[t],r=w(t,0,"hex");return r.create=function(r,i,o){return new j(t,e,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(t,e,n,i){return r.create(t,n,i).update(e)},b(r,w,t,e)}}],A={},L=[],E=0;E<k.length;++E)for(var x=k[E],N=x.bits,S=0;S<N.length;++S){var I=x.name+"_"+N[S];if(L.push(I),A[I]=x.createMethod(N[S],x.padding),"sha3"!==x.name){var T=x.name+N[S];L.push(T),A[T]=A[I]}}function C(t,e,n){this.blocks=[],this.s=[],this.padding=e,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(t<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function j(t,e,n){C.call(this,t,e,n)}C.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}for(var i,o,a=this.blocks,u=this.byteCount,c=t.length,h=this.blockCount,d=0,f=this.s;d<c;){if(this.reset)for(this.reset=!1,a[0]=this.block,i=1;i<h+1;++i)a[i]=0;if(n)for(i=this.start;d<c&&i<u;++d)a[i>>2]|=t[d]<<l[3&i++];else for(i=this.start;d<c&&i<u;++d)(o=t.charCodeAt(d))<128?a[i>>2]|=o<<l[3&i++]:o<2048?(a[i>>2]|=(192|o>>6)<<l[3&i++],a[i>>2]|=(128|63&o)<<l[3&i++]):o<55296||o>=57344?(a[i>>2]|=(224|o>>12)<<l[3&i++],a[i>>2]|=(128|o>>6&63)<<l[3&i++],a[i>>2]|=(128|63&o)<<l[3&i++]):(o=65536+((1023&o)<<10|1023&t.charCodeAt(++d)),a[i>>2]|=(240|o>>18)<<l[3&i++],a[i>>2]|=(128|o>>12&63)<<l[3&i++],a[i>>2]|=(128|o>>6&63)<<l[3&i++],a[i>>2]|=(128|63&o)<<l[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=a[h],i=0;i<h;++i)f[i]^=a[i];D(f),this.reset=!0}else this.start=i}return this},C.prototype.encode=function(t,e){var n=255&t,r=1,i=[n];for(n=255&(t>>=8);n>0;)i.unshift(n),n=255&(t>>=8),++r;return e?i.push(r):i.unshift(r),this.update(i),i.length},C.prototype.encodeString=function(t){var n,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(e);if(null===t)throw new Error(e);if(s&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||s&&ArrayBuffer.isView(t)))throw new Error(e);n=!0}var i=0,o=t.length;if(n)i=o;else for(var a=0;a<t.length;++a){var u=t.charCodeAt(a);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&t.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(t),i},C.prototype.bytepad=function(t,e){for(var n=this.encode(e),r=0;r<t.length;++r)n+=this.encodeString(t[r]);var i=e-n%e,o=[];return o.length=i,this.update(o),this},C.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex,n=this.blockCount,r=this.s;if(t[e>>2]|=this.padding[3&e],this.lastByteIndex===this.byteCount)for(t[0]=t[n],e=1;e<n+1;++e)t[e]=0;for(t[n-1]|=2147483648,e=0;e<n;++e)r[e]^=t[e];D(r)}},C.prototype.toString=C.prototype.hex=function(){this.finalize();for(var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s="";a<r;){for(o=0;o<e&&a<r;++o,++a)t=n[o],s+=u[t>>4&15]+u[15&t]+u[t>>12&15]+u[t>>8&15]+u[t>>20&15]+u[t>>16&15]+u[t>>28&15]+u[t>>24&15];a%e==0&&(D(n),o=0)}return i&&(t=n[o],s+=u[t>>4&15]+u[15&t],i>1&&(s+=u[t>>12&15]+u[t>>8&15]),i>2&&(s+=u[t>>20&15]+u[t>>16&15])),s},C.prototype.arrayBuffer=function(){this.finalize();var t,e=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;t=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(t);a<r;){for(o=0;o<e&&a<r;++o,++a)u[a]=n[o];a%e==0&&D(n)}return i&&(u[o]=n[o],t=t.slice(0,s)),t},C.prototype.buffer=C.prototype.arrayBuffer,C.prototype.digest=C.prototype.array=function(){this.finalize();for(var t,e,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<n&&s<i;++a,++s)t=s<<2,e=r[a],u[t]=255&e,u[t+1]=e>>8&255,u[t+2]=e>>16&255,u[t+3]=e>>24&255;s%n==0&&D(r)}return o&&(t=s<<2,e=r[a],u[t]=255&e,o>1&&(u[t+1]=e>>8&255),o>2&&(u[t+2]=e>>16&255)),u},j.prototype=new C,j.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var D=function(t){var e,n,r,i,o,a,s,u,c,l,d,f,p,m,g,y,v,w,b,M,k,A,L,E,x,N,S,I,T,C,j,D,O,_,z,P,B,R,U,W,Q,F,Y,H,V,q,G,Z,J,X,K,$,tt,et,nt,rt,it,ot,at,st,ut,ct,lt;for(r=0;r<48;r+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],a=t[2]^t[12]^t[22]^t[32]^t[42],s=t[3]^t[13]^t[23]^t[33]^t[43],u=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],l=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(f=t[8]^t[18]^t[28]^t[38]^t[48])^(a<<1|s>>>31),n=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(s<<1|a>>>31),t[0]^=e,t[1]^=n,t[10]^=e,t[11]^=n,t[20]^=e,t[21]^=n,t[30]^=e,t[31]^=n,t[40]^=e,t[41]^=n,e=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),t[2]^=e,t[3]^=n,t[12]^=e,t[13]^=n,t[22]^=e,t[23]^=n,t[32]^=e,t[33]^=n,t[42]^=e,t[43]^=n,e=a^(l<<1|d>>>31),n=s^(d<<1|l>>>31),t[4]^=e,t[5]^=n,t[14]^=e,t[15]^=n,t[24]^=e,t[25]^=n,t[34]^=e,t[35]^=n,t[44]^=e,t[45]^=n,e=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),t[6]^=e,t[7]^=n,t[16]^=e,t[17]^=n,t[26]^=e,t[27]^=n,t[36]^=e,t[37]^=n,t[46]^=e,t[47]^=n,e=l^(i<<1|o>>>31),n=d^(o<<1|i>>>31),t[8]^=e,t[9]^=n,t[18]^=e,t[19]^=n,t[28]^=e,t[29]^=n,t[38]^=e,t[39]^=n,t[48]^=e,t[49]^=n,m=t[0],g=t[1],q=t[11]<<4|t[10]>>>28,G=t[10]<<4|t[11]>>>28,I=t[20]<<3|t[21]>>>29,T=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,F=t[40]<<18|t[41]>>>14,Y=t[41]<<18|t[40]>>>14,_=t[2]<<1|t[3]>>>31,z=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,Z=t[22]<<10|t[23]>>>22,J=t[23]<<10|t[22]>>>22,C=t[33]<<13|t[32]>>>19,j=t[32]<<13|t[33]>>>19,ct=t[42]<<2|t[43]>>>30,lt=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,nt=t[4]<<30|t[5]>>>2,P=t[14]<<6|t[15]>>>26,B=t[15]<<6|t[14]>>>26,w=t[25]<<11|t[24]>>>21,b=t[24]<<11|t[25]>>>21,X=t[34]<<15|t[35]>>>17,K=t[35]<<15|t[34]>>>17,D=t[45]<<29|t[44]>>>3,O=t[44]<<29|t[45]>>>3,E=t[6]<<28|t[7]>>>4,x=t[7]<<28|t[6]>>>4,rt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,R=t[26]<<25|t[27]>>>7,U=t[27]<<25|t[26]>>>7,M=t[36]<<21|t[37]>>>11,k=t[37]<<21|t[36]>>>11,$=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,H=t[8]<<27|t[9]>>>5,V=t[9]<<27|t[8]>>>5,N=t[18]<<20|t[19]>>>12,S=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,W=t[38]<<8|t[39]>>>24,Q=t[39]<<8|t[38]>>>24,A=t[48]<<14|t[49]>>>18,L=t[49]<<14|t[48]>>>18,t[0]=m^~y&w,t[1]=g^~v&b,t[10]=E^~N&I,t[11]=x^~S&T,t[20]=_^~P&R,t[21]=z^~B&U,t[30]=H^~q&Z,t[31]=V^~G&J,t[40]=et^~rt&ot,t[41]=nt^~it&at,t[2]=y^~w&M,t[3]=v^~b&k,t[12]=N^~I&C,t[13]=S^~T&j,t[22]=P^~R&W,t[23]=B^~U&Q,t[32]=q^~Z&X,t[33]=G^~J&K,t[42]=rt^~ot&st,t[43]=it^~at&ut,t[4]=w^~M&A,t[5]=b^~k&L,t[14]=I^~C&D,t[15]=T^~j&O,t[24]=R^~W&F,t[25]=U^~Q&Y,t[34]=Z^~X&$,t[35]=J^~K&tt,t[44]=ot^~st&ct,t[45]=at^~ut&lt,t[6]=M^~A&m,t[7]=k^~L&g,t[16]=C^~D&E,t[17]=j^~O&x,t[26]=W^~F&_,t[27]=Q^~Y&z,t[36]=X^~$&H,t[37]=K^~tt&V,t[46]=st^~ct&et,t[47]=ut^~lt&nt,t[8]=A^~m&y,t[9]=L^~g&v,t[18]=D^~E&N,t[19]=O^~x&S,t[28]=F^~_&P,t[29]=Y^~z&B,t[38]=$^~H&q,t[39]=tt^~V&G,t[48]=ct^~et&rt,t[49]=lt^~nt&it,t[0]^=h[r],t[1]^=h[r+1]};if(a)t.exports=A;else for(E=0;E<L.length;++E)i[L[E]]=A[L[E]]}()})),sg=ag;function ug(t){return"0x"+sg.keccak_256(Rp(t))}const cg=new jp("rlp/5.7.0");function lg(t){const e=[];for(;t;)e.unshift(255&t),t>>=8;return e}function hg(t,e,n){let r=0;for(let i=0;i<n;i++)r=256*r+t[e+i];return r}function dg(t){if(Array.isArray(t)){let e=[];if(t.forEach((function(t){e=e.concat(dg(t))})),e.length<=55)return e.unshift(192+e.length),e;const n=lg(e.length);return n.unshift(247+n.length),n.concat(e)}zp(t)||cg.throwArgumentError("RLP object must be BytesLike","object",t);const e=Array.prototype.slice.call(Rp(t));if(1===e.length&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const n=lg(e.length);return n.unshift(183+n.length),n.concat(e)}function fg(t){return Yp(dg(t))}function pg(t,e,n,r){const i=[];for(;n<e+1+r;){const o=mg(t,n);i.push(o.result),(n+=o.consumed)>e+1+r&&cg.throwError("child data too short",jp.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function mg(t,e){if(0===t.length&&cg.throwError("data too short",jp.errors.BUFFER_OVERRUN,{}),t[e]>=248){const n=t[e]-247;e+1+n>t.length&&cg.throwError("data short segment too short",jp.errors.BUFFER_OVERRUN,{});const r=hg(t,e+1,n);return e+1+n+r>t.length&&cg.throwError("data long segment too short",jp.errors.BUFFER_OVERRUN,{}),pg(t,e,e+1+n,n+r)}if(t[e]>=192){const n=t[e]-192;return e+1+n>t.length&&cg.throwError("data array too short",jp.errors.BUFFER_OVERRUN,{}),pg(t,e,e+1,n)}if(t[e]>=184){const n=t[e]-183;e+1+n>t.length&&cg.throwError("data array too short",jp.errors.BUFFER_OVERRUN,{});const r=hg(t,e+1,n);e+1+n+r>t.length&&cg.throwError("data array too short",jp.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:Yp(t.slice(e+1+n,e+1+n+r))}}if(t[e]>=128){const n=t[e]-128;e+1+n>t.length&&cg.throwError("data too short",jp.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:Yp(t.slice(e+1,e+1+n))}}return{consumed:1,result:Yp(t[e])}}function gg(t){const e=Rp(t),n=mg(e,0);return n.consumed!==e.length&&cg.throwArgumentError("invalid rlp data","data",t),n.result}const yg=new jp("address/5.7.0");function vg(t){Qp(t,20)||yg.throwArgumentError("invalid address","address",t);const e=(t=t.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let t=0;t<40;t++)n[t]=e[t].charCodeAt(0);const r=Rp(ug(n));for(let t=0;t<40;t+=2)r[t>>1]>>4>=8&&(e[t]=e[t].toUpperCase()),(15&r[t>>1])>=8&&(e[t+1]=e[t+1].toUpperCase());return"0x"+e.join("")}const wg={};for(let t=0;t<10;t++)wg[String(t)]=String(t);for(let t=0;t<26;t++)wg[String.fromCharCode(65+t)]=String(10+t);const bg=Math.floor(function(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}(9007199254740991));function Mg(t){let e=null;if("string"!=typeof t&&yg.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==t.substring(0,2)&&(t="0x"+t),e=vg(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&yg.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==function(t){let e=(t=(t=t.toUpperCase()).substring(4)+t.substring(0,2)+"00").split("").map((t=>wg[t])).join("");for(;e.length>=bg;){let t=e.substring(0,bg);e=parseInt(t,10)%97+e.substring(t.length)}let n=String(98-parseInt(e,10)%97);for(;n.length<2;)n="0"+n;return n}(t)&&yg.throwArgumentError("bad icap checksum","address",t),n=t.substring(4),e=new Kp(n,36).toString(16);e.length<40;)e="0"+e;e=vg("0x"+e)}else yg.throwArgumentError("invalid address","address",t);var n;return e}function kg(t){let e=null;try{e=Mg(t.from)}catch(e){yg.throwArgumentError("missing from address","transaction",t)}return Mg(Vp(ug(fg([e,Wp(Rp(rm.from(t.nonce).toHexString()))])),12))}class Ag extends rg{constructor(t){super("address","address",t,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(t,e){try{e=Mg(e)}catch(t){this._throwError(t.message,e)}return t.writeValue(e)}decode(t){return Mg(Zp(t.readValue().toHexString(),20))}}class Lg extends rg{constructor(t){super(t.name,t.type,void 0,t.dynamic),this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,e){return this.coder.encode(t,e)}decode(t){return this.coder.decode(t)}}const Eg=new jp(jm);function xg(t,e,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let t={};r=e.map((e=>{const r=e.localName;return r||Eg.throwError("cannot encode object for signature with missing names",jp.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[r]&&Eg.throwError("cannot encode object for signature with duplicate names",jp.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:n}),t[r]=!0,n[r]}))}else Eg.throwArgumentError("invalid tuple value","tuple",n);e.length!==r.length&&Eg.throwArgumentError("types/value length mismatch","tuple",n);let i=new ig(t.wordSize),o=new ig(t.wordSize),a=[];e.forEach(((t,e)=>{let n=r[e];if(t.dynamic){let e=o.length;t.encode(o,n);let r=i.writeUpdatableValue();a.push((t=>{r(t+e)}))}else t.encode(i,n)})),a.forEach((t=>{t(i.length)}));let s=t.appendWriter(i);return s+=t.appendWriter(o),s}function Ng(t,e){let n=[],r=t.subReader(0);e.forEach((e=>{let i=null;if(e.dynamic){let n=t.readValue(),o=r.subReader(n.toNumber());try{i=e.decode(o)}catch(t){if(t.code===jp.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}}else try{i=e.decode(t)}catch(t){if(t.code===jp.errors.BUFFER_OVERRUN)throw t;i=t,i.baseType=e.name,i.name=e.localName,i.type=e.type}null!=i&&n.push(i)}));const i=e.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});e.forEach(((t,e)=>{let r=t.localName;if(!r||1!==i[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const o=n[e];o instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw o}}):n[r]=o}));for(let t=0;t<n.length;t++){const e=n[t];e instanceof Error&&Object.defineProperty(n,t,{enumerable:!0,get:()=>{throw e}})}return Object.freeze(n)}class Sg extends rg{constructor(t,e,n){super("array",t.type+"["+(e>=0?e:"")+"]",n,-1===e||t.dynamic),this.coder=t,this.length=e}defaultValue(){const t=this.coder.defaultValue(),e=[];for(let n=0;n<this.length;n++)e.push(t);return e}encode(t,e){Array.isArray(e)||this._throwError("expected array value",e);let n=this.length;-1===n&&(n=e.length,t.writeValue(e.length)),Eg.checkArgumentCount(e.length,n,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let t=0;t<e.length;t++)r.push(this.coder);return xg(t,r,e)}decode(t){let e=this.length;-1===e&&(e=t.readValue().toNumber(),32*e>t._data.length&&Eg.throwError("insufficient data length",jp.errors.BUFFER_OVERRUN,{length:t._data.length,count:e}));let n=[];for(let t=0;t<e;t++)n.push(new Lg(this.coder));return t.coerce(this.name,Ng(t,n))}}class Ig extends rg{constructor(t){super("bool","bool",t,!1)}defaultValue(){return!1}encode(t,e){return t.writeValue(e?1:0)}decode(t){return t.coerce(this.type,!t.readValue().isZero())}}class Tg extends rg{constructor(t,e){super(t,t,e,!0)}defaultValue(){return"0x"}encode(t,e){e=Rp(e);let n=t.writeValue(e.length);return n+=t.writeBytes(e),n}decode(t){return t.readBytes(t.readValue().toNumber(),!0)}}class Cg extends Tg{constructor(t){super("bytes",t)}decode(t){return t.coerce(this.name,Yp(super.decode(t)))}}class jg extends rg{constructor(t,e){let n="bytes"+String(t);super(n,n,e,!1),this.size=t}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(t,e){let n=Rp(e);return n.length!==this.size&&this._throwError("incorrect data length",e),t.writeBytes(n)}decode(t){return t.coerce(this.name,Yp(t.readBytes(this.size)))}}class Dg extends rg{constructor(t){super("null","",t,!1)}defaultValue(){return null}encode(t,e){return null!=e&&this._throwError("not null",e),t.writeBytes([])}decode(t){return t.readBytes(0),t.coerce(this.name,null)}}const Og=rm.from(-1),_g=rm.from(0),zg=rm.from(1),Pg=rm.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class Bg extends rg{constructor(t,e,n){const r=(e?"int":"uint")+8*t;super(r,r,n,!1),this.size=t,this.signed=e}defaultValue(){return 0}encode(t,e){let n=rm.from(e),r=Pg.mask(8*t.wordSize);if(this.signed){let t=r.mask(8*this.size-1);(n.gt(t)||n.lt(t.add(zg).mul(Og)))&&this._throwError("value out-of-bounds",e)}else(n.lt(_g)||n.gt(r.mask(8*this.size)))&&this._throwError("value out-of-bounds",e);return n=n.toTwos(8*this.size).mask(8*this.size),this.signed&&(n=n.fromTwos(8*this.size).toTwos(8*t.wordSize)),t.writeValue(n)}decode(t){let e=t.readValue().mask(8*this.size);return this.signed&&(e=e.fromTwos(8*this.size)),t.coerce(this.name,e)}}const Rg=new jp("strings/5.7.0");var Ug,Wg;function Qg(t,e,n,r,i){if(t===Wg.BAD_PREFIX||t===Wg.UNEXPECTED_CONTINUE){let t=0;for(let r=e+1;r<n.length&&n[r]>>6==2;r++)t++;return t}return t===Wg.OVERRUN?n.length-e-1:0}!function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"}(Ug||(Ug={})),function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"}(Wg||(Wg={}));const Fg=Object.freeze({error:function(t,e,n,r,i){return Rg.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",n)},ignore:Qg,replace:function(t,e,n,r,i){return t===Wg.OVERLONG?(r.push(i),0):(r.push(65533),Qg(t,e,n))}});function Yg(t,e){null==e&&(e=Fg.error),t=Rp(t);const n=[];let r=0;for(;r<t.length;){const i=t[r++];if(i>>7==0){n.push(i);continue}let o=null,a=null;if(192==(224&i))o=1,a=127;else if(224==(240&i))o=2,a=2047;else{if(240!=(248&i)){r+=e(128==(192&i)?Wg.UNEXPECTED_CONTINUE:Wg.BAD_PREFIX,r-1,t,n);continue}o=3,a=65535}if(r-1+o>=t.length){r+=e(Wg.OVERRUN,r-1,t,n);continue}let s=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=t[r];if(128!=(192&i)){r+=e(Wg.MISSING_CONTINUE,r,t,n),s=null;break}s=s<<6|63&i,r++}null!==s&&(s>1114111?r+=e(Wg.OUT_OF_RANGE,r-1-o,t,n,s):s>=55296&&s<=57343?r+=e(Wg.UTF16_SURROGATE,r-1-o,t,n,s):s<=a?r+=e(Wg.OVERLONG,r-1-o,t,n,s):n.push(s))}return n}function Hg(t,e=Ug.current){e!=Ug.current&&(Rg.checkNormalize(),t=t.normalize(e));let n=[];for(let e=0;e<t.length;e++){const r=t.charCodeAt(e);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){e++;const i=t.charCodeAt(e);if(e>=t.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&r)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return Rp(n)}function Vg(t,e){return Yg(t,e).map((t=>t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10&1023),56320+(1023&t))))).join("")}class qg extends Tg{constructor(t){super("string",t)}defaultValue(){return""}encode(t,e){return super.encode(t,Hg(e))}decode(t){return Vg(super.decode(t))}}class Gg extends rg{constructor(t,e){let n=!1;const r=[];t.forEach((t=>{t.dynamic&&(n=!0),r.push(t.type)}));super("tuple","tuple("+r.join(",")+")",e,n),this.coders=t}defaultValue(){const t=[];this.coders.forEach((e=>{t.push(e.defaultValue())}));const e=this.coders.reduce(((t,e)=>{const n=e.localName;return n&&(t[n]||(t[n]=0),t[n]++),t}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===e[i]&&("length"===i&&(i="_length"),null==t[i]&&(t[i]=t[r]))})),Object.freeze(t)}encode(t,e){return xg(t,this.coders,e)}decode(t){return t.coerce(this.name,Ng(t,this.coders))}}const Zg=new jp(jm),Jg=new RegExp(/^bytes([0-9]*)$/),Xg=new RegExp(/^(u?int)([0-9]*)$/);const Kg=new class{constructor(t){Am(this,"coerceFunc",t||null)}_getCoder(t){switch(t.baseType){case"address":return new Ag(t.name);case"bool":return new Ig(t.name);case"string":return new qg(t.name);case"bytes":return new Cg(t.name);case"array":return new Sg(this._getCoder(t.arrayChildren),t.arrayLength,t.name);case"tuple":return new Gg((t.components||[]).map((t=>this._getCoder(t))),t.name);case"":return new Dg(t.name)}let e=t.type.match(Xg);if(e){let n=parseInt(e[2]||"256");return(0===n||n>256||n%8!=0)&&Zg.throwArgumentError("invalid "+e[1]+" bit length","param",t),new Bg(n/8,"int"===e[1],t.name)}if(e=t.type.match(Jg),e){let n=parseInt(e[1]);return(0===n||n>32)&&Zg.throwArgumentError("invalid bytes length","param",t),new jg(n,t.name)}return Zg.throwArgumentError("invalid type","type",t.type)}_getWordSize(){return 32}_getReader(t,e){return new og(t,this._getWordSize(),this.coerceFunc,e)}_getWriter(){return new ig(this._getWordSize())}getDefaultValue(t){const e=t.map((t=>this._getCoder(Wm.from(t))));return new Gg(e,"_").defaultValue()}encode(t,e){t.length!==e.length&&Zg.throwError("types/values length mismatch",jp.errors.INVALID_ARGUMENT,{count:{types:t.length,values:e.length},value:{types:t,values:e}});const n=t.map((t=>this._getCoder(Wm.from(t)))),r=new Gg(n,"_"),i=this._getWriter();return r.encode(i,e),i.data}decode(t,e,n){const r=t.map((t=>this._getCoder(Wm.from(t))));return new Gg(r,"_").decode(this._getReader(Rp(e),n))}};function $g(t){return ug(Hg(t))}const ty="hash/5.7.0";function ey(t){t=atob(t);const e=[];for(let n=0;n<t.length;n++)e.push(t.charCodeAt(n));return Rp(e)}function ny(t){t=Rp(t);let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function ry(t,e){null==e&&(e=1);const n=[],r=n.forEach,i=function(t,e){r.call(t,(function(t){e>0&&Array.isArray(t)?i(t,e-1):n.push(t)}))};return i(t,e),n}function iy(t){return function(t){let e=0;return()=>t[e++]}(function(t){let e=0;function n(){return t[e++]<<8|t[e++]}let r=n(),i=1,o=[0,1];for(let t=1;t<r;t++)o.push(i+=n());let a=n(),s=e;e+=a;let u=0,c=0;function l(){return 0==u&&(c=c<<8|t[e++],u=8),c>>--u&1}const h=Math.pow(2,31),d=h>>>1,f=d>>1,p=h-1;let m=0;for(let t=0;t<31;t++)m=m<<1|l();let g=[],y=0,v=h;for(;;){let t=Math.floor(((m-y+1)*i-1)/v),e=0,n=r;for(;n-e>1;){let r=e+n>>>1;t<o[r]?n=r:e=r}if(0==e)break;g.push(e);let a=y+Math.floor(v*o[e]/i),s=y+Math.floor(v*o[e+1]/i)-1;for(;0==((a^s)&d);)m=m<<1&p|l(),a=a<<1&p,s=s<<1&p|1;for(;a&~s&f;)m=m&d|m<<1&p>>>1|l(),a=a<<1^d,s=(s^d)<<1|d|1;y=a,v=1+s-a}let w=r-4;return g.map((e=>{switch(e-w){case 3:return w+65792+(t[s++]<<16|t[s++]<<8|t[s++]);case 2:return w+256+(t[s++]<<8|t[s++]);case 1:return w+t[s++];default:return e-1}}))}(t))}function oy(t){return 1&t?~t>>1:t>>1}function ay(t,e){let n=Array(t);for(let r=0,i=-1;r<t;r++)n[r]=i+=1+e();return n}function sy(t,e){let n=Array(t);for(let r=0,i=0;r<t;r++)n[r]=i+=oy(e());return n}function uy(t,e){let n=ay(t(),t),r=t(),i=ay(r,t),o=function(t,e){let n=Array(t);for(let r=0;r<t;r++)n[r]=1+e();return n}(r,t);for(let t=0;t<r;t++)for(let e=0;e<o[t];e++)n.push(i[t]+e);return e?n.map((t=>e[t])):n}function cy(t,e,n){let r=Array(t).fill(void 0).map((()=>[]));for(let i=0;i<e;i++)sy(t,n).forEach(((t,e)=>r[e].push(t)));return r}function ly(t,e){let n=1+e(),r=e(),i=function(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(n)}return e}(e);return ry(cy(i.length,1+t,e).map(((t,e)=>{const o=t[0],a=t.slice(1);return Array(i[e]).fill(void 0).map(((t,e)=>{let i=e*r;return[o+e*n,a.map((t=>t+i))]}))})))}function hy(t,e){return cy(1+e(),1+t,e).map((t=>[t[0],t.slice(1)]))}const dy=iy(ey("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==")),fy=new Set(uy(dy)),py=new Set(uy(dy)),my=function(t){let e=[];for(;;){let n=t();if(0==n)break;e.push(ly(n,t))}for(;;){let n=t()-1;if(n<0)break;e.push(hy(n,t))}return function(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];e[r[0]]=r[1]}return e}(ry(e))}(dy),gy=function(t){let e=uy(t).sort(((t,e)=>t-e));return function n(){let r=[];for(;;){let i=uy(t,e);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((t,e)=>e.set.size-t.set.size));let i=t(),o=i%3;i=i/3|0;let a=!!(1&i);return i>>=1,{branches:r,valid:o,fe0f:a,save:1==i,check:2==i}}()}(dy),yy=45,vy=95;function wy(t){return function(t,e=Ug.current){return Yg(Hg(t,e))}(t)}function by(t){return t.filter((t=>65039!=t))}function My(t){for(let e of t.split(".")){let t=wy(e);try{for(let e=t.lastIndexOf(vy)-1;e>=0;e--)if(t[e]!==vy)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every((t=>t<128))&&t[2]===yy&&t[3]===yy)throw new Error("invalid label extension")}catch(t){throw new Error(`Invalid label "${e}": ${t.message}`)}}return t}function ky(t){return My(function(t,e){let n=wy(t).reverse(),r=[];for(;n.length;){let t=Ay(n);if(t){r.push(...e(t));continue}let i=n.pop();if(fy.has(i)){r.push(i);continue}if(py.has(i))continue;let o=my[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...o)}return My(function(t){return t.normalize("NFC")}(String.fromCodePoint(...r)))}(t,by))}function Ay(t,e){var n;let r,i,o=gy,a=[],s=t.length;for(e&&(e.length=0);s;){let u=t[--s];if(o=null===(n=o.branches.find((t=>t.set.has(u))))||void 0===n?void 0:n.node,!o)break;if(o.save)i=u;else if(o.check&&u===i)break;a.push(u),o.fe0f&&(a.push(65039),s>0&&65039==t[s-1]&&s--),o.valid&&(r=a.slice(),2==o.valid&&r.splice(1,1),e&&e.push(...t.slice(s).reverse()),t.length=s)}return r}const Ly=new jp(ty),Ey=new Uint8Array(32);function xy(t){if(0===t.length)throw new Error("invalid ENS name; empty component");return t}function Ny(t){const e=Hg(ky(t)),n=[];if(0===t.length)return n;let r=0;for(let t=0;t<e.length;t++){46===e[t]&&(n.push(xy(e.slice(r,t))),r=t+1)}if(r>=e.length)throw new Error("invalid ENS name; empty component");return n.push(xy(e.slice(r))),n}function Sy(t){"string"!=typeof t&&Ly.throwArgumentError("invalid ENS name; not a string","name",t);let e=Ey;const n=Ny(t);for(;n.length;)e=ug(Up([e,ug(n.pop())]));return Yp(e)}Ey.fill(0);var Iy=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const Ty=new jp(ty),Cy=new Uint8Array(32);Cy.fill(0);const jy=rm.from(-1),Dy=rm.from(0),Oy=rm.from(1),_y=rm.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const zy=Zp(Oy.toHexString(),32),Py=Zp(Dy.toHexString(),32),By={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Ry=["name","version","chainId","verifyingContract","salt"];function Uy(t){return function(e){return"string"!=typeof e&&Ty.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const Wy={name:Uy("name"),version:Uy("version"),chainId:function(t){try{return rm.from(t).toString()}catch(t){}return Ty.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return Mg(t).toLowerCase()}catch(t){}return Ty.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=Rp(t);if(32!==e.length)throw new Error("bad length");return Yp(e)}catch(t){}return Ty.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function Qy(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const n=""===e[1],r=parseInt(e[2]||"256");(r%8!=0||r>256||e[2]&&e[2]!==String(r))&&Ty.throwArgumentError("invalid numeric width","type",t);const i=_y.mask(n?r-1:r),o=n?i.add(Oy).mul(jy):Dy;return function(e){const n=rm.from(e);return(n.lt(o)||n.gt(i))&&Ty.throwArgumentError(`value out-of-bounds for ${t}`,"value",e),Zp(n.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const n=parseInt(e[1]);return(0===n||n>32||e[1]!==String(n))&&Ty.throwArgumentError("invalid bytes width","type",t),function(e){return Rp(e).length!==n&&Ty.throwArgumentError(`invalid length for ${t}`,"value",e),function(t){const e=Rp(t),n=e.length%32;return n?qp([e,Cy.slice(n)]):Yp(e)}(e)}}}switch(t){case"address":return function(t){return Zp(Mg(t),32)};case"bool":return function(t){return t?zy:Py};case"bytes":return function(t){return ug(t)};case"string":return function(t){return $g(t)}}return null}function Fy(t,e){return`${t}(${e.map((({name:t,type:e})=>e+" "+t)).join(",")})`}class Yy{constructor(t){Am(this,"types",Object.freeze(Tm(t))),Am(this,"_encoderCache",{}),Am(this,"_types",{});const e={},n={},r={};Object.keys(t).forEach((t=>{e[t]={},n[t]=[],r[t]={}}));for(const r in t){const i={};t[r].forEach((o=>{i[o.name]&&Ty.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,"types",t),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===r&&Ty.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",t);Qy(a)||(n[a]||Ty.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",t),n[a].push(r),e[r][a]=!0)}))}const i=Object.keys(n).filter((t=>0===n[t].length));0===i.length?Ty.throwArgumentError("missing primary type","types",t):i.length>1&&Ty.throwArgumentError(`ambiguous primary types or unused types: ${i.map((t=>JSON.stringify(t))).join(", ")}`,"types",t),Am(this,"primaryType",i[0]),function i(o,a){a[o]&&Ty.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",t),a[o]=!0,Object.keys(e[o]).forEach((t=>{n[t]&&(i(t,a),Object.keys(a).forEach((e=>{r[e][t]=!0})))})),delete a[o]}(this.primaryType,{});for(const e in r){const n=Object.keys(r[e]);n.sort(),this._types[e]=Fy(e,t[e])+n.map((e=>Fy(e,t[e]))).join("")}}getEncoder(t){let e=this._encoderCache[t];return e||(e=this._encoderCache[t]=this._getEncoder(t)),e}_getEncoder(t){{const e=Qy(t);if(e)return e}const e=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(e){const t=e[1],n=this.getEncoder(t),r=parseInt(e[3]);return e=>{r>=0&&e.length!==r&&Ty.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);let i=e.map(n);return this._types[t]&&(i=i.map(ug)),ug(qp(i))}}const n=this.types[t];if(n){const e=$g(this._types[t]);return t=>{const r=n.map((({name:e,type:n})=>{const r=this.getEncoder(n)(t[e]);return this._types[n]?ug(r):r}));return r.unshift(e),qp(r)}}return Ty.throwArgumentError(`unknown type: ${t}`,"type",t)}encodeType(t){const e=this._types[t];return e||Ty.throwArgumentError(`unknown type: ${JSON.stringify(t)}`,"name",t),e}encodeData(t,e){return this.getEncoder(t)(e)}hashStruct(t,e){return ug(this.encodeData(t,e))}encode(t){return this.encodeData(this.primaryType,t)}hash(t){return this.hashStruct(this.primaryType,t)}_visit(t,e,n){if(Qy(t))return n(t,e);const r=t.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const t=r[1],i=parseInt(r[3]);return i>=0&&e.length!==i&&Ty.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e),e.map((e=>this._visit(t,e,n)))}const i=this.types[t];return i?i.reduce(((t,{name:r,type:i})=>(t[r]=this._visit(i,e[r],n),t)),{}):Ty.throwArgumentError(`unknown type: ${t}`,"type",t)}visit(t,e){return this._visit(this.primaryType,t,e)}static from(t){return new Yy(t)}static getPrimaryType(t){return Yy.from(t).primaryType}static hashStruct(t,e,n){return Yy.from(e).hashStruct(t,n)}static hashDomain(t){const e=[];for(const n in t){const r=By[n];r||Ty.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",t),e.push({name:n,type:r})}return e.sort(((t,e)=>Ry.indexOf(t.name)-Ry.indexOf(e.name))),Yy.hashStruct("EIP712Domain",{EIP712Domain:e},t)}static encode(t,e,n){return qp(["0x1901",Yy.hashDomain(t),Yy.from(e).hash(n)])}static hash(t,e,n){return ug(Yy.encode(t,e,n))}static resolveNames(t,e,n,r){return Iy(this,void 0,void 0,(function*(){t=xm(t);const i={};t.verifyingContract&&!Qp(t.verifyingContract,20)&&(i[t.verifyingContract]="0x");const o=Yy.from(e);o.visit(n,((t,e)=>("address"!==t||Qp(e,20)||(i[e]="0x"),e)));for(const t in i)i[t]=yield r(t);return t.verifyingContract&&i[t.verifyingContract]&&(t.verifyingContract=i[t.verifyingContract]),n=o.visit(n,((t,e)=>"address"===t&&i[e]?i[e]:e)),{domain:t,value:n}}))}static getPayload(t,e,n){Yy.hashDomain(t);const r={},i=[];Ry.forEach((e=>{const n=t[e];null!=n&&(r[e]=Wy[e](n),i.push({name:e,type:By[e]}))}));const o=Yy.from(e),a=xm(e);return a.EIP712Domain?Ty.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",e):a.EIP712Domain=i,o.encode(n),{types:a,domain:r,primaryType:o.primaryType,message:o.visit(n,((t,e)=>{if(t.match(/^bytes(\d*)/))return Yp(Rp(e));if(t.match(/^u?int/))return rm.from(e).toString();switch(t){case"address":return e.toLowerCase();case"bool":return!!e;case"string":return"string"!=typeof e&&Ty.throwArgumentError("invalid string","value",e),e}return Ty.throwArgumentError("unsupported type","type",t)}))}}}const Hy=new jp(jm);class Vy extends Cm{}class qy extends Cm{}class Gy extends Cm{}class Zy extends Cm{static isIndexed(t){return!(!t||!t._isIndexed)}}const Jy={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Xy(t,e){const n=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return n.error=e,n}class Ky{constructor(t){let e=[];e="string"==typeof t?JSON.parse(t):t,Am(this,"fragments",e.map((t=>Fm.from(t))).filter((t=>null!=t))),Am(this,"_abiCoder",Lm(new.target,"getAbiCoder")()),Am(this,"functions",{}),Am(this,"errors",{}),Am(this,"events",{}),Am(this,"structs",{}),this.fragments.forEach((t=>{let e=null;switch(t.type){case"constructor":return this.deploy?void Hy.warn("duplicate definition - constructor"):void Am(this,"deploy",t);case"function":e=this.functions;break;case"event":e=this.events;break;case"error":e=this.errors;break;default:return}let n=t.format();e[n]?Hy.warn("duplicate definition - "+n):e[n]=t})),this.deploy||Am(this,"deploy",Gm.from({payable:!1,type:"constructor"})),Am(this,"_isInterface",!0)}format(t){t||(t=Rm.full),t===Rm.sighash&&Hy.throwArgumentError("interface does not support formatting sighash","format",t);const e=this.fragments.map((e=>e.format(t)));return t===Rm.json?JSON.stringify(e.map((t=>JSON.parse(t)))):e}static getAbiCoder(){return Kg}static getAddress(t){return Mg(t)}static getSighash(t){return Vp($g(t.format()),0,4)}static getEventTopic(t){return $g(t.format())}getFunction(t){if(Qp(t)){for(const e in this.functions)if(t===this.getSighash(e))return this.functions[e];Hy.throwArgumentError("no matching function","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.functions).filter((t=>t.split("(")[0]===e));return 0===n.length?Hy.throwArgumentError("no matching function","name",e):n.length>1&&Hy.throwArgumentError("multiple matching functions","name",e),this.functions[n[0]]}const e=this.functions[Zm.fromString(t).format()];return e||Hy.throwArgumentError("no matching function","signature",t),e}getEvent(t){if(Qp(t)){const e=t.toLowerCase();for(const t in this.events)if(e===this.getEventTopic(t))return this.events[t];Hy.throwArgumentError("no matching event","topichash",e)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.events).filter((t=>t.split("(")[0]===e));return 0===n.length?Hy.throwArgumentError("no matching event","name",e):n.length>1&&Hy.throwArgumentError("multiple matching events","name",e),this.events[n[0]]}const e=this.events[Ym.fromString(t).format()];return e||Hy.throwArgumentError("no matching event","signature",t),e}getError(t){if(Qp(t)){const e=Lm(this.constructor,"getSighash");for(const n in this.errors){if(t===e(this.errors[n]))return this.errors[n]}Hy.throwArgumentError("no matching error","sighash",t)}if(-1===t.indexOf("(")){const e=t.trim(),n=Object.keys(this.errors).filter((t=>t.split("(")[0]===e));return 0===n.length?Hy.throwArgumentError("no matching error","name",e):n.length>1&&Hy.throwArgumentError("multiple matching errors","name",e),this.errors[n[0]]}const e=this.errors[Zm.fromString(t).format()];return e||Hy.throwArgumentError("no matching error","signature",t),e}getSighash(t){if("string"==typeof t)try{t=this.getFunction(t)}catch(e){try{t=this.getError(t)}catch(t){throw e}}return Lm(this.constructor,"getSighash")(t)}getEventTopic(t){return"string"==typeof t&&(t=this.getEvent(t)),Lm(this.constructor,"getEventTopic")(t)}_decodeParams(t,e){return this._abiCoder.decode(t,e)}_encodeParams(t,e){return this._abiCoder.encode(t,e)}encodeDeploy(t){return this._encodeParams(this.deploy.inputs,t||[])}decodeErrorResult(t,e){"string"==typeof t&&(t=this.getError(t));const n=Rp(e);return Yp(n.slice(0,4))!==this.getSighash(t)&&Hy.throwArgumentError(`data signature does not match error ${t.name}.`,"data",Yp(n)),this._decodeParams(t.inputs,n.slice(4))}encodeErrorResult(t,e){return"string"==typeof t&&(t=this.getError(t)),Yp(Up([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionData(t,e){"string"==typeof t&&(t=this.getFunction(t));const n=Rp(e);return Yp(n.slice(0,4))!==this.getSighash(t)&&Hy.throwArgumentError(`data signature does not match function ${t.name}.`,"data",Yp(n)),this._decodeParams(t.inputs,n.slice(4))}encodeFunctionData(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Yp(Up([this.getSighash(t),this._encodeParams(t.inputs,e||[])]))}decodeFunctionResult(t,e){"string"==typeof t&&(t=this.getFunction(t));let n=Rp(e),r=null,i="",o=null,a=null,s=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(t.outputs,n)}catch(t){}break;case 4:{const t=Yp(n.slice(0,4)),e=Jy[t];if(e)o=this._abiCoder.decode(e.inputs,n.slice(4)),a=e.name,s=e.signature,e.reason&&(r=o[0]),"Error"===a?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===a&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const e=this.getError(t);o=this._abiCoder.decode(e.inputs,n.slice(4)),a=e.name,s=e.format()}catch(t){}break}}return Hy.throwError("call revert exception"+i,jp.errors.CALL_EXCEPTION,{method:t.format(),data:Yp(e),errorArgs:o,errorName:a,errorSignature:s,reason:r})}encodeFunctionResult(t,e){return"string"==typeof t&&(t=this.getFunction(t)),Yp(this._abiCoder.encode(t.outputs,e||[]))}encodeFilterTopics(t,e){"string"==typeof t&&(t=this.getEvent(t)),e.length>t.inputs.length&&Hy.throwError("too many arguments for "+t.format(),jp.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:e});let n=[];t.anonymous||n.push(this.getEventTopic(t));const r=(t,e)=>"string"===t.type?$g(e):"bytes"===t.type?ug(Yp(e)):("bool"===t.type&&"boolean"==typeof e&&(e=e?"0x01":"0x00"),t.type.match(/^u?int/)&&(e=rm.from(e).toHexString()),"address"===t.type&&this._abiCoder.encode(["address"],[e]),Zp(Yp(e),32));for(e.forEach(((e,i)=>{let o=t.inputs[i];o.indexed?null==e?n.push(null):"array"===o.baseType||"tuple"===o.baseType?Hy.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,e):Array.isArray(e)?n.push(e.map((t=>r(o,t)))):n.push(r(o,e)):null!=e&&Hy.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,e)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(t,e){"string"==typeof t&&(t=this.getEvent(t));const n=[],r=[],i=[];return t.anonymous||n.push(this.getEventTopic(t)),e.length!==t.inputs.length&&Hy.throwArgumentError("event arguments/values mismatch","values",e),t.inputs.forEach(((t,o)=>{const a=e[o];if(t.indexed)if("string"===t.type)n.push($g(a));else if("bytes"===t.type)n.push(ug(a));else{if("tuple"===t.baseType||"array"===t.baseType)throw new Error("not implemented");n.push(this._abiCoder.encode([t.type],[a]))}else r.push(t),i.push(a)})),{data:this._abiCoder.encode(r,i),topics:n}}decodeEventLog(t,e,n){if("string"==typeof t&&(t=this.getEvent(t)),null!=n&&!t.anonymous){let e=this.getEventTopic(t);Qp(n[0],32)&&n[0].toLowerCase()===e||Hy.throwError("fragment/topic mismatch",jp.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:e,value:n[0]}),n=n.slice(1)}let r=[],i=[],o=[];t.inputs.forEach(((t,e)=>{t.indexed?"string"===t.type||"bytes"===t.type||"tuple"===t.baseType||"array"===t.baseType?(r.push(Wm.fromObject({type:"bytes32",name:t.name})),o.push(!0)):(r.push(t),o.push(!1)):(i.push(t),o.push(!1))}));let a=null!=n?this._abiCoder.decode(r,Up(n)):null,s=this._abiCoder.decode(i,e,!0),u=[],c=0,l=0;t.inputs.forEach(((t,e)=>{if(t.indexed)if(null==a)u[e]=new Zy({_isIndexed:!0,hash:null});else if(o[e])u[e]=new Zy({_isIndexed:!0,hash:a[l++]});else try{u[e]=a[l++]}catch(t){u[e]=t}else try{u[e]=s[c++]}catch(t){u[e]=t}if(t.name&&null==u[t.name]){const n=u[e];n instanceof Error?Object.defineProperty(u,t.name,{enumerable:!0,get:()=>{throw Xy(`property ${JSON.stringify(t.name)}`,n)}}):u[t.name]=n}}));for(let t=0;t<u.length;t++){const e=u[t];e instanceof Error&&Object.defineProperty(u,t,{enumerable:!0,get:()=>{throw Xy(`index ${t}`,e)}})}return Object.freeze(u)}parseTransaction(t){let e=this.getFunction(t.data.substring(0,10).toLowerCase());return e?new qy({args:this._abiCoder.decode(e.inputs,"0x"+t.data.substring(10)),functionFragment:e,name:e.name,signature:e.format(),sighash:this.getSighash(e),value:rm.from(t.value||"0")}):null}parseLog(t){let e=this.getEvent(t.topics[0]);return!e||e.anonymous?null:new Vy({eventFragment:e,name:e.name,signature:e.format(),topic:this.getEventTopic(e),args:this.decodeEventLog(e,t.data,t.topics)})}parseError(t){const e=Yp(t);let n=this.getError(e.substring(0,10).toLowerCase());return n?new Gy({args:this._abiCoder.decode(n.inputs,"0x"+e.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(t){return!(!t||!t._isInterface)}}var $y=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const tv=new jp("abstract-provider/5.7.0");class ev extends Cm{static isForkEvent(t){return!(!t||!t._isForkEvent)}}class nv{constructor(){tv.checkAbstract(new.target,nv),Am(this,"_isProvider",!0)}getFeeData(){return $y(this,void 0,void 0,(function*(){const{block:t,gasPrice:e}=yield Em({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((t=>null))});let n=null,r=null,i=null;return t&&t.baseFeePerGas&&(n=t.baseFeePerGas,i=rm.from("1500000000"),r=t.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:e}}))}addListener(t,e){return this.on(t,e)}removeListener(t,e){return this.off(t,e)}static isProvider(t){return!(!t||!t._isProvider)}}var rv=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const iv=new jp("abstract-signer/5.7.0"),ov=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],av=[jp.errors.INSUFFICIENT_FUNDS,jp.errors.NONCE_EXPIRED,jp.errors.REPLACEMENT_UNDERPRICED];class sv{constructor(){iv.checkAbstract(new.target,sv),Am(this,"_isSigner",!0)}getBalance(t){return rv(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),t)}))}getTransactionCount(t){return rv(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),t)}))}estimateGas(t){return rv(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const e=yield Em(this.checkTransaction(t));return yield this.provider.estimateGas(e)}))}call(t,e){return rv(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield Em(this.checkTransaction(t));return yield this.provider.call(n,e)}))}sendTransaction(t){return rv(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const e=yield this.populateTransaction(t),n=yield this.signTransaction(e);return yield this.provider.sendTransaction(n)}))}getChainId(){return rv(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return rv(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return rv(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(t){return rv(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(t)}))}checkTransaction(t){for(const e in t)-1===ov.indexOf(e)&&iv.throwArgumentError("invalid transaction key: "+e,"transaction",t);const e=xm(t);return null==e.from?e.from=this.getAddress():e.from=Promise.all([Promise.resolve(e.from),this.getAddress()]).then((e=>(e[0].toLowerCase()!==e[1].toLowerCase()&&iv.throwArgumentError("from address mismatch","transaction",t),e[0]))),e}populateTransaction(t){return rv(this,void 0,void 0,(function*(){const e=yield Em(this.checkTransaction(t));null!=e.to&&(e.to=Promise.resolve(e.to).then((t=>rv(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.resolveName(t);return null==e&&iv.throwArgumentError("provided ENS name resolves to null","tx.to",t),e})))),e.to.catch((t=>{})));const n=null!=e.maxFeePerGas||null!=e.maxPriorityFeePerGas;if(null==e.gasPrice||2!==e.type&&!n?0!==e.type&&1!==e.type||!n||iv.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",t):iv.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",t),2!==e.type&&null!=e.type||null==e.maxFeePerGas||null==e.maxPriorityFeePerGas)if(0===e.type||1===e.type)null==e.gasPrice&&(e.gasPrice=this.getGasPrice());else{const t=yield this.getFeeData();if(null==e.type)if(null!=t.maxFeePerGas&&null!=t.maxPriorityFeePerGas)if(e.type=2,null!=e.gasPrice){const t=e.gasPrice;delete e.gasPrice,e.maxFeePerGas=t,e.maxPriorityFeePerGas=t}else null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas);else null!=t.gasPrice?(n&&iv.throwError("network does not support EIP-1559",jp.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==e.gasPrice&&(e.gasPrice=t.gasPrice),e.type=0):iv.throwError("failed to get consistent fee data",jp.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===e.type&&(null==e.maxFeePerGas&&(e.maxFeePerGas=t.maxFeePerGas),null==e.maxPriorityFeePerGas&&(e.maxPriorityFeePerGas=t.maxPriorityFeePerGas))}else e.type=2;return null==e.nonce&&(e.nonce=this.getTransactionCount("pending")),null==e.gasLimit&&(e.gasLimit=this.estimateGas(e).catch((t=>{if(av.indexOf(t.code)>=0)throw t;return iv.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",jp.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,tx:e})}))),null==e.chainId?e.chainId=this.getChainId():e.chainId=Promise.all([Promise.resolve(e.chainId),this.getChainId()]).then((e=>(0!==e[1]&&e[0]!==e[1]&&iv.throwArgumentError("chainId address mismatch","transaction",t),e[0]))),yield Em(e)}))}_checkProvider(t){this.provider||iv.throwError("missing provider",jp.errors.UNSUPPORTED_OPERATION,{operation:t||"_checkProvider"})}static isSigner(t){return!(!t||!t._isSigner)}}class uv extends sv{constructor(t,e){super(),Am(this,"address",t),Am(this,"provider",e||null)}getAddress(){return Promise.resolve(this.address)}_fail(t,e){return Promise.resolve().then((()=>{iv.throwError(t,jp.errors.UNSUPPORTED_OPERATION,{operation:e})}))}signMessage(t){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(t){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(t,e,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(t){return new uv(this.address,t)}}var cv=lv;function lv(t,e){if(!t)throw new Error(e||"Assertion failed")}lv.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var hv=[],dv=[],fv="undefined"!=typeof Uint8Array?Uint8Array:Array,pv=!1;function mv(){pv=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)hv[e]=t[e],dv[t.charCodeAt(e)]=e;dv["-".charCodeAt(0)]=62,dv["_".charCodeAt(0)]=63}function gv(t,e,n){for(var r,i,o=[],a=e;a<n;a+=3)r=(t[a]<<16)+(t[a+1]<<8)+t[a+2],o.push(hv[(i=r)>>18&63]+hv[i>>12&63]+hv[i>>6&63]+hv[63&i]);return o.join("")}function yv(t){var e;pv||mv();for(var n=t.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;s<u;s+=a)o.push(gv(t,s,s+a>u?u:s+a));return 1===r?(e=t[n-1],i+=hv[e>>2],i+=hv[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=hv[e>>10],i+=hv[e>>4&63],i+=hv[e<<2&63],i+="="),o.push(i),o.join("")}function vv(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=t[e+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+t[e+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+t[e+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)}function wv(t,e,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;t[n+f]=255&a,f+=p,a/=256,c-=8);t[n+f-p]|=128*m}var bv={}.toString,Mv=Array.isArray||function(t){return"[object Array]"==bv.call(t)};function kv(){return Lv.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Av(t,e){if(kv()<e)throw new RangeError("Invalid typed array length");return Lv.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=Lv.prototype:(null===t&&(t=new Lv(e)),t.length=e),t}function Lv(t,e,n){if(!(Lv.TYPED_ARRAY_SUPPORT||this instanceof Lv))return new Lv(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return Nv(this,t)}return Ev(this,t,e,n)}function Ev(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);Lv.TYPED_ARRAY_SUPPORT?(t=e).__proto__=Lv.prototype:t=Sv(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!Lv.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Cv(e,n);t=Av(t,r);var i=t.write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(Tv(e)){var n=0|Iv(e.length);return 0===(t=Av(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?Av(t,0):Sv(t,e);if("Buffer"===e.type&&Mv(e.data))return Sv(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function xv(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function Nv(t,e){if(xv(e),t=Av(t,e<0?0:0|Iv(e)),!Lv.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function Sv(t,e){var n=e.length<0?0:0|Iv(e.length);t=Av(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function Iv(t){if(t>=kv())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kv().toString(16)+" bytes");return 0|t}function Tv(t){return!(null==t||!t._isBuffer)}function Cv(t,e){if(Tv(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return iw(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ow(t).length;default:if(r)return iw(t).length;e=(""+e).toLowerCase(),r=!0}}function jv(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return qv(this,e,n);case"utf8":case"utf-8":return Fv(this,e,n);case"ascii":return Hv(this,e,n);case"latin1":case"binary":return Vv(this,e,n);case"base64":return Qv(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Gv(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function Dv(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Ov(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=Lv.from(e,r)),Tv(e))return 0===e.length?-1:_v(t,e,n,r,i);if("number"==typeof e)return e&=255,Lv.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):_v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function _v(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(o=n;o<s;o++)if(c(t,o)===c(e,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;d<u;d++)if(c(t,o+d)!==c(e,d)){h=!1;break}if(h)return o}return-1}function zv(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function Pv(t,e,n,r){return aw(iw(e,t.length-n),t,n,r)}function Bv(t,e,n,r){return aw(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function Rv(t,e,n,r){return Bv(t,e,n,r)}function Uv(t,e,n,r){return aw(ow(e),t,n,r)}function Wv(t,e,n,r){return aw(function(t,e){for(var n,r,i,o=[],a=0;a<t.length&&!((e-=2)<0);++a)r=(n=t.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function Qv(t,e,n){return 0===e&&n===t.length?yv(t):yv(t.slice(e,n))}function Fv(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,a,s,u,c=t[i],l=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(t){var e=t.length;if(e<=Yv)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=Yv));return n}(r)}Lv.TYPED_ARRAY_SUPPORT=void 0===l.TYPED_ARRAY_SUPPORT||l.TYPED_ARRAY_SUPPORT,kv(),Lv.poolSize=8192,Lv._augment=function(t){return t.__proto__=Lv.prototype,t},Lv.from=function(t,e,n){return Ev(null,t,e,n)},Lv.TYPED_ARRAY_SUPPORT&&(Lv.prototype.__proto__=Uint8Array.prototype,Lv.__proto__=Uint8Array),Lv.alloc=function(t,e,n){return function(t,e,n,r){return xv(e),e<=0?Av(t,e):void 0!==n?"string"==typeof r?Av(t,e).fill(n,r):Av(t,e).fill(n):Av(t,e)}(null,t,e,n)},Lv.allocUnsafe=function(t){return Nv(null,t)},Lv.allocUnsafeSlow=function(t){return Nv(null,t)},Lv.isBuffer=function(t){return null!=t&&(!!t._isBuffer||sw(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&sw(t.slice(0,0))}(t))},Lv.compare=function(t,e){if(!Tv(t)||!Tv(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,o=Math.min(n,r);i<o;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},Lv.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Lv.concat=function(t,e){if(!Mv(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return Lv.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=Lv.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var o=t[n];if(!Tv(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},Lv.byteLength=Cv,Lv.prototype._isBuffer=!0,Lv.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)Dv(this,e,e+1);return this},Lv.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)Dv(this,e,e+3),Dv(this,e+1,e+2);return this},Lv.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)Dv(this,e,e+7),Dv(this,e+1,e+6),Dv(this,e+2,e+5),Dv(this,e+3,e+4);return this},Lv.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?Fv(this,0,t):jv.apply(this,arguments)},Lv.prototype.equals=function(t){if(!Tv(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Lv.compare(this,t)},Lv.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},Lv.prototype.compare=function(t,e,n,r,i){if(!Tv(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(r,i),c=t.slice(e,n),l=0;l<s;++l)if(u[l]!==c[l]){o=u[l],a=c[l];break}return o<a?-1:a<o?1:0},Lv.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},Lv.prototype.indexOf=function(t,e,n){return Ov(this,t,e,n,!0)},Lv.prototype.lastIndexOf=function(t,e,n){return Ov(this,t,e,n,!1)},Lv.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return zv(this,t,e,n);case"utf8":case"utf-8":return Pv(this,t,e,n);case"ascii":return Bv(this,t,e,n);case"latin1":case"binary":return Rv(this,t,e,n);case"base64":return Uv(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wv(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Lv.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Yv=4096;function Hv(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function Vv(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function qv(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=rw(t[o]);return i}function Gv(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Zv(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function Jv(t,e,n,r,i,o){if(!Tv(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function Xv(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i<o;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function Kv(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i<o;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function $v(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function tw(t,e,n,r,i){return i||$v(t,0,n,4),wv(t,e,n,r,23,4),n+4}function ew(t,e,n,r,i){return i||$v(t,0,n,8),wv(t,e,n,r,52,8),n+8}Lv.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),Lv.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=Lv.prototype;else{var i=e-t;n=new Lv(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+t]}return n},Lv.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||Zv(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},Lv.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||Zv(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},Lv.prototype.readUInt8=function(t,e){return e||Zv(t,1,this.length),this[t]},Lv.prototype.readUInt16LE=function(t,e){return e||Zv(t,2,this.length),this[t]|this[t+1]<<8},Lv.prototype.readUInt16BE=function(t,e){return e||Zv(t,2,this.length),this[t]<<8|this[t+1]},Lv.prototype.readUInt32LE=function(t,e){return e||Zv(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Lv.prototype.readUInt32BE=function(t,e){return e||Zv(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Lv.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||Zv(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},Lv.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||Zv(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},Lv.prototype.readInt8=function(t,e){return e||Zv(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Lv.prototype.readInt16LE=function(t,e){e||Zv(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},Lv.prototype.readInt16BE=function(t,e){e||Zv(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},Lv.prototype.readInt32LE=function(t,e){return e||Zv(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Lv.prototype.readInt32BE=function(t,e){return e||Zv(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Lv.prototype.readFloatLE=function(t,e){return e||Zv(t,4,this.length),vv(this,t,!0,23,4)},Lv.prototype.readFloatBE=function(t,e){return e||Zv(t,4,this.length),vv(this,t,!1,23,4)},Lv.prototype.readDoubleLE=function(t,e){return e||Zv(t,8,this.length),vv(this,t,!0,52,8)},Lv.prototype.readDoubleBE=function(t,e){return e||Zv(t,8,this.length),vv(this,t,!1,52,8)},Lv.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||Jv(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},Lv.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||Jv(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},Lv.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||Jv(this,t,e,1,255,0),Lv.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},Lv.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||Jv(this,t,e,2,65535,0),Lv.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):Xv(this,t,e,!0),e+2},Lv.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||Jv(this,t,e,2,65535,0),Lv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):Xv(this,t,e,!1),e+2},Lv.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||Jv(this,t,e,4,4294967295,0),Lv.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):Kv(this,t,e,!0),e+4},Lv.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||Jv(this,t,e,4,4294967295,0),Lv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Kv(this,t,e,!1),e+4},Lv.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Jv(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o<n&&(a*=256);)t<0&&0===s&&0!==this[e+o-1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},Lv.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Jv(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},Lv.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||Jv(this,t,e,1,127,-128),Lv.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},Lv.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||Jv(this,t,e,2,32767,-32768),Lv.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):Xv(this,t,e,!0),e+2},Lv.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||Jv(this,t,e,2,32767,-32768),Lv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):Xv(this,t,e,!1),e+2},Lv.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||Jv(this,t,e,4,2147483647,-2147483648),Lv.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Kv(this,t,e,!0),e+4},Lv.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||Jv(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),Lv.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Kv(this,t,e,!1),e+4},Lv.prototype.writeFloatLE=function(t,e,n){return tw(this,t,e,!0,n)},Lv.prototype.writeFloatBE=function(t,e,n){return tw(this,t,e,!1,n)},Lv.prototype.writeDoubleLE=function(t,e,n){return ew(this,t,e,!0,n)},Lv.prototype.writeDoubleBE=function(t,e,n){return ew(this,t,e,!1,n)},Lv.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,o=r-n;if(this===t&&n<e&&e<r)for(i=o-1;i>=0;--i)t[i+e]=this[i+n];else if(o<1e3||!Lv.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o},Lv.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Lv.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var o;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o<n;++o)this[o]=t;else{var a=Tv(t)?t:iw(new Lv(t,r).toString()),s=a.length;for(o=0;o<n-e;++o)this[o+e]=a[o%s]}return this};var nw=/[^+\/0-9A-Za-z-_]/g;function rw(t){return t<16?"0"+t.toString(16):t.toString(16)}function iw(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function ow(t){return function(t){var e,n,r,i,o,a;pv||mv();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new fv(3*s/4-o),r=o>0?s-4:s;var u=0;for(e=0,n=0;e<r;e+=4,n+=3)i=dv[t.charCodeAt(e)]<<18|dv[t.charCodeAt(e+1)]<<12|dv[t.charCodeAt(e+2)]<<6|dv[t.charCodeAt(e+3)],a[u++]=i>>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=dv[t.charCodeAt(e)]<<2|dv[t.charCodeAt(e+1)]>>4,a[u++]=255&i):1===o&&(i=dv[t.charCodeAt(e)]<<10|dv[t.charCodeAt(e+1)]<<4|dv[t.charCodeAt(e+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(nw,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function aw(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function sw(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var uw=function(t){return t instanceof Lv},cw=o((function(t,e){var n=/%[sdj%]/g;e.format=function(t){if(!g(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(a(arguments[r]));return e.join(" ")}r=1;for(var i=arguments,o=i.length,s=String(t).replace(n,(function(t){if("%%"===t)return"%";if(r>=o)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r<o;u=i[++r])p(u)||!w(u)?s+=" "+u:s+=" "+a(u);return s},e.deprecate=function(t,n){if(y(r.process))return function(){return e.deprecate(t,n).apply(this,arguments)};if(!0===_.noDeprecation)return t;var i=!1;return function(){if(!i){if(_.throwDeprecation)throw new Error(n);_.traceDeprecation?console.trace(n):console.error(n),i=!0}return t.apply(this,arguments)}};var i,o={};function a(t,n){var r={seen:[],stylize:u};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),f(n)?r.showHidden=n:n&&e._extend(r,n),y(r.showHidden)&&(r.showHidden=!1),y(r.depth)&&(r.depth=2),y(r.colors)&&(r.colors=!1),y(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=s),c(r,t,r.depth)}function s(t,e){var n=a.styles[e];return n?"["+a.colors[n][0]+"m"+t+"["+a.colors[n][1]+"m":t}function u(t,e){return t}function c(t,n,r){if(t.customInspect&&n&&k(n.inspect)&&n.inspect!==e.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,t);return g(i)||(i=c(t,i,r)),i}var o=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(g(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if(m(e))return t.stylize(""+e,"number");if(f(e))return t.stylize(""+e,"boolean");if(p(e))return t.stylize("null","null")}(t,n);if(o)return o;var a=Object.keys(n),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(n)),0===a.length){if(k(n)){var u=n.name?": "+n.name:"";return t.stylize("[Function"+u+"]","special")}if(v(n))return t.stylize(RegExp.prototype.toString.call(n),"regexp");if(b(n))return t.stylize(Date.prototype.toString.call(n),"date");if(M(n))return l(n)}var w,A="",L=!1,E=["{","}"];(d(n)&&(L=!0,E=["[","]"]),k(n))&&(A=" [Function"+(n.name?": "+n.name:"")+"]");return v(n)&&(A=" "+RegExp.prototype.toString.call(n)),b(n)&&(A=" "+Date.prototype.toUTCString.call(n)),M(n)&&(A=" "+l(n)),0!==a.length||L&&0!=n.length?r<0?v(n)?t.stylize(RegExp.prototype.toString.call(n),"regexp"):t.stylize("[Object]","special"):(t.seen.push(n),w=L?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a<s;++a)x(e,String(a))?o.push(h(t,e,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(h(t,e,n,r,i,!0))})),o}(t,n,r,s,a):a.map((function(e){return h(t,n,r,s,e,L)})),t.seen.pop(),function(t,e,n){var r=t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(r>60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(w,A,E)):E[0]+A+E[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),x(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=p(n)?c(t,u.value,null):c(t,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),y(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function d(t){return Array.isArray(t)}function f(t){return"boolean"==typeof t}function p(t){return null===t}function m(t){return"number"==typeof t}function g(t){return"string"==typeof t}function y(t){return void 0===t}function v(t){return w(t)&&"[object RegExp]"===A(t)}function w(t){return"object"==typeof t&&null!==t}function b(t){return w(t)&&"[object Date]"===A(t)}function M(t){return w(t)&&("[object Error]"===A(t)||t instanceof Error)}function k(t){return"function"==typeof t}function A(t){return Object.prototype.toString.call(t)}function L(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(t){if(y(i)&&(i=_.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(i)){var n=_.pid;o[t]=function(){var r=e.format.apply(e,arguments);console.error("%s %d: %s",t,n,r)}}else o[t]=function(){};return o[t]},e.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=d,e.isBoolean=f,e.isNull=p,e.isNullOrUndefined=function(t){return null==t},e.isNumber=m,e.isString=g,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=y,e.isRegExp=v,e.isObject=w,e.isDate=b,e.isError=M,e.isFunction=k,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=uw;var E=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function x(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){var t,n;console.log("%s - %s",(t=new Date,n=[L(t.getHours()),L(t.getMinutes()),L(t.getSeconds())].join(":"),[t.getDate(),E[t.getMonth()],n].join(" ")),e.format.apply(e,arguments))},e.inherits=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})},e._extend=function(t,e){if(!e||!w(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}})),lw=o((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}})),hw=o((function(t){try{var e=cw;if("function"!=typeof e.inherits)throw"";t.exports=e.inherits}catch(e){t.exports=lw}}));function dw(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}var fw=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),i=0;i<t.length;i+=2)n.push(parseInt(t[i]+t[i+1],16))}else for(var r=0,i=0;i<t.length;i++){var o=t.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):dw(t,i)?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<t.length;i++)n[i]=0|t[i];return n};var pw=function(t){for(var e="",n=0;n<t.length;n++)e+=yw(t[n].toString(16));return e};function mw(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}var gw=function(t,e){for(var n="",r=0;r<t.length;r++){var i=t[r];"little"===e&&(i=mw(i)),n+=vw(i.toString(16))}return n};function yw(t){return 1===t.length?"0"+t:t}function vw(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}var ww=function(t,e,n,r){var i=n-e;cv(i%4==0);for(var o=new Array(i/4),a=0,s=e;a<o.length;a++,s+=4){var u;u="big"===r?t[s]<<24|t[s+1]<<16|t[s+2]<<8|t[s+3]:t[s+3]<<24|t[s+2]<<16|t[s+1]<<8|t[s],o[a]=u>>>0}return o};var bw=function(t,e){for(var n=new Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4){var o=t[r];"big"===e?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n};var Mw=function(t,e){return t>>>e|t<<32-e};var kw=function(t,e){return t<<e|t>>>32-e};var Aw=function(t,e){return t+e>>>0};var Lw=function(t,e,n){return t+e+n>>>0};var Ew=function(t,e,n,r){return t+e+n+r>>>0};var xw=function(t,e,n,r,i){return t+e+n+r+i>>>0};var Nw=function(t,e,n,r){var i=t[e],o=r+t[e+1]>>>0,a=(o<r?1:0)+n+i;t[e]=a>>>0,t[e+1]=o};var Sw=function(t,e,n,r){return(e+r>>>0<e?1:0)+t+n>>>0};var Iw=function(t,e,n,r){return e+r>>>0};var Tw=function(t,e,n,r,i,o,a,s){var u=0,c=e;return u+=(c=c+r>>>0)<e?1:0,u+=(c=c+o>>>0)<o?1:0,t+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0};var Cw=function(t,e,n,r,i,o,a,s){return e+r+o+s>>>0};var jw=function(t,e,n,r,i,o,a,s,u,c){var l=0,h=e;return l+=(h=h+r>>>0)<e?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,t+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0};var Dw=function(t,e,n,r,i,o,a,s,u,c){return e+r+o+s+c>>>0};var Ow=function(t,e,n){return(e<<32-n|t>>>n)>>>0};var _w=function(t,e,n){return(t<<32-n|e>>>n)>>>0};var zw=function(t,e,n){return t>>>n};var Pw=function(t,e,n){return(t<<32-n|e>>>n)>>>0},Bw={inherits:hw,toArray:fw,toHex:pw,htonl:mw,toHex32:gw,zero2:yw,zero8:vw,join32:ww,split32:bw,rotr32:Mw,rotl32:kw,sum32:Aw,sum32_3:Lw,sum32_4:Ew,sum32_5:xw,sum64:Nw,sum64_hi:Sw,sum64_lo:Iw,sum64_4_hi:Tw,sum64_4_lo:Cw,sum64_5_hi:jw,sum64_5_lo:Dw,rotr64_hi:Ow,rotr64_lo:_w,shr64_hi:zw,shr64_lo:Pw};function Rw(){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}var Uw=Rw;Rw.prototype.update=function(t,e){if(t=Bw.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=Bw.join32(t,0,t.length-n,this.endian);for(var r=0;r<t.length;r+=this._delta32)this._update(t,r,r+this._delta32)}return this},Rw.prototype.digest=function(t){return this.update(this._pad()),cv(null===this.pending),this._digest(t)},Rw.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,n=e-(t+this.padLength)%e,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(t<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=t>>>24&255,r[i++]=t>>>16&255,r[i++]=t>>>8&255,r[i++]=255&t}else for(r[i++]=255&t,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var Ww={BlockHash:Uw},Qw=Bw.rotr32;var Fw=function(t,e,n,r){return 0===t?Yw(e,n,r):1===t||3===t?Vw(e,n,r):2===t?Hw(e,n,r):void 0};function Yw(t,e,n){return t&e^~t&n}function Hw(t,e,n){return t&e^t&n^e&n}function Vw(t,e,n){return t^e^n}var qw=function(t){return Qw(t,2)^Qw(t,13)^Qw(t,22)};var Gw=function(t){return Qw(t,6)^Qw(t,11)^Qw(t,25)};var Zw=function(t){return Qw(t,7)^Qw(t,18)^t>>>3};var Jw=function(t){return Qw(t,17)^Qw(t,19)^t>>>10},Xw={ft_1:Fw,ch32:Yw,maj32:Hw,p32:Vw,s0_256:qw,s1_256:Gw,g0_256:Zw,g1_256:Jw},Kw=Bw.rotl32,$w=Bw.sum32,tb=Bw.sum32_5,eb=Xw.ft_1,nb=Ww.BlockHash,rb=[1518500249,1859775393,2400959708,3395469782];function ib(){if(!(this instanceof ib))return new ib;nb.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Bw.inherits(ib,nb);var ob=ib;ib.blockSize=512,ib.outSize=160,ib.hmacStrength=80,ib.padLength=64,ib.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=Kw(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=tb(Kw(i,5),eb(c,o,a,s),u,n[r],rb[c]);u=s,s=a,a=Kw(o,30),o=i,i=l}this.h[0]=$w(this.h[0],i),this.h[1]=$w(this.h[1],o),this.h[2]=$w(this.h[2],a),this.h[3]=$w(this.h[3],s),this.h[4]=$w(this.h[4],u)},ib.prototype._digest=function(t){return"hex"===t?Bw.toHex32(this.h,"big"):Bw.split32(this.h,"big")};var ab=Bw.sum32,sb=Bw.sum32_4,ub=Bw.sum32_5,cb=Xw.ch32,lb=Xw.maj32,hb=Xw.s0_256,db=Xw.s1_256,fb=Xw.g0_256,pb=Xw.g1_256,mb=Ww.BlockHash,gb=[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 yb(){if(!(this instanceof yb))return new yb;mb.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=gb,this.W=new Array(64)}Bw.inherits(yb,mb);var vb=yb;function wb(){if(!(this instanceof wb))return new wb;vb.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}yb.blockSize=512,yb.outSize=256,yb.hmacStrength=192,yb.padLength=64,yb.prototype._update=function(t,e){for(var n=this.W,r=0;r<16;r++)n[r]=t[e+r];for(;r<n.length;r++)n[r]=sb(pb(n[r-2]),n[r-7],fb(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(cv(this.k.length===n.length),r=0;r<n.length;r++){var d=ub(h,db(u),cb(u,c,l),this.k[r],n[r]),f=ab(hb(i),lb(i,o,a));h=l,l=c,c=u,u=ab(s,d),s=a,a=o,o=i,i=ab(d,f)}this.h[0]=ab(this.h[0],i),this.h[1]=ab(this.h[1],o),this.h[2]=ab(this.h[2],a),this.h[3]=ab(this.h[3],s),this.h[4]=ab(this.h[4],u),this.h[5]=ab(this.h[5],c),this.h[6]=ab(this.h[6],l),this.h[7]=ab(this.h[7],h)},yb.prototype._digest=function(t){return"hex"===t?Bw.toHex32(this.h,"big"):Bw.split32(this.h,"big")},Bw.inherits(wb,vb);var bb=wb;wb.blockSize=512,wb.outSize=224,wb.hmacStrength=192,wb.padLength=64,wb.prototype._digest=function(t){return"hex"===t?Bw.toHex32(this.h.slice(0,7),"big"):Bw.split32(this.h.slice(0,7),"big")};var Mb=Bw.rotr64_hi,kb=Bw.rotr64_lo,Ab=Bw.shr64_hi,Lb=Bw.shr64_lo,Eb=Bw.sum64,xb=Bw.sum64_hi,Nb=Bw.sum64_lo,Sb=Bw.sum64_4_hi,Ib=Bw.sum64_4_lo,Tb=Bw.sum64_5_hi,Cb=Bw.sum64_5_lo,jb=Ww.BlockHash,Db=[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 Ob(){if(!(this instanceof Ob))return new Ob;jb.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Db,this.W=new Array(160)}Bw.inherits(Ob,jb);var _b=Ob;function zb(t,e,n,r,i){var o=t&n^~t&i;return o<0&&(o+=4294967296),o}function Pb(t,e,n,r,i,o){var a=e&r^~e&o;return a<0&&(a+=4294967296),a}function Bb(t,e,n,r,i){var o=t&n^t&i^n&i;return o<0&&(o+=4294967296),o}function Rb(t,e,n,r,i,o){var a=e&r^e&o^r&o;return a<0&&(a+=4294967296),a}function Ub(t,e){var n=Mb(t,e,28)^Mb(e,t,2)^Mb(e,t,7);return n<0&&(n+=4294967296),n}function Wb(t,e){var n=kb(t,e,28)^kb(e,t,2)^kb(e,t,7);return n<0&&(n+=4294967296),n}function Qb(t,e){var n=Mb(t,e,14)^Mb(t,e,18)^Mb(e,t,9);return n<0&&(n+=4294967296),n}function Fb(t,e){var n=kb(t,e,14)^kb(t,e,18)^kb(e,t,9);return n<0&&(n+=4294967296),n}function Yb(t,e){var n=Mb(t,e,1)^Mb(t,e,8)^Ab(t,e,7);return n<0&&(n+=4294967296),n}function Hb(t,e){var n=kb(t,e,1)^kb(t,e,8)^Lb(t,e,7);return n<0&&(n+=4294967296),n}function Vb(t,e){var n=Mb(t,e,19)^Mb(e,t,29)^Ab(t,e,6);return n<0&&(n+=4294967296),n}function qb(t,e){var n=kb(t,e,19)^kb(e,t,29)^Lb(t,e,6);return n<0&&(n+=4294967296),n}function Gb(){if(!(this instanceof Gb))return new Gb;_b.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Ob.blockSize=1024,Ob.outSize=512,Ob.hmacStrength=192,Ob.padLength=128,Ob.prototype._prepareBlock=function(t,e){for(var n=this.W,r=0;r<32;r++)n[r]=t[e+r];for(;r<n.length;r+=2){var i=Vb(n[r-4],n[r-3]),o=qb(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=Yb(n[r-30],n[r-29]),c=Hb(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=Sb(i,o,a,s,u,c,l,h),n[r+1]=Ib(i,o,a,s,u,c,l,h)}},Ob.prototype._update=function(t,e){this._prepareBlock(t,e);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],m=this.h[12],g=this.h[13],y=this.h[14],v=this.h[15];cv(this.k.length===n.length);for(var w=0;w<n.length;w+=2){var b=y,M=v,k=Qb(h,d),A=Fb(h,d),L=zb(h,d,f,p,m),E=Pb(h,d,f,p,m,g),x=this.k[w],N=this.k[w+1],S=n[w],I=n[w+1],T=Tb(b,M,k,A,L,E,x,N,S,I),C=Cb(b,M,k,A,L,E,x,N,S,I);b=Ub(r,i),M=Wb(r,i),k=Bb(r,i,o,a,s),A=Rb(r,i,o,a,s,u);var j=xb(b,M,k,A),D=Nb(b,M,k,A);y=m,v=g,m=f,g=p,f=h,p=d,h=xb(c,l,T,C),d=Nb(l,l,T,C),c=s,l=u,s=o,u=a,o=r,a=i,r=xb(T,C,j,D),i=Nb(T,C,j,D)}Eb(this.h,0,r,i),Eb(this.h,2,o,a),Eb(this.h,4,s,u),Eb(this.h,6,c,l),Eb(this.h,8,h,d),Eb(this.h,10,f,p),Eb(this.h,12,m,g),Eb(this.h,14,y,v)},Ob.prototype._digest=function(t){return"hex"===t?Bw.toHex32(this.h,"big"):Bw.split32(this.h,"big")},Bw.inherits(Gb,_b);var Zb=Gb;Gb.blockSize=1024,Gb.outSize=384,Gb.hmacStrength=192,Gb.padLength=128,Gb.prototype._digest=function(t){return"hex"===t?Bw.toHex32(this.h.slice(0,12),"big"):Bw.split32(this.h.slice(0,12),"big")};var Jb={sha1:ob,sha224:bb,sha256:vb,sha384:Zb,sha512:_b},Xb=Bw.rotl32,Kb=Bw.sum32,$b=Bw.sum32_3,tM=Bw.sum32_4,eM=Ww.BlockHash;function nM(){if(!(this instanceof nM))return new nM;eM.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Bw.inherits(nM,eM);var rM=nM;function iM(t,e,n,r){return t<=15?e^n^r:t<=31?e&n|~e&r:t<=47?(e|~n)^r:t<=63?e&r|n&~r:e^(n|~r)}function oM(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function aM(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}nM.blockSize=512,nM.outSize=160,nM.hmacStrength=192,nM.padLength=64,nM.prototype._update=function(t,e){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=Kb(Xb(tM(n,iM(d,r,i,o),t[sM[d]+e],oM(d)),cM[d]),a);n=a,a=o,o=Xb(i,10),i=r,r=f,f=Kb(Xb(tM(s,iM(79-d,u,c,l),t[uM[d]+e],aM(d)),lM[d]),h),s=h,h=l,l=Xb(c,10),c=u,u=f}f=$b(this.h[1],i,l),this.h[1]=$b(this.h[2],o,h),this.h[2]=$b(this.h[3],a,s),this.h[3]=$b(this.h[4],n,u),this.h[4]=$b(this.h[0],r,c),this.h[0]=f},nM.prototype._digest=function(t){return"hex"===t?Bw.toHex32(this.h,"little"):Bw.split32(this.h,"little")};var sM=[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],uM=[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],cM=[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],lM=[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],hM={ripemd160:rM};function dM(t,e,n){if(!(this instanceof dM))return new dM(t,e,n);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(Bw.toArray(e,n))}var fM=dM;dM.prototype._init=function(t){t.length>this.blockSize&&(t=(new this.Hash).update(t).digest()),cv(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=(new this.Hash).update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=(new this.Hash).update(t)},dM.prototype.update=function(t,e){return this.inner.update(t,e),this},dM.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)};var pM=o((function(t,e){var n=e;n.utils=Bw,n.common=Ww,n.sha=Jb,n.ripemd=hM,n.hmac=fM,n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160})),mM=pM;function gM(t,e,n){return n={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&n.path)}},t(n,n.exports),n.exports}var yM=vM;function vM(t,e){if(!t)throw new Error(e||"Assertion failed")}vM.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)};var wM=gM((function(t,e){var n=e;function r(t){return 1===t.length?"0"+t:t}function i(t){for(var e="",n=0;n<t.length;n++)e+=r(t[n].toString(16));return e}n.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"!=typeof t){for(var r=0;r<t.length;r++)n[r]=0|t[r];return n}if("hex"===e){(t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t);for(r=0;r<t.length;r+=2)n.push(parseInt(t[r]+t[r+1],16))}else for(r=0;r<t.length;r++){var i=t.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(t,e){return"hex"===e?i(t):t}})),bM=gM((function(t,e){var n=e;n.assert=yM,n.toArray=wM.toArray,n.zero2=wM.zero2,n.toHex=wM.toHex,n.encode=wM.encode,n.getNAF=function(t,e,n){var r=new Array(Math.max(t.bitLength(),n)+1);r.fill(0);for(var i=1<<e+1,o=t.clone(),a=0;a<r.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var r,i=0,o=0;t.cmpn(-i)>0||e.cmpn(-o)>0;){var a,s,u=t.andln(3)+i&3,c=e.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(r=t.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!==(r=e.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},n.cachedProperty=function(t,e,n){var r="_"+e;t.prototype[e]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new kp(t,"hex","le")}})),MM=bM.getNAF,kM=bM.getJSF,AM=bM.assert;function LM(t,e){this.type=t,this.p=new kp(e.p,16),this.red=e.prime?kp.red(e.prime):kp.mont(this.p),this.zero=new kp(0).toRed(this.red),this.one=new kp(1).toRed(this.red),this.two=new kp(2).toRed(this.red),this.n=e.n&&new kp(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.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 EM=LM;function xM(t,e){this.curve=t,this.type=e,this.precomputed=null}LM.prototype.point=function(){throw new Error("Not implemented")},LM.prototype.validate=function(){throw new Error("Not implemented")},LM.prototype._fixedNafMul=function(t,e){AM(t.precomputed);var n=t._getDoubles(),r=MM(e,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var o,a,s=[];for(o=0;o<r.length;o+=n.step){a=0;for(var u=o+n.step-1;u>=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o<s.length;o++)(a=s[o])===h?l=l.mixedAdd(n.points[o]):a===-h&&(l=l.mixedAdd(n.points[o].neg()));c=c.add(l)}return c.toP()},LM.prototype._wnafMul=function(t,e){var n=4,r=t._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=MM(e,n,this._bitLength),a=this.jpoint(null,null,null),s=o.length-1;s>=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];AM(0!==c),a="affine"===t.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===t.type?a.toP():a},LM.prototype._wnafMulAdd=function(t,e,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o<r;o++){var d=(s=e[o])._getNAFPoints(t);u[o]=d.wnd,c[o]=d.points}for(o=r-1;o>=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var m=[e[f],null,null,e[p]];0===e[f].y.cmp(e[p].y)?(m[1]=e[f].add(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg())):0===e[f].y.cmp(e[p].y.redNeg())?(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].add(e[p].neg())):(m[1]=e[f].toJ().mixedAdd(e[p]),m[2]=e[f].toJ().mixedAdd(e[p].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],y=kM(n[f],n[p]);for(h=Math.max(y[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a<h;a++){var v=0|y[0][a],w=0|y[1][a];l[f][a]=g[3*(v+1)+(w+1)],l[p][a]=0,c[f]=m}}else l[f]=MM(n[f],u[f],this._bitLength),l[p]=MM(n[p],u[p],this._bitLength),h=Math.max(l[f].length,h),h=Math.max(l[p].length,h)}var b=this.jpoint(null,null,null),M=this._wnafT4;for(o=h;o>=0;o--){for(var k=0;o>=0;){var A=!0;for(a=0;a<r;a++)M[a]=0|l[a][o],0!==M[a]&&(A=!1);if(!A)break;k++,o--}if(o>=0&&k++,b=b.dblp(k),o<0)break;for(a=0;a<r;a++){var L=M[a];0!==L&&(L>0?s=c[a][L-1>>1]:L<0&&(s=c[a][-L-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o<r;o++)c[o]=null;return i?b:b.toP()},LM.BasePoint=xM,xM.prototype.eq=function(){throw new Error("Not implemented")},xM.prototype.validate=function(){return this.curve.validate(this)},LM.prototype.decodePoint=function(t,e){t=bM.toArray(t,e);var n=this.p.byteLength();if((4===t[0]||6===t[0]||7===t[0])&&t.length-1==2*n)return 6===t[0]?AM(t[t.length-1]%2==0):7===t[0]&&AM(t[t.length-1]%2==1),this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));if((2===t[0]||3===t[0])&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),3===t[0]);throw new Error("Unknown point format")},xM.prototype.encodeCompressed=function(t){return this.encode(t,!0)},xM.prototype._encode=function(t){var e=this.curve.p.byteLength(),n=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",e))},xM.prototype.encode=function(t,e){return bM.encode(this._encode(e),t)},xM.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},xM.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return!!e&&e.points.length>=Math.ceil((t.bitLength()+1)/e.step)},xM.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<e;i+=t){for(var o=0;o<t;o++)r=r.dbl();n.push(r)}return{step:t,points:n}},xM.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],n=(1<<t)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)e[i]=e[i-1].add(r);return{wnd:t,points:e}},xM.prototype._getBeta=function(){return null},xM.prototype.dblp=function(t){for(var e=this,n=0;n<t;n++)e=e.dbl();return e};var NM=gM((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}})),SM=bM.assert;function IM(t){EM.call(this,"short",t),this.a=new kp(t.a,16).toRed(this.red),this.b=new kp(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}NM(IM,EM);var TM=IM;function CM(t,e,n,r){EM.BasePoint.call(this,t,"affine"),null===e&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new kp(e,16),this.y=new kp(n,16),r&&(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)}function jM(t,e,n,r){EM.BasePoint.call(this,t,"jacobian"),null===e&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new kp(0)):(this.x=new kp(e,16),this.y=new kp(n,16),this.z=new kp(r,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}IM.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,n,r;if(t.beta)e=new kp(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=(e=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(t.lambda)n=new kp(t.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(e))?n=o[0]:(n=o[1],SM(0===this.g.mul(n).x.cmp(this.g.x.redMul(e))))}return r=t.basis?t.basis.map((function(t){return{a:new kp(t.a,16),b:new kp(t.b,16)}})):this._getEndoBasis(n),{beta:e,lambda:n,basis:r}}},IM.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:kp.mont(t),n=new kp(2).toRed(e).redInvm(),r=n.redNeg(),i=new kp(3).toRed(e).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},IM.prototype._getEndoBasis=function(t){for(var e,n,r,i,o,a,s,u,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=t,d=this.n.clone(),f=new kp(1),p=new kp(0),m=new kp(0),g=new kp(1),y=0;0!==h.cmpn(0);){var v=d.div(h);u=d.sub(v.mul(h)),c=m.sub(v.mul(f));var w=g.sub(v.mul(p));if(!r&&u.cmp(l)<0)e=s.neg(),n=f,r=u.neg(),i=c;else if(r&&2==++y)break;s=u,d=h,h=u,m=f,f=c,g=p,p=w}o=u.neg(),a=c;var b=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(b)>=0&&(o=e,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},IM.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],r=e[1],i=r.b.mul(t).divRound(this.n),o=n.b.neg().mul(t).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:t.sub(a).sub(s),k2:u.add(c).neg()}},IM.prototype.pointFromX=function(t,e){(t=new kp(t,16)).red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(e&&!i||!e&&i)&&(r=r.redNeg()),this.point(t,r)},IM.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,r=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},IM.prototype._endoWnafMulAdd=function(t,e,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<t.length;o++){var a=this._endoSplit(e[o]),s=t[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return c},NM(CM,EM.BasePoint),IM.prototype.point=function(t,e,n){return new CM(this,t,e,n)},IM.prototype.pointFromJSON=function(t,e){return CM.fromJSON(this,t,e)},CM.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,r=function(t){return n.point(t.x.redMul(n.endo.beta),t.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(r)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(r)}}}return e}},CM.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]},CM.fromJSON=function(t,e,n){"string"==typeof e&&(e=JSON.parse(e));var r=t.point(e[0],e[1],n);if(!e[2])return r;function i(e){return t.point(e[0],e[1],n)}var o=e[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},CM.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)+">"},CM.prototype.isInfinity=function(){return this.inf},CM.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(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),r=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},CM.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),r=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},CM.prototype.getX=function(){return this.x.fromRed()},CM.prototype.getY=function(){return this.y.fromRed()},CM.prototype.mul=function(t){return t=new kp(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)},CM.prototype.mulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},CM.prototype.jmulAdd=function(t,e,n){var r=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},CM.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},CM.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,r=function(t){return t.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return e},CM.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},NM(jM,EM.BasePoint),IM.prototype.jpoint=function(t,e,n){return new jM(this,t,e,n)},jM.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),r=this.y.redMul(e).redMul(t);return this.curve.point(n,r)},jM.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},jM.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(e),i=t.x.redMul(n),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,f,p)},jM.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,r=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},jM.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e<t;e++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(e=0;e<t;e++){var l=o.redSqr(),h=c.redSqr(),d=h.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),p=o.redMul(h),m=f.redSqr().redISub(p.redAdd(p)),g=p.redISub(m),y=f.redMul(g);y=y.redIAdd(y).redISub(d);var v=c.redMul(s);e+1<t&&(u=u.redMul(d)),o=m,s=v,c=y}return this.curve.jpoint(o,c.redMul(i),s)},jM.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},jM.prototype._zeroDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=u,e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),f=this.x.redAdd(h).redSqr().redISub(l).redISub(d);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),m=p.redSqr(),g=d.redIAdd(d);g=(g=g.redIAdd(g)).redIAdd(g),t=m.redISub(f).redISub(f),e=p.redMul(f.redISub(t)).redISub(g),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(t,e,n)},jM.prototype._threeDbl=function(){var t,e,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);t=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=d.redIAdd(d),m=(p=p.redIAdd(p)).redAdd(p);t=f.redSqr().redISub(m),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var g=h.redSqr();g=(g=(g=g.redIAdd(g)).redIAdd(g)).redIAdd(g),e=f.redMul(p.redISub(t)).redISub(g)}return this.curve.jpoint(t,e,n)},jM.prototype._dbl=function(){var t=this.curve.a,e=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=e.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(t.redMul(i)),u=e.redAdd(e),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),h=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=s.redMul(h).redISub(d),p=n.redAdd(n).redMul(r);return this.curve.jpoint(l,f,p)},jM.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr(),r=e.redSqr(),i=t.redAdd(t).redIAdd(t),o=i.redSqr(),a=this.x.redAdd(e).redSqr().redISub(t).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=e.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.x.redMul(s).redISub(l);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(h,d,f)},jM.prototype.mul=function(t,e){return t=new kp(t,e),this.curve._wnafMul(this,t)},jM.prototype.eq=function(t){if("affine"===t.type)return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),n=t.z.redSqr();if(0!==this.x.redMul(n).redISub(t.x.redMul(e)).cmpn(0))return!1;var r=e.redMul(this.z),i=n.redMul(t.z);return 0===this.y.redMul(i).redISub(t.y.redMul(r)).cmpn(0)},jM.prototype.eqXToP=function(t){var e=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(e);if(0===this.x.cmp(n))return!0;for(var r=t.clone(),i=this.curve.redN.redMul(e);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},jM.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)+">"},jM.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var DM=gM((function(t,e){var n=e;n.base=EM,n.short=TM,n.mont=null,n.edwards=null})),OM=gM((function(t,e){var n,r=e,i=bM.assert;function o(t){"short"===t.type?this.curve=new DM.short(t):"edwards"===t.type?this.curve=new DM.edwards(t):this.curve=new DM.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new o(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("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:mM.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("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:mM.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("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:mM.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("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:mM.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"]}),a("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:mM.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"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:mM.sha256,gRed:!1,g:["9"]}),a("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:mM.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(t){n=void 0}a("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:mM.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function _M(t){if(!(this instanceof _M))return new _M(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=wM.toArray(t.entropy,t.entropyEnc||"hex"),n=wM.toArray(t.nonce,t.nonceEnc||"hex"),r=wM.toArray(t.pers,t.persEnc||"hex");yM(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,n,r)}var zM=_M;_M.prototype._init=function(t,e,n){var r=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},_M.prototype._hmac=function(){return new mM.hmac(this.hash,this.K)},_M.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.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())},_M.prototype.reseed=function(t,e,n,r){"string"!=typeof e&&(r=n,n=e,e=null),t=wM.toArray(t,e),n=wM.toArray(n,r),yM(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},_M.prototype.generate=function(t,e,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(r=n,n=e,e=null),n&&(n=wM.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<t;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,t);return this._update(n),this._reseed++,wM.encode(o,e)};var PM=bM.assert;function BM(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var RM=BM;BM.fromPublic=function(t,e,n){return e instanceof BM?e:new BM(t,{pub:e,pubEnc:n})},BM.fromPrivate=function(t,e,n){return e instanceof BM?e:new BM(t,{priv:e,privEnc:n})},BM.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"}},BM.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},BM.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},BM.prototype._importPrivate=function(t,e){this.priv=new kp(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},BM.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?PM(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||PM(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},BM.prototype.derive=function(t){return t.validate()||PM(t.validate(),"public point not validated"),t.mul(this.priv).getX()},BM.prototype.sign=function(t,e,n){return this.ec.sign(t,this,e,n)},BM.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},BM.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var UM=bM.assert;function WM(t,e){if(t instanceof WM)return t;this._importDER(t,e)||(UM(t.r&&t.s,"Signature without r or s"),this.r=new kp(t.r,16),this.s=new kp(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var QM=WM;function FM(){this.place=0}function YM(t,e){var n=t[e.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=e.place;o<r;o++,a++)i<<=8,i|=t[a],i>>>=0;return!(i<=127)&&(e.place=a,i)}function HM(t){for(var e=0,n=t.length-1;!t[e]&&!(128&t[e+1])&&e<n;)e++;return 0===e?t:t.slice(e)}function VM(t,e){if(e<128)t.push(e);else{var n=1+(Math.log(e)/Math.LN2>>>3);for(t.push(128|n);--n;)t.push(e>>>(n<<3)&255);t.push(e)}}WM.prototype._importDER=function(t,e){t=bM.toArray(t,e);var n=new FM;if(48!==t[n.place++])return!1;var r=YM(t,n);if(!1===r)return!1;if(r+n.place!==t.length)return!1;if(2!==t[n.place++])return!1;var i=YM(t,n);if(!1===i)return!1;var o=t.slice(n.place,i+n.place);if(n.place+=i,2!==t[n.place++])return!1;var a=YM(t,n);if(!1===a)return!1;if(t.length!==a+n.place)return!1;var s=t.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new kp(o),this.s=new kp(s),this.recoveryParam=null,!0},WM.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&n[0]&&(n=[0].concat(n)),e=HM(e),n=HM(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];VM(r,e.length),(r=r.concat(e)).push(2),VM(r,n.length);var i=r.concat(n),o=[48];return VM(o,i.length),o=o.concat(i),bM.encode(o,t)};var qM=function(){throw new Error("unsupported")},GM=bM.assert;function ZM(t){if(!(this instanceof ZM))return new ZM(t);"string"==typeof t&&(GM(Object.prototype.hasOwnProperty.call(OM,t),"Unknown curve "+t),t=OM[t]),t instanceof OM.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var JM=ZM;ZM.prototype.keyPair=function(t){return new RM(this,t)},ZM.prototype.keyFromPrivate=function(t,e){return RM.fromPrivate(this,t,e)},ZM.prototype.keyFromPublic=function(t,e){return RM.fromPublic(this,t,e)},ZM.prototype.genKeyPair=function(t){t||(t={});for(var e=new zM({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||qM(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new kp(2));;){var i=new kp(e.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},ZM.prototype._truncateToN=function(t,e){var n=8*t.byteLength()-this.n.bitLength();return n>0&&(t=t.ushrn(n)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},ZM.prototype.sign=function(t,e,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),e=this.keyFromPrivate(e,n),t=this._truncateToN(new kp(t,16));for(var i=this.n.byteLength(),o=e.getPrivate().toArray("be",i),a=t.toArray("be",i),s=new zM({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new kp(1)),c=0;;c++){var l=r.k?r.k(c):new kp(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(e.getPrivate()).iadd(t));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new QM({r:f,s:p,recoveryParam:m})}}}}}},ZM.prototype.verify=function(t,e,n,r){t=this._truncateToN(new kp(t,16)),n=this.keyFromPublic(n,r);var i=(e=new QM(e,"hex")).r,o=e.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(t).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},ZM.prototype.recoverPubKey=function(t,e,n,r){GM((3&n)===n,"The recovery param is more than two bits"),e=new QM(e,r);var i=this.n,o=new kp(t),a=e.r,s=e.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=e.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},ZM.prototype.getKeyRecoveryParam=function(t,e,n,r){if(null!==(e=new QM(e,r)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var XM=gM((function(t,e){var n=e;n.version="6.5.4",n.utils=bM,n.rand=function(){throw new Error("unsupported")},n.curve=DM,n.curves=OM,n.ec=JM,n.eddsa=null})).ec;const KM=new jp("signing-key/5.7.0");let $M=null;function tk(){return $M||($M=new XM("secp256k1")),$M}class ek{constructor(t){Am(this,"curve","secp256k1"),Am(this,"privateKey",Yp(t)),32!==Hp(this.privateKey)&&KM.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const e=tk().keyFromPrivate(Rp(this.privateKey));Am(this,"publicKey","0x"+e.getPublic(!1,"hex")),Am(this,"compressedPublicKey","0x"+e.getPublic(!0,"hex")),Am(this,"_isSigningKey",!0)}_addPoint(t){const e=tk().keyFromPublic(Rp(this.publicKey)),n=tk().keyFromPublic(Rp(t));return"0x"+e.pub.add(n.pub).encodeCompressed("hex")}signDigest(t){const e=tk().keyFromPrivate(Rp(this.privateKey)),n=Rp(t);32!==n.length&&KM.throwArgumentError("bad digest length","digest",t);const r=e.sign(n,{canonical:!0});return Jp({recoveryParam:r.recoveryParam,r:Zp("0x"+r.r.toString(16),32),s:Zp("0x"+r.s.toString(16),32)})}computeSharedSecret(t){const e=tk().keyFromPrivate(Rp(this.privateKey)),n=tk().keyFromPublic(Rp(nk(t)));return Zp("0x"+e.derive(n.getPublic()).toString(16),32)}static isSigningKey(t){return!(!t||!t._isSigningKey)}}function nk(t,e){const n=Rp(t);if(32===n.length){const t=new ek(n);return e?"0x"+tk().keyFromPrivate(n).getPublic(!0,"hex"):t.publicKey}return 33===n.length?e?Yp(n):"0x"+tk().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?e?"0x"+tk().keyFromPublic(n).getPublic(!0,"hex"):Yp(n):KM.throwArgumentError("invalid public or private key","key","[REDACTED]")}const rk=new jp("transactions/5.7.0");var ik;function ok(t){return"0x"===t?null:Mg(t)}function ak(t){return"0x"===t?_g:rm.from(t)}function sk(t,e){return function(t){return Mg(Vp(ug(Vp(nk(t),1)),12))}(function(t,e){const n=Jp(e),r={r:Rp(n.r),s:Rp(n.s)};return"0x"+tk().recoverPubKey(Rp(t),r,n.recoveryParam).encode("hex",!1)}(Rp(t),e))}function uk(t,e){const n=Wp(rm.from(t).toHexString());return n.length>32&&rk.throwArgumentError("invalid length for "+e,"transaction:"+e,t),n}function ck(t,e){return{address:Mg(t),storageKeys:(e||[]).map(((e,n)=>(32!==Hp(e)&&rk.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,e),e.toLowerCase())))}}function lk(t){if(Array.isArray(t))return t.map(((t,e)=>Array.isArray(t)?(t.length>2&&rk.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${e}]`,t),ck(t[0],t[1])):ck(t.address,t.storageKeys)));const e=Object.keys(t).map((e=>{const n=t[e].reduce(((t,e)=>(t[e]=!0,t)),{});return ck(e,Object.keys(n).sort())}));return e.sort(((t,e)=>t.address.localeCompare(e.address))),e}function hk(t){return lk(t).map((t=>[t.address,t.storageKeys]))}function dk(t,e){if(null!=t.gasPrice){const e=rm.from(t.gasPrice),n=rm.from(t.maxFeePerGas||0);e.eq(n)||rk.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:e,maxFeePerGas:n})}const n=[uk(t.chainId||0,"chainId"),uk(t.nonce||0,"nonce"),uk(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),uk(t.maxFeePerGas||0,"maxFeePerGas"),uk(t.gasLimit||0,"gasLimit"),null!=t.to?Mg(t.to):"0x",uk(t.value||0,"value"),t.data||"0x",hk(t.accessList||[])];if(e){const t=Jp(e);n.push(uk(t.recoveryParam,"recoveryParam")),n.push(Wp(t.r)),n.push(Wp(t.s))}return qp(["0x02",fg(n)])}function fk(t,e){const n=[uk(t.chainId||0,"chainId"),uk(t.nonce||0,"nonce"),uk(t.gasPrice||0,"gasPrice"),uk(t.gasLimit||0,"gasLimit"),null!=t.to?Mg(t.to):"0x",uk(t.value||0,"value"),t.data||"0x",hk(t.accessList||[])];if(e){const t=Jp(e);n.push(uk(t.recoveryParam,"recoveryParam")),n.push(Wp(t.r)),n.push(Wp(t.s))}return qp(["0x01",fg(n)])}function pk(t,e,n){try{const n=ak(e[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");t.v=n}catch(t){rk.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=Zp(e[1],32),t.s=Zp(e[2],32);try{const e=ug(n(t));t.from=sk(e,{r:t.r,s:t.s,recoveryParam:t.v})}catch(t){}}function mk(t){const e=Rp(t);if(e[0]>127)return function(t){const e=gg(t);9!==e.length&&6!==e.length&&rk.throwArgumentError("invalid raw transaction","rawTransaction",t);const n={nonce:ak(e[0]).toNumber(),gasPrice:ak(e[1]),gasLimit:ak(e[2]),to:ok(e[3]),value:ak(e[4]),data:e[5],chainId:0};if(6===e.length)return n;try{n.v=rm.from(e[6]).toNumber()}catch(t){return n}if(n.r=Zp(e[7],32),n.s=Zp(e[8],32),rm.from(n.r).isZero()&&rm.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 r=n.v-27;const i=e.slice(0,6);0!==n.chainId&&(i.push(Yp(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);const o=ug(fg(i));try{n.from=sk(o,{r:Yp(n.r),s:Yp(n.s),recoveryParam:r})}catch(t){}n.hash=ug(t)}return n.type=null,n}(e);switch(e[0]){case 1:return function(t){const e=gg(t.slice(1));8!==e.length&&11!==e.length&&rk.throwArgumentError("invalid component count for transaction type: 1","payload",Yp(t));const n={type:1,chainId:ak(e[0]).toNumber(),nonce:ak(e[1]).toNumber(),gasPrice:ak(e[2]),gasLimit:ak(e[3]),to:ok(e[4]),value:ak(e[5]),data:e[6],accessList:lk(e[7])};return 8===e.length||(n.hash=ug(t),pk(n,e.slice(8),fk)),n}(e);case 2:return function(t){const e=gg(t.slice(1));9!==e.length&&12!==e.length&&rk.throwArgumentError("invalid component count for transaction type: 2","payload",Yp(t));const n=ak(e[2]),r=ak(e[3]),i={type:2,chainId:ak(e[0]).toNumber(),nonce:ak(e[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:ak(e[4]),to:ok(e[5]),value:ak(e[6]),data:e[7],accessList:lk(e[8])};return 9===e.length||(i.hash=ug(t),pk(i,e.slice(9),dk)),i}(e)}return rk.throwError(`unsupported transaction type: ${e[0]}`,jp.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}!function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"}(ik||(ik={}));var gk=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const yk=new jp("contracts/5.7.0");function vk(t,e){return gk(this,void 0,void 0,(function*(){const n=yield e;"string"!=typeof n&&yk.throwArgumentError("invalid address or ENS name","name",n);try{return Mg(n)}catch(t){}t||yk.throwError("a provider or signer is needed to resolve ENS names",jp.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield t.resolveName(n);return null==r&&yk.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r}))}function wk(t,e,n){return gk(this,void 0,void 0,(function*(){return Array.isArray(n)?yield Promise.all(n.map(((n,r)=>wk(t,Array.isArray(e)?e[r]:e[n.name],n)))):"address"===n.type?yield vk(t,e):"tuple"===n.type?yield wk(t,e,n.components):"array"===n.baseType?Array.isArray(e)?yield Promise.all(e.map((e=>wk(t,e,n.arrayChildren)))):Promise.reject(yk.makeError("invalid value for array",jp.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e}))}function bk(t,e,n){return gk(this,void 0,void 0,(function*(){let r={};n.length===e.inputs.length+1&&"object"==typeof n[n.length-1]&&(r=xm(n.pop())),yk.checkArgumentCount(n.length,e.inputs.length,"passed to contract"),t.signer?r.from?r.from=Em({override:vk(t.signer,r.from),signer:t.signer.getAddress()}).then((t=>gk(this,void 0,void 0,(function*(){return Mg(t.signer)!==t.override&&yk.throwError("Contract with a Signer cannot override from",jp.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),t.override})))):r.from=t.signer.getAddress():r.from&&(r.from=vk(t.provider,r.from));const i=yield Em({args:wk(t.signer||t.provider,n,e.inputs),address:t.resolvedAddress,overrides:Em(r)||{}}),o=t.interface.encodeFunctionData(e,i.args),a={data:o,to:i.address},s=i.overrides;if(null!=s.nonce&&(a.nonce=rm.from(s.nonce).toNumber()),null!=s.gasLimit&&(a.gasLimit=rm.from(s.gasLimit)),null!=s.gasPrice&&(a.gasPrice=rm.from(s.gasPrice)),null!=s.maxFeePerGas&&(a.maxFeePerGas=rm.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=rm.from(s.maxPriorityFeePerGas)),null!=s.from&&(a.from=s.from),null!=s.type&&(a.type=s.type),null!=s.accessList&&(a.accessList=lk(s.accessList)),null==a.gasLimit&&null!=e.gas){let t=21e3;const n=Rp(o);for(let e=0;e<n.length;e++)t+=4,n[e]&&(t+=64);a.gasLimit=rm.from(e.gas).add(t)}if(s.value){const t=rm.from(s.value);t.isZero()||e.payable||yk.throwError("non-payable method cannot override value",jp.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:r.value}),a.value=t}s.customData&&(a.customData=xm(s.customData)),s.ccipReadEnabled&&(a.ccipReadEnabled=!!s.ccipReadEnabled),delete r.nonce,delete r.gasLimit,delete r.gasPrice,delete r.from,delete r.value,delete r.type,delete r.accessList,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.customData,delete r.ccipReadEnabled;const u=Object.keys(r).filter((t=>null!=r[t]));return u.length&&yk.throwError(`cannot override ${u.map((t=>JSON.stringify(t))).join(",")}`,jp.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),a}))}function Mk(t,e,n){const r=t.signer||t.provider;return function(...i){return gk(this,void 0,void 0,(function*(){let o;if(i.length===e.inputs.length+1&&"object"==typeof i[i.length-1]){const t=xm(i.pop());null!=t.blockTag&&(o=yield t.blockTag),delete t.blockTag,i.push(t)}null!=t.deployTransaction&&(yield t._deployed(o));const a=yield bk(t,e,i),s=yield r.call(a,o);try{let r=t.interface.decodeFunctionResult(e,s);return n&&1===e.outputs.length&&(r=r[0]),r}catch(e){throw e.code===jp.errors.CALL_EXCEPTION&&(e.address=t.address,e.args=i,e.transaction=a),e}}))}}function kk(t,e){return function(...n){return gk(this,void 0,void 0,(function*(){t.signer||yk.throwError("sending a transaction requires a signer",jp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=t.deployTransaction&&(yield t._deployed());const r=yield bk(t,e,n),i=yield t.signer.sendTransaction(r);return function(t,e){const n=e.wait.bind(e);e.wait=e=>n(e).then((e=>(e.events=e.logs.map((n=>{let r=Tm(n),i=null;try{i=t.interface.parseLog(n)}catch(t){}return i&&(r.args=i.args,r.decode=(e,n)=>t.interface.decodeEventLog(i.eventFragment,e,n),r.event=i.name,r.eventSignature=i.signature),r.removeListener=()=>t.provider,r.getBlock=()=>t.provider.getBlock(e.blockHash),r.getTransaction=()=>t.provider.getTransaction(e.transactionHash),r.getTransactionReceipt=()=>Promise.resolve(e),r})),e)))}(t,i),i}))}}function Ak(t,e,n){return e.constant?Mk(t,e,n):kk(t,e)}function Lk(t){return!t.address||null!=t.topics&&0!==t.topics.length?(t.address||"*")+"@"+(t.topics?t.topics.map((t=>Array.isArray(t)?t.join("|"):t)).join(":"):""):"*"}class Ek{constructor(t,e){Am(this,"tag",t),Am(this,"filter",e),this._listeners=[]}addListener(t,e){this._listeners.push({listener:t,once:e})}removeListener(t){let e=!1;this._listeners=this._listeners.filter((n=>!(!e&&n.listener===t)||(e=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((t=>t.listener))}listenerCount(){return this._listeners.length}run(t){const e=this.listenerCount();return this._listeners=this._listeners.filter((e=>{const n=t.slice();return setTimeout((()=>{e.listener.apply(this,n)}),0),!e.once})),e}prepareEvent(t){}getEmit(t){return[t]}}class xk extends Ek{constructor(){super("error",null)}}class Nk extends Ek{constructor(t,e,n,r){const i={address:t};let o=e.getEventTopic(n);r?(o!==r[0]&&yk.throwArgumentError("topic mismatch","topics",r),i.topics=r.slice()):i.topics=[o],super(Lk(i),i),Am(this,"address",t),Am(this,"interface",e),Am(this,"fragment",n)}prepareEvent(t){super.prepareEvent(t),t.event=this.fragment.name,t.eventSignature=this.fragment.format(),t.decode=(t,e)=>this.interface.decodeEventLog(this.fragment,t,e);try{t.args=this.interface.decodeEventLog(this.fragment,t.data,t.topics)}catch(e){t.args=null,t.decodeError=e}}getEmit(t){const e=function(t){const e=[],n=function(t,r){if(Array.isArray(r))for(let i in r){const o=t.slice();o.push(i);try{n(o,r[i])}catch(t){e.push({path:o,error:t})}}};return n([],t),e}(t.args);if(e.length)throw e[0].error;const n=(t.args||[]).slice();return n.push(t),n}}class Sk extends Ek{constructor(t,e){super("*",{address:t}),Am(this,"address",t),Am(this,"interface",e)}prepareEvent(t){super.prepareEvent(t);try{const e=this.interface.parseLog(t);t.event=e.name,t.eventSignature=e.signature,t.decode=(t,n)=>this.interface.decodeEventLog(e.eventFragment,t,n),t.args=e.args}catch(t){}}}class Ik{constructor(t,e,n){Am(this,"interface",Lm(new.target,"getInterface")(e)),null==n?(Am(this,"provider",null),Am(this,"signer",null)):sv.isSigner(n)?(Am(this,"provider",n.provider||null),Am(this,"signer",n)):nv.isProvider(n)?(Am(this,"provider",n),Am(this,"signer",null)):yk.throwArgumentError("invalid signer or provider","signerOrProvider",n),Am(this,"callStatic",{}),Am(this,"estimateGas",{}),Am(this,"functions",{}),Am(this,"populateTransaction",{}),Am(this,"filters",{});{const t={};Object.keys(this.interface.events).forEach((e=>{const n=this.interface.events[e];Am(this.filters,e,((...t)=>({address:this.address,topics:this.interface.encodeFilterTopics(n,t)}))),t[n.name]||(t[n.name]=[]),t[n.name].push(e)})),Object.keys(t).forEach((e=>{const n=t[e];1===n.length?Am(this.filters,e,this.filters[n[0]]):yk.warn(`Duplicate definition of ${e} (${n.join(", ")})`)}))}if(Am(this,"_runningEvents",{}),Am(this,"_wrappedEmits",{}),null==t&&yk.throwArgumentError("invalid contract address or ENS name","addressOrName",t),Am(this,"address",t),this.provider)Am(this,"resolvedAddress",vk(this.provider,t));else try{Am(this,"resolvedAddress",Promise.resolve(Mg(t)))}catch(t){yk.throwError("provider is required to use ENS name as contract address",jp.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((t=>{}));const r={},i={};Object.keys(this.interface.functions).forEach((t=>{const e=this.interface.functions[t];if(i[t])yk.warn(`Duplicate ABI entry for ${JSON.stringify(t)}`);else{i[t]=!0;{const n=e.name;r[`%${n}`]||(r[`%${n}`]=[]),r[`%${n}`].push(t)}null==this[t]&&Am(this,t,Ak(this,e,!0)),null==this.functions[t]&&Am(this.functions,t,Ak(this,e,!1)),null==this.callStatic[t]&&Am(this.callStatic,t,Mk(this,e,!0)),null==this.populateTransaction[t]&&Am(this.populateTransaction,t,function(t,e){return function(...n){return bk(t,e,n)}}(this,e)),null==this.estimateGas[t]&&Am(this.estimateGas,t,function(t,e){const n=t.signer||t.provider;return function(...r){return gk(this,void 0,void 0,(function*(){n||yk.throwError("estimate require a provider or signer",jp.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield bk(t,e,r);return yield n.estimateGas(i)}))}}(this,e))}})),Object.keys(r).forEach((t=>{const e=r[t];if(e.length>1)return;t=t.substring(1);const n=e[0];try{null==this[t]&&Am(this,t,this[n])}catch(t){}null==this.functions[t]&&Am(this.functions,t,this.functions[n]),null==this.callStatic[t]&&Am(this.callStatic,t,this.callStatic[n]),null==this.populateTransaction[t]&&Am(this.populateTransaction,t,this.populateTransaction[n]),null==this.estimateGas[t]&&Am(this.estimateGas,t,this.estimateGas[n])}))}static getContractAddress(t){return kg(t)}static getInterface(t){return Ky.isInterface(t)?t:new Ky(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((t=>("0x"===t&&yk.throwError("contract not deployed",jp.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(t){this.signer||yk.throwError("sending a transactions require a signer",jp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const e=xm(t||{});return["from","to"].forEach((function(t){null!=e[t]&&yk.throwError("cannot override "+t,jp.errors.UNSUPPORTED_OPERATION,{operation:t})})),e.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(e)))}connect(t){"string"==typeof t&&(t=new uv(t,this.provider));const e=new this.constructor(this.address,this.interface,t);return this.deployTransaction&&Am(e,"deployTransaction",this.deployTransaction),e}attach(t){return new this.constructor(t,this.interface,this.signer||this.provider)}static isIndexed(t){return Zy.isIndexed(t)}_normalizeRunningEvent(t){return this._runningEvents[t.tag]?this._runningEvents[t.tag]:t}_getRunningEvent(t){if("string"==typeof t){if("error"===t)return this._normalizeRunningEvent(new xk);if("event"===t)return this._normalizeRunningEvent(new Ek("event",null));if("*"===t)return this._normalizeRunningEvent(new Sk(this.address,this.interface));const e=this.interface.getEvent(t);return this._normalizeRunningEvent(new Nk(this.address,this.interface,e))}if(t.topics&&t.topics.length>0){try{const e=t.topics[0];if("string"!=typeof e)throw new Error("invalid topic");const n=this.interface.getEvent(e);return this._normalizeRunningEvent(new Nk(this.address,this.interface,n,t.topics))}catch(t){}const e={address:this.address,topics:t.topics};return this._normalizeRunningEvent(new Ek(Lk(e),e))}return this._normalizeRunningEvent(new Sk(this.address,this.interface))}_checkRunningEvents(t){if(0===t.listenerCount()){delete this._runningEvents[t.tag];const e=this._wrappedEmits[t.tag];e&&t.filter&&(this.provider.off(t.filter,e),delete this._wrappedEmits[t.tag])}}_wrapEvent(t,e,n){const r=Tm(e);return r.removeListener=()=>{n&&(t.removeListener(n),this._checkRunningEvents(t))},r.getBlock=()=>this.provider.getBlock(e.blockHash),r.getTransaction=()=>this.provider.getTransaction(e.transactionHash),r.getTransactionReceipt=()=>this.provider.getTransactionReceipt(e.transactionHash),t.prepareEvent(r),r}_addEventListener(t,e,n){if(this.provider||yk.throwError("events require a provider or a signer with a provider",jp.errors.UNSUPPORTED_OPERATION,{operation:"once"}),t.addListener(e,n),this._runningEvents[t.tag]=t,!this._wrappedEmits[t.tag]){const n=n=>{let r=this._wrapEvent(t,n,e);if(null==r.decodeError)try{const e=t.getEmit(r);this.emit(t.filter,...e)}catch(t){r.decodeError=t.error}null!=t.filter&&this.emit("event",r),null!=r.decodeError&&this.emit("error",r.decodeError,r)};this._wrappedEmits[t.tag]=n,null!=t.filter&&this.provider.on(t.filter,n)}}queryFilter(t,e,n){const r=this._getRunningEvent(t),i=xm(r.filter);return"string"==typeof e&&Qp(e,32)?(null!=n&&yk.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),i.blockHash=e):(i.fromBlock=null!=e?e:0,i.toBlock=null!=n?n:"latest"),this.provider.getLogs(i).then((t=>t.map((t=>this._wrapEvent(r,t,null)))))}on(t,e){return this._addEventListener(this._getRunningEvent(t),e,!1),this}once(t,e){return this._addEventListener(this._getRunningEvent(t),e,!0),this}emit(t,...e){if(!this.provider)return!1;const n=this._getRunningEvent(t),r=n.run(e)>0;return this._checkRunningEvents(n),r}listenerCount(t){return this.provider?null==t?Object.keys(this._runningEvents).reduce(((t,e)=>t+this._runningEvents[e].listenerCount()),0):this._getRunningEvent(t).listenerCount():0}listeners(t){if(!this.provider)return[];if(null==t){const t=[];for(let e in this._runningEvents)this._runningEvents[e].listeners().forEach((e=>{t.push(e)}));return t}return this._getRunningEvent(t).listeners()}removeAllListeners(t){if(!this.provider)return this;if(null==t){for(const t in this._runningEvents){const e=this._runningEvents[t];e.removeAllListeners(),this._checkRunningEvents(e)}return this}const e=this._getRunningEvent(t);return e.removeAllListeners(),this._checkRunningEvents(e),this}off(t,e){if(!this.provider)return this;const n=this._getRunningEvent(t);return n.removeListener(e),this._checkRunningEvents(n),this}removeListener(t,e){return this.off(t,e)}}class Tk extends Ik{}class Ck{constructor(t){Am(this,"alphabet",t),Am(this,"base",t.length),Am(this,"_alphabetMap",{}),Am(this,"_leader",t.charAt(0));for(let e=0;e<t.length;e++)this._alphabetMap[t.charAt(e)]=e}encode(t){let e=Rp(t);if(0===e.length)return"";let n=[0];for(let t=0;t<e.length;++t){let r=e[t];for(let t=0;t<n.length;++t)r+=n[t]<<8,n[t]=r%this.base,r=r/this.base|0;for(;r>0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let t=0;0===e[t]&&t<e.length-1;++t)r+=this._leader;for(let t=n.length-1;t>=0;--t)r+=this.alphabet[n[t]];return r}decode(t){if("string"!=typeof t)throw new TypeError("Expected String");let e=[];if(0===t.length)return new Uint8Array(e);e.push(0);for(let n=0;n<t.length;n++){let r=this._alphabetMap[t[n]];if(void 0===r)throw new Error("Non-base"+this.base+" character");let i=r;for(let t=0;t<e.length;++t)i+=e[t]*this.base,e[t]=255&i,i>>=8;for(;i>0;)e.push(255&i),i>>=8}for(let n=0;t[n]===this._leader&&n<t.length-1;++n)e.push(0);return Rp(new Uint8Array(e.reverse()))}}new Ck("abcdefghijklmnopqrstuvwxyz234567");const jk=new Ck("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function Dk(t){return"0x"+mM.sha256().update(Rp(t)).digest("hex")}new jp("sha2/5.7.0");const Ok=new jp("networks/5.7.1");function _k(t){const e=function(e,n){null==n&&(n={});const r=[];if(e.InfuraProvider&&"-"!==n.infura)try{r.push(new e.InfuraProvider(t,n.infura))}catch(t){}if(e.EtherscanProvider&&"-"!==n.etherscan)try{r.push(new e.EtherscanProvider(t,n.etherscan))}catch(t){}if(e.AlchemyProvider&&"-"!==n.alchemy)try{r.push(new e.AlchemyProvider(t,n.alchemy))}catch(t){}if(e.PocketProvider&&"-"!==n.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const o=new e.PocketProvider(t,n.pocket);o.network&&-1===i.indexOf(o.network.name)&&r.push(o)}catch(t){}}if(e.CloudflareProvider&&"-"!==n.cloudflare)try{r.push(new e.CloudflareProvider(t))}catch(t){}if(e.AnkrProvider&&"-"!==n.ankr)try{const i=["ropsten"],o=new e.AnkrProvider(t,n.ankr);o.network&&-1===i.indexOf(o.network.name)&&r.push(o)}catch(t){}if(0===r.length)return null;if(e.FallbackProvider){let i=1;return null!=n.quorum?i=n.quorum:"homestead"===t&&(i=2),new e.FallbackProvider(r,i)}return r[0]};return e.renetwork=function(t){return _k(t)},e}function zk(t,e){const n=function(n,r){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return n.renetwork=function(e){return zk(t,e)},n}const Pk={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:_k("homestead")},Bk={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:_k("ropsten")},Rk={chainId:63,name:"classicMordor",_defaultProvider:zk("https://www.ethercluster.com/mordor","classicMordor")},Uk={unspecified:{chainId:0,name:"unspecified"},homestead:Pk,mainnet:Pk,morden:{chainId:2,name:"morden"},ropsten:Bk,testnet:Bk,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:_k("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:_k("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:_k("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:_k("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:zk("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:Rk,classicTestnet:Rk,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:zk("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:_k("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:_k("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};var Wk=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};function Qk(t,e){return Wk(this,void 0,void 0,(function*(){null==e&&(e={});const n={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(!0!==e.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=e.fetchOptions){const t=e.fetchOptions;t.mode&&(n.mode=t.mode),t.cache&&(n.cache=t.cache),t.credentials&&(n.credentials=t.credentials),t.redirect&&(n.redirect=t.redirect),t.referrer&&(n.referrer=t.referrer)}const r=yield fetch(t,n),i=yield r.arrayBuffer(),o={};return r.headers.forEach?r.headers.forEach(((t,e)=>{o[e.toLowerCase()]=t})):r.headers.keys().forEach((t=>{o[t.toLowerCase()]=r.headers.get(t)})),{headers:o,statusCode:r.status,statusMessage:r.statusText,body:Rp(new Uint8Array(i))}}))}var Fk=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const Yk=new jp("web/5.7.1");function Hk(t){return new Promise((e=>{setTimeout(e,t)}))}function Vk(t,e){if(null==t)return null;if("string"==typeof t)return t;if(zp(t)){if(e&&("text"===e.split("/")[0]||"application/json"===e.split(";")[0].trim()))try{return Vg(t)}catch(t){}return Yp(t)}return t}function qk(t,e,n){let r=null;if(null!=e){r=Hg(e);const n="string"==typeof t?{url:t}:xm(t);if(n.headers){0!==Object.keys(n.headers).filter((t=>"content-type"===t.toLowerCase())).length||(n.headers=xm(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};t=n}return function(t,e,n){const r="object"==typeof t&&null!=t.throttleLimit?t.throttleLimit:12;Yk.assertArgument(r>0&&r%1==0,"invalid connection throttle limit","connection.throttleLimit",r);const i="object"==typeof t?t.throttleCallback:null,o="object"==typeof t&&"number"==typeof t.throttleSlotInterval?t.throttleSlotInterval:100;Yk.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const a="object"==typeof t&&!!t.errorPassThrough,s={};let u=null;const c={method:"GET"};let l=!1,h=12e4;if("string"==typeof t)u=t;else if("object"==typeof t){if(null!=t&&null!=t.url||Yk.throwArgumentError("missing URL","connection.url",t),u=t.url,"number"==typeof t.timeout&&t.timeout>0&&(h=t.timeout),t.headers)for(const e in t.headers)s[e.toLowerCase()]={key:e,value:String(t.headers[e])},["if-none-match","if-modified-since"].indexOf(e.toLowerCase())>=0&&(l=!0);if(c.allowGzip=!!t.allowGzip,null!=t.user&&null!=t.password){"https:"!==u.substring(0,6)&&!0!==t.allowInsecureAuthentication&&Yk.throwError("basic authentication requires a secure https url",jp.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:t.user,password:"[REDACTED]"});const e=t.user+":"+t.password;s.authorization={key:"Authorization",value:"Basic "+ny(Hg(e))}}null!=t.skipFetchSetup&&(c.skipFetchSetup=!!t.skipFetchSetup),null!=t.fetchOptions&&(c.fetchOptions=xm(t.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=u?u.match(d):null;if(f)try{const t={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?ey(f[3]):(p=f[3],Hg(p.replace(/%([0-9a-f][0-9a-f])/gi,((t,e)=>String.fromCharCode(parseInt(e,16))))))};let e=t.body;return n&&(e=n(t.body,t)),Promise.resolve(e)}catch(t){Yk.throwError("processing response error",jp.errors.SERVER_ERROR,{body:Vk(f[1],f[2]),error:t,requestBody:null,requestMethod:"GET",url:u})}var p;e&&(c.method="POST",c.body=e,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(e.length)}));const m={};Object.keys(s).forEach((t=>{const e=s[t];m[e.key]=e.value})),c.headers=m;const g=function(){let t=null;return{promise:new Promise((function(e,n){h&&(t=setTimeout((()=>{null!=t&&(t=null,n(Yk.makeError("timeout",jp.errors.TIMEOUT,{requestBody:Vk(c.body,m["content-type"]),requestMethod:c.method,timeout:h,url:u})))}),h))})),cancel:function(){null!=t&&(clearTimeout(t),t=null)}}}(),y=function(){return Fk(this,void 0,void 0,(function*(){for(let t=0;t<r;t++){let e=null;try{if(e=yield Qk(u,c),t<r)if(301===e.statusCode||302===e.statusCode){const t=e.headers.location||"";if("GET"===c.method&&t.match(/^https:/)){u=e.headers.location;continue}}else if(429===e.statusCode){let n=!0;if(i&&(n=yield i(t,u)),n){let n=0;const r=e.headers["retry-after"];n="string"==typeof r&&r.match(/^[1-9][0-9]*$/)?1e3*parseInt(r):o*parseInt(String(Math.random()*Math.pow(2,t))),yield Hk(n);continue}}}catch(t){e=t.response,null==e&&(g.cancel(),Yk.throwError("missing response",jp.errors.SERVER_ERROR,{requestBody:Vk(c.body,m["content-type"]),requestMethod:c.method,serverError:t,url:u}))}let s=e.body;if(l&&304===e.statusCode?s=null:!a&&(e.statusCode<200||e.statusCode>=300)&&(g.cancel(),Yk.throwError("bad response",jp.errors.SERVER_ERROR,{status:e.statusCode,headers:e.headers,body:Vk(s,e.headers?e.headers["content-type"]:null),requestBody:Vk(c.body,m["content-type"]),requestMethod:c.method,url:u})),n)try{const t=yield n(s,e);return g.cancel(),t}catch(n){if(n.throttleRetry&&t<r){let e=!0;if(i&&(e=yield i(t,u)),e){const e=o*parseInt(String(Math.random()*Math.pow(2,t)));yield Hk(e);continue}}g.cancel(),Yk.throwError("processing response error",jp.errors.SERVER_ERROR,{body:Vk(s,e.headers?e.headers["content-type"]:null),error:n,requestBody:Vk(c.body,m["content-type"]),requestMethod:c.method,url:u})}return g.cancel(),s}return Yk.throwError("failed response",jp.errors.SERVER_ERROR,{requestBody:Vk(c.body,m["content-type"]),requestMethod:c.method,url:u})}))}();return Promise.race([g.promise,y])}(t,r,((t,e)=>{let r=null;if(null!=t)try{r=JSON.parse(Vg(t))}catch(e){Yk.throwError("invalid JSON",jp.errors.SERVER_ERROR,{body:t,error:e})}return n&&(r=n(r,e)),r}))}function Gk(t,e){return e||(e={}),null==(e=xm(e)).floor&&(e.floor=0),null==e.ceiling&&(e.ceiling=1e4),null==e.interval&&(e.interval=250),new Promise((function(n,r){let i=null,o=!1;const a=()=>!o&&(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout((()=>{a()&&r(new Error("timeout"))}),e.timeout));const s=e.retryLimit;let u=0;!function i(){return t().then((function(t){if(void 0!==t)a()&&n(t);else if(e.oncePoll)e.oncePoll.once("poll",i);else if(e.onceBlock)e.onceBlock.once("block",i);else if(!o){if(u++,u>s)return void(a()&&r(new Error("retry limit reached")));let t=e.interval*parseInt(String(Math.random()*Math.pow(2,u)));t<e.floor&&(t=e.floor),t>e.ceiling&&(t=e.ceiling),setTimeout(i,t)}return null}),(function(t){a()&&r(t)}))}()}))}for(var Zk="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Jk={},Xk=0;Xk<32;Xk++){var Kk=Zk.charAt(Xk);if(void 0!==Jk[Kk])throw new TypeError(Kk+" is ambiguous");Jk[Kk]=Xk}function $k(t){var e=t>>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function tA(t){for(var e=1,n=0;n<t.length;++n){var r=t.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+t+")";e=$k(e)^r>>5}for(e=$k(e),n=0;n<t.length;++n){var i=t.charCodeAt(n);e=$k(e)^31&i}return e}function eA(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var n=t.toLowerCase(),r=t.toUpperCase();if(t!==n&&t!==r)return"Mixed-case string "+t;var i=(t=n).lastIndexOf("1");if(-1===i)return"No separator character for "+t;if(0===i)return"Missing prefix for "+t;var o=t.slice(0,i),a=t.slice(i+1);if(a.length<6)return"Data too short";var s=tA(o);if("string"==typeof s)return s;for(var u=[],c=0;c<a.length;++c){var l=a.charAt(c),h=Jk[l];if(void 0===h)return"Unknown character "+l;s=$k(s)^h,c+6>=a.length||u.push(h)}return 1!==s?"Invalid checksum for "+t:{prefix:o,words:u}}function nA(t,e,n,r){for(var i=0,o=0,a=(1<<n)-1,s=[],u=0;u<t.length;++u)for(i=i<<e|t[u],o+=e;o>=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<<n-o&a);else{if(o>=e)return"Excess padding";if(i<<n-o&a)return"Non-zero padding"}return s}var rA={decodeUnsafe:function(){var t=eA.apply(null,arguments);if("object"==typeof t)return t},decode:function(t){var e=eA.apply(null,arguments);if("object"==typeof e)return e;throw new Error(e)},encode:function(t,e,n){if(n=n||90,t.length+7+e.length>n)throw new TypeError("Exceeds length limit");var r=tA(t=t.toLowerCase());if("string"==typeof r)throw new Error(r);for(var i=t+"1",o=0;o<e.length;++o){var a=e[o];if(a>>5!=0)throw new Error("Non 5-bit word");r=$k(r)^a,i+=Zk.charAt(a)}for(o=0;o<6;++o)r=$k(r);for(r^=1,o=0;o<6;++o){i+=Zk.charAt(r>>5*(5-o)&31)}return i},toWordsUnsafe:function(t){var e=nA(t,8,5,!0);if(Array.isArray(e))return e},toWords:function(t){var e=nA(t,8,5,!0);if(Array.isArray(e))return e;throw new Error(e)},fromWordsUnsafe:function(t){var e=nA(t,5,8,!1);if(Array.isArray(e))return e},fromWords:function(t){var e=nA(t,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}};const iA="providers/5.7.2",oA=new jp(iA);class aA{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const t={},e=this.address.bind(this),n=this.bigNumber.bind(this),r=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),s=this.number.bind(this),u=this.type.bind(this);return t.transaction={hash:o,type:u,accessList:aA.allowNull(this.accessList.bind(this),null),blockHash:aA.allowNull(o,null),blockNumber:aA.allowNull(s,null),transactionIndex:aA.allowNull(s,null),confirmations:aA.allowNull(s,null),from:e,gasPrice:aA.allowNull(n),maxPriorityFeePerGas:aA.allowNull(n),maxFeePerGas:aA.allowNull(n),gasLimit:n,to:aA.allowNull(e,null),value:n,nonce:s,data:i,r:aA.allowNull(this.uint256),s:aA.allowNull(this.uint256),v:aA.allowNull(s),creates:aA.allowNull(e,null),raw:aA.allowNull(i)},t.transactionRequest={from:aA.allowNull(e),nonce:aA.allowNull(s),gasLimit:aA.allowNull(n),gasPrice:aA.allowNull(n),maxPriorityFeePerGas:aA.allowNull(n),maxFeePerGas:aA.allowNull(n),to:aA.allowNull(e),value:aA.allowNull(n),data:aA.allowNull((t=>this.data(t,!0))),type:aA.allowNull(s),accessList:aA.allowNull(this.accessList.bind(this),null)},t.receiptLog={transactionIndex:s,blockNumber:s,transactionHash:o,address:e,topics:aA.arrayOf(o),data:i,logIndex:s,blockHash:o},t.receipt={to:aA.allowNull(this.address,null),from:aA.allowNull(this.address,null),contractAddress:aA.allowNull(e,null),transactionIndex:s,root:aA.allowNull(a),gasUsed:n,logsBloom:aA.allowNull(i),blockHash:o,transactionHash:o,logs:aA.arrayOf(this.receiptLog.bind(this)),blockNumber:s,confirmations:aA.allowNull(s,null),cumulativeGasUsed:n,effectiveGasPrice:aA.allowNull(n),status:aA.allowNull(s),type:u},t.block={hash:aA.allowNull(o),parentHash:o,number:s,timestamp:s,nonce:aA.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:aA.allowNull(e),extraData:i,transactions:aA.allowNull(aA.arrayOf(o)),baseFeePerGas:aA.allowNull(n)},t.blockWithTransactions=xm(t.block),t.blockWithTransactions.transactions=aA.allowNull(aA.arrayOf(this.transactionResponse.bind(this))),t.filter={fromBlock:aA.allowNull(r,void 0),toBlock:aA.allowNull(r,void 0),blockHash:aA.allowNull(o,void 0),address:aA.allowNull(e,void 0),topics:aA.allowNull(this.topics.bind(this),void 0)},t.filterLog={blockNumber:aA.allowNull(s),blockHash:aA.allowNull(o),transactionIndex:s,removed:aA.allowNull(this.boolean.bind(this)),address:e,data:aA.allowFalsish(i,"0x"),topics:aA.arrayOf(o),transactionHash:o,logIndex:s},t}accessList(t){return lk(t||[])}number(t){return"0x"===t?0:rm.from(t).toNumber()}type(t){return"0x"===t||null==t?0:rm.from(t).toNumber()}bigNumber(t){return rm.from(t)}boolean(t){if("boolean"==typeof t)return t;if("string"==typeof t){if("true"===(t=t.toLowerCase()))return!0;if("false"===t)return!1}throw new Error("invalid boolean - "+t)}hex(t,e){return"string"==typeof t&&(e||"0x"===t.substring(0,2)||(t="0x"+t),Qp(t))?t.toLowerCase():oA.throwArgumentError("invalid hash","value",t)}data(t,e){const n=this.hex(t,e);if(n.length%2!=0)throw new Error("invalid data; odd-length - "+t);return n}address(t){return Mg(t)}callAddress(t){if(!Qp(t,32))return null;const e=Mg(Vp(t,12));return"0x0000000000000000000000000000000000000000"===e?null:e}contractAddress(t){return kg(t)}blockTag(t){if(null==t)return"latest";if("earliest"===t)return"0x0";switch(t){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return t}if("number"==typeof t||Qp(t))return Gp(t);throw new Error("invalid blockTag")}hash(t,e){const n=this.hex(t,e);return 32!==Hp(n)?oA.throwArgumentError("invalid hash","value",t):n}difficulty(t){if(null==t)return null;const e=rm.from(t);try{return e.toNumber()}catch(t){}return null}uint256(t){if(!Qp(t))throw new Error("invalid uint256");return Zp(t,32)}_block(t,e){null!=t.author&&null==t.miner&&(t.miner=t.author);const n=null!=t._difficulty?t._difficulty:t.difficulty,r=aA.check(e,t);return r._difficulty=null==n?null:rm.from(n),r}block(t){return this._block(t,this.formats.block)}blockWithTransactions(t){return this._block(t,this.formats.blockWithTransactions)}transactionRequest(t){return aA.check(this.formats.transactionRequest,t)}transactionResponse(t){null!=t.gas&&null==t.gasLimit&&(t.gasLimit=t.gas),t.to&&rm.from(t.to).isZero()&&(t.to="0x0000000000000000000000000000000000000000"),null!=t.input&&null==t.data&&(t.data=t.input),null==t.to&&null==t.creates&&(t.creates=this.contractAddress(t)),1!==t.type&&2!==t.type||null!=t.accessList||(t.accessList=[]);const e=aA.check(this.formats.transaction,t);if(null!=t.chainId){let n=t.chainId;Qp(n)&&(n=rm.from(n).toNumber()),e.chainId=n}else{let n=t.networkId;null==n&&null==e.v&&(n=t.chainId),Qp(n)&&(n=rm.from(n).toNumber()),"number"!=typeof n&&null!=e.v&&(n=(e.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!=typeof n&&(n=0),e.chainId=n}return e.blockHash&&"x"===e.blockHash.replace(/0/g,"")&&(e.blockHash=null),e}transaction(t){return mk(t)}receiptLog(t){return aA.check(this.formats.receiptLog,t)}receipt(t){const e=aA.check(this.formats.receipt,t);if(null!=e.root)if(e.root.length<=4){const t=rm.from(e.root).toNumber();0===t||1===t?(null!=e.status&&e.status!==t&&oA.throwArgumentError("alt-root-status/status mismatch","value",{root:e.root,status:e.status}),e.status=t,delete e.root):oA.throwArgumentError("invalid alt-root-status","value.root",e.root)}else 66!==e.root.length&&oA.throwArgumentError("invalid root hash","value.root",e.root);return null!=e.status&&(e.byzantium=!0),e}topics(t){return Array.isArray(t)?t.map((t=>this.topics(t))):null!=t?this.hash(t,!0):null}filter(t){return aA.check(this.formats.filter,t)}filterLog(t){return aA.check(this.formats.filterLog,t)}static check(t,e){const n={};for(const r in t)try{const i=t[r](e[r]);void 0!==i&&(n[r]=i)}catch(t){throw t.checkKey=r,t.checkValue=e[r],t}return n}static allowNull(t,e){return function(n){return null==n?e:t(n)}}static allowFalsish(t,e){return function(n){return n?t(n):e}}static arrayOf(t){return function(e){if(!Array.isArray(e))throw new Error("not an array");const n=[];return e.forEach((function(e){n.push(t(e))})),n}}}var sA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const uA=new jp(iA);function cA(t){return null==t?"null":(32!==Hp(t)&&uA.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function lA(t){for(t=t.slice();t.length>0&&null==t[t.length-1];)t.pop();return t.map((t=>{if(Array.isArray(t)){const e={};t.forEach((t=>{e[cA(t)]=!0}));const n=Object.keys(e);return n.sort(),n.join("|")}return cA(t)})).join("&")}function hA(t){if("string"==typeof t){if(32===Hp(t=t.toLowerCase()))return"tx:"+t;if(-1===t.indexOf(":"))return t}else{if(Array.isArray(t))return"filter:*:"+lA(t);if(ev.isForkEvent(t))throw uA.warn("not implemented"),new Error("not implemented");if(t&&"object"==typeof t)return"filter:"+(t.address||"*")+":"+lA(t.topics||[])}throw new Error("invalid event - "+t)}function dA(){return(new Date).getTime()}function fA(t){return new Promise((e=>{setTimeout(e,t)}))}const pA=["block","network","pending","poll"];class mA{constructor(t,e,n){Am(this,"tag",t),Am(this,"listener",e),Am(this,"once",n),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"tx"!==t[0]?null:t[1]}get filter(){const t=this.tag.split(":");if("filter"!==t[0])return null;const e=t[1],n=""===(r=t[2])?[]:r.split(/&/g).map((t=>{if(""===t)return[];const e=t.split("|").map((t=>"null"===t?null:t));return 1===e.length?e[0]:e}));var r;const i={};return n.length>0&&(i.topics=n),e&&"*"!==e&&(i.address=e),i}pollable(){return this.tag.indexOf(":")>=0||pA.indexOf(this.tag)>=0}}const gA={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 yA(t){return Zp(rm.from(t).toHexString(),32)}function vA(t){return jk.encode(Up([t,Vp(Dk(Dk(t)),0,4)]))}const wA=new RegExp("^(ipfs)://(.*)$","i"),bA=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),wA,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function MA(t,e){try{return Vg(kA(t,e))}catch(t){}return null}function kA(t,e){if("0x"===t)return null;const n=rm.from(Vp(t,e,e+32)).toNumber(),r=rm.from(Vp(t,n,n+32)).toNumber();return Vp(t,n+32,n+32+r)}function AA(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):uA.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function LA(t){const e=Rp(t);if(e.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(e,32-e.length),n}function EA(t){if(t.length%32==0)return t;const e=new Uint8Array(32*Math.ceil(t.length/32));return e.set(t),e}function xA(t){const e=[];let n=0;for(let r=0;r<t.length;r++)e.push(null),n+=32;for(let r=0;r<t.length;r++){const i=Rp(t[r]);e[r]=LA(n),e.push(LA(i.length)),e.push(EA(i)),n+=32+32*Math.ceil(i.length/32)}return qp(e)}class NA{constructor(t,e,n,r){Am(this,"provider",t),Am(this,"name",n),Am(this,"address",t.formatter.address(e)),Am(this,"_resolvedAddress",r)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then((t=>rm.from(t).eq(1))).catch((t=>{if(t.code===jp.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,t}))),this._supportsEip2544}_fetch(t,e){return sA(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:qp([t,Sy(this.name),e||"0x"])};let r=!1;var i;(yield this.supportsWildcard())&&(r=!0,n.data=qp(["0x9061b923",xA([(i=this.name,Yp(Up(Ny(i).map((t=>{if(t.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const e=new Uint8Array(t.length+1);return e.set(t,1),e[0]=e.length-1,e}))))+"00"),n.data])]));try{let t=yield this.provider.call(n);return Rp(t).length%32==4&&uA.throwError("resolver threw error",jp.errors.CALL_EXCEPTION,{transaction:n,data:t}),r&&(t=kA(t,0)),t}catch(t){if(t.code===jp.errors.CALL_EXCEPTION)return null;throw t}}))}_fetchBytes(t,e){return sA(this,void 0,void 0,(function*(){const n=yield this._fetch(t,e);return null!=n?kA(n,0):null}))}_getAddress(t,e){const n=gA[String(t)];if(null==n&&uA.throwError(`unsupported coin type: ${t}`,jp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`}),"eth"===n.ilk)return this.provider.formatter.address(e);const r=Rp(e);if(null!=n.p2pkh){const t=e.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return vA(Up([[n.p2pkh],"0x"+t[2]]))}}if(null!=n.p2sh){const t=e.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(t){const e=parseInt(t[1],16);if(t[2].length===2*e&&e>=1&&e<=75)return vA(Up([[n.p2sh],"0x"+t[2]]))}}if(null!=n.prefix){const t=r[1];let e=r[0];if(0===e?20!==t&&32!==t&&(e=-1):e=-1,e>=0&&r.length===2+t&&t>=1&&t<=75){const t=rA.toWords(r.slice(2));return t.unshift(e),rA.encode(n.prefix,t)}}return null}getAddress(t){return sA(this,void 0,void 0,(function*(){if(null==t&&(t=60),60===t)try{const t=yield this._fetch("0x3b3b57de");return"0x"===t||"0x0000000000000000000000000000000000000000000000000000000000000000"===t?null:this.provider.formatter.callAddress(t)}catch(t){if(t.code===jp.errors.CALL_EXCEPTION)return null;throw t}const e=yield this._fetchBytes("0xf1cb7e06",yA(t));if(null==e||"0x"===e)return null;const n=this._getAddress(t,e);return null==n&&uA.throwError("invalid or unsupported coin data",jp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${t})`,coinType:t,data:e}),n}))}getAvatar(){return sA(this,void 0,void 0,(function*(){const t=[{type:"name",content:this.name}];try{const e=yield this.getText("avatar");if(null==e)return null;for(let n=0;n<bA.length;n++){const r=e.match(bA[n]);if(null==r)continue;const i=r[1].toLowerCase();switch(i){case"https":return t.push({type:"url",content:e}),{linkage:t,url:e};case"data":return t.push({type:"data",content:e}),{linkage:t,url:e};case"ipfs":return t.push({type:"ipfs",content:e}),{linkage:t,url:AA(e)};case"erc721":case"erc1155":{const n="erc721"===i?"0xc87b56dd":"0x0e89341c";t.push({type:i,content:e});const o=this._resolvedAddress||(yield this.getAddress()),a=(r[2]||"").split("/");if(2!==a.length)return null;const s=yield this.provider.formatter.address(a[0]),u=Zp(rm.from(a[1]).toHexString(),32);if("erc721"===i){const e=this.provider.formatter.callAddress(yield this.provider.call({to:s,data:qp(["0x6352211e",u])}));if(o!==e)return null;t.push({type:"owner",content:e})}else if("erc1155"===i){const e=rm.from(yield this.provider.call({to:s,data:qp(["0x00fdd58e",Zp(o,32),u])}));if(e.isZero())return null;t.push({type:"balance",content:e.toString()})}const c={to:this.provider.formatter.address(a[0]),data:qp([n,u])};let l=MA(yield this.provider.call(c),0);if(null==l)return null;t.push({type:"metadata-url-base",content:l}),"erc1155"===i&&(l=l.replace("{id}",u.substring(2)),t.push({type:"metadata-url-expanded",content:l})),l.match(/^ipfs:/i)&&(l=AA(l)),t.push({type:"metadata-url",content:l});const h=yield qk(l);if(!h)return null;t.push({type:"metadata",content:JSON.stringify(h)});let d=h.image;if("string"!=typeof d)return null;if(d.match(/^(https:\/\/|data:)/i));else{if(null==d.match(wA))return null;t.push({type:"url-ipfs",content:d}),d=AA(d)}return t.push({type:"url",content:d}),{linkage:t,url:d}}}}}catch(t){}return null}))}getContentHash(){return sA(this,void 0,void 0,(function*(){const t=yield this._fetchBytes("0xbc1c58d1");if(null==t||"0x"===t)return null;const e=t.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(e){const t=parseInt(e[3],16);if(e[4].length===2*t)return"ipfs://"+jk.encode("0x"+e[1])}const n=t.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const t=parseInt(n[3],16);if(n[4].length===2*t)return"ipns://"+jk.encode("0x"+n[1])}const r=t.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&64===r[1].length)return"bzz://"+r[1];const i=t.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const t={"=":"","+":"-","/":"_"};return"sia://"+ny("0x"+i[1]).replace(/[=+\/]/g,(e=>t[e]))}return uA.throwError("invalid or unsupported content hash data",jp.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:t})}))}getText(t){return sA(this,void 0,void 0,(function*(){let e=Hg(t);e=Up([yA(64),yA(e.length),e]),e.length%32!=0&&(e=Up([e,Zp("0x",32-t.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",Yp(e));return null==n||"0x"===n?null:Vg(n)}))}}let SA=null,IA=1;class TA extends nv{constructor(t){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Am(this,"anyNetwork","any"===t),this.anyNetwork&&(t=this.detectNetwork()),t instanceof Promise)this._networkPromise=t,t.catch((t=>{})),this._ready().catch((t=>{}));else{const e=Lm(new.target,"getNetwork")(t);e?(Am(this,"_network",e),this.emit("network",e,null)):uA.throwArgumentError("invalid network","network",t)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return sA(this,void 0,void 0,(function*(){if(null==this._network){let t=null;if(this._networkPromise)try{t=yield this._networkPromise}catch(t){}null==t&&(t=yield this.detectNetwork()),t||uA.throwError("no network detected",jp.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=t:Am(this,"_network",t),this.emit("network",t,null))}return this._network}))}get ready(){return Gk((()=>this._ready().then((t=>t),(t=>{if(t.code!==jp.errors.NETWORK_ERROR||"noNetwork"!==t.event)throw t}))))}static getFormatter(){return null==SA&&(SA=new aA),SA}static getNetwork(t){return function(t){if(null==t)return null;if("number"==typeof t){for(const e in Uk){const n=Uk[e];if(n.chainId===t)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:t,name:"unknown"}}if("string"==typeof t){const e=Uk[t];return null==e?null:{name:e.name,chainId:e.chainId,ensAddress:e.ensAddress,_defaultProvider:e._defaultProvider||null}}const e=Uk[t.name];if(!e)return"number"!=typeof t.chainId&&Ok.throwArgumentError("invalid network chainId","network",t),t;0!==t.chainId&&t.chainId!==e.chainId&&Ok.throwArgumentError("network chainId mismatch","network",t);let n=t._defaultProvider||null;var r;return null==n&&e._defaultProvider&&(n=(r=e._defaultProvider)&&"function"==typeof r.renetwork?e._defaultProvider.renetwork(t):e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:n}}(null==t?"homestead":t)}ccipReadFetch(t,e,n){return sA(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=t.to.toLowerCase(),i=e.toLowerCase(),o=[];for(let t=0;t<n.length;t++){const e=n[t],a=e.replace("{sender}",r).replace("{data}",i),s=e.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:r}),u=yield qk({url:a,errorPassThrough:!0},s,((t,e)=>(t.status=e.statusCode,t)));if(u.data)return u.data;const c=u.message||"unknown error";if(u.status>=400&&u.status<500)return uA.throwError(`response not found during CCIP fetch: ${c}`,jp.errors.SERVER_ERROR,{url:e,errorMessage:c});o.push(c)}return uA.throwError(`error encountered during CCIP fetch: ${o.map((t=>JSON.stringify(t))).join(", ")}`,jp.errors.SERVER_ERROR,{urls:n,errorMessages:o})}))}_getInternalBlockNumber(t){return sA(this,void 0,void 0,(function*(){if(yield this._ready(),t>0)for(;this._internalBlockNumber;){const e=this._internalBlockNumber;try{const n=yield e;if(dA()-n.respTime<=t)return n.blockNumber;break}catch(t){if(this._internalBlockNumber===e)break}}const e=dA(),n=Em({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((t=>null),(t=>t))}).then((({blockNumber:t,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=dA();return(t=rm.from(t).toNumber())<this._maxInternalBlockNumber&&(t=this._maxInternalBlockNumber),this._maxInternalBlockNumber=t,this._setFastBlockNumber(t),{blockNumber:t,reqTime:e,respTime:i}}));return this._internalBlockNumber=n,n.catch((t=>{this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return sA(this,void 0,void 0,(function*(){const t=IA++,e=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(t){return void this.emit("error",t)}if(this._setFastBlockNumber(n),this.emit("poll",t,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)uA.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",uA.makeError("network block skew detected",jp.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let t=this._emitted.block+1;t<=n;t++)this.emit("block",t);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((t=>{if("block"===t)return;const e=this._emitted[t];"pending"!==e&&n-e>12&&delete this._emitted[t]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((t=>{switch(t.type){case"tx":{const n=t.hash;let r=this.getTransactionReceipt(n).then((t=>t&&null!=t.blockNumber?(this._emitted["t:"+n]=t.blockNumber,this.emit(n,t),null):null)).catch((t=>{this.emit("error",t)}));e.push(r);break}case"filter":if(!t._inflight){t._inflight=!0,-2===t._lastBlockNumber&&(t._lastBlockNumber=n-1);const r=t.filter;r.fromBlock=t._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const o=this.getLogs(r).then((e=>{t._inflight=!1,0!==e.length&&e.forEach((e=>{e.blockNumber>t._lastBlockNumber&&(t._lastBlockNumber=e.blockNumber),this._emitted["b:"+e.blockHash]=e.blockNumber,this._emitted["t:"+e.transactionHash]=e.blockNumber,this.emit(r,e)}))})).catch((e=>{this.emit("error",e),t._inflight=!1}));e.push(o)}}})),this._lastBlockNumber=n,Promise.all(e).then((()=>{this.emit("didPoll",t)})).catch((t=>{this.emit("error",t)}))}else this.emit("didPoll",t)}))}resetEventsBlock(t){this._lastBlockNumber=t-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return sA(this,void 0,void 0,(function*(){return uA.throwError("provider does not support network detection",jp.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return sA(this,void 0,void 0,(function*(){const t=yield this._ready(),e=yield this.detectNetwork();if(t.chainId!==e.chainId){if(this.anyNetwork)return this._network=e,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",e,t),yield fA(0),this._network;const n=uA.makeError("underlying network changed",jp.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:e});throw this.emit("error",n),n}return t}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((t=>{this._setFastBlockNumber(t)}),(t=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}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("number"!=typeof t||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=dA();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((t=>((null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(t){null!=this._fastBlockNumber&&t<this._fastBlockNumber||(this._fastQueryDate=dA(),(null==this._fastBlockNumber||t>this._fastBlockNumber)&&(this._fastBlockNumber=t,this._fastBlockNumberPromise=Promise.resolve(t)))}waitForTransaction(t,e,n){return sA(this,void 0,void 0,(function*(){return this._waitForTransaction(t,null==e?1:e,n||0,null)}))}_waitForTransaction(t,e,n,r){return sA(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(t);return(i?i.confirmations:0)>=e?i:new Promise(((i,o)=>{const a=[];let s=!1;const u=function(){return!!s||(s=!0,a.forEach((t=>{t()})),!1)},c=t=>{t.confirmations<e||u()||i(t)};if(this.on(t,c),a.push((()=>{this.removeListener(t,c)})),r){let n=r.startBlock,i=null;const c=a=>sA(this,void 0,void 0,(function*(){s||(yield fA(1e3),this.getTransactionCount(r.from).then((l=>sA(this,void 0,void 0,(function*(){if(!s){if(l<=r.nonce)n=a;else{{const e=yield this.getTransaction(t);if(e&&null!=e.blockNumber)return}for(null==i&&(i=n-3,i<r.startBlock&&(i=r.startBlock));i<=a;){if(s)return;const n=yield this.getBlockWithTransactions(i);for(let i=0;i<n.transactions.length;i++){const a=n.transactions[i];if(a.hash===t)return;if(a.from===r.from&&a.nonce===r.nonce){if(s)return;const n=yield this.waitForTransaction(a.hash,e);if(u())return;let i="replaced";return a.data===r.data&&a.to===r.to&&a.value.eq(r.value)?i="repriced":"0x"===a.data&&a.from===a.to&&a.value.isZero()&&(i="cancelled"),void o(uA.makeError("transaction was replaced",jp.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(a),hash:t,receipt:n}))}}i++}}s||this.once("block",c)}}))),(t=>{s||this.once("block",c)})))}));if(s)return;this.once("block",c),a.push((()=>{this.removeListener("block",c)}))}if("number"==typeof n&&n>0){const t=setTimeout((()=>{u()||o(uA.makeError("timeout exceeded",jp.errors.TIMEOUT,{timeout:n}))}),n);t.unref&&t.unref(),a.push((()=>{clearTimeout(t)}))}}))}))}getBlockNumber(){return sA(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return sA(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield this.perform("getGasPrice",{});try{return rm.from(t)}catch(e){return uA.throwError("bad result from backend",jp.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e})}}))}getBalance(t,e){return sA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Em({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getBalance",n);try{return rm.from(r)}catch(t){return uA.throwError("bad result from backend",jp.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:t})}}))}getTransactionCount(t,e){return sA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Em({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getTransactionCount",n);try{return rm.from(r).toNumber()}catch(t){return uA.throwError("bad result from backend",jp.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:t})}}))}getCode(t,e){return sA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Em({address:this._getAddress(t),blockTag:this._getBlockTag(e)}),r=yield this.perform("getCode",n);try{return Yp(r)}catch(t){return uA.throwError("bad result from backend",jp.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:t})}}))}getStorageAt(t,e,n){return sA(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Em({address:this._getAddress(t),blockTag:this._getBlockTag(n),position:Promise.resolve(e).then((t=>Gp(t)))}),i=yield this.perform("getStorageAt",r);try{return Yp(i)}catch(t){return uA.throwError("bad result from backend",jp.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:t})}}))}_wrapTransaction(t,e,n){if(null!=e&&32!==Hp(e))throw new Error("invalid response - sendTransaction");const r=t;return null!=e&&t.hash!==e&&uA.throwError("Transaction hash mismatch from Provider.sendTransaction.",jp.errors.UNKNOWN_ERROR,{expectedHash:t.hash,returnedHash:e}),r.wait=(e,r)=>sA(this,void 0,void 0,(function*(){let i;null==e&&(e=1),null==r&&(r=0),0!==e&&null!=n&&(i={data:t.data,from:t.from,nonce:t.nonce,to:t.to,value:t.value,startBlock:n});const o=yield this._waitForTransaction(t.hash,e,r,i);return null==o&&0===e?null:(this._emitted["t:"+t.hash]=o.blockNumber,0===o.status&&uA.throwError("transaction failed",jp.errors.CALL_EXCEPTION,{transactionHash:t.hash,transaction:t,receipt:o}),o)})),r}sendTransaction(t){return sA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Promise.resolve(t).then((t=>Yp(t))),n=this.formatter.transaction(t);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const t=yield this.perform("sendTransaction",{signedTransaction:e});return this._wrapTransaction(n,t,r)}catch(t){throw t.transaction=n,t.transactionHash=n.hash,t}}))}_getTransactionRequest(t){return sA(this,void 0,void 0,(function*(){const e=yield t,n={};return["from","to"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?this._getAddress(t):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?rm.from(t):null)))})),["type"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>null!=t?t:null)))})),e.accessList&&(n.accessList=this.formatter.accessList(e.accessList)),["data"].forEach((t=>{null!=e[t]&&(n[t]=Promise.resolve(e[t]).then((t=>t?Yp(t):null)))})),this.formatter.transactionRequest(yield Em(n))}))}_getFilter(t){return sA(this,void 0,void 0,(function*(){t=yield t;const e={};return null!=t.address&&(e.address=this._getAddress(t.address)),["blockHash","topics"].forEach((n=>{null!=t[n]&&(e[n]=t[n])})),["fromBlock","toBlock"].forEach((n=>{null!=t[n]&&(e[n]=this._getBlockTag(t[n]))})),this.formatter.filter(yield Em(e))}))}_call(t,e,n){return sA(this,void 0,void 0,(function*(){n>=10&&uA.throwError("CCIP read exceeded maximum redirections",jp.errors.SERVER_ERROR,{redirects:n,transaction:t});const r=t.to,i=yield this.perform("call",{transaction:t,blockTag:e});if(n>=0&&"latest"===e&&null!=r&&"0x556f1830"===i.substring(0,10)&&Hp(i)%32==4)try{const o=Vp(i,4),a=Vp(o,0,32);rm.from(a).eq(r)||uA.throwError("CCIP Read sender did not match",jp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const s=[],u=rm.from(Vp(o,32,64)).toNumber(),c=rm.from(Vp(o,u,u+32)).toNumber(),l=Vp(o,u+32);for(let e=0;e<c;e++){const n=MA(l,32*e);null==n&&uA.throwError("CCIP Read contained corrupt URL string",jp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i}),s.push(n)}const h=kA(o,64);rm.from(Vp(o,100,128)).isZero()||uA.throwError("CCIP Read callback selector included junk",jp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const d=Vp(o,96,100),f=kA(o,128),p=yield this.ccipReadFetch(t,h,s);null==p&&uA.throwError("CCIP Read disabled or provided no URLs",jp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:t,data:i});const m={to:r,data:qp([d,xA([p,f])])};return this._call(m,e,n+1)}catch(t){if(t.code===jp.errors.SERVER_ERROR)throw t}try{return Yp(i)}catch(n){return uA.throwError("bad result from backend",jp.errors.SERVER_ERROR,{method:"call",params:{transaction:t,blockTag:e},result:i,error:n})}}))}call(t,e){return sA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Em({transaction:this._getTransactionRequest(t),blockTag:this._getBlockTag(e),ccipReadEnabled:Promise.resolve(t.ccipReadEnabled)});return this._call(n.transaction,n.blockTag,n.ccipReadEnabled?0:-1)}))}estimateGas(t){return sA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Em({transaction:this._getTransactionRequest(t)}),n=yield this.perform("estimateGas",e);try{return rm.from(n)}catch(t){return uA.throwError("bad result from backend",jp.errors.SERVER_ERROR,{method:"estimateGas",params:e,result:n,error:t})}}))}_getAddress(t){return sA(this,void 0,void 0,(function*(){"string"!=typeof(t=yield t)&&uA.throwArgumentError("invalid address or ENS name","name",t);const e=yield this.resolveName(t);return null==e&&uA.throwError("ENS name not configured",jp.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(t)})`}),e}))}_getBlock(t,e){return sA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;let n=-128;const r={includeTransactions:!!e};if(Qp(t,32))r.blockHash=t;else try{r.blockTag=yield this._getBlockTag(t),Qp(r.blockTag)&&(n=parseInt(r.blockTag.substring(2),16))}catch(e){uA.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",t)}return Gk((()=>sA(this,void 0,void 0,(function*(){const t=yield this.perform("getBlock",r);if(null==t)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(e){let e=null;for(let n=0;n<t.transactions.length;n++){const r=t.transactions[n];if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){null==e&&(e=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let t=e-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}}const n=this.formatter.blockWithTransactions(t);return n.transactions=n.transactions.map((t=>this._wrapTransaction(t))),n}return this.formatter.block(t)}))),{oncePoll:this})}))}getBlock(t){return this._getBlock(t,!1)}getBlockWithTransactions(t){return this._getBlock(t,!0)}getTransaction(t){return sA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return Gk((()=>sA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",e);if(null==n)return null==this._emitted["t:"+t]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(t){return sA(this,void 0,void 0,(function*(){yield this.getNetwork(),t=yield t;const e={transactionHash:this.formatter.hash(t,!0)};return Gk((()=>sA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",e);if(null==n)return null==this._emitted["t:"+t]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let t=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;t<=0&&(t=1),r.confirmations=t}return r}))),{oncePoll:this})}))}getLogs(t){return sA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield Em({filter:this._getFilter(t)}),n=yield this.perform("getLogs",e);return n.forEach((t=>{null==t.removed&&(t.removed=!1)})),aA.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return sA(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(t){return sA(this,void 0,void 0,(function*(){if("number"==typeof(t=yield t)&&t<0){t%1&&uA.throwArgumentError("invalid BlockTag","blockTag",t);let e=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return e+=t,e<0&&(e=0),this.formatter.blockTag(e)}return this.formatter.blockTag(t)}))}getResolver(t){return sA(this,void 0,void 0,(function*(){let e=t;for(;;){if(""===e||"."===e)return null;if("eth"!==t&&"eth"===e)return null;const n=yield this._getResolver(e,"getResolver");if(null!=n){const r=new NA(this,n,t);return e===t||(yield r.supportsWildcard())?r:null}e=e.split(".").slice(1).join(".")}}))}_getResolver(t,e){return sA(this,void 0,void 0,(function*(){null==e&&(e="ENS");const n=yield this.getNetwork();n.ensAddress||uA.throwError("network does not support ENS",jp.errors.UNSUPPORTED_OPERATION,{operation:e,network:n.name});try{const e=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+Sy(t).substring(2)});return this.formatter.callAddress(e)}catch(t){}return null}))}resolveName(t){return sA(this,void 0,void 0,(function*(){t=yield t;try{return Promise.resolve(this.formatter.address(t))}catch(e){if(Qp(t))throw e}"string"!=typeof t&&uA.throwArgumentError("invalid ENS name","name",t);const e=yield this.getResolver(t);return e?yield e.getAddress():null}))}lookupAddress(t){return sA(this,void 0,void 0,(function*(){t=yield t;const e=(t=this.formatter.address(t)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(e,"lookupAddress");if(null==n)return null;const r=MA(yield this.call({to:n,data:"0x691f3431"+Sy(e).substring(2)}),0);return(yield this.resolveName(r))!=t?null:r}))}getAvatar(t){return sA(this,void 0,void 0,(function*(){let e=null;if(Qp(t)){const n=this.formatter.address(t).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(n,"getAvatar");if(!r)return null;e=new NA(this,r,n);try{const t=yield e.getAvatar();if(t)return t.url}catch(t){if(t.code!==jp.errors.CALL_EXCEPTION)throw t}try{const t=MA(yield this.call({to:r,data:"0x691f3431"+Sy(n).substring(2)}),0);e=yield this.getResolver(t)}catch(t){if(t.code!==jp.errors.CALL_EXCEPTION)throw t;return null}}else if(e=yield this.getResolver(t),!e)return null;const n=yield e.getAvatar();return null==n?null:n.url}))}perform(t,e){return uA.throwError(t+" not implemented",jp.errors.NOT_IMPLEMENTED,{operation:t})}_startEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_stopEvent(t){this.polling=this._events.filter((t=>t.pollable())).length>0}_addEventListener(t,e,n){const r=new mA(hA(t),e,n);return this._events.push(r),this._startEvent(r),this}on(t,e){return this._addEventListener(t,e,!1)}once(t,e){return this._addEventListener(t,e,!0)}emit(t,...e){let n=!1,r=[],i=hA(t);return this._events=this._events.filter((t=>t.tag!==i||(setTimeout((()=>{t.listener.apply(this,e)}),0),n=!0,!t.once||(r.push(t),!1)))),r.forEach((t=>{this._stopEvent(t)})),n}listenerCount(t){if(!t)return this._events.length;let e=hA(t);return this._events.filter((t=>t.tag===e)).length}listeners(t){if(null==t)return this._events.map((t=>t.listener));let e=hA(t);return this._events.filter((t=>t.tag===e)).map((t=>t.listener))}off(t,e){if(null==e)return this.removeAllListeners(t);const n=[];let r=!1,i=hA(t);return this._events=this._events.filter((t=>t.tag!==i||t.listener!=e||(!!r||(r=!0,n.push(t),!1)))),n.forEach((t=>{this._stopEvent(t)})),this}removeAllListeners(t){let e=[];if(null==t)e=this._events,this._events=[];else{const n=hA(t);this._events=this._events.filter((t=>t.tag!==n||(e.push(t),!1)))}return e.forEach((t=>{this._stopEvent(t)})),this}}var CA=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))};const jA=new jp(iA),DA=["call","estimateGas"];function OA(t,e){if(null==t)return null;if("string"==typeof t.message&&t.message.match("reverted")){const n=Qp(t.data)?t.data:null;if(!e||n)return{message:t.message,data:n}}if("object"==typeof t){for(const n in t){const r=OA(t[n],e);if(r)return r}return null}if("string"==typeof t)try{return OA(JSON.parse(t),e)}catch(t){}return null}function _A(t,e,n){const r=n.transaction||n.signedTransaction;if("call"===t){const t=OA(e,!0);if(t)return t.data;jA.throwError("missing revert data in call exception; Transaction reverted without a reason string",jp.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if("estimateGas"===t){let n=OA(e.body,!1);null==n&&(n=OA(e,!1)),n&&jA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",jp.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:t,transaction:r,error:e})}let i=e.message;throw e.code===jp.errors.SERVER_ERROR&&e.error&&"string"==typeof e.error.message?i=e.error.message:"string"==typeof e.body?i=e.body:"string"==typeof e.responseText&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&jA.throwError("insufficient funds for intrinsic transaction cost",jp.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),i.match(/nonce (is )?too low/i)&&jA.throwError("nonce has already been used",jp.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&jA.throwError("replacement fee too low",jp.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),i.match(/only replay-protected/i)&&jA.throwError("legacy pre-eip-155 transactions not supported",jp.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:r}),DA.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&jA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",jp.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}function zA(t){return new Promise((function(e){setTimeout(e,t)}))}function PA(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function BA(t){return t?t.toLowerCase():t}const RA={};class UA extends sv{constructor(t,e,n){if(super(),t!==RA)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Am(this,"provider",e),null==n&&(n=0),"string"==typeof n?(Am(this,"_address",this.provider.formatter.address(n)),Am(this,"_index",null)):"number"==typeof n?(Am(this,"_index",n),Am(this,"_address",null)):jA.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(t){return jA.throwError("cannot alter JSON-RPC Signer connection",jp.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new WA(RA,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&&jA.throwError("unknown account #"+this._index,jp.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(t[this._index]))))}sendUncheckedTransaction(t){t=xm(t);const e=this.getAddress().then((t=>(t&&(t=t.toLowerCase()),t)));if(null==t.gasLimit){const n=xm(t);n.from=e,t.gasLimit=this.provider.estimateGas(n)}return null!=t.to&&(t.to=Promise.resolve(t.to).then((t=>CA(this,void 0,void 0,(function*(){if(null==t)return null;const e=yield this.provider.resolveName(t);return null==e&&jA.throwArgumentError("provided ENS name resolves to null","tx.to",t),e}))))),Em({tx:Em(t),sender:e}).then((({tx:e,sender:n})=>{null!=e.from?e.from.toLowerCase()!==n&&jA.throwArgumentError("from address mismatch","transaction",t):e.from=n;const r=this.provider.constructor.hexlifyTransaction(e,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((t=>t),(t=>("string"==typeof t.message&&t.message.match(/user denied/i)&&jA.throwError("user rejected transaction",jp.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:e}),_A("sendTransaction",t,r))))}))}signTransaction(t){return jA.throwError("signing transactions is unsupported",jp.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(t){return CA(this,void 0,void 0,(function*(){const e=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(t);try{return yield Gk((()=>CA(this,void 0,void 0,(function*(){const t=yield this.provider.getTransaction(n);if(null!==t)return this.provider._wrapTransaction(t,n,e)}))),{oncePoll:this.provider})}catch(t){throw t.transactionHash=n,t}}))}signMessage(t){return CA(this,void 0,void 0,(function*(){const e="string"==typeof t?Hg(t):t,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[Yp(e),n.toLowerCase()])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&jA.throwError("user rejected signing",jp.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:t}),e}}))}_legacySignMessage(t){return CA(this,void 0,void 0,(function*(){const e="string"==typeof t?Hg(t):t,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),Yp(e)])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&jA.throwError("user rejected signing",jp.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:t}),e}}))}_signTypedData(t,e,n){return CA(this,void 0,void 0,(function*(){const r=yield Yy.resolveNames(t,e,n,(t=>this.provider.resolveName(t))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(Yy.getPayload(r.domain,e,r.value))])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&jA.throwError("user rejected signing",jp.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:e,value:r.value}}),t}}))}unlock(t){return CA(this,void 0,void 0,(function*(){const e=this.provider,n=yield this.getAddress();return e.send("personal_unlockAccount",[n.toLowerCase(),t,null])}))}}class WA extends UA{sendTransaction(t){return this.sendUncheckedTransaction(t).then((t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:e=>this.provider.waitForTransaction(t,e)})))}}const QA={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class FA extends TA{constructor(t,e){let n=e;null==n&&(n=new Promise(((t,e)=>{setTimeout((()=>{this.detectNetwork().then((e=>{t(e)}),(t=>{e(t)}))}),0)}))),super(n),t||(t=Lm(this.constructor,"defaultUrl")()),Am(this,"connection","string"==typeof t?Object.freeze({url:t}):Object.freeze(xm(t))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(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 CA(this,void 0,void 0,(function*(){yield zA(0);let t=null;try{t=yield this.send("eth_chainId",[])}catch(e){try{t=yield this.send("net_version",[])}catch(t){}}if(null!=t){const e=Lm(this.constructor,"getNetwork");try{return e(rm.from(t).toNumber())}catch(e){return jA.throwError("could not detect network",jp.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e})}}return jA.throwError("could not detect network",jp.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(t){return new UA(RA,this,t)}getUncheckedSigner(t){return this.getSigner(t).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((t=>t.map((t=>this.formatter.address(t)))))}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Tm(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(t)>=0;if(r&&this._cache[t])return this._cache[t];const i=qk(this.connection,JSON.stringify(n),PA).then((t=>(this.emit("debug",{action:"response",request:n,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",error:t,request:n,provider:this}),t}));return r&&(this._cache[t]=i,setTimeout((()=>{this._cache[t]=null}),0)),i}prepareRequest(t,e){switch(t){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[BA(e.address),e.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[BA(e.address),e.blockTag]];case"getCode":return["eth_getCode",[BA(e.address),e.blockTag]];case"getStorageAt":return["eth_getStorageAt",[BA(e.address),Zp(e.position,32),e.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[e.signedTransaction]];case"getBlock":return e.blockTag?["eth_getBlockByNumber",[e.blockTag,!!e.includeTransactions]]:e.blockHash?["eth_getBlockByHash",[e.blockHash,!!e.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[e.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[e.transactionHash]];case"call":return["eth_call",[Lm(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0}),e.blockTag]];case"estimateGas":return["eth_estimateGas",[Lm(this.constructor,"hexlifyTransaction")(e.transaction,{from:!0})]];case"getLogs":return e.filter&&null!=e.filter.address&&(e.filter.address=BA(e.filter.address)),["eth_getLogs",[e.filter]]}return null}perform(t,e){return CA(this,void 0,void 0,(function*(){if("call"===t||"estimateGas"===t){const t=e.transaction;if(t&&null!=t.type&&rm.from(t.type).isZero()&&null==t.maxFeePerGas&&null==t.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((e=xm(e)).transaction=xm(t),delete e.transaction.type)}}const n=this.prepareRequest(t,e);null==n&&jA.throwError(t+" not implemented",jp.errors.NOT_IMPLEMENTED,{operation:t});try{return yield this.send(n[0],n[1])}catch(n){return _A(t,n,e)}}))}_startEvent(t){"pending"===t.tag&&this._startPending(),super._startEvent(t)}_startPending(){if(null!=this._pendingFilter)return;const t=this,e=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=e,e.then((function(n){return function r(){t.send("eth_getFilterChanges",[n]).then((function(n){if(t._pendingFilter!=e)return null;let r=Promise.resolve();return n.forEach((function(e){t._emitted["t:"+e.toLowerCase()]="pending",r=r.then((function(){return t.getTransaction(e).then((function(e){return t.emit("pending",e),null}))}))})),r.then((function(){return zA(1e3)}))})).then((function(){if(t._pendingFilter==e)return setTimeout((function(){r()}),0),null;t.send("eth_uninstallFilter",[n])})).catch((t=>{}))}(),n})).catch((t=>{}))}_stopEvent(t){"pending"===t.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(t)}static hexlifyTransaction(t,e){const n=xm(QA);if(e)for(const t in e)e[t]&&(n[t]=!0);var r,i;i=n,(r=t)&&"object"==typeof r||km.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((t=>{i[t]||km.throwArgumentError("invalid object key - "+t,"transaction:"+t,r)}));const o={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(e){if(null==t[e])return;const n=Gp(rm.from(t[e]));"gasLimit"===e&&(e="gas"),o[e]=n})),["from","to","data"].forEach((function(e){null!=t[e]&&(o[e]=Yp(t[e]))})),t.accessList&&(o.accessList=lk(t.accessList)),o}}const YA=new jp(iA);let HA=1;function VA(t,e){const n="Web3LegacyFetcher";return function(t,r){const i={method:t,params:r,id:HA++,jsonrpc:"2.0"};return new Promise(((t,r)=>{this.emit("debug",{action:"request",fetcher:n,request:Tm(i),provider:this}),e(i,((e,o)=>{if(e)return this.emit("debug",{action:"response",fetcher:n,error:e,request:i,provider:this}),r(e);if(this.emit("debug",{action:"response",fetcher:n,request:i,response:o,provider:this}),o.error){const t=new Error(o.error.message);return t.code=o.error.code,t.data=o.error.data,r(t)}t(o.result)}))}))}}class qA extends FA{constructor(t,e){null==t&&YA.throwArgumentError("missing provider","provider",t);let n=null,r=null,i=null;"function"==typeof t?(n="unknown:",r=t):(n=t.host||t.path||"",!n&&t.isMetaMask&&(n="metamask"),i=t,t.request?(""===n&&(n="eip-1193:"),r=function(t){return function(e,n){null==n&&(n=[]);const r={method:e,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:Tm(r),provider:this}),t.request(r).then((t=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:t,provider:this}),t)),(t=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:t,provider:this}),t}))}}(t)):t.sendAsync?r=VA(0,t.sendAsync.bind(t)):t.send?r=VA(0,t.send.bind(t)):YA.throwArgumentError("unsupported provider","provider",t),n||(n="unknown:")),super(n,e),Am(this,"jsonRpcFetchFunc",r),Am(this,"provider",i)}send(t,e){return this.jsonRpcFetchFunc(t,e)}}const GA=new jp("units/5.7.0"),ZA=["wei","kwei","mwei","gwei","szabo","finney","ether"];function JA(t,e){if("string"==typeof e){const t=ZA.indexOf(e);-1!==t&&(e=3*t)}return mm(t,null!=e?e:18)}function XA(t,e){if("string"!=typeof t&&GA.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=ZA.indexOf(e);-1!==t&&(e=3*t)}return gm(t,null!=e?e:18)}let KA,$A=()=>KA||(KA="object"==typeof l?l:window,KA);const tL=()=>(void 0===$A()._Web3ClientConfiguration&&($A()._Web3ClientConfiguration={}),$A()._Web3ClientConfiguration);class eL extends FA{constructor(t,e,n,r){super(t),this._network=e,this._endpoint=t,this._endpoints=n,this._failover=r,this._pendingBatch=[]}detectNetwork(){return Promise.resolve(sp.findByName(this._network).id)}requestChunk(t,e){const n=t.map((t=>t.request));return qk(e,JSON.stringify(n)).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(r.error){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else t.resolve(r.result)}))})).catch((e=>{if(e&&"SERVER_ERROR"==e.code){const e=this._endpoints.indexOf(this._endpoint)+1;this._failover(),this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this.requestChunk(t,this._endpoint)}else t.forEach((t=>{t.reject(e)}))}))}send(t,e){const n={method:t,params:e,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const e=[];for(let n=0;n<Math.ceil(t.length/99);n++)e[n]=t.slice(99*n,99*(n+1));e.forEach((t=>(t.map((t=>t.request)),this.requestChunk(t,this._endpoint))))}),tL().batchInterval||10)),i}}const nL=()=>(null==$A()._Web3ClientProviders&&($A()._Web3ClientProviders={}),$A()._Web3ClientProviders),rL=(t,e)=>{void 0===nL()[t]&&(nL()[t]=[]);const n=nL()[t].indexOf(e);n>-1&&nL()[t].splice(n,1),nL()[t].unshift(e)},iL=async(t,e,n=!0)=>{let r;nL()[t]=e.map(((r,i)=>new eL(r,t,e,(()=>{1===nL()[t].length?iL(t,e,n):nL()[t].splice(i,1)}))));let i=$A();if(null==i.fetch||void 0!==_&&_.env&&"test"==_.env.NODE_ENV||void 0!==i.cy||!1===n)r=nL()[t][0];else{let n=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=nL()[t][o]}rL(t,r)};var oL={getProvider:async t=>{let e=nL();if(e&&e[t])return e[t][0];let n=$A();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[t]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[t]=new Promise((async e=>{await iL(t,sp[t].endpoints),e($A()._Web3ClientProviders[t][0])}))),await n._Web3ClientGetProviderPromise[t]},getProviders:async t=>{let e=nL();if(e&&e[t])return e[t];let n=$A();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[t]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[t]=new Promise((async e=>{await iL(t,sp[t].endpoints),e($A()._Web3ClientProviders[t])}))),await n._Web3ClientGetProvidersPromise[t]},setProviderEndpoints:iL,setProvider:rL};class aL extends vh{constructor(t,e,n,r){super(t),this._provider=new vh(t),this._network=e,this._endpoint=t,this._endpoints=n,this._failover=r,this._pendingBatch=[],this._rpcRequest=this._rpcRequestReplacement.bind(this)}requestChunk(t){const e=t.map((t=>t.request)),n=e=>{if(e&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((t=>e.toString().match(t)))){const e=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this._provider=new vh(this._endpoint),this.requestChunk(t)}else t.forEach((t=>{t.reject(e)}))};try{return this._provider._rpcBatchRequest(e).then((e=>{t.forEach(((t,n)=>{const r=e[n];if(r.error){const e=new Error(r.error.message);e.code=r.error.code,e.data=r.error.data,t.reject(e)}else t.resolve(r)}))})).catch(n)}catch(t){return n(t)}}_rpcRequestReplacement(t,e){const n={methodName:t,args:e};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((t,e)=>{r.resolve=t,r.reject=e}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const t=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const e=[];for(let n=0;n<Math.ceil(t.length/99);n++)e[n]=t.slice(99*n,99*(n+1));e.forEach((t=>(t.map((t=>t.request)),this.requestChunk(t))))}),tL().batchInterval||10)),i}}const sL=()=>(null==$A()._Web3ClientProviders&&($A()._Web3ClientProviders={}),$A()._Web3ClientProviders),uL=(t,e)=>{void 0===sL()[t]&&(sL()[t]=[]);const n=sL()[t].indexOf(e);n>-1&&sL()[t].splice(n,1),sL()[t].unshift(e)},cL=async(t,e,n=!0)=>{let r;sL()[t]=e.map(((r,i)=>new aL(r,t,e,(()=>{1===sL()[t].length?cL(t,e,n):sL()[t].splice(i,1)}))));let i=$A();if(null==i.fetch||void 0!==_&&_.env&&"test"==_.env.NODE_ENV||void 0!==i.cy||!1===n)r=sL()[t][0];else{let n=await Promise.all(e.map((t=>new Promise((async e=>{let n=(new Date).getTime();setTimeout((()=>e(900)),900);if(!(await fetch(t,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"})})).ok)return e(999);let r=(new Date).getTime();e(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=sL()[t][o]}uL(t,r)};var lL={getProvider:async t=>{let e=sL();if(e&&e[t])return e[t][0];let n=$A();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[t]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[t]=new Promise((async e=>{await cL(t,sp[t].endpoints),e($A()._Web3ClientProviders[t][0])}))),await n._Web3ClientGetProviderPromise[t]},getProviders:async t=>{let e=sL();if(e&&e[t])return e[t];let n=$A();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[t]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[t]=new Promise((async e=>{await cL(t,sp[t].endpoints),e($A()._Web3ClientProviders[t])}))),await n._Web3ClientGetProvidersPromise[t]},setProviderEndpoints:cL,setProvider:uL};let hL=["ethereum","bsc","polygon","solana","fantom","velas"];hL.evm=["ethereum","bsc","polygon","fantom","velas"],hL.solana=["solana"];let dL=()=>(null==$A()._Web3ClientCacheStore&&($A()._Web3ClientCacheStore={}),$A()._Web3ClientCacheStore),fL=()=>(null==$A()._Web3ClientPromiseStore&&($A()._Web3ClientPromiseStore={}),$A()._Web3ClientPromiseStore),pL=function({key:t}){fL()[t]=void 0},mL=function({call:t,key:e,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:t}){return fL()[t]}({key:e=JSON.stringify(e)});if(a)return a.then(r).catch(i);(function({key:t,promise:e}){return fL()[t]=e,e})({key:e,promise:new Promise(((a,s)=>0===n?t().then((t=>{r(t),a(t)})).catch((t=>{i(t),s(t)})):(o=function({key:t,expires:e}){let n=dL()[t];if(function(t){let e,n=t[0],r=1;for(;r<t.length;){const i=t[r],o=t[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(e=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...t)=>n.call(e,...t))),e=void 0)}return n}([n,"optionalAccess",t=>t.expiresAt])>Date.now())return n.value}({key:e,expires:n}),o?(r(o),a(o),o):void t().then((t=>{t&&function({key:t,value:e,expires:n}){dL()[t]={expiresAt:Date.now()+n,value:e}}({key:e,value:t,expires:n}),r(t),a(t)})).catch((t=>{i(t),s(t)})))))}).then((()=>{pL({key:e})})).catch((()=>{pL({key:e})}))}))};const gL=async t=>{if(hL.evm.includes(t))return await oL.getProvider(t);if(hL.solana.includes(t))return await lL.getProvider(t);throw"Unknown blockchain: "+t};var yL=({provider:t,from:e,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return t.estimateGas({from:e,to:n,value:r});{let s=new Tk(n,o,t),u=s.estimateGas[i],c=(({contract:t,method:e,params:n})=>{let r=t.interface.fragments.find((t=>t.name==e));return n instanceof Array?n:n instanceof Object?r.inputs.map((t=>n[t.name])):void 0})({contract:s,method:i,params:a});return c?u(...c,{from:e,value:r}):u({from:e,value:r})}};let vL=async function({blockchain:t,from:e,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!hL.includes(t))throw"Unknown blockchain: "+t;void 0===r&&(r="0");const u=await gL(t);return await mL({expires:s||0,key:[t,e,n,r,i,a],call:async()=>yL({provider:u,from:e,to:n,value:r,method:i,api:o,params:a})})};const wL=({address:t,api:e,method:n,params:r,provider:i,block:o})=>{let a=new Tk(t,e,i),s=(({contract:t,method:e,params:n})=>t.interface.fragments.find((t=>t.name==e)).inputs.map(((t,e)=>Array.isArray(n)?n[e]:n[t.name])))({contract:a,method:n,params:r});return a[n](...s,{blockTag:o})},bL=({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a})=>n?wL({address:e,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:t,provider:e})=>e.getBalance(t))({address:e,provider:a}):"transactionCount"===r?(({address:t,provider:e})=>e.getTransactionCount(t))({address:e,provider:a}):void 0;const ML=async({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:a,providers:s})=>{try{if(null==r||"getAccountInfo"===r)return null==n&&(n=jf),await(async({address:t,api:e,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new bu(t));if(a&&a.data)return e.decode(a.data)})({address:e,api:n,method:r,params:i,provider:a,block:o});if("getProgramAccounts"===r)return await a.getProgramAccounts(new bu(e),i).then((t=>n?t.map((t=>(t.data=n.decode(t.account.data),t))):t));if("getTokenAccountBalance"===r)return await a.getTokenAccountBalance(new bu(e));if("latestBlockNumber"===r)return await a.getSlot(i||void 0);if("balance"===r)return await(({address:t,provider:e})=>e.getBalance(new bu(t)))({address:e,provider:a})}catch(u){if(s&&u&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((t=>u.toString().match(t)))){let u=s[s.indexOf(a)+1]||s[0];return ML({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:u,providers:s})}throw u}};const kL=async function(t,e){const{blockchain:n,address:r,method:i}=(t=>{if("object"==typeof t)return t;let e=t.match(/(?<blockchain>\w+):\/\/(?<part1>[\w\d]+)(\/(?<part2>[\w\d]+)*)?/);return null==e.groups.part2?e.groups.part1.match(/\d/)?{blockchain:e.groups.blockchain,address:e.groups.part1}:{blockchain:e.groups.blockchain,method:e.groups.part1}:{blockchain:e.groups.blockchain,address:e.groups.part1,method:e.groups.part2}})(t),{api:o,params:a,cache:s,block:u,timeout:c,strategy:l,cacheKey:h}=("object"==typeof t?t:e)||{};return await mL({expires:s||0,key:h||[n,r,i,a,u],call:async()=>{if(hL.evm.includes(n))return await(async({blockchain:t,address:e,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{if(s=s||tL().strategy||"failover",a=a||tL().timeout||void 0,"fastest"===s)return Promise.race((await oL.getProviders(t)).map((s=>{const u=bL({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s});if(a){const t=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a)));return Promise.race([u,t])}return u})));{const s=await oL.getProvider(t),u=bL({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s});return a?(a=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a))),Promise.race([u,a])):u}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});if(hL.solana.includes(n))return await(async({blockchain:t,address:e,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{s=s||tL().strategy||"failover",a=a||tL().timeout||void 0;const u=await lL.getProviders(t);if("fastest"===s)return Promise.race(u.map((s=>{const u=new Promise((a=>{ML({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s}).then(a)})),c=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a||1e4)));return Promise.race([u,c])})));{const s=await lL.getProvider(t),c=ML({blockchain:t,address:e,api:n,method:r,params:i,block:o,provider:s,providers:u});return a?(a=new Promise(((t,e)=>setTimeout((()=>{e(new Error("Web3ClientTimeout"))}),a))),Promise.race([c,a])):c}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});throw"Unknown blockchain: "+n}})};var AL=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=92)}([function(t,e,n){(function(t){n.d(e,"f",(function(){return s})),n.d(e,"g",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"h",(function(){return l})),n.d(e,"b",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"e",(function(){return f})),n.d(e,"d",(function(){return p})),n.d(e,"o",(function(){return m})),n.d(e,"n",(function(){return g})),n.d(e,"p",(function(){return y})),n.d(e,"A",(function(){return v})),n.d(e,"z",(function(){return w})),n.d(e,"B",(function(){return b})),n.d(e,"v",(function(){return M})),n.d(e,"u",(function(){return k})),n.d(e,"s",(function(){return E})),n.d(e,"r",(function(){return x})),n.d(e,"t",(function(){return N})),n.d(e,"q",(function(){return S})),n.d(e,"m",(function(){return I})),n.d(e,"l",(function(){return T})),n.d(e,"k",(function(){return C})),n.d(e,"j",(function(){return j})),n.d(e,"x",(function(){return O})),n.d(e,"a",(function(){return _})),n.d(e,"y",(function(){return z})),n.d(e,"w",(function(){return P}));var r=n(22),i=n.n(r),o=n(49),a=n.n(o);function s(t){return new Uint8Array(t)}function u(t,e=!1){const n=t.toString("hex");return e?_(n):n}function c(t){return t.toString("utf8")}function l(t){return t.readUIntBE(0,t.length)}function h(t){return a()(t)}function d(t,e=!1){return u(h(t),e)}function f(t){return c(h(t))}function p(t){return l(h(t))}function m(e){return t.from(O(e),"hex")}function g(t){return s(m(t))}function y(t){return c(m(t))}function v(e){return t.from(e,"utf8")}function w(t){return s(v(t))}function b(t,e=!1){return u(v(t),e)}function M(t){return h(L(A(t)))}function k(t){return L(A(t))}function A(t){return D((t>>>0).toString(2))}function L(t){return new Uint8Array(function(t,e=8){const n=D(t).match(new RegExp(`.{${e}}`,"gi"));return Array.from(n||[])}(t).map((t=>parseInt(t,2))))}function E(t,e){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}function x(e){return t.isBuffer(e)}function N(t){return i.a.strict(t)&&!x(t)}function S(t){return!N(t)&&!x(t)&&void 0!==t.byteLength}function I(t){return x(t)?"buffer":N(t)?"typed-array":S(t)?"array-buffer":Array.isArray(t)?"array":typeof t}function T(t){return function(t){return!("string"!=typeof t||!new RegExp(/^[01]+$/).test(t))&&t.length%8==0}(t)?"binary":E(t)?"hex":"utf8"}function C(...e){return t.concat(e)}function j(...t){let e=[];return t.forEach((t=>e=e.concat(Array.from(t)))),new Uint8Array([...e])}function D(t,e=8,n="0"){return function(t,e,n="0"){return function(t,e,n,r="0"){const i=e-t.length;let o=t;if(i>0){const e=r.repeat(i);o=n?e+t:t+e}return o}(t,e,!0,n)}(t,function(t,e=8){const n=t%e;return n?(t-n)/e*e+e:t}(t.length,e),n)}function O(t){return t.replace(/^0x/,"")}function _(t){return t.startsWith("0x")?t:"0x"+t}function z(t){return(t=D(t=O(t),2))&&(t=_(t)),t}function P(t){const e=t.startsWith("0x");return t=(t=O(t)).startsWith("0")?t.substring(1):t,e?_(t):t}}).call(this,n(18).Buffer)},function(t,e,n){n.d(e,"g",(function(){return r.detectEnv})),n.d(e,"r",(function(){return r.isMobile})),n.d(e,"m",(function(){return r.isBrowser})),n.d(e,"k",(function(){return r.getLocation})),n.d(e,"i",(function(){return r.getClientMeta})),n.d(e,"B",(function(){return r.setLocal})),n.d(e,"j",(function(){return r.getLocal})),n.d(e,"A",(function(){return r.removeLocal})),n.d(e,"v",(function(){return r.mobileLinkChoiceKey})),n.d(e,"C",(function(){return o})),n.d(e,"b",(function(){return c})),n.d(e,"c",(function(){return l})),n.d(e,"d",(function(){return h})),n.d(e,"e",(function(){return d})),n.d(e,"f",(function(){return f})),n.d(e,"w",(function(){return E})),n.d(e,"x",(function(){return x})),n.d(e,"z",(function(){return g})),n.d(e,"D",(function(){return y})),n.d(e,"h",(function(){return N})),n.d(e,"u",(function(){return j})),n.d(e,"y",(function(){return D})),n.d(e,"l",(function(){return I})),n.d(e,"a",(function(){return T})),n.d(e,"o",(function(){return w})),n.d(e,"q",(function(){return b})),n.d(e,"p",(function(){return M})),n.d(e,"n",(function(){return k})),n.d(e,"s",(function(){return A})),n.d(e,"t",(function(){return L}));var r=n(21);const i=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],o=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"];var a=n(16),s=n.n(a),u=n(0);function c(t){return u.b(new Uint8Array(t))}function l(t,e){return u.c(new Uint8Array(t),!e)}function h(t){return u.f(t).buffer}function d(t){return u.n(t).buffer}function f(t,e){const n=u.x(u.y(new s.a(t).toString(16)));return e?n:u.a(n)}var p=n(50);function m(t){return u.y(t)}const g=n(51).payloadId;function y(){return((t,e)=>{for(e=t="";t++<36;e+=51*t&52?(15^t?8^Math.random()*(20^t?16:4):4).toString(16):"-");return e})()}function v(t,e){return u.s(t,e)}function w(t){return void 0!==t.method}function b(t){return void 0!==t.result}function M(t){return void 0!==t.error}function k(t){return void 0!==t.event}function A(t){return i.includes(t)||t.startsWith("wc_")}function L(t){return!!t.method.startsWith("wc_")||!o.includes(t.method)}function E(t){var e,n;return(n=t)&&n.length&&!v(t[0])&&(t[0]=(e=t[0],u.B(e,!0))),t}function x(t){if(void 0!==t.type&&"0"!==t.type)return t;if(void 0===t.from||!(e=t.from)||"0x"!==e.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(e)||!/^(0x)?[0-9a-f]{40}$/.test(e)&&!/^(0x)?[0-9A-F]{40}$/.test(e)&&e!==function(t){t=Object(u.x)(t.toLowerCase());const e=Object(u.x)(Object(p.keccak_256)((n=t,u.A(n))));var n;let r="";for(let n=0;n<t.length;n++)parseInt(e[n],16)>7?r+=t[n].toUpperCase():r+=t[n];return Object(u.a)(r)}(e))throw new Error("Transaction object must include a valid 'from' value.");var e;function n(t){let e=t;var n;return("number"==typeof t||"string"==typeof t&&!function(t){return""===t||"string"==typeof t&&""===t.trim()}(t))&&(v(t)?"string"==typeof t&&(e=m(t)):e=f(t)),"string"==typeof e&&(n=e,e=u.w(u.a(n))),e}const r={from:m(t.from),to:void 0===t.to?void 0:m(t.to),gasPrice:void 0===t.gasPrice?"":n(t.gasPrice),gas:void 0===t.gas?void 0===t.gasLimit?"":n(t.gasLimit):n(t.gas),value:void 0===t.value?"":n(t.value),nonce:void 0===t.nonce?"":n(t.nonce),data:void 0===t.data?"":m(t.data)||"0x"},i=["gasPrice","gas","value","nonce"];return Object.keys(r).forEach((t=>{(void 0===r[t]||"string"==typeof r[t]&&!r[t].trim().length)&&i.includes(t)&&delete r[t]})),r}function N(t){const e=t.message||"Failed or Rejected Request";let n=-32e3;if(t&&!t.code)switch(e){case"Parse error":n=-32700;break;case"Invalid request":n=-32600;break;case"Method not found":n=-32601;break;case"Invalid params":n=-32602;break;case"Internal error":n=-32603;break;default:n=-32e3}const r={code:n,message:e};return t.data&&(r.data=t.data),r}var S=n(23);function I(t){const e=-1!==t.indexOf("?")?t.indexOf("?"):void 0;return void 0!==e?t.substr(e):""}function T(t,e){let n=C(t);return n=Object.assign(Object.assign({},n),e),function(t){return S.stringify(t)}(n)}function C(t){return S.parse(t)}function j(t){return void 0!==t.bridge}function D(t){const e=t.indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),i=function(t){const e=t.split("@");return{handshakeTopic:e[0],version:parseInt(e[1],10)}}(t.substring(e+1,n)),o=function(t){const e=C(t);return{key:e.key||"",bridge:e.bridge||""}}(void 0!==n?t.substr(n):"");return Object.assign(Object.assign({protocol:r},i),o)}},function(t,e,n){n.d(e,"b",(function(){return i})),n.d(e,"g",(function(){return o})),n.d(e,"a",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"e",(function(){return u})),n.d(e,"i",(function(){return c})),n.d(e,"j",(function(){return l})),n.d(e,"h",(function(){return r})),n.d(e,"d",(function(){return h})),n.d(e,"c",(function(){return d})),n.d(e,"k",(function(){return f})),n.d(e,"l",(function(){return p}));const r=512,i=256,o=256,a="AES-CBC",s="SHA-"+i,u="HMAC",c="SHA-256",l="SHA-512",h="encrypt",d="decrypt",f="sign",p="verify"},function(t,e,n){n.d(e,"b",(function(){return r})),n.d(e,"d",(function(){return i})),n.d(e,"c",(function(){return o})),n.d(e,"e",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"a",(function(){return u}));const r="INTERNAL_ERROR",i="SERVER_ERROR",o=[-32700,-32600,-32601,-32602,-32603],a=[-32e3,-32099],s={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[r]:{code:-32603,message:"Internal error"},[i]:{code:-32e3,message:"Server error"}},u=i},function(t,e,n){function r(t){let e;return"undefined"!=typeof window&&void 0!==window[t]&&(e=window[t]),e}function i(t){const e=r(t);if(!e)throw new Error(t+" is not defined in Window");return e}Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=void 0,e.getFromWindow=r,e.getFromWindowOrThrow=i,e.getDocumentOrThrow=function(){return i("document")},e.getDocument=function(){return r("document")},e.getNavigatorOrThrow=function(){return i("navigator")},e.getNavigator=function(){return r("navigator")},e.getLocationOrThrow=function(){return i("location")},e.getLocation=function(){return r("location")},e.getCryptoOrThrow=function(){return i("crypto")},e.getCrypto=function(){return r("crypto")},e.getLocalStorageOrThrow=function(){return i("localStorage")},e.getLocalStorage=function(){return r("localStorage")}},function(t,e,n){var r=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n),Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||e.hasOwnProperty(n)||r(e,t,n)};Object.defineProperty(e,"__esModule",{value:!0}),i(n(67),e),i(n(68),e)},function(t,e,n){n.d(e,"b",(function(){return a})),n.d(e,"a",(function(){return s})),n.d(e,"c",(function(){return u})),n.d(e,"d",(function(){return c})),n.d(e,"e",(function(){return l})),n.d(e,"f",(function(){return h}));var r=n(5),i=n(2);async function o(t,e=i.a){return r.getSubtleCrypto().importKey("raw",t,function(t){return t===i.a?{length:i.b,name:i.a}:{hash:{name:i.f},name:i.e}}(e),!0,function(t){return t===i.a?[i.d,i.c]:[i.k,i.l]}(e))}async function a(t,e,n){const a=r.getSubtleCrypto(),s=await o(e,i.a),u=await a.encrypt({iv:t,name:i.a},s,n);return new Uint8Array(u)}async function s(t,e,n){const a=r.getSubtleCrypto(),s=await o(e,i.a),u=await a.decrypt({iv:t,name:i.a},s,n);return new Uint8Array(u)}async function u(t,e){const n=r.getSubtleCrypto(),a=await o(t,i.e),s=await n.sign({length:i.g,name:i.e},a,e);return new Uint8Array(s)}async function c(t,e){const n=r.getSubtleCrypto(),a=await o(t,i.e),s=await n.sign({length:i.h,name:i.e},a,e);return new Uint8Array(s)}async function l(t){const e=r.getSubtleCrypto(),n=await e.digest({name:i.i},t);return new Uint8Array(n)}async function h(t){const e=r.getSubtleCrypto(),n=await e.digest({name:i.j},t);return new Uint8Array(n)}},function(t,e){var n,r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},e.getSymbolTotalCodewords=function(t){return r[t]},e.getBCHDigit=function(t){for(var e=0;0!==t;)e++,t>>>=1;return e},e.setToSJISFunction=function(t){if("function"!=typeof t)throw new Error('"toSJISFunc" is not a valid function.');n=t},e.isKanjiModeEnabled=function(){return void 0!==n},e.toSJIS=function(t){return n(t)}},function(t,e,n){var r=n(44),i=n(45);e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!r.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return i.testNumeric(t)?e.NUMERIC:i.testAlphanumeric(t)?e.ALPHANUMERIC:i.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return function(t){if("string"!=typeof t)throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}(t)}catch(t){return n}}},function(t,e,n){n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a}));var r=n(3);function i(t){return r.c.includes(t)}function o(t){return Object.keys(r.f).includes(t)?r.f[t]:r.f[r.a]}function a(t){return Object.values(r.f).find((e=>e.code===t))||r.f[r.a]}},function(t,e,n){var r=n(19);o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}();var i=o.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function o(t,e,n){return o.TYPED_ARRAY_SUPPORT||this instanceof o?"number"==typeof t?u(this,t):function(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");var i;return i=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),o.TYPED_ARRAY_SUPPORT?i.__proto__=o.prototype:i=c(t,i),i}(t,e,n,r):"string"==typeof e?function(t,e){var n=0|h(e),r=s(t,n),i=r.write(e);return i!==n&&(r=r.slice(0,i)),r}(t,e):function(t,e){if(o.isBuffer(e)){var n=0|a(e.length),r=s(t,n);return 0===r.length||e.copy(r,0,0,n),r}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(i=e.length)!=i?s(t,0):c(t,e);if("Buffer"===e.type&&Array.isArray(e.data))return c(t,e.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}(this,t,e,n):new o(t,e,n)}function a(t){if(t>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function s(t,e){var n;return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(e)).__proto__=o.prototype:(null===(n=t)&&(n=new o(e)),n.length=e),n}function u(t,e){var n=s(t,e<0?0:0|a(e));if(!o.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)n[r]=0;return n}function c(t,e){for(var n=e.length<0?0:0|a(e.length),r=s(t,n),i=0;i<n;i+=1)r[i]=255&e[i];return r}function l(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function h(t){return o.isBuffer(t)?t.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer)?t.byteLength:("string"!=typeof t&&(t=""+t),0===t.length?0:l(t).length)}o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),o.prototype.write=function(t,e,n){void 0===e||void 0===n&&"string"==typeof e?(n=this.length,e=0):isFinite(e)&&(e|=0,isFinite(n)?n|=0:n=void 0);var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");return function(t,e,n,r){return function(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}(l(e,t.length-n),t,n,r)}(this,t,e,n)},o.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),o.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=o.prototype;else{var i=e-t;n=new o(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+t]}return n},o.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,a=r-n;if(this===t&&n<e&&e<r)for(i=a-1;i>=0;--i)t[i+e]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+a),e);return a},o.prototype.fill=function(t,e,n){if("string"==typeof t){if("string"==typeof e?(e=0,n=this.length):"string"==typeof n&&(n=this.length),1===t.length){var r=t.charCodeAt(0);r<256&&(t=r)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var a=o.isBuffer(t)?t:new o(t),s=a.length;for(i=0;i<n-e;++i)this[i+e]=a[i%s]}return this},o.concat=function(t,e){if(!r(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return s(null,0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=u(null,e),a=0;for(n=0;n<t.length;++n){var c=t[n];if(!o.isBuffer(c))throw new TypeError('"list" argument must be an Array of Buffers');c.copy(i,a),a+=c.length}return i},o.byteLength=h,o.prototype._isBuffer=!0,o.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.exports.alloc=function(t){var e=new o(t);return e.fill(0),e},t.exports.from=function(t){return new o(t)}},function(t,e,n){var r=n(34);n.d(e,"randomBytes",(function(){return r.a}));var i=n(35);n.d(e,"aesCbcDecrypt",(function(){return i.a})),n.d(e,"aesCbcEncrypt",(function(){return i.b}));var o=n(36);n.d(e,"hmacSha256Sign",(function(){return o.a})),n(41),n(15),n(2)},function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(t){r=a}}();var u,c=[],l=!1,h=-1;function d(){l&&u&&(l=!1,u.length?c=u.concat(c):h=-1,c.length&&f())}function f(){if(!l){var t=s(d);l=!0;for(var e=c.length;e;){for(u=c,c=[];++h<e;)u&&u[h].run();h=-1,e=c.length}u=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||l||s(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){n.d(e,"a",(function(){return r}));class r{}},function(t,e,n){var r=n(37);n.o(r,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return r.isConstantTime})),n(38);var i=n(39);n.o(i,"isConstantTime")&&n.d(e,"isConstantTime",(function(){return i.isConstantTime}));var o=n(40);n.d(e,"isConstantTime",(function(){return o.a}))},function(t,e,n){(function(t){!function(t,e){function r(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}function o(t,e,n){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(n=e,e=10),this._init(t||0,e||10,n||"be"))}var a;"object"==typeof t?t.exports=o:e.BN=o,o.BN=o,o.wordSize=26;try{a=n(55).Buffer}catch(t){}function s(t,e,n){for(var r=0,i=Math.min(t.length,n),o=e;o<i;o++){var a=t.charCodeAt(o)-48;r<<=4,r|=a>=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return r}function u(t,e,n,r){for(var i=0,o=Math.min(t.length,n),a=e;a<o;a++){var s=t.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initNumber=function(t,e,n){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},o.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===n)for(i=t.length-1,o=0;i>=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i<t.length;i+=3)a=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var n=0;n<this.length;n++)this.words[n]=0;var r,i,o=0;for(n=t.length-6,r=0;n>=e;n-=6)i=s(t,n,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303,(o+=24)>=26&&(o-=26,r++);n+6!==e&&(i=s(t,e,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=e)r++;r--,i=i/e|0;for(var o=t.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(t,l,l+r,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(t,l,t.length,e),l=0;l<a;l++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var c=["","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"],l=[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],h=[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];function d(t,e,n){n.negative=e.negative^t.negative;var r=t.length+e.length|0;n.length=r,r=r-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,e.length-1),f=Math.max(0,c-t.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|t.words[p])*(o=0|e.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(t,e){var n;if(e=0|e||1,16===(t=t||10)||"hex"===t){n="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);n=0!=(o=s>>>24-i&16777215)||a!==this.length-1?c[6-u.length]+u+n:u+n,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(n=o.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var d=l[t],f=h[t];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(f).toString(t);n=(p=p.idivn(f)).isZero()?m+n:c[d-m.length]+m+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),o=n||Math.max(1,i);r(i<=o,"byte array longer than desired length"),r(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,c=new t(o),l=this.clone();if(u){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[s]=a;for(;s<o;s++)c[s]=0}else{for(s=0;s<o-i;s++)c[s]=0;for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),c[o-s-1]=a}return c},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var e=t,n=0;return e>=4096&&(n+=13,e>>>=13),e>=64&&(n+=7,e>>>=7),e>=8&&(n+=4,e>>>=4),e>=2&&(n+=2,e>>>=2),n+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,n=0;return 0==(8191&e)&&(n+=13,e>>>=13),0==(127&e)&&(n+=7,e>>>=7),0==(15&e)&&(n+=4,e>>>=4),0==(3&e)&&(n+=2,e>>>=2),0==(1&e)&&n++,n},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;e<this.length;e++){var n=this._zeroBits(this.words[e]);if(t+=n,26!==n)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},o.prototype.ior=function(t){return r(0==(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var n=0;n<e.length;n++)this.words[n]=this.words[n]&t.words[n];return this.length=e.length,this.strip()},o.prototype.iand=function(t){return r(0==(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,n;this.length>t.length?(e=this,n=t):(e=t,n=this);for(var r=0;r<n.length;r++)this.words[r]=e.words[r]^n.words[r];if(this!==e)for(;r<e.length;r++)this.words[r]=e.words[r];return this.length=e.length,this.strip()},o.prototype.ixor=function(t){return r(0==(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i<e;i++)this.words[i]=67108863&~this.words[i];return n>0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(t){var e,n,r;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();this.length>t.length?(n=this,r=t):(n=t,r=this);for(var i=0,o=0;o<r.length;o++)e=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&e,i=e>>>26;for(;0!==i&&o<n.length;o++)e=(0|n.words[o])+i,this.words[o]=67108863&e,i=e>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},o.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var n,r,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=t):(n=t,r=this);for(var o=0,a=0;a<r.length;a++)o=(e=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&e;for(;0!==o&&a<n.length;a++)o=(e=(0|n.words[a])+o)>>26,this.words[a]=67108863&e;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var f=function(t,e,n){var r,i,o,a=t.words,s=e.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,m=f>>>13,g=0|a[2],y=8191&g,v=g>>>13,w=0|a[3],b=8191&w,M=w>>>13,k=0|a[4],A=8191&k,L=k>>>13,E=0|a[5],x=8191&E,N=E>>>13,S=0|a[6],I=8191&S,T=S>>>13,C=0|a[7],j=8191&C,D=C>>>13,O=0|a[8],_=8191&O,z=O>>>13,P=0|a[9],B=8191&P,R=P>>>13,U=0|s[0],W=8191&U,Q=U>>>13,F=0|s[1],Y=8191&F,H=F>>>13,V=0|s[2],q=8191&V,G=V>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,tt=K>>>13,et=0|s[5],nt=8191&et,rt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ct=st>>>13,lt=0|s[8],ht=8191&lt,dt=lt>>>13,ft=0|s[9],pt=8191&ft,mt=ft>>>13;n.negative=t.negative^e.negative,n.length=19;var gt=(c+(r=Math.imul(h,W))|0)+((8191&(i=(i=Math.imul(h,Q))+Math.imul(d,W)|0))<<13)|0;c=((o=Math.imul(d,Q))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,r=Math.imul(p,W),i=(i=Math.imul(p,Q))+Math.imul(m,W)|0,o=Math.imul(m,Q);var yt=(c+(r=r+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,H)|0)+Math.imul(d,Y)|0))<<13)|0;c=((o=o+Math.imul(d,H)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,r=Math.imul(y,W),i=(i=Math.imul(y,Q))+Math.imul(v,W)|0,o=Math.imul(v,Q),r=r+Math.imul(p,Y)|0,i=(i=i+Math.imul(p,H)|0)+Math.imul(m,Y)|0,o=o+Math.imul(m,H)|0;var vt=(c+(r=r+Math.imul(h,q)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(d,q)|0))<<13)|0;c=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,r=Math.imul(b,W),i=(i=Math.imul(b,Q))+Math.imul(M,W)|0,o=Math.imul(M,Q),r=r+Math.imul(y,Y)|0,i=(i=i+Math.imul(y,H)|0)+Math.imul(v,Y)|0,o=o+Math.imul(v,H)|0,r=r+Math.imul(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,q)|0,o=o+Math.imul(m,G)|0;var wt=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,r=Math.imul(A,W),i=(i=Math.imul(A,Q))+Math.imul(L,W)|0,o=Math.imul(L,Q),r=r+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,H)|0)+Math.imul(M,Y)|0,o=o+Math.imul(M,H)|0,r=r+Math.imul(y,q)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(v,q)|0,o=o+Math.imul(v,G)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,J)|0,o=o+Math.imul(m,X)|0;var bt=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,r=Math.imul(x,W),i=(i=Math.imul(x,Q))+Math.imul(N,W)|0,o=Math.imul(N,Q),r=r+Math.imul(A,Y)|0,i=(i=i+Math.imul(A,H)|0)+Math.imul(L,Y)|0,o=o+Math.imul(L,H)|0,r=r+Math.imul(b,q)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(M,q)|0,o=o+Math.imul(M,G)|0,r=r+Math.imul(y,J)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,o=o+Math.imul(m,tt)|0;var Mt=(c+(r=r+Math.imul(h,nt)|0)|0)+((8191&(i=(i=i+Math.imul(h,rt)|0)+Math.imul(d,nt)|0))<<13)|0;c=((o=o+Math.imul(d,rt)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,r=Math.imul(I,W),i=(i=Math.imul(I,Q))+Math.imul(T,W)|0,o=Math.imul(T,Q),r=r+Math.imul(x,Y)|0,i=(i=i+Math.imul(x,H)|0)+Math.imul(N,Y)|0,o=o+Math.imul(N,H)|0,r=r+Math.imul(A,q)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(L,q)|0,o=o+Math.imul(L,G)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(y,$)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,tt)|0,r=r+Math.imul(p,nt)|0,i=(i=i+Math.imul(p,rt)|0)+Math.imul(m,nt)|0,o=o+Math.imul(m,rt)|0;var kt=(c+(r=r+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;c=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,r=Math.imul(j,W),i=(i=Math.imul(j,Q))+Math.imul(D,W)|0,o=Math.imul(D,Q),r=r+Math.imul(I,Y)|0,i=(i=i+Math.imul(I,H)|0)+Math.imul(T,Y)|0,o=o+Math.imul(T,H)|0,r=r+Math.imul(x,q)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(N,q)|0,o=o+Math.imul(N,G)|0,r=r+Math.imul(A,J)|0,i=(i=i+Math.imul(A,X)|0)+Math.imul(L,J)|0,o=o+Math.imul(L,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,tt)|0,r=r+Math.imul(y,nt)|0,i=(i=i+Math.imul(y,rt)|0)+Math.imul(v,nt)|0,o=o+Math.imul(v,rt)|0,r=r+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(m,ot)|0,o=o+Math.imul(m,at)|0;var At=(c+(r=r+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(d,ut)|0))<<13)|0;c=((o=o+Math.imul(d,ct)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,r=Math.imul(_,W),i=(i=Math.imul(_,Q))+Math.imul(z,W)|0,o=Math.imul(z,Q),r=r+Math.imul(j,Y)|0,i=(i=i+Math.imul(j,H)|0)+Math.imul(D,Y)|0,o=o+Math.imul(D,H)|0,r=r+Math.imul(I,q)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(T,q)|0,o=o+Math.imul(T,G)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(A,$)|0,i=(i=i+Math.imul(A,tt)|0)+Math.imul(L,$)|0,o=o+Math.imul(L,tt)|0,r=r+Math.imul(b,nt)|0,i=(i=i+Math.imul(b,rt)|0)+Math.imul(M,nt)|0,o=o+Math.imul(M,rt)|0,r=r+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,r=r+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,ut)|0,o=o+Math.imul(m,ct)|0;var Lt=(c+(r=r+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;c=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,r=Math.imul(B,W),i=(i=Math.imul(B,Q))+Math.imul(R,W)|0,o=Math.imul(R,Q),r=r+Math.imul(_,Y)|0,i=(i=i+Math.imul(_,H)|0)+Math.imul(z,Y)|0,o=o+Math.imul(z,H)|0,r=r+Math.imul(j,q)|0,i=(i=i+Math.imul(j,G)|0)+Math.imul(D,q)|0,o=o+Math.imul(D,G)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(T,J)|0,o=o+Math.imul(T,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,tt)|0,r=r+Math.imul(A,nt)|0,i=(i=i+Math.imul(A,rt)|0)+Math.imul(L,nt)|0,o=o+Math.imul(L,rt)|0,r=r+Math.imul(b,ot)|0,i=(i=i+Math.imul(b,at)|0)+Math.imul(M,ot)|0,o=o+Math.imul(M,at)|0,r=r+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ct)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ct)|0,r=r+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(m,ht)|0,o=o+Math.imul(m,dt)|0;var Et=(c+(r=r+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(d,pt)|0))<<13)|0;c=((o=o+Math.imul(d,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,r=Math.imul(B,Y),i=(i=Math.imul(B,H))+Math.imul(R,Y)|0,o=Math.imul(R,H),r=r+Math.imul(_,q)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(z,q)|0,o=o+Math.imul(z,G)|0,r=r+Math.imul(j,J)|0,i=(i=i+Math.imul(j,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(T,$)|0,o=o+Math.imul(T,tt)|0,r=r+Math.imul(x,nt)|0,i=(i=i+Math.imul(x,rt)|0)+Math.imul(N,nt)|0,o=o+Math.imul(N,rt)|0,r=r+Math.imul(A,ot)|0,i=(i=i+Math.imul(A,at)|0)+Math.imul(L,ot)|0,o=o+Math.imul(L,at)|0,r=r+Math.imul(b,ut)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(M,ut)|0,o=o+Math.imul(M,ct)|0,r=r+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var xt=(c+(r=r+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((o=o+Math.imul(m,mt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,r=Math.imul(B,q),i=(i=Math.imul(B,G))+Math.imul(R,q)|0,o=Math.imul(R,G),r=r+Math.imul(_,J)|0,i=(i=i+Math.imul(_,X)|0)+Math.imul(z,J)|0,o=o+Math.imul(z,X)|0,r=r+Math.imul(j,$)|0,i=(i=i+Math.imul(j,tt)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,tt)|0,r=r+Math.imul(I,nt)|0,i=(i=i+Math.imul(I,rt)|0)+Math.imul(T,nt)|0,o=o+Math.imul(T,rt)|0,r=r+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,r=r+Math.imul(A,ut)|0,i=(i=i+Math.imul(A,ct)|0)+Math.imul(L,ut)|0,o=o+Math.imul(L,ct)|0,r=r+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,dt)|0)+Math.imul(M,ht)|0,o=o+Math.imul(M,dt)|0;var Nt=(c+(r=r+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,mt)|0)+Math.imul(v,pt)|0))<<13)|0;c=((o=o+Math.imul(v,mt)|0)+(i>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(_,$)|0,i=(i=i+Math.imul(_,tt)|0)+Math.imul(z,$)|0,o=o+Math.imul(z,tt)|0,r=r+Math.imul(j,nt)|0,i=(i=i+Math.imul(j,rt)|0)+Math.imul(D,nt)|0,o=o+Math.imul(D,rt)|0,r=r+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(T,ot)|0,o=o+Math.imul(T,at)|0,r=r+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ct)|0,r=r+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,dt)|0)+Math.imul(L,ht)|0,o=o+Math.imul(L,dt)|0;var St=(c+(r=r+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,mt)|0)+Math.imul(M,pt)|0))<<13)|0;c=((o=o+Math.imul(M,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(R,$)|0,o=Math.imul(R,tt),r=r+Math.imul(_,nt)|0,i=(i=i+Math.imul(_,rt)|0)+Math.imul(z,nt)|0,o=o+Math.imul(z,rt)|0,r=r+Math.imul(j,ot)|0,i=(i=i+Math.imul(j,at)|0)+Math.imul(D,ot)|0,o=o+Math.imul(D,at)|0,r=r+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ct)|0)+Math.imul(T,ut)|0,o=o+Math.imul(T,ct)|0,r=r+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var It=(c+(r=r+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(L,pt)|0))<<13)|0;c=((o=o+Math.imul(L,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,r=Math.imul(B,nt),i=(i=Math.imul(B,rt))+Math.imul(R,nt)|0,o=Math.imul(R,rt),r=r+Math.imul(_,ot)|0,i=(i=i+Math.imul(_,at)|0)+Math.imul(z,ot)|0,o=o+Math.imul(z,at)|0,r=r+Math.imul(j,ut)|0,i=(i=i+Math.imul(j,ct)|0)+Math.imul(D,ut)|0,o=o+Math.imul(D,ct)|0,r=r+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(T,ht)|0,o=o+Math.imul(T,dt)|0;var Tt=(c+(r=r+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(N,pt)|0))<<13)|0;c=((o=o+Math.imul(N,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,r=Math.imul(B,ot),i=(i=Math.imul(B,at))+Math.imul(R,ot)|0,o=Math.imul(R,at),r=r+Math.imul(_,ut)|0,i=(i=i+Math.imul(_,ct)|0)+Math.imul(z,ut)|0,o=o+Math.imul(z,ct)|0,r=r+Math.imul(j,ht)|0,i=(i=i+Math.imul(j,dt)|0)+Math.imul(D,ht)|0,o=o+Math.imul(D,dt)|0;var Ct=(c+(r=r+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,mt)|0)+Math.imul(T,pt)|0))<<13)|0;c=((o=o+Math.imul(T,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,r=Math.imul(B,ut),i=(i=Math.imul(B,ct))+Math.imul(R,ut)|0,o=Math.imul(R,ct),r=r+Math.imul(_,ht)|0,i=(i=i+Math.imul(_,dt)|0)+Math.imul(z,ht)|0,o=o+Math.imul(z,dt)|0;var jt=(c+(r=r+Math.imul(j,pt)|0)|0)+((8191&(i=(i=i+Math.imul(j,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((o=o+Math.imul(D,mt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(B,ht),i=(i=Math.imul(B,dt))+Math.imul(R,ht)|0,o=Math.imul(R,dt);var Dt=(c+(r=r+Math.imul(_,pt)|0)|0)+((8191&(i=(i=i+Math.imul(_,mt)|0)+Math.imul(z,pt)|0))<<13)|0;c=((o=o+Math.imul(z,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var Ot=(c+(r=Math.imul(B,pt))|0)+((8191&(i=(i=Math.imul(B,mt))+Math.imul(R,pt)|0))<<13)|0;return c=((o=Math.imul(R,mt))+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,u[0]=gt,u[1]=yt,u[2]=vt,u[3]=wt,u[4]=bt,u[5]=Mt,u[6]=kt,u[7]=At,u[8]=Lt,u[9]=Et,u[10]=xt,u[11]=Nt,u[12]=St,u[13]=It,u[14]=Tt,u[15]=Ct,u[16]=jt,u[17]=Dt,u[18]=Ot,0!==c&&(u[19]=c,n.length++),n};function p(t,e,n){return(new m).mulp(t,e,n)}function m(t,e){this.x=t,this.y=e}Math.imul||(f=d),o.prototype.mulTo=function(t,e){var n=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,e):n<63?d(this,t,e):n<1024?function(t,e,n){n.negative=e.negative^t.negative,n.length=t.length+e.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,e.length-1),c=Math.max(0,o-t.length+1);c<=u;c++){var l=o-c,h=(0|t.words[l])*(0|e.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n.strip()}(this,t,e):p(this,t,e)},m.prototype.makeRBT=function(t){for(var e=new Array(t),n=o.prototype._countBits(t)-1,r=0;r<t;r++)e[r]=this.revBin(r,n,t);return e},m.prototype.revBin=function(t,e,n){if(0===t||t===n-1)return t;for(var r=0,i=0;i<e;i++)r|=(1&t)<<e-i-1,t>>=1;return r},m.prototype.permute=function(t,e,n,r,i,o){for(var a=0;a<o;a++)r[a]=e[t[a]],i[a]=n[t[a]]},m.prototype.transform=function(t,e,n,r,i,o){this.permute(o,t,e,n,r,i);for(var a=1;a<i;a<<=1)for(var s=a<<1,u=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),l=0;l<i;l+=s)for(var h=u,d=c,f=0;f<a;f++){var p=n[l+f],m=r[l+f],g=n[l+f+a],y=r[l+f+a],v=h*g-d*y;y=h*y+d*g,g=v,n[l+f]=p+g,r[l+f]=m+y,n[l+f+a]=p-g,r[l+f+a]=m-y,f!==s&&(v=u*h-c*d,d=u*d+c*h,h=v)}},m.prototype.guessLen13b=function(t,e){var n=1|Math.max(e,t),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},m.prototype.conjugate=function(t,e,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=t[r];t[r]=t[n-r-1],t[n-r-1]=i,i=e[r],e[r]=-e[n-r-1],e[n-r-1]=-i}},m.prototype.normalize13b=function(t,e){for(var n=0,r=0;r<e/2;r++){var i=8192*Math.round(t[2*r+1]/e)+Math.round(t[2*r]/e)+n;t[r]=67108863&i,n=i<67108864?0:i/67108864|0}return t},m.prototype.convert13b=function(t,e,n,i){for(var o=0,a=0;a<e;a++)o+=0|t[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*e;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},m.prototype.stub=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=0;return e},m.prototype.mulp=function(t,e,n){var r=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(r),o=this.stub(r),a=new Array(r),s=new Array(r),u=new Array(r),c=new Array(r),l=new Array(r),h=new Array(r),d=n.words;d.length=r,this.convert13b(t.words,t.length,a,r),this.convert13b(e.words,e.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,h,r,i);for(var f=0;f<r;f++){var p=s[f]*l[f]-u[f]*h[f];u[f]=s[f]*h[f]+u[f]*l[f],s[f]=p}return this.conjugate(s,u,r),this.transform(s,u,d,o,r,i),this.conjugate(d,o,r),this.normalize13b(d,r),n.negative=t.negative^e.negative,n.length=t.length+e.length,n.strip()},o.prototype.mul=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},o.prototype.mulf=function(t){var e=new o(null);return e.words=new Array(this.length+t.length),p(this,t,e)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){r("number"==typeof t),r(t<67108864);for(var e=0,n=0;n<this.length;n++){var i=(0|this.words[n])*t,o=(67108863&i)+(67108863&e);e>>=26,e+=i/67108864|0,e+=o>>>26,this.words[n]=67108863&o}return 0!==e&&(this.words[n]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),n=0;n<e.length;n++){var r=n/26|0,i=n%26;e[n]=(t.words[r]&1<<i)>>>i}return e}(t);if(0===e.length)return new o(1);for(var n=this,r=0;r<e.length&&0===e[r];r++,n=n.sqr());if(++r<e.length)for(var i=n.sqr();r<e.length;r++,i=i.sqr())0!==e[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(t){r("number"==typeof t&&t>=0);var e,n=t%26,i=(t-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(e=0;e<this.length;e++){var s=this.words[e]&o,u=(0|this.words[e])-s<<n;this.words[e]=u|a,a=s>>>26-n}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e<i;e++)this.words[e]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return r(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,e,n){var i;r("number"==typeof t&&t>=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<<o,u=n;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<<e;return!(this.length<=n||!(this.words[n]&i))},o.prototype.imaskn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<<e;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return r("number"==typeof t),r(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[e]>=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,e,n){var i,o,a=t.length+n;this._expand(a);var s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+n])+s;var u=(0|t.words[i])*e;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+n]=67108863&o}for(;i<this.length-n;i++)s=(o=(0|this.words[i+n])+s)>>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var n=(this.length,t.length),r=this.clone(),i=t,a=0|i.words[i.length-1];0!=(n=26-this._countBits(a))&&(i=i.ushln(n),r.iushln(n),a=0|i.words[i.length-1]);var s,u=r.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(i,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[i.length+h])+(0|r.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(i,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(i,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),r.strip(),"div"!==e&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var n=0!==e.div.negative?e.mod.isub(t):e.mod,r=t.ushrn(1),i=t.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},o.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),h=e.clone();!e.isZero();){for(var d=0,f=1;0==(e.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,m=1;0==(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(n)>=0?(e.isub(n),i.isub(s),a.isub(u)):(n.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(e.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(e.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(n.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s)):(n.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),n=t.clone();e.negative=0,n.negative=0;for(var r=0;e.isEven()&&n.isEven();r++)e.iushrn(1),n.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=e.cmp(n);if(i<0){var o=e;e=n,n=o}else if(0===i||0===n.cmpn(1))break;e.isub(n)}return n.iushln(r)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<<e;if(this.length<=n)return this._expand(n+1),this.words[n]|=i,this;for(var o=i,a=n;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:i<t?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|t.words[n];if(r!==i){r<i?e=-1:r>i&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new k(t)},o.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function k(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function A(t){k.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(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)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,n=t;do{this.split(n,this.tmp),e=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(e>this.n);var r=e<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):n.strip(),n},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(v,y),v.prototype.split=function(t,e){for(var n=Math.min(t.length,9),r=0;r<n;r++)e.words[r]=t.words[r];if(e.length=n,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,r=10;r<t.length;r++){var o=0|t.words[r];t.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,t.words[r-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,n=0;n<t.length;n++){var r=0|t.words[n];e+=977*r,t.words[n]=67108863&e,e=64*r+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(w,y),i(b,y),i(M,y),M.prototype.imulK=function(t){for(var e=0,n=0;n<t.length;n++){var r=19*(0|t.words[n])+e,i=67108863&r;r>>>=26,t.words[n]=i,e=r}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new w;else if("p192"===t)e=new b;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new M}return g[t]=e,e},k.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},k.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},k.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},k.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},k.prototype.add=function(t,e){this._verify2(t,e);var n=t.add(e);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},k.prototype.iadd=function(t,e){this._verify2(t,e);var n=t.iadd(e);return n.cmp(this.m)>=0&&n.isub(this.m),n},k.prototype.sub=function(t,e){this._verify2(t,e);var n=t.sub(e);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},k.prototype.isub=function(t,e){this._verify2(t,e);var n=t.isub(e);return n.cmpn(0)<0&&n.iadd(this.m),n},k.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},k.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},k.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},k.prototype.isqr=function(t){return this.imul(t,t.clone())},k.prototype.sqr=function(t){return this.mul(t,t)},k.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new o(1)).iushrn(2);return this.pow(t,n)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);r(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new o(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,i),d=this.pow(t,i.addn(1).iushrn(1)),f=this.pow(t,i),p=a;0!==f.cmp(s);){for(var m=f,g=0;0!==m.cmp(s);g++)m=m.redSqr();r(g<p);var y=this.pow(h,new o(1).iushln(p-g-1));d=d.redMul(y),h=y.redSqr(),f=f.redMul(h),p=g}return d},k.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},k.prototype.pow=function(t,e){if(e.isZero())return new o(1).toRed(this);if(0===e.cmpn(1))return t.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=t;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],t);var i=n[0],a=0,s=0,u=e.bitLength()%26;for(0===u&&(u=26),r=e.length-1;r>=0;r--){for(var c=e.words[r],l=u-1;l>=0;l--){var h=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},k.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},k.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new A(t)},i(A,k),A.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},A.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},A.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var n=t.imul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},A.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var n=t.mul(e),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},A.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(t,this)}).call(this,n(54)(t))},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});const r=n(60);r.__exportStar(n(61),e),r.__exportStar(n(62),e)},function(t,e,n){(function(t){
9
9
  /*!
10
10
  * The buffer module from node.js, for the browser.