@depay/widgets 12.3.9 → 12.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.bundle.js
CHANGED
|
@@ -6,7 +6,7 @@ z=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="functio
|
|
|
6
6
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
7
7
|
!function(e,t){var n=On,r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=o),o.prototype=Object.create(r.prototype),i(r,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(qn,qn.exports);var Zn=qn.exports.Buffer;var Jn=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var r=0;r<e.length;r++){var i=e.charAt(r),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=r}var a=e.length,s=e.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return Zn.alloc(0);for(var n=0,r=0,i=0;e[n]===s;)r++,n++;for(var o=(e.length-n)*u+1>>>0,c=new Uint8Array(o);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var d=0,h=o-1;(0!==l||d<i)&&-1!==h;h--,d++)l+=a*c[h]>>>0,c[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,n++}for(var p=o-i;p!==o&&0===c[p];)p++;var f=Zn.allocUnsafe(r+(o-p));f.fill(0,0,r);for(var y=r;p!==o;)f[y++]=c[p++];return f}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=Zn.from(t)),!Zn.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var d=t[i],h=0,p=u-1;(0!==d||h<r)&&-1!==p;p--,h++)d+=256*l[p]>>>0,l[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=h,i++}for(var f=u-r;f!==u&&0===l[f];)f++;for(var y=s.repeat(n);f<u;++f)y+=e.charAt(l[f]);return y},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+a+" character")}}},Xn=Jn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function Kn(e,t,n){return t<=e&&e<=n}function $n(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function er(e){this.tokens=[].slice.call(e)}er.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.shift());else this.tokens.push(e)}};var tr=-1;function nr(e,t){if(e)throw TypeError("Decoder error");return t||65533}var rr="utf-8";function ir(e,t){if(!(this instanceof ir))return new ir(e,t);if((e=void 0!==e?String(e).toLowerCase():rr)!==rr)throw new Error("Encoding not supported. Only utf-8 is supported");t=$n(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(t.fatal),this._ignoreBOM=Boolean(t.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function or(e,t){if(!(this instanceof or))return new or(e,t);if((e=void 0!==e?String(e).toLowerCase():rr)!==rr)throw new Error("Encoding not supported. Only utf-8 is supported");t=$n(t),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(t.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function ar(e){var t=e.fatal,n=0,r=0,i=0,o=128,a=191;this.handler=function(e,s){if(-1===s&&0!==i)return i=0,nr(t);if(-1===s)return tr;if(0===i){if(Kn(s,0,127))return s;if(Kn(s,194,223))i=1,n=s-192;else if(Kn(s,224,239))224===s&&(o=160),237===s&&(a=159),i=2,n=s-224;else{if(!Kn(s,240,244))return nr(t);240===s&&(o=144),244===s&&(a=143),i=3,n=s-240}return n<<=6*i,null}if(!Kn(s,o,a))return n=i=r=0,o=128,a=191,e.prepend(s),nr(t);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 sr(e){e.fatal,this.handler=function(e,t){if(-1===t)return tr;if(Kn(t,0,127))return t;var n,r;Kn(t,128,2047)?(n=1,r=192):Kn(t,2048,65535)?(n=2,r=224):Kn(t,65536,1114111)&&(n=3,r=240);for(var i=[(t>>6*n)+r];n>0;){var o=t>>6*(n-1);i.push(128|63&o),n-=1}return i}}ir.prototype={decode:function(e,t){var n;n="object"===_(e)&&e instanceof ArrayBuffer?new Uint8Array(e):"object"===_(e)&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=$n(t),this._streaming||(this._decoder=new ar({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(t.stream);for(var r,i=new er(n),o=[];!i.endOfStream()&&(r=this._decoder.handler(i,i.read()))!==tr;)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()))===tr)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(e){for(var t="",n=0;n<e.length;++n){var r=e[n];r<=65535?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode(55296+(r>>10),56320+(1023&r)))}return t}(o)}},or.prototype={encode:function(e,t){e=e?String(e):"",t=$n(t),this._streaming||(this._encoder=new sr(this._options)),this._streaming=Boolean(t.stream);for(var n,r=[],i=new er(function(e){for(var t=String(e),n=t.length,r=0,i=[];r<n;){var o=t.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=e.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}(e));!i.endOfStream()&&(n=this._encoder.handler(i,i.read()))!==tr;)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;(n=this._encoder.handler(i,i.read()))!==tr;)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}};var ur=C(Object.freeze({__proto__:null,TextEncoder:or,TextDecoder:ir})),cr=S&&S.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),lr=S&&S.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),dr=S&&S.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":_(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},hr=S&&S.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.hasOwnProperty.call(e,n)&&cr(t,e,n);return lr(t,e),t},pr=S&&S.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gn,"__esModule",{value:!0});var fr=Gn.deserializeUnchecked=Sr=Gn.deserialize=kr=Gn.serialize=Gn.BinaryReader=Gn.BinaryWriter=Gn.BorshError=Gn.baseDecode=Gn.baseEncode=void 0,yr=pr(Dn.exports),mr=pr(Xn),gr=hr(ur),vr=new("function"!=typeof TextDecoder?gr.TextDecoder:TextDecoder)("utf-8",{fatal:!0});Gn.baseEncode=function(e){return"string"==typeof e&&(e=Ee.from(e,"utf8")),mr.default.encode(Ee.from(e))},Gn.baseDecode=function(e){return Ee.from(mr.default.decode(e))};var wr=1024,br=function(e){Y(n,q(Error));var t=X(n);function n(e){var r;return B(this,n),(r=t.call(this,e)).fieldPath=[],r.originalMessage=e,r}return W(n,[{key:"addToFieldPath",value:function(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}]),n}();Gn.BorshError=br;var Mr=function(){function e(){B(this,e),this.buf=Ee.alloc(wr),this.length=0}return W(e,[{key:"maybeResize",value:function(){this.buf.length<16+this.length&&(this.buf=Ee.concat([this.buf,Ee.alloc(wr)]))}},{key:"writeU8",value:function(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}},{key:"writeU16",value:function(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}},{key:"writeU32",value:function(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}},{key:"writeU64",value:function(e){this.maybeResize(),this.writeBuffer(Ee.from(new yr.default(e).toArray("le",8)))}},{key:"writeU128",value:function(e){this.maybeResize(),this.writeBuffer(Ee.from(new yr.default(e).toArray("le",16)))}},{key:"writeU256",value:function(e){this.maybeResize(),this.writeBuffer(Ee.from(new yr.default(e).toArray("le",32)))}},{key:"writeU512",value:function(e){this.maybeResize(),this.writeBuffer(Ee.from(new yr.default(e).toArray("le",64)))}},{key:"writeBuffer",value:function(e){this.buf=Ee.concat([Ee.from(this.buf.subarray(0,this.length)),e,Ee.alloc(wr)]),this.length+=e.length}},{key:"writeString",value:function(e){this.maybeResize();var t=Ee.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}},{key:"writeFixedArray",value:function(e){this.writeBuffer(Ee.from(e))}},{key:"writeArray",value:function(e,t){this.maybeResize(),this.writeU32(e.length);var n,r=ae(e);try{for(r.s();!(n=r.n()).done;){var i=n.value;this.maybeResize(),t(i)}}catch(e){r.e(e)}finally{r.f()}}},{key:"toArray",value:function(){return this.buf.subarray(0,this.length)}}]),e}();function Ar(e,t,n){var r=n.value;n.value=function(){try{for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return r.apply(this,t)}catch(e){if(e instanceof RangeError){var i=e.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(i)>=0)throw new br("Reached the end of buffer when deserializing")}throw e}}}Gn.BinaryWriter=Mr;var Er=function(){function e(t){B(this,e),this.buf=t,this.offset=0}return W(e,[{key:"readU8",value:function(){var e=this.buf.readUInt8(this.offset);return this.offset+=1,e}},{key:"readU16",value:function(){var e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}},{key:"readU32",value:function(){var e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}},{key:"readU64",value:function(){var e=this.readBuffer(8);return new yr.default(e,"le")}},{key:"readU128",value:function(){var e=this.readBuffer(16);return new yr.default(e,"le")}},{key:"readU256",value:function(){var e=this.readBuffer(32);return new yr.default(e,"le")}},{key:"readU512",value:function(){var e=this.readBuffer(64);return new yr.default(e,"le")}},{key:"readBuffer",value:function(e){if(this.offset+e>this.buf.length)throw new br("Expected buffer length ".concat(e," isn't within bounds"));var t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"readString",value:function(){var e=this.readU32(),t=this.readBuffer(e);try{return vr.decode(t)}catch(e){throw new br("Error decoding UTF-8 string: ".concat(e))}}},{key:"readFixedArray",value:function(e){return new Uint8Array(this.readBuffer(e))}},{key:"readArray",value:function(e){for(var t=this.readU32(),n=Array(),r=0;r<t;++r)n.push(e());return n}}]),e}();function Nr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Tr(e,t,n,r,i){try{if("string"==typeof r)i["write".concat(Nr(r))](n);else if(r instanceof Array)if("number"==typeof r[0]){if(n.length!==r[0])throw new br("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 br("Expecting byte array of length ".concat(r[1],", but got ").concat(n.length," bytes"));for(var o=0;o<r[1];o++)Tr(e,null,n[o],r[0],i)}else i.writeArray(n,(function(n){Tr(e,t,n,r[0],i)}));else if(void 0!==r.kind)switch(r.kind){case"option":null==n?i.writeU8(0):(i.writeU8(1),Tr(e,t,n,r.type,i));break;case"map":i.writeU32(n.size),n.forEach((function(n,o){Tr(e,t,o,r.key,i),Tr(e,t,n,r.value,i)}));break;default:throw new br("FieldType ".concat(r," unrecognized"))}else Ir(e,n,i)}catch(e){throw e instanceof br&&e.addToFieldPath(t),e}}function Ir(e,t,n){if("function"!=typeof t.borshSerialize){var r=e.get(t.constructor);if(!r)throw new br("Class ".concat(t.constructor.name," is missing in schema"));if("struct"===r.kind)r.fields.map((function(r){var i=$(r,2),o=i[0],a=i[1];Tr(e,o,t[o],a,n)}));else{if("enum"!==r.kind)throw new br("Unexpected schema kind: ".concat(r.kind," for ").concat(t.constructor.name));for(var i=t[r.field],o=0;o<r.values.length;++o){var a=$(r.values[o],2),s=a[0],u=a[1];if(s===i){n.writeU8(o),Tr(e,s,t[s],u,n);break}}}}else t.borshSerialize(n)}dr([Ar],Er.prototype,"readU8",null),dr([Ar],Er.prototype,"readU16",null),dr([Ar],Er.prototype,"readU32",null),dr([Ar],Er.prototype,"readU64",null),dr([Ar],Er.prototype,"readU128",null),dr([Ar],Er.prototype,"readU256",null),dr([Ar],Er.prototype,"readU512",null),dr([Ar],Er.prototype,"readString",null),dr([Ar],Er.prototype,"readFixedArray",null),dr([Ar],Er.prototype,"readArray",null),Gn.BinaryReader=Er;var kr=Gn.serialize=function(e,t){var n=new(arguments.length>2&&void 0!==arguments[2]?arguments[2]:Mr);return Ir(e,t,n),n.toArray()};function Lr(e,t,n,r){try{if("string"==typeof n)return r["read".concat(Nr(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(Lr(e,null,n[0],r));return i}return r.readArray((function(){return Lr(e,t,n[0],r)}))}if("option"===n.kind)return r.readU8()?Lr(e,t,n.type,r):void 0;if("map"===n.kind){for(var a=new Map,s=r.readU32(),u=0;u<s;u++){var c=Lr(e,t,n.key,r),l=Lr(e,t,n.value,r);a.set(c,l)}return a}return xr(e,n,r)}catch(e){throw e instanceof br&&e.addToFieldPath(t),e}}function xr(e,t,n){if("function"==typeof t.borshDeserialize)return t.borshDeserialize(n);var r=e.get(t);if(!r)throw new br("Class ".concat(t.name," is missing in schema"));if("struct"===r.kind){var i,o={},a=ae(e.get(t).fields);try{for(a.s();!(i=a.n()).done;){var s=$(i.value,2),u=s[0],c=s[1];o[u]=Lr(e,u,c,n)}}catch(e){a.e(e)}finally{a.f()}return new t(o)}if("enum"===r.kind){var l=n.readU8();if(l>=r.values.length)throw new br("Enum index: ".concat(l," is out of range"));var d=$(r.values[l],2),h=d[0];return new t(Q({},h,Lr(e,h,d[1],n)))}throw new br("Unexpected schema kind: ".concat(r.kind," for ").concat(t.constructor.name))}var Sr=Gn.deserialize=function(e,t,n){var r=new(arguments.length>3&&void 0!==arguments[3]?arguments[3]:Er)(n),i=xr(e,t,r);if(r.offset<n.length)throw new br("Unexpected ".concat(n.length-r.offset," bytes after deserialized data"));return i};fr=Gn.deserializeUnchecked=function(e,t,n){return xr(e,t,new(arguments.length>3&&void 0!==arguments[3]?arguments[3]:Er)(n))};var jr={};Object.defineProperty(jr,"__esModule",{value:!0}),jr.s16=jr.s8=jr.nu64be=jr.u48be=jr.u40be=jr.u32be=jr.u24be=jr.u16be=wi=jr.nu64=jr.u48=jr.u40=vi=jr.u32=jr.u24=gi=jr.u16=mi=jr.u8=yi=jr.offset=jr.greedy=jr.Constant=jr.UTF8=jr.CString=jr.Blob=jr.Boolean=jr.BitField=jr.BitStructure=jr.VariantLayout=jr.Union=jr.UnionLayoutDiscriminator=jr.UnionDiscriminator=jr.Structure=jr.Sequence=jr.DoubleBE=jr.Double=jr.FloatBE=jr.Float=jr.NearInt64BE=jr.NearInt64=jr.NearUInt64BE=jr.NearUInt64=jr.IntBE=jr.Int=jr.UIntBE=jr.UInt=jr.OffsetLayout=jr.GreedyCount=jr.ExternalLayout=jr.bindConstructorLayout=jr.nameWithProperty=jr.Layout=jr.uint8ArrayToBuffer=jr.checkUint8Array=void 0,jr.constant=jr.utf8=jr.cstr=Ei=jr.blob=jr.unionLayoutDiscriminator=jr.union=Ai=jr.seq=jr.bits=Mi=jr.struct=jr.f64be=jr.f64=jr.f32be=jr.f32=jr.ns64be=jr.s48be=jr.s40be=jr.s32be=jr.s24be=jr.s16be=bi=jr.ns64=jr.s48=jr.s40=jr.s32=jr.s24=void 0;var Cr=On;function Dr(e){if(!(e instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function Or(e){return Dr(e),Cr.Buffer.from(e.buffer,e.byteOffset,e.length)}jr.checkUint8Array=Dr,jr.uint8ArrayToBuffer=Or;var zr=function(){function e(t,n){if(B(this,e),!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=n}return W(e,[{key:"makeDestinationObject",value:function(){return{}}},{key:"getSpan",value:function(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(e){var t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}},{key:"fromArray",value:function(e){}}]),e}();function _r(e,t){return t.property?e+"["+t.property+"]":e}jr.Layout=zr,jr.nameWithProperty=_r,jr.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(e,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof zr))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=function(){return new e},Object.defineProperty(e.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(e,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};var Pr=function(e){Y(n,zr);var t=X(n);function n(){return B(this,n),t.apply(this,arguments)}return W(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}();jr.ExternalLayout=Pr;var Rr=function(e){Y(n,Pr);var t=X(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,i=arguments.length>1?arguments[1]:void 0;if(B(this,n),!Number.isInteger(r)||0>=r)throw new TypeError("elementSpan must be a (positive) integer");return(e=t.call(this,-1,i)).elementSpan=r,e}return W(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Dr(e);var n=e.length-t;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(e,t,n){return 0}}]),n}();jr.GreedyCount=Rr;var Br=function(e){Y(n,Pr);var t=X(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2?arguments[2]:void 0;if(B(this,n),!(e instanceof zr))throw new TypeError("layout must be a Layout");if(!Number.isInteger(i))throw new TypeError("offset must be integer or undefined");return(r=t.call(this,e.span,o||e.property)).layout=e,r.offset=i,r}return W(n,[{key:"isCount",value:function(){return this.layout instanceof Ur||this.layout instanceof Wr}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.layout.decode(e,t+this.offset)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.layout.encode(e,t,n+this.offset)}}]),n}();jr.OffsetLayout=Br;var Ur=function(e){Y(n,zr);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Or(e).readUIntLE(t,this.span)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Or(t).writeUIntLE(e,n,this.span),this.span}}]),n}();jr.UInt=Ur;var Wr=function(e){Y(n,zr);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Or(e).readUIntBE(t,this.span)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Or(t).writeUIntBE(e,n,this.span),this.span}}]),n}();jr.UIntBE=Wr;var Qr=function(e){Y(n,zr);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Or(e).readIntLE(t,this.span)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Or(t).writeIntLE(e,n,this.span),this.span}}]),n}();jr.Int=Qr;var Yr=function(e){Y(n,zr);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Or(e).readIntBE(t,this.span)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Or(t).writeIntBE(e,n,this.span),this.span}}]),n}();jr.IntBE=Yr;var Fr=Math.pow(2,32);function Vr(e){var t=Math.floor(e/Fr);return{hi32:t,lo32:e-t*Fr}}function Hr(e,t){return e*Fr+t}var Gr=function(e){Y(n,zr);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Or(e),r=n.readUInt32LE(t);return Hr(n.readUInt32LE(t+4),r)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Vr(e),i=Or(t);return i.writeUInt32LE(r.lo32,n),i.writeUInt32LE(r.hi32,n+4),8}}]),n}();jr.NearUInt64=Gr;var qr=function(e){Y(n,zr);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Or(e);return Hr(n.readUInt32BE(t),n.readUInt32BE(t+4))}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Vr(e),i=Or(t);return i.writeUInt32BE(r.hi32,n),i.writeUInt32BE(r.lo32,n+4),8}}]),n}();jr.NearUInt64BE=qr;var Zr=function(e){Y(n,zr);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Or(e),r=n.readUInt32LE(t);return Hr(n.readInt32LE(t+4),r)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Vr(e),i=Or(t);return i.writeUInt32LE(r.lo32,n),i.writeInt32LE(r.hi32,n+4),8}}]),n}();jr.NearInt64=Zr;var Jr=function(e){Y(n,zr);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=Or(e);return Hr(n.readInt32BE(t),n.readUInt32BE(t+4))}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=Vr(e),i=Or(t);return i.writeInt32BE(r.hi32,n),i.writeUInt32BE(r.lo32,n+4),8}}]),n}();jr.NearInt64BE=Jr;var Xr=function(e){Y(n,zr);var t=X(n);function n(e){return B(this,n),t.call(this,4,e)}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Or(e).readFloatLE(t)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Or(t).writeFloatLE(e,n),4}}]),n}();jr.Float=Xr;var Kr=function(e){Y(n,zr);var t=X(n);function n(e){return B(this,n),t.call(this,4,e)}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Or(e).readFloatBE(t)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Or(t).writeFloatBE(e,n),4}}]),n}();jr.FloatBE=Kr;var $r=function(e){Y(n,zr);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Or(e).readDoubleLE(t)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Or(t).writeDoubleLE(e,n),8}}]),n}();jr.Double=$r;var ei=function(e){Y(n,zr);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Or(e).readDoubleBE(t)}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Or(t).writeDoubleBE(e,n),8}}]),n}();jr.DoubleBE=ei;var ti=function(e){Y(n,zr);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof zr))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof Pr&&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 Pr)&&0<e.span&&(a=r*e.span),(o=t.call(this,a,i)).elementLayout=e,o.count=r,o}return W(n,[{key:"getSpan",value:function(e){var t=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 Pr&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else for(var i=0;i<r;)n+=this.elementLayout.getSpan(e,t+n),++i;return n}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=0,i=this.count;for(i instanceof Pr&&(i=i.decode(e,t));r<i;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.elementLayout,i=e.reduce((function(e,i){return e+r.encode(i,t,n+e)}),0);return this.count instanceof Pr&&this.count.encode(e.length,t,n),i}}]),n}();jr.Sequence=ti;var ni=function(e){Y(n,zr);var t=X(n);function n(e,r,i){var o;if(B(this,n),!Array.isArray(e)||!e.reduce((function(e,t){return e&&t instanceof zr}),!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=ae(e);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(e){s.e(e)}finally{s.f()}var c=-1;try{c=e.reduce((function(e,t){return e+t.getSpan()}),0)}catch(e){}return(o=t.call(this,c,r)).fields=e,o.decodePrefixes=!!i,o}return W(n,[{key:"getSpan",value:function(e){var t=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(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Dr(e);var n,r=this.makeDestinationObject(),i=ae(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(e,t)),t+=o.getSpan(e,t),this.decodePrefixes&&e.length===t)break}}catch(e){i.e(e)}finally{i.f()}return r}},{key:"encode",value:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=r,o=0,a=0,s=ae(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=e[u.property];void 0!==l&&(a=u.encode(l,t,r),0>c&&(c=u.getSpan(t,r)))}o=r,r+=c}}catch(e){s.e(e)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(e){var t,n=this.makeDestinationObject(),r=ae(this.fields);try{for(r.s();!(t=r.n()).done;){var i=t.value;void 0!==i.property&&0<e.length&&(n[i.property]=e.shift())}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"layoutFor",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=ae(this.fields);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.property===e)return r}}catch(e){n.e(e)}finally{n.f()}}},{key:"offsetOf",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=0,r=ae(this.fields);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(i.property===e)return n;0>i.span?n=-1:0<=n&&(n+=i.span)}}catch(e){r.e(e)}finally{r.f()}}}]),n}();jr.Structure=ni;var ri=function(){function e(t){B(this,e),this.property=t}return W(e,[{key:"decode",value:function(e,t){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(e,t,n){throw new Error("UnionDiscriminator is abstract")}}]),e}();jr.UnionDiscriminator=ri;var ii=function(e){Y(n,ri);var t=X(n);function n(e,r){var i;if(B(this,n),!(e instanceof Pr&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=t.call(this,r||e.property||"variant")).layout=e,i}return W(n,[{key:"decode",value:function(e,t){return this.layout.decode(e,t)}},{key:"encode",value:function(e,t,n){return this.layout.encode(e,t,n)}}]),n}();jr.UnionLayoutDiscriminator=ii;var oi=function(e){Y(n,zr);var t=X(n);function n(e,r,i){var o,a;if(B(this,n),e instanceof Ur||e instanceof Wr)a=new ii(new Br(e));else if(e instanceof Pr&&e.isCount())a=new ii(e);else{if(!(e instanceof ri))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");a=e}if(void 0===r&&(r=null),!(null===r||r instanceof zr))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)&&(e instanceof Ur||e instanceof Wr)&&(s+=a.layout.span),(o=t.call(this,s,i)).discriminator=a,o.usesPrefixDiscriminator=e instanceof Ur||e instanceof Wr,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(J(o));return o.getSourceVariant=function(e){return u(e)},o.configGetSourceVariant=function(e){u=e.bind(this)},o}return W(n,[{key:"getSpan",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0<=this.span)return this.span;var n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}},{key:"defaultGetSourceVariant",value:function(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;var t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(var n in this.registry){var r=this.registry[n];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.discriminator,i=r.decode(e,n),o=this.registry[i];if(void 0===o){var a=this.defaultLayout,s=0;this.usesPrefixDiscriminator&&(s=r.layout.span),(t=this.makeDestinationObject())[r.property]=i,t[a.property]=a.decode(e,n+s)}else t=o.decode(e,n);return t}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.getSourceVariant(e);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(e[i.property],t,n),a+o.encode(e[o.property],t,n+a)}return r.encode(e,t,n)}},{key:"addVariant",value:function(e,t,n){var r=new ai(this,e,t,n);return this.registry[e]=r,r}},{key:"getVariant",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t=e instanceof Uint8Array?this.discriminator.decode(e,n):e,this.registry[t]}}]),n}();jr.Union=oi;var ai=function(e){Y(n,zr);var t=X(n);function n(e,r,i,o){var a;if(B(this,n),!(e instanceof oi))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 zr))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=i.span&&i.span>e.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=e.span;return 0>e.span&&0<=(s=i?i.span:0)&&e.usesPrefixDiscriminator&&(s+=e.discriminator.layout.span),(a=t.call(this,s,o)).union=e,a.variant=r,a.layout=i||null,a}return W(n,[{key:"getSpan",value:function(e){var t=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(e,t+n)),n+r}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))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(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(e,t){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(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);var i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(e){if(this.layout)return this.layout.fromArray(e)}}]),n}();function si(e){return 0>e&&(e+=4294967296),e}jr.VariantLayout=ai;var ui=function(e){Y(n,zr);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof Ur||e instanceof Wr))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");(o=t.call(this,e.span,i)).word=e,o.msb=!!r,o.fields=[];var a=0;return o._packedSetValue=function(e){return a=si(e),this},o._packedGetValue=function(){return a},o}return W(n,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.makeDestinationObject(),r=this.word.decode(e,t);this._packedSetValue(r);var i,o=ae(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;void 0!==a.property&&(n[a.property]=a.decode(e))}}catch(e){o.e(e)}finally{o.f()}return n}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.word.decode(t,n);this._packedSetValue(r);var i,o=ae(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(void 0!==a.property){var s=e[a.property];void 0!==s&&a.encode(s)}}}catch(e){o.e(e)}finally{o.f()}return this.word.encode(this._packedGetValue(),t,n)}},{key:"addField",value:function(e,t){var n=new ci(this,e,t);return this.fields.push(n),n}},{key:"addBoolean",value:function(e){var t=new li(this,e);return this.fields.push(t),t}},{key:"fieldFor",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=ae(this.fields);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.property===e)return r}}catch(e){n.e(e)}finally{n.f()}}}]),n}();jr.BitStructure=ui;var ci=function(){function e(t,n,r){if(B(this,e),!(t instanceof ui))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*t.span,o=t.fields.reduce((function(e,t){return e+t.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=t,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=si(this.valueMask<<this.start),this.property=r}return W(e,[{key:"decode",value:function(e,t){return si(this.container._packedGetValue()&this.wordMask)>>>this.start}},{key:"encode",value:function(e){if("number"!=typeof e||!Number.isInteger(e)||e!==si(e&this.valueMask))throw new TypeError(_r("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var t=this.container._packedGetValue(),n=si(e<<this.start);this.container._packedSetValue(si(t&~this.wordMask)|n)}}]),e}();jr.BitField=ci;var li=function(e){Y(n,ci);var t=X(n);function n(e,r){return B(this,n),t.call(this,e,1,r)}return W(n,[{key:"decode",value:function(e,t){return!!K(F(n.prototype),"decode",this).call(this,e,t)}},{key:"encode",value:function(e){"boolean"==typeof e&&(e=+e),K(F(n.prototype),"encode",this).call(this,e)}}]),n}();jr.Boolean=li;var di=function(e){Y(n,zr);var t=X(n);function n(e,r){var i;if(B(this,n),!(e instanceof Pr&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var o=-1;return e instanceof Pr||(o=e),(i=t.call(this,o,r)).length=e,i}return W(n,[{key:"getSpan",value:function(e,t){var n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.span;return 0>n&&(n=this.length.decode(e,t)),Or(e).slice(t,t+n)}},{key:"encode",value:function(e,t,n){var r=this.length;if(this.length instanceof Pr&&(r=e.length),!(e instanceof Uint8Array&&r===e.length))throw new TypeError(_r("Blob.encode",this)+" requires (length "+r+") Uint8Array as src");if(n+r>t.length)throw new RangeError("encoding overruns Uint8Array");var i=Or(e);return Or(t).write(i.toString("hex"),n,r,"hex"),this.length instanceof Pr&&this.length.encode(r,t,n),r}}]),n}();jr.Blob=di;var hi=function(e){Y(n,zr);var t=X(n);function n(e){return B(this,n),t.call(this,-1,e)}return W(n,[{key:"getSpan",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Dr(e);for(var n=t;n<e.length&&0!==e[n];)n+=1;return 1+n-t}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.getSpan(e,t);return Or(e).slice(t,t+n-1).toString("utf-8")}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;"string"!=typeof e&&(e=String(e));var r=Cr.Buffer.from(e,"utf8"),i=r.length;if(n+i>t.length)throw new RangeError("encoding overruns Buffer");var o=Or(t);return r.copy(o,n),o[n+i]=0,i+1}}]),n}();jr.CString=hi;var pi=function(e){Y(n,zr);var t=X(n);function n(e,r){var i;if(B(this,n),"string"==typeof e&&void 0===r&&(r=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");return(i=t.call(this,-1,r)).maxSpan=e,i}return W(n,[{key:"getSpan",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Dr(e),e.length-t}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");return Or(e).slice(t,t+n).toString("utf-8")}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;"string"!=typeof e&&(e=String(e));var r=Cr.Buffer.from(e,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(Or(t),n),i}}]),n}();jr.UTF8=pi;var fi=function(e){Y(n,zr);var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,0,r)).value=e,i}return W(n,[{key:"decode",value:function(e,t){return this.value}},{key:"encode",value:function(e,t,n){return 0}}]),n}();jr.Constant=fi,jr.greedy=function(e,t){return new Rr(e,t)};var yi=jr.offset=function(e,t,n){return new Br(e,t,n)},mi=jr.u8=function(e){return new Ur(1,e)},gi=jr.u16=function(e){return new Ur(2,e)};jr.u24=function(e){return new Ur(3,e)};var vi=jr.u32=function(e){return new Ur(4,e)};jr.u40=function(e){return new Ur(5,e)},jr.u48=function(e){return new Ur(6,e)};var wi=jr.nu64=function(e){return new Gr(e)};jr.u16be=function(e){return new Wr(2,e)},jr.u24be=function(e){return new Wr(3,e)},jr.u32be=function(e){return new Wr(4,e)},jr.u40be=function(e){return new Wr(5,e)},jr.u48be=function(e){return new Wr(6,e)},jr.nu64be=function(e){return new qr(e)},jr.s8=function(e){return new Qr(1,e)},jr.s16=function(e){return new Qr(2,e)},jr.s24=function(e){return new Qr(3,e)},jr.s32=function(e){return new Qr(4,e)},jr.s40=function(e){return new Qr(5,e)},jr.s48=function(e){return new Qr(6,e)};var bi=jr.ns64=function(e){return new Zr(e)};jr.s16be=function(e){return new Yr(2,e)},jr.s24be=function(e){return new Yr(3,e)},jr.s32be=function(e){return new Yr(4,e)},jr.s40be=function(e){return new Yr(5,e)},jr.s48be=function(e){return new Yr(6,e)},jr.ns64be=function(e){return new Jr(e)},jr.f32=function(e){return new Xr(e)},jr.f32be=function(e){return new Kr(e)},jr.f64=function(e){return new $r(e)},jr.f64be=function(e){return new ei(e)};var Mi=jr.struct=function(e,t,n){return new ni(e,t,n)};jr.bits=function(e,t,n){return new ui(e,t,n)};var Ai=jr.seq=function(e,t,n){return new ti(e,t,n)};jr.union=function(e,t,n){return new oi(e,t,n)},jr.unionLayoutDiscriminator=function(e,t){return new ii(e,t)};var Ei=jr.blob=function(e,t){return new di(e,t)};jr.cstr=function(e){return new hi(e)},jr.utf8=function(e,t){return new pi(e,t)},jr.constant=function(e,t){return new fi(e,t)};var Ni={};Object.defineProperty(Ni,"__esModule",{value:!0});var Ti=Ni.toBigIntLE=function(e){var t=Ee.from(e);t.reverse();var n=t.toString("hex");return 0===n.length?BigInt(0):BigInt("0x".concat(n))};Ni.toBigIntBE=function(e){var t=e.toString("hex");return 0===t.length?BigInt(0):BigInt("0x".concat(t))};var Ii=Ni.toBufferLE=function(e,t){var n=e.toString(16),r=Ee.from(n.padStart(2*t,"0").slice(0,2*t),"hex");return r.reverse(),r};Ni.toBufferBE=function(e,t){var n=e.toString(16);return Ee.from(n.padStart(2*t,"0").slice(0,2*t),"hex")};var ki=["message"],Li=z().mark(Oi),xi=function(e){Y(n,q(TypeError));var t=X(n);function n(e,r){var i,o;B(this,n);var a=e.message,s=Z(e,ki),u=e.path,c=0===u.length?a:"At path: "+u.join(".")+" -- "+a;return i=t.call(this,c),Object.assign(J(i),s),i.name=i.constructor.name,i.failures=function(){var t;return null!=(t=o)?t:o=[e].concat(ee(r()))},i}return W(n)}();function Si(e){return ji(e)&&"function"==typeof e[Symbol.iterator]}function ji(e){return"object"===_(e)&&null!=e}function Ci(e){return"string"==typeof e?JSON.stringify(e):""+e}function Di(e,t,n,r){if(!0!==e){!1===e?e={}:"string"==typeof e&&(e={message:e});var i=t.path,o=t.branch,a=n.type,s=e,u=s.refinement,c=s.message,l=void 0===c?"Expected a value of type `"+a+"`"+(u?" with refinement `"+u+"`":"")+", but received: `"+Ci(r)+"`":c;return O(O({value:r,type:a,refinement:u,key:i[i.length-1],path:i,branch:o},e),{},{message:l})}}function Oi(e,t,n,r){var i,o,a,s;return z().wrap((function(u){for(;;)switch(u.prev=u.next){case 0:Si(e)||(e=[e]),i=ae(e),u.prev=2,i.s();case 4:if((o=i.n()).done){u.next=12;break}if(a=o.value,!(s=Di(a,t,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()}}),Li,null,[[2,14,17,20]])}function zi(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return z().mark((function r(){var i,o,a,s,u,c,l,d,h,p,f,y,m,g,v,w,b,M,A,E,N,T,I,k,L,x,S;return z().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?[e]:a,u=n.coerce,c=void 0!==u&&u,l=n.mask,d=void 0!==l&&l,h={path:o,branch:s},c&&(e=t.coercer(e,h),d&&"type"!==t.type&&ji(t.schema)&&ji(e)&&!Array.isArray(e)))for(p in e)void 0===t.schema[p]&&delete e[p];f=!0,y=ae(t.validator(e,h)),r.prev=5,y.s();case 7:if((m=y.n()).done){r.next=14;break}return g=m.value,f=!1,r.next=12,[g,void 0];case 12:r.next=7;break;case 14:r.next=19;break;case 16:r.prev=16,r.t0=r.catch(5),y.e(r.t0);case 19:return r.prev=19,y.f(),r.finish(19);case 22:v=ae(t.entries(e,h)),r.prev=23,v.s();case 25:if((w=v.n()).done){r.next=52;break}b=$(w.value,3),M=b[0],A=b[1],E=b[2],N=zi(A,E,{path:void 0===M?o:[].concat(ee(o),[M]),branch:void 0===M?s:[].concat(ee(s),[A]),coerce:c,mask:d}),T=ae(N),r.prev=29,T.s();case 31:if((I=T.n()).done){r.next=42;break}if(!(k=I.value)[0]){r.next=39;break}return f=!1,r.next=37,[k[0],void 0];case 37:r.next=40;break;case 39:c&&(A=k[1],void 0===M?e=A:e instanceof Map?e.set(M,A):e instanceof Set?e.add(A):ji(e)&&(e[M]=A));case 40:r.next=31;break;case 42:r.next=47;break;case 44:r.prev=44,r.t1=r.catch(29),T.e(r.t1);case 47:return r.prev=47,T.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(!f){r.next=79;break}L=ae(t.refiner(e,h)),r.prev=62,L.s();case 64:if((x=L.n()).done){r.next=71;break}return S=x.value,f=!1,r.next=69,[S,void 0];case 69:r.next=64;break;case 71:r.next=76;break;case 73:r.prev=73,r.t3=r.catch(62),L.e(r.t3);case 76:return r.prev=76,L.f(),r.finish(76);case 79:if(!f){r.next=82;break}return r.next=82,[void 0,e];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 _i,Pi=function(){function e(t){var n=this;B(this,e);var r=t.type,i=t.schema,o=t.validator,a=t.refiner,s=t.coercer,u=void 0===s?function(e){return e}:s,c=t.entries,l=void 0===c?z().mark((function e(){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})):c;this.type=r,this.schema=i,this.entries=l,this.coercer=u,this.validator=o?function(e,t){return Oi(o(e,t),t,n,e)}:function(){return[]},this.refiner=a?function(e,t){return Oi(a(e,t),t,n,e)}:function(){return[]}}return W(e,[{key:"assert",value:function(e){return Ri(e,this)}},{key:"create",value:function(e){return Bi(e,this)}},{key:"is",value:function(e){return Ui(e,this)}},{key:"mask",value:function(e){return function(e,t){var n=Wi(e,t,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}(e,this)}},{key:"validate",value:function(e){return Wi(e,this,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}}]),e}();function Ri(e,t){var n=Wi(e,t);if(n[0])throw n[0]}function Bi(e,t){var n=Wi(e,t,{coerce:!0});if(n[0])throw n[0];return n[1]}function Ui(e,t){return!Wi(e,t)[0]}function Wi(e,t){var n=zi(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),r=function(e){var t=e.next(),n=t.done,r=t.value;return n?void 0:r}(n);if(r[0]){var i=new xi(r[0],z().mark((function e(){var t,r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=ae(n),e.prev=1,t.s();case 3:if((r=t.n()).done){e.next=10;break}if(!(i=r.value)[0]){e.next=8;break}return e.next=8,i[0];case 8:e.next=3;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(1),t.e(e.t0);case 15:return e.prev=15,t.f(),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[1,12,15,18]])})));return[i,void 0]}return[void 0,r[1]]}function Qi(e,t){return new Pi({type:e,schema:null,validator:t})}function Yi(e){return new Pi({type:"array",schema:e,entries:z().mark((function t(n){var r,i,o,a,s;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e||!Array.isArray(n)){t.next=18;break}r=ae(n.entries()),t.prev=2,r.s();case 4:if((i=r.n()).done){t.next=10;break}return o=$(i.value,2),a=o[0],s=o[1],t.next=8,[a,s,e];case 8:t.next=4;break;case 10:t.next=15;break;case 12:t.prev=12,t.t0=t.catch(2),r.e(t.t0);case 15:return t.prev=15,r.f(),t.finish(15);case 18:case"end":return t.stop()}}),t,null,[[2,12,15,18]])})),coercer:function(e){return Array.isArray(e)?e.slice():e},validator:function(e){return Array.isArray(e)||"Expected an array value, but received: "+Ci(e)}})}function Fi(){return Qi("boolean",(function(e){return"boolean"==typeof e}))}function Vi(e){return Qi("instance",(function(t){return t instanceof e||"Expected a `"+e.name+"` instance, but received: "+Ci(t)}))}function Hi(e){var t=Ci(e),n=_(e);return new Pi({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:function(n){return n===e||"Expected the literal `"+t+"`, but received: "+Ci(n)}})}function Gi(e){return new Pi(O(O({},e),{},{validator:function(t,n){return null===t||e.validator(t,n)},refiner:function(t,n){return null===t||e.refiner(t,n)}}))}function qi(){return Qi("number",(function(e){return"number"==typeof e&&!isNaN(e)||"Expected a number, but received: "+Ci(e)}))}function Zi(e){return new Pi(O(O({},e),{},{validator:function(t,n){return void 0===t||e.validator(t,n)},refiner:function(t,n){return void 0===t||e.refiner(t,n)}}))}function Ji(e,t){return new Pi({type:"record",schema:null,entries:z().mark((function n(r){var i,o;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!ji(r)){n.next=11;break}n.t0=z().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,e];case 7:return n.next=9,[i,o,t];case 9:n.next=2;break;case 11:case"end":return n.stop()}}),n)})),validator:function(e){return ji(e)||"Expected an object, but received: "+Ci(e)}})}function Xi(){return Qi("string",(function(e){return"string"==typeof e||"Expected a string, but received: "+Ci(e)}))}function Ki(e){var t=Qi("never",(function(){return!1}));return new Pi({type:"tuple",schema:null,entries:z().mark((function n(r){var i,o;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!Array.isArray(r)){n.next=9;break}i=Math.max(e.length,r.length),o=0;case 3:if(!(o<i)){n.next=9;break}return n.next=6,[o,r[o],e[o]||t];case 6:o++,n.next=3;break;case 9:case"end":return n.stop()}}),n)})),validator:function(e){return Array.isArray(e)||"Expected an array, but received: "+Ci(e)}})}function $i(e){var t=Object.keys(e);return new Pi({type:"type",schema:e,entries:z().mark((function n(r){var i,o,a;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!ji(r)){n.next=18;break}i=ae(t),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],e[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(e){return ji(e)||"Expected an object, but received: "+Ci(e)}})}function eo(e){var t=e.map((function(e){return e.type})).join(" | ");return new Pi({type:"union",schema:null,validator:function(n,r){var i,o,a=[],s=ae(e);try{for(s.s();!(i=s.n()).done;){var u=zi(n,i.value,r),c=(te(o=u)||ne(o)||re(o)||oe()).slice(0);if(!$(c,1)[0][0])return[];var l,d=ae(c);try{for(d.s();!(l=d.n()).done;){var h=$(l.value,1)[0];h&&a.push(h)}}catch(e){d.e(e)}finally{d.f()}}}catch(e){s.e(e)}finally{s.f()}return["Expected the value to satisfy a union of `"+t+"`, but received: "+Ci(n)].concat(a)}})}function to(){return Qi("unknown",(function(){return!0}))}function no(e,t,n){return new Pi(O(O({},e),{},{coercer:function(r,i){return Ui(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)}}))}var ro=new Uint8Array(16);function io(){if(!_i&&!(_i="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 _i(ro)}var oo=/^(?:[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 ao(e){return"string"==typeof e&&oo.test(e)}for(var so,uo,co=[],lo=0;lo<256;++lo)co.push((lo+256).toString(16).substr(1));function ho(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(co[e[t+0]]+co[e[t+1]]+co[e[t+2]]+co[e[t+3]]+"-"+co[e[t+4]]+co[e[t+5]]+"-"+co[e[t+6]]+co[e[t+7]]+"-"+co[e[t+8]]+co[e[t+9]]+"-"+co[e[t+10]]+co[e[t+11]]+co[e[t+12]]+co[e[t+13]]+co[e[t+14]]+co[e[t+15]]).toLowerCase();if(!ao(n))throw TypeError("Stringified UUID is invalid");return n}var po=0,fo=0;function yo(e){if(!ao(e))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n}function mo(e,t,n){function r(e,r,i,o){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof r&&(r=yo(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var a=new Uint8Array(16+e.length);if(a.set(r),a.set(e,r.length),(a=n(a))[6]=15&a[6]|t,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 ho(a)}try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r}function go(e){return 14+(e+64>>>9<<4)+1}function vo(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function wo(e,t,n,r,i,o){return vo((a=vo(vo(t,e),vo(r,o)))<<(s=i)|a>>>32-s,n);var a,s}function bo(e,t,n,r,i,o,a){return wo(t&n|~t&r,e,t,i,o,a)}function Mo(e,t,n,r,i,o,a){return wo(t&r|n&~r,e,t,i,o,a)}function Ao(e,t,n,r,i,o,a){return wo(t^n^r,e,t,i,o,a)}function Eo(e,t,n,r,i,o,a){return wo(n^(t|~r),e,t,i,o,a)}var No=mo("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){for(var t=[],n=32*e.length,r="0123456789abcdef",i=0;i<n;i+=8){var o=e[i>>5]>>>i%32&255,a=parseInt(r.charAt(o>>>4&15)+r.charAt(15&o),16);t.push(a)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[go(t)-1]=t;for(var n=1732584193,r=-271733879,i=-1732584194,o=271733878,a=0;a<e.length;a+=16){var s=n,u=r,c=i,l=o;n=bo(n,r,i,o,e[a],7,-680876936),o=bo(o,n,r,i,e[a+1],12,-389564586),i=bo(i,o,n,r,e[a+2],17,606105819),r=bo(r,i,o,n,e[a+3],22,-1044525330),n=bo(n,r,i,o,e[a+4],7,-176418897),o=bo(o,n,r,i,e[a+5],12,1200080426),i=bo(i,o,n,r,e[a+6],17,-1473231341),r=bo(r,i,o,n,e[a+7],22,-45705983),n=bo(n,r,i,o,e[a+8],7,1770035416),o=bo(o,n,r,i,e[a+9],12,-1958414417),i=bo(i,o,n,r,e[a+10],17,-42063),r=bo(r,i,o,n,e[a+11],22,-1990404162),n=bo(n,r,i,o,e[a+12],7,1804603682),o=bo(o,n,r,i,e[a+13],12,-40341101),i=bo(i,o,n,r,e[a+14],17,-1502002290),n=Mo(n,r=bo(r,i,o,n,e[a+15],22,1236535329),i,o,e[a+1],5,-165796510),o=Mo(o,n,r,i,e[a+6],9,-1069501632),i=Mo(i,o,n,r,e[a+11],14,643717713),r=Mo(r,i,o,n,e[a],20,-373897302),n=Mo(n,r,i,o,e[a+5],5,-701558691),o=Mo(o,n,r,i,e[a+10],9,38016083),i=Mo(i,o,n,r,e[a+15],14,-660478335),r=Mo(r,i,o,n,e[a+4],20,-405537848),n=Mo(n,r,i,o,e[a+9],5,568446438),o=Mo(o,n,r,i,e[a+14],9,-1019803690),i=Mo(i,o,n,r,e[a+3],14,-187363961),r=Mo(r,i,o,n,e[a+8],20,1163531501),n=Mo(n,r,i,o,e[a+13],5,-1444681467),o=Mo(o,n,r,i,e[a+2],9,-51403784),i=Mo(i,o,n,r,e[a+7],14,1735328473),n=Ao(n,r=Mo(r,i,o,n,e[a+12],20,-1926607734),i,o,e[a+5],4,-378558),o=Ao(o,n,r,i,e[a+8],11,-2022574463),i=Ao(i,o,n,r,e[a+11],16,1839030562),r=Ao(r,i,o,n,e[a+14],23,-35309556),n=Ao(n,r,i,o,e[a+1],4,-1530992060),o=Ao(o,n,r,i,e[a+4],11,1272893353),i=Ao(i,o,n,r,e[a+7],16,-155497632),r=Ao(r,i,o,n,e[a+10],23,-1094730640),n=Ao(n,r,i,o,e[a+13],4,681279174),o=Ao(o,n,r,i,e[a],11,-358537222),i=Ao(i,o,n,r,e[a+3],16,-722521979),r=Ao(r,i,o,n,e[a+6],23,76029189),n=Ao(n,r,i,o,e[a+9],4,-640364487),o=Ao(o,n,r,i,e[a+12],11,-421815835),i=Ao(i,o,n,r,e[a+15],16,530742520),n=Eo(n,r=Ao(r,i,o,n,e[a+2],23,-995338651),i,o,e[a],6,-198630844),o=Eo(o,n,r,i,e[a+7],10,1126891415),i=Eo(i,o,n,r,e[a+14],15,-1416354905),r=Eo(r,i,o,n,e[a+5],21,-57434055),n=Eo(n,r,i,o,e[a+12],6,1700485571),o=Eo(o,n,r,i,e[a+3],10,-1894986606),i=Eo(i,o,n,r,e[a+10],15,-1051523),r=Eo(r,i,o,n,e[a+1],21,-2054922799),n=Eo(n,r,i,o,e[a+8],6,1873313359),o=Eo(o,n,r,i,e[a+15],10,-30611744),i=Eo(i,o,n,r,e[a+6],15,-1560198380),r=Eo(r,i,o,n,e[a+13],21,1309151649),n=Eo(n,r,i,o,e[a+4],6,-145523070),o=Eo(o,n,r,i,e[a+11],10,-1120210379),i=Eo(i,o,n,r,e[a+2],15,718787259),r=Eo(r,i,o,n,e[a+9],21,-343485551),n=vo(n,s),r=vo(r,u),i=vo(i,c),o=vo(o,l)}return[n,r,i,o]}(function(e){if(0===e.length)return[];for(var t=8*e.length,n=new Uint32Array(go(t)),r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))})),To=No;function Io(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function ko(e,t){return e<<t|e>>>32-t}var Lo=mo("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var i=0;i<r.length;++i)e.push(r.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var o=e.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]=e[64*u+4*l]<<24|e[64*u+4*l+1]<<16|e[64*u+4*l+2]<<8|e[64*u+4*l+3];s[u]=c}s[a-1][14]=8*(e.length-1)/Math.pow(2,32),s[a-1][14]=Math.floor(s[a-1][14]),s[a-1][15]=8*(e.length-1)&4294967295;for(var d=0;d<a;++d){for(var h=new Uint32Array(80),p=0;p<16;++p)h[p]=s[d][p];for(var f=16;f<80;++f)h[f]=ko(h[f-3]^h[f-8]^h[f-14]^h[f-16],1);for(var y=n[0],m=n[1],g=n[2],v=n[3],w=n[4],b=0;b<80;++b){var M=Math.floor(b/20),A=ko(y,5)+Io(M,m,g,v)+w+t[M]+h[b]>>>0;w=v,v=g,g=ko(m,30)>>>0,m=y,y=A}n[0]=n[0]+y>>>0,n[1]=n[1]+m>>>0,n[2]=n[2]+g>>>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]]})),xo=Lo;var So=Object.freeze({__proto__:null,v1:function(e,t,n){var r=t&&n||0,i=t||new Array(16),o=(e=e||{}).node||so,a=void 0!==e.clockseq?e.clockseq:uo;if(null==o||null==a){var s=e.random||(e.rng||io)();null==o&&(o=so=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==a&&(a=uo=16383&(s[6]<<8|s[7]))}var u=void 0!==e.msecs?e.msecs:Date.now(),c=void 0!==e.nsecs?e.nsecs:fo+1,l=u-po+(c-fo)/1e4;if(l<0&&void 0===e.clockseq&&(a=a+1&16383),(l<0||u>po)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");po=u,fo=c,uo=a;var d=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=255&d;var h=u/4294967296*1e4&268435455;i[r++]=h>>>8&255,i[r++]=255&h,i[r++]=h>>>24&15|16,i[r++]=h>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var p=0;p<6;++p)i[r+p]=o[p];return t||ho(i)},v3:To,v4:function(e,t,n){var r=(e=e||{}).random||(e.rng||io)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return ho(r)},v5:xo,NIL:"00000000-0000-0000-0000-000000000000",version:function(e){if(!ao(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)},validate:ao,stringify:ho,parse:yo}),jo=C(So),Co=jo.v4,Do=function(e,t,n,r){if("string"!=typeof e)throw new TypeError(e+" 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:e};if(2===i&&(o.jsonrpc="2.0"),t){if("object"!==_(t)&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");o.params=t}if(void 0===n){var a="function"==typeof r.generator?r.generator:function(){return Co()};o.id=a(o,r)}else 2===i&&null===n?r.notificationIdNull&&(o.id=null):o.id=n;return o},Oo=jo.v4,zo=Do,_o=function e(t,n){if(!(this instanceof e))return new e(t,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 Oo()},version:void 0!==n.version?n.version:2,notificationIdNull:"boolean"==typeof n.notificationIdNull&&n.notificationIdNull},this.callServer=t},Po=_o;_o.prototype.request=function(e,t,n,r){var i=this,o=null,a=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");var s,u=!a&&e&&"object"===_(e)&&"function"==typeof t;if(a||u)r=t,o=e;else{"function"==typeof n&&(r=n,n=void 0);var c="function"==typeof r;try{o=zo(e,t,n,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(c)return r(e);throw e}if(!c)return o}try{s=JSON.stringify(o,this.options.replacer)}catch(e){return r(e)}return this.callServer(s,(function(e,t){i._parseResponse(e,t,r)})),o},_o.prototype._parseResponse=function(e,t,n){if(e)n(e);else{if(!t)return n();var r;try{r=JSON.parse(t,this.options.reviver)}catch(e){return n(e)}if(3===n.length){if(Array.isArray(r)){var i=function(e){return void 0!==e.error};return n(null,r.filter(i),r.filter((function(e){return!i(e)})))}return n(null,r.error,r.result)}n(null,r)}};var Ro,Bo=Po,Uo={},Wo={exports:{}};(Ro=Wo).exports=function(e){return e&&e.__esModule?e:{default:e}},Ro.exports.__esModule=!0,Ro.exports.default=Ro.exports;var Qo,Yo,Fo,Vo,Ho={exports:{}},Go={exports:{}};function qo(){return Qo||(Qo=1,function(e){function t(n){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Go)),Go.exports}function Zo(){return Yo||(Yo=1,function(e){var t=qo().default;function n(){
|
|
8
8
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
9
|
-
e.exports=n=function(){return r},e.exports.__esModule=!0,e.exports.default=e.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(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var i=t&&t.prototype instanceof f?t:f,o=Object.create(i.prototype),a=new I(r||[]);return o._invoke=function(e,t,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 L()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=E(a,n);if(s){if(s===p)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=h(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,a),o}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}r.wrap=d;var p={};function f(){}function y(){}function m(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,w=v&&v(v(k([])));w&&w!==i&&o.call(w,s)&&(g=w);var b=m.prototype=f.prototype=Object.create(g);function M(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,n){function r(i,a,s,u){var c=h(e[i],e,a);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==t(d)&&o.call(d,"__await")?n.resolve(d.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):n.resolve(d).then((function(e){l.value=e,s(l)}),(function(e){return r("throw",e,s,u)}))}u(c.arg)}var i;this._invoke=function(e,t){function o(){return new n((function(n,i){r(e,t,n,i)}))}return i=i?i.then(o,o):o()}}function E(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method))return p;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var r=h(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,p;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function k(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:L}}function L(){return{value:void 0,done:!0}}return y.prototype=m,l(b,"constructor",m),l(m,"constructor",y),y.displayName=l(m,c,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,l(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},r.awrap=function(e){return{__await:e}},M(A.prototype),l(A.prototype,u,(function(){return this})),r.AsyncIterator=A,r.async=function(e,t,n,i,o){void 0===o&&(o=Promise);var a=new A(d(e,t,n,i),o);return r.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.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(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},r.values=k,I.prototype={constructor:I,reset:function(e){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(T),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.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(e,t){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"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Ho)),Ho.exports}var Jo,Xo={exports:{}};var Ko,$o={exports:{}};function ea(){return Ko||(Ko=1,function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports}($o)),$o.exports}var ta,na={exports:{}};function ra(){return ta||(ta=1,function(e){function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports}(na)),na.exports}var ia,oa,aa={exports:{}},sa={exports:{}};function ua(){return ia||(ia=1,function(e){function t(n,r){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(sa)),sa.exports}function ca(){return oa||(oa=1,function(e){var t=ua();e.exports=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),n&&t(e,n)},e.exports.__esModule=!0,e.exports.default=e.exports}(aa)),aa.exports}var la,da,ha={exports:{}},pa={exports:{}};function fa(){return la||(la=1,function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports}(pa)),pa.exports}function ya(){return da||(da=1,function(e){var t=qo().default,n=fa();e.exports=function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports}(ha)),ha.exports}var ma,ga={exports:{}};function va(){return ma||(ma=1,function(e){function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(ga)),ga.exports}var wa,ba={exports:{}};function Ma(){return wa||(wa=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||e,a),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}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 e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];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(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,o,a){var s=n?n+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,i),!0;case 5:return l.fn.call(l.context,t,r,i,o),!0;case 6:return l.fn.call(l.context,t,r,i,o,a),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,p=l.length;for(c=0;c<p;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,r);break;case 4:l[c].fn.call(l[c].context,t,r,i);break;default:if(!u)for(h=1,u=new Array(d-1);h<d;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||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!==t||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(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(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,e.exports=s}(ba)),ba.exports}!function(e){var t=Wo.exports;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=t(function(){if(Vo)return Fo;Vo=1;var e=Zo()();Fo=e;try{regeneratorRuntime=e}catch(t){"object"===("undefined"==typeof globalThis?"undefined":_(globalThis))?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return Fo}()),r=t((Jo||(Jo=1,function(e){function t(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=e.apply(n,r);function s(e){t(a,i,o,s,u,"next",e)}function u(e){t(a,i,o,s,u,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports}(Xo)),Xo.exports)),i=t(qo()),o=t(ea()),a=t(ra()),s=t(ca()),u=t(ya()),c=t(va()),l=Ma();function d(e){var t=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(e){return!1}}();return function(){var n,r=(0,c.default)(e);if(t){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 h=function(e){(0,s.default)(p,e);var t,u,c,l,h=d(p);function p(e){var t,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,p);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,d=void 0===l?1e3:l,f=r.max_reconnects,y=void 0===f?5:f,m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(t=h.call(this)).webSocketFactory=e,t.queue={},t.rpc_id=0,t.address=n,t.autoconnect=s,t.ready=!1,t.reconnect=c,t.reconnect_timer_id=void 0,t.reconnect_interval=d,t.max_reconnects=y,t.rest_options=m,t.current_reconnects=0,t.generate_request_id=i||function(){return++t.rpc_id},t.autoconnect&&t._connect(t.address,Object.assign({autoconnect:t.autoconnect,reconnect:t.reconnect,reconnect_interval:t.reconnect_interval,max_reconnects:t.max_reconnects},t.rest_options)),t}return(0,a.default)(p,[{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(e,t,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(e,t),u={jsonrpc:"2.0",method:e,params:t||null,id:s};o.socket.send(JSON.stringify(u),r,(function(e){if(e)return a(e);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 e(t){var r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.call("rpc.login",t);case 2:if(r=e.sent){e.next=5;break}throw new Error("authentication failed");case 5:return e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function e(){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.call("__listMethods");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(e,t){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:e,params:t||null};n.socket.send(JSON.stringify(o),(function(e){if(e)return i(e);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function e(t){var r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof t&&(t=[t]),e.next=3,this.call("rpc.on",t);case 3:if(r=e.sent,"string"!=typeof t||"ok"===r[t]){e.next=6;break}throw new Error("Failed subscribing to an event '"+t+"' with: "+r[t]);case 6:return e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"unsubscribe",value:(t=(0,r.default)(n.default.mark((function e(t){var r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof t&&(t=[t]),e.next=3,this.call("rpc.off",t);case 3:if(r=e.sent,"string"!=typeof t||"ok"===r[t]){e.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"close",value:function(e,t){this.socket.close(e||1e3,t)}},{key:"_connect",value:function(e,t){var n=this;clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(e){var t=e.data;t instanceof ArrayBuffer&&(t=Ee.from(t).toString());try{t=JSON.parse(t)}catch(e){return}if(t.notification&&n.listeners(t.notification).length){if(!Object.keys(t.params).length)return n.emit(t.notification);var r=[t.notification];if(t.params.constructor===Object)r.push(t.params);else for(var i=0;i<t.params.length;i++)r.push(t.params[i]);return Promise.resolve().then((function(){n.emit.apply(n,r)}))}if(!n.queue[t.id])return t.method&&t.params?Promise.resolve().then((function(){n.emit(t.method,t.params)})):void 0;"error"in t=="result"in t&&n.queue[t.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),n.queue[t.id].timeout&&clearTimeout(n.queue[t.id].timeout),t.error?n.queue[t.id].promise[1](t.error):n.queue[t.id].promise[0](t.result),delete n.queue[t.id]})),this.socket.addEventListener("error",(function(e){return n.emit("error",e)})),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(e,t)}),n.reconnect_interval)))}))}}]),p}(l.EventEmitter);e.default=h}(Uo);var Aa=j(Uo),Ea={};!function(e){var t=Wo.exports;Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e,t){return new u(e,t)};var n=t(ea()),r=t(ra()),i=t(ca()),o=t(ya()),a=t(va());function s(e){var t=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(e){return!1}}();return function(){var n,r=(0,a.default)(e);if(t){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(e){(0,i.default)(o,e);var t=s(o);function o(e,r,i){var a;return(0,n.default)(this,o),(a=t.call(this)).socket=new window.WebSocket(e,i),a.socket.onopen=function(){return a.emit("open")},a.socket.onmessage=function(e){return a.emit("message",e.data)},a.socket.onerror=function(e){return a.emit("error",e)},a.socket.onclose=function(e){a.emit("close",e.code,e.reason)},a}return(0,r.default)(o,[{key:"send",value:function(e,t,n){var r=n||t;try{this.socket.send(e),r()}catch(e){r(e)}}},{key:"close",value:function(e,t){this.socket.close(e,t)}},{key:"addEventListener",value:function(e,t,n){this.socket.addEventListener(e,t,n)}}]),o}(Ma().EventEmitter)}(Ea);for(var Na=j(Ea),Ta=[],Ia=[],ka=[],La=BigInt(0),xa=BigInt(1),Sa=BigInt(2),ja=BigInt(7),Ca=BigInt(256),Da=BigInt(113),Oa=0,za=xa,_a=1,Pa=0;Oa<24;Oa++){var Ra=[Pa,(2*_a+3*Pa)%5];_a=Ra[0],Pa=Ra[1],Ta.push(2*(5*Pa+_a)),Ia.push((Oa+1)*(Oa+2)/2%64);for(var Ba=La,Ua=0;Ua<7;Ua++)(za=(za<<xa^(za>>ja)*Da)%Ca)&Sa&&(Ba^=xa<<(xa<<BigInt(Ua))-xa);ka.push(Ba)}var Wa=$(Et.split(ka,!0),2),Qa=Wa[0],Ya=Wa[1],Fa=function(e,t,n){return n>32?Et.rotlBH(e,t,n):Et.rotlSH(e,t,n)},Va=function(e,t,n){return n>32?Et.rotlBL(e,t,n):Et.rotlSL(e,t,n)};var Ha=function(e){Y(n,mt);var t=X(n);function n(e,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(B(this,n),(o=t.call(this)).blockLen=e,o.suffix=r,o.outputLen=i,o.enableXOF=s,o.rounds=u,o.pos=0,o.posOut=0,o.finished=!1,o.destroyed=!1,ht.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 W(n,[{key:"keccak",value:function(){!function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,n=new Uint32Array(10),r=24-t;r<24;r++){for(var i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[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=Fa(u,c,1)^n[a],d=Va(u,c,1)^n[a+1],h=0;h<50;h+=10)e[o+h]^=l,e[o+h+1]^=d;for(var p=e[2],f=e[3],y=0;y<24;y++){var m=Ia[y],g=Fa(p,f,m),v=Va(p,f,m),w=Ta[y];p=e[w],f=e[w+1],e[w]=g,e[w+1]=v}for(var b=0;b<50;b+=10){for(var M=0;M<10;M++)n[M]=e[b+M];for(var A=0;A<10;A++)e[b+A]^=~n[(A+2)%10]&n[(A+4)%10]}e[0]^=Qa[r],e[1]^=Ya[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}},{key:"update",value:function(e){ht.exists(this);for(var t=this.blockLen,n=this.state,r=(e=yt(e)).length,i=0;i<r;){for(var o=Math.min(t-this.pos,r-i),a=0;a<o;a++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}},{key:"finish",value:function(){if(!this.finished){this.finished=!0;var e=this.state,t=this.suffix,n=this.pos,r=this.blockLen;e[n]^=t,0!=(128&t)&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}}},{key:"writeInto",value:function(e){ht.exists(this,!1),ht.bytes(e),this.finish();for(var t=this.state,n=this.blockLen,r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();var o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}},{key:"xofInto",value:function(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}},{key:"xof",value:function(e){return ht.number(e),this.xofInto(new Uint8Array(e))}},{key:"digestInto",value:function(e){if(ht.output(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}},{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(e){var t=this.blockLen,r=this.suffix,i=this.outputLen,o=this.rounds,a=this.enableXOF;return e||(e=new n(t,r,i,a,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=r,e.outputLen=i,e.enableXOF=a,e.destroyed=this.destroyed,e}}]),n}(),Ga=function(e,t,n){return gt((function(){return new Ha(t,e,n)}))};Ga(6,144,28),Ga(6,136,32),Ga(6,104,48),Ga(6,72,64),Ga(1,144,28);var qa=Ga(1,136,32);Ga(1,104,48),Ga(1,72,64);var Za=function(e,t,n){return r=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ha(t,e,void 0===r.dkLen?n:r.dkLen,!0)},i=function(e,t){return r(t).update(yt(e)).digest()},o=r({}),i.outputLen=o.outputLen,i.blockLen=o.blockLen,i.create=function(e){return r(e)},i;var r,i,o};Za(31,168,16),Za(31,136,32);var Ja=function(e){Y(n,mt);var t=X(n);function n(e,r){var i;B(this,n),(i=t.call(this)).finished=!1,i.destroyed=!1,ht.hash(e);var o=yt(r);if(i.iHash=e.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?e.create().update(o).digest():o);for(var u=0;u<s.length;u++)s[u]^=54;i.iHash.update(s),i.oHash=e.create();for(var c=0;c<s.length;c++)s[c]^=106;return i.oHash.update(s),s.fill(0),i}return W(n,[{key:"update",value:function(e){return ht.exists(this),this.iHash.update(e),this}},{key:"digestInto",value:function(e){ht.exists(this),ht.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}},{key:"digest",value:function(){var e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}},{key:"_cloneInto",value:function(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));var t=this.oHash,n=this.iHash,r=this.finished,i=this.destroyed,o=this.blockLen,a=this.outputLen;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}},{key:"destroy",value:function(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}]),n}(),Xa=function(e,t,n){return new Ja(e,t).update(n).digest()};Xa.create=function(e,t){return new Ja(e,t)};var Ka=BigInt(0),$a=BigInt(1),es=BigInt(2),ts=BigInt(3),ns=BigInt(8),rs=Object.freeze({a:Ka,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:$a,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),is=function(e,t){return(e+t/es)/t},os=BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),as=function(e){var t=rs.n,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-$a*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,a=BigInt("0x100000000000000000000000000000000"),s=is(o*e,t),u=is(-r*e,t),c=_s(e-s*n-u*i,t),l=_s(-s*r-u*o,t),d=c>a,h=l>a;if(d&&(c=t-c),h&&(l=t-l),c>a||l>a)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:d,k1:c,k2neg:h,k2:l}},ss=32,us=32,cs=ss+1,ls=2*ss+1;function ds(e){var t=rs.a,n=rs.b,r=_s(e*e),i=_s(r*e);return _s(i+t*e+n)}var hs=rs.a===Ka,ps=function(e){Y(n,q(Error));var t=X(n);function n(e){return B(this,n),t.call(this,e)}return W(n)}();function fs(e){if(!(e instanceof ys))throw new TypeError("JacobianPoint expected")}var ys=function(){function e(t,n,r){B(this,e),this.x=t,this.y=n,this.z=r}return W(e,[{key:"equals",value:function(e){fs(e);var t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,a=e.z,s=_s(r*r),u=_s(a*a),c=_s(t*u),l=_s(i*s),d=_s(_s(n*a)*u),h=_s(_s(o*r)*s);return c===l&&d===h}},{key:"negate",value:function(){return new e(this.x,_s(-this.y),this.z)}},{key:"double",value:function(){var t=this.x,n=this.y,r=this.z,i=_s(t*t),o=_s(n*n),a=_s(o*o),s=t+o,u=_s(es*(_s(s*s)-i-a)),c=_s(ts*i),l=_s(c*c),d=_s(l-es*u);return new e(d,_s(c*(u-d)-ns*a),_s(es*n*r))}},{key:"add",value:function(t){fs(t);var n=this.x,r=this.y,i=this.z,o=t.x,a=t.y,s=t.z;if(o===Ka||a===Ka)return this;if(n===Ka||r===Ka)return t;var u=_s(i*i),c=_s(s*s),l=_s(n*c),d=_s(o*u),h=_s(_s(r*s)*c),p=_s(_s(a*i)*u),f=_s(d-l),y=_s(p-h);if(f===Ka)return y===Ka?this.double():e.ZERO;var m=_s(f*f),g=_s(f*m),v=_s(l*m),w=_s(y*y-g-es*v);return new e(w,_s(y*(v-w)-h*g),_s(i*s*f))}},{key:"subtract",value:function(e){return this.add(e.negate())}},{key:"multiplyUnsafe",value:function(t){var n=e.ZERO;if("bigint"==typeof t&&t===Ka)return n;var r=zs(t);if(r===$a)return this;if(!hs){for(var i=n,o=this;r>Ka;)r&$a&&(i=i.add(o)),o=o.double(),r>>=$a;return i}for(var a=as(r),s=a.k1neg,u=a.k1,c=a.k2neg,l=a.k2,d=n,h=n,p=this;u>Ka||l>Ka;)u&$a&&(d=d.add(p)),l&$a&&(h=h.add(p)),p=p.double(),u>>=$a,l>>=$a;return s&&(d=d.negate()),c&&(h=h.negate()),h=new e(_s(h.x*os),h.y,h.z),d.add(h)}},{key:"precomputeWindow",value:function(e){for(var t=hs?128/e+1:256/e+1,n=[],r=this,i=r,o=0;o<t;o++){i=r,n.push(i);for(var a=1;a<Math.pow(2,e-1);a++)i=i.add(r),n.push(i);r=i.double()}return n}},{key:"wNAF",value:function(t,n){!n&&this.equals(e.BASE)&&(n=vs.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&&gs.get(n);i||(i=this.precomputeWindow(r),n&&1!==r&&(i=e.normalizeZ(i),gs.set(n,i)));for(var o=e.ZERO,a=e.BASE,s=1+(hs?128/r:256/r),u=Math.pow(2,r-1),c=BigInt(Math.pow(2,r)-1),l=Math.pow(2,r),d=BigInt(r),h=0;h<s;h++){var p=h*u,f=Number(t&c);t>>=d,f>u&&(f-=l,t+=$a);var y=p,m=p+Math.abs(f)-1,g=h%2!=0,v=f<0;0===f?a=a.add(ms(g,i[y])):o=o.add(ms(v,i[m]))}return{p:o,f:a}}},{key:"multiply",value:function(t,n){var r,i,o=zs(t);if(hs){var a=as(o),s=a.k1neg,u=a.k1,c=a.k2neg,l=a.k2,d=this.wNAF(u,n),h=d.p,p=d.f,f=this.wNAF(l,n),y=f.p,m=f.f;h=ms(s,h),y=new e(_s((y=ms(c,y)).x*os),y.y,y.z),r=h.add(y),i=p.add(m)}else{var g=this.wNAF(o,n);r=g.p,i=g.f}return e.normalizeZ([r,i])[0]}},{key:"toAffine",value:function(t){var n=this.x,r=this.y,i=this.z,o=this.equals(e.ZERO);null==t&&(t=o?ns:Rs(i));var a=t,s=_s(a*a),u=_s(s*a),c=_s(n*s),l=_s(r*u),d=_s(i*a);if(o)return vs.ZERO;if(d!==$a)throw new Error("invZ was invalid");return new vs(c,l)}}],[{key:"fromAffine",value:function(t){if(!(t instanceof vs))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(vs.ZERO)?e.ZERO:new e(t.x,t.y,$a)}},{key:"toAffineBatch",value:function(e){var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rs.P,n=new Array(e.length),r=e.reduce((function(e,r,i){return r===Ka?e:(n[i]=e,_s(e*r,t))}),$a),i=Rs(r,t);return e.reduceRight((function(e,r,i){return r===Ka?e:(n[i]=_s(e*n[i],t),_s(e*r,t))}),i),n}(e.map((function(e){return e.z})));return e.map((function(e,n){return e.toAffine(t[n])}))}},{key:"normalizeZ",value:function(t){return e.toAffineBatch(t).map(e.fromAffine)}}]),e}();function ms(e,t){var n=t.negate();return e?n:t}ys.BASE=new ys(rs.Gx,rs.Gy,$a),ys.ZERO=new ys(Ka,$a,Ka);var gs=new WeakMap,vs=function(){function e(t,n){B(this,e),this.x=t,this.y=n}return W(e,[{key:"_setWindowSize",value:function(e){this._WINDOW_SIZE=e,gs.delete(this)}},{key:"hasEvenY",value:function(){return this.y%es===Ka}},{key:"toRawBytes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Cs(this.toHex(e))}},{key:"toHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=Ls(this.x);if(e){var n=this.hasEvenY()?"02":"03";return"".concat(n).concat(t)}return"04".concat(t).concat(Ls(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 e="Point is not on elliptic curve",t=this.x,n=this.y;if(!Qs(t)||!Qs(n))throw new Error(e);var r=_s(n*n);if(_s(r-ds(t))!==Ka)throw new Error(e)}},{key:"equals",value:function(e){return this.x===e.x&&this.y===e.y}},{key:"negate",value:function(){return new e(this.x,_s(-this.y))}},{key:"double",value:function(){return ys.fromAffine(this).double().toAffine()}},{key:"add",value:function(e){return ys.fromAffine(this).add(ys.fromAffine(e)).toAffine()}},{key:"subtract",value:function(e){return this.add(e.negate())}},{key:"multiply",value:function(e){return ys.fromAffine(this).multiply(e,this).toAffine()}},{key:"multiplyAndAddUnsafe",value:function(t,n,r){var i=ys.fromAffine(this),o=n===Ka||n===$a||this!==e.BASE?i.multiplyUnsafe(n):i.multiply(n),a=ys.fromAffine(t).multiplyUnsafe(r),s=o.add(a);return s.equals(ys.ZERO)?void 0:s.toAffine()}}],[{key:"fromCompressedHex",value:function(t){var n=32===t.length,r=Ds(n?t:t.subarray(1));if(!Qs(r))throw new Error("Point is not on curve");var i=function(e){var t=rs.P,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),s=BigInt(88),u=e*e*e%t,c=u*u*e%t,l=Ps(c,ts)*c%t,d=Ps(l,ts)*c%t,h=Ps(d,es)*u%t,p=Ps(h,r)*h%t,f=Ps(p,i)*p%t,y=Ps(f,a)*f%t,m=Ps(y,s)*y%t,g=Ps(m,a)*f%t,v=Ps(g,ts)*c%t,w=Ps(v,o)*p%t,b=Ps(w,n)*u%t,M=Ps(b,es),A=M*M%t;if(A!==e)throw new Error("Cannot find square root");return M}(ds(r)),o=(i&$a)===$a;n?o&&(i=_s(-i)):1==(1&t[0])!==o&&(i=_s(-i));var a=new e(r,i);return a.assertValidity(),a}},{key:"fromUncompressedHex",value:function(t){var n=new e(Ds(t.subarray(1,ss+1)),Ds(t.subarray(ss+1,2*ss+1)));return n.assertValidity(),n}},{key:"fromHex",value:function(e){var t=Os(e),n=t.length,r=t[0];if(n===ss)return this.fromCompressedHex(t);if(n===cs&&(2===r||3===r))return this.fromCompressedHex(t);if(n===ls&&4===r)return this.fromUncompressedHex(t);throw new Error("Point.fromHex: received invalid point. Expected 32-".concat(cs," compressed bytes or ").concat(ls," uncompressed bytes, not ").concat(n))}},{key:"fromPrivateKey",value:function(t){return e.BASE.multiply(Fs(t))}},{key:"fromSignature",value:function(t,n,r){var i=function(e){if(e instanceof Ms)return e.assertValidity(),e;try{return Ms.fromDER(e)}catch(t){return Ms.fromCompact(e)}}(n),o=i.r,a=i.s;if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");var s=Bs(Os(t)),u=rs.n,c=2===r||3===r?o+u:o,l=Rs(c,u),d=_s(-s*l,u),h=_s(a*l,u),p=1&r?"03":"02",f=e.fromHex(p+Ls(c)),y=e.BASE.multiplyAndAddUnsafe(f,d,h);if(!y)throw new Error("Cannot recover signature: point at infinify");return y.assertValidity(),y}}]),e}();function ws(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function bs(e){if(e.length<2||2!==e[0])throw new Error("Invalid signature integer tag: ".concat(Ns(e)));var t=e[1],n=e.subarray(2,t+2);if(!t||n.length!==t)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:Ds(n),left:e.subarray(t+2)}}vs.BASE=new vs(rs.Gx,rs.Gy),vs.ZERO=new vs(Ka,Ka);var Ms=function(){function e(t,n){B(this,e),this.r=t,this.s=n,this.assertValidity()}return W(e,[{key:"assertValidity",value:function(){var e=this.r,t=this.s;if(!Ws(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Ws(t))throw new Error("Invalid Signature: s must be 0 < s < n")}},{key:"hasHighS",value:function(){var e=rs.n>>$a;return this.s>e}},{key:"normalizeS",value:function(){return this.hasHighS()?new e(this.r,_s(-this.s,rs.n)):this}},{key:"toDERRawBytes",value:function(){return Cs(this.toDERHex())}},{key:"toDERHex",value:function(){var e=ws(Ss(this.s)),t=ws(Ss(this.r)),n=e.length/2,r=t.length/2,i=Ss(n),o=Ss(r),a=Ss(r+n+4);return"30".concat(a,"02").concat(o).concat(t,"02").concat(i).concat(e)}},{key:"toRawBytes",value:function(){return this.toDERRawBytes()}},{key:"toHex",value:function(){return this.toDERHex()}},{key:"toCompactRawBytes",value:function(){return Cs(this.toCompactHex())}},{key:"toCompactHex",value:function(){return Ls(this.r)+Ls(this.s)}}],[{key:"fromCompact",value:function(t){var n=t instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof t&&!n)throw new TypeError("".concat(r,": Expected string or Uint8Array"));var i=n?Ns(t):t;if(128!==i.length)throw new Error("".concat(r,": Expected 64-byte hex"));return new e(js(i.slice(0,64)),js(i.slice(64,128)))}},{key:"fromDER",value:function(t){var n=t instanceof Uint8Array;if("string"!=typeof t&&!n)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");var r=function(e){if(e.length<2||48!=e[0])throw new Error("Invalid signature tag: ".concat(Ns(e)));if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");var t=bs(e.subarray(2)),n=t.data,r=bs(t.left),i=r.data,o=r.left;if(o.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(Ns(o)));return{r:n,s:i}}(n?t:Cs(t));return new e(r.r,r.s)}},{key:"fromHex",value:function(e){return this.fromDER(e)}}]),e}();function As(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.every((function(e){return e instanceof Uint8Array})))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];for(var r=t.reduce((function(e,t){return e+t.length}),0),i=new Uint8Array(r),o=0,a=0;o<t.length;o++){var s=t[o];i.set(s,a),a+=s.length}return i}var Es=Array.from({length:256},(function(e,t){return t.toString(16).padStart(2,"0")}));function Ns(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");for(var t="",n=0;n<e.length;n++)t+=Es[e[n]];return t}var Ts,Is,ks=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function Ls(e){if("bigint"!=typeof e)throw new Error("Expected bigint");if(!(Ka<=e&&e<ks))throw new Error("Expected number 0 <= n < 2^256");return e.toString(16).padStart(64,"0")}function xs(e){var t=Cs(Ls(e));if(32!==t.length)throw new Error("Error: expected 32 bytes");return t}function Ss(e){var t=e.toString(16);return 1&t.length?"0".concat(t):t}function js(e){if("string"!=typeof e)throw new TypeError("hexToNumber: expected string, got "+_(e));return BigInt("0x".concat(e))}function Cs(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+_(e));if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);for(var t=new Uint8Array(e.length/2),n=0;n<t.length;n++){var r=2*n,i=e.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[n]=o}return t}function Ds(e){return js(Ns(e))}function Os(e){return e instanceof Uint8Array?Uint8Array.from(e):Cs(e)}function zs(e){if("number"==typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"==typeof e&&Ws(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function _s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rs.P,n=e%t;return n>=Ka?n:t+n}function Ps(e,t){for(var n=rs.P,r=e;t-- >Ka;)r*=r,r%=n;return r}function Rs(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rs.P;if(e===Ka||t<=Ka)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));for(var n=_s(e,t),r=t,i=Ka,o=$a;n!==Ka;){var a=r%n,s=i-o*(r/n);r=n,n=a,i=o,o=s}if(r!==$a)throw new Error("invert: does not exist");return _s(i,t)}function Bs(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=function(e){var t=8*e.length-8*us,n=Ds(e);return t>0?n>>BigInt(t):n}(e);if(t)return n;var r=rs.n;return n>=r?n-r:n}var Us=function(){function e(t,n){if(B(this,e),this.hashLen=t,this.qByteLen=n,"number"!=typeof t||t<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(t).fill(1),this.k=new Uint8Array(t).fill(0),this.counter=0}var t,n;return W(e,[{key:"hmac",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return $s.hmacSha256.apply($s,[this.k].concat(t))}},{key:"hmacSync",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Is.apply(void 0,[this.k].concat(t))}},{key:"checkSync",value:function(){if("function"!=typeof Is)throw new ps("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=R(z().mark((function e(){var t,n=arguments;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:new Uint8Array,e.next=3,this.hmac(this.v,Uint8Array.from([0]),t);case 3:return this.k=e.sent,e.next=6,this.hmac(this.v);case 6:if(this.v=e.sent,0!==t.length){e.next=9;break}return e.abrupt("return");case 9:return e.next=11,this.hmac(this.v,Uint8Array.from([1]),t);case 11:return this.k=e.sent,e.next=14,this.hmac(this.v);case 14:this.v=e.sent;case 15:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"reseedSync",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}},{key:"generate",value:(t=R(z().mark((function e(){var t,n,r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.incr(),t=0,n=[];case 3:if(!(t<this.qByteLen)){e.next=12;break}return e.next=6,this.hmac(this.v);case 6:this.v=e.sent,r=this.v.slice(),n.push(r),t+=this.v.length,e.next=3;break;case 12:return e.abrupt("return",As.apply(void 0,n));case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"generateSync",value:function(){this.checkSync(),this.incr();for(var e=0,t=[];e<this.qByteLen;){this.v=this.hmacSync(this.v);var n=this.v.slice();t.push(n),e+=this.v.length}return As.apply(void 0,t)}}]),e}();function Ws(e){return Ka<e&&e<rs.n}function Qs(e){return Ka<e&&e<rs.P}function Ys(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=rs.n,o=Bs(e,!0);if(Ws(o)){var a=Rs(o,i),s=vs.BASE.multiply(o),u=_s(s.x,i);if(u!==Ka){var c=_s(a*_s(t+n*u,i),i);if(c!==Ka){var l=new Ms(u,c),d=(s.x===l.r?0:2)|Number(s.y&$a);return r&&l.hasHighS()&&(l=l.normalizeS(),d^=1),{sig:l,recovery:d}}}}}function Fs(e){var t;if("bigint"==typeof e)t=e;else if("number"==typeof e&&Number.isSafeInteger(e)&&e>0)t=BigInt(e);else if("string"==typeof e){if(e.length!==2*us)throw new Error("Expected 32 bytes of private key");t=js(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private key");if(e.length!==us)throw new Error("Expected 32 bytes of private key");t=Ds(e)}if(!Ws(t))throw new Error("Expected private key: 0 < key < n");return t}function Vs(e){return Ds(e.length>ss?e.slice(0,ss):e)}function Hs(e){var t=Vs(e),n=_s(t,rs.n);return Gs(n<Ka?t:n)}function Gs(e){return xs(e)}function qs(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=function(e,t,n){if(null==e)throw new Error('sign: expected valid message hash, not "'.concat(e,'"'));var r=Os(e),i=Fs(t),o=[Gs(i),Hs(r)];if(null!=n){!0===n&&(n=$s.randomBytes(ss));var a=Os(n);if(a.length!==ss)throw new Error("sign: Expected ".concat(ss," bytes of extra data"));o.push(a)}return{seed:As.apply(void 0,o),m:Vs(r),d:i}}(e,t,r.extraEntropy),o=i.seed,a=i.m,s=i.d,u=new Us(32,us);for(u.reseedSync(o);!(n=Ys(u.generateSync(),a,s,r.canonical));)u.reseedSync();return function(e,t){var n=e.sig,r=e.recovery,i=Object.assign({canonical:!0,der:!0},t),o=i.der,a=i.recovered,s=o?n.toDERRawBytes():n.toCompactRawBytes();return a?[s,r]:s}(n,r)}vs.BASE._setWindowSize(8);var Zs,Js,Xs={node:zt,web:"object"===("undefined"==typeof self?"undefined":_(self))&&"crypto"in self?self.crypto:void 0},Ks={},$s={bytesToHex:Ns,hexToBytes:Cs,concatBytes:As,mod:_s,invert:Rs,isValidPrivateKey:function(e){try{return Fs(e),!0}catch(e){return!1}},_bigintTo32Bytes:xs,_normalizePrivateKey:Fs,hashToPrivateKey:function(e){e=Os(e);var t=us+8;if(e.length<t||e.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return xs(_s(Ds(e),rs.n-$a)+$a)},randomBytes:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Xs.web)return Xs.web.getRandomValues(new Uint8Array(e));if(Xs.node){var t=Xs.node.randomBytes;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:function(){return $s.hashToPrivateKey($s.randomBytes(us+8))},precompute:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vs.BASE,n=t===vs.BASE?t:new vs(t.x,t.y);return n._setWindowSize(e),n.multiply(ts),n},sha256:function(){var e=R(z().mark((function e(){var t,n,r,i,o,a,s=arguments;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=s.length,n=new Array(t),r=0;r<t;r++)n[r]=s[r];if(!Xs.web){e.next=8;break}return e.next=4,Xs.web.subtle.digest("SHA-256",As.apply(void 0,n));case 4:return i=e.sent,e.abrupt("return",new Uint8Array(i));case 8:if(!Xs.node){e.next=15;break}return o=Xs.node.createHash,a=o("sha256"),n.forEach((function(e){return a.update(e)})),e.abrupt("return",Uint8Array.from(a.digest()));case 15:throw new Error("The environment doesn't have sha256 function");case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),hmacSha256:(Js=R(z().mark((function e(t){var n,r,i,o,a,s,u,c,l=arguments;return z().wrap((function(e){for(;;)switch(e.prev=e.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(!Xs.web){e.next=12;break}return e.next=4,Xs.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);case 4:return o=e.sent,a=As.apply(void 0,r),e.next=8,Xs.web.subtle.sign("HMAC",o,a);case 8:return s=e.sent,e.abrupt("return",new Uint8Array(s));case 12:if(!Xs.node){e.next=19;break}return u=Xs.node.createHmac,c=u("sha256",t),r.forEach((function(e){return c.update(e)})),e.abrupt("return",Uint8Array.from(c.digest()));case 19:throw new Error("The environment doesn't have hmac-sha256 function");case 20:case"end":return e.stop()}}),e)}))),function(e){return Js.apply(this,arguments)}),sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:(Zs=R(z().mark((function e(t){var n,r,i,o,a,s=arguments;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(n=Ks[t])){e.next=7;break}return e.next=4,$s.sha256(Uint8Array.from(t,(function(e){return e.charCodeAt(0)})));case 4:r=e.sent,n=As(r,r),Ks[t]=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 e.abrupt("return",$s.sha256.apply($s,[n].concat(o)));case 9:case"end":return e.stop()}}),e)}))),function(e){return Zs.apply(this,arguments)}),taggedHashSync:function(e){if("function"!=typeof Ts)throw new ps("sha256Sync is undefined, you need to set it");var t=Ks[e];if(void 0===t){var n=Ts(Uint8Array.from(e,(function(e){return e.charCodeAt(0)})));t=As(n,n),Ks[e]=t}for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return Ts.apply(void 0,[t].concat(i))},_JacobianPoint:ys};Object.defineProperties($s,{sha256Sync:{configurable:!1,get:function(){return Ts},set:function(e){Ts||(Ts=e)}},hmacSha256Sync:{configurable:!1,get:function(){return Is},set:function(e){Is||(Is=e)}}});var eu=["commitment"],tu=["encoding"],nu=["commitment"],ru=["commitment"];Cn.sha512Sync=function(){var e;return Ot((e=Cn).concatBytes.apply(e,arguments))};var iu=Cn.randomPrivateKey,ou=function(){var e=Cn.randomPrivateKey(),t=au(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),{publicKey:t,secretKey:n}},au=xn.getPublicKey;function su(e){try{return tn.fromHex(e,!0),!0}catch(e){return!1}}var uu=function(e,t){return xn.sign(e,t.slice(0,32))},cu=xn.verify,lu=function(e){return Ee.isBuffer(e)?e:e instanceof Uint8Array?Ee.from(e.buffer,e.byteOffset,e.byteLength):Ee.from(e)},du=function(){function e(t){B(this,e),Object.assign(this,t)}return W(e,[{key:"encode",value:function(){return Ee.from(kr(pu,this))}}],[{key:"decode",value:function(e){return Sr(pu,this,e)}},{key:"decodeUnchecked",value:function(e){return fr(pu,this,e)}}]),e}(),hu=function(e){Y(n,du);var t=X(n);function n(e){var r;if(B(this,n),(r=t.call(this,e)).enum="",1!==Object.keys(e).length)throw new Error("Enum can only take single value");return Object.keys(e).map((function(e){r.enum=e})),r}return W(n)}(),pu=new Map,fu=32;var yu=1,mu=function(e,t){Y(a,du);var n,r,i,o=X(a);function a(e){var t;if(B(this,a),(t=o.call(this,{}))._bn=void 0,function(e){return void 0!==e._bn}(e))t._bn=e._bn;else{if("string"==typeof e){var n=Bn.decode(e);if(n.length!=fu)throw new Error("Invalid public key input");t._bn=new zn(n)}else t._bn=new zn(e);if(t._bn.byteLength()>fu)throw new Error("Invalid public key input")}return t}return W(a,[{key:"equals",value:function(e){return this._bn.eq(e._bn)}},{key:"toBase58",value:function(){return Bn.encode(this.toBytes())}},{key:"toJSON",value:function(){return this.toBase58()}},{key:"toBytes",value:function(){var e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}},{key:"toBuffer",value:function(){var e=this._bn.toArrayLike(Ee);if(e.length===fu)return e;var t=Ee.alloc(32);return e.copy(t,32-e.length),t}},{key:t,get:function(){return"PublicKey(".concat(this.toString(),")")}},{key:"toString",value:function(){return this.toBase58()}}],[{key:"unique",value:function(){var e=new a(yu);return yu+=1,new a(e.toBuffer())}},{key:"createWithSeed",value:(i=R(z().mark((function e(t,n,r){var i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Ee.concat([t.toBuffer(),Ee.from(n),r.toBuffer()]),o=Hn(i),e.abrupt("return",new a(o));case 3:case"end":return e.stop()}}),e)}))),function(e,t,n){return i.apply(this,arguments)})},{key:"createProgramAddressSync",value:function(e,t){var n=Ee.alloc(0);e.forEach((function(e){if(e.length>32)throw new TypeError("Max seed length exceeded");n=Ee.concat([n,lu(e)])})),n=Ee.concat([n,t.toBuffer(),Ee.from("ProgramDerivedAddress")]);var r=Hn(n);if(su(r))throw new Error("Invalid seeds, address must fall off the curve");return new a(r)}},{key:"createProgramAddress",value:(r=R(z().mark((function e(t,n){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.createProgramAddressSync(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"findProgramAddressSync",value:function(e,t){for(var n,r=255;0!=r;){try{var i=e.concat(Ee.from([r]));n=this.createProgramAddressSync(i,t)}catch(e){if(e instanceof TypeError)throw e;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}},{key:"findProgramAddress",value:(n=R(z().mark((function e(t,n){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.findProgramAddressSync(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"isOnCurve",value:function(e){return su(new a(e).toBytes())}}]),a}(0,Symbol.toStringTag);mu.default=new mu("11111111111111111111111111111111"),pu.set(mu,{kind:"struct",fields:[["_bn","u256"]]});var gu=function(){function e(t){if(B(this,e),this._publicKey=void 0,this._secretKey=void 0,t){var n=lu(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=n.slice(32,64),this._secretKey=n.slice(0,32)}else this._secretKey=lu(iu()),this._publicKey=lu(au(this._secretKey))}return W(e,[{key:"publicKey",get:function(){return new mu(this._publicKey)}},{key:"secretKey",get:function(){return Ee.concat([this._secretKey,this._publicKey],64)}}]),e}(),vu=new mu("BPFLoader1111111111111111111111111111111111"),wu=1232,bu=127,Mu=64,Au=function(e){Y(n,q(Error));var t=X(n);function n(e){var r;return B(this,n),(r=t.call(this,"Signature ".concat(e," has expired: block height exceeded."))).signature=void 0,r.signature=e,r}return W(n)}();Object.defineProperty(Au.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var Eu=function(e){Y(n,q(Error));var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,"Transaction was not confirmed in ".concat(r.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(e," using the Solana Explorer or CLI tools."))).signature=void 0,i.signature=e,i}return W(n)}();Object.defineProperty(Eu.prototype,"name",{value:"TransactionExpiredTimeoutError"});var Nu=function(e){Y(n,q(Error));var t=X(n);function n(e){var r;return B(this,n),(r=t.call(this,"Signature ".concat(e," has expired: the nonce is no longer valid."))).signature=void 0,r.signature=e,r}return W(n)}();Object.defineProperty(Nu.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var Tu=function(){function e(t,n){B(this,e),this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=n}return W(e,[{key:"keySegments",value:function(){var e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}},{key:"get",value:function(e){var t,n=ae(this.keySegments());try{for(n.s();!(t=n.n()).done;){var r=t.value;if(e<r.length)return r[e];e-=r.length}}catch(e){n.e(e)}finally{n.f()}}},{key:"length",get:function(){return this.keySegments().flat().length}},{key:"compileInstructions",value:function(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");var t=new Map;this.keySegments().flat().forEach((function(e,n){t.set(e.toBase58(),n)}));var n=function(e){var n=t.get(e.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return e.map((function(e){return{programIdIndex:n(e.programId),accountKeyIndexes:e.keys.map((function(e){return n(e.pubkey)})),data:e.data}}))}}]),e}(),Iu=function(){return Ei(32,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey")},ku=function(){return Ei(64,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature")},Lu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",t=Mi([vi("length"),vi("lengthPadding"),Ei(yi(vi(),-8),"chars")],e),n=t.decode.bind(t),r=t.encode.bind(t),i=t;return i.decode=function(e,t){return n(e,t).chars.toString()},i.encode=function(e,t,n){var i={chars:Ee.from(e,"utf8")};return r(i,t,n)},i.alloc=function(e){return vi().span+vi().span+Ee.from(e,"utf8").length},i};function xu(e,t){var n=function e(n){if(n.span>=0)return n.span;if("function"==typeof n.alloc)return n.alloc(t[n.property]);if("count"in n&&"elementLayout"in n){var r=t[n.property];if(Array.isArray(r))return r.length*e(n.elementLayout)}else if("fields"in n)return xu({layout:n},t[n.property]);return 0},r=0;return e.layout.fields.forEach((function(e){r+=n(e)})),r}function Su(e){for(var t=0,n=0;;){var r=e.shift();if(t|=(127&r)<<7*n,n+=1,0==(128&r))break}return t}function ju(e,t){for(var n=t;;){var r=127&n;if(0==(n>>=7)){e.push(r);break}r|=128,e.push(r)}}function Cu(e,t){if(!e)throw new Error(t||"Assertion failed")}var Du,Ou=function(){function e(t,n){B(this,e),this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=n}return W(e,[{key:"getMessageComponents",value:function(){var e=ee(this.keyMetaMap.entries());Cu(e.length<=256,"Max static account keys length exceeded");var t=e.filter((function(e){var t=$(e,2)[1];return t.isSigner&&t.isWritable})),n=e.filter((function(e){var t=$(e,2)[1];return t.isSigner&&!t.isWritable})),r=e.filter((function(e){var t=$(e,2)[1];return!t.isSigner&&t.isWritable})),i=e.filter((function(e){var t=$(e,2)[1];return!t.isSigner&&!t.isWritable})),o={numRequiredSignatures:t.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};return Cu(t.length>0,"Expected at least one writable signer key"),Cu($(t[0],1)[0]===this.payer.toBase58(),"Expected first writable signer key to be the fee payer"),[o,[].concat(ee(t.map((function(e){var t=$(e,1)[0];return new mu(t)}))),ee(n.map((function(e){var t=$(e,1)[0];return new mu(t)}))),ee(r.map((function(e){var t=$(e,1)[0];return new mu(t)}))),ee(i.map((function(e){var t=$(e,1)[0];return new mu(t)}))))]}},{key:"extractTableLookup",value:function(e){var t=$(this.drainKeysFoundInLookupTable(e.state.addresses,(function(e){return!e.isSigner&&!e.isInvoked&&e.isWritable})),2),n=t[0],r=t[1],i=$(this.drainKeysFoundInLookupTable(e.state.addresses,(function(e){return!e.isSigner&&!e.isInvoked&&!e.isWritable})),2),o=i[0],a=i[1];if(0!==n.length||0!==o.length)return[{accountKey:e.key,writableIndexes:n,readonlyIndexes:o},{writable:r,readonly:a}]}},{key:"drainKeysFoundInLookupTable",value:function(e,t){var n,r=this,i=new Array,o=new Array,a=ae(this.keyMetaMap.entries());try{var s=function(){var a=$(n.value,2),s=a[0],u=a[1];if(t(u)){var c=new mu(s),l=e.findIndex((function(e){return e.equals(c)}));l>=0&&(Cu(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(e){a.e(e)}finally{a.f()}return[i,o]}}],[{key:"compile",value:function(t,n){var r=new Map,i=function(e){var t=e.toBase58(),n=r.get(t);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(t,n)),n},o=i(n);o.isSigner=!0,o.isWritable=!0;var a,s=ae(t);try{for(s.s();!(a=s.n()).done;){var u=a.value;i(u.programId).isInvoked=!0;var c,l=ae(u.keys);try{for(l.s();!(c=l.n()).done;){var d=c.value,h=i(d.pubkey);h.isSigner||(h.isSigner=d.isSigner),h.isWritable||(h.isWritable=d.isWritable)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){s.e(e)}finally{s.f()}return new e(n,r)}}]),e}(),zu=function(){function e(t){var n=this;B(this,e),this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((function(e){return new mu(e)})),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((function(e){return n.indexToProgramIds.set(e.programIdIndex,n.accountKeys[e.programIdIndex])}))}return W(e,[{key:"version",get:function(){return"legacy"}},{key:"staticAccountKeys",get:function(){return this.accountKeys}},{key:"compiledInstructions",get:function(){return this.instructions.map((function(e){return{programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Bn.decode(e.data)}}))}},{key:"addressTableLookups",get:function(){return[]}},{key:"getAccountKeys",value:function(){return new Tu(this.staticAccountKeys)}},{key:"isAccountSigner",value:function(e){return e<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(e){var t=this.header.numRequiredSignatures;return e>=this.header.numRequiredSignatures?e-t<this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts:e<t-this.header.numReadonlySignedAccounts}},{key:"isProgramId",value:function(e){return this.indexToProgramIds.has(e)}},{key:"programIds",value:function(){return ee(this.indexToProgramIds.values())}},{key:"nonProgramIds",value:function(){var e=this;return this.accountKeys.filter((function(t,n){return!e.isProgramId(n)}))}},{key:"serialize",value:function(){var e=this.accountKeys.length,t=[];ju(t,e);var n=this.instructions.map((function(e){var t=e.accounts,n=e.programIdIndex,r=Array.from(Bn.decode(e.data)),i=[];ju(i,t.length);var o=[];return ju(o,r.length),{programIdIndex:n,keyIndicesCount:Ee.from(i),keyIndices:t,dataLength:Ee.from(o),data:r}})),r=[];ju(r,n.length);var i=Ee.alloc(wu);Ee.from(r).copy(i);var o=r.length;n.forEach((function(e){var t=Mi([mi("programIdIndex"),Ei(e.keyIndicesCount.length,"keyIndicesCount"),Ai(mi("keyIndex"),e.keyIndices.length,"keyIndices"),Ei(e.dataLength.length,"dataLength"),Ai(mi("userdatum"),e.data.length,"data")]).encode(e,i,o);o+=t})),i=i.slice(0,o);var a=Mi([Ei(1,"numRequiredSignatures"),Ei(1,"numReadonlySignedAccounts"),Ei(1,"numReadonlyUnsignedAccounts"),Ei(t.length,"keyCount"),Ai(Iu("key"),e,"keys"),Iu("recentBlockhash")]),s={numRequiredSignatures:Ee.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Ee.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Ee.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Ee.from(t),keys:this.accountKeys.map((function(e){return lu(e.toBytes())})),recentBlockhash:Bn.decode(this.recentBlockhash)},u=Ee.alloc(2048),c=a.encode(s,u);return i.copy(u,c),u.slice(0,c+i.length)}}],[{key:"compile",value:function(t){var n=$(Ou.compile(t.instructions,t.payerKey).getMessageComponents(),2),r=n[0],i=n[1],o=new Tu(i).compileInstructions(t.instructions).map((function(e){return{programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:Bn.encode(e.data)}}));return new e({header:r,accountKeys:i,recentBlockhash:t.recentBlockhash,instructions:o})}},{key:"from",value:function(t){var n=ee(t),r=n.shift();if(r!==(r&bu))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");for(var i=n.shift(),o=n.shift(),a=Su(n),s=[],u=0;u<a;u++){var c=n.slice(0,fu);n=n.slice(fu),s.push(new mu(Ee.from(c)))}for(var l=n.slice(0,fu),d=Su(n=n.slice(fu)),h=[],p=0;p<d;p++){var f=n.shift(),y=Su(n),m=n.slice(0,y),g=Su(n=n.slice(y)),v=n.slice(0,g),w=Bn.encode(Ee.from(v));n=n.slice(g),h.push({programIdIndex:f,accounts:m,data:w})}return new e({header:{numRequiredSignatures:r,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:o},recentBlockhash:Bn.encode(Ee.from(l)),accountKeys:s,instructions:h})}}]),e}(),_u=function(){function e(t){B(this,e),this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}return W(e,[{key:"version",get:function(){return 0}},{key:"numAccountKeysFromLookups",get:function(){var e,t=0,n=ae(this.addressTableLookups);try{for(n.s();!(e=n.n()).done;){var r=e.value;t+=r.readonlyIndexes.length+r.writableIndexes.length}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"getAccountKeys",value:function(e){var t;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");t=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)t=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new Tu(this.staticAccountKeys,t)}},{key:"isAccountSigner",value:function(e){return e<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(e){var t=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;if(e>=n){var r=e-n,i=this.addressTableLookups.reduce((function(e,t){return e+t.writableIndexes.length}),0);return r<i}return e>=this.header.numRequiredSignatures?e-t<n-t-this.header.numReadonlyUnsignedAccounts:e<t-this.header.numReadonlySignedAccounts}},{key:"resolveAddressTableLookups",value:function(e){var t,n={writable:[],readonly:[]},r=ae(this.addressTableLookups);try{var i=function(){var r=t.value,i=e.find((function(e){return e.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=ae(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(e){a.e(e)}finally{a.f()}var u,c=ae(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(e){c.e(e)}finally{c.f()}};for(r.s();!(t=r.n()).done;)i()}catch(e){r.e(e)}finally{r.f()}return n}},{key:"serialize",value:function(){var e=Array();ju(e,this.staticAccountKeys.length);var t=this.serializeInstructions(),n=Array();ju(n,this.compiledInstructions.length);var r=this.serializeAddressTableLookups(),i=Array();ju(i,this.addressTableLookups.length);var o=Mi([mi("prefix"),Mi([mi("numRequiredSignatures"),mi("numReadonlySignedAccounts"),mi("numReadonlyUnsignedAccounts")],"header"),Ei(e.length,"staticAccountKeysLength"),Ai(Iu(),this.staticAccountKeys.length,"staticAccountKeys"),Iu("recentBlockhash"),Ei(n.length,"instructionsLength"),Ei(t.length,"serializedInstructions"),Ei(i.length,"addressTableLookupsLength"),Ei(r.length,"serializedAddressTableLookups")]),a=new Uint8Array(wu),s=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map((function(e){return e.toBytes()})),recentBlockhash:Bn.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},a);return a.slice(0,s)}},{key:"serializeInstructions",value:function(){var e,t=0,n=new Uint8Array(wu),r=ae(this.compiledInstructions);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Array();ju(o,i.accountKeyIndexes.length);var a=Array();ju(a,i.data.length),t+=Mi([mi("programIdIndex"),Ei(o.length,"encodedAccountKeyIndexesLength"),Ai(mi(),i.accountKeyIndexes.length,"accountKeyIndexes"),Ei(a.length,"encodedDataLength"),Ei(i.data.length,"data")]).encode({programIdIndex:i.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(o),accountKeyIndexes:i.accountKeyIndexes,encodedDataLength:new Uint8Array(a),data:i.data},n,t)}}catch(e){r.e(e)}finally{r.f()}return n.slice(0,t)}},{key:"serializeAddressTableLookups",value:function(){var e,t=0,n=new Uint8Array(wu),r=ae(this.addressTableLookups);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Array();ju(o,i.writableIndexes.length);var a=Array();ju(a,i.readonlyIndexes.length),t+=Mi([Iu("accountKey"),Ei(o.length,"encodedWritableIndexesLength"),Ai(mi(),i.writableIndexes.length,"writableIndexes"),Ei(a.length,"encodedReadonlyIndexesLength"),Ai(mi(),i.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:i.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(o),writableIndexes:i.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(a),readonlyIndexes:i.readonlyIndexes},n,t)}}catch(e){r.e(e)}finally{r.f()}return n.slice(0,t)}}],[{key:"compile",value:function(t){var n,r=Ou.compile(t.instructions,t.payerKey),i=new Array,o={writable:new Array,readonly:new Array},a=ae(t.addressLookupTableAccounts||[]);try{for(a.s();!(n=a.n()).done;){var s=n.value,u=r.extractTableLookup(s);if(void 0!==u){var c,l,d=$(u,2),h=d[0],p=d[1],f=p.writable,y=p.readonly;i.push(h),(c=o.writable).push.apply(c,ee(f)),(l=o.readonly).push.apply(l,ee(y))}}}catch(e){a.e(e)}finally{a.f()}var m=$(r.getMessageComponents(),2),g=m[0],v=m[1],w=new Tu(v,o).compileInstructions(t.instructions);return new e({header:g,staticAccountKeys:v,recentBlockhash:t.recentBlockhash,compiledInstructions:w,addressTableLookups:i})}},{key:"deserialize",value:function(t){var n=ee(t),r=n.shift(),i=r&bu;Cu(r!==i,"Expected versioned message but received legacy message");Cu(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=Su(n),u=0;u<s;u++)a.push(new mu(n.splice(0,fu)));for(var c=Bn.encode(n.splice(0,fu)),l=Su(n),d=[],h=0;h<l;h++){var p=n.shift(),f=Su(n),y=n.splice(0,f),m=Su(n),g=new Uint8Array(n.splice(0,m));d.push({programIdIndex:p,accountKeyIndexes:y,data:g})}for(var v=Su(n),w=[],b=0;b<v;b++){var M=new mu(n.splice(0,fu)),A=Su(n),E=n.splice(0,A),N=Su(n),T=n.splice(0,N);w.push({accountKey:M,writableIndexes:E,readonlyIndexes:T})}return new e({header:o,staticAccountKeys:a,recentBlockhash:c,compiledInstructions:d,addressTableLookups:w})}}]),e}(),Pu={deserializeMessageVersion:function(e){var t=e[0],n=t&bu;return n===t?"legacy":n},deserialize:function(e){var t=Pu.deserializeMessageVersion(e);if("legacy"===t)return zu.from(e);if(0===t)return _u.deserialize(e);throw new Error("Transaction message version ".concat(t," deserialization is not supported"))}};!function(e){e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID"}(Du||(Du={}));var Ru=Ee.alloc(Mu).fill(0),Bu=function(){function e(t){B(this,e),this.keys=void 0,this.programId=void 0,this.data=Ee.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}return W(e,[{key:"toJSON",value:function(){return{keys:this.keys.map((function(e){var t=e.pubkey,n=e.isSigner,r=e.isWritable;return{pubkey:t.toJSON(),isSigner:n,isWritable:r}})),programId:this.programId.toJSON(),data:ee(this.data)}}}]),e}(),Uu=function(){function e(t){if(B(this,e),this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){var n=t.minContextSlot,r=t.nonceInfo;this.minNonceContextSlot=n,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){var i=t.blockhash,o=t.lastValidBlockHeight;this.recentBlockhash=i,this.lastValidBlockHeight=o}else{var a=t.recentBlockhash,s=t.nonceInfo;s&&(this.nonceInfo=s),this.recentBlockhash=a}}var t;return W(e,[{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(e){return e.toJSON()})),signers:this.signatures.map((function(e){return e.publicKey.toJSON()}))}}},{key:"add",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(0===n.length)throw new Error("No instructions");return n.forEach((function(t){"instructions"in t?e.instructions=e.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?e.instructions.push(t):e.instructions.push(new Bu(t))})),this}},{key:"compileMessage",value:function(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;var e,t,n;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction].concat(ee(this.instructions)):this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");if(t.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<t.length;r++)if(void 0===t[r].programId)throw new Error("Transaction instruction index ".concat(r," has undefined program id"));var i=[],o=[];t.forEach((function(e){e.keys.forEach((function(e){o.push(O({},e))}));var t=e.programId.toString();i.includes(t)||i.push(t)})),i.forEach((function(e){o.push({pubkey:new mu(e),isSigner:!1,isWritable:!1})}));var a=[];o.forEach((function(e){var t=e.pubkey.toString(),n=a.findIndex((function(e){return e.pubkey.toString()===t}));n>-1?(a[n].isWritable=a[n].isWritable||e.isWritable,a[n].isSigner=a[n].isSigner||e.isSigner):a.push(e)})),a.sort((function(e,t){return e.isSigner!==t.isSigner?e.isSigner?-1:1:e.isWritable!==t.isWritable?e.isWritable?-1:1:e.pubkey.toBase58().localeCompare(t.pubkey.toBase58())}));var s=a.findIndex((function(e){return e.pubkey.equals(n)}));if(s>-1){var u=$(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=ae(this.signatures);try{var d=function(){var e=c.value,t=a.findIndex((function(t){return t.pubkey.equals(e.publicKey)}));if(!(t>-1))throw new Error("unknown signer: ".concat(e.publicKey.toString()));a[t].isSigner||(a[t].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;)d()}catch(e){l.e(e)}finally{l.f()}var h=0,p=0,f=0,y=[],m=[];a.forEach((function(e){var t=e.pubkey,n=e.isSigner,r=e.isWritable;n?(y.push(t.toString()),h+=1,r||(p+=1)):(m.push(t.toString()),r||(f+=1))}));var g=y.concat(m),v=t.map((function(e){var t=e.data,n=e.programId;return{programIdIndex:g.indexOf(n.toString()),accounts:e.keys.map((function(e){return g.indexOf(e.pubkey.toString())})),data:Bn.encode(t)}}));return v.forEach((function(e){Cu(e.programIdIndex>=0),e.accounts.forEach((function(e){return Cu(e>=0)}))})),new zu({header:{numRequiredSignatures:h,numReadonlySignedAccounts:p,numReadonlyUnsignedAccounts:f},accountKeys:g,recentBlockhash:e,instructions:v})}},{key:"_compile",value:function(){var e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);if(this.signatures.length===t.length){var n=this.signatures.every((function(e,n){return t[n].equals(e.publicKey)}));if(n)return e}return this.signatures=t.map((function(e){return{signature:null,publicKey:e}})),e}},{key:"serializeMessage",value:function(){return this._compile().serialize()}},{key:"getEstimatedFee",value:(t=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getFeeForMessage(this.compileMessage());case 2:return e.abrupt("return",e.sent.value);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setSigners",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");var r=new Set;this.signatures=t.filter((function(e){var t=e.toString();return!r.has(t)&&(r.add(t),!0)})).map((function(e){return{signature:null,publicKey:e}}))}},{key:"sign",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=t;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(e){return{signature:null,publicKey:e.publicKey}}));var c=this._compile();this._partialSign.apply(this,[c].concat(i))}},{key:"partialSign",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=t;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(e){for(var t=this,n=e.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(e){var r=uu(n,e.secretKey);t._addSignature(e.publicKey,lu(r))}))}},{key:"addSignature",value:function(e,t){this._compile(),this._addSignature(e,t)}},{key:"_addSignature",value:function(e,t){Cu(64===t.length);var n=this.signatures.findIndex((function(t){return e.equals(t.publicKey)}));if(n<0)throw new Error("unknown signer: ".concat(e.toString()));this.signatures[n].signature=Ee.from(t)}},{key:"verifySignatures",value:function(e){return this._verifySignatures(this.serializeMessage(),void 0===e||e)}},{key:"_verifySignatures",value:function(e,t){var n,r=ae(this.signatures);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i.signature,a=i.publicKey;if(null===o){if(t)return!1}else if(!cu(o,e,a.toBytes()))return!1}}catch(e){r.e(e)}finally{r.f()}return!0}},{key:"serialize",value:function(e){var t=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=t.requireAllSignatures,r=t.verifySignatures,i=this.serializeMessage();if(r&&!this._verifySignatures(i,n))throw new Error("Signature verification failed");return this._serialize(i)}},{key:"_serialize",value:function(e){var t=this.signatures,n=[];ju(n,t.length);var r=n.length+64*t.length+e.length,i=Ee.alloc(r);return Cu(t.length<256),Ee.from(n).copy(i,0),t.forEach((function(e,t){var r=e.signature;null!==r&&(Cu(64===r.length,"signature has invalid length"),Ee.from(r).copy(i,n.length+64*t))})),e.copy(i,n.length+64*t.length),Cu(i.length<=wu,"Transaction too large: ".concat(i.length," > ").concat(wu)),i}},{key:"keys",get:function(){return Cu(1===this.instructions.length),this.instructions[0].keys.map((function(e){return e.pubkey}))}},{key:"programId",get:function(){return Cu(1===this.instructions.length),this.instructions[0].programId}},{key:"data",get:function(){return Cu(1===this.instructions.length),this.instructions[0].data}}],[{key:"from",value:function(t){for(var n=ee(t),r=Su(n),i=[],o=0;o<r;o++){var a=n.slice(0,Mu);n=n.slice(Mu),i.push(Bn.encode(Ee.from(a)))}return e.populate(zu.from(n),i)}},{key:"populate",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=new e;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),n.forEach((function(e,n){var i={signature:e==Bn.encode(Ru)?null:Bn.decode(e),publicKey:t.accountKeys[n]};r.signatures.push(i)})),t.instructions.forEach((function(e){var n=e.accounts.map((function(e){var n=t.accountKeys[e];return{pubkey:n,isSigner:r.signatures.some((function(e){return e.publicKey.toString()===n.toString()}))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));r.instructions.push(new Bu({keys:n,programId:t.accountKeys[e.programIdIndex],data:Bn.decode(e.data)}))})),r._message=t,r._json=r.toJSON(),r}}]),e}(),Wu=function(){function e(t){B(this,e),this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}return W(e,[{key:"compileToLegacyMessage",value:function(){return zu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}},{key:"compileToV0Message",value:function(e){return _u.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:e})}}],[{key:"decompile",value:function(t,n){var r=t.header,i=t.compiledInstructions,o=t.recentBlockhash,a=r.numRequiredSignatures,s=r.numReadonlySignedAccounts,u=r.numReadonlyUnsignedAccounts,c=a-s;Cu(c>0,"Message header is invalid");var l=t.staticAccountKeys.length-a-u;Cu(l>=0,"Message header is invalid");var d=t.getAccountKeys(n),h=d.get(0);if(void 0===h)throw new Error("Failed to decompile message because no account keys were found");var p,f=[],y=ae(i);try{for(y.s();!(p=y.n()).done;){var m,g=p.value,v=[],w=ae(g.accountKeyIndexes);try{for(w.s();!(m=w.n()).done;){var b=m.value,M=d.get(b);if(void 0===M)throw new Error("Failed to find key for account key index ".concat(b));var A=void 0;A=b<a?b<c:b<d.staticAccountKeys.length?b-a<l:b-d.staticAccountKeys.length<d.accountKeysFromLookups.writable.length,v.push({pubkey:M,isSigner:b<r.numRequiredSignatures,isWritable:A})}}catch(e){w.e(e)}finally{w.f()}var E=d.get(g.programIdIndex);if(void 0===E)throw new Error("Failed to find program id for program id index ".concat(g.programIdIndex));f.push(new Bu({programId:E,data:lu(g.data),keys:v}))}}catch(e){y.e(e)}finally{y.f()}return new e({payerKey:h,instructions:f,recentBlockhash:o})}}]),e}(),Qu=function(){function e(t,n){if(B(this,e),this.signatures=void 0,this.message=void 0,void 0!==n)Cu(n.length===t.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=n;else{for(var r=[],i=0;i<t.header.numRequiredSignatures;i++)r.push(new Uint8Array(Mu));this.signatures=r}this.message=t}return W(e,[{key:"version",get:function(){return this.message.version}},{key:"serialize",value:function(){var e=this.message.serialize(),t=Array();ju(t,this.signatures.length);var n=Mi([Ei(t.length,"encodedSignaturesLength"),Ai(ku(),this.signatures.length,"signatures"),Ei(e.length,"serializedMessage")]),r=new Uint8Array(2048),i=n.encode({encodedSignaturesLength:new Uint8Array(t),signatures:this.signatures,serializedMessage:e},r);return r.slice(0,i)}},{key:"sign",value:function(e){var t,n=this,r=this.message.serialize(),i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures),o=ae(e);try{var a=function(){var e=t.value,o=i.findIndex((function(t){return t.equals(e.publicKey)}));Cu(o>=0,"Cannot sign with non signer key ".concat(e.publicKey.toBase58())),n.signatures[o]=uu(r,e.secretKey)};for(o.s();!(t=o.n()).done;)a()}catch(e){o.e(e)}finally{o.f()}}},{key:"addSignature",value:function(e,t){Cu(64===t.byteLength,"Signature must be 64 bytes long");var n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((function(t){return t.equals(e)}));Cu(n>=0,"Can not add signature; `".concat(e.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=t}}],[{key:"deserialize",value:function(t){for(var n=ee(t),r=[],i=Su(n),o=0;o<i;o++)r.push(new Uint8Array(n.splice(0,Mu)));return new e(Pu.deserialize(new Uint8Array(n)),r)}}]),e}(),Yu=new mu("SysvarC1ock11111111111111111111111111111111"),Fu=new mu("SysvarEpochSchedu1e111111111111111111111111"),Vu=new mu("Sysvar1nstructions1111111111111111111111111"),Hu=new mu("SysvarRecentB1ockHashes11111111111111111111"),Gu=new mu("SysvarRent111111111111111111111111111111111"),qu=new mu("SysvarRewards111111111111111111111111111111"),Zu=new mu("SysvarS1otHashes111111111111111111111111111"),Ju=new mu("SysvarS1otHistory11111111111111111111111111"),Xu=new mu("SysvarStakeHistory1111111111111111111111111");function Ku(e,t,n,r){return $u.apply(this,arguments)}function $u(){return $u=R(z().mark((function e(t,n,r,i){var o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},e.next=3,t.sendTransaction(n,r,o);case 3:if(a=e.sent,null==n.recentBlockhash||null==n.lastValidBlockHeight){e.next=10;break}return e.next=7,t.confirmTransaction({abortSignal:null==i?void 0:i.abortSignal,signature:a,blockhash:n.recentBlockhash,lastValidBlockHeight:n.lastValidBlockHeight},i&&i.commitment);case 7:s=e.sent.value,e.next=22;break;case 10:if(null==n.minNonceContextSlot||null==n.nonceInfo){e.next=18;break}return u=n.nonceInfo.nonceInstruction,c=u.keys[0].pubkey,e.next=15,t.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=e.sent.value,e.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."),e.next=21,t.confirmTransaction(a,i&&i.commitment);case 21:s=e.sent.value;case 22:if(!s.err){e.next=24;break}throw new Error("Transaction ".concat(a," failed (").concat(JSON.stringify(s),")"));case 24:return e.abrupt("return",a);case 25:case"end":return e.stop()}}),e)}))),$u.apply(this,arguments)}function ec(e){return new Promise((function(t){return setTimeout(t,e)}))}function tc(e,t){var n=e.layout.span>=0?e.layout.span:xu(e,t),r=Ee.alloc(n),i=Object.assign({instruction:e.index},t);return e.layout.encode(i,r),r}function nc(e,t){var n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.instruction!==e.index)throw new Error("invalid instruction; instruction index mismatch ".concat(n.instruction," != ").concat(e.index));return n}var rc,ic=wi("lamportsPerSignature"),oc=Mi([vi("version"),vi("state"),Iu("authorizedPubkey"),Iu("nonce"),Mi([ic],"feeCalculator")]),ac=oc.span,sc=function(){function e(t){B(this,e),this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}return W(e,null,[{key:"fromAccountData",value:function(t){var n=oc.decode(lu(t),0);return new e({authorizedPubkey:new mu(n.authorizedPubkey),nonce:new mu(n.nonce).toString(),feeCalculator:n.feeCalculator})}}]),e}(),uc=(rc=8,function(e){var t=Ei(rc,e),n=function(e){return{decode:e.decode.bind(e),encode:e.encode.bind(e)}}(t),r=n.encode,i=n.decode,o=t;return o.decode=function(e,t){var n=i(e,t);return Ti(Ee.from(n))},o.encode=function(e,t,n){var i=Ii(e,rc);return r(i,t,n)},o}),cc=function(){function e(){B(this,e)}return W(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=vi("instruction").decode(e.data),r=0,i=Object.entries(lc);r<i.length;r++){var o=$(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a SystemInstruction");return t}},{key:"decodeCreateAccount",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(lc.Create,e.data),n=t.lamports,r=t.space,i=t.programId;return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:n,space:r,programId:new mu(i)}}},{key:"decodeTransfer",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(lc.Transfer,e.data).lamports;return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:t}}},{key:"decodeTransferWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(lc.TransferWithSeed,e.data),n=t.lamports,r=t.seed,i=t.programId;return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:n,seed:r,programId:new mu(i)}}},{key:"decodeAllocate",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=nc(lc.Allocate,e.data).space;return{accountPubkey:e.keys[0].pubkey,space:t}}},{key:"decodeAllocateWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=nc(lc.AllocateWithSeed,e.data),n=t.base,r=t.seed,i=t.space,o=t.programId;return{accountPubkey:e.keys[0].pubkey,basePubkey:new mu(n),seed:r,space:i,programId:new mu(o)}}},{key:"decodeAssign",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=nc(lc.Assign,e.data).programId;return{accountPubkey:e.keys[0].pubkey,programId:new mu(t)}}},{key:"decodeAssignWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=nc(lc.AssignWithSeed,e.data),n=t.base,r=t.seed,i=t.programId;return{accountPubkey:e.keys[0].pubkey,basePubkey:new mu(n),seed:r,programId:new mu(i)}}},{key:"decodeCreateWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(lc.CreateWithSeed,e.data),n=t.base,r=t.seed,i=t.lamports,o=t.space,a=t.programId;return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new mu(n),seed:r,lamports:i,space:o,programId:new mu(a)}}},{key:"decodeNonceInitialize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(lc.InitializeNonceAccount,e.data).authorized;return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new mu(t)}}},{key:"decodeNonceAdvance",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),nc(lc.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}},{key:"decodeNonceWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);var t=nc(lc.WithdrawNonceAccount,e.data).lamports;return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t}}},{key:"decodeNonceAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(lc.AuthorizeNonceAccount,e.data).authorized;return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new mu(t)}}},{key:"checkProgramId",value:function(e){if(!e.equals(dc.programId))throw new Error("invalid instruction; programId is not SystemProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),lc=Object.freeze({Create:{index:0,layout:Mi([vi("instruction"),bi("lamports"),bi("space"),Iu("programId")])},Assign:{index:1,layout:Mi([vi("instruction"),Iu("programId")])},Transfer:{index:2,layout:Mi([vi("instruction"),uc("lamports")])},CreateWithSeed:{index:3,layout:Mi([vi("instruction"),Iu("base"),Lu("seed"),bi("lamports"),bi("space"),Iu("programId")])},AdvanceNonceAccount:{index:4,layout:Mi([vi("instruction")])},WithdrawNonceAccount:{index:5,layout:Mi([vi("instruction"),bi("lamports")])},InitializeNonceAccount:{index:6,layout:Mi([vi("instruction"),Iu("authorized")])},AuthorizeNonceAccount:{index:7,layout:Mi([vi("instruction"),Iu("authorized")])},Allocate:{index:8,layout:Mi([vi("instruction"),bi("space")])},AllocateWithSeed:{index:9,layout:Mi([vi("instruction"),Iu("base"),Lu("seed"),bi("space"),Iu("programId")])},AssignWithSeed:{index:10,layout:Mi([vi("instruction"),Iu("base"),Lu("seed"),Iu("programId")])},TransferWithSeed:{index:11,layout:Mi([vi("instruction"),uc("lamports"),Lu("seed"),Iu("programId")])},UpgradeNonceAccount:{index:12,layout:Mi([vi("instruction")])}}),dc=function(){function e(){B(this,e)}return W(e,null,[{key:"createAccount",value:function(e){var t=tc(lc.Create,{lamports:e.lamports,space:e.space,programId:lu(e.programId.toBuffer())});return new Bu({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}},{key:"transfer",value:function(e){var t,n;"basePubkey"in e?(t=tc(lc.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:lu(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]):(t=tc(lc.Transfer,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]);return new Bu({keys:n,programId:this.programId,data:t})}},{key:"assign",value:function(e){var t,n;"basePubkey"in e?(t=tc(lc.AssignWithSeed,{base:lu(e.basePubkey.toBuffer()),seed:e.seed,programId:lu(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=tc(lc.Assign,{programId:lu(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]);return new Bu({keys:n,programId:this.programId,data:t})}},{key:"createAccountWithSeed",value:function(e){var t=tc(lc.CreateWithSeed,{base:lu(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:lu(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new Bu({keys:n,programId:this.programId,data:t})}},{key:"createNonceAccount",value:function(t){var n=new Uu;"basePubkey"in t&&"seed"in t?n.add(e.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:ac,programId:this.programId})):n.add(e.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:ac,programId:this.programId}));var r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return n.add(this.nonceInitialize(r)),n}},{key:"nonceInitialize",value:function(e){var t=tc(lc.InitializeNonceAccount,{authorized:lu(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Hu,isSigner:!1,isWritable:!1},{pubkey:Gu,isSigner:!1,isWritable:!1}],programId:this.programId,data:t};return new Bu(n)}},{key:"nonceAdvance",value:function(e){var t=tc(lc.AdvanceNonceAccount),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Hu,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t};return new Bu(n)}},{key:"nonceWithdraw",value:function(e){var t=tc(lc.WithdrawNonceAccount,{lamports:e.lamports});return new Bu({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:Hu,isSigner:!1,isWritable:!1},{pubkey:Gu,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}},{key:"nonceAuthorize",value:function(e){var t=tc(lc.AuthorizeNonceAccount,{authorized:lu(e.newAuthorizedPubkey.toBuffer())});return new Bu({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}},{key:"allocate",value:function(e){var t,n;"basePubkey"in e?(t=tc(lc.AllocateWithSeed,{base:lu(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:lu(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=tc(lc.Allocate,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]);return new Bu({keys:n,programId:this.programId,data:t})}}]),e}();dc.programId=new mu("11111111111111111111111111111111");var hc=function(){function e(){B(this,e)}var t;return W(e,null,[{key:"getMinNumSignatures",value:function(t){return 2*(Math.ceil(t/e.chunkSize)+1+1)}},{key:"load",value:(t=R(z().mark((function t(n,r,i,o,a){var s,u,c,l,d,h,p,f,y,m,g,v,w,b;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getMinimumBalanceForRentExemption(a.length);case 2:return s=t.sent,t.next=5,n.getAccountInfo(i.publicKey,"confirmed");case 5:if(u=t.sent,c=null,null===u){t.next=16;break}if(!u.executable){t.next=11;break}return console.error("Program load failed, account is already executable"),t.abrupt("return",!1);case 11:u.data.length!==a.length&&(c=c||new Uu).add(dc.allocate({accountPubkey:i.publicKey,space:a.length})),u.owner.equals(o)||(c=c||new Uu).add(dc.assign({accountPubkey:i.publicKey,programId:o})),u.lamports<s&&(c=c||new Uu).add(dc.transfer({fromPubkey:r.publicKey,toPubkey:i.publicKey,lamports:s-u.lamports})),t.next=17;break;case 16:c=(new Uu).add(dc.createAccount({fromPubkey:r.publicKey,newAccountPubkey:i.publicKey,lamports:s>0?s:1,space:a.length,programId:o}));case 17:if(null===c){t.next=20;break}return t.next=20,Ku(n,c,[r,i],{commitment:"confirmed"});case 20:l=Mi([vi("instruction"),vi("offset"),vi("bytesLength"),vi("bytesLengthPadding"),Ai(mi("byte"),yi(vi(),-8),"bytes")]),d=e.chunkSize,h=0,p=a,f=[];case 25:if(!(p.length>0)){t.next=39;break}if(y=p.slice(0,d),m=Ee.alloc(d+16),l.encode({instruction:0,offset:h,bytes:y,bytesLength:0,bytesLengthPadding:0},m),g=(new Uu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:m}),f.push(Ku(n,g,[r,i],{commitment:"confirmed"})),!n._rpcEndpoint.includes("solana.com")){t.next=35;break}return t.next=35,ec(250);case 35:h+=d,p=p.slice(d),t.next=25;break;case 39:return t.next=41,Promise.all(f);case 41:return v=Mi([vi("instruction")]),w=Ee.alloc(v.span),v.encode({instruction:1},w),b=(new Uu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:Gu,isSigner:!1,isWritable:!1}],programId:o,data:w}),t.next=47,Ku(n,b,[r,i],{commitment:"confirmed"});case 47:return t.abrupt("return",!0);case 48:case"end":return t.stop()}}),t)}))),function(e,n,r,i,o){return t.apply(this,arguments)})}]),e}();hc.chunkSize=932;var pc=new mu("BPFLoader2111111111111111111111111111111111"),fc=function(){function e(){B(this,e)}return W(e,null,[{key:"getMinNumSignatures",value:function(e){return hc.getMinNumSignatures(e)}},{key:"load",value:function(e,t,n,r,i){return hc.load(e,t,n,i,r)}}]),e}(),yc=Object.prototype.toString,mc=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function gc(e,t){var n,r,i,o,a,s,u;if(!0===e)return"true";if(!1===e)return"false";switch(_(e)){case"object":if(null===e)return null;if(e.toJSON&&"function"==typeof e.toJSON)return gc(e.toJSON(),t);if("[object Array]"===(u=yc.call(e))){for(i="[",r=e.length-1,n=0;n<r;n++)i+=gc(e[n],!0)+",";return r>-1&&(i+=gc(e[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=mc(e).sort()).length,i="",n=0;n<r;)void 0!==(s=gc(e[a=o[n]],!1))&&(i&&(i+=","),i+=JSON.stringify(a)+":"+s),n++;return"{"+i+"}"}return JSON.stringify(e);case"function":case"undefined":return t?null:void 0;case"string":return JSON.stringify(e);default:return isFinite(e)?e:null}}var vc=function(e){var t=gc(e,!1);if(void 0!==t)return""+t};function wc(e){for(var t=0;e>1;)e/=2,t++;return t}var bc=function(){function e(t,n,r,i,o){B(this,e),this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=n,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=o}return W(e,[{key:"getEpoch",value:function(e){return this.getEpochAndSlotIndex(e)[0]}},{key:"getEpochAndSlotIndex",value:function(e){if(e<this.firstNormalSlot){var t=wc(function(e){return 0===e?1:(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32))}(e+32+1))-wc(32)-1;return[t,e-(this.getSlotsInEpoch(t)-32)]}var n=e-this.firstNormalSlot,r=Math.floor(n/this.slotsPerEpoch);return[this.firstNormalEpoch+r,n%this.slotsPerEpoch]}},{key:"getFirstSlotInEpoch",value:function(e){return e<=this.firstNormalEpoch?32*(Math.pow(2,e)-1):(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}},{key:"getLastSlotInEpoch",value:function(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}},{key:"getSlotsInEpoch",value:function(e){return e<this.firstNormalEpoch?Math.pow(2,e+wc(32)):this.slotsPerEpoch}}]),e}(),Mc=function(e){Y(n,q(Error));var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,e)).logs=void 0,i.logs=r,i}return W(n)}(),Ac=function(e){Y(n,q(Error));var t=X(n);function n(e,r){var i,o=e.code,a=e.message,s=e.data;return B(this,n),(i=t.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 W(n)}(),Ec=globalThis.fetch,Nc=function(e){Y(n,Aa);var t=X(n);function n(e,r,i){var o;B(this,n);return(o=t.call(this,(function(e){var t=Na(e,O({autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3},r));return o.underlyingSocket="socket"in t?t.socket:t,t}),e,r,i)).underlyingSocket=void 0,o}return W(n,[{key:"call",value:function(){for(var e,t,r=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(t=K(F(n.prototype),"call",this)).call.apply(t,[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 e,t,r=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(t=K(F(n.prototype),"notify",this)).call.apply(t,[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 Tc=function(){function e(t){B(this,e),this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}return W(e,[{key:"isActive",value:function(){var e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}}],[{key:"deserialize",value:function(e){var t=function(e,t){var n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.typeIndex!==e.index)throw new Error("invalid account data; account type mismatch ".concat(n.typeIndex," != ").concat(e.index));return n}(Ic,e),n=e.length-56;Cu(n>=0,"lookup table is invalid"),Cu(n%32==0,"lookup table is invalid");var r=n/32,i=Mi([Ai(Iu(),r,"addresses")]).decode(e.slice(56)).addresses;return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new mu(t.authority[0]):void 0,addresses:i.map((function(e){return new mu(e)}))}}}]),e}(),Ic={index:1,layout:Mi([vi("typeIndex"),uc("deactivationSlot"),wi("lastExtendedSlot"),mi("lastExtendedStartIndex"),mi(),Ai(Iu(),yi(mi(),-1),"authority")])},kc=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;var Lc=no(Vi(mu),Xi(),(function(e){return new mu(e)})),xc=Ki([Xi(),Hi("base64")]),Sc=no(Vi(Ee),xc,(function(e){return Ee.from(e[0],"base64")}));function jc(e){var t,n;if("string"==typeof e)t=e;else if(e){t=e.commitment,n=Z(e,eu)}return{commitment:t,config:n}}function Cc(e){return eo([$i({jsonrpc:Hi("2.0"),id:Xi(),result:e}),$i({jsonrpc:Hi("2.0"),id:Xi(),error:$i({code:to(),message:Xi(),data:Zi(Qi("any",(function(){return!0})))})})])}var Dc=Cc(to());function Oc(e){return no(Cc(e),Dc,(function(t){return"error"in t?t:O(O({},t),{},{result:Bi(t.result,e)})}))}function zc(e){return Oc($i({context:$i({slot:qi()}),value:e}))}function _c(e){return $i({context:$i({slot:qi()}),value:e})}function Pc(e,t){return 0===e?new _u({header:t.header,staticAccountKeys:t.accountKeys.map((function(e){return new mu(e)})),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map((function(e){return{programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Bn.decode(e.data)}})),addressTableLookups:t.addressTableLookups}):new zu(t)}var Rc=$i({foundation:qi(),foundationTerm:qi(),initial:qi(),taper:qi(),terminal:qi()}),Bc=Oc(Yi(Gi($i({epoch:qi(),effectiveSlot:qi(),amount:qi(),postBalance:qi(),commission:Zi(Gi(qi()))})))),Uc=Yi($i({slot:qi(),prioritizationFee:qi()})),Wc=$i({total:qi(),validator:qi(),foundation:qi(),epoch:qi()}),Qc=$i({epoch:qi(),slotIndex:qi(),slotsInEpoch:qi(),absoluteSlot:qi(),blockHeight:Zi(qi()),transactionCount:Zi(qi())}),Yc=$i({slotsPerEpoch:qi(),leaderScheduleSlotOffset:qi(),warmup:Fi(),firstNormalEpoch:qi(),firstNormalSlot:qi()}),Fc=Ji(Xi(),Yi(qi())),Vc=Gi(eo([$i({}),Xi()])),Hc=$i({err:Vc}),Gc=Hi("receivedSignature"),qc=$i({"solana-core":Xi(),"feature-set":Zi(qi())}),Zc=zc($i({err:Gi(eo([$i({}),Xi()])),logs:Gi(Yi(Xi())),accounts:Zi(Gi(Yi(Gi($i({executable:Fi(),owner:Xi(),lamports:qi(),data:Yi(Xi()),rentEpoch:Zi(qi())}))))),unitsConsumed:Zi(qi()),returnData:Zi(Gi($i({programId:Xi(),data:Ki([Xi(),Hi("base64")])})))})),Jc=zc($i({byIdentity:Ji(Xi(),Yi(qi())),range:$i({firstSlot:qi(),lastSlot:qi()})}));var Xc=Oc(Rc),Kc=Oc(Wc),$c=Oc(Uc),el=Oc(Qc),tl=Oc(Yc),nl=Oc(Fc),rl=Oc(qi()),il=zc($i({total:qi(),circulating:qi(),nonCirculating:qi(),nonCirculatingAccounts:Yi(Lc)})),ol=$i({amount:Xi(),uiAmount:Gi(qi()),decimals:qi(),uiAmountString:Zi(Xi())}),al=zc(Yi($i({address:Lc,amount:Xi(),uiAmount:Gi(qi()),decimals:qi(),uiAmountString:Zi(Xi())}))),sl=zc(Yi($i({pubkey:Lc,account:$i({executable:Fi(),owner:Lc,lamports:qi(),data:Sc,rentEpoch:qi()})}))),ul=$i({program:Xi(),parsed:to(),space:qi()}),cl=zc(Yi($i({pubkey:Lc,account:$i({executable:Fi(),owner:Lc,lamports:qi(),data:ul,rentEpoch:qi()})}))),ll=zc(Yi($i({lamports:qi(),address:Lc}))),dl=$i({executable:Fi(),owner:Lc,lamports:qi(),data:Sc,rentEpoch:qi()}),hl=$i({pubkey:Lc,account:dl}),pl=no(eo([Vi(Ee),ul]),eo([xc,ul]),(function(e){return Array.isArray(e)?Bi(e,Sc):e})),fl=$i({executable:Fi(),owner:Lc,lamports:qi(),data:pl,rentEpoch:qi()}),yl=$i({pubkey:Lc,account:fl}),ml=$i({state:eo([Hi("active"),Hi("inactive"),Hi("activating"),Hi("deactivating")]),active:qi(),inactive:qi()}),gl=Oc(Yi($i({signature:Xi(),slot:qi(),err:Vc,memo:Gi(Xi()),blockTime:Zi(Gi(qi()))}))),vl=Oc(Yi($i({signature:Xi(),slot:qi(),err:Vc,memo:Gi(Xi()),blockTime:Zi(Gi(qi()))}))),wl=$i({subscription:qi(),result:_c(dl)}),bl=$i({pubkey:Lc,account:dl}),Ml=$i({subscription:qi(),result:_c(bl)}),Al=$i({parent:qi(),slot:qi(),root:qi()}),El=$i({subscription:qi(),result:Al}),Nl=eo([$i({type:eo([Hi("firstShredReceived"),Hi("completed"),Hi("optimisticConfirmation"),Hi("root")]),slot:qi(),timestamp:qi()}),$i({type:Hi("createdBank"),parent:qi(),slot:qi(),timestamp:qi()}),$i({type:Hi("frozen"),slot:qi(),timestamp:qi(),stats:$i({numTransactionEntries:qi(),numSuccessfulTransactions:qi(),numFailedTransactions:qi(),maxTransactionsPerEntry:qi()})}),$i({type:Hi("dead"),slot:qi(),timestamp:qi(),err:Xi()})]),Tl=$i({subscription:qi(),result:Nl}),Il=$i({subscription:qi(),result:_c(eo([Hc,Gc]))}),kl=$i({subscription:qi(),result:qi()}),Ll=$i({pubkey:Xi(),gossip:Gi(Xi()),tpu:Gi(Xi()),rpc:Gi(Xi()),version:Gi(Xi())}),xl=$i({votePubkey:Xi(),nodePubkey:Xi(),activatedStake:qi(),epochVoteAccount:Fi(),epochCredits:Yi(Ki([qi(),qi(),qi()])),commission:qi(),lastVote:qi(),rootSlot:Gi(qi())}),Sl=Oc($i({current:Yi(xl),delinquent:Yi(xl)})),jl=eo([Hi("processed"),Hi("confirmed"),Hi("finalized")]),Cl=$i({slot:qi(),confirmations:Gi(qi()),err:Vc,confirmationStatus:Zi(jl)}),Dl=zc(Yi(Gi(Cl))),Ol=Oc(qi()),zl=$i({accountKey:Lc,writableIndexes:Yi(qi()),readonlyIndexes:Yi(qi())}),_l=$i({signatures:Yi(Xi()),message:$i({accountKeys:Yi(Xi()),header:$i({numRequiredSignatures:qi(),numReadonlySignedAccounts:qi(),numReadonlyUnsignedAccounts:qi()}),instructions:Yi($i({accounts:Yi(qi()),data:Xi(),programIdIndex:qi()})),recentBlockhash:Xi(),addressTableLookups:Zi(Yi(zl))})}),Pl=$i({pubkey:Lc,signer:Fi(),writable:Fi(),source:Zi(eo([Hi("transaction"),Hi("lookupTable")]))}),Rl=$i({accountKeys:Yi(Pl),signatures:Yi(Xi())}),Bl=$i({parsed:to(),program:Xi(),programId:Lc}),Ul=$i({accounts:Yi(Lc),data:Xi(),programId:Lc}),Wl=no(eo([Ul,Bl]),eo([$i({parsed:to(),program:Xi(),programId:Xi()}),$i({accounts:Yi(Xi()),data:Xi(),programId:Xi()})]),(function(e){return Bi(e,"accounts"in e?Ul:Bl)})),Ql=$i({signatures:Yi(Xi()),message:$i({accountKeys:Yi(Pl),instructions:Yi(Wl),recentBlockhash:Xi(),addressTableLookups:Zi(Gi(Yi(zl)))})}),Yl=$i({accountIndex:qi(),mint:Xi(),owner:Zi(Xi()),uiTokenAmount:ol}),Fl=$i({writable:Yi(Lc),readonly:Yi(Lc)}),Vl=$i({err:Vc,fee:qi(),innerInstructions:Zi(Gi(Yi($i({index:qi(),instructions:Yi($i({accounts:Yi(qi()),data:Xi(),programIdIndex:qi()}))})))),preBalances:Yi(qi()),postBalances:Yi(qi()),logMessages:Zi(Gi(Yi(Xi()))),preTokenBalances:Zi(Gi(Yi(Yl))),postTokenBalances:Zi(Gi(Yi(Yl))),loadedAddresses:Zi(Fl),computeUnitsConsumed:Zi(qi())}),Hl=$i({err:Vc,fee:qi(),innerInstructions:Zi(Gi(Yi($i({index:qi(),instructions:Yi(Wl)})))),preBalances:Yi(qi()),postBalances:Yi(qi()),logMessages:Zi(Gi(Yi(Xi()))),preTokenBalances:Zi(Gi(Yi(Yl))),postTokenBalances:Zi(Gi(Yi(Yl))),loadedAddresses:Zi(Fl),computeUnitsConsumed:Zi(qi())}),Gl=eo([Hi(0),Hi("legacy")]),ql=$i({pubkey:Xi(),lamports:qi(),postBalance:Gi(qi()),rewardType:Gi(Xi()),commission:Zi(Gi(qi()))}),Zl=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),transactions:Yi($i({transaction:_l,meta:Gi(Vl),version:Zi(Gl)})),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),Jl=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),Xl=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),transactions:Yi($i({transaction:Rl,meta:Gi(Vl),version:Zi(Gl)})),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),Kl=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),transactions:Yi($i({transaction:Ql,meta:Gi(Hl),version:Zi(Gl)})),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),$l=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),transactions:Yi($i({transaction:Rl,meta:Gi(Hl),version:Zi(Gl)})),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),ed=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),td=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),transactions:Yi($i({transaction:_l,meta:Gi(Vl)})),rewards:Zi(Yi(ql)),blockTime:Gi(qi())}))),nd=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),signatures:Yi(Xi()),blockTime:Gi(qi())}))),rd=Oc(Gi($i({slot:qi(),meta:Vl,blockTime:Zi(Gi(qi())),transaction:_l,version:Zi(Gl)}))),id=Oc(Gi($i({slot:qi(),transaction:Ql,meta:Gi(Hl),blockTime:Zi(Gi(qi())),version:Zi(Gl)}))),od=zc($i({blockhash:Xi(),feeCalculator:$i({lamportsPerSignature:qi()})})),ad=zc($i({blockhash:Xi(),lastValidBlockHeight:qi()})),sd=Oc(Yi($i({slot:qi(),numTransactions:qi(),numSlots:qi(),samplePeriodSecs:qi()}))),ud=zc(Gi($i({feeCalculator:$i({lamportsPerSignature:qi()})}))),cd=Oc(Xi()),ld=Oc(Xi()),dd=$i({err:Vc,logs:Yi(Xi()),signature:Xi()}),hd=$i({result:_c(dd),subscription:qi()}),pd={"solana-client":"js/".concat("0.0.0-development")},fd=function(){function e(t,n){var r,i,o,a,s,u,c,l=this;B(this,e),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 e=R(z().mark((function e(t){var n,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=jc(t),o=i.commitment,a=i.config,s=l._buildArgs([],o,void 0,a),u=vc(s),r[u]=null!==(n=r[u])&&void 0!==n?n:R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,l._rpcRequest("getBlockHeight",s);case 3:if(t=e.sent,!("error"in(n=Bi(t,Oc(qi()))))){e.next=7;break}throw new Ac(n.error,"failed to get block height information");case 7:return e.abrupt("return",n.result);case 8:return e.prev=8,delete r[u],e.finish(8);case 11:case"end":return e.stop()}}),e,null,[[0,,8,11]])})))(),e.next=6,r[u];case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.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(e){if(!1===/^https?:/.test(e))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(t),this._rpcWsEndpoint=i||function(e){var t=e.match(kc);if(null==t)throw TypeError("Failed to validate endpoint URL `".concat(e,"`"));var n=$(t,4);n[0];var r=n[1],i=n[2],o=n[3],a=e.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)}(t),this._rpcClient=function(e,t,n,r,i,o){var a,s=n||Ec;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 e=R(z().mark((function e(t,n){var i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,i){try{r(t,n,(function(t,n){return e([t,n])}))}catch(e){i(e)}}));case 2:return i=e.sent,e.next=5,s.apply(void 0,ee(i));case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}());var u=new Bo(function(){var n=R(z().mark((function n(r,o){var u,c,l,d,h;return z().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"},t||{},pd)},n.prev=1,c=5,d=500;case 4:if(!a){n.next=10;break}return n.next=7,a(e,u);case 7:l=n.sent,n.next=13;break;case 10:return n.next=12,s(e,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(d,"ms delay...")),n.next=23,ec(d);case 23:d*=2;case 24:n.next=4;break;case 26:return n.next=28,l.text();case 28:h=n.sent,l.ok?o(null,h):o(new Error("".concat(l.status," ").concat(l.statusText,": ").concat(h))),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(e,t){return n.apply(this,arguments)}}(),{});return u}(t,o,a,s,u,c),this._rpcRequest=function(e){return function(t,n){return new Promise((function(r,i){e.request(t,n,(function(e,t){e?i(e):r(t)}))}))}}(this._rpcClient),this._rpcBatchRequest=function(e){return function(t){return new Promise((function(n,r){0===t.length&&n([]);var i=t.map((function(t){return e.request(t.methodName,t.args)}));e.request(i,(function(e,t){e?r(e):n(t)}))}))}}(this._rpcClient),this._rpcWebSocket=new Nc(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 t,n,r,i,o,a,s,u,c,l,d,h,p,f,y,m,g,v,w,b,M,A,E,N,T,I,k,L,x,S,j,C,D,P,U,Q,Y,F,V,H,G,q,J,X,K,te,ne,re,ie,oe,ae,se,ue,ce,le,de,he,pe,fe,ye,me,ge,ve,we,be,Me,Ae,Ne,Te,Ie,ke,Le,xe,Se,je,Ce,De,Oe,ze,_e,Pe,Re,Be,Ue,We,Qe,Ye,Fe;return W(e,[{key:"commitment",get:function(){return this._commitment}},{key:"rpcEndpoint",get:function(){return this._rpcEndpoint}},{key:"getBalanceAndContext",value:(Fe=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,void 0,o),e.next=4,this._rpcRequest("getBalance",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,zc(qi()))))){e.next=8;break}throw new Ac(u.error,"failed to get balance for ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Fe.apply(this,arguments)})},{key:"getBalance",value:(Ye=R(z().mark((function e(t,n){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getBalanceAndContext(t,n).then((function(e){return e.value})).catch((function(e){throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ye.apply(this,arguments)})},{key:"getBlockTime",value:(Qe=R(z().mark((function e(t){var n,r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getBlockTime",[t]);case 2:if(n=e.sent,!("error"in(r=Bi(n,Oc(Gi(qi())))))){e.next=6;break}throw new Ac(r.error,"failed to get block time for slot ".concat(t));case 6:return e.abrupt("return",r.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return Qe.apply(this,arguments)})},{key:"getMinimumLedgerSlot",value:(We=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("minimumLedgerSlot",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,Oc(qi()))))){e.next=6;break}throw new Ac(n.error,"failed to get minimum ledger slot");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return We.apply(this,arguments)})},{key:"getFirstAvailableBlock",value:(Ue=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getFirstAvailableBlock",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,rl)))){e.next=6;break}throw new Ac(n.error,"failed to get first available block");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return Ue.apply(this,arguments)})},{key:"getSupply",value:(Be=R(z().mark((function e(t){var n,r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={},n="string"==typeof t?{commitment:t}:t?O(O({},t),{},{commitment:t&&t.commitment||this.commitment}):{commitment:this.commitment},e.next=4,this._rpcRequest("getSupply",[n]);case 4:if(r=e.sent,!("error"in(i=Bi(r,il)))){e.next=8;break}throw new Ac(i.error,"failed to get supply");case 8:return e.abrupt("return",i.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Be.apply(this,arguments)})},{key:"getTokenSupply",value:(Re=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenSupply",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,zc(ol))))){e.next=7;break}throw new Ac(o.error,"failed to get token supply");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"getTokenAccountBalance",value:(Pe=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenAccountBalance",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,zc(ol))))){e.next=7;break}throw new Ac(o.error,"failed to get token account balance");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Pe.apply(this,arguments)})},{key:"getTokenAccountsByOwner",value:(_e=R(z().mark((function e(t,n,r){var i,o,a,s,u,c,l;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=jc(r),o=i.commitment,a=i.config,s=[t.toBase58()],"mint"in n?s.push({mint:n.mint.toBase58()}):s.push({programId:n.programId.toBase58()}),u=this._buildArgs(s,o,"base64",a),e.next=6,this._rpcRequest("getTokenAccountsByOwner",u);case 6:if(c=e.sent,!("error"in(l=Bi(c,sl)))){e.next=10;break}throw new Ac(l.error,"failed to get token accounts owned by account ".concat(t.toBase58()));case 10:return e.abrupt("return",l.result);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return _e.apply(this,arguments)})},{key:"getParsedTokenAccountsByOwner",value:(ze=R(z().mark((function e(t,n,r){var i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[t.toBase58()],"mint"in n?i.push({mint:n.mint.toBase58()}):i.push({programId:n.programId.toBase58()}),o=this._buildArgs(i,r,"jsonParsed"),e.next=5,this._rpcRequest("getTokenAccountsByOwner",o);case 5:if(a=e.sent,!("error"in(s=Bi(a,cl)))){e.next=9;break}throw new Ac(s.error,"failed to get token accounts owned by account ".concat(t.toBase58()));case 9:return e.abrupt("return",s.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ze.apply(this,arguments)})},{key:"getLargestAccounts",value:(Oe=R(z().mark((function e(t){var n,r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=O(O({},t),{},{commitment:t&&t.commitment||this.commitment}),r=n.filter||n.commitment?[n]:[],e.next=4,this._rpcRequest("getLargestAccounts",r);case 4:if(i=e.sent,!("error"in(o=Bi(i,ll)))){e.next=8;break}throw new Ac(o.error,"failed to get largest accounts");case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Oe.apply(this,arguments)})},{key:"getTokenLargestAccounts",value:(De=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenLargestAccounts",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,al)))){e.next=7;break}throw new Ac(o.error,"failed to get token largest accounts");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return De.apply(this,arguments)})},{key:"getAccountInfoAndContext",value:(Ce=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"base64",o),e.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,zc(Gi(dl)))))){e.next=8;break}throw new Ac(u.error,"failed to get info about account ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ce.apply(this,arguments)})},{key:"getParsedAccountInfo",value:(je=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"jsonParsed",o),e.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,zc(Gi(fl)))))){e.next=8;break}throw new Ac(u.error,"failed to get info about account ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return je.apply(this,arguments)})},{key:"getAccountInfo",value:(Se=R(z().mark((function e(t,n){var r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getAccountInfoAndContext(t,n);case 3:return r=e.sent,e.abrupt("return",r.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get info about account "+t.toBase58()+": "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e,t){return Se.apply(this,arguments)})},{key:"getMultipleParsedAccounts",value:(xe=R(z().mark((function e(t,n){var r,i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=t.map((function(e){return e.toBase58()})),s=this._buildArgs([a],i,"jsonParsed",o),e.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=e.sent,!("error"in(c=Bi(u,zc(Yi(Gi(fl))))))){e.next=9;break}throw new Ac(c.error,"failed to get info for accounts ".concat(a));case 9:return e.abrupt("return",c.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return xe.apply(this,arguments)})},{key:"getMultipleAccountsInfoAndContext",value:(Le=R(z().mark((function e(t,n){var r,i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=t.map((function(e){return e.toBase58()})),s=this._buildArgs([a],i,"base64",o),e.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=e.sent,!("error"in(c=Bi(u,zc(Yi(Gi(dl))))))){e.next=9;break}throw new Ac(c.error,"failed to get info for accounts ".concat(a));case 9:return e.abrupt("return",c.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return Le.apply(this,arguments)})},{key:"getMultipleAccountsInfo",value:(ke=R(z().mark((function e(t,n){var r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getMultipleAccountsInfoAndContext(t,n);case 2:return r=e.sent,e.abrupt("return",r.value);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return ke.apply(this,arguments)})},{key:"getStakeActivation",value:(Ie=R(z().mark((function e(t,n,r){var i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=jc(n),o=i.commitment,a=i.config,s=this._buildArgs([t.toBase58()],o,void 0,O(O({},a),{},{epoch:null!=r?r:null==a?void 0:a.epoch})),e.next=4,this._rpcRequest("getStakeActivation",s);case 4:if(u=e.sent,!("error"in(c=Bi(u,Oc(ml))))){e.next=8;break}throw new Ac(c.error,"failed to get Stake Activation ".concat(t.toBase58()));case 8:return e.abrupt("return",c.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Ie.apply(this,arguments)})},{key:"getProgramAccounts",value:(Te=R(z().mark((function e(t,n){var r,i,o,a,s,u,c,l,d;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,s=(a=o||{}).encoding,u=Z(a,tu),c=this._buildArgs([t.toBase58()],i,s||"base64",u),e.next=5,this._rpcRequest("getProgramAccounts",c);case 5:if(l=e.sent,!("error"in(d=Bi(l,Oc(Yi(hl)))))){e.next=9;break}throw new Ac(d.error,"failed to get accounts owned by program ".concat(t.toBase58()));case 9:return e.abrupt("return",d.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"getParsedProgramAccounts",value:(Ne=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"jsonParsed",o),e.next=4,this._rpcRequest("getProgramAccounts",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,Oc(Yi(yl)))))){e.next=8;break}throw new Ac(u.error,"failed to get accounts owned by program ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ne.apply(this,arguments)})},{key:"confirmTransaction",value:(Ae=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=4;break}r=t,e.next=8;break;case 4:if(null===(i=(o=t).abortSignal)||void 0===i||!i.aborted){e.next=7;break}return e.abrupt("return",Promise.reject(o.abortSignal.reason));case 7:r=o.signature;case 8:e.prev=8,a=Bn.decode(r),e.next=15;break;case 12:throw e.prev=12,e.t0=e.catch(8),new Error("signature must be base58 encoded: "+r);case 15:if(Cu(64===a.length,"signature has invalid length"),"string"!=typeof t){e.next=22;break}return e.next=19,this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:n||this.commitment,signature:r});case 19:return e.abrupt("return",e.sent);case 22:if(!("lastValidBlockHeight"in t)){e.next=28;break}return e.next=25,this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:n||this.commitment,strategy:t});case 25:return e.abrupt("return",e.sent);case 28:return e.next=30,this.confirmTransactionUsingDurableNonceStrategy({commitment:n||this.commitment,strategy:t});case 30:return e.abrupt("return",e.sent);case 31:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e,t){return Ae.apply(this,arguments)})},{key:"getCancellationPromise",value:function(e){return new Promise((function(t,n){null!=e&&(e.aborted?n(e.reason):e.addEventListener("abort",(function(){n(e.reason)})))}))}},{key:"getTransactionConfirmationPromise",value:function(e){var t,n,r=this,i=e.commitment,o=e.signature,a=!1;return{abortConfirmation:function(){n&&(n(),n=void 0),null!=t&&(r.removeSignatureListener(t),t=void 0)},confirmationPromise:new Promise((function(e,s){try{t=r.onSignature(o,(function(n,r){t=void 0;var i={context:r,value:n};e({__type:Du.PROCESSED,response:i})}),i);var u=new Promise((function(e){null==t?e():n=r._onSubscriptionStateChange(t,(function(t){"subscribed"===t&&e()}))}));R(z().mark((function t(){var n,c,l;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u;case 2:if(!a){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,r.getSignatureStatus(o);case 6:if(n=t.sent,!a){t.next=9;break}return t.abrupt("return");case 9:if(null!=n){t.next=11;break}return t.abrupt("return");case 11:if(c=n.context,null!=(l=n.value)){t.next=14;break}return t.abrupt("return");case 14:if(null==l||!l.err){t.next=18;break}s(l.err),t.next=29;break;case 18:t.t0=i,t.next="confirmed"===t.t0||"single"===t.t0||"singleGossip"===t.t0?21:"finalized"===t.t0||"max"===t.t0||"root"===t.t0?24:("processed"===t.t0||t.t0,27);break;case 21:if("processed"!==l.confirmationStatus){t.next=23;break}return t.abrupt("return");case 23:return t.abrupt("break",27);case 24:if("processed"!==l.confirmationStatus&&"confirmed"!==l.confirmationStatus){t.next=26;break}return t.abrupt("return");case 26:return t.abrupt("break",27);case 27:a=!0,e({__type:Du.PROCESSED,response:{context:c,value:l}});case 29:case"end":return t.stop()}}),t)})))()}catch(e){s(e)}}))}}},{key:"confirmTransactionUsingBlockHeightExceedanceStrategy",value:(Me=R(z().mark((function e(t){var n,r,i,o,a,s,u,c,l,d,h,p,f,y=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.strategy,i=r.abortSignal,o=r.lastValidBlockHeight,a=r.signature,s=!1,u=new Promise((function(e){var t=function(){var e=R(z().mark((function e(){var t;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,y.getBlockHeight(n);case 3:return t=e.sent,e.abrupt("return",t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",-1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();R(z().mark((function n(){var r;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t();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,ec(1e3);case 8:if(!s){n.next=10;break}return n.abrupt("return");case 10:return n.next=12,t();case 12:if(r=n.sent,!s){n.next=15;break}return n.abrupt("return");case 15:n.next=5;break;case 17:e({__type:Du.BLOCKHEIGHT_EXCEEDED});case 18:case"end":return n.stop()}}),n)})))()})),c=this.getTransactionConfirmationPromise({commitment:n,signature:a}),l=c.abortConfirmation,d=c.confirmationPromise,h=this.getCancellationPromise(i),e.prev=5,e.next=8,Promise.race([h,d,u]);case 8:if((f=e.sent).__type!==Du.PROCESSED){e.next=13;break}p=f.response,e.next=14;break;case 13:throw new Au(a);case 14:return e.prev=14,s=!0,l(),e.finish(14);case 18:return e.abrupt("return",p);case 19:case"end":return e.stop()}}),e,this,[[5,,14,18]])}))),function(e){return Me.apply(this,arguments)})},{key:"confirmTransactionUsingDurableNonceStrategy",value:(be=R(z().mark((function e(t){var n,r,i,o,a,s,u,c,l,d,h,p,f,y,m,g,v,w,b,M,A,E=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.strategy,i=r.abortSignal,o=r.minContextSlot,a=r.nonceAccountPubkey,s=r.nonceValue,u=r.signature,c=!1,l=new Promise((function(e){var t=s,r=null,i=function(){var e=R(z().mark((function e(){var i,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,E.getNonceAndContext(a,{commitment:n,minContextSlot:o});case 3:return i=e.sent,s=i.context,u=i.value,r=s.slot,e.abrupt("return",null==u?void 0:u.nonce);case 10:return e.prev=10,e.t0=e.catch(0),e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();R(z().mark((function n(){return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i();case 2:if(t=n.sent,!c){n.next=5;break}return n.abrupt("return");case 5:if(s===t){n.next=9;break}return e({__type:Du.NONCE_INVALID,slotInWhichNonceDidAdvance:r}),n.abrupt("return");case 9:return n.next=11,ec(2e3);case 11:if(!c){n.next=13;break}return n.abrupt("return");case 13:return n.next=15,i();case 15:if(t=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)})))()})),d=this.getTransactionConfirmationPromise({commitment:n,signature:u}),h=d.abortConfirmation,p=d.confirmationPromise,f=this.getCancellationPromise(i),e.prev=5,e.next=8,Promise.race([f,p,l]);case 8:if((m=e.sent).__type!==Du.PROCESSED){e.next=13;break}y=m.response,e.next=47;break;case 13:return e.next=16,this.getSignatureStatus(u);case 16:if(null!=(b=e.sent)){e.next=19;break}return e.abrupt("break",27);case 19:if(!(b.context.slot<(null!==(w=m.slotInWhichNonceDidAdvance)&&void 0!==w?w:o))){e.next=23;break}return e.next=22,ec(400);case 22:return e.abrupt("continue",13);case 23:return v=b,e.abrupt("break",27);case 27:if(null===(g=v)||void 0===g||!g.value){e.next=46;break}M=n||"finalized",A=v.value.confirmationStatus,e.t0=M,e.next="processed"===e.t0||"recent"===e.t0?33:"confirmed"===e.t0||"single"===e.t0||"singleGossip"===e.t0?36:"finalized"===e.t0||"max"===e.t0||"root"===e.t0?39:42;break;case 33:if("processed"===A||"confirmed"===A||"finalized"===A){e.next=35;break}throw new Nu(u);case 35:case 38:case 41:return e.abrupt("break",43);case 36:if("confirmed"===A||"finalized"===A){e.next=38;break}throw new Nu(u);case 39:if("finalized"===A){e.next=41;break}throw new Nu(u);case 42:case 43:y={context:v.context,value:{err:v.value.err}},e.next=47;break;case 46:throw new Nu(u);case 47:return e.prev=47,c=!0,h(),e.finish(47);case 51:return e.abrupt("return",y);case 52:case"end":return e.stop()}}),e,this,[[5,,47,51]])}))),function(e){return be.apply(this,arguments)})},{key:"confirmTransactionUsingLegacyTimeoutStrategy",value:(we=R(z().mark((function e(t){var n,r,i,o,a,s,u,c,l,d=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.signature,o=new Promise((function(e){var t=d._confirmTransactionInitialTimeout||6e4;switch(n){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":t=d._confirmTransactionInitialTimeout||3e4}i=setTimeout((function(){return e({__type:Du.TIMED_OUT,timeoutMs:t})}),t)})),a=this.getTransactionConfirmationPromise({commitment:n,signature:r}),s=a.abortConfirmation,u=a.confirmationPromise,e.prev=3,e.next=6,Promise.race([u,o]);case 6:if((l=e.sent).__type!==Du.PROCESSED){e.next=11;break}c=l.response,e.next=12;break;case 11:throw new Eu(r,l.timeoutMs/1e3);case 12:return e.prev=12,clearTimeout(i),s(),e.finish(12);case 16:return e.abrupt("return",c);case 17:case"end":return e.stop()}}),e,this,[[3,,12,16]])}))),function(e){return we.apply(this,arguments)})},{key:"getClusterNodes",value:(ve=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getClusterNodes",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,Oc(Yi(Ll)))))){e.next=6;break}throw new Ac(n.error,"failed to get cluster nodes");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return ve.apply(this,arguments)})},{key:"getVoteAccounts",value:(ge=R(z().mark((function e(t){var n,r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getVoteAccounts",n);case 3:if(r=e.sent,!("error"in(i=Bi(r,Sl)))){e.next=7;break}throw new Ac(i.error,"failed to get vote accounts");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return ge.apply(this,arguments)})},{key:"getSlot",value:(me=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getSlot",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,Oc(qi()))))){e.next=8;break}throw new Ac(s.error,"failed to get slot");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return me.apply(this,arguments)})},{key:"getSlotLeader",value:(ye=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getSlotLeader",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,Oc(Xi()))))){e.next=8;break}throw new Ac(s.error,"failed to get slot leader");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ye.apply(this,arguments)})},{key:"getSlotLeaders",value:(fe=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[t,n],e.next=3,this._rpcRequest("getSlotLeaders",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,Oc(Yi(Lc)))))){e.next=7;break}throw new Ac(o.error,"failed to get slot leaders");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return fe.apply(this,arguments)})},{key:"getSignatureStatus",value:(pe=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignatureStatuses([t],n);case 2:return r=e.sent,i=r.context,Cu(1===(o=r.value).length),a=o[0],e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return pe.apply(this,arguments)})},{key:"getSignatureStatuses",value:(he=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[t],n&&r.push(n),e.next=4,this._rpcRequest("getSignatureStatuses",r);case 4:if(i=e.sent,!("error"in(o=Bi(i,Dl)))){e.next=8;break}throw new Ac(o.error,"failed to get signature status");case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return he.apply(this,arguments)})},{key:"getTransactionCount",value:(de=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getTransactionCount",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,Oc(qi()))))){e.next=8;break}throw new Ac(s.error,"failed to get transaction count");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"getTotalSupply",value:(le=R(z().mark((function e(t){var n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0});case 2:return n=e.sent,e.abrupt("return",n.value.total);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"getInflationGovernor",value:(ce=R(z().mark((function e(t){var n,r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getInflationGovernor",n);case 3:if(r=e.sent,!("error"in(i=Bi(r,Xc)))){e.next=7;break}throw new Ac(i.error,"failed to get inflation");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"getInflationReward",value:(ue=R(z().mark((function e(t,n,r){var i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=jc(r),o=i.commitment,a=i.config,s=this._buildArgs([t.map((function(e){return e.toBase58()}))],o,void 0,O(O({},a),{},{epoch:null!=n?n:null==a?void 0:a.epoch})),e.next=4,this._rpcRequest("getInflationReward",s);case 4:if(u=e.sent,!("error"in(c=Bi(u,Bc)))){e.next=8;break}throw new Ac(c.error,"failed to get inflation reward");case 8:return e.abrupt("return",c.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ue.apply(this,arguments)})},{key:"getInflationRate",value:(se=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getInflationRate",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,Kc)))){e.next=6;break}throw new Ac(n.error,"failed to get inflation rate");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return se.apply(this,arguments)})},{key:"getEpochInfo",value:(ae=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getEpochInfo",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,el)))){e.next=8;break}throw new Ac(s.error,"failed to get epoch info");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ae.apply(this,arguments)})},{key:"getEpochSchedule",value:(oe=R(z().mark((function e(){var t,n,r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getEpochSchedule",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,tl)))){e.next=6;break}throw new Ac(n.error,"failed to get epoch schedule");case 6:return r=n.result,e.abrupt("return",new bc(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot));case 8:case"end":return e.stop()}}),e,this)}))),function(){return oe.apply(this,arguments)})},{key:"getLeaderSchedule",value:(ie=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getLeaderSchedule",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,nl)))){e.next=6;break}throw new Ac(n.error,"failed to get leader schedule");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return ie.apply(this,arguments)})},{key:"getMinimumBalanceForRentExemption",value:(re=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t],n),e.next=3,this._rpcRequest("getMinimumBalanceForRentExemption",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,Ol)))){e.next=8;break}return console.warn("Unable to fetch minimum balance for rent exemption"),e.abrupt("return",0);case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return re.apply(this,arguments)})},{key:"getRecentBlockhashAndContext",value:(ne=R(z().mark((function e(t){var n,r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getRecentBlockhash",n);case 3:if(r=e.sent,!("error"in(i=Bi(r,od)))){e.next=7;break}throw new Ac(i.error,"failed to get recent blockhash");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"getRecentPerformanceSamples",value:(te=R(z().mark((function e(t){var n,r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]);case 2:if(n=e.sent,!("error"in(r=Bi(n,sd)))){e.next=6;break}throw new Ac(r.error,"failed to get recent performance samples");case 6:return e.abrupt("return",r.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return te.apply(this,arguments)})},{key:"getFeeCalculatorForBlockhash",value:(K=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t],n),e.next=3,this._rpcRequest("getFeeCalculatorForBlockhash",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,ud)))){e.next=7;break}throw new Ac(o.error,"failed to get fee calculator");case 7:return a=o.result,s=a.context,u=a.value,e.abrupt("return",{context:s,value:null!==u?u.feeCalculator:null});case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return K.apply(this,arguments)})},{key:"getFeeForMessage",value:(X=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=lu(t.serialize()).toString("base64"),i=this._buildArgs([r],n),e.next=4,this._rpcRequest("getFeeForMessage",i);case 4:if(o=e.sent,!("error"in(a=Bi(o,zc(Gi(qi())))))){e.next=8;break}throw new Ac(a.error,"failed to get fee for message");case 8:if(null!==a.result){e.next=10;break}throw new Error("invalid blockhash");case 10:return e.abrupt("return",a.result);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"getRecentPrioritizationFees",value:(J=R(z().mark((function e(t){var n,r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=null==t||null===(n=t.lockedWritableAccounts)||void 0===n?void 0:n.map((function(e){return e.toBase58()})),i=this._buildArgs(null!=r&&r.length?[r]:[]),e.next=4,this._rpcRequest("getRecentPrioritizationFees",i);case 4:if(o=e.sent,!("error"in(a=Bi(o,$c)))){e.next=8;break}throw new Ac(a.error,"failed to get recent prioritization fees");case 8:return e.abrupt("return",a.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return J.apply(this,arguments)})},{key:"getRecentBlockhash",value:(q=R(z().mark((function e(t){var n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getRecentBlockhashAndContext(t);case 3:return n=e.sent,e.abrupt("return",n.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get recent blockhash: "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return q.apply(this,arguments)})},{key:"getLatestBlockhash",value:(G=R(z().mark((function e(t){var n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getLatestBlockhashAndContext(t);case 3:return n=e.sent,e.abrupt("return",n.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get recent blockhash: "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return G.apply(this,arguments)})},{key:"getLatestBlockhashAndContext",value:(H=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getLatestBlockhash",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,ad)))){e.next=8;break}throw new Ac(s.error,"failed to get latest blockhash");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"getVersion",value:(V=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getVersion",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,Oc(qc))))){e.next=6;break}throw new Ac(n.error,"failed to get version");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return V.apply(this,arguments)})},{key:"getGenesisHash",value:(F=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getGenesisHash",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,Oc(Xi()))))){e.next=6;break}throw new Ac(n.error,"failed to get genesis hash");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return F.apply(this,arguments)})},{key:"getBlock",value:(Y=R(z().mark((function e(t,n){var r,i,o,a,s,u,c,l,d;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,void 0,o),e.next=4,this._rpcRequest("getBlock",a);case 4:s=e.sent,e.prev=5,e.t0=null==o?void 0:o.transactionDetails,e.next="accounts"===e.t0?9:"none"===e.t0?13:17;break;case 9:if(!("error"in(u=Bi(s,Xl)))){e.next=12;break}throw u.error;case 12:return e.abrupt("return",u.result);case 13:if(!("error"in(c=Bi(s,Jl)))){e.next=16;break}throw c.error;case 16:return e.abrupt("return",c.result);case 17:if(!("error"in(l=Bi(s,Zl)))){e.next=20;break}throw l.error;case 20:return d=l.result,e.abrupt("return",d?O(O({},d),{},{transactions:d.transactions.map((function(e){var t=e.transaction,n=e.meta,r=e.version;return{meta:n,transaction:O(O({},t),{},{message:Pc(r,t.message)}),version:r}}))}):null);case 22:e.next=27;break;case 24:throw e.prev=24,e.t1=e.catch(5),new Ac(e.t1,"failed to get confirmed block");case 27:case"end":return e.stop()}}),e,this,[[5,24]])}))),function(e,t){return Y.apply(this,arguments)})},{key:"getParsedBlock",value:(Q=R(z().mark((function e(t,n){var r,i,o,a,s,u,c,l;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,"jsonParsed",o),e.next=4,this._rpcRequest("getBlock",a);case 4:s=e.sent,e.prev=5,e.t0=null==o?void 0:o.transactionDetails,e.next="accounts"===e.t0?9:"none"===e.t0?13:17;break;case 9:if(!("error"in(u=Bi(s,$l)))){e.next=12;break}throw u.error;case 12:return e.abrupt("return",u.result);case 13:if(!("error"in(c=Bi(s,ed)))){e.next=16;break}throw c.error;case 16:return e.abrupt("return",c.result);case 17:if(!("error"in(l=Bi(s,Kl)))){e.next=20;break}throw l.error;case 20:return e.abrupt("return",l.result);case 21:e.next=26;break;case 23:throw e.prev=23,e.t1=e.catch(5),new Ac(e.t1,"failed to get block");case 26:case"end":return e.stop()}}),e,this,[[5,23]])}))),function(e,t){return Q.apply(this,arguments)})},{key:"getBlockProduction",value:(U=R(z().mark((function e(t){var n,r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof t?r=t:t&&(i=t.commitment,o=Z(t,nu),r=i,n=o),a=this._buildArgs([],r,"base64",n),e.next=4,this._rpcRequest("getBlockProduction",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,Jc)))){e.next=8;break}throw new Ac(u.error,"failed to get block production information");case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return U.apply(this,arguments)})},{key:"getTransaction",value:(P=R(z().mark((function e(t,n){var r,i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,void 0,o),e.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,rd)))){e.next=8;break}throw new Ac(u.error,"failed to get transaction");case 8:if(c=u.result){e.next=11;break}return e.abrupt("return",c);case 11:return e.abrupt("return",O(O({},c),{},{transaction:O(O({},c.transaction),{},{message:Pc(c.version,c.transaction.message)})}));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return P.apply(this,arguments)})},{key:"getParsedTransaction",value:(D=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,"jsonParsed",o),e.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,id)))){e.next=8;break}throw new Ac(u.error,"failed to get transaction");case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return D.apply(this,arguments)})},{key:"getParsedTransactions",value:(C=R(z().mark((function e(t,n){var r,i,o,a,s,u,c=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=t.map((function(e){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([e],i,"jsonParsed",o)}})),e.next=4,this._rpcBatchRequest(a);case 4:return s=e.sent,u=s.map((function(e){var t=Bi(e,id);if("error"in t)throw new Ac(t.error,"failed to get transactions");return t.result})),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"getTransactions",value:(j=R(z().mark((function e(t,n){var r,i,o,a,s,u,c=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=t.map((function(e){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([e],i,void 0,o)}})),e.next=4,this._rpcBatchRequest(a);case 4:return s=e.sent,u=s.map((function(e){var t=Bi(e,rd);if("error"in t)throw new Ac(t.error,"failed to get transactions");var n=t.result;return n?O(O({},n),{},{transaction:O(O({},n.transaction),{},{message:Pc(n.version,n.transaction.message)})}):n})),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"getConfirmedBlock",value:(S=R(z().mark((function e(t,n){var r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n),e.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,td)))){e.next=7;break}throw new Ac(o.error,"failed to get confirmed block");case 7:if(a=o.result){e.next=10;break}throw new Error("Confirmed block "+t+" not found");case 10:return s=O(O({},a),{},{transactions:a.transactions.map((function(e){var t=e.transaction,n=e.meta,r=new zu(t.message);return{meta:n,transaction:O(O({},t),{},{message:r})}}))}),e.abrupt("return",O(O({},s),{},{transactions:s.transactions.map((function(e){var t=e.transaction;return{meta:e.meta,transaction:Uu.populate(t.message,t.signatures)}}))}));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"getBlocks",value:(x=R(z().mark((function e(t,n,r){var i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed(void 0!==n?[t,n]:[t],r),e.next=3,this._rpcRequest("getBlocks",i);case 3:if(o=e.sent,!("error"in(a=Bi(o,Oc(Yi(qi())))))){e.next=7;break}throw new Ac(a.error,"failed to get blocks");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return x.apply(this,arguments)})},{key:"getBlockSignatures",value:(L=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,void 0,{transactionDetails:"signatures",rewards:!1}),e.next=3,this._rpcRequest("getBlock",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,nd)))){e.next=7;break}throw new Ac(o.error,"failed to get block");case 7:if(a=o.result){e.next=10;break}throw new Error("Block "+t+" not found");case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return L.apply(this,arguments)})},{key:"getConfirmedBlockSignatures",value:(k=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,void 0,{transactionDetails:"signatures",rewards:!1}),e.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,nd)))){e.next=7;break}throw new Ac(o.error,"failed to get confirmed block");case 7:if(a=o.result){e.next=10;break}throw new Error("Confirmed block "+t+" not found");case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"getConfirmedTransaction",value:(I=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n),e.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,rd)))){e.next=7;break}throw new Ac(o.error,"failed to get transaction");case 7:if(a=o.result){e.next=10;break}return e.abrupt("return",a);case 10:return s=new zu(a.transaction.message),u=a.transaction.signatures,e.abrupt("return",O(O({},a),{},{transaction:Uu.populate(s,u)}));case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"getParsedConfirmedTransaction",value:(T=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed"),e.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,id)))){e.next=7;break}throw new Ac(o.error,"failed to get confirmed transaction");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"getParsedConfirmedTransactions",value:(N=R(z().mark((function e(t,n){var r,i,o,a=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.map((function(e){return{methodName:"getConfirmedTransaction",args:a._buildArgsAtLeastConfirmed([e],n,"jsonParsed")}})),e.next=3,this._rpcBatchRequest(r);case 3:return i=e.sent,o=i.map((function(e){var t=Bi(e,id);if("error"in t)throw new Ac(t.error,"failed to get confirmed transactions");return t.result})),e.abrupt("return",o);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return N.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress",value:(E=R(z().mark((function e(t,n,r){var i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={},e.next=3,this.getFirstAvailableBlock();case 3:o=e.sent;case 4:if("until"in i){e.next=24;break}if(!(--n<=0||n<o)){e.next=8;break}return e.abrupt("break",24);case 8:return e.prev=8,e.next=11,this.getConfirmedBlockSignatures(n,"finalized");case 11:(a=e.sent).signatures.length>0&&(i.until=a.signatures[a.signatures.length-1].toString()),e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(8),!(e.t0 instanceof Error&&e.t0.message.includes("skipped"))){e.next=21;break}return e.abrupt("continue",4);case 21:throw e.t0;case 22:e.next=4;break;case 24:return e.next=26,this.getSlot("finalized");case 26:s=e.sent;case 27:if("before"in i){e.next=47;break}if(!(++r>s)){e.next=31;break}return e.abrupt("break",47);case 31:return e.prev=31,e.next=34,this.getConfirmedBlockSignatures(r);case 34:(u=e.sent).signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString()),e.next=45;break;case 38:if(e.prev=38,e.t1=e.catch(31),!(e.t1 instanceof Error&&e.t1.message.includes("skipped"))){e.next=44;break}return e.abrupt("continue",27);case 44:throw e.t1;case 45:e.next=27;break;case 47:return e.next=49,this.getConfirmedSignaturesForAddress2(t,i);case 49:return c=e.sent,e.abrupt("return",c.map((function(e){return e.signature})));case 51:case"end":return e.stop()}}),e,this,[[8,15],[31,38]])}))),function(e,t,n){return E.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress2",value:(A=R(z().mark((function e(t,n,r){var i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,n),e.next=3,this._rpcRequest("getConfirmedSignaturesForAddress2",i);case 3:if(o=e.sent,!("error"in(a=Bi(o,gl)))){e.next=7;break}throw new Ac(a.error,"failed to get confirmed signatures for address");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return A.apply(this,arguments)})},{key:"getSignaturesForAddress",value:(M=R(z().mark((function e(t,n,r){var i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,n),e.next=3,this._rpcRequest("getSignaturesForAddress",i);case 3:if(o=e.sent,!("error"in(a=Bi(o,vl)))){e.next=7;break}throw new Ac(a.error,"failed to get signatures for address");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return M.apply(this,arguments)})},{key:"getAddressLookupTable",value:(b=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAccountInfoAndContext(t,n);case 2:return r=e.sent,i=r.context,o=r.value,a=null,null!==o&&(a=new Tc({key:t,state:Tc.deserialize(o.data)})),e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"getNonceAndContext",value:(w=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAccountInfoAndContext(t,n);case 2:return r=e.sent,i=r.context,o=r.value,a=null,null!==o&&(a=sc.fromAccountData(o.data)),e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"getNonce",value:(v=R(z().mark((function e(t,n){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getNonceAndContext(t,n).then((function(e){return e.value})).catch((function(e){throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"requestAirdrop",value:(g=R(z().mark((function e(t,n){var r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("requestAirdrop",[t.toBase58(),n]);case 2:if(r=e.sent,!("error"in(i=Bi(r,cd)))){e.next=6;break}throw new Ac(i.error,"airdrop to ".concat(t.toBase58()," failed"));case 6:return e.abrupt("return",i.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"_blockhashWithExpiryBlockHeight",value:(m=R(z().mark((function e(t){var n,r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=10;break}case 1:if(!this._pollingBlockhash){e.next=6;break}return e.next=4,ec(100);case 4:e.next=1;break;case 6:if(n=Date.now()-this._blockhashInfo.lastFetch,r=n>=3e4,null===this._blockhashInfo.latestBlockhash||r){e.next=10;break}return e.abrupt("return",this._blockhashInfo.latestBlockhash);case 10:return e.next=12,this._pollNewBlockhash();case 12:return e.abrupt("return",e.sent);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"_pollNewBlockhash",value:(y=R(z().mark((function e(){var t,n,r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._pollingBlockhash=!0,e.prev=1,t=Date.now(),n=this._blockhashInfo.latestBlockhash,r=n?n.blockhash:null,i=0;case 6:if(!(i<50)){e.next=18;break}return e.next=9,this.getLatestBlockhash("finalized");case 9:if(o=e.sent,r===o.blockhash){e.next=13;break}return this._blockhashInfo={latestBlockhash:o,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e.abrupt("return",o);case 13:return e.next=15,ec(200);case 15:i++,e.next=6;break;case 18:throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-t,"ms"));case 19:return e.prev=19,this._pollingBlockhash=!1,e.finish(19);case 22:case"end":return e.stop()}}),e,this,[[1,,19,22]])}))),function(){return y.apply(this,arguments)})},{key:"getStakeMinimumDelegation",value:(f=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,"base64",i),e.next=4,this._rpcRequest("getStakeMinimumDelegation",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,zc(qi()))))){e.next=8;break}throw new Ac(s.error,"failed to get stake minimum delegation");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"simulateTransaction",value:(p=R(z().mark((function e(t,n,r){var i,o,a,s,u,c,l,d,h,p,f,y,m,g,v,w,b,M,A,E,N,T,I,k,L,x;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("message"in t)){e.next=17;break}if(i=t.serialize(),o=Ee.from(i).toString("base64"),!Array.isArray(n)&&void 0===r){e.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],e.next=12,this._rpcRequest("simulateTransaction",s);case 12:if(u=e.sent,!("error"in(c=Bi(u,Zc)))){e.next=16;break}throw new Error("failed to simulate transaction: "+c.error.message);case 16:return e.abrupt("return",c.result);case 17:if(t instanceof Uu?(d=t,(l=new Uu).feePayer=d.feePayer,l.instructions=t.instructions,l.nonceInfo=d.nonceInfo,l.signatures=d.signatures):(l=Uu.populate(t))._message=l._json=void 0,void 0===n||Array.isArray(n)){e.next=20;break}throw new Error("Invalid arguments");case 20:if(h=n,!l.nonceInfo||!h){e.next=25;break}(p=l).sign.apply(p,ee(h)),e.next=45;break;case 25:f=this._disableBlockhashCaching;case 26:return e.next=28,this._blockhashWithExpiryBlockHeight(f);case 28:if(m=e.sent,l.lastValidBlockHeight=m.lastValidBlockHeight,l.recentBlockhash=m.blockhash,h){e.next=33;break}return e.abrupt("break",45);case 33:if((y=l).sign.apply(y,ee(h)),l.signature){e.next=36;break}throw new Error("!signature");case 36:if(g=l.signature.toString("base64"),this._blockhashInfo.simulatedSignatures.includes(g)||this._blockhashInfo.transactionSignatures.includes(g)){e.next=42;break}return this._blockhashInfo.simulatedSignatures.push(g),e.abrupt("break",45);case 42:f=!0;case 43:e.next=26;break;case 45:return v=l._compile(),w=v.serialize(),b=l._serialize(w),M=b.toString("base64"),A={encoding:"base64",commitment:this.commitment},r&&(E=(Array.isArray(r)?r:v.nonProgramIds()).map((function(e){return e.toBase58()})),A.accounts={encoding:"base64",addresses:E}),h&&(A.sigVerify=!0),N=[M,A],e.next=55,this._rpcRequest("simulateTransaction",N);case 55:if(T=e.sent,!("error"in(I=Bi(T,Zc)))){e.next=60;break}throw"data"in I.error&&(k=I.error.data.logs)&&Array.isArray(k)&&(x=(L="\n ")+k.join(L),console.error(I.error.message,x)),new Mc("failed to simulate transaction: "+I.error.message,k);case 60:return e.abrupt("return",I.result);case 61:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"sendTransaction",value:(h=R(z().mark((function e(t,n,r){var i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("version"in t)){e.next=7;break}if(!n||!Array.isArray(n)){e.next=3;break}throw new Error("Invalid arguments");case 3:return i=t.serialize(),e.next=6,this.sendRawTransaction(i,n);case 6:return e.abrupt("return",e.sent);case 7:if(void 0!==n&&Array.isArray(n)){e.next=9;break}throw new Error("Invalid arguments");case 9:if(o=n,!t.nonceInfo){e.next=14;break}t.sign.apply(t,ee(o)),e.next=32;break;case 14:a=this._disableBlockhashCaching;case 15:return e.next=17,this._blockhashWithExpiryBlockHeight(a);case 17:if(s=e.sent,t.lastValidBlockHeight=s.lastValidBlockHeight,t.recentBlockhash=s.blockhash,t.sign.apply(t,ee(o)),t.signature){e.next=23;break}throw new Error("!signature");case 23:if(u=t.signature.toString("base64"),this._blockhashInfo.transactionSignatures.includes(u)){e.next=29;break}return this._blockhashInfo.transactionSignatures.push(u),e.abrupt("break",32);case 29:a=!0;case 30:e.next=15;break;case 32:return c=t.serialize(),e.next=35,this.sendRawTransaction(c,r);case 35:return e.abrupt("return",e.sent);case 36:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return h.apply(this,arguments)})},{key:"sendRawTransaction",value:(d=R(z().mark((function e(t,n){var r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=lu(t).toString("base64"),e.next=3,this.sendEncodedTransaction(r,n);case 3:return i=e.sent,e.abrupt("return",i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"sendEncodedTransaction",value:(l=R(z().mark((function e(t,n){var r,i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.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=[t,r],e.next=10,this._rpcRequest("sendTransaction",a);case 10:if(s=e.sent,!("error"in(u=Bi(s,ld)))){e.next=15;break}throw"data"in u.error&&(c=u.error.data.logs),new Mc("failed to send transaction: "+u.error.message,c);case 15:return e.abrupt("return",u.result);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"_wsOnOpen",value:function(){var e=this;this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((function(){R(z().mark((function t(){return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._rpcWebSocket.notify("ping");case 3:t.next=7;break;case 5:t.prev=5,t.t0=t.catch(0);case 7:case"end":return t.stop()}}),t,null,[[0,5]])})))()}),5e3),this._updateSubscriptions()}},{key:"_wsOnError",value:function(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}},{key:"_wsOnClose",value:function(e){var t=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!==e?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((function(e){var n=$(e,2),r=n[0],i=n[1];t._setSubscription(r,O(O({},i),{},{state:"pending"}))}))):this._updateSubscriptions()}},{key:"_setSubscription",value:function(e,t){var n,r=null===(n=this._subscriptionsByHash[e])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[e]=t,r!==t.state){var i=this._subscriptionStateChangeCallbacksByHash[e];i&&i.forEach((function(e){try{e(t.state)}catch(e){}}))}}},{key:"_onSubscriptionStateChange",value:function(e,t){var n,r=this,i=this._subscriptionHashByClientSubscriptionId[e];if(null==i)return function(){};var o=(n=this._subscriptionStateChangeCallbacksByHash)[i]||(n[i]=new Set);return o.add(t),function(){o.delete(t),0===o.size&&delete r._subscriptionStateChangeCallbacksByHash[i]}}},{key:"_updateSubscriptions",value:(c=R(z().mark((function e(){var t,n,r=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==Object.keys(this._subscriptionsByHash).length){e.next=3;break}return this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((function(){r._rpcWebSocketIdleTimeout=null;try{r._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log("Error when closing socket connection: ".concat(e.message))}}),500)),e.abrupt("return");case 3:if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),this._rpcWebSocketConnected){e.next=7;break}return this._rpcWebSocket.connect(),e.abrupt("return");case 7:return t=this._rpcWebSocketGeneration,n=function(){return t===r._rpcWebSocketGeneration},e.next=11,Promise.all(Object.keys(this._subscriptionsByHash).map(function(){var e=R(z().mark((function e(t){var i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(i=r._subscriptionsByHash[t])){e.next=3;break}return e.abrupt("return");case 3:e.t0=i.state,e.next="pending"===e.t0||"unsubscribed"===e.t0?6:"subscribed"===e.t0?15:19;break;case 6:if(0!==i.callbacks.size){e.next=12;break}return delete r._subscriptionsByHash[t],"unsubscribed"===i.state&&delete r._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],e.next=11,r._updateSubscriptions();case 11:return e.abrupt("return");case 12:return e.next=14,R(z().mark((function e(){var o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i.args,a=i.method,e.prev=1,r._setSubscription(t,O(O({},i),{},{state:"subscribing"})),e.next=5,r._rpcWebSocket.call(a,o);case 5:return s=e.sent,r._setSubscription(t,O(O({},i),{},{serverSubscriptionId:s,state:"subscribed"})),r._subscriptionCallbacksByServerSubscriptionId[s]=i.callbacks,e.next=10,r._updateSubscriptions();case 10:e.next=20;break;case 12:if(e.prev=12,e.t0=e.catch(1),e.t0 instanceof Error&&console.error("".concat(a," error for argument"),o,e.t0.message),n()){e.next=17;break}return e.abrupt("return");case 17:return r._setSubscription(t,O(O({},i),{},{state:"pending"})),e.next=20,r._updateSubscriptions();case 20:case"end":return e.stop()}}),e,null,[[1,12]])})))();case 14:case 18:return e.abrupt("break",19);case 15:if(0!==i.callbacks.size){e.next=18;break}return e.next=18,R(z().mark((function e(){var o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=i.serverSubscriptionId,a=i.unsubscribeMethod,!r._subscriptionsAutoDisposedByRpc.has(o)){e.next=5;break}r._subscriptionsAutoDisposedByRpc.delete(o),e.next=21;break;case 5:return r._setSubscription(t,O(O({},i),{},{state:"unsubscribing"})),r._setSubscription(t,O(O({},i),{},{state:"unsubscribing"})),e.prev=7,e.next=10,r._rpcWebSocket.call(a,[o]);case 10:e.next=21;break;case 12:if(e.prev=12,e.t0=e.catch(7),e.t0 instanceof Error&&console.error("".concat(a," error:"),e.t0.message),n()){e.next=17;break}return e.abrupt("return");case 17:return r._setSubscription(t,O(O({},i),{},{state:"subscribed"})),e.next=20,r._updateSubscriptions();case 20:return e.abrupt("return");case 21:return r._setSubscription(t,O(O({},i),{},{state:"unsubscribed"})),e.next=24,r._updateSubscriptions();case 24:case"end":return e.stop()}}),e,null,[[7,12]])})))();case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 11:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"_handleServerNotification",value:function(e,t){var n=this._subscriptionCallbacksByServerSubscriptionId[e];void 0!==n&&n.forEach((function(e){try{e.apply(void 0,ee(t))}catch(e){console.error(e)}}))}},{key:"_wsOnAccountNotification",value:function(e){var t=Bi(e,wl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_makeSubscription",value:function(e,t){var n=this,r=this._nextClientSubscriptionId++,i=vc([e.method,t]),o=this._subscriptionsByHash[i];return void 0===o?this._subscriptionsByHash[i]=O(O({},e),{},{args:t,callbacks:new Set([e.callback]),state:"pending"}):o.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=R(z().mark((function t(){var o;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return delete n._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete n._subscriptionHashByClientSubscriptionId[r],Cu(void 0!==(o=n._subscriptionsByHash[i]),"Could not find a `Subscription` when tearing down client subscription #".concat(r)),o.callbacks.delete(e.callback),t.next=7,n._updateSubscriptions();case 7:case"end":return t.stop()}}),t)}))),this._updateSubscriptions(),r}},{key:"onAccountChange",value:function(e,t,n){var r=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}},{key:"removeAccountChangeListener",value:(u=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"account change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"_wsOnProgramAccountNotification",value:function(e){var t=Bi(e,Ml),n=t.result,r=t.subscription;this._handleServerNotification(r,[{accountId:n.value.pubkey,accountInfo:n.value.account},n.context])}},{key:"onProgramAccountChange",value:function(e,t,n,r){var i=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}},{key:"removeProgramAccountChangeListener",value:(s=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"program account change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"onLogs",value:function(e,t,n){var r=this._buildArgs(["object"===_(e)?{mentions:[e.toString()]}:e],n||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}},{key:"removeOnLogsListener",value:(a=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"logs");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"_wsOnLogsNotification",value:function(e){var t=Bi(e,hd),n=t.result,r=t.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_wsOnSlotNotification",value:function(e){var t=Bi(e,El),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotChange",value:function(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}},{key:"removeSlotChangeListener",value:(o=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"slot change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"_wsOnSlotUpdatesNotification",value:function(e){var t=Bi(e,Tl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotUpdate",value:function(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}},{key:"removeSlotUpdateListener",value:(i=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"slot update");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_unsubscribeClientSubscription",value:(r=R(z().mark((function e(t,n){var r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this._subscriptionDisposeFunctionsByClientSubscriptionId[t])){e.next=6;break}return e.next=4,r();case 4:e.next=7;break;case 6:console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(t,"` for '").concat(n,"' events ")+"could not be found.");case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_buildArgs",value:function(e,t,n,r){var i=t||this._commitment;if(i||n||r){var o={};n&&(o.encoding=n),i&&(o.commitment=i),r&&(o=Object.assign(o,r)),e.push(o)}return e}},{key:"_buildArgsAtLeastConfirmed",value:function(e,t,n,r){var i=t||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(e,t,n,r)}},{key:"_wsOnSignatureNotification",value:function(e){var t=Bi(e,Il),n=t.result,r=t.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(e,t,n){var r=this,i=this._buildArgs([e],n||this._commitment||"finalized"),o=this._makeSubscription({callback:function(e,n){if("status"===e.type){t(e.result,n);try{r.removeSignatureListener(o)}catch(e){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return o}},{key:"onSignatureWithOptions",value:function(e,t,n){var r=this,i=O(O({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),o=i.commitment,a=Z(i,ru),s=this._buildArgs([e],o,void 0,a),u=this._makeSubscription({callback:function(e,n){t(e,n);try{r.removeSignatureListener(u)}catch(e){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return u}},{key:"removeSignatureListener",value:(n=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"signature result");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_wsOnRootNotification",value:function(e){var t=Bi(e,kl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onRootChange",value:function(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}},{key:"removeRootChangeListener",value:(t=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"root change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}(),yd=function(){function e(t){B(this,e),this._keypair=void 0,this._keypair=null!=t?t:ou()}return W(e,[{key:"publicKey",get:function(){return new mu(this._keypair.publicKey)}},{key:"secretKey",get:function(){return new Uint8Array(this._keypair.secretKey)}}],[{key:"generate",value:function(){return new e(ou())}},{key:"fromSecretKey",value:function(t,n){if(64!==t.byteLength)throw new Error("bad secret key size");var r=t.slice(32,64);if(!n||!n.skipValidation)for(var i=t.slice(0,32),o=au(i),a=0;a<32;a++)if(r[a]!==o[a])throw new Error("provided secretKey is invalid");return new e({publicKey:r,secretKey:t})}},{key:"fromSeed",value:function(t){var n=au(t),r=new Uint8Array(64);return r.set(t),r.set(n,32),new e({publicKey:n,secretKey:r})}}]),e}(),md=Object.freeze({CreateLookupTable:{index:0,layout:Mi([vi("instruction"),uc("recentSlot"),mi("bumpSeed")])},FreezeLookupTable:{index:1,layout:Mi([vi("instruction")])},ExtendLookupTable:{index:2,layout:Mi([vi("instruction"),uc(),Ai(Iu(),yi(vi(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Mi([vi("instruction")])},CloseLookupTable:{index:4,layout:Mi([vi("instruction")])}}),gd=function(){function e(){B(this,e)}return W(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=vi("instruction").decode(e.data),r=0,i=Object.entries(md);r<i.length;r++){var o=$(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return t}},{key:"decodeCreateLookupTable",value:function(e){this.checkProgramId(e.programId),this.checkKeysLength(e.keys,4);var t=nc(md.CreateLookupTable,e.data).recentSlot;return{authority:e.keys[1].pubkey,payer:e.keys[2].pubkey,recentSlot:Number(t)}}},{key:"decodeExtendLookupTable",value:function(e){if(this.checkProgramId(e.programId),e.keys.length<2)throw new Error("invalid instruction; found ".concat(e.keys.length," keys, expected at least 2"));var t=nc(md.ExtendLookupTable,e.data).addresses;return{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,payer:e.keys.length>2?e.keys[2].pubkey:void 0,addresses:t.map((function(e){return new mu(e)}))}}},{key:"decodeCloseLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,3),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,recipient:e.keys[2].pubkey}}},{key:"decodeFreezeLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}},{key:"decodeDeactivateLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(vd.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}},{key:"checkKeysLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),vd=function(){function e(){B(this,e)}return W(e,null,[{key:"createLookupTable",value:function(e){var t=$(mu.findProgramAddressSync([e.authority.toBuffer(),Ii(BigInt(e.recentSlot),8)],this.programId),2),n=t[0],r=t[1],i=tc(md.CreateLookupTable,{recentSlot:BigInt(e.recentSlot),bumpSeed:r}),o=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:dc.programId,isSigner:!1,isWritable:!1}];return[new Bu({programId:this.programId,keys:o,data:i}),n]}},{key:"freezeLookupTable",value:function(e){var t=tc(md.FreezeLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new Bu({programId:this.programId,keys:n,data:t})}},{key:"extendLookupTable",value:function(e){var t=tc(md.ExtendLookupTable,{addresses:e.addresses.map((function(e){return e.toBytes()}))}),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&n.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:dc.programId,isSigner:!1,isWritable:!1}),new Bu({programId:this.programId,keys:n,data:t})}},{key:"deactivateLookupTable",value:function(e){var t=tc(md.DeactivateLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new Bu({programId:this.programId,keys:n,data:t})}},{key:"closeLookupTable",value:function(e){var t=tc(md.CloseLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new Bu({programId:this.programId,keys:n,data:t})}}]),e}();vd.programId=new mu("AddressLookupTab1e1111111111111111111111111");var wd=function(){function e(){B(this,e)}return W(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=mi("instruction").decode(e.data),r=0,i=Object.entries(bd);r<i.length;r++){var o=$(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return t}},{key:"decodeRequestUnits",value:function(e){this.checkProgramId(e.programId);var t=nc(bd.RequestUnits,e.data);return{units:t.units,additionalFee:t.additionalFee}}},{key:"decodeRequestHeapFrame",value:function(e){return this.checkProgramId(e.programId),{bytes:nc(bd.RequestHeapFrame,e.data).bytes}}},{key:"decodeSetComputeUnitLimit",value:function(e){return this.checkProgramId(e.programId),{units:nc(bd.SetComputeUnitLimit,e.data).units}}},{key:"decodeSetComputeUnitPrice",value:function(e){return this.checkProgramId(e.programId),{microLamports:nc(bd.SetComputeUnitPrice,e.data).microLamports}}},{key:"checkProgramId",value:function(e){if(!e.equals(Md.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}]),e}(),bd=Object.freeze({RequestUnits:{index:0,layout:Mi([mi("instruction"),vi("units"),vi("additionalFee")])},RequestHeapFrame:{index:1,layout:Mi([mi("instruction"),vi("bytes")])},SetComputeUnitLimit:{index:2,layout:Mi([mi("instruction"),vi("units")])},SetComputeUnitPrice:{index:3,layout:Mi([mi("instruction"),uc("microLamports")])}}),Md=function(){function e(){B(this,e)}return W(e,null,[{key:"requestUnits",value:function(e){var t=tc(bd.RequestUnits,e);return new Bu({keys:[],programId:this.programId,data:t})}},{key:"requestHeapFrame",value:function(e){var t=tc(bd.RequestHeapFrame,e);return new Bu({keys:[],programId:this.programId,data:t})}},{key:"setComputeUnitLimit",value:function(e){var t=tc(bd.SetComputeUnitLimit,e);return new Bu({keys:[],programId:this.programId,data:t})}},{key:"setComputeUnitPrice",value:function(e){var t=tc(bd.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new Bu({keys:[],programId:this.programId,data:t})}}]),e}();Md.programId=new mu("ComputeBudget111111111111111111111111111111");var Ad=Mi([mi("numSignatures"),mi("padding"),gi("signatureOffset"),gi("signatureInstructionIndex"),gi("publicKeyOffset"),gi("publicKeyInstructionIndex"),gi("messageDataOffset"),gi("messageDataSize"),gi("messageInstructionIndex")]),Ed=function(){function e(){B(this,e)}return W(e,null,[{key:"createInstructionWithPublicKey",value:function(t){var n=t.publicKey,r=t.message,i=t.signature,o=t.instructionIndex;Cu(32===n.length,"Public Key must be ".concat(32," bytes but received ").concat(n.length," bytes")),Cu(64===i.length,"Signature must be ".concat(64," bytes but received ").concat(i.length," bytes"));var a=Ad.span,s=a+n.length,u=s+i.length,c=Ee.alloc(u+r.length),l=null==o?65535:o;return Ad.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 Bu({keys:[],programId:e.programId,data:c})}},{key:"createInstructionWithPrivateKey",value:function(e){var t=e.privateKey,n=e.message,r=e.instructionIndex;Cu(64===t.length,"Private key must be ".concat(64," bytes but received ").concat(t.length," bytes"));try{var i=yd.fromSecretKey(t),o=i.publicKey.toBytes(),a=uu(n,i.secretKey);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,instructionIndex:r})}catch(e){throw new Error("Error creating instruction; ".concat(e))}}}]),e}();Ed.programId=new mu("Ed25519SigVerify111111111111111111111111111"),$s.hmacSha256Sync=function(e){for(var t=Xa.create(Hn,e),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(e){return t.update(e)})),t.digest()};$s.isValidPrivateKey;var Nd=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return vs.fromPrivateKey(e).toRawBytes(t)},Td=Mi([mi("numSignatures"),gi("signatureOffset"),mi("signatureInstructionIndex"),gi("ethAddressOffset"),mi("ethAddressInstructionIndex"),gi("messageDataOffset"),gi("messageDataSize"),mi("messageInstructionIndex"),Ei(20,"ethAddress"),Ei(64,"signature"),mi("recoveryId")]),Id=function(){function e(){B(this,e)}return W(e,null,[{key:"publicKeyToEthAddress",value:function(e){Cu(64===e.length,"Public key must be ".concat(64," bytes but received ").concat(e.length," bytes"));try{return Ee.from(qa(lu(e))).slice(-20)}catch(e){throw new Error("Error constructing Ethereum address: ".concat(e))}}},{key:"createInstructionWithPublicKey",value:function(t){var n=t.publicKey,r=t.message,i=t.signature,o=t.recoveryId,a=t.instructionIndex;return e.createInstructionWithEthAddress({ethAddress:e.publicKeyToEthAddress(n),message:r,signature:i,recoveryId:o,instructionIndex:a})}},{key:"createInstructionWithEthAddress",value:function(t){var n,r=t.ethAddress,i=t.message,o=t.signature,a=t.recoveryId,s=t.instructionIndex,u=void 0===s?0:s;Cu(20===(n="string"==typeof r?r.startsWith("0x")?Ee.from(r.substr(2),"hex"):Ee.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,d=Ee.alloc(Td.span+i.length);return Td.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:u,ethAddressOffset:12,ethAddressInstructionIndex:u,messageDataOffset:l,messageDataSize:i.length,messageInstructionIndex:u,signature:lu(o),ethAddress:lu(n),recoveryId:a},d),d.fill(lu(i),Td.span),new Bu({keys:[],programId:e.programId,data:d})}},{key:"createInstructionWithPrivateKey",value:function(e){var t=e.privateKey,n=e.message,r=e.instructionIndex;Cu(32===t.length,"Private key must be ".concat(32," bytes but received ").concat(t.length," bytes"));try{var i=lu(t),o=Nd(i,!1).slice(1),a=Ee.from(qa(lu(n))),s=$(qs(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(e){throw new Error("Error creating instruction; ".concat(e))}}}]),e}();Id.programId=new mu("KeccakSecp256k11111111111111111111111111111");var kd=new mu("StakeConfig11111111111111111111111111111111"),Ld=W((function e(t,n){B(this,e),this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=n})),xd=W((function e(t,n,r){B(this,e),this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=n,this.custodian=r}));xd.default=new xd(0,0,mu.default);var Sd=function(){function e(){B(this,e)}return W(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=vi("instruction").decode(e.data),r=0,i=Object.entries(jd);r<i.length;r++){var o=$(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a StakeInstruction");return t}},{key:"decodeInitialize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(jd.Initialize,e.data),n=t.authorized,r=t.lockup;return{stakePubkey:e.keys[0].pubkey,authorized:new Ld(new mu(n.staker),new mu(n.withdrawer)),lockup:new xd(r.unixTimestamp,r.epoch,new mu(r.custodian))}}},{key:"decodeDelegate",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),nc(jd.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}},{key:"decodeAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(jd.Authorize,e.data),n=t.newAuthorized,r=t.stakeAuthorizationType,i={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new mu(n),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(i.custodianPubkey=e.keys[3].pubkey),i}},{key:"decodeAuthorizeWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(jd.AuthorizeWithSeed,e.data),n=t.newAuthorized,r=t.stakeAuthorizationType,i=t.authoritySeed,o=t.authorityOwner,a={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:i,authorityOwner:new mu(o),newAuthorizedPubkey:new mu(n),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(a.custodianPubkey=e.keys[3].pubkey),a}},{key:"decodeSplit",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(jd.Split,e.data).lamports;return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:t}}},{key:"decodeMerge",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),nc(jd.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}},{key:"decodeWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);var t=nc(jd.Withdraw,e.data).lamports,n={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t};return e.keys.length>5&&(n.custodianPubkey=e.keys[5].pubkey),n}},{key:"decodeDeactivate",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),nc(jd.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(Dd.programId))throw new Error("invalid instruction; programId is not StakeProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),jd=Object.freeze({Initialize:{index:0,layout:Mi([vi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"authorized";return Mi([Iu("staker"),Iu("withdrawer")],e)}(),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return Mi([bi("unixTimestamp"),bi("epoch"),Iu("custodian")],e)}()])},Authorize:{index:1,layout:Mi([vi("instruction"),Iu("newAuthorized"),vi("stakeAuthorizationType")])},Delegate:{index:2,layout:Mi([vi("instruction")])},Split:{index:3,layout:Mi([vi("instruction"),bi("lamports")])},Withdraw:{index:4,layout:Mi([vi("instruction"),bi("lamports")])},Deactivate:{index:5,layout:Mi([vi("instruction")])},Merge:{index:7,layout:Mi([vi("instruction")])},AuthorizeWithSeed:{index:8,layout:Mi([vi("instruction"),Iu("newAuthorized"),vi("stakeAuthorizationType"),Lu("authoritySeed"),Iu("authorityOwner")])}}),Cd=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),Dd=function(){function e(){B(this,e)}return W(e,null,[{key:"initialize",value:function(e){var t=e.stakePubkey,n=e.authorized,r=e.lockup||xd.default,i=tc(jd.Initialize,{authorized:{staker:lu(n.staker.toBuffer()),withdrawer:lu(n.withdrawer.toBuffer())},lockup:{unixTimestamp:r.unixTimestamp,epoch:r.epoch,custodian:lu(r.custodian.toBuffer())}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Gu,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new Bu(o)}},{key:"createAccountWithSeed",value:function(e){var t=new Uu;t.add(dc.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));var n=e.stakePubkey,r=e.authorized,i=e.lockup;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"createAccount",value:function(e){var t=new Uu;t.add(dc.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));var n=e.stakePubkey,r=e.authorized,i=e.lockup;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"delegate",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.votePubkey,i=tc(jd.Delegate);return(new Uu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:Xu,isSigner:!1,isWritable:!1},{pubkey:kd,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"authorize",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.newAuthorizedPubkey,i=e.stakeAuthorizationType,o=e.custodianPubkey,a=tc(jd.Authorize,{newAuthorized:lu(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Uu).add({keys:s,programId:this.programId,data:a})}},{key:"authorizeWithSeed",value:function(e){var t=e.stakePubkey,n=e.authorityBase,r=e.authoritySeed,i=e.authorityOwner,o=e.newAuthorizedPubkey,a=e.stakeAuthorizationType,s=e.custodianPubkey,u=tc(jd.AuthorizeWithSeed,{newAuthorized:lu(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:lu(i.toBuffer())}),c=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:Yu,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new Uu).add({keys:c,programId:this.programId,data:u})}},{key:"splitInstruction",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.splitStakePubkey,i=e.lamports,o=tc(jd.Split,{lamports:i});return new Bu({keys:[{pubkey:t,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(e){var t=new Uu;return t.add(dc.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),t.add(this.splitInstruction(e))}},{key:"splitWithSeed",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.splitStakePubkey,i=e.basePubkey,o=e.seed,a=e.lamports,s=new Uu;return s.add(dc.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:t,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}},{key:"merge",value:function(e){var t=e.stakePubkey,n=e.sourceStakePubKey,r=e.authorizedPubkey,i=tc(jd.Merge);return(new Uu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:Xu,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"withdraw",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.toPubkey,i=e.lamports,o=e.custodianPubkey,a=tc(jd.Withdraw,{lamports:i}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:Xu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Uu).add({keys:s,programId:this.programId,data:a})}},{key:"deactivate",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=tc(jd.Deactivate);return(new Uu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}]),e}();Dd.programId=new mu("Stake11111111111111111111111111111111111111"),Dd.space=200;var Od=W((function e(t,n,r,i){B(this,e),this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=n,this.authorizedWithdrawer=r,this.commission=i})),zd=function(){function e(){B(this,e)}return W(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=vi("instruction").decode(e.data),r=0,i=Object.entries(_d);r<i.length;r++){var o=$(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a VoteInstruction");return t}},{key:"decodeInitializeAccount",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,4);var t=nc(_d.InitializeAccount,e.data).voteInit;return{votePubkey:e.keys[0].pubkey,nodePubkey:e.keys[3].pubkey,voteInit:new Od(new mu(t.nodePubkey),new mu(t.authorizedVoter),new mu(t.authorizedWithdrawer),t.commission)}}},{key:"decodeAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(_d.Authorize,e.data),n=t.newAuthorized,r=t.voteAuthorizationType;return{votePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new mu(n),voteAuthorizationType:{index:r}}}},{key:"decodeAuthorizeWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(_d.AuthorizeWithSeed,e.data).voteAuthorizeWithSeedArgs,n=t.currentAuthorityDerivedKeyOwnerPubkey,r=t.currentAuthorityDerivedKeySeed,i=t.newAuthorized,o=t.voteAuthorizationType;return{currentAuthorityDerivedKeyBasePubkey:e.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new mu(n),currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:new mu(i),voteAuthorizationType:{index:o},votePubkey:e.keys[0].pubkey}}},{key:"decodeWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(_d.Withdraw,e.data).lamports;return{votePubkey:e.keys[0].pubkey,authorizedWithdrawerPubkey:e.keys[2].pubkey,lamports:t,toPubkey:e.keys[1].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(Rd.programId))throw new Error("invalid instruction; programId is not VoteProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),_d=Object.freeze({InitializeAccount:{index:0,layout:Mi([vi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteInit";return Mi([Iu("nodePubkey"),Iu("authorizedVoter"),Iu("authorizedWithdrawer"),mi("commission")],e)}()])},Authorize:{index:1,layout:Mi([vi("instruction"),Iu("newAuthorized"),vi("voteAuthorizationType")])},Withdraw:{index:3,layout:Mi([vi("instruction"),bi("lamports")])},AuthorizeWithSeed:{index:10,layout:Mi([vi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return Mi([vi("voteAuthorizationType"),Iu("currentAuthorityDerivedKeyOwnerPubkey"),Lu("currentAuthorityDerivedKeySeed"),Iu("newAuthorized")],e)}()])}}),Pd=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),Rd=function(){function e(){B(this,e)}return W(e,null,[{key:"initializeAccount",value:function(e){var t=e.votePubkey,n=e.nodePubkey,r=e.voteInit,i=tc(_d.InitializeAccount,{voteInit:{nodePubkey:lu(r.nodePubkey.toBuffer()),authorizedVoter:lu(r.authorizedVoter.toBuffer()),authorizedWithdrawer:lu(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Gu,isSigner:!1,isWritable:!1},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new Bu(o)}},{key:"createAccount",value:function(e){var t=new Uu;return t.add(dc.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}},{key:"authorize",value:function(e){var t=e.votePubkey,n=e.authorizedPubkey,r=e.newAuthorizedPubkey,i=e.voteAuthorizationType,o=tc(_d.Authorize,{newAuthorized:lu(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Uu).add({keys:a,programId:this.programId,data:o})}},{key:"authorizeWithSeed",value:function(e){var t=e.currentAuthorityDerivedKeyBasePubkey,n=e.currentAuthorityDerivedKeyOwnerPubkey,r=e.currentAuthorityDerivedKeySeed,i=e.newAuthorizedPubkey,o=e.voteAuthorizationType,a=e.votePubkey,s=tc(_d.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:lu(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:lu(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return(new Uu).add({keys:u,programId:this.programId,data:s})}},{key:"withdraw",value:function(e){var t=e.votePubkey,n=e.authorizedWithdrawerPubkey,r=e.lamports,i=e.toPubkey,o=tc(_d.Withdraw,{lamports:r}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Uu).add({keys:a,programId:this.programId,data:o})}},{key:"safeWithdraw",value:function(t,n,r){if(t.lamports>n-r)throw new Error("Withdraw will leave vote account with insuffcient funds.");return e.withdraw(t)}}]),e}();Rd.programId=new mu("Vote111111111111111111111111111111111111111"),Rd.space=3731;var Bd=new mu("Va1idator1nfo111111111111111111111111111111"),Ud=$i({name:Xi(),website:Zi(Xi()),details:Zi(Xi()),keybaseUsername:Zi(Xi())}),Wd=function(){function e(t,n){B(this,e),this.key=void 0,this.info=void 0,this.key=t,this.info=n}return W(e,null,[{key:"fromConfigData",value:function(t){var n=ee(t);if(2!==Su(n))return null;for(var r=[],i=0;i<2;i++){var o=new mu(n.slice(0,fu)),a=1===(n=n.slice(fu)).slice(0,1)[0];n=n.slice(1),r.push({publicKey:o,isSigner:a})}if(r[0].publicKey.equals(Bd)&&r[1].isSigner){var s=Lu().decode(Ee.from(n)),u=JSON.parse(s);return Ri(u,Ud),new e(r[1].publicKey,u)}return null}}]),e}(),Qd=new mu("Vote111111111111111111111111111111111111111"),Yd=Mi([Iu("nodePubkey"),Iu("authorizedWithdrawer"),mi("commission"),wi(),Ai(Mi([wi("slot"),vi("confirmationCount")]),yi(vi(),-8),"votes"),mi("rootSlotValid"),wi("rootSlot"),wi(),Ai(Mi([wi("epoch"),Iu("authorizedVoter")]),yi(vi(),-8),"authorizedVoters"),Mi([Ai(Mi([Iu("authorizedPubkey"),wi("epochOfLastAuthorizedSwitch"),wi("targetEpoch")]),32,"buf"),wi("idx"),mi("isEmpty")],"priorVoters"),wi(),Ai(Mi([wi("epoch"),wi("credits"),wi("prevCredits")]),yi(vi(),-8),"epochCredits"),Mi([wi("slot"),wi("timestamp")],"lastTimestamp")]),Fd=function(){function e(t){B(this,e),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=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}return W(e,null,[{key:"fromAccountData",value:function(t){var n=Yd.decode(lu(t),4),r=n.rootSlot;return n.rootSlotValid||(r=null),new e({nodePubkey:new mu(n.nodePubkey),authorizedWithdrawer:new mu(n.authorizedWithdrawer),commission:n.commission,votes:n.votes,rootSlot:r,authorizedVoters:n.authorizedVoters.map(Vd),priorVoters:Gd(n.priorVoters),epochCredits:n.epochCredits,lastTimestamp:n.lastTimestamp})}}]),e}();function Vd(e){var t=e.authorizedVoter;return{epoch:e.epoch,authorizedVoter:new mu(t)}}function Hd(e){var t=e.authorizedPubkey,n=e.epochOfLastAuthorizedSwitch,r=e.targetEpoch;return{authorizedPubkey:new mu(t),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function Gd(e){var t=e.buf,n=e.idx;return e.isEmpty?[]:[].concat(ee(t.slice(n+1).map(Hd)),ee(t.slice(0,n).map(Hd)))}var qd={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 Zd(){return Zd=R(z().mark((function e(t,n,r,i){var o,a,s,u,c,l,d;return z().wrap((function(e){for(;;)switch(e.prev=e.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},e.next=4,t.sendRawTransaction(n,s);case 4:return u=e.sent,c=a&&a.commitment,l=o?t.confirmTransaction(o,c):t.confirmTransaction(u,c),e.next=9,l;case 9:if(!(d=e.sent.value).err){e.next=12;break}throw new Error("Raw transaction ".concat(u," failed (").concat(JSON.stringify(d),")"));case 12:return e.abrupt("return",u);case 13:case"end":return e.stop()}}),e)}))),Zd.apply(this,arguments)}var Jd=Object.freeze({__proto__:null,Account:gu,AddressLookupTableAccount:Tc,AddressLookupTableInstruction:gd,AddressLookupTableProgram:vd,Authorized:Ld,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:vu,BPF_LOADER_PROGRAM_ID:pc,BpfLoader:fc,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:bd,ComputeBudgetInstruction:wd,ComputeBudgetProgram:Md,Connection:fd,Ed25519Program:Ed,Enum:hu,EpochSchedule:bc,FeeCalculatorLayout:ic,Keypair:yd,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:md,Loader:hc,Lockup:xd,MAX_SEED_LENGTH:32,Message:zu,MessageAccountKeys:Tu,MessageV0:_u,NONCE_ACCOUNT_LENGTH:ac,NonceAccount:sc,PACKET_DATA_SIZE:wu,PUBLIC_KEY_LENGTH:fu,PublicKey:mu,SIGNATURE_LENGTH_IN_BYTES:Mu,SOLANA_SCHEMA:pu,STAKE_CONFIG_ID:kd,STAKE_INSTRUCTION_LAYOUTS:jd,SYSTEM_INSTRUCTION_LAYOUTS:lc,SYSVAR_CLOCK_PUBKEY:Yu,SYSVAR_EPOCH_SCHEDULE_PUBKEY:Fu,SYSVAR_INSTRUCTIONS_PUBKEY:Vu,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:Hu,SYSVAR_RENT_PUBKEY:Gu,SYSVAR_REWARDS_PUBKEY:qu,SYSVAR_SLOT_HASHES_PUBKEY:Zu,SYSVAR_SLOT_HISTORY_PUBKEY:Ju,SYSVAR_STAKE_HISTORY_PUBKEY:Xu,Secp256k1Program:Id,SendTransactionError:Mc,SolanaJSONRPCError:Ac,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:Cd,StakeInstruction:Sd,StakeProgram:Dd,Struct:du,SystemInstruction:cc,SystemProgram:dc,Transaction:Uu,TransactionExpiredBlockheightExceededError:Au,TransactionExpiredNonceInvalidError:Nu,TransactionExpiredTimeoutError:Eu,TransactionInstruction:Bu,TransactionMessage:Wu,get TransactionStatus(){return Du},VALIDATOR_INFO_KEY:Bd,VERSION_PREFIX_MASK:bu,VOTE_PROGRAM_ID:Qd,ValidatorInfo:Wd,VersionedMessage:Pu,VersionedTransaction:Qu,VoteAccount:Fd,VoteAuthorizationLayout:Pd,VoteInit:Od,VoteInstruction:zd,VoteProgram:Rd,clusterApiUrl:function(e,t){var n=!1===t?"http":"https";if(!e)return qd[n].devnet;var r=qd[n][e];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(e));return r},sendAndConfirmRawTransaction:function(e,t,n,r){return Zd.apply(this,arguments)},sendAndConfirmTransaction:Ku}),Xd=C(Jd),Kd={};Object.defineProperty(Kd,"__esModule",{value:!0});var $d={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"},eh=function(e){Y(n,q(Error));var t=X(n);function n(){var e;B(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(e=t.call(this,s)).code=a,e.data=u,e.name="SolanaMobileWalletAdapterError",e}return W(n)}(),th=function(e){Y(n,q(Error));var t=X(n);function n(){var e;B(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(e=t.call(this,u)).code=s,e.data=c,e.jsonRpcMessageId=a,e.name="SolanaMobileWalletAdapterProtocolError",e}return W(n)}();function nh(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function rh(e,t){return nh(this,void 0,void 0,z().mark((function n(){var r,i,o;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,crypto.subtle.exportKey("raw",e);case 2:return r=n.sent,n.next=5,crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},t,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 ih=4;function oh(e){if(e>=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");var t=new ArrayBuffer(ih);return new DataView(t).setUint32(0,e,!1),new Uint8Array(t)}function ah(){return nh(this,void 0,void 0,z().mark((function e(){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"]);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}function sh(){return nh(this,void 0,void 0,z().mark((function e(){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"]);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}var uh,ch=12;function lh(e,t){return nh(this,void 0,void 0,z().mark((function n(){var r,i,o,a,s;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=JSON.stringify(e),i=oh(e.id),o=new Uint8Array(ch),crypto.getRandomValues(o),n.next=6,crypto.subtle.encrypt(hh(i,o),t,(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 dh(e,t){return nh(this,void 0,void 0,z().mark((function n(){var r,i,o,a,s,u;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.slice(0,ih),i=e.slice(ih,ih+ch),o=e.slice(ih+ch),n.next=5,crypto.subtle.decrypt(hh(r,i),t,o);case 5:if(a=n.sent,s=ph().decode(a),u=JSON.parse(s),!Object.hasOwnProperty.call(u,"error")){n.next=10;break}throw new th(u.id,u.error.code,u.error.message);case 10:return n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))}function hh(e,t){return{additionalData:e,iv:t,name:"AES-GCM",tagLength:128}}function ph(){return void 0===uh&&(uh=new TextDecoder("utf-8")),uh}function fh(e,t,n){return nh(this,void 0,void 0,z().mark((function r(){var i,o,a,s,u,c,l;return z().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Promise.all([crypto.subtle.exportKey("raw",t),crypto.subtle.importKey("raw",e,{name:"ECDH",namedCurve:"P-256"},!1,[])]);case 2:return i=r.sent,o=$(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 yh(e){if(e<49152||e>65535)throw new eh($d.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,"Association port number must be between 49152 and 65535. ".concat(e," given."),{port:e});return e}function mh(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,i=0;i<r;i++)t+=String.fromCharCode(n[i]);return window.btoa(t)}var gh="solana-wallet";function vh(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function wh(e,t){var n=null;if(t){try{n=new URL(t)}catch(e){}if("https:"!==(null==n?void 0:n.protocol))throw new eh($d.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}n||(n=new URL("".concat(gh,":/")));var r=e.startsWith("/")?e:[].concat(ee(vh(n.pathname)),ee(vh(e))).join("/");return new URL(r,n)}function bh(e,t,n){return nh(this,void 0,void 0,z().mark((function r(){var i,o,a,s;return z().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=yh(t),r.next=3,crypto.subtle.exportKey("raw",e);case 3:return o=r.sent,a=mh(o),(s=wh("v1/associate/local",n)).searchParams.set("association",a.replace(/[/+=]/g,(function(e){return{"/":"_","+":"-","=":"."}[e]}))),s.searchParams.set("port","".concat(i)),r.abrupt("return",s);case 9:case"end":return r.stop()}}),r)})))}var Mh={Firefox:0,Other:1};var Ah=null;function Eh(e,t){return nh(this,void 0,void 0,z().mark((function n(){var r,i,o,a;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=yh(49152+Math.floor(16384*Math.random())),n.next=3,bh(e,r,t);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/")?Mh.Firefox:Mh.Other,n.t0=o,n.next=n.t0===Mh.Firefox?13:n.t0===Mh.Other?15:20;break;case 13:return s=i,null==Ah&&((Ah=document.createElement("iframe")).style.display="none",document.body.appendChild(Ah)),Ah.contentWindow.location.href=s.toString(),n.abrupt("break",21);case 15:return a=new Promise((function(e,t){function n(){clearTimeout(i),window.removeEventListener("blur",r)}function r(){n(),e()}window.addEventListener("blur",r);var i=setTimeout((function(){n(),t()}),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 eh($d.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 Nh=[150,150,200,500,500,750,750,1e3],Th=3e4;function Ih(){if("undefined"==typeof window||!0!==window.isSecureContext)throw new eh($d.ERROR_SECURE_CONTEXT_REQUIRED,"The mobile wallet adapter protocol must be used in a secure context (`https`).")}function kh(e){var t;try{t=new URL(e)}catch(e){throw new eh($d.ERROR_FORBIDDEN_WALLET_BASE_URL,"Invalid base URL supplied by wallet")}if("https:"!==t.protocol)throw new eh($d.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}Kd.SolanaMobileWalletAdapterError=eh,Kd.SolanaMobileWalletAdapterErrorCode=$d,Kd.SolanaMobileWalletAdapterProtocolError=th,Kd.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},Kd.transact=function(e,t){return nh(this,void 0,void 0,z().mark((function n(){var r,i,o,a,s,u,c,l,d=this;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return Ih(),n.next=3,ah();case 3:return r=n.sent,n.next=6,Eh(r.publicKey,null==t?void 0:t.baseUri);case 6:return i=n.sent,o="ws://localhost:".concat(i,"/solana-wallet"),s=function(){var e=ee(Nh);return function(){return e.length>1?e.shift():e[0]}}(),u=1,c=0,l={__type:"disconnected"},n.abrupt("return",new Promise((function(t,n){var h,p,f,y={},m=function e(){return nh(d,void 0,void 0,z().mark((function t(){var n,r;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("connecting"===l.__type){t.next=3;break}return console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(l.__type,"`.")),t.abrupt("return");case 3:return n=l.associationKeypair,h.removeEventListener("open",e),t.next=7,sh();case 7:return r=t.sent,t.t0=h,t.next=11,rh(r.publicKey,n.privateKey);case 11:t.t1=t.sent,t.t0.send.call(t.t0,t.t1),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};case 14:case"end":return t.stop()}}),t)})))},g=function(e){e.wasClean?l={__type:"disconnected"}:n(new eh($d.ERROR_SESSION_CLOSED,"The wallet session dropped unexpectedly (".concat(e.code,": ").concat(e.reason,")."),{closeEvent:e})),p()},v=function(e){return nh(d,void 0,void 0,z().mark((function e(){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(p(),!(Date.now()-a>=Th)){e.next=5;break}n(new eh($d.ERROR_SESSION_TIMEOUT,"Failed to connect to the wallet websocket on port ".concat(i,"."))),e.next=8;break;case 5:return e.next=7,new Promise((function(e){var t=s();f=window.setTimeout(e,t)}));case 7:b();case 8:case"end":return e.stop()}}),e)})))},w=function(r){return nh(d,void 0,void 0,z().mark((function i(){var o,a,s,d,f,m,g,v;return z().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,ih),(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,dh(o,l.sharedSecret);case 14:d=i.sent,f=y[d.id],delete y[d.id],f.resolve(d.result),i.next=29;break;case 20:if(i.prev=20,i.t1=i.catch(6),!(i.t1 instanceof th)){i.next=28;break}m=y[i.t1.jsonRpcMessageId],delete y[i.t1.jsonRpcMessageId],m.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,fh(o,l.associationPublicKey,l.ecdhPrivateKey);case 32:return g=i.sent,l={__type:"connected",sharedSecret:g},v=new Proxy({},{get:function(e,t){if(null==e[t]){var n=t.toString().replace(/[A-Z]/g,(function(e){return"_".concat(e.toLowerCase())})).toLowerCase();e[t]=function(e){return nh(this,void 0,void 0,z().mark((function r(){var i;return z().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=u++,r.t0=h,r.next=4,lh({id:i,jsonrpc:"2.0",method:n,params:null!=e?e:{}},g);case 4:return r.t1=r.sent,r.t0.send.call(r.t0,r.t1),r.abrupt("return",new Promise((function(e,n){y[i]={resolve:function(r){switch(t){case"authorize":case"reauthorize":var i=r.wallet_uri_base;if(null!=i)try{kh(i)}catch(e){return void n(e)}}e(r)},reject:n}})));case 7:case"end":return r.stop()}}),r)})))}}return e[t]},defineProperty:function(){return!1},deleteProperty:function(){return!1}}),i.prev=35,i.t2=t,i.next=39,e(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,p(),h.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(){p&&p(),l={__type:"connecting",associationKeypair:r},void 0===a&&(a=Date.now()),(h=new WebSocket(o,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",m),h.addEventListener("close",g),h.addEventListener("error",v),h.addEventListener("message",w),p=function(){window.clearTimeout(f),h.removeEventListener("open",m),h.removeEventListener("close",g),h.removeEventListener("error",v),h.removeEventListener("message",w)}};b()})));case 13:case"end":return n.stop()}}),n)})))};var Lh=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var r=0;r<e.length;r++){var i=e.charAt(r),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=r}var a=e.length,s=e.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var n=0,r=0,i=0;e[n]===s;)r++,n++;for(var o=(e.length-n)*u+1>>>0,c=new Uint8Array(o);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var d=0,h=o-1;(0!==l||d<i)&&-1!==h;h--,d++)l+=a*c[h]>>>0,c[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,n++}for(var p=o-i;p!==o&&0===c[p];)p++;for(var f=new Uint8Array(r+(o-p)),y=r;p!==o;)f[y++]=c[p++];return f}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var d=t[i],h=0,p=u-1;(0!==d||h<r)&&-1!==p;p--,h++)d+=256*l[p]>>>0,l[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=h,i++}for(var f=u-r;f!==u&&0===l[f];)f++;for(var y=s.repeat(n);f<u;++f)y+=e.charAt(l[f]);return y},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+a+" character")}}},xh=Lh("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Object.defineProperty(se,"__esModule",{value:!0});var Sh=Xd,jh=Kd;function Ch(e){return e&&"object"===_(e)&&"default"in e?e:{default:e}}var Dh=Ch(xh);function Oh(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function zh(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function _h(e){var t;return window.btoa((t=String.fromCharCode).call.apply(t,[null].concat(ee(e))))}function Ph(e){return new Uint8Array(window.atob(e).split("").map((function(e){return e.charCodeAt(0)})))}function Rh(e){return _h("version"in e?e.serialize():e.serialize({requireAllSignatures:!1,verifySignatures:!1}))}function Bh(e){var t=e[0]*Sh.SIGNATURE_LENGTH_IN_BYTES+1;return"legacy"===Sh.VersionedMessage.deserializeMessageVersion(e.slice(t,e.length))?Sh.Transaction.from(e):Sh.VersionedTransaction.deserialize(e)}se.transact=function(e,t){return zh(this,void 0,void 0,z().mark((function n(){var r;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(t){var n=new Proxy({},{get:function(e,n){if(null==e[n])switch(n){case"signAndSendTransactions":e[n]=function(e){var n=e.minContextSlot,r=e.transactions,i=Oh(e,["minContextSlot","transactions"]);return zh(this,void 0,void 0,z().mark((function e(){var o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.map(Rh),e.next=3,t.signAndSendTransactions(Object.assign(Object.assign(Object.assign({},i),null!=n?{options:{min_context_slot:n}}:null),{payloads:o}));case 3:return a=e.sent,s=a.signatures,u=s.map(Ph).map(Dh.default.encode),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})))};break;case"signMessages":e[n]=function(e){var n=e.payloads,r=Oh(e,["payloads"]);return zh(this,void 0,void 0,z().mark((function e(){var i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.map(_h),e.next=3,t.signMessages(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=e.sent,a=o.signed_payloads,s=a.map(Ph),e.abrupt("return",s);case 7:case"end":return e.stop()}}),e)})))};break;case"signTransactions":e[n]=function(e){var n=e.transactions,r=Oh(e,["transactions"]);return zh(this,void 0,void 0,z().mark((function e(){var i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.map(Rh),e.next=3,t.signTransactions(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=e.sent,a=o.signed_payloads,s=a.map(Ph),u=s.map(Bh),e.abrupt("return",u);case 8:case"end":return e.stop()}}),e)})))};break;default:e[n]=t[n]}return e[n]},defineProperty:function(){return!1},deleteProperty:function(){return!1}});return e(n)},n.next=3,jh.transact(r,t);case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n)})))};var Uh={},Wh=function(){function e(t,n){if(B(this,e),!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=n}return W(e,[{key:"makeDestinationObject",value:function(){return{}}},{key:"decode",value:function(e,t){throw new Error("Layout is abstract")}},{key:"encode",value:function(e,t,n){throw new Error("Layout is abstract")}},{key:"getSpan",value:function(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(e){var t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}},{key:"fromArray",value:function(e){}}]),e}();function Qh(e,t){return t.property?e+"["+t.property+"]":e}Uh.Layout=Wh,Uh.nameWithProperty=Qh,Uh.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(e.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Wh))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=function(){return new e},Object.defineProperty(e.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(e,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};var Yh=function(e){Y(n,Wh);var t=X(n);function n(){return B(this,n),t.apply(this,arguments)}return W(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}(),Fh=function(e){Y(n,Yh);var t=X(n);function n(e,r){var i;if(B(this,n),void 0===e&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");return(i=t.call(this,-1,r)).elementSpan=e,i}return W(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.length-t;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(e,t,n){return 0}}]),n}(),Vh=function(e){Y(n,Yh);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof Wh))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=t.call(this,e.span,i||e.property)).layout=e,o.offset=r,o}return W(n,[{key:"isCount",value:function(){return this.layout instanceof Hh||this.layout instanceof Gh}},{key:"decode",value:function(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}]),n}(),Hh=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readUIntLE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeUIntLE(e,n,this.span),this.span}}]),n}(),Gh=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readUIntBE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeUIntBE(e,n,this.span),this.span}}]),n}(),qh=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readIntLE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeIntLE(e,n,this.span),this.span}}]),n}(),Zh=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readIntBE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeIntBE(e,n,this.span),this.span}}]),n}(),Jh=Math.pow(2,32);function Xh(e){var t=Math.floor(e/Jh);return{hi32:t,lo32:e-t*Jh}}function Kh(e,t){return e*Jh+t}var $h=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.readUInt32LE(t);return Kh(e.readUInt32LE(t+4),n)}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Xh(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}}]),n}(),ep=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),Kh(e.readUInt32BE(t),e.readUInt32BE(t+4))}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Xh(e);return t.writeUInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}]),n}(),tp=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.readUInt32LE(t);return Kh(e.readInt32LE(t+4),n)}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Xh(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}}]),n}(),np=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),Kh(e.readInt32BE(t),e.readUInt32BE(t+4))}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Xh(e);return t.writeInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}]),n}(),rp=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,4,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readFloatLE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeFloatLE(e,n),4}}]),n}(),ip=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,4,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readFloatBE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeFloatBE(e,n),4}}]),n}(),op=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readDoubleLE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeDoubleLE(e,n),8}}]),n}(),ap=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readDoubleBE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeDoubleBE(e,n),8}}]),n}(),sp=function(e){Y(n,Wh);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof Wh))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof Yh&&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 Yh)&&0<e.span&&(a=r*e.span),(o=t.call(this,a,i)).elementLayout=e,o.count=r,o}return W(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0,r=this.count;if(r instanceof Yh&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else for(var i=0;i<r;)n+=this.elementLayout.getSpan(e,t+n),++i;return n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=[],r=0,i=this.count;for(i instanceof Yh&&(i=i.decode(e,t));r<i;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.elementLayout,i=e.reduce((function(e,i){return e+r.encode(i,t,n+e)}),0);return this.count instanceof Yh&&this.count.encode(e.length,t,n),i}}]),n}(),up=function(e){Y(n,Wh);var t=X(n);function n(e,r,i){var o;if(B(this,n),!Array.isArray(e)||!e.reduce((function(e,t){return e&&t instanceof Wh}),!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=ae(e);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(e){s.e(e)}finally{s.f()}var c=-1;try{c=e.reduce((function(e,t){return e+t.getSpan()}),0)}catch(e){}return(o=t.call(this,c,r)).fields=e,o.decodePrefixes=!!i,o}return W(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n,r=this.makeDestinationObject(),i=ae(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(e,t)),t+=o.getSpan(e,t),this.decodePrefixes&&e.length===t)break}}catch(e){i.e(e)}finally{i.f()}return r}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r,i=n,o=0,a=0,s=ae(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=e[u.property];void 0!==l&&(a=u.encode(l,t,n),0>c&&(c=u.getSpan(t,n)))}o=n,n+=c}}catch(e){s.e(e)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(e){var t,n=this.makeDestinationObject(),r=ae(this.fields);try{for(r.s();!(t=r.n()).done;){var i=t.value;void 0!==i.property&&0<e.length&&(n[i.property]=e.shift())}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"layoutFor",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=ae(this.fields);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.property===e)return r}}catch(e){n.e(e)}finally{n.f()}}},{key:"offsetOf",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=0,r=ae(this.fields);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(i.property===e)return n;0>i.span?n=-1:0<=n&&(n+=i.span)}}catch(e){r.e(e)}finally{r.f()}}}]),n}(),cp=function(){function e(t){B(this,e),this.property=t}return W(e,[{key:"decode",value:function(){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(){throw new Error("UnionDiscriminator is abstract")}}]),e}(),lp=function(e){Y(n,cp);var t=X(n);function n(e,r){var i;if(B(this,n),!(e instanceof Yh&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=t.call(this,r||e.property||"variant")).layout=e,i}return W(n,[{key:"decode",value:function(e,t){return this.layout.decode(e,t)}},{key:"encode",value:function(e,t,n){return this.layout.encode(e,t,n)}}]),n}(),dp=function(e){Y(n,Wh);var t=X(n);function n(e,r,i){var o;B(this,n);var a=e instanceof Hh||e instanceof Gh;if(a)e=new lp(new Vh(e));else if(e instanceof Yh&&e.isCount())e=new lp(e);else if(!(e instanceof cp))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===r&&(r=null),!(null===r||r instanceof Wh))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+=e.layout.span),(o=t.call(this,s,i)).discriminator=e,o.usesPrefixDiscriminator=a,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(J(o));return o.getSourceVariant=function(e){return u(e)},o.configGetSourceVariant=function(e){u=e.bind(this)},o}return W(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}},{key:"defaultGetSourceVariant",value:function(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;var t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(var n in this.registry){var r=this.registry[n];if(e.hasOwnProperty(r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(e,t){var n;void 0===t&&(t=0);var r=this.discriminator,i=r.decode(e,t),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(e,t+a)}else n=o.decode(e,t);return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.getSourceVariant(e);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(e[i.property],t,n),a+o.encode(e[o.property],t,n+a)}return r.encode(e,t,n)}},{key:"addVariant",value:function(e,t,n){var r=new hp(this,e,t,n);return this.registry[e]=r,r}},{key:"getVariant",value:function(e,t){var n=e;return Ee.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}]),n}(),hp=function(e){Y(n,Wh);var t=X(n);function n(e,r,i,o){var a;if(B(this,n),!(e instanceof dp))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 Wh))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=i.span&&i.span>e.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=e.span;return 0>e.span&&0<=(s=i?i.span:0)&&e.usesPrefixDiscriminator&&(s+=e.discriminator.layout.span),(a=t.call(this,s,o)).union=e,a.variant=r,a.layout=i||null,a}return W(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}},{key:"decode",value:function(e,t){var n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))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(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);var i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(e){if(this.layout)return this.layout.fromArray(e)}}]),n}();function pp(e){return 0>e&&(e+=4294967296),e}var fp=function(e){Y(n,Wh);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof Hh||e instanceof Gh))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=void 0),4<e.span)throw new RangeError("word cannot exceed 32 bits");(o=t.call(this,e.span,i)).word=e,o.msb=!!r,o.fields=[];var a=0;return o._packedSetValue=function(e){return a=pp(e),this},o._packedGetValue=function(){return a},o}return W(n,[{key:"decode",value:function(e,t){var n=this.makeDestinationObject();void 0===t&&(t=0);var r=this.word.decode(e,t);this._packedSetValue(r);var i,o=ae(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(e){o.e(e)}finally{o.f()}return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.word.decode(t,n);this._packedSetValue(r);var i,o=ae(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(void 0!==a.property){var s=e[a.property];void 0!==s&&a.encode(s)}}}catch(e){o.e(e)}finally{o.f()}return this.word.encode(this._packedGetValue(),t,n)}},{key:"addField",value:function(e,t){var n=new yp(this,e,t);return this.fields.push(n),n}},{key:"addBoolean",value:function(e){var t=new mp(this,e);return this.fields.push(t),t}},{key:"fieldFor",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=ae(this.fields);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.property===e)return r}}catch(e){n.e(e)}finally{n.f()}}}]),n}(),yp=function(){function e(t,n,r){if(B(this,e),!(t instanceof fp))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*t.span,o=t.fields.reduce((function(e,t){return e+t.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=t,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=pp(this.valueMask<<this.start),this.property=r}return W(e,[{key:"decode",value:function(){return pp(this.container._packedGetValue()&this.wordMask)>>>this.start}},{key:"encode",value:function(e){if(!Number.isInteger(e)||e!==pp(e&this.valueMask))throw new TypeError(Qh("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var t=this.container._packedGetValue(),n=pp(e<<this.start);this.container._packedSetValue(pp(t&~this.wordMask)|n)}}]),e}(),mp=function(e){Y(n,yp);var t=X(n);function n(e,r){return B(this,n),t.call(this,e,1,r)}return W(n,[{key:"decode",value:function(e,t){return!!yp.prototype.decode.call(this,e,t)}},{key:"encode",value:function(e){return"boolean"==typeof e&&(e=+e),yp.prototype.encode.call(this,e)}}]),n}(),gp=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),!(e instanceof Yh&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var o=-1;return e instanceof Yh||(o=e),(i=t.call(this,o,r)).length=e,i}return W(n,[{key:"getSpan",value:function(e,t){var n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}},{key:"encode",value:function(e,t,n){var r=this.length;if(this.length instanceof Yh&&(r=e.length),!Ee.isBuffer(e)||r!==e.length)throw new TypeError(Qh("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,r,"hex"),this.length instanceof Yh&&this.length.encode(r,t,n),r}}]),n}(),vp=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,-1,e)}return W(n,[{key:"getSpan",value:function(e,t){if(!Ee.isBuffer(e))throw new TypeError("b must be a Buffer");void 0===t&&(t=0);for(var n=t;n<e.length&&0!==e[n];)n+=1;return 1+n-t}},{key:"decode",value:function(e,t,n){void 0===t&&(t=0);var r=this.getSpan(e,t);return e.slice(t,t+r-1).toString("utf-8")}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());var r=new Ee(e,"utf8"),i=r.length;if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),t[n+i]=0,i+1}}]),n}(),wp=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),"string"==typeof e&&void 0===r&&(r=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");return(i=t.call(this,-1,r)).maxSpan=e,i}return W(n,[{key:"getSpan",value:function(e,t){if(!Ee.isBuffer(e))throw new TypeError("b must be a Buffer");return void 0===t&&(t=0),e.length-t}},{key:"decode",value:function(e,t,n){void 0===t&&(t=0);var r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return e.slice(t,t+r).toString("utf-8")}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());var r=new Ee(e,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),i}}]),n}(),bp=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,0,r)).value=e,i}return W(n,[{key:"decode",value:function(e,t,n){return this.value}},{key:"encode",value:function(e,t,n){return 0}}]),n}();Uh.ExternalLayout=Yh,Uh.GreedyCount=Fh,Uh.OffsetLayout=Vh,Uh.UInt=Hh,Uh.UIntBE=Gh,Uh.Int=qh,Uh.IntBE=Zh,Uh.Float=rp,Uh.FloatBE=ip,Uh.Double=op,Uh.DoubleBE=ap,Uh.Sequence=sp,Uh.Structure=up,Uh.UnionDiscriminator=cp,Uh.UnionLayoutDiscriminator=lp,Uh.Union=dp,Uh.VariantLayout=hp,Uh.BitStructure=fp,Uh.BitField=yp,Uh.Boolean=mp,Uh.Blob=gp,Uh.CString=vp,Uh.UTF8=wp,Uh.Constant=bp,Uh.greedy=function(e,t){return new Fh(e,t)},Uh.offset=function(e,t,n){return new Vh(e,t,n)},Uh.u8=function(e){return new Hh(1,e)},Uh.u16=function(e){return new Hh(2,e)},Uh.u24=function(e){return new Hh(3,e)},Uh.u32=function(e){return new Hh(4,e)},Uh.u40=function(e){return new Hh(5,e)},Uh.u48=function(e){return new Hh(6,e)},Uh.nu64=function(e){return new $h(e)},Uh.u16be=function(e){return new Gh(2,e)},Uh.u24be=function(e){return new Gh(3,e)},Uh.u32be=function(e){return new Gh(4,e)},Uh.u40be=function(e){return new Gh(5,e)},Uh.u48be=function(e){return new Gh(6,e)},Uh.nu64be=function(e){return new ep(e)},Uh.s8=function(e){return new qh(1,e)},Uh.s16=function(e){return new qh(2,e)},Uh.s24=function(e){return new qh(3,e)},Uh.s32=function(e){return new qh(4,e)},Uh.s40=function(e){return new qh(5,e)},Uh.s48=function(e){return new qh(6,e)},Uh.ns64=function(e){return new tp(e)},Uh.s16be=function(e){return new Zh(2,e)},Uh.s24be=function(e){return new Zh(3,e)},Uh.s32be=function(e){return new Zh(4,e)},Uh.s40be=function(e){return new Zh(5,e)},Uh.s48be=function(e){return new Zh(6,e)},Uh.ns64be=function(e){return new np(e)},Uh.f32=function(e){return new rp(e)},Uh.f32be=function(e){return new ip(e)},Uh.f64=function(e){return new op(e)},Uh.f64be=function(e){return new ap(e)},Uh.struct=function(e,t,n){return new up(e,t,n)},Uh.bits=function(e,t,n){return new fp(e,t,n)};var Mp=Uh.seq=function(e,t,n){return new sp(e,t,n)};Uh.union=function(e,t,n){return new dp(e,t,n)},Uh.unionLayoutDiscriminator=function(e,t){return new lp(e,t)},Uh.blob=function(e,t){return new gp(e,t)},Uh.cstr=function(e){return new vp(e)},Uh.utf8=function(e,t){return new wp(e,t)},Uh.const=function(e,t){return new bp(e,t)};var Ap={},Ep={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"===_(e)?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:On.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);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 "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.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(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"===_(e)&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"===_(e))return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.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=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[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<e.length;i+=3)a=e[i]|e[i+1]<<8|e[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(e,t,n){this.length=Math.ceil((e.length-t)/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=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,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(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var d=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)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(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],h=[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],p=[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 f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.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,d=67108863&u,h=Math.min(c,t.length-1),p=Math.max(0,c-e.length+1);p<=h;p++){var f=c-p|0;l+=(a=(i=0|e.words[f])*(o=0|t.words[p])+d)/67108864|0,d=67108863&a}n.words[c]=0|d,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){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?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=h[e],l=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var y=f.modrn(l).toString(e);r=(f=f.idivn(l)).isZero()?y+r:d[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=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 e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).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(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;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(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>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(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;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(e){return this.clone().isub(e)};var y=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],d=8191&l,h=l>>>13,p=0|a[1],f=8191&p,y=p>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],E=8191&A,N=A>>>13,T=0|a[5],I=8191&T,k=T>>>13,L=0|a[6],x=8191&L,S=L>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,_=O>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],W=8191&U,Q=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],de=8191&le,he=le>>>13,pe=0|s[9],fe=8191&pe,ye=pe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(d,W))|0)+((8191&(i=(i=Math.imul(d,Q))+Math.imul(h,W)|0))<<13)|0;c=((o=Math.imul(h,Q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(f,W),i=(i=Math.imul(f,Q))+Math.imul(y,W)|0,o=Math.imul(y,Q);var ge=(c+(r=r+Math.imul(d,F)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(h,F)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,W),i=(i=Math.imul(g,Q))+Math.imul(v,W)|0,o=Math.imul(v,Q),r=r+Math.imul(f,F)|0,i=(i=i+Math.imul(f,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,q)|0)+Math.imul(h,G)|0))<<13)|0;c=((o=o+Math.imul(h,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=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(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(f,G)|0,i=(i=i+Math.imul(f,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(h,J)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(E,W),i=(i=Math.imul(E,Q))+Math.imul(N,W)|0,o=Math.imul(N,Q),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(f,J)|0,i=(i=i+Math.imul(f,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(h,$)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(I,W),i=(i=Math.imul(I,Q))+Math.imul(k,W)|0,o=Math.imul(k,Q),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(f,$)|0,i=(i=i+Math.imul(f,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(h,ne)|0))<<13)|0;c=((o=o+Math.imul(h,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(x,W),i=(i=Math.imul(x,Q))+Math.imul(S,W)|0,o=Math.imul(S,Q),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|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(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(f,ne)|0,i=(i=i+Math.imul(f,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(C,W),i=(i=Math.imul(C,Q))+Math.imul(D,W)|0,o=Math.imul(D,Q),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(f,oe)|0,i=(i=i+Math.imul(f,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ee=(c+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(z,W),i=(i=Math.imul(z,Q))+Math.imul(_,W)|0,o=Math.imul(_,Q),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(f,ue)|0,i=(i=i+Math.imul(f,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(R,W),i=(i=Math.imul(R,Q))+Math.imul(B,W)|0,o=Math.imul(B,Q),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(_,F)|0,o=o+Math.imul(_,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(f,de)|0,i=(i=i+Math.imul(f,he)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,he)|0;var Te=(c+(r=r+Math.imul(d,fe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ye)|0)+Math.imul(h,fe)|0))<<13)|0;c=((o=o+Math.imul(h,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,V))+Math.imul(B,F)|0,o=Math.imul(B,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(k,ne)|0,o=o+Math.imul(k,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,de)|0,i=(i=i+Math.imul(g,he)|0)+Math.imul(v,de)|0,o=o+Math.imul(v,he)|0;var Ie=(c+(r=r+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ye)|0)+Math.imul(y,fe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(R,G),i=(i=Math.imul(R,q))+Math.imul(B,G)|0,o=Math.imul(B,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(x,ne)|0,i=(i=i+Math.imul(x,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,he)|0;var ke=(c+(r=r+Math.imul(g,fe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,fe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,X))+Math.imul(B,J)|0,o=Math.imul(B,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(k,ue)|0,o=o+Math.imul(k,ce)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,he)|0)+Math.imul(N,de)|0,o=o+Math.imul(N,he)|0;var Le=(c+(r=r+Math.imul(b,fe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,fe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,ee))+Math.imul(B,$)|0,o=Math.imul(B,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(I,de)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(k,de)|0,o=o+Math.imul(k,he)|0;var xe=(c+(r=r+Math.imul(E,fe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(N,fe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(R,ne),i=(i=Math.imul(R,re))+Math.imul(B,ne)|0,o=Math.imul(B,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,r=r+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,r=r+Math.imul(x,de)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,he)|0;var Se=(c+(r=r+Math.imul(I,fe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(k,fe)|0))<<13)|0;c=((o=o+Math.imul(k,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(R,oe),i=(i=Math.imul(R,ae))+Math.imul(B,oe)|0,o=Math.imul(B,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,he)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,he)|0;var je=(c+(r=r+Math.imul(x,fe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ye)|0)+Math.imul(S,fe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(R,ue),i=(i=Math.imul(R,ce))+Math.imul(B,ue)|0,o=Math.imul(B,ce),r=r+Math.imul(z,de)|0,i=(i=i+Math.imul(z,he)|0)+Math.imul(_,de)|0,o=o+Math.imul(_,he)|0;var Ce=(c+(r=r+Math.imul(C,fe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ye)|0)+Math.imul(D,fe)|0))<<13)|0;c=((o=o+Math.imul(D,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(R,de),i=(i=Math.imul(R,he))+Math.imul(B,de)|0,o=Math.imul(B,he);var De=(c+(r=r+Math.imul(z,fe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(_,fe)|0))<<13)|0;c=((o=o+Math.imul(_,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863;var Oe=(c+(r=Math.imul(R,fe))|0)+((8191&(i=(i=Math.imul(R,ye))+Math.imul(B,fe)|0))<<13)|0;return c=((o=Math.imul(B,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ee,u[8]=Ne,u[9]=Te,u[10]=Ie,u[11]=ke,u[12]=Le,u[13]=xe,u[14]=Se,u[15]=je,u[16]=Ce,u[17]=De,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.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,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,d=(0|e.words[l])*(0|t.words[c]),h=67108863&d;s=67108863&(h=h+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(h>>>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 g(e,t,n){return m(e,t,n)}Math.imul||(y=f),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?f(this,e,t):n<1024?m(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,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++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-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 d=0|this.words[c];this.words[c]=l<<26-o|d>>>o,l=d&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(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;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(e,t){var n=(this.length,e.length),r=this.clone(),o=e,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"!==t){(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 d=u-1;d>=0;d--){var h=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(h=Math.min(h/a|0,67108863),r._ishlnsubmul(o,h,d);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=h)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),d=t.clone();!t.isZero();){for(var h=0,p=1;0==(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var f=0,y=1;0==(r.words[0]&y)&&f<26;++f,y<<=1);if(f>0)for(r.iushrn(f);f-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,h=1;0==(r.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;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(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new N(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,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 A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){N.call(this,e),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 e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<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(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},r(b,w),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(M,w),r(A,w),r(E,w),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new M;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return v[e]=t,t},N.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},N.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},N.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},N.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},N.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},N.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},N.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},N.prototype.isqr=function(e){return this.imul(e,e.clone())},N.prototype.sqr=function(e){return this.mul(e,e)},N.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,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 d=this.pow(l,o),h=this.pow(e,o.addn(1).iushrn(1)),p=this.pow(e,o),f=a;0!==p.cmp(s);){for(var y=p,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<f);var g=this.pow(d,new i(1).iushln(f-m-1));h=h.redMul(g),d=g.redSqr(),p=p.redMul(d),f=m}return h},N.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},N.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var d=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},N.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)},r(T,N),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),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)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),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)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(Ep,S),function(e){var t=S&&S.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.map=e.array=e.rustEnum=e.str=e.vecU8=e.tagged=e.vec=e.bool=e.option=e.publicKey=e.i128=e.u128=e.i64=e.u64=e.struct=e.f64=e.f32=e.i32=e.u32=e.i16=e.u16=e.i8=e.u8=void 0;var n=Uh,r=Xd,i=t(Ep.exports),o=Uh;Object.defineProperty(e,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(e,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(e,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(e,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(e,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(e,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(e,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(e,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(e,"struct",{enumerable:!0,get:function(){return o.struct}});var a=function(e){Y(r,e);var t=X(r);function r(e,i,o){var a;return B(this,r),(a=t.call(this,e,o)).blob=n.blob(e),a.signed=i,a}return W(r,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new i.default(this.blob.decode(e,t),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(e=e.toTwos(8*this.span)),this.blob.encode(e.toArrayLike(Ee,"le",this.span),t,n)}}]),r}(n.Layout);function s(e){return new a(8,!1,e)}e.u64=s,e.i64=function(e){return new a(8,!0,e)},e.u128=function(e){return new a(16,!1,e)},e.i128=function(e){return new a(16,!0,e)};var u=function(e){Y(n,e);var t=X(n);function n(e,r,i,o){var a;return B(this,n),(a=t.call(this,e.span,o)).layout=e,a.decoder=r,a.encoder=i,a}return W(n,[{key:"decode",value:function(e,t){return this.decoder(this.layout.decode(e,t))}},{key:"encode",value:function(e,t,n){return this.layout.encode(this.encoder(e),t,n)}},{key:"getSpan",value:function(e,t){return this.layout.getSpan(e,t)}}]),n}(n.Layout);e.publicKey=function(e){return new u(n.blob(32),(function(e){return new r.PublicKey(e)}),(function(e){return e.toBuffer()}),e)};var c=function(e){Y(r,e);var t=X(r);function r(e,i){var o;return B(this,r),(o=t.call(this,-1,i)).layout=e,o.discriminator=n.u8(),o}return W(r,[{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==e?this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+1)+1)}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(e,t);if(0===n)return null;if(1===n)return this.layout.decode(e,t+1);throw new Error("Invalid option "+this.property)}},{key:"getSpan",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(e,t);if(0===n)return 1;if(1===n)return this.layout.getSpan(e,t+1)+1;throw new Error("Invalid option "+this.property)}}]),r}(n.Layout);function l(e){if(0===e)return!1;if(1===e)return!0;throw new Error("Invalid bool: "+e)}function d(e){return e?1:0}function h(e){var t=n.u32("length"),r=n.struct([t,n.blob(n.offset(t,-t.span),"data")]);return new u(r,(function(e){return e.data}),(function(e){return{data:e}}),e)}e.option=function(e,t){return new c(e,t)},e.bool=function(e){return new u(n.u8(),l,d,e)},e.vec=function(e,t){var r=n.u32("length"),i=n.struct([r,n.seq(e,n.offset(r,-r.span),"values")]);return new u(i,(function(e){return e.values}),(function(e){return{values:e}}),t)},e.tagged=function(e,t,r){var i=n.struct([s("tag"),t.replicate("data")]);return new u(i,(function(t){var n=t.tag,r=t.data;if(!n.eq(e))throw new Error("Invalid tag, expected: "+e.toString("hex")+", got: "+n.toString("hex"));return r}),(function(t){return{tag:e,data:t}}),r)},e.vecU8=h,e.str=function(e){return new u(h(),(function(e){return e.toString("utf-8")}),(function(e){return Ee.from(e,"utf-8")}),e)},e.rustEnum=function(e,t,r){var i=n.union(null!=r?r:n.u8(),t);return e.forEach((function(e,t){return i.addVariant(t,e,e.property)})),i},e.array=function(e,t,r){var i=n.struct([n.seq(e,t,"values")]);return new u(i,(function(e){return e.values}),(function(e){return{values:e}}),r)};var p=function(e){Y(n,e);var t=X(n);function n(e,r,i){var o;return B(this,n),(o=t.call(this,e.span+r.span,i)).keyLayout=e,o.valueLayout=r,o}return W(n,[{key:"decode",value:function(e,t){return t=t||0,[this.keyLayout.decode(e,t),this.valueLayout.decode(e,t+this.keyLayout.getSpan(e,t))]}},{key:"encode",value:function(e,t,n){n=n||0;var r=this.keyLayout.encode(e[0],t,n);return r+this.valueLayout.encode(e[1],t,n+r)}},{key:"getSpan",value:function(e,t){return this.keyLayout.getSpan(e,t)+this.valueLayout.getSpan(e,t)}}]),n}(n.Layout);e.map=function(e,t,r){var i=n.u32("length"),o=n.struct([i,n.seq(new p(e,t),n.offset(i,-i.span),"values")]);return new u(o,(function(e){var t=e.values;return new Map(t)}),(function(e){return{values:Array.from(e.entries())}}),r)}}(Ap),se.Web3MobileWallet;var Np=se.transact,Tp=On.Buffer,Ip=Dn.exports,kp=Ap.struct([Ap.publicKey("mint"),Ap.publicKey("owner"),Ap.u64("amount"),Ap.u32("delegateOption"),Ap.publicKey("delegate"),Ap.u8("state"),Ap.u32("isNativeOption"),Ap.u64("isNative"),Ap.u64("delegatedAmount"),Ap.u32("closeAuthorityOption"),Ap.publicKey("closeAuthority")]);Ap.array;var Lp=Ap.bool,xp=Ap.i128;Ap.i16;var Sp=Ap.i32,jp=Ap.i64;Ap.i8,Ap.map;var Cp=Ap.option,Dp=Ap.publicKey,Op=Ap.rustEnum,zp=Ap.str,_p=Ap.struct;Ap.tagged;var Pp=Ap.u128,Rp=Ap.u16,Bp=Ap.u32,Up=Ap.u64,Wp=Ap.u8,Qp=Ap.vec;Ap.vecU8;const Yp="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yOTkuMyAyMzcuNSA1MDAgMTIybDIwMC43IDExNS41LTczLjUgNDIuNkw1MDAgMjA4LjJsLTEyNy4xIDcxLjktNzMuNi00Mi42em00MDEuNCAxNDYtNzMuNS00Mi42LTEyNy4xIDczTDM3MyAzNDAuNGwtNzMuNSA0My4xdjg1LjdsMTI3LjEgNzN2MTQ1LjRsNzMuNSA0My4xIDczLjUtNDMuMVY1NDIuMWwxMjcuMS03M3YtODUuNnptMCAyMzIuMXYtODUuN2wtNzMuNSA0Mi42djg1LjdjLS4xLS42IDczLjUtNDIuNiA3My41LTQyLjZ6bTUxLjkgMjkuMy0xMjcuMSA3M3Y4NS43TDgyNi4xIDY4OFY0NTYuNGwtNzMuNSA0My4xdjE0NS40em0tNzMuNS0zMzQuNCA3My41IDQzLjF2ODUuN2w3My41LTQzLjF2LTg1LjdsLTczLjUtNDMuMS03My41IDQzLjF6TTQyNi41IDc0OS40djg1LjdsNzMuNSA0My4xIDczLjUtNDMuMXYtODUuN2wtNzMuNSA0Mi03My41LTQyek0yOTkuMyA2MTUuNmw3My41IDQzLjF2LTg2LjJMMjk5LjMgNTMwdjg1LjZ6bTEyNy4yLTMwNS4xIDczLjUgNDMuMSA3My41LTQzLjEtNzMuNS00Mi42YzAtLjUtNzMuNSA0Mi42LTczLjUgNDIuNnptLTE3OS4xIDQzLjEgNzMuNS00My4xLTczLjUtNDMuMS03My41IDQzLjF2ODUuN2w3My41IDQzLjF2LTg1Ljd6bTAgMTQ1LjQtNzMuNS00Mi42VjY4OGwyMDAuNyAxMTUuNXYtODUuN2wtMTI3LjEtNzNjLS4xLjEtLjEtMTQ1LjgtLjEtMTQ1Ljh6IiBmaWxsPSIjZjBiOTBiIi8+PC9zdmc+",Fp="https://app.uniswap.org/static/media/bnb-logo.797868eb94521320b78e3967134febbe.svg";var Vp={name:"bsc",id:"0x38",networkId:"56",namespace:"eip155",platform:"evm",label:"BNB Smart Chain",fullName:"BNB Smart Chain Mainnet",logo:Yp,logoBackgroundColor:"#000000",logoWhiteBackground:Yp,currency:{name:"BNB",symbol:"BNB",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Fp},wrapped:{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png"},stables:{usd:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955"]},explorer:"https://bscscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://bscscan.com/tx/${e.id||e}`:t?`https://bscscan.com/token/${t}`: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:Fp,type:"NATIVE"},{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",symbol:"WBNB",name:"Wrapped BNB",decimals:18,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/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://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Hp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAADxdJREFUeJztXVtzFMcVplwuP8VVeYmf7HJ+RKqSl/AQP6X8H+yqXUEIjhMnQY5jO9oVCIzA5mowdzAYG4xAGAyWLC5G3IyDL8gOASUYKrarYGZWC7qi23b6692VV6uZ7e6ZnT3di07VV6JUaLfnnG+6z+lz+vScOXUoL6SzP52/2PtlQ9p7piHlLU2k3P2JJqcjkXLO8589/OdN/tPjvx8VEP8Wv+sp/J8O/A3+Fp+Bz8JnUj/XrPjIwjT7ybxm57fJlLsy2eR2cwPe4QZksYB/Nr4D34XvxHdTP/8DJ+k0e4S/lb9Jpr2WZJNzgRtjPDaDS4DvFmPgY8GYMDZq/dStNKQzv0qmnA1c6RkqgysQIoMxYqzU+qoLWZDO/jyZdl7lir1ObdwQZLiOseMZqPVonSTS7i+4AtsTTW6O2pDR4ebEs/Bnotar8dKw2Pk1n0I76Y0W16zgdOIZqfVsnCSbvaeEB2+AkWpCBEQS/Jmp9U4u3Fl6nIdWB6gNQgb+7NABtR1qLjxcejiZdhfxKXGA3AjUswHXAXQBnVDbpSbCPeO5fAr8hlrxpgE6gW6o7ROb5N96Z3l9ePZxgUcMXEd1NxssbMk8kWxyztEr2A5AV3XjGySb3acTSLYYoFjL4EF31PYLLXwaeyiZcltnp/woEJtIrdAltT21BEkR7tnuo1dgfQC6tCbRlGh1H02k3C5qpalg/bt3WdOGDPk4lACdct1S27eiLEgPPMbDmcvkylLAgiUOc/sm2LHuITavmX48KoBun1828DNqO/tKsiX7JF+zeqmVpIqPzg2xyckc++Sfw2ImoB6POtxe6Jra3tMEb75Nxv/Hmxk2MZGbIsCpz4bZn1d45OPSIQF0Tm13IViXbJn2i+i9NcYgRQIA+zsGyMelA6Fzap8AnqktDl8RO9r7WVFKCQAs3dJHPj4tcN2TRQcizrcs1Hv+NZf1D04GEqDj/JBwDqnHqYNCiFj7fYL8Jg+9AnTQfXmYlUo5AYAtbffIx6lNAm6L2hpfbO/atcO3dGsfy+VyUgIAL66yySEE3FzNto2R2ElYtrffkHbYd7fHWbkEEeDQyUHk6cnHrQkPtonV+CKla2FWDx6+nwQRAFi5K0s+bl3ANrGmkvP5fPoH1cFfX/fYyP2cNgG6Lg6z55a55OPXJgG3UVzGn2vbug98fvW+r/FlBADePtJPPn59iKKS6lYW5ad++8q4Vu+5G2h8FQIAr663JFlUAtiqqksBZ1Uj9UPp4neLHeb0TUQmwNEzg2xemv559OE2VsX4KE2ysXoXhpOJCgGAdXttShblAZtVpayMe5Zt1A+ji5fXZdj4uL/jF4YApy4NsxdaLXQIue2iGb/Ze4r6IcLg6rejUuPrEAB47yO7kkVTJIhyAsnG41rYylUVHQIAizdZlixqyh9DC2V8HGKkHrwuELffHZiUWz4kAVBEAueS+jl1EepAqo2ndLFW64guAYBNB2xMFjmdWsbHWXbqQesC0zMMGjcBgEVv2JYs4tDpT5BvzmDAoBWBxM2tH8a0jB+FAAe77EsWwaZKxkdLE9u2fPce65dbu4oEAFp32JYscnNK7WrQ14Z+sOpAMefwiLrjVy0CdF0cYguX2rU3ANtKCWBTdS9wqWcklPGjEgDYcdiuZBEaV1U0PtqbUQ9SB6/vyoY2fjUIALy81q5kUcUWduhxRz1AVcxvdthtb2aVT60JcOT0oKg4otaHKmBjX+OLA50GN2Esx+FT8mRPLQgAIO1MrQ91ArgZ31JytDqlHpwqXlrjsbExvZg/TgKcvDTM/rjcHocQtp45/ae9FuqBqeLr/6gle2pFAAChKLVeVAFbzyRAk3OBemAq2LhfPdlTSwIA6Y12JItg62nGR9tzyq7bqljY4rK+e5WrfCgJcPzskHBOqfUkJQC39bRW9+h9Tz0oFXx8Yahqxo+DAMCGfXY4hLB5SfjnrqQekAypjRntZA8FAU5/NixK0an1JQNsXrL+m1/4ceM7/WRPJcExsas3Rtn7nQNVJ8GBj82vHppWKBLrNStVAOrzqyWjPHzEWQGEbjBW81t9bPn2LNt9tF/UE1SLBMu2Ge4QcpsL4+MyJPLBVADi68HhcMmeUrnbP8kufDUyw8ggQBHoD7Dt4D3WyX2NqASAv/L7Fnr9VYK4CAs3YlEPpBLOfxk+2QP5wRlnZy7ztTnAUKUEKGLJpj72JnfmUFoehQTbDpldPQTb8/Xfe5Z6IEHA1BxWem+N8rdd/ib7EaAUq/dkxZoelgTYtaTWYxBwJR7y/8uoB+IHnMbB26sjY+M59uU1vr5/qj6FywhQxIodWfbOh/2ioZQOAZCzMLV6CLafU7hUkXww5Wjr8j/S7Sdo+3LxyojSGx+WAFN+wtY+tp1P7V0afsIbbxtaPcRtb2T1b+Mqj90flcf8t91x1v158PoeBwGKWLy5j23kfsIxBT/h5KfDoj8RtV7LIaqFTcwBfHUt+Eg35L//G2WnqxSyhSVAKdZwP+FgV2U/Yc9R85JFIieQwH25BgymCHTt9JPxiRy7ch3xe/QQrdoEKGLlzqzICgb5CQb2Je6ZU7g0mXogAmjR5mWnJ3uwB3Dp65nxu4kEKGIZ9xN2tN9jJy5OJ6txfYm57TEDGNPwCdm0otzJTLCzX+T31uMwfJwEmNpP2NLHNu2/y453/0gEw/oSe3MK16dTD2Sqf+/N78diN3qtCDDlMG7qY2v33mWHTg6Y1ZeY294YAhw7Ozi1P19L1IIA0/yEXdxpfMeQWUAQwJAlAClUtHOrdwL8fW3GpBPGnlFOIIDp8lh3dT19EwiAJe4PprWdKziBRoWBALaB1/JpEhsothMAdYJY8w3dDhZh4HkDBuIL7J7t+qDfWgKg57BRYV85uO0xA3SQD0SCl9ZkRP9eWwjwyrqM8bUABXQYkwySpU0xhb62Lcs6z5u7E4idPpUDIn8ypeOYSAYZkg5esTPLPr0yIu2+gd1CnA3QTcvGSYA0B6IY2TpfXNLQxo5a30BDyluKI2HPUA+kCHj/qNlDDl0WKsGxevd49LAxqvGxPM2XjBV+AJpNYp/DpJ1AURBiUkkYvP9i9S9yAnjTZX+DaffoJ+H9g7CGR1j3nEKDCIS12OLGd6HGwaRoQJSEmVYU+rfVHhu+/2MR6LWbo+JMQGUmO6Lo4kSIsDFMWKfSNRRLWWnJOdrPm3aAVBSFmlgWXt7sEQc4kB+QKRBv5Pb2e7ERAIUqssbROL629eDMMSzZbFiZeLEs3NSDISjhLpeh4Umx7ssaMiD+bpMUaOgQAE6b7DYxjAkdS7ouzoxScFUdtT7LMe1giIlHw/AmORn/g6AoFlWps0OdP7p7hiUA/AuVUi74A+gU4vf5KC2XOYkkBCg9Gmbq4VBMm0gRBwkqgGX7B1A+PO+ggpKgsO4vK+VhHXwBVAAFkQuhqqk3kE07HGry8XDU5FcStIWHl40Zo9LnwH9AXZ6MAHBCZUe8EaLiFLBsL2LVbjOrgWccDze5QQTeQpX27zj6tV3hJM4r6zPsg5Lpemr7lv9eRiIA5V4dCruR+wxuLz+jQYTpLWIwHQ8MqZ0P/Pb7MdYiuQMYpMLOI87vIcRU2ZrFUnPwhNp+A7arTb5xzLdFjOlNorCTpio4+o0zhSBOpc+EZy+LKJDD33lYLyNpYPXvNPg2ibKhTRzqA3QE9wUiHAzTtgXx/po9+jUJpreTD2wTlw8HzW4UCY/e7wpYmSCc1NmDRxQQpioJOQzTbxgLbBSZXwbMbxWLmDtsj8B/3RiteA8gMnr7QtYlItEjW3JMQMVWsflZwL1OPUgZEM6FFWwrI2dQWp+H4o3NB/S2kMuBo+zUepFB2ixaEMCSdvFf/Lvy+UGZIKpAW5hiNBDF+Cae+/MlgEq7eFsujMAWbdSegdXoEoZNKFmewAwoXhhRWAasuDIGTRuitI57kNrFK18ZA7Hp0qgPz4RvHhmVACZV90ihc2lUfhYwr3GEHxrS4XsIRiEAchQmVfdUgva1cRCbLo58sayKKG4CIOdvWnVPxZckzMWRYhYwsFAkCDpXxkYlgHHVPRUQ+upYQQDLLo/W7SkYhgAoOaN+Ti0CRLk8GpJIOQeoH0IVSOfeCagiqgYBUH1sYnVPILjtIhkf0pDOPM6diAHyh1EEpufxClVEYQmA4o9Gi66Mhc1gu8gEgCTT7iLqB9KBrIooDAGM7fUXRABus6oYH5JOs4e5M/EN9UNpsF+0gq8WAd4zuLrH9/m5rWCzqhEAkkw7c23YIi4CmTl0EI1KAFHdY9UVsW4Otqqq8UtIsJz+AdWBJhNRCYD0M/Vz6AA2isX4kPxS4JyjfkgdVKoikhHgrfctC/m4bao+9ZfLwpbMEwlDGkupoFIVUSUCtJ80v7qnDB5sE6vxi5Jsdp+2yR9AFdCoTxVREAEwaxjTy08JfN3nNqmJ8adIkHJb6R9cHbt9qoiCCIBOJNTj1QFsUVPjQ/ha8xCPNfdRP7wOcFmUjAC7j9hR3TNlfG4D2KLmBCiQ4JFEyu2iVoIqyquIyglgT3VPAVz3gSXetZJEq/tossm9TK4MRbSWVBGVEwDtXqjHpwqhc657UuMXZUF64DHuiPRSK0UVOLJdTgCcPKIelzrcXuic2u7TJNmSfdIWEhSriIoEsKm6BzqGrqnt7StgpS3LAc7to+MIqntMvM/HD9CtcW9+uWBdssUxxDk+dPGiHocSoFNT1nyZiIOmloWIJqMQ6tF6+7oi9gnEZpE9O4bmwc1Bh2RxfjUkv21sT+7AIHg1396NS5CksC2LSAnoqmaJnVqJSCWLeoLZJSEYophjeewpXUpBtYpN5WW1AnQSWyWPaQKGc7Y32lRtHJvhhQ7cxrp+64NElJw3OW3URqB76522qpVu2yw4vWLTMbTohne7I5/YqUfBIUZbTiWHMjx/ttAHNR8kwVn2fJOKeogYxGZOu/b5/FnJt6vJ9yyyI8tYZvhejF25LcusVBa0N0OPO5ObWWJsGKO0FdushBckRdDqFP1u0fSYsss5vluMgY8FY7IuYVMPgrbn6H2PCxBEJBHn9Tf8s4UHz78L3zmj5fqsmCG4DAk3YiWbvGfFvYgpdz888EJL/J7Chdkerk8XEP8Wv+vJzyo8EsHf8L/FZ+Czpi5YqjP5P2ey0rAsl+yGAAAAAElFTkSuQmCC",Gp="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png";var qp={name:"ethereum",id:"0x1",networkId:"1",namespace:"eip155",platform:"evm",label:"Ethereum",fullName:"Ethereum Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbC1vcGFjaXR5Oi42MDJ9LnN0MCwuc3Qxe2ZpbGw6I2ZmZn08L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik01MTEuNCA3My4zdjMxNS41TDc3OCA1MDggNTExLjQgNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTExLjQgNzMuMyAyNDQuNyA1MDhsMjY2LjYtMTE5LjJWNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNNTExLjQgNzEyLjN2MjE0LjVsMjY2LjgtMzY5LjEtMjY2LjggMTU0LjZ6Ii8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTUxMS40IDkyNi43VjcxMi4zTDI0NC43IDU1Ny42bDI2Ni43IDM2OS4xeiIvPjxwYXRoIGQ9Ik01MTEuNCA2NjIuNyA3NzggNTA4IDUxMS40IDM4OC44djI3My45eiIgZmlsbD0iI2ZmZiIgZmlsbC1vcGFjaXR5PSIuMiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im0yNDQuNyA1MDggMjY2LjYgMTU0LjdWMzg4LjhMMjQ0LjcgNTA4eiIvPjwvc3ZnPgo=",logoBackgroundColor:"#5683ec",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGltYWdlLXJlbmRlcmluZz0ib3B0aW1pemVRdWFsaXR5IiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgdGV4dC1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4PSIwIiB5PSIwIiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGU+LnN0MXtmaWxsOiM4YzhjOGN9PC9zdHlsZT48cGF0aCBkPSJtNDk5LjggNzcuNS01LjUgMTl2NTU5LjFsNS41IDUuNSAyNTkuNy0xNTMuNUw0OTkuOCA3Ny41eiIgZmlsbD0iIzM0MzQzNCIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Im00OTkuOCA3Ny41LTI1OS4zIDQzMEw0OTkuOCA2NjFWNzcuNXoiLz48cGF0aCBkPSJtNDk5LjggNzEwLjMtMi45IDR2MTk5LjFsMi45IDkuMSAyNTkuNy0zNjUuOC0yNTkuNyAxNTMuNnoiIGZpbGw9IiMzYzNjM2IiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNDk5LjggOTIyLjVWNzEwLjNMMjQwLjUgNTU2LjdsMjU5LjMgMzY1Ljh6Ii8+PHBhdGggZD0ibTQ5OS44IDY2MSAyNTkuNy0xNTMuNS0yNTkuNy0xMTcuOFY2NjF6IiBmaWxsPSIjMTQxNDE0Ii8+PHBhdGggZD0iTTI0MC41IDUwNy41IDQ5OS44IDY2MVYzODkuN0wyNDAuNSA1MDcuNXoiIGZpbGw9IiMzOTM5MzkiLz48L3N2Zz4K",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Hp},wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",logo:Gp,logoBackgroundColor:"#FFFFFF"},stables:{usd:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]},explorer:"https://etherscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://etherscan.io/tx/${e.id||e}`:t?`https://etherscan.io/token/${t}`: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:Hp,type:"NATIVE"},{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Gp,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:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c/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:"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:"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:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Zp="https://assets.spooky.fi/tokens/FTM.png",Jp="https://assets.spooky.fi/tokens/wFTM.png";var Xp={name:"fantom",id:"0xfa",networkId:"250",namespace:"eip155",label:"Fantom",fullName:"Fantom Opera",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00NjcgMTM1LjVjMTgtOS4zIDQ1LjEtOS4zIDYzIDBsMTgzLjQgOTdjMTAuNyA2LjEgMTYuNiAxNCAxOCAyMy4zdjQ4Ni42YzAgOS4zLTYuMSAxOS4yLTE4IDI1LjJsLTE4My4yIDk3Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTgzLjMtOTdjLTExLjktNi4xLTE3LjItMTUuOS0xOC0yNS4yVjI1NS43Yy43LTguNyA2LjctMTcuMiAxNy4yLTIzLjNMNDY3IDEzNS41em0yMzUuOCAzODkuNy0xNzIuNiA5MC45Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTcxLjktOTAuM3YyMTQuNGwxNzEuOSA5MC4zYzEwIDUuMyAyMC42IDEwLjcgMzEuMiAxMS4zaC43YzEwIDAgMjAtNS4zIDMwLjUtMTBsMTc0LTkyLjMtLjgtMjE0LjN6TTIzNy4zIDczMS4xYzAgMTguNiAyIDMxLjIgNi43IDM5LjggMy4zIDcuMyA4LjcgMTIuNiAxOC42IDE5LjJsLjcuN2MyIDEuNCA0LjcgMi42IDcuMyA0LjdsMy4zIDIgMTAuNyA2LjEtMTQuNiAyNC42LTExLjMtNy4zLTItMS40Yy0zLjMtMi02LjEtNC04LjctNS4zLTI3LjktMTguNi0zNy44LTM5LjItMzcuOC04MS42di0xLjRoMjcuMXpNNDg1IDM5Ni40Yy0xLjQuNy0yLjYuNy00IDEuNGwtMTgzLjIgOTYuOWgtLjcuN2wxODMuMyA5N2MxLjQuNyAyLjYgMS40IDQgMS40bC0uMS0xOTYuN3ptMjkuMyAwdjE5Ny44YzEuNC0uNyAyLjYtLjcgNC0xLjRsMTgzLjMtOTdoLjctLjdsLTE4My4zLTk4LjJjLTEuNC0uNS0yLjgtMS4yLTQtMS4yem0xODguNS0xMDctMTY0LjcgODYuMyAxNjQuNyA4Ni40VjI4OS40em0tNDA3LjcgMHYxNzMuM2wxNjQuNy04Ni4zLTE2NC43LTg3em0yMjIuNS0xMjhjLTkuMy01LjMtMjYuNS01LjMtMzYuNiAwbC0xODMuMiA5N2gtLjcuN2wxODMuMyA5N2M5LjMgNS4zIDI2LjUgNS4zIDM2LjYgMGwxODMuMy05N2guNy0uN2wtMTgzLjQtOTd6bTIxMi41IDkuMyAxMS4zIDcuMyAyIDEuNGMzLjMgMiA2LjEgNCA4LjcgNS4zIDI3LjkgMTguNiAzNy44IDM5LjIgMzcuOCA4MS42djEuNGgtMjguN2MwLTE4LjYtMi0zMS4yLTYuNy0zOS44LTMuMy03LjMtOC43LTEyLjYtMTguNi0xOS4ybC0uNy0uN2MtMi0xLjQtNC43LTIuNi03LjMtNC43bC0zLjMtMi0xMC43LTYuMSAxNi4yLTI0LjV6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#226efb",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iNDI1IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE5NjlmZiIvPjxwYXRoIGQ9Ik00NzQuMSAyMTAuM2MxNC4zLTcuNCAzNS45LTcuNCA1MC4yIDBsMTQ1LjkgNzcuMmM4LjUgNC44IDEzLjIgMTEuMSAxNC4zIDE4LjV2Mzg3LjVjMCA3LjQtNC44IDE1LjMtMTQuMyAyMC4xbC0xNDUuOSA3Ny4yYy0xNC4zIDcuNC0zNS45IDcuNC01MC4yIDBsLTE0NS45LTc3LjJjLTkuNS00LjgtMTMuNy0xMi43LTE0LjMtMjAuMVYzMDZjLjUtNi45IDUuMy0xMy43IDEzLjctMTguNS4xIDAgMTQ2LjUtNzcuMiAxNDYuNS03Ny4yem0xODcuNyAzMTAuM0w1MjQuMyA1OTNjLTE0LjMgNy40LTM1LjkgNy40LTUwLjIgMGwtMTM2LjktNzEuOXYxNzAuN2wxMzYuOSA3MS45YzcuOSA0LjIgMTYuNCA4LjUgMjQuOCA5aC41YzcuOSAwIDE1LjktNC4yIDI0LjMtNy45bDEzOC41LTczLjVWNTIwLjZoLS40ek0yOTEuMiA2ODQuNWMwIDE0LjggMS42IDI0LjggNS4zIDMxLjcgMi42IDUuOCA2LjkgMTAgMTQuOCAxNS4zbC41LjVjMS42IDEuMSAzLjcgMi4xIDUuOCAzLjdsMi42IDEuNiA4LjUgNC44LTExLjYgMTkuNi05LTUuOC0xLjYtMS4xYy0yLjYtMS42LTQuOC0zLjItNi45LTQuMi0yMi4yLTE0LjgtMzAuMS0zMS4yLTMwLjEtNjV2LTEuMWgyMS43em0xOTcuMi0yNjYuNGMtMS4xLjUtMi4xLjUtMy4yIDEuMWwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzEuMS41IDIuMSAxLjEgMy4yIDEuMVY0MTguMXptMjMuMiAwdjE1Ny41YzEuMS0uNSAyLjEtLjUgMy4yLTEuMWwxNDUuOS03Ny4yaC41LS41bC0xNDUuOS03OC4yYy0xLjEtLjUtMi4xLTEtMy4yLTF6TTY2MS44IDMzM2wtMTMxLjEgNjguNyAxMzEuMSA2OC43VjMzM3ptLTMyNC42IDB2MTM4bDEzMS4xLTY4LjdjMC0uMS0xMzEuMS02OS4zLTEzMS4xLTY5LjN6bTE3Ny4xLTEwMi4xYy03LjQtNC4yLTIxLjEtNC4yLTI5LjEgMGwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzcuNCA0LjIgMjEuMSA0LjIgMjkuMSAwbDE0NS45LTc3LjJoLjUtLjVsLTE0NS45LTc3LjJ6bTE2OS4xIDcuNCA5IDUuOCAxLjYgMS4xYzIuNiAxLjYgNC44IDMuMiA2LjkgNC4yIDIyLjIgMTQuOCAzMC4xIDMxLjIgMzAuMSA2NXYxLjFoLTIyLjdjMC0xNC44LTEuNi0yNC44LTUuMy0zMS43LTIuNi01LjgtNi45LTEwLTE0LjgtMTUuM2wtLjUtLjVjLTEuNi0xLjEtMy43LTIuMS01LjgtMy43bC0yLjYtMS42LTguNS00LjggMTIuNi0xOS42eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",currency:{name:"Fantom",symbol:"FTM",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Zp},wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",logo:Jp},stables:{usd:["0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf","0x1B6382DBDEa11d97f24495C9A90b7c88469134a4"]},explorer:"https://ftmscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://ftmscan.com/tx/${e.id||e}`:t?`https://ftmscan.com/token/${t}`: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:Zp,type:"NATIVE"},{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",symbol:"WFTM",name:"Wrapped Fantom",decimals:18,logo:Jp,type:"20"},{address:"0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf",symbol:"lzUSDC",name:"LayerZero USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"},{address:"0x1B6382DBDEa11d97f24495C9A90b7c88469134a4",symbol:"axlUSDC",name:"Axelar Wrapped USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Kp="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/info/logo.png",$p="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/assets/0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270/logo.png";var ef={name:"polygon",id:"0x89",networkId:"137",namespace:"eip155",label:"Polygon (POS)",fullName:"Polygon (POS) Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMzEuNSA0NTkuM2MtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnYxOTQuNGMwIDE5LjIgOS42IDM2IDI0IDQzLjJsMTY1LjYgOTZjMTQuNCA5LjYgMzMuNiA5LjYgNDggMGwxNjUuNi05NmMxNC40LTkuNiAyNC0yNCAyNC00My4ydi02OS42bC03Ni44LTQzLjJ2NjQuOGMwIDE5LjItOS42IDM2LTI0IDQzLjJsLTg2LjQgNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtODYuNC01MC40Yy0xNC40LTkuNi0yNC0yNC0yNC00My4yVjU1MC41YzAtMTkuMiA5LjYtMzYgMjQtNDMuMmw4OC44LTUwLjRjMTQuNC05LjYgMzMuNi05LjYgNDggMGwxMTIuOCA2NC44IDc2LjggNDUuNiAxMTIuOCA2NC44YzE0LjQgOS42IDMzLjYgOS42IDQ4IDBsMTY4LTk2YzE0LjQtOS42IDI0LTI0IDI0LTQzLjJ2LTE5MmMwLTE0LjQtOS42LTMxLjItMjQtNDAuOGwtMTY4LTk2Yy0xNC40LTkuNi0zMy42LTkuNi00OCAwbC0xNjUuNiA5NmMtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnY2OS42bDc2LjggNDUuNnYtNjkuNmMwLTE5LjIgOS42LTM2IDI0LTQzLjJsODguOC01Mi44YzE0LjQtOS42IDMzLjYtOS42IDQ4IDBsODguOCA1MC40YzE0LjQgOS42IDI0IDI0IDI0IDQzLjJ2MTAwLjhjMCAxOS4yLTEyIDM2LTI0IDQzLjJsLTg4LjggNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtMTEyLjgtNjkuNi03OS4yLTQzLjItMTE3LjYtNjkuNmMtMTQuNC05LjYtMzMuNi05LjYtNDggMCAwIDIuNC0xNjAuOCA5OC40LTE2My4yIDk4LjR6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#824ee2",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMDkuNyA0NTljLTE2LjQgOS40LTI1LjggMjUuOC0yNS44IDQ2Ljl2MjA2LjNjMCAyMS4xIDkuNCAzNy41IDI1LjggNDYuOWwxNzUuOCAxMDMuMWMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBsMTc1LjgtMTAzLjFjMTYuNC05LjQgMjUuOC0yNS44IDI1LjgtNDYuOXYtNzIuN2wtODItNDYuOXY2OGMwIDIxLjEtOS40IDM3LjUtMjUuOCA0Ni45TDMzNyA3NjEuNGMtMTYuNCA5LjQtMzUuMiA5LjQtNTEuNiAwTDE5NCA3MDcuNWMtMTYuNC05LjQtMjUuOC0yNS44LTI1LjgtNDYuOVY1NTIuOGMwLTIxLjEgOS40LTM3LjUgMjUuOC00Ni45bDkzLjgtNTMuOWMxNC4xLTkuNCAzNS4yLTkuNCA1MS42IDBsMTE5LjUgNjggODIgNDkuMiAxMTkuNSA2OGMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBMODkwLjIgNTM0YzE2LjQtOS40IDI1LjgtMjUuOCAyNS44LTQ2LjlWMjgzLjJjMC0xNi40LTkuNC0zMi44LTI1LjgtNDIuMkw3MTIuMSAxMzcuOWMtMTYuNC05LjQtMzUuMi05LjQtNTEuNiAwTDQ4NC43IDI0MWMtMTYuNCA5LjQtMjUuOCAyNS44LTI1LjggNDYuOXY3NWw4MiA0OS4ydi03Mi43YzAtMjEuMSA5LjQtMzcuNSAyNS44LTQ2LjlsOTMuOC01Ni4zYzE2LjQtOS40IDM1LjItOS40IDUxLjYgMGw5My44IDUzLjljMTQuMSA5LjQgMjUuOCAyNS44IDI1LjggNDYuOXYxMDhjMCAyMS4xLTExLjcgMzcuNS0yNS44IDQ2LjlsLTkzLjggNTYuM2MtMTQuMSA5LjQtMzUuMiA5LjQtNTEuNiAwTDU0MSA0NzUuNGwtODItNDYuOS0xMjQuMi03Mi43Yy0xNC4xLTkuNC0zNS4yLTkuNC01MS42IDAtLjEuMS0xNzEuMiAxMDMuMi0xNzMuNSAxMDMuMnoiIGZpbGw9IiM4MjQ3ZTUiLz48L3N2Zz4=",currency:{name:"Polygon",symbol:"MATIC",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Kp},wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",logo:$p},stables:{usd:["0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174","0xc2132D05D31c914a87C6611C10748AEb04B58e8F"]},explorer:"https://polygonscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://polygonscan.com/tx/${e.id||e}`:t?`https://polygonscan.com/token/${t}`: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:Kp,type:"NATIVE"},{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",symbol:"WMATIC",name:"Wrapped Matic",decimals:18,logo:$p,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:"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:"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:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xf6261529C6C2fBEB313aB25cDEcD243613b40EB5",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const tf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDp1cmwoI1NWR0lEXzAwMDAwMDE5Njc2ODQzODE5NzI3MzAwODIwMDAwMDA1OTQ3NjMyODMzODYxMjM4OTE3Xyl9LnN0MntmaWxsOnVybCgjU1ZHSURfMDAwMDAwNjQzMjA1MjE4MTcxODM4NzM1NjAwMDAwMDMxNzkyNDIxNTkzMzkwODM5NjdfKX08L3N0eWxlPjxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfMV8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iODE1Ljg1NiIgeTE9IjcwLjgyNCIgeDI9IjM4OC4zMzYiIHkyPSItNzQ4LjA1MiIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSA2NTcuOWM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDc5NS4xYy00LjkgNC45LTEyLjIgNy4zLTE3LjEgNy4zSDEyNS4zYy0xMi4yIDAtMTcuMS0xNC43LTkuOC0yNC41bDEyMi40LTEyMHoiIGZpbGw9InVybCgjU1ZHSURfMV8pIi8+PGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8wMDAwMDE1MDgxNTQ0MzI2NzI2OTc2MDQ0MDAwMDAxMzQ2MDgyNDM3MDQwMzE3MjU0M18iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iNjI4LjQ4MSIgeTE9IjE2NC4xMzQiIHgyPSIyMDAuOTYyIiB5Mj0iLTY1NC43NCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSAyMDQuOGM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDM0MmMtNC45IDQuOS0xMi4yIDcuMy0xNy4xIDcuM0gxMjUuM2MtMTIuMiAwLTE3LjEtMTQuNy05LjgtMjJsMTIyLjQtMTIyLjV6IiBmaWxsPSJ1cmwoI1NWR0lEXzAwMDAwMTUwODE1NDQzMjY3MjY5NzYwNDQwMDAwMDEzNDYwODI0MzcwNDAzMTcyNTQzXykiLz48bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzAwMDAwMDA3NDA5ODc3MzYzMTA0OTgxNjMwMDAwMDE1MTMzNzA1NTcwNjgwMDk3NzA5XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI3MjAuOTIzIiB5MT0iMTE1Ljg3IiB4Mj0iMjkzLjQwNiIgeTI9Ii03MDMuMDAzIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTkxLjQzNSkiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwZmZhMyIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2RjMWZmZiIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTc2Mi4xIDQzMC4xYy00LjktNC45LTEyLjItNy4zLTE3LjEtNy4zSDEyNS4zYy0xMi4yIDAtMTcuMSAxNC43LTkuOCAyMkwyMzggNTY3LjNjNC45IDQuOSAxMi4yIDcuMyAxNy4xIDcuM2g2MTkuN2MxMi4yIDAgMTcuMS0xNC43IDkuOC0yMkw3NjIuMSA0MzAuMXoiIGZpbGw9InVybCgjU1ZHSURfMDAwMDAwMDc0MDk4NzczNjMxMDQ5ODE2MzAwMDAwMTUxMzM3MDU1NzA2ODAwOTc3MDlfKSIvPjwvc3ZnPgo=",nf="https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png";var rf={name:"solana",networkId:"solana",namespace:"solana",label:"Solana",fullName:"Solana Mainnet Beta",logo:tf,logoBackgroundColor:"#000000",logoWhiteBackground:tf,currency:{name:"Solana",symbol:"SOL",decimals:9,address:"11111111111111111111111111111111",logo:nf},wrapped:{address:"So11111111111111111111111111111111111111112",logo:nf},stables:{usd:["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]},explorer:"https://solscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://solscan.io/tx/${e.id||e}`:t?`https://solscan.io/token/${t}`: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"],sockets:["wss://solana-mainnet.phantom.app/YBPpkkN4g91xDiAnTE9r0RcMkjg0sKUIWvAfoFVJ","wss://mainnet-beta.solflare.network"],tokens:[{address:"11111111111111111111111111111111",symbol:"SOL",name:"Solana",decimals:9,logo:nf,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"},{address:"DePay1miDBPWXs6PVQrdC5Vch2jemgEPaiyXLNLLa2NF",symbol:"DEPAY",name:"DePay",decimals:9,logo:"https://depay.com/favicon.png",type:"SPL"}],zero:"0",maxInt:"340282366920938463463374607431768211455"};const of="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDojMjEzMTQ3fTwvc3R5bGU+PHBhdGggZD0iTTkyIDkyaDgxNnY4MTZIOTJWOTJ6IiBmaWxsPSJub25lIi8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTE2NS44IDM0MC4xVjY2MGMwIDIwLjYgMTAuOCAzOS4yIDI4LjcgNDkuNmwyNzcuMSAxNTkuOWMxNy42IDEwLjEgMzkuNSAxMC4xIDU3LjEgMGwyNzcuMS0xNTkuOWMxNy42LTEwLjEgMjguNy0yOSAyOC43LTQ5LjZWMzQwLjFjMC0yMC42LTEwLjgtMzkuMi0yOC43LTQ5LjZsLTI3Ny4xLTE2MGMtMTcuNi0xMC4xLTM5LjUtMTAuMS01Ny4xIDBsLTI3Ny4xIDE2MGMtMTcuNiAxMC4xLTI4LjQgMjktMjguNCA0OS42aC0uM3oiLz48cGF0aCBkPSJtNTYwLjQgNTYyLTM5LjUgMTA4LjRjLTEgMi45LTEgNi4yIDAgOS41bDY3LjkgMTg2LjQgNzguNi00NS40LTk0LjMtMjU4LjhjLTIuMy02LTEwLjQtNi0xMi43LS4xem03OS4zLTE4Mi4xYy0yLjMtNS45LTEwLjQtNS45LTEyLjcgMGwtMzkuNSAxMDguNGMtMSAyLjktMSA2LjIgMCA5LjVMNjk4LjggODAzbDc4LjYtNDUuNC0xMzcuNy0zNzcuNHYtLjN6IiBmaWxsPSIjMTJhYWZmIi8+PHBhdGggZD0iTTUwMCAxNDIuNmMyIDAgMy45LjYgNS41IDEuNmwyOTkuNiAxNzNjMy42IDIgNS41IDUuOSA1LjUgOS44djM0NmMwIDMuOS0yLjMgNy44LTUuNSA5LjhsLTI5OS42IDE3M2MtMS42IDEtMy42IDEuNi01LjUgMS42cy0zLjktLjYtNS41LTEuNmwtMjk5LjYtMTczYy0zLjYtMi01LjUtNS45LTUuNS05LjhWMzI2LjdjMC0zLjkgMi4zLTcuOCA1LjUtOS44bDI5OS42LTE3M2MxLjYtMSAzLjYtMS42IDUuNS0xLjZ2LjN6bTAtNTAuNmMtMTAuOCAwLTIxLjIgMi42LTMxIDguMmwtMjk5LjYgMTczYy0xOS4yIDExLjEtMzEgMzEuMy0zMSA1My41djM0NmMwIDIyLjIgMTEuOCA0Mi40IDMxIDUzLjVsMjk5LjYgMTczYzkuNSA1LjUgMjAuMiA4LjIgMzEgOC4yczIxLjItMi42IDMxLTguMmwyOTkuNi0xNzNjMTkuMi0xMS4xIDMxLTMxLjMgMzEtNTMuNXYtMzQ2YzAtMjIuMi0xMS44LTQyLjQtMzEtNTMuNWwtMjk5LjktMTczYy05LjUtNS41LTIwLjItOC4yLTMxLTguMmguM3oiIGZpbGw9IiM5ZGNjZWQiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJtMzAxLjUgODAzLjIgMjcuOC03NS43IDU1LjUgNDYtNTEuOSA0Ny43LTMxLjQtMTh6Ii8+PHBhdGggZD0iTTQ3NC41IDMwMi4yaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOEwyMjIuOSA3NTcuNWw3OC42IDQ1LjRMNDgxLjEgMzExYzEuNi00LjYtMS42LTkuMS02LjItOS4xbC0uNC4zem0xMzMuMiAwaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOGwtMTg2IDUwOS44IDc4LjYgNDUuNEw2MTMuOSAzMTFjMS42LTQuNi0xLjYtOS4xLTYuMi05LjF2LjN6IiBmaWxsPSIjZmZmIi8+PC9zdmc+Cg==";var af={name:"arbitrum",id:"0xa4b1",networkId:"42161",namespace:"eip155",platform:"evm",label:"Arbitrum",fullName:"Arbitrum One",logo:of,logoBackgroundColor:"#2b354d",logoWhiteBackground:of,currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:qp.currency.logo},wrapped:{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",logo:qp.wrapped.logo},stables:{usd:["0xaf88d065e77c8cC2239327C5EDb3A432268e5831","0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"]},explorer:"https://arbiscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://arbiscan.io/tx/${e.id||e}`:t?`https://arbiscan.io/token/${t}`:n?`https://arbiscan.io/address/${n}`:void 0,endpoints:["https://arbitrum.blockpi.network/v1/rpc/public","https://arbitrum-one.publicnode.com","https://endpoints.omniatech.io/v1/arbitrum/one/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:qp.currency.logo,type:"NATIVE"},{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:qp.wrapped.logo,type:"20"},{address:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8/logo.png",type:"20"},{address:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1/logo.png",type:"20"},{address:"0x912CE59144191C1204E64559FE8253a0e49E6548",symbol:"ARB",name:"Arbitrum",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0x912CE59144191C1204E64559FE8253a0e49E6548/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const sf="https://traderjoexyz.com/static/media/avalanche.7c81486190237e87e238c029fd746008.svg",uf="https://raw.githubusercontent.com/traderjoe-xyz/joe-tokenlists/main/logos/0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7/logo.png";var cf={name:"avalanche",id:"0xa86a",networkId:"43114",namespace:"eip155",platform:"evm",label:"Avalanche",fullName:"Avalanche C-Chain",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0zNTkuMSA3NTEuMWgtOTUuM2MtMjAgMC0yOS45IDAtMzYtMy44LTYuNi00LjMtMTAuNC0xMS4zLTEwLjktMTguOS0uMy03LjEgNC42LTE1LjggMTQuNC0zM2wyMzUtNDE0LjNjMTAuMS0xNy42IDE1LjEtMjYuNCAyMS40LTI5LjYgNi45LTMuNSAxNS4xLTMuNSAyMS45IDAgNi40IDMuMyAxMS40IDEyIDIxLjQgMjkuNmw0OC40IDg0LjMuMi41YzEwLjggMTguOSAxNi4zIDI4LjUgMTguNiAzOC41IDIuNiAxMC45IDIuNiAyMi42IDAgMzMuNS0yLjQgMTAuMS03LjggMTkuOC0xOC44IDM4LjlMNDU2LjIgNjk0LjlsLS4zLjVjLTEwLjggMTktMTYuMyAyOC43LTI0LjEgMzYtOC4zIDgtMTguMyAxMy43LTI5LjMgMTYuOS05LjkgMi44LTIxLjEgMi44LTQzLjQgMi44em0yNDAuMyAwaDEzNi40YzIwLjIgMCAzMC4yIDAgMzYuMy00IDYuNi00LjMgMTAuNi0xMS4zIDEwLjktMTkuMS4zLTYuOS00LjUtMTUuMi0xMy45LTMxLjZsLTEtMS43TDY5OS44IDU3OGwtLjgtMS4yYy05LjYtMTYuMy0xNC40LTI0LjUtMjAuNy0yNy42LTYuOS0zLjYtMTUtMy42LTIxLjcgMC02LjIgMy4zLTExLjMgMTEuOC0yMS4zIDI5bC02OC4xIDExNi45LS4yLjNjLTEwLjEgMTcuMi0xNSAyNS44LTE0LjUgMzIuOC41IDcuNyA0LjUgMTQuOSAxMC45IDE5IDUuNyAzLjkgMTUuOCAzLjkgMzYgMy45eiIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#E84142",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yMzUuNiAyNTkuNWg1MjguOXY0ODFIMjM1LjZ2LTQ4MXoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNOTI4IDUwMGMwIDIzNi40LTE5MS42IDQyOC00MjggNDI4UzcyIDczNi40IDcyIDUwMCAyNjMuNiA3MiA1MDAgNzJzNDI4IDE5MS42IDQyOCA0Mjh6TTM3OC43IDY3MC4zaC04My4xYy0xNy41IDAtMjYuMSAwLTMxLjMtMy40LTUuNy0zLjctOS4xLTkuOC05LjYtMTYuNS0uMy02LjIgNC0xMy44IDEyLjYtMjguOUw0NzIuNSAyNjBjOC43LTE1LjQgMTMuMS0yMyAxOC43LTI1LjkgNi0zIDEzLjEtMyAxOS4xIDAgNS42IDIuOCAxMCAxMC41IDE4LjcgMjUuOWw0Mi4yIDczLjYuMi40YzkuNCAxNi41IDE0LjIgMjQuOCAxNi4zIDMzLjYgMi4zIDkuNiAyLjMgMTkuNiAwIDI5LjItMi4xIDguOC02LjggMTcuMi0xNi40IDM0TDQ2My42IDYyMS4ybC0uMy41Yy05LjUgMTYuNi0xNC4zIDI1LTIxIDMxLjQtNy4zIDYuOS0xNiAxMi0yNS41IDE0LjgtOC43IDIuNC0xOC41IDIuNC0zOC4xIDIuNHptMjA5LjggMGgxMTljMTcuNiAwIDI2LjQgMCAzMS43LTMuNSA1LjctMy43IDkuMi05LjkgOS42LTE2LjYuMy02LTMuOS0xMy4zLTEyLjItMjcuNWwtLjktMS41LTU5LjYtMTAyLS43LTEuMWMtOC40LTE0LjItMTIuNi0yMS4zLTE4LTI0LjEtNi0zLTEzLjEtMy0xOSAwLTUuNSAyLjgtOS45IDEwLjMtMTguNiAyNS4zbC01OS40IDEwMi0uMi40Yy04LjcgMTUtMTMgMjIuNS0xMi43IDI4LjcuNCA2LjcgMy45IDEyLjkgOS42IDE2LjYgNSAzLjMgMTMuOCAzLjMgMzEuNCAzLjN6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2U4NDE0MiIvPjwvc3ZnPg==",currency:{name:"Avalanche",symbol:"AVAX",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:sf},wrapped:{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",logo:uf},stables:{usd:["0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7","0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]},explorer:"https://snowtrace.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://snowtrace.io/tx/${e.id||e}`:t?`https://snowtrace.io/token/${t}`:n?`https://snowtrace.io/address/${n}`:void 0,endpoints:["https://avalanche.public-rpc.com","https://avalanche.blockpi.network/v1/rpc/public","https://avax.meowrpc.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"AVAX",name:"Avalanche",decimals:18,logo:sf,type:"NATIVE"},{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",symbol:"WAVAX",name:"Wrapped AVAX",decimals:18,logo:uf,type:"20"},{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7/logo.png",type:"20"},{address:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E/logo.png",type:"20"},{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xd586E7F844cEa2F87f50152665BCbc2C279D8d70/logo.png",type:"20"},{address:"0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const lf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAMAAAAKTh9YAAAAYFBMVEVHcEz////////////////////////////////////j++ma6qVj5nsl5lAK4zpA6mXO79aD8Zyr87uCvq0J2TkItEkOhl4EeVsKzSwLrxMNtQpjsZG42dEeuxyF2oU6wzjPwJjeAAAACnRSTlMAEUB9r9j/YO+Kf6/iMwAABD1JREFUeAHU1EESQjEMAlBIAq33v7ArV7+OLss7AZOB4IDVI/kW0nQRf+Ca7QvNwg/s7VtpGJP8oPFNybdT4aidoPHEcYZn6ymnEEOjH8KPk0zeTI+DLacpfMhpxKTGnFtDB9o8/Jisw8uxh1/OtGIrYw9Ah9pEOVWhnaoxTvWCnErR2Z3rzX59JMYOAkEYXr1gRJfIzP1PalbOpZm2aEf+tcKnCCz7bS37si/7si/7si/7si/7srvRHAE5kJHdbV4wkn076Q9RMMLu04fYnceT/An9JnhMkr19Ezwvvvee73ieOL1dfdN15yQlwas2S7vbgTn4iLfaDO0emIPPeLtgZt+AOfhcQHJGdieYg88VLG9k98AUfG7gBRu7YAo+9wpeNLEnYAY+915wkIndQ4Xn9IajgoV9hwbP6b3iqGRhF5zH537VHi3swGl87tft3tB+Ap/7Z9lFhef0z3hndmjwnP4Z32qEAs/po4//Rwao8JzeC3hiMyeACs/ppnMCUlThOf3wxjurObAKz+kHNz5arT0CNHhO5zde7NZ8UYXn9N4K2Utnt8NzOsFL+Kuz2+EJneA5nduN8bmTWsXzKqNzuyX+FZ3rL43Sud0Un/txtV7KqNY+6Hq7Kb71Gxt0W7seX5od/Z6a+8BuGASCMMwraRK4103A9z9leq+Q3zCYC+h7oy7tbr6d4zGd2zme04Ed4AEd2AEe0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2Tl+B+jQzvH7j/ThnNub4Xd7Rud2gLc9pyM7wO9sz+nEDvA7e8G/0vX2IeTan/DXPdWL+cwD/hl/c3r2lT2u7XbWk31aYt9vesp9yD5Xn1ZPx7svtNtMYwfX9/hqjwAvuq8awIufZwzgxc+RZgAvfn43gBe/N5lxPLAD+sTs2HgnS53jnS51jHfC1CneKVOHeCdNneGdNnWEd+LUCd6pUwd4p04d4J06dYB3tekAL64nSAAvr+PgeGYHdI6ndkDneGoHdI4HdkAvxw/V7IsiegU8sIdSejk+VbIvyumveBY8twdQh51A8PL691x8PBf3HRD8oO33QPhR2mfD8EnZ3wTxXthXRvFe18+H8anbPsqkOVfnnJ6DF/RmPdE5vs69aQiYnoH3rXuzXukcP6jmE3C8734uxAgfgSvM4+D4RcV37SmgZ+BT6/kz0yd6KT5+kcex9bel+fDPupXP+MOs8byl6esGYfRxbDPnanG0OVf+8ODeH9Ks5f+mE50vJlp37d23EQQhFATRr6Yg/4RPuSe9o6tmIni7gN2222677bbbbrvttttuu5sw/7EP1j7kfhO6m5Wbak90Jw7d54NeGsV9jb0y1B+f+P5qpHB08XvD8M4zrq9N7pqje/L8jj/twXa8XOl4uSoe4/363RnvlyOo/LE1R8JnZfywrB7pGLY0Xa/gV5AhY9e5oJHCAAAAAElFTkSuQmCC",df="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAYAAAA9kO9qAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0PSURBVHgB7d1LbFzVHcfx37l3/CDGxgkhxEnU2K1EgxoUN0kVUglhIhbdVAo7dpCiSl2BqbqphIRpuy5u95SwY1XSWlXVIhFXtGqjJsXQSJRCsXklaQiJ8zCxPTP3cv53cuOxZ8bjmbmP8z/n/5GMHcfjmPHXZ86ce++xQpJGxwdRwChCtQ9Q+nU4qt87CIVhCLGeEHP6v/NQag5h8DY8TKOEGcxMziMhCp2iwD0c1V/kE/QnUNxCJGdavxzHmRdfQYfajz2K3HsGKhyHBC7SN6dznUY5eEGP9nNoQ+uxS+Qib6GawL9++QJa1FrsB8fH9D/0sn5rGELka04PuMdwenJ6ozfwN/qB2D/+vP7ZOA4ZzYUZdIfqSQx9Fzj/979s5AbNR3aatvieHs3DoxDCSOqEnssfa7Zys37s0VKiOqmXhUYhhMlCvUwZhI+sF3zj2CV0wU2T4L2GN6Spi4QuOFG612jKXV/9J6j0ZFThRxCCnz2NnrTWTmMqy4snIQRnSk9n1ixL1k5jKuvoQvBGHdPzziqrY4/W0uWAkbDCMDw1Xv2OlWnM6PgwfDULIewxj3I4Eq/OrIzsvpqAEHYZrB7dq6cxD0MI2yg8E8/dK7HvH38SMlcXdqpcb4E49sqFF0LY6VbfqnKil7oCIewVPVH1omtGhbBbdG20hwBjEMJ2AcWuvH0QwnYK+zyE4TCEsF2oaGSXy+yEA3TntPQ4DCHsN+xBCEdI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwRgEWU30loK9c+cOCj3DB6v/dtqltS7ffDi/2wFZWffcpbv/IJXh7r8Hfe70SexWKPZjdhPKpzdGLzd/Y9dD9Uzh0BR69VIUeo/somO1D6c0tCN6y50I2hQPPhmCORqauxz9D4cjnLd2u9MY9KL6605noC9+/EN1PaweB9dB9Q/cR3VfcsY+9nW/gWsWpIRRf+hpspUa+RM/T/4OnX7eLol987n7WAwPb2Cnurqdn9cPxZSTBhm9mPfRo1/XUxx0NBtWWX9qN0tR2cMRyNYa+cT2/eDex0KPPqadCvfpzqjpzWK4Kj51D99MfJhY66X7qo+jRlCOWsdNI1clDciM2Be8/9AW6n/gEaaDg6UkuN+xip1Gl1SeirbAheH/0Krp/OIc09fz0v4k+YmSBVewUYBYPoZyD976xgMLjn0INpBui0scv6BGWE1ax06qLl1GAHIOn0D09qvt7biAL9Airdic/nUwLq9iznidyCj4KXb/438l2q/2uR9ObUiaNTex+g6N9aeMQfBx69PaORWTJPyKxJ45iz4vJwVeHrrYupz5XX4vm7mpkARywiT3v0EwMvjr0SH8RefBHeMzb2cTuGXCHmhR8Tej0Pj2y54HLk3g+I7sha7omBF8v9EhPgDxI7BbLM/iGoedpyQcHbGIPDDtBK4/gm4a+lM+3M7zK47IINrGbeDZilsFvZEQPr3UhD3ShBwd8Yp/dBBNlEfxGpy7huV7kIfjkDnDAJvbSqc0wVZrBtzJHD68X9Oie7ZSCHnHz+iFrFZ85+9kBoy+YTiP4dp6MBu/diSwV/3gvuGC1GlOaMvuOTTL4dlddyu/chTDDJ6rlv20BF8xiHzJuVWatJILvaHlRhx68M4AsFF/dxeoyRlaxhws+ln/9dZiuk+CTWEePRveU5+7xrgOcsDuoRHN3DndyO8EndsBIj+6l3w2lNp2h5050cTo3LI+g0sOnbcEnfWSUVmZKJ5IPPg6d4y4MPnYcngBDNMIT2vnLZHQKLO2+RTuQocFqUmqnANz0EX5wZ3QSnUrgvJnwcjcWJ/YYe8yjGbaxExuCT/1cl2VPx9kXxa46OCuy/O8BLP38Pr2mzuMAUj2sYyecg8/spC4dPB3SD/7T33L0wWe9KP15G5Z/sxuY7wZnVuz1SLoe/zS6INt08c5jqr+U29mL9G+rHYt6erMQnRZMf7799ekfDFzqRqBfwvf6EdzwUT6tf0Cv898D15rYCZvg9dy3+Id7jQ8oLCprQidWnc/OZpVmyzK6jp4H+s3dZMi20Il1F2+wCV6HbmrwNoZOrLxSSYJvn62hE2svy5PgW2dz6MTqa1Al+I2zPXRi/QXXEnxzLoROnNhdQIJvzJXQiTNbaUjwtVwKnTi1b4wEv8K10IlzmyRJ8G6GTpzcEczl4F0NnTi7/R234NWmzi/idjl04vRej6yCf/R9qJ4OfmnvTc/p0InzG5tyCR67+tB94FRbwUvoFbKLL3gF3/PAmy0Ffzv0mzx22k2TxH4Lh+DDzVug+pY2HLyEvprEXsX44H0fwcBdUL1fNg1eQq8lsa9BwZemtsNYd1QueG4WvIReS2KvI9rWzdRNVLtXLnpuFHxAu+pK6DUk9jpom73gbD9MFPau3sqiXvDhZzy2kM6axN4ABc9FTfBlBVFLYm9Abcvn1yw2VS7Xffft4PuuAr35/NY800nsddDejP7eazBSg9hJHLw/fBGilsReh8l7z6jFm+v/faGI3u+9Dm/7FxCrSexr0EZLhSOfw1Tqxo3mH6OD3/SD30vwa0jsVTjsKKYWmscefVzvsgS/hsR+C4vQr1xed85e8/ES/CoSO/jsEen9/wJaJcGvcD52LqGrS/p5xHJ7y6ESfIXTsXMJnSL3znX2dUrwDsfOKXT/ww+QBNeDdzJ2dqEvJ3c01+XgnYvd5dBjrgbvVOwS+goXg3cmdgm9lmvBOxG7hN6YS8FbH7uE3pwrwVsdu4S+cS4Eb23sEnrrbA/eytgl9PbZHLx1sUvonbM1eKtiZ/Mbrq8pY0OP2Ri8NbGzCf1iDxZ/sg9Lf3oAprMteCtiZxX6c/dHr5dPHsTSyQMwnU3Bs4+dY+gxCT5brGPnHHpMgs8O29htCD0mwWeDZew2hR7jFrwavA5u2MVeOHTZutBjvIKf0q87/6VmWeIX+1Mfw3TthB7jErynR/auw2fBCavYaacub5vZo0knoce4BN99+B1Wozuv2A2fviQReoxD8DSd4TS6s4nd23vN6FE9ydBjHILv+vZ74IJN7IVDV2CqNEKPmR48zd25rMywiV2NtP/bndOUZugx04P3R86BAz6xGziFySL0mMnBezKyJ8u0+XqWocdMDd7r57EiI7v4tiGP0GNcliVNxCZ2U34vaZ6hx0wLPrie333RCj6xX+xG3kwIPWZS8MH8ZnDAJvbg7ADyZFLoMVOCD84PggM2sZdO5Td6mBh6LO/gg/l+BBfuBgd8pjGzfbnM200OPZZn8OXZIXDB6Amqj9LUvcgSh9BjeQW/pP9dLlgtPZamhjIb3TmFHss6+OJb9yHU0xguWMVOo3vx1R1IG8fQYxT84m/HkDaaq3Ma1Qm7g0o0upfeuAdp4Rx6rDjzzdSDX5p6mNWoTlgeQS2+tBvB7CYkzYbQY2kGv/j6gyi9vxPc+NhxeALcFD2U/7oVatdNeLsWkQT64Vn62R4rQo8FF7YivNIPf+Q8VGHjvxm7kXCxR4/oD6F46lvgSOHAsyEYS2KngdLUdv1cYKcxpyQkjc5KvOPYFLzN7Z+dGJy/Gzdfe4TNmno97GMndPovRV84cqml25X1UVmKPO+js1mhq4q6x860FD09EV1+cz+K/9wD7qyIPUbR0+V7/qEr8Pdeh+orrfp7GrlpulLWR2PLb2y1diRvxh8+F4VPmx35Q6s3PApLXQg+H0B5Ti8EvDuiX6e/+pUVq2Kv5/ZFH3rZ0tW4m4l2COitbJ/NbYWlFdZ/9216wpkWeuKJRfvvJ7l4QzhDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyj2OQhhvzkPIeYhhO105zr28G0IYTsVfuRBYQZC2C7EjKdn7RK7sJ+HaQ+lKHaZtwu7lWhkn5mk0GV0Fzabps4r6+xh+AqEsNdx+k8l9gAnIFMZYaNQH0c682I0mFdip6lMGP4KQthGhdPxmyunCwSYhIzuwjZlvBC/uRK7jO7CNkqHPjM5F/9x9YlgNLqHcq6MsAB1fPrFiep3rY6dRncvPAYhuKvTsV/zQef+MYedDyr9GDAGITii6cvpyeO1727kwI9f048FRyEEK+EJnJl8rN7fNL54oxwco5NnIAQX1GsZDafhat0bj44PwlMn9UeNQgiTUehB+Mit01/qWv+yPLohfQKoExDCWHrq0iR0sv7IXu3g+ARC9TyEMEn0ZHT1EmPjD23FwfExBOplfathCJEnWken5cXTk9MbvUlrscdklBd5oWumPX2kv6QPgDaZtqzVXuxkdHwYvtLR42EZ6UXqOog81n7s1faPP6k/0xNyIEokigJX4Yx+/Up0GnqbkceSiT1GS5UFvUwZYEx/5n36ixzW/8SgjPyiqeicrHC+sgGAmtGRvx1dMtph4NW+AiZycfiu2QTRAAAAAElFTkSuQmCC";var hf={name:"gnosis",id:"0x64",networkId:"100",namespace:"eip155",label:"Gnosis",fullName:"Gnosis Chain",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojZmZmfTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMzMS45IDU1Ni41YzIzLjUgMCA0Ni40LTcuOCA2NS0yMi4yTDI0OCAzODUuNGMtMzUuOSA0Ni40LTI3LjQgMTEyLjkgMTguOSAxNDguOCAxOC42IDE0IDQxLjUgMjEuOSA2NSAyMS45di40em00NDIuMy0xMDYuMWMwLTIzLjUtNy44LTQ2LjQtMjIuMi02NUw2MDMuMiA1MzQuMmM0Ni40IDM1LjkgMTEyLjkgMjcuNCAxNDguOC0xOC45IDE0LjMtMTguNiAyMi4yLTQxLjQgMjIuMi02NC45eiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im04NDkuMiAyODguNS02NS45IDY1LjljNTIuOSA2My42IDQ0LjcgMTU4LTE4LjkgMjExLjItNTUuNiA0Ni43LTEzNi42IDQ2LjctMTkyLjIgMEw1MDAgNjM3LjdsLTcyLjEtNzIuMWMtNjMuNiA1Mi45LTE1OCA0NC43LTIxMS4yLTE4LjktNDYuNy01NS42LTQ2LjctMTM2LjYgMC0xOTIuMmwtMzMuNi0zMy42LTMyLTMyLjNDMTEyLjMgMzUyLjIgOTIgNDI1LjMgOTIgNTAwYzAgMjI1LjIgMTgyLjggNDA4IDQwOCA0MDhzNDA4LTE4Mi44IDQwOC00MDhjLjMtNzQuNC0yMC42LTE0Ny44LTU4LjgtMjExLjV6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTc5NS4xIDIxOC4zYy0xNTUuNC0xNjIuOC00MTMuNi0xNjktNTc2LjQtMTMuNy00LjkgNC42LTkuNSA5LjEtMTMuNyAxMy43LTEwLjEgMTAuOC0xOS42IDIxLjktMjguNyAzMy4zTDUwMCA1NzUuNGwzMjMuOC0zMjMuOGMtOC44LTExLjctMTguNi0yMi44LTI4LjctMzMuM3pNNTAwIDE0NS4yYzk1LjMgMCAxODQuMSAzNi45IDI1MSAxMDMuOEw1MDAgNTAwIDI0OSAyNDljNjYuNi02Ny4yIDE1NS43LTEwMy44IDI1MS0xMDMuOHoiLz48L3N2Zz4K",logoBackgroundColor:"#406958",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojM2U2OTU3fTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMyNC4yIDU1OS4xYzI0LjYgMCA0OC41LTguMiA2Ny45LTIzLjJMMjM2LjUgMzgwLjJjLTM3LjUgNDguNS0yOC43IDExOC4xIDE5LjggMTU1LjYgMTkuNSAxNC43IDQzLjMgMjIuOSA2Ny45IDIyLjl2LjR6TTc4Ni43IDQ0OC4xYzAtMjQuNi04LjItNDguNS0yMy4yLTY3LjlMNjA3LjkgNTM1LjhjNDguNSAzNy41IDExOC4xIDI4LjcgMTU1LjYtMTkuOCAxNS0xOS40IDIzLjItNDMuMyAyMy4yLTY3Ljl6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0ibTg2NS4yIDI3OC44LTY4LjkgNjguOWM1NS4zIDY2LjYgNDYuOCAxNjUuMi0xOS44IDIyMC44LTU4LjQgNDguOC0xNDIuNyA0OC44LTIwMSAwTDUwMCA2NDRsLTc1LjQtNzUuNGMtNjYuNiA1NS4zLTE2NS4yIDQ2LjgtMjIwLjgtMTkuOC00OC44LTU4LjQtNDguOC0xNDIuNyAwLTIwMWwtMzUuMi0zNS4yLTMzLjQtMzMuOGMtNDAuNiA2Ni42LTYxLjggMTQzLTYxLjggMjIxLjIgMCAyMzUuNSAxOTEuMSA0MjYuNiA0MjYuNiA0MjYuNlM5MjYuNiA3MzUuNSA5MjYuNiA1MDBjLjQtNzcuOC0yMS41LTE1NC42LTYxLjQtMjIxLjJ6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTgwOC42IDIwNS41QzY0Ni4xIDM1LjEgMzc2LjEgMjguNyAyMDUuOCAxOTEuMWMtNS4xIDQuOC05LjkgOS42LTE0LjMgMTQuMy0xMC42IDExLjMtMjAuNSAyMi45LTMwIDM0LjhMNTAwIDU3OC44bDMzOC42LTMzOC42Yy05LjItMTIuMi0xOS41LTIzLjgtMzAtMzQuN3pNNTAwIDEyOWM5OS43IDAgMTkyLjUgMzguNiAyNjIuNSAxMDguNUw1MDAgNTAwIDIzNy41IDIzNy41QzMwNy4yIDE2Ny4yIDQwMC4zIDEyOSA1MDAgMTI5eiIvPjwvc3ZnPgo=",currency:{name:"xDAI",symbol:"xDAI",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:lf},wrapped:{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",logo:df},stables:{usd:["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"]},explorer:"https://gnosisscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://gnosisscan.io/tx/${e.id||e}`:t?`https://gnosisscan.io/token/${t}`:n?`https://gnosisscan.io/address/${n}`:void 0,endpoints:["https://rpc.gnosis.gateway.fm","https://rpc.gnosischain.com","https://gnosis.blockpi.network/v1/rpc/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"xDAI",name:"xDAI",decimals:18,logo:lf,type:"NATIVE"},{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",symbol:"WXDAI",name:"Wrapped XDAI",decimals:18,logo:df,type:"20"},{address:"0x4ECaBa5870353805a9F068101A40E0f32ed605C6",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",symbol:"GNO",name:"Gnosis",decimals:18,logo:"https://cdn.sushi.com/image/upload/f_auto,c_limit,w_16,q_auto/tokens/100/0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb.jpg",type:"20"},{address:"0xD057604A14982FE8D88c5fC25Aac3267eA142a08",symbol:"HOPR",name:"HOPR",decimals:18,logo:"https://hoprnet.org/assets/icons/hopr_icon.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};var pf={name:"optimism",id:"0xa",networkId:"10",namespace:"eip155",label:"Optimism",fullName:"Optimism",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00ODcuMSAzOTUuN2MtNS4yLTE1LjgtMTMuMi0zMS43LTI2LjQtNDIuMi0xMy4yLTEwLjUtMjYuNC0yMS4yLTQ0LjktMjYuNC0xOC41LTUuMi0zNy04LTU4LjEtOC00Ny41IDAtODcuMSAxMC41LTExNi4xIDM0LjQtMjkgMjMuOC00Ny41IDU4LjEtNjAuNyAxMDIuOS0yLjYgMTUuOC04IDI5LTEwLjUgNDQuOS0yLjYgMTMuMi01LjIgMjktOCA0Mi4yLTIuNiAyMy44LTIuNiA0Mi4yIDIuNiA2MC43IDUuMiAxNS44IDEzLjIgMzEuNyAyNi40IDQyLjIgMTMuMiAxMC41IDI2LjQgMjEuMiA0NC45IDI2LjQgMTguNCA1LjIgMzcgOCA1OC4xIDggNDcuNSAwIDg3LjEtMTAuNSAxMTYuMS0zNC40czQ3LjUtNTguMSA2MC43LTEwMi45YzIuNi0xMy4yIDUuMi0yOSAxMC41LTQyLjIgMi42LTEzLjIgNS4yLTI5IDgtNDQuOSAyLjgtMjMuOCAyLjgtNDQuOC0yLjYtNjAuN3ptLTkyLjQgNjAuOGMtMi42IDEzLjItNS4yIDI2LjQtOCAzOS41LTIuNiAxMy4yLTUuMiAyNi40LTEwLjUgNDIuMi01LjIgMjMuOC0xNS44IDM5LjUtMjkgNTAuMi0xMy4yIDEwLjUtMjkgMTUuOC00Ny41IDE1LjgtMTguNCAwLTMxLjctNS4yLTM5LjUtMTUuOC04LTEwLjUtMTAuNS0yOS01LjItNTAuMiAyLjYtMTUuOCA1LjItMjkgOC00Mi4yIDIuNi0xMy4yIDUuMi0yNi40IDEwLjUtMzkuNSA1LjItMjMuOCAxNS44LTM5LjUgMjktNTAuMiAxMy4yLTEwLjUgMjktMTUuOCA0Ny41LTE1LjggMTguNCAwIDMxLjcgNS4yIDM5LjUgMTUuOCA3LjkgMTAuNiAxMC41IDI2LjMgNS4yIDUwLjJ6bTQ0MC45LTY4LjZjLTUuMi0xNS44LTEzLjItMjYuNC0yMy44LTM3cy0yMy44LTE1LjgtNDIuMi0yMS4yYy0xNS44LTUuMi0zNC40LTgtNTUuNC04SDU3OS43Yy0yLjYgMC01LjIgMC0xMC41IDIuNi0yLjYgMi42LTUuMiA1LjItNS4yIDhsLTY4LjYgMzI3LjRjMCAyLjYgMCA4IDIuNiA4IDIuNiAyLjYgNS4yIDIuNiA4IDIuNmg2OC42YzIuNiAwIDggMCAxMC41LTIuNnM1LjItNS4yIDUuMi04bDIzLjgtMTEwLjloNjguNmM0Mi4yIDAgNzYuNi04IDEwMi45LTI2LjQgMjYuNC0xOC40IDQyLjItNDcuNSA1MC4yLTg0LjYgNS4xLTE4LjQgNS4xLTM2LjctLjItNDkuOXpNNzQzLjEgNDM4Yy0yLjYgMTUuOC0xMC41IDI2LjQtMjEuMiAzNC40cy0yMy44IDEwLjUtMzcgMTAuNWgtNTguMWwxOC40LTg5LjdoNjAuN2MxMy4yIDAgMjEuMiAyLjYgMjYuNCA1LjIgNS4yIDUuMiAxMC41IDEwLjUgMTAuNSAxNS44IDMgNS4yIDMgMTMuMi4zIDIzLjh6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",logoBackgroundColor:"#FF0420",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iMzk2LjYiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNNTAwIDg5Ni42YzIxOS4xIDAgMzk2LjYtMTc3LjYgMzk2LjYtMzk2LjZTNzE5LjEgMTAzLjQgNTAwIDEwMy40IDEwMy40IDI4MC45IDEwMy40IDUwMCAyODAuOSA4OTYuNiA1MDAgODk2LjZ6TTM1MC43IDYwOWMxMC45IDMuNCAyMi42IDUuMSAzNS4zIDUuMSAyOS4xIDAgNTIuNC02LjcgNjkuNi0yMC4yIDE3LjMtMTMuNyAyOS4zLTM0LjMgMzYuMi02MS44IDItOC42IDMuOS0xNy4zIDUuNy0yNS45IDItOC42IDMuNy0xNy40IDUuMS0yNi4yIDIuNC0xMy43IDItMjUuNi0xLjItMzUuOS0zLTEwLjItOC4zLTE4LjktMTYtMjUuOS03LjQtNy0xNi42LTEyLjMtMjcuNC0xNS43LTEwLjctMy42LTIyLjMtNS40LTM1LTUuNC0yOS4zIDAtNTIuNyA3LTY5LjkgMjEuMXMtMjkuMiAzNC43LTM1LjkgNjEuOGMtMiA4LjgtNCAxNy42LTYgMjYuMi0xLjggOC42LTMuNSAxNy4zLTUuMSAyNS45LTIuMiAxMy43LTEuOCAyNS42IDEuMiAzNS45IDMuMiAxMC4yIDguNSAxOC44IDE2IDI1LjYgNy40IDYuOCAxNi42IDExLjkgMjcuNCAxNS40em02Ny44LTQ4Yy04LjIgNi40LTE3LjggOS42LTI4LjYgOS42LTExLjEgMC0xOS0zLjItMjMuOC05LjYtNC44LTYuNC02LTE2LjctMy42LTMwLjcgMS42LTguOCAzLjItMTcuMiA0LjgtMjUgMS44LTcuOCAzLjgtMTYgNi0yNC40IDMuNC0xNC4xIDkuMS0yNC4zIDE3LjItMzAuNyA4LjItNi40IDE3LjgtOS42IDI4LjYtOS42czE4LjggMy4yIDIzLjggOS42IDYuMiAxNi43IDMuNiAzMC43Yy0xLjQgOC40LTMgMTYuNi00LjggMjQuNC0xLjYgNy44LTMuNSAxNi4yLTUuNyAyNS0zLjQgMTQtOS4yIDI0LjMtMTcuNSAzMC43em05MS43IDQ4YzEuMiAxLjQgMi44IDIuMSA0LjggMi4xaDQxYzIuMiAwIDQuMS0uNyA1LjctMi4xIDEuOC0xLjQgMi45LTMuMiAzLjMtNS40bDEzLjktNjZoNDAuN2MyNS45IDAgNDYuNS01LjUgNjEuOC0xNi42IDE1LjUtMTEuMSAyNS43LTI4LjEgMzAuNy01MS4yIDIuNC0xMS43IDIuMy0yMS44LS4zLTMwLjQtMi42LTguOC03LjItMTYuMi0xMy45LTIyLTYuNi01LjgtMTUtMTAuMS0yNS0xMy05LjgtMi44LTIwLjktNC4yLTMzLjItNC4yaC04MC4yYy0yIDAtMy45LjctNS43IDIuMS0xLjggMS40LTIuOSAzLjItMy4zIDUuNEw1MDkgNjAzLjVjLS40IDIuMiAwIDQgMS4yIDUuNXptMTExLjItMTEzLjFoLTM0LjdsMTEuOC01NGgzNi4yYzcuMiAwIDEyLjYgMS4yIDE2IDMuNiAzLjYgMi40IDUuNyA1LjYgNi4zIDkuNi42IDQgLjQgOC42LS42IDEzLjktMiA5LTYuMyAxNS44LTEzIDIwLjItNi40IDQuNS0xMy44IDYuNy0yMiA2Ljd6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmMDQyMCIvPjwvc3ZnPg==",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:qp.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:qp.wrapped.logo},stables:{usd:["0x94b008aA00579c1307B0EF2c499aD98a8ce58e58","0x7F5c764cBc14f9669B88837ca1490cCa17c31607"]},explorer:"https://optimistic.etherscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://optimistic.etherscan.io/tx/${e.id||e}`:t?`https://optimistic.etherscan.io/token/${t}`:n?`https://optimistic.etherscan.io/address/${n}`:void 0,endpoints:["https://optimism.blockpi.network/v1/rpc/public","https://optimism.meowrpc.com","https://optimism.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:qp.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:qp.wrapped.logo,type:"20"},{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x94b008aA00579c1307B0EF2c499aD98a8ce58e58/logo.png",type:"20"},{address:"0x7F5c764cBc14f9669B88837ca1490cCa17c31607",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x7F5c764cBc14f9669B88837ca1490cCa17c31607/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x4200000000000000000000000000000000000042",symbol:"OP",name:"Optimism",decimals:18,logo:"https://user-images.githubusercontent.com/1300064/219575413-d7990d69-1d21-44ef-a2b1-e9c682c79802.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};var ff={name:"base",id:"0x2105",networkId:"8453",namespace:"eip155",label:"Base",fullName:"Base",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguNiA4NDJDNjg4IDg0MiA4NDIgNjg4LjkgODQyIDQ5OS41UzY4OCAxNTcgNDk4LjYgMTU3QzMxOSAxNTcgMTcxLjIgMjk1LjEgMTU3IDQ3MC4zaDQ1My4xdjU3LjVIMTU3QzE3MiA3MDMuOSAzMTkgODQyIDQ5OC42IDg0MnoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#0052FF",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguOSA4NDVDNjkwLjEgODQ1IDg0NSA2OTAuMyA4NDUgNDk5LjVTNjkwLjEgMTU0IDQ5OC45IDE1NEMzMTcuNiAxNTQgMTY4LjggMjkzLjMgMTU0IDQ3MC41aDQ1Ny40djU4LjFIMTU0QzE2OC44IDcwNS44IDMxNy42IDg0NSA0OTguOSA4NDV6IiBmaWxsPSIjMDA1MmZmIi8+PC9zdmc+",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:qp.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:qp.wrapped.logo},stables:{usd:["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"]},explorer:"https://basescan.org",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://basescan.org/tx/${e.id||e}`:t?`https://basescan.org/token/${t}`:n?`https://basescan.org/address/${n}`:void 0,endpoints:["https://base.blockpi.network/v1/rpc/public","https://base.meowrpc.com","https://mainnet.base.org"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:qp.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:qp.wrapped.logo,type:"20"},{address:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",symbol:"USDbC",name:"USD Base Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const yf=[qp,Vp,ef,rf,Xp,af,cf,hf,pf,ff];var mf={ethereum:qp,bsc:Vp,polygon:ef,solana:rf,fantom:Xp,arbitrum:af,avalanche:cf,gnosis:hf,optimism:pf,base:ff,all:yf,findById:function(e){let t=e;t.match("0x0")&&(t=t.replace(/0x0+/,"0x"));let n=yf.find((e=>e.id&&e.id.toLowerCase()==t.toLowerCase()));return n},findByNetworkId:function(e){e=e.toString();let t=yf.find((t=>t.networkId==e));return t},findByName:function(e){return yf.find((t=>t.name==e))}},gf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function vf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function wf(e){var t={exports:{}};return e(t,t.exports),t.exports}for(var bf=function(e){var t=Lf(e),n=t[0],r=t[1];return 3*(n+r)/4-r},Mf=function(e){var t,n,r=Lf(e),i=r[0],o=r[1],a=new Tf(function(e,t,n){return 3*(t+n)/4-n}(0,i,o)),s=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)t=Nf[e.charCodeAt(n)]<<18|Nf[e.charCodeAt(n+1)]<<12|Nf[e.charCodeAt(n+2)]<<6|Nf[e.charCodeAt(n+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=255&t;2===o&&(t=Nf[e.charCodeAt(n)]<<2|Nf[e.charCodeAt(n+1)]>>4,a[s++]=255&t);1===o&&(t=Nf[e.charCodeAt(n)]<<10|Nf[e.charCodeAt(n+1)]<<4|Nf[e.charCodeAt(n+2)]>>2,a[s++]=t>>8&255,a[s++]=255&t);return a},Af=function(e){for(var t,n=e.length,r=n%3,i=[],o=16383,a=0,s=n-r;a<s;a+=o)i.push(xf(e,a,a+o>s?s:a+o));1===r?(t=e[n-1],i.push(Ef[t>>2]+Ef[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(Ef[t>>10]+Ef[t>>4&63]+Ef[t<<2&63]+"="));return i.join("")},Ef=[],Nf=[],Tf="undefined"!=typeof Uint8Array?Uint8Array:Array,If="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kf=0;kf<64;++kf)Ef[kf]=If[kf],Nf[If.charCodeAt(kf)]=kf;function Lf(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function xf(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(Ef[(i=r)>>18&63]+Ef[i>>12&63]+Ef[i>>6&63]+Ef[63&i]);return o.join("")}Nf["-".charCodeAt(0)]=62,Nf["_".charCodeAt(0)]=63;var Sf={byteLength:bf,toByteArray:Mf,fromByteArray:Af},jf=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+e[t+d],d+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)},Cf=function(e,t,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,d=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*u-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+p]=255&s,p+=f,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+p]=255&a,p+=f,a/=256,c-=8);e[n+p-f]|=128*y},Df=wf((function(e,t){const n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},t.INSPECT_MAX_BYTES=50;const r=2147483647;function i(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|h(e,t);let r=i(n);const a=r.write(e,t);a!==n&&(r=r.slice(0,a));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(H(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(H(e,ArrayBuffer)||e&&H(e.buffer,ArrayBuffer))return l(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(H(e,SharedArrayBuffer)||e&&H(e.buffer,SharedArrayBuffer)))return l(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);const a=function(e){if(o.isBuffer(e)){const t=0|d(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||G(e.length)?i(0):c(e);if("Buffer"===e.type&&Array.isArray(e.data))return c(e.data)}(e);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return s(e),i(e<0?0:0|d(e))}function c(e){const t=e.length<0?0:0|d(e.length),n=i(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function l(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,o.prototype),r}function d(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function h(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||H(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(i)return r?-1:Y(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function f(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){let o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let r=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-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(e,o+r)!==c(t,r)){n=!1;break}if(n)return o}return-1}function g(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(G(r))return a;e[n+a]=r}return a}function v(e,t,n,r){return V(Y(t,e.length-n),e,n,r)}function w(e,t,n,r){return V(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function b(e,t,n,r){return V(F(t),e,n,r)}function M(e,t,n,r){return V(function(e,t){let n,r,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?Sf.fromByteArray(e):Sf.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128==(192&n)&&(u=(31&t)<<6|63&n,u>127&&(o=u));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(u=(15&t)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&t)<<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(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}(r)}t.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){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(e,t,n){return a(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return function(e,t,n){return s(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}(e,t,n)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(H(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),H(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=o.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(H(t,Uint8Array))i+t.length>r.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},o.byteLength=h,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)f(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)f(this,t,t+3),f(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="";const n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,i){if(H(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const u=Math.min(a,s),c=this.slice(r,i),l=e.slice(t,n);for(let e=0;e<u;++e)if(c[e]!==l[e]){a=c[e],s=l[e];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return g(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":case"latin1":case"binary":return w(this,e,t,n);case"base64":return b(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,t,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 N=4096;function T(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function I(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function k(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=q[e[r]];return i}function L(e,t,n){const r=e.slice(t,n);let i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}function x(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function S(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function j(e,t,n,r,i){B(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function C(e,t,n,r,i){B(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),Cf(e,t,n,r,23,4),n+4}function z(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),Cf(e,t,n,r,52,8),n+8}o.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),jf(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),jf(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),jf(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),jf(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Z((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,e,t,n,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,e,t,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Z((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,n){return O(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return O(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=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===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const a=o.isBuffer(e)?e:o.from(e,r),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=a[i%s]}return this};const _={};function P(e,t,n){_[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function R(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function B(e,t,n,r,i,o){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===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}`:`>= ${t}${r} and <= ${n}${r}`,new _.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){U(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(r,i,o)}function U(e,t){if("number"!=typeof e)throw new _.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,n){if(Math.floor(e)!==e)throw U(e,n),new _.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new _.ERR_BUFFER_OUT_OF_BOUNDS;throw new _.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}P("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),P("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),P("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=R(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=R(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const Q=/[^+/0-9A-Za-z-_]/g;function Y(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=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((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(e){return Sf.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(Q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function H(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function G(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Z(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}})),Of=wf((function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Df.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);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 "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.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(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.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=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[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<e.length;i+=3)a=e[i]|e[i+1]<<8|e[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(e,t,n){this.length=Math.ceil((e.length-t)/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=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,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(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var d=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)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(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],h=[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],p=[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(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){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?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=h[e],l=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var y=f.modrn(l).toString(e);r=(f=f.idivn(l)).isZero()?y+r:d[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=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 e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.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,d=67108863&u,h=Math.min(c,t.length-1),p=Math.max(0,c-e.length+1);p<=h;p++){var f=c-p|0;l+=(a=(i=0|e.words[f])*(o=0|t.words[p])+d)/67108864|0,d=67108863&a}n.words[c]=0|d,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(e,t,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(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).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(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;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(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>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(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;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(e){return this.clone().isub(e)};var y=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],d=8191&l,h=l>>>13,p=0|a[1],f=8191&p,y=p>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],E=8191&A,N=A>>>13,T=0|a[5],I=8191&T,k=T>>>13,L=0|a[6],x=8191&L,S=L>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,_=O>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],W=8191&U,Q=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],de=8191&le,he=le>>>13,pe=0|s[9],fe=8191&pe,ye=pe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(d,W))|0)+((8191&(i=(i=Math.imul(d,Q))+Math.imul(h,W)|0))<<13)|0;c=((o=Math.imul(h,Q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(f,W),i=(i=Math.imul(f,Q))+Math.imul(y,W)|0,o=Math.imul(y,Q);var ge=(c+(r=r+Math.imul(d,F)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(h,F)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,W),i=(i=Math.imul(g,Q))+Math.imul(v,W)|0,o=Math.imul(v,Q),r=r+Math.imul(f,F)|0,i=(i=i+Math.imul(f,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,q)|0)+Math.imul(h,G)|0))<<13)|0;c=((o=o+Math.imul(h,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=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(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(f,G)|0,i=(i=i+Math.imul(f,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(h,J)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(E,W),i=(i=Math.imul(E,Q))+Math.imul(N,W)|0,o=Math.imul(N,Q),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(f,J)|0,i=(i=i+Math.imul(f,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(h,$)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(I,W),i=(i=Math.imul(I,Q))+Math.imul(k,W)|0,o=Math.imul(k,Q),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(f,$)|0,i=(i=i+Math.imul(f,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(h,ne)|0))<<13)|0;c=((o=o+Math.imul(h,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(x,W),i=(i=Math.imul(x,Q))+Math.imul(S,W)|0,o=Math.imul(S,Q),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|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(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(f,ne)|0,i=(i=i+Math.imul(f,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(C,W),i=(i=Math.imul(C,Q))+Math.imul(D,W)|0,o=Math.imul(D,Q),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(f,oe)|0,i=(i=i+Math.imul(f,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ee=(c+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(z,W),i=(i=Math.imul(z,Q))+Math.imul(_,W)|0,o=Math.imul(_,Q),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(f,ue)|0,i=(i=i+Math.imul(f,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(R,W),i=(i=Math.imul(R,Q))+Math.imul(B,W)|0,o=Math.imul(B,Q),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(_,F)|0,o=o+Math.imul(_,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(f,de)|0,i=(i=i+Math.imul(f,he)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,he)|0;var Te=(c+(r=r+Math.imul(d,fe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ye)|0)+Math.imul(h,fe)|0))<<13)|0;c=((o=o+Math.imul(h,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,V))+Math.imul(B,F)|0,o=Math.imul(B,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(k,ne)|0,o=o+Math.imul(k,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,de)|0,i=(i=i+Math.imul(g,he)|0)+Math.imul(v,de)|0,o=o+Math.imul(v,he)|0;var Ie=(c+(r=r+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ye)|0)+Math.imul(y,fe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(R,G),i=(i=Math.imul(R,q))+Math.imul(B,G)|0,o=Math.imul(B,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(x,ne)|0,i=(i=i+Math.imul(x,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,he)|0;var ke=(c+(r=r+Math.imul(g,fe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,fe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,X))+Math.imul(B,J)|0,o=Math.imul(B,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(k,ue)|0,o=o+Math.imul(k,ce)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,he)|0)+Math.imul(N,de)|0,o=o+Math.imul(N,he)|0;var Le=(c+(r=r+Math.imul(b,fe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,fe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,ee))+Math.imul(B,$)|0,o=Math.imul(B,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(I,de)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(k,de)|0,o=o+Math.imul(k,he)|0;var xe=(c+(r=r+Math.imul(E,fe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(N,fe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(R,ne),i=(i=Math.imul(R,re))+Math.imul(B,ne)|0,o=Math.imul(B,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,r=r+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,r=r+Math.imul(x,de)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,he)|0;var Se=(c+(r=r+Math.imul(I,fe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(k,fe)|0))<<13)|0;c=((o=o+Math.imul(k,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(R,oe),i=(i=Math.imul(R,ae))+Math.imul(B,oe)|0,o=Math.imul(B,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,he)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,he)|0;var je=(c+(r=r+Math.imul(x,fe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ye)|0)+Math.imul(S,fe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(R,ue),i=(i=Math.imul(R,ce))+Math.imul(B,ue)|0,o=Math.imul(B,ce),r=r+Math.imul(z,de)|0,i=(i=i+Math.imul(z,he)|0)+Math.imul(_,de)|0,o=o+Math.imul(_,he)|0;var Ce=(c+(r=r+Math.imul(C,fe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ye)|0)+Math.imul(D,fe)|0))<<13)|0;c=((o=o+Math.imul(D,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(R,de),i=(i=Math.imul(R,he))+Math.imul(B,de)|0,o=Math.imul(B,he);var De=(c+(r=r+Math.imul(z,fe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(_,fe)|0))<<13)|0;c=((o=o+Math.imul(_,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863;var Oe=(c+(r=Math.imul(R,fe))|0)+((8191&(i=(i=Math.imul(R,ye))+Math.imul(B,fe)|0))<<13)|0;return c=((o=Math.imul(B,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ee,u[8]=Ne,u[9]=Te,u[10]=Ie,u[11]=ke,u[12]=Le,u[13]=xe,u[14]=Se,u[15]=je,u[16]=Ce,u[17]=De,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.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,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,d=(0|e.words[l])*(0|t.words[c]),h=67108863&d;s=67108863&(h=h+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(h>>>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 g(e,t,n){return m(e,t,n)}Math.imul||(y=f),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?f(this,e,t):n<1024?m(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,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++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-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 d=0|this.words[c];this.words[c]=l<<26-o|d>>>o,l=d&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(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;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(e,t){var n=(this.length,e.length),r=this.clone(),o=e,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"!==t){(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 d=u-1;d>=0;d--){var h=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(h=Math.min(h/a|0,67108863),r._ishlnsubmul(o,h,d);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=h)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),d=t.clone();!t.isZero();){for(var h=0,p=1;0==(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var f=0,y=1;0==(r.words[0]&y)&&f<26;++f,y<<=1);if(f>0)for(r.iushrn(f);f-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,h=1;0==(r.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;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(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new N(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,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 A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){N.call(this,e),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 e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<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(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},r(b,w),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(M,w),r(A,w),r(E,w),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new M;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return v[e]=t,t},N.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},N.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},N.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},N.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},N.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},N.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},N.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},N.prototype.isqr=function(e){return this.imul(e,e.clone())},N.prototype.sqr=function(e){return this.mul(e,e)},N.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,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 d=this.pow(l,o),h=this.pow(e,o.addn(1).iushrn(1)),p=this.pow(e,o),f=a;0!==p.cmp(s);){for(var y=p,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<f);var g=this.pow(d,new i(1).iushln(f-m-1));h=h.redMul(g),d=g.redSqr(),p=p.redMul(d),f=m}return h},N.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},N.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var d=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},N.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)},r(T,N),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),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)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),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)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,gf)}));
|
|
9
|
+
e.exports=n=function(){return r},e.exports.__esModule=!0,e.exports.default=e.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(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function d(e,t,n,r){var i=t&&t.prototype instanceof f?t:f,o=Object.create(i.prototype),a=new I(r||[]);return o._invoke=function(e,t,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 L()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=E(a,n);if(s){if(s===p)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=h(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,a),o}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}r.wrap=d;var p={};function f(){}function y(){}function m(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,w=v&&v(v(k([])));w&&w!==i&&o.call(w,s)&&(g=w);var b=m.prototype=f.prototype=Object.create(g);function M(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,n){function r(i,a,s,u){var c=h(e[i],e,a);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==t(d)&&o.call(d,"__await")?n.resolve(d.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):n.resolve(d).then((function(e){l.value=e,s(l)}),(function(e){return r("throw",e,s,u)}))}u(c.arg)}var i;this._invoke=function(e,t){function o(){return new n((function(n,i){r(e,t,n,i)}))}return i=i?i.then(o,o):o()}}function E(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method))return p;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var r=h(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,p;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,p):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,p)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function k(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:L}}function L(){return{value:void 0,done:!0}}return y.prototype=m,l(b,"constructor",m),l(m,"constructor",y),y.displayName=l(m,c,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,l(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},r.awrap=function(e){return{__await:e}},M(A.prototype),l(A.prototype,u,(function(){return this})),r.AsyncIterator=A,r.async=function(e,t,n,i,o){void 0===o&&(o=Promise);var a=new A(d(e,t,n,i),o);return r.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.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(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},r.values=k,I.prototype={constructor:I,reset:function(e){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(T),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.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(e,t){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"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),p},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),p}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:k(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(Ho)),Ho.exports}var Jo,Xo={exports:{}};var Ko,$o={exports:{}};function ea(){return Ko||(Ko=1,function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports}($o)),$o.exports}var ta,na={exports:{}};function ra(){return ta||(ta=1,function(e){function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports}(na)),na.exports}var ia,oa,aa={exports:{}},sa={exports:{}};function ua(){return ia||(ia=1,function(e){function t(n,r){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(sa)),sa.exports}function ca(){return oa||(oa=1,function(e){var t=ua();e.exports=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),n&&t(e,n)},e.exports.__esModule=!0,e.exports.default=e.exports}(aa)),aa.exports}var la,da,ha={exports:{}},pa={exports:{}};function fa(){return la||(la=1,function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports}(pa)),pa.exports}function ya(){return da||(da=1,function(e){var t=qo().default,n=fa();e.exports=function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports}(ha)),ha.exports}var ma,ga={exports:{}};function va(){return ma||(ma=1,function(e){function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(ga)),ga.exports}var wa,ba={exports:{}};function Ma(){return wa||(wa=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||e,a),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}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 e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];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(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,o,a){var s=n?n+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,i),!0;case 5:return l.fn.call(l.context,t,r,i,o),!0;case 6:return l.fn.call(l.context,t,r,i,o,a),!0}for(c=1,u=new Array(d-1);c<d;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var h,p=l.length;for(c=0;c<p;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),d){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,r);break;case 4:l[c].fn.call(l[c].context,t,r,i);break;default:if(!u)for(h=1,u=new Array(d-1);h<d;h++)u[h-1]=arguments[h];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||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!==t||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(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(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,e.exports=s}(ba)),ba.exports}!function(e){var t=Wo.exports;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=t(function(){if(Vo)return Fo;Vo=1;var e=Zo()();Fo=e;try{regeneratorRuntime=e}catch(t){"object"===("undefined"==typeof globalThis?"undefined":_(globalThis))?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return Fo}()),r=t((Jo||(Jo=1,function(e){function t(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=e.apply(n,r);function s(e){t(a,i,o,s,u,"next",e)}function u(e){t(a,i,o,s,u,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports}(Xo)),Xo.exports)),i=t(qo()),o=t(ea()),a=t(ra()),s=t(ca()),u=t(ya()),c=t(va()),l=Ma();function d(e){var t=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(e){return!1}}();return function(){var n,r=(0,c.default)(e);if(t){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 h=function(e){(0,s.default)(p,e);var t,u,c,l,h=d(p);function p(e){var t,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,p);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,d=void 0===l?1e3:l,f=r.max_reconnects,y=void 0===f?5:f,m=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(t=h.call(this)).webSocketFactory=e,t.queue={},t.rpc_id=0,t.address=n,t.autoconnect=s,t.ready=!1,t.reconnect=c,t.reconnect_timer_id=void 0,t.reconnect_interval=d,t.max_reconnects=y,t.rest_options=m,t.current_reconnects=0,t.generate_request_id=i||function(){return++t.rpc_id},t.autoconnect&&t._connect(t.address,Object.assign({autoconnect:t.autoconnect,reconnect:t.reconnect,reconnect_interval:t.reconnect_interval,max_reconnects:t.max_reconnects},t.rest_options)),t}return(0,a.default)(p,[{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(e,t,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(e,t),u={jsonrpc:"2.0",method:e,params:t||null,id:s};o.socket.send(JSON.stringify(u),r,(function(e){if(e)return a(e);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 e(t){var r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.call("rpc.login",t);case 2:if(r=e.sent){e.next=5;break}throw new Error("authentication failed");case 5:return e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function e(){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.call("__listMethods");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(e,t){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:e,params:t||null};n.socket.send(JSON.stringify(o),(function(e){if(e)return i(e);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function e(t){var r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof t&&(t=[t]),e.next=3,this.call("rpc.on",t);case 3:if(r=e.sent,"string"!=typeof t||"ok"===r[t]){e.next=6;break}throw new Error("Failed subscribing to an event '"+t+"' with: "+r[t]);case 6:return e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"unsubscribe",value:(t=(0,r.default)(n.default.mark((function e(t){var r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof t&&(t=[t]),e.next=3,this.call("rpc.off",t);case 3:if(r=e.sent,"string"!=typeof t||"ok"===r[t]){e.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"close",value:function(e,t){this.socket.close(e||1e3,t)}},{key:"_connect",value:function(e,t){var n=this;clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(e){var t=e.data;t instanceof ArrayBuffer&&(t=Ee.from(t).toString());try{t=JSON.parse(t)}catch(e){return}if(t.notification&&n.listeners(t.notification).length){if(!Object.keys(t.params).length)return n.emit(t.notification);var r=[t.notification];if(t.params.constructor===Object)r.push(t.params);else for(var i=0;i<t.params.length;i++)r.push(t.params[i]);return Promise.resolve().then((function(){n.emit.apply(n,r)}))}if(!n.queue[t.id])return t.method&&t.params?Promise.resolve().then((function(){n.emit(t.method,t.params)})):void 0;"error"in t=="result"in t&&n.queue[t.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),n.queue[t.id].timeout&&clearTimeout(n.queue[t.id].timeout),t.error?n.queue[t.id].promise[1](t.error):n.queue[t.id].promise[0](t.result),delete n.queue[t.id]})),this.socket.addEventListener("error",(function(e){return n.emit("error",e)})),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(e,t)}),n.reconnect_interval)))}))}}]),p}(l.EventEmitter);e.default=h}(Uo);var Aa=j(Uo),Ea={};!function(e){var t=Wo.exports;Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e,t){return new u(e,t)};var n=t(ea()),r=t(ra()),i=t(ca()),o=t(ya()),a=t(va());function s(e){var t=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(e){return!1}}();return function(){var n,r=(0,a.default)(e);if(t){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(e){(0,i.default)(o,e);var t=s(o);function o(e,r,i){var a;return(0,n.default)(this,o),(a=t.call(this)).socket=new window.WebSocket(e,i),a.socket.onopen=function(){return a.emit("open")},a.socket.onmessage=function(e){return a.emit("message",e.data)},a.socket.onerror=function(e){return a.emit("error",e)},a.socket.onclose=function(e){a.emit("close",e.code,e.reason)},a}return(0,r.default)(o,[{key:"send",value:function(e,t,n){var r=n||t;try{this.socket.send(e),r()}catch(e){r(e)}}},{key:"close",value:function(e,t){this.socket.close(e,t)}},{key:"addEventListener",value:function(e,t,n){this.socket.addEventListener(e,t,n)}}]),o}(Ma().EventEmitter)}(Ea);for(var Na=j(Ea),Ta=[],Ia=[],ka=[],La=BigInt(0),xa=BigInt(1),Sa=BigInt(2),ja=BigInt(7),Ca=BigInt(256),Da=BigInt(113),Oa=0,za=xa,_a=1,Pa=0;Oa<24;Oa++){var Ra=[Pa,(2*_a+3*Pa)%5];_a=Ra[0],Pa=Ra[1],Ta.push(2*(5*Pa+_a)),Ia.push((Oa+1)*(Oa+2)/2%64);for(var Ba=La,Ua=0;Ua<7;Ua++)(za=(za<<xa^(za>>ja)*Da)%Ca)&Sa&&(Ba^=xa<<(xa<<BigInt(Ua))-xa);ka.push(Ba)}var Wa=$(Et.split(ka,!0),2),Qa=Wa[0],Ya=Wa[1],Fa=function(e,t,n){return n>32?Et.rotlBH(e,t,n):Et.rotlSH(e,t,n)},Va=function(e,t,n){return n>32?Et.rotlBL(e,t,n):Et.rotlSL(e,t,n)};var Ha=function(e){Y(n,mt);var t=X(n);function n(e,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(B(this,n),(o=t.call(this)).blockLen=e,o.suffix=r,o.outputLen=i,o.enableXOF=s,o.rounds=u,o.pos=0,o.posOut=0,o.finished=!1,o.destroyed=!1,ht.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 W(n,[{key:"keccak",value:function(){!function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,n=new Uint32Array(10),r=24-t;r<24;r++){for(var i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[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=Fa(u,c,1)^n[a],d=Va(u,c,1)^n[a+1],h=0;h<50;h+=10)e[o+h]^=l,e[o+h+1]^=d;for(var p=e[2],f=e[3],y=0;y<24;y++){var m=Ia[y],g=Fa(p,f,m),v=Va(p,f,m),w=Ta[y];p=e[w],f=e[w+1],e[w]=g,e[w+1]=v}for(var b=0;b<50;b+=10){for(var M=0;M<10;M++)n[M]=e[b+M];for(var A=0;A<10;A++)e[b+A]^=~n[(A+2)%10]&n[(A+4)%10]}e[0]^=Qa[r],e[1]^=Ya[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}},{key:"update",value:function(e){ht.exists(this);for(var t=this.blockLen,n=this.state,r=(e=yt(e)).length,i=0;i<r;){for(var o=Math.min(t-this.pos,r-i),a=0;a<o;a++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}},{key:"finish",value:function(){if(!this.finished){this.finished=!0;var e=this.state,t=this.suffix,n=this.pos,r=this.blockLen;e[n]^=t,0!=(128&t)&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}}},{key:"writeInto",value:function(e){ht.exists(this,!1),ht.bytes(e),this.finish();for(var t=this.state,n=this.blockLen,r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();var o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}},{key:"xofInto",value:function(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}},{key:"xof",value:function(e){return ht.number(e),this.xofInto(new Uint8Array(e))}},{key:"digestInto",value:function(e){if(ht.output(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}},{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(e){var t=this.blockLen,r=this.suffix,i=this.outputLen,o=this.rounds,a=this.enableXOF;return e||(e=new n(t,r,i,a,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=r,e.outputLen=i,e.enableXOF=a,e.destroyed=this.destroyed,e}}]),n}(),Ga=function(e,t,n){return gt((function(){return new Ha(t,e,n)}))};Ga(6,144,28),Ga(6,136,32),Ga(6,104,48),Ga(6,72,64),Ga(1,144,28);var qa=Ga(1,136,32);Ga(1,104,48),Ga(1,72,64);var Za=function(e,t,n){return r=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Ha(t,e,void 0===r.dkLen?n:r.dkLen,!0)},i=function(e,t){return r(t).update(yt(e)).digest()},o=r({}),i.outputLen=o.outputLen,i.blockLen=o.blockLen,i.create=function(e){return r(e)},i;var r,i,o};Za(31,168,16),Za(31,136,32);var Ja=function(e){Y(n,mt);var t=X(n);function n(e,r){var i;B(this,n),(i=t.call(this)).finished=!1,i.destroyed=!1,ht.hash(e);var o=yt(r);if(i.iHash=e.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?e.create().update(o).digest():o);for(var u=0;u<s.length;u++)s[u]^=54;i.iHash.update(s),i.oHash=e.create();for(var c=0;c<s.length;c++)s[c]^=106;return i.oHash.update(s),s.fill(0),i}return W(n,[{key:"update",value:function(e){return ht.exists(this),this.iHash.update(e),this}},{key:"digestInto",value:function(e){ht.exists(this),ht.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}},{key:"digest",value:function(){var e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}},{key:"_cloneInto",value:function(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));var t=this.oHash,n=this.iHash,r=this.finished,i=this.destroyed,o=this.blockLen,a=this.outputLen;return e.finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}},{key:"destroy",value:function(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}]),n}(),Xa=function(e,t,n){return new Ja(e,t).update(n).digest()};Xa.create=function(e,t){return new Ja(e,t)};var Ka=BigInt(0),$a=BigInt(1),es=BigInt(2),ts=BigInt(3),ns=BigInt(8),rs=Object.freeze({a:Ka,b:BigInt(7),P:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:$a,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee")}),is=function(e,t){return(e+t/es)/t},os=BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),as=function(e){var t=rs.n,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-$a*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,a=BigInt("0x100000000000000000000000000000000"),s=is(o*e,t),u=is(-r*e,t),c=_s(e-s*n-u*i,t),l=_s(-s*r-u*o,t),d=c>a,h=l>a;if(d&&(c=t-c),h&&(l=t-l),c>a||l>a)throw new Error("splitScalarEndo: Endomorphism failed, k="+e);return{k1neg:d,k1:c,k2neg:h,k2:l}},ss=32,us=32,cs=ss+1,ls=2*ss+1;function ds(e){var t=rs.a,n=rs.b,r=_s(e*e),i=_s(r*e);return _s(i+t*e+n)}var hs=rs.a===Ka,ps=function(e){Y(n,q(Error));var t=X(n);function n(e){return B(this,n),t.call(this,e)}return W(n)}();function fs(e){if(!(e instanceof ys))throw new TypeError("JacobianPoint expected")}var ys=function(){function e(t,n,r){B(this,e),this.x=t,this.y=n,this.z=r}return W(e,[{key:"equals",value:function(e){fs(e);var t=this.x,n=this.y,r=this.z,i=e.x,o=e.y,a=e.z,s=_s(r*r),u=_s(a*a),c=_s(t*u),l=_s(i*s),d=_s(_s(n*a)*u),h=_s(_s(o*r)*s);return c===l&&d===h}},{key:"negate",value:function(){return new e(this.x,_s(-this.y),this.z)}},{key:"double",value:function(){var t=this.x,n=this.y,r=this.z,i=_s(t*t),o=_s(n*n),a=_s(o*o),s=t+o,u=_s(es*(_s(s*s)-i-a)),c=_s(ts*i),l=_s(c*c),d=_s(l-es*u);return new e(d,_s(c*(u-d)-ns*a),_s(es*n*r))}},{key:"add",value:function(t){fs(t);var n=this.x,r=this.y,i=this.z,o=t.x,a=t.y,s=t.z;if(o===Ka||a===Ka)return this;if(n===Ka||r===Ka)return t;var u=_s(i*i),c=_s(s*s),l=_s(n*c),d=_s(o*u),h=_s(_s(r*s)*c),p=_s(_s(a*i)*u),f=_s(d-l),y=_s(p-h);if(f===Ka)return y===Ka?this.double():e.ZERO;var m=_s(f*f),g=_s(f*m),v=_s(l*m),w=_s(y*y-g-es*v);return new e(w,_s(y*(v-w)-h*g),_s(i*s*f))}},{key:"subtract",value:function(e){return this.add(e.negate())}},{key:"multiplyUnsafe",value:function(t){var n=e.ZERO;if("bigint"==typeof t&&t===Ka)return n;var r=zs(t);if(r===$a)return this;if(!hs){for(var i=n,o=this;r>Ka;)r&$a&&(i=i.add(o)),o=o.double(),r>>=$a;return i}for(var a=as(r),s=a.k1neg,u=a.k1,c=a.k2neg,l=a.k2,d=n,h=n,p=this;u>Ka||l>Ka;)u&$a&&(d=d.add(p)),l&$a&&(h=h.add(p)),p=p.double(),u>>=$a,l>>=$a;return s&&(d=d.negate()),c&&(h=h.negate()),h=new e(_s(h.x*os),h.y,h.z),d.add(h)}},{key:"precomputeWindow",value:function(e){for(var t=hs?128/e+1:256/e+1,n=[],r=this,i=r,o=0;o<t;o++){i=r,n.push(i);for(var a=1;a<Math.pow(2,e-1);a++)i=i.add(r),n.push(i);r=i.double()}return n}},{key:"wNAF",value:function(t,n){!n&&this.equals(e.BASE)&&(n=vs.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&&gs.get(n);i||(i=this.precomputeWindow(r),n&&1!==r&&(i=e.normalizeZ(i),gs.set(n,i)));for(var o=e.ZERO,a=e.BASE,s=1+(hs?128/r:256/r),u=Math.pow(2,r-1),c=BigInt(Math.pow(2,r)-1),l=Math.pow(2,r),d=BigInt(r),h=0;h<s;h++){var p=h*u,f=Number(t&c);t>>=d,f>u&&(f-=l,t+=$a);var y=p,m=p+Math.abs(f)-1,g=h%2!=0,v=f<0;0===f?a=a.add(ms(g,i[y])):o=o.add(ms(v,i[m]))}return{p:o,f:a}}},{key:"multiply",value:function(t,n){var r,i,o=zs(t);if(hs){var a=as(o),s=a.k1neg,u=a.k1,c=a.k2neg,l=a.k2,d=this.wNAF(u,n),h=d.p,p=d.f,f=this.wNAF(l,n),y=f.p,m=f.f;h=ms(s,h),y=new e(_s((y=ms(c,y)).x*os),y.y,y.z),r=h.add(y),i=p.add(m)}else{var g=this.wNAF(o,n);r=g.p,i=g.f}return e.normalizeZ([r,i])[0]}},{key:"toAffine",value:function(t){var n=this.x,r=this.y,i=this.z,o=this.equals(e.ZERO);null==t&&(t=o?ns:Rs(i));var a=t,s=_s(a*a),u=_s(s*a),c=_s(n*s),l=_s(r*u),d=_s(i*a);if(o)return vs.ZERO;if(d!==$a)throw new Error("invZ was invalid");return new vs(c,l)}}],[{key:"fromAffine",value:function(t){if(!(t instanceof vs))throw new TypeError("JacobianPoint#fromAffine: expected Point");return t.equals(vs.ZERO)?e.ZERO:new e(t.x,t.y,$a)}},{key:"toAffineBatch",value:function(e){var t=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rs.P,n=new Array(e.length),r=e.reduce((function(e,r,i){return r===Ka?e:(n[i]=e,_s(e*r,t))}),$a),i=Rs(r,t);return e.reduceRight((function(e,r,i){return r===Ka?e:(n[i]=_s(e*n[i],t),_s(e*r,t))}),i),n}(e.map((function(e){return e.z})));return e.map((function(e,n){return e.toAffine(t[n])}))}},{key:"normalizeZ",value:function(t){return e.toAffineBatch(t).map(e.fromAffine)}}]),e}();function ms(e,t){var n=t.negate();return e?n:t}ys.BASE=new ys(rs.Gx,rs.Gy,$a),ys.ZERO=new ys(Ka,$a,Ka);var gs=new WeakMap,vs=function(){function e(t,n){B(this,e),this.x=t,this.y=n}return W(e,[{key:"_setWindowSize",value:function(e){this._WINDOW_SIZE=e,gs.delete(this)}},{key:"hasEvenY",value:function(){return this.y%es===Ka}},{key:"toRawBytes",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Cs(this.toHex(e))}},{key:"toHex",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=Ls(this.x);if(e){var n=this.hasEvenY()?"02":"03";return"".concat(n).concat(t)}return"04".concat(t).concat(Ls(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 e="Point is not on elliptic curve",t=this.x,n=this.y;if(!Qs(t)||!Qs(n))throw new Error(e);var r=_s(n*n);if(_s(r-ds(t))!==Ka)throw new Error(e)}},{key:"equals",value:function(e){return this.x===e.x&&this.y===e.y}},{key:"negate",value:function(){return new e(this.x,_s(-this.y))}},{key:"double",value:function(){return ys.fromAffine(this).double().toAffine()}},{key:"add",value:function(e){return ys.fromAffine(this).add(ys.fromAffine(e)).toAffine()}},{key:"subtract",value:function(e){return this.add(e.negate())}},{key:"multiply",value:function(e){return ys.fromAffine(this).multiply(e,this).toAffine()}},{key:"multiplyAndAddUnsafe",value:function(t,n,r){var i=ys.fromAffine(this),o=n===Ka||n===$a||this!==e.BASE?i.multiplyUnsafe(n):i.multiply(n),a=ys.fromAffine(t).multiplyUnsafe(r),s=o.add(a);return s.equals(ys.ZERO)?void 0:s.toAffine()}}],[{key:"fromCompressedHex",value:function(t){var n=32===t.length,r=Ds(n?t:t.subarray(1));if(!Qs(r))throw new Error("Point is not on curve");var i=function(e){var t=rs.P,n=BigInt(6),r=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),s=BigInt(88),u=e*e*e%t,c=u*u*e%t,l=Ps(c,ts)*c%t,d=Ps(l,ts)*c%t,h=Ps(d,es)*u%t,p=Ps(h,r)*h%t,f=Ps(p,i)*p%t,y=Ps(f,a)*f%t,m=Ps(y,s)*y%t,g=Ps(m,a)*f%t,v=Ps(g,ts)*c%t,w=Ps(v,o)*p%t,b=Ps(w,n)*u%t,M=Ps(b,es),A=M*M%t;if(A!==e)throw new Error("Cannot find square root");return M}(ds(r)),o=(i&$a)===$a;n?o&&(i=_s(-i)):1==(1&t[0])!==o&&(i=_s(-i));var a=new e(r,i);return a.assertValidity(),a}},{key:"fromUncompressedHex",value:function(t){var n=new e(Ds(t.subarray(1,ss+1)),Ds(t.subarray(ss+1,2*ss+1)));return n.assertValidity(),n}},{key:"fromHex",value:function(e){var t=Os(e),n=t.length,r=t[0];if(n===ss)return this.fromCompressedHex(t);if(n===cs&&(2===r||3===r))return this.fromCompressedHex(t);if(n===ls&&4===r)return this.fromUncompressedHex(t);throw new Error("Point.fromHex: received invalid point. Expected 32-".concat(cs," compressed bytes or ").concat(ls," uncompressed bytes, not ").concat(n))}},{key:"fromPrivateKey",value:function(t){return e.BASE.multiply(Fs(t))}},{key:"fromSignature",value:function(t,n,r){var i=function(e){if(e instanceof Ms)return e.assertValidity(),e;try{return Ms.fromDER(e)}catch(t){return Ms.fromCompact(e)}}(n),o=i.r,a=i.s;if(![0,1,2,3].includes(r))throw new Error("Cannot recover: invalid recovery bit");var s=Bs(Os(t)),u=rs.n,c=2===r||3===r?o+u:o,l=Rs(c,u),d=_s(-s*l,u),h=_s(a*l,u),p=1&r?"03":"02",f=e.fromHex(p+Ls(c)),y=e.BASE.multiplyAndAddUnsafe(f,d,h);if(!y)throw new Error("Cannot recover signature: point at infinify");return y.assertValidity(),y}}]),e}();function ws(e){return Number.parseInt(e[0],16)>=8?"00"+e:e}function bs(e){if(e.length<2||2!==e[0])throw new Error("Invalid signature integer tag: ".concat(Ns(e)));var t=e[1],n=e.subarray(2,t+2);if(!t||n.length!==t)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:Ds(n),left:e.subarray(t+2)}}vs.BASE=new vs(rs.Gx,rs.Gy),vs.ZERO=new vs(Ka,Ka);var Ms=function(){function e(t,n){B(this,e),this.r=t,this.s=n,this.assertValidity()}return W(e,[{key:"assertValidity",value:function(){var e=this.r,t=this.s;if(!Ws(e))throw new Error("Invalid Signature: r must be 0 < r < n");if(!Ws(t))throw new Error("Invalid Signature: s must be 0 < s < n")}},{key:"hasHighS",value:function(){var e=rs.n>>$a;return this.s>e}},{key:"normalizeS",value:function(){return this.hasHighS()?new e(this.r,_s(-this.s,rs.n)):this}},{key:"toDERRawBytes",value:function(){return Cs(this.toDERHex())}},{key:"toDERHex",value:function(){var e=ws(Ss(this.s)),t=ws(Ss(this.r)),n=e.length/2,r=t.length/2,i=Ss(n),o=Ss(r),a=Ss(r+n+4);return"30".concat(a,"02").concat(o).concat(t,"02").concat(i).concat(e)}},{key:"toRawBytes",value:function(){return this.toDERRawBytes()}},{key:"toHex",value:function(){return this.toDERHex()}},{key:"toCompactRawBytes",value:function(){return Cs(this.toCompactHex())}},{key:"toCompactHex",value:function(){return Ls(this.r)+Ls(this.s)}}],[{key:"fromCompact",value:function(t){var n=t instanceof Uint8Array,r="Signature.fromCompact";if("string"!=typeof t&&!n)throw new TypeError("".concat(r,": Expected string or Uint8Array"));var i=n?Ns(t):t;if(128!==i.length)throw new Error("".concat(r,": Expected 64-byte hex"));return new e(js(i.slice(0,64)),js(i.slice(64,128)))}},{key:"fromDER",value:function(t){var n=t instanceof Uint8Array;if("string"!=typeof t&&!n)throw new TypeError("Signature.fromDER: Expected string or Uint8Array");var r=function(e){if(e.length<2||48!=e[0])throw new Error("Invalid signature tag: ".concat(Ns(e)));if(e[1]!==e.length-2)throw new Error("Invalid signature: incorrect length");var t=bs(e.subarray(2)),n=t.data,r=bs(t.left),i=r.data,o=r.left;if(o.length)throw new Error("Invalid signature: left bytes after parsing: ".concat(Ns(o)));return{r:n,s:i}}(n?t:Cs(t));return new e(r.r,r.s)}},{key:"fromHex",value:function(e){return this.fromDER(e)}}]),e}();function As(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(!t.every((function(e){return e instanceof Uint8Array})))throw new Error("Uint8Array list expected");if(1===t.length)return t[0];for(var r=t.reduce((function(e,t){return e+t.length}),0),i=new Uint8Array(r),o=0,a=0;o<t.length;o++){var s=t[o];i.set(s,a),a+=s.length}return i}var Es=Array.from({length:256},(function(e,t){return t.toString(16).padStart(2,"0")}));function Ns(e){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");for(var t="",n=0;n<e.length;n++)t+=Es[e[n]];return t}var Ts,Is,ks=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");function Ls(e){if("bigint"!=typeof e)throw new Error("Expected bigint");if(!(Ka<=e&&e<ks))throw new Error("Expected number 0 <= n < 2^256");return e.toString(16).padStart(64,"0")}function xs(e){var t=Cs(Ls(e));if(32!==t.length)throw new Error("Error: expected 32 bytes");return t}function Ss(e){var t=e.toString(16);return 1&t.length?"0".concat(t):t}function js(e){if("string"!=typeof e)throw new TypeError("hexToNumber: expected string, got "+_(e));return BigInt("0x".concat(e))}function Cs(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+_(e));if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex"+e.length);for(var t=new Uint8Array(e.length/2),n=0;n<t.length;n++){var r=2*n,i=e.slice(r,r+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[n]=o}return t}function Ds(e){return js(Ns(e))}function Os(e){return e instanceof Uint8Array?Uint8Array.from(e):Cs(e)}function zs(e){if("number"==typeof e&&Number.isSafeInteger(e)&&e>0)return BigInt(e);if("bigint"==typeof e&&Ws(e))return e;throw new TypeError("Expected valid private scalar: 0 < scalar < curve.n")}function _s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rs.P,n=e%t;return n>=Ka?n:t+n}function Ps(e,t){for(var n=rs.P,r=e;t-- >Ka;)r*=r,r%=n;return r}function Rs(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rs.P;if(e===Ka||t<=Ka)throw new Error("invert: expected positive integers, got n=".concat(e," mod=").concat(t));for(var n=_s(e,t),r=t,i=Ka,o=$a;n!==Ka;){var a=r%n,s=i-o*(r/n);r=n,n=a,i=o,o=s}if(r!==$a)throw new Error("invert: does not exist");return _s(i,t)}function Bs(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=function(e){var t=8*e.length-8*us,n=Ds(e);return t>0?n>>BigInt(t):n}(e);if(t)return n;var r=rs.n;return n>=r?n-r:n}var Us=function(){function e(t,n){if(B(this,e),this.hashLen=t,this.qByteLen=n,"number"!=typeof t||t<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(t).fill(1),this.k=new Uint8Array(t).fill(0),this.counter=0}var t,n;return W(e,[{key:"hmac",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return $s.hmacSha256.apply($s,[this.k].concat(t))}},{key:"hmacSync",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Is.apply(void 0,[this.k].concat(t))}},{key:"checkSync",value:function(){if("function"!=typeof Is)throw new ps("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=R(z().mark((function e(){var t,n=arguments;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]?n[0]:new Uint8Array,e.next=3,this.hmac(this.v,Uint8Array.from([0]),t);case 3:return this.k=e.sent,e.next=6,this.hmac(this.v);case 6:if(this.v=e.sent,0!==t.length){e.next=9;break}return e.abrupt("return");case 9:return e.next=11,this.hmac(this.v,Uint8Array.from([1]),t);case 11:return this.k=e.sent,e.next=14,this.hmac(this.v);case 14:this.v=e.sent;case 15:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"reseedSync",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array;this.checkSync(),this.k=this.hmacSync(this.v,Uint8Array.from([0]),e),this.v=this.hmacSync(this.v),0!==e.length&&(this.k=this.hmacSync(this.v,Uint8Array.from([1]),e),this.v=this.hmacSync(this.v))}},{key:"generate",value:(t=R(z().mark((function e(){var t,n,r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.incr(),t=0,n=[];case 3:if(!(t<this.qByteLen)){e.next=12;break}return e.next=6,this.hmac(this.v);case 6:this.v=e.sent,r=this.v.slice(),n.push(r),t+=this.v.length,e.next=3;break;case 12:return e.abrupt("return",As.apply(void 0,n));case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"generateSync",value:function(){this.checkSync(),this.incr();for(var e=0,t=[];e<this.qByteLen;){this.v=this.hmacSync(this.v);var n=this.v.slice();t.push(n),e+=this.v.length}return As.apply(void 0,t)}}]),e}();function Ws(e){return Ka<e&&e<rs.n}function Qs(e){return Ka<e&&e<rs.P}function Ys(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=rs.n,o=Bs(e,!0);if(Ws(o)){var a=Rs(o,i),s=vs.BASE.multiply(o),u=_s(s.x,i);if(u!==Ka){var c=_s(a*_s(t+n*u,i),i);if(c!==Ka){var l=new Ms(u,c),d=(s.x===l.r?0:2)|Number(s.y&$a);return r&&l.hasHighS()&&(l=l.normalizeS(),d^=1),{sig:l,recovery:d}}}}}function Fs(e){var t;if("bigint"==typeof e)t=e;else if("number"==typeof e&&Number.isSafeInteger(e)&&e>0)t=BigInt(e);else if("string"==typeof e){if(e.length!==2*us)throw new Error("Expected 32 bytes of private key");t=js(e)}else{if(!(e instanceof Uint8Array))throw new TypeError("Expected valid private key");if(e.length!==us)throw new Error("Expected 32 bytes of private key");t=Ds(e)}if(!Ws(t))throw new Error("Expected private key: 0 < key < n");return t}function Vs(e){return Ds(e.length>ss?e.slice(0,ss):e)}function Hs(e){var t=Vs(e),n=_s(t,rs.n);return Gs(n<Ka?t:n)}function Gs(e){return xs(e)}function qs(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=function(e,t,n){if(null==e)throw new Error('sign: expected valid message hash, not "'.concat(e,'"'));var r=Os(e),i=Fs(t),o=[Gs(i),Hs(r)];if(null!=n){!0===n&&(n=$s.randomBytes(ss));var a=Os(n);if(a.length!==ss)throw new Error("sign: Expected ".concat(ss," bytes of extra data"));o.push(a)}return{seed:As.apply(void 0,o),m:Vs(r),d:i}}(e,t,r.extraEntropy),o=i.seed,a=i.m,s=i.d,u=new Us(32,us);for(u.reseedSync(o);!(n=Ys(u.generateSync(),a,s,r.canonical));)u.reseedSync();return function(e,t){var n=e.sig,r=e.recovery,i=Object.assign({canonical:!0,der:!0},t),o=i.der,a=i.recovered,s=o?n.toDERRawBytes():n.toCompactRawBytes();return a?[s,r]:s}(n,r)}vs.BASE._setWindowSize(8);var Zs,Js,Xs={node:zt,web:"object"===("undefined"==typeof self?"undefined":_(self))&&"crypto"in self?self.crypto:void 0},Ks={},$s={bytesToHex:Ns,hexToBytes:Cs,concatBytes:As,mod:_s,invert:Rs,isValidPrivateKey:function(e){try{return Fs(e),!0}catch(e){return!1}},_bigintTo32Bytes:xs,_normalizePrivateKey:Fs,hashToPrivateKey:function(e){e=Os(e);var t=us+8;if(e.length<t||e.length>1024)throw new Error("Expected valid bytes of private key as per FIPS 186");return xs(_s(Ds(e),rs.n-$a)+$a)},randomBytes:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:32;if(Xs.web)return Xs.web.getRandomValues(new Uint8Array(e));if(Xs.node){var t=Xs.node.randomBytes;return Uint8Array.from(t(e))}throw new Error("The environment doesn't have randomBytes function")},randomPrivateKey:function(){return $s.hashToPrivateKey($s.randomBytes(us+8))},precompute:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vs.BASE,n=t===vs.BASE?t:new vs(t.x,t.y);return n._setWindowSize(e),n.multiply(ts),n},sha256:function(){var e=R(z().mark((function e(){var t,n,r,i,o,a,s=arguments;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=s.length,n=new Array(t),r=0;r<t;r++)n[r]=s[r];if(!Xs.web){e.next=8;break}return e.next=4,Xs.web.subtle.digest("SHA-256",As.apply(void 0,n));case 4:return i=e.sent,e.abrupt("return",new Uint8Array(i));case 8:if(!Xs.node){e.next=15;break}return o=Xs.node.createHash,a=o("sha256"),n.forEach((function(e){return a.update(e)})),e.abrupt("return",Uint8Array.from(a.digest()));case 15:throw new Error("The environment doesn't have sha256 function");case 16:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),hmacSha256:(Js=R(z().mark((function e(t){var n,r,i,o,a,s,u,c,l=arguments;return z().wrap((function(e){for(;;)switch(e.prev=e.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(!Xs.web){e.next=12;break}return e.next=4,Xs.web.subtle.importKey("raw",t,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]);case 4:return o=e.sent,a=As.apply(void 0,r),e.next=8,Xs.web.subtle.sign("HMAC",o,a);case 8:return s=e.sent,e.abrupt("return",new Uint8Array(s));case 12:if(!Xs.node){e.next=19;break}return u=Xs.node.createHmac,c=u("sha256",t),r.forEach((function(e){return c.update(e)})),e.abrupt("return",Uint8Array.from(c.digest()));case 19:throw new Error("The environment doesn't have hmac-sha256 function");case 20:case"end":return e.stop()}}),e)}))),function(e){return Js.apply(this,arguments)}),sha256Sync:void 0,hmacSha256Sync:void 0,taggedHash:(Zs=R(z().mark((function e(t){var n,r,i,o,a,s=arguments;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(n=Ks[t])){e.next=7;break}return e.next=4,$s.sha256(Uint8Array.from(t,(function(e){return e.charCodeAt(0)})));case 4:r=e.sent,n=As(r,r),Ks[t]=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 e.abrupt("return",$s.sha256.apply($s,[n].concat(o)));case 9:case"end":return e.stop()}}),e)}))),function(e){return Zs.apply(this,arguments)}),taggedHashSync:function(e){if("function"!=typeof Ts)throw new ps("sha256Sync is undefined, you need to set it");var t=Ks[e];if(void 0===t){var n=Ts(Uint8Array.from(e,(function(e){return e.charCodeAt(0)})));t=As(n,n),Ks[e]=t}for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return Ts.apply(void 0,[t].concat(i))},_JacobianPoint:ys};Object.defineProperties($s,{sha256Sync:{configurable:!1,get:function(){return Ts},set:function(e){Ts||(Ts=e)}},hmacSha256Sync:{configurable:!1,get:function(){return Is},set:function(e){Is||(Is=e)}}});var eu=["commitment"],tu=["encoding"],nu=["commitment"],ru=["commitment"];Cn.sha512Sync=function(){var e;return Ot((e=Cn).concatBytes.apply(e,arguments))};var iu=Cn.randomPrivateKey,ou=function(){var e=Cn.randomPrivateKey(),t=au(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),{publicKey:t,secretKey:n}},au=xn.getPublicKey;function su(e){try{return tn.fromHex(e,!0),!0}catch(e){return!1}}var uu=function(e,t){return xn.sign(e,t.slice(0,32))},cu=xn.verify,lu=function(e){return Ee.isBuffer(e)?e:e instanceof Uint8Array?Ee.from(e.buffer,e.byteOffset,e.byteLength):Ee.from(e)},du=function(){function e(t){B(this,e),Object.assign(this,t)}return W(e,[{key:"encode",value:function(){return Ee.from(kr(pu,this))}}],[{key:"decode",value:function(e){return Sr(pu,this,e)}},{key:"decodeUnchecked",value:function(e){return fr(pu,this,e)}}]),e}(),hu=function(e){Y(n,du);var t=X(n);function n(e){var r;if(B(this,n),(r=t.call(this,e)).enum="",1!==Object.keys(e).length)throw new Error("Enum can only take single value");return Object.keys(e).map((function(e){r.enum=e})),r}return W(n)}(),pu=new Map,fu=32;var yu=1,mu=function(e,t){Y(a,du);var n,r,i,o=X(a);function a(e){var t;if(B(this,a),(t=o.call(this,{}))._bn=void 0,function(e){return void 0!==e._bn}(e))t._bn=e._bn;else{if("string"==typeof e){var n=Bn.decode(e);if(n.length!=fu)throw new Error("Invalid public key input");t._bn=new zn(n)}else t._bn=new zn(e);if(t._bn.byteLength()>fu)throw new Error("Invalid public key input")}return t}return W(a,[{key:"equals",value:function(e){return this._bn.eq(e._bn)}},{key:"toBase58",value:function(){return Bn.encode(this.toBytes())}},{key:"toJSON",value:function(){return this.toBase58()}},{key:"toBytes",value:function(){var e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}},{key:"toBuffer",value:function(){var e=this._bn.toArrayLike(Ee);if(e.length===fu)return e;var t=Ee.alloc(32);return e.copy(t,32-e.length),t}},{key:t,get:function(){return"PublicKey(".concat(this.toString(),")")}},{key:"toString",value:function(){return this.toBase58()}}],[{key:"unique",value:function(){var e=new a(yu);return yu+=1,new a(e.toBuffer())}},{key:"createWithSeed",value:(i=R(z().mark((function e(t,n,r){var i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Ee.concat([t.toBuffer(),Ee.from(n),r.toBuffer()]),o=Hn(i),e.abrupt("return",new a(o));case 3:case"end":return e.stop()}}),e)}))),function(e,t,n){return i.apply(this,arguments)})},{key:"createProgramAddressSync",value:function(e,t){var n=Ee.alloc(0);e.forEach((function(e){if(e.length>32)throw new TypeError("Max seed length exceeded");n=Ee.concat([n,lu(e)])})),n=Ee.concat([n,t.toBuffer(),Ee.from("ProgramDerivedAddress")]);var r=Hn(n);if(su(r))throw new Error("Invalid seeds, address must fall off the curve");return new a(r)}},{key:"createProgramAddress",value:(r=R(z().mark((function e(t,n){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.createProgramAddressSync(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"findProgramAddressSync",value:function(e,t){for(var n,r=255;0!=r;){try{var i=e.concat(Ee.from([r]));n=this.createProgramAddressSync(i,t)}catch(e){if(e instanceof TypeError)throw e;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}},{key:"findProgramAddress",value:(n=R(z().mark((function e(t,n){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.findProgramAddressSync(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"isOnCurve",value:function(e){return su(new a(e).toBytes())}}]),a}(0,Symbol.toStringTag);mu.default=new mu("11111111111111111111111111111111"),pu.set(mu,{kind:"struct",fields:[["_bn","u256"]]});var gu=function(){function e(t){if(B(this,e),this._publicKey=void 0,this._secretKey=void 0,t){var n=lu(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=n.slice(32,64),this._secretKey=n.slice(0,32)}else this._secretKey=lu(iu()),this._publicKey=lu(au(this._secretKey))}return W(e,[{key:"publicKey",get:function(){return new mu(this._publicKey)}},{key:"secretKey",get:function(){return Ee.concat([this._secretKey,this._publicKey],64)}}]),e}(),vu=new mu("BPFLoader1111111111111111111111111111111111"),wu=1232,bu=127,Mu=64,Au=function(e){Y(n,q(Error));var t=X(n);function n(e){var r;return B(this,n),(r=t.call(this,"Signature ".concat(e," has expired: block height exceeded."))).signature=void 0,r.signature=e,r}return W(n)}();Object.defineProperty(Au.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var Eu=function(e){Y(n,q(Error));var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,"Transaction was not confirmed in ".concat(r.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(e," using the Solana Explorer or CLI tools."))).signature=void 0,i.signature=e,i}return W(n)}();Object.defineProperty(Eu.prototype,"name",{value:"TransactionExpiredTimeoutError"});var Nu=function(e){Y(n,q(Error));var t=X(n);function n(e){var r;return B(this,n),(r=t.call(this,"Signature ".concat(e," has expired: the nonce is no longer valid."))).signature=void 0,r.signature=e,r}return W(n)}();Object.defineProperty(Nu.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var Tu=function(){function e(t,n){B(this,e),this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=n}return W(e,[{key:"keySegments",value:function(){var e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}},{key:"get",value:function(e){var t,n=ae(this.keySegments());try{for(n.s();!(t=n.n()).done;){var r=t.value;if(e<r.length)return r[e];e-=r.length}}catch(e){n.e(e)}finally{n.f()}}},{key:"length",get:function(){return this.keySegments().flat().length}},{key:"compileInstructions",value:function(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");var t=new Map;this.keySegments().flat().forEach((function(e,n){t.set(e.toBase58(),n)}));var n=function(e){var n=t.get(e.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return e.map((function(e){return{programIdIndex:n(e.programId),accountKeyIndexes:e.keys.map((function(e){return n(e.pubkey)})),data:e.data}}))}}]),e}(),Iu=function(){return Ei(32,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey")},ku=function(){return Ei(64,arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature")},Lu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",t=Mi([vi("length"),vi("lengthPadding"),Ei(yi(vi(),-8),"chars")],e),n=t.decode.bind(t),r=t.encode.bind(t),i=t;return i.decode=function(e,t){return n(e,t).chars.toString()},i.encode=function(e,t,n){var i={chars:Ee.from(e,"utf8")};return r(i,t,n)},i.alloc=function(e){return vi().span+vi().span+Ee.from(e,"utf8").length},i};function xu(e,t){var n=function e(n){if(n.span>=0)return n.span;if("function"==typeof n.alloc)return n.alloc(t[n.property]);if("count"in n&&"elementLayout"in n){var r=t[n.property];if(Array.isArray(r))return r.length*e(n.elementLayout)}else if("fields"in n)return xu({layout:n},t[n.property]);return 0},r=0;return e.layout.fields.forEach((function(e){r+=n(e)})),r}function Su(e){for(var t=0,n=0;;){var r=e.shift();if(t|=(127&r)<<7*n,n+=1,0==(128&r))break}return t}function ju(e,t){for(var n=t;;){var r=127&n;if(0==(n>>=7)){e.push(r);break}r|=128,e.push(r)}}function Cu(e,t){if(!e)throw new Error(t||"Assertion failed")}var Du,Ou=function(){function e(t,n){B(this,e),this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=n}return W(e,[{key:"getMessageComponents",value:function(){var e=ee(this.keyMetaMap.entries());Cu(e.length<=256,"Max static account keys length exceeded");var t=e.filter((function(e){var t=$(e,2)[1];return t.isSigner&&t.isWritable})),n=e.filter((function(e){var t=$(e,2)[1];return t.isSigner&&!t.isWritable})),r=e.filter((function(e){var t=$(e,2)[1];return!t.isSigner&&t.isWritable})),i=e.filter((function(e){var t=$(e,2)[1];return!t.isSigner&&!t.isWritable})),o={numRequiredSignatures:t.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};return Cu(t.length>0,"Expected at least one writable signer key"),Cu($(t[0],1)[0]===this.payer.toBase58(),"Expected first writable signer key to be the fee payer"),[o,[].concat(ee(t.map((function(e){var t=$(e,1)[0];return new mu(t)}))),ee(n.map((function(e){var t=$(e,1)[0];return new mu(t)}))),ee(r.map((function(e){var t=$(e,1)[0];return new mu(t)}))),ee(i.map((function(e){var t=$(e,1)[0];return new mu(t)}))))]}},{key:"extractTableLookup",value:function(e){var t=$(this.drainKeysFoundInLookupTable(e.state.addresses,(function(e){return!e.isSigner&&!e.isInvoked&&e.isWritable})),2),n=t[0],r=t[1],i=$(this.drainKeysFoundInLookupTable(e.state.addresses,(function(e){return!e.isSigner&&!e.isInvoked&&!e.isWritable})),2),o=i[0],a=i[1];if(0!==n.length||0!==o.length)return[{accountKey:e.key,writableIndexes:n,readonlyIndexes:o},{writable:r,readonly:a}]}},{key:"drainKeysFoundInLookupTable",value:function(e,t){var n,r=this,i=new Array,o=new Array,a=ae(this.keyMetaMap.entries());try{var s=function(){var a=$(n.value,2),s=a[0],u=a[1];if(t(u)){var c=new mu(s),l=e.findIndex((function(e){return e.equals(c)}));l>=0&&(Cu(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(e){a.e(e)}finally{a.f()}return[i,o]}}],[{key:"compile",value:function(t,n){var r=new Map,i=function(e){var t=e.toBase58(),n=r.get(t);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(t,n)),n},o=i(n);o.isSigner=!0,o.isWritable=!0;var a,s=ae(t);try{for(s.s();!(a=s.n()).done;){var u=a.value;i(u.programId).isInvoked=!0;var c,l=ae(u.keys);try{for(l.s();!(c=l.n()).done;){var d=c.value,h=i(d.pubkey);h.isSigner||(h.isSigner=d.isSigner),h.isWritable||(h.isWritable=d.isWritable)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){s.e(e)}finally{s.f()}return new e(n,r)}}]),e}(),zu=function(){function e(t){var n=this;B(this,e),this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map((function(e){return new mu(e)})),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((function(e){return n.indexToProgramIds.set(e.programIdIndex,n.accountKeys[e.programIdIndex])}))}return W(e,[{key:"version",get:function(){return"legacy"}},{key:"staticAccountKeys",get:function(){return this.accountKeys}},{key:"compiledInstructions",get:function(){return this.instructions.map((function(e){return{programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Bn.decode(e.data)}}))}},{key:"addressTableLookups",get:function(){return[]}},{key:"getAccountKeys",value:function(){return new Tu(this.staticAccountKeys)}},{key:"isAccountSigner",value:function(e){return e<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(e){var t=this.header.numRequiredSignatures;return e>=this.header.numRequiredSignatures?e-t<this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts:e<t-this.header.numReadonlySignedAccounts}},{key:"isProgramId",value:function(e){return this.indexToProgramIds.has(e)}},{key:"programIds",value:function(){return ee(this.indexToProgramIds.values())}},{key:"nonProgramIds",value:function(){var e=this;return this.accountKeys.filter((function(t,n){return!e.isProgramId(n)}))}},{key:"serialize",value:function(){var e=this.accountKeys.length,t=[];ju(t,e);var n=this.instructions.map((function(e){var t=e.accounts,n=e.programIdIndex,r=Array.from(Bn.decode(e.data)),i=[];ju(i,t.length);var o=[];return ju(o,r.length),{programIdIndex:n,keyIndicesCount:Ee.from(i),keyIndices:t,dataLength:Ee.from(o),data:r}})),r=[];ju(r,n.length);var i=Ee.alloc(wu);Ee.from(r).copy(i);var o=r.length;n.forEach((function(e){var t=Mi([mi("programIdIndex"),Ei(e.keyIndicesCount.length,"keyIndicesCount"),Ai(mi("keyIndex"),e.keyIndices.length,"keyIndices"),Ei(e.dataLength.length,"dataLength"),Ai(mi("userdatum"),e.data.length,"data")]).encode(e,i,o);o+=t})),i=i.slice(0,o);var a=Mi([Ei(1,"numRequiredSignatures"),Ei(1,"numReadonlySignedAccounts"),Ei(1,"numReadonlyUnsignedAccounts"),Ei(t.length,"keyCount"),Ai(Iu("key"),e,"keys"),Iu("recentBlockhash")]),s={numRequiredSignatures:Ee.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Ee.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Ee.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Ee.from(t),keys:this.accountKeys.map((function(e){return lu(e.toBytes())})),recentBlockhash:Bn.decode(this.recentBlockhash)},u=Ee.alloc(2048),c=a.encode(s,u);return i.copy(u,c),u.slice(0,c+i.length)}}],[{key:"compile",value:function(t){var n=$(Ou.compile(t.instructions,t.payerKey).getMessageComponents(),2),r=n[0],i=n[1],o=new Tu(i).compileInstructions(t.instructions).map((function(e){return{programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:Bn.encode(e.data)}}));return new e({header:r,accountKeys:i,recentBlockhash:t.recentBlockhash,instructions:o})}},{key:"from",value:function(t){var n=ee(t),r=n.shift();if(r!==(r&bu))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");for(var i=n.shift(),o=n.shift(),a=Su(n),s=[],u=0;u<a;u++){var c=n.slice(0,fu);n=n.slice(fu),s.push(new mu(Ee.from(c)))}for(var l=n.slice(0,fu),d=Su(n=n.slice(fu)),h=[],p=0;p<d;p++){var f=n.shift(),y=Su(n),m=n.slice(0,y),g=Su(n=n.slice(y)),v=n.slice(0,g),w=Bn.encode(Ee.from(v));n=n.slice(g),h.push({programIdIndex:f,accounts:m,data:w})}return new e({header:{numRequiredSignatures:r,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:o},recentBlockhash:Bn.encode(Ee.from(l)),accountKeys:s,instructions:h})}}]),e}(),_u=function(){function e(t){B(this,e),this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}return W(e,[{key:"version",get:function(){return 0}},{key:"numAccountKeysFromLookups",get:function(){var e,t=0,n=ae(this.addressTableLookups);try{for(n.s();!(e=n.n()).done;){var r=e.value;t+=r.readonlyIndexes.length+r.writableIndexes.length}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"getAccountKeys",value:function(e){var t;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");t=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)t=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new Tu(this.staticAccountKeys,t)}},{key:"isAccountSigner",value:function(e){return e<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(e){var t=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;if(e>=n){var r=e-n,i=this.addressTableLookups.reduce((function(e,t){return e+t.writableIndexes.length}),0);return r<i}return e>=this.header.numRequiredSignatures?e-t<n-t-this.header.numReadonlyUnsignedAccounts:e<t-this.header.numReadonlySignedAccounts}},{key:"resolveAddressTableLookups",value:function(e){var t,n={writable:[],readonly:[]},r=ae(this.addressTableLookups);try{var i=function(){var r=t.value,i=e.find((function(e){return e.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=ae(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(e){a.e(e)}finally{a.f()}var u,c=ae(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(e){c.e(e)}finally{c.f()}};for(r.s();!(t=r.n()).done;)i()}catch(e){r.e(e)}finally{r.f()}return n}},{key:"serialize",value:function(){var e=Array();ju(e,this.staticAccountKeys.length);var t=this.serializeInstructions(),n=Array();ju(n,this.compiledInstructions.length);var r=this.serializeAddressTableLookups(),i=Array();ju(i,this.addressTableLookups.length);var o=Mi([mi("prefix"),Mi([mi("numRequiredSignatures"),mi("numReadonlySignedAccounts"),mi("numReadonlyUnsignedAccounts")],"header"),Ei(e.length,"staticAccountKeysLength"),Ai(Iu(),this.staticAccountKeys.length,"staticAccountKeys"),Iu("recentBlockhash"),Ei(n.length,"instructionsLength"),Ei(t.length,"serializedInstructions"),Ei(i.length,"addressTableLookupsLength"),Ei(r.length,"serializedAddressTableLookups")]),a=new Uint8Array(wu),s=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map((function(e){return e.toBytes()})),recentBlockhash:Bn.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},a);return a.slice(0,s)}},{key:"serializeInstructions",value:function(){var e,t=0,n=new Uint8Array(wu),r=ae(this.compiledInstructions);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Array();ju(o,i.accountKeyIndexes.length);var a=Array();ju(a,i.data.length),t+=Mi([mi("programIdIndex"),Ei(o.length,"encodedAccountKeyIndexesLength"),Ai(mi(),i.accountKeyIndexes.length,"accountKeyIndexes"),Ei(a.length,"encodedDataLength"),Ei(i.data.length,"data")]).encode({programIdIndex:i.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(o),accountKeyIndexes:i.accountKeyIndexes,encodedDataLength:new Uint8Array(a),data:i.data},n,t)}}catch(e){r.e(e)}finally{r.f()}return n.slice(0,t)}},{key:"serializeAddressTableLookups",value:function(){var e,t=0,n=new Uint8Array(wu),r=ae(this.addressTableLookups);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Array();ju(o,i.writableIndexes.length);var a=Array();ju(a,i.readonlyIndexes.length),t+=Mi([Iu("accountKey"),Ei(o.length,"encodedWritableIndexesLength"),Ai(mi(),i.writableIndexes.length,"writableIndexes"),Ei(a.length,"encodedReadonlyIndexesLength"),Ai(mi(),i.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:i.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(o),writableIndexes:i.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(a),readonlyIndexes:i.readonlyIndexes},n,t)}}catch(e){r.e(e)}finally{r.f()}return n.slice(0,t)}}],[{key:"compile",value:function(t){var n,r=Ou.compile(t.instructions,t.payerKey),i=new Array,o={writable:new Array,readonly:new Array},a=ae(t.addressLookupTableAccounts||[]);try{for(a.s();!(n=a.n()).done;){var s=n.value,u=r.extractTableLookup(s);if(void 0!==u){var c,l,d=$(u,2),h=d[0],p=d[1],f=p.writable,y=p.readonly;i.push(h),(c=o.writable).push.apply(c,ee(f)),(l=o.readonly).push.apply(l,ee(y))}}}catch(e){a.e(e)}finally{a.f()}var m=$(r.getMessageComponents(),2),g=m[0],v=m[1],w=new Tu(v,o).compileInstructions(t.instructions);return new e({header:g,staticAccountKeys:v,recentBlockhash:t.recentBlockhash,compiledInstructions:w,addressTableLookups:i})}},{key:"deserialize",value:function(t){var n=ee(t),r=n.shift(),i=r&bu;Cu(r!==i,"Expected versioned message but received legacy message");Cu(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=Su(n),u=0;u<s;u++)a.push(new mu(n.splice(0,fu)));for(var c=Bn.encode(n.splice(0,fu)),l=Su(n),d=[],h=0;h<l;h++){var p=n.shift(),f=Su(n),y=n.splice(0,f),m=Su(n),g=new Uint8Array(n.splice(0,m));d.push({programIdIndex:p,accountKeyIndexes:y,data:g})}for(var v=Su(n),w=[],b=0;b<v;b++){var M=new mu(n.splice(0,fu)),A=Su(n),E=n.splice(0,A),N=Su(n),T=n.splice(0,N);w.push({accountKey:M,writableIndexes:E,readonlyIndexes:T})}return new e({header:o,staticAccountKeys:a,recentBlockhash:c,compiledInstructions:d,addressTableLookups:w})}}]),e}(),Pu={deserializeMessageVersion:function(e){var t=e[0],n=t&bu;return n===t?"legacy":n},deserialize:function(e){var t=Pu.deserializeMessageVersion(e);if("legacy"===t)return zu.from(e);if(0===t)return _u.deserialize(e);throw new Error("Transaction message version ".concat(t," deserialization is not supported"))}};!function(e){e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID"}(Du||(Du={}));var Ru=Ee.alloc(Mu).fill(0),Bu=function(){function e(t){B(this,e),this.keys=void 0,this.programId=void 0,this.data=Ee.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}return W(e,[{key:"toJSON",value:function(){return{keys:this.keys.map((function(e){var t=e.pubkey,n=e.isSigner,r=e.isWritable;return{pubkey:t.toJSON(),isSigner:n,isWritable:r}})),programId:this.programId.toJSON(),data:ee(this.data)}}}]),e}(),Uu=function(){function e(t){if(B(this,e),this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){var n=t.minContextSlot,r=t.nonceInfo;this.minNonceContextSlot=n,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){var i=t.blockhash,o=t.lastValidBlockHeight;this.recentBlockhash=i,this.lastValidBlockHeight=o}else{var a=t.recentBlockhash,s=t.nonceInfo;s&&(this.nonceInfo=s),this.recentBlockhash=a}}var t;return W(e,[{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(e){return e.toJSON()})),signers:this.signatures.map((function(e){return e.publicKey.toJSON()}))}}},{key:"add",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(0===n.length)throw new Error("No instructions");return n.forEach((function(t){"instructions"in t?e.instructions=e.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?e.instructions.push(t):e.instructions.push(new Bu(t))})),this}},{key:"compileMessage",value:function(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;var e,t,n;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction].concat(ee(this.instructions)):this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");if(t.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<t.length;r++)if(void 0===t[r].programId)throw new Error("Transaction instruction index ".concat(r," has undefined program id"));var i=[],o=[];t.forEach((function(e){e.keys.forEach((function(e){o.push(O({},e))}));var t=e.programId.toString();i.includes(t)||i.push(t)})),i.forEach((function(e){o.push({pubkey:new mu(e),isSigner:!1,isWritable:!1})}));var a=[];o.forEach((function(e){var t=e.pubkey.toString(),n=a.findIndex((function(e){return e.pubkey.toString()===t}));n>-1?(a[n].isWritable=a[n].isWritable||e.isWritable,a[n].isSigner=a[n].isSigner||e.isSigner):a.push(e)})),a.sort((function(e,t){return e.isSigner!==t.isSigner?e.isSigner?-1:1:e.isWritable!==t.isWritable?e.isWritable?-1:1:e.pubkey.toBase58().localeCompare(t.pubkey.toBase58())}));var s=a.findIndex((function(e){return e.pubkey.equals(n)}));if(s>-1){var u=$(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=ae(this.signatures);try{var d=function(){var e=c.value,t=a.findIndex((function(t){return t.pubkey.equals(e.publicKey)}));if(!(t>-1))throw new Error("unknown signer: ".concat(e.publicKey.toString()));a[t].isSigner||(a[t].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;)d()}catch(e){l.e(e)}finally{l.f()}var h=0,p=0,f=0,y=[],m=[];a.forEach((function(e){var t=e.pubkey,n=e.isSigner,r=e.isWritable;n?(y.push(t.toString()),h+=1,r||(p+=1)):(m.push(t.toString()),r||(f+=1))}));var g=y.concat(m),v=t.map((function(e){var t=e.data,n=e.programId;return{programIdIndex:g.indexOf(n.toString()),accounts:e.keys.map((function(e){return g.indexOf(e.pubkey.toString())})),data:Bn.encode(t)}}));return v.forEach((function(e){Cu(e.programIdIndex>=0),e.accounts.forEach((function(e){return Cu(e>=0)}))})),new zu({header:{numRequiredSignatures:h,numReadonlySignedAccounts:p,numReadonlyUnsignedAccounts:f},accountKeys:g,recentBlockhash:e,instructions:v})}},{key:"_compile",value:function(){var e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);if(this.signatures.length===t.length){var n=this.signatures.every((function(e,n){return t[n].equals(e.publicKey)}));if(n)return e}return this.signatures=t.map((function(e){return{signature:null,publicKey:e}})),e}},{key:"serializeMessage",value:function(){return this._compile().serialize()}},{key:"getEstimatedFee",value:(t=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getFeeForMessage(this.compileMessage());case 2:return e.abrupt("return",e.sent.value);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setSigners",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");var r=new Set;this.signatures=t.filter((function(e){var t=e.toString();return!r.has(t)&&(r.add(t),!0)})).map((function(e){return{signature:null,publicKey:e}}))}},{key:"sign",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=t;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(e){return{signature:null,publicKey:e.publicKey}}));var c=this._compile();this._partialSign.apply(this,[c].concat(i))}},{key:"partialSign",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=t;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(e){for(var t=this,n=e.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(e){var r=uu(n,e.secretKey);t._addSignature(e.publicKey,lu(r))}))}},{key:"addSignature",value:function(e,t){this._compile(),this._addSignature(e,t)}},{key:"_addSignature",value:function(e,t){Cu(64===t.length);var n=this.signatures.findIndex((function(t){return e.equals(t.publicKey)}));if(n<0)throw new Error("unknown signer: ".concat(e.toString()));this.signatures[n].signature=Ee.from(t)}},{key:"verifySignatures",value:function(e){return this._verifySignatures(this.serializeMessage(),void 0===e||e)}},{key:"_verifySignatures",value:function(e,t){var n,r=ae(this.signatures);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i.signature,a=i.publicKey;if(null===o){if(t)return!1}else if(!cu(o,e,a.toBytes()))return!1}}catch(e){r.e(e)}finally{r.f()}return!0}},{key:"serialize",value:function(e){var t=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=t.requireAllSignatures,r=t.verifySignatures,i=this.serializeMessage();if(r&&!this._verifySignatures(i,n))throw new Error("Signature verification failed");return this._serialize(i)}},{key:"_serialize",value:function(e){var t=this.signatures,n=[];ju(n,t.length);var r=n.length+64*t.length+e.length,i=Ee.alloc(r);return Cu(t.length<256),Ee.from(n).copy(i,0),t.forEach((function(e,t){var r=e.signature;null!==r&&(Cu(64===r.length,"signature has invalid length"),Ee.from(r).copy(i,n.length+64*t))})),e.copy(i,n.length+64*t.length),Cu(i.length<=wu,"Transaction too large: ".concat(i.length," > ").concat(wu)),i}},{key:"keys",get:function(){return Cu(1===this.instructions.length),this.instructions[0].keys.map((function(e){return e.pubkey}))}},{key:"programId",get:function(){return Cu(1===this.instructions.length),this.instructions[0].programId}},{key:"data",get:function(){return Cu(1===this.instructions.length),this.instructions[0].data}}],[{key:"from",value:function(t){for(var n=ee(t),r=Su(n),i=[],o=0;o<r;o++){var a=n.slice(0,Mu);n=n.slice(Mu),i.push(Bn.encode(Ee.from(a)))}return e.populate(zu.from(n),i)}},{key:"populate",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=new e;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),n.forEach((function(e,n){var i={signature:e==Bn.encode(Ru)?null:Bn.decode(e),publicKey:t.accountKeys[n]};r.signatures.push(i)})),t.instructions.forEach((function(e){var n=e.accounts.map((function(e){var n=t.accountKeys[e];return{pubkey:n,isSigner:r.signatures.some((function(e){return e.publicKey.toString()===n.toString()}))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));r.instructions.push(new Bu({keys:n,programId:t.accountKeys[e.programIdIndex],data:Bn.decode(e.data)}))})),r._message=t,r._json=r.toJSON(),r}}]),e}(),Wu=function(){function e(t){B(this,e),this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}return W(e,[{key:"compileToLegacyMessage",value:function(){return zu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}},{key:"compileToV0Message",value:function(e){return _u.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:e})}}],[{key:"decompile",value:function(t,n){var r=t.header,i=t.compiledInstructions,o=t.recentBlockhash,a=r.numRequiredSignatures,s=r.numReadonlySignedAccounts,u=r.numReadonlyUnsignedAccounts,c=a-s;Cu(c>0,"Message header is invalid");var l=t.staticAccountKeys.length-a-u;Cu(l>=0,"Message header is invalid");var d=t.getAccountKeys(n),h=d.get(0);if(void 0===h)throw new Error("Failed to decompile message because no account keys were found");var p,f=[],y=ae(i);try{for(y.s();!(p=y.n()).done;){var m,g=p.value,v=[],w=ae(g.accountKeyIndexes);try{for(w.s();!(m=w.n()).done;){var b=m.value,M=d.get(b);if(void 0===M)throw new Error("Failed to find key for account key index ".concat(b));var A=void 0;A=b<a?b<c:b<d.staticAccountKeys.length?b-a<l:b-d.staticAccountKeys.length<d.accountKeysFromLookups.writable.length,v.push({pubkey:M,isSigner:b<r.numRequiredSignatures,isWritable:A})}}catch(e){w.e(e)}finally{w.f()}var E=d.get(g.programIdIndex);if(void 0===E)throw new Error("Failed to find program id for program id index ".concat(g.programIdIndex));f.push(new Bu({programId:E,data:lu(g.data),keys:v}))}}catch(e){y.e(e)}finally{y.f()}return new e({payerKey:h,instructions:f,recentBlockhash:o})}}]),e}(),Qu=function(){function e(t,n){if(B(this,e),this.signatures=void 0,this.message=void 0,void 0!==n)Cu(n.length===t.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=n;else{for(var r=[],i=0;i<t.header.numRequiredSignatures;i++)r.push(new Uint8Array(Mu));this.signatures=r}this.message=t}return W(e,[{key:"version",get:function(){return this.message.version}},{key:"serialize",value:function(){var e=this.message.serialize(),t=Array();ju(t,this.signatures.length);var n=Mi([Ei(t.length,"encodedSignaturesLength"),Ai(ku(),this.signatures.length,"signatures"),Ei(e.length,"serializedMessage")]),r=new Uint8Array(2048),i=n.encode({encodedSignaturesLength:new Uint8Array(t),signatures:this.signatures,serializedMessage:e},r);return r.slice(0,i)}},{key:"sign",value:function(e){var t,n=this,r=this.message.serialize(),i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures),o=ae(e);try{var a=function(){var e=t.value,o=i.findIndex((function(t){return t.equals(e.publicKey)}));Cu(o>=0,"Cannot sign with non signer key ".concat(e.publicKey.toBase58())),n.signatures[o]=uu(r,e.secretKey)};for(o.s();!(t=o.n()).done;)a()}catch(e){o.e(e)}finally{o.f()}}},{key:"addSignature",value:function(e,t){Cu(64===t.byteLength,"Signature must be 64 bytes long");var n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((function(t){return t.equals(e)}));Cu(n>=0,"Can not add signature; `".concat(e.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=t}}],[{key:"deserialize",value:function(t){for(var n=ee(t),r=[],i=Su(n),o=0;o<i;o++)r.push(new Uint8Array(n.splice(0,Mu)));return new e(Pu.deserialize(new Uint8Array(n)),r)}}]),e}(),Yu=new mu("SysvarC1ock11111111111111111111111111111111"),Fu=new mu("SysvarEpochSchedu1e111111111111111111111111"),Vu=new mu("Sysvar1nstructions1111111111111111111111111"),Hu=new mu("SysvarRecentB1ockHashes11111111111111111111"),Gu=new mu("SysvarRent111111111111111111111111111111111"),qu=new mu("SysvarRewards111111111111111111111111111111"),Zu=new mu("SysvarS1otHashes111111111111111111111111111"),Ju=new mu("SysvarS1otHistory11111111111111111111111111"),Xu=new mu("SysvarStakeHistory1111111111111111111111111");function Ku(e,t,n,r){return $u.apply(this,arguments)}function $u(){return $u=R(z().mark((function e(t,n,r,i){var o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},e.next=3,t.sendTransaction(n,r,o);case 3:if(a=e.sent,null==n.recentBlockhash||null==n.lastValidBlockHeight){e.next=10;break}return e.next=7,t.confirmTransaction({abortSignal:null==i?void 0:i.abortSignal,signature:a,blockhash:n.recentBlockhash,lastValidBlockHeight:n.lastValidBlockHeight},i&&i.commitment);case 7:s=e.sent.value,e.next=22;break;case 10:if(null==n.minNonceContextSlot||null==n.nonceInfo){e.next=18;break}return u=n.nonceInfo.nonceInstruction,c=u.keys[0].pubkey,e.next=15,t.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=e.sent.value,e.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."),e.next=21,t.confirmTransaction(a,i&&i.commitment);case 21:s=e.sent.value;case 22:if(!s.err){e.next=24;break}throw new Error("Transaction ".concat(a," failed (").concat(JSON.stringify(s),")"));case 24:return e.abrupt("return",a);case 25:case"end":return e.stop()}}),e)}))),$u.apply(this,arguments)}function ec(e){return new Promise((function(t){return setTimeout(t,e)}))}function tc(e,t){var n=e.layout.span>=0?e.layout.span:xu(e,t),r=Ee.alloc(n),i=Object.assign({instruction:e.index},t);return e.layout.encode(i,r),r}function nc(e,t){var n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.instruction!==e.index)throw new Error("invalid instruction; instruction index mismatch ".concat(n.instruction," != ").concat(e.index));return n}var rc,ic=wi("lamportsPerSignature"),oc=Mi([vi("version"),vi("state"),Iu("authorizedPubkey"),Iu("nonce"),Mi([ic],"feeCalculator")]),ac=oc.span,sc=function(){function e(t){B(this,e),this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}return W(e,null,[{key:"fromAccountData",value:function(t){var n=oc.decode(lu(t),0);return new e({authorizedPubkey:new mu(n.authorizedPubkey),nonce:new mu(n.nonce).toString(),feeCalculator:n.feeCalculator})}}]),e}(),uc=(rc=8,function(e){var t=Ei(rc,e),n=function(e){return{decode:e.decode.bind(e),encode:e.encode.bind(e)}}(t),r=n.encode,i=n.decode,o=t;return o.decode=function(e,t){var n=i(e,t);return Ti(Ee.from(n))},o.encode=function(e,t,n){var i=Ii(e,rc);return r(i,t,n)},o}),cc=function(){function e(){B(this,e)}return W(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=vi("instruction").decode(e.data),r=0,i=Object.entries(lc);r<i.length;r++){var o=$(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a SystemInstruction");return t}},{key:"decodeCreateAccount",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(lc.Create,e.data),n=t.lamports,r=t.space,i=t.programId;return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:n,space:r,programId:new mu(i)}}},{key:"decodeTransfer",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(lc.Transfer,e.data).lamports;return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:t}}},{key:"decodeTransferWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(lc.TransferWithSeed,e.data),n=t.lamports,r=t.seed,i=t.programId;return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:n,seed:r,programId:new mu(i)}}},{key:"decodeAllocate",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=nc(lc.Allocate,e.data).space;return{accountPubkey:e.keys[0].pubkey,space:t}}},{key:"decodeAllocateWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=nc(lc.AllocateWithSeed,e.data),n=t.base,r=t.seed,i=t.space,o=t.programId;return{accountPubkey:e.keys[0].pubkey,basePubkey:new mu(n),seed:r,space:i,programId:new mu(o)}}},{key:"decodeAssign",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=nc(lc.Assign,e.data).programId;return{accountPubkey:e.keys[0].pubkey,programId:new mu(t)}}},{key:"decodeAssignWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=nc(lc.AssignWithSeed,e.data),n=t.base,r=t.seed,i=t.programId;return{accountPubkey:e.keys[0].pubkey,basePubkey:new mu(n),seed:r,programId:new mu(i)}}},{key:"decodeCreateWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(lc.CreateWithSeed,e.data),n=t.base,r=t.seed,i=t.lamports,o=t.space,a=t.programId;return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new mu(n),seed:r,lamports:i,space:o,programId:new mu(a)}}},{key:"decodeNonceInitialize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(lc.InitializeNonceAccount,e.data).authorized;return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new mu(t)}}},{key:"decodeNonceAdvance",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),nc(lc.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}},{key:"decodeNonceWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);var t=nc(lc.WithdrawNonceAccount,e.data).lamports;return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t}}},{key:"decodeNonceAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(lc.AuthorizeNonceAccount,e.data).authorized;return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new mu(t)}}},{key:"checkProgramId",value:function(e){if(!e.equals(dc.programId))throw new Error("invalid instruction; programId is not SystemProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),lc=Object.freeze({Create:{index:0,layout:Mi([vi("instruction"),bi("lamports"),bi("space"),Iu("programId")])},Assign:{index:1,layout:Mi([vi("instruction"),Iu("programId")])},Transfer:{index:2,layout:Mi([vi("instruction"),uc("lamports")])},CreateWithSeed:{index:3,layout:Mi([vi("instruction"),Iu("base"),Lu("seed"),bi("lamports"),bi("space"),Iu("programId")])},AdvanceNonceAccount:{index:4,layout:Mi([vi("instruction")])},WithdrawNonceAccount:{index:5,layout:Mi([vi("instruction"),bi("lamports")])},InitializeNonceAccount:{index:6,layout:Mi([vi("instruction"),Iu("authorized")])},AuthorizeNonceAccount:{index:7,layout:Mi([vi("instruction"),Iu("authorized")])},Allocate:{index:8,layout:Mi([vi("instruction"),bi("space")])},AllocateWithSeed:{index:9,layout:Mi([vi("instruction"),Iu("base"),Lu("seed"),bi("space"),Iu("programId")])},AssignWithSeed:{index:10,layout:Mi([vi("instruction"),Iu("base"),Lu("seed"),Iu("programId")])},TransferWithSeed:{index:11,layout:Mi([vi("instruction"),uc("lamports"),Lu("seed"),Iu("programId")])},UpgradeNonceAccount:{index:12,layout:Mi([vi("instruction")])}}),dc=function(){function e(){B(this,e)}return W(e,null,[{key:"createAccount",value:function(e){var t=tc(lc.Create,{lamports:e.lamports,space:e.space,programId:lu(e.programId.toBuffer())});return new Bu({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}},{key:"transfer",value:function(e){var t,n;"basePubkey"in e?(t=tc(lc.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:lu(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]):(t=tc(lc.Transfer,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]);return new Bu({keys:n,programId:this.programId,data:t})}},{key:"assign",value:function(e){var t,n;"basePubkey"in e?(t=tc(lc.AssignWithSeed,{base:lu(e.basePubkey.toBuffer()),seed:e.seed,programId:lu(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=tc(lc.Assign,{programId:lu(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]);return new Bu({keys:n,programId:this.programId,data:t})}},{key:"createAccountWithSeed",value:function(e){var t=tc(lc.CreateWithSeed,{base:lu(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:lu(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new Bu({keys:n,programId:this.programId,data:t})}},{key:"createNonceAccount",value:function(t){var n=new Uu;"basePubkey"in t&&"seed"in t?n.add(e.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:ac,programId:this.programId})):n.add(e.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:ac,programId:this.programId}));var r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return n.add(this.nonceInitialize(r)),n}},{key:"nonceInitialize",value:function(e){var t=tc(lc.InitializeNonceAccount,{authorized:lu(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Hu,isSigner:!1,isWritable:!1},{pubkey:Gu,isSigner:!1,isWritable:!1}],programId:this.programId,data:t};return new Bu(n)}},{key:"nonceAdvance",value:function(e){var t=tc(lc.AdvanceNonceAccount),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Hu,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t};return new Bu(n)}},{key:"nonceWithdraw",value:function(e){var t=tc(lc.WithdrawNonceAccount,{lamports:e.lamports});return new Bu({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:Hu,isSigner:!1,isWritable:!1},{pubkey:Gu,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}},{key:"nonceAuthorize",value:function(e){var t=tc(lc.AuthorizeNonceAccount,{authorized:lu(e.newAuthorizedPubkey.toBuffer())});return new Bu({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}},{key:"allocate",value:function(e){var t,n;"basePubkey"in e?(t=tc(lc.AllocateWithSeed,{base:lu(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:lu(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=tc(lc.Allocate,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]);return new Bu({keys:n,programId:this.programId,data:t})}}]),e}();dc.programId=new mu("11111111111111111111111111111111");var hc=function(){function e(){B(this,e)}var t;return W(e,null,[{key:"getMinNumSignatures",value:function(t){return 2*(Math.ceil(t/e.chunkSize)+1+1)}},{key:"load",value:(t=R(z().mark((function t(n,r,i,o,a){var s,u,c,l,d,h,p,f,y,m,g,v,w,b;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getMinimumBalanceForRentExemption(a.length);case 2:return s=t.sent,t.next=5,n.getAccountInfo(i.publicKey,"confirmed");case 5:if(u=t.sent,c=null,null===u){t.next=16;break}if(!u.executable){t.next=11;break}return console.error("Program load failed, account is already executable"),t.abrupt("return",!1);case 11:u.data.length!==a.length&&(c=c||new Uu).add(dc.allocate({accountPubkey:i.publicKey,space:a.length})),u.owner.equals(o)||(c=c||new Uu).add(dc.assign({accountPubkey:i.publicKey,programId:o})),u.lamports<s&&(c=c||new Uu).add(dc.transfer({fromPubkey:r.publicKey,toPubkey:i.publicKey,lamports:s-u.lamports})),t.next=17;break;case 16:c=(new Uu).add(dc.createAccount({fromPubkey:r.publicKey,newAccountPubkey:i.publicKey,lamports:s>0?s:1,space:a.length,programId:o}));case 17:if(null===c){t.next=20;break}return t.next=20,Ku(n,c,[r,i],{commitment:"confirmed"});case 20:l=Mi([vi("instruction"),vi("offset"),vi("bytesLength"),vi("bytesLengthPadding"),Ai(mi("byte"),yi(vi(),-8),"bytes")]),d=e.chunkSize,h=0,p=a,f=[];case 25:if(!(p.length>0)){t.next=39;break}if(y=p.slice(0,d),m=Ee.alloc(d+16),l.encode({instruction:0,offset:h,bytes:y,bytesLength:0,bytesLengthPadding:0},m),g=(new Uu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:m}),f.push(Ku(n,g,[r,i],{commitment:"confirmed"})),!n._rpcEndpoint.includes("solana.com")){t.next=35;break}return t.next=35,ec(250);case 35:h+=d,p=p.slice(d),t.next=25;break;case 39:return t.next=41,Promise.all(f);case 41:return v=Mi([vi("instruction")]),w=Ee.alloc(v.span),v.encode({instruction:1},w),b=(new Uu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:Gu,isSigner:!1,isWritable:!1}],programId:o,data:w}),t.next=47,Ku(n,b,[r,i],{commitment:"confirmed"});case 47:return t.abrupt("return",!0);case 48:case"end":return t.stop()}}),t)}))),function(e,n,r,i,o){return t.apply(this,arguments)})}]),e}();hc.chunkSize=932;var pc=new mu("BPFLoader2111111111111111111111111111111111"),fc=function(){function e(){B(this,e)}return W(e,null,[{key:"getMinNumSignatures",value:function(e){return hc.getMinNumSignatures(e)}},{key:"load",value:function(e,t,n,r,i){return hc.load(e,t,n,i,r)}}]),e}(),yc=Object.prototype.toString,mc=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function gc(e,t){var n,r,i,o,a,s,u;if(!0===e)return"true";if(!1===e)return"false";switch(_(e)){case"object":if(null===e)return null;if(e.toJSON&&"function"==typeof e.toJSON)return gc(e.toJSON(),t);if("[object Array]"===(u=yc.call(e))){for(i="[",r=e.length-1,n=0;n<r;n++)i+=gc(e[n],!0)+",";return r>-1&&(i+=gc(e[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=mc(e).sort()).length,i="",n=0;n<r;)void 0!==(s=gc(e[a=o[n]],!1))&&(i&&(i+=","),i+=JSON.stringify(a)+":"+s),n++;return"{"+i+"}"}return JSON.stringify(e);case"function":case"undefined":return t?null:void 0;case"string":return JSON.stringify(e);default:return isFinite(e)?e:null}}var vc=function(e){var t=gc(e,!1);if(void 0!==t)return""+t};function wc(e){for(var t=0;e>1;)e/=2,t++;return t}var bc=function(){function e(t,n,r,i,o){B(this,e),this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=n,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=o}return W(e,[{key:"getEpoch",value:function(e){return this.getEpochAndSlotIndex(e)[0]}},{key:"getEpochAndSlotIndex",value:function(e){if(e<this.firstNormalSlot){var t=wc(function(e){return 0===e?1:(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32))}(e+32+1))-wc(32)-1;return[t,e-(this.getSlotsInEpoch(t)-32)]}var n=e-this.firstNormalSlot,r=Math.floor(n/this.slotsPerEpoch);return[this.firstNormalEpoch+r,n%this.slotsPerEpoch]}},{key:"getFirstSlotInEpoch",value:function(e){return e<=this.firstNormalEpoch?32*(Math.pow(2,e)-1):(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}},{key:"getLastSlotInEpoch",value:function(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}},{key:"getSlotsInEpoch",value:function(e){return e<this.firstNormalEpoch?Math.pow(2,e+wc(32)):this.slotsPerEpoch}}]),e}(),Mc=function(e){Y(n,q(Error));var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,e)).logs=void 0,i.logs=r,i}return W(n)}(),Ac=function(e){Y(n,q(Error));var t=X(n);function n(e,r){var i,o=e.code,a=e.message,s=e.data;return B(this,n),(i=t.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 W(n)}(),Ec=globalThis.fetch,Nc=function(e){Y(n,Aa);var t=X(n);function n(e,r,i){var o;B(this,n);return(o=t.call(this,(function(e){var t=Na(e,O({autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3},r));return o.underlyingSocket="socket"in t?t.socket:t,t}),e,r,i)).underlyingSocket=void 0,o}return W(n,[{key:"call",value:function(){for(var e,t,r=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(t=K(F(n.prototype),"call",this)).call.apply(t,[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 e,t,r=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(t=K(F(n.prototype),"notify",this)).call.apply(t,[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 Tc=function(){function e(t){B(this,e),this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}return W(e,[{key:"isActive",value:function(){var e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}}],[{key:"deserialize",value:function(e){var t=function(e,t){var n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.typeIndex!==e.index)throw new Error("invalid account data; account type mismatch ".concat(n.typeIndex," != ").concat(e.index));return n}(Ic,e),n=e.length-56;Cu(n>=0,"lookup table is invalid"),Cu(n%32==0,"lookup table is invalid");var r=n/32,i=Mi([Ai(Iu(),r,"addresses")]).decode(e.slice(56)).addresses;return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new mu(t.authority[0]):void 0,addresses:i.map((function(e){return new mu(e)}))}}}]),e}(),Ic={index:1,layout:Mi([vi("typeIndex"),uc("deactivationSlot"),wi("lastExtendedSlot"),mi("lastExtendedStartIndex"),mi(),Ai(Iu(),yi(mi(),-1),"authority")])},kc=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;var Lc=no(Vi(mu),Xi(),(function(e){return new mu(e)})),xc=Ki([Xi(),Hi("base64")]),Sc=no(Vi(Ee),xc,(function(e){return Ee.from(e[0],"base64")}));function jc(e){var t,n;if("string"==typeof e)t=e;else if(e){t=e.commitment,n=Z(e,eu)}return{commitment:t,config:n}}function Cc(e){return eo([$i({jsonrpc:Hi("2.0"),id:Xi(),result:e}),$i({jsonrpc:Hi("2.0"),id:Xi(),error:$i({code:to(),message:Xi(),data:Zi(Qi("any",(function(){return!0})))})})])}var Dc=Cc(to());function Oc(e){return no(Cc(e),Dc,(function(t){return"error"in t?t:O(O({},t),{},{result:Bi(t.result,e)})}))}function zc(e){return Oc($i({context:$i({slot:qi()}),value:e}))}function _c(e){return $i({context:$i({slot:qi()}),value:e})}function Pc(e,t){return 0===e?new _u({header:t.header,staticAccountKeys:t.accountKeys.map((function(e){return new mu(e)})),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map((function(e){return{programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Bn.decode(e.data)}})),addressTableLookups:t.addressTableLookups}):new zu(t)}var Rc=$i({foundation:qi(),foundationTerm:qi(),initial:qi(),taper:qi(),terminal:qi()}),Bc=Oc(Yi(Gi($i({epoch:qi(),effectiveSlot:qi(),amount:qi(),postBalance:qi(),commission:Zi(Gi(qi()))})))),Uc=Yi($i({slot:qi(),prioritizationFee:qi()})),Wc=$i({total:qi(),validator:qi(),foundation:qi(),epoch:qi()}),Qc=$i({epoch:qi(),slotIndex:qi(),slotsInEpoch:qi(),absoluteSlot:qi(),blockHeight:Zi(qi()),transactionCount:Zi(qi())}),Yc=$i({slotsPerEpoch:qi(),leaderScheduleSlotOffset:qi(),warmup:Fi(),firstNormalEpoch:qi(),firstNormalSlot:qi()}),Fc=Ji(Xi(),Yi(qi())),Vc=Gi(eo([$i({}),Xi()])),Hc=$i({err:Vc}),Gc=Hi("receivedSignature"),qc=$i({"solana-core":Xi(),"feature-set":Zi(qi())}),Zc=zc($i({err:Gi(eo([$i({}),Xi()])),logs:Gi(Yi(Xi())),accounts:Zi(Gi(Yi(Gi($i({executable:Fi(),owner:Xi(),lamports:qi(),data:Yi(Xi()),rentEpoch:Zi(qi())}))))),unitsConsumed:Zi(qi()),returnData:Zi(Gi($i({programId:Xi(),data:Ki([Xi(),Hi("base64")])})))})),Jc=zc($i({byIdentity:Ji(Xi(),Yi(qi())),range:$i({firstSlot:qi(),lastSlot:qi()})}));var Xc=Oc(Rc),Kc=Oc(Wc),$c=Oc(Uc),el=Oc(Qc),tl=Oc(Yc),nl=Oc(Fc),rl=Oc(qi()),il=zc($i({total:qi(),circulating:qi(),nonCirculating:qi(),nonCirculatingAccounts:Yi(Lc)})),ol=$i({amount:Xi(),uiAmount:Gi(qi()),decimals:qi(),uiAmountString:Zi(Xi())}),al=zc(Yi($i({address:Lc,amount:Xi(),uiAmount:Gi(qi()),decimals:qi(),uiAmountString:Zi(Xi())}))),sl=zc(Yi($i({pubkey:Lc,account:$i({executable:Fi(),owner:Lc,lamports:qi(),data:Sc,rentEpoch:qi()})}))),ul=$i({program:Xi(),parsed:to(),space:qi()}),cl=zc(Yi($i({pubkey:Lc,account:$i({executable:Fi(),owner:Lc,lamports:qi(),data:ul,rentEpoch:qi()})}))),ll=zc(Yi($i({lamports:qi(),address:Lc}))),dl=$i({executable:Fi(),owner:Lc,lamports:qi(),data:Sc,rentEpoch:qi()}),hl=$i({pubkey:Lc,account:dl}),pl=no(eo([Vi(Ee),ul]),eo([xc,ul]),(function(e){return Array.isArray(e)?Bi(e,Sc):e})),fl=$i({executable:Fi(),owner:Lc,lamports:qi(),data:pl,rentEpoch:qi()}),yl=$i({pubkey:Lc,account:fl}),ml=$i({state:eo([Hi("active"),Hi("inactive"),Hi("activating"),Hi("deactivating")]),active:qi(),inactive:qi()}),gl=Oc(Yi($i({signature:Xi(),slot:qi(),err:Vc,memo:Gi(Xi()),blockTime:Zi(Gi(qi()))}))),vl=Oc(Yi($i({signature:Xi(),slot:qi(),err:Vc,memo:Gi(Xi()),blockTime:Zi(Gi(qi()))}))),wl=$i({subscription:qi(),result:_c(dl)}),bl=$i({pubkey:Lc,account:dl}),Ml=$i({subscription:qi(),result:_c(bl)}),Al=$i({parent:qi(),slot:qi(),root:qi()}),El=$i({subscription:qi(),result:Al}),Nl=eo([$i({type:eo([Hi("firstShredReceived"),Hi("completed"),Hi("optimisticConfirmation"),Hi("root")]),slot:qi(),timestamp:qi()}),$i({type:Hi("createdBank"),parent:qi(),slot:qi(),timestamp:qi()}),$i({type:Hi("frozen"),slot:qi(),timestamp:qi(),stats:$i({numTransactionEntries:qi(),numSuccessfulTransactions:qi(),numFailedTransactions:qi(),maxTransactionsPerEntry:qi()})}),$i({type:Hi("dead"),slot:qi(),timestamp:qi(),err:Xi()})]),Tl=$i({subscription:qi(),result:Nl}),Il=$i({subscription:qi(),result:_c(eo([Hc,Gc]))}),kl=$i({subscription:qi(),result:qi()}),Ll=$i({pubkey:Xi(),gossip:Gi(Xi()),tpu:Gi(Xi()),rpc:Gi(Xi()),version:Gi(Xi())}),xl=$i({votePubkey:Xi(),nodePubkey:Xi(),activatedStake:qi(),epochVoteAccount:Fi(),epochCredits:Yi(Ki([qi(),qi(),qi()])),commission:qi(),lastVote:qi(),rootSlot:Gi(qi())}),Sl=Oc($i({current:Yi(xl),delinquent:Yi(xl)})),jl=eo([Hi("processed"),Hi("confirmed"),Hi("finalized")]),Cl=$i({slot:qi(),confirmations:Gi(qi()),err:Vc,confirmationStatus:Zi(jl)}),Dl=zc(Yi(Gi(Cl))),Ol=Oc(qi()),zl=$i({accountKey:Lc,writableIndexes:Yi(qi()),readonlyIndexes:Yi(qi())}),_l=$i({signatures:Yi(Xi()),message:$i({accountKeys:Yi(Xi()),header:$i({numRequiredSignatures:qi(),numReadonlySignedAccounts:qi(),numReadonlyUnsignedAccounts:qi()}),instructions:Yi($i({accounts:Yi(qi()),data:Xi(),programIdIndex:qi()})),recentBlockhash:Xi(),addressTableLookups:Zi(Yi(zl))})}),Pl=$i({pubkey:Lc,signer:Fi(),writable:Fi(),source:Zi(eo([Hi("transaction"),Hi("lookupTable")]))}),Rl=$i({accountKeys:Yi(Pl),signatures:Yi(Xi())}),Bl=$i({parsed:to(),program:Xi(),programId:Lc}),Ul=$i({accounts:Yi(Lc),data:Xi(),programId:Lc}),Wl=no(eo([Ul,Bl]),eo([$i({parsed:to(),program:Xi(),programId:Xi()}),$i({accounts:Yi(Xi()),data:Xi(),programId:Xi()})]),(function(e){return Bi(e,"accounts"in e?Ul:Bl)})),Ql=$i({signatures:Yi(Xi()),message:$i({accountKeys:Yi(Pl),instructions:Yi(Wl),recentBlockhash:Xi(),addressTableLookups:Zi(Gi(Yi(zl)))})}),Yl=$i({accountIndex:qi(),mint:Xi(),owner:Zi(Xi()),uiTokenAmount:ol}),Fl=$i({writable:Yi(Lc),readonly:Yi(Lc)}),Vl=$i({err:Vc,fee:qi(),innerInstructions:Zi(Gi(Yi($i({index:qi(),instructions:Yi($i({accounts:Yi(qi()),data:Xi(),programIdIndex:qi()}))})))),preBalances:Yi(qi()),postBalances:Yi(qi()),logMessages:Zi(Gi(Yi(Xi()))),preTokenBalances:Zi(Gi(Yi(Yl))),postTokenBalances:Zi(Gi(Yi(Yl))),loadedAddresses:Zi(Fl),computeUnitsConsumed:Zi(qi())}),Hl=$i({err:Vc,fee:qi(),innerInstructions:Zi(Gi(Yi($i({index:qi(),instructions:Yi(Wl)})))),preBalances:Yi(qi()),postBalances:Yi(qi()),logMessages:Zi(Gi(Yi(Xi()))),preTokenBalances:Zi(Gi(Yi(Yl))),postTokenBalances:Zi(Gi(Yi(Yl))),loadedAddresses:Zi(Fl),computeUnitsConsumed:Zi(qi())}),Gl=eo([Hi(0),Hi("legacy")]),ql=$i({pubkey:Xi(),lamports:qi(),postBalance:Gi(qi()),rewardType:Gi(Xi()),commission:Zi(Gi(qi()))}),Zl=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),transactions:Yi($i({transaction:_l,meta:Gi(Vl),version:Zi(Gl)})),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),Jl=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),Xl=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),transactions:Yi($i({transaction:Rl,meta:Gi(Vl),version:Zi(Gl)})),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),Kl=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),transactions:Yi($i({transaction:Ql,meta:Gi(Hl),version:Zi(Gl)})),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),$l=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),transactions:Yi($i({transaction:Rl,meta:Gi(Hl),version:Zi(Gl)})),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),ed=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),rewards:Zi(Yi(ql)),blockTime:Gi(qi()),blockHeight:Gi(qi())}))),td=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),transactions:Yi($i({transaction:_l,meta:Gi(Vl)})),rewards:Zi(Yi(ql)),blockTime:Gi(qi())}))),nd=Oc(Gi($i({blockhash:Xi(),previousBlockhash:Xi(),parentSlot:qi(),signatures:Yi(Xi()),blockTime:Gi(qi())}))),rd=Oc(Gi($i({slot:qi(),meta:Vl,blockTime:Zi(Gi(qi())),transaction:_l,version:Zi(Gl)}))),id=Oc(Gi($i({slot:qi(),transaction:Ql,meta:Gi(Hl),blockTime:Zi(Gi(qi())),version:Zi(Gl)}))),od=zc($i({blockhash:Xi(),feeCalculator:$i({lamportsPerSignature:qi()})})),ad=zc($i({blockhash:Xi(),lastValidBlockHeight:qi()})),sd=Oc(Yi($i({slot:qi(),numTransactions:qi(),numSlots:qi(),samplePeriodSecs:qi()}))),ud=zc(Gi($i({feeCalculator:$i({lamportsPerSignature:qi()})}))),cd=Oc(Xi()),ld=Oc(Xi()),dd=$i({err:Vc,logs:Yi(Xi()),signature:Xi()}),hd=$i({result:_c(dd),subscription:qi()}),pd={"solana-client":"js/".concat("0.0.0-development")},fd=function(){function e(t,n){var r,i,o,a,s,u,c,l=this;B(this,e),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 e=R(z().mark((function e(t){var n,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=jc(t),o=i.commitment,a=i.config,s=l._buildArgs([],o,void 0,a),u=vc(s),r[u]=null!==(n=r[u])&&void 0!==n?n:R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,l._rpcRequest("getBlockHeight",s);case 3:if(t=e.sent,!("error"in(n=Bi(t,Oc(qi()))))){e.next=7;break}throw new Ac(n.error,"failed to get block height information");case 7:return e.abrupt("return",n.result);case 8:return e.prev=8,delete r[u],e.finish(8);case 11:case"end":return e.stop()}}),e,null,[[0,,8,11]])})))(),e.next=6,r[u];case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.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(e){if(!1===/^https?:/.test(e))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(t),this._rpcWsEndpoint=i||function(e){var t=e.match(kc);if(null==t)throw TypeError("Failed to validate endpoint URL `".concat(e,"`"));var n=$(t,4);n[0];var r=n[1],i=n[2],o=n[3],a=e.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)}(t),this._rpcClient=function(e,t,n,r,i,o){var a,s=n||Ec;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 e=R(z().mark((function e(t,n){var i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,i){try{r(t,n,(function(t,n){return e([t,n])}))}catch(e){i(e)}}));case 2:return i=e.sent,e.next=5,s.apply(void 0,ee(i));case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}());var u=new Bo(function(){var n=R(z().mark((function n(r,o){var u,c,l,d,h;return z().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"},t||{},pd)},n.prev=1,c=5,d=500;case 4:if(!a){n.next=10;break}return n.next=7,a(e,u);case 7:l=n.sent,n.next=13;break;case 10:return n.next=12,s(e,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(d,"ms delay...")),n.next=23,ec(d);case 23:d*=2;case 24:n.next=4;break;case 26:return n.next=28,l.text();case 28:h=n.sent,l.ok?o(null,h):o(new Error("".concat(l.status," ").concat(l.statusText,": ").concat(h))),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(e,t){return n.apply(this,arguments)}}(),{});return u}(t,o,a,s,u,c),this._rpcRequest=function(e){return function(t,n){return new Promise((function(r,i){e.request(t,n,(function(e,t){e?i(e):r(t)}))}))}}(this._rpcClient),this._rpcBatchRequest=function(e){return function(t){return new Promise((function(n,r){0===t.length&&n([]);var i=t.map((function(t){return e.request(t.methodName,t.args)}));e.request(i,(function(e,t){e?r(e):n(t)}))}))}}(this._rpcClient),this._rpcWebSocket=new Nc(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 t,n,r,i,o,a,s,u,c,l,d,h,p,f,y,m,g,v,w,b,M,A,E,N,T,I,k,L,x,S,j,C,D,P,U,Q,Y,F,V,H,G,q,J,X,K,te,ne,re,ie,oe,ae,se,ue,ce,le,de,he,pe,fe,ye,me,ge,ve,we,be,Me,Ae,Ne,Te,Ie,ke,Le,xe,Se,je,Ce,De,Oe,ze,_e,Pe,Re,Be,Ue,We,Qe,Ye,Fe;return W(e,[{key:"commitment",get:function(){return this._commitment}},{key:"rpcEndpoint",get:function(){return this._rpcEndpoint}},{key:"getBalanceAndContext",value:(Fe=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,void 0,o),e.next=4,this._rpcRequest("getBalance",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,zc(qi()))))){e.next=8;break}throw new Ac(u.error,"failed to get balance for ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Fe.apply(this,arguments)})},{key:"getBalance",value:(Ye=R(z().mark((function e(t,n){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getBalanceAndContext(t,n).then((function(e){return e.value})).catch((function(e){throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ye.apply(this,arguments)})},{key:"getBlockTime",value:(Qe=R(z().mark((function e(t){var n,r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getBlockTime",[t]);case 2:if(n=e.sent,!("error"in(r=Bi(n,Oc(Gi(qi())))))){e.next=6;break}throw new Ac(r.error,"failed to get block time for slot ".concat(t));case 6:return e.abrupt("return",r.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return Qe.apply(this,arguments)})},{key:"getMinimumLedgerSlot",value:(We=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("minimumLedgerSlot",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,Oc(qi()))))){e.next=6;break}throw new Ac(n.error,"failed to get minimum ledger slot");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return We.apply(this,arguments)})},{key:"getFirstAvailableBlock",value:(Ue=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getFirstAvailableBlock",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,rl)))){e.next=6;break}throw new Ac(n.error,"failed to get first available block");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return Ue.apply(this,arguments)})},{key:"getSupply",value:(Be=R(z().mark((function e(t){var n,r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={},n="string"==typeof t?{commitment:t}:t?O(O({},t),{},{commitment:t&&t.commitment||this.commitment}):{commitment:this.commitment},e.next=4,this._rpcRequest("getSupply",[n]);case 4:if(r=e.sent,!("error"in(i=Bi(r,il)))){e.next=8;break}throw new Ac(i.error,"failed to get supply");case 8:return e.abrupt("return",i.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Be.apply(this,arguments)})},{key:"getTokenSupply",value:(Re=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenSupply",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,zc(ol))))){e.next=7;break}throw new Ac(o.error,"failed to get token supply");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"getTokenAccountBalance",value:(Pe=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenAccountBalance",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,zc(ol))))){e.next=7;break}throw new Ac(o.error,"failed to get token account balance");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Pe.apply(this,arguments)})},{key:"getTokenAccountsByOwner",value:(_e=R(z().mark((function e(t,n,r){var i,o,a,s,u,c,l;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=jc(r),o=i.commitment,a=i.config,s=[t.toBase58()],"mint"in n?s.push({mint:n.mint.toBase58()}):s.push({programId:n.programId.toBase58()}),u=this._buildArgs(s,o,"base64",a),e.next=6,this._rpcRequest("getTokenAccountsByOwner",u);case 6:if(c=e.sent,!("error"in(l=Bi(c,sl)))){e.next=10;break}throw new Ac(l.error,"failed to get token accounts owned by account ".concat(t.toBase58()));case 10:return e.abrupt("return",l.result);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return _e.apply(this,arguments)})},{key:"getParsedTokenAccountsByOwner",value:(ze=R(z().mark((function e(t,n,r){var i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[t.toBase58()],"mint"in n?i.push({mint:n.mint.toBase58()}):i.push({programId:n.programId.toBase58()}),o=this._buildArgs(i,r,"jsonParsed"),e.next=5,this._rpcRequest("getTokenAccountsByOwner",o);case 5:if(a=e.sent,!("error"in(s=Bi(a,cl)))){e.next=9;break}throw new Ac(s.error,"failed to get token accounts owned by account ".concat(t.toBase58()));case 9:return e.abrupt("return",s.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ze.apply(this,arguments)})},{key:"getLargestAccounts",value:(Oe=R(z().mark((function e(t){var n,r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=O(O({},t),{},{commitment:t&&t.commitment||this.commitment}),r=n.filter||n.commitment?[n]:[],e.next=4,this._rpcRequest("getLargestAccounts",r);case 4:if(i=e.sent,!("error"in(o=Bi(i,ll)))){e.next=8;break}throw new Ac(o.error,"failed to get largest accounts");case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Oe.apply(this,arguments)})},{key:"getTokenLargestAccounts",value:(De=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenLargestAccounts",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,al)))){e.next=7;break}throw new Ac(o.error,"failed to get token largest accounts");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return De.apply(this,arguments)})},{key:"getAccountInfoAndContext",value:(Ce=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"base64",o),e.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,zc(Gi(dl)))))){e.next=8;break}throw new Ac(u.error,"failed to get info about account ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ce.apply(this,arguments)})},{key:"getParsedAccountInfo",value:(je=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"jsonParsed",o),e.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,zc(Gi(fl)))))){e.next=8;break}throw new Ac(u.error,"failed to get info about account ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return je.apply(this,arguments)})},{key:"getAccountInfo",value:(Se=R(z().mark((function e(t,n){var r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getAccountInfoAndContext(t,n);case 3:return r=e.sent,e.abrupt("return",r.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get info about account "+t.toBase58()+": "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e,t){return Se.apply(this,arguments)})},{key:"getMultipleParsedAccounts",value:(xe=R(z().mark((function e(t,n){var r,i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=t.map((function(e){return e.toBase58()})),s=this._buildArgs([a],i,"jsonParsed",o),e.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=e.sent,!("error"in(c=Bi(u,zc(Yi(Gi(fl))))))){e.next=9;break}throw new Ac(c.error,"failed to get info for accounts ".concat(a));case 9:return e.abrupt("return",c.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return xe.apply(this,arguments)})},{key:"getMultipleAccountsInfoAndContext",value:(Le=R(z().mark((function e(t,n){var r,i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=t.map((function(e){return e.toBase58()})),s=this._buildArgs([a],i,"base64",o),e.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=e.sent,!("error"in(c=Bi(u,zc(Yi(Gi(dl))))))){e.next=9;break}throw new Ac(c.error,"failed to get info for accounts ".concat(a));case 9:return e.abrupt("return",c.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return Le.apply(this,arguments)})},{key:"getMultipleAccountsInfo",value:(ke=R(z().mark((function e(t,n){var r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getMultipleAccountsInfoAndContext(t,n);case 2:return r=e.sent,e.abrupt("return",r.value);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return ke.apply(this,arguments)})},{key:"getStakeActivation",value:(Ie=R(z().mark((function e(t,n,r){var i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=jc(n),o=i.commitment,a=i.config,s=this._buildArgs([t.toBase58()],o,void 0,O(O({},a),{},{epoch:null!=r?r:null==a?void 0:a.epoch})),e.next=4,this._rpcRequest("getStakeActivation",s);case 4:if(u=e.sent,!("error"in(c=Bi(u,Oc(ml))))){e.next=8;break}throw new Ac(c.error,"failed to get Stake Activation ".concat(t.toBase58()));case 8:return e.abrupt("return",c.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Ie.apply(this,arguments)})},{key:"getProgramAccounts",value:(Te=R(z().mark((function e(t,n){var r,i,o,a,s,u,c,l,d;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,s=(a=o||{}).encoding,u=Z(a,tu),c=this._buildArgs([t.toBase58()],i,s||"base64",u),e.next=5,this._rpcRequest("getProgramAccounts",c);case 5:if(l=e.sent,!("error"in(d=Bi(l,Oc(Yi(hl)))))){e.next=9;break}throw new Ac(d.error,"failed to get accounts owned by program ".concat(t.toBase58()));case 9:return e.abrupt("return",d.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"getParsedProgramAccounts",value:(Ne=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"jsonParsed",o),e.next=4,this._rpcRequest("getProgramAccounts",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,Oc(Yi(yl)))))){e.next=8;break}throw new Ac(u.error,"failed to get accounts owned by program ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ne.apply(this,arguments)})},{key:"confirmTransaction",value:(Ae=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=4;break}r=t,e.next=8;break;case 4:if(null===(i=(o=t).abortSignal)||void 0===i||!i.aborted){e.next=7;break}return e.abrupt("return",Promise.reject(o.abortSignal.reason));case 7:r=o.signature;case 8:e.prev=8,a=Bn.decode(r),e.next=15;break;case 12:throw e.prev=12,e.t0=e.catch(8),new Error("signature must be base58 encoded: "+r);case 15:if(Cu(64===a.length,"signature has invalid length"),"string"!=typeof t){e.next=22;break}return e.next=19,this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:n||this.commitment,signature:r});case 19:return e.abrupt("return",e.sent);case 22:if(!("lastValidBlockHeight"in t)){e.next=28;break}return e.next=25,this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:n||this.commitment,strategy:t});case 25:return e.abrupt("return",e.sent);case 28:return e.next=30,this.confirmTransactionUsingDurableNonceStrategy({commitment:n||this.commitment,strategy:t});case 30:return e.abrupt("return",e.sent);case 31:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e,t){return Ae.apply(this,arguments)})},{key:"getCancellationPromise",value:function(e){return new Promise((function(t,n){null!=e&&(e.aborted?n(e.reason):e.addEventListener("abort",(function(){n(e.reason)})))}))}},{key:"getTransactionConfirmationPromise",value:function(e){var t,n,r=this,i=e.commitment,o=e.signature,a=!1;return{abortConfirmation:function(){n&&(n(),n=void 0),null!=t&&(r.removeSignatureListener(t),t=void 0)},confirmationPromise:new Promise((function(e,s){try{t=r.onSignature(o,(function(n,r){t=void 0;var i={context:r,value:n};e({__type:Du.PROCESSED,response:i})}),i);var u=new Promise((function(e){null==t?e():n=r._onSubscriptionStateChange(t,(function(t){"subscribed"===t&&e()}))}));R(z().mark((function t(){var n,c,l;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u;case 2:if(!a){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,r.getSignatureStatus(o);case 6:if(n=t.sent,!a){t.next=9;break}return t.abrupt("return");case 9:if(null!=n){t.next=11;break}return t.abrupt("return");case 11:if(c=n.context,null!=(l=n.value)){t.next=14;break}return t.abrupt("return");case 14:if(null==l||!l.err){t.next=18;break}s(l.err),t.next=29;break;case 18:t.t0=i,t.next="confirmed"===t.t0||"single"===t.t0||"singleGossip"===t.t0?21:"finalized"===t.t0||"max"===t.t0||"root"===t.t0?24:("processed"===t.t0||t.t0,27);break;case 21:if("processed"!==l.confirmationStatus){t.next=23;break}return t.abrupt("return");case 23:return t.abrupt("break",27);case 24:if("processed"!==l.confirmationStatus&&"confirmed"!==l.confirmationStatus){t.next=26;break}return t.abrupt("return");case 26:return t.abrupt("break",27);case 27:a=!0,e({__type:Du.PROCESSED,response:{context:c,value:l}});case 29:case"end":return t.stop()}}),t)})))()}catch(e){s(e)}}))}}},{key:"confirmTransactionUsingBlockHeightExceedanceStrategy",value:(Me=R(z().mark((function e(t){var n,r,i,o,a,s,u,c,l,d,h,p,f,y=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.strategy,i=r.abortSignal,o=r.lastValidBlockHeight,a=r.signature,s=!1,u=new Promise((function(e){var t=function(){var e=R(z().mark((function e(){var t;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,y.getBlockHeight(n);case 3:return t=e.sent,e.abrupt("return",t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",-1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();R(z().mark((function n(){var r;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t();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,ec(1e3);case 8:if(!s){n.next=10;break}return n.abrupt("return");case 10:return n.next=12,t();case 12:if(r=n.sent,!s){n.next=15;break}return n.abrupt("return");case 15:n.next=5;break;case 17:e({__type:Du.BLOCKHEIGHT_EXCEEDED});case 18:case"end":return n.stop()}}),n)})))()})),c=this.getTransactionConfirmationPromise({commitment:n,signature:a}),l=c.abortConfirmation,d=c.confirmationPromise,h=this.getCancellationPromise(i),e.prev=5,e.next=8,Promise.race([h,d,u]);case 8:if((f=e.sent).__type!==Du.PROCESSED){e.next=13;break}p=f.response,e.next=14;break;case 13:throw new Au(a);case 14:return e.prev=14,s=!0,l(),e.finish(14);case 18:return e.abrupt("return",p);case 19:case"end":return e.stop()}}),e,this,[[5,,14,18]])}))),function(e){return Me.apply(this,arguments)})},{key:"confirmTransactionUsingDurableNonceStrategy",value:(be=R(z().mark((function e(t){var n,r,i,o,a,s,u,c,l,d,h,p,f,y,m,g,v,w,b,M,A,E=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.strategy,i=r.abortSignal,o=r.minContextSlot,a=r.nonceAccountPubkey,s=r.nonceValue,u=r.signature,c=!1,l=new Promise((function(e){var t=s,r=null,i=function(){var e=R(z().mark((function e(){var i,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,E.getNonceAndContext(a,{commitment:n,minContextSlot:o});case 3:return i=e.sent,s=i.context,u=i.value,r=s.slot,e.abrupt("return",null==u?void 0:u.nonce);case 10:return e.prev=10,e.t0=e.catch(0),e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();R(z().mark((function n(){return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i();case 2:if(t=n.sent,!c){n.next=5;break}return n.abrupt("return");case 5:if(s===t){n.next=9;break}return e({__type:Du.NONCE_INVALID,slotInWhichNonceDidAdvance:r}),n.abrupt("return");case 9:return n.next=11,ec(2e3);case 11:if(!c){n.next=13;break}return n.abrupt("return");case 13:return n.next=15,i();case 15:if(t=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)})))()})),d=this.getTransactionConfirmationPromise({commitment:n,signature:u}),h=d.abortConfirmation,p=d.confirmationPromise,f=this.getCancellationPromise(i),e.prev=5,e.next=8,Promise.race([f,p,l]);case 8:if((m=e.sent).__type!==Du.PROCESSED){e.next=13;break}y=m.response,e.next=47;break;case 13:return e.next=16,this.getSignatureStatus(u);case 16:if(null!=(b=e.sent)){e.next=19;break}return e.abrupt("break",27);case 19:if(!(b.context.slot<(null!==(w=m.slotInWhichNonceDidAdvance)&&void 0!==w?w:o))){e.next=23;break}return e.next=22,ec(400);case 22:return e.abrupt("continue",13);case 23:return v=b,e.abrupt("break",27);case 27:if(null===(g=v)||void 0===g||!g.value){e.next=46;break}M=n||"finalized",A=v.value.confirmationStatus,e.t0=M,e.next="processed"===e.t0||"recent"===e.t0?33:"confirmed"===e.t0||"single"===e.t0||"singleGossip"===e.t0?36:"finalized"===e.t0||"max"===e.t0||"root"===e.t0?39:42;break;case 33:if("processed"===A||"confirmed"===A||"finalized"===A){e.next=35;break}throw new Nu(u);case 35:case 38:case 41:return e.abrupt("break",43);case 36:if("confirmed"===A||"finalized"===A){e.next=38;break}throw new Nu(u);case 39:if("finalized"===A){e.next=41;break}throw new Nu(u);case 42:case 43:y={context:v.context,value:{err:v.value.err}},e.next=47;break;case 46:throw new Nu(u);case 47:return e.prev=47,c=!0,h(),e.finish(47);case 51:return e.abrupt("return",y);case 52:case"end":return e.stop()}}),e,this,[[5,,47,51]])}))),function(e){return be.apply(this,arguments)})},{key:"confirmTransactionUsingLegacyTimeoutStrategy",value:(we=R(z().mark((function e(t){var n,r,i,o,a,s,u,c,l,d=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.signature,o=new Promise((function(e){var t=d._confirmTransactionInitialTimeout||6e4;switch(n){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":t=d._confirmTransactionInitialTimeout||3e4}i=setTimeout((function(){return e({__type:Du.TIMED_OUT,timeoutMs:t})}),t)})),a=this.getTransactionConfirmationPromise({commitment:n,signature:r}),s=a.abortConfirmation,u=a.confirmationPromise,e.prev=3,e.next=6,Promise.race([u,o]);case 6:if((l=e.sent).__type!==Du.PROCESSED){e.next=11;break}c=l.response,e.next=12;break;case 11:throw new Eu(r,l.timeoutMs/1e3);case 12:return e.prev=12,clearTimeout(i),s(),e.finish(12);case 16:return e.abrupt("return",c);case 17:case"end":return e.stop()}}),e,this,[[3,,12,16]])}))),function(e){return we.apply(this,arguments)})},{key:"getClusterNodes",value:(ve=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getClusterNodes",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,Oc(Yi(Ll)))))){e.next=6;break}throw new Ac(n.error,"failed to get cluster nodes");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return ve.apply(this,arguments)})},{key:"getVoteAccounts",value:(ge=R(z().mark((function e(t){var n,r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getVoteAccounts",n);case 3:if(r=e.sent,!("error"in(i=Bi(r,Sl)))){e.next=7;break}throw new Ac(i.error,"failed to get vote accounts");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return ge.apply(this,arguments)})},{key:"getSlot",value:(me=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getSlot",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,Oc(qi()))))){e.next=8;break}throw new Ac(s.error,"failed to get slot");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return me.apply(this,arguments)})},{key:"getSlotLeader",value:(ye=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getSlotLeader",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,Oc(Xi()))))){e.next=8;break}throw new Ac(s.error,"failed to get slot leader");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ye.apply(this,arguments)})},{key:"getSlotLeaders",value:(fe=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[t,n],e.next=3,this._rpcRequest("getSlotLeaders",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,Oc(Yi(Lc)))))){e.next=7;break}throw new Ac(o.error,"failed to get slot leaders");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return fe.apply(this,arguments)})},{key:"getSignatureStatus",value:(pe=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignatureStatuses([t],n);case 2:return r=e.sent,i=r.context,Cu(1===(o=r.value).length),a=o[0],e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return pe.apply(this,arguments)})},{key:"getSignatureStatuses",value:(he=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[t],n&&r.push(n),e.next=4,this._rpcRequest("getSignatureStatuses",r);case 4:if(i=e.sent,!("error"in(o=Bi(i,Dl)))){e.next=8;break}throw new Ac(o.error,"failed to get signature status");case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return he.apply(this,arguments)})},{key:"getTransactionCount",value:(de=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getTransactionCount",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,Oc(qi()))))){e.next=8;break}throw new Ac(s.error,"failed to get transaction count");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"getTotalSupply",value:(le=R(z().mark((function e(t){var n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0});case 2:return n=e.sent,e.abrupt("return",n.value.total);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"getInflationGovernor",value:(ce=R(z().mark((function e(t){var n,r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getInflationGovernor",n);case 3:if(r=e.sent,!("error"in(i=Bi(r,Xc)))){e.next=7;break}throw new Ac(i.error,"failed to get inflation");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"getInflationReward",value:(ue=R(z().mark((function e(t,n,r){var i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=jc(r),o=i.commitment,a=i.config,s=this._buildArgs([t.map((function(e){return e.toBase58()}))],o,void 0,O(O({},a),{},{epoch:null!=n?n:null==a?void 0:a.epoch})),e.next=4,this._rpcRequest("getInflationReward",s);case 4:if(u=e.sent,!("error"in(c=Bi(u,Bc)))){e.next=8;break}throw new Ac(c.error,"failed to get inflation reward");case 8:return e.abrupt("return",c.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ue.apply(this,arguments)})},{key:"getInflationRate",value:(se=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getInflationRate",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,Kc)))){e.next=6;break}throw new Ac(n.error,"failed to get inflation rate");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return se.apply(this,arguments)})},{key:"getEpochInfo",value:(ae=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getEpochInfo",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,el)))){e.next=8;break}throw new Ac(s.error,"failed to get epoch info");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ae.apply(this,arguments)})},{key:"getEpochSchedule",value:(oe=R(z().mark((function e(){var t,n,r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getEpochSchedule",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,tl)))){e.next=6;break}throw new Ac(n.error,"failed to get epoch schedule");case 6:return r=n.result,e.abrupt("return",new bc(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot));case 8:case"end":return e.stop()}}),e,this)}))),function(){return oe.apply(this,arguments)})},{key:"getLeaderSchedule",value:(ie=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getLeaderSchedule",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,nl)))){e.next=6;break}throw new Ac(n.error,"failed to get leader schedule");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return ie.apply(this,arguments)})},{key:"getMinimumBalanceForRentExemption",value:(re=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t],n),e.next=3,this._rpcRequest("getMinimumBalanceForRentExemption",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,Ol)))){e.next=8;break}return console.warn("Unable to fetch minimum balance for rent exemption"),e.abrupt("return",0);case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return re.apply(this,arguments)})},{key:"getRecentBlockhashAndContext",value:(ne=R(z().mark((function e(t){var n,r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getRecentBlockhash",n);case 3:if(r=e.sent,!("error"in(i=Bi(r,od)))){e.next=7;break}throw new Ac(i.error,"failed to get recent blockhash");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"getRecentPerformanceSamples",value:(te=R(z().mark((function e(t){var n,r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]);case 2:if(n=e.sent,!("error"in(r=Bi(n,sd)))){e.next=6;break}throw new Ac(r.error,"failed to get recent performance samples");case 6:return e.abrupt("return",r.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return te.apply(this,arguments)})},{key:"getFeeCalculatorForBlockhash",value:(K=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t],n),e.next=3,this._rpcRequest("getFeeCalculatorForBlockhash",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,ud)))){e.next=7;break}throw new Ac(o.error,"failed to get fee calculator");case 7:return a=o.result,s=a.context,u=a.value,e.abrupt("return",{context:s,value:null!==u?u.feeCalculator:null});case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return K.apply(this,arguments)})},{key:"getFeeForMessage",value:(X=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=lu(t.serialize()).toString("base64"),i=this._buildArgs([r],n),e.next=4,this._rpcRequest("getFeeForMessage",i);case 4:if(o=e.sent,!("error"in(a=Bi(o,zc(Gi(qi())))))){e.next=8;break}throw new Ac(a.error,"failed to get fee for message");case 8:if(null!==a.result){e.next=10;break}throw new Error("invalid blockhash");case 10:return e.abrupt("return",a.result);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"getRecentPrioritizationFees",value:(J=R(z().mark((function e(t){var n,r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=null==t||null===(n=t.lockedWritableAccounts)||void 0===n?void 0:n.map((function(e){return e.toBase58()})),i=this._buildArgs(null!=r&&r.length?[r]:[]),e.next=4,this._rpcRequest("getRecentPrioritizationFees",i);case 4:if(o=e.sent,!("error"in(a=Bi(o,$c)))){e.next=8;break}throw new Ac(a.error,"failed to get recent prioritization fees");case 8:return e.abrupt("return",a.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return J.apply(this,arguments)})},{key:"getRecentBlockhash",value:(q=R(z().mark((function e(t){var n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getRecentBlockhashAndContext(t);case 3:return n=e.sent,e.abrupt("return",n.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get recent blockhash: "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return q.apply(this,arguments)})},{key:"getLatestBlockhash",value:(G=R(z().mark((function e(t){var n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getLatestBlockhashAndContext(t);case 3:return n=e.sent,e.abrupt("return",n.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get recent blockhash: "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return G.apply(this,arguments)})},{key:"getLatestBlockhashAndContext",value:(H=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getLatestBlockhash",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,ad)))){e.next=8;break}throw new Ac(s.error,"failed to get latest blockhash");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"getVersion",value:(V=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getVersion",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,Oc(qc))))){e.next=6;break}throw new Ac(n.error,"failed to get version");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return V.apply(this,arguments)})},{key:"getGenesisHash",value:(F=R(z().mark((function e(){var t,n;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getGenesisHash",[]);case 2:if(t=e.sent,!("error"in(n=Bi(t,Oc(Xi()))))){e.next=6;break}throw new Ac(n.error,"failed to get genesis hash");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return F.apply(this,arguments)})},{key:"getBlock",value:(Y=R(z().mark((function e(t,n){var r,i,o,a,s,u,c,l,d;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,void 0,o),e.next=4,this._rpcRequest("getBlock",a);case 4:s=e.sent,e.prev=5,e.t0=null==o?void 0:o.transactionDetails,e.next="accounts"===e.t0?9:"none"===e.t0?13:17;break;case 9:if(!("error"in(u=Bi(s,Xl)))){e.next=12;break}throw u.error;case 12:return e.abrupt("return",u.result);case 13:if(!("error"in(c=Bi(s,Jl)))){e.next=16;break}throw c.error;case 16:return e.abrupt("return",c.result);case 17:if(!("error"in(l=Bi(s,Zl)))){e.next=20;break}throw l.error;case 20:return d=l.result,e.abrupt("return",d?O(O({},d),{},{transactions:d.transactions.map((function(e){var t=e.transaction,n=e.meta,r=e.version;return{meta:n,transaction:O(O({},t),{},{message:Pc(r,t.message)}),version:r}}))}):null);case 22:e.next=27;break;case 24:throw e.prev=24,e.t1=e.catch(5),new Ac(e.t1,"failed to get confirmed block");case 27:case"end":return e.stop()}}),e,this,[[5,24]])}))),function(e,t){return Y.apply(this,arguments)})},{key:"getParsedBlock",value:(Q=R(z().mark((function e(t,n){var r,i,o,a,s,u,c,l;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,"jsonParsed",o),e.next=4,this._rpcRequest("getBlock",a);case 4:s=e.sent,e.prev=5,e.t0=null==o?void 0:o.transactionDetails,e.next="accounts"===e.t0?9:"none"===e.t0?13:17;break;case 9:if(!("error"in(u=Bi(s,$l)))){e.next=12;break}throw u.error;case 12:return e.abrupt("return",u.result);case 13:if(!("error"in(c=Bi(s,ed)))){e.next=16;break}throw c.error;case 16:return e.abrupt("return",c.result);case 17:if(!("error"in(l=Bi(s,Kl)))){e.next=20;break}throw l.error;case 20:return e.abrupt("return",l.result);case 21:e.next=26;break;case 23:throw e.prev=23,e.t1=e.catch(5),new Ac(e.t1,"failed to get block");case 26:case"end":return e.stop()}}),e,this,[[5,23]])}))),function(e,t){return Q.apply(this,arguments)})},{key:"getBlockProduction",value:(U=R(z().mark((function e(t){var n,r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof t?r=t:t&&(i=t.commitment,o=Z(t,nu),r=i,n=o),a=this._buildArgs([],r,"base64",n),e.next=4,this._rpcRequest("getBlockProduction",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,Jc)))){e.next=8;break}throw new Ac(u.error,"failed to get block production information");case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return U.apply(this,arguments)})},{key:"getTransaction",value:(P=R(z().mark((function e(t,n){var r,i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,void 0,o),e.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,rd)))){e.next=8;break}throw new Ac(u.error,"failed to get transaction");case 8:if(c=u.result){e.next=11;break}return e.abrupt("return",c);case 11:return e.abrupt("return",O(O({},c),{},{transaction:O(O({},c.transaction),{},{message:Pc(c.version,c.transaction.message)})}));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return P.apply(this,arguments)})},{key:"getParsedTransaction",value:(D=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,"jsonParsed",o),e.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=e.sent,!("error"in(u=Bi(s,id)))){e.next=8;break}throw new Ac(u.error,"failed to get transaction");case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return D.apply(this,arguments)})},{key:"getParsedTransactions",value:(C=R(z().mark((function e(t,n){var r,i,o,a,s,u,c=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=t.map((function(e){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([e],i,"jsonParsed",o)}})),e.next=4,this._rpcBatchRequest(a);case 4:return s=e.sent,u=s.map((function(e){var t=Bi(e,id);if("error"in t)throw new Ac(t.error,"failed to get transactions");return t.result})),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"getTransactions",value:(j=R(z().mark((function e(t,n){var r,i,o,a,s,u,c=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=jc(n),i=r.commitment,o=r.config,a=t.map((function(e){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([e],i,void 0,o)}})),e.next=4,this._rpcBatchRequest(a);case 4:return s=e.sent,u=s.map((function(e){var t=Bi(e,rd);if("error"in t)throw new Ac(t.error,"failed to get transactions");var n=t.result;return n?O(O({},n),{},{transaction:O(O({},n.transaction),{},{message:Pc(n.version,n.transaction.message)})}):n})),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"getConfirmedBlock",value:(S=R(z().mark((function e(t,n){var r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n),e.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,td)))){e.next=7;break}throw new Ac(o.error,"failed to get confirmed block");case 7:if(a=o.result){e.next=10;break}throw new Error("Confirmed block "+t+" not found");case 10:return s=O(O({},a),{},{transactions:a.transactions.map((function(e){var t=e.transaction,n=e.meta,r=new zu(t.message);return{meta:n,transaction:O(O({},t),{},{message:r})}}))}),e.abrupt("return",O(O({},s),{},{transactions:s.transactions.map((function(e){var t=e.transaction;return{meta:e.meta,transaction:Uu.populate(t.message,t.signatures)}}))}));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"getBlocks",value:(x=R(z().mark((function e(t,n,r){var i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed(void 0!==n?[t,n]:[t],r),e.next=3,this._rpcRequest("getBlocks",i);case 3:if(o=e.sent,!("error"in(a=Bi(o,Oc(Yi(qi())))))){e.next=7;break}throw new Ac(a.error,"failed to get blocks");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return x.apply(this,arguments)})},{key:"getBlockSignatures",value:(L=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,void 0,{transactionDetails:"signatures",rewards:!1}),e.next=3,this._rpcRequest("getBlock",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,nd)))){e.next=7;break}throw new Ac(o.error,"failed to get block");case 7:if(a=o.result){e.next=10;break}throw new Error("Block "+t+" not found");case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return L.apply(this,arguments)})},{key:"getConfirmedBlockSignatures",value:(k=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,void 0,{transactionDetails:"signatures",rewards:!1}),e.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,nd)))){e.next=7;break}throw new Ac(o.error,"failed to get confirmed block");case 7:if(a=o.result){e.next=10;break}throw new Error("Confirmed block "+t+" not found");case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"getConfirmedTransaction",value:(I=R(z().mark((function e(t,n){var r,i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n),e.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,rd)))){e.next=7;break}throw new Ac(o.error,"failed to get transaction");case 7:if(a=o.result){e.next=10;break}return e.abrupt("return",a);case 10:return s=new zu(a.transaction.message),u=a.transaction.signatures,e.abrupt("return",O(O({},a),{},{transaction:Uu.populate(s,u)}));case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"getParsedConfirmedTransaction",value:(T=R(z().mark((function e(t,n){var r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed"),e.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=e.sent,!("error"in(o=Bi(i,id)))){e.next=7;break}throw new Ac(o.error,"failed to get confirmed transaction");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"getParsedConfirmedTransactions",value:(N=R(z().mark((function e(t,n){var r,i,o,a=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.map((function(e){return{methodName:"getConfirmedTransaction",args:a._buildArgsAtLeastConfirmed([e],n,"jsonParsed")}})),e.next=3,this._rpcBatchRequest(r);case 3:return i=e.sent,o=i.map((function(e){var t=Bi(e,id);if("error"in t)throw new Ac(t.error,"failed to get confirmed transactions");return t.result})),e.abrupt("return",o);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return N.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress",value:(E=R(z().mark((function e(t,n,r){var i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={},e.next=3,this.getFirstAvailableBlock();case 3:o=e.sent;case 4:if("until"in i){e.next=24;break}if(!(--n<=0||n<o)){e.next=8;break}return e.abrupt("break",24);case 8:return e.prev=8,e.next=11,this.getConfirmedBlockSignatures(n,"finalized");case 11:(a=e.sent).signatures.length>0&&(i.until=a.signatures[a.signatures.length-1].toString()),e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(8),!(e.t0 instanceof Error&&e.t0.message.includes("skipped"))){e.next=21;break}return e.abrupt("continue",4);case 21:throw e.t0;case 22:e.next=4;break;case 24:return e.next=26,this.getSlot("finalized");case 26:s=e.sent;case 27:if("before"in i){e.next=47;break}if(!(++r>s)){e.next=31;break}return e.abrupt("break",47);case 31:return e.prev=31,e.next=34,this.getConfirmedBlockSignatures(r);case 34:(u=e.sent).signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString()),e.next=45;break;case 38:if(e.prev=38,e.t1=e.catch(31),!(e.t1 instanceof Error&&e.t1.message.includes("skipped"))){e.next=44;break}return e.abrupt("continue",27);case 44:throw e.t1;case 45:e.next=27;break;case 47:return e.next=49,this.getConfirmedSignaturesForAddress2(t,i);case 49:return c=e.sent,e.abrupt("return",c.map((function(e){return e.signature})));case 51:case"end":return e.stop()}}),e,this,[[8,15],[31,38]])}))),function(e,t,n){return E.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress2",value:(A=R(z().mark((function e(t,n,r){var i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,n),e.next=3,this._rpcRequest("getConfirmedSignaturesForAddress2",i);case 3:if(o=e.sent,!("error"in(a=Bi(o,gl)))){e.next=7;break}throw new Ac(a.error,"failed to get confirmed signatures for address");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return A.apply(this,arguments)})},{key:"getSignaturesForAddress",value:(M=R(z().mark((function e(t,n,r){var i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,n),e.next=3,this._rpcRequest("getSignaturesForAddress",i);case 3:if(o=e.sent,!("error"in(a=Bi(o,vl)))){e.next=7;break}throw new Ac(a.error,"failed to get signatures for address");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return M.apply(this,arguments)})},{key:"getAddressLookupTable",value:(b=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAccountInfoAndContext(t,n);case 2:return r=e.sent,i=r.context,o=r.value,a=null,null!==o&&(a=new Tc({key:t,state:Tc.deserialize(o.data)})),e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"getNonceAndContext",value:(w=R(z().mark((function e(t,n){var r,i,o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAccountInfoAndContext(t,n);case 2:return r=e.sent,i=r.context,o=r.value,a=null,null!==o&&(a=sc.fromAccountData(o.data)),e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"getNonce",value:(v=R(z().mark((function e(t,n){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getNonceAndContext(t,n).then((function(e){return e.value})).catch((function(e){throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"requestAirdrop",value:(g=R(z().mark((function e(t,n){var r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("requestAirdrop",[t.toBase58(),n]);case 2:if(r=e.sent,!("error"in(i=Bi(r,cd)))){e.next=6;break}throw new Ac(i.error,"airdrop to ".concat(t.toBase58()," failed"));case 6:return e.abrupt("return",i.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"_blockhashWithExpiryBlockHeight",value:(m=R(z().mark((function e(t){var n,r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=10;break}case 1:if(!this._pollingBlockhash){e.next=6;break}return e.next=4,ec(100);case 4:e.next=1;break;case 6:if(n=Date.now()-this._blockhashInfo.lastFetch,r=n>=3e4,null===this._blockhashInfo.latestBlockhash||r){e.next=10;break}return e.abrupt("return",this._blockhashInfo.latestBlockhash);case 10:return e.next=12,this._pollNewBlockhash();case 12:return e.abrupt("return",e.sent);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"_pollNewBlockhash",value:(y=R(z().mark((function e(){var t,n,r,i,o;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._pollingBlockhash=!0,e.prev=1,t=Date.now(),n=this._blockhashInfo.latestBlockhash,r=n?n.blockhash:null,i=0;case 6:if(!(i<50)){e.next=18;break}return e.next=9,this.getLatestBlockhash("finalized");case 9:if(o=e.sent,r===o.blockhash){e.next=13;break}return this._blockhashInfo={latestBlockhash:o,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e.abrupt("return",o);case 13:return e.next=15,ec(200);case 15:i++,e.next=6;break;case 18:throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-t,"ms"));case 19:return e.prev=19,this._pollingBlockhash=!1,e.finish(19);case 22:case"end":return e.stop()}}),e,this,[[1,,19,22]])}))),function(){return y.apply(this,arguments)})},{key:"getStakeMinimumDelegation",value:(f=R(z().mark((function e(t){var n,r,i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=jc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,"base64",i),e.next=4,this._rpcRequest("getStakeMinimumDelegation",o);case 4:if(a=e.sent,!("error"in(s=Bi(a,zc(qi()))))){e.next=8;break}throw new Ac(s.error,"failed to get stake minimum delegation");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"simulateTransaction",value:(p=R(z().mark((function e(t,n,r){var i,o,a,s,u,c,l,d,h,p,f,y,m,g,v,w,b,M,A,E,N,T,I,k,L,x;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("message"in t)){e.next=17;break}if(i=t.serialize(),o=Ee.from(i).toString("base64"),!Array.isArray(n)&&void 0===r){e.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],e.next=12,this._rpcRequest("simulateTransaction",s);case 12:if(u=e.sent,!("error"in(c=Bi(u,Zc)))){e.next=16;break}throw new Error("failed to simulate transaction: "+c.error.message);case 16:return e.abrupt("return",c.result);case 17:if(t instanceof Uu?(d=t,(l=new Uu).feePayer=d.feePayer,l.instructions=t.instructions,l.nonceInfo=d.nonceInfo,l.signatures=d.signatures):(l=Uu.populate(t))._message=l._json=void 0,void 0===n||Array.isArray(n)){e.next=20;break}throw new Error("Invalid arguments");case 20:if(h=n,!l.nonceInfo||!h){e.next=25;break}(p=l).sign.apply(p,ee(h)),e.next=45;break;case 25:f=this._disableBlockhashCaching;case 26:return e.next=28,this._blockhashWithExpiryBlockHeight(f);case 28:if(m=e.sent,l.lastValidBlockHeight=m.lastValidBlockHeight,l.recentBlockhash=m.blockhash,h){e.next=33;break}return e.abrupt("break",45);case 33:if((y=l).sign.apply(y,ee(h)),l.signature){e.next=36;break}throw new Error("!signature");case 36:if(g=l.signature.toString("base64"),this._blockhashInfo.simulatedSignatures.includes(g)||this._blockhashInfo.transactionSignatures.includes(g)){e.next=42;break}return this._blockhashInfo.simulatedSignatures.push(g),e.abrupt("break",45);case 42:f=!0;case 43:e.next=26;break;case 45:return v=l._compile(),w=v.serialize(),b=l._serialize(w),M=b.toString("base64"),A={encoding:"base64",commitment:this.commitment},r&&(E=(Array.isArray(r)?r:v.nonProgramIds()).map((function(e){return e.toBase58()})),A.accounts={encoding:"base64",addresses:E}),h&&(A.sigVerify=!0),N=[M,A],e.next=55,this._rpcRequest("simulateTransaction",N);case 55:if(T=e.sent,!("error"in(I=Bi(T,Zc)))){e.next=60;break}throw"data"in I.error&&(k=I.error.data.logs)&&Array.isArray(k)&&(x=(L="\n ")+k.join(L),console.error(I.error.message,x)),new Mc("failed to simulate transaction: "+I.error.message,k);case 60:return e.abrupt("return",I.result);case 61:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"sendTransaction",value:(h=R(z().mark((function e(t,n,r){var i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("version"in t)){e.next=7;break}if(!n||!Array.isArray(n)){e.next=3;break}throw new Error("Invalid arguments");case 3:return i=t.serialize(),e.next=6,this.sendRawTransaction(i,n);case 6:return e.abrupt("return",e.sent);case 7:if(void 0!==n&&Array.isArray(n)){e.next=9;break}throw new Error("Invalid arguments");case 9:if(o=n,!t.nonceInfo){e.next=14;break}t.sign.apply(t,ee(o)),e.next=32;break;case 14:a=this._disableBlockhashCaching;case 15:return e.next=17,this._blockhashWithExpiryBlockHeight(a);case 17:if(s=e.sent,t.lastValidBlockHeight=s.lastValidBlockHeight,t.recentBlockhash=s.blockhash,t.sign.apply(t,ee(o)),t.signature){e.next=23;break}throw new Error("!signature");case 23:if(u=t.signature.toString("base64"),this._blockhashInfo.transactionSignatures.includes(u)){e.next=29;break}return this._blockhashInfo.transactionSignatures.push(u),e.abrupt("break",32);case 29:a=!0;case 30:e.next=15;break;case 32:return c=t.serialize(),e.next=35,this.sendRawTransaction(c,r);case 35:return e.abrupt("return",e.sent);case 36:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return h.apply(this,arguments)})},{key:"sendRawTransaction",value:(d=R(z().mark((function e(t,n){var r,i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=lu(t).toString("base64"),e.next=3,this.sendEncodedTransaction(r,n);case 3:return i=e.sent,e.abrupt("return",i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"sendEncodedTransaction",value:(l=R(z().mark((function e(t,n){var r,i,o,a,s,u,c;return z().wrap((function(e){for(;;)switch(e.prev=e.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=[t,r],e.next=10,this._rpcRequest("sendTransaction",a);case 10:if(s=e.sent,!("error"in(u=Bi(s,ld)))){e.next=15;break}throw"data"in u.error&&(c=u.error.data.logs),new Mc("failed to send transaction: "+u.error.message,c);case 15:return e.abrupt("return",u.result);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"_wsOnOpen",value:function(){var e=this;this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((function(){R(z().mark((function t(){return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._rpcWebSocket.notify("ping");case 3:t.next=7;break;case 5:t.prev=5,t.t0=t.catch(0);case 7:case"end":return t.stop()}}),t,null,[[0,5]])})))()}),5e3),this._updateSubscriptions()}},{key:"_wsOnError",value:function(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}},{key:"_wsOnClose",value:function(e){var t=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!==e?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((function(e){var n=$(e,2),r=n[0],i=n[1];t._setSubscription(r,O(O({},i),{},{state:"pending"}))}))):this._updateSubscriptions()}},{key:"_setSubscription",value:function(e,t){var n,r=null===(n=this._subscriptionsByHash[e])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[e]=t,r!==t.state){var i=this._subscriptionStateChangeCallbacksByHash[e];i&&i.forEach((function(e){try{e(t.state)}catch(e){}}))}}},{key:"_onSubscriptionStateChange",value:function(e,t){var n,r=this,i=this._subscriptionHashByClientSubscriptionId[e];if(null==i)return function(){};var o=(n=this._subscriptionStateChangeCallbacksByHash)[i]||(n[i]=new Set);return o.add(t),function(){o.delete(t),0===o.size&&delete r._subscriptionStateChangeCallbacksByHash[i]}}},{key:"_updateSubscriptions",value:(c=R(z().mark((function e(){var t,n,r=this;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==Object.keys(this._subscriptionsByHash).length){e.next=3;break}return this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((function(){r._rpcWebSocketIdleTimeout=null;try{r._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log("Error when closing socket connection: ".concat(e.message))}}),500)),e.abrupt("return");case 3:if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),this._rpcWebSocketConnected){e.next=7;break}return this._rpcWebSocket.connect(),e.abrupt("return");case 7:return t=this._rpcWebSocketGeneration,n=function(){return t===r._rpcWebSocketGeneration},e.next=11,Promise.all(Object.keys(this._subscriptionsByHash).map(function(){var e=R(z().mark((function e(t){var i;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(i=r._subscriptionsByHash[t])){e.next=3;break}return e.abrupt("return");case 3:e.t0=i.state,e.next="pending"===e.t0||"unsubscribed"===e.t0?6:"subscribed"===e.t0?15:19;break;case 6:if(0!==i.callbacks.size){e.next=12;break}return delete r._subscriptionsByHash[t],"unsubscribed"===i.state&&delete r._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],e.next=11,r._updateSubscriptions();case 11:return e.abrupt("return");case 12:return e.next=14,R(z().mark((function e(){var o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i.args,a=i.method,e.prev=1,r._setSubscription(t,O(O({},i),{},{state:"subscribing"})),e.next=5,r._rpcWebSocket.call(a,o);case 5:return s=e.sent,r._setSubscription(t,O(O({},i),{},{serverSubscriptionId:s,state:"subscribed"})),r._subscriptionCallbacksByServerSubscriptionId[s]=i.callbacks,e.next=10,r._updateSubscriptions();case 10:e.next=20;break;case 12:if(e.prev=12,e.t0=e.catch(1),e.t0 instanceof Error&&console.error("".concat(a," error for argument"),o,e.t0.message),n()){e.next=17;break}return e.abrupt("return");case 17:return r._setSubscription(t,O(O({},i),{},{state:"pending"})),e.next=20,r._updateSubscriptions();case 20:case"end":return e.stop()}}),e,null,[[1,12]])})))();case 14:case 18:return e.abrupt("break",19);case 15:if(0!==i.callbacks.size){e.next=18;break}return e.next=18,R(z().mark((function e(){var o,a;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=i.serverSubscriptionId,a=i.unsubscribeMethod,!r._subscriptionsAutoDisposedByRpc.has(o)){e.next=5;break}r._subscriptionsAutoDisposedByRpc.delete(o),e.next=21;break;case 5:return r._setSubscription(t,O(O({},i),{},{state:"unsubscribing"})),r._setSubscription(t,O(O({},i),{},{state:"unsubscribing"})),e.prev=7,e.next=10,r._rpcWebSocket.call(a,[o]);case 10:e.next=21;break;case 12:if(e.prev=12,e.t0=e.catch(7),e.t0 instanceof Error&&console.error("".concat(a," error:"),e.t0.message),n()){e.next=17;break}return e.abrupt("return");case 17:return r._setSubscription(t,O(O({},i),{},{state:"subscribed"})),e.next=20,r._updateSubscriptions();case 20:return e.abrupt("return");case 21:return r._setSubscription(t,O(O({},i),{},{state:"unsubscribed"})),e.next=24,r._updateSubscriptions();case 24:case"end":return e.stop()}}),e,null,[[7,12]])})))();case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 11:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"_handleServerNotification",value:function(e,t){var n=this._subscriptionCallbacksByServerSubscriptionId[e];void 0!==n&&n.forEach((function(e){try{e.apply(void 0,ee(t))}catch(e){console.error(e)}}))}},{key:"_wsOnAccountNotification",value:function(e){var t=Bi(e,wl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_makeSubscription",value:function(e,t){var n=this,r=this._nextClientSubscriptionId++,i=vc([e.method,t]),o=this._subscriptionsByHash[i];return void 0===o?this._subscriptionsByHash[i]=O(O({},e),{},{args:t,callbacks:new Set([e.callback]),state:"pending"}):o.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=R(z().mark((function t(){var o;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return delete n._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete n._subscriptionHashByClientSubscriptionId[r],Cu(void 0!==(o=n._subscriptionsByHash[i]),"Could not find a `Subscription` when tearing down client subscription #".concat(r)),o.callbacks.delete(e.callback),t.next=7,n._updateSubscriptions();case 7:case"end":return t.stop()}}),t)}))),this._updateSubscriptions(),r}},{key:"onAccountChange",value:function(e,t,n){var r=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}},{key:"removeAccountChangeListener",value:(u=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"account change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"_wsOnProgramAccountNotification",value:function(e){var t=Bi(e,Ml),n=t.result,r=t.subscription;this._handleServerNotification(r,[{accountId:n.value.pubkey,accountInfo:n.value.account},n.context])}},{key:"onProgramAccountChange",value:function(e,t,n,r){var i=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}},{key:"removeProgramAccountChangeListener",value:(s=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"program account change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"onLogs",value:function(e,t,n){var r=this._buildArgs(["object"===_(e)?{mentions:[e.toString()]}:e],n||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}},{key:"removeOnLogsListener",value:(a=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"logs");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"_wsOnLogsNotification",value:function(e){var t=Bi(e,hd),n=t.result,r=t.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_wsOnSlotNotification",value:function(e){var t=Bi(e,El),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotChange",value:function(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}},{key:"removeSlotChangeListener",value:(o=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"slot change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"_wsOnSlotUpdatesNotification",value:function(e){var t=Bi(e,Tl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotUpdate",value:function(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}},{key:"removeSlotUpdateListener",value:(i=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"slot update");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_unsubscribeClientSubscription",value:(r=R(z().mark((function e(t,n){var r;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this._subscriptionDisposeFunctionsByClientSubscriptionId[t])){e.next=6;break}return e.next=4,r();case 4:e.next=7;break;case 6:console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(t,"` for '").concat(n,"' events ")+"could not be found.");case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_buildArgs",value:function(e,t,n,r){var i=t||this._commitment;if(i||n||r){var o={};n&&(o.encoding=n),i&&(o.commitment=i),r&&(o=Object.assign(o,r)),e.push(o)}return e}},{key:"_buildArgsAtLeastConfirmed",value:function(e,t,n,r){var i=t||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(e,t,n,r)}},{key:"_wsOnSignatureNotification",value:function(e){var t=Bi(e,Il),n=t.result,r=t.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(e,t,n){var r=this,i=this._buildArgs([e],n||this._commitment||"finalized"),o=this._makeSubscription({callback:function(e,n){if("status"===e.type){t(e.result,n);try{r.removeSignatureListener(o)}catch(e){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return o}},{key:"onSignatureWithOptions",value:function(e,t,n){var r=this,i=O(O({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),o=i.commitment,a=Z(i,ru),s=this._buildArgs([e],o,void 0,a),u=this._makeSubscription({callback:function(e,n){t(e,n);try{r.removeSignatureListener(u)}catch(e){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return u}},{key:"removeSignatureListener",value:(n=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"signature result");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_wsOnRootNotification",value:function(e){var t=Bi(e,kl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onRootChange",value:function(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}},{key:"removeRootChangeListener",value:(t=R(z().mark((function e(t){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"root change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}(),yd=function(){function e(t){B(this,e),this._keypair=void 0,this._keypair=null!=t?t:ou()}return W(e,[{key:"publicKey",get:function(){return new mu(this._keypair.publicKey)}},{key:"secretKey",get:function(){return new Uint8Array(this._keypair.secretKey)}}],[{key:"generate",value:function(){return new e(ou())}},{key:"fromSecretKey",value:function(t,n){if(64!==t.byteLength)throw new Error("bad secret key size");var r=t.slice(32,64);if(!n||!n.skipValidation)for(var i=t.slice(0,32),o=au(i),a=0;a<32;a++)if(r[a]!==o[a])throw new Error("provided secretKey is invalid");return new e({publicKey:r,secretKey:t})}},{key:"fromSeed",value:function(t){var n=au(t),r=new Uint8Array(64);return r.set(t),r.set(n,32),new e({publicKey:n,secretKey:r})}}]),e}(),md=Object.freeze({CreateLookupTable:{index:0,layout:Mi([vi("instruction"),uc("recentSlot"),mi("bumpSeed")])},FreezeLookupTable:{index:1,layout:Mi([vi("instruction")])},ExtendLookupTable:{index:2,layout:Mi([vi("instruction"),uc(),Ai(Iu(),yi(vi(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Mi([vi("instruction")])},CloseLookupTable:{index:4,layout:Mi([vi("instruction")])}}),gd=function(){function e(){B(this,e)}return W(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=vi("instruction").decode(e.data),r=0,i=Object.entries(md);r<i.length;r++){var o=$(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return t}},{key:"decodeCreateLookupTable",value:function(e){this.checkProgramId(e.programId),this.checkKeysLength(e.keys,4);var t=nc(md.CreateLookupTable,e.data).recentSlot;return{authority:e.keys[1].pubkey,payer:e.keys[2].pubkey,recentSlot:Number(t)}}},{key:"decodeExtendLookupTable",value:function(e){if(this.checkProgramId(e.programId),e.keys.length<2)throw new Error("invalid instruction; found ".concat(e.keys.length," keys, expected at least 2"));var t=nc(md.ExtendLookupTable,e.data).addresses;return{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,payer:e.keys.length>2?e.keys[2].pubkey:void 0,addresses:t.map((function(e){return new mu(e)}))}}},{key:"decodeCloseLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,3),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,recipient:e.keys[2].pubkey}}},{key:"decodeFreezeLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}},{key:"decodeDeactivateLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(vd.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}},{key:"checkKeysLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),vd=function(){function e(){B(this,e)}return W(e,null,[{key:"createLookupTable",value:function(e){var t=$(mu.findProgramAddressSync([e.authority.toBuffer(),Ii(BigInt(e.recentSlot),8)],this.programId),2),n=t[0],r=t[1],i=tc(md.CreateLookupTable,{recentSlot:BigInt(e.recentSlot),bumpSeed:r}),o=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:dc.programId,isSigner:!1,isWritable:!1}];return[new Bu({programId:this.programId,keys:o,data:i}),n]}},{key:"freezeLookupTable",value:function(e){var t=tc(md.FreezeLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new Bu({programId:this.programId,keys:n,data:t})}},{key:"extendLookupTable",value:function(e){var t=tc(md.ExtendLookupTable,{addresses:e.addresses.map((function(e){return e.toBytes()}))}),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&n.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:dc.programId,isSigner:!1,isWritable:!1}),new Bu({programId:this.programId,keys:n,data:t})}},{key:"deactivateLookupTable",value:function(e){var t=tc(md.DeactivateLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new Bu({programId:this.programId,keys:n,data:t})}},{key:"closeLookupTable",value:function(e){var t=tc(md.CloseLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new Bu({programId:this.programId,keys:n,data:t})}}]),e}();vd.programId=new mu("AddressLookupTab1e1111111111111111111111111");var wd=function(){function e(){B(this,e)}return W(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=mi("instruction").decode(e.data),r=0,i=Object.entries(bd);r<i.length;r++){var o=$(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return t}},{key:"decodeRequestUnits",value:function(e){this.checkProgramId(e.programId);var t=nc(bd.RequestUnits,e.data);return{units:t.units,additionalFee:t.additionalFee}}},{key:"decodeRequestHeapFrame",value:function(e){return this.checkProgramId(e.programId),{bytes:nc(bd.RequestHeapFrame,e.data).bytes}}},{key:"decodeSetComputeUnitLimit",value:function(e){return this.checkProgramId(e.programId),{units:nc(bd.SetComputeUnitLimit,e.data).units}}},{key:"decodeSetComputeUnitPrice",value:function(e){return this.checkProgramId(e.programId),{microLamports:nc(bd.SetComputeUnitPrice,e.data).microLamports}}},{key:"checkProgramId",value:function(e){if(!e.equals(Md.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}]),e}(),bd=Object.freeze({RequestUnits:{index:0,layout:Mi([mi("instruction"),vi("units"),vi("additionalFee")])},RequestHeapFrame:{index:1,layout:Mi([mi("instruction"),vi("bytes")])},SetComputeUnitLimit:{index:2,layout:Mi([mi("instruction"),vi("units")])},SetComputeUnitPrice:{index:3,layout:Mi([mi("instruction"),uc("microLamports")])}}),Md=function(){function e(){B(this,e)}return W(e,null,[{key:"requestUnits",value:function(e){var t=tc(bd.RequestUnits,e);return new Bu({keys:[],programId:this.programId,data:t})}},{key:"requestHeapFrame",value:function(e){var t=tc(bd.RequestHeapFrame,e);return new Bu({keys:[],programId:this.programId,data:t})}},{key:"setComputeUnitLimit",value:function(e){var t=tc(bd.SetComputeUnitLimit,e);return new Bu({keys:[],programId:this.programId,data:t})}},{key:"setComputeUnitPrice",value:function(e){var t=tc(bd.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new Bu({keys:[],programId:this.programId,data:t})}}]),e}();Md.programId=new mu("ComputeBudget111111111111111111111111111111");var Ad=Mi([mi("numSignatures"),mi("padding"),gi("signatureOffset"),gi("signatureInstructionIndex"),gi("publicKeyOffset"),gi("publicKeyInstructionIndex"),gi("messageDataOffset"),gi("messageDataSize"),gi("messageInstructionIndex")]),Ed=function(){function e(){B(this,e)}return W(e,null,[{key:"createInstructionWithPublicKey",value:function(t){var n=t.publicKey,r=t.message,i=t.signature,o=t.instructionIndex;Cu(32===n.length,"Public Key must be ".concat(32," bytes but received ").concat(n.length," bytes")),Cu(64===i.length,"Signature must be ".concat(64," bytes but received ").concat(i.length," bytes"));var a=Ad.span,s=a+n.length,u=s+i.length,c=Ee.alloc(u+r.length),l=null==o?65535:o;return Ad.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 Bu({keys:[],programId:e.programId,data:c})}},{key:"createInstructionWithPrivateKey",value:function(e){var t=e.privateKey,n=e.message,r=e.instructionIndex;Cu(64===t.length,"Private key must be ".concat(64," bytes but received ").concat(t.length," bytes"));try{var i=yd.fromSecretKey(t),o=i.publicKey.toBytes(),a=uu(n,i.secretKey);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,instructionIndex:r})}catch(e){throw new Error("Error creating instruction; ".concat(e))}}}]),e}();Ed.programId=new mu("Ed25519SigVerify111111111111111111111111111"),$s.hmacSha256Sync=function(e){for(var t=Xa.create(Hn,e),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(e){return t.update(e)})),t.digest()};$s.isValidPrivateKey;var Nd=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return vs.fromPrivateKey(e).toRawBytes(t)},Td=Mi([mi("numSignatures"),gi("signatureOffset"),mi("signatureInstructionIndex"),gi("ethAddressOffset"),mi("ethAddressInstructionIndex"),gi("messageDataOffset"),gi("messageDataSize"),mi("messageInstructionIndex"),Ei(20,"ethAddress"),Ei(64,"signature"),mi("recoveryId")]),Id=function(){function e(){B(this,e)}return W(e,null,[{key:"publicKeyToEthAddress",value:function(e){Cu(64===e.length,"Public key must be ".concat(64," bytes but received ").concat(e.length," bytes"));try{return Ee.from(qa(lu(e))).slice(-20)}catch(e){throw new Error("Error constructing Ethereum address: ".concat(e))}}},{key:"createInstructionWithPublicKey",value:function(t){var n=t.publicKey,r=t.message,i=t.signature,o=t.recoveryId,a=t.instructionIndex;return e.createInstructionWithEthAddress({ethAddress:e.publicKeyToEthAddress(n),message:r,signature:i,recoveryId:o,instructionIndex:a})}},{key:"createInstructionWithEthAddress",value:function(t){var n,r=t.ethAddress,i=t.message,o=t.signature,a=t.recoveryId,s=t.instructionIndex,u=void 0===s?0:s;Cu(20===(n="string"==typeof r?r.startsWith("0x")?Ee.from(r.substr(2),"hex"):Ee.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,d=Ee.alloc(Td.span+i.length);return Td.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:u,ethAddressOffset:12,ethAddressInstructionIndex:u,messageDataOffset:l,messageDataSize:i.length,messageInstructionIndex:u,signature:lu(o),ethAddress:lu(n),recoveryId:a},d),d.fill(lu(i),Td.span),new Bu({keys:[],programId:e.programId,data:d})}},{key:"createInstructionWithPrivateKey",value:function(e){var t=e.privateKey,n=e.message,r=e.instructionIndex;Cu(32===t.length,"Private key must be ".concat(32," bytes but received ").concat(t.length," bytes"));try{var i=lu(t),o=Nd(i,!1).slice(1),a=Ee.from(qa(lu(n))),s=$(qs(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(e){throw new Error("Error creating instruction; ".concat(e))}}}]),e}();Id.programId=new mu("KeccakSecp256k11111111111111111111111111111");var kd=new mu("StakeConfig11111111111111111111111111111111"),Ld=W((function e(t,n){B(this,e),this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=n})),xd=W((function e(t,n,r){B(this,e),this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=n,this.custodian=r}));xd.default=new xd(0,0,mu.default);var Sd=function(){function e(){B(this,e)}return W(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=vi("instruction").decode(e.data),r=0,i=Object.entries(jd);r<i.length;r++){var o=$(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a StakeInstruction");return t}},{key:"decodeInitialize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(jd.Initialize,e.data),n=t.authorized,r=t.lockup;return{stakePubkey:e.keys[0].pubkey,authorized:new Ld(new mu(n.staker),new mu(n.withdrawer)),lockup:new xd(r.unixTimestamp,r.epoch,new mu(r.custodian))}}},{key:"decodeDelegate",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),nc(jd.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}},{key:"decodeAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(jd.Authorize,e.data),n=t.newAuthorized,r=t.stakeAuthorizationType,i={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new mu(n),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(i.custodianPubkey=e.keys[3].pubkey),i}},{key:"decodeAuthorizeWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=nc(jd.AuthorizeWithSeed,e.data),n=t.newAuthorized,r=t.stakeAuthorizationType,i=t.authoritySeed,o=t.authorityOwner,a={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:i,authorityOwner:new mu(o),newAuthorizedPubkey:new mu(n),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(a.custodianPubkey=e.keys[3].pubkey),a}},{key:"decodeSplit",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(jd.Split,e.data).lamports;return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:t}}},{key:"decodeMerge",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),nc(jd.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}},{key:"decodeWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);var t=nc(jd.Withdraw,e.data).lamports,n={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t};return e.keys.length>5&&(n.custodianPubkey=e.keys[5].pubkey),n}},{key:"decodeDeactivate",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),nc(jd.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(Dd.programId))throw new Error("invalid instruction; programId is not StakeProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),jd=Object.freeze({Initialize:{index:0,layout:Mi([vi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"authorized";return Mi([Iu("staker"),Iu("withdrawer")],e)}(),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return Mi([bi("unixTimestamp"),bi("epoch"),Iu("custodian")],e)}()])},Authorize:{index:1,layout:Mi([vi("instruction"),Iu("newAuthorized"),vi("stakeAuthorizationType")])},Delegate:{index:2,layout:Mi([vi("instruction")])},Split:{index:3,layout:Mi([vi("instruction"),bi("lamports")])},Withdraw:{index:4,layout:Mi([vi("instruction"),bi("lamports")])},Deactivate:{index:5,layout:Mi([vi("instruction")])},Merge:{index:7,layout:Mi([vi("instruction")])},AuthorizeWithSeed:{index:8,layout:Mi([vi("instruction"),Iu("newAuthorized"),vi("stakeAuthorizationType"),Lu("authoritySeed"),Iu("authorityOwner")])}}),Cd=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),Dd=function(){function e(){B(this,e)}return W(e,null,[{key:"initialize",value:function(e){var t=e.stakePubkey,n=e.authorized,r=e.lockup||xd.default,i=tc(jd.Initialize,{authorized:{staker:lu(n.staker.toBuffer()),withdrawer:lu(n.withdrawer.toBuffer())},lockup:{unixTimestamp:r.unixTimestamp,epoch:r.epoch,custodian:lu(r.custodian.toBuffer())}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Gu,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new Bu(o)}},{key:"createAccountWithSeed",value:function(e){var t=new Uu;t.add(dc.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));var n=e.stakePubkey,r=e.authorized,i=e.lockup;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"createAccount",value:function(e){var t=new Uu;t.add(dc.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));var n=e.stakePubkey,r=e.authorized,i=e.lockup;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"delegate",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.votePubkey,i=tc(jd.Delegate);return(new Uu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:Xu,isSigner:!1,isWritable:!1},{pubkey:kd,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"authorize",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.newAuthorizedPubkey,i=e.stakeAuthorizationType,o=e.custodianPubkey,a=tc(jd.Authorize,{newAuthorized:lu(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Uu).add({keys:s,programId:this.programId,data:a})}},{key:"authorizeWithSeed",value:function(e){var t=e.stakePubkey,n=e.authorityBase,r=e.authoritySeed,i=e.authorityOwner,o=e.newAuthorizedPubkey,a=e.stakeAuthorizationType,s=e.custodianPubkey,u=tc(jd.AuthorizeWithSeed,{newAuthorized:lu(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:lu(i.toBuffer())}),c=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:Yu,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new Uu).add({keys:c,programId:this.programId,data:u})}},{key:"splitInstruction",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.splitStakePubkey,i=e.lamports,o=tc(jd.Split,{lamports:i});return new Bu({keys:[{pubkey:t,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(e){var t=new Uu;return t.add(dc.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),t.add(this.splitInstruction(e))}},{key:"splitWithSeed",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.splitStakePubkey,i=e.basePubkey,o=e.seed,a=e.lamports,s=new Uu;return s.add(dc.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:t,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}},{key:"merge",value:function(e){var t=e.stakePubkey,n=e.sourceStakePubKey,r=e.authorizedPubkey,i=tc(jd.Merge);return(new Uu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:Xu,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"withdraw",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.toPubkey,i=e.lamports,o=e.custodianPubkey,a=tc(jd.Withdraw,{lamports:i}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:Xu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new Uu).add({keys:s,programId:this.programId,data:a})}},{key:"deactivate",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=tc(jd.Deactivate);return(new Uu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}]),e}();Dd.programId=new mu("Stake11111111111111111111111111111111111111"),Dd.space=200;var Od=W((function e(t,n,r,i){B(this,e),this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=n,this.authorizedWithdrawer=r,this.commission=i})),zd=function(){function e(){B(this,e)}return W(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=vi("instruction").decode(e.data),r=0,i=Object.entries(_d);r<i.length;r++){var o=$(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a VoteInstruction");return t}},{key:"decodeInitializeAccount",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,4);var t=nc(_d.InitializeAccount,e.data).voteInit;return{votePubkey:e.keys[0].pubkey,nodePubkey:e.keys[3].pubkey,voteInit:new Od(new mu(t.nodePubkey),new mu(t.authorizedVoter),new mu(t.authorizedWithdrawer),t.commission)}}},{key:"decodeAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(_d.Authorize,e.data),n=t.newAuthorized,r=t.voteAuthorizationType;return{votePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new mu(n),voteAuthorizationType:{index:r}}}},{key:"decodeAuthorizeWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(_d.AuthorizeWithSeed,e.data).voteAuthorizeWithSeedArgs,n=t.currentAuthorityDerivedKeyOwnerPubkey,r=t.currentAuthorityDerivedKeySeed,i=t.newAuthorized,o=t.voteAuthorizationType;return{currentAuthorityDerivedKeyBasePubkey:e.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new mu(n),currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:new mu(i),voteAuthorizationType:{index:o},votePubkey:e.keys[0].pubkey}}},{key:"decodeWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=nc(_d.Withdraw,e.data).lamports;return{votePubkey:e.keys[0].pubkey,authorizedWithdrawerPubkey:e.keys[2].pubkey,lamports:t,toPubkey:e.keys[1].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(Rd.programId))throw new Error("invalid instruction; programId is not VoteProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),_d=Object.freeze({InitializeAccount:{index:0,layout:Mi([vi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteInit";return Mi([Iu("nodePubkey"),Iu("authorizedVoter"),Iu("authorizedWithdrawer"),mi("commission")],e)}()])},Authorize:{index:1,layout:Mi([vi("instruction"),Iu("newAuthorized"),vi("voteAuthorizationType")])},Withdraw:{index:3,layout:Mi([vi("instruction"),bi("lamports")])},AuthorizeWithSeed:{index:10,layout:Mi([vi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return Mi([vi("voteAuthorizationType"),Iu("currentAuthorityDerivedKeyOwnerPubkey"),Lu("currentAuthorityDerivedKeySeed"),Iu("newAuthorized")],e)}()])}}),Pd=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),Rd=function(){function e(){B(this,e)}return W(e,null,[{key:"initializeAccount",value:function(e){var t=e.votePubkey,n=e.nodePubkey,r=e.voteInit,i=tc(_d.InitializeAccount,{voteInit:{nodePubkey:lu(r.nodePubkey.toBuffer()),authorizedVoter:lu(r.authorizedVoter.toBuffer()),authorizedWithdrawer:lu(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Gu,isSigner:!1,isWritable:!1},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new Bu(o)}},{key:"createAccount",value:function(e){var t=new Uu;return t.add(dc.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}},{key:"authorize",value:function(e){var t=e.votePubkey,n=e.authorizedPubkey,r=e.newAuthorizedPubkey,i=e.voteAuthorizationType,o=tc(_d.Authorize,{newAuthorized:lu(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Uu).add({keys:a,programId:this.programId,data:o})}},{key:"authorizeWithSeed",value:function(e){var t=e.currentAuthorityDerivedKeyBasePubkey,n=e.currentAuthorityDerivedKeyOwnerPubkey,r=e.currentAuthorityDerivedKeySeed,i=e.newAuthorizedPubkey,o=e.voteAuthorizationType,a=e.votePubkey,s=tc(_d.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:lu(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:lu(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:Yu,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return(new Uu).add({keys:u,programId:this.programId,data:s})}},{key:"withdraw",value:function(e){var t=e.votePubkey,n=e.authorizedWithdrawerPubkey,r=e.lamports,i=e.toPubkey,o=tc(_d.Withdraw,{lamports:r}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new Uu).add({keys:a,programId:this.programId,data:o})}},{key:"safeWithdraw",value:function(t,n,r){if(t.lamports>n-r)throw new Error("Withdraw will leave vote account with insuffcient funds.");return e.withdraw(t)}}]),e}();Rd.programId=new mu("Vote111111111111111111111111111111111111111"),Rd.space=3731;var Bd=new mu("Va1idator1nfo111111111111111111111111111111"),Ud=$i({name:Xi(),website:Zi(Xi()),details:Zi(Xi()),keybaseUsername:Zi(Xi())}),Wd=function(){function e(t,n){B(this,e),this.key=void 0,this.info=void 0,this.key=t,this.info=n}return W(e,null,[{key:"fromConfigData",value:function(t){var n=ee(t);if(2!==Su(n))return null;for(var r=[],i=0;i<2;i++){var o=new mu(n.slice(0,fu)),a=1===(n=n.slice(fu)).slice(0,1)[0];n=n.slice(1),r.push({publicKey:o,isSigner:a})}if(r[0].publicKey.equals(Bd)&&r[1].isSigner){var s=Lu().decode(Ee.from(n)),u=JSON.parse(s);return Ri(u,Ud),new e(r[1].publicKey,u)}return null}}]),e}(),Qd=new mu("Vote111111111111111111111111111111111111111"),Yd=Mi([Iu("nodePubkey"),Iu("authorizedWithdrawer"),mi("commission"),wi(),Ai(Mi([wi("slot"),vi("confirmationCount")]),yi(vi(),-8),"votes"),mi("rootSlotValid"),wi("rootSlot"),wi(),Ai(Mi([wi("epoch"),Iu("authorizedVoter")]),yi(vi(),-8),"authorizedVoters"),Mi([Ai(Mi([Iu("authorizedPubkey"),wi("epochOfLastAuthorizedSwitch"),wi("targetEpoch")]),32,"buf"),wi("idx"),mi("isEmpty")],"priorVoters"),wi(),Ai(Mi([wi("epoch"),wi("credits"),wi("prevCredits")]),yi(vi(),-8),"epochCredits"),Mi([wi("slot"),wi("timestamp")],"lastTimestamp")]),Fd=function(){function e(t){B(this,e),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=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}return W(e,null,[{key:"fromAccountData",value:function(t){var n=Yd.decode(lu(t),4),r=n.rootSlot;return n.rootSlotValid||(r=null),new e({nodePubkey:new mu(n.nodePubkey),authorizedWithdrawer:new mu(n.authorizedWithdrawer),commission:n.commission,votes:n.votes,rootSlot:r,authorizedVoters:n.authorizedVoters.map(Vd),priorVoters:Gd(n.priorVoters),epochCredits:n.epochCredits,lastTimestamp:n.lastTimestamp})}}]),e}();function Vd(e){var t=e.authorizedVoter;return{epoch:e.epoch,authorizedVoter:new mu(t)}}function Hd(e){var t=e.authorizedPubkey,n=e.epochOfLastAuthorizedSwitch,r=e.targetEpoch;return{authorizedPubkey:new mu(t),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function Gd(e){var t=e.buf,n=e.idx;return e.isEmpty?[]:[].concat(ee(t.slice(n+1).map(Hd)),ee(t.slice(0,n).map(Hd)))}var qd={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 Zd(){return Zd=R(z().mark((function e(t,n,r,i){var o,a,s,u,c,l,d;return z().wrap((function(e){for(;;)switch(e.prev=e.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},e.next=4,t.sendRawTransaction(n,s);case 4:return u=e.sent,c=a&&a.commitment,l=o?t.confirmTransaction(o,c):t.confirmTransaction(u,c),e.next=9,l;case 9:if(!(d=e.sent.value).err){e.next=12;break}throw new Error("Raw transaction ".concat(u," failed (").concat(JSON.stringify(d),")"));case 12:return e.abrupt("return",u);case 13:case"end":return e.stop()}}),e)}))),Zd.apply(this,arguments)}var Jd=Object.freeze({__proto__:null,Account:gu,AddressLookupTableAccount:Tc,AddressLookupTableInstruction:gd,AddressLookupTableProgram:vd,Authorized:Ld,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:vu,BPF_LOADER_PROGRAM_ID:pc,BpfLoader:fc,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:bd,ComputeBudgetInstruction:wd,ComputeBudgetProgram:Md,Connection:fd,Ed25519Program:Ed,Enum:hu,EpochSchedule:bc,FeeCalculatorLayout:ic,Keypair:yd,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:md,Loader:hc,Lockup:xd,MAX_SEED_LENGTH:32,Message:zu,MessageAccountKeys:Tu,MessageV0:_u,NONCE_ACCOUNT_LENGTH:ac,NonceAccount:sc,PACKET_DATA_SIZE:wu,PUBLIC_KEY_LENGTH:fu,PublicKey:mu,SIGNATURE_LENGTH_IN_BYTES:Mu,SOLANA_SCHEMA:pu,STAKE_CONFIG_ID:kd,STAKE_INSTRUCTION_LAYOUTS:jd,SYSTEM_INSTRUCTION_LAYOUTS:lc,SYSVAR_CLOCK_PUBKEY:Yu,SYSVAR_EPOCH_SCHEDULE_PUBKEY:Fu,SYSVAR_INSTRUCTIONS_PUBKEY:Vu,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:Hu,SYSVAR_RENT_PUBKEY:Gu,SYSVAR_REWARDS_PUBKEY:qu,SYSVAR_SLOT_HASHES_PUBKEY:Zu,SYSVAR_SLOT_HISTORY_PUBKEY:Ju,SYSVAR_STAKE_HISTORY_PUBKEY:Xu,Secp256k1Program:Id,SendTransactionError:Mc,SolanaJSONRPCError:Ac,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:Cd,StakeInstruction:Sd,StakeProgram:Dd,Struct:du,SystemInstruction:cc,SystemProgram:dc,Transaction:Uu,TransactionExpiredBlockheightExceededError:Au,TransactionExpiredNonceInvalidError:Nu,TransactionExpiredTimeoutError:Eu,TransactionInstruction:Bu,TransactionMessage:Wu,get TransactionStatus(){return Du},VALIDATOR_INFO_KEY:Bd,VERSION_PREFIX_MASK:bu,VOTE_PROGRAM_ID:Qd,ValidatorInfo:Wd,VersionedMessage:Pu,VersionedTransaction:Qu,VoteAccount:Fd,VoteAuthorizationLayout:Pd,VoteInit:Od,VoteInstruction:zd,VoteProgram:Rd,clusterApiUrl:function(e,t){var n=!1===t?"http":"https";if(!e)return qd[n].devnet;var r=qd[n][e];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(e));return r},sendAndConfirmRawTransaction:function(e,t,n,r){return Zd.apply(this,arguments)},sendAndConfirmTransaction:Ku}),Xd=C(Jd),Kd={};Object.defineProperty(Kd,"__esModule",{value:!0});var $d={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"},eh=function(e){Y(n,q(Error));var t=X(n);function n(){var e;B(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(e=t.call(this,s)).code=a,e.data=u,e.name="SolanaMobileWalletAdapterError",e}return W(n)}(),th=function(e){Y(n,q(Error));var t=X(n);function n(){var e;B(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(e=t.call(this,u)).code=s,e.data=c,e.jsonRpcMessageId=a,e.name="SolanaMobileWalletAdapterProtocolError",e}return W(n)}();function nh(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function rh(e,t){return nh(this,void 0,void 0,z().mark((function n(){var r,i,o;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,crypto.subtle.exportKey("raw",e);case 2:return r=n.sent,n.next=5,crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},t,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 ih=4;function oh(e){if(e>=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");var t=new ArrayBuffer(ih);return new DataView(t).setUint32(0,e,!1),new Uint8Array(t)}function ah(){return nh(this,void 0,void 0,z().mark((function e(){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"]);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}function sh(){return nh(this,void 0,void 0,z().mark((function e(){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"]);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}var uh,ch=12;function lh(e,t){return nh(this,void 0,void 0,z().mark((function n(){var r,i,o,a,s;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=JSON.stringify(e),i=oh(e.id),o=new Uint8Array(ch),crypto.getRandomValues(o),n.next=6,crypto.subtle.encrypt(hh(i,o),t,(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 dh(e,t){return nh(this,void 0,void 0,z().mark((function n(){var r,i,o,a,s,u;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.slice(0,ih),i=e.slice(ih,ih+ch),o=e.slice(ih+ch),n.next=5,crypto.subtle.decrypt(hh(r,i),t,o);case 5:if(a=n.sent,s=ph().decode(a),u=JSON.parse(s),!Object.hasOwnProperty.call(u,"error")){n.next=10;break}throw new th(u.id,u.error.code,u.error.message);case 10:return n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))}function hh(e,t){return{additionalData:e,iv:t,name:"AES-GCM",tagLength:128}}function ph(){return void 0===uh&&(uh=new TextDecoder("utf-8")),uh}function fh(e,t,n){return nh(this,void 0,void 0,z().mark((function r(){var i,o,a,s,u,c,l;return z().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Promise.all([crypto.subtle.exportKey("raw",t),crypto.subtle.importKey("raw",e,{name:"ECDH",namedCurve:"P-256"},!1,[])]);case 2:return i=r.sent,o=$(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 yh(e){if(e<49152||e>65535)throw new eh($d.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,"Association port number must be between 49152 and 65535. ".concat(e," given."),{port:e});return e}function mh(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,i=0;i<r;i++)t+=String.fromCharCode(n[i]);return window.btoa(t)}var gh="solana-wallet";function vh(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function wh(e,t){var n=null;if(t){try{n=new URL(t)}catch(e){}if("https:"!==(null==n?void 0:n.protocol))throw new eh($d.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}n||(n=new URL("".concat(gh,":/")));var r=e.startsWith("/")?e:[].concat(ee(vh(n.pathname)),ee(vh(e))).join("/");return new URL(r,n)}function bh(e,t,n){return nh(this,void 0,void 0,z().mark((function r(){var i,o,a,s;return z().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=yh(t),r.next=3,crypto.subtle.exportKey("raw",e);case 3:return o=r.sent,a=mh(o),(s=wh("v1/associate/local",n)).searchParams.set("association",a.replace(/[/+=]/g,(function(e){return{"/":"_","+":"-","=":"."}[e]}))),s.searchParams.set("port","".concat(i)),r.abrupt("return",s);case 9:case"end":return r.stop()}}),r)})))}var Mh={Firefox:0,Other:1};var Ah=null;function Eh(e,t){return nh(this,void 0,void 0,z().mark((function n(){var r,i,o,a;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=yh(49152+Math.floor(16384*Math.random())),n.next=3,bh(e,r,t);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/")?Mh.Firefox:Mh.Other,n.t0=o,n.next=n.t0===Mh.Firefox?13:n.t0===Mh.Other?15:20;break;case 13:return s=i,null==Ah&&((Ah=document.createElement("iframe")).style.display="none",document.body.appendChild(Ah)),Ah.contentWindow.location.href=s.toString(),n.abrupt("break",21);case 15:return a=new Promise((function(e,t){function n(){clearTimeout(i),window.removeEventListener("blur",r)}function r(){n(),e()}window.addEventListener("blur",r);var i=setTimeout((function(){n(),t()}),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 eh($d.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 Nh=[150,150,200,500,500,750,750,1e3],Th=3e4;function Ih(){if("undefined"==typeof window||!0!==window.isSecureContext)throw new eh($d.ERROR_SECURE_CONTEXT_REQUIRED,"The mobile wallet adapter protocol must be used in a secure context (`https`).")}function kh(e){var t;try{t=new URL(e)}catch(e){throw new eh($d.ERROR_FORBIDDEN_WALLET_BASE_URL,"Invalid base URL supplied by wallet")}if("https:"!==t.protocol)throw new eh($d.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}Kd.SolanaMobileWalletAdapterError=eh,Kd.SolanaMobileWalletAdapterErrorCode=$d,Kd.SolanaMobileWalletAdapterProtocolError=th,Kd.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},Kd.transact=function(e,t){return nh(this,void 0,void 0,z().mark((function n(){var r,i,o,a,s,u,c,l,d=this;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return Ih(),n.next=3,ah();case 3:return r=n.sent,n.next=6,Eh(r.publicKey,null==t?void 0:t.baseUri);case 6:return i=n.sent,o="ws://localhost:".concat(i,"/solana-wallet"),s=function(){var e=ee(Nh);return function(){return e.length>1?e.shift():e[0]}}(),u=1,c=0,l={__type:"disconnected"},n.abrupt("return",new Promise((function(t,n){var h,p,f,y={},m=function e(){return nh(d,void 0,void 0,z().mark((function t(){var n,r;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("connecting"===l.__type){t.next=3;break}return console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(l.__type,"`.")),t.abrupt("return");case 3:return n=l.associationKeypair,h.removeEventListener("open",e),t.next=7,sh();case 7:return r=t.sent,t.t0=h,t.next=11,rh(r.publicKey,n.privateKey);case 11:t.t1=t.sent,t.t0.send.call(t.t0,t.t1),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};case 14:case"end":return t.stop()}}),t)})))},g=function(e){e.wasClean?l={__type:"disconnected"}:n(new eh($d.ERROR_SESSION_CLOSED,"The wallet session dropped unexpectedly (".concat(e.code,": ").concat(e.reason,")."),{closeEvent:e})),p()},v=function(e){return nh(d,void 0,void 0,z().mark((function e(){return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(p(),!(Date.now()-a>=Th)){e.next=5;break}n(new eh($d.ERROR_SESSION_TIMEOUT,"Failed to connect to the wallet websocket on port ".concat(i,"."))),e.next=8;break;case 5:return e.next=7,new Promise((function(e){var t=s();f=window.setTimeout(e,t)}));case 7:b();case 8:case"end":return e.stop()}}),e)})))},w=function(r){return nh(d,void 0,void 0,z().mark((function i(){var o,a,s,d,f,m,g,v;return z().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,ih),(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,dh(o,l.sharedSecret);case 14:d=i.sent,f=y[d.id],delete y[d.id],f.resolve(d.result),i.next=29;break;case 20:if(i.prev=20,i.t1=i.catch(6),!(i.t1 instanceof th)){i.next=28;break}m=y[i.t1.jsonRpcMessageId],delete y[i.t1.jsonRpcMessageId],m.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,fh(o,l.associationPublicKey,l.ecdhPrivateKey);case 32:return g=i.sent,l={__type:"connected",sharedSecret:g},v=new Proxy({},{get:function(e,t){if(null==e[t]){var n=t.toString().replace(/[A-Z]/g,(function(e){return"_".concat(e.toLowerCase())})).toLowerCase();e[t]=function(e){return nh(this,void 0,void 0,z().mark((function r(){var i;return z().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=u++,r.t0=h,r.next=4,lh({id:i,jsonrpc:"2.0",method:n,params:null!=e?e:{}},g);case 4:return r.t1=r.sent,r.t0.send.call(r.t0,r.t1),r.abrupt("return",new Promise((function(e,n){y[i]={resolve:function(r){switch(t){case"authorize":case"reauthorize":var i=r.wallet_uri_base;if(null!=i)try{kh(i)}catch(e){return void n(e)}}e(r)},reject:n}})));case 7:case"end":return r.stop()}}),r)})))}}return e[t]},defineProperty:function(){return!1},deleteProperty:function(){return!1}}),i.prev=35,i.t2=t,i.next=39,e(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,p(),h.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(){p&&p(),l={__type:"connecting",associationKeypair:r},void 0===a&&(a=Date.now()),(h=new WebSocket(o,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",m),h.addEventListener("close",g),h.addEventListener("error",v),h.addEventListener("message",w),p=function(){window.clearTimeout(f),h.removeEventListener("open",m),h.removeEventListener("close",g),h.removeEventListener("error",v),h.removeEventListener("message",w)}};b()})));case 13:case"end":return n.stop()}}),n)})))};var Lh=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var r=0;r<e.length;r++){var i=e.charAt(r),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=r}var a=e.length,s=e.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var n=0,r=0,i=0;e[n]===s;)r++,n++;for(var o=(e.length-n)*u+1>>>0,c=new Uint8Array(o);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var d=0,h=o-1;(0!==l||d<i)&&-1!==h;h--,d++)l+=a*c[h]>>>0,c[h]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,n++}for(var p=o-i;p!==o&&0===c[p];)p++;for(var f=new Uint8Array(r+(o-p)),y=r;p!==o;)f[y++]=c[p++];return f}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var d=t[i],h=0,p=u-1;(0!==d||h<r)&&-1!==p;p--,h++)d+=256*l[p]>>>0,l[p]=d%a>>>0,d=d/a>>>0;if(0!==d)throw new Error("Non-zero carry");r=h,i++}for(var f=u-r;f!==u&&0===l[f];)f++;for(var y=s.repeat(n);f<u;++f)y+=e.charAt(l[f]);return y},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+a+" character")}}},xh=Lh("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Object.defineProperty(se,"__esModule",{value:!0});var Sh=Xd,jh=Kd;function Ch(e){return e&&"object"===_(e)&&"default"in e?e:{default:e}}var Dh=Ch(xh);function Oh(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function zh(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function _h(e){var t;return window.btoa((t=String.fromCharCode).call.apply(t,[null].concat(ee(e))))}function Ph(e){return new Uint8Array(window.atob(e).split("").map((function(e){return e.charCodeAt(0)})))}function Rh(e){return _h("version"in e?e.serialize():e.serialize({requireAllSignatures:!1,verifySignatures:!1}))}function Bh(e){var t=e[0]*Sh.SIGNATURE_LENGTH_IN_BYTES+1;return"legacy"===Sh.VersionedMessage.deserializeMessageVersion(e.slice(t,e.length))?Sh.Transaction.from(e):Sh.VersionedTransaction.deserialize(e)}se.transact=function(e,t){return zh(this,void 0,void 0,z().mark((function n(){var r;return z().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(t){var n=new Proxy({},{get:function(e,n){if(null==e[n])switch(n){case"signAndSendTransactions":e[n]=function(e){var n=e.minContextSlot,r=e.transactions,i=Oh(e,["minContextSlot","transactions"]);return zh(this,void 0,void 0,z().mark((function e(){var o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.map(Rh),e.next=3,t.signAndSendTransactions(Object.assign(Object.assign(Object.assign({},i),null!=n?{options:{min_context_slot:n}}:null),{payloads:o}));case 3:return a=e.sent,s=a.signatures,u=s.map(Ph).map(Dh.default.encode),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})))};break;case"signMessages":e[n]=function(e){var n=e.payloads,r=Oh(e,["payloads"]);return zh(this,void 0,void 0,z().mark((function e(){var i,o,a,s;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.map(_h),e.next=3,t.signMessages(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=e.sent,a=o.signed_payloads,s=a.map(Ph),e.abrupt("return",s);case 7:case"end":return e.stop()}}),e)})))};break;case"signTransactions":e[n]=function(e){var n=e.transactions,r=Oh(e,["transactions"]);return zh(this,void 0,void 0,z().mark((function e(){var i,o,a,s,u;return z().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.map(Rh),e.next=3,t.signTransactions(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=e.sent,a=o.signed_payloads,s=a.map(Ph),u=s.map(Bh),e.abrupt("return",u);case 8:case"end":return e.stop()}}),e)})))};break;default:e[n]=t[n]}return e[n]},defineProperty:function(){return!1},deleteProperty:function(){return!1}});return e(n)},n.next=3,jh.transact(r,t);case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n)})))};var Uh={},Wh=function(){function e(t,n){if(B(this,e),!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=n}return W(e,[{key:"makeDestinationObject",value:function(){return{}}},{key:"decode",value:function(e,t){throw new Error("Layout is abstract")}},{key:"encode",value:function(e,t,n){throw new Error("Layout is abstract")}},{key:"getSpan",value:function(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(e){var t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}},{key:"fromArray",value:function(e){}}]),e}();function Qh(e,t){return t.property?e+"["+t.property+"]":e}Uh.Layout=Wh,Uh.nameWithProperty=Qh,Uh.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(e.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Wh))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=function(){return new e},Object.defineProperty(e.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(e,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};var Yh=function(e){Y(n,Wh);var t=X(n);function n(){return B(this,n),t.apply(this,arguments)}return W(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}(),Fh=function(e){Y(n,Yh);var t=X(n);function n(e,r){var i;if(B(this,n),void 0===e&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");return(i=t.call(this,-1,r)).elementSpan=e,i}return W(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.length-t;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(e,t,n){return 0}}]),n}(),Vh=function(e){Y(n,Yh);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof Wh))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=t.call(this,e.span,i||e.property)).layout=e,o.offset=r,o}return W(n,[{key:"isCount",value:function(){return this.layout instanceof Hh||this.layout instanceof Gh}},{key:"decode",value:function(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}]),n}(),Hh=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readUIntLE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeUIntLE(e,n,this.span),this.span}}]),n}(),Gh=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readUIntBE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeUIntBE(e,n,this.span),this.span}}]),n}(),qh=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readIntLE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeIntLE(e,n,this.span),this.span}}]),n}(),Zh=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readIntBE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeIntBE(e,n,this.span),this.span}}]),n}(),Jh=Math.pow(2,32);function Xh(e){var t=Math.floor(e/Jh);return{hi32:t,lo32:e-t*Jh}}function Kh(e,t){return e*Jh+t}var $h=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.readUInt32LE(t);return Kh(e.readUInt32LE(t+4),n)}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Xh(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}}]),n}(),ep=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),Kh(e.readUInt32BE(t),e.readUInt32BE(t+4))}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Xh(e);return t.writeUInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}]),n}(),tp=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.readUInt32LE(t);return Kh(e.readInt32LE(t+4),n)}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Xh(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}}]),n}(),np=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),Kh(e.readInt32BE(t),e.readUInt32BE(t+4))}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Xh(e);return t.writeInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}]),n}(),rp=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,4,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readFloatLE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeFloatLE(e,n),4}}]),n}(),ip=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,4,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readFloatBE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeFloatBE(e,n),4}}]),n}(),op=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readDoubleLE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeDoubleLE(e,n),8}}]),n}(),ap=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return W(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readDoubleBE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeDoubleBE(e,n),8}}]),n}(),sp=function(e){Y(n,Wh);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof Wh))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof Yh&&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 Yh)&&0<e.span&&(a=r*e.span),(o=t.call(this,a,i)).elementLayout=e,o.count=r,o}return W(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0,r=this.count;if(r instanceof Yh&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else for(var i=0;i<r;)n+=this.elementLayout.getSpan(e,t+n),++i;return n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=[],r=0,i=this.count;for(i instanceof Yh&&(i=i.decode(e,t));r<i;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.elementLayout,i=e.reduce((function(e,i){return e+r.encode(i,t,n+e)}),0);return this.count instanceof Yh&&this.count.encode(e.length,t,n),i}}]),n}(),up=function(e){Y(n,Wh);var t=X(n);function n(e,r,i){var o;if(B(this,n),!Array.isArray(e)||!e.reduce((function(e,t){return e&&t instanceof Wh}),!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=ae(e);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(e){s.e(e)}finally{s.f()}var c=-1;try{c=e.reduce((function(e,t){return e+t.getSpan()}),0)}catch(e){}return(o=t.call(this,c,r)).fields=e,o.decodePrefixes=!!i,o}return W(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n,r=this.makeDestinationObject(),i=ae(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(e,t)),t+=o.getSpan(e,t),this.decodePrefixes&&e.length===t)break}}catch(e){i.e(e)}finally{i.f()}return r}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r,i=n,o=0,a=0,s=ae(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=e[u.property];void 0!==l&&(a=u.encode(l,t,n),0>c&&(c=u.getSpan(t,n)))}o=n,n+=c}}catch(e){s.e(e)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(e){var t,n=this.makeDestinationObject(),r=ae(this.fields);try{for(r.s();!(t=r.n()).done;){var i=t.value;void 0!==i.property&&0<e.length&&(n[i.property]=e.shift())}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"layoutFor",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=ae(this.fields);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.property===e)return r}}catch(e){n.e(e)}finally{n.f()}}},{key:"offsetOf",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=0,r=ae(this.fields);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(i.property===e)return n;0>i.span?n=-1:0<=n&&(n+=i.span)}}catch(e){r.e(e)}finally{r.f()}}}]),n}(),cp=function(){function e(t){B(this,e),this.property=t}return W(e,[{key:"decode",value:function(){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(){throw new Error("UnionDiscriminator is abstract")}}]),e}(),lp=function(e){Y(n,cp);var t=X(n);function n(e,r){var i;if(B(this,n),!(e instanceof Yh&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=t.call(this,r||e.property||"variant")).layout=e,i}return W(n,[{key:"decode",value:function(e,t){return this.layout.decode(e,t)}},{key:"encode",value:function(e,t,n){return this.layout.encode(e,t,n)}}]),n}(),dp=function(e){Y(n,Wh);var t=X(n);function n(e,r,i){var o;B(this,n);var a=e instanceof Hh||e instanceof Gh;if(a)e=new lp(new Vh(e));else if(e instanceof Yh&&e.isCount())e=new lp(e);else if(!(e instanceof cp))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===r&&(r=null),!(null===r||r instanceof Wh))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+=e.layout.span),(o=t.call(this,s,i)).discriminator=e,o.usesPrefixDiscriminator=a,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(J(o));return o.getSourceVariant=function(e){return u(e)},o.configGetSourceVariant=function(e){u=e.bind(this)},o}return W(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}},{key:"defaultGetSourceVariant",value:function(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;var t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(var n in this.registry){var r=this.registry[n];if(e.hasOwnProperty(r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(e,t){var n;void 0===t&&(t=0);var r=this.discriminator,i=r.decode(e,t),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(e,t+a)}else n=o.decode(e,t);return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.getSourceVariant(e);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(e[i.property],t,n),a+o.encode(e[o.property],t,n+a)}return r.encode(e,t,n)}},{key:"addVariant",value:function(e,t,n){var r=new hp(this,e,t,n);return this.registry[e]=r,r}},{key:"getVariant",value:function(e,t){var n=e;return Ee.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}]),n}(),hp=function(e){Y(n,Wh);var t=X(n);function n(e,r,i,o){var a;if(B(this,n),!(e instanceof dp))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 Wh))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=i.span&&i.span>e.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=e.span;return 0>e.span&&0<=(s=i?i.span:0)&&e.usesPrefixDiscriminator&&(s+=e.discriminator.layout.span),(a=t.call(this,s,o)).union=e,a.variant=r,a.layout=i||null,a}return W(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}},{key:"decode",value:function(e,t){var n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))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(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);var i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(e){if(this.layout)return this.layout.fromArray(e)}}]),n}();function pp(e){return 0>e&&(e+=4294967296),e}var fp=function(e){Y(n,Wh);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof Hh||e instanceof Gh))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=void 0),4<e.span)throw new RangeError("word cannot exceed 32 bits");(o=t.call(this,e.span,i)).word=e,o.msb=!!r,o.fields=[];var a=0;return o._packedSetValue=function(e){return a=pp(e),this},o._packedGetValue=function(){return a},o}return W(n,[{key:"decode",value:function(e,t){var n=this.makeDestinationObject();void 0===t&&(t=0);var r=this.word.decode(e,t);this._packedSetValue(r);var i,o=ae(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(e){o.e(e)}finally{o.f()}return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.word.decode(t,n);this._packedSetValue(r);var i,o=ae(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(void 0!==a.property){var s=e[a.property];void 0!==s&&a.encode(s)}}}catch(e){o.e(e)}finally{o.f()}return this.word.encode(this._packedGetValue(),t,n)}},{key:"addField",value:function(e,t){var n=new yp(this,e,t);return this.fields.push(n),n}},{key:"addBoolean",value:function(e){var t=new mp(this,e);return this.fields.push(t),t}},{key:"fieldFor",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=ae(this.fields);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.property===e)return r}}catch(e){n.e(e)}finally{n.f()}}}]),n}(),yp=function(){function e(t,n,r){if(B(this,e),!(t instanceof fp))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*t.span,o=t.fields.reduce((function(e,t){return e+t.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=t,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=pp(this.valueMask<<this.start),this.property=r}return W(e,[{key:"decode",value:function(){return pp(this.container._packedGetValue()&this.wordMask)>>>this.start}},{key:"encode",value:function(e){if(!Number.isInteger(e)||e!==pp(e&this.valueMask))throw new TypeError(Qh("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var t=this.container._packedGetValue(),n=pp(e<<this.start);this.container._packedSetValue(pp(t&~this.wordMask)|n)}}]),e}(),mp=function(e){Y(n,yp);var t=X(n);function n(e,r){return B(this,n),t.call(this,e,1,r)}return W(n,[{key:"decode",value:function(e,t){return!!yp.prototype.decode.call(this,e,t)}},{key:"encode",value:function(e){return"boolean"==typeof e&&(e=+e),yp.prototype.encode.call(this,e)}}]),n}(),gp=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),!(e instanceof Yh&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var o=-1;return e instanceof Yh||(o=e),(i=t.call(this,o,r)).length=e,i}return W(n,[{key:"getSpan",value:function(e,t){var n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}},{key:"encode",value:function(e,t,n){var r=this.length;if(this.length instanceof Yh&&(r=e.length),!Ee.isBuffer(e)||r!==e.length)throw new TypeError(Qh("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,r,"hex"),this.length instanceof Yh&&this.length.encode(r,t,n),r}}]),n}(),vp=function(e){Y(n,Wh);var t=X(n);function n(e){return B(this,n),t.call(this,-1,e)}return W(n,[{key:"getSpan",value:function(e,t){if(!Ee.isBuffer(e))throw new TypeError("b must be a Buffer");void 0===t&&(t=0);for(var n=t;n<e.length&&0!==e[n];)n+=1;return 1+n-t}},{key:"decode",value:function(e,t,n){void 0===t&&(t=0);var r=this.getSpan(e,t);return e.slice(t,t+r-1).toString("utf-8")}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());var r=new Ee(e,"utf8"),i=r.length;if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),t[n+i]=0,i+1}}]),n}(),wp=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;if(B(this,n),"string"==typeof e&&void 0===r&&(r=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");return(i=t.call(this,-1,r)).maxSpan=e,i}return W(n,[{key:"getSpan",value:function(e,t){if(!Ee.isBuffer(e))throw new TypeError("b must be a Buffer");return void 0===t&&(t=0),e.length-t}},{key:"decode",value:function(e,t,n){void 0===t&&(t=0);var r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return e.slice(t,t+r).toString("utf-8")}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());var r=new Ee(e,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),i}}]),n}(),bp=function(e){Y(n,Wh);var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,0,r)).value=e,i}return W(n,[{key:"decode",value:function(e,t,n){return this.value}},{key:"encode",value:function(e,t,n){return 0}}]),n}();Uh.ExternalLayout=Yh,Uh.GreedyCount=Fh,Uh.OffsetLayout=Vh,Uh.UInt=Hh,Uh.UIntBE=Gh,Uh.Int=qh,Uh.IntBE=Zh,Uh.Float=rp,Uh.FloatBE=ip,Uh.Double=op,Uh.DoubleBE=ap,Uh.Sequence=sp,Uh.Structure=up,Uh.UnionDiscriminator=cp,Uh.UnionLayoutDiscriminator=lp,Uh.Union=dp,Uh.VariantLayout=hp,Uh.BitStructure=fp,Uh.BitField=yp,Uh.Boolean=mp,Uh.Blob=gp,Uh.CString=vp,Uh.UTF8=wp,Uh.Constant=bp,Uh.greedy=function(e,t){return new Fh(e,t)},Uh.offset=function(e,t,n){return new Vh(e,t,n)},Uh.u8=function(e){return new Hh(1,e)},Uh.u16=function(e){return new Hh(2,e)},Uh.u24=function(e){return new Hh(3,e)},Uh.u32=function(e){return new Hh(4,e)},Uh.u40=function(e){return new Hh(5,e)},Uh.u48=function(e){return new Hh(6,e)},Uh.nu64=function(e){return new $h(e)},Uh.u16be=function(e){return new Gh(2,e)},Uh.u24be=function(e){return new Gh(3,e)},Uh.u32be=function(e){return new Gh(4,e)},Uh.u40be=function(e){return new Gh(5,e)},Uh.u48be=function(e){return new Gh(6,e)},Uh.nu64be=function(e){return new ep(e)},Uh.s8=function(e){return new qh(1,e)},Uh.s16=function(e){return new qh(2,e)},Uh.s24=function(e){return new qh(3,e)},Uh.s32=function(e){return new qh(4,e)},Uh.s40=function(e){return new qh(5,e)},Uh.s48=function(e){return new qh(6,e)},Uh.ns64=function(e){return new tp(e)},Uh.s16be=function(e){return new Zh(2,e)},Uh.s24be=function(e){return new Zh(3,e)},Uh.s32be=function(e){return new Zh(4,e)},Uh.s40be=function(e){return new Zh(5,e)},Uh.s48be=function(e){return new Zh(6,e)},Uh.ns64be=function(e){return new np(e)},Uh.f32=function(e){return new rp(e)},Uh.f32be=function(e){return new ip(e)},Uh.f64=function(e){return new op(e)},Uh.f64be=function(e){return new ap(e)},Uh.struct=function(e,t,n){return new up(e,t,n)},Uh.bits=function(e,t,n){return new fp(e,t,n)};var Mp=Uh.seq=function(e,t,n){return new sp(e,t,n)};Uh.union=function(e,t,n){return new dp(e,t,n)},Uh.unionLayoutDiscriminator=function(e,t){return new lp(e,t)},Uh.blob=function(e,t){return new gp(e,t)},Uh.cstr=function(e){return new vp(e)},Uh.utf8=function(e,t){return new wp(e,t)},Uh.const=function(e,t){return new bp(e,t)};var Ap={},Ep={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"===_(e)?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:On.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);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 "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.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(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"===_(e)&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"===_(e))return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.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=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[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<e.length;i+=3)a=e[i]|e[i+1]<<8|e[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(e,t,n){this.length=Math.ceil((e.length-t)/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=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,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(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var d=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)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(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],h=[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],p=[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 f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.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,d=67108863&u,h=Math.min(c,t.length-1),p=Math.max(0,c-e.length+1);p<=h;p++){var f=c-p|0;l+=(a=(i=0|e.words[f])*(o=0|t.words[p])+d)/67108864|0,d=67108863&a}n.words[c]=0|d,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){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?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=h[e],l=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var y=f.modrn(l).toString(e);r=(f=f.idivn(l)).isZero()?y+r:d[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=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 e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,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(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).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(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;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(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>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(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;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(e){return this.clone().isub(e)};var y=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],d=8191&l,h=l>>>13,p=0|a[1],f=8191&p,y=p>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],E=8191&A,N=A>>>13,T=0|a[5],I=8191&T,k=T>>>13,L=0|a[6],x=8191&L,S=L>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,_=O>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],W=8191&U,Q=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],de=8191&le,he=le>>>13,pe=0|s[9],fe=8191&pe,ye=pe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(d,W))|0)+((8191&(i=(i=Math.imul(d,Q))+Math.imul(h,W)|0))<<13)|0;c=((o=Math.imul(h,Q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(f,W),i=(i=Math.imul(f,Q))+Math.imul(y,W)|0,o=Math.imul(y,Q);var ge=(c+(r=r+Math.imul(d,F)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(h,F)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,W),i=(i=Math.imul(g,Q))+Math.imul(v,W)|0,o=Math.imul(v,Q),r=r+Math.imul(f,F)|0,i=(i=i+Math.imul(f,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,q)|0)+Math.imul(h,G)|0))<<13)|0;c=((o=o+Math.imul(h,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=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(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(f,G)|0,i=(i=i+Math.imul(f,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(h,J)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(E,W),i=(i=Math.imul(E,Q))+Math.imul(N,W)|0,o=Math.imul(N,Q),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(f,J)|0,i=(i=i+Math.imul(f,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(h,$)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(I,W),i=(i=Math.imul(I,Q))+Math.imul(k,W)|0,o=Math.imul(k,Q),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(f,$)|0,i=(i=i+Math.imul(f,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(h,ne)|0))<<13)|0;c=((o=o+Math.imul(h,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(x,W),i=(i=Math.imul(x,Q))+Math.imul(S,W)|0,o=Math.imul(S,Q),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|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(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(f,ne)|0,i=(i=i+Math.imul(f,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(C,W),i=(i=Math.imul(C,Q))+Math.imul(D,W)|0,o=Math.imul(D,Q),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(f,oe)|0,i=(i=i+Math.imul(f,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ee=(c+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(z,W),i=(i=Math.imul(z,Q))+Math.imul(_,W)|0,o=Math.imul(_,Q),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(f,ue)|0,i=(i=i+Math.imul(f,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(R,W),i=(i=Math.imul(R,Q))+Math.imul(B,W)|0,o=Math.imul(B,Q),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(_,F)|0,o=o+Math.imul(_,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(f,de)|0,i=(i=i+Math.imul(f,he)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,he)|0;var Te=(c+(r=r+Math.imul(d,fe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ye)|0)+Math.imul(h,fe)|0))<<13)|0;c=((o=o+Math.imul(h,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,V))+Math.imul(B,F)|0,o=Math.imul(B,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(k,ne)|0,o=o+Math.imul(k,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,de)|0,i=(i=i+Math.imul(g,he)|0)+Math.imul(v,de)|0,o=o+Math.imul(v,he)|0;var Ie=(c+(r=r+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ye)|0)+Math.imul(y,fe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(R,G),i=(i=Math.imul(R,q))+Math.imul(B,G)|0,o=Math.imul(B,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(x,ne)|0,i=(i=i+Math.imul(x,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,he)|0;var ke=(c+(r=r+Math.imul(g,fe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,fe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,X))+Math.imul(B,J)|0,o=Math.imul(B,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(k,ue)|0,o=o+Math.imul(k,ce)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,he)|0)+Math.imul(N,de)|0,o=o+Math.imul(N,he)|0;var Le=(c+(r=r+Math.imul(b,fe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,fe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,ee))+Math.imul(B,$)|0,o=Math.imul(B,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(I,de)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(k,de)|0,o=o+Math.imul(k,he)|0;var xe=(c+(r=r+Math.imul(E,fe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(N,fe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(R,ne),i=(i=Math.imul(R,re))+Math.imul(B,ne)|0,o=Math.imul(B,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,r=r+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,r=r+Math.imul(x,de)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,he)|0;var Se=(c+(r=r+Math.imul(I,fe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(k,fe)|0))<<13)|0;c=((o=o+Math.imul(k,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(R,oe),i=(i=Math.imul(R,ae))+Math.imul(B,oe)|0,o=Math.imul(B,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,he)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,he)|0;var je=(c+(r=r+Math.imul(x,fe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ye)|0)+Math.imul(S,fe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(R,ue),i=(i=Math.imul(R,ce))+Math.imul(B,ue)|0,o=Math.imul(B,ce),r=r+Math.imul(z,de)|0,i=(i=i+Math.imul(z,he)|0)+Math.imul(_,de)|0,o=o+Math.imul(_,he)|0;var Ce=(c+(r=r+Math.imul(C,fe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ye)|0)+Math.imul(D,fe)|0))<<13)|0;c=((o=o+Math.imul(D,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(R,de),i=(i=Math.imul(R,he))+Math.imul(B,de)|0,o=Math.imul(B,he);var De=(c+(r=r+Math.imul(z,fe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(_,fe)|0))<<13)|0;c=((o=o+Math.imul(_,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863;var Oe=(c+(r=Math.imul(R,fe))|0)+((8191&(i=(i=Math.imul(R,ye))+Math.imul(B,fe)|0))<<13)|0;return c=((o=Math.imul(B,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ee,u[8]=Ne,u[9]=Te,u[10]=Ie,u[11]=ke,u[12]=Le,u[13]=xe,u[14]=Se,u[15]=je,u[16]=Ce,u[17]=De,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.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,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,d=(0|e.words[l])*(0|t.words[c]),h=67108863&d;s=67108863&(h=h+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(h>>>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 g(e,t,n){return m(e,t,n)}Math.imul||(y=f),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?f(this,e,t):n<1024?m(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,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++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-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 d=0|this.words[c];this.words[c]=l<<26-o|d>>>o,l=d&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(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;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(e,t){var n=(this.length,e.length),r=this.clone(),o=e,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"!==t){(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 d=u-1;d>=0;d--){var h=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(h=Math.min(h/a|0,67108863),r._ishlnsubmul(o,h,d);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=h)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),d=t.clone();!t.isZero();){for(var h=0,p=1;0==(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var f=0,y=1;0==(r.words[0]&y)&&f<26;++f,y<<=1);if(f>0)for(r.iushrn(f);f-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,h=1;0==(r.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;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(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new N(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,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 A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){N.call(this,e),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 e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<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(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},r(b,w),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(M,w),r(A,w),r(E,w),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new M;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return v[e]=t,t},N.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},N.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},N.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},N.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},N.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},N.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},N.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},N.prototype.isqr=function(e){return this.imul(e,e.clone())},N.prototype.sqr=function(e){return this.mul(e,e)},N.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,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 d=this.pow(l,o),h=this.pow(e,o.addn(1).iushrn(1)),p=this.pow(e,o),f=a;0!==p.cmp(s);){for(var y=p,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<f);var g=this.pow(d,new i(1).iushln(f-m-1));h=h.redMul(g),d=g.redSqr(),p=p.redMul(d),f=m}return h},N.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},N.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var d=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},N.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)},r(T,N),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),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)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),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)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(Ep,S),function(e){var t=S&&S.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.map=e.array=e.rustEnum=e.str=e.vecU8=e.tagged=e.vec=e.bool=e.option=e.publicKey=e.i128=e.u128=e.i64=e.u64=e.struct=e.f64=e.f32=e.i32=e.u32=e.i16=e.u16=e.i8=e.u8=void 0;var n=Uh,r=Xd,i=t(Ep.exports),o=Uh;Object.defineProperty(e,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(e,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(e,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(e,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(e,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(e,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(e,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(e,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(e,"struct",{enumerable:!0,get:function(){return o.struct}});var a=function(e){Y(r,e);var t=X(r);function r(e,i,o){var a;return B(this,r),(a=t.call(this,e,o)).blob=n.blob(e),a.signed=i,a}return W(r,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new i.default(this.blob.decode(e,t),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(e=e.toTwos(8*this.span)),this.blob.encode(e.toArrayLike(Ee,"le",this.span),t,n)}}]),r}(n.Layout);function s(e){return new a(8,!1,e)}e.u64=s,e.i64=function(e){return new a(8,!0,e)},e.u128=function(e){return new a(16,!1,e)},e.i128=function(e){return new a(16,!0,e)};var u=function(e){Y(n,e);var t=X(n);function n(e,r,i,o){var a;return B(this,n),(a=t.call(this,e.span,o)).layout=e,a.decoder=r,a.encoder=i,a}return W(n,[{key:"decode",value:function(e,t){return this.decoder(this.layout.decode(e,t))}},{key:"encode",value:function(e,t,n){return this.layout.encode(this.encoder(e),t,n)}},{key:"getSpan",value:function(e,t){return this.layout.getSpan(e,t)}}]),n}(n.Layout);e.publicKey=function(e){return new u(n.blob(32),(function(e){return new r.PublicKey(e)}),(function(e){return e.toBuffer()}),e)};var c=function(e){Y(r,e);var t=X(r);function r(e,i){var o;return B(this,r),(o=t.call(this,-1,i)).layout=e,o.discriminator=n.u8(),o}return W(r,[{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==e?this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+1)+1)}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(e,t);if(0===n)return null;if(1===n)return this.layout.decode(e,t+1);throw new Error("Invalid option "+this.property)}},{key:"getSpan",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(e,t);if(0===n)return 1;if(1===n)return this.layout.getSpan(e,t+1)+1;throw new Error("Invalid option "+this.property)}}]),r}(n.Layout);function l(e){if(0===e)return!1;if(1===e)return!0;throw new Error("Invalid bool: "+e)}function d(e){return e?1:0}function h(e){var t=n.u32("length"),r=n.struct([t,n.blob(n.offset(t,-t.span),"data")]);return new u(r,(function(e){return e.data}),(function(e){return{data:e}}),e)}e.option=function(e,t){return new c(e,t)},e.bool=function(e){return new u(n.u8(),l,d,e)},e.vec=function(e,t){var r=n.u32("length"),i=n.struct([r,n.seq(e,n.offset(r,-r.span),"values")]);return new u(i,(function(e){return e.values}),(function(e){return{values:e}}),t)},e.tagged=function(e,t,r){var i=n.struct([s("tag"),t.replicate("data")]);return new u(i,(function(t){var n=t.tag,r=t.data;if(!n.eq(e))throw new Error("Invalid tag, expected: "+e.toString("hex")+", got: "+n.toString("hex"));return r}),(function(t){return{tag:e,data:t}}),r)},e.vecU8=h,e.str=function(e){return new u(h(),(function(e){return e.toString("utf-8")}),(function(e){return Ee.from(e,"utf-8")}),e)},e.rustEnum=function(e,t,r){var i=n.union(null!=r?r:n.u8(),t);return e.forEach((function(e,t){return i.addVariant(t,e,e.property)})),i},e.array=function(e,t,r){var i=n.struct([n.seq(e,t,"values")]);return new u(i,(function(e){return e.values}),(function(e){return{values:e}}),r)};var p=function(e){Y(n,e);var t=X(n);function n(e,r,i){var o;return B(this,n),(o=t.call(this,e.span+r.span,i)).keyLayout=e,o.valueLayout=r,o}return W(n,[{key:"decode",value:function(e,t){return t=t||0,[this.keyLayout.decode(e,t),this.valueLayout.decode(e,t+this.keyLayout.getSpan(e,t))]}},{key:"encode",value:function(e,t,n){n=n||0;var r=this.keyLayout.encode(e[0],t,n);return r+this.valueLayout.encode(e[1],t,n+r)}},{key:"getSpan",value:function(e,t){return this.keyLayout.getSpan(e,t)+this.valueLayout.getSpan(e,t)}}]),n}(n.Layout);e.map=function(e,t,r){var i=n.u32("length"),o=n.struct([i,n.seq(new p(e,t),n.offset(i,-i.span),"values")]);return new u(o,(function(e){var t=e.values;return new Map(t)}),(function(e){return{values:Array.from(e.entries())}}),r)}}(Ap),se.Web3MobileWallet;var Np=se.transact,Tp=On.Buffer,Ip=Dn.exports,kp=Ap.struct([Ap.publicKey("mint"),Ap.publicKey("owner"),Ap.u64("amount"),Ap.u32("delegateOption"),Ap.publicKey("delegate"),Ap.u8("state"),Ap.u32("isNativeOption"),Ap.u64("isNative"),Ap.u64("delegatedAmount"),Ap.u32("closeAuthorityOption"),Ap.publicKey("closeAuthority")]);Ap.array;var Lp=Ap.bool,xp=Ap.i128;Ap.i16;var Sp=Ap.i32,jp=Ap.i64;Ap.i8,Ap.map;var Cp=Ap.option,Dp=Ap.publicKey,Op=Ap.rustEnum,zp=Ap.str,_p=Ap.struct;Ap.tagged;var Pp=Ap.u128,Rp=Ap.u16,Bp=Ap.u32,Up=Ap.u64,Wp=Ap.u8,Qp=Ap.vec;Ap.vecU8;const Yp="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yOTkuMyAyMzcuNSA1MDAgMTIybDIwMC43IDExNS41LTczLjUgNDIuNkw1MDAgMjA4LjJsLTEyNy4xIDcxLjktNzMuNi00Mi42em00MDEuNCAxNDYtNzMuNS00Mi42LTEyNy4xIDczTDM3MyAzNDAuNGwtNzMuNSA0My4xdjg1LjdsMTI3LjEgNzN2MTQ1LjRsNzMuNSA0My4xIDczLjUtNDMuMVY1NDIuMWwxMjcuMS03M3YtODUuNnptMCAyMzIuMXYtODUuN2wtNzMuNSA0Mi42djg1LjdjLS4xLS42IDczLjUtNDIuNiA3My41LTQyLjZ6bTUxLjkgMjkuMy0xMjcuMSA3M3Y4NS43TDgyNi4xIDY4OFY0NTYuNGwtNzMuNSA0My4xdjE0NS40em0tNzMuNS0zMzQuNCA3My41IDQzLjF2ODUuN2w3My41LTQzLjF2LTg1LjdsLTczLjUtNDMuMS03My41IDQzLjF6TTQyNi41IDc0OS40djg1LjdsNzMuNSA0My4xIDczLjUtNDMuMXYtODUuN2wtNzMuNSA0Mi03My41LTQyek0yOTkuMyA2MTUuNmw3My41IDQzLjF2LTg2LjJMMjk5LjMgNTMwdjg1LjZ6bTEyNy4yLTMwNS4xIDczLjUgNDMuMSA3My41LTQzLjEtNzMuNS00Mi42YzAtLjUtNzMuNSA0Mi42LTczLjUgNDIuNnptLTE3OS4xIDQzLjEgNzMuNS00My4xLTczLjUtNDMuMS03My41IDQzLjF2ODUuN2w3My41IDQzLjF2LTg1Ljd6bTAgMTQ1LjQtNzMuNS00Mi42VjY4OGwyMDAuNyAxMTUuNXYtODUuN2wtMTI3LjEtNzNjLS4xLjEtLjEtMTQ1LjgtLjEtMTQ1Ljh6IiBmaWxsPSIjZjBiOTBiIi8+PC9zdmc+",Fp="https://app.uniswap.org/static/media/bnb-logo.797868eb94521320b78e3967134febbe.svg";var Vp={name:"bsc",id:"0x38",networkId:"56",namespace:"eip155",platform:"evm",label:"BNB Smart Chain",fullName:"BNB Smart Chain Mainnet",logo:Yp,logoBackgroundColor:"#000000",logoWhiteBackground:Yp,currency:{name:"BNB",symbol:"BNB",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Fp},wrapped:{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png"},stables:{usd:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955"]},explorer:"https://bscscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://bscscan.com/tx/${e.id||e}`:t?`https://bscscan.com/token/${t}`: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:Fp,type:"NATIVE"},{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",symbol:"WBNB",name:"Wrapped BNB",decimals:18,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/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://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Hp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAADxdJREFUeJztXVtzFMcVplwuP8VVeYmf7HJ+RKqSl/AQP6X8H+yqXUEIjhMnQY5jO9oVCIzA5mowdzAYG4xAGAyWLC5G3IyDL8gOASUYKrarYGZWC7qi23b6692VV6uZ7e6ZnT3di07VV6JUaLfnnG+6z+lz+vScOXUoL6SzP52/2PtlQ9p7piHlLU2k3P2JJqcjkXLO8589/OdN/tPjvx8VEP8Wv+sp/J8O/A3+Fp+Bz8JnUj/XrPjIwjT7ybxm57fJlLsy2eR2cwPe4QZksYB/Nr4D34XvxHdTP/8DJ+k0e4S/lb9Jpr2WZJNzgRtjPDaDS4DvFmPgY8GYMDZq/dStNKQzv0qmnA1c6RkqgysQIoMxYqzU+qoLWZDO/jyZdl7lir1ObdwQZLiOseMZqPVonSTS7i+4AtsTTW6O2pDR4ebEs/Bnotar8dKw2Pk1n0I76Y0W16zgdOIZqfVsnCSbvaeEB2+AkWpCBEQS/Jmp9U4u3Fl6nIdWB6gNQgb+7NABtR1qLjxcejiZdhfxKXGA3AjUswHXAXQBnVDbpSbCPeO5fAr8hlrxpgE6gW6o7ROb5N96Z3l9ePZxgUcMXEd1NxssbMk8kWxyztEr2A5AV3XjGySb3acTSLYYoFjL4EF31PYLLXwaeyiZcltnp/woEJtIrdAltT21BEkR7tnuo1dgfQC6tCbRlGh1H02k3C5qpalg/bt3WdOGDPk4lACdct1S27eiLEgPPMbDmcvkylLAgiUOc/sm2LHuITavmX48KoBun1828DNqO/tKsiX7JF+zeqmVpIqPzg2xyckc++Sfw2ImoB6POtxe6Jra3tMEb75Nxv/Hmxk2MZGbIsCpz4bZn1d45OPSIQF0Tm13IViXbJn2i+i9NcYgRQIA+zsGyMelA6Fzap8AnqktDl8RO9r7WVFKCQAs3dJHPj4tcN2TRQcizrcs1Hv+NZf1D04GEqDj/JBwDqnHqYNCiFj7fYL8Jg+9AnTQfXmYlUo5AYAtbffIx6lNAm6L2hpfbO/atcO3dGsfy+VyUgIAL66yySEE3FzNto2R2ElYtrffkHbYd7fHWbkEEeDQyUHk6cnHrQkPtonV+CKla2FWDx6+nwQRAFi5K0s+bl3ANrGmkvP5fPoH1cFfX/fYyP2cNgG6Lg6z55a55OPXJgG3UVzGn2vbug98fvW+r/FlBADePtJPPn59iKKS6lYW5ad++8q4Vu+5G2h8FQIAr663JFlUAtiqqksBZ1Uj9UPp4neLHeb0TUQmwNEzg2xemv559OE2VsX4KE2ysXoXhpOJCgGAdXttShblAZtVpayMe5Zt1A+ji5fXZdj4uL/jF4YApy4NsxdaLXQIue2iGb/Ze4r6IcLg6rejUuPrEAB47yO7kkVTJIhyAsnG41rYylUVHQIAizdZlixqyh9DC2V8HGKkHrwuELffHZiUWz4kAVBEAueS+jl1EepAqo2ndLFW64guAYBNB2xMFjmdWsbHWXbqQesC0zMMGjcBgEVv2JYs4tDpT5BvzmDAoBWBxM2tH8a0jB+FAAe77EsWwaZKxkdLE9u2fPce65dbu4oEAFp32JYscnNK7WrQ14Z+sOpAMefwiLrjVy0CdF0cYguX2rU3ANtKCWBTdS9wqWcklPGjEgDYcdiuZBEaV1U0PtqbUQ9SB6/vyoY2fjUIALy81q5kUcUWduhxRz1AVcxvdthtb2aVT60JcOT0oKg4otaHKmBjX+OLA50GN2Esx+FT8mRPLQgAIO1MrQ91ArgZ31JytDqlHpwqXlrjsbExvZg/TgKcvDTM/rjcHocQtp45/ae9FuqBqeLr/6gle2pFAAChKLVeVAFbzyRAk3OBemAq2LhfPdlTSwIA6Y12JItg62nGR9tzyq7bqljY4rK+e5WrfCgJcPzskHBOqfUkJQC39bRW9+h9Tz0oFXx8Yahqxo+DAMCGfXY4hLB5SfjnrqQekAypjRntZA8FAU5/NixK0an1JQNsXrL+m1/4ceM7/WRPJcExsas3Rtn7nQNVJ8GBj82vHppWKBLrNStVAOrzqyWjPHzEWQGEbjBW81t9bPn2LNt9tF/UE1SLBMu2Ge4QcpsL4+MyJPLBVADi68HhcMmeUrnbP8kufDUyw8ggQBHoD7Dt4D3WyX2NqASAv/L7Fnr9VYK4CAs3YlEPpBLOfxk+2QP5wRlnZy7ztTnAUKUEKGLJpj72JnfmUFoehQTbDpldPQTb8/Xfe5Z6IEHA1BxWem+N8rdd/ib7EaAUq/dkxZoelgTYtaTWYxBwJR7y/8uoB+IHnMbB26sjY+M59uU1vr5/qj6FywhQxIodWfbOh/2ioZQOAZCzMLV6CLafU7hUkXww5Wjr8j/S7Sdo+3LxyojSGx+WAFN+wtY+tp1P7V0afsIbbxtaPcRtb2T1b+Mqj90flcf8t91x1v158PoeBwGKWLy5j23kfsIxBT/h5KfDoj8RtV7LIaqFTcwBfHUt+Eg35L//G2WnqxSyhSVAKdZwP+FgV2U/Yc9R85JFIieQwH25BgymCHTt9JPxiRy7ch3xe/QQrdoEKGLlzqzICgb5CQb2Je6ZU7g0mXogAmjR5mWnJ3uwB3Dp65nxu4kEKGIZ9xN2tN9jJy5OJ6txfYm57TEDGNPwCdm0otzJTLCzX+T31uMwfJwEmNpP2NLHNu2/y453/0gEw/oSe3MK16dTD2Sqf+/N78diN3qtCDDlMG7qY2v33mWHTg6Y1ZeY294YAhw7Ozi1P19L1IIA0/yEXdxpfMeQWUAQwJAlAClUtHOrdwL8fW3GpBPGnlFOIIDp8lh3dT19EwiAJe4PprWdKziBRoWBALaB1/JpEhsothMAdYJY8w3dDhZh4HkDBuIL7J7t+qDfWgKg57BRYV85uO0xA3SQD0SCl9ZkRP9eWwjwyrqM8bUABXQYkwySpU0xhb62Lcs6z5u7E4idPpUDIn8ypeOYSAYZkg5esTPLPr0yIu2+gd1CnA3QTcvGSYA0B6IY2TpfXNLQxo5a30BDyluKI2HPUA+kCHj/qNlDDl0WKsGxevd49LAxqvGxPM2XjBV+AJpNYp/DpJ1AURBiUkkYvP9i9S9yAnjTZX+DaffoJ+H9g7CGR1j3nEKDCIS12OLGd6HGwaRoQJSEmVYU+rfVHhu+/2MR6LWbo+JMQGUmO6Lo4kSIsDFMWKfSNRRLWWnJOdrPm3aAVBSFmlgWXt7sEQc4kB+QKRBv5Pb2e7ERAIUqssbROL629eDMMSzZbFiZeLEs3NSDISjhLpeh4Umx7ssaMiD+bpMUaOgQAE6b7DYxjAkdS7ouzoxScFUdtT7LMe1giIlHw/AmORn/g6AoFlWps0OdP7p7hiUA/AuVUi74A+gU4vf5KC2XOYkkBCg9Gmbq4VBMm0gRBwkqgGX7B1A+PO+ggpKgsO4vK+VhHXwBVAAFkQuhqqk3kE07HGry8XDU5FcStIWHl40Zo9LnwH9AXZ6MAHBCZUe8EaLiFLBsL2LVbjOrgWccDze5QQTeQpX27zj6tV3hJM4r6zPsg5Lpemr7lv9eRiIA5V4dCruR+wxuLz+jQYTpLWIwHQ8MqZ0P/Pb7MdYiuQMYpMLOI87vIcRU2ZrFUnPwhNp+A7arTb5xzLdFjOlNorCTpio4+o0zhSBOpc+EZy+LKJDD33lYLyNpYPXvNPg2ibKhTRzqA3QE9wUiHAzTtgXx/po9+jUJpreTD2wTlw8HzW4UCY/e7wpYmSCc1NmDRxQQpioJOQzTbxgLbBSZXwbMbxWLmDtsj8B/3RiteA8gMnr7QtYlItEjW3JMQMVWsflZwL1OPUgZEM6FFWwrI2dQWp+H4o3NB/S2kMuBo+zUepFB2ixaEMCSdvFf/Lvy+UGZIKpAW5hiNBDF+Cae+/MlgEq7eFsujMAWbdSegdXoEoZNKFmewAwoXhhRWAasuDIGTRuitI57kNrFK18ZA7Hp0qgPz4RvHhmVACZV90ihc2lUfhYwr3GEHxrS4XsIRiEAchQmVfdUgva1cRCbLo58sayKKG4CIOdvWnVPxZckzMWRYhYwsFAkCDpXxkYlgHHVPRUQ+upYQQDLLo/W7SkYhgAoOaN+Ti0CRLk8GpJIOQeoH0IVSOfeCagiqgYBUH1sYnVPILjtIhkf0pDOPM6diAHyh1EEpufxClVEYQmA4o9Gi66Mhc1gu8gEgCTT7iLqB9KBrIooDAGM7fUXRABus6oYH5JOs4e5M/EN9UNpsF+0gq8WAd4zuLrH9/m5rWCzqhEAkkw7c23YIi4CmTl0EI1KAFHdY9UVsW4Otqqq8UtIsJz+AdWBJhNRCYD0M/Vz6AA2isX4kPxS4JyjfkgdVKoikhHgrfctC/m4bao+9ZfLwpbMEwlDGkupoFIVUSUCtJ80v7qnDB5sE6vxi5Jsdp+2yR9AFdCoTxVREAEwaxjTy08JfN3nNqmJ8adIkHJb6R9cHbt9qoiCCIBOJNTj1QFsUVPjQ/ha8xCPNfdRP7wOcFmUjAC7j9hR3TNlfG4D2KLmBCiQ4JFEyu2iVoIqyquIyglgT3VPAVz3gSXetZJEq/tossm9TK4MRbSWVBGVEwDtXqjHpwqhc657UuMXZUF64DHuiPRSK0UVOLJdTgCcPKIelzrcXuic2u7TJNmSfdIWEhSriIoEsKm6BzqGrqnt7StgpS3LAc7to+MIqntMvM/HD9CtcW9+uWBdssUxxDk+dPGiHocSoFNT1nyZiIOmloWIJqMQ6tF6+7oi9gnEZpE9O4bmwc1Bh2RxfjUkv21sT+7AIHg1396NS5CksC2LSAnoqmaJnVqJSCWLeoLZJSEYophjeewpXUpBtYpN5WW1AnQSWyWPaQKGc7Y32lRtHJvhhQ7cxrp+64NElJw3OW3URqB76522qpVu2yw4vWLTMbTohne7I5/YqUfBIUZbTiWHMjx/ttAHNR8kwVn2fJOKeogYxGZOu/b5/FnJt6vJ9yyyI8tYZvhejF25LcusVBa0N0OPO5ObWWJsGKO0FdushBckRdDqFP1u0fSYsss5vluMgY8FY7IuYVMPgrbn6H2PCxBEJBHn9Tf8s4UHz78L3zmj5fqsmCG4DAk3YiWbvGfFvYgpdz888EJL/J7Chdkerk8XEP8Wv+vJzyo8EsHf8L/FZ+Czpi5YqjP5P2ey0rAsl+yGAAAAAElFTkSuQmCC",Gp="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png";var qp={name:"ethereum",id:"0x1",networkId:"1",namespace:"eip155",platform:"evm",label:"Ethereum",fullName:"Ethereum Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbC1vcGFjaXR5Oi42MDJ9LnN0MCwuc3Qxe2ZpbGw6I2ZmZn08L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik01MTEuNCA3My4zdjMxNS41TDc3OCA1MDggNTExLjQgNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTExLjQgNzMuMyAyNDQuNyA1MDhsMjY2LjYtMTE5LjJWNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNNTExLjQgNzEyLjN2MjE0LjVsMjY2LjgtMzY5LjEtMjY2LjggMTU0LjZ6Ii8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTUxMS40IDkyNi43VjcxMi4zTDI0NC43IDU1Ny42bDI2Ni43IDM2OS4xeiIvPjxwYXRoIGQ9Ik01MTEuNCA2NjIuNyA3NzggNTA4IDUxMS40IDM4OC44djI3My45eiIgZmlsbD0iI2ZmZiIgZmlsbC1vcGFjaXR5PSIuMiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im0yNDQuNyA1MDggMjY2LjYgMTU0LjdWMzg4LjhMMjQ0LjcgNTA4eiIvPjwvc3ZnPgo=",logoBackgroundColor:"#5683ec",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGltYWdlLXJlbmRlcmluZz0ib3B0aW1pemVRdWFsaXR5IiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgdGV4dC1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4PSIwIiB5PSIwIiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGU+LnN0MXtmaWxsOiM4YzhjOGN9PC9zdHlsZT48cGF0aCBkPSJtNDk5LjggNzcuNS01LjUgMTl2NTU5LjFsNS41IDUuNSAyNTkuNy0xNTMuNUw0OTkuOCA3Ny41eiIgZmlsbD0iIzM0MzQzNCIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Im00OTkuOCA3Ny41LTI1OS4zIDQzMEw0OTkuOCA2NjFWNzcuNXoiLz48cGF0aCBkPSJtNDk5LjggNzEwLjMtMi45IDR2MTk5LjFsMi45IDkuMSAyNTkuNy0zNjUuOC0yNTkuNyAxNTMuNnoiIGZpbGw9IiMzYzNjM2IiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNDk5LjggOTIyLjVWNzEwLjNMMjQwLjUgNTU2LjdsMjU5LjMgMzY1Ljh6Ii8+PHBhdGggZD0ibTQ5OS44IDY2MSAyNTkuNy0xNTMuNS0yNTkuNy0xMTcuOFY2NjF6IiBmaWxsPSIjMTQxNDE0Ii8+PHBhdGggZD0iTTI0MC41IDUwNy41IDQ5OS44IDY2MVYzODkuN0wyNDAuNSA1MDcuNXoiIGZpbGw9IiMzOTM5MzkiLz48L3N2Zz4K",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Hp},wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",logo:Gp,logoBackgroundColor:"#FFFFFF"},stables:{usd:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]},explorer:"https://etherscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://etherscan.io/tx/${e.id||e}`:t?`https://etherscan.io/token/${t}`: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:Hp,type:"NATIVE"},{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Gp,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:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c/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:"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:"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:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Zp="https://assets.spooky.fi/tokens/FTM.png",Jp="https://assets.spooky.fi/tokens/wFTM.png";var Xp={name:"fantom",id:"0xfa",networkId:"250",namespace:"eip155",label:"Fantom",fullName:"Fantom Opera",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00NjcgMTM1LjVjMTgtOS4zIDQ1LjEtOS4zIDYzIDBsMTgzLjQgOTdjMTAuNyA2LjEgMTYuNiAxNCAxOCAyMy4zdjQ4Ni42YzAgOS4zLTYuMSAxOS4yLTE4IDI1LjJsLTE4My4yIDk3Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTgzLjMtOTdjLTExLjktNi4xLTE3LjItMTUuOS0xOC0yNS4yVjI1NS43Yy43LTguNyA2LjctMTcuMiAxNy4yLTIzLjNMNDY3IDEzNS41em0yMzUuOCAzODkuNy0xNzIuNiA5MC45Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTcxLjktOTAuM3YyMTQuNGwxNzEuOSA5MC4zYzEwIDUuMyAyMC42IDEwLjcgMzEuMiAxMS4zaC43YzEwIDAgMjAtNS4zIDMwLjUtMTBsMTc0LTkyLjMtLjgtMjE0LjN6TTIzNy4zIDczMS4xYzAgMTguNiAyIDMxLjIgNi43IDM5LjggMy4zIDcuMyA4LjcgMTIuNiAxOC42IDE5LjJsLjcuN2MyIDEuNCA0LjcgMi42IDcuMyA0LjdsMy4zIDIgMTAuNyA2LjEtMTQuNiAyNC42LTExLjMtNy4zLTItMS40Yy0zLjMtMi02LjEtNC04LjctNS4zLTI3LjktMTguNi0zNy44LTM5LjItMzcuOC04MS42di0xLjRoMjcuMXpNNDg1IDM5Ni40Yy0xLjQuNy0yLjYuNy00IDEuNGwtMTgzLjIgOTYuOWgtLjcuN2wxODMuMyA5N2MxLjQuNyAyLjYgMS40IDQgMS40bC0uMS0xOTYuN3ptMjkuMyAwdjE5Ny44YzEuNC0uNyAyLjYtLjcgNC0xLjRsMTgzLjMtOTdoLjctLjdsLTE4My4zLTk4LjJjLTEuNC0uNS0yLjgtMS4yLTQtMS4yem0xODguNS0xMDctMTY0LjcgODYuMyAxNjQuNyA4Ni40VjI4OS40em0tNDA3LjcgMHYxNzMuM2wxNjQuNy04Ni4zLTE2NC43LTg3em0yMjIuNS0xMjhjLTkuMy01LjMtMjYuNS01LjMtMzYuNiAwbC0xODMuMiA5N2gtLjcuN2wxODMuMyA5N2M5LjMgNS4zIDI2LjUgNS4zIDM2LjYgMGwxODMuMy05N2guNy0uN2wtMTgzLjQtOTd6bTIxMi41IDkuMyAxMS4zIDcuMyAyIDEuNGMzLjMgMiA2LjEgNCA4LjcgNS4zIDI3LjkgMTguNiAzNy44IDM5LjIgMzcuOCA4MS42djEuNGgtMjguN2MwLTE4LjYtMi0zMS4yLTYuNy0zOS44LTMuMy03LjMtOC43LTEyLjYtMTguNi0xOS4ybC0uNy0uN2MtMi0xLjQtNC43LTIuNi03LjMtNC43bC0zLjMtMi0xMC43LTYuMSAxNi4yLTI0LjV6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#226efb",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iNDI1IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE5NjlmZiIvPjxwYXRoIGQ9Ik00NzQuMSAyMTAuM2MxNC4zLTcuNCAzNS45LTcuNCA1MC4yIDBsMTQ1LjkgNzcuMmM4LjUgNC44IDEzLjIgMTEuMSAxNC4zIDE4LjV2Mzg3LjVjMCA3LjQtNC44IDE1LjMtMTQuMyAyMC4xbC0xNDUuOSA3Ny4yYy0xNC4zIDcuNC0zNS45IDcuNC01MC4yIDBsLTE0NS45LTc3LjJjLTkuNS00LjgtMTMuNy0xMi43LTE0LjMtMjAuMVYzMDZjLjUtNi45IDUuMy0xMy43IDEzLjctMTguNS4xIDAgMTQ2LjUtNzcuMiAxNDYuNS03Ny4yem0xODcuNyAzMTAuM0w1MjQuMyA1OTNjLTE0LjMgNy40LTM1LjkgNy40LTUwLjIgMGwtMTM2LjktNzEuOXYxNzAuN2wxMzYuOSA3MS45YzcuOSA0LjIgMTYuNCA4LjUgMjQuOCA5aC41YzcuOSAwIDE1LjktNC4yIDI0LjMtNy45bDEzOC41LTczLjVWNTIwLjZoLS40ek0yOTEuMiA2ODQuNWMwIDE0LjggMS42IDI0LjggNS4zIDMxLjcgMi42IDUuOCA2LjkgMTAgMTQuOCAxNS4zbC41LjVjMS42IDEuMSAzLjcgMi4xIDUuOCAzLjdsMi42IDEuNiA4LjUgNC44LTExLjYgMTkuNi05LTUuOC0xLjYtMS4xYy0yLjYtMS42LTQuOC0zLjItNi45LTQuMi0yMi4yLTE0LjgtMzAuMS0zMS4yLTMwLjEtNjV2LTEuMWgyMS43em0xOTcuMi0yNjYuNGMtMS4xLjUtMi4xLjUtMy4yIDEuMWwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzEuMS41IDIuMSAxLjEgMy4yIDEuMVY0MTguMXptMjMuMiAwdjE1Ny41YzEuMS0uNSAyLjEtLjUgMy4yLTEuMWwxNDUuOS03Ny4yaC41LS41bC0xNDUuOS03OC4yYy0xLjEtLjUtMi4xLTEtMy4yLTF6TTY2MS44IDMzM2wtMTMxLjEgNjguNyAxMzEuMSA2OC43VjMzM3ptLTMyNC42IDB2MTM4bDEzMS4xLTY4LjdjMC0uMS0xMzEuMS02OS4zLTEzMS4xLTY5LjN6bTE3Ny4xLTEwMi4xYy03LjQtNC4yLTIxLjEtNC4yLTI5LjEgMGwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzcuNCA0LjIgMjEuMSA0LjIgMjkuMSAwbDE0NS45LTc3LjJoLjUtLjVsLTE0NS45LTc3LjJ6bTE2OS4xIDcuNCA5IDUuOCAxLjYgMS4xYzIuNiAxLjYgNC44IDMuMiA2LjkgNC4yIDIyLjIgMTQuOCAzMC4xIDMxLjIgMzAuMSA2NXYxLjFoLTIyLjdjMC0xNC44LTEuNi0yNC44LTUuMy0zMS43LTIuNi01LjgtNi45LTEwLTE0LjgtMTUuM2wtLjUtLjVjLTEuNi0xLjEtMy43LTIuMS01LjgtMy43bC0yLjYtMS42LTguNS00LjggMTIuNi0xOS42eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",currency:{name:"Fantom",symbol:"FTM",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Zp},wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",logo:Jp},stables:{usd:["0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf","0x1B6382DBDEa11d97f24495C9A90b7c88469134a4"]},explorer:"https://ftmscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://ftmscan.com/tx/${e.id||e}`:t?`https://ftmscan.com/token/${t}`: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:Zp,type:"NATIVE"},{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",symbol:"WFTM",name:"Wrapped Fantom",decimals:18,logo:Jp,type:"20"},{address:"0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf",symbol:"lzUSDC",name:"LayerZero USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"},{address:"0x1B6382DBDEa11d97f24495C9A90b7c88469134a4",symbol:"axlUSDC",name:"Axelar Wrapped USDC",decimals:6,logo:"https://assets.spooky.fi/tokens/USDC.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const Kp="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/info/logo.png",$p="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/assets/0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270/logo.png";var ef={name:"polygon",id:"0x89",networkId:"137",namespace:"eip155",label:"Polygon (POS)",fullName:"Polygon (POS) Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMzEuNSA0NTkuM2MtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnYxOTQuNGMwIDE5LjIgOS42IDM2IDI0IDQzLjJsMTY1LjYgOTZjMTQuNCA5LjYgMzMuNiA5LjYgNDggMGwxNjUuNi05NmMxNC40LTkuNiAyNC0yNCAyNC00My4ydi02OS42bC03Ni44LTQzLjJ2NjQuOGMwIDE5LjItOS42IDM2LTI0IDQzLjJsLTg2LjQgNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtODYuNC01MC40Yy0xNC40LTkuNi0yNC0yNC0yNC00My4yVjU1MC41YzAtMTkuMiA5LjYtMzYgMjQtNDMuMmw4OC44LTUwLjRjMTQuNC05LjYgMzMuNi05LjYgNDggMGwxMTIuOCA2NC44IDc2LjggNDUuNiAxMTIuOCA2NC44YzE0LjQgOS42IDMzLjYgOS42IDQ4IDBsMTY4LTk2YzE0LjQtOS42IDI0LTI0IDI0LTQzLjJ2LTE5MmMwLTE0LjQtOS42LTMxLjItMjQtNDAuOGwtMTY4LTk2Yy0xNC40LTkuNi0zMy42LTkuNi00OCAwbC0xNjUuNiA5NmMtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnY2OS42bDc2LjggNDUuNnYtNjkuNmMwLTE5LjIgOS42LTM2IDI0LTQzLjJsODguOC01Mi44YzE0LjQtOS42IDMzLjYtOS42IDQ4IDBsODguOCA1MC40YzE0LjQgOS42IDI0IDI0IDI0IDQzLjJ2MTAwLjhjMCAxOS4yLTEyIDM2LTI0IDQzLjJsLTg4LjggNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtMTEyLjgtNjkuNi03OS4yLTQzLjItMTE3LjYtNjkuNmMtMTQuNC05LjYtMzMuNi05LjYtNDggMCAwIDIuNC0xNjAuOCA5OC40LTE2My4yIDk4LjR6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#824ee2",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMDkuNyA0NTljLTE2LjQgOS40LTI1LjggMjUuOC0yNS44IDQ2Ljl2MjA2LjNjMCAyMS4xIDkuNCAzNy41IDI1LjggNDYuOWwxNzUuOCAxMDMuMWMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBsMTc1LjgtMTAzLjFjMTYuNC05LjQgMjUuOC0yNS44IDI1LjgtNDYuOXYtNzIuN2wtODItNDYuOXY2OGMwIDIxLjEtOS40IDM3LjUtMjUuOCA0Ni45TDMzNyA3NjEuNGMtMTYuNCA5LjQtMzUuMiA5LjQtNTEuNiAwTDE5NCA3MDcuNWMtMTYuNC05LjQtMjUuOC0yNS44LTI1LjgtNDYuOVY1NTIuOGMwLTIxLjEgOS40LTM3LjUgMjUuOC00Ni45bDkzLjgtNTMuOWMxNC4xLTkuNCAzNS4yLTkuNCA1MS42IDBsMTE5LjUgNjggODIgNDkuMiAxMTkuNSA2OGMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBMODkwLjIgNTM0YzE2LjQtOS40IDI1LjgtMjUuOCAyNS44LTQ2LjlWMjgzLjJjMC0xNi40LTkuNC0zMi44LTI1LjgtNDIuMkw3MTIuMSAxMzcuOWMtMTYuNC05LjQtMzUuMi05LjQtNTEuNiAwTDQ4NC43IDI0MWMtMTYuNCA5LjQtMjUuOCAyNS44LTI1LjggNDYuOXY3NWw4MiA0OS4ydi03Mi43YzAtMjEuMSA5LjQtMzcuNSAyNS44LTQ2LjlsOTMuOC01Ni4zYzE2LjQtOS40IDM1LjItOS40IDUxLjYgMGw5My44IDUzLjljMTQuMSA5LjQgMjUuOCAyNS44IDI1LjggNDYuOXYxMDhjMCAyMS4xLTExLjcgMzcuNS0yNS44IDQ2LjlsLTkzLjggNTYuM2MtMTQuMSA5LjQtMzUuMiA5LjQtNTEuNiAwTDU0MSA0NzUuNGwtODItNDYuOS0xMjQuMi03Mi43Yy0xNC4xLTkuNC0zNS4yLTkuNC01MS42IDAtLjEuMS0xNzEuMiAxMDMuMi0xNzMuNSAxMDMuMnoiIGZpbGw9IiM4MjQ3ZTUiLz48L3N2Zz4=",currency:{name:"Polygon",symbol:"MATIC",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Kp},wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",logo:$p},stables:{usd:["0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174","0xc2132D05D31c914a87C6611C10748AEb04B58e8F"]},explorer:"https://polygonscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://polygonscan.com/tx/${e.id||e}`:t?`https://polygonscan.com/token/${t}`:n?`https://polygonscan.com/address/${n}`:void 0,endpoints:["https://polygon-rpc.com","https://polygon.meowrpc.com","https://polygon.llamarpc.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"MATIC",name:"Polygon",decimals:18,logo:Kp,type:"NATIVE"},{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",symbol:"WMATIC",name:"Wrapped Matic",decimals:18,logo:$p,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:"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:"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:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xf6261529C6C2fBEB313aB25cDEcD243613b40EB5",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const tf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDp1cmwoI1NWR0lEXzAwMDAwMDE5Njc2ODQzODE5NzI3MzAwODIwMDAwMDA1OTQ3NjMyODMzODYxMjM4OTE3Xyl9LnN0MntmaWxsOnVybCgjU1ZHSURfMDAwMDAwNjQzMjA1MjE4MTcxODM4NzM1NjAwMDAwMDMxNzkyNDIxNTkzMzkwODM5NjdfKX08L3N0eWxlPjxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfMV8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iODE1Ljg1NiIgeTE9IjcwLjgyNCIgeDI9IjM4OC4zMzYiIHkyPSItNzQ4LjA1MiIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSA2NTcuOWM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDc5NS4xYy00LjkgNC45LTEyLjIgNy4zLTE3LjEgNy4zSDEyNS4zYy0xMi4yIDAtMTcuMS0xNC43LTkuOC0yNC41bDEyMi40LTEyMHoiIGZpbGw9InVybCgjU1ZHSURfMV8pIi8+PGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8wMDAwMDE1MDgxNTQ0MzI2NzI2OTc2MDQ0MDAwMDAxMzQ2MDgyNDM3MDQwMzE3MjU0M18iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iNjI4LjQ4MSIgeTE9IjE2NC4xMzQiIHgyPSIyMDAuOTYyIiB5Mj0iLTY1NC43NCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSAyMDQuOGM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDM0MmMtNC45IDQuOS0xMi4yIDcuMy0xNy4xIDcuM0gxMjUuM2MtMTIuMiAwLTE3LjEtMTQuNy05LjgtMjJsMTIyLjQtMTIyLjV6IiBmaWxsPSJ1cmwoI1NWR0lEXzAwMDAwMTUwODE1NDQzMjY3MjY5NzYwNDQwMDAwMDEzNDYwODI0MzcwNDAzMTcyNTQzXykiLz48bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzAwMDAwMDA3NDA5ODc3MzYzMTA0OTgxNjMwMDAwMDE1MTMzNzA1NTcwNjgwMDk3NzA5XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI3MjAuOTIzIiB5MT0iMTE1Ljg3IiB4Mj0iMjkzLjQwNiIgeTI9Ii03MDMuMDAzIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTkxLjQzNSkiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwZmZhMyIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2RjMWZmZiIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTc2Mi4xIDQzMC4xYy00LjktNC45LTEyLjItNy4zLTE3LjEtNy4zSDEyNS4zYy0xMi4yIDAtMTcuMSAxNC43LTkuOCAyMkwyMzggNTY3LjNjNC45IDQuOSAxMi4yIDcuMyAxNy4xIDcuM2g2MTkuN2MxMi4yIDAgMTcuMS0xNC43IDkuOC0yMkw3NjIuMSA0MzAuMXoiIGZpbGw9InVybCgjU1ZHSURfMDAwMDAwMDc0MDk4NzczNjMxMDQ5ODE2MzAwMDAwMTUxMzM3MDU1NzA2ODAwOTc3MDlfKSIvPjwvc3ZnPgo=",nf="https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png";var rf={name:"solana",networkId:"solana",namespace:"solana",label:"Solana",fullName:"Solana Mainnet Beta",logo:tf,logoBackgroundColor:"#000000",logoWhiteBackground:tf,currency:{name:"Solana",symbol:"SOL",decimals:9,address:"11111111111111111111111111111111",logo:nf},wrapped:{address:"So11111111111111111111111111111111111111112",logo:nf},stables:{usd:["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]},explorer:"https://solscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://solscan.io/tx/${e.id||e}`:t?`https://solscan.io/token/${t}`: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"],sockets:["wss://solana-mainnet.phantom.app/YBPpkkN4g91xDiAnTE9r0RcMkjg0sKUIWvAfoFVJ","wss://mainnet-beta.solflare.network"],tokens:[{address:"11111111111111111111111111111111",symbol:"SOL",name:"Solana",decimals:9,logo:nf,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"},{address:"DePay1miDBPWXs6PVQrdC5Vch2jemgEPaiyXLNLLa2NF",symbol:"DEPAY",name:"DePay",decimals:9,logo:"https://depay.com/favicon.png",type:"SPL"}],zero:"0",maxInt:"340282366920938463463374607431768211455"};const of="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDojMjEzMTQ3fTwvc3R5bGU+PHBhdGggZD0iTTkyIDkyaDgxNnY4MTZIOTJWOTJ6IiBmaWxsPSJub25lIi8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTE2NS44IDM0MC4xVjY2MGMwIDIwLjYgMTAuOCAzOS4yIDI4LjcgNDkuNmwyNzcuMSAxNTkuOWMxNy42IDEwLjEgMzkuNSAxMC4xIDU3LjEgMGwyNzcuMS0xNTkuOWMxNy42LTEwLjEgMjguNy0yOSAyOC43LTQ5LjZWMzQwLjFjMC0yMC42LTEwLjgtMzkuMi0yOC43LTQ5LjZsLTI3Ny4xLTE2MGMtMTcuNi0xMC4xLTM5LjUtMTAuMS01Ny4xIDBsLTI3Ny4xIDE2MGMtMTcuNiAxMC4xLTI4LjQgMjktMjguNCA0OS42aC0uM3oiLz48cGF0aCBkPSJtNTYwLjQgNTYyLTM5LjUgMTA4LjRjLTEgMi45LTEgNi4yIDAgOS41bDY3LjkgMTg2LjQgNzguNi00NS40LTk0LjMtMjU4LjhjLTIuMy02LTEwLjQtNi0xMi43LS4xem03OS4zLTE4Mi4xYy0yLjMtNS45LTEwLjQtNS45LTEyLjcgMGwtMzkuNSAxMDguNGMtMSAyLjktMSA2LjIgMCA5LjVMNjk4LjggODAzbDc4LjYtNDUuNC0xMzcuNy0zNzcuNHYtLjN6IiBmaWxsPSIjMTJhYWZmIi8+PHBhdGggZD0iTTUwMCAxNDIuNmMyIDAgMy45LjYgNS41IDEuNmwyOTkuNiAxNzNjMy42IDIgNS41IDUuOSA1LjUgOS44djM0NmMwIDMuOS0yLjMgNy44LTUuNSA5LjhsLTI5OS42IDE3M2MtMS42IDEtMy42IDEuNi01LjUgMS42cy0zLjktLjYtNS41LTEuNmwtMjk5LjYtMTczYy0zLjYtMi01LjUtNS45LTUuNS05LjhWMzI2LjdjMC0zLjkgMi4zLTcuOCA1LjUtOS44bDI5OS42LTE3M2MxLjYtMSAzLjYtMS42IDUuNS0xLjZ2LjN6bTAtNTAuNmMtMTAuOCAwLTIxLjIgMi42LTMxIDguMmwtMjk5LjYgMTczYy0xOS4yIDExLjEtMzEgMzEuMy0zMSA1My41djM0NmMwIDIyLjIgMTEuOCA0Mi40IDMxIDUzLjVsMjk5LjYgMTczYzkuNSA1LjUgMjAuMiA4LjIgMzEgOC4yczIxLjItMi42IDMxLTguMmwyOTkuNi0xNzNjMTkuMi0xMS4xIDMxLTMxLjMgMzEtNTMuNXYtMzQ2YzAtMjIuMi0xMS44LTQyLjQtMzEtNTMuNWwtMjk5LjktMTczYy05LjUtNS41LTIwLjItOC4yLTMxLTguMmguM3oiIGZpbGw9IiM5ZGNjZWQiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJtMzAxLjUgODAzLjIgMjcuOC03NS43IDU1LjUgNDYtNTEuOSA0Ny43LTMxLjQtMTh6Ii8+PHBhdGggZD0iTTQ3NC41IDMwMi4yaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOEwyMjIuOSA3NTcuNWw3OC42IDQ1LjRMNDgxLjEgMzExYzEuNi00LjYtMS42LTkuMS02LjItOS4xbC0uNC4zem0xMzMuMiAwaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOGwtMTg2IDUwOS44IDc4LjYgNDUuNEw2MTMuOSAzMTFjMS42LTQuNi0xLjYtOS4xLTYuMi05LjF2LjN6IiBmaWxsPSIjZmZmIi8+PC9zdmc+Cg==";var af={name:"arbitrum",id:"0xa4b1",networkId:"42161",namespace:"eip155",platform:"evm",label:"Arbitrum",fullName:"Arbitrum One",logo:of,logoBackgroundColor:"#2b354d",logoWhiteBackground:of,currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:qp.currency.logo},wrapped:{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",logo:qp.wrapped.logo},stables:{usd:["0xaf88d065e77c8cC2239327C5EDb3A432268e5831","0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"]},explorer:"https://arbiscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://arbiscan.io/tx/${e.id||e}`:t?`https://arbiscan.io/token/${t}`:n?`https://arbiscan.io/address/${n}`:void 0,endpoints:["https://arbitrum.blockpi.network/v1/rpc/public","https://arbitrum-one.publicnode.com","https://endpoints.omniatech.io/v1/arbitrum/one/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:qp.currency.logo,type:"NATIVE"},{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:qp.wrapped.logo,type:"20"},{address:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8/logo.png",type:"20"},{address:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1/logo.png",type:"20"},{address:"0x912CE59144191C1204E64559FE8253a0e49E6548",symbol:"ARB",name:"Arbitrum",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0x912CE59144191C1204E64559FE8253a0e49E6548/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const sf="https://traderjoexyz.com/static/media/avalanche.7c81486190237e87e238c029fd746008.svg",uf="https://raw.githubusercontent.com/traderjoe-xyz/joe-tokenlists/main/logos/0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7/logo.png";var cf={name:"avalanche",id:"0xa86a",networkId:"43114",namespace:"eip155",platform:"evm",label:"Avalanche",fullName:"Avalanche C-Chain",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0zNTkuMSA3NTEuMWgtOTUuM2MtMjAgMC0yOS45IDAtMzYtMy44LTYuNi00LjMtMTAuNC0xMS4zLTEwLjktMTguOS0uMy03LjEgNC42LTE1LjggMTQuNC0zM2wyMzUtNDE0LjNjMTAuMS0xNy42IDE1LjEtMjYuNCAyMS40LTI5LjYgNi45LTMuNSAxNS4xLTMuNSAyMS45IDAgNi40IDMuMyAxMS40IDEyIDIxLjQgMjkuNmw0OC40IDg0LjMuMi41YzEwLjggMTguOSAxNi4zIDI4LjUgMTguNiAzOC41IDIuNiAxMC45IDIuNiAyMi42IDAgMzMuNS0yLjQgMTAuMS03LjggMTkuOC0xOC44IDM4LjlMNDU2LjIgNjk0LjlsLS4zLjVjLTEwLjggMTktMTYuMyAyOC43LTI0LjEgMzYtOC4zIDgtMTguMyAxMy43LTI5LjMgMTYuOS05LjkgMi44LTIxLjEgMi44LTQzLjQgMi44em0yNDAuMyAwaDEzNi40YzIwLjIgMCAzMC4yIDAgMzYuMy00IDYuNi00LjMgMTAuNi0xMS4zIDEwLjktMTkuMS4zLTYuOS00LjUtMTUuMi0xMy45LTMxLjZsLTEtMS43TDY5OS44IDU3OGwtLjgtMS4yYy05LjYtMTYuMy0xNC40LTI0LjUtMjAuNy0yNy42LTYuOS0zLjYtMTUtMy42LTIxLjcgMC02LjIgMy4zLTExLjMgMTEuOC0yMS4zIDI5bC02OC4xIDExNi45LS4yLjNjLTEwLjEgMTcuMi0xNSAyNS44LTE0LjUgMzIuOC41IDcuNyA0LjUgMTQuOSAxMC45IDE5IDUuNyAzLjkgMTUuOCAzLjkgMzYgMy45eiIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#E84142",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yMzUuNiAyNTkuNWg1MjguOXY0ODFIMjM1LjZ2LTQ4MXoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNOTI4IDUwMGMwIDIzNi40LTE5MS42IDQyOC00MjggNDI4UzcyIDczNi40IDcyIDUwMCAyNjMuNiA3MiA1MDAgNzJzNDI4IDE5MS42IDQyOCA0Mjh6TTM3OC43IDY3MC4zaC04My4xYy0xNy41IDAtMjYuMSAwLTMxLjMtMy40LTUuNy0zLjctOS4xLTkuOC05LjYtMTYuNS0uMy02LjIgNC0xMy44IDEyLjYtMjguOUw0NzIuNSAyNjBjOC43LTE1LjQgMTMuMS0yMyAxOC43LTI1LjkgNi0zIDEzLjEtMyAxOS4xIDAgNS42IDIuOCAxMCAxMC41IDE4LjcgMjUuOWw0Mi4yIDczLjYuMi40YzkuNCAxNi41IDE0LjIgMjQuOCAxNi4zIDMzLjYgMi4zIDkuNiAyLjMgMTkuNiAwIDI5LjItMi4xIDguOC02LjggMTcuMi0xNi40IDM0TDQ2My42IDYyMS4ybC0uMy41Yy05LjUgMTYuNi0xNC4zIDI1LTIxIDMxLjQtNy4zIDYuOS0xNiAxMi0yNS41IDE0LjgtOC43IDIuNC0xOC41IDIuNC0zOC4xIDIuNHptMjA5LjggMGgxMTljMTcuNiAwIDI2LjQgMCAzMS43LTMuNSA1LjctMy43IDkuMi05LjkgOS42LTE2LjYuMy02LTMuOS0xMy4zLTEyLjItMjcuNWwtLjktMS41LTU5LjYtMTAyLS43LTEuMWMtOC40LTE0LjItMTIuNi0yMS4zLTE4LTI0LjEtNi0zLTEzLjEtMy0xOSAwLTUuNSAyLjgtOS45IDEwLjMtMTguNiAyNS4zbC01OS40IDEwMi0uMi40Yy04LjcgMTUtMTMgMjIuNS0xMi43IDI4LjcuNCA2LjcgMy45IDEyLjkgOS42IDE2LjYgNSAzLjMgMTMuOCAzLjMgMzEuNCAzLjN6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2U4NDE0MiIvPjwvc3ZnPg==",currency:{name:"Avalanche",symbol:"AVAX",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:sf},wrapped:{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",logo:uf},stables:{usd:["0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7","0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]},explorer:"https://snowtrace.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://snowtrace.io/tx/${e.id||e}`:t?`https://snowtrace.io/token/${t}`:n?`https://snowtrace.io/address/${n}`:void 0,endpoints:["https://avalanche.public-rpc.com","https://avalanche.blockpi.network/v1/rpc/public","https://avax.meowrpc.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"AVAX",name:"Avalanche",decimals:18,logo:sf,type:"NATIVE"},{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",symbol:"WAVAX",name:"Wrapped AVAX",decimals:18,logo:uf,type:"20"},{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7/logo.png",type:"20"},{address:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E/logo.png",type:"20"},{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xd586E7F844cEa2F87f50152665BCbc2C279D8d70/logo.png",type:"20"},{address:"0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const lf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAMAAAAKTh9YAAAAYFBMVEVHcEz////////////////////////////////////j++ma6qVj5nsl5lAK4zpA6mXO79aD8Zyr87uCvq0J2TkItEkOhl4EeVsKzSwLrxMNtQpjsZG42dEeuxyF2oU6wzjPwJjeAAAACnRSTlMAEUB9r9j/YO+Kf6/iMwAABD1JREFUeAHU1EESQjEMAlBIAq33v7ArV7+OLss7AZOB4IDVI/kW0nQRf+Ca7QvNwg/s7VtpGJP8oPFNybdT4aidoPHEcYZn6ymnEEOjH8KPk0zeTI+DLacpfMhpxKTGnFtDB9o8/Jisw8uxh1/OtGIrYw9Ah9pEOVWhnaoxTvWCnErR2Z3rzX59JMYOAkEYXr1gRJfIzP1PalbOpZm2aEf+tcKnCCz7bS37si/7si/7si/7si/7srvRHAE5kJHdbV4wkn076Q9RMMLu04fYnceT/An9JnhMkr19Ezwvvvee73ieOL1dfdN15yQlwas2S7vbgTn4iLfaDO0emIPPeLtgZt+AOfhcQHJGdieYg88VLG9k98AUfG7gBRu7YAo+9wpeNLEnYAY+915wkIndQ4Xn9IajgoV9hwbP6b3iqGRhF5zH537VHi3swGl87tft3tB+Ap/7Z9lFhef0z3hndmjwnP4Z32qEAs/po4//Rwao8JzeC3hiMyeACs/ppnMCUlThOf3wxjurObAKz+kHNz5arT0CNHhO5zde7NZ8UYXn9N4K2Utnt8NzOsFL+Kuz2+EJneA5nduN8bmTWsXzKqNzuyX+FZ3rL43Sud0Un/txtV7KqNY+6Hq7Kb71Gxt0W7seX5od/Z6a+8BuGASCMMwraRK4103A9z9leq+Q3zCYC+h7oy7tbr6d4zGd2zme04Ed4AEd2AEe0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2Tl+B+jQzvH7j/ThnNub4Xd7Rud2gLc9pyM7wO9sz+nEDvA7e8G/0vX2IeTan/DXPdWL+cwD/hl/c3r2lT2u7XbWk31aYt9vesp9yD5Xn1ZPx7svtNtMYwfX9/hqjwAvuq8awIufZwzgxc+RZgAvfn43gBe/N5lxPLAD+sTs2HgnS53jnS51jHfC1CneKVOHeCdNneGdNnWEd+LUCd6pUwd4p04d4J06dYB3tekAL64nSAAvr+PgeGYHdI6ndkDneGoHdI4HdkAvxw/V7IsiegU8sIdSejk+VbIvyumveBY8twdQh51A8PL691x8PBf3HRD8oO33QPhR2mfD8EnZ3wTxXthXRvFe18+H8anbPsqkOVfnnJ6DF/RmPdE5vs69aQiYnoH3rXuzXukcP6jmE3C8734uxAgfgSvM4+D4RcV37SmgZ+BT6/kz0yd6KT5+kcex9bel+fDPupXP+MOs8byl6esGYfRxbDPnanG0OVf+8ODeH9Ks5f+mE50vJlp37d23EQQhFATRr6Yg/4RPuSe9o6tmIni7gN2222677bbbbrvttttuu5sw/7EP1j7kfhO6m5Wbak90Jw7d54NeGsV9jb0y1B+f+P5qpHB08XvD8M4zrq9N7pqje/L8jj/twXa8XOl4uSoe4/363RnvlyOo/LE1R8JnZfywrB7pGLY0Xa/gV5AhY9e5oJHCAAAAAElFTkSuQmCC",df="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAYAAAA9kO9qAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0PSURBVHgB7d1LbFzVHcfx37l3/CDGxgkhxEnU2K1EgxoUN0kVUglhIhbdVAo7dpCiSl2BqbqphIRpuy5u95SwY1XSWlXVIhFXtGqjJsXQSJRCsXklaQiJ8zCxPTP3cv53cuOxZ8bjmbmP8z/n/5GMHcfjmPHXZ86ce++xQpJGxwdRwChCtQ9Q+nU4qt87CIVhCLGeEHP6v/NQag5h8DY8TKOEGcxMziMhCp2iwD0c1V/kE/QnUNxCJGdavxzHmRdfQYfajz2K3HsGKhyHBC7SN6dznUY5eEGP9nNoQ+uxS+Qib6GawL9++QJa1FrsB8fH9D/0sn5rGELka04PuMdwenJ6ozfwN/qB2D/+vP7ZOA4ZzYUZdIfqSQx9Fzj/979s5AbNR3aatvieHs3DoxDCSOqEnssfa7Zys37s0VKiOqmXhUYhhMlCvUwZhI+sF3zj2CV0wU2T4L2GN6Spi4QuOFG612jKXV/9J6j0ZFThRxCCnz2NnrTWTmMqy4snIQRnSk9n1ixL1k5jKuvoQvBGHdPzziqrY4/W0uWAkbDCMDw1Xv2OlWnM6PgwfDULIewxj3I4Eq/OrIzsvpqAEHYZrB7dq6cxD0MI2yg8E8/dK7HvH38SMlcXdqpcb4E49sqFF0LY6VbfqnKil7oCIewVPVH1omtGhbBbdG20hwBjEMJ2AcWuvH0QwnYK+zyE4TCEsF2oaGSXy+yEA3TntPQ4DCHsN+xBCEdI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwRgEWU30loK9c+cOCj3DB6v/dtqltS7ffDi/2wFZWffcpbv/IJXh7r8Hfe70SexWKPZjdhPKpzdGLzd/Y9dD9Uzh0BR69VIUeo/somO1D6c0tCN6y50I2hQPPhmCORqauxz9D4cjnLd2u9MY9KL6605noC9+/EN1PaweB9dB9Q/cR3VfcsY+9nW/gWsWpIRRf+hpspUa+RM/T/4OnX7eLol987n7WAwPb2Cnurqdn9cPxZSTBhm9mPfRo1/XUxx0NBtWWX9qN0tR2cMRyNYa+cT2/eDex0KPPqadCvfpzqjpzWK4Kj51D99MfJhY66X7qo+jRlCOWsdNI1clDciM2Be8/9AW6n/gEaaDg6UkuN+xip1Gl1SeirbAheH/0Krp/OIc09fz0v4k+YmSBVewUYBYPoZyD976xgMLjn0INpBui0scv6BGWE1ax06qLl1GAHIOn0D09qvt7biAL9Airdic/nUwLq9iznidyCj4KXb/438l2q/2uR9ObUiaNTex+g6N9aeMQfBx69PaORWTJPyKxJ45iz4vJwVeHrrYupz5XX4vm7mpkARywiT3v0EwMvjr0SH8RefBHeMzb2cTuGXCHmhR8Tej0Pj2y54HLk3g+I7sha7omBF8v9EhPgDxI7BbLM/iGoedpyQcHbGIPDDtBK4/gm4a+lM+3M7zK47IINrGbeDZilsFvZEQPr3UhD3ShBwd8Yp/dBBNlEfxGpy7huV7kIfjkDnDAJvbSqc0wVZrBtzJHD68X9Oie7ZSCHnHz+iFrFZ85+9kBoy+YTiP4dp6MBu/diSwV/3gvuGC1GlOaMvuOTTL4dlddyu/chTDDJ6rlv20BF8xiHzJuVWatJILvaHlRhx68M4AsFF/dxeoyRlaxhws+ln/9dZiuk+CTWEePRveU5+7xrgOcsDuoRHN3DndyO8EndsBIj+6l3w2lNp2h5050cTo3LI+g0sOnbcEnfWSUVmZKJ5IPPg6d4y4MPnYcngBDNMIT2vnLZHQKLO2+RTuQocFqUmqnANz0EX5wZ3QSnUrgvJnwcjcWJ/YYe8yjGbaxExuCT/1cl2VPx9kXxa46OCuy/O8BLP38Pr2mzuMAUj2sYyecg8/spC4dPB3SD/7T33L0wWe9KP15G5Z/sxuY7wZnVuz1SLoe/zS6INt08c5jqr+U29mL9G+rHYt6erMQnRZMf7799ekfDFzqRqBfwvf6EdzwUT6tf0Cv898D15rYCZvg9dy3+Id7jQ8oLCprQidWnc/OZpVmyzK6jp4H+s3dZMi20Il1F2+wCV6HbmrwNoZOrLxSSYJvn62hE2svy5PgW2dz6MTqa1Al+I2zPXRi/QXXEnxzLoROnNhdQIJvzJXQiTNbaUjwtVwKnTi1b4wEv8K10IlzmyRJ8G6GTpzcEczl4F0NnTi7/R234NWmzi/idjl04vRej6yCf/R9qJ4OfmnvTc/p0InzG5tyCR67+tB94FRbwUvoFbKLL3gF3/PAmy0Ffzv0mzx22k2TxH4Lh+DDzVug+pY2HLyEvprEXsX44H0fwcBdUL1fNg1eQq8lsa9BwZemtsNYd1QueG4WvIReS2KvI9rWzdRNVLtXLnpuFHxAu+pK6DUk9jpom73gbD9MFPau3sqiXvDhZzy2kM6axN4ABc9FTfBlBVFLYm9Abcvn1yw2VS7Xffft4PuuAr35/NY800nsddDejP7eazBSg9hJHLw/fBGilsReh8l7z6jFm+v/faGI3u+9Dm/7FxCrSexr0EZLhSOfw1Tqxo3mH6OD3/SD30vwa0jsVTjsKKYWmscefVzvsgS/hsR+C4vQr1xed85e8/ES/CoSO/jsEen9/wJaJcGvcD52LqGrS/p5xHJ7y6ESfIXTsXMJnSL3znX2dUrwDsfOKXT/ww+QBNeDdzJ2dqEvJ3c01+XgnYvd5dBjrgbvVOwS+goXg3cmdgm9lmvBOxG7hN6YS8FbH7uE3pwrwVsdu4S+cS4Eb23sEnrrbA/eytgl9PbZHLx1sUvonbM1eKtiZ/Mbrq8pY0OP2Ri8NbGzCf1iDxZ/sg9Lf3oAprMteCtiZxX6c/dHr5dPHsTSyQMwnU3Bs4+dY+gxCT5brGPnHHpMgs8O29htCD0mwWeDZew2hR7jFrwavA5u2MVeOHTZutBjvIKf0q87/6VmWeIX+1Mfw3TthB7jErynR/auw2fBCavYaacub5vZo0knoce4BN99+B1Wozuv2A2fviQReoxD8DSd4TS6s4nd23vN6FE9ydBjHILv+vZ74IJN7IVDV2CqNEKPmR48zd25rMywiV2NtP/bndOUZugx04P3R86BAz6xGziFySL0mMnBezKyJ8u0+XqWocdMDd7r57EiI7v4tiGP0GNcliVNxCZ2U34vaZ6hx0wLPrie333RCj6xX+xG3kwIPWZS8MH8ZnDAJvbg7ADyZFLoMVOCD84PggM2sZdO5Td6mBh6LO/gg/l+BBfuBgd8pjGzfbnM200OPZZn8OXZIXDB6Amqj9LUvcgSh9BjeQW/pP9dLlgtPZamhjIb3TmFHss6+OJb9yHU0xguWMVOo3vx1R1IG8fQYxT84m/HkDaaq3Ma1Qm7g0o0upfeuAdp4Rx6rDjzzdSDX5p6mNWoTlgeQS2+tBvB7CYkzYbQY2kGv/j6gyi9vxPc+NhxeALcFD2U/7oVatdNeLsWkQT64Vn62R4rQo8FF7YivNIPf+Q8VGHjvxm7kXCxR4/oD6F46lvgSOHAsyEYS2KngdLUdv1cYKcxpyQkjc5KvOPYFLzN7Z+dGJy/Gzdfe4TNmno97GMndPovRV84cqml25X1UVmKPO+js1mhq4q6x860FD09EV1+cz+K/9wD7qyIPUbR0+V7/qEr8Pdeh+orrfp7GrlpulLWR2PLb2y1diRvxh8+F4VPmx35Q6s3PApLXQg+H0B5Ti8EvDuiX6e/+pUVq2Kv5/ZFH3rZ0tW4m4l2COitbJ/NbYWlFdZ/9216wpkWeuKJRfvvJ7l4QzhDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyj2OQhhvzkPIeYhhO105zr28G0IYTsVfuRBYQZC2C7EjKdn7RK7sJ+HaQ+lKHaZtwu7lWhkn5mk0GV0Fzabps4r6+xh+AqEsNdx+k8l9gAnIFMZYaNQH0c682I0mFdip6lMGP4KQthGhdPxmyunCwSYhIzuwjZlvBC/uRK7jO7CNkqHPjM5F/9x9YlgNLqHcq6MsAB1fPrFiep3rY6dRncvPAYhuKvTsV/zQef+MYedDyr9GDAGITii6cvpyeO1727kwI9f048FRyEEK+EJnJl8rN7fNL54oxwco5NnIAQX1GsZDafhat0bj44PwlMn9UeNQgiTUehB+Mit01/qWv+yPLohfQKoExDCWHrq0iR0sv7IXu3g+ARC9TyEMEn0ZHT1EmPjD23FwfExBOplfathCJEnWken5cXTk9MbvUlrscdklBd5oWumPX2kv6QPgDaZtqzVXuxkdHwYvtLR42EZ6UXqOog81n7s1faPP6k/0xNyIEokigJX4Yx+/Up0GnqbkceSiT1GS5UFvUwZYEx/5n36ixzW/8SgjPyiqeicrHC+sgGAmtGRvx1dMtph4NW+AiZycfiu2QTRAAAAAElFTkSuQmCC";var hf={name:"gnosis",id:"0x64",networkId:"100",namespace:"eip155",label:"Gnosis",fullName:"Gnosis Chain",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojZmZmfTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMzMS45IDU1Ni41YzIzLjUgMCA0Ni40LTcuOCA2NS0yMi4yTDI0OCAzODUuNGMtMzUuOSA0Ni40LTI3LjQgMTEyLjkgMTguOSAxNDguOCAxOC42IDE0IDQxLjUgMjEuOSA2NSAyMS45di40em00NDIuMy0xMDYuMWMwLTIzLjUtNy44LTQ2LjQtMjIuMi02NUw2MDMuMiA1MzQuMmM0Ni40IDM1LjkgMTEyLjkgMjcuNCAxNDguOC0xOC45IDE0LjMtMTguNiAyMi4yLTQxLjQgMjIuMi02NC45eiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im04NDkuMiAyODguNS02NS45IDY1LjljNTIuOSA2My42IDQ0LjcgMTU4LTE4LjkgMjExLjItNTUuNiA0Ni43LTEzNi42IDQ2LjctMTkyLjIgMEw1MDAgNjM3LjdsLTcyLjEtNzIuMWMtNjMuNiA1Mi45LTE1OCA0NC43LTIxMS4yLTE4LjktNDYuNy01NS42LTQ2LjctMTM2LjYgMC0xOTIuMmwtMzMuNi0zMy42LTMyLTMyLjNDMTEyLjMgMzUyLjIgOTIgNDI1LjMgOTIgNTAwYzAgMjI1LjIgMTgyLjggNDA4IDQwOCA0MDhzNDA4LTE4Mi44IDQwOC00MDhjLjMtNzQuNC0yMC42LTE0Ny44LTU4LjgtMjExLjV6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTc5NS4xIDIxOC4zYy0xNTUuNC0xNjIuOC00MTMuNi0xNjktNTc2LjQtMTMuNy00LjkgNC42LTkuNSA5LjEtMTMuNyAxMy43LTEwLjEgMTAuOC0xOS42IDIxLjktMjguNyAzMy4zTDUwMCA1NzUuNGwzMjMuOC0zMjMuOGMtOC44LTExLjctMTguNi0yMi44LTI4LjctMzMuM3pNNTAwIDE0NS4yYzk1LjMgMCAxODQuMSAzNi45IDI1MSAxMDMuOEw1MDAgNTAwIDI0OSAyNDljNjYuNi02Ny4yIDE1NS43LTEwMy44IDI1MS0xMDMuOHoiLz48L3N2Zz4K",logoBackgroundColor:"#406958",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojM2U2OTU3fTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMyNC4yIDU1OS4xYzI0LjYgMCA0OC41LTguMiA2Ny45LTIzLjJMMjM2LjUgMzgwLjJjLTM3LjUgNDguNS0yOC43IDExOC4xIDE5LjggMTU1LjYgMTkuNSAxNC43IDQzLjMgMjIuOSA2Ny45IDIyLjl2LjR6TTc4Ni43IDQ0OC4xYzAtMjQuNi04LjItNDguNS0yMy4yLTY3LjlMNjA3LjkgNTM1LjhjNDguNSAzNy41IDExOC4xIDI4LjcgMTU1LjYtMTkuOCAxNS0xOS40IDIzLjItNDMuMyAyMy4yLTY3Ljl6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0ibTg2NS4yIDI3OC44LTY4LjkgNjguOWM1NS4zIDY2LjYgNDYuOCAxNjUuMi0xOS44IDIyMC44LTU4LjQgNDguOC0xNDIuNyA0OC44LTIwMSAwTDUwMCA2NDRsLTc1LjQtNzUuNGMtNjYuNiA1NS4zLTE2NS4yIDQ2LjgtMjIwLjgtMTkuOC00OC44LTU4LjQtNDguOC0xNDIuNyAwLTIwMWwtMzUuMi0zNS4yLTMzLjQtMzMuOGMtNDAuNiA2Ni42LTYxLjggMTQzLTYxLjggMjIxLjIgMCAyMzUuNSAxOTEuMSA0MjYuNiA0MjYuNiA0MjYuNlM5MjYuNiA3MzUuNSA5MjYuNiA1MDBjLjQtNzcuOC0yMS41LTE1NC42LTYxLjQtMjIxLjJ6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTgwOC42IDIwNS41QzY0Ni4xIDM1LjEgMzc2LjEgMjguNyAyMDUuOCAxOTEuMWMtNS4xIDQuOC05LjkgOS42LTE0LjMgMTQuMy0xMC42IDExLjMtMjAuNSAyMi45LTMwIDM0LjhMNTAwIDU3OC44bDMzOC42LTMzOC42Yy05LjItMTIuMi0xOS41LTIzLjgtMzAtMzQuN3pNNTAwIDEyOWM5OS43IDAgMTkyLjUgMzguNiAyNjIuNSAxMDguNUw1MDAgNTAwIDIzNy41IDIzNy41QzMwNy4yIDE2Ny4yIDQwMC4zIDEyOSA1MDAgMTI5eiIvPjwvc3ZnPgo=",currency:{name:"xDAI",symbol:"xDAI",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:lf},wrapped:{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",logo:df},stables:{usd:["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"]},explorer:"https://gnosisscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://gnosisscan.io/tx/${e.id||e}`:t?`https://gnosisscan.io/token/${t}`:n?`https://gnosisscan.io/address/${n}`:void 0,endpoints:["https://rpc.gnosis.gateway.fm","https://rpc.gnosischain.com","https://gnosis.blockpi.network/v1/rpc/public"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"xDAI",name:"xDAI",decimals:18,logo:lf,type:"NATIVE"},{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",symbol:"WXDAI",name:"Wrapped XDAI",decimals:18,logo:df,type:"20"},{address:"0x4ECaBa5870353805a9F068101A40E0f32ed605C6",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",symbol:"GNO",name:"Gnosis",decimals:18,logo:"https://cdn.sushi.com/image/upload/f_auto,c_limit,w_16,q_auto/tokens/100/0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb.jpg",type:"20"},{address:"0xD057604A14982FE8D88c5fC25Aac3267eA142a08",symbol:"HOPR",name:"HOPR",decimals:18,logo:"https://hoprnet.org/assets/icons/hopr_icon.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};var pf={name:"optimism",id:"0xa",networkId:"10",namespace:"eip155",label:"Optimism",fullName:"Optimism",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00ODcuMSAzOTUuN2MtNS4yLTE1LjgtMTMuMi0zMS43LTI2LjQtNDIuMi0xMy4yLTEwLjUtMjYuNC0yMS4yLTQ0LjktMjYuNC0xOC41LTUuMi0zNy04LTU4LjEtOC00Ny41IDAtODcuMSAxMC41LTExNi4xIDM0LjQtMjkgMjMuOC00Ny41IDU4LjEtNjAuNyAxMDIuOS0yLjYgMTUuOC04IDI5LTEwLjUgNDQuOS0yLjYgMTMuMi01LjIgMjktOCA0Mi4yLTIuNiAyMy44LTIuNiA0Mi4yIDIuNiA2MC43IDUuMiAxNS44IDEzLjIgMzEuNyAyNi40IDQyLjIgMTMuMiAxMC41IDI2LjQgMjEuMiA0NC45IDI2LjQgMTguNCA1LjIgMzcgOCA1OC4xIDggNDcuNSAwIDg3LjEtMTAuNSAxMTYuMS0zNC40czQ3LjUtNTguMSA2MC43LTEwMi45YzIuNi0xMy4yIDUuMi0yOSAxMC41LTQyLjIgMi42LTEzLjIgNS4yLTI5IDgtNDQuOSAyLjgtMjMuOCAyLjgtNDQuOC0yLjYtNjAuN3ptLTkyLjQgNjAuOGMtMi42IDEzLjItNS4yIDI2LjQtOCAzOS41LTIuNiAxMy4yLTUuMiAyNi40LTEwLjUgNDIuMi01LjIgMjMuOC0xNS44IDM5LjUtMjkgNTAuMi0xMy4yIDEwLjUtMjkgMTUuOC00Ny41IDE1LjgtMTguNCAwLTMxLjctNS4yLTM5LjUtMTUuOC04LTEwLjUtMTAuNS0yOS01LjItNTAuMiAyLjYtMTUuOCA1LjItMjkgOC00Mi4yIDIuNi0xMy4yIDUuMi0yNi40IDEwLjUtMzkuNSA1LjItMjMuOCAxNS44LTM5LjUgMjktNTAuMiAxMy4yLTEwLjUgMjktMTUuOCA0Ny41LTE1LjggMTguNCAwIDMxLjcgNS4yIDM5LjUgMTUuOCA3LjkgMTAuNiAxMC41IDI2LjMgNS4yIDUwLjJ6bTQ0MC45LTY4LjZjLTUuMi0xNS44LTEzLjItMjYuNC0yMy44LTM3cy0yMy44LTE1LjgtNDIuMi0yMS4yYy0xNS44LTUuMi0zNC40LTgtNTUuNC04SDU3OS43Yy0yLjYgMC01LjIgMC0xMC41IDIuNi0yLjYgMi42LTUuMiA1LjItNS4yIDhsLTY4LjYgMzI3LjRjMCAyLjYgMCA4IDIuNiA4IDIuNiAyLjYgNS4yIDIuNiA4IDIuNmg2OC42YzIuNiAwIDggMCAxMC41LTIuNnM1LjItNS4yIDUuMi04bDIzLjgtMTEwLjloNjguNmM0Mi4yIDAgNzYuNi04IDEwMi45LTI2LjQgMjYuNC0xOC40IDQyLjItNDcuNSA1MC4yLTg0LjYgNS4xLTE4LjQgNS4xLTM2LjctLjItNDkuOXpNNzQzLjEgNDM4Yy0yLjYgMTUuOC0xMC41IDI2LjQtMjEuMiAzNC40cy0yMy44IDEwLjUtMzcgMTAuNWgtNTguMWwxOC40LTg5LjdoNjAuN2MxMy4yIDAgMjEuMiAyLjYgMjYuNCA1LjIgNS4yIDUuMiAxMC41IDEwLjUgMTAuNSAxNS44IDMgNS4yIDMgMTMuMi4zIDIzLjh6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",logoBackgroundColor:"#FF0420",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iMzk2LjYiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNNTAwIDg5Ni42YzIxOS4xIDAgMzk2LjYtMTc3LjYgMzk2LjYtMzk2LjZTNzE5LjEgMTAzLjQgNTAwIDEwMy40IDEwMy40IDI4MC45IDEwMy40IDUwMCAyODAuOSA4OTYuNiA1MDAgODk2LjZ6TTM1MC43IDYwOWMxMC45IDMuNCAyMi42IDUuMSAzNS4zIDUuMSAyOS4xIDAgNTIuNC02LjcgNjkuNi0yMC4yIDE3LjMtMTMuNyAyOS4zLTM0LjMgMzYuMi02MS44IDItOC42IDMuOS0xNy4zIDUuNy0yNS45IDItOC42IDMuNy0xNy40IDUuMS0yNi4yIDIuNC0xMy43IDItMjUuNi0xLjItMzUuOS0zLTEwLjItOC4zLTE4LjktMTYtMjUuOS03LjQtNy0xNi42LTEyLjMtMjcuNC0xNS43LTEwLjctMy42LTIyLjMtNS40LTM1LTUuNC0yOS4zIDAtNTIuNyA3LTY5LjkgMjEuMXMtMjkuMiAzNC43LTM1LjkgNjEuOGMtMiA4LjgtNCAxNy42LTYgMjYuMi0xLjggOC42LTMuNSAxNy4zLTUuMSAyNS45LTIuMiAxMy43LTEuOCAyNS42IDEuMiAzNS45IDMuMiAxMC4yIDguNSAxOC44IDE2IDI1LjYgNy40IDYuOCAxNi42IDExLjkgMjcuNCAxNS40em02Ny44LTQ4Yy04LjIgNi40LTE3LjggOS42LTI4LjYgOS42LTExLjEgMC0xOS0zLjItMjMuOC05LjYtNC44LTYuNC02LTE2LjctMy42LTMwLjcgMS42LTguOCAzLjItMTcuMiA0LjgtMjUgMS44LTcuOCAzLjgtMTYgNi0yNC40IDMuNC0xNC4xIDkuMS0yNC4zIDE3LjItMzAuNyA4LjItNi40IDE3LjgtOS42IDI4LjYtOS42czE4LjggMy4yIDIzLjggOS42IDYuMiAxNi43IDMuNiAzMC43Yy0xLjQgOC40LTMgMTYuNi00LjggMjQuNC0xLjYgNy44LTMuNSAxNi4yLTUuNyAyNS0zLjQgMTQtOS4yIDI0LjMtMTcuNSAzMC43em05MS43IDQ4YzEuMiAxLjQgMi44IDIuMSA0LjggMi4xaDQxYzIuMiAwIDQuMS0uNyA1LjctMi4xIDEuOC0xLjQgMi45LTMuMiAzLjMtNS40bDEzLjktNjZoNDAuN2MyNS45IDAgNDYuNS01LjUgNjEuOC0xNi42IDE1LjUtMTEuMSAyNS43LTI4LjEgMzAuNy01MS4yIDIuNC0xMS43IDIuMy0yMS44LS4zLTMwLjQtMi42LTguOC03LjItMTYuMi0xMy45LTIyLTYuNi01LjgtMTUtMTAuMS0yNS0xMy05LjgtMi44LTIwLjktNC4yLTMzLjItNC4yaC04MC4yYy0yIDAtMy45LjctNS43IDIuMS0xLjggMS40LTIuOSAzLjItMy4zIDUuNEw1MDkgNjAzLjVjLS40IDIuMiAwIDQgMS4yIDUuNXptMTExLjItMTEzLjFoLTM0LjdsMTEuOC01NGgzNi4yYzcuMiAwIDEyLjYgMS4yIDE2IDMuNiAzLjYgMi40IDUuNyA1LjYgNi4zIDkuNi42IDQgLjQgOC42LS42IDEzLjktMiA5LTYuMyAxNS44LTEzIDIwLjItNi40IDQuNS0xMy44IDYuNy0yMiA2Ljd6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmMDQyMCIvPjwvc3ZnPg==",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:qp.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:qp.wrapped.logo},stables:{usd:["0x94b008aA00579c1307B0EF2c499aD98a8ce58e58","0x7F5c764cBc14f9669B88837ca1490cCa17c31607"]},explorer:"https://optimistic.etherscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://optimistic.etherscan.io/tx/${e.id||e}`:t?`https://optimistic.etherscan.io/token/${t}`:n?`https://optimistic.etherscan.io/address/${n}`:void 0,endpoints:["https://optimism.blockpi.network/v1/rpc/public","https://optimism.meowrpc.com","https://optimism.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:qp.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:qp.wrapped.logo,type:"20"},{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x94b008aA00579c1307B0EF2c499aD98a8ce58e58/logo.png",type:"20"},{address:"0x7F5c764cBc14f9669B88837ca1490cCa17c31607",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x7F5c764cBc14f9669B88837ca1490cCa17c31607/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x4200000000000000000000000000000000000042",symbol:"OP",name:"Optimism",decimals:18,logo:"https://user-images.githubusercontent.com/1300064/219575413-d7990d69-1d21-44ef-a2b1-e9c682c79802.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};var ff={name:"base",id:"0x2105",networkId:"8453",namespace:"eip155",label:"Base",fullName:"Base",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguNiA4NDJDNjg4IDg0MiA4NDIgNjg4LjkgODQyIDQ5OS41UzY4OCAxNTcgNDk4LjYgMTU3QzMxOSAxNTcgMTcxLjIgMjk1LjEgMTU3IDQ3MC4zaDQ1My4xdjU3LjVIMTU3QzE3MiA3MDMuOSAzMTkgODQyIDQ5OC42IDg0MnoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#0052FF",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguOSA4NDVDNjkwLjEgODQ1IDg0NSA2OTAuMyA4NDUgNDk5LjVTNjkwLjEgMTU0IDQ5OC45IDE1NEMzMTcuNiAxNTQgMTY4LjggMjkzLjMgMTU0IDQ3MC41aDQ1Ny40djU4LjFIMTU0QzE2OC44IDcwNS44IDMxNy42IDg0NSA0OTguOSA4NDV6IiBmaWxsPSIjMDA1MmZmIi8+PC9zdmc+",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:qp.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:qp.wrapped.logo},stables:{usd:["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"]},explorer:"https://basescan.org",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://basescan.org/tx/${e.id||e}`:t?`https://basescan.org/token/${t}`:n?`https://basescan.org/address/${n}`:void 0,endpoints:["https://base.blockpi.network/v1/rpc/public","https://base.meowrpc.com","https://mainnet.base.org"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:qp.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:qp.wrapped.logo,type:"20"},{address:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",symbol:"USDbC",name:"USD Base Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935"};const yf=[qp,Vp,ef,rf,Xp,af,cf,hf,pf,ff];var mf={ethereum:qp,bsc:Vp,polygon:ef,solana:rf,fantom:Xp,arbitrum:af,avalanche:cf,gnosis:hf,optimism:pf,base:ff,all:yf,findById:function(e){let t=e;t.match("0x0")&&(t=t.replace(/0x0+/,"0x"));let n=yf.find((e=>e.id&&e.id.toLowerCase()==t.toLowerCase()));return n},findByNetworkId:function(e){e=e.toString();let t=yf.find((t=>t.networkId==e));return t},findByName:function(e){return yf.find((t=>t.name==e))}},gf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function vf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function wf(e){var t={exports:{}};return e(t,t.exports),t.exports}for(var bf=function(e){var t=Lf(e),n=t[0],r=t[1];return 3*(n+r)/4-r},Mf=function(e){var t,n,r=Lf(e),i=r[0],o=r[1],a=new Tf(function(e,t,n){return 3*(t+n)/4-n}(0,i,o)),s=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)t=Nf[e.charCodeAt(n)]<<18|Nf[e.charCodeAt(n+1)]<<12|Nf[e.charCodeAt(n+2)]<<6|Nf[e.charCodeAt(n+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=255&t;2===o&&(t=Nf[e.charCodeAt(n)]<<2|Nf[e.charCodeAt(n+1)]>>4,a[s++]=255&t);1===o&&(t=Nf[e.charCodeAt(n)]<<10|Nf[e.charCodeAt(n+1)]<<4|Nf[e.charCodeAt(n+2)]>>2,a[s++]=t>>8&255,a[s++]=255&t);return a},Af=function(e){for(var t,n=e.length,r=n%3,i=[],o=16383,a=0,s=n-r;a<s;a+=o)i.push(xf(e,a,a+o>s?s:a+o));1===r?(t=e[n-1],i.push(Ef[t>>2]+Ef[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(Ef[t>>10]+Ef[t>>4&63]+Ef[t<<2&63]+"="));return i.join("")},Ef=[],Nf=[],Tf="undefined"!=typeof Uint8Array?Uint8Array:Array,If="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kf=0;kf<64;++kf)Ef[kf]=If[kf],Nf[If.charCodeAt(kf)]=kf;function Lf(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function xf(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(Ef[(i=r)>>18&63]+Ef[i>>12&63]+Ef[i>>6&63]+Ef[63&i]);return o.join("")}Nf["-".charCodeAt(0)]=62,Nf["_".charCodeAt(0)]=63;var Sf={byteLength:bf,toByteArray:Mf,fromByteArray:Af},jf=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+e[t+d],d+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)},Cf=function(e,t,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,d=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*u-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+p]=255&s,p+=f,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+p]=255&a,p+=f,a/=256,c-=8);e[n+p-f]|=128*y},Df=wf((function(e,t){const n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},t.INSPECT_MAX_BYTES=50;const r=2147483647;function i(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|h(e,t);let r=i(n);const a=r.write(e,t);a!==n&&(r=r.slice(0,a));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(H(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(H(e,ArrayBuffer)||e&&H(e.buffer,ArrayBuffer))return l(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(H(e,SharedArrayBuffer)||e&&H(e.buffer,SharedArrayBuffer)))return l(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);const a=function(e){if(o.isBuffer(e)){const t=0|d(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||G(e.length)?i(0):c(e);if("Buffer"===e.type&&Array.isArray(e.data))return c(e.data)}(e);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return s(e),i(e<0?0:0|d(e))}function c(e){const t=e.length<0?0:0|d(e.length),n=i(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function l(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,o.prototype),r}function d(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function h(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||H(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(i)return r?-1:Y(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,n);case"utf8":case"utf-8":return E(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function f(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){let o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let r=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-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(e,o+r)!==c(t,r)){n=!1;break}if(n)return o}return-1}function g(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(G(r))return a;e[n+a]=r}return a}function v(e,t,n,r){return V(Y(t,e.length-n),e,n,r)}function w(e,t,n,r){return V(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function b(e,t,n,r){return V(F(t),e,n,r)}function M(e,t,n,r){return V(function(e,t){let n,r,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?Sf.fromByteArray(e):Sf.fromByteArray(e.slice(t,n))}function E(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128==(192&n)&&(u=(31&t)<<6|63&n,u>127&&(o=u));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(u=(15&t)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&t)<<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(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}(r)}t.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){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(e,t,n){return a(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return function(e,t,n){return s(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}(e,t,n)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(H(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),H(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=o.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(H(t,Uint8Array))i+t.length>r.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},o.byteLength=h,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)f(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)f(this,t,t+3),f(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?E(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="";const n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,i){if(H(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const u=Math.min(a,s),c=this.slice(r,i),l=e.slice(t,n);for(let e=0;e<u;++e)if(c[e]!==l[e]){a=c[e],s=l[e];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return g(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":case"latin1":case"binary":return w(this,e,t,n);case"base64":return b(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,t,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 N=4096;function T(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function I(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function k(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=q[e[r]];return i}function L(e,t,n){const r=e.slice(t,n);let i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}function x(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function S(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function j(e,t,n,r,i){B(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function C(e,t,n,r,i){B(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function D(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,4),Cf(e,t,n,r,23,4),n+4}function z(e,t,n,r,i){return t=+t,n>>>=0,i||D(e,0,n,8),Cf(e,t,n,r,52,8),n+8}o.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||x(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||x(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||x(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||x(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||x(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||W(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||x(e,4,this.length),jf(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||x(e,4,this.length),jf(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||x(e,8,this.length),jf(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||x(e,8,this.length),jf(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Z((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(e,t=0){return C(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,e,t,n,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,e,t,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Z((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(e,t=0){return C(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,n){return O(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return O(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<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),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=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===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const a=o.isBuffer(e)?e:o.from(e,r),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=a[i%s]}return this};const _={};function P(e,t,n){_[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function R(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function B(e,t,n,r,i,o){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===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}`:`>= ${t}${r} and <= ${n}${r}`,new _.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){U(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||W(t,e.length-(n+1))}(r,i,o)}function U(e,t){if("number"!=typeof e)throw new _.ERR_INVALID_ARG_TYPE(t,"number",e)}function W(e,t,n){if(Math.floor(e)!==e)throw U(e,n),new _.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new _.ERR_BUFFER_OUT_OF_BOUNDS;throw new _.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}P("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),P("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),P("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=R(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=R(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const Q=/[^+/0-9A-Za-z-_]/g;function Y(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=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((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(e){return Sf.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(Q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function H(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function G(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Z(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}})),Of=wf((function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:Df.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);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 "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.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(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.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=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[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<e.length;i+=3)a=e[i]|e[i+1]<<8|e[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(e,t,n){this.length=Math.ceil((e.length-t)/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=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,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(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var d=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)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(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var d=["","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"],h=[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],p=[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(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){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?d[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=h[e],l=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var y=f.modrn(l).toString(e);r=(f=f.idivn(l)).isZero()?y+r:d[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=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 e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function f(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.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,d=67108863&u,h=Math.min(c,t.length-1),p=Math.max(0,c-e.length+1);p<=h;p++){var f=c-p|0;l+=(a=(i=0|e.words[f])*(o=0|t.words[p])+d)/67108864|0,d=67108863&a}n.words[c]=0|d,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(e,t,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(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).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(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;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(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>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(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;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(e){return this.clone().isub(e)};var y=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],d=8191&l,h=l>>>13,p=0|a[1],f=8191&p,y=p>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],E=8191&A,N=A>>>13,T=0|a[5],I=8191&T,k=T>>>13,L=0|a[6],x=8191&L,S=L>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,_=O>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],W=8191&U,Q=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],de=8191&le,he=le>>>13,pe=0|s[9],fe=8191&pe,ye=pe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(d,W))|0)+((8191&(i=(i=Math.imul(d,Q))+Math.imul(h,W)|0))<<13)|0;c=((o=Math.imul(h,Q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(f,W),i=(i=Math.imul(f,Q))+Math.imul(y,W)|0,o=Math.imul(y,Q);var ge=(c+(r=r+Math.imul(d,F)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(h,F)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,W),i=(i=Math.imul(g,Q))+Math.imul(v,W)|0,o=Math.imul(v,Q),r=r+Math.imul(f,F)|0,i=(i=i+Math.imul(f,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,q)|0)+Math.imul(h,G)|0))<<13)|0;c=((o=o+Math.imul(h,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=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(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(f,G)|0,i=(i=i+Math.imul(f,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(h,J)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(E,W),i=(i=Math.imul(E,Q))+Math.imul(N,W)|0,o=Math.imul(N,Q),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(f,J)|0,i=(i=i+Math.imul(f,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(h,$)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(I,W),i=(i=Math.imul(I,Q))+Math.imul(k,W)|0,o=Math.imul(k,Q),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(f,$)|0,i=(i=i+Math.imul(f,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(h,ne)|0))<<13)|0;c=((o=o+Math.imul(h,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(x,W),i=(i=Math.imul(x,Q))+Math.imul(S,W)|0,o=Math.imul(S,Q),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|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(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(f,ne)|0,i=(i=i+Math.imul(f,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(C,W),i=(i=Math.imul(C,Q))+Math.imul(D,W)|0,o=Math.imul(D,Q),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(f,oe)|0,i=(i=i+Math.imul(f,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ee=(c+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(z,W),i=(i=Math.imul(z,Q))+Math.imul(_,W)|0,o=Math.imul(_,Q),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(f,ue)|0,i=(i=i+Math.imul(f,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(R,W),i=(i=Math.imul(R,Q))+Math.imul(B,W)|0,o=Math.imul(B,Q),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(_,F)|0,o=o+Math.imul(_,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(f,de)|0,i=(i=i+Math.imul(f,he)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,he)|0;var Te=(c+(r=r+Math.imul(d,fe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ye)|0)+Math.imul(h,fe)|0))<<13)|0;c=((o=o+Math.imul(h,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,V))+Math.imul(B,F)|0,o=Math.imul(B,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(k,ne)|0,o=o+Math.imul(k,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,de)|0,i=(i=i+Math.imul(g,he)|0)+Math.imul(v,de)|0,o=o+Math.imul(v,he)|0;var Ie=(c+(r=r+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ye)|0)+Math.imul(y,fe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(R,G),i=(i=Math.imul(R,q))+Math.imul(B,G)|0,o=Math.imul(B,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(x,ne)|0,i=(i=i+Math.imul(x,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,he)|0;var ke=(c+(r=r+Math.imul(g,fe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,fe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,X))+Math.imul(B,J)|0,o=Math.imul(B,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(k,ue)|0,o=o+Math.imul(k,ce)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,he)|0)+Math.imul(N,de)|0,o=o+Math.imul(N,he)|0;var Le=(c+(r=r+Math.imul(b,fe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,fe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,ee))+Math.imul(B,$)|0,o=Math.imul(B,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(I,de)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(k,de)|0,o=o+Math.imul(k,he)|0;var xe=(c+(r=r+Math.imul(E,fe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(N,fe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(R,ne),i=(i=Math.imul(R,re))+Math.imul(B,ne)|0,o=Math.imul(B,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,r=r+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,r=r+Math.imul(x,de)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,he)|0;var Se=(c+(r=r+Math.imul(I,fe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(k,fe)|0))<<13)|0;c=((o=o+Math.imul(k,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(R,oe),i=(i=Math.imul(R,ae))+Math.imul(B,oe)|0,o=Math.imul(B,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,he)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,he)|0;var je=(c+(r=r+Math.imul(x,fe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ye)|0)+Math.imul(S,fe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(R,ue),i=(i=Math.imul(R,ce))+Math.imul(B,ue)|0,o=Math.imul(B,ce),r=r+Math.imul(z,de)|0,i=(i=i+Math.imul(z,he)|0)+Math.imul(_,de)|0,o=o+Math.imul(_,he)|0;var Ce=(c+(r=r+Math.imul(C,fe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ye)|0)+Math.imul(D,fe)|0))<<13)|0;c=((o=o+Math.imul(D,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(R,de),i=(i=Math.imul(R,he))+Math.imul(B,de)|0,o=Math.imul(B,he);var De=(c+(r=r+Math.imul(z,fe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(_,fe)|0))<<13)|0;c=((o=o+Math.imul(_,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863;var Oe=(c+(r=Math.imul(R,fe))|0)+((8191&(i=(i=Math.imul(R,ye))+Math.imul(B,fe)|0))<<13)|0;return c=((o=Math.imul(B,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ee,u[8]=Ne,u[9]=Te,u[10]=Ie,u[11]=ke,u[12]=Le,u[13]=xe,u[14]=Se,u[15]=je,u[16]=Ce,u[17]=De,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.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,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,d=(0|e.words[l])*(0|t.words[c]),h=67108863&d;s=67108863&(h=h+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(h>>>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 g(e,t,n){return m(e,t,n)}Math.imul||(y=f),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?f(this,e,t):n<1024?m(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,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++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-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 d=0|this.words[c];this.words[c]=l<<26-o|d>>>o,l=d&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(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;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(e,t){var n=(this.length,e.length),r=this.clone(),o=e,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"!==t){(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 d=u-1;d>=0;d--){var h=67108864*(0|r.words[o.length+d])+(0|r.words[o.length+d-1]);for(h=Math.min(h/a|0,67108863),r._ishlnsubmul(o,h,d);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(o,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=h)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),d=t.clone();!t.isZero();){for(var h=0,p=1;0==(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(d)),o.iushrn(1),a.iushrn(1);for(var f=0,y=1;0==(r.words[0]&y)&&f<26;++f,y<<=1);if(f>0)for(r.iushrn(f);f-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,h=1;0==(r.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(r.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;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(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new N(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,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 A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){N.call(this,e),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 e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<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(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},r(b,w),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(M,w),r(A,w),r(E,w),E.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new M;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return v[e]=t,t},N.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},N.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},N.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},N.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},N.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},N.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},N.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},N.prototype.isqr=function(e){return this.imul(e,e.clone())},N.prototype.sqr=function(e){return this.mul(e,e)},N.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,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 d=this.pow(l,o),h=this.pow(e,o.addn(1).iushrn(1)),p=this.pow(e,o),f=a;0!==p.cmp(s);){for(var y=p,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<f);var g=this.pow(d,new i(1).iushln(f-m-1));h=h.redMul(g),d=g.redSqr(),p=p.redMul(d),f=m}return h},N.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},N.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var d=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==d||0!==a?(a<<=1,a|=d,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},N.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)},r(T,N),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),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)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),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)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,gf)}));
|
|
10
10
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */let zf=!1,_f=!1;const Pf={debug:1,default:2,info:2,warning:3,error:4,off:5};let Rf=Pf.default,Bf=null;const Uf=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var Wf,Qf;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(Wf||(Wf={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(Qf||(Qf={}));const Yf="0123456789abcdef";class Ff{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==Pf[n]&&this.throwArgumentError("invalid log level name","logLevel",e),Rf>Pf[n]||console.log.apply(console,t)}debug(...e){this._log(Ff.levels.DEBUG,e)}info(...e){this._log(Ff.levels.INFO,e)}warn(...e){this._log(Ff.levels.WARNING,e)}makeError(e,t,n){if(_f)return this.makeError("censored error",t,{});t||(t=Ff.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e<t.length;e++)n+=Yf[t[e]>>4],n+=Yf[15&t[e]];r.push(e+"=Uint8Array(0x"+n+")")}else r.push(e+"="+JSON.stringify(t))}catch(t){r.push(e+"="+JSON.stringify(n[e].toString()))}})),r.push(`code=${t}`),r.push(`version=${this.version}`);const i=e;let o="";switch(t){case Qf.NUMERIC_FAULT:{o="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":o+="-"+t;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case Qf.CALL_EXCEPTION:case Qf.INSUFFICIENT_FUNDS:case Qf.MISSING_NEW:case Qf.NONCE_EXPIRED:case Qf.REPLACEMENT_UNDERPRICED:case Qf.TRANSACTION_REPLACED:case Qf.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(e+=" ("+r.join(", ")+")");const a=new Error(e);return a.reason=i,a.code=t,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,Ff.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(e){Uf&&this.throwError("platform missing String.prototype.normalize",Ff.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Uf})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Ff.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Ff.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n=n?": "+n:"",e<t&&this.throwError("missing argument"+n,Ff.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+n,Ff.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",Ff.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Ff.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",Ff.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Bf||(Bf=new Ff("logger/5.7.0")),Bf}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Ff.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),zf){if(!e)return;this.globalLogger().throwError("error censorship permanent",Ff.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_f=!!e,zf=!!t}static setLogLevel(e){const t=Pf[e.toLowerCase()];null!=t?Rf=t:Ff.globalLogger().warn("invalid log level - "+e)}static from(e){return new Ff(e)}}Ff.errors=Qf,Ff.levels=Wf;const Vf=new Ff("bytes/5.7.0");function Hf(e){return!!e.toHexString}function Gf(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return Gf(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function qf(e){return ty(e)&&!(e.length%2)||Jf(e)}function Zf(e){return"number"==typeof e&&e==e&&e%1==0}function Jf(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Zf(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const n=e[t];if(!Zf(n)||n<0||n>=256)return!1}return!0}function Xf(e,t){if(t||(t={}),"number"==typeof e){Vf.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),Gf(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Hf(e)&&(e=e.toHexString()),ty(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":Vf.throwArgumentError("hex data is odd-length","value",e));const r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return Gf(new Uint8Array(r))}return Jf(e)?Gf(new Uint8Array(e)):Vf.throwArgumentError("invalid arrayify value","value",e)}function Kf(e){const t=e.map((e=>Xf(e))),n=t.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(n);return t.reduce(((e,t)=>(r.set(t,e),e+t.length)),0),Gf(r)}function $f(e){let t=Xf(e);if(0===t.length)return t;let n=0;for(;n<t.length&&0===t[n];)n++;return n&&(t=t.slice(n)),t}function ey(e,t){(e=Xf(e)).length>t&&Vf.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(e,t-e.length),Gf(n)}function ty(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const ny="0123456789abcdef";function ry(e,t){if(t||(t={}),"number"==typeof e){Vf.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=ny[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Hf(e))return e.toHexString();if(ty(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Vf.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Jf(e)){let t="0x";for(let n=0;n<e.length;n++){let r=e[n];t+=ny[(240&r)>>4]+ny[15&r]}return t}return Vf.throwArgumentError("invalid hexlify value","value",e)}function iy(e){if("string"!=typeof e)e=ry(e);else if(!ty(e)||e.length%2)return null;return(e.length-2)/2}function oy(e,t,n){return"string"!=typeof e?e=ry(e):(!ty(e)||e.length%2)&&Vf.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function ay(e){let t="0x";return e.forEach((e=>{t+=ry(e).substring(2)})),t}function sy(e){const t=function(e){"string"!=typeof e&&(e=ry(e));ty(e)||Vf.throwArgumentError("invalid hex string","value",e);e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}(ry(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function uy(e,t){for("string"!=typeof e?e=ry(e):ty(e)||Vf.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Vf.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function cy(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(qf(e)){let n=Xf(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=ry(n.slice(0,32)),t.s=ry(n.slice(32,64))):65===n.length?(t.r=ry(n.slice(0,32)),t.s=ry(n.slice(32,64)),t.v=n[64]):Vf.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:Vf.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=ry(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const n=ey(Xf(t._vs),32);t._vs=ry(n);const r=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=r:t.recoveryParam!==r&&Vf.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;const i=ry(n);null==t.s?t.s=i:t.s!==i&&Vf.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?Vf.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const n=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==n&&Vf.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&ty(t.r)?t.r=uy(t.r,32):Vf.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&ty(t.s)?t.s=uy(t.s,32):Vf.throwArgumentError("signature missing or invalid s","signature",e);const n=Xf(t.s);n[0]>=128&&Vf.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(n[0]|=128);const r=ry(n);t._vs&&(ty(t._vs)||Vf.throwArgumentError("signature invalid _vs","signature",e),t._vs=uy(t._vs,32)),null==t._vs?t._vs=r:t._vs!==r&&Vf.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}const ly="bignumber/5.7.0";var dy=Of.BN;const hy=new Ff(ly),py={},fy=9007199254740991;let yy=!1;class my{constructor(e,t){e!==py&&hy.throwError("cannot call constructor directly; use BigNumber.from",Ff.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return vy(wy(this).fromTwos(e))}toTwos(e){return vy(wy(this).toTwos(e))}abs(){return"-"===this._hex[0]?my.from(this._hex.substring(1)):this}add(e){return vy(wy(this).add(wy(e)))}sub(e){return vy(wy(this).sub(wy(e)))}div(e){return my.from(e).isZero()&&by("division-by-zero","div"),vy(wy(this).div(wy(e)))}mul(e){return vy(wy(this).mul(wy(e)))}mod(e){const t=wy(e);return t.isNeg()&&by("division-by-zero","mod"),vy(wy(this).umod(t))}pow(e){const t=wy(e);return t.isNeg()&&by("negative-power","pow"),vy(wy(this).pow(t))}and(e){const t=wy(e);return(this.isNegative()||t.isNeg())&&by("unbound-bitwise-result","and"),vy(wy(this).and(t))}or(e){const t=wy(e);return(this.isNegative()||t.isNeg())&&by("unbound-bitwise-result","or"),vy(wy(this).or(t))}xor(e){const t=wy(e);return(this.isNegative()||t.isNeg())&&by("unbound-bitwise-result","xor"),vy(wy(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&by("negative-width","mask"),vy(wy(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&by("negative-width","shl"),vy(wy(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&by("negative-width","shr"),vy(wy(this).shrn(e))}eq(e){return wy(this).eq(wy(e))}lt(e){return wy(this).lt(wy(e))}lte(e){return wy(this).lte(wy(e))}gt(e){return wy(this).gt(wy(e))}gte(e){return wy(this).gte(wy(e))}isNegative(){return"-"===this._hex[0]}isZero(){return wy(this).isZero()}toNumber(){try{return wy(this).toNumber()}catch(e){by("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return hy.throwError("this platform does not support BigInt",Ff.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?yy||(yy=!0,hy.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?hy.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ff.errors.UNEXPECTED_ARGUMENT,{}):hy.throwError("BigNumber.toString does not accept parameters",Ff.errors.UNEXPECTED_ARGUMENT,{})),wy(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof my)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new my(py,gy(e)):e.match(/^-?[0-9]+$/)?new my(py,gy(new dy(e))):hy.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&by("underflow","BigNumber.from",e),(e>=fy||e<=-fy)&&by("overflow","BigNumber.from",e),my.from(String(e));const t=e;if("bigint"==typeof t)return my.from(t.toString());if(Jf(t))return my.from(ry(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return my.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(ty(e)||"-"===e[0]&&ty(e.substring(1))))return my.from(e)}return hy.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function gy(e){if("string"!=typeof e)return gy(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&hy.throwArgumentError("invalid hex","value",e),"0x00"===(e=gy(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function vy(e){return my.from(gy(e))}function wy(e){const t=my.from(e).toHexString();return"-"===t[0]?new dy("-"+t.substring(3),16):new dy(t.substring(2),16)}function by(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),hy.throwError(e,Ff.errors.NUMERIC_FAULT,r)}const My=new Ff(ly),Ay={},Ey=my.from(0),Ny=my.from(-1);function Ty(e,t,n,r){const i={fault:t,operation:n};return void 0!==r&&(i.value=r),My.throwError(e,Ff.errors.NUMERIC_FAULT,i)}let Iy="0";for(;Iy.length<256;)Iy+=Iy;function ky(e){if("number"!=typeof e)try{e=my.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+Iy.substring(0,e):My.throwArgumentError("invalid decimal size","decimals",e)}function Ly(e,t){null==t&&(t=0);const n=ky(t),r=(e=my.from(e)).lt(Ey);r&&(e=e.mul(Ny));let i=e.mod(n).toString();for(;i.length<n.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=e.div(n).toString();return e=1===n.length?o:o+"."+i,r&&(e="-"+e),e}function xy(e,t){null==t&&(t=0);const n=ky(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||My.throwArgumentError("invalid decimal value","value",e);const r="-"===e.substring(0,1);r&&(e=e.substring(1)),"."===e&&My.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&My.throwArgumentError("too many decimal points","value",e);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&&Ty("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length<n.length-1;)a+="0";const s=my.from(o),u=my.from(a);let c=s.mul(n).add(u);return r&&(c=c.mul(Ny)),c}class Sy{constructor(e,t,n,r){e!==Ay&&My.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Ff.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=n,this.decimals=r,this.name=(t?"":"u")+"fixed"+String(n)+"x"+String(r),this._multiplier=ky(r),Object.freeze(this)}static from(e){if(e instanceof Sy)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,n=128,r=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||My.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],n=parseInt(i[2]),r=parseInt(i[3])}else if(e){const i=(t,n,r)=>null==e[t]?r:(typeof e[t]!==n&&My.throwArgumentError("invalid fixed format ("+t+" not "+n+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&My.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&My.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new Sy(Ay,t,n,r)}}class jy{constructor(e,t,n,r){e!==Ay&&My.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Ff.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=t,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&My.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=xy(this._value,this.format.decimals),n=xy(e._value,e.format.decimals);return jy.fromValue(t.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=xy(this._value,this.format.decimals),n=xy(e._value,e.format.decimals);return jy.fromValue(t.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=xy(this._value,this.format.decimals),n=xy(e._value,e.format.decimals);return jy.fromValue(t.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=xy(this._value,this.format.decimals),n=xy(e._value,e.format.decimals);return jy.fromValue(t.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=jy.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(t=t.subUnsafe(Cy.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=jy.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(t=t.addUnsafe(Cy.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&My.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const n=jy.from("1"+Iy.substring(0,e),this.format),r=Dy.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(e){if(null==e)return this._hex;e%8&&My.throwArgumentError("invalid byte width","width",e);return uy(my.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return jy.fromString(this._value,e)}static fromValue(e,t,n){return null!=n||null==t||function(e){return null!=e&&(my.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||ty(e)||"bigint"==typeof e||Jf(e))}(t)||(n=t,t=null),null==t&&(t=0),null==n&&(n="fixed"),jy.fromString(Ly(e,t),Sy.from(n))}static fromString(e,t){null==t&&(t="fixed");const n=Sy.from(t),r=xy(e,n.decimals);!n.signed&&r.lt(Ey)&&Ty("unsigned value cannot be negative","overflow","value",e);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=uy(i,n.width/8));const o=Ly(r,n.decimals);return new jy(Ay,i,o,n)}static fromBytes(e,t){null==t&&(t="fixed");const n=Sy.from(t);if(Xf(e).length>n.width/8)throw new Error("overflow");let r=my.from(e);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),o=Ly(r,n.decimals);return new jy(Ay,i,o,n)}static from(e,t){if("string"==typeof e)return jy.fromString(e,t);if(Jf(e))return jy.fromBytes(e,t);try{return jy.fromValue(e,0,t)}catch(e){if(e.code!==Ff.errors.INVALID_ARGUMENT)throw e}return My.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const Cy=jy.from(1),Dy=jy.from("0.5");var Oy=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const zy=new Ff("properties/5.7.0");function _y(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function Py(e,t){for(let n=0;n<32;n++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function Ry(e){return Oy(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const n=e[t];return Promise.resolve(n).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function By(e){const t={};for(const n in e)t[n]=e[n];return t}const Uy={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function Wy(e){if(null==e||Uy[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let n=0;n<t.length;n++){let r=null;try{r=e[t[n]]}catch(e){continue}if(!Wy(r))return!1}return!0}return zy.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Qy(e){if(Wy(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>Yy(e))));if("object"==typeof e){const t={};for(const n in e){const r=e[n];void 0!==r&&_y(t,n,Yy(r))}return t}return zy.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function Yy(e){return Qy(e)}class Fy{constructor(e){for(const t in e)this[t]=Yy(e[t])}}const Vy="abi/5.7.0",Hy=new Ff(Vy),Gy={};let qy={calldata:!0,memory:!0,storage:!0},Zy={calldata:!0,memory:!0};function Jy(e,t){if("bytes"===e||"string"===e){if(qy[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&Zy[t])return!0;return(qy[t]||"payable"===t)&&Hy.throwArgumentError("invalid modifier","name",t),!1}function Xy(e,t){for(let n in t)_y(e,n,t[n])}const Ky=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),$y=new RegExp(/^(.*)\[([0-9]*)\]$/);class em{constructor(e,t){e!==Gy&&Hy.throwError("use fromString",Ff.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Xy(this,t);let n=this.type.match($y);Xy(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:em.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(e){if(e||(e=Ky.sighash),Ky[e]||Hy.throwArgumentError("invalid format type","format",e),e===Ky.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==Ky.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Ky.full?", ":",")+")"):t+=this.type,e!==Ky.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Ky.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?em.fromString(e,t):em.fromObject(e)}static fromObject(e){return em.isParamType(e)?e:new em(Gy,{name:e.name||null,type:dm(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(em.fromObject):null})}static fromString(e,t){return n=function(e,t){let n=e;function r(t){Hy.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let n={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(n.indexed=!1),n}e=e.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let n=0;n<e.length;n++){let o=e[n];switch(o){case"(":a.state.allowType&&""===a.type?a.type="tuple":a.state.allowParams||r(n),a.state.allowType=!1,a.type=dm(a.type),a.components=[i(a)],a=a.components[0];break;case")":delete a.state,"indexed"===a.name&&(t||r(n),a.indexed=!0,a.name=""),Jy(a.type,a.name)&&(a.name=""),a.type=dm(a.type);let e=a;a=a.parent,a||r(n),delete e.parent,a.state.allowParams=!1,a.state.allowName=!0,a.state.allowArray=!0;break;case",":delete a.state,"indexed"===a.name&&(t||r(n),a.indexed=!0,a.name=""),Jy(a.type,a.name)&&(a.name=""),a.type=dm(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=dm(a.type),delete a.state.allowType,a.state.allowName=!0,a.state.allowParams=!0),a.state.allowName&&""!==a.name&&("indexed"===a.name?(t||r(n),a.indexed&&r(n),a.indexed=!0,a.name=""):Jy(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&&Hy.throwArgumentError("unexpected eof","param",e),delete o.state,"indexed"===a.name?(t||r(n.length-7),a.indexed&&r(n.length-7),a.indexed=!0,a.name=""):Jy(a.type,a.name)&&(a.name=""),o.type=dm(o.type),o}(e,!!t),em.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}}function tm(e,t){return function(e){e=e.trim();let t=[],n="",r=0;for(let i=0;i<e.length;i++){let o=e[i];","===o&&0===r?(t.push(n),n=""):(n+=o,"("===o?r++:")"===o&&(r--,-1===r&&Hy.throwArgumentError("unbalanced parenthesis","value",e)))}n&&t.push(n);return t}(e).map((e=>em.fromString(e,t)))}class nm{constructor(e,t){e!==Gy&&Hy.throwError("use a static from method",Ff.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Xy(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return nm.isFragment(e)?e:"string"==typeof e?nm.fromString(e):nm.fromObject(e)}static fromObject(e){if(nm.isFragment(e))return e;switch(e.type){case"function":return um.fromObject(e);case"event":return rm.fromObject(e);case"constructor":return sm.fromObject(e);case"error":return lm.fromObject(e);case"fallback":case"receive":return null}return Hy.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?rm.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?um.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?sm.fromString(e.trim()):"error"===e.split(" ")[0]?lm.fromString(e.substring(5).trim()):Hy.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class rm extends nm{format(e){if(e||(e=Ky.sighash),Ky[e]||Hy.throwArgumentError("invalid format type","format",e),e===Ky.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ky.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ky.full?", ":",")+") ",e!==Ky.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?rm.fromString(e):rm.fromObject(e)}static fromObject(e){if(rm.isEventFragment(e))return e;"event"!==e.type&&Hy.throwArgumentError("invalid event object","value",e);const t={name:pm(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(em.fromObject):[],type:"event"};return new rm(Gy,t)}static fromString(e){let t=e.match(fm);t||Hy.throwArgumentError("invalid event string","value",e);let n=!1;return t[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:Hy.warn("unknown modifier: "+e)}})),rm.fromObject({name:t[1].trim(),anonymous:n,inputs:tm(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function im(e,t){t.gas=null;let n=e.split("@");return 1!==n.length?(n.length>2&&Hy.throwArgumentError("invalid human-readable ABI signature","value",e),n[1].match(/^[0-9]+$/)||Hy.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=my.from(n[1]),n[0]):e}function om(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function am(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&Hy.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&Hy.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||Hy.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&Hy.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&Hy.throwArgumentError("unable to determine stateMutability","value",e),t}class sm extends nm{format(e){if(e||(e=Ky.sighash),Ky[e]||Hy.throwArgumentError("invalid format type","format",e),e===Ky.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((t=>JSON.parse(t.format(e))))});e===Ky.sighash&&Hy.throwError("cannot format a constructor for sighash",Ff.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Ky.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?sm.fromString(e):sm.fromObject(e)}static fromObject(e){if(sm.isConstructorFragment(e))return e;"constructor"!==e.type&&Hy.throwArgumentError("invalid constructor object","value",e);let t=am(e);t.constant&&Hy.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(em.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?my.from(e.gas):null};return new sm(Gy,n)}static fromString(e){let t={type:"constructor"},n=(e=im(e,t)).match(fm);return n&&"constructor"===n[1].trim()||Hy.throwArgumentError("invalid constructor string","value",e),t.inputs=tm(n[2].trim(),!1),om(n[3].trim(),t),sm.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class um extends sm{format(e){if(e||(e=Ky.sighash),Ky[e]||Hy.throwArgumentError("invalid format type","format",e),e===Ky.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((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ky.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ky.full?", ":",")+") ",e!==Ky.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"==typeof e?um.fromString(e):um.fromObject(e)}static fromObject(e){if(um.isFunctionFragment(e))return e;"function"!==e.type&&Hy.throwArgumentError("invalid function object","value",e);let t=am(e);const n={type:e.type,name:pm(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(em.fromObject):[],outputs:e.outputs?e.outputs.map(em.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?my.from(e.gas):null};return new um(Gy,n)}static fromString(e){let t={type:"function"},n=(e=im(e,t)).split(" returns ");n.length>2&&Hy.throwArgumentError("invalid function string","value",e);let r=n[0].match(fm);if(r||Hy.throwArgumentError("invalid function signature","value",e),t.name=r[1].trim(),t.name&&pm(t.name),t.inputs=tm(r[2],!1),om(r[3].trim(),t),n.length>1){let r=n[1].match(fm);""==r[1].trim()&&""==r[3].trim()||Hy.throwArgumentError("unexpected tokens","value",e),t.outputs=tm(r[2],!1)}else t.outputs=[];return um.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function cm(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||Hy.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class lm extends nm{format(e){if(e||(e=Ky.sighash),Ky[e]||Hy.throwArgumentError("invalid format type","format",e),e===Ky.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ky.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ky.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?lm.fromString(e):lm.fromObject(e)}static fromObject(e){if(lm.isErrorFragment(e))return e;"error"!==e.type&&Hy.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:pm(e.name),inputs:e.inputs?e.inputs.map(em.fromObject):[]};return cm(new lm(Gy,t))}static fromString(e){let t={type:"error"},n=e.match(fm);return n||Hy.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&pm(t.name),t.inputs=tm(n[2],!1),cm(lm.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function dm(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const hm=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function pm(e){return e&&e.match(hm)||Hy.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const fm=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const ym=new Ff(Vy);class mm{constructor(e,t,n,r){this.name=e,this.type=t,this.localName=n,this.dynamic=r}_throwError(e,t){ym.throwArgumentError(e,this.localName,t)}}class gm{constructor(e){_y(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return ay(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(Kf(e._data))}writeBytes(e){let t=Xf(e);const n=t.length%this.wordSize;return n&&(t=Kf([t,this._padding.slice(n)])),this._writeData(t)}_getValue(e){let t=Xf(my.from(e));return t.length>this.wordSize&&ym.throwError("value out-of-bounds",Ff.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Kf([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class vm{constructor(e,t,n,r){_y(this,"_data",Xf(e)),_y(this,"wordSize",t||32),_y(this,"_coerceFunc",n),_y(this,"allowLoose",r),this._offset=0}get data(){return ry(this._data)}get consumed(){return this._offset}static coerce(e,t){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):vm.coerce(e,t)}_peekBytes(e,t,n){let r=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+t<=this._data.length?r=t:ym.throwError("data out-of-bounds",Ff.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(e){return new vm(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let n=this._peekBytes(0,e,!!t);return this._offset+=n.length,n.slice(0,e)}readValue(){return my.from(this.readBytes(this.wordSize))}}var wm=wf((function(e){!function(){var t="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof L&&L.versions&&L.versions.node?r=gf:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&e.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),u=[4,1024,262144,67108864],c=[0,8,16,24],l=[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],h=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],f={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var y=function(e,t,n){return function(r){return new j(e,t,e).update(r)[n]()}},m=function(e,t,n){return function(r,i){return new j(e,t,i).update(r)[n]()}},g=function(e,t,n){return function(t,r,i,o){return A["cshake"+e].update(t,r,i,o)[n]()}},v=function(e,t,n){return function(t,r,i,o){return A["kmac"+e].update(t,r,i,o)[n]()}},w=function(e,t,n,r){for(var i=0;i<p.length;++i){var o=p[i];e[o]=t(n,r,o)}return e},b=function(e,t){var n=y(e,t,"hex");return n.create=function(){return new j(e,t,e)},n.update=function(e){return n.create().update(e)},w(n,y,e,t)},M=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:b},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:b},{name:"shake",padding:[31,7936,2031616,520093696],bits:h,createMethod:function(e,t){var n=m(e,t,"hex");return n.create=function(n){return new j(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},w(n,m,e,t)}},{name:"cshake",padding:u,bits:h,createMethod:function(e,t){var n=f[e],r=g(e,0,"hex");return r.create=function(r,i,o){return i||o?new j(e,t,r).bytepad([i,o],n):A["shake"+e].create(r)},r.update=function(e,t,n,i){return r.create(t,n,i).update(e)},w(r,g,e,t)}},{name:"kmac",padding:u,bits:h,createMethod:function(e,t){var n=f[e],r=v(e,0,"hex");return r.create=function(r,i,o){return new C(e,t,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(e,t,n,i){return r.create(e,n,i).update(t)},w(r,v,e,t)}}],A={},E=[],N=0;N<M.length;++N)for(var T=M[N],I=T.bits,k=0;k<I.length;++k){var x=T.name+"_"+I[k];if(E.push(x),A[x]=T.createMethod(I[k],T.padding),"sha3"!==T.name){var S=T.name+I[k];E.push(S),A[S]=A[x]}}function j(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<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 C(e,t,n){j.call(this,e,t,n)}j.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var i,o,s=this.blocks,u=this.byteCount,l=e.length,d=this.blockCount,h=0,p=this.s;h<l;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<d+1;++i)s[i]=0;if(n)for(i=this.start;h<l&&i<u;++h)s[i>>2]|=e[h]<<c[3&i++];else for(i=this.start;h<l&&i<u;++h)(o=e.charCodeAt(h))<128?s[i>>2]|=o<<c[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++h)),s[i>>2]|=(240|o>>18)<<c[3&i++],s[i>>2]|=(128|o>>12&63)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[d],i=0;i<d;++i)p[i]^=s[i];D(p),this.reset=!0}else this.start=i}return this},j.prototype.encode=function(e,t){var n=255&e,r=1,i=[n];for(n=255&(e>>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},j.prototype.encodeString=function(e){var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}var i=0,o=e.length;if(n)i=o;else for(var s=0;s<e.length;++s){var u=e.charCodeAt(s);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&e.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(e),i},j.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var i=t-n%t,o=[];return o.length=i,this.update(o),this},j.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];D(r)}},j.prototype.toString=j.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,u="";a<r;){for(o=0;o<t&&a<r;++o,++a)e=n[o],u+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t==0&&(D(n),o=0)}return i&&(e=n[o],u+=s[e>>4&15]+s[15&e],i>1&&(u+=s[e>>12&15]+s[e>>8&15]),i>2&&(u+=s[e>>20&15]+s[e>>16&15])),u},j.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);a<r;){for(o=0;o<t&&a<r;++o,++a)u[a]=n[o];a%t==0&&D(n)}return i&&(u[o]=n[o],e=e.slice(0,s)),e},j.prototype.buffer=j.prototype.arrayBuffer,j.prototype.digest=j.prototype.array=function(){this.finalize();for(var e,t,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)e=s<<2,t=r[a],u[e]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%n==0&&D(r)}return o&&(e=s<<2,t=r[a],u[e]=255&t,o>1&&(u[e+1]=t>>8&255),o>2&&(u[e+2]=t>>16&255)),u},C.prototype=new j,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),j.prototype.finalize.call(this)};var D=function(e){var t,n,r,i,o,a,s,u,c,d,h,p,f,y,m,g,v,w,b,M,A,E,N,T,I,k,L,x,S,j,C,D,O,z,_,P,R,B,U,W,Q,Y,F,V,H,G,q,Z,J,X,K,$,ee,te,ne,re,ie,oe,ae,se,ue,ce,le;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(p=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(f=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(d<<1|h>>>31),n=s^(h<<1|d>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=u^(p<<1|f>>>31),n=c^(f<<1|p>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=d^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,y=e[0],m=e[1],G=e[11]<<4|e[10]>>>28,q=e[10]<<4|e[11]>>>28,x=e[20]<<3|e[21]>>>29,S=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,Y=e[40]<<18|e[41]>>>14,F=e[41]<<18|e[40]>>>14,z=e[2]<<1|e[3]>>>31,_=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Z=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,j=e[33]<<13|e[32]>>>19,C=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,P=e[14]<<6|e[15]>>>26,R=e[15]<<6|e[14]>>>26,w=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,K=e[35]<<15|e[34]>>>17,D=e[45]<<29|e[44]>>>3,O=e[44]<<29|e[45]>>>3,T=e[6]<<28|e[7]>>>4,I=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,B=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,M=e[36]<<21|e[37]>>>11,A=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,H=e[9]<<27|e[8]>>>5,k=e[18]<<20|e[19]>>>12,L=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,W=e[38]<<8|e[39]>>>24,Q=e[39]<<8|e[38]>>>24,E=e[48]<<14|e[49]>>>18,N=e[49]<<14|e[48]>>>18,e[0]=y^~g&w,e[1]=m^~v&b,e[10]=T^~k&x,e[11]=I^~L&S,e[20]=z^~P&B,e[21]=_^~R&U,e[30]=V^~G&Z,e[31]=H^~q&J,e[40]=te^~re&oe,e[41]=ne^~ie&ae,e[2]=g^~w&M,e[3]=v^~b&A,e[12]=k^~x&j,e[13]=L^~S&C,e[22]=P^~B&W,e[23]=R^~U&Q,e[32]=G^~Z&X,e[33]=q^~J&K,e[42]=re^~oe&se,e[43]=ie^~ae&ue,e[4]=w^~M&E,e[5]=b^~A&N,e[14]=x^~j&D,e[15]=S^~C&O,e[24]=B^~W&Y,e[25]=U^~Q&F,e[34]=Z^~X&$,e[35]=J^~K&ee,e[44]=oe^~se&ce,e[45]=ae^~ue&le,e[6]=M^~E&y,e[7]=A^~N&m,e[16]=j^~D&T,e[17]=C^~O&I,e[26]=W^~Y&z,e[27]=Q^~F&_,e[36]=X^~$&V,e[37]=K^~ee&H,e[46]=se^~ce&te,e[47]=ue^~le&ne,e[8]=E^~y&g,e[9]=N^~m&v,e[18]=D^~T&k,e[19]=O^~I&L,e[28]=Y^~z&P,e[29]=F^~_&R,e[38]=$^~V&G,e[39]=ee^~H&q,e[48]=ce^~te&re,e[49]=le^~ne&ie,e[0]^=l[r],e[1]^=l[r+1]};if(o)e.exports=A;else for(N=0;N<E.length;++N)r[E[N]]=A[E[N]]}()})),bm=wm;function Mm(e){return"0x"+bm.keccak_256(Xf(e))}const Am=new Ff("rlp/5.7.0");function Em(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function Nm(e,t,n){let r=0;for(let i=0;i<n;i++)r=256*r+e[t+i];return r}function Tm(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(Tm(e))})),t.length<=55)return t.unshift(192+t.length),t;const n=Em(t.length);return n.unshift(247+n.length),n.concat(t)}qf(e)||Am.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(Xf(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const n=Em(t.length);return n.unshift(183+n.length),n.concat(t)}function Im(e){return ry(Tm(e))}function km(e,t,n,r){const i=[];for(;n<t+1+r;){const o=Lm(e,n);i.push(o.result),(n+=o.consumed)>t+1+r&&Am.throwError("child data too short",Ff.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function Lm(e,t){if(0===e.length&&Am.throwError("data too short",Ff.errors.BUFFER_OVERRUN,{}),e[t]>=248){const n=e[t]-247;t+1+n>e.length&&Am.throwError("data short segment too short",Ff.errors.BUFFER_OVERRUN,{});const r=Nm(e,t+1,n);return t+1+n+r>e.length&&Am.throwError("data long segment too short",Ff.errors.BUFFER_OVERRUN,{}),km(e,t,t+1+n,n+r)}if(e[t]>=192){const n=e[t]-192;return t+1+n>e.length&&Am.throwError("data array too short",Ff.errors.BUFFER_OVERRUN,{}),km(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;t+1+n>e.length&&Am.throwError("data array too short",Ff.errors.BUFFER_OVERRUN,{});const r=Nm(e,t+1,n);t+1+n+r>e.length&&Am.throwError("data array too short",Ff.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:ry(e.slice(t+1+n,t+1+n+r))}}if(e[t]>=128){const n=e[t]-128;t+1+n>e.length&&Am.throwError("data too short",Ff.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:ry(e.slice(t+1,t+1+n))}}return{consumed:1,result:ry(e[t])}}function xm(e){const t=Xf(e),n=Lm(t,0);return n.consumed!==t.length&&Am.throwArgumentError("invalid rlp data","data",e),n.result}const Sm=new Ff("address/5.7.0");function jm(e){ty(e,20)||Sm.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let e=0;e<40;e++)n[e]=t[e].charCodeAt(0);const r=Xf(Mm(n));for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&r[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const Cm={};for(let e=0;e<10;e++)Cm[String(e)]=String(e);for(let e=0;e<26;e++)Cm[String.fromCharCode(65+e)]=String(10+e);const Dm=Math.floor(function(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}(9007199254740991));function Om(e){let t=null;if("string"!=typeof e&&Sm.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=jm(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&Sm.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==function(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>Cm[e])).join("");for(;t.length>=Dm;){let e=t.substring(0,Dm);t=parseInt(e,10)%97+t.substring(e.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n="0"+n;return n}(e)&&Sm.throwArgumentError("bad icap checksum","address",e),n=e.substring(4),t=new dy(n,36).toString(16);t.length<40;)t="0"+t;t=jm("0x"+t)}else Sm.throwArgumentError("invalid address","address",e);var n;return t}function zm(e){let t=null;try{t=Om(e.from)}catch(t){Sm.throwArgumentError("missing from address","transaction",e)}return Om(oy(Mm(Im([t,$f(Xf(my.from(e.nonce).toHexString()))])),12))}class _m extends mm{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=Om(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return Om(uy(e.readValue().toHexString(),20))}}class Pm extends mm{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const Rm=new Ff(Vy);function Bm(e,t,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let e={};r=t.map((t=>{const r=t.localName;return r||Rm.throwError("cannot encode object for signature with missing names",Ff.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]&&Rm.throwError("cannot encode object for signature with duplicate names",Ff.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]=!0,n[r]}))}else Rm.throwArgumentError("invalid tuple value","tuple",n);t.length!==r.length&&Rm.throwArgumentError("types/value length mismatch","tuple",n);let i=new gm(e.wordSize),o=new gm(e.wordSize),a=[];t.forEach(((e,t)=>{let n=r[t];if(e.dynamic){let t=o.length;e.encode(o,n);let r=i.writeUpdatableValue();a.push((e=>{r(e+t)}))}else e.encode(i,n)})),a.forEach((e=>{e(i.length)}));let s=e.appendWriter(i);return s+=e.appendWriter(o),s}function Um(e,t){let n=[],r=e.subReader(0);t.forEach((t=>{let i=null;if(t.dynamic){let n=e.readValue(),o=r.subReader(n.toNumber());try{i=t.decode(o)}catch(e){if(e.code===Ff.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(e){if(e.code===Ff.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}null!=i&&n.push(i)}));const i=t.reduce(((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e}),{});t.forEach(((e,t)=>{let r=e.localName;if(!r||1!==i[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const o=n[t];o instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw o}}):n[r]=o}));for(let e=0;e<n.length;e++){const t=n[e];t instanceof Error&&Object.defineProperty(n,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(n)}class Wm extends mm{constructor(e,t,n){super("array",e.type+"["+(t>=0?t:"")+"]",n,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let n=this.length;-1===n&&(n=t.length,e.writeValue(t.length)),Rm.checkArgumentCount(t.length,n,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let e=0;e<t.length;e++)r.push(this.coder);return Bm(e,r,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&Rm.throwError("insufficient data length",Ff.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let n=[];for(let e=0;e<t;e++)n.push(new Pm(this.coder));return e.coerce(this.name,Um(e,n))}}class Qm extends mm{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class Ym extends mm{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=Xf(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class Fm extends Ym{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,ry(super.decode(e)))}}class Vm extends mm{constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let n=Xf(t);return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return e.coerce(this.name,ry(e.readBytes(this.size)))}}class Hm extends mm{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}const Gm=my.from(-1),qm=my.from(0),Zm=my.from(1),Jm=my.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class Xm extends mm{constructor(e,t,n){const r=(t?"int":"uint")+8*e;super(r,r,n,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let n=my.from(t),r=Jm.mask(8*e.wordSize);if(this.signed){let e=r.mask(8*this.size-1);(n.gt(e)||n.lt(e.add(Zm).mul(Gm)))&&this._throwError("value out-of-bounds",t)}else(n.lt(qm)||n.gt(r.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return n=n.toTwos(8*this.size).mask(8*this.size),this.signed&&(n=n.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(n)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}const Km=new Ff("strings/5.7.0");var $m,eg;function tg(e,t,n,r,i){if(e===eg.BAD_PREFIX||e===eg.UNEXPECTED_CONTINUE){let e=0;for(let r=t+1;r<n.length&&n[r]>>6==2;r++)e++;return e}return e===eg.OVERRUN?n.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}($m||($m={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(eg||(eg={}));const ng=Object.freeze({error:function(e,t,n,r,i){return Km.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",n)},ignore:tg,replace:function(e,t,n,r,i){return e===eg.OVERLONG?(r.push(i),0):(r.push(65533),tg(e,t,n))}});function rg(e,t){null==t&&(t=ng.error),e=Xf(e);const n=[];let r=0;for(;r<e.length;){const i=e[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+=t(128==(192&i)?eg.UNEXPECTED_CONTINUE:eg.BAD_PREFIX,r-1,e,n);continue}o=3,a=65535}if(r-1+o>=e.length){r+=t(eg.OVERRUN,r-1,e,n);continue}let s=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=e[r];if(128!=(192&i)){r+=t(eg.MISSING_CONTINUE,r,e,n),s=null;break}s=s<<6|63&i,r++}null!==s&&(s>1114111?r+=t(eg.OUT_OF_RANGE,r-1-o,e,n,s):s>=55296&&s<=57343?r+=t(eg.UTF16_SURROGATE,r-1-o,e,n,s):s<=a?r+=t(eg.OVERLONG,r-1-o,e,n,s):n.push(s))}return n}function ig(e,t=$m.current){t!=$m.current&&(Km.checkNormalize(),e=e.normalize(t));let n=[];for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);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)){t++;const i=e.charCodeAt(t);if(t>=e.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 Xf(n)}function og(e,t){return rg(e,t).map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}class ag extends Ym{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,ig(t))}decode(e){return og(super.decode(e))}}class sg extends mm{constructor(e,t){let n=!1;const r=[];e.forEach((e=>{e.dynamic&&(n=!0),r.push(e.type)}));super("tuple","tuple("+r.join(",")+")",t,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach((t=>{e.push(t.defaultValue())}));const t=this.coders.reduce(((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[r]))})),Object.freeze(e)}encode(e,t){return Bm(e,this.coders,t)}decode(e){return e.coerce(this.name,Um(e,this.coders))}}const ug=new Ff(Vy),cg=new RegExp(/^bytes([0-9]*)$/),lg=new RegExp(/^(u?int)([0-9]*)$/);const dg=new class{constructor(e){_y(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new _m(e.name);case"bool":return new Qm(e.name);case"string":return new ag(e.name);case"bytes":return new Fm(e.name);case"array":return new Wm(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new sg((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new Hm(e.name)}let t=e.type.match(lg);if(t){let n=parseInt(t[2]||"256");return(0===n||n>256||n%8!=0)&&ug.throwArgumentError("invalid "+t[1]+" bit length","param",e),new Xm(n/8,"int"===t[1],e.name)}if(t=e.type.match(cg),t){let n=parseInt(t[1]);return(0===n||n>32)&&ug.throwArgumentError("invalid bytes length","param",e),new Vm(n,e.name)}return ug.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new vm(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new gm(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(em.from(e))));return new sg(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&ug.throwError("types/values length mismatch",Ff.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const n=e.map((e=>this._getCoder(em.from(e)))),r=new sg(n,"_"),i=this._getWriter();return r.encode(i,t),i.data}decode(e,t,n){const r=e.map((e=>this._getCoder(em.from(e))));return new sg(r,"_").decode(this._getReader(Xf(t),n))}};function hg(e){return Mm(ig(e))}const pg="hash/5.7.0";function fg(e){e=atob(e);const t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return Xf(t)}function yg(e){e=Xf(e);let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function mg(e,t){null==t&&(t=1);const n=[],r=n.forEach,i=function(e,t){r.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):n.push(e)}))};return i(e,t),n}function gg(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function n(){return e[t++]<<8|e[t++]}let r=n(),i=1,o=[0,1];for(let e=1;e<r;e++)o.push(i+=n());let a=n(),s=t;t+=a;let u=0,c=0;function l(){return 0==u&&(c=c<<8|e[t++],u=8),c>>--u&1}const d=Math.pow(2,31),h=d>>>1,p=h>>1,f=d-1;let y=0;for(let e=0;e<31;e++)y=y<<1|l();let m=[],g=0,v=d;for(;;){let e=Math.floor(((y-g+1)*i-1)/v),t=0,n=r;for(;n-t>1;){let r=t+n>>>1;e<o[r]?n=r:t=r}if(0==t)break;m.push(t);let a=g+Math.floor(v*o[t]/i),s=g+Math.floor(v*o[t+1]/i)-1;for(;0==((a^s)&h);)y=y<<1&f|l(),a=a<<1&f,s=s<<1&f|1;for(;a&~s&p;)y=y&h|y<<1&f>>>1|l(),a=a<<1^h,s=(s^h)<<1|h|1;g=a,v=1+s-a}let w=r-4;return m.map((t=>{switch(t-w){case 3:return w+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return w+256+(e[s++]<<8|e[s++]);case 1:return w+e[s++];default:return t-1}}))}(e))}function vg(e){return 1&e?~e>>1:e>>1}function wg(e,t){let n=Array(e);for(let r=0,i=-1;r<e;r++)n[r]=i+=1+t();return n}function bg(e,t){let n=Array(e);for(let r=0,i=0;r<e;r++)n[r]=i+=vg(t());return n}function Mg(e,t){let n=wg(e(),e),r=e(),i=wg(r,e),o=function(e,t){let n=Array(e);for(let r=0;r<e;r++)n[r]=1+t();return n}(r,e);for(let e=0;e<r;e++)for(let t=0;t<o[e];t++)n.push(i[e]+t);return t?n.map((e=>t[e])):n}function Ag(e,t,n){let r=Array(e).fill(void 0).map((()=>[]));for(let i=0;i<t;i++)bg(e,n).forEach(((e,t)=>r[t].push(e)));return r}function Eg(e,t){let n=1+t(),r=t(),i=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(n)}return t}(t);return mg(Ag(i.length,1+e,t).map(((e,t)=>{const o=e[0],a=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*r;return[o+t*n,a.map((e=>e+i))]}))})))}function Ng(e,t){return Ag(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const Tg=gg(fg("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==")),Ig=new Set(Mg(Tg)),kg=new Set(Mg(Tg)),Lg=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(Eg(n,e))}for(;;){let n=e()-1;if(n<0)break;t.push(Ng(n,e))}return function(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[r[0]]=r[1]}return t}(mg(t))}(Tg),xg=function(e){let t=Mg(e).sort(((e,t)=>e-t));return function n(){let r=[];for(;;){let i=Mg(e,t);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((e,t)=>t.set.size-e.set.size));let i=e(),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}}()}(Tg),Sg=45,jg=95;function Cg(e){return function(e,t=$m.current){return rg(ig(e,t))}(e)}function Dg(e){return e.filter((e=>65039!=e))}function Og(e){for(let t of e.split(".")){let e=Cg(t);try{for(let t=e.lastIndexOf(jg)-1;t>=0;t--)if(e[t]!==jg)throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&e[2]===Sg&&e[3]===Sg)throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function zg(e){return Og(function(e,t){let n=Cg(e).reverse(),r=[];for(;n.length;){let e=_g(n);if(e){r.push(...t(e));continue}let i=n.pop();if(Ig.has(i)){r.push(i);continue}if(kg.has(i))continue;let o=Lg[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...o)}return Og(function(e){return e.normalize("NFC")}(String.fromCodePoint(...r)))}(e,Dg))}function _g(e,t){var n;let r,i,o=xg,a=[],s=e.length;for(t&&(t.length=0);s;){let u=e[--s];if(o=null===(n=o.branches.find((e=>e.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==e[s-1]&&s--),o.valid&&(r=a.slice(),2==o.valid&&r.splice(1,1),t&&t.push(...e.slice(s).reverse()),e.length=s)}return r}const Pg=new Ff(pg),Rg=new Uint8Array(32);function Bg(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function Ug(e){const t=ig(zg(e)),n=[];if(0===e.length)return n;let r=0;for(let e=0;e<t.length;e++){46===t[e]&&(n.push(Bg(t.slice(r,e))),r=e+1)}if(r>=t.length)throw new Error("invalid ENS name; empty component");return n.push(Bg(t.slice(r))),n}function Wg(e){"string"!=typeof e&&Pg.throwArgumentError("invalid ENS name; not a string","name",e);let t=Rg;const n=Ug(e);for(;n.length;)t=Mm(Kf([t,Mm(n.pop())]));return ry(t)}Rg.fill(0);var Qg=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const Yg=new Ff(pg),Fg=new Uint8Array(32);Fg.fill(0);const Vg=my.from(-1),Hg=my.from(0),Gg=my.from(1),qg=my.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Zg=uy(Gg.toHexString(),32),Jg=uy(Hg.toHexString(),32),Xg={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Kg=["name","version","chainId","verifyingContract","salt"];function $g(e){return function(t){return"string"!=typeof t&&Yg.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const ev={name:$g("name"),version:$g("version"),chainId:function(e){try{return my.from(e).toString()}catch(e){}return Yg.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return Om(e).toLowerCase()}catch(e){}return Yg.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=Xf(e);if(32!==t.length)throw new Error("bad length");return ry(t)}catch(e){}return Yg.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function tv(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],r=parseInt(t[2]||"256");(r%8!=0||r>256||t[2]&&t[2]!==String(r))&&Yg.throwArgumentError("invalid numeric width","type",e);const i=qg.mask(n?r-1:r),o=n?i.add(Gg).mul(Vg):Hg;return function(t){const n=my.from(t);return(n.lt(o)||n.gt(i))&&Yg.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),uy(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const n=parseInt(t[1]);return(0===n||n>32||t[1]!==String(n))&&Yg.throwArgumentError("invalid bytes width","type",e),function(t){return Xf(t).length!==n&&Yg.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=Xf(e),n=t.length%32;return n?ay([t,Fg.slice(n)]):ry(t)}(t)}}}switch(e){case"address":return function(e){return uy(Om(e),32)};case"bool":return function(e){return e?Zg:Jg};case"bytes":return function(e){return Mm(e)};case"string":return function(e){return hg(e)}}return null}function nv(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class rv{constructor(e){_y(this,"types",Object.freeze(Yy(e))),_y(this,"_encoderCache",{}),_y(this,"_types",{});const t={},n={},r={};Object.keys(e).forEach((e=>{t[e]={},n[e]=[],r[e]={}}));for(const r in e){const i={};e[r].forEach((o=>{i[o.name]&&Yg.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,"types",e),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===r&&Yg.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e);tv(a)||(n[a]||Yg.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",e),n[a].push(r),t[r][a]=!0)}))}const i=Object.keys(n).filter((e=>0===n[e].length));0===i.length?Yg.throwArgumentError("missing primary type","types",e):i.length>1&&Yg.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),_y(this,"primaryType",i[0]),function i(o,a){a[o]&&Yg.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e),a[o]=!0,Object.keys(t[o]).forEach((e=>{n[e]&&(i(e,a),Object.keys(a).forEach((t=>{r[t][e]=!0})))})),delete a[o]}(this.primaryType,{});for(const t in r){const n=Object.keys(r[t]);n.sort(),this._types[t]=nv(t,e[t])+n.map((t=>nv(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=tv(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],n=this.getEncoder(e),r=parseInt(t[3]);return t=>{r>=0&&t.length!==r&&Yg.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(n);return this._types[e]&&(i=i.map(Mm)),Mm(ay(i))}}const n=this.types[e];if(n){const t=hg(this._types[e]);return e=>{const r=n.map((({name:t,type:n})=>{const r=this.getEncoder(n)(e[t]);return this._types[n]?Mm(r):r}));return r.unshift(t),ay(r)}}return Yg.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Yg.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Mm(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,n){if(tv(e))return n(e,t);const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const e=r[1],i=parseInt(r[3]);return i>=0&&t.length!==i&&Yg.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,n)))}const i=this.types[e];return i?i.reduce(((e,{name:r,type:i})=>(e[r]=this._visit(i,t[r],n),e)),{}):Yg.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new rv(e)}static getPrimaryType(e){return rv.from(e).primaryType}static hashStruct(e,t,n){return rv.from(t).hashStruct(e,n)}static hashDomain(e){const t=[];for(const n in e){const r=Xg[n];r||Yg.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:r})}return t.sort(((e,t)=>Kg.indexOf(e.name)-Kg.indexOf(t.name))),rv.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return ay(["0x1901",rv.hashDomain(e),rv.from(t).hash(n)])}static hash(e,t,n){return Mm(rv.encode(e,t,n))}static resolveNames(e,t,n,r){return Qg(this,void 0,void 0,(function*(){e=By(e);const i={};e.verifyingContract&&!ty(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=rv.from(t);o.visit(n,((e,t)=>("address"!==e||ty(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield r(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),n=o.visit(n,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:n}}))}static getPayload(e,t,n){rv.hashDomain(e);const r={},i=[];Kg.forEach((t=>{const n=e[t];null!=n&&(r[t]=ev[t](n),i.push({name:t,type:Xg[t]}))}));const o=rv.from(t),a=By(t);return a.EIP712Domain?Yg.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=i,o.encode(n),{types:a,domain:r,primaryType:o.primaryType,message:o.visit(n,((e,t)=>{if(e.match(/^bytes(\d*)/))return ry(Xf(t));if(e.match(/^u?int/))return my.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&Yg.throwArgumentError("invalid string","value",t),t}return Yg.throwArgumentError("unsupported type","type",e)}))}}}const iv=new Ff(Vy);class ov extends Fy{}class av extends Fy{}class sv extends Fy{}class uv extends Fy{static isIndexed(e){return!(!e||!e._isIndexed)}}const cv={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function lv(e,t){const n=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return n.error=t,n}class dv{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,_y(this,"fragments",t.map((e=>nm.from(e))).filter((e=>null!=e))),_y(this,"_abiCoder",Py(new.target,"getAbiCoder")()),_y(this,"functions",{}),_y(this,"errors",{}),_y(this,"events",{}),_y(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void iv.warn("duplicate definition - constructor"):void _y(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let n=e.format();t[n]?iv.warn("duplicate definition - "+n):t[n]=e})),this.deploy||_y(this,"deploy",sm.from({payable:!1,type:"constructor"})),_y(this,"_isInterface",!0)}format(e){e||(e=Ky.full),e===Ky.sighash&&iv.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===Ky.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return dg}static getAddress(e){return Om(e)}static getSighash(e){return oy(hg(e.format()),0,4)}static getEventTopic(e){return hg(e.format())}getFunction(e){if(ty(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];iv.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.functions).filter((e=>e.split("(")[0]===t));return 0===n.length?iv.throwArgumentError("no matching function","name",t):n.length>1&&iv.throwArgumentError("multiple matching functions","name",t),this.functions[n[0]]}const t=this.functions[um.fromString(e).format()];return t||iv.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(ty(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];iv.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.events).filter((e=>e.split("(")[0]===t));return 0===n.length?iv.throwArgumentError("no matching event","name",t):n.length>1&&iv.throwArgumentError("multiple matching events","name",t),this.events[n[0]]}const t=this.events[rm.fromString(e).format()];return t||iv.throwArgumentError("no matching event","signature",e),t}getError(e){if(ty(e)){const t=Py(this.constructor,"getSighash");for(const n in this.errors){if(e===t(this.errors[n]))return this.errors[n]}iv.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.errors).filter((e=>e.split("(")[0]===t));return 0===n.length?iv.throwArgumentError("no matching error","name",t):n.length>1&&iv.throwArgumentError("multiple matching errors","name",t),this.errors[n[0]]}const t=this.errors[um.fromString(e).format()];return t||iv.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return Py(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),Py(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"==typeof e&&(e=this.getError(e));const n=Xf(t);return ry(n.slice(0,4))!==this.getSighash(e)&&iv.throwArgumentError(`data signature does not match error ${e.name}.`,"data",ry(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),ry(Kf([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const n=Xf(t);return ry(n.slice(0,4))!==this.getSighash(e)&&iv.throwArgumentError(`data signature does not match function ${e.name}.`,"data",ry(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),ry(Kf([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let n=Xf(t),r=null,i="",o=null,a=null,s=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch(e){}break;case 4:{const e=ry(n.slice(0,4)),t=cv[e];if(t)o=this._abiCoder.decode(t.inputs,n.slice(4)),a=t.name,s=t.signature,t.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 t=this.getError(e);o=this._abiCoder.decode(t.inputs,n.slice(4)),a=t.name,s=t.format()}catch(e){}break}}return iv.throwError("call revert exception"+i,Ff.errors.CALL_EXCEPTION,{method:e.format(),data:ry(t),errorArgs:o,errorName:a,errorSignature:s,reason:r})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),ry(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&iv.throwError("too many arguments for "+e.format(),Ff.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let n=[];e.anonymous||n.push(this.getEventTopic(e));const r=(e,t)=>"string"===e.type?hg(t):"bytes"===e.type?Mm(ry(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=my.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),uy(ry(t),32));for(t.forEach(((t,i)=>{let o=e.inputs[i];o.indexed?null==t?n.push(null):"array"===o.baseType||"tuple"===o.baseType?iv.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,t):Array.isArray(t)?n.push(t.map((e=>r(o,e)))):n.push(r(o,t)):null!=t&&iv.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,t)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));const n=[],r=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&iv.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,o)=>{const a=t[o];if(e.indexed)if("string"===e.type)n.push(hg(a));else if("bytes"===e.type)n.push(Mm(a));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(this._abiCoder.encode([e.type],[a]))}else r.push(e),i.push(a)})),{data:this._abiCoder.encode(r,i),topics:n}}decodeEventLog(e,t,n){if("string"==typeof e&&(e=this.getEvent(e)),null!=n&&!e.anonymous){let t=this.getEventTopic(e);ty(n[0],32)&&n[0].toLowerCase()===t||iv.throwError("fragment/topic mismatch",Ff.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:n[0]}),n=n.slice(1)}let r=[],i=[],o=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(r.push(em.fromObject({type:"bytes32",name:e.name})),o.push(!0)):(r.push(e),o.push(!1)):(i.push(e),o.push(!1))}));let a=null!=n?this._abiCoder.decode(r,Kf(n)):null,s=this._abiCoder.decode(i,t,!0),u=[],c=0,l=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==a)u[t]=new uv({_isIndexed:!0,hash:null});else if(o[t])u[t]=new uv({_isIndexed:!0,hash:a[l++]});else try{u[t]=a[l++]}catch(e){u[t]=e}else try{u[t]=s[c++]}catch(e){u[t]=e}if(e.name&&null==u[e.name]){const n=u[t];n instanceof Error?Object.defineProperty(u,e.name,{enumerable:!0,get:()=>{throw lv(`property ${JSON.stringify(e.name)}`,n)}}):u[e.name]=n}}));for(let e=0;e<u.length;e++){const t=u[e];t instanceof Error&&Object.defineProperty(u,e,{enumerable:!0,get:()=>{throw lv(`index ${e}`,t)}})}return Object.freeze(u)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new av({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:my.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new ov({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=ry(e);let n=this.getError(t.substring(0,10).toLowerCase());return n?new sv({args:this._abiCoder.decode(n.inputs,"0x"+t.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!(!e||!e._isInterface)}}var hv=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const pv=new Ff("abstract-provider/5.7.0");class fv extends Fy{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class yv{constructor(){pv.checkAbstract(new.target,yv),_y(this,"_isProvider",!0)}getFeeData(){return hv(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield Ry({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let n=null,r=null,i=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,i=my.from("1500000000"),r=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}var mv=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const gv=new Ff("abstract-signer/5.7.0"),vv=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],wv=[Ff.errors.INSUFFICIENT_FUNDS,Ff.errors.NONCE_EXPIRED,Ff.errors.REPLACEMENT_UNDERPRICED];class bv{constructor(){gv.checkAbstract(new.target,bv),_y(this,"_isSigner",!0)}getBalance(e){return mv(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return mv(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return mv(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield Ry(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return mv(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield Ry(this.checkTransaction(e));return yield this.provider.call(n,t)}))}sendTransaction(e){return mv(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),n=yield this.signTransaction(t);return yield this.provider.sendTransaction(n)}))}getChainId(){return mv(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return mv(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return mv(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return mv(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===vv.indexOf(t)&&gv.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=By(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&gv.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return mv(this,void 0,void 0,(function*(){const t=yield Ry(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>mv(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&gv.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const n=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!n?0!==t.type&&1!==t.type||!n||gv.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):gv.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(n&&gv.throwError("network does not support EIP-1559",Ff.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):gv.throwError("failed to get consistent fee data",Ff.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(wv.indexOf(e.code)>=0)throw e;return gv.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Ff.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&gv.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield Ry(t)}))}_checkProvider(e){this.provider||gv.throwError("missing provider",Ff.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class Mv extends bv{constructor(e,t){super(),_y(this,"address",e),_y(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{gv.throwError(e,Ff.errors.UNSUPPORTED_OPERATION,{operation:t})}))}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Mv(this.address,e)}}var Av=Ev;function Ev(e,t){if(!e)throw new Error(t||"Assertion failed")}Ev.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var Nv=[],Tv=[],Iv="undefined"!=typeof Uint8Array?Uint8Array:Array,kv=!1;function Lv(){kv=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)Nv[t]=e[t],Tv[e.charCodeAt(t)]=t;Tv["-".charCodeAt(0)]=62,Tv["_".charCodeAt(0)]=63}function xv(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(Nv[(i=r)>>18&63]+Nv[i>>12&63]+Nv[i>>6&63]+Nv[63&i]);return o.join("")}function Sv(e){var t;kv||Lv();for(var n=e.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;s<u;s+=a)o.push(xv(e,s,s+a>u?u:s+a));return 1===r?(t=e[n-1],i+=Nv[t>>2],i+=Nv[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=Nv[t>>10],i+=Nv[t>>4&63],i+=Nv[t<<2&63],i+="="),o.push(i),o.join("")}function jv(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-l)-1,p>>=-l,l+=s;l>0;o=256*o+e[t+d],d+=h,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+d],d+=h,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)}function Cv(e,t,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,d=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+d>=1?h/u:h*Math.pow(2,1-d))*u>=2&&(a++,u/=2),a+d>=l?(s=0,a=l):a+d>=1?(s=(t*u-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+p]=255&s,p+=f,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+p]=255&a,p+=f,a/=256,c-=8);e[n+p-f]|=128*y}var Dv={}.toString,Ov=Array.isArray||function(e){return"[object Array]"==Dv.call(e)};function zv(){return Pv.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function _v(e,t){if(zv()<t)throw new RangeError("Invalid typed array length");return Pv.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Pv.prototype:(null===e&&(e=new Pv(t)),e.length=t),e}function Pv(e,t,n){if(!(Pv.TYPED_ARRAY_SUPPORT||this instanceof Pv))return new Pv(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Uv(this,e)}return Rv(this,e,t,n)}function Rv(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);Pv.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Pv.prototype:e=Wv(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!Pv.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|Fv(t,n);e=_v(e,r);var i=e.write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(Yv(t)){var n=0|Qv(t.length);return 0===(e=_v(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?_v(e,0):Wv(e,t);if("Buffer"===t.type&&Ov(t.data))return Wv(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Bv(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Uv(e,t){if(Bv(t),e=_v(e,t<0?0:0|Qv(t)),!Pv.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function Wv(e,t){var n=t.length<0?0:0|Qv(t.length);e=_v(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function Qv(e){if(e>=zv())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+zv().toString(16)+" bytes");return 0|e}function Yv(e){return!(null==e||!e._isBuffer)}function Fv(e,t){if(Yv(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return gw(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return vw(e).length;default:if(r)return gw(e).length;t=(""+t).toLowerCase(),r=!0}}function Vv(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return aw(this,t,n);case"utf8":case"utf-8":return nw(this,t,n);case"ascii":return iw(this,t,n);case"latin1":case"binary":return ow(this,t,n);case"base64":return tw(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return sw(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function Hv(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function Gv(e,t,n,r,i){if(0===e.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:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=Pv.from(t,r)),Yv(t))return 0===t.length?-1:qv(e,t,n,r,i);if("number"==typeof t)return t&=255,Pv.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):qv(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function qv(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-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 d=!0,h=0;h<u;h++)if(c(e,o+h)!==c(t,h)){d=!1;break}if(d)return o}return-1}function Zv(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.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(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function Jv(e,t,n,r){return ww(gw(t,e.length-n),e,n,r)}function Xv(e,t,n,r){return ww(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function Kv(e,t,n,r){return Xv(e,t,n,r)}function $v(e,t,n,r){return ww(vw(t),e,n,r)}function ew(e,t,n,r){return ww(function(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function tw(e,t,n){return 0===t&&n===e.length?Sv(e):Sv(e.slice(t,n))}function nw(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,u,c=e[i],l=null,d=c>239?4:c>223?3:c>191?2:1;if(i+d<=n)switch(d){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],a=e[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=e[i+1],a=e[i+2],s=e[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,d=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=d}return function(e){var t=e.length;if(t<=rw)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=rw));return n}(r)}Pv.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT,zv(),Pv.poolSize=8192,Pv._augment=function(e){return e.__proto__=Pv.prototype,e},Pv.from=function(e,t,n){return Rv(null,e,t,n)},Pv.TYPED_ARRAY_SUPPORT&&(Pv.prototype.__proto__=Uint8Array.prototype,Pv.__proto__=Uint8Array),Pv.alloc=function(e,t,n){return function(e,t,n,r){return Bv(t),t<=0?_v(e,t):void 0!==n?"string"==typeof r?_v(e,t).fill(n,r):_v(e,t).fill(n):_v(e,t)}(null,e,t,n)},Pv.allocUnsafe=function(e){return Uv(null,e)},Pv.allocUnsafeSlow=function(e){return Uv(null,e)},Pv.isBuffer=function(e){return null!=e&&(!!e._isBuffer||bw(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&bw(e.slice(0,0))}(e))},Pv.compare=function(e,t){if(!Yv(e)||!Yv(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},Pv.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Pv.concat=function(e,t){if(!Ov(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Pv.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=Pv.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!Yv(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},Pv.byteLength=Fv,Pv.prototype._isBuffer=!0,Pv.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Hv(this,t,t+1);return this},Pv.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Hv(this,t,t+3),Hv(this,t+1,t+2);return this},Pv.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Hv(this,t,t+7),Hv(this,t+1,t+6),Hv(this,t+2,t+5),Hv(this,t+3,t+4);return this},Pv.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?nw(this,0,e):Vv.apply(this,arguments)},Pv.prototype.equals=function(e){if(!Yv(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Pv.compare(this,e)},Pv.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Pv.prototype.compare=function(e,t,n,r,i){if(!Yv(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),c=e.slice(t,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},Pv.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},Pv.prototype.indexOf=function(e,t,n){return Gv(this,e,t,n,!0)},Pv.prototype.lastIndexOf=function(e,t,n){return Gv(this,e,t,n,!1)},Pv.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>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,e,t,n);case"utf8":case"utf-8":return Jv(this,e,t,n);case"ascii":return Xv(this,e,t,n);case"latin1":case"binary":return Kv(this,e,t,n);case"base64":return $v(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ew(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},Pv.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var rw=4096;function iw(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function ow(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function aw(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=mw(e[o]);return i}function sw(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function uw(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function cw(e,t,n,r,i,o){if(!Yv(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function lw(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function dw(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function hw(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function pw(e,t,n,r,i){return i||hw(e,0,n,4),Cv(e,t,n,r,23,4),n+4}function fw(e,t,n,r,i){return i||hw(e,0,n,8),Cv(e,t,n,r,52,8),n+8}Pv.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),Pv.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=Pv.prototype;else{var i=t-e;n=new Pv(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},Pv.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||uw(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},Pv.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||uw(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},Pv.prototype.readUInt8=function(e,t){return t||uw(e,1,this.length),this[e]},Pv.prototype.readUInt16LE=function(e,t){return t||uw(e,2,this.length),this[e]|this[e+1]<<8},Pv.prototype.readUInt16BE=function(e,t){return t||uw(e,2,this.length),this[e]<<8|this[e+1]},Pv.prototype.readUInt32LE=function(e,t){return t||uw(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Pv.prototype.readUInt32BE=function(e,t){return t||uw(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Pv.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||uw(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},Pv.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||uw(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},Pv.prototype.readInt8=function(e,t){return t||uw(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Pv.prototype.readInt16LE=function(e,t){t||uw(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},Pv.prototype.readInt16BE=function(e,t){t||uw(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},Pv.prototype.readInt32LE=function(e,t){return t||uw(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Pv.prototype.readInt32BE=function(e,t){return t||uw(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Pv.prototype.readFloatLE=function(e,t){return t||uw(e,4,this.length),jv(this,e,!0,23,4)},Pv.prototype.readFloatBE=function(e,t){return t||uw(e,4,this.length),jv(this,e,!1,23,4)},Pv.prototype.readDoubleLE=function(e,t){return t||uw(e,8,this.length),jv(this,e,!0,52,8)},Pv.prototype.readDoubleBE=function(e,t){return t||uw(e,8,this.length),jv(this,e,!1,52,8)},Pv.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||cw(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},Pv.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||cw(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},Pv.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||cw(this,e,t,1,255,0),Pv.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Pv.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||cw(this,e,t,2,65535,0),Pv.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):lw(this,e,t,!0),t+2},Pv.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||cw(this,e,t,2,65535,0),Pv.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):lw(this,e,t,!1),t+2},Pv.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||cw(this,e,t,4,4294967295,0),Pv.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):dw(this,e,t,!0),t+4},Pv.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||cw(this,e,t,4,4294967295,0),Pv.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):dw(this,e,t,!1),t+4},Pv.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);cw(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},Pv.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);cw(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},Pv.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||cw(this,e,t,1,127,-128),Pv.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Pv.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||cw(this,e,t,2,32767,-32768),Pv.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):lw(this,e,t,!0),t+2},Pv.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||cw(this,e,t,2,32767,-32768),Pv.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):lw(this,e,t,!1),t+2},Pv.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||cw(this,e,t,4,2147483647,-2147483648),Pv.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):dw(this,e,t,!0),t+4},Pv.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||cw(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Pv.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):dw(this,e,t,!1),t+4},Pv.prototype.writeFloatLE=function(e,t,n){return pw(this,e,t,!0,n)},Pv.prototype.writeFloatBE=function(e,t,n){return pw(this,e,t,!1,n)},Pv.prototype.writeDoubleLE=function(e,t,n){return fw(this,e,t,!0,n)},Pv.prototype.writeDoubleBE=function(e,t,n){return fw(this,e,t,!1,n)},Pv.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!Pv.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},Pv.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Pv.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=Yv(e)?e:gw(new Pv(e,r).toString()),s=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%s]}return this};var yw=/[^+\/0-9A-Za-z-_]/g;function mw(e){return e<16?"0"+e.toString(16):e.toString(16)}function gw(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=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((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function vw(e){return function(e){var t,n,r,i,o,a;kv||Lv();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new Iv(3*s/4-o),r=o>0?s-4:s;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=Tv[e.charCodeAt(t)]<<18|Tv[e.charCodeAt(t+1)]<<12|Tv[e.charCodeAt(t+2)]<<6|Tv[e.charCodeAt(t+3)],a[u++]=i>>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=Tv[e.charCodeAt(t)]<<2|Tv[e.charCodeAt(t+1)]>>4,a[u++]=255&i):1===o&&(i=Tv[e.charCodeAt(t)]<<10|Tv[e.charCodeAt(t+1)]<<4|Tv[e.charCodeAt(t+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(yw,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ww(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function bw(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Mw=function(e){return e instanceof Pv},Aw=wf((function(e,t){var n=/%[sdj%]/g;t.format=function(e){if(!y(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(o(arguments[r]));return t.join(" ")}r=1;for(var i=arguments,a=i.length,s=String(e).replace(n,(function(e){if("%%"===e)return"%";if(r>=a)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(e){return"[Circular]"}default:return e}})),u=i[r];r<a;u=i[++r])p(u)||!v(u)?s+=" "+u:s+=" "+o(u);return s},t.deprecate=function(e,n){if(m(gf.process))return function(){return t.deprecate(e,n).apply(this,arguments)};if(!0===L.noDeprecation)return e;var r=!1;return function(){if(!r){if(L.throwDeprecation)throw new Error(n);L.traceDeprecation?console.trace(n):console.error(n),r=!0}return e.apply(this,arguments)}};var r,i={};function o(e,n){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),h(n)?r.showHidden=n:n&&t._extend(r,n),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),u(r,e,r.depth)}function a(e,t){var n=o.styles[t];return n?"["+o.colors[n][0]+"m"+e+"["+o.colors[n][1]+"m":e}function s(e,t){return e}function u(e,n,r){if(e.customInspect&&n&&M(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return y(i)||(i=u(e,i,r)),i}var o=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(y(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(f(t))return e.stylize(""+t,"number");if(h(t))return e.stylize(""+t,"boolean");if(p(t))return e.stylize("null","null")}(e,n);if(o)return o;var a=Object.keys(n),s=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),0===a.length){if(M(n)){var v=n.name?": "+n.name:"";return e.stylize("[Function"+v+"]","special")}if(g(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return e.stylize(Date.prototype.toString.call(n),"date");if(b(n))return c(n)}var A,E="",N=!1,I=["{","}"];(d(n)&&(N=!0,I=["[","]"]),M(n))&&(E=" [Function"+(n.name?": "+n.name:"")+"]");return g(n)&&(E=" "+RegExp.prototype.toString.call(n)),w(n)&&(E=" "+Date.prototype.toUTCString.call(n)),b(n)&&(E=" "+c(n)),0!==a.length||N&&0!=n.length?r<0?g(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),A=N?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)T(t,String(a))?o.push(l(e,t,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(l(e,t,n,r,i,!0))})),o}(e,n,r,s,a):a.map((function(t){return l(e,n,r,s,t,N)})),e.seen.pop(),function(e,t,n){var r=e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(r>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(A,E,I)):I[0]+E+I[1]}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i,o){var a,s,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),T(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=p(n)?u(e,c.value,null):u(e,c.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),m(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=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e){return Array.isArray(e)}function h(e){return"boolean"==typeof e}function p(e){return null===e}function f(e){return"number"==typeof e}function y(e){return"string"==typeof e}function m(e){return void 0===e}function g(e){return v(e)&&"[object RegExp]"===A(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===A(e)}function b(e){return v(e)&&("[object Error]"===A(e)||e instanceof Error)}function M(e){return"function"==typeof e}function A(e){return Object.prototype.toString.call(e)}function E(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(m(r)&&(r=L.env.NODE_DEBUG||""),e=e.toUpperCase(),!i[e])if(new RegExp("\\b"+e+"\\b","i").test(r)){var n=L.pid;i[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else i[e]=function(){};return i[e]},t.inspect=o,o.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]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=d,t.isBoolean=h,t.isNull=p,t.isNullOrUndefined=function(e){return null==e},t.isNumber=f,t.isString=y,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=m,t.isRegExp=g,t.isObject=v,t.isDate=w,t.isError=b,t.isFunction=M,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=Mw;var N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){var e,n;console.log("%s - %s",(e=new Date,n=[E(e.getHours()),E(e.getMinutes()),E(e.getSeconds())].join(":"),[e.getDate(),N[e.getMonth()],n].join(" ")),t.format.apply(t,arguments))},t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t._extend=function(e,t){if(!t||!v(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}})),Ew=wf((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),Nw=wf((function(e){try{var t=Aw;if("function"!=typeof t.inherits)throw"";e.exports=t.inherits}catch(t){e.exports=Ew}}));function Tw(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}var Iw=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)n.push(parseInt(e[i]+e[i+1],16))}else for(var r=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):Tw(e,i)?(o=65536+((1023&o)<<10)+(1023&e.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<e.length;i++)n[i]=0|e[i];return n};var kw=function(e){for(var t="",n=0;n<e.length;n++)t+=Sw(e[n].toString(16));return t};function Lw(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}var xw=function(e,t){for(var n="",r=0;r<e.length;r++){var i=e[r];"little"===t&&(i=Lw(i)),n+=jw(i.toString(16))}return n};function Sw(e){return 1===e.length?"0"+e:e}function jw(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}var Cw=function(e,t,n,r){var i=n-t;Av(i%4==0);for(var o=new Array(i/4),a=0,s=t;a<o.length;a++,s+=4){var u;u="big"===r?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],o[a]=u>>>0}return o};var Dw=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4){var o=e[r];"big"===t?(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 Ow=function(e,t){return e>>>t|e<<32-t};var zw=function(e,t){return e<<t|e>>>32-t};var _w=function(e,t){return e+t>>>0};var Pw=function(e,t,n){return e+t+n>>>0};var Rw=function(e,t,n,r){return e+t+n+r>>>0};var Bw=function(e,t,n,r,i){return e+t+n+r+i>>>0};var Uw=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,a=(o<r?1:0)+n+i;e[t]=a>>>0,e[t+1]=o};var Ww=function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0};var Qw=function(e,t,n,r){return t+r>>>0};var Yw=function(e,t,n,r,i,o,a,s){var u=0,c=t;return u+=(c=c+r>>>0)<t?1:0,u+=(c=c+o>>>0)<o?1:0,e+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0};var Fw=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0};var Vw=function(e,t,n,r,i,o,a,s,u,c){var l=0,d=t;return l+=(d=d+r>>>0)<t?1:0,l+=(d=d+o>>>0)<o?1:0,l+=(d=d+s>>>0)<s?1:0,e+n+i+a+u+(l+=(d=d+c>>>0)<c?1:0)>>>0};var Hw=function(e,t,n,r,i,o,a,s,u,c){return t+r+o+s+c>>>0};var Gw=function(e,t,n){return(t<<32-n|e>>>n)>>>0};var qw=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var Zw=function(e,t,n){return e>>>n};var Jw=function(e,t,n){return(e<<32-n|t>>>n)>>>0},Xw={inherits:Nw,toArray:Iw,toHex:kw,htonl:Lw,toHex32:xw,zero2:Sw,zero8:jw,join32:Cw,split32:Dw,rotr32:Ow,rotl32:zw,sum32:_w,sum32_3:Pw,sum32_4:Rw,sum32_5:Bw,sum64:Uw,sum64_hi:Ww,sum64_lo:Qw,sum64_4_hi:Yw,sum64_4_lo:Fw,sum64_5_hi:Vw,sum64_5_lo:Hw,rotr64_hi:Gw,rotr64_lo:qw,shr64_hi:Zw,shr64_lo:Jw};function Kw(){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 $w=Kw;Kw.prototype.update=function(e,t){if(e=Xw.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=Xw.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},Kw.prototype.digest=function(e){return this.update(this._pad()),Av(null===this.pending),this._digest(e)},Kw.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=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++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>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 eb={BlockHash:$w},tb=Xw.rotr32;var nb=function(e,t,n,r){return 0===e?rb(t,n,r):1===e||3===e?ob(t,n,r):2===e?ib(t,n,r):void 0};function rb(e,t,n){return e&t^~e&n}function ib(e,t,n){return e&t^e&n^t&n}function ob(e,t,n){return e^t^n}var ab=function(e){return tb(e,2)^tb(e,13)^tb(e,22)};var sb=function(e){return tb(e,6)^tb(e,11)^tb(e,25)};var ub=function(e){return tb(e,7)^tb(e,18)^e>>>3};var cb=function(e){return tb(e,17)^tb(e,19)^e>>>10},lb={ft_1:nb,ch32:rb,maj32:ib,p32:ob,s0_256:ab,s1_256:sb,g0_256:ub,g1_256:cb},db=Xw.rotl32,hb=Xw.sum32,pb=Xw.sum32_5,fb=lb.ft_1,yb=eb.BlockHash,mb=[1518500249,1859775393,2400959708,3395469782];function gb(){if(!(this instanceof gb))return new gb;yb.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Xw.inherits(gb,yb);var vb=gb;gb.blockSize=512,gb.outSize=160,gb.hmacStrength=80,gb.padLength=64,gb.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=db(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=pb(db(i,5),fb(c,o,a,s),u,n[r],mb[c]);u=s,s=a,a=db(o,30),o=i,i=l}this.h[0]=hb(this.h[0],i),this.h[1]=hb(this.h[1],o),this.h[2]=hb(this.h[2],a),this.h[3]=hb(this.h[3],s),this.h[4]=hb(this.h[4],u)},gb.prototype._digest=function(e){return"hex"===e?Xw.toHex32(this.h,"big"):Xw.split32(this.h,"big")};var wb=Xw.sum32,bb=Xw.sum32_4,Mb=Xw.sum32_5,Ab=lb.ch32,Eb=lb.maj32,Nb=lb.s0_256,Tb=lb.s1_256,Ib=lb.g0_256,kb=lb.g1_256,Lb=eb.BlockHash,xb=[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 Sb(){if(!(this instanceof Sb))return new Sb;Lb.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=xb,this.W=new Array(64)}Xw.inherits(Sb,Lb);var jb=Sb;function Cb(){if(!(this instanceof Cb))return new Cb;jb.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Sb.blockSize=512,Sb.outSize=256,Sb.hmacStrength=192,Sb.padLength=64,Sb.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=bb(kb(n[r-2]),n[r-7],Ib(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],d=this.h[7];for(Av(this.k.length===n.length),r=0;r<n.length;r++){var h=Mb(d,Tb(u),Ab(u,c,l),this.k[r],n[r]),p=wb(Nb(i),Eb(i,o,a));d=l,l=c,c=u,u=wb(s,h),s=a,a=o,o=i,i=wb(h,p)}this.h[0]=wb(this.h[0],i),this.h[1]=wb(this.h[1],o),this.h[2]=wb(this.h[2],a),this.h[3]=wb(this.h[3],s),this.h[4]=wb(this.h[4],u),this.h[5]=wb(this.h[5],c),this.h[6]=wb(this.h[6],l),this.h[7]=wb(this.h[7],d)},Sb.prototype._digest=function(e){return"hex"===e?Xw.toHex32(this.h,"big"):Xw.split32(this.h,"big")},Xw.inherits(Cb,jb);var Db=Cb;Cb.blockSize=512,Cb.outSize=224,Cb.hmacStrength=192,Cb.padLength=64,Cb.prototype._digest=function(e){return"hex"===e?Xw.toHex32(this.h.slice(0,7),"big"):Xw.split32(this.h.slice(0,7),"big")};var Ob=Xw.rotr64_hi,zb=Xw.rotr64_lo,_b=Xw.shr64_hi,Pb=Xw.shr64_lo,Rb=Xw.sum64,Bb=Xw.sum64_hi,Ub=Xw.sum64_lo,Wb=Xw.sum64_4_hi,Qb=Xw.sum64_4_lo,Yb=Xw.sum64_5_hi,Fb=Xw.sum64_5_lo,Vb=eb.BlockHash,Hb=[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 Gb(){if(!(this instanceof Gb))return new Gb;Vb.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Hb,this.W=new Array(160)}Xw.inherits(Gb,Vb);var qb=Gb;function Zb(e,t,n,r,i){var o=e&n^~e&i;return o<0&&(o+=4294967296),o}function Jb(e,t,n,r,i,o){var a=t&r^~t&o;return a<0&&(a+=4294967296),a}function Xb(e,t,n,r,i){var o=e&n^e&i^n&i;return o<0&&(o+=4294967296),o}function Kb(e,t,n,r,i,o){var a=t&r^t&o^r&o;return a<0&&(a+=4294967296),a}function $b(e,t){var n=Ob(e,t,28)^Ob(t,e,2)^Ob(t,e,7);return n<0&&(n+=4294967296),n}function eM(e,t){var n=zb(e,t,28)^zb(t,e,2)^zb(t,e,7);return n<0&&(n+=4294967296),n}function tM(e,t){var n=Ob(e,t,14)^Ob(e,t,18)^Ob(t,e,9);return n<0&&(n+=4294967296),n}function nM(e,t){var n=zb(e,t,14)^zb(e,t,18)^zb(t,e,9);return n<0&&(n+=4294967296),n}function rM(e,t){var n=Ob(e,t,1)^Ob(e,t,8)^_b(e,t,7);return n<0&&(n+=4294967296),n}function iM(e,t){var n=zb(e,t,1)^zb(e,t,8)^Pb(e,t,7);return n<0&&(n+=4294967296),n}function oM(e,t){var n=Ob(e,t,19)^Ob(t,e,29)^_b(e,t,6);return n<0&&(n+=4294967296),n}function aM(e,t){var n=zb(e,t,19)^zb(t,e,29)^Pb(e,t,6);return n<0&&(n+=4294967296),n}function sM(){if(!(this instanceof sM))return new sM;qb.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Gb.blockSize=1024,Gb.outSize=512,Gb.hmacStrength=192,Gb.padLength=128,Gb.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=oM(n[r-4],n[r-3]),o=aM(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=rM(n[r-30],n[r-29]),c=iM(n[r-30],n[r-29]),l=n[r-32],d=n[r-31];n[r]=Wb(i,o,a,s,u,c,l,d),n[r+1]=Qb(i,o,a,s,u,c,l,d)}},Gb.prototype._update=function(e,t){this._prepareBlock(e,t);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],d=this.h[8],h=this.h[9],p=this.h[10],f=this.h[11],y=this.h[12],m=this.h[13],g=this.h[14],v=this.h[15];Av(this.k.length===n.length);for(var w=0;w<n.length;w+=2){var b=g,M=v,A=tM(d,h),E=nM(d,h),N=Zb(d,h,p,f,y),T=Jb(d,h,p,f,y,m),I=this.k[w],k=this.k[w+1],L=n[w],x=n[w+1],S=Yb(b,M,A,E,N,T,I,k,L,x),j=Fb(b,M,A,E,N,T,I,k,L,x);b=$b(r,i),M=eM(r,i),A=Xb(r,i,o,a,s),E=Kb(r,i,o,a,s,u);var C=Bb(b,M,A,E),D=Ub(b,M,A,E);g=y,v=m,y=p,m=f,p=d,f=h,d=Bb(c,l,S,j),h=Ub(l,l,S,j),c=s,l=u,s=o,u=a,o=r,a=i,r=Bb(S,j,C,D),i=Ub(S,j,C,D)}Rb(this.h,0,r,i),Rb(this.h,2,o,a),Rb(this.h,4,s,u),Rb(this.h,6,c,l),Rb(this.h,8,d,h),Rb(this.h,10,p,f),Rb(this.h,12,y,m),Rb(this.h,14,g,v)},Gb.prototype._digest=function(e){return"hex"===e?Xw.toHex32(this.h,"big"):Xw.split32(this.h,"big")},Xw.inherits(sM,qb);var uM=sM;sM.blockSize=1024,sM.outSize=384,sM.hmacStrength=192,sM.padLength=128,sM.prototype._digest=function(e){return"hex"===e?Xw.toHex32(this.h.slice(0,12),"big"):Xw.split32(this.h.slice(0,12),"big")};var cM={sha1:vb,sha224:Db,sha256:jb,sha384:uM,sha512:qb},lM=Xw.rotl32,dM=Xw.sum32,hM=Xw.sum32_3,pM=Xw.sum32_4,fM=eb.BlockHash;function yM(){if(!(this instanceof yM))return new yM;fM.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Xw.inherits(yM,fM);var mM=yM;function gM(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function vM(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function wM(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}yM.blockSize=512,yM.outSize=160,yM.hmacStrength=192,yM.padLength=64,yM.prototype._update=function(e,t){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,d=a,h=0;h<80;h++){var p=dM(lM(pM(n,gM(h,r,i,o),e[bM[h]+t],vM(h)),AM[h]),a);n=a,a=o,o=lM(i,10),i=r,r=p,p=dM(lM(pM(s,gM(79-h,u,c,l),e[MM[h]+t],wM(h)),EM[h]),d),s=d,d=l,l=lM(c,10),c=u,u=p}p=hM(this.h[1],i,l),this.h[1]=hM(this.h[2],o,d),this.h[2]=hM(this.h[3],a,s),this.h[3]=hM(this.h[4],n,u),this.h[4]=hM(this.h[0],r,c),this.h[0]=p},yM.prototype._digest=function(e){return"hex"===e?Xw.toHex32(this.h,"little"):Xw.split32(this.h,"little")};var bM=[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],MM=[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],AM=[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],EM=[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],NM={ripemd160:mM};function TM(e,t,n){if(!(this instanceof TM))return new TM(e,t,n);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Xw.toArray(t,n))}var IM=TM;TM.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),Av(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},TM.prototype.update=function(e,t){return this.inner.update(e,t),this},TM.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)};var kM=wf((function(e,t){var n=t;n.utils=Xw,n.common=eb,n.sha=cM,n.ripemd=NM,n.hmac=IM,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})),LM=kM;function xM(e,t,n){return n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},e(n,n.exports),n.exports}var SM=jM;function jM(e,t){if(!e)throw new Error(t||"Assertion failed")}jM.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var CM=xM((function(e,t){var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(r=0;r<e.length;r++){var i=e.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(e,t){return"hex"===t?i(e):e}})),DM=xM((function(e,t){var n=t;n.assert=SM,n.toArray=CM.toArray,n.zero2=CM.zero2,n.toHex=CM.toHex,n.encode=CM.encode,n.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<<t+1,o=e.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(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,u=e.andln(3)+i&3,c=t.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!==(r=t.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),e.iushrn(1),t.iushrn(1)}return n},n.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new Of(e,"hex","le")}})),OM=DM.getNAF,zM=DM.getJSF,_M=DM.assert;function PM(e,t){this.type=e,this.p=new Of(t.p,16),this.red=t.prime?Of.red(t.prime):Of.mont(this.p),this.zero=new Of(0).toRed(this.red),this.one=new Of(1).toRed(this.red),this.two=new Of(2).toRed(this.red),this.n=t.n&&new Of(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var RM=PM;function BM(e,t){this.curve=e,this.type=t,this.precomputed=null}PM.prototype.point=function(){throw new Error("Not implemented")},PM.prototype.validate=function(){throw new Error("Not implemented")},PM.prototype._fixedNafMul=function(e,t){_M(e.precomputed);var n=e._getDoubles(),r=OM(t,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),d=i;d>0;d--){for(o=0;o<s.length;o++)(a=s[o])===d?l=l.mixedAdd(n.points[o]):a===-d&&(l=l.mixedAdd(n.points[o].neg()));c=c.add(l)}return c.toP()},PM.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=OM(t,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];_M(0!==c),a="affine"===e.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"===e.type?a.toP():a},PM.prototype._wnafMulAdd=function(e,t,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,d=0;for(o=0;o<r;o++){var h=(s=t[o])._getNAFPoints(e);u[o]=h.wnd,c[o]=h.points}for(o=r-1;o>=1;o-=2){var p=o-1,f=o;if(1===u[p]&&1===u[f]){var y=[t[p],null,null,t[f]];0===t[p].y.cmp(t[f].y)?(y[1]=t[p].add(t[f]),y[2]=t[p].toJ().mixedAdd(t[f].neg())):0===t[p].y.cmp(t[f].y.redNeg())?(y[1]=t[p].toJ().mixedAdd(t[f]),y[2]=t[p].add(t[f].neg())):(y[1]=t[p].toJ().mixedAdd(t[f]),y[2]=t[p].toJ().mixedAdd(t[f].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=zM(n[p],n[f]);for(d=Math.max(g[0].length,d),l[p]=new Array(d),l[f]=new Array(d),a=0;a<d;a++){var v=0|g[0][a],w=0|g[1][a];l[p][a]=m[3*(v+1)+(w+1)],l[f][a]=0,c[p]=y}}else l[p]=OM(n[p],u[p],this._bitLength),l[f]=OM(n[f],u[f],this._bitLength),d=Math.max(l[p].length,d),d=Math.max(l[f].length,d)}var b=this.jpoint(null,null,null),M=this._wnafT4;for(o=d;o>=0;o--){for(var A=0;o>=0;){var E=!0;for(a=0;a<r;a++)M[a]=0|l[a][o],0!==M[a]&&(E=!1);if(!E)break;A++,o--}if(o>=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a<r;a++){var N=M[a];0!==N&&(N>0?s=c[a][N-1>>1]:N<0&&(s=c[a][-N-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()},PM.BasePoint=BM,BM.prototype.eq=function(){throw new Error("Not implemented")},BM.prototype.validate=function(){return this.curve.validate(this)},PM.prototype.decodePoint=function(e,t){e=DM.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?_M(e[e.length-1]%2==0):7===e[0]&&_M(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},BM.prototype.encodeCompressed=function(e){return this.encode(e,!0)},BM.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},BM.prototype.encode=function(e,t){return DM.encode(this._encode(t),e)},BM.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},BM.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},BM.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)r=r.dbl();n.push(r)}return{step:e,points:n}},BM.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},BM.prototype._getBeta=function(){return null},BM.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t};var UM=xM((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),WM=DM.assert;function QM(e){RM.call(this,"short",e),this.a=new Of(e.a,16).toRed(this.red),this.b=new Of(e.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(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}UM(QM,RM);var YM=QM;function FM(e,t,n,r){RM.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new Of(t,16),this.y=new Of(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 VM(e,t,n,r){RM.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Of(0)):(this.x=new Of(t,16),this.y=new Of(n,16),this.z=new Of(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}QM.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n,r;if(e.beta)t=new Of(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=(t=i[0].cmp(i[1])<0?i[0]:i[1]).toRed(this.red)}if(e.lambda)n=new Of(e.lambda,16);else{var o=this._getEndoRoots(this.n);0===this.g.mul(o[0]).x.cmp(this.g.x.redMul(t))?n=o[0]:(n=o[1],WM(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return r=e.basis?e.basis.map((function(e){return{a:new Of(e.a,16),b:new Of(e.b,16)}})):this._getEndoBasis(n),{beta:t,lambda:n,basis:r}}},QM.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Of.mont(e),n=new Of(2).toRed(t).redInvm(),r=n.redNeg(),i=new Of(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},QM.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,u,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=e,h=this.n.clone(),p=new Of(1),f=new Of(0),y=new Of(0),m=new Of(1),g=0;0!==d.cmpn(0);){var v=h.div(d);u=h.sub(v.mul(d)),c=y.sub(v.mul(p));var w=m.sub(v.mul(f));if(!r&&u.cmp(l)<0)t=s.neg(),n=p,r=u.neg(),i=c;else if(r&&2==++g)break;s=u,h=d,d=u,y=p,p=c,m=f,f=w}o=u.neg(),a=c;var b=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(b)>=0&&(o=t,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}]},QM.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).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:e.sub(a).sub(s),k2:u.add(c).neg()}},QM.prototype.pointFromX=function(e,t){(e=new Of(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.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(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},QM.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},QM.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[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},UM(FM,RM.BasePoint),QM.prototype.point=function(e,t,n){return new FM(this,e,t,n)},QM.prototype.pointFromJSON=function(e,t){return FM.fromJSON(this,e,t)},FM.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},FM.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]},FM.fromJSON=function(e,t,n){"string"==typeof t&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var o=t[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},FM.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)+">"},FM.prototype.isInfinity=function(){return this.inf},FM.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},FM.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).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)},FM.prototype.getX=function(){return this.x.fromRed()},FM.prototype.getY=function(){return this.y.fromRed()},FM.prototype.mul=function(e){return e=new Of(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},FM.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},FM.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},FM.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},FM.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.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 t},FM.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},UM(VM,RM.BasePoint),QM.prototype.jpoint=function(e,t,n){return new VM(this,e,t,n)},VM.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},VM.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},VM.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.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),d=r.redMul(c),h=u.redSqr().redIAdd(l).redISub(d).redISub(d),p=u.redMul(d.redISub(h)).redISub(o.redMul(l)),f=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(h,p,f)},VM.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).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),d=s.redSqr().redIAdd(c).redISub(l).redISub(l),h=s.redMul(l.redISub(d)).redISub(i.redMul(c)),p=this.z.redMul(a);return this.curve.jpoint(d,h,p)},VM.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)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(t=0;t<e;t++){var l=o.redSqr(),d=c.redSqr(),h=d.redSqr(),p=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),f=o.redMul(d),y=p.redSqr().redISub(f.redAdd(f)),m=f.redISub(y),g=p.redMul(m);g=g.redIAdd(g).redISub(h);var v=c.redMul(s);t+1<e&&(u=u.redMul(h)),o=y,s=v,c=g}return this.curve.jpoint(o,c.redMul(i),s)},VM.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},VM.prototype._zeroDbl=function(){var e,t,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),e=u,t=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),d=this.y.redSqr(),h=d.redSqr(),p=this.x.redAdd(d).redSqr().redISub(l).redISub(h);p=p.redIAdd(p);var f=l.redAdd(l).redIAdd(l),y=f.redSqr(),m=h.redIAdd(h);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(p).redISub(p),t=f.redMul(p.redISub(e)).redISub(m),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},VM.prototype._threeDbl=function(){var e,t,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);e=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),d=this.y.redSqr(),h=this.x.redMul(d),p=this.x.redSub(l).redMul(this.x.redAdd(l));p=p.redAdd(p).redIAdd(p);var f=h.redIAdd(h),y=(f=f.redIAdd(f)).redAdd(f);e=p.redSqr().redISub(y),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(l);var m=d.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=p.redMul(f.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,n)},VM.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=t.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),d=c.redISub(l),h=a.redSqr();h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=s.redMul(d).redISub(h),f=n.redAdd(n).redMul(r);return this.curve.jpoint(l,p,f)},VM.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).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=t.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var d=this.x.redMul(s).redISub(l);d=(d=d.redIAdd(d)).redIAdd(d);var h=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));h=(h=(h=h.redIAdd(h)).redIAdd(h)).redIAdd(h);var p=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(d,h,p)},VM.prototype.mul=function(e,t){return e=new Of(e,t),this.curve._wnafMul(this,e)},VM.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},VM.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){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}},VM.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)+">"},VM.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var HM=xM((function(e,t){var n=t;n.base=RM,n.short=YM,n.mont=null,n.edwards=null})),GM=xM((function(e,t){var n,r=t,i=DM.assert;function o(e){"short"===e.type?this.curve=new HM.short(e):"edwards"===e.type?this.curve=new HM.edwards(e):this.curve=new HM.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new o(t);return Object.defineProperty(r,e,{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:LM.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:LM.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:LM.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:LM.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:LM.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:LM.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:LM.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(e){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:LM.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function qM(e){if(!(this instanceof qM))return new qM(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=CM.toArray(e.entropy,e.entropyEnc||"hex"),n=CM.toArray(e.nonce,e.nonceEnc||"hex"),r=CM.toArray(e.pers,e.persEnc||"hex");SM(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var ZM=qM;qM.prototype._init=function(e,t,n){var r=e.concat(t).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},qM.prototype._hmac=function(){return new LM.hmac(this.hash,this.K)},qM.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},qM.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=CM.toArray(e,t),n=CM.toArray(n,r),SM(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},qM.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=CM.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(n),this._reseed++,CM.encode(o,t)};var JM=DM.assert;function XM(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var KM=XM;XM.fromPublic=function(e,t,n){return t instanceof XM?t:new XM(e,{pub:t,pubEnc:n})},XM.fromPrivate=function(e,t,n){return t instanceof XM?t:new XM(e,{priv:t,privEnc:n})},XM.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.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"}},XM.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},XM.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},XM.prototype._importPrivate=function(e,t){this.priv=new Of(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},XM.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?JM(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||JM(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},XM.prototype.derive=function(e){return e.validate()||JM(e.validate(),"public point not validated"),e.mul(this.priv).getX()},XM.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},XM.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},XM.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var $M=DM.assert;function eA(e,t){if(e instanceof eA)return e;this._importDER(e,t)||($M(e.r&&e.s,"Signature without r or s"),this.r=new Of(e.r,16),this.s=new Of(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var tA=eA;function nA(){this.place=0}function rA(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=t.place;o<r;o++,a++)i<<=8,i|=e[a],i>>>=0;return!(i<=127)&&(t.place=a,i)}function iA(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function oA(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}eA.prototype._importDER=function(e,t){e=DM.toArray(e,t);var n=new nA;if(48!==e[n.place++])return!1;var r=rA(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=rA(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var a=rA(e,n);if(!1===a)return!1;if(e.length!==a+n.place)return!1;var s=e.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 Of(o),this.s=new Of(s),this.recoveryParam=null,!0},eA.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=iA(t),n=iA(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];oA(r,t.length),(r=r.concat(t)).push(2),oA(r,n.length);var i=r.concat(n),o=[48];return oA(o,i.length),o=o.concat(i),DM.encode(o,e)};var aA=function(){throw new Error("unsupported")},sA=DM.assert;function uA(e){if(!(this instanceof uA))return new uA(e);"string"==typeof e&&(sA(Object.prototype.hasOwnProperty.call(GM,e),"Unknown curve "+e),e=GM[e]),e instanceof GM.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var cA=uA;uA.prototype.keyPair=function(e){return new KM(this,e)},uA.prototype.keyFromPrivate=function(e,t){return KM.fromPrivate(this,e,t)},uA.prototype.keyFromPublic=function(e,t){return KM.fromPublic(this,e,t)},uA.prototype.genKeyPair=function(e){e||(e={});for(var t=new ZM({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||aA(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new Of(2));;){var i=new Of(t.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},uA.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},uA.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new Of(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.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 Of(1)),c=0;;c++){var l=r.k?r.k(c):new Of(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var d=this.g.mul(l);if(!d.isInfinity()){var h=d.getX(),p=h.umod(this.n);if(0!==p.cmpn(0)){var f=l.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(f=f.umod(this.n)).cmpn(0)){var y=(d.getY().isOdd()?1:0)|(0!==h.cmp(p)?2:0);return r.canonical&&f.cmp(this.nh)>0&&(f=this.n.sub(f),y^=1),new tA({r:p,s:f,recoveryParam:y})}}}}}},uA.prototype.verify=function(e,t,n,r){e=this._truncateToN(new Of(e,16)),n=this.keyFromPublic(n,r);var i=(t=new tA(t,"hex")).r,o=t.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(e).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)},uA.prototype.recoverPubKey=function(e,t,n,r){sA((3&n)===n,"The recovery param is more than two bits"),t=new tA(t,r);var i=this.n,o=new Of(e),a=t.r,s=t.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=t.r.invm(i),d=i.sub(o).mul(l).umod(i),h=s.mul(l).umod(i);return this.g.mulAdd(d,a,h)},uA.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new tA(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var lA=xM((function(e,t){var n=t;n.version="6.5.4",n.utils=DM,n.rand=function(){throw new Error("unsupported")},n.curve=HM,n.curves=GM,n.ec=cA,n.eddsa=null})).ec;const dA=new Ff("signing-key/5.7.0");let hA=null;function pA(){return hA||(hA=new lA("secp256k1")),hA}class fA{constructor(e){_y(this,"curve","secp256k1"),_y(this,"privateKey",ry(e)),32!==iy(this.privateKey)&&dA.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=pA().keyFromPrivate(Xf(this.privateKey));_y(this,"publicKey","0x"+t.getPublic(!1,"hex")),_y(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),_y(this,"_isSigningKey",!0)}_addPoint(e){const t=pA().keyFromPublic(Xf(this.publicKey)),n=pA().keyFromPublic(Xf(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const t=pA().keyFromPrivate(Xf(this.privateKey)),n=Xf(e);32!==n.length&&dA.throwArgumentError("bad digest length","digest",e);const r=t.sign(n,{canonical:!0});return cy({recoveryParam:r.recoveryParam,r:uy("0x"+r.r.toString(16),32),s:uy("0x"+r.s.toString(16),32)})}computeSharedSecret(e){const t=pA().keyFromPrivate(Xf(this.privateKey)),n=pA().keyFromPublic(Xf(yA(e)));return uy("0x"+t.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function yA(e,t){const n=Xf(e);if(32===n.length){const e=new fA(n);return t?"0x"+pA().keyFromPrivate(n).getPublic(!0,"hex"):e.publicKey}return 33===n.length?t?ry(n):"0x"+pA().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?t?"0x"+pA().keyFromPublic(n).getPublic(!0,"hex"):ry(n):dA.throwArgumentError("invalid public or private key","key","[REDACTED]")}const mA=new Ff("transactions/5.7.0");var gA;function vA(e){return"0x"===e?null:Om(e)}function wA(e){return"0x"===e?qm:my.from(e)}function bA(e,t){return function(e){return Om(oy(Mm(oy(yA(e),1)),12))}(function(e,t){const n=cy(t),r={r:Xf(n.r),s:Xf(n.s)};return"0x"+pA().recoverPubKey(Xf(e),r,n.recoveryParam).encode("hex",!1)}(Xf(e),t))}function MA(e,t){const n=$f(my.from(e).toHexString());return n.length>32&&mA.throwArgumentError("invalid length for "+t,"transaction:"+t,e),n}function AA(e,t){return{address:Om(e),storageKeys:(t||[]).map(((t,n)=>(32!==iy(t)&&mA.throwArgumentError("invalid access list storageKey",`accessList[${e}:${n}]`,t),t.toLowerCase())))}}function EA(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&mA.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),AA(e[0],e[1])):AA(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const n=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return AA(t,Object.keys(n).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function NA(e){return EA(e).map((e=>[e.address,e.storageKeys]))}function TA(e,t){if(null!=e.gasPrice){const t=my.from(e.gasPrice),n=my.from(e.maxFeePerGas||0);t.eq(n)||mA.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:n})}const n=[MA(e.chainId||0,"chainId"),MA(e.nonce||0,"nonce"),MA(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),MA(e.maxFeePerGas||0,"maxFeePerGas"),MA(e.gasLimit||0,"gasLimit"),null!=e.to?Om(e.to):"0x",MA(e.value||0,"value"),e.data||"0x",NA(e.accessList||[])];if(t){const e=cy(t);n.push(MA(e.recoveryParam,"recoveryParam")),n.push($f(e.r)),n.push($f(e.s))}return ay(["0x02",Im(n)])}function IA(e,t){const n=[MA(e.chainId||0,"chainId"),MA(e.nonce||0,"nonce"),MA(e.gasPrice||0,"gasPrice"),MA(e.gasLimit||0,"gasLimit"),null!=e.to?Om(e.to):"0x",MA(e.value||0,"value"),e.data||"0x",NA(e.accessList||[])];if(t){const e=cy(t);n.push(MA(e.recoveryParam,"recoveryParam")),n.push($f(e.r)),n.push($f(e.s))}return ay(["0x01",Im(n)])}function kA(e,t,n){try{const n=wA(t[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");e.v=n}catch(e){mA.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=uy(t[1],32),e.s=uy(t[2],32);try{const t=Mm(n(e));e.from=bA(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function LA(e){const t=Xf(e);if(t[0]>127)return function(e){const t=xm(e);9!==t.length&&6!==t.length&&mA.throwArgumentError("invalid raw transaction","rawTransaction",e);const n={nonce:wA(t[0]).toNumber(),gasPrice:wA(t[1]),gasLimit:wA(t[2]),to:vA(t[3]),value:wA(t[4]),data:t[5],chainId:0};if(6===t.length)return n;try{n.v=my.from(t[6]).toNumber()}catch(e){return n}if(n.r=uy(t[7],32),n.s=uy(t[8],32),my.from(n.r).isZero()&&my.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=t.slice(0,6);0!==n.chainId&&(i.push(ry(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);const o=Mm(Im(i));try{n.from=bA(o,{r:ry(n.r),s:ry(n.s),recoveryParam:r})}catch(e){}n.hash=Mm(e)}return n.type=null,n}(t);switch(t[0]){case 1:return function(e){const t=xm(e.slice(1));8!==t.length&&11!==t.length&&mA.throwArgumentError("invalid component count for transaction type: 1","payload",ry(e));const n={type:1,chainId:wA(t[0]).toNumber(),nonce:wA(t[1]).toNumber(),gasPrice:wA(t[2]),gasLimit:wA(t[3]),to:vA(t[4]),value:wA(t[5]),data:t[6],accessList:EA(t[7])};return 8===t.length||(n.hash=Mm(e),kA(n,t.slice(8),IA)),n}(t);case 2:return function(e){const t=xm(e.slice(1));9!==t.length&&12!==t.length&&mA.throwArgumentError("invalid component count for transaction type: 2","payload",ry(e));const n=wA(t[2]),r=wA(t[3]),i={type:2,chainId:wA(t[0]).toNumber(),nonce:wA(t[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:wA(t[4]),to:vA(t[5]),value:wA(t[6]),data:t[7],accessList:EA(t[8])};return 9===t.length||(i.hash=Mm(e),kA(i,t.slice(9),TA)),i}(t)}return mA.throwError(`unsupported transaction type: ${t[0]}`,Ff.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(gA||(gA={}));var xA=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const SA=new Ff("contracts/5.7.0");function jA(e,t){return xA(this,void 0,void 0,(function*(){const n=yield t;"string"!=typeof n&&SA.throwArgumentError("invalid address or ENS name","name",n);try{return Om(n)}catch(e){}e||SA.throwError("a provider or signer is needed to resolve ENS names",Ff.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield e.resolveName(n);return null==r&&SA.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r}))}function CA(e,t,n){return xA(this,void 0,void 0,(function*(){return Array.isArray(n)?yield Promise.all(n.map(((n,r)=>CA(e,Array.isArray(t)?t[r]:t[n.name],n)))):"address"===n.type?yield jA(e,t):"tuple"===n.type?yield CA(e,t,n.components):"array"===n.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>CA(e,t,n.arrayChildren)))):Promise.reject(SA.makeError("invalid value for array",Ff.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function DA(e,t,n){return xA(this,void 0,void 0,(function*(){let r={};n.length===t.inputs.length+1&&"object"==typeof n[n.length-1]&&(r=By(n.pop())),SA.checkArgumentCount(n.length,t.inputs.length,"passed to contract"),e.signer?r.from?r.from=Ry({override:jA(e.signer,r.from),signer:e.signer.getAddress()}).then((e=>xA(this,void 0,void 0,(function*(){return Om(e.signer)!==e.override&&SA.throwError("Contract with a Signer cannot override from",Ff.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):r.from=e.signer.getAddress():r.from&&(r.from=jA(e.provider,r.from));const i=yield Ry({args:CA(e.signer||e.provider,n,t.inputs),address:e.resolvedAddress,overrides:Ry(r)||{}}),o=e.interface.encodeFunctionData(t,i.args),a={data:o,to:i.address},s=i.overrides;if(null!=s.nonce&&(a.nonce=my.from(s.nonce).toNumber()),null!=s.gasLimit&&(a.gasLimit=my.from(s.gasLimit)),null!=s.gasPrice&&(a.gasPrice=my.from(s.gasPrice)),null!=s.maxFeePerGas&&(a.maxFeePerGas=my.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=my.from(s.maxPriorityFeePerGas)),null!=s.from&&(a.from=s.from),null!=s.type&&(a.type=s.type),null!=s.accessList&&(a.accessList=EA(s.accessList)),null==a.gasLimit&&null!=t.gas){let e=21e3;const n=Xf(o);for(let t=0;t<n.length;t++)e+=4,n[t]&&(e+=64);a.gasLimit=my.from(t.gas).add(e)}if(s.value){const e=my.from(s.value);e.isZero()||t.payable||SA.throwError("non-payable method cannot override value",Ff.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:r.value}),a.value=e}s.customData&&(a.customData=By(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((e=>null!=r[e]));return u.length&&SA.throwError(`cannot override ${u.map((e=>JSON.stringify(e))).join(",")}`,Ff.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),a}))}function OA(e,t,n){const r=e.signer||e.provider;return function(...i){return xA(this,void 0,void 0,(function*(){let o;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=By(i.pop());null!=e.blockTag&&(o=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(o));const a=yield DA(e,t,i),s=yield r.call(a,o);try{let r=e.interface.decodeFunctionResult(t,s);return n&&1===t.outputs.length&&(r=r[0]),r}catch(t){throw t.code===Ff.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=a),t}}))}}function zA(e,t){return function(...n){return xA(this,void 0,void 0,(function*(){e.signer||SA.throwError("sending a transaction requires a signer",Ff.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const r=yield DA(e,t,n),i=yield e.signer.sendTransaction(r);return function(e,t){const n=t.wait.bind(t);t.wait=t=>n(t).then((t=>(t.events=t.logs.map((n=>{let r=Yy(n),i=null;try{i=e.interface.parseLog(n)}catch(e){}return i&&(r.args=i.args,r.decode=(t,n)=>e.interface.decodeEventLog(i.eventFragment,t,n),r.event=i.name,r.eventSignature=i.signature),r.removeListener=()=>e.provider,r.getBlock=()=>e.provider.getBlock(t.blockHash),r.getTransaction=()=>e.provider.getTransaction(t.transactionHash),r.getTransactionReceipt=()=>Promise.resolve(t),r})),t)))}(e,i),i}))}}function _A(e,t,n){return t.constant?OA(e,t,n):zA(e,t)}function PA(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.map((e=>Array.isArray(e)?e.join("|"):e)).join(":"):""):"*"}class RA{constructor(e,t){_y(this,"tag",e),_y(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter((n=>!(!t&&n.listener===e)||(t=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((e=>e.listener))}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter((t=>{const n=e.slice();return setTimeout((()=>{t.listener.apply(this,n)}),0),!t.once})),t}prepareEvent(e){}getEmit(e){return[e]}}class BA extends RA{constructor(){super("error",null)}}class UA extends RA{constructor(e,t,n,r){const i={address:e};let o=t.getEventTopic(n);r?(o!==r[0]&&SA.throwArgumentError("topic mismatch","topics",r),i.topics=r.slice()):i.topics=[o],super(PA(i),i),_y(this,"address",e),_y(this,"interface",t),_y(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=function(e){const t=[],n=function(e,r){if(Array.isArray(r))for(let i in r){const o=e.slice();o.push(i);try{n(o,r[i])}catch(e){t.push({path:o,error:e})}}};return n([],e),t}(e.args);if(t.length)throw t[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class WA extends RA{constructor(e,t){super("*",{address:e}),_y(this,"address",e),_y(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,n)=>this.interface.decodeEventLog(t.eventFragment,e,n),e.args=t.args}catch(e){}}}class QA{constructor(e,t,n){_y(this,"interface",Py(new.target,"getInterface")(t)),null==n?(_y(this,"provider",null),_y(this,"signer",null)):bv.isSigner(n)?(_y(this,"provider",n.provider||null),_y(this,"signer",n)):yv.isProvider(n)?(_y(this,"provider",n),_y(this,"signer",null)):SA.throwArgumentError("invalid signer or provider","signerOrProvider",n),_y(this,"callStatic",{}),_y(this,"estimateGas",{}),_y(this,"functions",{}),_y(this,"populateTransaction",{}),_y(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const n=this.interface.events[t];_y(this.filters,t,((...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(n,e)}))),e[n.name]||(e[n.name]=[]),e[n.name].push(t)})),Object.keys(e).forEach((t=>{const n=e[t];1===n.length?_y(this.filters,t,this.filters[n[0]]):SA.warn(`Duplicate definition of ${t} (${n.join(", ")})`)}))}if(_y(this,"_runningEvents",{}),_y(this,"_wrappedEmits",{}),null==e&&SA.throwArgumentError("invalid contract address or ENS name","addressOrName",e),_y(this,"address",e),this.provider)_y(this,"resolvedAddress",jA(this.provider,e));else try{_y(this,"resolvedAddress",Promise.resolve(Om(e)))}catch(e){SA.throwError("provider is required to use ENS name as contract address",Ff.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((e=>{}));const r={},i={};Object.keys(this.interface.functions).forEach((e=>{const t=this.interface.functions[e];if(i[e])SA.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{i[e]=!0;{const n=t.name;r[`%${n}`]||(r[`%${n}`]=[]),r[`%${n}`].push(e)}null==this[e]&&_y(this,e,_A(this,t,!0)),null==this.functions[e]&&_y(this.functions,e,_A(this,t,!1)),null==this.callStatic[e]&&_y(this.callStatic,e,OA(this,t,!0)),null==this.populateTransaction[e]&&_y(this.populateTransaction,e,function(e,t){return function(...n){return DA(e,t,n)}}(this,t)),null==this.estimateGas[e]&&_y(this.estimateGas,e,function(e,t){const n=e.signer||e.provider;return function(...r){return xA(this,void 0,void 0,(function*(){n||SA.throwError("estimate require a provider or signer",Ff.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield DA(e,t,r);return yield n.estimateGas(i)}))}}(this,t))}})),Object.keys(r).forEach((e=>{const t=r[e];if(t.length>1)return;e=e.substring(1);const n=t[0];try{null==this[e]&&_y(this,e,this[n])}catch(e){}null==this.functions[e]&&_y(this.functions,e,this.functions[n]),null==this.callStatic[e]&&_y(this.callStatic,e,this.callStatic[n]),null==this.populateTransaction[e]&&_y(this.populateTransaction,e,this.populateTransaction[n]),null==this.estimateGas[e]&&_y(this.estimateGas,e,this.estimateGas[n])}))}static getContractAddress(e){return zm(e)}static getInterface(e){return dv.isInterface(e)?e:new dv(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,e).then((e=>("0x"===e&&SA.throwError("contract not deployed",Ff.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||SA.throwError("sending a transactions require a signer",Ff.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=By(e||{});return["from","to"].forEach((function(e){null!=t[e]&&SA.throwError("cannot override "+e,Ff.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new Mv(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&_y(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return uv.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new BA);if("event"===e)return this._normalizeRunningEvent(new RA("event",null));if("*"===e)return this._normalizeRunningEvent(new WA(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new UA(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const t=e.topics[0];if("string"!=typeof t)throw new Error("invalid topic");const n=this.interface.getEvent(t);return this._normalizeRunningEvent(new UA(this.address,this.interface,n,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new RA(PA(t),t))}return this._normalizeRunningEvent(new WA(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,n){const r=Yy(t);return r.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},r.getBlock=()=>this.provider.getBlock(t.blockHash),r.getTransaction=()=>this.provider.getTransaction(t.transactionHash),r.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(r),r}_addEventListener(e,t,n){if(this.provider||SA.throwError("events require a provider or a signer with a provider",Ff.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const n=n=>{let r=this._wrapEvent(e,n,t);if(null==r.decodeError)try{const t=e.getEmit(r);this.emit(e.filter,...t)}catch(e){r.decodeError=e.error}null!=e.filter&&this.emit("event",r),null!=r.decodeError&&this.emit("error",r.decodeError,r)};this._wrappedEmits[e.tag]=n,null!=e.filter&&this.provider.on(e.filter,n)}}queryFilter(e,t,n){const r=this._getRunningEvent(e),i=By(r.filter);return"string"==typeof t&&ty(t,32)?(null!=n&&SA.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=n?n:"latest"),this.provider.getLogs(i).then((e=>e.map((e=>this._wrapEvent(r,e,null)))))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const n=this._getRunningEvent(e),r=n.run(t)>0;return this._checkRunningEvents(n),r}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce(((e,t)=>e+this._runningEvents[t].listenerCount()),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){const e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach((t=>{e.push(t)}));return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(const e in this._runningEvents){const t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(t),this._checkRunningEvents(n),this}removeListener(e,t){return this.off(e,t)}}class YA extends QA{}class FA{constructor(e){_y(this,"alphabet",e),_y(this,"base",e.length),_y(this,"_alphabetMap",{}),_y(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=Xf(e);if(0===t.length)return"";let n=[0];for(let e=0;e<t.length;++e){let r=t[e];for(let e=0;e<n.length;++e)r+=n[e]<<8,n[e]=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 e=0;0===t[e]&&e<t.length-1;++e)r+=this._leader;for(let e=n.length-1;e>=0;--e)r+=this.alphabet[n[e]];return r}decode(e){if("string"!=typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let n=0;n<e.length;n++){let r=this._alphabetMap[e[n]];if(void 0===r)throw new Error("Non-base"+this.base+" character");let i=r;for(let e=0;e<t.length;++e)i+=t[e]*this.base,t[e]=255&i,i>>=8;for(;i>0;)t.push(255&i),i>>=8}for(let n=0;e[n]===this._leader&&n<e.length-1;++n)t.push(0);return Xf(new Uint8Array(t.reverse()))}}new FA("abcdefghijklmnopqrstuvwxyz234567");const VA=new FA("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function HA(e){return"0x"+LM.sha256().update(Xf(e)).digest("hex")}new Ff("sha2/5.7.0");const GA=new Ff("networks/5.7.1");function qA(e){const t=function(t,n){null==n&&(n={});const r=[];if(t.InfuraProvider&&"-"!==n.infura)try{r.push(new t.InfuraProvider(e,n.infura))}catch(e){}if(t.EtherscanProvider&&"-"!==n.etherscan)try{r.push(new t.EtherscanProvider(e,n.etherscan))}catch(e){}if(t.AlchemyProvider&&"-"!==n.alchemy)try{r.push(new t.AlchemyProvider(e,n.alchemy))}catch(e){}if(t.PocketProvider&&"-"!==n.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(e,n.pocket);o.network&&-1===i.indexOf(o.network.name)&&r.push(o)}catch(e){}}if(t.CloudflareProvider&&"-"!==n.cloudflare)try{r.push(new t.CloudflareProvider(e))}catch(e){}if(t.AnkrProvider&&"-"!==n.ankr)try{const i=["ropsten"],o=new t.AnkrProvider(e,n.ankr);o.network&&-1===i.indexOf(o.network.name)&&r.push(o)}catch(e){}if(0===r.length)return null;if(t.FallbackProvider){let i=1;return null!=n.quorum?i=n.quorum:"homestead"===e&&(i=2),new t.FallbackProvider(r,i)}return r[0]};return t.renetwork=function(e){return qA(e)},t}function ZA(e,t){const n=function(n,r){return n.JsonRpcProvider?new n.JsonRpcProvider(e,t):null};return n.renetwork=function(t){return ZA(e,t)},n}const JA={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:qA("homestead")},XA={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:qA("ropsten")},KA={chainId:63,name:"classicMordor",_defaultProvider:ZA("https://www.ethercluster.com/mordor","classicMordor")},$A={unspecified:{chainId:0,name:"unspecified"},homestead:JA,mainnet:JA,morden:{chainId:2,name:"morden"},ropsten:XA,testnet:XA,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:qA("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:qA("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:qA("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:qA("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ZA("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:KA,classicTestnet:KA,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ZA("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:qA("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:qA("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 eE=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};function tE(e,t){return eE(this,void 0,void 0,(function*(){null==t&&(t={});const n={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(n.mode=e.mode),e.cache&&(n.cache=e.cache),e.credentials&&(n.credentials=e.credentials),e.redirect&&(n.redirect=e.redirect),e.referrer&&(n.referrer=e.referrer)}const r=yield fetch(e,n),i=yield r.arrayBuffer(),o={};return r.headers.forEach?r.headers.forEach(((e,t)=>{o[t.toLowerCase()]=e})):r.headers.keys().forEach((e=>{o[e.toLowerCase()]=r.headers.get(e)})),{headers:o,statusCode:r.status,statusMessage:r.statusText,body:Xf(new Uint8Array(i))}}))}var nE=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const rE=new Ff("web/5.7.1");function iE(e){return new Promise((t=>{setTimeout(t,e)}))}function oE(e,t){if(null==e)return null;if("string"==typeof e)return e;if(qf(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return og(e)}catch(e){}return ry(e)}return e}function aE(e,t,n){let r=null;if(null!=t){r=ig(t);const n="string"==typeof e?{url:e}:By(e);if(n.headers){0!==Object.keys(n.headers).filter((e=>"content-type"===e.toLowerCase())).length||(n.headers=By(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};e=n}return function(e,t,n){const r="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;rE.assertArgument(r>0&&r%1==0,"invalid connection throttle limit","connection.throttleLimit",r);const i="object"==typeof e?e.throttleCallback:null,o="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;rE.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const a="object"==typeof e&&!!e.errorPassThrough,s={};let u=null;const c={method:"GET"};let l=!1,d=12e4;if("string"==typeof e)u=e;else if("object"==typeof e){if(null!=e&&null!=e.url||rE.throwArgumentError("missing URL","connection.url",e),u=e.url,"number"==typeof e.timeout&&e.timeout>0&&(d=e.timeout),e.headers)for(const t in e.headers)s[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(l=!0);if(c.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==u.substring(0,6)&&!0!==e.allowInsecureAuthentication&&rE.throwError("basic authentication requires a secure https url",Ff.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;s.authorization={key:"Authorization",value:"Basic "+yg(ig(t))}}null!=e.skipFetchSetup&&(c.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(c.fetchOptions=By(e.fetchOptions))}const h=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),p=u?u.match(h):null;if(p)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":p[1]||"text/plain"},body:p[2]?fg(p[3]):(f=p[3],ig(f.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return n&&(t=n(e.body,e)),Promise.resolve(t)}catch(e){rE.throwError("processing response error",Ff.errors.SERVER_ERROR,{body:oE(p[1],p[2]),error:e,requestBody:null,requestMethod:"GET",url:u})}var f;t&&(c.method="POST",c.body=t,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(t.length)}));const y={};Object.keys(s).forEach((e=>{const t=s[e];y[t.key]=t.value})),c.headers=y;const m=function(){let e=null;return{promise:new Promise((function(t,n){d&&(e=setTimeout((()=>{null!=e&&(e=null,n(rE.makeError("timeout",Ff.errors.TIMEOUT,{requestBody:oE(c.body,y["content-type"]),requestMethod:c.method,timeout:d,url:u})))}),d))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),g=function(){return nE(this,void 0,void 0,(function*(){for(let e=0;e<r;e++){let t=null;try{if(t=yield tE(u,c),e<r)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===c.method&&e.match(/^https:/)){u=t.headers.location;continue}}else if(429===t.statusCode){let n=!0;if(i&&(n=yield i(e,u)),n){let n=0;const r=t.headers["retry-after"];n="string"==typeof r&&r.match(/^[1-9][0-9]*$/)?1e3*parseInt(r):o*parseInt(String(Math.random()*Math.pow(2,e))),yield iE(n);continue}}}catch(e){t=e.response,null==t&&(m.cancel(),rE.throwError("missing response",Ff.errors.SERVER_ERROR,{requestBody:oE(c.body,y["content-type"]),requestMethod:c.method,serverError:e,url:u}))}let s=t.body;if(l&&304===t.statusCode?s=null:!a&&(t.statusCode<200||t.statusCode>=300)&&(m.cancel(),rE.throwError("bad response",Ff.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:oE(s,t.headers?t.headers["content-type"]:null),requestBody:oE(c.body,y["content-type"]),requestMethod:c.method,url:u})),n)try{const e=yield n(s,t);return m.cancel(),e}catch(n){if(n.throttleRetry&&e<r){let t=!0;if(i&&(t=yield i(e,u)),t){const t=o*parseInt(String(Math.random()*Math.pow(2,e)));yield iE(t);continue}}m.cancel(),rE.throwError("processing response error",Ff.errors.SERVER_ERROR,{body:oE(s,t.headers?t.headers["content-type"]:null),error:n,requestBody:oE(c.body,y["content-type"]),requestMethod:c.method,url:u})}return m.cancel(),s}return rE.throwError("failed response",Ff.errors.SERVER_ERROR,{requestBody:oE(c.body,y["content-type"]),requestMethod:c.method,url:u})}))}();return Promise.race([m.promise,g])}(e,r,((e,t)=>{let r=null;if(null!=e)try{r=JSON.parse(og(e))}catch(t){rE.throwError("invalid JSON",Ff.errors.SERVER_ERROR,{body:e,error:t})}return n&&(r=n(r,t)),r}))}function sE(e,t){return t||(t={}),null==(t=By(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(n,r){let i=null,o=!1;const a=()=>!o&&(o=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{a()&&r(new Error("timeout"))}),t.timeout));const s=t.retryLimit;let u=0;!function i(){return e().then((function(e){if(void 0!==e)a()&&n(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!o){if(u++,u>s)return void(a()&&r(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,u)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){a()&&r(e)}))}()}))}for(var uE="qpzry9x8gf2tvdw0s3jn54khce6mua7l",cE={},lE=0;lE<32;lE++){var dE=uE.charAt(lE);if(void 0!==cE[dE])throw new TypeError(dE+" is ambiguous");cE[dE]=lE}function hE(e){var t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function pE(e){for(var t=1,n=0;n<e.length;++n){var r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=hE(t)^r>>5}for(t=hE(t),n=0;n<e.length;++n){var i=e.charCodeAt(n);t=hE(t)^31&i}return t}function fE(e,t){if(t=t||90,e.length<8)return e+" too short";if(e.length>t)return"Exceeds length limit";var n=e.toLowerCase(),r=e.toUpperCase();if(e!==n&&e!==r)return"Mixed-case string "+e;var i=(e=n).lastIndexOf("1");if(-1===i)return"No separator character for "+e;if(0===i)return"Missing prefix for "+e;var o=e.slice(0,i),a=e.slice(i+1);if(a.length<6)return"Data too short";var s=pE(o);if("string"==typeof s)return s;for(var u=[],c=0;c<a.length;++c){var l=a.charAt(c),d=cE[l];if(void 0===d)return"Unknown character "+l;s=hE(s)^d,c+6>=a.length||u.push(d)}return 1!==s?"Invalid checksum for "+e:{prefix:o,words:u}}function yE(e,t,n,r){for(var i=0,o=0,a=(1<<n)-1,s=[],u=0;u<e.length;++u)for(i=i<<t|e[u],o+=t;o>=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<<n-o&a);else{if(o>=t)return"Excess padding";if(i<<n-o&a)return"Non-zero padding"}return s}var mE={decodeUnsafe:function(){var e=fE.apply(null,arguments);if("object"==typeof e)return e},decode:function(e){var t=fE.apply(null,arguments);if("object"==typeof t)return t;throw new Error(t)},encode:function(e,t,n){if(n=n||90,e.length+7+t.length>n)throw new TypeError("Exceeds length limit");var r=pE(e=e.toLowerCase());if("string"==typeof r)throw new Error(r);for(var i=e+"1",o=0;o<t.length;++o){var a=t[o];if(a>>5!=0)throw new Error("Non 5-bit word");r=hE(r)^a,i+=uE.charAt(a)}for(o=0;o<6;++o)r=hE(r);for(r^=1,o=0;o<6;++o){i+=uE.charAt(r>>5*(5-o)&31)}return i},toWordsUnsafe:function(e){var t=yE(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=yE(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=yE(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=yE(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}};const gE="providers/5.7.2",vE=new Ff(gE);class wE{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=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 e.transaction={hash:o,type:u,accessList:wE.allowNull(this.accessList.bind(this),null),blockHash:wE.allowNull(o,null),blockNumber:wE.allowNull(s,null),transactionIndex:wE.allowNull(s,null),confirmations:wE.allowNull(s,null),from:t,gasPrice:wE.allowNull(n),maxPriorityFeePerGas:wE.allowNull(n),maxFeePerGas:wE.allowNull(n),gasLimit:n,to:wE.allowNull(t,null),value:n,nonce:s,data:i,r:wE.allowNull(this.uint256),s:wE.allowNull(this.uint256),v:wE.allowNull(s),creates:wE.allowNull(t,null),raw:wE.allowNull(i)},e.transactionRequest={from:wE.allowNull(t),nonce:wE.allowNull(s),gasLimit:wE.allowNull(n),gasPrice:wE.allowNull(n),maxPriorityFeePerGas:wE.allowNull(n),maxFeePerGas:wE.allowNull(n),to:wE.allowNull(t),value:wE.allowNull(n),data:wE.allowNull((e=>this.data(e,!0))),type:wE.allowNull(s),accessList:wE.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:s,blockNumber:s,transactionHash:o,address:t,topics:wE.arrayOf(o),data:i,logIndex:s,blockHash:o},e.receipt={to:wE.allowNull(this.address,null),from:wE.allowNull(this.address,null),contractAddress:wE.allowNull(t,null),transactionIndex:s,root:wE.allowNull(a),gasUsed:n,logsBloom:wE.allowNull(i),blockHash:o,transactionHash:o,logs:wE.arrayOf(this.receiptLog.bind(this)),blockNumber:s,confirmations:wE.allowNull(s,null),cumulativeGasUsed:n,effectiveGasPrice:wE.allowNull(n),status:wE.allowNull(s),type:u},e.block={hash:wE.allowNull(o),parentHash:o,number:s,timestamp:s,nonce:wE.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:wE.allowNull(t),extraData:i,transactions:wE.allowNull(wE.arrayOf(o)),baseFeePerGas:wE.allowNull(n)},e.blockWithTransactions=By(e.block),e.blockWithTransactions.transactions=wE.allowNull(wE.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:wE.allowNull(r,void 0),toBlock:wE.allowNull(r,void 0),blockHash:wE.allowNull(o,void 0),address:wE.allowNull(t,void 0),topics:wE.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:wE.allowNull(s),blockHash:wE.allowNull(o),transactionIndex:s,removed:wE.allowNull(this.boolean.bind(this)),address:t,data:wE.allowFalsish(i,"0x"),topics:wE.arrayOf(o),transactionHash:o,logIndex:s},e}accessList(e){return EA(e||[])}number(e){return"0x"===e?0:my.from(e).toNumber()}type(e){return"0x"===e||null==e?0:my.from(e).toNumber()}bigNumber(e){return my.from(e)}boolean(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),ty(e))?e.toLowerCase():vE.throwArgumentError("invalid hash","value",e)}data(e,t){const n=this.hex(e,t);if(n.length%2!=0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return Om(e)}callAddress(e){if(!ty(e,32))return null;const t=Om(oy(e,12));return"0x0000000000000000000000000000000000000000"===t?null:t}contractAddress(e){return zm(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"==typeof e||ty(e))return sy(e);throw new Error("invalid blockTag")}hash(e,t){const n=this.hex(e,t);return 32!==iy(n)?vE.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(null==e)return null;const t=my.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!ty(e))throw new Error("invalid uint256");return uy(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const n=null!=e._difficulty?e._difficulty:e.difficulty,r=wE.check(t,e);return r._difficulty=null==n?null:my.from(n),r}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return wE.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&my.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=wE.check(this.formats.transaction,e);if(null!=e.chainId){let n=e.chainId;ty(n)&&(n=my.from(n).toNumber()),t.chainId=n}else{let n=e.networkId;null==n&&null==t.v&&(n=e.chainId),ty(n)&&(n=my.from(n).toNumber()),"number"!=typeof n&&null!=t.v&&(n=(t.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!=typeof n&&(n=0),t.chainId=n}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return LA(e)}receiptLog(e){return wE.check(this.formats.receiptLog,e)}receipt(e){const t=wE.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=my.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&vE.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):vE.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&vE.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map((e=>this.topics(e))):null!=e?this.hash(e,!0):null}filter(e){return wE.check(this.formats.filter,e)}filterLog(e){return wE.check(this.formats.filterLog,e)}static check(e,t){const n={};for(const r in e)try{const i=e[r](t[r]);void 0!==i&&(n[r]=i)}catch(e){throw e.checkKey=r,e.checkValue=t[r],e}return n}static allowNull(e,t){return function(n){return null==n?t:e(n)}}static allowFalsish(e,t){return function(n){return n?e(n):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const n=[];return t.forEach((function(t){n.push(e(t))})),n}}}var bE=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const ME=new Ff(gE);function AE(e){return null==e?"null":(32!==iy(e)&&ME.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function EE(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((e=>{if(Array.isArray(e)){const t={};e.forEach((e=>{t[AE(e)]=!0}));const n=Object.keys(t);return n.sort(),n.join("|")}return AE(e)})).join("&")}function NE(e){if("string"==typeof e){if(32===iy(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+EE(e);if(fv.isForkEvent(e))throw ME.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+EE(e.topics||[])}throw new Error("invalid event - "+e)}function TE(){return(new Date).getTime()}function IE(e){return new Promise((t=>{setTimeout(t,e)}))}const kE=["block","network","pending","poll"];class LE{constructor(e,t,n){_y(this,"tag",e),_y(this,"listener",t),_y(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 e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],n=""===(r=e[2])?[]:r.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}));var r;const i={};return n.length>0&&(i.topics=n),t&&"*"!==t&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||kE.indexOf(this.tag)>=0}}const xE={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 SE(e){return uy(my.from(e).toHexString(),32)}function jE(e){return VA.encode(Kf([e,oy(HA(HA(e)),0,4)]))}const CE=new RegExp("^(ipfs)://(.*)$","i"),DE=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),CE,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function OE(e,t){try{return og(zE(e,t))}catch(e){}return null}function zE(e,t){if("0x"===e)return null;const n=my.from(oy(e,t,t+32)).toNumber(),r=my.from(oy(e,n,n+32)).toNumber();return oy(e,n+32,n+32+r)}function _E(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):ME.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function PE(e){const t=Xf(e);if(t.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(t,32-t.length),n}function RE(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function BE(e){const t=[];let n=0;for(let r=0;r<e.length;r++)t.push(null),n+=32;for(let r=0;r<e.length;r++){const i=Xf(e[r]);t[r]=PE(n),t.push(PE(i.length)),t.push(RE(i)),n+=32+32*Math.ceil(i.length/32)}return ay(t)}class UE{constructor(e,t,n,r){_y(this,"provider",e),_y(this,"name",n),_y(this,"address",e.formatter.address(t)),_y(this,"_resolvedAddress",r)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then((e=>my.from(e).eq(1))).catch((e=>{if(e.code===Ff.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return bE(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:ay([e,Wg(this.name),t||"0x"])};let r=!1;var i;(yield this.supportsWildcard())&&(r=!0,n.data=ay(["0x9061b923",BE([(i=this.name,ry(Kf(Ug(i).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"),n.data])]));try{let e=yield this.provider.call(n);return Xf(e).length%32==4&&ME.throwError("resolver threw error",Ff.errors.CALL_EXCEPTION,{transaction:n,data:e}),r&&(e=zE(e,0)),e}catch(e){if(e.code===Ff.errors.CALL_EXCEPTION)return null;throw e}}))}_fetchBytes(e,t){return bE(this,void 0,void 0,(function*(){const n=yield this._fetch(e,t);return null!=n?zE(n,0):null}))}_getAddress(e,t){const n=xE[String(e)];if(null==n&&ME.throwError(`unsupported coin type: ${e}`,Ff.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===n.ilk)return this.provider.formatter.address(t);const r=Xf(t);if(null!=n.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return jE(Kf([[n.p2pkh],"0x"+e[2]]))}}if(null!=n.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return jE(Kf([[n.p2sh],"0x"+e[2]]))}}if(null!=n.prefix){const e=r[1];let t=r[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&r.length===2+e&&e>=1&&e<=75){const e=mE.toWords(r.slice(2));return e.unshift(t),mE.encode(n.prefix,e)}}return null}getAddress(e){return bE(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===Ff.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",SE(e));if(null==t||"0x"===t)return null;const n=this._getAddress(e,t);return null==n&&ME.throwError("invalid or unsupported coin data",Ff.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),n}))}getAvatar(){return bE(this,void 0,void 0,(function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let n=0;n<DE.length;n++){const r=t.match(DE[n]);if(null==r)continue;const i=r[1].toLowerCase();switch(i){case"https":return e.push({type:"url",content:t}),{linkage:e,url:t};case"data":return e.push({type:"data",content:t}),{linkage:e,url:t};case"ipfs":return e.push({type:"ipfs",content:t}),{linkage:e,url:_E(t)};case"erc721":case"erc1155":{const n="erc721"===i?"0xc87b56dd":"0x0e89341c";e.push({type:i,content:t});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=uy(my.from(a[1]).toHexString(),32);if("erc721"===i){const t=this.provider.formatter.callAddress(yield this.provider.call({to:s,data:ay(["0x6352211e",u])}));if(o!==t)return null;e.push({type:"owner",content:t})}else if("erc1155"===i){const t=my.from(yield this.provider.call({to:s,data:ay(["0x00fdd58e",uy(o,32),u])}));if(t.isZero())return null;e.push({type:"balance",content:t.toString()})}const c={to:this.provider.formatter.address(a[0]),data:ay([n,u])};let l=OE(yield this.provider.call(c),0);if(null==l)return null;e.push({type:"metadata-url-base",content:l}),"erc1155"===i&&(l=l.replace("{id}",u.substring(2)),e.push({type:"metadata-url-expanded",content:l})),l.match(/^ipfs:/i)&&(l=_E(l)),e.push({type:"metadata-url",content:l});const d=yield aE(l);if(!d)return null;e.push({type:"metadata",content:JSON.stringify(d)});let h=d.image;if("string"!=typeof h)return null;if(h.match(/^(https:\/\/|data:)/i));else{if(null==h.match(CE))return null;e.push({type:"url-ipfs",content:h}),h=_E(h)}return e.push({type:"url",content:h}),{linkage:e,url:h}}}}}catch(e){}return null}))}getContentHash(){return bE(this,void 0,void 0,(function*(){const e=yield this._fetchBytes("0xbc1c58d1");if(null==e||"0x"===e)return null;const t=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const e=parseInt(t[3],16);if(t[4].length===2*e)return"ipfs://"+VA.encode("0x"+t[1])}const n=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const e=parseInt(n[3],16);if(n[4].length===2*e)return"ipns://"+VA.encode("0x"+n[1])}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&64===r[1].length)return"bzz://"+r[1];const i=e.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const e={"=":"","+":"-","/":"_"};return"sia://"+yg("0x"+i[1]).replace(/[=+\/]/g,(t=>e[t]))}return ME.throwError("invalid or unsupported content hash data",Ff.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return bE(this,void 0,void 0,(function*(){let t=ig(e);t=Kf([SE(64),SE(t.length),t]),t.length%32!=0&&(t=Kf([t,uy("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",ry(t));return null==n||"0x"===n?null:og(n)}))}}let WE=null,QE=1;class YE extends yv{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),_y(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch((e=>{})),this._ready().catch((e=>{}));else{const t=Py(new.target,"getNetwork")(e);t?(_y(this,"_network",t),this.emit("network",t,null)):ME.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return bE(this,void 0,void 0,(function*(){if(null==this._network){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch(e){}null==e&&(e=yield this.detectNetwork()),e||ME.throwError("no network detected",Ff.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:_y(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return sE((()=>this._ready().then((e=>e),(e=>{if(e.code!==Ff.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==WE&&(WE=new wE),WE}static getNetwork(e){return function(e){if(null==e)return null;if("number"==typeof e){for(const t in $A){const n=$A[t];if(n.chainId===e)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=$A[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=$A[e.name];if(!t)return"number"!=typeof e.chainId&&GA.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&GA.throwArgumentError("network chainId mismatch","network",e);let n=e._defaultProvider||null;var r;return null==n&&t._defaultProvider&&(n=(r=t._defaultProvider)&&"function"==typeof r.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:n}}(null==e?"homestead":e)}ccipReadFetch(e,t,n){return bE(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let e=0;e<n.length;e++){const t=n[e],a=t.replace("{sender}",r).replace("{data}",i),s=t.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:r}),u=yield aE({url:a,errorPassThrough:!0},s,((e,t)=>(e.status=t.statusCode,e)));if(u.data)return u.data;const c=u.message||"unknown error";if(u.status>=400&&u.status<500)return ME.throwError(`response not found during CCIP fetch: ${c}`,Ff.errors.SERVER_ERROR,{url:t,errorMessage:c});o.push(c)}return ME.throwError(`error encountered during CCIP fetch: ${o.map((e=>JSON.stringify(e))).join(", ")}`,Ff.errors.SERVER_ERROR,{urls:n,errorMessages:o})}))}_getInternalBlockNumber(e){return bE(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const n=yield t;if(TE()-n.respTime<=e)return n.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=TE(),n=Ry({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=TE();return(e=my.from(e).toNumber())<this._maxInternalBlockNumber&&(e=this._maxInternalBlockNumber),this._maxInternalBlockNumber=e,this._setFastBlockNumber(e),{blockNumber:e,reqTime:t,respTime:i}}));return this._internalBlockNumber=n,n.catch((e=>{this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return bE(this,void 0,void 0,(function*(){const e=QE++,t=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)ME.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",ME.makeError("network block skew detected",Ff.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let e=this._emitted.block+1;e<=n;e++)this.emit("block",e);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&n-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((e=>{switch(e.type){case"tx":{const n=e.hash;let r=this.getTransactionReceipt(n).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+n]=e.blockNumber,this.emit(n,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(r);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=n-1);const r=e.filter;r.fromBlock=e._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((t=>{e._inflight=!1,0!==t.length&&t.forEach((t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(r,t)}))})).catch((t=>{this.emit("error",t),e._inflight=!1}));t.push(o)}}})),this._lastBlockNumber=n,Promise.all(t).then((()=>{this.emit("didPoll",e)})).catch((e=>{this.emit("error",e)}))}else this.emit("didPoll",e)}))}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return bE(this,void 0,void 0,(function*(){return ME.throwError("provider does not support network detection",Ff.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return bE(this,void 0,void 0,(function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,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",t,e),yield IE(0),this._network;const n=ME.makeError("underlying network changed",Ff.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",n),n}return e}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((e=>{this._setFastBlockNumber(e)}),(e=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!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))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const e=TE();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=TE(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,n){return bE(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,n||0,null)}))}_waitForTransaction(e,t,n,r){return bE(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,o)=>{const a=[];let s=!1;const u=function(){return!!s||(s=!0,a.forEach((e=>{e()})),!1)},c=e=>{e.confirmations<t||u()||i(e)};if(this.on(e,c),a.push((()=>{this.removeListener(e,c)})),r){let n=r.startBlock,i=null;const c=a=>bE(this,void 0,void 0,(function*(){s||(yield IE(1e3),this.getTransactionCount(r.from).then((l=>bE(this,void 0,void 0,(function*(){if(!s){if(l<=r.nonce)n=a;else{{const t=yield this.getTransaction(e);if(t&&null!=t.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===e)return;if(a.from===r.from&&a.nonce===r.nonce){if(s)return;const n=yield this.waitForTransaction(a.hash,t);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(ME.makeError("transaction was replaced",Ff.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(a),hash:e,receipt:n}))}}i++}}s||this.once("block",c)}}))),(e=>{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 e=setTimeout((()=>{u()||o(ME.makeError("timeout exceeded",Ff.errors.TIMEOUT,{timeout:n}))}),n);e.unref&&e.unref(),a.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return bE(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return bE(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return my.from(e)}catch(t){return ME.throwError("bad result from backend",Ff.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return bE(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Ry({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getBalance",n);try{return my.from(r)}catch(e){return ME.throwError("bad result from backend",Ff.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:e})}}))}getTransactionCount(e,t){return bE(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Ry({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getTransactionCount",n);try{return my.from(r).toNumber()}catch(e){return ME.throwError("bad result from backend",Ff.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:e})}}))}getCode(e,t){return bE(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Ry({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getCode",n);try{return ry(r)}catch(e){return ME.throwError("bad result from backend",Ff.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:e})}}))}getStorageAt(e,t,n){return bE(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield Ry({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(t).then((e=>sy(e)))}),i=yield this.perform("getStorageAt",r);try{return ry(i)}catch(e){return ME.throwError("bad result from backend",Ff.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:e})}}))}_wrapTransaction(e,t,n){if(null!=t&&32!==iy(t))throw new Error("invalid response - sendTransaction");const r=e;return null!=t&&e.hash!==t&&ME.throwError("Transaction hash mismatch from Provider.sendTransaction.",Ff.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),r.wait=(t,r)=>bE(this,void 0,void 0,(function*(){let i;null==t&&(t=1),null==r&&(r=0),0!==t&&null!=n&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const o=yield this._waitForTransaction(e.hash,t,r,i);return null==o&&0===t?null:(this._emitted["t:"+e.hash]=o.blockNumber,0===o.status&&ME.throwError("transaction failed",Ff.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:o}),o)})),r}sendTransaction(e){return bE(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>ry(e))),n=this.formatter.transaction(e);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(n,e,r)}catch(e){throw e.transaction=n,e.transactionHash=n.hash,e}}))}_getTransactionRequest(e){return bE(this,void 0,void 0,(function*(){const t=yield e,n={};return["from","to"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?my.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(n.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?ry(e):null)))})),this.formatter.transactionRequest(yield Ry(n))}))}_getFilter(e){return bE(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((n=>{null!=e[n]&&(t[n]=e[n])})),["fromBlock","toBlock"].forEach((n=>{null!=e[n]&&(t[n]=this._getBlockTag(e[n]))})),this.formatter.filter(yield Ry(t))}))}_call(e,t,n){return bE(this,void 0,void 0,(function*(){n>=10&&ME.throwError("CCIP read exceeded maximum redirections",Ff.errors.SERVER_ERROR,{redirects:n,transaction:e});const r=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(n>=0&&"latest"===t&&null!=r&&"0x556f1830"===i.substring(0,10)&&iy(i)%32==4)try{const o=oy(i,4),a=oy(o,0,32);my.from(a).eq(r)||ME.throwError("CCIP Read sender did not match",Ff.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const s=[],u=my.from(oy(o,32,64)).toNumber(),c=my.from(oy(o,u,u+32)).toNumber(),l=oy(o,u+32);for(let t=0;t<c;t++){const n=OE(l,32*t);null==n&&ME.throwError("CCIP Read contained corrupt URL string",Ff.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i}),s.push(n)}const d=zE(o,64);my.from(oy(o,100,128)).isZero()||ME.throwError("CCIP Read callback selector included junk",Ff.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const h=oy(o,96,100),p=zE(o,128),f=yield this.ccipReadFetch(e,d,s);null==f&&ME.throwError("CCIP Read disabled or provided no URLs",Ff.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const y={to:r,data:ay([h,BE([f,p])])};return this._call(y,t,n+1)}catch(e){if(e.code===Ff.errors.SERVER_ERROR)throw e}try{return ry(i)}catch(n){return ME.throwError("bad result from backend",Ff.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:t},result:i,error:n})}}))}call(e,t){return bE(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield Ry({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(t),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(n.transaction,n.blockTag,n.ccipReadEnabled?0:-1)}))}estimateGas(e){return bE(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Ry({transaction:this._getTransactionRequest(e)}),n=yield this.perform("estimateGas",t);try{return my.from(n)}catch(e){return ME.throwError("bad result from backend",Ff.errors.SERVER_ERROR,{method:"estimateGas",params:t,result:n,error:e})}}))}_getAddress(e){return bE(this,void 0,void 0,(function*(){"string"!=typeof(e=yield e)&&ME.throwArgumentError("invalid address or ENS name","name",e);const t=yield this.resolveName(e);return null==t&&ME.throwError("ENS name not configured",Ff.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),t}))}_getBlock(e,t){return bE(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;let n=-128;const r={includeTransactions:!!t};if(ty(e,32))r.blockHash=e;else try{r.blockTag=yield this._getBlockTag(e),ty(r.blockTag)&&(n=parseInt(r.blockTag.substring(2),16))}catch(t){ME.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return sE((()=>bE(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",r);if(null==e)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(t){let t=null;for(let n=0;n<e.transactions.length;n++){const r=e.transactions[n];if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){null==t&&(t=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let e=t-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}}const n=this.formatter.blockWithTransactions(e);return n.transactions=n.transactions.map((e=>this._wrapTransaction(e))),n}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return bE(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return sE((()=>bE(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(e){return bE(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return sE((()=>bE(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",t);if(null==n)return null==this._emitted["t:"+e]?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 e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return r}))),{oncePoll:this})}))}getLogs(e){return bE(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Ry({filter:this._getFilter(e)}),n=yield this.perform("getLogs",t);return n.forEach((e=>{null==e.removed&&(e.removed=!1)})),wE.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return bE(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return bE(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&ME.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)}))}getResolver(e){return bE(this,void 0,void 0,(function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const n=yield this._getResolver(t,"getResolver");if(null!=n){const r=new UE(this,n,e);return t===e||(yield r.supportsWildcard())?r:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return bE(this,void 0,void 0,(function*(){null==t&&(t="ENS");const n=yield this.getNetwork();n.ensAddress||ME.throwError("network does not support ENS",Ff.errors.UNSUPPORTED_OPERATION,{operation:t,network:n.name});try{const t=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+Wg(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null}))}resolveName(e){return bE(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(ty(e))throw t}"string"!=typeof e&&ME.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return bE(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(t,"lookupAddress");if(null==n)return null;const r=OE(yield this.call({to:n,data:"0x691f3431"+Wg(t).substring(2)}),0);return(yield this.resolveName(r))!=e?null:r}))}getAvatar(e){return bE(this,void 0,void 0,(function*(){let t=null;if(ty(e)){const n=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(n,"getAvatar");if(!r)return null;t=new UE(this,r,n);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==Ff.errors.CALL_EXCEPTION)throw e}try{const e=OE(yield this.call({to:r,data:"0x691f3431"+Wg(n).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==Ff.errors.CALL_EXCEPTION)throw e;return null}}else if(t=yield this.getResolver(e),!t)return null;const n=yield t.getAvatar();return null==n?null:n.url}))}perform(e,t){return ME.throwError(e+" not implemented",Ff.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_stopEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_addEventListener(e,t,n){const r=new LE(NE(e),t,n);return this._events.push(r),this._startEvent(r),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let n=!1,r=[],i=NE(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),n=!0,!e.once||(r.push(e),!1)))),r.forEach((e=>{this._stopEvent(e)})),n}listenerCount(e){if(!e)return this._events.length;let t=NE(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=NE(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const n=[];let r=!1,i=NE(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!r||(r=!0,n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const n=NE(e);this._events=this._events.filter((e=>e.tag!==n||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var FE=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const VE=new Ff(gE),HE=["call","estimateGas"];function GE(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const n=ty(e.data)?e.data:null;if(!t||n)return{message:e.message,data:n}}if("object"==typeof e){for(const n in e){const r=GE(e[n],t);if(r)return r}return null}if("string"==typeof e)try{return GE(JSON.parse(e),t)}catch(e){}return null}function qE(e,t,n){const r=n.transaction||n.signedTransaction;if("call"===e){const e=GE(t,!0);if(e)return e.data;VE.throwError("missing revert data in call exception; Transaction reverted without a reason string",Ff.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:t})}if("estimateGas"===e){let n=GE(t.body,!1);null==n&&(n=GE(t,!1)),n&&VE.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Ff.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:e,transaction:r,error:t})}let i=t.message;throw t.code===Ff.errors.SERVER_ERROR&&t.error&&"string"==typeof t.error.message?i=t.error.message:"string"==typeof t.body?i=t.body:"string"==typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&VE.throwError("insufficient funds for intrinsic transaction cost",Ff.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),i.match(/nonce (is )?too low/i)&&VE.throwError("nonce has already been used",Ff.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&VE.throwError("replacement fee too low",Ff.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),i.match(/only replay-protected/i)&&VE.throwError("legacy pre-eip-155 transactions not supported",Ff.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:r}),HE.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&VE.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",Ff.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}function ZE(e){return new Promise((function(t){setTimeout(t,e)}))}function JE(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function XE(e){return e?e.toLowerCase():e}const KE={};class $E extends bv{constructor(e,t,n){if(super(),e!==KE)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");_y(this,"provider",t),null==n&&(n=0),"string"==typeof n?(_y(this,"_address",this.provider.formatter.address(n)),_y(this,"_index",null)):"number"==typeof n?(_y(this,"_index",n),_y(this,"_address",null)):VE.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return VE.throwError("cannot alter JSON-RPC Signer connection",Ff.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new eN(KE,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((e=>(e.length<=this._index&&VE.throwError("unknown account #"+this._index,Ff.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=By(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const n=By(e);n.from=t,e.gasLimit=this.provider.estimateGas(n)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>FE(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&VE.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),Ry({tx:Ry(e),sender:t}).then((({tx:t,sender:n})=>{null!=t.from?t.from.toLowerCase()!==n&&VE.throwArgumentError("from address mismatch","transaction",e):t.from=n;const r=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((e=>e),(e=>("string"==typeof e.message&&e.message.match(/user denied/i)&&VE.throwError("user rejected transaction",Ff.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),qE("sendTransaction",e,r))))}))}signTransaction(e){return VE.throwError("signing transactions is unsupported",Ff.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return FE(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield sE((()=>FE(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(n);if(null!==e)return this.provider._wrapTransaction(e,n,t)}))),{oncePoll:this.provider})}catch(e){throw e.transactionHash=n,e}}))}signMessage(e){return FE(this,void 0,void 0,(function*(){const t="string"==typeof e?ig(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[ry(t),n.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&VE.throwError("user rejected signing",Ff.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),t}}))}_legacySignMessage(e){return FE(this,void 0,void 0,(function*(){const t="string"==typeof e?ig(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),ry(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&VE.throwError("user rejected signing",Ff.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),t}}))}_signTypedData(e,t,n){return FE(this,void 0,void 0,(function*(){const r=yield rv.resolveNames(e,t,n,(e=>this.provider.resolveName(e))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(rv.getPayload(r.domain,t,r.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&VE.throwError("user rejected signing",Ff.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:t,value:r.value}}),e}}))}unlock(e){return FE(this,void 0,void 0,(function*(){const t=this.provider,n=yield this.getAddress();return t.send("personal_unlockAccount",[n.toLowerCase(),e,null])}))}}class eN extends $E{sendTransaction(e){return this.sendUncheckedTransaction(e).then((e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)})))}}const tN={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class nN extends YE{constructor(e,t){let n=t;null==n&&(n=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(n),e||(e=Py(this.constructor,"defaultUrl")()),_y(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(By(e))),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 FE(this,void 0,void 0,(function*(){yield ZE(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(e){}}if(null!=e){const t=Py(this.constructor,"getNetwork");try{return t(my.from(e).toNumber())}catch(t){return VE.throwError("could not detect network",Ff.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return VE.throwError("could not detect network",Ff.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new $E(KE,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((e=>e.map((e=>this.formatter.address(e)))))}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Yy(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(r&&this._cache[e])return this._cache[e];const i=aE(this.connection,JSON.stringify(n),JE).then((e=>(this.emit("debug",{action:"response",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:n,provider:this}),e}));return r&&(this._cache[e]=i,setTimeout((()=>{this._cache[e]=null}),0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[XE(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[XE(t.address),t.blockTag]];case"getCode":return["eth_getCode",[XE(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[XE(t.address),uy(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[Py(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[Py(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=XE(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return FE(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&my.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((t=By(t)).transaction=By(e),delete t.transaction.type)}}const n=this.prepareRequest(e,t);null==n&&VE.throwError(e+" not implemented",Ff.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(n){return qE(e,n,t)}}))}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(n){return function r(){e.send("eth_getFilterChanges",[n]).then((function(n){if(e._pendingFilter!=t)return null;let r=Promise.resolve();return n.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",r=r.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),r.then((function(){return ZE(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){r()}),0),null;e.send("eth_uninstallFilter",[n])})).catch((e=>{}))}(),n})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const n=By(tN);if(t)for(const e in t)t[e]&&(n[e]=!0);var r,i;i=n,(r=e)&&"object"==typeof r||zy.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((e=>{i[e]||zy.throwArgumentError("invalid object key - "+e,"transaction:"+e,r)}));const o={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const n=sy(my.from(e[t]));"gasLimit"===t&&(t="gas"),o[t]=n})),["from","to","data"].forEach((function(t){null!=e[t]&&(o[t]=ry(e[t]))})),e.accessList&&(o.accessList=EA(e.accessList)),o}}const rN=new Ff(gE);let iN=1;function oN(e,t){const n="Web3LegacyFetcher";return function(e,r){const i={method:e,params:r,id:iN++,jsonrpc:"2.0"};return new Promise(((e,r)=>{this.emit("debug",{action:"request",fetcher:n,request:Yy(i),provider:this}),t(i,((t,o)=>{if(t)return this.emit("debug",{action:"response",fetcher:n,error:t,request:i,provider:this}),r(t);if(this.emit("debug",{action:"response",fetcher:n,request:i,response:o,provider:this}),o.error){const e=new Error(o.error.message);return e.code=o.error.code,e.data=o.error.data,r(e)}e(o.result)}))}))}}class aN extends nN{constructor(e,t){null==e&&rN.throwArgumentError("missing provider","provider",e);let n=null,r=null,i=null;"function"==typeof e?(n="unknown:",r=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),i=e,e.request?(""===n&&(n="eip-1193:"),r=function(e){return function(t,n){null==n&&(n=[]);const r={method:t,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:Yy(r),provider:this}),e.request(r).then((e=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:e,provider:this}),e}))}}(e)):e.sendAsync?r=oN(0,e.sendAsync.bind(e)):e.send?r=oN(0,e.send.bind(e)):rN.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,t),_y(this,"jsonRpcFetchFunc",r),_y(this,"provider",i)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const sN=new RegExp("^bytes([0-9]+)$"),uN=new RegExp("^(u?int)([0-9]*)$"),cN=new RegExp("^(.*)\\[([0-9]*)\\]$"),lN="0000000000000000000000000000000000000000000000000000000000000000",dN=new Ff("solidity/5.7.0");function hN(e,t,n){switch(e){case"address":return n?ey(t,32):Xf(t);case"string":return ig(t);case"bytes":return Xf(t);case"bool":return t=t?"0x01":"0x00",n?ey(t,32):Xf(t)}let r=e.match(uN);if(r){let i=parseInt(r[2]||"256");return(r[2]&&String(i)!==r[2]||i%8!=0||0===i||i>256)&&dN.throwArgumentError("invalid number type","type",e),n&&(i=256),ey(t=my.from(t).toTwos(i),i/8)}if(r=e.match(sN),r){const i=parseInt(r[1]);return(String(i)!==r[1]||0===i||i>32)&&dN.throwArgumentError("invalid bytes type","type",e),Xf(t).byteLength!==i&&dN.throwArgumentError(`invalid value for ${e}`,"value",t),n?Xf((t+lN).substring(0,66)):t}if(r=e.match(cN),r&&Array.isArray(t)){const n=r[1];parseInt(r[2]||String(t.length))!=t.length&&dN.throwArgumentError(`invalid array length for ${e}`,"value",t);const i=[];return t.forEach((function(e){i.push(hN(n,e,!0))})),Kf(i)}return dN.throwArgumentError("invalid type","type",e)}function pN(e,t){e.length!=t.length&&dN.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const n=[];return e.forEach((function(e,r){n.push(hN(e,t[r]))})),ry(Kf(n))}const fN=new Ff("units/5.7.0"),yN=["wei","kwei","mwei","gwei","szabo","finney","ether"];function mN(e,t){if("string"==typeof t){const e=yN.indexOf(t);-1!==e&&(t=3*e)}return Ly(e,null!=t?t:18)}function gN(e,t){if("string"!=typeof e&&fN.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=yN.indexOf(t);-1!==e&&(t=3*e)}return xy(e,null!=t?t:18)}let vN,wN=()=>vN||(vN="object"==typeof r?r:window,vN);const bN=()=>(void 0===wN()._Web3ClientConfiguration&&(wN()._Web3ClientConfiguration={}),wN()._Web3ClientConfiguration);function MN(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...e)=>n.call(t,...e))),t=void 0)}return n}class AN extends nN{constructor(e,t,n,r){super(e),this._network=t,this._endpoint=e,this._endpoints=n,this._failover=r,this._pendingBatch=[]}detectNetwork(){return Promise.resolve(mf.findByName(this._network).id)}requestChunk(e,t){try{const n=e.map((e=>e.request));return aE(t,JSON.stringify(n)).then((t=>{e.forEach(((e,n)=>{const r=t[n];if(MN([r,"optionalAccess",e=>e.error])){const t=new Error(r.error.message);t.code=r.error.code,t.data=r.error.data,e.reject(t)}else MN([r,"optionalAccess",e=>e.result])?e.resolve(r.result):e.reject()}))})).catch((t=>{if(t&&"SERVER_ERROR"==t.code){const t=this._endpoints.indexOf(this._endpoint)+1;this._failover(),this._endpoint=t>=this._endpoints.length?this._endpoints[0]:this._endpoints[t],this.requestChunk(e,this._endpoint)}else e.forEach((e=>{e.reject(t)}))}))}catch(t){e.forEach((e=>{e.reject()}))}}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((e,t)=>{r.resolve=e,r.reject=t}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const e=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const t=[];for(let n=0;n<Math.ceil(e.length/99);n++)t[n]=e.slice(99*n,99*(n+1));t.forEach((e=>(e.map((e=>e.request)),this.requestChunk(e,this._endpoint))))}),bN().batchInterval||10)),i}}const EN=()=>(null==wN()._Web3ClientProviders&&(wN()._Web3ClientProviders={}),wN()._Web3ClientProviders),NN=(e,t)=>{void 0===EN()[e]&&(EN()[e]=[]);const n=EN()[e].indexOf(t);n>-1&&EN()[e].splice(n,1),EN()[e].unshift(t)},TN=async(e,t,n=!0)=>{let r;EN()[e]=t.map(((r,i)=>new AN(r,e,t,(()=>{1===EN()[e].length?TN(e,t,n):EN()[e].splice(i,1)}))));let i=wN();if(null==i.fetch||void 0!==L&&L.env&&"test"==L.env.NODE_ENV||void 0!==i.cy||!1===n)r=EN()[e][0];else{let n=await Promise.all(t.map((e=>new Promise((async t=>{let n=(new Date).getTime();setTimeout((()=>t(900)),900);if(!(await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"})})).ok)return t(999);let r=(new Date).getTime();t(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=EN()[e][o]}NN(e,r)};var IN={getProvider:async e=>{let t=EN();if(t&&t[e])return t[e][0];let n=wN();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[e]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[e]=new Promise((async t=>{await TN(e,mf[e].endpoints),t(wN()._Web3ClientProviders[e][0])}))),await n._Web3ClientGetProviderPromise[e]},getProviders:async e=>{let t=EN();if(t&&t[e])return t[e];let n=wN();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[e]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[e]=new Promise((async t=>{await TN(e,mf[e].endpoints),t(wN()._Web3ClientProviders[e])}))),await n._Web3ClientGetProvidersPromise[e]},setProviderEndpoints:TN,setProvider:NN};class kN extends fd{constructor(e,t,n,r){super(e),this._provider=new fd(e),this._network=t,this._endpoint=e,this._endpoints=n,this._failover=r,this._pendingBatch=[],this._rpcRequest=this._rpcRequestReplacement.bind(this)}requestChunk(e){const t=e.map((e=>e.request)),n=t=>{if(t&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((e=>t.toString().match(e)))){const t=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=t>=this._endpoints.length?this._endpoints[0]:this._endpoints[t],this._provider=new fd(this._endpoint),this.requestChunk(e)}else e.forEach((e=>{e.reject(t)}))};try{return this._provider._rpcBatchRequest(t).then((t=>{e.forEach(((e,n)=>{const r=t[n];if(function(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...e)=>n.call(t,...e))),t=void 0)}return n}([r,"optionalAccess",e=>e.error])){const t=new Error(r.error.message);t.code=r.error.code,t.data=r.error.data,e.reject(t)}else r?e.resolve(r):e.reject()}))})).catch(n)}catch(e){return n(e)}}_rpcRequestReplacement(e,t){const n={methodName:e,args:t};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((e,t)=>{r.resolve=e,r.reject=t}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const e=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const t=[];for(let n=0;n<Math.ceil(e.length/99);n++)t[n]=e.slice(99*n,99*(n+1));t.forEach((e=>(e.map((e=>e.request)),this.requestChunk(e))))}),bN().batchInterval||10)),i}}const LN=()=>(null==wN()._Web3ClientProviders&&(wN()._Web3ClientProviders={}),wN()._Web3ClientProviders),xN=(e,t)=>{void 0===LN()[e]&&(LN()[e]=[]);const n=LN()[e].indexOf(t);n>-1&&LN()[e].splice(n,1),LN()[e].unshift(t)},SN=async(e,t,n=!0)=>{let r;LN()[e]=t.map(((r,i)=>new kN(r,e,t,(()=>{1===LN()[e].length?SN(e,t,n):LN()[e].splice(i,1)}))));let i=wN();if(null==i.fetch||void 0!==L&&L.env&&"test"==L.env.NODE_ENV||void 0!==i.cy||!1===n)r=LN()[e][0];else{let n=await Promise.all(t.map((e=>new Promise((async t=>{let n=(new Date).getTime();setTimeout((()=>t(900)),900);if(!(await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"})})).ok)return t(999);let r=(new Date).getTime();t(r-n)})))));const i=Math.min(...n),o=n.indexOf(i);r=LN()[e][o]}xN(e,r)};var jN={getProvider:async e=>{let t=LN();if(t&&t[e])return t[e][0];let n=wN();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[e]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[e]=new Promise((async t=>{await SN(e,mf[e].endpoints),t(wN()._Web3ClientProviders[e][0])}))),await n._Web3ClientGetProviderPromise[e]},getProviders:async e=>{let t=LN();if(t&&t[e])return t[e];let n=wN();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[e]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[e]=new Promise((async t=>{await SN(e,mf[e].endpoints),t(wN()._Web3ClientProviders[e])}))),await n._Web3ClientGetProvidersPromise[e]},setProviderEndpoints:SN,setProvider:xN};let CN=["ethereum","bsc","polygon","solana","fantom","arbitrum","avalanche","gnosis","optimism","base"];CN.evm=["ethereum","bsc","polygon","fantom","arbitrum","avalanche","gnosis","optimism","base"],CN.solana=["solana"];let DN=()=>(null==wN()._Web3ClientCacheStore&&(wN()._Web3ClientCacheStore={}),wN()._Web3ClientCacheStore),ON=()=>(null==wN()._Web3ClientPromiseStore&&(wN()._Web3ClientPromiseStore={}),wN()._Web3ClientPromiseStore),zN=function({key:e}){ON()[e]=void 0},_N=function({call:e,key:t,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:e}){return ON()[e]}({key:t=JSON.stringify(t)});if(a)return a.then(r).catch(i);(function({key:e,promise:t}){return ON()[e]=t,t})({key:t,promise:new Promise(((a,s)=>0===n?e().then((e=>{r(e),a(e)})).catch((e=>{i(e),s(e)})):(o=function({key:e,expires:t}){let n=DN()[e];if(function(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...e)=>n.call(t,...e))),t=void 0)}return n}([n,"optionalAccess",e=>e.expiresAt])>Date.now())return n.value}({key:t,expires:n}),o?(r(o),a(o),o):void e().then((e=>{e&&function({key:e,value:t,expires:n}){DN()[e]={expiresAt:Date.now()+n,value:t}}({key:t,value:e,expires:n}),r(e),a(e)})).catch((e=>{i(e),s(e)})))))}).then((()=>{zN({key:t})})).catch((()=>{zN({key:t})}))}))};const PN=async e=>{if(CN.evm.includes(e))return await IN.getProvider(e);if(CN.solana.includes(e))return await jN.getProvider(e);throw"Unknown blockchain: "+e},RN=e=>`(${e.map((e=>"tuple"===e.type?RN(e.components):e.type)).join(",")})`;var BN=({provider:e,from:t,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return e.estimateGas({from:t,to:n,value:r});{let s=new YA(n,o,e),u=s.interface.fragments.find((e=>e.name==i)),c=(({contract:e,method:t,params:n})=>{let r=e.interface.fragments.find((e=>e.name==t));return n instanceof Array?n:n instanceof Object?r.inputs.map((e=>n[e.name])):void 0})({contract:s,method:i,params:a});void 0===s[i]&&(i=`${i}(${u.inputs.map((e=>"tuple"===e.type?RN(e.components):e.type)).join(",")})`);let l=s.estimateGas[i];return c?l(...c,{from:t,value:r}):l({from:t,value:r})}};let UN=async function({blockchain:e,from:t,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!CN.includes(e))throw"Unknown blockchain: "+e;void 0===r&&(r="0");const u=await PN(e);return await _N({expires:s||0,key:[e,t,n,r,i,a],call:async()=>BN({provider:u,from:t,to:n,value:r,method:i,api:o,params:a})})};const WN=({address:e,api:t,method:n,params:r,provider:i,block:o})=>{const a=new YA(e,t,i),s=(({contract:e,method:t,params:n})=>e.interface.fragments.find((e=>e.name==t)).inputs.map(((e,t)=>Array.isArray(n)?n[t]:n[e.name])))({contract:a,method:n,params:r}),u=a.interface.fragments.find((e=>e.name===n));return void 0===a[n]&&(n=`${n}(${u.inputs.map((e=>e.type)).join(",")})`),u&&"nonpayable"===u.stateMutability?a.callStatic[n](...s,{blockTag:o}):a[n](...s,{blockTag:o})},QN=({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:a})=>n?WN({address:t,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:e,provider:t})=>t.getBalance(e))({address:t,provider:a}):"transactionCount"===r?(({address:e,provider:t})=>t.getTransactionCount(e))({address:t,provider:a}):void 0;const YN=async({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:a,providers:s})=>{try{if(null==r||"getAccountInfo"===r)return null==n&&(n=kp),await(async({address:e,api:t,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new mu(e));if(a&&a.data)return t.decode(a.data)})({address:t,api:n,method:r,params:i,provider:a,block:o});if("getProgramAccounts"===r)return await a.getProgramAccounts(new mu(t),i).then((e=>n?e.map((e=>(e.data=n.decode(e.account.data),e))):e));if("getTokenAccountBalance"===r)return await a.getTokenAccountBalance(new mu(t));if("latestBlockNumber"===r)return await a.getSlot(i||void 0);if("balance"===r)return await(({address:e,provider:t})=>t.getBalance(new mu(e)))({address:t,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((e=>u.toString().match(e)))){let u=s[s.indexOf(a)+1]||s[0];return YN({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:u,providers:s})}throw u}};const FN=async function(e,t){const{blockchain:n,address:r,method:i}=(e=>{if("object"==typeof e)return e;let t=e.match(/(?<blockchain>\w+):\/\/(?<part1>[\w\d]+)(\/(?<part2>[\w\d]+)*)?/);return null==t.groups.part2?t.groups.part1.match(/\d/)?{blockchain:t.groups.blockchain,address:t.groups.part1}:{blockchain:t.groups.blockchain,method:t.groups.part1}:{blockchain:t.groups.blockchain,address:t.groups.part1,method:t.groups.part2}})(e),{api:o,params:a,cache:s,block:u,timeout:c,strategy:l,cacheKey:d}=("object"==typeof e?e:t)||{};return await _N({expires:s||0,key:d||[n,r,i,a,u],call:async()=>{if(CN.evm.includes(n))return await(async({blockchain:e,address:t,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{if(s=s||bN().strategy||"failover",a=a||bN().timeout||void 0,"fastest"===s){const s=await IN.getProviders(e);let u=[];const c=s.map((a=>new Promise((s=>{u.push(QN({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:a}).then(s))})))),l=new Promise(((e,t)=>setTimeout((()=>{t(new Error("Web3ClientTimeout"))}),a||1e4)));return u=Promise.all(u.map((e=>new Promise((t=>{e.catch(t)}))))).then((()=>{})),Promise.race([...c,l,u])}{const s=await IN.getProvider(e),u=QN({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:s});return a?(a=new Promise(((e,t)=>setTimeout((()=>{t(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(CN.solana.includes(n))return await(async({blockchain:e,address:t,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{s=s||bN().strategy||"failover",a=a||bN().timeout||void 0;const u=await jN.getProviders(e);if("fastest"===s){let s=[];const c=u.map((a=>new Promise((u=>{s.push(YN({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:a}).then(u))})))),l=new Promise(((e,t)=>setTimeout((()=>{t(new Error("Web3ClientTimeout"))}),a||1e4)));return s=Promise.all(s.map((e=>new Promise((t=>{e.catch(t)}))))).then((()=>{})),Promise.race([...c,l,s])}{const s=await jN.getProvider(e),c=YN({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:s,providers:u});return a?(a=new Promise(((e,t)=>setTimeout((()=>{t(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 VN=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=92)}([function(e,t,n){(function(e){n.d(t,"f",(function(){return s})),n.d(t,"g",(function(){return u})),n.d(t,"i",(function(){return c})),n.d(t,"h",(function(){return l})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return h})),n.d(t,"e",(function(){return p})),n.d(t,"d",(function(){return f})),n.d(t,"o",(function(){return y})),n.d(t,"n",(function(){return m})),n.d(t,"p",(function(){return g})),n.d(t,"A",(function(){return v})),n.d(t,"z",(function(){return w})),n.d(t,"B",(function(){return b})),n.d(t,"v",(function(){return M})),n.d(t,"u",(function(){return A})),n.d(t,"s",(function(){return T})),n.d(t,"r",(function(){return I})),n.d(t,"t",(function(){return k})),n.d(t,"q",(function(){return L})),n.d(t,"m",(function(){return x})),n.d(t,"l",(function(){return S})),n.d(t,"k",(function(){return j})),n.d(t,"j",(function(){return C})),n.d(t,"x",(function(){return O})),n.d(t,"a",(function(){return z})),n.d(t,"y",(function(){return _})),n.d(t,"w",(function(){return P}));var r=n(22),i=n.n(r),o=n(49),a=n.n(o);function s(e){return new Uint8Array(e)}function u(e,t=!1){const n=e.toString("hex");return t?z(n):n}function c(e){return e.toString("utf8")}function l(e){return e.readUIntBE(0,e.length)}function d(e){return a()(e)}function h(e,t=!1){return u(d(e),t)}function p(e){return c(d(e))}function f(e){return l(d(e))}function y(t){return e.from(O(t),"hex")}function m(e){return s(y(e))}function g(e){return c(y(e))}function v(t){return e.from(t,"utf8")}function w(e){return s(v(e))}function b(e,t=!1){return u(v(e),t)}function M(e){return d(N(E(e)))}function A(e){return N(E(e))}function E(e){return D((e>>>0).toString(2))}function N(e){return new Uint8Array(function(e,t=8){const n=D(e).match(new RegExp(`.{${t}}`,"gi"));return Array.from(n||[])}(e).map((e=>parseInt(e,2))))}function T(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}function I(t){return e.isBuffer(t)}function k(e){return i.a.strict(e)&&!I(e)}function L(e){return!k(e)&&!I(e)&&void 0!==e.byteLength}function x(e){return I(e)?"buffer":k(e)?"typed-array":L(e)?"array-buffer":Array.isArray(e)?"array":typeof e}function S(e){return function(e){return!("string"!=typeof e||!new RegExp(/^[01]+$/).test(e))&&e.length%8==0}(e)?"binary":T(e)?"hex":"utf8"}function j(...t){return e.concat(t)}function C(...e){let t=[];return e.forEach((e=>t=t.concat(Array.from(e)))),new Uint8Array([...t])}function D(e,t=8,n="0"){return function(e,t,n="0"){return function(e,t,n,r="0"){const i=t-e.length;let o=e;if(i>0){const t=r.repeat(i);o=n?t+e:e+t}return o}(e,t,!0,n)}(e,function(e,t=8){const n=e%t;return n?(e-n)/t*t+t:e}(e.length,t),n)}function O(e){return e.replace(/^0x/,"")}function z(e){return e.startsWith("0x")?e:"0x"+e}function _(e){return(e=D(e=O(e),2))&&(e=z(e)),e}function P(e){const t=e.startsWith("0x");return e=(e=O(e)).startsWith("0")?e.substring(1):e,t?z(e):e}}).call(this,n(18).Buffer)},function(e,t,n){n.d(t,"g",(function(){return r.detectEnv})),n.d(t,"r",(function(){return r.isMobile})),n.d(t,"m",(function(){return r.isBrowser})),n.d(t,"k",(function(){return r.getLocation})),n.d(t,"i",(function(){return r.getClientMeta})),n.d(t,"B",(function(){return r.setLocal})),n.d(t,"j",(function(){return r.getLocal})),n.d(t,"A",(function(){return r.removeLocal})),n.d(t,"v",(function(){return r.mobileLinkChoiceKey})),n.d(t,"C",(function(){return o})),n.d(t,"b",(function(){return c})),n.d(t,"c",(function(){return l})),n.d(t,"d",(function(){return d})),n.d(t,"e",(function(){return h})),n.d(t,"f",(function(){return p})),n.d(t,"w",(function(){return T})),n.d(t,"x",(function(){return I})),n.d(t,"z",(function(){return m})),n.d(t,"D",(function(){return g})),n.d(t,"h",(function(){return k})),n.d(t,"u",(function(){return C})),n.d(t,"y",(function(){return D})),n.d(t,"l",(function(){return x})),n.d(t,"a",(function(){return S})),n.d(t,"o",(function(){return w})),n.d(t,"q",(function(){return b})),n.d(t,"p",(function(){return M})),n.d(t,"n",(function(){return A})),n.d(t,"s",(function(){return E})),n.d(t,"t",(function(){return N}));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(e){return u.b(new Uint8Array(e))}function l(e,t){return u.c(new Uint8Array(e),!t)}function d(e){return u.f(e).buffer}function h(e){return u.n(e).buffer}function p(e,t){const n=u.x(u.y(new s.a(e).toString(16)));return t?n:u.a(n)}var f=n(50);function y(e){return u.y(e)}const m=n(51).payloadId;function g(){return((e,t)=>{for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t})()}function v(e,t){return u.s(e,t)}function w(e){return void 0!==e.method}function b(e){return void 0!==e.result}function M(e){return void 0!==e.error}function A(e){return void 0!==e.event}function E(e){return i.includes(e)||e.startsWith("wc_")}function N(e){return!!e.method.startsWith("wc_")||!o.includes(e.method)}function T(e){var t,n;return(n=e)&&n.length&&!v(e[0])&&(e[0]=(t=e[0],u.B(t,!0))),e}function I(e){if(void 0!==e.type&&"0"!==e.type)return e;if(void 0===e.from||!(t=e.from)||"0x"!==t.toLowerCase().substring(0,2)||!/^(0x)?[0-9a-f]{40}$/i.test(t)||!/^(0x)?[0-9a-f]{40}$/.test(t)&&!/^(0x)?[0-9A-F]{40}$/.test(t)&&t!==function(e){e=Object(u.x)(e.toLowerCase());const t=Object(u.x)(Object(f.keccak_256)((n=e,u.A(n))));var n;let r="";for(let n=0;n<e.length;n++)parseInt(t[n],16)>7?r+=e[n].toUpperCase():r+=e[n];return Object(u.a)(r)}(t))throw new Error("Transaction object must include a valid 'from' value.");var t;function n(e){let t=e;var n;return("number"==typeof e||"string"==typeof e&&!function(e){return""===e||"string"==typeof e&&""===e.trim()}(e))&&(v(e)?"string"==typeof e&&(t=y(e)):t=p(e)),"string"==typeof t&&(n=t,t=u.w(u.a(n))),t}const r={from:y(e.from),to:void 0===e.to?void 0:y(e.to),gasPrice:void 0===e.gasPrice?"":n(e.gasPrice),gas:void 0===e.gas?void 0===e.gasLimit?"":n(e.gasLimit):n(e.gas),value:void 0===e.value?"":n(e.value),nonce:void 0===e.nonce?"":n(e.nonce),data:void 0===e.data?"":y(e.data)||"0x"},i=["gasPrice","gas","value","nonce"];return Object.keys(r).forEach((e=>{(void 0===r[e]||"string"==typeof r[e]&&!r[e].trim().length)&&i.includes(e)&&delete r[e]})),r}function k(e){const t=e.message||"Failed or Rejected Request";let n=-32e3;if(e&&!e.code)switch(t){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:t};return e.data&&(r.data=e.data),r}var L=n(23);function x(e){const t=-1!==e.indexOf("?")?e.indexOf("?"):void 0;return void 0!==t?e.substr(t):""}function S(e,t){let n=j(e);return n=Object.assign(Object.assign({},n),t),function(e){return L.stringify(e)}(n)}function j(e){return L.parse(e)}function C(e){return void 0!==e.bridge}function D(e){const t=e.indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=function(e){const t=e.split("@");return{handshakeTopic:t[0],version:parseInt(t[1],10)}}(e.substring(t+1,n)),o=function(e){const t=j(e);return{key:t.key||"",bridge:t.bridge||""}}(void 0!==n?e.substr(n):"");return Object.assign(Object.assign({protocol:r},i),o)}},function(e,t,n){n.d(t,"b",(function(){return i})),n.d(t,"g",(function(){return o})),n.d(t,"a",(function(){return a})),n.d(t,"f",(function(){return s})),n.d(t,"e",(function(){return u})),n.d(t,"i",(function(){return c})),n.d(t,"j",(function(){return l})),n.d(t,"h",(function(){return r})),n.d(t,"d",(function(){return d})),n.d(t,"c",(function(){return h})),n.d(t,"k",(function(){return p})),n.d(t,"l",(function(){return f}));const r=512,i=256,o=256,a="AES-CBC",s="SHA-"+i,u="HMAC",c="SHA-256",l="SHA-512",d="encrypt",h="decrypt",p="sign",f="verify"},function(e,t,n){n.d(t,"b",(function(){return r})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return o})),n.d(t,"e",(function(){return a})),n.d(t,"f",(function(){return s})),n.d(t,"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(e,t,n){function r(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function i(e){const t=r(e);if(!t)throw new Error(e+" is not defined in Window");return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=r,t.getFromWindowOrThrow=i,t.getDocumentOrThrow=function(){return i("document")},t.getDocument=function(){return r("document")},t.getNavigatorOrThrow=function(){return i("navigator")},t.getNavigator=function(){return r("navigator")},t.getLocationOrThrow=function(){return i("location")},t.getLocation=function(){return r("location")},t.getCryptoOrThrow=function(){return i("crypto")},t.getCrypto=function(){return r("crypto")},t.getLocalStorageOrThrow=function(){return i("localStorage")},t.getLocalStorage=function(){return r("localStorage")}},function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(67),t),i(n(68),t)},function(e,t,n){n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s})),n.d(t,"c",(function(){return u})),n.d(t,"d",(function(){return c})),n.d(t,"e",(function(){return l})),n.d(t,"f",(function(){return d}));var r=n(5),i=n(2);async function o(e,t=i.a){return r.getSubtleCrypto().importKey("raw",e,function(e){return e===i.a?{length:i.b,name:i.a}:{hash:{name:i.f},name:i.e}}(t),!0,function(e){return e===i.a?[i.d,i.c]:[i.k,i.l]}(t))}async function a(e,t,n){const a=r.getSubtleCrypto(),s=await o(t,i.a),u=await a.encrypt({iv:e,name:i.a},s,n);return new Uint8Array(u)}async function s(e,t,n){const a=r.getSubtleCrypto(),s=await o(t,i.a),u=await a.decrypt({iv:e,name:i.a},s,n);return new Uint8Array(u)}async function u(e,t){const n=r.getSubtleCrypto(),a=await o(e,i.e),s=await n.sign({length:i.g,name:i.e},a,t);return new Uint8Array(s)}async function c(e,t){const n=r.getSubtleCrypto(),a=await o(e,i.e),s=await n.sign({length:i.h,name:i.e},a,t);return new Uint8Array(s)}async function l(e){const t=r.getSubtleCrypto(),n=await t.digest({name:i.i},e);return new Uint8Array(n)}async function d(e){const t=r.getSubtleCrypto(),n=await t.digest({name:i.j},e);return new Uint8Array(n)}},function(e,t){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];t.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return 4*e+17},t.getSymbolTotalCodewords=function(e){return r[e]},t.getBCHDigit=function(e){for(var t=0;0!==e;)t++,e>>>=1;return t},t.setToSJISFunction=function(e){if("function"!=typeof e)throw new Error('"toSJISFunc" is not a valid function.');n=e},t.isKanjiModeEnabled=function(){return void 0!==n},t.toSJIS=function(e){return n(e)}},function(e,t,n){var r=n(44),i=n(45);t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(e,t){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!r.isValid(t))throw new Error("Invalid version: "+t);return t>=1&&t<10?e.ccBits[0]:t<27?e.ccBits[1]:e.ccBits[2]},t.getBestModeForData=function(e){return i.testNumeric(e)?t.NUMERIC:i.testAlphanumeric(e)?t.ALPHANUMERIC:i.testKanji(e)?t.KANJI:t.BYTE},t.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")},t.isValid=function(e){return e&&e.bit&&e.ccBits},t.from=function(e,n){if(t.isValid(e))return e;try{return function(e){if("string"!=typeof e)throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+e)}}(e)}catch(e){return n}}},function(e,t,n){n.d(t,"c",(function(){return i})),n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return a}));var r=n(3);function i(e){return r.c.includes(e)}function o(e){return Object.keys(r.f).includes(e)?r.f[e]:r.f[r.a]}function a(e){return Object.values(r.f).find((t=>t.code===e))||r.f[r.a]}},function(e,t,n){var r=n(19);o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}();var i=o.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function o(e,t,n){return o.TYPED_ARRAY_SUPPORT||this instanceof o?"number"==typeof e?u(this,e):function(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");var i;return i=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),o.TYPED_ARRAY_SUPPORT?i.__proto__=o.prototype:i=c(e,i),i}(e,t,n,r):"string"==typeof t?function(e,t){var n=0|d(t),r=s(e,n),i=r.write(t);return i!==n&&(r=r.slice(0,i)),r}(e,t):function(e,t){if(o.isBuffer(t)){var n=0|a(t.length),r=s(e,n);return 0===r.length||t.copy(r,0,0,n),r}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(i=t.length)!=i?s(e,0):c(e,t);if("Buffer"===t.type&&Array.isArray(t.data))return c(e,t.data)}var i;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}(this,e,t,n):new o(e,t,n)}function a(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function s(e,t){var n;return o.TYPED_ARRAY_SUPPORT?(n=new Uint8Array(t)).__proto__=o.prototype:(null===(n=e)&&(n=new o(t)),n.length=t),n}function u(e,t){var n=s(e,t<0?0:0|a(t));if(!o.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)n[r]=0;return n}function c(e,t){for(var n=t.length<0?0:0|a(t.length),r=s(e,n),i=0;i<n;i+=1)r[i]=255&t[i];return r}function l(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=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((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function d(e){return o.isBuffer(e)?e.length:"undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer)?e.byteLength:("string"!=typeof e&&(e=""+e),0===e.length?0:l(e).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(e,t,n){void 0===t||void 0===n&&"string"==typeof t?(n=this.length,t=0):isFinite(t)&&(t|=0,isFinite(n)?n|=0:n=void 0);var r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");return function(e,t,n,r){return function(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}(l(t,e.length-n),e,n,r)}(this,e,t,n)},o.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),o.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=o.prototype;else{var i=t-e;n=new o(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+e]}return n},o.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,a=r-n;if(this===e&&n<t&&t<r)for(i=a-1;i>=0;--i)e[i+t]=this[i+n];else if(a<1e3||!o.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},o.prototype.fill=function(e,t,n){if("string"==typeof e){if("string"==typeof t?(t=0,n=this.length):"string"==typeof n&&(n=this.length),1===e.length){var r=e.charCodeAt(0);r<256&&(e=r)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var a=o.isBuffer(e)?e:new o(e),s=a.length;for(i=0;i<n-t;++i)this[i+t]=a[i%s]}return this},o.concat=function(e,t){if(!r(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s(null,0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var i=u(null,t),a=0;for(n=0;n<e.length;++n){var c=e[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=d,o.prototype._isBuffer=!0,o.isBuffer=function(e){return!(null==e||!e._isBuffer)},e.exports.alloc=function(e){var t=new o(e);return t.fill(0),t},e.exports.from=function(e){return new o(e)}},function(e,t,n){var r=n(34);n.d(t,"randomBytes",(function(){return r.a}));var i=n(35);n.d(t,"aesCbcDecrypt",(function(){return i.a})),n.d(t,"aesCbcEncrypt",(function(){return i.b}));var o=n(36);n.d(t,"hmacSha256Sign",(function(){return o.a})),n(41),n(15),n(2)},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var u,c=[],l=!1,d=-1;function h(){l&&u&&(l=!1,u.length?c=u.concat(c):d=-1,c.length&&p())}function p(){if(!l){var e=s(h);l=!0;for(var t=c.length;t;){for(u=c,c=[];++d<t;)u&&u[d].run();d=-1,t=c.length}u=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function y(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new f(e,t)),1!==c.length||l||s(p)},f.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=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){n.d(t,"a",(function(){return r}));class r{}},function(e,t,n){var r=n(37);n.o(r,"isConstantTime")&&n.d(t,"isConstantTime",(function(){return r.isConstantTime})),n(38);var i=n(39);n.o(i,"isConstantTime")&&n.d(t,"isConstantTime",(function(){return i.isConstantTime}));var o=n(40);n.d(t,"isConstantTime",(function(){return o.a}))},function(e,t,n){(function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function o(e,t,n){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var a;"object"==typeof e?e.exports=o:t.BN=o,o.BN=o,o.wordSize=26;try{a=n(55).Buffer}catch(e){}function s(e,t,n){for(var r=0,i=Math.min(e.length,n),o=t;o<i;o++){var a=e.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(e,t,n,r){for(var i=0,o=Math.min(e.length,n),a=t;a<o;a++){var s=e.charCodeAt(a)-48;i*=r,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(e){return e instanceof o||null!==e&&"object"==typeof e&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,n){if("number"==typeof e)return this._initNumber(e,t,n);if("object"==typeof e)return this._initArray(e,t,n);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&i++,16===t?this._parseHex(e,i):this._parseBase(e,t,i),"-"===e[0]&&(this.negative=1),this.strip(),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initNumber=function(e,t,n){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),t,n)},o.prototype._initArray=function(e,t,n){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.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=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[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<e.length;i+=3)a=e[i]|e[i+1]<<8|e[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(e,t){this.length=Math.ceil((e.length-t)/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=e.length-6,r=0;n>=t;n-=6)i=s(e,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!==t&&(i=s(e,t,n+6),this.words[r]|=i<<o&67108863,this.words[r+1]|=i>>>26-o&4194303),this.strip()},o.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var d=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)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],d=[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 h(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.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,d=67108863&u,h=Math.min(c,t.length-1),p=Math.max(0,c-e.length+1);p<=h;p++){var f=c-p|0;l+=(a=(i=0|e.words[f])*(o=0|t.words[p])+d)/67108864|0,d=67108863&a}n.words[c]=0|d,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n.strip()}o.prototype.toString=function(e,t){var n;if(t=0|t||1,16===(e=e||10)||"hex"===e){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%t!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(e===(0|e)&&e>=2&&e<=36){var h=l[e],p=d[e];n="";var f=this.clone();for(f.negative=0;!f.isZero();){var y=f.modn(p).toString(e);n=(f=f.idivn(p)).isZero()?y+n:c[h-y.length]+y+n}for(this.isZero()&&(n="0"+n);n.length%t!=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 e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return r(void 0!==a),this.toArrayLike(a,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,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"===t,c=new e(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(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},o.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).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(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return r(0==(this.negative|e.negative)),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return r(0==(this.negative|e.negative)),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return r(0==(this.negative|e.negative)),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),n=e%26;this._expand(t),n>0&&t--;for(var i=0;i<t;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(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var n=e/26|0,i=e%26;return this._expand(n+1),this.words[n]=t?this.words[n]|1<<i:this.words[n]&~(1<<i),this.strip()},o.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>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(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;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(e){return this.clone().isub(e)};var p=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],d=8191&l,h=l>>>13,p=0|a[1],f=8191&p,y=p>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],E=8191&A,N=A>>>13,T=0|a[5],I=8191&T,k=T>>>13,L=0|a[6],x=8191&L,S=L>>>13,j=0|a[7],C=8191&j,D=j>>>13,O=0|a[8],z=8191&O,_=O>>>13,P=0|a[9],R=8191&P,B=P>>>13,U=0|s[0],W=8191&U,Q=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],de=8191&le,he=le>>>13,pe=0|s[9],fe=8191&pe,ye=pe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(d,W))|0)+((8191&(i=(i=Math.imul(d,Q))+Math.imul(h,W)|0))<<13)|0;c=((o=Math.imul(h,Q))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(f,W),i=(i=Math.imul(f,Q))+Math.imul(y,W)|0,o=Math.imul(y,Q);var ge=(c+(r=r+Math.imul(d,F)|0)|0)+((8191&(i=(i=i+Math.imul(d,V)|0)+Math.imul(h,F)|0))<<13)|0;c=((o=o+Math.imul(h,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,W),i=(i=Math.imul(g,Q))+Math.imul(v,W)|0,o=Math.imul(v,Q),r=r+Math.imul(f,F)|0,i=(i=i+Math.imul(f,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(d,G)|0)|0)+((8191&(i=(i=i+Math.imul(d,q)|0)+Math.imul(h,G)|0))<<13)|0;c=((o=o+Math.imul(h,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=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(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(f,G)|0,i=(i=i+Math.imul(f,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(d,J)|0)|0)+((8191&(i=(i=i+Math.imul(d,X)|0)+Math.imul(h,J)|0))<<13)|0;c=((o=o+Math.imul(h,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(E,W),i=(i=Math.imul(E,Q))+Math.imul(N,W)|0,o=Math.imul(N,Q),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(f,J)|0,i=(i=i+Math.imul(f,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(d,$)|0)|0)+((8191&(i=(i=i+Math.imul(d,ee)|0)+Math.imul(h,$)|0))<<13)|0;c=((o=o+Math.imul(h,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(I,W),i=(i=Math.imul(I,Q))+Math.imul(k,W)|0,o=Math.imul(k,Q),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(f,$)|0,i=(i=i+Math.imul(f,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(d,ne)|0)|0)+((8191&(i=(i=i+Math.imul(d,re)|0)+Math.imul(h,ne)|0))<<13)|0;c=((o=o+Math.imul(h,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(x,W),i=(i=Math.imul(x,Q))+Math.imul(S,W)|0,o=Math.imul(S,Q),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(k,F)|0,o=o+Math.imul(k,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|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(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(f,ne)|0,i=(i=i+Math.imul(f,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(d,oe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ae)|0)+Math.imul(h,oe)|0))<<13)|0;c=((o=o+Math.imul(h,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(C,W),i=(i=Math.imul(C,Q))+Math.imul(D,W)|0,o=Math.imul(D,Q),r=r+Math.imul(x,F)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(k,G)|0,o=o+Math.imul(k,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(f,oe)|0,i=(i=i+Math.imul(f,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ee=(c+(r=r+Math.imul(d,ue)|0)|0)+((8191&(i=(i=i+Math.imul(d,ce)|0)+Math.imul(h,ue)|0))<<13)|0;c=((o=o+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(z,W),i=(i=Math.imul(z,Q))+Math.imul(_,W)|0,o=Math.imul(_,Q),r=r+Math.imul(C,F)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(D,F)|0,o=o+Math.imul(D,V)|0,r=r+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(k,J)|0,o=o+Math.imul(k,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(f,ue)|0,i=(i=i+Math.imul(f,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(d,de)|0)|0)+((8191&(i=(i=i+Math.imul(d,he)|0)+Math.imul(h,de)|0))<<13)|0;c=((o=o+Math.imul(h,he)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(R,W),i=(i=Math.imul(R,Q))+Math.imul(B,W)|0,o=Math.imul(B,Q),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(_,F)|0,o=o+Math.imul(_,V)|0,r=r+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(D,G)|0,o=o+Math.imul(D,q)|0,r=r+Math.imul(x,J)|0,i=(i=i+Math.imul(x,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(k,$)|0,o=o+Math.imul(k,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(f,de)|0,i=(i=i+Math.imul(f,he)|0)+Math.imul(y,de)|0,o=o+Math.imul(y,he)|0;var Te=(c+(r=r+Math.imul(d,fe)|0)|0)+((8191&(i=(i=i+Math.imul(d,ye)|0)+Math.imul(h,fe)|0))<<13)|0;c=((o=o+Math.imul(h,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(R,F),i=(i=Math.imul(R,V))+Math.imul(B,F)|0,o=Math.imul(B,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,r=r+Math.imul(C,J)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(D,J)|0,o=o+Math.imul(D,X)|0,r=r+Math.imul(x,$)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(k,ne)|0,o=o+Math.imul(k,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,de)|0,i=(i=i+Math.imul(g,he)|0)+Math.imul(v,de)|0,o=o+Math.imul(v,he)|0;var Ie=(c+(r=r+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ye)|0)+Math.imul(y,fe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(R,G),i=(i=Math.imul(R,q))+Math.imul(B,G)|0,o=Math.imul(B,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(_,J)|0,o=o+Math.imul(_,X)|0,r=r+Math.imul(C,$)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(D,$)|0,o=o+Math.imul(D,ee)|0,r=r+Math.imul(x,ne)|0,i=(i=i+Math.imul(x,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,de)|0,i=(i=i+Math.imul(b,he)|0)+Math.imul(M,de)|0,o=o+Math.imul(M,he)|0;var ke=(c+(r=r+Math.imul(g,fe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,fe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(R,J),i=(i=Math.imul(R,X))+Math.imul(B,J)|0,o=Math.imul(B,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(_,$)|0,o=o+Math.imul(_,ee)|0,r=r+Math.imul(C,ne)|0,i=(i=i+Math.imul(C,re)|0)+Math.imul(D,ne)|0,o=o+Math.imul(D,re)|0,r=r+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(k,ue)|0,o=o+Math.imul(k,ce)|0,r=r+Math.imul(E,de)|0,i=(i=i+Math.imul(E,he)|0)+Math.imul(N,de)|0,o=o+Math.imul(N,he)|0;var Le=(c+(r=r+Math.imul(b,fe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,fe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(R,$),i=(i=Math.imul(R,ee))+Math.imul(B,$)|0,o=Math.imul(B,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(_,ne)|0,o=o+Math.imul(_,re)|0,r=r+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(D,oe)|0,o=o+Math.imul(D,ae)|0,r=r+Math.imul(x,ue)|0,i=(i=i+Math.imul(x,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(I,de)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(k,de)|0,o=o+Math.imul(k,he)|0;var xe=(c+(r=r+Math.imul(E,fe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(N,fe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(R,ne),i=(i=Math.imul(R,re))+Math.imul(B,ne)|0,o=Math.imul(B,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,r=r+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,ce)|0)+Math.imul(D,ue)|0,o=o+Math.imul(D,ce)|0,r=r+Math.imul(x,de)|0,i=(i=i+Math.imul(x,he)|0)+Math.imul(S,de)|0,o=o+Math.imul(S,he)|0;var Se=(c+(r=r+Math.imul(I,fe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(k,fe)|0))<<13)|0;c=((o=o+Math.imul(k,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(R,oe),i=(i=Math.imul(R,ae))+Math.imul(B,oe)|0,o=Math.imul(B,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,ce)|0,r=r+Math.imul(C,de)|0,i=(i=i+Math.imul(C,he)|0)+Math.imul(D,de)|0,o=o+Math.imul(D,he)|0;var je=(c+(r=r+Math.imul(x,fe)|0)|0)+((8191&(i=(i=i+Math.imul(x,ye)|0)+Math.imul(S,fe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(R,ue),i=(i=Math.imul(R,ce))+Math.imul(B,ue)|0,o=Math.imul(B,ce),r=r+Math.imul(z,de)|0,i=(i=i+Math.imul(z,he)|0)+Math.imul(_,de)|0,o=o+Math.imul(_,he)|0;var Ce=(c+(r=r+Math.imul(C,fe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ye)|0)+Math.imul(D,fe)|0))<<13)|0;c=((o=o+Math.imul(D,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(R,de),i=(i=Math.imul(R,he))+Math.imul(B,de)|0,o=Math.imul(B,he);var De=(c+(r=r+Math.imul(z,fe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(_,fe)|0))<<13)|0;c=((o=o+Math.imul(_,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863;var Oe=(c+(r=Math.imul(R,fe))|0)+((8191&(i=(i=Math.imul(R,ye))+Math.imul(B,fe)|0))<<13)|0;return c=((o=Math.imul(B,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ee,u[8]=Ne,u[9]=Te,u[10]=Ie,u[11]=ke,u[12]=Le,u[13]=xe,u[14]=Se,u[15]=je,u[16]=Ce,u[17]=De,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function f(e,t,n){return(new y).mulp(e,t,n)}function y(e,t){this.x=e,this.y=t}Math.imul||(p=h),o.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?p(this,e,t):n<63?h(this,e,t):n<1024?function(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.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,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,d=(0|e.words[l])*(0|t.words[c]),h=67108863&d;s=67108863&(h=h+s|0),i+=(a=(a=a+(d/67108864|0)|0)+(h>>>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,e,t):f(this,e,t)},y.prototype.makeRBT=function(e){for(var t=new Array(e),n=o.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},y.prototype.revBin=function(e,t,n){if(0===e||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(1&e)<<t-i-1,e>>=1;return r},y.prototype.permute=function(e,t,n,r,i,o){for(var a=0;a<o;a++)r[a]=t[e[a]],i[a]=n[e[a]]},y.prototype.transform=function(e,t,n,r,i,o){this.permute(o,e,t,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 d=u,h=c,p=0;p<a;p++){var f=n[l+p],y=r[l+p],m=n[l+p+a],g=r[l+p+a],v=d*m-h*g;g=d*g+h*m,m=v,n[l+p]=f+m,r[l+p]=y+g,n[l+p+a]=f-m,r[l+p+a]=y-g,p!==s&&(v=u*d-c*h,h=u*h+c*d,d=v)}},y.prototype.guessLen13b=function(e,t){var n=1|Math.max(t,e),r=1&n,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},y.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},y.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=8192*Math.round(e[2*r+1]/t)+Math.round(e[2*r]/t)+n;e[r]=67108863&i,n=i<67108864?0:i/67108864|0}return e},y.prototype.convert13b=function(e,t,n,i){for(var o=0,a=0;a<t;a++)o+=0|e[a],n[2*a]=8191&o,o>>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a<i;++a)n[a]=0;r(0===o),r(0==(-8192&o))},y.prototype.stub=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=0;return t},y.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.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),d=new Array(r),h=n.words;h.length=r,this.convert13b(e.words,e.length,a,r),this.convert13b(t.words,t.length,c,r),this.transform(a,o,s,u,r,i),this.transform(c,o,l,d,r,i);for(var p=0;p<r;p++){var f=s[p]*l[p]-u[p]*d[p];u[p]=s[p]*d[p]+u[p]*l[p],s[p]=f}return this.conjugate(s,u,r),this.transform(s,u,h,o,r,i),this.conjugate(h,o,r),this.normalize13b(h,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),f(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){r("number"==typeof e),r(e<67108864);for(var t=0,n=0;n<this.length;n++){var i=(0|this.words[n])*e,o=(67108863&i)+(67108863&t);t>>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}(e);if(0===t.length)return new o(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var i=n.sqr();r<t.length;r++,i=i.sqr())0!==t[r]&&(n=n.mul(i));return n},o.prototype.iushln=function(e){r("number"==typeof e&&e>=0);var t,n=e%26,i=(e-n)/26,o=67108863>>>26-n<<26-n;if(0!==n){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<n;this.words[t]=u|a,a=s>>>26-n}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return r(0===this.negative),this.iushln(e)},o.prototype.iushrn=function(e,t,n){var i;r("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-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 d=0|this.words[c];this.words[c]=l<<26-o|d>>>o,l=d&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(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<<t;return!(this.length<=n||!(this.words[n]&i))},o.prototype.imaskn=function(e){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==t&&n++,this.length=Math.min(n,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return r("number"==typeof e),r(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,n){var i,o,a=e.length+n;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+n])+s;var u=(0|e.words[i])*t;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(e,t){var n=(this.length,e.length),r=this.clone(),i=e,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"!==t){(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 d=u-1;d>=0;d--){var h=67108864*(0|r.words[i.length+d])+(0|r.words[i.length+d-1]);for(h=Math.min(h/a|0,67108863),r._ishlnsubmul(i,h,d);0!==r.negative;)h--,r.negative=0,r._ishlnsubmul(i,1,d),r.isZero()||(r.negative^=1);s&&(s.words[d]=h)}return s&&s.strip(),r.strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},o.prototype.divmod=function(e,t,n){return r(!e.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(i=s.div.neg()),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.iadd(e)),{div:i,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),n&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t);var i,a,s},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,n=0,i=this.length-1;i>=0;i--)n=(t*n+(0|this.words[i]))%e;return n},o.prototype.idivn=function(e){r(e<=67108863);for(var t=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*t;this.words[n]=i/e|0,t=i%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),c=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++c;for(var l=n.clone(),d=t.clone();!t.isZero();){for(var h=0,p=1;0==(t.words[0]&p)&&h<26;++h,p<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(l),a.isub(d)),i.iushrn(1),a.iushrn(1);for(var f=0,y=1;0==(n.words[0]&y)&&f<26;++f,y<<=1);if(f>0)for(n.iushrn(f);f-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(d)),s.iushrn(1),u.iushrn(1);t.cmp(n)>=0?(t.isub(n),i.isub(s),a.isub(u)):(n.isub(t),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:n.iushln(c)}},o.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,n=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,a=new o(1),s=new o(0),u=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var d=0,h=1;0==(n.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(n.iushrn(d);d-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.isub(t),s.isub(a))}return(i=0===t.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(e),i},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<<t;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(e){var t,n=e<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)t=1;else{n&&(e=-e),r(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},o.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},o.prototype.gtn=function(e){return 1===this.cmpn(e)},o.prototype.gt=function(e){return 1===this.cmp(e)},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return-1===this.cmpn(e)},o.prototype.lt=function(e){return-1===this.cmp(e)},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return 0===this.cmpn(e)},o.prototype.eq=function(e){return 0===this.cmp(e)},o.red=function(e){return new A(e)},o.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var m={k256:null,p224:null,p192:null,p25519:null};function g(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function w(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function b(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function M(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=o._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){A.call(this,e),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)}g.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<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},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},i(v,g),v.prototype.split=function(e,t){for(var n=Math.min(e.length,9),r=0;r<n;r++)t.words[r]=e.words[r];if(t.length=n,e.length<=9)return e.words[0]=0,void(e.length=1);var i=e.words[9];for(t.words[t.length++]=4194303&i,r=10;r<e.length;r++){var o=0|e.words[r];e.words[r-10]=(4194303&o)<<4|i>>>22,i=o}i>>>=22,e.words[r-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},v.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(w,g),i(b,g),i(M,g),M.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},o._prime=function(e){if(m[e])return m[e];var t;if("k256"===e)t=new v;else if("p224"===e)t=new w;else if("p192"===e)t=new b;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new M}return m[e]=t,t},A.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},A.prototype._verify2=function(e,t){r(0==(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},A.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},A.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},A.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},A.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},A.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},A.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},A.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},A.prototype.isqr=function(e){return this.imul(e,e.clone())},A.prototype.sqr=function(e){return this.mul(e,e)},A.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2==1),3===t){var n=this.m.add(new o(1)).iushrn(2);return this.pow(e,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 d=this.pow(l,i),h=this.pow(e,i.addn(1).iushrn(1)),p=this.pow(e,i),f=a;0!==p.cmp(s);){for(var y=p,m=0;0!==y.cmp(s);m++)y=y.redSqr();r(m<f);var g=this.pow(d,new o(1).iushln(f-m-1));h=h.redMul(g),d=g.redSqr(),p=p.redMul(d),f=m}return h},A.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},A.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new o(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var i=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var d=c>>l&1;i!==n[0]&&(i=this.sqr(i)),0!==d||0!==a?(a<<=1,a|=d,(4==++s||0===r&&0===l)&&(i=this.mul(i,n[a]),s=0,a=0)):s=0}u=26}return i},A.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},A.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new E(e)},i(E,A),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),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(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var n=e.mul(t),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)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,this)}).call(this,n(54)(e))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});const r=n(60);r.__exportStar(n(61),t),r.__exportStar(n(62),t)},function(e,t,n){(function(e){
|
|
11
11
|
/*!
|
|
12
12
|
* The buffer module from node.js, for the browser.
|