!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).layeredToolkit=t()}(this,(function(){"use strict";function e(t){return e="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(t)}function t(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,r||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}function r(e,r,n){return(r=t(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t>18&63]+l[i>>12&63]+l[i>>6&63]+l[63&i]);return o.join("")}function b(e){var t;h||p();for(var r=e.length,n=r%3,i="",o=[],a=16383,s=0,c=r-n;sc?c:s+a));return 1===n?(t=e[r-1],i+=l[t>>2],i+=l[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=l[t>>10],i+=l[t>>4&63],i+=l[t<<2&63],i+="="),o.push(i),o.join("")}function g(e,t,r,n,i){var o,a,s=8*i-n-1,c=(1<>1,l=-7,f=r?i-1:0,d=r?-1:1,h=e[t+f];for(f+=d,o=h&(1<<-l)-1,h>>=-l,l+=s;l>0;o=256*o+e[t+f],f+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=n;l>0;a=256*a+e[t+f],f+=d,l-=8);if(0===o)o=1-u;else{if(o===c)return a?NaN:1/0*(h?-1:1);a+=Math.pow(2,n),o-=u}return(h?-1:1)*a*Math.pow(2,o-n)}function y(e,t,r,n,i,o){var a,s,c,u=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,m=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*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+f>=1?d/c:d*Math.pow(2,1-f))*c>=2&&(a++,c/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(t*c-1)*Math.pow(2,i),a+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[r+h]=255&s,h+=p,s/=256,i-=8);for(a=a<0;e[r+h]=255&a,h+=p,a/=256,u-=8);e[r+h-p]|=128*m}var v={}.toString,w=Array.isArray||function(e){return"[object Array]"==v.call(e)};_.TYPED_ARRAY_SUPPORT=void 0===u.TYPED_ARRAY_SUPPORT||u.TYPED_ARRAY_SUPPORT;var E=A();function A(){return _.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function x(e,t){if(A()=A())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+A().toString(16)+" bytes");return 0|e}function O(e){return!(null==e||!e._isBuffer)}function M(e,t){if(O(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 r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return ie(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return oe(e).length;default:if(n)return ie(e).length;t=(""+t).toLowerCase(),n=!0}}function C(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return V(this,t,r);case"utf8":case"utf-8":return H(this,t,r);case"ascii":return q(this,t,r);case"latin1":case"binary":return K(this,t,r);case"base64":return $(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function B(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function N(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=_.from(t,n)),O(t))return 0===t.length?-1:R(e,t,r,n,i);if("number"==typeof t)return t&=255,_.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):R(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function R(e,t,r,n,i){var o,a=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=r;os&&(r=s-c),o=r;o>=0;o--){for(var f=!0,d=0;di&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function $(e,t,r){return 0===t&&r===e.length?b(e):b(e.slice(t,r))}function H(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:u>223?3:u>191?2:1;if(i+f<=r)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(c=(15&u)<<12|(63&o)<<6|63&a)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(c=(15&u)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=G)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},_.prototype.compare=function(e,t,r,n,i){if(!O(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(o,a),c=this.slice(n,i),u=e.slice(t,r),l=0;li)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return F(this,e,t,r);case"utf8":case"utf-8":return L(this,e,t,r);case"ascii":return U(this,e,t,r);case"latin1":case"binary":return j(this,e,t,r);case"base64":return D(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var G=4096;function q(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",o=t;or)throw new RangeError("Trying to access beyond buffer length")}function Z(e,t,r,n,i,o){if(!O(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function Y(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i>>8*(n?i:1-i)}function X(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i>>8*(n?i:3-i)&255}function Q(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function ee(e,t,r,n,i){return i||Q(e,0,r,4),y(e,t,r,n,23,4),r+4}function te(e,t,r,n,i){return i||Q(e,0,r,8),y(e,t,r,n,52,8),r+8}_.prototype.slice=function(e,t){var r,n=this.length;if((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),t0&&(i*=256);)n+=this[e+--t]*i;return n},_.prototype.readUInt8=function(e,t){return t||J(e,1,this.length),this[e]},_.prototype.readUInt16LE=function(e,t){return t||J(e,2,this.length),this[e]|this[e+1]<<8},_.prototype.readUInt16BE=function(e,t){return t||J(e,2,this.length),this[e]<<8|this[e+1]},_.prototype.readUInt32LE=function(e,t){return t||J(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},_.prototype.readUInt32BE=function(e,t){return t||J(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},_.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=this[e],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*t)),n},_.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||J(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},_.prototype.readInt8=function(e,t){return t||J(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},_.prototype.readInt16LE=function(e,t){t||J(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},_.prototype.readInt16BE=function(e,t){t||J(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},_.prototype.readInt32LE=function(e,t){return t||J(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},_.prototype.readInt32BE=function(e,t){return t||J(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},_.prototype.readFloatLE=function(e,t){return t||J(e,4,this.length),g(this,e,!0,23,4)},_.prototype.readFloatBE=function(e,t){return t||J(e,4,this.length),g(this,e,!1,23,4)},_.prototype.readDoubleLE=function(e,t){return t||J(e,8,this.length),g(this,e,!0,52,8)},_.prototype.readDoubleBE=function(e,t){return t||J(e,8,this.length),g(this,e,!1,52,8)},_.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||Z(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+r},_.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,1,255,0),_.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},_.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Y(this,e,t,!0),t+2},_.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,65535,0),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Y(this,e,t,!1),t+2},_.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,4294967295,0),_.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):X(this,e,t,!0),t+4},_.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,4294967295,0),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):X(this,e,t,!1),t+4},_.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Z(this,e,t,r,i-1,-i)}var o=0,a=1,s=0;for(this[t]=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+r},_.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,1,127,-128),_.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},_.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Y(this,e,t,!0),t+2},_.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,2,32767,-32768),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Y(this,e,t,!1),t+2},_.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,2147483647,-2147483648),_.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):X(this,e,t,!0),t+4},_.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Z(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),_.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):X(this,e,t,!1),t+4},_.prototype.writeFloatLE=function(e,t,r){return ee(this,e,t,!0,r)},_.prototype.writeFloatBE=function(e,t,r){return ee(this,e,t,!1,r)},_.prototype.writeDoubleLE=function(e,t,r){return te(this,e,t,!0,r)},_.prototype.writeDoubleBE=function(e,t,r){return te(this,e,t,!1,r)},_.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t=0;--i)e[i+t]=this[i+r];else if(o<1e3||!_.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function oe(e){return function(e){var t,r,n,i,o,a;h||p();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 d(3*s/4-o),n=o>0?s-4:s;var c=0;for(t=0,r=0;t>16&255,a[c++]=i>>8&255,a[c++]=255&i;return 2===o?(i=f[e.charCodeAt(t)]<<2|f[e.charCodeAt(t+1)]>>4,a[c++]=255&i):1===o&&(i=f[e.charCodeAt(t)]<<10|f[e.charCodeAt(t+1)]<<4|f[e.charCodeAt(t+2)]>>2,a[c++]=i>>8&255,a[c++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(re,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ae(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function se(e){return null!=e&&(!!e._isBuffer||ce(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&ce(e.slice(0,0))}(e))}function ce(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var ue,le=Object.freeze({__proto__:null,Buffer:_,INSPECT_MAX_BYTES:50,SlowBuffer:function(e){return+e!=e&&(e=0),_.alloc(+e)},isBuffer:se,kMaxLength:E}),fe=s(le),de={ArrayIsArray:e=>Array.isArray(e),ArrayPrototypeIncludes:(e,t)=>e.includes(t),ArrayPrototypeIndexOf:(e,t)=>e.indexOf(t),ArrayPrototypeJoin:(e,t)=>e.join(t),ArrayPrototypeMap:(e,t)=>e.map(t),ArrayPrototypePop:(e,t)=>e.pop(t),ArrayPrototypePush:(e,t)=>e.push(t),ArrayPrototypeSlice:(e,t,r)=>e.slice(t,r),Error:Error,FunctionPrototypeCall:(e,t,...r)=>e.call(t,...r),FunctionPrototypeSymbolHasInstance:(e,t)=>Function.prototype[Symbol.hasInstance].call(e,t),MathFloor:Math.floor,Number:Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(e,t)=>Object.defineProperties(e,t),ObjectDefineProperty:(e,t,r)=>Object.defineProperty(e,t,r),ObjectGetOwnPropertyDescriptor:(e,t)=>Object.getOwnPropertyDescriptor(e,t),ObjectKeys:e=>Object.keys(e),ObjectSetPrototypeOf:(e,t)=>Object.setPrototypeOf(e,t),Promise:Promise,PromisePrototypeCatch:(e,t)=>e.catch(t),PromisePrototypeThen:(e,t,r)=>e.then(t,r),PromiseReject:e=>Promise.reject(e),PromiseResolve:e=>Promise.resolve(e),ReflectApply:Reflect.apply,RegExpPrototypeTest:(e,t)=>e.test(t),SafeSet:Set,String:String,StringPrototypeSlice:(e,t,r)=>e.slice(t,r),StringPrototypeToLowerCase:e=>e.toLowerCase(),StringPrototypeToUpperCase:e=>e.toUpperCase(),StringPrototypeTrim:e=>e.trim(),Symbol:Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet:(e,t,r)=>e.set(t,r),Boolean:Boolean,Uint8Array:Uint8Array},he={exports:{}},pe={exports:{}};function me(){if(ue)return pe.exports;ue=1;const{AbortController:e,AbortSignal:t}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;return pe.exports=e,pe.exports.AbortSignal=t,pe.exports.default=e,pe.exports}function be(){}function ge(){ge.init.call(this)}function ye(e){return void 0===e._maxListeners?ge.defaultMaxListeners:e._maxListeners}function ve(e,t,r,n){var i,o,a,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]):(o=e._events=new be,e._eventsCount=0),a){if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),!a.warned&&(i=ye(e))&&i>0&&a.length>i){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,"function"==typeof console.warn?console.warn(s):console.log(s)}}else a=o[t]=r,++e._eventsCount;return e}function we(e,t,r){var n=!1;function i(){e.removeListener(t,i),n||(n=!0,r.apply(e,arguments))}return i.listener=r,i}function Ee(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function Ae(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}be.prototype=Object.create(null),ge.EventEmitter=ge,ge.usingDomains=!1,ge.prototype.domain=void 0,ge.prototype._events=void 0,ge.prototype._maxListeners=void 0,ge.defaultMaxListeners=10,ge.init=function(){this.domain=null,ge.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new be,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ge.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ge.prototype.getMaxListeners=function(){return ye(this)},ge.prototype.emit=function(e){var t,r,n,i,o,a,s,c="error"===e;if(a=this._events)c=c&&null==a.error;else if(!c)return!1;if(s=this.domain,c){if(t=arguments[1],!s){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=s,t.domainThrown=!1,s.emit("error",t),!1}if(!(r=a[e]))return!1;var l="function"==typeof r;switch(n=arguments.length){case 1:!function(e,t,r){if(t)e.call(r);else for(var n=e.length,i=Ae(e,n),o=0;o0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new be,this;delete n[e]}else!function(e,t){for(var r=t,n=r+1,i=e.length;n0?Reflect.ownKeys(this._events):[]};var xe=s(Object.freeze({__proto__:null,EventEmitter:ge,default:ge}));!function(e){const t=fe,{kResistStopPropagation:r,SymbolDispose:n}=de,i=globalThis.AbortSignal||me().AbortSignal,o=globalThis.AbortController||me().AbortController,a=Object.getPrototypeOf((async function(){})).constructor,s=globalThis.Blob||t.Blob,c=void 0!==s?function(e){return e instanceof s}:function(e){return!1},u=(e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new ERR_INVALID_ARG_TYPE(t,"AbortSignal",e)};class l extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError("Expected input to be an Array, got "+typeof e);let t="";for(let r=0;r{e=r,t=n})),resolve:e,reject:t}},promisify:e=>new Promise(((t,r)=>{e(((e,...n)=>e?r(e):t(...n)))})),debuglog:()=>function(){},format:(e,...t)=>e.replace(/%([sdifj])/g,(function(...[e,r]){const n=t.shift();if("f"===r)return n.toFixed(6);if("j"===r)return JSON.stringify(n);if("s"===r&&"object"==typeof n){return`${n.constructor!==Object?n.constructor.name:""} {}`.trim()}return n.toString()})),inspect(e){switch(typeof e){case"string":if(e.includes("'")){if(!e.includes('"'))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}},types:{isAsyncFunction:e=>e instanceof a,isArrayBufferView:e=>ArrayBuffer.isView(e)},isBlob:c,deprecate:(e,t)=>e,addAbortListener:xe.addAbortListener||function(e,t){if(void 0===e)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);let i;return u(e,"signal"),((e,t)=>{if("function"!=typeof e)throw new ERR_INVALID_ARG_TYPE(t,"Function",e)})(t,"listener"),e.aborted?queueMicrotask((()=>t())):(e.addEventListener("abort",t,{__proto__:null,once:!0,[r]:!0}),i=()=>{e.removeEventListener("abort",t)}),{__proto__:null,[n](){var e;null===(e=i)||void 0===e||e()}}},AbortSignalAny:i.any||function(e){if(1===e.length)return e[0];const t=new o,r=()=>t.abort();return e.forEach((e=>{u(e,"signals"),e.addEventListener("abort",r,{once:!0})})),t.signal.addEventListener("abort",(()=>{e.forEach((e=>e.removeEventListener("abort",r)))}),{once:!0}),t.signal}},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(he);var _e=he.exports,ke={};const{format:Se,inspect:Pe,AggregateError:Ie}=_e,Te=globalThis.AggregateError||Ie,Oe=Symbol("kIsNodeError"),Me=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Ce=/^([A-Z][a-z0-9]*)+$/,Be={};function Ne(e,t){if(!e)throw new Be.ERR_INTERNAL_ASSERTION(t)}function Re(e){let t="",r=e.length;const n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function Fe(e,t,r){r||(r=Error);class n extends r{constructor(...r){super(function(e,t,r){if("function"==typeof t)return Ne(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);const n=(t.match(/%[dfijoOs]/g)||[]).length;return Ne(n===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),0===r.length?t:Se(t,...r)}(e,t,r))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=e,n.prototype[Oe]=!0,Be[e]=n}function Le(e){const t="__node_internal_"+e.name;return Object.defineProperty(e,"name",{value:t}),e}let Ue=class extends Error{constructor(e="The operation was aborted",t=void 0){if(void 0!==t&&"object"!=typeof t)throw new Be.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}};Fe("ERR_ASSERTION","%s",Error),Fe("ERR_INVALID_ARG_TYPE",((e,t,r)=>{Ne("string"==typeof e,"'name' must be a string"),Array.isArray(t)||(t=[t]);let n="The ";e.endsWith(" argument")?n+=`${e} `:n+=`"${e}" ${e.includes(".")?"property":"argument"} `,n+="must be ";const i=[],o=[],a=[];for(const e of t)Ne("string"==typeof e,"All expected entries have to be of type string"),Me.includes(e)?i.push(e.toLowerCase()):Ce.test(e)?o.push(e):(Ne("object"!==e,'The value "object" should be written as "Object"'),a.push(e));if(o.length>0){const e=i.indexOf("object");-1!==e&&(i.splice(i,e,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{const e=i.pop();n+=`one of type ${i.join(", ")}, or ${e}`}}(o.length>0||a.length>0)&&(n+=" or ")}if(o.length>0){switch(o.length){case 1:n+=`an instance of ${o[0]}`;break;case 2:n+=`an instance of ${o[0]} or ${o[1]}`;break;default:{const e=o.pop();n+=`an instance of ${o.join(", ")}, or ${e}`}}a.length>0&&(n+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(n+="an "),n+=`${a[0]}`;break;case 2:n+=`one of ${a[0]} or ${a[1]}`;break;default:{const e=a.pop();n+=`one of ${a.join(", ")}, or ${e}`}}if(null==r)n+=`. Received ${r}`;else if("function"==typeof r&&r.name)n+=`. Received function ${r.name}`;else if("object"==typeof r){var s;if(null!==(s=r.constructor)&&void 0!==s&&s.name)n+=`. Received an instance of ${r.constructor.name}`;else{n+=`. Received ${Pe(r,{depth:-1})}`}}else{let e=Pe(r,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),n+=`. Received type ${typeof r} (${e})`}return n}),TypeError),Fe("ERR_INVALID_ARG_VALUE",((e,t,r="is invalid")=>{let n=Pe(t);n.length>128&&(n=n.slice(0,128)+"...");return`The ${e.includes(".")?"property":"argument"} '${e}' ${r}. Received ${n}`}),TypeError),Fe("ERR_INVALID_RETURN_VALUE",((e,t,r)=>{var n;return`Expected ${e} to be returned from the "${t}" function but got ${null!=r&&null!==(n=r.constructor)&&void 0!==n&&n.name?`instance of ${r.constructor.name}`:"type "+typeof r}.`}),TypeError),Fe("ERR_MISSING_ARGS",((...e)=>{let t;Ne(e.length>0,"At least one arg needs to be specified");const r=e.length;switch(e=(Array.isArray(e)?e:[e]).map((e=>`"${e}"`)).join(" or "),r){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`}}return`${t} must be specified`}),TypeError),Fe("ERR_OUT_OF_RANGE",((e,t,r)=>{let n;return Ne(t,'Missing "range" argument'),Number.isInteger(r)&&Math.abs(r)>2**32?n=Re(String(r)):"bigint"==typeof r?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=Re(n)),n+="n"):n=Pe(r),`The value of "${e}" is out of range. It must be ${t}. Received ${n}`}),RangeError),Fe("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),Fe("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),Fe("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),Fe("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),Fe("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),Fe("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),Fe("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),Fe("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),Fe("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),Fe("ERR_STREAM_WRITE_AFTER_END","write after end",Error),Fe("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var je={AbortError:Ue,aggregateTwoErrors:Le((function(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const r=new Te([t,e],t.message);return r.code=t.code,r}return e||t})),hideStackFrames:Le,codes:Be};const{ArrayIsArray:De,ArrayPrototypeIncludes:ze,ArrayPrototypeJoin:$e,ArrayPrototypeMap:He,NumberIsInteger:Ge,NumberIsNaN:qe,NumberMAX_SAFE_INTEGER:Ke,NumberMIN_SAFE_INTEGER:Ve,NumberParseInt:We,ObjectPrototypeHasOwnProperty:Je,RegExpPrototypeExec:Ze,String:Ye,StringPrototypeToUpperCase:Xe,StringPrototypeTrim:Qe}=de,{hideStackFrames:et,codes:{ERR_SOCKET_BAD_PORT:tt,ERR_INVALID_ARG_TYPE:rt,ERR_INVALID_ARG_VALUE:nt,ERR_OUT_OF_RANGE:it,ERR_UNKNOWN_SIGNAL:ot}}=je,{normalizeEncoding:at}=_e,{isAsyncFunction:st,isArrayBufferView:ct}=_e.types,ut={};const lt=/^[0-7]+$/;const ft=et(((e,t,r=Ve,n=Ke)=>{if("number"!=typeof e)throw new rt(t,"number",e);if(!Ge(e))throw new it(t,"an integer",e);if(en)throw new it(t,`>= ${r} && <= ${n}`,e)})),dt=et(((e,t,r=-2147483648,n=2147483647)=>{if("number"!=typeof e)throw new rt(t,"number",e);if(!Ge(e))throw new it(t,"an integer",e);if(en)throw new it(t,`>= ${r} && <= ${n}`,e)})),ht=et(((e,t,r=!1)=>{if("number"!=typeof e)throw new rt(t,"number",e);if(!Ge(e))throw new it(t,"an integer",e);const n=r?1:0,i=4294967295;if(ei)throw new it(t,`>= ${n} && <= ${i}`,e)}));function pt(e,t){if("string"!=typeof e)throw new rt(t,"string",e)}const mt=et(((e,t,r)=>{if(!ze(r,e)){const n=$e(He(r,(e=>"string"==typeof e?`'${e}'`:Ye(e))),", ");throw new nt(t,e,"must be one of: "+n)}}));function bt(e,t){if("boolean"!=typeof e)throw new rt(t,"boolean",e)}function gt(e,t,r){return null!=e&&Je(e,t)?e[t]:r}const yt=et(((e,t,r=null)=>{const n=gt(r,"allowArray",!1),i=gt(r,"allowFunction",!1);if(!gt(r,"nullable",!1)&&null===e||!n&&De(e)||"object"!=typeof e&&(!i||"function"!=typeof e))throw new rt(t,"Object",e)})),vt=et(((e,t)=>{if(null!=e&&"object"!=typeof e&&"function"!=typeof e)throw new rt(t,"a dictionary",e)})),wt=et(((e,t,r=0)=>{if(!De(e))throw new rt(t,"Array",e);if(e.length{if(!ct(e))throw new rt(t,["Buffer","TypedArray","DataView"],e)}));const At=et(((e,t)=>{if(void 0!==e&&(null===e||"object"!=typeof e||!("aborted"in e)))throw new rt(t,"AbortSignal",e)})),xt=et(((e,t)=>{if("function"!=typeof e)throw new rt(t,"Function",e)})),_t=et(((e,t)=>{if("function"!=typeof e||st(e))throw new rt(t,"Function",e)})),kt=et(((e,t)=>{if(void 0!==e)throw new rt(t,"undefined",e)}));const St=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Pt(e,t){if(void 0===e||!Ze(St,e))throw new nt(t,e,'must be an array or string of format "; rel=preload; as=style"')}var It={isInt32:function(e){return e===(0|e)},isUint32:function(e){return e===e>>>0},parseFileMode:function(e,t,r){if(void 0===e&&(e=r),"string"==typeof e){if(null===Ze(lt,e))throw new nt(t,e,"must be a 32-bit unsigned integer or an octal string");e=We(e,8)}return ht(e,t),e},validateArray:wt,validateStringArray:function(e,t){wt(e,t);for(let r=0;rn||(null!=r||null!=n)&&qe(e))throw new it(t,`${null!=r?`>= ${r}`:""}${null!=r&&null!=n?" && ":""}${null!=n?`<= ${n}`:""}`,e)},validateObject:yt,validateOneOf:mt,validatePlainFunction:_t,validatePort:function(e,t="Port",r=!0){if("number"!=typeof e&&"string"!=typeof e||"string"==typeof e&&0===Qe(e).length||+e!=+e>>>0||e>65535||0===e&&!r)throw new tt(t,e,r);return 0|e},validateSignalName:function(e,t="signal"){if(pt(e,t),void 0===ut[e]){if(void 0!==ut[Xe(e)])throw new ot(e+" (signals must use all capital letters)");throw new ot(e)}},validateString:pt,validateUint32:ht,validateUndefined:kt,validateUnion:function(e,t,r){if(!ze(r,e))throw new rt(t,`('${$e(r,"|")}')`,e)},validateAbortSignal:At,validateLinkHeaderValue:function(e){if("string"==typeof e)return Pt(e,"hints"),e;if(De(e)){const t=e.length;let r="";if(0===t)return r;for(let n=0;n; rel=preload; as=style"')}},Tt={exports:{}};function Ot(){throw new Error("setTimeout has not been defined")}function Mt(){throw new Error("clearTimeout has not been defined")}var Ct=Ot,Bt=Mt;function Nt(e){if(Ct===setTimeout)return setTimeout(e,0);if((Ct===Ot||!Ct)&&setTimeout)return Ct=setTimeout,setTimeout(e,0);try{return Ct(e,0)}catch(t){try{return Ct.call(null,e,0)}catch(t){return Ct.call(this,e,0)}}}"function"==typeof u.setTimeout&&(Ct=setTimeout),"function"==typeof u.clearTimeout&&(Bt=clearTimeout);var Rt,Ft=[],Lt=!1,Ut=-1;function jt(){Lt&&Rt&&(Lt=!1,Rt.length?Ft=Rt.concat(Ft):Ut=-1,Ft.length&&Dt())}function Dt(){if(!Lt){var e=Nt(jt);Lt=!0;for(var t=Ft.length;t;){for(Rt=Ft,Ft=[];++Ut1)for(var r=1;r{};function gn(e,t,r){var n,i;if(2===arguments.length?(r=t,t=qr):null==t?t=qr:Jr(t,"options"),Wr(r,"callback"),Vr(t.signal,"options.signal"),r=Kr(r),nn(e)||un(e))return function(e,t,r){let n=!1,i=bn;if(t.signal)if(i=()=>{n=!0,r.call(e,new zr(void 0,{cause:t.signal.reason}))},t.signal.aborted)Dr.nextTick(i);else{mn=mn||_e.addAbortListener;const n=mn(t.signal,i),o=r;r=Kr(((...t)=>{n[Qr](),o.apply(e,t)}))}const o=(...t)=>{n||Dr.nextTick((()=>r.apply(e,t)))};return Xr(e[pn].promise,o,o),bn}(e,t,r);if(!dn(e))throw new Hr("stream",["ReadableStream","WritableStream","Stream"],e);const o=null!==(n=t.readable)&&void 0!==n?n:rn(e),a=null!==(i=t.writable)&&void 0!==i?i:cn(e),s=e._writableState,c=e._readableState,u=()=>{e.writable||d()};let l=hn(e)&&rn(e)===o&&cn(e)===a,f=ln(e,!1);const d=()=>{f=!0,e.destroyed&&(l=!1),(!l||e.readable&&!o)&&(o&&!h||r.call(e))};let h=on(e,!1);const p=()=>{h=!0,e.destroyed&&(l=!1),(!l||e.writable&&!a)&&(a&&!f||r.call(e))},m=t=>{r.call(e,t)};let b=en(e);const g=()=>{b=!0;const t=fn(e)||an(e);return t&&"boolean"!=typeof t?r.call(e,t):o&&!h&&rn(e,!0)&&!on(e,!1)?r.call(e,new Gr):!a||f||ln(e,!1)?void r.call(e):r.call(e,new Gr)},y=()=>{b=!0;const t=fn(e)||an(e);if(t&&"boolean"!=typeof t)return r.call(e,t);r.call(e)},v=()=>{e.req.on("finish",d)};!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?a&&!s&&(e.on("end",u),e.on("close",u)):(e.on("complete",d),l||e.on("abort",g),e.req?v():e.on("request",v)),l||"boolean"!=typeof e.aborted||e.on("aborted",g),e.on("end",p),e.on("finish",d),!1!==t.error&&e.on("error",m),e.on("close",g),b?Dr.nextTick(g):null!=s&&s.errorEmitted||null!=c&&c.errorEmitted?l||Dr.nextTick(y):(o||l&&!tn(e)||!f&&!1!==sn(e))&&(a||l&&!sn(e)||!h&&!1!==tn(e))?c&&e.req&&e.aborted&&Dr.nextTick(y):Dr.nextTick(y);const w=()=>{r=bn,e.removeListener("aborted",g),e.removeListener("complete",d),e.removeListener("abort",g),e.removeListener("request",v),e.req&&e.req.removeListener("finish",d),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",d),e.removeListener("end",p),e.removeListener("error",m),e.removeListener("close",g)};if(t.signal&&!b){const n=()=>{const n=r;w(),n.call(e,new zr(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)Dr.nextTick(n);else{mn=mn||_e.addAbortListener;const i=mn(t.signal,n),o=r;r=Kr(((...t)=>{i[Qr](),o.apply(e,t)}))}}return w}Tt.exports=gn,Tt.exports.finished=function(e,t){var r;let n=!1;return null===t&&(t=qr),null!==(r=t)&&void 0!==r&&r.cleanup&&(Zr(t.cleanup,"cleanup"),n=t.cleanup),new Yr(((r,i)=>{const o=gn(e,t,(e=>{n&&o(),e?i(e):r()}))}))};var yn=Tt.exports;const vn=mr,{aggregateTwoErrors:wn,codes:{ERR_MULTIPLE_CALLBACK:En},AbortError:An}=je,{Symbol:xn}=de,{kIsDestroyed:_n,isDestroyed:kn,isFinished:Sn,isServerRequest:Pn}=jr,In=xn("kDestroy"),Tn=xn("kConstruct");function On(e,t,r){e&&(e.stack,t&&!t.errored&&(t.errored=e),r&&!r.errored&&(r.errored=e))}function Mn(e,t,r){let n=!1;function i(t){if(n)return;n=!0;const i=e._readableState,o=e._writableState;On(t,o,i),o&&(o.closed=!0),i&&(i.closed=!0),"function"==typeof r&&r(t),t?vn.nextTick(Cn,e,t):vn.nextTick(Bn,e)}try{e._destroy(t||null,i)}catch(t){i(t)}}function Cn(e,t){Nn(e,t),Bn(e)}function Bn(e){const t=e._readableState,r=e._writableState;r&&(r.closeEmitted=!0),t&&(t.closeEmitted=!0),(null!=r&&r.emitClose||null!=t&&t.emitClose)&&e.emit("close")}function Nn(e,t){const r=e._readableState,n=e._writableState;null!=n&&n.errorEmitted||null!=r&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),e.emit("error",t))}function Rn(e,t,r){const n=e._readableState,i=e._writableState;if(null!=i&&i.destroyed||null!=n&&n.destroyed)return this;null!=n&&n.autoDestroy||null!=i&&i.autoDestroy?e.destroy(t):t&&(t.stack,i&&!i.errored&&(i.errored=t),n&&!n.errored&&(n.errored=t),r?vn.nextTick(Nn,e,t):Nn(e,t))}function Fn(e){let t=!1;function r(r){if(t)return void Rn(e,null!=r?r:new En);t=!0;const n=e._readableState,i=e._writableState,o=i||n;n&&(n.constructed=!0),i&&(i.constructed=!0),o.destroyed?e.emit(In,r):r?Rn(e,r,!0):vn.nextTick(Ln,e)}try{e._construct((e=>{vn.nextTick(r,e)}))}catch(e){vn.nextTick(r,e)}}function Ln(e){e.emit(Tn)}function Un(e){return(null==e?void 0:e.setHeader)&&"function"==typeof e.abort}function jn(e){e.emit("close")}function Dn(e,t){e.emit("error",t),vn.nextTick(jn,e)}var zn={construct:function(e,t){if("function"!=typeof e._construct)return;const r=e._readableState,n=e._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),e.once(Tn,t),e.listenerCount(Tn)>1||vn.nextTick(Fn,e)},destroyer:function(e,t){e&&!kn(e)&&(t||Sn(e)||(t=new An),Pn(e)?(e.socket=null,e.destroy(t)):Un(e)?e.abort():Un(e.req)?e.req.abort():"function"==typeof e.destroy?e.destroy(t):"function"==typeof e.close?e.close():t?vn.nextTick(Dn,e,t):vn.nextTick(jn,e),e.destroyed||(e[_n]=!0))},destroy:function(e,t){const r=this._readableState,n=this._writableState,i=n||r;return null!=n&&n.destroyed||null!=r&&r.destroyed?("function"==typeof t&&t(),this):(On(e,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Mn(this,e,t):this.once(In,(function(r){Mn(this,wn(r,e),t)})),this)},undestroy:function(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=!1===e.readable,e.endEmitted=!1===e.readable),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=!1===t.writable,t.ending=!1===t.writable,t.finished=!1===t.writable)},errorOrDestroy:Rn};const{ArrayIsArray:$n,ObjectSetPrototypeOf:Hn}=de,{EventEmitter:Gn}=xe;function qn(e){Gn.call(this,e)}function Kn(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?$n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}Hn(qn.prototype,Gn.prototype),Hn(qn,Gn),qn.prototype.pipe=function(e,t){const r=this;function n(t){e.writable&&!1===e.write(t)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),e.on("drain",i),e._isStdio||t&&!1===t.end||(r.on("end",a),r.on("close",s));let o=!1;function a(){o||(o=!0,e.end())}function s(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function c(e){u(),0===Gn.listenerCount(this,"error")&&this.emit("error",e)}function u(){r.removeListener("data",n),e.removeListener("drain",i),r.removeListener("end",a),r.removeListener("close",s),r.removeListener("error",c),e.removeListener("error",c),r.removeListener("end",u),r.removeListener("close",u),e.removeListener("close",u)}return Kn(r,"error",c),Kn(e,"error",c),r.on("end",u),r.on("close",u),e.on("close",u),e.emit("pipe",r),e};var Vn={Stream:qn,prependListener:Kn},Wn={exports:{}};!function(e){const{SymbolDispose:t}=de,{AbortError:r,codes:n}=je,{isNodeStream:i,isWebStream:o,kControllerErrorFunction:a}=jr,s=yn,{ERR_INVALID_ARG_TYPE:c}=n;let u;e.exports.addAbortSignal=function(t,r){if(((e,t)=>{if("object"!=typeof e||!("aborted"in e))throw new c(t,"AbortSignal",e)})(t,"signal"),!i(r)&&!o(r))throw new c("stream",["ReadableStream","WritableStream","Stream"],r);return e.exports.addAbortSignalNoValidate(t,r)},e.exports.addAbortSignalNoValidate=function(e,n){if("object"!=typeof e||!("aborted"in e))return n;const o=i(n)?()=>{n.destroy(new r(void 0,{cause:e.reason}))}:()=>{n[a](new r(void 0,{cause:e.reason}))};if(e.aborted)o();else{u=u||_e.addAbortListener;const r=u(e,o);s(n,r[t])}return n}}(Wn);var Jn=Wn.exports;const{StringPrototypeSlice:Zn,SymbolIterator:Yn,TypedArrayPrototypeSet:Xn,Uint8Array:Qn}=de,{Buffer:ei}=fe,{inspect:ti}=_e;var ri=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}shift(){if(0===this.length)return;const e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(0===this.length)return"";let t=this.head,r=""+t.data;for(;null!==(t=t.next);)r+=e+t.data;return r}concat(e){if(0===this.length)return ei.alloc(0);const t=ei.allocUnsafe(e>>>0);let r=this.head,n=0;for(;r;)Xn(t,r.data,n),n+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(ei.length)){e===i.length?(t+=i,++n,r.next?this.head=r.next:this.head=this.tail=null):(t+=Zn(i,0,e),this.head=r,r.data=Zn(i,e));break}t+=i,e-=i.length,++n}while(null!==(r=r.next));return this.length-=n,t}_getBuffer(e){const t=ei.allocUnsafe(e),r=e;let n=this.head,i=0;do{const o=n.data;if(!(e>o.length)){e===o.length?(Xn(t,o,r-e),++i,n.next?this.head=n.next:this.head=this.tail=null):(Xn(t,new Qn(o.buffer,o.byteOffset,e),r-e),this.head=n,n.data=o.slice(e));break}Xn(t,o,r-e),e-=o.length,++i}while(null!==(n=n.next));return this.length-=i,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return ti(this,{...t,depth:0,customInspect:!1})}};const{MathFloor:ni,NumberIsInteger:ii}=de,{validateInteger:oi}=It,{ERR_INVALID_ARG_VALUE:ai}=je.codes;let si=16384,ci=16;function ui(e){return e?ci:si}var li={getHighWaterMark:function(e,t,r,n){const i=function(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}(t,n,r);if(null!=i){if(!ii(i)||i<0){throw new ai(n?`options.${r}`:"options.highWaterMark",i)}return ni(i)}return ui(e.objectMode)},getDefaultHighWaterMark:ui,setDefaultHighWaterMark:function(e,t){oi(t,"value",0),e?ci=t:si=t}},fi=_.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function di(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),function(e){if(e&&!fi(e))throw new Error("Unknown encoding: "+e)}(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=pi;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=mi;break;default:return void(this.write=hi)}this.charBuffer=new _(6),this.charReceived=0,this.charLength=0}function hi(e){return e.toString(this.encoding)}function pi(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function mi(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}di.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived=55296&&i<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived);var i;n=(t+=e.toString(this.encoding,0,n)).length-1;if((i=t.charCodeAt(n))>=55296&&i<=56319){var o=this.surrogateSize;return this.charLength+=o,this.charReceived+=o,this.charBuffer.copy(this.charBuffer,o,0,o),e.copy(this.charBuffer,0,0,o),t.substring(0,n)}return t},di.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t},di.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t};var bi=s(Object.freeze({__proto__:null,StringDecoder:di}));const gi=mr,{PromisePrototypeThen:yi,SymbolAsyncIterator:vi,SymbolIterator:wi}=de,{Buffer:Ei}=fe,{ERR_INVALID_ARG_TYPE:Ai,ERR_STREAM_NULL_VALUES:xi}=je.codes;var _i,ki,Si,Pi,Ii,Ti,Oi,Mi,Ci=function(e,t,r){let n,i;if("string"==typeof t||t instanceof Ei)return new e({objectMode:!0,...r,read(){this.push(t),this.push(null)}});if(t&&t[vi])i=!0,n=t[vi]();else{if(!t||!t[wi])throw new Ai("iterable",["Iterable"],t);i=!1,n=t[wi]()}const o=new e({objectMode:!0,highWaterMark:1,...r});let a=!1;return o._read=function(){a||(a=!0,async function(){for(;;){try{const{value:e,done:t}=i?await n.next():n.next();if(t)o.push(null);else{const t=e&&"function"==typeof e.then?await e:e;if(null===t)throw a=!1,new xi;if(o.push(t))continue;a=!1}}catch(e){o.destroy(e)}break}}())},o._destroy=function(e,t){yi(async function(e){const t=null!=e,r="function"==typeof n.throw;if(t&&r){const{value:t,done:r}=await n.throw(e);if(await t,r)return}if("function"==typeof n.return){const{value:e}=await n.return();await e}}(e),(()=>gi.nextTick(t,e)),(r=>gi.nextTick(t,r||e)))},o};function Bi(){if(ki)return _i;ki=1;const e=mr,{ArrayPrototypeIndexOf:t,NumberIsInteger:r,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:o,ObjectKeys:a,ObjectSetPrototypeOf:s,Promise:c,SafeSet:u,SymbolAsyncDispose:l,SymbolAsyncIterator:f,Symbol:d}=de;_i=K,K.ReadableState=q;const{EventEmitter:h}=xe,{Stream:p,prependListener:m}=Vn,{Buffer:b}=fe,{addAbortSignal:g}=Jn,y=yn;let v=_e.debuglog("stream",(e=>{v=e}));const w=ri,E=zn,{getHighWaterMark:A,getDefaultHighWaterMark:x}=li,{aggregateTwoErrors:_,codes:{ERR_INVALID_ARG_TYPE:k,ERR_METHOD_NOT_IMPLEMENTED:S,ERR_OUT_OF_RANGE:P,ERR_STREAM_PUSH_AFTER_EOF:I,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:T},AbortError:O}=je,{validateObject:M}=It,C=d("kPaused"),{StringDecoder:B}=bi,N=Ci;s(K.prototype,p.prototype),s(K,p);const R=()=>{},{errorOrDestroy:F}=E,L=1,U=16,j=32,D=64,z=2048,$=4096,H=65536;function G(e){return{enumerable:!1,get(){return!!(this.state&e)},set(t){t?this.state|=e:this.state&=~e}}}function q(e,t,r){"boolean"!=typeof r&&(r=t instanceof Fi()),this.state=z|$|U|j,e&&e.objectMode&&(this.state|=L),r&&e&&e.readableObjectMode&&(this.state|=L),this.highWaterMark=e?A(this,e,"readableHighWaterMark",r):x(!1),this.buffer=new w,this.length=0,this.pipes=[],this.flowing=null,this[C]=null,e&&!1===e.emitClose&&(this.state&=~z),e&&!1===e.autoDestroy&&(this.state&=~$),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new B(e.encoding),this.encoding=e.encoding)}function K(e){if(!(this instanceof K))return new K(e);const t=this instanceof Fi();this._readableState=new q(e,this,t),e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.construct&&(this._construct=e.construct),e.signal&&!t&&g(e.signal,this)),p.call(this,e),E.construct(this,(()=>{this._readableState.needReadable&&X(this,this._readableState)}))}function V(e,t,r,n){v("readableAddChunk",t);const i=e._readableState;let o;if(i.state&L||("string"==typeof t?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?t=b.from(t,r).toString(i.encoding):(t=b.from(t,r),r=""))):t instanceof b?r="":p._isUint8Array(t)?(t=p._uint8ArrayToBuffer(t),r=""):null!=t&&(o=new k("chunk",["string","Buffer","Uint8Array"],t))),o)F(e,o);else if(null===t)i.state&=-9,function(e,t){if(v("onEofChunk"),t.ended)return;if(t.decoder){const e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?Z(e):(t.needReadable=!1,t.emittedReadable=!0,Y(e))}(e,i);else if(i.state&L||t&&t.length>0)if(n)if(4&i.state)F(e,new T);else{if(i.destroyed||i.errored)return!1;W(e,i,t,!0)}else if(i.ended)F(e,new I);else{if(i.destroyed||i.errored)return!1;i.state&=-9,i.decoder&&!r?(t=i.decoder.write(t),i.objectMode||0!==t.length?W(e,i,t,!1):X(e,i)):W(e,i,t,!1)}else n||(i.state&=-9,X(e,i));return!i.ended&&(i.length0?(t.state&H?t.awaitDrainWriters.clear():t.awaitDrainWriters=null,t.dataEmitted=!0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.state&D&&Z(e)),X(e,t)}o(q.prototype,{objectMode:G(L),ended:G(2),endEmitted:G(4),reading:G(8),constructed:G(U),sync:G(j),needReadable:G(D),emittedReadable:G(128),readableListening:G(256),resumeScheduled:G(512),errorEmitted:G(1024),emitClose:G(z),autoDestroy:G($),destroyed:G(8192),closed:G(16384),closeEmitted:G(32768),multiAwaitDrain:G(H),readingMore:G(1<<17),dataEmitted:G(1<<18)}),K.prototype.destroy=E.destroy,K.prototype._undestroy=E.undestroy,K.prototype._destroy=function(e,t){t(e)},K.prototype[h.captureRejectionSymbol]=function(e){this.destroy(e)},K.prototype[l]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new O,this.destroy(e)),new c(((t,r)=>y(this,(n=>n&&n!==e?r(n):t(null)))))},K.prototype.push=function(e,t){return V(this,e,t,!1)},K.prototype.unshift=function(e,t){return V(this,e,t,!0)},K.prototype.isPaused=function(){const e=this._readableState;return!0===e[C]||!1===e.flowing},K.prototype.setEncoding=function(e){const t=new B(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;const r=this._readableState.buffer;let n="";for(const e of r)n+=t.write(e);return r.clear(),""!==n&&r.push(n),this._readableState.length=n.length,this};function J(e,t){return e<=0||0===t.length&&t.ended?0:t.state&L?1:n(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0}function Z(t){const r=t._readableState;v("emitReadable",r.needReadable,r.emittedReadable),r.needReadable=!1,r.emittedReadable||(v("emitReadable",r.flowing),r.emittedReadable=!0,e.nextTick(Y,t))}function Y(e){const t=e._readableState;v("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||t.errored||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,ne(e)}function X(t,r){!r.readingMore&&r.constructed&&(r.readingMore=!0,e.nextTick(Q,t,r))}function Q(e,t){for(;!t.reading&&!t.ended&&(t.length0,t.resumeScheduled&&!1===t[C]?t.flowing=!0:e.listenerCount("data")>0?e.resume():t.readableListening||(t.flowing=null)}function te(e){v("readable nexttick read 0"),e.read(0)}function re(e,t){v("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),ne(e),t.flowing&&!t.reading&&e.read(0)}function ne(e){const t=e._readableState;for(v("flow",t.flowing);t.flowing&&null!==e.read(););}function ie(e,t){"function"!=typeof e.read&&(e=K.wrap(e,{objectMode:!0}));const r=async function*(e,t){let r,n=R;function i(t){this===e?(n(),n=R):n=t}e.on("readable",i);const o=y(e,{writable:!1},(e=>{r=e?_(r,e):null,n(),n=R}));try{for(;;){const t=e.destroyed?null:e.read();if(null!==t)yield t;else{if(r)throw r;if(null===r)return;await new c(i)}}}catch(e){throw r=_(r,e),r}finally{!r&&!1===(null==t?void 0:t.destroyOnReturn)||void 0!==r&&!e._readableState.autoDestroy?(e.off("readable",i),o()):E.destroyer(e,null)}}(e,t);return r.stream=e,r}function oe(e,t){if(0===t.length)return null;let r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r}function ae(t){const r=t._readableState;v("endReadable",r.endEmitted),r.endEmitted||(r.ended=!0,e.nextTick(se,r,t))}function se(t,r){if(v("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&0===t.length)if(t.endEmitted=!0,r.emit("end"),r.writable&&!1===r.allowHalfOpen)e.nextTick(ce,r);else if(t.autoDestroy){const e=r._writableState;(!e||e.autoDestroy&&(e.finished||!1===e.writable))&&r.destroy()}}function ce(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}let ue;function le(){return void 0===ue&&(ue={}),ue}return K.prototype.read=function(e){v("read",e),void 0===e?e=NaN:r(e)||(e=i(e,10));const t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=function(e){if(e>1073741824)throw new P("size","<= 1GiB",e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,++e}(e)),0!==e&&(t.state&=-129),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return v("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?ae(this):Z(this),null;if(0===(e=J(e,t))&&t.ended)return 0===t.length&&ae(this),null;let o,a=!!(t.state&D);if(v("need readable",a),(0===t.length||t.length-e0?oe(e,t):null,null===o?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&ae(this)),null===o||t.errorEmitted||t.closeEmitted||(t.dataEmitted=!0,this.emit("data",o)),o},K.prototype._read=function(e){throw new S("_read()")},K.prototype.pipe=function(t,r){const n=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new u(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),v("pipe count=%d opts=%j",i.pipes.length,r);const o=(!r||!1!==r.end)&&t!==e.stdout&&t!==e.stderr?s:g;function a(e,r){v("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,function(){v("cleanup"),t.removeListener("close",p),t.removeListener("finish",b),c&&t.removeListener("drain",c);t.removeListener("error",h),t.removeListener("unpipe",a),n.removeListener("end",s),n.removeListener("end",g),n.removeListener("data",d),l=!0,c&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&c()}())}function s(){v("onend"),t.end()}let c;i.endEmitted?e.nextTick(o):n.once("end",o),t.on("unpipe",a);let l=!1;function f(){l||(1===i.pipes.length&&i.pipes[0]===t?(v("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(v("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),n.pause()),c||(c=function(e,t){return function(){const r=e._readableState;r.awaitDrainWriters===t?(v("pipeOnDrain",1),r.awaitDrainWriters=null):r.multiAwaitDrain&&(v("pipeOnDrain",r.awaitDrainWriters.size),r.awaitDrainWriters.delete(t)),r.awaitDrainWriters&&0!==r.awaitDrainWriters.size||!e.listenerCount("data")||e.resume()}}(n,t),t.on("drain",c))}function d(e){v("ondata");const r=t.write(e);v("dest.write",r),!1===r&&f()}function h(e){if(v("onerror",e),g(),t.removeListener("error",h),0===t.listenerCount("error")){const r=t._writableState||t._readableState;r&&!r.errorEmitted?F(t,e):t.emit("error",e)}}function p(){t.removeListener("finish",b),g()}function b(){v("onfinish"),t.removeListener("close",p),g()}function g(){v("unpipe"),n.unpipe(t)}return n.on("data",d),m(t,"error",h),t.once("close",p),t.once("finish",b),t.emit("pipe",n),!0===t.writableNeedDrain?f():i.flowing||(v("pipe resume"),n.resume()),t},K.prototype.unpipe=function(e){const r=this._readableState;if(0===r.pipes.length)return this;if(!e){const e=r.pipes;r.pipes=[],this.pause();for(let t=0;t0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,v("on readable",i.length,i.reading),i.length?Z(this):i.reading||e.nextTick(te,this))),n},K.prototype.addListener=K.prototype.on,K.prototype.removeListener=function(t,r){const n=p.prototype.removeListener.call(this,t,r);return"readable"===t&&e.nextTick(ee,this),n},K.prototype.off=K.prototype.removeListener,K.prototype.removeAllListeners=function(t){const r=p.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||e.nextTick(ee,this),r},K.prototype.resume=function(){const t=this._readableState;return t.flowing||(v("resume"),t.flowing=!t.readableListening,function(t,r){r.resumeScheduled||(r.resumeScheduled=!0,e.nextTick(re,t,r))}(this,t)),t[C]=!1,this},K.prototype.pause=function(){return v("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(v("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[C]=!0,this},K.prototype.wrap=function(e){let t=!1;e.on("data",(r=>{!this.push(r)&&e.pause&&(t=!0,e.pause())})),e.on("end",(()=>{this.push(null)})),e.on("error",(e=>{F(this,e)})),e.on("close",(()=>{this.destroy()})),e.on("destroy",(()=>{this.destroy()})),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};const r=a(e);for(let t=1;t{const e=this._writableState;e.writing||j(this,e),$(this,e)}))}function C(t,r,n,i){const o=t._writableState;if("function"==typeof n)i=n,n=o.defaultEncoding;else{if(n){if("buffer"!==n&&!d.isEncoding(n))throw new k(n)}else n=o.defaultEncoding;"function"!=typeof i&&(i=P)}if(null===r)throw new x;if(!o.objectMode)if("string"==typeof r)!1!==o.decodeStrings&&(r=d.from(r,n),n="buffer");else if(r instanceof d)n="buffer";else{if(!f._isUint8Array(r))throw new g("chunk",["string","Buffer","Uint8Array"],r);r=f._uint8ArrayToBuffer(r),n="buffer"}let a;return o.ending?a=new _:o.destroyed&&(a=new E("write")),a?(e.nextTick(i,a),S(t,a,!0),a):(o.pendingcb++,function(e,t,r,n,i){const o=t.objectMode?1:r.length;t.length+=o;const a=t.lengthn.bufferedIndex&&j(t,n),i?null!==n.afterWriteTickInfo&&n.afterWriteTickInfo.cb===o?n.afterWriteTickInfo.count++:(n.afterWriteTickInfo={count:1,cb:o,stream:t,state:n},e.nextTick(F,n.afterWriteTickInfo)):L(t,n,1,o))):S(t,new v)}function F({stream:e,state:t,count:r,cb:n}){return t.afterWriteTickInfo=null,L(e,t,r,n)}function L(e,t,r,n){for(!t.ending&&!e.destroyed&&0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"));r-- >0;)t.pendingcb--,n();t.destroyed&&U(t),$(e,t)}function U(e){if(e.writing)return;for(let r=e.bufferedIndex;r1&&e._writev){r.pendingcb-=a-1;const i=r.allNoop?P:e=>{for(let t=s;t256?(n.splice(0,s),r.bufferedIndex=0):r.bufferedIndex=s}r.bufferProcessing=!1}function D(e){return e.ending&&!e.destroyed&&e.constructed&&0===e.length&&!e.errored&&0===e.buffered.length&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function z(t,r){r.prefinished||r.finalCalled||("function"!=typeof t._final||r.destroyed?(r.prefinished=!0,t.emit("prefinish")):(r.finalCalled=!0,function(t,r){let n=!1;function i(i){if(n)S(t,null!=i?i:v());else if(n=!0,r.pendingcb--,i){const e=r[I].splice(0);for(let t=0;t{D(t)?H(e,t):t.pendingcb--}),t,r)):D(r)&&(r.pendingcb++,H(t,r))))}function H(e,t){t.pendingcb--,t.finished=!0;const r=t[I].splice(0);for(let e=0;e{h=!1,e&&m(t,e),p(e)})),u._write=function(e,t,r){i.write(e,t)?r():o=r},u._final=function(e){i.end(),a=e},i.on("drain",(function(){if(o){const e=o;o=null,e()}})),i.on("finish",(function(){if(a){const e=a;a=null,e()}}))),l&&(f(t,(e=>{l=!1,e&&m(t,e),p(e)})),t.on("readable",(function(){if(s){const e=s;s=null,e()}})),t.on("end",(function(){u.push(null)})),u._read=function(){for(;;){const e=t.read();if(null===e)return void(s=u._read);if(!u.push(e))return}}),u._destroy=function(e,r){e||null===c||(e=new d),s=null,o=null,a=null,null===c?r(e):(c=r,m(i,e),m(t,e))},u}return Ii=function t(r,n){if(c(r))return r;if(a(r))return S({readable:r});if(s(r))return S({writable:r});if(o(r))return S({writable:!1,readable:!1});if(u(r))return S({readable:g.fromWeb(r)});if(l(r))return S({writable:y.fromWeb(r)});if("function"==typeof r){const{value:t,write:o,final:a,destroy:s}=function(t){let{promise:r,resolve:n}=v();const i=new x,o=i.signal,a=t(async function*(){for(;;){const t=r;r=null;const{chunk:i,done:a,cb:s}=await t;if(e.nextTick(s),a)return;if(o.aborted)throw new d(void 0,{cause:o.reason});({promise:r,resolve:n}=v()),yield i}}(),{signal:o});return{value:a,write(e,t,r){const i=n;n=null,i({chunk:e,done:!1,cb:r})},final(e){const t=n;n=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}(r);if(i(t))return w(k,t,{objectMode:!0,write:o,final:a,destroy:s});const c=null==t?void 0:t.then;if("function"==typeof c){let r;const n=_(c,t,(e=>{if(null!=e)throw new p("nully","body",e)}),(e=>{m(r,e)}));return r=new k({objectMode:!0,readable:!1,write:o,final(t){a((async()=>{try{await n,e.nextTick(t,null)}catch(r){e.nextTick(t,r)}}))},destroy:s})}throw new p("Iterable, AsyncIterable or AsyncFunction",n,t)}if(A(r))return t(r.arrayBuffer());if(i(r))return w(k,r,{objectMode:!0,writable:!1});if(u(null==r?void 0:r.readable)&&l(null==r?void 0:r.writable))return k.fromWeb(r);if("object"==typeof(null==r?void 0:r.writable)||"object"==typeof(null==r?void 0:r.readable)){return S({readable:null!=r&&r.readable?a(null==r?void 0:r.readable)?null==r?void 0:r.readable:t(r.readable):void 0,writable:null!=r&&r.writable?s(null==r?void 0:r.writable)?null==r?void 0:r.writable:t(r.writable):void 0})}const f=null==r?void 0:r.then;if("function"==typeof f){let e;return _(f,r,(t=>{null!=t&&e.push(t),e.push(null)}),(t=>{m(e,t)})),e=new k({objectMode:!0,writable:!1,read(){}})}throw new h(n,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],r)},Ii}function Fi(){if(Mi)return Oi;Mi=1;const{ObjectDefineProperties:e,ObjectGetOwnPropertyDescriptor:t,ObjectKeys:r,ObjectSetPrototypeOf:n}=de;Oi=a;const i=Bi(),o=Ni();n(a.prototype,i.prototype),n(a,i);{const e=r(o.prototype);for(let t=0;t{t?e?e(t):this.destroy(t):(null!=r&&this.push(r),this.push(null),e&&e())}))}function Ki(){this._final!==qi&&qi.call(this)}Gi.prototype._final=qi,Gi.prototype._transform=function(e,t,r){throw new Di("_transform()")},Gi.prototype._write=function(e,t,r){const n=this._readableState,i=this._writableState,o=n.length;this._transform(e,t,((e,t)=>{e?r(e):(null!=t&&this.push(t),i.ended||o===n.length||n.length{n=!0}));const i=ro(e,{readable:t,writable:r},(e=>{n=!e}));return{destroy:t=>{n||(n=!0,io.destroyer(e,t||new lo("pipe")))},cleanup:i}}function To(e){if(bo(e))return e;if(yo(e))return async function*(e){So||(So=Bi());yield*So.prototype[eo].call(e)}(e);throw new so("val",["Readable","Iterable","AsyncIterable"],e)}async function Oo(e,t,r,{end:n}){let i,o=null;const a=e=>{if(e&&(i=e),o){const e=o;o=null,e()}},s=()=>new Qi(((e,t)=>{i?t(i):o=()=>{i?t(i):e()}}));t.on("drain",a);const c=ro(t,{readable:!1},a);try{t.writableNeedDrain&&await s();for await(const r of e)t.write(r)||await s();n&&(t.end(),await s()),r()}catch(e){r(i!==e?ao(i,e):e)}finally{c(),t.off("drain",a)}}async function Mo(e,t,r,{end:n}){wo(t)&&(t=t.writable);const i=t.getWriter();try{for await(const t of e)await i.ready,i.write(t).catch((()=>{}));await i.ready,n&&await i.close(),r()}catch(e){try{await i.abort(e),r(e)}catch(e){r(e)}}}function Co(e,t,r){if(1===e.length&&Xi(e[0])&&(e=e[0]),e.length<2)throw new uo("streams");const n=new _o,i=n.signal,o=null==r?void 0:r.signal,a=[];function s(){m(new ho)}let c,u,l;mo(o,"options.signal"),Po=Po||_e.addAbortListener,o&&(c=Po(o,s));const f=[];let d,h=0;function p(e){m(e,0==--h)}function m(e,r){var i;if(!e||u&&"ERR_STREAM_PREMATURE_CLOSE"!==u.code||(u=e),u||r){for(;f.length;)f.shift()(u);null===(i=c)||void 0===i||i[to](),n.abort(),r&&(u||a.forEach((e=>e())),Yi.nextTick(t,u,l))}}for(let y=0;y0,A=w||!1!==(null==r?void 0:r.end),x=y===e.length-1;if(vo(v)){if(A){const{destroy:k,cleanup:S}=Io(v,w,E);f.push(k),go(v)&&x&&a.push(S)}function _(e){e&&"AbortError"!==e.name&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code&&p(e)}v.on("error",_),go(v)&&x&&a.push((()=>{v.removeListener("error",_)}))}if(0===y)if("function"==typeof v){if(d=v({signal:i}),!bo(d))throw new co("Iterable, AsyncIterable or Stream","source",d)}else d=bo(v)||yo(v)||wo(v)?v:oo.from(v);else if("function"==typeof v){var b;if(wo(d))d=To(null===(b=d)||void 0===b?void 0:b.readable);else d=To(d);if(d=v(d,{signal:i}),w){if(!bo(d,!0))throw new co("AsyncIterable",`transform[${y-1}]`,d)}else{var g;ko||(ko=Wi);const P=new ko({objectMode:!0}),I=null===(g=d)||void 0===g?void 0:g.then;if("function"==typeof I)h++,I.call(d,(e=>{l=e,null!=e&&P.write(e),A&&P.end(),Yi.nextTick(p)}),(e=>{P.destroy(e),Yi.nextTick(p,e)}));else if(bo(d,!0))h++,Oo(d,P,p,{end:A});else{if(!Ao(d)&&!wo(d))throw new co("AsyncIterable or Promise","destination",d);{const M=d.readable||d;h++,Oo(M,P,p,{end:A})}}d=P;const{destroy:T,cleanup:O}=Io(d,!1,!0);f.push(T),x&&a.push(O)}}else if(vo(v)){if(yo(d)){h+=2;const C=Bo(d,v,p,{end:A});go(v)&&x&&a.push(C)}else if(wo(d)||Ao(d)){const B=d.readable||d;h++,Oo(B,v,p,{end:A})}else{if(!bo(d))throw new so("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],d);h++,Oo(d,v,p,{end:A})}d=v}else if(Eo(v)){if(yo(d))h++,Mo(To(d),v,p,{end:A});else if(Ao(d)||bo(d))h++,Mo(d,v,p,{end:A});else{if(!wo(d))throw new so("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],d);h++,Mo(d.readable,v,p,{end:A})}d=v}else d=oo.from(v)}return(null!=i&&i.aborted||null!=o&&o.aborted)&&Yi.nextTick(s),d}function Bo(e,t,r,{end:n}){let i=!1;if(t.on("close",(()=>{i||r(new fo)})),e.pipe(t,{end:!1}),n){function o(){i=!0,t.end()}xo(e)?Yi.nextTick(o):e.once("end",o)}else r();return ro(e,{readable:!0,writable:!1},(t=>{const n=e._readableState;t&&"ERR_STREAM_PREMATURE_CLOSE"===t.code&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once("end",r).once("error",r):r(t)})),ro(t,{readable:!1,writable:!0},r)}var No={pipelineImpl:Co,pipeline:function(...e){return Co(e,no(function(e){return po(e[e.length-1],"streams[stream.length - 1]"),e.pop()}(e)))}};const{pipeline:Ro}=No,Fo=Fi(),{destroyer:Lo}=zn,{isNodeStream:Uo,isReadable:jo,isWritable:Do,isWebStream:zo,isTransformStream:$o,isWritableStream:Ho,isReadableStream:Go}=jr,{AbortError:qo,codes:{ERR_INVALID_ARG_VALUE:Ko,ERR_MISSING_ARGS:Vo}}=je,Wo=yn;var Jo=function(...e){if(0===e.length)throw new Vo("streams");if(1===e.length)return Fo.from(e[0]);const t=[...e];if("function"==typeof e[0]&&(e[0]=Fo.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=Fo.from(e[t])}for(let r=0;r0&&!(Do(e[r])||Ho(e[r])||$o(e[r])))throw new Ko(`streams[${r}]`,t[r],"must be writable")}let r,n,i,o,a;const s=e[0],c=Ro(e,(function(e){const t=o;o=null,t?t(e):e?a.destroy(e):l||u||a.destroy()})),u=!!(Do(s)||Ho(s)||$o(s)),l=!!(jo(c)||Go(c)||$o(c));if(a=new Fo({writableObjectMode:!(null==s||!s.writableObjectMode),readableObjectMode:!(null==c||!c.readableObjectMode),writable:u,readable:l}),u){if(Uo(s))a._write=function(e,t,n){s.write(e,t)?n():r=n},a._final=function(e){s.end(),n=e},s.on("drain",(function(){if(r){const e=r;r=null,e()}}));else if(zo(s)){const e=($o(s)?s.writable:s).getWriter();a._write=async function(t,r,n){try{await e.ready,e.write(t).catch((()=>{})),n()}catch(e){n(e)}},a._final=async function(t){try{await e.ready,e.close().catch((()=>{})),n=t}catch(e){t(e)}}}const e=$o(c)?c.readable:c;Wo(e,(()=>{if(n){const e=n;n=null,e()}}))}if(l)if(Uo(c))c.on("readable",(function(){if(i){const e=i;i=null,e()}})),c.on("end",(function(){a.push(null)})),a._read=function(){for(;;){const e=c.read();if(null===e)return void(i=a._read);if(!a.push(e))return}};else if(zo(c)){const e=($o(c)?c.readable:c).getReader();a._read=async function(){for(;;)try{const{value:t,done:r}=await e.read();if(!a.push(t))return;if(r)return void a.push(null)}catch{return}}}return a._destroy=function(e,t){e||null===o||(e=new qo),i=null,r=null,n=null,null===o?t(e):(o=t,Uo(c)&&Lo(c,e))},a};const Zo=globalThis.AbortController||me().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Yo,ERR_INVALID_ARG_TYPE:Xo,ERR_MISSING_ARGS:Qo,ERR_OUT_OF_RANGE:ea},AbortError:ta}=je,{validateAbortSignal:ra,validateInteger:na,validateObject:ia}=It,oa=de.Symbol("kWeak"),aa=de.Symbol("kResistStopPropagation"),{finished:sa}=yn,ca=Jo,{addAbortSignalNoValidate:ua}=Jn,{isWritable:la,isNodeStream:fa}=jr,{deprecate:da}=_e,{ArrayPrototypePush:ha,Boolean:pa,MathFloor:ma,Number:ba,NumberIsNaN:ga,Promise:ya,PromiseReject:va,PromiseResolve:wa,PromisePrototypeThen:Ea,Symbol:Aa}=de,xa=Aa("kEmpty"),_a=Aa("kEof");function ka(e,t){if("function"!=typeof e)throw new Xo("fn",["Function","AsyncFunction"],e);null!=t&&ia(t,"options"),null!=(null==t?void 0:t.signal)&&ra(t.signal,"options.signal");let r=1;null!=(null==t?void 0:t.concurrency)&&(r=ma(t.concurrency));let n=r-1;return null!=(null==t?void 0:t.highWaterMark)&&(n=ma(t.highWaterMark)),na(r,"options.concurrency",1),na(n,"options.highWaterMark",0),n+=r,async function*(){const i=_e.AbortSignalAny([null==t?void 0:t.signal].filter(pa)),o=this,a=[],s={signal:i};let c,u,l=!1,f=0;function d(){l=!0,h()}function h(){f-=1,p()}function p(){u&&!l&&f=n||f>=r)&&await new ya((e=>{u=e}))}a.push(_a)}catch(e){const t=va(e);Ea(t,h,d),a.push(t)}finally{l=!0,c&&(c(),c=null)}}();try{for(;;){for(;a.length>0;){const e=await a[0];if(e===_a)return;if(i.aborted)throw new ta;e!==xa&&(yield e),a.shift(),p()}await new ya((e=>{c=e}))}}finally{l=!0,u&&(u(),u=null)}}.call(this)}async function Sa(e,t=void 0){for await(const r of Pa.call(this,e,t))return!0;return!1}function Pa(e,t){if("function"!=typeof e)throw new Xo("fn",["Function","AsyncFunction"],e);return ka.call(this,(async function(t,r){return await e(t,r)?t:xa}),t)}class Ia extends Qo{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function Ta(e){if(e=ba(e),ga(e))return 0;if(e<0)throw new ea("number",">= 0",e);return e}var Oa,Ma,Ca;function Ba(){if(Ma)return Oa;Ma=1;const{ArrayPrototypePop:e,Promise:t}=de,{isIterable:r,isNodeStream:n,isWebStream:i}=jr,{pipelineImpl:o}=No,{finished:a}=yn;return Na(),Oa={finished:a,pipeline:function(...a){return new t(((t,s)=>{let c,u;const l=a[a.length-1];if(l&&"object"==typeof l&&!n(l)&&!r(l)&&!i(l)){const t=e(a);c=t.signal,u=t.end}o(a,((e,r)=>{e?s(e):t(r)}),{signal:c,end:u})}))}},Oa}function Na(){if(Ca)return c.exports;Ca=1;const{Buffer:e}=fe,{ObjectDefineProperty:t,ObjectKeys:r,ReflectApply:n}=de,{promisify:{custom:i}}=_e,{streamReturningOperators:o,promiseReturningOperators:a}=ke,{codes:{ERR_ILLEGAL_CONSTRUCTOR:s}}=je,u=Jo,{setDefaultHighWaterMark:l,getDefaultHighWaterMark:f}=li,{pipeline:d}=No,{destroyer:h}=zn,p=yn,m=Ba(),b=jr,g=c.exports=Vn.Stream;g.isDestroyed=b.isDestroyed,g.isDisturbed=b.isDisturbed,g.isErrored=b.isErrored,g.isReadable=b.isReadable,g.isWritable=b.isWritable,g.Readable=Bi();for(const v of r(o)){const w=o[v];function E(...e){if(new.target)throw s();return g.Readable.from(n(w,this,e))}t(E,"name",{__proto__:null,value:w.name}),t(E,"length",{__proto__:null,value:w.length}),t(g.Readable.prototype,v,{__proto__:null,value:E,enumerable:!1,configurable:!0,writable:!0})}for(const A of r(a)){const x=a[A];function _(...e){if(new.target)throw s();return n(x,this,e)}t(_,"name",{__proto__:null,value:x.name}),t(_,"length",{__proto__:null,value:x.length}),t(g.Readable.prototype,A,{__proto__:null,value:_,enumerable:!1,configurable:!0,writable:!0})}g.Writable=Ni(),g.Duplex=Fi(),g.Transform=ji,g.PassThrough=Wi,g.pipeline=d;const{addAbortSignal:y}=Jn;return g.addAbortSignal=y,g.finished=p,g.destroy=h,g.compose=u,g.setDefaultHighWaterMark=l,g.getDefaultHighWaterMark=f,t(g,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>m}),t(d,i,{__proto__:null,enumerable:!0,get:()=>m.pipeline}),t(p,i,{__proto__:null,enumerable:!0,get:()=>m.finished}),g.Stream=g,g._isUint8Array=function(e){return e instanceof Uint8Array},g._uint8ArrayToBuffer=function(t){return e.from(t.buffer,t.byteOffset,t.byteLength)},c.exports}ke.streamReturningOperators={asIndexedPairs:da((function(e=void 0){return null!=e&&ia(e,"options"),null!=(null==e?void 0:e.signal)&&ra(e.signal,"options.signal"),async function*(){let t=0;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new ta({cause:e.signal.reason});yield[t++,n]}}.call(this)}),"readable.asIndexedPairs will be removed in a future version."),drop:function(e,t=void 0){return null!=t&&ia(t,"options"),null!=(null==t?void 0:t.signal)&&ra(t.signal,"options.signal"),e=Ta(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new ta;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new ta;e--<=0&&(yield r)}}.call(this)},filter:Pa,flatMap:function(e,t){const r=ka.call(this,e,t);return async function*(){for await(const e of r)yield*e}.call(this)},map:ka,take:function(e,t=void 0){return null!=t&&ia(t,"options"),null!=(null==t?void 0:t.signal)&&ra(t.signal,"options.signal"),e=Ta(e),async function*(){var r;if(null!=t&&null!==(r=t.signal)&&void 0!==r&&r.aborted)throw new ta;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new ta;if(e-- >0&&(yield r),e<=0)return}}.call(this)},compose:function(e,t){if(null!=t&&ia(t,"options"),null!=(null==t?void 0:t.signal)&&ra(t.signal,"options.signal"),fa(e)&&!la(e))throw new Yo("stream",e,"must be writable");const r=ca(this,e);return null!=t&&t.signal&&ua(t.signal,r),r}},ke.promiseReturningOperators={every:async function(e,t=void 0){if("function"!=typeof e)throw new Xo("fn",["Function","AsyncFunction"],e);return!await Sa.call(this,(async(...t)=>!await e(...t)),t)},forEach:async function(e,t){if("function"!=typeof e)throw new Xo("fn",["Function","AsyncFunction"],e);for await(const r of ka.call(this,(async function(t,r){return await e(t,r),xa}),t));},reduce:async function(e,t,r){var n;if("function"!=typeof e)throw new Xo("reducer",["Function","AsyncFunction"],e);null!=r&&ia(r,"options"),null!=(null==r?void 0:r.signal)&&ra(r.signal,"options.signal");let i=arguments.length>1;if(null!=r&&null!==(n=r.signal)&&void 0!==n&&n.aborted){const e=new ta(void 0,{cause:r.signal.reason});throw this.once("error",(()=>{})),await sa(this.destroy(e)),e}const o=new Zo,a=o.signal;if(null!=r&&r.signal){const e={once:!0,[oa]:this,[aa]:!0};r.signal.addEventListener("abort",(()=>o.abort()),e)}let s=!1;try{for await(const n of this){var c;if(s=!0,null!=r&&null!==(c=r.signal)&&void 0!==c&&c.aborted)throw new ta;i?t=await e(t,n,{signal:a}):(t=n,i=!0)}if(!s&&!i)throw new Ia}finally{o.abort()}return t},toArray:async function(e){null!=e&&ia(e,"options"),null!=(null==e?void 0:e.signal)&&ra(e.signal,"options.signal");const t=[];for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new ta(void 0,{cause:e.signal.reason});ha(t,n)}return t},some:Sa,find:async function(e,t){for await(const r of Pa.call(this,e,t))return r}},function(e){const t=Na(),r=Ba(),n=t.Readable.destroy;e.exports=t.Readable,e.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,e.exports._isUint8Array=t._isUint8Array,e.exports.isDisturbed=t.isDisturbed,e.exports.isErrored=t.isErrored,e.exports.isReadable=t.isReadable,e.exports.Readable=t.Readable,e.exports.Writable=t.Writable,e.exports.Duplex=t.Duplex,e.exports.Transform=t.Transform,e.exports.PassThrough=t.PassThrough,e.exports.addAbortSignal=t.addAbortSignal,e.exports.finished=t.finished,e.exports.destroy=t.destroy,e.exports.destroy=n,e.exports.pipeline=t.pipeline,e.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get:()=>r}),e.exports.Stream=t.Stream,e.exports.default=e.exports}({exports:{}});var Ra=za;za.default=za,za.stable=qa,za.stableStringify=qa;var Fa="[...]",La="[Circular]",Ua=[],ja=[];function Da(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function za(e,t,r,n){var i;void 0===n&&(n=Da()),Ha(e,"",0,[],void 0,0,n);try{i=0===ja.length?JSON.stringify(e,t,r):JSON.stringify(e,Va(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==Ua.length;){var o=Ua.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function $a(e,t,r,n){var i=Object.getOwnPropertyDescriptor(n,r);void 0!==i.get?i.configurable?(Object.defineProperty(n,r,{value:e}),Ua.push([n,r,t,i])):ja.push([t,r,e]):(n[r]=e,Ua.push([n,r,t]))}function Ha(e,t,r,n,i,o,a){var s;if(o+=1,"object"==typeof e&&null!==e){for(s=0;sa.depthLimit)return void $a(Fa,e,t,i);if(void 0!==a.edgesLimit&&r+1>a.edgesLimit)return void $a(Fa,e,t,i);if(n.push(e),Array.isArray(e))for(s=0;st?1:0}function qa(e,t,r,n){void 0===n&&(n=Da());var i,o=Ka(e,"",0,[],void 0,0,n)||e;try{i=0===ja.length?JSON.stringify(o,t,r):JSON.stringify(o,Va(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==Ua.length;){var a=Ua.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return i}function Ka(e,t,r,n,i,o,a){var s;if(o+=1,"object"==typeof e&&null!==e){for(s=0;sa.depthLimit)return void $a(Fa,e,t,i);if(void 0!==a.edgesLimit&&r+1>a.edgesLimit)return void $a(Fa,e,t,i);if(n.push(e),Array.isArray(e))for(s=0;s0)for(var n=0;nObject.hasOwnProperty.call(e,t);let es=class e extends Error{constructor(t,{cause:r}={}){super(t),this.name=e.name,r&&(this.cause=r),this.message=t}};var ts=Object.freeze({__proto__:null,ErrorWithCause:es});const rs=e=>{if(e&&"object"==typeof e&&"cause"in e){if("function"==typeof e.cause){const t=e.cause();return t instanceof Error?t:void 0}return e.cause instanceof Error?e.cause:void 0}},ns=(e,t)=>{if(!(e instanceof Error))return"";const r=e.stack||"";if(t.has(e))return r+"\ncauses have become circular...";const n=rs(e);return n?(t.add(e),r+"\ncaused by: "+ns(n,t)):r},is=(e,t,r)=>{if(!(e instanceof Error))return"";const n=r?"":e.message||"";if(t.has(e))return n+": ...";const i=rs(e);if(i){t.add(e);const r="cause"in e&&"function"==typeof e.cause;return n+(r?"":": ")+is(i,t,r)}return n};var os=Object.freeze({__proto__:null,findCauseByReference:(e,t)=>{if(!e||!t)return;if(!(e instanceof Error))return;if(!(t.prototype instanceof Error)&&t!==Error)return;const r=new Set;let n=e;for(;n&&!r.has(n);){if(r.add(n),n instanceof t)return n;n=rs(n)}},getErrorCause:rs,messageWithCauses:e=>is(e,new Set),stackWithCauses:e=>ns(e,new Set)});let as=class extends TypeError{constructor(e,t){let r;const{message:n,explanation:i,...o}=e,{path:a}=e,s=0===a.length?n:`At path: ${a.join(".")} -- ${n}`;super(i??s),null!=i&&(this.cause=s),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}};function ss(e){return"object"==typeof e&&null!=e}function cs(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function us(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function ls(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:a}=r,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${us(n)}\``}=e;return{value:n,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*fs(e,t,r,n){(function(e){return ss(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const i of e){const e=ls(i,t,r,n);e&&(yield e)}}function*ds(e,t,r={}){const{path:n=[],branch:i=[e],coerce:o=!1,mask:a=!1}=r,s={path:n,branch:i};if(o&&(e=t.coercer(e,s),a&&"type"!==t.type&&ss(t.schema)&&ss(e)&&!Array.isArray(e)))for(const r in e)void 0===t.schema[r]&&delete e[r];let c="valid";for(const n of t.validator(e,s))n.explanation=r.message,c="not_valid",yield[n,void 0];for(let[u,l,f]of t.entries(e,s)){const t=ds(l,f,{path:void 0===u?n:[...n,u],branch:void 0===u?i:[...i,l],coerce:o,mask:a,message:r.message});for(const r of t)r[0]?(c=null!=r[0].refinement?"not_refined":"not_valid",yield[r[0],void 0]):o&&(l=r[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):ss(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const n of t.refiner(e,s))n.explanation=r.message,c="not_refined",yield[n,void 0];"valid"===c&&(yield[void 0,e])}let hs=class{constructor(e){const{type:t,schema:r,validator:n,refiner:i,coercer:o=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=r,this.entries=a,this.coercer=o,this.validator=n?(e,t)=>fs(n(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>fs(i(e,t),t,this,e):()=>[]}assert(e,t){return ps(e,this,t)}create(e,t){return ms(e,this,t)}is(e){return gs(e,this)}mask(e,t){return bs(e,this,t)}validate(e,t={}){return ys(e,this,t)}};function ps(e,t,r){const n=ys(e,t,{message:r});if(n[0])throw n[0]}function ms(e,t,r){const n=ys(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function bs(e,t,r){const n=ys(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function gs(e,t){return!ys(e,t)[0]}function ys(e,t,r={}){const n=ds(e,t,r),i=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(i[0]){const e=new as(i[0],(function*(){for(const e of n)e[0]&&(yield e[0])}));return[e,void 0]}return[void 0,i[1]]}function vs(e,t){return new hs({type:e,schema:null,validator:t})}function ws(e){let t;return new hs({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator:(r,n)=>(t??(t=e()),t.validator(r,n)),coercer:(r,n)=>(t??(t=e()),t.coercer(r,n)),refiner:(r,n)=>(t??(t=e()),t.refiner(r,n))})}function Es(){return vs("any",(()=>!0))}function As(e){return new hs({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${us(e)}`})}function xs(){return vs("boolean",(e=>"boolean"==typeof e))}function _s(){return vs("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${us(e)}`))}function ks(e){const t=us(e),r=typeof e;return new hs({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${us(r)}`})}function Ss(){return vs("never",(()=>!1))}function Ps(e){return new hs({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}function Is(){return vs("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${us(e)}`))}function Ts(e){const t=e?Object.keys(e):[],r=Ss();return new hs({type:"object",schema:e||null,*entries(n){if(e&&ss(n)){const i=new Set(Object.keys(n));for(const r of t)i.delete(r),yield[r,n[r],e[r]];for(const e of i)yield[e,n[e],r]}},validator:e=>ss(e)||`Expected an object, but received: ${us(e)}`,coercer:e=>ss(e)?{...e}:e})}function Os(e){return new hs({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function Ms(e,t){return new hs({type:"record",schema:null,*entries(r){if(ss(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>ss(e)||`Expected an object, but received: ${us(e)}`})}function Cs(){return vs("string",(e=>"string"==typeof e||`Expected a string, but received: ${us(e)}`))}function Bs(e){const t=Object.keys(e);return new hs({type:"type",schema:e,*entries(r){if(ss(r))for(const n of t)yield[n,r[n],e[n]]},validator:e=>ss(e)||`Expected an object, but received: ${us(e)}`,coercer:e=>ss(e)?{...e}:e})}function Ns(e){const t=e.map((e=>e.type)).join(" | ");return new hs({type:"union",schema:null,coercer(t){for(const r of e){const[e,n]=r.validate(t,{coerce:!0});if(!e)return n}return t},validator(r,n){const i=[];for(const t of e){const[...e]=ds(r,t,n),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${us(r)}`,...i]}})}function Rs(){return vs("unknown",(()=>!0))}function Fs(e,t,r){return new hs({...e,coercer:(n,i)=>gs(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function Ls(e){return e instanceof Map||e instanceof Set?e.size:e.length}function Us(e,t,r){return new hs({...e,*refiner(n,i){yield*e.refiner(n,i);const o=fs(r(n,i),i,e,n);for(const e of o)yield{...e,refinement:t}}})}var js=Object.freeze({__proto__:null,Struct:hs,StructError:as,any:Es,array:As,assert:ps,assign:function(...e){const t="type"===e[0].type,r=e.map((e=>e.schema)),n=Object.assign({},...r);return t?Bs(n):Ts(n)},bigint:function(){return vs("bigint",(e=>"bigint"==typeof e))},boolean:xs,coerce:Fs,create:ms,date:function(){return vs("date",(e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${us(e)}`))},defaulted:function(e,t,r={}){return Fs(e,Rs(),(e=>{const n="function"==typeof t?t():t;if(void 0===e)return n;if(!r.strict&&cs(e)&&cs(n)){const t={...e};let r=!1;for(const e in n)void 0===t[e]&&(t[e]=n[e],r=!0);if(r)return t}return e}))},define:vs,deprecated:function(e,t){return new hs({...e,refiner:(t,r)=>void 0===t||e.refiner(t,r),validator:(r,n)=>void 0===r||(t(r,n),e.validator(r,n))})},dynamic:function(e){return new hs({type:"dynamic",schema:null,*entries(t,r){const n=e(t,r);yield*n.entries(t,r)},validator:(t,r)=>e(t,r).validator(t,r),coercer:(t,r)=>e(t,r).coercer(t,r),refiner:(t,r)=>e(t,r).refiner(t,r)})},empty:function(e){return Us(e,"empty",(t=>{const r=Ls(t);return 0===r||`Expected an empty ${e.type} but received one with a size of \`${r}\``}))},enums:function(e){const t={},r=e.map((e=>us(e))).join();for(const r of e)t[r]=r;return new hs({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${r}\`, but received: ${us(t)}`})},func:function(){return vs("func",(e=>"function"==typeof e||`Expected a function, but received: ${us(e)}`))},instance:function(e){return vs("instance",(t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${us(t)}`))},integer:_s,intersection:function(e){return new hs({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})},is:gs,lazy:ws,literal:ks,map:function(e,t){return new hs({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||`Expected a \`Map\` object, but received: ${us(e)}`})},mask:bs,max:function(e,t,r={}){const{exclusive:n}=r;return Us(e,"max",(r=>n?rn?r>t:r>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${r}\``))},never:Ss,nonempty:function(e){return Us(e,"nonempty",(t=>Ls(t)>0||`Expected a nonempty ${e.type} but received an empty one`))},nullable:Ps,number:Is,object:Ts,omit:function(e,t){const{schema:r}=e,n={...r};for(const e of t)delete n[e];return"type"===e.type?Bs(n):Ts(n)},optional:Os,partial:function(e){const t=e instanceof hs,r=t?{...e.schema}:{...e};for(const e in r)r[e]=Os(r[e]);return t&&"type"===e.type?Bs(r):Ts(r)},pattern:function(e,t){return Us(e,"pattern",(r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`))},pick:function(e,t){const{schema:r}=e,n={};for(const e of t)n[e]=r[e];return"type"===e.type?Bs(n):Ts(n)},record:Ms,refine:Us,regexp:function(){return vs("regexp",(e=>e instanceof RegExp))},set:function(e){return new hs({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||`Expected a \`Set\` object, but received: ${us(e)}`})},size:function(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return Us(e,"size",(e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=r||`${n} ${i} but received \`${e}\``;if(e instanceof Map||e instanceof Set){const{size:o}=e;return t<=o&&o<=r||`${n} with a size ${i} but received one with a size of \`${o}\``}{const{length:o}=e;return t<=o&&o<=r||`${n} with a length ${i} but received one with a length of \`${o}\``}}))},string:Cs,struct:function(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),vs(e,t)},trimmed:function(e){return Fs(e,Cs(),(e=>e.trim()))},tuple:function(e){const t=Ss();return new hs({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;iArray.isArray(e)||`Expected an array, but received: ${us(e)}`})},type:Bs,union:Ns,unknown:Rs,validate:ys});function Ds(e){return function(e){return function(e){return"object"==typeof e&&null!==e&&"message"in e}(e)&&"string"==typeof e.message?e.message:function(e){return null==e}(e)?"":String(e)}(e).replace(/\.$/u,"")}function zs(e,t){return r=e,Boolean("string"==typeof r?.prototype?.constructor?.name)?new e({message:t}):e({message:t});var r}var $s=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};var Hs={exports:{}};var Gs={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};const qs="object"==typeof pr&&pr.env&&pr.env.NODE_DEBUG&&/\bsemver\b/i.test(pr.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var Ks=qs;!function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Gs,o=Ks,a=(t=e.exports={}).re=[],s=t.safeRe=[],c=t.src=[],u=t.t={};let l=0;const f="[a-zA-Z0-9-]",d=[["\\s",1],["\\d",i],[f,n]],h=(e,t,r)=>{const n=(e=>{for(const[t,r]of d)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=l++;o(e,i,t),u[e]=i,c[i]=t,a[i]=new RegExp(t,r?"g":void 0),s[i]=new RegExp(n,r?"g":void 0)};h("NUMERICIDENTIFIER","0|[1-9]\\d*"),h("NUMERICIDENTIFIERLOOSE","\\d+"),h("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),h("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h("PRERELEASEIDENTIFIER",`(?:${c[u.NUMERICIDENTIFIER]}|${c[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NUMERICIDENTIFIERLOOSE]}|${c[u.NONNUMERICIDENTIFIER]})`),h("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h("BUILDIDENTIFIER",`${f}+`),h("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h("FULL",`^${c[u.FULLPLAIN]}$`),h("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h("LOOSE",`^${c[u.LOOSEPLAIN]}$`),h("GTLT","((?:<|>)?=?)"),h("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),h("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?`+`(?:${c[u.BUILD]})?(?:$|[^\\d])`),h("COERCERTL",c[u.COERCE],!0),h("COERCERTLFULL",c[u.COERCEFULL],!0),h("LONETILDE","(?:~>?)"),h("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",h("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h("LONECARET","(?:\\^)"),h("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",h("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",h("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h("STAR","(<|>)?=?\\s*\\*"),h("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),h("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Hs,Hs.exports);var Vs=Hs.exports;const Ws=Object.freeze({loose:!0}),Js=Object.freeze({});var Zs=e=>e?"object"!=typeof e?Ws:e:Js;const Ys=/^[0-9]+$/,Xs=(e,t)=>{const r=Ys.test(e),n=Ys.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eXs(t,e)};const ec=Ks,{MAX_LENGTH:tc,MAX_SAFE_INTEGER:rc}=Gs,{safeRe:nc,t:ic}=Vs,oc=Zs,{compareIdentifiers:ac}=Qs;var sc=class e{constructor(t,r){if(r=oc(r),t instanceof e){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if("string"!=typeof t)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>tc)throw new TypeError(`version is longer than ${tc} characters`);ec("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?nc[ic.LOOSE]:nc[ic.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>rc||this.major<0)throw new TypeError("Invalid major version");if(this.minor>rc||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>rc||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===ac(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};const cc=sc;var uc=(e,t,r=!1)=>{if(e instanceof cc)return e;try{return new cc(e,t)}catch(e){if(!r)return null;throw e}};const lc=uc;var fc=(e,t)=>{const r=lc(e,t);return r?r.version:null};const dc=uc;var hc=(e,t)=>{const r=dc(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const pc=sc;var mc=(e,t,r,n,i)=>{"string"==typeof r&&(i=n,n=r,r=void 0);try{return new pc(e instanceof pc?e.version:e,r).inc(t,n,i).version}catch(e){return null}};const bc=uc;var gc=(e,t)=>{const r=bc(e,null,!0),n=bc(t,null,!0),i=r.compare(n);if(0===i)return null;const o=i>0,a=o?r:n,s=o?n:r,c=!!a.prerelease.length;if(!!s.prerelease.length&&!c)return s.patch||s.minor?a.patch?"patch":a.minor?"minor":"major":"major";const u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};const yc=sc;var vc=(e,t)=>new yc(e,t).major;const wc=sc;var Ec=(e,t)=>new wc(e,t).minor;const Ac=sc;var xc=(e,t)=>new Ac(e,t).patch;const _c=uc;var kc=(e,t)=>{const r=_c(e,t);return r&&r.prerelease.length?r.prerelease:null};const Sc=sc;var Pc=(e,t,r)=>new Sc(e,r).compare(new Sc(t,r));const Ic=Pc;var Tc=(e,t,r)=>Ic(t,e,r);const Oc=Pc;var Mc=(e,t)=>Oc(e,t,!0);const Cc=sc;var Bc=(e,t,r)=>{const n=new Cc(e,r),i=new Cc(t,r);return n.compare(i)||n.compareBuild(i)};const Nc=Bc;var Rc=(e,t)=>e.sort(((e,r)=>Nc(e,r,t)));const Fc=Bc;var Lc=(e,t)=>e.sort(((e,r)=>Fc(r,e,t)));const Uc=Pc;var jc=(e,t,r)=>Uc(e,t,r)>0;const Dc=Pc;var zc=(e,t,r)=>Dc(e,t,r)<0;const $c=Pc;var Hc=(e,t,r)=>0===$c(e,t,r);const Gc=Pc;var qc=(e,t,r)=>0!==Gc(e,t,r);const Kc=Pc;var Vc=(e,t,r)=>Kc(e,t,r)>=0;const Wc=Pc;var Jc=(e,t,r)=>Wc(e,t,r)<=0;const Zc=Hc,Yc=qc,Xc=jc,Qc=Vc,eu=zc,tu=Jc;var ru=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return Zc(e,r,n);case"!=":return Yc(e,r,n);case">":return Xc(e,r,n);case">=":return Qc(e,r,n);case"<":return eu(e,r,n);case"<=":return tu(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};const nu=sc,iu=uc,{safeRe:ou,t:au}=Vs;var su,cu,uu,lu,fu,du,hu,pu,mu,bu,gu=(e,t)=>{if(e instanceof nu)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const n=t.includePrerelease?ou[au.COERCERTLFULL]:ou[au.COERCERTL];let i;for(;(i=n.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&i.index+i[0].length===r.index+r[0].length||(r=i),n.lastIndex=i.index+i[1].length+i[2].length;n.lastIndex=-1}else r=e.match(t.includePrerelease?ou[au.COERCEFULL]:ou[au.COERCE]);if(null===r)return null;const n=r[2],i=r[3]||"0",o=r[4]||"0",a=t.includePrerelease&&r[5]?`-${r[5]}`:"",s=t.includePrerelease&&r[6]?`+${r[6]}`:"";return iu(`${n}.${i}.${o}${a}${s}`,t)};function yu(){if(lu)return uu;function e(t){var r=this;if(r instanceof e||(r=new e),r.tail=null,r.head=null,r.length=0,t&&"function"==typeof t.forEach)t.forEach((function(e){r.push(e)}));else if(arguments.length>0)for(var n=0,i=arguments.length;n1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");n=this.head.next,r=this.head.value}for(var i=0;null!==n;i++)r=e(r,n.value,i),n=n.next;return r},e.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");n=this.tail.prev,r=this.tail.value}for(var i=this.length-1;null!==n;i--)r=e(r,n.value,i),n=n.prev;return r},e.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},e.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},e.prototype.slice=function(t,r){(r=r||this.length)<0&&(r+=this.length),(t=t||0)<0&&(t+=this.length);var n=new e;if(rthis.length&&(r=this.length);for(var i=0,o=this.head;null!==o&&ithis.length&&(r=this.length);for(var i=this.length,o=this.tail;null!==o&&i>r;i--)o=o.prev;for(;null!==o&&i>t;i--,o=o.prev)n.push(o.value);return n},e.prototype.splice=function(e,r,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,o=this.head;null!==o&&ithis.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&d)|(this.options.loose&&h))+":"+e,n=r.get(t);if(n)return n;const a=this.options.loose,m=a?s[c.HYPHENRANGELOOSE]:s[c.HYPHENRANGE];e=e.replace(m,P(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(s[c.COMPARATORTRIM],u),o("comparator trim",e),e=e.replace(s[c.TILDETRIM],l),o("tilde trim",e),e=e.replace(s[c.CARETTRIM],f),o("caret trim",e);let b=e.split(" ").map((e=>g(e,this.options))).join(" ").split(/\s+/).map((e=>S(e,this.options)));a&&(b=b.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(s[c.COMPARATORLOOSE]))))),o("range list",b);const y=new Map,v=b.map((e=>new i(e,this.options)));for(const e of v){if(p(e))return[e];y.set(e.value,e)}y.size>1&&y.has("")&&y.delete("");const w=[...y.values()];return r.set(t,w),w}intersects(t,r){if(!(t instanceof e))throw new TypeError("a Range is required");return this.set.some((e=>b(e,r)&&t.set.some((t=>b(t,r)&&e.every((e=>t.every((t=>e.intersects(t,r)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t1,d=(e,t,r)=>{const n=e[u].get(t);if(n){const t=n.value;if(h(e,t)){if(m(e,n),!e[i])return}else r&&(e[l]&&(n.value.now=Date.now()),e[c].unshiftNode(n));return t.value}},h=(e,t)=>{if(!t||!t.maxAge&&!e[o])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[o]&&r>e[o]},p=e=>{if(e[r]>e[t])for(let n=e[c].tail;e[r]>e[t]&&null!==n;){const t=n.prev;m(e,n),n=t}},m=(e,t)=>{if(t){const n=t.value;e[a]&&e[a](n.key,n.value),e[r]-=n.length,e[u].delete(n.key),e[c].removeNode(t)}};class b{constructor(e,t,r,n,i){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=i||0}}const g=(e,t,r,n)=>{let o=r.value;h(e,o)&&(m(e,r),e[i]||(o=void 0)),o&&t.call(n,o.value,o.key,e)};return fu=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[t]=e.max||1/0;const r=e.length||f;if(this[n]="function"!=typeof r?f:r,this[i]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[o]=e.maxAge||0,this[a]=e.dispose,this[s]=e.noDisposeOnSet||!1,this[l]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[t]=e||1/0,p(this)}get max(){return this[t]}set allowStale(e){this[i]=!!e}get allowStale(){return this[i]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[o]=e,p(this)}get maxAge(){return this[o]}set lengthCalculator(e){"function"!=typeof e&&(e=f),e!==this[n]&&(this[n]=e,this[r]=0,this[c].forEach((e=>{e.length=this[n](e.value,e.key),this[r]+=e.length}))),p(this)}get lengthCalculator(){return this[n]}get length(){return this[r]}get itemCount(){return this[c].length}rforEach(e,t){t=t||this;for(let r=this[c].tail;null!==r;){const n=r.prev;g(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[c].head;null!==r;){const n=r.next;g(this,e,r,t),r=n}}keys(){return this[c].toArray().map((e=>e.key))}values(){return this[c].toArray().map((e=>e.value))}reset(){this[a]&&this[c]&&this[c].length&&this[c].forEach((e=>this[a](e.key,e.value))),this[u]=new Map,this[c]=new e,this[r]=0}dump(){return this[c].map((e=>!h(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[c]}set(e,i,l){if((l=l||this[o])&&"number"!=typeof l)throw new TypeError("maxAge must be a number");const f=l?Date.now():0,d=this[n](i,e);if(this[u].has(e)){if(d>this[t])return m(this,this[u].get(e)),!1;const n=this[u].get(e).value;return this[a]&&(this[s]||this[a](e,n.value)),n.now=f,n.maxAge=l,n.value=i,this[r]+=d-n.length,n.length=d,this.get(e),p(this),!0}const h=new b(e,i,d,f,l);return h.length>this[t]?(this[a]&&this[a](e,i),!1):(this[r]+=h.length,this[c].unshift(h),this[u].set(e,this[c].head),p(this),!0)}has(e){if(!this[u].has(e))return!1;const t=this[u].get(e).value;return!h(this,t)}get(e){return d(this,e,!0)}peek(e){return d(this,e,!1)}pop(){const e=this[c].tail;return e?(m(this,e),e.value):null}del(e){m(this,this[u].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],i=n.e||0;if(0===i)this.set(n.k,n.v);else{const e=i-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[u].forEach(((e,t)=>d(this,t,!1)))}},fu}(),r=new t({max:1e3}),n=Zs,i=wu(),o=Ks,a=sc,{safeRe:s,t:c,comparatorTrimReplace:u,tildeTrimReplace:l,caretTrimReplace:f}=Vs,{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:h}=Gs,p=e=>"<0.0.0-0"===e.value,m=e=>""===e.value,b=(e,t)=>{let r=!0;const n=e.slice();let i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},g=(e,t)=>(o("comp",e,t),e=E(e,t),o("caret",e),e=v(e,t),o("tildes",e),e=x(e,t),o("xrange",e),e=k(e,t),o("stars",e),e),y=e=>!e||"x"===e.toLowerCase()||"*"===e,v=(e,t)=>e.trim().split(/\s+/).map((e=>w(e,t))).join(" "),w=(e,t)=>{const r=t.loose?s[c.TILDELOOSE]:s[c.TILDE];return e.replace(r,((t,r,n,i,a)=>{let s;return o("tilde",e,t,r,n,i,a),y(r)?s="":y(n)?s=`>=${r}.0.0 <${+r+1}.0.0-0`:y(i)?s=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:a?(o("replaceTilde pr",a),s=`>=${r}.${n}.${i}-${a} <${r}.${+n+1}.0-0`):s=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,o("tilde return",s),s}))},E=(e,t)=>e.trim().split(/\s+/).map((e=>A(e,t))).join(" "),A=(e,t)=>{o("caret",e,t);const r=t.loose?s[c.CARETLOOSE]:s[c.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,a,s)=>{let c;return o("caret",e,t,r,i,a,s),y(r)?c="":y(i)?c=`>=${r}.0.0${n} <${+r+1}.0.0-0`:y(a)?c="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:s?(o("replaceCaret pr",s),c="0"===r?"0"===i?`>=${r}.${i}.${a}-${s} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}-${s} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a}-${s} <${+r+1}.0.0-0`):(o("no pr"),c="0"===r?"0"===i?`>=${r}.${i}.${a}${n} <${r}.${i}.${+a+1}-0`:`>=${r}.${i}.${a}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${a} <${+r+1}.0.0-0`),o("caret return",c),c}))},x=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>_(e,t))).join(" ")),_=(e,t)=>{e=e.trim();const r=t.loose?s[c.XRANGELOOSE]:s[c.XRANGE];return e.replace(r,((r,n,i,a,s,c)=>{o("xRange",e,r,n,i,a,s,c);const u=y(i),l=u||y(a),f=l||y(s),d=f;return"="===n&&d&&(n=""),c=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&d?(l&&(a=0),s=0,">"===n?(n=">=",l?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):"<="===n&&(n="<",l?i=+i+1:a=+a+1),"<"===n&&(c="-0"),r=`${n+i}.${a}.${s}${c}`):l?r=`>=${i}.0.0${c} <${+i+1}.0.0-0`:f&&(r=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o("xRange return",r),r}))},k=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[c.STAR],"")),S=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(s[t.includePrerelease?c.GTE0PRE:c.GTE0],"")),P=e=>(t,r,n,i,o,a,s,c,u,l,f,d,h)=>`${r=y(n)?"":y(i)?`>=${n}.0.0${e?"-0":""}`:y(o)?`>=${n}.${i}.0${e?"-0":""}`:a?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=y(u)?"":y(l)?`<${+u+1}.0.0-0`:y(f)?`<${u}.${+l+1}.0-0`:d?`<=${u}.${l}.${f}-${d}`:e?`<${u}.${l}.${+f+1}-0`:`<=${c}`}`.trim(),I=(e,t,r)=>{for(let r=0;r0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0};return hu}function wu(){if(bu)return mu;bu=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(n,i){if(i=r(i),n instanceof t){if(n.loose===!!i.loose)return n;n=n.value}n=n.trim().split(/\s+/).join(" "),a("comparator",n,i),this.options=i,this.loose=!!i.loose,this.parse(n),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const r=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],o=t.match(r);if(!o)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new s(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new s(t,this.options)}catch(e){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new c(e.value,n).test(this.value):""===e.operator?""===e.value||new c(this.value,n).test(e.semver):(!(n=r(n)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(o(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(o(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}mu=t;const r=Zs,{safeRe:n,t:i}=Vs,o=ru,a=Ks,s=sc,c=vu();return mu}const Eu=vu();var Au=(e,t,r)=>{try{t=new Eu(t,r)}catch(e){return!1}return t.test(e)};const xu=vu();var _u=(e,t)=>new xu(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));const ku=sc,Su=vu();var Pu=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Su(t,r)}catch(e){return null}return e.forEach((e=>{o.test(e)&&(n&&-1!==i.compare(e)||(n=e,i=new ku(n,r)))})),n};const Iu=sc,Tu=vu();var Ou=(e,t,r)=>{let n=null,i=null,o=null;try{o=new Tu(t,r)}catch(e){return null}return e.forEach((e=>{o.test(e)&&(n&&1!==i.compare(e)||(n=e,i=new Iu(n,r)))})),n};const Mu=sc,Cu=vu(),Bu=jc;var Nu=(e,t)=>{e=new Cu(e,t);let r=new Mu("0.0.0");if(e.test(r))return r;if(r=new Mu("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t{const t=new Mu(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":i&&!Bu(t,i)||(i=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!i||r&&!Bu(r,i)||(r=i)}return r&&e.test(r)?r:null};const Ru=vu();var Fu=(e,t)=>{try{return new Ru(e,t).range||"*"}catch(e){return null}};const Lu=sc,Uu=wu(),{ANY:ju}=Uu,Du=vu(),zu=Au,$u=jc,Hu=zc,Gu=Jc,qu=Vc;var Ku=(e,t,r,n)=>{let i,o,a,s,c;switch(e=new Lu(e,n),t=new Du(t,n),r){case">":i=$u,o=Gu,a=Hu,s=">",c=">=";break;case"<":i=Hu,o=qu,a=$u,s="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(zu(e,t,n))return!1;for(let r=0;r{e.semver===ju&&(e=new Uu(">=0.0.0")),l=l||e,f=f||e,i(e.semver,l.semver,n)?l=e:a(e.semver,f.semver,n)&&(f=e)})),l.operator===s||l.operator===c)return!1;if((!f.operator||f.operator===s)&&o(e,f.semver))return!1;if(f.operator===c&&a(e,f.semver))return!1}return!0};const Vu=Ku;var Wu=(e,t,r)=>Vu(e,t,">",r);const Ju=Ku;var Zu=(e,t,r)=>Ju(e,t,"<",r);const Yu=vu();var Xu=(e,t,r)=>(e=new Yu(e,r),t=new Yu(t,r),e.intersects(t,r));const Qu=Au,el=Pc;const tl=vu(),rl=wu(),{ANY:nl}=rl,il=Au,ol=Pc,al=[new rl(">=0.0.0-0")],sl=[new rl(">=0.0.0")],cl=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===nl){if(1===t.length&&t[0].semver===nl)return!0;e=r.includePrerelease?al:sl}if(1===t.length&&t[0].semver===nl){if(r.includePrerelease)return!0;t=sl}const n=new Set;let i,o,a,s,c,u,l;for(const t of e)">"===t.operator||">="===t.operator?i=ul(i,t,r):"<"===t.operator||"<="===t.operator?o=ll(o,t,r):n.add(t.semver);if(n.size>1)return null;if(i&&o){if(a=ol(i.semver,o.semver,r),a>0)return null;if(0===a&&(">="!==i.operator||"<="!==o.operator))return null}for(const e of n){if(i&&!il(e,String(i),r))return null;if(o&&!il(e,String(o),r))return null;for(const n of t)if(!il(e,String(n),r))return!1;return!0}let f=!(!o||r.includePrerelease||!o.semver.prerelease.length)&&o.semver,d=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver;f&&1===f.prerelease.length&&"<"===o.operator&&0===f.prerelease[0]&&(f=!1);for(const e of t){if(l=l||">"===e.operator||">="===e.operator,u=u||"<"===e.operator||"<="===e.operator,i)if(d&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===d.major&&e.semver.minor===d.minor&&e.semver.patch===d.patch&&(d=!1),">"===e.operator||">="===e.operator){if(s=ul(i,e,r),s===e&&s!==i)return!1}else if(">="===i.operator&&!il(i.semver,String(e),r))return!1;if(o)if(f&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===f.major&&e.semver.minor===f.minor&&e.semver.patch===f.patch&&(f=!1),"<"===e.operator||"<="===e.operator){if(c=ll(o,e,r),c===e&&c!==o)return!1}else if("<="===o.operator&&!il(o.semver,String(e),r))return!1;if(!e.operator&&(o||i)&&0!==a)return!1}return!(i&&u&&!o&&0!==a)&&(!(o&&l&&!i&&0!==a)&&(!d&&!f))},ul=(e,t,r)=>{if(!e)return t;const n=ol(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},ll=(e,t,r)=>{if(!e)return t;const n=ol(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};var fl=(e,t,r={})=>{if(e===t)return!0;e=new tl(e,r),t=new tl(t,r);let n=!1;e:for(const i of e.set){for(const e of t.set){const t=cl(i,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0};const dl=Vs,hl=Gs,pl=sc,ml=Qs,bl=(e,t,r)=>{const n=[];let i=null,o=null;const a=e.sort(((e,t)=>el(e,t,r)));for(const e of a){Qu(e,t,r)?(o=e,i||(i=e)):(o&&n.push([i,o]),o=null,i=null)}i&&n.push([i,null]);const s=[];for(const[e,t]of n)e===t?s.push(e):t||e!==a[0]?t?e===a[0]?s.push(`<=${t}`):s.push(`${e} - ${t}`):s.push(`>=${e}`):s.push("*");const c=s.join(" || "),u="string"==typeof t.raw?t.raw:String(t);return c.lengthTs(e);function vl({path:e,branch:t}){const r=e[e.length-1];return Qa(t[t.length-2],r)}function wl(e){return new hs({...e,type:`optional ${e.type}`,validator:(t,r)=>!vl(r)||e.validator(t,r),refiner:(t,r)=>!vl(r)||e.refiner(t,r)})}var El=Ns([ks(null),xs(),vs("finite number",(e=>gs(e,Is())&&Number.isFinite(e))),Cs(),As(ws((()=>El))),Ms(Cs(),ws((()=>El)))]),Al=Fs(El,Es(),(e=>(function(e,t,r="Assertion failed",n=$s){try{ps(e,t)}catch(e){throw zs(n,`${r}: ${Ds(e)}.`)}}(e,El),JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))))));function xl(e){try{return function(e){ms(e,Al)}(e),!0}catch{return!1}}var _l=ks("2.0"),kl=Ps(Ns([Is(),Cs()])),Sl=yl({code:_s(),message:Cs(),data:wl(Al),stack:wl(Cs())}),Pl=Ns([Ms(Cs(),Al),As(Al)]);function Il(e){return gs(e,Sl)}yl({id:kl,jsonrpc:_l,method:Cs(),params:wl(Pl)}),yl({jsonrpc:_l,method:Cs(),params:wl(Pl)}),Ts({id:kl,jsonrpc:_l,result:Os(Rs()),error:Os(Sl)}),Ns([yl({id:kl,jsonrpc:_l,result:Al}),yl({id:kl,jsonrpc:_l,error:Sl})]);var Tl,Ol,Ml={exports:{}};function Cl(){if(Ol)return Tl;Ol=1;var e=1e3,t=60*e,r=60*t,n=24*r,i=7*n,o=365.25*n;function a(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}return Tl=function(s,c){c=c||{};var u=typeof s;if("string"===u&&s.length>0)return function(a){if((a=String(a)).length>100)return;var s=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(!s)return;var c=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(s);if("number"===u&&isFinite(s))return c.long?function(i){var o=Math.abs(i);if(o>=n)return a(i,o,n,"day");if(o>=r)return a(i,o,r,"hour");if(o>=t)return a(i,o,t,"minute");if(o>=e)return a(i,o,e,"second");return i+" ms"}(s):function(i){var o=Math.abs(i);if(o>=n)return Math.round(i/n)+"d";if(o>=r)return Math.round(i/r)+"h";if(o>=t)return Math.round(i/t)+"m";if(o>=e)return Math.round(i/e)+"s";return i+"ms"}(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))},Tl}var Bl=function(e){function t(e){let n,i,o,a=null;function s(...e){if(!s.enabled)return;const r=s,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";a++;const o=t.formatters[i];if("function"==typeof o){const t=e[a];n=o.call(r,t),e.splice(a,1),a--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=r,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{a=e}}),"function"==typeof t.init&&t.init(s),s}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==pr&&"env"in pr&&(e=pr.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Bl(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Ml,Ml.exports);var Nl=Ml.exports,Rl=Ja.internal,Fl="Unspecified error message. This is a bug, please report it.",Ll={code:Rl,message:jl(Rl)},Ul="Unspecified server error.";function jl(e,t=Fl){if(function(e){return Number.isInteger(e)}(e)){const t=e.toString();if(Qa(Ya,t))return Ya[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return Ul}return t}function Dl(e,{fallbackError:t=Ll,shouldIncludeStack:r=!0}={}){if(!Il(t))throw new Error("Must provide fallback error with integer number code and string message.");const n=function(e,t){if(e&&"object"==typeof e&&"serialize"in e&&"function"==typeof e.serialize)return e.serialize();if(Il(e))return e;const r=zl(e),n={...t,data:{cause:r}};return n}(e,t);return r||delete n.stack,n}function zl(e){return Array.isArray(e)?e.map((e=>xl(e)?e:Xa(e)?$l(e):null)):Xa(e)?$l(e):xl(e)?e:null}function $l(e){return Object.getOwnPropertyNames(e).reduce(((t,r)=>{const n=e[r];return xl(n)&&(t[r]=n),t}),{})}var Hl=class extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a non-empty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data,function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}}(this.data)&&(e.data.cause=zl(this.data.cause))),this.stack&&(e.stack=this.stack),e}toString(){return Wa(this.serialize(),ql,2)}},Gl=class extends Hl{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}};function ql(e,t){if("[Circular]"!==t)return t}var Kl={parse:e=>Wl(Ja.parse,e),invalidRequest:e=>Wl(Ja.invalidRequest,e),invalidParams:e=>Wl(Ja.invalidParams,e),methodNotFound:e=>Wl(Ja.methodNotFound,e),internal:e=>Wl(Ja.internal,e),server:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Wl(t,e)},invalidInput:e=>Wl(Ja.invalidInput,e),resourceNotFound:e=>Wl(Ja.resourceNotFound,e),resourceUnavailable:e=>Wl(Ja.resourceUnavailable,e),transactionRejected:e=>Wl(Ja.transactionRejected,e),methodNotSupported:e=>Wl(Ja.methodNotSupported,e),limitExceeded:e=>Wl(Ja.limitExceeded,e)},Vl={userRejectedRequest:e=>Jl(Za.userRejectedRequest,e),unauthorized:e=>Jl(Za.unauthorized,e),unsupportedMethod:e=>Jl(Za.unsupportedMethod,e),disconnected:e=>Jl(Za.disconnected,e),chainDisconnected:e=>Jl(Za.chainDisconnected,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:r,data:n}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new Gl(t,r,n)}};function Wl(e,t){const[r,n]=Zl(t);return new Hl(e,r??jl(e),n)}function Jl(e,t){const[r,n]=Zl(t);return new Gl(e,r??jl(e),n)}function Zl(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t??void 0,r]}}return[]}var Yl={exports:{}},Xl=function e(t,r){if(t&&r)return e(t)(r);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){n[e]=t[e]})),n;function n(){for(var e=new Array(arguments.length),r=0;r{throw e}))}}Yl.exports=Ql(ef),Yl.exports.strict=Ql(tf),ef.proto=ef((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return ef(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return tf(this)},configurable:!0})})),/^v?\.0/.test(pr.version);class nf extends ge{emit(e){let t="error"===e;const r=this._events;if(void 0!==r)t=t&&void 0===r.error;else if(!t)return!1;for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o0&&([e]=i),e instanceof Error)throw e;const t=new Error("Unhandled error."+(e?` (${e.message})`:""));throw t.context=e,t}const a=r[e];if(void 0===a)return!1;if("function"==typeof a)rf(a,this,i);else{const e=a.length,t=function(e){const t=e.length,r=new Array(t);for(let n=0;n{const o=e[t.method];return void 0===o?n():"function"==typeof o?o(t,r,n,i):(r.result=o,i())}}function sf(e){return async(t,r,n,i)=>{let o;const a=new Promise((e=>{o=e}));let s=null,c=!1;const u=async()=>{c=!0,n((e=>{s=e,o()})),await a};try{await e(t,r,u),c?(await a,s(null)):i(null)}catch(e){const t=e;s?s(t):i(t)}}}class cf extends nf{constructor(){super(),r(this,"_middleware",void 0),this._middleware=[]}static async _runAllMiddleware(e,t,r){const n=[];let i=null,o=!1;for(const a of r)if([i,o]=await cf._runMiddleware(e,t,a,n),o)break;return[i,o,n.reverse()]}static _runMiddleware(e,t,r,n){return new Promise((i=>{const o=e=>{const r=e||t.error;r&&(!1===Object.keys(r).includes("stack")&&(r.stack="Stack trace is not available."),t.error=Dl(r,{shouldIncludeStack:!0,fallbackError:{message:(null==r?void 0:r.message)||(null==r?void 0:r.toString()),code:(null==r?void 0:r.code)||-32603,stack:null==r?void 0:r.stack,data:(null==r?void 0:r.data)||(null==r?void 0:r.message)||(null==r?void 0:r.toString())}})),i([r,!0])},a=e=>{t.error?o(t.error):(e&&("function"!=typeof e&&o(new of({code:-32603,message:"JRPCEngine: 'next' return handlers must be functions"})),n.push(e)),i([null,!1]))};try{r(e,t,a,o)}catch(e){o(e)}}))}static async _runReturnHandlers(e){for(const t of e)await new Promise(((e,r)=>{t((t=>t?r(t):e()))}))}static _checkForCompletion(e,t,r){if(!("result"in t)&&!("error"in t))throw new of({code:-32603,message:"Response has no error or result for request"});if(!r)throw new of({code:-32603,message:"Nothing ended request"})}push(e){this._middleware.push(e)}handle(e,t){if(t&&"function"!=typeof t)throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?t?this._handleBatch(e,t):this._handleBatch(e):t?this._handle(e,t):this._promiseHandle(e)}asMiddleware(){return async(e,t,r,n)=>{try{const[i,o,a]=await cf._runAllMiddleware(e,t,this._middleware);return o?(await cf._runReturnHandlers(a),n(i)):r((async e=>{try{await cf._runReturnHandlers(a)}catch(t){return e(t)}return e()}))}catch(e){return n(e)}}}async _handleBatch(e,t){try{const r=await Promise.all(e.map(this._promiseHandle.bind(this)));return t?t(null,r):r}catch(e){if(t)return t(e);throw e}}_promiseHandle(e){return new Promise(((t,r)=>{this._handle(e,((e,n)=>{e&&void 0===n?r(e):t(n)})).catch(r)}))}async _handle(e,t){if(!e||Array.isArray(e)||"object"!=typeof e){const e=new of({code:-32603,message:"request must be plain object"});return t(e,{id:void 0,jsonrpc:"2.0",error:e})}if("string"!=typeof e.method){const r=new of({code:-32603,message:"method must be string"});return t(r,{id:e.id,jsonrpc:"2.0",error:r})}const r=i({},e),n={id:r.id,jsonrpc:r.jsonrpc};let o=null;try{await this._processRequest(r,n)}catch(e){o=e}var a,s,c,u,l,f,d;o&&(delete n.result,n.error||(!1===Object.keys(o).includes("stack")&&(o.stack="Stack trace is not available."),n.error=Dl(o,{shouldIncludeStack:!0,fallbackError:{message:(null===(a=o)||void 0===a?void 0:a.message)||(null===(s=o)||void 0===s?void 0:s.toString()),code:(null===(c=o)||void 0===c?void 0:c.code)||-32603,stack:null===(u=o)||void 0===u?void 0:u.stack,data:(null===(l=o)||void 0===l?void 0:l.data)||(null===(f=o)||void 0===f?void 0:f.message)||(null===(d=o)||void 0===d?void 0:d.toString())}})));return t(o,n)}async _processRequest(e,t){const[r,n,i]=await cf._runAllMiddleware(e,t,this._middleware);if(cf._checkForCompletion(e,t,n),await cf._runReturnHandlers(i),r)throw r}}function uf(e){const t=new cf;return e.forEach((e=>t.push(e))),t.asMiddleware()}function lf(e){const t=new nf;return t.sendAsync=async t=>{const r=await e.handle(t);if(r.error){var n,i,o,a,s,c,u;!1===Object.keys(r.error).includes("stack")&&(r.error.stack="Stack trace is not available.");const e=Dl(r.error,{fallbackError:{message:(null===(n=r.error)||void 0===n?void 0:n.message)||(null===(i=r.error)||void 0===i?void 0:i.toString()),code:(null===(o=r.error)||void 0===o?void 0:o.code)||-32603,stack:null===(a=r.error)||void 0===a?void 0:a.stack,data:(null===(s=r.error)||void 0===s?void 0:s.data)||(null===(c=r.error)||void 0===c?void 0:c.message)||(null===(u=r.error)||void 0===u?void 0:u.toString())},shouldIncludeStack:!0});throw Kl.internal(e)}return r.result},t.send=(t,r)=>{if("function"!=typeof r)throw new Error('Must provide callback to "send" method.');e.handle(t,r)},e.on&&e.on("notification",(e=>{t.emit("data",null,e)})),t.request=async e=>{const r=i(i({},e),{},{id:Math.random().toString(36).slice(2),jsonrpc:"2.0"});return await t.sendAsync(r)},t}var ff={exports:{}},df={},hf={};Object.defineProperty(hf,"__esModule",{value:!0}),hf.default=function(e){var t=e.length,r=t%4;if(!r)return e;var n=t,i=4-r,o=t+i,a=_.alloc(o);for(a.write(e);i--;)a.write("=",n++);return a.toString()},Object.defineProperty(df,"__esModule",{value:!0});var pf=hf;function mf(e,t){return void 0===t&&(t="utf8"),_.isBuffer(e)?gf(e.toString("base64")):gf(_.from(e,t).toString("base64"))}function bf(e){return e=e.toString(),pf.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function gf(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var yf=mf;yf.encode=mf,yf.decode=function(e,t){return void 0===t&&(t="utf8"),_.from(bf(e),"base64").toString(t)},yf.toBase64=bf,yf.fromBase64=gf,yf.toBuffer=function(e){return _.from(bf(e),"base64")},df.default=yf,function(e){e.exports=df.default,e.exports.default=e.exports}(ff);const vf={MAINNET:"mainnet",TESTNET:"testnet",CYAN:"cyan",AQUA:"aqua",CELESTE:"celeste"},wf={SAPPHIRE_DEVNET:"sapphire_devnet",SAPPHIRE_MAINNET:"sapphire_mainnet"},Ef=a(ff.exports);function Af(e){return Ef.decode(e)}function xf(e){return Ef.encode(JSON.stringify(e))}function _f(e){let t,r=!1,n=0;try{t=window[e],r=!0,n=t.length;const i="__storage_test__";return t.setItem(i,i),t.removeItem(i),!0}catch(e){const t=e;return t&&(22===t.code||1014===t.code||"QuotaExceededError"===t.name||"NS_ERROR_DOM_QUOTA_REACHED"===t.name)&&r&&0!==n}}class kf{constructor(){r(this,"store",new Map)}getItem(e){return this.store.get(e)||null}setItem(e,t){this.store.set(e,t)}removeItem(e){this.store.delete(e)}}class Sf{constructor(e,t){r(this,"storage",void 0),r(this,"_storeKey",void 0),this.storage=t,this._storeKey=e;try{t.getItem(e)||this.resetStore()}catch(e){}}static getInstance(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"local";if(!this.instanceMap.has(e)){let r;r="local"===t&&_f("localStorage")?window.localStorage:"session"===t&&_f("sessionStorage")?window.sessionStorage:new kf,this.instanceMap.set(e,new this(e,r))}return this.instanceMap.get(e)}toJSON(){return this.storage.getItem(this._storeKey)}resetStore(){const e=this.getStore();return this.storage.removeItem(this._storeKey),e}getStore(){return JSON.parse(this.storage.getItem(this._storeKey)||"{}")}get(e){return JSON.parse(this.storage.getItem(this._storeKey)||"{}")[e]}set(e,t){const r=JSON.parse(this.storage.getItem(this._storeKey)||"{}");r[e]=t,this.storage.setItem(this._storeKey,JSON.stringify(r))}}r(Sf,"instanceMap",new Map);const Pf="popup",If="redirect",Tf=i(i({},wf),vf),Of="secp256k1",Mf="ed25519",Cf="facebook",Bf="line",Nf="login",Rf="enable_mfa",Ff="manage_mfa",Lf="modify_social_factor",Uf="production",jf="development",Df="staging",zf="testing";var $f,Hf=($f=function(e,t){return $f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},$f(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}$f(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Gf=function(e){function t(t,r){var n=this.constructor,i=e.call(this,t,r)||this;return Object.defineProperty(i,"name",{value:n.name,enumerable:!1,configurable:!0}),function(e,t){var r=Object.setPrototypeOf;r?r(e,t):e.__proto__=t}(i,n.prototype),function(e,t){void 0===t&&(t=e.constructor);var r=Error.captureStackTrace;r&&r(e,t)}(i),i}return Hf(t,e),t}(Error),qf={exports:{}};!function(e,t){var r="__lodash_hash_undefined__",n=9007199254740991,i="[object Arguments]",a="[object AsyncFunction]",s="[object Function]",c="[object GeneratorFunction]",u="[object Null]",l="[object Object]",f="[object Proxy]",d="[object Undefined]",h=/^\[object .+?Constructor\]$/,p=/^(?:0|[1-9]\d*)$/,m={};m["[object Float32Array]"]=m["[object Float64Array]"]=m["[object Int8Array]"]=m["[object Int16Array]"]=m["[object Int32Array]"]=m["[object Uint8Array]"]=m["[object Uint8ClampedArray]"]=m["[object Uint16Array]"]=m["[object Uint32Array]"]=!0,m[i]=m["[object Array]"]=m["[object ArrayBuffer]"]=m["[object Boolean]"]=m["[object DataView]"]=m["[object Date]"]=m["[object Error]"]=m[s]=m["[object Map]"]=m["[object Number]"]=m[l]=m["[object RegExp]"]=m["[object Set]"]=m["[object String]"]=m["[object WeakMap]"]=!1;var b="object"==typeof o&&o&&o.Object===Object&&o,g="object"==typeof self&&self&&self.Object===Object&&self,y=b||g||Function("return this")(),v=t&&!t.nodeType&&t,w=v&&e&&!e.nodeType&&e,E=w&&w.exports===v,A=E&&b.process,x=function(){try{var e=w&&w.require&&w.require("util").types;return e||A&&A.binding&&A.binding("util")}catch(e){}}(),_=x&&x.isTypedArray;var k=Array.prototype,S=Function.prototype,P=Object.prototype,I=y["__core-js_shared__"],T=S.toString,O=P.hasOwnProperty,M=function(){var e=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),C=P.toString,B=T.call(Object),N=RegExp("^"+T.call(O).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=E?y.Buffer:void 0,F=y.Symbol,L=y.Uint8Array,U=R?R.allocUnsafe:void 0,j=function(e,t){return function(r){return e(t(r))}}(Object.getPrototypeOf,Object),D=Object.create,z=P.propertyIsEnumerable,$=k.splice,H=F?F.toStringTag:void 0,G=function(){try{var e=be(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),q=R?R.isBuffer:void 0,K=Math.max,V=Date.now,W=be(y,"Map"),J=be(Object,"create"),Z=function(){function e(){}return function(t){if(!Ie(t))return{};if(D)return D(t);e.prototype=t;var r=new e;return e.prototype=void 0,r}}();function Y(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t-1},X.prototype.set=function(e,t){var r=this.__data__,n=ie(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Q.prototype.clear=function(){this.size=0,this.__data__={hash:new Y,map:new(W||X),string:new Y}},Q.prototype.delete=function(e){var t=me(this,e).delete(e);return this.size-=t?1:0,t},Q.prototype.get=function(e){return me(this,e).get(e)},Q.prototype.has=function(e){return me(this,e).has(e)},Q.prototype.set=function(e,t){var r=me(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},ee.prototype.clear=function(){this.__data__=new X,this.size=0},ee.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},ee.prototype.get=function(e){return this.__data__.get(e)},ee.prototype.has=function(e){return this.__data__.has(e)},ee.prototype.set=function(e,t){var r=this.__data__;if(r instanceof X){var n=r.__data__;if(!W||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Q(n)}return r.set(e,t),this.size=r.size,this};var ae,se=function(e,t,r){for(var n=-1,i=Object(e),o=r(e),a=o.length;a--;){var s=o[ae?a:++n];if(!1===t(i[s],s,i))break}return e};function ce(e){return null==e?void 0===e?d:u:H&&H in Object(e)?function(e){var t=O.call(e,H),r=e[H];try{e[H]=void 0;var n=!0}catch(e){}var i=C.call(e);n&&(t?e[H]=r:delete e[H]);return i}(e):function(e){return C.call(e)}(e)}function ue(e){return Te(e)&&ce(e)==i}function le(e){return!(!Ie(e)||function(e){return!!M&&M in e}(e))&&(Se(e)?N:h).test(function(e){if(null!=e){try{return T.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e))}function fe(e){if(!Ie(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=ye(e),r=[];for(var n in e)("constructor"!=n||!t&&O.call(e,n))&&r.push(n);return r}function de(e,t,r,n,i){e!==t&&se(t,(function(o,a){if(i||(i=new ee),Ie(o))!function(e,t,r,n,i,o,a){var s=ve(e,r),c=ve(t,r),u=a.get(c);if(u)return void re(e,r,u);var f=o?o(s,c,r+"",e,t,a):void 0,d=void 0===f;if(d){var h=xe(c),p=!h&&ke(c),m=!h&&!p&&Oe(c);f=c,h||p||m?xe(s)?f=s:!function(e){return Te(e)&&_e(e)}(s)?p?(d=!1,f=function(e,t){if(t)return e.slice();var r=e.length,n=U?U(r):new e.constructor(r);return e.copy(n),n}(c,!0)):m?(d=!1,f=function(e,t){var r=t?(n=e.buffer,i=new n.constructor(n.byteLength),new L(i).set(new L(n)),i):e.buffer;var n,i;return new e.constructor(r,e.byteOffset,e.length)}(c,!0)):f=[]:f=function(e,t){var r=-1,n=e.length;t||(t=Array(n));for(;++r-1&&e%1==0&&e0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(pe);function Ee(e,t){return e===t||e!=e&&t!=t}var Ae=ue(function(){return arguments}())?ue:function(e){return Te(e)&&O.call(e,"callee")&&!z.call(e,"callee")},xe=Array.isArray;function _e(e){return null!=e&&Pe(e.length)&&!Se(e)}var ke=q||function(){return!1};function Se(e){if(!Ie(e))return!1;var t=ce(e);return t==s||t==c||t==a||t==f}function Pe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}function Ie(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Te(e){return null!=e&&"object"==typeof e}var Oe=_?function(e){return function(t){return e(t)}}(_):function(e){return Te(e)&&Pe(e.length)&&!!m[ce(e)]};function Me(e){return _e(e)?te(e,!0):fe(e)}var Ce,Be=(Ce=function(e,t,r){de(e,t,r)},he((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(i=Ce.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!Ie(r))return!1;var n=typeof t;return!!("number"==n?_e(r)&&ge(t,r.length):"string"==n&&t in r)&&Ee(r[t],e)}(t[0],t[1],o)&&(i=n<3?void 0:i,n=1),e=Object(e);++r=0&&t<=f.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?d+=":"+e:"symbol"==typeof e&&(d=void 0),f.name=e,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=r||l,f.getLevel=function(){return null!=u?u:null!=s?s:a},f.setLevel=function(e,r){return u=p(e),!1!==r&&function(e){var r=(n[e]||"silent").toUpperCase();if(typeof window!==t&&d){try{return void(window.localStorage[d]=r)}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"="+r+";"}catch(e){}}}(u),c.call(f)},f.setDefaultLevel=function(e){s=p(e),h()||f.setLevel(e,!1)},f.resetLevel=function(){u=null,function(){if(typeof window!==t&&d){try{window.localStorage.removeItem(d)}catch(e){}try{window.document.cookie=encodeURIComponent(d)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),c.call(f)},f.enableAll=function(e){f.setLevel(f.levels.TRACE,e)},f.disableAll=function(e){f.setLevel(f.levels.SILENT,e)},f.rebuild=function(){if(o!==f&&(a=p(o.getLevel())),c.call(f),o===f)for(var e in i)i[e].rebuild()},a=p(o?o.getLevel():"WARN");var m=h();null!=m&&(u=p(m)),c.call(f)}(o=new f).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=i[e];return t||(t=i[e]=new f(e,o.methodFactory)),t};var d=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=d),o},o.getLoggers=function(){return i},o.default=o,o}))}(Vf);var Wf=Vf.exports,Jf=a(Wf);const Zf=Jf.getLogger("http-helpers");Zf.setLevel(Wf.levels.INFO);async function Yf(e,t){let r=null;try{r=new URL(e)}catch(e){}return fetch(e,t)}function Xf(){const e={"x-api-key":"torus-default"};return e}function Qf(e){Zf.info(`Response: ${e.status} ${e.statusText}`),Zf.info(`Url: ${e.url}`)}const ed=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r={mode:"cors",headers:{}};(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).useAPIKey&&(r.headers=i(i({},r.headers),Xf()));const n=Kf(r,t,{method:"GET"}),o=await Yf(e,n);if(o.ok){const e=o.headers.get("content-type");return null!=e&&e.includes("application/json")?o.json():o.text()}throw Qf(o),o},td=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};n.useAPIKey&&(o.headers=i(i({},o.headers),Xf()));const a=Kf(o,r,{method:"POST"});return n.isUrlEncodedData?(a.body=t,"application/json; charset=utf-8"===a.headers["Content-Type"]&&delete a.headers["Content-Type"]):a.body=JSON.stringify(t),(async(e,t)=>{let r=null;try{const n=new Promise(((t,n)=>{r=setTimeout((()=>{n(new Error(`Timed out in ${e}ms`))}),e)})),i=await Promise.race([t,n]);return null!=r&&clearTimeout(r),i}catch(e){throw null!=r&&clearTimeout(r),e}})(n.timeout||6e4,Yf(e,a).then((e=>{if(n.logTracingHeader&&function(e){const t=e.headers.get("x-web3-correlation-id");t&&Zf.info(`Request tracing with traceID = ${t}`)}(e),e.ok){const t=e.headers.get("content-type");return null!=t&&t.includes("application/json")?e.json():e.text()}throw Qf(e),e})))};class rd extends Error{}rd.prototype.name="InvalidTokenError";const nd={EIP155:"eip155",SOLANA:"solana",OTHER:"other"},id="multichain",od=(e,t)=>{if(e===nd.OTHER)return null;const r=t?"number"==typeof t?t:parseInt(t,16):(e=>{if(e===nd.EIP155)return 1;if(e===nd.SOLANA)return 1;throw new Error(`Chain namespace ${e} is not supported`)})(e);return e===nd.EIP155?(e=>{const t=nd.EIP155;return 1===e?{chainNamespace:t,chainId:"0x1",rpcTarget:"https://rpc.ankr.com/eth",displayName:"Ethereum Mainnet",blockExplorer:"https://etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:5===e?{chainNamespace:t,chainId:"0x5",rpcTarget:"https://rpc.ankr.com/eth_goerli",displayName:"Goerli Testnet",blockExplorer:"https://goerli.etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:11155111===e?{chainNamespace:t,chainId:"0xaa36a7",rpcTarget:"https://rpc.ankr.com/eth_sepolia",displayName:"Sepolia Testnet",blockExplorer:"https://sepolia.etherscan.io/",ticker:"ETH",tickerName:"Ethereum",decimals:18}:137===e?{chainNamespace:t,chainId:"0x89",rpcTarget:"https://rpc.ankr.com/polygon",displayName:"Polygon Mainnet",blockExplorer:"https://polygonscan.com",ticker:"MATIC",tickerName:"Polygon"}:80001===e?{chainNamespace:t,chainId:"0x13881",rpcTarget:"https://rpc.ankr.com/polygon_mumbai",displayName:"Polygon Mumbai Testnet",blockExplorer:"https://mumbai.polygonscan.com/",ticker:"MATIC",tickerName:"Polygon",decimals:18}:56===e?{chainNamespace:t,chainId:"0x38",rpcTarget:"https://rpc.ankr.com/bsc",displayName:"Binance SmartChain Mainnet",blockExplorer:"https://bscscan.com",ticker:"BNB",tickerName:"Binance SmartChain",decimals:18}:97===e?{chainNamespace:t,chainId:"0x61",rpcTarget:"https://rpc.ankr.com/bsc_testnet_chapel",displayName:"Binance SmartChain Testnet",blockExplorer:"https://testnet.bscscan.com",ticker:"BNB",tickerName:"Binance SmartChain",decimals:18}:25===e?{chainNamespace:t,chainId:"0x19",rpcTarget:"https://rpc.cronos.org",displayName:"Cronos Mainnet",blockExplorer:"https://cronoscan.com/",ticker:"CRO",tickerName:"Cronos"}:338===e?{chainNamespace:t,chainId:"0x152",rpcTarget:"https://rpc-t3.cronos.org/",displayName:"Cronos Testnet",blockExplorer:"https://cronoscan.com/",ticker:"CRO",tickerName:"Cronos",decimals:18}:8217===e?{chainNamespace:t,chainId:"0x2019",rpcTarget:"https://public-node-api.klaytnapi.com/v1/cypress",displayName:"Klaytn Mainnet",blockExplorer:"https://scope.klaytn.com",ticker:"KLAY",tickerName:"Klaytn",decimals:18}:null})(r):e===nd.SOLANA?(e=>{const t=nd.SOLANA;return 1===e?{chainNamespace:t,chainId:"0x1",rpcTarget:"https://rpc.ankr.com/solana",displayName:"Solana Mainnet",blockExplorer:"https://explorer.solana.com",ticker:"SOL",tickerName:"Solana",decimals:9}:2===e?{chainNamespace:t,chainId:"0x2",rpcTarget:"https://api.testnet.solana.com",displayName:"Solana Testnet",blockExplorer:"https://explorer.solana.com?cluster=testnet",ticker:"SOL",tickerName:"Solana",decimals:9}:3===e?{chainNamespace:t,chainId:"0x3",rpcTarget:"https://api.devnet.solana.com",displayName:"Solana Devnet",blockExplorer:"https://explorer.solana.com?cluster=devnet",ticker:"SOL",tickerName:"Solana",decimals:9}:null})(r):null};class ad extends Gf{constructor(e,t){super(t),r(this,"code",void 0),r(this,"message",void 0),this.code=e,this.message=t||"",Object.defineProperty(this,"name",{value:"Web3AuthError"})}toJSON(){return{name:this.name,code:this.code,message:this.message}}toString(){return JSON.stringify(this.toJSON())}}class sd extends ad{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"WalletInitializationError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new sd(e,`${sd.messages[e]}, ${t}`)}static notFound(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5001,e)}static notInstalled(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5002,e)}static notReady(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5003,e)}static windowBlocked(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5004,e)}static windowClosed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5005,e)}static incompatibleChainNameSpace(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5006,e)}static duplicateAdapterError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5007,e)}static invalidProviderConfigError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5008,e)}static providerNotReadyError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5009,e)}static rpcConnectionError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5010,e)}static invalidParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5011,e)}static invalidNetwork(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return sd.fromCode(5013,e)}}r(sd,"messages",{5e3:"Custom",5001:"Wallet is not found",5002:"Wallet is not installed",5003:"Wallet is not ready yet",5004:"Wallet window is blocked",5005:"Wallet window has been closed by the user",5006:"Incompatible chain namespace provided",5007:"Adapter has already been included",5008:"Invalid provider Config",5009:"Provider is not ready yet",5010:"Failed to connect with rpc url",5011:"Invalid params passed in",5013:"Invalid network provided"});class cd extends ad{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"WalletLoginError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new cd(e,`${cd.messages[e]}. ${t}`)}static connectionError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return cd.fromCode(5111,e)}static disconnectionError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return cd.fromCode(5112,e)}static notConnectedError(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return cd.fromCode(5113,e)}static popupClosed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return cd.fromCode(5114,e)}static mfaEnabled(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return cd.fromCode(5115,e)}static chainConfigNotAdded(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return cd.fromCode(5116,e)}static unsupportedOperation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return cd.fromCode(5117,e)}static coreKitKeyNotFound(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return cd.fromCode(5118,e)}static userNotLoggedIn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return cd.fromCode(5119,e)}}r(cd,"messages",{5e3:"Custom",5111:"Failed to connect with wallet",5112:"Failed to disconnect from wallet",5113:"Wallet is not connected",5114:"Wallet popup has been closed by the user",5115:"User has already enabled mfa, please use the @web3auth/web3auth-web sdk for login with mfa",5116:"Chain config has not been added. Please add the chain config before calling switchChain",5117:"Unsupported operation",5118:"useCoreKitKey flag is enabled but coreKitKey is not available",5119:"User not logged in."});class ud extends ad{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"WalletOperationsError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new ud(e,`${ud.messages[e]}, ${t}`)}static chainIDNotAllowed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return ud.fromCode(5201,e)}static operationNotAllowed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return ud.fromCode(5202,e)}static chainNamespaceNotAllowed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return ud.fromCode(5203,e)}}r(ud,"messages",{5e3:"Custom",5201:"Provided chainId is not allowed",5202:"This operation is not allowed"});class ld extends ad{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"WalletProviderError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new ud(e,`${ld.messages[e]}, ${t}`)}static invalidRequestArgs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return ud.fromCode(5301,e)}static invalidRequestMethod(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return ud.fromCode(5302,e)}static invalidRequestParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return ud.fromCode(5303,e)}}r(ld,"messages",{5e3:"Custom",5301:"Expected a single, non-array, object argument.",5302:"'args.method' must be a non-empty string.",5303:"'args.params' must be an object or array if provided."});const fd={OPENLOGIN:"openlogin",WALLET_CONNECT_V2:"wallet-connect-v2"},dd=i({TORUS_SOLANA:"torus-solana",PHANTOM:"phantom",SOLFLARE:"solflare",SLOPE:"slope"},fd),hd=i({TORUS_EVM:"torus-evm",METAMASK:"metamask",COINBASE:"coinbase"},fd),pd=i(i({},hd),dd);dd.TORUS_SOLANA,dd.PHANTOM,dd.SOLFLARE,dd.SLOPE,hd.TORUS_EVM,hd.METAMASK,hd.COINBASE;const md="in_app",bd={NOT_READY:"not_ready",READY:"ready",CONNECTING:"connecting",CONNECTED:"connected",DISCONNECTED:"disconnected",ERRORED:"errored"},gd=i(i({},bd),{},{ADAPTER_DATA_UPDATED:"adapter_data_updated",CACHE_CLEAR:"cache_clear"});class yd extends nf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),r(this,"adapterData",{}),r(this,"sessionTime",86400),r(this,"clientId",void 0),r(this,"web3AuthNetwork",Tf.MAINNET),r(this,"useCoreKitKey",void 0),r(this,"rehydrated",!1),r(this,"chainConfig",null),r(this,"knownChainConfigs",{}),r(this,"adapterNamespace",void 0),r(this,"currentChainNamespace",void 0),r(this,"type",void 0),r(this,"name",void 0),r(this,"status",void 0),this.setAdapterSettings(e)}get chainConfigProxy(){return this.chainConfig?i({},this.chainConfig):null}get connnected(){return this.status===bd.CONNECTED}setAdapterSettings(e){if(this.status===bd.READY)return;null!=e&&e.sessionTime&&(this.sessionTime=e.sessionTime),null!=e&&e.clientId&&(this.clientId=e.clientId),null!=e&&e.web3AuthNetwork&&(this.web3AuthNetwork=e.web3AuthNetwork),void 0!==(null==e?void 0:e.useCoreKitKey)&&(this.useCoreKitKey=e.useCoreKitKey);const t=e.chainConfig;if(t){if(!t.chainNamespace)throw sd.notReady("ChainNamespace is required while setting chainConfig");this.currentChainNamespace=t.chainNamespace;const e=i(i({},od(t.chainNamespace,t.chainId)||{}),t);this.chainConfig=e,this.addChainConfig(e)}}checkConnectionRequirements(){if(this.name!==pd.WALLET_CONNECT_V2||this.status!==bd.CONNECTING){if(this.status===bd.CONNECTING)throw sd.notReady("Already connecting");if(this.status===bd.CONNECTED)throw cd.connectionError("Already connected");if(this.status!==bd.READY)throw cd.connectionError("Wallet adapter is not ready yet, Please wait for init function to resolve before calling connect/connectTo function")}}checkInitializationRequirements(){if(!this.clientId)throw sd.invalidParams("Please initialize Web3Auth with a valid clientId in constructor");if(!this.chainConfig)throw sd.invalidParams("rpcTarget is required in chainConfig");if(!this.chainConfig.rpcTarget&&this.chainConfig.chainNamespace!==nd.OTHER)throw sd.invalidParams("rpcTarget is required in chainConfig");if(!this.chainConfig.chainId&&this.chainConfig.chainNamespace!==nd.OTHER)throw sd.invalidParams("chainID is required in chainConfig");if(this.status!==bd.NOT_READY){if(this.status===bd.CONNECTED)throw sd.notReady("Already connected");if(this.status===bd.READY)throw sd.notReady("Adapter is already initialized")}}checkDisconnectionRequirements(){if(this.status!==bd.CONNECTED)throw cd.disconnectionError("Not connected with wallet")}checkAddChainRequirements(e){if(!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&!this.provider)throw cd.notConnectedError("Not connected with wallet.");if(this.currentChainNamespace!==e.chainNamespace)throw ud.chainNamespaceNotAllowed("This adapter doesn't support this chainNamespace")}checkSwitchChainRequirements(e){let{chainId:t}=e;if(!(arguments.length>1&&void 0!==arguments[1]&&arguments[1])&&!this.provider)throw cd.notConnectedError("Not connected with wallet.");if(!this.knownChainConfigs[t])throw cd.chainConfigNotAdded("Invalid chainId")}updateAdapterData(e){this.adapterData=e,this.emit(gd.ADAPTER_DATA_UPDATED,{adapterName:this.name,data:e})}addChainConfig(e){const t=this.knownChainConfigs[e.chainId];this.knownChainConfigs[e.chainId]=i(i({},t||{}),e)}getChainConfig(e){return this.knownChainConfigs[e]||null}}var vd=Jf.getLogger("web3auth-logger");function wd(e){let t,r=!1,n=0;try{t=window[e],r=!0,n=t.length;const i="__storage_test__";return t.setItem(i,i),t.removeItem(i),!0}catch(e){const t=e;return!(!t||22!==t.code&&1014!==t.code&&"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||!r||0===n)}}const Ed=e=>("string"==typeof e||"number"==typeof e)&&/^(-)?0x[0-9a-f]*$/i.test(e),Ad=i(i({},nd),{},{MULTICHAIN:"multichain"});function xd(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function _d(e,...t){if(!((r=e)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Expected Uint8Array");var r;if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function kd(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");xd(e.outputLen),xd(e.blockLen)}function Sd(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Pd(e,t){_d(e);const r=t.outputLen;if(e.lengthnew DataView(e.buffer,e.byteOffset,e.byteLength),Cd=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function Bd(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function Nd(e){if("string"==typeof e&&(e=Bd(e)),!Od(e))throw new Error("expected Uint8Array, got "+typeof e);return e}let Rd=class{clone(){return this._cloneInto()}};function Fd(e){const t=t=>e().update(Nd(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Ld(e=32){if(Td&&"function"==typeof Td.getRandomValues)return Td.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}let Ud=class extends Rd{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Md(this.buffer)}update(e){Sd(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=Nd(e)).length;for(let o=0;on-o&&(this.process(r,0),o=0);for(let e=o;e>i&o),s=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,a,n),e.setUint32(t+u,s,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const a=Md(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=s/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^e&r^t&r,Dd=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),zd=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),$d=new Uint32Array(64);let Hd=class extends Ud{constructor(){super(64,32,8,!1),this.A=0|zd[0],this.B=0|zd[1],this.C=0|zd[2],this.D=0|zd[3],this.E=0|zd[4],this.F=0|zd[5],this.G=0|zd[6],this.H=0|zd[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)$d[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=$d[e-15],r=$d[e-2],n=Cd(t,7)^Cd(t,18)^t>>>3,i=Cd(r,17)^Cd(r,19)^r>>>10;$d[e]=i+$d[e-7]+n+$d[e-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(Cd(a,6)^Cd(a,11)^Cd(a,25))+((l=a)&s^~l&c)+Dd[e]+$d[e]|0,f=(Cd(r,2)^Cd(r,13)^Cd(r,22))+jd(r,n,i)|0;u=c,c=s,s=a,a=o+t|0,o=i,i=n,n=r,r=t+f|0}var l;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,a,s,c,u)}roundClean(){$d.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Gd=Fd((()=>new Hd)),qd=BigInt(0),Kd=BigInt(1),Vd=BigInt(2); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Wd(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}const Jd=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Zd(e){if(!Wd(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r=Qd._0&&e<=Qd._9?e-Qd._0:e>=Qd._A&&e<=Qd._F?e-(Qd._A-10):e>=Qd._a&&e<=Qd._f?e-(Qd._a-10):void 0}function th(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t(Vd<new Uint8Array(e),lh=e=>Uint8Array.from(e);function fh(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=uh(e),i=uh(e),o=0;const a=()=>{n.fill(1),i.fill(0),o=0},s=(...e)=>r(i,n,...e),c=(e=uh())=>{i=s(lh([0]),e),n=s(),0!==e.length&&(i=s(lh([1]),e),n=s())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e{let r;for(a(),c(e);!(r=t(u()));)c();return a(),r}}const dh={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||Wd(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function hh(e,t,r={}){const n=(t,r,n)=>{const i=dh[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}var ph=Object.freeze({__proto__:null,bitGet:function(e,t){return e>>BigInt(t)&Kd},bitLen:function(e){let t;for(t=0;e>qd;e>>=Kd,t+=1);return t},bitMask:ch,bitSet:(e,t,r)=>e|(r?Kd:qd)<=mh?r:t+r}function xh(e,t,r){if(r<=mh||t 0");if(r===bh)return mh;let n=bh;for(;t>mh;)t&bh&&(n=n*e%r),e=e*e%r,t>>=bh;return n}function _h(e,t,r){let n=e;for(;t-- >mh;)n*=n,n%=r;return n}function kh(e,t){if(e===mh||t<=mh)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=Ah(e,t),n=t,i=mh,o=bh;for(;r!==mh;){const e=n%r,t=i-o*(n/r);n=r,r=e,i=o,o=t}if(n!==bh)throw new Error("invert: does not exist");return Ah(i,t)}function Sh(e){if(e%vh===yh){const t=(e+bh)/vh;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%Eh===wh){const t=(e-wh)/Eh;return function(e,r){const n=e.mul(r,gh),i=e.pow(n,t),o=e.mul(r,i),a=e.mul(e.mul(o,gh),i),s=e.mul(o,e.sub(a,e.ONE));if(!e.eql(e.sqr(s),r))throw new Error("Cannot find square root");return s}}return function(e){const t=(e-bh)/gh;let r,n,i;for(r=e-bh,n=0;r%gh===mh;r/=gh,n++);for(i=gh;i(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});hh(e,t)}(e.Fp),hh(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ih(e.n,e.nBitLength),...e,p:e.Fp.ORDER})} /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:Nh,hexToBytes:Rh}=ph,Fh={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=Fh;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Nh(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=Fh,r="string"==typeof e?Rh(e):e;if(!Wd(r))throw new Error("ui8a expected");let n=r.length;if(n<2||48!=r[0])throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=Fh._parseInt(r.subarray(2)),{d:a,l:s}=Fh._parseInt(o);if(s.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),i=t(r(e.r)),o=n.length/2,a=i.length/2,s=r(o),c=r(a);return`30${r(a+o+4)}02${c}${i}02${s}${n}`}},Lh=BigInt(0),Uh=BigInt(1);BigInt(2);const jh=BigInt(3);function Dh(e){const t=function(e){const t=Bh(e);hh(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:r}=t,n=t.toBytes||((e,t,n)=>{const i=t.toAffine();return sh(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=t.fromBytes||(e=>{const t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function o(e){const{a:n,b:i}=t,o=r.sqr(e),a=r.mul(o,e);return r.add(r.add(a,r.mul(e,n)),i)}if(!r.eql(r.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(e){return"bigint"==typeof e&&Lhr.eql(e,r.ZERO);return i(t)&&i(n)?f.ZERO:new f(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}static fromHex(e){const t=f.fromAffine(i(ah("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return f.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:n}=this.toAffine();if(!r.isValid(e)||!r.isValid(n))throw new Error("bad point: x or y not FE");const i=r.sqr(n),a=o(e);if(!r.eql(i,a))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){l(e);const{px:t,py:n,pz:i}=this,{px:o,py:a,pz:s}=e,c=r.eql(r.mul(t,s),r.mul(o,i)),u=r.eql(r.mul(n,s),r.mul(a,i));return c&&u}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){const{a:e,b:n}=t,i=r.mul(n,jh),{px:o,py:a,pz:s}=this;let c=r.ZERO,u=r.ZERO,l=r.ZERO,d=r.mul(o,o),h=r.mul(a,a),p=r.mul(s,s),m=r.mul(o,a);return m=r.add(m,m),l=r.mul(o,s),l=r.add(l,l),c=r.mul(e,l),u=r.mul(i,p),u=r.add(c,u),c=r.sub(h,u),u=r.add(h,u),u=r.mul(c,u),c=r.mul(m,c),l=r.mul(i,l),p=r.mul(e,p),m=r.sub(d,p),m=r.mul(e,m),m=r.add(m,l),l=r.add(d,d),d=r.add(l,d),d=r.add(d,p),d=r.mul(d,m),u=r.add(u,d),p=r.mul(a,s),p=r.add(p,p),d=r.mul(p,m),c=r.sub(c,d),l=r.mul(p,h),l=r.add(l,l),l=r.add(l,l),new f(c,u,l)}add(e){l(e);const{px:n,py:i,pz:o}=this,{px:a,py:s,pz:c}=e;let u=r.ZERO,d=r.ZERO,h=r.ZERO;const p=t.a,m=r.mul(t.b,jh);let b=r.mul(n,a),g=r.mul(i,s),y=r.mul(o,c),v=r.add(n,i),w=r.add(a,s);v=r.mul(v,w),w=r.add(b,g),v=r.sub(v,w),w=r.add(n,o);let E=r.add(a,c);return w=r.mul(w,E),E=r.add(b,y),w=r.sub(w,E),E=r.add(i,o),u=r.add(s,c),E=r.mul(E,u),u=r.add(g,y),E=r.sub(E,u),h=r.mul(p,w),u=r.mul(m,y),h=r.add(u,h),u=r.sub(g,h),h=r.add(g,h),d=r.mul(u,h),g=r.add(b,b),g=r.add(g,b),y=r.mul(p,y),w=r.mul(m,w),g=r.add(g,y),y=r.sub(b,y),y=r.mul(p,y),w=r.add(w,y),b=r.mul(g,w),d=r.add(d,b),b=r.mul(E,w),u=r.mul(v,u),u=r.sub(u,b),b=r.mul(v,g),h=r.mul(E,h),h=r.add(h,b),new f(u,d,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(f.ZERO)}wNAF(e){return h.wNAFCached(this,u,e,(e=>{const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}))}multiplyUnsafe(e){const n=f.ZERO;if(e===Lh)return n;if(s(e),e===Uh)return this;const{endo:i}=t;if(!i)return h.unsafeLadder(this,e);let{k1neg:o,k1:a,k2neg:c,k2:u}=i.splitScalar(e),l=n,d=n,p=this;for(;a>Lh||u>Lh;)a&Uh&&(l=l.add(p)),u&Uh&&(d=d.add(p)),p=p.double(),a>>=Uh,u>>=Uh;return o&&(l=l.negate()),c&&(d=d.negate()),d=new f(r.mul(d.px,i.beta),d.py,d.pz),l.add(d)}multiply(e){s(e);let n,i,o=e;const{endo:a}=t;if(a){const{k1neg:e,k1:t,k2neg:s,k2:c}=a.splitScalar(o);let{p:u,f:l}=this.wNAF(t),{p:d,f:p}=this.wNAF(c);u=h.constTimeNegate(e,u),d=h.constTimeNegate(s,d),d=new f(r.mul(d.px,a.beta),d.py,d.pz),n=u.add(d),i=l.add(p)}else{const{p:e,f:t}=this.wNAF(o);n=e,i=t}return f.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(e,t,r){const n=f.BASE,i=(e,t)=>t!==Lh&&t!==Uh&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){const{px:t,py:n,pz:i}=this,o=this.is0();null==e&&(e=o?r.ONE:r.inv(i));const a=r.mul(t,e),s=r.mul(n,e),c=r.mul(i,e);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw new Error("invZ was invalid");return{x:a,y:s}}isTorsionFree(){const{h:e,isTorsionFree:r}=t;if(e===Uh)return!0;if(r)return r(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:r}=t;return e===Uh?this:r?r(f,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),n(f,this,e)}toHex(e=!0){return Zd(this.toRawBytes(e))}}f.BASE=new f(t.Gx,t.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);const d=t.nBitLength,h=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>Mh;)r&Ch&&(n=n.add(i)),i=i.double(),r>>=Ch;return n},precomputeWindow(e,t){const{windows:r,windowSize:i}=n(t),o=[];let a=e,s=a;for(let e=0;e>=d,n>s&&(n-=f,o+=Ch);const a=t,h=t+Math.abs(n)-1,p=e%2!=0,m=n<0;0===n?u=u.add(r(p,i[a])):c=c.add(r(m,i[h]))}return{p:c,f:u}},wNAFCached(e,t,r,n){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}}(f,t.endo?Math.ceil(d/2):d);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function zh(e){const t=function(e){const t=Bh(e);return hh(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:n}=t,i=r.BYTES+1,o=2*r.BYTES+1;function a(e){return Ah(e,n)}function s(e){return kh(e,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:f}=Dh({...t,toBytes(e,t,n){const i=t.toAffine(),o=r.toBytes(i.x),a=sh;return n?a(Uint8Array.from([t.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(e){const t=e.length,n=e[0],a=e.subarray(1);if(t!==i||2!==n&&3!==n){if(t===o&&4===n){return{x:r.fromBytes(a.subarray(0,r.BYTES)),y:r.fromBytes(a.subarray(r.BYTES,2*r.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const e=rh(a);if(!(Lh<(s=e)&&sZd(ih(e,t.nByteLength));function h(e){return e>n>>Uh}const p=(e,t,r)=>rh(e.slice(t,r));class m{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const r=t.nByteLength;return e=ah("compactSignature",e,2*r),new m(p(e,0,r),p(e,r,2*r))}static fromDER(e){const{r:t,s:r}=Fh.toSig(ah("DER",e));return new m(t,r)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new m(this.r,this.s,e)}recoverPublicKey(e){const{r:n,s:i,recovery:o}=this,u=v(ah("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const l=2===o||3===o?n+t.n:n;if(l>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const f=1&o?"03":"02",h=c.fromHex(f+d(l)),p=s(l),m=a(-u*p),b=a(i*p),g=c.BASE.multiplyAndAddUnsafe(h,m,b);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return th(this.toDERHex())}toDERHex(){return Fh.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return th(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}const b={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=Oh(t.n);return function(e,t,r=!1){const n=e.length,i=Th(t),o=Oh(t);if(n<16||n1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const a=Ah(r?rh(e):nh(e),t-bh)+bh;return r?oh(a,i):ih(a,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function g(e){const t=Wd(e),r="string"==typeof e,n=(t||r)&&e.length;return t?n===i||n===o:r?n===2*i||n===2*o:e instanceof c}const y=t.bits2int||function(e){const r=rh(e),n=8*e.length-t.nBitLength;return n>0?r>>BigInt(n):r},v=t.bits2int_modN||function(e){return a(y(e))},w=ch(t.nBitLength);function E(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(Lh<=e&&ee in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:l}=t;let{lowS:d,prehash:p,extraEntropy:b}=i;null==d&&(d=!0),e=ah("msgHash",e),p&&(e=ah("prehashed msgHash",o(e)));const g=v(e),w=u(n),A=[E(w),E(g)];if(null!=b){const e=!0===b?l(r.BYTES):b;A.push(ah("extraEntropy",e))}const _=sh(...A),k=g;return{seed:_,k2sig:function(e){const t=y(e);if(!f(t))return;const r=s(t),n=c.BASE.multiply(t).toAffine(),i=a(n.x);if(i===Lh)return;const o=a(r*a(k+i*w));if(o===Lh)return;let u=(n.x===i?0:2)|Number(n.y&Uh),l=o;return d&&h(o)&&(l=function(e){return h(e)?a(-e):e}(o),u^=1),new m(i,l,u)}}}const x={lowS:t.lowS,prehash:!1},_={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(g(e))throw new Error("first arg must be private key");if(!g(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(r)},sign:function(e,r,n=x){const{seed:i,k2sig:o}=A(e,r,n),a=t;return fh(a.hash.outputLen,a.nByteLength,a.hmac)(i,o)},verify:function(e,r,n,i=_){const o=e;if(r=ah("msgHash",r),n=ah("publicKey",n),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=i;let f,d;try{if("string"==typeof o||Wd(o))try{f=m.fromDER(o)}catch(e){if(!(e instanceof Fh.Err))throw e;f=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:e,s:t}=o;f=new m(e,t)}}d=c.fromHex(n)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&f.hasHighS())return!1;l&&(r=t.hash(r));const{r:h,s:p}=f,b=v(r),g=s(p),y=a(b*g),w=a(h*g),E=c.BASE.multiplyAndAddUnsafe(d,y,w)?.toAffine();return!!E&&a(E.x)===h},ProjectivePoint:c,Signature:m,utils:b}}BigInt(4);let $h=class extends Rd{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,kd(e);const r=Nd(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let e=0;enew $h(e,t).update(r).digest(); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function Gh(e){return{hash:e,hmac:(t,...r)=>Hh(e,t,function(...e){let t=0;for(let r=0;rnew $h(e,t); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const qh=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Kh=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Vh=BigInt(1),Wh=BigInt(2),Jh=(e,t)=>(e+t/Wh)/t;const Zh=function(e,t,r=!1,n={}){if(e<=mh)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=Ih(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=Sh(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:ch(i),ZERO:mh,ONE:bh,create:t=>Ah(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return mh<=t&&te===mh,isOdd:e=>(e&bh)===bh,neg:t=>Ah(-t,e),eql:(e,t)=>e===t,sqr:t=>Ah(t*t,e),add:(t,r)=>Ah(t+r,e),sub:(t,r)=>Ah(t-r,e),mul:(t,r)=>Ah(t*r,e),pow:(e,t)=>function(e,t,r){if(r 0");if(r===mh)return e.ONE;if(r===bh)return t;let n=e.ONE,i=t;for(;r>mh;)r&bh&&(n=e.mul(n,i)),i=e.sqr(i),r>>=bh;return n}(s,e,t),div:(t,r)=>Ah(t*kh(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>kh(t,e),sqrt:n.sqrt||(e=>a(s,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),i=e.inv(n);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),i),r}(s,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?oh(e,o):ih(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return r?nh(e):rh(e)}});return Object.freeze(s)}(qh,void 0,void 0,{sqrt:function(e){const t=qh,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=_h(l,r,t)*l%t,d=_h(f,r,t)*l%t,h=_h(d,Wh,t)*u%t,p=_h(h,i,t)*h%t,m=_h(p,o,t)*p%t,b=_h(m,s,t)*m%t,g=_h(b,c,t)*b%t,y=_h(g,s,t)*m%t,v=_h(y,r,t)*l%t,w=_h(v,a,t)*p%t,E=_h(w,n,t)*u%t,A=_h(E,Wh,t);if(!Zh.eql(Zh.sqr(A),e))throw new Error("Cannot find square root");return A}}),Yh=function(e,t){const r=t=>zh({...e,...Gh(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:Zh,n:Kh,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Kh,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Vh*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,a=BigInt("0x100000000000000000000000000000000"),s=Jh(o*e,t),c=Jh(-n*e,t);let u=Ah(e-s*r-c*i,t),l=Ah(-s*n-c*o,t);const f=u>a,d=l>a;if(f&&(u=t-u),d&&(l=t-l),u>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:d,k2:l}}}},Gd);function Xh(e,t){if(e.length!==t.length)return!1;for(let r=0;r(Id.bytes(t),e(t))}function ep(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type "+typeof e);return"0"===e[0]&&"x"===e[1]}BigInt(0),Yh.ProjectivePoint,Id.bool,Id.bytes,(()=>{const e="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,t="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);t&&!e&&t("crypto")})();const tp=e=>{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return ep(e)?e.slice(2):e};function rp(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}const np=BigInt(0),ip={},op={};for(let e=0;e<16;e++){const t=e,r=16*e,n=e.toString(16).toLowerCase();op[n]=t,op[n.toUpperCase()]=t,ip[n]=r,ip[n.toUpperCase()]=r}function ap(e){const t=e.length,r=new Uint8Array(t/2);for(let n=0;nt.toString(16).padStart(2,"0"))),cp=[];for(let e=0;e<=65535;e++)cp[e]=BigInt(e);const up=(e,t=!1)=>{t&&e.reverse();const r=(e=>{let t="0x";if(void 0===e||0===e.length)return t;for(const r of e)t+=sp[r];return t})(e);return"0x"===r?np:4===r.length?cp[e[0]]:6===r.length?cp[256*e[0]+e[1]]:BigInt(r)},lp=e=>{if("string"!=typeof e)throw new Error(`hex argument type ${typeof e} must be of type string`);if(!/^0x[0-9a-fA-F]*$/.test(e))throw new Error(`Input must be a 0x-prefixed hexadecimal string, got ${e}`);return(e=e.slice(2)).length%2!=0&&(e=rp(e)),ap(e)},fp=e=>{const t=(e=>{if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`})(e);return lp(t)},dp=(e,t=!1)=>{const r=hp("0x"+rp(e.toString(16)));return t?r.reverse():r},hp=e=>{if(null==e)return new Uint8Array;if(Array.isArray(e)||e instanceof Uint8Array)return Uint8Array.from(e);if("string"==typeof e){if(!function(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||void 0!==t&&t>0&&e.length!==2+2*t)}(e))throw new Error(`Cannot convert string to Uint8Array. toBytes only supports 0x-prefixed hex strings and this string was given: ${e}`);return lp(e)}if("number"==typeof e)return fp(e);if("bigint"==typeof e){if(e{if("0x"===e.slice(0,2))throw new Error("hex string is prefixed with 0x, should be unprefixed");return ap(rp(e))})(t)}if(void 0!==e.toBytes)return e.toBytes();throw new Error("invalid type")},pp=e=>BigInt.asIntN(256,up(e)),mp=e=>dp(BigInt.asUintN(256,e));BigInt("0xffffffffffffffff"),BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),Yh.CURVE.n,Yh.CURVE.n,BigInt(2),BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");lp("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470");lp("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347");lp("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"),Uint8Array.from([128]),BigInt(-1),BigInt(0),BigInt(1);const bp=BigInt(2);BigInt(3),BigInt(7),BigInt(8),BigInt(27),BigInt(28),BigInt(31),BigInt(32),BigInt(64),BigInt(128),BigInt(255),BigInt(256),BigInt(96),BigInt(100),BigInt(160),BigInt(224),BigInt(7922816251426434e13),BigInt(1461501637330903e33),BigInt(2695994666715064e52),BigInt(1e9),Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));const gp=BigInt(2**32-1),yp=BigInt(32);function vp(e,t=!1){return t?{h:Number(e&gp),l:Number(e>>yp&gp)}:{h:0|Number(e>>yp&gp),l:0|Number(e&gp)}}function wp(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i>Pp)*Tp)%Ip,t&Sp&&(i^=kp<<(kp<r>32?((e,t,r)=>t<>>64-r)(e,t,r):((e,t,r)=>e<>>32-r)(e,t,r),Bp=(e,t,r)=>r>32?((e,t,r)=>e<>>64-r)(e,t,r):((e,t,r)=>t<>>32-r)(e,t,r);let Np=class e extends Rd{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,xd(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)))(this.state)}keccak(){!function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=Cp(o,a,1)^r[n],c=Bp(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=Ap[r],o=Cp(t,i,n),a=Bp(t,i,n),s=Ep[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=Op[n],e[1]^=Mp[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Sd(this);const{blockLen:t,state:r}=this,n=(e=Nd(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return xd(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Pd(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return t||(t=new e(r,n,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}};const Rp=((e,t,r)=>Fd((()=>new Np(t,e,r))))(1,136,32),Fp=(()=>{const e=Qh(Rp);return e.create=Rp.create,e})();var Lp,Up,jp;!function(e){e.String="string",e.Bytes="view",e.Number="number"}(Lp||(Lp={})),function(e){e.String="string",e.Bytes="view",e.JSON="json"}(Up||(Up={})),function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Uint8Array=2]="Uint8Array",e[e.PrefixedHexString=3]="PrefixedHexString"}(jp||(jp={}));const Dp=Qh(Gd);var zp=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,$p=Math.ceil,Hp=Math.floor,Gp="[BigNumber Error] ",qp=Gp+"Number primitive has more than 15 significant digits: ",Kp=1e14,Vp=14,Wp=9007199254740991,Jp=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Zp=1e7,Yp=1e9;function Xp(e){var t=0|e;return e>0||e===t?t:t-1}function Qp(e){for(var t,r,n=1,i=e.length,o=e[0]+"";nu^r?1:-1;for(s=(c=i.length)<(u=o.length)?c:u,a=0;ao[a]^r?1:-1;return c==u?0:c>u^r?1:-1}function tm(e,t,r,n){if(er||e!==Hp(e))throw Error(Gp+(n||"Argument")+("number"==typeof e?er?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function rm(e){var t=e.c.length-1;return Xp(e.e/Vp)==t&&e.c[t]%2!=0}function nm(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function im(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else tv?d.c=d.e=null:e.e=10;c/=10,s++);return void(s>v?d.c=d.e=null:(d.e=s,d.c=[e]))}f=String(e)}else{if(!zp.test(f=String(e)))return i(d,f,u);d.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(s=f.indexOf("."))>-1&&(f=f.replace(".","")),(c=f.search(/e/i))>0?(s<0&&(s=c),s+=+f.slice(c+1),f=f.substring(0,c)):s<0&&(s=f.length)}else{if(tm(t,2,_.length,"Base"),10==t&&k)return O(d=new S(e),p+d.e+1,m);if(f=String(e),u="number"==typeof e){if(0*e!=0)return i(d,f,u,t);if(d.s=1/e<0?(f=f.slice(1),-1):1,S.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(qp+e)}else d.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(r=_.slice(0,t),s=c=0,l=f.length;cs){s=l;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,c=-1,s=0;continue}return i(d,String(e),u,t)}u=!1,(s=(f=n(f,t,10,d.s)).indexOf("."))>-1?f=f.replace(".",""):s=f.length}for(c=0;48===f.charCodeAt(c);c++);for(l=f.length;48===f.charCodeAt(--l););if(f=f.slice(c,++l)){if(l-=c,u&&S.DEBUG&&l>15&&(e>Wp||e!==Hp(e)))throw Error(qp+d.s*e);if((s=s-c-1)>v)d.c=d.e=null;else if(s=g)?nm(c,a):im(c,a,"0");else if(o=(e=O(new S(e),t,r)).e,s=(c=Qp(e.c)).length,1==n||2==n&&(t<=o||o<=b)){for(;ss){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-s)>0)for(o+1==s&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function I(e,t){for(var r,n,i=1,o=new S(e[0]);i=10;i/=10,n++);return(r=n+r*Vp-1)>v?e.c=e.e=null:r=10;s/=10,i++);if((o=t-i)<0)o+=Vp,a=t,c=f[u=0],l=Hp(c/d[i-a-1]%10);else if((u=$p((o+1)/Vp))>=f.length){if(!n)break e;for(;f.length<=u;f.push(0));c=l=0,i=1,a=(o%=Vp)-Vp+1}else{for(c=s=f[u],i=1;s>=10;s/=10,i++);l=(a=(o%=Vp)-Vp+i)<0?0:Hp(c/d[i-a-1]%10)}if(n=n||t<0||null!=f[u+1]||(a<0?c:c%d[i-a-1]),n=r<4?(l||n)&&(0==r||r==(e.s<0?3:2)):l>5||5==l&&(4==r||n||6==r&&(o>0?a>0?c/d[i-a]:0:f[u-1])%10&1||r==(e.s<0?8:7)),t<1||!f[0])return f.length=0,n?(t-=e.e+1,f[0]=d[(Vp-t%Vp)%Vp],e.e=-t||0):f[0]=e.e=0,e;if(0==o?(f.length=u,s=1,u--):(f.length=u+1,s=d[Vp-o],f[u]=a>0?Hp(c/d[i-a]%d[a])*s:0),n)for(;;){if(0==u){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(e.e++,f[0]==Kp&&(f[0]=1));break}if(f[u]+=s,f[u]!=Kp)break;f[u--]=0,s=1}for(o=f.length;0===f[--o];f.pop());}e.e>v?e.c=e.e=null:e.e=g?nm(t,r):im(t,r,"0"),e.s<0?"-"+t:t)}return S.clone=e,S.ROUND_UP=0,S.ROUND_DOWN=1,S.ROUND_CEIL=2,S.ROUND_FLOOR=3,S.ROUND_HALF_UP=4,S.ROUND_HALF_DOWN=5,S.ROUND_HALF_EVEN=6,S.ROUND_HALF_CEIL=7,S.ROUND_HALF_FLOOR=8,S.EUCLID=9,S.config=S.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(Gp+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(tm(r=e[t],0,Yp,t),p=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(tm(r=e[t],0,8,t),m=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(tm(r[0],-Yp,0,t),tm(r[1],0,Yp,t),b=r[0],g=r[1]):(tm(r,-Yp,Yp,t),b=-(g=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)tm(r[0],-Yp,-1,t),tm(r[1],1,Yp,t),y=r[0],v=r[1];else{if(tm(r,-Yp,Yp,t),!r)throw Error(Gp+t+" cannot be zero: "+r);y=-(v=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(Gp+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw w=!r,Error(Gp+"crypto unavailable");w=r}else w=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(tm(r=e[t],0,9,t),E=r),e.hasOwnProperty(t="POW_PRECISION")&&(tm(r=e[t],0,Yp,t),A=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(Gp+t+" not an object: "+r);x=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(Gp+t+" invalid: "+r);k="0123456789"==r.slice(0,10),_=r}}return{DECIMAL_PLACES:p,ROUNDING_MODE:m,EXPONENTIAL_AT:[b,g],RANGE:[y,v],CRYPTO:w,MODULO_MODE:E,POW_PRECISION:A,FORMAT:x,ALPHABET:_}},S.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!S.DEBUG)return!0;var t,r,n=e.c,i=e.e,o=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===o||-1===o)&&i>=-Yp&&i<=Yp&&i===Hp(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%Vp)<1&&(t+=Vp),String(n[0]).length==t){for(t=0;t=Kp||r!==Hp(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===o||1===o||-1===o))return!0;throw Error(Gp+"Invalid BigNumber: "+e)},S.maximum=S.max=function(){return I(arguments,-1)},S.minimum=S.min=function(){return I(arguments,1)},S.random=(o=9007199254740992,a=Math.random()*o&2097151?function(){return Hp(Math.random()*o)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,o,s=0,c=[],u=new S(h);if(null==e?e=p:tm(e,0,Yp),i=$p(e/Vp),w)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));s>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[s]=r[0],t[s+1]=r[1]):(c.push(o%1e14),s+=2);s=i/2}else{if(!crypto.randomBytes)throw w=!1,Error(Gp+"crypto unavailable");for(t=crypto.randomBytes(i*=7);s=9e15?crypto.randomBytes(7).copy(t,s):(c.push(o%1e14),s+=7);s=i/7}if(!w)for(;s=10;o/=10,s++);sr-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(n,i,o,a,s){var c,u,l,f,d,h,b,g,y=n.indexOf("."),v=p,w=m;for(y>=0&&(f=A,A=0,n=n.replace(".",""),h=(g=new S(i)).pow(n.length-y),A=f,g.c=t(im(Qp(h.c),h.e,"0"),10,o,e),g.e=g.c.length),l=f=(b=t(n,i,o,s?(c=_,e):(c=e,_))).length;0==b[--f];b.pop());if(!b[0])return c.charAt(0);if(y<0?--l:(h.c=b,h.e=l,h.s=a,b=(h=r(h,g,v,w,o)).c,d=h.r,l=h.e),y=b[u=l+v+1],f=o/2,d=d||u<0||null!=b[u+1],d=w<4?(null!=y||d)&&(0==w||w==(h.s<0?3:2)):y>f||y==f&&(4==w||d||6==w&&1&b[u-1]||w==(h.s<0?8:7)),u<1||!b[0])n=d?im(c.charAt(1),-v,c.charAt(0)):c.charAt(0);else{if(b.length=u,d)for(--o;++b[--u]>o;)b[u]=0,u||(++l,b=[1].concat(b));for(f=b.length;!b[--f];);for(y=0,n="";y<=f;n+=c.charAt(b[y++]));n=im(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,a,s=0,c=e.length,u=t%Zp,l=t/Zp|0;for(e=e.slice();c--;)s=((i=u*(o=e[c]%Zp)+(n=l*o+(a=e[c]/Zp|0)*u)%Zp*Zp+s)/r|0)+(n/Zp|0)+l*a,e[c]=i%r;return s&&(e=[s].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;it[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]1;e.splice(0,1));}return function(n,i,o,a,s){var c,u,l,f,d,h,p,m,b,g,y,v,w,E,A,x,_,k=n.s==i.s?1:-1,P=n.c,I=i.c;if(!(P&&P[0]&&I&&I[0]))return new S(n.s&&i.s&&(P?!I||P[0]!=I[0]:I)?P&&0==P[0]||!I?0*k:k/0:NaN);for(b=(m=new S(k)).c=[],k=o+(u=n.e-i.e)+1,s||(s=Kp,u=Xp(n.e/Vp)-Xp(i.e/Vp),k=k/Vp|0),l=0;I[l]==(P[l]||0);l++);if(I[l]>(P[l]||0)&&u--,k<0)b.push(1),f=!0;else{for(E=P.length,x=I.length,l=0,k+=2,(d=Hp(s/(I[0]+1)))>1&&(I=e(I,d,s),P=e(P,d,s),x=I.length,E=P.length),w=x,y=(g=P.slice(0,x)).length;y=s/2&&A++;do{if(d=0,(c=t(I,g,x,y))<0){if(v=g[0],x!=y&&(v=v*s+(g[1]||0)),(d=Hp(v/A))>1)for(d>=s&&(d=s-1),p=(h=e(I,d,s)).length,y=g.length;1==t(h,g,p,y);)d--,r(h,x=10;k/=10,l++);O(m,o+(m.e=l+u*Vp-1)+1,a,f)}else m.e=u,m.r=+f;return m}}(),s=/^(-?)0([xbo])(?=\w[\w.]*$)/i,c=/^([^.]+)\.$/,u=/^\.([^.]+)$/,l=/^-?(Infinity|NaN)$/,f=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,r,n){var i,o=r?t:t.replace(f,"");if(l.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(s,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(c,"$1").replace(u,"0.$1")),t!=o))return new S(o,i);if(S.DEBUG)throw Error(Gp+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},d.absoluteValue=d.abs=function(){var e=new S(this);return e.s<0&&(e.s=1),e},d.comparedTo=function(e,t){return em(this,new S(e,t))},d.decimalPlaces=d.dp=function(e,t){var r,n,i,o=this;if(null!=e)return tm(e,0,Yp),null==t?t=m:tm(t,0,8),O(new S(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-Xp(this.e/Vp))*Vp,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},d.dividedBy=d.div=function(e,t){return r(this,new S(e,t),p,m)},d.dividedToIntegerBy=d.idiv=function(e,t){return r(this,new S(e,t),0,1)},d.exponentiatedBy=d.pow=function(e,t){var r,n,i,o,a,s,c,u,l=this;if((e=new S(e)).c&&!e.isInteger())throw Error(Gp+"Exponent not an integer: "+M(e));if(null!=t&&(t=new S(t)),a=e.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!e.c||!e.c[0])return u=new S(Math.pow(+M(l),a?e.s*(2-rm(e)):+M(e))),t?u.mod(t):u;if(s=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new S(NaN);(n=!s&&l.isInteger()&&t.isInteger())&&(l=l.mod(t))}else{if(e.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return o=l.s<0&&rm(e)?-0:0,l.e>-1&&(o=1/o),new S(s?1/o:o);A&&(o=$p(A/Vp+2))}for(a?(r=new S(.5),s&&(e.s=1),c=rm(e)):c=(i=Math.abs(+M(e)))%2,u=new S(h);;){if(c){if(!(u=u.times(l)).c)break;o?u.c.length>o&&(u.c.length=o):n&&(u=u.mod(t))}if(i){if(0===(i=Hp(i/2)))break;c=i%2}else if(O(e=e.times(r),e.e+1,1),e.e>14)c=rm(e);else{if(0===(i=+M(e)))break;c=i%2}l=l.times(l),o?l.c&&l.c.length>o&&(l.c.length=o):n&&(l=l.mod(t))}return n?u:(s&&(u=h.div(u)),t?u.mod(t):o?O(u,A,m,undefined):u)},d.integerValue=function(e){var t=new S(this);return null==e?e=m:tm(e,0,8),O(t,t.e+1,e)},d.isEqualTo=d.eq=function(e,t){return 0===em(this,new S(e,t))},d.isFinite=function(){return!!this.c},d.isGreaterThan=d.gt=function(e,t){return em(this,new S(e,t))>0},d.isGreaterThanOrEqualTo=d.gte=function(e,t){return 1===(t=em(this,new S(e,t)))||0===t},d.isInteger=function(){return!!this.c&&Xp(this.e/Vp)>this.c.length-2},d.isLessThan=d.lt=function(e,t){return em(this,new S(e,t))<0},d.isLessThanOrEqualTo=d.lte=function(e,t){return-1===(t=em(this,new S(e,t)))||0===t},d.isNaN=function(){return!this.s},d.isNegative=function(){return this.s<0},d.isPositive=function(){return this.s>0},d.isZero=function(){return!!this.c&&0==this.c[0]},d.minus=function(e,t){var r,n,i,o,a=this,s=a.s;if(t=(e=new S(e,t)).s,!s||!t)return new S(NaN);if(s!=t)return e.s=-t,a.plus(e);var c=a.e/Vp,u=e.e/Vp,l=a.c,f=e.c;if(!c||!u){if(!l||!f)return l?(e.s=-t,e):new S(f?a:NaN);if(!l[0]||!f[0])return f[0]?(e.s=-t,e):new S(l[0]?a:3==m?-0:0)}if(c=Xp(c),u=Xp(u),l=l.slice(),s=c-u){for((o=s<0)?(s=-s,i=l):(u=c,i=f),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(o=(s=l.length)<(t=f.length))?s:t,s=t=0;t0)for(;t--;l[r++]=0);for(t=Kp-1;n>s;){if(l[--n]=0;){for(r=0,d=v[i]%b,h=v[i]/b|0,o=i+(a=c);o>i;)r=((u=d*(u=y[--a]%b)+(s=h*u+(l=y[a]/b|0)*d)%b*b+p[o]+r)/m|0)+(s/b|0)+h*l,p[o--]=u%m;p[o]=r}return r?++n:p.splice(0,1),T(e,p,n)},d.negated=function(){var e=new S(this);return e.s=-e.s||null,e},d.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new S(e,t)).s,!i||!t)return new S(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/Vp,a=e.e/Vp,s=n.c,c=e.c;if(!o||!a){if(!s||!c)return new S(i/0);if(!s[0]||!c[0])return c[0]?e:new S(s[0]?n:0*i)}if(o=Xp(o),a=Xp(a),s=s.slice(),i=o-a){for(i>0?(a=o,r=c):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=c.length)<0&&(r=c,c=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/Kp|0,s[t]=Kp===s[t]?0:s[t]%Kp;return i&&(s=[i].concat(s),++a),T(e,s,a)},d.precision=d.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return tm(e,1,Yp),null==t?t=m:tm(t,0,8),O(new S(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*Vp+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},d.shiftedBy=function(e){return tm(e,-9007199254740991,Wp),this.times("1e"+e)},d.squareRoot=d.sqrt=function(){var e,t,n,i,o,a=this,s=a.c,c=a.s,u=a.e,l=p+4,f=new S("0.5");if(1!==c||!s||!s[0])return new S(!c||c<0&&(!s||s[0])?NaN:s?a:1/0);if(0==(c=Math.sqrt(+M(a)))||c==1/0?(((t=Qp(s)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=Xp((u+1)/2)-(u<0||u%2),n=new S(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new S(c+""),n.c[0])for((c=(u=n.e)+l)<3&&(c=0);;)if(o=n,n=f.times(o.plus(r(a,o,l,1))),Qp(o.c).slice(0,c)===(t=Qp(n.c)).slice(0,c)){if(n.e0&&p>0){for(o=p%s||s,l=h.substr(0,o);o0&&(l+=u+h.slice(o)),d&&(l="-"+l)}n=f?l+(r.decimalSeparator||"")+((c=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+c+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):l}return(r.prefix||"")+n+(r.suffix||"")},d.toFraction=function(e){var t,n,i,o,a,s,c,u,l,f,d,p,b=this,g=b.c;if(null!=e&&(!(c=new S(e)).isInteger()&&(c.c||1!==c.s)||c.lt(h)))throw Error(Gp+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+M(c));if(!g)return new S(b);for(t=new S(h),l=n=new S(h),i=u=new S(h),p=Qp(g),a=t.e=p.length-b.e-1,t.c[0]=Jp[(s=a%Vp)<0?Vp+s:s],e=!e||c.comparedTo(t)>0?a>0?t:l:c,s=v,v=1/0,c=new S(p),u.c[0]=0;f=r(c,t,0,1),1!=(o=n.plus(f.times(i))).comparedTo(e);)n=i,i=o,l=u.plus(f.times(o=l)),u=o,t=c.minus(f.times(o=t)),c=o;return o=r(e.minus(n),i,0,1),u=u.plus(o.times(l)),n=n.plus(o.times(i)),u.s=l.s=b.s,d=r(l,i,a*=2,m).minus(b).abs().comparedTo(r(u,n,a,m).minus(b).abs())<1?[l,i]:[u,n],v=s,d},d.toNumber=function(){return+M(this)},d.toPrecision=function(e,t){return null!=e&&tm(e,1,Yp),P(this,e,t,2)},d.toString=function(e){var t,r=this,i=r.s,o=r.e;return null===o?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=o<=b||o>=g?nm(Qp(r.c),o):im(Qp(r.c),o,"0"):10===e&&k?t=im(Qp((r=O(new S(r),p+o+1,m)).c),r.e,"0"):(tm(e,2,_.length,"Base"),t=n(im(Qp(r.c),o,"0"),10,e,i,!0)),i<0&&r.c[0]&&(t="-"+t)),t},d.valueOf=d.toJSON=function(){return M(this)},d._isBigNumber=!0,d[Symbol.toStringTag]="BigNumber",d[Symbol.for("nodejs.util.inspect.custom")]=d.valueOf,null!=t&&S.set(t),S}(),am={exports:{}};!function(e,t){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(r),a=Math.max(i,o),s=0,c=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===s)return 0;a-=1}else if(c[0][a]1?i-1:0),a=1;a0){var a=Object.keys(r),c=s.default.find(a,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var l=s.default.find(a,(function(e){return t.isPlatform(e)}));if(l){var f=this.satisfies(r[l]);if(void 0!==f)return f}}if(o>0){var d=Object.keys(i),h=s.default.find(d,(function(e){return t.isBrowser(e,!0)}));if(void 0!==h)return this.compareVersion(i[h])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(s.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:o.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:o.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:o.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})}(am);var sm=a(am.exports);function cm(e){if(e)return function(e){for(var t in cm.prototype)e[t]=cm.prototype[t];return e}(e)}cm.prototype.on=cm.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},cm.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},cm.prototype.off=cm.prototype.removeListener=cm.prototype.removeAllListeners=cm.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,r,n){for(var i=0,o=Math.min(e.length,r),a=t;a=49?s-49+10:s>=17?s-17+10:s}return i}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,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++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=s(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this.strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l1&&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},i.prototype.inspect=function(){return(this.red?""};var u=["","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],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&c,d=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=d;h++){var p=u-h|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&a}r.words[u]=0|f,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r.strip()}i.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>>24-i&16777215)||a!==this.length-1?u[6-c.length]+c+n:c+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 d=l[e],h=f[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modn(h).toString(e);n=(p=p.idivn(h)).isZero()?m+n:u[d-m.length]+m+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")},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&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return r(void 0!==o),this.toArrayLike(o,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.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,c="le"===t,u=new e(o),l=this.clone();if(c){for(s=0;!l.isZero();s++)a=l.andln(255),l.iushrn(8),u[s]=a;for(;s=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},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;te.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 r=0;re.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,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.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){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;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.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<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.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 r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,b=0|a[2],g=8191&b,y=b>>>13,v=0|a[3],w=8191&v,E=v>>>13,A=0|a[4],x=8191&A,_=A>>>13,k=0|a[5],S=8191&k,P=k>>>13,I=0|a[6],T=8191&I,O=I>>>13,M=0|a[7],C=8191&M,B=M>>>13,N=0|a[8],R=8191&N,F=N>>>13,L=0|a[9],U=8191&L,j=L>>>13,D=0|s[0],z=8191&D,$=D>>>13,H=0|s[1],G=8191&H,q=H>>>13,K=0|s[2],V=8191&K,W=K>>>13,J=0|s[3],Z=8191&J,Y=J>>>13,X=0|s[4],Q=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],fe=8191&le,de=le>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,$))+Math.imul(d,z)|0))<<13)|0;u=((o=Math.imul(d,$))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,$))+Math.imul(m,z)|0,o=Math.imul(m,$);var ge=(u+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,q)|0)+Math.imul(d,G)|0))<<13)|0;u=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,z),i=(i=Math.imul(g,$))+Math.imul(y,z)|0,o=Math.imul(y,$),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,q)|0;var ye=(u+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,$))+Math.imul(E,z)|0,o=Math.imul(E,$),n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var ve=(u+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(x,z),i=(i=Math.imul(x,$))+Math.imul(_,z)|0,o=Math.imul(_,$),n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,q)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,q)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Y)|0;var we=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,$))+Math.imul(P,z)|0,o=Math.imul(P,$),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,Y)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var Ee=(u+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,$))+Math.imul(O,z)|0,o=Math.imul(O,$),n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,Y)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var Ae=(u+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,$))+Math.imul(B,z)|0,o=Math.imul(B,$),n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,q)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,q)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var xe=(u+(n=n+Math.imul(f,ce)|0)|0)+((8191&(i=(i=i+Math.imul(f,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,$))+Math.imul(F,z)|0,o=Math.imul(F,$),n=n+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,q)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var _e=(u+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(U,z),i=(i=Math.imul(U,$))+Math.imul(j,z)|0,o=Math.imul(j,$),n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,q)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,q)|0,n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,n=n+Math.imul(g,ce)|0,i=(i=i+Math.imul(g,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,de)|0;var ke=(u+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,q))+Math.imul(j,G)|0,o=Math.imul(j,q),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,W)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(P,re)|0,o=o+Math.imul(P,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,n=n+Math.imul(g,fe)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,de)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,W))+Math.imul(j,V)|0,o=Math.imul(j,W),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(F,Z)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,ue)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(E,fe)|0,o=o+Math.imul(E,de)|0;var Pe=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,Y))+Math.imul(j,Z)|0,o=Math.imul(j,Y),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(P,ce)|0,o=o+Math.imul(P,ue)|0,n=n+Math.imul(x,fe)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,de)|0;var Ie=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,ee))+Math.imul(j,Q)|0,o=Math.imul(j,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(F,re)|0,o=o+Math.imul(F,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,n=n+Math.imul(S,fe)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(P,fe)|0,o=o+Math.imul(P,de)|0;var Te=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(_,pe)|0))<<13)|0;u=((o=o+Math.imul(_,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(j,re)|0,o=Math.imul(j,ne),n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(F,oe)|0,o=o+Math.imul(F,ae)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(B,ce)|0,o=o+Math.imul(B,ue)|0,n=n+Math.imul(T,fe)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(P,pe)|0))<<13)|0;u=((o=o+Math.imul(P,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,ae))+Math.imul(j,oe)|0,o=Math.imul(j,ae),n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(F,ce)|0,o=o+Math.imul(F,ue)|0,n=n+Math.imul(C,fe)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,de)|0;var Me=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(F,fe)|0,o=o+Math.imul(F,de)|0;var Ce=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(U,fe),i=(i=Math.imul(U,de))+Math.imul(j,fe)|0,o=Math.imul(j,de);var Be=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(F,pe)|0))<<13)|0;u=((o=o+Math.imul(F,me)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(u+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,me))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,me))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=be,c[1]=ge,c[2]=ye,c[3]=ve,c[4]=we,c[5]=Ee,c[6]=Ae,c[7]=xe,c[8]=_e,c[9]=ke,c[10]=Se,c[11]=Pe,c[12]=Ie,c[13]=Te,c[14]=Oe,c[15]=Me,c[16]=Ce,c[17]=Be,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function p(e,t,r){return(new m).mulp(e,t,r)}function m(e,t){this.x=e,this.y=t}Math.imul||(h=d),i.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return r=10===this.length&&10===e.length?h(this,e,t):n<63?d(this,e,t):n<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):p(this,e,t),r},m.prototype.makeRBT=function(e){for(var t=new Array(e),r=i.prototype._countBits(e)-1,n=0;n>=1;return n},m.prototype.permute=function(e,t,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,n[2*a+1]=8191&o,o>>>=13;for(a=2*t;a>=26,t+=i/67108864|0,t+=o>>>26,this.words[n]=67108863&o}return 0!==t&&(this.words[n]=t,this.length++),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()),r=0;r>>i}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=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>>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=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==l||u>=i);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},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){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=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<=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(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>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,c=n.length-o.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var d=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s.strip(),n.strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!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(),n&&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}):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 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.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(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 r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.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},i.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()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.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 o=new i(1),a=new i(0),s=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),f=t.clone();!t.isZero();){for(var d=0,h=1;!(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(f)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;!(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(f)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s),a.isub(c)):(n.isub(t),s.isub(o),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},i.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 o,a=new i(1),s=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var f=0,d=1;!(n.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(n.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.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(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>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,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:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(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 A(e)},i.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)},i.prototype.fromRed=function(){return r(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 r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function g(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 y(){g.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function v(){g.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){g.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function E(){g.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function A(e){if("string"==typeof e){var t=i._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 x(e){A.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)}g.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},g.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},g.prototype.split=function(e,t){e.iushrn(this.n,0,t)},g.prototype.imulK=function(e){return e.imul(this.k)},n(y,g),y.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},y.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new y;else if("p224"===e)t=new v;else if("p192"===e)t=new w;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new E}return b[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(!(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 r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},A.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},A.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},A.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},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 i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var f=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}c=26}return o},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},i.mont=function(e){return new x(e)},n(x,A),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).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)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).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)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,o)}(pm);var mm=pm.exports,bm=gm;function gm(e,t){if(!e)throw new Error(t||"Assertion failed")}gm.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var ym={};!function(e){var t=e;function r(e){return 1===e.length?"0"+e:e}function n(e){for(var t="",n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}return r},t.zero2=r,t.toHex=n,t.encode=function(e,t){return"hex"===t?n(e):e}}(ym),function(e){var t=e,r=mm,n=bm,i=ym;t.assert=n,t.toArray=i.toArray,t.zero2=i.zero2,t.toHex=i.toHex,t.encode=i.encode,t.getNAF=function(e,t,r){var n,i=new Array(Math.max(e.bitLength(),r)+1);for(n=0;n(o>>1)-1?(o>>1)-c:c,a.isubn(s)):s=0,i[n]=s,a.iushrn(1)}return i},t.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},t.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},t.parseBytes=function(e){return"string"==typeof e?t.toArray(e,"hex"):e},t.intFromLE=function(e){return new r(e,"hex","le")}}(hm);var vm,wm={exports:{}},Em=s(lm);function Am(e){this.rand=e}if(wm.exports=function(e){return vm||(vm=new Am(null)),vm.generate(e)},wm.exports.Rand=Am,Am.prototype.generate=function(e){return this._rand(e)},Am.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Cm=Mm;function Bm(e,t){this.curve=e,this.type=t,this.precomputed=null}Mm.prototype.point=function(){throw new Error("Not implemented")},Mm.prototype.validate=function(){throw new Error("Not implemented")},Mm.prototype._fixedNafMul=function(e,t){Om(e.precomputed);var r=e._getDoubles(),n=Im(t,1,this._bitLength),i=(1<=o;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=i;f>0;f--){for(o=0;o=0;s--){for(var c=0;s>=0&&0===o[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=o[s];Om(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},Mm.prototype._wnafMulAdd=function(e,t,r,n,i){var o,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===c[h]&&1===c[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],g=Tm(r[h],r[p]);for(f=Math.max(g[0].length,f),l[h]=new Array(f),l[p]=new Array(f),a=0;a=0;o--){for(var A=0;o>=0;){var x=!0;for(a=0;a=0&&A++,w=w.dblp(A),o<0)break;for(a=0;a0?s=u[a][_-1>>1]:_<0&&(s=u[a][-_-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o=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 r=[this],n=this,i=0;i=0&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},Dm.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},Dm.prototype.pointFromX=function(e,t){(e=new Fm(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},Dm.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},Dm.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},$m.prototype.isInfinity=function(){return this.inf},$m.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 r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},$m.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,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),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)},$m.prototype.getX=function(){return this.x.fromRed()},$m.prototype.getY=function(){return this.y.fromRed()},$m.prototype.mul=function(e){return e=new Fm(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)},$m.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},$m.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},$m.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))},$m.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},$m.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Lm(Hm,Um.BasePoint),Dm.prototype.jpoint=function(e,t,r){return new Hm(this,e,t,r)},Hm.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},Hm.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Hm.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),f=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(f).redISub(f),h=c.redMul(f.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,h,p)},Hm.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),f=s.redSqr().redIAdd(u).redISub(l).redISub(l),d=s.redMul(l.redISub(f)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(f,d,h)},Hm.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 r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},Hm.prototype.inspect=function(){return this.isInfinity()?"":""},Hm.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Gm=mm,qm=Rm,Km=Cm,Vm=hm;function Wm(e){Km.call(this,"mont",e),this.a=new Gm(e.a,16).toRed(this.red),this.b=new Gm(e.b,16).toRed(this.red),this.i4=new Gm(4).toRed(this.red).redInvm(),this.two=new Gm(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}qm(Wm,Km);var Jm=Wm;function Zm(e,t,r){Km.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Gm(t,16),this.z=new Gm(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}Wm.prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},qm(Zm,Km.BasePoint),Wm.prototype.decodePoint=function(e,t){return this.point(Vm.toArray(e,t),1)},Wm.prototype.point=function(e,t){return new Zm(this,e,t)},Wm.prototype.pointFromJSON=function(e){return Zm.fromJSON(this,e)},Zm.prototype.precompute=function(){},Zm.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},Zm.fromJSON=function(e,t){return new Zm(e,t[0],t[1]||e.one)},Zm.prototype.inspect=function(){return this.isInfinity()?"":""},Zm.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},Zm.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},Zm.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},Zm.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),a=i.redMul(n),s=t.z.redMul(o.redAdd(a).redSqr()),c=t.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,c)},Zm.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},Zm.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},Zm.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},Zm.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},Zm.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},Zm.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Ym=mm,Xm=Rm,Qm=Cm,eb=hm.assert;function tb(e){this.twisted=1!=(0|e.a),this.mOneA=this.twisted&&-1==(0|e.a),this.extended=this.mOneA,Qm.call(this,"edwards",e),this.a=new Ym(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Ym(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Ym(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),eb(!this.twisted||0===this.c.fromRed().cmpn(1)),this.oneC=1==(0|e.c)}Xm(tb,Qm);var rb=tb;function nb(e,t,r,n,i){Qm.BasePoint.call(this,e,"projective"),null===t&&null===r&&null===n?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Ym(t,16),this.y=new Ym(r,16),this.z=n?new Ym(n,16):this.curve.one,this.t=i&&new Ym(i,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.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}tb.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},tb.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},tb.prototype.jpoint=function(e,t,r,n){return this.point(e,t,r,n)},tb.prototype.pointFromX=function(e,t){(e=new Ym(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=this.c2.redSub(this.a.redMul(r)),i=this.one.redSub(this.c2.redMul(this.d).redMul(r)),o=n.redMul(i.redInvm()),a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");var s=a.fromRed().isOdd();return(t&&!s||!t&&s)&&(a=a.redNeg()),this.point(e,a)},tb.prototype.pointFromY=function(e,t){(e=new Ym(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr(),n=r.redSub(this.c2),i=r.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(i.redInvm());if(0===o.cmp(this.zero)){if(t)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(0!==a.redSqr().redSub(o).cmp(this.zero))throw new Error("invalid point");return a.fromRed().isOdd()!==t&&(a=a.redNeg()),this.point(a,e)},tb.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),r=e.y.redSqr(),n=t.redMul(this.a).redAdd(r),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(r)));return 0===n.cmp(i)},Xm(nb,Qm.BasePoint),tb.prototype.pointFromJSON=function(e){return nb.fromJSON(this,e)},tb.prototype.point=function(e,t,r,n){return new nb(this,e,t,r,n)},nb.fromJSON=function(e,t){return new nb(e,t[0],t[1],t[2])},nb.prototype.inspect=function(){return this.isInfinity()?"":""},nb.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&(0===this.y.cmp(this.z)||this.zOne&&0===this.y.cmp(this.curve.c))},nb.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),a=o.redSub(r),s=n.redSub(t),c=i.redMul(a),u=o.redMul(s),l=i.redMul(s),f=a.redMul(o);return this.curve.point(c,u,f,l)},nb.prototype._projDbl=function(){var e,t,r,n,i,o,a=this.x.redAdd(this.y).redSqr(),s=this.x.redSqr(),c=this.y.redSqr();if(this.curve.twisted){var u=(n=this.curve._mulA(s)).redAdd(c);this.zOne?(e=a.redSub(s).redSub(c).redMul(u.redSub(this.curve.two)),t=u.redMul(n.redSub(c)),r=u.redSqr().redSub(u).redSub(u)):(i=this.z.redSqr(),o=u.redSub(i).redISub(i),e=a.redSub(s).redISub(c).redMul(o),t=u.redMul(n.redSub(c)),r=u.redMul(o))}else n=s.redAdd(c),i=this.curve._mulC(this.z).redSqr(),o=n.redSub(i).redSub(i),e=this.curve._mulC(a.redISub(n)).redMul(o),t=this.curve._mulC(n).redMul(s.redISub(c)),r=n.redMul(o);return this.curve.point(e,t,r)},nb.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},nb.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),a=i.redSub(n),s=i.redAdd(n),c=r.redAdd(t),u=o.redMul(a),l=s.redMul(c),f=o.redMul(c),d=a.redMul(s);return this.curve.point(u,l,d,f)},nb.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),a=this.y.redMul(e.y),s=this.curve.d.redMul(o).redMul(a),c=i.redSub(s),u=i.redAdd(s),l=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(a),f=n.redMul(c).redMul(l);return this.curve.twisted?(t=n.redMul(u).redMul(a.redSub(this.curve._mulA(o))),r=c.redMul(u)):(t=n.redMul(u).redMul(a.redSub(o)),r=this.curve._mulC(c).redMul(u)),this.curve.point(f,t,r)},nb.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},nb.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},nb.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},nb.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},nb.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},nb.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},nb.prototype.getX=function(){return this.normalize(),this.x.fromRed()},nb.prototype.getY=function(){return this.normalize(),this.y.fromRed()},nb.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},nb.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}},nb.prototype.toP=nb.prototype.normalize,nb.prototype.mixedAdd=nb.prototype.add,function(e){var t=e;t.base=Cm,t.short=zm,t.mont=Jm,t.edwards=rb}(km);var ib={},ob={},ab={},sb=bm,cb=Rm;function ub(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function lb(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function fb(e){return 1===e.length?"0"+e:e}function db(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}ab.inherits=cb,ab.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];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>6|192,r[n++]=63&o|128):ub(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>0}return o},ab.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},ab.rotr32=function(e,t){return e>>>t|e<<32-t},ab.rotl32=function(e,t){return e<>>32-t},ab.sum32=function(e,t){return e+t>>>0},ab.sum32_3=function(e,t,r){return e+t+r>>>0},ab.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},ab.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},ab.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},ab.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},ab.sum64_lo=function(e,t,r,n){return t+n>>>0},ab.sum64_4_hi=function(e,t,r,n,i,o,a,s){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0},ab.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},ab.sum64_5_hi=function(e,t,r,n,i,o,a,s,c,u){var l=0,f=t;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},ab.sum64_5_lo=function(e,t,r,n,i,o,a,s,c,u){return t+n+o+s+u>>>0},ab.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},ab.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},ab.shr64_hi=function(e,t,r){return e>>>r},ab.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0};var hb={},pb=ab,mb=bm;function bb(){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}hb.BlockHash=bb,bb.prototype.update=function(e,t){if(e=pb.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=pb.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o>>3},yb.g1_256=function(e){return vb(e,17)^vb(e,19)^e>>>10};var xb=ab,_b=hb,kb=yb,Sb=xb.rotl32,Pb=xb.sum32,Ib=xb.sum32_5,Tb=kb.ft_1,Ob=_b.BlockHash,Mb=[1518500249,1859775393,2400959708,3395469782];function Cb(){if(!(this instanceof Cb))return new Cb;Ob.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}xb.inherits(Cb,Ob);var Bb=Cb;Cb.blockSize=512,Cb.outSize=160,Cb.hmacStrength=80,Cb.padLength=64,Cb.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;nthis.blockSize&&(e=(new this.Hash).update(e).digest()),Xg(e.length<=this.blockSize);for(var t=e.length;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var cy=sy;sy.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},sy.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=oy.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var hy=mm,py=hm,my=py.assert;function by(e,t){if(e instanceof by)return e;this._importDER(e,t)||(my(e.r&&e.s,"Signature without r or s"),this.r=new hy(e.r,16),this.s=new hy(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var gy=by;function yy(){this.place=0}function vy(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function wy(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}by.prototype._importDER=function(e,t){e=py.toArray(e,t);var r=new yy;if(48!==e[r.place++])return!1;var n=vy(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=vy(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var a=vy(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.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 hy(o),this.s=new hy(s),this.recoveryParam=null,!0},by.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=wy(t),r=wy(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];Ey(n,t.length),(n=n.concat(t)).push(2),Ey(n,r.length);var i=n.concat(r),o=[48];return Ey(o,i.length),o=o.concat(i),py.encode(o,e)};var Ay=mm,xy=cy,_y=ib,ky=_m,Sy=hm.assert,Py=dy,Iy=gy;function Ty(e){if(!(this instanceof Ty))return new Ty(e);"string"==typeof e&&(Sy(Object.prototype.hasOwnProperty.call(_y,e),"Unknown curve "+e),e=_y[e]),e instanceof _y.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 Oy=Ty;Ty.prototype.keyPair=function(e){return new Py(this,e)},Ty.prototype.keyFromPrivate=function(e,t){return Py.fromPrivate(this,e,t)},Ty.prototype.keyFromPublic=function(e,t){return Py.fromPublic(this,e,t)},Ty.prototype.genKeyPair=function(e){e||(e={});for(var t=new xy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||ky(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new Ay(2));;){var i=new Ay(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Ty.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Ty.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new Ay(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new xy({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new Ay(1)),u=0;;u++){var l=n.k?n.k(u):new Ay(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var f=this.g.mul(l);if(!f.isInfinity()){var d=f.getX(),h=d.umod(this.n);if(0!==h.cmpn(0)){var p=l.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==d.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new Iy({r:h,s:p,recoveryParam:m})}}}}}},Ty.prototype.verify=function(e,t,r,n){e=this._truncateToN(new Ay(e,16)),r=this.keyFromPublic(r,n);var i=(t=new Iy(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),c=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},Ty.prototype.recoverPubKey=function(e,t,r,n){Sy((3&r)===r,"The recovery param is more than two bits"),t=new Iy(t,n);var i=this.n,o=new Ay(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(i),f=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(f,a,d)},Ty.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new Iy(t,n)).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(r))return i}throw new Error("Unable to find valid recovery factor")};var My=hm,Cy=My.assert,By=My.parseBytes,Ny=My.cachedProperty;function Ry(e,t){this.eddsa=e,this._secret=By(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=By(t.pub)}Ry.fromPublic=function(e,t){return t instanceof Ry?t:new Ry(e,{pub:t})},Ry.fromSecret=function(e,t){return t instanceof Ry?t:new Ry(e,{secret:t})},Ry.prototype.secret=function(){return this._secret},Ny(Ry,"pubBytes",(function(){return this.eddsa.encodePoint(this.pub())})),Ny(Ry,"pub",(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())})),Ny(Ry,"privBytes",(function(){var e=this.eddsa,t=this.hash(),r=e.encodingLength-1,n=t.slice(0,e.encodingLength);return n[0]&=248,n[r]&=127,n[r]|=64,n})),Ny(Ry,"priv",(function(){return this.eddsa.decodeInt(this.privBytes())})),Ny(Ry,"hash",(function(){return this.eddsa.hash().update(this.secret()).digest()})),Ny(Ry,"messagePrefix",(function(){return this.hash().slice(this.eddsa.encodingLength)})),Ry.prototype.sign=function(e){return Cy(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)},Ry.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},Ry.prototype.getSecret=function(e){return Cy(this._secret,"KeyPair is public only"),My.encode(this.secret(),e)},Ry.prototype.getPublic=function(e){return My.encode(this.pubBytes(),e)};var Fy=Ry,Ly=mm,Uy=hm,jy=Uy.assert,Dy=Uy.cachedProperty,zy=Uy.parseBytes;function $y(e,t){this.eddsa=e,"object"!=typeof t&&(t=zy(t)),Array.isArray(t)&&(t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),jy(t.R&&t.S,"Signature without R or S"),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof Ly&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Dy($y,"S",(function(){return this.eddsa.decodeInt(this.Sencoded())})),Dy($y,"R",(function(){return this.eddsa.decodePoint(this.Rencoded())})),Dy($y,"Rencoded",(function(){return this.eddsa.encodePoint(this.R())})),Dy($y,"Sencoded",(function(){return this.eddsa.encodeInt(this.S())})),$y.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},$y.prototype.toHex=function(){return Uy.encode(this.toBytes(),"hex").toUpperCase()};var Hy=$y,Gy=ob,qy=ib,Ky=hm,Vy=Ky.assert,Wy=Ky.parseBytes,Jy=Fy,Zy=Hy;function Yy(e){if(Vy("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof Yy))return new Yy(e);e=qy[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=Gy.sha512}var Xy=Yy;Yy.prototype.sign=function(e,t){e=Wy(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),s=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:s,Rencoded:o})},Yy.prototype.verify=function(e,t,r){e=Wy(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},Yy.prototype.hashInt=function(){for(var e=this.hash(),t=0;t0&&e.compare(rv)<0)}function av(e){const t=new Uint8Array(e);return void 0===ev.getRandomValues?_.from(um.randomBytes(e)):(ev.getRandomValues(t),_.from(t))}async function sv(e){if(tv){const t=await tv.digest("SHA-512",e);return new Uint8Array(t)}const t=um.createHash("sha512").update(e).digest();return new Uint8Array(t)}function cv(e){return async function(t,r,n){if(tv){const i={name:"AES-CBC"},o=await tv.importKey("raw",r,i,!1,[e]),a={name:"AES-CBC",iv:t},s=await tv[e](a,o,n);return _.from(new Uint8Array(s))}if("encrypt"===e){const e=um.createCipheriv("aes-256-cbc",r,t),i=e.update(n),o=e.final();return _.concat([i,o])}if("decrypt"===e){const e=um.createDecipheriv("aes-256-cbc",r,t),i=e.update(n),o=e.final();return _.concat([i,o])}throw new Error(`Unsupported operation: ${e}`)}}const uv=cv("encrypt"),lv=cv("decrypt");async function fv(e,t){if(tv){const r={name:"HMAC",hash:{name:"SHA-256"}},n=await tv.importKey("raw",new Uint8Array(e),r,!1,["sign","verify"]),i=await tv.sign("HMAC",n,t);return _.from(new Uint8Array(i))}const r=um.createHmac("sha256",_.from(e));r.update(t);return r.digest()}const dv=function(e){return iv(32===e.length,"Bad private key"),iv(ov(e),"Bad private key"),_.from(Qy.keyFromPrivate(e).getPublic("array"))},hv=async function(e,t){return iv(32===e.length,"Bad private key"),iv(ov(e),"Bad private key"),iv(t.length>0,"Message should not be empty"),iv(t.length<=32,"Message is too long"),_.from(Qy.sign(t,e,{canonical:!0}).toDER())},pv=async function(e,t){iv(_.isBuffer(e),"Bad private key"),iv(_.isBuffer(t),"Bad public key"),iv(32===e.length,"Bad private key"),iv(ov(e),"Bad private key"),iv(65===t.length||33===t.length,"Bad public key"),65===t.length&&iv(4===t[0],"Bad public key"),33===t.length&&iv(2===t[0]||3===t[0],"Bad public key");const r=Qy.keyFromPrivate(e),n=Qy.keyFromPublic(t),i=r.derive(n.getPublic());return _.from(i.toArray())},mv=async function(e,t){iv(_.isBuffer(e),"Bad private key"),iv(_.isBuffer(t),"Bad public key"),iv(32===e.length,"Bad private key"),iv(ov(e),"Bad private key"),iv(65===t.length||33===t.length,"Bad public key"),65===t.length&&iv(4===t[0],"Bad public key"),33===t.length&&iv(2===t[0]||3===t[0],"Bad public key");const r=Qy.keyFromPrivate(e),n=Qy.keyFromPublic(t),i=r.derive(n.getPublic());return _.from(i.toString(16,64),"hex")},bv=async function(e,t,r){const n=null!=r&&r,i=n?mv:pv,o=await i(e,t.ephemPublicKey),a=await sv(o),s=a.slice(0,32),c=a.slice(32),u=_.concat([t.iv,t.ephemPublicKey,t.ciphertext]),l=await async function(e,t,r){return function(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n="0"&&t<="9";)r+=t,o();if("."===t)for(r+=".";o()&&t>="0"&&t<="9";)r+=t;if("e"===t||"E"===t)for(r+=t,o(),"-"!==t&&"+"!==t||(r+=t,o());t>="0"&&t<="9";)r+=t,o();return e=Number(r),isFinite(e)||i("Bad number"),e}function s(){var e,r,a,s="";if('"'===t)for(;o();){if('"'===t)return o(),s;if("\\"===t)if(o(),"u"===t){for(a=0,r=0;r<4&&(e=parseInt(o(),16),isFinite(e));r+=1)a=16*a+e;s+=String.fromCharCode(a)}else{if("string"!=typeof n[t])break;s+=n[t]}else s+=t}i("Bad string")}function c(){for(;t&&t<=" ";)o()}function u(){switch(c(),t){case"{":return function(){var e,r={};if("{"===t){if(o("{"),c(),"}"===t)return o("}"),r;for(;t;){if(e=s(),c(),o(":"),Object.prototype.hasOwnProperty.call(r,e)&&i('Duplicate key "'+e+'"'),r[e]=u(),c(),"}"===t)return o("}"),r;o(","),c()}}i("Bad object")}();case"[":return function(){var e=[];if("["===t){if(o("["),c(),"]"===t)return o("]"),e;for(;t;){if(e.push(u()),c(),"]"===t)return o("]"),e;o(","),c()}}i("Bad array")}();case'"':return s();case"-":return a();default:return t>="0"&&t<="9"?a():function(){switch(t){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null;default:i("Unexpected '"+t+"'")}}()}}return gv=function(n,o){var a;return r=n,e=0,t=" ",a=u(),c(),t&&i("Syntax error"),"function"==typeof o?function e(t,r){var n,i,a=t[r];if(a&&"object"==typeof a)for(n in u)Object.prototype.hasOwnProperty.call(a,n)&&(void 0===(i=e(a,n))?delete a[n]:a[n]=i);return o.call(t,r,a)}({"":a},""):a},gv}function _v(){if(wv)return vv;wv=1;var e,t,r,n=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function o(e){return n.lastIndex=0,n.test(e)?'"'+e.replace(n,(function(e){var t=i[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function a(n,i){var s,c,u,l,f,d=e,h=i[n];switch(h&&"object"==typeof h&&"function"==typeof h.toJSON&&(h=h.toJSON(n)),"function"==typeof r&&(h=r.call(i,n,h)),typeof h){case"string":return o(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h)return"null";if(e+=t,f=[],"[object Array]"===Object.prototype.toString.apply(h)){for(l=h.length,s=0;s=0&&"[object Function]"===Pv.call(e.callee)),r};var Tv=Array.prototype.slice,Ov=Iv,Mv=Object.keys,Cv=Mv?function(e){return Mv(e)}:function(){if(Sv)return kv;var e;if(Sv=1,!Object.keys){var t=Object.prototype.hasOwnProperty,r=Object.prototype.toString,n=Iv,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call((function(){}),"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],c=function(e){var t=e.constructor;return t&&t.prototype===e},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},l=function(){if("undefined"==typeof window)return!1;for(var e in window)try{if(!u["$"+e]&&t.call(window,e)&&null!==window[e]&&"object"==typeof window[e])try{c(window[e])}catch(e){return!0}}catch(e){return!0}return!1}();e=function(e){var i=null!==e&&"object"==typeof e,u="[object Function]"===r.call(e),f=n(e),d=i&&"[object String]"===r.call(e),h=[];if(!i&&!u&&!f)throw new TypeError("Object.keys called on a non-object");var p=a&&u;if(d&&e.length>0&&!t.call(e,0))for(var m=0;m0)for(var b=0;b1&&"boolean"!=typeof t)throw new aw('"allowMissing" argument must be a boolean');if(null===Ow(/^%?[^%]*%?$/,e))throw new ow("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=function(e){var t=Tw(e,0,1),r=Tw(e,-1);if("%"===t&&"%"!==r)throw new ow("invalid intrinsic syntax, expected closing `%`");if("%"===r&&"%"!==t)throw new ow("invalid intrinsic syntax, expected opening `%`");var n=[];return Iw(e,Mw,(function(e,t,r,i){n[n.length]=r?Iw(i,Cw,"$1"):t||e})),n}(e),n=r.length>0?r[0]:"",i=Bw("%"+n+"%",t),o=i.name,a=i.value,s=!1,c=i.alias;c&&(n=c[0],Pw(r,Sw([0,1],c)));for(var u=1,l=!0;u=r.length){var p=lw(a,f);a=(l=!!p)&&"get"in p&&!("originalValue"in p.get)?p.get:a[f]}else l=kw(a,f),a=a[f];l&&!s&&(yw[o]=a)}}return a};function Rw(){if(Ew)return ww;Ew=1;var e=Nw("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch(t){e=!1}return ww=e}var Fw=Nw("%Object.getOwnPropertyDescriptor%",!0);if(Fw)try{Fw([],"length")}catch(C1){Fw=null}var Lw=Fw,Uw=Rw(),jw=qv,Dw=Kv,zw=Lw,$w=Rw(),Hw=function(){return!!$w};Hw.hasArrayLengthDefineBug=function(){if(!$w)return null;try{return 1!==$w([],"length",{value:1}).length}catch(e){return!0}};var Gw=Nw,qw=function(e,t,r){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new Dw("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new Dw("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new Dw("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new Dw("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new Dw("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new Dw("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,i=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6&&arguments[6],s=!!zw&&zw(e,t);if(Uw)Uw(e,t,{configurable:null===o&&s?s.configurable:!o,enumerable:null===n&&s?s.enumerable:!n,value:r,writable:null===i&&s?s.writable:!i});else{if(!a&&(n||i||o))throw new jw("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=r}},Kw=Hw(),Vw=Lw,Ww=Kv,Jw=Gw("%Math.floor%"),Zw=function(e,t){if("function"!=typeof e)throw new Ww("`fn` is not a function");if("number"!=typeof t||t<0||t>4294967295||Jw(t)!==t)throw new Ww("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],n=!0,i=!0;if("length"in e&&Vw){var o=Vw(e,"length");o&&!o.configurable&&(n=!1),o&&!o.writable&&(i=!1)}return(n||i||!r)&&(Kw?qw(e,"length",t,!0,!0):qw(e,"length",t)),e};!function(e){var t=Dv,r=Nw,n=Zw,i=Kv,o=r("%Function.prototype.apply%"),a=r("%Function.prototype.call%"),s=r("%Reflect.apply%",!0)||t.call(a,o),c=Rw(),u=r("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new i("a function is required");var r=s(t,a,arguments);return n(r,1+u(0,e.length-(arguments.length-1)),!0)};var l=function(){return s(t,o,arguments)};c?c(e.exports,"apply",{value:l}):e.exports.apply=l}(Rv);var Yw=Nw,Xw=Rv.exports,Qw=Xw(Yw("String.prototype.indexOf"));("undefined"!=typeof JSON?JSON:(Ev||(Ev=1,Av.parse=xv(),Av.stringify=_v()),Av)).stringify;var eE=function(e,t){var r=Yw(e,!!t);return"function"==typeof r&&Qw(e,".prototype.")>-1?Xw(r):r};function tE(e){return _.from(Fp(e))}eE("Array.prototype.join"),eE("Array.prototype.push");const rE=new fm.ec("secp256k1");async function nE(e,t){const r=JSON.stringify(t),n=_.from(r,"utf-8"),i=await async function(e,t,r){let n=(r=r||{}).ephemPrivateKey||av(32);for(;!ov(n);)n=r.ephemPrivateKey||av(32);const i=dv(n),o=await pv(n,e),a=await sv(o),s=r.iv||av(16),c=a.slice(0,32),u=a.slice(32),l=await uv(s,_.from(c),t),f=_.concat([s,i,l]);return{iv:s,ephemPublicKey:i,ciphertext:l,mac:await fv(_.from(u),f)}}(dv(_.from(e,"hex")),n),o=function(e){return{iv:_.from(e.iv).toString("hex"),ephemPublicKey:_.from(e.ephemPublicKey).toString("hex"),ciphertext:_.from(e.ciphertext).toString("hex"),mac:_.from(e.mac).toString("hex")}}(i);return JSON.stringify(o)}async function iE(e,t){const r=function(e){return{iv:_.from(e.iv,"hex"),ephemPublicKey:_.from(e.ephemPublicKey,"hex"),ciphertext:_.from(e.ciphertext,"hex"),mac:_.from(e.mac,"hex")}}(JSON.parse(t)),n=rE.keyFromPrivate(e),i=(await bv(_.from(n.getPrivate().toString("hex",64),"hex"),r)).toString("utf-8");return JSON.parse(i)}var oE={exports:{}}; /** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */!function(e,t){(function(){var r,n="Expected a function",i="__lodash_hash_undefined__",a="__lodash_placeholder__",s=16,c=32,u=64,l=128,f=256,d=1/0,h=9007199254740991,p=NaN,m=4294967295,b=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",s],["flip",512],["partial",c],["partialRight",u],["rearg",f]],g="[object Arguments]",y="[object Array]",v="[object Boolean]",w="[object Date]",E="[object Error]",A="[object Function]",x="[object GeneratorFunction]",_="[object Map]",k="[object Number]",S="[object Object]",P="[object Promise]",I="[object RegExp]",T="[object Set]",O="[object String]",M="[object Symbol]",C="[object WeakMap]",B="[object ArrayBuffer]",N="[object DataView]",R="[object Float32Array]",F="[object Float64Array]",L="[object Int8Array]",U="[object Int16Array]",j="[object Int32Array]",D="[object Uint8Array]",z="[object Uint8ClampedArray]",$="[object Uint16Array]",H="[object Uint32Array]",G=/\b__p \+= '';/g,q=/\b(__p \+=) '' \+/g,K=/(__e\(.*?\)|\b__t\)) \+\n'';/g,V=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,J=RegExp(V.source),Z=RegExp(W.source),Y=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,ee=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,re=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,ie=RegExp(ne.source),oe=/^\s+/,ae=/\s/,se=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ce=/\{\n\/\* \[wrapped with (.+)\] \*/,ue=/,? & /,le=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,fe=/[()=,{}\[\]\/\s]/,de=/\\(\\)?/g,he=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,me=/^[-+]0x[0-9a-f]+$/i,be=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,ve=/^(?:0|[1-9]\d*)$/,we=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ee=/($^)/,Ae=/['\n\r\u2028\u2029\\]/g,xe="\\ud800-\\udfff",_e="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",ke="\\u2700-\\u27bf",Se="a-z\\xdf-\\xf6\\xf8-\\xff",Pe="A-Z\\xc0-\\xd6\\xd8-\\xde",Ie="\\ufe0e\\ufe0f",Te="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Oe="['’]",Me="["+xe+"]",Ce="["+Te+"]",Be="["+_e+"]",Ne="\\d+",Re="["+ke+"]",Fe="["+Se+"]",Le="[^"+xe+Te+Ne+ke+Se+Pe+"]",Ue="\\ud83c[\\udffb-\\udfff]",je="[^"+xe+"]",De="(?:\\ud83c[\\udde6-\\uddff]){2}",ze="[\\ud800-\\udbff][\\udc00-\\udfff]",$e="["+Pe+"]",He="\\u200d",Ge="(?:"+Fe+"|"+Le+")",qe="(?:"+$e+"|"+Le+")",Ke="(?:['’](?:d|ll|m|re|s|t|ve))?",Ve="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Be+"|"+Ue+")"+"?",Je="["+Ie+"]?",Ze=Je+We+("(?:"+He+"(?:"+[je,De,ze].join("|")+")"+Je+We+")*"),Ye="(?:"+[Re,De,ze].join("|")+")"+Ze,Xe="(?:"+[je+Be+"?",Be,De,ze,Me].join("|")+")",Qe=RegExp(Oe,"g"),et=RegExp(Be,"g"),tt=RegExp(Ue+"(?="+Ue+")|"+Xe+Ze,"g"),rt=RegExp([$e+"?"+Fe+"+"+Ke+"(?="+[Ce,$e,"$"].join("|")+")",qe+"+"+Ve+"(?="+[Ce,$e+Ge,"$"].join("|")+")",$e+"?"+Ge+"+"+Ke,$e+"+"+Ve,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ne,Ye].join("|"),"g"),nt=RegExp("["+He+xe+_e+Ie+"]"),it=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ot=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],at=-1,st={};st[R]=st[F]=st[L]=st[U]=st[j]=st[D]=st[z]=st[$]=st[H]=!0,st[g]=st[y]=st[B]=st[v]=st[N]=st[w]=st[E]=st[A]=st[_]=st[k]=st[S]=st[I]=st[T]=st[O]=st[C]=!1;var ct={};ct[g]=ct[y]=ct[B]=ct[N]=ct[v]=ct[w]=ct[R]=ct[F]=ct[L]=ct[U]=ct[j]=ct[_]=ct[k]=ct[S]=ct[I]=ct[T]=ct[O]=ct[M]=ct[D]=ct[z]=ct[$]=ct[H]=!0,ct[E]=ct[A]=ct[C]=!1;var ut={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},lt=parseFloat,ft=parseInt,dt="object"==typeof o&&o&&o.Object===Object&&o,ht="object"==typeof self&&self&&self.Object===Object&&self,pt=dt||ht||Function("return this")(),mt=t&&!t.nodeType&&t,bt=mt&&e&&!e.nodeType&&e,gt=bt&&bt.exports===mt,yt=gt&&dt.process,vt=function(){try{var e=bt&&bt.require&&bt.require("util").types;return e||yt&&yt.binding&&yt.binding("util")}catch(e){}}(),wt=vt&&vt.isArrayBuffer,Et=vt&&vt.isDate,At=vt&&vt.isMap,xt=vt&&vt.isRegExp,_t=vt&&vt.isSet,kt=vt&&vt.isTypedArray;function St(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Pt(e,t,r,n){for(var i=-1,o=null==e?0:e.length;++i-1}function Bt(e,t,r){for(var n=-1,i=null==e?0:e.length;++n-1;);return r}function rr(e,t){for(var r=e.length;r--&&$t(t,e[r],0)>-1;);return r}var nr=Vt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ir=Vt({"&":"&","<":"<",">":">",'"':""","'":"'"});function or(e){return"\\"+ut[e]}function ar(e){return nt.test(e)}function sr(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function cr(e,t){return function(r){return e(t(r))}}function ur(e,t){for(var r=-1,n=e.length,i=0,o=[];++r",""":'"',"'":"'"});var br=function e(t){var o=(t=null==t?pt:br.defaults(pt.Object(),t,br.pick(pt,ot))).Array,ae=t.Date,xe=t.Error,_e=t.Function,ke=t.Math,Se=t.Object,Pe=t.RegExp,Ie=t.String,Te=t.TypeError,Oe=o.prototype,Me=_e.prototype,Ce=Se.prototype,Be=t["__core-js_shared__"],Ne=Me.toString,Re=Ce.hasOwnProperty,Fe=0,Le=function(){var e=/[^.]+$/.exec(Be&&Be.keys&&Be.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Ue=Ce.toString,je=Ne.call(Se),De=pt._,ze=Pe("^"+Ne.call(Re).replace(ne,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),$e=gt?t.Buffer:r,He=t.Symbol,Ge=t.Uint8Array,qe=$e?$e.allocUnsafe:r,Ke=cr(Se.getPrototypeOf,Se),Ve=Se.create,We=Ce.propertyIsEnumerable,Je=Oe.splice,Ze=He?He.isConcatSpreadable:r,Ye=He?He.iterator:r,Xe=He?He.toStringTag:r,tt=function(){try{var e=fo(Se,"defineProperty");return e({},"",{}),e}catch(e){}}(),nt=t.clearTimeout!==pt.clearTimeout&&t.clearTimeout,ut=ae&&ae.now!==pt.Date.now&&ae.now,dt=t.setTimeout!==pt.setTimeout&&t.setTimeout,ht=ke.ceil,mt=ke.floor,bt=Se.getOwnPropertySymbols,yt=$e?$e.isBuffer:r,vt=t.isFinite,jt=Oe.join,Vt=cr(Se.keys,Se),gr=ke.max,yr=ke.min,vr=ae.now,wr=t.parseInt,Er=ke.random,Ar=Oe.reverse,xr=fo(t,"DataView"),_r=fo(t,"Map"),kr=fo(t,"Promise"),Sr=fo(t,"Set"),Pr=fo(t,"WeakMap"),Ir=fo(Se,"create"),Tr=Pr&&new Pr,Or={},Mr=Uo(xr),Cr=Uo(_r),Br=Uo(kr),Nr=Uo(Sr),Rr=Uo(Pr),Fr=He?He.prototype:r,Lr=Fr?Fr.valueOf:r,Ur=Fr?Fr.toString:r;function jr(e){if(ts(e)&&!Ga(e)&&!(e instanceof Hr)){if(e instanceof $r)return e;if(Re.call(e,"__wrapped__"))return jo(e)}return new $r(e)}var Dr=function(){function e(){}return function(t){if(!es(t))return{};if(Ve)return Ve(t);e.prototype=t;var n=new e;return e.prototype=r,n}}();function zr(){}function $r(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=r}function Hr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=m,this.__views__=[]}function Gr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function cn(e,t,n,i,o,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=o?n(e,i,o,a):n(e)),s!==r)return s;if(!es(e))return e;var f=Ga(e);if(f){if(s=function(e){var t=e.length,r=new e.constructor(t);t&&"string"==typeof e[0]&&Re.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!c)return Ti(e,s)}else{var d=mo(e),h=d==A||d==x;if(Wa(e))return xi(e,c);if(d==S||d==g||h&&!o){if(s=u||h?{}:go(e),!c)return u?function(e,t){return Oi(e,po(e),t)}(e,function(e,t){return e&&Oi(t,Cs(t),e)}(s,e)):function(e,t){return Oi(e,ho(e),t)}(e,nn(s,e))}else{if(!ct[d])return o?e:{};s=function(e,t,r){var n=e.constructor;switch(t){case B:return _i(e);case v:case w:return new n(+e);case N:return function(e,t){var r=t?_i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case R:case F:case L:case U:case j:case D:case z:case $:case H:return ki(e,r);case _:return new n;case k:case O:return new n(e);case I:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case T:return new n;case M:return i=e,Lr?Se(Lr.call(i)):{}}var i}(e,d,c)}}a||(a=new Wr);var p=a.get(e);if(p)return p;a.set(e,s),as(e)?e.forEach((function(r){s.add(cn(r,t,n,r,e,a))})):rs(e)&&e.forEach((function(r,i){s.set(i,cn(r,t,n,i,e,a))}));var m=f?r:(l?u?io:no:u?Cs:Ms)(e);return It(m||e,(function(r,i){m&&(r=e[i=r]),en(s,i,cn(r,t,n,i,e,a))})),s}function un(e,t,n){var i=n.length;if(null==e)return!i;for(e=Se(e);i--;){var o=n[i],a=t[o],s=e[o];if(s===r&&!(o in e)||!a(s))return!1}return!0}function ln(e,t,i){if("function"!=typeof e)throw new Te(n);return Mo((function(){e.apply(r,i)}),t)}function fn(e,t,r,n){var i=-1,o=Ct,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;r&&(t=Nt(t,Xt(r))),n?(o=Bt,a=!1):t.length>=200&&(o=er,a=!1,t=new Vr(t));e:for(;++i-1},qr.prototype.set=function(e,t){var r=this.__data__,n=tn(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Kr.prototype.clear=function(){this.size=0,this.__data__={hash:new Gr,map:new(_r||qr),string:new Gr}},Kr.prototype.delete=function(e){var t=uo(this,e).delete(e);return this.size-=t?1:0,t},Kr.prototype.get=function(e){return uo(this,e).get(e)},Kr.prototype.has=function(e){return uo(this,e).has(e)},Kr.prototype.set=function(e,t){var r=uo(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Vr.prototype.add=Vr.prototype.push=function(e){return this.__data__.set(e,i),this},Vr.prototype.has=function(e){return this.__data__.has(e)},Wr.prototype.clear=function(){this.__data__=new qr,this.size=0},Wr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Wr.prototype.get=function(e){return this.__data__.get(e)},Wr.prototype.has=function(e){return this.__data__.has(e)},Wr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof qr){var n=r.__data__;if(!_r||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new Kr(n)}return r.set(e,t),this.size=r.size,this};var dn=Bi(wn),hn=Bi(En,!0);function pn(e,t){var r=!0;return dn(e,(function(e,n,i){return r=!!t(e,n,i)})),r}function mn(e,t,n){for(var i=-1,o=e.length;++i0&&r(s)?t>1?gn(s,t-1,r,n,i):Rt(i,s):n||(i[i.length]=s)}return i}var yn=Ni(),vn=Ni(!0);function wn(e,t){return e&&yn(e,t,Ms)}function En(e,t){return e&&vn(e,t,Ms)}function An(e,t){return Mt(t,(function(t){return Ya(e[t])}))}function xn(e,t){for(var n=0,i=(t=vi(t,e)).length;null!=e&&nt}function Pn(e,t){return null!=e&&Re.call(e,t)}function In(e,t){return null!=e&&t in Se(e)}function Tn(e,t,n){for(var i=n?Bt:Ct,a=e[0].length,s=e.length,c=s,u=o(s),l=1/0,f=[];c--;){var d=e[c];c&&t&&(d=Nt(d,Xt(t))),l=yr(d.length,l),u[c]=!n&&(t||a>=120&&d.length>=120)?new Vr(c&&d):r}d=e[0];var h=-1,p=u[0];e:for(;++h=s?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}))}function qn(e,t,r){for(var n=-1,i=t.length,o={};++n-1;)s!==e&&Je.call(s,c,1),Je.call(e,c,1);return e}function Vn(e,t){for(var r=e?t.length:0,n=r-1;r--;){var i=t[r];if(r==n||i!==o){var o=i;vo(i)?Je.call(e,i,1):fi(e,i)}}return e}function Wn(e,t){return e+mt(Er()*(t-e+1))}function Jn(e,t){var r="";if(!e||t<1||t>h)return r;do{t%2&&(r+=e),(t=mt(t/2))&&(e+=e)}while(t);return r}function Zn(e,t){return Co(Po(e,t,nc),e+"")}function Yn(e){return Zr(Ds(e))}function Xn(e,t){var r=Ds(e);return Ro(r,sn(t,0,r.length))}function Qn(e,t,n,i){if(!es(e))return e;for(var o=-1,a=(t=vi(t,e)).length,s=a-1,c=e;null!=c&&++oi?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=o(i);++n>>1,a=e[o];null!==a&&!cs(a)&&(r?a<=t:a=200){var u=t?null:Ji(e);if(u)return lr(u);a=!1,i=er,c=new Vr}else c=t?[]:s;e:for(;++n=i?e:ni(e,t,n)}var Ai=nt||function(e){return pt.clearTimeout(e)};function xi(e,t){if(t)return e.slice();var r=e.length,n=qe?qe(r):new e.constructor(r);return e.copy(n),n}function _i(e){var t=new e.constructor(e.byteLength);return new Ge(t).set(new Ge(e)),t}function ki(e,t){var r=t?_i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Si(e,t){if(e!==t){var n=e!==r,i=null===e,o=e==e,a=cs(e),s=t!==r,c=null===t,u=t==t,l=cs(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||i&&s&&u||!n&&u||!o)return 1;if(!i&&!a&&!l&&e1?n[o-1]:r,s=o>2?n[2]:r;for(a=e.length>3&&"function"==typeof a?(o--,a):r,s&&wo(n[0],n[1],s)&&(a=o<3?r:a,o=1),t=Se(t);++i-1?o[a?t[s]:s]:r}}function ji(e){return ro((function(t){var i=t.length,o=i,a=$r.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Te(n);if(a&&!c&&"wrapper"==ao(s))var c=new $r([],!0)}for(o=c?o:i;++o1&&w.reverse(),h&&fc))return!1;var l=a.get(e),f=a.get(t);if(l&&f)return l==t&&f==e;var d=-1,h=!0,p=2&n?new Vr:r;for(a.set(e,t),a.set(t,e);++d-1&&e%1==0&&e1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(se,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return It(b,(function(r){var n="_."+r[0];t&r[1]&&!Ct(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ce);return t?t[1].split(ue):[]}(n),r)))}function No(e){var t=0,n=0;return function(){var i=vr(),o=16-(i-n);if(n=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Ro(e,t){var n=-1,i=e.length,o=i-1;for(t=t===r?i:t;++n1?e[t-1]:r;return n="function"==typeof n?(e.pop(),n):r,oa(e,n)}));function da(e){var t=jr(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var pa=ro((function(e){var t=e.length,n=t?e[0]:0,i=this.__wrapped__,o=function(t){return an(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Hr&&vo(n)?((i=i.slice(n,+n+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:r}),new $r(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(r),e}))):this.thru(o)}));var ma=Mi((function(e,t,r){Re.call(e,r)?++e[r]:on(e,r,1)}));var ba=Ui(Ho),ga=Ui(Go);function ya(e,t){return(Ga(e)?It:dn)(e,co(t,3))}function va(e,t){return(Ga(e)?Tt:hn)(e,co(t,3))}var wa=Mi((function(e,t,r){Re.call(e,r)?e[r].push(t):on(e,r,[t])}));var Ea=Zn((function(e,t,r){var n=-1,i="function"==typeof t,a=Ka(e)?o(e.length):[];return dn(e,(function(e){a[++n]=i?St(t,e,r):On(e,t,r)})),a})),Aa=Mi((function(e,t,r){on(e,r,t)}));function xa(e,t){return(Ga(e)?Nt:jn)(e,co(t,3))}var _a=Mi((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]}));var ka=Zn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&wo(e,t[0],t[1])?t=[]:r>2&&wo(t[0],t[1],t[2])&&(t=[t[0]]),Gn(e,gn(t,1),[])})),Sa=ut||function(){return pt.Date.now()};function Pa(e,t,n){return t=n?r:t,t=e&&null==t?e.length:t,Yi(e,l,r,r,r,r,t)}function Ia(e,t){var i;if("function"!=typeof t)throw new Te(n);return e=ps(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=r),i}}var Ta=Zn((function(e,t,r){var n=1;if(r.length){var i=ur(r,so(Ta));n|=c}return Yi(e,n,t,r,i)})),Oa=Zn((function(e,t,r){var n=3;if(r.length){var i=ur(r,so(Oa));n|=c}return Yi(t,n,e,r,i)}));function Ma(e,t,i){var o,a,s,c,u,l,f=0,d=!1,h=!1,p=!0;if("function"!=typeof e)throw new Te(n);function m(t){var n=o,i=a;return o=a=r,f=t,c=e.apply(i,n)}function b(e){var n=e-l;return l===r||n>=t||n<0||h&&e-f>=s}function g(){var e=Sa();if(b(e))return y(e);u=Mo(g,function(e){var r=t-(e-l);return h?yr(r,s-(e-f)):r}(e))}function y(e){return u=r,p&&o?m(e):(o=a=r,c)}function v(){var e=Sa(),n=b(e);if(o=arguments,a=this,l=e,n){if(u===r)return function(e){return f=e,u=Mo(g,t),d?m(e):c}(l);if(h)return Ai(u),u=Mo(g,t),m(l)}return u===r&&(u=Mo(g,t)),c}return t=bs(t)||0,es(i)&&(d=!!i.leading,s=(h="maxWait"in i)?gr(bs(i.maxWait)||0,t):s,p="trailing"in i?!!i.trailing:p),v.cancel=function(){u!==r&&Ai(u),f=0,o=l=a=u=r},v.flush=function(){return u===r?c:y(Sa())},v}var Ca=Zn((function(e,t){return ln(e,1,t)})),Ba=Zn((function(e,t,r){return ln(e,bs(t)||0,r)}));function Na(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Te(n);var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=e.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(Na.Cache||Kr),r}function Ra(e){if("function"!=typeof e)throw new Te(n);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Na.Cache=Kr;var Fa=wi((function(e,t){var r=(t=1==t.length&&Ga(t[0])?Nt(t[0],Xt(co())):Nt(gn(t,1),Xt(co()))).length;return Zn((function(n){for(var i=-1,o=yr(n.length,r);++i=t})),Ha=Mn(function(){return arguments}())?Mn:function(e){return ts(e)&&Re.call(e,"callee")&&!We.call(e,"callee")},Ga=o.isArray,qa=wt?Xt(wt):function(e){return ts(e)&&kn(e)==B};function Ka(e){return null!=e&&Qa(e.length)&&!Ya(e)}function Va(e){return ts(e)&&Ka(e)}var Wa=yt||bc,Ja=Et?Xt(Et):function(e){return ts(e)&&kn(e)==w};function Za(e){if(!ts(e))return!1;var t=kn(e);return t==E||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!is(e)}function Ya(e){if(!es(e))return!1;var t=kn(e);return t==A||t==x||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xa(e){return"number"==typeof e&&e==ps(e)}function Qa(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=h}function es(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ts(e){return null!=e&&"object"==typeof e}var rs=At?Xt(At):function(e){return ts(e)&&mo(e)==_};function ns(e){return"number"==typeof e||ts(e)&&kn(e)==k}function is(e){if(!ts(e)||kn(e)!=S)return!1;var t=Ke(e);if(null===t)return!0;var r=Re.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Ne.call(r)==je}var os=xt?Xt(xt):function(e){return ts(e)&&kn(e)==I};var as=_t?Xt(_t):function(e){return ts(e)&&mo(e)==T};function ss(e){return"string"==typeof e||!Ga(e)&&ts(e)&&kn(e)==O}function cs(e){return"symbol"==typeof e||ts(e)&&kn(e)==M}var us=kt?Xt(kt):function(e){return ts(e)&&Qa(e.length)&&!!st[kn(e)]};var ls=Ki(Un),fs=Ki((function(e,t){return e<=t}));function ds(e){if(!e)return[];if(Ka(e))return ss(e)?hr(e):Ti(e);if(Ye&&e[Ye])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[Ye]());var t=mo(e);return(t==_?sr:t==T?lr:Ds)(e)}function hs(e){return e?(e=bs(e))===d||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ps(e){var t=hs(e),r=t%1;return t==t?r?t-r:t:0}function ms(e){return e?sn(ps(e),0,m):0}function bs(e){if("number"==typeof e)return e;if(cs(e))return p;if(es(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=es(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var r=be.test(e);return r||ye.test(e)?ft(e.slice(2),r?2:8):me.test(e)?p:+e}function gs(e){return Oi(e,Cs(e))}function ys(e){return null==e?"":ui(e)}var vs=Ci((function(e,t){if(_o(t)||Ka(t))Oi(t,Ms(t),e);else for(var r in t)Re.call(t,r)&&en(e,r,t[r])})),ws=Ci((function(e,t){Oi(t,Cs(t),e)})),Es=Ci((function(e,t,r,n){Oi(t,Cs(t),e,n)})),As=Ci((function(e,t,r,n){Oi(t,Ms(t),e,n)})),xs=ro(an);var _s=Zn((function(e,t){e=Se(e);var n=-1,i=t.length,o=i>2?t[2]:r;for(o&&wo(t[0],t[1],o)&&(i=1);++n1),t})),Oi(e,io(e),r),n&&(r=cn(r,7,eo));for(var i=t.length;i--;)fi(r,t[i]);return r}));var Fs=ro((function(e,t){return null==e?{}:function(e,t){return qn(e,t,(function(t,r){return Ps(e,r)}))}(e,t)}));function Ls(e,t){if(null==e)return{};var r=Nt(io(e),(function(e){return[e]}));return t=co(t),qn(e,r,(function(e,r){return t(e,r[0])}))}var Us=Zi(Ms),js=Zi(Cs);function Ds(e){return null==e?[]:Qt(e,Ms(e))}var zs=Fi((function(e,t,r){return t=t.toLowerCase(),e+(r?$s(t):t)}));function $s(e){return Zs(ys(e).toLowerCase())}function Hs(e){return(e=ys(e))&&e.replace(we,nr).replace(et,"")}var Gs=Fi((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),qs=Fi((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Ks=Ri("toLowerCase");var Vs=Fi((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()}));var Ws=Fi((function(e,t,r){return e+(r?" ":"")+Zs(t)}));var Js=Fi((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Zs=Ri("toUpperCase");function Ys(e,t,n){return e=ys(e),(t=n?r:t)===r?function(e){return it.test(e)}(e)?function(e){return e.match(rt)||[]}(e):function(e){return e.match(le)||[]}(e):e.match(t)||[]}var Xs=Zn((function(e,t){try{return St(e,r,t)}catch(e){return Za(e)?e:new xe(e)}})),Qs=ro((function(e,t){return It(t,(function(t){t=Lo(t),on(e,t,Ta(e[t],e))})),e}));function ec(e){return function(){return e}}var tc=ji(),rc=ji(!0);function nc(e){return e}function ic(e){return Rn("function"==typeof e?e:cn(e,1))}var oc=Zn((function(e,t){return function(r){return On(r,e,t)}})),ac=Zn((function(e,t){return function(r){return On(e,r,t)}}));function sc(e,t,r){var n=Ms(t),i=An(t,n);null!=r||es(t)&&(i.length||!n.length)||(r=t,t=e,e=this,i=An(t,Ms(t)));var o=!(es(r)&&"chain"in r&&!r.chain),a=Ya(e);return It(i,(function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(o||t){var r=e(this.__wrapped__);return(r.__actions__=Ti(this.__actions__)).push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,Rt([this.value()],arguments))})})),e}function cc(){}var uc=Hi(Nt),lc=Hi(Ot),fc=Hi(Ut);function dc(e){return Eo(e)?Kt(Lo(e)):function(e){return function(t){return xn(t,e)}}(e)}var hc=qi(),pc=qi(!0);function mc(){return[]}function bc(){return!1}var gc=$i((function(e,t){return e+t}),0),yc=Wi("ceil"),vc=$i((function(e,t){return e/t}),1),wc=Wi("floor");var Ec,Ac=$i((function(e,t){return e*t}),1),xc=Wi("round"),_c=$i((function(e,t){return e-t}),0);return jr.after=function(e,t){if("function"!=typeof t)throw new Te(n);return e=ps(e),function(){if(--e<1)return t.apply(this,arguments)}},jr.ary=Pa,jr.assign=vs,jr.assignIn=ws,jr.assignInWith=Es,jr.assignWith=As,jr.at=xs,jr.before=Ia,jr.bind=Ta,jr.bindAll=Qs,jr.bindKey=Oa,jr.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ga(e)?e:[e]},jr.chain=da,jr.chunk=function(e,t,n){t=(n?wo(e,t,n):t===r)?1:gr(ps(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,s=0,c=o(ht(i/t));ao?0:o+n),(i=i===r||i>o?o:ps(i))<0&&(i+=o),i=n>i?0:ms(i);n>>0)?(e=ys(e))&&("string"==typeof t||null!=t&&!os(t))&&!(t=ui(t))&&ar(e)?Ei(hr(e),0,n):e.split(t,n):[]},jr.spread=function(e,t){if("function"!=typeof e)throw new Te(n);return t=null==t?0:gr(ps(t),0),Zn((function(r){var n=r[t],i=Ei(r,0,t);return n&&Rt(i,n),St(e,this,i)}))},jr.tail=function(e){var t=null==e?0:e.length;return t?ni(e,1,t):[]},jr.take=function(e,t,n){return e&&e.length?ni(e,0,(t=n||t===r?1:ps(t))<0?0:t):[]},jr.takeRight=function(e,t,n){var i=null==e?0:e.length;return i?ni(e,(t=i-(t=n||t===r?1:ps(t)))<0?0:t,i):[]},jr.takeRightWhile=function(e,t){return e&&e.length?hi(e,co(t,3),!1,!0):[]},jr.takeWhile=function(e,t){return e&&e.length?hi(e,co(t,3)):[]},jr.tap=function(e,t){return t(e),e},jr.throttle=function(e,t,r){var i=!0,o=!0;if("function"!=typeof e)throw new Te(n);return es(r)&&(i="leading"in r?!!r.leading:i,o="trailing"in r?!!r.trailing:o),Ma(e,t,{leading:i,maxWait:t,trailing:o})},jr.thru=ha,jr.toArray=ds,jr.toPairs=Us,jr.toPairsIn=js,jr.toPath=function(e){return Ga(e)?Nt(e,Lo):cs(e)?[e]:Ti(Fo(ys(e)))},jr.toPlainObject=gs,jr.transform=function(e,t,r){var n=Ga(e),i=n||Wa(e)||us(e);if(t=co(t,4),null==r){var o=e&&e.constructor;r=i?n?new o:[]:es(e)&&Ya(o)?Dr(Ke(e)):{}}return(i?It:wn)(e,(function(e,n,i){return t(r,e,n,i)})),r},jr.unary=function(e){return Pa(e,1)},jr.union=ta,jr.unionBy=ra,jr.unionWith=na,jr.uniq=function(e){return e&&e.length?li(e):[]},jr.uniqBy=function(e,t){return e&&e.length?li(e,co(t,2)):[]},jr.uniqWith=function(e,t){return t="function"==typeof t?t:r,e&&e.length?li(e,r,t):[]},jr.unset=function(e,t){return null==e||fi(e,t)},jr.unzip=ia,jr.unzipWith=oa,jr.update=function(e,t,r){return null==e?e:di(e,t,yi(r))},jr.updateWith=function(e,t,n,i){return i="function"==typeof i?i:r,null==e?e:di(e,t,yi(n),i)},jr.values=Ds,jr.valuesIn=function(e){return null==e?[]:Qt(e,Cs(e))},jr.without=aa,jr.words=Ys,jr.wrap=function(e,t){return La(yi(t),e)},jr.xor=sa,jr.xorBy=ca,jr.xorWith=ua,jr.zip=la,jr.zipObject=function(e,t){return bi(e||[],t||[],en)},jr.zipObjectDeep=function(e,t){return bi(e||[],t||[],Qn)},jr.zipWith=fa,jr.entries=Us,jr.entriesIn=js,jr.extend=ws,jr.extendWith=Es,sc(jr,jr),jr.add=gc,jr.attempt=Xs,jr.camelCase=zs,jr.capitalize=$s,jr.ceil=yc,jr.clamp=function(e,t,n){return n===r&&(n=t,t=r),n!==r&&(n=(n=bs(n))==n?n:0),t!==r&&(t=(t=bs(t))==t?t:0),sn(bs(e),t,n)},jr.clone=function(e){return cn(e,4)},jr.cloneDeep=function(e){return cn(e,5)},jr.cloneDeepWith=function(e,t){return cn(e,5,t="function"==typeof t?t:r)},jr.cloneWith=function(e,t){return cn(e,4,t="function"==typeof t?t:r)},jr.conformsTo=function(e,t){return null==t||un(e,t,Ms(t))},jr.deburr=Hs,jr.defaultTo=function(e,t){return null==e||e!=e?t:e},jr.divide=vc,jr.endsWith=function(e,t,n){e=ys(e),t=ui(t);var i=e.length,o=n=n===r?i:sn(ps(n),0,i);return(n-=t.length)>=0&&e.slice(n,o)==t},jr.eq=Da,jr.escape=function(e){return(e=ys(e))&&Z.test(e)?e.replace(W,ir):e},jr.escapeRegExp=function(e){return(e=ys(e))&&ie.test(e)?e.replace(ne,"\\$&"):e},jr.every=function(e,t,n){var i=Ga(e)?Ot:pn;return n&&wo(e,t,n)&&(t=r),i(e,co(t,3))},jr.find=ba,jr.findIndex=Ho,jr.findKey=function(e,t){return Dt(e,co(t,3),wn)},jr.findLast=ga,jr.findLastIndex=Go,jr.findLastKey=function(e,t){return Dt(e,co(t,3),En)},jr.floor=wc,jr.forEach=ya,jr.forEachRight=va,jr.forIn=function(e,t){return null==e?e:yn(e,co(t,3),Cs)},jr.forInRight=function(e,t){return null==e?e:vn(e,co(t,3),Cs)},jr.forOwn=function(e,t){return e&&wn(e,co(t,3))},jr.forOwnRight=function(e,t){return e&&En(e,co(t,3))},jr.get=Ss,jr.gt=za,jr.gte=$a,jr.has=function(e,t){return null!=e&&bo(e,t,Pn)},jr.hasIn=Ps,jr.head=Ko,jr.identity=nc,jr.includes=function(e,t,r,n){e=Ka(e)?e:Ds(e),r=r&&!n?ps(r):0;var i=e.length;return r<0&&(r=gr(i+r,0)),ss(e)?r<=i&&e.indexOf(t,r)>-1:!!i&&$t(e,t,r)>-1},jr.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=null==r?0:ps(r);return i<0&&(i=gr(n+i,0)),$t(e,t,i)},jr.inRange=function(e,t,n){return t=hs(t),n===r?(n=t,t=0):n=hs(n),function(e,t,r){return e>=yr(t,r)&&e=-9007199254740991&&e<=h},jr.isSet=as,jr.isString=ss,jr.isSymbol=cs,jr.isTypedArray=us,jr.isUndefined=function(e){return e===r},jr.isWeakMap=function(e){return ts(e)&&mo(e)==C},jr.isWeakSet=function(e){return ts(e)&&"[object WeakSet]"==kn(e)},jr.join=function(e,t){return null==e?"":jt.call(e,t)},jr.kebabCase=Gs,jr.last=Zo,jr.lastIndexOf=function(e,t,n){var i=null==e?0:e.length;if(!i)return-1;var o=i;return n!==r&&(o=(o=ps(n))<0?gr(i+o,0):yr(o,i-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,o):zt(e,Gt,o,!0)},jr.lowerCase=qs,jr.lowerFirst=Ks,jr.lt=ls,jr.lte=fs,jr.max=function(e){return e&&e.length?mn(e,nc,Sn):r},jr.maxBy=function(e,t){return e&&e.length?mn(e,co(t,2),Sn):r},jr.mean=function(e){return qt(e,nc)},jr.meanBy=function(e,t){return qt(e,co(t,2))},jr.min=function(e){return e&&e.length?mn(e,nc,Un):r},jr.minBy=function(e,t){return e&&e.length?mn(e,co(t,2),Un):r},jr.stubArray=mc,jr.stubFalse=bc,jr.stubObject=function(){return{}},jr.stubString=function(){return""},jr.stubTrue=function(){return!0},jr.multiply=Ac,jr.nth=function(e,t){return e&&e.length?Hn(e,ps(t)):r},jr.noConflict=function(){return pt._===this&&(pt._=De),this},jr.noop=cc,jr.now=Sa,jr.pad=function(e,t,r){e=ys(e);var n=(t=ps(t))?dr(e):0;if(!t||n>=t)return e;var i=(t-n)/2;return Gi(mt(i),r)+e+Gi(ht(i),r)},jr.padEnd=function(e,t,r){e=ys(e);var n=(t=ps(t))?dr(e):0;return t&&nt){var i=e;e=t,t=i}if(n||e%1||t%1){var o=Er();return yr(e+o*(t-e+lt("1e-"+((o+"").length-1))),t)}return Wn(e,t)},jr.reduce=function(e,t,r){var n=Ga(e)?Ft:Wt,i=arguments.length<3;return n(e,co(t,4),r,i,dn)},jr.reduceRight=function(e,t,r){var n=Ga(e)?Lt:Wt,i=arguments.length<3;return n(e,co(t,4),r,i,hn)},jr.repeat=function(e,t,n){return t=(n?wo(e,t,n):t===r)?1:ps(t),Jn(ys(e),t)},jr.replace=function(){var e=arguments,t=ys(e[0]);return e.length<3?t:t.replace(e[1],e[2])},jr.result=function(e,t,n){var i=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=r);++ih)return[];var r=m,n=yr(e,m);t=co(t),e-=m;for(var i=Zt(n,t);++r=a)return e;var c=n-dr(i);if(c<1)return i;var u=s?Ei(s,0,c).join(""):e.slice(0,c);if(o===r)return u+i;if(s&&(c+=u.length-c),os(o)){if(e.slice(c).search(o)){var l,f=u;for(o.global||(o=Pe(o.source,ys(pe.exec(o))+"g")),o.lastIndex=0;l=o.exec(f);)var d=l.index;u=u.slice(0,d===r?c:d)}}else if(e.indexOf(ui(o),c)!=c){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+i},jr.unescape=function(e){return(e=ys(e))&&J.test(e)?e.replace(V,mr):e},jr.uniqueId=function(e){var t=++Fe;return ys(e)+t},jr.upperCase=Js,jr.upperFirst=Zs,jr.each=ya,jr.eachRight=va,jr.first=Ko,sc(jr,(Ec={},wn(jr,(function(e,t){Re.call(jr.prototype,t)||(Ec[t]=e)})),Ec),{chain:!1}),jr.VERSION="4.17.21",It(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){jr[e].placeholder=jr})),It(["drop","take"],(function(e,t){Hr.prototype[e]=function(n){n=n===r?1:gr(ps(n),0);var i=this.__filtered__&&!t?new Hr(this):this.clone();return i.__filtered__?i.__takeCount__=yr(n,i.__takeCount__):i.__views__.push({size:yr(n,m),type:e+(i.__dir__<0?"Right":"")}),i},Hr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),It(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;Hr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:co(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),It(["head","last"],(function(e,t){var r="take"+(t?"Right":"");Hr.prototype[e]=function(){return this[r](1).value()[0]}})),It(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");Hr.prototype[e]=function(){return this.__filtered__?new Hr(this):this[r](1)}})),Hr.prototype.compact=function(){return this.filter(nc)},Hr.prototype.find=function(e){return this.filter(e).head()},Hr.prototype.findLast=function(e){return this.reverse().find(e)},Hr.prototype.invokeMap=Zn((function(e,t){return"function"==typeof e?new Hr(this):this.map((function(r){return On(r,e,t)}))})),Hr.prototype.reject=function(e){return this.filter(Ra(co(e)))},Hr.prototype.slice=function(e,t){e=ps(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Hr(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==r&&(n=(t=ps(t))<0?n.dropRight(-t):n.take(t-e)),n)},Hr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Hr.prototype.toArray=function(){return this.take(m)},wn(Hr.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=jr[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(jr.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof Hr,u=s[0],l=c||Ga(t),f=function(e){var t=o.apply(jr,Rt([e],s));return i&&d?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var d=this.__chain__,h=!!this.__actions__.length,p=a&&!d,m=c&&!h;if(!a&&l){t=m?t:new Hr(this);var b=e.apply(t,s);return b.__actions__.push({func:ha,args:[f],thisArg:r}),new $r(b,d)}return p&&m?e.apply(this,s):(b=this.thru(f),p?i?b.value()[0]:b.value():b)})})),It(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Oe[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);jr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var i=this.value();return t.apply(Ga(i)?i:[],e)}return this[r]((function(r){return t.apply(Ga(r)?r:[],e)}))}})),wn(Hr.prototype,(function(e,t){var r=jr[t];if(r){var n=r.name+"";Re.call(Or,n)||(Or[n]=[]),Or[n].push({name:t,func:r})}})),Or[Di(r,2).name]=[{name:"wrapper",func:r}],Hr.prototype.clone=function(){var e=new Hr(this.__wrapped__);return e.__actions__=Ti(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ti(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ti(this.__views__),e},Hr.prototype.reverse=function(){if(this.__filtered__){var e=new Hr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Hr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=Ga(e),n=t<0,i=r?e.length:0,o=function(e,t,r){var n=-1,i=r.length;for(;++n=this.__values__.length;return{done:e,value:e?r:this.__values__[this.__index__++]}},jr.prototype.plant=function(e){for(var t,n=this;n instanceof zr;){var i=jo(n);i.__index__=0,i.__values__=r,t?o.__wrapped__=i:t=i;var o=i;n=n.__wrapped__}return o.__wrapped__=e,t},jr.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Hr){var t=e;return this.__actions__.length&&(t=new Hr(this)),(t=t.reverse()).__actions__.push({func:ha,args:[ea],thisArg:r}),new $r(t,this.__chain__)}return this.thru(ea)},jr.prototype.toJSON=jr.prototype.valueOf=jr.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},jr.prototype.first=jr.prototype.head,Ye&&(jr.prototype[Ye]=function(){return this}),jr}();bt?((bt.exports=br)._=br,mt._=br):pt._=br}).call(o)}(oE,oE.exports);class aE extends nf{constructor(e){let{config:t={},state:n={}}=e;super(),r(this,"defaultConfig",{}),r(this,"defaultState",{}),r(this,"disabled",!1),r(this,"name","BaseController"),r(this,"initialConfig",void 0),r(this,"initialState",void 0),r(this,"internalConfig",this.defaultConfig),r(this,"internalState",this.defaultState),this.initialState=n,this.initialConfig=t}get config(){return this.internalConfig}get state(){return this.internalState}configure(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]){this.internalConfig=t?e:Object.assign(this.internalConfig,e);for(const e in this.internalConfig)void 0!==this.internalConfig[e]&&(this[e]=this.internalConfig[e])}else for(const t in e)void 0!==this.internalConfig[t]&&(this.internalConfig[t]=e[t],this[t]=e[t])}update(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.internalState=i(t?{}:i({},this.internalState),e),this.emit("store",this.internalState)}initialize(){return this.internalState=this.defaultState,this.internalConfig=this.defaultConfig,this.configure(this.initialConfig),this.update(this.initialState),this}}const sE=()=>!0,cE=["newListener","removeListener"],uE=e=>!cE.includes(e);function lE(e,t){let r=(t||{}).eventFilter||sE;if("string"==typeof r&&"skipInternal"===r&&(r=uE),"function"!=typeof r)throw new Error("createEventEmitterProxy - Invalid eventFilter");let n=e,i=e=>{const t=n;n=e,t.eventNames().filter(r).forEach((r=>{(function(e,t){return void 0!==e.rawListeners?e.rawListeners(t):e.listeners(t)})(t,r).forEach((t=>e.on(r,t)))})),t.removeAllListeners()};const o=new Proxy({},{get:(e,t)=>"setTarget"===t?i:n[t],set:(e,t,r)=>"setTarget"===t?(i=r,!0):(n[t]=r,!0)});return o}function fE(e,t){if(""!==e&&!/^[a-f0-9]+$/iu.test(e))throw new Error(`Expected an unprefixed hex string. Received: ${e}`);if(t<0)throw new Error(`Expected a non-negative integer target length. Received: ${t}`);return String.prototype.padStart.call(e,t,"0")}function dE(e,t,r){const n=pp(t),i=pp(r),o=up(e),a=fE(_.from(mp(n)).toString("hex"),64),s=fE(_.from(mp(i)).toString("hex"),64),c=tp("0x"+o.toString(16));var u;return"string"!=typeof(u=a.concat(s,c))||ep(u)?u:"0x"+u}const hE=async(e,t)=>{const r=_.from(e,"hex"),n=tp(t),i=function(e,t,r){const n=Yh.sign(e,t),i=n.toCompactRawBytes();return{r:i.slice(0,32),s:i.slice(32,64),v:void 0===r?BigInt(n.recovery+27):BigInt(n.recovery+35)+BigInt(r)*bp}}(_.from(n,"hex"),r);return dE(_.from(dp(i.v)),_.from(i.r),_.from(i.s))},pE=["Gateway timeout","ETIMEDOUT","failed to parse response body","Failed to fetch"];function mE(e){switch(e.status){case 405:throw Kl.methodNotFound();case 418:throw Kl.internal({message:"Request is being rate limited."});case 503:case 504:throw Kl.internal({message:"Gateway timeout. The request took too long to process.This can happen when querying over too wide a block range."})}}function bE(e){return new Promise((t=>{setTimeout(t,e)}))}function gE(e,t){if(200!==e.status)throw Kl.internal({message:`Non-200 status code: '${e.status}'`,data:t});if(t.error)throw Kl.internal({data:t.error});return t.result}function yE(e){let{rpcTarget:t,originHttpHeaderKey:r}=e;return sf((async(e,n,i)=>{const{fetchUrl:o,fetchParams:a}=function(e){let{req:t,rpcTarget:r,originHttpHeaderKey:n}=e;const i=new URL(r),o={id:t.id,jsonrpc:t.jsonrpc,method:t.method,params:t.params},a=t.origin,s={method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(o)};return n&&a&&(s.headers[n]=a),{fetchUrl:i.href,fetchParams:s}}({req:e,rpcTarget:t,originHttpHeaderKey:r});for(let e=0;e<5;e++){try{const e=await fetch(o,a);mE(e);const t=await e.json(),r=gE(e,t);return void(n.result=r)}catch(e){const t=e.toString();if(!pE.some((e=>t.includes(e))))throw e}await bE(1e3)}}))}var vE=function(e){var t=(e=e||{}).max||Number.MAX_SAFE_INTEGER,r=void 0!==e.start?e.start:Math.floor(Math.random()*t);return function(){return r%=t,r++}};var wE=a(vE);let EE=class extends aE{constructor(e){let{config:t,state:n}=e;if(super({config:t,state:n}),r(this,"_providerEngineProxy",null),!t.chainConfig)throw sd.invalidProviderConfigError("Please provide chainConfig");if(!t.chainConfig.chainId)throw sd.invalidProviderConfigError("Please provide chainId inside chainConfig");if(!t.chainConfig.rpcTarget)throw sd.invalidProviderConfigError("Please provide rpcTarget inside chainConfig");this.defaultState={chainId:"loading"},this.defaultConfig={chainConfig:t.chainConfig,networks:{[t.chainConfig.chainId]:t.chainConfig}},super.initialize()}get currentChainConfig(){return this.config.chainConfig}get provider(){return this._providerEngineProxy}get chainId(){return this.state.chainId}set provider(e){throw new Error("Method not implemented.")}async request(e){var t;if(!e||"object"!=typeof e||Array.isArray(e))throw Kl.invalidRequest({message:ld.invalidRequestArgs().message,data:i(i({},e||{}),{},{cause:ld.invalidRequestArgs().message})});const{method:r,params:n}=e;if("string"!=typeof r||0===r.length)throw Kl.invalidRequest({message:ld.invalidRequestMethod().message,data:i(i({},e||{}),{},{cause:ld.invalidRequestMethod().message})});if(void 0!==n&&!Array.isArray(n)&&("object"!=typeof n||null===n))throw Kl.invalidRequest({message:ld.invalidRequestParams().message,data:i(i({},e||{}),{},{cause:ld.invalidRequestParams().message})});return null===(t=this.provider)||void 0===t?void 0:t.request(e)}sendAsync(e,t){return t?this.send(e,t):this.request(e)}send(e,t){this.request(e).then((e=>t(null,{result:e}))).catch((e=>t(e,null)))}addChain(e){if(!e.chainId)throw Kl.invalidParams("chainId is required");if(!e.rpcTarget)throw Kl.invalidParams("chainId is required");this.configure({networks:i(i({},this.config.networks),{},{[e.chainId]:e})})}getChainConfig(e){var t;const r=null===(t=this.config.networks)||void 0===t?void 0:t[e];if(!r)throw Kl.invalidRequest(`Chain ${e} is not supported, please add chainConfig for it`);return r}updateProviderEngineProxy(e){this._providerEngineProxy?this._providerEngineProxy.setTarget(e):this._providerEngineProxy=lE(e)}getProviderEngineProxy(){return this._providerEngineProxy}};function AE(e){return(t,r,n,i)=>"chainId"===t.method?(r.result=e,i()):n()}function xE(e){return(t,r,n,i)=>"provider_config"===t.method?(r.result=e,i()):n()}var _E,kE;class SE extends EE{constructor(e){let{config:t,state:r}=e;super({config:t,state:r})}async setupProvider(){const{networkMiddleware:e}=function(e){const{chainId:t,rpcTarget:r}=e,n=yE({rpcTarget:r});return{networkMiddleware:uf([AE(t),xE(e),n]),fetchMiddleware:n}}(this.config.chainConfig),t=new cf;t.push(e);const r=lf(t);this.updateProviderEngineProxy(r);const n=this.config.chainConfig.chainId;this.state.chainId!==n&&(this.emit("chainChanged",n),this.emit("connect",{chainId:n})),this.update({chainId:this.config.chainConfig.chainId})}async switchChain(e){if(!this._providerEngineProxy)throw Vl.custom({message:"Provider is not initialized",code:4902});const t=this.getChainConfig(e.chainId);this.update({chainId:"loading"}),this.configure({chainConfig:t}),await this.setupProvider()}updateProviderEngineProxy(e){this._providerEngineProxy?this._providerEngineProxy.setTarget(e):this._providerEngineProxy=lE(e)}getProviderEngineProxy(){return this._providerEngineProxy}lookupNetwork(){throw new Error("Method not implemented.")}}_E=SE,r(SE,"getProviderInstance",(async e=>{const t=new _E({config:{chainConfig:e.chainConfig}});return await t.setupProvider(),t}));class PE extends EE{constructor(e){let{config:t,state:n}=e;super({config:{chainConfig:i(i({},t.chainConfig),{},{chainNamespace:nd.OTHER})},state:n}),r(this,"_providerEngineProxy",null)}get provider(){return this._providerEngineProxy}set provider(e){throw new Error("Method not implemented.")}addChain(e){throw new Error("Method not implemented.")}async setupProvider(e){const t=this.getPrivKeyMiddleware(e),r=new cf;r.push(t);const n=lf(r);this.updateProviderEngineProxy(n)}updateProviderEngineProxy(e){this._providerEngineProxy?this._providerEngineProxy.setTarget(e):this._providerEngineProxy=lE(e)}async switchChain(e){return Promise.resolve()}getProviderEngineProxy(){return this._providerEngineProxy}async lookupNetwork(){return Promise.resolve("")}getPrivKeyMiddleware(e){const t={getPrivatekey:async()=>e};return this.createPrivKeyMiddleware(t)}createPrivKeyMiddleware(e){let{getPrivatekey:t}=e;return af({private_key:sf((async function(e,r){r.result=await t()}))})}}kE=PE,r(PE,"getProviderInstance",(async e=>{const t=new kE({config:{chainConfig:e.chainConfig}});return await t.setupProvider(e.privKey),t})),wE();const IE="Web3Auth-cachedAdapter";class TE extends nf{constructor(e){var t,n,o,a;if(super(),r(this,"coreOptions",void 0),r(this,"connectedAdapterName",null),r(this,"status",bd.NOT_READY),r(this,"cachedAdapter",null),r(this,"walletAdapters",{}),r(this,"commonJRPCProvider",null),r(this,"plugins",{}),r(this,"storage","localStorage"),!e.clientId)throw sd.invalidParams("Please provide a valid clientId in constructor");if(e.enableLogging?vd.enableAll():vd.setLevel("error"),null===(t=e.chainConfig)||void 0===t||!t.chainNamespace||!Object.values(nd).includes(null===(n=e.chainConfig)||void 0===n?void 0:n.chainNamespace))throw sd.invalidParams("Please provide a valid chainNamespace in chainConfig");"session"===e.storageKey&&(this.storage="sessionStorage"),this.cachedAdapter=wd(this.storage)?window[this.storage].getItem(IE):null,this.coreOptions=i(i({},e),{},{chainConfig:i(i({},od(null===(o=e.chainConfig)||void 0===o?void 0:o.chainNamespace,null===(a=e.chainConfig)||void 0===a?void 0:a.chainId)||{}),e.chainConfig)}),this.subscribeToAdapterEvents=this.subscribeToAdapterEvents.bind(this)}get connected(){return Boolean(this.connectedAdapterName)}get provider(){return this.status!==bd.NOT_READY&&this.commonJRPCProvider?this.commonJRPCProvider:null}set provider(e){throw new Error("Not implemented")}async init(){this.commonJRPCProvider=await SE.getProviderInstance({chainConfig:this.coreOptions.chainConfig});const e=Object.keys(this.walletAdapters).map((e=>{if(this.subscribeToAdapterEvents(this.walletAdapters[e]),this.walletAdapters[e].chainConfigProxy)this.walletAdapters[e].setAdapterSettings({sessionTime:this.coreOptions.sessionTime,clientId:this.coreOptions.clientId,web3AuthNetwork:this.coreOptions.web3AuthNetwork,useCoreKitKey:this.coreOptions.useCoreKitKey});else{const t=this.coreOptions.chainConfig;if(!t.chainNamespace)throw sd.invalidParams("Please provide chainNamespace in chainConfig");this.walletAdapters[e].setAdapterSettings({chainConfig:t,sessionTime:this.coreOptions.sessionTime,clientId:this.coreOptions.clientId,web3AuthNetwork:this.coreOptions.web3AuthNetwork,useCoreKitKey:this.coreOptions.useCoreKitKey})}return this.walletAdapters[e].init({autoConnect:this.cachedAdapter===e}).catch((e=>vd.error(e)))}));this.status=bd.READY,await Promise.all(e)}configureAdapter(e){this.checkInitRequirements();const t=this.coreOptions.chainConfig;if(!t.chainNamespace)throw sd.invalidParams("Please provide chainNamespace in chainConfig");if(this.walletAdapters[e.name])throw sd.duplicateAdapterError(`Wallet adapter for ${e.name} already exists`);if(e.adapterNamespace!==id&&e.adapterNamespace!==t.chainNamespace)throw sd.incompatibleChainNameSpace(`This wallet adapter belongs to ${e.adapterNamespace} which is incompatible with currently used namespace: ${t.chainNamespace}`);return e.adapterNamespace===id&&e.currentChainNamespace&&t.chainNamespace!==e.currentChainNamespace&&e.setAdapterSettings({chainConfig:t}),this.walletAdapters[e.name]=e,this}clearCache(){wd(this.storage)&&(window[this.storage].removeItem(IE),this.cachedAdapter=null)}async addChain(e){if(this.status===bd.CONNECTED&&this.connectedAdapterName)return this.walletAdapters[this.connectedAdapterName].addChain(e);if(this.commonJRPCProvider)return this.commonJRPCProvider.addChain(e);throw sd.notReady("No wallet is ready")}async switchChain(e){if(this.status===bd.CONNECTED&&this.connectedAdapterName)return this.walletAdapters[this.connectedAdapterName].switchChain(e);if(this.commonJRPCProvider)return this.commonJRPCProvider.switchChain(e);throw sd.notReady("No wallet is ready")}async connectTo(e,t){if(!this.walletAdapters[e]||!this.commonJRPCProvider)throw sd.notFound(`Please add wallet adapter for ${e} wallet, before connecting`);const r=await this.walletAdapters[e].connect(t);return this.commonJRPCProvider.updateProviderEngineProxy(r.provider||r),this.provider}async logout(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cleanup:!1};if(this.status!==bd.CONNECTED||!this.connectedAdapterName)throw cd.notConnectedError("No wallet is connected");await this.walletAdapters[this.connectedAdapterName].disconnect(e)}async getUserInfo(){if(vd.debug("Getting user info",this.status,this.connectedAdapterName),this.status!==bd.CONNECTED||!this.connectedAdapterName)throw cd.notConnectedError("No wallet is connected");return this.walletAdapters[this.connectedAdapterName].getUserInfo()}async authenticateUser(){if(this.status!==bd.CONNECTED||!this.connectedAdapterName)throw cd.notConnectedError("No wallet is connected");return this.walletAdapters[this.connectedAdapterName].authenticateUser()}async addPlugin(e){if(this.plugins[e.name])throw new Error(`Plugin ${e.name} already exist`);if(e.pluginNamespace!==Ad.MULTICHAIN&&e.pluginNamespace!==this.coreOptions.chainConfig.chainNamespace)throw new Error(`This plugin belongs to ${e.pluginNamespace} namespace which is incompatible with currently used namespace: ${this.coreOptions.chainConfig.chainNamespace}`);return this.plugins[e.name]=e,this}subscribeToAdapterEvents(e){e.on(gd.CONNECTED,(async e=>{if(!this.commonJRPCProvider)throw sd.notFound("CommonJrpcProvider not found");const{provider:t}=this.walletAdapters[e.adapter];this.commonJRPCProvider.updateProviderEngineProxy(t.provider||t),this.status=bd.CONNECTED,this.connectedAdapterName=e.adapter,this.cacheWallet(e.adapter),vd.debug("connected",this.status,this.connectedAdapterName),Object.values(this.plugins).map((async t=>{try{if(!t.SUPPORTED_ADAPTERS.includes(e.adapter))return;await t.initWithWeb3Auth(this),await t.connect()}catch(e){if(5211===e.code)return;vd.error(e)}})),this.emit(gd.CONNECTED,i({},e))})),e.on(gd.DISCONNECTED,(async e=>{if(this.status=bd.READY,wd(this.storage)){const e=window[this.storage].getItem(IE);this.connectedAdapterName===e&&this.clearCache()}vd.debug("disconnected",this.status,this.connectedAdapterName),await Promise.all(Object.values(this.plugins).map((e=>e.disconnect().catch((e=>{5211!==e.code&&vd.error(e)}))))),this.connectedAdapterName=null,this.emit(gd.DISCONNECTED,e)})),e.on(gd.CONNECTING,(e=>{this.status=bd.CONNECTING,this.emit(gd.CONNECTING,e),vd.debug("connecting",this.status,this.connectedAdapterName)})),e.on(gd.ERRORED,(e=>{this.status=bd.ERRORED,this.clearCache(),this.emit(gd.ERRORED,e),vd.debug("errored",this.status,this.connectedAdapterName)})),e.on(gd.ADAPTER_DATA_UPDATED,(e=>{vd.debug("adapter data updated",e),this.emit(gd.ADAPTER_DATA_UPDATED,e)})),e.on(gd.CACHE_CLEAR,(e=>{vd.debug("adapter cache clear",e),wd(this.storage)&&this.clearCache()}))}checkInitRequirements(){if(this.status===bd.CONNECTING)throw sd.notReady("Already pending connection");if(this.status===bd.CONNECTED)throw sd.notReady("Already connected");if(this.status===bd.READY)throw sd.notReady("Adapter is already initialized")}cacheWallet(e){wd(this.storage)&&(window[this.storage].setItem(IE,e),this.cachedAdapter=e)}}const OE=[{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"kernel",type:"address"},{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnerChanged",type:"event"},{inputs:[{internalType:"bytes",name:"",type:"bytes"}],name:"disable",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"ecdsaValidatorStorage",outputs:[{internalType:"address",name:"owner",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"enable",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_caller",type:"address"},{internalType:"bytes",name:"",type:"bytes"}],name:"validCaller",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"hash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"validateSignature",outputs:[{internalType:"ValidationData",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"_userOp",type:"tuple"},{internalType:"bytes32",name:"_userOpHash",type:"bytes32"},{internalType:"uint256",name:"",type:"uint256"}],name:"validateUserOp",outputs:[{internalType:"ValidationData",name:"validationData",type:"uint256"}],stateMutability:"payable",type:"function"}],ME=[{inputs:[{internalType:"contract IEntryPoint",name:"_entryPoint",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AlreadyInitialized",type:"error"},{inputs:[],name:"DisabledMode",type:"error"},{inputs:[],name:"NotAuthorizedCaller",type:"error"},{inputs:[],name:"NotEntryPoint",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldValidator",type:"address"},{indexed:!0,internalType:"address",name:"newValidator",type:"address"}],name:"DefaultValidatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes4",name:"selector",type:"bytes4"},{indexed:!0,internalType:"address",name:"executor",type:"address"},{indexed:!0,internalType:"address",name:"validator",type:"address"}],name:"ExecutionChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Received",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newImplementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[{internalType:"bytes4",name:"_disableFlag",type:"bytes4"}],name:"disableMode",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"entryPoint",outputs:[{internalType:"contract IEntryPoint",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"},{internalType:"enum Operation",name:"",type:"uint8"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct Call[]",name:"calls",type:"tuple[]"}],name:"executeBatch",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"getDefaultValidator",outputs:[{internalType:"contract IKernelValidator",name:"validator",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDisabledMode",outputs:[{internalType:"bytes4",name:"disabled",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"_selector",type:"bytes4"}],name:"getExecution",outputs:[{components:[{internalType:"ValidAfter",name:"validAfter",type:"uint48"},{internalType:"ValidUntil",name:"validUntil",type:"uint48"},{internalType:"address",name:"executor",type:"address"},{internalType:"contract IKernelValidator",name:"validator",type:"address"}],internalType:"struct ExecutionDetail",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastDisabledTime",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint192",name:"key",type:"uint192"}],name:"getNonce",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getNonce",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IKernelValidator",name:"_defaultValidator",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"initialize",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"hash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256[]",name:"",type:"uint256[]"},{internalType:"uint256[]",name:"",type:"uint256[]"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC1155BatchReceived",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC1155Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC721Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"contract IKernelValidator",name:"_defaultValidator",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"setDefaultValidator",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes4",name:"_selector",type:"bytes4"},{internalType:"address",name:"_executor",type:"address"},{internalType:"contract IKernelValidator",name:"_validator",type:"address"},{internalType:"ValidUntil",name:"_validUntil",type:"uint48"},{internalType:"ValidAfter",name:"_validAfter",type:"uint48"},{internalType:"bytes",name:"_enableData",type:"bytes"}],name:"setExecution",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"_userOp",type:"tuple"},{internalType:"bytes32",name:"userOpHash",type:"bytes32"},{internalType:"uint256",name:"missingAccountFunds",type:"uint256"}],name:"validateUserOp",outputs:[{internalType:"ValidationData",name:"validationData",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],CE=[{inputs:[{internalType:"address",name:"_owner",type:"address"},{internalType:"contract IEntryPoint",name:"_entryPoint",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"DeploymentFailed",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"NoHandoverRequest",type:"error"},{inputs:[],name:"SaltDoesNotStartWithCaller",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"proxy",type:"address"},{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Deployed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverCanceled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{inputs:[{internalType:"uint32",name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"cancelOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"completeOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_implementation",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"uint256",name:"_index",type:"uint256"}],name:"createAccount",outputs:[{internalType:"address",name:"proxy",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[],name:"entryPoint",outputs:[{internalType:"contract IEntryPoint",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"uint256",name:"_index",type:"uint256"}],name:"getAccountAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initCodeHash",outputs:[{internalType:"bytes32",name:"result",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isAllowedImplementation",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"ownershipHandoverExpiresAt",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ownershipHandoverValidFor",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"salt",type:"bytes32"}],name:"predictDeterministicAddress",outputs:[{internalType:"address",name:"predicted",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"requestOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"contract IEntryPoint",name:"_entryPoint",type:"address"}],name:"setEntryPoint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_implementation",type:"address"},{internalType:"bool",name:"_allow",type:"bool"}],name:"setImplementation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"}],BE=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"bytes",name:"transactions",type:"bytes"}],name:"multiSend",outputs:[],stateMutability:"payable",type:"function"}],NE=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint8",name:"decimals_",type:"uint8"},{internalType:"uint256",name:"initialBalance_",type:"uint256"},{internalType:"address payable",name:"feeReceiver_",type:"address"}],stateMutability:"payable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"subtractedValue",type:"uint256"}],name:"decreaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"addedValue",type:"uint256"}],name:"increaseAllowance",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}];function RE(e,t={}){const{fees:r=e.fees,formatters:n=e.formatters,serializers:i=e.serializers}=t;return{...e,fees:r,formatters:n,serializers:i}}const FE=RE({id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),LE=RE({id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Arbitrum Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:88114}},testnet:!0});let UE=class e extends Error{constructor(t,r={}){super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"viem@1.21.3"});const n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath;this.message=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: https://viem.sh${i}.html${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join("\n"),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=t}walk(e){return jE(this,e)}};function jE(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e?jE(e.cause,t):t?null:e}let DE=class extends UE{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}},zE=class extends UE{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidHexBooleanError"})}},$E=class extends UE{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}};function HE(e,{strict:t=!0}={}){return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function GE(e){return HE(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function qE(e,{dir:t="left"}={}){let r="string"==typeof e?e.replace("0x",""):e,n=0;for(let e=0;er)throw new VE({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;i2*r)throw new VE({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}const ZE=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function YE(e,t={}){return"number"==typeof e||"bigint"==typeof e?eA(e,t):"string"==typeof e?rA(e,t):"boolean"==typeof e?XE(e,t):QE(e,t)}function XE(e,t={}){const r=`0x${Number(e)}`;return"number"==typeof t.size?(uA(r,{size:t.size}),WE(r,{size:t.size})):r}function QE(e,t={}){let r="";for(let t=0;to||i=oA.zero&&e<=oA.nine?e-oA.zero:e>=oA.A&&e<=oA.F?e-(oA.A-10):e>=oA.a&&e<=oA.f?e-(oA.a-10):void 0}function sA(e,t={}){let r=e;t.size&&(uA(r,{size:t.size}),r=WE(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;et)throw new $E({givenSize:GE(e),maxSize:t})}function lA(e,t){const r="string"==typeof t?{to:t}:t,n=r.to;return"number"===n?hA(e,r):"bigint"===n?fA(e,r):"string"===n?pA(e,r):"boolean"===n?dA(e,r):sA(e,r)}function fA(e,t={}){const{signed:r}=t;t.size&&uA(e,{size:t.size});const n=BigInt(e);if(!r)return n;const i=(e.length-2)/2;return n<=(1n<<8n*BigInt(i)-1n)-1n?n:n-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function dA(e,t={}){let r=e;if(t.size&&(uA(r,{size:t.size}),r=qE(r)),"0x00"===qE(r))return!1;if("0x01"===qE(r))return!0;throw new zE(r)}function hA(e,t={}){return Number(fA(e,t))}function pA(e,t={}){let r=sA(e);return t.size&&(uA(r,{size:t.size}),r=qE(r,{dir:"right"})),(new TextDecoder).decode(r)}const mA={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559"};function bA(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?hA(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?hA(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?mA[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"==typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t}function gA(e){const t=e.transactions?.map((e=>"string"==typeof e?e:bA(e)));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,difficulty:e.difficulty?BigInt(e.difficulty):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}function yA(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}const vA={"0x0":"reverted","0x1":"success"};function wA(e){return{...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((e=>yA(e))):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?hA(e.transactionIndex):null,status:e.status?vA[e.status]:null,type:e.type?mA[e.type]||e.type:null}}const EA={legacy:"0x0",eip2930:"0x1",eip1559:"0x2"};function AA(e){return{...e,gas:void 0!==e.gas?eA(e.gas):void 0,gasPrice:void 0!==e.gasPrice?eA(e.gasPrice):void 0,maxFeePerGas:void 0!==e.maxFeePerGas?eA(e.maxFeePerGas):void 0,maxPriorityFeePerGas:void 0!==e.maxPriorityFeePerGas?eA(e.maxPriorityFeePerGas):void 0,nonce:void 0!==e.nonce?eA(e.nonce):void 0,type:void 0!==e.type?EA[e.type]:void 0,value:void 0!==e.value?eA(e.value):void 0}}let xA=class extends UE{constructor({address:e}){super(`Address "${e}" is invalid.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}},_A=class extends UE{constructor({blockNumber:e,chain:t,contract:r}){super(`Chain "${t.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"})}};class kA extends UE{constructor({chain:e,currentChainId:t}){super(`The current chain of the wallet (id: ${t}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e.id} – ${e.name}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainMismatchError"})}}class SA extends UE{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotFoundError"})}}let PA=class extends UE{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}};const IA={gwei:9,wei:18},TA={ether:-9,wei:9};function OA(e,t){let r=e.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[i,o]=[r.slice(0,r.length-t),r.slice(r.length-t)];return o=o.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${o?`.${o}`:""}`}function MA(e,t="wei"){return OA(e,TA[t])}let CA=class extends UE{constructor({cause:e,message:t}={}){const r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}};Object.defineProperty(CA,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(CA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});let BA=class extends UE{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${MA(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}};Object.defineProperty(BA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});let NA=class extends UE{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${MA(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}};Object.defineProperty(NA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});let RA=class extends UE{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}};Object.defineProperty(RA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});let FA=class extends UE{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}};Object.defineProperty(FA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});let LA=class extends UE{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}};Object.defineProperty(LA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});let UA=class extends UE{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}};Object.defineProperty(UA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});let jA=class extends UE{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}};Object.defineProperty(jA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});let DA=class extends UE{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}};Object.defineProperty(DA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});let zA=class extends UE{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}};Object.defineProperty(zA,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});let $A=class extends UE{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${MA(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${MA(r)} gwei`:""}).`].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}};Object.defineProperty($A,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});let HA=class extends UE{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"})}};const GA=/^0x[a-fA-F0-9]{40}$/;function qA(e){return GA.test(e)}function KA(e){return"string"==typeof e[0]?VA(e):function(e){let t=0;for(const r of e)t+=r.length;const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(e)}function VA(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}let WA=class e extends Error{constructor(t,r={}){const n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath;super([t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...n?[`Details: ${n}`]:[],"Version: abitype@0.9.8"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=t}};function JA(e,t){const r=e.exec(t);return r?.groups}const ZA=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,YA=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,XA=/^\(.+?\).*?$/,QA=/^tuple(?(\[(\d*)\])*)$/;function ex(e){let t=e.type;if(QA.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let n=0;n[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function nx(e){return rx.test(e)}function ix(e){return JA(rx,e)}const ox=new Set(["memory","indexed","storage","calldata"]),ax=new Set(["calldata","memory","storage"]);let sx=class extends WA{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}},cx=class extends WA{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}},ux=class extends WA{constructor({params:e}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(e,null,2)})`,docsPath:"/api/human.html#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}},lx=class extends WA{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},fx=class extends WA{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}},dx=class extends WA{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},hx=class extends WA{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}},px=class extends WA{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}},mx=class extends WA{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},bx=class extends WA{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}},gx=class extends WA{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}},yx=class extends WA{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}};const vx=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]),wx=/^(?[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Ex=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Ax=/^u?int$/;function xx(e,t){const r=function(e,t){return t?`${t}:${e}`:e}(e,t?.type);if(vx.has(r))return vx.get(r);const n=XA.test(e),i=JA(n?Ex:wx,e);if(!i)throw new lx({param:e});if(i.name&&function(e){return"address"===e||"bool"===e||"function"===e||"string"===e||"tuple"===e||ZA.test(e)||YA.test(e)||Sx.test(e)}(i.name))throw new fx({param:e,name:i.name});const o=i.name?{name:i.name}:{},a="indexed"===i.modifier?{indexed:!0}:{},s=t?.structs??{};let c,u={};if(n){c="tuple";const e=_x(i.type),t=[],r=e.length;for(let n=0;n[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function Ix(e,t,r=new Set){const n=[],i=e.length;for(let o=0;oe[t.name||r]?.(n)??t(e,n)}function Mx(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new Qx(e.type);return`${e.name}(${Cx(e.inputs,{includeName:t})})`}function Cx(e,{includeName:t=!1}={}){return e?e.map((e=>function(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${Cx(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}(e,{includeName:t}))).join(t?", ":","):""}let Bx=class extends UE{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"})}},Nx=class extends UE{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"})}},Rx=class extends UE{constructor({data:e,params:t,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join("\n"),{metaMessages:[`Params: (${Cx(t,{includeName:!0})})`,`Data: ${e} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=r}},Fx=class extends UE{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}},Lx=class extends UE{constructor({expectedLength:e,givenLength:t,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}},Ux=class extends UE{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${GE(t)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}},jx=class extends UE{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}},Dx=class extends UE{constructor(e,{docsPath:t}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}},zx=class extends UE{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureEmptyTopicsError"})}},$x=class extends UE{constructor(e,{docsPath:t}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"})}},Hx=class extends UE{constructor(e,{docsPath:t}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"})}},Gx=class extends UE{constructor(e,{docsPath:t}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}},qx=class extends UE{constructor(e,{docsPath:t}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"})}},Kx=class extends UE{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Mx(e.abiItem)}\`, and`,`\`${t.type}\` in \`${Mx(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}},Vx=class extends UE{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}},Wx=class extends UE{constructor({abiItem:e,data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for non-indexed event parameters.`].join("\n"),{metaMessages:[`Params: (${Cx(r,{includeName:!0})})`,`Data: ${t} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=r,this.size=n}},Jx=class extends UE{constructor({abiItem:e,param:t}){super([`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${Mx(e,{includeName:!0})}".`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}},Zx=class extends UE{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}},Yx=class extends UE{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"})}},Xx=class extends UE{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}},Qx=class extends UE{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}},e_=class extends UE{constructor(e){super(`Filter type "${e}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}};const t_=e=>{var t;return function(e){let t=!0,r="",n=0,i="",o=!1;for(let a=0;a0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function i_(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}const o_=BigInt(2**32-1),a_=BigInt(32);function s_(e,t=!1){return t?{h:Number(e&o_),l:Number(e>>a_&o_)}:{h:0|Number(e>>a_&o_),l:0|Number(e&o_)}}function c_(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;ie instanceof Uint8Array;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function l_(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!u_(e))throw new Error("expected Uint8Array, got "+typeof e);return e}let f_=class{clone(){return this._cloneInto()}};const[d_,h_,p_]=[[],[],[]],m_=BigInt(0),b_=BigInt(1),g_=BigInt(2),y_=BigInt(7),v_=BigInt(256),w_=BigInt(113);for(let e=0,t=b_,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],d_.push(2*(5*n+r)),h_.push((e+1)*(e+2)/2%64);let i=m_;for(let e=0;e<7;e++)t=(t<>y_)*w_)%v_,t&g_&&(i^=b_<<(b_<r>32?((e,t,r)=>t<>>64-r)(e,t,r):((e,t,r)=>e<>>32-r)(e,t,r),__=(e,t,r)=>r>32?((e,t,r)=>e<>>64-r) /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */(e,t,r):((e,t,r)=>t<>>32-r)(e,t,r);let k_=class e extends f_{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,r_(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)))(this.state)}keccak(){!function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=x_(o,a,1)^r[n],c=__(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=h_[r],o=x_(t,i,n),a=__(t,i,n),s=d_[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=E_[n],e[1]^=A_[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){i_(this);const{blockLen:t,state:r}=this,n=(e=l_(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return r_(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(function(e,t){n_(e);const r=t.outputLen;if(e.lengthfunction(e){const t=t=>e().update(l_(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}((()=>new k_(t,e,r))),P_=S_(1,136,32);function I_(e,t){const r=t||"hex",n=P_(HE(e,{strict:!1})?iA(e):e);return"bytes"===r?n:YE(n)}const T_=e=>(e=>I_(iA(e)))((e=>t_(e))(e));function O_(e,t,r,{strict:n}={}){return HE(e,{strict:!1})?function(e,t,r,{strict:n}={}){M_(e,t);const i=`0x${e.replace("0x","").slice(2*(t??0),2*(r??e.length))}`;n&&C_(i,t,r);return i}(e,t,r,{strict:n}):function(e,t,r,{strict:n}={}){M_(e,t);const i=e.slice(t,r);n&&C_(i,t,r);return i}(e,t,r,{strict:n})}function M_(e,t){if("number"==typeof t&&t>0&&t>GE(e)-1)throw new KE({offset:t,position:"start",size:GE(e)})}function C_(e,t,r){if("number"==typeof t&&"number"==typeof r&&GE(e)!==r-t)throw new KE({offset:r,position:"end",size:GE(e)})}function B_(e,t){if(e.length!==t.length)throw new jx({expectedLength:e.length,givenLength:t.length});const r=function({params:e,values:t}){const r=[];for(let n=0;n0?KA([t,e]):t}}if(i)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:KA(o.map((({encoded:e})=>e)))}}(t,{length:n,param:{...e,type:i}})}if("tuple"===e.type)return function(e,{param:t}){let r=!1;const n=[];for(let i=0;ie)))}}(t,{param:e});if("address"===e.type)return function(e){if(!qA(e))throw new xA({address:e});return{dynamic:!1,encoded:JE(e.toLowerCase())}}(t);if("bool"===e.type)return function(e){return{dynamic:!1,encoded:JE(XE(e))}}(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){return function(e,{signed:t}){return{dynamic:!1,encoded:eA(e,{size:32,signed:t})}}(t,{signed:e.type.startsWith("int")})}if(e.type.startsWith("bytes"))return function(e,{param:t}){const[,r]=t.type.split("bytes"),n=GE(e);if(!r){let t=e;return n%32!=0&&(t=JE(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:KA([JE(eA(n,{size:32})),t])}}if(n!==parseInt(r))throw new Ux({expectedSize:parseInt(r),value:e});return{dynamic:!1,encoded:JE(e,{dir:"right"})}}(t,{param:e});if("string"===e.type)return function(e){const t=rA(e),r=Math.ceil(GE(t)/32),n=[];for(let e=0;eO_((e=>I_(iA(e)))(t_(e)),0,4);function U_({abi:e,args:t=[],name:r}){const n=HE(r,{strict:!1}),i=e.filter((e=>n?"function"===e.type?L_(e)===r:"event"===e.type&&T_(e)===r:"name"in e&&e.name===r));if(0===i.length)return;if(1===i.length)return i[0];let o;for(const e of i){if(!("inputs"in e))continue;if(!t||0===t.length){if(!e.inputs||0===e.inputs.length)return e;continue}if(!e.inputs)continue;if(0===e.inputs.length)continue;if(e.inputs.length!==t.length)continue;const r=t.every(((t,r)=>{const n="inputs"in e&&e.inputs[r];return!!n&&j_(t,n)}));if(r){if(o&&"inputs"in o&&o.inputs){const r=D_(e.inputs,o.inputs,t);if(r)throw new Kx({abiItem:e,type:r[0]},{abiItem:o,type:r[1]})}o=e}}return o||i[0]}function j_(e,t){const r=typeof e,n=t.type;switch(n){case"address":return qA(e);case"bool":return"boolean"===r;case"function":case"string":return"string"===r;default:return"tuple"===n&&"components"in t?Object.values(t.components).every(((t,r)=>j_(Object.values(e)[r],t))):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?"number"===r||"bigint"===r:/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?"string"===r||e instanceof Uint8Array:!!/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)&&(Array.isArray(e)&&e.every((e=>j_(e,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")}))))}}function D_(e,t,r){for(const n in e){const i=e[n],o=t[n];if("tuple"===i.type&&"tuple"===o.type&&"components"in i&&"components"in o)return D_(i.components,o.components,r[n]);const a=[i.type,o.type];if(!(!a.includes("address")||!a.includes("bytes20"))||(a.includes("address")&&a.includes("string")||!(!a.includes("address")||!a.includes("bytes")))&&qA(r[n]))return a}}function z_({abi:e,eventName:t,args:r}){let n=e[0];if(t&&(n=U_({abi:e,args:r,name:t}),!n))throw new Hx(t,{docsPath:"/docs/contract/encodeEventTopics"});if("event"!==n.type)throw new Hx(void 0,{docsPath:"/docs/contract/encodeEventTopics"});const i=Mx(n),o=T_(i);let a=[];if(r&&"inputs"in n){const e=n.inputs?.filter((e=>"indexed"in e&&e.indexed)),t=Array.isArray(r)?r:Object.values(r).length>0?e?.map((e=>r[e.name]))??[]:[];t.length>0&&(a=e?.map(((e,r)=>Array.isArray(t[r])?t[r].map(((n,i)=>$_({param:e,value:t[r][i]}))):t[r]?$_({param:e,value:t[r]}):null))??[])}return[o,...a]}function $_({param:e,value:t}){if("string"===e.type||"bytes"===e.type)return I_(iA(t));if("tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))throw new e_(e.type);return B_([e],[t])}function H_(e,{method:t}){const r={};return"fallback"===e.transport.type&&e.transport.onResponse?.((({method:e,response:n,status:i,transport:o})=>{"success"===i&&t===e&&(r[n]=o.request)})),t=>r[t]||e.request}async function G_(e,{address:t,abi:r,args:n,eventName:i,fromBlock:o,strict:a,toBlock:s}){const c=H_(e,{method:"eth_newFilter"}),u=i?z_({abi:r,args:n,eventName:i}):void 0,l=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof o?eA(o):o,toBlock:"bigint"==typeof s?eA(s):s,topics:u}]});return{abi:r,args:n,eventName:i,id:l,request:c(l),strict:a,type:"event"}}function q_(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}function K_({abi:e,args:t,functionName:r}){let n=e[0];if(r&&(n=U_({abi:e,args:t,name:r}),!n))throw new Gx(r,{docsPath:"/docs/contract/encodeFunctionData"});if("function"!==n.type)throw new Gx(void 0,{docsPath:"/docs/contract/encodeFunctionData"});const i=Mx(n);return VA([L_(i),("inputs"in n&&n.inputs?B_(n.inputs,t??[]):void 0)??"0x"])}const V_={1:"An `assert` condition failed.",17:"Arithmic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},W_={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},J_={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function Z_(e,t){const r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=I_(cA(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());return`0x${i.join("")}`}function Y_(e,t){if("0x"===t&&e.length>0)throw new Fx;if(GE(t)&&GE(t)<32)throw new Rx({data:t,params:e,size:GE(t)});return function({data:e,params:t}){const r=[];let n=0;for(let i=0;i=GE(e))throw new Rx({data:e,params:t,size:GE(e)});const o=t[i],{consumed:a,value:s}=X_({data:e,param:o,position:n});r.push(s),n+=a}return r}({data:t,params:e})}function X_({data:e,param:t,position:r}){const n=F_(t.type);if(n){const[i,o]=n;return function(e,{param:t,length:r,position:n}){if(!r){const r=hA(O_(e,n,n+32,{strict:!0})),i=hA(O_(e,r,r+32,{strict:!0}));let o=0;const a=[];for(let n=0;n!e)),i=n?[]:{};let o=0;if(Q_(t)){const a=hA(O_(e,r,r+32,{strict:!0}));for(let r=0;r48?fA(e,{signed:r}):hA(e,{signed:r})}}(i,{param:t});if("address"===t.type)return function(e){return{consumed:32,value:Z_(O_(e,-20))}}(i);if("bool"===t.type)return function(e){return{consumed:32,value:dA(e)}}(i);throw new Yx(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}function Q_(e){const{type:t}=e;if("string"===t)return!0;if("bytes"===t)return!0;if(t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some(Q_);const r=F_(e.type);return!(!r||!Q_({...e,type:r[1]}))}function ek({abi:e,data:t}){const r=O_(t,0,4);if("0x"===r)throw new Fx;const n=[...e||[],W_,J_].find((e=>"error"===e.type&&r===L_(Mx(e))));if(!n)throw new Dx(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:n,args:"inputs"in n&&n.inputs&&n.inputs.length>0?Y_(n.inputs,O_(t,4)):void 0,errorName:n.name}}const tk=(e,t,r)=>JSON.stringify(e,((e,r)=>{const n="bigint"==typeof r?r.toString():r;return"function"==typeof t?t(e,n):n}),r);function rk({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map(((e,r)=>`${n&&e.name?`${e.name}: `:""}${"object"==typeof t[r]?tk(t[r]):t[r]}`)).join(", ")})`}function nk(e,t="wei"){return OA(e,IA[t])}function ik(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),r=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(r+1)} ${t}`)).join("\n")}let ok=class extends UE{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"})}},ak=class extends UE{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",ik(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}};class sk extends UE{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=ik({chain:n&&`${n?.name} (id: ${n?.id})`,from:t?.address,to:l,value:void 0!==f&&`${nk(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${MA(a)} gwei`,maxFeePerGas:void 0!==s&&`${MA(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${MA(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",d].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionExecutionError"}),this.cause=e}}let ck=class extends UE{constructor({blockHash:e,blockNumber:t,blockTag:r,hash:n,index:i}){let o="Transaction";r&&void 0!==i&&(o=`Transaction at block time "${r}" at index "${i}"`),e&&void 0!==i&&(o=`Transaction at block hash "${e}" at index "${i}"`),t&&void 0!==i&&(o=`Transaction at block number "${t}" at index "${i}"`),n&&(o=`Transaction with hash "${n}"`),super(`${o} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"})}},uk=class extends UE{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionReceiptNotFoundError"})}},lk=class extends UE{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WaitForTransactionReceiptTimeoutError"})}},fk=class extends UE{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=t?q_(t):void 0,h=ik({from:d?.address,to:l,value:void 0!==f&&`${nk(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${MA(a)} gwei`,maxFeePerGas:void 0!==s&&`${MA(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${MA(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",h].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CallExecutionError"}),this.cause=e}},dk=class extends UE{constructor(e,{abi:t,args:r,contractAddress:n,docsPath:i,functionName:o,sender:a}){const s=U_({abi:t,args:r,name:o}),c=s?rk({abiItem:s,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=ik({address:n&&n,function:s?Mx(s,{includeName:!0}):void 0,args:c&&"()"!==c&&`${[...Array(o?.length??0).keys()].map((()=>" ")).join("")}${c}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Contract Call:",u].filter(Boolean)}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionExecutionError"}),this.abi=t,this.args=r,this.cause=e,this.contractAddress=n,this.functionName=o,this.sender=a}},hk=class extends UE{constructor({abi:e,data:t,functionName:r,message:n}){let i,o,a,s,c;if(t&&"0x"!==t)try{o=ek({abi:e,data:t});const{abiItem:r,errorName:n,args:i}=o;if("Error"===n)s=i[0];else if("Panic"===n){const[e]=i;s=V_[e]}else{const e=r?Mx(r,{includeName:!0}):void 0,t=r&&i?rk({abiItem:r,args:i,includeFunctionName:!1,includeName:!1}):void 0;a=[e?`Error: ${e}`:"",t&&"()"!==t?` ${[...Array(n?.length??0).keys()].map((()=>" ")).join("")}${t}`:""]}}catch(e){i=e}else n&&(s=n);i instanceof Dx&&(c=i.signature,a=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(s&&"execution reverted"!==s||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,s||c].join("\n"):`The contract function "${r}" reverted.`,{cause:i,metaMessages:a}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=s,this.signature=c}},pk=class extends UE{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionZeroDataError"})}},mk=class extends UE{constructor({data:e,message:t}){super(t||""),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RawContractError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}},bk=class extends UE{constructor({body:e,details:t,headers:r,status:n,url:i}){super("HTTP request failed.",{details:t,metaMessages:[n&&`Status: ${n}`,`URL: ${i}`,e&&`Request body: ${tk(e)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=r,this.status=n,this.url=i}},gk=class extends UE{constructor({body:e,details:t,url:r}){super("WebSocket request failed.",{details:t,metaMessages:[`URL: ${r}`,`Request body: ${tk(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WebSocketRequestError"})}},yk=class extends UE{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${r}`,`Request body: ${tk(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}},vk=class extends UE{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${t}`,`Request body: ${tk(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}};let wk=class extends UE{constructor(e,{code:t,docsPath:r,metaMessages:n,shortMessage:i}){super(i,{cause:e,docsPath:r,metaMessages:n||e?.metaMessages}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.code=e instanceof yk?e.code:t??-1}},Ek=class extends wk{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}},Ak=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"})}};Object.defineProperty(Ak,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});let xk=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}};Object.defineProperty(xk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});let _k=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}};Object.defineProperty(_k,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});let kk=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}};Object.defineProperty(kk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});let Sk=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}};Object.defineProperty(Sk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});let Pk=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}};Object.defineProperty(Pk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});let Ik=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}};Object.defineProperty(Ik,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});let Tk=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}};Object.defineProperty(Tk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});let Ok=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}};Object.defineProperty(Ok,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});let Mk=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}};Object.defineProperty(Mk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});let Ck=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}};Object.defineProperty(Ck,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});let Bk=class e extends wk{constructor(t){super(t,{code:e.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}};Object.defineProperty(Bk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});let Nk=class e extends Ek{constructor(t){super(t,{code:e.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}};Object.defineProperty(Nk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});let Rk=class e extends Ek{constructor(t){super(t,{code:e.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"})}};Object.defineProperty(Rk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});let Fk=class e extends Ek{constructor(t){super(t,{code:e.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}};Object.defineProperty(Fk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});let Lk=class e extends Ek{constructor(t){super(t,{code:e.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}};Object.defineProperty(Lk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});let Uk=class e extends Ek{constructor(t){super(t,{code:e.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"})}};Object.defineProperty(Uk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});let jk=class e extends Ek{constructor(t){super(t,{code:e.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}};Object.defineProperty(jk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});let Dk=class extends wk{constructor(e){super(e,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}};const zk=3;function $k(e,{abi:t,address:r,args:n,docsPath:i,functionName:o,sender:a}){const{code:s,data:c,message:u,shortMessage:l}=e instanceof mk?e:e instanceof UE?e.walk((e=>"data"in e))||e.walk():{},f=e instanceof Fx?new pk({functionName:o}):[zk,Sk.code].includes(s)&&(c||u||l)?new hk({abi:t,data:"object"==typeof c?c.data:c,functionName:o,message:l??u}):e;return new dk(f,{abi:t,args:n,contractAddress:r,docsPath:i,functionName:o,sender:a})}let Hk=class extends UE{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join("\n"),{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}},Gk=class extends UE{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=ik({from:t?.address,to:l,value:void 0!==f&&`${nk(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${MA(a)} gwei`,maxFeePerGas:void 0!==s&&`${MA(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${MA(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}};function qk(e,t){const r=(e.details||"").toLowerCase(),n=e.walk((e=>e.code===CA.code));return n instanceof UE?new CA({cause:e,message:n.details}):CA.nodeMessage.test(r)?new CA({cause:e,message:e.details}):BA.nodeMessage.test(r)?new BA({cause:e,maxFeePerGas:t?.maxFeePerGas}):NA.nodeMessage.test(r)?new NA({cause:e,maxFeePerGas:t?.maxFeePerGas}):RA.nodeMessage.test(r)?new RA({cause:e,nonce:t?.nonce}):FA.nodeMessage.test(r)?new FA({cause:e,nonce:t?.nonce}):LA.nodeMessage.test(r)?new LA({cause:e,nonce:t?.nonce}):UA.nodeMessage.test(r)?new UA({cause:e}):jA.nodeMessage.test(r)?new jA({cause:e,gas:t?.gas}):DA.nodeMessage.test(r)?new DA({cause:e,gas:t?.gas}):zA.nodeMessage.test(r)?new zA({cause:e}):$A.nodeMessage.test(r)?new $A({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new HA({cause:e})}function Kk(e,{format:t}){if(!t)return{};const r={};return function t(n){const i=Object.keys(n);for(const o of i)o in e&&(r[o]=e[o]),n[o]&&"object"==typeof n[o]&&!Array.isArray(n[o])&&t(n[o])}(t(e||{})),r}function Vk(e){const{account:t,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:o}=e,a=t?q_(t):void 0;if(a&&!qA(a.address))throw new xA({address:a.address});if(o&&!qA(o))throw new xA({address:o});if(void 0!==r&&(void 0!==n||void 0!==i))throw new ok;if(n&&n>2n**256n-1n)throw new BA({maxFeePerGas:n});if(i&&n&&i>n)throw new $A({maxFeePerGas:n,maxPriorityFeePerGas:i})}let Wk=class extends UE{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}},Jk=class extends UE{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}},Zk=class extends UE{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${MA(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}},Yk=class extends UE{constructor({blockHash:e,blockNumber:t}){let r="Block";e&&(r=`Block at hash "${e}"`),t&&(r=`Block at number "${t}"`),super(`${r} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}};async function Xk(e,{blockHash:t,blockNumber:r,blockTag:n,includeTransactions:i}={}){const o=n??"latest",a=i??!1,s=void 0!==r?eA(r):void 0;let c=null;if(c=t?await e.request({method:"eth_getBlockByHash",params:[t,a]}):await e.request({method:"eth_getBlockByNumber",params:[s||o,a]}),!c)throw new Yk({blockHash:t,blockNumber:r});return(e.chain?.formatters?.block?.format||gA)(c)}async function Qk(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function eS(e,t){const{block:r,chain:n=e.chain,request:i}=t||{};if("function"==typeof n?.fees?.defaultPriorityFee){const t=r||await Ox(e,Xk,"getBlock")({});return n.fees.defaultPriorityFee({block:t,client:e,request:i})}if(void 0!==n?.fees?.defaultPriorityFee)return n?.fees?.defaultPriorityFee;try{return fA(await e.request({method:"eth_maxPriorityFeePerGas"}))}catch{const[t,n]=await Promise.all([r?Promise.resolve(r):Ox(e,Xk,"getBlock")({}),Ox(e,Qk,"getGasPrice")({})]);if("bigint"!=typeof t.baseFeePerGas)throw new Jk;const i=n-t.baseFeePerGas;return i<0n?0n:i}}async function tS(e,t){const{block:r,chain:n=e.chain,request:i,type:o="eip1559"}=t||{},a=await(async()=>"function"==typeof n?.fees?.baseFeeMultiplier?n.fees.baseFeeMultiplier({block:r,client:e,request:i}):n?.fees?.baseFeeMultiplier??1.2)();if(a<1)throw new Wk;const s=10**(a.toString().split(".")[1]?.length??0),c=e=>e*BigInt(Math.ceil(a*s))/BigInt(s),u=r||await Ox(e,Xk,"getBlock")({});if("function"==typeof n?.fees?.estimateFeesPerGas)return n.fees.estimateFeesPerGas({block:r,client:e,multiply:c,request:i,type:o});if("eip1559"===o){if("bigint"!=typeof u.baseFeePerGas)throw new Jk;const t=i?.maxPriorityFeePerGas?i.maxPriorityFeePerGas:await eS(e,{block:u,chain:n,request:i}),r=c(u.baseFeePerGas);return{maxFeePerGas:i?.maxFeePerGas??r+t,maxPriorityFeePerGas:t}}return{gasPrice:i?.gasPrice??c(await Ox(e,Qk,"getGasPrice")({}))}}async function rS(e,{address:t,blockTag:r="latest",blockNumber:n}){return hA(await e.request({method:"eth_getTransactionCount",params:[t,n?eA(n):r]}))}async function nS(e,t){const{account:r=e.account,chain:n,gas:i,nonce:o,type:a}=t;if(!r)throw new Hk;const s=q_(r),c=await Ox(e,Xk,"getBlock")({blockTag:"latest"}),u={...t,from:s.address};if(void 0===o&&(u.nonce=await Ox(e,rS,"getTransactionCount")({address:s.address,blockTag:"pending"})),void 0===a)try{u.type=function(e){if(e.type)return e.type;if(void 0!==e.maxFeePerGas||void 0!==e.maxPriorityFeePerGas)return"eip1559";if(void 0!==e.gasPrice)return void 0!==e.accessList?"eip2930":"legacy";throw new ak({transaction:e})}(u)}catch{u.type="bigint"==typeof c.baseFeePerGas?"eip1559":"legacy"}if("eip1559"===u.type){const{maxFeePerGas:r,maxPriorityFeePerGas:i}=await tS(e,{block:c,chain:n,request:u});if(void 0===t.maxPriorityFeePerGas&&t.maxFeePerGas&&t.maxFeePerGas{const t=qk(e,r);return t instanceof HA?e:t})();return new Gk(n,{docsPath:t,...r})}(r,{...t,account:n,chain:e.chain})}}async function oS(e,{abi:t,address:r,args:n,functionName:i,...o}){const a=K_({abi:t,args:n,functionName:i});try{return await Ox(e,iS,"estimateGas")({data:a,to:r,...o})}catch(e){const a=o.account?q_(o.account):void 0;throw $k(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:a?.address})}}const aS="/docs/contract/decodeEventLog";function sS({abi:e,data:t,strict:r,topics:n}){const i=r??!0,[o,...a]=n;if(!o)throw new zx({docsPath:aS});const s=e.find((e=>"event"===e.type&&o===T_(Mx(e))));if(!s||!("name"in s)||"event"!==s.type)throw new $x(o,{docsPath:aS});const{name:c,inputs:u}=s,l=u?.some((e=>!("name"in e&&e.name)));let f=l?[]:{};const d=u.filter((e=>"indexed"in e&&e.indexed));for(let e=0;e!("indexed"in e&&e.indexed)));if(h.length>0)if(t&&"0x"!==t)try{const e=Y_(h,t);if(e)if(l)f=[...f,...e];else for(let t=0;t0?f:void 0}}function cS({param:e,value:t}){if("string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))return t;return(Y_([e],t)||[])[0]}async function uS(e,{address:t,blockHash:r,fromBlock:n,toBlock:i,event:o,events:a,args:s,strict:c}={}){const u=c??!1,l=a??(o?[o]:void 0);let f,d=[];return l&&(d=[l.flatMap((e=>z_({abi:[e],eventName:e.name,args:s})))],o&&(d=d[0])),f=r?await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:r}]}):await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:"bigint"==typeof n?eA(n):n,toBlock:"bigint"==typeof i?eA(i):i}]}),f.map((e=>{try{const{eventName:t,args:r}=l?sS({abi:l,data:e.data,topics:e.topics,strict:u}):{eventName:void 0,args:void 0};return yA(e,{args:r,eventName:t})}catch(t){let r,n;if(t instanceof Wx||t instanceof Jx){if(u)return;r=t.abiItem.name,n=t.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return yA(e,{args:n?[]:{},eventName:r})}})).filter(Boolean)}async function lS(e,{abi:t,address:r,args:n,blockHash:i,eventName:o,fromBlock:a,toBlock:s,strict:c}){const u=o?U_({abi:t,name:o}):void 0,l=u?void 0:t.filter((e=>"event"===e.type));return Ox(e,uS,"getLogs")({address:r,args:n,blockHash:i,event:u,events:l,fromBlock:a,toBlock:s,strict:c})}const fS="/docs/contract/decodeFunctionResult";function dS({abi:e,args:t,functionName:r,data:n}){let i=e[0];if(r&&(i=U_({abi:e,args:t,name:r}),!i))throw new Gx(r,{docsPath:fS});if("function"!==i.type)throw new Gx(void 0,{docsPath:fS});if(!i.outputs)throw new qx(i.name,{docsPath:fS});const o=Y_(i.outputs,n);return o&&o.length>1?o:o&&1===o.length?o[0]:void 0}const hS=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],pS=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],mS=[...pS,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],bS=[...pS,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],gS=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],yS=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],vS=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],wS="0x82ad56cb";function ES({blockNumber:e,chain:t,contract:r}){const n=t?.contracts?.[r];if(!n)throw new _A({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new _A({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}const AS=new Map;function xS({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:i}){const o=async()=>{const t=s();a();const r=t.map((({args:e})=>e));0!==r.length&&e(r).then((e=>{i&&Array.isArray(e)&&e.sort(i);for(let r=0;r{for(let r=0;rAS.delete(t),s=()=>AS.get(t)||[],c=e=>AS.set(t,[...s(),e]);return{flush:a,async schedule(e){const t={},i=new Promise(((e,r)=>{t.resolve=e,t.reject=r})),a=r?.([...s().map((({args:e})=>e)),e]);a&&o();return s().length>0?(c({args:e,pendingPromise:t}),i):(c({args:e,pendingPromise:t}),setTimeout(o,n),i)}}}async function _S(e,t){const{account:r=e.account,batch:n=Boolean(e.batch?.multicall),blockNumber:i,blockTag:o="latest",accessList:a,data:s,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:d,to:h,value:p,...m}=t,b=r?q_(r):void 0;try{Vk(t);const r=(i?eA(i):void 0)||o,g=e.chain?.formatters?.transactionRequest?.format,y=(g||AA)({...Kk(m,{format:g}),from:b?.address,accessList:a,data:s,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:d,to:h,value:p});if(n&&function({request:e}){const{data:t,to:r,...n}=e;return!!t&&(!t.startsWith(wS)&&(!!r&&!(Object.values(n).filter((e=>void 0!==e)).length>0)))}({request:y}))try{return await async function(e,t){const{batchSize:r=1024,wait:n=0}="object"==typeof e.batch?.multicall?e.batch.multicall:{},{blockNumber:i,blockTag:o="latest",data:a,multicallAddress:s,to:c}=t;let u=s;if(!u){if(!e.chain)throw new PA;u=ES({blockNumber:i,chain:e.chain,contract:"multicall3"})}const l=i?eA(i):void 0,f=l||o,{schedule:d}=xS({id:`${e.uid}.${f}`,wait:n,shouldSplitBatch(e){const t=e.reduce(((e,{data:t})=>e+(t.length-2)),0);return t>2*r},fn:async t=>{const r=t.map((e=>({allowFailure:!0,callData:e.data,target:e.to}))),n=K_({abi:hS,args:[r],functionName:"aggregate3"}),i=await e.request({method:"eth_call",params:[{data:n,to:u},f]});return dS({abi:hS,args:[r],functionName:"aggregate3",data:i||"0x"})}}),[{returnData:h,success:p}]=await d({data:a,to:c});if(!p)throw new mk({data:h});return"0x"===h?{data:void 0}:{data:h}}(e,{...y,blockNumber:i,blockTag:o})}catch(e){if(!(e instanceof PA||e instanceof _A))throw e}const v=await e.request({method:"eth_call",params:r?[y,r]:[y]});return"0x"===v?{data:void 0}:{data:v}}catch(r){const n=function(e){if(!(e instanceof UE))return;const t=e.walk();return"object"==typeof t.data?t.data.data:t.data}(r),{offchainLookup:i,offchainLookupSignature:o}=await Promise.resolve().then((function(){return BP}));if(n?.slice(0,10)===o&&h)return{data:await i(e,{data:n,to:h})};throw function(e,{docsPath:t,...r}){const n=(()=>{const t=qk(e,r);return t instanceof HA?e:t})();return new fk(n,{docsPath:t,...r})}(r,{...t,account:b,chain:e.chain})}}async function kS(e,{abi:t,address:r,args:n,functionName:i,...o}){const a=K_({abi:t,args:n,functionName:i});try{const{data:s}=await Ox(e,_S,"call")({data:a,to:r,...o});return dS({abi:t,args:n,functionName:i,data:s||"0x"})}catch(e){throw $k(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/readContract",functionName:i})}}async function SS(e,{abi:t,address:r,args:n,dataSuffix:i,functionName:o,...a}){const s=a.account?q_(a.account):void 0,c=K_({abi:t,args:n,functionName:o});try{const{data:s}=await Ox(e,_S,"call")({batch:!1,data:`${c}${i?i.replace("0x",""):""}`,to:r,...a});return{result:dS({abi:t,args:n,functionName:o,data:s||"0x"}),request:{abi:t,address:r,args:n,dataSuffix:i,functionName:o,...a}}}catch(e){throw $k(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/simulateContract",functionName:o,sender:s?.address})}}const PS=new Map,IS=new Map;let TS=0;function OS(e,t,r){const n=++TS,i=()=>PS.get(e)||[],o=()=>{const t=IS.get(e);1===i().length&&t&&t(),(()=>{const t=i();PS.set(e,t.filter((e=>e.id!==n)))})()},a=i();if(PS.set(e,[...a,{id:n,fns:t}]),a&&a.length>0)return o;const s={};for(const e in t)s[e]=(...t)=>{const r=i();if(0!==r.length)for(const n of r)n.fns[e]?.(...t)};const c=r(s);return"function"==typeof c&&IS.set(e,c),o}async function MS(e){return new Promise((t=>setTimeout(t,e)))}function CS(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let i=!0;const o=()=>i=!1;return(async()=>{let a;t&&(a=await e({unpoll:o}));const s=await(r?.(a))??n;await MS(s);const c=async()=>{i&&(await e({unpoll:o}),await MS(n),c())};c()})(),o}const BS=new Map,NS=new Map;async function RS(e,{cacheKey:t,cacheTime:r=1/0}){const n=function(e){const t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:r=>t.set(e,r)}),r=t(e,BS),n=t(e,NS);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}(t),i=n.response.get();if(i&&r>0){if((new Date).getTime()-i.created.getTime()`blockNumber.${e}`;async function LS(e,{cacheTime:t=e.cacheTime,maxAge:r}={}){const n=await RS((()=>e.request({method:"eth_blockNumber"})),{cacheKey:FS(e.uid),cacheTime:r??t});return BigInt(n)}async function US(e,{filter:t}){const r="strict"in t&&t.strict;return(await t.request({method:"eth_getFilterChanges",params:[t.id]})).map((e=>{if("string"==typeof e)return e;try{const{eventName:n,args:i}="abi"in t&&t.abi?sS({abi:t.abi,data:e.data,topics:e.topics,strict:r}):{eventName:void 0,args:void 0};return yA(e,{args:i,eventName:n})}catch(r){let n,i;if(r instanceof Wx||r instanceof Jx){if("strict"in t&&t.strict)return;n=r.abiItem.name,i=r.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return yA(e,{args:i?[]:{},eventName:n})}})).filter(Boolean)}async function jS(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function DS(e,{abi:t,address:r,args:n,batch:i=!0,eventName:o,onError:a,onLogs:s,poll:c,pollingInterval:u=e.pollingInterval,strict:l}){return(void 0!==c?c:"webSocket"!==e.transport.type)?(()=>{const c=tk(["watchContractEvent",r,n,i,e.uid,o,u]),f=l??!1;return OS(c,{onLogs:s,onError:a},(a=>{let s,c,l=!1;const d=CS((async()=>{if(l)try{let u;if(c)u=await Ox(e,US,"getFilterChanges")({filter:c});else{const i=await Ox(e,LS,"getBlockNumber")({});u=s&&s!==i?await Ox(e,lS,"getContractEvents")({abi:t,address:r,args:n,eventName:o,fromBlock:s+1n,toBlock:i,strict:f}):[],s=i}if(0===u.length)return;if(i)a.onLogs(u);else for(const e of u)a.onLogs([e])}catch(e){c&&e instanceof Pk&&(l=!1),a.onError?.(e)}else{try{c=await Ox(e,G_,"createContractEventFilter")({abi:t,address:r,args:n,eventName:o,strict:f})}catch{}l=!0}}),{emitOnBegin:!0,interval:u});return async()=>{c&&await Ox(e,jS,"uninstallFilter")({filter:c}),d()}}))})():(()=>{let i=!0,c=()=>i=!1;return(async()=>{try{const u=o?z_({abi:t,eventName:o,args:n}):[],{unsubscribe:f}=await e.transport.subscribe({params:["logs",{address:r,topics:u}],onData(e){if(!i)return;const r=e.result;try{const{eventName:e,args:n}=sS({abi:t,data:r.data,topics:r.topics,strict:l}),i=yA(r,{args:n,eventName:e});s([i])}catch(e){let t,n;if(e instanceof Wx||e instanceof Jx){if(l)return;t=e.abiItem.name,n=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const i=yA(r,{args:n?[]:{},eventName:t});s([i])}},onError(e){a?.(e)}});c=f,i||c()}catch(e){a?.(e)}})(),c})()}async function zS(e){return hA(await e.request({method:"eth_chainId"}))}async function $S(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]})}async function HS(e,t){const{account:r=e.account,chain:n=e.chain,accessList:i,data:o,gas:a,gasPrice:s,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:f,value:d,...h}=t;if(!r)throw new Hk({docsPath:"/docs/actions/wallet/sendTransaction"});const p=q_(r);try{let r;if(Vk(t),null!==n&&(r=await Ox(e,zS,"getChainId")({}),function({chain:e,currentChainId:t}){if(!e)throw new SA;if(t!==e.id)throw new kA({chain:e,currentChainId:t})}({currentChainId:r,chain:n})),"local"===p.type){const t=await Ox(e,nS,"prepareTransactionRequest")({account:p,accessList:i,chain:n,data:o,gas:a,gasPrice:s,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:f,value:d,...h});r||(r=await Ox(e,zS,"getChainId")({}));const m=n?.serializers?.transaction,b=await p.signTransaction({...t,chainId:r},{serializer:m});return await Ox(e,$S,"sendRawTransaction")({serializedTransaction:b})}const m=e.chain?.formatters?.transactionRequest?.format,b=(m||AA)({...Kk(h,{format:m}),accessList:i,data:o,from:p.address,gas:a,gasPrice:s,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:l,to:f,value:d});return await e.request({method:"eth_sendTransaction",params:[b]})}catch(e){throw function(e,{docsPath:t,...r}){const n=(()=>{const t=qk(e,r);return t instanceof HA?e:t})();return new sk(n,{docsPath:t,...r})}(e,{...t,account:p,chain:t.chain||void 0})}}async function GS(e,{abi:t,address:r,args:n,dataSuffix:i,functionName:o,...a}){const s=K_({abi:t,args:n,functionName:o});return await Ox(e,HS,"sendTransaction")({data:`${s}${i?i.replace("0x",""):""}`,to:r,...a})}function qS(e){const t=e.length&&Array.isArray(e[0]);return{args:t?e[0]:[],options:(t?e[1]:e[0])??{}}}function KS(e,t){let r=!1;Array.isArray(e[0])?r=!0:1===e.length?r=t.inputs.some((e=>e.indexed)):2===e.length&&(r=!0);return{args:r?e[0]:void 0,options:(r?e[1]:e[0])??{}}}const VS=256;let WS,JS=VS;function ZS(e=11){if(!WS||JS+e>2*VS){WS="",JS=0;for(let e=0;e!0)}={}){return new Promise(((i,o)=>{const a=async({count:s=0}={})=>{try{const t=await e();i(t)}catch(e){if(s{const r="function"==typeof t?t({count:s,error:e}):t;r&&await MS(r),a({count:s+1})})({error:e});o(e)}};a()}))}const XS=e=>"code"in e?-1!==e.code&&-32004!==e.code&&-32005!==e.code&&-32042!==e.code&&-32603!==e.code:!!(e instanceof bk&&e.status)&&(403!==e.status&&408!==e.status&&413!==e.status&&429!==e.status&&500!==e.status&&502!==e.status&&503!==e.status&&504!==e.status);function QS(e,{retryDelay:t=150,retryCount:r=3}={}){return async n=>YS((async()=>{try{return await e(n)}catch(e){const t=e;switch(t.code){case Ak.code:throw new Ak(t);case xk.code:throw new xk(t);case _k.code:throw new _k(t);case kk.code:throw new kk(t);case Sk.code:throw new Sk(t);case Pk.code:throw new Pk(t);case Ik.code:throw new Ik(t);case Tk.code:throw new Tk(t);case Ok.code:throw new Ok(t);case Mk.code:throw new Mk(t);case Ck.code:throw new Ck(t);case Bk.code:throw new Bk(t);case Nk.code:throw new Nk(t);case Rk.code:throw new Rk(t);case Fk.code:throw new Fk(t);case Lk.code:throw new Lk(t);case Uk.code:throw new Uk(t);case jk.code:throw new jk(t);case 5e3:throw new Nk(t);default:if(e instanceof UE)throw e;throw new Dk(t)}}}),{delay:({count:e,error:r})=>{if(r&&r instanceof bk){const e=r?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*parseInt(e)}return(1<!XS(e)})}let eP=class extends UE{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}};function tP(e,{errorInstance:t=new Error("timed out"),timeout:r,signal:n}){return new Promise(((i,o)=>{(async()=>{let a;try{const s=new AbortController;r>0&&(a=setTimeout((()=>{n?s.abort():o(t)}),r)),i(await e({signal:s?.signal}))}catch(e){"AbortError"===e.name&&o(t),o(e)}finally{clearTimeout(a)}})()}))}let rP=0;const nP={http:async function(e,{body:t,fetchOptions:r={},timeout:n=1e4}){const{headers:i,method:o,signal:a}=r;try{const s=await tP((async({signal:s})=>await fetch(e,{...r,body:Array.isArray(t)?tk(t.map((e=>({jsonrpc:"2.0",id:e.id??rP++,...e})))):tk({jsonrpc:"2.0",id:t.id??rP++,...t}),headers:{...i,"Content-Type":"application/json"},method:o||"POST",signal:a||(n>0?s:void 0)})),{errorInstance:new vk({body:t,url:e}),timeout:n,signal:!0});let c;if(c=s.headers.get("Content-Type")?.startsWith("application/json")?await s.json():await s.text(),!s.ok)throw new bk({body:t,details:tk(c.error)||s.statusText,headers:s.headers,status:s.status,url:e});return c}catch(r){if(r instanceof bk)throw r;if(r instanceof vk)throw r;throw new bk({body:t,details:r.message,url:e})}},webSocket:function(e,{body:t,onResponse:r}){if(e.readyState===e.CLOSED||e.readyState===e.CLOSING)throw new gk({body:t,url:e.url,details:"Socket is closed."});const n=rP++,i=({data:o})=>{const a=JSON.parse(o);"number"==typeof a.id&&n!==a.id||(r?.(a),"eth_subscribe"===t.method&&"string"==typeof a.result&&e.subscriptions.set(a.result,i),"eth_unsubscribe"===t.method&&e.subscriptions.delete(t.params?.[0]))};return e.requests.set(n,i),e.send(JSON.stringify({jsonrpc:"2.0",...t,id:n})),e},webSocketAsync:async function(e,{body:t,timeout:r=1e4}){return tP((()=>new Promise((r=>nP.webSocket(e,{body:t,onResponse:r})))),{errorInstance:new vk({body:t,url:e.url}),timeout:r})}};function iP(e,t={}){const{batch:r,fetchOptions:n,key:i="http",name:o="HTTP JSON-RPC",retryDelay:a}=t;return({chain:s,retryCount:c,timeout:u})=>{const{batchSize:l=1e3,wait:f=0}="object"==typeof r?r:{},d=t.retryCount??c,h=u??t.timeout??1e4,p=e||s?.rpcUrls.default.http[0];if(!p)throw new eP;return function({key:e,name:t,request:r,retryCount:n=3,retryDelay:i=150,timeout:o,type:a},s){return{config:{key:e,name:t,request:r,retryCount:n,retryDelay:i,timeout:o,type:a},request:QS(r,{retryCount:n,retryDelay:i}),value:s}}({key:i,name:o,async request({method:t,params:i}){const o={method:t,params:i},{schedule:a}=xS({id:`${e}`,wait:f,shouldSplitBatch:e=>e.length>l,fn:e=>nP.http(p,{body:e,fetchOptions:n,timeout:h}),sort:(e,t)=>e.id-t.id}),[{error:s,result:c}]=await(async e=>r?a(e):[await nP.http(p,{body:e,fetchOptions:n,timeout:h})])(o);if(s)throw new yk({body:o,error:s,url:p});return c},retryCount:d,retryDelay:a,timeout:h,type:"http"},{fetchOptions:n,url:e})}}function oP(e,t){if(!(e instanceof UE))return!1;const r=e.walk((e=>e instanceof hk));return r instanceof hk&&("ResolverNotFound"===r.data?.errorName||("ResolverWildcardNotSupported"===r.data?.errorName||(!!r.reason?.includes("Wildcard on non-extended resolvers is not supported")||"reverse"===t&&r.reason===V_[50])))}function aP(e){if(66!==e.length)return null;if(0!==e.indexOf("["))return null;if(65!==e.indexOf("]"))return null;const t=`0x${e.slice(1,65)}`;return HE(t)?t:null}function sP(e){let t=new Uint8Array(32).fill(0);if(!e)return QE(t);const r=e.split(".");for(let e=r.length-1;e>=0;e-=1){const n=aP(r[e]),i=n?iA(n):I_(cA(r[e]),"bytes");t=I_(KA([t,i]),"bytes")}return QE(t)}function cP(e){return`[${e.slice(2)}]`}function uP(e){const t=new Uint8Array(32).fill(0);return e?aP(e)||I_(cA(e)):QE(t)}function lP(e){const t=e.replace(/^\.|\.$/gm,"");if(0===t.length)return new Uint8Array(1);const r=new Uint8Array(cA(t).byteLength+2);let n=0;const i=t.split(".");for(let e=0;e255&&(t=cA(cP(uP(i[e])))),r[n]=t.length,r.set(t,n+1),n+=t.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}let fP=class extends UE{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}},dP=class extends UE{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}},hP=class extends UE{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}},pP=class extends UE{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}};const mP=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,bP=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,gP=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,yP=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;function vP(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function wP({uri:e,gatewayUrls:t}){const r=gP.test(e);if(r)return{uri:e,isOnChain:!0,isEncoded:r};const n=vP(t?.ipfs,"https://ipfs.io"),i=vP(t?.arweave,"https://arweave.net"),o=e.match(mP),{protocol:a,subpath:s,target:c,subtarget:u=""}=o?.groups||{},l="ipns:/"===a||"ipns/"===s,f="ipfs:/"===a||"ipfs/"===s||bP.test(e);if(e.startsWith("http")&&!l&&!f){let r=e;return t?.arweave&&(r=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:r,isOnChain:!1,isEncoded:!1}}if((l||f)&&c)return{uri:`${n}/${l?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if("ar:/"===a&&c)return{uri:`${i}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(yP,"");if(d.startsWith("{const r=new Image;r.onload=()=>{t(!0)},r.onerror=()=>{t(!1)},r.src=e}))}}(r);if(i)return r;throw new hP({uri:t})}async function xP(e,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?async function(e,{gatewayUrls:t,record:r}){const n=function(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[r,n,i]=t.split("/"),[o,a]=r.split(":"),[s,c]=n.split(":");if(!o||"eip155"!==o.toLowerCase())throw new dP({reason:"Only EIP-155 supported"});if(!a)throw new dP({reason:"Chain ID not found"});if(!c)throw new dP({reason:"Contract address not found"});if(!i)throw new dP({reason:"Token ID not found"});if(!s)throw new dP({reason:"ERC namespace not found"});return{chainID:parseInt(a),namespace:s.toLowerCase(),contractAddress:c,tokenID:i}}(r),i=await async function(e,{nft:t}){if("erc721"===t.namespace)return kS(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if("erc1155"===t.namespace)return kS(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new pP({namespace:t.namespace})}(e,{nft:n}),{uri:o,isOnChain:a,isEncoded:s}=wP({uri:i,gatewayUrls:t});if(a&&(o.includes("data:application/json;base64,")||o.startsWith("{"))){const e=s?atob(o.replace("data:application/json;base64,","")):o;return AP({uri:EP(JSON.parse(e)),gatewayUrls:t})}let c=n.tokenID;"erc1155"===n.namespace&&(c=c.replace("0x","").padStart(64,"0"));return async function({gatewayUrls:e,uri:t}){try{const r=await fetch(t).then((e=>e.json()));return await AP({gatewayUrls:e,uri:EP(r)})}catch{throw new hP({uri:t})}}({gatewayUrls:t,uri:o.replace(/(?:0x)?{id}/,c)})}(e,{gatewayUrls:t,record:r}):AP({uri:r,gatewayUrls:t})}async function _P(e,{blockNumber:t,blockTag:r,name:n,key:i,universalResolverAddress:o}){let a=o;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=ES({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const o=await Ox(e,kS,"readContract")({address:a,abi:mS,functionName:"resolve",args:[YE(lP(n)),K_({abi:gS,functionName:"text",args:[sP(n),i]})],blockNumber:t,blockTag:r});if("0x"===o[0])return null;const s=dS({abi:gS,functionName:"text",data:o[0]});return""===s?null:s}catch(e){if(oP(e,"resolve"))return null;throw e}}async function kP(e,{address:t,args:r,event:n,events:i,fromBlock:o,strict:a,toBlock:s}={}){const c=i??(n?[n]:void 0),u=H_(e,{method:"eth_newFilter"});let l=[];c&&(l=[c.flatMap((e=>z_({abi:[e],eventName:e.name,args:r})))],n&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof o?eA(o):o,toBlock:"bigint"==typeof s?eA(s):s,...l.length?{topics:l}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:o,id:f,request:u(f),strict:a,toBlock:s,type:"event"}}async function SP(e){const t=H_(e,{method:"eth_newPendingTransactionFilter"}),r=await e.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:t(r),type:"transaction"}}async function PP(e,{blockCount:t,blockNumber:r,blockTag:n="latest",rewardPercentiles:i}){const o=r?eA(r):void 0;return function(e){return{baseFeePerGas:e.baseFeePerGas.map((e=>BigInt(e))),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map((e=>e.map((e=>BigInt(e)))))}}(await e.request({method:"eth_feeHistory",params:[eA(t),o||n,i]}))}let IP=class extends UE{constructor({callbackSelector:e,cause:t,data:r,extraData:n,sender:i,urls:o}){super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],t.metaMessages?.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map((e=>` ${e}`))],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${e}`,` Extra data: ${n}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}},TP=class extends UE{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${t}`,`Response: ${tk(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}},OP=class extends UE{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}};const MP={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function CP({data:e,sender:t,urls:r}){let n=new Error("An unknown error occurred.");for(let i=0;i{for(const r of e){const{name:e,type:n}=r,a=n,s=t[e],c=a.match(RP);if(c&&("number"==typeof s||"bigint"==typeof s)){const[e,t,r]=c;eA(s,{signed:"int"===t,size:parseInt(r)/8})}if("address"===a&&"string"==typeof s&&!qA(s))throw new xA({address:s});const u=a.match(NP);if(u){const[e,t]=u;if(t&&GE(s)!==parseInt(t))throw new Vx({expectedSize:parseInt(t),givenSize:GE(s)})}const l=i[a];l&&o(l,s)}};i.EIP712Domain&&e&&o(i.EIP712Domain,e);if("EIP712Domain"!==r){const e=i[r];o(e,t)}}({domain:i,message:t,primaryType:r,types:o});const a=["0x1901"];return i&&a.push(function({domain:e,types:t}){return LP({data:e,primaryType:"EIP712Domain",types:t})}({domain:i,types:o})),"EIP712Domain"!==r&&a.push(LP({data:t,primaryType:r,types:o})),I_(KA(a))}function LP({data:e,primaryType:t,types:r}){return I_(UP({data:e,primaryType:t,types:r}))}function UP({data:e,primaryType:t,types:r}){const n=[{type:"bytes32"}],i=[jP({primaryType:t,types:r})];for(const o of r[t]){const[t,a]=zP({types:r,name:o.name,type:o.type,value:e[o.name]});n.push(t),i.push(a)}return B_(n,i)}function jP({primaryType:e,types:t}){const r=YE(function({primaryType:e,types:t}){let r="";const n=DP({primaryType:e,types:t});n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i)r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`;return r}({primaryType:e,types:t}));return I_(r)}function DP({primaryType:e,types:t},r=new Set){const n=e.match(/^\w*/u),i=n?.[0];if(r.has(i)||void 0===t[i])return r;r.add(i);for(const e of t[i])DP({primaryType:e.type,types:t},r);return r}function zP({types:e,name:t,type:r,value:n}){if(void 0!==e[r])return[{type:"bytes32"},I_(UP({data:n,primaryType:r,types:e}))];if("bytes"===r){return[{type:"bytes32"},I_(n=`0x${(n.length%2?"0":"")+n.slice(2)}`)]}if("string"===r)return[{type:"bytes32"},I_(YE(n))];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),o=n.map((r=>zP({name:t,type:i,types:e,value:r})));return[{type:"bytes32"},I_(B_(o.map((([e])=>e)),o.map((([,e])=>e))))]}return[{type:r},n]}function $P({domain:e}){return["string"==typeof e?.name&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},"number"==typeof e?.chainId&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}const HP="/docs/contract/encodeDeployData";function GP({abi:e,args:t,bytecode:r}){if(!t||0===t.length)return r;const n=e.find((e=>"type"in e&&"constructor"===e.type));if(!n)throw new Bx({docsPath:HP});if(!("inputs"in n))throw new Nx({docsPath:HP});if(!n.inputs||0===n.inputs.length)throw new Nx({docsPath:HP});return VA([r,B_(n.inputs,t)])}const qP="Ethereum Signed Message:\n";async function KP(e,{address:t,blockNumber:r,blockTag:n,storageKeys:i}){const o=n??"latest",a=void 0!==r?eA(r):void 0;return function(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?hA(e.nonce):void 0,storageProof:e.storageProof?(t=e.storageProof,t.map((e=>({...e,value:BigInt(e.value)})))):void 0};var t}(await e.request({method:"eth_getProof",params:[t,i,a||o]}))}async function VP(e,{blockHash:t,blockNumber:r,blockTag:n,hash:i,index:o}){const a=n||"latest",s=void 0!==r?eA(r):void 0;let c=null;if(i?c=await e.request({method:"eth_getTransactionByHash",params:[i]}):t?c=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,eA(o)]}):(s||a)&&(c=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[s||a,eA(o)]})),!c)throw new ck({blockHash:t,blockNumber:r,blockTag:a,hash:i,index:o});return(e.chain?.formatters?.transaction?.format||bA)(c)}async function WP(e,{hash:t}){const r=await e.request({method:"eth_getTransactionReceipt",params:[t]});if(!r)throw new uk({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||wA)(r)}const JP="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572"; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */async function ZP(e,{address:t,hash:r,signature:n,...i}){const o=HE(n)?n:YE(n);try{const{data:n}=await Ox(e,_S,"call")({data:GP({abi:vS,args:[t,r,o],bytecode:JP}),...i});return s="0x1",function(e,t){if(e.length!==t.length)return!1;for(let r=0;rCS((async()=>{try{const t=await Ox(e,LS,"getBlockNumber")({cacheTime:0});if(s){if(t===s)return;if(t-s>1&&r)for(let e=s+1n;es)&&(n.onBlockNumber(t,s),s=t)}catch(e){n.onError?.(e)}}),{emitOnBegin:t,interval:a}))):(()=>{let t=!0,r=()=>t=!1;return(async()=>{try{const{unsubscribe:o}=await e.transport.subscribe({params:["newHeads"],onData(e){if(!t)return;const r=fA(e.result?.number);n(r,s),s=r},onError(e){i?.(e)}});r=o,t||r()}catch(e){i?.(e)}})(),r})()}function QP(e){return{call:t=>_S(e,t),createBlockFilter:()=>async function(e){const t=H_(e,{method:"eth_newBlockFilter"}),r=await e.request({method:"eth_newBlockFilter"});return{id:r,request:t(r),type:"block"}}(e),createContractEventFilter:t=>G_(e,t),createEventFilter:t=>kP(e,t),createPendingTransactionFilter:()=>SP(e),estimateContractGas:t=>oS(e,t),estimateGas:t=>iS(e,t),getBalance:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=r?eA(r):void 0,o=await e.request({method:"eth_getBalance",params:[t,i||n]});return BigInt(o)}(e,t),getBlock:t=>Xk(e,t),getBlockNumber:t=>LS(e,t),getBlockTransactionCount:t=>async function(e,{blockHash:t,blockNumber:r,blockTag:n="latest"}={}){const i=void 0!==r?eA(r):void 0;let o;return o=t?await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]}):await e.request({method:"eth_getBlockTransactionCountByNumber",params:[i||n]}),hA(o)}(e,t),getBytecode:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=void 0!==r?eA(r):void 0,o=await e.request({method:"eth_getCode",params:[t,i||n]});if("0x"!==o)return o}(e,t),getChainId:()=>zS(e),getContractEvents:t=>lS(e,t),getEnsAddress:t=>async function(e,{blockNumber:t,blockTag:r,coinType:n,name:i,universalResolverAddress:o}){let a=o;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=ES({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const o=K_({abi:yS,functionName:"addr",...null!=n?{args:[sP(i),BigInt(n)]}:{args:[sP(i)]}}),s=await Ox(e,kS,"readContract")({address:a,abi:mS,functionName:"resolve",args:[YE(lP(i)),o],blockNumber:t,blockTag:r});if("0x"===s[0])return null;const c=dS({abi:yS,args:null!=n?[sP(i),BigInt(n)]:void 0,functionName:"addr",data:s[0]});return"0x"===c||"0x00"===qE(c)?null:c}catch(e){if(oP(e,"resolve"))return null;throw e}}(e,t),getEnsAvatar:t=>async function(e,{blockNumber:t,blockTag:r,gatewayUrls:n,name:i,universalResolverAddress:o}){const a=await Ox(e,_P,"getEnsText")({blockNumber:t,blockTag:r,key:"avatar",name:i,universalResolverAddress:o});if(!a)return null;try{return await xP(e,{record:a,gatewayUrls:n})}catch{return null}}(e,t),getEnsName:t=>async function(e,{address:t,blockNumber:r,blockTag:n,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=ES({blockNumber:r,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const[i,s]=await Ox(e,kS,"readContract")({address:o,abi:bS,functionName:"reverse",args:[YE(lP(a))],blockNumber:r,blockTag:n});return t.toLowerCase()!==s.toLowerCase()?null:i}catch(e){if(oP(e,"reverse"))return null;throw e}}(e,t),getEnsResolver:t=>async function(e,{blockNumber:t,blockTag:r,name:n,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=ES({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}const[a]=await Ox(e,kS,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[YE(lP(n))],blockNumber:t,blockTag:r});return a}(e,t),getEnsText:t=>_P(e,t),getFeeHistory:t=>PP(e,t),estimateFeesPerGas:t=>async function(e,t){return tS(e,t)}(e,t),getFilterChanges:e=>US(0,e),getFilterLogs:e=>async function(e,{filter:t}){const r=t.strict??!1;return(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map((e=>{try{const{eventName:n,args:i}="abi"in t&&t.abi?sS({abi:t.abi,data:e.data,topics:e.topics,strict:r}):{eventName:void 0,args:void 0};return yA(e,{args:i,eventName:n})}catch(r){let n,i;if(r instanceof Wx||r instanceof Jx){if("strict"in t&&t.strict)return;n=r.abiItem.name,i=r.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return yA(e,{args:i?[]:{},eventName:n})}})).filter(Boolean)}(0,e),getGasPrice:()=>Qk(e),getLogs:t=>uS(e,t),getProof:t=>KP(e,t),estimateMaxPriorityFeePerGas:t=>async function(e,t){return eS(e,t)}(e,t),getStorageAt:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest",slot:i}){const o=void 0!==r?eA(r):void 0;return await e.request({method:"eth_getStorageAt",params:[t,i,o||n]})}(e,t),getTransaction:t=>VP(e,t),getTransactionConfirmations:t=>async function(e,{hash:t,transactionReceipt:r}){const[n,i]=await Promise.all([Ox(e,LS,"getBlockNumber")({}),t?Ox(e,VP,"getBlockNumber")({hash:t}):void 0]),o=r?.blockNumber||i?.blockNumber;return o?n-o+1n:0n}(e,t),getTransactionCount:t=>rS(e,t),getTransactionReceipt:t=>WP(e,t),multicall:t=>async function(e,t){const{allowFailure:r=!0,batchSize:n,blockNumber:i,blockTag:o,contracts:a,multicallAddress:s}=t,c=n??("object"==typeof e.batch?.multicall&&e.batch.multicall.batchSize||1024);let u=s;if(!u){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");u=ES({blockNumber:i,chain:e.chain,contract:"multicall3"})}const l=[[]];let f=0,d=0;for(let e=0;e0&&d>c&&l[f].length>0&&(f++,d=(e.length-2)/2,l[f]=[]),l[f]=[...l[f],{allowFailure:!0,callData:e,target:n}]}catch(e){const a=$k(e,{abi:t,address:n,args:i,docsPath:"/docs/contract/multicall",functionName:o});if(!r)throw a;l[f]=[...l[f],{allowFailure:!0,callData:"0x",target:n}]}}const h=await Promise.allSettled(l.map((t=>Ox(e,kS,"readContract")({abi:hS,address:u,args:[t],blockNumber:i,blockTag:o,functionName:"aggregate3"})))),p=[];for(let e=0;enS(e,t),readContract:t=>kS(e,t),sendRawTransaction:t=>$S(e,t),simulateContract:t=>SS(e,t),verifyMessage:t=>YP(e,t),verifyTypedData:t=>async function(e,{address:t,signature:r,message:n,primaryType:i,types:o,domain:a,...s}){return ZP(e,{address:t,hash:FP({message:n,primaryType:i,types:o,domain:a}),signature:r,...s})}(e,t),uninstallFilter:e=>jS(0,e),waitForTransactionReceipt:t=>async function(e,{confirmations:t=1,hash:r,onReplaced:n,pollingInterval:i=e.pollingInterval,timeout:o}){const a=tk(["waitForTransactionReceipt",e.uid,r]);let s,c,u,l=!1;return new Promise(((f,d)=>{o&&setTimeout((()=>d(new lk({hash:r}))),o);const h=OS(a,{onReplaced:n,resolve:f,reject:d},(n=>{const o=Ox(e,XP,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:i,async onBlockNumber(i){if(l)return;let a=i;const f=e=>{o(),e(),h()};try{if(u){if(t>1&&(!u.blockNumber||a-u.blockNumber+1nn.resolve(u)))}if(s||(l=!0,await YS((async()=>{s=await Ox(e,VP,"getTransaction")({hash:r}),s.blockNumber&&(a=s.blockNumber)}),{delay:({count:e})=>200*(1<1&&(!u.blockNumber||a-u.blockNumber+1nn.resolve(u)))}catch(r){if(s&&(r instanceof ck||r instanceof uk))try{c=s,l=!0;const r=await YS((()=>Ox(e,Xk,"getBlock")({blockNumber:a,includeTransactions:!0})),{delay:({count:e})=>200*(1<e instanceof Yk});l=!1;const i=r.transactions.find((({from:e,nonce:t})=>e===c.from&&t===c.nonce));if(!i)return;if(u=await Ox(e,WP,"getTransactionReceipt")({hash:i.hash}),t>1&&(!u.blockNumber||a-u.blockNumber+1n{n.onReplaced?.({reason:o,replacedTransaction:c,transaction:i,transactionReceipt:u}),n.resolve(u)}))}catch(e){f((()=>n.reject(e)))}else f((()=>n.reject(r)))}}})}))}))}(e,t),watchBlocks:t=>function(e,{blockTag:t="latest",emitMissed:r=!1,emitOnBegin:n=!1,onBlock:i,onError:o,includeTransactions:a,poll:s,pollingInterval:c=e.pollingInterval}){const u=void 0!==s?s:"webSocket"!==e.transport.type,l=a??!1;let f;return u?OS(tk(["watchBlocks",e.uid,r,n,l,c]),{onBlock:i,onError:o},(i=>CS((async()=>{try{const n=await Ox(e,Xk,"getBlock")({blockTag:t,includeTransactions:l});if(n.number&&f?.number){if(n.number===f.number)return;if(n.number-f.number>1&&r)for(let t=f?.number+1n;tf.number)&&(i.onBlock(n,f),f=n)}catch(e){i.onError?.(e)}}),{emitOnBegin:n,interval:c}))):(()=>{let t=!0,r=()=>t=!1;return(async()=>{try{const{unsubscribe:n}=await e.transport.subscribe({params:["newHeads"],onData(r){if(!t)return;const n=(e.chain?.formatters?.block?.format||gA)(r.result);i(n,f),f=n},onError(e){o?.(e)}});r=n,t||r()}catch(e){o?.(e)}})(),r})()}(e,t),watchBlockNumber:t=>XP(e,t),watchContractEvent:t=>DS(e,t),watchEvent:t=>function(e,{address:t,args:r,batch:n=!0,event:i,events:o,onError:a,onLogs:s,poll:c,pollingInterval:u=e.pollingInterval,strict:l}){const f=void 0!==c?c:"webSocket"!==e.transport.type,d=l??!1;return f?OS(tk(["watchEvent",t,r,n,e.uid,i,u]),{onLogs:s,onError:a},(a=>{let s,c,l=!1;const f=CS((async()=>{if(l)try{let u;if(c)u=await Ox(e,US,"getFilterChanges")({filter:c});else{const n=await Ox(e,LS,"getBlockNumber")({});u=s&&s!==n?await Ox(e,uS,"getLogs")({address:t,args:r,event:i,events:o,fromBlock:s+1n,toBlock:n}):[],s=n}if(0===u.length)return;if(n)a.onLogs(u);else for(const e of u)a.onLogs([e])}catch(e){c&&e instanceof Pk&&(l=!1),a.onError?.(e)}else{try{c=await Ox(e,kP,"createEventFilter")({address:t,args:r,event:i,events:o,strict:d})}catch{}l=!0}}),{emitOnBegin:!0,interval:u});return async()=>{c&&await Ox(e,jS,"uninstallFilter")({filter:c}),f()}})):(()=>{let n=!0,c=()=>n=!1;return(async()=>{try{const u=o??(i?[i]:void 0);let f=[];u&&(f=[u.flatMap((e=>z_({abi:[e],eventName:e.name,args:r})))],i&&(f=f[0]));const{unsubscribe:h}=await e.transport.subscribe({params:["logs",{address:t,topics:f}],onData(e){if(!n)return;const t=e.result;try{const{eventName:e,args:r}=sS({abi:u,data:t.data,topics:t.topics,strict:d}),n=yA(t,{args:r,eventName:e});s([n])}catch(e){let r,n;if(e instanceof Wx||e instanceof Jx){if(l)return;r=e.abiItem.name,n=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const i=yA(t,{args:n?[]:{},eventName:r});s([i])}},onError(e){a?.(e)}});c=h,n||c()}catch(e){a?.(e)}})(),c})()}(e,t),watchPendingTransactions:t=>function(e,{batch:t=!0,onError:r,onTransactions:n,poll:i,pollingInterval:o=e.pollingInterval}){return(void 0!==i?i:"webSocket"!==e.transport.type)?OS(tk(["watchPendingTransactions",e.uid,t,o]),{onTransactions:n,onError:r},(r=>{let n;const i=CS((async()=>{try{if(!n)try{return void(n=await Ox(e,SP,"createPendingTransactionFilter")({}))}catch(e){throw i(),e}const o=await Ox(e,US,"getFilterChanges")({filter:n});if(0===o.length)return;if(t)r.onTransactions(o);else for(const e of o)r.onTransactions([e])}catch(e){r.onError?.(e)}}),{emitOnBegin:!0,interval:o});return async()=>{n&&await Ox(e,jS,"uninstallFilter")({filter:n}),i()}})):(()=>{let t=!0,i=()=>t=!1;return(async()=>{try{const{unsubscribe:o}=await e.transport.subscribe({params:["newPendingTransactions"],onData(e){if(!t)return;const r=e.result;n([r])},onError(e){r?.(e)}});i=o,t||i()}catch(e){r?.(e)}})(),i})()}(e,t)}}function eI(e){const{key:t="public",name:r="Public Client"}=e,n=function(e){const{batch:t,cacheTime:r=e.pollingInterval??4e3,key:n="base",name:i="Base Client",pollingInterval:o=4e3,type:a="base"}=e,s=e.chain,c=e.account?q_(e.account):void 0,{config:u,request:l,value:f}=e.transport({chain:s,pollingInterval:o}),d={account:c,batch:t,cacheTime:r,chain:s,key:n,name:i,pollingInterval:o,request:l,transport:{...u,...f},type:a,uid:ZS()};return Object.assign(d,{extend:function e(t){return r=>{const n=r(t);for(const e in d)delete n[e];const i={...t,...n};return Object.assign(i,{extend:e(i)})}}(d)})}({...e,key:t,name:r,type:"publicClient"});return n.extend(QP)}BigInt(0),BigInt(1),BigInt(2);const tI=[{inputs:[{internalType:"uint256",name:"preOpGas",type:"uint256"},{internalType:"uint256",name:"paid",type:"uint256"},{internalType:"uint48",name:"validAfter",type:"uint48"},{internalType:"uint48",name:"validUntil",type:"uint48"},{internalType:"bool",name:"targetSuccess",type:"bool"},{internalType:"bytes",name:"targetResult",type:"bytes"}],name:"ExecutionResult",type:"error"},{inputs:[{internalType:"uint256",name:"opIndex",type:"uint256"},{internalType:"string",name:"reason",type:"string"}],name:"FailedOp",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"},{inputs:[{internalType:"address",name:"aggregator",type:"address"}],name:"SignatureValidationFailed",type:"error"},{inputs:[{components:[{internalType:"uint256",name:"preOpGas",type:"uint256"},{internalType:"uint256",name:"prefund",type:"uint256"},{internalType:"bool",name:"sigFailed",type:"bool"},{internalType:"uint48",name:"validAfter",type:"uint48"},{internalType:"uint48",name:"validUntil",type:"uint48"},{internalType:"bytes",name:"paymasterContext",type:"bytes"}],internalType:"struct IEntryPoint.ReturnInfo",name:"returnInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"senderInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"factoryInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"paymasterInfo",type:"tuple"}],name:"ValidationResult",type:"error"},{inputs:[{components:[{internalType:"uint256",name:"preOpGas",type:"uint256"},{internalType:"uint256",name:"prefund",type:"uint256"},{internalType:"bool",name:"sigFailed",type:"bool"},{internalType:"uint48",name:"validAfter",type:"uint48"},{internalType:"uint48",name:"validUntil",type:"uint48"},{internalType:"bytes",name:"paymasterContext",type:"bytes"}],internalType:"struct IEntryPoint.ReturnInfo",name:"returnInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"senderInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"factoryInfo",type:"tuple"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"paymasterInfo",type:"tuple"},{components:[{internalType:"address",name:"aggregator",type:"address"},{components:[{internalType:"uint256",name:"stake",type:"uint256"},{internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],internalType:"struct IStakeManager.StakeInfo",name:"stakeInfo",type:"tuple"}],internalType:"struct IEntryPoint.AggregatorStakeInfo",name:"aggregatorInfo",type:"tuple"}],name:"ValidationResultWithAggregation",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"userOpHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"address",name:"factory",type:"address"},{indexed:!1,internalType:"address",name:"paymaster",type:"address"}],name:"AccountDeployed",type:"event"},{anonymous:!1,inputs:[],name:"BeforeExecution",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"totalDeposit",type:"uint256"}],name:"Deposited",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"aggregator",type:"address"}],name:"SignatureAggregatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"totalStaked",type:"uint256"},{indexed:!1,internalType:"uint256",name:"unstakeDelaySec",type:"uint256"}],name:"StakeLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"withdrawTime",type:"uint256"}],name:"StakeUnlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"address",name:"withdrawAddress",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"StakeWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"userOpHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!0,internalType:"address",name:"paymaster",type:"address"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"bool",name:"success",type:"bool"},{indexed:!1,internalType:"uint256",name:"actualGasCost",type:"uint256"},{indexed:!1,internalType:"uint256",name:"actualGasUsed",type:"uint256"}],name:"UserOperationEvent",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"userOpHash",type:"bytes32"},{indexed:!0,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"nonce",type:"uint256"},{indexed:!1,internalType:"bytes",name:"revertReason",type:"bytes"}],name:"UserOperationRevertReason",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"address",name:"withdrawAddress",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Withdrawn",type:"event"},{inputs:[],name:"SIG_VALIDATION_FAILED",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"address",name:"sender",type:"address"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"}],name:"_validateSenderAndPaymaster",outputs:[],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint32",name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"deposits",outputs:[{internalType:"uint112",name:"deposit",type:"uint112"},{internalType:"bool",name:"staked",type:"bool"},{internalType:"uint112",name:"stake",type:"uint112"},{internalType:"uint32",name:"unstakeDelaySec",type:"uint32"},{internalType:"uint48",name:"withdrawTime",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"getDepositInfo",outputs:[{components:[{internalType:"uint112",name:"deposit",type:"uint112"},{internalType:"bool",name:"staked",type:"bool"},{internalType:"uint112",name:"stake",type:"uint112"},{internalType:"uint32",name:"unstakeDelaySec",type:"uint32"},{internalType:"uint48",name:"withdrawTime",type:"uint48"}],internalType:"struct IStakeManager.DepositInfo",name:"info",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint192",name:"key",type:"uint192"}],name:"getNonce",outputs:[{internalType:"uint256",name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"}],name:"getSenderAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"userOp",type:"tuple"}],name:"getUserOpHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation[]",name:"userOps",type:"tuple[]"},{internalType:"contract IAggregator",name:"aggregator",type:"address"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct IEntryPoint.UserOpsPerAggregator[]",name:"opsPerAggregator",type:"tuple[]"},{internalType:"address payable",name:"beneficiary",type:"address"}],name:"handleAggregatedOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation[]",name:"ops",type:"tuple[]"},{internalType:"address payable",name:"beneficiary",type:"address"}],name:"handleOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint192",name:"key",type:"uint192"}],name:"incrementNonce",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"callData",type:"bytes"},{components:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"address",name:"paymaster",type:"address"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"}],internalType:"struct EntryPoint.MemoryUserOp",name:"mUserOp",type:"tuple"},{internalType:"bytes32",name:"userOpHash",type:"bytes32"},{internalType:"uint256",name:"prefund",type:"uint256"},{internalType:"uint256",name:"contextOffset",type:"uint256"},{internalType:"uint256",name:"preOpGas",type:"uint256"}],internalType:"struct EntryPoint.UserOpInfo",name:"opInfo",type:"tuple"},{internalType:"bytes",name:"context",type:"bytes"}],name:"innerHandleOp",outputs:[{internalType:"uint256",name:"actualGasCost",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint192",name:"",type:"uint192"}],name:"nonceSequenceNumber",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"op",type:"tuple"},{internalType:"address",name:"target",type:"address"},{internalType:"bytes",name:"targetCallData",type:"bytes"}],name:"simulateHandleOp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"userOp",type:"tuple"}],name:"simulateValidation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address payable",name:"withdrawAddress",type:"address"},{internalType:"uint256",name:"withdrawAmount",type:"uint256"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],rI=e=>{const t=e;return{...t,estimateUserOperationGas:(e,r)=>t.request({method:"eth_estimateUserOperationGas",params:[e,r]}),sendUserOperation:(e,r)=>t.request({method:"eth_sendUserOperation",params:[e,r]}),getUserOperationByHash:e=>t.request({method:"eth_getUserOperationByHash",params:[e]}),getUserOperationReceipt:e=>t.request({method:"eth_getUserOperationReceipt",params:[e]}),getSupportedEntryPoints:()=>t.request({method:"eth_supportedEntryPoints",params:[]}),getMaxPriorityFeePerGas:()=>t.request({method:"eth_maxPriorityFeePerGas",params:[]}),async getFeeData(){const e=await t.getBlock({blockTag:"latest"});if(e&&e.baseFeePerGas){const t=BigInt(15e8);return{maxPriorityFeePerGas:t,maxFeePerGas:e.baseFeePerGas*BigInt(2)+t}}return{maxFeePerGas:0,maxPriorityFeePerGas:0}},getContractCode:async e=>await t.getBytecode({address:e})??"0x"}},nI=({chain:e,rpcUrl:t,fetchOptions:r})=>rI(eI({chain:e,transport:iP(t,{fetchOptions:{...r,headers:{...r?.headers,"Alchemy-AA-Sdk-Version":"0.1.0-alpha.23"}}})}));var iI;!function(e){e[e.DEBUG=4]="DEBUG",e[e.INFO=3]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=1]="ERROR",e[e.NONE=0]="NONE"}(iI||(iI={}));let oI=class{static setLogLevel(e){this.logLevel=e}static setLogFilter(e){this.logFilter=e}static error(e,...t){this.shouldLog(e,iI.ERROR)&&console.error(e,...t)}static warn(e,...t){this.shouldLog(e,iI.WARN)&&console.warn(e,...t)}static debug(e,...t){this.shouldLog(e,iI.DEBUG)&&console.debug(e,...t)}static info(e,...t){this.shouldLog(e,iI.INFO)&&console.info(e,...t)}static shouldLog(e,t){return!(this.logLevel(...n)=>{const{args:o,options:a}=qS(n);return Ox(r,kS,"readContract")({abi:e,address:t,functionName:i,args:o,...a})}})),c&&(a.simulate=new Proxy({},{get:(n,i)=>(...n)=>{const{args:o,options:a}=qS(n);return Ox(r,SS,"simulateContract")({abi:e,address:t,functionName:i,args:o,...a})}})),u&&(a.createEventFilter=new Proxy({},{get:(n,i)=>(...n)=>{const o=e.find((e=>"event"===e.type&&e.name===i)),{args:a,options:s}=KS(n,o);return Ox(r,G_,"createContractEventFilter")({abi:e,address:t,eventName:i,args:a,...s})}}),a.getEvents=new Proxy({},{get:(n,i)=>(...n)=>{const o=e.find((e=>"event"===e.type&&e.name===i)),{args:a,options:s}=KS(n,o);return Ox(r,lS,"getContractEvents")({abi:e,address:t,eventName:i,args:a,...s})}}),a.watchEvent=new Proxy({},{get:(n,i)=>(...n)=>{const o=e.find((e=>"event"===e.type&&e.name===i)),{args:a,options:s}=KS(n,o);return Ox(r,DS,"watchContractEvent")({abi:e,address:t,eventName:i,args:a,...s})}}))),o&&c&&(a.write=new Proxy({},{get:(r,i)=>(...r)=>{const{args:o,options:a}=qS(r);return Ox(n,GS,"writeContract")({abi:e,address:t,functionName:i,args:o,...a})}})),(i||o)&&c&&(a.estimateGas=new Proxy({},{get:(i,o)=>(...i)=>{const{args:a,options:s}=qS(i);return Ox(r??n,oS,"estimateContractGas")({abi:e,address:t,functionName:o,args:a,...s,account:s.account??n.account})}})),a.address=t,a.abi=e,a}({address:e.entryPointAddress,abi:tI,publicClient:this.rpcProvider})}async signMessageWith6492(e){throw new Error("signMessageWith6492 not supported")}async signTypedData(e){throw new Error("signTypedData not supported")}async signTypedDataWith6492(e){throw new Error("signTypedDataWith6492 not supported")}async encodeBatchExecute(e){throw new Error("encodeBatchExecute not supported")}async getNonce(){if(!await this.isAccountDeployed())return 0n;const e=await this.getAddress();return this.entryPoint.read.getNonce([e,BigInt(0)])}async getInitCode(){if(this.deploymentState===aI.DEPLOYED)return"0x";const e=await this.rpcProvider.getContractCode(await this.getAddress());return(e?.length??0)>2?(this.deploymentState=aI.DEPLOYED,"0x"):(this.deploymentState=aI.NOT_DEPLOYED,this.getAccountInitCode())}async getAddress(){if(!this.accountAddress){const e=await this.getAccountInitCode();oI.debug("[BaseSmartContractAccount](getAddress) initCode: ",e);try{await this.entryPoint.simulate.getSenderAddress([e])}catch(e){if(oI.debug("[BaseSmartContractAccount](getAddress) entrypoint.getSenderAddress result: ",e),"SenderAddressResult"===e.cause?.data?.errorName)return this.accountAddress=e.cause.data.args[0],this.accountAddress}throw new Error("getCounterFactualAddress failed")}return this.accountAddress}async isAccountDeployed(){return await this.getDeploymentState()===aI.DEPLOYED}async getDeploymentState(){if(this.deploymentState===aI.UNDEFINED){return"0x"===await this.getInitCode()?aI.DEPLOYED:aI.NOT_DEPLOYED}return this.deploymentState}}const cI=({factoryAddress:e,initCode:t,signature:r})=>KA([B_(Tx("address, bytes, bytes"),[e,t,r]),"0x6492649264926492649264926492649264926492649264926492649264926492"]);var uI={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);iasync t=>{let r=t;for(const t of e)r=await t(r);return r};async function dI(e){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(await Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}function hI(e){if("function"!=typeof e)return null==e||"string"==typeof e||"boolean"==typeof e?e:"bigint"==typeof e?YE(e):null!=e._isBigNumber||"object"!=typeof e?YE(e).replace(/^0x0/,"0x"):Array.isArray(e)?e.map((e=>hI(e))):Object.keys(e).reduce(((t,r)=>({...t,[r]:hI(e[r])})),{})}function pI(e,t,r){const n=B_([{type:"bytes32"},{type:"address"},{type:"uint256"}],[I_(mI(e)),t,r]);return I_(n)}function mI(e){const t=I_(e.initCode),r=I_(e.callData),n=I_(e.paymasterAndData);return B_([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"bytes32"}],[e.sender,fA(e.nonce),t,r,fA(e.callGasLimit),fA(e.verificationGasLimit),fA(e.preVerificationGas),fA(e.maxFeePerGas),fA(e.maxPriorityFeePerGas),n])}function bI(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}const gI=async e=>e,yI=new Map([[FE.id,10000000n],[LE.id,10000000n]]);class vI extends lI{constructor(e,t,r,n,i){super(),Object.defineProperty(this,"entryPointAddress",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"chain",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"account",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"txMaxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"txRetryIntervalMs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"txRetryMulitplier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"minPriorityFeePerBid",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rpcClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const{method:t,params:r}=e;switch(t){case"eth_sendTransaction":const[t]=r;return this.sendTransaction(t);case"eth_sign":case"personal_sign":const[n,i]=r;if(i!==await this.getAddress())throw new Error("cannot sign for address that is not the current account");return this.signMessage(n);default:return this.rpcClient.request(e)}}}),Object.defineProperty(this,"getAddress",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!this.account)throw new Error("account not connected!");return this.account.getAddress()}}),Object.defineProperty(this,"sendTransaction",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{if(!e.to)throw new Error("transaction is missing to address");const t={};e.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);const{hash:r}=await this.sendUserOperation({target:e.to,data:e.data??"0x",value:e.value?lA(e.value,"bigint"):0n},t);return await this.waitForUserOperationTransaction(r)}}),Object.defineProperty(this,"signMessage",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{if(!this.account)throw new Error("account not connected!");return this.account.signMessage(e)}}),Object.defineProperty(this,"signTypedData",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{if(!this.account)throw new Error("account not connected!");return this.account.signTypedData(e)}}),Object.defineProperty(this,"sendTransactions",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const t=e.map((e=>{if(!e.to)throw new Error("one transaction in the batch is missing a target address");return{target:e.to,data:e.data??"0x",value:e.value?lA(e.value,"bigint"):0n}})),r=(...e)=>{if(e.length)return e.reduce(((e,t)=>e>t?e:t))},n=r(...e.filter((e=>null!=e.maxFeePerGas)).map((e=>lA(e.maxFeePerGas,"bigint")))),i=r(...e.filter((e=>null!=e.maxPriorityFeePerGas)).map((e=>lA(e.maxPriorityFeePerGas,"bigint")))),o={};null!=n&&(o.maxFeePerGas=n),null!=i&&(o.maxPriorityFeePerGas=i);const{hash:a}=await this.sendUserOperation(t,o);return await this.waitForUserOperationTransaction(a)}}),Object.defineProperty(this,"waitForUserOperationTransaction",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{for(let t=0;tsetTimeout(e,r)));const n=await this.getUserOperationReceipt(e).catch((()=>null));if(n)return this.getTransaction(n.receipt.transactionHash).then((e=>e.hash))}throw new Error("Failed to find transaction for User Operation")}}),Object.defineProperty(this,"getUserOperationByHash",{enumerable:!0,configurable:!0,writable:!0,value:e=>this.rpcClient.getUserOperationByHash(e)}),Object.defineProperty(this,"getUserOperationReceipt",{enumerable:!0,configurable:!0,writable:!0,value:e=>this.rpcClient.getUserOperationReceipt(e)}),Object.defineProperty(this,"getTransaction",{enumerable:!0,configurable:!0,writable:!0,value:e=>this.rpcClient.getTransaction({hash:e})}),Object.defineProperty(this,"sendUserOperation",{enumerable:!0,configurable:!0,writable:!0,value:async(e,t)=>{if(!this.account)throw new Error("account not connected!");const r=await this.account.getInitCode(),n=await fI(this.dummyPaymasterDataMiddleware,this.feeDataGetter,this.gasEstimator,this.paymasterDataMiddleware,this.customMiddleware??gI,(async e=>({...e,...t})))({initCode:r,sender:this.getAddress(),nonce:this.account.getNonce(),callData:Array.isArray(e)?this.account.encodeBatchExecute(e):this.account.encodeExecute(e.target,e.value??0n,e.data),signature:this.account.getDummySignature()}),i=hI(await dI(n));if(!function(e){return!!(e.callGasLimit&&e.maxFeePerGas&&null!=e.maxPriorityFeePerGas&&e.preVerificationGas&&e.verificationGasLimit)}(i))throw new Error(`Request is missing parameters. All properties on UserOperationStruct must be set. uo: ${JSON.stringify(i,null,2)}`);return i.signature=await this.account.signMessage(pI(i,this.entryPointAddress,BigInt(this.chain.id))),{hash:await this.rpcClient.sendUserOperation(i,this.entryPointAddress),request:i}}}),Object.defineProperty(this,"dummyPaymasterDataMiddleware",{enumerable:!0,configurable:!0,writable:!0,value:async e=>(e.paymasterAndData="0x",e)}),Object.defineProperty(this,"paymasterDataMiddleware",{enumerable:!0,configurable:!0,writable:!0,value:async e=>(e.paymasterAndData="0x",e)}),Object.defineProperty(this,"gasEstimator",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const t=hI(await dI(e)),r=await this.rpcClient.estimateUserOperationGas(t,this.entryPointAddress);return e.callGasLimit=r.callGasLimit,e.verificationGasLimit=r.verificationGasLimit,e.preVerificationGas=r.preVerificationGas,e}}),Object.defineProperty(this,"feeDataGetter",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const t=await this.rpcClient.getMaxPriorityFeePerGas(),r=await this.rpcClient.getFeeData();if(!r.maxFeePerGas||!r.maxPriorityFeePerGas)throw new Error("feeData is missing maxFeePerGas or maxPriorityFeePerGas");let n=4n*BigInt(t)/3n;n{bI(this,"dummyPaymasterDataMiddleware",e.dummyPaymasterDataMiddleware?this.overrideMiddlewareFunction(e.dummyPaymasterDataMiddleware):this.dummyPaymasterDataMiddleware);return bI(this,"paymasterDataMiddleware",e.paymasterDataMiddleware?this.overrideMiddlewareFunction(e.paymasterDataMiddleware):this.paymasterDataMiddleware),this}}),Object.defineProperty(this,"withGasEstimator",{enumerable:!0,configurable:!0,writable:!0,value:e=>(bI(this,"gasEstimator",this.overrideMiddlewareFunction(e)),this)}),Object.defineProperty(this,"withFeeDataGetter",{enumerable:!0,configurable:!0,writable:!0,value:e=>(bI(this,"feeDataGetter",this.overrideMiddlewareFunction(e)),this)}),Object.defineProperty(this,"withCustomMiddleware",{enumerable:!0,configurable:!0,writable:!0,value:e=>(bI(this,"customMiddleware",e),this)}),Object.defineProperty(this,"overrideMiddlewareFunction",{enumerable:!0,configurable:!0,writable:!0,value:e=>async t=>({...t,...await e(t)})}),this.txMaxRetries=i?.txMaxRetries??5,this.txRetryIntervalMs=i?.txRetryIntervalMs??2e3,this.txRetryMulitplier=i?.txRetryMulitplier??1.5,this.minPriorityFeePerBid=i?.minPriorityFeePerBid??yI.get(r.id)??100000000n,this.rpcClient="string"==typeof e?nI({chain:r,rpcUrl:e}):e}signMessageWith6492(e){if(!this.account)throw new Error("account not connected!");return this.account.signMessageWith6492(e)}signTypedDataWith6492(e){if(!this.account)throw new Error("account not connected!");return this.account.signTypedDataWith6492(e)}connect(e){const t=e(this.rpcClient);return bI(this,"account",t),this.emit("connect",{chainId:YE(this.chain.id)}),t.getAddress().then((e=>this.emit("accountsChanged",[e]))),this}disconnect(){return this.account&&(this.emit("disconnect"),this.emit("accountsChanged",[])),bI(this,"account",void 0),this}isConnected(){return void 0!==this.account}}let wI=class e extends Error{constructor(t,r={}){const n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath;super([t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...n?[`Details: ${n}`]:[],"Version: abitype@0.9.8"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=t}};function EI(e,t){const r=e.exec(t);return r?.groups}const AI=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,xI=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,_I=/^\(.+?\).*?$/,kI=/^tuple(?(\[(\d*)\])*)$/;function SI(e){let t=e.type;if(kI.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let n=0;n[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function TI(e){return II.test(e)}function OI(e){return EI(II,e)}const MI=new Set(["memory","indexed","storage","calldata"]),CI=new Set(["calldata","memory","storage"]);let BI=class extends wI{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}},NI=class extends wI{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}};class RI extends wI{constructor({params:e}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(e,null,2)})`,docsPath:"/api/human.html#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}let FI=class extends wI{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},LI=class extends wI{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}},UI=class extends wI{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}},jI=class extends wI{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}},DI=class extends wI{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}},zI=class extends wI{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},$I=class extends wI{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}},HI=class extends wI{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}},GI=class extends wI{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}};const qI=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]),KI=/^(?[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,VI=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,WI=/^u?int$/;function JI(e,t){const r=function(e,t){return t?`${t}:${e}`:e}(e,t?.type);if(qI.has(r))return qI.get(r);const n=_I.test(e),i=EI(n?VI:KI,e);if(!i)throw new FI({param:e});if(i.name&&function(e){return"address"===e||"bool"===e||"function"===e||"string"===e||"tuple"===e||AI.test(e)||xI.test(e)||XI.test(e)}(i.name))throw new LI({param:e,name:i.name});const o=i.name?{name:i.name}:{},a="indexed"===i.modifier?{indexed:!0}:{},s=t?.structs??{};let c,u={};if(n){c="tuple";const e=ZI(i.type),t=[],r=e.length;for(let n=0;n[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function eT(e,t,r=new Set){const n=[],i=e.length;for(let o=0;oe[t.name||r]?.(n)??t(e,n)}function nT(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new OT(e.type);return`${e.name}(${iT(e.inputs,{includeName:t})})`}function iT(e,{includeName:t=!1}={}){return e?e.map((e=>function(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${iT(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}(e,{includeName:t}))).join(t?", ":","):""}function oT(e,{strict:t=!0}={}){return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function aT(e){return oT(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}let sT=class e extends Error{constructor(t,r={}){super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"viem@1.21.3"});const n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath;this.message=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: https://viem.sh${i}.html${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join("\n"),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=t}walk(e){return cT(this,e)}};function cT(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e?cT(e.cause,t):t?null:e}let uT=class extends sT{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"})}},lT=class extends sT{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"})}},fT=class extends sT{constructor({data:e,params:t,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join("\n"),{metaMessages:[`Params: (${iT(t,{includeName:!0})})`,`Data: ${e} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=r}},dT=class extends sT{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}},hT=class extends sT{constructor({expectedLength:e,givenLength:t,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}},pT=class extends sT{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${aT(t)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}},mT=class extends sT{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}},bT=class extends sT{constructor(e,{docsPath:t}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}},gT=class extends sT{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureEmptyTopicsError"})}},yT=class extends sT{constructor(e,{docsPath:t}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"})}},vT=class extends sT{constructor(e,{docsPath:t}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"})}},wT=class extends sT{constructor(e,{docsPath:t}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}},ET=class extends sT{constructor(e,{docsPath:t}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"})}};class AT extends sT{constructor(e,{docsPath:t}){super([`Encoded function signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionSignatureNotFoundError"})}}let xT=class extends sT{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${nT(e.abiItem)}\`, and`,`\`${t.type}\` in \`${nT(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}},_T=class extends sT{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}},kT=class extends sT{constructor({abiItem:e,data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for non-indexed event parameters.`].join("\n"),{metaMessages:[`Params: (${iT(r,{includeName:!0})})`,`Data: ${t} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=r,this.size=n}},ST=class extends sT{constructor({abiItem:e,param:t}){super([`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${nT(e,{includeName:!0})}".`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}},PT=class extends sT{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}},IT=class extends sT{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"})}},TT=class extends sT{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}},OT=class extends sT{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}};class MT extends sT{constructor(e){super(`Type "${e}" is not supported for packed encoding.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedPackedAbiType"})}}let CT=class extends sT{constructor(e){super(`Filter type "${e}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}},BT=class extends sT{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SliceOffsetOutOfBoundsError"})}},NT=class extends sT{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeExceedsPaddingSizeError"})}};function RT(e,{dir:t,size:r=32}={}){return"string"==typeof e?FT(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new NT({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;i2*r)throw new NT({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}let LT=class extends sT{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}},UT=class extends sT{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidBytesBooleanError"})}};class jT extends sT{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidHexBooleanError"})}}let DT=class extends sT{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}};function zT(e,{dir:t="left"}={}){let r="string"==typeof e?e.replace("0x",""):e,n=0;for(let e=0;et)throw new DT({givenSize:aT(e),maxSize:t})}function HT(e,t){const r="string"==typeof t?{to:t}:t,n=r.to;return"number"===n?KT(e,r):"bigint"===n?GT(e,r):"string"===n?VT(e,r):"boolean"===n?qT(e,r):oO(e,r)}function GT(e,t={}){const{signed:r}=t;t.size&&$T(e,{size:t.size});const n=BigInt(e);if(!r)return n;const i=(e.length-2)/2;return n<=(1n<<8n*BigInt(i)-1n)-1n?n:n-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function qT(e,t={}){let r=e;if(t.size&&($T(r,{size:t.size}),r=zT(r)),"0x00"===zT(r))return!1;if("0x01"===zT(r))return!0;throw new jT(r)}function KT(e,t={}){return Number(GT(e,t))}function VT(e,t={}){let r=oO(e);return t.size&&($T(r,{size:t.size}),r=zT(r,{dir:"right"})),(new TextDecoder).decode(r)}const WT=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function JT(e,t={}){return"number"==typeof e||"bigint"==typeof e?XT(e,t):"string"==typeof e?eO(e,t):"boolean"==typeof e?ZT(e,t):YT(e,t)}function ZT(e,t={}){const r=`0x${Number(e)}`;return"number"==typeof t.size?($T(r,{size:t.size}),RT(r,{size:t.size})):r}function YT(e,t={}){let r="";for(let t=0;to||i=nO.zero&&e<=nO.nine?e-nO.zero:e>=nO.A&&e<=nO.F?e-(nO.A-10):e>=nO.a&&e<=nO.f?e-(nO.a-10):void 0}function oO(e,t={}){let r=e;t.size&&($T(r,{size:t.size}),r=RT(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;e{var t;return function(e){let t=!0,r="",n=0,i="",o=!1;for(let a=0;a0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function lO(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function fO(e,t){uO(e);const r=t.outputLen;if(e.length>hO&dO)}:{h:0|Number(e>>hO&dO),l:0|Number(e&dO)}}function mO(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;ie instanceof Uint8Array,yO=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),vO=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function wO(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!gO(e))throw new Error("expected Uint8Array, got "+typeof e);return e}let EO=class{clone(){return this._cloneInto()}};function AO(e){const t=t=>e().update(wO(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function xO(e=32){if(bO&&"function"==typeof bO.getRandomValues)return bO.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const[_O,kO,SO]=[[],[],[]],PO=BigInt(0),IO=BigInt(1),TO=BigInt(2),OO=BigInt(7),MO=BigInt(256),CO=BigInt(113);for(let e=0,t=IO,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],_O.push(2*(5*n+r)),kO.push((e+1)*(e+2)/2%64);let i=PO;for(let e=0;e<7;e++)t=(t<>OO)*CO)%MO,t&TO&&(i^=IO<<(IO<r>32?((e,t,r)=>t<>>64-r)(e,t,r):((e,t,r)=>e<>>32-r)(e,t,r),FO=(e,t,r)=>r>32?((e,t,r)=>e<>>64-r)(e,t,r):((e,t,r)=>t<>>32-r)(e,t,r);let LO=class e extends EO{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,cO(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)))(this.state)}keccak(){!function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=RO(o,a,1)^r[n],c=FO(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=kO[r],o=RO(t,i,n),a=FO(t,i,n),s=_O[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=BO[n],e[1]^=NO[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){lO(this);const{blockLen:t,state:r}=this,n=(e=wO(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return cO(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(fO(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return t||(t=new e(r,n,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}};const UO=((e,t,r)=>AO((()=>new LO(t,e,r))))(1,136,32);function jO(e,t){const r=t||"hex",n=UO(oT(e,{strict:!1})?rO(e):e);return"bytes"===r?n:JT(n)}const DO=e=>(e=>jO(rO(e)))((e=>sO(e))(e));let zO=class extends sT{constructor({address:e}){super(`Address "${e}" is invalid.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}};const $O=/^0x[a-fA-F0-9]{40}$/;function HO(e){return $O.test(e)}function GO(e){return"string"==typeof e[0]?qO(e):function(e){let t=0;for(const r of e)t+=r.length;const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(e)}function qO(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}function KO(e,t,r,{strict:n}={}){return oT(e,{strict:!1})?function(e,t,r,{strict:n}={}){VO(e,t);const i=`0x${e.replace("0x","").slice(2*(t??0),2*(r??e.length))}`;n&&WO(i,t,r);return i}(e,t,r,{strict:n}):function(e,t,r,{strict:n}={}){VO(e,t);const i=e.slice(t,r);n&&WO(i,t,r);return i}(e,t,r,{strict:n})}function VO(e,t){if("number"==typeof t&&t>0&&t>aT(e)-1)throw new BT({offset:t,position:"start",size:aT(e)})}function WO(e,t,r){if("number"==typeof t&&"number"==typeof r&&aT(e)!==r-t)throw new BT({offset:r,position:"end",size:aT(e)})}function JO(e,t){if(e.length!==t.length)throw new mT({expectedLength:e.length,givenLength:t.length});const r=function({params:e,values:t}){const r=[];for(let n=0;n0?GO([t,e]):t}}if(i)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:GO(o.map((({encoded:e})=>e)))}}(t,{length:n,param:{...e,type:i}})}if("tuple"===e.type)return function(e,{param:t}){let r=!1;const n=[];for(let i=0;ie)))}}(t,{param:e});if("address"===e.type)return function(e){if(!HO(e))throw new zO({address:e});return{dynamic:!1,encoded:FT(e.toLowerCase())}}(t);if("bool"===e.type)return function(e){return{dynamic:!1,encoded:FT(ZT(e))}}(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){return function(e,{signed:t}){return{dynamic:!1,encoded:XT(e,{size:32,signed:t})}}(t,{signed:e.type.startsWith("int")})}if(e.type.startsWith("bytes"))return function(e,{param:t}){const[,r]=t.type.split("bytes"),n=aT(e);if(!r){let t=e;return n%32!=0&&(t=FT(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:GO([FT(XT(n,{size:32})),t])}}if(n!==parseInt(r))throw new pT({expectedSize:parseInt(r),value:e});return{dynamic:!1,encoded:FT(e,{dir:"right"})}}(t,{param:e});if("string"===e.type)return function(e){const t=eO(e),r=Math.ceil(aT(t)/32),n=[];for(let e=0;eKO((e=>jO(rO(e)))(sO(e)),0,4);function eM({abi:e,args:t=[],name:r}){const n=oT(r,{strict:!1}),i=e.filter((e=>n?"function"===e.type?QO(e)===r:"event"===e.type&&DO(e)===r:"name"in e&&e.name===r));if(0===i.length)return;if(1===i.length)return i[0];let o;for(const e of i){if(!("inputs"in e))continue;if(!t||0===t.length){if(!e.inputs||0===e.inputs.length)return e;continue}if(!e.inputs)continue;if(0===e.inputs.length)continue;if(e.inputs.length!==t.length)continue;const r=t.every(((t,r)=>{const n="inputs"in e&&e.inputs[r];return!!n&&tM(t,n)}));if(r){if(o&&"inputs"in o&&o.inputs){const r=rM(e.inputs,o.inputs,t);if(r)throw new xT({abiItem:e,type:r[0]},{abiItem:o,type:r[1]})}o=e}}return o||i[0]}function tM(e,t){const r=typeof e,n=t.type;switch(n){case"address":return HO(e);case"bool":return"boolean"===r;case"function":case"string":return"string"===r;default:return"tuple"===n&&"components"in t?Object.values(t.components).every(((t,r)=>tM(Object.values(e)[r],t))):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?"number"===r||"bigint"===r:/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?"string"===r||e instanceof Uint8Array:!!/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)&&(Array.isArray(e)&&e.every((e=>tM(e,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")}))))}}function rM(e,t,r){for(const n in e){const i=e[n],o=t[n];if("tuple"===i.type&&"tuple"===o.type&&"components"in i&&"components"in o)return rM(i.components,o.components,r[n]);const a=[i.type,o.type];if(!(!a.includes("address")||!a.includes("bytes20"))||(a.includes("address")&&a.includes("string")||!(!a.includes("address")||!a.includes("bytes")))&&HO(r[n]))return a}}function nM({abi:e,eventName:t,args:r}){let n=e[0];if(t&&(n=eM({abi:e,args:r,name:t}),!n))throw new vT(t,{docsPath:"/docs/contract/encodeEventTopics"});if("event"!==n.type)throw new vT(void 0,{docsPath:"/docs/contract/encodeEventTopics"});const i=nT(n),o=DO(i);let a=[];if(r&&"inputs"in n){const e=n.inputs?.filter((e=>"indexed"in e&&e.indexed)),t=Array.isArray(r)?r:Object.values(r).length>0?e?.map((e=>r[e.name]))??[]:[];t.length>0&&(a=e?.map(((e,r)=>Array.isArray(t[r])?t[r].map(((n,i)=>iM({param:e,value:t[r][i]}))):t[r]?iM({param:e,value:t[r]}):null))??[])}return[o,...a]}function iM({param:e,value:t}){if("string"===e.type||"bytes"===e.type)return jO(rO(t));if("tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))throw new CT(e.type);return JO([e],[t])}function oM(e,{method:t}){const r={};return"fallback"===e.transport.type&&e.transport.onResponse?.((({method:e,response:n,status:i,transport:o})=>{"success"===i&&t===e&&(r[n]=o.request)})),t=>r[t]||e.request}async function aM(e,{address:t,abi:r,args:n,eventName:i,fromBlock:o,strict:a,toBlock:s}){const c=oM(e,{method:"eth_newFilter"}),u=i?nM({abi:r,args:n,eventName:i}):void 0,l=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof o?XT(o):o,toBlock:"bigint"==typeof s?XT(s):s,topics:u}]});return{abi:r,args:n,eventName:i,id:l,request:c(l),strict:a,type:"event"}}function sM(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}function cM({abi:e,args:t,functionName:r}){let n=e[0];if(r&&(n=eM({abi:e,args:t,name:r}),!n))throw new wT(r,{docsPath:"/docs/contract/encodeFunctionData"});if("function"!==n.type)throw new wT(void 0,{docsPath:"/docs/contract/encodeFunctionData"});const i=nT(n);return qO([QO(i),("inputs"in n&&n.inputs?JO(n.inputs,t??[]):void 0)??"0x"])}const uM={1:"An `assert` condition failed.",17:"Arithmic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},lM={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},fM={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function dM(e,t){const r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=jO(aO(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());return`0x${i.join("")}`}function hM(e,t){if("0x"===t&&e.length>0)throw new dT;if(aT(t)&&aT(t)<32)throw new fT({data:t,params:e,size:aT(t)});return function({data:e,params:t}){const r=[];let n=0;for(let i=0;i=aT(e))throw new fT({data:e,params:t,size:aT(e)});const o=t[i],{consumed:a,value:s}=pM({data:e,param:o,position:n});r.push(s),n+=a}return r}({data:t,params:e})}function pM({data:e,param:t,position:r}){const n=XO(t.type);if(n){const[i,o]=n;return function(e,{param:t,length:r,position:n}){if(!r){const r=KT(KO(e,n,n+32,{strict:!0})),i=KT(KO(e,r,r+32,{strict:!0}));let o=0;const a=[];for(let n=0;n!e)),i=n?[]:{};let o=0;if(mM(t)){const a=KT(KO(e,r,r+32,{strict:!0}));for(let r=0;r48?GT(e,{signed:r}):KT(e,{signed:r})}}(i,{param:t});if("address"===t.type)return function(e){return{consumed:32,value:dM(KO(e,-20))}}(i);if("bool"===t.type)return function(e){return{consumed:32,value:qT(e)}}(i);throw new IT(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}function mM(e){const{type:t}=e;if("string"===t)return!0;if("bytes"===t)return!0;if(t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some(mM);const r=XO(e.type);return!(!r||!mM({...e,type:r[1]}))}function bM({abi:e,data:t}){const r=KO(t,0,4);if("0x"===r)throw new dT;const n=[...e||[],lM,fM].find((e=>"error"===e.type&&r===QO(nT(e))));if(!n)throw new bT(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:n,args:"inputs"in n&&n.inputs&&n.inputs.length>0?hM(n.inputs,KO(t,4)):void 0,errorName:n.name}}const gM=(e,t,r)=>JSON.stringify(e,((e,r)=>{const n="bigint"==typeof r?r.toString():r;return"function"==typeof t?t(e,n):n}),r);function yM({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map(((e,r)=>`${n&&e.name?`${e.name}: `:""}${"object"==typeof t[r]?gM(t[r]):t[r]}`)).join(", ")})`}const vM={gwei:9,wei:18},wM={ether:-9,wei:9};function EM(e,t){let r=e.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[i,o]=[r.slice(0,r.length-t),r.slice(r.length-t)];return o=o.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${o?`.${o}`:""}`}function AM(e,t="wei"){return EM(e,vM[t])}function xM(e,t="wei"){return EM(e,wM[t])}function _M(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),r=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(r+1)} ${t}`)).join("\n")}let kM=class extends sT{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"})}};class SM extends sT{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidLegacyVError"})}}let PM=class extends sT{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",_M(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}};class IM extends sT{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStorageKeySizeError"})}}let TM=class extends sT{constructor({blockHash:e,blockNumber:t,blockTag:r,hash:n,index:i}){let o="Transaction";r&&void 0!==i&&(o=`Transaction at block time "${r}" at index "${i}"`),e&&void 0!==i&&(o=`Transaction at block hash "${e}" at index "${i}"`),t&&void 0!==i&&(o=`Transaction at block number "${t}" at index "${i}"`),n&&(o=`Transaction with hash "${n}"`),super(`${o} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"})}},OM=class extends sT{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionReceiptNotFoundError"})}},MM=class extends sT{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WaitForTransactionReceiptTimeoutError"})}},CM=class extends sT{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=t?sM(t):void 0,h=_M({from:d?.address,to:l,value:void 0!==f&&`${AM(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${xM(a)} gwei`,maxFeePerGas:void 0!==s&&`${xM(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${xM(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",h].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CallExecutionError"}),this.cause=e}},BM=class extends sT{constructor(e,{abi:t,args:r,contractAddress:n,docsPath:i,functionName:o,sender:a}){const s=eM({abi:t,args:r,name:o}),c=s?yM({abiItem:s,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=_M({address:n&&n,function:s?nT(s,{includeName:!0}):void 0,args:c&&"()"!==c&&`${[...Array(o?.length??0).keys()].map((()=>" ")).join("")}${c}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Contract Call:",u].filter(Boolean)}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionExecutionError"}),this.abi=t,this.args=r,this.cause=e,this.contractAddress=n,this.functionName=o,this.sender=a}},NM=class extends sT{constructor({abi:e,data:t,functionName:r,message:n}){let i,o,a,s,c;if(t&&"0x"!==t)try{o=bM({abi:e,data:t});const{abiItem:r,errorName:n,args:i}=o;if("Error"===n)s=i[0];else if("Panic"===n){const[e]=i;s=uM[e]}else{const e=r?nT(r,{includeName:!0}):void 0,t=r&&i?yM({abiItem:r,args:i,includeFunctionName:!1,includeName:!1}):void 0;a=[e?`Error: ${e}`:"",t&&"()"!==t?` ${[...Array(n?.length??0).keys()].map((()=>" ")).join("")}${t}`:""]}}catch(e){i=e}else n&&(s=n);i instanceof bT&&(c=i.signature,a=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(s&&"execution reverted"!==s||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,s||c].join("\n"):`The contract function "${r}" reverted.`,{cause:i,metaMessages:a}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=s,this.signature=c}},RM=class extends sT{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionZeroDataError"})}},FM=class extends sT{constructor({data:e,message:t}){super(t||""),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RawContractError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}},LM=class extends sT{constructor({body:e,details:t,headers:r,status:n,url:i}){super("HTTP request failed.",{details:t,metaMessages:[n&&`Status: ${n}`,`URL: ${i}`,e&&`Request body: ${gM(e)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=r,this.status=n,this.url=i}};class UM extends sT{constructor({body:e,details:t,url:r}){super("WebSocket request failed.",{details:t,metaMessages:[`URL: ${r}`,`Request body: ${gM(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WebSocketRequestError"})}}let jM=class extends sT{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${r}`,`Request body: ${gM(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}},DM=class extends sT{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${t}`,`Request body: ${gM(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}};let zM=class extends sT{constructor(e,{code:t,docsPath:r,metaMessages:n,shortMessage:i}){super(i,{cause:e,docsPath:r,metaMessages:n||e?.metaMessages}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.code=e instanceof jM?e.code:t??-1}},$M=class extends zM{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}},HM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"})}};Object.defineProperty(HM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});let GM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}};Object.defineProperty(GM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});let qM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}};Object.defineProperty(qM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});let KM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}};Object.defineProperty(KM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});let VM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}};Object.defineProperty(VM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});let WM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}};Object.defineProperty(WM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});let JM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}};Object.defineProperty(JM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});let ZM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}};Object.defineProperty(ZM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});let YM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}};Object.defineProperty(YM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});let XM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}};Object.defineProperty(XM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});let QM=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}};Object.defineProperty(QM,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});let eC=class e extends zM{constructor(t){super(t,{code:e.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}};Object.defineProperty(eC,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});let tC=class e extends $M{constructor(t){super(t,{code:e.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}};Object.defineProperty(tC,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});let rC=class e extends $M{constructor(t){super(t,{code:e.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"})}};Object.defineProperty(rC,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});let nC=class e extends $M{constructor(t){super(t,{code:e.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}};Object.defineProperty(nC,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});let iC=class e extends $M{constructor(t){super(t,{code:e.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}};Object.defineProperty(iC,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});let oC=class e extends $M{constructor(t){super(t,{code:e.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"})}};Object.defineProperty(oC,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});let aC=class e extends $M{constructor(t){super(t,{code:e.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}};Object.defineProperty(aC,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});let sC=class extends zM{constructor(e){super(e,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}};const cC=3;function uC(e,{abi:t,address:r,args:n,docsPath:i,functionName:o,sender:a}){const{code:s,data:c,message:u,shortMessage:l}=e instanceof FM?e:e instanceof sT?e.walk((e=>"data"in e))||e.walk():{},f=e instanceof dT?new RM({functionName:o}):[cC,VM.code].includes(s)&&(c||u||l)?new NM({abi:t,data:"object"==typeof c?c.data:c,functionName:o,message:l??u}):e;return new BM(f,{abi:t,args:n,contractAddress:r,docsPath:i,functionName:o,sender:a})}class lC extends sT{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join("\n"),{docsPath:e,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}let fC=class extends sT{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=_M({from:t?.address,to:l,value:void 0!==f&&`${AM(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${xM(a)} gwei`,maxFeePerGas:void 0!==s&&`${xM(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${xM(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}},dC=class extends sT{constructor({cause:e,message:t}={}){const r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}};Object.defineProperty(dC,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(dC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});let hC=class extends sT{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${xM(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}};Object.defineProperty(hC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});let pC=class extends sT{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${xM(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}};Object.defineProperty(pC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});let mC=class extends sT{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}};Object.defineProperty(mC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});let bC=class extends sT{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}};Object.defineProperty(bC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});let gC=class extends sT{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}};Object.defineProperty(gC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});let yC=class extends sT{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}};Object.defineProperty(yC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});let vC=class extends sT{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}};Object.defineProperty(vC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});let wC=class extends sT{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}};Object.defineProperty(wC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});let EC=class extends sT{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}};Object.defineProperty(EC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});let AC=class extends sT{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${xM(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${xM(r)} gwei`:""}).`].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}};Object.defineProperty(AC,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});let xC=class extends sT{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"})}};function _C(e,t){const r=(e.details||"").toLowerCase(),n=e.walk((e=>e.code===dC.code));return n instanceof sT?new dC({cause:e,message:n.details}):dC.nodeMessage.test(r)?new dC({cause:e,message:e.details}):hC.nodeMessage.test(r)?new hC({cause:e,maxFeePerGas:t?.maxFeePerGas}):pC.nodeMessage.test(r)?new pC({cause:e,maxFeePerGas:t?.maxFeePerGas}):mC.nodeMessage.test(r)?new mC({cause:e,nonce:t?.nonce}):bC.nodeMessage.test(r)?new bC({cause:e,nonce:t?.nonce}):gC.nodeMessage.test(r)?new gC({cause:e,nonce:t?.nonce}):yC.nodeMessage.test(r)?new yC({cause:e}):vC.nodeMessage.test(r)?new vC({cause:e,gas:t?.gas}):wC.nodeMessage.test(r)?new wC({cause:e,gas:t?.gas}):EC.nodeMessage.test(r)?new EC({cause:e}):AC.nodeMessage.test(r)?new AC({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new xC({cause:e})}function kC(e,{format:t}){if(!t)return{};const r={};return function t(n){const i=Object.keys(n);for(const o of i)o in e&&(r[o]=e[o]),n[o]&&"object"==typeof n[o]&&!Array.isArray(n[o])&&t(n[o])}(t(e||{})),r}function SC(e,t){return({exclude:r,format:n})=>({exclude:r,format:e=>{const i=t(e);if(r)for(const e of r)delete i[e];return{...i,...n(e)}},type:e})}const PC={legacy:"0x0",eip2930:"0x1",eip1559:"0x2"};function IC(e){return{...e,gas:void 0!==e.gas?XT(e.gas):void 0,gasPrice:void 0!==e.gasPrice?XT(e.gasPrice):void 0,maxFeePerGas:void 0!==e.maxFeePerGas?XT(e.maxFeePerGas):void 0,maxPriorityFeePerGas:void 0!==e.maxPriorityFeePerGas?XT(e.maxPriorityFeePerGas):void 0,nonce:void 0!==e.nonce?XT(e.nonce):void 0,type:void 0!==e.type?PC[e.type]:void 0,value:void 0!==e.value?XT(e.value):void 0}}const TC=SC("transactionRequest",IC);function OC(e){const{account:t,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:o}=e,a=t?sM(t):void 0;if(a&&!HO(a.address))throw new zO({address:a.address});if(o&&!HO(o))throw new zO({address:o});if(void 0!==r&&(void 0!==n||void 0!==i))throw new kM;if(n&&n>2n**256n-1n)throw new hC({maxFeePerGas:n});if(i&&n&&i>n)throw new AC({maxFeePerGas:n,maxPriorityFeePerGas:i})}let MC=class extends sT{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}},CC=class extends sT{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}},BC=class extends sT{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${xM(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}},NC=class extends sT{constructor({blockHash:e,blockNumber:t}){let r="Block";e&&(r=`Block at hash "${e}"`),t&&(r=`Block at number "${t}"`),super(`${r} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}};const RC={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559"};function FC(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?KT(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?KT(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?RC[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"==typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t}const LC=SC("transaction",FC);function UC(e){const t=e.transactions?.map((e=>"string"==typeof e?e:FC(e)));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,difficulty:e.difficulty?BigInt(e.difficulty):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const jC=SC("block",UC);async function DC(e,{blockHash:t,blockNumber:r,blockTag:n,includeTransactions:i}={}){const o=n??"latest",a=i??!1,s=void 0!==r?XT(r):void 0;let c=null;if(c=t?await e.request({method:"eth_getBlockByHash",params:[t,a]}):await e.request({method:"eth_getBlockByNumber",params:[s||o,a]}),!c)throw new NC({blockHash:t,blockNumber:r});return(e.chain?.formatters?.block?.format||UC)(c)}async function zC(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function $C(e,t){const{block:r,chain:n=e.chain,request:i}=t||{};if("function"==typeof n?.fees?.defaultPriorityFee){const t=r||await rT(e,DC,"getBlock")({});return n.fees.defaultPriorityFee({block:t,client:e,request:i})}if(void 0!==n?.fees?.defaultPriorityFee)return n?.fees?.defaultPriorityFee;try{return GT(await e.request({method:"eth_maxPriorityFeePerGas"}))}catch{const[t,n]=await Promise.all([r?Promise.resolve(r):rT(e,DC,"getBlock")({}),rT(e,zC,"getGasPrice")({})]);if("bigint"!=typeof t.baseFeePerGas)throw new CC;const i=n-t.baseFeePerGas;return i<0n?0n:i}}async function HC(e,t){const{block:r,chain:n=e.chain,request:i,type:o="eip1559"}=t||{},a=await(async()=>"function"==typeof n?.fees?.baseFeeMultiplier?n.fees.baseFeeMultiplier({block:r,client:e,request:i}):n?.fees?.baseFeeMultiplier??1.2)();if(a<1)throw new MC;const s=10**(a.toString().split(".")[1]?.length??0),c=e=>e*BigInt(Math.ceil(a*s))/BigInt(s),u=r||await rT(e,DC,"getBlock")({});if("function"==typeof n?.fees?.estimateFeesPerGas)return n.fees.estimateFeesPerGas({block:r,client:e,multiply:c,request:i,type:o});if("eip1559"===o){if("bigint"!=typeof u.baseFeePerGas)throw new CC;const t=i?.maxPriorityFeePerGas?i.maxPriorityFeePerGas:await $C(e,{block:u,chain:n,request:i}),r=c(u.baseFeePerGas);return{maxFeePerGas:i?.maxFeePerGas??r+t,maxPriorityFeePerGas:t}}return{gasPrice:i?.gasPrice??c(await rT(e,zC,"getGasPrice")({}))}}async function GC(e,{address:t,blockTag:r="latest",blockNumber:n}){return KT(await e.request({method:"eth_getTransactionCount",params:[t,n?XT(n):r]}))}function qC(e){if(e.type)return e.type;if(void 0!==e.maxFeePerGas||void 0!==e.maxPriorityFeePerGas)return"eip1559";if(void 0!==e.gasPrice)return void 0!==e.accessList?"eip2930":"legacy";throw new PM({transaction:e})}async function KC(e,t){const{account:r=e.account,chain:n,gas:i,nonce:o,type:a}=t;if(!r)throw new lC;const s=sM(r),c=await rT(e,DC,"getBlock")({blockTag:"latest"}),u={...t,from:s.address};if(void 0===o&&(u.nonce=await rT(e,GC,"getTransactionCount")({address:s.address,blockTag:"pending"})),void 0===a)try{u.type=qC(u)}catch{u.type="bigint"==typeof c.baseFeePerGas?"eip1559":"legacy"}if("eip1559"===u.type){const{maxFeePerGas:r,maxPriorityFeePerGas:i}=await HC(e,{block:c,chain:n,request:u});if(void 0===t.maxPriorityFeePerGas&&t.maxFeePerGas&&t.maxFeePerGas{const t=_C(e,r);return t instanceof xC?e:t})();return new fC(n,{docsPath:t,...r})}(r,{...t,account:n,chain:e.chain})}}const WC="/docs/contract/decodeEventLog";function JC({abi:e,data:t,strict:r,topics:n}){const i=r??!0,[o,...a]=n;if(!o)throw new gT({docsPath:WC});const s=e.find((e=>"event"===e.type&&o===DO(nT(e))));if(!s||!("name"in s)||"event"!==s.type)throw new yT(o,{docsPath:WC});const{name:c,inputs:u}=s,l=u?.some((e=>!("name"in e&&e.name)));let f=l?[]:{};const d=u.filter((e=>"indexed"in e&&e.indexed));for(let e=0;e!("indexed"in e&&e.indexed)));if(h.length>0)if(t&&"0x"!==t)try{const e=hM(h,t);if(e)if(l)f=[...f,...e];else for(let t=0;t0?f:void 0}}function ZC({param:e,value:t}){if("string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))return t;return(hM([e],t)||[])[0]}function YC(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}async function XC(e,{address:t,blockHash:r,fromBlock:n,toBlock:i,event:o,events:a,args:s,strict:c}={}){const u=c??!1,l=a??(o?[o]:void 0);let f,d=[];return l&&(d=[l.flatMap((e=>nM({abi:[e],eventName:e.name,args:s})))],o&&(d=d[0])),f=r?await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:r}]}):await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:"bigint"==typeof n?XT(n):n,toBlock:"bigint"==typeof i?XT(i):i}]}),f.map((e=>{try{const{eventName:t,args:r}=l?JC({abi:l,data:e.data,topics:e.topics,strict:u}):{eventName:void 0,args:void 0};return YC(e,{args:r,eventName:t})}catch(t){let r,n;if(t instanceof kT||t instanceof ST){if(u)return;r=t.abiItem.name,n=t.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return YC(e,{args:n?[]:{},eventName:r})}})).filter(Boolean)}async function QC(e,{abi:t,address:r,args:n,blockHash:i,eventName:o,fromBlock:a,toBlock:s,strict:c}){const u=o?eM({abi:t,name:o}):void 0,l=u?void 0:t.filter((e=>"event"===e.type));return rT(e,XC,"getLogs")({address:r,args:n,blockHash:i,event:u,events:l,fromBlock:a,toBlock:s,strict:c})}const eB="/docs/contract/decodeFunctionResult";function tB({abi:e,args:t,functionName:r,data:n}){let i=e[0];if(r&&(i=eM({abi:e,args:t,name:r}),!i))throw new wT(r,{docsPath:eB});if("function"!==i.type)throw new wT(void 0,{docsPath:eB});if(!i.outputs)throw new ET(i.name,{docsPath:eB});const o=hM(i.outputs,n);return o&&o.length>1?o:o&&1===o.length?o[0]:void 0}const rB=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],nB=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],iB=[...nB,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],oB=[...nB,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],aB=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],sB=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],cB=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],uB="0x82ad56cb";let lB=class extends sT{constructor({blockNumber:e,chain:t,contract:r}){super(`Chain "${t.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"})}},fB=class extends sT{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}};class dB extends sT{constructor({chainId:e}){super(`Chain ID "${e}" is invalid.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidChainIdError"})}}function hB({blockNumber:e,chain:t,contract:r}){const n=t?.contracts?.[r];if(!n)throw new lB({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new lB({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}const pB=new Map;function mB({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:i}){const o=async()=>{const t=s();a();const r=t.map((({args:e})=>e));0!==r.length&&e(r).then((e=>{i&&Array.isArray(e)&&e.sort(i);for(let r=0;r{for(let r=0;rpB.delete(t),s=()=>pB.get(t)||[],c=e=>pB.set(t,[...s(),e]);return{flush:a,async schedule(e){const t={},i=new Promise(((e,r)=>{t.resolve=e,t.reject=r})),a=r?.([...s().map((({args:e})=>e)),e]);a&&o();return s().length>0?(c({args:e,pendingPromise:t}),i):(c({args:e,pendingPromise:t}),setTimeout(o,n),i)}}}async function bB(e,t){const{account:r=e.account,batch:n=Boolean(e.batch?.multicall),blockNumber:i,blockTag:o="latest",accessList:a,data:s,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:d,to:h,value:p,...m}=t,b=r?sM(r):void 0;try{OC(t);const r=(i?XT(i):void 0)||o,g=e.chain?.formatters?.transactionRequest?.format,y=(g||IC)({...kC(m,{format:g}),from:b?.address,accessList:a,data:s,gas:c,gasPrice:u,maxFeePerGas:l,maxPriorityFeePerGas:f,nonce:d,to:h,value:p});if(n&&function({request:e}){const{data:t,to:r,...n}=e;return!!t&&(!t.startsWith(uB)&&(!!r&&!(Object.values(n).filter((e=>void 0!==e)).length>0)))}({request:y}))try{return await async function(e,t){const{batchSize:r=1024,wait:n=0}="object"==typeof e.batch?.multicall?e.batch.multicall:{},{blockNumber:i,blockTag:o="latest",data:a,multicallAddress:s,to:c}=t;let u=s;if(!u){if(!e.chain)throw new fB;u=hB({blockNumber:i,chain:e.chain,contract:"multicall3"})}const l=i?XT(i):void 0,f=l||o,{schedule:d}=mB({id:`${e.uid}.${f}`,wait:n,shouldSplitBatch(e){const t=e.reduce(((e,{data:t})=>e+(t.length-2)),0);return t>2*r},fn:async t=>{const r=t.map((e=>({allowFailure:!0,callData:e.data,target:e.to}))),n=cM({abi:rB,args:[r],functionName:"aggregate3"}),i=await e.request({method:"eth_call",params:[{data:n,to:u},f]});return tB({abi:rB,args:[r],functionName:"aggregate3",data:i||"0x"})}}),[{returnData:h,success:p}]=await d({data:a,to:c});if(!p)throw new FM({data:h});return"0x"===h?{data:void 0}:{data:h}}(e,{...y,blockNumber:i,blockTag:o})}catch(e){if(!(e instanceof fB||e instanceof lB))throw e}const v=await e.request({method:"eth_call",params:r?[y,r]:[y]});return"0x"===v?{data:void 0}:{data:v}}catch(r){const n=function(e){if(!(e instanceof sT))return;const t=e.walk();return"object"==typeof t.data?t.data.data:t.data}(r),{offchainLookup:i,offchainLookupSignature:o}=await Promise.resolve().then((function(){return vN}));if(n?.slice(0,10)===o&&h)return{data:await i(e,{data:n,to:h})};throw function(e,{docsPath:t,...r}){const n=(()=>{const t=_C(e,r);return t instanceof xC?e:t})();return new CM(n,{docsPath:t,...r})}(r,{...t,account:b,chain:e.chain})}}async function gB(e,{abi:t,address:r,args:n,functionName:i,...o}){const a=cM({abi:t,args:n,functionName:i});try{const{data:s}=await rT(e,bB,"call")({data:a,to:r,...o});return tB({abi:t,args:n,functionName:i,data:s||"0x"})}catch(e){throw uC(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/readContract",functionName:i})}}const yB=new Map,vB=new Map;let wB=0;function EB(e,t,r){const n=++wB,i=()=>yB.get(e)||[],o=()=>{const t=vB.get(e);1===i().length&&t&&t(),(()=>{const t=i();yB.set(e,t.filter((e=>e.id!==n)))})()},a=i();if(yB.set(e,[...a,{id:n,fns:t}]),a&&a.length>0)return o;const s={};for(const e in t)s[e]=(...t)=>{const r=i();if(0!==r.length)for(const n of r)n.fns[e]?.(...t)};const c=r(s);return"function"==typeof c&&vB.set(e,c),o}async function AB(e){return new Promise((t=>setTimeout(t,e)))}function xB(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let i=!0;const o=()=>i=!1;return(async()=>{let a;t&&(a=await e({unpoll:o}));const s=await(r?.(a))??n;await AB(s);const c=async()=>{i&&(await e({unpoll:o}),await AB(n),c())};c()})(),o}const _B=new Map,kB=new Map;async function SB(e,{cacheKey:t,cacheTime:r=1/0}){const n=function(e){const t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:r=>t.set(e,r)}),r=t(e,_B),n=t(e,kB);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}(t),i=n.response.get();if(i&&r>0){if((new Date).getTime()-i.created.getTime()`blockNumber.${e}`;async function IB(e,{cacheTime:t=e.cacheTime,maxAge:r}={}){const n=await SB((()=>e.request({method:"eth_blockNumber"})),{cacheKey:PB(e.uid),cacheTime:r??t});return BigInt(n)}async function TB(e,{filter:t}){const r="strict"in t&&t.strict;return(await t.request({method:"eth_getFilterChanges",params:[t.id]})).map((e=>{if("string"==typeof e)return e;try{const{eventName:n,args:i}="abi"in t&&t.abi?JC({abi:t.abi,data:e.data,topics:e.topics,strict:r}):{eventName:void 0,args:void 0};return YC(e,{args:i,eventName:n})}catch(r){let n,i;if(r instanceof kT||r instanceof ST){if("strict"in t&&t.strict)return;n=r.abiItem.name,i=r.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return YC(e,{args:i?[]:{},eventName:n})}})).filter(Boolean)}async function OB(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}const MB=256;let CB,BB=MB;function NB(e=11){if(!CB||BB+e>2*MB){CB="",BB=0;for(let e=0;e!0)}={}){return new Promise(((i,o)=>{const a=async({count:s=0}={})=>{try{const t=await e();i(t)}catch(e){if(s{const r="function"==typeof t?t({count:s,error:e}):t;r&&await AB(r),a({count:s+1})})({error:e});o(e)}};a()}))}const FB=e=>"code"in e?-1!==e.code&&-32004!==e.code&&-32005!==e.code&&-32042!==e.code&&-32603!==e.code:!!(e instanceof LM&&e.status)&&(403!==e.status&&408!==e.status&&413!==e.status&&429!==e.status&&500!==e.status&&502!==e.status&&503!==e.status&&504!==e.status);function LB(e,{retryDelay:t=150,retryCount:r=3}={}){return async n=>RB((async()=>{try{return await e(n)}catch(e){const t=e;switch(t.code){case HM.code:throw new HM(t);case GM.code:throw new GM(t);case qM.code:throw new qM(t);case KM.code:throw new KM(t);case VM.code:throw new VM(t);case WM.code:throw new WM(t);case JM.code:throw new JM(t);case ZM.code:throw new ZM(t);case YM.code:throw new YM(t);case XM.code:throw new XM(t);case QM.code:throw new QM(t);case eC.code:throw new eC(t);case tC.code:throw new tC(t);case rC.code:throw new rC(t);case nC.code:throw new nC(t);case iC.code:throw new iC(t);case oC.code:throw new oC(t);case aC.code:throw new aC(t);case 5e3:throw new tC(t);default:if(e instanceof sT)throw e;throw new sC(t)}}}),{delay:({count:e,error:r})=>{if(r&&r instanceof LM){const e=r?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*parseInt(e)}return(1<!FB(e)})}function UB({key:e,name:t,request:r,retryCount:n=3,retryDelay:i=150,timeout:o,type:a},s){return{config:{key:e,name:t,request:r,retryCount:n,retryDelay:i,timeout:o,type:a},request:LB(r,{retryCount:n,retryDelay:i}),value:s}}function jB(e,t={}){const{key:r="custom",name:n="Custom Provider",retryDelay:i}=t;return({retryCount:o})=>UB({key:r,name:n,request:e.request.bind(e),retryCount:t.retryCount??o,retryDelay:i,type:"custom"})}let DB=class extends sT{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}};function zB(e,{errorInstance:t=new Error("timed out"),timeout:r,signal:n}){return new Promise(((i,o)=>{(async()=>{let a;try{const s=new AbortController;r>0&&(a=setTimeout((()=>{n?s.abort():o(t)}),r)),i(await e({signal:s?.signal}))}catch(e){"AbortError"===e.name&&o(t),o(e)}finally{clearTimeout(a)}})()}))}let $B=0;const HB={http:async function(e,{body:t,fetchOptions:r={},timeout:n=1e4}){const{headers:i,method:o,signal:a}=r;try{const s=await zB((async({signal:s})=>await fetch(e,{...r,body:Array.isArray(t)?gM(t.map((e=>({jsonrpc:"2.0",id:e.id??$B++,...e})))):gM({jsonrpc:"2.0",id:t.id??$B++,...t}),headers:{...i,"Content-Type":"application/json"},method:o||"POST",signal:a||(n>0?s:void 0)})),{errorInstance:new DM({body:t,url:e}),timeout:n,signal:!0});let c;if(c=s.headers.get("Content-Type")?.startsWith("application/json")?await s.json():await s.text(),!s.ok)throw new LM({body:t,details:gM(c.error)||s.statusText,headers:s.headers,status:s.status,url:e});return c}catch(r){if(r instanceof LM)throw r;if(r instanceof DM)throw r;throw new LM({body:t,details:r.message,url:e})}},webSocket:function(e,{body:t,onResponse:r}){if(e.readyState===e.CLOSED||e.readyState===e.CLOSING)throw new UM({body:t,url:e.url,details:"Socket is closed."});const n=$B++,i=({data:o})=>{const a=JSON.parse(o);"number"==typeof a.id&&n!==a.id||(r?.(a),"eth_subscribe"===t.method&&"string"==typeof a.result&&e.subscriptions.set(a.result,i),"eth_unsubscribe"===t.method&&e.subscriptions.delete(t.params?.[0]))};return e.requests.set(n,i),e.send(JSON.stringify({jsonrpc:"2.0",...t,id:n})),e},webSocketAsync:async function(e,{body:t,timeout:r=1e4}){return zB((()=>new Promise((r=>HB.webSocket(e,{body:t,onResponse:r})))),{errorInstance:new DM({body:t,url:e.url}),timeout:r})}};function GB(e,t={}){const{batch:r,fetchOptions:n,key:i="http",name:o="HTTP JSON-RPC",retryDelay:a}=t;return({chain:s,retryCount:c,timeout:u})=>{const{batchSize:l=1e3,wait:f=0}="object"==typeof r?r:{},d=t.retryCount??c,h=u??t.timeout??1e4,p=e||s?.rpcUrls.default.http[0];if(!p)throw new DB;return UB({key:i,name:o,async request({method:t,params:i}){const o={method:t,params:i},{schedule:a}=mB({id:`${e}`,wait:f,shouldSplitBatch:e=>e.length>l,fn:e=>HB.http(p,{body:e,fetchOptions:n,timeout:h}),sort:(e,t)=>e.id-t.id}),[{error:s,result:c}]=await(async e=>r?a(e):[await HB.http(p,{body:e,fetchOptions:n,timeout:h})])(o);if(s)throw new jM({body:o,error:s,url:p});return c},retryCount:d,retryDelay:a,timeout:h,type:"http"},{fetchOptions:n,url:e})}}function qB(e,t){if(!(e instanceof sT))return!1;const r=e.walk((e=>e instanceof NM));return r instanceof NM&&("ResolverNotFound"===r.data?.errorName||("ResolverWildcardNotSupported"===r.data?.errorName||(!!r.reason?.includes("Wildcard on non-extended resolvers is not supported")||"reverse"===t&&r.reason===uM[50])))}function KB(e){if(66!==e.length)return null;if(0!==e.indexOf("["))return null;if(65!==e.indexOf("]"))return null;const t=`0x${e.slice(1,65)}`;return oT(t)?t:null}function VB(e){let t=new Uint8Array(32).fill(0);if(!e)return YT(t);const r=e.split(".");for(let e=r.length-1;e>=0;e-=1){const n=KB(r[e]),i=n?rO(n):jO(aO(r[e]),"bytes");t=jO(GO([t,i]),"bytes")}return YT(t)}function WB(e){return`[${e.slice(2)}]`}function JB(e){const t=new Uint8Array(32).fill(0);return e?KB(e)||jO(aO(e)):YT(t)}function ZB(e){const t=e.replace(/^\.|\.$/gm,"");if(0===t.length)return new Uint8Array(1);const r=new Uint8Array(aO(t).byteLength+2);let n=0;const i=t.split(".");for(let e=0;e255&&(t=aO(WB(JB(i[e])))),r[n]=t.length,r.set(t,n+1),n+=t.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}let YB=class extends sT{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}},XB=class extends sT{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}},QB=class extends sT{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}},eN=class extends sT{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}};const tN=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,rN=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,nN=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,iN=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;function oN(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function aN({uri:e,gatewayUrls:t}){const r=nN.test(e);if(r)return{uri:e,isOnChain:!0,isEncoded:r};const n=oN(t?.ipfs,"https://ipfs.io"),i=oN(t?.arweave,"https://arweave.net"),o=e.match(tN),{protocol:a,subpath:s,target:c,subtarget:u=""}=o?.groups||{},l="ipns:/"===a||"ipns/"===s,f="ipfs:/"===a||"ipfs/"===s||rN.test(e);if(e.startsWith("http")&&!l&&!f){let r=e;return t?.arweave&&(r=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:r,isOnChain:!1,isEncoded:!1}}if((l||f)&&c)return{uri:`${n}/${l?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if("ar:/"===a&&c)return{uri:`${i}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(iN,"");if(d.startsWith("{const r=new Image;r.onload=()=>{t(!0)},r.onerror=()=>{t(!1)},r.src=e}))}}(r);if(i)return r;throw new QB({uri:t})}async function uN(e,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?async function(e,{gatewayUrls:t,record:r}){const n=function(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[r,n,i]=t.split("/"),[o,a]=r.split(":"),[s,c]=n.split(":");if(!o||"eip155"!==o.toLowerCase())throw new XB({reason:"Only EIP-155 supported"});if(!a)throw new XB({reason:"Chain ID not found"});if(!c)throw new XB({reason:"Contract address not found"});if(!i)throw new XB({reason:"Token ID not found"});if(!s)throw new XB({reason:"ERC namespace not found"});return{chainID:parseInt(a),namespace:s.toLowerCase(),contractAddress:c,tokenID:i}}(r),i=await async function(e,{nft:t}){if("erc721"===t.namespace)return gB(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if("erc1155"===t.namespace)return gB(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new eN({namespace:t.namespace})}(e,{nft:n}),{uri:o,isOnChain:a,isEncoded:s}=aN({uri:i,gatewayUrls:t});if(a&&(o.includes("data:application/json;base64,")||o.startsWith("{"))){const e=s?atob(o.replace("data:application/json;base64,","")):o;return cN({uri:sN(JSON.parse(e)),gatewayUrls:t})}let c=n.tokenID;"erc1155"===n.namespace&&(c=c.replace("0x","").padStart(64,"0"));return async function({gatewayUrls:e,uri:t}){try{const r=await fetch(t).then((e=>e.json()));return await cN({gatewayUrls:e,uri:sN(r)})}catch{throw new QB({uri:t})}}({gatewayUrls:t,uri:o.replace(/(?:0x)?{id}/,c)})}(e,{gatewayUrls:t,record:r}):cN({uri:r,gatewayUrls:t})}async function lN(e,{blockNumber:t,blockTag:r,name:n,key:i,universalResolverAddress:o}){let a=o;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=hB({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const o=await rT(e,gB,"readContract")({address:a,abi:iB,functionName:"resolve",args:[JT(ZB(n)),cM({abi:aB,functionName:"text",args:[VB(n),i]})],blockNumber:t,blockTag:r});if("0x"===o[0])return null;const s=tB({abi:aB,functionName:"text",data:o[0]});return""===s?null:s}catch(e){if(qB(e,"resolve"))return null;throw e}}async function fN(e,{address:t,args:r,event:n,events:i,fromBlock:o,strict:a,toBlock:s}={}){const c=i??(n?[n]:void 0),u=oM(e,{method:"eth_newFilter"});let l=[];c&&(l=[c.flatMap((e=>nM({abi:[e],eventName:e.name,args:r})))],n&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof o?XT(o):o,toBlock:"bigint"==typeof s?XT(s):s,...l.length?{topics:l}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:o,id:f,request:u(f),strict:a,toBlock:s,type:"event"}}async function dN(e){const t=oM(e,{method:"eth_newPendingTransactionFilter"}),r=await e.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:t(r),type:"transaction"}}async function hN(e,{blockCount:t,blockNumber:r,blockTag:n="latest",rewardPercentiles:i}){const o=r?XT(r):void 0;return function(e){return{baseFeePerGas:e.baseFeePerGas.map((e=>BigInt(e))),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map((e=>e.map((e=>BigInt(e)))))}}(await e.request({method:"eth_feeHistory",params:[XT(t),o||n,i]}))}let pN=class extends sT{constructor({callbackSelector:e,cause:t,data:r,extraData:n,sender:i,urls:o}){super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],t.metaMessages?.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map((e=>` ${e}`))],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${e}`,` Extra data: ${n}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}},mN=class extends sT{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${t}`,`Response: ${gM(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}},bN=class extends sT{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}};const gN={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function yN({data:e,sender:t,urls:r}){let n=new Error("An unknown error occurred.");for(let i=0;i{for(const r of e){const{name:e,type:n}=r,a=n,s=t[e],c=a.match(xN);if(c&&("number"==typeof s||"bigint"==typeof s)){const[e,t,r]=c;XT(s,{signed:"int"===t,size:parseInt(r)/8})}if("address"===a&&"string"==typeof s&&!HO(s))throw new zO({address:s});const u=a.match(AN);if(u){const[e,t]=u;if(t&&aT(s)!==parseInt(t))throw new _T({expectedSize:parseInt(t),givenSize:aT(s)})}const l=i[a];l&&o(l,s)}};i.EIP712Domain&&e&&o(i.EIP712Domain,e);if("EIP712Domain"!==r){const e=i[r];o(e,t)}}({domain:i,message:t,primaryType:r,types:o});const a=["0x1901"];return i&&a.push(function({domain:e,types:t}){return kN({data:e,primaryType:"EIP712Domain",types:t})}({domain:i,types:o})),"EIP712Domain"!==r&&a.push(kN({data:t,primaryType:r,types:o})),jO(GO(a))}function kN({data:e,primaryType:t,types:r}){return jO(SN({data:e,primaryType:t,types:r}))}function SN({data:e,primaryType:t,types:r}){const n=[{type:"bytes32"}],i=[PN({primaryType:t,types:r})];for(const o of r[t]){const[t,a]=TN({types:r,name:o.name,type:o.type,value:e[o.name]});n.push(t),i.push(a)}return JO(n,i)}function PN({primaryType:e,types:t}){const r=JT(function({primaryType:e,types:t}){let r="";const n=IN({primaryType:e,types:t});n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i)r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`;return r}({primaryType:e,types:t}));return jO(r)}function IN({primaryType:e,types:t},r=new Set){const n=e.match(/^\w*/u),i=n?.[0];if(r.has(i)||void 0===t[i])return r;r.add(i);for(const e of t[i])IN({primaryType:e.type,types:t},r);return r}function TN({types:e,name:t,type:r,value:n}){if(void 0!==e[r])return[{type:"bytes32"},jO(SN({data:n,primaryType:r,types:e}))];if("bytes"===r){return[{type:"bytes32"},jO(n=`0x${(n.length%2?"0":"")+n.slice(2)}`)]}if("string"===r)return[{type:"bytes32"},jO(JT(n))];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),o=n.map((r=>TN({name:t,type:i,types:e,value:r})));return[{type:"bytes32"},jO(JO(o.map((([e])=>e)),o.map((([,e])=>e))))]}return[{type:r},n]}function ON({domain:e}){return["string"==typeof e?.name&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},"number"==typeof e?.chainId&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function MN({abi:e,data:t}){const r=KO(t,0,4),n=e.find((e=>"function"===e.type&&r===QO(nT(e))));if(!n)throw new AT(r,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:n.name,args:"inputs"in n&&n.inputs&&n.inputs.length>0?hM(n.inputs,KO(t,4)):void 0}}const CN="/docs/contract/encodeDeployData";function BN({abi:e,args:t,bytecode:r}){if(!t||0===t.length)return r;const n=e.find((e=>"type"in e&&"constructor"===e.type));if(!n)throw new uT({docsPath:CN});if(!("inputs"in n))throw new lT({docsPath:CN});if(!n.inputs||0===n.inputs.length)throw new lT({docsPath:CN});return qO([r,JO(n.inputs,t)])}function NN(e,t,r=!1){if("address"===e){const e=t;if(!HO(e))throw new zO({address:e});return RT(e.toLowerCase(),{size:r?32:null})}if("string"===e)return eO(t);if("bytes"===e)return t;if("bool"===e)return RT(ZT(t),{size:r?32:1});const n=e.match(xN);if(n){const[e,i,o="256"]=n,a=parseInt(o)/8;return XT(t,{size:r?32:a,signed:"int"===i})}const i=e.match(AN);if(i){const[e,n]=i;if(parseInt(n)!==(t.length-2)/2)throw new _T({expectedSize:parseInt(n),givenSize:(t.length-2)/2});return RT(t,{dir:"right",size:r?32:null})}const o=e.match(EN);if(o&&Array.isArray(t)){const[e,r]=o,n=[];for(let e=0;ethis.bytes.length-1)throw new FN({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new RN({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},incrementPosition(e){if(e<0)throw new RN({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){const e=this.inspectByte();return this.position++,e},readBytes(e){const t=this.inspectBytes(e);return this.position+=e,t},readUint8(){const e=this.inspectUint8();return this.position+=1,e},readUint16(){const e=this.inspectUint16();return this.position+=2,e},readUint24(){const e=this.inspectUint24();return this.position+=3,e},readUint32(){const e=this.inspectUint32();return this.position+=4,e},setPosition(e){this.assertPosition(e),this.position=e}};function UN(e,t="hex"){const r=jN(e),n=function(e){const t=Object.create(LN);return t.bytes=e,t.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),t}(new Uint8Array(r.length));return r.encode(n),"hex"===t?YT(n.bytes):n.bytes}function jN(e){return Array.isArray(e)?function(e){const t=e.reduce(((e,t)=>e+t.length),0),r=DN(t),n=t<=55?1+t:1+r+t;return{length:n,encode(n){t<=55?n.pushByte(192+t):(n.pushByte(247+r),1===r?n.pushUint8(t):2===r?n.pushUint16(t):3===r?n.pushUint24(t):n.pushUint32(t));for(const{encode:t}of e)t(n)}}}(e.map((e=>jN(e)))):function(e){const t="string"==typeof e?oO(e):e,r=DN(t.length),n=1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+r+t.length;return{length:n,encode(e){1===t.length&&t[0]<128?e.pushBytes(t):t.length<=55?(e.pushByte(128+t.length),e.pushBytes(t)):(e.pushByte(183+r),1===r?e.pushUint8(t.length):2===r?e.pushUint16(t.length):3===r?e.pushUint24(t.length):e.pushUint32(t.length),e.pushBytes(t))}}}(e)}function DN(e){if(e<256)return 1;if(e<65536)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new sT("Length is too large.")}const zN={"0x0":"reverted","0x1":"success"};function $N(e){return{...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((e=>YC(e))):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?KT(e.transactionIndex):null,status:e.status?zN[e.status]:null,type:e.type?RC[e.type]||e.type:null}}const HN=SC("transactionReceipt",$N);function GN(e,t){const r="string"==typeof t?{to:t}:t,n=r.to;return"number"===n?function(e,t={}){void 0!==t.size&&$T(e,{size:t.size});const r=YT(e,t);return KT(r)}(e,r):"bigint"===n?function(e,t={}){void 0!==t.size&&$T(e,{size:t.size});const r=YT(e,t);return GT(r)}(e,r):"boolean"===n?function(e,t={}){let r=e;void 0!==t.size&&($T(r,{size:t.size}),r=zT(r));if(r.length>1||r[0]>1)throw new UT(r);return Boolean(r[0])}(e,r):"string"===n?function(e,t={}){let r=e;void 0!==t.size&&($T(r,{size:t.size}),r=zT(r,{dir:"right"}));return(new TextDecoder).decode(r)}(e,r):YT(e,r)}let qN=class extends EO{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=yO(this.buffer)}update(e){lO(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=wO(e)).length;for(let o=0;on-o&&(this.process(r,0),o=0);for(let e=o;e>i&o),s=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,a,n),e.setUint32(t+u,s,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const a=yO(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=s/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^e&r^t&r,VN=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),WN=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),JN=new Uint32Array(64);let ZN=class extends qN{constructor(){super(64,32,8,!1),this.A=0|WN[0],this.B=0|WN[1],this.C=0|WN[2],this.D=0|WN[3],this.E=0|WN[4],this.F=0|WN[5],this.G=0|WN[6],this.H=0|WN[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)JN[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=JN[e-15],r=JN[e-2],n=vO(t,7)^vO(t,18)^t>>>3,i=vO(r,17)^vO(r,19)^r>>>10;JN[e]=i+JN[e-7]+n+JN[e-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(vO(a,6)^vO(a,11)^vO(a,25))+((l=a)&s^~l&c)+VN[e]+JN[e]|0,f=(vO(r,2)^vO(r,13)^vO(r,22))+KN(r,n,i)|0;u=c,c=s,s=a,a=o+t|0,o=i,i=n,n=r,r=t+f|0}var l;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,a,s,c,u)}roundClean(){JN.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const YN=AO((()=>new ZN)),XN="Ethereum Signed Message:\n";function QN(e,t){const r="string"==typeof e?aO(e):e.raw instanceof Uint8Array?e.raw:rO(e.raw);return jO(GO([aO(`${XN}${r.length}`),r]),t)}function eR(e){if(!e||0===e.length)return[];const t=[];for(let r=0;r2n**256n-1n)throw new hC({maxFeePerGas:i});if(r&&i&&r>i)throw new AC({maxFeePerGas:i,maxPriorityFeePerGas:r})}(e);const f=eR(u),d=[JT(r),i?JT(i):"0x",c?JT(c):"0x",s?JT(s):"0x",n?JT(n):"0x",o??"0x",a?JT(a):"0x",l??"0x",f];if(t){const e=0n===t.v?"0x":1n===t.v?JT(1):27n===t.v?"0x":JT(1);d.push(e,zT(t.r),zT(t.s))}return qO(["0x02",UN(d)])}(e,t):"eip2930"===r?function(e,t){const{chainId:r,gas:n,data:i,nonce:o,to:a,value:s,accessList:c,gasPrice:u}=e;!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o}=e;if(t<=0)throw new dB({chainId:t});if(o&&!HO(o))throw new zO({address:o});if(r||i)throw new sT("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(n&&n>2n**256n-1n)throw new hC({maxFeePerGas:n})}(e);const l=eR(c),f=[JT(r),o?JT(o):"0x",u?JT(u):"0x",n?JT(n):"0x",a??"0x",s?JT(s):"0x",i??"0x",l];if(t){const e=0n===t.v?"0x":1n===t.v?JT(1):27n===t.v?"0x":JT(1);f.push(e,zT(t.r),zT(t.s))}return qO(["0x01",UN(f)])}(e,t):function(e,t){const{chainId:r=0,gas:n,data:i,nonce:o,to:a,value:s,gasPrice:c}=e;!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o,accessList:a}=e;if(o&&!HO(o))throw new zO({address:o});if(void 0!==t&&t<=0)throw new dB({chainId:t});if(r||i)throw new sT("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(n&&n>2n**256n-1n)throw new hC({maxFeePerGas:n});if(a)throw new sT("`accessList` is not a valid Legacy Transaction attribute.")}(e);let u=[o?JT(o):"0x",c?JT(c):"0x",n?JT(n):"0x",a??"0x",s?JT(s):"0x",i??"0x"];if(t){const e=(()=>{if(r>0)return BigInt(2*r)+BigInt(35n+t.v-27n);if(t.v>=35n){return(t.v-35n)/2n>0?t.v:27n+(35n===t.v?0n:1n)}const e=27n+(27n===t.v?0n:1n);if(t.v!==e)throw new SM({v:t.v});return e})();u=[...u,JT(e),t.r,t.s]}else r>0&&(u=[...u,JT(r),"0x","0x"]);return UN(u)}(e,t)}function rR(e,t){let[r,n="0"]=e.split(".");const i=r.startsWith("-");if(i&&(r=r.slice(1)),n=n.replace(/(0+)$/,""),0===t)1===Math.round(Number(`.${n}`))&&(r=`${BigInt(r)+1n}`),n="";else if(n.length>t){const[e,i,o]=[n.slice(0,t-1),n.slice(t-1,t),n.slice(t)],a=Math.round(Number(`${i}.${o}`));n=a>9?`${BigInt(e)+BigInt(1)}0`.padStart(e.length+1,"0"):`${e}${a}`,n.length>t&&(n=n.slice(1),r=`${BigInt(r)+1n}`),n=n.slice(0,t)}else n=n.padEnd(t,"0");return BigInt(`${i?"-":""}${r}${n}`)}async function nR(e,{address:t,blockNumber:r,blockTag:n,storageKeys:i}){const o=n??"latest",a=void 0!==r?XT(r):void 0;return function(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?KT(e.nonce):void 0,storageProof:e.storageProof?(t=e.storageProof,t.map((e=>({...e,value:BigInt(e.value)})))):void 0};var t}(await e.request({method:"eth_getProof",params:[t,i,a||o]}))}async function iR(e,{blockHash:t,blockNumber:r,blockTag:n,hash:i,index:o}){const a=n||"latest",s=void 0!==r?XT(r):void 0;let c=null;if(i?c=await e.request({method:"eth_getTransactionByHash",params:[i]}):t?c=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,XT(o)]}):(s||a)&&(c=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[s||a,XT(o)]})),!c)throw new TM({blockHash:t,blockNumber:r,blockTag:a,hash:i,index:o});return(e.chain?.formatters?.transaction?.format||FC)(c)}async function oR(e,{hash:t}){const r=await e.request({method:"eth_getTransactionReceipt",params:[t]});if(!r)throw new OM({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||$N)(r)}const aR="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",sR=BigInt(0),cR=BigInt(1),uR=BigInt(2),lR=e=>e instanceof Uint8Array,fR=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0"))); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function dR(e){if(!lR(e))throw new Error("Uint8Array expected");let t="";for(let r=0;re+t.length),0));let r=0;return e.forEach((e=>{if(!lR(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t}function AR(e,t){if(e.length!==t.length)return!1;for(let r=0;r(uR<new Uint8Array(e),kR=e=>Uint8Array.from(e);function SR(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=_R(e),i=_R(e),o=0;const a=()=>{n.fill(1),i.fill(0),o=0},s=(...e)=>r(i,n,...e),c=(e=_R())=>{i=s(kR([0]),e),n=s(),0!==e.length&&(i=s(kR([1]),e),n=s())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e{let r;for(a(),c(e);!(r=t(u()));)c();return a(),r}}const PR={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function IR(e,t,r={}){const n=(t,r,n)=>{const i=PR[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}var TR=Object.freeze({__proto__:null,bitGet:function(e,t){return e>>BigInt(t)&cR},bitLen:function(e){let t;for(t=0;e>sR;e>>=cR,t+=1);return t},bitMask:xR,bitSet:(e,t,r)=>e|(r?cR:sR)<xB((async()=>{try{const t=await rT(e,IB,"getBlockNumber")({cacheTime:0});if(s){if(t===s)return;if(t-s>1&&r)for(let e=s+1n;es)&&(n.onBlockNumber(t,s),s=t)}catch(e){n.onError?.(e)}}),{emitOnBegin:t,interval:a}))):(()=>{let t=!0,r=()=>t=!1;return(async()=>{try{const{unsubscribe:o}=await e.transport.subscribe({params:["newHeads"],onData(e){if(!t)return;const r=GT(e.result?.number);n(r,s),s=r},onError(e){i?.(e)}});r=o,t||r()}catch(e){i?.(e)}})(),r})()}function CR(e){return{call:t=>bB(e,t),createBlockFilter:()=>async function(e){const t=oM(e,{method:"eth_newBlockFilter"}),r=await e.request({method:"eth_newBlockFilter"});return{id:r,request:t(r),type:"block"}}(e),createContractEventFilter:t=>aM(e,t),createEventFilter:t=>fN(e,t),createPendingTransactionFilter:()=>dN(e),estimateContractGas:t=>async function(e,{abi:t,address:r,args:n,functionName:i,...o}){const a=cM({abi:t,args:n,functionName:i});try{return await rT(e,VC,"estimateGas")({data:a,to:r,...o})}catch(e){const a=o.account?sM(o.account):void 0;throw uC(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/estimateContractGas",functionName:i,sender:a?.address})}}(e,t),estimateGas:t=>VC(e,t),getBalance:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=r?XT(r):void 0,o=await e.request({method:"eth_getBalance",params:[t,i||n]});return BigInt(o)}(e,t),getBlock:t=>DC(e,t),getBlockNumber:t=>IB(e,t),getBlockTransactionCount:t=>async function(e,{blockHash:t,blockNumber:r,blockTag:n="latest"}={}){const i=void 0!==r?XT(r):void 0;let o;return o=t?await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]}):await e.request({method:"eth_getBlockTransactionCountByNumber",params:[i||n]}),KT(o)}(e,t),getBytecode:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=void 0!==r?XT(r):void 0,o=await e.request({method:"eth_getCode",params:[t,i||n]});if("0x"!==o)return o}(e,t),getChainId:()=>async function(e){return KT(await e.request({method:"eth_chainId"}))}(e),getContractEvents:t=>QC(e,t),getEnsAddress:t=>async function(e,{blockNumber:t,blockTag:r,coinType:n,name:i,universalResolverAddress:o}){let a=o;if(!a){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");a=hB({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const o=cM({abi:sB,functionName:"addr",...null!=n?{args:[VB(i),BigInt(n)]}:{args:[VB(i)]}}),s=await rT(e,gB,"readContract")({address:a,abi:iB,functionName:"resolve",args:[JT(ZB(i)),o],blockNumber:t,blockTag:r});if("0x"===s[0])return null;const c=tB({abi:sB,args:null!=n?[VB(i),BigInt(n)]:void 0,functionName:"addr",data:s[0]});return"0x"===c||"0x00"===zT(c)?null:c}catch(e){if(qB(e,"resolve"))return null;throw e}}(e,t),getEnsAvatar:t=>async function(e,{blockNumber:t,blockTag:r,gatewayUrls:n,name:i,universalResolverAddress:o}){const a=await rT(e,lN,"getEnsText")({blockNumber:t,blockTag:r,key:"avatar",name:i,universalResolverAddress:o});if(!a)return null;try{return await uN(e,{record:a,gatewayUrls:n})}catch{return null}}(e,t),getEnsName:t=>async function(e,{address:t,blockNumber:r,blockTag:n,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=hB({blockNumber:r,chain:e.chain,contract:"ensUniversalResolver"})}const a=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const[i,s]=await rT(e,gB,"readContract")({address:o,abi:oB,functionName:"reverse",args:[JT(ZB(a))],blockNumber:r,blockTag:n});return t.toLowerCase()!==s.toLowerCase()?null:i}catch(e){if(qB(e,"reverse"))return null;throw e}}(e,t),getEnsResolver:t=>async function(e,{blockNumber:t,blockTag:r,name:n,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=hB({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}const[a]=await rT(e,gB,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[JT(ZB(n))],blockNumber:t,blockTag:r});return a}(e,t),getEnsText:t=>lN(e,t),getFeeHistory:t=>hN(e,t),estimateFeesPerGas:t=>async function(e,t){return HC(e,t)}(e,t),getFilterChanges:e=>TB(0,e),getFilterLogs:e=>async function(e,{filter:t}){const r=t.strict??!1;return(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map((e=>{try{const{eventName:n,args:i}="abi"in t&&t.abi?JC({abi:t.abi,data:e.data,topics:e.topics,strict:r}):{eventName:void 0,args:void 0};return YC(e,{args:i,eventName:n})}catch(r){let n,i;if(r instanceof kT||r instanceof ST){if("strict"in t&&t.strict)return;n=r.abiItem.name,i=r.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return YC(e,{args:i?[]:{},eventName:n})}})).filter(Boolean)}(0,e),getGasPrice:()=>zC(e),getLogs:t=>XC(e,t),getProof:t=>nR(e,t),estimateMaxPriorityFeePerGas:t=>async function(e,t){return $C(e,t)}(e,t),getStorageAt:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest",slot:i}){const o=void 0!==r?XT(r):void 0;return await e.request({method:"eth_getStorageAt",params:[t,i,o||n]})}(e,t),getTransaction:t=>iR(e,t),getTransactionConfirmations:t=>async function(e,{hash:t,transactionReceipt:r}){const[n,i]=await Promise.all([rT(e,IB,"getBlockNumber")({}),t?rT(e,iR,"getBlockNumber")({hash:t}):void 0]),o=r?.blockNumber||i?.blockNumber;return o?n-o+1n:0n}(e,t),getTransactionCount:t=>GC(e,t),getTransactionReceipt:t=>oR(e,t),multicall:t=>async function(e,t){const{allowFailure:r=!0,batchSize:n,blockNumber:i,blockTag:o,contracts:a,multicallAddress:s}=t,c=n??("object"==typeof e.batch?.multicall&&e.batch.multicall.batchSize||1024);let u=s;if(!u){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");u=hB({blockNumber:i,chain:e.chain,contract:"multicall3"})}const l=[[]];let f=0,d=0;for(let e=0;e0&&d>c&&l[f].length>0&&(f++,d=(e.length-2)/2,l[f]=[]),l[f]=[...l[f],{allowFailure:!0,callData:e,target:n}]}catch(e){const a=uC(e,{abi:t,address:n,args:i,docsPath:"/docs/contract/multicall",functionName:o});if(!r)throw a;l[f]=[...l[f],{allowFailure:!0,callData:"0x",target:n}]}}const h=await Promise.allSettled(l.map((t=>rT(e,gB,"readContract")({abi:rB,address:u,args:[t],blockNumber:i,blockTag:o,functionName:"aggregate3"})))),p=[];for(let e=0;eKC(e,t),readContract:t=>gB(e,t),sendRawTransaction:t=>async function(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]})}(e,t),simulateContract:t=>async function(e,{abi:t,address:r,args:n,dataSuffix:i,functionName:o,...a}){const s=a.account?sM(a.account):void 0,c=cM({abi:t,args:n,functionName:o});try{const{data:s}=await rT(e,bB,"call")({batch:!1,data:`${c}${i?i.replace("0x",""):""}`,to:r,...a});return{result:tB({abi:t,args:n,functionName:o,data:s||"0x"}),request:{abi:t,address:r,args:n,dataSuffix:i,functionName:o,...a}}}catch(e){throw uC(e,{abi:t,address:r,args:n,docsPath:"/docs/contract/simulateContract",functionName:o,sender:s?.address})}}(e,t),verifyMessage:t=>async function(e,{address:t,message:r,signature:n,...i}){return OR(e,{address:t,hash:QN(r),signature:n,...i})}(e,t),verifyTypedData:t=>async function(e,{address:t,signature:r,message:n,primaryType:i,types:o,domain:a,...s}){return OR(e,{address:t,hash:_N({message:n,primaryType:i,types:o,domain:a}),signature:r,...s})}(e,t),uninstallFilter:e=>OB(0,e),waitForTransactionReceipt:t=>async function(e,{confirmations:t=1,hash:r,onReplaced:n,pollingInterval:i=e.pollingInterval,timeout:o}){const a=gM(["waitForTransactionReceipt",e.uid,r]);let s,c,u,l=!1;return new Promise(((f,d)=>{o&&setTimeout((()=>d(new MM({hash:r}))),o);const h=EB(a,{onReplaced:n,resolve:f,reject:d},(n=>{const o=rT(e,MR,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:i,async onBlockNumber(i){if(l)return;let a=i;const f=e=>{o(),e(),h()};try{if(u){if(t>1&&(!u.blockNumber||a-u.blockNumber+1nn.resolve(u)))}if(s||(l=!0,await RB((async()=>{s=await rT(e,iR,"getTransaction")({hash:r}),s.blockNumber&&(a=s.blockNumber)}),{delay:({count:e})=>200*(1<1&&(!u.blockNumber||a-u.blockNumber+1nn.resolve(u)))}catch(r){if(s&&(r instanceof TM||r instanceof OM))try{c=s,l=!0;const r=await RB((()=>rT(e,DC,"getBlock")({blockNumber:a,includeTransactions:!0})),{delay:({count:e})=>200*(1<e instanceof NC});l=!1;const i=r.transactions.find((({from:e,nonce:t})=>e===c.from&&t===c.nonce));if(!i)return;if(u=await rT(e,oR,"getTransactionReceipt")({hash:i.hash}),t>1&&(!u.blockNumber||a-u.blockNumber+1n{n.onReplaced?.({reason:o,replacedTransaction:c,transaction:i,transactionReceipt:u}),n.resolve(u)}))}catch(e){f((()=>n.reject(e)))}else f((()=>n.reject(r)))}}})}))}))}(e,t),watchBlocks:t=>function(e,{blockTag:t="latest",emitMissed:r=!1,emitOnBegin:n=!1,onBlock:i,onError:o,includeTransactions:a,poll:s,pollingInterval:c=e.pollingInterval}){const u=void 0!==s?s:"webSocket"!==e.transport.type,l=a??!1;let f;return u?EB(gM(["watchBlocks",e.uid,r,n,l,c]),{onBlock:i,onError:o},(i=>xB((async()=>{try{const n=await rT(e,DC,"getBlock")({blockTag:t,includeTransactions:l});if(n.number&&f?.number){if(n.number===f.number)return;if(n.number-f.number>1&&r)for(let t=f?.number+1n;tf.number)&&(i.onBlock(n,f),f=n)}catch(e){i.onError?.(e)}}),{emitOnBegin:n,interval:c}))):(()=>{let t=!0,r=()=>t=!1;return(async()=>{try{const{unsubscribe:n}=await e.transport.subscribe({params:["newHeads"],onData(r){if(!t)return;const n=(e.chain?.formatters?.block?.format||UC)(r.result);i(n,f),f=n},onError(e){o?.(e)}});r=n,t||r()}catch(e){o?.(e)}})(),r})()}(e,t),watchBlockNumber:t=>MR(e,t),watchContractEvent:t=>function(e,{abi:t,address:r,args:n,batch:i=!0,eventName:o,onError:a,onLogs:s,poll:c,pollingInterval:u=e.pollingInterval,strict:l}){return(void 0!==c?c:"webSocket"!==e.transport.type)?(()=>{const c=gM(["watchContractEvent",r,n,i,e.uid,o,u]),f=l??!1;return EB(c,{onLogs:s,onError:a},(a=>{let s,c,l=!1;const d=xB((async()=>{if(l)try{let u;if(c)u=await rT(e,TB,"getFilterChanges")({filter:c});else{const i=await rT(e,IB,"getBlockNumber")({});u=s&&s!==i?await rT(e,QC,"getContractEvents")({abi:t,address:r,args:n,eventName:o,fromBlock:s+1n,toBlock:i,strict:f}):[],s=i}if(0===u.length)return;if(i)a.onLogs(u);else for(const e of u)a.onLogs([e])}catch(e){c&&e instanceof WM&&(l=!1),a.onError?.(e)}else{try{c=await rT(e,aM,"createContractEventFilter")({abi:t,address:r,args:n,eventName:o,strict:f})}catch{}l=!0}}),{emitOnBegin:!0,interval:u});return async()=>{c&&await rT(e,OB,"uninstallFilter")({filter:c}),d()}}))})():(()=>{let i=!0,c=()=>i=!1;return(async()=>{try{const u=o?nM({abi:t,eventName:o,args:n}):[],{unsubscribe:f}=await e.transport.subscribe({params:["logs",{address:r,topics:u}],onData(e){if(!i)return;const r=e.result;try{const{eventName:e,args:n}=JC({abi:t,data:r.data,topics:r.topics,strict:l}),i=YC(r,{args:n,eventName:e});s([i])}catch(e){let t,n;if(e instanceof kT||e instanceof ST){if(l)return;t=e.abiItem.name,n=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const i=YC(r,{args:n?[]:{},eventName:t});s([i])}},onError(e){a?.(e)}});c=f,i||c()}catch(e){a?.(e)}})(),c})()}(e,t),watchEvent:t=>function(e,{address:t,args:r,batch:n=!0,event:i,events:o,onError:a,onLogs:s,poll:c,pollingInterval:u=e.pollingInterval,strict:l}){const f=void 0!==c?c:"webSocket"!==e.transport.type,d=l??!1;return f?EB(gM(["watchEvent",t,r,n,e.uid,i,u]),{onLogs:s,onError:a},(a=>{let s,c,l=!1;const f=xB((async()=>{if(l)try{let u;if(c)u=await rT(e,TB,"getFilterChanges")({filter:c});else{const n=await rT(e,IB,"getBlockNumber")({});u=s&&s!==n?await rT(e,XC,"getLogs")({address:t,args:r,event:i,events:o,fromBlock:s+1n,toBlock:n}):[],s=n}if(0===u.length)return;if(n)a.onLogs(u);else for(const e of u)a.onLogs([e])}catch(e){c&&e instanceof WM&&(l=!1),a.onError?.(e)}else{try{c=await rT(e,fN,"createEventFilter")({address:t,args:r,event:i,events:o,strict:d})}catch{}l=!0}}),{emitOnBegin:!0,interval:u});return async()=>{c&&await rT(e,OB,"uninstallFilter")({filter:c}),f()}})):(()=>{let n=!0,c=()=>n=!1;return(async()=>{try{const u=o??(i?[i]:void 0);let f=[];u&&(f=[u.flatMap((e=>nM({abi:[e],eventName:e.name,args:r})))],i&&(f=f[0]));const{unsubscribe:h}=await e.transport.subscribe({params:["logs",{address:t,topics:f}],onData(e){if(!n)return;const t=e.result;try{const{eventName:e,args:r}=JC({abi:u,data:t.data,topics:t.topics,strict:d}),n=YC(t,{args:r,eventName:e});s([n])}catch(e){let r,n;if(e instanceof kT||e instanceof ST){if(l)return;r=e.abiItem.name,n=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const i=YC(t,{args:n?[]:{},eventName:r});s([i])}},onError(e){a?.(e)}});c=h,n||c()}catch(e){a?.(e)}})(),c})()}(e,t),watchPendingTransactions:t=>function(e,{batch:t=!0,onError:r,onTransactions:n,poll:i,pollingInterval:o=e.pollingInterval}){return(void 0!==i?i:"webSocket"!==e.transport.type)?EB(gM(["watchPendingTransactions",e.uid,t,o]),{onTransactions:n,onError:r},(r=>{let n;const i=xB((async()=>{try{if(!n)try{return void(n=await rT(e,dN,"createPendingTransactionFilter")({}))}catch(e){throw i(),e}const o=await rT(e,TB,"getFilterChanges")({filter:n});if(0===o.length)return;if(t)r.onTransactions(o);else for(const e of o)r.onTransactions([e])}catch(e){r.onError?.(e)}}),{emitOnBegin:!0,interval:o});return async()=>{n&&await rT(e,OB,"uninstallFilter")({filter:n}),i()}})):(()=>{let t=!0,i=()=>t=!1;return(async()=>{try{const{unsubscribe:o}=await e.transport.subscribe({params:["newPendingTransactions"],onData(e){if(!t)return;const r=e.result;n([r])},onError(e){r?.(e)}});i=o,t||i()}catch(e){r?.(e)}})(),i})()}(e,t)}}function BR(e){const{key:t="public",name:r="Public Client"}=e,n=function(e){const{batch:t,cacheTime:r=e.pollingInterval??4e3,key:n="base",name:i="Base Client",pollingInterval:o=4e3,type:a="base"}=e,s=e.chain,c=e.account?sM(e.account):void 0,{config:u,request:l,value:f}=e.transport({chain:s,pollingInterval:o}),d={account:c,batch:t,cacheTime:r,chain:s,key:n,name:i,pollingInterval:o,request:l,transport:{...u,...f},type:a,uid:NB()};return Object.assign(d,{extend:function e(t){return r=>{const n=r(t);for(const e in d)delete n[e];const i={...t,...n};return Object.assign(i,{extend:e(i)})}}(d)})}({...e,key:t,name:r,type:"publicClient"});return n.extend(CR)}const NR=BigInt(0),RR=BigInt(1),FR=BigInt(2),LR=BigInt(3),UR=BigInt(4),jR=BigInt(5),DR=BigInt(8); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function zR(e,t){const r=e%t;return r>=NR?r:t+r}function $R(e,t,r){if(r<=NR||t 0");if(r===RR)return NR;let n=RR;for(;t>NR;)t&RR&&(n=n*e%r),e=e*e%r,t>>=RR;return n}function HR(e,t,r){let n=e;for(;t-- >NR;)n*=n,n%=r;return n}function GR(e,t){if(e===NR||t<=NR)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=zR(e,t),n=t,i=NR,o=RR;for(;r!==NR;){const e=n%r,t=i-o*(n/r);n=r,r=e,i=o,o=t}if(n!==RR)throw new Error("invert: does not exist");return zR(i,t)}function qR(e){if(e%UR===LR){const t=(e+RR)/UR;return function(e,r){const n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw new Error("Cannot find square root");return n}}if(e%DR===jR){const t=(e-jR)/DR;return function(e,r){const n=e.mul(r,FR),i=e.pow(n,t),o=e.mul(r,i),a=e.mul(e.mul(o,FR),i),s=e.mul(o,e.sub(a,e.ONE));if(!e.eql(e.sqr(s),r))throw new Error("Cannot find square root");return s}}return function(e){const t=(e-RR)/FR;let r,n,i;for(r=e-RR,n=0;r%FR===NR;r/=FR,n++);for(i=FR;i(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});IR(e,t)}(e.Fp),IR(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...VR(e.n,e.nBitLength),...e,p:e.Fp.ORDER})} /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:QR,hexToBytes:eF}=TR,tF={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=tF;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");const r=e[1],n=e.subarray(2,r+2);if(!r||n.length!==r)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(0===n[0]&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:QR(n),l:e.subarray(r+2)}},toSig(e){const{Err:t}=tF,r="string"==typeof e?eF(e):e;if(!(r instanceof Uint8Array))throw new Error("ui8a expected");let n=r.length;if(n<2||48!=r[0])throw new t("Invalid signature tag");if(r[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=tF._parseInt(r.subarray(2)),{d:a,l:s}=tF._parseInt(o);if(s.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s:a}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),i=t(r(e.r)),o=n.length/2,a=i.length/2,s=r(o),c=r(a);return`30${r(a+o+4)}02${c}${i}02${s}${n}`}},rF=BigInt(0),nF=BigInt(1);BigInt(2);const iF=BigInt(3);function oF(e){const t=function(e){const t=XR(e);IR(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:r}=t,n=t.toBytes||((e,t,n)=>{const i=t.toAffine();return ER(Uint8Array.from([4]),r.toBytes(i.x),r.toBytes(i.y))}),i=t.fromBytes||(e=>{const t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function o(e){const{a:n,b:i}=t,o=r.sqr(e),a=r.mul(o,e);return r.add(r.add(a,r.mul(e,n)),i)}if(!r.eql(r.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(e){return"bigint"==typeof e&&rFr.eql(e,r.ZERO);return i(t)&&i(n)?f.ZERO:new f(t,n,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}static fromHex(e){const t=f.fromAffine(i(wR("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return f.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:n}=this.toAffine();if(!r.isValid(e)||!r.isValid(n))throw new Error("bad point: x or y not FE");const i=r.sqr(n),a=o(e);if(!r.eql(i,a))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){l(e);const{px:t,py:n,pz:i}=this,{px:o,py:a,pz:s}=e,c=r.eql(r.mul(t,s),r.mul(o,i)),u=r.eql(r.mul(n,s),r.mul(a,i));return c&&u}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){const{a:e,b:n}=t,i=r.mul(n,iF),{px:o,py:a,pz:s}=this;let c=r.ZERO,u=r.ZERO,l=r.ZERO,d=r.mul(o,o),h=r.mul(a,a),p=r.mul(s,s),m=r.mul(o,a);return m=r.add(m,m),l=r.mul(o,s),l=r.add(l,l),c=r.mul(e,l),u=r.mul(i,p),u=r.add(c,u),c=r.sub(h,u),u=r.add(h,u),u=r.mul(c,u),c=r.mul(m,c),l=r.mul(i,l),p=r.mul(e,p),m=r.sub(d,p),m=r.mul(e,m),m=r.add(m,l),l=r.add(d,d),d=r.add(l,d),d=r.add(d,p),d=r.mul(d,m),u=r.add(u,d),p=r.mul(a,s),p=r.add(p,p),d=r.mul(p,m),c=r.sub(c,d),l=r.mul(p,h),l=r.add(l,l),l=r.add(l,l),new f(c,u,l)}add(e){l(e);const{px:n,py:i,pz:o}=this,{px:a,py:s,pz:c}=e;let u=r.ZERO,d=r.ZERO,h=r.ZERO;const p=t.a,m=r.mul(t.b,iF);let b=r.mul(n,a),g=r.mul(i,s),y=r.mul(o,c),v=r.add(n,i),w=r.add(a,s);v=r.mul(v,w),w=r.add(b,g),v=r.sub(v,w),w=r.add(n,o);let E=r.add(a,c);return w=r.mul(w,E),E=r.add(b,y),w=r.sub(w,E),E=r.add(i,o),u=r.add(s,c),E=r.mul(E,u),u=r.add(g,y),E=r.sub(E,u),h=r.mul(p,w),u=r.mul(m,y),h=r.add(u,h),u=r.sub(g,h),h=r.add(g,h),d=r.mul(u,h),g=r.add(b,b),g=r.add(g,b),y=r.mul(p,y),w=r.mul(m,w),g=r.add(g,y),y=r.sub(b,y),y=r.mul(p,y),w=r.add(w,y),b=r.mul(g,w),d=r.add(d,b),b=r.mul(E,w),u=r.mul(v,u),u=r.sub(u,b),b=r.mul(v,g),h=r.mul(E,h),h=r.add(h,b),new f(u,d,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(f.ZERO)}wNAF(e){return h.wNAFCached(this,u,e,(e=>{const t=r.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(f.fromAffine)}))}multiplyUnsafe(e){const n=f.ZERO;if(e===rF)return n;if(s(e),e===nF)return this;const{endo:i}=t;if(!i)return h.unsafeLadder(this,e);let{k1neg:o,k1:a,k2neg:c,k2:u}=i.splitScalar(e),l=n,d=n,p=this;for(;a>rF||u>rF;)a&nF&&(l=l.add(p)),u&nF&&(d=d.add(p)),p=p.double(),a>>=nF,u>>=nF;return o&&(l=l.negate()),c&&(d=d.negate()),d=new f(r.mul(d.px,i.beta),d.py,d.pz),l.add(d)}multiply(e){s(e);let n,i,o=e;const{endo:a}=t;if(a){const{k1neg:e,k1:t,k2neg:s,k2:c}=a.splitScalar(o);let{p:u,f:l}=this.wNAF(t),{p:d,f:p}=this.wNAF(c);u=h.constTimeNegate(e,u),d=h.constTimeNegate(s,d),d=new f(r.mul(d.px,a.beta),d.py,d.pz),n=u.add(d),i=l.add(p)}else{const{p:e,f:t}=this.wNAF(o);n=e,i=t}return f.normalizeZ([n,i])[0]}multiplyAndAddUnsafe(e,t,r){const n=f.BASE,i=(e,t)=>t!==rF&&t!==nF&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){const{px:t,py:n,pz:i}=this,o=this.is0();null==e&&(e=o?r.ONE:r.inv(i));const a=r.mul(t,e),s=r.mul(n,e),c=r.mul(i,e);if(o)return{x:r.ZERO,y:r.ZERO};if(!r.eql(c,r.ONE))throw new Error("invZ was invalid");return{x:a,y:s}}isTorsionFree(){const{h:e,isTorsionFree:r}=t;if(e===nF)return!0;if(r)return r(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:r}=t;return e===nF?this:r?r(f,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),n(f,this,e)}toHex(e=!0){return dR(this.toRawBytes(e))}}f.BASE=new f(t.Gx,t.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);const d=t.nBitLength,h=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>ZR;)r&YR&&(n=n.add(i)),i=i.double(),r>>=YR;return n},precomputeWindow(e,t){const{windows:r,windowSize:i}=n(t),o=[];let a=e,s=a;for(let e=0;e>=d,n>s&&(n-=f,o+=YR);const a=t,h=t+Math.abs(n)-1,p=e%2!=0,m=n<0;0===n?u=u.add(r(p,i[a])):c=c.add(r(m,i[h]))}return{p:c,f:u}},wNAFCached(e,t,r,n){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}}(f,t.endo?Math.ceil(d/2):d);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function aF(e){const t=function(e){const t=XR(e);return IR(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:n}=t,i=r.BYTES+1,o=2*r.BYTES+1;function a(e){return zR(e,n)}function s(e){return GR(e,n)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:f}=oF({...t,toBytes(e,t,n){const i=t.toAffine(),o=r.toBytes(i.x),a=ER;return n?a(Uint8Array.from([t.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(e){const t=e.length,n=e[0],a=e.subarray(1);if(t!==i||2!==n&&3!==n){if(t===o&&4===n){return{x:r.fromBytes(a.subarray(0,r.BYTES)),y:r.fromBytes(a.subarray(r.BYTES,2*r.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}{const e=bR(a);if(!(rF<(s=e)&&sdR(yR(e,t.nByteLength));function h(e){return e>n>>nF}const p=(e,t,r)=>bR(e.slice(t,r));class m{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const r=t.nByteLength;return e=wR("compactSignature",e,2*r),new m(p(e,0,r),p(e,r,2*r))}static fromDER(e){const{r:t,s:r}=tF.toSig(wR("DER",e));return new m(t,r)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new m(this.r,this.s,e)}recoverPublicKey(e){const{r:n,s:i,recovery:o}=this,u=v(wR("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");const l=2===o||3===o?n+t.n:n;if(l>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const f=1&o?"03":"02",h=c.fromHex(f+d(l)),p=s(l),m=a(-u*p),b=a(i*p),g=c.BASE.multiplyAndAddUnsafe(h,m,b);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return h(this.s)}normalizeS(){return this.hasHighS()?new m(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return mR(this.toDERHex())}toDERHex(){return tF.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return mR(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}const b={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=JR(t.n);return function(e,t,r=!1){const n=e.length,i=WR(t),o=JR(t);if(n<16||n1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const a=zR(r?bR(e):gR(e),t-RR)+RR;return r?vR(a,i):yR(a,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function g(e){const t=e instanceof Uint8Array,r="string"==typeof e,n=(t||r)&&e.length;return t?n===i||n===o:r?n===2*i||n===2*o:e instanceof c}const y=t.bits2int||function(e){const r=bR(e),n=8*e.length-t.nBitLength;return n>0?r>>BigInt(n):r},v=t.bits2int_modN||function(e){return a(y(e))},w=xR(t.nBitLength);function E(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(rF<=e&&ee in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:l}=t;let{lowS:d,prehash:p,extraEntropy:b}=i;null==d&&(d=!0),e=wR("msgHash",e),p&&(e=wR("prehashed msgHash",o(e)));const g=v(e),w=u(n),A=[E(w),E(g)];if(null!=b){const e=!0===b?l(r.BYTES):b;A.push(wR("extraEntropy",e))}const _=ER(...A),k=g;return{seed:_,k2sig:function(e){const t=y(e);if(!f(t))return;const r=s(t),n=c.BASE.multiply(t).toAffine(),i=a(n.x);if(i===rF)return;const o=a(r*a(k+i*w));if(o===rF)return;let u=(n.x===i?0:2)|Number(n.y&nF),l=o;return d&&h(o)&&(l=function(e){return h(e)?a(-e):e}(o),u^=1),new m(i,l,u)}}}const x={lowS:t.lowS,prehash:!1},_={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(g(e))throw new Error("first arg must be private key");if(!g(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(r)},sign:function(e,r,n=x){const{seed:i,k2sig:o}=A(e,r,n),a=t;return SR(a.hash.outputLen,a.nByteLength,a.hmac)(i,o)},verify:function(e,r,n,i=_){const o=e;if(r=wR("msgHash",r),n=wR("publicKey",n),"strict"in i)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=i;let f,d;try{if("string"==typeof o||o instanceof Uint8Array)try{f=m.fromDER(o)}catch(e){if(!(e instanceof tF.Err))throw e;f=m.fromCompact(o)}else{if("object"!=typeof o||"bigint"!=typeof o.r||"bigint"!=typeof o.s)throw new Error("PARSE");{const{r:e,s:t}=o;f=new m(e,t)}}d=c.fromHex(n)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&f.hasHighS())return!1;l&&(r=t.hash(r));const{r:h,s:p}=f,b=v(r),g=s(p),y=a(b*g),w=a(h*g),E=c.BASE.multiplyAndAddUnsafe(d,y,w)?.toAffine();return!!E&&a(E.x)===h},ProjectivePoint:c,Signature:m,utils:b}}BigInt(4);let sF=class extends EO{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");cO(e.outputLen),cO(e.blockLen)}(e);const r=wO(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let e=0;enew sF(e,t).update(r).digest(); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ function uF(e){return{hash:e,hmac:(t,...r)=>cF(e,t,function(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let r=0;return e.forEach((e=>{if(!gO(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t}(...r)),randomBytes:xO}}cF.create=(e,t)=>new sF(e,t); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const lF=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),fF=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),dF=BigInt(1),hF=BigInt(2),pF=(e,t)=>(e+t/hF)/t;const mF=function(e,t,r=!1,n={}){if(e<=NR)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=VR(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=qR(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:xR(i),ZERO:NR,ONE:RR,create:t=>zR(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return NR<=t&&te===NR,isOdd:e=>(e&RR)===RR,neg:t=>zR(-t,e),eql:(e,t)=>e===t,sqr:t=>zR(t*t,e),add:(t,r)=>zR(t+r,e),sub:(t,r)=>zR(t-r,e),mul:(t,r)=>zR(t*r,e),pow:(e,t)=>function(e,t,r){if(r 0");if(r===NR)return e.ONE;if(r===RR)return t;let n=e.ONE,i=t;for(;r>NR;)r&RR&&(n=e.mul(n,i)),i=e.sqr(i),r>>=RR;return n}(s,e,t),div:(t,r)=>zR(t*GR(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>GR(t,e),sqrt:n.sqrt||(e=>a(s,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),i=e.inv(n);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),i),r}(s,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?vR(e,o):yR(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return r?gR(e):bR(e)}});return Object.freeze(s)}(lF,void 0,void 0,{sqrt:function(e){const t=lF,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=HR(l,r,t)*l%t,d=HR(f,r,t)*l%t,h=HR(d,hF,t)*u%t,p=HR(h,i,t)*h%t,m=HR(p,o,t)*p%t,b=HR(m,s,t)*m%t,g=HR(b,c,t)*b%t,y=HR(g,s,t)*m%t,v=HR(y,r,t)*l%t,w=HR(v,a,t)*p%t,E=HR(w,n,t)*u%t,A=HR(E,hF,t);if(!mF.eql(mF.sqr(A),e))throw new Error("Cannot find square root");return A}}),bF=function(e,t){const r=t=>aF({...e,...uF(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:mF,n:fF,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=fF,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-dF*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,a=BigInt("0x100000000000000000000000000000000"),s=pF(o*e,t),c=pF(-n*e,t);let u=zR(e-s*r-c*i,t),l=zR(-s*n-c*o,t);const f=u>a,d=l>a;if(f&&(u=t-u),d&&(l=t-l),u>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:d,k2:l}}}},YN);BigInt(0),bF.ProjectivePoint;const gF=wN({id:787,name:"Acala",network:"acala",nativeCurrency:{name:"Acala",symbol:"ACA",decimals:18},rpcUrls:{public:{http:["https://eth-rpc-acala.aca-api.network"],webSocket:["wss://eth-rpc-acala.aca-api.network"]},default:{http:["https://eth-rpc-acala.aca-api.network"],webSocket:["wss://eth-rpc-acala.aca-api.network"]}},blockExplorers:{default:{name:"Acala Blockscout",url:"https://blockscout.acala.network"}},testnet:!1}),yF=wN({id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),vF=wN({id:421613,name:"Arbitrum Goerli",network:"arbitrum-goerli",nativeCurrency:{name:"Arbitrum Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-goerli.g.alchemy.com/v2"],webSocket:["wss://arb-goerli.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-goerli.infura.io/v3"],webSocket:["wss://arbitrum-goerli.infura.io/ws/v3"]},default:{http:["https://goerli-rollup.arbitrum.io/rpc"]},public:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://goerli.arbiscan.io"},default:{name:"Arbiscan",url:"https://goerli.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:88114}},testnet:!0}),wF=wN({id:42170,name:"Arbitrum Nova",network:"arbitrum-nova",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{blast:{http:["https://arbitrum-nova.public.blastapi.io"],webSocket:["wss://arbitrum-nova.public.blastapi.io"]},default:{http:["https://nova.arbitrum.io/rpc"]},public:{http:["https://nova.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://nova.arbiscan.io"},blockScout:{name:"BlockScout",url:"https://nova-explorer.arbitrum.io/"},default:{name:"Arbiscan",url:"https://nova.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1746963}}}),EF=wN({id:592,name:"Astar",network:"astar-mainnet",nativeCurrency:{name:"Astar",symbol:"ASTR",decimals:18},rpcUrls:{public:{http:["https://astar.api.onfinality.io/public"]},default:{http:["https://astar.api.onfinality.io/public"]}},blockExplorers:{default:{name:"Astar Subscan",url:"https://astar.subscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:761794}},testnet:!1}),AF=wN({id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://arb-sepolia.g.alchemy.com/v2"],webSocket:["wss://arb-sepolia.g.alchemy.com/v2"]},default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://sepolia.arbiscan.io"},default:{name:"Arbiscan",url:"https://sepolia.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:81930}},testnet:!0}),xF=wN({id:1261120,name:"Astar zkEVM Testnet zKatana",network:"zKatana",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.zkatana.gelato.digital","https://rpc.startale.com/zkatana"]},public:{http:["https://rpc.zkatana.gelato.digital","https://rpc.startale.com/zkatana"]}},blockExplorers:{blockscout:{name:"Blockscout zKatana chain explorer",url:"https://zkatana.blockscout.com"},default:{name:"zKatana Explorer",url:"https://zkatana.explorer.startale.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:31317}},testnet:!0}),_F=wN({id:1313161554,name:"Aurora",network:"aurora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{infura:{http:["https://aurora-mainnet.infura.io/v3"]},default:{http:["https://mainnet.aurora.dev"]},public:{http:["https://mainnet.aurora.dev"]}},blockExplorers:{etherscan:{name:"Aurorascan",url:"https://aurorascan.dev"},default:{name:"Aurorascan",url:"https://aurorascan.dev"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:62907816}}}),kF=wN({id:1313161555,name:"Aurora Testnet",network:"aurora-testnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{infura:{http:["https://aurora-testnet.infura.io/v3"]},default:{http:["https://testnet.aurora.dev"]},public:{http:["https://testnet.aurora.dev"]}},blockExplorers:{etherscan:{name:"Aurorascan",url:"https://testnet.aurorascan.dev"},default:{name:"Aurorascan",url:"https://testnet.aurorascan.dev"}},testnet:!0}),SF=wN({id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11907934}}}),PF=wN({id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7096959}},testnet:!0}),IF=wN({id:5165,network:"bahamut",name:"Bahamut",nativeCurrency:{name:"Fasttoken",symbol:"FTN",decimals:18},rpcUrls:{default:{http:["https://rpc1.bahamut.io","https://bahamut.publicnode.com","https://rpc2.bahamut.io"],webSocket:["wss://ws1.sahara.bahamutchain.com","wss://bahamut.publicnode.com","wss://ws2.sahara.bahamutchain.com"]},public:{http:["https://rpc1.bahamut.io","https://bahamut.publicnode.com","https://rpc2.bahamut.io"],webSocket:["wss://ws1.sahara.bahamutchain.com","wss://bahamut.publicnode.com","wss://ws2.sahara.bahamutchain.com"]}},blockExplorers:{default:{name:"Ftnscan",url:"https://www.ftnscan.com"}}}),TF={block:jC({format(e){const t=e.transactions?.map((e=>{if("string"==typeof e)return e;const t=FC(e);return"0x7e"===t.typeHex&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?GT(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}));return{transactions:t,stateRoot:e.stateRoot}}}),transaction:LC({format(e){const t={};return"0x7e"===e.type&&(t.isSystemTx=e.isSystemTx,t.mint=e.mint?GT(e.mint):void 0,t.sourceHash=e.sourceHash,t.type="deposit"),t}}),transactionReceipt:HN({format:e=>({l1GasPrice:e.l1GasPrice?GT(e.l1GasPrice):null,l1GasUsed:e.l1GasUsed?GT(e.l1GasUsed):null,l1Fee:e.l1Fee?GT(e.l1Fee):null,l1FeeScalar:e.l1FeeScalar?Number(e.l1FeeScalar):null})})},OF=wN({id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://base-mainnet.g.alchemy.com/v2"],webSocket:["wss://base-mainnet.g.alchemy.com/v2"]},infura:{http:["https://base-mainnet.infura.io/v3"],webSocket:["wss://base-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{blockscout:{name:"Basescout",url:"https://base.blockscout.com"},default:{name:"Basescan",url:"https://basescan.org"},etherscan:{name:"Basescan",url:"https://basescan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022}}},{formatters:TF}),MF=wN({id:84531,network:"base-goerli",name:"Base Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://base-goerli.g.alchemy.com/v2"],webSocket:["wss://base-goerli.g.alchemy.com/v2"]},default:{http:["https://goerli.base.org"]},public:{http:["https://goerli.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://goerli.basescan.org"},default:{name:"Basescan",url:"https://goerli.basescan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1376988}},testnet:!0,sourceId:5},{formatters:TF}),CF=wN({id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://base-sepolia.g.alchemy.com/v2"],webSocket:["wss://base-sepolia.g.alchemy.com/v2"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{blockscout:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"},default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0,sourceId:11155111},{formatters:TF}),BF=wN({id:641230,name:"Bear Network Chain Mainnet",network:"BearNetworkChainMainnet",nativeCurrency:{decimals:18,name:"BearNetworkChain",symbol:"BRNKC"},rpcUrls:{public:{http:["https://brnkc-mainnet.bearnetwork.net"]},default:{http:["https://brnkc-mainnet.bearnetwork.net"]}},blockExplorers:{default:{name:"BrnkScan",url:"https://brnkscan.bearnetwork.net"}}}),NF=wN({id:751230,name:"Bear Network Chain Testnet",network:"BearNetworkChainTestnet",nativeCurrency:{decimals:18,name:"tBRNKC",symbol:"tBRNKC"},rpcUrls:{public:{http:["https://brnkc-test.bearnetwork.net"]},default:{http:["https://brnkc-test.bearnetwork.net"]}},blockExplorers:{default:{name:"BrnkTestScan",url:"https://brnktest-scan.bearnetwork.net"}},testnet:!0}),RF=wN({id:199,name:"BitTorrent",network:"bittorrent-chain-mainnet",nativeCurrency:{name:"BitTorrent",symbol:"BTT",decimals:18},rpcUrls:{default:{http:["https://rpc.bittorrentchain.io"]},public:{http:["https://rpc.bittorrentchain.io"]}},blockExplorers:{etherscan:{name:"Bttcscan",url:"https://bttcscan.com"},default:{name:"Bttcscan",url:"https://bttcscan.com"}}}),FF=wN({id:1028,name:"BitTorrent Chain Testnet",network:"bittorrent-chain-testnet",nativeCurrency:{name:"BitTorrent",symbol:"BTT",decimals:18},rpcUrls:{default:{http:["https://testrpc.bittorrentchain.io"]},public:{http:["https://testrpc.bittorrentchain.io"]}},blockExplorers:{etherscan:{name:"Bttcscan",url:"https://testnet.bttcscan.com"},default:{name:"Bttcscan",url:"https://testnet.bttcscan.com"}},testnet:!0}),LF=wN({id:288,name:"Boba Network",network:"boba",nativeCurrency:{decimals:18,name:"Boba",symbol:"BOBA"},rpcUrls:{default:{http:["https://mainnet.boba.network"]},public:{http:["https://mainnet.boba.network"]}},blockExplorers:{etherscan:{name:"BOBAScan",url:"https://bobascan.com"},default:{name:"BOBAScan",url:"https://bobascan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:446859}}}),UF=wN({id:1039,name:"Bronos",network:"bronos",nativeCurrency:{decimals:18,name:"BRO",symbol:"BRO"},rpcUrls:{default:{http:["https://evm.bronos.org"]},public:{http:["https://evm.bronos.org"]}},blockExplorers:{default:{name:"BronoScan",url:"https://broscan.bronos.org"}}}),jF=wN({id:1038,name:"Bronos Testnet",network:"bronos-testnet",nativeCurrency:{decimals:18,name:"Bronos Coin",symbol:"tBRO"},rpcUrls:{default:{http:["https://evm-testnet.bronos.org"]},public:{http:["https://evm-testnet.bronos.org"]}},blockExplorers:{default:{name:"BronoScan",url:"https://tbroscan.bronos.org"}},testnet:!0}),DF=wN({id:56,name:"BNB Smart Chain",network:"bsc",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://rpc.ankr.com/bsc"]},public:{http:["https://rpc.ankr.com/bsc"]}},blockExplorers:{etherscan:{name:"BscScan",url:"https://bscscan.com"},default:{name:"BscScan",url:"https://bscscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}}),zF=wN({id:97,name:"Binance Smart Chain Testnet",network:"bsc-testnet",nativeCurrency:{decimals:18,name:"BNB",symbol:"tBNB"},rpcUrls:{default:{http:["https://data-seed-prebsc-1-s1.bnbchain.org:8545"]},public:{http:["https://data-seed-prebsc-1-s1.bnbchain.org:8545"]}},blockExplorers:{etherscan:{name:"BscScan",url:"https://testnet.bscscan.com"},default:{name:"BscScan",url:"https://testnet.bscscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:17422483}},testnet:!0}),$F=wN({id:4999,name:"BlackFort Exchange Network",network:"bxn",nativeCurrency:{name:"BlackFort Token",symbol:"BXN",decimals:18},rpcUrls:{default:{http:["https://mainnet.blackfort.network/rpc"]},public:{http:["https://mainnet.blackfort.network/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.blackfort.network"}}}),HF=wN({id:4777,name:"BlackFort Exchange Network Testnet",network:"bxnTestnet",nativeCurrency:{name:"BlackFort Testnet Token",symbol:"TBXN",decimals:18},rpcUrls:{default:{http:["https://testnet.blackfort.network/rpc"]},public:{http:["https://testnet.blackfort.network/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer.blackfort.network"}}}),GF=wN({id:7700,name:"Canto",network:"canto",nativeCurrency:{decimals:18,name:"Canto",symbol:"CANTO"},rpcUrls:{default:{http:["https://canto.gravitychain.io"]},public:{http:["https://canto.gravitychain.io"]}},blockExplorers:{default:{name:"Tuber.Build (Blockscout)",url:"https://tuber.build"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2905789}}});function qF(e){return 0===e||0n===e||null==e||"0"===e||""===e||"string"==typeof e&&("0x"===zT(e).toLowerCase()||"0x00"===zT(e).toLowerCase())}function KF(e){return!qF(e)}function VF(e){return KF(e.maxFeePerGas)&&KF(e.maxPriorityFeePerGas)}function WF(e){return"cip42"===e.type||VF(e)&&(KF(e.feeCurrency)||KF(e.gatewayFeeRecipient)||KF(e.gatewayFee))}function JF(e){return"cip64"===e.type||VF(e)&&KF(e.feeCurrency)&&qF(e.gatewayFee)&&qF(e.gatewayFeeRecipient)}const ZF={block:jC({exclude:["difficulty","gasLimit","mixHash","nonce","uncles"],format(e){const t=e.transactions?.map((e=>"string"==typeof e?e:{...FC(e),feeCurrency:e.feeCurrency,..."0x7b"!==e.type?{gatewayFee:e.gatewayFee?GT(e.gatewayFee):null,gatewayFeeRecipient:e.gatewayFeeRecipient||null}:{}}));return{randomness:e.randomness,transactions:t}}}),transaction:LC({format(e){const t={feeCurrency:e.feeCurrency};return"0x7b"===e.type?t.type="cip64":("0x7c"===e.type&&(t.type="cip42"),t.gatewayFee=e.gatewayFee?GT(e.gatewayFee):null,t.gatewayFeeRecipient=e.gatewayFeeRecipient),t}}),transactionRequest:TC({format(e){const t={feeCurrency:e.feeCurrency};return JF(e)?t.type="0x7b":(WF(e)&&(t.type="0x7c"),t.gatewayFee=void 0!==e.gatewayFee?XT(e.gatewayFee):void 0,t.gatewayFeeRecipient=e.gatewayFeeRecipient),t}})},YF={transaction:(e,t)=>JF(e)?function(e,t){!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o,feeCurrency:a}=e;if(t<=0)throw new dB({chainId:t});if(o&&!HO(o))throw new zO({address:o});if(n)throw new sT("`gasPrice` is not a valid CIP-64 Transaction attribute.");if(KF(i)&&i>XF)throw new hC({maxFeePerGas:i});if(KF(r)&&KF(i)&&r>i)throw new AC({maxFeePerGas:i,maxPriorityFeePerGas:r});if(KF(a)&&!HO(a))throw new sT("`feeCurrency` MUST be a token address for CIP-64 transactions.");if(qF(a))throw new sT("`feeCurrency` must be provided for CIP-64 transactions.")}(e);const{chainId:r,gas:n,nonce:i,to:o,value:a,maxFeePerGas:s,maxPriorityFeePerGas:c,accessList:u,feeCurrency:l,data:f}=e,d=[JT(r),i?JT(i):"0x",c?JT(c):"0x",s?JT(s):"0x",n?JT(n):"0x",o??"0x",a?JT(a):"0x",f??"0x",eR(u),l];t&&d.push(27n===t.v?"0x":JT(1),zT(t.r),zT(t.s));return qO(["0x7b",UN(d)])}(e,t):WF(e)?function(e,t){!function(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:i,to:o,feeCurrency:a,gatewayFee:s,gatewayFeeRecipient:c}=e;if(t<=0)throw new dB({chainId:t});if(o&&!HO(o))throw new zO({address:o});if(n)throw new sT("`gasPrice` is not a valid CIP-42 Transaction attribute.");if(KF(i)&&i>XF)throw new hC({maxFeePerGas:i});if(KF(r)&&KF(i)&&r>i)throw new AC({maxFeePerGas:i,maxPriorityFeePerGas:r});if(KF(s)&&qF(c)||KF(c)&&qF(s))throw new sT("`gatewayFee` and `gatewayFeeRecipient` must be provided together.");if(KF(a)&&!HO(a))throw new sT("`feeCurrency` MUST be a token address for CIP-42 transactions.");if(KF(c)&&!HO(c))throw new zO(c);if(qF(a)&&qF(c))throw new sT("Either `feeCurrency` or `gatewayFeeRecipient` must be provided for CIP-42 transactions.")}(e);const{chainId:r,gas:n,nonce:i,to:o,value:a,maxFeePerGas:s,maxPriorityFeePerGas:c,accessList:u,feeCurrency:l,gatewayFeeRecipient:f,gatewayFee:d,data:h}=e,p=[JT(r),i?JT(i):"0x",c?JT(c):"0x",s?JT(s):"0x",n?JT(n):"0x",l??"0x",f??"0x",d?JT(d):"0x",o??"0x",a?JT(a):"0x",h??"0x",eR(u)];t&&p.push(27n===t.v?"0x":JT(1),zT(t.r),zT(t.s));return qO(["0x7c",UN(p)])}(e,t):tR(e,t)};const XF=2n**256n-1n;const QF=wN({id:42220,name:"Celo",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:13112599}},testnet:!1},{formatters:ZF,serializers:YF}),eL=wN({id:44787,name:"Alfajores",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"A-CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:14569001}},testnet:!0},{formatters:ZF,serializers:YF}),tL=wN({id:88888,name:"Chiliz Chain",network:"chiliz-chain",nativeCurrency:{decimals:18,name:"CHZ",symbol:"CHZ"},rpcUrls:{default:{http:["https://rpc.ankr.com/chiliz","https://chiliz.publicnode.com"]},public:{http:["https://rpc.ankr.com/chiliz","https://chiliz.publicnode.com"]}},blockExplorers:{default:{name:"Chiliz Explorer",url:"https://scan.chiliz.com"}}}),rL=wN({id:17323,name:"Cannoli",network:"celo-cannoli",nativeCurrency:{decimals:18,name:"CELO",symbol:"C-CELO"},rpcUrls:{default:{http:["https://forno.cannoli.celo-testnet.org"]},public:{http:["https://forno.cannoli.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/cannoli"}},contracts:{multicall3:{address:"0x5Acb0aa8BF4E8Ff0d882Ee187140713C12BF9718",blockCreated:87429}},testnet:!0},{formatters:ZF,serializers:YF}),nL=wN({id:61,name:"Ethereum Classic",network:"classic",nativeCurrency:{decimals:18,name:"ETC",symbol:"ETC"},rpcUrls:{default:{http:["https://etc.rivet.link"]},public:{http:["https://etc.rivet.link"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.com/etc/mainnet"}}}),iL=wN({id:1030,name:"Conflux eSpace",network:"cfx-espace",nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:{default:{http:["https://evm.confluxrpc.org"],webSocket:["wss://evm.confluxrpc.org/ws"]},public:{http:["https://evm.confluxrpc.org"],webSocket:["wss://evm.confluxrpc.org/ws"]}},blockExplorers:{default:{name:"ConfluxScan",url:"https://evm.confluxscan.io"}},contracts:{multicall3:{address:"0xEFf0078910f638cd81996cc117bccD3eDf2B072F",blockCreated:68602935}}}),oL=wN({id:71,name:"Conflux eSpace Testnet",network:"cfx-espace-testnet",testnet:!0,nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:{default:{http:["https://evmtestnet.confluxrpc.org"],webSocket:["wss://evmtestnet.confluxrpc.org/ws"]},public:{http:["https://evmtestnet.confluxrpc.org"],webSocket:["wss://evmtestnet.confluxrpc.org/ws"]}},blockExplorers:{default:{name:"ConfluxScan",url:"https://evmtestnet.confluxscan.io"}},contracts:{multicall3:{address:"0xEFf0078910f638cd81996cc117bccD3eDf2B072F",blockCreated:117499050}}}),aL=wN({id:1116,name:"Core Dao",network:"coreDao",nativeCurrency:{decimals:18,name:"Core",symbol:"CORE"},rpcUrls:{public:{http:["https://rpc.coredao.org"]},default:{http:["https://rpc.coredao.org"]}},blockExplorers:{default:{name:"CoreDao",url:"https://scan.coredao.org"},etherscan:{name:"CoreDao",url:"https://scan.coredao.org"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:11907934}},testnet:!1}),sL=wN({id:25,name:"Cronos Mainnet",network:"cronos",nativeCurrency:{decimals:18,name:"Cronos",symbol:"CRO"},rpcUrls:{default:{http:["https://evm.cronos.org"]},public:{http:["https://evm.cronos.org"]}},blockExplorers:{default:{name:"Cronoscan",url:"https://cronoscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1963112}}}),cL=wN({id:338,name:"Cronos Testnet",network:"cronos-testnet",nativeCurrency:{decimals:18,name:"CRO",symbol:"tCRO"},rpcUrls:{default:{http:["https://evm-t3.cronos.org"]},public:{http:["https://evm-t3.cronos.org"]}},blockExplorers:{default:{name:"Cronos Explorer",url:"https://cronos.org/explorer/testnet3"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:10191251}},testnet:!0}),uL=wN({id:3737,network:"crossbell",name:"Crossbell",nativeCurrency:{decimals:18,name:"CSB",symbol:"CSB"},rpcUrls:{default:{http:["https://rpc.crossbell.io"]},public:{http:["https://rpc.crossbell.io"]}},blockExplorers:{default:{name:"CrossScan",url:"https://scan.crossbell.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:38246031}}}),lL=wN({id:53935,name:"DFK Chain",network:"dfk",nativeCurrency:{decimals:18,name:"Jewel",symbol:"JEWEL"},rpcUrls:{default:{http:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"]},public:{http:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"]}},blockExplorers:{etherscan:{name:"DFKSubnetScan",url:"https://subnets.avax.network/defi-kingdoms"},default:{name:"DFKSubnetScan",url:"https://subnets.avax.network/defi-kingdoms"}}}),fL=wN({id:2e3,name:"Dogechain",network:"dogechain",nativeCurrency:{decimals:18,name:"Dogechain",symbol:"DC"},rpcUrls:{default:{http:["https://rpc.dogechain.dog"]},public:{http:["https://rpc.dogechain.dog"]}},blockExplorers:{etherscan:{name:"DogeChainExplorer",url:"https://explorer.dogechain.dog"},default:{name:"DogeChainExplorer",url:"https://explorer.dogechain.dog"}}}),dL=wN({id:2021,name:"Edgeware EdgeEVM Mainnet",network:"edgeware",nativeCurrency:{decimals:18,name:"Edgeware",symbol:"EDG"},rpcUrls:{default:{http:["https://edgeware-evm.jelliedowl.net"]},public:{http:["https://edgeware-evm.jelliedowl.net"]}},blockExplorers:{etherscan:{name:"Edgscan by Bharathcoorg",url:"https://edgscan.live"},default:{name:"Edgscan by Bharathcoorg",url:"https://edgscan.live"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:18117872}}}),hL=wN({id:2022,name:"Beresheet BereEVM Testnet",network:"edgewareTestnet",nativeCurrency:{decimals:18,name:"Testnet EDG",symbol:"tEDG"},rpcUrls:{default:{http:["https://beresheet-evm.jelliedowl.net"]},public:{http:["https://beresheet-evm.jelliedowl.net"]}},blockExplorers:{etherscan:{name:"Edgscan by Bharathcoorg",url:"https://testnet.edgscan.live"},default:{name:"Edgscan by Bharathcoorg",url:"https://testnet.edgscan.live"}}}),pL=wN({id:17777,name:"EOS EVM",network:"eos",nativeCurrency:{decimals:18,name:"EOS",symbol:"EOS"},rpcUrls:{default:{http:["https://api.evm.eosnetwork.com"]},public:{http:["https://api.evm.eosnetwork.com"]}},blockExplorers:{etherscan:{name:"EOS EVM Explorer",url:"https://explorer.evm.eosnetwork.com"},default:{name:"EOS EVM Explorer",url:"https://explorer.evm.eosnetwork.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7943933}}}),mL=wN({id:15557,name:"EOS EVM Testnet",network:"eos",nativeCurrency:{decimals:18,name:"EOS",symbol:"EOS"},rpcUrls:{default:{http:["https://api.testnet.evm.eosnetwork.com"]},public:{http:["https://api.testnet.evm.eosnetwork.com"]}},blockExplorers:{etherscan:{name:"EOS EVM Testnet Explorer",url:"https://explorer.testnet.evm.eosnetwork.com"},default:{name:"EOS EVM Testnet Explorer",url:"https://explorer.testnet.evm.eosnetwork.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9067940}},testnet:!0}),bL=wN({id:9001,name:"Evmos",network:"evmos",nativeCurrency:{decimals:18,name:"Evmos",symbol:"EVMOS"},rpcUrls:{default:{http:["https://eth.bd.evmos.org:8545"]},public:{http:["https://eth.bd.evmos.org:8545"]}},blockExplorers:{default:{name:"Evmos Block Explorer",url:"https://escan.live"}}}),gL=wN({id:9e3,name:"Evmos Testnet",network:"evmos-testnet",nativeCurrency:{decimals:18,name:"Evmos",symbol:"EVMOS"},rpcUrls:{default:{http:["https://eth.bd.evmos.dev:8545"]},public:{http:["https://eth.bd.evmos.dev:8545"]}},blockExplorers:{default:{name:"Evmos Testnet Block Explorer",url:"https://evm.evmos.dev/"}}}),yL=wN({id:1994,name:"Ekta",network:"ekta",nativeCurrency:{decimals:18,name:"EKTA",symbol:"EKTA"},rpcUrls:{public:{http:["https://main.ekta.io"]},default:{http:["https://main.ekta.io"]}},blockExplorers:{default:{name:"Ektascan",url:"https://ektascan.io"}}}),vL=wN({id:1004,name:"Ekta Testnet",network:"ekta-testnet",nativeCurrency:{decimals:18,name:"EKTA",symbol:"EKTA"},rpcUrls:{public:{http:["https://test.ekta.io:8545"]},default:{http:["https://test.ekta.io:8545"]}},blockExplorers:{default:{name:"Test Ektascan",url:"https://test.ektascan.io"}},testnet:!0}),wL=wN({id:250,name:"Fantom",network:"fantom",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpc.ankr.com/fantom"]},public:{http:["https://rpc.ankr.com/fantom"]}},blockExplorers:{etherscan:{name:"FTMScan",url:"https://ftmscan.com"},default:{name:"FTMScan",url:"https://ftmscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:33001987}}}),EL=wN({id:64240,name:"Fantom Sonic Open Testnet",network:"fantom-sonic-testnet",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpcapi.sonic.fantom.network"]},public:{http:["https://rpcapi.sonic.fantom.network"]}},blockExplorers:{default:{name:"Fantom Sonic Open Testnet Explorer",url:"https://public-sonic.fantom.network"}},testnet:!0}),AL=wN({id:4002,name:"Fantom Testnet",network:"fantom-testnet",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpc.testnet.fantom.network"]},public:{http:["https://rpc.testnet.fantom.network"]}},blockExplorers:{etherscan:{name:"FTMScan",url:"https://testnet.ftmscan.com"},default:{name:"FTMScan",url:"https://testnet.ftmscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:8328688}}}),xL=wN({id:12306,name:"Fibo Chain",network:"fibochain",nativeCurrency:{decimals:18,name:"fibo",symbol:"FIBO"},rpcUrls:{default:{http:["https://network.hzroc.art"]},public:{http:["https://network.hzroc.art"]}},blockExplorers:{default:{name:"FiboScan",url:"https://scan.fibochain.org"}}}),_L=wN({id:314,name:"Filecoin Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3328594}}}),kL=wN({id:314159,name:"Filecoin Calibration",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}}),SL=wN({id:3141,name:"Filecoin Hyperspace",network:"filecoin-hyperspace",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.hyperspace.node.glif.io/rpc/v1"]},public:{http:["https://api.hyperspace.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://hyperspace.filfox.info/en"},filscan:{name:"Filscan",url:"https://hyperspace.filscan.io"}}}),PL=wN({id:14,name:"Flare Mainnet",network:"flare-mainnet",nativeCurrency:{decimals:18,name:"flare",symbol:"FLR"},rpcUrls:{default:{http:["https://flare-api.flare.network/ext/C/rpc"]},public:{http:["https://flare-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Flare Explorer",url:"https://flare-explorer.flare.network"}}}),IL=wN({id:114,name:"Coston2",network:"coston2",nativeCurrency:{decimals:18,name:"coston2flare",symbol:"C2FLR"},rpcUrls:{default:{http:["https://coston2-api.flare.network/ext/C/rpc"]},public:{http:["https://coston2-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Coston2 Explorer",url:"https://coston2-explorer.flare.network"}},testnet:!0}),TL=wN({id:31337,name:"Foundry",network:"foundry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]},public:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]}}}),OL=wN({id:122,name:"Fuse",network:"fuse",nativeCurrency:{name:"Fuse",symbol:"FUSE",decimals:18},rpcUrls:{default:{http:["https://rpc.fuse.io"]},public:{http:["https://rpc.fuse.io"]}},blockExplorers:{default:{name:"Fuse Explorer",url:"https://explorer.fuse.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:16146628}}}),ML=wN({id:123,name:"Fuse Sparknet",network:"fuse",nativeCurrency:{name:"Spark",symbol:"SPARK",decimals:18},rpcUrls:{default:{http:["https://rpc.fusespark.io"]},public:{http:["https://rpc.fusespark.io"]}},blockExplorers:{default:{name:"Sparkent Explorer",url:"https://explorer.fusespark.io"}}}),CL=wN({id:4689,name:"IoTeX",network:"iotex",nativeCurrency:{decimals:18,name:"IoTeX",symbol:"IOTX"},rpcUrls:{default:{http:["https://babel-api.mainnet.iotex.io"],webSocket:["wss://babel-api.mainnet.iotex.io"]},public:{http:["https://babel-api.mainnet.iotex.io"],webSocket:["wss://babel-api.mainnet.iotex.io"]}},blockExplorers:{default:{name:"IoTeXScan",url:"https://iotexscan.io"}}}),BL=wN({id:4690,name:"IoTeX Testnet",network:"iotex-testnet",nativeCurrency:{decimals:18,name:"IoTeX",symbol:"IOTX"},rpcUrls:{default:{http:["https://babel-api.testnet.iotex.io"],webSocket:["wss://babel-api.testnet.iotex.io"]},public:{http:["https://babel-api.testnet.iotex.io"],webSocket:["wss://babel-api.testnet.iotex.io"]}},blockExplorers:{default:{name:"IoTeXScan",url:"https://testnet.iotexscan.io"}}}),NL=wN({id:8899,name:"JIBCHAIN L1",network:"jbc",nativeCurrency:{name:"JBC",symbol:"JBC",decimals:18},rpcUrls:{default:{http:["https://rpc-l1.jibchain.net"]},public:{http:["https://rpc-l1.jibchain.net"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp-l1.jibchain.net"}},contracts:{multicall3:{address:"0xc0C8C486D1466C57Efe13C2bf000d4c56F47CBdC",blockCreated:2299048}},testnet:!1}),RL=wN({id:686,name:"Karura",network:"karura",nativeCurrency:{name:"Karura",symbol:"KAR",decimals:18},rpcUrls:{public:{http:["https://eth-rpc-karura.aca-api.network"],webSocket:["wss://eth-rpc-karura.aca-api.network"]},default:{http:["https://eth-rpc-karura.aca-api.network"],webSocket:["wss://eth-rpc-karura.aca-api.network"]}},blockExplorers:{default:{name:"Karura Blockscout",url:"https://blockscout.karura.network"}},testnet:!1}),FL=wN({id:1663,name:"Horizen Gobi Testnet",network:"gobi",nativeCurrency:{decimals:18,name:"Test ZEN",symbol:"tZEN"},rpcUrls:{public:{http:["https://gobi-testnet.horizenlabs.io/ethv1"]},default:{http:["https://gobi-testnet.horizenlabs.io/ethv1"]}},blockExplorers:{default:{name:"Gobi Explorer",url:"https://gobi-explorer.horizen.io"}},contracts:{},testnet:!0}),LL=wN({id:5,network:"goerli",name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-goerli.g.alchemy.com/v2"],webSocket:["wss://eth-goerli.g.alchemy.com/v2"]},infura:{http:["https://goerli.infura.io/v3"],webSocket:["wss://goerli.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/eth_goerli"]},public:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli.etherscan.io"},default:{name:"Etherscan",url:"https://goerli.etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0x56522D00C410a43BFfDF00a9A569489297385790",blockCreated:8765204},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6507670}},testnet:!0}),UL=wN({id:100,name:"Gnosis",network:"gnosis",nativeCurrency:{decimals:18,name:"Gnosis",symbol:"xDAI"},rpcUrls:{default:{http:["https://rpc.gnosischain.com"],webSocket:["wss://rpc.gnosischain.com/wss"]},public:{http:["https://rpc.gnosischain.com"],webSocket:["wss://rpc.gnosischain.com/wss"]}},blockExplorers:{etherscan:{name:"Gnosisscan",url:"https://gnosisscan.io"},default:{name:"Gnosis Chain Explorer",url:"https://blockscout.com/xdai/mainnet"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:21022491}}}),jL=wN({id:10200,name:"Gnosis Chiado",network:"chiado",nativeCurrency:{decimals:18,name:"Gnosis",symbol:"xDAI"},rpcUrls:{default:{http:["https://rpc.chiadochain.net"],webSocket:["wss://rpc.chiadochain.net/wss"]},public:{http:["https://rpc.chiadochain.net"],webSocket:["wss://rpc.chiadochain.net/wss"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.chiadochain.net"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4967313}},testnet:!0}),DL=wN({id:31337,name:"Hardhat",network:"hardhat",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]},public:{http:["http://127.0.0.1:8545"]}}}),zL=wN({id:16666e5,name:"Harmony One",network:"harmony",nativeCurrency:{name:"Harmony",symbol:"ONE",decimals:18},rpcUrls:{public:{http:["https://rpc.ankr.com/harmony"]},default:{http:["https://rpc.ankr.com/harmony"]}},blockExplorers:{default:{name:"Harmony Explorer",url:"https://explorer.harmony.one"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:24185753}}}),$L=wN({id:11235,name:"HAQQ Mainnet",network:"haqq-mainnet",nativeCurrency:{decimals:18,name:"Islamic Coin",symbol:"ISLM"},rpcUrls:{default:{http:["https://rpc.eth.haqq.network"]},public:{http:["https://rpc.eth.haqq.network"]}},blockExplorers:{default:{name:"HAQQ Explorer",url:"https://explorer.haqq.network"}}}),HL=wN({id:54211,name:"HAQQ Testedge 2",network:"haqq-testedge-2",nativeCurrency:{decimals:18,name:"Islamic Coin",symbol:"ISLMT"},rpcUrls:{default:{http:["https://rpc.eth.testedge2.haqq.network"]},public:{http:["https://rpc.eth.testedge2.haqq.network"]}},blockExplorers:{default:{name:"HAQQ Explorer",url:"https://explorer.testedge2.haqq.network"}}}),GL=wN({id:17e3,network:"holesky",name:"Holesky",nativeCurrency:{name:"Holesky Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:77}},testnet:!0}),qL=wN({id:2222,name:"Kava EVM",network:"kava-mainnet",nativeCurrency:{name:"Kava",symbol:"KAVA",decimals:18},rpcUrls:{public:{http:["https://evm.kava.io"]},default:{http:["https://evm.kava.io"]}},blockExplorers:{default:{name:"Kava EVM Explorer",url:"https://kavascan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3661165}},testnet:!1}),KL=wN({id:2221,name:"Kava EVM Testnet",network:"kava-testnet",nativeCurrency:{name:"Kava",symbol:"KAVA",decimals:18},rpcUrls:{public:{http:["https://evm.testnet.kava.io"]},default:{http:["https://evm.testnet.kava.io"]}},blockExplorers:{default:{name:"Kava EVM Testnet Explorer",url:"https://testnet.kavascan.com/"}},contracts:{multicall3:{address:"0xDf1D724A7166261eEB015418fe8c7679BBEa7fd6",blockCreated:7242179}},testnet:!0}),VL=wN({id:8217,name:"Klaytn",network:"klaytn",nativeCurrency:{decimals:18,name:"Klaytn",symbol:"KLAY"},rpcUrls:{default:{http:["https://public-en-cypress.klaytn.net"]},public:{http:["https://public-en-cypress.klaytn.net"]}},blockExplorers:{etherscan:{name:"KlaytnScope",url:"https://scope.klaytn.com"},default:{name:"KlaytnScope",url:"https://scope.klaytn.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:96002415}}}),WL=wN({id:1001,name:"Klaytn Baobab Testnet",network:"klaytn-baobab",nativeCurrency:{decimals:18,name:"Baobab Klaytn",symbol:"KLAY"},rpcUrls:{default:{http:["https://public-en-baobab.klaytn.net"]},public:{http:["https://public-en-baobab.klaytn.net"]}},blockExplorers:{etherscan:{name:"KlaytnScope",url:"https://baobab.klaytnscope.com"},default:{name:"KlaytnScope",url:"https://baobab.klaytnscope.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:123390593}},testnet:!0}),JL=wN({id:255,network:"kroma",name:"Kroma",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://api.kroma.network"]},public:{http:["https://api.kroma.network"]}},blockExplorers:{default:{name:"Kroma Explorer",url:"https://blockscout.kroma.network"}},testnet:!1}),ZL=wN({id:2358,network:"kroma-sepolia",name:"Kroma Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://api.sepolia.kroma.network"]},public:{http:["https://api.sepolia.kroma.network"]}},blockExplorers:{default:{name:"Kroma Sepolia Explorer",url:"https://blockscout.sepolia.kroma.network"}},testnet:!0}),YL=wN({id:59144,name:"Linea Mainnet",network:"linea-mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-mainnet.infura.io/v3"],webSocket:["wss://linea-mainnet.infura.io/ws/v3"]},default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"},blockscout:{name:"Blockscout",url:"https://explorer.linea.build"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:42}},testnet:!1}),XL=wN({id:59140,name:"Linea Goerli Testnet",network:"linea-testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"},blockscout:{name:"Blockscout",url:"https://explorer.goerli.linea.build"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:498623}},testnet:!0}),QL=wN({id:1337,name:"Localhost",network:"localhost",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]},public:{http:["http://127.0.0.1:8545"]}}}),eU=wN({id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]},public:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}}),tU=wN({id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62",blockCreated:16966585},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),rU=wN({id:595,name:"Mandala TC9",network:"mandala",nativeCurrency:{name:"Mandala",symbol:"mACA",decimals:18},rpcUrls:{public:{http:["https://eth-rpc-tc9.aca-staging.network"],webSocket:["wss://eth-rpc-tc9.aca-staging.network"]},default:{http:["https://eth-rpc-tc9.aca-staging.network"],webSocket:["wss://eth-rpc-tc9.aca-staging.network"]}},blockExplorers:{default:{name:"Mandala Blockscout",url:"https://blockscout.mandala.aca-staging.network"}},testnet:!0}),nU=wN({id:169,name:"Manta Pacific Mainnet",network:"manta",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://pacific-rpc.manta.network/http"]},public:{http:["https://pacific-rpc.manta.network/http"]}},blockExplorers:{etherscan:{name:"Manta Explorer",url:"https://pacific-explorer.manta.network"},default:{name:"Manta Explorer",url:"https://pacific-explorer.manta.network"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:332890}}}),iU=wN({id:3441005,name:"Manta Pacific Testnet",network:"manta-testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://manta-testnet.calderachain.xyz/http"]},public:{http:["https://manta-testnet.calderachain.xyz/http"]}},blockExplorers:{etherscan:{name:"Manta Testnet Explorer",url:"https://pacific-explorer.testnet.manta.network"},default:{name:"Manta Testnet Explorer",url:"https://pacific-explorer.testnet.manta.network"}},contracts:{multicall3:{address:"0x211B1643b95Fe76f11eD8880EE810ABD9A4cf56C",blockCreated:419915}},testnet:!0}),oU=wN({id:5e3,name:"Mantle",network:"mantle",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.mantle.xyz"]},public:{http:["https://rpc.mantle.xyz"]}},blockExplorers:{etherscan:{name:"Mantle Explorer",url:"https://explorer.mantle.xyz"},default:{name:"Mantle Explorer",url:"https://explorer.mantle.xyz"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:304717}}}),aU=wN({id:5001,name:"Mantle Testnet",network:"mantle",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.testnet.mantle.xyz"]},public:{http:["https://rpc.testnet.mantle.xyz"]}},blockExplorers:{etherscan:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz"},default:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz"}},testnet:!0}),sU=wN({id:82,name:"Meter",network:"meter",nativeCurrency:{decimals:18,name:"MTR",symbol:"MTR"},rpcUrls:{default:{http:["https://rpc.meter.io"]},public:{http:["https://rpc.meter.io"]}},blockExplorers:{default:{name:"MeterScan",url:"https://scan.meter.io"}}}),cU=wN({id:83,name:"Meter Testnet",network:"meter-testnet",nativeCurrency:{decimals:18,name:"MTR",symbol:"MTR"},rpcUrls:{default:{http:["https://rpctest.meter.io"]},public:{http:["https://rpctest.meter.io"]}},blockExplorers:{default:{name:"MeterTestnetScan",url:"https://scan-warringstakes.meter.io"}}}),uU=wN({id:1088,name:"Metis",network:"andromeda",nativeCurrency:{decimals:18,name:"Metis",symbol:"METIS"},rpcUrls:{default:{http:["https://andromeda.metis.io/?owner=1088"]},public:{http:["https://andromeda.metis.io/?owner=1088"]}},blockExplorers:{default:{name:"Andromeda Explorer",url:"https://andromeda-explorer.metis.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2338552}}}),lU=wN({id:599,name:"Metis Goerli",network:"metis-goerli",nativeCurrency:{decimals:18,name:"Metis Goerli",symbol:"METIS"},rpcUrls:{default:{http:["https://goerli.gateway.metisdevops.link"]},public:{http:["https://goerli.gateway.metisdevops.link"]}},blockExplorers:{default:{name:"Metis Goerli Explorer",url:"https://goerli.explorer.metisdevops.link"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1006207}}}),fU=wN({id:7518,network:"MEVerse",name:"MEVerse Chain Mainnet",nativeCurrency:{decimals:18,name:"MEVerse",symbol:"MEV"},rpcUrls:{default:{http:["https://rpc.meversemainnet.io"]},public:{http:["https://rpc.meversemainnet.io"]}},blockExplorers:{default:{name:"Explorer",url:"https://www.meversescan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:86881340}}}),dU=wN({id:4759,network:"MEVerse Testnet",name:"MEVerse Chain Testnet",nativeCurrency:{decimals:18,name:"MEVerse",symbol:"MEV"},rpcUrls:{default:{http:["https://rpc.meversetestnet.io"]},public:{http:["https://rpc.meversetestnet.io"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.meversescan.io/"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:64371115}},testnet:!0}),hU=wN({id:919,name:"Mode Testnet",network:"mode-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.mode.network"]},public:{http:["https://sepolia.mode.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia.explorer.mode.network"}},contracts:{multicall3:{address:"0xBAba8373113Fb7a68f195deF18732e01aF8eDfCF",blockCreated:3019007}},testnet:!0}),pU=wN({id:1287,name:"Moonbase Alpha",network:"moonbase-alpha",nativeCurrency:{decimals:18,name:"DEV",symbol:"DEV"},rpcUrls:{default:{http:["https://rpc.api.moonbase.moonbeam.network"],webSocket:["wss://wss.api.moonbase.moonbeam.network"]},public:{http:["https://rpc.api.moonbase.moonbeam.network"],webSocket:["wss://wss.api.moonbase.moonbeam.network"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonbase.moonscan.io"},etherscan:{name:"Moonscan",url:"https://moonbase.moonscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1850686}},testnet:!0}),mU=wN({id:1284,name:"Moonbeam",network:"moonbeam",nativeCurrency:{decimals:18,name:"GLMR",symbol:"GLMR"},rpcUrls:{public:{http:["https://moonbeam.public.blastapi.io"],webSocket:["wss://moonbeam.public.blastapi.io"]},default:{http:["https://moonbeam.public.blastapi.io"],webSocket:["wss://moonbeam.public.blastapi.io"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonscan.io"},etherscan:{name:"Moonscan",url:"https://moonscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:609002}},testnet:!1}),bU=wN({id:1281,name:"Moonbeam Development Node",network:"development",nativeCurrency:{decimals:18,name:"DEV",symbol:"DEV"},rpcUrls:{default:{http:["http://127.0.0.1:9944"],webSocket:["wss://127.0.0.1:9944"]},public:{http:["http://127.0.0.1:9944"],webSocket:["wss://127.0.0.1:9944"]}}}),gU=wN({id:1285,name:"Moonriver",network:"moonriver",nativeCurrency:{decimals:18,name:"MOVR",symbol:"MOVR"},rpcUrls:{public:{http:["https://moonriver.public.blastapi.io"],webSocket:["wss://moonriver.public.blastapi.io"]},default:{http:["https://moonriver.public.blastapi.io"],webSocket:["wss://moonriver.public.blastapi.io"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonriver.moonscan.io"},etherscan:{name:"Moonscan",url:"https://moonriver.moonscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1597904}},testnet:!1}),yU=wN({id:245022926,network:"neonDevnet",name:"Neon EVM DevNet",nativeCurrency:{name:"NEON",symbol:"NEON",decimals:18},rpcUrls:{default:{http:["https://devnet.neonevm.org"]},public:{http:["https://devnet.neonevm.org"]}},blockExplorers:{default:{name:"Neonscan",url:"https://devnet.neonscan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:205206112}},testnet:!0}),vU=wN({id:245022934,network:"neonMainnet",name:"Neon EVM MainNet",nativeCurrency:{name:"NEON",symbol:"NEON",decimals:18},rpcUrls:{default:{http:["https://neon-proxy-mainnet.solana.p2p.org"]},public:{http:["https://neon-proxy-mainnet.solana.p2p.org"]}},blockExplorers:{default:{name:"Neonscan",url:"https://neonscan.org"}},contracts:{},testnet:!1}),wU=wN({id:4242,name:"Nexi",network:"nexi",nativeCurrency:{name:"Nexi",symbol:"NEXI",decimals:18},rpcUrls:{default:{http:["https://rpc.chain.nexi.technology"]},public:{http:["https://rpc.chain.nexi.technology"]}},blockExplorers:{etherscan:{name:"NexiScan",url:"https://www.nexiscan.com"},default:{name:"NexiScan",url:"https://www.nexiscan.com"}},contracts:{multicall3:{address:"0x0277A46Cc69A57eE3A6C8c158bA874832F718B8E",blockCreated:25770160}}}),EU=wN({id:240,name:"Nexilix Smart Chain",network:"nexilix",nativeCurrency:{decimals:18,name:"Nexilix",symbol:"NEXILIX"},rpcUrls:{default:{http:["https://rpcurl.pos.nexilix.com"]},public:{http:["https://rpcurl.pos.nexilix.com"]}},blockExplorers:{etherscan:{name:"NexilixScan",url:"https://scan.nexilix.com"},default:{name:"NexilixScan",url:"https://scan.nexilix.com"}},contracts:{multicall3:{address:"0x58381c8e2BF9d0C2C4259cA14BdA9Afe02831244",blockCreated:74448}}}),AU=wN({id:248,name:"Oasys",network:"oasys",nativeCurrency:{name:"Oasys",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.oasys.games"]},public:{http:["https://rpc.mainnet.oasys.games"]}},blockExplorers:{default:{name:"OasysScan",url:"https://scan.oasys.games"}}}),xU=wN({id:4090,network:"oasis-testnet",name:"Oasis Testnet",nativeCurrency:{name:"Fasttoken",symbol:"FTN",decimals:18},rpcUrls:{default:{http:["https://rpc1.oasis.bahamutchain.com"]},public:{http:["https://rpc1.oasis.bahamutchain.com"]}},blockExplorers:{default:{name:"Ftnscan",url:"https://oasis.ftnscan.com"}},testnet:!0}),_U=wN({id:66,name:"OKC",network:"okc",nativeCurrency:{decimals:18,name:"OKT",symbol:"OKT"},rpcUrls:{default:{http:["https://exchainrpc.okex.org"]},public:{http:["https://exchainrpc.okex.org"]}},blockExplorers:{default:{name:"oklink",url:"https://www.oklink.com/okc"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10364792}}}),kU=wN({id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263}}},{formatters:TF}),SU=wN({id:420,name:"Optimism Goerli",network:"optimism-goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-goerli.g.alchemy.com/v2"],webSocket:["wss://opt-goerli.g.alchemy.com/v2"]},infura:{http:["https://optimism-goerli.infura.io/v3"],webSocket:["wss://optimism-goerli.infura.io/ws/v3"]},default:{http:["https://goerli.optimism.io"]},public:{http:["https://goerli.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"},default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:49461}},testnet:!0},{formatters:TF}),PU=wN({id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{alchemy:{http:["https://opt-sepolia.g.alchemy.com/v2"],webSocket:["wss://opt-sepolia.g.alchemy.com/v2"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]}},blockExplorers:{blockscout:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"},default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204}},testnet:!0},{formatters:TF}),IU=wN({id:204,name:"opBNB",network:"opBNB Mainnet",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{public:{http:["https://opbnb-mainnet-rpc.bnbchain.org"]},default:{http:["https://opbnb-mainnet-rpc.bnbchain.org"]}},blockExplorers:{default:{name:"opbnbscan",url:"https://mainnet.opbnbscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:512881}}}),TU=wN({id:5611,name:"opBNB Testnet",network:"opBNB Testnet",nativeCurrency:{decimals:18,name:"tBNB",symbol:"tBNB"},rpcUrls:{public:{http:["https://opbnb-testnet-rpc.bnbchain.org"]},default:{http:["https://opbnb-testnet-rpc.bnbchain.org"]}},blockExplorers:{default:{name:"opbnbscan",url:"https://testnet.opbnbscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3705108}},testnet:!0}),OU=wN({id:424,network:"pgn",name:"PGN",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.publicgoods.network"]},public:{http:["https://rpc.publicgoods.network"]}},blockExplorers:{default:{name:"PGN Explorer",url:"https://explorer.publicgoods.network"},blocksout:{name:"PGN Explorer",url:"https://explorer.publicgoods.network"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3380209}}},{formatters:TF}),MU=wN({id:58008,network:"pgn-testnet",name:"PGN ",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.publicgoods.network"]},public:{http:["https://sepolia.publicgoods.network"]}},blockExplorers:{default:{name:"PGN Testnet Explorer",url:"https://explorer.sepolia.publicgoods.network"},blocksout:{name:"PGN Testnet Explorer",url:"https://explorer.sepolia.publicgoods.network"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3754925}},testnet:!0},{formatters:TF}),CU=wN({id:242,name:"Plinga",network:"plinga",nativeCurrency:{name:"Plinga",symbol:"PLINGA",decimals:18},rpcUrls:{default:{http:["https://rpcurl.mainnet.plgchain.com"]},public:{http:["https://rpcurl.mainnet.plgchain.com"]}},blockExplorers:{default:{name:"Plgscan",url:"https://www.plgscan.com"}},contracts:{multicall3:{address:"0x0989576160f2e7092908BB9479631b901060b6e4",blockCreated:204489}}}),BU=wN({id:137,name:"Polygon",network:"matic",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),NU=wN({id:80001,name:"Polygon Mumbai",network:"maticmum",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{alchemy:{http:["https://polygon-mumbai.g.alchemy.com/v2"],webSocket:["wss://polygon-mumbai.g.alchemy.com/v2"]},infura:{http:["https://polygon-mumbai.infura.io/v3"],webSocket:["wss://polygon-mumbai.infura.io/ws/v3"]},default:{http:["https://rpc.ankr.com/polygon_mumbai"]},public:{http:["https://rpc.ankr.com/polygon_mumbai"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"},default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}},testnet:!0}),RU=wN({id:1442,name:"Polygon zkEVM Testnet",network:"polygon-zkevm-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.public.zkevm-test.net"]},public:{http:["https://rpc.public.zkevm-test.net"]}},blockExplorers:{blockscout:{name:"Blockscout",url:"https://explorer.public.zkevm-test.net"},default:{name:"PolygonScan",url:"https://testnet-zkevm.polygonscan.com"}},testnet:!0,contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:525686}}}),FU=wN({id:1101,name:"Polygon zkEVM",network:"polygon-zkevm",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://zkevm-rpc.com"]},public:{http:["https://zkevm-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://zkevm.polygonscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:57746}}}),LU=wN({id:369,network:"pulsechain",name:"PulseChain",nativeCurrency:{name:"Pulse",symbol:"PLS",decimals:18},testnet:!1,rpcUrls:{default:{http:["https://rpc.pulsechain.com"],webSocket:["wss://ws.pulsechain.com"]},public:{http:["https://rpc.pulsechain.com"],webSocket:["wss://ws.pulsechain.com"]}},blockExplorers:{default:{name:"PulseScan",url:"https://scan.pulsechain.com"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),UU=wN({id:943,network:"pulsechainV4",name:"PulseChain V4",testnet:!0,nativeCurrency:{name:"V4 Pulse",symbol:"v4PLS",decimals:18},rpcUrls:{default:{http:["https://rpc.v4.testnet.pulsechain.com"],webSocket:["wss://ws.v4.testnet.pulsechain.com"]},public:{http:["https://rpc.v4.testnet.pulsechain.com"],webSocket:["wss://ws.v4.testnet.pulsechain.com"]}},blockExplorers:{default:{name:"PulseScan",url:"https://scan.v4.testnet.pulsechain.com"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),jU=wN({id:35441,name:"Q Mainnet",network:"q-mainnet",nativeCurrency:{decimals:18,name:"Q",symbol:"Q"},rpcUrls:{default:{http:["https://rpc.q.org"]},public:{http:["https://rpc.q.org"]}},blockExplorers:{default:{name:"Q Mainnet Explorer",url:"https://explorer.q.org"}}}),DU=wN({id:35443,name:"Q Testnet",network:"q-testnet",nativeCurrency:{decimals:18,name:"Q",symbol:"Q"},rpcUrls:{default:{http:["https://rpc.qtestnet.org"]},public:{http:["https://rpc.qtestnet.org"]}},blockExplorers:{default:{name:"Q Testnet Explorer",url:"https://explorer.qtestnet.org"}},testnet:!0}),zU=wN({id:570,name:"Rollux Mainnet",network:"rollux",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.rollux.com"],webSocket:["wss://rpc.rollux.com/wss"]},public:{http:["https://rollux.public-rpc.com"]}},blockExplorers:{default:{name:"RolluxExplorer",url:"https://explorer.rollux.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:119222}}}),$U=wN({id:57e3,name:"Rollux Testnet",network:"rollux-testnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc-tanenbaum.rollux.com/"],webSocket:["wss://rpc-tanenbaum.rollux.com/wss"]},public:{http:["https://rpc-tanenbaum.rollux.com/"]}},blockExplorers:{default:{name:"RolluxTestnetExplorer",url:"https://rollux.tanenbaum.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1813675}}}),HU=wN({id:2020,name:"Ronin",network:"ronin",nativeCurrency:{name:"RON",symbol:"RON",decimals:18},rpcUrls:{default:{http:["https://api.roninchain.com/rpc"]},public:{http:["https://api.roninchain.com/rpc"]}},blockExplorers:{default:{name:"Ronin Explorer",url:"https://app.roninchain.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:26023535}}}),GU=wN({id:30,name:"Rootstock Mainnet",network:"rootstock",nativeCurrency:{decimals:18,name:"Rootstock Bitcoin",symbol:"RBTC"},rpcUrls:{public:{http:["https://public-node.rsk.co"]},default:{http:["https://public-node.rsk.co"]}},blockExplorers:{blockscout:{name:"Blockscout",url:"https://rootstock.blockscout.com"},default:{name:"RSK Explorer",url:"https://explorer.rsk.co"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4249540}}}),qU=wN({id:2021,name:"Saigon Testnet",network:"saigon",nativeCurrency:{name:"RON",symbol:"RON",decimals:18},rpcUrls:{default:{http:["https://saigon-testnet.roninchain.com/rpc"]},public:{http:["https://saigon-testnet.roninchain.com/rpc"]}},blockExplorers:{default:{name:"Saigon Explorer",url:"https://saigon-explorer.roninchain.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:18736871}},testnet:!0}),KU=wN({id:23294,name:"Oasis Sapphire",network:"sapphire",nativeCurrency:{name:"Sapphire Rose",symbol:"ROSE",decimals:18},rpcUrls:{default:{http:["https://sapphire.oasis.io"],webSocket:["wss://sapphire.oasis.io/ws"]},public:{http:["https://sapphire.oasis.io"],webSocket:["wss://sapphire.oasis.io/ws"]}},blockExplorers:{default:{name:"Oasis Sapphire Explorer",url:"https://explorer.sapphire.oasis.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:734531}}}),VU=wN({id:23295,name:"Oasis Sapphire Testnet",network:"sapphire-testnet",nativeCurrency:{name:"Sapphire Test Rose",symbol:"TEST",decimals:18},rpcUrls:{default:{http:["https://testnet.sapphire.oasis.dev"],webSocket:["wss://testnet.sapphire.oasis.dev/ws"]},public:{http:["https://testnet.sapphire.oasis.dev"],webSocket:["wss://testnet.sapphire.oasis.dev/ws"]}},blockExplorers:{default:{name:"Oasis Sapphire Testnet Explorer",url:"https://testnet.explorer.sapphire.oasis.dev"}},testnet:!0}),WU=wN({id:534352,name:"Scroll",network:"scroll",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.scroll.io"],webSocket:["wss://wss-rpc.scroll.io/ws"]},public:{http:["https://rpc.scroll.io"],webSocket:["wss://wss-rpc.scroll.io/ws"]}},blockExplorers:{default:{name:"Scrollscan",url:"https://scrollscan.com"},blockscout:{name:"Blockscout",url:"https://blockscout.scroll.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14}},testnet:!1}),JU=wN({id:534351,name:"Scroll Sepolia",network:"scroll-sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.scroll.io"]},public:{http:["https://sepolia-rpc.scroll.io"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-blockscout.scroll.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9473}},testnet:!0}),ZU=wN({id:534353,name:"Scroll Testnet",network:"scroll-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://alpha-rpc.scroll.io/l2"],webSocket:["wss://alpha-rpc.scroll.io/l2/ws"]},public:{http:["https://alpha-rpc.scroll.io/l2"],webSocket:["wss://alpha-rpc.scroll.io/l2/ws"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.scroll.io"}},testnet:!0}),YU=wN({id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0x21B000Fd62a880b2125A61e36a284BB757b76025",blockCreated:3914906}},testnet:!0}),XU=wN({id:148,name:"Shimmer",network:"shimmer",nativeCurrency:{decimals:18,name:"Shimmer",symbol:"SMR"},rpcUrls:{public:{http:["https://json-rpc.evm.shimmer.network"]},default:{http:["https://json-rpc.evm.shimmer.network"]}},blockExplorers:{default:{name:"Shimmer Network Explorer",url:"https://explorer.evm.shimmer.network"}}}),QU=wN({id:1073,name:"Shimmer Testnet",network:"shimmer-testnet",nativeCurrency:{decimals:18,name:"Shimmer",symbol:"SMR"},rpcUrls:{public:{http:["https://json-rpc.evm.testnet.shimmer.network"]},default:{http:["https://json-rpc.evm.testnet.shimmer.network"]}},blockExplorers:{default:{name:"Shimmer Network Explorer",url:"https://explorer.evm.testnet.shimmer.network"}},testnet:!0}),ej=wN({id:391845894,name:"SKALE | Block Brawlers",network:"skale-brawl",nativeCurrency:{name:"BRAWL",symbol:"BRAWL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/frayed-decent-antares"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/frayed-decent-antares"]},public:{http:["https://mainnet.skalenodes.com/v1/frayed-decent-antares"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/frayed-decent-antares"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://frayed-decent-antares.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://frayed-decent-antares.explorer.mainnet.skalenodes.com"}},contracts:{}}),tj=wN({id:1564830818,name:"SKALE | Calypso NFT Hub",network:"skale-calypso",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/honorable-steel-rasalhague"]},public:{http:["https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/honorable-steel-rasalhague"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3107626}}}),rj=wN({id:344106930,name:"SKALE | Calypso NFT Hub Testnet",network:"skale-calypso-testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://staging-v3.skalenodes.com/v1/staging-utter-unripe-menkar"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-utter-unripe-menkar"]},public:{http:["https://staging-v3.skalenodes.com/v1/staging-utter-unripe-menkar"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-utter-unripe-menkar"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://staging-utter-unripe-menkar.explorer.staging-v3.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://staging-utter-unripe-menkar.explorer.staging-v3.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2131424}},testnet:!0}),nj=wN({id:1351057110,name:"SKALE | Chaos Testnet",network:"skale-chaos-testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://staging-v3.skalenodes.com/v1/staging-fast-active-bellatrix"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-fast-active-bellatrix"]},public:{http:["https://staging-v3.skalenodes.com/v1/staging-fast-active-bellatrix"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-fast-active-bellatrix"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://staging-fast-active-bellatrix.explorer.staging-v3.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://staging-fast-active-bellatrix.explorer.staging-v3.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1192202}},testnet:!0}),ij=wN({id:1026062157,name:"SKALE | CryptoBlades",network:"skale-cryptoblades",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/affectionate-immediate-pollux"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/affectionate-immediate-pollux"]},public:{http:["https://mainnet.skalenodes.com/v1/affectionate-immediate-pollux"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/affectionate-immediate-pollux"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://affectionate-immediate-pollux.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://affectionate-immediate-pollux.explorer.mainnet.skalenodes.com"}},contracts:{}}),oj=wN({id:2046399126,name:"SKALE | Crypto Colosseum",network:"skale-crypto-coloseeum",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/haunting-devoted-deneb"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/haunting-devoted-deneb"]},public:{http:["https://mainnet.skalenodes.com/v1/haunting-devoted-deneb"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/haunting-devoted-deneb"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://haunting-devoted-deneb.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://haunting-devoted-deneb.explorer.mainnet.skalenodes.com"}},contracts:{}}),aj=wN({id:2046399126,name:"SKALE | Europa Liquidity Hub",network:"skale-europa",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/elated-tan-skat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/elated-tan-skat"]},public:{http:["https://mainnet.skalenodes.com/v1/elated-tan-skat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/elated-tan-skat"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://elated-tan-skat.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://elated-tan-skat.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3113495}}}),sj=wN({id:476158412,name:"SKALE | Europa Liquidity Hub Testnet",network:"skale-europa-testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://staging-v3.skalenodes.com/v1/staging-legal-crazy-castor"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-legal-crazy-castor"]},public:{http:["https://staging-v3.skalenodes.com/v1/staging-legal-crazy-castor"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-legal-crazy-castor"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://staging-legal-crazy-castor.explorer.staging-v3.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://staging-legal-crazy-castor.explorer.staging-v3.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2071911}},testnet:!0}),cj=wN({id:2139927552,name:"SKALE | Exorde",network:"skale-exorde",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/light-vast-diphda"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/light-vast-diphda"]},public:{http:["https://mainnet.skalenodes.com/v1/light-vast-diphda"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/light-vast-diphda"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://light-vast-diphda.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://light-vast-diphda.explorer.mainnet.skalenodes.com"}},contracts:{}}),uj=wN({id:1273227453,name:"SKALE | Human Protocol",network:"skale-human-protocol",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/wan-red-ain"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/wan-red-ain"]},public:{http:["https://mainnet.skalenodes.com/v1/wan-red-ain"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/wan-red-ain"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://wan-red-ain.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://wan-red-ain.explorer.mainnet.skalenodes.com"}},contracts:{}}),lj=wN({id:1482601649,name:"SKALE | Nebula Gaming Hub",network:"skale-nebula",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/green-giddy-denebola"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/green-giddy-denebola"]},public:{http:["https://mainnet.skalenodes.com/v1/green-giddy-denebola"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/green-giddy-denebola"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://green-giddy-denebola.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://green-giddy-denebola.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2372986}}}),fj=wN({id:503129905,name:"SKALE | Nebula Gaming Hub Testnet",network:"skale-nebula-testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://staging-v3.skalenodes.com/v1/staging-faint-slimy-achird"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-faint-slimy-achird"]},public:{http:["https://staging-v3.skalenodes.com/v1/staging-faint-slimy-achird"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-faint-slimy-achird"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://staging-faint-slimy-achird.explorer.staging-v3.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://staging-faint-slimy-achird.explorer.staging-v3.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2205882}},testnet:!0}),dj=wN({id:278611351,name:"SKALE | Razor Network",network:"skale-razor",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/turbulent-unique-scheat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/turbulent-unique-scheat"]},public:{http:["https://mainnet.skalenodes.com/v1/turbulent-unique-scheat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/turbulent-unique-scheat"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://turbulent-unique-scheat.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://turbulent-unique-scheat.explorer.mainnet.skalenodes.com"}},contracts:{}}),hj=wN({id:1350216234,name:"SKALE | Titan Community Hub",network:"skale-titan",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/parallel-stormy-spica"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/parallel-stormy-spica"]},public:{http:["https://mainnet.skalenodes.com/v1/parallel-stormy-spica"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/parallel-stormy-spica"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://parallel-stormy-spica.explorer.mainnet.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://parallel-stormy-spica.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2076458}}}),pj=wN({id:1517929550,name:"SKALE | Titan Community Hub Testnet",network:"skale-titan-testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://staging-v3.skalenodes.com/v1/staging-aware-chief-gianfar"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-aware-chief-gianfar"]},public:{http:["https://staging-v3.skalenodes.com/v1/staging-aware-chief-gianfar"],webSocket:["wss://staging-v3.skalenodes.com/v1/ws/staging-aware-chief-gianfar"]}},blockExplorers:{blockscout:{name:"SKALE Explorer",url:"https://staging-aware-chief-gianfar.explorer.staging-v3.skalenodes.com"},default:{name:"SKALE Explorer",url:"https://staging-aware-chief-gianfar.explorer.staging-v3.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2085155}},testnet:!0}),mj=wN({id:19,name:"Songbird Mainnet",network:"songbird-mainnet",nativeCurrency:{decimals:18,name:"songbird",symbol:"SGB"},rpcUrls:{default:{http:["https://songbird-api.flare.network/ext/C/rpc"]},public:{http:["https://songbird-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Songbird Explorer",url:"https://songbird-explorer.flare.network"}}}),bj=wN({id:16,name:"Coston",network:"coston",nativeCurrency:{decimals:18,name:"costonflare",symbol:"CFLR"},rpcUrls:{default:{http:["https://coston-api.flare.network/ext/C/rpc"]},public:{http:["https://coston-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Coston Explorer",url:"https://coston-explorer.flare.network"}},testnet:!0}),gj=wN({id:88882,name:"Chiliz Spicy Testnet",network:"chiliz-spicy-Testnet",nativeCurrency:{decimals:18,name:"CHZ",symbol:"CHZ"},rpcUrls:{default:{http:["https://spicy-rpc.chiliz.com","https://chiliz-spicy.publicnode.com"],webSocket:["wss://spicy-rpc-ws.chiliz.com","wss://chiliz-spicy.publicnode.com"]},public:{http:["https://spicy-rpc.chiliz.com","https://chiliz-spicy.publicnode.com"],webSocket:["wss://spicy-rpc-ws.chiliz.com","wss://chiliz-spicy.publicnode.com"]}},blockExplorers:{default:{name:"Chiliz Explorer",url:"http://spicy-explorer.chiliz.com"}},testnet:!0}),yj=wN({id:8082,name:"Shardeum Sphinx",network:"shmSphinx",nativeCurrency:{name:"SHARDEUM",symbol:"SHM",decimals:18},rpcUrls:{default:{http:["https://sphinx.shardeum.org"]},public:{http:["https://sphinx.shardeum.org"]}},blockExplorers:{default:{name:"Shardeum Explorer",url:"https://explorer-sphinx.shardeum.org"}},testnet:!0}),vj=wN({id:109,name:"Shibarium",network:"shibarium",nativeCurrency:{name:"Bone",symbol:"BONE",decimals:18},rpcUrls:{default:{http:["https://rpc.shibrpc.com"]},public:{http:["https://rpc.shibrpc.com"]}},blockExplorers:{etherscan:{name:"Blockscout",url:"https://shibariumscan.io"},default:{name:"Blockscout",url:"https://shibariumscan.io"}},contracts:{multicall3:{address:"0x864Bf681ADD6052395188A89101A1B37d3B4C961",blockCreated:265900}}}),wj=wN({id:57,name:"Syscoin Mainnet",network:"syscoin",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.syscoin.org"],webSocket:["wss://rpc.syscoin.org/wss"]},public:{http:["https://rpc.syscoin.org"],webSocket:["wss://rpc.syscoin.org/wss"]}},blockExplorers:{default:{name:"SyscoinExplorer",url:"https://explorer.syscoin.org"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:287139}}}),Ej=wN({id:5700,name:"Syscoin Tanenbaum Testnet",network:"syscoin-testnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.tanenbaum.io"],webSocket:["wss://rpc.tanenbaum.io/wss"]},public:{http:["https://rpc.tanenbaum.io"],webSocket:["wss://rpc.tanenbaum.io/wss"]}},blockExplorers:{default:{name:"SyscoinTestnetExplorer",url:"https://tanenbaum.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:271288}}}),Aj=wN({id:841,name:"Taraxa Mainnet",network:"taraxa",nativeCurrency:{name:"Tara",symbol:"TARA",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.taraxa.io"]},public:{http:["https://rpc.mainnet.taraxa.io"]}},blockExplorers:{default:{name:"Taraxa Explorer",url:"https://explorer.mainnet.taraxa.io"}}}),xj=wN({id:167007,name:"Taiko Jolnir (Alpha-5 Testnet)",network:"tko-jolnir",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.jolnir.taiko.xyz"]},public:{http:["https://rpc.jolnir.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.jolnir.taiko.xyz"}}}),_j=wN({id:167005,name:"Taiko (Alpha-3 Testnet)",network:"taiko-sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.test.taiko.xyz"]},public:{http:["https://rpc.test.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.test.taiko.xyz"}}}),kj=wN({id:842,name:"Taraxa Testnet",network:"taraxa-testnet",nativeCurrency:{name:"Tara",symbol:"TARA",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.taraxa.io"]},public:{http:["https://rpc.testnet.taraxa.io"]}},blockExplorers:{default:{name:"Taraxa Explorer",url:"https://explorer.testnet.taraxa.io"}},testnet:!0}),Sj=wN({id:40,name:"Telos",network:"telos",nativeCurrency:{decimals:18,name:"Telos",symbol:"TLOS"},rpcUrls:{default:{http:["https://mainnet.telos.net/evm"]},public:{http:["https://mainnet.telos.net/evm"]}},blockExplorers:{default:{name:"Teloscan",url:"https://www.teloscan.io/"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:246530709}}}),Pj=wN({id:41,name:"Telos",network:"telosTestnet",nativeCurrency:{decimals:18,name:"Telos",symbol:"TLOS"},rpcUrls:{default:{http:["https://testnet.telos.net/evm"]},public:{http:["https://testnet.telos.net/evm"]}},blockExplorers:{default:{name:"Teloscan (testnet)",url:"https://testnet.teloscan.io/"}},testnet:!0}),Ij=wN({id:1559,name:"Tenet",network:"tenet-mainnet",nativeCurrency:{name:"TENET",symbol:"TENET",decimals:18},rpcUrls:{public:{http:["https://rpc.tenet.org"]},default:{http:["https://rpc.tenet.org"]}},blockExplorers:{default:{name:"TenetScan Mainnet",url:"https://tenetscan.io"}},testnet:!1}),Tj=wN({id:997,name:"5ireChain Thunder Testnet",network:"5ireChain",nativeCurrency:{name:"5ire Token",symbol:"5IRE",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.5ire.network"]},public:{http:["https://rpc-testnet.5ire.network"]}},blockExplorers:{default:{name:"5ireChain Explorer",url:"https://explorer.5ire.network"}},testnet:!0}),Oj=wN({id:100009,name:"Vechain",network:"vechain",nativeCurrency:{name:"VeChain",symbol:"VET",decimals:18},rpcUrls:{default:{http:["https://mainnet.vechain.org"]},public:{http:["https://mainnet.vechain.org"]}},blockExplorers:{default:{name:"Vechain Explorer",url:"https://explore.vechain.org"},vechainStats:{name:"Vechain Stats",url:"https://vechainstats.com"}}}),Mj=wN({id:888,name:"Wanchain",network:"wanchain",nativeCurrency:{name:"WANCHAIN",symbol:"WAN",decimals:18},rpcUrls:{default:{http:["https://gwan-ssl.wandevs.org:56891","https://gwan2-ssl.wandevs.org"]},public:{http:["https://gwan-ssl.wandevs.org:56891","https://gwan2-ssl.wandevs.org"]}},blockExplorers:{etherscan:{name:"WanScan",url:"https://wanscan.org"},default:{name:"WanScan",url:"https://wanscan.org"}},contracts:{multicall3:{address:"0xcDF6A1566e78EB4594c86Fe73Fcdc82429e97fbB",blockCreated:25312390}}}),Cj=wN({id:999,name:"Wanchain Testnet",network:"wanchainTestnet",nativeCurrency:{name:"WANCHAIN",symbol:"WANt",decimals:18},rpcUrls:{default:{http:["https://gwan-ssl.wandevs.org:46891"]},public:{http:["https://gwan-ssl.wandevs.org:46891"]}},blockExplorers:{etherscan:{name:"WanScanTest",url:"https://wanscan.org"},default:{name:"WanScanTest",url:"https://wanscan.org"}},contracts:{multicall3:{address:"0x11c89bF4496c39FB80535Ffb4c92715839CC5324",blockCreated:24743448}},testnet:!0}),Bj=wN({id:1111,name:"WEMIX",network:"wemix-mainnet",nativeCurrency:{name:"WEMIX",symbol:"WEMIX",decimals:18},rpcUrls:{default:{http:["https://api.wemix.com"]},public:{http:["https://api.wemix.com"]}},blockExplorers:{etherscan:{name:"wemixExplorer",url:"https://explorer.wemix.com"},default:{name:"wemixExplorer",url:"https://explorer.wemix.com"}}}),Nj=wN({id:1112,name:"WEMIX Testnet",network:"wemix-testnet",nativeCurrency:{name:"WEMIX",symbol:"tWEMIX",decimals:18},rpcUrls:{default:{http:["https://api.test.wemix.com"]},public:{http:["https://api.test.wemix.com"]}},blockExplorers:{etherscan:{name:"wemixExplorer",url:"https://testnet.wemixscan.com"},default:{name:"wemixExplorer",url:"https://testnet.wemixscan.com"}},testnet:!0}),Rj=wN({id:50,name:"XinFin Network",network:"xdc",nativeCurrency:{decimals:18,name:"XDC",symbol:"XDC"},rpcUrls:{default:{http:["https://rpc.xinfin.network"]},public:{http:["https://rpc.xinfin.network"]}},blockExplorers:{xinfin:{name:"XinFin",url:"https://explorer.xinfin.network"},default:{name:"Blocksscan",url:"https://xdc.blocksscan.io"}}}),Fj=wN({id:51,name:"Apothem Network",network:"xdc-testnet",nativeCurrency:{decimals:18,name:"TXDC",symbol:"TXDC"},rpcUrls:{default:{http:["https://erpc.apothem.network"]},public:{http:["https://erpc.apothem.network"]}},blockExplorers:{xinfin:{name:"XinFin",url:"https://explorer.apothem.network"},default:{name:"Blocksscan",url:"https://apothem.blocksscan.io"}}}),Lj=wN({id:1337803,network:"zhejiang",name:"Zhejiang",nativeCurrency:{name:"Zhejiang Ether",symbol:"ZhejETH",decimals:18},rpcUrls:{default:{http:["https://rpc.zhejiang.ethpandaops.io"]},public:{http:["https://rpc.zhejiang.ethpandaops.io"]}},blockExplorers:{beaconchain:{name:"Etherscan",url:"https://zhejiang.beaconcha.in"},blockscout:{name:"Blockscout",url:"https://blockscout.com/eth/zhejiang-testnet"},default:{name:"Beaconchain",url:"https://zhejiang.beaconcha.in"}},testnet:!0}),Uj=wN({id:42766,name:"ZKFair Mainnet",network:"zkfair-mainnet",nativeCurrency:{decimals:18,name:"USD Coin",symbol:"USDC"},rpcUrls:{default:{http:["https://rpc.zkfair.io"]},public:{http:["https://rpc.zkfair.io"]}},blockExplorers:{default:{name:"zkFair Explorer",url:"https://scan.zkfair.io"}},testnet:!1}),jj=wN({id:43851,name:"ZKFair Testnet",network:"zkfair-testnet",nativeCurrency:{decimals:18,name:"USD Coin",symbol:"USDC"},rpcUrls:{default:{http:["https://testnet-rpc.zkfair.io"]},public:{http:["https://testnet-rpc.zkfair.io"]}},blockExplorers:{default:{name:"zkFair Explorer",url:"https://testnet-scan.zkfair.io"}},testnet:!0}),Dj={block:jC({format(e){const t=e.transactions?.map((e=>{if("string"==typeof e)return e;const t=Dj.transaction.format(e);return"0x71"===t.typeHex?t.type="eip712":"0xff"===t.typeHex&&(t.type="priority"),t}));return{l1BatchNumber:e.l1BatchNumber?GT(e.l1BatchNumber):null,l1BatchTimestamp:e.l1BatchTimestamp?GT(e.l1BatchTimestamp):null,transactions:t}}}),transaction:LC({format(e){const t={};return"0x71"===e.type?t.type="eip712":"0xff"===e.type&&(t.type="priority"),{...t,l1BatchNumber:e.l1BatchNumber?GT(e.l1BatchNumber):null,l1BatchTxIndex:e.l1BatchTxIndex?GT(e.l1BatchTxIndex):null}}}),transactionReceipt:HN({format:e=>({l1BatchNumber:e.l1BatchNumber?GT(e.l1BatchNumber):null,l1BatchTxIndex:e.l1BatchTxIndex?GT(e.l1BatchTxIndex):null,logs:e.logs.map((e=>({...YC(e),l1BatchNumber:e.l1BatchNumber?GT(e.l1BatchNumber):null,transactionLogIndex:KT(e.transactionLogIndex),logType:e.logType}))),l2ToL1Logs:e.l2ToL1Logs.map((e=>({blockNumber:GT(e.blockHash),blockHash:e.blockHash,l1BatchNumber:GT(e.l1BatchNumber),transactionIndex:GT(e.transactionIndex),shardId:GT(e.shardId),isService:e.isService,sender:e.sender,key:e.key,value:e.value,transactionHash:e.transactionHash,logIndex:GT(e.logIndex)})))})}),transactionRequest:TC({exclude:["customSignature","factoryDeps","gasPerPubdata","paymaster","paymasterInput"],format:e=>e.gasPerPubdata||e.paymaster&&e.paymasterInput||e.factoryDeps||e.customSignature?{eip712Meta:{...e.gasPerPubdata?{gasPerPubdata:JT(e.gasPerPubdata)}:{},...e.paymaster&&e.paymasterInput?{paymasterParams:{paymaster:e.paymaster,paymasterInput:Array.from(oO(e.paymasterInput))}}:{},...e.factoryDeps?{factoryDeps:e.factoryDeps}:{},...e.customSignature?{customSignature:e.customSignature}:{}},type:"eip712"===e.type?"0x71":"0xff"}:{}})},zj={transaction:(e,t)=>{return"customSignature"in(r=e)||"paymaster"in r||"paymasterInput"in r||"gasPerPubdata"in r||"factoryDeps"in r?function(e){const{chainId:t,gas:r,nonce:n,to:i,from:o,value:a,maxFeePerGas:s,maxPriorityFeePerGas:c,customSignature:u,factoryDeps:l,paymaster:f,paymasterInput:d,gasPerPubdata:h,data:p}=e;!function(e){const{chainId:t,to:r,from:n,paymaster:i,paymasterInput:o}=e;if(t<=0)throw new dB({chainId:t});if(r&&!HO(r))throw new zO({address:r});if(n&&!HO(n))throw new zO({address:n});if(i&&!HO(i))throw new zO({address:i});if(i&&!o)throw new sT("`paymasterInput` must be provided when `paymaster` is defined");if(!i&&o)throw new sT("`paymaster` must be provided when `paymasterInput` is defined")}(e);const m=[n?JT(n):"0x",c?JT(c):"0x",s?JT(s):"0x",r?JT(r):"0x",i??"0x",a?JT(a):"0x",p??"0x",JT(t),JT(""),JT(""),JT(t),o??"0x",h?JT(h):"0x",l??[],u??"0x",f&&d?[f,d]:[]];return qO(["0x71",UN(m)])}(e):tR(e,t);var r}};const $j=wN({id:324,name:"zkSync Era",network:"zksync-era",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.era.zksync.io"],webSocket:["wss://mainnet.era.zksync.io/ws"]},public:{http:["https://mainnet.era.zksync.io"],webSocket:["wss://mainnet.era.zksync.io/ws"]}},blockExplorers:{default:{name:"zkExplorer",url:"https://explorer.zksync.io"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"}}},{serializers:zj,formatters:Dj}),Hj=wN({id:280,name:"zkSync Era Testnet",network:"zksync-era-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet.era.zksync.dev"],webSocket:["wss://testnet.era.zksync.dev/ws"]},public:{http:["https://testnet.era.zksync.dev"],webSocket:["wss://testnet.era.zksync.dev/ws"]}},blockExplorers:{default:{name:"zkExplorer",url:"https://goerli.explorer.zksync.io"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"}},testnet:!0},{serializers:zj,formatters:Dj}),Gj=wN({id:300,name:"zkSync Sepolia Testnet",network:"zksync-sepolia-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.era.zksync.dev"],webSocket:["wss://sepolia.era.zksync.dev/ws"]},public:{http:["https://sepolia.era.zksync.dev"],webSocket:["wss://sepolia.era.zksync.dev/ws"]}},blockExplorers:{default:{name:"zkExplorer",url:"https://sepolia.explorer.zksync.io/"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"}},testnet:!0},{serializers:zj,formatters:Dj}),qj=wN({id:7001,name:"ZetaChain Athens Testnet",network:"zetachain-athens-testnet",nativeCurrency:{decimals:18,name:"Zeta",symbol:"aZETA"},rpcUrls:{public:{http:["https://zetachain-athens-evm.blockpi.network/v1/rpc/public"]},default:{http:["https://zetachain-athens-evm.blockpi.network/v1/rpc/public"]}},blockExplorers:{default:{name:"ZetaScan",url:"https://athens3.explorer.zetachain.com"}},testnet:!0}),Kj=wN({id:32769,name:"Zilliqa",network:"zilliqa",nativeCurrency:{name:"Zilliqa",symbol:"ZIL",decimals:18},rpcUrls:{default:{http:["https://api.zilliqa.com"]},public:{http:["https://api.zilliqa.com"]}},blockExplorers:{default:{name:"Ethernal",url:"https://evmx.zilliqa.com"}},testnet:!1}),Vj=wN({id:33101,name:"Zilliqa Testnet",network:"zilliqa-testnet",nativeCurrency:{name:"Zilliqa",symbol:"ZIL",decimals:18},rpcUrls:{default:{http:["https://dev-api.zilliqa.com"]},public:{http:["https://dev-api.zilliqa.com"]}},blockExplorers:{default:{name:"Ethernal",url:"https://evmx.testnet.zilliqa.com"}},testnet:!0}),Wj=wN({id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:5882}}},{formatters:TF}),Jj=wN({id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:83160}},testnet:!0},{formatters:TF}),Zj=wN({id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:189123}},testnet:!0},{formatters:TF});var Yj=Object.freeze({__proto__:null,acala:gF,arbitrum:yF,arbitrumGoerli:vF,arbitrumNova:wF,arbitrumSepolia:AF,astar:EF,astarZkatana:xF,aurora:_F,auroraTestnet:kF,avalanche:SF,avalancheFuji:PF,bahamut:IF,base:OF,baseGoerli:MF,baseSepolia:CF,bearNetworkChainMainnet:BF,bearNetworkChainTestnet:NF,bitTorrent:RF,bitTorrentTestnet:FF,boba:LF,bronos:UF,bronosTestnet:jF,bsc:DF,bscTestnet:zF,bxn:$F,bxnTestnet:HF,canto:GF,celo:QF,celoAlfajores:eL,celoCannoli:rL,chiliz:tL,classic:nL,confluxESpace:iL,confluxESpaceTestnet:oL,coreDao:aL,cronos:sL,cronosTestnet:cL,crossbell:uL,dfk:lL,dogechain:fL,edgeware:dL,edgewareTestnet:hL,ekta:yL,ektaTestnet:vL,eos:pL,eosTestnet:mL,evmos:bL,evmosTestnet:gL,fantom:wL,fantomSonicTestnet:EL,fantomTestnet:AL,fibo:xL,filecoin:_L,filecoinCalibration:kL,filecoinHyperspace:SL,flare:PL,flareTestnet:IL,foundry:TL,fuse:OL,fuseSparknet:ML,gnosis:UL,gnosisChiado:jL,gobi:FL,goerli:LL,haqqMainnet:$L,haqqTestedge2:HL,hardhat:DL,harmonyOne:zL,holesky:GL,iotex:CL,iotexTestnet:BL,jbc:NL,karura:RL,kava:qL,kavaTestnet:KL,klaytn:VL,klaytnBaobab:WL,kroma:JL,kromaSepolia:ZL,linea:YL,lineaTestnet:XL,localhost:QL,lukso:eU,mainnet:tU,mandala:rU,manta:nU,mantaTestnet:iU,mantle:oU,mantleTestnet:aU,meter:sU,meterTestnet:cU,metis:uU,metisGoerli:lU,mev:fU,mevTestnet:dU,modeTestnet:hU,moonbaseAlpha:pU,moonbeam:mU,moonbeamDev:bU,moonriver:gU,neonDevnet:yU,neonMainnet:vU,nexi:wU,nexilix:EU,oasisTestnet:xU,oasys:AU,okc:_U,opBNB:IU,opBNBTestnet:TU,optimism:kU,optimismGoerli:SU,optimismSepolia:PU,pgn:OU,pgnTestnet:MU,plinga:CU,polygon:BU,polygonMumbai:NU,polygonZkEvm:FU,polygonZkEvmTestnet:RU,pulsechain:LU,pulsechainV4:UU,qMainnet:jU,qTestnet:DU,rollux:zU,rolluxTestnet:$U,ronin:HU,rootstock:GU,saigon:qU,sapphire:KU,sapphireTestnet:VU,scroll:WU,scrollSepolia:JU,scrollTestnet:ZU,sepolia:YU,shardeumSphinx:yj,shibarium:vj,shimmer:XU,shimmerTestnet:QU,skaleBlockBrawlers:ej,skaleCalypso:tj,skaleCalypsoTestnet:rj,skaleChaosTestnet:nj,skaleCryptoBlades:ij,skaleCryptoColosseum:oj,skaleEuropa:aj,skaleEuropaTestnet:sj,skaleExorde:cj,skaleHumanProtocol:uj,skaleNebula:lj,skaleNebulaTestnet:fj,skaleRazor:dj,skaleTitan:hj,skaleTitanTestnet:pj,songbird:mj,songbirdTestnet:bj,spicy:gj,syscoin:wj,syscoinTestnet:Ej,taikoJolnir:xj,taikoTestnetSepolia:_j,taraxa:Aj,taraxaTestnet:kj,telos:Sj,telosTestnet:Pj,tenet:Ij,thunderTestnet:Tj,vechain:Oj,wanchain:Mj,wanchainTestnet:Cj,wemix:Bj,wemixTestnet:Nj,xdc:Rj,xdcTestnet:Fj,zetachainAthensTestnet:qj,zhejiang:Lj,zilliqa:Kj,zilliqaTestnet:Vj,zkFair:Uj,zkFairTestnet:jj,zkSync:$j,zkSyncSepoliaTestnet:Gj,zkSyncTestnet:Hj,zora:Wj,zoraSepolia:Jj,zoraTestnet:Zj});const Xj="https://meta-aa-provider.onrender.com/api/v1/bundler",Qj="https://meta-aa-provider.onrender.com/api/v1/paymaster",eD="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",tD="0x8ae01fcf7c655655ff2c6ef907b8b4718ab4e17c",rD="0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5",nD={USDC:{1:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",137:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",42161:"0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8",43114:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"},PEPE:{1:"0x6982508145454Ce325dDbE47a25d4ec3d2311933"}},iD={[nD.USDC[1]]:rR("100",6),[nD.USDC[5]]:rR("100",6),[nD.USDC[137]]:rR("10",6),[nD.USDC[42161]]:rR("10",6),[nD.USDC[43114]]:rR("10",6),[nD.PEPE[1]]:rR("50000000",18),"0x3870419Ba2BBf0127060bCB37f69A1b1C090992B":rR("100",18)},oD=new Map([[BU.id,30000000000n]]),aD="f36f7f706a58477884ce6fe89165666c",sD={1:`https://mainnet.infura.io/v3/${aD}`,5:`https://goerli.infura.io/v3/${aD}`,11155111:"https://fittest-ultra-aura.ethereum-sepolia.quiknode.pro/3893d01b1dd411fdfa9b6dd372dd2b4f69fcf1ea/",137:`https://polygon-mainnet.infura.io/v3/${aD}`,80001:`https://polygon-mumbai.infura.io/v3/${aD}`,80002:`https://polygon-amoy.infura.io/v3/${aD}`,10:`https://optimism-mainnet.infura.io/v3/${aD}`,420:`https://optimism-goerli.infura.io/v3/${aD}`,42161:`https://arbitrum-mainnet.infura.io/v3/${aD}`,421613:`https://arbitrum-goerli.infura.io/v3/${aD}`,43114:`https://avalanche-mainnet.infura.io/v3/${aD}`,43113:`https://avalanche-fuji.infura.io/v3/${aD}`,1313161554:`https://aurora-mainnet.infura.io/v3/${aD}`,1313161555:`https://aurora-testnet.infura.io/v3/${aD}`,56:"https://neat-greatest-layer.bsc.quiknode.pro/9405a499ceee314e5f2f68c9d47518d3537fce6a/",8453:"https://twilight-red-tree.base-mainnet.quiknode.pro/dc6eb27bf0f917df215922488dd97f4de7d9b08e/",84531:"https://icy-long-mountain.base-goerli.quiknode.pro/5b80d93e97cc9412a63c10a30841869abbef9596/",100:"https://thrilling-fluent-film.xdai.quiknode.pro/305955cffb9868cdd95b5e3dc9775f20678ad9ac/",10200:"https://nd-810-853-201.p2pify.com/e828b09f0d43591de96c297b3f36fffd",59144:`https://linea-mainnet.infura.io/v3/${aD}`,59140:`https://linea-goerli.infura.io/v3/${aD}`,204:"https://opbnb.rpc.thirdweb.com/eed98c1f30120c0508f17c1f01d3102b",42069:"https://rpc.op-testnet.gelato.digital",1261120:"https://rpc.zkatana.gelato.digital",84532:"https://floral-old-feather.base-sepolia.quiknode.pro/4c3b4295d0c174410872b1e461a91cc33c7969a9/",421614:`https://arbitrum-sepolia.infura.io/v3/${aD}`,11155420:`https://optimism-sepolia.infura.io/v3/${aD}`,42220:`https://celo-mainnet.infura.io/v3/${aD}`,44787:`https://celo-alfajores.infura.io/v3/${aD}`,168587773:"https://168587773.rpc.thirdweb.com/eed98c1f30120c0508f17c1f01d3102b",81457:"https://rpc.blast.io",3776:"https://rpc.startale.com/astar-zkevm",122:"https://rpc.fuse.io",42170:"https://nova.arbitrum.io/rpc",94204209:"https://rpc.polygon-blackberry.gelato.digital",88153591557:"https://rpc.arb-blueberry.gelato.digital",123420111:"https://rpc.opcelestia-raspberry.gelato.digital"};var cD;!function(e){e.sudo="0x00000000",e.plugin="0x00000001",e.enable="0x00000002"}(cD||(cD={}));class uD{constructor(e){Object.defineProperty(this,"validatorAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"mode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"projectId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"entryPointAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enableSignature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"validUntil",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"validAfter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"executor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"selector",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"rpcUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"publicClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.projectId=e.projectId,this.validatorAddress=e.validatorAddress??"0xd9AB5096a832b9ce79914329DAEE236f8Eea0390",this.mode=e.mode??cD.sudo,this.entryPointAddress=e.entryPointAddress??eD,this.enableSignature=e.enableSignature,this.validUntil=e.validUntil??0,this.validAfter=e.validAfter??0,this.executor=e.executor,this.selector=e.selector,this.chain=e.chain,this.rpcUrl=e.rpcUrl,this.publicClient=BR({transport:GB(e.rpcUrl??sD[this.chain?.id??NU.id]),chain:this.chain??NU})}shouldDelegateViaFallback(){return!0}getPluginValidatorData(){if(!this.selector||!this.executor)throw Error("Plugin Validator data params uninitialised");return{selector:this.selector,executor:this.executor,validAfter:this.validAfter,validUntil:this.validUntil}}getNonceKey(){return 0n}async getDynamicDummySignature(e,t){const r=await this.resolveValidatorMode(e,t);if(r===cD.enable){const r=await this.getEnableData(e),n=r.length/2-1,i=65,o=qO(["0x000000000000000000000000",this.getAddress(),this.executor]);return qO([cD.enable,o,RT(JT(n),{size:32}),r,RT(JT(i),{size:32}),"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",await this.getDummyUserOpSignature(t)])}return qO([r,await this.getDummyUserOpSignature(t)])}setEnableSignature(e){this.enableSignature=e}getEnableSignature(){return this.enableSignature}getAddress(){return this.validatorAddress}getPublicClient(){if(!this.publicClient)throw new Error("Validator uninitialized: PublicClient missing");return this.publicClient}async approveExecutor(e,t,r,n,i,o){if(!this.chain)throw new Error("Validator uninitialized");let a;try{const t=await this.getPublicClient().getStorageAt({address:e,slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});a=t?"0x"+t.slice(26):t}catch(e){}const s=e,c=await this.signer();return await c.signTypedData({domain:{name:"Kernel",version:a?.toLowerCase()===rD.toLowerCase()||a?.toLowerCase()==="0x8dD4DBB54d8A8Cf0DE6F9CCC4609470A30EfF18C".toLowerCase()||void 0===a||"0x0000000000000000000000000000000000000000"===a?"0.2.2":"0.2.1",chainId:this.chain.id,verifyingContract:s},types:{ValidatorApproved:[{name:"sig",type:"bytes4"},{name:"validatorData",type:"uint256"},{name:"executor",type:"address"},{name:"enableData",type:"bytes"}]},message:{sig:t,validatorData:GT(qO([RT(JT(n),{size:6}),RT(JT(i),{size:6}),o.getAddress()]),{size:32}),executor:r,enableData:await o.getEnableData(e)},primaryType:"ValidatorApproved"})}async resolveValidatorMode(e,t){if(!this.chain||!this.publicClient)throw new Error("Validator uninitialized");let r;try{const n=await this.publicClient.readContract({abi:ME,address:e,functionName:"getDefaultValidator"});r=n?.toLowerCase()===this.validatorAddress.toLowerCase()||this.mode===cD.sudo?cD.sudo:await this.isPluginEnabled(e,t.toString().slice(0,10))?cD.plugin:cD.enable}catch(e){r=this.mode===cD.plugin?cD.enable:this.mode}return r}async getSignature(e){const t=await this.resolveValidatorMode(e.sender,e.callData);if(t===cD.sudo||t===cD.plugin)return qO([this.mode,await this.signUserOp(e)]);{const r=await this.getEnableData(e.sender),n=r.length/2-1,i=this.getEnableSignature();if(!i)throw new Error("Enable signature not set");return GO([t,RT(JT(this.validUntil),{size:6}),RT(JT(this.validAfter),{size:6}),RT(this.validatorAddress,{size:20}),RT(this.executor,{size:20}),RT(JT(n),{size:32}),r,RT(JT(i.length/2-1),{size:32}),i,await this.signUserOp(e)])}}}function lD(e,t){return function(){return e.apply(t,arguments)}}const{toString:fD}=Object.prototype,{getPrototypeOf:dD}=Object,hD=(e=>t=>{const r=fD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),pD=e=>(e=e.toLowerCase(),t=>hD(t)===e),mD=e=>t=>typeof t===e,{isArray:bD}=Array,gD=mD("undefined");const yD=pD("ArrayBuffer");const vD=mD("string"),wD=mD("function"),ED=mD("number"),AD=e=>null!==e&&"object"==typeof e,xD=e=>{if("object"!==hD(e))return!1;const t=dD(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},_D=pD("Date"),kD=pD("File"),SD=pD("Blob"),PD=pD("FileList"),ID=pD("URLSearchParams");function TD(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),bD(e))for(n=0,i=e.length;n0;)if(n=r[i],t===n.toLowerCase())return n;return null}const MD="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:u,CD=e=>!gD(e)&&e!==MD;const BD=(e=>t=>e&&t instanceof e)("undefined"!=typeof Uint8Array&&dD(Uint8Array)),ND=pD("HTMLFormElement"),RD=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),FD=pD("RegExp"),LD=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};TD(r,((r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)})),Object.defineProperties(e,n)},UD="abcdefghijklmnopqrstuvwxyz",jD="0123456789",DD={DIGIT:jD,ALPHA:UD,ALPHA_DIGIT:UD+UD.toUpperCase()+jD};const zD=pD("AsyncFunction");var $D={isArray:bD,isArrayBuffer:yD,isBuffer:function(e){return null!==e&&!gD(e)&&null!==e.constructor&&!gD(e.constructor)&&wD(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||wD(e.append)&&("formdata"===(t=hD(e))||"object"===t&&wD(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&yD(e.buffer),t},isString:vD,isNumber:ED,isBoolean:e=>!0===e||!1===e,isObject:AD,isPlainObject:xD,isUndefined:gD,isDate:_D,isFile:kD,isBlob:SD,isRegExp:FD,isFunction:wD,isStream:e=>AD(e)&&wD(e.pipe),isURLSearchParams:ID,isTypedArray:BD,isFileList:PD,forEach:TD,merge:function e(){const{caseless:t}=CD(this)&&this||{},r={},n=(n,i)=>{const o=t&&OD(r,i)||i;xD(r[o])&&xD(n)?r[o]=e(r[o],n):xD(n)?r[o]=e({},n):bD(n)?r[o]=n.slice():r[o]=n};for(let e=0,t=arguments.length;e(TD(t,((t,n)=>{r&&wD(t)?e[n]=lD(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,o,a;const s={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)a=i[o],n&&!n(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==r&&dD(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:hD,kindOfTest:pD,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(bD(e))return e;let t=e.length;if(!ED(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:ND,hasOwnProperty:RD,hasOwnProp:RD,reduceDescriptors:LD,freezeMethods:e=>{LD(e,((t,r)=>{if(wD(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];wD(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return bD(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:OD,global:MD,isContextDefined:CD,ALPHABET:DD,generateString:(e=16,t=DD.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&wD(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(AD(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=bD(e)?[]:{};return TD(e,((e,t)=>{const o=r(e,n+1);!gD(o)&&(i[t]=o)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:zD,isThenable:e=>e&&(AD(e)||wD(e))&&wD(e.then)&&wD(e.catch)};function HD(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}$D.inherits(HD,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$D.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const GD=HD.prototype,qD={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{qD[e]={value:e}})),Object.defineProperties(HD,qD),Object.defineProperty(GD,"isAxiosError",{value:!0}),HD.from=(e,t,r,n,i,o)=>{const a=Object.create(GD);return $D.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),HD.call(a,e.message,t,r,n,i),a.cause=e,a.name=e.name,o&&Object.assign(a,o),a};function KD(e){return $D.isPlainObject(e)||$D.isArray(e)}function VD(e){return $D.endsWith(e,"[]")?e.slice(0,-2):e}function WD(e,t,r){return e?e.concat(t).map((function(e,t){return e=VD(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const JD=$D.toFlatObject($D,{},null,(function(e){return/^is[A-Z]/.test(e)}));function ZD(e,t,r){if(!$D.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=$D.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!$D.isUndefined(t[e])}))).metaTokens,i=r.visitor||u,o=r.dots,a=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&$D.isSpecCompliantForm(t);if(!$D.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if($D.isDate(e))return e.toISOString();if(!s&&$D.isBlob(e))throw new HD("Blob is not supported. Use a Buffer instead.");return $D.isArrayBuffer(e)||$D.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):_.from(e):e}function u(e,r,i){let s=e;if(e&&!i&&"object"==typeof e)if($D.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if($D.isArray(e)&&function(e){return $D.isArray(e)&&!e.some(KD)}(e)||($D.isFileList(e)||$D.endsWith(r,"[]"))&&(s=$D.toArray(e)))return r=VD(r),s.forEach((function(e,n){!$D.isUndefined(e)&&null!==e&&t.append(!0===a?WD([r],n,o):null===a?r:r+"[]",c(e))})),!1;return!!KD(e)||(t.append(WD(i,r,o),c(e)),!1)}const l=[],f=Object.assign(JD,{defaultVisitor:u,convertValue:c,isVisitable:KD});if(!$D.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!$D.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),$D.forEach(r,(function(r,o){!0===(!($D.isUndefined(r)||null===r)&&i.call(t,r,$D.isString(o)?o.trim():o,n,f))&&e(r,n?n.concat(o):[o])})),l.pop()}}(e),t}function YD(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function XD(e,t){this._pairs=[],e&&ZD(e,this,t)}const QD=XD.prototype;function ez(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function tz(e,t,r){if(!t)return e;const n=r&&r.encode||ez,i=r&&r.serialize;let o;if(o=i?i(t,r):$D.isURLSearchParams(t)?t.toString():new XD(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}QD.append=function(e,t){this._pairs.push([e,t])},QD.toString=function(e){const t=e?function(t){return e.call(this,t,YD)}:YD;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class rz{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){$D.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var nz={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},iz={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:XD,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const oz="undefined"!=typeof window&&"undefined"!=typeof document,az=(sz="undefined"!=typeof navigator&&navigator.product,oz&&["ReactNative","NativeScript","NS"].indexOf(sz)<0);var sz;const cz="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var uz={...Object.freeze({__proto__:null,hasBrowserEnv:oz,hasStandardBrowserEnv:az,hasStandardBrowserWebWorkerEnv:cz}),...iz};function lz(e){function t(e,r,n,i){let o=e[i++];if("__proto__"===o)return!0;const a=Number.isFinite(+o),s=i>=e.length;if(o=!o&&$D.isArray(n)?n.length:o,s)return $D.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!a;n[o]&&$D.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&$D.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let o;for(n=0;n{t(function(e){return $D.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const fz={transitional:nz,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=$D.isObject(e);i&&$D.isHTMLForm(e)&&(e=new FormData(e));if($D.isFormData(e))return n?JSON.stringify(lz(e)):e;if($D.isArrayBuffer(e)||$D.isBuffer(e)||$D.isStream(e)||$D.isFile(e)||$D.isBlob(e))return e;if($D.isArrayBufferView(e))return e.buffer;if($D.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return ZD(e,new uz.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return uz.isNode&&$D.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=$D.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return ZD(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if($D.isString(e))try{return(t||JSON.parse)(e),$D.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||fz.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&$D.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw HD.from(e,HD.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:uz.classes.FormData,Blob:uz.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};$D.forEach(["delete","get","head","post","put","patch"],(e=>{fz.headers[e]={}}));var dz=fz;const hz=$D.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const pz=Symbol("internals");function mz(e){return e&&String(e).trim().toLowerCase()}function bz(e){return!1===e||null==e?e:$D.isArray(e)?e.map(bz):String(e)}function gz(e,t,r,n,i){return $D.isFunction(n)?n.call(this,t,r):(i&&(t=r),$D.isString(t)?$D.isString(n)?-1!==t.indexOf(n):$D.isRegExp(n)?n.test(t):void 0:void 0)}let yz=class{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=mz(t);if(!i)throw new Error("header name must be a non-empty string");const o=$D.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=bz(e))}const o=(e,t)=>$D.forEach(e,((e,r)=>i(e,r,t)));return $D.isPlainObject(e)||e instanceof this.constructor?o(e,t):$D.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())?o((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim(),!r||t[r]&&hz[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=mz(e)){const r=$D.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if($D.isFunction(t))return t.call(this,e,r);if($D.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=mz(e)){const r=$D.findKey(this,e);return!(!r||void 0===this[r]||t&&!gz(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=mz(e)){const i=$D.findKey(r,e);!i||t&&!gz(0,r[i],i,t)||(delete r[i],n=!0)}}return $D.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!gz(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return $D.forEach(this,((n,i)=>{const o=$D.findKey(r,i);if(o)return t[o]=bz(n),void delete t[i];const a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();a!==i&&delete t[i],t[a]=bz(n),r[a]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return $D.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&$D.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[pz]=this[pz]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=mz(e);t[n]||(!function(e,t){const r=$D.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return $D.isArray(e)?e.forEach(n):n(e),this}};yz.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),$D.reduceDescriptors(yz.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),$D.freezeMethods(yz);var vz=yz;function wz(e,t){const r=this||dz,n=t||r,i=vz.from(n.headers);let o=n.data;return $D.forEach(e,(function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function Ez(e){return!(!e||!e.__CANCEL__)}function Az(e,t,r){HD.call(this,null==e?"canceled":e,HD.ERR_CANCELED,t,r),this.name="CanceledError"}$D.inherits(Az,HD,{__CANCEL__:!0});var xz=uz.hasStandardBrowserEnv?{write(e,t,r,n,i,o){const a=[e+"="+encodeURIComponent(t)];$D.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),$D.isString(n)&&a.push("path="+n),$D.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function _z(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var kz=uz.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=$D.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function Sz(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,o=0,a=0;return t=void 0!==t?t:1e3,function(s){const c=Date.now(),u=n[a];i||(i=c),r[o]=s,n[o]=c;let l=a,f=0;for(;l!==o;)f+=r[l++],l%=e;if(o=(o+1)%e,o===a&&(a=(a+1)%e),c-i{const o=i.loaded,a=i.lengthComputable?i.total:void 0,s=o-r,c=n(s);r=o;const u={loaded:o,total:a,progress:a?o/a:void 0,bytes:s,rate:c||void 0,estimated:c&&a&&o<=a?(a-o)/c:void 0,event:i};u[t?"download":"upload"]=!0,e(u)}}var Pz="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=vz.from(e.headers).normalize();let o,a,{responseType:s,withXSRFToken:c}=e;function u(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}if($D.isFormData(n))if(uz.hasStandardBrowserEnv||uz.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if(!1!==(a=i.getContentType())){const[e,...t]=a?a.split(";").map((e=>e.trim())).filter(Boolean):[];i.setContentType([e||"multipart/form-data",...t].join("; "))}let l=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const f=_z(e.baseURL,e.url);function d(){if(!l)return;const n=vz.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new HD("Request failed with status code "+r.status,[HD.ERR_BAD_REQUEST,HD.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),u()}),(function(e){r(e),u()}),{data:s&&"text"!==s&&"json"!==s?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:n,config:e,request:l}),l=null}if(l.open(e.method.toUpperCase(),tz(f,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=d:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(d)},l.onabort=function(){l&&(r(new HD("Request aborted",HD.ECONNABORTED,e,l)),l=null)},l.onerror=function(){r(new HD("Network Error",HD.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||nz;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new HD(t,n.clarifyTimeoutError?HD.ETIMEDOUT:HD.ECONNABORTED,e,l)),l=null},uz.hasStandardBrowserEnv&&(c&&$D.isFunction(c)&&(c=c(e)),c||!1!==c&&kz(f))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&xz.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in l&&$D.forEach(i.toJSON(),(function(e,t){l.setRequestHeader(t,e)})),$D.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),s&&"json"!==s&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",Sz(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",Sz(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{l&&(r(!t||t.type?new Az(null,e,l):t),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const h=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(f);h&&-1===uz.protocols.indexOf(h)?r(new HD("Unsupported protocol "+h+":",HD.ERR_BAD_REQUEST,e)):l.send(n||null)}))};const Iz={http:null,xhr:Pz};$D.forEach(Iz,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Tz=e=>`- ${e}`,Oz=e=>$D.isFunction(e)||null===e||!1===e;var Mz=e=>{e=$D.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let o=0;o`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new HD("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Tz).join("\n"):" "+Tz(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function Cz(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Az(null,e)}function Bz(e){Cz(e),e.headers=vz.from(e.headers),e.data=wz.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Mz(e.adapter||dz.adapter)(e).then((function(t){return Cz(e),t.data=wz.call(e,e.transformResponse,t),t.headers=vz.from(t.headers),t}),(function(t){return Ez(t)||(Cz(e),t&&t.response&&(t.response.data=wz.call(e,e.transformResponse,t.response),t.response.headers=vz.from(t.response.headers))),Promise.reject(t)}))}const Nz=e=>e instanceof vz?{...e}:e;function Rz(e,t){t=t||{};const r={};function n(e,t,r){return $D.isPlainObject(e)&&$D.isPlainObject(t)?$D.merge.call({caseless:r},e,t):$D.isPlainObject(t)?$D.merge({},t):$D.isArray(t)?t.slice():t}function i(e,t,r){return $D.isUndefined(t)?$D.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function o(e,t){if(!$D.isUndefined(t))return n(void 0,t)}function a(e,t){return $D.isUndefined(t)?$D.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function s(r,i,o){return o in t?n(r,i):o in e?n(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s,headers:(e,t)=>i(Nz(e),Nz(t),!0)};return $D.forEach(Object.keys(Object.assign({},e,t)),(function(n){const o=c[n]||i,a=o(e[n],t[n],n);$D.isUndefined(a)&&o!==s||(r[n]=a)})),r}const Fz="1.6.8",Lz={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Lz[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Uz={};Lz.transitional=function(e,t,r){function n(e,t){return"[Axios v1.6.8] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new HD(n(i," has been removed"+(t?" in "+t:"")),HD.ERR_DEPRECATED);return t&&!Uz[i]&&(Uz[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,o)}};var jz={assertOptions:function(e,t,r){if("object"!=typeof e)throw new HD("options must be an object",HD.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],a=t[o];if(a){const t=e[o],r=void 0===t||a(t,o,e);if(!0!==r)throw new HD("option "+o+" must be "+r,HD.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new HD("Unknown option "+o,HD.ERR_BAD_OPTION)}},validators:Lz};const Dz=jz.validators;let zz=class{constructor(e){this.defaults=e,this.interceptors={request:new rz,response:new rz}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t;Error.captureStackTrace?Error.captureStackTrace(t={}):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Rz(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&jz.assertOptions(r,{silentJSONParsing:Dz.transitional(Dz.boolean),forcedJSONParsing:Dz.transitional(Dz.boolean),clarifyTimeoutError:Dz.transitional(Dz.boolean)},!1),null!=n&&($D.isFunction(n)?t.paramsSerializer={serialize:n}:jz.assertOptions(n,{encode:Dz.function,serialize:Dz.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&$D.merge(i.common,i[t.method]);i&&$D.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=vz.concat(o,i);const a=[];let s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,a.unshift(e.fulfilled,e.rejected))}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let l,f=0;if(!s){const e=[Bz.bind(this),void 0];for(e.unshift.apply(e,a),e.push.apply(e,c),l=e.length,u=Promise.resolve(t);f{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new Az(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let t;return{token:new e((function(e){t=e})),cancel:t}}};const Gz={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Gz).forEach((([e,t])=>{Gz[t]=e}));var qz=Gz;const Kz=function e(t){const r=new $z(t),n=lD($z.prototype.request,r);return $D.extend(n,$z.prototype,r,{allOwnKeys:!0}),$D.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Rz(t,r))},n}(dz);Kz.Axios=$z,Kz.CanceledError=Az,Kz.CancelToken=Hz,Kz.isCancel=Ez,Kz.VERSION=Fz,Kz.toFormData=ZD,Kz.AxiosError=HD,Kz.Cancel=Kz.CanceledError,Kz.all=function(e){return Promise.all(e)},Kz.spread=function(e){return function(t){return e.apply(null,t)}},Kz.isAxiosError=function(e){return $D.isObject(e)&&!0===e.isAxiosError},Kz.mergeConfig=Rz,Kz.AxiosHeaders=vz,Kz.formToJSON=e=>lz($D.isHTMLForm(e)?new FormData(e):e),Kz.getAdapter=Mz,Kz.HttpStatusCode=qz,Kz.default=Kz;const{Axios:Vz,AxiosError:Wz,CanceledError:Jz,isCancel:Zz,CancelToken:Yz,VERSION:Xz,all:Qz,Cancel:e$,isAxiosError:t$,spread:r$,toFormData:n$,AxiosHeaders:i$,HttpStatusCode:o$,formToJSON:a$,getAdapter:s$,mergeConfig:c$}=Kz,u$=async(e,t)=>{try{const{data:{chainId:r}}=await Kz.post(`${t??"https://backend-vikp.onrender.com"}/v1/projects/get-chain-id`,{projectId:e},{headers:{"Content-Type":"application/json"}});return r}catch(e){return void console.log(e)}},l$=wN({id:42069,name:"Gelato OPTestnet",network:"gelatoOPTestnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.op-testnet.gelato.digital"],webSocket:[]},public:{http:["https://rpc.op-testnet.gelato.digital"],webSocket:[]}},blockExplorers:{default:{name:"Explorer",url:"https://blockscout.op-testnet.gelato.digital"}}}),f$=wN({id:1261120,name:"Astar zKatana",network:"astarZKatana",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zkatana.gelato.digital"],webSocket:["https://ws.zkatana.gelato.digital"]},public:{http:["https://rpc.zkatana.gelato.digital"],webSocket:["https://ws.zkatana.gelato.digital"]}},blockExplorers:{default:{name:"Explorer",url:"https://zkatana.blockscout.com"}}}),d$=wN({id:3776,name:"Astar zkEVM",network:"AstarZkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.startale.com/astar-zkevm"]},public:{http:["https://rpc.startale.com/astar-zkevm"]}},blockExplorers:{default:{name:"Astar zkEVM Explorer",url:"https://astar-zkevm.explorer.startale.com"}},contracts:{multicall3:{address:"0x36eabf148272BA81A5225C6a3637972F0EE17771",blockCreated:93528}},testnet:!1}),h$=wN({id:42170,name:"Arbitrum Nova",network:"arbitrumNova",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://nova.arbitrum.io/rpc"]},public:{http:["https://nova.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://nova.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1746963}},testnet:!1}),p$=wN({id:88153591557,name:"Arbitrum Blueberry",network:"arbitrum-blueberry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.arb-blueberry.gelato.digital"]},public:{http:["https://rpc.arb-blueberry.gelato.digital"]}},blockExplorers:{default:{name:"Gelatoscout",url:"https://arb-blueberry.gelatoscout.com"}},testnet:!0}),m$=wN({id:123420111,name:"OP Celestia Raspberry",network:"op-celestia-raspberry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.opcelestia-raspberry.gelato.digital"]},public:{http:["https://rpc.opcelestia-raspberry.gelato.digital"]}},blockExplorers:{default:{name:"Gelatoscout",url:"https://opcelestia-raspberry.gelatoscout.com"}},testnet:!0}),b$=wN({id:94204209,name:"Polygon Blackberry",network:"polybon-blackberry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.polygon-blackberry.gelato.digital"]},public:{http:["https://rpc.polygon-blackberry.gelato.digital"]}},blockExplorers:{default:{name:"Gelatoscout",url:"https://polygon-blackberry.gelatoscout.com"}},testnet:!0});var g$=Object.freeze({__proto__:null,arbitrumBlueberry:p$,arbitrumNova:h$,astarZKatana:f$,astarZkEVM:d$,gelatoOPTestnet:l$,opCelestiaRaspberry:m$,polygonBlackberry:b$});let y$=!1,v$=!1;const w$={debug:1,default:2,info:2,warning:3,error:4,off:5};let E$=w$.default,A$=null;const x$=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(r){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 _$,k$;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(_$||(_$={})),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"}(k$||(k$={}));const S$="0123456789abcdef";class P${constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==w$[r]&&this.throwArgumentError("invalid log level name","logLevel",e),E$>w$[r]||console.log.apply(console,t)}debug(...e){this._log(P$.levels.DEBUG,e)}info(...e){this._log(P$.levels.INFO,e)}warn(...e){this._log(P$.levels.WARNING,e)}makeError(e,t,r){if(v$)return this.makeError("censored error",t,{});t||(t=P$.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e>4],r+=S$[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch(t){n.push(e+"="+JSON.stringify(r[e].toString()))}})),n.push(`code=${t}`),n.push(`version=${this.version}`);const i=e;let o="";switch(t){case k$.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 k$.CALL_EXCEPTION:case k$.INSUFFICIENT_FUNDS:case k$.MISSING_NEW:case k$.NONCE_EXPIRED:case k$.REPLACEMENT_UNDERPRICED:case k$.TRANSACTION_REPLACED:case k$.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const a=new Error(e);return a.reason=i,a.code=t,Object.keys(r).forEach((function(e){a[e]=r[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,P$.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){x$&&this.throwError("platform missing String.prototype.normalize",P$.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:x$})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,P$.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,P$.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",et&&this.throwError("too many arguments"+r,P$.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",P$.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",P$.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",P$.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return A$||(A$=new P$("logger/5.7.0")),A$}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",P$.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),y$){if(!e)return;this.globalLogger().throwError("error censorship permanent",P$.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}v$=!!e,y$=!!t}static setLogLevel(e){const t=w$[e.toLowerCase()];null!=t?E$=t:P$.globalLogger().warn("invalid log level - "+e)}static from(e){return new P$(e)}}P$.errors=k$,P$.levels=_$;var I$=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const T$=new P$("properties/5.7.0");function O$(e,t,r){Object.defineProperty(e,t,{enumerable:!0,value:r,writable:!1})}function M$(e,t){for(let r=0;r<32;r++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function C$(e){return I$(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const r=e[t];return Promise.resolve(r).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function B$(e,t){e&&"object"==typeof e||T$.throwArgumentError("invalid object","object",e),Object.keys(e).forEach((r=>{t[r]||T$.throwArgumentError("invalid object key - "+r,"transaction:"+r,e)}))}function N$(e){const t={};for(const r in e)t[r]=e[r];return t}const R$={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function F$(e){if(null==e||R$[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let r=0;rU$(e))));if("object"==typeof e){const t={};for(const r in e){const n=e[r];void 0!==n&&O$(t,r,U$(n))}return t}return T$.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function U$(e){return L$(e)}class j${constructor(e){for(const t in e)this[t]=U$(e[t])}}var D$=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const z$=new P$("abstract-signer/5.7.0"),$$=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],H$=[P$.errors.INSUFFICIENT_FUNDS,P$.errors.NONCE_EXPIRED,P$.errors.REPLACEMENT_UNDERPRICED];class G${constructor(){z$.checkAbstract(new.target,G$),O$(this,"_isSigner",!0)}getBalance(e){return D$(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return D$(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return D$(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield C$(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return D$(this,void 0,void 0,(function*(){this._checkProvider("call");const r=yield C$(this.checkTransaction(e));return yield this.provider.call(r,t)}))}sendTransaction(e){return D$(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)}))}getChainId(){return D$(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return D$(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return D$(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return D$(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===$$.indexOf(t)&&z$.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=N$(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()&&z$.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return D$(this,void 0,void 0,(function*(){const t=yield C$(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>D$(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&z$.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const r=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!r?0!==t.type&&1!==t.type||!r||z$.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):z$.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?(r&&z$.throwError("network does not support EIP-1559",P$.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):z$.throwError("failed to get consistent fee data",P$.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(H$.indexOf(e.code)>=0)throw e;return z$.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",P$.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]&&z$.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield C$(t)}))}_checkProvider(e){this.provider||z$.throwError("missing provider",P$.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class q$ extends G${constructor(e,t){super(),O$(this,"address",e),O$(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{z$.throwError(e,P$.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,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new q$(this.address,e)}}const K$=new P$("bytes/5.7.0");function V$(e){return!!e.toHexString}function W$(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return W$(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function J$(e){return rH(e)&&!(e.length%2)||Y$(e)}function Z$(e){return"number"==typeof e&&e==e&&e%1==0}function Y$(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Z$(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function X$(e,t){if(t||(t={}),"number"==typeof e){K$.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),W$(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),V$(e)&&(e=e.toHexString()),rH(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":K$.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;eX$(e))),r=t.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(r);return t.reduce(((e,t)=>(n.set(t,e),e+t.length)),0),W$(n)}function eH(e){let t=X$(e);if(0===t.length)return t;let r=0;for(;rt&&K$.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(t);return r.set(e,t-e.length),W$(r)}function rH(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}const nH="0123456789abcdef";function iH(e,t){if(t||(t={}),"number"==typeof e){K$.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t=nH[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),V$(e))return e.toHexString();if(rH(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":K$.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Y$(e)){let t="0x";for(let r=0;r>4]+nH[15&n]}return t}return K$.throwArgumentError("invalid hexlify value","value",e)}function oH(e){if("string"!=typeof e)e=iH(e);else if(!rH(e)||e.length%2)return null;return(e.length-2)/2}function aH(e,t,r){return"string"!=typeof e?e=iH(e):(!rH(e)||e.length%2)&&K$.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function sH(e){let t="0x";return e.forEach((e=>{t+=iH(e).substring(2)})),t}function cH(e){const t=uH(iH(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function uH(e){"string"!=typeof e&&(e=iH(e)),rH(e)||K$.throwArgumentError("invalid hex string","value",e),e=e.substring(2);let t=0;for(;t2*t+2&&K$.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function fH(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(J$(e)){let r=X$(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=iH(r.slice(0,32)),t.s=iH(r.slice(32,64))):65===r.length?(t.r=iH(r.slice(0,32)),t.s=iH(r.slice(32,64)),t.v=r[64]):K$.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:K$.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=iH(r.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 r=tH(X$(t._vs),32);t._vs=iH(r);const n=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=n:t.recoveryParam!==n&&K$.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;const i=iH(r);null==t.s?t.s=i:t.s!==i&&K$.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?K$.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 r=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==r&&K$.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&rH(t.r)?t.r=lH(t.r,32):K$.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&rH(t.s)?t.s=lH(t.s,32):K$.throwArgumentError("signature missing or invalid s","signature",e);const r=X$(t.s);r[0]>=128&&K$.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(r[0]|=128);const n=iH(r);t._vs&&(rH(t._vs)||K$.throwArgumentError("signature invalid _vs","signature",e),t._vs=lH(t._vs,32)),null==t._vs?t._vs=n:t._vs!==n&&K$.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function dH(e){return iH(Q$([(e=fH(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}var hH={exports:{}};!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"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:fe.Buffer}catch(e){}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,n,i){for(var o=0,a=0,s=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.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++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=s(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l1&&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?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.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>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),n=0!==o||a!==this.length-1?f[6-c.length]+c+n:c+n}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 u=d[e],l=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(e);n=(p=p.idivn(l)).isZero()?m+n:f[u-m.length]+m+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")},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&&r(!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 p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&c,d=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=d;h++){var p=u-h|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&a}r.words[u]=0|f,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();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");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 r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},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;te.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 r=0;re.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,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.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){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;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.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<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.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 r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,b=0|a[2],g=8191&b,y=b>>>13,v=0|a[3],w=8191&v,E=v>>>13,A=0|a[4],x=8191&A,_=A>>>13,k=0|a[5],S=8191&k,P=k>>>13,I=0|a[6],T=8191&I,O=I>>>13,M=0|a[7],C=8191&M,B=M>>>13,N=0|a[8],R=8191&N,F=N>>>13,L=0|a[9],U=8191&L,j=L>>>13,D=0|s[0],z=8191&D,$=D>>>13,H=0|s[1],G=8191&H,q=H>>>13,K=0|s[2],V=8191&K,W=K>>>13,J=0|s[3],Z=8191&J,Y=J>>>13,X=0|s[4],Q=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],fe=8191&le,de=le>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,$))+Math.imul(d,z)|0))<<13)|0;u=((o=Math.imul(d,$))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,$))+Math.imul(m,z)|0,o=Math.imul(m,$);var ge=(u+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,q)|0)+Math.imul(d,G)|0))<<13)|0;u=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,z),i=(i=Math.imul(g,$))+Math.imul(y,z)|0,o=Math.imul(y,$),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,q)|0;var ye=(u+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,$))+Math.imul(E,z)|0,o=Math.imul(E,$),n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var ve=(u+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(x,z),i=(i=Math.imul(x,$))+Math.imul(_,z)|0,o=Math.imul(_,$),n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,q)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,q)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Y)|0;var we=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,$))+Math.imul(P,z)|0,o=Math.imul(P,$),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,Y)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var Ee=(u+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,$))+Math.imul(O,z)|0,o=Math.imul(O,$),n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,Y)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var Ae=(u+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,$))+Math.imul(B,z)|0,o=Math.imul(B,$),n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,q)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,q)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var xe=(u+(n=n+Math.imul(f,ce)|0)|0)+((8191&(i=(i=i+Math.imul(f,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,$))+Math.imul(F,z)|0,o=Math.imul(F,$),n=n+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,q)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var _e=(u+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(U,z),i=(i=Math.imul(U,$))+Math.imul(j,z)|0,o=Math.imul(j,$),n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,q)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,q)|0,n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,n=n+Math.imul(g,ce)|0,i=(i=i+Math.imul(g,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,de)|0;var ke=(u+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,q))+Math.imul(j,G)|0,o=Math.imul(j,q),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,W)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(P,re)|0,o=o+Math.imul(P,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,n=n+Math.imul(g,fe)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,de)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,W))+Math.imul(j,V)|0,o=Math.imul(j,W),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(F,Z)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,ue)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(E,fe)|0,o=o+Math.imul(E,de)|0;var Pe=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,Y))+Math.imul(j,Z)|0,o=Math.imul(j,Y),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(P,ce)|0,o=o+Math.imul(P,ue)|0,n=n+Math.imul(x,fe)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,de)|0;var Ie=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,ee))+Math.imul(j,Q)|0,o=Math.imul(j,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(F,re)|0,o=o+Math.imul(F,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,n=n+Math.imul(S,fe)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(P,fe)|0,o=o+Math.imul(P,de)|0;var Te=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(_,pe)|0))<<13)|0;u=((o=o+Math.imul(_,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(j,re)|0,o=Math.imul(j,ne),n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(F,oe)|0,o=o+Math.imul(F,ae)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(B,ce)|0,o=o+Math.imul(B,ue)|0,n=n+Math.imul(T,fe)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(P,pe)|0))<<13)|0;u=((o=o+Math.imul(P,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,ae))+Math.imul(j,oe)|0,o=Math.imul(j,ae),n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(F,ce)|0,o=o+Math.imul(F,ue)|0,n=n+Math.imul(C,fe)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,de)|0;var Me=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(F,fe)|0,o=o+Math.imul(F,de)|0;var Ce=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(U,fe),i=(i=Math.imul(U,de))+Math.imul(j,fe)|0,o=Math.imul(j,de);var Be=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(F,pe)|0))<<13)|0;u=((o=o+Math.imul(F,me)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(u+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,me))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,me))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=be,c[1]=ge,c[2]=ye,c[3]=ve,c[4]=we,c[5]=Ee,c[6]=Ae,c[7]=xe,c[8]=_e,c[9]=ke,c[10]=Se,c[11]=Pe,c[12]=Ie,c[13]=Te,c[14]=Oe,c[15]=Me,c[16]=Ce,c[17]=Be,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function g(e,t,r){return b(e,t,r)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?b(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),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i>=26,n+=o/67108864|0,n+=a>>>26,this.words[i]=67108863&a}return 0!==n&&(this.words[i]=n,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()),r=0;r>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=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>>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=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==l||u>=i);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},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){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=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<=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(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>26)-(c/67108864|0),this.words[i+n]=67108863&o}for(;i>26,this.words[i+n]=67108863&o;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,c=n.length-o.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var d=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!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(),n&&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}):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 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 r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);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),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*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),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.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 o=new i(1),a=new i(0),s=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),f=t.clone();!t.isZero();){for(var d=0,h=1;!(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(f)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;!(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(f)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s),a.isub(c)):(n.isub(t),s.isub(o),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},i.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 o,a=new i(1),s=new i(0),c=n.clone();t.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,l=1;!(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var f=0,d=1;!(n.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(n.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);t.cmp(n)>=0?(t.isub(n),a.isub(s)):(n.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(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>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,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:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(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 _(e)},i.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)},i.prototype.fromRed=function(){return r(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 r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function v(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 w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._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 k(e){_.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)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(w,v),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new E;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new x}return y[e]=t,t},_.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.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 i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var f=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var f=u>>l&1;o!==r[0]&&(o=this.sqr(o)),0!==f||0!==a?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}c=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new k(e)},n(k,_),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).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)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).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)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,o)}(hH);var pH=a(hH.exports);const mH="bignumber/5.7.0";var bH=pH.BN;const gH=new P$(mH),yH={},vH=9007199254740991;let wH=!1;class EH{constructor(e,t){e!==yH&&gH.throwError("cannot call constructor directly; use BigNumber.from",P$.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return xH(_H(this).fromTwos(e))}toTwos(e){return xH(_H(this).toTwos(e))}abs(){return"-"===this._hex[0]?EH.from(this._hex.substring(1)):this}add(e){return xH(_H(this).add(_H(e)))}sub(e){return xH(_H(this).sub(_H(e)))}div(e){return EH.from(e).isZero()&&kH("division-by-zero","div"),xH(_H(this).div(_H(e)))}mul(e){return xH(_H(this).mul(_H(e)))}mod(e){const t=_H(e);return t.isNeg()&&kH("division-by-zero","mod"),xH(_H(this).umod(t))}pow(e){const t=_H(e);return t.isNeg()&&kH("negative-power","pow"),xH(_H(this).pow(t))}and(e){const t=_H(e);return(this.isNegative()||t.isNeg())&&kH("unbound-bitwise-result","and"),xH(_H(this).and(t))}or(e){const t=_H(e);return(this.isNegative()||t.isNeg())&&kH("unbound-bitwise-result","or"),xH(_H(this).or(t))}xor(e){const t=_H(e);return(this.isNegative()||t.isNeg())&&kH("unbound-bitwise-result","xor"),xH(_H(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&kH("negative-width","mask"),xH(_H(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&kH("negative-width","shl"),xH(_H(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&kH("negative-width","shr"),xH(_H(this).shrn(e))}eq(e){return _H(this).eq(_H(e))}lt(e){return _H(this).lt(_H(e))}lte(e){return _H(this).lte(_H(e))}gt(e){return _H(this).gt(_H(e))}gte(e){return _H(this).gte(_H(e))}isNegative(){return"-"===this._hex[0]}isZero(){return _H(this).isZero()}toNumber(){try{return _H(this).toNumber()}catch(e){kH("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return gH.throwError("this platform does not support BigInt",P$.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?wH||(wH=!0,gH.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?gH.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",P$.errors.UNEXPECTED_ARGUMENT,{}):gH.throwError("BigNumber.toString does not accept parameters",P$.errors.UNEXPECTED_ARGUMENT,{})),_H(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof EH)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new EH(yH,AH(e)):e.match(/^-?[0-9]+$/)?new EH(yH,AH(new bH(e))):gH.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&kH("underflow","BigNumber.from",e),(e>=vH||e<=-vH)&&kH("overflow","BigNumber.from",e),EH.from(String(e));const t=e;if("bigint"==typeof t)return EH.from(t.toString());if(Y$(t))return EH.from(iH(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return EH.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(rH(e)||"-"===e[0]&&rH(e.substring(1))))return EH.from(e)}return gH.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function AH(e){if("string"!=typeof e)return AH(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&gH.throwArgumentError("invalid hex","value",e),"0x00"===(e=AH(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 xH(e){return EH.from(AH(e))}function _H(e){const t=EH.from(e).toHexString();return"-"===t[0]?new bH("-"+t.substring(3),16):new bH(t.substring(2),16)}function kH(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),gH.throwError(e,P$.errors.NUMERIC_FAULT,n)}const SH=new P$(mH),PH={},IH=EH.from(0),TH=EH.from(-1);function OH(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),SH.throwError(e,P$.errors.NUMERIC_FAULT,i)}let MH="0";for(;MH.length<256;)MH+=MH;function CH(e){if("number"!=typeof e)try{e=EH.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+MH.substring(0,e):SH.throwArgumentError("invalid decimal size","decimals",e)}function BH(e,t){null==t&&(t=0);const r=CH(t),n=(e=EH.from(e)).lt(IH);n&&(e=e.mul(TH));let i=e.mod(r).toString();for(;i.length2&&SH.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>r.length-1&&OH("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.lengthnull==e[t]?n:(typeof e[t]!==r&&SH.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&SH.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&SH.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new RH(PH,t,r,n)}}class FH{constructor(e,t,r,n){e!==PH&&SH.throwError("cannot use FixedNumber constructor; use FixedNumber.from",P$.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&SH.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=NH(this._value,this.format.decimals),r=NH(e._value,e.format.decimals);return FH.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=NH(this._value,this.format.decimals),r=NH(e._value,e.format.decimals);return FH.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=NH(this._value,this.format.decimals),r=NH(e._value,e.format.decimals);return FH.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=NH(this._value,this.format.decimals),r=NH(e._value,e.format.decimals);return FH.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=FH.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(LH.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=FH.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(LH.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)&&SH.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=FH.from("1"+MH.substring(0,e),this.format),n=UH.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}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&&SH.throwArgumentError("invalid byte width","width",e);return lH(EH.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return FH.fromString(this._value,e)}static fromValue(e,t,r){return null!=r||null==t||function(e){return null!=e&&(EH.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||rH(e)||"bigint"==typeof e||Y$(e))}(t)||(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),FH.fromString(BH(e,t),RH.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=RH.from(t),n=NH(e,r.decimals);!r.signed&&n.lt(IH)&&OH("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=lH(i,r.width/8));const o=BH(n,r.decimals);return new FH(PH,i,o,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=RH.from(t);if(X$(e).length>r.width/8)throw new Error("overflow");let n=EH.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=BH(n,r.decimals);return new FH(PH,i,o,r)}static from(e,t){if("string"==typeof e)return FH.fromString(e,t);if(Y$(e))return FH.fromBytes(e,t);try{return FH.fromValue(e,0,t)}catch(e){if(e.code!==P$.errors.INVALID_ARGUMENT)throw e}return SH.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const LH=FH.from(1),UH=FH.from("0.5");var jH={exports:{}};!function(e){!function(){var t="input is invalid type",r="object"==typeof window,n=r?window:{};n.JS_SHA3_NO_WINDOW&&(r=!1);var i=!r&&"object"==typeof self;!n.JS_SHA3_NO_NODE_JS&&"object"==typeof pr&&pr.versions&&pr.versions.node?n=o:i&&(n=self);var a=!n.JS_SHA3_NO_COMMON_JS&&e.exports,s=!n.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,c="0123456789abcdef".split(""),u=[4,1024,262144,67108864],l=[0,8,16,24],f=[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"],m={128:168,256:136};!n.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!s||!n.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 b=function(e,t,r){return function(n){return new M(e,t,e).update(n)[r]()}},g=function(e,t,r){return function(n,i){return new M(e,t,i).update(n)[r]()}},y=function(e,t,r){return function(t,n,i,o){return x["cshake"+e].update(t,n,i,o)[r]()}},v=function(e,t,r){return function(t,n,i,o){return x["kmac"+e].update(t,n,i,o)[r]()}},w=function(e,t,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function C(e,t,r){M.call(this,e,t,r)}M.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var r,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}for(var i,o,a=this.blocks,c=this.byteCount,u=e.length,f=this.blockCount,d=0,h=this.s;d>2]|=e[d]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(a[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=c){for(this.start=i-c,this.block=a[f],i=0;i>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},M.prototype.encodeString=function(e){var r,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);r=!0}var i=0,o=e.length;if(r)i=o;else for(var a=0;a=57344?i+=3:(c=65536+((1023&c)<<10|1023&e.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(e),i},M.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+c[15&e]+c[e>>12&15]+c[e>>8&15]+c[e>>20&15]+c[e>>16&15]+c[e>>28&15]+c[e>>24&15];a%t==0&&(B(r),o=0)}return i&&(e=r[o],s+=c[e>>4&15]+c[15&e],i>1&&(s+=c[e>>12&15]+c[e>>8&15]),i>2&&(s+=c[e>>20&15]+c[e>>16&15])),s},M.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var c=new Uint32Array(e);a>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;s%r==0&&B(n)}return o&&(e=s<<2,t=n[a],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},C.prototype=new M,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),M.prototype.finalize.call(this)};var B=function(e){var t,r,n,i,o,a,s,c,u,l,d,h,p,m,b,g,y,v,w,E,A,x,_,k,S,P,I,T,O,M,C,B,N,R,F,L,U,j,D,z,$,H,G,q,K,V,W,J,Z,Y,X,Q,ee,te,re,ne,ie,oe,ae,se,ce,ue,le;for(n=0;n<48;n+=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],c=e[4]^e[14]^e[24]^e[34]^e[44],u=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|u>>>31),r=o^(u<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(l<<1|d>>>31),r=s^(d<<1|l>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(h<<1|p>>>31),r=u^(p<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=l^(i<<1|o>>>31),r=d^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],b=e[1],V=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,O=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,F=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,M=e[33]<<13|e[32]>>>19,C=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Y=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,j=e[26]<<25|e[27]>>>7,D=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,A=e[37]<<21|e[36]>>>11,Q=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,K=e[9]<<27|e[8]>>>5,P=e[18]<<20|e[19]>>>12,I=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,$=e[39]<<8|e[38]>>>24,x=e[48]<<14|e[49]>>>18,_=e[49]<<14|e[48]>>>18,e[0]=m^~g&v,e[1]=b^~y&w,e[10]=k^~P&T,e[11]=S^~I&O,e[20]=R^~L&j,e[21]=F^~U&D,e[30]=q^~V&J,e[31]=K^~W&Z,e[40]=te^~ne&oe,e[41]=re^~ie&ae,e[2]=g^~v&E,e[3]=y^~w&A,e[12]=P^~T&M,e[13]=I^~O&C,e[22]=L^~j&z,e[23]=U^~D&$,e[32]=V^~J&Y,e[33]=W^~Z&X,e[42]=ne^~oe&se,e[43]=ie^~ae&ce,e[4]=v^~E&x,e[5]=w^~A&_,e[14]=T^~M&B,e[15]=O^~C&N,e[24]=j^~z&H,e[25]=D^~$&G,e[34]=J^~Y&Q,e[35]=Z^~X&ee,e[44]=oe^~se&ue,e[45]=ae^~ce&le,e[6]=E^~x&m,e[7]=A^~_&b,e[16]=M^~B&k,e[17]=C^~N&S,e[26]=z^~H&R,e[27]=$^~G&F,e[36]=Y^~Q&q,e[37]=X^~ee&K,e[46]=se^~ue&te,e[47]=ce^~le&re,e[8]=x^~m&g,e[9]=_^~b&y,e[18]=B^~k&P,e[19]=N^~S&I,e[28]=H^~R&L,e[29]=G^~F&U,e[38]=Q^~q&V,e[39]=ee^~K&W,e[48]=ue^~te&ne,e[49]=le^~re&ie,e[0]^=f[n],e[1]^=f[n+1]};if(a)e.exports=x;else for(k=0;k<_.length;++k)n[_[k]]=x[_[k]]}()}(jH);var DH=a(jH.exports);function zH(e){return"0x"+DH.keccak_256(X$(e))}const $H=new P$("rlp/5.7.0");function HH(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function GH(e,t,r){let n=0;for(let i=0;it+1+n&&$H.throwError("child data too short",P$.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function WH(e,t){if(0===e.length&&$H.throwError("data too short",P$.errors.BUFFER_OVERRUN,{}),e[t]>=248){const r=e[t]-247;t+1+r>e.length&&$H.throwError("data short segment too short",P$.errors.BUFFER_OVERRUN,{});const n=GH(e,t+1,r);return t+1+r+n>e.length&&$H.throwError("data long segment too short",P$.errors.BUFFER_OVERRUN,{}),VH(e,t,t+1+r,r+n)}if(e[t]>=192){const r=e[t]-192;return t+1+r>e.length&&$H.throwError("data array too short",P$.errors.BUFFER_OVERRUN,{}),VH(e,t,t+1,r)}if(e[t]>=184){const r=e[t]-183;t+1+r>e.length&&$H.throwError("data array too short",P$.errors.BUFFER_OVERRUN,{});const n=GH(e,t+1,r);t+1+r+n>e.length&&$H.throwError("data array too short",P$.errors.BUFFER_OVERRUN,{});return{consumed:1+r+n,result:iH(e.slice(t+1+r,t+1+r+n))}}if(e[t]>=128){const r=e[t]-128;t+1+r>e.length&&$H.throwError("data too short",P$.errors.BUFFER_OVERRUN,{});return{consumed:1+r,result:iH(e.slice(t+1,t+1+r))}}return{consumed:1,result:iH(e[t])}}function JH(e){const t=X$(e),r=WH(t,0);return r.consumed!==t.length&&$H.throwArgumentError("invalid rlp data","data",e),r.result}var ZH=Object.freeze({__proto__:null,decode:JH,encode:KH});const YH=new P$("address/5.7.0");function XH(e){rH(e,20)||YH.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let e=0;e<40;e++)r[e]=t[e].charCodeAt(0);const n=X$(zH(r));for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&n[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const QH={};for(let e=0;e<10;e++)QH[String(e)]=String(e);for(let e=0;e<26;e++)QH[String.fromCharCode(65+e)]=String(10+e);const eG=Math.floor(function(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}(9007199254740991));function tG(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>QH[e])).join("");for(;t.length>=eG;){let e=t.substring(0,eG);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}function rG(e){let t=null;if("string"!=typeof e&&YH.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=XH(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&YH.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)!==tG(e)&&YH.throwArgumentError("bad icap checksum","address",e),t=function(e){return new bH(e,36).toString(16)}(e.substring(4));t.length<40;)t="0"+t;t=XH("0x"+t)}else YH.throwArgumentError("invalid address","address",e);return t}function nG(e){let t=null;try{t=rG(e.from)}catch(t){YH.throwArgumentError("missing from address","transaction",e)}return rG(aH(zH(KH([t,eH(X$(EH.from(e.nonce).toHexString()))])),12))}var iG=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const oG=new P$("abstract-provider/5.7.0");class aG extends j${static isForkEvent(e){return!(!e||!e._isForkEvent)}}class sG{constructor(){oG.checkAbstract(new.target,sG),O$(this,"_isProvider",!0)}getFeeData(){return iG(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield C$({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let r=null,n=null,i=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,i=EH.from("1500000000"),n=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:r,maxFeePerGas:n,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)}}const cG="0x0000000000000000000000000000000000000000",uG=EH.from(-1),lG=EH.from(0),fG=EH.from(1),dG=EH.from(2),hG=EH.from("1000000000000000000"),pG=EH.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),mG=EH.from("-0x8000000000000000000000000000000000000000000000000000000000000000"),bG=EH.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),gG="0x0000000000000000000000000000000000000000000000000000000000000000";var yG=Object.freeze({__proto__:null,AddressZero:cG,EtherSymbol:"Ξ",HashZero:gG,MaxInt256:bG,MaxUint256:pG,MinInt256:mG,NegativeOne:uG,One:fG,Two:dG,WeiPerEther:hG,Zero:lG});const vG=new P$("strings/5.7.0");var wG,EG;function AG(e,t,r,n,i){if(e===EG.BAD_PREFIX||e===EG.UNEXPECTED_CONTINUE){let e=0;for(let n=t+1;n>6==2;n++)e++;return e}return e===EG.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(wG||(wG={})),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 xG=Object.freeze({error:function(e,t,r,n,i){return vG.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:AG,replace:function(e,t,r,n,i){return e===EG.OVERLONG?(n.push(i),0):(n.push(65533),AG(e,t,r))}});function _G(e,t){null==t&&(t=xG.error),e=X$(e);const r=[];let n=0;for(;n>7)){r.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)){n+=t(128==(192&i)?EG.UNEXPECTED_CONTINUE:EG.BAD_PREFIX,n-1,e,r);continue}o=3,a=65535}if(n-1+o>=e.length){n+=t(EG.OVERRUN,n-1,e,r);continue}let s=i&(1<<8-o-1)-1;for(let i=0;i1114111?n+=t(EG.OUT_OF_RANGE,n-1-o,e,r,s):s>=55296&&s<=57343?n+=t(EG.UTF16_SURROGATE,n-1-o,e,r,s):s<=a?n+=t(EG.OVERLONG,n-1-o,e,r,s):r.push(s))}return r}function kG(e,t=wG.current){t!=wG.current&&(vG.checkNormalize(),e=e.normalize(t));let r=[];for(let t=0;t>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return X$(r)}function SG(e){const t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function PG(e){return e.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function IG(e,t){return PG(_G(e,t))}function TG(e,t=wG.current){return _G(kG(e,t))}function OG(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function MG(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function CG(e,t){let r=0;for(let n=0;n=r&&e<=r+i.h&&(e-r)%(i.d||1)==0){if(i.e&&-1!==i.e.indexOf(e-r))continue;return i}}return null}const BG=MG("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),NG="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),RG=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],FG=OG("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),LG=OG("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),UG=OG("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;r0&&Array.isArray(e)?i(e,t-1):r.push(e)}))};return i(e,t),r}function KG(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,o=[0,1];for(let e=1;e>--c&1}const f=Math.pow(2,31),d=f>>>1,h=d>>1,p=f-1;let m=0;for(let e=0;e<31;e++)m=m<<1|l();let b=[],g=0,y=f;for(;;){let e=Math.floor(((m-g+1)*i-1)/y),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e>>1|l(),a=a<<1^d,s=(s^d)<<1|d|1;g=a,y=1+s-a}let v=n-4;return b.map((t=>{switch(t-v){case 3:return v+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return v+256+(e[s++]<<8|e[s++]);case 1:return v+e[s++];default:return t-1}}))}(e))}function VG(e){return 1&e?~e>>1:e>>1}function WG(e,t){let r=Array(e);for(let n=0,i=-1;nt[e])):r}function YG(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let i=0;in[t].push(e)));return n}function XG(e,t){let r=1+t(),n=t(),i=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}(t);return qG(YG(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*n;return[o+t*r,a.map((e=>e+i))]}))})))}function QG(e,t){return YG(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const eq=KG($G("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==")),tq=new Set(ZG(eq)),rq=new Set(ZG(eq)),nq=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(XG(r,e))}for(;;){let r=e()-1;if(r<0)break;t.push(QG(r,e))}return function(e){const t={};for(let r=0;re-t));return function r(){let n=[];for(;;){let i=ZG(e,t);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.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:n,valid:o,fe0f:a,save:1==i,check:2==i}}()}(eq),oq=45,aq=95;function sq(e){return TG(e)}function cq(e){return e.filter((e=>65039!=e))}function uq(e){for(let t of e.split(".")){let e=sq(t);try{for(let t=e.lastIndexOf(aq)-1;t>=0;t--)if(e[t]!==aq)throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&e[2]===oq&&e[3]===oq)throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function lq(e){return uq(function(e,t){let r=sq(e).reverse(),n=[];for(;r.length;){let e=fq(r);if(e){n.push(...t(e));continue}let i=r.pop();if(tq.has(i)){n.push(i);continue}if(rq.has(i))continue;let o=nq[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);n.push(...o)}return uq(function(e){return e.normalize("NFC")}(String.fromCodePoint(...n)))}(e,cq))}function fq(e,t){var r;let n,i,o=iq,a=[],s=e.length;for(t&&(t.length=0);s;){let c=e[--s];if(o=null===(r=o.branches.find((e=>e.set.has(c))))||void 0===r?void 0:r.node,!o)break;if(o.save)i=c;else if(o.check&&c===i)break;a.push(c),o.fe0f&&(a.push(65039),s>0&&65039==e[s-1]&&s--),o.valid&&(n=a.slice(),2==o.valid&&n.splice(1,1),t&&t.push(...e.slice(s).reverse()),e.length=s)}return n}const dq=new P$(zG),hq=new Uint8Array(32);function pq(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function mq(e){const t=kG(lq(e)),r=[];if(0===e.length)return r;let n=0;for(let e=0;e=t.length)throw new Error("invalid ENS name; empty component");return r.push(pq(t.slice(n))),r}function bq(e){"string"!=typeof e&&dq.throwArgumentError("invalid ENS name; not a string","name",e);let t=hq;const r=mq(e);for(;r.length;)t=zH(Q$([t,zH(r.pop())]));return iH(t)}function gq(e){return iH(Q$(mq(e).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"}hq.fill(0);const yq="Ethereum Signed Message:\n";function vq(e){return"string"==typeof e&&(e=kG(e)),zH(Q$([kG(yq),kG(String(e.length)),e]))}var wq=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const Eq=new P$(zG),Aq=new Uint8Array(32);Aq.fill(0);const xq=EH.from(-1),_q=EH.from(0),kq=EH.from(1),Sq=EH.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Pq=lH(kq.toHexString(),32),Iq=lH(_q.toHexString(),32),Tq={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Oq=["name","version","chainId","verifyingContract","salt"];function Mq(e){return function(t){return"string"!=typeof t&&Eq.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const Cq={name:Mq("name"),version:Mq("version"),chainId:function(e){try{return EH.from(e).toString()}catch(e){}return Eq.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return rG(e).toLowerCase()}catch(e){}return Eq.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=X$(e);if(32!==t.length)throw new Error("bad length");return iH(t)}catch(e){}return Eq.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function Bq(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const r=""===t[1],n=parseInt(t[2]||"256");(n%8!=0||n>256||t[2]&&t[2]!==String(n))&&Eq.throwArgumentError("invalid numeric width","type",e);const i=Sq.mask(r?n-1:n),o=r?i.add(kq).mul(xq):_q;return function(t){const r=EH.from(t);return(r.lt(o)||r.gt(i))&&Eq.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),lH(r.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return(0===r||r>32||t[1]!==String(r))&&Eq.throwArgumentError("invalid bytes width","type",e),function(t){return X$(t).length!==r&&Eq.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=X$(e),r=t.length%32;return r?sH([t,Aq.slice(r)]):iH(t)}(t)}}}switch(e){case"address":return function(e){return lH(rG(e),32)};case"bool":return function(e){return e?Pq:Iq};case"bytes":return function(e){return zH(e)};case"string":return function(e){return DG(e)}}return null}function Nq(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class Rq{constructor(e){O$(this,"types",Object.freeze(U$(e))),O$(this,"_encoderCache",{}),O$(this,"_types",{});const t={},r={},n={};Object.keys(e).forEach((e=>{t[e]={},r[e]=[],n[e]={}}));for(const n in e){const i={};e[n].forEach((o=>{i[o.name]&&Eq.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(n)}`,"types",e),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===n&&Eq.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e);Bq(a)||(r[a]||Eq.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",e),r[a].push(n),t[n][a]=!0)}))}const i=Object.keys(r).filter((e=>0===r[e].length));0===i.length?Eq.throwArgumentError("missing primary type","types",e):i.length>1&&Eq.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),O$(this,"primaryType",i[0]),function i(o,a){a[o]&&Eq.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e),a[o]=!0,Object.keys(t[o]).forEach((e=>{r[e]&&(i(e,a),Object.keys(a).forEach((t=>{n[t][e]=!0})))})),delete a[o]}(this.primaryType,{});for(const t in n){const r=Object.keys(n[t]);r.sort(),this._types[t]=Nq(t,e[t])+r.map((t=>Nq(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=Bq(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],r=this.getEncoder(e),n=parseInt(t[3]);return t=>{n>=0&&t.length!==n&&Eq.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(r);return this._types[e]&&(i=i.map(zH)),zH(sH(i))}}const r=this.types[e];if(r){const t=DG(this._types[e]);return e=>{const n=r.map((({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this._types[r]?zH(n):n}));return n.unshift(t),sH(n)}}return Eq.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Eq.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return zH(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(Bq(e))return r(e,t);const n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){const e=n[1],i=parseInt(n[3]);return i>=0&&t.length!==i&&Eq.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,r)))}const i=this.types[e];return i?i.reduce(((e,{name:n,type:i})=>(e[n]=this._visit(i,t[n],r),e)),{}):Eq.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Rq(e)}static getPrimaryType(e){return Rq.from(e).primaryType}static hashStruct(e,t,r){return Rq.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const n=Tq[r];n||Eq.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort(((e,t)=>Oq.indexOf(e.name)-Oq.indexOf(t.name))),Rq.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return sH(["0x1901",Rq.hashDomain(e),Rq.from(t).hash(r)])}static hash(e,t,r){return zH(Rq.encode(e,t,r))}static resolveNames(e,t,r,n){return wq(this,void 0,void 0,(function*(){e=N$(e);const i={};e.verifyingContract&&!rH(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=Rq.from(t);o.visit(r,((e,t)=>("address"!==e||rH(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield n(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=o.visit(r,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:r}}))}static getPayload(e,t,r){Rq.hashDomain(e);const n={},i=[];Oq.forEach((t=>{const r=e[t];null!=r&&(n[t]=Cq[t](r),i.push({name:t,type:Tq[t]}))}));const o=Rq.from(t),a=N$(t);return a.EIP712Domain?Eq.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=i,o.encode(r),{types:a,domain:n,primaryType:o.primaryType,message:o.visit(r,((e,t)=>{if(e.match(/^bytes(\d*)/))return iH(X$(t));if(e.match(/^u?int/))return EH.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&Eq.throwArgumentError("invalid string","value",t),t}return Eq.throwArgumentError("unsupported type","type",e)}))}}}class Fq{constructor(e){O$(this,"alphabet",e),O$(this,"base",e.length),O$(this,"_alphabetMap",{}),O$(this,"_leader",e.charAt(0));for(let t=0;t0;)r.push(n%this.base),n=n/this.base|0}let n="";for(let e=0;0===t[e]&&e=0;--e)n+=this.alphabet[r[e]];return n}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 r=0;r>=8;for(;i>0;)t.push(255&i),i>>=8}for(let r=0;e[r]===this._leader&&r>24&255,c[t.length+1]=f>>16&255,c[t.length+2]=f>>8&255,c[t.length+3]=255&f;let d=X$($q(i,e,c));o||(o=d.length,l=new Uint8Array(o),a=Math.ceil(n/o),u=n-(a-1)*o),l.set(d);for(let t=1;t>8,a=255&i;o?r.push(o,a):r.push(a)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),Wq=Gq((function(e,t){var r=t;r.assert=qq,r.toArray=Vq.toArray,r.zero2=Vq.zero2,r.toHex=Vq.toHex,r.encode=Vq.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),a=1&c?3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c:0,r[0].push(a),s=1&u?3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u:0,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new pH(e,"hex","le")}})),Jq=Wq.getNAF,Zq=Wq.getJSF,Yq=Wq.assert;function Xq(e,t){this.type=e,this.p=new pH(t.p,16),this.red=t.prime?pH.red(t.prime):pH.mont(this.p),this.zero=new pH(0).toRed(this.red),this.one=new pH(1).toRed(this.red),this.two=new pH(2).toRed(this.red),this.n=t.n&&new pH(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 r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Qq=Xq;function eK(e,t){this.curve=e,this.type=t,this.precomputed=null}Xq.prototype.point=function(){throw new Error("Not implemented")},Xq.prototype.validate=function(){throw new Error("Not implemented")},Xq.prototype._fixedNafMul=function(e,t){Yq(e.precomputed);var r=e._getDoubles(),n=Jq(t,1,this._bitLength),i=(1<=o;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=i;f>0;f--){for(o=0;o=0;s--){for(var c=0;s>=0&&0===o[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=o[s];Yq(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},Xq.prototype._wnafMulAdd=function(e,t,r,n,i){var o,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===c[h]&&1===c[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],g=Zq(r[h],r[p]);for(f=Math.max(g[0].length,f),l[h]=new Array(f),l[p]=new Array(f),a=0;a=0;o--){for(var A=0;o>=0;){var x=!0;for(a=0;a=0&&A++,w=w.dblp(A),o<0)break;for(a=0;a0?s=u[a][_-1>>1]:_<0&&(s=u[a][-_-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},eK.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},nK.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},nK.prototype.pointFromX=function(e,t){(e=new pH(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},nK.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},nK.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},oK.prototype.isInfinity=function(){return this.inf},oK.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 r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},oK.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,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),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)},oK.prototype.getX=function(){return this.x.fromRed()},oK.prototype.getY=function(){return this.y.fromRed()},oK.prototype.mul=function(e){return e=new pH(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)},oK.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},oK.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},oK.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))},oK.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},oK.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},tK(aK,Qq.BasePoint),nK.prototype.jpoint=function(e,t,r){return new aK(this,e,t,r)},aK.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},aK.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},aK.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),f=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(f).redISub(f),h=c.redMul(f.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,h,p)},aK.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),f=s.redSqr().redIAdd(u).redISub(l).redISub(l),d=s.redMul(l.redISub(f)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(f,d,h)},aK.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 r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},aK.prototype.inspect=function(){return this.isInfinity()?"":""},aK.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var sK=Gq((function(e,t){var r=t;r.base=Qq,r.short=iK,r.mont=null,r.edwards=null})),cK=Gq((function(e,t){var r,n=t,i=Wq.assert;function o(e){"short"===e.type?this.curve=new sK.short(e):"edwards"===e.type?this.curve=new sK.edwards(e):this.curve=new sK.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(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new o(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.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:ny.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:ny.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:ny.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:ny.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:ny.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:ny.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:ny.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(e){r=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:ny.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function uK(e){if(!(this instanceof uK))return new uK(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=Vq.toArray(e.entropy,e.entropyEnc||"hex"),r=Vq.toArray(e.nonce,e.nonceEnc||"hex"),n=Vq.toArray(e.pers,e.persEnc||"hex");qq(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var lK=uK;uK.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},uK.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=Vq.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var pK=Wq.assert;function mK(e,t){if(e instanceof mK)return e;this._importDER(e,t)||(pK(e.r&&e.s,"Signature without r or s"),this.r=new pH(e.r,16),this.s=new pH(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var bK=mK;function gK(){this.place=0}function yK(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function vK(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}mK.prototype._importDER=function(e,t){e=Wq.toArray(e,t);var r=new gK;if(48!==e[r.place++])return!1;var n=yK(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=yK(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var a=yK(e,r);if(!1===a)return!1;if(e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.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 pH(o),this.s=new pH(s),this.recoveryParam=null,!0},mK.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=vK(t),r=vK(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];wK(n,t.length),(n=n.concat(t)).push(2),wK(n,r.length);var i=n.concat(r),o=[48];return wK(o,i.length),o=o.concat(i),Wq.encode(o,e)};var EK=function(){throw new Error("unsupported")},AK=Wq.assert;function xK(e){if(!(this instanceof xK))return new xK(e);"string"==typeof e&&(AK(Object.prototype.hasOwnProperty.call(cK,e),"Unknown curve "+e),e=cK[e]),e instanceof cK.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 _K=xK;xK.prototype.keyPair=function(e){return new hK(this,e)},xK.prototype.keyFromPrivate=function(e,t){return hK.fromPrivate(this,e,t)},xK.prototype.keyFromPublic=function(e,t){return hK.fromPublic(this,e,t)},xK.prototype.genKeyPair=function(e){e||(e={});for(var t=new lK({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||EK(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new pH(2));;){var i=new pH(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},xK.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},xK.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new pH(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new lK({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new pH(1)),u=0;;u++){var l=n.k?n.k(u):new pH(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var f=this.g.mul(l);if(!f.isInfinity()){var d=f.getX(),h=d.umod(this.n);if(0!==h.cmpn(0)){var p=l.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==d.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new bK({r:h,s:p,recoveryParam:m})}}}}}},xK.prototype.verify=function(e,t,r,n){e=this._truncateToN(new pH(e,16)),r=this.keyFromPublic(r,n);var i=(t=new bK(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),c=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},xK.prototype.recoverPubKey=function(e,t,r,n){AK((3&r)===r,"The recovery param is more than two bits"),t=new bK(t,n);var i=this.n,o=new pH(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(i),f=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(f,a,d)},xK.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new bK(t,n)).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(r))return i}throw new Error("Unable to find valid recovery factor")};var kK=Gq((function(e,t){var r=t;r.version="6.5.4",r.utils=Wq,r.rand=function(){throw new Error("unsupported")},r.curve=sK,r.curves=cK,r.ec=_K,r.eddsa=null})),SK=kK.ec;const PK=new P$("signing-key/5.7.0");let IK=null;function TK(){return IK||(IK=new SK("secp256k1")),IK}class OK{constructor(e){O$(this,"curve","secp256k1"),O$(this,"privateKey",iH(e)),32!==oH(this.privateKey)&&PK.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=TK().keyFromPrivate(X$(this.privateKey));O$(this,"publicKey","0x"+t.getPublic(!1,"hex")),O$(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),O$(this,"_isSigningKey",!0)}_addPoint(e){const t=TK().keyFromPublic(X$(this.publicKey)),r=TK().keyFromPublic(X$(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=TK().keyFromPrivate(X$(this.privateKey)),r=X$(e);32!==r.length&&PK.throwArgumentError("bad digest length","digest",e);const n=t.sign(r,{canonical:!0});return fH({recoveryParam:n.recoveryParam,r:lH("0x"+n.r.toString(16),32),s:lH("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const t=TK().keyFromPrivate(X$(this.privateKey)),r=TK().keyFromPublic(X$(CK(e)));return lH("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function MK(e,t){const r=fH(t),n={r:X$(r.r),s:X$(r.s)};return"0x"+TK().recoverPubKey(X$(e),n,r.recoveryParam).encode("hex",!1)}function CK(e,t){const r=X$(e);if(32===r.length){const e=new OK(r);return t?"0x"+TK().keyFromPrivate(r).getPublic(!0,"hex"):e.publicKey}return 33===r.length?t?iH(r):"0x"+TK().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+TK().keyFromPublic(r).getPublic(!0,"hex"):iH(r):PK.throwArgumentError("invalid public or private key","key","[REDACTED]")}const BK=new P$("transactions/5.7.0");var NK;function RK(e){return"0x"===e?null:rG(e)}function FK(e){return"0x"===e?lG:EH.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(NK||(NK={}));const LK=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],UK={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function jK(e){return rG(aH(zH(aH(CK(e),1)),12))}function DK(e,t){return jK(MK(X$(e),t))}function zK(e,t){const r=eH(EH.from(e).toHexString());return r.length>32&&BK.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function $K(e,t){return{address:rG(e),storageKeys:(t||[]).map(((t,r)=>(32!==oH(t)&&BK.throwArgumentError("invalid access list storageKey",`accessList[${e}:${r}]`,t),t.toLowerCase())))}}function HK(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&BK.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),$K(e[0],e[1])):$K(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const r=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return $K(t,Object.keys(r).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function GK(e){return HK(e).map((e=>[e.address,e.storageKeys]))}function qK(e,t){if(null!=e.gasPrice){const t=EH.from(e.gasPrice),r=EH.from(e.maxFeePerGas||0);t.eq(r)||BK.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:r})}const r=[zK(e.chainId||0,"chainId"),zK(e.nonce||0,"nonce"),zK(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),zK(e.maxFeePerGas||0,"maxFeePerGas"),zK(e.gasLimit||0,"gasLimit"),null!=e.to?rG(e.to):"0x",zK(e.value||0,"value"),e.data||"0x",GK(e.accessList||[])];if(t){const e=fH(t);r.push(zK(e.recoveryParam,"recoveryParam")),r.push(eH(e.r)),r.push(eH(e.s))}return sH(["0x02",KH(r)])}function KK(e,t){const r=[zK(e.chainId||0,"chainId"),zK(e.nonce||0,"nonce"),zK(e.gasPrice||0,"gasPrice"),zK(e.gasLimit||0,"gasLimit"),null!=e.to?rG(e.to):"0x",zK(e.value||0,"value"),e.data||"0x",GK(e.accessList||[])];if(t){const e=fH(t);r.push(zK(e.recoveryParam,"recoveryParam")),r.push(eH(e.r)),r.push(eH(e.s))}return sH(["0x01",KH(r)])}function VK(e,t){if(null==e.type||0===e.type)return null!=e.accessList&&BK.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){B$(e,UK);const r=[];LK.forEach((function(t){let n=e[t.name]||[];const i={};t.numeric&&(i.hexPad="left"),n=X$(iH(n,i)),t.length&&n.length!==t.length&&n.length>0&&BK.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n),t.maxLength&&(n=eH(n),n.length>t.maxLength&&BK.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n)),r.push(iH(n))}));let n=0;if(null!=e.chainId?(n=e.chainId,"number"!=typeof n&&BK.throwArgumentError("invalid transaction.chainId","transaction",e)):t&&!J$(t)&&t.v>28&&(n=Math.floor((t.v-35)/2)),0!==n&&(r.push(iH(n)),r.push("0x"),r.push("0x")),!t)return KH(r);const i=fH(t);let o=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),o+=2*n+8,i.v>28&&i.v!==o&&BK.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==o&&BK.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),r.push(iH(o)),r.push(eH(X$(i.r))),r.push(eH(X$(i.s))),KH(r)}(e,t);switch(e.type){case 1:return KK(e,t);case 2:return qK(e,t)}return BK.throwError(`unsupported transaction type: ${e.type}`,P$.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function WK(e,t,r){try{const r=FK(t[0]).toNumber();if(0!==r&&1!==r)throw new Error("bad recid");e.v=r}catch(e){BK.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=lH(t[1],32),e.s=lH(t[2],32);try{const t=zH(r(e));e.from=DK(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function JK(e){const t=X$(e);if(t[0]>127)return function(e){const t=JH(e);9!==t.length&&6!==t.length&&BK.throwArgumentError("invalid raw transaction","rawTransaction",e);const r={nonce:FK(t[0]).toNumber(),gasPrice:FK(t[1]),gasLimit:FK(t[2]),to:RK(t[3]),value:FK(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=EH.from(t[6]).toNumber()}catch(e){return r}if(r.r=lH(t[7],32),r.s=lH(t[8],32),EH.from(r.r).isZero()&&EH.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=t.slice(0,6);0!==r.chainId&&(i.push(iH(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);const o=zH(KH(i));try{r.from=DK(o,{r:iH(r.r),s:iH(r.s),recoveryParam:n})}catch(e){}r.hash=zH(e)}return r.type=null,r}(t);switch(t[0]){case 1:return function(e){const t=JH(e.slice(1));8!==t.length&&11!==t.length&&BK.throwArgumentError("invalid component count for transaction type: 1","payload",iH(e));const r={type:1,chainId:FK(t[0]).toNumber(),nonce:FK(t[1]).toNumber(),gasPrice:FK(t[2]),gasLimit:FK(t[3]),to:RK(t[4]),value:FK(t[5]),data:t[6],accessList:HK(t[7])};return 8===t.length||(r.hash=zH(e),WK(r,t.slice(8),KK)),r}(t);case 2:return function(e){const t=JH(e.slice(1));9!==t.length&&12!==t.length&&BK.throwArgumentError("invalid component count for transaction type: 2","payload",iH(e));const r=FK(t[2]),n=FK(t[3]),i={type:2,chainId:FK(t[0]).toNumber(),nonce:FK(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:FK(t[4]),to:RK(t[5]),value:FK(t[6]),data:t[7],accessList:HK(t[8])};return 9===t.length||(i.hash=zH(e),WK(i,t.slice(9),qK)),i}(t)}return BK.throwError(`unsupported transaction type: ${t[0]}`,P$.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}const ZK=new P$("wordlists/5.7.0");class YK{constructor(e){ZK.checkAbstract(new.target,YK),O$(this,"locale",e)}split(e){return e.toLowerCase().split(/ +/g)}join(e){return e.join(" ")}static check(e){const t=[];for(let r=0;r<2048;r++){const n=e.getWord(r);if(r!==e.getWordIndex(n))return"0x";t.push(n)}return DG(t.join("\n")+"\n")}static register(e,t){t||(t=e.locale)}}let XK=null;function QK(e){if(null==XK&&(XK="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==YK.check(e)))throw XK=null,new Error("BIP39 Wordlist for en (English) FAILED")}const eV=new class extends YK{constructor(){super("en")}getWord(e){return QK(this),XK[e]}getWordIndex(e){return QK(this),XK.indexOf(e)}};YK.register(eV);const tV={en:eV},rV=new P$("hdnode/5.7.0"),nV=EH.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),iV=kG("Bitcoin seed"),oV=2147483648;function aV(e){return(1<=256)throw new Error("Depth too large!");return cV(Q$([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",iH(this.depth),this.parentFingerprint,lH(iH(this.index),4),this.chainCode,null!=this.privateKey?Q$(["0x00",this.privateKey]):this.publicKey]))}neuter(){return new dV(lV,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}_derive(e){if(e>4294967295)throw new Error("invalid index - "+String(e));let t=this.path;t&&(t+="/"+(2147483647&e));const r=new Uint8Array(37);if(e&oV){if(!this.privateKey)throw new Error("cannot derive child of neutered node");r.set(X$(this.privateKey),1),t&&(t+="'")}else r.set(X$(this.publicKey));for(let t=24;t>=0;t-=8)r[33+(t>>3)]=e>>24-t&255;const n=X$($q(Uq.sha512,this.chainCode,r)),i=n.slice(0,32),o=n.slice(32);let a=null,s=null;if(this.privateKey)a=sV(EH.from(i).add(this.privateKey).mod(nV));else{s=new OK(iH(i))._addPoint(this.publicKey)}let c=t;const u=this.mnemonic;return u&&(c=Object.freeze({phrase:u.phrase,path:t,locale:u.locale||"en"})),new dV(lV,a,s,this.fingerprint,sV(o),e,this.depth+1,c)}derivePath(e){const t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();let r=this;for(let e=0;e=oV)throw new Error("invalid path index - "+n);r=r._derive(oV+e)}else{if(!n.match(/^[0-9]+$/))throw new Error("invalid path component - "+n);{const e=parseInt(n);if(e>=oV)throw new Error("invalid path index - "+n);r=r._derive(e)}}}return r}static _fromSeed(e,t){const r=X$(e);if(r.length<16||r.length>64)throw new Error("invalid seed");const n=X$($q(Uq.sha512,iV,r));return new dV(lV,sV(n.slice(0,32)),null,"0x00000000",sV(n.slice(32)),0,0,t)}static fromMnemonic(e,t,r){return e=mV(pV(e,r=uV(r)),r),dV._fromSeed(hV(e,t),{phrase:e,path:"m",locale:r.locale})}static fromSeed(e){return dV._fromSeed(e,null)}static fromExtendedKey(e){const t=Lq.decode(e);82===t.length&&cV(t.slice(0,78))===e||rV.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");const r=t[4],n=iH(t.slice(5,9)),i=parseInt(iH(t.slice(9,13)).substring(2),16),o=iH(t.slice(13,45)),a=t.slice(45,78);switch(iH(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new dV(lV,null,iH(a),n,o,i,r,null);case"0x0488ade4":case"0x04358394 ":if(0!==a[0])break;return new dV(lV,iH(a.slice(1)),null,n,o,i,r,null)}return rV.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}function hV(e,t){t||(t="");const r=kG("mnemonic"+t,wG.NFKD);return Hq(kG(e,wG.NFKD),r,2048,64,"sha512")}function pV(e,t){t=uV(t),rV.checkNormalize();const r=t.split(e);if(r.length%3!=0)throw new Error("invalid mnemonic");const n=X$(new Uint8Array(Math.ceil(11*r.length/8)));let i=0;for(let e=0;e>3]|=1<<7-i%8),i++}const o=32*r.length/3,a=aV(r.length/3);if((X$(zq(n.slice(0,o/8)))[0]&a)!==(n[n.length-1]&a))throw new Error("invalid checksum");return iH(n.slice(0,o/8))}function mV(e,t){if(t=uV(t),(e=X$(e)).length%4!=0||e.length<16||e.length>32)throw new Error("invalid entropy");const r=[0];let n=11;for(let t=0;t8?(r[r.length-1]<<=8,r[r.length-1]|=e[t],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[t]>>8-n,r.push(e[t]&(1<<8-n)-1),n+=3);const i=e.length/4,o=X$(zq(e))[0]&aV(i);return r[r.length-1]<<=i,r[r.length-1]|=o>>8-i,t.join(r.map((e=>t.getWord(e))))}const bV=new P$("random/5.7.0");const gV=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==u)return u;throw new Error("unable to locate global object")}();let yV=gV.crypto||gV.msCrypto;function vV(e){(e<=0||e>1024||e%1||e!=e)&&bV.throwArgumentError("invalid length","length",e);const t=new Uint8Array(e);return yV.getRandomValues(t),X$(t)}function wV(e){for(let t=(e=e.slice()).length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}yV&&yV.getRandomValues||(bV.warn("WARNING: Missing strong random number source"),yV={getRandomValues:function(e){return bV.throwError("no secure random source avaialble",P$.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}});var EV={exports:{}};!function(e,t){!function(t){function r(e){return parseInt(e)===e}function n(e){if(!r(e.length))return!1;for(var t=0;t255)return!1;return!0}function i(e,t){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!n(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(r(e.length)&&n(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function o(e){return new Uint8Array(e)}function a(e,t,r,n,i){null==n&&null==i||(e=e.slice?e.slice(n,i):Array.prototype.slice.call(e,n,i)),t.set(e,r)}var s,c={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},u=(s="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+s[15&n])}return t.join("")}}),l={16:10,24:12,32:14},f=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],d=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],p=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],m=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],b=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],g=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],v=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],w=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],E=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],A=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],x=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],_=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],k=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function S(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=o[t],this._Kd[e-r][t%4]=o[t];for(var a,s=0,c=i;c>16&255]<<24^d[a>>8&255]<<16^d[255&a]<<8^d[a>>24&255]^f[s]<<24,s+=1,8!=i)for(t=1;t>8&255]<<8^d[a>>16&255]<<16^d[a>>24&255]<<24;for(t=i/2+1;t>2,h=c%4,this._Ke[u][h]=o[t],this._Kd[e-u][h]=o[t++],c++}for(var u=1;u>24&255]^x[a>>16&255]^_[a>>8&255]^k[255&a]},P.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],n=S(e),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var a=1;a>24&255]^m[n[(i+1)%4]>>16&255]^b[n[(i+2)%4]>>8&255]^g[255&n[(i+3)%4]]^this._Ke[a][i];n=r.slice()}var s,c=o(16);for(i=0;i<4;i++)s=this._Ke[t][i],c[4*i]=255&(d[n[i]>>24&255]^s>>24),c[4*i+1]=255&(d[n[(i+1)%4]>>16&255]^s>>16),c[4*i+2]=255&(d[n[(i+2)%4]>>8&255]^s>>8),c[4*i+3]=255&(d[255&n[(i+3)%4]]^s);return c},P.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],n=S(e),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var a=1;a>24&255]^v[n[(i+3)%4]>>16&255]^w[n[(i+2)%4]>>8&255]^E[255&n[(i+1)%4]]^this._Kd[a][i];n=r.slice()}var s,c=o(16);for(i=0;i<4;i++)s=this._Kd[t][i],c[4*i]=255&(h[n[i]>>24&255]^s>>24),c[4*i+1]=255&(h[n[(i+3)%4]>>16&255]^s>>16),c[4*i+2]=255&(h[n[(i+2)%4]>>8&255]^s>>8),c[4*i+3]=255&(h[255&n[(i+1)%4]]^s);return c};var I=function(e){if(!(this instanceof I))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new P(e)};I.prototype.encrypt=function(e){if((e=i(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=o(e.length),r=o(16),n=0;n=0;--t)this._counter[t]=e%256,e>>=8},C.prototype.setBytes=function(e){if(16!=(e=i(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},C.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var B=function(e,t){if(!(this instanceof B))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof C||(t=new C(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new P(e)};B.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;n=64;){let h,p,m,b,g,y=r,v=n,w=i,E=o,A=a,x=s,_=c,k=u;for(p=0;p<16;p++)m=f+4*p,l[p]=(255&e[m])<<24|(255&e[m+1])<<16|(255&e[m+2])<<8|255&e[m+3];for(p=16;p<64;p++)h=l[p-2],b=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,h=l[p-15],g=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,l[p]=(b+l[p-7]|0)+(g+l[p-16]|0)|0;for(p=0;p<64;p++)b=(((A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7))+(A&x^~A&_)|0)+(k+(t[p]+l[p]|0)|0)|0,g=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&v^y&w^v&w)|0,k=_,_=x,x=A,A=E+b|0,E=w,w=v,v=y,y=b+g|0;r=r+y|0,n=n+v|0,i=i+w|0,o=o+E|0,a=a+A|0,s=s+x|0,c=c+_|0,u=u+k|0,f+=64,d-=64}}f(e);let d,h=e.length%64,p=e.length/536870912|0,m=e.length<<3,b=h<56?56:120,g=e.slice(e.length-h,e.length);for(g.push(128),d=h+1;d>>24&255),g.push(p>>>16&255),g.push(p>>>8&255),g.push(p>>>0&255),g.push(m>>>24&255),g.push(m>>>16&255),g.push(m>>>8&255),g.push(m>>>0&255),f(g),[r>>>24&255,r>>>16&255,r>>>8&255,r>>>0&255,n>>>24&255,n>>>16&255,n>>>8&255,n>>>0&255,i>>>24&255,i>>>16&255,i>>>8&255,i>>>0&255,o>>>24&255,o>>>16&255,o>>>8&255,o>>>0&255,a>>>24&255,a>>>16&255,a>>>8&255,a>>>0&255,s>>>24&255,s>>>16&255,s>>>8&255,s>>>0&255,c>>>24&255,c>>>16&255,c>>>8&255,c>>>0&255,u>>>24&255,u>>>16&255,u>>>8&255,u>>>0&255]}function i(e,t,r){e=e.length<=64?e:n(e);const i=64+t.length+4,o=new Array(i),a=new Array(64);let s,c=[];for(s=0;s<64;s++)o[s]=54;for(s=0;s=i-4;e--){if(o[e]++,o[e]<=255)return;o[e]=0}}for(;r>=32;)u(),c=c.concat(n(a.concat(n(o)))),r-=32;return r>0&&(u(),c=c.concat(n(a.concat(n(o))).slice(0,r))),c}function o(e,t,r,n,i){let o;for(u(e,16*(2*r-1),i,0,16),o=0;o<2*r;o++)c(e,16*o,i,16),s(i,n),u(i,0,e,t+16*o,16);for(o=0;o>>32-t}function s(e,t){u(e,0,t,0,16);for(let e=8;e>0;e-=2)t[4]^=a(t[0]+t[12],7),t[8]^=a(t[4]+t[0],9),t[12]^=a(t[8]+t[4],13),t[0]^=a(t[12]+t[8],18),t[9]^=a(t[5]+t[1],7),t[13]^=a(t[9]+t[5],9),t[1]^=a(t[13]+t[9],13),t[5]^=a(t[1]+t[13],18),t[14]^=a(t[10]+t[6],7),t[2]^=a(t[14]+t[10],9),t[6]^=a(t[2]+t[14],13),t[10]^=a(t[6]+t[2],18),t[3]^=a(t[15]+t[11],7),t[7]^=a(t[3]+t[15],9),t[11]^=a(t[7]+t[3],13),t[15]^=a(t[11]+t[7],18),t[1]^=a(t[0]+t[3],7),t[2]^=a(t[1]+t[0],9),t[3]^=a(t[2]+t[1],13),t[0]^=a(t[3]+t[2],18),t[6]^=a(t[5]+t[4],7),t[7]^=a(t[6]+t[5],9),t[4]^=a(t[7]+t[6],13),t[5]^=a(t[4]+t[7],18),t[11]^=a(t[10]+t[9],7),t[8]^=a(t[11]+t[10],9),t[9]^=a(t[8]+t[11],13),t[10]^=a(t[9]+t[8],18),t[12]^=a(t[15]+t[14],7),t[13]^=a(t[12]+t[15],9),t[14]^=a(t[13]+t[12],13),t[15]^=a(t[14]+t[13],18);for(let r=0;r<16;++r)e[r]+=t[r]}function c(e,t,r,n){for(let i=0;i=256)return!1}return!0}function f(e,t){if("number"!=typeof e||e%1)throw new Error("invalid "+t);return e}function d(e,t,n,a,s,d,h){if(n=f(n,"N"),a=f(a,"r"),s=f(s,"p"),d=f(d,"dkLen"),0===n||n&n-1)throw new Error("N must be power of 2");if(n>r/128/a)throw new Error("N too large");if(a>r/128/s)throw new Error("r too large");if(!l(e))throw new Error("password must be an array or buffer");if(e=Array.prototype.slice.call(e),!l(t))throw new Error("salt must be an array or buffer");t=Array.prototype.slice.call(t);let p=i(e,t,128*s*a);const m=new Uint32Array(32*s*a);for(let e=0;eT&&(t=T);for(let e=0;eT&&(t=T);for(let e=0;e>8&255),p.push(m[e]>>16&255),p.push(m[e]>>24&255);const r=i(e,p,d);return h&&h(null,1,r),r}h&&O(M)};if(!h)for(;;){const e=M();if(null!=e)return e}M()}const h={scrypt:function(e,t,r,n,i,o,a){return new Promise((function(s,c){let u=0;a&&a(0),d(e,t,r,n,i,o,(function(e,t,r){if(e)c(e);else if(r)a&&1!==u&&a(1),s(new Uint8Array(r));else if(a&&t!==u)return u=t,a(t)}))}))},syncScrypt:function(e,t,r,n,i,o){return new Uint8Array(d(e,t,r,n,i,o))}};e.exports=h}()}(NV);var RV=a(NV.exports),FV=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const LV=new P$(xV);function UV(e){return null!=e&&e.mnemonic&&e.mnemonic.phrase}class jV extends j${isKeystoreAccount(e){return!(!e||!e._isKeystoreAccount)}}function DV(e,t){const r=_V(PV(e,"crypto/ciphertext"));if(iH(zH(Q$([t.slice(16,32),r]))).substring(2)!==PV(e,"crypto/mac").toLowerCase())throw new Error("invalid password");const n=function(e,t,r){if("aes-128-ctr"===PV(e,"crypto/cipher")){const n=_V(PV(e,"crypto/cipherparams/iv")),i=new AV.Counter(n);return X$(new AV.ModeOfOperation.ctr(t,i).decrypt(r))}return null}(e,t.slice(0,16),r);n||LV.throwError("unsupported cipher",P$.errors.UNSUPPORTED_OPERATION,{operation:"decrypt"});const i=t.slice(32,64),o=jK(n);if(e.address){let t=e.address.toLowerCase();if("0x"!==t.substring(0,2)&&(t="0x"+t),rG(t)!==o)throw new Error("address mismatch")}const a={_isKeystoreAccount:!0,address:o,privateKey:iH(n)};if("0.1"===PV(e,"x-ethers/version")){const t=_V(PV(e,"x-ethers/mnemonicCiphertext")),r=_V(PV(e,"x-ethers/mnemonicCounter")),n=new AV.Counter(r),o=new AV.ModeOfOperation.ctr(i,n),s=PV(e,"x-ethers/path")||fV,c=PV(e,"x-ethers/locale")||"en",u=X$(o.decrypt(t));try{const e=mV(u,c),t=dV.fromMnemonic(e,null,c).derivePath(s);if(t.privateKey!=a.privateKey)throw new Error("mnemonic mismatch");a.mnemonic=t.mnemonic}catch(e){if(e.code!==P$.errors.INVALID_ARGUMENT||"wordlist"!==e.argument)throw e}}return new jV(a)}function zV(e,t,r,n,i){return X$(Hq(e,t,r,n,i))}function $V(e,t,r,n,i){return Promise.resolve(zV(e,t,r,n,i))}function HV(e,t,r,n,i){const o=SV(t),a=PV(e,"crypto/kdf");if(a&&"string"==typeof a){const t=function(e,t){return LV.throwArgumentError("invalid key-derivation function parameters",e,t)};if("scrypt"===a.toLowerCase()){const r=_V(PV(e,"crypto/kdfparams/salt")),s=parseInt(PV(e,"crypto/kdfparams/n")),c=parseInt(PV(e,"crypto/kdfparams/r")),u=parseInt(PV(e,"crypto/kdfparams/p"));s&&c&&u||t("kdf",a),s&s-1&&t("N",s);const l=parseInt(PV(e,"crypto/kdfparams/dklen"));return 32!==l&&t("dklen",l),n(o,r,s,c,u,64,i)}if("pbkdf2"===a.toLowerCase()){const n=_V(PV(e,"crypto/kdfparams/salt"));let i=null;const a=PV(e,"crypto/kdfparams/prf");"hmac-sha256"===a?i="sha256":"hmac-sha512"===a?i="sha512":t("prf",a);const s=parseInt(PV(e,"crypto/kdfparams/c")),c=parseInt(PV(e,"crypto/kdfparams/dklen"));return 32!==c&&t("dklen",c),r(o,n,s,c,i)}}return LV.throwArgumentError("unsupported key-derivation function","kdf",a)}function GV(e,t,r){if(CV(e)){r&&r(0);const n=MV(e,t);return r&&r(1),Promise.resolve(n)}return BV(e)?function(e,t,r){return FV(this,void 0,void 0,(function*(){const n=JSON.parse(e);return DV(n,yield HV(n,t,$V,RV.scrypt,r))}))}(e,t,r):Promise.reject(new Error("invalid JSON wallet"))}function qV(e,t){if(CV(e))return MV(e,t);if(BV(e))return function(e,t){const r=JSON.parse(e);return DV(r,HV(r,t,zV,RV.syncScrypt))}(e,t);throw new Error("invalid JSON wallet")}var KV=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const VV=new P$("wallet/5.7.0");class WV extends G${constructor(e,t){if(super(),function(e){return null!=e&&rH(e.privateKey,32)&&null!=e.address}(e)){const t=new OK(e.privateKey);if(O$(this,"_signingKey",(()=>t)),O$(this,"address",jK(this.publicKey)),this.address!==rG(e.address)&&VV.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(e){const t=e.mnemonic;return t&&t.phrase}(e)){const t=e.mnemonic;O$(this,"_mnemonic",(()=>({phrase:t.phrase,path:t.path||fV,locale:t.locale||"en"})));const r=this.mnemonic;jK(dV.fromMnemonic(r.phrase,null,r.locale).derivePath(r.path).privateKey)!==this.address&&VV.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else O$(this,"_mnemonic",(()=>null))}else{if(OK.isSigningKey(e))"secp256k1"!==e.curve&&VV.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),O$(this,"_signingKey",(()=>e));else{"string"==typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e);const t=new OK(e);O$(this,"_signingKey",(()=>t))}O$(this,"_mnemonic",(()=>null)),O$(this,"address",jK(this.publicKey))}t&&!sG.isProvider(t)&&VV.throwArgumentError("invalid provider","provider",t),O$(this,"provider",t||null)}get mnemonic(){return this._mnemonic()}get privateKey(){return this._signingKey().privateKey}get publicKey(){return this._signingKey().publicKey}getAddress(){return Promise.resolve(this.address)}connect(e){return new WV(this,e)}signTransaction(e){return C$(e).then((t=>{null!=t.from&&(rG(t.from)!==this.address&&VV.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete t.from);const r=this._signingKey().signDigest(zH(VK(t)));return VK(t,r)}))}signMessage(e){return KV(this,void 0,void 0,(function*(){return dH(this._signingKey().signDigest(vq(e)))}))}_signTypedData(e,t,r){return KV(this,void 0,void 0,(function*(){const n=yield Rq.resolveNames(e,t,r,(e=>(null==this.provider&&VV.throwError("cannot resolve ENS names without a provider",P$.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:e}),this.provider.resolveName(e))));return dH(this._signingKey().signDigest(Rq.hash(n.domain,t,n.value)))}))}encrypt(e,t,r){if("function"!=typeof t||r||(r=t,t={}),r&&"function"!=typeof r)throw new Error("invalid callback");return t||(t={}),function(e,t,r,n){try{if(rG(e.address)!==jK(e.privateKey))throw new Error("address/privateKey mismatch");if(UV(e)){const t=e.mnemonic;if(dV.fromMnemonic(t.phrase,null,t.locale).derivePath(t.path||fV).privateKey!=e.privateKey)throw new Error("mnemonic mismatch")}}catch(e){return Promise.reject(e)}"function"!=typeof r||n||(n=r,r={}),r||(r={});const i=X$(e.privateKey),o=SV(t);let a=null,s=null,c=null;if(UV(e)){const t=e.mnemonic;a=X$(pV(t.phrase,t.locale||"en")),s=t.path||fV,c=t.locale||"en"}let u=r.client;u||(u="ethers.js");let l=null;l=r.salt?X$(r.salt):vV(32);let f=null;if(r.iv){if(f=X$(r.iv),16!==f.length)throw new Error("invalid iv")}else f=vV(16);let d=null;if(r.uuid){if(d=X$(r.uuid),16!==d.length)throw new Error("invalid uuid")}else d=vV(16);let h=1<<17,p=8,m=1;return r.scrypt&&(r.scrypt.N&&(h=r.scrypt.N),r.scrypt.r&&(p=r.scrypt.r),r.scrypt.p&&(m=r.scrypt.p)),RV.scrypt(o,l,h,p,m,64,n).then((t=>{const r=(t=X$(t)).slice(0,16),n=t.slice(16,32),o=t.slice(32,64),b=new AV.Counter(f),g=X$(new AV.ModeOfOperation.ctr(r,b).encrypt(i)),y=zH(Q$([n,g])),v={address:e.address.substring(2).toLowerCase(),id:IV(d),version:3,crypto:{cipher:"aes-128-ctr",cipherparams:{iv:iH(f).substring(2)},ciphertext:iH(g).substring(2),kdf:"scrypt",kdfparams:{salt:iH(l).substring(2),n:h,dklen:32,p:m,r:p},mac:y.substring(2)}};if(a){const e=vV(16),t=new AV.Counter(e),r=X$(new AV.ModeOfOperation.ctr(o,t).encrypt(a)),n=new Date,i=n.getUTCFullYear()+"-"+kV(n.getUTCMonth()+1,2)+"-"+kV(n.getUTCDate(),2)+"T"+kV(n.getUTCHours(),2)+"-"+kV(n.getUTCMinutes(),2)+"-"+kV(n.getUTCSeconds(),2)+".0Z";v["x-ethers"]={client:u,gethFilename:"UTC--"+i+"--"+v.address,mnemonicCounter:iH(e).substring(2),mnemonicCiphertext:iH(r).substring(2),path:s,locale:c,version:"0.1"}}return JSON.stringify(v)}))}(this,e,t,r)}static createRandom(e){let t=vV(16);e||(e={}),e.extraEntropy&&(t=X$(aH(zH(Q$([t,e.extraEntropy])),0,16)));const r=mV(t,e.locale);return WV.fromMnemonic(r,e.path,e.locale)}static fromEncryptedJson(e,t,r){return GV(e,t,r).then((e=>new WV(e)))}static fromEncryptedJsonSync(e,t){return new WV(qV(e,t))}static fromMnemonic(e,t,r){return t||(t=fV),new WV(dV.fromMnemonic(e,null,r).derivePath(t))}}const JV=e=>{const t=rO(e.data),r=function(e,t){if(e.length!==t.length)throw new mT({expectedLength:e.length,givenLength:t.length});const r=[];for(let n=0;n"0x"+e.map((e=>JV(e))).join("");const YV=e=>{let t=e;if(!oT(t)&&(t=`0x${t}`,!oT(t)))throw new Error("Invalid signed data "+e);let{r:r,s:n,v:i}=function(e){const{r:t,s:r}=bF.Signature.fromCompact(e.slice(2,130)),n=BigInt(`0x${e.slice(130)}`);return{r:XT(t,{size:32}),s:XT(r,{size:32}),v:n}}(t);0n!==i&&1n!==i||(i+=27n);const o=function({r:e,s:t,v:r}){return`0x${new bF.Signature(GT(e),GT(t)).toCompactHex()}${JT(r).slice(2)}`}({r:r,s:n,v:i});return o},XV=e=>{for(const t of Object.values(Yj).concat(Object.values(g$)))if(t.id===e)return t;throw new Error("could not find chain")};class QV extends uD{constructor(e){super(e),Object.defineProperty(this,"owner",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.owner=e.owner}static async init(e){const t=await u$(e.projectId);if(!t)throw new Error("ChainId not found");const r=XV(t);return new QV({...e,chain:r})}async signer(){return await Promise.resolve(this.owner)}async getOwner(){return this.owner.getAddress()}async getEnableData(){return this.getOwner()}encodeEnable(e){return cM({abi:OE,functionName:"enable",args:[e]})}encodeDisable(e="0x"){return cM({abi:OE,functionName:"disable",args:[e]})}async getDummyUserOpSignature(){return"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"}async isPluginEnabled(e,t){if(!this.publicClient)throw new Error("Validator uninitialized: PublicClient missing");const r=await this.publicClient.readContract({abi:ME,address:e,functionName:"getExecution",args:[t]}),n=await this.publicClient.readContract({abi:OE,address:this.validatorAddress,functionName:"ecdsaValidatorStorage",args:[e]});return r.validator.toLowerCase()===this.validatorAddress.toLowerCase()&&n.toLowerCase()===(await this.getEnableData()).toLowerCase()}async signMessage(e){return await this.owner.signMessage(e)}async signTypedData(e){return YV(await this.owner.signTypedData(e))}async signUserOp(e){if(!this.chain)throw new Error("Validator uninitialized");const t=pI({...e,signature:"0x"},this.entryPointAddress,BigInt(this.chain.id)),r="string"==typeof t?rO(t):t;return await this.owner.signMessage(r)}}QO("doRecovery(address, bytes)");var eW={},tW={exports:{}};function rW(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var nW,iW={exports:{}};function oW(){return nW||(nW=1,function(e,t){var r;e.exports=(r=r||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==o&&o.crypto&&(r=o.crypto),!r)try{r=Em}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},s=a.lib={},c=s.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=s.WordArray=c.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:4*e.length},toString:function(e){return(e||f).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(var s=0;s>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},d=l.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},h=l.Utf8={stringify:function(e){try{return decodeURIComponent(escape(d.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return d.parse(unescape(encodeURIComponent(e)))}},p=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,s=o/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,l=e.min(4*c,o);if(c){for(var f=0;f>>7)^(p<<14|p>>>18)^p>>>3,b=u[h-2],g=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;u[h]=m+u[h-7]+g+u[h-16]}var y=n&i^n&o^i&o,v=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=d+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&f)+c[h]+u[h];d=f,f=l,l=s,s=a+w|0,a=o,o=i,i=n,n=w+(v+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+d|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),r.SHA256)}(tW);var aW=tW.exports,sW={exports:{}};!function(e,t){e.exports=function(){function e(e,t){var r=t?"└":"├";return r+=e?"─ ":"──┐"}function t(e,t){var r=[];for(var n in e)e.hasOwnProperty(n)&&(t&&"function"==typeof e[n]||r.push(n));return r}function r(n,i,o,a,s,c,u){var l,f,d="",h=0,p=a.slice(0);if(p.push([i,o])&&a.length>0&&(a.forEach((function(e,t){t>0&&(d+=(e[1]?" ":"│")+" "),f||e[0]!==i||(f=!0)})),d+=e(n,o)+n,s&&("object"!=typeof i||i instanceof Date)&&(d+=": "+i),f&&(d+=" (circular ref.)"),u(d)),!f&&"object"==typeof i){var m=t(i,c);m.forEach((function(e){l=++h===m.length,r(e,i[e],l,p,s,c,u)}))}}var n={asLines:function(e,t,n,i){r(".",e,!1,[],t,"function"!=typeof n&&n,i||n)},asTree:function(e,t,n){var i="";return r(".",e,!1,[],t,n,(function(e){i+=e+"\n"})),i}};return n}()}(sW);var cW,uW=sW.exports,lW={},fW={exports:{}},dW={exports:{}};function hW(){return cW||(cW=1,function(e,t){var r;e.exports=(r=oW(),function(e){var t=r,n=t.lib,i=n.Base,o=n.WordArray,a=t.x64={};a.Word=i.extend({init:function(e,t){this.high=e,this.low=t}}),a.WordArray=i.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:8*t.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)};n.prototype=e}}(),r.lib.WordArray)}(mW)),mW.exports}var gW,yW={exports:{}};function vW(){return gW||(gW=1,function(e,t){var r;e.exports=(r=oW(),function(){var e=r,t=e.lib.WordArray,n=e.enc;function i(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var r=e.length,n=[],i=0;i>>1]|=e.charCodeAt(i)<<16-i%2*16;return t.create(n,2*r)}},n.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o>>2]>>>16-o%4*8&65535);n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var r=e.length,n=[],o=0;o>>1]|=i(e.charCodeAt(o)<<16-o%2*16);return t.create(n,2*r)}}}(),r.enc.Utf16)}(yW)),yW.exports}var wW,EW={exports:{}};function AW(){return wW||(wW=1,function(e,t){var r;e.exports=(r=oW(),function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var i=[],o=0,a=0;a>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,n=e.sigBytes,i=t?this._safe_map:this._map;e.clamp();for(var o=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,c=0;c<4&&a+.75*c>>6*(3-c)&63));var u=i.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,i=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],h=e[t+2],p=e[t+3],m=e[t+4],b=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],w=e[t+9],E=e[t+10],A=e[t+11],x=e[t+12],_=e[t+13],k=e[t+14],S=e[t+15],P=o[0],I=o[1],T=o[2],O=o[3];P=u(P,I,T,O,a,7,s[0]),O=u(O,P,I,T,c,12,s[1]),T=u(T,O,P,I,h,17,s[2]),I=u(I,T,O,P,p,22,s[3]),P=u(P,I,T,O,m,7,s[4]),O=u(O,P,I,T,b,12,s[5]),T=u(T,O,P,I,g,17,s[6]),I=u(I,T,O,P,y,22,s[7]),P=u(P,I,T,O,v,7,s[8]),O=u(O,P,I,T,w,12,s[9]),T=u(T,O,P,I,E,17,s[10]),I=u(I,T,O,P,A,22,s[11]),P=u(P,I,T,O,x,7,s[12]),O=u(O,P,I,T,_,12,s[13]),T=u(T,O,P,I,k,17,s[14]),P=l(P,I=u(I,T,O,P,S,22,s[15]),T,O,c,5,s[16]),O=l(O,P,I,T,g,9,s[17]),T=l(T,O,P,I,A,14,s[18]),I=l(I,T,O,P,a,20,s[19]),P=l(P,I,T,O,b,5,s[20]),O=l(O,P,I,T,E,9,s[21]),T=l(T,O,P,I,S,14,s[22]),I=l(I,T,O,P,m,20,s[23]),P=l(P,I,T,O,w,5,s[24]),O=l(O,P,I,T,k,9,s[25]),T=l(T,O,P,I,p,14,s[26]),I=l(I,T,O,P,v,20,s[27]),P=l(P,I,T,O,_,5,s[28]),O=l(O,P,I,T,h,9,s[29]),T=l(T,O,P,I,y,14,s[30]),P=f(P,I=l(I,T,O,P,x,20,s[31]),T,O,b,4,s[32]),O=f(O,P,I,T,v,11,s[33]),T=f(T,O,P,I,A,16,s[34]),I=f(I,T,O,P,k,23,s[35]),P=f(P,I,T,O,c,4,s[36]),O=f(O,P,I,T,m,11,s[37]),T=f(T,O,P,I,y,16,s[38]),I=f(I,T,O,P,E,23,s[39]),P=f(P,I,T,O,_,4,s[40]),O=f(O,P,I,T,a,11,s[41]),T=f(T,O,P,I,p,16,s[42]),I=f(I,T,O,P,g,23,s[43]),P=f(P,I,T,O,w,4,s[44]),O=f(O,P,I,T,x,11,s[45]),T=f(T,O,P,I,S,16,s[46]),P=d(P,I=f(I,T,O,P,h,23,s[47]),T,O,a,6,s[48]),O=d(O,P,I,T,y,10,s[49]),T=d(T,O,P,I,k,15,s[50]),I=d(I,T,O,P,b,21,s[51]),P=d(P,I,T,O,x,6,s[52]),O=d(O,P,I,T,p,10,s[53]),T=d(T,O,P,I,E,15,s[54]),I=d(I,T,O,P,c,21,s[55]),P=d(P,I,T,O,v,6,s[56]),O=d(O,P,I,T,S,10,s[57]),T=d(T,O,P,I,g,15,s[58]),I=d(I,T,O,P,_,21,s[59]),P=d(P,I,T,O,m,6,s[60]),O=d(O,P,I,T,A,10,s[61]),T=d(T,O,P,I,h,15,s[62]),I=d(I,T,O,P,w,21,s[63]),o[0]=o[0]+P|0,o[1]=o[1]+I|0,o[2]=o[2]+T|0,o[3]=o[3]+O|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),a=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,o,a){var s=e+(t&r|~t&n)+i+a;return(s<>>32-o)+t}function l(e,t,r,n,i,o,a){var s=e+(t&n|r&~n)+i+a;return(s<>>32-o)+t}function f(e,t,r,n,i,o,a){var s=e+(t^r^n)+i+a;return(s<>>32-o)+t}function d(e,t,r,n,i,o,a){var s=e+(r^(t|~n))+i+a;return(s<>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),r.MD5)}(PW)),PW.exports}var TW,OW={exports:{}};function MW(){return TW||(TW=1,function(e,t){var r;e.exports=(r=oW(),function(){var e=r,t=e.lib,n=t.WordArray,i=t.Hasher,o=e.algo,a=[],s=o.SHA1=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],s=r[3],c=r[4],u=0;u<80;u++){if(u<16)a[u]=0|e[t+u];else{var l=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=l<<1|l>>>31}var f=(n<<5|n>>>27)+c+a[u];f+=u<20?1518500249+(i&o|~i&s):u<40?1859775393+(i^o^s):u<60?(i&o|i&s|o&s)-1894007588:(i^o^s)-899497514,c=s,s=o,o=i<<30|i>>>2,i=n,n=f}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=i._createHelper(s),e.HmacSHA1=i._createHmacHelper(s)}(),r.SHA1)}(OW)),OW.exports}var CW,BW={exports:{}};var NW,RW={exports:{}};function FW(){return NW||(NW=1,function(e,t){var r;e.exports=(r=oW(),hW(),function(){var e=r,t=e.lib.Hasher,n=e.x64,i=n.Word,o=n.WordArray,a=e.algo;function s(){return i.create.apply(i,arguments)}var c=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=s()}();var l=a.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],l=r[5],f=r[6],d=r[7],h=n.high,p=n.low,m=i.high,b=i.low,g=o.high,y=o.low,v=a.high,w=a.low,E=s.high,A=s.low,x=l.high,_=l.low,k=f.high,S=f.low,P=d.high,I=d.low,T=h,O=p,M=m,C=b,B=g,N=y,R=v,F=w,L=E,U=A,j=x,D=_,z=k,$=S,H=P,G=I,q=0;q<80;q++){var K,V,W=u[q];if(q<16)V=W.high=0|e[t+2*q],K=W.low=0|e[t+2*q+1];else{var J=u[q-15],Z=J.high,Y=J.low,X=(Z>>>1|Y<<31)^(Z>>>8|Y<<24)^Z>>>7,Q=(Y>>>1|Z<<31)^(Y>>>8|Z<<24)^(Y>>>7|Z<<25),ee=u[q-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=u[q-7],ae=oe.high,se=oe.low,ce=u[q-16],ue=ce.high,le=ce.low;V=(V=(V=X+ae+((K=Q+se)>>>0>>0?1:0))+ne+((K+=ie)>>>0>>0?1:0))+ue+((K+=le)>>>0>>0?1:0),W.high=V,W.low=K}var fe,de=L&j^~L&z,he=U&D^~U&$,pe=T&M^T&B^M&B,me=O&C^O&N^C&N,be=(T>>>28|O<<4)^(T<<30|O>>>2)^(T<<25|O>>>7),ge=(O>>>28|T<<4)^(O<<30|T>>>2)^(O<<25|T>>>7),ye=(L>>>14|U<<18)^(L>>>18|U<<14)^(L<<23|U>>>9),ve=(U>>>14|L<<18)^(U>>>18|L<<14)^(U<<23|L>>>9),we=c[q],Ee=we.high,Ae=we.low,xe=H+ye+((fe=G+ve)>>>0>>0?1:0),_e=ge+me;H=z,G=$,z=j,$=D,j=L,D=U,L=R+(xe=(xe=(xe=xe+de+((fe+=he)>>>0>>0?1:0))+Ee+((fe+=Ae)>>>0>>0?1:0))+V+((fe+=K)>>>0>>0?1:0))+((U=F+fe|0)>>>0>>0?1:0)|0,R=B,F=N,B=M,N=C,M=T,C=O,T=xe+(be+pe+(_e>>>0>>0?1:0))+((O=fe+_e|0)>>>0>>0?1:0)|0}p=n.low=p+O,n.high=h+T+(p>>>0>>0?1:0),b=i.low=b+C,i.high=m+M+(b>>>0>>0?1:0),y=o.low=y+N,o.high=g+B+(y>>>0>>0?1:0),w=a.low=w+F,a.high=v+R+(w>>>0>>0?1:0),A=s.low=A+U,s.high=E+L+(A>>>0>>0?1:0),_=l.low=_+D,l.high=x+j+(_>>>0>>0?1:0),S=f.low=S+$,f.high=k+z+(S>>>0<$>>>0?1:0),I=d.low=I+G,d.high=P+H+(I>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(l),e.HmacSHA512=t._createHmacHelper(l)}(),r.SHA512)}(RW)),RW.exports}var LW,UW={exports:{}};var jW,DW={exports:{}};function zW(){return jW||(jW=1,function(e,t){var r;e.exports=(r=oW(),hW(),function(e){var t=r,n=t.lib,i=n.WordArray,o=n.Hasher,a=t.x64.Word,s=t.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,r=0;r<24;r++){c[e+5*t]=(r+1)*(r+2)/2%64;var n=(2*e+3*t)%5;e=t%5,t=n}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var i=1,o=0;o<24;o++){for(var s=0,f=0,d=0;d<7;d++){if(1&i){var h=(1<>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(I=r[i]).high^=a,I.low^=o}for(var s=0;s<24;s++){for(var d=0;d<5;d++){for(var h=0,p=0,m=0;m<5;m++)h^=(I=r[d+5*m]).high,p^=I.low;var b=f[d];b.high=h,b.low=p}for(d=0;d<5;d++){var g=f[(d+4)%5],y=f[(d+1)%5],v=y.high,w=y.low;for(h=g.high^(v<<1|w>>>31),p=g.low^(w<<1|v>>>31),m=0;m<5;m++)(I=r[d+5*m]).high^=h,I.low^=p}for(var E=1;E<25;E++){var A=(I=r[E]).high,x=I.low,_=c[E];_<32?(h=A<<_|x>>>32-_,p=x<<_|A>>>32-_):(h=x<<_-32|A>>>64-_,p=A<<_-32|x>>>64-_);var k=f[u[E]];k.high=h,k.low=p}var S=f[0],P=r[0];for(S.high=P.high,S.low=P.low,d=0;d<5;d++)for(m=0;m<5;m++){var I=r[E=d+5*m],T=f[E],O=f[(d+1)%5+5*m],M=f[(d+2)%5+5*m];I.high=T.high^~O.high&M.high,I.low=T.low^~O.low&M.low}I=r[0];var C=l[s];I.high^=C.high,I.low^=C.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var n=8*t.sigBytes,o=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(e.ceil((n+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,c=s/8,u=[],l=0;l>>24)|4278255360&(d<<24|d>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),u.push(h),u.push(d)}return new i.init(u,s)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=o._createHelper(d),t.HmacSHA3=o._createHmacHelper(d)}(Math),r.SHA3)}(DW)),DW.exports}var $W,HW={exports:{}};var GW,qW={exports:{}};function KW(){return GW||(GW=1,function(e,t){var r;e.exports=(r=oW(),void function(){var e=r,t=e.lib.Base,n=e.enc.Utf8;e.algo.HMAC=t.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),s=o.words,c=a.words,u=0;u>>2];e.sigBytes-=t}};n.BlockCipher=l.extend({cfg:l.cfg.extend({mode:h,padding:p}),reset:function(){var e;l.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),b=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(t):t).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=o.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=n.SerializableCipher=i.extend({cfg:i.extend({format:b}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),a=i.cfg;return m.create({ciphertext:o,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,n,i){if(n||(n=o.random(8)),i)a=u.create({keySize:t+r,hasher:i}).compute(e,n);else var a=u.create({keySize:t+r}).compute(e,n);var s=o.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:s,salt:n})}},v=n.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=i.iv;var o=g.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=i.iv,g.decrypt.call(this,e,t,i.key,n)}})}()))}(QW)),QW.exports}var tJ,rJ={exports:{}};function nJ(){return tJ||(tJ=1,function(e,t){var r;e.exports=(r=oW(),eJ(),r.mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,n){var i,o=this._iv;o?(i=o.slice(0),this._iv=void 0):i=this._prevBlock,n.encryptBlock(i,0);for(var a=0;a>24))e+=1<<24;else{var t=e>>16&255,r=e>>8&255,n=255&e;255===t?(t=0,255===r?(r=0,255===n?n=0:++n):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=n}return e}function n(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var i=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,i=r.blockSize,o=this._iv,a=this._counter;o&&(a=this._counter=o.slice(0),this._iv=void 0),n(a);var s=a.slice(0);r.encryptBlock(s,0);for(var c=0;c>>5]>>>31-n%32&1}for(var i=this._subKeys=[],o=0;o<16;o++){var u=i[o]=[],l=c[o];for(r=0;r<24;r++)u[r/6|0]|=t[(s[r]-1+l)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(s[r+24]-1+l)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var f=this._invSubKeys=[];for(r=0;r<16;r++)f[r]=i[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],d.call(this,4,252645135),d.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),d.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],o=this._lBlock,a=this._rBlock,s=0,c=0;c<8;c++)s|=u[c][((a^i[c])&l[c])>>>0];this._lBlock=a,this._rBlock=o^s}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,d.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function d(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),i=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=f.createEncryptor(n.create(t)),this._des2=f.createEncryptor(n.create(r)),this._des3=f.createEncryptor(n.create(i))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=i._createHelper(p)}(),r.TripleDES)}(OJ)),OJ.exports}var CJ,BJ={exports:{}};var NJ,RJ={exports:{}};var FJ,LJ={exports:{}};var UJ,jJ={exports:{}};function DJ(){return UJ||(UJ=1,function(e,t){var r;e.exports=(r=oW(),AW(),IW(),YW(),eJ(),function(){var e=r,t=e.lib.BlockCipher,n=e.algo;const i=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var s={pbox:[],sbox:[]};function c(e,t){let r=t>>24&255,n=t>>16&255,i=t>>8&255,o=255&t,a=e.sbox[0][r]+e.sbox[1][n];return a^=e.sbox[2][i],a+=e.sbox[3][o],a}function u(e,t,r){let n,o=t,a=r;for(let t=0;t1;--t)o^=e.pbox[t],a=c(e,o)^a,n=o,o=a,a=n;return n=o,o=a,a=n,a^=e.pbox[1],o^=e.pbox[0],{left:o,right:a}}function f(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let n=0;for(let a=0;a=r&&(n=0);let s=0,c=0,l=0;for(let t=0;t>>24)|4278255360&(i<<24|i>>>8)}var o,a,h,w,E,A,x,_,k,S,P,I=this._hash.words,T=f.words,O=d.words,M=s.words,C=c.words,B=u.words,N=l.words;for(A=o=I[0],x=a=I[1],_=h=I[2],k=w=I[3],S=E=I[4],r=0;r<80;r+=1)P=o+e[t+M[r]]|0,P+=r<16?p(a,h,w)+T[0]:r<32?m(a,h,w)+T[1]:r<48?b(a,h,w)+T[2]:r<64?g(a,h,w)+T[3]:y(a,h,w)+T[4],P=(P=v(P|=0,B[r]))+E|0,o=E,E=w,w=v(h,10),h=a,a=P,P=A+e[t+C[r]]|0,P+=r<16?y(x,_,k)+O[0]:r<32?g(x,_,k)+O[1]:r<48?b(x,_,k)+O[2]:r<64?m(x,_,k)+O[3]:p(x,_,k)+O[4],P=(P=v(P|=0,N[r]))+S|0,A=S,S=k,k=v(_,10),_=x,x=P;P=I[1]+h+k|0,I[1]=I[2]+w+S|0,I[2]=I[3]+E+A|0,I[3]=I[4]+o+x|0,I[4]=I[0]+a+_|0,I[0]=P},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var i=this._hash,o=i.words,a=0;a<5;a++){var s=o[a];o[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return i},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function b(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=o._createHelper(h),t.HmacRIPEMD160=o._createHmacHelper(h)}(),r.RIPEMD160)}(HW)),KW(),VW||(VW=1,function(e,t){var r;e.exports=(r=oW(),KW(),function(){var e=r,t=e.lib,n=t.Base,i=t.WordArray,o=e.algo,a=o.SHA256,s=o.HMAC,c=o.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:a,iterations:25e4}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r=this.cfg,n=s.create(r.hasher,e),o=i.create(),a=i.create([1]),c=o.words,u=a.words,l=r.keySize,f=r.iterations;c.length>>2]|=i<<24-o%4*8,e.sigBytes+=i},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)}(bJ)),gJ||(gJ=1,function(e,t){var r;e.exports=(r=oW(),eJ(),r.pad.Iso10126={pad:function(e,t){var n=4*t,i=n-e.sigBytes%n;e.concat(r.lib.WordArray.random(i-1)).concat(r.lib.WordArray.create([i<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)}(yJ)),vJ||(vJ=1,function(e,t){var r;e.exports=(r=oW(),eJ(),r.pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)}(wJ)),EJ||(EJ=1,function(e,t){var r;e.exports=(r=oW(),eJ(),r.pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)}(AJ)),xJ||(xJ=1,function(e,t){var r;e.exports=(r=oW(),eJ(),r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)}(_J)),kJ||(kJ=1,function(e,t){var r,n,i,o;e.exports=(o=oW(),eJ(),n=(r=o).lib.CipherParams,i=r.enc.Hex,r.format.Hex={stringify:function(e){return e.ciphertext.toString(i)},parse:function(e){var t=i.parse(e);return n.create({ciphertext:t})}},o.format.Hex)}(SJ)),PJ||(PJ=1,function(e,t){var r;e.exports=(r=oW(),AW(),IW(),YW(),eJ(),function(){var e=r,t=e.lib.BlockCipher,n=e.algo,i=[],o=[],a=[],s=[],c=[],u=[],l=[],f=[],d=[],h=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,n=0;for(t=0;t<256;t++){var p=n^n<<1^n<<2^n<<3^n<<4;p=p>>>8^255&p^99,i[r]=p,o[p]=r;var m=e[r],b=e[m],g=e[b],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,s[r]=y<<16|y>>>16,c[r]=y<<8|y>>>24,u[r]=y,y=16843009*g^65537*b^257*m^16843008*r,l[p]=y<<24|y>>>8,f[p]=y<<16|y>>>16,d[p]=y<<8|y>>>24,h[p]=y,r?(r=m^e[e[e[g^m]]],n^=e[e[n]]):r=n=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],a=0;a6&&a%r==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=p[a/r|0]<<24),o[a]=o[a-r]^u);for(var s=this._invKeySchedule=[],c=0;c>>24]]^f[i[u>>>16&255]]^d[i[u>>>8&255]]^h[i[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,l,f,d,h,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,a,s){for(var c=this._nRounds,u=e[t]^r[0],l=e[t+1]^r[1],f=e[t+2]^r[2],d=e[t+3]^r[3],h=4,p=1;p>>24]^i[l>>>16&255]^o[f>>>8&255]^a[255&d]^r[h++],b=n[l>>>24]^i[f>>>16&255]^o[d>>>8&255]^a[255&u]^r[h++],g=n[f>>>24]^i[d>>>16&255]^o[u>>>8&255]^a[255&l]^r[h++],y=n[d>>>24]^i[u>>>16&255]^o[l>>>8&255]^a[255&f]^r[h++];u=m,l=b,f=g,d=y}m=(s[u>>>24]<<24|s[l>>>16&255]<<16|s[f>>>8&255]<<8|s[255&d])^r[h++],b=(s[l>>>24]<<24|s[f>>>16&255]<<16|s[d>>>8&255]<<8|s[255&u])^r[h++],g=(s[f>>>24]<<24|s[d>>>16&255]<<16|s[u>>>8&255]<<8|s[255&l])^r[h++],y=(s[d>>>24]<<24|s[u>>>16&255]<<16|s[l>>>8&255]<<8|s[255&f])^r[h++],e[t]=m,e[t+1]=b,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)}(IJ)),MJ(),CJ||(CJ=1,function(e,t){var r;e.exports=(r=oW(),AW(),IW(),YW(),eJ(),function(){var e=r,t=e.lib.StreamCipher,n=e.algo,i=n.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,n=this._S=[],i=0;i<256;i++)n[i]=i;i=0;for(var o=0;i<256;i++){var a=i%r,s=t[a>>>2]>>>24-a%4*8&255;o=(o+n[i]+s)%256;var c=n[i];n[i]=n[o],n[o]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,n|=e[(e[t]+e[r])%256]<<24-8*i}return this._i=t,this._j=r,n}e.RC4=t._createHelper(i);var a=n.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)}(BJ)),NJ||(NJ=1,function(e,t){var r;e.exports=(r=oW(),AW(),IW(),YW(),eJ(),function(){var e=r,t=e.lib.StreamCipher,n=e.algo,i=[],o=[],a=[],s=n.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,a=o[0],s=o[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=u>>>16|4294901760&l,d=l<<16|65535&u;for(i[0]^=u,i[1]^=f,i[2]^=l,i[3]^=d,i[4]^=u,i[5]^=f,i[6]^=l,i[7]^=d,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,s=n>>>16,c=((i*i>>>17)+i*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(s)}(),r.Rabbit)}(RJ)),FJ||(FJ=1,function(e,t){var r;e.exports=(r=oW(),AW(),IW(),YW(),eJ(),function(){var e=r,t=e.lib.StreamCipher,n=e.algo,i=[],o=[],a=[],s=n.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var i=0;i<4;i++)c.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(t){var o=t.words,a=o[0],s=o[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=u>>>16|4294901760&l,d=l<<16|65535&u;for(n[0]^=u,n[1]^=f,n[2]^=l,n[3]^=d,n[4]^=u,n[5]^=f,n[6]^=l,n[7]^=d,i=0;i<4;i++)c.call(this)}},_doProcessBlock:function(e,t){var r=this._X;c.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),e[t+n]^=i[n]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var n=e[r]+t[r],i=65535&n,s=n>>>16,c=((i*i>>>17)+i*s>>>15)+s*s,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^u}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(s)}(),r.RabbitLegacy)}(LJ)),DJ(),r)}(fW);var zJ=fW.exports,$J=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(lW,"__esModule",{value:!0}),lW.Base=void 0;const HJ=fe,GJ=$J(zJ);class qJ{print(){qJ.print(this)}bufferIndexOf(e,t,r=!1){if(r)return this.binarySearch(e,t,HJ.Buffer.compare);return this.linearSearch(e,t,((e,t)=>e.equals(t)))}static binarySearch(e,t,r){let n=0,i=e.length-1;for(;n<=i;){const o=Math.floor((n+i)/2),a=r(e[o],t);if(0===a){for(let n=o-1;n>=0;n--)if(0!==r(e[n],t))return n+1;return 0}a<0?n=o+1:i=o-1}return-1}binarySearch(e,t,r){return qJ.binarySearch(e,t,r)}static linearSearch(e,t,r){for(let n=0;n{const r=e(t);return HJ.Buffer.isBuffer(r)?r:this.isHexString(r)?HJ.Buffer.from(r.replace("0x",""),"hex"):"string"==typeof r?HJ.Buffer.from(r):"bigint"==typeof r?HJ.Buffer.from(t.toString(16),"hex"):ArrayBuffer.isView(r)?HJ.Buffer.from(r.buffer,r.byteOffset,r.byteLength):HJ.Buffer.from(e(GJ.default.enc.Hex.parse(t.toString("hex"))).toString(GJ.default.enc.Hex),"hex")}}isHexString(e){return qJ.isHexString(e)}log2(e){return 1===e?0:1+this.log2(e/2|0)}zip(e,t){return e.map(((e,r)=>[e,t[r]]))}static hexZeroPad(e,t){return"0x"+e.replace("0x","").padStart(t,"0")}}lW.Base=qJ,lW.default=qJ;var KJ=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(eW,"__esModule",{value:!0}),eW.MerkleTree=void 0;const VJ=fe,WJ=KJ((function(e){for(var t=new _(e.length),r=0,n=e.length-1;r<=n;++r,--n)t[r]=e[n],t[n]=e[r];return t})),JJ=KJ(aW),ZJ=KJ(uW),YJ=KJ(lW);class XJ extends YJ.default{constructor(e,t=JJ.default,r={}){if(super(),this.duplicateOdd=!1,this.concatenator=VJ.Buffer.concat,this.hashLeaves=!1,this.isBitcoinTree=!1,this.leaves=[],this.layers=[],this.sortLeaves=!1,this.sortPairs=!1,this.sort=!1,this.fillDefaultHash=null,this.complete=!1,r.complete){if(r.isBitcoinTree)throw new Error('option "complete" is incompatible with "isBitcoinTree"');if(r.duplicateOdd)throw new Error('option "complete" is incompatible with "duplicateOdd"')}if(this.isBitcoinTree=!!r.isBitcoinTree,this.hashLeaves=!!r.hashLeaves,this.sortLeaves=!!r.sortLeaves,this.sortPairs=!!r.sortPairs,this.complete=!!r.complete,r.fillDefaultHash)if("function"==typeof r.fillDefaultHash)this.fillDefaultHash=r.fillDefaultHash;else{if(!VJ.Buffer.isBuffer(r.fillDefaultHash)&&"string"!=typeof r.fillDefaultHash)throw new Error('method "fillDefaultHash" must be a function, Buffer, or string');this.fillDefaultHash=(e,t)=>r.fillDefaultHash}this.sort=!!r.sort,this.sort&&(this.sortLeaves=!0,this.sortPairs=!0),this.duplicateOdd=!!r.duplicateOdd,r.concatenator&&(this.concatenator=r.concatenator),this.hashFn=this.bufferifyFn(t),this.processLeaves(e)}getOptions(){var e,t;return{complete:this.complete,isBitcoinTree:this.isBitcoinTree,hashLeaves:this.hashLeaves,sortLeaves:this.sortLeaves,sortPairs:this.sortPairs,sort:this.sort,fillDefaultHash:null!==(t=null===(e=this.fillDefaultHash)||void 0===e?void 0:e.toString())&&void 0!==t?t:null,duplicateOdd:this.duplicateOdd}}processLeaves(e){if(this.hashLeaves&&(e=e.map(this.hashFn)),this.leaves=e.map(this.bufferify),this.sortLeaves&&(this.leaves=this.leaves.sort(VJ.Buffer.compare)),this.fillDefaultHash)for(let e=this.leaves.length;e1;){const t=this.layers.length;this.layers.push([]);const r=this.complete&&1===t&&!Number.isInteger(Math.log2(e.length))?2*e.length-Math.pow(2,Math.ceil(Math.log2(e.length))):e.length;for(let n=0;n=r){this.layers[t].push(...e.slice(r));break}if(n+1===e.length&&e.length%2==1){const r=e[e.length-1];let i=r;if(this.isBitcoinTree){i=this.hashFn(this.concatenator([WJ.default(r),WJ.default(r)])),i=WJ.default(this.hashFn(i)),this.layers[t].push(i);continue}if(!this.duplicateOdd){this.layers[t].push(e[n]);continue}}const i=e[n],o=n+1===e.length?i:e[n+1];let a=null;a=this.isBitcoinTree?[WJ.default(i),WJ.default(o)]:[i,o],this.sortPairs&&a.sort(VJ.Buffer.compare);let s=this.hashFn(this.concatenator(a));this.isBitcoinTree&&(s=WJ.default(this.hashFn(s))),this.layers[t].push(s)}e=this.layers[t]}}addLeaf(e,t=!1){t&&(e=this.hashFn(e)),this.processLeaves(this.leaves.concat(e))}addLeaves(e,t=!1){t&&(e=e.map(this.hashFn)),this.processLeaves(this.leaves.concat(e))}getLeaves(e){return Array.isArray(e)?(this.hashLeaves&&(e=e.map(this.hashFn),this.sortLeaves&&(e=e.sort(VJ.Buffer.compare))),this.leaves.filter((t=>-1!==this.bufferIndexOf(e,t,this.sortLeaves)))):this.leaves}getLeaf(e){return e<0||e>this.leaves.length-1?VJ.Buffer.from([]):this.leaves[e]}getLeafIndex(e){e=this.bufferify(e);const t=this.getLeaves();for(let r=0;rthis.bufferToHex(e)))}static marshalLeaves(e){return JSON.stringify(e.map((e=>XJ.bufferToHex(e))),null,2)}static unmarshalLeaves(e){let t=null;if("string"==typeof e)t=JSON.parse(e);else{if(!(e instanceof Object))throw new Error("Expected type of string or object");t=e}if(!t)return[];if(!Array.isArray(t))throw new Error("Expected JSON string to be array");return t.map(XJ.bufferify)}getLayers(){return this.layers}getHexLayers(){return this.layers.reduce(((e,t)=>(Array.isArray(t)?e.push(t.map((e=>this.bufferToHex(e)))):e.push(t),e)),[])}getLayersFlat(){const e=this.layers.reduce(((e,t)=>(Array.isArray(t)?e.unshift(...t):e.unshift(t),e)),[]);return e.unshift(VJ.Buffer.from([0])),e}getHexLayersFlat(){return this.getLayersFlat().map((e=>this.bufferToHex(e)))}getLayerCount(){return this.getLayers().length}getRoot(){return 0===this.layers.length?VJ.Buffer.from([]):this.layers[this.layers.length-1][0]||VJ.Buffer.from([])}getHexRoot(){return this.bufferToHex(this.getRoot())}getProof(e,t){if(void 0===e)throw new Error("leaf is required");e=this.bufferify(e);const r=[];if(!Number.isInteger(t)){t=-1;for(let r=0;rthis.bufferToHex(e.data)))}getProofs(){const e=[];return this.getProofsDFS(this.layers.length-1,0,[],e),e}getProofsDFS(e,t,r,n){const i=t%2;if(-1===e)return void(i||n.push([...r].reverse()));if(t>=this.layers[e].length)return;const o=this.layers[e],a=i?t-1:t+1;let s=!1;athis.bufferToHex(e.data)))}getPositionalHexProof(e,t){return this.getProof(e,t).map((e=>["left"===e.position?0:1,this.bufferToHex(e.data)]))}static marshalProof(e){const t=e.map((e=>"string"==typeof e?e:VJ.Buffer.isBuffer(e)?XJ.bufferToHex(e):{position:e.position,data:XJ.bufferToHex(e.data)}));return JSON.stringify(t,null,2)}static unmarshalProof(e){let t=null;if("string"==typeof e)t=JSON.parse(e);else{if(!(e instanceof Object))throw new Error("Expected type of string or object");t=e}if(!t)return[];if(!Array.isArray(t))throw new Error("Expected JSON string to be array");return t.map((e=>{if("string"==typeof e)return XJ.bufferify(e);if(e instanceof Object)return{position:e.position,data:XJ.bufferify(e.data)};throw new Error("Expected item to be of type string or object")}))}static marshalTree(e){const t=e.getHexRoot(),r=e.leaves.map((e=>XJ.bufferToHex(e))),n=e.getHexLayers(),i=e.getOptions();return JSON.stringify({options:i,root:t,layers:n,leaves:r},null,2)}static unmarshalTree(e,t=JJ.default,r={}){let n=null;if("string"==typeof e)n=JSON.parse(e);else{if(!(e instanceof Object))throw new Error("Expected type of string or object");n=e}if(!n)throw new Error("could not parse json");return r=Object.assign({},n.options||{},r),new XJ(n.leaves,t,r)}getProofIndices(e,t){const r=Math.pow(2,t);let n=new Set;for(const t of e){let e=r+t;for(;e>1;)n.add(1^e),e=e/2|0}const i=e.map((e=>r+e)),o=Array.from(n).sort(((e,t)=>e-t)).reverse();n=i.concat(o);const a=new Set,s=[];for(let e of n)if(!a.has(e))for(s.push(e);e>1&&(a.add(e),a.has(1^e));)e=e/2|0;return s.filter((t=>!e.includes(t-r)))}getProofIndicesForUnevenTree(e,t){const r=Math.ceil(Math.log2(t)),n=[];for(let e=0;ee%2==0?e+1:e-1));let r=t.filter((e=>!o.includes(e)));const a=n.find((({index:t})=>t===e));a&&o.includes(a.leavesCount-1)&&(r=r.slice(0,-1)),i.push(r),o=[...new Set(o.map((e=>e%2==0?e/2:e%2==0?(e+1)/2:(e-1)/2)))]}return i}getMultiProof(e,t){this.complete||console.warn("Warning: For correct multiProofs it's strongly recommended to set complete: true"),t||(t=e,e=this.getLayersFlat());if(this.isUnevenTree()&&t.every(Number.isInteger))return this.getMultiProofForUnevenTree(t);if(!t.every(Number.isInteger)){let e=t;this.sortPairs&&(e=e.sort(VJ.Buffer.compare));let r=e.map((e=>this.bufferIndexOf(this.leaves,e,this.sortLeaves))).sort(((e,t)=>e===t?0:e>t?1:-1));if(!r.every((e=>-1!==e)))throw new Error("Element does not exist in Merkle tree");const n=[],i=[];let o=[];for(let e=0;er.indexOf(e)===t)),o=[]}return i.filter((e=>!n.includes(e)))}return this.getProofIndices(t,Math.log2(e.length/2|0)).map((t=>e[t]))}getMultiProofForUnevenTree(e,t){t||(t=e,e=this.getLayers());let r=[],n=t;for(const t of e){const e=[];for(const r of n){if(r%2==0){const i=r+1;if(!n.includes(i)&&t[i]){e.push(t[i]);continue}}const i=r-1;n.includes(i)||!t[i]||e.push(t[i])}r=r.concat(e);const i=new Set;for(const e of n)e%2!=0?e%2!=0?i.add((e-1)/2):i.add((e+1)/2):i.add(e/2);n=Array.from(i)}return r}getHexMultiProof(e,t){return this.getMultiProof(e,t).map((e=>this.bufferToHex(e)))}getProofFlags(e,t){if(!Array.isArray(e)||e.length<=0)throw new Error("Invalid Inputs!");let r;if(r=e.every(Number.isInteger)?[...e].sort(((e,t)=>e===t?0:e>t?1:-1)):e.map((e=>this.bufferIndexOf(this.leaves,e,this.sortLeaves))).sort(((e,t)=>e===t?0:e>t?1:-1)),!r.every((e=>-1!==e)))throw new Error("Element does not exist in Merkle tree");const n=t.map((e=>this.bufferify(e))),i=[],o=[];for(let e=0;e{if(!i.includes(t[r])){const e=this.getPairNode(t,r),a=n.includes(t[r])||n.includes(e);e&&o.push(!a),i.push(t[r]),i.push(e)}return e.push(r/2|0),e}),[])}return o}verify(e,t,r){let n=this.bufferify(t);if(r=this.bufferify(r),!Array.isArray(e)||!t||!r)return!1;for(let t=0;tthis.bufferify(e))),i=i.map((e=>this.bufferify(e)));const a={};for(const[e,n]of this.zip(t,r))a[Math.pow(2,o)+e]=n;for(const[e,r]of this.zip(this.getProofIndices(t,o),i))a[e]=r;let s=Object.keys(a).map((e=>+e)).sort(((e,t)=>e-t));s=s.slice(0,s.length-1);let c=0;for(;c=2&&{}.hasOwnProperty.call(a,1^e)){let t=[a[e-e%2],a[e-e%2+1]];this.sortPairs&&(t=t.sort(VJ.Buffer.compare));const r=t[1]?this.hashFn(this.concatenator(t)):t[0];a[e/2|0]=r,s.push(e/2|0)}c+=1}return!t.length||{}.hasOwnProperty.call(a,1)&&a[1].equals(e)}verifyMultiProofWithFlags(e,t,r,n){e=this.bufferify(e),t=t.map(this.bufferify),r=r.map(this.bufferify);const i=t.length,o=n.length,a=[];let s=0,c=0,u=0;for(let e=0;ethis.bufferify(e))),i=i.map((e=>this.bufferify(e)));const o=this.calculateRootForUnevenTree(t,r,n,i);return e.equals(o)}getDepth(){return this.getLayers().length-1}getLayersAsObject(){const e=this.getLayers().map((e=>e.map((e=>this.bufferToHex(e,!1))))),t=[];for(let r=0;re-t)),o=i.map((([e])=>e)),a=this.getProofIndicesForUnevenTree(o,r);let s=0;const c=[];for(let e=0;ee-t)).map((([,e])=>e)),r=u[e].map((([e])=>e)),n=[...new Set(r.map((e=>e%2==0?e/2:e%2==0?(e+1)/2:(e-1)/2)))],i=[];for(let e=0;e0&&!(e&1<=t));o--);if(n!==r.length)throw new Error("invalid bit calculation");return r}numOfPeaks(e){let t=e,r=0;for(;t>0;)t%2==1&&r++,t>>=1;return r}peakBagging(e,t){const r=this.getSize(e);if(this.numOfPeaks(e)!==t.length)throw new Error("received invalid number of peaks");return 0!==e||t.length?this.peakBaggingFn?this.bufferify(this.peakBaggingFn(r,t)):this.hashFn(tZ.Buffer.concat([this.bufferify(r),...t.map(this.bufferify)])):tZ.Buffer.alloc(0)}getSize(e){return(e<<1)-this.numOfPeaks(e)}getRoot(){return this.root}getHexRoot(){return this.bufferToHex(this.getRoot())}getNode(e){return this.hashes[e]}mountainHeight(e){let t=1;for(;1<r;)t-=(1<this.size)throw new Error("out of range");if(!this.isLeaf(e))throw new Error("not a leaf");const t=this.root,r=this.width,n=this.getPeakIndexes(this.width),i=[];let o=0;for(let t=0;t=e&&0===o&&(o=n[t]);let a=0,s=0,c=this.heightAt(o);const u=[];for(;o!==e;)c--,[a,s]=this.getChildren(o),o=e<=a?a:s,u[c-1]=this.hashes[e<=a?s:a];return{root:t,width:r,peakBagging:i,siblings:u}}verify(e,t,r,n,i,o){n=this.bufferify(n);if(this.getSize(t)=r){a=i[e],s=c[e];break}if(!a)throw new Error("target not found");let u=o.length+1;const l=new Array(u);let f,d=0,h=0;for(;u>0&&(l[--u]=s,s!==r);)[d,h]=this.getChildren(s),s=r>d?h:d;for(;uthis.size)throw new Error("out of range");if(!this.hashes[e]){const[t,r]=this.getChildren(e),n=this._getOrCreateNode(t),i=this._getOrCreateNode(r);this.hashes[e]=this.hashBranch(e,n,i)}return this.hashes[e]}}QJ.MerkleMountainRange=iZ,"undefined"!=typeof window&&(window.MerkleMountainRange=iZ),QJ.default=iZ;var oZ={},aZ=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(oZ,"__esModule",{value:!0}),oZ.IncrementalMerkleTree=void 0;const sZ=aZ(lW),cZ=aZ(uW);class uZ extends sZ.default{constructor(e,t){if(super(),this.hashFn=e,t.depth&&(this.depth=t.depth),t.arity&&(this.arity=t.arity),this.depth<1)throw new Error("depth must be greater than 0");if(this.arity<1)throw new Error("arity must be greater than 0");const r=[];let n=t.zeroValue;if(this.zeroValue=n,this.zeroes=[],this.depth)for(let e=0;e=this.getMaxLeaves())throw new Error("tree is full");let t=e,r=this.nodes[0].length;for(let e=0;e=this.nodes[0].length)throw new Error("out of bounds");let r=t;for(let t=0;tBigInt(e)))}getLayers(){const e=[];for(const t of this.nodes)e.push(this.copyList(t));if(e[0].length=e[r].length&&(e[r][t]=this.zeroes[r]);t=Math.floor(t/this.arity)}}return e.push([this.root]),e}getHexLayers(){return this.getLayers().reduce(((e,t)=>(Array.isArray(t)?e.push(t.map((e=>this.bufferToHex(this.bufferify(e))))):e.push(t),e)),[])}getLayersAsObject(){const e=this.getLayers().map((e=>e.map((e=>this.bufferToHex(this.bufferify(e),!1))))),t=[];for(let r=0;r=this.nodes[0].length)throw new Error("The leaf does not exist in this tree");const t=[],r=[],n=e;for(let n=0;nBigInt(e))),this.data=r}getBucket(){let e;return e=this.data?this.hashFn(this.data):_.alloc(32),new dZ(BigInt(this.rng[1])-BigInt(this.rng[0]),e)}};class hZ{constructor(e,t){this.bucket=e,this.right=t}}lZ.ProofStep=hZ;class pZ extends fZ.Base{constructor(e,t){super(),this.leaves=e,this.hashFn=t,pZ.checkConsecutive(e),this.buckets=[];for(const t of e)this.buckets.push(t.getBucket());let r=[];for(const e of this.buckets)r.push(e);for(;1!==r.length;){const e=[];for(;r.length;)if(r.length>=2){const t=r.shift(),n=r.shift(),i=t.size+n.size,o=this.hashFn(_.concat([this.sizeToBuffer(t.size),this.bufferify(t.hashed),this.sizeToBuffer(n.size),this.bufferify(n.hashed)])),a=new dZ(i,o);n.parent=a,t.parent=n.parent,t.right=n,n.left=t,e.push(a)}else e.push(r.shift());r=e}this.root=r[0]}sizeToBuffer(e){const t=_.alloc(8);return new DataView(t.buffer).setBigInt64(0,BigInt(e),!1),t}static checkConsecutive(e){let t=BigInt(0);for(const r of e){if(r.rng[0]!==t)throw new Error("leaf ranges are invalid");t=BigInt(r.rng[1])}}getProof(e){let t=this.buckets[Number(e)];const r=[];for(;t&&t.parent;){const e=!!t.right,n=t.right?t.right:t.left;t=t.parent,r.push(new hZ(n,e))}return r}sum(e){let t=BigInt(0);for(const r of e)t+=BigInt(r);return t}verifyProof(e,t,r){const n=[this.sum(r.filter((e=>!e.right)).map((e=>e.bucket.size))),BigInt(e.size)-this.sum(r.filter((e=>e.right)).map((e=>e.bucket.size)))];if(n[0]!==t.rng[0]||n[1]!==t.rng[1])return!1;let i,o=t.getBucket();for(const e of r)i=e.right?this.hashFn(_.concat([this.sizeToBuffer(o.size),this.bufferify(o.hashed),this.sizeToBuffer(e.bucket.size),this.bufferify(e.bucket.hashed)])):this.hashFn(_.concat([this.sizeToBuffer(e.bucket.size),this.bufferify(e.bucket.hashed),this.sizeToBuffer(o.size),this.bufferify(o.hashed)])),o=new dZ(BigInt(o.size)+BigInt(e.bucket.size),i);return o.size===e.size&&o.hashed.toString("hex")===e.hashed.toString("hex")}}lZ.MerkleSumTree=pZ,"undefined"!=typeof window&&(window.MerkleSumTree=pZ),lZ.default=pZ,function(e){var t=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.MerkleTree=void 0;const r=t(eW);e.MerkleTree=r.default;var n=QJ;Object.defineProperty(e,"MerkleMountainRange",{enumerable:!0,get:function(){return n.MerkleMountainRange}});var i=oZ;Object.defineProperty(e,"IncrementalMerkleTree",{enumerable:!0,get:function(){return i.IncrementalMerkleTree}});var a=lZ;Object.defineProperty(e,"MerkleSumTree",{enumerable:!0,get:function(){return a.MerkleSumTree}}),e.default=r.default}({});const mZ=({chain:e,rpcUrl:t,bundlerRpcUrl:r,projectId:n,bundlerProvider:i})=>{const o=GB(r??Xj,{fetchOptions:{headers:r===Xj?{projectId:n,bundlerProvider:i}:{}},name:"Connected bundler network",key:"connected-bundler-network",retryCount:0,timeout:35e3}),a=GB(t??sD[e.id]);let s=rI(BR({chain:e,transport:jB({async request({method:t,params:r}){let n;return n=["eth_sendUserOperation","eth_estimateUserOperationGas","eth_getUserOperationReceipt","eth_getUserOperationByHash","eth_supportedEntryPoints","eth_maxPriorityFeePerGas","rundler_maxPriorityFeePerGas","pimlico_getUserOperationGasPrice"].includes(t)?await o({chain:e}).request({method:t,params:r}):await a({chain:e}).request({method:t,params:r}),n}})}));return s};var bZ;function gZ(e){return e&&void 0!==e.connectValidator}!function(e){e.UNDEFINED="0x0",e.NOT_DEPLOYED="0x1",e.DEPLOYED="0x2"}(bZ||(bZ={}));class yZ extends sI{constructor(e){super({...e,entryPointAddress:e.entryPointAddress??eD,chain:e.chain??NU,rpcClient:e.rpcClient??Xj}),Object.defineProperty(this,"factoryAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"initCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"validator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"defaultValidator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.index=e.index??0n,this.factoryAddress=e.factoryAddress??"0x5de4839a76cf55d0c90e2061ef4386d962E15ae3",this.validator=e.validator,this.defaultValidator=e.defaultValidator,this.initCode=e.initCode}static async init(e){const t=await u$(e.projectId);if(!t)throw new Error("ChainId not found");const r=XV(t),n="string"==typeof e.rpcClient?mZ({chain:r,rpcUrl:e.rpcClient,bundlerRpcUrl:e.rpcClient??Xj,projectId:e.projectId,bundlerProvider:e.bundlerProvider}):e.rpcClient;return new yZ({...e,chain:r,rpcClient:n})}connectValidator(e){return bI(this,"validator",e),this}getValidator(){if(!this.validator)throw new Error("Validator not connected");return this.validator}getDummySignature(){return"0x00000000870fe151d548a1c527c3804866fab30abf28ed17b79d5fc5149f19ca0819fefc3c57f3da4fdf9b10fab3f2f3dca536467ae44943b9dbb8433efe7760ddd72aaa1c"}async getInitCode(){if(this.deploymentState===bZ.DEPLOYED)return"0x";const e=await this.rpcProvider.getContractCode(await this.getAddress());return(e?.length??0)>2?(this.deploymentState=bZ.DEPLOYED,"0x"):(this.deploymentState=bZ.NOT_DEPLOYED,this.initCode??this.getAccountInitCode())}getIndex(){return this.index}async approvePlugin(){if(!this.validator)throw new Error("Validator not connected");if(this.defaultValidator&&!this.validator.getEnableSignature()){const{executor:e,selector:t,validAfter:r,validUntil:n}=this.validator.getPluginValidatorData(),i=await this.defaultValidator.approveExecutor(await this.getAddress(),t,e,n,r,this.validator);this.validator.setEnableSignature(i)}}async encodeExecute(e,t,r){if(!this.validator)throw new Error("Validator not connected");return e.toLowerCase()===(await this.getAddress()).toLowerCase()&&this.validator.shouldDelegateViaFallback()?r:this.encodeExecuteAction(e,t,r,0)}async encodeBatchExecute(e){const t=await this.getKernelImplementationAddess(),r=await this.getInitCode();if(t?.toLowerCase()!==rD.toLowerCase()&&t?.toLowerCase()!=="0x8dD4DBB54d8A8Cf0DE6F9CCC4609470A30EfF18C".toLowerCase()&&t?.toLowerCase()!=="0xd3f582f6b4814e989ee8e96bc3175320b5a540ab".toLowerCase()&&"0x"===r){const t=cM({abi:BE,functionName:"multiSend",args:[ZV(e)]});return await this.encodeExecuteDelegate(tD,BigInt(0),t)}return await this.encodeExecuteBatchAction(e)}async encodeExecuteDelegate(e,t,r){return this.encodeExecuteAction(e,t,r,1)}async encodeSetExection(){if(!this.validator)throw new Error("Validator not connected");const{executor:e,selector:t,validAfter:r,validUntil:n}=await this.validator.getPluginValidatorData(),i=await this.validator.getEnableData();return cM({abi:ME,functionName:"setExecution",args:[t,e,this.validator.validatorAddress,n,r,i]})}async encodeUgradeTo(){return cM({abi:ME,functionName:"upgradeTo",args:[rD]})}async getKernelImplementationAddess(){try{const e=await this.rpcProvider.getStorageAt({address:await this.getAddress(),slot:"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc"});return e?"0x"+e.slice(26):e}catch(e){return}}async signMessageWith6492(e){try{if(!this.validator)throw new Error("Validator not connected");const t="string"==typeof e?rO(e):e;let r=await this.validator.signMessage(rO(QN({raw:t})));return await this.isAccountDeployed()||(r=cI({factoryAddress:this.factoryAddress,initCode:await this.getFactoryInitCode(),signature:r})),r}catch(e){throw console.error("Got Error - ",e.message),new Error("Message Signing with EIP6492 failed")}}async signTypedDataWith6492(e){try{if(!this.validator)throw new Error("Validator not connected");let t=await this.validator.signTypedData(e);return await this.isAccountDeployed()||(t=cI({factoryAddress:this.factoryAddress,initCode:await this.getFactoryInitCode(),signature:t})),t}catch(e){throw console.error("Got Error - ",e.message),new Error("Message Signing with EIP6492 failed")}}async signMessage(e){if(!this.validator)throw new Error("Validator not connected");const t="string"==typeof e?rO(e):e;return await this.validator.signMessage(t)}async signTypedData(e){if(!this.validator)throw new Error("Validator not connected");return await this.validator.signTypedData(e)}signUserOp(e){if(!this.validator)throw new Error("Validator not connected");return this.validator.signUserOp(e)}encodeExecuteAction(e,t,r,n){return cM({abi:ME,functionName:"execute",args:[e,t,r,n]})}encodeExecuteBatchAction(e){return cM({abi:ME,functionName:"executeBatch",args:[e.map((e=>({to:e.target,value:e.value??0n,data:e.data})))]})}async getAccountInitCode(){return qO([this.factoryAddress,await this.getFactoryInitCode()])}async getNonce(){if(!await this.isAccountDeployed())return 0n;if(!this.validator)throw Error("Validator unintialized");const e=await this.getAddress(),t=this.validator.getNonceKey();return this.entryPoint.read.getNonce([e,t])}async getFactoryInitCode(){const e=this.defaultValidator??this.validator;if(!e)throw new Error("Validator not connected");try{return cM({abi:CE,functionName:"createAccount",args:[rD,cM({abi:ME,functionName:"initialize",args:[e.getAddress(),await e.getEnableData()]}),this.index]})}catch(e){throw console.error("err occurred:",e.message),new Error("Factory Code generation failed")}}}const vZ=tI.find((e=>"simulateValidation"===e.name))?.inputs[0];function wZ(e,t=!0){if(t){let t=JO({components:[{type:"address",name:"sender"},{type:"uint256",name:"nonce"},{type:"bytes",name:"initCode"},{type:"bytes",name:"callData"},{type:"uint256",name:"callGasLimit"},{type:"uint256",name:"verificationGasLimit"},{type:"uint256",name:"preVerificationGas"},{type:"uint256",name:"maxFeePerGas"},{type:"uint256",name:"maxPriorityFeePerGas"},{type:"bytes",name:"paymasterAndData"},{type:"bytes",name:"signature"}],name:"userOp",type:"tuple"}.components,Object.values({...e,signature:"0x"}));return t="0x"+t.slice(66,t.length-64),t}return function(e,t){const r=e.map((e=>"bytes"===e.type&&t?"bytes32":e.type)).join(", "),n=e.map((e=>"bytes"===e.type&&t?jO(e.val):e.val));return JO(tT(r),n)}(vZ.components.map((t=>({type:t.type,val:e[t.name]}))),t)}function EZ(e){return!!(e.callGasLimit&&e.maxFeePerGas&&null!=e.maxPriorityFeePerGas&&e.preVerificationGas&&e.verificationGasLimit)}const AZ={fixed:21e3,perUserOp:18300,perUserOpWord:4,zeroByte:4,nonZeroByte:16,bundleSize:1,sigSize:65};let xZ=class extends sT{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}};const _Z=async(e,t)=>{if(null==t||"0x"===t)return BigInt(0);const r=t.substring(0,42),n="0x"+t.substring(42);return await e.rpcClient.estimateGas({account:eD,to:r,data:n})},kZ=async e=>function(e,t){const r={...AZ,...t??{}},n=rO(wZ({preVerificationGas:21e3,signature:JT(_.alloc(r.sigSize,1)),...e},!1)),i=n.map((e=>0===e?r.zeroByte:r.nonZeroByte)).reduce(((e,t)=>e+t));return Math.round(i+r.fixed/r.bundleSize+r.perUserOp+r.perUserOpWord*n.length)}(await dI(e)),SZ={STACKUP:"eth_maxPriorityFeePerGas",ALCHEMY:"rundler_maxPriorityFeePerGas",PIMLICO:"pimlico_getUserOperationGasPrice",GELATO:"eth_maxPriorityFeePerGas"},PZ=async e=>{let[t,r]=await Promise.all([e.rpcClient.request({method:SZ[e.bundlerProvider]??"eth_maxPriorityFeePerGas",params:[]}),e.rpcClient.getBlock({blockTag:"latest"})]);if("PIMLICO"===e.bundlerProvider&&(t=t.standard.maxPriorityFeePerGas),"bigint"!=typeof r.baseFeePerGas)throw new xZ;const n=10**1.2.toString().split(".")[1].length,i=BigInt(t),o=(e=>e*BigInt(1.2*n)/BigInt(n))(r.baseFeePerGas);return{maxFeePerGas:o+i,maxPriorityFeePerGas:i}},IZ=async e=>{const{block:t,gasPrice:r}=await dI({block:e.rpcClient.getBlock({blockTag:"latest"}),gasPrice:e.rpcClient.getGasPrice().catch((e=>(console.warn("Legacy: Failed to get gas price",e),null)))});let n=null,i=null;if(t&&null!=t.baseFeePerGas){const o=BigInt("1500000000");i=r?r-t.baseFeePerGas:null,(null==i||i-BigInt(0)||i>o)&&(i=o),i=i{let t=f[e];return"string"==typeof t&&t.startsWith("0x")||(t=JT(t)),[e,t]})).reduce(((e,[t,r])=>({...e,[t]:r})),{}));const d=await u$(this.provider.getProjectId());if(!d)throw new Error("ChainId not found");let h=Object.fromEntries(Object.entries({projectId:this.provider.getProjectId(),chainId:d,userOp:c,entryPointAddress:eD,callData:t instanceof Promise?await t:t,gasTokenData:r&&l&&i?{tokenAddress:r,erc20UserOp:l,erc20CallData:i instanceof Promise?await i:i}:void 0,tokenAddress:r,erc20UserOp:l,erc20CallData:i instanceof Promise?await i:i,paymasterProvider:o,shouldOverrideFee:a,shouldConsume:s}).filter((([e,t])=>void 0!==t)));const{data:p}=await Kz.post(`${Qj}/getPaymasterAndData`,{...h},{headers:{"Content-Type":"application/json"}});return p}}const BZ={VERIFYING_PAYMASTER:class extends CZ{constructor(e,t){super(e)}async getPaymasterResponse(e,t,r,n){const i=hI(await dI(e));return await this.signUserOp({userOp:i,paymasterProvider:t,shouldOverrideFee:r,shouldConsume:n})}},TOKEN_PAYMASTER:class extends CZ{constructor(e,t){super(e),Object.defineProperty(this,"paymasterConfig",{enumerable:!0,configurable:!0,writable:!0,value:t})}async getPaymasterAddress(e){const t=await u$(this.provider.getProjectId());try{const{data:r}=await Kz.post(`${Qj}/getPaymasterAddress`,{chainId:t,entryPointAddress:eD,paymasterProvider:e},{headers:{"Content-Type":"application/json"}});return r}catch(e){return void console.log(e)}}async decodeMainCallFromCallData(e,t){let r="0x";if(t instanceof Promise){const e=await t;r=e instanceof Uint8Array?JT(e):e}else r=t instanceof Uint8Array?JT(t):t;try{const{functionName:e,args:t}=MN({abi:ME,data:r});if("execute"===e){const[e,r,n]=t;let i;try{({functionName:i}=MN({abi:BE,data:n}))}catch(e){}let o={target:e,value:r??0n,data:n};return"multiSend"===i&&(o={...o,target:tD,delegateCall:!0,data:n}),o}if("executeBatch"===e){const[e]=t;return e.map((e=>({target:e.to,value:e.value??0n,data:e.data})))}}catch(t){return{target:e instanceof Promise?await e:e,data:r,value:0n,delegateCall:!0}}}async getERC20UserOp(e,t,r,n){try{const i={target:r,value:BigInt(0),data:cM({abi:NE,functionName:"approve",args:[n,iD[r]]})};if(!this.provider.account)throw MZ;let o;o=function(e){return e&&Array.isArray(e)}(t)?[i,...t]:[i,t];const a=await this.provider.account.encodeBatchExecute(o);return{...e,callData:a,callGasLimit:await this.provider.rpcClient.estimateGas({account:eD,to:await this.provider.getAddress(),data:a}),signature:await this.provider.getAccount().getValidator().getDynamicDummySignature(await e.sender,a)}}catch(e){return}}async getPaymasterResponse(e,t,r,n){const i=await this.decodeMainCallFromCallData(e.sender,e.callData);if(!i)throw OZ;const o=await u$(this.provider.getProjectId());if(!o)throw new Error("ChainId not found");const a=function(e,t){return"TEST_ERC20"===e?"0x3870419Ba2BBf0127060bCB37f69A1b1C090992B":nD[e][t]||void 0}(this.paymasterConfig.gasToken,o);let s=await this.getPaymasterAddress(t);if(void 0!==a&&void 0!==s&&HO(s)){const o=await this.getERC20UserOp(e,i,a,s);if(!o)return;return await this.signUserOp({userOp:e,callData:e.callData,gasTokenAddress:a,erc20UserOp:o,erc20CallData:o.callData,paymasterProvider:t,shouldOverrideFee:r,shouldConsume:n})}}}},NZ=(e,t)=>(e.withPaymasterMiddleware(RZ(e,t)),e),RZ=(e,t)=>({dummyPaymasterDataMiddleware:async e=>(e.paymasterAndData="0xe93eca6595fe94091dc1af46aac2a8b5d79907700000000000000000000000000000000000000000000000000000000064ee5cd9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",e),paymasterDataMiddleware:async r=>{const n=BigInt("100000"),i=BigInt("1000000"),o=BigInt("55000"),a=new BZ[t.policy](e,t);let s;try{s=await a.getPaymasterResponse({...r,preVerificationGas:n,verificationGasLimit:i,callGasLimit:o},t.paymasterProvider,!1,e.shouldConsume())}catch(e){if(console.error(e),t.onlySendSponsoredTransaction)throw e instanceof Wz?Error(e.response?.data.message):e}if(t.onlySendSponsoredTransaction&&(!s||!s.paymasterAndData||"0x"===s.paymasterAndData))throw new Error("Transaction is not sponsored");return s&&s.paymasterAndData&&"0x"!==s.paymasterAndData?{...r,...s}:{...r,paymasterAndData:"0x"}}});var FZ,LZ;!function(e){e[e.Call=0]="Call",e[e.DelegateCall=1]="DelegateCall"}(FZ||(FZ={}));class UZ extends vI{constructor({projectId:e,chain:t,entryPointAddress:r=eD,rpcUrl:n,bundlerRpcUrl:i=Xj,account:o,bundlerProvider:a,opts:s}){const c="number"==typeof t?XV(t):t;super(mZ({chain:c,rpcUrl:n,bundlerRpcUrl:i,projectId:e,bundlerProvider:a}),r,c,o,{...s,txMaxRetries:s?.txMaxRetries??20,txRetryIntervalMs:s?.txRetryIntervalMs??1e4,minPriorityFeePerBid:s?.minPriorityFeePerBid??oD.get(c.id)}),Object.defineProperty(this,"projectId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendTxMaxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sendTxRetryIntervalMs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"bundlerProvider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_txMaxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_txRetryIntervalMs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_shouldConsume",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"feeOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getProjectId",{enumerable:!0,configurable:!0,writable:!0,value:()=>this.projectId}),Object.defineProperty(this,"shouldConsume",{enumerable:!0,configurable:!0,writable:!0,value:()=>this._shouldConsume}),Object.defineProperty(this,"sendTransaction",{enumerable:!0,configurable:!0,writable:!0,value:async(e,t=FZ.Call)=>{if(!e.to)throw new Error("transaction is missing to address");const r={};e.maxFeePerGas&&(r.maxFeePerGas=e.maxFeePerGas),e.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas);const{hash:n}=await this.sendUserOperation({target:e.to,data:e.data??"0x",value:e.value?HT(e.value,"bigint"):0n},r,t);return await this.waitForUserOperationTransaction(n)}}),Object.defineProperty(this,"buildUserOperation",{enumerable:!0,configurable:!0,writable:!0,value:async(e,t,r=FZ.Call)=>{if(this._shouldConsume=!1,!gZ(this.account))throw new Error("account not connected!");if(!this.account.validator)throw new Error("validator not connected!");let n="0x";if(Array.isArray(e)){if(r!==FZ.Call)throw TZ;n=await this.account.encodeBatchExecute(e)}else{if(!gZ(this.account))throw TZ;if(r===FZ.DelegateCall)n=await this.account.encodeExecuteDelegate(e.target,e.value??0n,e.data);else{if(r!==FZ.Call)throw TZ;n=await this.account.encodeExecute(e.target,e.value??0n,e.data)}}const i=await this.account.getInitCode(),o=await this.account.getNonce(),a=await this._runMiddlewareStack({initCode:i,sender:this.getAddress(),nonce:o,callData:n,signature:await this.account.getValidator().getDynamicDummySignature(await this.getAddress(),n)},t);return this._shouldConsume=!0,a}}),Object.defineProperty(this,"_runMiddlewareStack",{enumerable:!0,configurable:!0,writable:!0,value:async(e,t)=>{const r=await fI(this.dummyPaymasterDataMiddleware,this.feeDataGetter,this.paymasterDataMiddleware,this.gasEstimator,this.customMiddleware??gI,(async e=>({...e,...t})))(e);return hI(await dI(r))}}),Object.defineProperty(this,"sendUserOperation",{enumerable:!0,configurable:!0,writable:!0,value:async(e,t,r=FZ.Call)=>{if(!this._shouldConsume)throw new Error("Cannot send user operation while building user operation");if(!gZ(this.account))throw new Error("account not connected!");if(!this.account.validator)throw new Error("validator not connected!");let n="0x";if(Array.isArray(e)){if(r!==FZ.Call)throw TZ;n=await this.account.encodeBatchExecute(e)}else{if(!gZ(this.account))throw TZ;if(r===FZ.DelegateCall)n=await this.account.encodeExecuteDelegate(e.target,e.value??0n,e.data);else{if(r!==FZ.Call)throw TZ;n=await this.account.encodeExecute(e.target,e.value??0n,e.data)}}const i=await this.account.getInitCode();let o="",a=0;const s=await this.account.getNonce();let c,u,l,f;do{if(c=await fI(this.dummyPaymasterDataMiddleware,this.feeDataGetter,this.paymasterDataMiddleware,this.gasEstimator,this.customMiddleware??gI,(async e=>({...e,...t})))({initCode:i,sender:this.getAddress(),nonce:s,callData:n,signature:await this.account.getValidator().getDynamicDummySignature(await this.getAddress(),n),maxFeePerGas:l,maxPriorityFeePerGas:f}),u=hI(await dI(c)),!EZ(u))throw new Error(`Request is missing parameters. All properties on UserOperationStruct must be set. uo: ${JSON.stringify(u,null,2)}`);await this.account.approvePlugin(),u.signature=await this.account.validator.getSignature(u);try{o=await this.rpcClient.sendUserOperation(u,this.entryPointAddress)}catch(e){if(this.isReplacementOpError(e)&&a++setTimeout(e,this.sendTxRetryIntervalMs)));continue}throw this.unwrapError(e)}}while(""===o);return{hash:o,request:u}}}),Object.defineProperty(this,"waitForUserOperationTransaction",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{let t=await this.rpcClient.getBlockNumber();for(let r=0;rnull));if(t)return this.getTransaction(t.receipt.transactionHash).then((e=>e.hash))}else{const r=await this.rpcClient.getLogs({address:eD,event:eM({abi:tI,name:"UserOperationEvent"}),args:{userOpHash:e},fromBlock:t-100n});if(r.length)return r[0].transactionHash}await new Promise((e=>setTimeout(e,this._txRetryIntervalMs)))}throw new Error("Failed to find transaction for User Operation")}}),Object.defineProperty(this,"getAccount",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!gZ(this.account))throw new Error("account not connected!");return this.account}}),Object.defineProperty(this,"dummyPaymasterDataMiddleware",{enumerable:!0,configurable:!0,writable:!0,value:async e=>(e.paymasterAndData="0x",e)}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const{method:t,params:r}=e;switch(t){case"eth_chainId":return this.chain.id;case"eth_sendTransaction":const[t]=r;return this.sendTransaction(t);case"eth_signTypedData_v4":return this.signTypedData(JSON.parse(r[1]));case"personal_sign":if(!this.account)throw new Error("account not connected!");const[n,i]=r;if(i.toLowerCase()!==(await this.getAddress()).toLowerCase())throw new Error("cannot sign for address that is not the current account");return this.account.signMessageWith6492(n);default:return this.rpcClient.request(e)}}}),this.feeOptions={maxFeePerGasBufferPercentage:s?.feeOptions?.maxFeePerGasBufferPercentage??0,maxPriorityFeePerGasBufferPercentage:s?.feeOptions?.maxPriorityFeePerGasBufferPercentage??13},this._txMaxRetries=s?.txMaxRetries??20,this._txRetryIntervalMs=s?.txRetryIntervalMs??5e3,this.bundlerProvider=a,this.projectId=e,this.sendTxMaxRetries=s?.sendTxMaxRetries??3,this.sendTxRetryIntervalMs=s?.sendTxRetryIntervalMs??6e4,(e=>{e.withFeeDataGetter((async t=>{let r,n,i=await dI({maxFeePerGas:t.maxFeePerGas,maxPriorityFeePerGas:t.maxPriorityFeePerGas});if("GELATO"===e.bundlerProvider)return{maxFeePerGas:0n,maxPriorityFeePerGas:0n};try{({maxFeePerGas:r,maxPriorityFeePerGas:n}=await PZ(e))}catch(e){console.warn("getGas: eth_maxPriorityFeePerGas failed, falling back to legacy gas price.")}if(void 0===r||void 0===n){const t=await IZ(e);r=t?.maxFeePerGas?BigInt(t?.maxFeePerGas):0n,n=t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):0n}return i.maxFeePerGas||i.maxPriorityFeePerGas?{maxFeePerGas:i.maxFeePerGas??r,maxPriorityFeePerGas:i.maxPriorityFeePerGas??n}:{maxFeePerGas:r,maxPriorityFeePerGas:n}})),e.withGasEstimator((async t=>{if(void 0!==t.callGasLimit&&void 0!==t.verificationGasLimit&&void 0!==t.preVerificationGas)return t;const r=await(e.account?.getInitCode()),n=await _Z(e,r),i={...t,callGasLimit:void 0!==r&&r.length>2?BigInt("1000000"):BigInt(55e3),verificationGasLimit:BigInt(11e4)+n,preVerificationGas:BigInt(1e5)};i.preVerificationGas=await kZ(i);const o=hI(await dI(i));let a;a=await e.rpcClient.estimateUserOperationGas(o,eD);const{preVerificationGas:s,verificationGasLimit:c,callGasLimit:u}=a;return o.preVerificationGas=BigInt(s)??o.preVerificationGas,o.verificationGasLimit=BigInt(c)??o.verificationGasLimit,o.callGasLimit=BigInt(u)??o.callGasLimit,{...t,...o}}))})(this)}isReplacementOpError(e){if(null!=e.cause){const t=e?.cause?.message;return(t?.includes("replacement op must increase maxFeePerGas and MaxPriorityFeePerGas")||null!==t?.match(/.*replacement.*underpriced.*/))??!1}return!1}unwrapError(e){if(null!=e?.cause){let t="",r=e?.cause?.message;if(!0===r?.includes("FailedOp")){const e=r.match(/FailedOp\((.*)\)/);if(null!=e){const n=e[1].split(",");t=`(paymaster address: ${n[1]})`,r=n[2]}}const n=new Error(`The bundler has failed to include UserOperation in a batch: ${r} ${t}`);return n.stack=e.stack,n}return e}withZeroDevPaymasterAndData(e){if(!this.isConnected())throw new Error("ZeroDevProvider: account is not set, did you call `connect` first?");return NZ(this,e)}}BigInt.prototype.toJSON=function(){return this.toString()},function(e){e[e.EQUAL=0]="EQUAL",e[e.GREATER_THAN=1]="GREATER_THAN",e[e.LESS_THAN=2]="LESS_THAN",e[e.GREATER_THAN_OR_EQUAL=3]="GREATER_THAN_OR_EQUAL",e[e.LESS_THAN_OR_EQUAL=4]="LESS_THAN_OR_EQUAL",e[e.NOT_EQUAL=5]="NOT_EQUAL"}(LZ||(LZ={}));class jZ extends UZ{constructor(e,t){let r=e.bundlerProvider;const n=(void 0===e.usePaymaster||e.usePaymaster)&&"GELATO"!==r;if(e.opts?.paymasterConfig&&"TOKEN_PAYMASTER"===e.opts?.paymasterConfig.policy&&n&&(r="STACKUP"),super({...e.opts?.providerConfig,chain:e.opts?.providerConfig?.chain??NU,rpcUrl:e.opts?.providerConfig?.rpcUrl,projectId:e.projectId,bundlerProvider:r}),Object.defineProperty(this,"defaultProvider",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getValidator",{enumerable:!0,configurable:!0,writable:!0,value:()=>{if(!gZ(this.account)||!this.account.validator)throw new Error("ValidatorProvider: account with validator is not set, did you call all connects first?");return this.account.getValidator()}}),Object.defineProperty(this,"getEncodedEnableData",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{if(!gZ(this.account)||!this.account.validator)throw new Error("ValidatorProvider: account with validator is not set, did you call all connects first?");return await this.account.validator.encodeEnable(e)}}),Object.defineProperty(this,"getEncodedDisableData",{enumerable:!0,configurable:!0,writable:!0,value:async(e="0x")=>{if(!gZ(this.account)||!this.account.validator)throw new Error("ValidatorProvider: account with validator is not set, did you call all connects first?");return await this.account.validator.encodeDisable(e)}}),Object.defineProperty(this,"sendEnableUserOperation",{enumerable:!0,configurable:!0,writable:!0,value:async e=>{const t=await this.getEncodedEnableData(e);if(!gZ(this.account)||!this.account.validator)throw new Error("ValidatorProvider: account with validator is not set, did you call all connects first?");return await this.sendUserOperation({target:this.account.validator.validatorAddress,data:t})}}),Object.defineProperty(this,"sendDisableUserOperation",{enumerable:!0,configurable:!0,writable:!0,value:async(e="0x")=>{const t=await this.getEncodedDisableData(e);if(!gZ(this.account)||!this.account.validator)throw new Error("ValidatorProvider: account with validator is not set, did you call all connects first?");if(!this.defaultProvider)throw Error("Default Validator provider unintialized");return await this.defaultProvider.sendUserOperation({target:this.account.validator.validatorAddress,data:t})}}),this.defaultProvider=e.defaultProvider,"number"==typeof e.opts?.providerConfig?.chain&&"number"==typeof e.defaultProvider?.chain&&e.opts?.providerConfig?.chain!==e.defaultProvider?.chain||"object"==typeof e.opts?.providerConfig?.chain&&"object"==typeof e.defaultProvider?.chain&&e.opts?.providerConfig?.chain.id!==e.defaultProvider?.chain.id)throw new Error("chainId mismatch between default provider and current provider - check projectIds");if(this.connect((()=>new yZ({projectId:e.projectId,validator:t,defaultValidator:e.defaultProvider?.getValidator(),rpcClient:this.rpcClient,bundlerProvider:r,index:e.defaultProvider?.getAccount().getIndex(),...e.opts?.accountConfig}))),n){let t=e.opts?.paymasterConfig??{policy:"VERIFYING_PAYMASTER"};t={...t,paymasterProvider:e.opts?.paymasterConfig?.paymasterProvider??r},NZ(this,t)}}}class DZ extends jZ{constructor(e){const t="number"==typeof e.opts?.providerConfig?.chain?XV(e.opts.providerConfig.chain):e.opts?.providerConfig?.chain??NU,r=new QV({projectId:e.projectId,owner:e.owner,chain:t,rpcUrl:e.opts?.providerConfig?.rpcUrl,...e.opts?.validatorConfig});super({...e,opts:{...e.opts,providerConfig:{...e.opts?.providerConfig,chain:t}}},r),Object.defineProperty(this,"changeOwner",{enumerable:!0,configurable:!0,writable:!0,value:this.sendEnableUserOperation}),Object.defineProperty(this,"deleteOwner",{enumerable:!0,configurable:!0,writable:!0,value:this.sendDisableUserOperation})}static async init(e){const t=await u$(e.projectId);if(!t)throw new Error("ChainId not found");const r=XV(t);return new DZ({...e,opts:{...e.opts,providerConfig:{chain:r,...e.opts?.providerConfig}}})}}const zZ=new P$("networks/5.7.1");function $Z(e){const t=function(t,r){null==r&&(r={});const n=[];if(t.InfuraProvider&&"-"!==r.infura)try{n.push(new t.InfuraProvider(e,r.infura))}catch(e){}if(t.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new t.EtherscanProvider(e,r.etherscan))}catch(e){}if(t.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new t.AlchemyProvider(e,r.alchemy))}catch(e){}if(t.PocketProvider&&"-"!==r.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(e,r.pocket);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(e){}}if(t.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new t.CloudflareProvider(e))}catch(e){}if(t.AnkrProvider&&"-"!==r.ankr)try{const i=["ropsten"],o=new t.AnkrProvider(e,r.ankr);o.network&&-1===i.indexOf(o.network.name)&&n.push(o)}catch(e){}if(0===n.length)return null;if(t.FallbackProvider){let i=1;return null!=r.quorum?i=r.quorum:"homestead"===e&&(i=2),new t.FallbackProvider(n,i)}return n[0]};return t.renetwork=function(e){return $Z(e)},t}function HZ(e,t){const r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return HZ(e,t)},r}const GZ={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:$Z("homestead")},qZ={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:$Z("ropsten")},KZ={chainId:63,name:"classicMordor",_defaultProvider:HZ("https://www.ethercluster.com/mordor","classicMordor")},VZ={unspecified:{chainId:0,name:"unspecified"},homestead:GZ,mainnet:GZ,morden:{chainId:2,name:"morden"},ropsten:qZ,testnet:qZ,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:$Z("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:$Z("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:$Z("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:$Z("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:HZ("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:KZ,classicTestnet:KZ,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:HZ("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:$Z("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:$Z("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"}};function WZ(e){if(null==e)return null;if("number"==typeof e){for(const t in VZ){const r=VZ[t];if(r.chainId===e)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=VZ[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=VZ[e.name];if(!t)return"number"!=typeof e.chainId&&zZ.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&zZ.throwArgumentError("network chainId mismatch","network",e);let r=e._defaultProvider||null;return null==r&&t._defaultProvider&&(r=function(e){return e&&"function"==typeof e.renetwork}(t._defaultProvider)?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:r}}var JZ=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};function ZZ(e,t){return JZ(this,void 0,void 0,(function*(){null==t&&(t={});const r={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(r.mode=e.mode),e.cache&&(r.cache=e.cache),e.credentials&&(r.credentials=e.credentials),e.redirect&&(r.redirect=e.redirect),e.referrer&&(r.referrer=e.referrer)}const n=yield fetch(e,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach(((e,t)=>{o[t.toLowerCase()]=e})):n.headers.keys().forEach((e=>{o[e.toLowerCase()]=n.headers.get(e)})),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:X$(new Uint8Array(i))}}))}var YZ=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const XZ=new P$("web/5.7.1");function QZ(e){return new Promise((t=>{setTimeout(t,e)}))}function eY(e,t){if(null==e)return null;if("string"==typeof e)return e;if(J$(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return IG(e)}catch(e){}return iH(e)}return e}function tY(e){return kG(e.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16)))))}function rY(e,t,r){const n="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;XZ.assertArgument(n>0&&n%1==0,"invalid connection throttle limit","connection.throttleLimit",n);const i="object"==typeof e?e.throttleCallback:null,o="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;XZ.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const a="object"==typeof e&&!!e.errorPassThrough,s={};let c=null;const u={method:"GET"};let l=!1,f=12e4;if("string"==typeof e)c=e;else if("object"==typeof e){if(null!=e&&null!=e.url||XZ.throwArgumentError("missing URL","connection.url",e),c=e.url,"number"==typeof e.timeout&&e.timeout>0&&(f=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(u.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==c.substring(0,6)&&!0!==e.allowInsecureAuthentication&&XZ.throwError("basic authentication requires a secure https url",P$.errors.INVALID_ARGUMENT,{argument:"url",url:c,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;s.authorization={key:"Authorization",value:"Basic "+HG(kG(t))}}null!=e.skipFetchSetup&&(u.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(u.fetchOptions=N$(e.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=c?c.match(d):null;if(h)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?$G(h[3]):tY(h[3])};let t=e.body;return r&&(t=r(e.body,e)),Promise.resolve(t)}catch(e){XZ.throwError("processing response error",P$.errors.SERVER_ERROR,{body:eY(h[1],h[2]),error:e,requestBody:null,requestMethod:"GET",url:c})}t&&(u.method="POST",u.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 p={};Object.keys(s).forEach((e=>{const t=s[e];p[t.key]=t.value})),u.headers=p;const m=function(){let e=null;return{promise:new Promise((function(t,r){f&&(e=setTimeout((()=>{null!=e&&(e=null,r(XZ.makeError("timeout",P$.errors.TIMEOUT,{requestBody:eY(u.body,p["content-type"]),requestMethod:u.method,timeout:f,url:c})))}),f))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),b=function(){return YZ(this,void 0,void 0,(function*(){for(let e=0;e=300)&&(m.cancel(),XZ.throwError("bad response",P$.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:eY(s,t.headers?t.headers["content-type"]:null),requestBody:eY(u.body,p["content-type"]),requestMethod:u.method,url:c})),r)try{const e=yield r(s,t);return m.cancel(),e}catch(r){if(r.throttleRetry&&e"content-type"===e.toLowerCase())).length||(r.headers=N$(r.headers),r.headers["content-type"]="application/json")}else r.headers={"content-type":"application/json"};e=r}return rY(e,n,((e,t)=>{let n=null;if(null!=e)try{n=JSON.parse(IG(e))}catch(t){XZ.throwError("invalid JSON",P$.errors.SERVER_ERROR,{body:e,error:t})}return r&&(n=r(n,t)),n}))}function iY(e,t){return t||(t={}),null==(t=N$(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(r,n){let i=null,o=!1;const a=()=>!o&&(o=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{a()&&n(new Error("timeout"))}),t.timeout));const s=t.retryLimit;let c=0;!function i(){return e().then((function(e){if(void 0!==e)a()&&r(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!o){if(c++,c>s)return void(a()&&n(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,c)));et.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){a()&&n(e)}))}()}))}for(var oY="qpzry9x8gf2tvdw0s3jn54khce6mua7l",aY={},sY=0;sY<32;sY++){var cY=oY.charAt(sY);if(void 0!==aY[cY])throw new TypeError(cY+" is ambiguous");aY[cY]=sY}function uY(e){var t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function lY(e){for(var t=1,r=0;r126)return"Invalid prefix ("+e+")";t=uY(t)^n>>5}for(t=uY(t),r=0;rt)return"Exceeds length limit";var r=e.toLowerCase(),n=e.toUpperCase();if(e!==r&&e!==n)return"Mixed-case string "+e;var i=(e=r).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=lY(o);if("string"==typeof s)return s;for(var c=[],u=0;u=a.length||c.push(f)}return 1!==s?"Invalid checksum for "+e:{prefix:o,words:c}}function dY(e,t,r,n){for(var i=0,o=0,a=(1<=r;)o-=r,s.push(i>>o&a);if(n)o>0&&s.push(i<=t)return"Excess padding";if(i<r)throw new TypeError("Exceeds length limit");var n=lY(e=e.toLowerCase());if("string"==typeof n)throw new Error(n);for(var i=e+"1",o=0;o>5)throw new Error("Non 5-bit word");n=uY(n)^a,i+=oY.charAt(a)}for(o=0;o<6;++o)n=uY(n);for(n^=1,o=0;o<6;++o){i+=oY.charAt(n>>5*(5-o)&31)}return i},toWordsUnsafe:function(e){var t=dY(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=dY(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=dY(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=dY(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}},pY=a(hY);const mY="providers/5.7.2",bY=new P$(mY);class gY{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),n=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),s=this.number.bind(this),c=this.type.bind(this);return e.transaction={hash:o,type:c,accessList:gY.allowNull(this.accessList.bind(this),null),blockHash:gY.allowNull(o,null),blockNumber:gY.allowNull(s,null),transactionIndex:gY.allowNull(s,null),confirmations:gY.allowNull(s,null),from:t,gasPrice:gY.allowNull(r),maxPriorityFeePerGas:gY.allowNull(r),maxFeePerGas:gY.allowNull(r),gasLimit:r,to:gY.allowNull(t,null),value:r,nonce:s,data:i,r:gY.allowNull(this.uint256),s:gY.allowNull(this.uint256),v:gY.allowNull(s),creates:gY.allowNull(t,null),raw:gY.allowNull(i)},e.transactionRequest={from:gY.allowNull(t),nonce:gY.allowNull(s),gasLimit:gY.allowNull(r),gasPrice:gY.allowNull(r),maxPriorityFeePerGas:gY.allowNull(r),maxFeePerGas:gY.allowNull(r),to:gY.allowNull(t),value:gY.allowNull(r),data:gY.allowNull((e=>this.data(e,!0))),type:gY.allowNull(s),accessList:gY.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:s,blockNumber:s,transactionHash:o,address:t,topics:gY.arrayOf(o),data:i,logIndex:s,blockHash:o},e.receipt={to:gY.allowNull(this.address,null),from:gY.allowNull(this.address,null),contractAddress:gY.allowNull(t,null),transactionIndex:s,root:gY.allowNull(a),gasUsed:r,logsBloom:gY.allowNull(i),blockHash:o,transactionHash:o,logs:gY.arrayOf(this.receiptLog.bind(this)),blockNumber:s,confirmations:gY.allowNull(s,null),cumulativeGasUsed:r,effectiveGasPrice:gY.allowNull(r),status:gY.allowNull(s),type:c},e.block={hash:gY.allowNull(o),parentHash:o,number:s,timestamp:s,nonce:gY.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:gY.allowNull(t),extraData:i,transactions:gY.allowNull(gY.arrayOf(o)),baseFeePerGas:gY.allowNull(r)},e.blockWithTransactions=N$(e.block),e.blockWithTransactions.transactions=gY.allowNull(gY.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:gY.allowNull(n,void 0),toBlock:gY.allowNull(n,void 0),blockHash:gY.allowNull(o,void 0),address:gY.allowNull(t,void 0),topics:gY.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:gY.allowNull(s),blockHash:gY.allowNull(o),transactionIndex:s,removed:gY.allowNull(this.boolean.bind(this)),address:t,data:gY.allowFalsish(i,"0x"),topics:gY.arrayOf(o),transactionHash:o,logIndex:s},e}accessList(e){return HK(e||[])}number(e){return"0x"===e?0:EH.from(e).toNumber()}type(e){return"0x"===e||null==e?0:EH.from(e).toNumber()}bigNumber(e){return EH.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),rH(e))?e.toLowerCase():bY.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!=0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return rG(e)}callAddress(e){if(!rH(e,32))return null;const t=rG(aH(e,12));return t===cG?null:t}contractAddress(e){return nG(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||rH(e))return cH(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return 32!==oH(r)?bY.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(null==e)return null;const t=EH.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!rH(e))throw new Error("invalid uint256");return lH(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const r=null!=e._difficulty?e._difficulty:e.difficulty,n=gY.check(t,e);return n._difficulty=null==r?null:EH.from(r),n}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return gY.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&EH.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=gY.check(this.formats.transaction,e);if(null!=e.chainId){let r=e.chainId;rH(r)&&(r=EH.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;null==r&&null==t.v&&(r=e.chainId),rH(r)&&(r=EH.from(r).toNumber()),"number"!=typeof r&&null!=t.v&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),"number"!=typeof r&&(r=0),t.chainId=r}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return JK(e)}receiptLog(e){return gY.check(this.formats.receiptLog,e)}receipt(e){const t=gY.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=EH.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&bY.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):bY.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&bY.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 gY.check(this.formats.filter,e)}filterLog(e){return gY.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const n in e)try{const i=e[n](t[n]);void 0!==i&&(r[n]=i)}catch(e){throw e.checkKey=n,e.checkValue=t[n],e}return r}static allowNull(e,t){return function(r){return null==r?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach((function(t){r.push(e(t))})),r}}}function yY(e){return e&&"function"==typeof e.isCommunityResource}function vY(e){return yY(e)&&e.isCommunityResource()}let wY=!1;function EY(){wY||(wY=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var AY=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const xY=new P$(mY);function _Y(e){return null==e?"null":(32!==oH(e)&&xY.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function kY(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[_Y(e)]=!0}));const r=Object.keys(t);return r.sort(),r.join("|")}return _Y(e)})).join("&")}function SY(e){if("string"==typeof e){if(32===oH(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+kY(e);if(aG.isForkEvent(e))throw xY.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+kY(e.topics||[])}throw new Error("invalid event - "+e)}function PY(){return(new Date).getTime()}function IY(e){return new Promise((t=>{setTimeout(t,e)}))}const TY=["block","network","pending","poll"];class OY{constructor(e,t,r){O$(this,"tag",e),O$(this,"listener",t),O$(this,"once",r),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],r=function(e){return""===e?[]:e.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}))}(e[2]),n={};return r.length>0&&(n.topics=r),t&&"*"!==t&&(n.address=t),n}pollable(){return this.tag.indexOf(":")>=0||TY.indexOf(this.tag)>=0}}const MY={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 CY(e){return lH(EH.from(e).toHexString(),32)}function BY(e){return Lq.encode(Q$([e,aH(zq(zq(e)),0,4)]))}const NY=new RegExp("^(ipfs)://(.*)$","i"),RY=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),NY,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function FY(e,t){try{return IG(LY(e,t))}catch(e){}return null}function LY(e,t){if("0x"===e)return null;const r=EH.from(aH(e,t,t+32)).toNumber(),n=EH.from(aH(e,r,r+32)).toNumber();return aH(e,r+32,r+32+n)}function UY(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):xY.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function jY(e){const t=X$(e);if(t.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(t,32-t.length),r}function DY(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function zY(e){const t=[];let r=0;for(let n=0;nEH.from(e).eq(1))).catch((e=>{if(e.code===P$.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return AY(this,void 0,void 0,(function*(){const r={to:this.address,ccipReadEnabled:!0,data:sH([e,bq(this.name),t||"0x"])};let n=!1;(yield this.supportsWildcard())&&(n=!0,r.data=sH(["0x9061b923",zY([gq(this.name),r.data])]));try{let e=yield this.provider.call(r);return X$(e).length%32==4&&xY.throwError("resolver threw error",P$.errors.CALL_EXCEPTION,{transaction:r,data:e}),n&&(e=LY(e,0)),e}catch(e){if(e.code===P$.errors.CALL_EXCEPTION)return null;throw e}}))}_fetchBytes(e,t){return AY(this,void 0,void 0,(function*(){const r=yield this._fetch(e,t);return null!=r?LY(r,0):null}))}_getAddress(e,t){const r=MY[String(e)];if(null==r&&xY.throwError(`unsupported coin type: ${e}`,P$.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===r.ilk)return this.provider.formatter.address(t);const n=X$(t);if(null!=r.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 BY(Q$([[r.p2pkh],"0x"+e[2]]))}}if(null!=r.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 BY(Q$([[r.p2sh],"0x"+e[2]]))}}if(null!=r.prefix){const e=n[1];let t=n[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&n.length===2+e&&e>=1&&e<=75){const e=pY.toWords(n.slice(2));return e.unshift(t),pY.encode(r.prefix,e)}}return null}getAddress(e){return AY(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||e===gG?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===P$.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",CY(e));if(null==t||"0x"===t)return null;const r=this._getAddress(e,t);return null==r&&xY.throwError("invalid or unsupported coin data",P$.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r}))}getAvatar(){return AY(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 r=0;re[t]))}return xY.throwError("invalid or unsupported content hash data",P$.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return AY(this,void 0,void 0,(function*(){let t=kG(e);t=Q$([CY(64),CY(t.length),t]),t.length%32!=0&&(t=Q$([t,lH("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",iH(t));return null==r||"0x"===r?null:IG(r)}))}}let HY=null,GY=1;class qY extends sG{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),O$(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=M$(new.target,"getNetwork")(e);t?(O$(this,"_network",t),this.emit("network",t,null)):xY.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return AY(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||xY.throwError("no network detected",P$.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:O$(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return iY((()=>this._ready().then((e=>e),(e=>{if(e.code!==P$.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==HY&&(HY=new gY),HY}static getNetwork(e){return WZ(null==e?"homestead":e)}ccipReadFetch(e,t,r){return AY(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===r.length)return null;const n=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let e=0;e=0?null:JSON.stringify({data:i,sender:n}),c=yield nY({url:a,errorPassThrough:!0},s,((e,t)=>(e.status=t.statusCode,e)));if(c.data)return c.data;const u=c.message||"unknown error";if(c.status>=400&&c.status<500)return xY.throwError(`response not found during CCIP fetch: ${u}`,P$.errors.SERVER_ERROR,{url:t,errorMessage:u});o.push(u)}return xY.throwError(`error encountered during CCIP fetch: ${o.map((e=>JSON.stringify(e))).join(", ")}`,P$.errors.SERVER_ERROR,{urls:r,errorMessages:o})}))}_getInternalBlockNumber(e){return AY(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const r=yield t;if(PY()-r.respTime<=e)return r.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=PY(),r=C$({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:n})=>{if(n)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),n;const i=PY();return(e=EH.from(e).toNumber()){this._internalBlockNumber===r&&(this._internalBlockNumber=null)})),(yield r).blockNumber}))}poll(){return AY(this,void 0,void 0,(function*(){const e=GY++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)xY.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",xY.makeError("network block skew detected",P$.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let e=this._emitted.block+1;e<=r;e++)this.emit("block",e);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&r-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=r-1),this._events.forEach((e=>{switch(e.type){case"tx":{const r=e.hash;let n=this.getTransactionReceipt(r).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+r]=e.blockNumber,this.emit(r,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(n);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=r-1);const n=e.filter;n.fromBlock=e._lastBlockNumber+1,n.toBlock=r;const i=n.toBlock-this._maxFilterBlockRange;i>n.fromBlock&&(n.fromBlock=i),n.fromBlock<0&&(n.fromBlock=0);const o=this.getLogs(n).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(n,t)}))})).catch((t=>{this.emit("error",t),e._inflight=!1}));t.push(o)}}})),this._lastBlockNumber=r,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 AY(this,void 0,void 0,(function*(){return xY.throwError("provider does not support network detection",P$.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return AY(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 IY(0),this._network;const r=xY.makeError("underlying network changed",P$.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}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=PY();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&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return AY(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,r||0,null)}))}_waitForTransaction(e,t,r,n){return AY(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 c=function(){return!!s||(s=!0,a.forEach((e=>{e()})),!1)},u=e=>{e.confirmations{this.removeListener(e,u)})),n){let r=n.startBlock,i=null;const u=a=>AY(this,void 0,void 0,(function*(){s||(yield IY(1e3),this.getTransactionCount(n.from).then((l=>AY(this,void 0,void 0,(function*(){if(!s){if(l<=n.nonce)r=a;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=r-3,i{s||this.once("block",u)})))}));if(s)return;this.once("block",u),a.push((()=>{this.removeListener("block",u)}))}if("number"==typeof r&&r>0){const e=setTimeout((()=>{c()||o(xY.makeError("timeout exceeded",P$.errors.TIMEOUT,{timeout:r}))}),r);e.unref&&e.unref(),a.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return AY(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return AY(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return EH.from(e)}catch(t){return xY.throwError("bad result from backend",P$.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return AY(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield C$({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getBalance",r);try{return EH.from(n)}catch(e){return xY.throwError("bad result from backend",P$.errors.SERVER_ERROR,{method:"getBalance",params:r,result:n,error:e})}}))}getTransactionCount(e,t){return AY(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield C$({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getTransactionCount",r);try{return EH.from(n).toNumber()}catch(e){return xY.throwError("bad result from backend",P$.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:n,error:e})}}))}getCode(e,t){return AY(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield C$({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),n=yield this.perform("getCode",r);try{return iH(n)}catch(e){return xY.throwError("bad result from backend",P$.errors.SERVER_ERROR,{method:"getCode",params:r,result:n,error:e})}}))}getStorageAt(e,t,r){return AY(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield C$({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((e=>cH(e)))}),i=yield this.perform("getStorageAt",n);try{return iH(i)}catch(e){return xY.throwError("bad result from backend",P$.errors.SERVER_ERROR,{method:"getStorageAt",params:n,result:i,error:e})}}))}_wrapTransaction(e,t,r){if(null!=t&&32!==oH(t))throw new Error("invalid response - sendTransaction");const n=e;return null!=t&&e.hash!==t&&xY.throwError("Transaction hash mismatch from Provider.sendTransaction.",P$.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),n.wait=(t,n)=>AY(this,void 0,void 0,(function*(){let i;null==t&&(t=1),null==n&&(n=0),0!==t&&null!=r&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const o=yield this._waitForTransaction(e.hash,t,n,i);return null==o&&0===t?null:(this._emitted["t:"+e.hash]=o.blockNumber,0===o.status&&xY.throwError("transaction failed",P$.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:o}),o)})),n}sendTransaction(e){return AY(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>iH(e))),r=this.formatter.transaction(e);null==r.confirmations&&(r.confirmations=0);const n=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,e,n)}catch(e){throw e.transaction=r,e.transactionHash=r.hash,e}}))}_getTransactionRequest(e){return AY(this,void 0,void 0,(function*(){const t=yield e,r={};return["from","to"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?EH.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(r[e]=Promise.resolve(t[e]).then((e=>e?iH(e):null)))})),this.formatter.transactionRequest(yield C$(r))}))}_getFilter(e){return AY(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((r=>{null!=e[r]&&(t[r]=e[r])})),["fromBlock","toBlock"].forEach((r=>{null!=e[r]&&(t[r]=this._getBlockTag(e[r]))})),this.formatter.filter(yield C$(t))}))}_call(e,t,r){return AY(this,void 0,void 0,(function*(){r>=10&&xY.throwError("CCIP read exceeded maximum redirections",P$.errors.SERVER_ERROR,{redirects:r,transaction:e});const n=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&"latest"===t&&null!=n&&"0x556f1830"===i.substring(0,10)&&oH(i)%32==4)try{const o=aH(i,4),a=aH(o,0,32);EH.from(a).eq(n)||xY.throwError("CCIP Read sender did not match",P$.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const s=[],c=EH.from(aH(o,32,64)).toNumber(),u=EH.from(aH(o,c,c+32)).toNumber(),l=aH(o,c+32);for(let t=0;tAY(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",n);if(null==e)return null!=n.blockHash&&null==this._emitted["b:"+n.blockHash]||null!=n.blockTag&&r>this._emitted.block?null:void 0;if(t){let t=null;for(let r=0;rthis._wrapTransaction(e))),r}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return AY(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return iY((()=>AY(this,void 0,void 0,(function*(){const r=yield this.perform("getTransaction",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;const n=this.formatter.transactionResponse(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return this._wrapTransaction(n)}))),{oncePoll:this})}))}getTransactionReceipt(e){return AY(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return iY((()=>AY(this,void 0,void 0,(function*(){const r=yield this.perform("getTransactionReceipt",t);if(null==r)return null==this._emitted["t:"+e]?null:void 0;if(null==r.blockHash)return;const n=this.formatter.receipt(r);if(null==n.blockNumber)n.confirmations=0;else if(null==n.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-n.blockNumber+1;e<=0&&(e=1),n.confirmations=e}return n}))),{oncePoll:this})}))}getLogs(e){return AY(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield C$({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach((e=>{null==e.removed&&(e.removed=!1)})),gY.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)}))}getEtherPrice(){return AY(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return AY(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&xY.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 AY(this,void 0,void 0,(function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const r=yield this._getResolver(t,"getResolver");if(null!=r){const n=new $Y(this,r,e);return t===e||(yield n.supportsWildcard())?n:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return AY(this,void 0,void 0,(function*(){null==t&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||xY.throwError("network does not support ENS",P$.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const t=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+bq(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null}))}resolveName(e){return AY(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(rH(e))throw t}"string"!=typeof e&&xY.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return AY(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(null==r)return null;const n=FY(yield this.call({to:r,data:"0x691f3431"+bq(t).substring(2)}),0);return(yield this.resolveName(n))!=e?null:n}))}getAvatar(e){return AY(this,void 0,void 0,(function*(){let t=null;if(rH(e)){const r=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"getAvatar");if(!n)return null;t=new $Y(this,n,r);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==P$.errors.CALL_EXCEPTION)throw e}try{const e=FY(yield this.call({to:n,data:"0x691f3431"+bq(r).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==P$.errors.CALL_EXCEPTION)throw e;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return null==r?null:r.url}))}perform(e,t){return xY.throwError(e+" not implemented",P$.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,r){const n=new OY(SY(e),t,r);return this._events.push(n),this._startEvent(n),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,n=[],i=SY(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),r=!0,!e.once||(n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),r}listenerCount(e){if(!e)return this._events.length;let t=SY(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=SY(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const r=[];let n=!1,i=SY(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!n||(n=!0,r.push(e),!1)))),r.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const r=SY(e);this._events=this._events.filter((e=>e.tag!==r||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var KY=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const VY=new P$(mY),WY=["call","estimateGas"];function JY(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const r=rH(e.data)?e.data:null;if(!t||r)return{message:e.message,data:r}}if("object"==typeof e){for(const r in e){const n=JY(e[r],t);if(n)return n}return null}if("string"==typeof e)try{return JY(JSON.parse(e),t)}catch(e){}return null}function ZY(e,t,r){const n=r.transaction||r.signedTransaction;if("call"===e){const e=JY(t,!0);if(e)return e.data;VY.throwError("missing revert data in call exception; Transaction reverted without a reason string",P$.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:t})}if("estimateGas"===e){let r=JY(t.body,!1);null==r&&(r=JY(t,!1)),r&&VY.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",P$.errors.UNPREDICTABLE_GAS_LIMIT,{reason:r.message,method:e,transaction:n,error:t})}let i=t.message;throw t.code===P$.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)&&VY.throwError("insufficient funds for intrinsic transaction cost",P$.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:n}),i.match(/nonce (is )?too low/i)&&VY.throwError("nonce has already been used",P$.errors.NONCE_EXPIRED,{error:t,method:e,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&VY.throwError("replacement fee too low",P$.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:n}),i.match(/only replay-protected/i)&&VY.throwError("legacy pre-eip-155 transactions not supported",P$.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:n}),WY.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&VY.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",P$.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function YY(e){return new Promise((function(t){setTimeout(t,e)}))}function XY(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 QY(e){return e?e.toLowerCase():e}const eX={};class tX extends G${constructor(e,t,r){if(super(),e!==eX)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");O$(this,"provider",t),null==r&&(r=0),"string"==typeof r?(O$(this,"_address",this.provider.formatter.address(r)),O$(this,"_index",null)):"number"==typeof r?(O$(this,"_index",r),O$(this,"_address",null)):VY.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return VY.throwError("cannot alter JSON-RPC Signer connection",P$.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new rX(eX,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&&VY.throwError("unknown account #"+this._index,P$.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=N$(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const r=N$(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>KY(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&VY.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),C$({tx:C$(e),sender:t}).then((({tx:t,sender:r})=>{null!=t.from?t.from.toLowerCase()!==r&&VY.throwArgumentError("from address mismatch","transaction",e):t.from=r;const n=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[n]).then((e=>e),(e=>("string"==typeof e.message&&e.message.match(/user denied/i)&&VY.throwError("user rejected transaction",P$.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),ZY("sendTransaction",e,n))))}))}signTransaction(e){return VY.throwError("signing transactions is unsupported",P$.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return KY(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield iY((()=>KY(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(r);if(null!==e)return this.provider._wrapTransaction(e,r,t)}))),{oncePoll:this.provider})}catch(e){throw e.transactionHash=r,e}}))}signMessage(e){return KY(this,void 0,void 0,(function*(){const t="string"==typeof e?kG(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[iH(t),r.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&VY.throwError("user rejected signing",P$.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),t}}))}_legacySignMessage(e){return KY(this,void 0,void 0,(function*(){const t="string"==typeof e?kG(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),iH(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&VY.throwError("user rejected signing",P$.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),t}}))}_signTypedData(e,t,r){return KY(this,void 0,void 0,(function*(){const n=yield Rq.resolveNames(e,t,r,(e=>this.provider.resolveName(e))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(Rq.getPayload(n.domain,t,n.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&VY.throwError("user rejected signing",P$.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:n.domain,types:t,value:n.value}}),e}}))}unlock(e){return KY(this,void 0,void 0,(function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])}))}}class rX extends tX{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 nX={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class iX extends qY{constructor(e,t){let r=t;null==r&&(r=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(r),e||(e=M$(this.constructor,"defaultUrl")()),O$(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(N$(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 KY(this,void 0,void 0,(function*(){yield YY(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=M$(this.constructor,"getNetwork");try{return t(EH.from(e).toNumber())}catch(t){return VY.throwError("could not detect network",P$.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return VY.throwError("could not detect network",P$.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new tX(eX,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 r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:U$(r),provider:this});const n=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(n&&this._cache[e])return this._cache[e];const i=nY(this.connection,JSON.stringify(r),XY).then((e=>(this.emit("debug",{action:"response",request:r,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:r,provider:this}),e}));return n&&(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",[QY(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[QY(t.address),t.blockTag]];case"getCode":return["eth_getCode",[QY(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[QY(t.address),lH(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",[M$(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[M$(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=QY(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return KY(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&EH.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const r=yield this.getFeeData();null==r.maxFeePerGas&&null==r.maxPriorityFeePerGas&&((t=N$(t)).transaction=N$(e),delete t.transaction.type)}}const r=this.prepareRequest(e,t);null==r&&VY.throwError(e+" not implemented",P$.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(r){return ZY(e,r,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(r){return function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;let n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return YY(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){n()}),0),null;e.send("eth_uninstallFilter",[r])})).catch((e=>{}))}(),r})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=N$(nX);if(t)for(const e in t)t[e]&&(r[e]=!0);B$(e,r);const n={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const r=cH(EH.from(e[t]));"gasLimit"===t&&(t="gas"),n[t]=r})),["from","to","data"].forEach((function(t){null!=e[t]&&(n[t]=iH(e[t]))})),e.accessList&&(n.accessList=HK(e.accessList)),n}}let oX=null;try{if(oX=WebSocket,null==oX)throw new Error("inject please")}catch(Vre){const e=new P$(mY);oX=function(){e.throwError("WebSockets not supported in this environment",P$.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var aX=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const sX=new P$(mY);let cX=1;class uX extends iX{constructor(e,t){"any"===t&&sX.throwError("WebSocketProvider does not support 'any' network yet",P$.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),super("string"==typeof e?e:"_websocket",t),this._pollingInterval=-1,this._wsReady=!1,O$(this,"_websocket","string"==typeof e?new oX(this.connection.url):e),O$(this,"_requests",{}),O$(this,"_subs",{}),O$(this,"_subIds",{}),O$(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach((e=>{this.websocket.send(this._requests[e].payload)}))},this.websocket.onmessage=e=>{const t=e.data,r=JSON.parse(t);if(null!=r.id){const e=String(r.id),n=this._requests[e];if(delete this._requests[e],void 0!==r.result)n.callback(null,r.result),this.emit("debug",{action:"response",request:JSON.parse(n.payload),response:r.result,provider:this});else{let e=null;r.error?(e=new Error(r.error.message||"unknown error"),O$(e,"code",r.error.code||null),O$(e,"response",t)):e=new Error("unknown error"),n.callback(e,void 0),this.emit("debug",{action:"response",error:e,request:JSON.parse(n.payload),provider:this})}}else if("eth_subscription"===r.method){const e=this._subs[r.params.subscription];e&&e.processFunc(r.params.result)}else console.warn("this should not happen")};const r=setInterval((()=>{this.emit("poll")}),1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){sX.throwError("cannot reset events block on WebSocketProvider",P$.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){sX.throwError("cannot set polling interval on WebSocketProvider",P$.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return aX(this,void 0,void 0,(function*(){return null}))}set polling(e){e&&sX.throwError("cannot set polling on WebSocketProvider",P$.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=cX++;return new Promise(((n,i)=>{const o=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(o),provider:this}),this._requests[String(r)]={callback:function(e,t){return e?i(e):n(t)},payload:o},this._wsReady&&this.websocket.send(o)}))}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,r){return aX(this,void 0,void 0,(function*(){let n=this._subIds[e];null==n&&(n=Promise.all(t).then((e=>this.send("eth_subscribe",e))),this._subIds[e]=n);const i=yield n;this._subs[i]={tag:e,processFunc:r}}))}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],(e=>{const t=EH.from(e.number).toNumber();this._emitted.block=t,this.emit("block",t)}));break;case"pending":this._subscribe("pending",["newPendingTransactions"],(e=>{this.emit("pending",e)}));break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],(t=>{null==t.removed&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))}));break;case"tx":{const t=e=>{const t=e.hash;this.getTransactionReceipt(t).then((e=>{e&&this.emit(t,e)}))};t(e),this._subscribe("tx",["newHeads"],(e=>{this._events.filter((e=>"tx"===e.type)).forEach(t)}));break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e)}}_stopEvent(e){let t=e.tag;if("tx"===e.type){if(this._events.filter((e=>"tx"===e.type)).length)return;t="tx"}else if(this.listenerCount(e.event))return;const r=this._subIds[t];r&&(delete this._subIds[t],r.then((e=>{this._subs[e]&&(delete this._subs[e],this.send("eth_unsubscribe",[e]))})))}destroy(){return aX(this,void 0,void 0,(function*(){this.websocket.readyState===oX.CONNECTING&&(yield new Promise((e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}}))),this.websocket.close(1e3)}))}}var lX=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const fX=new P$(mY);class dX extends iX{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return lX(this,void 0,void 0,(function*(){let t=this.network;return null==t&&(t=yield e.detectNetwork.call(this),t||fX.throwError("no network detected",P$.errors.UNKNOWN_ERROR,{}),null==this._network&&(O$(this,"_network",t),this.emit("network",t,null))),t}))}}class hX extends dX{constructor(e,t){fX.checkAbstract(new.target,hX),e=M$(new.target,"getNetwork")(e),t=M$(new.target,"getApiKey")(t);super(M$(new.target,"getUrl")(e,t),e),"string"==typeof t?O$(this,"apiKey",t):null!=t&&Object.keys(t).forEach((e=>{O$(this,e,t[e])}))}_startPending(){fX.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return fX.throwError("API provider does not support signing",P$.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return fX.throwError("not implemented; sub-classes must override getUrl",P$.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const pX=new P$(mY),mX="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class bX extends uX{constructor(e,t){const r=new gX(e,t);super(r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi."),r.network),O$(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===mX}}class gX extends hX{static getWebSocketProvider(e,t){return new bX(e,t)}static getApiKey(e){return null==e?mX:(e&&"string"!=typeof e&&pX.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:pX.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(e,r)=>(t===mX&&EY(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===mX}}const yX=new P$(mY),vX="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function wX(e){switch(e){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return yX.throwArgumentError("unsupported network","name",e)}class EX extends hX{isCommunityResource(){return this.apiKey===vX}static getApiKey(e){return null==e?vX:e}static getUrl(e,t){null==t&&(t=vX);const r={allowGzip:!0,url:"https://"+wX(e.name)+t,throttleCallback:(e,r)=>(t.apiKey===vX&&EY(),Promise.resolve(!0))};return null!=t.projectSecret&&(r.user="",r.password=t.projectSecret),r}}var AX=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const xX=new P$(mY);class _X extends hX{static getApiKey(e){return null!=e&&xX.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;if("homestead"===e.name)r="https://cloudflare-eth.com/";else xX.throwArgumentError("unsupported network","network",arguments[0]);return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return AX(this,void 0,void 0,(function*(){if("getBlockNumber"===e){return(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number}return r.perform.call(this,e,t)}))}}var kX=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const SX=new P$(mY);function PX(e){const t={};for(let r in e){if(null==e[r])continue;let n=e[r];"type"===r&&0===n||(n={type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?cH(iH(n)):"accessList"===r?"["+HK(n).map((e=>`{address:"${e.address}",storageKeys:["${e.storageKeys.join('","')}"]}`)).join(",")+"]":iH(n),t[r]=n)}return t}function IX(e){if(0==e.status&&("No records found"===e.message||"No transactions found"===e.message))return e.result;if(1!=e.status||"string"!=typeof e.message||!e.message.match(/^OK/)){const t=new Error("invalid response");throw t.result=JSON.stringify(e),(e.result||"").toLowerCase().indexOf("rate limit")>=0&&(t.throttleRetry=!0),t}return e.result}function TX(e){if(e&&0==e.status&&"NOTOK"==e.message&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){const t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if("2.0"!=e.jsonrpc){const t=new Error("invalid response");throw t.result=JSON.stringify(e),t}if(e.error){const t=new Error(e.error.message||"unknown error");throw e.error.code&&(t.code=e.error.code),e.error.data&&(t.data=e.error.data),t}return e.result}function OX(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}function MX(e,t,r){if("call"===e&&t.code===P$.errors.SERVER_ERROR){const e=t.error;if(e&&(e.message.match(/reverted/i)||e.message.match(/VM execution error/i))){let r=e.data;if(r&&(r="0x"+r.replace(/^.*0x/i,"")),rH(r))return r;SX.throwError("missing revert data in call exception",P$.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}let n=t.message;throw t.code===P$.errors.SERVER_ERROR&&(t.error&&"string"==typeof t.error.message?n=t.error.message:"string"==typeof t.body?n=t.body:"string"==typeof t.responseText&&(n=t.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&SX.throwError("insufficient funds for intrinsic transaction cost",P$.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&SX.throwError("nonce has already been used",P$.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),n.match(/another transaction with same nonce/)&&SX.throwError("replacement fee too low",P$.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&SX.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",P$.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}class CX extends qY{constructor(e,t){super(e),O$(this,"baseUrl",this.getBaseUrl()),O$(this,"apiKey",t||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return SX.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,t){const r=Object.keys(t).reduce(((e,r)=>{const n=t[r];return null!=n&&(e+=`&${r}=${n}`),e}),""),n=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${r}${n}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,t){return t.module=e,t.apikey=this.apiKey,t}fetch(e,t,r){return kX(this,void 0,void 0,(function*(){const n=r?this.getPostUrl():this.getUrl(e,t),i=r?this.getPostData(e,t):null,o="proxy"===e?TX:IX;this.emit("debug",{action:"request",request:n,provider:this});const a={url:n,throttleSlotInterval:1e3,throttleCallback:(e,t)=>(this.isCommunityResource()&&EY(),Promise.resolve(!0))};let s=null;i&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},s=Object.keys(i).map((e=>`${e}=${i[e]}`)).join("&"));const c=yield nY(a,s,o||TX);return this.emit("debug",{action:"response",request:n,response:U$(c),provider:this}),c}))}detectNetwork(){return kX(this,void 0,void 0,(function*(){return this.network}))}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return kX(this,void 0,void 0,(function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch((e=>MX("sendTransaction",e,t.signedTransaction)));case"getBlock":if(t.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash});case"call":{if("latest"!==t.blockTag)throw new Error("EtherscanProvider does not support blockTag for call");const e=PX(t.transaction);e.module="proxy",e.action="eth_call";try{return yield this.fetch("proxy",e,!0)}catch(e){return MX("call",e,t.transaction)}}case"estimateGas":{const e=PX(t.transaction);e.module="proxy",e.action="eth_estimateGas";try{return yield this.fetch("proxy",e,!0)}catch(e){return MX("estimateGas",e,t.transaction)}}case"getLogs":{const e={action:"getLogs"};if(t.filter.fromBlock&&(e.fromBlock=OX(t.filter.fromBlock)),t.filter.toBlock&&(e.toBlock=OX(t.filter.toBlock)),t.filter.address&&(e.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&SX.throwError("unsupported topic count",P$.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),1===t.filter.topics.length)){const r=t.filter.topics[0];"string"==typeof r&&66===r.length||SX.throwError("unsupported topic format",P$.errors.UNSUPPORTED_OPERATION,{topic0:r}),e.topic0=r}const r=yield this.fetch("logs",e);let n={};for(let e=0;e{["contractAddress","to"].forEach((function(t){""==e[t]&&delete e[t]})),null==e.creates&&null!=e.contractAddress&&(e.creates=e.contractAddress);const t=this.formatter.transactionResponse(e);return e.timeStamp&&(t.timestamp=parseInt(e.timeStamp)),t}))}))}isCommunityResource(){return null==this.apiKey}}var BX=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const NX=new P$(mY);function RX(){return(new Date).getTime()}function FX(e){let t=null;for(let r=0;rt?null:(n+i)/2}function UX(e){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return JSON.stringify(e);if("string"==typeof e)return e;if(EH.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map((e=>UX(e))));if("object"==typeof e){const t=Object.keys(e);return t.sort(),"{"+t.map((t=>{let r=e[t];return r="function"==typeof r?"[function]":UX(r),JSON.stringify(t)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}let jX=1;function DX(e){let t=null,r=null,n=new Promise((n=>{t=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(t,e)}));return{cancel:t,getPromise:function(){return n},wait:e=>(n=n.then(e),n)}}const zX=[P$.errors.CALL_EXCEPTION,P$.errors.INSUFFICIENT_FUNDS,P$.errors.NONCE_EXPIRED,P$.errors.REPLACEMENT_UNDERPRICED,P$.errors.UNPREDICTABLE_GAS_LIMIT],$X=["address","args","errorArgs","errorSignature","method","transaction"];function HX(e,t){const r={weight:e.weight};return Object.defineProperty(r,"provider",{get:()=>e.provider}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function GX(e,t,r){let n=UX;switch(t){case"getBlockNumber":return function(t){const r=t.map((e=>e.result));let n=LX(t.map((e=>e.result)),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=e._highestBlockNumber&&(e._highestBlockNumber=n),e._highestBlockNumber};case"getGasPrice":return function(e){const t=e.map((e=>e.result));return t.sort(),t[Math.floor(t.length/2)]};case"getEtherPrice":return function(e){return LX(e.map((e=>e.result)))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(e){return null==e?null:((e=N$(e)).confirmations=-1,UX(e))};break;case"getBlock":n=r.includeTransactions?function(e){return null==e?null:((e=N$(e)).transactions=e.transactions.map((e=>((e=N$(e)).confirmations=-1,e))),UX(e))}:function(e){return null==e?null:UX(e)};break;default:throw new Error("unknown method: "+t)}return function(e,t){return function(r){const n={};r.forEach((t=>{const r=e(t.result);n[r]||(n[r]={count:0,result:t.result}),n[r].count++}));const i=Object.keys(n);for(let e=0;e=t)return r.result}}}(n,e.quorum)}function qX(e,t){return BX(this,void 0,void 0,(function*(){const r=e.provider;return null!=r.blockNumber&&r.blockNumber>=t||-1===t?r:iY((()=>new Promise(((n,i)=>{setTimeout((function(){return r.blockNumber>=t?n(r):e.cancelled?n(null):n(void 0)}),0)}))),{oncePoll:r})}))}function KX(e,t,r,n){return BX(this,void 0,void 0,(function*(){let i=e.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&rH(n.blockTag)&&(i=yield qX(e,t)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&rH(n.blockTag)&&(i=yield qX(e,t)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&rH(n.blockTag)&&(i=yield qX(e,t)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&rH(n.blockTag)&&(i=yield qX(e,t)),"call"===r&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let r=n.filter;return(r.fromBlock&&rH(r.fromBlock)||r.toBlock&&rH(r.toBlock))&&(i=yield qX(e,t)),i.getLogs(r)}}return NX.throwError("unknown method error",P$.errors.UNKNOWN_ERROR,{method:r,params:n})}))}class VX extends qY{constructor(e,t){0===e.length&&NX.throwArgumentError("missing providers","providers",e);const r=e.map(((e,t)=>{if(sG.isProvider(e)){const t=vY(e)?2e3:750,r=1;return Object.freeze({provider:e,weight:1,stallTimeout:t,priority:r})}const r=N$(e);null==r.priority&&(r.priority=1),null==r.stallTimeout&&(r.stallTimeout=vY(e)?2e3:750),null==r.weight&&(r.weight=1);const n=r.weight;return(n%1||n>512||n<1)&&NX.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${t}].weight`,n),Object.freeze(r)})),n=r.reduce(((e,t)=>e+t.weight),0);null==t?t=n/2:t>n&&NX.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let i=FX(r.map((e=>e.provider.network)));null==i&&(i=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then(e,t)}),0)}))),super(i),O$(this,"providerConfigs",Object.freeze(r)),O$(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return BX(this,void 0,void 0,(function*(){return FX(yield Promise.all(this.providerConfigs.map((e=>e.provider.getNetwork()))))}))}perform(e,t){return BX(this,void 0,void 0,(function*(){if("sendTransaction"===e){const e=yield Promise.all(this.providerConfigs.map((e=>e.provider.sendTransaction(t.signedTransaction).then((e=>e.hash),(e=>e)))));for(let t=0;te.priority-t.priority));const i=this._highestBlockNumber;let o=0,a=!0;for(;;){const s=RX();let c=n.filter((e=>e.runner&&s-e.starte+t.weight),0);for(;c{r.staller=null})),r.runner=KX(r,i,e,t).then((n=>{r.done=!0,r.result=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:a,backend:HX(r,RX()),request:{method:e,params:U$(t)},provider:this})}),(n=>{r.done=!0,r.error=n,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:a,backend:HX(r,RX()),request:{method:e,params:U$(t)},provider:this})})),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:a,backend:HX(r,null),request:{method:e,params:U$(t)},provider:this}),c+=r.weight}const u=[];n.forEach((e=>{!e.done&&e.runner&&(u.push(e.runner),e.staller&&u.push(e.staller.getPromise()))})),u.length&&(yield Promise.race(u));const l=n.filter((e=>e.done&&null==e.error));if(l.length>=this.quorum){const e=r(l);if(void 0!==e)return n.forEach((e=>{e.staller&&e.staller.cancel(),e.cancelled=!0})),e;a||(yield DX(100).getPromise()),a=!1}const f=n.reduce(((e,t)=>{if(!t.done||null==t.error)return e;const r=t.error.code;return zX.indexOf(r)>=0&&(e[r]||(e[r]={error:t.error,weight:0}),e[r].weight+=t.weight),e}),{});if(Object.keys(f).forEach((e=>{const t=f[e];if(t.weight{e.staller&&e.staller.cancel(),e.cancelled=!0}));const r=t.error,i={};$X.forEach((e=>{null!=r[e]&&(i[e]=r[e])})),NX.throwError(r.reason||r.message,e,i)})),0===n.filter((e=>!e.done)).length)break}return n.forEach((e=>{e.staller&&e.staller.cancel(),e.cancelled=!0})),NX.throwError("failed to meet quorum",P$.errors.SERVER_ERROR,{method:e,params:t,results:n.map((e=>HX(e))),provider:this})}))}}const WX=new P$(mY),JX="84842078b09946638c03157f83405213";class ZX extends uX{constructor(e,t){const r=new YX(e,t),n=r.connection;n.password&&WX.throwError("INFURA WebSocket project secrets unsupported",P$.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});super(n.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/"),e),O$(this,"apiKey",r.projectId),O$(this,"projectId",r.projectId),O$(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===JX}}class YX extends hX{static getWebSocketProvider(e,t){return new ZX(e,t)}static getApiKey(e){const t={apiKey:JX,projectId:JX,projectSecret:null};return null==e||("string"==typeof e?t.projectId=e:null!=e.projectSecret?(WX.assertArgument("string"==typeof e.projectId,"projectSecret requires a projectId","projectId",e.projectId),WX.assertArgument("string"==typeof e.projectSecret,"invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;default:WX.throwError("unsupported network",P$.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const n={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(e,r)=>(t.projectId===JX&&EY(),Promise.resolve(!0))};return null!=t.projectSecret&&(n.user="",n.password=t.projectSecret),n}isCommunityResource(){return this.projectId===JX}}const XX=new P$(mY);class QX extends hX{static getApiKey(e){return e&&"string"!=typeof e&&XX.throwArgumentError("invalid apiKey","apiKey",e),e||"ETHERS_JS_SHARED"}static getUrl(e,t){XX.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:XX.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const eQ=new P$(mY),tQ="62e1ad51b37b8e00394bda3b";class rQ extends hX{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return null==e?t.applicationId=tQ:"string"==typeof e?t.applicationId=e:null!=e.applicationSecretKey?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:eQ.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:eQ.throwError("unsupported network",P$.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const n={headers:{},url:`https://${r}/v1/lb/${t.applicationId}`};return null!=t.applicationSecretKey&&(n.user="",n.password=t.applicationSecretKey),n}isCommunityResource(){return this.applicationId===tQ}}const nQ=new P$(mY);let iQ=1;function oQ(e,t){const r="Web3LegacyFetcher";return function(e,n){const i={method:e,params:n,id:iQ++,jsonrpc:"2.0"};return new Promise(((e,n)=>{this.emit("debug",{action:"request",fetcher:r,request:U$(i),provider:this}),t(i,((t,o)=>{if(t)return this.emit("debug",{action:"response",fetcher:r,error:t,request:i,provider:this}),n(t);if(this.emit("debug",{action:"response",fetcher:r,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,n(e)}e(o.result)}))}))}}class aQ extends iX{constructor(e,t){null==e&&nQ.throwArgumentError("missing provider","provider",e);let r=null,n=null,i=null;"function"==typeof e?(r="unknown:",n=e):(r=e.host||e.path||"",!r&&e.isMetaMask&&(r="metamask"),i=e,e.request?(""===r&&(r="eip-1193:"),n=function(e){return function(t,r){null==r&&(r=[]);const n={method:t,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:U$(n),provider:this}),e.request(n).then((e=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:e,provider:this}),e}))}}(e)):e.sendAsync?n=oQ(0,e.sendAsync.bind(e)):e.send?n=oQ(0,e.send.bind(e)):nQ.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),O$(this,"jsonRpcFetchFunc",n),O$(this,"provider",i)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const sQ=new P$(mY);function cQ(e,t){if(null==e&&(e="homestead"),"string"==typeof e){const t=e.match(/^(ws|http)s?:/i);if(t)switch(t[1].toLowerCase()){case"http":case"https":return new iX(e);case"ws":case"wss":return new uX(e);default:sQ.throwArgumentError("unsupported URL scheme","network",e)}}const r=WZ(e);return r&&r._defaultProvider||sQ.throwError("unsupported getDefaultProvider network",P$.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:e}),r._defaultProvider({FallbackProvider:VX,AlchemyProvider:gX,AnkrProvider:EX,CloudflareProvider:_X,EtherscanProvider:CX,InfuraProvider:YX,JsonRpcProvider:iX,NodesmithProvider:QX,PocketProvider:rQ,Web3Provider:aQ,IpcProvider:null},t)}var uQ=Object.freeze({__proto__:null,AlchemyProvider:gX,AlchemyWebSocketProvider:bX,AnkrProvider:EX,BaseProvider:qY,CloudflareProvider:_X,EtherscanProvider:CX,FallbackProvider:VX,Formatter:gY,InfuraProvider:YX,InfuraWebSocketProvider:ZX,IpcProvider:null,JsonRpcBatchProvider:class extends iX{send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const n={request:r,resolve:null,reject:null},i=new Promise(((e,t)=>{n.resolve=e,n.reject=t}));return this._pendingBatch.push(n),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const e=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const t=e.map((e=>e.request));return this.emit("debug",{action:"requestBatch",request:U$(t),provider:this}),nY(this.connection,JSON.stringify(t)).then((r=>{this.emit("debug",{action:"response",request:t,response:r,provider:this}),e.forEach(((e,t)=>{const n=r[t];if(n.error){const t=new Error(n.error.message);t.code=n.error.code,t.data=n.error.data,e.reject(t)}else e.resolve(n.result)}))}),(r=>{this.emit("debug",{action:"response",error:r,request:t,provider:this}),e.forEach((e=>{e.reject(r)}))}))}),10)),i}},JsonRpcProvider:iX,JsonRpcSigner:tX,NodesmithProvider:QX,PocketProvider:rQ,Provider:sG,Resolver:$Y,StaticJsonRpcProvider:dX,UrlJsonRpcProvider:hX,Web3Provider:aQ,WebSocketProvider:uX,getDefaultProvider:cQ,getNetwork:WZ,isCommunityResourcable:yY,isCommunityResource:vY,showThrottleMessage:EY});function lQ(e){const t=new aQ(e).getSigner();return{getAddress:async()=>Promise.resolve(await t.getAddress()),signMessage:async e=>await t.signMessage(e),signTypedData:async e=>YV(await t._signTypedData(e.domain,e.types,e.message))}}var fQ=function(e,t){return fQ=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},fQ(e,t)};function dQ(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}fQ(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var hQ=function(){return hQ=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function bQ(e,t){return function(r,n){t(r,n,e)}}function gQ(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function yQ(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function vQ(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function xQ(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function _Q(){for(var e=[],t=0;t1||s(e,t)}))})}function s(e,t){try{!function(e){e.value instanceof PQ?Promise.resolve(e.value.v).then(c,u):l(o[0][2],e)}(i[e](t))}catch(e){l(o[0][3],e)}}function c(e){s("next",e)}function u(e){s("throw",e)}function l(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}}function TQ(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:PQ(e[n](t)),done:!1}:i?i(t):t}:i}}function OQ(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=AQ(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,i,(t=e[r](t)).done,t.value)}))}}}function MQ(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var CQ=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function BQ(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&wQ(t,e,r);return CQ(t,e),t}function NQ(e){return e&&e.__esModule?e:{default:e}}function RQ(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function FQ(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}function LQ(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw new TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function UQ(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=t[Symbol.asyncDispose]}if(void 0===n){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=t[Symbol.dispose]}if("function"!=typeof n)throw new TypeError("Object not disposable.");e.stack.push({value:t,dispose:n,async:r})}else r&&e.stack.push({async:!0});return t}var jQ="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var n=new Error(r);return n.name="SuppressedError",n.error=e,n.suppressed=t,n};function DQ(e){function t(t){e.error=e.hasError?new jQ(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}return function r(){for(;e.stack.length;){var n=e.stack.pop();try{var i=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(i).then(r,(function(e){return t(e),r()}))}catch(e){t(e)}}if(e.hasError)throw e.error}()}var zQ,$Q={__extends:dQ,__assign:hQ,__rest:pQ,__decorate:mQ,__param:bQ,__metadata:gQ,__awaiter:yQ,__generator:vQ,__createBinding:wQ,__exportStar:EQ,__values:AQ,__read:xQ,__spread:_Q,__spreadArrays:kQ,__spreadArray:SQ,__await:PQ,__asyncGenerator:IQ,__asyncDelegator:TQ,__asyncValues:OQ,__makeTemplateObject:MQ,__importStar:BQ,__importDefault:NQ,__classPrivateFieldGet:RQ,__classPrivateFieldSet:FQ,__classPrivateFieldIn:LQ,__addDisposableResource:UQ,__disposeResources:DQ},HQ=Object.freeze({__proto__:null,__addDisposableResource:UQ,get __assign(){return hQ},__asyncDelegator:TQ,__asyncGenerator:IQ,__asyncValues:OQ,__await:PQ,__awaiter:yQ,__classPrivateFieldGet:RQ,__classPrivateFieldIn:LQ,__classPrivateFieldSet:FQ,__createBinding:wQ,__decorate:mQ,__disposeResources:DQ,__esDecorate:function(e,t,r,n,i,o){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var s,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?n.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d=!1,h=r.length-1;h>=0;h--){var p={};for(var m in n)p[m]="access"===m?{}:n[m];for(var m in n.access)p.access[m]=n.access[m];p.addInitializer=function(e){if(d)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(e||null))};var b=(0,r[h])("accessor"===c?{get:f.get,set:f.set}:f[u],p);if("accessor"===c){if(void 0===b)continue;if(null===b||"object"!=typeof b)throw new TypeError("Object expected");(s=a(b.get))&&(f.get=s),(s=a(b.set))&&(f.set=s),(s=a(b.init))&&i.unshift(s)}else(s=a(b))&&("field"===c?i.unshift(s):f[u]=s)}l&&Object.defineProperty(l,n.name,f),d=!0},__exportStar:EQ,__extends:dQ,__generator:vQ,__importDefault:NQ,__importStar:BQ,__makeTemplateObject:MQ,__metadata:gQ,__param:bQ,__propKey:function(e){return"symbol"==typeof e?e:"".concat(e)},__read:xQ,__rest:pQ,__runInitializers:function(e,t,r){for(var n=arguments.length>2,i=0;i{setTimeout((()=>{t(!0)}),e)}))}),KQ),e),t.__exportStar(function(){if(QQ)return WQ;QQ=1,Object.defineProperty(WQ,"__esModule",{value:!0}),WQ.fromMiliseconds=WQ.toMiliseconds=void 0;const e=r0();return WQ.toMiliseconds=function(t){return t*e.ONE_THOUSAND},WQ.fromMiliseconds=function(t){return Math.floor(t/e.ONE_THOUSAND)},WQ}(),e)}(qQ)),qQ}var i0,o0={};var a0,s0,c0={},u0={};function l0(){return s0||(s0=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});GQ.__exportStar((a0||(a0=1,Object.defineProperty(u0,"__esModule",{value:!0}),u0.IWatch=void 0,u0.IWatch=class{}),u0),e)}(c0)),c0}!function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=GQ;t.__exportStar(n0(),e),t.__exportStar(function(){if(i0)return o0;i0=1,Object.defineProperty(o0,"__esModule",{value:!0}),o0.Watch=void 0;class e{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const t=this.get(e);if(void 0!==t.elapsed)throw new Error(`Watch already stopped for label: ${e}`);const r=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:r})}get(e){const t=this.timestamps.get(e);if(void 0===t)throw new Error(`No timestamp found for label: ${e}`);return t}elapsed(e){const t=this.get(e);return t.elapsed||Date.now()-t.started}}return o0.Watch=e,o0.default=e,o0}(),e),t.__exportStar(l0(),e),t.__exportStar(r0(),e)}({});var f0={};function d0(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function h0(e){const t=d0(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}Object.defineProperty(f0,"__esModule",{value:!0}),f0.getLocalStorage=f0.getLocalStorageOrThrow=f0.getCrypto=f0.getCryptoOrThrow=f0.getLocation=f0.getLocationOrThrow=f0.getNavigator=f0.getNavigatorOrThrow=f0.getDocument=f0.getDocumentOrThrow=f0.getFromWindowOrThrow=f0.getFromWindow=void 0,f0.getFromWindow=d0,f0.getFromWindowOrThrow=h0,f0.getDocumentOrThrow=function(){return h0("document")},f0.getDocument=function(){return d0("document")},f0.getNavigatorOrThrow=function(){return h0("navigator")},f0.getNavigator=function(){return d0("navigator")},f0.getLocationOrThrow=function(){return h0("location")},f0.getLocation=function(){return d0("location")},f0.getCryptoOrThrow=function(){return h0("crypto")},f0.getCrypto=function(){return d0("crypto")},f0.getLocalStorageOrThrow=function(){return h0("localStorage")},f0.getLocalStorage=function(){return d0("localStorage")};var p0={};Object.defineProperty(p0,"__esModule",{value:!0}),p0.getWindowMetadata=void 0;const m0=f0;p0.getWindowMetadata=function(){let e,t;try{e=m0.getDocumentOrThrow(),t=m0.getLocationOrThrow()}catch(e){return null}function r(...t){const r=e.getElementsByTagName("meta");for(let e=0;en.getAttribute(e))).filter((e=>!!e&&t.includes(e)));if(i.length&&i){const e=n.getAttribute("content");if(e)return e}}return""}const n=function(){let t=r("name","og:site_name","og:title","twitter:title");return t||(t=e.title),t}(),i=r("description","og:description","twitter:description","keywords"),o=t.origin,a=function(){const r=e.getElementsByTagName("link"),n=[];for(let e=0;e-1){const e=i.getAttribute("href");if(e)if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{const n=t.pathname.split("/");n.pop();r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){const r=t.protocol+e;n.push(r)}else n.push(e)}}return n}();return{description:i,url:o,icons:a,name:n}};var b0=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)),g0="%[a-f0-9]{2}",y0=new RegExp("("+g0+")|([^%]+?)","gi"),v0=new RegExp("("+g0+")+","gi");function w0(e,t){try{return[decodeURIComponent(e.join(""))]}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),n=e.slice(t);return Array.prototype.concat.call([],w0(r),w0(n))}function E0(e){try{return decodeURIComponent(e)}catch(n){for(var t=e.match(y0)||[],r=1;r{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]},_0=function(e,t){for(var r={},n=Object.keys(e),i=Array.isArray(t),o=0;oNumber(e)-Number(t))).map((t=>e[t])):e}function l(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function f(e){const t=(e=l(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function d(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function h(e,t){a((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,n)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===n[e]&&(n[e]={}),n[e][t[1]]=r):n[e]=r};case"bracket":return(e,r,n)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"colon-list-separator":return(e,r,n)=>{t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),t?void 0!==n[e]?n[e]=[].concat(n[e],r):n[e]=[r]:n[e]=r};case"comma":case"separator":return(t,r,n)=>{const i="string"==typeof r&&r.includes(e.arrayFormatSeparator),o="string"==typeof r&&!i&&c(r,e).includes(e.arrayFormatSeparator);r=o?c(r,e):r;const a=i||o?r.split(e.arrayFormatSeparator).map((t=>c(t,e))):null===r?r:c(r,e);n[t]=a};case"bracket-separator":return(t,r,n)=>{const i=/(\[\])$/.test(t);if(t=t.replace(/\[\]$/,""),!i)return void(n[t]=r?c(r,e):r);const o=null===r?[]:r.split(e.arrayFormatSeparator).map((t=>c(t,e)));void 0!==n[t]?n[t]=[].concat(n[t],o):n[t]=o};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),i=Object.create(null);if("string"!=typeof e)return i;if(!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const o of e.split("&")){if(""===o)continue;let[e,a]=n(t.decode?o.replace(/\+/g," "):o,"=");a=void 0===a?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?a:c(a,t),r(c(e,t),a,i)}for(const e of Object.keys(i)){const r=i[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=d(r[e],t);else i[e]=d(r,t)}return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce(((e,t)=>{const r=i[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=u(r):e[t]=r,e}),Object.create(null))}e.extract=f,e.parse=h,e.stringify=(e,t)=>{if(!e)return"";a((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&(e=>null==e)(e[r])||t.skipEmptyString&&""===e[r],n=function(e){switch(e.arrayFormat){case"index":return t=>(r,n)=>{const i=r.length;return void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),"[",i,"]"].join("")]:[...r,[s(t,e),"[",s(i,e),"]=",s(n,e)].join("")]};case"bracket":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),"[]"].join("")]:[...r,[s(t,e),"[]=",s(n,e)].join("")];case"colon-list-separator":return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,[s(t,e),":list="].join("")]:[...r,[s(t,e),":list=",s(n,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t="bracket-separator"===e.arrayFormat?"[]=":"=";return r=>(n,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?n:(i=null===i?"":i,0===n.length?[[s(r,e),t,s(i,e)].join("")]:[[n,s(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(r,n)=>void 0===n||e.skipNull&&null===n||e.skipEmptyString&&""===n?r:null===n?[...r,s(t,e)]:[...r,[s(t,e),"=",s(n,e)].join("")]}}(t),i={};for(const t of Object.keys(e))r(t)||(i[t]=e[t]);const o=Object.keys(i);return!1!==t.sort&&o.sort(t.sort),o.map((r=>{const i=e[r];return void 0===i?"":null===i?s(r,t):Array.isArray(i)?0===i.length&&"bracket-separator"===t.arrayFormat?s(r,t)+"[]":i.reduce(n(r),[]).join("&"):s(r,t)+"="+s(i,t)})).filter((e=>e.length>0)).join("&")},e.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,i]=n(e,"#");return Object.assign({url:r.split("?")[0]||"",query:h(f(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:c(i,t)}:{})},e.stringifyUrl=(t,r)=>{r=Object.assign({encode:!0,strict:!0,[o]:!0},r);const n=l(t.url).split("?")[0]||"",i=e.extract(t.url),a=e.parse(i,{sort:!1}),c=Object.assign(a,t.query);let u=e.stringify(c,r);u&&(u=`?${u}`);let f=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(t.url);return t.fragmentIdentifier&&(f=`#${r[o]?s(t.fragmentIdentifier,r):t.fragmentIdentifier}`),`${n}${u}${f}`},e.pick=(t,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0,[o]:!1},n);const{url:a,query:s,fragmentIdentifier:c}=e.parseUrl(t,n);return e.stringifyUrl({url:a,query:i(s,r),fragmentIdentifier:c},n)},e.exclude=(t,r,n)=>{const i=Array.isArray(r)?e=>!r.includes(e):(e,t)=>!r(e,t);return e.pick(t,i,n)}}({});var k0={},S0={},P0={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mul=Math.imul||function(e,t){var r=65535&e,n=65535&t;return r*n+((e>>>16&65535)*n+r*(t>>>16&65535)<<16>>>0)|0},e.add=function(e,t){return e+t|0},e.sub=function(e,t){return e-t|0},e.rotl=function(e,t){return e<>>32-t},e.rotr=function(e,t){return e<<32-t|e>>>t},e.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(t){return e.isInteger(t)&&t>=-e.MAX_SAFE_INTEGER&&t<=e.MAX_SAFE_INTEGER}}(P0),Object.defineProperty(S0,"__esModule",{value:!0});var I0=P0;function T0(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>8,t[r+1]=e>>>0,t}function O0(e,t,r){return void 0===t&&(t=new Uint8Array(2)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t}function M0(e,t){return void 0===t&&(t=0),e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function C0(e,t){return void 0===t&&(t=0),(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function B0(e,t){return void 0===t&&(t=0),e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t]}function N0(e,t){return void 0===t&&(t=0),(e[t+3]<<24|e[t+2]<<16|e[t+1]<<8|e[t])>>>0}function R0(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>24,t[r+1]=e>>>16,t[r+2]=e>>>8,t[r+3]=e>>>0,t}function F0(e,t,r){return void 0===t&&(t=new Uint8Array(4)),void 0===r&&(r=0),t[r+0]=e>>>0,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24,t}function L0(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),R0(e/4294967296>>>0,t,r),R0(e>>>0,t,r+4),t}function U0(e,t,r){return void 0===t&&(t=new Uint8Array(8)),void 0===r&&(r=0),F0(e>>>0,t,r),F0(e/4294967296>>>0,t,r+4),t}S0.readInt16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])<<16>>16},S0.readUint16BE=function(e,t){return void 0===t&&(t=0),(e[t+0]<<8|e[t+1])>>>0},S0.readInt16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])<<16>>16},S0.readUint16LE=function(e,t){return void 0===t&&(t=0),(e[t+1]<<8|e[t])>>>0},S0.writeUint16BE=T0,S0.writeInt16BE=T0,S0.writeUint16LE=O0,S0.writeInt16LE=O0,S0.readInt32BE=M0,S0.readUint32BE=C0,S0.readInt32LE=B0,S0.readUint32LE=N0,S0.writeUint32BE=R0,S0.writeInt32BE=R0,S0.writeUint32LE=F0,S0.writeInt32LE=F0,S0.readInt64BE=function(e,t){void 0===t&&(t=0);var r=M0(e,t),n=M0(e,t+4);return 4294967296*r+n-4294967296*(n>>31)},S0.readUint64BE=function(e,t){return void 0===t&&(t=0),4294967296*C0(e,t)+C0(e,t+4)},S0.readInt64LE=function(e,t){void 0===t&&(t=0);var r=B0(e,t);return 4294967296*B0(e,t+4)+r-4294967296*(r>>31)},S0.readUint64LE=function(e,t){void 0===t&&(t=0);var r=N0(e,t);return 4294967296*N0(e,t+4)+r},S0.writeUint64BE=L0,S0.writeInt64BE=L0,S0.writeUint64LE=U0,S0.writeInt64LE=U0,S0.readUintBE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var n=0,i=1,o=e/8+r-1;o>=r;o--)n+=t[o]*i,i*=256;return n},S0.readUintLE=function(e,t,r){if(void 0===r&&(r=0),e%8!=0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>t.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var n=0,i=1,o=r;o=n;o--)r[o]=t/i&255,i*=256;return r},S0.writeUintLE=function(e,t,r,n){if(void 0===r&&(r=new Uint8Array(e/8)),void 0===n&&(n=0),e%8!=0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!I0.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var i=1,o=n;o>>16|M<<16)|0)>>>20|x<<12,_=(_^=I=I+(C=(C^=w=w+_|0)>>>16|C<<16)|0)>>>20|_<<12,k=(k^=T=T+(B=(B^=E=E+k|0)>>>16|B<<16)|0)>>>20|k<<12,S=(S^=O=O+(N=(N^=A=A+S|0)>>>16|N<<16)|0)>>>20|S<<12,k=(k^=T=T+(B=(B^=E=E+k|0)>>>24|B<<8)|0)>>>25|k<<7,S=(S^=O=O+(N=(N^=A=A+S|0)>>>24|N<<8)|0)>>>25|S<<7,_=(_^=I=I+(C=(C^=w=w+_|0)>>>24|C<<8)|0)>>>25|_<<7,x=(x^=P=P+(M=(M^=v=v+x|0)>>>24|M<<8)|0)>>>25|x<<7,_=(_^=T=T+(N=(N^=v=v+_|0)>>>16|N<<16)|0)>>>20|_<<12,k=(k^=O=O+(M=(M^=w=w+k|0)>>>16|M<<16)|0)>>>20|k<<12,S=(S^=P=P+(C=(C^=E=E+S|0)>>>16|C<<16)|0)>>>20|S<<12,x=(x^=I=I+(B=(B^=A=A+x|0)>>>16|B<<16)|0)>>>20|x<<12,S=(S^=P=P+(C=(C^=E=E+S|0)>>>24|C<<8)|0)>>>25|S<<7,x=(x^=I=I+(B=(B^=A=A+x|0)>>>24|B<<8)|0)>>>25|x<<7,k=(k^=O=O+(M=(M^=w=w+k|0)>>>24|M<<8)|0)>>>25|k<<7,_=(_^=T=T+(N=(N^=v=v+_|0)>>>24|N<<8)|0)>>>25|_<<7;D0.writeUint32LE(v+n|0,e,0),D0.writeUint32LE(w+i|0,e,4),D0.writeUint32LE(E+o|0,e,8),D0.writeUint32LE(A+a|0,e,12),D0.writeUint32LE(x+s|0,e,16),D0.writeUint32LE(_+c|0,e,20),D0.writeUint32LE(k+u|0,e,24),D0.writeUint32LE(S+l|0,e,28),D0.writeUint32LE(P+f|0,e,32),D0.writeUint32LE(I+d|0,e,36),D0.writeUint32LE(T+h|0,e,40),D0.writeUint32LE(O+p|0,e,44),D0.writeUint32LE(M+m|0,e,48),D0.writeUint32LE(C+b|0,e,52),D0.writeUint32LE(B+g|0,e,56),D0.writeUint32LE(N+y|0,e,60)}function G0(e,t,r,n,i){if(void 0===i&&(i=0),32!==e.length)throw new Error("ChaCha: key size must be 32 bytes");if(n.length>>=8,t++;if(n>0)throw new Error("ChaCha: counter overflow")}k0.streamXOR=G0,k0.stream=function(e,t,r,n){return void 0===n&&(n=0),z0.wipe(r),G0(e,t,r,r,n)};var K0={},V0={};function W0(e,t){if(e.length!==t.length)return 0;for(var r=0,n=0;n>>8}Object.defineProperty(V0,"__esModule",{value:!0}),V0.select=function(e,t,r){return~(e-1)&t|e-1&r},V0.lessOrEqual=function(e,t){return(0|e)-(0|t)-1>>>31&1},V0.compare=W0,V0.equal=function(e,t){return 0!==e.length&&0!==t.length&&0!==W0(e,t)},function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=V0,r=j0;e.DIGEST_LENGTH=16;var n=function(){function t(t){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var r=t[0]|t[1]<<8;this._r[0]=8191&r;var n=t[2]|t[3]<<8;this._r[1]=8191&(r>>>13|n<<3);var i=t[4]|t[5]<<8;this._r[2]=7939&(n>>>10|i<<6);var o=t[6]|t[7]<<8;this._r[3]=8191&(i>>>7|o<<9);var a=t[8]|t[9]<<8;this._r[4]=255&(o>>>4|a<<12),this._r[5]=a>>>1&8190;var s=t[10]|t[11]<<8;this._r[6]=8191&(a>>>14|s<<2);var c=t[12]|t[13]<<8;this._r[7]=8065&(s>>>11|c<<5);var u=t[14]|t[15]<<8;this._r[8]=8191&(c>>>8|u<<8),this._r[9]=u>>>5&127,this._pad[0]=t[16]|t[17]<<8,this._pad[1]=t[18]|t[19]<<8,this._pad[2]=t[20]|t[21]<<8,this._pad[3]=t[22]|t[23]<<8,this._pad[4]=t[24]|t[25]<<8,this._pad[5]=t[26]|t[27]<<8,this._pad[6]=t[28]|t[29]<<8,this._pad[7]=t[30]|t[31]<<8}return t.prototype._blocks=function(e,t,r){for(var n=this._fin?0:2048,i=this._h[0],o=this._h[1],a=this._h[2],s=this._h[3],c=this._h[4],u=this._h[5],l=this._h[6],f=this._h[7],d=this._h[8],h=this._h[9],p=this._r[0],m=this._r[1],b=this._r[2],g=this._r[3],y=this._r[4],v=this._r[5],w=this._r[6],E=this._r[7],A=this._r[8],x=this._r[9];r>=16;){var _=e[t+0]|e[t+1]<<8;i+=8191&_;var k=e[t+2]|e[t+3]<<8;o+=8191&(_>>>13|k<<3);var S=e[t+4]|e[t+5]<<8;a+=8191&(k>>>10|S<<6);var P=e[t+6]|e[t+7]<<8;s+=8191&(S>>>7|P<<9);var I=e[t+8]|e[t+9]<<8;c+=8191&(P>>>4|I<<12),u+=I>>>1&8191;var T=e[t+10]|e[t+11]<<8;l+=8191&(I>>>14|T<<2);var O=e[t+12]|e[t+13]<<8;f+=8191&(T>>>11|O<<5);var M=e[t+14]|e[t+15]<<8,C=0,B=C;B+=i*p,B+=o*(5*x),B+=a*(5*A),B+=s*(5*E),C=(B+=c*(5*w))>>>13,B&=8191,B+=u*(5*v),B+=l*(5*y),B+=f*(5*g),B+=(d+=8191&(O>>>8|M<<8))*(5*b);var N=C+=(B+=(h+=M>>>5|n)*(5*m))>>>13;N+=i*m,N+=o*p,N+=a*(5*x),N+=s*(5*A),C=(N+=c*(5*E))>>>13,N&=8191,N+=u*(5*w),N+=l*(5*v),N+=f*(5*y),N+=d*(5*g),C+=(N+=h*(5*b))>>>13,N&=8191;var R=C;R+=i*b,R+=o*m,R+=a*p,R+=s*(5*x),C=(R+=c*(5*A))>>>13,R&=8191,R+=u*(5*E),R+=l*(5*w),R+=f*(5*v),R+=d*(5*y);var F=C+=(R+=h*(5*g))>>>13;F+=i*g,F+=o*b,F+=a*m,F+=s*p,C=(F+=c*(5*x))>>>13,F&=8191,F+=u*(5*A),F+=l*(5*E),F+=f*(5*w),F+=d*(5*v);var L=C+=(F+=h*(5*y))>>>13;L+=i*y,L+=o*g,L+=a*b,L+=s*m,C=(L+=c*p)>>>13,L&=8191,L+=u*(5*x),L+=l*(5*A),L+=f*(5*E),L+=d*(5*w);var U=C+=(L+=h*(5*v))>>>13;U+=i*v,U+=o*y,U+=a*g,U+=s*b,C=(U+=c*m)>>>13,U&=8191,U+=u*p,U+=l*(5*x),U+=f*(5*A),U+=d*(5*E);var j=C+=(U+=h*(5*w))>>>13;j+=i*w,j+=o*v,j+=a*y,j+=s*g,C=(j+=c*b)>>>13,j&=8191,j+=u*m,j+=l*p,j+=f*(5*x),j+=d*(5*A);var D=C+=(j+=h*(5*E))>>>13;D+=i*E,D+=o*w,D+=a*v,D+=s*y,C=(D+=c*g)>>>13,D&=8191,D+=u*b,D+=l*m,D+=f*p,D+=d*(5*x);var z=C+=(D+=h*(5*A))>>>13;z+=i*A,z+=o*E,z+=a*w,z+=s*v,C=(z+=c*y)>>>13,z&=8191,z+=u*g,z+=l*b,z+=f*m,z+=d*p;var $=C+=(z+=h*(5*x))>>>13;$+=i*x,$+=o*A,$+=a*E,$+=s*w,C=($+=c*v)>>>13,$&=8191,$+=u*y,$+=l*g,$+=f*b,$+=d*m,i=B=8191&(C=(C=((C+=($+=h*p)>>>13)<<2)+C|0)+(B&=8191)|0),o=N+=C>>>=13,a=R&=8191,s=F&=8191,c=L&=8191,u=U&=8191,l=j&=8191,f=D&=8191,d=z&=8191,h=$&=8191,t+=16,r-=16}this._h[0]=i,this._h[1]=o,this._h[2]=a,this._h[3]=s,this._h[4]=c,this._h[5]=u,this._h[6]=l,this._h[7]=f,this._h[8]=d,this._h[9]=h},t.prototype.finish=function(e,t){void 0===t&&(t=0);var r,n,i,o,a=new Uint16Array(10);if(this._leftover){for(o=this._leftover,this._buffer[o++]=1;o<16;o++)this._buffer[o]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(r=this._h[1]>>>13,this._h[1]&=8191,o=2;o<10;o++)this._h[o]+=r,r=this._h[o]>>>13,this._h[o]&=8191;for(this._h[0]+=5*r,r=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=r,r=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=r,a[0]=this._h[0]+5,r=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this._h[o]+r,r=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,n=(1^r)-1,o=0;o<10;o++)a[o]&=n;for(n=~n,o=0;o<10;o++)this._h[o]=this._h[o]&n|a[o];for(this._h[0]=65535&(this._h[0]|this._h[1]<<13),this._h[1]=65535&(this._h[1]>>>3|this._h[2]<<10),this._h[2]=65535&(this._h[2]>>>6|this._h[3]<<7),this._h[3]=65535&(this._h[3]>>>9|this._h[4]<<4),this._h[4]=65535&(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14),this._h[5]=65535&(this._h[6]>>>2|this._h[7]<<11),this._h[6]=65535&(this._h[7]>>>5|this._h[8]<<8),this._h[7]=65535&(this._h[8]>>>8|this._h[9]<<5),i=this._h[0]+this._pad[0],this._h[0]=65535&i,o=1;o<8;o++)i=(this._h[o]+this._pad[o]|0)+(i>>>16)|0,this._h[o]=65535&i;return e[t+0]=this._h[0]>>>0,e[t+1]=this._h[0]>>>8,e[t+2]=this._h[1]>>>0,e[t+3]=this._h[1]>>>8,e[t+4]=this._h[2]>>>0,e[t+5]=this._h[2]>>>8,e[t+6]=this._h[3]>>>0,e[t+7]=this._h[3]>>>8,e[t+8]=this._h[4]>>>0,e[t+9]=this._h[4]>>>8,e[t+10]=this._h[5]>>>0,e[t+11]=this._h[5]>>>8,e[t+12]=this._h[6]>>>0,e[t+13]=this._h[6]>>>8,e[t+14]=this._h[7]>>>0,e[t+15]=this._h[7]>>>8,this._finished=!0,this},t.prototype.update=function(e){var t,r=0,n=e.length;if(this._leftover){(t=16-this._leftover)>n&&(t=n);for(var i=0;i=16&&(t=n-n%16,this._blocks(e,r,t),r+=t,n-=t),n){for(i=0;i16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var a=new Uint8Array(16);a.set(e,a.length-e.length);var s=new Uint8Array(32);t.stream(this._key,a,s,4);var c,u=r.length+this.tagLength;if(o){if(o.length!==u)throw new Error("ChaCha20Poly1305: incorrect destination length");c=o}else c=new Uint8Array(u);return t.streamXOR(this._key,a,r,c,4),this._authenticate(c.subarray(c.length-this.tagLength,c.length),s,c.subarray(0,c.length-this.tagLength),i),n.wipe(a),c},s.prototype.open=function(e,r,i,a){if(e.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(r.length0&&c.update(a.subarray(s.length%16))),c.update(o),o.length%16>0&&c.update(a.subarray(o.length%16));var u=new Uint8Array(8);s&&i.writeUint64LE(s.length,u),c.update(u),i.writeUint64LE(o.length,u),c.update(u);for(var l=c.digest(),f=0;fthis.blockSize?this._inner.update(t).finish(r).clean():r.set(t);for(var n=0;n1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(e){for(var t=new Uint8Array(e),r=0;r256)throw new Error("randomString charset is too long");let s="";const c=r.length,u=256-256%c;for(;t>0;){const e=i(Math.ceil(256*t/u),a);for(let n=0;n0;n++){const i=e[n];i0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=e[r++],t--;this._bufferLength===this.blockSize&&(o(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(t>=this.blockSize&&(r=o(this._temp,this._state,e,r,t),t%=this.blockSize);t>0;)this._buffer[this._bufferLength++]=e[r++],t--;return this},n.prototype.finish=function(e){if(!this._finished){var r=this._bytesHashed,n=this._bufferLength,i=r/536870912|0,a=r<<3,s=r%64<56?64:128;this._buffer[n]=128;for(var c=n+1;c0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},n.prototype.restoreState=function(e){return this._state.set(e.state),this._bufferLength=e.bufferLength,e.buffer&&this._buffer.set(e.buffer),this._bytesHashed=e.bytesHashed,this._finished=!1,this},n.prototype.cleanSavedState=function(e){r.wipe(e.state),e.buffer&&r.wipe(e.buffer),e.bufferLength=0,e.bytesHashed=0},n}();e.SHA256=n;var i=new Int32Array([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 o(e,r,n,o,a){for(;a>=64;){for(var s=r[0],c=r[1],u=r[2],l=r[3],f=r[4],d=r[5],h=r[6],p=r[7],m=0;m<16;m++){var b=o+4*m;e[m]=t.readUint32BE(n,b)}for(m=16;m<64;m++){var g=e[m-2],y=(g>>>17|g<<15)^(g>>>19|g<<13)^g>>>10,v=((g=e[m-15])>>>7|g<<25)^(g>>>18|g<<14)^g>>>3;e[m]=(y+e[m-7]|0)+(v+e[m-16]|0)}for(m=0;m<64;m++){y=(((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&d^~f&h)|0)+(p+(i[m]+e[m]|0)|0)|0,v=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&c^s&u^c&u)|0;p=h,h=d,d=f,f=l+y|0,l=u,u=c,c=s,s=y+v|0}r[0]+=s,r[1]+=c,r[2]+=u,r[3]+=l,r[4]+=f,r[5]+=d,r[6]+=h,r[7]+=p,o+=64,a-=64}return o}e.hash=function(e){var t=new n;t.update(e);var r=t.digest();return t.clean(),r}}({});!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const t=o1,r=j0;function n(e){const t=new Float64Array(16);if(e)for(let r=0;r=0;--e){const t=r[e>>>3]>>>(7&e)&1;s(d,h,t),s(p,m,t),c(b,d,p),u(d,d,p),c(p,h,m),u(h,h,m),f(m,b),f(g,d),l(d,p,d),l(p,h,b),c(b,d,p),u(d,d,p),f(h,d),u(p,m,g),l(d,p,o),c(d,d,m),l(p,p,d),l(d,m,g),l(m,h,i),f(h,b),s(d,h,t),s(p,m,t)}for(let e=0;e<16;e++)i[e+16]=d[e],i[e+32]=p[e],i[e+48]=h[e],i[e+64]=m[e];const y=i.subarray(32),v=i.subarray(16);!function(e,t){const r=n();for(let e=0;e<16;e++)r[e]=t[e];for(let e=253;e>=0;e--)f(r,r),2!==e&&4!==e&&l(r,r,t);for(let t=0;t<16;t++)e[t]=r[t]}(y,y),l(v,v,y);const w=new Uint8Array(32);return function(e,t){const r=n(),i=n();for(let e=0;e<16;e++)i[e]=t[e];a(i),a(i),a(i);for(let e=0;e<2;e++){r[0]=i[0]-65517;for(let e=1;e<15;e++)r[e]=i[e]-65535-(r[e-1]>>16&1),r[e-1]&=65535;r[15]=i[15]-32767-(r[14]>>16&1);const e=r[15]>>16&1;r[14]&=65535,s(i,r,1-e)}for(let t=0;t<16;t++)e[2*t]=255&i[t],e[2*t+1]=i[t]>>8}(w,v),w}function h(e){return d(e,i)}function p(t){if(t.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const r=new Uint8Array(t);return{publicKey:h(r),secretKey:r}}e.scalarMult=d,e.scalarMultBase=h,e.generateKeyPairFromSeed=p,e.generateKeyPair=function(e){const n=(0,t.randomBytes)(32,e),i=p(n);return(0,r.wipe)(n),i},e.sharedKey=function(t,r,n=!1){if(t.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(r.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const i=d(t,r);if(n){let e=0;for(let t=0;t=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n>>0,a=new Uint8Array(o);e[t];){var l=r[e.charCodeAt(t)];if(255===l)return;for(var f=0,d=o-1;(0!==l||f>>0,a[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var h=o-i;h!==o&&0===a[h];)h++;for(var p=new Uint8Array(n+(o-h)),m=n;h!==o;)p[m++]=a[h++];return p}}}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 r=0,n=0,i=0,o=t.length;i!==o&&0===t[i];)i++,r++;for(var a=(o-i)*l+1>>>0,u=new Uint8Array(a);i!==o;){for(var f=t[i],d=0,h=a-1;(0!==f||d>>0,u[h]=f%s>>>0,f=f/s>>>0;if(0!==f)throw new Error("Non-zero carry");n=d,i++}for(var p=a-n;p!==a&&0===u[p];)p++;for(var m=c.repeat(r);pnew b1({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class y1{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new p1(e,t,r),this.decoder=new m1(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const v1=({name:e,prefix:t,encode:r,decode:n})=>new y1(e,t,r,n),w1=({prefix:e,name:t,alphabet:r})=>{const{encode:n,decode:i}=h1(r,t);return v1({prefix:e,name:t,encode:n,decode:e=>(e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")})(i(e))})},E1=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>v1({prefix:t,name:e,encode:e=>((e,t,r)=>{const n="="===t[t.length-1],i=(1<r;)a-=r,o+=t[i&s>>a];if(a&&(o+=t[i&s<((e,t,r,n)=>{const i={};for(let e=0;e=8&&(s-=8,a[u++]=255&c>>s)}if(s>=r||255&c<<8-s)throw new SyntaxError("Unexpected end of data");return a})(t,n,r,e)});v1({prefix:"\0",name:"identity",encode:e=>{return t=e,(new TextDecoder).decode(t);var t},decode:e=>(e=>(new TextEncoder).encode(e))(e)}),E1({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),E1({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),w1({prefix:"9",name:"base10",alphabet:"0123456789"}),E1({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),E1({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),E1({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),E1({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),E1({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),E1({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),E1({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),E1({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),E1({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),E1({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),E1({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),w1({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),w1({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),w1({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),w1({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),E1({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),E1({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),E1({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),E1({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});const A1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),x1=A1.reduce(((e,t,r)=>(e[r]=t,e)),[]),_1=A1.reduce(((e,t,r)=>(e[t.codePointAt(0)]=r,e)),[]);v1({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce(((e,t)=>e+=x1[t]),"")},decode:function(e){const t=[];for(const r of e){const e=_1[r.codePointAt(0)];if(void 0===e)throw new Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}}),new TextEncoder,new TextDecoder;const k1=":";function S1(e){const[t,r]=e.split(k1);return{namespace:t,reference:r}}function P1(e){const[t,r,n]=e.split(k1);return{namespace:t,reference:r,address:n}}function I1(e){const{namespace:t,reference:r}=P1(e);return function(e){const{namespace:t,reference:r}=e;return[t,r].join(k1)}({namespace:t,reference:r})}function T1(e,t=[]){const r=[];return Object.keys(e).forEach((n=>{if(t.length&&!t.includes(n))return;const i=e[n];r.push(...i.accounts)})),r}function O1(e,t=[]){const r=[];return Object.keys(e).forEach((n=>{if(t.length&&!t.includes(n))return;const i=e[n];r.push(...function(e){return function(e,t){const r=[];return e.forEach((e=>{const n=t(e);r.includes(n)||r.push(n)})),r}(e,I1)}(i.accounts))})),r}var M1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof u<"u"?u:typeof self<"u"?self:{};var C1; /** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT */C1={exports:{}},function(){var e="input is invalid type",t="object"==typeof window,r=t?window:{};r.JS_SHA3_NO_WINDOW&&(t=!1);var n=!t&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof pr&&pr.versions&&pr.versions.node?r=M1:n&&(r=self);var i=!r.JS_SHA3_NO_COMMON_JS&&C1.exports,o=!r.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",a="0123456789abcdef".split(""),s=[4,1024,262144,67108864],c=[0,8,16,24],u=[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],l=[224,256,384,512],f=[128,256],d=["hex","buffer","arrayBuffer","array","digest"],h={128:168,256:136};(r.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),o&&(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 p=function(e,t,r){return function(n){return new T(e,t,e).update(n)[r]()}},m=function(e,t,r){return function(n,i){return new T(e,t,i).update(n)[r]()}},b=function(e,t,r){return function(t,n,i,o){return E["cshake"+e].update(t,n,i,o)[r]()}},g=function(e,t,r){return function(t,n,i,o){return E["kmac"+e].update(t,n,i,o)[r]()}},y=function(e,t,r,n){for(var i=0;i>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function O(e,t,r){T.call(this,e,t,r)}T.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(o&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||o&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}for(var i,a,s=this.blocks,u=this.byteCount,l=t.length,f=this.blockCount,d=0,h=this.s;d>2]|=t[d]<>2]|=a<>2]|=(192|a>>6)<>2]|=(128|63&a)<=57344?(s[i>>2]|=(224|a>>12)<>2]|=(128|a>>6&63)<>2]|=(128|63&a)<>2]|=(240|a>>18)<>2]|=(128|a>>12&63)<>2]|=(128|a>>6&63)<>2]|=(128|63&a)<=u){for(this.start=i-u,this.block=s[f],i=0;i>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},T.prototype.encodeString=function(t){var r,n=typeof t;if("string"!==n){if("object"!==n)throw new Error(e);if(null===t)throw new Error(e);if(o&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||o&&ArrayBuffer.isView(t)))throw new Error(e);r=!0}var i=0,a=t.length;if(r)i=a;else for(var s=0;s=57344?i+=3:(c=65536+((1023&c)<<10|1023&t.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(t),i},T.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+a[15&e]+a[e>>12&15]+a[e>>8&15]+a[e>>20&15]+a[e>>16&15]+a[e>>28&15]+a[e>>24&15];s%t==0&&(M(r),o=0)}return i&&(e=r[o],c+=a[e>>4&15]+a[15&e],i>1&&(c+=a[e>>12&15]+a[e>>8&15]),i>2&&(c+=a[e>>20&15]+a[e>>16&15])),c},T.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var c=new Uint32Array(e);a>8&255,c[e+2]=t>>16&255,c[e+3]=t>>24&255;s%r==0&&M(n)}return o&&(e=s<<2,t=n[a],c[e]=255&t,o>1&&(c[e+1]=t>>8&255),o>2&&(c[e+2]=t>>16&255)),c},O.prototype=new T,O.prototype.finalize=function(){return this.encode(this.outputBits,!0),T.prototype.finalize.call(this)};var M=function(e){var t,r,n,i,o,a,s,c,l,f,d,h,p,m,b,g,y,v,w,E,A,x,_,k,S,P,I,T,O,M,C,B,N,R,F,L,U,j,D,z,$,H,G,q,K,V,W,J,Z,Y,X,Q,ee,te,re,ne,ie,oe,ae,se,ce,ue,le;for(n=0;n<48;n+=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],c=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|l>>>31),r=o^(l<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=a^(f<<1|d>>>31),r=s^(d<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(h<<1|p>>>31),r=l^(p<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|o>>>31),r=d^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],b=e[1],V=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,T=e[20]<<3|e[21]>>>29,O=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ce=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,F=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,Z=e[23]<<10|e[22]>>>22,M=e[33]<<13|e[32]>>>19,C=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,U=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Y=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,B=e[45]<<29|e[44]>>>3,N=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,j=e[26]<<25|e[27]>>>7,D=e[27]<<25|e[26]>>>7,E=e[36]<<21|e[37]>>>11,A=e[37]<<21|e[36]>>>11,Q=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,K=e[9]<<27|e[8]>>>5,P=e[18]<<20|e[19]>>>12,I=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,$=e[39]<<8|e[38]>>>24,x=e[48]<<14|e[49]>>>18,_=e[49]<<14|e[48]>>>18,e[0]=m^~g&v,e[1]=b^~y&w,e[10]=k^~P&T,e[11]=S^~I&O,e[20]=R^~L&j,e[21]=F^~U&D,e[30]=q^~V&J,e[31]=K^~W&Z,e[40]=te^~ne&oe,e[41]=re^~ie&ae,e[2]=g^~v&E,e[3]=y^~w&A,e[12]=P^~T&M,e[13]=I^~O&C,e[22]=L^~j&z,e[23]=U^~D&$,e[32]=V^~J&Y,e[33]=W^~Z&X,e[42]=ne^~oe&se,e[43]=ie^~ae&ce,e[4]=v^~E&x,e[5]=w^~A&_,e[14]=T^~M&B,e[15]=O^~C&N,e[24]=j^~z&H,e[25]=D^~$&G,e[34]=J^~Y&Q,e[35]=Z^~X&ee,e[44]=oe^~se&ue,e[45]=ae^~ce&le,e[6]=E^~x&m,e[7]=A^~_&b,e[16]=M^~B&k,e[17]=C^~N&S,e[26]=z^~H&R,e[27]=$^~G&F,e[36]=Y^~Q&q,e[37]=X^~ee&K,e[46]=se^~ue&te,e[47]=ce^~le&re,e[8]=x^~m&g,e[9]=_^~b&y,e[18]=B^~k&P,e[19]=N^~S&I,e[28]=H^~R&L,e[29]=G^~F&U,e[38]=Q^~q&V,e[39]=ee^~K&W,e[48]=ue^~te&ne,e[49]=le^~re&ie,e[0]^=u[n],e[1]^=u[n+1]};if(i)C1.exports=E;else for(x=0;x{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch{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 j1,D1;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(j1||(j1={})),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"}(D1||(D1={}));const z1="0123456789abcdef";class $1{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();null==R1[r]&&this.throwArgumentError("invalid log level name","logLevel",e),!(F1>R1[r])&&console.log.apply(console,t)}debug(...e){this._log($1.levels.DEBUG,e)}info(...e){this._log($1.levels.INFO,e)}warn(...e){this._log($1.levels.WARNING,e)}makeError(e,t,r){if(N1)return this.makeError("censored error",t,{});t||(t=$1.errors.UNKNOWN_ERROR),r||(r={});const n=[];Object.keys(r).forEach((e=>{const t=r[e];try{if(t instanceof Uint8Array){let r="";for(let e=0;e>4],r+=z1[15&t[e]];n.push(e+"=Uint8Array(0x"+r+")")}else n.push(e+"="+JSON.stringify(t))}catch{n.push(e+"="+JSON.stringify(r[e].toString()))}})),n.push(`code=${t}`),n.push(`version=${this.version}`);const i=e;let o="";switch(t){case D1.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 D1.CALL_EXCEPTION:case D1.INSUFFICIENT_FUNDS:case D1.MISSING_NEW:case D1.NONCE_EXPIRED:case D1.REPLACEMENT_UNDERPRICED:case D1.TRANSACTION_REPLACED:case D1.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const a=new Error(e);return a.reason=i,a.code=t,Object.keys(r).forEach((function(e){a[e]=r[e]})),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,$1.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,n){e||this.throwError(t,r,n)}assertArgument(e,t,r,n){e||this.throwArgumentError(t,r,n)}checkNormalize(e){U1&&this.throwError("platform missing String.prototype.normalize",$1.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:U1})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,$1.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,$1.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r=r?": "+r:"",et&&this.throwError("too many arguments"+r,$1.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||null==e)&&this.throwError("missing new",$1.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",$1.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||null==e)&&this.throwError("missing new",$1.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return L1||(L1=new $1("logger/5.7.0")),L1}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",$1.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),B1){if(!e)return;this.globalLogger().throwError("error censorship permanent",$1.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}N1=!!e,B1=!!t}static setLogLevel(e){const t=R1[e.toLowerCase()];null!=t?F1=t:$1.globalLogger().warn("invalid log level - "+e)}static from(e){return new $1(e)}}$1.errors=D1,$1.levels=j1;const H1=new $1("bytes/5.7.0");function G1(e){return!!e.toHexString}function q1(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return q1(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function K1(e){return"number"==typeof e&&e==e&&e%1==0}function V1(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e||!K1(e.length)||e.length<0)return!1;for(let t=0;t=256)return!1}return!0}function W1(e,t){if(t||(t={}),"number"==typeof e){H1.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),q1(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),G1(e)&&(e=e.toHexString()),J1(e)){let r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":H1.throwArgumentError("hex data is odd-length","value",e));const n=[];for(let e=0;e>4]+Z1[15&n]}return t}return H1.throwArgumentError("invalid hexlify value","value",e)}function X1(e,t){for("string"!=typeof e?e=Y1(e):J1(e)||H1.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&H1.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}var Q1={exports:{}},e2=function(e){var t=e.default;if("function"==typeof t){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}(Object.freeze({__proto__:null,default:{}}));!function(e){!function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o=typeof window<"u"&&typeof window.Buffer<"u"?window.Buffer:e2.Buffer}catch{}function a(e,t){var n=e.charCodeAt(t);return n>=48&&n<=57?n-48:n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:void r(!1,"Invalid character in "+e)}function s(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function c(e,t,n,i){for(var o=0,a=0,s=Math.min(e.length,n),c=t;c=49?u-49+10:u>=17?u-17+10:u,r(u>=0&&a0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.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++,this.negative=1),i=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===n)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=s(e,t,n)<=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,a=o%n,s=Math.min(o,o-a)+r,u=0,l=r;l1&&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},typeof Symbol<"u"&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch{i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.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>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),n=0!==o||a!==this.length-1?f[6-c.length]+c+n:c+n}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 u=d[e],l=h[e];n="";var p=this.clone();for(p.negative=0;!p.isZero();){var m=p.modrn(l).toString(e);n=(p=p.idivn(l)).isZero()?m+n:f[u-m.length]+m+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")},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&&r(!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 p(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,c=a/67108864|0;r.words[0]=s;for(var u=1;u>>26,f=67108863&c,d=Math.min(u,t.length-1),h=Math.max(0,u-e.length+1);h<=d;h++){var p=u-h|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[h])+f)/67108864|0,f=67108863&a}r.words[u]=0|f,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,n){this._strip();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");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 r=0,n=0,i=0,o=0;i>8&255),r>16&255),6===o?(r>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r=0&&(e[r--]=a>>8&255),r>=0&&(e[r--]=a>>16&255),6===o?(r>=0&&(e[r--]=a>>24&255),n=0,o=0):(n=a>>>24,o+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},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;te.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 r=0;re.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,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.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){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;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.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<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.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 r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==o&&a>26,this.words[a]=67108863&t;if(0===o&&a>>13,h=0|a[1],p=8191&h,m=h>>>13,b=0|a[2],g=8191&b,y=b>>>13,v=0|a[3],w=8191&v,E=v>>>13,A=0|a[4],x=8191&A,_=A>>>13,k=0|a[5],S=8191&k,P=k>>>13,I=0|a[6],T=8191&I,O=I>>>13,M=0|a[7],C=8191&M,B=M>>>13,N=0|a[8],R=8191&N,F=N>>>13,L=0|a[9],U=8191&L,j=L>>>13,D=0|s[0],z=8191&D,$=D>>>13,H=0|s[1],G=8191&H,q=H>>>13,K=0|s[2],V=8191&K,W=K>>>13,J=0|s[3],Z=8191&J,Y=J>>>13,X=0|s[4],Q=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ce=8191&se,ue=se>>>13,le=0|s[8],fe=8191&le,de=le>>>13,he=0|s[9],pe=8191&he,me=he>>>13;r.negative=e.negative^t.negative,r.length=19;var be=(u+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,$))+Math.imul(d,z)|0))<<13)|0;u=((o=Math.imul(d,$))+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,$))+Math.imul(m,z)|0,o=Math.imul(m,$);var ge=(u+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,q)|0)+Math.imul(d,G)|0))<<13)|0;u=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(g,z),i=(i=Math.imul(g,$))+Math.imul(y,z)|0,o=Math.imul(y,$),n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(m,G)|0,o=o+Math.imul(m,q)|0;var ye=(u+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(d,V)|0))<<13)|0;u=((o=o+Math.imul(d,W)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,$))+Math.imul(E,z)|0,o=Math.imul(E,$),n=n+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,o=o+Math.imul(m,W)|0;var ve=(u+(n=n+Math.imul(f,Z)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(d,Z)|0))<<13)|0;u=((o=o+Math.imul(d,Y)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(x,z),i=(i=Math.imul(x,$))+Math.imul(_,z)|0,o=Math.imul(_,$),n=n+Math.imul(w,G)|0,i=(i=i+Math.imul(w,q)|0)+Math.imul(E,G)|0,o=o+Math.imul(E,q)|0,n=n+Math.imul(g,V)|0,i=(i=i+Math.imul(g,W)|0)+Math.imul(y,V)|0,o=o+Math.imul(y,W)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Z)|0,o=o+Math.imul(m,Y)|0;var we=(u+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(d,Q)|0))<<13)|0;u=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,z),i=(i=Math.imul(S,$))+Math.imul(P,z)|0,o=Math.imul(P,$),n=n+Math.imul(x,G)|0,i=(i=i+Math.imul(x,q)|0)+Math.imul(_,G)|0,o=o+Math.imul(_,q)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(E,V)|0,o=o+Math.imul(E,W)|0,n=n+Math.imul(g,Z)|0,i=(i=i+Math.imul(g,Y)|0)+Math.imul(y,Z)|0,o=o+Math.imul(y,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,Q)|0,o=o+Math.imul(m,ee)|0;var Ee=(u+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;u=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(T,z),i=(i=Math.imul(T,$))+Math.imul(O,z)|0,o=Math.imul(O,$),n=n+Math.imul(S,G)|0,i=(i=i+Math.imul(S,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,n=n+Math.imul(x,V)|0,i=(i=i+Math.imul(x,W)|0)+Math.imul(_,V)|0,o=o+Math.imul(_,W)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(E,Z)|0,o=o+Math.imul(E,Y)|0,n=n+Math.imul(g,Q)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(y,Q)|0,o=o+Math.imul(y,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,o=o+Math.imul(m,ne)|0;var Ae=(u+(n=n+Math.imul(f,oe)|0)|0)+((8191&(i=(i=i+Math.imul(f,ae)|0)+Math.imul(d,oe)|0))<<13)|0;u=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,$))+Math.imul(B,z)|0,o=Math.imul(B,$),n=n+Math.imul(T,G)|0,i=(i=i+Math.imul(T,q)|0)+Math.imul(O,G)|0,o=o+Math.imul(O,q)|0,n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,W)|0)+Math.imul(P,V)|0,o=o+Math.imul(P,W)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,Y)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,Y)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(E,Q)|0,o=o+Math.imul(E,ee)|0,n=n+Math.imul(g,re)|0,i=(i=i+Math.imul(g,ne)|0)+Math.imul(y,re)|0,o=o+Math.imul(y,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(m,oe)|0,o=o+Math.imul(m,ae)|0;var xe=(u+(n=n+Math.imul(f,ce)|0)|0)+((8191&(i=(i=i+Math.imul(f,ue)|0)+Math.imul(d,ce)|0))<<13)|0;u=((o=o+Math.imul(d,ue)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(R,z),i=(i=Math.imul(R,$))+Math.imul(F,z)|0,o=Math.imul(F,$),n=n+Math.imul(C,G)|0,i=(i=i+Math.imul(C,q)|0)+Math.imul(B,G)|0,o=o+Math.imul(B,q)|0,n=n+Math.imul(T,V)|0,i=(i=i+Math.imul(T,W)|0)+Math.imul(O,V)|0,o=o+Math.imul(O,W)|0,n=n+Math.imul(S,Z)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,Y)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(E,re)|0,o=o+Math.imul(E,ne)|0,n=n+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(m,ce)|0,o=o+Math.imul(m,ue)|0;var _e=(u+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;u=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(U,z),i=(i=Math.imul(U,$))+Math.imul(j,z)|0,o=Math.imul(j,$),n=n+Math.imul(R,G)|0,i=(i=i+Math.imul(R,q)|0)+Math.imul(F,G)|0,o=o+Math.imul(F,q)|0,n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,W)|0)+Math.imul(B,V)|0,o=o+Math.imul(B,W)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,Y)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,Y)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,ee)|0,n=n+Math.imul(x,re)|0,i=(i=i+Math.imul(x,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,ae)|0)+Math.imul(E,oe)|0,o=o+Math.imul(E,ae)|0,n=n+Math.imul(g,ce)|0,i=(i=i+Math.imul(g,ue)|0)+Math.imul(y,ce)|0,o=o+Math.imul(y,ue)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(m,fe)|0,o=o+Math.imul(m,de)|0;var ke=(u+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,me)|0)+Math.imul(d,pe)|0))<<13)|0;u=((o=o+Math.imul(d,me)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(U,G),i=(i=Math.imul(U,q))+Math.imul(j,G)|0,o=Math.imul(j,q),n=n+Math.imul(R,V)|0,i=(i=i+Math.imul(R,W)|0)+Math.imul(F,V)|0,o=o+Math.imul(F,W)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,Y)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(P,re)|0,o=o+Math.imul(P,ne)|0,n=n+Math.imul(x,oe)|0,i=(i=i+Math.imul(x,ae)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,ae)|0,n=n+Math.imul(w,ce)|0,i=(i=i+Math.imul(w,ue)|0)+Math.imul(E,ce)|0,o=o+Math.imul(E,ue)|0,n=n+Math.imul(g,fe)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(y,fe)|0,o=o+Math.imul(y,de)|0;var Se=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;u=((o=o+Math.imul(m,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(U,V),i=(i=Math.imul(U,W))+Math.imul(j,V)|0,o=Math.imul(j,W),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,Y)|0)+Math.imul(F,Z)|0,o=o+Math.imul(F,Y)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(S,oe)|0,i=(i=i+Math.imul(S,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,n=n+Math.imul(x,ce)|0,i=(i=i+Math.imul(x,ue)|0)+Math.imul(_,ce)|0,o=o+Math.imul(_,ue)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(E,fe)|0,o=o+Math.imul(E,de)|0;var Pe=(u+(n=n+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,me)|0)+Math.imul(y,pe)|0))<<13)|0;u=((o=o+Math.imul(y,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(U,Z),i=(i=Math.imul(U,Y))+Math.imul(j,Z)|0,o=Math.imul(j,Y),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(F,Q)|0,o=o+Math.imul(F,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(B,re)|0,o=o+Math.imul(B,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,ae)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,ae)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(P,ce)|0,o=o+Math.imul(P,ue)|0,n=n+Math.imul(x,fe)|0,i=(i=i+Math.imul(x,de)|0)+Math.imul(_,fe)|0,o=o+Math.imul(_,de)|0;var Ie=(u+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(E,pe)|0))<<13)|0;u=((o=o+Math.imul(E,me)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(U,Q),i=(i=Math.imul(U,ee))+Math.imul(j,Q)|0,o=Math.imul(j,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(F,re)|0,o=o+Math.imul(F,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,ae)|0)+Math.imul(B,oe)|0,o=o+Math.imul(B,ae)|0,n=n+Math.imul(T,ce)|0,i=(i=i+Math.imul(T,ue)|0)+Math.imul(O,ce)|0,o=o+Math.imul(O,ue)|0,n=n+Math.imul(S,fe)|0,i=(i=i+Math.imul(S,de)|0)+Math.imul(P,fe)|0,o=o+Math.imul(P,de)|0;var Te=(u+(n=n+Math.imul(x,pe)|0)|0)+((8191&(i=(i=i+Math.imul(x,me)|0)+Math.imul(_,pe)|0))<<13)|0;u=((o=o+Math.imul(_,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(U,re),i=(i=Math.imul(U,ne))+Math.imul(j,re)|0,o=Math.imul(j,ne),n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,ae)|0)+Math.imul(F,oe)|0,o=o+Math.imul(F,ae)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(B,ce)|0,o=o+Math.imul(B,ue)|0,n=n+Math.imul(T,fe)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(O,fe)|0,o=o+Math.imul(O,de)|0;var Oe=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,me)|0)+Math.imul(P,pe)|0))<<13)|0;u=((o=o+Math.imul(P,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(U,oe),i=(i=Math.imul(U,ae))+Math.imul(j,oe)|0,o=Math.imul(j,ae),n=n+Math.imul(R,ce)|0,i=(i=i+Math.imul(R,ue)|0)+Math.imul(F,ce)|0,o=o+Math.imul(F,ue)|0,n=n+Math.imul(C,fe)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(B,fe)|0,o=o+Math.imul(B,de)|0;var Me=(u+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,me)|0)+Math.imul(O,pe)|0))<<13)|0;u=((o=o+Math.imul(O,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(U,ce),i=(i=Math.imul(U,ue))+Math.imul(j,ce)|0,o=Math.imul(j,ue),n=n+Math.imul(R,fe)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(F,fe)|0,o=o+Math.imul(F,de)|0;var Ce=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,me)|0)+Math.imul(B,pe)|0))<<13)|0;u=((o=o+Math.imul(B,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(U,fe),i=(i=Math.imul(U,de))+Math.imul(j,fe)|0,o=Math.imul(j,de);var Be=(u+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,me)|0)+Math.imul(F,pe)|0))<<13)|0;u=((o=o+Math.imul(F,me)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863;var Ne=(u+(n=Math.imul(U,pe))|0)+((8191&(i=(i=Math.imul(U,me))+Math.imul(j,pe)|0))<<13)|0;return u=((o=Math.imul(j,me))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,c[0]=be,c[1]=ge,c[2]=ye,c[3]=ve,c[4]=we,c[5]=Ee,c[6]=Ae,c[7]=xe,c[8]=_e,c[9]=ke,c[10]=Se,c[11]=Pe,c[12]=Ie,c[13]=Te,c[14]=Oe,c[15]=Me,c[16]=Ce,c[17]=Be,c[18]=Ne,0!==u&&(c[19]=u,r.length++),r};function b(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r._strip()}function g(e,t,r){return b(e,t,r)}Math.imul||(m=p),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):r<63?p(this,e,t):r<1024?b(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),r("number"==typeof e),r(e<67108864);for(var n=0,i=0;i>=26,n+=o/67108864|0,n+=a>>>26,this.words[i]=67108863&a}return 0!==n&&(this.words[i]=n,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()),r=0;r>>i&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=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>>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=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,u=0;u=0&&(0!==l||u>=i);u--){var f=0|this.words[u];this.words[u]=l<<26-o|f>>>o,l=f&s}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,n){return r(0===this.negative),this.iushrn(e,t,n)},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){r("number"==typeof e&&e>=0);var t=e%26,n=(e-t)/26,i=1<=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<=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(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>26)-(c/67108864|0),this.words[i+n]=67108863&a}for(;i>26,this.words[i+n]=67108863&a;if(0===s)return this._strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),o=e,a=0|o.words[o.length-1];0!==(r=26-this._countBits(a))&&(o=o.ushln(r),n.iushln(r),a=0|o.words[o.length-1]);var s,c=n.length-o.length;if("mod"!==t){(s=new i(null)).length=c+1,s.words=new Array(s.length);for(var u=0;u=0;f--){var d=67108864*(0|n.words[o.length+f])+(0|n.words[o.length+f-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,n){return r(!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(),n&&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}):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 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 r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);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),r(e<=67108863);for(var n=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(n*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),r(e<=67108863);for(var n=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*n;this.words[i]=o/e|0,n=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.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 o=new i(1),a=new i(0),s=new i(0),c=new i(1),u=0;t.isEven()&&n.isEven();)t.iushrn(1),n.iushrn(1),++u;for(var l=n.clone(),f=t.clone();!t.isZero();){for(var d=0,h=1;!(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(f)),o.iushrn(1),a.iushrn(1);for(var p=0,m=1;!(n.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(n.iushrn(p);p-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(l),c.isub(f)),s.iushrn(1),c.iushrn(1);t.cmp(n)>=0?(t.isub(n),o.isub(s),a.isub(c)):(n.isub(t),s.isub(o),c.isub(a))}return{a:s,b:c,gcd:n.iushln(u)}},i.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t,n=this,o=e.clone();n=0!==n.negative?n.umod(e):n.clone();for(var a=new i(1),s=new i(0),c=o.clone();n.cmpn(1)>0&&o.cmpn(1)>0;){for(var u=0,l=1;!(n.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(n.iushrn(u);u-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);for(var f=0,d=1;!(o.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(o.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);n.cmp(o)>=0?(n.isub(o),a.isub(s)):(o.isub(n),s.isub(a))}return(t=0===n.cmpn(1)?a:s).cmpn(0)<0&&t.iadd(e),t},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var o=t;t=r,r=o}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return!(1&this.words[0])},i.prototype.isOdd=function(){return!(1&~this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,n=(e-t)/26,i=1<>>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,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:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(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 _(e)},i.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)},i.prototype.fromRed=function(){return r(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 r(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function v(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 w(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function E(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function x(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"==typeof e){var t=i._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 k(e){_.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)}v.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},n(w,v),w.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},w.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if("k256"===e)t=new w;else if("p224"===e)t=new E;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new x}return y[e]=t,t},_.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){r(!(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(u(e,e.umod(this.m)._forceRed(this)),e)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.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 i(1)).iushrn(2);return this.pow(e,n)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);r(!o.isZero());var s=new i(1).toRed(this),c=s.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var f=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),h=this.pow(e,o),p=a;0!==h.cmp(s);){for(var m=h,b=0;0!==m.cmp(s);b++)m=m.redSqr();r(b=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var f=u>>l&1;(o!==r[0]&&(o=this.sqr(o)),0!==f||0!==a)?(a<<=1,a|=f,(4===++s||0===n&&0===l)&&(o=this.mul(o,r[a]),s=0,a=0)):s=0}c=26}return o},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new k(e)},n(k,_),k.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},k.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},k.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).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)},k.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=r.isub(n).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)},k.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,M1)}(Q1);var t2=Q1.exports;const r2="bignumber/5.7.0";var n2=t2.BN;const i2=new $1(r2),o2={},a2=9007199254740991;let s2=!1;class c2{constructor(e,t){e!==o2&&i2.throwError("cannot call constructor directly; use BigNumber.from",$1.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return l2(f2(this).fromTwos(e))}toTwos(e){return l2(f2(this).toTwos(e))}abs(){return"-"===this._hex[0]?c2.from(this._hex.substring(1)):this}add(e){return l2(f2(this).add(f2(e)))}sub(e){return l2(f2(this).sub(f2(e)))}div(e){return c2.from(e).isZero()&&d2("division-by-zero","div"),l2(f2(this).div(f2(e)))}mul(e){return l2(f2(this).mul(f2(e)))}mod(e){const t=f2(e);return t.isNeg()&&d2("division-by-zero","mod"),l2(f2(this).umod(t))}pow(e){const t=f2(e);return t.isNeg()&&d2("negative-power","pow"),l2(f2(this).pow(t))}and(e){const t=f2(e);return(this.isNegative()||t.isNeg())&&d2("unbound-bitwise-result","and"),l2(f2(this).and(t))}or(e){const t=f2(e);return(this.isNegative()||t.isNeg())&&d2("unbound-bitwise-result","or"),l2(f2(this).or(t))}xor(e){const t=f2(e);return(this.isNegative()||t.isNeg())&&d2("unbound-bitwise-result","xor"),l2(f2(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&d2("negative-width","mask"),l2(f2(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&d2("negative-width","shl"),l2(f2(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&d2("negative-width","shr"),l2(f2(this).shrn(e))}eq(e){return f2(this).eq(f2(e))}lt(e){return f2(this).lt(f2(e))}lte(e){return f2(this).lte(f2(e))}gt(e){return f2(this).gt(f2(e))}gte(e){return f2(this).gte(f2(e))}isNegative(){return"-"===this._hex[0]}isZero(){return f2(this).isZero()}toNumber(){try{return f2(this).toNumber()}catch{d2("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return i2.throwError("this platform does not support BigInt",$1.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?s2||(s2=!0,i2.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?i2.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",$1.errors.UNEXPECTED_ARGUMENT,{}):i2.throwError("BigNumber.toString does not accept parameters",$1.errors.UNEXPECTED_ARGUMENT,{})),f2(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof c2)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new c2(o2,u2(e)):e.match(/^-?[0-9]+$/)?new c2(o2,u2(new n2(e))):i2.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&d2("underflow","BigNumber.from",e),(e>=a2||e<=-a2)&&d2("overflow","BigNumber.from",e),c2.from(String(e));const t=e;if("bigint"==typeof t)return c2.from(t.toString());if(V1(t))return c2.from(Y1(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return c2.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(J1(e)||"-"===e[0]&&J1(e.substring(1))))return c2.from(e)}return i2.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function u2(e){if("string"!=typeof e)return u2(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&i2.throwArgumentError("invalid hex","value",e),"0x00"===(e=u2(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 l2(e){return c2.from(u2(e))}function f2(e){const t=c2.from(e).toHexString();return"-"===t[0]?new n2("-"+t.substring(3),16):new n2(t.substring(2),16)}function d2(e,t,r){const n={fault:e,operation:t};return null!=r&&(n.value=r),i2.throwError(e,$1.errors.NUMERIC_FAULT,n)}const h2=new $1(r2),p2={},m2=c2.from(0),b2=c2.from(-1);function g2(e,t,r,n){const i={fault:t,operation:r};return void 0!==n&&(i.value=n),h2.throwError(e,$1.errors.NUMERIC_FAULT,i)}let y2="0";for(;y2.length<256;)y2+=y2;function v2(e){if("number"!=typeof e)try{e=c2.from(e).toNumber()}catch{}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+y2.substring(0,e):h2.throwArgumentError("invalid decimal size","decimals",e)}function w2(e,t){null==t&&(t=0);const r=v2(t),n=(e=c2.from(e)).lt(m2);n&&(e=e.mul(b2));let i=e.mod(r).toString();for(;i.length2&&h2.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>r.length-1&&g2("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.lengthnull==e[t]?n:(typeof e[t]!==r&&h2.throwArgumentError("invalid fixed format ("+t+" not "+r+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),r=i("width","number",r),n=i("decimals","number",n)}return r%8&&h2.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),n>80&&h2.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new A2(p2,t,r,n)}}class x2{constructor(e,t,r,n){e!==p2&&h2.throwError("cannot use FixedNumber constructor; use FixedNumber.from",$1.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=t,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&h2.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=E2(this._value,this.format.decimals),r=E2(e._value,e.format.decimals);return x2.fromValue(t.add(r),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=E2(this._value,this.format.decimals),r=E2(e._value,e.format.decimals);return x2.fromValue(t.sub(r),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=E2(this._value,this.format.decimals),r=E2(e._value,e.format.decimals);return x2.fromValue(t.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=E2(this._value,this.format.decimals),r=E2(e._value,e.format.decimals);return x2.fromValue(t.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=x2.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return this.isNegative()&&r&&(t=t.subUnsafe(_2.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=x2.from(e[0],this.format);const r=!e[1].match(/^(0*)$/);return!this.isNegative()&&r&&(t=t.addUnsafe(_2.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)&&h2.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const r=x2.from("1"+y2.substring(0,e),this.format),n=k2.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(n).floor().divUnsafe(r)}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&&h2.throwArgumentError("invalid byte width","width",e);return X1(c2.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return x2.fromString(this._value,e)}static fromValue(e,t,r){return null==r&&null!=t&&!function(e){return null!=e&&(c2.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||J1(e)||"bigint"==typeof e||V1(e))}(t)&&(r=t,t=null),null==t&&(t=0),null==r&&(r="fixed"),x2.fromString(w2(e,t),A2.from(r))}static fromString(e,t){null==t&&(t="fixed");const r=A2.from(t),n=E2(e,r.decimals);!r.signed&&n.lt(m2)&&g2("unsigned value cannot be negative","overflow","value",e);let i=null;r.signed?i=n.toTwos(r.width).toHexString():(i=n.toHexString(),i=X1(i,r.width/8));const o=w2(n,r.decimals);return new x2(p2,i,o,r)}static fromBytes(e,t){null==t&&(t="fixed");const r=A2.from(t);if(W1(e).length>r.width/8)throw new Error("overflow");let n=c2.from(e);r.signed&&(n=n.fromTwos(r.width));const i=n.toTwos((r.signed?0:1)+r.width).toHexString(),o=w2(n,r.decimals);return new x2(p2,i,o,r)}static from(e,t){if("string"==typeof e)return x2.fromString(e,t);if(V1(e))return x2.fromBytes(e,t);try{return x2.fromValue(e,0,t)}catch(e){if(e.code!==$1.errors.INVALID_ARGUMENT)throw e}return h2.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const _2=x2.from(1),k2=x2.from("0.5");var S2,P2;function I2(e,t){t||(t=function(e){return[parseInt(e,16)]});let r=0,n={};return e.split(",").forEach((e=>{let i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function T2(e){let t=0;return e.split(",").map((e=>{let r=e.split("-");1===r.length?r[1]="0":""===r[1]&&(r[1]="1");let n=t+parseInt(r[0],16);return t=parseInt(r[1],16),{l:n,h:t}}))}function O2(e,t){null==t&&(t=1);const r=[],n=r.forEach,i=function(e,t){n.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):r.push(e)}))};return i(e,t),r}function M2(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function r(){return e[t++]<<8|e[t++]}let n=r(),i=1,o=[0,1];for(let e=1;e>--c&1}const f=Math.pow(2,31),d=f>>>1,h=d>>1,p=f-1;let m=0;for(let e=0;e<31;e++)m=m<<1|l();let b=[],g=0,y=f;for(;;){let e=Math.floor(((m-g+1)*i-1)/y),t=0,r=n;for(;r-t>1;){let n=t+r>>>1;e>>1|l(),a=a<<1^d,s=(s^d)<<1|d|1;g=a,y=1+s-a}let v=n-4;return b.map((t=>{switch(t-v){case 3:return v+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return v+256+(e[s++]<<8|e[s++]);case 1:return v+e[s++];default:return t-1}}))}(e))}function C2(e){return 1&e?~e>>1:e>>1}function B2(e,t){let r=Array(e);for(let n=0,i=-1;nt[e])):r}function F2(e,t,r){let n=Array(e).fill(void 0).map((()=>[]));for(let i=0;in[t].push(e)));return n}function L2(e,t){let r=1+t(),n=t(),i=function(e){let t=[];for(;;){let r=e();if(0==r)break;t.push(r)}return t}(t);return O2(F2(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*n;return[o+t*r,a.map((e=>e+i))]}))})))}function U2(e,t){return F2(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(S2||(S2={})),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"}(P2||(P2={})),T2("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((e=>parseInt(e,16))),I2("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),I2("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),I2("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");let t=[];for(let r=0;re-t));(function r(){let n=[];for(;;){let i=R2(e,t);if(0==i.length)break;n.push({set:new Set(i),node:r()})}n.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:n,valid:o,fe0f:a,save:1==i,check:2==i}})()}(j2);new Uint8Array(32).fill(0);new Uint8Array(32).fill(0),c2.from(-1);const D2=c2.from(0),z2=c2.from(1);c2.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),X1(z2.toHexString(),32),X1(D2.toHexString(),32);var $2={},H2={},G2=q2;function q2(e,t){if(!e)throw new Error(t||"Assertion failed")}q2.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var K2={exports:{}};"function"==typeof Object.create?K2.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:K2.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var V2=G2,W2=K2.exports;function J2(e,t){return!(55296!=(64512&e.charCodeAt(t))||t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function Z2(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function Y2(e){return 1===e.length?"0"+e:e}function X2(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}H2.inherits=W2,H2.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];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>6|192,r[n++]=63&o|128):J2(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>0}return o},H2.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},H2.rotr32=function(e,t){return e>>>t|e<<32-t},H2.rotl32=function(e,t){return e<>>32-t},H2.sum32=function(e,t){return e+t>>>0},H2.sum32_3=function(e,t,r){return e+t+r>>>0},H2.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},H2.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},H2.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,a=(o>>0,e[t+1]=o},H2.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},H2.sum64_lo=function(e,t,r,n){return t+n>>>0},H2.sum64_4_hi=function(e,t,r,n,i,o,a,s){var c=0,u=t;return c+=(u=u+n>>>0)>>0)>>0)>>0},H2.sum64_4_lo=function(e,t,r,n,i,o,a,s){return t+n+o+s>>>0},H2.sum64_5_hi=function(e,t,r,n,i,o,a,s,c,u){var l=0,f=t;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},H2.sum64_5_lo=function(e,t,r,n,i,o,a,s,c,u){return t+n+o+s+u>>>0},H2.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},H2.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},H2.shr64_hi=function(e,t,r){return e>>>r},H2.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0};var Q2={},e6=H2,t6=G2;function r6(){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}Q2.BlockHash=r6,r6.prototype.update=function(e,t){if(e=e6.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=e6.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;o>>3},i6.g1_256=function(e){return o6(e,17)^o6(e,19)^e>>>10};var u6=H2,l6=Q2,f6=i6,d6=u6.rotl32,h6=u6.sum32,p6=u6.sum32_5,m6=f6.ft_1,b6=l6.BlockHash,g6=[1518500249,1859775393,2400959708,3395469782];function y6(){if(!(this instanceof y6))return new y6;b6.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}u6.inherits(y6,b6);var v6=y6;y6.blockSize=512,y6.outSize=160,y6.hmacStrength=80,y6.padLength=64,y6.prototype._update=function(e,t){for(var r=this.W,n=0;n<16;n++)r[n]=e[t+n];for(;nthis.blockSize&&(e=(new this.Hash).update(e).digest()),U5(e.length<=this.blockSize);for(var t=e.length;t>8,a=255&i;o?r.push(o,a):r.push(a)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),q5=z5((function(e,t){var r=t;r.assert=$5,r.toArray=G5.toArray,r.zero2=G5.zero2,r.toHex=G5.toHex,r.encode=G5.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-c:c,o.isubn(s)):s=0,n[a]=s,o.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,c=e.andln(3)+i&3,u=t.andln(3)+o&3;3===c&&(c=-1),3===u&&(u=-1),1&c?a=3!==(n=e.andln(7)+i&7)&&5!==n||2!==u?c:-c:a=0,r[0].push(a),1&u?s=3!==(n=t.andln(7)+o&7)&&5!==n||2!==c?u:-u:s=0,r[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"==typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new t2(e,"hex","le")}})),K5=q5.getNAF,V5=q5.getJSF,W5=q5.assert;function J5(e,t){this.type=e,this.p=new t2(t.p,16),this.red=t.prime?t2.red(t.prime):t2.mont(this.p),this.zero=new t2(0).toRed(this.red),this.one=new t2(1).toRed(this.red),this.two=new t2(2).toRed(this.red),this.n=t.n&&new t2(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 r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Z5=J5;function Y5(e,t){this.curve=e,this.type=t,this.precomputed=null}J5.prototype.point=function(){throw new Error("Not implemented")},J5.prototype.validate=function(){throw new Error("Not implemented")},J5.prototype._fixedNafMul=function(e,t){W5(e.precomputed);var r=e._getDoubles(),n=K5(t,1,this._bitLength),i=(1<=o;c--)a=(a<<1)+n[c];s.push(a)}for(var u=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=i;f>0;f--){for(o=0;o=0;s--){for(var c=0;s>=0&&0===o[s];s--)c++;if(s>=0&&c++,a=a.dblp(c),s<0)break;var u=o[s];W5(0!==u),a="affine"===e.type?u>0?a.mixedAdd(i[u-1>>1]):a.mixedAdd(i[-u-1>>1].neg()):u>0?a.add(i[u-1>>1]):a.add(i[-u-1>>1].neg())}return"affine"===e.type?a.toP():a},J5.prototype._wnafMulAdd=function(e,t,r,n,i){var o,a,s,c=this._wnafT1,u=this._wnafT2,l=this._wnafT3,f=0;for(o=0;o=1;o-=2){var h=o-1,p=o;if(1===c[h]&&1===c[p]){var m=[t[h],null,null,t[p]];0===t[h].y.cmp(t[p].y)?(m[1]=t[h].add(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg())):0===t[h].y.cmp(t[p].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].add(t[p].neg())):(m[1]=t[h].toJ().mixedAdd(t[p]),m[2]=t[h].toJ().mixedAdd(t[p].neg()));var b=[-3,-1,-5,-7,0,7,5,1,3],g=V5(r[h],r[p]);for(f=Math.max(g[0].length,f),l[h]=new Array(f),l[p]=new Array(f),a=0;a=0;o--){for(var A=0;o>=0;){var x=!0;for(a=0;a=0&&A++,w=w.dblp(A),o<0)break;for(a=0;a0?s=u[a][_-1>>1]:_<0&&(s=u[a][-_-1>>1].neg()),w="affine"===s.type?w.mixedAdd(s):w.add(s))}}for(o=0;o=Math.ceil((e.bitLength()+1)/t.step)},Y5.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(o=t,a=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:n,b:i},{a:o,b:a}]},e3.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),c=i.mul(r.b),u=o.mul(n.b);return{k1:e.sub(a).sub(s),k2:c.add(u).neg()}},e3.prototype.pointFromX=function(e,t){(e=new t2(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},e3.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},e3.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},r3.prototype.isInfinity=function(){return this.inf},r3.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 r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},r3.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,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),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)},r3.prototype.getX=function(){return this.x.fromRed()},r3.prototype.getY=function(){return this.y.fromRed()},r3.prototype.mul=function(e){return e=new t2(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)},r3.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},r3.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},r3.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))},r3.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},r3.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},X5(n3,Z5.BasePoint),e3.prototype.jpoint=function(e,t,r){return new n3(this,e,t,r)},n3.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},n3.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},n3.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),s=n.redSub(i),c=o.redSub(a);if(0===s.cmpn(0))return 0!==c.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),l=u.redMul(s),f=n.redMul(u),d=c.redSqr().redIAdd(l).redISub(f).redISub(f),h=c.redMul(f.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,h,p)},n3.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),u=c.redMul(a),l=r.redMul(c),f=s.redSqr().redIAdd(u).redISub(l).redISub(l),d=s.redMul(l.redISub(f)).redISub(i.redMul(u)),h=this.z.redMul(a);return this.curve.jpoint(f,d,h)},n3.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 r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},n3.prototype.inspect=function(){return this.isInfinity()?"":""},n3.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var i3=z5((function(e,t){var r=t;r.base=Z5,r.short=t3,r.mont=null,r.edwards=null})),o3=z5((function(e,t){var r,n=t,i=q5.assert;function o(e){"short"===e.type?this.curve=new i3.short(e):"edwards"===e.type?this.curve=new i3.edwards(e):this.curve=new i3.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(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new o(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.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:$2.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:$2.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:$2.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:$2.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:$2.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:$2.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:$2.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch{r=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:$2.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function a3(e){if(!(this instanceof a3))return new a3(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=G5.toArray(e.entropy,e.entropyEnc||"hex"),r=G5.toArray(e.nonce,e.nonceEnc||"hex"),n=G5.toArray(e.pers,e.persEnc||"hex");$5(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var s3=a3;a3.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},a3.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=G5.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var f3=q5.assert;function d3(e,t){if(e instanceof d3)return e;this._importDER(e,t)||(f3(e.r&&e.s,"Signature without r or s"),this.r=new t2(e.r,16),this.s=new t2(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var h3=d3;function p3(){this.place=0}function m3(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,o=0,a=t.place;o>>=0;return!(i<=127)&&(t.place=a,i)}function b3(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}d3.prototype._importDER=function(e,t){e=q5.toArray(e,t);var r=new p3;if(48!==e[r.place++])return!1;var n=m3(e,r);if(!1===n||n+r.place!==e.length||2!==e[r.place++])return!1;var i=m3(e,r);if(!1===i)return!1;var o=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var a=m3(e,r);if(!1===a||e.length!==a+r.place)return!1;var s=e.slice(r.place,a+r.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 t2(o),this.s=new t2(s),this.recoveryParam=null,!0},d3.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=b3(t),r=b3(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];g3(n,t.length),(n=n.concat(t)).push(2),g3(n,r.length);var i=n.concat(r),o=[48];return g3(o,i.length),o=o.concat(i),q5.encode(o,e)};var y3=function(){throw new Error("unsupported")},v3=q5.assert;function w3(e){if(!(this instanceof w3))return new w3(e);"string"==typeof e&&(v3(Object.prototype.hasOwnProperty.call(o3,e),"Unknown curve "+e),e=o3[e]),e instanceof o3.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 E3=w3;w3.prototype.keyPair=function(e){return new l3(this,e)},w3.prototype.keyFromPrivate=function(e,t){return l3.fromPrivate(this,e,t)},w3.prototype.keyFromPublic=function(e,t){return l3.fromPublic(this,e,t)},w3.prototype.genKeyPair=function(e){e||(e={});for(var t=new s3({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||y3(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new t2(2));;){var i=new t2(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},w3.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},w3.prototype.sign=function(e,t,r,n){"object"==typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new t2(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new s3({hash:this.hash,entropy:o,nonce:a,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new t2(1)),u=0;;u++){var l=n.k?n.k(u):new t2(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(c)>=0)){var f=this.g.mul(l);if(!f.isInfinity()){var d=f.getX(),h=d.umod(this.n);if(0!==h.cmpn(0)){var p=l.invm(this.n).mul(h.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var m=(f.getY().isOdd()?1:0)|(0!==d.cmp(h)?2:0);return n.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),m^=1),new h3({r:h,s:p,recoveryParam:m})}}}}}},w3.prototype.verify=function(e,t,r,n){e=this._truncateToN(new t2(e,16)),r=this.keyFromPublic(r,n);var i=(t=new h3(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(c,r.getPublic(),u)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(c,r.getPublic(),u)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},w3.prototype.recoverPubKey=function(e,t,r,n){v3((3&r)===r,"The recovery param is more than two bits"),t=new h3(t,n);var i=this.n,o=new t2(e),a=t.r,s=t.s,c=1&r,u=r>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");a=u?this.curve.pointFromX(a.add(this.curve.n),c):this.curve.pointFromX(a,c);var l=t.r.invm(i),f=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(f,a,d)},w3.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new h3(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var A3,x3=z5((function(e,t){var r=t;r.version="6.5.4",r.utils=q5,r.rand=function(){throw new Error("unsupported")},r.curve=i3,r.curves=o3,r.ec=E3,r.eddsa=null}));function _3(e,t,r){if(r>e.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function k3(e){if(0===e[0])throw new Error("invalid RLP: extra zeros");return T3(function(e){let t="";for(let r=0;re.length)throw new Error("invalid RLP: total length is larger than the data");for(i=_3(e,r,n);i.length;)o=P3(i),a.push(o.data),i=o.remainder;return{data:a,remainder:e.subarray(n)}}}x3.ec,function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(A3||(A3={}));const I3=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function T3(e){const t=Number.parseInt(e,16);if(Number.isNaN(t))throw new Error("Invalid byte sequence");return t}function O3(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;re+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t=2&&"0"===e[0]&&"x"===e[1]}function N3(e){if(e instanceof Uint8Array)return e;if("string"==typeof e)return B3(e)?O3((r="string"!=typeof(n=e)?n:B3(n)?n.slice(2):n).length%2?`0${r}`:r):(t=e,(new TextEncoder).encode(t));var t,r,n;if("number"==typeof e||"bigint"==typeof e)return e?O3(C3(e)):Uint8Array.from([]);if(null==e)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}const R3={encode:function e(t){if(Array.isArray(t)){const r=[];let n=0;for(let i=0;i{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return F3(e)?e.slice(2):e};function U3(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}function j3(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&!(void 0!==t&&t>0&&e.length!==2+2*t)}const D3=function(e){if(!(e instanceof Uint8Array)){throw new Error(`This method only supports Uint8Array but input was: ${e}`)}},z3=BigInt(0),$3={},H3={};for(let e=0;e<16;e++){const t=e,r=16*e,n=e.toString(16).toLowerCase();H3[n]=t,H3[n.toUpperCase()]=t,$3[n]=r,$3[n.toUpperCase()]=r}function G3(e){const t=e.length,r=new Uint8Array(t/2);for(let n=0;nt.toString(16).padStart(2,"0"))),K3=e=>{let t="0x";if(void 0===e||0===e.length)return t;for(const r of e)t+=q3[r];return t},V3=[];for(let e=0;e<=65535;e++)V3[e]=BigInt(e);const W3=(e,t=!1)=>{t&&e.reverse();const r=K3(e);return"0x"===r?z3:4===r.length?V3[e[0]]:6===r.length?V3[256*e[0]+e[1]]:BigInt(r)},J3=e=>{if("string"!=typeof e)throw new Error(`hex argument type ${typeof e} must be of type string`);if(!/^0x[0-9a-fA-F]*$/.test(e))throw new Error(`Input must be a 0x-prefixed hexadecimal string, got ${e}`);return(e=e.slice(2)).length%2!=0&&(e=U3(e)),G3(e)},Z3=e=>{if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`},Y3=e=>{const t=Z3(e);return J3(t)},X3=(e,t=!1)=>{const r=r8("0x"+U3(e.toString(16)));return t?r.reverse():r},Q3=e=>new Uint8Array(e),e8=(e,t)=>(D3(e),((e,t,r)=>r?e.length(D3(e),(e=>{let t=e[0];for(;e.length>0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e})(e)),r8=e=>{if(null==e)return new Uint8Array;if(Array.isArray(e)||e instanceof Uint8Array)return Uint8Array.from(e);if("string"==typeof e){if(!j3(e))throw new Error(`Cannot convert string to Uint8Array. toBytes only supports 0x-prefixed hex strings and this string was given: ${e}`);return J3(e)}if("number"==typeof e)return Y3(e);if("bigint"==typeof e){if(e{if("0x"===e.slice(0,2))throw new Error("hex string is prefixed with 0x, should be unprefixed");return G3(U3(e))})(t)}if(void 0!==e.toBytes)return e.toBytes();throw new Error("invalid type")},n8=e=>"string"!=typeof e||F3(e)?e:"0x"+e,i8=e=>{for(const[t,r]of Object.entries(e))if(void 0!==r&&r.length>0&&0===r[0])throw new Error(`${t} cannot have leading zeroes, received: ${K3(r)}`)},o8=e=>"0x"+e.toString(16),a8=e=>t8(X3(e)),s8=(...e)=>{if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t=t&&e<=r}toString(){return K3(this.bytes)}toBytes(){return new Uint8Array(this.bytes)}};var E8,A8,x8;function _8(e,t){if(null===e)return null;if(void 0===e)return;if("string"==typeof e&&!j3(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const r=r8(e);switch(t){case x8.Uint8Array:return r;case x8.BigInt:return W3(r);case x8.Number:{const e=W3(r);if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(e)}case x8.PrefixedHexString:return K3(r);default:throw new Error("unknown outputType")}}function k8(e,t,r){const n=Yh.sign(e,t),i=n.toCompactRawBytes();return{r:i.slice(0,32),s:i.slice(32,64),v:void 0===r?BigInt(n.recovery+27):BigInt(n.recovery+35)+BigInt(r)*h8}}!function(e){e.String="string",e.Bytes="view",e.Number="number"}(E8||(E8={})),function(e){e.String="string",e.Bytes="view",e.JSON="json"}(A8||(A8={})),function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Uint8Array=2]="Uint8Array",e[e.PrefixedHexString=3]="PrefixedHexString"}(x8||(x8={}));const S8=function(e,t,r,n,i){const o=s8(e8(r,32),e8(n,32)),a=function(e,t){return e===f8||e===d8?e:void 0===t?e-m8:e-(t*h8+BigInt(35))}(t,i);if(!function(e){return e===f8||e===d8}(a))throw new Error("Invalid signature v value");return Yh.Signature.fromCompact(o).addRecoveryBit(Number(a)).recoverPublicKey(e).toRawBytes(!1).slice(1)},P8=4096,I8=131072;function T8(e){const t=new Uint8Array(131072);for(let r=0;r{const t=Bd(e),r=t.byteLength;if(0===r)throw Error("invalid blob data");if(r>262143)throw Error("blob data is too large");const n=Math.ceil(r/I8),i=function(e,t){const r=new Uint8Array(t*I8).fill(0);return r.set(e),r[e.byteLength]=128,r}(t,n),o=[];for(let e=0;e{const r=new Uint8Array(32);return r.set([t],0),r.set(Dp(e).subarray(1),1),r},C8={mainnet:{name:"mainnet",chainId:1,networkId:1,defaultHardfork:"shanghai",consensus:{type:"pow",algorithm:"ethash",ethash:{}},comment:"The Ethereum main chain",url:"https://ethstats.net/",genesis:{gasLimit:5e3,difficulty:17179869184,nonce:"0x0000000000000042",extraData:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa"},hardforks:[{name:"chainstart",block:0,forkHash:"0xfc64ec04"},{name:"homestead",block:115e4,forkHash:"0x97c2c34c"},{name:"dao",block:192e4,forkHash:"0x91d1f948"},{name:"tangerineWhistle",block:2463e3,forkHash:"0x7a64da13"},{name:"spuriousDragon",block:2675e3,forkHash:"0x3edd5b10"},{name:"byzantium",block:437e4,forkHash:"0xa00bc324"},{name:"constantinople",block:728e4,forkHash:"0x668db0af"},{name:"petersburg",block:728e4,forkHash:"0x668db0af"},{name:"istanbul",block:9069e3,forkHash:"0x879d6e30"},{name:"muirGlacier",block:92e5,forkHash:"0xe029e991"},{name:"berlin",block:12244e3,forkHash:"0x0eb440f6"},{name:"london",block:12965e3,forkHash:"0xb715077d"},{name:"arrowGlacier",block:13773e3,forkHash:"0x20c327fc"},{name:"grayGlacier",block:1505e4,forkHash:"0xf0afd0e3"},{name:"paris",ttd:"58750000000000000000000",block:15537394,forkHash:"0xf0afd0e3"},{name:"mergeForkIdTransition",block:null,forkHash:null},{name:"shanghai",block:null,timestamp:"1681338455",forkHash:"0xdce96c2d"},{name:"cancun",block:null,timestamp:"1710338135",forkHash:"0x9f3d2254"}],bootstrapNodes:[{ip:"18.138.108.67",port:30303,id:"d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666",location:"ap-southeast-1-001",comment:"bootnode-aws-ap-southeast-1-001"},{ip:"3.209.45.79",port:30303,id:"22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de",location:"us-east-1-001",comment:"bootnode-aws-us-east-1-001"},{ip:"65.108.70.101",port:30303,id:"2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc",location:"eu-west-1-001",comment:"bootnode-hetzner-hel"},{ip:"157.90.35.166",port:30303,id:"4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052",location:"eu-central-1-001",comment:"bootnode-hetzner-fsn"}],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.mainnet.ethdisco.net"]},goerli:{name:"goerli",chainId:5,networkId:5,defaultHardfork:"shanghai",consensus:{type:"poa",algorithm:"clique",clique:{period:15,epoch:3e4}},comment:"Cross-client PoA test network",url:"https://github.com/goerli/testnet",genesis:{timestamp:"0x5c51a607",gasLimit:10485760,difficulty:1,nonce:"0x0000000000000000",extraData:"0x22466c6578692069732061207468696e6722202d204166726900000000000000e0a2bd4258d2768837baa26a28fe71dc079f84c70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"},hardforks:[{name:"chainstart",block:0,forkHash:"0xa3f5ab08"},{name:"homestead",block:0,forkHash:"0xa3f5ab08"},{name:"tangerineWhistle",block:0,forkHash:"0xa3f5ab08"},{name:"spuriousDragon",block:0,forkHash:"0xa3f5ab08"},{name:"byzantium",block:0,forkHash:"0xa3f5ab08"},{name:"constantinople",block:0,forkHash:"0xa3f5ab08"},{name:"petersburg",block:0,forkHash:"0xa3f5ab08"},{name:"istanbul",block:1561651,forkHash:"0xc25efa5c"},{name:"berlin",block:4460644,forkHash:"0x757a1c47"},{name:"london",block:5062605,forkHash:"0xb8c6299d"},{name:"paris",ttd:"10790000",block:7382819,forkHash:"0xb8c6299d"},{name:"mergeForkIdTransition",block:null,forkHash:null},{name:"shanghai",block:null,timestamp:"1678832736",forkHash:"0xf9843abf"},{name:"cancun",block:null,timestamp:"1705473120",forkHash:"0x70cc14e2"}],bootstrapNodes:[{ip:"51.141.78.53",port:30303,id:"011f758e6552d105183b1761c5e2dea0111bc20fd5f6422bc7f91e0fabbec9a6595caf6239b37feb773dddd3f87240d99d859431891e4a642cf2a0a9e6cbb98a",location:"",comment:"Upstream bootnode 1"},{ip:"13.93.54.137",port:30303,id:"176b9417f511d05b6b2cf3e34b756cf0a7096b3094572a8f6ef4cdcb9d1f9d00683bf0f83347eebdf3b81c3521c2332086d9592802230bf528eaf606a1d9677b",location:"",comment:"Upstream bootnode 2"},{ip:"94.237.54.114",port:30313,id:"46add44b9f13965f7b9875ac6b85f016f341012d84f975377573800a863526f4da19ae2c620ec73d11591fa9510e992ecc03ad0751f53cc02f7c7ed6d55c7291",location:"",comment:"Upstream bootnode 3"},{ip:"18.218.250.66",port:30313,id:"b5948a2d3e9d486c4d75bf32713221c2bd6cf86463302339299bd227dc2e276cd5a1c7ca4f43a0e9122fe9af884efed563bd2a1fd28661f3b5f5ad7bf1de5949",location:"",comment:"Upstream bootnode 4"},{ip:"3.11.147.67",port:30303,id:"a61215641fb8714a373c80edbfa0ea8878243193f57c96eeb44d0bc019ef295abd4e044fd619bfc4c59731a73fb79afe84e9ab6da0c743ceb479cbb6d263fa91",location:"",comment:"Ethereum Foundation bootnode"},{ip:"51.15.116.226",port:30303,id:"a869b02cec167211fb4815a82941db2e7ed2936fd90e78619c53eb17753fcf0207463e3419c264e2a1dd8786de0df7e68cf99571ab8aeb7c4e51367ef186b1dd",location:"",comment:"Goerli Initiative bootnode"},{ip:"51.15.119.157",port:30303,id:"807b37ee4816ecf407e9112224494b74dd5933625f655962d892f2f0f02d7fbbb3e2a94cf87a96609526f30c998fd71e93e2f53015c558ffc8b03eceaf30ee33",location:"",comment:"Goerli Initiative bootnode"},{ip:"51.15.119.157",port:40303,id:"a59e33ccd2b3e52d578f1fbd70c6f9babda2650f0760d6ff3b37742fdcdfdb3defba5d56d315b40c46b70198c7621e63ffa3f987389c7118634b0fefbbdfa7fd",location:"",comment:"Goerli Initiative bootnode"}],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.goerli.ethdisco.net"]},sepolia:{name:"sepolia",chainId:11155111,networkId:11155111,defaultHardfork:"shanghai",consensus:{type:"pow",algorithm:"ethash",ethash:{}},comment:"PoW test network to replace Ropsten",url:"https://github.com/ethereum/go-ethereum/pull/23730",genesis:{timestamp:"0x6159af19",gasLimit:3e7,difficulty:131072,nonce:"0x0000000000000000",extraData:"0x5365706f6c69612c20417468656e732c204174746963612c2047726565636521"},hardforks:[{name:"chainstart",block:0,forkHash:"0xfe3366e7"},{name:"homestead",block:0,forkHash:"0xfe3366e7"},{name:"tangerineWhistle",block:0,forkHash:"0xfe3366e7"},{name:"spuriousDragon",block:0,forkHash:"0xfe3366e7"},{name:"byzantium",block:0,forkHash:"0xfe3366e7"},{name:"constantinople",block:0,forkHash:"0xfe3366e7"},{name:"petersburg",block:0,forkHash:"0xfe3366e7"},{name:"istanbul",block:0,forkHash:"0xfe3366e7"},{name:"muirGlacier",block:0,forkHash:"0xfe3366e7"},{name:"berlin",block:0,forkHash:"0xfe3366e7"},{name:"london",block:0,forkHash:"0xfe3366e7"},{name:"paris",ttd:"17000000000000000",block:1450409,forkHash:"0xfe3366e7"},{name:"mergeForkIdTransition",block:1735371,forkHash:"0xb96cbd13"},{name:"shanghai",block:null,timestamp:"1677557088",forkHash:"0xf7f9bc08"},{name:"cancun",block:null,timestamp:"1706655072",forkHash:"0x88cf81d9"}],bootstrapNodes:[{ip:"18.168.182.86",port:30303,id:"9246d00bc8fd1742e5ad2428b80fc4dc45d786283e05ef6edbd9002cbc335d40998444732fbe921cb88e1d2c73d1b1de53bae6a2237996e9bfe14f871baf7066",location:"",comment:"geth"},{ip:"52.14.151.177",port:30303,id:"ec66ddcf1a974950bd4c782789a7e04f8aa7110a72569b6e65fcd51e937e74eed303b1ea734e4d19cfaec9fbff9b6ee65bf31dcb50ba79acce9dd63a6aca61c7",location:"",comment:"besu"},{ip:"165.22.196.173",port:30303,id:"ce970ad2e9daa9e14593de84a8b49da3d54ccfdf83cbc4fe519cb8b36b5918ed4eab087dedd4a62479b8d50756b492d5f762367c8d20329a7854ec01547568a6",location:"",comment:"EF"},{ip:"65.108.95.67",port:30303,id:"075503b13ed736244896efcde2a992ec0b451357d46cb7a8132c0384721742597fc8f0d91bbb40bb52e7d6e66728d36a1fda09176294e4a30cfac55dcce26bc6",location:"",comment:"lodestar"}],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.sepolia.ethdisco.net"]},holesky:{name:"holesky",chainId:17e3,networkId:17e3,defaultHardfork:"paris",consensus:{type:"pos",algorithm:"casper"},comment:"PoS test network to replace Goerli",url:"https://github.com/eth-clients/holesky/",genesis:{baseFeePerGas:"0x3B9ACA00",difficulty:"0x01",extraData:"0x",gasLimit:"0x17D7840",nonce:"0x0000000000001234",timestamp:"0x65156994"},hardforks:[{name:"chainstart",block:0,forkHash:"0xc61a6098"},{name:"homestead",block:0,forkHash:"0xc61a6098"},{name:"tangerineWhistle",block:0,forkHash:"0xc61a6098"},{name:"spuriousDragon",block:0,forkHash:"0xc61a6098"},{name:"byzantium",block:0,forkHash:"0xc61a6098"},{name:"constantinople",block:0,forkHash:"0xc61a6098"},{name:"petersburg",block:0,forkHash:"0xc61a6098"},{name:"istanbul",block:0,forkHash:"0xc61a6098"},{name:"muirGlacier",block:0,forkHash:"0xc61a6098"},{name:"berlin",block:0,forkHash:"0xc61a6098"},{name:"london",block:0,forkHash:"0xc61a6098"},{name:"paris",ttd:"0",block:0,forkHash:"0xc61a6098"},{name:"mergeForkIdTransition",block:0,forkHash:"0xc61a6098"},{name:"shanghai",block:null,timestamp:"1696000704",forkHash:"0xfd4f016b"},{name:"cancun",block:null,timestamp:"1707305664",forkHash:"0x9b192ad0"}],bootstrapNodes:[{ip:"146.190.13.128",port:30303,id:"ac906289e4b7f12df423d654c5a962b6ebe5b3a74cc9e06292a85221f9a64a6f1cfdd6b714ed6dacef51578f92b34c60ee91e9ede9c7f8fadc4d347326d95e2b",location:"",comment:"bootnode 1"},{ip:"178.128.136.233",port:30303,id:"a3435a0155a3e837c02f5e7f5662a2f1fbc25b48e4dc232016e1c51b544cb5b4510ef633ea3278c0e970fa8ad8141e2d4d0f9f95456c537ff05fdf9b31c15072",location:"",comment:"bootnode 2"}],dnsNetworks:["enrtree://AKA3AM6LPBYEUDMVNU3BSVQJ5AD45Y7YPOHJLEF6W26QOE4VTUDPE@all.holesky.ethdisco.net"]},kaustinen:{name:"kaustinen",chainId:69420,networkId:69420,defaultHardfork:"prague",consensus:{type:"pos",algorithm:"casper"},comment:"Verkle kaustinen testnet 2 (likely temporary, do not hard-wire into production code)",url:"https://github.com/eth-clients/kaustinen/",genesis:{difficulty:"0x01",extraData:"0x",gasLimit:"0x17D7840",nonce:"0x0000000000001234",timestamp:"0x65608a64"},hardforks:[{name:"chainstart",block:0},{name:"homestead",block:0},{name:"tangerineWhistle",block:0},{name:"spuriousDragon",block:0},{name:"byzantium",block:0},{name:"constantinople",block:0},{name:"petersburg",block:0},{name:"istanbul",block:0},{name:"berlin",block:0},{name:"london",block:0},{name:"paris",ttd:"0",block:0},{name:"mergeForkIdTransition",block:0},{name:"shanghai",block:null,timestamp:"0"},{name:"prague",block:null,timestamp:"1700825700"}],bootstrapNodes:[],dnsNetworks:[]}};let B8=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(B8=new Int32Array(B8));const N8=(e,t)=>((e,t)=>{let r=0===t?0:~t;for(let t=0;t>>8;return~r})(e,t)>>>0;var R8,F8,L8,U8,j8,D8;!function(e){e[e.Mainnet=1]="Mainnet",e[e.Goerli=5]="Goerli",e[e.Sepolia=11155111]="Sepolia",e[e.Holesky=17e3]="Holesky",e[e.Kaustinen=69420]="Kaustinen"}(R8||(R8={})),R8.Mainnet,J3("0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544"),R8.Goerli,J3("0x5d6cded585e73c4e322c30c2f782a336316f17dd85a4863b9d838d2d4b8b3008"),R8.Sepolia,J3("0x5eb6e371a698b8d68f665192350ffcecbbbf322916f4b51bd79bb6887da3f494"),R8.Holesky,J3("0x69d8c9d72f6fa4ad42d4702b433707212f90db395eb54dc20bc85de253788783"),R8.Kaustinen,J3("0x5e8519756841faf0b2c28951c451b61a4b407b70a5ce5b57992f4bec973173ff"),function(e){e.Chainstart="chainstart",e.Homestead="homestead",e.Dao="dao",e.TangerineWhistle="tangerineWhistle",e.SpuriousDragon="spuriousDragon",e.Byzantium="byzantium",e.Constantinople="constantinople",e.Petersburg="petersburg",e.Istanbul="istanbul",e.MuirGlacier="muirGlacier",e.Berlin="berlin",e.London="london",e.ArrowGlacier="arrowGlacier",e.GrayGlacier="grayGlacier",e.MergeForkIdTransition="mergeForkIdTransition",e.Paris="paris",e.Shanghai="shanghai",e.Cancun="cancun",e.Prague="prague"}(F8||(F8={})),function(e){e.ProofOfStake="pos",e.ProofOfWork="pow",e.ProofOfAuthority="poa"}(L8||(L8={})),function(e){e.Ethash="ethash",e.Clique="clique",e.Casper="casper"}(U8||(U8={})),function(e){e.PolygonMainnet="polygon-mainnet",e.PolygonMumbai="polygon-mumbai",e.ArbitrumOne="arbitrum-one",e.xDaiChain="x-dai-chain",e.OptimisticKovan="optimistic-kovan",e.OptimisticEthereum="optimistic-ethereum"}(j8||(j8={})),function(e){e.Stagnant="stagnant",e.Draft="draft",e.Review="review",e.Final="final"}(D8||(D8={}));const z8={1153:{comment:"Transient storage opcodes",url:"https://eips.ethereum.org/EIPS/eip-1153",status:D8.Review,minimumHardfork:F8.Chainstart,requiredEIPs:[],gasPrices:{tstore:{v:100,d:"Base fee of the TSTORE opcode"},tload:{v:100,d:"Base fee of the TLOAD opcode"}}},1559:{comment:"Fee market change for ETH 1.0 chain",url:"https://eips.ethereum.org/EIPS/eip-1559",status:D8.Final,minimumHardfork:F8.Berlin,requiredEIPs:[2930],gasConfig:{baseFeeMaxChangeDenominator:{v:8,d:"Maximum base fee change denominator"},elasticityMultiplier:{v:2,d:"Maximum block gas target elasticity"},initialBaseFee:{v:1e9,d:"Initial base fee on first EIP1559 block"}}},2315:{comment:"Simple subroutines for the EVM",url:"https://eips.ethereum.org/EIPS/eip-2315",status:D8.Draft,minimumHardfork:F8.Istanbul,requiredEIPs:[],gasPrices:{beginsub:{v:2,d:"Base fee of the BEGINSUB opcode"},returnsub:{v:5,d:"Base fee of the RETURNSUB opcode"},jumpsub:{v:10,d:"Base fee of the JUMPSUB opcode"}}},2565:{comment:"ModExp gas cost",url:"https://eips.ethereum.org/EIPS/eip-2565",status:D8.Final,minimumHardfork:F8.Byzantium,requiredEIPs:[],gasPrices:{modexpGquaddivisor:{v:3,d:"Gquaddivisor from modexp precompile for gas calculation"}}},2718:{comment:"Typed Transaction Envelope",url:"https://eips.ethereum.org/EIPS/eip-2718",status:D8.Final,minimumHardfork:F8.Chainstart,requiredEIPs:[]},2929:{comment:"Gas cost increases for state access opcodes",url:"https://eips.ethereum.org/EIPS/eip-2929",status:D8.Final,minimumHardfork:F8.Chainstart,requiredEIPs:[],gasPrices:{coldsload:{v:2100,d:"Gas cost of the first read of storage from a given location (per transaction)"},coldaccountaccess:{v:2600,d:"Gas cost of the first read of a given address (per transaction)"},warmstorageread:{v:100,d:"Gas cost of reading storage locations which have already loaded 'cold'"},sstoreCleanGasEIP2200:{v:2900,d:"Once per SSTORE operation from clean non-zero to something else"},sstoreNoopGasEIP2200:{v:100,d:"Once per SSTORE operation if the value doesn't change"},sstoreDirtyGasEIP2200:{v:100,d:"Once per SSTORE operation if a dirty value is changed"},sstoreInitRefundEIP2200:{v:19900,d:"Once per SSTORE operation for resetting to the original zero value"},sstoreCleanRefundEIP2200:{v:4900,d:"Once per SSTORE operation for resetting to the original non-zero value"},call:{v:0,d:"Base fee of the CALL opcode"},callcode:{v:0,d:"Base fee of the CALLCODE opcode"},delegatecall:{v:0,d:"Base fee of the DELEGATECALL opcode"},staticcall:{v:0,d:"Base fee of the STATICCALL opcode"},balance:{v:0,d:"Base fee of the BALANCE opcode"},extcodesize:{v:0,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:0,d:"Base fee of the EXTCODECOPY opcode"},extcodehash:{v:0,d:"Base fee of the EXTCODEHASH opcode"},sload:{v:0,d:"Base fee of the SLOAD opcode"},sstore:{v:0,d:"Base fee of the SSTORE opcode"}}},2930:{comment:"Optional access lists",url:"https://eips.ethereum.org/EIPS/eip-2930",status:D8.Final,minimumHardfork:F8.Istanbul,requiredEIPs:[2718,2929],gasPrices:{accessListStorageKeyCost:{v:1900,d:"Gas cost per storage key in an Access List transaction"},accessListAddressCost:{v:2400,d:"Gas cost per storage key in an Access List transaction"}}},2935:{comment:"Save historical block hashes in state (Verkle related usage, UNSTABLE)",url:"https://github.com/gballet/EIPs/pull/3/commits/2e9ac09a142b0d9fb4db0b8d4609f92e5d9990c5",status:D8.Draft,minimumHardfork:F8.Chainstart,requiredEIPs:[],vm:{historyStorageAddress:{v:BigInt("0xfffffffffffffffffffffffffffffffffffffffe"),d:"The address where the historical blockhashes are stored"},historyServeWindow:{v:BigInt(256),d:"The amount of blocks to be served by the historical blockhash contract"}}},3074:{comment:"AUTH and AUTHCALL opcodes",url:"https://eips.ethereum.org/EIPS/eip-3074",status:D8.Review,minimumHardfork:F8.London,requiredEIPs:[],gasPrices:{auth:{v:3100,d:"Gas cost of the AUTH opcode"},authcall:{v:0,d:"Gas cost of the AUTHCALL opcode"},authcallValueTransfer:{v:6700,d:"Paid for CALL when the value transfer is non-zero"}}},3198:{comment:"BASEFEE opcode",url:"https://eips.ethereum.org/EIPS/eip-3198",status:D8.Final,minimumHardfork:F8.London,requiredEIPs:[],gasPrices:{basefee:{v:2,d:"Gas cost of the BASEFEE opcode"}}},3529:{comment:"Reduction in refunds",url:"https://eips.ethereum.org/EIPS/eip-3529",status:D8.Final,minimumHardfork:F8.Berlin,requiredEIPs:[2929],gasConfig:{maxRefundQuotient:{v:5,d:"Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)"}},gasPrices:{selfdestructRefund:{v:0,d:"Refunded following a selfdestruct operation"},sstoreClearRefundEIP2200:{v:4800,d:"Once per SSTORE operation for clearing an originally existing storage slot"}}},3540:{comment:"EVM Object Format (EOF) v1",url:"https://eips.ethereum.org/EIPS/eip-3540",status:D8.Review,minimumHardfork:F8.London,requiredEIPs:[3541]},3541:{comment:"Reject new contracts starting with the 0xEF byte",url:"https://eips.ethereum.org/EIPS/eip-3541",status:D8.Final,minimumHardfork:F8.Berlin,requiredEIPs:[]},3554:{comment:"Difficulty Bomb Delay to December 1st 2021",url:"https://eips.ethereum.org/EIPS/eip-3554",status:D8.Final,minimumHardfork:F8.MuirGlacier,requiredEIPs:[],pow:{difficultyBombDelay:{v:95e5,d:"the amount of blocks to delay the difficulty bomb with"}}},3607:{comment:"Reject transactions from senders with deployed code",url:"https://eips.ethereum.org/EIPS/eip-3607",status:D8.Final,minimumHardfork:F8.Chainstart,requiredEIPs:[]},3651:{comment:"Warm COINBASE",url:"https://eips.ethereum.org/EIPS/eip-3651",status:D8.Review,minimumHardfork:F8.London,requiredEIPs:[2929]},3670:{comment:"EOF - Code Validation",url:"https://eips.ethereum.org/EIPS/eip-3670",status:"Review",minimumHardfork:F8.London,requiredEIPs:[3540],gasConfig:{},gasPrices:{},vm:{},pow:{}},3675:{comment:"Upgrade consensus to Proof-of-Stake",url:"https://eips.ethereum.org/EIPS/eip-3675",status:D8.Final,minimumHardfork:F8.London,requiredEIPs:[]},3855:{comment:"PUSH0 instruction",url:"https://eips.ethereum.org/EIPS/eip-3855",status:D8.Review,minimumHardfork:F8.Chainstart,requiredEIPs:[],gasPrices:{push0:{v:2,d:"Base fee of the PUSH0 opcode"}}},3860:{comment:"Limit and meter initcode",url:"https://eips.ethereum.org/EIPS/eip-3860",status:D8.Review,minimumHardfork:F8.SpuriousDragon,requiredEIPs:[],gasPrices:{initCodeWordCost:{v:2,d:"Gas to pay for each word (32 bytes) of initcode when creating a contract"}},vm:{maxInitCodeSize:{v:49152,d:"Maximum length of initialization code when creating a contract"}}},4345:{comment:"Difficulty Bomb Delay to June 2022",url:"https://eips.ethereum.org/EIPS/eip-4345",status:D8.Final,minimumHardfork:F8.London,requiredEIPs:[],pow:{difficultyBombDelay:{v:107e5,d:"the amount of blocks to delay the difficulty bomb with"}}},4399:{comment:"Supplant DIFFICULTY opcode with PREVRANDAO",url:"https://eips.ethereum.org/EIPS/eip-4399",status:D8.Review,minimumHardfork:F8.London,requiredEIPs:[],gasPrices:{prevrandao:{v:2,d:"Base fee of the PREVRANDAO opcode (previously DIFFICULTY)"}}},4788:{comment:"Beacon block root in the EVM",url:"https://eips.ethereum.org/EIPS/eip-4788",status:D8.Draft,minimumHardfork:F8.Cancun,requiredEIPs:[],gasPrices:{},vm:{historicalRootsLength:{v:8191,d:"The modulo parameter of the beaconroot ring buffer in the beaconroot statefull precompile"}}},4844:{comment:"Shard Blob Transactions",url:"https://eips.ethereum.org/EIPS/eip-4844",status:D8.Draft,minimumHardfork:F8.Paris,requiredEIPs:[1559,2718,2930,4895],gasConfig:{blobGasPerBlob:{v:131072,d:"The base fee for blob gas per blob"},targetBlobGasPerBlock:{v:393216,d:"The target blob gas consumed per block"},maxblobGasPerBlock:{v:786432,d:"The max blob gas allowable per block"},blobGasPriceUpdateFraction:{v:3338477,d:"The denominator used in the exponential when calculating a blob gas price"}},gasPrices:{simpleGasPerBlob:{v:12e3,d:"The basic gas fee for each blob"},minBlobGasPrice:{v:1,d:"The minimum fee per blob gas"},kzgPointEvaluationGasPrecompilePrice:{v:5e4,d:"The fee associated with the point evaluation precompile"},blobhash:{v:3,d:"Base fee of the BLOBHASH opcode"}},sharding:{blobCommitmentVersionKzg:{v:1,d:"The number indicated a versioned hash is a KZG commitment"},fieldElementsPerBlob:{v:4096,d:"The number of field elements allowed per blob"}}},4895:{comment:"Beacon chain push withdrawals as operations",url:"https://eips.ethereum.org/EIPS/eip-4895",status:D8.Review,minimumHardfork:F8.Paris,requiredEIPs:[]},5133:{comment:"Delaying Difficulty Bomb to mid-September 2022",url:"https://eips.ethereum.org/EIPS/eip-5133",status:D8.Draft,minimumHardfork:F8.GrayGlacier,requiredEIPs:[],pow:{difficultyBombDelay:{v:114e5,d:"the amount of blocks to delay the difficulty bomb with"}}},5656:{comment:"MCOPY - Memory copying instruction",url:"https://eips.ethereum.org/EIPS/eip-5656",status:D8.Draft,minimumHardfork:F8.Shanghai,requiredEIPs:[],gasPrices:{mcopy:{v:3,d:"Base fee of the MCOPY opcode"}}},6780:{comment:"SELFDESTRUCT only in same transaction",url:"https://eips.ethereum.org/EIPS/eip-6780",status:D8.Draft,minimumHardfork:F8.London,requiredEIPs:[]},6800:{comment:"Ethereum state using a unified verkle tree (experimental)",url:"https://github.com/ethereum/EIPs/pull/6800",status:D8.Draft,minimumHardfork:F8.London,requiredEIPs:[]},7516:{comment:"BLOBBASEFEE opcode",url:"https://eips.ethereum.org/EIPS/eip-7516",status:D8.Draft,minimumHardfork:F8.Paris,requiredEIPs:[4844],gasPrices:{blobbasefee:{v:2,d:"Gas cost of the BLOBBASEFEE opcode"}}}};var $8;!function(e){e.Draft="draft",e.Review="review",e.Final="final"}($8||($8={}));const H8={chainstart:{name:"chainstart",comment:"Start of the Ethereum main chain",url:"",status:$8.Final,gasConfig:{minGasLimit:{v:5e3,d:"Minimum the gas limit may ever be"},gasLimitBoundDivisor:{v:1024,d:"The bound divisor of the gas limit, used in update calculations"},maxRefundQuotient:{v:2,d:"Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)"}},gasPrices:{base:{v:2,d:"Gas base cost, used e.g. for ChainID opcode (Istanbul)"},exp:{v:10,d:"Base fee of the EXP opcode"},expByte:{v:10,d:"Times ceil(log256(exponent)) for the EXP instruction"},keccak256:{v:30,d:"Base fee of the SHA3 opcode"},keccak256Word:{v:6,d:"Once per word of the SHA3 operation's data"},sload:{v:50,d:"Base fee of the SLOAD opcode"},sstoreSet:{v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero"},sstoreReset:{v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero"},sstoreRefund:{v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero"},jumpdest:{v:1,d:"Base fee of the JUMPDEST opcode"},log:{v:375,d:"Base fee of the LOG opcode"},logData:{v:8,d:"Per byte in a LOG* operation's data"},logTopic:{v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas"},create:{v:32e3,d:"Base fee of the CREATE opcode"},call:{v:40,d:"Base fee of the CALL opcode"},callStipend:{v:2300,d:"Free gas given at beginning of call"},callValueTransfer:{v:9e3,d:"Paid for CALL when the value transfor is non-zero"},callNewAccount:{v:25e3,d:"Paid for CALL when the destination address didn't exist prior"},selfdestructRefund:{v:24e3,d:"Refunded following a selfdestruct operation"},memory:{v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL"},quadCoeffDiv:{v:512,d:"Divisor for the quadratic particle of the memory cost equation"},createData:{v:200,d:""},tx:{v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions"},txCreation:{v:32e3,d:"The cost of creating a contract via tx"},txDataZero:{v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions"},txDataNonZero:{v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},copy:{v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added"},ecRecover:{v:3e3,d:""},sha256:{v:60,d:""},sha256Word:{v:12,d:""},ripemd160:{v:600,d:""},ripemd160Word:{v:120,d:""},identity:{v:15,d:""},identityWord:{v:3,d:""},stop:{v:0,d:"Base fee of the STOP opcode"},add:{v:3,d:"Base fee of the ADD opcode"},mul:{v:5,d:"Base fee of the MUL opcode"},sub:{v:3,d:"Base fee of the SUB opcode"},div:{v:5,d:"Base fee of the DIV opcode"},sdiv:{v:5,d:"Base fee of the SDIV opcode"},mod:{v:5,d:"Base fee of the MOD opcode"},smod:{v:5,d:"Base fee of the SMOD opcode"},addmod:{v:8,d:"Base fee of the ADDMOD opcode"},mulmod:{v:8,d:"Base fee of the MULMOD opcode"},signextend:{v:5,d:"Base fee of the SIGNEXTEND opcode"},lt:{v:3,d:"Base fee of the LT opcode"},gt:{v:3,d:"Base fee of the GT opcode"},slt:{v:3,d:"Base fee of the SLT opcode"},sgt:{v:3,d:"Base fee of the SGT opcode"},eq:{v:3,d:"Base fee of the EQ opcode"},iszero:{v:3,d:"Base fee of the ISZERO opcode"},and:{v:3,d:"Base fee of the AND opcode"},or:{v:3,d:"Base fee of the OR opcode"},xor:{v:3,d:"Base fee of the XOR opcode"},not:{v:3,d:"Base fee of the NOT opcode"},byte:{v:3,d:"Base fee of the BYTE opcode"},address:{v:2,d:"Base fee of the ADDRESS opcode"},balance:{v:20,d:"Base fee of the BALANCE opcode"},origin:{v:2,d:"Base fee of the ORIGIN opcode"},caller:{v:2,d:"Base fee of the CALLER opcode"},callvalue:{v:2,d:"Base fee of the CALLVALUE opcode"},calldataload:{v:3,d:"Base fee of the CALLDATALOAD opcode"},calldatasize:{v:2,d:"Base fee of the CALLDATASIZE opcode"},calldatacopy:{v:3,d:"Base fee of the CALLDATACOPY opcode"},codesize:{v:2,d:"Base fee of the CODESIZE opcode"},codecopy:{v:3,d:"Base fee of the CODECOPY opcode"},gasprice:{v:2,d:"Base fee of the GASPRICE opcode"},extcodesize:{v:20,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:20,d:"Base fee of the EXTCODECOPY opcode"},blockhash:{v:20,d:"Base fee of the BLOCKHASH opcode"},coinbase:{v:2,d:"Base fee of the COINBASE opcode"},timestamp:{v:2,d:"Base fee of the TIMESTAMP opcode"},number:{v:2,d:"Base fee of the NUMBER opcode"},difficulty:{v:2,d:"Base fee of the DIFFICULTY opcode"},gaslimit:{v:2,d:"Base fee of the GASLIMIT opcode"},pop:{v:2,d:"Base fee of the POP opcode"},mload:{v:3,d:"Base fee of the MLOAD opcode"},mstore:{v:3,d:"Base fee of the MSTORE opcode"},mstore8:{v:3,d:"Base fee of the MSTORE8 opcode"},sstore:{v:0,d:"Base fee of the SSTORE opcode"},jump:{v:8,d:"Base fee of the JUMP opcode"},jumpi:{v:10,d:"Base fee of the JUMPI opcode"},pc:{v:2,d:"Base fee of the PC opcode"},msize:{v:2,d:"Base fee of the MSIZE opcode"},gas:{v:2,d:"Base fee of the GAS opcode"},push:{v:3,d:"Base fee of the PUSH opcode"},dup:{v:3,d:"Base fee of the DUP opcode"},swap:{v:3,d:"Base fee of the SWAP opcode"},callcode:{v:40,d:"Base fee of the CALLCODE opcode"},return:{v:0,d:"Base fee of the RETURN opcode"},invalid:{v:0,d:"Base fee of the INVALID opcode"},selfdestruct:{v:0,d:"Base fee of the SELFDESTRUCT opcode"}},vm:{stackLimit:{v:1024,d:"Maximum size of VM stack allowed"},callCreateDepth:{v:1024,d:"Maximum depth of call/create stack"},maxExtraDataSize:{v:32,d:"Maximum size extra data may be after Genesis"}},pow:{minimumDifficulty:{v:131072,d:"The minimum that the difficulty may ever be"},difficultyBoundDivisor:{v:2048,d:"The bound divisor of the difficulty, used in the update calculations"},durationLimit:{v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not"},epochDuration:{v:3e4,d:"Duration between proof-of-work epochs"},timebombPeriod:{v:1e5,d:"Exponential difficulty timebomb period"},minerReward:{v:BigInt("5000000000000000000"),d:"the amount a miner get rewarded for mining a block"},difficultyBombDelay:{v:0,d:"the amount of blocks to delay the difficulty bomb with"}}},homestead:{name:"homestead",comment:"Homestead hardfork with protocol and network changes",url:"https://eips.ethereum.org/EIPS/eip-606",status:$8.Final,gasPrices:{delegatecall:{v:40,d:"Base fee of the DELEGATECALL opcode"}}},dao:{name:"dao",comment:"DAO rescue hardfork",url:"https://eips.ethereum.org/EIPS/eip-779",status:$8.Final},tangerineWhistle:{name:"tangerineWhistle",comment:"Hardfork with gas cost changes for IO-heavy operations",url:"https://eips.ethereum.org/EIPS/eip-608",status:$8.Final,gasPrices:{sload:{v:200,d:"Once per SLOAD operation"},call:{v:700,d:"Once per CALL operation & message call transaction"},extcodesize:{v:700,d:"Base fee of the EXTCODESIZE opcode"},extcodecopy:{v:700,d:"Base fee of the EXTCODECOPY opcode"},balance:{v:400,d:"Base fee of the BALANCE opcode"},delegatecall:{v:700,d:"Base fee of the DELEGATECALL opcode"},callcode:{v:700,d:"Base fee of the CALLCODE opcode"},selfdestruct:{v:5e3,d:"Base fee of the SELFDESTRUCT opcode"}}},spuriousDragon:{name:"spuriousDragon",comment:"HF with EIPs for simple replay attack protection, EXP cost increase, state trie clearing, contract code size limit",url:"https://eips.ethereum.org/EIPS/eip-607",status:$8.Final,gasPrices:{expByte:{v:50,d:"Times ceil(log256(exponent)) for the EXP instruction"}},vm:{maxCodeSize:{v:24576,d:"Maximum length of contract code"}}},byzantium:{name:"byzantium",comment:"Hardfork with new precompiles, instructions and other protocol changes",url:"https://eips.ethereum.org/EIPS/eip-609",status:$8.Final,gasPrices:{modexpGquaddivisor:{v:20,d:"Gquaddivisor from modexp precompile for gas calculation"},ecAdd:{v:500,d:"Gas costs for curve addition precompile"},ecMul:{v:4e4,d:"Gas costs for curve multiplication precompile"},ecPairing:{v:1e5,d:"Base gas costs for curve pairing precompile"},ecPairingWord:{v:8e4,d:"Gas costs regarding curve pairing precompile input length"},revert:{v:0,d:"Base fee of the REVERT opcode"},staticcall:{v:700,d:"Base fee of the STATICCALL opcode"},returndatasize:{v:2,d:"Base fee of the RETURNDATASIZE opcode"},returndatacopy:{v:3,d:"Base fee of the RETURNDATACOPY opcode"}},pow:{minerReward:{v:BigInt("3000000000000000000"),d:"the amount a miner get rewarded for mining a block"},difficultyBombDelay:{v:3e6,d:"the amount of blocks to delay the difficulty bomb with"}}},constantinople:{name:"constantinople",comment:"Postponed hardfork including EIP-1283 (SSTORE gas metering changes)",url:"https://eips.ethereum.org/EIPS/eip-1013",status:$8.Final,gasPrices:{netSstoreNoopGas:{v:200,d:"Once per SSTORE operation if the value doesn't change"},netSstoreInitGas:{v:2e4,d:"Once per SSTORE operation from clean zero"},netSstoreCleanGas:{v:5e3,d:"Once per SSTORE operation from clean non-zero"},netSstoreDirtyGas:{v:200,d:"Once per SSTORE operation from dirty"},netSstoreClearRefund:{v:15e3,d:"Once per SSTORE operation for clearing an originally existing storage slot"},netSstoreResetRefund:{v:4800,d:"Once per SSTORE operation for resetting to the original non-zero value"},netSstoreResetClearRefund:{v:19800,d:"Once per SSTORE operation for resetting to the original zero value"},shl:{v:3,d:"Base fee of the SHL opcode"},shr:{v:3,d:"Base fee of the SHR opcode"},sar:{v:3,d:"Base fee of the SAR opcode"},extcodehash:{v:400,d:"Base fee of the EXTCODEHASH opcode"},create2:{v:32e3,d:"Base fee of the CREATE2 opcode"}},pow:{minerReward:{v:BigInt("2000000000000000000"),d:"The amount a miner gets rewarded for mining a block"},difficultyBombDelay:{v:5e6,d:"the amount of blocks to delay the difficulty bomb with"}}},petersburg:{name:"petersburg",comment:"Aka constantinopleFix, removes EIP-1283, activate together with or after constantinople",url:"https://eips.ethereum.org/EIPS/eip-1716",status:$8.Final,gasPrices:{netSstoreNoopGas:{v:null,d:"Removed along EIP-1283"},netSstoreInitGas:{v:null,d:"Removed along EIP-1283"},netSstoreCleanGas:{v:null,d:"Removed along EIP-1283"},netSstoreDirtyGas:{v:null,d:"Removed along EIP-1283"},netSstoreClearRefund:{v:null,d:"Removed along EIP-1283"},netSstoreResetRefund:{v:null,d:"Removed along EIP-1283"},netSstoreResetClearRefund:{v:null,d:"Removed along EIP-1283"}}},istanbul:{name:"istanbul",comment:"HF targeted for December 2019 following the Constantinople/Petersburg HF",url:"https://eips.ethereum.org/EIPS/eip-1679",status:$8.Final,gasConfig:{},gasPrices:{blake2Round:{v:1,d:"Gas cost per round for the Blake2 F precompile"},ecAdd:{v:150,d:"Gas costs for curve addition precompile"},ecMul:{v:6e3,d:"Gas costs for curve multiplication precompile"},ecPairing:{v:45e3,d:"Base gas costs for curve pairing precompile"},ecPairingWord:{v:34e3,d:"Gas costs regarding curve pairing precompile input length"},txDataNonZero:{v:16,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions"},sstoreSentryGasEIP2200:{v:2300,d:"Minimum gas required to be present for an SSTORE call, not consumed"},sstoreNoopGasEIP2200:{v:800,d:"Once per SSTORE operation if the value doesn't change"},sstoreDirtyGasEIP2200:{v:800,d:"Once per SSTORE operation if a dirty value is changed"},sstoreInitGasEIP2200:{v:2e4,d:"Once per SSTORE operation from clean zero to non-zero"},sstoreInitRefundEIP2200:{v:19200,d:"Once per SSTORE operation for resetting to the original zero value"},sstoreCleanGasEIP2200:{v:5e3,d:"Once per SSTORE operation from clean non-zero to something else"},sstoreCleanRefundEIP2200:{v:4200,d:"Once per SSTORE operation for resetting to the original non-zero value"},sstoreClearRefundEIP2200:{v:15e3,d:"Once per SSTORE operation for clearing an originally existing storage slot"},balance:{v:700,d:"Base fee of the BALANCE opcode"},extcodehash:{v:700,d:"Base fee of the EXTCODEHASH opcode"},chainid:{v:2,d:"Base fee of the CHAINID opcode"},selfbalance:{v:5,d:"Base fee of the SELFBALANCE opcode"},sload:{v:800,d:"Base fee of the SLOAD opcode"}}},muirGlacier:{name:"muirGlacier",comment:"HF to delay the difficulty bomb",url:"https://eips.ethereum.org/EIPS/eip-2384",status:$8.Final,pow:{difficultyBombDelay:{v:9e6,d:"the amount of blocks to delay the difficulty bomb with"}}},berlin:{name:"berlin",comment:"HF targeted for July 2020 following the Muir Glacier HF",url:"https://eips.ethereum.org/EIPS/eip-2070",status:$8.Final,eips:[2565,2929,2718,2930]},london:{name:"london",comment:"HF targeted for July 2021 following the Berlin fork",url:"https://github.com/ethereum/eth1.0-specs/blob/master/network-upgrades/mainnet-upgrades/london.md",status:$8.Final,eips:[1559,3198,3529,3541]},arrowGlacier:{name:"arrowGlacier",comment:"HF to delay the difficulty bomb",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md",status:$8.Final,eips:[4345]},grayGlacier:{name:"grayGlacier",comment:"Delaying the difficulty bomb to Mid September 2022",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/gray-glacier.md",status:$8.Final,eips:[5133]},paris:{name:"paris",comment:"Hardfork to upgrade the consensus mechanism to Proof-of-Stake",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/merge.md",status:$8.Final,consensus:{type:"pos",algorithm:"casper",casper:{}},eips:[3675,4399]},mergeForkIdTransition:{name:"mergeForkIdTransition",comment:"Pre-merge hardfork to fork off non-upgraded clients",url:"https://eips.ethereum.org/EIPS/eip-3675",status:$8.Final,eips:[]},shanghai:{name:"shanghai",comment:"Next feature hardfork after the merge hardfork having withdrawals, warm coinbase, push0, limit/meter initcode",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/shanghai.md",status:$8.Final,eips:[3651,3855,3860,4895]},cancun:{name:"cancun",comment:"Next feature hardfork after shanghai, includes proto-danksharding EIP 4844 blobs (still WIP hence not for production use), transient storage opcodes, parent beacon block root availability in EVM, selfdestruct only in same transaction, and blob base fee opcode",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/cancun.md",status:$8.Final,eips:[1153,4844,4788,5656,6780,7516]},prague:{name:"prague",comment:"Next feature hardfork after cancun, internally used for verkle testing/implementation (incomplete/experimental)",url:"https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/prague.md",status:$8.Draft,eips:[6800]}};function G8(e,t=!0){const{name:r,config:n,difficulty:i,mixHash:o,gasLimit:a,coinbase:s,baseFeePerGas:c,excessBlobGas:u}=e;let{extraData:l,timestamp:f,nonce:d}=e;const h=Number(f),{chainId:p}=n;if(""===l&&(l="0x"),F3(f)||(f=Z3(parseInt(f))),18!==d.length&&(d=function(e){return e&&"0x0"!==e?F3(e)?"0x"+L3(e).padStart(16,"0"):"0x"+e.padStart(16,"0"):"0x0000000000000000"}(d)),n.eip155Block!==n.eip158Block)throw new Error("EIP155 block number must equal EIP 158 block number since both are part of SpuriousDragon hardfork and the client only supports activating the full hardfork");const m={name:r,chainId:p,networkId:p,genesis:{timestamp:f,gasLimit:a,difficulty:i,nonce:d,extraData:l,mixHash:o,coinbase:s,baseFeePerGas:c,excessBlobGas:u},hardfork:void 0,hardforks:[],bootstrapNodes:[],consensus:void 0!==n.clique?{type:"poa",algorithm:"clique",clique:{period:n.clique.period??n.clique.blockperiodseconds,epoch:n.clique.epoch??n.clique.epochlength}}:{type:"pow",algorithm:"ethash",ethash:{}}},b={[F8.Homestead]:{name:"homesteadBlock"},[F8.Dao]:{name:"daoForkBlock"},[F8.TangerineWhistle]:{name:"eip150Block"},[F8.SpuriousDragon]:{name:"eip155Block"},[F8.Byzantium]:{name:"byzantiumBlock"},[F8.Constantinople]:{name:"constantinopleBlock"},[F8.Petersburg]:{name:"petersburgBlock"},[F8.Istanbul]:{name:"istanbulBlock"},[F8.MuirGlacier]:{name:"muirGlacierBlock"},[F8.Berlin]:{name:"berlinBlock"},[F8.London]:{name:"londonBlock"},[F8.MergeForkIdTransition]:{name:"mergeForkBlock",postMerge:t},[F8.Shanghai]:{name:"shanghaiTime",postMerge:!0,isTimestamp:!0},[F8.Cancun]:{name:"cancunTime",postMerge:!0,isTimestamp:!0},[F8.Prague]:{name:"pragueTime",postMerge:!0,isTimestamp:!0}},g=Object.keys(b).reduce(((e,t)=>(e[b[t].name]=t,e)),{}),y=Object.keys(n).filter((e=>void 0!==g[e]&&void 0!==n[e]&&null!==n[e]));m.hardforks=y.map((e=>({name:g[e],block:!0===b[g[e]].isTimestamp||"number"!=typeof n[e]?null:n[e],timestamp:!0===b[g[e]].isTimestamp&&"number"==typeof n[e]?n[e]:void 0}))).filter((e=>null!==e.block||void 0!==e.timestamp)),m.hardforks.sort((function(e,t){return(e.block??1/0)-(t.block??1/0)})),m.hardforks.sort((function(e,t){return(e.timestamp??0)-(t.timestamp??0)}));for(const e of m.hardforks)e.timestamp===h&&(e.timestamp=0);if(void 0!==n.terminalTotalDifficulty){const e={name:F8.Paris,ttd:n.terminalTotalDifficulty,block:null},t=m.hardforks.findIndex((e=>!0===b[e.name]?.postMerge));-1!==t?m.hardforks.splice(t,0,e):m.hardforks.push(e)}const v=m.hardforks.length>0?m.hardforks.slice(-1)[0]:void 0;return m.hardfork=v?.name,m.hardforks.unshift({name:F8.Chainstart,block:0}),m}class q8{constructor(e){this._eips=[],this._paramsCache={},this._activatedEIPsCache=[],this.events=new ge,this._customChains=e.customChains??[],this._chainParams=this.setChain(e.chain),this.DEFAULT_HARDFORK=this._chainParams.defaultHardfork??F8.Shanghai,this.HARDFORK_CHANGES=this.hardforks().map((e=>[e.name,H8[e.name]??(this._chainParams.customHardforks&&this._chainParams.customHardforks[e.name])])),this._hardfork=this.DEFAULT_HARDFORK,void 0!==e.hardfork&&this.setHardfork(e.hardfork),e.eips&&this.setEIPs(e.eips),this.customCrypto=e.customCrypto??{},0===Object.keys(this._paramsCache).length&&(this._buildParamsCache(),this._buildActivatedEIPsCache())}static custom(e,t={}){const r=t.baseChain??"mainnet",n={...q8._getChainParams(r)};if(n.name="custom-chain","string"!=typeof e)return new q8({chain:{...n,...e},...t});if(e===j8.PolygonMainnet)return q8.custom({name:j8.PolygonMainnet,chainId:137,networkId:137},t);if(e===j8.PolygonMumbai)return q8.custom({name:j8.PolygonMumbai,chainId:80001,networkId:80001},t);if(e===j8.ArbitrumOne)return q8.custom({name:j8.ArbitrumOne,chainId:42161,networkId:42161},t);if(e===j8.xDaiChain)return q8.custom({name:j8.xDaiChain,chainId:100,networkId:100},t);if(e===j8.OptimisticKovan)return q8.custom({name:j8.OptimisticKovan,chainId:69,networkId:69},{hardfork:F8.Berlin,...t});if(e===j8.OptimisticEthereum)return q8.custom({name:j8.OptimisticEthereum,chainId:10,networkId:10},{hardfork:F8.Berlin,...t});throw new Error(`Custom chain ${e} not supported`)}static fromGethGenesis(e,{chain:t,eips:r,genesisHash:n,hardfork:i,mergeForkIdPostMerge:o,customCrypto:a}){const s=function(e,t,r){try{const n=["config","difficulty","gasLimit","nonce","alloc"];if(n.some((t=>!(t in e)))){const t=n.filter((t=>!(t in e)));throw new Error(`Invalid format, expected geth genesis field "${t}" missing`)}return void 0!==t&&(e.name=t),G8(e,r)}catch(e){throw new Error(`Error parsing parameters file: ${e.message}`)}}(e,t,o),c=new q8({chain:s.name??"custom",customChains:[s],eips:r,hardfork:i??s.hardfork,customCrypto:a});return void 0!==n&&c.setForkHashes(n),c}static isSupportedChainId(e){const t=this.getInitializedChains();return Boolean(t.names[e.toString()])}static _getChainParams(e,t){const r=this.getInitializedChains(t);if("number"==typeof e||"bigint"==typeof e){if(e=e.toString(),r.names[e]){return r[r.names[e]]}throw new Error(`Chain with ID ${e} not supported`)}if(void 0!==r[e])return r[e];throw new Error(`Chain with name ${e} not supported`)}setChain(e){if("number"==typeof e||"bigint"==typeof e||"string"==typeof e)this._chainParams=q8._getChainParams(e,this._customChains);else{if("object"!=typeof e)throw new Error("Wrong input format");{if(this._customChains.length>0)throw new Error("Chain must be a string, number, or bigint when initialized with customChains passed in");const t=["networkId","genesis","hardforks","bootstrapNodes"];for(const r of t)if(!(r in e))throw new Error(`Missing required chain parameter: ${r}`);this._chainParams=e}}for(const e of this.hardforks())if(void 0===e.block)throw new Error("Hardfork cannot have undefined block number");return this._chainParams}setHardfork(e){let t=!1;for(const r of this.HARDFORK_CHANGES)r[0]===e&&(this._hardfork!==e&&(this._hardfork=e,this._buildParamsCache(),this._buildActivatedEIPsCache(),this.events.emit("hardforkChanged",e)),t=!0);if(!t)throw new Error(`Hardfork with name ${e} not supported`)}getHardforkBy(e){const t=_8(e.blockNumber,x8.BigInt),r=_8(e.td,x8.BigInt),n=_8(e.timestamp,x8.BigInt),i=this.hardforks().filter((e=>null!==e.block||null!==e.ttd&&void 0!==e.ttd||void 0!==e.timestamp)),o=i.findIndex((e=>null!==e.ttd&&void 0!==e.ttd)),a=i.slice(o+1).findIndex((e=>null!==e.ttd&&void 0!==e.ttd));if(a>=0)throw Error("More than one merge hardforks found with ttd specified");let s=i.findIndex((e=>void 0!==t&&null!==e.block&&BigInt(e.block)>t||void 0!==n&&void 0!==e.timestamp&&BigInt(e.timestamp)>n));if(-1===s)s=i.length;else if(0===s)throw Error("Must have at least one hardfork at block 0");if(void 0===n){const e=i.slice(0,s).reverse().findIndex((e=>null!==e.block||void 0!==e.ttd));s-=e}if(s-=1,null===i[s].block&&void 0===i[s].timestamp)(null==r||BigInt(i[s].ttd)>r)&&(s-=1);else if(o>=0&&null!=r){if(s>=o&&BigInt(i[o].ttd)>r)throw Error("Maximum HF determined by total difficulty is lower than the block number HF");if(sMath.max(Number(t.timestamp??"0"),e)),0);if(e>n)throw Error("Maximum HF determined by timestamp is lower than the block number/ttd HF");const t=i.slice(s+1).reduce(((e,t)=>Math.min(Number(t.timestamp??n),e)),Number(n));if(t=r}activeOnBlock(e){return this.hardforkIsActiveOnBlock(null,e)}hardforkGteHardfork(e,t){e=e??this._hardfork;const r=this.hardforks();let n=-1,i=-1,o=0;for(const a of r)a.name===e&&(n=o),a.name===t&&(i=o),o+=1;return n>=i&&-1!==i}gteHardfork(e){return this.hardforkGteHardfork(null,e)}hardforkBlock(e){e=e??this._hardfork;const t=this._getHardfork(e)?.block;return null==t?null:BigInt(t)}hardforkTimestamp(e){e=e??this._hardfork;const t=this._getHardfork(e)?.timestamp;return null==t?null:BigInt(t)}eipBlock(e){for(const t of this.HARDFORK_CHANGES){const r=t[1];if("eips"in r&&r.eips.includes(e))return this.hardforkBlock(t[0])}return null}eipTimestamp(e){for(const t of this.HARDFORK_CHANGES){const r=t[1];if("eips"in r&&r.eips.includes(e))return this.hardforkTimestamp(t[0])}return null}hardforkTTD(e){e=e??this._hardfork;const t=this._getHardfork(e)?.ttd;return null==t?null:BigInt(t)}nextHardforkBlockOrTimestamp(e){e=e??this._hardfork;const t=this.hardforks();let r=t.findIndex((t=>t.name===e));if(e===F8.Paris&&(r-=1),r<0)return null;let n=t[r].timestamp??t[r].block;n=null!=n?Number(n):null;const i=t.slice(r+1).find((e=>{let t=e.timestamp??e.block;return t=null!=t?Number(t):null,e.name!==F8.Paris&&null!=t&&t!==n}));if(void 0===i)return null;const o=i.timestamp??i.block;return null==o?null:BigInt(o)}_calcForkHash(e,t){let r=new Uint8Array(0),n=0;for(const t of this.hardforks()){const{block:i,timestamp:o,name:a}=t;let s=o??i;if(s=null!==s?Number(s):null,"number"==typeof s&&0!==s&&s!==n&&a!==F8.Paris){const e=J3("0x"+s.toString(16).padStart(16,"0"));r=s8(r,e),n=s}if(t.name===e)break}const i=s8(t,r);return K3(Y3(N8(i)>>>0))}forkHash(e,t){e=e??this._hardfork;const r=this._getHardfork(e);if(null===r||null===r?.block&&void 0===r?.timestamp&&void 0===r?.ttd){throw new Error("No fork hash calculation possible for future hardfork")}if(null!=r?.forkHash)return r.forkHash;if(!t)throw new Error("genesisHash required for forkHash calculation");return this._calcForkHash(e,t)}hardforkForForkHash(e){const t=this.hardforks().filter((t=>t.forkHash===e));return t.length>=1?t[t.length-1]:null}setForkHashes(e){for(const t of this.hardforks()){const r=t.timestamp??t.block;null!==t.forkHash&&void 0!==t.forkHash||null==r&&void 0===t.ttd||(t.forkHash=this.forkHash(t.name,e))}}genesis(){return this._chainParams.genesis}hardforks(){const e=this._chainParams.hardforks;return void 0!==this._chainParams.customHardforks&&this._chainParams.customHardforks,e}bootstrapNodes(){return this._chainParams.bootstrapNodes}dnsNetworks(){return this._chainParams.dnsNetworks}hardfork(){return this._hardfork}chainId(){return BigInt(this._chainParams.chainId)}chainName(){return this._chainParams.name}networkId(){return BigInt(this._chainParams.networkId)}eips(){return this._eips}consensusType(){const e=this.hardfork();let t;for(const r of this.HARDFORK_CHANGES)if("consensus"in r[1]&&(t=r[1].consensus.type),r[0]===e)break;return t??this._chainParams.consensus.type}consensusAlgorithm(){const e=this.hardfork();let t;for(const r of this.HARDFORK_CHANGES)if("consensus"in r[1]&&(t=r[1].consensus.algorithm),r[0]===e)break;return t??this._chainParams.consensus.algorithm}consensusConfig(){const e=this.hardfork();let t;for(const r of this.HARDFORK_CHANGES){if("consensus"in r[1]){const e=r[1],n=e.consensus.algorithm;t=e.consensus[n]}if(r[0]===e)break}return t??this._chainParams.consensus[this.consensusAlgorithm()]??{}}copy(){const e=Object.assign(Object.create(Object.getPrototypeOf(this)),this);return e.events=new ge,e}static getInitializedChains(e){const t={};for(const[e,r]of Object.entries(R8))t[r]=e.toLowerCase();const r={...C8};if(e)for(const n of e){const{name:e}=n;t[n.chainId.toString()]=e,r[e]=n}return r.names=t,r}}var K8,V8;function W8(e){return!function(e){if(0===e.length)return!0;const t=e[0];return!!Array.isArray(t)}(e)}!function(e){e[e.EIP155ReplayProtection=155]="EIP155ReplayProtection",e[e.EIP1559FeeMarket=1559]="EIP1559FeeMarket",e[e.EIP2718TypedTransaction=2718]="EIP2718TypedTransaction",e[e.EIP2930AccessLists=2930]="EIP2930AccessLists"}(K8||(K8={})),function(e){e[e.Legacy=0]="Legacy",e[e.AccessListEIP2930=1]="AccessListEIP2930",e[e.FeeMarketEIP1559=2]="FeeMarketEIP1559",e[e.BlobEIP4844=3]="BlobEIP4844"}(V8||(V8={}));class J8{static getAccessListData(e){let t,r;if(W8(e)){t=e;const n=[];for(let t=0;t0?new w8(f):void 0,this.value=W3(r8(""===o?"0x":o)),this.data=r8(""===a?"0x":a),this.v=d.length>0?W3(d):void 0,this.r=h.length>0?W3(h):void 0,this.s=p.length>0?W3(p):void 0,this._validateCannotExceedMaxInteger({value:this.value,r:this.r,s:this.s}),this._validateCannotExceedMaxInteger({gasLimit:this.gasLimit},64),this._validateCannotExceedMaxInteger({nonce:this.nonce},64,!0);const m=void 0===this.to||null===this.to,b=t.allowUnlimitedInitCodeSize??!1,g=t.common??this._getCommon();m&&g.isActivatedEIP(3860)&&!1===b&&function(e,t){const r=e.param("vm","maxInitCodeSize");if(r&&BigInt(t)>r)throw new Error(`the initcode size of this transaction is too large: it is ${t} while the max is ${e.param("vm","maxInitCodeSize")}`)}(g,this.data.length)}get type(){return this._type}supports(e){return this.activeCapabilities.includes(e)}getValidationErrors(){const e=[];return this.isSigned()&&!this.verifySignature()&&e.push("Invalid Signature"),this.getBaseFee()>this.gasLimit&&e.push(`gasLimit is too low. given ${this.gasLimit}, need at least ${this.getBaseFee()}`),e}isValid(){return 0===this.getValidationErrors().length}getBaseFee(){const e=this.common.param("gasPrices","tx");let t=this.getDataFee();if(e&&(t+=e),this.common.gteHardfork("homestead")&&this.toCreationAddress()){const e=this.common.param("gasPrices","txCreation");e&&(t+=e)}return t}getDataFee(){const e=this.common.param("gasPrices","txDataZero"),t=this.common.param("gasPrices","txDataNonZero");let r=f8;for(let n=0;n-1&&this.activeCapabilities.splice(e,1)}return s}toJSON(){return{type:o8(BigInt(this.type)),nonce:o8(this.nonce),gasLimit:o8(this.gasLimit),to:void 0!==this.to?this.to.toString():void 0,value:o8(this.value),data:K3(this.data),v:void 0!==this.v?o8(this.v):void 0,r:void 0!==this.r?o8(this.r):void 0,s:void 0!==this.s?o8(this.s):void 0}}_getCommon(e,t){if(void 0!==t){const r=W3(r8(t));if(e){if(e.chainId()!==r){const t=this._errorMsg(`The chain ID does not match the chain ID of Common. Got: ${r}, expected: ${e.chainId}`);throw new Error(t)}return e.copy()}return q8.isSupportedChainId(r)?new q8({chain:r}):q8.custom({name:"custom-chain",networkId:r,chainId:r},{baseChain:this.DEFAULT_CHAIN})}return e?.copy()??new q8({chain:this.DEFAULT_CHAIN})}_validateCannotExceedMaxInteger(e,t=256,r=!1){for(const[n,i]of Object.entries(e))switch(t){case 64:if(r){if(void 0!==i&&i>=c8){const e=this._errorMsg(`${n} cannot equal or exceed MAX_UINT64 (2^64-1), given ${i}`);throw new Error(e)}}else if(void 0!==i&&i>c8){const e=this._errorMsg(`${n} cannot exceed MAX_UINT64 (2^64-1), given ${i}`);throw new Error(e)}break;case 256:if(r){if(void 0!==i&&i>=u8){const e=this._errorMsg(`${n} cannot equal or exceed MAX_INTEGER (2^256-1), given ${i}`);throw new Error(e)}}else if(void 0!==i&&i>u8){const e=this._errorMsg(`${n} cannot exceed MAX_INTEGER (2^256-1), given ${i}`);throw new Error(e)}break;default:{const e=this._errorMsg("unimplemented bits value");throw new Error(e)}}}static _validateNotArray(e){const t=["nonce","gasPrice","gasLimit","to","value","data","v","r","s","type","baseFee","maxFeePerGas","chainId"];for(const[r,n]of Object.entries(e))if(t.includes(r)&&Array.isArray(n))throw new Error(`${r} cannot be an array`)}_getSharedErrorPostfix(){let e="";try{e=this.isSigned()?K3(this.hash()):"not available (unsigned)"}catch(t){e="error"}let t="";try{t=this.isSigned().toString()}catch(t){e="error"}let r="";try{r=this.common.hardfork()}catch(e){r="error"}let n=`tx type=${this.type} hash=${e} nonce=${this.nonce} value=${this.value} `;return n+=`signed=${t} hf=${r}`,n}}function X8(e,t){const r=e.maxPriorityFeePerGas,n=e.maxFeePerGas-t,i=(re.maxFeePerGas)throw new Error("Tx cannot pay baseFee");const r=e.maxFeePerGas-t;return e.maxPriorityFeePerGasl8){const t=e4(e,"Invalid Signature: s-values greater than secp256k1n/2 are considered invalid");throw new Error(t)}}function i4(e){if(void 0!==e.cache.senderPubKey)return e.cache.senderPubKey;const t=e.getMessageToVerifySignature(),{v:r,r:n,s:i}=e;n4(e);try{const o=(e.common.customCrypto.ecrecover??S8)(t,r,a8(n),a8(i),e.supports(K8.EIP155ReplayProtection)?e.common.chainId():void 0);return Object.isFrozen(e)&&(e.cache.senderPubKey=o),o}catch(t){const r=e4(e,"Invalid Signature");throw new Error(r)}}function o4(e,t){if(void 0!==t&&t>e)throw new Error("Tx cannot pay baseFee");return void 0===t?e:e-t}function a4(e){return(e.common.customCrypto.keccak256??Fp)(e.getMessageToSign())}function s4(e,t){return s8(Z8(e.type),R3.encode(t??e.raw()))}function c4(e){const{v:t}=e;if(void 0!==t&&t!==f8&&t!==d8){const t=e4(e,"The y-parity of the transaction should either be 0 or 1");throw new Error(t)}}function u4(e){return t4(e,BigInt(J8.getDataFeeEIP2930(e.accessList,e.common)))}class l4 extends Y8{constructor(e,t={}){super({...e,type:V8.FeeMarketEIP1559},t);const{chainId:r,accessList:n,maxFeePerGas:i,maxPriorityFeePerGas:o}=e;if(this.common=this._getCommon(t.common,r),this.chainId=this.common.chainId(),!1===this.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");this.activeCapabilities=this.activeCapabilities.concat([1559,2718,2930]);const a=J8.getAccessListData(n??[]);if(this.accessList=a.accessList,this.AccessListJSON=a.AccessListJSON,J8.verifyAccessList(this.accessList),this.maxFeePerGas=W3(r8(""===i?"0x":i)),this.maxPriorityFeePerGas=W3(r8(""===o?"0x":o)),this._validateCannotExceedMaxInteger({maxFeePerGas:this.maxFeePerGas,maxPriorityFeePerGas:this.maxPriorityFeePerGas}),Y8._validateNotArray(e),this.gasLimit*this.maxFeePerGas>u8){const e=this._errorMsg("gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)");throw new Error(e)}if(this.maxFeePerGasu8){const e=this._errorMsg("gasLimit * gasPrice cannot exceed MAX_INTEGER");throw new Error(e)}c4(this),n4(this);(t?.freeze??!0)&&Object.freeze(this)}static fromTxData(e,t={}){return new f4(e,t)}static fromSerializedTx(e,t={}){if(!1===Xh(e.subarray(0,1),Z8(V8.AccessListEIP2930)))throw new Error(`Invalid serialized tx input: not an EIP-2930 transaction (wrong tx type, expected: ${V8.AccessListEIP2930}, received: ${K3(e.subarray(0,1))}`);const r=R3.decode(Uint8Array.from(e.subarray(1)));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return f4.fromValuesArray(r,t)}static fromValuesArray(e,t={}){if(8!==e.length&&11!==e.length)throw new Error("Invalid EIP-2930 transaction. Only expecting 8 values (for unsigned tx) or 11 values (for signed tx).");const[r,n,i,o,a,s,c,u,l,f,d]=e;this._validateNotArray({chainId:r,v:l}),i8({nonce:n,gasPrice:i,gasLimit:o,value:s,v:l,r:f,s:d});return new f4({chainId:W3(r),nonce:n,gasPrice:i,gasLimit:o,to:a,value:s,data:c,accessList:u??[],v:void 0!==l?W3(l):void 0,r:f,s:d},t)}getEffectivePriorityFee(e){return o4(this.gasPrice,e)}getDataFee(){return u4(this)}getUpfrontCost(){return this.gasLimit*this.gasPrice+this.value}raw(){return[a8(this.chainId),a8(this.nonce),a8(this.gasPrice),a8(this.gasLimit),void 0!==this.to?this.to.bytes:new Uint8Array(0),a8(this.value),this.data,this.accessList,void 0!==this.v?a8(this.v):new Uint8Array(0),void 0!==this.r?a8(this.r):new Uint8Array(0),void 0!==this.s?a8(this.s):new Uint8Array(0)]}serialize(){return s4(this)}getMessageToSign(){return s4(this,this.raw().slice(0,8))}getHashedMessageToSign(){return a4(this)}hash(){return r4(this)}getMessageToVerifySignature(){return this.getHashedMessageToSign()}getSenderPublicKey(){return i4(this)}addSignature(e,t,r,n=!1){t=r8(t),r=r8(r);const i={...this.txOptions,common:this.common};return f4.fromTxData({chainId:this.chainId,nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:n?e-m8:e,r:W3(t),s:W3(r)},i)}toJSON(){const e=J8.getAccessListJSON(this.accessList);return{...super.toJSON(),chainId:o8(this.chainId),gasPrice:o8(this.gasPrice),accessList:e}}errorStr(){let e=this._getSharedErrorPostfix();return e+=` gasPrice=${this.gasPrice} accessListCount=${this.accessList?.length??0}`,e}_errorMsg(e){return e4(this,e)}}class d4 extends Y8{constructor(e,t={}){super({...e,type:V8.BlobEIP4844},t);const{chainId:r,accessList:n,maxFeePerGas:i,maxPriorityFeePerGas:o,maxFeePerBlobGas:a}=e;if(this.common=this._getCommon(t.common,r),this.chainId=this.common.chainId(),!1===this.common.isActivatedEIP(1559))throw new Error("EIP-1559 not enabled on Common");if(!1===this.common.isActivatedEIP(4844))throw new Error("EIP-4844 not enabled on Common");this.activeCapabilities=this.activeCapabilities.concat([1559,2718,2930]);const s=J8.getAccessListData(n??[]);if(this.accessList=s.accessList,this.AccessListJSON=s.AccessListJSON,J8.verifyAccessList(this.accessList),this.maxFeePerGas=W3(r8(""===i?"0x":i)),this.maxPriorityFeePerGas=W3(r8(""===o?"0x":o)),this._validateCannotExceedMaxInteger({maxFeePerGas:this.maxFeePerGas,maxPriorityFeePerGas:this.maxPriorityFeePerGas}),Y8._validateNotArray(e),this.gasLimit*this.maxFeePerGas>u8){const e=this._errorMsg("gasLimit * maxFeePerGas cannot exceed MAX_INTEGER (2^256-1)");throw new Error(e)}if(this.maxFeePerGasr8(e))),c4(this),n4(this);for(const e of this.blobVersionedHashes){if(32!==e.length){const e=this._errorMsg("versioned hash is invalid length");throw new Error(e)}if(BigInt(e[0])!==this.common.param("sharding","blobCommitmentVersionKzg")){const e=this._errorMsg("versioned hash does not start with KZG commitment version");throw new Error(e)}}if(this.blobVersionedHashes.length>6){const e=this._errorMsg("tx can contain at most 6 blobs");throw new Error(e)}if(0===this.blobVersionedHashes.length){const e=this._errorMsg("tx should contain at least one blob");throw new Error(e)}if(void 0===this.to){const e=this._errorMsg('tx should have a "to" field and cannot be used to create contracts');throw new Error(e)}this.blobs=e.blobs?.map((e=>r8(e))),this.kzgCommitments=e.kzgCommitments?.map((e=>r8(e))),this.kzgProofs=e.kzgProofs?.map((e=>r8(e)));(t?.freeze??!0)&&Object.freeze(this)}static fromTxData(e,t){if(void 0===t?.common?.customCrypto?.kzg)throw new Error("A common object with customCrypto.kzg initialized required to instantiate a 4844 blob tx");const r=t.common.customCrypto.kzg;if(void 0!==e.blobsData){if(void 0!==e.blobs)throw new Error("cannot have both raw blobs data and encoded blobs in constructor");if(void 0!==e.kzgCommitments)throw new Error("cannot have both raw blobs data and KZG commitments in constructor");if(void 0!==e.blobVersionedHashes)throw new Error("cannot have both raw blobs data and versioned hashes in constructor");if(void 0!==e.kzgProofs)throw new Error("cannot have both raw blobs data and KZG proofs in constructor");e.blobs=O8(e.blobsData.reduce(((e,t)=>e+t))),e.kzgCommitments=((e,t)=>{const r=[];for(const n of t)r.push(e.blobToKzgCommitment(n));return r})(r,e.blobs),e.blobVersionedHashes=(e=>{const t=[];for(const r of e)t.push(M8(r,1));return t})(e.kzgCommitments),e.kzgProofs=((e,t,r)=>t.map(((t,n)=>e.computeBlobKzgProof(t,r[n]))))(r,e.blobs,e.kzgCommitments)}return new d4(e,t)}getEffectivePriorityFee(e){return Q8(this,e)}static minimalFromNetworkWrapper(e,t){if(void 0===t?.common?.customCrypto?.kzg)throw new Error("A common object with customCrypto.kzg initialized required to instantiate a 4844 blob tx");return d4.fromTxData({...e,blobs:void 0,kzgCommitments:void 0,kzgProofs:void 0},t)}static fromSerializedTx(e,t={}){if(void 0===t.common?.customCrypto?.kzg)throw new Error("A common object with customCrypto.kzg initialized required to instantiate a 4844 blob tx");if(!1===Xh(e.subarray(0,1),Z8(V8.BlobEIP4844)))throw new Error(`Invalid serialized tx input: not an EIP-4844 transaction (wrong tx type, expected: ${V8.BlobEIP4844}, received: ${K3(e.subarray(0,1))}`);const r=R3.decode(e.subarray(1));if(!Array.isArray(r))throw new Error("Invalid serialized tx input: must be array");return d4.fromValuesArray(r,t)}static fromValuesArray(e,t={}){if(void 0===t.common?.customCrypto?.kzg)throw new Error("A common object with customCrypto.kzg initialized required to instantiate a 4844 blob tx");if(11!==e.length&&14!==e.length)throw new Error("Invalid EIP-4844 transaction. Only expecting 11 values (for unsigned tx) or 14 values (for signed tx).");const[r,n,i,o,a,s,c,u,l,f,d,h,p,m]=e;return this._validateNotArray({chainId:r,v:h}),i8({nonce:n,maxPriorityFeePerGas:i,maxFeePerGas:o,gasLimit:a,value:c,maxFeePerBlobGas:f,v:h,r:p,s:m}),new d4({chainId:W3(r),nonce:n,maxPriorityFeePerGas:i,maxFeePerGas:o,gasLimit:a,to:s,value:c,data:u,accessList:l??[],maxFeePerBlobGas:f,blobVersionedHashes:d,v:void 0!==h?W3(h):void 0,r:p,s:m},t)}static fromSerializedBlobTxNetworkWrapper(e,t){if(!t||!t.common)throw new Error("common instance required to validate versioned hashes");if(void 0===t.common?.customCrypto?.kzg)throw new Error("A common object with customCrypto.kzg initialized required to instantiate a 4844 blob tx");if(!1===Xh(e.subarray(0,1),Z8(V8.BlobEIP4844)))throw new Error(`Invalid serialized tx input: not an EIP-4844 transaction (wrong tx type, expected: ${V8.BlobEIP4844}, received: ${K3(e.subarray(0,1))}`);const r=R3.decode(e.subarray(1));if(4!==r.length)throw Error("Expected 4 values in the deserialized network transaction");const[n,i,o,a]=r,s=d4.fromValuesArray(n,{...t,freeze:!1});if(void 0===s.to)throw Error("BlobEIP4844Transaction can not be send without a valid `to`");const c=Number(t.common.param("sharding","blobCommitmentVersionKzg"));((e,t,r,n,i,o)=>{if(e.length!==t.length||t.length!==r.length)throw new Error("Number of blobVersionedHashes, blobs, and commitments not all equal");if(0===e.length)throw new Error("Invalid transaction with empty blobs");let a;try{a=o.verifyBlobKzgProofBatch(t,r,n)}catch(e){throw new Error(`KZG verification of blobs fail with error=${e}`)}if(!a)throw new Error("KZG proof cannot be verified from blobs/commitments");for(let t=0;tK3(e)))}}addSignature(e,t,r,n=!1){t=r8(t),r=r8(r);const i={...this.txOptions,common:this.common};return d4.fromTxData({chainId:this.chainId,nonce:this.nonce,maxPriorityFeePerGas:this.maxPriorityFeePerGas,maxFeePerGas:this.maxFeePerGas,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,accessList:this.accessList,v:n?e-m8:e,r:W3(t),s:W3(r),maxFeePerBlobGas:this.maxFeePerBlobGas,blobVersionedHashes:this.blobVersionedHashes,blobs:this.blobs,kzgCommitments:this.kzgCommitments,kzgProofs:this.kzgProofs},i)}errorStr(){let e=this._getSharedErrorPostfix();return e+=` maxFeePerGas=${this.maxFeePerGas} maxPriorityFeePerGas=${this.maxPriorityFeePerGas}`,e}_errorMsg(e){return e4(this,e)}numBlobs(){return this.blobVersionedHashes.length}}function h4(e,t){const r=Number(e),n=2*Number(t);return r===n+35||r===n+36}class p4 extends Y8{constructor(e,t={}){if(super({...e,type:V8.Legacy},t),this.common=this._validateTxV(this.v,t.common),this.keccakFunction=this.common.customCrypto.keccak256??Fp,this.gasPrice=W3(r8(""===e.gasPrice?"0x":e.gasPrice)),this.gasPrice*this.gasLimit>u8){const e=this._errorMsg("gas limit * gasPrice cannot exceed MAX_INTEGER (2^256-1)");throw new Error(e)}this._validateCannotExceedMaxInteger({gasPrice:this.gasPrice}),Y8._validateNotArray(e),this.common.gteHardfork("spuriousDragon")&&(this.isSigned()?h4(this.v,this.common.chainId())&&this.activeCapabilities.push(K8.EIP155ReplayProtection):this.activeCapabilities.push(K8.EIP155ReplayProtection));(t?.freeze??!0)&&Object.freeze(this)}static fromTxData(e,t={}){return new p4(e,t)}static fromSerializedTx(e,t={}){const r=R3.decode(e);if(!Array.isArray(r))throw new Error("Invalid serialized tx input. Must be array");return this.fromValuesArray(r,t)}static fromValuesArray(e,t={}){if(6!==e.length&&9!==e.length)throw new Error("Invalid transaction. Only expecting 6 values (for unsigned tx) or 9 values (for signed tx).");const[r,n,i,o,a,s,c,u,l]=e;return i8({nonce:r,gasPrice:n,gasLimit:i,value:a,v:c,r:u,s:l}),new p4({nonce:r,gasPrice:n,gasLimit:i,to:o,value:a,data:s,v:c,r:u,s:l},t)}getEffectivePriorityFee(e){return o4(this.gasPrice,e)}raw(){return[a8(this.nonce),a8(this.gasPrice),a8(this.gasLimit),void 0!==this.to?this.to.bytes:new Uint8Array(0),a8(this.value),this.data,void 0!==this.v?a8(this.v):new Uint8Array(0),void 0!==this.r?a8(this.r):new Uint8Array(0),void 0!==this.s?a8(this.s):new Uint8Array(0)]}serialize(){return R3.encode(this.raw())}getMessageToSign(){const e=[a8(this.nonce),a8(this.gasPrice),a8(this.gasLimit),void 0!==this.to?this.to.bytes:new Uint8Array(0),a8(this.value),this.data];return this.supports(K8.EIP155ReplayProtection)&&(e.push(a8(this.common.chainId())),e.push(t8(r8(0))),e.push(t8(r8(0)))),e}getHashedMessageToSign(){const e=this.getMessageToSign();return this.keccakFunction(R3.encode(e))}getDataFee(){return t4(this)}getUpfrontCost(){return this.gasLimit*this.gasPrice+this.value}hash(){return r4(this)}getMessageToVerifySignature(){if(!this.isSigned()){const e=this._errorMsg("This transaction is not signed");throw new Error(e)}return this.getHashedMessageToSign()}getSenderPublicKey(){return i4(this)}addSignature(e,t,r,n=!1){t=r8(t),r=r8(r),n&&this.supports(K8.EIP155ReplayProtection)&&(e+=this.common.chainId()*h8+p8);const i={...this.txOptions,common:this.common};return p4.fromTxData({nonce:this.nonce,gasPrice:this.gasPrice,gasLimit:this.gasLimit,to:this.to,value:this.value,data:this.data,v:e,r:W3(t),s:W3(r)},i)}toJSON(){return{...super.toJSON(),gasPrice:o8(this.gasPrice)}}_validateTxV(e,t){let r;const n=void 0!==e?Number(e):void 0;if(void 0!==n&&n<37&&27!==n&&28!==n)throw new Error(`Legacy txs need either v = 27/28 or v >= 37 (EIP-155 replay protection), got v = ${n}`);if(void 0!==n&&0!==n&&(!t||t.gteHardfork("spuriousDragon"))&&27!==n&&28!==n)if(t){if(!h4(BigInt(n),t.chainId()))throw new Error(`Incompatible EIP155-based V ${n} and chain id ${t.chainId()}. See the Common parameter of the Transaction constructor to set the chain id.`)}else{let e;e=(n-35)%2==0?35:36,r=BigInt(n-e)/h8}return this._getCommon(t,r)}errorStr(){let e=this._getSharedErrorPostfix();return e+=` gasPrice=${this.gasPrice}`,e}_errorMsg(e){return e4(this,e)}}class m4{constructor(){}static fromTxData(e,t={}){if("type"in e&&void 0!==e.type){if(function(e){return Number(W3(r8(e.type)))===V8.Legacy}(e))return p4.fromTxData(e,t);if(function(e){return Number(W3(r8(e.type)))===V8.AccessListEIP2930}(e))return f4.fromTxData(e,t);if(function(e){return Number(W3(r8(e.type)))===V8.FeeMarketEIP1559}(e))return l4.fromTxData(e,t);if(function(e){return Number(W3(r8(e.type)))===V8.BlobEIP4844}(e))return d4.fromTxData(e,t);throw new Error(`Tx instantiation with type ${e?.type} not supported`)}return p4.fromTxData(e,t)}static fromSerializedData(e,t={}){if(!(e[0]<=127))return p4.fromSerializedTx(e,t);switch(e[0]){case V8.AccessListEIP2930:return f4.fromSerializedTx(e,t);case V8.FeeMarketEIP1559:return l4.fromSerializedTx(e,t);case V8.BlobEIP4844:return d4.fromSerializedTx(e,t);default:throw new Error(`TypedTransaction with ID ${e[0]} unknown`)}}static fromBlockBodyData(e,t={}){if(e instanceof Uint8Array)return this.fromSerializedData(e,t);if(Array.isArray(e))return p4.fromValuesArray(e,t);throw new Error("Cannot decode transaction: unknown type input")}static async fromJsonRpcProvider(e,t,r){const n=(e=>{if("string"==typeof e)return e;if("object"==typeof e&&void 0!==e._getConnection)return e._getConnection().url;throw new Error("Must provide valid provider URL or Web3Provider")})(e),i=await(async(e,t)=>{const r=JSON.stringify({method:t.method,params:t.params,jsonrpc:"2.0",id:1}),n=await fetch(e,{headers:{"content-type":"application/json"},method:"POST",body:r});if(!n.ok)throw new Error(`JSONRpcError: ${JSON.stringify({method:t.method,status:n.status,message:await n.text().catch((()=>"Could not parse error message likely because of a network error"))},null,2)}`);return(await n.json()).result})(n,{method:"eth_getTransactionByHash",params:[t]});if(null===i)throw new Error("No data returned from provider");return m4.fromRPC(i,r)}static async fromRPC(e,t={}){return m4.fromTxData((e=>{const t=Object.assign({},e);return t.gasLimit=_8(t.gasLimit??t.gas,x8.BigInt),t.data=void 0===t.data?t.input:t.data,t.gasPrice=void 0!==t.gasPrice?BigInt(t.gasPrice):void 0,t.value=void 0!==t.value?BigInt(t.value):void 0,t.to=null!==t.to&&void 0!==t.to?e8(r8(t.to),20):null,t.v="0x0"===t.v?"0x":t.v,t.r="0x0"===t.r?"0x":t.r,t.s="0x0"===t.s?"0x":t.s,"0x"===t.v&&"0x"===t.r&&"0x"===t.s||(t.v=_8(t.v,x8.BigInt)),t})(e),t)}}var b4={},g4={},y4={},v4={},w4={},E4={},A4={},x4={},_4={};function k4(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function S4(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function P4(e,...t){if(!((r=e)instanceof Uint8Array||null!=r&&"object"==typeof r&&"Uint8Array"===r.constructor.name))throw new Error("Expected Uint8Array");var r;if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function I4(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");k4(e.outputLen),k4(e.blockLen)}function T4(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function O4(e,t){P4(e);const r=t.outputLen;if(e.lengthnew Uint8Array(e.buffer,e.byteOffset,e.byteLength);function r(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.rotr=(e,t)=>e<<32-t|e>>>t,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));e.bytesToHex=function(e){if(!r(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}e.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t{},e.asyncLoop=async function(t,r,n){let i=Date.now();for(let o=0;o=0&&te().update(s(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(s(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(s(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}(C4),Object.defineProperty(x4,"__esModule",{value:!0}),x4.SHA2=void 0;const N4=_4,R4=C4;x4.SHA2=class extends R4.Hash{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,R4.createView)(this.buffer)}update(e){(0,N4.exists)(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=(0,R4.toBytes)(e)).length;for(let o=0;on-o&&(this.process(r,0),o=0);for(let e=o;e>i&o),s=Number(r&o),c=n?4:0,u=n?0:4;e.setUint32(t+c,a,n),e.setUint32(t+u,s,n)}(r,n-8,BigInt(8*this.length),i),this.process(r,0);const a=(0,R4.createView)(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=s/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^e&r^t&r,j4=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),D4=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),z4=new Uint32Array(64);class $4 extends F4.SHA2{constructor(){super(64,32,8,!1),this.A=0|D4[0],this.B=0|D4[1],this.C=0|D4[2],this.D=0|D4[3],this.E=0|D4[4],this.F=0|D4[5],this.G=0|D4[6],this.H=0|D4[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)z4[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=z4[e-15],r=z4[e-2],n=(0,L4.rotr)(t,7)^(0,L4.rotr)(t,18)^t>>>3,i=(0,L4.rotr)(r,17)^(0,L4.rotr)(r,19)^r>>>10;z4[e]=i+z4[e-7]+n+z4[e-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+((0,L4.rotr)(a,6)^(0,L4.rotr)(a,11)^(0,L4.rotr)(a,25))+((l=a)&s^~l&c)+j4[e]+z4[e]|0,f=((0,L4.rotr)(r,2)^(0,L4.rotr)(r,13)^(0,L4.rotr)(r,22))+U4(r,n,i)|0;u=c,c=s,s=a,a=o+t|0,o=i,i=n,n=r,r=t+f|0}var l;r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,n,i,o,a,s,c,u)}roundClean(){z4.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class H4 extends $4{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}A4.sha256=(0,L4.wrapConstructor)((()=>new $4)),A4.sha224=(0,L4.wrapConstructor)((()=>new H4));var G4={},q4={};Object.defineProperty(q4,"__esModule",{value:!0}),q4.validateObject=q4.createHmacDrbg=q4.bitMask=q4.bitSet=q4.bitGet=q4.bitLen=q4.utf8ToBytes=q4.equalBytes=q4.concatBytes=q4.ensureBytes=q4.numberToVarBytesBE=q4.numberToBytesLE=q4.numberToBytesBE=q4.bytesToNumberLE=q4.bytesToNumberBE=q4.hexToBytes=q4.hexToNumber=q4.numberToHexUnpadded=q4.bytesToHex=q4.isBytes=void 0; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const K4=BigInt(0),V4=BigInt(1),W4=BigInt(2);function J4(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}q4.isBytes=J4;const Z4=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Y4(e){if(!J4(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r=e9._0&&e<=e9._9?e-e9._0:e>=e9._A&&e<=e9._F?e-(e9._A-10):e>=e9._a&&e<=e9._f?e-(e9._a-10):void 0}function r9(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;tK4;e>>=V4,t+=1);return t},q4.bitGet=function(e,t){return e>>BigInt(t)&V4};q4.bitSet=(e,t,r)=>e|(r?V4:K4)<(W4<new Uint8Array(e),a9=e=>Uint8Array.from(e);q4.createHmacDrbg=function(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=o9(e),i=o9(e),o=0;const a=()=>{n.fill(1),i.fill(0),o=0},s=(...e)=>r(i,n,...e),c=(e=o9())=>{i=s(a9([0]),e),n=s(),0!==e.length&&(i=s(a9([1]),e),n=s())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e{let r;for(a(),c(e);!(r=t(u()));)c();return a(),r}};const s9={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||J4(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};q4.validateObject=function(e,t,r={}){const n=(t,r,n)=>{const i=s9[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e},Object.defineProperty(G4,"__esModule",{value:!0}),G4.mapHashToField=G4.getMinHashLength=G4.getFieldBytesLength=G4.hashToPrivateScalar=G4.FpSqrtEven=G4.FpSqrtOdd=G4.Field=G4.nLength=G4.FpIsSquare=G4.FpDiv=G4.FpInvertBatch=G4.FpPow=G4.validateField=G4.isNegativeLE=G4.FpSqrt=G4.tonelliShanks=G4.invert=G4.pow2=G4.pow=G4.mod=void 0; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const c9=q4,u9=BigInt(0),l9=BigInt(1),f9=BigInt(2),d9=BigInt(3),h9=BigInt(4),p9=BigInt(5),m9=BigInt(8);function b9(e,t){const r=e%t;return r>=u9?r:t+r}function g9(e,t,r){if(r<=u9||t 0");if(r===l9)return u9;let n=l9;for(;t>u9;)t&l9&&(n=n*e%r),e=e*e%r,t>>=l9;return n}function y9(e,t){if(e===u9||t<=u9)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=b9(e,t),n=t,i=u9,o=l9;for(;r!==u9;){const e=n%r,t=i-o*(n/r);n=r,r=e,i=o,o=t}if(n!==l9)throw new Error("invert: does not exist");return b9(i,t)}function v9(e){const t=(e-l9)/f9;let r,n,i;for(r=e-l9,n=0;r%f9===u9;r/=f9,n++);for(i=f9;iu9;)n*=n,n%=r;return n},G4.invert=y9,G4.tonelliShanks=v9,G4.FpSqrt=w9;G4.isNegativeLE=(e,t)=>(b9(e,t)&l9)===l9;const E9=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function A9(e,t,r){if(r 0");if(r===u9)return e.ONE;if(r===l9)return t;let n=e.ONE,i=t;for(;r>u9;)r&l9&&(n=e.mul(n,i)),i=e.sqr(i),r>>=l9;return n}function x9(e,t){const r=new Array(t.length),n=t.reduce(((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n))),e.ONE),i=e.inv(n);return t.reduceRight(((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n))),i),r}function _9(e,t){const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function k9(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function S9(e){const t=k9(e);return t+Math.ceil(t/2)}G4.validateField=function(e){const t=E9.reduce(((e,t)=>(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,c9.validateObject)(e,t)},G4.FpPow=A9,G4.FpInvertBatch=x9,G4.FpDiv=function(e,t,r){return e.mul(t,"bigint"==typeof r?y9(r,e.ORDER):e.inv(r))},G4.FpIsSquare=function(e){const t=(e.ORDER-l9)/f9;return r=>{const n=e.pow(r,t);return e.eql(n,e.ZERO)||e.eql(n,e.ONE)}},G4.nLength=_9,G4.Field=function(e,t,r=!1,n={}){if(e<=u9)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=_9(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const a=w9(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:(0,c9.bitMask)(i),ZERO:u9,ONE:l9,create:t=>b9(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return u9<=t&&te===u9,isOdd:e=>(e&l9)===l9,neg:t=>b9(-t,e),eql:(e,t)=>e===t,sqr:t=>b9(t*t,e),add:(t,r)=>b9(t+r,e),sub:(t,r)=>b9(t-r,e),mul:(t,r)=>b9(t*r,e),pow:(e,t)=>A9(s,e,t),div:(t,r)=>b9(t*y9(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>y9(t,e),sqrt:n.sqrt||(e=>a(s,e)),invertBatch:e=>x9(s,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?(0,c9.numberToBytesLE)(e,o):(0,c9.numberToBytesBE)(e,o),fromBytes:e=>{if(e.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${e.length}`);return r?(0,c9.bytesToNumberLE)(e):(0,c9.bytesToNumberBE)(e)}});return Object.freeze(s)},G4.FpSqrtOdd=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?r:e.neg(r)},G4.FpSqrtEven=function(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r},G4.hashToPrivateScalar=function(e,t,r=!1){const n=(e=(0,c9.ensureBytes)("privateHash",e)).length,i=_9(t).nByteLength+8;if(i<24||n1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${n}`);return b9(r?(0,c9.bytesToNumberLE)(e):(0,c9.bytesToNumberBE)(e),t-l9)+l9},G4.getFieldBytesLength=k9,G4.getMinHashLength=S9,G4.mapHashToField=function(e,t,r=!1){const n=e.length,i=k9(t),o=S9(t);if(n<16||n1024)throw new Error(`expected ${o}-1024 bytes of input, got ${n}`);const a=b9(r?(0,c9.bytesToNumberBE)(e):(0,c9.bytesToNumberLE)(e),t-l9)+l9;return r?(0,c9.numberToBytesLE)(a,i):(0,c9.numberToBytesBE)(a,i)};var P9={},I9={};Object.defineProperty(I9,"__esModule",{value:!0}),I9.validateBasic=I9.wNAF=void 0; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const T9=G4,O9=q4,M9=BigInt(0),C9=BigInt(1);I9.wNAF=function(e,t){const r=(e,t)=>{const r=t.negate();return e?r:t},n=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:r,unsafeLadder(t,r){let n=e.ZERO,i=t;for(;r>M9;)r&C9&&(n=n.add(i)),i=i.double(),r>>=C9;return n},precomputeWindow(e,t){const{windows:r,windowSize:i}=n(t),o=[];let a=e,s=a;for(let e=0;e>=d,n>s&&(n-=f,o+=C9);const a=t,h=t+Math.abs(n)-1,p=e%2!=0,m=n<0;0===n?u=u.add(r(p,i[a])):c=c.add(r(m,i[h]))}return{p:c,f:u}},wNAFCached(e,t,r,n){const i=e._WINDOW_SIZE||1;let o=t.get(e);return o||(o=this.precomputeWindow(e,i),1!==i&&t.set(e,n(o))),this.wNAF(i,o,r)}}},I9.validateBasic=function(e){return(0,T9.validateField)(e.Fp),(0,O9.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,T9.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mapToCurveSimpleSWU=e.SWUFpSqrtRatio=e.weierstrass=e.weierstrassPoints=e.DER=void 0; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const t=G4,r=q4,n=q4,i=I9;const{bytesToNumberBE:o,hexToBytes:a}=r;e.DER={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:r}=e.DER;if(t.length<2||2!==t[0])throw new r("Invalid signature integer tag");const n=t[1],i=t.subarray(2,n+2);if(!n||i.length!==n)throw new r("Invalid signature integer: wrong length");if(128&i[0])throw new r("Invalid signature integer: negative");if(0===i[0]&&!(128&i[1]))throw new r("Invalid signature integer: unnecessary leading zero");return{d:o(i),l:t.subarray(n+2)}},toSig(t){const{Err:n}=e.DER,i="string"==typeof t?a(t):t;if(!r.isBytes(i))throw new Error("ui8a expected");let o=i.length;if(o<2||48!=i[0])throw new n("Invalid signature tag");if(i[1]!==o-2)throw new n("Invalid signature: incorrect length");const{d:s,l:c}=e.DER._parseInt(i.subarray(2)),{d:u,l:l}=e.DER._parseInt(c);if(l.length)throw new n("Invalid signature: left bytes after parsing");return{r:s,s:u}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,r=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},n=t(r(e.s)),i=t(r(e.r)),o=n.length/2,a=i.length/2,s=r(o),c=r(a);return`30${r(a+o+4)}02${c}${i}02${s}${n}`}};const s=BigInt(0),c=BigInt(1),u=BigInt(2),l=BigInt(3),f=BigInt(4);function d(e){const o=function(e){const t=(0,i.validateBasic)(e);r.validateObject(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:o,a:a}=t;if(n){if(!o.eql(a,o.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:a}=o,u=o.toBytes||((e,t,n)=>{const i=t.toAffine();return r.concatBytes(Uint8Array.from([4]),a.toBytes(i.x),a.toBytes(i.y))}),f=o.fromBytes||(e=>{const t=e.subarray(1);return{x:a.fromBytes(t.subarray(0,a.BYTES)),y:a.fromBytes(t.subarray(a.BYTES,2*a.BYTES))}});function d(e){const{a:t,b:r}=o,n=a.sqr(e),i=a.mul(n,e);return a.add(a.add(i,a.mul(e,t)),r)}if(!a.eql(a.sqr(o.Gy),d(o.Gx)))throw new Error("bad generator point: equation left != right");function h(e){return"bigint"==typeof e&&sa.eql(e,a.ZERO);return n(t)&&n(r)?y.ZERO:new y(t,r,a.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=a.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(y.fromAffine)}static fromHex(e){const t=y.fromAffine(f((0,n.ensureBytes)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return y.BASE.multiply(m(e))}_setWindowSize(e){this._WINDOW_SIZE=e,b.delete(this)}assertValidity(){if(this.is0()){if(o.allowInfinityPoint&&!a.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:e,y:t}=this.toAffine();if(!a.isValid(e)||!a.isValid(t))throw new Error("bad point: x or y not FE");const r=a.sqr(t),n=d(e);if(!a.eql(r,n))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(a.isOdd)return!a.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){g(e);const{px:t,py:r,pz:n}=this,{px:i,py:o,pz:s}=e,c=a.eql(a.mul(t,s),a.mul(i,n)),u=a.eql(a.mul(r,s),a.mul(o,n));return c&&u}negate(){return new y(this.px,a.neg(this.py),this.pz)}double(){const{a:e,b:t}=o,r=a.mul(t,l),{px:n,py:i,pz:s}=this;let c=a.ZERO,u=a.ZERO,f=a.ZERO,d=a.mul(n,n),h=a.mul(i,i),p=a.mul(s,s),m=a.mul(n,i);return m=a.add(m,m),f=a.mul(n,s),f=a.add(f,f),c=a.mul(e,f),u=a.mul(r,p),u=a.add(c,u),c=a.sub(h,u),u=a.add(h,u),u=a.mul(c,u),c=a.mul(m,c),f=a.mul(r,f),p=a.mul(e,p),m=a.sub(d,p),m=a.mul(e,m),m=a.add(m,f),f=a.add(d,d),d=a.add(f,d),d=a.add(d,p),d=a.mul(d,m),u=a.add(u,d),p=a.mul(i,s),p=a.add(p,p),d=a.mul(p,m),c=a.sub(c,d),f=a.mul(p,h),f=a.add(f,f),f=a.add(f,f),new y(c,u,f)}add(e){g(e);const{px:t,py:r,pz:n}=this,{px:i,py:s,pz:c}=e;let u=a.ZERO,f=a.ZERO,d=a.ZERO;const h=o.a,p=a.mul(o.b,l);let m=a.mul(t,i),b=a.mul(r,s),v=a.mul(n,c),w=a.add(t,r),E=a.add(i,s);w=a.mul(w,E),E=a.add(m,b),w=a.sub(w,E),E=a.add(t,n);let A=a.add(i,c);return E=a.mul(E,A),A=a.add(m,v),E=a.sub(E,A),A=a.add(r,n),u=a.add(s,c),A=a.mul(A,u),u=a.add(b,v),A=a.sub(A,u),d=a.mul(h,E),u=a.mul(p,v),d=a.add(u,d),u=a.sub(b,d),d=a.add(b,d),f=a.mul(u,d),b=a.add(m,m),b=a.add(b,m),v=a.mul(h,v),E=a.mul(p,E),b=a.add(b,v),v=a.sub(m,v),v=a.mul(h,v),E=a.add(E,v),m=a.mul(b,E),f=a.add(f,m),m=a.mul(A,E),u=a.mul(w,u),u=a.sub(u,m),m=a.mul(w,b),d=a.mul(A,d),d=a.add(d,m),new y(u,f,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(y.ZERO)}wNAF(e){return w.wNAFCached(this,b,e,(e=>{const t=a.invertBatch(e.map((e=>e.pz)));return e.map(((e,r)=>e.toAffine(t[r]))).map(y.fromAffine)}))}multiplyUnsafe(e){const t=y.ZERO;if(e===s)return t;if(p(e),e===c)return this;const{endo:r}=o;if(!r)return w.unsafeLadder(this,e);let{k1neg:n,k1:i,k2neg:u,k2:l}=r.splitScalar(e),f=t,d=t,h=this;for(;i>s||l>s;)i&c&&(f=f.add(h)),l&c&&(d=d.add(h)),h=h.double(),i>>=c,l>>=c;return n&&(f=f.negate()),u&&(d=d.negate()),d=new y(a.mul(d.px,r.beta),d.py,d.pz),f.add(d)}multiply(e){p(e);let t,r,n=e;const{endo:i}=o;if(i){const{k1neg:e,k1:o,k2neg:s,k2:c}=i.splitScalar(n);let{p:u,f:l}=this.wNAF(o),{p:f,f:d}=this.wNAF(c);u=w.constTimeNegate(e,u),f=w.constTimeNegate(s,f),f=new y(a.mul(f.px,i.beta),f.py,f.pz),t=u.add(f),r=l.add(d)}else{const{p:e,f:i}=this.wNAF(n);t=e,r=i}return y.normalizeZ([t,r])[0]}multiplyAndAddUnsafe(e,t,r){const n=y.BASE,i=(e,t)=>t!==s&&t!==c&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),o=i(this,t).add(i(e,r));return o.is0()?void 0:o}toAffine(e){const{px:t,py:r,pz:n}=this,i=this.is0();null==e&&(e=i?a.ONE:a.inv(n));const o=a.mul(t,e),s=a.mul(r,e),c=a.mul(n,e);if(i)return{x:a.ZERO,y:a.ZERO};if(!a.eql(c,a.ONE))throw new Error("invZ was invalid");return{x:o,y:s}}isTorsionFree(){const{h:e,isTorsionFree:t}=o;if(e===c)return!0;if(t)return t(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:t}=o;return e===c?this:t?t(y,this):this.multiplyUnsafe(o.h)}toRawBytes(e=!0){return this.assertValidity(),u(y,this,e)}toHex(e=!0){return r.bytesToHex(this.toRawBytes(e))}}y.BASE=new y(o.Gx,o.Gy,a.ONE),y.ZERO=new y(a.ZERO,a.ONE,a.ZERO);const v=o.nBitLength,w=(0,i.wNAF)(y,o.endo?Math.ceil(v/2):v);return{CURVE:o,ProjectivePoint:y,normPrivateKeyToScalar:m,weierstrassEquation:d,isWithinCurveOrder:h}}function h(e,t){const r=e.ORDER;let n=s;for(let e=r-c;e%u===s;e/=u)n+=c;const i=n,o=u<{let n=b,o=e.pow(r,p),a=e.sqr(o);a=e.mul(a,r);let s=e.mul(t,a);s=e.pow(s,h),s=e.mul(s,o),o=e.mul(s,r),a=e.mul(s,t);let l=e.mul(a,o);s=e.pow(l,m);let f=e.eql(s,e.ONE);o=e.mul(a,g),s=e.mul(l,n),a=e.cmov(o,a,f),l=e.cmov(s,l,f);for(let t=i;t>c;t--){let r=t-u;r=u<{let o=e.sqr(i);const a=e.mul(t,i);o=e.mul(o,a);let s=e.pow(o,r);s=e.mul(s,a);const c=e.mul(s,n),u=e.mul(e.sqr(s),i),l=e.eql(u,t);return{isValid:l,value:e.cmov(c,s,l)}}}return y}e.weierstrassPoints=d,e.weierstrass=function(o){const a=function(e){const t=(0,i.validateBasic)(e);return r.validateObject(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(o),{Fp:u,n:l}=a,f=u.BYTES+1,h=2*u.BYTES+1;function p(e){return t.mod(e,l)}function m(e){return t.invert(e,l)}const{ProjectivePoint:b,normPrivateKeyToScalar:g,weierstrassEquation:y,isWithinCurveOrder:v}=d({...a,toBytes(e,t,n){const i=t.toAffine(),o=u.toBytes(i.x),a=r.concatBytes;return n?a(Uint8Array.from([t.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,u.toBytes(i.y))},fromBytes(e){const t=e.length,n=e[0],i=e.subarray(1);if(t!==f||2!==n&&3!==n){if(t===h&&4===n){return{x:u.fromBytes(i.subarray(0,u.BYTES)),y:u.fromBytes(i.subarray(u.BYTES,2*u.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${f} compressed bytes or ${h} uncompressed bytes`)}{const e=r.bytesToNumberBE(i);if(!(s<(o=e)&&or.bytesToHex(r.numberToBytesBE(e,a.nByteLength));function E(e){return e>l>>c}const A=(e,t,n)=>r.bytesToNumberBE(e.slice(t,n));class x{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){const t=a.nByteLength;return e=(0,n.ensureBytes)("compactSignature",e,2*t),new x(A(e,0,t),A(e,t,2*t))}static fromDER(t){const{r:r,s:i}=e.DER.toSig((0,n.ensureBytes)("DER",t));return new x(r,i)}assertValidity(){if(!v(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!v(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new x(this.r,this.s,e)}recoverPublicKey(e){const{r:t,s:r,recovery:i}=this,o=P((0,n.ensureBytes)("msgHash",e));if(null==i||![0,1,2,3].includes(i))throw new Error("recovery id invalid");const s=2===i||3===i?t+a.n:t;if(s>=u.ORDER)throw new Error("recovery id 2 or 3 invalid");const c=1&i?"03":"02",l=b.fromHex(c+w(s)),f=m(s),d=p(-o*f),h=p(r*f),g=b.BASE.multiplyAndAddUnsafe(l,d,h);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return E(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,p(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return w(this.r)+w(this.s)}}const _={isValidPrivateKey(e){try{return g(e),!0}catch(e){return!1}},normPrivateKeyToScalar:g,randomPrivateKey:()=>{const e=t.getMinHashLength(a.n);return t.mapHashToField(a.randomBytes(e),a.n)},precompute:(e=8,t=b.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function k(e){const t=r.isBytes(e),n="string"==typeof e,i=(t||n)&&e.length;return t?i===f||i===h:n?i===2*f||i===2*h:e instanceof b}const S=a.bits2int||function(e){const t=r.bytesToNumberBE(e),n=8*e.length-a.nBitLength;return n>0?t>>BigInt(n):t},P=a.bits2int_modN||function(e){return p(S(e))},I=r.bitMask(a.nBitLength);function T(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(s<=e&&ee in i)))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:l}=a;let{lowS:f,prehash:d,extraEntropy:h}=i;null==f&&(f=!0),e=(0,n.ensureBytes)("msgHash",e),d&&(e=(0,n.ensureBytes)("prehashed msgHash",o(e)));const y=P(e),w=g(t),A=[T(w),T(y)];if(null!=h){const e=!0===h?l(u.BYTES):h;A.push((0,n.ensureBytes)("extraEntropy",e))}const _=r.concatBytes(...A),k=y;return{seed:_,k2sig:function(e){const t=S(e);if(!v(t))return;const r=m(t),n=b.BASE.multiply(t).toAffine(),i=p(n.x);if(i===s)return;const o=p(r*p(k+i*w));if(o===s)return;let a=(n.x===i?0:2)|Number(n.y&c),u=o;return f&&E(o)&&(u=function(e){return E(e)?p(-e):e}(o),a^=1),new x(i,u,a)}}}const M={lowS:a.lowS,prehash:!1},C={lowS:a.lowS,prehash:!1};return b.BASE._setWindowSize(8),{CURVE:a,getPublicKey:function(e,t=!0){return b.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(k(e))throw new Error("first arg must be private key");if(!k(t))throw new Error("second arg must be public key");return b.fromHex(t).multiply(g(e)).toRawBytes(r)},sign:function(e,t,n=M){const{seed:i,k2sig:o}=O(e,t,n),s=a;return r.createHmacDrbg(s.hash.outputLen,s.nByteLength,s.hmac)(i,o)},verify:function(t,i,o,s=C){const c=t;if(i=(0,n.ensureBytes)("msgHash",i),o=(0,n.ensureBytes)("publicKey",o),"strict"in s)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=s;let f,d;try{if("string"==typeof c||r.isBytes(c))try{f=x.fromDER(c)}catch(t){if(!(t instanceof e.DER.Err))throw t;f=x.fromCompact(c)}else{if("object"!=typeof c||"bigint"!=typeof c.r||"bigint"!=typeof c.s)throw new Error("PARSE");{const{r:e,s:t}=c;f=new x(e,t)}}d=b.fromHex(o)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&f.hasHighS())return!1;l&&(i=a.hash(i));const{r:h,s:g}=f,y=P(i),v=m(g),w=p(y*v),E=p(h*v),A=b.BASE.multiplyAndAddUnsafe(d,w,E)?.toAffine();return!!A&&p(A.x)===h},ProjectivePoint:b,Signature:x,utils:_}},e.SWUFpSqrtRatio=h,e.mapToCurveSimpleSWU=function(e,r){if(t.validateField(e),!e.isValid(r.A)||!e.isValid(r.B)||!e.isValid(r.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const n=h(e,r.Z);if(!e.isOdd)throw new Error("Fp.isOdd is not implemented!");return t=>{let i,o,a,s,c,u,l,f;i=e.sqr(t),i=e.mul(i,r.Z),o=e.sqr(i),o=e.add(o,i),a=e.add(o,e.ONE),a=e.mul(a,r.B),s=e.cmov(r.Z,e.neg(o),!e.eql(o,e.ZERO)),s=e.mul(s,r.A),o=e.sqr(a),u=e.sqr(s),c=e.mul(u,r.A),o=e.add(o,c),o=e.mul(o,a),u=e.mul(u,s),c=e.mul(u,r.B),o=e.add(o,c),l=e.mul(i,a);const{isValid:d,value:h}=n(o,u);f=e.mul(i,t),f=e.mul(f,h),l=e.cmov(l,a,d),f=e.cmov(f,h,d);const p=e.isOdd(t)===e.isOdd(f);return f=e.cmov(e.neg(f),f,p),l=e.div(l,s),{x:l,y:f}}}}(P9);var B9={};Object.defineProperty(B9,"__esModule",{value:!0}),B9.createHasher=B9.isogenyMap=B9.hash_to_field=B9.expand_message_xof=B9.expand_message_xmd=void 0;const N9=G4,R9=q4;const F9=R9.bytesToNumberBE;function L9(e,t){if(e<0||e>=1<<8*t)throw new Error(`bad I2OSP call: value=${e} length=${t}`);const r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=255&e,e>>>=8;return new Uint8Array(r)}function U9(e,t){const r=new Uint8Array(e.length);for(let n=0;n255&&(t=n((0,R9.concatBytes)((0,R9.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:i,blockLen:o}=n,a=Math.ceil(r/i);if(a>255)throw new Error("Invalid xmd length");const s=(0,R9.concatBytes)(t,L9(t.length,1)),c=L9(0,o),u=L9(r,2),l=new Array(a),f=n((0,R9.concatBytes)(c,e,u,L9(0,1),s));l[0]=n((0,R9.concatBytes)(f,L9(1,1),s));for(let e=1;e<=a;e++){const t=[U9(f,l[e-1]),L9(e+1,1),s];l[e]=n((0,R9.concatBytes)(...t))}return(0,R9.concatBytes)(...l).slice(0,r)}function $9(e,t,r,n,i){if(j9(e),j9(t),D9(r),t.length>255){const e=Math.ceil(2*n/8);t=i.create({dkLen:e}).update((0,R9.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(e).update(L9(r,2)).update(t).update(L9(t.length,1)).digest()}function H9(e,t,r){(0,R9.validateObject)(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:n,k:i,m:o,hash:a,expand:s,DST:c}=r;j9(e),D9(t);const u=function(e){if((0,R9.isBytes)(e))return e;if("string"==typeof e)return(0,R9.utf8ToBytes)(e);throw new Error("DST must be Uint8Array or string")}(c),l=n.toString(2).length,f=Math.ceil((l+i)/8),d=t*o*f;let h;if("xmd"===s)h=z9(e,u,d,a);else if("xof"===s)h=$9(e,u,d,i,a);else{if("_internal_pass"!==s)throw new Error('expand must be "xmd" or "xof"');h=e}const p=new Array(t);for(let e=0;eArray.from(e).reverse()));return(t,n)=>{const[i,o,a,s]=r.map((r=>r.reduce(((r,n)=>e.add(e.mul(r,t),n)))));return t=e.div(i,o),n=e.mul(n,e.div(a,s)),{x:t,y:n}}},B9.createHasher=function(e,t,r){if("function"!=typeof t)throw new Error("mapToCurve() must be defined");return{hashToCurve(n,i){const o=H9(n,2,{...r,DST:r.DST,...i}),a=e.fromAffine(t(o[0])),s=e.fromAffine(t(o[1])),c=a.add(s).clearCofactor();return c.assertValidity(),c},encodeToCurve(n,i){const o=H9(n,1,{...r,DST:r.encodeDST,...i}),a=e.fromAffine(t(o[0])).clearCofactor();return a.assertValidity(),a}}};var G9={},q9={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=_4,r=C4;class n extends r.Hash{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,(0,t.hash)(e);const i=(0,r.toBytes)(n);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const o=this.blockLen,a=new Uint8Array(o);a.set(i.length>o?e.create().update(i).digest():i);for(let e=0;enew n(e,t).update(r).digest(),e.hmac.create=(e,t)=>new n(e,t)}(q9),Object.defineProperty(G9,"__esModule",{value:!0}),G9.createCurve=G9.getHash=void 0; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const K9=q9,V9=C4,W9=P9;function J9(e){return{hash:e,hmac:(t,...r)=>(0,K9.hmac)(e,t,(0,V9.concatBytes)(...r)),randomBytes:V9.randomBytes}}G9.getHash=J9,G9.createCurve=function(e,t){const r=t=>(0,W9.weierstrass)({...e,...J9(t)});return Object.freeze({...r(t),create:r})},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ const t=A4,r=C4,n=G4,i=P9,o=q4,a=B9,s=G9,c=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),u=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l=BigInt(1),f=BigInt(2),d=(e,t)=>(e+t/f)/t;function h(e){const t=c,r=BigInt(3),i=BigInt(6),o=BigInt(11),a=BigInt(22),s=BigInt(23),u=BigInt(44),l=BigInt(88),d=e*e*e%t,h=d*d*e%t,m=(0,n.pow2)(h,r,t)*h%t,b=(0,n.pow2)(m,r,t)*h%t,g=(0,n.pow2)(b,f,t)*d%t,y=(0,n.pow2)(g,o,t)*g%t,v=(0,n.pow2)(y,a,t)*y%t,w=(0,n.pow2)(v,u,t)*v%t,E=(0,n.pow2)(w,l,t)*w%t,A=(0,n.pow2)(E,u,t)*v%t,x=(0,n.pow2)(A,r,t)*h%t,_=(0,n.pow2)(x,s,t)*y%t,k=(0,n.pow2)(_,i,t)*d%t,S=(0,n.pow2)(k,f,t);if(!p.eql(p.sqr(S),e))throw new Error("Cannot find square root");return S}const p=(0,n.Field)(c,void 0,void 0,{sqrt:h});e.secp256k1=(0,s.createCurve)({a:BigInt(0),b:BigInt(7),Fp:p,n:u,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=u,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),i=-l*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=r,s=BigInt("0x100000000000000000000000000000000"),c=d(a*e,t),f=d(-i*e,t);let h=(0,n.mod)(e-c*r-f*o,t),p=(0,n.mod)(-c*i-f*a,t);const m=h>s,b=p>s;if(m&&(h=t-h),b&&(p=t-p),h>s||p>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:m,k1:h,k2neg:b,k2:p}}}},t.sha256);const m=BigInt(0),b=e=>"bigint"==typeof e&&m"bigint"==typeof e&&me.charCodeAt(0))));n=(0,o.concatBytes)(r,r),y[e]=n}return(0,t.sha256)((0,o.concatBytes)(n,...r))}const w=e=>e.toRawBytes(!0).slice(1),E=e=>(0,o.numberToBytesBE)(e,32),A=e=>(0,n.mod)(e,c),x=e=>(0,n.mod)(e,u),_=e.secp256k1.ProjectivePoint,k=(e,t,r)=>_.BASE.multiplyAndAddUnsafe(e,t,r);function S(t){let r=e.secp256k1.utils.normPrivateKeyToScalar(t),n=_.fromPrivateKey(r);return{scalar:n.hasEvenY()?r:x(-r),bytes:w(n)}}function P(e){if(!b(e))throw new Error("bad x: need 0 < x < p");const t=A(e*e);let r=h(A(t*e+BigInt(7)));r%f!==m&&(r=A(-r));const n=new _(e,r,l);return n.assertValidity(),n}function I(...e){return x((0,o.bytesToNumberBE)(v("BIP0340/challenge",...e)))}function T(e){return S(e).bytes}function O(e,t,n=(0,r.randomBytes)(32)){const i=(0,o.ensureBytes)("message",e),{bytes:a,scalar:s}=S(t),c=(0,o.ensureBytes)("auxRand",n,32),u=E(s^(0,o.bytesToNumberBE)(v("BIP0340/aux",c))),l=v("BIP0340/nonce",u,a,i),f=x((0,o.bytesToNumberBE)(l));if(f===m)throw new Error("sign failed: k is zero");const{bytes:d,scalar:h}=S(f),p=I(d,a,i),b=new Uint8Array(64);if(b.set(d,0),b.set(E(x(h+p*s)),32),!M(b,i,a))throw new Error("sign: Invalid signature produced");return b}function M(e,t,r){const n=(0,o.ensureBytes)("signature",e,64),i=(0,o.ensureBytes)("message",t),a=(0,o.ensureBytes)("publicKey",r,32);try{const e=P((0,o.bytesToNumberBE)(a)),t=(0,o.bytesToNumberBE)(n.subarray(0,32));if(!b(t))return!1;const r=(0,o.bytesToNumberBE)(n.subarray(32,64));if(!g(r))return!1;const s=I(E(t),w(e),i),c=k(e,r,x(-s));return!(!c||!c.hasEvenY()||c.toAffine().x!==t)}catch(e){return!1}}e.schnorr={getPublicKey:T,sign:O,verify:M,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:P,pointToBytes:w,numberToBytesBE:o.numberToBytesBE,bytesToNumberBE:o.bytesToNumberBE,taggedHash:v,mod:n.mod}};const C=(()=>(0,a.isogenyMap)(p,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((e=>e.map((e=>BigInt(e)))))))(),B=(()=>(0,i.mapToCurveSimpleSWU)(p,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:p.create(BigInt("-11"))}))(),N=(()=>(0,a.createHasher)(e.secp256k1.ProjectivePoint,(e=>{const{x:t,y:r}=B(p.create(e[0]));return C(t,r)}),{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:p.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}))();e.hashToCurve=N.hashToCurve,e.encodeToCurve=N.encodeToCurve}(E4),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=E4;Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})}(w4),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_WITHDRAWALS_PER_PAYLOAD=e.RLP_EMPTY_STRING=e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.SECP256K1_ORDER_DIV_2=e.SECP256K1_ORDER=e.MAX_INTEGER_BIGINT=e.MAX_INTEGER=e.MAX_UINT64=void 0;const t=fe,r=w4;e.MAX_UINT64=BigInt("0xffffffffffffffff"),e.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),e.SECP256K1_ORDER=r.secp256k1.CURVE.n,e.SECP256K1_ORDER_DIV_2=r.secp256k1.CURVE.n/BigInt(2),e.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.Buffer.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.Buffer.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.Buffer.from(e.KECCAK256_RLP_S,"hex"),e.RLP_EMPTY_STRING=t.Buffer.from([128]),e.MAX_WITHDRAWALS_PER_PAYLOAD=16}(v4);var Z9={};Object.defineProperty(Z9,"__esModule",{value:!0}),Z9.GWEI_TO_WEI=void 0,Z9.GWEI_TO_WEI=BigInt(1e9);var Y9={},X9={};function Q9(e){if(Array.isArray(e)){const t=[];let r=0;for(let n=0;ne.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function t7(e){if(0===e[0])throw new Error("invalid RLP: extra zeros");return s7(a7(e))}function r7(e,t){if(e<56)return Uint8Array.from([e+t]);const r=f7(e),n=f7(t+55+r.length/2);return Uint8Array.from(c7(n+r))}function n7(e,t=!1){if(null==e||0===e.length)return Uint8Array.from([]);const r=i7(h7(e));if(t)return r;if(0!==r.remainder.length)throw new Error("invalid RLP: remainder must be zero");return r.data}function i7(e){let t,r,n,i,o;const a=[],s=e[0];if(s<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(s<=183){if(t=s-127,n=128===s?Uint8Array.from([]):e7(e,1,t),2===t&&n[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:n,remainder:e.slice(t)}}if(s<=191){if(r=s-182,e.length-1e.length)throw new Error("invalid RLP: total length is larger than the data");for(i=e7(e,r,n);i.length;)o=i7(i),a.push(o.data),i=o.remainder;return{data:a,remainder:e.slice(n)}}}Object.defineProperty(X9,"__esModule",{value:!0}),X9.RLP=X9.utils=X9.decode=X9.encode=void 0,X9.encode=Q9,X9.decode=n7;const o7=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function a7(e){let t="";for(let r=0;re+t.length),0),r=new Uint8Array(t);for(let t=0,n=0;t=2&&"0"===e[0]&&"x"===e[1]}function h7(e){if(e instanceof Uint8Array)return e;if("string"==typeof e)return d7(e)?c7((t="string"!=typeof(r=e)?r:d7(r)?r.slice(2):r).length%2?`0${t}`:t):l7(e);var t,r;if("number"==typeof e||"bigint"==typeof e)return e?c7(f7(e)):Uint8Array.from([]);if(null==e)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}X9.utils={bytesToHex:a7,concatBytes:u7,hexToBytes:c7,utf8ToBytes:l7},X9.RLP={encode:Q9,decode:n7};var p7={},m7={},b7={};Object.defineProperty(b7,"__esModule",{value:!0}),b7.add5L=b7.add5H=b7.add4H=b7.add4L=b7.add3H=b7.add3L=b7.add=b7.rotlBL=b7.rotlBH=b7.rotlSL=b7.rotlSH=b7.rotr32L=b7.rotr32H=b7.rotrBL=b7.rotrBH=b7.rotrSL=b7.rotrSH=b7.shrSL=b7.shrSH=b7.toBig=b7.split=b7.fromBig=void 0;const g7=BigInt(2**32-1),y7=BigInt(32);function v7(e,t=!1){return t?{h:Number(e&g7),l:Number(e>>y7&g7)}:{h:0|Number(e>>y7&g7),l:0|Number(e&g7)}}function w7(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);b7.toBig=E7;const A7=(e,t,r)=>e>>>r;b7.shrSH=A7;const x7=(e,t,r)=>e<<32-r|t>>>r;b7.shrSL=x7;const _7=(e,t,r)=>e>>>r|t<<32-r;b7.rotrSH=_7;const k7=(e,t,r)=>e<<32-r|t>>>r;b7.rotrSL=k7;const S7=(e,t,r)=>e<<64-r|t>>>r-32;b7.rotrBH=S7;const P7=(e,t,r)=>e>>>r-32|t<<64-r;b7.rotrBL=P7;const I7=(e,t)=>t;b7.rotr32H=I7;const T7=(e,t)=>e;b7.rotr32L=T7;const O7=(e,t,r)=>e<>>32-r;b7.rotlSH=O7;const M7=(e,t,r)=>t<>>32-r;b7.rotlSL=M7;const C7=(e,t,r)=>t<>>64-r;b7.rotlBH=C7;const B7=(e,t,r)=>e<>>64-r;function N7(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}b7.rotlBL=B7,b7.add=N7;const R7=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);b7.add3L=R7;const F7=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;b7.add3H=F7;const L7=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);b7.add4L=L7;const U7=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;b7.add4H=U7;const j7=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);b7.add5L=j7;const D7=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;b7.add5H=D7;const z7={fromBig:v7,split:w7,toBig:E7,shrSH:A7,shrSL:x7,rotrSH:_7,rotrSL:k7,rotrBH:S7,rotrBL:P7,rotr32H:I7,rotr32L:T7,rotlSH:O7,rotlSL:M7,rotlBH:C7,rotlBL:B7,add:N7,add3L:R7,add3H:F7,add4L:L7,add4H:U7,add5H:D7,add5L:j7};b7.default=z7,Object.defineProperty(m7,"__esModule",{value:!0}),m7.shake256=m7.shake128=m7.keccak_512=m7.keccak_384=m7.keccak_256=m7.keccak_224=m7.sha3_512=m7.sha3_384=m7.sha3_256=m7.sha3_224=m7.Keccak=m7.keccakP=void 0;const $7=_4,H7=b7,G7=C4,[q7,K7,V7]=[[],[],[]],W7=BigInt(0),J7=BigInt(1),Z7=BigInt(2),Y7=BigInt(7),X7=BigInt(256),Q7=BigInt(113);for(let e=0,t=J7,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],q7.push(2*(5*n+r)),K7.push((e+1)*(e+2)/2%64);let i=W7;for(let e=0;e<7;e++)t=(t<>Y7)*Q7)%X7,t&Z7&&(i^=J7<<(J7<r>32?(0,H7.rotlBH)(e,t,r):(0,H7.rotlSH)(e,t,r),nee=(e,t,r)=>r>32?(0,H7.rotlBL)(e,t,r):(0,H7.rotlSL)(e,t,r);function iee(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=ree(o,a,1)^r[n],c=nee(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=K7[r],o=ree(t,i,n),a=nee(t,i,n),s=q7[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=eee[n],e[1]^=tee[n]}r.fill(0)}m7.keccakP=iee;let oee=class e extends G7.Hash{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,$7.number)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,G7.u32)(this.state)}keccak(){iee(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){(0,$7.exists)(this);const{blockLen:t,state:r}=this,n=(e=(0,G7.toBytes)(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,$7.number)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,$7.output)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return t||(t=new e(r,n,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}};m7.Keccak=oee;const aee=(e,t,r)=>(0,G7.wrapConstructor)((()=>new oee(t,e,r)));m7.sha3_224=aee(6,144,28),m7.sha3_256=aee(6,136,32),m7.sha3_384=aee(6,104,48),m7.sha3_512=aee(6,72,64),m7.keccak_224=aee(1,144,28),m7.keccak_256=aee(1,136,32),m7.keccak_384=aee(1,104,48),m7.keccak_512=aee(1,72,64);const see=(e,t,r)=>(0,G7.wrapXOFConstructorWithOpts)(((n={})=>new oee(t,e,void 0===n.dkLen?r:n.dkLen,!0)));m7.shake128=see(31,168,16),m7.shake256=see(31,136,32);var cee={exports:{}};!function(e,t){var r=o&&o.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.wrapHash=t.equalsBytes=t.hexToBytes=t.bytesToUtf8=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0;const n=r(_4),i=C4,a=n.default.bool;t.assertBool=a;const s=n.default.bytes;t.assertBytes=s;var c=C4;Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return c.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return c.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return c.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return c.utf8ToBytes}}),t.bytesToUtf8=function(e){if(!(e instanceof Uint8Array))throw new TypeError("bytesToUtf8 expected Uint8Array, got "+typeof e);return(new TextDecoder).decode(e)},t.hexToBytes=function(e){const t=e.startsWith("0x")?e.substring(2):e;return(0,i.hexToBytes)(t)},t.equalsBytes=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r(n.default.bytes(t),e(t))},t.crypto=(()=>{const t="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,r=rW.bind(e);return{node:r&&!t?r("crypto"):void 0,web:t}})()}(cee,cee.exports);var uee=cee.exports;Object.defineProperty(p7,"__esModule",{value:!0}),p7.keccak512=p7.keccak384=p7.keccak256=p7.keccak224=void 0;const lee=m7,fee=uee;p7.keccak224=(0,fee.wrapHash)(lee.keccak_224),p7.keccak256=(()=>{const e=(0,fee.wrapHash)(lee.keccak_256);return e.create=lee.keccak_256.create,e})(),p7.keccak384=(0,fee.wrapHash)(lee.keccak_384),p7.keccak512=(0,fee.wrapHash)(lee.keccak_512);var dee={},hee={},pee={};function mee(e){if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type "+typeof e);return"0"===e[0]&&"x"===e[1]}Object.defineProperty(pee,"__esModule",{value:!0}),pee.isHexString=pee.getKeys=pee.fromAscii=pee.fromUtf8=pee.toAscii=pee.arrayContainsArray=pee.getBinarySize=pee.padToEven=pee.stripHexPrefix=pee.isHexPrefixed=void 0,pee.isHexPrefixed=mee;function bee(e){let t=e;if("string"!=typeof t)throw new Error("[padToEven] value must be type 'string', received "+typeof t);return t.length%2&&(t=`0${t}`),t}pee.stripHexPrefix=e=>{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return mee(e)?e.slice(2):e},pee.padToEven=bee,pee.getBinarySize=function(e){if("string"!=typeof e)throw new Error("[getBinarySize] method requires input type 'string', received "+typeof e);return _.byteLength(e,"utf8")},pee.arrayContainsArray=function(e,t,r){if(!0!==Array.isArray(e))throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(!0!==Array.isArray(t))throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof t}'`);return t[!0===r?"some":"every"]((t=>e.indexOf(t)>=0))},pee.toAscii=function(e){let t="",r=0;const n=e.length;for("0x"===e.substring(0,2)&&(r=2);r0&&e.length!==2+2*t)},Object.defineProperty(hee,"__esModule",{value:!0}),hee.assertIsString=hee.assertIsArray=hee.assertIsBuffer=hee.assertIsHexString=void 0;const gee=pee;hee.assertIsHexString=function(e){if(!(0,gee.isHexString)(e)){throw new Error(`This method only supports 0x-prefixed hex strings but input was: ${e}`)}};hee.assertIsBuffer=function(e){if(!_.isBuffer(e)){throw new Error(`This method only supports Buffer but input was: ${e}`)}};hee.assertIsArray=function(e){if(!Array.isArray(e)){throw new Error(`This method only supports number arrays but input was: ${e}`)}};hee.assertIsString=function(e){if("string"!=typeof e){throw new Error(`This method only supports strings but input was: ${e}`)}},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.intToUnpaddedBuffer=e.bigIntToUnpaddedBuffer=e.bigIntToHex=e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.short=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToInt=e.bigIntToBuffer=e.bufferToBigInt=e.bufferToHex=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;const t=hee,r=pee;e.intToHex=function(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`};e.intToBuffer=function(t){const n=(0,e.intToHex)(t);return _.from((0,r.padToEven)(n.slice(2)),"hex")};e.zeros=function(e){return _.allocUnsafe(e).fill(0)};const n=function(t,r,n){const i=(0,e.zeros)(r);return n?t.length0&&"0"===t.toString();)t=(e=e.slice(1))[0];return e};e.unpadBuffer=function(e){return(0,t.assertIsBuffer)(e),i(e)};e.unpadArray=function(e){return(0,t.assertIsArray)(e),i(e)};e.unpadHexString=function(e){return(0,t.assertIsHexString)(e),e=(0,r.stripHexPrefix)(e),"0x"+i(e)};e.toBuffer=function(t){if(null==t)return _.allocUnsafe(0);if(_.isBuffer(t))return _.from(t);if(Array.isArray(t)||t instanceof Uint8Array)return _.from(t);if("string"==typeof t){if(!(0,r.isHexString)(t))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${t}`);return _.from((0,r.padToEven)((0,r.stripHexPrefix)(t)),"hex")}if("number"==typeof t)return(0,e.intToBuffer)(t);if("bigint"==typeof t){if(t0&&0===r[0])throw new Error(`${t} cannot have leading zeroes, received: ${r.toString("hex")}`)},e.arrToBufArr=function e(t){return Array.isArray(t)?t.map((t=>e(t))):_.from(t)},e.bufArrToArr=function e(t){return Array.isArray(t)?t.map((t=>e(t))):Uint8Array.from(t??[])};e.bigIntToHex=e=>"0x"+e.toString(16),e.bigIntToUnpaddedBuffer=function(t){return(0,e.unpadBuffer)(a(t))},e.intToUnpaddedBuffer=function(t){return(0,e.unpadBuffer)((0,e.intToBuffer)(t))}}(dee),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.accountBodyToRLP=e.accountBodyToSlim=e.accountBodyFromSlim=e.isZeroAddress=e.zeroAddress=e.importPublic=e.privateToAddress=e.privateToPublic=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isValidAddress=e.Account=void 0;const t=X9,r=p7,n=w4,i=uee,o=dee,a=v4,s=hee,c=pee,u=BigInt(0);class l{constructor(e=u,t=u,r=a.KECCAK256_RLP,n=a.KECCAK256_NULL){this.nonce=e,this.balance=t,this.storageRoot=r,this.codeHash=n,this._validate()}static fromAccountData(e){const{nonce:t,balance:r,storageRoot:n,codeHash:i}=e;return new l(void 0!==t?(0,o.bufferToBigInt)((0,o.toBuffer)(t)):void 0,void 0!==r?(0,o.bufferToBigInt)((0,o.toBuffer)(r)):void 0,void 0!==n?(0,o.toBuffer)(n):void 0,void 0!==i?(0,o.toBuffer)(i):void 0)}static fromRlpSerializedAccount(e){const r=(0,o.arrToBufArr)(t.RLP.decode(Uint8Array.from(e)));if(!Array.isArray(r))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(r)}static fromValuesArray(e){const[t,r,n,i]=e;return new l((0,o.bufferToBigInt)(t),(0,o.bufferToBigInt)(r),n,i)}_validate(){if(this.nonce=8?f+=n[e].toUpperCase():f+=n[e];return f};e.isValidChecksumAddress=function(t,r){return(0,e.isValidAddress)(t)&&(0,e.toChecksumAddress)(t,r)===t};e.generateAddress=function(e,n){return(0,s.assertIsBuffer)(e),(0,s.assertIsBuffer)(n),(0,o.bufferToBigInt)(n)===BigInt(0)?_.from((0,r.keccak256)(t.RLP.encode((0,o.bufArrToArr)([e,null])))).slice(-20):_.from((0,r.keccak256)(t.RLP.encode((0,o.bufArrToArr)([e,n])))).slice(-20)};e.generateAddress2=function(e,t,n){if((0,s.assertIsBuffer)(e),(0,s.assertIsBuffer)(t),(0,s.assertIsBuffer)(n),20!==e.length)throw new Error("Expected from to be of length 20");if(32!==t.length)throw new Error("Expected salt to be of length 32");const i=(0,r.keccak256)(_.concat([_.from("ff","hex"),e,t,(0,r.keccak256)(n)]));return(0,o.toBuffer)(i).slice(-20)};e.isValidPrivate=function(e){return n.secp256k1.utils.isValidPrivateKey(e)};e.isValidPublic=function(e,t=!1){if((0,s.assertIsBuffer)(e),64===e.length)try{return n.secp256k1.ProjectivePoint.fromHex(_.concat([_.from([4]),e])),!0}catch(e){return!1}if(!t)return!1;try{return n.secp256k1.ProjectivePoint.fromHex(e),!0}catch(e){return!1}};e.pubToAddress=function(e,t=!1){if((0,s.assertIsBuffer)(e),t&&64!==e.length&&(e=_.from(n.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),64!==e.length)throw new Error("Expected pubKey to be of length 64");return _.from((0,r.keccak256)(e)).slice(-20)},e.publicToAddress=e.pubToAddress;e.privateToPublic=function(e){return(0,s.assertIsBuffer)(e),_.from(n.secp256k1.ProjectivePoint.fromPrivateKey(e).toRawBytes(!1).slice(1))};e.privateToAddress=function(t){return(0,e.publicToAddress)((0,e.privateToPublic)(t))};e.importPublic=function(e){return(0,s.assertIsBuffer)(e),64!==e.length&&(e=_.from(n.secp256k1.ProjectivePoint.fromHex(e).toRawBytes(!1).slice(1))),e};e.zeroAddress=function(){const e=(0,o.zeros)(20);return(0,o.bufferToHex)(e)};function f(e){const[t,r,n,i]=e;return[t,r,0===(0,o.arrToBufArr)(n).length?a.KECCAK256_RLP:n,0===(0,o.arrToBufArr)(i).length?a.KECCAK256_NULL:i]}e.isZeroAddress=function(t){try{(0,s.assertIsString)(t)}catch(e){return!1}return(0,e.zeroAddress)()===t},e.accountBodyFromSlim=f;const d=new Uint8Array(0);e.accountBodyToSlim=function(e){const[t,r,n,i]=e;return[t,r,(0,o.arrToBufArr)(n).equals(a.KECCAK256_RLP)?d:n,(0,o.arrToBufArr)(i).equals(a.KECCAK256_NULL)?d:i]},e.accountBodyToRLP=function(e,r=!0){const n=r?f(e):e;return(0,o.arrToBufArr)(t.RLP.encode(n))}}(Y9);var yee={};Object.defineProperty(yee,"__esModule",{value:!0}),yee.Address=void 0;const vee=Y9,wee=dee;class Eee{constructor(e){if(20!==e.length)throw new Error("Invalid address length");this.buf=e}static zero(){return new Eee((0,wee.zeros)(20))}static fromString(e){if(!(0,vee.isValidAddress)(e))throw new Error("Invalid address");return new Eee((0,wee.toBuffer)(e))}static fromPublicKey(e){if(!_.isBuffer(e))throw new Error("Public key should be Buffer");const t=(0,vee.pubToAddress)(e);return new Eee(t)}static fromPrivateKey(e){if(!_.isBuffer(e))throw new Error("Private key should be Buffer");const t=(0,vee.privateToAddress)(e);return new Eee(t)}static generate(e,t){if("bigint"!=typeof t)throw new Error("Expected nonce to be a bigint");return new Eee((0,vee.generateAddress)(e.buf,(0,wee.bigIntToBuffer)(t)))}static generate2(e,t,r){if(!_.isBuffer(t))throw new Error("Expected salt to be a Buffer");if(!_.isBuffer(r))throw new Error("Expected initCode to be a Buffer");return new Eee((0,vee.generateAddress2)(e.buf,t,r))}equals(e){return this.buf.equals(e.buf)}isZero(){return this.equals(Eee.zero())}isPrecompileOrSystemAddress(){const e=(0,wee.bufferToBigInt)(this.buf),t=BigInt(0),r=BigInt("0xffff");return e>=t&&e<=r}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return _.from(this.buf)}}yee.Address=Eee;var Aee={},xee={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=void 0;const t=dee,r=pee;var n;!function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Buffer=2]="Buffer",e[e.PrefixedHexString=3]="PrefixedHexString"}(n=e.TypeOutput||(e.TypeOutput={})),e.toType=function(e,i){if(null===e)return null;if(void 0===e)return;if("string"==typeof e&&!(0,r.isHexString)(e))throw new Error(`A string must be provided with a 0x-prefix, given: ${e}`);if("number"==typeof e&&!Number.isSafeInteger(e))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const o=(0,t.toBuffer)(e);switch(i){case n.Buffer:return o;case n.BigInt:return(0,t.bufferToBigInt)(o);case n.Number:{const e=(0,t.bufferToBigInt)(o);if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(e)}case n.PrefixedHexString:return(0,t.bufferToHex)(o);default:throw new Error("unknown outputType")}}}(xee),Object.defineProperty(Aee,"__esModule",{value:!0}),Aee.Withdrawal=void 0;const _ee=yee,kee=dee,See=xee;class Pee{constructor(e,t,r,n){this.index=e,this.validatorIndex=t,this.address=r,this.amount=n}static fromWithdrawalData(e){const{index:t,validatorIndex:r,address:n,amount:i}=e,o=(0,See.toType)(t,See.TypeOutput.BigInt),a=(0,See.toType)(r,See.TypeOutput.BigInt),s=new _ee.Address((0,See.toType)(n,See.TypeOutput.Buffer)),c=(0,See.toType)(i,See.TypeOutput.BigInt);return new Pee(o,a,s,c)}static fromValuesArray(e){if(4!==e.length)throw Error(`Invalid withdrawalArray length expected=4 actual=${e.length}`);const[t,r,n,i]=e;return Pee.fromWithdrawalData({index:t,validatorIndex:r,address:n,amount:i})}static toBufferArray(e){const{index:t,validatorIndex:r,address:n,amount:i}=e,o=(0,See.toType)(t,See.TypeOutput.BigInt)===BigInt(0)?_.alloc(0):(0,See.toType)(t,See.TypeOutput.Buffer),a=(0,See.toType)(r,See.TypeOutput.BigInt)===BigInt(0)?_.alloc(0):(0,See.toType)(r,See.TypeOutput.Buffer);let s;s=n instanceof _ee.Address?n.buf:(0,See.toType)(n,See.TypeOutput.Buffer);return[o,a,s,(0,See.toType)(i,See.TypeOutput.BigInt)===BigInt(0)?_.alloc(0):(0,See.toType)(i,See.TypeOutput.Buffer)]}raw(){return Pee.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,kee.bigIntToHex)(this.index),validatorIndex:(0,kee.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,kee.bigIntToHex)(this.amount)}}}Aee.Withdrawal=Pee;var Iee={};Object.defineProperty(Iee,"__esModule",{value:!0}),Iee.hashPersonalMessage=Iee.isValidSignature=Iee.fromRpcSig=Iee.toCompactSig=Iee.toRpcSig=Iee.ecrecover=Iee.ecsign=void 0;const Tee=p7,Oee=w4,Mee=dee,Cee=v4,Bee=hee;function Nee(e,t){return e===BigInt(0)||e===BigInt(1)?e:void 0===t?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function Ree(e){return e===BigInt(0)||e===BigInt(1)}Iee.ecsign=function(e,t,r){const n=Oee.secp256k1.sign(e,t),i=n.toCompactRawBytes();return{r:_.from(i.slice(0,32)),s:_.from(i.slice(32,64)),v:void 0===r?BigInt(n.recovery+27):BigInt(n.recovery+35)+BigInt(r)*BigInt(2)}};Iee.ecrecover=function(e,t,r,n,i){const o=_.concat([(0,Mee.setLengthLeft)(r,32),(0,Mee.setLengthLeft)(n,32)],64),a=Nee(t,i);if(!Ree(a))throw new Error("Invalid signature v value");const s=Oee.secp256k1.Signature.fromCompact(o).addRecoveryBit(Number(a)).recoverPublicKey(e);return _.from(s.toRawBytes(!1).slice(1))};Iee.toRpcSig=function(e,t,r,n){if(!Ree(Nee(e,n)))throw new Error("Invalid signature v value");return(0,Mee.bufferToHex)(_.concat([(0,Mee.setLengthLeft)(t,32),(0,Mee.setLengthLeft)(r,32),(0,Mee.toBuffer)(e)]))};Iee.toCompactSig=function(e,t,r,n){if(!Ree(Nee(e,n)))throw new Error("Invalid signature v value");let i=r;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(i=_.from(r),i[0]|=128),(0,Mee.bufferToHex)(_.concat([(0,Mee.setLengthLeft)(t,32),(0,Mee.setLengthLeft)(i,32)]))};Iee.fromRpcSig=function(e){const t=(0,Mee.toBuffer)(e);let r,n,i;if(t.length>=65)r=t.slice(0,32),n=t.slice(32,64),i=(0,Mee.bufferToBigInt)(t.slice(64));else{if(64!==t.length)throw new Error("Invalid signature length");r=t.slice(0,32),n=t.slice(32,64),i=BigInt((0,Mee.bufferToInt)(t.slice(32,33))>>7),n[0]&=127}return i<27&&(i+=BigInt(27)),{v:i,r:r,s:n}};Iee.isValidSignature=function(e,t,r,n=!0,i){if(32!==t.length||32!==r.length)return!1;if(!Ree(Nee(e,i)))return!1;const o=(0,Mee.bufferToBigInt)(t),a=(0,Mee.bufferToBigInt)(r);return!(o===BigInt(0)||o>=Cee.SECP256K1_ORDER||a===BigInt(0)||a>=Cee.SECP256K1_ORDER)&&!(n&&a>=Cee.SECP256K1_ORDER_DIV_2)};Iee.hashPersonalMessage=function(e){(0,Bee.assertIsBuffer)(e);const t=_.from(`Ethereum Signed Message:\n${e.length}`,"utf-8");return _.from((0,Tee.keccak256)(_.concat([t,e])))};var Fee={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.compactBytesToNibbles=e.bytesToNibbles=e.nibblesToCompactBytes=e.nibblesToBytes=e.hasTerminator=void 0;e.hasTerminator=e=>e.length>0&&16===e[e.length-1];e.nibblesToBytes=(e,t)=>{for(let r=0,n=0;n{let r=0;(0,e.hasTerminator)(t)&&(r=1,t=t.subarray(0,t.length-1));const n=new Uint8Array(t.length/2+1);return n[0]=r<<5,1&~t.length||(n[0]|=16,n[0]|=t[0],t=t.subarray(1)),(0,e.nibblesToBytes)(t,n.subarray(1)),n};e.bytesToNibbles=e=>{const t=2*e.length+1,r=new Uint8Array(t);for(let t=0;t{if(0===t.length)return t;let r=(0,e.bytesToNibbles)(t);r[0]<2&&(r=r.subarray(0,r.length-1));const n=2-(1&r[0]);return r.subarray(n)}}(Fee);var Lee={};Object.defineProperty(Lee,"__esModule",{value:!0}),Lee.AsyncEventEmitter=void 0;const Uee=xe;class jee extends Uee.EventEmitter{emit(e,...t){let[r,n]=t;const i=this;let o=i._events[e]??[];return void 0===n&&"function"==typeof r&&(n=r,r=void 0),"newListener"!==e&&"removeListener"!==e||(r={event:r,fn:n},n=void 0),o=Array.isArray(o)?o:[o],async function(e,t,r){let n;for await(const i of t)try{i.length<2?i.call(e,r):await new Promise(((t,n)=>{i.call(e,r,(e=>{e?n(e):t()}))}))}catch(e){n=e}if(n)throw n}(i,o.slice(),r).then(n).catch(n),i.listenerCount(e)>0}once(e,t){const r=this;let n;if("function"!=typeof t)throw new TypeError("listener must be a function");return n=t.length>=2?function(i,o){r.removeListener(e,n),t(i,o)}:function(i){r.removeListener(e,n),t(i,n)},r.on(e,n),r}first(e,t){let r=this._events[e]??[];if("function"!=typeof t)throw new TypeError("listener must be a function");return Array.isArray(r)||(this._events[e]=r=[r]),r.unshift(t),this}before(e,t,r){return this.beforeOrAfter(e,t,r)}after(e,t,r){return this.beforeOrAfter(e,t,r,"after")}beforeOrAfter(e,t,r,n){let i,o,a=this._events[e]??[];const s="after"===n?1:0;if("function"!=typeof r)throw new TypeError("listener must be a function");if("function"!=typeof t)throw new TypeError("target must be a function");for(Array.isArray(a)||(this._events[e]=a=[a]),o=a.length,i=a.length;i--;)if(a[i]===t){o=i+s;break}return a.splice(o,0,r),this}on(e,t){return super.on(e,t)}addListener(e,t){return super.addListener(e,t)}prependListener(e,t){return super.prependListener(e,t)}prependOnceListener(e,t){return super.prependOnceListener(e,t)}removeAllListeners(e){return super.removeAllListeners(e)}removeListener(e,t){return super.removeListener(e,t)}eventNames(){return super.eventNames()}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(e){return super.setMaxListeners(e)}}Lee.AsyncEventEmitter=jee;var Dee={};Object.defineProperty(Dee,"__esModule",{value:!0}),Dee.Lock=void 0;Dee.Lock=class{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise((e=>this.promiseResolverQueue.push(e)))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(1===this.permits&&this.promiseResolverQueue.length>0){this.permits-=1;const e=this.promiseResolverQueue.shift();e&&e(!0)}}};var zee,$ee,Hee={},Gee={},qee=ete(u.fetch)&&ete(u.ReadableStream);function Kee(e){$ee||($ee=new u.XMLHttpRequest).open("GET",u.location.host?"/":"https://example.com");try{return $ee.responseType=e,$ee.responseType===e}catch(e){return!1}}var Vee=void 0!==u.ArrayBuffer,Wee=Vee&&ete(u.ArrayBuffer.prototype.slice),Jee=Vee&&Kee("arraybuffer"),Zee=!qee&&Wee&&Kee("ms-stream"),Yee=!qee&&Vee&&Kee("moz-chunked-arraybuffer"),Xee=ete($ee.overrideMimeType),Qee=ete(u.VBArray);function ete(e){return"function"==typeof e}$ee=null;var tte="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},rte=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),r={},n=0;n=i)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}})),a=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),bte(t)?r.showHidden=t:t&&Nte(r,t),Ate(r.showHidden)&&(r.showHidden=!1),Ate(r.depth)&&(r.depth=2),Ate(r.colors)&&(r.colors=!1),Ate(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=lte),dte(r,e,r.depth)}function lte(e,t){var r=ute.styles[t];return r?"["+ute.colors[r][0]+"m"+e+"["+ute.colors[r][1]+"m":e}function fte(e,t){return e}function dte(e,t,r){if(e.customInspect&&t&&Pte(t.inspect)&&t.inspect!==ute&&(!t.constructor||t.constructor.prototype!==t)){var n=t.inspect(r,e);return wte(n)||(n=dte(e,n,r)),n}var i=function(e,t){if(Ate(t))return e.stylize("undefined","undefined");if(wte(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(vte(t))return e.stylize(""+t,"number");if(bte(t))return e.stylize(""+t,"boolean");if(gte(t))return e.stylize("null","null")}(e,t);if(i)return i;var o=Object.keys(t),a=function(e){var t={};return e.forEach((function(e,r){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),Ste(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return hte(t);if(0===o.length){if(Pte(t)){var s=t.name?": "+t.name:"";return e.stylize("[Function"+s+"]","special")}if(xte(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(kte(t))return e.stylize(Date.prototype.toString.call(t),"date");if(Ste(t))return hte(t)}var c,u="",l=!1,f=["{","}"];(mte(t)&&(l=!0,f=["[","]"]),Pte(t))&&(u=" [Function"+(t.name?": "+t.name:"")+"]");return xte(t)&&(u=" "+RegExp.prototype.toString.call(t)),kte(t)&&(u=" "+Date.prototype.toUTCString.call(t)),Ste(t)&&(u=" "+hte(t)),0!==o.length||l&&0!=t.length?r<0?xte(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special"):(e.seen.push(t),c=l?function(e,t,r,n,i){for(var o=[],a=0,s=t.length;a60)return r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1];return r[0]+t+" "+e.join(", ")+" "+r[1]}(c,u,f)):f[0]+u+f[1]}function hte(e){return"["+Error.prototype.toString.call(e)+"]"}function pte(e,t,r,n,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")),Rte(n,i)||(a="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=gte(r)?dte(e,c.value,null):dte(e,c.value,r-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")),Ate(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 mte(e){return Array.isArray(e)}function bte(e){return"boolean"==typeof e}function gte(e){return null===e}function yte(e){return null==e}function vte(e){return"number"==typeof e}function wte(e){return"string"==typeof e}function Ete(e){return"symbol"==typeof e}function Ate(e){return void 0===e}function xte(e){return _te(e)&&"[object RegExp]"===Ote(e)}function _te(e){return"object"==typeof e&&null!==e}function kte(e){return _te(e)&&"[object Date]"===Ote(e)}function Ste(e){return _te(e)&&("[object Error]"===Ote(e)||e instanceof Error)}function Pte(e){return"function"==typeof e}function Ite(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Tte(e){return _.isBuffer(e)}function Ote(e){return Object.prototype.toString.call(e)}function Mte(e){return e<10?"0"+e.toString(10):e.toString(10)}ute.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]},ute.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Cte=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Bte(){console.log("%s - %s",function(){var e=new Date,t=[Mte(e.getHours()),Mte(e.getMinutes()),Mte(e.getSeconds())].join(":");return[e.getDate(),Cte[e.getMonth()],t].join(" ")}(),ite.apply(null,arguments))}function Nte(e,t){if(!t||!_te(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function Rte(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Fte="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function Lte(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(Fte&&e[Fte]){var t;if("function"!=typeof(t=e[Fte]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,Fte,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,r,n=new Promise((function(e,n){t=e,r=n})),i=[],o=0;o0?this.tail.next=t:this.head=t,this.tail=t,++this.length},$te.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},$te.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},$te.prototype.clear=function(){this.head=this.tail=null,this.length=0},$te.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},$te.prototype.concat=function(e){if(0===this.length)return _.alloc(0);if(1===this.length)return this.head.data;for(var t=_.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t},qte.ReadableState=Gte;var Hte=cte("stream");function Gte(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof vre&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new $te,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new di(e.encoding),this.encoding=e.encoding)}function qte(e){if(!(this instanceof qte))return new qte(e);this._readableState=new Gte(e,this),this.readable=!0,e&&"function"==typeof e.read&&(this._read=e.read),ge.call(this)}function Kte(e,t,r,n,i){var o=function(e,t){var r=null;_.isBuffer(t)||"string"==typeof t||null==t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));return r}(t,r);if(o)e.emit("error",o);else if(null===r)t.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,Jte(e)}(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var c;!t.decoder||i||n||(r=t.decoder.write(r),c=!t.objectMode&&0===r.length),i||(t.reading=!1),c||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Jte(e))),function(e,t){t.readingMore||(t.readingMore=!0,zt(Yte,e,t))}(e,t)}else i||(t.reading=!1);return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=Vte?e=Vte:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function Jte(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Hte("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?zt(Zte,e):Zte(e))}function Zte(e){Hte("emit readable"),e.emit("readable"),ere(e)}function Yte(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(a===o.length?i+=o:i+=o.slice(0,e),0===(e-=a)){a===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=o.slice(a));break}++n}return t.length-=n,i}(e,t):function(e,t){var r=_.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,a=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,a),0===(e-=a)){a===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=o.slice(a));break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function rre(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,zt(nre,t,e))}function nre(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function ire(e,t){for(var r=0,n=e.length;r=t.highWaterMark||t.ended))return Hte("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?rre(this):Jte(this),null;if(0===(e=Wte(e,t))&&t.ended)return 0===t.length&&rre(this),null;var n,i=t.needReadable;return Hte("need readable",i),(0===t.length||t.length-e0?tre(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&rre(this)),null!==n&&this.emit("data",n),n},qte.prototype._read=function(e){this.emit("error",new Error("not implemented"))},qte.prototype.pipe=function(e,t){var r=this,n=this._readableState;switch(n.pipesCount){case 0:n.pipes=e;break;case 1:n.pipes=[n.pipes,e];break;default:n.pipes.push(e)}n.pipesCount+=1,Hte("pipe count=%d opts=%j",n.pipesCount,t);var i=!t||!1!==t.end?a:u;function o(e){Hte("onunpipe"),e===r&&u()}function a(){Hte("onend"),e.end()}n.endEmitted?zt(i):r.once("end",i),e.on("unpipe",o);var s=function(e){return function(){var t=e._readableState;Hte("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&e.listeners("data").length&&(t.flowing=!0,ere(e))}}(r);e.on("drain",s);var c=!1;function u(){Hte("cleanup"),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("drain",s),e.removeListener("error",d),e.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",u),r.removeListener("data",f),c=!0,!n.awaitDrain||e._writableState&&!e._writableState.needDrain||s()}var l=!1;function f(t){Hte("ondata"),l=!1,!1!==e.write(t)||l||((1===n.pipesCount&&n.pipes===e||n.pipesCount>1&&-1!==ire(n.pipes,e))&&!c&&(Hte("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,l=!0),r.pause())}function d(t){Hte("onerror",t),m(),e.removeListener("error",d),0===function(e,t){return e.listeners(t).length}(e,"error")&&e.emit("error",t)}function h(){e.removeListener("finish",p),m()}function p(){Hte("onfinish"),e.removeListener("close",h),m()}function m(){Hte("unpipe"),r.unpipe(e)}return r.on("data",f),function(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}(e,"error",d),e.once("close",h),e.once("finish",p),e.emit("pipe",r),n.flowing||(Hte("pipe resume"),r.resume()),e},qte.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this)),this;if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},cre.prototype._write=function(e,t,r){r(new Error("not implemented"))},cre.prototype._writev=null,cre.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(e,t,r){t.ending=!0,pre(e,t),r&&(t.finished?zt(r):e.once("finish",r));t.ended=!0,e.writable=!1}(this,n,r)},tte(vre,qte);for(var bre=Object.keys(cre.prototype),gre=0;gree._pos){var n=r.substr(e._pos);if("x-user-defined"===e._charset){for(var i=new _(n.length),o=0;oe._pos&&(e.push(new _(new Uint8Array(a.result.slice(e._pos)))),e._pos=a.result.byteLength)},a.onload=function(){e.push(null)},a.readAsArrayBuffer(r)}e._xhr.readyState===Ire&&"ms-stream"!==e._mode&&e.push(null)},tte(Ore,cre);var Mre=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];Ore.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===Mre.indexOf(r)&&(this._headers[r]={name:e,value:t})},Ore.prototype.getHeader=function(e){return this._headers[e.toLowerCase()].value},Ore.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},Ore.prototype._onFinish=function(){var e=this;if(!e._destroyed){var t,r=e._opts,n=e._headers;if("POST"!==r.method&&"PUT"!==r.method&&"PATCH"!==r.method||(t=function(){if(void 0!==zee)return zee;try{new u.Blob([new ArrayBuffer(1)]),zee=!0}catch(e){zee=!1}return zee}()?new u.Blob(e._body.map((function(e){return function(e){if(e instanceof Uint8Array){if(0===e.byteOffset&&e.byteLength===e.buffer.byteLength)return e.buffer;if("function"==typeof e.buffer.slice)return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(se(e)){for(var t=new Uint8Array(e.length),r=e.length,n=0;n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Gre=Bre-Nre,qre=Math.floor,Kre=String.fromCharCode;function Vre(e){throw new RangeError(Hre[e])}function Wre(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function Jre(e,t,r){var n=0;for(e=r?qre(e/Lre):e>>1,e+=qre(e/t);e>Gre*Rre>>1;n+=Bre)e=qre(e/Gre);return qre(n+(Gre+1)*e/(e+Fre))}function Zre(e){return function(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]);var i=function(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}((e=e.replace($re,".")).split("."),t).join(".");return n+i}(e,(function(e){return zre.test(e)?"xn--"+function(e){var t,r,n,i,o,a,s,c,u,l,f,d,h,p,m,b=[];for(e=function(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i=t&&fqre((Cre-r)/(h=n+1))&&Vre("overflow"),r+=(s-t)*h,t=s,a=0;aCre&&Vre("overflow"),f==t){for(c=r,u=Bre;!(c<(l=u<=o?Nre:u>=o+Rre?Rre:u-o));u+=Bre)m=c-l,p=Bre-l,b.push(Kre(Wre(l+m%p,0))),c=qre(m/p);b.push(Kre(Wre(c,0))),o=Jre(r,h,n==i),r=0,++n}++r,++t}return b.join("")}(e):e}))}function Yre(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Xre=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function Qre(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function ene(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n0&&s>a&&(s=a);for(var c=0;c=0?(u=h.substr(0,p),l=h.substr(p+1)):(u=h,l=""),f=decodeURIComponent(u),d=decodeURIComponent(l),Yre(i,f)?Xre(i[f])?i[f].push(d):i[f]=[i[f],d]:i[f]=d}return i}const nne=u.URL,ine=u.URLSearchParams;var one={parse:wne,resolve:kne,resolveObject:Sne,fileURLToPath:Ane,format:xne,Url:ane,URL:nne,URLSearchParams:ine};function ane(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var sne=/^([a-z0-9.+-]+:)/i,cne=/:[0-9]*$/,une=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,lne=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),fne=["'"].concat(lne),dne=["%","/","?",";","#"].concat(fne),hne=["/","?","#"],pne=255,mne=/^[+a-z0-9A-Z_-]{0,63}$/,bne=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,gne={javascript:!0,"javascript:":!0},yne={javascript:!0,"javascript:":!0},vne={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function wne(e,t,r){if(e&&_te(e)&&e instanceof ane)return e;var n=new ane;return n.parse(e,t,r),n}function Ene(e,t,r,n){if(!wte(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),o=-1!==i&&i127?A+="x":A+=E[x];if(!A.match(mne)){var k=w.slice(0,u),S=w.slice(u+1),P=E.match(bne);P&&(k.push(P[1]),S.unshift(P[2])),S.length&&(s="/"+S.join(".")+s),e.hostname=k.join(".");break}}}}e.hostname.length>pne?e.hostname="":e.hostname=e.hostname.toLowerCase(),v||(e.hostname=Zre(e.hostname)),d=e.port?":"+e.port:"";var I=e.hostname||"";e.host=I+d,e.href+=e.host,v&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!gne[p])for(u=0,f=fne.length;u0)&&n.host.split("@"))&&(n.auth=m.shift(),n.host=n.hostname=m.shift())),n.search=e.search,n.query=e.query,gte(n.pathname)&>e(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var A=w.slice(-1)[0],x=(n.host||e.host||w.length>1)&&("."===A||".."===A)||""===A,_=0,k=w.length;k>=0;k--)"."===(A=w[k])?w.splice(k,1):".."===A?(w.splice(k,1),_++):_&&(w.splice(k,1),_--);if(!y&&!v)for(;_--;_)w.unshift("..");!y||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),x&&"/"!==w.join("/").substr(-1)&&w.push("");var S=""===w[0]||w[0]&&"/"===w[0].charAt(0);return E&&(n.hostname=n.host=S?"":w.length?w.shift():"",(m=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=m.shift(),n.host=n.hostname=m.shift())),(y=y||n.host&&w.length)&&!S&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),gte(n.pathname)&>e(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},ane.prototype.parseHost=function(){return Pne(this)};var Ine=Object.freeze({__proto__:null,URL:nne,URLSearchParams:ine,Url:ane,default:one,fileURLToPath:Ane,format:xne,parse:wne,resolve:kne,resolveObject:Sne});function Tne(e,t){"string"==typeof e&&(e=wne(e));var r=-1===u.location.protocol.search(/^https?:$/)?"http:":"",n=e.protocol||r,i=e.hostname||e.host,o=e.port,a=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(o?":"+o:"")+a,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var s=new Ore(e);return t&&s.on("response",t),s}function One(e,t){var r=Tne(e,t);return r.end(),r}function Mne(){}Mne.defaultMaxSockets=4;var Cne=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Bne={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},Nne={request:Tne,get:One,Agent:Mne,METHODS:Cne,STATUS_CODES:Bne},Rne=s(Object.freeze({__proto__:null,Agent:Mne,METHODS:Cne,STATUS_CODES:Bne,default:Nne,get:One,request:Tne}));function Fne(e,t){"string"==typeof e&&(e=wne(e));var r=-1===u.location.protocol.search(/^https?:$/)?"http:":"",n=e.protocol||r,i=e.hostname||e.host,o=e.port,a=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(o?":"+o:"")+a,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var s=new Ore(e);return t&&s.on("response",t),s}function Lne(e,t){var r=Fne(e,t);return r.end(),r}function Une(){}Une.defaultMaxSockets=4;var jne=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Dne={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},zne={request:Fne,get:Lne,Agent:Une,METHODS:jne,STATUS_CODES:Dne},$ne=s(Object.freeze({__proto__:null,Agent:Une,METHODS:jne,STATUS_CODES:Dne,default:zne,get:Lne,request:Fne})),Hne={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function Gne(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function qne(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o=0;)e[t]=0}var eie=0,tie=1,rie=2,nie=29,iie=256,oie=iie+1+nie,aie=30,sie=19,cie=2*oie+1,uie=15,lie=16,fie=7,die=256,hie=16,pie=17,mie=18,bie=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],gie=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],yie=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],vie=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],wie=new Array(2*(oie+2));Qne(wie);var Eie=new Array(2*aie);Qne(Eie);var Aie=new Array(512);Qne(Aie);var xie=new Array(256);Qne(xie);var _ie=new Array(nie);Qne(_ie);var kie,Sie,Pie,Iie=new Array(aie);function Tie(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function Oie(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Mie(e){return e<256?Aie[e]:Aie[256+(e>>>7)]}function Cie(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function Bie(e,t,r){e.bi_valid>lie-r?(e.bi_buf|=t<>lie-e.bi_valid,e.bi_valid+=r-lie):(e.bi_buf|=t<>>=1,r<<=1}while(--t>0);return r>>>1}function Fie(e,t,r){var n,i,o=new Array(uie+1),a=0;for(n=1;n<=uie;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=Rie(o[s]++,s))}}function Lie(e){var t;for(t=0;t8?Cie(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function jie(e,t,r,n){var i=2*t,o=2*r;return e[i]>1;r>=1;r--)Die(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Die(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,Die(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,f=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(o=0;o<=uie;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;rp&&(o=p,m++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=h&&(a=d[n-h]),s=c[2*n],e.opt_len+=s*(o+a),f&&(e.static_len+=s*(l[2*n+1]+a)));if(0!==m){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,m-=2}while(m>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),Fie(o,u,e.bl_count)}function Hie(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s>=7;n=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}function Jie(e,t,r,n){var i,o,a=0;e.level>0?(e.strm.data_type===Xne&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return Zne;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return Yne;for(t=32;t=3&&0===e.bl_tree[2*vie[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?Vie(e,t,r,n):e.strategy===Jne||o===i?(Bie(e,(tie<<1)+(n?1:0),3),zie(e,wie,Eie)):(Bie(e,(rie<<1)+(n?1:0),3),function(e,t,r,n){var i;for(Bie(e,t-257,5),Bie(e,r-1,5),Bie(e,n-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(xie[r]+iie+1)]++,e.dyn_dtree[2*Mie(t)]++),e.last_lit===e.lit_bufsize-1}function Yie(e,t,r,n){for(var i=65535&e,o=e>>>16&65535,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16}var Xie=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();function Qie(e,t,r,n){var i=Xie,o=n+r;e^=-1;for(var a=n;a>>8^i[255&(e^t[a])];return~e}var eoe,toe=0,roe=4,noe=0,ioe=-2,ooe=2,aoe=8,soe=286,coe=30,uoe=19,loe=2*soe+1,foe=15,doe=3,hoe=258,poe=hoe+doe+1,moe=42,boe=103,goe=113,yoe=666,voe=1,woe=2,Eoe=3,Aoe=4;function xoe(e,t){return e.msg=Hne[t],t}function _oe(e){return(e<<1)-(e>4?9:0)}function koe(e){for(var t=e.length;--t>=0;)e[t]=0}function Soe(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(qne(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function Poe(e,t){Jie(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Soe(e.strm)}function Ioe(e,t){e.pending_buf[e.pending++]=t}function Toe(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function Ooe(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,qne(t,e.input,e.next_in,i,r),1===e.state.wrap?e.adler=Yie(e.adler,t,i,r):2===e.state.wrap&&(e.adler=Qie(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function Moe(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-poe?e.strstart-(e.w_size-poe):0,u=e.window,l=e.w_mask,f=e.prev,d=e.strstart+hoe,h=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===h&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&oa){if(e.match_start=t,a=n,n>=s)break;h=u[o+a-1],p=u[o+a]}}}while((t=f[t&l])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function Coe(e){var t,r,n,i,o,a=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=a+(a-poe)){qne(e.window,e.window,a,a,0),e.match_start-=a,e.strstart-=a,e.block_start-=a,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=a?n-a:0}while(--r);t=r=a;do{n=e.prev[--t],e.prev[t]=n>=a?n-a:0}while(--r);i+=a}if(0===e.strm.avail_in)break;if(r=Ooe(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=doe)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<=doe&&(e.ins_h=(e.ins_h<=doe)if(n=Zie(e,e.strstart-e.match_start,e.match_length-doe),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=doe){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=doe&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=doe-1)),e.prev_length>=doe&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-doe,n=Zie(e,e.strstart-1-e.prev_match,e.prev_length-doe),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<5||t<0)return e?xoe(e,ioe):ioe;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===yoe&&t!==roe)return xoe(e,0===e.avail_out?-5:ioe);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===moe)if(2===n.wrap)e.adler=0,Ioe(n,31),Ioe(n,139),Ioe(n,8),n.gzhead?(Ioe(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Ioe(n,255&n.gzhead.time),Ioe(n,n.gzhead.time>>8&255),Ioe(n,n.gzhead.time>>16&255),Ioe(n,n.gzhead.time>>24&255),Ioe(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),Ioe(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Ioe(n,255&n.gzhead.extra.length),Ioe(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Qie(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(Ioe(n,0),Ioe(n,0),Ioe(n,0),Ioe(n,0),Ioe(n,0),Ioe(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),Ioe(n,3),n.status=goe);else{var a=aoe+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=goe,Toe(n,a),0!==n.strstart&&(Toe(n,e.adler>>>16),Toe(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=Qie(e.adler,n.pending_buf,n.pending-i,i)),Soe(e),i=n.pending,n.pending!==n.pending_buf_size));)Ioe(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=Qie(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Qie(e.adler,n.pending_buf,n.pending-i,i)),Soe(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindexi&&(e.adler=Qie(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Qie(e.adler,n.pending_buf,n.pending-i,i)),Soe(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindexi&&(e.adler=Qie(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=boe)}else n.status=boe;if(n.status===boe&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&Soe(e),n.pending+2<=n.pending_buf_size&&(Ioe(n,255&e.adler),Ioe(n,e.adler>>8&255),e.adler=0,n.status=goe)):n.status=goe),0!==n.pending){if(Soe(e),0===e.avail_out)return n.last_flush=-1,noe}else if(0===e.avail_in&&_oe(t)<=_oe(r)&&t!==roe)return xoe(e,-5);if(n.status===yoe&&0!==e.avail_in)return xoe(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==toe&&n.status!==yoe){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(Coe(e),0===e.lookahead)){if(t===toe)return voe;break}if(e.match_length=0,r=Zie(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Poe(e,!1),0===e.strm.avail_out))return voe}return e.insert=0,t===roe?(Poe(e,!0),0===e.strm.avail_out?Eoe:Aoe):e.last_lit&&(Poe(e,!1),0===e.strm.avail_out)?voe:woe}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=hoe){if(Coe(e),e.lookahead<=hoe&&t===toe)return voe;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=doe&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+hoe;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=doe?(r=Zie(e,1,e.match_length-doe),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Zie(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Poe(e,!1),0===e.strm.avail_out))return voe}return e.insert=0,t===roe?(Poe(e,!0),0===e.strm.avail_out?Eoe:Aoe):e.last_lit&&(Poe(e,!1),0===e.strm.avail_out)?voe:woe}(n,t):eoe[n.level].func(n,t);if(s!==Eoe&&s!==Aoe||(n.status=yoe),s===voe||s===Eoe)return 0===e.avail_out&&(n.last_flush=-1),noe;if(s===woe&&(1===t?Wie(n):5!==t&&(Vie(n,0,0,!1),3===t&&(koe(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),Soe(e),0===e.avail_out))return n.last_flush=-1,noe}return t!==roe?noe:n.wrap<=0?1:(2===n.wrap?(Ioe(n,255&e.adler),Ioe(n,e.adler>>8&255),Ioe(n,e.adler>>16&255),Ioe(n,e.adler>>24&255),Ioe(n,255&e.total_in),Ioe(n,e.total_in>>8&255),Ioe(n,e.total_in>>16&255),Ioe(n,e.total_in>>24&255)):(Toe(n,e.adler>>>16),Toe(n,65535&e.adler)),Soe(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?noe:1)}eoe=[new Roe(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Coe(e),0===e.lookahead&&t===toe)return voe;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,Poe(e,!1),0===e.strm.avail_out))return voe;if(e.strstart-e.block_start>=e.w_size-poe&&(Poe(e,!1),0===e.strm.avail_out))return voe}return e.insert=0,t===roe?(Poe(e,!0),0===e.strm.avail_out?Eoe:Aoe):(e.strstart>e.block_start&&(Poe(e,!1),e.strm.avail_out),voe)})),new Roe(4,4,8,4,Boe),new Roe(4,5,16,8,Boe),new Roe(4,6,32,32,Boe),new Roe(4,4,16,16,Noe),new Roe(8,16,32,32,Noe),new Roe(8,16,128,128,Noe),new Roe(8,32,128,256,Noe),new Roe(32,128,258,1024,Noe),new Roe(32,258,258,4096,Noe)];var joe=30,Doe=12;function zoe(e,t){var r,n,i,o,a,s,c,u,l,f,d,h,p,m,b,g,y,v,w,E,A,x,_,k,S;r=e.state,n=e.next_in,k=e.input,i=n+(e.avail_in-5),o=e.next_out,S=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,l=r.whave,f=r.wnext,d=r.window,h=r.hold,p=r.bits,m=r.lencode,b=r.distcode,g=(1<>>=w=v>>>24,p-=w,0===(w=v>>>16&255))S[o++]=65535&v;else{if(!(16&w)){if(64&w){if(32&w){r.mode=Doe;break e}e.msg="invalid literal/length code",r.mode=joe;break e}v=m[(65535&v)+(h&(1<>>=w,p-=w),p<15&&(h+=k[n++]<>>=w=v>>>24,p-=w,16&(w=v>>>16&255)){if(A=65535&v,p<(w&=15)&&(h+=k[n++]<c){e.msg="invalid distance too far back",r.mode=joe;break e}if(h>>>=w,p-=w,A>(w=o-a)){if((w=A-w)>l&&r.sane){e.msg="invalid distance too far back",r.mode=joe;break e}if(x=0,_=d,0===f){if(x+=u-w,w2;)S[o++]=_[x++],S[o++]=_[x++],S[o++]=_[x++],E-=3;E&&(S[o++]=_[x++],E>1&&(S[o++]=_[x++]))}else{x=o-A;do{S[o++]=S[x++],S[o++]=S[x++],S[o++]=S[x++],E-=3}while(E>2);E&&(S[o++]=S[x++],E>1&&(S[o++]=S[x++]))}break}if(64&w){e.msg="invalid distance code",r.mode=joe;break e}v=b[(65535&v)+(h&(1<>3,h&=(1<<(p-=E<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n=1&&0===O[E];E--);if(A>E&&(A=E),0===E)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(w=1;w0&&(e===qoe||1!==E))return-1;for(M[1]=0,y=1;y<$oe;y++)M[y+1]=M[y]+O[y];for(v=0;vHoe||e===Voe&&S>Goe)return 1;for(;;){p=y-_,a[v]h?(m=C[B+a[v]],b=I[T+a[v]]):(m=96,b=0),c=1<>_)+(u-=c)]=p<<24|m<<16|b}while(0!==u);for(c=1<>=1;if(0!==c?(P&=c-1,P+=c):P=0,v++,0==--O[y]){if(y===E)break;y=t[r+a[v]]}if(y>A&&(P&f)!==l){for(0===_&&(_=A),d+=w,k=1<<(x=y-_);x+_Hoe||e===Voe&&S>Goe)return 1;i[l=P&f]=A<<24|x<<16|d-o}}return 0!==P&&(i[d+P]=y-_<<24|64<<16),s.bits=A,0}var Qoe=1,eae=2,tae=0,rae=-2,nae=1,iae=12,oae=30,aae=852,sae=592;function cae(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function uae(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Vne(320),this.work=new Vne(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function lae(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,function(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=nae,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Wne(aae),t.distcode=t.distdyn=new Wne(sae),t.sane=1,t.back=-1,tae):rae}(e)):rae}function fae(e,t){var r,n;return e?(n=new uae,e.state=n,n.window=null,r=function(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?rae:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,lae(e))):rae}(e,t),r!==tae&&(e.state=null),r):rae}var dae,hae,pae=!0;function mae(e){if(pae){var t;for(dae=new Wne(512),hae=new Wne(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Xoe(Qoe,e.lens,0,288,dae,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Xoe(eae,e.lens,0,32,hae,0,e.work,{bits:5}),pae=!1}e.lencode=dae,e.lenbits=9,e.distcode=hae,e.distbits=5}function bae(e,t){var r,n,i,o,a,s,c,u,l,f,d,h,p,m,b,g,y,v,w,E,A,x,_,k,S=0,P=new Kne(4),I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return rae;(r=e.state).mode===iae&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,f=s,d=c,x=tae;e:for(;;)switch(r.mode){case nae:if(0===r.wrap){r.mode=13;break}for(;l<16;){if(0===s)break e;s--,u+=n[o++]<>>8&255,r.check=Qie(r.check,P,2,0),u=0,l=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=oae;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=oae;break}if(l-=4,A=8+(15&(u>>>=4)),0===r.wbits)r.wbits=A;else if(A>r.wbits){e.msg="invalid window size",r.mode=oae;break}r.dmax=1<>8&1),512&r.flags&&(P[0]=255&u,P[1]=u>>>8&255,r.check=Qie(r.check,P,2,0)),u=0,l=0,r.mode=3;case 3:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<>>8&255,P[2]=u>>>16&255,P[3]=u>>>24&255,r.check=Qie(r.check,P,4,0)),u=0,l=0,r.mode=4;case 4:for(;l<16;){if(0===s)break e;s--,u+=n[o++]<>8),512&r.flags&&(P[0]=255&u,P[1]=u>>>8&255,r.check=Qie(r.check,P,2,0)),u=0,l=0,r.mode=5;case 5:if(1024&r.flags){for(;l<16;){if(0===s)break e;s--,u+=n[o++]<>>8&255,r.check=Qie(r.check,P,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((h=r.length)>s&&(h=s),h&&(r.head&&(A=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),qne(r.head.extra,n,o,h,A)),512&r.flags&&(r.check=Qie(r.check,n,h,o)),s-=h,o+=h,r.length-=h),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;h=0;do{A=n[o+h++],r.head&&A&&r.length<65536&&(r.head.name+=String.fromCharCode(A))}while(A&&h>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=iae;break;case 10:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<>>=7&l,l-=7&l,r.mode=27;break}for(;l<3;){if(0===s)break e;s--,u+=n[o++]<>>=1)){case 0:r.mode=14;break;case 1:if(mae(r),r.mode=20,6===t){u>>>=2,l-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=oae}u>>>=2,l-=2;break;case 14:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,u+=n[o++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=oae;break}if(r.length=65535&u,u=0,l=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(h=r.length){if(h>s&&(h=s),h>c&&(h=c),0===h)break e;qne(i,n,o,h,a),s-=h,o+=h,c-=h,a+=h,r.length-=h;break}r.mode=iae;break;case 17:for(;l<14;){if(0===s)break e;s--,u+=n[o++]<>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=oae;break}r.have=0,r.mode=18;case 18:for(;r.have>>=3,l-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,_={bits:r.lenbits},x=Xoe(0,r.lens,0,19,r.lencode,0,r.work,_),r.lenbits=_.bits,x){e.msg="invalid code lengths set",r.mode=oae;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,y=65535&S,!((b=S>>>24)<=l);){if(0===s)break e;s--,u+=n[o++]<>>=b,l-=b,r.lens[r.have++]=y;else{if(16===y){for(k=b+2;l>>=b,l-=b,0===r.have){e.msg="invalid bit length repeat",r.mode=oae;break}A=r.lens[r.have-1],h=3+(3&u),u>>>=2,l-=2}else if(17===y){for(k=b+3;l>>=b)),u>>>=3,l-=3}else{for(k=b+7;l>>=b)),u>>>=7,l-=7}if(r.have+h>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=oae;break}for(;h--;)r.lens[r.have++]=A}}if(r.mode===oae)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=oae;break}if(r.lenbits=9,_={bits:r.lenbits},x=Xoe(Qoe,r.lens,0,r.nlen,r.lencode,0,r.work,_),r.lenbits=_.bits,x){e.msg="invalid literal/lengths set",r.mode=oae;break}if(r.distbits=6,r.distcode=r.distdyn,_={bits:r.distbits},x=Xoe(eae,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,_),r.distbits=_.bits,x){e.msg="invalid distances set",r.mode=oae;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,zoe(e,d),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,r.mode===iae&&(r.back=-1);break}for(r.back=0;g=(S=r.lencode[u&(1<>>16&255,y=65535&S,!((b=S>>>24)<=l);){if(0===s)break e;s--,u+=n[o++]<>v)])>>>16&255,y=65535&S,!(v+(b=S>>>24)<=l);){if(0===s)break e;s--,u+=n[o++]<>>=v,l-=v,r.back+=v}if(u>>>=b,l-=b,r.back+=b,r.length=y,0===g){r.mode=26;break}if(32&g){r.back=-1,r.mode=iae;break}if(64&g){e.msg="invalid literal/length code",r.mode=oae;break}r.extra=15&g,r.mode=22;case 22:if(r.extra){for(k=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;g=(S=r.distcode[u&(1<>>16&255,y=65535&S,!((b=S>>>24)<=l);){if(0===s)break e;s--,u+=n[o++]<>v)])>>>16&255,y=65535&S,!(v+(b=S>>>24)<=l);){if(0===s)break e;s--,u+=n[o++]<>>=v,l-=v,r.back+=v}if(u>>>=b,l-=b,r.back+=b,64&g){e.msg="invalid distance code",r.mode=oae;break}r.offset=y,r.extra=15&g,r.mode=24;case 24:if(r.extra){for(k=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=oae;break}r.mode=25;case 25:if(0===c)break e;if(h=d-c,r.offset>h){if((h=r.offset-h)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=oae;break}h>r.wnext?(h-=r.wnext,p=r.wsize-h):p=r.wnext-h,h>r.length&&(h=r.length),m=r.window}else m=i,p=a-r.offset,h=r.length;h>c&&(h=c),c-=h,r.length-=h;do{i[a++]=m[p++]}while(--h);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;l<32;){if(0===s)break e;s--,u|=n[o++]<=o.wsize?(qne(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),qne(o.window,t,r-n,i,o.wnext),(n-=i)?(qne(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave7)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function vae(e,t){for(var r=0;r15&&(a=2,n-=16),i<1||i>9||r!==aoe||n<8||n>15||t<0||t>9||o<0||o>4)return xoe(e,ioe);8===n&&(n=9);var s=new Foe;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<Eae.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsEae.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelEae.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelEae.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=Eae.Z_FILTERED&&e.strategy!=Eae.Z_HUFFMAN_ONLY&&e.strategy!=Eae.Z_RLE&&e.strategy!=Eae.Z_FIXED&&e.strategy!=Eae.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!_.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new Eae.Zlib(t);var r=this;this._hadError=!1,this._binding.onerror=function(e,t){r._binding=null,r._hadError=!0;var n=new Error(e);n.errno=t,n.code=Aae[t],r.emit("error",n)};var n=Eae.Z_DEFAULT_COMPRESSION;"number"==typeof e.level&&(n=e.level);var i=Eae.Z_DEFAULT_STRATEGY;"number"==typeof e.strategy&&(i=e.strategy),this._binding.init(e.windowBits||Eae.Z_DEFAULT_WINDOWBITS,n,e.memLevel||Eae.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=new _(this._chunkSize),this._offset=0,this._closed=!1,this._level=n,this._strategy=i,this.once("end",this.close)}Object.keys(Aae).forEach((function(e){Aae[Aae[e]]=e})),tte(Qae,xre),Qae.prototype.params=function(e,t,r){if(eEae.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=Eae.Z_FILTERED&&t!=Eae.Z_HUFFMAN_ONLY&&t!=Eae.Z_RLE&&t!=Eae.Z_FIXED&&t!=Eae.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);if(this._level!==e||this._strategy!==t){var n=this;this.flush(Eae.Z_SYNC_FLUSH,(function(){n._binding.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())}))}else pr.nextTick(r)},Qae.prototype.reset=function(){return this._binding.reset()},Qae.prototype._flush=function(e){this._transform(new _(0),"",e)},Qae.prototype.flush=function(e,t){var r=this._writableState;if(("function"==typeof e||void 0===e&&!t)&&(t=e,e=Eae.Z_FULL_FLUSH),r.ended)t&&pr.nextTick(t);else if(r.ending)t&&this.once("end",t);else if(r.needDrain){var n=this;this.once("drain",(function(){n.flush(t)}))}else this._flushFlag=e,this.write(new _(0),"",t)},Qae.prototype.close=function(e){if(e&&pr.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var t=this;pr.nextTick((function(){t.emit("close")}))}},Qae.prototype._transform=function(e,t,r){var n,i=this._writableState,o=(i.ending||i.ended)&&(!e||i.length===e.length);if(null===!e&&!_.isBuffer(e))return r(new Error("invalid input"));o?n=Eae.Z_FINISH:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||Eae.Z_NO_FLUSH)),this._processChunk(e,n,r)},Qae.prototype._processChunk=function(e,t,r){var n=e&&e.length,i=this._chunkSize-this._offset,o=0,a=this,s="function"==typeof r;if(!s){var c,u=[],l=0;this.on("error",(function(e){c=e}));do{var f=this._binding.writeSync(t,e,o,n,this._buffer,this._offset,i)}while(!this._hadError&&p(f[0],f[1]));if(this._hadError)throw c;var d=_.concat(u,l);return this.close(),d}var h=this._binding.write(t,e,o,n,this._buffer,this._offset,i);function p(c,f){if(!a._hadError){var d=i-f;if(function(e,t){if(!e)throw new Error(t)}(d>=0,"have should not go down"),d>0){var h=a._buffer.slice(a._offset,a._offset+d);a._offset+=d,s?a.push(h):(u.push(h),l+=h.length)}if((0===f||a._offset>=a._chunkSize)&&(i=a._chunkSize,a._offset=0,a._buffer=new _(a._chunkSize)),0===f){if(o+=n-c,n=c,!s)return!0;var m=a._binding.write(t,e,o,n,a._buffer,a._offset,a._chunkSize);return m.callback=p,void(m.buffer=e)}if(!s)return!1;r()}}h.buffer=e,h.callback=p},tte(Kae,Qae),tte(Vae,Qae),tte(Wae,Qae),tte(Jae,Qae),tte(Zae,Qae),tte(Yae,Qae),tte(Xae,Qae);var ese={codes:Aae,createDeflate:xae,createInflate:_ae,createDeflateRaw:kae,createInflateRaw:Sae,createGzip:Pae,createGunzip:Iae,createUnzip:Tae,deflate:Oae,deflateSync:Mae,gzip:Cae,gzipSync:Bae,deflateRaw:Nae,deflateRawSync:Rae,unzip:Fae,unzipSync:Lae,inflate:Uae,inflateSync:jae,gunzip:Dae,gunzipSync:zae,inflateRaw:$ae,inflateRawSync:Hae,Deflate:Kae,Inflate:Vae,Gzip:Wae,Gunzip:Jae,DeflateRaw:Zae,InflateRaw:Yae,Unzip:Xae,Zlib:Qae},tse=s(Object.freeze({__proto__:null,Deflate:Kae,DeflateRaw:Zae,Gunzip:Jae,Gzip:Wae,Inflate:Vae,InflateRaw:Yae,Unzip:Xae,Zlib:Qae,codes:Aae,createDeflate:xae,createDeflateRaw:kae,createGunzip:Iae,createGzip:Pae,createInflate:_ae,createInflateRaw:Sae,createUnzip:Tae,default:ese,deflate:Oae,deflateRaw:Nae,deflateRawSync:Rae,deflateSync:Mae,gunzip:Dae,gunzipSync:zae,gzip:Cae,gzipSync:Bae,inflate:Uae,inflateRaw:$ae,inflateRawSync:Hae,inflateSync:jae,unzip:Fae,unzipSync:Lae})),rse=s(zte),nse=s(Ine);Object.defineProperty(Gee,"__esModule",{value:!0}),Gee.InvalidStatusCodeError=Gee.InvalidCertError=void 0;const ise=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class ose extends Error{constructor(e,t){super(e),this.fingerprint256=t}}Gee.InvalidCertError=ose;class ase extends Error{constructor(e){super(`Request Failed. Status Code: ${e}`),this.statusCode=e}}function sse(e,t){if(!t||"text"===t||"json"===t)try{let r=new TextDecoder("utf8",{fatal:!0}).decode(e);if("text"===t)return r;try{return JSON.parse(r)}catch(e){if("json"===t)throw e;return r}}catch(e){if("text"===t||"json"===t)throw e}return e}Gee.InvalidStatusCodeError=ase;let cse={};function use(e,t){let r={...ise,...t};const n=Rne,i=$ne,o=tse,{promisify:a}=rse,{resolve:s}=nse,c=!!/^https/.test(e);let u={method:r.method||"GET",headers:{"Accept-Encoding":"gzip, deflate, br"}};const l=e=>e.replace(/:| /g,"").toLowerCase();if(r.keepAlive){const e={keepAlive:!0,keepAliveMsecs:3e4,maxFreeSockets:1024,maxCachedSessions:1024},t=[c,c&&r.sslPinnedCertificates?.map((e=>l(e))).sort()].join();u.agent=cse[t]||(cse[t]=new(c?i:n).Agent(e))}"json"===r.type&&(u.headers["Content-Type"]="application/json"),r.data&&(r.method||(u.method="POST"),u.body="json"===r.type?JSON.stringify(r.data):r.data),u.headers={...u.headers,...r.headers},r.sslAllowSelfSigned&&(u.rejectUnauthorized=!1);return new Promise(((t,f)=>{const d=async t=>{if(t&&"DEPTH_ZERO_SELF_SIGNED_CERT"===t.code)try{await use(e,{...r,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(e){e&&e.fingerprint256&&(t=new ose(`Self-signed SSL certificate: ${e.fingerprint256}`,e.fingerprint256))}f(t)},h=(c?i:n).request(e,u,(n=>{n.on("error",d),(async()=>{try{t(await(async t=>{const n=t.statusCode;if(r.redirect&&300<=n&&n<400&&t.headers.location){if(10==r._redirectCount)throw new Error("Request failed. Too much redirects.");return r._redirectCount+=1,await use(s(e,t.headers.location),r)}if(r.expectStatusCode&&n!==r.expectStatusCode)throw t.resume(),new ase(n);let i=[];for await(const e of t)i.push(e);let c=_.concat(i);const u=t.headers["content-encoding"];"br"===u&&(c=await a(o.brotliDecompress)(c)),"gzip"!==u&&"deflate"!==u||(c=await a(o.unzip)(c));const l=sse(c,r.type);return r.full?{headers:t.headers,status:n,body:l}:l})(n))}catch(e){f(e)}})()}));h.on("error",d);const p=r.sslPinnedCertificates?.map((e=>l(e))),m=e=>{const t=l(e.getPeerCertificate()?.fingerprint256||"");if((t||!e.isSessionReused())&&!p.includes(t))return h.emit("error",new ose(`Invalid SSL certificate: ${t} Expected: ${p}`,t)),h.abort()};r.sslPinnedCertificates&&h.on("socket",(e=>{const t=e.listeners("secureConnect").map((e=>(e.name||"").replace("bound ",""))).includes("mfetchSecureConnect");t||e.on("secureConnect",m.bind(null,e))})),r.keepAlive&&h.setNoDelay(!0),u.body&&h.write(u.body),h.end()}))}const lse=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map((e=>e.toLowerCase()))),fse=new Set(["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via"].map((e=>e.toLowerCase())));async function dse(e,t){let r={...ise,...t};const n=new Headers;"json"===r.type&&n.set("Content-Type","application/json");let i=new URL(e);if(i.username){const e=btoa(`${i.username}:${i.password}`);n.set("Authorization",`Basic ${e}`),i.username="",i.password=""}e=""+i;for(let e in r.headers){const t=e.toLowerCase();(lse.has(t)||r.cors&&!fse.has(t))&&n.set(e,r.headers[e])}let o={headers:n,redirect:r.redirect?"follow":"manual"};r.referrer||(o.referrerPolicy="no-referrer"),r.cors&&(o.mode="cors"),r.data&&(r.method||(o.method="POST"),o.body="json"===r.type?JSON.stringify(r.data):r.data);const a=await fetch(e,o);if(r.expectStatusCode&&a.status!==r.expectStatusCode)throw new ase(a.status);const s=sse(new Uint8Array(await a.arrayBuffer()),r.type);return r.full?{headers:Object.fromEntries(a.headers.entries()),status:a.status,body:s}:s}const hse=!!("object"==typeof pr&&pr.versions&&pr.versions.node&&pr.versions.v8);Gee.default=function(e,t){return(hse?use:dse)(e,t)},Object.defineProperty(Hee,"__esModule",{value:!0}),Hee.getProvider=Hee.fetchFromProvider=void 0;const pse=Gee;Hee.fetchFromProvider=async(e,t)=>(await(0,pse.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;Hee.getProvider=e=>{if("string"==typeof e)return e;if(void 0!==e?.connection?.url)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")},function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.toAscii=e.stripHexPrefix=e.padToEven=e.isHexString=e.isHexPrefixed=e.getKeys=e.getBinarySize=e.fromUtf8=e.fromAscii=e.arrayContainsArray=void 0,r(v4,e),r(Z9,e),r(Y9,e),r(yee,e),r(Aee,e),r(Iee,e),r(dee,e),r(xee,e),r(Fee,e),r(Lee,e);var n=pee;Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return n.arrayContainsArray}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return n.fromAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return n.fromUtf8}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return n.getBinarySize}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return n.getKeys}}),Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return n.isHexPrefixed}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return n.isHexString}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return n.padToEven}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return n.stripHexPrefix}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return n.toAscii}}),r(Dee,e),r(Hee,e)}(y4);var mse={},bse={},gse={},yse={},vse={},wse={},Ese={};Object.defineProperty(Ese,"__esModule",{value:!0});var Ase=(e=>(e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date",e))(Ase||{}),xse=/"|\\|\n|\r|\t/gu;function _se(e){return e.charCodeAt(0)<=127}Ese.isNonEmptyArray=function(e){return Array.isArray(e)&&e.length>0},Ese.isNullOrUndefined=function(e){return null==e},Ese.isObject=function(e){return Boolean(e)&&"object"==typeof e&&!Array.isArray(e)},Ese.hasProperty=(e,t)=>Object.hasOwnProperty.call(e,t),Ese.getKnownPropertyNames=function(e){return Object.getOwnPropertyNames(e)},Ese.JsonSize=Ase,Ese.ESCAPE_CHARACTERS_REGEXP=xse,Ese.isPlainObject=function(e){if("object"!=typeof e||null===e)return!1;try{let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch(e){return!1}},Ese.isASCII=_se,Ese.calculateStringSize=function(e){return e.split("").reduce(((e,t)=>_se(t)?e+1:e+2),0)+(t=e.match(xse),r=()=>[],null!=t?t:r()).length;var t,r},Ese.calculateNumberSize=function(e){return e.toString().length};var kse=s(ts),Sse=s(os);const{ErrorWithCause:Pse}=kse,{findCauseByReference:Ise,getErrorCause:Tse,messageWithCauses:Ose,stackWithCauses:Mse}=Sse;var Cse={ErrorWithCause:Pse,findCauseByReference:Ise,getErrorCause:Tse,stackWithCauses:Mse,messageWithCauses:Ose};Object.defineProperty(wse,"__esModule",{value:!0});var Bse=Ese,Nse=Cse;function Rse(e){return"object"==typeof e&&null!==e&&"code"in e}function Fse(e){return"object"==typeof e&&null!==e&&"message"in e}wse.isErrorWithCode=Rse,wse.isErrorWithMessage=Fse,wse.isErrorWithStack=function(e){return"object"==typeof e&&null!==e&&"stack"in e},wse.getErrorMessage=function(e){return Fse(e)&&"string"==typeof e.message?e.message:Bse.isNullOrUndefined.call(void 0,e)?"":String(e)},wse.wrapError=function(e,t){if(function(e){return e instanceof Error||Bse.isObject.call(void 0,e)&&"Error"===e.constructor.name}(e)){let r;return r=2===Error.length?new Error(t,{cause:e}):new Nse.ErrorWithCause(t,{cause:e}),Rse(e)&&(r.code=e.code),r}return t.length>0?new Error(`${String(e)}: ${t}`):new Error(String(e))};var Lse=s(js);Object.defineProperty(vse,"__esModule",{value:!0});var Use=wse,jse=Lse;function Dse(e,t){return Boolean("string"==typeof function(e){let t,r=e[0],n=1;for(;nr.call(t,...e))),t=void 0)}return r}([e,"optionalAccess",e=>e.prototype,"optionalAccess",e=>e.constructor,"optionalAccess",e=>e.name]))?new e({message:t}):e({message:t})}var zse=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};vse.AssertionError=zse,vse.assert=function(e,t="Assertion failed.",r=zse){if(!e){if(t instanceof Error)throw t;throw Dse(r,t)}},vse.assertStruct=function(e,t,r="Assertion failed",n=zse){try{jse.assert.call(void 0,e,t)}catch(e){throw Dse(n,`${r}: ${function(e){return Use.getErrorMessage.call(void 0,e).replace(/\.$/u,"")}(e)}.`)}},vse.assertExhaustive=function(e){throw new Error("Invalid branch reached. Should be detected during compilation.")};var $se={},Hse={};function Gse(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function qse(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function Kse(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function Vse(e,...t){if(!Kse(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function Wse(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Gse(e.outputLen),Gse(e.blockLen)}function Jse(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Zse(e,t){Vse(e);const r=t.outputLen;if(e.length>ece&Qse)}:{h:0|Number(e>>ece&Qse),l:0|Number(e&Qse)}}function rce(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);Xse.toBig=nce;const ice=(e,t,r)=>e>>>r;Xse.shrSH=ice;const oce=(e,t,r)=>e<<32-r|t>>>r;Xse.shrSL=oce;const ace=(e,t,r)=>e>>>r|t<<32-r;Xse.rotrSH=ace;const sce=(e,t,r)=>e<<32-r|t>>>r;Xse.rotrSL=sce;const cce=(e,t,r)=>e<<64-r|t>>>r-32;Xse.rotrBH=cce;const uce=(e,t,r)=>e>>>r-32|t<<64-r;Xse.rotrBL=uce;const lce=(e,t)=>t;Xse.rotr32H=lce;const fce=(e,t)=>e;Xse.rotr32L=fce;const dce=(e,t,r)=>e<>>32-r;Xse.rotlSH=dce;const hce=(e,t,r)=>t<>>32-r;Xse.rotlSL=hce;const pce=(e,t,r)=>t<>>64-r;Xse.rotlBH=pce;const mce=(e,t,r)=>e<>>64-r;function bce(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}Xse.rotlBL=mce,Xse.add=bce;const gce=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);Xse.add3L=gce;const yce=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;Xse.add3H=yce;const vce=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);Xse.add4L=vce;const wce=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;Xse.add4H=wce;const Ece=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);Xse.add5L=Ece;const Ace=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;Xse.add5H=Ace;const xce={fromBig:tce,split:rce,toBig:nce,shrSH:ice,shrSL:oce,rotrSH:ace,rotrSL:sce,rotrBH:cce,rotrBL:uce,rotr32H:lce,rotr32L:fce,rotlSH:dce,rotlSL:hce,rotlBH:pce,rotlBL:mce,add:bce,add3L:gce,add3H:yce,add4L:vce,add4H:wce,add5H:Ace,add5L:Ece};Xse.default=xce;var _ce={},kce={};Object.defineProperty(kce,"__esModule",{value:!0}),kce.crypto=void 0,kce.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=kce,r=Hse;e.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name};e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);e.rotr=(e,t)=>e<<32-t|e>>>t;e.rotl=(e,t)=>e<>>32-t>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];e.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,e.byteSwapIfBE=e.isLE?e=>e:t=>(0,e.byteSwap)(t),e.byteSwap32=function(t){for(let r=0;rt.toString(16).padStart(2,"0")));e.bytesToHex=function(e){(0,r.bytes)(e);let t="";for(let r=0;r=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}e.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t{},e.asyncLoop=async function(t,r,n){let i=Date.now();for(let o=0;o=0&&te().update(s(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(s(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(s(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}(_ce),Object.defineProperty($se,"__esModule",{value:!0}),$se.shake256=$se.shake128=$se.keccak_512=$se.keccak_384=$se.keccak_256=$se.keccak_224=$se.sha3_512=$se.sha3_384=$se.sha3_256=$se.sha3_224=$se.Keccak=$se.keccakP=void 0;const Sce=Hse,Pce=Xse,Ice=_ce,Tce=[],Oce=[],Mce=[],Cce=BigInt(0),Bce=BigInt(1),Nce=BigInt(2),Rce=BigInt(7),Fce=BigInt(256),Lce=BigInt(113);for(let e=0,t=Bce,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Tce.push(2*(5*n+r)),Oce.push((e+1)*(e+2)/2%64);let i=Cce;for(let e=0;e<7;e++)t=(t<>Rce)*Lce)%Fce,t&Nce&&(i^=Bce<<(Bce<r>32?(0,Pce.rotlBH)(e,t,r):(0,Pce.rotlSH)(e,t,r),zce=(e,t,r)=>r>32?(0,Pce.rotlBL)(e,t,r):(0,Pce.rotlSL)(e,t,r);function $ce(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=Dce(o,a,1)^r[n],c=zce(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=Oce[r],o=Dce(t,i,n),a=zce(t,i,n),s=Tce[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=Uce[n],e[1]^=jce[n]}r.fill(0)}$se.keccakP=$ce;let Hce=class e extends Ice.Hash{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,Sce.number)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Ice.u32)(this.state)}keccak(){Ice.isLE||(0,Ice.byteSwap32)(this.state32),$ce(this.state32,this.rounds),Ice.isLE||(0,Ice.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(e){(0,Sce.exists)(this);const{blockLen:t,state:r}=this,n=(e=(0,Ice.toBytes)(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,Sce.number)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,Sce.output)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return t||(t=new e(r,n,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}};$se.Keccak=Hce;const Gce=(e,t,r)=>(0,Ice.wrapConstructor)((()=>new Hce(t,e,r)));$se.sha3_224=Gce(6,144,28),$se.sha3_256=Gce(6,136,32),$se.sha3_384=Gce(6,104,48),$se.sha3_512=Gce(6,72,64),$se.keccak_224=Gce(1,144,28),$se.keccak_256=Gce(1,136,32),$se.keccak_384=Gce(1,104,48),$se.keccak_512=Gce(1,72,64);const qce=(e,t,r)=>(0,Ice.wrapXOFConstructorWithOpts)(((n={})=>new Hce(t,e,void 0===n.dkLen?r:n.dkLen,!0)));$se.shake128=qce(31,168,16),$se.shake256=qce(31,136,32);var Kce={};!function(e){function t(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function r(...e){const t=e=>e,r=(e,t)=>r=>e(t(r)),n=e.map((e=>e.encode)).reduceRight(r,t),i=e.map((e=>e.decode)).reduce(r,t);return{encode:n,decode:i}}function n(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const r=e.indexOf(t);if(-1===r)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return r}))}}}function i(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function o(e,t="="){if("string"!=typeof t)throw new Error("padding chr should be string");return{encode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;r.length*e%8;)r.push(t);return r},decode(r){if(!Array.isArray(r)||r.length&&"string"!=typeof r[0])throw new Error("padding.encode input should be array of strings");for(let e of r)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let n=r.length;if(n*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if(!((n-1)*e%8))throw new Error("Invalid padding: string has too much padding");return r.slice(0,n)}}}function a(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function s(e,t,r){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let n=0;const i=[],o=Array.from(e);for(o.forEach((e=>{if(e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,a=!0;for(let i=n;it?c(t,e%t):e,u=(e,t)=>e+(t-c(e,t));function l(e,t,r,n){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(u(t,r)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${u(t,r)}`);let i=0,o=0;const a=2**r-1,s=[];for(const n of e){if(n>=2**t)throw new Error(`convertRadix2: invalid data word=${n} from=${t}`);if(i=i<32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=r;o-=r)s.push((i>>o-r&a)>>>0);i&=2**o-1}if(i=i<=t)throw new Error("Excess padding");if(!n&&i)throw new Error(`Non-zero padding: ${i}`);return n&&o>0&&s.push(i>>>0),s}function f(e){return{encode:r=>{if(!t(r))throw new Error("radix.encode input should be Uint8Array");return s(Array.from(r),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(s(t,e,256))}}}function d(e,r=!1){if(e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(u(8,e)>32||u(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!t(n))throw new Error("radix2.encode input should be Uint8Array");return l(Array.from(n),8,e,!r)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(l(t,e,8,r))}}}function h(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}function p(e,r){if("function"!=typeof r)throw new Error("checksum fn should be function");return{encode(n){if(!t(n))throw new Error("checksum.encode: input should be Uint8Array");const i=r(n).slice(0,e),o=new Uint8Array(n.length+e);return o.set(n),o.set(i,n.length),o},decode(n){if(!t(n))throw new Error("checksum.decode: input should be Uint8Array");const i=n.slice(0,-e),o=r(i).slice(0,e),a=n.slice(-e);for(let t=0;te.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),e.base64=r(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),o(6),i("")),e.base64nopad=r(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),i("")),e.base64url=r(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),o(6),i("")),e.base64urlnopad=r(d(6),n("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),i(""));const m=e=>r(f(58),n(e),i(""));e.base58=m("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e.base58flickr=m("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e.base58xrp=m("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const b=[0,2,3,5,6,7,9,10,11];e.base58xmr={encode(t){let r="";for(let n=0;nr(p(4,(e=>t(t(e)))),e.base58),e.base58check=e.createBase58check;const g=r(n("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),i("")),y=[996825010,642813549,513874426,1027748829,705979059];function v(e){const t=e>>25;let r=(33554431&e)<<5;for(let e=0;e>e&1)&&(r^=y[e]);return r}function w(e,t,r=1){const n=e.length;let i=1;for(let t=0;t126)throw new Error(`Invalid prefix (${e})`);i=v(i)^r>>5}i=v(i);for(let t=0;tr)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${r})`);const n=e.toLowerCase();if(e!==n&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const i=n.lastIndexOf("1");if(0===i||-1===i)throw new Error('Letter "1" must be present between prefix and data only');const o=n.slice(0,i),a=n.slice(i+1);if(a.length<6)throw new Error("Data must be at least 6 characters long");const s=g.decode(a).slice(0,-6),c=w(o,s,t);if(!a.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:o,words:s}}return{encode:function(e,r,n=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(r)||r.length&&"number"!=typeof r[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof r);if(0===e.length)throw new TypeError(`Invalid prefix length ${e.length}`);const i=e.length+7+r.length;if(!1!==n&&i>n)throw new TypeError(`Length ${i} exceeds limit ${n}`);const o=e.toLowerCase(),a=w(o,r,t);return`${o}1${g.encode(r)}${a}`},decode:a,decodeToBytes:function(e){const{prefix:t,words:r}=a(e,!1);return{prefix:t,words:r,bytes:n(r)}},decodeUnsafe:h(a),fromWords:n,fromWordsUnsafe:o,toWords:i}}e.bech32=E("bech32"),e.bech32m=E("bech32m"),e.utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},e.hex=r(d(4),n("0123456789abcdef"),i(""),a((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));const A={utf8:e.utf8,hex:e.hex,base16:e.base16,base32:e.base32,base64:e.base64,base64url:e.base64url,base58:e.base58,base58xmr:e.base58xmr},x="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr";e.bytesToString=(e,r)=>{if("string"!=typeof e||!A.hasOwnProperty(e))throw new TypeError(x);if(!t(r))throw new TypeError("bytesToString() expects Uint8Array");return A[e].encode(r)},e.str=e.bytesToString;e.stringToBytes=(e,t)=>{if(!A.hasOwnProperty(e))throw new TypeError(x);if("string"!=typeof t)throw new TypeError("stringToBytes() expects string");return A[e].decode(t)},e.bytes=e.stringToBytes}(Kce),Object.defineProperty(yse,"__esModule",{value:!0});var Vce=vse,Wce=$se,Jce=Lse,Zce=Kce,Yce=48,Xce=58,Qce=87;var eue=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function tue(e){return e instanceof Uint8Array}function rue(e){Vce.assert.call(void 0,tue(e),"Value must be a Uint8Array.")}function nue(e){if(rue(e),0===e.length)return"0x";const t=eue(),r=new Array(e.length);for(let n=0;nr.call(t,...e))),t=void 0)}return r}([e,"optionalAccess",e=>e.toLowerCase,"optionalCall",e=>e()]))return new Uint8Array;bue(e);const t=wue(e).toLowerCase(),r=t.length%2==0?t:`0${t}`,n=new Uint8Array(r.length/2);for(let e=0;e=BigInt(0),"Value must be a non-negative bigint.");return oue(e.toString(16))}function sue(e){Vce.assert.call(void 0,"number"==typeof e,"Value must be a number."),Vce.assert.call(void 0,e>=0,"Value must be a non-negative number."),Vce.assert.call(void 0,Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");return oue(e.toString(16))}function cue(e){return Vce.assert.call(void 0,"string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function uue(e){if("bigint"==typeof e)return aue(e);if("number"==typeof e)return sue(e);if("string"==typeof e)return e.startsWith("0x")?oue(e):cue(e);if(tue(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}var lue=Jce.pattern.call(void 0,Jce.string.call(void 0),/^(?:0x)?[0-9a-f]+$/iu),fue=Jce.pattern.call(void 0,Jce.string.call(void 0),/^0x[0-9a-f]+$/iu),due=Jce.pattern.call(void 0,Jce.string.call(void 0),/^0x[0-9a-f]{40}$/u),hue=Jce.pattern.call(void 0,Jce.string.call(void 0),/^0x[0-9a-fA-F]{40}$/u);function pue(e){return Jce.is.call(void 0,e,lue)}function mue(e){return Jce.is.call(void 0,e,fue)}function bue(e){Vce.assert.call(void 0,pue(e),"Value must be a hexadecimal string.")}function gue(e){Vce.assert.call(void 0,Jce.is.call(void 0,e,hue),"Invalid hex address.");const t=wue(e.toLowerCase()),r=wue(nue(Wce.keccak_256.call(void 0,t)));return`0x${t.split("").map(((e,t)=>{const n=r[t];return Vce.assert.call(void 0,Jce.is.call(void 0,n,Jce.string.call(void 0)),"Hash shorter than address."),parseInt(n,16)>7?e.toUpperCase():e})).join("")}`}function yue(e){return!!Jce.is.call(void 0,e,hue)&&gue(e)===e}function vue(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`}function wue(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}yse.HexStruct=lue,yse.StrictHexStruct=fue,yse.HexAddressStruct=due,yse.HexChecksumAddressStruct=hue,yse.isHexString=pue,yse.isStrictHexString=mue,yse.assertIsHexString=bue,yse.assertIsStrictHexString=function(e){Vce.assert.call(void 0,mue(e),'Value must be a hexadecimal string, starting with "0x".')},yse.isValidHexAddress=function(e){return Jce.is.call(void 0,e,due)||yue(e)},yse.getChecksumAddress=gue,yse.isValidChecksumAddress=yue,yse.add0x=vue,yse.remove0x=wue,yse.isBytes=tue,yse.assertIsBytes=rue,yse.bytesToHex=nue,yse.bytesToBigInt=iue,yse.bytesToSignedBigInt=function(e){rue(e);let t=BigInt(0);for(const r of e)t=(t<0,"Byte length must be greater than 0."),Vce.assert.call(void 0,function(e,t){Vce.assert.call(void 0,t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(8*t-1))}(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let e=0;e>=BigInt(8);return n.reverse()},yse.numberToBytes=sue,yse.stringToBytes=cue,yse.base64ToBytes=function(e){return Vce.assert.call(void 0,"string"==typeof e,"Value must be a string."),Zce.base64.decode(e)},yse.valueToBytes=uue,yse.concatBytes=function(e){const t=new Array(e.length);let r=0;for(let n=0;n(Aue.assert.call(void 0,"number"==typeof e,"Value must be a number."),Aue.assert.call(void 0,e>=0,"Value must be a non-negative number."),Aue.assert.call(void 0,Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),Eue.add0x.call(void 0,e.toString(16))),gse.bigIntToHex=e=>(Aue.assert.call(void 0,"bigint"==typeof e,"Value must be a bigint."),Aue.assert.call(void 0,e>=0,"Value must be a non-negative bigint."),Eue.add0x.call(void 0,e.toString(16))),gse.hexToNumber=e=>{Eue.assertIsHexString.call(void 0,e);const t=parseInt(e,16);return Aue.assert.call(void 0,Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t},gse.hexToBigInt=e=>(Eue.assertIsHexString.call(void 0,e),BigInt(Eue.add0x.call(void 0,e)));var xue={};Object.defineProperty(xue,"__esModule",{value:!0}),xue.createDeferredPromise=function({suppressUnhandledRejection:e=!1}={}){let t,r;const n=new Promise(((e,n)=>{t=e,r=n}));return e&&n.catch((e=>{})),{promise:n,resolve:t,reject:r}};var _ue={};Object.defineProperty(_ue,"__esModule",{value:!0});var kue=(e=>(e[e.Millisecond=1]="Millisecond",e[e.Second=1e3]="Second",e[e.Minute=6e4]="Minute",e[e.Hour=36e5]="Hour",e[e.Day=864e5]="Day",e[e.Week=6048e5]="Week",e[e.Year=31536e6]="Year",e))(kue||{}),Sue=(e,t)=>{if(!(e=>Number.isInteger(e)&&e>=0)(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};_ue.Duration=kue,_ue.inMilliseconds=function(e,t){return Sue(e,"count"),e*t},_ue.timeSince=function(e){return Sue(e,"timestamp"),Date.now()-e};var Pue={};Object.defineProperty(Pue,"__esModule",{value:!0});var Iue=vse,Tue=gl,Oue=Lse,Mue=Oue.refine.call(void 0,Oue.string.call(void 0),"Version",(e=>null!==Tue.valid.call(void 0,e)||`Expected SemVer version, got "${e}"`)),Cue=Oue.refine.call(void 0,Oue.string.call(void 0),"Version range",(e=>null!==Tue.validRange.call(void 0,e)||`Expected SemVer range, got "${e}"`));Pue.VersionStruct=Mue,Pue.VersionRangeStruct=Cue,Pue.isValidSemVerVersion=function(e){return Oue.is.call(void 0,e,Mue)},Pue.isValidSemVerRange=function(e){return Oue.is.call(void 0,e,Cue)},Pue.assertIsSemVerVersion=function(e){Iue.assertStruct.call(void 0,e,Mue)},Pue.assertIsSemVerRange=function(e){Iue.assertStruct.call(void 0,e,Cue)},Pue.gtVersion=function(e,t){return Tue.gt.call(void 0,e,t)},Pue.gtRange=function(e,t){return Tue.gtr.call(void 0,e,t)},Pue.satisfiesVersionRange=function(e,t){return Tue.satisfies.call(void 0,e,t,{includePrerelease:!0})};var Bue={};Object.defineProperty(Bue,"__esModule",{value:!0});var Nue=vse,Rue=Ese,Fue=Lse,Lue=e=>Fue.object.call(void 0,e);function Uue({path:e,branch:t}){const r=e[e.length-1];return Rue.hasProperty.call(void 0,t[t.length-2],r)}function jue(e){return new Fue.Struct({...e,type:`optional ${e.type}`,validator:(t,r)=>!Uue(r)||e.validator(t,r),refiner:(t,r)=>!Uue(r)||e.refiner(t,r)})}var Due=Fue.union.call(void 0,[Fue.literal.call(void 0,null),Fue.boolean.call(void 0),Fue.define.call(void 0,"finite number",(e=>Fue.is.call(void 0,e,Fue.number.call(void 0))&&Number.isFinite(e))),Fue.string.call(void 0),Fue.array.call(void 0,Fue.lazy.call(void 0,(()=>Due))),Fue.record.call(void 0,Fue.string.call(void 0),Fue.lazy.call(void 0,(()=>Due)))]),zue=Fue.coerce.call(void 0,Due,Fue.any.call(void 0),(e=>(Nue.assertStruct.call(void 0,e,Due),JSON.parse(JSON.stringify(e,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t}))))));function $ue(e){return Fue.create.call(void 0,e,zue)}var Hue=Fue.literal.call(void 0,"2.0"),Gue=Fue.nullable.call(void 0,Fue.union.call(void 0,[Fue.number.call(void 0),Fue.string.call(void 0)])),que=Lue({code:Fue.integer.call(void 0),message:Fue.string.call(void 0),data:jue(zue),stack:jue(Fue.string.call(void 0))}),Kue=Fue.union.call(void 0,[Fue.record.call(void 0,Fue.string.call(void 0),zue),Fue.array.call(void 0,zue)]),Vue=Lue({id:Gue,jsonrpc:Hue,method:Fue.string.call(void 0),params:jue(Kue)}),Wue=Lue({jsonrpc:Hue,method:Fue.string.call(void 0),params:jue(Kue)});var Jue=Fue.object.call(void 0,{id:Gue,jsonrpc:Hue,result:Fue.optional.call(void 0,Fue.unknown.call(void 0)),error:Fue.optional.call(void 0,que)}),Zue=Lue({id:Gue,jsonrpc:Hue,result:zue}),Yue=Lue({id:Gue,jsonrpc:Hue,error:que}),Xue=Fue.union.call(void 0,[Zue,Yue]);Bue.object=Lue,Bue.exactOptional=jue,Bue.UnsafeJsonStruct=Due,Bue.JsonStruct=zue,Bue.isValidJson=function(e){try{return $ue(e),!0}catch(e){return!1}},Bue.getSafeJson=$ue,Bue.getJsonSize=function(e){Nue.assertStruct.call(void 0,e,zue,"Invalid JSON value");const t=JSON.stringify(e);return(new TextEncoder).encode(t).byteLength},Bue.jsonrpc2="2.0",Bue.JsonRpcVersionStruct=Hue,Bue.JsonRpcIdStruct=Gue,Bue.JsonRpcErrorStruct=que,Bue.JsonRpcParamsStruct=Kue,Bue.JsonRpcRequestStruct=Vue,Bue.JsonRpcNotificationStruct=Wue,Bue.isJsonRpcNotification=function(e){return Fue.is.call(void 0,e,Wue)},Bue.assertIsJsonRpcNotification=function(e,t){Nue.assertStruct.call(void 0,e,Wue,"Invalid JSON-RPC notification",t)},Bue.isJsonRpcRequest=function(e){return Fue.is.call(void 0,e,Vue)},Bue.assertIsJsonRpcRequest=function(e,t){Nue.assertStruct.call(void 0,e,Vue,"Invalid JSON-RPC request",t)},Bue.PendingJsonRpcResponseStruct=Jue,Bue.JsonRpcSuccessStruct=Zue,Bue.JsonRpcFailureStruct=Yue,Bue.JsonRpcResponseStruct=Xue,Bue.isPendingJsonRpcResponse=function(e){return Fue.is.call(void 0,e,Jue)},Bue.assertIsPendingJsonRpcResponse=function(e,t){Nue.assertStruct.call(void 0,e,Jue,"Invalid pending JSON-RPC response",t)},Bue.isJsonRpcResponse=function(e){return Fue.is.call(void 0,e,Xue)},Bue.assertIsJsonRpcResponse=function(e,t){Nue.assertStruct.call(void 0,e,Xue,"Invalid JSON-RPC response",t)},Bue.isJsonRpcSuccess=function(e){return Fue.is.call(void 0,e,Zue)},Bue.assertIsJsonRpcSuccess=function(e,t){Nue.assertStruct.call(void 0,e,Zue,"Invalid JSON-RPC success response",t)},Bue.isJsonRpcFailure=function(e){return Fue.is.call(void 0,e,Yue)},Bue.assertIsJsonRpcFailure=function(e,t){Nue.assertStruct.call(void 0,e,Yue,"Invalid JSON-RPC failure response",t)},Bue.isJsonRpcError=function(e){return Fue.is.call(void 0,e,que)},Bue.assertIsJsonRpcError=function(e,t){Nue.assertStruct.call(void 0,e,que,"Invalid JSON-RPC error",t)},Bue.getJsonRpcIdValidator=function(e){const{permitEmptyString:t,permitFractions:r,permitNull:n}={permitEmptyString:!0,permitFractions:!1,permitNull:!0,...e};return e=>Boolean("number"==typeof e&&(r||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||n&&null===e)};var Que={};Object.defineProperty(Que,"__esModule",{value:!0});var ele,tle=((ele=Nl)&&ele.__esModule?ele:{default:ele}).default.call(void 0,"metamask");Que.createProjectLogger=function(e){return tle.extend(e)},Que.createModuleLogger=function(e,t){return e.extend(t)};var rle={};function nle(e){let t,r=e[0],n=1;for(;nr.call(t,...e))),t=void 0)}return r}Object.defineProperty(rle,"__esModule",{value:!0});var ile=Lse,ole=/^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,ale=/^[-a-z0-9]{3,8}$/u,sle=/^[-_a-zA-Z0-9]{1,32}$/u,cle=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,ule=/^[-.%a-zA-Z0-9]{1,128}$/u,lle=ile.pattern.call(void 0,ile.string.call(void 0),ole),fle=ile.pattern.call(void 0,ile.string.call(void 0),ale),dle=ile.pattern.call(void 0,ile.string.call(void 0),sle),hle=ile.pattern.call(void 0,ile.string.call(void 0),cle),ple=ile.pattern.call(void 0,ile.string.call(void 0),ule),mle=(e=>(e.Eip155="eip155",e))(mle||{});function ble(e){return ile.is.call(void 0,e,fle)}function gle(e){return ile.is.call(void 0,e,dle)}rle.CAIP_CHAIN_ID_REGEX=ole,rle.CAIP_NAMESPACE_REGEX=ale,rle.CAIP_REFERENCE_REGEX=sle,rle.CAIP_ACCOUNT_ID_REGEX=cle,rle.CAIP_ACCOUNT_ADDRESS_REGEX=ule,rle.CaipChainIdStruct=lle,rle.CaipNamespaceStruct=fle,rle.CaipReferenceStruct=dle,rle.CaipAccountIdStruct=hle,rle.CaipAccountAddressStruct=ple,rle.KnownCaipNamespace=mle,rle.isCaipChainId=function(e){return ile.is.call(void 0,e,lle)},rle.isCaipNamespace=ble,rle.isCaipReference=gle,rle.isCaipAccountId=function(e){return ile.is.call(void 0,e,hle)},rle.isCaipAccountAddress=function(e){return ile.is.call(void 0,e,ple)},rle.parseCaipChainId=function(e){const t=ole.exec(e);if(!nle([t,"optionalAccess",e=>e.groups]))throw new Error("Invalid CAIP chain ID.");return{namespace:t.groups.namespace,reference:t.groups.reference}},rle.parseCaipAccountId=function(e){const t=cle.exec(e);if(!nle([t,"optionalAccess",e=>e.groups]))throw new Error("Invalid CAIP account ID.");return{address:t.groups.accountAddress,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}},rle.toCaipChainId=function(e,t){if(!ble(e))throw new Error(`Invalid "namespace", must match: ${ale.toString()}`);if(!gle(t))throw new Error(`Invalid "reference", must match: ${sle.toString()}`);return`${e}:${t}`};var yle={},vle={};function wle(e,t){return null!=e?e:t()}Object.defineProperty(vle,"__esModule",{value:!0});var Ele=vse,Ale=Lse;vle.base64=(e,t={})=>{const r=wle(t.paddingRequired,(()=>!1)),n=wle(t.characterSet,(()=>"base64"));let i,o;return"base64"===n?i=String.raw`[A-Za-z0-9+\/]`:(Ele.assert.call(void 0,"base64url"===n),i=String.raw`[-_A-Za-z0-9]`),o=r?new RegExp(`^(?:${i}{4})*(?:${i}{3}=|${i}{2}==)?$`,"u"):new RegExp(`^(?:${i}{4})*(?:${i}{2,3}|${i}{3}=|${i}{2}==)?$`,"u"),Ale.pattern.call(void 0,e,o)},Object.defineProperty(yle,"__esModule",{value:!0});var xle=vle,_le=Lse,kle=_le.size.call(void 0,xle.base64.call(void 0,_le.string.call(void 0),{paddingRequired:!0}),44,44);yle.ChecksumStruct=kle;var Sle={};Object.defineProperty(Sle,"__esModule",{value:!0});var Ple=yse,Ile=vse,Tle=Lse,Ole=Tle.union.call(void 0,[Tle.number.call(void 0),Tle.bigint.call(void 0),Tle.string.call(void 0),Ple.StrictHexStruct]),Mle=Tle.coerce.call(void 0,Tle.number.call(void 0),Ole,Number),Cle=Tle.coerce.call(void 0,Tle.bigint.call(void 0),Ole,BigInt);Tle.union.call(void 0,[Ple.StrictHexStruct,Tle.instance.call(void 0,Uint8Array)]);var Ble=Tle.coerce.call(void 0,Tle.instance.call(void 0,Uint8Array),Tle.union.call(void 0,[Ple.StrictHexStruct]),Ple.hexToBytes),Nle=Tle.coerce.call(void 0,Ple.StrictHexStruct,Tle.instance.call(void 0,Uint8Array),Ple.bytesToHex);Sle.createNumber=function(e){try{const t=Tle.create.call(void 0,e,Mle);return Ile.assert.call(void 0,Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){if(t instanceof Tle.StructError)throw new Error(`Expected a number-like value, got "${e}".`);throw t}},Sle.createBigInt=function(e){try{return Tle.create.call(void 0,e,Cle)}catch(e){if(e instanceof Tle.StructError)throw new Error(`Expected a number-like value, got "${String(e.value)}".`);throw e}},Sle.createBytes=function(e){if("string"==typeof e&&"0x"===e.toLowerCase())return new Uint8Array;try{return Tle.create.call(void 0,e,Ble)}catch(e){if(e instanceof Tle.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}},Sle.createHex=function(e){if(e instanceof Uint8Array&&0===e.length||"string"==typeof e&&"0x"===e.toLowerCase())return"0x";try{return Tle.create.call(void 0,e,Nle)}catch(e){if(e instanceof Tle.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}};var Rle={},Fle={};Object.defineProperty(Fle,"__esModule",{value:!0});var Lle=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};Fle.__privateGet=(e,t,r)=>(Lle(e,t,"read from private field"),r?r.call(e):t.get(e)),Fle.__privateAdd=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Fle.__privateSet=(e,t,r,n)=>(Lle(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Object.defineProperty(Rle,"__esModule",{value:!0});var Ule,jle,Dle=Fle,zle=class{constructor(e){Dle.__privateAdd.call(void 0,this,Ule,void 0),Dle.__privateSet.call(void 0,this,Ule,new Map(e)),Object.freeze(this)}get size(){return Dle.__privateGet.call(void 0,this,Ule).size}[Symbol.iterator](){return Dle.__privateGet.call(void 0,this,Ule)[Symbol.iterator]()}entries(){return Dle.__privateGet.call(void 0,this,Ule).entries()}forEach(e,t){return Dle.__privateGet.call(void 0,this,Ule).forEach(((r,n,i)=>e.call(t,r,n,this)))}get(e){return Dle.__privateGet.call(void 0,this,Ule).get(e)}has(e){return Dle.__privateGet.call(void 0,this,Ule).has(e)}keys(){return Dle.__privateGet.call(void 0,this,Ule).keys()}values(){return Dle.__privateGet.call(void 0,this,Ule).values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map((([e,t])=>`${String(e)} => ${String(t)}`)).join(", ")} `:""}}`}};Ule=new WeakMap;var $le=class{constructor(e){Dle.__privateAdd.call(void 0,this,jle,void 0),Dle.__privateSet.call(void 0,this,jle,new Set(e)),Object.freeze(this)}get size(){return Dle.__privateGet.call(void 0,this,jle).size}[Symbol.iterator](){return Dle.__privateGet.call(void 0,this,jle)[Symbol.iterator]()}entries(){return Dle.__privateGet.call(void 0,this,jle).entries()}forEach(e,t){return Dle.__privateGet.call(void 0,this,jle).forEach(((r,n,i)=>e.call(t,r,n,this)))}has(e){return Dle.__privateGet.call(void 0,this,jle).has(e)}keys(){return Dle.__privateGet.call(void 0,this,jle).keys()}values(){return Dle.__privateGet.call(void 0,this,jle).values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map((e=>String(e))).join(", ")} `:""}}`}};jle=new WeakMap,Object.freeze(zle),Object.freeze(zle.prototype),Object.freeze($le),Object.freeze($le.prototype),Rle.FrozenMap=zle,Rle.FrozenSet=$le,Object.defineProperty(bse,"__esModule",{value:!0});var Hle=gse,Gle=xue,qle=_ue,Kle=Pue,Vle=Bue,Wle=Que,Jle=rle,Zle=yle,Yle=vle,Xle=Sle,Qle=yse,efe=vse,tfe=wse,rfe=Ese,nfe=Rle;bse.AssertionError=efe.AssertionError,bse.CAIP_ACCOUNT_ADDRESS_REGEX=Jle.CAIP_ACCOUNT_ADDRESS_REGEX,bse.CAIP_ACCOUNT_ID_REGEX=Jle.CAIP_ACCOUNT_ID_REGEX,bse.CAIP_CHAIN_ID_REGEX=Jle.CAIP_CHAIN_ID_REGEX,bse.CAIP_NAMESPACE_REGEX=Jle.CAIP_NAMESPACE_REGEX,bse.CAIP_REFERENCE_REGEX=Jle.CAIP_REFERENCE_REGEX,bse.CaipAccountAddressStruct=Jle.CaipAccountAddressStruct,bse.CaipAccountIdStruct=Jle.CaipAccountIdStruct,bse.CaipChainIdStruct=Jle.CaipChainIdStruct,bse.CaipNamespaceStruct=Jle.CaipNamespaceStruct,bse.CaipReferenceStruct=Jle.CaipReferenceStruct,bse.ChecksumStruct=Zle.ChecksumStruct,bse.Duration=qle.Duration,bse.ESCAPE_CHARACTERS_REGEXP=rfe.ESCAPE_CHARACTERS_REGEXP,bse.FrozenMap=nfe.FrozenMap,bse.FrozenSet=nfe.FrozenSet,bse.HexAddressStruct=Qle.HexAddressStruct,bse.HexChecksumAddressStruct=Qle.HexChecksumAddressStruct,bse.HexStruct=Qle.HexStruct,bse.JsonRpcErrorStruct=Vle.JsonRpcErrorStruct,bse.JsonRpcFailureStruct=Vle.JsonRpcFailureStruct,bse.JsonRpcIdStruct=Vle.JsonRpcIdStruct,bse.JsonRpcNotificationStruct=Vle.JsonRpcNotificationStruct,bse.JsonRpcParamsStruct=Vle.JsonRpcParamsStruct,bse.JsonRpcRequestStruct=Vle.JsonRpcRequestStruct,bse.JsonRpcResponseStruct=Vle.JsonRpcResponseStruct,bse.JsonRpcSuccessStruct=Vle.JsonRpcSuccessStruct,bse.JsonRpcVersionStruct=Vle.JsonRpcVersionStruct,bse.JsonSize=rfe.JsonSize,bse.JsonStruct=Vle.JsonStruct,bse.KnownCaipNamespace=Jle.KnownCaipNamespace,bse.PendingJsonRpcResponseStruct=Vle.PendingJsonRpcResponseStruct,bse.StrictHexStruct=Qle.StrictHexStruct,bse.UnsafeJsonStruct=Vle.UnsafeJsonStruct,bse.VersionRangeStruct=Kle.VersionRangeStruct,bse.VersionStruct=Kle.VersionStruct,bse.add0x=Qle.add0x,bse.assert=efe.assert,bse.assertExhaustive=efe.assertExhaustive,bse.assertIsBytes=Qle.assertIsBytes,bse.assertIsHexString=Qle.assertIsHexString,bse.assertIsJsonRpcError=Vle.assertIsJsonRpcError,bse.assertIsJsonRpcFailure=Vle.assertIsJsonRpcFailure,bse.assertIsJsonRpcNotification=Vle.assertIsJsonRpcNotification,bse.assertIsJsonRpcRequest=Vle.assertIsJsonRpcRequest,bse.assertIsJsonRpcResponse=Vle.assertIsJsonRpcResponse,bse.assertIsJsonRpcSuccess=Vle.assertIsJsonRpcSuccess,bse.assertIsPendingJsonRpcResponse=Vle.assertIsPendingJsonRpcResponse,bse.assertIsSemVerRange=Kle.assertIsSemVerRange,bse.assertIsSemVerVersion=Kle.assertIsSemVerVersion,bse.assertIsStrictHexString=Qle.assertIsStrictHexString,bse.assertStruct=efe.assertStruct,bse.base64=Yle.base64,bse.base64ToBytes=Qle.base64ToBytes,bse.bigIntToBytes=Qle.bigIntToBytes,bse.bigIntToHex=Hle.bigIntToHex,bse.bytesToBase64=Qle.bytesToBase64,bse.bytesToBigInt=Qle.bytesToBigInt,bse.bytesToHex=Qle.bytesToHex,bse.bytesToNumber=Qle.bytesToNumber,bse.bytesToSignedBigInt=Qle.bytesToSignedBigInt,bse.bytesToString=Qle.bytesToString,bse.calculateNumberSize=rfe.calculateNumberSize,bse.calculateStringSize=rfe.calculateStringSize,bse.concatBytes=Qle.concatBytes,bse.createBigInt=Xle.createBigInt,bse.createBytes=Xle.createBytes,bse.createDataView=Qle.createDataView,bse.createDeferredPromise=Gle.createDeferredPromise,bse.createHex=Xle.createHex,bse.createModuleLogger=Wle.createModuleLogger,bse.createNumber=Xle.createNumber,bse.createProjectLogger=Wle.createProjectLogger,bse.exactOptional=Vle.exactOptional,bse.getChecksumAddress=Qle.getChecksumAddress,bse.getErrorMessage=tfe.getErrorMessage,bse.getJsonRpcIdValidator=Vle.getJsonRpcIdValidator,bse.getJsonSize=Vle.getJsonSize,bse.getKnownPropertyNames=rfe.getKnownPropertyNames,bse.getSafeJson=Vle.getSafeJson,bse.gtRange=Kle.gtRange,bse.gtVersion=Kle.gtVersion,bse.hasProperty=rfe.hasProperty,bse.hexToBigInt=Hle.hexToBigInt,bse.hexToBytes=Qle.hexToBytes,bse.hexToNumber=Hle.hexToNumber,bse.inMilliseconds=qle.inMilliseconds,bse.isASCII=rfe.isASCII,bse.isBytes=Qle.isBytes,bse.isCaipAccountAddress=Jle.isCaipAccountAddress,bse.isCaipAccountId=Jle.isCaipAccountId,bse.isCaipChainId=Jle.isCaipChainId,bse.isCaipNamespace=Jle.isCaipNamespace,bse.isCaipReference=Jle.isCaipReference,bse.isErrorWithCode=tfe.isErrorWithCode,bse.isErrorWithMessage=tfe.isErrorWithMessage,bse.isErrorWithStack=tfe.isErrorWithStack,bse.isHexString=Qle.isHexString,bse.isJsonRpcError=Vle.isJsonRpcError,bse.isJsonRpcFailure=Vle.isJsonRpcFailure,bse.isJsonRpcNotification=Vle.isJsonRpcNotification,bse.isJsonRpcRequest=Vle.isJsonRpcRequest,bse.isJsonRpcResponse=Vle.isJsonRpcResponse,bse.isJsonRpcSuccess=Vle.isJsonRpcSuccess,bse.isNonEmptyArray=rfe.isNonEmptyArray,bse.isNullOrUndefined=rfe.isNullOrUndefined,bse.isObject=rfe.isObject,bse.isPendingJsonRpcResponse=Vle.isPendingJsonRpcResponse,bse.isPlainObject=rfe.isPlainObject,bse.isStrictHexString=Qle.isStrictHexString,bse.isValidChecksumAddress=Qle.isValidChecksumAddress,bse.isValidHexAddress=Qle.isValidHexAddress,bse.isValidJson=Vle.isValidJson,bse.isValidSemVerRange=Kle.isValidSemVerRange,bse.isValidSemVerVersion=Kle.isValidSemVerVersion,bse.jsonrpc2=Vle.jsonrpc2,bse.numberToBytes=Qle.numberToBytes,bse.numberToHex=Hle.numberToHex,bse.object=Vle.object,bse.parseCaipAccountId=Jle.parseCaipAccountId,bse.parseCaipChainId=Jle.parseCaipChainId,bse.remove0x=Qle.remove0x,bse.satisfiesVersionRange=Kle.satisfiesVersionRange,bse.signedBigIntToBytes=Qle.signedBigIntToBytes,bse.stringToBytes=Qle.stringToBytes,bse.timeSince=qle.timeSince,bse.toCaipChainId=Jle.toCaipChainId,bse.valueToBytes=Qle.valueToBytes,bse.wrapError=tfe.wrapError,Object.defineProperty(mse,"__esModule",{value:!0}),mse.normalize=mse.recoverPublicKey=mse.concatSig=mse.legacyToBuffer=mse.isNullish=mse.padWithZeroes=void 0;const ife=y4,ofe=bse;function afe(e,t){if(""!==e&&!/^[a-f0-9]+$/iu.test(e))throw new Error(`Expected an unprefixed hex string. Received: ${e}`);if(t<0)throw new Error(`Expected a non-negative integer target length. Received: ${t}`);return String.prototype.padStart.call(e,t,"0")}function sfe(e){return null==e}mse.padWithZeroes=afe,mse.isNullish=sfe,mse.legacyToBuffer=function(e){return"string"!=typeof e||(0,ife.isHexString)(e)?(0,ife.toBuffer)(e):_.from(e)},mse.concatSig=function(e,t,r){const n=(0,ife.fromSigned)(t),i=(0,ife.fromSigned)(r),o=(0,ife.bufferToInt)(e),a=afe((0,ife.toUnsigned)(n).toString("hex"),64),s=afe((0,ife.toUnsigned)(i).toString("hex"),64),c=(0,ofe.remove0x)((0,ofe.numberToHex)(o));return(0,ofe.add0x)(a.concat(s,c))},mse.recoverPublicKey=function(e,t){const r=(0,ife.fromRpcSig)(t);return(0,ife.ecrecover)(e,r.v,r.r,r.s)},mse.normalize=function(e){if(!sfe(e)){if("number"==typeof e){if(e<0)return"0x";const t=(0,ofe.numberToBytes)(e);e=(0,ofe.bytesToHex)(t)}if("string"!=typeof e){let t="eth-sig-util.normalize() requires hex string or integer input.";throw t+=` received ${typeof e}: ${e}`,new Error(t)}return(0,ofe.add0x)(e.toLowerCase())}},Object.defineProperty(g4,"__esModule",{value:!0}),g4.extractPublicKey=g4.recoverPersonalSignature=g4.personalSign=void 0;const cfe=y4,ufe=mse;function lfe(e,t){const r=(0,cfe.hashPersonalMessage)((0,ufe.legacyToBuffer)(e));return(0,ufe.recoverPublicKey)(r,t)}g4.personalSign=function({privateKey:e,data:t}){if((0,ufe.isNullish)(t))throw new Error("Missing data parameter");if((0,ufe.isNullish)(e))throw new Error("Missing privateKey parameter");const r=(0,ufe.legacyToBuffer)(t),n=(0,cfe.hashPersonalMessage)(r),i=(0,cfe.ecsign)(n,e);return(0,ufe.concatSig)((0,cfe.toBuffer)(i.v),i.r,i.s)},g4.recoverPersonalSignature=function({data:e,signature:t}){if((0,ufe.isNullish)(e))throw new Error("Missing data parameter");if((0,ufe.isNullish)(t))throw new Error("Missing signature parameter");const r=lfe(e,t),n=(0,cfe.publicToAddress)(r);return(0,cfe.bufferToHex)(n)},g4.extractPublicKey=function({data:e,signature:t}){if((0,ufe.isNullish)(e))throw new Error("Missing data parameter");if((0,ufe.isNullish)(t))throw new Error("Missing signature parameter");return`0x${lfe(e,t).toString("hex")}`};var ffe={},dfe={},hfe={},pfe={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ParserError=e.getErrorStack=e.getErrorMessage=void 0;const t=bse;e.getErrorMessage=e=>"string"==typeof e?e:e instanceof Error||(0,t.isObject)(e)&&(0,t.hasProperty)(e,"message")&&"string"==typeof e.message?e.message:"Unknown error.";e.getErrorStack=e=>{if(e instanceof Error)return e.stack};class r extends Error{constructor(t,r){super(t),this.name="ParserError";const n=(0,e.getErrorStack)(r);n&&(this.stack=n)}}e.ParserError=r}(pfe);var mfe={},bfe={};Object.defineProperty(bfe,"__esModule",{value:!0}),bfe.iterate=void 0;const gfe=bse;bfe.iterate=function*(e,t=32){for(let r=0;r{(0,gfe.assert)(e>=0,"Cannot skip a negative number of bytes."),(0,gfe.assert)(e%t==0,"Length must be a multiple of the size."),r+=e},i=e.subarray(r);yield{skip:n,value:i}}return{skip:()=>{},value:new Uint8Array}};var yfe={},vfe={},wfe={},Efe={};Object.defineProperty(Efe,"__esModule",{value:!0}),Efe.padEnd=Efe.padStart=Efe.set=void 0;const Afe=bse;Efe.set=(e,t,r)=>(0,Afe.concatBytes)([e.subarray(0,r),t,e.subarray(r+t.length)]);Efe.padStart=(e,t=32)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Afe.concatBytes)([r,e])};Efe.padEnd=(e,t=32)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Afe.concatBytes)([e,r])},function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(Efe,e)}(wfe),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.address=e.getAddress=void 0;const t=bse,r=pfe,n=wfe;e.getAddress=e=>{const i=(0,t.createBytes)(e);return(0,t.assert)(i.length<=20,new r.ParserError(`Invalid address value. Expected address to be 20 bytes long, but received ${i.length} bytes.`)),(0,n.padStart)(i,20)},e.address={isDynamic:!1,isType:e=>"address"===e,getByteLength:()=>32,encode({buffer:r,value:i,packed:o}){const a=(0,e.getAddress)(i);if(o)return(0,t.concatBytes)([r,a]);const s=(0,n.padStart)(a);return(0,t.concatBytes)([r,s])},decode:({value:e})=>(0,t.add0x)((0,t.bytesToHex)(e.slice(12,32)))}}(vfe);var xfe={},_fe={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fixedBytes=e.getByteLength=void 0;const t=bse,r=pfe,n=wfe,i=/^bytes([0-9]{1,2})$/u;e.getByteLength=e=>{const n=e.match(i)?.[1];(0,t.assert)(n,`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`);const o=Number(n);return(0,t.assert)(o>0&&o<=32,new r.ParserError(`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`)),o},e.fixedBytes={isDynamic:!1,isType:e=>i.test(e),getByteLength:()=>32,encode({type:i,buffer:o,value:a,packed:s}){const c=(0,e.getByteLength)(i),u=(0,t.createBytes)(a);return(0,t.assert)(u.length<=c,new r.ParserError(`Expected a value of length ${c}, but received a value of length ${u.length}.`)),s?(0,t.concatBytes)([o,(0,n.padEnd)(u,c)]):(0,t.concatBytes)([o,(0,n.padEnd)(u)])},decode({type:t,value:r}){const n=(0,e.getByteLength)(t);return r.slice(0,n)}}}(_fe);var kfe,Sfe,Pfe={};function Ife(){return kfe||(kfe=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tuple=e.getTupleElements=void 0;const t=bse,r=pfe,n=hde(),i=/^\((.+)\)$/u;e.getTupleElements=e=>{(0,t.assert)(e.startsWith("(")&&e.endsWith(")"),new r.ParserError(`Invalid tuple type. Expected tuple type, but received "${e}".`));const n=[];let i="",o=0;for(let t=1;t(0,e.getTupleElements)(t).some((e=>{const t=(0,n.getParser)(e);return(0,n.isDynamicParser)(t,e)})),isType:e=>(e=>i.test(e))(e),getByteLength(t){if((0,n.isDynamicParser)(this,t))return 32;return(0,e.getTupleElements)(t).reduce(((e,t)=>e+(0,n.getParser)(t).getByteLength(t)),0)},encode({type:t,buffer:r,value:i,packed:o,tight:a}){const s=(0,e.getTupleElements)(t);return(0,n.pack)({types:s,values:i,byteArray:r,packed:o,tight:a})},decode({type:t,value:r,skip:i}){const o=(0,e.getTupleElements)(t);return i(this.getByteLength(t)-32),(0,n.unpack)(o,r)}}}(Pfe)),Pfe}var Tfe={};class Ofe extends TypeError{constructor(e,t){let r;const{message:n,explanation:i,...o}=e,{path:a}=e,s=0===a.length?n:`At path: ${a.join(".")} -- ${n}`;super(i??s),null!=i&&(this.cause=s),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function Mfe(e){return"object"==typeof e&&null!=e}function Cfe(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Bfe(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function Nfe(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:o}=t,{type:a}=r,{refinement:s,message:c=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${Bfe(n)}\``}=e;return{value:n,type:a,refinement:s,key:i[i.length-1],path:i,branch:o,...e,message:c}}function*Rfe(e,t,r,n){(function(e){return Mfe(e)&&"function"==typeof e[Symbol.iterator]})(e)||(e=[e]);for(const i of e){const e=Nfe(i,t,r,n);e&&(yield e)}}function*Ffe(e,t,r={}){const{path:n=[],branch:i=[e],coerce:o=!1,mask:a=!1}=r,s={path:n,branch:i};if(o&&(e=t.coercer(e,s),a&&"type"!==t.type&&Mfe(t.schema)&&Mfe(e)&&!Array.isArray(e)))for(const r in e)void 0===t.schema[r]&&delete e[r];let c="valid";for(const n of t.validator(e,s))n.explanation=r.message,c="not_valid",yield[n,void 0];for(let[u,l,f]of t.entries(e,s)){const t=Ffe(l,f,{path:void 0===u?n:[...n,u],branch:void 0===u?i:[...i,l],coerce:o,mask:a,message:r.message});for(const r of t)r[0]?(c=null!=r[0].refinement?"not_refined":"not_valid",yield[r[0],void 0]):o&&(l=r[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):Mfe(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const n of t.refiner(e,s))n.explanation=r.message,c="not_refined",yield[n,void 0];"valid"===c&&(yield[void 0,e])}class Lfe{constructor(e){const{type:t,schema:r,validator:n,refiner:i,coercer:o=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=r,this.entries=a,this.coercer=o,this.validator=n?(e,t)=>Rfe(n(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>Rfe(i(e,t),t,this,e):()=>[]}assert(e,t){return Ufe(e,this,t)}create(e,t){return jfe(e,this,t)}is(e){return zfe(e,this)}mask(e,t){return Dfe(e,this,t)}validate(e,t={}){return $fe(e,this,t)}}function Ufe(e,t,r){const n=$fe(e,t,{message:r});if(n[0])throw n[0]}function jfe(e,t,r){const n=$fe(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Dfe(e,t,r){const n=$fe(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function zfe(e,t){return!$fe(e,t)[0]}function $fe(e,t,r={}){const n=Ffe(e,t,r),i=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);if(i[0]){const e=new Ofe(i[0],(function*(){for(const e of n)e[0]&&(yield e[0])}));return[e,void 0]}return[void 0,i[1]]}function Hfe(e,t){return new Lfe({type:e,schema:null,validator:t})}function Gfe(){return Hfe("never",(()=>!1))}function qfe(e){const t=e?Object.keys(e):[],r=Gfe();return new Lfe({type:"object",schema:e||null,*entries(n){if(e&&Mfe(n)){const i=new Set(Object.keys(n));for(const r of t)i.delete(r),yield[r,n[r],e[r]];for(const e of i)yield[e,n[e],r]}},validator:e=>Mfe(e)||`Expected an object, but received: ${Bfe(e)}`,coercer:e=>Mfe(e)?{...e}:e})}function Kfe(e){return new Lfe({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function Vfe(){return Hfe("string",(e=>"string"==typeof e||`Expected a string, but received: ${Bfe(e)}`))}function Wfe(e){const t=Object.keys(e);return new Lfe({type:"type",schema:e,*entries(r){if(Mfe(r))for(const n of t)yield[n,r[n],e[n]]},validator:e=>Mfe(e)||`Expected an object, but received: ${Bfe(e)}`,coercer:e=>Mfe(e)?{...e}:e})}function Jfe(){return Hfe("unknown",(()=>!0))}function Zfe(e,t,r){return new Lfe({...e,coercer:(n,i)=>zfe(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function Yfe(e){return e instanceof Map||e instanceof Set?e.size:e.length}function Xfe(e,t,r){return new Lfe({...e,*refiner(n,i){yield*e.refiner(n,i);const o=Rfe(r(n,i),i,e,n);for(const e of o)yield{...e,refinement:t}}})}var Qfe=Object.freeze({__proto__:null,Struct:Lfe,StructError:Ofe,any:function(){return Hfe("any",(()=>!0))},array:function(e){return new Lfe({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${Bfe(e)}`})},assert:Ufe,assign:function(...e){const t="type"===e[0].type,r=e.map((e=>e.schema)),n=Object.assign({},...r);return t?Wfe(n):qfe(n)},bigint:function(){return Hfe("bigint",(e=>"bigint"==typeof e))},boolean:function(){return Hfe("boolean",(e=>"boolean"==typeof e))},coerce:Zfe,create:jfe,date:function(){return Hfe("date",(e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${Bfe(e)}`))},defaulted:function(e,t,r={}){return Zfe(e,Jfe(),(e=>{const n="function"==typeof t?t():t;if(void 0===e)return n;if(!r.strict&&Cfe(e)&&Cfe(n)){const t={...e};let r=!1;for(const e in n)void 0===t[e]&&(t[e]=n[e],r=!0);if(r)return t}return e}))},define:Hfe,deprecated:function(e,t){return new Lfe({...e,refiner:(t,r)=>void 0===t||e.refiner(t,r),validator:(r,n)=>void 0===r||(t(r,n),e.validator(r,n))})},dynamic:function(e){return new Lfe({type:"dynamic",schema:null,*entries(t,r){const n=e(t,r);yield*n.entries(t,r)},validator:(t,r)=>e(t,r).validator(t,r),coercer:(t,r)=>e(t,r).coercer(t,r),refiner:(t,r)=>e(t,r).refiner(t,r)})},empty:function(e){return Xfe(e,"empty",(t=>{const r=Yfe(t);return 0===r||`Expected an empty ${e.type} but received one with a size of \`${r}\``}))},enums:function(e){const t={},r=e.map((e=>Bfe(e))).join();for(const r of e)t[r]=r;return new Lfe({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${r}\`, but received: ${Bfe(t)}`})},func:function(){return Hfe("func",(e=>"function"==typeof e||`Expected a function, but received: ${Bfe(e)}`))},instance:function(e){return Hfe("instance",(t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Bfe(t)}`))},integer:function(){return Hfe("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Bfe(e)}`))},intersection:function(e){return new Lfe({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})},is:zfe,lazy:function(e){let t;return new Lfe({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator:(r,n)=>(t??(t=e()),t.validator(r,n)),coercer:(r,n)=>(t??(t=e()),t.coercer(r,n)),refiner:(r,n)=>(t??(t=e()),t.refiner(r,n))})},literal:function(e){const t=Bfe(e),r=typeof e;return new Lfe({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${Bfe(r)}`})},map:function(e,t){return new Lfe({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||`Expected a \`Map\` object, but received: ${Bfe(e)}`})},mask:Dfe,max:function(e,t,r={}){const{exclusive:n}=r;return Xfe(e,"max",(r=>n?rn?r>t:r>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${r}\``))},never:Gfe,nonempty:function(e){return Xfe(e,"nonempty",(t=>Yfe(t)>0||`Expected a nonempty ${e.type} but received an empty one`))},nullable:function(e){return new Lfe({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})},number:function(){return Hfe("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${Bfe(e)}`))},object:qfe,omit:function(e,t){const{schema:r}=e,n={...r};for(const e of t)delete n[e];return"type"===e.type?Wfe(n):qfe(n)},optional:Kfe,partial:function(e){const t=e instanceof Lfe,r=t?{...e.schema}:{...e};for(const e in r)r[e]=Kfe(r[e]);return t&&"type"===e.type?Wfe(r):qfe(r)},pattern:function(e,t){return Xfe(e,"pattern",(r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`))},pick:function(e,t){const{schema:r}=e,n={};for(const e of t)n[e]=r[e];return"type"===e.type?Wfe(n):qfe(n)},record:function(e,t){return new Lfe({type:"record",schema:null,*entries(r){if(Mfe(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>Mfe(e)||`Expected an object, but received: ${Bfe(e)}`})},refine:Xfe,regexp:function(){return Hfe("regexp",(e=>e instanceof RegExp))},set:function(e){return new Lfe({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||`Expected a \`Set\` object, but received: ${Bfe(e)}`})},size:function(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return Xfe(e,"size",(e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=r||`${n} ${i} but received \`${e}\``;if(e instanceof Map||e instanceof Set){const{size:o}=e;return t<=o&&o<=r||`${n} with a size ${i} but received one with a size of \`${o}\``}{const{length:o}=e;return t<=o&&o<=r||`${n} with a length ${i} but received one with a length of \`${o}\``}}))},string:Vfe,struct:function(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),Hfe(e,t)},trimmed:function(e){return Zfe(e,Vfe(),(e=>e.trim()))},tuple:function(e){const t=Gfe();return new Lfe({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;iArray.isArray(e)||`Expected an array, but received: ${Bfe(e)}`})},type:Wfe,union:function(e){const t=e.map((e=>e.type)).join(" | ");return new Lfe({type:"union",schema:null,coercer(t){for(const r of e){const[e,n]=r.validate(t,{coerce:!0});if(!e)return n}return t},validator(r,n){const i=[];for(const t of e){const[...e]=Ffe(r,t,n),[o]=e;if(!o[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Bfe(r)}`,...i]}})},unknown:Jfe,validate:$fe}),ede=s(Qfe),tde={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.number=e.getBigInt=e.assertNumberLength=e.getLength=e.isSigned=void 0;const t=bse,r=pfe,n=wfe,i=/^u?int(?[0-9]*)?$/u;e.isSigned=e=>!e.startsWith("u");e.getLength=e=>{if("int"===e||"uint"===e)return 256;const n=e.match(i);(0,t.assert)(n?.groups?.length,new r.ParserError(`Invalid number type. Expected a number type, but received "${e}".`));const o=parseInt(n.groups.length,10);return(0,t.assert)(o>=8&&o<=256,new r.ParserError(`Invalid number length. Expected a number between 8 and 256, but received "${e}".`)),(0,t.assert)(o%8==0,new r.ParserError(`Invalid number length. Expected a multiple of 8, but received "${e}".`)),o};e.assertNumberLength=(n,i)=>{const o=(0,e.getLength)(i),a=BigInt(2)**BigInt(o-((0,e.isSigned)(i)?1:0))-BigInt(1);(0,e.isSigned)(i)?(0,t.assert)(n>=-(a+BigInt(1))&&n<=a,new r.ParserError(`Number "${n}" is out of range for type "${i}".`)):(0,t.assert)(n<=a,new r.ParserError(`Number "${n}" is out of range for type "${i}".`))};e.getBigInt=e=>{try{return(0,t.createBigInt)(e)}catch{throw new r.ParserError(`Invalid number. Expected a valid number value, but received "${e}".`)}},e.number={isDynamic:!1,isType:e=>i.test(e),getByteLength:()=>32,encode({type:r,buffer:i,value:o,packed:a}){const s=(0,e.getBigInt)(o);if((0,e.assertNumberLength)(s,r),(0,e.isSigned)(r)){if(a){const n=(0,e.getLength)(r)/8;return(0,t.concatBytes)([i,(0,t.signedBigIntToBytes)(s,n)])}return(0,t.concatBytes)([i,(0,n.padStart)((0,t.signedBigIntToBytes)(s,32))])}if(a){const o=(0,e.getLength)(r)/8;return(0,t.concatBytes)([i,(0,n.padStart)((0,t.bigIntToBytes)(s),o)])}return(0,t.concatBytes)([i,(0,n.padStart)((0,t.bigIntToBytes)(s))])},decode({type:r,value:n}){const i=n.subarray(0,32);if((0,e.isSigned)(r)){const n=(0,t.bytesToSignedBigInt)(i);return(0,e.assertNumberLength)(n,r),n}const o=(0,t.bytesToBigInt)(i);return(0,e.assertNumberLength)(o,r),o}}}(tde),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bool=e.getBooleanValue=void 0;const t=bse,r=ede,n=pfe,i=tde,o=(0,r.coerce)((0,r.boolean)(),(0,r.union)([(0,r.literal)("true"),(0,r.literal)("false")]),(e=>"true"===e));e.getBooleanValue=e=>{try{return(0,r.create)(e,o)?BigInt(1):BigInt(0)}catch{throw new n.ParserError(`Invalid boolean value. Expected a boolean literal, or the string "true" or "false", but received "${e}".`)}},e.bool={isDynamic:!1,isType:e=>"bool"===e,getByteLength:()=>32,encode({buffer:r,value:n,packed:o,tight:a}){const s=(0,e.getBooleanValue)(n);return o?(0,t.concatBytes)([r,(0,t.bigIntToBytes)(s)]):i.number.encode({type:"uint256",buffer:r,value:s,packed:o,tight:a})},decode:e=>i.number.decode({...e,type:"uint256"})===BigInt(1)}}(Tfe);var rde={};Object.defineProperty(rde,"__esModule",{value:!0}),rde.bytes=void 0;const nde=bse,ide=wfe;rde.bytes={isDynamic:!0,isType:e=>"bytes"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:r}){const n=(0,nde.createBytes)(t);if(r)return(0,nde.concatBytes)([e,n]);const i=32*Math.ceil(n.byteLength/32);return(0,nde.concatBytes)([e,(0,ide.padStart)((0,nde.numberToBytes)(n.byteLength)),(0,ide.padEnd)(n,i)])},decode({value:e}){const t=e.subarray(0,32),r=(0,nde.bytesToNumber)(t);return e.slice(32,32+r)}};var ode={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fn=e.getFunction=void 0;const t=bse,r=ede,n=pfe,i=_fe,o=(0,r.coerce)((0,r.object)({address:t.StrictHexStruct,selector:t.StrictHexStruct}),(0,r.union)([t.StrictHexStruct,(0,r.instance)(Uint8Array)]),(e=>{const r=(0,t.createBytes)(e);return(0,t.assert)(24===r.length,new n.ParserError(`Invalid Solidity function. Expected function to be 24 bytes long, but received ${r.length} bytes.`)),{address:(0,t.bytesToHex)(r.subarray(0,20)),selector:(0,t.bytesToHex)(r.subarray(20,24))}}));e.getFunction=e=>{const n=(0,r.create)(e,o);return(0,t.concatBytes)([(0,t.hexToBytes)(n.address),(0,t.hexToBytes)(n.selector)])},e.fn={isDynamic:!1,isType:e=>"function"===e,getByteLength:()=>32,encode({buffer:t,value:r,packed:n,tight:o}){const a=(0,e.getFunction)(r);return i.fixedBytes.encode({type:"bytes24",buffer:t,value:a,packed:n,tight:o})},decode:({value:e})=>({address:(0,t.bytesToHex)(e.slice(0,20)),selector:(0,t.bytesToHex)(e.slice(20,24))})}}(ode);var ade={};Object.defineProperty(ade,"__esModule",{value:!0});var sde={};Object.defineProperty(sde,"__esModule",{value:!0}),sde.string=void 0;const cde=bse,ude=rde;var lde,fde;function dde(){return lde||(lde=1,function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(vfe,e),r((Sfe||(Sfe=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.array=e.getTupleType=e.getArrayType=e.isArrayType=void 0;const t=bse,r=pfe,n=hde(),i=wfe,o=_fe,a=Ife(),s=/^(?.*)\[(?\d*?)\]$/u;e.isArrayType=e=>s.test(e),e.getArrayType=e=>{const n=e.match(s);return(0,t.assert)(n?.groups?.type,new r.ParserError(`Invalid array type. Expected an array type, but received "${e}".`)),[n.groups.type,n.groups.length?parseInt(n.groups.length,10):void 0]},e.getTupleType=(e,t)=>`(${new Array(t).fill(e).join(",")})`,e.array={isDynamic(t){const[r,i]=(0,e.getArrayType)(t);return void 0===i||(0,n.isDynamicParser)((0,n.getParser)(r),r)},isType:t=>(0,e.isArrayType)(t),getByteLength(i){(0,t.assert)((0,e.isArrayType)(i),new r.ParserError(`Expected an array type, but received "${i}".`));const[o,s]=(0,e.getArrayType)(i);return(0,n.isDynamicParser)(this,i)||void 0===s?32:a.tuple.getByteLength((0,e.getTupleType)(o,s))},encode({type:s,buffer:c,value:u,packed:l,tight:f}){const[d,h]=(0,e.getArrayType)(s);if((0,t.assert)(!l||!(0,e.isArrayType)(d),new r.ParserError("Cannot pack nested arrays.")),l&&(0,n.isDynamicParser)((0,n.getParser)(d),d))return(0,n.pack)({types:new Array(u.length).fill(d),values:u,byteArray:c,packed:l,arrayPacked:!0,tight:f});if(h)return(0,t.assert)(h===u.length,new r.ParserError(`Array length does not match type length. Expected a length of ${h}, but received ${u.length}.`)),a.tuple.encode({type:(0,e.getTupleType)(d,h),buffer:c,value:u,packed:o.fixedBytes.isType(d)&&f,tight:f});if(l)return(0,n.pack)({types:new Array(u.length).fill(d),values:u,byteArray:c,packed:o.fixedBytes.isType(d)&&f,arrayPacked:!0,tight:f});const p=(0,i.padStart)((0,t.numberToBytes)(u.length));return(0,n.pack)({types:new Array(u.length).fill(d),values:u,byteArray:(0,t.concatBytes)([c,p]),packed:l,tight:f})},decode({type:i,value:o,...s}){const[c,u]=(0,e.getArrayType)(i);if(u){const n=a.tuple.decode({type:(0,e.getTupleType)(c,u),value:o,...s});return(0,t.assert)(n.length===u,new r.ParserError(`Array length does not match type length. Expected a length of ${u}, but received ${n.length}.`)),n}const l=(0,t.bytesToNumber)(o.subarray(0,32));return(0,n.unpack)(new Array(l).fill(c),o.subarray(32))}}}(xfe)),xfe),e),r(Tfe,e),r(rde,e),r(_fe,e),r(ode,e),r(tde,e),r(ade,e),r(sde,e),r(Ife(),e)}(yfe)),yfe}function hde(){return fde||(fde=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unpack=e.pack=e.isDynamicParser=e.getParser=void 0;const t=bse,r=pfe,n=bfe,i=dde(),o=wfe;e.getParser=e=>{const t={address:i.address,array:i.array,bool:i.bool,bytes:i.bytes,fixedBytes:i.fixedBytes,function:i.fn,number:i.number,string:i.string,tuple:i.tuple},n=t[e];if(n)return n;const o=Object.values(t).find((t=>t.isType(e)));if(o)return o;throw new r.ParserError(`The type "${e}" is not supported.`)};e.isDynamicParser=(e,t)=>{const{isDynamic:r}=e;return"function"==typeof r?r(t):r};e.pack=({types:n,values:i,packed:a=!1,tight:s=!1,arrayPacked:c=!1,byteArray:u=new Uint8Array})=>{(0,t.assert)(n.length===i.length,new r.ParserError(`The number of types (${n.length}) does not match the number of values (${i.length}).`));const{staticBuffer:l,dynamicBuffer:f,pointers:d}=n.reduce((({staticBuffer:r,dynamicBuffer:n,pointers:o},u,l)=>{const f=(0,e.getParser)(u),d=i[l];if(a||c||!(0,e.isDynamicParser)(f,u))return{staticBuffer:f.encode({buffer:r,value:d,type:u,packed:a,tight:s}),dynamicBuffer:n,pointers:o};return{staticBuffer:(0,t.concatBytes)([r,new Uint8Array(32)]),dynamicBuffer:f.encode({buffer:n,value:d,type:u,packed:a,tight:s}),pointers:[...o,{position:r.length,pointer:n.length}]}}),{staticBuffer:new Uint8Array,dynamicBuffer:new Uint8Array,pointers:[]});(0,t.assert)(!a&&!c||0===f.length,new r.ParserError("Invalid pack state."));const h=l.length,p=d.reduce(((e,{pointer:r,position:n})=>{const i=(0,o.padStart)((0,t.numberToBytes)(h+r));return(0,o.set)(e,i,n)}),l);return(0,t.concatBytes)([u,p,f])};e.unpack=(i,o)=>{const a=(0,n.iterate)(o);return i.map((n=>{const{value:{value:i,skip:s},done:c}=a.next();(0,t.assert)(!c,new r.ParserError(`The encoded value is invalid for the provided types. Reached end of buffer while attempting to parse "${n}".`));const u=(0,e.getParser)(n);if((0,e.isDynamicParser)(u,n)){const e=(0,t.bytesToNumber)(i.subarray(0,32)),r=o.subarray(e);return u.decode({type:n,value:r,skip:s})}return u.decode({type:n,value:i,skip:s})}))}}(mfe)),mfe}sde.string={isDynamic:!0,isType:e=>"string"===e,getByteLength:()=>32,encode:({buffer:e,value:t,packed:r,tight:n})=>ude.bytes.encode({type:"bytes",buffer:e,value:(0,cde.stringToBytes)(t),packed:r,tight:n}),decode:e=>(0,cde.bytesToString)(ude.bytes.decode(e))},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeSingle=e.decode=e.encodePacked=e.encodeSingle=e.encode=void 0;const t=bse,r=pfe,n=hde();e.encode=(e,t,i,o)=>{try{return(0,n.pack)({types:e,values:t,packed:i,tight:o})}catch(e){if(e instanceof r.ParserError)throw new r.ParserError(`Unable to encode value: ${e.message}`,e);throw new r.ParserError(`An unexpected error occurred: ${(0,r.getErrorMessage)(e)}`,e)}};e.encodeSingle=(t,r)=>(0,e.encode)([t],[r]);e.encodePacked=(t,r,n)=>(0,e.encode)(t,r,!0,n);e.decode=(e,i)=>{const o=(0,t.createBytes)(i);try{return(0,n.unpack)(e,o)}catch(e){if(e instanceof r.ParserError)throw new r.ParserError(`Unable to decode value: ${e.message}`,e);throw new r.ParserError(`An unexpected error occurred: ${(0,r.getErrorMessage)(e)}`,e)}};e.decodeSingle=(n,i)=>{const o=(0,e.decode)([n],i);return(0,t.assert)(1===o.length,new r.ParserError("Decoded value array has unexpected length.")),o[0]}}(hfe);var pde={},mde={};Object.defineProperty(mde,"__esModule",{value:!0}),function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(mde,e)}(pde),function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(hfe,e),r(pfe,e),r(pde,e)}(dfe),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.recoverTypedSignature=e.signTypedData=e.typedSignatureHash=e.TypedDataUtils=e.TYPED_MESSAGE_SCHEMA=e.SignTypedDataVersion=void 0;const t=y4,r=dfe,n=dde(),i=wfe,o=bse,a=p7,s=mse;var c;function u(e,t){if(!Object.keys(c).includes(e))throw new Error(`Invalid version: '${e}'`);if(t&&!t.includes(e))throw new Error(`SignTypedDataVersion not allowed: '${e}'. Allowed versions are: ${t.join(", ")}`)}function l(e,t){(0,o.assert)(null!==t,`Unable to encode value: Invalid number. Expected a valid number value, but received "${t}".`);const r=BigInt(t),i=(0,n.getLength)(e),a=BigInt(2)**BigInt(i)-BigInt(1);return(0,o.assert)(r>=-a&&r<=a,`Unable to encode value: Number "${t}" is out of range for type "${e}".`),r}function f(e){let t=BigInt(0);for(let r=0;r=49?n-BigInt(49)+BigInt(10):n>=17?n-BigInt(17)+BigInt(10):n}return(0,i.padStart)((0,o.bigIntToBytes)(t),20)}function d(e,n,s,p,m){if(u(m,[c.V3,c.V4]),void 0!==e[s])return["bytes32",m===c.V4&&null==p?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,t.arrToBufArr)((0,a.keccak256)(h(s,p,e,m)))];if("function"===s)throw new Error('Unsupported or invalid type: "function"');if(void 0===p)throw new Error(`missing value for field ${n} of type ${s}`);if("address"===s){if("number"==typeof p)return["address",(0,i.padStart)((0,o.numberToBytes)(p),20)];if((0,o.isStrictHexString)(p))return["address",(0,o.add0x)(p)];if("string"==typeof p)return["address",f(p).subarray(0,20)]}if("bool"===s)return["bool",Boolean(p)];if("bytes"===s)return"number"==typeof p?p=(0,o.numberToBytes)(p):(0,o.isStrictHexString)(p)||"0x"===p?p=(0,o.hexToBytes)(p):"string"==typeof p&&(p=(0,o.stringToBytes)(p)),["bytes32",(0,t.arrToBufArr)((0,a.keccak256)(p))];if(s.startsWith("bytes")&&"bytes"!==s&&!s.includes("["))return"number"==typeof p?p<0?["bytes32",new Uint8Array(32)]:["bytes32",(0,o.bigIntToBytes)(BigInt(p))]:(0,o.isStrictHexString)(p)?["bytes32",(0,o.hexToBytes)(p)]:["bytes32",p];if(s.startsWith("int")&&!s.includes("[")){const e=l(s,p);return e>=BigInt(0)?["uint256",e]:["int256",e]}if("string"===s)return p="number"==typeof p?(0,o.numberToBytes)(p):(0,o.stringToBytes)(null!=p?p:""),["bytes32",(0,t.arrToBufArr)((0,a.keccak256)(p))];if(s.endsWith("]")){if(m===c.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const i=s.slice(0,s.lastIndexOf("[")),o=p.map((t=>d(e,n,i,t,m)));return["bytes32",(0,t.arrToBufArr)((0,a.keccak256)((0,r.encode)(o.map((([e])=>e)),o.map((([,e])=>e)))))]}return[s,p]}function h(e,n,i,o){u(o,[c.V3,c.V4]);const a=["bytes32"],s=[g(e,i)];for(const t of i[e]){if(o===c.V3&&void 0===n[t.name])continue;const[e,r]=d(i,t.name,t.type,n[t.name],o);a.push(e),s.push(r)}return(0,t.arrToBufArr)((0,r.encode)(a,s))}function p(e,t){let r="";const n=m(e,t);n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i){if(!t[e])throw new Error(`No type definition specified: ${e}`);r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`}return r}function m(e,t,r=new Set){if("string"!=typeof e)throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(e)}`);const n=e.match(/^\w*/u);if([e]=n,r.has(e)||void 0===t[e])return r;r.add(e);for(const n of t[e])m(n.type,t,r);return r}function b(e,r,n,i){u(i,[c.V3,c.V4]);const o=h(e,r,n,i),s=(0,a.keccak256)(o);return(0,t.arrToBufArr)(s)}function g(e,r){const n=(0,o.stringToBytes)(p(e,r));return(0,t.arrToBufArr)((0,a.keccak256)(n))}function y(t){const r={};for(const n in e.TYPED_MESSAGE_SCHEMA.properties)t[n]&&(r[n]=t[n]);return"types"in r&&(r.types=Object.assign({EIP712Domain:[]},r.types)),r}function v(e,t){u(t,[c.V3,c.V4]);const r=y(e),{domain:n}=r;return b("EIP712Domain",n,{EIP712Domain:r.types.EIP712Domain},t)}function w(e,t){if((0,n.isArrayType)(e)&&Array.isArray(t)){const[r]=(0,n.getArrayType)(e);return t.map((e=>w(r,e)))}if("address"===e){if("number"==typeof t)return(0,i.padStart)((0,o.numberToBytes)(t),20);if((0,o.isStrictHexString)(t))return(0,i.padStart)((0,o.hexToBytes)(t).subarray(0,20),20);if(t instanceof Uint8Array)return(0,i.padStart)(t.subarray(0,20),20)}if("bool"===e)return Boolean(t);if(e.startsWith("bytes")&&"bytes"!==e){const r=(0,n.getByteLength)(e);if("number"==typeof t)return t<0?new Uint8Array:(0,o.numberToBytes)(t).subarray(0,r);if((0,o.isStrictHexString)(t))return(0,o.hexToBytes)(t).subarray(0,r);if(t instanceof Uint8Array)return t.subarray(0,r)}if(e.startsWith("uint")&&"number"==typeof t)return Math.abs(t);if(e.startsWith("int")&&"number"==typeof t){const r=(0,n.getLength)(e);return BigInt.asIntN(r,BigInt(t))}return t}function E(e,t){return t.map((t=>{if("string"==typeof t||"number"==typeof t||"bigint"==typeof t){const r=l(e,t);if(r>=BigInt(0))return(0,i.padStart)((0,o.bigIntToBytes)(r),32);const a=(0,n.getLength)(e),s=BigInt.asIntN(a,r);return(0,o.signedBigIntToBytes)(s,32)}return t}))}function A(e){const c=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!("length"in e)||!e.length)throw c;const u=e.map((({name:e,type:t,value:r})=>{if("address[]"===t)return{name:e,type:"bytes32[]",value:(a=r,a.map((e=>"number"==typeof e?(0,i.padStart)((0,o.numberToBytes)(e),32):(0,o.isStrictHexString)(e)?(0,i.padStart)((0,o.hexToBytes)(e).subarray(0,32),32):e instanceof Uint8Array?(0,i.padStart)(e.subarray(0,32),32):e)))};var a;if(t.startsWith("int")&&(0,n.isArrayType)(t)){const[i,o]=(0,n.getArrayType)(t);return{name:e,type:`bytes32[${null!=o?o:""}]`,value:E(i,r)}}return{name:e,type:t,value:w(t,r)}})),l=u.map((e=>"bytes"!==e.type?e.value:(0,s.legacyToBuffer)(e.value))),f=u.map((e=>{if("function"===e.type)throw new Error('Unsupported or invalid type: "function"');return e.type})),d=e.map((e=>{if(!e.name)throw c;return`${e.type} ${e.name}`}));return(0,t.arrToBufArr)((0,a.keccak256)((0,r.encodePacked)(["bytes32","bytes32"],[(0,a.keccak256)((0,r.encodePacked)(["string[]"],[d],!0)),(0,a.keccak256)((0,r.encodePacked)(f,l,!0))])))}!function(e){e.V1="V1",e.V3="V3",e.V4="V4"}(c=e.SignTypedDataVersion||(e.SignTypedDataVersion={})),e.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},e.TypedDataUtils={encodeData:h,encodeType:p,findTypeDependencies:m,hashStruct:b,hashType:g,sanitizeData:y,eip712Hash:function(e,r){u(r,[c.V3,c.V4]);const n=y(e),i=[(0,o.hexToBytes)("1901")];return i.push(v(e,r)),"EIP712Domain"!==n.primaryType&&i.push(b(n.primaryType,n.message,n.types,r)),(0,t.arrToBufArr)((0,a.keccak256)((0,o.concatBytes)(i)))},eip712DomainHash:v},e.typedSignatureHash=function(e){const t=A(e);return(0,o.bytesToHex)(t)},e.signTypedData=function({privateKey:r,data:n,version:i}){if(u(i),(0,s.isNullish)(n))throw new Error("Missing data parameter");if((0,s.isNullish)(r))throw new Error("Missing private key parameter");const a=i===c.V1?A(n):e.TypedDataUtils.eip712Hash(n,i),l=(0,t.ecsign)(a,r);return(0,s.concatSig)((0,t.arrToBufArr)((0,o.bigIntToBytes)(l.v)),l.r,l.s)},e.recoverTypedSignature=function({data:r,signature:n,version:i}){if(u(i),(0,s.isNullish)(r))throw new Error("Missing data parameter");if((0,s.isNullish)(n))throw new Error("Missing signature parameter");const a=i===c.V1?A(r):e.TypedDataUtils.eip712Hash(r,i),l=(0,s.recoverPublicKey)(a,n),f=(0,t.publicToAddress)(l);return(0,o.bytesToHex)(f)}}(ffe);var bde={},gde={exports:{}};!function(e){!function(e){var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function p(e,t,r,n,i){var o,a=0;for(o=0;o>>8)-1}function m(e,t,r,n){return p(e,t,r,n,16)}function b(e,t,r,n){return p(e,t,r,n,32)}function g(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,d=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,b=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,E=o,A=a,x=s,_=c,k=u,S=l,P=f,I=d,T=h,O=p,M=m,C=b,B=g,N=y,R=v,F=w,L=0;L<20;L+=2)E^=(i=(B^=(i=(T^=(i=(k^=(i=E+B|0)<<7|i>>>25)+E|0)<<9|i>>>23)+k|0)<<13|i>>>19)+T|0)<<18|i>>>14,S^=(i=(A^=(i=(N^=(i=(O^=(i=S+A|0)<<7|i>>>25)+S|0)<<9|i>>>23)+O|0)<<13|i>>>19)+N|0)<<18|i>>>14,M^=(i=(P^=(i=(x^=(i=(R^=(i=M+P|0)<<7|i>>>25)+M|0)<<9|i>>>23)+R|0)<<13|i>>>19)+x|0)<<18|i>>>14,F^=(i=(C^=(i=(I^=(i=(_^=(i=F+C|0)<<7|i>>>25)+F|0)<<9|i>>>23)+_|0)<<13|i>>>19)+I|0)<<18|i>>>14,E^=(i=(_^=(i=(x^=(i=(A^=(i=E+_|0)<<7|i>>>25)+E|0)<<9|i>>>23)+A|0)<<13|i>>>19)+x|0)<<18|i>>>14,S^=(i=(k^=(i=(I^=(i=(P^=(i=S+k|0)<<7|i>>>25)+S|0)<<9|i>>>23)+P|0)<<13|i>>>19)+I|0)<<18|i>>>14,M^=(i=(O^=(i=(T^=(i=(C^=(i=M+O|0)<<7|i>>>25)+M|0)<<9|i>>>23)+C|0)<<13|i>>>19)+T|0)<<18|i>>>14,F^=(i=(R^=(i=(N^=(i=(B^=(i=F+R|0)<<7|i>>>25)+F|0)<<9|i>>>23)+B|0)<<13|i>>>19)+N|0)<<18|i>>>14;E=E+o|0,A=A+a|0,x=x+s|0,_=_+c|0,k=k+u|0,S=S+l|0,P=P+f|0,I=I+d|0,T=T+h|0,O=O+p|0,M=M+m|0,C=C+b|0,B=B+g|0,N=N+y|0,R=R+v|0,F=F+w|0,e[0]=E>>>0&255,e[1]=E>>>8&255,e[2]=E>>>16&255,e[3]=E>>>24&255,e[4]=A>>>0&255,e[5]=A>>>8&255,e[6]=A>>>16&255,e[7]=A>>>24&255,e[8]=x>>>0&255,e[9]=x>>>8&255,e[10]=x>>>16&255,e[11]=x>>>24&255,e[12]=_>>>0&255,e[13]=_>>>8&255,e[14]=_>>>16&255,e[15]=_>>>24&255,e[16]=k>>>0&255,e[17]=k>>>8&255,e[18]=k>>>16&255,e[19]=k>>>24&255,e[20]=S>>>0&255,e[21]=S>>>8&255,e[22]=S>>>16&255,e[23]=S>>>24&255,e[24]=P>>>0&255,e[25]=P>>>8&255,e[26]=P>>>16&255,e[27]=P>>>24&255,e[28]=I>>>0&255,e[29]=I>>>8&255,e[30]=I>>>16&255,e[31]=I>>>24&255,e[32]=T>>>0&255,e[33]=T>>>8&255,e[34]=T>>>16&255,e[35]=T>>>24&255,e[36]=O>>>0&255,e[37]=O>>>8&255,e[38]=O>>>16&255,e[39]=O>>>24&255,e[40]=M>>>0&255,e[41]=M>>>8&255,e[42]=M>>>16&255,e[43]=M>>>24&255,e[44]=C>>>0&255,e[45]=C>>>8&255,e[46]=C>>>16&255,e[47]=C>>>24&255,e[48]=B>>>0&255,e[49]=B>>>8&255,e[50]=B>>>16&255,e[51]=B>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=R>>>0&255,e[57]=R>>>8&255,e[58]=R>>>16&255,e[59]=R>>>24&255,e[60]=F>>>0&255,e[61]=F>>>8&255,e[62]=F>>>16&255,e[63]=F>>>24&255}(e,t,r,n)}function y(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,l=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,d=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,h=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,m=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,b=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,g=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,y=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,v=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,w=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,E=0;E<20;E+=2)o^=(i=(g^=(i=(h^=(i=(u^=(i=o+g|0)<<7|i>>>25)+o|0)<<9|i>>>23)+u|0)<<13|i>>>19)+h|0)<<18|i>>>14,l^=(i=(a^=(i=(y^=(i=(p^=(i=l+a|0)<<7|i>>>25)+l|0)<<9|i>>>23)+p|0)<<13|i>>>19)+y|0)<<18|i>>>14,m^=(i=(f^=(i=(s^=(i=(v^=(i=m+f|0)<<7|i>>>25)+m|0)<<9|i>>>23)+v|0)<<13|i>>>19)+s|0)<<18|i>>>14,w^=(i=(b^=(i=(d^=(i=(c^=(i=w+b|0)<<7|i>>>25)+w|0)<<9|i>>>23)+c|0)<<13|i>>>19)+d|0)<<18|i>>>14,o^=(i=(c^=(i=(s^=(i=(a^=(i=o+c|0)<<7|i>>>25)+o|0)<<9|i>>>23)+a|0)<<13|i>>>19)+s|0)<<18|i>>>14,l^=(i=(u^=(i=(d^=(i=(f^=(i=l+u|0)<<7|i>>>25)+l|0)<<9|i>>>23)+f|0)<<13|i>>>19)+d|0)<<18|i>>>14,m^=(i=(p^=(i=(h^=(i=(b^=(i=m+p|0)<<7|i>>>25)+m|0)<<9|i>>>23)+b|0)<<13|i>>>19)+h|0)<<18|i>>>14,w^=(i=(v^=(i=(y^=(i=(g^=(i=w+v|0)<<7|i>>>25)+w|0)<<9|i>>>23)+g|0)<<13|i>>>19)+y|0)<<18|i>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=l>>>0&255,e[5]=l>>>8&255,e[6]=l>>>16&255,e[7]=l>>>24&255,e[8]=m>>>0&255,e[9]=m>>>8&255,e[10]=m>>>16&255,e[11]=m>>>24&255,e[12]=w>>>0&255,e[13]=w>>>8&255,e[14]=w>>>16&255,e[15]=w>>>24&255,e[16]=f>>>0&255,e[17]=f>>>8&255,e[18]=f>>>16&255,e[19]=f>>>24&255,e[20]=d>>>0&255,e[21]=d>>>8&255,e[22]=d>>>16&255,e[23]=d>>>24&255,e[24]=h>>>0&255,e[25]=h>>>8&255,e[26]=h>>>16&255,e[27]=h>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,t,r,n)}var v=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(e,t,r,n,i,o,a){var s,c,u=new Uint8Array(16),l=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=o[c];for(;i>=64;){for(g(l,u,a,v),c=0;c<64;c++)e[t+c]=r[n+c]^l[c];for(s=1,c=8;c<16;c++)s=s+(255&u[c])|0,u[c]=255&s,s>>>=8;i-=64,t+=64,n+=64}if(i>0)for(g(l,u,a,v),c=0;c=64;){for(g(c,s,i,v),a=0;a<64;a++)e[t+a]=c[a];for(o=1,a=8;a<16;a++)o=o+(255&s[a])|0,s[a]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(g(c,s,i,v),a=0;a>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|a<<2),s=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|s<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(s>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function k(e,t,r,n,i,o){var a=new _(o);return a.update(r,n,i),a.finish(e,t),0}function S(e,t,r,n,i,o){var a=new Uint8Array(16);return k(a,0,r,n,i,o),m(e,t,a,0)}function P(e,t,r,n,i){var o;if(r<32)return-1;for(x(e,0,t,0,r,n,i),k(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function I(e,t,r,n,i){var o,a=new Uint8Array(32);if(r<32)return-1;if(A(a,0,32,n,i),0!==S(t,16,t,32,r-32,a))return-1;for(x(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function O(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function M(e,t,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function C(e,r){var n,i,o,a=t(),s=t();for(n=0;n<16;n++)s[n]=r[n];for(O(s),O(s),O(s),i=0;i<2;i++){for(a[0]=s[0]-65517,n=1;n<15;n++)a[n]=s[n]-65535-(a[n-1]>>16&1),a[n-1]&=65535;a[15]=s[15]-32767-(a[14]>>16&1),o=a[15]>>16&1,a[14]&=65535,M(s,a,1-o)}for(n=0;n<16;n++)e[2*n]=255&s[n],e[2*n+1]=s[n]>>8}function B(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return C(r,e),C(n,t),b(r,0,n,0)}function N(e){var t=new Uint8Array(32);return C(t,e),1&t[0]}function R(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function F(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function L(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function U(e,t,r){var n,i,o=0,a=0,s=0,c=0,u=0,l=0,f=0,d=0,h=0,p=0,m=0,b=0,g=0,y=0,v=0,w=0,E=0,A=0,x=0,_=0,k=0,S=0,P=0,I=0,T=0,O=0,M=0,C=0,B=0,N=0,R=0,F=r[0],L=r[1],U=r[2],j=r[3],D=r[4],z=r[5],$=r[6],H=r[7],G=r[8],q=r[9],K=r[10],V=r[11],W=r[12],J=r[13],Z=r[14],Y=r[15];o+=(n=t[0])*F,a+=n*L,s+=n*U,c+=n*j,u+=n*D,l+=n*z,f+=n*$,d+=n*H,h+=n*G,p+=n*q,m+=n*K,b+=n*V,g+=n*W,y+=n*J,v+=n*Z,w+=n*Y,a+=(n=t[1])*F,s+=n*L,c+=n*U,u+=n*j,l+=n*D,f+=n*z,d+=n*$,h+=n*H,p+=n*G,m+=n*q,b+=n*K,g+=n*V,y+=n*W,v+=n*J,w+=n*Z,E+=n*Y,s+=(n=t[2])*F,c+=n*L,u+=n*U,l+=n*j,f+=n*D,d+=n*z,h+=n*$,p+=n*H,m+=n*G,b+=n*q,g+=n*K,y+=n*V,v+=n*W,w+=n*J,E+=n*Z,A+=n*Y,c+=(n=t[3])*F,u+=n*L,l+=n*U,f+=n*j,d+=n*D,h+=n*z,p+=n*$,m+=n*H,b+=n*G,g+=n*q,y+=n*K,v+=n*V,w+=n*W,E+=n*J,A+=n*Z,x+=n*Y,u+=(n=t[4])*F,l+=n*L,f+=n*U,d+=n*j,h+=n*D,p+=n*z,m+=n*$,b+=n*H,g+=n*G,y+=n*q,v+=n*K,w+=n*V,E+=n*W,A+=n*J,x+=n*Z,_+=n*Y,l+=(n=t[5])*F,f+=n*L,d+=n*U,h+=n*j,p+=n*D,m+=n*z,b+=n*$,g+=n*H,y+=n*G,v+=n*q,w+=n*K,E+=n*V,A+=n*W,x+=n*J,_+=n*Z,k+=n*Y,f+=(n=t[6])*F,d+=n*L,h+=n*U,p+=n*j,m+=n*D,b+=n*z,g+=n*$,y+=n*H,v+=n*G,w+=n*q,E+=n*K,A+=n*V,x+=n*W,_+=n*J,k+=n*Z,S+=n*Y,d+=(n=t[7])*F,h+=n*L,p+=n*U,m+=n*j,b+=n*D,g+=n*z,y+=n*$,v+=n*H,w+=n*G,E+=n*q,A+=n*K,x+=n*V,_+=n*W,k+=n*J,S+=n*Z,P+=n*Y,h+=(n=t[8])*F,p+=n*L,m+=n*U,b+=n*j,g+=n*D,y+=n*z,v+=n*$,w+=n*H,E+=n*G,A+=n*q,x+=n*K,_+=n*V,k+=n*W,S+=n*J,P+=n*Z,I+=n*Y,p+=(n=t[9])*F,m+=n*L,b+=n*U,g+=n*j,y+=n*D,v+=n*z,w+=n*$,E+=n*H,A+=n*G,x+=n*q,_+=n*K,k+=n*V,S+=n*W,P+=n*J,I+=n*Z,T+=n*Y,m+=(n=t[10])*F,b+=n*L,g+=n*U,y+=n*j,v+=n*D,w+=n*z,E+=n*$,A+=n*H,x+=n*G,_+=n*q,k+=n*K,S+=n*V,P+=n*W,I+=n*J,T+=n*Z,O+=n*Y,b+=(n=t[11])*F,g+=n*L,y+=n*U,v+=n*j,w+=n*D,E+=n*z,A+=n*$,x+=n*H,_+=n*G,k+=n*q,S+=n*K,P+=n*V,I+=n*W,T+=n*J,O+=n*Z,M+=n*Y,g+=(n=t[12])*F,y+=n*L,v+=n*U,w+=n*j,E+=n*D,A+=n*z,x+=n*$,_+=n*H,k+=n*G,S+=n*q,P+=n*K,I+=n*V,T+=n*W,O+=n*J,M+=n*Z,C+=n*Y,y+=(n=t[13])*F,v+=n*L,w+=n*U,E+=n*j,A+=n*D,x+=n*z,_+=n*$,k+=n*H,S+=n*G,P+=n*q,I+=n*K,T+=n*V,O+=n*W,M+=n*J,C+=n*Z,B+=n*Y,v+=(n=t[14])*F,w+=n*L,E+=n*U,A+=n*j,x+=n*D,_+=n*z,k+=n*$,S+=n*H,P+=n*G,I+=n*q,T+=n*K,O+=n*V,M+=n*W,C+=n*J,B+=n*Z,N+=n*Y,w+=(n=t[15])*F,a+=38*(A+=n*U),s+=38*(x+=n*j),c+=38*(_+=n*D),u+=38*(k+=n*z),l+=38*(S+=n*$),f+=38*(P+=n*H),d+=38*(I+=n*G),h+=38*(T+=n*q),p+=38*(O+=n*K),m+=38*(M+=n*V),b+=38*(C+=n*W),g+=38*(B+=n*J),y+=38*(N+=n*Z),v+=38*(R+=n*Y),o=(n=(o+=38*(E+=n*L))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),e[0]=o,e[1]=a,e[2]=s,e[3]=c,e[4]=u,e[5]=l,e[6]=f,e[7]=d,e[8]=h,e[9]=p,e[10]=m,e[11]=b,e[12]=g,e[13]=y,e[14]=v,e[15]=w}function j(e,t){U(e,t,t)}function D(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)j(i,i),2!==n&&4!==n&&U(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function z(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)j(i,i),1!==n&&U(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function $(e,r,n){var i,o,a=new Uint8Array(32),c=new Float64Array(80),u=t(),l=t(),f=t(),d=t(),h=t(),p=t();for(o=0;o<31;o++)a[o]=r[o];for(a[31]=127&r[31]|64,a[0]&=248,R(c,n),o=0;o<16;o++)l[o]=c[o],d[o]=u[o]=f[o]=0;for(u[0]=d[0]=1,o=254;o>=0;--o)M(u,l,i=a[o>>>3]>>>(7&o)&1),M(f,d,i),F(h,u,f),L(u,u,f),F(f,l,d),L(l,l,d),j(d,h),j(p,u),U(u,f,u),U(f,l,h),F(h,u,f),L(u,u,f),j(l,u),L(f,d,p),U(u,f,s),F(u,u,d),U(f,f,u),U(u,d,p),U(d,l,c),j(l,h),M(u,l,i),M(f,d,i);for(o=0;o<16;o++)c[o+16]=u[o],c[o+32]=f[o],c[o+48]=l[o],c[o+64]=d[o];var m=c.subarray(32),b=c.subarray(16);return D(m,m),U(b,b,m),C(e,b),0}function H(e,t){return $(e,t,i)}function G(e,t){return r(t,32),H(e,t)}function q(e,t,r){var i=new Uint8Array(32);return $(i,r,t),y(e,n,i,v)}_.prototype.blocks=function(e,t,r){for(var n,i,o,a,s,c,u,l,f,d,h,p,m,b,g,y,v,w,E,A=this.fin?0:2048,x=this.h[0],_=this.h[1],k=this.h[2],S=this.h[3],P=this.h[4],I=this.h[5],T=this.h[6],O=this.h[7],M=this.h[8],C=this.h[9],B=this.r[0],N=this.r[1],R=this.r[2],F=this.r[3],L=this.r[4],U=this.r[5],j=this.r[6],D=this.r[7],z=this.r[8],$=this.r[9];r>=16;)d=f=0,d+=(x+=8191&(n=255&e[t+0]|(255&e[t+1])<<8))*B,d+=(_+=8191&(n>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*$),d+=(k+=8191&(i>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*z),d+=(S+=8191&(o>>>7|(a=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*D),f=(d+=(P+=8191&(a>>>4|(s=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*j))>>>13,d&=8191,d+=(I+=s>>>1&8191)*(5*U),d+=(T+=8191&(s>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*L),d+=(O+=8191&(c>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*F),d+=(M+=8191&(u>>>8|(l=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*R),h=f+=(d+=(C+=l>>>5|A)*(5*N))>>>13,h+=x*N,h+=_*B,h+=k*(5*$),h+=S*(5*z),f=(h+=P*(5*D))>>>13,h&=8191,h+=I*(5*j),h+=T*(5*U),h+=O*(5*L),h+=M*(5*F),f+=(h+=C*(5*R))>>>13,h&=8191,p=f,p+=x*R,p+=_*N,p+=k*B,p+=S*(5*$),f=(p+=P*(5*z))>>>13,p&=8191,p+=I*(5*D),p+=T*(5*j),p+=O*(5*U),p+=M*(5*L),m=f+=(p+=C*(5*F))>>>13,m+=x*F,m+=_*R,m+=k*N,m+=S*B,f=(m+=P*(5*$))>>>13,m&=8191,m+=I*(5*z),m+=T*(5*D),m+=O*(5*j),m+=M*(5*U),b=f+=(m+=C*(5*L))>>>13,b+=x*L,b+=_*F,b+=k*R,b+=S*N,f=(b+=P*B)>>>13,b&=8191,b+=I*(5*$),b+=T*(5*z),b+=O*(5*D),b+=M*(5*j),g=f+=(b+=C*(5*U))>>>13,g+=x*U,g+=_*L,g+=k*F,g+=S*R,f=(g+=P*N)>>>13,g&=8191,g+=I*B,g+=T*(5*$),g+=O*(5*z),g+=M*(5*D),y=f+=(g+=C*(5*j))>>>13,y+=x*j,y+=_*U,y+=k*L,y+=S*F,f=(y+=P*R)>>>13,y&=8191,y+=I*N,y+=T*B,y+=O*(5*$),y+=M*(5*z),v=f+=(y+=C*(5*D))>>>13,v+=x*D,v+=_*j,v+=k*U,v+=S*L,f=(v+=P*F)>>>13,v&=8191,v+=I*R,v+=T*N,v+=O*B,v+=M*(5*$),w=f+=(v+=C*(5*z))>>>13,w+=x*z,w+=_*D,w+=k*j,w+=S*U,f=(w+=P*L)>>>13,w&=8191,w+=I*F,w+=T*R,w+=O*N,w+=M*B,E=f+=(w+=C*(5*$))>>>13,E+=x*$,E+=_*z,E+=k*D,E+=S*j,f=(E+=P*U)>>>13,E&=8191,E+=I*L,E+=T*F,E+=O*R,E+=M*N,x=d=8191&(f=(f=((f+=(E+=C*B)>>>13)<<2)+f|0)+(d&=8191)|0),_=h+=f>>>=13,k=p&=8191,S=m&=8191,P=b&=8191,I=g&=8191,T=y&=8191,O=v&=8191,M=w&=8191,C=E&=8191,t+=16,r-=16;this.h[0]=x,this.h[1]=_,this.h[2]=k,this.h[3]=S,this.h[4]=P,this.h[5]=I,this.h[6]=T,this.h[7]=O,this.h[8]=M,this.h[9]=C},_.prototype.finish=function(e,t){var r,n,i,o,a=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,a[0]=this.h[0]+5,r=a[0]>>>13,a[0]&=8191,o=1;o<10;o++)a[o]=this.h[o]+r,r=a[o]>>>13,a[o]&=8191;for(a[9]-=8192,n=(1^r)-1,o=0;o<10;o++)a[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|a[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},_.prototype.update=function(e,t,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n=128;){for(A=0;A<16;A++)x=8*A+J,O[A]=r[x+0]<<24|r[x+1]<<16|r[x+2]<<8|r[x+3],M[A]=r[x+4]<<24|r[x+5]<<16|r[x+6]<<8|r[x+7];for(A=0;A<80;A++)if(i=C,o=B,a=N,s=R,c=F,u=L,l=U,j,d=D,h=z,p=$,m=H,b=G,g=q,y=K,V,S=65535&(k=V),P=k>>>16,I=65535&(_=j),T=_>>>16,S+=65535&(k=(G>>>14|F<<18)^(G>>>18|F<<14)^(F>>>9|G<<23)),P+=k>>>16,I+=65535&(_=(F>>>14|G<<18)^(F>>>18|G<<14)^(G>>>9|F<<23)),T+=_>>>16,S+=65535&(k=G&q^~G&K),P+=k>>>16,I+=65535&(_=F&L^~F&U),T+=_>>>16,_=W[2*A],S+=65535&(k=W[2*A+1]),P+=k>>>16,I+=65535&_,T+=_>>>16,_=O[A%16],P+=(k=M[A%16])>>>16,I+=65535&_,T+=_>>>16,I+=(P+=(S+=65535&k)>>>16)>>>16,S=65535&(k=E=65535&S|P<<16),P=k>>>16,I=65535&(_=w=65535&I|(T+=I>>>16)<<16),T=_>>>16,S+=65535&(k=(D>>>28|C<<4)^(C>>>2|D<<30)^(C>>>7|D<<25)),P+=k>>>16,I+=65535&(_=(C>>>28|D<<4)^(D>>>2|C<<30)^(D>>>7|C<<25)),T+=_>>>16,P+=(k=D&z^D&$^z&$)>>>16,I+=65535&(_=C&B^C&N^B&N),T+=_>>>16,f=65535&(I+=(P+=(S+=65535&k)>>>16)>>>16)|(T+=I>>>16)<<16,v=65535&S|P<<16,S=65535&(k=m),P=k>>>16,I=65535&(_=s),T=_>>>16,P+=(k=E)>>>16,I+=65535&(_=w),T+=_>>>16,B=i,N=o,R=a,F=s=65535&(I+=(P+=(S+=65535&k)>>>16)>>>16)|(T+=I>>>16)<<16,L=c,U=u,j=l,C=f,z=d,$=h,H=p,G=m=65535&S|P<<16,q=b,K=g,V=y,D=v,A%16==15)for(x=0;x<16;x++)_=O[x],S=65535&(k=M[x]),P=k>>>16,I=65535&_,T=_>>>16,_=O[(x+9)%16],S+=65535&(k=M[(x+9)%16]),P+=k>>>16,I+=65535&_,T+=_>>>16,w=O[(x+1)%16],S+=65535&(k=((E=M[(x+1)%16])>>>1|w<<31)^(E>>>8|w<<24)^(E>>>7|w<<25)),P+=k>>>16,I+=65535&(_=(w>>>1|E<<31)^(w>>>8|E<<24)^w>>>7),T+=_>>>16,w=O[(x+14)%16],P+=(k=((E=M[(x+14)%16])>>>19|w<<13)^(w>>>29|E<<3)^(E>>>6|w<<26))>>>16,I+=65535&(_=(w>>>19|E<<13)^(E>>>29|w<<3)^w>>>6),T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,O[x]=65535&I|T<<16,M[x]=65535&S|P<<16;S=65535&(k=D),P=k>>>16,I=65535&(_=C),T=_>>>16,_=e[0],P+=(k=t[0])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[0]=C=65535&I|T<<16,t[0]=D=65535&S|P<<16,S=65535&(k=z),P=k>>>16,I=65535&(_=B),T=_>>>16,_=e[1],P+=(k=t[1])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[1]=B=65535&I|T<<16,t[1]=z=65535&S|P<<16,S=65535&(k=$),P=k>>>16,I=65535&(_=N),T=_>>>16,_=e[2],P+=(k=t[2])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[2]=N=65535&I|T<<16,t[2]=$=65535&S|P<<16,S=65535&(k=H),P=k>>>16,I=65535&(_=R),T=_>>>16,_=e[3],P+=(k=t[3])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[3]=R=65535&I|T<<16,t[3]=H=65535&S|P<<16,S=65535&(k=G),P=k>>>16,I=65535&(_=F),T=_>>>16,_=e[4],P+=(k=t[4])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[4]=F=65535&I|T<<16,t[4]=G=65535&S|P<<16,S=65535&(k=q),P=k>>>16,I=65535&(_=L),T=_>>>16,_=e[5],P+=(k=t[5])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[5]=L=65535&I|T<<16,t[5]=q=65535&S|P<<16,S=65535&(k=K),P=k>>>16,I=65535&(_=U),T=_>>>16,_=e[6],P+=(k=t[6])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[6]=U=65535&I|T<<16,t[6]=K=65535&S|P<<16,S=65535&(k=V),P=k>>>16,I=65535&(_=j),T=_>>>16,_=e[7],P+=(k=t[7])>>>16,I+=65535&_,T+=_>>>16,T+=(I+=(P+=(S+=65535&k)>>>16)>>>16)>>>16,e[7]=j=65535&I|T<<16,t[7]=V=65535&S|P<<16,J+=128,n-=128}return n}function Z(e,t,r){var n,i=new Int32Array(8),o=new Int32Array(8),a=new Uint8Array(256),s=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,J(i,o,t,r),r%=128,n=0;n=0;--i)X(e,t,n=r[i/8|0]>>(7&i)&1),Y(t,e),Y(e,e),X(e,t,n)}function te(e,r){var n=[t(),t(),t(),t()];T(n[0],l),T(n[1],f),T(n[2],a),U(n[3],l,f),ee(e,n,r)}function re(e,n,i){var o,a=new Uint8Array(64),s=[t(),t(),t(),t()];for(i||r(n,32),Z(a,n,32),a[0]&=248,a[31]&=127,a[31]|=64,te(s,a),Q(e,s),o=0;o<32;o++)n[o+32]=e[o];return 0}var ne=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ie(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*ne[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ne[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function oe(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ie(e,r)}function ae(e,r,n,i){var o,a,s=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),l=new Float64Array(64),f=[t(),t(),t(),t()];Z(s,i,32),s[0]&=248,s[31]&=127,s[31]|=64;var d=n+64;for(o=0;o>7&&L(e[0],o,e[0]),U(e[3],e[0],e[1]),0)}(h,i))return-1;for(s=0;s=0},e.sign.keyPair=function(){var e=new Uint8Array(le),t=new Uint8Array(fe);return re(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(he(e),e.length!==fe)throw new Error("bad secret key size");for(var t=new Uint8Array(le),r=0;r0&&(o=2048-i-16),n.padding="0".repeat(o),Pde({publicKey:e,data:JSON.stringify(n),version:r})},bde.decrypt=Ide,bde.decryptSafely=function({encryptedData:e,privateKey:t}){if((0,Sde.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,Sde.isNullish)(t))throw new Error("Missing privateKey parameter");return JSON.parse(Ide({encryptedData:e,privateKey:t})).data},bde.getEncryptionPublicKey=function(e){const t=Tde(e),r=_de.box.keyPair.fromSecretKey(t).publicKey;return kde.encodeBase64(r)},function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.normalize=e.concatSig=void 0,r(g4,e),r(ffe,e),r(bde,e);var n=mse;Object.defineProperty(e,"concatSig",{enumerable:!0,get:function(){return n.concatSig}}),Object.defineProperty(e,"normalize",{enumerable:!0,get:function(){return n.normalize}})}(b4);var Mde,Cde=Object.prototype.hasOwnProperty,Bde=Object.keys||function(e){var t=[];for(var r in e)Cde.call(e,r)&&t.push(r);return t},Nde=Array.prototype.slice;function Rde(){return void 0!==Mde?Mde:Mde="foo"===function(){}.name}function Fde(e){return Object.prototype.toString.call(e)}function Lde(e){return!se(e)&&("function"==typeof u.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}function Ude(e,t){e||Gde(e,!0,t,"==",qde)}var jde=/\s*function\s+([^\(\s]*)\s*/;function Dde(e){if(Pte(e)){if(Rde())return e.name;var t=e.toString().match(jde);return t&&t[1]}}function zde(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=function(e){return $de(Hde(e.actual),128)+" "+e.operator+" "+$de(Hde(e.expected),128)}(this),this.generatedMessage=!0);var t=e.stackStartFunction||Gde;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=Dde(t),o=n.indexOf("\n"+i);if(o>=0){var a=n.indexOf("\n",o+1);n=n.substring(a+1)}this.stack=n}}}function $de(e,t){return"string"==typeof e?e.length=0;s--)if(c[s]!==u[s])return!1;for(s=c.length-1;s>=0;s--)if(!Kde(e[a=c[s]],t[a],r,n))return!1;return!0}(e,t,r,n))}return r?e===t:e==t}function Vde(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function Wde(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function Jde(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&Gde(i,r,"Missing expected exception"+n);var o="string"==typeof n,a=!e&&i&&!r;if((!e&&Ste(i)&&o&&Wde(i,r)||a)&&Gde(i,r,"Got unwanted exception"+n),e&&i&&r&&!Wde(i,r)||!e&&i)throw i}Ude.AssertionError=zde,tte(zde,Error),Ude.fail=Gde,Ude.ok=qde,Ude.equal=function e(t,r,n){t!=r&&Gde(t,r,n,"==",e)},Ude.notEqual=function e(t,r,n){t==r&&Gde(t,r,n,"!=",e)},Ude.deepEqual=function e(t,r,n){Kde(t,r,!1)||Gde(t,r,n,"deepEqual",e)},Ude.deepStrictEqual=function e(t,r,n){Kde(t,r,!0)||Gde(t,r,n,"deepStrictEqual",e)},Ude.notDeepEqual=function e(t,r,n){Kde(t,r,!1)&&Gde(t,r,n,"notDeepEqual",e)},Ude.notDeepStrictEqual=function e(t,r,n){Kde(t,r,!0)&&Gde(t,r,n,"notDeepStrictEqual",e)},Ude.strictEqual=function e(t,r,n){t!==r&&Gde(t,r,n,"===",e)},Ude.notStrictEqual=function e(t,r,n){t===r&&Gde(t,r,n,"!==",e)},Ude.throws=function(e,t,r){Jde(!0,e,t,r)},Ude.doesNotThrow=function(e,t,r){Jde(!1,e,t,r)},Ude.ifError=function(e){if(e)throw e};var Zde={},Yde={},Xde=nse,Qde=Yde.ValidationError=function(e,t,r,n,i,o){if(Array.isArray(n)?(this.path=n,this.property=n.reduce((function(e,t){return e+ahe(t)}),"instance")):void 0!==n&&(this.property=n),e&&(this.message=e),r){var a=r.$id||r.id;this.schema=a||r}void 0!==t&&(this.instance=t),this.name=i,this.argument=o,this.stack=this.toString()};Qde.prototype.toString=function(){return this.property+" "+this.message};var ehe=Yde.ValidatorResult=function(e,t,r,n){this.instance=e,this.schema=t,this.options=r,this.path=n.path,this.propertyPath=n.propertyPath,this.errors=[],this.throwError=r&&r.throwError,this.throwFirst=r&&r.throwFirst,this.throwAll=r&&r.throwAll,this.disableFormat=r&&!0===r.disableFormat};function the(e,t){return t+": "+e.toString()+"\n"}function rhe(e){Error.captureStackTrace&&Error.captureStackTrace(this,rhe),this.instance=e.instance,this.schema=e.schema,this.options=e.options,this.errors=e.errors}ehe.prototype.addError=function(e){var t;if("string"==typeof e)t=new Qde(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");t=new Qde(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(t),this.throwFirst)throw new rhe(this);if(this.throwError)throw t;return t},ehe.prototype.importErrors=function(e){"string"==typeof e||e&&e.validatorType?this.addError(e):e&&e.errors&&(this.errors=this.errors.concat(e.errors))},ehe.prototype.toString=function(e){return this.errors.map(the).join("")},Object.defineProperty(ehe.prototype,"valid",{get:function(){return!this.errors.length}}),Yde.ValidatorResultError=rhe,rhe.prototype=new Error,rhe.prototype.constructor=rhe,rhe.prototype.name="Validation Error";var nhe=Yde.SchemaError=function e(t,r){this.message=t,this.schema=r,Error.call(this,t),Error.captureStackTrace(this,e)};nhe.prototype=Object.create(Error.prototype,{constructor:{value:nhe,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var ihe=Yde.SchemaContext=function(e,t,r,n,i){this.schema=e,this.options=t,Array.isArray(r)?(this.path=r,this.propertyPath=r.reduce((function(e,t){return e+ahe(t)}),"instance")):this.propertyPath=r,this.base=n,this.schemas=i};ihe.prototype.resolve=function(e){return Xde.resolve(this.base,e)},ihe.prototype.makeChild=function(e,t){var r=void 0===t?this.path:this.path.concat([t]),n=e.$id||e.id,i=Xde.resolve(this.base,n||""),o=new ihe(e,this.options,r,i,Object.create(this.schemas));return n&&!o.schemas[i]&&(o.schemas[i]=e),o};var ohe=Yde.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,duration:/P(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S)|\d+(D|M(\d+D)?|Y(\d+M(\d+D)?)?)(T\d+(H(\d+M(\d+S)?)?|M(\d+S)?|S))?|\d+W)/i,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"idn-email":/^("(?:[!#-\[\]-\u{10FFFF}]|\\[\t -\u{10FFFF}])*"|[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*)@([!#-'*+\-/-9=?A-Z\^-\u{10FFFF}](?:\.?[!#-'*+\-/-9=?A-Z\^-\u{10FFFF}])*|\[[!-Z\^-\u{10FFFF}]*\])$/u,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,iri:/^[a-zA-Z][a-zA-Z0-9+.-]*:[^\s]*$/,"iri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~-\u{10FFFF}]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~-\u{10FFFF}])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~-\u{10FFFF}]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~-\u{10FFFF}])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~-\u{10FFFF}])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~-\u{10FFFF}])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~-\u{10FFFF}]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/u,uuid:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i,"uri-template":/(%[0-9a-f]{2}|[!#$&(-;=?@\[\]_a-z~]|\{[!#&+,./;=?@|]?(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?(,(%[0-9a-f]{2}|[0-9_a-z])(\.?(%[0-9a-f]{2}|[0-9_a-z]))*(:[1-9]\d{0,3}|\*)?)*\})*/iu,"json-pointer":/^(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*$/iu,"relative-json-pointer":/^\d+(#|(\/([\x00-\x2e0-@\[-}\x7f]|~[01])*)*)$/iu,hostname:/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"host-name":/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,"utc-millisec":function(e){return"string"==typeof e&&parseFloat(e)===parseInt(e,10)&&!isNaN(e)},regex:function(e){var t=!0;try{new RegExp(e)}catch(e){t=!1}return t},style:/[\r\n\t ]*[^\r\n\t ][^:]*:[\r\n\t ]*[^\r\n\t ;]*[\r\n\t ]*;?/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/};ohe.regexp=ohe.regex,ohe.pattern=ohe.regex,ohe.ipv4=ohe["ip-address"],Yde.isFormat=function(e,t,r){if("string"==typeof e&&void 0!==ohe[t]){if(ohe[t]instanceof RegExp)return ohe[t].test(e);if("function"==typeof ohe[t])return ohe[t](e)}else if(r&&r.customFormats&&"function"==typeof r.customFormats[t])return r.customFormats[t](e);return!0};var ahe=Yde.makeSuffix=function(e){return(e=e.toString()).match(/[.\s\[\]]/)||e.match(/^[\d]/)?e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]":"."+e};function she(e,t,r,n){"object"==typeof r?t[n]=lhe(e[n],r):-1===e.indexOf(r)&&t.push(r)}function che(e,t,r){t[r]=e[r]}function uhe(e,t,r,n){"object"==typeof t[n]&&t[n]&&e[n]?r[n]=lhe(e[n],t[n]):r[n]=t[n]}function lhe(e,t){var r=Array.isArray(t),n=r&&[]||{};return r?(e=e||[],n=n.concat(e),t.forEach(she.bind(null,e,n))):(e&&"object"==typeof e&&Object.keys(e).forEach(che.bind(null,e,n)),Object.keys(t).forEach(uhe.bind(null,e,t,n))),n}function fhe(e){return"/"+encodeURIComponent(e).replace(/~/g,"%7E")}Yde.deepCompareStrict=function e(t,r){if(typeof t!=typeof r)return!1;if(Array.isArray(t))return!!Array.isArray(r)&&(t.length===r.length&&t.every((function(n,i){return e(t[i],r[i])})));if("object"==typeof t){if(!t||!r)return t===r;var n=Object.keys(t),i=Object.keys(r);return n.length===i.length&&n.every((function(n){return e(t[n],r[n])}))}return t===r},Yde.deepMerge=lhe,Yde.objectGetPath=function(e,t){for(var r,n=t.split("/").slice(1);"string"==typeof(r=n.shift());){var i=decodeURIComponent(r.replace(/~0/,"~").replace(/~1/g,"/"));if(!(i in e))return;e=e[i]}return e},Yde.encodePath=function(e){return e.map(fhe).join("")},Yde.getDecimalPlaces=function(e){var t=0;if(isNaN(e))return t;"number"!=typeof e&&(e=Number(e));var r=e.toString().split("e");if(2===r.length){if("-"!==r[1][0])return t;t=Number(r[1].slice(1))}var n=r[0].split(".");return 2===n.length&&(t+=n[1].length),t},Yde.isSchema=function(e){return"object"==typeof e&&e||"boolean"==typeof e};var dhe=Yde,hhe=dhe.ValidatorResult,phe=dhe.SchemaError,mhe={ignoreProperties:{id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0}},bhe=mhe.validators={};function ghe(e,t,r,n,i){var o=t.throwError,a=t.throwAll;t.throwError=!1,t.throwAll=!1;var s=this.validateSchema(e,i,t,r);return t.throwError=o,t.throwAll=a,!s.valid&&n instanceof Function&&n(s),s.valid}function yhe(e,t){if(Object.hasOwnProperty.call(e,t))return e[t];if(t in e)for(;e=Object.getPrototypeOf(e);)if(Object.propertyIsEnumerable.call(e,t))return e[t]}function vhe(e,t,r,n,i,o){if(this.types.object(e)&&(!t.properties||void 0===t.properties[i]))if(!1===t.additionalProperties)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var a=t.additionalProperties||{};"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,i,a,r,n);var s=this.validateSchema(e[i],a,r,n.makeChild(a,i));s.instance!==o.instance[i]&&(o.instance[i]=s.instance),o.importErrors(s)}}bhe.type=function(e,t,r,n){if(void 0===e)return null;var i=new hhe(e,t,r,n),o=Array.isArray(t.type)?t.type:[t.type];if(!o.some(this.testType.bind(this,e,t,r,n))){var a=o.map((function(e){if(e){var t=e.$id||e.id;return t?"<"+t+">":e+""}}));i.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return i},bhe.anyOf=function(e,t,r,n){if(void 0===e)return null;var i=new hhe(e,t,r,n),o=new hhe(e,t,r,n);if(!Array.isArray(t.anyOf))throw new phe("anyOf must be an array");if(!t.anyOf.some(ghe.bind(this,e,r,n,(function(e){o.importErrors(e)})))){var a=t.anyOf.map((function(e,t){var r=e.$id||e.id;return r?"<"+r+">":e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+t+"]"}));r.nestedErrors&&i.importErrors(o),i.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return i},bhe.allOf=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.allOf))throw new phe("allOf must be an array");var i=new hhe(e,t,r,n),o=this;return t.allOf.forEach((function(t,a){var s=o.validateSchema(e,t,r,n);if(!s.valid){var c=t.$id||t.id||t.title&&JSON.stringify(t.title)||t.$ref&&"<"+t.$ref+">"||"[subschema "+a+"]";i.addError({name:"allOf",argument:{id:c,length:s.errors.length,valid:s},message:"does not match allOf schema "+c+" with "+s.errors.length+" error[s]:"}),i.importErrors(s)}})),i},bhe.oneOf=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.oneOf))throw new phe("oneOf must be an array");var i=new hhe(e,t,r,n),o=new hhe(e,t,r,n),a=t.oneOf.filter(ghe.bind(this,e,r,n,(function(e){o.importErrors(e)}))).length,s=t.oneOf.map((function(e,t){return e.$id||e.id||e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+t+"]"}));return 1!==a&&(r.nestedErrors&&i.importErrors(o),i.addError({name:"oneOf",argument:s,message:"is not exactly one from "+s.join(",")})),i},bhe.if=function(e,t,r,n){if(void 0===e)return null;if(!dhe.isSchema(t.if))throw new Error('Expected "if" keyword to be a schema');var i,o=ghe.call(this,e,r,n,null,t.if),a=new hhe(e,t,r,n);if(o){if(void 0===t.then)return;if(!dhe.isSchema(t.then))throw new Error('Expected "then" keyword to be a schema');i=this.validateSchema(e,t.then,r,n.makeChild(t.then)),a.importErrors(i)}else{if(void 0===t.else)return;if(!dhe.isSchema(t.else))throw new Error('Expected "else" keyword to be a schema');i=this.validateSchema(e,t.else,r,n.makeChild(t.else)),a.importErrors(i)}return a},bhe.propertyNames=function(e,t,r,n){if(this.types.object(e)){var i=new hhe(e,t,r,n),o=void 0!==t.propertyNames?t.propertyNames:{};if(!dhe.isSchema(o))throw new phe('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(void 0!==yhe(e,a)){var s=this.validateSchema(a,o,r,n.makeChild(o));i.importErrors(s)}return i}},bhe.properties=function(e,t,r,n){if(this.types.object(e)){var i=new hhe(e,t,r,n),o=t.properties||{};for(var a in o){var s=o[a];if(void 0!==s){if(null===s)throw new phe('Unexpected null, expected schema in "properties"');"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,a,s,r,n);var c=yhe(e,a),u=this.validateSchema(c,s,r,n.makeChild(s,a));u.instance!==i.instance[a]&&(i.instance[a]=u.instance),i.importErrors(u)}}return i}},bhe.patternProperties=function(e,t,r,n){if(this.types.object(e)){var i=new hhe(e,t,r,n),o=t.patternProperties||{};for(var a in e){var s=!0;for(var c in o){var u=o[c];if(void 0!==u){if(null===u)throw new phe('Unexpected null, expected schema in "patternProperties"');try{var l=new RegExp(c,"u")}catch(e){l=new RegExp(c)}if(l.test(a)){s=!1,"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,a,u,r,n);var f=this.validateSchema(e[a],u,r,n.makeChild(u,a));f.instance!==i.instance[a]&&(i.instance[a]=f.instance),i.importErrors(f)}}}s&&vhe.call(this,e,t,r,n,a,i)}return i}},bhe.additionalProperties=function(e,t,r,n){if(this.types.object(e)){if(t.patternProperties)return null;var i=new hhe(e,t,r,n);for(var o in e)vhe.call(this,e,t,r,n,o,i);return i}},bhe.minProperties=function(e,t,r,n){if(this.types.object(e)){var i=new hhe(e,t,r,n);return Object.keys(e).length>=t.minProperties||i.addError({name:"minProperties",argument:t.minProperties,message:"does not meet minimum property length of "+t.minProperties}),i}},bhe.maxProperties=function(e,t,r,n){if(this.types.object(e)){var i=new hhe(e,t,r,n);return Object.keys(e).length<=t.maxProperties||i.addError({name:"maxProperties",argument:t.maxProperties,message:"does not meet maximum property length of "+t.maxProperties}),i}},bhe.items=function(e,t,r,n){var i=this;if(this.types.array(e)&&void 0!==t.items){var o=new hhe(e,t,r,n);return e.every((function(e,a){if(Array.isArray(t.items))var s=void 0===t.items[a]?t.additionalItems:t.items[a];else s=t.items;if(void 0===s)return!0;if(!1===s)return o.addError({name:"items",message:"additionalItems not permitted"}),!1;var c=i.validateSchema(e,s,r,n.makeChild(s,a));return c.instance!==o.instance[a]&&(o.instance[a]=c.instance),o.importErrors(c),!0})),o}},bhe.contains=function(e,t,r,n){var i=this;if(this.types.array(e)&&void 0!==t.contains){if(!dhe.isSchema(t.contains))throw new Error('Expected "contains" keyword to be a schema');var o=new hhe(e,t,r,n),a=e.some((function(e,o){return 0===i.validateSchema(e,t.contains,r,n.makeChild(t.contains,o)).errors.length}));return!1===a&&o.addError({name:"contains",argument:t.contains,message:"must contain an item matching given schema"}),o}},bhe.minimum=function(e,t,r,n){if(this.types.number(e)){var i=new hhe(e,t,r,n);return t.exclusiveMinimum&&!0===t.exclusiveMinimum?e>t.minimum||i.addError({name:"minimum",argument:t.minimum,message:"must be greater than "+t.minimum}):e>=t.minimum||i.addError({name:"minimum",argument:t.minimum,message:"must be greater than or equal to "+t.minimum}),i}},bhe.maximum=function(e,t,r,n){if(this.types.number(e)){var i=new hhe(e,t,r,n);return t.exclusiveMaximum&&!0===t.exclusiveMaximum?et.exclusiveMinimum||i.addError({name:"exclusiveMinimum",argument:t.exclusiveMinimum,message:"must be strictly greater than "+t.exclusiveMinimum}),i}},bhe.exclusiveMaximum=function(e,t,r,n){if("boolean"!=typeof t.exclusiveMaximum&&this.types.number(e)){var i=new hhe(e,t,r,n);return e=t.minLength||i.addError({name:"minLength",argument:t.minLength,message:"does not meet minimum length of "+t.minLength}),i}},bhe.maxLength=function(e,t,r,n){if(this.types.string(e)){var i=new hhe(e,t,r,n),o=e.match(/[\uDC00-\uDFFF]/g);return e.length-(o?o.length:0)<=t.maxLength||i.addError({name:"maxLength",argument:t.maxLength,message:"does not meet maximum length of "+t.maxLength}),i}},bhe.minItems=function(e,t,r,n){if(this.types.array(e)){var i=new hhe(e,t,r,n);return e.length>=t.minItems||i.addError({name:"minItems",argument:t.minItems,message:"does not meet minimum length of "+t.minItems}),i}},bhe.maxItems=function(e,t,r,n){if(this.types.array(e)){var i=new hhe(e,t,r,n);return e.length<=t.maxItems||i.addError({name:"maxItems",argument:t.maxItems,message:"does not meet maximum length of "+t.maxItems}),i}},bhe.uniqueItems=function(e,t,r,n){if(!0===t.uniqueItems&&this.types.array(e)){var i=new hhe(e,t,r,n);return e.every(Ehe)||i.addError({name:"uniqueItems",message:"contains duplicate item"}),i}},bhe.dependencies=function(e,t,r,n){if(this.types.object(e)){var i=new hhe(e,t,r,n);for(var o in t.dependencies)if(void 0!==e[o]){var a=t.dependencies[o],s=n.makeChild(a,o);if("string"==typeof a&&(a=[a]),Array.isArray(a))a.forEach((function(t){void 0===e[t]&&i.addError({name:"dependencies",argument:s.propertyPath,message:"property "+t+" not found, required by "+s.propertyPath})}));else{var c=this.validateSchema(e,a,r,s);i.instance!==c.instance&&(i.instance=c.instance),c&&c.errors.length&&(i.addError({name:"dependencies",argument:s.propertyPath,message:"does not meet dependency required by "+s.propertyPath}),i.importErrors(c))}}return i}},bhe.enum=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.enum))throw new phe("enum expects an array",t);var i=new hhe(e,t,r,n);return t.enum.some(dhe.deepCompareStrict.bind(null,e))||i.addError({name:"enum",argument:t.enum,message:"is not one of enum values: "+t.enum.map(String).join(",")}),i},bhe.const=function(e,t,r,n){if(void 0===e)return null;var i=new hhe(e,t,r,n);return dhe.deepCompareStrict(t.const,e)||i.addError({name:"const",argument:t.const,message:"does not exactly match expected constant: "+t.const}),i},bhe.not=bhe.disallow=function(e,t,r,n){var i=this;if(void 0===e)return null;var o=new hhe(e,t,r,n),a=t.not||t.disallow;return a?(Array.isArray(a)||(a=[a]),a.forEach((function(a){if(i.testType(e,t,r,n,a)){var s=a&&(a.$id||a.id)||a;o.addError({name:"not",argument:s,message:"is of prohibited type "+s})}})),o):null};var Ahe=mhe,xhe={},_he=nse,khe=Yde;function She(e,t){this.id=e,this.ref=t}xhe.SchemaScanResult=She,xhe.scan=function(e,t){function r(e,t){if(t&&"object"==typeof t)if(t.$ref){var s=_he.resolve(e,t.$ref);a[s]=a[s]?a[s]+1:0}else{var c=t.$id||t.id,u=c?_he.resolve(e,c):e;if(u){if(u.indexOf("#")<0&&(u+="#"),o[u]){if(!khe.deepCompareStrict(o[u],t))throw new Error("Schema <"+u+"> already exists with different definition");return o[u]}o[u]=t,"#"==u[u.length-1]&&(o[u.substring(0,u.length-1)]=t)}n(u+"/items",Array.isArray(t.items)?t.items:[t.items]),n(u+"/extends",Array.isArray(t.extends)?t.extends:[t.extends]),r(u+"/additionalItems",t.additionalItems),i(u+"/properties",t.properties),r(u+"/additionalProperties",t.additionalProperties),i(u+"/definitions",t.definitions),i(u+"/patternProperties",t.patternProperties),i(u+"/dependencies",t.dependencies),n(u+"/disallow",t.disallow),n(u+"/allOf",t.allOf),n(u+"/anyOf",t.anyOf),n(u+"/oneOf",t.oneOf),r(u+"/not",t.not)}}function n(e,t){if(Array.isArray(t))for(var n=0;n",e);var a=The.objectGetPath(r.schemas[o],i.substr(1));if(void 0===a)throw new Bhe("no such schema "+i+" located in <"+o+">",e);return{subschema:a,switchSchema:t}},Rhe.prototype.testType=function(e,t,r,n,i){if(void 0!==i){if(null===i)throw new Bhe('Unexpected null in "type" keyword');if("function"==typeof this.types[i])return this.types[i].call(this,e);if(i&&"object"==typeof i){var o=this.validateSchema(e,i,r,n);return void 0===o||!(o&&o.errors.length)}return!0}};var Lhe=Rhe.prototype.types={};Lhe.string=function(e){return"string"==typeof e},Lhe.number=function(e){return"number"==typeof e&&isFinite(e)},Lhe.integer=function(e){return"number"==typeof e&&e%1==0},Lhe.boolean=function(e){return"boolean"==typeof e},Lhe.array=function(e){return Array.isArray(e)},Lhe.null=function(e){return null===e},Lhe.date=function(e){return e instanceof Date},Lhe.any=function(e){return!0},Lhe.object=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&!(e instanceof Date)};var Uhe,jhe=Rhe,Dhe=Zde.Validator=jhe;function zhe(e){return 42===e.length}function $he(e){let{getAccounts:t,getPrivateKey:r,processDecryptMessage:n,processEncryptionPublicKey:o,processEthSignMessage:a,processPersonalMessage:s,processTransaction:c,processSignTransaction:u,processTypedMessage:l,processTypedMessageV3:f,processTypedMessageV4:d}=e;if(!t)throw new Error("opts.getAccounts is required");async function h(e,r){if("string"==typeof e&&e.length>0){const n=(await t(r)).map((e=>e.toLowerCase())),i=e.toLowerCase();if(n.includes(i))return i}throw Kl.invalidParams({message:"Invalid parameters: must provide an Ethereum address."})}async function p(e,t){if(!r)throw Kl.methodNotSupported();t.result=r(e)}return af({eth_accounts:sf((async function(e,r){r.result=await t(e)})),eth_private_key:sf(p),private_key:sf(p),eth_coinbase:sf((async function(e,r){const n=await t(e);r.result=n[0]||null})),eth_sendTransaction:sf((async function(e,t){if(!c)throw Kl.methodNotSupported();const r=e.params[0]||{from:""};r.from=await h(r.from,e),t.result=await c(r,e)})),eth_signTransaction:sf((async function(e,t){if(!u)throw Kl.methodNotSupported();const r=e.params[0]||{from:""};r.from=await h(r.from,e),t.result=await u(r,e)})),eth_sign:sf((async function(e,t){if(!a)throw Kl.methodNotSupported();const r=await h(e.params[0],e),n=e.params[1],o=i(i({},e.params[2]||{}),{},{from:r,data:n});t.result=await a(o,e)})),eth_signTypedData:sf((async function(e,t){if(!l)throw Kl.methodNotSupported();const r=e.params[0],n=await h(e.params[1],e),o=i(i({},e.params[2]||{}),{},{from:n,data:r});t.result=await l(o,e,"V1")})),eth_signTypedData_v3:sf((async function(e,t){if(!f)throw Kl.methodNotSupported();const r=await h(e.params[0],e),n={data:e.params[1],from:r,version:"V3"};t.result=await f(n,e,"V3")})),eth_signTypedData_v4:sf((async function(e,t){if(!d)throw Kl.methodNotSupported();const r=await h(e.params[0],e),n={data:e.params[1],from:r,version:"V4"};t.result=await d(n,e,"V4")})),personal_sign:sf((async function(e,t){if(!s)throw Kl.methodNotSupported();const r=e.params[0],n=e.params[1],o=e.params[2]||{};let a,c;if(zhe(r)&&!zhe(n)){let e="The eth_personalSign method requires params ordered ";e+="[message, address]. This was previously handled incorrectly, ",e+="and has been corrected automatically. ",e+="Please switch this param order for smooth behavior in the future.",t.warning=e,a=r,c=n}else c=r,a=n;a=await h(a,e);const u=i(i({},o),{},{from:a,data:c});t.result=await s(u,e)})),eth_getEncryptionPublicKey:sf((async function(e,t){if(!o)throw Kl.methodNotSupported();const r=await h(e.params[0],e);t.result=await o(r,e)})),eth_decrypt:sf((async function(e,t){if(!n)throw Kl.methodNotSupported();const r=e.params[0],o=await h(e.params[1],e),a=i(i({},e.params[2]||{}),{},{from:o,data:r});t.result=n(a,e)}))})}function Hhe(e){const{getAccounts:t,getPrivateKey:r,processTransaction:n,processSignTransaction:i,processEthSignMessage:o,processTypedMessage:a,processTypedMessageV3:s,processTypedMessageV4:c,processPersonalMessage:u,processEncryptionPublicKey:l,processDecryptMessage:f}=e;return uf([af({eth_syncing:!1}),$he({getAccounts:t,getPrivateKey:r,processTransaction:n,processEthSignMessage:o,processSignTransaction:i,processTypedMessage:a,processTypedMessageV3:s,processTypedMessageV4:c,processPersonalMessage:u,processEncryptionPublicKey:l,processDecryptMessage:f})])}function Ghe(e){let{addChain:t,switchChain:r}=e;return af({wallet_addEthereumChain:sf((async function(e,r){var n;const i=null!==(n=e.params)&&void 0!==n&&n.length?e.params[0]:void 0;if(!i)throw Kl.invalidParams("Missing chain params");if(!i.chainId)throw Kl.invalidParams("Missing chainId in chainParams");if(!i.rpcUrls||0===i.rpcUrls.length)throw Kl.invalidParams("Missing rpcUrls in chainParams");if(!i.nativeCurrency)throw Kl.invalidParams("Missing nativeCurrency in chainParams");r.result=await t(i)})),wallet_switchEthereumChain:sf((async function(e,t){var n;const i=null!==(n=e.params)&&void 0!==n&&n.length?e.params[0]:void 0;if(!i)throw Kl.invalidParams("Missing chainId");t.result=await r(i)}))})}function qhe(e){return(t,r,n,i)=>"eth_chainId"===t.method?(r.result=e,i()):n()}function Khe(e){return(t,r,n,i)=>"eth_provider_config"===t.method?(r.result=e,i()):n()}function Vhe(e){const{chainId:t,rpcTarget:r}=e,n=yE({rpcTarget:r});return{networkMiddleware:uf([qhe(t),Khe(e),n]),fetchMiddleware:n}}async function Whe(e){if(e.session.length){const t=e.session.keys.length-1;return e.session.get(e.session.keys[t])}return null}async function Jhe(e,t,r,n){const i=await Whe(e);if(!i)throw Vl.disconnected();return e.request({topic:i.topic,chainId:`eip155:${t}`,request:{method:r,params:n}})}async function Zhe(e){const t=await Whe(e);if(!t)throw Vl.disconnected();const r=T1(t.namespaces);if(r&&r.length)return[...new Set(r.map((e=>P1(e).address)))];throw new Error("Failed to get accounts")}Zde.ValidatorResult=Yde.ValidatorResult,Zde.ValidatorResultError=Yde.ValidatorResultError,Zde.ValidationError=Yde.ValidationError,Zde.SchemaError=Yde.SchemaError,Zde.SchemaScanResult=xhe.SchemaScanResult,Zde.scan=xhe.scan,Zde.validate=function(e,t,r){return(new Dhe).validate(e,t,r)};class Yhe extends EE{constructor(e){let{config:t,state:n,connector:o}=e;super({config:{chainConfig:i(i({},t.chainConfig),{},{chainNamespace:nd.EIP155}),skipLookupNetwork:!!t.skipLookupNetwork},state:i(i({},n||{}),{},{chainId:"loading",accounts:[]})}),r(this,"connector",null),this.connector=o||null}async enable(){if(!this.connector)throw Vl.custom({message:"Connector is not initialized, pass wallet connect connector in constructor",code:4902});return await this.setupProvider(this.connector),this._providerEngineProxy.request({method:"eth_accounts"})}async setupProvider(e){this.onConnectorStateUpdate(e),await this.setupEngine(e)}async switchChain(e){let{chainId:t}=e;if(!this.connector)throw Vl.custom({message:"Connector is not initialized, pass wallet connect connector in constructor",code:4902});const r=this.getChainConfig(t);this.configure({chainConfig:r}),await this.setupEngine(this.connector),this.lookupNetwork(this.connector)}async addChain(e){super.addChain(e)}async lookupNetwork(e){const t=this.config.chainConfig.chainId;return this.update({chainId:t}),this.emit("chainChanged",t),this.emit("connect",{chainId:t}),this.config.chainConfig.chainId}async setupEngine(e){const{chainId:t}=this.config.chainConfig,r=function(e){let{connector:t,chainId:r}=e;return{getPrivateKey:async()=>{throw Kl.methodNotSupported()},getAccounts:async e=>Zhe(t),processTransaction:async(e,n)=>await Jhe(t,r,"eth_sendTransaction",[e]),processSignTransaction:async(e,n)=>await Jhe(t,r,"eth_signTransaction",[e]),processEthSignMessage:async(e,n)=>await Jhe(t,r,"eth_sign",[e.from,e.data]),processPersonalMessage:async(e,n)=>await Jhe(t,r,"personal_sign",[e.from,e.data]),processTypedMessage:async(e,n)=>await Jhe(t,r,"eth_signTypedData",[e.data,e.from]),processTypedMessageV3:async e=>await Jhe(t,r,"eth_signTypedData_v3",[e.from,e.data]),processTypedMessageV4:async e=>await Jhe(t,r,"eth_signTypedData_v4",[e.from,e.data]),processEncryptionPublicKey:async e=>{throw Kl.methodNotSupported()},processDecryptMessage:e=>{throw Kl.methodNotSupported()}}}({connector:e,chainId:parseInt(t,16)}),n=await Zhe(e);this.update({accounts:n||[]});const i=Hhe(r),o=this.getChainSwitchMiddleware(),a=new cf,{networkMiddleware:s}=Vhe(this.config.chainConfig);a.push(i),a.push(o),a.push(s);const c=lf(a);this.updateProviderEngineProxy(c)}getChainSwitchMiddleware(){return Ghe({addChain:async e=>{const{chainId:t,chainName:r,rpcUrls:n,blockExplorerUrls:i,nativeCurrency:o}=e;this.addChain({chainNamespace:nd.EIP155,chainId:t,ticker:(null==o?void 0:o.symbol)||"ETH",tickerName:(null==o?void 0:o.name)||"Ether",displayName:r,rpcTarget:n[0],blockExplorer:(null==i?void 0:i[0])||"",decimals:(null==o?void 0:o.decimals)||18})},switchChain:async e=>{const{chainId:t}=e;await this.switchChain({chainId:t})}})}connectedTopic(){var e;if(!this.connector)throw cd.notConnectedError("Wallet connect connector is not connected");if(null!==(e=this.connector)&&void 0!==e&&null!==(e=e.session)&&void 0!==e&&e.length){var t;const e=this.connector.session.keys.length-1;return null===(t=this.connector.session.get(this.connector.session.keys[e]))||void 0===t?void 0:t.topic}}checkIfChainIdAllowed(e){if(!this.connector||!this.connectedTopic())return!1;const t=O1(this.connector.session.get(this.connectedTopic()).namespaces);let r=!1;for(const n of t){const t=S1(n);if(Number.parseInt(t.reference,10)===Number.parseInt(e,10)){r=!0;break}}return r}checkIfAccountAllowed(e){if(!this.connector||!this.connectedTopic())return!1;const t=T1(this.connector.session.get(this.connectedTopic()).namespaces);let r=!1;for(const i of t){var n;if((null===(n=P1(i).address)||void 0===n?void 0:n.toLowerCase())===(null==e?void 0:e.toLowerCase())){r=!0;break}}return r}async onConnectorStateUpdate(e){e.events.on("session_event",(async t=>{if(vd.debug("session_event data",t),!this.provider)throw cd.notConnectedError("Wallet connect connector is not connected");const{event:r}=t.params,{name:n,data:o}=r||{};if("accountsChanged"===n&&null!=o&&o.length&&this.state.accounts[0]!==o[0]&&this.checkIfAccountAllowed(o[0])&&(this.update({accounts:o}),this.emit("accountsChanged",o)),"chainChanged"===r.name){const{chainId:t,rpcUrl:r}=o,n=`0x${t.toString(16)}`;if(!this.checkIfChainIdAllowed(n))return;if(n&&this.state.chainId!==n){const t=od(nd.EIP155,n)||{};this.configure({chainConfig:i(i({},t),{},{chainId:n,rpcTarget:r,chainNamespace:nd.EIP155})}),await this.setupEngine(e)}}}))}}Uhe=Yhe,r(Yhe,"getProviderInstance",(async e=>{const t=new Uhe({config:{chainConfig:e.chainConfig,skipLookupNetwork:e.skipLookupNetwork}});return await t.setupProvider(e.connector),t}));const Xhe=new om("1e18"),Qhe=new om("1e9"),epe=new om("1"),tpe={hex:e=>new om("string"==typeof e?L3(e):e,16),dec:e=>new om(e,10)},rpe={WEI:e=>e.div(Xhe),GWEI:e=>e.div(Qhe),ETH:e=>e.div(epe)},npe={WEI:e=>e.times(Xhe).dp(0,om.ROUND_HALF_UP),GWEI:e=>e.times(Qhe).dp(9,om.ROUND_HALF_UP),ETH:e=>e.times(epe).dp(9,om.ROUND_HALF_UP)},ipe={hex:e=>e.toString(16),dec:e=>new om(e).toString(10)},ope=(e,t)=>{let{fromNumericBase:r="hex",toNumericBase:n,fromDenomination:i,toDenomination:o,numberOfDecimals:a}=t;return(e=>{const{value:t,fromNumericBase:r,fromDenomination:n,toNumericBase:i,toDenomination:o,numberOfDecimals:a}=e;let s=tpe[r](t);return n&&(s=rpe[n](s)),o&&(s=npe[o](s)),a&&(s=s.dp(a,om.ROUND_HALF_DOWN)),i&&(s=ipe[i](s)),s})({fromNumericBase:r,toNumericBase:n,fromDenomination:i,toDenomination:o,numberOfDecimals:a,value:e||"0"})};function ape(e){return ope(e,{fromNumericBase:"dec",toNumericBase:"hex",fromDenomination:"GWEI",toDenomination:"WEI"})}function spe(e){return ope(e,{fromNumericBase:"hex",toNumericBase:"dec",fromDenomination:"WEI",toDenomination:"GWEI"})}function cpe(e){return spe(ape(e)).toString()}const upe=(e,t)=>{try{Ude.ok(e&&"object"==typeof e,"Params must be an object."),Ude.ok("data"in e,'Params must include a "data" field.'),Ude.ok("from"in e,'Params must include a "from" field.'),Ude.ok("string"==typeof e.from&&b8(e.from),'"from" field must be a valid, lowercase, hexadecimal Ethereum address string.');let n=null,i=null;switch(e.version){case b4.SignTypedDataVersion.V1:"string"==typeof e.data?Ude.doesNotThrow((()=>{n=JSON.parse(e.data)}),'"data" must be a valid JSON string.'):n=e.data,Ude.ok(Array.isArray(n),"params.data must be an array."),Ude.doesNotThrow((()=>{b4.typedSignatureHash(n)}),"Signing data must be valid EIP-712 typed data.");break;case b4.SignTypedDataVersion.V3:case b4.SignTypedDataVersion.V4:{var r;"string"==typeof e.data?Ude.doesNotThrow((()=>{n=JSON.parse(e.data)}),'"data" must be a valid JSON string.'):n=e.data;const o=n;Ude.ok(o.primaryType in o.types,`Primary type of "${o.primaryType}" has no type definition.`);const a=Zde.validate(o,b4.TYPED_MESSAGE_SCHEMA.properties);Ude.strictEqual(a.errors.length,0,"Signing data must conform to EIP-712 schema. See https://git.io/fNtcx."),i=null===(r=o.domain)||void 0===r?void 0:r.chainId,i&&(Ude.ok(!Number.isNaN(t),`Cannot sign messages for chainId "${i}", because Web3Auth is switching networks.`),"string"==typeof i&&(i=Number.parseInt(i,Ed(i)?16:10)),Ude.strictEqual(i,t,`Provided chainId "${i}" must match the active chainId "${t}"`));break}default:Ude.fail(`Unknown typed data version "${e.version}"`)}}catch(e){throw Kl.invalidInput({message:null==e?void 0:e.message})}};async function lpe(e,t,r){const n=await r.formatTransaction(e),i=await r.getCommonConfiguration(),o=m4.fromTxData(n,{common:i}).sign(_.from(t,"hex")).serialize();return _.from(o)}function fpe(e){return n8(e.toString(16))}function dpe(e){return pH.isBN(e)?e:new pH(L3(e),16)}const hpe="0x0",ppe="0x2",mpe="sentEther",bpe="contractInteraction",gpe="contractDeployment",ype="fee-market",vpe="legacy",wpe="eth_gasPrice";class Epe{constructor(e){let{getProviderEngineProxy:t}=e;r(this,"API_SUPPORTED_CHAINIDS",new Set(["0x1","0x5","0x13881","0xa4b1","0xa86a","0x2105","0x38","0xfa","0xa","0x89"])),r(this,"chainConfig",null),r(this,"getProviderEngineProxy",void 0),r(this,"isEIP1559Compatible",!1),this.getProviderEngineProxy=t}get providerProxy(){return this.getProviderEngineProxy()}async init(){this.chainConfig=await this.providerProxy.request({method:"eth_provider_config"}),this.isEIP1559Compatible=await this.getEIP1559Compatibility()}async getCommonConfiguration(){if(!this.chainConfig)throw new Error("Chain config not initialized");const{displayName:e,chainId:t}=this.chainConfig,r=this.isEIP1559Compatible?F8.Paris:F8.Berlin,n={name:e,chainId:"loading"===t?0:Number.parseInt(t,16),networkId:"loading"===t?0:Number.parseInt(t,16),defaultHardfork:r};return q8.custom(n)}async formatTransaction(e){if(!this.chainConfig)throw new Error("Chain config not initialized");const t=i({},e);if(void 0===t.nonce&&(t.nonce=await this.providerProxy.request({method:"eth_getTransactionCount",params:[e.from,"latest"]})),!this.isEIP1559Compatible&&t.gasPrice){if(t.maxFeePerGas&&delete t.maxFeePerGas,t.maxPriorityFeePerGas&&delete t.maxPriorityFeePerGas,!t.gasLimit)if(t.gas)t.gasLimit=t.gas;else{const e=await this.getDefaultGasLimit(t);e&&(t.gasLimit=e)}return t}if(!t.gasLimit)if(t.gas)t.gasLimit=t.gas;else{const e=await this.getDefaultGasLimit(t);e&&(t.gasLimit=e)}const{gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:o}=await this.getDefaultGasFees(t);var a,s;return this.isEIP1559Compatible?(!t.gasPrice||t.maxFeePerGas||t.maxPriorityFeePerGas?(n&&!t.maxFeePerGas&&(t.maxFeePerGas=n),o&&!t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=o),r&&!t.maxFeePerGas&&(t.maxFeePerGas=r),t.maxFeePerGas&&!t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=t.maxFeePerGas)):(t.maxFeePerGas=t.gasPrice,t.maxPriorityFeePerGas=(a="string"==typeof o?L3(o):o,s="string"==typeof t.gasPrice?L3(t.gasPrice):t.gasPrice,null!=a&&null!=s&&new om(a,10).lt(s,10)?o:t.gasPrice)),delete t.gasPrice):(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),!r||t.gasPrice||t.maxPriorityFeePerGas||t.maxFeePerGas||(t.gasPrice=r),t.type=this.isEIP1559Compatible?ppe:hpe,t.chainId=this.chainConfig.chainId,t}async fetchEthGasPriceEstimate(){return{gasPrice:spe(await this.providerProxy.request({method:"eth_gasPrice",params:[]})).toString()}}async fetchGasEstimatesViaEthFeeHistory(){const e=await this.providerProxy.request({method:"eth_feeHistory",params:[10,"latest",[10,50,95]]}),t=e.baseFeePerGas[e.baseFeePerGas.length-1],r=e.reward.reduce(((e,t)=>({slow:e.slow.plus(new om(t[0],16)),average:e.average.plus(new om(t[1],16)),fast:e.fast.plus(new om(t[2],16))})),{slow:new om(0),average:new om(0),fast:new om(0)});return{estimatedBaseFee:spe(t).toString(),high:{maxWaitTimeEstimate:3e4,minWaitTimeEstimate:15e3,suggestedMaxFeePerGas:spe(r.fast.plus(t).toString(16)).toString(),suggestedMaxPriorityFeePerGas:spe(r.fast.toString(16)).toString()},medium:{maxWaitTimeEstimate:45e3,minWaitTimeEstimate:15e3,suggestedMaxFeePerGas:spe(r.average.plus(t).toString(16)).toString(),suggestedMaxPriorityFeePerGas:spe(r.average.toString(16)).toString()},low:{maxWaitTimeEstimate:6e4,minWaitTimeEstimate:15e3,suggestedMaxFeePerGas:spe(r.slow.plus(t).toString(16)).toString(),suggestedMaxPriorityFeePerGas:spe(r.slow.toString(16)).toString()}}}async getEIP1559Compatibility(){const e=await this.providerProxy.request({method:"eth_getBlockByNumber",params:["latest",!1]});return!!(e&&void 0!==e.baseFeePerGas)}async fetchGasFeeEstimateData(){if(!this.chainConfig)throw new Error("Chain config not initialized");const e="0x1"===this.chainConfig.chainId,t=Number.parseInt(this.chainConfig.chainId,16);let r;try{if(this.isEIP1559Compatible){let e;try{if(!this.API_SUPPORTED_CHAINIDS.has(this.chainConfig.chainId))throw new Error("Chain id not supported by api");e=await async function(e){const t=await ed(e);return i(i({},t),{},{estimatedBaseFee:cpe(t.estimatedBaseFee),low:i(i({},t.low),{},{suggestedMaxPriorityFeePerGas:cpe(t.low.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:cpe(t.low.suggestedMaxFeePerGas)}),medium:i(i({},t.medium),{},{suggestedMaxPriorityFeePerGas:cpe(t.medium.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:cpe(t.medium.suggestedMaxFeePerGas)}),high:i(i({},t.high),{},{suggestedMaxPriorityFeePerGas:cpe(t.high.suggestedMaxPriorityFeePerGas),suggestedMaxFeePerGas:cpe(t.high.suggestedMaxFeePerGas)})})}("https://gas-api.metaswap.codefi.network/networks//suggestedGasFees".replace("",`${t}`))}catch(t){e=await this.fetchGasEstimatesViaEthFeeHistory()}r={gasFeeEstimates:e,gasEstimateType:ype}}else{if(!e)throw new Error("Main gas fee/price estimation failed. Use fallback");{const e=await async function(e){const t=await ed(e,{referrer:e,referrerPolicy:"no-referrer-when-downgrade",method:"GET",mode:"cors"});return{low:t.SafeGasPrice,medium:t.ProposeGasPrice,high:t.FastGasPrice}}("https://gas-api.metaswap.codefi.network/networks//gasPrices".replace("",`${t}`));r={gasFeeEstimates:e,gasEstimateType:vpe}}}}catch(e){try{r={gasFeeEstimates:await this.fetchEthGasPriceEstimate(),gasEstimateType:wpe}}catch(e){throw new Error(`Gas fee/price estimation failed. Message: ${e.message}`)}}return r}async getDefaultGasFees(e){if(!this.isEIP1559Compatible&&e.gasPrice||this.isEIP1559Compatible&&e.maxFeePerGas&&e.maxPriorityFeePerGas)return{};try{const{gasFeeEstimates:e,gasEstimateType:t}=await this.fetchGasFeeEstimateData();if(this.isEIP1559Compatible&&t===ype){const{medium:{suggestedMaxPriorityFeePerGas:t,suggestedMaxFeePerGas:r}={}}=e;if(t&&r)return{maxFeePerGas:n8(ape(r)),maxPriorityFeePerGas:n8(ape(t))}}else{if(t===vpe)return{gasPrice:n8(ape(e.medium))};if(t===wpe)return{gasPrice:n8(ape(e.gasPrice))}}}catch(e){vd.error(e)}const{gasPrice:t}=await this.fetchEthGasPriceEstimate();return{gasPrice:n8(ape(t))}}async estimateTxGas(e){const t=i({},e);delete t.gasPrice,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas;return await this.providerProxy.request({method:"eth_estimateGas",params:[t]})}async analyzeGasUsage(e){const t=await this.providerProxy.request({method:"eth_getBlockByNumber",params:["latest",!1]});let r=fpe(function(e,t,r){const n=new pH(t),i=new pH(r);return e.mul(n).div(i)}(dpe(t.gasLimit),19,20));try{r=await this.estimateTxGas(e)}catch(e){vd.warn(e)}return{blockGasLimit:t.gasLimit,estimatedGasHex:r}}addGasBuffer(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1.5;const n=dpe(e),i=dpe(t).muln(.9),o=n.muln(r);return n.gt(i)?fpe(n):o.lt(i)?fpe(o):fpe(i)}async determineTransactionCategory(e){const{data:t,to:r}=e;let n,i="";if(t&&!r)n=gpe;else{try{i=await this.providerProxy.request({method:"eth_getCode",params:[r,"latest"]})}catch(e){vd.warn(e)}n=!i||"0x"===i||"0x0"===i?mpe:bpe}return{transactionCategory:n,code:i}}async getDefaultGasLimit(e){const{transactionCategory:t}=await this.determineTransactionCategory(i({},e));if(e.gas)return e.gas;if(e.to&&t===mpe){if(e.data)throw Error("TxGasUtil - Trying to call a function on a non-contract address");return n8(21e3.toString(16))}const{blockGasLimit:r,estimatedGasHex:n}=await this.analyzeGasUsage(e);return this.addGasBuffer(n8(n),r)}}var Ape;class xpe extends EE{constructor(e){let{config:t,state:r}=e;super({config:{chainConfig:i(i({},t.chainConfig),{},{chainNamespace:nd.EIP155})},state:r})}async enable(){if(!this.state.privateKey)throw Vl.custom({message:"Private key is not found in state, plz pass it in constructor state param",code:4902});return await this.setupProvider(this.state.privateKey),this._providerEngineProxy.request({method:"eth_accounts"})}async setupProvider(e){const t=new Epe({getProviderEngineProxy:this.getProviderEngineProxy.bind(this)}),r=function(e){let{txFormatter:t,privKey:r,getProviderEngineProxy:n}=e;return{getAccounts:async e=>[`0x${_.from(v8(_.from(r,"hex"))).toString("hex")}`],getPrivateKey:async e=>r,processTransaction:async(e,i)=>{const o=n();if(!o)throw Vl.custom({message:"Provider is not initialized",code:4902});e.input&&!e.data&&(e.data=e.input);const a=await lpe(e,r,t);return await o.request({method:"eth_sendRawTransaction",params:["0x".concat(a.toString("hex"))]})},processSignTransaction:async(e,i)=>{if(!n())throw Vl.custom({message:"Provider is not initialized",code:4902});return e.input&&!e.data&&(e.data=e.input),`0x${(await lpe(e,r,t)).toString("hex")}`},processEthSignMessage:async(e,t)=>hE(r,e.data),processPersonalMessage:async(e,t)=>{const n=_.from(r,"hex");return b4.personalSign({privateKey:n,data:e.data})},processTypedMessage:async(e,t)=>{vd.debug("processTypedMessage",e);const o=_.from(r,"hex"),a=n();if(!a)throw Vl.custom({message:"Provider is not initialized",code:4902});const s=await a.request({method:"eth_chainId"}),c=Number.parseInt(s,Ed(s)?16:10),u=i(i({},e),{},{version:b4.SignTypedDataVersion.V1});upe(u,c);const l="string"==typeof u.data?JSON.parse(u.data):u.data;return b4.signTypedData({privateKey:o,data:l,version:b4.SignTypedDataVersion.V1})},processTypedMessageV3:async(e,t)=>{vd.debug("processTypedMessageV3",e);const i=_.from(r,"hex"),o=n();if(!o)throw Vl.custom({message:"Provider is not initialized",code:4902});const a=await o.request({method:"eth_chainId"}),s=Number.parseInt(a,Ed(a)?16:10);upe(e,s);const c="string"==typeof e.data?JSON.parse(e.data):e.data;return b4.signTypedData({privateKey:i,data:c,version:b4.SignTypedDataVersion.V3})},processTypedMessageV4:async(e,t)=>{vd.debug("processTypedMessageV4",e);const i=_.from(r,"hex"),o=n();if(!o)throw Vl.custom({message:"Provider is not initialized",code:4902});const a=await o.request({method:"eth_chainId"}),s=Number.parseInt(a,Ed(a)?16:10);upe(e,s);const c="string"==typeof e.data?JSON.parse(e.data):e.data;return b4.signTypedData({privateKey:i,data:c,version:b4.SignTypedDataVersion.V4})},processEncryptionPublicKey:async(e,t)=>(vd.info("processEncryptionPublicKey",e),b4.getEncryptionPublicKey(r)),processDecryptMessage:(e,t)=>{vd.info("processDecryptMessage",e);const n=L3(e.data),i=_.from(n,"hex");return b4.decrypt({encryptedData:JSON.parse(i.toString("utf8")),privateKey:r})}}}({txFormatter:t,privKey:e,getProviderEngineProxy:this.getProviderEngineProxy.bind(this)}),n=Hhe(r),o=this.getChainSwitchMiddleware(),a=new cf,{networkMiddleware:s}=Vhe(this.config.chainConfig);a.push(n),a.push(o),a.push(this.getAccountMiddleware()),a.push(s);const c=lf(a);this.updateProviderEngineProxy(c),await t.init(),await this.lookupNetwork()}async updateAccount(e){if(!this._providerEngineProxy)throw Vl.custom({message:"Provider is not initialized",code:4902});await this._providerEngineProxy.request({method:"eth_private_key"})!==e.privateKey&&(await this.setupProvider(e.privateKey),this.emit("accountsChanged",{accounts:await this._providerEngineProxy.request({method:"eth_accounts"})}))}async switchChain(e){if(!this._providerEngineProxy)throw Vl.custom({message:"Provider is not initialized",code:4902});const t=this.getChainConfig(e.chainId);this.update({chainId:"loading"}),this.configure({chainConfig:t});const r=await this._providerEngineProxy.request({method:"eth_private_key"});await this.setupProvider(r)}async lookupNetwork(){if(!this._providerEngineProxy)throw Vl.custom({message:"Provider is not initialized",code:4902});const{chainId:e}=this.config.chainConfig;if(!e)throw Kl.invalidParams("chainId is required while lookupNetwork");const t=await this._providerEngineProxy.request({method:"net_version",params:[]});if(parseInt(e,16)!==parseInt(t,10))throw Vl.chainDisconnected(`Invalid network, net_version is: ${t}`);return this.state.chainId!==e&&(this.emit("chainChanged",e),this.emit("connect",{chainId:e})),this.update({chainId:e}),t}getChainSwitchMiddleware(){return Ghe({addChain:async e=>{const{chainId:t,chainName:r,rpcUrls:n,blockExplorerUrls:i,nativeCurrency:o}=e;this.addChain({chainNamespace:nd.EIP155,chainId:t,ticker:(null==o?void 0:o.symbol)||"ETH",tickerName:(null==o?void 0:o.name)||"Ether",displayName:r,rpcTarget:n[0],blockExplorer:(null==i?void 0:i[0])||"",decimals:(null==o?void 0:o.decimals)||18})},switchChain:async e=>{const{chainId:t}=e;await this.switchChain({chainId:t})}})}getAccountMiddleware(){return function(e){let{updatePrivatekey:t}=e;return af({wallet_updateAccount:sf((async function(e,r){var n;const i=null!==(n=e.params)&&void 0!==n&&n.length?e.params[0]:void 0;if(null==i||!i.privateKey)throw Kl.invalidParams("Missing privateKey");r.result=await t(i)}))})}({updatePrivatekey:async e=>{const{privateKey:t}=e;await this.updateAccount({privateKey:t})}})}}function _pe(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}Ape=xpe,r(xpe,"getProviderInstance",(async e=>{const t=new Ape({config:{chainConfig:e.chainConfig}});return await t.setupProvider(e.privKey),t}));let kpe=class e extends Error{constructor(t,r={}){super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"viem@2.9.8"});const n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,i=r.cause instanceof e&&r.cause.docsPath||r.docsPath;this.message=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: https://viem.sh${i}${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join("\n"),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=i,this.metaMessages=r.metaMessages,this.shortMessage=t}walk(e){return Spe(this,e)}};function Spe(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e?Spe(e.cause,t):t?null:e}class Ppe extends kpe{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}}class Ipe extends kpe{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidBytesBooleanError"})}}class Tpe extends kpe{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}}function Ope(e,{strict:t=!0}={}){return!!e&&("string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")))}function Mpe(e){return Ope(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function Cpe(e,{dir:t="left"}={}){let r="string"==typeof e?e.replace("0x",""):e,n=0;for(let e=0;er)throw new Npe({size:e.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let i=0;i2*r)throw new Npe({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}const Upe=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function jpe(e,t={}){return"number"==typeof e||"bigint"==typeof e?$pe(e,t):"string"==typeof e?Gpe(e,t):"boolean"==typeof e?Dpe(e,t):zpe(e,t)}function Dpe(e,t={}){const r=`0x${Number(e)}`;return"number"==typeof t.size?(Ype(r,{size:t.size}),Fpe(r,{size:t.size})):r}function zpe(e,t={}){let r="";for(let t=0;to||i=Vpe.zero&&e<=Vpe.nine?e-Vpe.zero:e>=Vpe.A&&e<=Vpe.F?e-(Vpe.A-10):e>=Vpe.a&&e<=Vpe.f?e-(Vpe.a-10):void 0}function Jpe(e,t={}){let r=e;t.size&&(Ype(r,{size:t.size}),r=Fpe(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;et)throw new Tpe({givenSize:Mpe(e),maxSize:t})}function Xpe(e,t={}){const{signed:r}=t;t.size&&Ype(e,{size:t.size});const n=BigInt(e);if(!r)return n;const i=(e.length-2)/2;return n<=(1n<<8n*BigInt(i)-1n)-1n?n:n-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function Qpe(e,t={}){return Number(Xpe(e,t))}const eme={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844"};function tme(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Qpe(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Qpe(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?eme[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if("bigint"==typeof t.v){if(0n===t.v||27n===t.v)return 0;if(1n===t.v||28n===t.v)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),"legacy"===t.type&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),"eip2930"===t.type&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),"eip1559"===t.type&&delete t.maxFeePerBlobGas,t}function rme(e){const t=e.transactions?.map((e=>"string"==typeof e?e:tme(e)));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}function nme(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}const ime={"0x0":"reverted","0x1":"success"};function ome(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((e=>nme(e))):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Qpe(e.transactionIndex):null,status:e.status?ime[e.status]:null,type:e.type?eme[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}class ame extends kpe{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}class sme extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}set(e,t){return super.set(e,t),this.maxSize&&this.size>this.maxSize&&this.delete(this.keys().next().value),this}}function cme(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function ume(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function lme(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}const fme=BigInt(2**32-1),dme=BigInt(32);function hme(e,t=!1){return t?{h:Number(e&fme),l:Number(e>>dme&fme)}:{h:0|Number(e>>dme&fme),l:0|Number(e&fme)}}function pme(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;ie instanceof Uint8Array;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function bme(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!mme(e))throw new Error("expected Uint8Array, got "+typeof e);return e}let gme=class{clone(){return this._cloneInto()}};const[yme,vme,wme]=[[],[],[]],Eme=BigInt(0),Ame=BigInt(1),xme=BigInt(2),_me=BigInt(7),kme=BigInt(256),Sme=BigInt(113);for(let e=0,t=Ame,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],yme.push(2*(5*n+r)),vme.push((e+1)*(e+2)/2%64);let i=Eme;for(let e=0;e<7;e++)t=(t<>_me)*Sme)%kme,t&xme&&(i^=Ame<<(Ame<r>32?((e,t,r)=>t<>>64-r)(e,t,r):((e,t,r)=>e<>>32-r)(e,t,r),Ome=(e,t,r)=>r>32?((e,t,r)=>e<>>64-r) /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */(e,t,r):((e,t,r)=>t<>>32-r)(e,t,r);class Mme extends gme{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,cme(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)))(this.state)}keccak(){!function(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=Tme(o,a,1)^r[n],c=Ome(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=vme[r],o=Tme(t,i,n),a=Ome(t,i,n),s=yme[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=Pme[n],e[1]^=Ime[n]}r.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){lme(this);const{blockLen:t,state:r}=this,n=(e=bme(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return cme(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(function(e,t){ume(e);const r=t.outputLen;if(e.lengthfunction(e){const t=t=>e().update(bme(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}((()=>new Mme(t,e,r))),Bme=Cme(1,136,32);function Nme(e,t){const r=t||"hex",n=Bme(Ope(e,{strict:!1})?Kpe(e):e);return"bytes"===r?n:jpe(n)}function Rme(e,t){const r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=Nme(Zpe(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());return`0x${i.join("")}`}const Fme=/^0x[a-fA-F0-9]{40}$/,Lme=new sme(8192);function Ume(e,t){const{strict:r=!0}=t??{};if(Lme.has(e))return Lme.get(e);const n=!(!Fme.test(e)||e.toLowerCase()!==e&&r&&Rme(e)!==e);return Lme.set(e,n),n}function jme(e){return"string"==typeof e[0]?Dme(e):function(e){let t=0;for(const r of e)t+=r.length;const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(e)}function Dme(e){return`0x${e.reduce(((e,t)=>e+t.replace("0x","")),"")}`}class zme extends Error{constructor(e,t={}){const r=t.cause instanceof zme?t.cause.details:t.cause?.message?t.cause.message:t.details,n=t.cause instanceof zme&&t.cause.docsPath||t.docsPath;super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: https://abitype.dev${n}`]:[],...r?[`Details: ${r}`]:[],"Version: abitype@1.0.0"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),t.cause&&(this.cause=t.cause),this.details=r,this.docsPath=n,this.metaMessages=t.metaMessages,this.shortMessage=e}}function $me(e,t){const r=e.exec(t);return r?.groups}const Hme=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Gme=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,qme=/^\(.+?\).*?$/,Kme=/^tuple(?(\[(\d*)\])*)$/;function Vme(e){let t=e.type;if(Kme.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let n=0;n[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;const Zme=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;const Yme=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;const Xme=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function Qme(e){return Xme.test(e)}function ebe(e){return $me(Xme,e)}const tbe=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;const rbe=/^fallback\(\)$/;const nbe=/^receive\(\) external payable$/;const ibe=new Set(["indexed"]),obe=new Set(["calldata","memory","storage"]);class abe extends zme{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class sbe extends zme{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class cbe extends zme{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class ube extends zme{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class lbe extends zme{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class fbe extends zme{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class dbe extends zme{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class hbe extends zme{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class pbe extends zme{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class mbe extends zme{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class bbe extends zme{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class gbe extends zme{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}const ybe=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function vbe(e,t={}){if(function(e){return Yme.test(e)}(e)){const r=function(e){return $me(Yme,e)}(e);if(!r)throw new hbe({signature:e,type:"function"});const n=_be(r.parameters),i=[],o=n.length;for(let e=0;e[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Ebe=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Abe=/^u?int$/;function xbe(e,t){const r=function(e,t){return t?`${t}:${e}`:e}(e,t?.type);if(ybe.has(r))return ybe.get(r);const n=qme.test(e),i=$me(n?Ebe:wbe,e);if(!i)throw new cbe({param:e});if(i.name&&function(e){return"address"===e||"bool"===e||"function"===e||"string"===e||"tuple"===e||Hme.test(e)||Gme.test(e)||Sbe.test(e)}(i.name))throw new ube({param:e,name:i.name});const o=i.name?{name:i.name}:{},a="indexed"===i.modifier?{indexed:!0}:{},s=t?.structs??{};let c,u={};if(n){c="tuple";const e=_be(i.type),t=[],r=e.length;for(let n=0;n[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function Ibe(e,t,r=new Set){const n=[],i=e.length;for(let o=0;oe[t.name||r]?.(n)??t(e,n)}function Mbe(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new Qbe(e.type);return`${e.name}(${Cbe(e.inputs,{includeName:t})})`}function Cbe(e,{includeName:t=!1}={}){return e?e.map((e=>function(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${Cbe(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}(e,{includeName:t}))).join(t?", ":","):""}class Bbe extends kpe{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"})}}class Nbe extends kpe{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join("\n"),{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"})}}class Rbe extends kpe{constructor({data:e,params:t,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join("\n"),{metaMessages:[`Params: (${Cbe(t,{includeName:!0})})`,`Data: ${e} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=r}}class Fbe extends kpe{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}}class Lbe extends kpe{constructor({expectedLength:e,givenLength:t,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}}class Ube extends kpe{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${Mpe(t)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}}class jbe extends kpe{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}}class Dbe extends kpe{constructor(e,{docsPath:t}){super([`Encoded error signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class zbe extends kpe{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureEmptyTopicsError"})}}class $be extends kpe{constructor(e,{docsPath:t}){super([`Encoded event signature "${e}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${e}.`].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"})}}class Hbe extends kpe{constructor(e,{docsPath:t}={}){super([`Event ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"})}}class Gbe extends kpe{constructor(e,{docsPath:t}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}}class qbe extends kpe{constructor(e,{docsPath:t}){super([`Function "${e}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"})}}class Kbe extends kpe{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Mbe(e.abiItem)}\`, and`,`\`${t.type}\` in \`${Mbe(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}}class Vbe extends kpe{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}}class Wbe extends kpe{constructor({abiItem:e,data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for non-indexed event parameters.`].join("\n"),{metaMessages:[`Params: (${Cbe(r,{includeName:!0})})`,`Data: ${t} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=r,this.size=n}}class Jbe extends kpe{constructor({abiItem:e,param:t}){super([`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${Mbe(e,{includeName:!0})}".`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class Zbe extends kpe{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}}class Ybe extends kpe{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"})}}class Xbe extends kpe{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}}class Qbe extends kpe{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}}class ege extends kpe{constructor(e){super(`Filter type "${e}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}}const tge=e=>Nme(Kpe(e));const rge=e=>{var t;return function(e){let t=!0,r="",n=0,i="",o=!1;for(let a=0;a0&&t>Mpe(e)-1)throw new Bpe({offset:t,position:"start",size:Mpe(e)})}function sge(e,t,r){if("number"==typeof t&&"number"==typeof r&&Mpe(e)!==r-t)throw new Bpe({offset:r,position:"end",size:Mpe(e)})}function cge(e,t,r,{strict:n}={}){age(e,t);const i=e.slice(t,r);return n&&sge(i,t,r),i}function uge(e,t){if(e.length!==t.length)throw new jbe({expectedLength:e.length,givenLength:t.length});const r=function({params:e,values:t}){const r=[];for(let n=0;n0?jme([t,e]):t}}if(i)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:jme(o.map((({encoded:e})=>e)))}}(t,{length:n,param:{...e,type:i}})}if("tuple"===e.type)return function(e,{param:t}){let r=!1;const n=[];for(let i=0;ie)))}}(t,{param:e});if("address"===e.type)return function(e){if(!Ume(e))throw new ame({address:e});return{dynamic:!1,encoded:Lpe(e.toLowerCase())}}(t);if("bool"===e.type)return function(e){if("boolean"!=typeof e)throw new kpe(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Lpe(Dpe(e))}}(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){return function(e,{signed:t}){return{dynamic:!1,encoded:$pe(e,{size:32,signed:t})}}(t,{signed:e.type.startsWith("int")})}if(e.type.startsWith("bytes"))return function(e,{param:t}){const[,r]=t.type.split("bytes"),n=Mpe(e);if(!r){let t=e;return n%32!=0&&(t=Lpe(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:jme([Lpe($pe(n,{size:32})),t])}}if(n!==parseInt(r))throw new Ube({expectedSize:parseInt(r),value:e});return{dynamic:!1,encoded:Lpe(e,{dir:"right"})}}(t,{param:e});if("string"===e.type)return function(e){const t=Gpe(e),r=Math.ceil(Mpe(t)/32),n=[];for(let e=0;eoge(nge(e),0,4);function pge(e){const{abi:t,args:r=[],name:n}=e,i=Ope(n,{strict:!1}),o=t.filter((e=>i?"function"===e.type?hge(e)===n:"event"===e.type&&ige(e)===n:"name"in e&&e.name===n));if(0===o.length)return;if(1===o.length)return o[0];let a;for(const e of o){if(!("inputs"in e))continue;if(!r||0===r.length){if(!e.inputs||0===e.inputs.length)return e;continue}if(!e.inputs)continue;if(0===e.inputs.length)continue;if(e.inputs.length!==r.length)continue;const t=r.every(((t,r)=>{const n="inputs"in e&&e.inputs[r];return!!n&&mge(t,n)}));if(t){if(a&&"inputs"in a&&a.inputs){const t=bge(e.inputs,a.inputs,r);if(t)throw new Kbe({abiItem:e,type:t[0]},{abiItem:a,type:t[1]})}a=e}}return a||o[0]}function mge(e,t){const r=typeof e,n=t.type;switch(n){case"address":return Ume(e,{strict:!1});case"bool":return"boolean"===r;case"function":case"string":return"string"===r;default:return"tuple"===n&&"components"in t?Object.values(t.components).every(((t,r)=>mge(Object.values(e)[r],t))):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?"number"===r||"bigint"===r:/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?"string"===r||e instanceof Uint8Array:!!/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)&&(Array.isArray(e)&&e.every((e=>mge(e,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")}))))}}function bge(e,t,r){for(const n in e){const i=e[n],o=t[n];if("tuple"===i.type&&"tuple"===o.type&&"components"in i&&"components"in o)return bge(i.components,o.components,r[n]);const a=[i.type,o.type];if(!(!a.includes("address")||!a.includes("bytes20"))||(a.includes("address")&&a.includes("string")||!(!a.includes("address")||!a.includes("bytes")))&&Ume(r[n],{strict:!1}))return a}}const gge="/docs/contract/encodeEventTopics";function yge(e){const{abi:t,eventName:r,args:n}=e;let i=t[0];if(r){const e=pge({abi:t,name:r});if(!e)throw new Hbe(r,{docsPath:gge});i=e}if("event"!==i.type)throw new Hbe(void 0,{docsPath:gge});const o=Mbe(i),a=ige(o);let s=[];if(n&&"inputs"in i){const e=i.inputs?.filter((e=>"indexed"in e&&e.indexed)),t=Array.isArray(n)?n:Object.values(n).length>0?e?.map((e=>n[e.name]))??[]:[];t.length>0&&(s=e?.map(((e,r)=>Array.isArray(t[r])?t[r].map(((n,i)=>vge({param:e,value:t[r][i]}))):t[r]?vge({param:e,value:t[r]}):null))??[])}return[a,...s]}function vge({param:e,value:t}){if("string"===e.type||"bytes"===e.type)return Nme(Kpe(t));if("tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))throw new ege(e.type);return uge([e],[t])}function wge(e,{method:t}){const r={};return"fallback"===e.transport.type&&e.transport.onResponse?.((({method:e,response:n,status:i,transport:o})=>{"success"===i&&t===e&&(r[n]=o.request)})),t=>r[t]||e.request}async function Ege(e,t){const{address:r,abi:n,args:i,eventName:o,fromBlock:a,strict:s,toBlock:c}=t,u=wge(e,{method:"eth_newFilter"}),l=o?yge({abi:n,args:i,eventName:o}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:r,fromBlock:"bigint"==typeof a?$pe(a):a,toBlock:"bigint"==typeof c?$pe(c):c,topics:l}]});return{abi:n,args:i,eventName:o,id:f,request:u(f),strict:Boolean(s),type:"event"}}function Age(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}const xge="/docs/contract/encodeFunctionData";function _ge(e){const{args:t}=e,{abi:r,functionName:n}=1===e.abi.length&&e.functionName?.startsWith("0x")?e:function(e){const{abi:t,args:r,functionName:n}=e;let i=t[0];if(n){const e=pge({abi:t,args:r,name:n});if(!e)throw new Gbe(n,{docsPath:xge});i=e}if("function"!==i.type)throw new Gbe(void 0,{docsPath:xge});return{abi:[i],functionName:hge(Mbe(i))}}(e),i=r[0];return Dme([n,("inputs"in i&&i.inputs?uge(i.inputs,t??[]):void 0)??"0x"])}const kge={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Sge={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Pge={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Ige extends kpe{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NegativeOffsetError"})}}class Tge extends kpe{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PositionOutOfBoundsError"})}}class Oge extends kpe{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RecursiveReadLimitExceededError"})}}const Mge={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:1/0,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Oge({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Tge({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Ige({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new Ige({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===1/0)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Cge(e,t={}){void 0!==t.size&&Ype(e,{size:t.size});return Xpe(zpe(e,t),t)}function Bge(e,t={}){let r=e;if(void 0!==t.size&&(Ype(r,{size:t.size}),r=Cpe(r)),r.length>1||r[0]>1)throw new Ipe(r);return Boolean(r[0])}function Nge(e,t={}){void 0!==t.size&&Ype(e,{size:t.size});return Qpe(zpe(e,t),t)}function Rge(e,t){const r="string"==typeof t?Jpe(t):t,n=function(e,{recursiveReadLimit:t=8192}={}){const r=Object.create(Mge);return r.bytes=e,r.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}(r);if(0===Mpe(r)&&e.length>0)throw new Fbe;if(Mpe(t)&&Mpe(t)<32)throw new Rbe({data:"string"==typeof t?t:zpe(t),params:e,size:Mpe(t)});let i=0;const o=[];for(let t=0;t!e)),i=n?[]:{};let o=0;if(jge(t)){const a=r+Nge(e.readBytes(Uge));for(let r=0;r48?Cge(i,{signed:r}):Nge(i,{signed:r}),32]}(e,t);if("string"===t.type)return function(e,{staticPosition:t}){const r=Nge(e.readBytes(32)),n=t+r;e.setPosition(n);const i=Nge(e.readBytes(32));if(0===i)return e.setPosition(t+32),["",32];const o=e.readBytes(i,32),a=function(e,t={}){let r=e;return void 0!==t.size&&(Ype(r,{size:t.size}),r=Cpe(r,{dir:"right"})),(new TextDecoder).decode(r)}(Cpe(o));return e.setPosition(t+32),[a,32]}(e,{staticPosition:r});throw new Ybe(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Lge=32,Uge=32;function jge(e){const{type:t}=e;if("string"===t)return!0;if("bytes"===t)return!0;if(t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some(jge);const r=dge(e.type);return!(!r||!jge({...e,type:r[1]}))}function Dge(e){const{abi:t,data:r}=e,n=oge(r,0,4);if("0x"===n)throw new Fbe;const i=[...t||[],Sge,Pge].find((e=>"error"===e.type&&n===hge(Mbe(e))));if(!i)throw new Dbe(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:i,args:"inputs"in i&&i.inputs&&i.inputs.length>0?Rge(i.inputs,oge(r,4)):void 0,errorName:i.name}}const zge=(e,t,r)=>JSON.stringify(e,((e,r)=>{const n="bigint"==typeof r?r.toString():r;return"function"==typeof t?t(e,n):n}),r);function $ge({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map(((e,r)=>`${n&&e.name?`${e.name}: `:""}${"object"==typeof t[r]?zge(t[r]):t[r]}`)).join(", ")})`}const Hge={gwei:9,wei:18},Gge={ether:-9,wei:9};function qge(e,t){let r=e.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[i,o]=[r.slice(0,r.length-t),r.slice(r.length-t)];return o=o.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${o?`.${o}`:""}`}function Kge(e,t="wei"){return qge(e,Hge[t])}function Vge(e,t="wei"){return qge(e,Gge[t])}class Wge extends kpe{constructor({address:e}){super(`State for account "${e}" is set multiple times.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountStateConflictError"})}}class Jge extends kpe{constructor(){super("state and stateDiff are set on the same account."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"StateAssignmentConflictError"})}}function Zge(e){return e.reduce(((e,{slot:t,value:r})=>`${e} ${t}: ${r}\n`),"")}function Yge(e){const t=Object.entries(e).map((([e,t])=>void 0===t||!1===t?null:[e,t])).filter(Boolean),r=t.reduce(((e,[t])=>Math.max(e,t.length)),0);return t.map((([e,t])=>` ${`${e}:`.padEnd(r+1)} ${t}`)).join("\n")}class Xge extends kpe{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join("\n")),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"})}}class Qge extends kpe{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Yge(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}}class eye extends kpe{constructor({blockHash:e,blockNumber:t,blockTag:r,hash:n,index:i}){let o="Transaction";r&&void 0!==i&&(o=`Transaction at block time "${r}" at index "${i}"`),e&&void 0!==i&&(o=`Transaction at block hash "${e}" at index "${i}"`),t&&void 0!==i&&(o=`Transaction at block number "${t}" at index "${i}"`),n&&(o=`Transaction with hash "${n}"`),super(`${o} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"})}}class tye extends kpe{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionReceiptNotFoundError"})}}class rye extends kpe{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WaitForTransactionReceiptTimeoutError"})}}class nye extends kpe{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f,stateOverride:d}){const h=t?Age(t):void 0;let p=Yge({from:h?.address,to:l,value:void 0!==f&&`${Kge(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${Vge(a)} gwei`,maxFeePerGas:void 0!==s&&`${Vge(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${Vge(c)} gwei`,nonce:u});d&&(p+=`\n${function(e){return e.reduce(((e,{address:t,...r})=>{let n=`${e} ${t}:\n`;return r.nonce&&(n+=` nonce: ${r.nonce}\n`),r.balance&&(n+=` balance: ${r.balance}\n`),r.code&&(n+=` code: ${r.code}\n`),r.state&&(n+=" state:\n",n+=Zge(r.state)),r.stateDiff&&(n+=" stateDiff:\n",n+=Zge(r.stateDiff)),n})," State Override:\n").slice(0,-1)}(d)}`),super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",p].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CallExecutionError"}),this.cause=e}}class iye extends kpe{constructor(e,{abi:t,args:r,contractAddress:n,docsPath:i,functionName:o,sender:a}){const s=pge({abi:t,args:r,name:o}),c=s?$ge({abiItem:s,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=Yge({address:n&&n,function:s?Mbe(s,{includeName:!0}):void 0,args:c&&"()"!==c&&`${[...Array(o?.length??0).keys()].map((()=>" ")).join("")}${c}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${o}".`,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Contract Call:",u].filter(Boolean)}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionExecutionError"}),this.abi=t,this.args=r,this.cause=e,this.contractAddress=n,this.functionName=o,this.sender=a}}class oye extends kpe{constructor({abi:e,data:t,functionName:r,message:n}){let i,o,a,s,c;if(t&&"0x"!==t)try{o=Dge({abi:e,data:t});const{abiItem:r,errorName:n,args:i}=o;if("Error"===n)s=i[0];else if("Panic"===n){const[e]=i;s=kge[e]}else{const e=r?Mbe(r,{includeName:!0}):void 0,t=r&&i?$ge({abiItem:r,args:i,includeFunctionName:!1,includeName:!1}):void 0;a=[e?`Error: ${e}`:"",t&&"()"!==t?` ${[...Array(n?.length??0).keys()].map((()=>" ")).join("")}${t}`:""]}}catch(e){i=e}else n&&(s=n);i instanceof Dbe&&(c=i.signature,a=[`Unable to decode signature "${c}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${c}.`]),super(s&&"execution reverted"!==s||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,s||c].join("\n"):`The contract function "${r}" reverted.`,{cause:i,metaMessages:a}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=o,this.reason=s,this.signature=c}}class aye extends kpe{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionZeroDataError"})}}class sye extends kpe{constructor({data:e,message:t}){super(t||""),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RawContractError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}class cye extends kpe{constructor({body:e,details:t,headers:r,status:n,url:i}){super("HTTP request failed.",{details:t,metaMessages:[n&&`Status: ${n}`,`URL: ${i}`,e&&`Request body: ${zge(e)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=r,this.status=n,this.url=i}}class uye extends kpe{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${r}`,`Request body: ${zge(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code}}class lye extends kpe{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${t}`,`Request body: ${zge(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}}class fye extends kpe{constructor(e,{code:t,docsPath:r,metaMessages:n,shortMessage:i}){super(i,{cause:e,docsPath:r,metaMessages:n||e?.metaMessages}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=e.name,this.code=e instanceof uye?e.code:t??-1}}class dye extends fye{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class hye extends fye{constructor(e){super(e,{code:hye.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"})}}Object.defineProperty(hye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class pye extends fye{constructor(e){super(e,{code:pye.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}}Object.defineProperty(pye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class mye extends fye{constructor(e){super(e,{code:mye.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}}Object.defineProperty(mye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class bye extends fye{constructor(e){super(e,{code:bye.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}}Object.defineProperty(bye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class gye extends fye{constructor(e){super(e,{code:gye.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}}Object.defineProperty(gye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class yye extends fye{constructor(e){super(e,{code:yye.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join("\n")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}}Object.defineProperty(yye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class vye extends fye{constructor(e){super(e,{code:vye.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(vye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class wye extends fye{constructor(e){super(e,{code:wye.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}}Object.defineProperty(wye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Eye extends fye{constructor(e){super(e,{code:Eye.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}}Object.defineProperty(Eye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Aye extends fye{constructor(e){super(e,{code:Aye.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}}Object.defineProperty(Aye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class xye extends fye{constructor(e){super(e,{code:xye.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}}Object.defineProperty(xye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class _ye extends fye{constructor(e){super(e,{code:_ye.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}}Object.defineProperty(_ye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class kye extends dye{constructor(e){super(e,{code:kye.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}}Object.defineProperty(kye,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Sye extends dye{constructor(e){super(e,{code:Sye.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"})}}Object.defineProperty(Sye,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Pye extends dye{constructor(e){super(e,{code:Pye.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}}Object.defineProperty(Pye,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Iye extends dye{constructor(e){super(e,{code:Iye.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}}Object.defineProperty(Iye,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Tye extends dye{constructor(e){super(e,{code:Tye.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"})}}Object.defineProperty(Tye,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Oye extends dye{constructor(e){super(e,{code:Oye.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}}Object.defineProperty(Oye,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Mye extends fye{constructor(e){super(e,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}}const Cye=3;function Bye(e,{abi:t,address:r,args:n,docsPath:i,functionName:o,sender:a}){const{code:s,data:c,message:u,shortMessage:l}=e instanceof sye?e:e instanceof kpe?e.walk((e=>"data"in e))||e.walk():{},f=e instanceof Fbe?new aye({functionName:o}):[Cye,gye.code].includes(s)&&(c||u||l)?new oye({abi:t,data:"object"==typeof c?c.data:c,functionName:o,message:l??u}):e;return new iye(f,{abi:t,args:n,contractAddress:r,docsPath:i,functionName:o,sender:a})}class Nye extends kpe{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:o,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:l,value:f}){const d=Yge({from:t?.address,to:l,value:void 0!==f&&`${Kge(f)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:o,gasPrice:void 0!==a&&`${Vge(a)} gwei`,maxFeePerGas:void 0!==s&&`${Vge(s)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${Vge(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",d].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EstimateGasExecutionError"}),this.cause=e}}class Rye extends kpe{constructor({cause:e,message:t}={}){const r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}}Object.defineProperty(Rye,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(Rye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Fye extends kpe{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${Vge(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"})}}Object.defineProperty(Fye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Lye extends kpe{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${Vge(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"})}}Object.defineProperty(Lye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class Uye extends kpe{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}}Object.defineProperty(Uye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class jye extends kpe{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}}Object.defineProperty(jye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Dye extends kpe{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}}Object.defineProperty(Dye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class zye extends kpe{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"})}}Object.defineProperty(zye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});class $ye extends kpe{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"})}}Object.defineProperty($ye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Hye extends kpe{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}}Object.defineProperty(Hye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Gye extends kpe{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Gye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class qye extends kpe{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${Vge(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Vge(r)} gwei`:""}).`].join("\n"),{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}}Object.defineProperty(qye,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class Kye extends kpe{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"})}}function Vye(e,t){const r=(e.details||"").toLowerCase(),n=e instanceof kpe?e.walk((e=>e.code===Rye.code)):e;return n instanceof kpe?new Rye({cause:e,message:n.details}):Rye.nodeMessage.test(r)?new Rye({cause:e,message:e.details}):Fye.nodeMessage.test(r)?new Fye({cause:e,maxFeePerGas:t?.maxFeePerGas}):Lye.nodeMessage.test(r)?new Lye({cause:e,maxFeePerGas:t?.maxFeePerGas}):Uye.nodeMessage.test(r)?new Uye({cause:e,nonce:t?.nonce}):jye.nodeMessage.test(r)?new jye({cause:e,nonce:t?.nonce}):Dye.nodeMessage.test(r)?new Dye({cause:e,nonce:t?.nonce}):zye.nodeMessage.test(r)?new zye({cause:e}):$ye.nodeMessage.test(r)?new $ye({cause:e,gas:t?.gas}):Hye.nodeMessage.test(r)?new Hye({cause:e,gas:t?.gas}):Gye.nodeMessage.test(r)?new Gye({cause:e}):qye.nodeMessage.test(r)?new qye({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new Kye({cause:e})}function Wye(e,{format:t}){if(!t)return{};const r={};return function t(n){const i=Object.keys(n);for(const o of i)o in e&&(r[o]=e[o]),n[o]&&"object"==typeof n[o]&&!Array.isArray(n[o])&&t(n[o])}(t(e||{})),r}const Jye={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3"};function Zye(e){const t={...e};return void 0!==e.blobs&&"string"!=typeof e.blobs[0]&&(t.blobs=e.blobs.map((e=>zpe(e)))),void 0!==e.gas&&(t.gas=$pe(e.gas)),void 0!==e.gasPrice&&(t.gasPrice=$pe(e.gasPrice)),void 0!==e.maxFeePerBlobGas&&(t.maxFeePerBlobGas=$pe(e.maxFeePerBlobGas)),void 0!==e.maxFeePerGas&&(t.maxFeePerGas=$pe(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=$pe(e.maxPriorityFeePerGas)),void 0!==e.nonce&&(t.nonce=$pe(e.nonce)),void 0!==e.type&&(t.type=Jye[e.type]),void 0!==e.value&&(t.value=$pe(e.value)),t}function Yye(e){const{account:t,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:i,to:o}=e,a=t?Age(t):void 0;if(a&&!Ume(a.address))throw new ame({address:a.address});if(o&&!Ume(o))throw new ame({address:o});if(void 0!==r&&(void 0!==n||void 0!==i))throw new Xge;if(n&&n>2n**256n-1n)throw new Fye({maxFeePerGas:n});if(i&&n&&i>n)throw new qye({maxFeePerGas:n,maxPriorityFeePerGas:i})}class Xye extends kpe{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class Qye extends kpe{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class eve extends kpe{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Vge(e)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class tve extends kpe{constructor({blockHash:e,blockNumber:t}){let r="Block";e&&(r=`Block at hash "${e}"`),t&&(r=`Block at number "${t}"`),super(`${r} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}async function rve(e,{blockHash:t,blockNumber:r,blockTag:n,includeTransactions:i}={}){const o=n??"latest",a=i??!1,s=void 0!==r?$pe(r):void 0;let c=null;if(c=t?await e.request({method:"eth_getBlockByHash",params:[t,a]}):await e.request({method:"eth_getBlockByNumber",params:[s||o,a]}),!c)throw new tve({blockHash:t,blockNumber:r});return(e.chain?.formatters?.block?.format||rme)(c)}async function nve(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function ive(e,t){const{block:r,chain:n=e.chain,request:i}=t||{};if("function"==typeof n?.fees?.defaultPriorityFee){const t=r||await Obe(e,rve,"getBlock")({});return n.fees.defaultPriorityFee({block:t,client:e,request:i})}if(void 0!==n?.fees?.defaultPriorityFee)return n?.fees?.defaultPriorityFee;try{return Xpe(await e.request({method:"eth_maxPriorityFeePerGas"}))}catch{const[t,n]=await Promise.all([r?Promise.resolve(r):Obe(e,rve,"getBlock")({}),Obe(e,nve,"getGasPrice")({})]);if("bigint"!=typeof t.baseFeePerGas)throw new Qye;const i=n-t.baseFeePerGas;return i<0n?0n:i}}async function ove(e,t){const{block:r,chain:n=e.chain,request:i,type:o="eip1559"}=t||{},a=await(async()=>"function"==typeof n?.fees?.baseFeeMultiplier?n.fees.baseFeeMultiplier({block:r,client:e,request:i}):n?.fees?.baseFeeMultiplier??1.2)();if(a<1)throw new Xye;const s=10**(a.toString().split(".")[1]?.length??0),c=e=>e*BigInt(Math.ceil(a*s))/BigInt(s),u=r||await Obe(e,rve,"getBlock")({});if("function"==typeof n?.fees?.estimateFeesPerGas){const t=await n.fees.estimateFeesPerGas({block:r,client:e,multiply:c,request:i,type:o});if(null!==t)return t}if("eip1559"===o){if("bigint"!=typeof u.baseFeePerGas)throw new Qye;const t="bigint"==typeof i?.maxPriorityFeePerGas?i.maxPriorityFeePerGas:await ive(e,{block:u,chain:n,request:i}),r=c(u.baseFeePerGas);return{maxFeePerGas:i?.maxFeePerGas??r+t,maxPriorityFeePerGas:t}}return{gasPrice:i?.gasPrice??c(await Obe(e,nve,"getGasPrice")({}))}}async function ave(e,{address:t,blockTag:r="latest",blockNumber:n}){return Qpe(await e.request({method:"eth_getTransactionCount",params:[t,n?$pe(n):r]}))}async function sve(e){return Qpe(await e.request({method:"eth_chainId"}))}async function cve(e,t){const{account:r=e.account,chain:n,chainId:i,gas:o,nonce:a,parameters:s=["chainId","fees","gas","nonce","type"],type:c}=t,u=r?Age(r):void 0,l={...t,...u?{from:u?.address}:{}};s.includes("chainId")&&(l.chainId=n?n.id:void 0!==i?i:await Obe(e,sve,"getChainId")({})),s.includes("nonce")&&void 0===a&&u&&(l.nonce=await Obe(e,ave,"getTransactionCount")({address:u.address,blockTag:"pending"}));const f=await(()=>{if(void 0===l.type)return Obe(e,rve,"getBlock")({blockTag:"latest"})})();if((s.includes("fees")||s.includes("type"))&&void 0===c)try{l.type=function(e){if(e.type)return e.type;if(void 0!==e.blobs||void 0!==e.blobVersionedHashes||void 0!==e.maxFeePerBlobGas||void 0!==e.sidecars)return"eip4844";if(void 0!==e.maxFeePerGas||void 0!==e.maxPriorityFeePerGas)return"eip1559";if(void 0!==e.gasPrice)return void 0!==e.accessList?"eip2930":"legacy";throw new Qge({transaction:e})}(l)}catch{l.type="bigint"==typeof f?.baseFeePerGas?"eip1559":"legacy"}if(s.includes("fees"))if("eip1559"===l.type||"eip4844"===l.type){if(void 0===l.maxFeePerGas||void 0===l.maxPriorityFeePerGas){const{maxFeePerGas:r,maxPriorityFeePerGas:i}=await ove(e,{block:f,chain:n,request:l});if(void 0===t.maxPriorityFeePerGas&&t.maxFeePerGas&&t.maxFeePerGas{const t=Vye(e,r);return t instanceof Kye?e:t})();return new Nye(n,{docsPath:t,...r})}(r,{...t,account:n,chain:e.chain})}}const lve="/docs/contract/decodeEventLog";function fve(e){const{abi:t,data:r,strict:n,topics:i}=e,o=n??!0,[a,...s]=i;if(!a)throw new zbe({docsPath:lve});const c=t.find((e=>"event"===e.type&&a===ige(Mbe(e))));if(!c||!("name"in c)||"event"!==c.type)throw new $be(a,{docsPath:lve});const{name:u,inputs:l}=c,f=l?.some((e=>!("name"in e&&e.name)));let d=f?[]:{};const h=l.filter((e=>"indexed"in e&&e.indexed));for(let e=0;e!("indexed"in e&&e.indexed)));if(p.length>0)if(r&&"0x"!==r)try{const e=Rge(p,r);if(e)if(f)d=[...d,...e];else for(let t=0;t0?d:void 0}}function dve({param:e,value:t}){if("string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))return t;return(Rge([e],t)||[])[0]}function hve({abi:e,eventName:t,logs:r,strict:n=!0}){return r.map((r=>{try{const i=fve({...r,abi:e,strict:n});return t&&!t.includes(i.eventName)?null:{...i,...r}}catch(e){let t,i;if(e instanceof $be)return null;if(e instanceof Wbe||e instanceof Jbe){if(n)return null;t=e.abiItem.name,i=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}return{...r,args:i?[]:{},eventName:t}}})).filter(Boolean)}async function pve(e,{address:t,blockHash:r,fromBlock:n,toBlock:i,event:o,events:a,args:s,strict:c}={}){const u=c??!1,l=a??(o?[o]:void 0);let f,d=[];l&&(d=[l.flatMap((e=>yge({abi:[e],eventName:e.name,args:s})))],o&&(d=d[0])),f=r?await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:r}]}):await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:"bigint"==typeof n?$pe(n):n,toBlock:"bigint"==typeof i?$pe(i):i}]});const h=f.map((e=>nme(e)));return l?hve({abi:l,logs:h,strict:u}):h}async function mve(e,t){const{abi:r,address:n,args:i,blockHash:o,eventName:a,fromBlock:s,toBlock:c,strict:u}=t,l=a?pge({abi:r,name:a}):void 0,f=l?void 0:r.filter((e=>"event"===e.type));return Obe(e,pve,"getLogs")({address:n,args:i,blockHash:o,event:l,events:f,fromBlock:s,toBlock:c,strict:u})}const bve="/docs/contract/decodeFunctionResult";function gve(e){const{abi:t,args:r,functionName:n,data:i}=e;let o=t[0];if(n){const e=pge({abi:t,args:r,name:n});if(!e)throw new Gbe(n,{docsPath:bve});o=e}if("function"!==o.type)throw new Gbe(void 0,{docsPath:bve});if(!o.outputs)throw new qbe(o.name,{docsPath:bve});const a=Rge(o.outputs,i);return a&&a.length>1?a:a&&1===a.length?a[0]:void 0}const yve=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],vve=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],wve=[...vve,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],Eve=[...vve,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],Ave=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],xve=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],_ve=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],kve="0x82ad56cb";class Sve extends kpe{constructor({blockNumber:e,chain:t,contract:r}){super(`Chain "${t.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"})}}class Pve extends kpe{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}}function Ive({blockNumber:e,chain:t,contract:r}){const n=t?.contracts?.[r];if(!n)throw new Sve({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new Sve({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}const Tve=new Map;function Ove({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:i}){const o=async()=>{const t=s();a();const r=t.map((({args:e})=>e));0!==r.length&&e(r).then((e=>{i&&Array.isArray(e)&&e.sort(i);for(let r=0;r{for(let r=0;rTve.delete(t),s=()=>Tve.get(t)||[],c=e=>Tve.set(t,[...s(),e]);return{flush:a,async schedule(e){const t={},i=new Promise(((e,r)=>{t.resolve=e,t.reject=r})),a=r?.([...s().map((({args:e})=>e)),e]);a&&o();return s().length>0?(c({args:e,pendingPromise:t}),i):(c({args:e,pendingPromise:t}),setTimeout(o,n),i)}}}async function Mve(e,t){const{account:r=e.account,batch:n=Boolean(e.batch?.multicall),blockNumber:i,blockTag:o="latest",accessList:a,blobs:s,data:c,gas:u,gasPrice:l,maxFeePerBlobGas:f,maxFeePerGas:d,maxPriorityFeePerGas:h,nonce:p,to:m,value:b,stateOverride:g,...y}=t,v=r?Age(r):void 0;try{Yye(t);const r=(i?$pe(i):void 0)||o,w=function(e){if(!e)return;const t={};for(const{address:r,...n}of e){if(!Ume(r,{strict:!1}))throw new ame({address:r});if(t[r])throw new Wge({address:r});t[r]=Bve(n)}return t}(g),E=e.chain?.formatters?.transactionRequest?.format,A=(E||Zye)({...Wye(y,{format:E}),from:v?.address,accessList:a,blobs:s,data:c,gas:u,gasPrice:l,maxFeePerBlobGas:f,maxFeePerGas:d,maxPriorityFeePerGas:h,nonce:p,to:m,value:b});if(n&&function({request:e}){const{data:t,to:r,...n}=e;return!!t&&(!t.startsWith(kve)&&(!!r&&!(Object.values(n).filter((e=>void 0!==e)).length>0)))}({request:A})&&!w)try{return await async function(e,t){const{batchSize:r=1024,wait:n=0}="object"==typeof e.batch?.multicall?e.batch.multicall:{},{blockNumber:i,blockTag:o="latest",data:a,multicallAddress:s,to:c}=t;let u=s;if(!u){if(!e.chain)throw new Pve;u=Ive({blockNumber:i,chain:e.chain,contract:"multicall3"})}const l=i?$pe(i):void 0,f=l||o,{schedule:d}=Ove({id:`${e.uid}.${f}`,wait:n,shouldSplitBatch(e){const t=e.reduce(((e,{data:t})=>e+(t.length-2)),0);return t>2*r},fn:async t=>{const r=t.map((e=>({allowFailure:!0,callData:e.data,target:e.to}))),n=_ge({abi:yve,args:[r],functionName:"aggregate3"}),i=await e.request({method:"eth_call",params:[{data:n,to:u},f]});return gve({abi:yve,args:[r],functionName:"aggregate3",data:i||"0x"})}}),[{returnData:h,success:p}]=await d({data:a,to:c});if(!p)throw new sye({data:h});return"0x"===h?{data:void 0}:{data:h}}(e,{...A,blockNumber:i,blockTag:o})}catch(e){if(!(e instanceof Pve||e instanceof Sve))throw e}const x=await e.request({method:"eth_call",params:w?[A,r,w]:[A,r]});return"0x"===x?{data:void 0}:{data:x}}catch(r){const n=function(e){if(!(e instanceof kpe))return;const t=e.walk();return"object"==typeof t?.data?t.data?.data:t.data}(r),{offchainLookup:i,offchainLookupSignature:o}=await Promise.resolve().then((function(){return Bwe}));if(!1!==e.ccipRead&&n?.slice(0,10)===o&&m)return{data:await i(e,{data:n,to:m})};throw function(e,{docsPath:t,...r}){const n=(()=>{const t=Vye(e,r);return t instanceof Kye?e:t})();return new nye(n,{docsPath:t,...r})}(r,{...t,account:v,chain:e.chain})}}function Cve(e){if(e&&0!==e.length)return e.reduce(((e,{slot:t,value:r})=>{if(66!==t.length)throw new Rpe({size:t.length,targetSize:66,type:"hex"});if(66!==r.length)throw new Rpe({size:r.length,targetSize:66,type:"hex"});return e[t]=r,e}),{})}function Bve(e){const{balance:t,nonce:r,state:n,stateDiff:i,code:o}=e,a={};if(void 0!==o&&(a.code=o),void 0!==t&&(a.balance=$pe(t,{size:32})),void 0!==r&&(a.nonce=$pe(r,{size:8})),void 0!==n&&(a.state=Cve(n)),void 0!==i){if(a.state)throw new Jge;a.stateDiff=Cve(i)}return a}async function Nve(e,t){const{abi:r,address:n,args:i,functionName:o,...a}=t,s=_ge({abi:r,args:i,functionName:o});try{const{data:t}=await Obe(e,Mve,"call")({...a,data:s,to:n});return gve({abi:r,args:i,functionName:o,data:t||"0x"})}catch(e){throw Bye(e,{abi:r,address:n,args:i,docsPath:"/docs/contract/readContract",functionName:o})}}const Rve=new Map,Fve=new Map;let Lve=0;function Uve(e,t,r){const n=++Lve,i=()=>Rve.get(e)||[],o=()=>{const t=Fve.get(e);1===i().length&&t&&t(),(()=>{const t=i();Rve.set(e,t.filter((e=>e.id!==n)))})()},a=i();if(Rve.set(e,[...a,{id:n,fns:t}]),a&&a.length>0)return o;const s={};for(const e in t)s[e]=(...t)=>{const r=i();if(0!==r.length)for(const n of r)n.fns[e]?.(...t)};const c=r(s);return"function"==typeof c&&Fve.set(e,c),o}async function jve(e){return new Promise((t=>setTimeout(t,e)))}function Dve(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let i=!0;const o=()=>i=!1;return(async()=>{let a;t&&(a=await e({unpoll:o}));const s=await(r?.(a))??n;await jve(s);const c=async()=>{i&&(await e({unpoll:o}),await jve(n),c())};c()})(),o}const zve=new Map,$ve=new Map;async function Hve(e,{cacheKey:t,cacheTime:r=1/0}){const n=function(e){const t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:r=>t.set(e,r)}),r=t(e,zve),n=t(e,$ve);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}(t),i=n.response.get();if(i&&r>0){if((new Date).getTime()-i.created.getTime()`blockNumber.${e}`;async function qve(e,{cacheTime:t=e.cacheTime}={}){const r=await Hve((()=>e.request({method:"eth_blockNumber"})),{cacheKey:Gve(e.uid),cacheTime:t});return BigInt(r)}async function Kve(e,{filter:t}){const r="strict"in t&&t.strict,n=await t.request({method:"eth_getFilterChanges",params:[t.id]});if("string"==typeof n[0])return n;const i=n.map((e=>nme(e)));return"abi"in t&&t.abi?hve({abi:t.abi,logs:i,strict:r}):i}async function Vve(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}const Wve=256;let Jve,Zve=Wve;function Yve(e=11){if(!Jve||Zve+e>2*Wve){Jve="",Zve=0;for(let e=0;e!0)}={}){return new Promise(((i,o)=>{const a=async({count:s=0}={})=>{try{const t=await e();i(t)}catch(e){if(s{const r="function"==typeof t?t({count:s,error:e}):t;r&&await jve(r),a({count:s+1})})({error:e});o(e)}};a()}))}function Qve(e,t={}){return async(r,n={})=>{const{retryDelay:i=150,retryCount:o=3}={...t,...n};return Xve((async()=>{try{return await e(r)}catch(e){const t=e;switch(t.code){case hye.code:throw new hye(t);case pye.code:throw new pye(t);case mye.code:throw new mye(t);case bye.code:throw new bye(t);case gye.code:throw new gye(t);case yye.code:throw new yye(t);case vye.code:throw new vye(t);case wye.code:throw new wye(t);case Eye.code:throw new Eye(t);case Aye.code:throw new Aye(t);case xye.code:throw new xye(t);case _ye.code:throw new _ye(t);case kye.code:throw new kye(t);case Sye.code:throw new Sye(t);case Pye.code:throw new Pye(t);case Iye.code:throw new Iye(t);case Tye.code:throw new Tye(t);case Oye.code:throw new Oye(t);case 5e3:throw new kye(t);default:if(e instanceof kpe)throw e;throw new Mye(t)}}}),{delay:({count:e,error:t})=>{if(t&&t instanceof cye){const e=t?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*parseInt(e)}return(1<function(e){if("code"in e&&"number"==typeof e.code)return-1===e.code||(e.code===xye.code||e.code===gye.code);if(e instanceof cye&&e.status)return 403===e.status||(408===e.status||(413===e.status||(429===e.status||(500===e.status||(502===e.status||(503===e.status||504===e.status))))));return!0}(e)})}}class ewe extends kpe{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}function twe(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const rwe=twe();function nwe(e,t={}){return{async request(r){const{body:n,fetchOptions:i={},onRequest:o=t.onRequest,onResponse:a=t.onResponse,timeout:s=t.timeout??1e4}=r,{headers:c,method:u,signal:l}={...t.fetchOptions,...i};try{const t=await function(e,{errorInstance:t=new Error("timed out"),timeout:r,signal:n}){return new Promise(((i,o)=>{(async()=>{let a;try{const s=new AbortController;r>0&&(a=setTimeout((()=>{n?s.abort():o(t)}),r)),i(await e({signal:s?.signal||null}))}catch(e){"AbortError"===e.name&&o(t),o(e)}finally{clearTimeout(a)}})()}))}((async({signal:t})=>{const r=new Request(e,{...i,body:Array.isArray(n)?zge(n.map((e=>({jsonrpc:"2.0",id:e.id??rwe.take(),...e})))):zge({jsonrpc:"2.0",id:n.id??rwe.take(),...n}),headers:{...c,"Content-Type":"application/json"},method:u||"POST",signal:l||(s>0?t:null)});o&&await o(r);return await fetch(r)}),{errorInstance:new lye({body:n,url:e}),timeout:s,signal:!0});let r;if(a&&await a(t),r=t.headers.get("Content-Type")?.startsWith("application/json")?await t.json():await t.text(),!t.ok)throw new cye({body:n,details:zge(r.error)||t.statusText,headers:t.headers,status:t.status,url:e});return r}catch(t){if(t instanceof cye)throw t;if(t instanceof lye)throw t;throw new cye({body:n,details:t.message,url:e})}}}}function iwe(e,t={}){const{batch:r,fetchOptions:n,key:i="http",name:o="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:s,retryDelay:c}=t;return({chain:u,retryCount:l,timeout:f})=>{const{batchSize:d=1e3,wait:h=0}="object"==typeof r?r:{},p=t.retryCount??l,m=f??t.timeout??1e4,b=e||u?.rpcUrls.default.http[0];if(!b)throw new ewe;const g=nwe(b,{fetchOptions:n,onRequest:a,onResponse:s,timeout:m});return function({key:e,name:t,request:r,retryCount:n=3,retryDelay:i=150,timeout:o,type:a},s){return{config:{key:e,name:t,request:r,retryCount:n,retryDelay:i,timeout:o,type:a},request:Qve(r,{retryCount:n,retryDelay:i}),value:s}}({key:i,name:o,async request({method:t,params:n}){const i={method:t,params:n},{schedule:o}=Ove({id:`${e}`,wait:h,shouldSplitBatch:e=>e.length>d,fn:e=>g.request({body:e}),sort:(e,t)=>e.id-t.id}),[{error:a,result:s}]=await(async e=>r?o(e):[await g.request({body:e})])(i);if(a)throw new uye({body:i,error:a,url:b});return s},retryCount:p,retryDelay:c,timeout:m,type:"http"},{fetchOptions:n,url:b})}}function owe(e,t){if(!(e instanceof kpe))return!1;const r=e.walk((e=>e instanceof oye));return r instanceof oye&&("ResolverNotFound"===r.data?.errorName||("ResolverWildcardNotSupported"===r.data?.errorName||("ResolverNotContract"===r.data?.errorName||("ResolverError"===r.data?.errorName||("HttpError"===r.data?.errorName||(!!r.reason?.includes("Wildcard on non-extended resolvers is not supported")||"reverse"===t&&r.reason===kge[50]))))))}function awe(e){if(66!==e.length)return null;if(0!==e.indexOf("["))return null;if(65!==e.indexOf("]"))return null;const t=`0x${e.slice(1,65)}`;return Ope(t)?t:null}function swe(e){let t=new Uint8Array(32).fill(0);if(!e)return zpe(t);const r=e.split(".");for(let e=r.length-1;e>=0;e-=1){const n=awe(r[e]),i=n?Kpe(n):Nme(Zpe(r[e]),"bytes");t=Nme(jme([t,i]),"bytes")}return zpe(t)}function cwe(e){return`[${e.slice(2)}]`}function uwe(e){const t=new Uint8Array(32).fill(0);return e?awe(e)||Nme(Zpe(e)):zpe(t)}function lwe(e){const t=e.replace(/^\.|\.$/gm,"");if(0===t.length)return new Uint8Array(1);const r=new Uint8Array(Zpe(t).byteLength+2);let n=0;const i=t.split(".");for(let e=0;e255&&(t=Zpe(cwe(uwe(i[e])))),r[n]=t.length,r.set(t,n+1),n+=t.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}class fwe extends kpe{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class dwe extends kpe{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class hwe extends kpe{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class pwe extends kpe{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const mwe=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,bwe=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,gwe=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,ywe=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;function vwe(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function wwe({uri:e,gatewayUrls:t}){const r=gwe.test(e);if(r)return{uri:e,isOnChain:!0,isEncoded:r};const n=vwe(t?.ipfs,"https://ipfs.io"),i=vwe(t?.arweave,"https://arweave.net"),o=e.match(mwe),{protocol:a,subpath:s,target:c,subtarget:u=""}=o?.groups||{},l="ipns:/"===a||"ipns/"===s,f="ipfs:/"===a||"ipfs/"===s||bwe.test(e);if(e.startsWith("http")&&!l&&!f){let r=e;return t?.arweave&&(r=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:r,isOnChain:!1,isEncoded:!1}}if((l||f)&&c)return{uri:`${n}/${l?"ipns":"ipfs"}/${c}${u}`,isOnChain:!1,isEncoded:!1};if("ar:/"===a&&c)return{uri:`${i}/${c}${u||""}`,isOnChain:!1,isEncoded:!1};let d=e.replace(ywe,"");if(d.startsWith("{const r=new Image;r.onload=()=>{t(!0)},r.onerror=()=>{t(!1)},r.src=e}))}}(r);if(i)return r;throw new hwe({uri:t})}async function xwe(e,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?async function(e,{gatewayUrls:t,record:r}){const n=function(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[r,n,i]=t.split("/"),[o,a]=r.split(":"),[s,c]=n.split(":");if(!o||"eip155"!==o.toLowerCase())throw new dwe({reason:"Only EIP-155 supported"});if(!a)throw new dwe({reason:"Chain ID not found"});if(!c)throw new dwe({reason:"Contract address not found"});if(!i)throw new dwe({reason:"Token ID not found"});if(!s)throw new dwe({reason:"ERC namespace not found"});return{chainID:parseInt(a),namespace:s.toLowerCase(),contractAddress:c,tokenID:i}}(r),i=await async function(e,{nft:t}){if("erc721"===t.namespace)return Nve(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if("erc1155"===t.namespace)return Nve(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new pwe({namespace:t.namespace})}(e,{nft:n}),{uri:o,isOnChain:a,isEncoded:s}=wwe({uri:i,gatewayUrls:t});if(a&&(o.includes("data:application/json;base64,")||o.startsWith("{"))){const e=s?atob(o.replace("data:application/json;base64,","")):o;return Awe({uri:Ewe(JSON.parse(e)),gatewayUrls:t})}let c=n.tokenID;"erc1155"===n.namespace&&(c=c.replace("0x","").padStart(64,"0"));return async function({gatewayUrls:e,uri:t}){try{const r=await fetch(t).then((e=>e.json()));return await Awe({gatewayUrls:e,uri:Ewe(r)})}catch{throw new hwe({uri:t})}}({gatewayUrls:t,uri:o.replace(/(?:0x)?{id}/,c)})}(e,{gatewayUrls:t,record:r}):Awe({uri:r,gatewayUrls:t})}async function _we(e,{blockNumber:t,blockTag:r,name:n,key:i,gatewayUrls:o,strict:a,universalResolverAddress:s}){let c=s;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=Ive({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const a={address:c,abi:wve,functionName:"resolve",args:[jpe(lwe(n)),_ge({abi:Ave,functionName:"text",args:[swe(n),i]})],blockNumber:t,blockTag:r},s=Obe(e,Nve,"readContract"),u=o?await s({...a,args:[...a.args,o]}):await s(a);if("0x"===u[0])return null;const l=gve({abi:Ave,functionName:"text",data:u[0]});return""===l?null:l}catch(e){if(a)throw e;if(owe(e,"resolve"))return null;throw e}}async function kwe(e,{address:t,args:r,event:n,events:i,fromBlock:o,strict:a,toBlock:s}={}){const c=i??(n?[n]:void 0),u=wge(e,{method:"eth_newFilter"});let l=[];c&&(l=[c.flatMap((e=>yge({abi:[e],eventName:e.name,args:r})))],n&&(l=l[0]));const f=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof o?$pe(o):o,toBlock:"bigint"==typeof s?$pe(s):s,...l.length?{topics:l}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:o,id:f,request:u(f),strict:Boolean(a),toBlock:s,type:"event"}}async function Swe(e){const t=wge(e,{method:"eth_newPendingTransactionFilter"}),r=await e.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:t(r),type:"transaction"}}async function Pwe(e,{blockCount:t,blockNumber:r,blockTag:n="latest",rewardPercentiles:i}){const o=r?$pe(r):void 0;return function(e){return{baseFeePerGas:e.baseFeePerGas.map((e=>BigInt(e))),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:e.reward?.map((e=>e.map((e=>BigInt(e)))))}}(await e.request({method:"eth_feeHistory",params:[$pe(t),o||n,i]}))}class Iwe extends kpe{constructor({callbackSelector:e,cause:t,data:r,extraData:n,sender:i,urls:o}){super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],t.metaMessages?.length?"":[],"Offchain Gateway Call:",o&&[" Gateway URL(s):",...o.map((e=>` ${e}`))],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${e}`,` Extra data: ${n}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class Twe extends kpe{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${t}`,`Response: ${zge(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class Owe extends kpe{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}const Mwe={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function Cwe({data:e,sender:t,urls:r}){let n=new Error("An unknown error occurred.");for(let i=0;i{for(const r of e){const{name:e,type:n}=r,a=t[e],s=n.match(Rwe);if(s&&("number"==typeof a||"bigint"==typeof a)){const[e,t,r]=s;$pe(a,{signed:"int"===t,size:parseInt(r)/8})}if("address"===n&&"string"==typeof a&&!Ume(a))throw new ame({address:a});const c=n.match(Nwe);if(c){const[e,t]=c;if(t&&Mpe(a)!==parseInt(t))throw new Vbe({expectedSize:parseInt(t),givenSize:Mpe(a)})}const u=i[n];u&&o(u,a)}};i.EIP712Domain&&t&&o(i.EIP712Domain,t);if("EIP712Domain"!==n){const e=i[n];o(e,r)}}({domain:t,message:r,primaryType:n,types:i});const o=["0x1901"];return t&&o.push(function({domain:e,types:t}){return Lwe({data:e,primaryType:"EIP712Domain",types:t})}({domain:t,types:i})),"EIP712Domain"!==n&&o.push(Lwe({data:r,primaryType:n,types:i})),Nme(jme(o))}function Lwe({data:e,primaryType:t,types:r}){return Nme(Uwe({data:e,primaryType:t,types:r}))}function Uwe({data:e,primaryType:t,types:r}){const n=[{type:"bytes32"}],i=[jwe({primaryType:t,types:r})];for(const o of r[t]){const[t,a]=zwe({types:r,name:o.name,type:o.type,value:e[o.name]});n.push(t),i.push(a)}return uge(n,i)}function jwe({primaryType:e,types:t}){const r=jpe(function({primaryType:e,types:t}){let r="";const n=Dwe({primaryType:e,types:t});n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i)r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`;return r}({primaryType:e,types:t}));return Nme(r)}function Dwe({primaryType:e,types:t},r=new Set){const n=e.match(/^\w*/u),i=n?.[0];if(r.has(i)||void 0===t[i])return r;r.add(i);for(const e of t[i])Dwe({primaryType:e.type,types:t},r);return r}function zwe({types:e,name:t,type:r,value:n}){if(void 0!==e[r])return[{type:"bytes32"},Nme(Uwe({data:n,primaryType:r,types:e}))];if("bytes"===r){return[{type:"bytes32"},Nme(n=`0x${(n.length%2?"0":"")+n.slice(2)}`)]}if("string"===r)return[{type:"bytes32"},Nme(jpe(n))];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),o=n.map((r=>zwe({name:t,type:i,types:e,value:r})));return[{type:"bytes32"},Nme(uge(o.map((([e])=>e)),o.map((([,e])=>e))))]}return[{type:r},n]}function $we({domain:e}){return["string"==typeof e?.name&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},"number"==typeof e?.chainId&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}const Hwe="/docs/contract/encodeDeployData";function Gwe(e){const{abi:t,args:r,bytecode:n}=e;if(!r||0===r.length)return n;const i=t.find((e=>"type"in e&&"constructor"===e.type));if(!i)throw new Bbe({docsPath:Hwe});if(!("inputs"in i))throw new Nbe({docsPath:Hwe});if(!i.inputs||0===i.inputs.length)throw new Nbe({docsPath:Hwe});return Dme([n,uge(i.inputs,r)])}const qwe="Ethereum Signed Message:\n";async function Kwe(e,{address:t,blockNumber:r,blockTag:n,storageKeys:i}){const o=n??"latest",a=void 0!==r?$pe(r):void 0;return function(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Qpe(e.nonce):void 0,storageProof:e.storageProof?(t=e.storageProof,t.map((e=>({...e,value:BigInt(e.value)})))):void 0};var t}(await e.request({method:"eth_getProof",params:[t,i,a||o]}))}async function Vwe(e,{blockHash:t,blockNumber:r,blockTag:n,hash:i,index:o}){const a=n||"latest",s=void 0!==r?$pe(r):void 0;let c=null;if(i?c=await e.request({method:"eth_getTransactionByHash",params:[i]}):t?c=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,$pe(o)]}):(s||a)&&(c=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[s||a,$pe(o)]})),!c)throw new eye({blockHash:t,blockNumber:r,blockTag:a,hash:i,index:o});return(e.chain?.formatters?.transaction?.format||tme)(c)}async function Wwe(e,{hash:t}){const r=await e.request({method:"eth_getTransactionReceipt",params:[t]});if(!r)throw new tye({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||ome)(r)}const Jwe="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572"; /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */async function Zwe(e,{address:t,hash:r,signature:n,...i}){const o=Ope(n)?n:jpe(n);try{const{data:n}=await Obe(e,Mve,"call")({data:Gwe({abi:_ve,args:[t,r,o],bytecode:Jwe}),...i});return s="0x1",function(e,t){if(e.length!==t.length)return!1;for(let r=0;rDve((async()=>{try{const t=await Obe(e,qve,"getBlockNumber")({cacheTime:0});if(s){if(t===s)return;if(t-s>1&&r)for(let e=s+1n;es)&&(n.onBlockNumber(t,s),s=t)}catch(e){n.onError?.(e)}}),{emitOnBegin:t,interval:a}))):Uve(zge(["watchBlockNumber",e.uid,t,r]),{onBlockNumber:n,onError:i},(t=>{let r=!0,n=()=>r=!1;return(async()=>{try{const{unsubscribe:i}=await e.transport.subscribe({params:["newHeads"],onData(e){if(!r)return;const n=Xpe(e.result?.number);t.onBlockNumber(n,s),s=n},onError(e){t.onError?.(e)}});n=i,r||n()}catch(e){i?.(e)}})(),()=>n()}))}function Qwe(e){return{call:t=>Mve(e,t),createBlockFilter:()=>async function(e){const t=wge(e,{method:"eth_newBlockFilter"}),r=await e.request({method:"eth_newBlockFilter"});return{id:r,request:t(r),type:"block"}}(e),createContractEventFilter:t=>Ege(e,t),createEventFilter:t=>kwe(e,t),createPendingTransactionFilter:()=>Swe(e),estimateContractGas:t=>async function(e,t){const{abi:r,address:n,args:i,functionName:o,...a}=t,s=_ge({abi:r,args:i,functionName:o});try{return await Obe(e,uve,"estimateGas")({data:s,to:n,...a})}catch(e){const t=a.account?Age(a.account):void 0;throw Bye(e,{abi:r,address:n,args:i,docsPath:"/docs/contract/estimateContractGas",functionName:o,sender:t?.address})}}(e,t),estimateGas:t=>uve(e,t),getBalance:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=r?$pe(r):void 0,o=await e.request({method:"eth_getBalance",params:[t,i||n]});return BigInt(o)}(e,t),getBlobBaseFee:()=>async function(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}(e),getBlock:t=>rve(e,t),getBlockNumber:t=>qve(e,t),getBlockTransactionCount:t=>async function(e,{blockHash:t,blockNumber:r,blockTag:n="latest"}={}){const i=void 0!==r?$pe(r):void 0;let o;return o=t?await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]}):await e.request({method:"eth_getBlockTransactionCountByNumber",params:[i||n]}),Qpe(o)}(e,t),getBytecode:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest"}){const i=void 0!==r?$pe(r):void 0,o=await e.request({method:"eth_getCode",params:[t,i||n]});if("0x"!==o)return o}(e,t),getChainId:()=>sve(e),getContractEvents:t=>mve(e,t),getEnsAddress:t=>async function(e,{blockNumber:t,blockTag:r,coinType:n,name:i,gatewayUrls:o,strict:a,universalResolverAddress:s}){let c=s;if(!c){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");c=Ive({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const a=_ge({abi:xve,functionName:"addr",...null!=n?{args:[swe(i),BigInt(n)]}:{args:[swe(i)]}}),s={address:c,abi:wve,functionName:"resolve",args:[jpe(lwe(i)),a],blockNumber:t,blockTag:r},u=Obe(e,Nve,"readContract"),l=o?await u({...s,args:[...s.args,o]}):await u(s);if("0x"===l[0])return null;const f=gve({abi:xve,args:null!=n?[swe(i),BigInt(n)]:void 0,functionName:"addr",data:l[0]});return"0x"===f||"0x00"===Cpe(f)?null:f}catch(e){if(a)throw e;if(owe(e,"resolve"))return null;throw e}}(e,t),getEnsAvatar:t=>async function(e,{blockNumber:t,blockTag:r,assetGatewayUrls:n,name:i,gatewayUrls:o,strict:a,universalResolverAddress:s}){const c=await Obe(e,_we,"getEnsText")({blockNumber:t,blockTag:r,key:"avatar",name:i,universalResolverAddress:s,gatewayUrls:o,strict:a});if(!c)return null;try{return await xwe(e,{record:c,gatewayUrls:n})}catch{return null}}(e,t),getEnsName:t=>async function(e,{address:t,blockNumber:r,blockTag:n,gatewayUrls:i,strict:o,universalResolverAddress:a}){let s=a;if(!s){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");s=Ive({blockNumber:r,chain:e.chain,contract:"ensUniversalResolver"})}const c=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const o={address:s,abi:Eve,functionName:"reverse",args:[jpe(lwe(c))],blockNumber:r,blockTag:n},a=Obe(e,Nve,"readContract"),[u,l]=i?await a({...o,args:[...o.args,i]}):await a(o);return t.toLowerCase()!==l.toLowerCase()?null:u}catch(e){if(o)throw e;if(owe(e,"reverse"))return null;throw e}}(e,t),getEnsResolver:t=>async function(e,{blockNumber:t,blockTag:r,name:n,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=Ive({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}const[a]=await Obe(e,Nve,"readContract")({address:o,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[jpe(lwe(n))],blockNumber:t,blockTag:r});return a}(e,t),getEnsText:t=>_we(e,t),getFeeHistory:t=>Pwe(e,t),estimateFeesPerGas:t=>async function(e,t){return ove(e,t)}(e,t),getFilterChanges:e=>Kve(0,e),getFilterLogs:e=>async function(e,{filter:t}){const r=t.strict??!1,n=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map((e=>nme(e)));return t.abi?hve({abi:t.abi,logs:n,strict:r}):n}(0,e),getGasPrice:()=>nve(e),getLogs:t=>pve(e,t),getProof:t=>Kwe(e,t),estimateMaxPriorityFeePerGas:t=>async function(e,t){return ive(e,t)}(e,t),getStorageAt:t=>async function(e,{address:t,blockNumber:r,blockTag:n="latest",slot:i}){const o=void 0!==r?$pe(r):void 0;return await e.request({method:"eth_getStorageAt",params:[t,i,o||n]})}(e,t),getTransaction:t=>Vwe(e,t),getTransactionConfirmations:t=>async function(e,{hash:t,transactionReceipt:r}){const[n,i]=await Promise.all([Obe(e,qve,"getBlockNumber")({}),t?Obe(e,Vwe,"getBlockNumber")({hash:t}):void 0]),o=r?.blockNumber||i?.blockNumber;return o?n-o+1n:0n}(e,t),getTransactionCount:t=>ave(e,t),getTransactionReceipt:t=>Wwe(e,t),multicall:t=>async function(e,t){const{allowFailure:r=!0,batchSize:n,blockNumber:i,blockTag:o,multicallAddress:a,stateOverride:s}=t,c=t.contracts,u=n??("object"==typeof e.batch?.multicall&&e.batch.multicall.batchSize||1024);let l=a;if(!l){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");l=Ive({blockNumber:i,chain:e.chain,contract:"multicall3"})}const f=[[]];let d=0,h=0;for(let e=0;e0&&h>u&&f[d].length>0&&(d++,h=(e.length-2)/2,f[d]=[]),f[d]=[...f[d],{allowFailure:!0,callData:e,target:n}]}catch(e){const a=Bye(e,{abi:t,address:n,args:i,docsPath:"/docs/contract/multicall",functionName:o});if(!r)throw a;f[d]=[...f[d],{allowFailure:!0,callData:"0x",target:n}]}}const p=await Promise.allSettled(f.map((t=>Obe(e,Nve,"readContract")({abi:yve,address:l,args:[t],blockNumber:i,blockTag:o,functionName:"aggregate3",stateOverride:s})))),m=[];for(let e=0;ecve(e,t),readContract:t=>Nve(e,t),sendRawTransaction:t=>async function(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}(e,t),simulateContract:t=>async function(e,t){const{abi:r,address:n,args:i,dataSuffix:o,functionName:a,...s}=t,c=s.account?Age(s.account):e.account,u=_ge({abi:r,args:i,functionName:a});try{const{data:l}=await Obe(e,Mve,"call")({batch:!1,data:`${u}${o?o.replace("0x",""):""}`,to:n,...s,account:c});return{result:gve({abi:r,args:i,functionName:a,data:l||"0x"}),request:{abi:r.filter((e=>"name"in e&&e.name===t.functionName)),address:n,args:i,dataSuffix:o,functionName:a,...s,account:c}}}catch(e){throw Bye(e,{abi:r,address:n,args:i,docsPath:"/docs/contract/simulateContract",functionName:a,sender:c?.address})}}(e,t),verifyMessage:t=>Ywe(e,t),verifyTypedData:t=>async function(e,t){const{address:r,signature:n,message:i,primaryType:o,types:a,domain:s,...c}=t;return Zwe(e,{address:r,hash:Fwe({message:i,primaryType:o,types:a,domain:s}),signature:n,...c})}(e,t),uninstallFilter:e=>Vve(0,e),waitForTransactionReceipt:t=>async function(e,{confirmations:t=1,hash:r,onReplaced:n,pollingInterval:i=e.pollingInterval,retryCount:o=6,retryDelay:a=(({count:e})=>200*(1<{s&&setTimeout((()=>p(new rye({hash:r}))),s);const m=Uve(c,{onReplaced:n,resolve:h,reject:p},(n=>{const s=Obe(e,Xwe,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:i,async onBlockNumber(i){if(d)return;let c=i;const h=e=>{s(),e(),m()};try{if(f){if(t>1&&(!f.blockNumber||c-f.blockNumber+1nn.resolve(f)))}if(u||(d=!0,await Xve((async()=>{u=await Obe(e,Vwe,"getTransaction")({hash:r}),u.blockNumber&&(c=u.blockNumber)}),{delay:a,retryCount:o}),d=!1),f=await Obe(e,Wwe,"getTransactionReceipt")({hash:r}),t>1&&(!f.blockNumber||c-f.blockNumber+1nn.resolve(f)))}catch(r){if(r instanceof eye||r instanceof tye){if(!u)return void(d=!1);try{l=u,d=!0;const r=await Xve((()=>Obe(e,rve,"getBlock")({blockNumber:c,includeTransactions:!0})),{delay:a,retryCount:o,shouldRetry:({error:e})=>e instanceof tve});d=!1;const i=r.transactions.find((({from:e,nonce:t})=>e===l.from&&t===l.nonce));if(!i)return;if(f=await Obe(e,Wwe,"getTransactionReceipt")({hash:i.hash}),t>1&&(!f.blockNumber||c-f.blockNumber+1n{n.onReplaced?.({reason:s,replacedTransaction:l,transaction:i,transactionReceipt:f}),n.resolve(f)}))}catch(e){h((()=>n.reject(e)))}}else h((()=>n.reject(r)))}}})}))}))}(e,t),watchBlocks:t=>function(e,{blockTag:t="latest",emitMissed:r=!1,emitOnBegin:n=!1,onBlock:i,onError:o,includeTransactions:a,poll:s,pollingInterval:c=e.pollingInterval}){const u=void 0!==s?s:"webSocket"!==e.transport.type,l=a??!1;let f;return u?Uve(zge(["watchBlocks",e.uid,t,r,n,l,c]),{onBlock:i,onError:o},(i=>Dve((async()=>{try{const n=await Obe(e,rve,"getBlock")({blockTag:t,includeTransactions:l});if(n.number&&f?.number){if(n.number===f.number)return;if(n.number-f.number>1&&r)for(let t=f?.number+1n;tf.number)&&(i.onBlock(n,f),f=n)}catch(e){i.onError?.(e)}}),{emitOnBegin:n,interval:c}))):(()=>{let t=!0,r=()=>t=!1;return(async()=>{try{const{unsubscribe:n}=await e.transport.subscribe({params:["newHeads"],onData(r){if(!t)return;const n=(e.chain?.formatters?.block?.format||rme)(r.result);i(n,f),f=n},onError(e){o?.(e)}});r=n,t||r()}catch(e){o?.(e)}})(),()=>r()})()}(e,t),watchBlockNumber:t=>Xwe(e,t),watchContractEvent:t=>function(e,t){const{abi:r,address:n,args:i,batch:o=!0,eventName:a,onError:s,onLogs:c,poll:u,pollingInterval:l=e.pollingInterval,strict:f}=t;return(void 0!==u?u:"webSocket"!==e.transport.type)?(()=>{const t=f??!1;return Uve(zge(["watchContractEvent",n,i,o,e.uid,a,l,t]),{onLogs:c,onError:s},(s=>{let c,u,f=!1;const d=Dve((async()=>{if(f)try{let l;if(u)l=await Obe(e,Kve,"getFilterChanges")({filter:u});else{const o=await Obe(e,qve,"getBlockNumber")({});l=c&&c!==o?await Obe(e,mve,"getContractEvents")({abi:r,address:n,args:i,eventName:a,fromBlock:c+1n,toBlock:o,strict:t}):[],c=o}if(0===l.length)return;if(o)s.onLogs(l);else for(const e of l)s.onLogs([e])}catch(e){u&&e instanceof yye&&(f=!1),s.onError?.(e)}else{try{u=await Obe(e,Ege,"createContractEventFilter")({abi:r,address:n,args:i,eventName:a,strict:t})}catch{}f=!0}}),{emitOnBegin:!0,interval:l});return async()=>{u&&await Obe(e,Vve,"uninstallFilter")({filter:u}),d()}}))})():(()=>{const t=f??!1,u=zge(["watchContractEvent",n,i,o,e.uid,a,l,t]);let d=!0,h=()=>d=!1;return Uve(u,{onLogs:c,onError:s},(t=>((async()=>{try{const o=a?yge({abi:r,eventName:a,args:i}):[],{unsubscribe:s}=await e.transport.subscribe({params:["logs",{address:n,topics:o}],onData(e){if(!d)return;const n=e.result;try{const{eventName:e,args:i}=fve({abi:r,data:n.data,topics:n.topics,strict:f}),o=nme(n,{args:i,eventName:e});t.onLogs([o])}catch(e){let r,i;if(e instanceof Wbe||e instanceof Jbe){if(f)return;r=e.abiItem.name,i=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const o=nme(n,{args:i?[]:{},eventName:r});t.onLogs([o])}},onError(e){t.onError?.(e)}});h=s,d||h()}catch(e){s?.(e)}})(),()=>h())))})()}(e,t),watchEvent:t=>function(e,{address:t,args:r,batch:n=!0,event:i,events:o,onError:a,onLogs:s,poll:c,pollingInterval:u=e.pollingInterval,strict:l}){const f=void 0!==c?c:"webSocket"!==e.transport.type,d=l??!1;return f?Uve(zge(["watchEvent",t,r,n,e.uid,i,u]),{onLogs:s,onError:a},(a=>{let s,c,l=!1;const f=Dve((async()=>{if(l)try{let u;if(c)u=await Obe(e,Kve,"getFilterChanges")({filter:c});else{const n=await Obe(e,qve,"getBlockNumber")({});u=s&&s!==n?await Obe(e,pve,"getLogs")({address:t,args:r,event:i,events:o,fromBlock:s+1n,toBlock:n}):[],s=n}if(0===u.length)return;if(n)a.onLogs(u);else for(const e of u)a.onLogs([e])}catch(e){c&&e instanceof yye&&(l=!1),a.onError?.(e)}else{try{c=await Obe(e,kwe,"createEventFilter")({address:t,args:r,event:i,events:o,strict:d})}catch{}l=!0}}),{emitOnBegin:!0,interval:u});return async()=>{c&&await Obe(e,Vve,"uninstallFilter")({filter:c}),f()}})):(()=>{let n=!0,c=()=>n=!1;return(async()=>{try{const u=o??(i?[i]:void 0);let f=[];u&&(f=[u.flatMap((e=>yge({abi:[e],eventName:e.name,args:r})))],i&&(f=f[0]));const{unsubscribe:h}=await e.transport.subscribe({params:["logs",{address:t,topics:f}],onData(e){if(!n)return;const t=e.result;try{const{eventName:e,args:r}=fve({abi:u??[],data:t.data,topics:t.topics,strict:d}),n=nme(t,{args:r,eventName:e});s([n])}catch(e){let r,n;if(e instanceof Wbe||e instanceof Jbe){if(l)return;r=e.abiItem.name,n=e.abiItem.inputs?.some((e=>!("name"in e&&e.name)))}const i=nme(t,{args:n?[]:{},eventName:r});s([i])}},onError(e){a?.(e)}});c=h,n||c()}catch(e){a?.(e)}})(),()=>c()})()}(e,t),watchPendingTransactions:t=>function(e,{batch:t=!0,onError:r,onTransactions:n,poll:i,pollingInterval:o=e.pollingInterval}){return(void 0!==i?i:"webSocket"!==e.transport.type)?Uve(zge(["watchPendingTransactions",e.uid,t,o]),{onTransactions:n,onError:r},(r=>{let n;const i=Dve((async()=>{try{if(!n)try{return void(n=await Obe(e,Swe,"createPendingTransactionFilter")({}))}catch(e){throw i(),e}const o=await Obe(e,Kve,"getFilterChanges")({filter:n});if(0===o.length)return;if(t)r.onTransactions(o);else for(const e of o)r.onTransactions([e])}catch(e){r.onError?.(e)}}),{emitOnBegin:!0,interval:o});return async()=>{n&&await Obe(e,Vve,"uninstallFilter")({filter:n}),i()}})):(()=>{let t=!0,i=()=>t=!1;return(async()=>{try{const{unsubscribe:o}=await e.transport.subscribe({params:["newPendingTransactions"],onData(e){if(!t)return;const r=e.result;n([r])},onError(e){r?.(e)}});i=o,t||i()}catch(e){r?.(e)}})(),()=>i()})()}(e,t)}}function eEe(e){const{key:t="public",name:r="Public Client"}=e,n=function(e){const{batch:t,cacheTime:r=e.pollingInterval??4e3,ccipRead:n,key:i="base",name:o="Base Client",pollingInterval:a=4e3,type:s="base"}=e,c=e.chain,u=e.account?Age(e.account):void 0,{config:l,request:f,value:d}=e.transport({chain:c,pollingInterval:a}),h={account:u,batch:t,cacheTime:r,ccipRead:n,chain:c,key:i,name:o,pollingInterval:a,request:f,transport:{...l,...d},type:s,uid:Yve()};return Object.assign(h,{extend:function e(t){return r=>{const n=r(t);for(const e in h)delete n[e];const i={...t,...n};return Object.assign(i,{extend:e(i)})}}(h)})}({...e,key:t,name:r,type:"publicClient"});return n.extend(Qwe)}BigInt(0),BigInt(1),BigInt(2);const tEe=_pe({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),rEe=_pe({id:137,name:"Polygon",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),nEe=_pe({id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0});class iEe{constructor(){r(this,"sessionId",void 0)}checkSessionParams(){if(!this.sessionId)throw new Error("Session id is required");this.sessionId=this.sessionId.padStart(64,"0")}request(e){let{method:t="GET",url:r,data:n={},headers:o={}}=e;const a={headers:o};switch(t){case"GET":return ed(r,a);case"POST":return td(r,n,a);case"PUT":return async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};n.useAPIKey&&(o.headers=i(i({},o.headers),Xf()));const a=Kf(o,r,{method:"PUT"});n.isUrlEncodedData?(a.body=t,"application/json; charset=utf-8"===a.headers["Content-Type"]&&delete a.headers["Content-Type"]):a.body=JSON.stringify(t);const s=await Yf(e,a);if(s.ok){const e=s.headers.get("content-type");return null!=e&&e.includes("application/json")?s.json():s.text()}throw Qf(s),s}(r,n,a);case"PATCH":return async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};n.useAPIKey&&(o.headers=i(i({},o.headers),Xf()));const a=Kf(o,r,{method:"PATCH"});n.isUrlEncodedData?(a.body=t,"application/json; charset=utf-8"===a.headers["Content-Type"]&&delete a.headers["Content-Type"]):a.body=JSON.stringify(t);const s=await Yf(e,a);if(s.ok){const e=s.headers.get("content-type");return null!=e&&e.includes("application/json")?s.json():s.text()}throw Qf(s),s}(r,n,a)}throw new Error("Invalid method type")}}class oEe extends iEe{constructor(){let{sessionServerBaseUrl:e,sessionNamespace:t,sessionTime:n,sessionId:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),r(this,"sessionServerBaseUrl","https://session.web3auth.io"),r(this,"sessionNamespace",void 0),r(this,"sessionTime",86400),r(this,"sessionId",""),e&&(this.sessionServerBaseUrl=e),t&&(this.sessionNamespace=t),n&&(this.sessionTime=n),i&&(this.sessionId=i.padStart(64,"0"))}static generateRandomSessionKey(){return function(){let e=av(32);for(;!ov(e);)e=av(32);return e}().toString("hex").padStart(64,"0")}async createSession(e){super.checkSessionParams();const t=_.from(this.sessionId,"hex"),r=dv(t).toString("hex"),n=await nE(this.sessionId,e),i={key:r,data:n,signature:(await hv(t,tE(_.from(n,"utf8")))).toString("hex"),namespace:this.sessionNamespace,timeout:this.sessionTime};return await super.request({method:"POST",url:`${this.sessionServerBaseUrl}/store/set`,data:i}),this.sessionId}async authorizeSession(){super.checkSessionParams();const e=dv(_.from(this.sessionId,"hex")).toString("hex"),t=new URL(`${this.sessionServerBaseUrl}/store/get`);t.searchParams.append("key",e),this.sessionNamespace&&t.searchParams.append("namespace",this.sessionNamespace);const r=await super.request({url:t.toString()});if(!r.message)throw new Error("Session Expired or Invalid public key");const n=await iE(this.sessionId,r.message);if(n.error)throw new Error("There was an error decrypting data.");return n}async updateSession(e){super.checkSessionParams();const t=_.from(this.sessionId,"hex"),r=dv(t).toString("hex"),n=await nE(this.sessionId,e),i={key:r,data:n,signature:(await hv(t,tE(_.from(n,"utf8")))).toString("hex"),namespace:this.sessionNamespace};await super.request({method:"PUT",url:`${this.sessionServerBaseUrl}/store/update`,data:i})}async invalidateSession(){super.checkSessionParams();const e=_.from(this.sessionId,"hex"),t=dv(e).toString("hex"),r=await nE(this.sessionId,{}),n={key:t,data:r,signature:(await hv(e,tE(_.from(r,"utf8")))).toString("hex"),namespace:this.sessionNamespace,timeout:1};return await super.request({method:"POST",url:`${this.sessionServerBaseUrl}/store/set`,data:n}),this.sessionId="",!0}}const aEe=Jf.getLogger("http-helpers");aEe.setLevel(Wf.levels.INFO);const sEe=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={mode:"cors",headers:{"Content-Type":"application/json; charset=utf-8"}};n.useAPIKey&&(o.headers=i(i({},o.headers),{"x-api-key":"torus-default"}));const a=Kf(o,r,{method:"POST"});return n.isUrlEncodedData?(a.body=t,"application/json; charset=utf-8"===a.headers["Content-Type"]&&delete a.headers["Content-Type"]):a.body=JSON.stringify(t),((e,t)=>{const r=new Promise(((t,r)=>{const n=setTimeout((()=>{clearTimeout(n),r(new Error(`Timed out in ${e}ms`))}),e)}));return Promise.race([t,r])})(n.timeout||6e4,async function(e,t){let r=null;try{r=new URL(e)}catch(e){}return fetch(e,t)}(e,a).then((e=>{if(n.logTracingHeader&&function(e){aEe.info(`Request tracing with traceID=${e.headers.get("x-web3-correlation-id")}`)}(e),e.ok){const t=e.headers.get("content-type");return null!=t&&t.includes("application/json")?e.json():e.text()}throw function(e){aEe.info(`Response: ${e.status} ${e.statusText}`),aEe.info(`Url: ${e.url}`)}(e),e})))},cEe=Object.create(null);cEe.open="0",cEe.close="1",cEe.ping="2",cEe.pong="3",cEe.message="4",cEe.upgrade="5",cEe.noop="6";const uEe=Object.create(null);Object.keys(cEe).forEach((e=>{uEe[cEe[e]]=e}));const lEe={type:"error",data:"parser error"},fEe="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),dEe="function"==typeof ArrayBuffer,hEe=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,pEe=({type:e,data:t},r,n)=>fEe&&t instanceof Blob?r?n(t):mEe(t,n):dEe&&(t instanceof ArrayBuffer||hEe(t))?r?n(t):mEe(new Blob([t]),n):n(cEe[e]+(t||"")),mEe=(e,t)=>{const r=new FileReader;return r.onload=function(){const e=r.result.split(",")[1];t("b"+(e||""))},r.readAsDataURL(e)};function bEe(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let gEe;const yEe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",vEe="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)vEe[yEe.charCodeAt(e)]=e;const wEe="function"==typeof ArrayBuffer,EEe=(e,t)=>{if("string"!=typeof e)return{type:"message",data:xEe(e,t)};const r=e.charAt(0);if("b"===r)return{type:"message",data:AEe(e.substring(1),t)};return uEe[r]?e.length>1?{type:uEe[r],data:e.substring(1)}:{type:uEe[r]}:lEe},AEe=(e,t)=>{if(wEe){const r=(e=>{let t,r,n,i,o,a=.75*e.length,s=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);const u=new ArrayBuffer(a),l=new Uint8Array(u);for(t=0;t>4,l[c++]=(15&n)<<4|i>>2,l[c++]=(3&i)<<6|63&o;return u})(e);return xEe(r,t)}return{base64:!0,data:e}},xEe=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,_Ee=String.fromCharCode(30);function kEe(){return new TransformStream({transform(e,t){!function(e,t){fEe&&e.data instanceof Blob?e.data.arrayBuffer().then(bEe).then(t):dEe&&(e.data instanceof ArrayBuffer||hEe(e.data))?t(bEe(e.data)):pEe(e,!1,(e=>{gEe||(gEe=new TextEncoder),t(gEe.encode(e))}))}(e,(r=>{const n=r.length;let i;if(n<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,n);else if(n<65536){i=new Uint8Array(3);const e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,n)}else{i=new Uint8Array(9);const e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(n))}e.data&&"string"!=typeof e.data&&(i[0]|=128),t.enqueue(i),t.enqueue(r)}))}})}let SEe;function PEe(e){return e.reduce(((e,t)=>e+t.length),0)}function IEe(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let n=0;for(let i=0;i(e.hasOwnProperty(r)&&(t[r]=e[r]),t)),{})}const MEe=TEe.setTimeout,CEe=TEe.clearTimeout;function BEe(e,t){t.useNativeTimers?(e.setTimeoutFn=MEe.bind(TEe),e.clearTimeoutFn=CEe.bind(TEe)):(e.setTimeoutFn=TEe.setTimeout.bind(TEe),e.clearTimeoutFn=TEe.clearTimeout.bind(TEe))}function NEe(e){return"string"==typeof e?function(e){let t=0,r=0;for(let n=0,i=e.length;n=57344?r+=3:(n++,r+=4);return r}(e):Math.ceil(1.33*(e.byteLength||e.size))}class REe extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}}class FEe extends cm{constructor(e){super(),this.writable=!1,BEe(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new REe(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=EEe(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}(e);return t.length?"?"+t:""}}const LEe="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),UEe=64,jEe={};let DEe,zEe=0,$Ee=0;function HEe(e){let t="";do{t=LEe[e%UEe]+t,e=Math.floor(e/UEe)}while(e>0);return t}function GEe(){const e=HEe(+new Date);return e!==DEe?(zEe=0,DEe=e):e+"."+HEe(zEe++)}for(;$Ee{var e;3===n.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(n)),4===n.readyState&&(200===n.status||1223===n.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof n.status?n.status:0)}),0))},n.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=e.requestsCount++,e.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(t){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=WEe,t)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete e.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};if(ZEe.requestsCount=0,ZEe.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",YEe);else if("function"==typeof addEventListener){addEventListener("onpagehide"in TEe?"pagehide":"unload",YEe,!1)}function YEe(){for(let e in ZEe.requests)ZEe.requests.hasOwnProperty(e)&&ZEe.requests[e].abort()}const XEe="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),QEe=TEe.WebSocket||TEe.MozWebSocket,eAe="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();const tAe={websocket:class extends FEe{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,r=eAe?{}:OEe(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=eAe?new QEe(e,t,r):t?new QEe(e,t):new QEe(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t{try{this.ws.send(e)}catch(e){}n&&XEe((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=GEe()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!QEe}},webtransport:class extends FEe{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((e=>{const t=function(e,t){SEe||(SEe=new TextDecoder);const r=[];let n=0,i=-1,o=!1;return new TransformStream({transform(a,s){for(r.push(a);;){if(0===n){if(PEe(r)<1)break;const e=IEe(r,1);o=!(128&~e[0]),i=127&e[0],n=i<126?3:126===i?1:2}else if(1===n){if(PEe(r)<2)break;const e=IEe(r,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),n=3}else if(2===n){if(PEe(r)<8)break;const e=IEe(r,8),t=new DataView(e.buffer,e.byteOffset,e.length),o=t.getUint32(0);if(o>Math.pow(2,21)-1){s.enqueue(lEe);break}i=o*Math.pow(2,32)+t.getUint32(4),n=3}else{if(PEe(r)e){s.enqueue(lEe);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),n=kEe();n.readable.pipeTo(e.writable),this.writer=n.writable.getWriter();const i=()=>{r.read().then((({done:e,value:t})=>{e||(this.onPacket(t),i())})).catch((e=>{}))};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then((()=>this.onOpen()))}))})))}write(e){this.writable=!1;for(let t=0;t{n&&XEe((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends FEe{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let r=location.port;r||(r=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||r!==e.port}const t=e&&e.forceBase64;this.supportsBinary=JEe&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const r=e.split(_Ee),n=[];for(let e=0;e{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const r=e.length,n=new Array(r);let i=0;e.forEach(((e,o)=>{pEe(e,!1,(e=>{n[o]=e,++i===r&&t(n.join(_Ee))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=GEe()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ZEe(this.uri(),e)}doWrite(e,t){const r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},rAe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,nAe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function iAe(e){if(e.length>2e3)throw"URI too long";const t=e,r=e.indexOf("["),n=e.indexOf("]");-1!=r&&-1!=n&&(e=e.substring(0,r)+e.substring(r,n).replace(/:/g,";")+e.substring(n,e.length));let i=rAe.exec(e||""),o={},a=14;for(;a--;)o[nAe[a]]=i[a]||"";return-1!=r&&-1!=n&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=function(e,t){const r=/\/{2,9}/g,n=t.replace(r,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1);"/"==t.slice(-1)&&n.splice(n.length-1,1);return n}(0,o.path),o.queryKey=function(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,n){t&&(r[t]=n)})),r}(0,o.query),o}let oAe=class e extends cm{constructor(e,t={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=iAe(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=iAe(t.host).host),BEe(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},r=e.split("&");for(let e=0,n=r.length;e{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new tAe[e](r)}open(){let t;if(this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(e){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(t){let r=this.createTransport(t),n=!1;e.priorWebsocketSuccess=!1;const i=()=>{n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",(t=>{if(!n)if("pong"===t.type&&"probe"===t.data){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;e.priorWebsocketSuccess="websocket"===r.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=r.name,this.emitReserved("upgradeError",e)}})))};function o(){n||(n=!0,l(),r.close(),r=null)}const a=e=>{const t=new Error("probe error: "+e);t.transport=r.name,o(),this.emitReserved("upgradeError",t)};function s(){a("transport closed")}function c(){a("socket closed")}function u(e){r&&e.name!==r.name&&o()}const l=()=>{r.removeListener("open",i),r.removeListener("error",a),r.removeListener("close",s),this.off("close",c),this.off("upgrading",u)};r.once("open",i),r.once("error",a),r.once("close",s),this.once("close",c),this.once("upgrading",u),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==t?this.setTimeoutFn((()=>{n||r.open()}),200):r.open()}onOpen(){if(this.readyState="open",e.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t0&&e>this.maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof r&&(n=r,r=null),"closing"===this.readyState||"closed"===this.readyState)return;(r=r||{}).compress=!1!==r.compress;const i={type:e,data:t,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),n&&this.once("flush",n),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?r():e()})):this.upgrading?r():e()),this}onError(t){e.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let r=0;const n=e.length;for(;r"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,cAe=Object.prototype.toString,uAe="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===cAe.call(Blob),lAe="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===cAe.call(File);function fAe(e){return aAe&&(e instanceof ArrayBuffer||sAe(e))||uAe&&e instanceof Blob||lAe&&e instanceof File}function dAe(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,r=e.length;t=0&&e.num{delete this.acks[e];for(let t=0;t{this.io.clearTimeoutFn(i),t.apply(this,e)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise(((r,n)=>{const i=(e,t)=>e?n(e):r(t);i.withError=!0,t.push(i),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...n)=>{if(r!==this._queue[0])return;return null!==e?r.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue()})),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:yAe.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach((e=>{if(!this.sendBuffer.some((t=>String(t.id)===e))){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}}))}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case yAe.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case yAe.EVENT:case yAe.BINARY_EVENT:this.onevent(e);break;case yAe.ACK:case yAe.BINARY_ACK:this.onack(e);break;case yAe.DISCONNECT:this.ondisconnect();break;case yAe.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let r=!1;return function(...n){r||(r=!0,t.packet({type:yAe.ACK,id:e,data:n}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:yAe.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}SAe.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+r:e-r}return 0|Math.min(e,this.max)},SAe.prototype.reset=function(){this.attempts=0},SAe.prototype.setMin=function(e){this.ms=e},SAe.prototype.setMax=function(e){this.max=e},SAe.prototype.setJitter=function(e){this.jitter=e};class PAe extends cm{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,BEe(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(r=t.randomizationFactor)&&void 0!==r?r:.5),this.backoff=new SAe({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const n=t.parser||AAe;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new oAe(this.uri,this.opts);const t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const n=xAe(t,"open",(function(){r.onopen(),e&&e()})),i=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},o=xAe(t,"error",i);if(!1!==this._timeout){const e=this._timeout,r=this.setTimeoutFn((()=>{n(),i(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}return this.subs.push(n),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(xAe(e,"ping",this.onping.bind(this)),xAe(e,"data",this.ondata.bind(this)),xAe(e,"error",this.onerror.bind(this)),xAe(e,"close",this.onclose.bind(this)),xAe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){XEe((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new kAe(this,e,t),this.nsps[e]=r),r}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let r=0;re())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&r.unref(),this.subs.push((()=>{this.clearTimeoutFn(r)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const IAe={};function TAe(e,t){"object"==typeof e&&(t=e,e=void 0);const r=function(e,t="",r){let n=e;r=r||"undefined"!=typeof location&&location,null==e&&(e=r.protocol+"//"+r.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?r.protocol+e:r.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==r?r.protocol+"//"+e:"https://"+e),n=iAe(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const i=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port+t,n.href=n.protocol+"://"+i+(r&&r.port===n.port?"":":"+n.port),n}(e,(t=t||{}).path||"/socket.io"),n=r.source,i=r.id,o=r.path,a=IAe[i]&&o in IAe[i].nsps;let s;return t.forceNew||t["force new connection"]||!1===t.multiplex||a?s=new PAe(n,t):(IAe[i]||(IAe[i]=new PAe(n,t)),s=IAe[i]),r.query&&!t.query&&(t.query=r.queryKey),s.socket(r.path,t)}Object.assign(TAe,{Manager:PAe,Socket:kAe,io:TAe,connect:TAe});var OAe=Jf.getLogger("SecurePubSub");class MAe{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,"options",void 0),r(this,"SOCKET_CONN",null),this.options=e,this.options.timeout=e.timeout||600,this.options.serverUrl=e.serverUrl||"https://broadcast-server.tor.us",this.options.enableLogging=e.enableLogging||!1,this.options.namespace=e.namespace||"",this.options.enableLogging?OAe.enableAll():OAe.disableAll()}static setLogLevel(e){OAe.setLevel(e),function(e){aEe.setLevel(e)}(e)}async publish(e,t){const r=tE(_.from(e,"utf8")),n=await nE(r.toString("hex"),t),i=await hv(r,tE(_.from(n,"utf8"))),o={key:dv(r).toString("hex"),data:n,signature:i.toString("hex"),timeout:this.options.timeout,namespace:this.options.namespace};return sEe(`${this.options.serverUrl}/channel/set`,o)}async subscribe(e){let t=!0;const r=tE(_.from(e,"utf8")),n=dv(r).toString("hex"),i=this.getSocketConnection();i.connected?(OAe.debug("already connected with socket"),i.emit("check_auth_status",n,{namespace:this.options.namespace})):i.once("connect",(()=>{OAe.debug("connected with socket"),i.emit("check_auth_status",n,{namespace:this.options.namespace})}));const o=()=>{i.once("connect",(async()=>{OAe.debug("connected with socket using reconnect"),t&&i.emit("check_auth_status",n,{namespace:this.options.namespace})}))},a=()=>{t||document.removeEventListener("visibilitychange",a),i.connected||"visible"!==document.visibilityState||o()},s=()=>{OAe.debug("socket disconnected",t),t?(OAe.error("socket disconnected unexpectedly, reconnecting socket"),o()):i.removeListener("disconnect",s)};i.on("disconnect",s);const c=new Promise(((e,o)=>{OAe.info("listening to",`${n}_success`),i.once(`${n}_success`,(async n=>{try{const t=await iE(r.toString("hex"),n);OAe.info("got data",t),e(t)}catch(e){OAe.error(e),o(e)}finally{t=!1,document.removeEventListener("visibilitychange",a)}}))}));return"undefined"!=typeof document&&document.addEventListener("visibilitychange",a),c}cleanup(){this.SOCKET_CONN&&(this.SOCKET_CONN.disconnect(),this.SOCKET_CONN=null)}getSocketConnection(){if(this.SOCKET_CONN)return this.SOCKET_CONN;const e=TAe(this.options.serverUrl,{transports:["websocket","polling"],withCredentials:!0,reconnectionDelayMax:1e4,reconnectionAttempts:10});return e.on("connect_error",(t=>{e.io.opts.transports=["polling","websocket"],OAe.error("connect error",t)})),e.on("connect",(async()=>{const{engine:t}=e.io;OAe.debug("initially connected to",t.transport.name),t.once("upgrade",(()=>{OAe.debug("upgraded",t.transport.name)})),t.once("close",(e=>{OAe.debug("connection closed",e)}))})),e.on("error",(t=>{OAe.error("socket errored",t),e.disconnect()})),this.SOCKET_CONN=e,this.SOCKET_CONN}}class CAe extends Gf{constructor(e,t){super(t),r(this,"code",void 0),r(this,"message",void 0),this.code=e,this.message=t||"",Object.defineProperty(this,"name",{value:"OpenloginError"})}toJSON(){return{name:this.name,code:this.code,message:this.message}}toString(){return JSON.stringify(this.toJSON())}}class BAe extends CAe{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"InitializationError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new BAe(e,`${BAe.messages[e]}, ${t}`)}static invalidParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return BAe.fromCode(5001,e)}static notInitialized(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return BAe.fromCode(5002,e)}}r(BAe,"messages",{5e3:"Custom",5001:"Invalid constructor params",5002:"SDK not initialized. please call init first"});class NAe extends CAe{constructor(e,t){super(e,t),Object.defineProperty(this,"name",{value:"LoginError"})}static fromCode(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return new NAe(e,`${NAe.messages[e]}, ${t}`)}static invalidLoginParams(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return NAe.fromCode(5111,e)}static userNotLoggedIn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return NAe.fromCode(5112,e)}static popupClosed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return NAe.fromCode(5113,e)}static loginFailed(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return NAe.fromCode(5114,e)}static popupBlocked(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return NAe.fromCode(5115,e)}static mfaAlreadyEnabled(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return NAe.fromCode(5116,e)}static mfaNotEnabled(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return NAe.fromCode(5117,e)}}r(NAe,"messages",{5e3:"Custom",5111:"Invalid login params",5112:"User not logged in.",5113:"login popup has been closed by the user",5114:"Login failed",5115:"Popup was blocked. Please call this function as soon as user clicks button or use redirect mode",5116:"MFA already enabled",5117:"MFA not yet enabled. Please call `enableMFA` first"});const RAe=Wf.getLogger("openlogin");RAe.setLevel("error");function FAe(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t={},r=new URL(window.location.href);r.searchParams.forEach(((e,r)=>{"result"!==r&&(t[r]=e)}));const n=r.searchParams.get("result");if(n)try{const e=JSON.parse(Af(n));Object.keys(e).forEach((r=>{t[r]=e[r]}))}catch(e){RAe.error(e)}const o=r.hash.substring(1),a=new URL(`${window.location.origin}/?${o}`);a.searchParams.forEach(((e,r)=>{"result"!==r&&(t[r]=e)}));const s=a.searchParams.get("result");if(s)try{const e=JSON.parse(Af(s));Object.keys(e).forEach((r=>{t[r]=e[r]}))}catch(e){RAe.error(e)}if(e){const e=new URL(window.location.origin+window.location.pathname);if(e.search=window.location.search,s){const t=JSON.parse(Af(s));delete t.sessionId,delete t.sessionNamespace,delete t.error,e.hash=(c=JSON.stringify(t),Ef.encode(c))}window.history.replaceState(i(i({},window.history.state),{},{as:e.href,url:e.href}),"",e.href)}var c;return t}function LAe(e){const{baseURL:t,query:r,hash:n}=e,i=new URL(t);if(r&&Object.keys(r).forEach((e=>{i.searchParams.append(e,r[e])})),n){const e=new URL(LAe({baseURL:t,query:n})).searchParams.toString();i.hash=e}return i.toString()}function UAe(e){return e!==Cf&&e!==Bf||!function(){if("undefined"==typeof window)return!1;const e=sm.getParser(window.navigator.userAgent).getPlatform();return e.type===sm.PLATFORMS_MAP.tablet||e.type===sm.PLATFORMS_MAP.mobile}()?1e4:3e5}class jAe extends ge{constructor(e){let{url:t,target:n,features:i,timeout:o=3e4}=e;super(),r(this,"url",void 0),r(this,"target",void 0),r(this,"features",void 0),r(this,"window",void 0),r(this,"windowTimer",void 0),r(this,"iClosedWindow",void 0),r(this,"timeout",void 0),this.url=t,this.target=n||"_blank",this.features=i||function(){if("undefined"==typeof window)return"";const e=void 0!==window.screenLeft?window.screenLeft:window.screenX,t=void 0!==window.screenTop?window.screenTop:window.screenY,r=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,n=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,i=Math.abs((r-1200)/2/1+e);return`titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=700,width=1200,top=${Math.abs((n-700)/2/1+t)},left=${i}`}(),this.window=void 0,this.windowTimer=void 0,this.iClosedWindow=!1,this.timeout=o,this._setupTimer()}_setupTimer(){this.windowTimer=Number(setInterval((()=>{this.window&&this.window.closed&&(clearInterval(this.windowTimer),setTimeout((()=>{this.iClosedWindow||this.emit("close"),this.iClosedWindow=!1,this.window=void 0}),this.timeout)),void 0===this.window&&clearInterval(this.windowTimer)}),500))}open(){var e;if(this.window=window.open(this.url,this.target,this.features),!this.window)throw NAe.popupBlocked();null!==(e=this.window)&&void 0!==e&&e.focus&&this.window.focus()}close(){this.iClosedWindow=!0,this.window&&this.window.close()}redirect(e){e?window.location.replace(this.url):window.location.href=this.url}async listenOnChannel(e){const t=new MAe,r=await t.subscribe(e);this.close(),t.cleanup();const n=JSON.parse(r);return n.error?{error:n.error,state:n.state}:n.data}}class DAe{constructor(e){if(r(this,"state",{}),r(this,"options",void 0),r(this,"sessionManager",void 0),r(this,"currentStorage",void 0),r(this,"_storageBaseKey","openlogin_store"),r(this,"dappState",void 0),r(this,"addVersionInUrls",!0),!e.clientId)throw BAe.invalidParams("clientId is required");if(e.network||(e.network=Tf.SAPPHIRE_MAINNET),e.buildEnv||(e.buildEnv=Uf),(e.buildEnv===jf||e.buildEnv===zf||e.sdkUrl)&&(this.addVersionInUrls=!1),e.sdkUrl||e.useMpc||(e.buildEnv===jf?(e.sdkUrl="http://localhost:3000",e.dashboardUrl="http://localhost:5173/wallet/account"):e.buildEnv===Df?(e.sdkUrl="https://staging-auth.web3auth.io",e.dashboardUrl="https://staging-account.web3auth.io/wallet/account"):e.buildEnv===zf?(e.sdkUrl="https://develop-auth.web3auth.io",e.dashboardUrl="https://develop-account.web3auth.io/wallet/account"):(e.sdkUrl="https://auth.web3auth.io",e.dashboardUrl="https://account.web3auth.io/wallet/account")),e.useMpc&&!e.sdkUrl){if(Object.values(vf).includes(e.network))throw new Error("MPC is not supported on legacy networks, please use sapphire_devnet or sapphire_mainnet.");e.buildEnv===jf?e.sdkUrl="http://localhost:3000":e.buildEnv===Df?e.sdkUrl="https://staging-mpc-auth.web3auth.io":e.buildEnv===zf?e.sdkUrl="https://develop-mpc-auth.web3auth.io":e.sdkUrl="https://mpc-auth.web3auth.io"}e.redirectUrl||"undefined"==typeof window||(e.redirectUrl=`${window.location.protocol}//${window.location.host}${window.location.pathname}`),e.uxMode||(e.uxMode=If),"boolean"!=typeof e.replaceUrlOnRedirect&&(e.replaceUrlOnRedirect=!0),e.originData||(e.originData={}),e.whiteLabel||(e.whiteLabel={}),e.loginConfig||(e.loginConfig={}),e.mfaSettings||(e.mfaSettings={}),e.storageServerUrl||(e.storageServerUrl="https://broadcast-server.tor.us"),e.storageKey||(e.storageKey="local"),e.webauthnTransports||(e.webauthnTransports=["internal"]),e.sessionTime||(e.sessionTime=86400),this.options=e}get privKey(){return this.options.useMpc?this.state.factorKey||"":this.state.privKey?this.state.privKey.padStart(64,"0"):""}get coreKitKey(){return this.state.coreKitKey?this.state.coreKitKey.padStart(64,"0"):""}get ed25519PrivKey(){return this.state.ed25519PrivKey?this.state.ed25519PrivKey.padStart(128,"0"):""}get coreKitEd25519Key(){return this.state.coreKitEd25519PrivKey?this.state.coreKitEd25519PrivKey.padStart(128,"0"):""}get sessionId(){return this.state.sessionId||""}get sessionNamespace(){return this.options.sessionNamespace||""}get appState(){return this.state.userInfo.appState||this.dappState||""}get baseUrl(){return this.addVersionInUrls?`${this.options.sdkUrl}/v${"6.2.11".split(".")[0]}`:`${this.options.sdkUrl}`}async init(){const e=FAe(this.options.replaceUrlOnRedirect);e.sessionNamespace&&(this.options.sessionNamespace=e.sessionNamespace);const t=this.options.sessionNamespace?`${this._storageBaseKey}_${this.options.sessionNamespace}`:this._storageBaseKey;this.currentStorage=Sf.getInstance(t,this.options.storageKey);const r=this.currentStorage.get("sessionId");if(this.sessionManager=new oEe({sessionServerBaseUrl:this.options.storageServerUrl,sessionNamespace:this.options.sessionNamespace,sessionTime:this.options.sessionTime,sessionId:r}),this.options.network!==Tf.TESTNET&&this.options.network!==Tf.SAPPHIRE_DEVNET||console.log(`%c WARNING! You are on ${this.options.network}. Please set network: 'mainnet' or 'sapphire_mainnet' in production`,"color: #FF0000"),this.options.buildEnv!==Uf&&console.log(`%c WARNING! You are using build env ${this.options.buildEnv}. Please set buildEnv: 'production' in production`,"color: #FF0000"),e.error)throw this.dappState=e.state,NAe.loginFailed(e.error);if(e.sessionId&&(this.currentStorage.set("sessionId",e.sessionId),this.sessionManager.sessionId=e.sessionId),this.sessionManager.sessionId){const e=await this._authorizeSession();this.updateState(e),0===Object.keys(e).length&&this.currentStorage.set("sessionId","")}}async login(e){if(!e.loginProvider)throw NAe.invalidLoginParams("loginProvider is required");const t={redirectUrl:this.options.redirectUrl},r=i(i({loginProvider:e.loginProvider},t),e),n={actionType:Nf,options:this.options,params:r},o=await this.openloginHandler(`${this.baseUrl}/start`,n,UAe(e.loginProvider));if(this.options.uxMode===If)return null;if(o.error)throw this.dappState=o.state,NAe.loginFailed(o.error);return this.sessionManager.sessionId=o.sessionId,this.options.sessionNamespace=o.sessionNamespace,this.currentStorage.set("sessionId",o.sessionId),await this.rehydrateSession(),{privKey:this.privKey}}async logout(){if(!this.sessionManager.sessionId)throw NAe.userNotLoggedIn();await this.sessionManager.invalidateSession(),this.updateState({privKey:"",coreKitKey:"",coreKitEd25519PrivKey:"",ed25519PrivKey:"",walletKey:"",oAuthPrivateKey:"",tKey:"",metadataNonce:"",keyMode:void 0,userInfo:{name:"",profileImage:"",dappShare:"",idToken:"",oAuthIdToken:"",oAuthAccessToken:"",appState:"",email:"",verifier:"",verifierId:"",aggregateVerifier:"",typeOfLogin:"",isMfaEnabled:!1},authToken:"",sessionId:"",factorKey:"",signatures:[],tssShareIndex:-1,tssPubKey:"",tssShare:"",tssNonce:-1}),this.currentStorage.set("sessionId","")}async enableMFA(e){var t;if(!this.sessionId)throw NAe.userNotLoggedIn();if(this.state.userInfo.isMfaEnabled)throw NAe.mfaAlreadyEnabled();const r={redirectUrl:this.options.redirectUrl},n={actionType:Rf,options:this.options,params:i(i(i({},r),e),{},{loginProvider:this.state.userInfo.typeOfLogin,extraLoginOptions:{login_hint:this.state.userInfo.verifierId},mfaLevel:"mandatory"}),sessionId:this.sessionId},o=await this.openloginHandler(`${this.baseUrl}/start`,n,UAe(n.params.loginProvider));if(this.options.uxMode===If)return null;if(o.error)throw this.dappState=o.state,NAe.loginFailed(o.error);return this.sessionManager.sessionId=o.sessionId,this.options.sessionNamespace=o.sessionNamespace,this.currentStorage.set("sessionId",o.sessionId),await this.rehydrateSession(),Boolean(null===(t=this.state.userInfo)||void 0===t?void 0:t.isMfaEnabled)}async manageMFA(e){if(!this.sessionId)throw NAe.userNotLoggedIn();if(!this.state.userInfo.isMfaEnabled)throw NAe.mfaNotEnabled();const t={redirectUrl:this.options.dashboardUrl,dappUrl:`${window.location.origin}${window.location.pathname}`},r={actionType:Ff,options:this.options,params:i(i(i({},t),e),{},{loginProvider:this.state.userInfo.typeOfLogin,extraLoginOptions:{login_hint:this.state.userInfo.verifierId}})},n={loginId:await this.getLoginId(r),sessionNamespace:this.options.network,storageServerUrl:this.options.storageServerUrl},o=LAe({baseURL:`${this.baseUrl}/start`,hash:{b64Params:xf(n)}});window.open(o,"_blank")}async changeSocialFactor(e){if(!this.sessionId)throw NAe.userNotLoggedIn();const t={redirectUrl:this.options.redirectUrl},r={actionType:Lf,options:this.options,params:i(i({},t),e),sessionId:this.sessionId},n=await this.openloginHandler(`${this.baseUrl}/start`,r);if(this.options.uxMode!==If)return this.sessionManager.sessionId=n.sessionId,this.options.sessionNamespace=n.sessionNamespace,this.currentStorage.set("sessionId",n.sessionId),await this.rehydrateSession(),!0}getUserInfo(){if(!this.sessionManager.sessionId)throw NAe.userNotLoggedIn();return this.state.userInfo}async getLoginId(e){if(!this.sessionManager)throw BAe.notInitialized();const t=oEe.generateRandomSessionKey(),r=new oEe({sessionServerBaseUrl:this.options.storageServerUrl,sessionNamespace:this.options.sessionNamespace,sessionTime:600,sessionId:t});return await r.createSession(JSON.parse(JSON.stringify(e))),t}async _authorizeSession(){try{if(!this.sessionManager.sessionId)return{};return await this.sessionManager.authorizeSession()}catch(e){return RAe.error("authorization failed",e),{}}}updateState(e){this.state=i(i({},this.state),e)}async rehydrateSession(){const e=await this._authorizeSession();this.updateState(e)}async openloginHandler(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e4;const n=await this.getLoginId(t),i={loginId:n,sessionNamespace:this.options.sessionNamespace,storageServerUrl:this.options.storageServerUrl};if(this.options.uxMode===If){const t=LAe({baseURL:e,hash:{b64Params:xf(i)}});return void(window.location.href=t)}const o=LAe({baseURL:e,hash:{b64Params:xf(i)}}),a=new jAe({url:o,timeout:r});return new Promise(((e,t)=>{a.on("close",(()=>{t(NAe.popupClosed())})),a.listenOnChannel(n).then(e).catch(t);try{a.open()}catch(e){t(e)}}))}}class zAe extends yd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(e),r(this,"name",pd.OPENLOGIN),r(this,"adapterNamespace",id),r(this,"type",md),r(this,"openloginInstance",null),r(this,"status",bd.NOT_READY),r(this,"currentChainNamespace",nd.EIP155),r(this,"privateKeyProvider",null),r(this,"openloginOptions",void 0),r(this,"loginSettings",{loginProvider:""}),this.setAdapterSettings(i(i({},e.adapterSettings),{},{chainConfig:e.chainConfig,clientId:e.clientId||"",sessionTime:e.sessionTime,web3AuthNetwork:e.web3AuthNetwork,useCoreKitKey:e.useCoreKitKey,privateKeyProvider:e.privateKeyProvider})),this.loginSettings=e.loginSettings||{loginProvider:""},this.privateKeyProvider=e.privateKeyProvider||null}get chainConfigProxy(){return this.chainConfig?i({},this.chainConfig):null}get provider(){return this.status!==bd.NOT_READY&&this.privateKeyProvider?this.privateKeyProvider:null}set provider(e){throw new Error("Not implemented")}async init(e){if(super.checkInitializationRequirements(),!this.clientId)throw sd.invalidParams("clientId is required before openlogin's initialization");if(!this.openloginOptions)throw sd.invalidParams("openloginOptions is required before openlogin's initialization");const t=this.openloginOptions.uxMode===If;if(this.openloginOptions=i(i({},this.openloginOptions),{},{replaceUrlOnRedirect:t}),this.openloginInstance=new DAe(i(i({},this.openloginOptions),{},{clientId:this.clientId,network:this.openloginOptions.network||this.web3AuthNetwork||Tf.SAPPHIRE_MAINNET})),vd.debug("initializing openlogin adapter init"),await this.openloginInstance.init(),!this.chainConfig)throw sd.invalidParams("chainConfig is required before initialization");this.status=bd.READY,this.emit(gd.READY,pd.OPENLOGIN);try{vd.debug("initializing openlogin adapter");this._getFinalPrivKey()&&(e.autoConnect||t)&&(this.rehydrated=!0,await this.connect())}catch(e){vd.error("Failed to connect with cached openlogin provider",e),this.emit("ERRORED",e)}}async connect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{loginProvider:""};super.checkConnectionRequirements(),this.status=bd.CONNECTING,this.emit(gd.CONNECTING,i(i({},e),{},{adapter:pd.OPENLOGIN}));try{return await this.connectWithProvider(e),this.provider}catch(e){if(vd.error("Failed to connect with openlogin provider",e),this.status=bd.READY,this.emit(gd.ERRORED,e),null!=e&&e.message.includes("user closed popup"))throw cd.popupClosed();if(e instanceof ad)throw e;throw cd.connectionError("Failed to login with openlogin")}}async disconnect(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{cleanup:!1};if(this.status!==bd.CONNECTED)throw cd.notConnectedError("Not connected with wallet");if(!this.openloginInstance)throw sd.notReady("openloginInstance is not ready");await this.openloginInstance.logout(),e.cleanup?(this.status=bd.NOT_READY,this.openloginInstance=null,this.privateKeyProvider=null):this.status=bd.READY,this.rehydrated=!1,this.emit(gd.DISCONNECTED)}async authenticateUser(){if(this.status!==bd.CONNECTED)throw cd.notConnectedError("Not connected with wallet, Please login/connect first");return{idToken:(await this.getUserInfo()).idToken}}async getUserInfo(){if(this.status!==bd.CONNECTED)throw cd.notConnectedError("Not connected with wallet");if(!this.openloginInstance)throw sd.notReady("openloginInstance is not ready");return this.openloginInstance.getUserInfo()}setAdapterSettings(e){super.setAdapterSettings(e);const t={adapterSettings:{network:Tf.SAPPHIRE_MAINNET,clientId:"",uxMode:Pf},loginSettings:{},privateKeyProvider:void 0};vd.info("setting adapter settings",e),this.openloginOptions=i(i(i({},t.adapterSettings),this.openloginOptions),e),e.web3AuthNetwork&&(this.openloginOptions.network=e.web3AuthNetwork),e.privateKeyProvider&&(this.privateKeyProvider=e.privateKeyProvider)}async addChain(e){var t;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.checkAddChainRequirements(e,r),null===(t=this.privateKeyProvider)||void 0===t||t.addChain(e),this.addChainConfig(e)}async switchChain(e){var t;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super.checkSwitchChainRequirements(e,r),await(null===(t=this.privateKeyProvider)||void 0===t?void 0:t.switchChain(e)),this.setAdapterSettings({chainConfig:this.getChainConfig(e.chainId)})}_getFinalPrivKey(){if(!this.openloginInstance)return"";let e=this.openloginInstance.privKey;if(this.useCoreKitKey){if(this.openloginInstance.privKey&&!this.openloginInstance.coreKitKey)throw cd.coreKitKeyNotFound();e=this.openloginInstance.coreKitKey}return e}_getFinalEd25519PrivKey(){if(!this.openloginInstance)return"";let e=this.openloginInstance.ed25519PrivKey;if(this.useCoreKitKey){if(this.openloginInstance.ed25519PrivKey&&!this.openloginInstance.coreKitEd25519Key)throw cd.coreKitKeyNotFound();e=this.openloginInstance.coreKitEd25519Key}return e}async connectWithProvider(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{loginProvider:""};if(!this.privateKeyProvider)throw sd.invalidParams("PrivateKey Provider is required before initialization");if(!this.openloginInstance)throw sd.notReady("openloginInstance is not ready");if(!this._getFinalPrivKey()||null!==(e=t.extraLoginOptions)&&void 0!==e&&e.id_token){var r;if(this.loginSettings.curve||(this.loginSettings.curve=this.currentChainNamespace===nd.SOLANA?Mf:Of),!t.loginProvider&&!this.loginSettings.loginProvider)throw sd.invalidParams("loginProvider is required for login");await this.openloginInstance.login(Kf(this.loginSettings,t,{extraLoginOptions:i(i({},t.extraLoginOptions||{}),{},{login_hint:t.login_hint||(null===(r=t.extraLoginOptions)||void 0===r?void 0:r.login_hint)})}))}let n=this._getFinalPrivKey();n&&(this.currentChainNamespace===nd.SOLANA&&(n=this._getFinalEd25519PrivKey()),await this.privateKeyProvider.setupProvider(n),this.status=bd.CONNECTED,this.emit(gd.CONNECTED,{adapter:pd.OPENLOGIN,reconnected:this.rehydrated}))}}let $Ae=null,HAe=null;const GAe={"0x13882":nEe,"0x89":rEe,"0x1":tEe},qAe={"0x13882":"90812738-dff4-49fd-a375-314d83e71beb","0x89":"e93be2e6-08fe-4f70-b20a-0a1707381029","0x1":"0b421b2d-d3ae-4a03-8bb1-126539276fcd"},KAe="0x89";console.log("env","production");const VAe={chainNamespace:"eip155",chainId:"0x13882",rpcTarget:"https://polygon-amoy.g.alchemy.com/v2/yfPnDjn4YVGDpSBun0Y9jv9XvrRKq1Vs",displayName:"Polygon Amoy Testnet",blockExplorer:"https://www.oklink.com/amoy",ticker:"MATIC",tickerName:"Matic"};let WAe="",JAe="",ZAe="";const YAe=async(e,t,r,n)=>{if(!HAe)return void console.log("web3auth not initialized yet");console.log("Setting in Login!",e,t,r);const i={mfaLevel:"default",loginProvider:e,redirectUrl:`${n}${r}`};console.log(t),t&&(i.extraLoginOptions={login_hint:t,domain:ZAe,verifierIdField:"name"}),console.log(i);const o=await HAe.connectTo(pd.OPENLOGIN,i),a=await DZ.init({projectId:qAe[KAe],owner:lQ(o),opts:{paymasterConfig:{policy:"VERIFYING_PAYMASTER"}}});$Ae=a},XAe=async()=>{HAe?(await HAe.logout(),$Ae=null):console.log("web3auth not initialized yet")},QAe=async e=>{try{const t=new TE({clientId:"BAPdzmJPQYTJV7zblzErbez6KFzOvRGzvA4k9pQZh7R-X0AwhZ4ZpQAWCWSTca8PS8MLGSqEY33ymiqxrfGAGbU",web3AuthNetwork:"sapphire_mainnet",chainConfig:VAe}),r=new xpe({config:{chainConfig:VAe}});WAe=e.auth0.verifierID?e.auth0.verifierID:"layered-demo-email-passwordless_1705700808",JAe=e.auth0.clientID?e.auth0.clientID:"zEkEfeWPDgRgpvnwPc0xEK58NOV97T6W",ZAe=e.auth0.domain?e.auth0.domain:"https://dev-wvj8ilnmab2m0q11.us.auth0.com";const n=new zAe({adapterSettings:{uxMode:"redirect",whiteLabel:{appName:e.name?e.name:"Layered.xyz",appUrl:e.url?e.url:"https://layered.xyz",logoLight:e.logo?e.logo:"https://layered-brand-assets.s3.us-west-1.amazonaws.com/Logo+Only+Light.png",logoDark:e.logo?e.logo:"https://layered-brand-assets.s3.us-west-1.amazonaws.com/Logo+Only+Light.png",defaultLanguage:"en",mode:"dark",theme:{primary:e.primary?e.primary:"#00D1B2"},useLogoLoader:!0},loginConfig:{google:{verifier:"layered-demo-google-test_1705700808",typeOfLogin:"google",clientId:"672620586559-gd914s8o98oerjlu1dhd28qajn6hq1dq.apps.googleusercontent.com"},facebook:{verifier:"Facebook verifier name from web3auth dashboard",typeOfLogin:"facebook",clientId:"Facebook Client ID"},linkedin:{verifier:"verifier on web3auth dashboard",typeOfLogin:"linkedin",clientId:"CLient id from linkedin"},jwt:{verifier:WAe,typeOfLogin:"jwt",clientId:JAe}}},privateKeyProvider:r});if(t.configureAdapter(n),await t.init(),await t.addChain({chainNamespace:"eip155",chainId:"0x89",rpcTarget:"https://polygon-mainnet.g.alchemy.com/v2/26uv2UQi8g99zBpSFbpQ2hqNCYVzQLci",displayName:"Polygon Mainnet",blockExplorer:"https://polygonscan.com/",ticker:"MATIC",tickerName:"Matic"}),await t.addChain({chainNamespace:"eip155",chainId:"0x1",rpcTarget:"https://eth-mainnet.g.alchemy.com/v2/jmYwXxpmuvaarrxh3X2X-0Qu3rfhhxv7",displayName:"Ethereum Mainnet",blockExplorer:"https://etherscan.io/",ticker:"ETH",tickerName:"Ether"}),HAe=t,t.provider&&t.connected){console.log("setting zeroDev",qAe[KAe],t.provider);const e=await DZ.init({projectId:qAe[KAe],owner:lQ(t.provider),opts:{paymasterConfig:{policy:"VERIFYING_PAYMASTER"}}});console.log("new prov",e),$Ae=e}console.log(HAe),console.log($Ae)}catch(e){console.error(e)}},exe=async(e,t)=>{if(!HAe)return console.log("web3auth not initialized yet"),void await t(null);if(!GAe[e]||!qAe[e])return console.log("Unsupported chainId"),void await t(null);await HAe.switchChain({chainId:e});const r=await DZ.init({projectId:qAe[e],owner:lQ(HAe.provider),opts:{paymasterConfig:{policy:"VERIFYING_PAYMASTER"}}});$Ae=r,await t($Ae)},txe=async()=>HAe?$Ae:(console.log("web3auth not initialized yet"),null),rxe=async()=>{if(!HAe)return console.log("web3auth not initialized yet"),null;return await HAe.getUserInfo()};var nxe={},ixe={};const oxe="abi/5.7.0",axe=new P$(oxe),sxe={};let cxe={calldata:!0,memory:!0,storage:!0},uxe={calldata:!0,memory:!0};function lxe(e,t){if("bytes"===e||"string"===e){if(cxe[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&uxe[t])return!0;return(cxe[t]||"payable"===t)&&axe.throwArgumentError("invalid modifier","name",t),!1}function fxe(e,t){for(let r in t)O$(e,r,t[r])}const dxe=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),hxe=new RegExp(/^(.*)\[([0-9]*)\]$/);class pxe{constructor(e,t){e!==sxe&&axe.throwError("use fromString",P$.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),fxe(this,t);let r=this.type.match(hxe);fxe(this,r?{arrayLength:parseInt(r[2]||"-1"),arrayChildren:pxe.fromObject({type:r[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=dxe.sighash),dxe[e]||axe.throwArgumentError("invalid format type","format",e),e===dxe.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!==dxe.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===dxe.full?", ":",")+")"):t+=this.type,e!==dxe.sighash&&(!0===this.indexed&&(t+=" indexed"),e===dxe.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?pxe.fromString(e,t):pxe.fromObject(e)}static fromObject(e){return pxe.isParamType(e)?e:new pxe(sxe,{name:e.name||null,type:kxe(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(pxe.fromObject):null})}static fromString(e,t){return function(e){return pxe.fromObject({name:e.name,type:e.type,indexed:e.indexed,components:e.components})}(function(e,t){let r=e;function n(t){axe.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let r=0;rpxe.fromString(e,t)))}class bxe{constructor(e,t){e!==sxe&&axe.throwError("use a static from method",P$.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),fxe(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return bxe.isFragment(e)?e:"string"==typeof e?bxe.fromString(e):bxe.fromObject(e)}static fromObject(e){if(bxe.isFragment(e))return e;switch(e.type){case"function":return Axe.fromObject(e);case"event":return gxe.fromObject(e);case"constructor":return Exe.fromObject(e);case"error":return _xe.fromObject(e);case"fallback":case"receive":return null}return axe.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]?gxe.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Axe.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Exe.fromString(e.trim()):"error"===e.split(" ")[0]?_xe.fromString(e.substring(5).trim()):axe.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class gxe extends bxe{format(e){if(e||(e=dxe.sighash),dxe[e]||axe.throwArgumentError("invalid format type","format",e),e===dxe.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!==dxe.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===dxe.full?", ":",")+") ",e!==dxe.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?gxe.fromString(e):gxe.fromObject(e)}static fromObject(e){if(gxe.isEventFragment(e))return e;"event"!==e.type&&axe.throwArgumentError("invalid event object","value",e);const t={name:Pxe(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(pxe.fromObject):[],type:"event"};return new gxe(sxe,t)}static fromString(e){let t=e.match(Ixe);t||axe.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":r=!0;break;case"":break;default:axe.warn("unknown modifier: "+e)}})),gxe.fromObject({name:t[1].trim(),anonymous:r,inputs:mxe(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function yxe(e,t){t.gas=null;let r=e.split("@");return 1!==r.length?(r.length>2&&axe.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||axe.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=EH.from(r[1]),r[0]):e}function vxe(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 wxe(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&&axe.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&axe.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||axe.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&&axe.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&&axe.throwArgumentError("unable to determine stateMutability","value",e),t}class Exe extends bxe{format(e){if(e||(e=dxe.sighash),dxe[e]||axe.throwArgumentError("invalid format type","format",e),e===dxe.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===dxe.sighash&&axe.throwError("cannot format a constructor for sighash",P$.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===dxe.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?Exe.fromString(e):Exe.fromObject(e)}static fromObject(e){if(Exe.isConstructorFragment(e))return e;"constructor"!==e.type&&axe.throwArgumentError("invalid constructor object","value",e);let t=wxe(e);t.constant&&axe.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(pxe.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?EH.from(e.gas):null};return new Exe(sxe,r)}static fromString(e){let t={type:"constructor"},r=(e=yxe(e,t)).match(Ixe);return r&&"constructor"===r[1].trim()||axe.throwArgumentError("invalid constructor string","value",e),t.inputs=mxe(r[2].trim(),!1),vxe(r[3].trim(),t),Exe.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class Axe extends Exe{format(e){if(e||(e=dxe.sighash),dxe[e]||axe.throwArgumentError("invalid format type","format",e),e===dxe.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!==dxe.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===dxe.full?", ":",")+") ",e!==dxe.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?Axe.fromString(e):Axe.fromObject(e)}static fromObject(e){if(Axe.isFunctionFragment(e))return e;"function"!==e.type&&axe.throwArgumentError("invalid function object","value",e);let t=wxe(e);const r={type:e.type,name:Pxe(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(pxe.fromObject):[],outputs:e.outputs?e.outputs.map(pxe.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?EH.from(e.gas):null};return new Axe(sxe,r)}static fromString(e){let t={type:"function"},r=(e=yxe(e,t)).split(" returns ");r.length>2&&axe.throwArgumentError("invalid function string","value",e);let n=r[0].match(Ixe);if(n||axe.throwArgumentError("invalid function signature","value",e),t.name=n[1].trim(),t.name&&Pxe(t.name),t.inputs=mxe(n[2],!1),vxe(n[3].trim(),t),r.length>1){let n=r[1].match(Ixe);""==n[1].trim()&&""==n[3].trim()||axe.throwArgumentError("unexpected tokens","value",e),t.outputs=mxe(n[2],!1)}else t.outputs=[];return Axe.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function xxe(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||axe.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class _xe extends bxe{format(e){if(e||(e=dxe.sighash),dxe[e]||axe.throwArgumentError("invalid format type","format",e),e===dxe.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==dxe.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===dxe.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?_xe.fromString(e):_xe.fromObject(e)}static fromObject(e){if(_xe.isErrorFragment(e))return e;"error"!==e.type&&axe.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:Pxe(e.name),inputs:e.inputs?e.inputs.map(pxe.fromObject):[]};return xxe(new _xe(sxe,t))}static fromString(e){let t={type:"error"},r=e.match(Ixe);return r||axe.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&Pxe(t.name),t.inputs=mxe(r[2],!1),xxe(_xe.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function kxe(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const Sxe=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Pxe(e){return e&&e.match(Sxe)||axe.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Ixe=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Txe=new P$(oxe);function Oxe(e){const t=[],r=function(e,n){if(Array.isArray(n))for(let i in n){const o=e.slice();o.push(i);try{r(o,n[i])}catch(e){t.push({path:o,error:e})}}};return r([],e),t}class Mxe{constructor(e,t,r,n){this.name=e,this.type=t,this.localName=r,this.dynamic=n}_throwError(e,t){Txe.throwArgumentError(e,this.localName,t)}}class Cxe{constructor(e){O$(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return sH(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(Q$(e._data))}writeBytes(e){let t=X$(e);const r=t.length%this.wordSize;return r&&(t=Q$([t,this._padding.slice(r)])),this._writeData(t)}_getValue(e){let t=X$(EH.from(e));return t.length>this.wordSize&&Txe.throwError("value out-of-bounds",P$.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Q$([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 Bxe{constructor(e,t,r,n){O$(this,"_data",X$(e)),O$(this,"wordSize",t||32),O$(this,"_coerceFunc",r),O$(this,"allowLoose",n),this._offset=0}get data(){return iH(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):Bxe.coerce(e,t)}_peekBytes(e,t,r){let n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:Txe.throwError("data out-of-bounds",P$.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}subReader(e){return new Bxe(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return EH.from(this.readBytes(this.wordSize))}}class Nxe extends Mxe{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=rG(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return rG(lH(e.readValue().toHexString(),20))}}class Rxe extends Mxe{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 Fxe=new P$(oxe);function Lxe(e,t,r){let n=null;if(Array.isArray(r))n=r;else if(r&&"object"==typeof r){let e={};n=t.map((t=>{const n=t.localName;return n||Fxe.throwError("cannot encode object for signature with missing names",P$.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]&&Fxe.throwError("cannot encode object for signature with duplicate names",P$.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:r}),e[n]=!0,r[n]}))}else Fxe.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&Fxe.throwArgumentError("types/value length mismatch","tuple",r);let i=new Cxe(e.wordSize),o=new Cxe(e.wordSize),a=[];t.forEach(((e,t)=>{let r=n[t];if(e.dynamic){let t=o.length;e.encode(o,r);let n=i.writeUpdatableValue();a.push((e=>{n(e+t)}))}else e.encode(i,r)})),a.forEach((e=>{e(i.length)}));let s=e.appendWriter(i);return s+=e.appendWriter(o),s}function Uxe(e,t){let r=[],n=e.subReader(0);t.forEach((t=>{let i=null;if(t.dynamic){let r=e.readValue(),o=n.subReader(r.toNumber());try{i=t.decode(o)}catch(e){if(e.code===P$.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===P$.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}null!=i&&r.push(i)}));const i=t.reduce(((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});t.forEach(((e,t)=>{let n=e.localName;if(!n||1!==i[n])return;if("length"===n&&(n="_length"),null!=r[n])return;const o=r[t];o instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}}):r[n]=o}));for(let e=0;e{throw t}})}return Object.freeze(r)}class jxe extends Mxe{constructor(e,t,r){super("array",e.type+"["+(t>=0?t:"")+"]",r,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;re._data.length&&Fxe.throwError("insufficient data length",P$.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let e=0;e{e.dynamic&&(r=!0),n.push(e.type)}));super("tuple","tuple("+n.join(",")+")",t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach((t=>{e.push(t.defaultValue())}));const t=this.coders.reduce(((e,t)=>{const r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});return this.coders.forEach(((r,n)=>{let i=r.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[n]))})),Object.freeze(e)}encode(e,t){return Lxe(e,this.coders,t)}decode(e){return e.coerce(this.name,Uxe(e,this.coders))}}const Wxe=new P$(oxe),Jxe=new RegExp(/^bytes([0-9]*)$/),Zxe=new RegExp(/^(u?int)([0-9]*)$/);class Yxe{constructor(e){O$(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new Nxe(e.name);case"bool":return new Dxe(e.name);case"string":return new Kxe(e.name);case"bytes":return new $xe(e.name);case"array":return new jxe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Vxe((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new Gxe(e.name)}let t=e.type.match(Zxe);if(t){let r=parseInt(t[2]||"256");return(0===r||r>256||r%8!=0)&&Wxe.throwArgumentError("invalid "+t[1]+" bit length","param",e),new qxe(r/8,"int"===t[1],e.name)}if(t=e.type.match(Jxe),t){let r=parseInt(t[1]);return(0===r||r>32)&&Wxe.throwArgumentError("invalid bytes length","param",e),new Hxe(r,e.name)}return Wxe.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new Bxe(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new Cxe(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(pxe.from(e))));return new Vxe(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Wxe.throwError("types/values length mismatch",P$.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map((e=>this._getCoder(pxe.from(e)))),n=new Vxe(r,"_"),i=this._getWriter();return n.encode(i,t),i.data}decode(e,t,r){const n=e.map((e=>this._getCoder(pxe.from(e))));return new Vxe(n,"_").decode(this._getReader(X$(t),r))}}const Xxe=new Yxe,Qxe=new P$(oxe);class e_e extends j${}class t_e extends j${}class r_e extends j${}class n_e extends j${static isIndexed(e){return!(!e||!e._isIndexed)}}const i_e={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function o_e(e,t){const r=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return r.error=t,r}class a_e{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,O$(this,"fragments",t.map((e=>bxe.from(e))).filter((e=>null!=e))),O$(this,"_abiCoder",M$(new.target,"getAbiCoder")()),O$(this,"functions",{}),O$(this,"errors",{}),O$(this,"events",{}),O$(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void Qxe.warn("duplicate definition - constructor"):void O$(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let r=e.format();t[r]?Qxe.warn("duplicate definition - "+r):t[r]=e})),this.deploy||O$(this,"deploy",Exe.from({payable:!1,type:"constructor"})),O$(this,"_isInterface",!0)}format(e){e||(e=dxe.full),e===dxe.sighash&&Qxe.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===dxe.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return Xxe}static getAddress(e){return rG(e)}static getSighash(e){return aH(DG(e.format()),0,4)}static getEventTopic(e){return DG(e.format())}getFunction(e){if(rH(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];Qxe.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.functions).filter((e=>e.split("(")[0]===t));return 0===r.length?Qxe.throwArgumentError("no matching function","name",t):r.length>1&&Qxe.throwArgumentError("multiple matching functions","name",t),this.functions[r[0]]}const t=this.functions[Axe.fromString(e).format()];return t||Qxe.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(rH(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];Qxe.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.events).filter((e=>e.split("(")[0]===t));return 0===r.length?Qxe.throwArgumentError("no matching event","name",t):r.length>1&&Qxe.throwArgumentError("multiple matching events","name",t),this.events[r[0]]}const t=this.events[gxe.fromString(e).format()];return t||Qxe.throwArgumentError("no matching event","signature",e),t}getError(e){if(rH(e)){const t=M$(this.constructor,"getSighash");for(const r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}Qxe.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),r=Object.keys(this.errors).filter((e=>e.split("(")[0]===t));return 0===r.length?Qxe.throwArgumentError("no matching error","name",t):r.length>1&&Qxe.throwArgumentError("multiple matching errors","name",t),this.errors[r[0]]}const t=this.errors[Axe.fromString(e).format()];return t||Qxe.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 M$(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),M$(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 r=X$(t);return iH(r.slice(0,4))!==this.getSighash(e)&&Qxe.throwArgumentError(`data signature does not match error ${e.name}.`,"data",iH(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),iH(Q$([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const r=X$(t);return iH(r.slice(0,4))!==this.getSighash(e)&&Qxe.throwArgumentError(`data signature does not match function ${e.name}.`,"data",iH(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),iH(Q$([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let r=X$(t),n=null,i="",o=null,a=null,s=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(e){}break;case 4:{const e=iH(r.slice(0,4)),t=i_e[e];if(t)o=this._abiCoder.decode(t.inputs,r.slice(4)),a=t.name,s=t.signature,t.reason&&(n=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,r.slice(4)),a=t.name,s=t.format()}catch(e){}break}}return Qxe.throwError("call revert exception"+i,P$.errors.CALL_EXCEPTION,{method:e.format(),data:iH(t),errorArgs:o,errorName:a,errorSignature:s,reason:n})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),iH(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Qxe.throwError("too many arguments for "+e.format(),P$.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const n=(e,t)=>"string"===e.type?DG(t):"bytes"===e.type?zH(iH(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=EH.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),lH(iH(t),32));for(t.forEach(((t,i)=>{let o=e.inputs[i];o.indexed?null==t?r.push(null):"array"===o.baseType||"tuple"===o.baseType?Qxe.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,t):Array.isArray(t)?r.push(t.map((e=>n(o,e)))):r.push(n(o,t)):null!=t&&Qxe.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,t)}));r.length&&null===r[r.length-1];)r.pop();return r}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));const r=[],n=[],i=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Qxe.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,o)=>{const a=t[o];if(e.indexed)if("string"===e.type)r.push(DG(a));else if("bytes"===e.type)r.push(zH(a));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");r.push(this._abiCoder.encode([e.type],[a]))}else n.push(e),i.push(a)})),{data:this._abiCoder.encode(n,i),topics:r}}decodeEventLog(e,t,r){if("string"==typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){let t=this.getEventTopic(e);rH(r[0],32)&&r[0].toLowerCase()===t||Qxe.throwError("fragment/topic mismatch",P$.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:r[0]}),r=r.slice(1)}let n=[],i=[],o=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(n.push(pxe.fromObject({type:"bytes32",name:e.name})),o.push(!0)):(n.push(e),o.push(!1)):(i.push(e),o.push(!1))}));let a=null!=r?this._abiCoder.decode(n,Q$(r)):null,s=this._abiCoder.decode(i,t,!0),c=[],u=0,l=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==a)c[t]=new n_e({_isIndexed:!0,hash:null});else if(o[t])c[t]=new n_e({_isIndexed:!0,hash:a[l++]});else try{c[t]=a[l++]}catch(e){c[t]=e}else try{c[t]=s[u++]}catch(e){c[t]=e}if(e.name&&null==c[e.name]){const r=c[t];r instanceof Error?Object.defineProperty(c,e.name,{enumerable:!0,get:()=>{throw o_e(`property ${JSON.stringify(e.name)}`,r)}}):c[e.name]=r}}));for(let e=0;e{throw o_e(`index ${e}`,t)}})}return Object.freeze(c)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new t_e({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:EH.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new e_e({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=iH(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new r_e({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!(!e||!e._isInterface)}}var s_e=function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}c((n=n.apply(e,t||[])).next())}))};const c_e=new P$("contracts/5.7.0"),u_e={chainId:!0,data:!0,from:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0,customData:!0,ccipReadEnabled:!0};function l_e(e,t){return s_e(this,void 0,void 0,(function*(){const r=yield t;"string"!=typeof r&&c_e.throwArgumentError("invalid address or ENS name","name",r);try{return rG(r)}catch(e){}e||c_e.throwError("a provider or signer is needed to resolve ENS names",P$.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield e.resolveName(r);return null==n&&c_e.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n}))}function f_e(e,t,r){return s_e(this,void 0,void 0,(function*(){return Array.isArray(r)?yield Promise.all(r.map(((r,n)=>f_e(e,Array.isArray(t)?t[n]:t[r.name],r)))):"address"===r.type?yield l_e(e,t):"tuple"===r.type?yield f_e(e,t,r.components):"array"===r.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>f_e(e,t,r.arrayChildren)))):Promise.reject(c_e.makeError("invalid value for array",P$.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function d_e(e,t,r){return s_e(this,void 0,void 0,(function*(){let n={};r.length===t.inputs.length+1&&"object"==typeof r[r.length-1]&&(n=N$(r.pop())),c_e.checkArgumentCount(r.length,t.inputs.length,"passed to contract"),e.signer?n.from?n.from=C$({override:l_e(e.signer,n.from),signer:e.signer.getAddress()}).then((e=>s_e(this,void 0,void 0,(function*(){return rG(e.signer)!==e.override&&c_e.throwError("Contract with a Signer cannot override from",P$.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):n.from=e.signer.getAddress():n.from&&(n.from=l_e(e.provider,n.from));const i=yield C$({args:f_e(e.signer||e.provider,r,t.inputs),address:e.resolvedAddress,overrides:C$(n)||{}}),o=e.interface.encodeFunctionData(t,i.args),a={data:o,to:i.address},s=i.overrides;if(null!=s.nonce&&(a.nonce=EH.from(s.nonce).toNumber()),null!=s.gasLimit&&(a.gasLimit=EH.from(s.gasLimit)),null!=s.gasPrice&&(a.gasPrice=EH.from(s.gasPrice)),null!=s.maxFeePerGas&&(a.maxFeePerGas=EH.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=EH.from(s.maxPriorityFeePerGas)),null!=s.from&&(a.from=s.from),null!=s.type&&(a.type=s.type),null!=s.accessList&&(a.accessList=HK(s.accessList)),null==a.gasLimit&&null!=t.gas){let e=21e3;const r=X$(o);for(let t=0;tnull!=n[e]));return c.length&&c_e.throwError(`cannot override ${c.map((e=>JSON.stringify(e))).join(",")}`,P$.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:c}),a}))}function h_e(e,t){const r=t.wait.bind(t);t.wait=t=>r(t).then((t=>(t.events=t.logs.map((r=>{let n=U$(r),i=null;try{i=e.interface.parseLog(r)}catch(e){}return i&&(n.args=i.args,n.decode=(t,r)=>e.interface.decodeEventLog(i.eventFragment,t,r),n.event=i.name,n.eventSignature=i.signature),n.removeListener=()=>e.provider,n.getBlock=()=>e.provider.getBlock(t.blockHash),n.getTransaction=()=>e.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>Promise.resolve(t),n})),t)))}function p_e(e,t,r){const n=e.signer||e.provider;return function(...i){return s_e(this,void 0,void 0,(function*(){let o;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=N$(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 d_e(e,t,i),s=yield n.call(a,o);try{let n=e.interface.decodeFunctionResult(t,s);return r&&1===t.outputs.length&&(n=n[0]),n}catch(t){throw t.code===P$.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=a),t}}))}}function m_e(e,t,r){return t.constant?p_e(e,t,r):function(e,t){return function(...r){return s_e(this,void 0,void 0,(function*(){e.signer||c_e.throwError("sending a transaction requires a signer",P$.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const n=yield d_e(e,t,r),i=yield e.signer.sendTransaction(n);return h_e(e,i),i}))}}(e,t)}function b_e(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 g_e{constructor(e,t){O$(this,"tag",e),O$(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((r=>!(!t&&r.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 r=e.slice();return setTimeout((()=>{t.listener.apply(this,r)}),0),!t.once})),t}prepareEvent(e){}getEmit(e){return[e]}}class y_e extends g_e{constructor(){super("error",null)}}class v_e extends g_e{constructor(e,t,r,n){const i={address:e};let o=t.getEventTopic(r);n?(o!==n[0]&&c_e.throwArgumentError("topic mismatch","topics",n),i.topics=n.slice()):i.topics=[o],super(b_e(i),i),O$(this,"address",e),O$(this,"interface",t),O$(this,"fragment",r)}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=Oxe(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class w_e extends g_e{constructor(e,t){super("*",{address:e}),O$(this,"address",e),O$(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,r)=>this.interface.decodeEventLog(t.eventFragment,e,r),e.args=t.args}catch(e){}}}class E_e{constructor(e,t,r){O$(this,"interface",M$(new.target,"getInterface")(t)),null==r?(O$(this,"provider",null),O$(this,"signer",null)):G$.isSigner(r)?(O$(this,"provider",r.provider||null),O$(this,"signer",r)):sG.isProvider(r)?(O$(this,"provider",r),O$(this,"signer",null)):c_e.throwArgumentError("invalid signer or provider","signerOrProvider",r),O$(this,"callStatic",{}),O$(this,"estimateGas",{}),O$(this,"functions",{}),O$(this,"populateTransaction",{}),O$(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const r=this.interface.events[t];O$(this.filters,t,((...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(r,e)}))),e[r.name]||(e[r.name]=[]),e[r.name].push(t)})),Object.keys(e).forEach((t=>{const r=e[t];1===r.length?O$(this.filters,t,this.filters[r[0]]):c_e.warn(`Duplicate definition of ${t} (${r.join(", ")})`)}))}if(O$(this,"_runningEvents",{}),O$(this,"_wrappedEmits",{}),null==e&&c_e.throwArgumentError("invalid contract address or ENS name","addressOrName",e),O$(this,"address",e),this.provider)O$(this,"resolvedAddress",l_e(this.provider,e));else try{O$(this,"resolvedAddress",Promise.resolve(rG(e)))}catch(e){c_e.throwError("provider is required to use ENS name as contract address",P$.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((e=>{}));const n={},i={};Object.keys(this.interface.functions).forEach((e=>{const t=this.interface.functions[e];if(i[e])c_e.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{i[e]=!0;{const r=t.name;n[`%${r}`]||(n[`%${r}`]=[]),n[`%${r}`].push(e)}null==this[e]&&O$(this,e,m_e(this,t,!0)),null==this.functions[e]&&O$(this.functions,e,m_e(this,t,!1)),null==this.callStatic[e]&&O$(this.callStatic,e,p_e(this,t,!0)),null==this.populateTransaction[e]&&O$(this.populateTransaction,e,function(e,t){return function(...r){return d_e(e,t,r)}}(this,t)),null==this.estimateGas[e]&&O$(this.estimateGas,e,function(e,t){const r=e.signer||e.provider;return function(...n){return s_e(this,void 0,void 0,(function*(){r||c_e.throwError("estimate require a provider or signer",P$.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield d_e(e,t,n);return yield r.estimateGas(i)}))}}(this,t))}})),Object.keys(n).forEach((e=>{const t=n[e];if(t.length>1)return;e=e.substring(1);const r=t[0];try{null==this[e]&&O$(this,e,this[r])}catch(e){}null==this.functions[e]&&O$(this.functions,e,this.functions[r]),null==this.callStatic[e]&&O$(this.callStatic,e,this.callStatic[r]),null==this.populateTransaction[e]&&O$(this.populateTransaction,e,this.populateTransaction[r]),null==this.estimateGas[e]&&O$(this.estimateGas,e,this.estimateGas[r])}))}static getContractAddress(e){return nG(e)}static getInterface(e){return a_e.isInterface(e)?e:new a_e(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&&c_e.throwError("contract not deployed",P$.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||c_e.throwError("sending a transactions require a signer",P$.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=N$(e||{});return["from","to"].forEach((function(e){null!=t[e]&&c_e.throwError("cannot override "+e,P$.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new q$(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&O$(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return n_e.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 y_e);if("event"===e)return this._normalizeRunningEvent(new g_e("event",null));if("*"===e)return this._normalizeRunningEvent(new w_e(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new v_e(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 r=this.interface.getEvent(t);return this._normalizeRunningEvent(new v_e(this.address,this.interface,r,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new g_e(b_e(t),t))}return this._normalizeRunningEvent(new w_e(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,r){const n=U$(t);return n.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},n.getBlock=()=>this.provider.getBlock(t.blockHash),n.getTransaction=()=>this.provider.getTransaction(t.transactionHash),n.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(n),n}_addEventListener(e,t,r){if(this.provider||c_e.throwError("events require a provider or a signer with a provider",P$.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const r=r=>{let n=this._wrapEvent(e,r,t);if(null==n.decodeError)try{const t=e.getEmit(n);this.emit(e.filter,...t)}catch(e){n.decodeError=e.error}null!=e.filter&&this.emit("event",n),null!=n.decodeError&&this.emit("error",n.decodeError,n)};this._wrappedEmits[e.tag]=r,null!=e.filter&&this.provider.on(e.filter,r)}}queryFilter(e,t,r){const n=this._getRunningEvent(e),i=N$(n.filter);return"string"==typeof t&&rH(t,32)?(null!=r&&c_e.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=r?r:"latest"),this.provider.getLogs(i).then((e=>e.map((e=>this._wrapEvent(n,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 r=this._getRunningEvent(e),n=r.run(t)>0;return this._checkRunningEvents(r),n}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 r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class A_e extends E_e{}class x_e{constructor(e,t,r){let n=null;n="string"==typeof t?t:Y$(t)?iH(t):t&&"string"==typeof t.object?t.object:"!","0x"!==n.substring(0,2)&&(n="0x"+n),(!rH(n)||n.length%2)&&c_e.throwArgumentError("invalid bytecode","bytecode",t),r&&!G$.isSigner(r)&&c_e.throwArgumentError("invalid signer","signer",r),O$(this,"bytecode",n),O$(this,"interface",M$(new.target,"getInterface")(e)),O$(this,"signer",r||null)}getDeployTransaction(...e){let t={};if(e.length===this.interface.deploy.inputs.length+1&&"object"==typeof e[e.length-1]){t=N$(e.pop());for(const e in t)if(!u_e[e])throw new Error("unknown transaction override "+e)}if(["data","from","to"].forEach((e=>{null!=t[e]&&c_e.throwError("cannot override "+e,P$.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.value){EH.from(t.value).isZero()||this.interface.deploy.payable||c_e.throwError("non-payable constructor cannot override value",P$.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:t.value})}return c_e.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor"),t.data=iH(Q$([this.bytecode,this.interface.encodeDeploy(e)])),t}deploy(...e){return s_e(this,void 0,void 0,(function*(){let t={};e.length===this.interface.deploy.inputs.length+1&&(t=e.pop()),c_e.checkArgumentCount(e.length,this.interface.deploy.inputs.length," in Contract constructor");const r=yield f_e(this.signer,e,this.interface.deploy.inputs);r.push(t);const n=this.getDeployTransaction(...r),i=yield this.signer.sendTransaction(n),o=M$(this.constructor,"getContractAddress")(i),a=M$(this.constructor,"getContract")(o,this.interface,this.signer);return h_e(a,i),O$(a,"deployTransaction",i),a}))}attach(e){return this.constructor.getContract(e,this.interface,this.signer)}connect(e){return new this.constructor(this.interface,this.bytecode,e)}static fromSolidity(e,t){null==e&&c_e.throwError("missing compiler output",P$.errors.MISSING_ARGUMENT,{argument:"compilerOutput"}),"string"==typeof e&&(e=JSON.parse(e));const r=e.abi;let n=null;return e.bytecode?n=e.bytecode:e.evm&&e.evm.bytecode&&(n=e.evm.bytecode),new this(r,n,t)}static getInterface(e){return A_e.getInterface(e)}static getContractAddress(e){return nG(e)}static getContract(e,t,r){return new A_e(e,t,r)}}const __e=new RegExp("^bytes([0-9]+)$"),k_e=new RegExp("^(u?int)([0-9]*)$"),S_e=new RegExp("^(.*)\\[([0-9]*)\\]$"),P_e="0000000000000000000000000000000000000000000000000000000000000000",I_e=new P$("solidity/5.7.0");function T_e(e,t,r){switch(e){case"address":return r?tH(t,32):X$(t);case"string":return kG(t);case"bytes":return X$(t);case"bool":return t=t?"0x01":"0x00",r?tH(t,32):X$(t)}let n=e.match(k_e);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!=0||0===i||i>256)&&I_e.throwArgumentError("invalid number type","type",e),r&&(i=256),tH(t=EH.from(t).toTwos(i),i/8)}if(n=e.match(__e),n){const i=parseInt(n[1]);return(String(i)!==n[1]||0===i||i>32)&&I_e.throwArgumentError("invalid bytes type","type",e),X$(t).byteLength!==i&&I_e.throwArgumentError(`invalid value for ${e}`,"value",t),r?X$((t+P_e).substring(0,66)):t}if(n=e.match(S_e),n&&Array.isArray(t)){const r=n[1];parseInt(n[2]||String(t.length))!=t.length&&I_e.throwArgumentError(`invalid array length for ${e}`,"value",t);const i=[];return t.forEach((function(e){i.push(T_e(r,e,!0))})),Q$(i)}return I_e.throwArgumentError("invalid type","type",e)}function O_e(e,t){e.length!=t.length&&I_e.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const r=[];return e.forEach((function(e,n){r.push(T_e(e,t[n]))})),iH(Q$(r))}const M_e=new P$("units/5.7.0"),C_e=["wei","kwei","mwei","gwei","szabo","finney","ether"];function B_e(e,t){if("string"==typeof t){const e=C_e.indexOf(t);-1!==e&&(t=3*e)}return BH(e,null!=t?t:18)}function N_e(e,t){if("string"!=typeof e&&M_e.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=C_e.indexOf(t);-1!==e&&(t=3*e)}return NH(e,null!=t?t:18)}var R_e=Object.freeze({__proto__:null,AbiCoder:Yxe,ConstructorFragment:Exe,ErrorFragment:_xe,EventFragment:gxe,FormatTypes:dxe,Fragment:bxe,FunctionFragment:Axe,HDNode:dV,Indexed:n_e,Interface:a_e,LogDescription:e_e,Logger:P$,ParamType:pxe,RLP:ZH,SigningKey:OK,get SupportedAlgorithm(){return Uq},TransactionDescription:t_e,get TransactionTypes(){return NK},get UnicodeNormalizationForm(){return wG},Utf8ErrorFuncs:xG,get Utf8ErrorReason(){return EG},_TypedDataEncoder:Rq,_fetchData:rY,_toEscapedUtf8String:function(e,t){return'"'+_G(e,t).map((e=>{if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?SG(e):SG(55296+((e-=65536)>>10&1023))+SG(56320+(1023&e))})).join("")+'"'},accessListify:HK,arrayify:X$,base58:Lq,base64:GG,checkProperties:B$,checkResultErrors:Oxe,commify:function(e){const t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&M_e.throwArgumentError("invalid value","value",e);let r=t[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");let i="";for(2===t.length&&(i="."+(t[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);const o=[];for(;r.length;){if(r.length<=3){o.unshift(r);break}{const e=r.length-3;o.unshift(r.substring(e)),r=r.substring(0,e)}}return n+o.join(",")+i},computeAddress:jK,computeHmac:$q,computePublicKey:CK,concat:Q$,deepCopy:U$,defaultAbiCoder:Xxe,defaultPath:fV,defineReadOnly:O$,dnsEncode:gq,entropyToMnemonic:mV,fetchJson:nY,formatBytes32String:function(e){const t=kG(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return iH(Q$([t,gG]).slice(0,32))},formatEther:function(e){return B_e(e,18)},formatUnits:B_e,getAccountPath:function(e){return("number"!=typeof e||e<0||e>=oV||e%1)&&rV.throwArgumentError("invalid account index","index",e),`m/44'/60'/${e}'/0/0`},getAddress:rG,getContractAddress:nG,getCreate2Address:function(e,t,r){return 32!==oH(t)&&YH.throwArgumentError("salt must be 32 bytes","salt",t),32!==oH(r)&&YH.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),rG(aH(zH(Q$(["0xff",rG(e),t,r])),12))},getIcapAddress:function(e){let t=function(e){return new bH(e,16).toString(36)}(rG(e).substring(2)).toUpperCase();for(;t.length<30;)t="0"+t;return"XE"+tG("XE00"+t)+t},getJsonWalletAddress:function(e){if(CV(e))try{return rG(JSON.parse(e).ethaddr)}catch(e){return null}if(BV(e))try{return rG(JSON.parse(e).address)}catch(e){return null}return null},getStatic:M$,hashMessage:vq,hexConcat:sH,hexDataLength:oH,hexDataSlice:aH,hexStripZeros:uH,hexValue:cH,hexZeroPad:lH,hexlify:iH,id:DG,isAddress:function(e){try{return rG(e),!0}catch(e){}return!1},isBytes:Y$,isBytesLike:J$,isHexString:rH,isValidMnemonic:function(e,t){try{return pV(e,t),!0}catch(e){}return!1},isValidName:function(e){try{return 0!==mq(e).length}catch(e){}return!1},joinSignature:dH,keccak256:zH,mnemonicToEntropy:pV,mnemonicToSeed:hV,namehash:bq,nameprep:function(e){if(e.match(/^[a-z0-9-]*$/i)&&e.length<=59)return e.toLowerCase();let t=TG(e);var r;r=t.map((e=>{if(NG.indexOf(e)>=0)return[];if(e>=65024&&e<=65039)return[];let t=function(e){let t=CG(e,RG);if(t)return[e+t.s];let r=FG[e];if(r)return r;let n=LG[e];return n?[e+n[0]]:UG[e]||null}(e);return t||[e]})),t=r.reduce(((e,t)=>(t.forEach((t=>{e.push(t)})),e)),[]),t=TG(PG(t),wG.NFKC),t.forEach((e=>{if(CG(e,jG))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),t.forEach((e=>{if(CG(e,BG))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));let n=PG(t);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n},parseBytes32String:function(e){const t=X$(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");let r=31;for(;0===t[r-1];)r--;return IG(t.slice(0,r))},parseEther:function(e){return N_e(e,18)},parseTransaction:JK,parseUnits:N_e,poll:iY,randomBytes:vV,recoverAddress:DK,recoverPublicKey:MK,resolveProperties:C$,ripemd160:Dq,serializeTransaction:VK,sha256:zq,sha512:function(e){return"0x"+ny.sha512().update(X$(e)).digest("hex")},shallowCopy:N$,shuffled:wV,solidityKeccak256:function(e,t){return zH(O_e(e,t))},solidityPack:O_e,soliditySha256:function(e,t){return zq(O_e(e,t))},splitSignature:fH,stripZeros:eH,toUtf8Bytes:kG,toUtf8CodePoints:TG,toUtf8String:IG,verifyMessage:function(e,t){return DK(vq(e),t)},verifyTypedData:function(e,t,r,n){return DK(Rq.hash(e,t,r),n)},zeroPad:tH});const F_e="ethers/5.7.2",L_e=new P$(F_e);var U_e=Object.freeze({__proto__:null,BaseContract:E_e,BigNumber:EH,Contract:A_e,ContractFactory:x_e,FixedNumber:FH,Signer:G$,VoidSigner:q$,Wallet:WV,Wordlist:YK,constants:yG,get errors(){return k$},getDefaultProvider:cQ,logger:L_e,providers:uQ,utils:R_e,version:F_e,wordlists:tV});try{const e=window;null==e._ethers&&(e._ethers=U_e)}catch(Vre){}var j_e=s(Object.freeze({__proto__:null,BaseContract:E_e,BigNumber:EH,Contract:A_e,ContractFactory:x_e,FixedNumber:FH,Signer:G$,VoidSigner:q$,Wallet:WV,Wordlist:YK,constants:yG,get errors(){return k$},ethers:U_e,getDefaultProvider:cQ,logger:L_e,providers:uQ,utils:R_e,version:F_e,wordlists:tV}));var D_e=function(e,t){for(var r=-1,n=t.length,i=e.length;++r0&&n(c)?r>1?e(c,r-1,n,i,o):wke(o,c):i||(o[o.length]=c)}return o};var xke=function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r-1},Rke=Pke;var Fke=function(e,t){var r=this.__data__,n=Rke(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},Lke=_ke,Uke=Oke,jke=Cke,Dke=Nke,zke=Fke;function $ke(e){var t=-1,r=null==e?0:e.length;for(this.clear();++ts))return!1;var u=o.get(e),l=o.get(t);if(u&&l)return u==t&&l==e;var f=-1,d=!0,h=2&r?new kPe:void 0;for(o.set(e,t),o.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},rIe=nke,nIe=tIe,iIe=ike,oIe={};oIe["[object Float32Array]"]=oIe["[object Float64Array]"]=oIe["[object Int8Array]"]=oIe["[object Int16Array]"]=oIe["[object Int32Array]"]=oIe["[object Uint8Array]"]=oIe["[object Uint8ClampedArray]"]=oIe["[object Uint16Array]"]=oIe["[object Uint32Array]"]=!0,oIe["[object Arguments]"]=oIe["[object Array]"]=oIe["[object ArrayBuffer]"]=oIe["[object Boolean]"]=oIe["[object DataView]"]=oIe["[object Date]"]=oIe["[object Error]"]=oIe["[object Function]"]=oIe["[object Map]"]=oIe["[object Number]"]=oIe["[object Object]"]=oIe["[object RegExp]"]=oIe["[object Set]"]=oIe["[object String]"]=oIe["[object WeakMap]"]=!1;var aIe=function(e){return iIe(e)&&nIe(e.length)&&!!oIe[rIe(e)]};var sIe=function(e){return function(t){return e(t)}},cIe={exports:{}};!function(e,t){var r=z_e,n=t&&!t.nodeType&&t,i=n&&e&&!e.nodeType&&e,o=i&&i.exports===n&&r.process,a=function(){try{var e=i&&i.require&&i.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=a}(cIe,cIe.exports);var uIe=cIe.exports,lIe=aIe,fIe=sIe,dIe=uIe&&uIe.isTypedArray,hIe=dIe?fIe(dIe):lIe,pIe=JPe,mIe=pke,bIe=mke,gIe=XPe,yIe=eIe,vIe=hIe,wIe=Object.prototype.hasOwnProperty;var EIe=function(e,t){var r=bIe(e),n=!r&&mIe(e),i=!r&&!n&&gIe(e),o=!r&&!n&&!i&&vIe(e),a=r||n||i||o,s=a?pIe(e.length,String):[],c=s.length;for(var u in e)!t&&!wIe.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||yIe(u,c))||s.push(u);return s},AIe=Object.prototype;var xIe=function(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||AIe)};var _Ie=function(e,t){return function(r){return e(t(r))}},kIe=_Ie(Object.keys,Object),SIe=xIe,PIe=kIe,IIe=Object.prototype.hasOwnProperty;var TIe=function(e){if(!SIe(e))return PIe(e);var t=[];for(var r in Object(e))IIe.call(e,r)&&"constructor"!=r&&t.push(r);return t},OIe=Xke,MIe=tIe;var CIe=function(e){return null!=e&&MIe(e.length)&&!OIe(e)},BIe=EIe,NIe=TIe,RIe=CIe;var FIe=function(e){return RIe(e)?BIe(e):NIe(e)},LIe=zPe,UIe=WPe,jIe=FIe;var DIe=function(e){return LIe(e,jIe,UIe)},zIe=DIe,$Ie=Object.prototype.hasOwnProperty;var HIe=function(e,t,r,n,i,o){var a=1&r,s=zIe(e),c=s.length;if(c!=zIe(t).length&&!a)return!1;for(var u=c;u--;){var l=s[u];if(!(a?l in t:$Ie.call(t,l)))return!1}var f=o.get(e),d=o.get(t);if(f&&d)return f==t&&d==e;var h=!0;o.set(e,t),o.set(t,e);for(var p=a;++ue.type)),r=(0,gMe.default)(t,(e=>["bytes32",yMe.TYPE_TRANSFORMATIONS[e]??e])),n=["bytes32",...r],i=function(e){const t=Object.keys(yMe.PARAMETER_SHORT_TYPES),r=e.reduce(((e,r)=>[...e,t.find((e=>yMe.PARAMETER_SHORT_TYPES[e]===r))]),[]);return`${vMe}${r.join("")}`}(t),o=bMe.ethers.utils.formatBytes32String(i),a=function(e){return(0,gMe.default)(e,(e=>{const{name:t,value:r,type:n}=e,i=wMe[n],o=bMe.ethers.utils.formatBytes32String(t);return i?[o,i(r)]:[o,r]}))}(e),s=[o,...a];return(new bMe.ethers.utils.AbiCoder).encode(n,s)};var EMe={};var AMe=function(e,t,r){var n=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(i);++ne.toString(),uint256:e=>e.toString()};EMe.decode=function(e){if("0x"===e)return{};const t=QMe.ethers.utils.hexlify(QMe.ethers.utils.arrayify(e).slice(0,32)),r=QMe.ethers.utils.parseBytes32String(t),n=r.substring(0,1);if("1"!==n)throw new Error(`Unknown ABI schema version: ${n}`);const i=r.substring(1),o=Array.from(i).map((e=>tCe.PARAMETER_SHORT_TYPES[e])),a=o.reduce(((e,t)=>[...e,"bytes32",tCe.TYPE_TRANSFORMATIONS[t]??t]),["bytes32"]),s=QMe.ethers.utils.defaultAbiCoder.decode(a,e);if(QMe.ethers.utils.defaultAbiCoder.encode(a,s)!==e)throw new Error("Re-encoding mismatch");const[c,...u]=s;return function(e,t){return t.reduce(((t,r,n)=>{const[i,o]=r,a=QMe.ethers.utils.parseBytes32String(i),s=e[n],c=rCe[s];if(!c)return{...t,[a]:o};const u=c(o);return{...t,[a]:u}}),{})}(o,(0,eCe.default)(u,2))};var nCe={};Object.defineProperty(nCe,"__esModule",{value:!0}),function(e){var t=o&&o.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=o&&o.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.PARAMETER_SHORT_TYPES=e.decode=e.encode=void 0;var n=ixe;Object.defineProperty(e,"encode",{enumerable:!0,get:function(){return n.encode}});var i=EMe;Object.defineProperty(e,"decode",{enumerable:!0,get:function(){return i.decode}});var a=pMe;Object.defineProperty(e,"PARAMETER_SHORT_TYPES",{enumerable:!0,get:function(){return a.PARAMETER_SHORT_TYPES}}),r(nCe,e)}(nxe);var iCe=[{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"getMiddleware",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],oCe={_format:"hh-sol-artifact-1",contractName:"TokenDistributor",sourceName:"contracts/v1/TokenDistributor.sol",abi:[{inputs:[{internalType:"address",name:"deployer",type:"address"},{internalType:"address",name:"_rrpAddress",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"earner",type:"address"},{indexed:!1,internalType:"bytes32",name:"actionId",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"payout",type:"uint256"}],name:"tokenActionEarned",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"earner",type:"address"},{indexed:!1,internalType:"bytes32",name:"actionId",type:"bytes32"},{indexed:!1,internalType:"string",name:"reason",type:"string"}],name:"tokenActionFailed",type:"event"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DISTRIBUTOR_DEPLOYER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"airnodeRrp",outputs:[{internalType:"contract IAirnodeRrpV0",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"requestId",type:"bytes32"},{internalType:"bytes",name:"data",type:"bytes"}],name:"fulfill",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"actionId",type:"bytes32"},{internalType:"bytes32",name:"proofID",type:"bytes32"},{internalType:"string",name:"metadata",type:"string"},{internalType:"bytes",name:"parameters",type:"bytes"}],name:"fulfillAction",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"fulfilledData",outputs:[{internalType:"int256",name:"",type:"int256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"incomingFulfillments",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract AuthorizableVault",name:"_vault",type:"address"},{internalType:"contract IERC20",name:"_tok",type:"address"},{internalType:"contract TokenMapping",name:"_map",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"pendingRequests",outputs:[{internalType:"bytes32",name:"actionId",type:"bytes32"},{internalType:"bytes32",name:"proofID",type:"bytes32"},{internalType:"address",name:"sender",type:"address"},{internalType:"string",name:"metadata",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"airnode",type:"address"},{internalType:"address",name:"sponsorWallet",type:"address"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],bytecode:"0x60a06040523480156200001157600080fd5b5060405162001b8738038062001b87833981016040819052620000349162000217565b6001600160a01b0381166080819052604051632b77c09f60e21b81523060048201526001602482015282919063addf027c90604401600060405180830381600087803b1580156200008457600080fd5b505af115801562000099573d6000803e3d6000fd5b5050505050620000b8620000b26200010360201b60201c565b62000107565b620000e47f60d80c98cdf3bdd0ed315cc9b95e0688cb16e95fee20366fd3d59bfbf8c10ec08362000159565b50506007805463ffffffff60a01b191661249f60a51b1790556200024f565b3390565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001f6576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001b53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b03811681146200021257600080fd5b919050565b600080604083850312156200022b57600080fd5b6200023683620001fa565b91506200024660208401620001fa565b90509250929050565b608051611907620002806000396000818161027d015281816105cc01528181610ab80152610d2301526119076000f3fe6080604052600436106100e85760003560e01c806301ffc9a714610134578063248a9ca3146101695780632795ad20146101975780632f2ff15d146101c757806331268369146101e757806336568abe14610209578063406c6d6c14610229578063715018a61461025657806371bab6661461026b5780637c1de7e1146102b75780637f0ce16c146102d75780638da5cb5b146102f757806391d148541461030c578063a217fddf1461032c578063c0c53b8b14610341578063d547741f14610361578063dd2ae83f14610381578063f2fde38b146103b1578063f940e385146103d157600080fd5b3661012f576100f56103f1565b6001600160a01b03166108fc479081150290604051600060405180830381858888f1935050505015801561012d573d6000803e3d6000fd5b005b600080fd5b34801561014057600080fd5b5061015461014f36600461117a565b610400565b60405190151581526020015b60405180910390f35b34801561017557600080fd5b506101896101843660046111a4565b610437565b604051908152602001610160565b3480156101a357600080fd5b506101b76101b23660046111a4565b61044c565b604051610160949392919061120d565b3480156101d357600080fd5b5061012d6101e2366004611259565b610509565b3480156101f357600080fd5b506101896000805160206118db83398151915281565b34801561021557600080fd5b5061012d610224366004611259565b61052a565b34801561023557600080fd5b506101896102443660046111a4565b60036020526000908152604090205481565b34801561026257600080fd5b5061012d6105ad565b34801561027757600080fd5b5061029f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610160565b3480156102c357600080fd5b5061012d6102d23660046112d1565b6105c1565b3480156102e357600080fd5b5061012d6102f2366004611362565b610a1e565b34801561030357600080fd5b5061029f6103f1565b34801561031857600080fd5b50610154610327366004611259565b610bde565b34801561033857600080fd5b50610189600081565b34801561034d57600080fd5b5061012d61035c366004611432565b610c07565b34801561036d57600080fd5b5061012d61037c366004611259565b610c5f565b34801561038d57600080fd5b5061015461039c3660046111a4565b60026020526000908152604090205460ff1681565b3480156103bd57600080fd5b5061012d6103cc36600461147d565b610c7b565b3480156103dd57600080fd5b5061012d6103ec36600461149a565b610cf4565b6001546001600160a01b031690565b60006001600160e01b03198216637965db0b60e01b148061043157506301ffc9a760e01b6001600160e01b03198316145b92915050565b60009081526020819052604090206001015490565b6004602052600090815260409020805460018201546002830154600384018054939492936001600160a01b039092169291610486906114c8565b80601f01602080910402602001604051908101604052809291908181526020018280546104b2906114c8565b80156104ff5780601f106104d4576101008083540402835291602001916104ff565b820191906000526020600020905b8154815290600101906020018083116104e257829003601f168201915b5050505050905084565b61051282610437565b61051b81610d7b565b6105258383610d85565b505050565b6001600160a01b038116331461059f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105a98282610e09565b5050565b6105b5610e6e565b6105bf6000610ecd565b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106325760405162461bcd60e51b8152602060048201526016602482015275043616c6c6572206e6f74204169726e6f6465205252560541b6044820152606401610596565b60008381526002602052604090205460ff166106875760405162461bcd60e51b81526020600482015260146024820152734e6f20737563682072657175657374206d61646560601b6044820152606401610596565b6000838152600260205260408120805460ff191690556106a9828401846111a4565b600085815260036020526040902081905590506001819003610933576006546000858152600460208190526040918290206002810154815460018301549451632b0144ab60e11b81526001600160a01b039687169663560289569661071a9691909416949293926003019101611502565b600060405180830381600087803b15801561073457600080fd5b505af1158015610748573d6000803e3d6000fd5b5050600554600754600088815260046020819052604091829020600281015460065491549351630dce9f0760e41b81526001600160a01b0396871698506301e336679750948616959081169491169263dce9f070926107ab920190815260200190565b60e060405180830381865afa1580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec91906115bb565b602001516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b15801561083f57600080fd5b505af1158015610853573d6000803e3d6000fd5b505050600085815260046020819052604091829020600281015490546006549351630dce9f0760e41b81529283018190527fc6798876072215c3559fe195e58a6001906fc6c496ba9a550476ffdd208adc4b94506001600160a01b0391821693909291169063dce9f0709060240160e060405180830381865afa1580156108de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090291906115bb565b602090810151604080516001600160a01b0390951685529184019290925282015260600160405180910390a16109de565b600084815260046020526040908190206002810154905491517f376c6bb6f978e3c1dd36537193cb25d03e334edd66d9eeb20b546824fc3d0eee926109d5926001600160a01b0316916001600160a01b0392909216825260208201526060604082018190526022908201527f4f7261636c6520696e76616c696461746564206561726e696e672072657175656080820152611cdd60f21b60a082015260c00190565b60405180910390a15b6000848152600460205260408120818155600181018290556002810180546001600160a01b031916905590610a16600383018261112c565b505050505050565b600654604051630dce9f0760e41b8152600481018790526000916001600160a01b03169063dce9f0709060240160e060405180830381865afa158015610a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8c91906115bb565b608081015160a082015160c0830151604051636e6be03f60e01b81529394506000936001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693636e6be03f93610b00939192909130918290637c1de7e160e01b908d908d90600401611656565b6020604051808303816000875af1158015610b1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4391906116cd565b60008181526002602081815260408084208054600160ff19909116811790915581516080810183528d81528084018d815233828501908152606083018e815289895260049096529390962081518155955191860191909155905192840180546001600160a01b0319166001600160a01b039094169390931790925551929350916003820190610bd2908261172c565b50505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206118db833981519152610c1f81610d7b565b50600580546001600160a01b039485166001600160a01b031991821617909155600780549385169382169390931790925560068054919093169116179055565b610c6882610437565b610c7181610d7b565b6105258383610e09565b610c83610e6e565b6001600160a01b038116610ce85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610596565b610cf181610ecd565b50565b610cfc610e6e565b604051631d414cbd60e01b81526001600160a01b03838116600483015282811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631d414cbd90604401600060405180830381600087803b158015610d6757600080fd5b505af1158015610a16573d6000803e3d6000fd5b610cf18133610f1f565b610d8f8282610bde565b6105a9576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610dc53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610e138282610bde565b156105a9576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b33610e776103f1565b6001600160a01b0316146105bf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610596565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610f298282610bde565b6105a957610f3681610f78565b610f41836020610f8a565b604051602001610f529291906117eb565b60408051601f198184030181529082905262461bcd60e51b82526105969160040161185a565b60606104316001600160a01b03831660145b60606000610f99836002611883565b610fa490600261189a565b6001600160401b03811115610fbb57610fbb61131c565b6040519080825280601f01601f191660200182016040528015610fe5576020820181803683370190505b509050600360fc1b81600081518110611000576110006118ad565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061102f5761102f6118ad565b60200101906001600160f81b031916908160001a9053506000611053846002611883565b61105e90600161189a565b90505b60018111156110d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611092576110926118ad565b1a60f81b8282815181106110a8576110a86118ad565b60200101906001600160f81b031916908160001a90535060049490941c936110cf816118c3565b9050611061565b5083156111255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610596565b9392505050565b508054611138906114c8565b6000825580601f10611148575050565b601f016020900490600052602060002090810190610cf191905b808211156111765760008155600101611162565b5090565b60006020828403121561118c57600080fd5b81356001600160e01b03198116811461112557600080fd5b6000602082840312156111b657600080fd5b5035919050565b60005b838110156111d85781810151838201526020016111c0565b50506000910152565b600081518084526111f98160208601602086016111bd565b601f01601f19169290920160200192915050565b84815283602082015260018060a01b038316604082015260806060820152600061123a60808301846111e1565b9695505050505050565b6001600160a01b0381168114610cf157600080fd5b6000806040838503121561126c57600080fd5b82359150602083013561127e81611244565b809150509250929050565b60008083601f84011261129b57600080fd5b5081356001600160401b038111156112b257600080fd5b6020830191508360208285010111156112ca57600080fd5b9250929050565b6000806000604084860312156112e657600080fd5b8335925060208401356001600160401b0381111561130357600080fd5b61130f86828701611289565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561135a5761135a61131c565b604052919050565b60008060008060006080868803121561137a57600080fd5b85359450602080870135945060408701356001600160401b03808211156113a057600080fd5b818901915089601f8301126113b457600080fd5b8135818111156113c6576113c661131c565b6113d8601f8201601f19168501611332565b8181528b858386010111156113ec57600080fd5b81858501868301376000918101909401529194506060880135918083111561141357600080fd5b505061142188828901611289565b969995985093965092949392505050565b60008060006060848603121561144757600080fd5b833561145281611244565b9250602084013561146281611244565b9150604084013561147281611244565b809150509250925092565b60006020828403121561148f57600080fd5b813561112581611244565b600080604083850312156114ad57600080fd5b82356114b881611244565b9150602083013561127e81611244565b600181811c908216806114dc57607f821691505b6020821081036114fc57634e487b7160e01b600052602260045260246000fd5b50919050565b60018060a01b03851681526000602085818401528460408401526080606084015260008454611530816114c8565b80608087015260a0600180841660008114611552576001811461156c5761159a565b60ff1985168984015283151560051b89018301955061159a565b896000528660002060005b858110156115925781548b8201860152908301908801611577565b8a0184019650505b50939b9a5050505050505050505050565b80516115b681611244565b919050565b600060e082840312156115cd57600080fd5b60405160e081016001600160401b03811182821017156115ef576115ef61131c565b8060405250825181526020830151602082015260408301516003811061161457600080fd5b60408201526060838101519082015261162f608084016115ab565b608082015260a083015160a082015261164a60c084016115ab565b60c08201529392505050565b6001600160a01b0389811682526020820189905287811660408301528681166060830152851660808201526001600160e01b0319841660a082015260e060c08201819052810182905260006101008385828501376000838501820152601f909301601f191690910190910198975050505050505050565b6000602082840312156116df57600080fd5b5051919050565b601f82111561052557600081815260208120601f850160051c8101602086101561170d5750805b601f850160051c820191505b81811015610a1657828155600101611719565b81516001600160401b038111156117455761174561131c565b6117598161175384546114c8565b846116e6565b602080601f83116001811461178e57600084156117765750858301515b600019600386901b1c1916600185901b178555610a16565b600085815260208120601f198616915b828110156117bd5788860151825594840194600190910190840161179e565b50858210156117db5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b81526000835161181d8160178501602088016111bd565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161184e8160288401602088016111bd565b01602801949350505050565b60208152600061112560208301846111e1565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176104315761043161186d565b808201808211156104315761043161186d565b634e487b7160e01b600052603260045260246000fd5b6000816118d2576118d261186d565b50600019019056fe60d80c98cdf3bdd0ed315cc9b95e0688cb16e95fee20366fd3d59bfbf8c10ec0a164736f6c6343000811000a",deployedBytecode:"0x6080604052600436106100e85760003560e01c806301ffc9a714610134578063248a9ca3146101695780632795ad20146101975780632f2ff15d146101c757806331268369146101e757806336568abe14610209578063406c6d6c14610229578063715018a61461025657806371bab6661461026b5780637c1de7e1146102b75780637f0ce16c146102d75780638da5cb5b146102f757806391d148541461030c578063a217fddf1461032c578063c0c53b8b14610341578063d547741f14610361578063dd2ae83f14610381578063f2fde38b146103b1578063f940e385146103d157600080fd5b3661012f576100f56103f1565b6001600160a01b03166108fc479081150290604051600060405180830381858888f1935050505015801561012d573d6000803e3d6000fd5b005b600080fd5b34801561014057600080fd5b5061015461014f36600461117a565b610400565b60405190151581526020015b60405180910390f35b34801561017557600080fd5b506101896101843660046111a4565b610437565b604051908152602001610160565b3480156101a357600080fd5b506101b76101b23660046111a4565b61044c565b604051610160949392919061120d565b3480156101d357600080fd5b5061012d6101e2366004611259565b610509565b3480156101f357600080fd5b506101896000805160206118db83398151915281565b34801561021557600080fd5b5061012d610224366004611259565b61052a565b34801561023557600080fd5b506101896102443660046111a4565b60036020526000908152604090205481565b34801561026257600080fd5b5061012d6105ad565b34801561027757600080fd5b5061029f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610160565b3480156102c357600080fd5b5061012d6102d23660046112d1565b6105c1565b3480156102e357600080fd5b5061012d6102f2366004611362565b610a1e565b34801561030357600080fd5b5061029f6103f1565b34801561031857600080fd5b50610154610327366004611259565b610bde565b34801561033857600080fd5b50610189600081565b34801561034d57600080fd5b5061012d61035c366004611432565b610c07565b34801561036d57600080fd5b5061012d61037c366004611259565b610c5f565b34801561038d57600080fd5b5061015461039c3660046111a4565b60026020526000908152604090205460ff1681565b3480156103bd57600080fd5b5061012d6103cc36600461147d565b610c7b565b3480156103dd57600080fd5b5061012d6103ec36600461149a565b610cf4565b6001546001600160a01b031690565b60006001600160e01b03198216637965db0b60e01b148061043157506301ffc9a760e01b6001600160e01b03198316145b92915050565b60009081526020819052604090206001015490565b6004602052600090815260409020805460018201546002830154600384018054939492936001600160a01b039092169291610486906114c8565b80601f01602080910402602001604051908101604052809291908181526020018280546104b2906114c8565b80156104ff5780601f106104d4576101008083540402835291602001916104ff565b820191906000526020600020905b8154815290600101906020018083116104e257829003601f168201915b5050505050905084565b61051282610437565b61051b81610d7b565b6105258383610d85565b505050565b6001600160a01b038116331461059f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105a98282610e09565b5050565b6105b5610e6e565b6105bf6000610ecd565b565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106325760405162461bcd60e51b8152602060048201526016602482015275043616c6c6572206e6f74204169726e6f6465205252560541b6044820152606401610596565b60008381526002602052604090205460ff166106875760405162461bcd60e51b81526020600482015260146024820152734e6f20737563682072657175657374206d61646560601b6044820152606401610596565b6000838152600260205260408120805460ff191690556106a9828401846111a4565b600085815260036020526040902081905590506001819003610933576006546000858152600460208190526040918290206002810154815460018301549451632b0144ab60e11b81526001600160a01b039687169663560289569661071a9691909416949293926003019101611502565b600060405180830381600087803b15801561073457600080fd5b505af1158015610748573d6000803e3d6000fd5b5050600554600754600088815260046020819052604091829020600281015460065491549351630dce9f0760e41b81526001600160a01b0396871698506301e336679750948616959081169491169263dce9f070926107ab920190815260200190565b60e060405180830381865afa1580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec91906115bb565b602001516040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b15801561083f57600080fd5b505af1158015610853573d6000803e3d6000fd5b505050600085815260046020819052604091829020600281015490546006549351630dce9f0760e41b81529283018190527fc6798876072215c3559fe195e58a6001906fc6c496ba9a550476ffdd208adc4b94506001600160a01b0391821693909291169063dce9f0709060240160e060405180830381865afa1580156108de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061090291906115bb565b602090810151604080516001600160a01b0390951685529184019290925282015260600160405180910390a16109de565b600084815260046020526040908190206002810154905491517f376c6bb6f978e3c1dd36537193cb25d03e334edd66d9eeb20b546824fc3d0eee926109d5926001600160a01b0316916001600160a01b0392909216825260208201526060604082018190526022908201527f4f7261636c6520696e76616c696461746564206561726e696e672072657175656080820152611cdd60f21b60a082015260c00190565b60405180910390a15b6000848152600460205260408120818155600181018290556002810180546001600160a01b031916905590610a16600383018261112c565b505050505050565b600654604051630dce9f0760e41b8152600481018790526000916001600160a01b03169063dce9f0709060240160e060405180830381865afa158015610a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8c91906115bb565b608081015160a082015160c0830151604051636e6be03f60e01b81529394506000936001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001693636e6be03f93610b00939192909130918290637c1de7e160e01b908d908d90600401611656565b6020604051808303816000875af1158015610b1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b4391906116cd565b60008181526002602081815260408084208054600160ff19909116811790915581516080810183528d81528084018d815233828501908152606083018e815289895260049096529390962081518155955191860191909155905192840180546001600160a01b0319166001600160a01b039094169390931790925551929350916003820190610bd2908261172c565b50505050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206118db833981519152610c1f81610d7b565b50600580546001600160a01b039485166001600160a01b031991821617909155600780549385169382169390931790925560068054919093169116179055565b610c6882610437565b610c7181610d7b565b6105258383610e09565b610c83610e6e565b6001600160a01b038116610ce85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610596565b610cf181610ecd565b50565b610cfc610e6e565b604051631d414cbd60e01b81526001600160a01b03838116600483015282811660248301527f00000000000000000000000000000000000000000000000000000000000000001690631d414cbd90604401600060405180830381600087803b158015610d6757600080fd5b505af1158015610a16573d6000803e3d6000fd5b610cf18133610f1f565b610d8f8282610bde565b6105a9576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610dc53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610e138282610bde565b156105a9576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b33610e776103f1565b6001600160a01b0316146105bf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610596565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610f298282610bde565b6105a957610f3681610f78565b610f41836020610f8a565b604051602001610f529291906117eb565b60408051601f198184030181529082905262461bcd60e51b82526105969160040161185a565b60606104316001600160a01b03831660145b60606000610f99836002611883565b610fa490600261189a565b6001600160401b03811115610fbb57610fbb61131c565b6040519080825280601f01601f191660200182016040528015610fe5576020820181803683370190505b509050600360fc1b81600081518110611000576110006118ad565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061102f5761102f6118ad565b60200101906001600160f81b031916908160001a9053506000611053846002611883565b61105e90600161189a565b90505b60018111156110d6576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611092576110926118ad565b1a60f81b8282815181106110a8576110a86118ad565b60200101906001600160f81b031916908160001a90535060049490941c936110cf816118c3565b9050611061565b5083156111255760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610596565b9392505050565b508054611138906114c8565b6000825580601f10611148575050565b601f016020900490600052602060002090810190610cf191905b808211156111765760008155600101611162565b5090565b60006020828403121561118c57600080fd5b81356001600160e01b03198116811461112557600080fd5b6000602082840312156111b657600080fd5b5035919050565b60005b838110156111d85781810151838201526020016111c0565b50506000910152565b600081518084526111f98160208601602086016111bd565b601f01601f19169290920160200192915050565b84815283602082015260018060a01b038316604082015260806060820152600061123a60808301846111e1565b9695505050505050565b6001600160a01b0381168114610cf157600080fd5b6000806040838503121561126c57600080fd5b82359150602083013561127e81611244565b809150509250929050565b60008083601f84011261129b57600080fd5b5081356001600160401b038111156112b257600080fd5b6020830191508360208285010111156112ca57600080fd5b9250929050565b6000806000604084860312156112e657600080fd5b8335925060208401356001600160401b0381111561130357600080fd5b61130f86828701611289565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561135a5761135a61131c565b604052919050565b60008060008060006080868803121561137a57600080fd5b85359450602080870135945060408701356001600160401b03808211156113a057600080fd5b818901915089601f8301126113b457600080fd5b8135818111156113c6576113c661131c565b6113d8601f8201601f19168501611332565b8181528b858386010111156113ec57600080fd5b81858501868301376000918101909401529194506060880135918083111561141357600080fd5b505061142188828901611289565b969995985093965092949392505050565b60008060006060848603121561144757600080fd5b833561145281611244565b9250602084013561146281611244565b9150604084013561147281611244565b809150509250925092565b60006020828403121561148f57600080fd5b813561112581611244565b600080604083850312156114ad57600080fd5b82356114b881611244565b9150602083013561127e81611244565b600181811c908216806114dc57607f821691505b6020821081036114fc57634e487b7160e01b600052602260045260246000fd5b50919050565b60018060a01b03851681526000602085818401528460408401526080606084015260008454611530816114c8565b80608087015260a0600180841660008114611552576001811461156c5761159a565b60ff1985168984015283151560051b89018301955061159a565b896000528660002060005b858110156115925781548b8201860152908301908801611577565b8a0184019650505b50939b9a5050505050505050505050565b80516115b681611244565b919050565b600060e082840312156115cd57600080fd5b60405160e081016001600160401b03811182821017156115ef576115ef61131c565b8060405250825181526020830151602082015260408301516003811061161457600080fd5b60408201526060838101519082015261162f608084016115ab565b608082015260a083015160a082015261164a60c084016115ab565b60c08201529392505050565b6001600160a01b0389811682526020820189905287811660408301528681166060830152851660808201526001600160e01b0319841660a082015260e060c08201819052810182905260006101008385828501376000838501820152601f909301601f191690910190910198975050505050505050565b6000602082840312156116df57600080fd5b5051919050565b601f82111561052557600081815260208120601f850160051c8101602086101561170d5750805b601f850160051c820191505b81811015610a1657828155600101611719565b81516001600160401b038111156117455761174561131c565b6117598161175384546114c8565b846116e6565b602080601f83116001811461178e57600084156117765750858301515b600019600386901b1c1916600185901b178555610a16565b600085815260208120601f198616915b828110156117bd5788860151825594840194600190910190840161179e565b50858210156117db5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b81526000835161181d8160178501602088016111bd565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161184e8160288401602088016111bd565b01602801949350505050565b60208152600061112560208301846111e1565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176104315761043161186d565b808201808211156104315761043161186d565b634e487b7160e01b600052603260045260246000fd5b6000816118d2576118d261186d565b50600019019056fe60d80c98cdf3bdd0ed315cc9b95e0688cb16e95fee20366fd3d59bfbf8c10ec0a164736f6c6343000811000a",linkReferences:{},deployedLinkReferences:{}};let aCe={"app_id":2,"tokenPathways":[{"name":"Tokens Earned on First Login","description":"Tokens to be earned on first login","hex":"0x7c4cae6ac11afd096f4beeaf9971f6830c913967ce17069083bef5764bfbb3a2","earned_on_login":true,"earned_on_referral":false,"token_amount":4,"frequency":2,"frequency_amount":1,"token_distributor":"0x6dfcF940caf422d33f7CBEB371De75eadBE938BD","chain_id":"0x89"},{"name":"Tokens Earned on Referral","description":"Earned on Referral","hex":"0x6cf8bedd4e1084291a64d6273fbf84b802c19d246801deaaf841448d6a0e391c","earned_on_login":false,"earned_on_referral":true,"token_amount":6,"frequency":0,"frequency_amount":0,"token_distributor":"0x6dfcF940caf422d33f7CBEB371De75eadBE938BD","chain_id":"0x89"}],"Title":"Layered Demo","Primary":"#50C2B2","Logo":"","URL":"","Auth0_settings":{"verifierID":"","clientID":"","domain":""},"socialLogins":{"facebook":true,"google":true,"linkedin":true,"discord":true,"slack":true,"walletconnect":true}},sCe="https://staging.layered.xyz",cCe={name:aCe.Title,url:aCe.URL,primary:aCe.Primary,logo:aCe.Logo,auth0:aCe.Auth0_settings},uCe={},lCe={referred:0,joined:0},fCe={referred:0,joined:0};const dCe=(e,t)=>(e(),setInterval(e,t)),hCe=async()=>{bCe.initialized?bCe.provider?bCe.userSmartAccount||await bCe.provider.getAddress().then((async e=>{console.log(e),bCe.userSmartAccount=e,await rxe().then((async e=>{e&&(console.log(e),bCe.userName=e.name||null)})).catch((e=>console.log("error getting user: info")))})).catch((e=>console.log("error getting user smart account: ",e))):await txe().then((async e=>{e&&(bCe.provider=e,await e.getAddress().then((async e=>{console.log(e),bCe.userSmartAccount=e,await rxe().then((async e=>{e&&(console.log(e),bCe.userName=e.name||null)})).catch((e=>console.log("error getting user: info")))})).catch((e=>console.log("error getting user smart account: ",e))))})).catch((e=>console.log("error getting provider: ",e))):await QAe(cCe).then((async()=>{bCe.initialized=!0,await txe().then((async e=>{e&&(bCe.provider=e,await e.getAddress().then((async e=>{console.log(e),bCe.userSmartAccount=e,await rxe().then((async e=>{e&&(console.log(e),bCe.userName=e.name||null)})).catch((e=>console.log("error getting user: info")))})).catch((e=>console.log("error getting user smart account: ",e))))})).catch((e=>console.log("error getting provider: ",e)))})).catch((e=>console.log("Error while initializing: ",e)))},pCe=()=>{console.log("in the fade out"),mCe((()=>{const e=document.querySelectorAll("#layered-preloader");console.log("preloader ",e),e.length>0&&(console.log("found some preloaders "),e.forEach(((e,t)=>{console.log("adding for ",e),e.style.display="none",e.className="layeredFadeOut"})))}))},mCe=e=>{"complete"===document.readyState||"interactive"===document.readyState?setTimeout(e,1):document.addEventListener("DOMContentLoaded",e)},bCe={initialized:!1,provider:null,userSmartAccount:null,userName:null,requireAuthorization:e=>{let t=!1;(async()=>{bCe.initialized?bCe.provider||(t=!0,window.location.replace(e)):await hCe().then((async()=>{console.log("after init"),bCe.provider||(t=!0,window.location.replace(e))})).catch((e=>console.log("error initializing in requireAuthorization ",e)))})().then((()=>{t?console.log("Should redirect"):pCe()})).catch((e=>{console.log("error interacting with preloader",e)}))},redirectIfAuthorized:e=>{let t=!1;(async()=>{bCe.initialized?bCe.provider&&(console.log("initialized with a provider about to redirect"),t=!0,window.location.replace(e)):await hCe().then((async()=>{bCe.provider&&(console.log("and now in the provider about to redirect"),t=!0,window.location.replace(e))})).catch((e=>console.log("error initializing in redirectIfAuthorized ",e)))})().then((()=>{t?console.log("Should redirect"):pCe()})).catch((e=>{console.log("error interacting with preloader",e)}))}};return mCe((async()=>{var e,t,r,n,i,o;await hCe();const a=aCe.tokenPathways.filter((e=>!0===e.earned_on_login)),s=aCe.tokenPathways.filter((e=>!0===e.earned_on_referral)),c=Tbe(["function fulfillAction(bytes32 actionId, bytes32 proofID, string memory metadata, bytes calldata parameters) public"]);if(bCe.provider){const e=await rxe();fetch(`${sCe}/api/data/users/addUserToApp`,{method:"POST",body:JSON.stringify({smartAddress:bCe.userSmartAccount,app_id:aCe.app_id,user:e}),headers:{"Content-Type":"text/plain"}}).then((async t=>{const r=await t.json();console.log("Successfully added user to app ",r);let n=await fetch(`${sCe}/api/data/earnedpathways`,{method:"POST",body:JSON.stringify({smartAddress:bCe.userSmartAccount,app_id:aCe.app_id,user:e}),headers:{"Content-Type":"text/plain"}}),i=await n.json();console.log("earnedPathways",i),console.log("New user triggering earned on first login action");try{if(bCe.provider)for(var o=0;oe.hex===a[o].hex));if(t[0]){if(2==a[o].frequency&&t.length>=a[o].frequency_amount){console.log("skipping pathway because we alreayd earned it");continue}a[o].frequency}const r=[{type:"string",name:"app_id",value:aCe.app_id.toString()},{type:"string",name:"userAddress",value:bCe.userSmartAccount},{type:"string",name:"_path",value:"status"},{type:"string",name:"_type",value:"int256"}],n=nxe.encode(r);await exe(a[o].chain_id,(async t=>{if(t){const r=Nme(jpe(`${bCe.userSmartAccount||""}+${Date.now()}`)),i=await t.sendUserOperation({target:a[o].token_distributor,data:_ge({abi:c,functionName:"fulfillAction",args:[a[o].hex,r,"",n]})}),s=await t.waitForUserOperationTransaction(i.hash);console.log("Tx for earning tokens upon login: ",s),s&&fetch(`${sCe}/api/data/earnedpathways/new`,{method:"POST",body:JSON.stringify({smartAddress:bCe.userSmartAccount,app_id:aCe.app_id,proof:r,hex:a[o].hex,user:e}),headers:{"Content-Type":"text/plain"}}).then((e=>{console.log("successfully added earnedpathway",e)})).catch((e=>{console.log("error adding earnedpathway",e)}))}}))}}catch(e){console.log("error while earning first login action: ",e)}})).catch((e=>{console.log("Error adding user to app: ",e)})),s.length>0&&dCe((async()=>{fetch(`${sCe}/api/data/referrals`,{method:"POST",body:JSON.stringify({smartAddress:bCe.userSmartAccount,app_id:aCe.app_id,user:e}),headers:{"Content-Type":"text/plain"}}).then((async t=>{let r=await fetch(`${sCe}/api/data/earnedpathways`,{method:"POST",body:JSON.stringify({smartAddress:bCe.userSmartAccount,app_id:aCe.app_id,user:e}),headers:{"Content-Type":"text/plain"}}),n=await r.json();console.log("earnedPathways",n);const i=await t.json();console.log("we got refs!",i);const o=i.userReferrals,a=i.allReferrals;console.log("pathways earned on Ref",s),lCe.referred=o.length,lCe.joined=o.filter((e=>null!=e.referred_user_id)).length,fCe.referred=a.length,fCe.joined=a.filter((e=>null!=e.referred_user_id)).length,console.log("User Ref Counts & Total Ref Counts",lCe,fCe),M();try{if(bCe.provider)for(var u=0;ue.hex===s[u].hex));if(t.filter((e=>e.proof===o[l].proof)).length>0)console.log("we already confirmed this proof!");else{if(t[0]){if(2==s[u].frequency&&t.length>=s[u].frequency_amount){console.log("skipping pathway because we already earned it");continue}s[u].frequency}if(o[l].referred_user_id){const t=[{type:"string",name:"app_id",value:aCe.app_id.toString()},{type:"string",name:"proof",value:o[l].proof},{type:"string",name:"_path",value:"status"},{type:"string",name:"_type",value:"int256"}],r=nxe.encode(t);await exe(s[u].chain_id,(async t=>{if(t){const n=await t.sendUserOperation({target:s[u].token_distributor,data:_ge({abi:c,functionName:"fulfillAction",args:[s[u].hex,o[l].proof,"",r]})}),i=await t.waitForUserOperationTransaction(n.hash);console.log("Tx for earning tokens upon referral: ",i),i&&fetch(`${sCe}/api/data/earnedpathways/new`,{method:"POST",body:JSON.stringify({smartAddress:bCe.userSmartAccount,app_id:aCe.app_id,proof:o[l].proof,hex:s[u].hex,user:e}),headers:{"Content-Type":"text/plain"}}).then((e=>{console.log("successfully added earnedpathway",e)})).catch((e=>{console.log("error adding earnedpathway",e)}))}}))}}}}}catch(e){console.log("Error earning referral: ",e)}}))}),36e5)}const u="https://polygon-amoy.g.alchemy.com/v2/yfPnDjn4YVGDpSBun0Y9jv9XvrRKq1Vs",l="https://polygon-mainnet.g.alchemy.com/v2/26uv2UQi8g99zBpSFbpQ2hqNCYVzQLci",f="https://eth-mainnet.g.alchemy.com/v2/jmYwXxpmuvaarrxh3X2X-0Qu3rfhhxv7",d={"0x13882":"https://amoy.polygonscan.com/","0x89":"https://polygonscan.com/","0x1":"https://etherscan.io/"},h={"0x13882":await eEe({chain:nEe,transport:iwe(u)}),"0x89":await eEe({chain:rEe,transport:iwe(l)}),"0x1":await eEe({chain:tEe,transport:iwe(f)})};console.log(window.location.protocol+"//"+window.location.hostname,aCe.app_id);const p=async(e,t,r)=>{await YAe(e,t,r,window.location.protocol+"//"+window.location.hostname+":"+window.location.port)},m=document.querySelectorAll("#layered-google-login");if(m.length>0){const t=null===(e=m[0].attributes.getNamedItem("lyr-redirectUrl"))||void 0===e?void 0:e.value;console.log("redirectUrl for google ",t),m[0].addEventListener("click",(()=>p("google",null,t||null)))}const b=document.querySelectorAll("#layered-linkedin-login");if(b.length>0){const e=null===(t=b[0].attributes.getNamedItem("lyr-redirectUrl"))||void 0===t?void 0:t.value;b[0].addEventListener("click",(()=>p("linkedin",null,e||null)))}const g=document.querySelectorAll("#layered-facebook-login");if(g.length>0){const e=null===(r=g[0].attributes.getNamedItem("lyr-redirectUrl"))||void 0===r?void 0:r.value;g[0].addEventListener("click",(()=>p("facebook",null,e||null)))}const y=document.querySelectorAll("#layered-email-login-submit"),v=document.querySelectorAll("#layered-email-login-data");if(console.log(v),y.length>0&&v.length>0){const e=null===(n=y[0].attributes.getNamedItem("lyr-redirectUrl"))||void 0===n?void 0:n.value;y[0].addEventListener("click",(()=>p("jwt",v[0].value,e||null)))}document.querySelectorAll("#layered-referral-submit");const w=document.querySelectorAll("#layered-referral-data"),E=document.querySelectorAll("#layered-referral-form");E.length>0&&E[0].addEventListener("submit",(async e=>{if(e.preventDefault(),bCe.provider){const e=await rxe();fetch(`${sCe}/api/data/referrals/new`,{method:"POST",body:JSON.stringify({smartAddress:bCe.userSmartAccount,referral_email:w[0].value,app_id:aCe.app_id,user:e}),headers:{"Content-Type":"text/plain"}}).then((e=>{console.log(e),w[0].value="",console.log("Successfully recorded referral")})).catch((e=>{console.log(e),console.log("Error recording referral")}))}else console.log("Error: You are not logged in, you must be logged in to refer other users.")}));const A=document.querySelectorAll("#layered-login-form");if(A.length>0){const e=null===(i=A[0].attributes.getNamedItem("layered-submit-override"))||void 0===i?void 0:i.value,t=null===(o=A[0].attributes.getNamedItem("lyr-redirectUrl"))||void 0===o?void 0:o.value;"email-login"===e?(console.log("adding email event listener to ",A[0]),A[0].addEventListener("submit",(e=>(e.preventDefault(),p("jwt",v[0].value,t||null),!1)))):"google-login"===e?(console.log("adding google event listener to ",A[0]),A[0].addEventListener("submit",(e=>(e.preventDefault(),p("google",null,t||null),!1)))):(console.log("adding else event listener to ",A[0]),A[0].addEventListener("submit",(e=>(e.preventDefault(),p("jwt",v[0].value,t||null),!1))))}document.querySelectorAll("#layered-discord-login"),document.querySelectorAll("#layered-slack-login");const x=document.querySelectorAll("#layered-error-state"),_=document.querySelectorAll("#layered-success-state");console.log("Success States: ",_);const k=document.querySelectorAll("#layered-logout"),S=async()=>{try{await XAe(),(e=>{var t;let r;for(var n=0;n<_.length;n++)console.log("state: ",_[n]),(null===(t=_[n].attributes.getNamedItem("layeredComponent"))||void 0===t?void 0:t.value)===e&&(r=_[n],r.style.display="flex",setTimeout((()=>{r.style.display="none"}),5e3))})("layered-logout")}catch(e){console.log("Error in logout: ",e)}};k.length>0&&(console.log("Found log out button"),k.forEach(((e,t)=>{e.addEventListener("click",(()=>S()))})));const P=async(e,t,r,n,i)=>{const o=h[t],a=await o.readContract({address:e,abi:r,functionName:n,args:i}).catch((e=>{console.log("Error: ",e),(e=>{var t;let r;for(var n=0;n{r.style.display="none"}),5e3))})("layered-token-balance")}));return a||""},I=document.querySelectorAll("#layered-token-balance");I.length>0&&bCe.userSmartAccount&&(console.log("Balance component: ",I),I.forEach((async(e,t)=>{dCe((async()=>{var t,r;let n=null===(t=e.attributes.getNamedItem("layered-token-collection"))||void 0===t?void 0:t.value,i=(null===(r=e.attributes.getNamedItem("layered-token-chain-id"))||void 0===r?void 0:r.value)||"0x89";const o=await P(n,i,iCe,"balanceOf",[bCe.userSmartAccount||"0x"]);e.textContent=Kge(o)||"",uCe=Object.assign({},uCe)}),2e3)})));const T=document.querySelectorAll("#layered-explorer-link");T.length>0&&T.forEach((async(e,t)=>{var r,n,i;let o=null===(r=e.attributes.getNamedItem("layered-explorer-address"))||void 0===r?void 0:r.value,a=null===(n=e.attributes.getNamedItem("layered-explorer-type"))||void 0===n?void 0:n.value,s=null===(i=e.attributes.getNamedItem("layered-explorer-chain-id"))||void 0===i?void 0:i.value;s||(s="0x89"),o||(o=bCe.userSmartAccount?bCe.userSmartAccount:"0x"),["token","address"].includes(a)||(a="address");let c=`${d[s]}${a}/${o}`;e.setAttribute("href",c)}));const O=document.querySelectorAll("#layered-user-name");O.length>0&&bCe.userName&&O.forEach((async(e,t)=>{e.textContent=bCe.userName}));const M=()=>{const e=document.querySelectorAll("#layered-user-referral-joined-count");e.length>0&&e.forEach((async(e,t)=>{console.log("setting textContent of user referrals joined ",lCe.joined.toString()),e.textContent=lCe.joined.toString()}));const t=document.querySelectorAll("#layered-user-referral-referred-count");t.length>0&&t.forEach((async(e,t)=>{console.log("setting textContent of user referrals joined ",lCe.joined.toString()),e.textContent=lCe.referred.toString()}));const r=document.querySelectorAll("#layered-total-referral-joined-count");r.length>0&&r.forEach((async(e,t)=>{e.textContent=fCe.joined.toString()}));const n=document.querySelectorAll("#layered-total-referral-referred-count");n.length>0&&n.forEach((async(e,t)=>{e.textContent=fCe.referred.toString()}))};document.querySelectorAll("#layered-token-total-supply").forEach((async(e,t)=>{var r,n,i;let o=(null===(r=e.attributes.getNamedItem("layered-token-address"))||void 0===r?void 0:r.value)||"0x",a=(null===(n=e.attributes.getNamedItem("layered-token-chain-id"))||void 0===n?void 0:n.value)||"0x89",s=(null===(i=e.attributes.getNamedItem("layered-token-ignore-address"))||void 0===i?void 0:i.value)||void 0,c=await P(o,a,iCe,"totalSupply",[]),u=s?await P(o,a,iCe,"balanceOf",[s]):BigInt(0);console.log(c,u),c-=u,e.textContent=Kge(c)||""}));document.querySelectorAll("#layered-token-earned-count").forEach((async(e,t)=>{var r,n,i,o;let a,s=(null===(r=e.attributes.getNamedItem("layered-token-distributor-address"))||void 0===r?void 0:r.value)||"0x",c=(null===(n=e.attributes.getNamedItem("layered-token-chain-id"))||void 0===n?void 0:n.value)||"0x89",u=(null===(i=e.attributes.getNamedItem("layered-token-event-hex"))||void 0===i?void 0:i.value)||void 0,l=(null===(o=e.attributes.getNamedItem("layered-token-user-filter"))||void 0===o?void 0:o.value)||void 0,f=h[c],d=await f.getContractEvents({abi:oCe.abi,address:s,fromBlock:"earliest",toBlock:"latest",eventName:"tokenActionEarned"});a=u?l?"current-user"==l?d.filter((e=>e.args.actionId==u)).filter((e=>e.args.earner==bCe.userSmartAccount)).reduce(((e,t)=>e+t.args.payout),BigInt(0)):d.filter((e=>e.args.actionId==u)).filter((e=>e.args.earner==l)).reduce(((e,t)=>e+t.args.payout),BigInt(0)):d.filter((e=>e.args.actionId==u)).reduce(((e,t)=>e+t.args.payout),BigInt(0)):l?"current-user"==l?d.filter((e=>e.args.earner==bCe.userSmartAccount)).reduce(((e,t)=>e+t.args.payout),BigInt(0)):d.filter((e=>e.args.earner==l)).reduce(((e,t)=>e+t.args.payout),BigInt(0)):d.reduce(((e,t)=>e+t.args.payout),BigInt(0)),e.textContent=Kge(a)}))})),bCe}));